@shahmilsaari/memory-core 1.0.5 → 1.0.8

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.
@@ -967,12 +967,12 @@ var seeds = [
967
967
  import { watch } from "chokidar";
968
968
  import { spawnSync } from "child_process";
969
969
  import { existsSync as existsSync6, readdirSync as readdirSync3, readFileSync as readFileSync5, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
970
- import { join as join7, relative as relative2, resolve as resolve4, sep } from "path";
970
+ import { dirname as dirname4, join as join7, relative as relative2, resolve as resolve4, sep } from "path";
971
971
  import chalk from "chalk";
972
972
 
973
973
  // src/generator.ts
974
974
  import { readFileSync as readFileSync4, readdirSync as readdirSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, existsSync as existsSync5 } from "fs";
975
- import { join as join6, dirname as dirname3 } from "path";
975
+ import { join as join6, dirname as dirname3, basename } from "path";
976
976
  import { fileURLToPath } from "url";
977
977
  import Handlebars from "handlebars";
978
978
  import yaml from "js-yaml";
@@ -1881,6 +1881,41 @@ async function retrieveMemorySelection(options) {
1881
1881
  var __filename = fileURLToPath(import.meta.url);
1882
1882
  var __dirname = dirname3(__filename);
1883
1883
  var PKG_ROOT = join6(__dirname, "..");
1884
+ function stringifyProfileScalar(value) {
1885
+ if (typeof value === "string") {
1886
+ const trimmed = value.trim();
1887
+ return trimmed.length > 0 ? trimmed : null;
1888
+ }
1889
+ if (typeof value === "number" || typeof value === "boolean") {
1890
+ return String(value);
1891
+ }
1892
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
1893
+ const entries = Object.entries(value);
1894
+ if (entries.length === 1) {
1895
+ const [key, rawValue] = entries[0];
1896
+ const scalar = stringifyProfileScalar(rawValue);
1897
+ return scalar ? `${key}: ${scalar}` : key;
1898
+ }
1899
+ return JSON.stringify(value);
1900
+ }
1901
+ function normalizeProfileStringList(value) {
1902
+ if (!Array.isArray(value)) return [];
1903
+ return value.map((entry) => stringifyProfileScalar(entry)).filter((entry) => typeof entry === "string" && entry.length > 0);
1904
+ }
1905
+ function normalizeArchitectureProfile(raw, fallbackName = "unknown") {
1906
+ const data = raw && typeof raw === "object" ? raw : {};
1907
+ const name = typeof data.name === "string" && data.name.trim().length > 0 ? data.name.trim() : fallbackName;
1908
+ const layer = data.layer === "frontend" || data.layer === "fullstack" || data.layer === "backend" ? data.layer : "backend";
1909
+ return {
1910
+ name,
1911
+ displayName: typeof data.displayName === "string" && data.displayName.trim().length > 0 ? data.displayName.trim() : name,
1912
+ layer,
1913
+ description: typeof data.description === "string" ? data.description : "",
1914
+ rules: normalizeProfileStringList(data.rules),
1915
+ folders: normalizeProfileStringList(data.folders),
1916
+ avoid: normalizeProfileStringList(data.avoid)
1917
+ };
1918
+ }
1884
1919
  var OUTPUT_FILES = [
1885
1920
  { template: "CLAUDE.md.hbs", path: "CLAUDE.md", agent: "Claude Code" },
1886
1921
  { template: "copilot-instructions.md.hbs", path: ".github/copilot-instructions.md", agent: "GitHub Copilot" },
@@ -1935,11 +1970,16 @@ Handlebars.registerHelper("memoryBlock", (memory) => {
1935
1970
  function loadProfile(name) {
1936
1971
  const profilePath = join6(PKG_ROOT, "profiles", `${name}.yml`);
1937
1972
  if (!existsSync5(profilePath)) throw new Error(`Profile not found: ${name}`);
1938
- return yaml.load(readFileSync4(profilePath, "utf-8"));
1973
+ return normalizeArchitectureProfile(yaml.load(readFileSync4(profilePath, "utf-8")), name);
1939
1974
  }
1940
1975
  function listProfiles(layer) {
1941
1976
  const files = readdirSync2(join6(PKG_ROOT, "profiles")).filter((f) => f.endsWith(".yml"));
1942
- const all = files.map((f) => yaml.load(readFileSync4(join6(PKG_ROOT, "profiles", f), "utf-8")));
1977
+ const all = files.map(
1978
+ (f) => normalizeArchitectureProfile(
1979
+ yaml.load(readFileSync4(join6(PKG_ROOT, "profiles", f), "utf-8")),
1980
+ basename(f, ".yml")
1981
+ )
1982
+ );
1943
1983
  if (!layer) return all;
1944
1984
  if (layer === "backend") return all.filter((p) => p.layer === "backend" || p.layer === "fullstack");
1945
1985
  if (layer === "frontend") return all.filter((p) => p.layer === "frontend" || p.layer === "fullstack");
@@ -2292,6 +2332,28 @@ var SOURCE_EXTENSIONS3 = /\.(ts|tsx|js|jsx|py|php|rb|go|java|cs|swift|kt|rs|vue|
2292
2332
  var reasonMap = new Map(
2293
2333
  seeds.filter((s) => s.reason).map((s) => [s.content, s.reason])
2294
2334
  );
2335
+ function findProjectRoot(startPath) {
2336
+ let current = resolve4(startPath);
2337
+ while (true) {
2338
+ if (existsSync6(join7(current, ".memory-core.json"))) return current;
2339
+ const parent = dirname4(current);
2340
+ if (parent === current) return null;
2341
+ current = parent;
2342
+ }
2343
+ }
2344
+ function resolveWatchPaths(pathOption, projectRootOption) {
2345
+ if (projectRootOption) {
2346
+ const projectRoot2 = resolve4(projectRootOption);
2347
+ return {
2348
+ projectRoot: projectRoot2,
2349
+ watchPath: resolve4(projectRoot2, pathOption ?? ".")
2350
+ };
2351
+ }
2352
+ const cwdRoot = resolve4(process.cwd());
2353
+ const watchPath = resolve4(cwdRoot, pathOption ?? ".");
2354
+ const projectRoot = findProjectRoot(watchPath) ?? findProjectRoot(cwdRoot) ?? cwdRoot;
2355
+ return { projectRoot, watchPath };
2356
+ }
2295
2357
  function readStatsFile(statsPath) {
2296
2358
  if (!existsSync6(statsPath)) return { rules: {}, files: {} };
2297
2359
  try {
@@ -2718,8 +2780,7 @@ ${inputToSend}`;
2718
2780
  }
2719
2781
  }
2720
2782
  async function scanFiles(options = {}) {
2721
- const projectRoot = resolve4(process.cwd());
2722
- const watchPath = resolve4(projectRoot, options.path ?? ".");
2783
+ const { projectRoot, watchPath } = resolveWatchPaths(options.path, options.projectRoot);
2723
2784
  const config2 = loadConfig(projectRoot);
2724
2785
  if (!config2) {
2725
2786
  throw new Error("No .memory-core.json found. Run: memory-core init");
@@ -2758,8 +2819,7 @@ async function scanFiles(options = {}) {
2758
2819
  return summary;
2759
2820
  }
2760
2821
  async function startWatch(options = {}) {
2761
- const projectRoot = resolve4(process.cwd());
2762
- const watchPath = resolve4(projectRoot, options.path ?? ".");
2822
+ const { projectRoot, watchPath } = resolveWatchPaths(options.path, options.projectRoot);
2763
2823
  const config2 = loadConfig(projectRoot);
2764
2824
  const exitOnSetupFailure = options.exitOnSetupFailure ?? true;
2765
2825
  if (!config2) {
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  retrieveMemorySelection,
21
21
  runMigrations,
22
22
  seeds
23
- } from "./chunk-WJG77BPO.js";
23
+ } from "./chunk-PRRVI3YM.js";
24
24
 
25
25
  // src/cli.ts
26
26
  import { Command } from "commander";
@@ -186,6 +186,23 @@ function recordViolations(violations, source = "hook") {
186
186
  stats.recentViolations = [...recent, ...stats.recentViolations ?? []].slice(0, 50);
187
187
  writeFileSync2(statsPath, JSON.stringify(stats, null, 2) + "\n", "utf-8");
188
188
  }
189
+ function resetViolationStats(cwd = process.cwd()) {
190
+ const statsPath = join2(cwd, ".memory-core-stats.json");
191
+ if (!existsSync2(statsPath)) return;
192
+ let stats = {};
193
+ try {
194
+ const parsed = JSON.parse(readFileSync2(statsPath, "utf-8"));
195
+ if (parsed && typeof parsed === "object") {
196
+ stats = parsed;
197
+ }
198
+ } catch {
199
+ stats = {};
200
+ }
201
+ stats.rules = {};
202
+ stats.files = {};
203
+ stats.recentViolations = [];
204
+ writeFileSync2(statsPath, JSON.stringify(stats, null, 2) + "\n", "utf-8");
205
+ }
189
206
  async function promptToSaveViolations(violations) {
190
207
  if (!process.stdin.isTTY || violations.length === 0) return;
191
208
  try {
@@ -360,6 +377,204 @@ function dedupeViolations(violations) {
360
377
  }
361
378
  return deduped;
362
379
  }
380
+ function normalizeKeyPath(value) {
381
+ return value.replace(/\\/g, "/").replace(/^\.\/+/, "").toLowerCase();
382
+ }
383
+ function violationRecurrenceKey(violation) {
384
+ return [
385
+ violation.rule.trim().toLowerCase(),
386
+ normalizeKeyPath(violation.file || "diff"),
387
+ violation.issue.trim().toLowerCase()
388
+ ].join("\0");
389
+ }
390
+ function findRecurringViolations(currentViolations, recentViolations, minCount = 2) {
391
+ if (currentViolations.length === 0 || recentViolations.length === 0) return [];
392
+ const counts = /* @__PURE__ */ new Map();
393
+ for (const recent of recentViolations) {
394
+ const key = violationRecurrenceKey(recent);
395
+ counts.set(key, (counts.get(key) ?? 0) + 1);
396
+ }
397
+ return currentViolations.filter((violation) => (counts.get(violationRecurrenceKey(violation)) ?? 0) >= minCount);
398
+ }
399
+ function extractIssuePhrase(issue) {
400
+ const quoted = issue.match(/"([^"]{3,160})"/);
401
+ if (quoted?.[1]) return quoted[1].trim();
402
+ const afterColon = issue.split(":").slice(1).join(":").trim();
403
+ if (afterColon.length >= 3) return afterColon.slice(0, 180);
404
+ const fallback = issue.trim();
405
+ return fallback.length >= 3 ? fallback.slice(0, 180) : null;
406
+ }
407
+ function buildIgnorePatternFromDecision(decision) {
408
+ const explicit = decision.pattern?.trim();
409
+ if (explicit && explicit.length >= 3) return explicit;
410
+ return extractIssuePhrase(decision.issue);
411
+ }
412
+ function parseFalsePositiveDecision(value) {
413
+ if (!value || typeof value !== "object") return null;
414
+ const candidate = value;
415
+ if (typeof candidate.rule !== "string" || typeof candidate.issue !== "string") return null;
416
+ return {
417
+ rule: candidate.rule,
418
+ file: typeof candidate.file === "string" ? candidate.file : void 0,
419
+ line: typeof candidate.line === "number" ? candidate.line : void 0,
420
+ issue: candidate.issue,
421
+ falsePositive: candidate.falsePositive === true,
422
+ pattern: typeof candidate.pattern === "string" ? candidate.pattern : void 0,
423
+ reason: typeof candidate.reason === "string" ? candidate.reason : void 0
424
+ };
425
+ }
426
+ function parseFalsePositiveDecisions(raw) {
427
+ const candidates = [
428
+ raw,
429
+ raw.replace(/^```(?:json)?\s*/i, "").replace(/\s*```$/i, "")
430
+ ];
431
+ const objectStart = raw.indexOf("{");
432
+ const objectEnd = raw.lastIndexOf("}");
433
+ if (objectStart !== -1 && objectEnd > objectStart) {
434
+ candidates.push(raw.slice(objectStart, objectEnd + 1));
435
+ }
436
+ const arrayStart = raw.indexOf("[");
437
+ const arrayEnd = raw.lastIndexOf("]");
438
+ if (arrayStart !== -1 && arrayEnd > arrayStart) {
439
+ candidates.push(raw.slice(arrayStart, arrayEnd + 1));
440
+ }
441
+ for (const candidate of candidates) {
442
+ try {
443
+ const parsed = JSON.parse(candidate);
444
+ const items = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.decisions) ? parsed.decisions : parsed?.rule ? [parsed] : null;
445
+ if (!items) continue;
446
+ return {
447
+ valid: true,
448
+ decisions: items.map(parseFalsePositiveDecision).filter((decision) => decision !== null)
449
+ };
450
+ } catch {
451
+ }
452
+ }
453
+ return { valid: false, decisions: [] };
454
+ }
455
+ function loadRecentViolationsFromStats(cwd = process.cwd()) {
456
+ const statsPath = join2(cwd, ".memory-core-stats.json");
457
+ if (!existsSync2(statsPath)) return [];
458
+ try {
459
+ const parsed = JSON.parse(readFileSync2(statsPath, "utf-8"));
460
+ if (!Array.isArray(parsed.recentViolations)) return [];
461
+ return parsed.recentViolations.filter(
462
+ (entry) => Boolean(entry) && typeof entry.rule === "string" && typeof entry.issue === "string" && typeof entry.file === "string" && typeof entry.timestamp === "string"
463
+ );
464
+ } catch {
465
+ return [];
466
+ }
467
+ }
468
+ async function learnGlobalIgnoresFromFalsePositives(options) {
469
+ if (options.currentViolations.length === 0) return [];
470
+ const recentViolations = loadRecentViolationsFromStats();
471
+ const recurring = findRecurringViolations(options.currentViolations, recentViolations, 2);
472
+ if (recurring.length === 0) return [];
473
+ const systemPrompt = `You are verifying repeated architecture-rule alerts.
474
+ Mark falsePositive=true ONLY when the alert is clearly a false positive for this staged diff.
475
+ For each false positive, return a concise ignore pattern that will suppress only this recurring false alert.
476
+ Prefer exact snippets from the issue text.
477
+
478
+ Return strict JSON:
479
+ {"decisions":[{"rule":"...","file":"...","line":1,"issue":"...","falsePositive":true,"pattern":"...","reason":"..."}]}
480
+ Do not include any text outside JSON.`;
481
+ const userPrompt = `Staged diff:
482
+ ${options.diff.slice(0, 6e3)}
483
+
484
+ Recurring violations:
485
+ ${JSON.stringify(recurring, null, 2)}
486
+
487
+ Existing allow patterns:
488
+ ${JSON.stringify(options.allowPatterns, null, 2)}`;
489
+ if (options.debug) {
490
+ console.log(chalk.gray("\n [debug] false-positive recheck prompt:"));
491
+ console.log(chalk.dim(systemPrompt));
492
+ console.log(chalk.dim(userPrompt));
493
+ console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
494
+ }
495
+ try {
496
+ const raw = await callChatModel([
497
+ { role: "system", content: systemPrompt },
498
+ { role: "user", content: userPrompt }
499
+ ]);
500
+ const parsed = parseFalsePositiveDecisions(raw);
501
+ if (!parsed.valid) return [];
502
+ const existing = new Set(options.allowPatterns.map((pattern) => pattern.toLowerCase()));
503
+ const app = getDefaultApplicationContainer();
504
+ const inserted = [];
505
+ for (const decision of parsed.decisions) {
506
+ if (!decision.falsePositive) continue;
507
+ const pattern = buildIgnorePatternFromDecision(decision);
508
+ if (!pattern) continue;
509
+ const normalized = pattern.toLowerCase();
510
+ if (existing.has(normalized)) continue;
511
+ try {
512
+ await app.services.memoryEngine.remember({
513
+ type: "ignore",
514
+ scope: "global",
515
+ architecture: "global",
516
+ content: pattern,
517
+ reason: `Auto-added from repeated false-positive recheck for "${decision.rule}"${decision.reason ? `: ${decision.reason}` : ""}`,
518
+ tags: ["ignore", "auto-false-positive"]
519
+ });
520
+ existing.add(normalized);
521
+ inserted.push(pattern);
522
+ } catch {
523
+ }
524
+ }
525
+ return inserted;
526
+ } catch {
527
+ return [];
528
+ }
529
+ }
530
+ function normalizePath(value) {
531
+ return value.replace(/\\/g, "/").replace(/^\.\/+/, "");
532
+ }
533
+ function resolveChangedFile(candidate, changedFiles) {
534
+ const normalizedCandidate = normalizePath(candidate);
535
+ const candidates = [normalizedCandidate];
536
+ if (/^(?:a|b)\//.test(normalizedCandidate)) {
537
+ candidates.push(normalizedCandidate.slice(2));
538
+ }
539
+ for (const current of candidates) {
540
+ if (changedFiles.has(current)) return current;
541
+ for (const changed of changedFiles) {
542
+ if (changed.endsWith(`/${current}`) || current.endsWith(`/${changed}`)) {
543
+ return changed;
544
+ }
545
+ }
546
+ }
547
+ return void 0;
548
+ }
549
+ function buildModelInputFromDiff(diff, maxChars = 8e3) {
550
+ const addedLines = getAddedLines(diff);
551
+ if (addedLines.length === 0) {
552
+ const truncated2 = diff.length > maxChars;
553
+ return {
554
+ text: truncated2 ? diff.slice(0, maxChars) + "\n\n[diff truncated]" : diff,
555
+ source: "diff",
556
+ truncated: truncated2
557
+ };
558
+ }
559
+ const chunks = [];
560
+ let currentFile = "";
561
+ for (const addedLine of addedLines) {
562
+ if (addedLine.file !== currentFile) {
563
+ currentFile = addedLine.file;
564
+ chunks.push(`
565
+ # ${currentFile}`);
566
+ }
567
+ const line = addedLine.line ?? "?";
568
+ chunks.push(`${line}: ${addedLine.content}`);
569
+ }
570
+ const summary = chunks.join("\n").trim();
571
+ const truncated = summary.length > maxChars;
572
+ return {
573
+ text: truncated ? summary.slice(0, maxChars) + "\n\n[added lines truncated]" : summary,
574
+ source: "added-lines",
575
+ truncated
576
+ };
577
+ }
363
578
  function findDeterministicViolations(diff, rules, avoids, allowPatterns = []) {
364
579
  const rulePhrases = rules.flatMap(
365
580
  (rule) => extractForbiddenPhrases(rule).map((phrase) => ({ rule, phrase }))
@@ -391,39 +606,36 @@ function findDeterministicViolations(diff, rules, avoids, allowPatterns = []) {
391
606
  }
392
607
  return dedupeViolations(violations);
393
608
  }
394
- async function verifyViolations(diff, violations, allowPatterns, debug) {
609
+ function filterModelViolationsByStagedDiff(violations, stagedFiles, diff) {
395
610
  if (violations.length === 0) return violations;
396
- const systemPrompt = `You are verifying candidate architecture violations.
397
- Only keep violations that are directly supported by the diff.
398
- Reject speculative or weak matches.
399
- Treat these allowlisted patterns as intentional and valid:
400
- ${allowPatterns.length ? allowPatterns.map((pattern, index) => `${index + 1}. ${pattern}`).join("\n") : "(none)"}
401
-
402
- Return strict JSON:
403
- {"violations":[{"rule":"...","file":"...","line":1,"issue":"...","suggestion":"...","reason":"..."}]}
404
- Do not include any text outside the JSON.`;
405
- const userPrompt = `Diff:
406
- ${diff.slice(0, 6e3)}
407
-
408
- Candidate violations:
409
- ${JSON.stringify(violations, null, 2)}`;
410
- if (debug) {
411
- console.log(chalk.gray("\n [debug] verifier prompt:"));
412
- console.log(chalk.dim(systemPrompt));
413
- console.log(chalk.dim(userPrompt));
414
- console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
415
- }
416
- try {
417
- const raw = await callChatModel([
418
- { role: "system", content: systemPrompt },
419
- { role: "user", content: userPrompt }
420
- ]);
421
- const parsed = parseModelViolations(raw);
422
- if (parsed.valid) return parsed.violations;
423
- return violations;
424
- } catch {
425
- return violations;
611
+ const changedFiles = new Set(stagedFiles.map((file) => normalizePath(file)));
612
+ if (changedFiles.size === 0) return [];
613
+ const linesByFile = /* @__PURE__ */ new Map();
614
+ for (const addedLine of getAddedLines(diff)) {
615
+ const file = normalizePath(addedLine.file);
616
+ if (!changedFiles.has(file)) continue;
617
+ if (typeof addedLine.line !== "number") continue;
618
+ const list = linesByFile.get(file) ?? [];
619
+ list.push(addedLine.line);
620
+ linesByFile.set(file, list);
621
+ }
622
+ const LINE_TOLERANCE = 3;
623
+ const filtered = [];
624
+ for (const violation of violations) {
625
+ if (!violation.file || violation.file === "diff") {
626
+ filtered.push(violation);
627
+ continue;
628
+ }
629
+ const resolvedFile = resolveChangedFile(violation.file, changedFiles);
630
+ if (!resolvedFile) continue;
631
+ const candidateLines = linesByFile.get(resolvedFile) ?? [];
632
+ if (typeof violation.line === "number" && candidateLines.length > 0) {
633
+ const supported = candidateLines.some((line) => Math.abs(line - violation.line) <= LINE_TOLERANCE);
634
+ if (!supported) continue;
635
+ }
636
+ filtered.push({ ...violation, file: resolvedFile });
426
637
  }
638
+ return filtered;
427
639
  }
428
640
  function installHook(advisory = true) {
429
641
  if (!existsSync2(".git")) {
@@ -485,12 +697,16 @@ async function checkStaged(options = {}) {
485
697
  let diff;
486
698
  let stagedFiles = [];
487
699
  try {
488
- stagedFiles = execSync("git diff --cached --name-only", { encoding: "utf-8" }).split("\n").filter((f) => f && SOURCE_EXTENSIONS.test(f));
700
+ stagedFiles = execSync("git diff --cached --name-only --diff-filter=ACMRT", { encoding: "utf-8" }).split("\n").filter((f) => f && SOURCE_EXTENSIONS.test(f)).map((f) => normalizePath(f));
489
701
  if (stagedFiles.length === 0) {
490
702
  if (options.verbose) console.log(chalk.gray(" No source files staged \u2014 skipping rule check."));
491
703
  return;
492
704
  }
493
- const result = spawnSync("git", ["diff", "--cached", "--", ...stagedFiles], { encoding: "utf-8" });
705
+ const result = spawnSync(
706
+ "git",
707
+ ["diff", "--cached", "--unified=0", "--diff-filter=ACMRT", "--", ...stagedFiles],
708
+ { encoding: "utf-8" }
709
+ );
494
710
  diff = result.stdout ?? "";
495
711
  } catch {
496
712
  console.error(chalk.red(" Failed to read staged diff."));
@@ -504,15 +720,17 @@ async function checkStaged(options = {}) {
504
720
  if (!existsSync2(configPath)) return;
505
721
  const config = JSON.parse(readFileSync2(configPath, "utf-8"));
506
722
  const { rules: fallbackRules, avoids } = getProfileRules(config);
507
- const rules = await loadRelevantRules(config, diff, stagedFiles, fallbackRules);
508
- const allowPatterns = [.../* @__PURE__ */ new Set([...getAllowPatterns(config), ...await loadIgnorePatterns()])];
723
+ const [rules, ignores] = await Promise.all([
724
+ loadRelevantRules(config, diff, stagedFiles, fallbackRules),
725
+ loadIgnorePatterns()
726
+ ]);
727
+ const allowPatterns = [.../* @__PURE__ */ new Set([...getAllowPatterns(config), ...ignores])];
509
728
  if (rules.length === 0) return;
510
- const MAX_DIFF = 8e3;
511
- const truncated = diff.length > MAX_DIFF;
512
- const diffToSend = truncated ? diff.slice(0, MAX_DIFF) + "\n\n[diff truncated]" : diff;
729
+ const modelInput = buildModelInputFromDiff(diff, 8e3);
513
730
  console.log(chalk.cyan("\n archmind \u2014 checking staged changes against rules\u2026"));
514
731
  if (options.verbose || options.debug) {
515
- console.log(chalk.gray(` model: ${getChatProviderLabel()} rules: ${rules.length} diff: ${diff.length} chars${truncated ? " (truncated)" : ""}`));
732
+ const sourceLabel = modelInput.source === "added-lines" ? "added lines" : "diff";
733
+ console.log(chalk.gray(` model: ${getChatProviderLabel()} rules: ${rules.length} diff: ${diff.length} chars input: ${sourceLabel}${modelInput.truncated ? " (truncated)" : ""}`));
516
734
  }
517
735
  const rulesWithReasons = rules.map((r, i) => {
518
736
  const why = reasonMap.get(r);
@@ -520,7 +738,7 @@ async function checkStaged(options = {}) {
520
738
  WHY: ${why}` : `${i + 1}. ${r}`;
521
739
  }).join("\n");
522
740
  const systemPrompt = `You are a strict code reviewer enforcing architecture and framework rules.
523
- Analyze the git diff and identify ONLY clear, definite rule violations \u2014 not style preferences.
741
+ Analyze the provided staged changes and identify ONLY clear, definite rule violations \u2014 not style preferences.
524
742
  Use the WHY for each rule to understand intent and judge edge cases correctly.
525
743
 
526
744
  Rules to enforce:
@@ -543,7 +761,8 @@ Do not include any text outside the JSON object.`;
543
761
  console.log(systemPrompt);
544
762
  console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
545
763
  console.log(chalk.gray(` [debug] diff length: ${diff.length} chars`));
546
- console.log(chalk.dim(diffToSend));
764
+ console.log(chalk.gray(` [debug] model input source: ${modelInput.source}`));
765
+ console.log(chalk.dim(modelInput.text));
547
766
  console.log(chalk.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
548
767
  }
549
768
  const deterministicViolations = findDeterministicViolations(diff, rules, avoids, allowPatterns);
@@ -557,9 +776,9 @@ Do not include any text outside the JSON object.`;
557
776
  try {
558
777
  const raw = await callChatModel([
559
778
  { role: "system", content: systemPrompt },
560
- { role: "user", content: `Review this diff:
779
+ { role: "user", content: `Review these staged changes:
561
780
 
562
- ${diffToSend}` }
781
+ ${modelInput.text}` }
563
782
  ]);
564
783
  if (options.verbose || options.debug) {
565
784
  console.log(chalk.gray(` raw response: ${options.debug ? raw : raw.slice(0, 200)}`));
@@ -585,10 +804,26 @@ ${diffToSend}` }
585
804
  modelViolations = [];
586
805
  }
587
806
  }
588
- modelViolations = await verifyViolations(diff, modelViolations, allowPatterns, options.debug ?? false);
807
+ modelViolations = filterModelViolationsByStagedDiff(modelViolations, stagedFiles, diff);
589
808
  let violations = dedupeViolations([...deterministicViolations, ...astViolations, ...modelViolations]);
590
809
  violations = applyAllowPatterns(violations, allowPatterns);
810
+ if (violations.length > 0) {
811
+ const learnedPatterns = await learnGlobalIgnoresFromFalsePositives({
812
+ diff,
813
+ currentViolations: violations,
814
+ allowPatterns,
815
+ debug: options.debug
816
+ });
817
+ if (learnedPatterns.length > 0) {
818
+ if (options.verbose || options.debug) {
819
+ console.log(chalk.gray(` learned ${learnedPatterns.length} global ignore pattern${learnedPatterns.length > 1 ? "s" : ""} from false-positive recheck`));
820
+ }
821
+ const refinedAllowPatterns = [.../* @__PURE__ */ new Set([...allowPatterns, ...learnedPatterns])];
822
+ violations = applyAllowPatterns(violations, refinedAllowPatterns);
823
+ }
824
+ }
591
825
  if (violations.length === 0) {
826
+ resetViolationStats();
592
827
  console.log(chalk.green(" \u2713 No rule violations \u2014 commit allowed.\n"));
593
828
  return;
594
829
  }
@@ -2127,7 +2362,7 @@ program.command("stats").description("Show violation counters recorded by check
2127
2362
  }
2128
2363
  });
2129
2364
  program.command("dashboard").description("Start the live Svelte dashboard with WebSocket watch events").option("-p, --port <port>", "Dashboard port", "5178").option("--path <dir>", "Directory to watch (default: current directory)").option("--no-watch", "Serve the dashboard without starting file watch").action(async (opts) => {
2130
- const { startDashboard } = await import("./dashboard-server-OEDFMSFB.js");
2365
+ const { startDashboard } = await import("./dashboard-server-TNHWMEZO.js");
2131
2366
  await startDashboard({
2132
2367
  port: parseInt(opts.port, 10),
2133
2368
  path: opts.path,
@@ -0,0 +1,2 @@
1
+ var Vl=Object.defineProperty;var Hn=e=>{throw TypeError(e)};var ql=(e,t,r)=>t in e?Vl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var je=(e,t,r)=>ql(e,typeof t!="symbol"?t+"":t,r),is=(e,t,r)=>t.has(e)||Hn("Cannot "+r);var c=(e,t,r)=>(is(e,t,"read from private field"),r?r.call(e):t.get(e)),R=(e,t,r)=>t.has(e)?Hn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),D=(e,t,r,s)=>(is(e,t,"write to private field"),s?s.call(e,r):t.set(e,r),r),q=(e,t,r)=>(is(e,t,"access private method"),r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const f of i.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();const Ul=!1;var As=Array.isArray,zl=Array.prototype.indexOf,Gt=Array.prototype.includes,zr=Array.from,Hl=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,va=Object.getOwnPropertyDescriptors,Bl=Object.prototype,Kl=Array.prototype,Ts=Object.getPrototypeOf,Bn=Object.isExtensible;const Yl=()=>{};function Gl(e){return e()}function vs(e){for(var t=0;t<e.length;t++)e[t]()}function da(){var e,t,r=new Promise((s,a)=>{e=s,t=a});return{promise:r,resolve:e,reject:t}}const oe=2,Jt=4,xr=8,pa=1<<24,Ge=16,We=32,ht=64,ds=128,Re=512,Z=1024,ae=2048,Ve=4096,ue=8192,Ne=16384,jt=32768,Kn=1<<25,Qt=65536,ps=1<<17,Jl=1<<18,er=1<<19,_a=1<<20,Ye=1<<25,Dt=65536,$r=1<<21,_r=1<<22,pt=1<<23,Ct=Symbol("$state"),et=new class extends Error{constructor(){super(...arguments);je(this,"name","StaleReactionError");je(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function ha(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ql(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Xl(e,t,r){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Zl(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function eo(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function to(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ro(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function so(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function no(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ao(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function io(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const lo=1,oo=2,ga=4,co=8,fo=16,uo=2,re=Symbol(),ba="http://www.w3.org/1999/xhtml";function vo(){console.warn("https://svelte.dev/e/derived_inert")}function po(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function _o(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ma(e){return e===this.v}function ho(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function ya(e){return!ho(e,this.v)}let kr=!1,go=!1;function bo(){kr=!0}let B=null;function Xt(e){B=e}function wa(e,t=!1,r){B={p:B,i:!1,c:null,e:null,s:e,x:null,r:O,l:kr&&!t?{s:null,u:null,$:[]}:null}}function Ea(e){var t=B,r=t.e;if(r!==null){t.e=null;for(var s of r)Ua(s)}return t.i=!0,B=t.p,{}}function Sr(){return!kr||B!==null&&B.l===null}let wt=[];function xa(){var e=wt;wt=[],vs(e)}function _t(e){if(wt.length===0&&!vr){var t=wt;queueMicrotask(()=>{t===wt&&xa()})}wt.push(e)}function mo(){for(;wt.length>0;)xa()}function ka(e){var t=O;if(t===null)return F.f|=pt,e;if(!(t.f&jt)&&!(t.f&Jt))throw e;dt(e,t)}function dt(e,t){for(;t!==null;){if(t.f&ds){if(!(t.f&jt))throw e;try{t.b.error(e);return}catch(r){e=r}}t=t.parent}throw e}const yo=-7169;function G(e,t){e.f=e.f&yo|t}function Cs(e){e.f&Re||e.deps===null?G(e,Z):G(e,Ve)}function Sa(e){if(e!==null)for(const t of e)!(t.f&oe)||!(t.f&Dt)||(t.f^=Dt,Sa(t.deps))}function Aa(e,t,r){e.f&ae?t.add(e):e.f&Ve&&r.add(e),Sa(e.deps),G(e,Z)}const yt=new Set;let S=null,ne=null,_s=null,vr=!1,ls=!1,Ut=null,Dr=null;var Yn=0;let wo=1;var zt,Ht,xt,tt,He,gr,be,br,ut,rt,Be,Bt,Kt,kt,ee,Or,Ta,Fr,hs,Ir,Eo;const Vr=class Vr{constructor(){R(this,ee);je(this,"id",wo++);je(this,"current",new Map);je(this,"previous",new Map);R(this,zt,new Set);R(this,Ht,new Set);R(this,xt,new Set);R(this,tt,new Map);R(this,He,new Map);R(this,gr,null);R(this,be,[]);R(this,br,[]);R(this,ut,new Set);R(this,rt,new Set);R(this,Be,new Map);R(this,Bt,new Set);je(this,"is_fork",!1);R(this,Kt,!1);R(this,kt,new Set)}skip_effect(t){c(this,Be).has(t)||c(this,Be).set(t,{d:[],m:[]}),c(this,Bt).delete(t)}unskip_effect(t,r=s=>this.schedule(s)){var s=c(this,Be).get(t);if(s){c(this,Be).delete(t);for(var a of s.d)G(a,ae),r(a);for(a of s.m)G(a,Ve),r(a)}c(this,Bt).add(t)}capture(t,r,s=!1){t.v!==re&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&pt||(this.current.set(t,[r,s]),ne==null||ne.set(t,r)),this.is_fork||(t.v=r)}activate(){S=this}deactivate(){S=null,ne=null}flush(){try{ls=!0,S=this,q(this,ee,Fr).call(this)}finally{Yn=0,_s=null,Ut=null,Dr=null,ls=!1,S=null,ne=null,Rt.clear()}}discard(){for(const t of c(this,Ht))t(this);c(this,Ht).clear(),c(this,xt).clear(),yt.delete(this)}register_created_effect(t){c(this,br).push(t)}increment(t,r){let s=c(this,tt).get(r)??0;if(c(this,tt).set(r,s+1),t){let a=c(this,He).get(r)??0;c(this,He).set(r,a+1)}}decrement(t,r,s){let a=c(this,tt).get(r)??0;if(a===1?c(this,tt).delete(r):c(this,tt).set(r,a-1),t){let i=c(this,He).get(r)??0;i===1?c(this,He).delete(r):c(this,He).set(r,i-1)}c(this,Kt)||s||(D(this,Kt,!0),_t(()=>{D(this,Kt,!1),this.flush()}))}transfer_effects(t,r){for(const s of t)c(this,ut).add(s);for(const s of r)c(this,rt).add(s);t.clear(),r.clear()}oncommit(t){c(this,zt).add(t)}ondiscard(t){c(this,Ht).add(t)}on_fork_commit(t){c(this,xt).add(t)}run_fork_commit_callbacks(){for(const t of c(this,xt))t(this);c(this,xt).clear()}settled(){return(c(this,gr)??D(this,gr,da())).promise}static ensure(){if(S===null){const t=S=new Vr;ls||(yt.add(S),vr||_t(()=>{S===t&&t.flush()}))}return S}apply(){{ne=null;return}}schedule(t){var a;if(_s=t,(a=t.b)!=null&&a.is_pending&&t.f&(Jt|xr|pa)&&!(t.f&jt)){t.b.defer_effect(t);return}for(var r=t;r.parent!==null;){r=r.parent;var s=r.f;if(Ut!==null&&r===O&&(F===null||!(F.f&oe)))return;if(s&(ht|We)){if(!(s&Z))return;r.f^=Z}}c(this,be).push(r)}};zt=new WeakMap,Ht=new WeakMap,xt=new WeakMap,tt=new WeakMap,He=new WeakMap,gr=new WeakMap,be=new WeakMap,br=new WeakMap,ut=new WeakMap,rt=new WeakMap,Be=new WeakMap,Bt=new WeakMap,Kt=new WeakMap,kt=new WeakMap,ee=new WeakSet,Or=function(){return this.is_fork||c(this,He).size>0},Ta=function(){for(const s of c(this,kt))for(const a of c(s,He).keys()){for(var t=!1,r=a;r.parent!==null;){if(c(this,Be).has(r)){t=!0;break}r=r.parent}if(!t)return!0}return!1},Fr=function(){var d,u;if(Yn++>1e3&&(yt.delete(this),ko()),!q(this,ee,Or).call(this)){for(const p of c(this,ut))c(this,rt).delete(p),G(p,ae),this.schedule(p);for(const p of c(this,rt))G(p,Ve),this.schedule(p)}const t=c(this,be);D(this,be,[]),this.apply();var r=Ut=[],s=[],a=Dr=[];for(const p of t)try{q(this,ee,hs).call(this,p,r,s)}catch(g){throw Na(p),g}if(S=null,a.length>0){var i=Vr.ensure();for(const p of a)i.schedule(p)}if(Ut=null,Dr=null,q(this,ee,Or).call(this)||q(this,ee,Ta).call(this)){q(this,ee,Ir).call(this,s),q(this,ee,Ir).call(this,r);for(const[p,g]of c(this,Be))Ra(p,g)}else{c(this,tt).size===0&&yt.delete(this),c(this,ut).clear(),c(this,rt).clear();for(const p of c(this,zt))p(this);c(this,zt).clear(),Gn(s),Gn(r),(d=c(this,gr))==null||d.resolve()}var f=S;if(c(this,be).length>0){const p=f??(f=this);c(p,be).push(...c(this,be).filter(g=>!c(p,be).includes(g)))}f!==null&&(yt.add(f),q(u=f,ee,Fr).call(u))},hs=function(t,r,s){t.f^=Z;for(var a=t.first;a!==null;){var i=a.f,f=(i&(We|ht))!==0,d=f&&(i&Z)!==0,u=d||(i&ue)!==0||c(this,Be).has(a);if(!u&&a.fn!==null){f?a.f^=Z:i&Jt?r.push(a):tr(a)&&(i&Ge&&c(this,rt).add(a),It(a));var p=a.first;if(p!==null){a=p;continue}}for(;a!==null;){var g=a.next;if(g!==null){a=g;break}a=a.parent}}},Ir=function(t){for(var r=0;r<t.length;r+=1)Aa(t[r],c(this,ut),c(this,rt))},Eo=function(){var g,x,w;for(const y of yt){var t=y.id<this.id,r=[];for(const[o,[T,m]]of this.current){if(y.current.has(o)){var s=y.current.get(o)[0];if(t&&T!==s)y.current.set(o,[T,m]);else continue}r.push(o)}var a=[...y.current.keys()].filter(o=>!this.current.has(o));if(a.length===0)t&&y.discard();else if(r.length>0){if(t)for(const o of c(this,Bt))y.unskip_effect(o,T=>{var m;T.f&(Ge|_r)?y.schedule(T):q(m=y,ee,Ir).call(m,[T])});y.activate();var i=new Set,f=new Map;for(var d of r)Ca(d,a,i,f);f=new Map;var u=[...y.current.keys()].filter(o=>this.current.has(o)?this.current.get(o)[0]!==o:!0);for(const o of c(this,br))!(o.f&(Ne|ue|ps))&&Rs(o,u,f)&&(o.f&(_r|Ge)?(G(o,ae),y.schedule(o)):c(y,ut).add(o));if(c(y,be).length>0){y.apply();for(var p of c(y,be))q(g=y,ee,hs).call(g,p,[],[]);D(y,be,[])}y.deactivate()}}for(const y of yt)c(y,kt).has(this)&&(c(y,kt).delete(this),c(y,kt).size===0&&!q(x=y,ee,Or).call(x)&&(y.activate(),q(w=y,ee,Fr).call(w)))};let Ot=Vr;function xo(e){var t=vr;vr=!0;try{for(var r;;){if(mo(),S===null)return r;S.flush()}}finally{vr=t}}function ko(){try{ro()}catch(e){dt(e,_s)}}let Le=null;function Gn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var s=e[r++];if(!(s.f&(Ne|ue))&&tr(s)&&(Le=new Set,It(s),s.deps===null&&s.first===null&&s.nodes===null&&s.teardown===null&&s.ac===null&&Ha(s),(Le==null?void 0:Le.size)>0)){Rt.clear();for(const a of Le){if(a.f&(Ne|ue))continue;const i=[a];let f=a.parent;for(;f!==null;)Le.has(f)&&(Le.delete(f),i.push(f)),f=f.parent;for(let d=i.length-1;d>=0;d--){const u=i[d];u.f&(Ne|ue)||It(u)}}Le.clear()}}Le=null}}function Ca(e,t,r,s){if(!r.has(e)&&(r.add(e),e.reactions!==null))for(const a of e.reactions){const i=a.f;i&oe?Ca(a,t,r,s):i&(_r|Ge)&&!(i&ae)&&Rs(a,t,s)&&(G(a,ae),Ns(a))}}function Rs(e,t,r){const s=r.get(e);if(s!==void 0)return s;if(e.deps!==null)for(const a of e.deps){if(Gt.call(t,a))return!0;if(a.f&oe&&Rs(a,t,r))return r.set(a,!0),!0}return r.set(e,!1),!1}function Ns(e){S.schedule(e)}function Ra(e,t){if(!(e.f&We&&e.f&Z)){e.f&ae?t.d.push(e):e.f&Ve&&t.m.push(e),G(e,Z);for(var r=e.first;r!==null;)Ra(r,t),r=r.next}}function Na(e){G(e,Z);for(var t=e.first;t!==null;)Na(t),t=t.next}function So(e){let t=0,r=Ft(0),s;return()=>{Fs()&&(n(r),Br(()=>(t===0&&(s=b(()=>e(()=>dr(r)))),t+=1,()=>{_t(()=>{t-=1,t===0&&(s==null||s(),s=void 0,dr(r))})})))}}var Ao=Qt|er;function To(e,t,r,s){new Co(e,t,r,s)}var Se,Ss,Ae,St,de,Te,fe,me,st,At,vt,Yt,mr,yr,nt,qr,J,Ro,No,Mo,gs,jr,Lr,bs,ms;class Co{constructor(t,r,s,a){R(this,J);je(this,"parent");je(this,"is_pending",!1);je(this,"transform_error");R(this,Se);R(this,Ss,null);R(this,Ae);R(this,St);R(this,de);R(this,Te,null);R(this,fe,null);R(this,me,null);R(this,st,null);R(this,At,0);R(this,vt,0);R(this,Yt,!1);R(this,mr,new Set);R(this,yr,new Set);R(this,nt,null);R(this,qr,So(()=>(D(this,nt,Ft(c(this,At))),()=>{D(this,nt,null)})));var i;D(this,Se,t),D(this,Ae,r),D(this,St,f=>{var d=O;d.b=this,d.f|=ds,s(f)}),this.parent=O.b,this.transform_error=a??((i=this.parent)==null?void 0:i.transform_error)??(f=>f),D(this,de,js(()=>{q(this,J,gs).call(this)},Ao))}defer_effect(t){Aa(t,c(this,mr),c(this,yr))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(this,Ae).pending}update_pending_count(t,r){q(this,J,bs).call(this,t,r),D(this,At,c(this,At)+t),!(!c(this,nt)||c(this,Yt))&&(D(this,Yt,!0),_t(()=>{D(this,Yt,!1),c(this,nt)&&Zt(c(this,nt),c(this,At))}))}get_effect_pending(){return c(this,qr).call(this),n(c(this,nt))}error(t){if(!c(this,Ae).onerror&&!c(this,Ae).failed)throw t;S!=null&&S.is_fork?(c(this,Te)&&S.skip_effect(c(this,Te)),c(this,fe)&&S.skip_effect(c(this,fe)),c(this,me)&&S.skip_effect(c(this,me)),S.on_fork_commit(()=>{q(this,J,ms).call(this,t)})):q(this,J,ms).call(this,t)}}Se=new WeakMap,Ss=new WeakMap,Ae=new WeakMap,St=new WeakMap,de=new WeakMap,Te=new WeakMap,fe=new WeakMap,me=new WeakMap,st=new WeakMap,At=new WeakMap,vt=new WeakMap,Yt=new WeakMap,mr=new WeakMap,yr=new WeakMap,nt=new WeakMap,qr=new WeakMap,J=new WeakSet,Ro=function(){try{D(this,Te,Ce(()=>c(this,St).call(this,c(this,Se))))}catch(t){this.error(t)}},No=function(t){const r=c(this,Ae).failed;r&&D(this,me,Ce(()=>{r(c(this,Se),()=>t,()=>()=>{})}))},Mo=function(){const t=c(this,Ae).pending;t&&(this.is_pending=!0,D(this,fe,Ce(()=>t(c(this,Se)))),_t(()=>{var r=D(this,st,document.createDocumentFragment()),s=at();r.append(s),D(this,Te,q(this,J,Lr).call(this,()=>Ce(()=>c(this,St).call(this,s)))),c(this,vt)===0&&(c(this,Se).before(r),D(this,st,null),Nt(c(this,fe),()=>{D(this,fe,null)}),q(this,J,jr).call(this,S))}))},gs=function(){try{if(this.is_pending=this.has_pending_snippet(),D(this,vt,0),D(this,At,0),D(this,Te,Ce(()=>{c(this,St).call(this,c(this,Se))})),c(this,vt)>0){var t=D(this,st,document.createDocumentFragment());$s(c(this,Te),t);const r=c(this,Ae).pending;D(this,fe,Ce(()=>r(c(this,Se))))}else q(this,J,jr).call(this,S)}catch(r){this.error(r)}},jr=function(t){this.is_pending=!1,t.transfer_effects(c(this,mr),c(this,yr))},Lr=function(t){var r=O,s=F,a=B;Oe(c(this,de)),De(c(this,de)),Xt(c(this,de).ctx);try{return Ot.ensure(),t()}catch(i){return ka(i),null}finally{Oe(r),De(s),Xt(a)}},bs=function(t,r){var s;if(!this.has_pending_snippet()){this.parent&&q(s=this.parent,J,bs).call(s,t,r);return}D(this,vt,c(this,vt)+t),c(this,vt)===0&&(q(this,J,jr).call(this,r),c(this,fe)&&Nt(c(this,fe),()=>{D(this,fe,null)}),c(this,st)&&(c(this,Se).before(c(this,st)),D(this,st,null)))},ms=function(t){c(this,Te)&&(_e(c(this,Te)),D(this,Te,null)),c(this,fe)&&(_e(c(this,fe)),D(this,fe,null)),c(this,me)&&(_e(c(this,me)),D(this,me,null));var r=c(this,Ae).onerror;let s=c(this,Ae).failed;var a=!1,i=!1;const f=()=>{if(a){_o();return}a=!0,i&&io(),c(this,me)!==null&&Nt(c(this,me),()=>{D(this,me,null)}),q(this,J,Lr).call(this,()=>{q(this,J,gs).call(this)})},d=u=>{try{i=!0,r==null||r(u,f),i=!1}catch(p){dt(p,c(this,de)&&c(this,de).parent)}s&&D(this,me,q(this,J,Lr).call(this,()=>{try{return Ce(()=>{var p=O;p.b=this,p.f|=ds,s(c(this,Se),()=>u,()=>f)})}catch(p){return dt(p,c(this,de).parent),null}}))};_t(()=>{var u;try{u=this.transform_error(t)}catch(p){dt(p,c(this,de)&&c(this,de).parent);return}u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(d,p=>dt(p,c(this,de)&&c(this,de).parent)):d(u)})};function Do(e,t,r,s){const a=Sr()?Ms:Da;var i=e.filter(w=>!w.settled);if(r.length===0&&i.length===0){s(t.map(a));return}var f=O,d=Oo(),u=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(w=>w.promise)):null;function p(w){d();try{s(w)}catch(y){f.f&Ne||dt(y,f)}Wr()}if(r.length===0){u.then(()=>p(t.map(a)));return}var g=Ma();function x(){Promise.all(r.map(w=>Fo(w))).then(w=>p([...t.map(a),...w])).catch(w=>dt(w,f)).finally(()=>g())}u?u.then(()=>{d(),x(),Wr()}):x()}function Oo(){var e=O,t=F,r=B,s=S;return function(i=!0){Oe(e),De(t),Xt(r),i&&!(e.f&Ne)&&(s==null||s.activate(),s==null||s.apply())}}function Wr(e=!0){Oe(null),De(null),Xt(null),e&&(S==null||S.deactivate())}function Ma(){var e=O,t=e.b,r=S,s=t.is_rendered();return t.update_pending_count(1,r),r.increment(s,e),(a=!1)=>{t.update_pending_count(-1,r),r.decrement(s,e,a)}}function Ms(e){var t=oe|ae;return O!==null&&(O.f|=er),{ctx:B,deps:null,effects:null,equals:ma,f:t,fn:e,reactions:null,rv:0,v:re,wv:0,parent:O,ac:null}}function Fo(e,t,r){let s=O;s===null&&Ql();var a=void 0,i=Ft(re),f=!F,d=new Map;return Go(()=>{var y;var u=O,p=da();a=p.promise;try{Promise.resolve(e()).then(p.resolve,p.reject).finally(Wr)}catch(o){p.reject(o),Wr()}var g=S;if(f){if(u.f&jt)var x=Ma();if(s.b.is_rendered())(y=d.get(g))==null||y.reject(et),d.delete(g);else{for(const o of d.values())o.reject(et);d.clear()}d.set(g,p)}const w=(o,T=void 0)=>{if(x){var m=T===et;x(m)}if(!(T===et||u.f&Ne)){if(g.activate(),T)i.f|=pt,Zt(i,T);else{i.f&pt&&(i.f^=pt),Zt(i,o);for(const[C,W]of d){if(d.delete(C),C===g)break;W.reject(et)}}g.deactivate()}};p.promise.then(w,o=>w(null,o||"unknown"))}),Is(()=>{for(const u of d.values())u.reject(et)}),new Promise(u=>{function p(g){function x(){g===a?u(i):p(a)}g.then(x,x)}p(a)})}function Da(e){const t=Ms(e);return t.equals=ya,t}function Io(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)_e(t[r])}}function Ds(e){var t,r=O,s=e.parent;if(!gt&&s!==null&&s.f&(Ne|ue))return vo(),e.v;Oe(s);try{e.f&=~Dt,Io(e),t=Qa(e)}finally{Oe(r)}return t}function Oa(e){var t=Ds(e);if(!e.equals(t)&&(e.wv=Ga(),(!(S!=null&&S.is_fork)||e.deps===null)&&(S!==null?S.capture(e,t,!0):e.v=t,e.deps===null))){G(e,Z);return}gt||(ne!==null?(Fs()||S!=null&&S.is_fork)&&ne.set(e,t):Cs(e))}function jo(e){var t,r;if(e.effects!==null)for(const s of e.effects)(s.teardown||s.ac)&&((t=s.teardown)==null||t.call(s),(r=s.ac)==null||r.abort(et),s.teardown=Yl,s.ac=null,hr(s,0),Ls(s))}function Fa(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&It(t)}let ys=new Set;const Rt=new Map;let Ia=!1;function Ft(e,t){var r={f:0,v:e,reactions:null,equals:ma,rv:0,wv:0};return r}function ct(e,t){const r=Ft(e);return Xo(r),r}function X(e,t=!1,r=!0){var a;const s=Ft(e);return t||(s.equals=ya),kr&&r&&B!==null&&B.l!==null&&((a=B.l).s??(a.s=[])).push(s),s}function ir(e,t){return M(e,b(()=>n(e))),t}function M(e,t,r=!1){F!==null&&(!$e||F.f&ps)&&Sr()&&F.f&(oe|Ge|_r|ps)&&(Me===null||!Gt.call(Me,e))&&ao();let s=r?cr(t):t;return Zt(e,s,Dr)}function Zt(e,t,r=null){if(!e.equals(t)){Rt.set(e,gt?t:e.v);var s=Ot.ensure();if(s.capture(e,t),e.f&oe){const a=e;e.f&ae&&Ds(a),ne===null&&Cs(a)}e.wv=Ga(),ja(e,ae,r),Sr()&&O!==null&&O.f&Z&&!(O.f&(We|ht))&&(ke===null?Zo([e]):ke.push(e)),!s.is_fork&&ys.size>0&&!Ia&&Lo()}return t}function Lo(){Ia=!1;for(const e of ys)e.f&Z&&G(e,Ve),tr(e)&&It(e);ys.clear()}function dr(e){M(e,e.v+1)}function ja(e,t,r){var s=e.reactions;if(s!==null)for(var a=Sr(),i=s.length,f=0;f<i;f++){var d=s[f],u=d.f;if(!(!a&&d===O)){var p=(u&ae)===0;if(p&&G(d,t),u&oe){var g=d;ne==null||ne.delete(g),u&Dt||(u&Re&&(O===null||!(O.f&$r))&&(d.f|=Dt),ja(g,Ve,r))}else if(p){var x=d;u&Ge&&Le!==null&&Le.add(x),r!==null?r.push(x):Ns(x)}}}}function cr(e){if(typeof e!="object"||e===null||Ct in e)return e;const t=Ts(e);if(t!==Bl&&t!==Kl)return e;var r=new Map,s=As(e),a=ct(0),i=Mt,f=d=>{if(Mt===i)return d();var u=F,p=Mt;De(null),ea(i);var g=d();return De(u),ea(p),g};return s&&r.set("length",ct(e.length)),new Proxy(e,{defineProperty(d,u,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&so();var g=r.get(u);return g===void 0?f(()=>{var x=ct(p.value);return r.set(u,x),x}):M(g,p.value,!0),!0},deleteProperty(d,u){var p=r.get(u);if(p===void 0){if(u in d){const g=f(()=>ct(re));r.set(u,g),dr(a)}}else M(p,re),dr(a);return!0},get(d,u,p){var y;if(u===Ct)return e;var g=r.get(u),x=u in d;if(g===void 0&&(!x||(y=ur(d,u))!=null&&y.writable)&&(g=f(()=>{var o=cr(x?d[u]:re),T=ct(o);return T}),r.set(u,g)),g!==void 0){var w=n(g);return w===re?void 0:w}return Reflect.get(d,u,p)},getOwnPropertyDescriptor(d,u){var p=Reflect.getOwnPropertyDescriptor(d,u);if(p&&"value"in p){var g=r.get(u);g&&(p.value=n(g))}else if(p===void 0){var x=r.get(u),w=x==null?void 0:x.v;if(x!==void 0&&w!==re)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return p},has(d,u){var w;if(u===Ct)return!0;var p=r.get(u),g=p!==void 0&&p.v!==re||Reflect.has(d,u);if(p!==void 0||O!==null&&(!g||(w=ur(d,u))!=null&&w.writable)){p===void 0&&(p=f(()=>{var y=g?cr(d[u]):re,o=ct(y);return o}),r.set(u,p));var x=n(p);if(x===re)return!1}return g},set(d,u,p,g){var L;var x=r.get(u),w=u in d;if(s&&u==="length")for(var y=p;y<x.v;y+=1){var o=r.get(y+"");o!==void 0?M(o,re):y in d&&(o=f(()=>ct(re)),r.set(y+"",o))}if(x===void 0)(!w||(L=ur(d,u))!=null&&L.writable)&&(x=f(()=>ct(void 0)),M(x,cr(p)),r.set(u,x));else{w=x.v!==re;var T=f(()=>cr(p));M(x,T)}var m=Reflect.getOwnPropertyDescriptor(d,u);if(m!=null&&m.set&&m.set.call(g,p),!w){if(s&&typeof u=="string"){var C=r.get("length"),W=Number(u);Number.isInteger(W)&&W>=C.v&&M(C,W+1)}dr(a)}return!0},ownKeys(d){n(a);var u=Reflect.ownKeys(d).filter(x=>{var w=r.get(x);return w===void 0||w.v!==re});for(var[p,g]of r)g.v!==re&&!(p in d)&&u.push(p);return u},setPrototypeOf(){no()}})}function Jn(e){try{if(e!==null&&typeof e=="object"&&Ct in e)return e[Ct]}catch{}return e}function Po(e,t){return Object.is(Jn(e),Jn(t))}var Qn,La,Pa,$a;function $o(){if(Qn===void 0){Qn=window,La=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Pa=ur(t,"firstChild").get,$a=ur(t,"nextSibling").get,Bn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Bn(r)&&(r.__t=void 0)}}function at(e=""){return document.createTextNode(e)}function Os(e){return Pa.call(e)}function Ar(e){return $a.call(e)}function _(e,t){return Os(e)}function Wo(e,t=!1){{var r=Os(e);return r instanceof Comment&&r.data===""?Ar(r):r}}function h(e,t=1,r=!1){let s=e;for(;t--;)s=Ar(s);return s}function Vo(e){e.textContent=""}function Wa(){return!1}function qo(e,t,r){return document.createElementNS(ba,e,void 0)}let Xn=!1;function Uo(){Xn||(Xn=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const r of e.target.elements)(t=r.__on_r)==null||t.call(r)})},{capture:!0}))}function Hr(e){var t=F,r=O;De(null),Oe(null);try{return e()}finally{De(t),Oe(r)}}function Va(e,t,r,s=r){e.addEventListener(t,()=>Hr(r));const a=e.__on_r;a?e.__on_r=()=>{a(),s(!0)}:e.__on_r=()=>s(!0),Uo()}function qa(e){O===null&&(F===null&&to(),eo()),gt&&Zl()}function zo(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function Je(e,t){var r=O;r!==null&&r.f&ue&&(e|=ue);var s={ctx:B,deps:null,nodes:null,f:e|ae|Re,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};S==null||S.register_created_effect(s);var a=s;if(e&Jt)Ut!==null?Ut.push(s):Ot.ensure().schedule(s);else if(t!==null){try{It(s)}catch(f){throw _e(s),f}a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&!(a.f&er)&&(a=a.first,e&Ge&&e&Qt&&a!==null&&(a.f|=Qt))}if(a!==null&&(a.parent=r,r!==null&&zo(a,r),F!==null&&F.f&oe&&!(e&ht))){var i=F;(i.effects??(i.effects=[])).push(a)}return s}function Fs(){return F!==null&&!$e}function Is(e){const t=Je(xr,null);return G(t,Z),t.teardown=e,t}function ws(e){qa();var t=O.f,r=!F&&(t&We)!==0&&(t&jt)===0;if(r){var s=B;(s.e??(s.e=[])).push(e)}else return Ua(e)}function Ua(e){return Je(Jt|_a,e)}function Ho(e){return qa(),Je(xr|_a,e)}function Bo(e){Ot.ensure();const t=Je(ht|er,e);return(r={})=>new Promise(s=>{r.outro?Nt(t,()=>{_e(t),s(void 0)}):(_e(t),s(void 0))})}function Ko(e){return Je(Jt,e)}function xe(e,t){var r=B,s={effect:null,ran:!1,deps:e};r.l.$.push(s),s.effect=Br(()=>{if(e(),!s.ran){s.ran=!0;var a=O;try{Oe(a.parent),b(t)}finally{Oe(a)}}})}function Yo(){var e=B;Br(()=>{for(var t of e.l.$){t.deps();var r=t.effect;r.f&Z&&r.deps!==null&&G(r,Ve),tr(r)&&It(r),t.ran=!1}})}function Go(e){return Je(_r|er,e)}function Br(e,t=0){return Je(xr|t,e)}function U(e,t=[],r=[],s=[]){Do(s,t,r,a=>{Je(xr,()=>e(...a.map(n)))})}function js(e,t=0){var r=Je(Ge|t,e);return r}function Ce(e){return Je(We|er,e)}function za(e){var t=e.teardown;if(t!==null){const r=gt,s=F;Zn(!0),De(null);try{t.call(null)}finally{Zn(r),De(s)}}}function Ls(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const a=r.ac;a!==null&&Hr(()=>{a.abort(et)});var s=r.next;r.f&ht?r.parent=null:_e(r,t),r=s}}function Jo(e){for(var t=e.first;t!==null;){var r=t.next;t.f&We||_e(t),t=r}}function _e(e,t=!0){var r=!1;(t||e.f&Jl)&&e.nodes!==null&&e.nodes.end!==null&&(Qo(e.nodes.start,e.nodes.end),r=!0),G(e,Kn),Ls(e,t&&!r),hr(e,0);var s=e.nodes&&e.nodes.t;if(s!==null)for(const i of s)i.stop();za(e),e.f^=Kn,e.f|=Ne;var a=e.parent;a!==null&&a.first!==null&&Ha(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Qo(e,t){for(;e!==null;){var r=e===t?null:Ar(e);e.remove(),e=r}}function Ha(e){var t=e.parent,r=e.prev,s=e.next;r!==null&&(r.next=s),s!==null&&(s.prev=r),t!==null&&(t.first===e&&(t.first=s),t.last===e&&(t.last=r))}function Nt(e,t,r=!0){var s=[];Ba(e,s,!0);var a=()=>{r&&_e(e),t&&t()},i=s.length;if(i>0){var f=()=>--i||a();for(var d of s)d.out(f)}else a()}function Ba(e,t,r){if(!(e.f&ue)){e.f^=ue;var s=e.nodes&&e.nodes.t;if(s!==null)for(const d of s)(d.is_global||r)&&t.push(d);for(var a=e.first;a!==null;){var i=a.next;if(!(a.f&ht)){var f=(a.f&Qt)!==0||(a.f&We)!==0&&(e.f&Ge)!==0;Ba(a,t,f?r:!1)}a=i}}}function Ps(e){Ka(e,!0)}function Ka(e,t){if(e.f&ue){e.f^=ue,e.f&Z||(G(e,ae),Ot.ensure().schedule(e));for(var r=e.first;r!==null;){var s=r.next,a=(r.f&Qt)!==0||(r.f&We)!==0;Ka(r,a?t:!1),r=s}var i=e.nodes&&e.nodes.t;if(i!==null)for(const f of i)(f.is_global||t)&&f.in()}}function $s(e,t){if(e.nodes)for(var r=e.nodes.start,s=e.nodes.end;r!==null;){var a=r===s?null:Ar(r);t.append(r),r=a}}let Pr=!1,gt=!1;function Zn(e){gt=e}let F=null,$e=!1;function De(e){F=e}let O=null;function Oe(e){O=e}let Me=null;function Xo(e){F!==null&&(Me===null?Me=[e]:Me.push(e))}let pe=null,ge=0,ke=null;function Zo(e){ke=e}let Ya=1,Et=0,Mt=Et;function ea(e){Mt=e}function Ga(){return++Ya}function tr(e){var t=e.f;if(t&ae)return!0;if(t&oe&&(e.f&=~Dt),t&Ve){for(var r=e.deps,s=r.length,a=0;a<s;a++){var i=r[a];if(tr(i)&&Oa(i),i.wv>e.wv)return!0}t&Re&&ne===null&&G(e,Z)}return!1}function Ja(e,t,r=!0){var s=e.reactions;if(s!==null&&!(Me!==null&&Gt.call(Me,e)))for(var a=0;a<s.length;a++){var i=s[a];i.f&oe?Ja(i,t,!1):t===i&&(r?G(i,ae):i.f&Z&&G(i,Ve),Ns(i))}}function Qa(e){var T;var t=pe,r=ge,s=ke,a=F,i=Me,f=B,d=$e,u=Mt,p=e.f;pe=null,ge=0,ke=null,F=p&(We|ht)?null:e,Me=null,Xt(e.ctx),$e=!1,Mt=++Et,e.ac!==null&&(Hr(()=>{e.ac.abort(et)}),e.ac=null);try{e.f|=$r;var g=e.fn,x=g();e.f|=jt;var w=e.deps,y=S==null?void 0:S.is_fork;if(pe!==null){var o;if(y||hr(e,ge),w!==null&&ge>0)for(w.length=ge+pe.length,o=0;o<pe.length;o++)w[ge+o]=pe[o];else e.deps=w=pe;if(Fs()&&e.f&Re)for(o=ge;o<w.length;o++)((T=w[o]).reactions??(T.reactions=[])).push(e)}else!y&&w!==null&&ge<w.length&&(hr(e,ge),w.length=ge);if(Sr()&&ke!==null&&!$e&&w!==null&&!(e.f&(oe|Ve|ae)))for(o=0;o<ke.length;o++)Ja(ke[o],e);if(a!==null&&a!==e){if(Et++,a.deps!==null)for(let m=0;m<r;m+=1)a.deps[m].rv=Et;if(t!==null)for(const m of t)m.rv=Et;ke!==null&&(s===null?s=ke:s.push(...ke))}return e.f&pt&&(e.f^=pt),x}catch(m){return ka(m)}finally{e.f^=$r,pe=t,ge=r,ke=s,F=a,Me=i,Xt(f),$e=d,Mt=u}}function ec(e,t){let r=t.reactions;if(r!==null){var s=zl.call(r,e);if(s!==-1){var a=r.length-1;a===0?r=t.reactions=null:(r[s]=r[a],r.pop())}}if(r===null&&t.f&oe&&(pe===null||!Gt.call(pe,t))){var i=t;i.f&Re&&(i.f^=Re,i.f&=~Dt),i.v!==re&&Cs(i),jo(i),hr(i,0)}}function hr(e,t){var r=e.deps;if(r!==null)for(var s=t;s<r.length;s++)ec(e,r[s])}function It(e){var t=e.f;if(!(t&Ne)){G(e,Z);var r=O,s=Pr;O=e,Pr=!0;try{t&(Ge|pa)?Jo(e):Ls(e),za(e);var a=Qa(e);e.teardown=typeof a=="function"?a:null,e.wv=Ya;var i;Ul&&go&&e.f&ae&&e.deps}finally{Pr=s,O=r}}}async function tc(){await Promise.resolve(),xo()}function n(e){var t=e.f,r=(t&oe)!==0;if(F!==null&&!$e){var s=O!==null&&(O.f&Ne)!==0;if(!s&&(Me===null||!Gt.call(Me,e))){var a=F.deps;if(F.f&$r)e.rv<Et&&(e.rv=Et,pe===null&&a!==null&&a[ge]===e?ge++:pe===null?pe=[e]:pe.push(e));else{(F.deps??(F.deps=[])).push(e);var i=e.reactions;i===null?e.reactions=[F]:Gt.call(i,F)||i.push(F)}}}if(gt&&Rt.has(e))return Rt.get(e);if(r){var f=e;if(gt){var d=f.v;return(!(f.f&Z)&&f.reactions!==null||Za(f))&&(d=Ds(f)),Rt.set(f,d),d}var u=(f.f&Re)===0&&!$e&&F!==null&&(Pr||(F.f&Re)!==0),p=(f.f&jt)===0;tr(f)&&(u&&(f.f|=Re),Oa(f)),u&&!p&&(Fa(f),Xa(f))}if(ne!=null&&ne.has(e))return ne.get(e);if(e.f&pt)throw e.v;return e.v}function Xa(e){if(e.f|=Re,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&oe&&!(t.f&Re)&&(Fa(t),Xa(t))}function Za(e){if(e.v===re)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Rt.has(t)||t.f&oe&&Za(t))return!0;return!1}function b(e){var t=$e;try{return $e=!0,e()}finally{$e=t}}function rc(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Ct in e)Es(e);else if(!Array.isArray(e))for(let t in e){const r=e[t];typeof r=="object"&&r&&Ct in r&&Es(r)}}}function Es(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let s in e)try{Es(e[s],t)}catch{}const r=Ts(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const s=va(r);for(let a in s){const i=s[a].get;if(i)try{i.call(e)}catch{}}}}}const sc=["touchstart","touchmove"];function nc(e){return sc.includes(e)}const Rr=Symbol("events"),ac=new Set,ta=new Set;function ic(e,t,r,s={}){function a(i){if(s.capture||xs.call(t,i),!i.cancelBubble)return Hr(()=>r==null?void 0:r.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?_t(()=>{t.addEventListener(e,a,s)}):t.addEventListener(e,a,s),a}function ra(e,t,r,s,a){var i={capture:s,passive:a},f=ic(e,t,r,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Is(()=>{t.removeEventListener(e,f,i)})}let sa=null;function xs(e){var m,C;var t=this,r=t.ownerDocument,s=e.type,a=((m=e.composedPath)==null?void 0:m.call(e))||[],i=a[0]||e.target;sa=e;var f=0,d=sa===e&&e[Rr];if(d){var u=a.indexOf(d);if(u!==-1&&(t===document||t===window)){e[Rr]=t;return}var p=a.indexOf(t);if(p===-1)return;u<=p&&(f=u)}if(i=a[f]||e.target,i!==t){Hl(e,"currentTarget",{configurable:!0,get(){return i||r}});var g=F,x=O;De(null),Oe(null);try{for(var w,y=[];i!==null;){var o=i.assignedSlot||i.parentNode||i.host||null;try{var T=(C=i[Rr])==null?void 0:C[s];T!=null&&(!i.disabled||e.target===i)&&T.call(i,e)}catch(W){w?y.push(W):w=W}if(e.cancelBubble||o===t||o===null)break;i=o}if(w){for(let W of y)queueMicrotask(()=>{throw W});throw w}}finally{e[Rr]=t,delete e.currentTarget,De(g),Oe(x)}}}var fa;const os=((fa=globalThis==null?void 0:globalThis.window)==null?void 0:fa.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function lc(e){return(os==null?void 0:os.createHTML(e))??e}function oc(e){var t=qo("template");return t.innerHTML=lc(e.replaceAll("<!>","<!---->")),t.content}function Ws(e,t){var r=O;r.nodes===null&&(r.nodes={start:e,end:t,a:null,t:null})}function V(e,t){var r=(t&uo)!==0,s,a=!e.startsWith("<!>");return()=>{s===void 0&&(s=oc(a?e:"<!>"+e),s=Os(s));var i=r||La?document.importNode(s,!0):s.cloneNode(!0);return Ws(i,i),i}}function na(e=""){{var t=at(e+"");return Ws(t,t),t}}function cc(){var e=document.createDocumentFragment(),t=document.createComment(""),r=at();return e.append(t,r),Ws(t,r),e}function P(e,t){e!==null&&e.before(t)}function k(e,t){var r=t==null?"":typeof t=="object"?`${t}`:t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=`${r}`)}function fc(e,t){return uc(e,t)}const Nr=new Map;function uc(e,{target:t,anchor:r,props:s={},events:a,context:i,intro:f=!0,transformError:d}){$o();var u=void 0,p=Bo(()=>{var g=r??t.appendChild(at());To(g,{pending:()=>{}},y=>{wa({});var o=B;i&&(o.c=i),a&&(s.$$events=a),u=e(y,s)||{},Ea()},d);var x=new Set,w=y=>{for(var o=0;o<y.length;o++){var T=y[o];if(!x.has(T)){x.add(T);var m=nc(T);for(const L of[t,document]){var C=Nr.get(L);C===void 0&&(C=new Map,Nr.set(L,C));var W=C.get(T);W===void 0?(L.addEventListener(T,xs,{passive:m}),C.set(T,1)):C.set(T,W+1)}}}};return w(zr(ac)),ta.add(w),()=>{var m;for(var y of x)for(const C of[t,document]){var o=Nr.get(C),T=o.get(y);--T==0?(C.removeEventListener(y,xs),o.delete(y),o.size===0&&Nr.delete(C)):o.set(y,T)}ta.delete(w),g!==r&&((m=g.parentNode)==null||m.removeChild(g))}});return vc.set(u,p),u}let vc=new WeakMap;var Pe,Ke,ye,Tt,wr,Er,Ur;class dc{constructor(t,r=!0){je(this,"anchor");R(this,Pe,new Map);R(this,Ke,new Map);R(this,ye,new Map);R(this,Tt,new Set);R(this,wr,!0);R(this,Er,t=>{if(c(this,Pe).has(t)){var r=c(this,Pe).get(t),s=c(this,Ke).get(r);if(s)Ps(s),c(this,Tt).delete(r);else{var a=c(this,ye).get(r);a&&(c(this,Ke).set(r,a.effect),c(this,ye).delete(r),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),s=a.effect)}for(const[i,f]of c(this,Pe)){if(c(this,Pe).delete(i),i===t)break;const d=c(this,ye).get(f);d&&(_e(d.effect),c(this,ye).delete(f))}for(const[i,f]of c(this,Ke)){if(i===r||c(this,Tt).has(i))continue;const d=()=>{if(Array.from(c(this,Pe).values()).includes(i)){var p=document.createDocumentFragment();$s(f,p),p.append(at()),c(this,ye).set(i,{effect:f,fragment:p})}else _e(f);c(this,Tt).delete(i),c(this,Ke).delete(i)};c(this,wr)||!s?(c(this,Tt).add(i),Nt(f,d,!1)):d()}}});R(this,Ur,t=>{c(this,Pe).delete(t);const r=Array.from(c(this,Pe).values());for(const[s,a]of c(this,ye))r.includes(s)||(_e(a.effect),c(this,ye).delete(s))});this.anchor=t,D(this,wr,r)}ensure(t,r){var s=S,a=Wa();if(r&&!c(this,Ke).has(t)&&!c(this,ye).has(t))if(a){var i=document.createDocumentFragment(),f=at();i.append(f),c(this,ye).set(t,{effect:Ce(()=>r(f)),fragment:i})}else c(this,Ke).set(t,Ce(()=>r(this.anchor)));if(c(this,Pe).set(s,t),a){for(const[d,u]of c(this,Ke))d===t?s.unskip_effect(u):s.skip_effect(u);for(const[d,u]of c(this,ye))d===t?s.unskip_effect(u.effect):s.skip_effect(u.effect);s.oncommit(c(this,Er)),s.ondiscard(c(this,Ur))}else c(this,Er).call(this,s)}}Pe=new WeakMap,Ke=new WeakMap,ye=new WeakMap,Tt=new WeakMap,wr=new WeakMap,Er=new WeakMap,Ur=new WeakMap;function ce(e,t,r=!1){var s=new dc(e),a=r?Qt:0;function i(f,d){s.ensure(f,d)}js(()=>{var f=!1;t((d,u=0)=>{f=!0,i(u,d)}),f||i(-1,null)},a)}function pc(e,t,r){for(var s=[],a=t.length,i,f=t.length,d=0;d<a;d++){let x=t[d];Nt(x,()=>{if(i){if(i.pending.delete(x),i.done.add(x),i.pending.size===0){var w=e.outrogroups;ks(e,zr(i.done)),w.delete(i),w.size===0&&(e.outrogroups=null)}}else f-=1},!1)}if(f===0){var u=s.length===0&&r!==null;if(u){var p=r,g=p.parentNode;Vo(g),g.append(p),e.items.clear()}ks(e,t,!u)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function ks(e,t,r=!0){var s;if(e.pending.size>0){s=new Set;for(const f of e.pending.values())for(const d of f)s.add(e.items.get(d).e)}for(var a=0;a<t.length;a++){var i=t[a];if(s!=null&&s.has(i)){i.f|=Ye;const f=document.createDocumentFragment();$s(i,f)}else _e(t[a],r)}}var aa;function qt(e,t,r,s,a,i=null){var f=e,d=new Map,u=(t&ga)!==0;if(u){var p=e;f=p.appendChild(at())}var g=null,x=Da(()=>{var L=r();return As(L)?L:L==null?[]:zr(L)}),w,y=new Map,o=!0;function T(L){W.effect.f&Ne||(W.pending.delete(L),W.fallback=g,_c(W,w,f,t,s),g!==null&&(w.length===0?g.f&Ye?(g.f^=Ye,fr(g,null,f)):Ps(g):Nt(g,()=>{g=null})))}function m(L){W.pending.delete(L)}var C=js(()=>{w=n(x);for(var L=w.length,Q=new Set,ie=S,qe=Wa(),I=0;I<L;I+=1){var Qe=w[I],it=s(Qe,I),ve=o?null:d.get(it);ve?(ve.v&&Zt(ve.v,Qe),ve.i&&Zt(ve.i,I),qe&&ie.unskip_effect(ve.e)):(ve=hc(d,o?f:aa??(aa=at()),Qe,it,I,a,t,r),o||(ve.e.f|=Ye),d.set(it,ve)),Q.add(it)}if(L===0&&i&&!g&&(o?g=Ce(()=>i(f)):(g=Ce(()=>i(aa??(aa=at()))),g.f|=Ye)),L>Q.size&&Xl(),!o)if(y.set(ie,Q),qe){for(const[Xe,Lt]of d)Q.has(Xe)||ie.skip_effect(Lt.e);ie.oncommit(T),ie.ondiscard(m)}else T(ie);n(x)}),W={effect:C,items:d,pending:y,outrogroups:null,fallback:g};o=!1}function lr(e){for(;e!==null&&!(e.f&We);)e=e.next;return e}function _c(e,t,r,s,a){var ve,Xe,Lt,Pt,rr,bt,Tr,sr,nr;var i=(s&co)!==0,f=t.length,d=e.items,u=lr(e.effect.first),p,g=null,x,w=[],y=[],o,T,m,C;if(i)for(C=0;C<f;C+=1)o=t[C],T=a(o,C),m=d.get(T).e,m.f&Ye||((Xe=(ve=m.nodes)==null?void 0:ve.a)==null||Xe.measure(),(x??(x=new Set)).add(m));for(C=0;C<f;C+=1){if(o=t[C],T=a(o,C),m=d.get(T).e,e.outrogroups!==null)for(const we of e.outrogroups)we.pending.delete(m),we.done.delete(m);if(m.f&ue&&(Ps(m),i&&((Pt=(Lt=m.nodes)==null?void 0:Lt.a)==null||Pt.unfix(),(x??(x=new Set)).delete(m))),m.f&Ye)if(m.f^=Ye,m===u)fr(m,null,r);else{var W=g?g.next:u;m===e.effect.last&&(e.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),ft(e,g,m),ft(e,m,W),fr(m,W,r),g=m,w=[],y=[],u=lr(g.next);continue}if(m!==u){if(p!==void 0&&p.has(m)){if(w.length<y.length){var L=y[0],Q;g=L.prev;var ie=w[0],qe=w[w.length-1];for(Q=0;Q<w.length;Q+=1)fr(w[Q],L,r);for(Q=0;Q<y.length;Q+=1)p.delete(y[Q]);ft(e,ie.prev,qe.next),ft(e,g,ie),ft(e,qe,L),u=L,g=qe,C-=1,w=[],y=[]}else p.delete(m),fr(m,u,r),ft(e,m.prev,m.next),ft(e,m,g===null?e.effect.first:g.next),ft(e,g,m),g=m;continue}for(w=[],y=[];u!==null&&u!==m;)(p??(p=new Set)).add(u),y.push(u),u=lr(u.next);if(u===null)continue}m.f&Ye||w.push(m),g=m,u=lr(m.next)}if(e.outrogroups!==null){for(const we of e.outrogroups)we.pending.size===0&&(ks(e,zr(we.done)),(rr=e.outrogroups)==null||rr.delete(we));e.outrogroups.size===0&&(e.outrogroups=null)}if(u!==null||p!==void 0){var I=[];if(p!==void 0)for(m of p)m.f&ue||I.push(m);for(;u!==null;)!(u.f&ue)&&u!==e.fallback&&I.push(u),u=lr(u.next);var Qe=I.length;if(Qe>0){var it=s&ga&&f===0?r:null;if(i){for(C=0;C<Qe;C+=1)(Tr=(bt=I[C].nodes)==null?void 0:bt.a)==null||Tr.measure();for(C=0;C<Qe;C+=1)(nr=(sr=I[C].nodes)==null?void 0:sr.a)==null||nr.fix()}pc(e,I,it)}}i&&_t(()=>{var we,ar;if(x!==void 0)for(m of x)(ar=(we=m.nodes)==null?void 0:we.a)==null||ar.apply()})}function hc(e,t,r,s,a,i,f,d){var u=f&lo?f&fo?Ft(r):X(r,!1,!1):null,p=f&oo?Ft(a):null;return{v:u,i:p,e:Ce(()=>(i(t,u??r,p??a,d),()=>{e.delete(s)}))}}function fr(e,t,r){if(e.nodes)for(var s=e.nodes.start,a=e.nodes.end,i=t&&!(t.f&Ye)?t.nodes.start:r;s!==null;){var f=Ar(s);if(i.before(s),s===a)return;s=f}}function ft(e,t,r){t===null?e.effect.first=r:t.next=r,r===null?e.effect.last=t:r.prev=t}const ia=[...`
2
+ \r\f \v\uFEFF`];function gc(e,t,r){var s=e==null?"":""+e;if(r){for(var a of Object.keys(r))if(r[a])s=s?s+" "+a:a;else if(s.length)for(var i=a.length,f=0;(f=s.indexOf(a,f))>=0;){var d=f+i;(f===0||ia.includes(s[f-1]))&&(d===s.length||ia.includes(s[d]))?s=(f===0?"":s.substring(0,f))+s.substring(d+1):f=d}}return s===""?null:s}function bc(e,t){return e==null?null:String(e)}function or(e,t,r,s,a,i){var f=e.__className;if(f!==r||f===void 0){var d=gc(r,s,i);d==null?e.removeAttribute("class"):e.className=d,e.__className=r}else if(i&&a!==i)for(var u in i){var p=!!i[u];(a==null||p!==!!a[u])&&e.classList.toggle(u,p)}return i}function la(e,t,r,s){var a=e.__style;if(a!==t){var i=bc(t);i==null?e.removeAttribute("style"):e.style.cssText=i,e.__style=t}return s}function ei(e,t,r=!1){if(e.multiple){if(t==null)return;if(!As(t))return po();for(var s of e.options)s.selected=t.includes(pr(s));return}for(s of e.options){var a=pr(s);if(Po(a,t)){s.selected=!0;return}}(!r||t!==void 0)&&(e.selectedIndex=-1)}function mc(e){var t=new MutationObserver(()=>{ei(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Is(()=>{t.disconnect()})}function cs(e,t,r=t){var s=new WeakSet,a=!0;Va(e,"change",i=>{var f=i?"[selected]":":checked",d;if(e.multiple)d=[].map.call(e.querySelectorAll(f),pr);else{var u=e.querySelector(f)??e.querySelector("option:not([disabled])");d=u&&pr(u)}r(d),e.__value=d,S!==null&&s.add(S)}),Ko(()=>{var i=t();if(e===document.activeElement){var f=S;if(s.has(f))return}if(ei(e,i,a),a&&i===void 0){var d=e.querySelector(":checked");d!==null&&(i=pr(d),r(i))}e.__value=i,a=!1}),mc(e)}function pr(e){return"__value"in e?e.__value:e.value}const yc=Symbol("is custom element"),wc=Symbol("is html");function Ec(e,t,r,s){var a=xc(e);a[t]!==(a[t]=r)&&(r==null?e.removeAttribute(t):typeof r!="string"&&kc(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function xc(e){return e.__attributes??(e.__attributes={[yc]:e.nodeName.includes("-"),[wc]:e.namespaceURI===ba})}var oa=new Map;function kc(e){var t=e.getAttribute("is")||e.nodeName,r=oa.get(t);if(r)return r;oa.set(t,r=[]);for(var s,a=e,i=Element.prototype;i!==a;){s=va(a);for(var f in s)s[f].set&&r.push(f);a=Ts(a)}return r}function Mr(e,t,r=t){var s=new WeakSet;Va(e,"input",async a=>{var i=a?e.defaultValue:e.value;if(i=fs(e)?us(i):i,r(i),S!==null&&s.add(S),await tc(),i!==(i=t())){var f=e.selectionStart,d=e.selectionEnd,u=e.value.length;if(e.value=i??"",d!==null){var p=e.value.length;f===d&&d===u&&p>u?(e.selectionStart=p,e.selectionEnd=p):(e.selectionStart=f,e.selectionEnd=Math.min(d,p))}}}),b(t)==null&&e.value&&(r(fs(e)?us(e.value):e.value),S!==null&&s.add(S)),Br(()=>{var a=t();if(e===document.activeElement){var i=S;if(s.has(i))return}fs(e)&&a===us(e.value)||e.type==="date"&&!a&&!e.value||a!==e.value&&(e.value=a??"")})}function fs(e){var t=e.type;return t==="number"||t==="range"}function us(e){return e===""?null:+e}function Sc(e){return function(...t){var r=t[0];return r.preventDefault(),e==null?void 0:e.apply(this,t)}}function Ac(e=!1){const t=B,r=t.l.u;if(!r)return;let s=()=>rc(t.s);if(e){let a=0,i={};const f=Ms(()=>{let d=!1;const u=t.s;for(const p in u)u[p]!==i[p]&&(i[p]=u[p],d=!0);return d&&a++,a});s=()=>n(f)}r.b.length&&Ho(()=>{ca(t,s),vs(r.b)}),ws(()=>{const a=b(()=>r.m.map(Gl));return()=>{for(const i of a)typeof i=="function"&&i()}}),r.a.length&&ws(()=>{ca(t,s),vs(r.a)})}function ca(e,t){if(e.l.s)for(const r of e.l.s)n(r);t()}function Tc(e){B===null&&ha(),kr&&B.l!==null?Rc(B).m.push(e):ws(()=>{const t=b(e);if(typeof t=="function")return t})}function Cc(e){B===null&&ha(),Tc(()=>()=>b(e))}function Rc(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const Nc="5";var ua;typeof window<"u"&&((ua=window.__svelte??(window.__svelte={})).v??(ua.v=new Set)).add(Nc);bo();var Mc=V('<div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watch issue</span><strong class="status-warn svelte-d3ct2b"> </strong></div>'),Dc=V('<section class="notice svelte-d3ct2b"> </section>'),Oc=V('<section class="notice danger svelte-d3ct2b"> </section>'),Fc=V('<p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b">--:--:--</time><span class="sys svelte-d3ct2b">SYS</span><strong class="svelte-d3ct2b">Waiting for memory-core watch output...</strong></p>'),Ic=V('<strong class="svelte-d3ct2b"> </strong>'),jc=V('<strong class="svelte-d3ct2b"> </strong>'),Lc=V('<strong class="svelte-d3ct2b"> </strong>'),Pc=V('<strong class="svelte-d3ct2b"> </strong>'),$c=V('<strong class="svelte-d3ct2b"> </strong>'),Wc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Why:</b> </p>'),Vc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Issue:</b> </p>'),qc=V('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Fix:</b> </p>'),Uc=V('<pre class="svelte-d3ct2b"> </pre>'),zc=V('<div class="terminal-detail svelte-d3ct2b"><p class="svelte-d3ct2b"> </p> <p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Rule:</b> </p> <!> <!> <!> <!></div>'),Hc=V('<section><p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b"> </time> <span class="svelte-d3ct2b"> </span> <!></p> <!></section>'),Bc=V('<div class="metric-row svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),Kc=V('<p class="empty svelte-d3ct2b">No rule counters yet.</p>'),Yc=V('<div class="metric-row warning svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),Gc=V('<p class="empty svelte-d3ct2b">No file counters yet.</p>'),Jc=V('<small class="svelte-d3ct2b"> </small>'),Qc=V('<small class="svelte-d3ct2b"> </small>'),Xc=V('<section class="commit-item svelte-d3ct2b"><div class="commit-meta svelte-d3ct2b"><span> </span> <time> </time></div> <strong class="svelte-d3ct2b"> </strong> <p class="svelte-d3ct2b"> </p> <!> <!></section>'),Zc=V('<article class="glass-panel commit-watch svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Commit Watch</h2> <span class="svelte-d3ct2b"> </span></div> <div class="commit-list svelte-d3ct2b"></div></article>'),ef=V('<small class="svelte-d3ct2b"> </small>'),tf=V('<div class="rule-item svelte-d3ct2b"><div><div class="rule-meta svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <code class="svelte-d3ct2b"> </code></div> <p class="svelte-d3ct2b"> </p> <!></div> <button class="svelte-d3ct2b">Delete</button></div>'),rf=V('<p class="empty svelte-d3ct2b">No rules match the current filters.</p>'),sf=V('<div class="command-center svelte-d3ct2b"><aside class="sidebar svelte-d3ct2b"><div class="brand svelte-d3ct2b"><h1 class="svelte-d3ct2b">memory-core</h1> <span class="svelte-d3ct2b">command center</span></div> <nav aria-label="Dashboard navigation" class="svelte-d3ct2b"><a class="nav-item active svelte-d3ct2b" href="/"><span class="nav-icon svelte-d3ct2b">[]</span> <span>Command Center</span></a></nav> <div class="sidebar-footer svelte-d3ct2b"><div><i class="svelte-d3ct2b"></i> </div> <small class="svelte-d3ct2b"> </small></div></aside> <div class="workspace svelte-d3ct2b"><header class="topbar svelte-d3ct2b"><div class="topbar-left svelte-d3ct2b"><button class="icon-button mobile-menu svelte-d3ct2b" aria-label="Menu">=</button> <div><i class="svelte-d3ct2b"></i> <span> </span></div></div> <div class="header-metrics svelte-d3ct2b" aria-label="Global metrics"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Violations</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Files</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Rules</span> <strong class="svelte-d3ct2b"> </strong></div></div> <div class="top-actions svelte-d3ct2b" aria-label="Status shortcuts"><button class="icon-button svelte-d3ct2b" title="Warnings" aria-label="Warnings">!</button> <button class="icon-button svelte-d3ct2b" title="Rules" aria-label="Rules">R</button> <button class="icon-button svelte-d3ct2b" title="Database" aria-label="Database">DB</button> <button class="icon-button svelte-d3ct2b" title="Network" aria-label="Network">LAN</button></div></header> <main class="canvas svelte-d3ct2b"><section class="status-grid svelte-d3ct2b"><article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Project</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Name</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Type</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Language</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Architecture</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watcher</span><strong class="svelte-d3ct2b"> </strong></div> <!></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Runtime</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Provider</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check model</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check status</span> <strong><!></strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Embedding</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Ollama URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">PostgreSQL</h2> <span> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Database</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">User</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Host</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article></section> <!> <!> <section class="terminal-panel glass-panel svelte-d3ct2b"><div class="terminal-head svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="terminal-icon svelte-d3ct2b">&gt;_</span> <h2 class="svelte-d3ct2b">Live Feed</h2></div> <div class="window-dots svelte-d3ct2b" aria-hidden="true"><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i></div></div> <div class="terminal-body svelte-d3ct2b"><!> <!></div></section> <section class="content-grid svelte-d3ct2b"><article class="glass-panel stats-panel svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Stats</h2> <span class="svelte-d3ct2b">Recorded</span></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Most Violated Rules</h3> <!></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Problem Files</h3> <!></div> <div class="summary-strip svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Clean</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Issues</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Events</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <!> <article class="glass-panel rule-engine svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Rule Engine</h2> <span class="svelte-d3ct2b"> </span></div> <form class="rule-form svelte-d3ct2b"><div class="control-grid svelte-d3ct2b"><select class="svelte-d3ct2b"><option>Rule</option><option>Decision</option><option>Pattern</option><option>Ignore</option></select> <select class="svelte-d3ct2b"><option>Project</option><option>Global</option></select></div> <textarea rows="3" placeholder="Rule or decision" class="svelte-d3ct2b"></textarea> <div class="control-grid svelte-d3ct2b"><input placeholder="Reason" class="svelte-d3ct2b"/> <input placeholder="Tags" class="svelte-d3ct2b"/></div> <button class="svelte-d3ct2b"> </button></form> <div class="control-grid filters svelte-d3ct2b"><select class="svelte-d3ct2b"><option>All types</option><option>Rules</option><option>Decisions</option><option>Patterns</option><option>Ignores</option></select> <input placeholder="Search rules..." class="svelte-d3ct2b"/></div> <div class="rule-list svelte-d3ct2b"></div></article></section></main></div></div>');function nf(e,t){wa(t,!1);const r=X(),s=X(),a=X(),i=X(),f=X(),d=X(),u=X(),p=X(),g=X(),x=X(),w=X(),y=X();let o=X({config:null,stats:{rules:{},files:{},topRules:[],topFiles:[]},files:[],memories:[]}),T=X([]),m=X(!1),C=X("all"),W=X(""),L=X(!1),Q=X(""),ie,qe=!1,I=X({type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"});const Qe=24*60*60*1e3,it=()=>{var l;return((l=n(o).runtime)==null?void 0:l.project.name)??"memory-core"},ve=l=>{if(!l)return null;const v=l.trim().toLowerCase();return{angular:"angular",express:"express",fastify:"fastify",go:"go-api",laravel:"laravel-service-repository",nestjs:"nestjs","next.js":"nextjs","nuxt.js":"nuxt",react:"react","react native":"react-native",svelte:"svelte","vue.js":"vue"}[v]??null},Xe=l=>{var A;const v=(A=n(o).config)==null?void 0:A[l];return typeof v=="string"&&v.trim().length>0?v.trim():void 0},Lt=()=>{var E,$,Ee,lt,ot;const l=((E=n(o).runtime)==null?void 0:E.project.declaredArchitectures)??[],v=(($=n(o).runtime)==null?void 0:$.project.activeArchitectures)??[],A=(Ee=n(o).runtime)==null?void 0:Ee.project.backendArchitecture,N=(lt=n(o).runtime)==null?void 0:lt.project.frontendFramework,z=Xe("backendArchitecture")??Xe("backendArch"),te=Xe("frontendFramework")??Xe("frontendFw"),le=ve((ot=n(o).runtime)==null?void 0:ot.project.detected.framework),j=[...new Set([...l,...v,A,N,z,te,le??void 0].filter(Ze=>typeof Ze=="string"&&Ze.length>0))];return j.length>0?j.join(", "):"none"};function Pt(l){M(T,[{...l,id:crypto.randomUUID()},...n(T)].slice(0,80))}function rr(l){return l.type==="saved"?{type:"saved",timestamp:l.timestamp,file:l.file}:l.type==="clean"?{type:"clean",timestamp:l.timestamp,file:l.file}:l.type==="skipped"?{type:"skipped",timestamp:l.timestamp,file:l.file,reason:l.reason}:l.type==="violations"?{type:"violations",timestamp:l.timestamp,file:l.file,violations:l.violations}:l.type==="error"?{type:"error",timestamp:l.timestamp,message:l.message}:l.type==="ready"?{type:"system",timestamp:l.timestamp,message:`Watching ${l.path} | ${l.rules} rules | ${l.model}`}:{type:"system",timestamp:l.timestamp,message:"Watch stopped"}}function bt(l){const v=n(o).files??[],A=v.findIndex(z=>z.file===l.file),N=v.slice();return A===-1?N.push(l):N[A]=l,N.sort((z,te)=>te.lastSeen.localeCompare(z.lastSeen))}function Tr(l){const v=n(o).watcher??{enabled:!0,running:!1,path:void 0,model:void 0,rules:void 0,lastEventAt:void 0,error:void 0};let A=n(o).files,N={...v,lastEventAt:l.timestamp,enabled:!0};l.type==="ready"&&(N={...N,running:!0,error:void 0,path:l.path,model:l.model,rules:l.rules}),l.type==="saved"&&(A=bt({file:l.file,status:"checking",lastSeen:l.timestamp,violations:[]})),l.type==="clean"&&(A=bt({file:l.file,status:"clean",lastSeen:l.timestamp,violations:[]})),l.type==="skipped"&&(A=bt({file:l.file,status:"skipped",lastSeen:l.timestamp,violations:[],message:l.reason})),l.type==="violations"&&(A=bt({file:l.file,status:"violations",lastSeen:l.timestamp,violations:l.violations})),l.type==="error"&&(N={...N,running:!1,error:l.message}),l.type==="stopped"&&(N={...N,running:!1});const z=[l,...n(o).events??[]].slice(0,100);M(o,{...n(o),files:A,events:z,watcher:N})}function sr(l=[]){M(T,l.map(rr).map(v=>({...v,id:crypto.randomUUID()})).reverse().slice(0,80))}function nr(l){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l))}function we(l){return Math.max(1,...l.map(v=>v.count))}function ar(l,v){const A=l.file||v;return l.line?`${A}:${l.line}`:A}function ti(l){return l.type==="saved"?"SAVE":l.type==="clean"?"OK":l.type==="skipped"?"SKIP":l.type==="violations"?"FAIL":l.type==="error"?"WARN":"SYS"}async function Kr(){const l=await fetch("/api/snapshot");M(o,await l.json()),sr(n(o).events)}async function ri(){if(!qe&&document.visibilityState!=="hidden"){qe=!0;try{const l=await fetch("/api/stats",{cache:"no-store"});if(!l.ok)return;const v=await l.json();if(!v.stats)return;M(o,{...n(o),stats:v.stats})}catch{}finally{qe=!1}}}function si(){ie&&clearInterval(ie),ie=setInterval(()=>{ri()},2e3)}function Vs(){const l=location.protocol==="https:"?"wss:":"ws:",v=new WebSocket(`${l}//${location.host}/ws`);v.addEventListener("open",()=>{M(m,!0),Pt({type:"system",timestamp:new Date().toISOString(),message:"Dashboard connected"})}),v.addEventListener("close",()=>{M(m,!1),Pt({type:"error",timestamp:new Date().toISOString(),message:"Dashboard disconnected"}),setTimeout(Vs,1500)}),v.addEventListener("message",A=>{const N=JSON.parse(A.data);if(N.type==="snapshot"){M(o,N.snapshot),n(T).length===0&&sr(n(o).events);return}N.type==="watch"&&(Tr(N.event),Pt(rr(N.event)))})}async function ni(){if(n(I).content.trim()){M(L,!0),M(Q,"");try{const l=await fetch("/api/memories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n(I))});if(!l.ok)throw new Error((await l.json()).error??"Save failed");M(I,{type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"}),await Kr()}catch(l){M(Q,l.message)}finally{M(L,!1)}}}async function ai(l){M(Q,"");const v=await fetch(`/api/memories/${l}`,{method:"DELETE"});if(!v.ok){M(Q,(await v.json()).error??"Delete failed");return}await Kr()}Kr().catch(l=>{M(Q,l.message)}),Vs(),si(),Cc(()=>{ie&&(clearInterval(ie),ie=void 0)}),xe(()=>(n(o),n(C),n(W)),()=>{M(r,n(o).memories.filter(l=>{const v=n(C)==="all"||l.type===n(C),A=`${l.type} ${l.scope} ${l.content} ${l.reason??""} ${l.tags.join(" ")}`.toLowerCase();return v&&A.includes(n(W).toLowerCase())}))}),xe(()=>n(o),()=>{M(s,Object.values(n(o).stats.files??{}).reduce((l,v)=>l+v,0))}),xe(()=>n(o),()=>{M(a,n(o).files.filter(l=>l.status==="clean").length)}),xe(()=>n(o),()=>{M(i,Object.values(n(o).stats.rules).reduce((l,v)=>l+v,0))}),xe(()=>n(o),()=>{M(f,n(o).stats.recentViolations??[])}),xe(()=>n(f),()=>{M(d,n(f).filter(l=>{if(!(l.source==="hook"||l.source==="ci"))return!1;const v=Date.parse(l.timestamp);return Number.isNaN(v)?!1:Date.now()-v<=Qe}))}),xe(()=>n(s),()=>{M(u,n(s))}),xe(()=>n(o),()=>{M(p,Object.keys(n(o).stats.files??{}).length)}),xe(()=>n(o),()=>{M(g,n(o).memories.filter(l=>["rule","pattern","decision"].includes(l.type)).length)}),xe(()=>n(o),()=>{var l;M(x,((l=n(o).memoryCount)==null?void 0:l.total)??n(o).memories.length)}),xe(()=>n(o),()=>{var l;M(w,((l=n(o).memoryCount)==null?void 0:l.relevant)??n(o).memories.length)}),xe(()=>(n(m),n(o)),()=>{var l,v;M(y,n(m)?((l=n(o).watcher)==null?void 0:l.enabled)===!1?{live:!1,label:"Watch off"}:(v=n(o).watcher)!=null&&v.running?{live:!0,label:"Watcher live"}:{live:!1,label:"Watcher idle"}:{live:!1,label:"Disconnected"})}),Yo(),Ac();var qs=sf(),Us=_(qs),ii=h(_(Us),4),Yr=_(ii);let zs;var li=h(_(Yr)),oi=h(Yr,2),ci=_(oi),fi=h(Us,2),Hs=_(fi),Bs=_(Hs),Ks=h(_(Bs),2);let Ys;var ui=h(_(Ks),2),vi=_(ui),di=h(Bs,2),Gs=_(di),pi=h(_(Gs),2),_i=_(pi),Js=h(Gs,2),hi=h(_(Js),2),gi=_(hi),bi=h(Js,2),mi=h(_(bi),2),yi=_(mi),wi=h(Hs,2),Qs=_(wi),Xs=_(Qs),Zs=_(Xs),Ei=h(_(Zs),2),xi=_(Ei),ki=h(Zs,2),en=_(ki),Si=h(_(en)),Ai=_(Si),tn=h(en,2),Ti=h(_(tn)),Ci=_(Ti),rn=h(tn,2),Ri=h(_(rn)),Ni=_(Ri),sn=h(rn,2),Mi=h(_(sn)),Di=_(Mi),nn=h(sn,2),Oi=h(_(nn)),Fi=_(Oi),Ii=h(nn,2);{var ji=l=>{var v=Mc(),A=h(_(v)),N=_(A);U(()=>k(N,(n(o),b(()=>n(o).watcher.error)))),P(l,v)};ce(Ii,l=>{n(o),b(()=>{var v;return(v=n(o).watcher)==null?void 0:v.error})&&l(ji)})}var an=h(Xs,2),ln=_(an),Li=h(_(ln),2),Pi=_(Li),$i=h(ln,2),on=_($i),Wi=h(_(on)),Vi=_(Wi),cn=h(on,2),qi=h(_(cn)),Ui=_(qi),fn=h(cn,2),un=h(_(fn),2);let vn;var zi=_(un);{var Hi=l=>{var v=na();U(()=>k(v,(n(o),b(()=>{var A;return(A=n(o).runtime)!=null&&A.model.checkModelInstalled?"installed":"missing"})))),P(l,v)},Bi=l=>{var v=na();U(()=>k(v,(n(o),b(()=>{var A;return(A=n(o).runtime)!=null&&A.model.apiKeyConfigured?"api key set":"api key missing"})))),P(l,v)};ce(zi,l=>{n(o),b(()=>{var v;return((v=n(o).runtime)==null?void 0:v.model.provider)==="ollama"})?l(Hi):l(Bi,-1)})}var dn=h(fn,2),Ki=h(_(dn)),Yi=_(Ki),Gi=h(dn,2),Ji=h(_(Gi)),Qi=_(Ji),Xi=h(an,2),pn=_(Xi),_n=h(_(pn),2);let hn;var Zi=_(_n),el=h(pn,2),gn=_(el),tl=h(_(gn)),rl=_(tl),bn=h(gn,2),sl=h(_(bn)),nl=_(sl),mn=h(bn,2),al=h(_(mn)),il=_(al),ll=h(mn,2),ol=h(_(ll)),cl=_(ol),yn=h(Qs,2);{var fl=l=>{var v=Dc(),A=_(v);U(()=>k(A,(n(o),b(()=>n(o).dbError)))),P(l,v)};ce(yn,l=>{n(o),b(()=>n(o).dbError)&&l(fl)})}var wn=h(yn,2);{var ul=l=>{var v=Oc(),A=_(v);U(()=>k(A,n(Q))),P(l,v)};ce(wn,l=>{n(Q)&&l(ul)})}var En=h(wn,2),vl=h(_(En),2),xn=_(vl);{var dl=l=>{var v=Fc();P(l,v)};ce(xn,l=>{n(T),b(()=>n(T).length===0)&&l(dl)})}var pl=h(xn,2);qt(pl,1,()=>(n(T),b(()=>[...n(T)].reverse())),l=>l.id,(l,v)=>{var A=Hc();let N;var z=_(A),te=_(z),le=_(te),j=h(te,2),E=_(j),$=h(j,2);{var Ee=K=>{var Y=Ic(),he=_(Y);U(()=>k(he,(n(v),b(()=>n(v).message)))),P(K,Y)},lt=K=>{var Y=jc(),he=_(Y);U(()=>k(he,`saved: ${n(v),b(()=>n(v).file)??""}`)),P(K,Y)},ot=K=>{var Y=Lc(),he=_(Y);U(()=>k(he,`${n(v),b(()=>n(v).file)??""} - no violations`)),P(K,Y)},Ze=K=>{var Y=Pc(),he=_(Y);U(()=>k(he,`${n(v),b(()=>n(v).file)??""} - skipped: ${n(v),b(()=>n(v).reason)??""}`)),P(K,Y)},Ue=K=>{var Y=$c(),he=_(Y);U(()=>k(he,`${n(v),b(()=>n(v).violations.length)??""} violation${n(v),b(()=>n(v).violations.length===1?"":"s")??""} in ${n(v),b(()=>n(v).file)??""}`)),P(K,Y)};ce($,K=>{n(v),b(()=>n(v).type==="system"||n(v).type==="error")?K(Ee):(n(v),b(()=>n(v).type==="saved")?K(lt,1):(n(v),b(()=>n(v).type==="clean")?K(ot,2):(n(v),b(()=>n(v).type==="skipped")?K(Ze,3):K(Ue,-1))))})}var $t=h(z,2);{var Wt=K=>{var Y=cc(),he=Wo(Y);qt(he,3,()=>(n(v),b(()=>n(v).violations)),(Cr,H)=>`${n(v).id}-${H}`,(Cr,H,Fe)=>{var ze=zc(),Vt=_(ze),Fl=_(Vt),Vn=h(Vt,2),Il=h(_(Vn)),qn=h(Vn,2);{var jl=se=>{var Ie=Wc(),mt=h(_(Ie));U(()=>k(mt,` ${n(H),b(()=>n(H).reason)??""}`)),P(se,Ie)};ce(qn,se=>{n(H),b(()=>n(H).reason)&&se(jl)})}var Un=h(qn,2);{var Ll=se=>{var Ie=Vc(),mt=h(_(Ie));U(()=>k(mt,` ${n(H),b(()=>n(H).issue)??""}`)),P(se,Ie)};ce(Un,se=>{n(H),b(()=>n(H).issue)&&se(Ll)})}var zn=h(Un,2);{var Pl=se=>{var Ie=qc(),mt=h(_(Ie));U(()=>k(mt,` ${n(H),b(()=>n(H).suggestion)??""}`)),P(se,Ie)};ce(zn,se=>{n(H),b(()=>n(H).suggestion)&&se(Pl)})}var $l=h(zn,2);{var Wl=se=>{var Ie=Uc(),mt=_(Ie);U(()=>k(mt,(n(H),b(()=>n(H).code)))),P(se,Ie)};ce($l,se=>{n(H),b(()=>n(H).code)&&se(Wl)})}U(se=>{k(Fl,`[${n(Fe)+1}] ${se??""}`),k(Il,` ${n(H),b(()=>n(H).rule)??""}`)},[()=>(n(H),n(v),b(()=>ar(n(H),n(v).file)))]),P(Cr,ze)}),P(K,Y)};ce($t,K=>{n(v),b(()=>n(v).type==="violations")&&K(Wt)})}U((K,Y)=>{N=or(A,1,"svelte-d3ct2b",null,N,{"error-line":n(v).type==="error","ok-line":n(v).type==="clean","violation-line":n(v).type==="violations"}),k(le,K),k(E,Y)},[()=>(n(v),b(()=>nr(n(v).timestamp))),()=>(n(v),b(()=>ti(n(v))))]),P(l,A)});var _l=h(En,2),kn=_(_l),Sn=h(_(kn),2),hl=h(_(Sn),2);qt(hl,1,()=>(n(o),b(()=>n(o).stats.topRules.slice(0,5))),l=>l.name,(l,v)=>{var A=Bc(),N=_(A),z=_(N),te=_(z),le=h(z,2),j=_(le),E=h(N,2);U($=>{k(te,(n(v),b(()=>n(v).name))),k(j,(n(v),b(()=>n(v).count))),la(E,$)},[()=>(n(v),n(o),b(()=>`width: ${n(v).count/we(n(o).stats.topRules)*100}%`))]),P(l,A)},l=>{var v=Kc();P(l,v)});var An=h(Sn,2),gl=h(_(An),2);qt(gl,1,()=>(n(o),b(()=>n(o).stats.topFiles.slice(0,5))),l=>l.name,(l,v)=>{var A=Yc(),N=_(A),z=_(N),te=_(z),le=h(z,2),j=_(le),E=h(N,2);U($=>{k(te,(n(v),b(()=>n(v).name))),k(j,(n(v),b(()=>n(v).count))),la(E,$)},[()=>(n(v),n(o),b(()=>`width: ${n(v).count/we(n(o).stats.topFiles)*100}%`))]),P(l,A)},l=>{var v=Gc();P(l,v)});var bl=h(An,2),Tn=_(bl),ml=h(_(Tn)),yl=_(ml),Cn=h(Tn,2),wl=h(_(Cn)),El=_(wl),xl=h(Cn,2),kl=h(_(xl)),Sl=_(kl),Rn=h(kn,2);{var Al=l=>{var v=Zc(),A=_(v),N=h(_(A),2),z=_(N),te=h(A,2);qt(te,7,()=>(n(d),b(()=>n(d).slice(0,8))),(le,j)=>`${le.timestamp}-${j}`,(le,j)=>{var E=Xc(),$=_(E),Ee=_($),lt=_(Ee),ot=h(Ee,2),Ze=_(ot),Ue=h($,2),$t=_(Ue),Wt=h(Ue,2),K=_(Wt),Y=h(Wt,2);{var he=Fe=>{var ze=Jc(),Vt=_(ze);U(()=>k(Vt,(n(j),b(()=>n(j).issue)))),P(Fe,ze)};ce(Y,Fe=>{n(j),b(()=>n(j).issue)&&Fe(he)})}var Cr=h(Y,2);{var H=Fe=>{var ze=Qc(),Vt=_(ze);U(()=>k(Vt,(n(j),b(()=>n(j).suggestion)))),P(Fe,ze)};ce(Cr,Fe=>{n(j),b(()=>n(j).suggestion)&&Fe(H)})}U((Fe,ze)=>{k(lt,(n(j),b(()=>n(j).source==="ci"?"CI":"Hook"))),k(Ze,Fe),k($t,(n(j),b(()=>n(j).rule))),k(K,ze)},[()=>(n(j),b(()=>nr(n(j).timestamp))),()=>(n(j),b(()=>ar(n(j),n(j).file||"staged diff")))]),P(le,E)}),U(()=>k(z,`${n(d),b(()=>n(d).length)??""} in 24h`)),P(l,v)};ce(Rn,l=>{n(d),b(()=>n(d).length>0)&&l(Al)})}var Tl=h(Rn,2),Nn=_(Tl),Cl=h(_(Nn),2),Rl=_(Cl),Gr=h(Nn,2),Mn=_(Gr),Jr=_(Mn),Qr=_(Jr);Qr.value=Qr.__value="rule";var Xr=h(Qr);Xr.value=Xr.__value="decision";var Zr=h(Xr);Zr.value=Zr.__value="pattern";var Dn=h(Zr);Dn.value=Dn.__value="ignore";var On=h(Jr,2),es=_(On);es.value=es.__value="project";var Fn=h(es);Fn.value=Fn.__value="global";var In=h(Mn,2),jn=h(In,2),Ln=_(jn),Nl=h(Ln,2),Pn=h(jn,2),Ml=_(Pn),$n=h(Gr,2),ts=_($n),rs=_(ts);rs.value=rs.__value="all";var ss=h(rs);ss.value=ss.__value="rule";var ns=h(ss);ns.value=ns.__value="decision";var as=h(ns);as.value=as.__value="pattern";var Wn=h(as);Wn.value=Wn.__value="ignore";var Dl=h(ts,2),Ol=h($n,2);qt(Ol,5,()=>n(r),l=>l.id,(l,v)=>{var A=tf(),N=_(A),z=_(N),te=_(z),le=_(te),j=h(te,2),E=_(j),$=h(z,2),Ee=_($),lt=h($,2);{var ot=Ue=>{var $t=ef(),Wt=_($t);U(()=>k(Wt,(n(v),b(()=>n(v).reason)))),P(Ue,$t)};ce(lt,Ue=>{n(v),b(()=>n(v).reason)&&Ue(ot)})}var Ze=h(N,2);U(Ue=>{k(le,(n(v),b(()=>n(v).scope))),k(E,`Rule-${Ue??""}`),k(Ee,(n(v),b(()=>n(v).content))),Ec(Ze,"aria-label",(n(v),b(()=>`Delete ${n(v).id}`)))},[()=>(n(v),b(()=>String(n(v).id).padStart(3,"0")))]),ra("click",Ze,()=>ai(n(v).id)),P(l,A)},l=>{var v=rf();P(l,v)}),U((l,v,A)=>{var N,z,te,le,j;zs=or(Yr,1,"status-chip svelte-d3ct2b",null,zs,{live:n(y).live}),k(li,` ${n(y),b(()=>n(y).label)??""}`),k(ci,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.label)??"runtime pending"}))),Ys=or(Ks,1,"live-label svelte-d3ct2b",null,Ys,{live:n(y).live}),k(vi,(n(y),b(()=>n(y).label))),k(_i,n(u)),k(gi,n(p)),k(yi,n(g)),k(xi,(n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.project.initialized?"Initialized":"Not initialized"}))),k(Ai,l),k(Ci,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.type)??"unknown"}))),k(Ni,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.project.language)??"unknown"}))),k(Di,v),k(Fi,(n(o),b(()=>{var E,$;return((E=n(o).watcher)==null?void 0:E.enabled)===!1?"disabled":($=n(o).watcher)!=null&&$.running?"running":"idle"}))),k(Pi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.label)??"pending"}))),k(Vi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.provider)??"unknown"}))),k(Ui,(n(o),b(()=>{var E,$,Ee;return((E=n(o).runtime)==null?void 0:E.model.checkModelResolved)??(($=n(o).runtime)==null?void 0:$.model.checkModel)??((Ee=n(o).runtime)==null?void 0:Ee.model.chatModel)??"unknown"}))),vn=or(un,1,"svelte-d3ct2b",null,vn,{"status-ok":((N=n(o).runtime)==null?void 0:N.model.checkModelInstalled)||((z=n(o).runtime)==null?void 0:z.model.apiKeyConfigured),"status-warn":((te=n(o).runtime)==null?void 0:te.model.checkModelInstalled)===!1||((le=n(o).runtime)==null?void 0:le.model.error)}),k(Yi,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.model.embeddingModelResolved)??(($=n(o).runtime)==null?void 0:$.model.embeddingModel)??"unknown"}))),k(Qi,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.model.ollamaUrl)??"unknown"}))),hn=or(_n,1,"svelte-d3ct2b",null,hn,{success:(j=n(o).runtime)==null?void 0:j.postgres.connected}),k(Zi,(n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.postgres.connected?"Connected":"Not connected"}))),k(rl,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.postgres.serverDatabase)??(($=n(o).runtime)==null?void 0:$.postgres.database)??"unknown"}))),k(nl,(n(o),b(()=>{var E,$;return((E=n(o).runtime)==null?void 0:E.postgres.serverUser)??(($=n(o).runtime)==null?void 0:$.postgres.user)??"unknown"}))),k(il,`${n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.postgres.host)??"unknown"})??""}${n(o),b(()=>{var E;return(E=n(o).runtime)!=null&&E.postgres.port?`:${n(o).runtime.postgres.port}`:""})??""}`),k(cl,(n(o),b(()=>{var E;return((E=n(o).runtime)==null?void 0:E.postgres.url)??"(not set)"}))),k(yl,n(a)),k(El,n(u)),k(Sl,n(i)),k(Rl,`${n(g)??""} rules active`),Pn.disabled=A,k(Ml,n(L)?"Saving...":"Add New Architecture Rule")},[()=>b(it),()=>b(Lt),()=>(n(L),n(I),b(()=>n(L)||!n(I).content.trim()))]),cs(Jr,()=>n(I).type,l=>ir(I,n(I).type=l)),cs(On,()=>n(I).scope,l=>ir(I,n(I).scope=l)),Mr(In,()=>n(I).content,l=>ir(I,n(I).content=l)),Mr(Ln,()=>n(I).reason,l=>ir(I,n(I).reason=l)),Mr(Nl,()=>n(I).tags,l=>ir(I,n(I).tags=l)),ra("submit",Gr,Sc(ni)),cs(ts,()=>n(C),l=>M(C,l)),Mr(Dl,()=>n(W),l=>M(W,l)),P(e,qs),Ea()}fc(nf,{target:document.getElementById("app")});
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Memory Core Dashboard</title>
7
- <script type="module" crossorigin src="/assets/index-D7EPH82B.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-BqYo8t3P.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CJyZEmIe.css">
9
9
  </head>
10
10
  <body>
@@ -12,7 +12,7 @@ import {
12
12
  saveMemory,
13
13
  startWatch,
14
14
  updateMemory
15
- } from "./chunk-WJG77BPO.js";
15
+ } from "./chunk-PRRVI3YM.js";
16
16
 
17
17
  // src/dashboard-server.ts
18
18
  import { createHash } from "crypto";
@@ -47,6 +47,51 @@ var snapshotBroadcastInFlight = false;
47
47
  var snapshotBroadcastQueued = false;
48
48
  var snapshotBroadcastForceRefresh = false;
49
49
  var projectRoot = process.cwd();
50
+ function mapFrameworkToArchitecture(framework) {
51
+ if (!framework) return null;
52
+ const normalized = framework.trim().toLowerCase();
53
+ if (!normalized) return null;
54
+ const map = {
55
+ angular: "angular",
56
+ express: "express",
57
+ fastify: "fastify",
58
+ go: "go-api",
59
+ laravel: "laravel-service-repository",
60
+ nestjs: "nestjs",
61
+ "next.js": "nextjs",
62
+ "nuxt.js": "nuxt",
63
+ react: "react",
64
+ "react native": "react-native",
65
+ svelte: "svelte",
66
+ "vue.js": "vue"
67
+ };
68
+ return map[normalized] ?? null;
69
+ }
70
+ function normalizeArchitectureValue(value) {
71
+ if (typeof value !== "string") return null;
72
+ const trimmed = value.trim();
73
+ return trimmed.length > 0 ? trimmed : null;
74
+ }
75
+ function resolveDeclaredArchitectures(config, detectedFramework) {
76
+ const backendArchitecture = normalizeArchitectureValue(config?.backendArchitecture ?? config?.backendArch) ?? void 0;
77
+ const frontendFramework = normalizeArchitectureValue(config?.frontendFramework ?? config?.frontendFw) ?? void 0;
78
+ const declaredArchitectures = [...new Set([
79
+ backendArchitecture,
80
+ frontendFramework
81
+ ].filter((value) => Boolean(value)))];
82
+ if (declaredArchitectures.length > 0) {
83
+ return { backendArchitecture, frontendFramework, declaredArchitectures };
84
+ }
85
+ const inferredFromFramework = mapFrameworkToArchitecture(detectedFramework);
86
+ if (!inferredFromFramework) {
87
+ return { backendArchitecture, frontendFramework, declaredArchitectures: [] };
88
+ }
89
+ return {
90
+ backendArchitecture,
91
+ frontendFramework,
92
+ declaredArchitectures: [inferredFromFramework]
93
+ };
94
+ }
50
95
  function readJsonFile(path, fallback) {
51
96
  if (!existsSync(path)) return fallback;
52
97
  try {
@@ -210,11 +255,12 @@ async function getModelStatus(forceRefresh = false) {
210
255
  }
211
256
  async function getRuntimeStatus(config) {
212
257
  const detected = detectProject(projectRoot);
213
- const declaredArchitectures = [
214
- config?.backendArchitecture,
215
- config?.frontendFramework
216
- ].filter((value) => typeof value === "string" && value.length > 0);
217
- const activeArchitectures = inferProjectArchitectures(projectRoot, config);
258
+ const declared = resolveDeclaredArchitectures(config, detected.framework);
259
+ const inferredArchitectures = inferProjectArchitectures(projectRoot, config);
260
+ const activeArchitectures = [.../* @__PURE__ */ new Set([
261
+ ...inferredArchitectures,
262
+ ...declared.declaredArchitectures
263
+ ])];
218
264
  const database = parseDatabaseUrl(Config.databaseUrl);
219
265
  let postgres = {
220
266
  ...database,
@@ -249,7 +295,9 @@ async function getRuntimeStatus(config) {
249
295
  type: config?.projectType ?? "unknown",
250
296
  language: config?.language ?? detected.language,
251
297
  initialized: config !== null,
252
- declaredArchitectures,
298
+ backendArchitecture: declared.backendArchitecture,
299
+ frontendFramework: declared.frontendFramework,
300
+ declaredArchitectures: declared.declaredArchitectures,
253
301
  activeArchitectures,
254
302
  detected
255
303
  },
@@ -696,7 +744,8 @@ async function startDashboard(options = {}) {
696
744
  if (options.watch ?? true) {
697
745
  watcherStatus.enabled = true;
698
746
  void startWatch({
699
- path: projectRoot,
747
+ projectRoot,
748
+ path: ".",
700
749
  onEvent: handleWatchEvent,
701
750
  exitOnSetupFailure: false
702
751
  });
@@ -706,5 +755,7 @@ async function startDashboard(options = {}) {
706
755
  }
707
756
  }
708
757
  export {
758
+ mapFrameworkToArchitecture,
759
+ resolveDeclaredArchitectures,
709
760
  startDashboard
710
761
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shahmilsaari/memory-core",
3
- "version": "1.0.5",
3
+ "version": "1.0.8",
4
4
  "description": "Universal AI memory core — generate AI context files from architecture profiles with RAG support",
5
5
  "homepage": "https://memory-core.shahmilsaari.my/",
6
6
  "type": "module",
@@ -11,7 +11,7 @@ rules:
11
11
  - Repository pattern — services depend on repository interfaces, never directly on TypeORM/Prisma
12
12
  - Guards handle all authentication and authorization — never check tokens inside controllers or services
13
13
  - Use exception filters for all error handling — never return raw errors or catch exceptions in controllers
14
- - Interceptors handle cross-cutting concerns: logging, response transformation, caching
14
+ - "Interceptors handle cross-cutting concerns: logging, response transformation, caching"
15
15
  - ConfigModule with Joi/zod validation for all environment variables at startup
16
16
  - Each module uses forwardRef() only as a last resort — restructure to remove circular dependencies
17
17
  - Global pipes, guards, and filters are registered in main.ts — never duplicated per-controller
@@ -18,7 +18,7 @@ rules:
18
18
  - Return slow data as unresolved promises from load functions to enable streaming
19
19
  - Always use use:enhance on forms for progressive enhancement
20
20
  - Return field-keyed errors with fail() from form actions for inline validation
21
- - Order every component as: <script> → markup → <style>
21
+ - "Order every component as: <script> → markup → <style>"
22
22
  - Always use <script lang="ts"> for TypeScript in components
23
23
  - Use snippets ({#snippet} / {@render}) for composition — avoid the legacy <slot> API
24
24
  - Always key {#each} blocks with a unique ID — never use array index as a key
@@ -1,2 +0,0 @@
1
- var ql=Object.defineProperty;var zn=e=>{throw TypeError(e)};var Ul=(e,t,s)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Fe=(e,t,s)=>Ul(e,typeof t!="symbol"?t+"":t,s),tr=(e,t,s)=>t.has(e)||zn("Cannot "+s);var c=(e,t,s)=>(tr(e,t,"read from private field"),s?s.call(e):t.get(e)),N=(e,t,s)=>t.has(e)?zn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),D=(e,t,s,r)=>(tr(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),U=(e,t,s)=>(tr(e,t,"access private method"),s);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const u of i.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function s(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(a){if(a.ep)return;a.ep=!0;const i=s(a);fetch(a.href,i)}})();const Vl=!1;var wr=Array.isArray,zl=Array.prototype.indexOf,Vt=Array.prototype.includes,Ws=Array.from,Hl=Object.defineProperty,is=Object.getOwnPropertyDescriptor,ua=Object.getOwnPropertyDescriptors,Bl=Object.prototype,Kl=Array.prototype,Er=Object.getPrototypeOf,Hn=Object.isExtensible;const Yl=()=>{};function Gl(e){return e()}function lr(e){for(var t=0;t<e.length;t++)e[t]()}function va(){var e,t,s=new Promise((r,a)=>{e=r,t=a});return{promise:s,resolve:e,reject:t}}const le=2,zt=4,bs=8,da=1<<24,Be=16,$e=32,vt=64,or=128,Re=512,X=1024,re=2048,We=4096,ce=8192,Ce=16384,Dt=32768,Bn=1<<25,Ht=65536,cr=1<<17,Jl=1<<18,Yt=1<<19,pa=1<<20,He=1<<25,Rt=65536,Fs=1<<21,fs=1<<22,ft=1<<23,kt=Symbol("$state"),Xe=new class extends Error{constructor(){super(...arguments);Fe(this,"name","StaleReactionError");Fe(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function _a(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ql(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Xl(e,t,s){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Zl(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function eo(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function to(e){throw new Error("https://svelte.dev/e/effect_orphan")}function so(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ro(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function no(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ao(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function io(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const lo=1,oo=2,ha=4,co=8,fo=16,uo=2,ee=Symbol(),ga="http://www.w3.org/1999/xhtml";function vo(){console.warn("https://svelte.dev/e/derived_inert")}function po(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function _o(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ba(e){return e===this.v}function ho(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function ma(e){return!ho(e,this.v)}let ms=!1,go=!1;function bo(){ms=!0}let z=null;function Bt(e){z=e}function ya(e,t=!1,s){z={p:z,i:!1,c:null,e:null,s:e,x:null,r:O,l:ms&&!t?{s:null,u:null,$:[]}:null}}function wa(e){var t=z,s=t.e;if(s!==null){t.e=null;for(var r of s)Ua(r)}return t.i=!0,z=t.p,{}}function ys(){return!ms||z!==null&&z.l===null}let gt=[];function Ea(){var e=gt;gt=[],lr(e)}function ut(e){if(gt.length===0&&!ls){var t=gt;queueMicrotask(()=>{t===gt&&Ea()})}gt.push(e)}function mo(){for(;gt.length>0;)Ea()}function xa(e){var t=O;if(t===null)return I.f|=ft,e;if(!(t.f&Dt)&&!(t.f&zt))throw e;ct(e,t)}function ct(e,t){for(;t!==null;){if(t.f&or){if(!(t.f&Dt))throw e;try{t.b.error(e);return}catch(s){e=s}}t=t.parent}throw e}const yo=-7169;function Y(e,t){e.f=e.f&yo|t}function xr(e){e.f&Re||e.deps===null?Y(e,X):Y(e,We)}function ka(e){if(e!==null)for(const t of e)!(t.f&le)||!(t.f&Rt)||(t.f^=Rt,ka(t.deps))}function Sa(e,t,s){e.f&re?t.add(e):e.f&We&&s.add(e),ka(e.deps),Y(e,X)}const ht=new Set;let S=null,se=null,fr=null,ls=!1,sr=!1,Pt=null,Rs=null;var Kn=0;let wo=1;var jt,$t,mt,Ze,Ue,vs,be,ds,lt,et,Ve,Wt,qt,yt,Z,Cs,Ta,Ns,ur,Ms,Eo;const Ps=class Ps{constructor(){N(this,Z);Fe(this,"id",wo++);Fe(this,"current",new Map);Fe(this,"previous",new Map);N(this,jt,new Set);N(this,$t,new Set);N(this,mt,new Set);N(this,Ze,new Map);N(this,Ue,new Map);N(this,vs,null);N(this,be,[]);N(this,ds,[]);N(this,lt,new Set);N(this,et,new Set);N(this,Ve,new Map);N(this,Wt,new Set);Fe(this,"is_fork",!1);N(this,qt,!1);N(this,yt,new Set)}skip_effect(t){c(this,Ve).has(t)||c(this,Ve).set(t,{d:[],m:[]}),c(this,Wt).delete(t)}unskip_effect(t,s=r=>this.schedule(r)){var r=c(this,Ve).get(t);if(r){c(this,Ve).delete(t);for(var a of r.d)Y(a,re),s(a);for(a of r.m)Y(a,We),s(a)}c(this,Wt).add(t)}capture(t,s,r=!1){t.v!==ee&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&ft||(this.current.set(t,[s,r]),se==null||se.set(t,s)),this.is_fork||(t.v=s)}activate(){S=this}deactivate(){S=null,se=null}flush(){try{sr=!0,S=this,U(this,Z,Ns).call(this)}finally{Kn=0,fr=null,Pt=null,Rs=null,sr=!1,S=null,se=null,St.clear()}}discard(){for(const t of c(this,$t))t(this);c(this,$t).clear(),c(this,mt).clear(),ht.delete(this)}register_created_effect(t){c(this,ds).push(t)}increment(t,s){let r=c(this,Ze).get(s)??0;if(c(this,Ze).set(s,r+1),t){let a=c(this,Ue).get(s)??0;c(this,Ue).set(s,a+1)}}decrement(t,s,r){let a=c(this,Ze).get(s)??0;if(a===1?c(this,Ze).delete(s):c(this,Ze).set(s,a-1),t){let i=c(this,Ue).get(s)??0;i===1?c(this,Ue).delete(s):c(this,Ue).set(s,i-1)}c(this,qt)||r||(D(this,qt,!0),ut(()=>{D(this,qt,!1),this.flush()}))}transfer_effects(t,s){for(const r of t)c(this,lt).add(r);for(const r of s)c(this,et).add(r);t.clear(),s.clear()}oncommit(t){c(this,jt).add(t)}ondiscard(t){c(this,$t).add(t)}on_fork_commit(t){c(this,mt).add(t)}run_fork_commit_callbacks(){for(const t of c(this,mt))t(this);c(this,mt).clear()}settled(){return(c(this,vs)??D(this,vs,va())).promise}static ensure(){if(S===null){const t=S=new Ps;sr||(ht.add(S),ls||ut(()=>{S===t&&t.flush()}))}return S}apply(){{se=null;return}}schedule(t){var a;if(fr=t,(a=t.b)!=null&&a.is_pending&&t.f&(zt|bs|da)&&!(t.f&Dt)){t.b.defer_effect(t);return}for(var s=t;s.parent!==null;){s=s.parent;var r=s.f;if(Pt!==null&&s===O&&(I===null||!(I.f&le)))return;if(r&(vt|$e)){if(!(r&X))return;s.f^=X}}c(this,be).push(s)}};jt=new WeakMap,$t=new WeakMap,mt=new WeakMap,Ze=new WeakMap,Ue=new WeakMap,vs=new WeakMap,be=new WeakMap,ds=new WeakMap,lt=new WeakMap,et=new WeakMap,Ve=new WeakMap,Wt=new WeakMap,qt=new WeakMap,yt=new WeakMap,Z=new WeakSet,Cs=function(){return this.is_fork||c(this,Ue).size>0},Ta=function(){for(const r of c(this,yt))for(const a of c(r,Ue).keys()){for(var t=!1,s=a;s.parent!==null;){if(c(this,Ve).has(s)){t=!0;break}s=s.parent}if(!t)return!0}return!1},Ns=function(){var d,v;if(Kn++>1e3&&(ht.delete(this),ko()),!U(this,Z,Cs).call(this)){for(const p of c(this,lt))c(this,et).delete(p),Y(p,re),this.schedule(p);for(const p of c(this,et))Y(p,We),this.schedule(p)}const t=c(this,be);D(this,be,[]),this.apply();var s=Pt=[],r=[],a=Rs=[];for(const p of t)try{U(this,Z,ur).call(this,p,s,r)}catch(g){throw Ca(p),g}if(S=null,a.length>0){var i=Ps.ensure();for(const p of a)i.schedule(p)}if(Pt=null,Rs=null,U(this,Z,Cs).call(this)||U(this,Z,Ta).call(this)){U(this,Z,Ms).call(this,r),U(this,Z,Ms).call(this,s);for(const[p,g]of c(this,Ve))Ra(p,g)}else{c(this,Ze).size===0&&ht.delete(this),c(this,lt).clear(),c(this,et).clear();for(const p of c(this,jt))p(this);c(this,jt).clear(),Yn(r),Yn(s),(d=c(this,vs))==null||d.resolve()}var u=S;if(c(this,be).length>0){const p=u??(u=this);c(p,be).push(...c(this,be).filter(g=>!c(p,be).includes(g)))}u!==null&&(ht.add(u),U(v=u,Z,Ns).call(v))},ur=function(t,s,r){t.f^=X;for(var a=t.first;a!==null;){var i=a.f,u=(i&($e|vt))!==0,d=u&&(i&X)!==0,v=d||(i&ce)!==0||c(this,Ve).has(a);if(!v&&a.fn!==null){u?a.f^=X:i&zt?s.push(a):Gt(a)&&(i&Be&&c(this,et).add(a),Mt(a));var p=a.first;if(p!==null){a=p;continue}}for(;a!==null;){var g=a.next;if(g!==null){a=g;break}a=a.parent}}},Ms=function(t){for(var s=0;s<t.length;s+=1)Sa(t[s],c(this,lt),c(this,et))},Eo=function(){var g,E,w;for(const y of ht){var t=y.id<this.id,s=[];for(const[o,[T,m]]of this.current){if(y.current.has(o)){var r=y.current.get(o)[0];if(t&&T!==r)y.current.set(o,[T,m]);else continue}s.push(o)}var a=[...y.current.keys()].filter(o=>!this.current.has(o));if(a.length===0)t&&y.discard();else if(s.length>0){if(t)for(const o of c(this,Wt))y.unskip_effect(o,T=>{var m;T.f&(Be|fs)?y.schedule(T):U(m=y,Z,Ms).call(m,[T])});y.activate();var i=new Set,u=new Map;for(var d of s)Aa(d,a,i,u);u=new Map;var v=[...y.current.keys()].filter(o=>this.current.has(o)?this.current.get(o)[0]!==o:!0);for(const o of c(this,ds))!(o.f&(Ce|ce|cr))&&kr(o,v,u)&&(o.f&(fs|Be)?(Y(o,re),y.schedule(o)):c(y,lt).add(o));if(c(y,be).length>0){y.apply();for(var p of c(y,be))U(g=y,Z,ur).call(g,p,[],[]);D(y,be,[])}y.deactivate()}}for(const y of ht)c(y,yt).has(this)&&(c(y,yt).delete(this),c(y,yt).size===0&&!U(E=y,Z,Cs).call(E)&&(y.activate(),U(w=y,Z,Ns).call(w)))};let Ct=Ps;function xo(e){var t=ls;ls=!0;try{for(var s;;){if(mo(),S===null)return s;S.flush()}}finally{ls=t}}function ko(){try{so()}catch(e){ct(e,fr)}}let Le=null;function Yn(e){var t=e.length;if(t!==0){for(var s=0;s<t;){var r=e[s++];if(!(r.f&(Ce|ce))&&Gt(r)&&(Le=new Set,Mt(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&za(r),(Le==null?void 0:Le.size)>0)){St.clear();for(const a of Le){if(a.f&(Ce|ce))continue;const i=[a];let u=a.parent;for(;u!==null;)Le.has(u)&&(Le.delete(u),i.push(u)),u=u.parent;for(let d=i.length-1;d>=0;d--){const v=i[d];v.f&(Ce|ce)||Mt(v)}}Le.clear()}}Le=null}}function Aa(e,t,s,r){if(!s.has(e)&&(s.add(e),e.reactions!==null))for(const a of e.reactions){const i=a.f;i&le?Aa(a,t,s,r):i&(fs|Be)&&!(i&re)&&kr(a,t,r)&&(Y(a,re),Sr(a))}}function kr(e,t,s){const r=s.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const a of e.deps){if(Vt.call(t,a))return!0;if(a.f&le&&kr(a,t,s))return s.set(a,!0),!0}return s.set(e,!1),!1}function Sr(e){S.schedule(e)}function Ra(e,t){if(!(e.f&$e&&e.f&X)){e.f&re?t.d.push(e):e.f&We&&t.m.push(e),Y(e,X);for(var s=e.first;s!==null;)Ra(s,t),s=s.next}}function Ca(e){Y(e,X);for(var t=e.first;t!==null;)Ca(t),t=t.next}function So(e){let t=0,s=Nt(0),r;return()=>{Cr()&&(n(s),Us(()=>(t===0&&(r=b(()=>e(()=>os(s)))),t+=1,()=>{ut(()=>{t-=1,t===0&&(r==null||r(),r=void 0,os(s))})})))}}var To=Ht|Yt;function Ao(e,t,s,r){new Ro(e,t,s,r)}var ke,yr,Se,wt,ue,Te,oe,me,tt,Et,ot,Ut,ps,_s,st,js,G,Co,No,Mo,vr,Ds,Os,dr,pr;class Ro{constructor(t,s,r,a){N(this,G);Fe(this,"parent");Fe(this,"is_pending",!1);Fe(this,"transform_error");N(this,ke);N(this,yr,null);N(this,Se);N(this,wt);N(this,ue);N(this,Te,null);N(this,oe,null);N(this,me,null);N(this,tt,null);N(this,Et,0);N(this,ot,0);N(this,Ut,!1);N(this,ps,new Set);N(this,_s,new Set);N(this,st,null);N(this,js,So(()=>(D(this,st,Nt(c(this,Et))),()=>{D(this,st,null)})));var i;D(this,ke,t),D(this,Se,s),D(this,wt,u=>{var d=O;d.b=this,d.f|=or,r(u)}),this.parent=O.b,this.transform_error=a??((i=this.parent)==null?void 0:i.transform_error)??(u=>u),D(this,ue,Mr(()=>{U(this,G,vr).call(this)},To))}defer_effect(t){Sa(t,c(this,ps),c(this,_s))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(this,Se).pending}update_pending_count(t,s){U(this,G,dr).call(this,t,s),D(this,Et,c(this,Et)+t),!(!c(this,st)||c(this,Ut))&&(D(this,Ut,!0),ut(()=>{D(this,Ut,!1),c(this,st)&&Kt(c(this,st),c(this,Et))}))}get_effect_pending(){return c(this,js).call(this),n(c(this,st))}error(t){if(!c(this,Se).onerror&&!c(this,Se).failed)throw t;S!=null&&S.is_fork?(c(this,Te)&&S.skip_effect(c(this,Te)),c(this,oe)&&S.skip_effect(c(this,oe)),c(this,me)&&S.skip_effect(c(this,me)),S.on_fork_commit(()=>{U(this,G,pr).call(this,t)})):U(this,G,pr).call(this,t)}}ke=new WeakMap,yr=new WeakMap,Se=new WeakMap,wt=new WeakMap,ue=new WeakMap,Te=new WeakMap,oe=new WeakMap,me=new WeakMap,tt=new WeakMap,Et=new WeakMap,ot=new WeakMap,Ut=new WeakMap,ps=new WeakMap,_s=new WeakMap,st=new WeakMap,js=new WeakMap,G=new WeakSet,Co=function(){try{D(this,Te,Ae(()=>c(this,wt).call(this,c(this,ke))))}catch(t){this.error(t)}},No=function(t){const s=c(this,Se).failed;s&&D(this,me,Ae(()=>{s(c(this,ke),()=>t,()=>()=>{})}))},Mo=function(){const t=c(this,Se).pending;t&&(this.is_pending=!0,D(this,oe,Ae(()=>t(c(this,ke)))),ut(()=>{var s=D(this,tt,document.createDocumentFragment()),r=rt();s.append(r),D(this,Te,U(this,G,Os).call(this,()=>Ae(()=>c(this,wt).call(this,r)))),c(this,ot)===0&&(c(this,ke).before(s),D(this,tt,null),Tt(c(this,oe),()=>{D(this,oe,null)}),U(this,G,Ds).call(this,S))}))},vr=function(){try{if(this.is_pending=this.has_pending_snippet(),D(this,ot,0),D(this,Et,0),D(this,Te,Ae(()=>{c(this,wt).call(this,c(this,ke))})),c(this,ot)>0){var t=D(this,tt,document.createDocumentFragment());Ir(c(this,Te),t);const s=c(this,Se).pending;D(this,oe,Ae(()=>s(c(this,ke))))}else U(this,G,Ds).call(this,S)}catch(s){this.error(s)}},Ds=function(t){this.is_pending=!1,t.transfer_effects(c(this,ps),c(this,_s))},Os=function(t){var s=O,r=I,a=z;De(c(this,ue)),Me(c(this,ue)),Bt(c(this,ue).ctx);try{return Ct.ensure(),t()}catch(i){return xa(i),null}finally{De(s),Me(r),Bt(a)}},dr=function(t,s){var r;if(!this.has_pending_snippet()){this.parent&&U(r=this.parent,G,dr).call(r,t,s);return}D(this,ot,c(this,ot)+t),c(this,ot)===0&&(U(this,G,Ds).call(this,s),c(this,oe)&&Tt(c(this,oe),()=>{D(this,oe,null)}),c(this,tt)&&(c(this,ke).before(c(this,tt)),D(this,tt,null)))},pr=function(t){c(this,Te)&&(de(c(this,Te)),D(this,Te,null)),c(this,oe)&&(de(c(this,oe)),D(this,oe,null)),c(this,me)&&(de(c(this,me)),D(this,me,null));var s=c(this,Se).onerror;let r=c(this,Se).failed;var a=!1,i=!1;const u=()=>{if(a){_o();return}a=!0,i&&io(),c(this,me)!==null&&Tt(c(this,me),()=>{D(this,me,null)}),U(this,G,Os).call(this,()=>{U(this,G,vr).call(this)})},d=v=>{try{i=!0,s==null||s(v,u),i=!1}catch(p){ct(p,c(this,ue)&&c(this,ue).parent)}r&&D(this,me,U(this,G,Os).call(this,()=>{try{return Ae(()=>{var p=O;p.b=this,p.f|=or,r(c(this,ke),()=>v,()=>u)})}catch(p){return ct(p,c(this,ue).parent),null}}))};ut(()=>{var v;try{v=this.transform_error(t)}catch(p){ct(p,c(this,ue)&&c(this,ue).parent);return}v!==null&&typeof v=="object"&&typeof v.then=="function"?v.then(d,p=>ct(p,c(this,ue)&&c(this,ue).parent)):d(v)})};function Do(e,t,s,r){const a=ys()?Tr:Ma;var i=e.filter(w=>!w.settled);if(s.length===0&&i.length===0){r(t.map(a));return}var u=O,d=Oo(),v=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(w=>w.promise)):null;function p(w){d();try{r(w)}catch(y){u.f&Ce||ct(y,u)}Ls()}if(s.length===0){v.then(()=>p(t.map(a)));return}var g=Na();function E(){Promise.all(s.map(w=>Io(w))).then(w=>p([...t.map(a),...w])).catch(w=>ct(w,u)).finally(()=>g())}v?v.then(()=>{d(),E(),Ls()}):E()}function Oo(){var e=O,t=I,s=z,r=S;return function(i=!0){De(e),Me(t),Bt(s),i&&!(e.f&Ce)&&(r==null||r.activate(),r==null||r.apply())}}function Ls(e=!0){De(null),Me(null),Bt(null),e&&(S==null||S.deactivate())}function Na(){var e=O,t=e.b,s=S,r=t.is_rendered();return t.update_pending_count(1,s),s.increment(r,e),(a=!1)=>{t.update_pending_count(-1,s),s.decrement(r,e,a)}}function Tr(e){var t=le|re;return O!==null&&(O.f|=Yt),{ctx:z,deps:null,effects:null,equals:ba,f:t,fn:e,reactions:null,rv:0,v:ee,wv:0,parent:O,ac:null}}function Io(e,t,s){let r=O;r===null&&Ql();var a=void 0,i=Nt(ee),u=!I,d=new Map;return Go(()=>{var y;var v=O,p=va();a=p.promise;try{Promise.resolve(e()).then(p.resolve,p.reject).finally(Ls)}catch(o){p.reject(o),Ls()}var g=S;if(u){if(v.f&Dt)var E=Na();if(r.b.is_rendered())(y=d.get(g))==null||y.reject(Xe),d.delete(g);else{for(const o of d.values())o.reject(Xe);d.clear()}d.set(g,p)}const w=(o,T=void 0)=>{if(E){var m=T===Xe;E(m)}if(!(T===Xe||v.f&Ce)){if(g.activate(),T)i.f|=ft,Kt(i,T);else{i.f&ft&&(i.f^=ft),Kt(i,o);for(const[R,$]of d){if(d.delete(R),R===g)break;$.reject(Xe)}}g.deactivate()}};p.promise.then(w,o=>w(null,o||"unknown"))}),Nr(()=>{for(const v of d.values())v.reject(Xe)}),new Promise(v=>{function p(g){function E(){g===a?v(i):p(a)}g.then(E,E)}p(a)})}function Ma(e){const t=Tr(e);return t.equals=ma,t}function Fo(e){var t=e.effects;if(t!==null){e.effects=null;for(var s=0;s<t.length;s+=1)de(t[s])}}function Ar(e){var t,s=O,r=e.parent;if(!dt&&r!==null&&r.f&(Ce|ce))return vo(),e.v;De(r);try{e.f&=~Rt,Fo(e),t=Ja(e)}finally{De(s)}return t}function Da(e){var t=Ar(e);if(!e.equals(t)&&(e.wv=Ya(),(!(S!=null&&S.is_fork)||e.deps===null)&&(S!==null?S.capture(e,t,!0):e.v=t,e.deps===null))){Y(e,X);return}dt||(se!==null?(Cr()||S!=null&&S.is_fork)&&se.set(e,t):xr(e))}function Lo(e){var t,s;if(e.effects!==null)for(const r of e.effects)(r.teardown||r.ac)&&((t=r.teardown)==null||t.call(r),(s=r.ac)==null||s.abort(Xe),r.teardown=Yl,r.ac=null,us(r,0),Dr(r))}function Oa(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&Mt(t)}let _r=new Set;const St=new Map;let Ia=!1;function Nt(e,t){var s={f:0,v:e,reactions:null,equals:ba,rv:0,wv:0};return s}function at(e,t){const s=Nt(e);return Xo(s),s}function Q(e,t=!1,s=!0){var a;const r=Nt(e);return t||(r.equals=ma),ms&&s&&z!==null&&z.l!==null&&((a=z.l).s??(a.s=[])).push(r),r}function ts(e,t){return M(e,b(()=>n(e))),t}function M(e,t,s=!1){I!==null&&(!je||I.f&cr)&&ys()&&I.f&(le|Be|fs|cr)&&(Ne===null||!Vt.call(Ne,e))&&ao();let r=s?ns(t):t;return Kt(e,r,Rs)}function Kt(e,t,s=null){if(!e.equals(t)){St.set(e,dt?t:e.v);var r=Ct.ensure();if(r.capture(e,t),e.f&le){const a=e;e.f&re&&Ar(a),se===null&&xr(a)}e.wv=Ya(),Fa(e,re,s),ys()&&O!==null&&O.f&X&&!(O.f&($e|vt))&&(xe===null?Zo([e]):xe.push(e)),!r.is_fork&&_r.size>0&&!Ia&&Po()}return t}function Po(){Ia=!1;for(const e of _r)e.f&X&&Y(e,We),Gt(e)&&Mt(e);_r.clear()}function os(e){M(e,e.v+1)}function Fa(e,t,s){var r=e.reactions;if(r!==null)for(var a=ys(),i=r.length,u=0;u<i;u++){var d=r[u],v=d.f;if(!(!a&&d===O)){var p=(v&re)===0;if(p&&Y(d,t),v&le){var g=d;se==null||se.delete(g),v&Rt||(v&Re&&(O===null||!(O.f&Fs))&&(d.f|=Rt),Fa(g,We,s))}else if(p){var E=d;v&Be&&Le!==null&&Le.add(E),s!==null?s.push(E):Sr(E)}}}}function ns(e){if(typeof e!="object"||e===null||kt in e)return e;const t=Er(e);if(t!==Bl&&t!==Kl)return e;var s=new Map,r=wr(e),a=at(0),i=At,u=d=>{if(At===i)return d();var v=I,p=At;Me(null),Zn(i);var g=d();return Me(v),Zn(p),g};return r&&s.set("length",at(e.length)),new Proxy(e,{defineProperty(d,v,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&ro();var g=s.get(v);return g===void 0?u(()=>{var E=at(p.value);return s.set(v,E),E}):M(g,p.value,!0),!0},deleteProperty(d,v){var p=s.get(v);if(p===void 0){if(v in d){const g=u(()=>at(ee));s.set(v,g),os(a)}}else M(p,ee),os(a);return!0},get(d,v,p){var y;if(v===kt)return e;var g=s.get(v),E=v in d;if(g===void 0&&(!E||(y=is(d,v))!=null&&y.writable)&&(g=u(()=>{var o=ns(E?d[v]:ee),T=at(o);return T}),s.set(v,g)),g!==void 0){var w=n(g);return w===ee?void 0:w}return Reflect.get(d,v,p)},getOwnPropertyDescriptor(d,v){var p=Reflect.getOwnPropertyDescriptor(d,v);if(p&&"value"in p){var g=s.get(v);g&&(p.value=n(g))}else if(p===void 0){var E=s.get(v),w=E==null?void 0:E.v;if(E!==void 0&&w!==ee)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return p},has(d,v){var w;if(v===kt)return!0;var p=s.get(v),g=p!==void 0&&p.v!==ee||Reflect.has(d,v);if(p!==void 0||O!==null&&(!g||(w=is(d,v))!=null&&w.writable)){p===void 0&&(p=u(()=>{var y=g?ns(d[v]):ee,o=at(y);return o}),s.set(v,p));var E=n(p);if(E===ee)return!1}return g},set(d,v,p,g){var L;var E=s.get(v),w=v in d;if(r&&v==="length")for(var y=p;y<E.v;y+=1){var o=s.get(y+"");o!==void 0?M(o,ee):y in d&&(o=u(()=>at(ee)),s.set(y+"",o))}if(E===void 0)(!w||(L=is(d,v))!=null&&L.writable)&&(E=u(()=>at(void 0)),M(E,ns(p)),s.set(v,E));else{w=E.v!==ee;var T=u(()=>ns(p));M(E,T)}var m=Reflect.getOwnPropertyDescriptor(d,v);if(m!=null&&m.set&&m.set.call(g,p),!w){if(r&&typeof v=="string"){var R=s.get("length"),$=Number(v);Number.isInteger($)&&$>=R.v&&M(R,$+1)}os(a)}return!0},ownKeys(d){n(a);var v=Reflect.ownKeys(d).filter(E=>{var w=s.get(E);return w===void 0||w.v!==ee});for(var[p,g]of s)g.v!==ee&&!(p in d)&&v.push(p);return v},setPrototypeOf(){no()}})}function Gn(e){try{if(e!==null&&typeof e=="object"&&kt in e)return e[kt]}catch{}return e}function jo(e,t){return Object.is(Gn(e),Gn(t))}var Jn,La,Pa,ja;function $o(){if(Jn===void 0){Jn=window,La=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,s=Text.prototype;Pa=is(t,"firstChild").get,ja=is(t,"nextSibling").get,Hn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),Hn(s)&&(s.__t=void 0)}}function rt(e=""){return document.createTextNode(e)}function Rr(e){return Pa.call(e)}function ws(e){return ja.call(e)}function _(e,t){return Rr(e)}function Wo(e,t=!1){{var s=Rr(e);return s instanceof Comment&&s.data===""?ws(s):s}}function h(e,t=1,s=!1){let r=e;for(;t--;)r=ws(r);return r}function qo(e){e.textContent=""}function $a(){return!1}function Uo(e,t,s){return document.createElementNS(ga,e,void 0)}let Qn=!1;function Vo(){Qn||(Qn=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const s of e.target.elements)(t=s.__on_r)==null||t.call(s)})},{capture:!0}))}function qs(e){var t=I,s=O;Me(null),De(null);try{return e()}finally{Me(t),De(s)}}function Wa(e,t,s,r=s){e.addEventListener(t,()=>qs(s));const a=e.__on_r;a?e.__on_r=()=>{a(),r(!0)}:e.__on_r=()=>r(!0),Vo()}function qa(e){O===null&&(I===null&&to(),eo()),dt&&Zl()}function zo(e,t){var s=t.last;s===null?t.last=t.first=e:(s.next=e,e.prev=s,t.last=e)}function Ke(e,t){var s=O;s!==null&&s.f&ce&&(e|=ce);var r={ctx:z,deps:null,nodes:null,f:e|re|Re,first:null,fn:t,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,wv:0,ac:null};S==null||S.register_created_effect(r);var a=r;if(e&zt)Pt!==null?Pt.push(r):Ct.ensure().schedule(r);else if(t!==null){try{Mt(r)}catch(u){throw de(r),u}a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&!(a.f&Yt)&&(a=a.first,e&Be&&e&Ht&&a!==null&&(a.f|=Ht))}if(a!==null&&(a.parent=s,s!==null&&zo(a,s),I!==null&&I.f&le&&!(e&vt))){var i=I;(i.effects??(i.effects=[])).push(a)}return r}function Cr(){return I!==null&&!je}function Nr(e){const t=Ke(bs,null);return Y(t,X),t.teardown=e,t}function hr(e){qa();var t=O.f,s=!I&&(t&$e)!==0&&(t&Dt)===0;if(s){var r=z;(r.e??(r.e=[])).push(e)}else return Ua(e)}function Ua(e){return Ke(zt|pa,e)}function Ho(e){return qa(),Ke(bs|pa,e)}function Bo(e){Ct.ensure();const t=Ke(vt|Yt,e);return(s={})=>new Promise(r=>{s.outro?Tt(t,()=>{de(t),r(void 0)}):(de(t),r(void 0))})}function Ko(e){return Ke(zt,e)}function Ee(e,t){var s=z,r={effect:null,ran:!1,deps:e};s.l.$.push(r),r.effect=Us(()=>{if(e(),!r.ran){r.ran=!0;var a=O;try{De(a.parent),b(t)}finally{De(a)}}})}function Yo(){var e=z;Us(()=>{for(var t of e.l.$){t.deps();var s=t.effect;s.f&X&&s.deps!==null&&Y(s,We),Gt(s)&&Mt(s),t.ran=!1}})}function Go(e){return Ke(fs|Yt,e)}function Us(e,t=0){return Ke(bs|t,e)}function V(e,t=[],s=[],r=[]){Do(r,t,s,a=>{Ke(bs,()=>e(...a.map(n)))})}function Mr(e,t=0){var s=Ke(Be|t,e);return s}function Ae(e){return Ke($e|Yt,e)}function Va(e){var t=e.teardown;if(t!==null){const s=dt,r=I;Xn(!0),Me(null);try{t.call(null)}finally{Xn(s),Me(r)}}}function Dr(e,t=!1){var s=e.first;for(e.first=e.last=null;s!==null;){const a=s.ac;a!==null&&qs(()=>{a.abort(Xe)});var r=s.next;s.f&vt?s.parent=null:de(s,t),s=r}}function Jo(e){for(var t=e.first;t!==null;){var s=t.next;t.f&$e||de(t),t=s}}function de(e,t=!0){var s=!1;(t||e.f&Jl)&&e.nodes!==null&&e.nodes.end!==null&&(Qo(e.nodes.start,e.nodes.end),s=!0),Y(e,Bn),Dr(e,t&&!s),us(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const i of r)i.stop();Va(e),e.f^=Bn,e.f|=Ce;var a=e.parent;a!==null&&a.first!==null&&za(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Qo(e,t){for(;e!==null;){var s=e===t?null:ws(e);e.remove(),e=s}}function za(e){var t=e.parent,s=e.prev,r=e.next;s!==null&&(s.next=r),r!==null&&(r.prev=s),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=s))}function Tt(e,t,s=!0){var r=[];Ha(e,r,!0);var a=()=>{s&&de(e),t&&t()},i=r.length;if(i>0){var u=()=>--i||a();for(var d of r)d.out(u)}else a()}function Ha(e,t,s){if(!(e.f&ce)){e.f^=ce;var r=e.nodes&&e.nodes.t;if(r!==null)for(const d of r)(d.is_global||s)&&t.push(d);for(var a=e.first;a!==null;){var i=a.next;if(!(a.f&vt)){var u=(a.f&Ht)!==0||(a.f&$e)!==0&&(e.f&Be)!==0;Ha(a,t,u?s:!1)}a=i}}}function Or(e){Ba(e,!0)}function Ba(e,t){if(e.f&ce){e.f^=ce,e.f&X||(Y(e,re),Ct.ensure().schedule(e));for(var s=e.first;s!==null;){var r=s.next,a=(s.f&Ht)!==0||(s.f&$e)!==0;Ba(s,a?t:!1),s=r}var i=e.nodes&&e.nodes.t;if(i!==null)for(const u of i)(u.is_global||t)&&u.in()}}function Ir(e,t){if(e.nodes)for(var s=e.nodes.start,r=e.nodes.end;s!==null;){var a=s===r?null:ws(s);t.append(s),s=a}}let Is=!1,dt=!1;function Xn(e){dt=e}let I=null,je=!1;function Me(e){I=e}let O=null;function De(e){O=e}let Ne=null;function Xo(e){I!==null&&(Ne===null?Ne=[e]:Ne.push(e))}let ve=null,ge=0,xe=null;function Zo(e){xe=e}let Ka=1,bt=0,At=bt;function Zn(e){At=e}function Ya(){return++Ka}function Gt(e){var t=e.f;if(t&re)return!0;if(t&le&&(e.f&=~Rt),t&We){for(var s=e.deps,r=s.length,a=0;a<r;a++){var i=s[a];if(Gt(i)&&Da(i),i.wv>e.wv)return!0}t&Re&&se===null&&Y(e,X)}return!1}function Ga(e,t,s=!0){var r=e.reactions;if(r!==null&&!(Ne!==null&&Vt.call(Ne,e)))for(var a=0;a<r.length;a++){var i=r[a];i.f&le?Ga(i,t,!1):t===i&&(s?Y(i,re):i.f&X&&Y(i,We),Sr(i))}}function Ja(e){var T;var t=ve,s=ge,r=xe,a=I,i=Ne,u=z,d=je,v=At,p=e.f;ve=null,ge=0,xe=null,I=p&($e|vt)?null:e,Ne=null,Bt(e.ctx),je=!1,At=++bt,e.ac!==null&&(qs(()=>{e.ac.abort(Xe)}),e.ac=null);try{e.f|=Fs;var g=e.fn,E=g();e.f|=Dt;var w=e.deps,y=S==null?void 0:S.is_fork;if(ve!==null){var o;if(y||us(e,ge),w!==null&&ge>0)for(w.length=ge+ve.length,o=0;o<ve.length;o++)w[ge+o]=ve[o];else e.deps=w=ve;if(Cr()&&e.f&Re)for(o=ge;o<w.length;o++)((T=w[o]).reactions??(T.reactions=[])).push(e)}else!y&&w!==null&&ge<w.length&&(us(e,ge),w.length=ge);if(ys()&&xe!==null&&!je&&w!==null&&!(e.f&(le|We|re)))for(o=0;o<xe.length;o++)Ga(xe[o],e);if(a!==null&&a!==e){if(bt++,a.deps!==null)for(let m=0;m<s;m+=1)a.deps[m].rv=bt;if(t!==null)for(const m of t)m.rv=bt;xe!==null&&(r===null?r=xe:r.push(...xe))}return e.f&ft&&(e.f^=ft),E}catch(m){return xa(m)}finally{e.f^=Fs,ve=t,ge=s,xe=r,I=a,Ne=i,Bt(u),je=d,At=v}}function ec(e,t){let s=t.reactions;if(s!==null){var r=zl.call(s,e);if(r!==-1){var a=s.length-1;a===0?s=t.reactions=null:(s[r]=s[a],s.pop())}}if(s===null&&t.f&le&&(ve===null||!Vt.call(ve,t))){var i=t;i.f&Re&&(i.f^=Re,i.f&=~Rt),i.v!==ee&&xr(i),Lo(i),us(i,0)}}function us(e,t){var s=e.deps;if(s!==null)for(var r=t;r<s.length;r++)ec(e,s[r])}function Mt(e){var t=e.f;if(!(t&Ce)){Y(e,X);var s=O,r=Is;O=e,Is=!0;try{t&(Be|da)?Jo(e):Dr(e),Va(e);var a=Ja(e);e.teardown=typeof a=="function"?a:null,e.wv=Ka;var i;Vl&&go&&e.f&re&&e.deps}finally{Is=r,O=s}}}async function tc(){await Promise.resolve(),xo()}function n(e){var t=e.f,s=(t&le)!==0;if(I!==null&&!je){var r=O!==null&&(O.f&Ce)!==0;if(!r&&(Ne===null||!Vt.call(Ne,e))){var a=I.deps;if(I.f&Fs)e.rv<bt&&(e.rv=bt,ve===null&&a!==null&&a[ge]===e?ge++:ve===null?ve=[e]:ve.push(e));else{(I.deps??(I.deps=[])).push(e);var i=e.reactions;i===null?e.reactions=[I]:Vt.call(i,I)||i.push(I)}}}if(dt&&St.has(e))return St.get(e);if(s){var u=e;if(dt){var d=u.v;return(!(u.f&X)&&u.reactions!==null||Xa(u))&&(d=Ar(u)),St.set(u,d),d}var v=(u.f&Re)===0&&!je&&I!==null&&(Is||(I.f&Re)!==0),p=(u.f&Dt)===0;Gt(u)&&(v&&(u.f|=Re),Da(u)),v&&!p&&(Oa(u),Qa(u))}if(se!=null&&se.has(e))return se.get(e);if(e.f&ft)throw e.v;return e.v}function Qa(e){if(e.f|=Re,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&le&&!(t.f&Re)&&(Oa(t),Qa(t))}function Xa(e){if(e.v===ee)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(St.has(t)||t.f&le&&Xa(t))return!0;return!1}function b(e){var t=je;try{return je=!0,e()}finally{je=t}}function sc(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(kt in e)gr(e);else if(!Array.isArray(e))for(let t in e){const s=e[t];typeof s=="object"&&s&&kt in s&&gr(s)}}}function gr(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let r in e)try{gr(e[r],t)}catch{}const s=Er(e);if(s!==Object.prototype&&s!==Array.prototype&&s!==Map.prototype&&s!==Set.prototype&&s!==Date.prototype){const r=ua(s);for(let a in r){const i=r[a].get;if(i)try{i.call(e)}catch{}}}}}const rc=["touchstart","touchmove"];function nc(e){return rc.includes(e)}const Ss=Symbol("events"),ac=new Set,ea=new Set;function ic(e,t,s,r={}){function a(i){if(r.capture||br.call(t,i),!i.cancelBubble)return qs(()=>s==null?void 0:s.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?ut(()=>{t.addEventListener(e,a,r)}):t.addEventListener(e,a,r),a}function ta(e,t,s,r,a){var i={capture:r,passive:a},u=ic(e,t,s,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Nr(()=>{t.removeEventListener(e,u,i)})}let sa=null;function br(e){var m,R;var t=this,s=t.ownerDocument,r=e.type,a=((m=e.composedPath)==null?void 0:m.call(e))||[],i=a[0]||e.target;sa=e;var u=0,d=sa===e&&e[Ss];if(d){var v=a.indexOf(d);if(v!==-1&&(t===document||t===window)){e[Ss]=t;return}var p=a.indexOf(t);if(p===-1)return;v<=p&&(u=v)}if(i=a[u]||e.target,i!==t){Hl(e,"currentTarget",{configurable:!0,get(){return i||s}});var g=I,E=O;Me(null),De(null);try{for(var w,y=[];i!==null;){var o=i.assignedSlot||i.parentNode||i.host||null;try{var T=(R=i[Ss])==null?void 0:R[r];T!=null&&(!i.disabled||e.target===i)&&T.call(i,e)}catch($){w?y.push($):w=$}if(e.cancelBubble||o===t||o===null)break;i=o}if(w){for(let $ of y)queueMicrotask(()=>{throw $});throw w}}finally{e[Ss]=t,delete e.currentTarget,Me(g),De(E)}}}var ca;const rr=((ca=globalThis==null?void 0:globalThis.window)==null?void 0:ca.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function lc(e){return(rr==null?void 0:rr.createHTML(e))??e}function oc(e){var t=Uo("template");return t.innerHTML=lc(e.replaceAll("<!>","<!---->")),t.content}function Fr(e,t){var s=O;s.nodes===null&&(s.nodes={start:e,end:t,a:null,t:null})}function W(e,t){var s=(t&uo)!==0,r,a=!e.startsWith("<!>");return()=>{r===void 0&&(r=oc(a?e:"<!>"+e),r=Rr(r));var i=s||La?document.importNode(r,!0):r.cloneNode(!0);return Fr(i,i),i}}function ra(e=""){{var t=rt(e+"");return Fr(t,t),t}}function cc(){var e=document.createDocumentFragment(),t=document.createComment(""),s=rt();return e.append(t,s),Fr(t,s),e}function P(e,t){e!==null&&e.before(t)}function x(e,t){var s=t==null?"":typeof t=="object"?`${t}`:t;s!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=s,e.nodeValue=`${s}`)}function fc(e,t){return uc(e,t)}const Ts=new Map;function uc(e,{target:t,anchor:s,props:r={},events:a,context:i,intro:u=!0,transformError:d}){$o();var v=void 0,p=Bo(()=>{var g=s??t.appendChild(rt());Ao(g,{pending:()=>{}},y=>{ya({});var o=z;i&&(o.c=i),a&&(r.$$events=a),v=e(y,r)||{},wa()},d);var E=new Set,w=y=>{for(var o=0;o<y.length;o++){var T=y[o];if(!E.has(T)){E.add(T);var m=nc(T);for(const L of[t,document]){var R=Ts.get(L);R===void 0&&(R=new Map,Ts.set(L,R));var $=R.get(T);$===void 0?(L.addEventListener(T,br,{passive:m}),R.set(T,1)):R.set(T,$+1)}}}};return w(Ws(ac)),ea.add(w),()=>{var m;for(var y of E)for(const R of[t,document]){var o=Ts.get(R),T=o.get(y);--T==0?(R.removeEventListener(y,br),o.delete(y),o.size===0&&Ts.delete(R)):o.set(y,T)}ea.delete(w),g!==s&&((m=g.parentNode)==null||m.removeChild(g))}});return vc.set(v,p),v}let vc=new WeakMap;var Pe,ze,ye,xt,hs,gs,$s;class dc{constructor(t,s=!0){Fe(this,"anchor");N(this,Pe,new Map);N(this,ze,new Map);N(this,ye,new Map);N(this,xt,new Set);N(this,hs,!0);N(this,gs,t=>{if(c(this,Pe).has(t)){var s=c(this,Pe).get(t),r=c(this,ze).get(s);if(r)Or(r),c(this,xt).delete(s);else{var a=c(this,ye).get(s);a&&(c(this,ze).set(s,a.effect),c(this,ye).delete(s),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),r=a.effect)}for(const[i,u]of c(this,Pe)){if(c(this,Pe).delete(i),i===t)break;const d=c(this,ye).get(u);d&&(de(d.effect),c(this,ye).delete(u))}for(const[i,u]of c(this,ze)){if(i===s||c(this,xt).has(i))continue;const d=()=>{if(Array.from(c(this,Pe).values()).includes(i)){var p=document.createDocumentFragment();Ir(u,p),p.append(rt()),c(this,ye).set(i,{effect:u,fragment:p})}else de(u);c(this,xt).delete(i),c(this,ze).delete(i)};c(this,hs)||!r?(c(this,xt).add(i),Tt(u,d,!1)):d()}}});N(this,$s,t=>{c(this,Pe).delete(t);const s=Array.from(c(this,Pe).values());for(const[r,a]of c(this,ye))s.includes(r)||(de(a.effect),c(this,ye).delete(r))});this.anchor=t,D(this,hs,s)}ensure(t,s){var r=S,a=$a();if(s&&!c(this,ze).has(t)&&!c(this,ye).has(t))if(a){var i=document.createDocumentFragment(),u=rt();i.append(u),c(this,ye).set(t,{effect:Ae(()=>s(u)),fragment:i})}else c(this,ze).set(t,Ae(()=>s(this.anchor)));if(c(this,Pe).set(r,t),a){for(const[d,v]of c(this,ze))d===t?r.unskip_effect(v):r.skip_effect(v);for(const[d,v]of c(this,ye))d===t?r.unskip_effect(v.effect):r.skip_effect(v.effect);r.oncommit(c(this,gs)),r.ondiscard(c(this,$s))}else c(this,gs).call(this,r)}}Pe=new WeakMap,ze=new WeakMap,ye=new WeakMap,xt=new WeakMap,hs=new WeakMap,gs=new WeakMap,$s=new WeakMap;function fe(e,t,s=!1){var r=new dc(e),a=s?Ht:0;function i(u,d){r.ensure(u,d)}Mr(()=>{var u=!1;t((d,v=0)=>{u=!0,i(v,d)}),u||i(-1,null)},a)}function pc(e,t,s){for(var r=[],a=t.length,i,u=t.length,d=0;d<a;d++){let E=t[d];Tt(E,()=>{if(i){if(i.pending.delete(E),i.done.add(E),i.pending.size===0){var w=e.outrogroups;mr(e,Ws(i.done)),w.delete(i),w.size===0&&(e.outrogroups=null)}}else u-=1},!1)}if(u===0){var v=r.length===0&&s!==null;if(v){var p=s,g=p.parentNode;qo(g),g.append(p),e.items.clear()}mr(e,t,!v)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function mr(e,t,s=!0){var r;if(e.pending.size>0){r=new Set;for(const u of e.pending.values())for(const d of u)r.add(e.items.get(d).e)}for(var a=0;a<t.length;a++){var i=t[a];if(r!=null&&r.has(i)){i.f|=He;const u=document.createDocumentFragment();Ir(i,u)}else de(t[a],s)}}var na;function Lt(e,t,s,r,a,i=null){var u=e,d=new Map,v=(t&ha)!==0;if(v){var p=e;u=p.appendChild(rt())}var g=null,E=Ma(()=>{var L=s();return wr(L)?L:L==null?[]:Ws(L)}),w,y=new Map,o=!0;function T(L){$.effect.f&Ce||($.pending.delete(L),$.fallback=g,_c($,w,u,t,r),g!==null&&(w.length===0?g.f&He?(g.f^=He,as(g,null,u)):Or(g):Tt(g,()=>{g=null})))}function m(L){$.pending.delete(L)}var R=Mr(()=>{w=n(E);for(var L=w.length,J=new Set,ne=S,qe=$a(),F=0;F<L;F+=1){var Ye=w[F],nt=r(Ye,F),ae=o?null:d.get(nt);ae?(ae.v&&Kt(ae.v,Ye),ae.i&&Kt(ae.i,F),qe&&ne.unskip_effect(ae.e)):(ae=hc(d,o?u:na??(na=rt()),Ye,nt,F,a,t,s),o||(ae.e.f|=He),d.set(nt,ae)),J.add(nt)}if(L===0&&i&&!g&&(o?g=Ae(()=>i(u)):(g=Ae(()=>i(na??(na=rt()))),g.f|=He)),L>J.size&&Xl(),!o)if(y.set(ne,J),qe){for(const[pt,Ge]of d)J.has(pt)||ne.skip_effect(Ge.e);ne.oncommit(T),ne.ondiscard(m)}else T(ne);n(E)}),$={effect:R,items:d,pending:y,outrogroups:null,fallback:g};o=!1}function ss(e){for(;e!==null&&!(e.f&$e);)e=e.next;return e}function _c(e,t,s,r,a){var ae,pt,Ge,Es,Jt,Qt,Xt,Zt,xs;var i=(r&co)!==0,u=t.length,d=e.items,v=ss(e.effect.first),p,g=null,E,w=[],y=[],o,T,m,R;if(i)for(R=0;R<u;R+=1)o=t[R],T=a(o,R),m=d.get(T).e,m.f&He||((pt=(ae=m.nodes)==null?void 0:ae.a)==null||pt.measure(),(E??(E=new Set)).add(m));for(R=0;R<u;R+=1){if(o=t[R],T=a(o,R),m=d.get(T).e,e.outrogroups!==null)for(const pe of e.outrogroups)pe.pending.delete(m),pe.done.delete(m);if(m.f&ce&&(Or(m),i&&((Es=(Ge=m.nodes)==null?void 0:Ge.a)==null||Es.unfix(),(E??(E=new Set)).delete(m))),m.f&He)if(m.f^=He,m===v)as(m,null,s);else{var $=g?g.next:v;m===e.effect.last&&(e.effect.last=m.prev),m.prev&&(m.prev.next=m.next),m.next&&(m.next.prev=m.prev),it(e,g,m),it(e,m,$),as(m,$,s),g=m,w=[],y=[],v=ss(g.next);continue}if(m!==v){if(p!==void 0&&p.has(m)){if(w.length<y.length){var L=y[0],J;g=L.prev;var ne=w[0],qe=w[w.length-1];for(J=0;J<w.length;J+=1)as(w[J],L,s);for(J=0;J<y.length;J+=1)p.delete(y[J]);it(e,ne.prev,qe.next),it(e,g,ne),it(e,qe,L),v=L,g=qe,R-=1,w=[],y=[]}else p.delete(m),as(m,v,s),it(e,m.prev,m.next),it(e,m,g===null?e.effect.first:g.next),it(e,g,m),g=m;continue}for(w=[],y=[];v!==null&&v!==m;)(p??(p=new Set)).add(v),y.push(v),v=ss(v.next);if(v===null)continue}m.f&He||w.push(m),g=m,v=ss(m.next)}if(e.outrogroups!==null){for(const pe of e.outrogroups)pe.pending.size===0&&(mr(e,Ws(pe.done)),(Jt=e.outrogroups)==null||Jt.delete(pe));e.outrogroups.size===0&&(e.outrogroups=null)}if(v!==null||p!==void 0){var F=[];if(p!==void 0)for(m of p)m.f&ce||F.push(m);for(;v!==null;)!(v.f&ce)&&v!==e.fallback&&F.push(v),v=ss(v.next);var Ye=F.length;if(Ye>0){var nt=r&ha&&u===0?s:null;if(i){for(R=0;R<Ye;R+=1)(Xt=(Qt=F[R].nodes)==null?void 0:Qt.a)==null||Xt.measure();for(R=0;R<Ye;R+=1)(xs=(Zt=F[R].nodes)==null?void 0:Zt.a)==null||xs.fix()}pc(e,F,nt)}}i&&ut(()=>{var pe,ks;if(E!==void 0)for(m of E)(ks=(pe=m.nodes)==null?void 0:pe.a)==null||ks.apply()})}function hc(e,t,s,r,a,i,u,d){var v=u&lo?u&fo?Nt(s):Q(s,!1,!1):null,p=u&oo?Nt(a):null;return{v,i:p,e:Ae(()=>(i(t,v??s,p??a,d),()=>{e.delete(r)}))}}function as(e,t,s){if(e.nodes)for(var r=e.nodes.start,a=e.nodes.end,i=t&&!(t.f&He)?t.nodes.start:s;r!==null;){var u=ws(r);if(i.before(r),r===a)return;r=u}}function it(e,t,s){t===null?e.effect.first=s:t.next=s,s===null?e.effect.last=t:s.prev=t}const aa=[...`
2
- \r\f \v\uFEFF`];function gc(e,t,s){var r=e==null?"":""+e;if(s){for(var a of Object.keys(s))if(s[a])r=r?r+" "+a:a;else if(r.length)for(var i=a.length,u=0;(u=r.indexOf(a,u))>=0;){var d=u+i;(u===0||aa.includes(r[u-1]))&&(d===r.length||aa.includes(r[d]))?r=(u===0?"":r.substring(0,u))+r.substring(d+1):u=d}}return r===""?null:r}function bc(e,t){return e==null?null:String(e)}function rs(e,t,s,r,a,i){var u=e.__className;if(u!==s||u===void 0){var d=gc(s,r,i);d==null?e.removeAttribute("class"):e.className=d,e.__className=s}else if(i&&a!==i)for(var v in i){var p=!!i[v];(a==null||p!==!!a[v])&&e.classList.toggle(v,p)}return i}function ia(e,t,s,r){var a=e.__style;if(a!==t){var i=bc(t);i==null?e.removeAttribute("style"):e.style.cssText=i,e.__style=t}return r}function Za(e,t,s=!1){if(e.multiple){if(t==null)return;if(!wr(t))return po();for(var r of e.options)r.selected=t.includes(cs(r));return}for(r of e.options){var a=cs(r);if(jo(a,t)){r.selected=!0;return}}(!s||t!==void 0)&&(e.selectedIndex=-1)}function mc(e){var t=new MutationObserver(()=>{Za(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Nr(()=>{t.disconnect()})}function nr(e,t,s=t){var r=new WeakSet,a=!0;Wa(e,"change",i=>{var u=i?"[selected]":":checked",d;if(e.multiple)d=[].map.call(e.querySelectorAll(u),cs);else{var v=e.querySelector(u)??e.querySelector("option:not([disabled])");d=v&&cs(v)}s(d),e.__value=d,S!==null&&r.add(S)}),Ko(()=>{var i=t();if(e===document.activeElement){var u=S;if(r.has(u))return}if(Za(e,i,a),a&&i===void 0){var d=e.querySelector(":checked");d!==null&&(i=cs(d),s(i))}e.__value=i,a=!1}),mc(e)}function cs(e){return"__value"in e?e.__value:e.value}const yc=Symbol("is custom element"),wc=Symbol("is html");function Ec(e,t,s,r){var a=xc(e);a[t]!==(a[t]=s)&&(s==null?e.removeAttribute(t):typeof s!="string"&&kc(e).includes(t)?e[t]=s:e.setAttribute(t,s))}function xc(e){return e.__attributes??(e.__attributes={[yc]:e.nodeName.includes("-"),[wc]:e.namespaceURI===ga})}var la=new Map;function kc(e){var t=e.getAttribute("is")||e.nodeName,s=la.get(t);if(s)return s;la.set(t,s=[]);for(var r,a=e,i=Element.prototype;i!==a;){r=ua(a);for(var u in r)r[u].set&&s.push(u);a=Er(a)}return s}function As(e,t,s=t){var r=new WeakSet;Wa(e,"input",async a=>{var i=a?e.defaultValue:e.value;if(i=ar(e)?ir(i):i,s(i),S!==null&&r.add(S),await tc(),i!==(i=t())){var u=e.selectionStart,d=e.selectionEnd,v=e.value.length;if(e.value=i??"",d!==null){var p=e.value.length;u===d&&d===v&&p>v?(e.selectionStart=p,e.selectionEnd=p):(e.selectionStart=u,e.selectionEnd=Math.min(d,p))}}}),b(t)==null&&e.value&&(s(ar(e)?ir(e.value):e.value),S!==null&&r.add(S)),Us(()=>{var a=t();if(e===document.activeElement){var i=S;if(r.has(i))return}ar(e)&&a===ir(e.value)||e.type==="date"&&!a&&!e.value||a!==e.value&&(e.value=a??"")})}function ar(e){var t=e.type;return t==="number"||t==="range"}function ir(e){return e===""?null:+e}function Sc(e){return function(...t){var s=t[0];return s.preventDefault(),e==null?void 0:e.apply(this,t)}}function Tc(e=!1){const t=z,s=t.l.u;if(!s)return;let r=()=>sc(t.s);if(e){let a=0,i={};const u=Tr(()=>{let d=!1;const v=t.s;for(const p in v)v[p]!==i[p]&&(i[p]=v[p],d=!0);return d&&a++,a});r=()=>n(u)}s.b.length&&Ho(()=>{oa(t,r),lr(s.b)}),hr(()=>{const a=b(()=>s.m.map(Gl));return()=>{for(const i of a)typeof i=="function"&&i()}}),s.a.length&&hr(()=>{oa(t,r),lr(s.a)})}function oa(e,t){if(e.l.s)for(const s of e.l.s)n(s);t()}function Ac(e){z===null&&_a(),ms&&z.l!==null?Cc(z).m.push(e):hr(()=>{const t=b(e);if(typeof t=="function")return t})}function Rc(e){z===null&&_a(),Ac(()=>()=>b(e))}function Cc(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const Nc="5";var fa;typeof window<"u"&&((fa=window.__svelte??(window.__svelte={})).v??(fa.v=new Set)).add(Nc);bo();var Mc=W('<div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watch issue</span><strong class="status-warn svelte-d3ct2b"> </strong></div>'),Dc=W('<section class="notice svelte-d3ct2b"> </section>'),Oc=W('<section class="notice danger svelte-d3ct2b"> </section>'),Ic=W('<p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b">--:--:--</time><span class="sys svelte-d3ct2b">SYS</span><strong class="svelte-d3ct2b">Waiting for memory-core watch output...</strong></p>'),Fc=W('<strong class="svelte-d3ct2b"> </strong>'),Lc=W('<strong class="svelte-d3ct2b"> </strong>'),Pc=W('<strong class="svelte-d3ct2b"> </strong>'),jc=W('<strong class="svelte-d3ct2b"> </strong>'),$c=W('<strong class="svelte-d3ct2b"> </strong>'),Wc=W('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Why:</b> </p>'),qc=W('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Issue:</b> </p>'),Uc=W('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Fix:</b> </p>'),Vc=W('<pre class="svelte-d3ct2b"> </pre>'),zc=W('<div class="terminal-detail svelte-d3ct2b"><p class="svelte-d3ct2b"> </p> <p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Rule:</b> </p> <!> <!> <!> <!></div>'),Hc=W('<section><p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b"> </time> <span class="svelte-d3ct2b"> </span> <!></p> <!></section>'),Bc=W('<div class="metric-row svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),Kc=W('<p class="empty svelte-d3ct2b">No rule counters yet.</p>'),Yc=W('<div class="metric-row warning svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <strong class="svelte-d3ct2b"> </strong></div> <i class="svelte-d3ct2b"></i></div>'),Gc=W('<p class="empty svelte-d3ct2b">No file counters yet.</p>'),Jc=W('<small class="svelte-d3ct2b"> </small>'),Qc=W('<small class="svelte-d3ct2b"> </small>'),Xc=W('<section class="commit-item svelte-d3ct2b"><div class="commit-meta svelte-d3ct2b"><span> </span> <time> </time></div> <strong class="svelte-d3ct2b"> </strong> <p class="svelte-d3ct2b"> </p> <!> <!></section>'),Zc=W('<p class="empty svelte-d3ct2b">No commit hook violations recorded yet.</p>'),ef=W('<small class="svelte-d3ct2b"> </small>'),tf=W('<div class="rule-item svelte-d3ct2b"><div><div class="rule-meta svelte-d3ct2b"><span class="svelte-d3ct2b"> </span> <code class="svelte-d3ct2b"> </code></div> <p class="svelte-d3ct2b"> </p> <!></div> <button class="svelte-d3ct2b">Delete</button></div>'),sf=W('<p class="empty svelte-d3ct2b">No rules match the current filters.</p>'),rf=W('<div class="command-center svelte-d3ct2b"><aside class="sidebar svelte-d3ct2b"><div class="brand svelte-d3ct2b"><h1 class="svelte-d3ct2b">memory-core</h1> <span class="svelte-d3ct2b">command center</span></div> <nav aria-label="Dashboard navigation" class="svelte-d3ct2b"><a class="nav-item active svelte-d3ct2b" href="/"><span class="nav-icon svelte-d3ct2b">[]</span> <span>Command Center</span></a></nav> <div class="sidebar-footer svelte-d3ct2b"><div><i class="svelte-d3ct2b"></i> </div> <small class="svelte-d3ct2b"> </small></div></aside> <div class="workspace svelte-d3ct2b"><header class="topbar svelte-d3ct2b"><div class="topbar-left svelte-d3ct2b"><button class="icon-button mobile-menu svelte-d3ct2b" aria-label="Menu">=</button> <div><i class="svelte-d3ct2b"></i> <span> </span></div></div> <div class="header-metrics svelte-d3ct2b" aria-label="Global metrics"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Violations</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Files</span> <strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Rules</span> <strong class="svelte-d3ct2b"> </strong></div></div> <div class="top-actions svelte-d3ct2b" aria-label="Status shortcuts"><button class="icon-button svelte-d3ct2b" title="Warnings" aria-label="Warnings">!</button> <button class="icon-button svelte-d3ct2b" title="Rules" aria-label="Rules">R</button> <button class="icon-button svelte-d3ct2b" title="Database" aria-label="Database">DB</button> <button class="icon-button svelte-d3ct2b" title="Network" aria-label="Network">LAN</button></div></header> <main class="canvas svelte-d3ct2b"><section class="status-grid svelte-d3ct2b"><article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Project</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Name</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Type</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Language</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Architecture</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watcher</span><strong class="svelte-d3ct2b"> </strong></div> <!></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Runtime</h2> <span class="svelte-d3ct2b"> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Provider</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check model</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Check status</span> <strong><!></strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Embedding</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Ollama URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <article class="glass-panel status-card svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">PostgreSQL</h2> <span> </span></div> <div class="data-list svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Database</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">User</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Host</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">URL</span><strong class="svelte-d3ct2b"> </strong></div></div></article></section> <!> <!> <section class="terminal-panel glass-panel svelte-d3ct2b"><div class="terminal-head svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="terminal-icon svelte-d3ct2b">&gt;_</span> <h2 class="svelte-d3ct2b">Live Feed</h2></div> <div class="window-dots svelte-d3ct2b" aria-hidden="true"><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i><i class="svelte-d3ct2b"></i></div></div> <div class="terminal-body svelte-d3ct2b"><!> <!></div></section> <section class="content-grid svelte-d3ct2b"><article class="glass-panel stats-panel svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Stats</h2> <span class="svelte-d3ct2b">Recorded</span></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Most Violated Rules</h3> <!></div> <div class="stat-block svelte-d3ct2b"><h3 class="svelte-d3ct2b">Problem Files</h3> <!></div> <div class="summary-strip svelte-d3ct2b"><div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Clean</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Issues</span><strong class="svelte-d3ct2b"> </strong></div> <div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Events</span><strong class="svelte-d3ct2b"> </strong></div></div></article> <article class="glass-panel commit-watch svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Commit Watch</h2> <span class="svelte-d3ct2b"> </span></div> <div class="commit-list svelte-d3ct2b"></div></article> <article class="glass-panel rule-engine svelte-d3ct2b"><div class="card-head svelte-d3ct2b"><h2 class="svelte-d3ct2b">Rule Engine</h2> <span class="svelte-d3ct2b"> </span></div> <form class="rule-form svelte-d3ct2b"><div class="control-grid svelte-d3ct2b"><select class="svelte-d3ct2b"><option>Rule</option><option>Decision</option><option>Pattern</option><option>Ignore</option></select> <select class="svelte-d3ct2b"><option>Project</option><option>Global</option></select></div> <textarea rows="3" placeholder="Rule or decision" class="svelte-d3ct2b"></textarea> <div class="control-grid svelte-d3ct2b"><input placeholder="Reason" class="svelte-d3ct2b"/> <input placeholder="Tags" class="svelte-d3ct2b"/></div> <button class="svelte-d3ct2b"> </button></form> <div class="control-grid filters svelte-d3ct2b"><select class="svelte-d3ct2b"><option>All types</option><option>Rules</option><option>Decisions</option><option>Patterns</option><option>Ignores</option></select> <input placeholder="Search rules..." class="svelte-d3ct2b"/></div> <div class="rule-list svelte-d3ct2b"></div></article></section></main></div></div>');function nf(e,t){ya(t,!1);const s=Q(),r=Q(),a=Q(),i=Q(),u=Q(),d=Q(),v=Q(),p=Q(),g=Q(),E=Q(),w=Q(),y=Q();let o=Q({config:null,stats:{rules:{},files:{},topRules:[],topFiles:[]},files:[],memories:[]}),T=Q([]),m=Q(!1),R=Q("all"),$=Q(""),L=Q(!1),J=Q(""),ne,qe=!1,F=Q({type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"});const Ye=()=>{var l;return((l=n(o).runtime)==null?void 0:l.project.name)??"memory-core"},nt=()=>{var A,C;const l=((A=n(o).runtime)==null?void 0:A.project.declaredArchitectures)??[],f=((C=n(o).runtime)==null?void 0:C.project.activeArchitectures)??[];return l.length>0?l.join(", "):f.length>0?f.join(", "):"none"};function ae(l){M(T,[{...l,id:crypto.randomUUID()},...n(T)].slice(0,80))}function pt(l){return l.type==="saved"?{type:"saved",timestamp:l.timestamp,file:l.file}:l.type==="clean"?{type:"clean",timestamp:l.timestamp,file:l.file}:l.type==="skipped"?{type:"skipped",timestamp:l.timestamp,file:l.file,reason:l.reason}:l.type==="violations"?{type:"violations",timestamp:l.timestamp,file:l.file,violations:l.violations}:l.type==="error"?{type:"error",timestamp:l.timestamp,message:l.message}:l.type==="ready"?{type:"system",timestamp:l.timestamp,message:`Watching ${l.path} | ${l.rules} rules | ${l.model}`}:{type:"system",timestamp:l.timestamp,message:"Watch stopped"}}function Ge(l){const f=n(o).files??[],A=f.findIndex(H=>H.file===l.file),C=f.slice();return A===-1?C.push(l):C[A]=l,C.sort((H,ie)=>ie.lastSeen.localeCompare(H.lastSeen))}function Es(l){const f=n(o).watcher??{enabled:!0,running:!1,path:void 0,model:void 0,rules:void 0,lastEventAt:void 0,error:void 0};let A=n(o).files,C={...f,lastEventAt:l.timestamp,enabled:!0};l.type==="ready"&&(C={...C,running:!0,error:void 0,path:l.path,model:l.model,rules:l.rules}),l.type==="saved"&&(A=Ge({file:l.file,status:"checking",lastSeen:l.timestamp,violations:[]})),l.type==="clean"&&(A=Ge({file:l.file,status:"clean",lastSeen:l.timestamp,violations:[]})),l.type==="skipped"&&(A=Ge({file:l.file,status:"skipped",lastSeen:l.timestamp,violations:[],message:l.reason})),l.type==="violations"&&(A=Ge({file:l.file,status:"violations",lastSeen:l.timestamp,violations:l.violations})),l.type==="error"&&(C={...C,running:!1,error:l.message}),l.type==="stopped"&&(C={...C,running:!1});const H=[l,...n(o).events??[]].slice(0,100);M(o,{...n(o),files:A,events:H,watcher:C})}function Jt(l=[]){M(T,l.map(pt).map(f=>({...f,id:crypto.randomUUID()})).reverse().slice(0,80))}function Qt(l){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l))}function Xt(l){return Math.max(1,...l.map(f=>f.count))}function Zt(l,f){const A=l.file||f;return l.line?`${A}:${l.line}`:A}function xs(l){return l.type==="saved"?"SAVE":l.type==="clean"?"OK":l.type==="skipped"?"SKIP":l.type==="violations"?"FAIL":l.type==="error"?"WARN":"SYS"}async function pe(){const l=await fetch("/api/snapshot");M(o,await l.json()),Jt(n(o).events)}async function ks(){if(!qe&&document.visibilityState!=="hidden"){qe=!0;try{const l=await fetch("/api/stats",{cache:"no-store"});if(!l.ok)return;const f=await l.json();if(!f.stats)return;M(o,{...n(o),stats:f.stats})}catch{}finally{qe=!1}}}function ei(){ne&&clearInterval(ne),ne=setInterval(()=>{ks()},2e3)}function Lr(){const l=location.protocol==="https:"?"wss:":"ws:",f=new WebSocket(`${l}//${location.host}/ws`);f.addEventListener("open",()=>{M(m,!0),ae({type:"system",timestamp:new Date().toISOString(),message:"Dashboard connected"})}),f.addEventListener("close",()=>{M(m,!1),ae({type:"error",timestamp:new Date().toISOString(),message:"Dashboard disconnected"}),setTimeout(Lr,1500)}),f.addEventListener("message",A=>{const C=JSON.parse(A.data);if(C.type==="snapshot"){M(o,C.snapshot),n(T).length===0&&Jt(n(o).events);return}C.type==="watch"&&(Es(C.event),ae(pt(C.event)))})}async function ti(){if(n(F).content.trim()){M(L,!0),M(J,"");try{const l=await fetch("/api/memories",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n(F))});if(!l.ok)throw new Error((await l.json()).error??"Save failed");M(F,{type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"}),await pe()}catch(l){M(J,l.message)}finally{M(L,!1)}}}async function si(l){M(J,"");const f=await fetch(`/api/memories/${l}`,{method:"DELETE"});if(!f.ok){M(J,(await f.json()).error??"Delete failed");return}await pe()}pe().catch(l=>{M(J,l.message)}),Lr(),ei(),Rc(()=>{ne&&(clearInterval(ne),ne=void 0)}),Ee(()=>(n(o),n(R),n($)),()=>{M(s,n(o).memories.filter(l=>{const f=n(R)==="all"||l.type===n(R),A=`${l.type} ${l.scope} ${l.content} ${l.reason??""} ${l.tags.join(" ")}`.toLowerCase();return f&&A.includes(n($).toLowerCase())}))}),Ee(()=>n(o),()=>{M(r,Object.values(n(o).stats.files??{}).reduce((l,f)=>l+f,0))}),Ee(()=>n(o),()=>{M(a,n(o).files.filter(l=>l.status==="clean").length)}),Ee(()=>n(o),()=>{M(i,Object.values(n(o).stats.rules).reduce((l,f)=>l+f,0))}),Ee(()=>n(o),()=>{M(u,n(o).stats.recentViolations??[])}),Ee(()=>n(u),()=>{M(d,n(u).filter(l=>l.source==="hook"||l.source==="ci"))}),Ee(()=>n(r),()=>{M(v,n(r))}),Ee(()=>n(o),()=>{M(p,Object.keys(n(o).stats.files??{}).length)}),Ee(()=>n(o),()=>{M(g,n(o).memories.filter(l=>["rule","pattern","decision"].includes(l.type)).length)}),Ee(()=>n(o),()=>{var l;M(E,((l=n(o).memoryCount)==null?void 0:l.total)??n(o).memories.length)}),Ee(()=>n(o),()=>{var l;M(w,((l=n(o).memoryCount)==null?void 0:l.relevant)??n(o).memories.length)}),Ee(()=>(n(m),n(o)),()=>{var l,f;M(y,n(m)?((l=n(o).watcher)==null?void 0:l.enabled)===!1?{live:!1,label:"Watch off"}:(f=n(o).watcher)!=null&&f.running?{live:!0,label:"Watcher live"}:{live:!1,label:"Watcher idle"}:{live:!1,label:"Disconnected"})}),Yo(),Tc();var Pr=rf(),jr=_(Pr),ri=h(_(jr),4),Vs=_(ri);let $r;var ni=h(_(Vs)),ai=h(Vs,2),ii=_(ai),li=h(jr,2),Wr=_(li),qr=_(Wr),Ur=h(_(qr),2);let Vr;var oi=h(_(Ur),2),ci=_(oi),fi=h(qr,2),zr=_(fi),ui=h(_(zr),2),vi=_(ui),Hr=h(zr,2),di=h(_(Hr),2),pi=_(di),_i=h(Hr,2),hi=h(_(_i),2),gi=_(hi),bi=h(Wr,2),Br=_(bi),Kr=_(Br),Yr=_(Kr),mi=h(_(Yr),2),yi=_(mi),wi=h(Yr,2),Gr=_(wi),Ei=h(_(Gr)),xi=_(Ei),Jr=h(Gr,2),ki=h(_(Jr)),Si=_(ki),Qr=h(Jr,2),Ti=h(_(Qr)),Ai=_(Ti),Xr=h(Qr,2),Ri=h(_(Xr)),Ci=_(Ri),Zr=h(Xr,2),Ni=h(_(Zr)),Mi=_(Ni),Di=h(Zr,2);{var Oi=l=>{var f=Mc(),A=h(_(f)),C=_(A);V(()=>x(C,(n(o),b(()=>n(o).watcher.error)))),P(l,f)};fe(Di,l=>{n(o),b(()=>{var f;return(f=n(o).watcher)==null?void 0:f.error})&&l(Oi)})}var en=h(Kr,2),tn=_(en),Ii=h(_(tn),2),Fi=_(Ii),Li=h(tn,2),sn=_(Li),Pi=h(_(sn)),ji=_(Pi),rn=h(sn,2),$i=h(_(rn)),Wi=_($i),nn=h(rn,2),an=h(_(nn),2);let ln;var qi=_(an);{var Ui=l=>{var f=ra();V(()=>x(f,(n(o),b(()=>{var A;return(A=n(o).runtime)!=null&&A.model.checkModelInstalled?"installed":"missing"})))),P(l,f)},Vi=l=>{var f=ra();V(()=>x(f,(n(o),b(()=>{var A;return(A=n(o).runtime)!=null&&A.model.apiKeyConfigured?"api key set":"api key missing"})))),P(l,f)};fe(qi,l=>{n(o),b(()=>{var f;return((f=n(o).runtime)==null?void 0:f.model.provider)==="ollama"})?l(Ui):l(Vi,-1)})}var on=h(nn,2),zi=h(_(on)),Hi=_(zi),Bi=h(on,2),Ki=h(_(Bi)),Yi=_(Ki),Gi=h(en,2),cn=_(Gi),fn=h(_(cn),2);let un;var Ji=_(fn),Qi=h(cn,2),vn=_(Qi),Xi=h(_(vn)),Zi=_(Xi),dn=h(vn,2),el=h(_(dn)),tl=_(el),pn=h(dn,2),sl=h(_(pn)),rl=_(sl),nl=h(pn,2),al=h(_(nl)),il=_(al),_n=h(Br,2);{var ll=l=>{var f=Dc(),A=_(f);V(()=>x(A,(n(o),b(()=>n(o).dbError)))),P(l,f)};fe(_n,l=>{n(o),b(()=>n(o).dbError)&&l(ll)})}var hn=h(_n,2);{var ol=l=>{var f=Oc(),A=_(f);V(()=>x(A,n(J))),P(l,f)};fe(hn,l=>{n(J)&&l(ol)})}var gn=h(hn,2),cl=h(_(gn),2),bn=_(cl);{var fl=l=>{var f=Ic();P(l,f)};fe(bn,l=>{n(T),b(()=>n(T).length===0)&&l(fl)})}var ul=h(bn,2);Lt(ul,1,()=>(n(T),b(()=>[...n(T)].reverse())),l=>l.id,(l,f)=>{var A=Hc();let C;var H=_(A),ie=_(H),we=_(ie),_e=h(ie,2),k=_(_e),q=h(_e,2);{var Je=j=>{var B=Fc(),Oe=_(B);V(()=>x(Oe,(n(f),b(()=>n(f).message)))),P(j,B)},es=j=>{var B=Lc(),Oe=_(B);V(()=>x(Oe,`saved: ${n(f),b(()=>n(f).file)??""}`)),P(j,B)},Ot=j=>{var B=Pc(),Oe=_(B);V(()=>x(Oe,`${n(f),b(()=>n(f).file)??""} - no violations`)),P(j,B)},It=j=>{var B=jc(),Oe=_(B);V(()=>x(Oe,`${n(f),b(()=>n(f).file)??""} - skipped: ${n(f),b(()=>n(f).reason)??""}`)),P(j,B)},Qe=j=>{var B=$c(),Oe=_(B);V(()=>x(Oe,`${n(f),b(()=>n(f).violations.length)??""} violation${n(f),b(()=>n(f).violations.length===1?"":"s")??""} in ${n(f),b(()=>n(f).file)??""}`)),P(j,B)};fe(q,j=>{n(f),b(()=>n(f).type==="system"||n(f).type==="error")?j(Je):(n(f),b(()=>n(f).type==="saved")?j(es,1):(n(f),b(()=>n(f).type==="clean")?j(Ot,2):(n(f),b(()=>n(f).type==="skipped")?j(It,3):j(Qe,-1))))})}var Ft=h(H,2);{var he=j=>{var B=cc(),Oe=Wo(B);Lt(Oe,3,()=>(n(f),b(()=>n(f).violations)),(Pn,K)=>`${n(f).id}-${K}`,(Pn,K,Ol)=>{var jn=zc(),$n=_(jn),Il=_($n),Wn=h($n,2),Fl=h(_(Wn)),qn=h(Wn,2);{var Ll=te=>{var Ie=Wc(),_t=h(_(Ie));V(()=>x(_t,` ${n(K),b(()=>n(K).reason)??""}`)),P(te,Ie)};fe(qn,te=>{n(K),b(()=>n(K).reason)&&te(Ll)})}var Un=h(qn,2);{var Pl=te=>{var Ie=qc(),_t=h(_(Ie));V(()=>x(_t,` ${n(K),b(()=>n(K).issue)??""}`)),P(te,Ie)};fe(Un,te=>{n(K),b(()=>n(K).issue)&&te(Pl)})}var Vn=h(Un,2);{var jl=te=>{var Ie=Uc(),_t=h(_(Ie));V(()=>x(_t,` ${n(K),b(()=>n(K).suggestion)??""}`)),P(te,Ie)};fe(Vn,te=>{n(K),b(()=>n(K).suggestion)&&te(jl)})}var $l=h(Vn,2);{var Wl=te=>{var Ie=Vc(),_t=_(Ie);V(()=>x(_t,(n(K),b(()=>n(K).code)))),P(te,Ie)};fe($l,te=>{n(K),b(()=>n(K).code)&&te(Wl)})}V(te=>{x(Il,`[${n(Ol)+1}] ${te??""}`),x(Fl,` ${n(K),b(()=>n(K).rule)??""}`)},[()=>(n(K),n(f),b(()=>Zt(n(K),n(f).file)))]),P(Pn,jn)}),P(j,B)};fe(Ft,j=>{n(f),b(()=>n(f).type==="violations")&&j(he)})}V((j,B)=>{C=rs(A,1,"svelte-d3ct2b",null,C,{"error-line":n(f).type==="error","ok-line":n(f).type==="clean","violation-line":n(f).type==="violations"}),x(we,j),x(k,B)},[()=>(n(f),b(()=>Qt(n(f).timestamp))),()=>(n(f),b(()=>xs(n(f))))]),P(l,A)});var vl=h(gn,2),mn=_(vl),yn=h(_(mn),2),dl=h(_(yn),2);Lt(dl,1,()=>(n(o),b(()=>n(o).stats.topRules.slice(0,5))),l=>l.name,(l,f)=>{var A=Bc(),C=_(A),H=_(C),ie=_(H),we=h(H,2),_e=_(we),k=h(C,2);V(q=>{x(ie,(n(f),b(()=>n(f).name))),x(_e,(n(f),b(()=>n(f).count))),ia(k,q)},[()=>(n(f),n(o),b(()=>`width: ${n(f).count/Xt(n(o).stats.topRules)*100}%`))]),P(l,A)},l=>{var f=Kc();P(l,f)});var wn=h(yn,2),pl=h(_(wn),2);Lt(pl,1,()=>(n(o),b(()=>n(o).stats.topFiles.slice(0,5))),l=>l.name,(l,f)=>{var A=Yc(),C=_(A),H=_(C),ie=_(H),we=h(H,2),_e=_(we),k=h(C,2);V(q=>{x(ie,(n(f),b(()=>n(f).name))),x(_e,(n(f),b(()=>n(f).count))),ia(k,q)},[()=>(n(f),n(o),b(()=>`width: ${n(f).count/Xt(n(o).stats.topFiles)*100}%`))]),P(l,A)},l=>{var f=Gc();P(l,f)});var _l=h(wn,2),En=_(_l),hl=h(_(En)),gl=_(hl),xn=h(En,2),bl=h(_(xn)),ml=_(bl),yl=h(xn,2),wl=h(_(yl)),El=_(wl),kn=h(mn,2),Sn=_(kn),xl=h(_(Sn),2),kl=_(xl),Sl=h(Sn,2);Lt(Sl,7,()=>(n(d),b(()=>n(d).slice(0,8))),(l,f)=>`${l.timestamp}-${f}`,(l,f)=>{var A=Xc(),C=_(A),H=_(C),ie=_(H),we=h(H,2),_e=_(we),k=h(C,2),q=_(k),Je=h(k,2),es=_(Je),Ot=h(Je,2);{var It=he=>{var j=Jc(),B=_(j);V(()=>x(B,(n(f),b(()=>n(f).issue)))),P(he,j)};fe(Ot,he=>{n(f),b(()=>n(f).issue)&&he(It)})}var Qe=h(Ot,2);{var Ft=he=>{var j=Qc(),B=_(j);V(()=>x(B,(n(f),b(()=>n(f).suggestion)))),P(he,j)};fe(Qe,he=>{n(f),b(()=>n(f).suggestion)&&he(Ft)})}V((he,j)=>{x(ie,(n(f),b(()=>n(f).source==="ci"?"CI":"Hook"))),x(_e,he),x(q,(n(f),b(()=>n(f).rule))),x(es,j)},[()=>(n(f),b(()=>Qt(n(f).timestamp))),()=>(n(f),b(()=>Zt(n(f),n(f).file||"staged diff")))]),P(l,A)},l=>{var f=Zc();P(l,f)});var Tl=h(kn,2),Tn=_(Tl),Al=h(_(Tn),2),Rl=_(Al),zs=h(Tn,2),An=_(zs),Hs=_(An),Bs=_(Hs);Bs.value=Bs.__value="rule";var Ks=h(Bs);Ks.value=Ks.__value="decision";var Ys=h(Ks);Ys.value=Ys.__value="pattern";var Rn=h(Ys);Rn.value=Rn.__value="ignore";var Cn=h(Hs,2),Gs=_(Cn);Gs.value=Gs.__value="project";var Nn=h(Gs);Nn.value=Nn.__value="global";var Mn=h(An,2),Dn=h(Mn,2),On=_(Dn),Cl=h(On,2),In=h(Dn,2),Nl=_(In),Fn=h(zs,2),Js=_(Fn),Qs=_(Js);Qs.value=Qs.__value="all";var Xs=h(Qs);Xs.value=Xs.__value="rule";var Zs=h(Xs);Zs.value=Zs.__value="decision";var er=h(Zs);er.value=er.__value="pattern";var Ln=h(er);Ln.value=Ln.__value="ignore";var Ml=h(Js,2),Dl=h(Fn,2);Lt(Dl,5,()=>n(s),l=>l.id,(l,f)=>{var A=tf(),C=_(A),H=_(C),ie=_(H),we=_(ie),_e=h(ie,2),k=_(_e),q=h(H,2),Je=_(q),es=h(q,2);{var Ot=Qe=>{var Ft=ef(),he=_(Ft);V(()=>x(he,(n(f),b(()=>n(f).reason)))),P(Qe,Ft)};fe(es,Qe=>{n(f),b(()=>n(f).reason)&&Qe(Ot)})}var It=h(C,2);V(Qe=>{x(we,(n(f),b(()=>n(f).scope))),x(k,`Rule-${Qe??""}`),x(Je,(n(f),b(()=>n(f).content))),Ec(It,"aria-label",(n(f),b(()=>`Delete ${n(f).id}`)))},[()=>(n(f),b(()=>String(n(f).id).padStart(3,"0")))]),ta("click",It,()=>si(n(f).id)),P(l,A)},l=>{var f=sf();P(l,f)}),V((l,f,A)=>{var C,H,ie,we,_e;$r=rs(Vs,1,"status-chip svelte-d3ct2b",null,$r,{live:n(y).live}),x(ni,` ${n(y),b(()=>n(y).label)??""}`),x(ii,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.label)??"runtime pending"}))),Vr=rs(Ur,1,"live-label svelte-d3ct2b",null,Vr,{live:n(y).live}),x(ci,(n(y),b(()=>n(y).label))),x(vi,n(v)),x(pi,n(p)),x(gi,n(g)),x(yi,(n(o),b(()=>{var k;return(k=n(o).runtime)!=null&&k.project.initialized?"Initialized":"Not initialized"}))),x(xi,l),x(Si,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.project.type)??"unknown"}))),x(Ai,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.project.language)??"unknown"}))),x(Ci,f),x(Mi,(n(o),b(()=>{var k,q;return((k=n(o).watcher)==null?void 0:k.enabled)===!1?"disabled":(q=n(o).watcher)!=null&&q.running?"running":"idle"}))),x(Fi,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.label)??"pending"}))),x(ji,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.provider)??"unknown"}))),x(Wi,(n(o),b(()=>{var k,q,Je;return((k=n(o).runtime)==null?void 0:k.model.checkModelResolved)??((q=n(o).runtime)==null?void 0:q.model.checkModel)??((Je=n(o).runtime)==null?void 0:Je.model.chatModel)??"unknown"}))),ln=rs(an,1,"svelte-d3ct2b",null,ln,{"status-ok":((C=n(o).runtime)==null?void 0:C.model.checkModelInstalled)||((H=n(o).runtime)==null?void 0:H.model.apiKeyConfigured),"status-warn":((ie=n(o).runtime)==null?void 0:ie.model.checkModelInstalled)===!1||((we=n(o).runtime)==null?void 0:we.model.error)}),x(Hi,(n(o),b(()=>{var k,q;return((k=n(o).runtime)==null?void 0:k.model.embeddingModelResolved)??((q=n(o).runtime)==null?void 0:q.model.embeddingModel)??"unknown"}))),x(Yi,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.ollamaUrl)??"unknown"}))),un=rs(fn,1,"svelte-d3ct2b",null,un,{success:(_e=n(o).runtime)==null?void 0:_e.postgres.connected}),x(Ji,(n(o),b(()=>{var k;return(k=n(o).runtime)!=null&&k.postgres.connected?"Connected":"Not connected"}))),x(Zi,(n(o),b(()=>{var k,q;return((k=n(o).runtime)==null?void 0:k.postgres.serverDatabase)??((q=n(o).runtime)==null?void 0:q.postgres.database)??"unknown"}))),x(tl,(n(o),b(()=>{var k,q;return((k=n(o).runtime)==null?void 0:k.postgres.serverUser)??((q=n(o).runtime)==null?void 0:q.postgres.user)??"unknown"}))),x(rl,`${n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.postgres.host)??"unknown"})??""}${n(o),b(()=>{var k;return(k=n(o).runtime)!=null&&k.postgres.port?`:${n(o).runtime.postgres.port}`:""})??""}`),x(il,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.postgres.url)??"(not set)"}))),x(gl,n(a)),x(ml,n(v)),x(El,n(i)),x(kl,`${n(d),b(()=>n(d).length)??""} recent`),x(Rl,`${n(g)??""} rules active`),In.disabled=A,x(Nl,n(L)?"Saving...":"Add New Architecture Rule")},[()=>b(Ye),()=>b(nt),()=>(n(L),n(F),b(()=>n(L)||!n(F).content.trim()))]),nr(Hs,()=>n(F).type,l=>ts(F,n(F).type=l)),nr(Cn,()=>n(F).scope,l=>ts(F,n(F).scope=l)),As(Mn,()=>n(F).content,l=>ts(F,n(F).content=l)),As(On,()=>n(F).reason,l=>ts(F,n(F).reason=l)),As(Cl,()=>n(F).tags,l=>ts(F,n(F).tags=l)),ta("submit",zs,Sc(ti)),nr(Js,()=>n(R),l=>M(R,l)),As(Ml,()=>n($),l=>M($,l)),P(e,Pr),wa()}fc(nf,{target:document.getElementById("app")});