@shahmilsaari/memory-core 1.0.7 → 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.
@@ -972,7 +972,7 @@ 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");
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  retrieveMemorySelection,
21
21
  runMigrations,
22
22
  seeds
23
- } from "./chunk-VF2GJEJP.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-ONGEIYYG.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-CbN3F0rB.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-VF2GJEJP.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
  },
@@ -707,5 +755,7 @@ async function startDashboard(options = {}) {
707
755
  }
708
756
  }
709
757
  export {
758
+ mapFrameworkToArchitecture,
759
+ resolveDeclaredArchitectures,
710
760
  startDashboard
711
761
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shahmilsaari/memory-core",
3
- "version": "1.0.7",
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 $l=Object.defineProperty;var zn=e=>{throw TypeError(e)};var Wl=(e,t,s)=>t in e?$l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var Fe=(e,t,s)=>Wl(e,typeof t!="symbol"?t+"":t,s),ar=(e,t,s)=>t.has(e)||zn("Cannot "+s);var c=(e,t,s)=>(ar(e,t,"read from private field"),s?s.call(e):t.get(e)),C=(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)=>(ar(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),U=(e,t,s)=>(ar(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 f of i.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&r(f)}).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 ql=!1;var Sr=Array.isArray,Ul=Array.prototype.indexOf,Kt=Array.prototype.includes,zs=Array.from,Vl=Object.defineProperty,us=Object.getOwnPropertyDescriptor,ua=Object.getOwnPropertyDescriptors,zl=Object.prototype,Hl=Array.prototype,Tr=Object.getPrototypeOf,Hn=Object.isExtensible;const Bl=()=>{};function Kl(e){return e()}function ur(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,Yt=4,xs=8,da=1<<24,Ye=16,$e=32,dt=64,vr=128,Ae=512,Z=1024,ne=2048,We=4096,fe=8192,Re=16384,It=32768,Bn=1<<25,Gt=65536,dr=1<<17,Yl=1<<18,Xt=1<<19,pa=1<<20,Ke=1<<25,Nt=65536,$s=1<<21,_s=1<<22,ut=1<<23,Tt=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 Gl(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Jl(e,t,s){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Ql(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Xl(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Zl(e){throw new Error("https://svelte.dev/e/effect_orphan")}function eo(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function to(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function so(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ro(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function no(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const ao=1,io=2,ha=4,lo=8,oo=16,co=2,te=Symbol(),ga="http://www.w3.org/1999/xhtml";function fo(){console.warn("https://svelte.dev/e/derived_inert")}function uo(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function vo(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ba(e){return e===this.v}function po(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function ma(e){return!po(e,this.v)}let ks=!1,_o=!1;function ho(){ks=!0}let H=null;function Jt(e){H=e}function ya(e,t=!1,s){H={p:H,i:!1,c:null,e:null,s:e,x:null,r:O,l:ks&&!t?{s:null,u:null,$:[]}:null}}function wa(e){var t=H,s=t.e;if(s!==null){t.e=null;for(var r of s)Ua(r)}return t.i=!0,H=t.p,{}}function Ss(){return!ks||H!==null&&H.l===null}let mt=[];function Ea(){var e=mt;mt=[],ur(e)}function vt(e){if(mt.length===0&&!vs){var t=mt;queueMicrotask(()=>{t===mt&&Ea()})}mt.push(e)}function go(){for(;mt.length>0;)Ea()}function xa(e){var t=O;if(t===null)return I.f|=ut,e;if(!(t.f&It)&&!(t.f&Yt))throw e;ft(e,t)}function ft(e,t){for(;t!==null;){if(t.f&vr){if(!(t.f&It))throw e;try{t.b.error(e);return}catch(s){e=s}}t=t.parent}throw e}const bo=-7169;function G(e,t){e.f=e.f&bo|t}function Ar(e){e.f&Ae||e.deps===null?G(e,Z):G(e,We)}function ka(e){if(e!==null)for(const t of e)!(t.f&le)||!(t.f&Nt)||(t.f^=Nt,ka(t.deps))}function Sa(e,t,s){e.f&ne?t.add(e):e.f&We&&s.add(e),ka(e.deps),G(e,Z)}const bt=new Set;let S=null,re=null,pr=null,vs=!1,ir=!1,qt=null,Ds=null;var Kn=0;let mo=1;var Ut,Vt,wt,Ze,ze,gs,be,bs,ot,et,He,zt,Ht,Et,ee,Os,Ta,Is,_r,Fs,yo;const qs=class qs{constructor(){C(this,ee);Fe(this,"id",mo++);Fe(this,"current",new Map);Fe(this,"previous",new Map);C(this,Ut,new Set);C(this,Vt,new Set);C(this,wt,new Set);C(this,Ze,new Map);C(this,ze,new Map);C(this,gs,null);C(this,be,[]);C(this,bs,[]);C(this,ot,new Set);C(this,et,new Set);C(this,He,new Map);C(this,zt,new Set);Fe(this,"is_fork",!1);C(this,Ht,!1);C(this,Et,new Set)}skip_effect(t){c(this,He).has(t)||c(this,He).set(t,{d:[],m:[]}),c(this,zt).delete(t)}unskip_effect(t,s=r=>this.schedule(r)){var r=c(this,He).get(t);if(r){c(this,He).delete(t);for(var a of r.d)G(a,ne),s(a);for(a of r.m)G(a,We),s(a)}c(this,zt).add(t)}capture(t,s,r=!1){t.v!==te&&!this.previous.has(t)&&this.previous.set(t,t.v),t.f&ut||(this.current.set(t,[s,r]),re==null||re.set(t,s)),this.is_fork||(t.v=s)}activate(){S=this}deactivate(){S=null,re=null}flush(){try{ir=!0,S=this,U(this,ee,Is).call(this)}finally{Kn=0,pr=null,qt=null,Ds=null,ir=!1,S=null,re=null,At.clear()}}discard(){for(const t of c(this,Vt))t(this);c(this,Vt).clear(),c(this,wt).clear(),bt.delete(this)}register_created_effect(t){c(this,bs).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,ze).get(s)??0;c(this,ze).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,ze).get(s)??0;i===1?c(this,ze).delete(s):c(this,ze).set(s,i-1)}c(this,Ht)||r||(D(this,Ht,!0),vt(()=>{D(this,Ht,!1),this.flush()}))}transfer_effects(t,s){for(const r of t)c(this,ot).add(r);for(const r of s)c(this,et).add(r);t.clear(),s.clear()}oncommit(t){c(this,Ut).add(t)}ondiscard(t){c(this,Vt).add(t)}on_fork_commit(t){c(this,wt).add(t)}run_fork_commit_callbacks(){for(const t of c(this,wt))t(this);c(this,wt).clear()}settled(){return(c(this,gs)??D(this,gs,va())).promise}static ensure(){if(S===null){const t=S=new qs;ir||(bt.add(S),vs||vt(()=>{S===t&&t.flush()}))}return S}apply(){{re=null;return}}schedule(t){var a;if(pr=t,(a=t.b)!=null&&a.is_pending&&t.f&(Yt|xs|da)&&!(t.f&It)){t.b.defer_effect(t);return}for(var s=t;s.parent!==null;){s=s.parent;var r=s.f;if(qt!==null&&s===O&&(I===null||!(I.f&le)))return;if(r&(dt|$e)){if(!(r&Z))return;s.f^=Z}}c(this,be).push(s)}};Ut=new WeakMap,Vt=new WeakMap,wt=new WeakMap,Ze=new WeakMap,ze=new WeakMap,gs=new WeakMap,be=new WeakMap,bs=new WeakMap,ot=new WeakMap,et=new WeakMap,He=new WeakMap,zt=new WeakMap,Ht=new WeakMap,Et=new WeakMap,ee=new WeakSet,Os=function(){return this.is_fork||c(this,ze).size>0},Ta=function(){for(const r of c(this,Et))for(const a of c(r,ze).keys()){for(var t=!1,s=a;s.parent!==null;){if(c(this,He).has(s)){t=!0;break}s=s.parent}if(!t)return!0}return!1},Is=function(){var v,u;if(Kn++>1e3&&(bt.delete(this),Eo()),!U(this,ee,Os).call(this)){for(const p of c(this,ot))c(this,et).delete(p),G(p,ne),this.schedule(p);for(const p of c(this,et))G(p,We),this.schedule(p)}const t=c(this,be);D(this,be,[]),this.apply();var s=qt=[],r=[],a=Ds=[];for(const p of t)try{U(this,ee,_r).call(this,p,s,r)}catch(g){throw Ca(p),g}if(S=null,a.length>0){var i=qs.ensure();for(const p of a)i.schedule(p)}if(qt=null,Ds=null,U(this,ee,Os).call(this)||U(this,ee,Ta).call(this)){U(this,ee,Fs).call(this,r),U(this,ee,Fs).call(this,s);for(const[p,g]of c(this,He))Ra(p,g)}else{c(this,Ze).size===0&&bt.delete(this),c(this,ot).clear(),c(this,et).clear();for(const p of c(this,Ut))p(this);c(this,Ut).clear(),Yn(r),Yn(s),(v=c(this,gs))==null||v.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&&(bt.add(f),U(u=f,ee,Is).call(u))},_r=function(t,s,r){t.f^=Z;for(var a=t.first;a!==null;){var i=a.f,f=(i&($e|dt))!==0,v=f&&(i&Z)!==0,u=v||(i&fe)!==0||c(this,He).has(a);if(!u&&a.fn!==null){f?a.f^=Z:i&Yt?s.push(a):Zt(a)&&(i&Ye&&c(this,et).add(a),Ot(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}}},Fs=function(t){for(var s=0;s<t.length;s+=1)Sa(t[s],c(this,ot),c(this,et))},yo=function(){var g,E,w;for(const y of bt){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,zt))y.unskip_effect(o,T=>{var m;T.f&(Ye|_s)?y.schedule(T):U(m=y,ee,Fs).call(m,[T])});y.activate();var i=new Set,f=new Map;for(var v of s)Aa(v,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,bs))!(o.f&(Re|fe|dr))&&Rr(o,u,f)&&(o.f&(_s|Ye)?(G(o,ne),y.schedule(o)):c(y,ot).add(o));if(c(y,be).length>0){y.apply();for(var p of c(y,be))U(g=y,ee,_r).call(g,p,[],[]);D(y,be,[])}y.deactivate()}}for(const y of bt)c(y,Et).has(this)&&(c(y,Et).delete(this),c(y,Et).size===0&&!U(E=y,ee,Os).call(E)&&(y.activate(),U(w=y,ee,Is).call(w)))};let Mt=qs;function wo(e){var t=vs;vs=!0;try{for(var s;;){if(go(),S===null)return s;S.flush()}}finally{vs=t}}function Eo(){try{eo()}catch(e){ft(e,pr)}}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&(Re|fe))&&Zt(r)&&(Le=new Set,Ot(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)){At.clear();for(const a of Le){if(a.f&(Re|fe))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 v=i.length-1;v>=0;v--){const u=i[v];u.f&(Re|fe)||Ot(u)}}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&(_s|Ye)&&!(i&ne)&&Rr(a,t,r)&&(G(a,ne),Cr(a))}}function Rr(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(Kt.call(t,a))return!0;if(a.f&le&&Rr(a,t,s))return s.set(a,!0),!0}return s.set(e,!1),!1}function Cr(e){S.schedule(e)}function Ra(e,t){if(!(e.f&$e&&e.f&Z)){e.f&ne?t.d.push(e):e.f&We&&t.m.push(e),G(e,Z);for(var s=e.first;s!==null;)Ra(s,t),s=s.next}}function Ca(e){G(e,Z);for(var t=e.first;t!==null;)Ca(t),t=t.next}function xo(e){let t=0,s=Dt(0),r;return()=>{Or()&&(n(s),Bs(()=>(t===0&&(r=b(()=>e(()=>ds(s)))),t+=1,()=>{vt(()=>{t-=1,t===0&&(r==null||r(),r=void 0,ds(s))})})))}}var ko=Gt|Xt;function So(e,t,s,r){new To(e,t,s,r)}var xe,kr,ke,xt,de,Se,ce,me,tt,kt,ct,Bt,ms,ys,st,Us,J,Ao,Ro,Co,hr,Ls,Ps,gr,br;class To{constructor(t,s,r,a){C(this,J);Fe(this,"parent");Fe(this,"is_pending",!1);Fe(this,"transform_error");C(this,xe);C(this,kr,null);C(this,ke);C(this,xt);C(this,de);C(this,Se,null);C(this,ce,null);C(this,me,null);C(this,tt,null);C(this,kt,0);C(this,ct,0);C(this,Bt,!1);C(this,ms,new Set);C(this,ys,new Set);C(this,st,null);C(this,Us,xo(()=>(D(this,st,Dt(c(this,kt))),()=>{D(this,st,null)})));var i;D(this,xe,t),D(this,ke,s),D(this,xt,f=>{var v=O;v.b=this,v.f|=vr,r(f)}),this.parent=O.b,this.transform_error=a??((i=this.parent)==null?void 0:i.transform_error)??(f=>f),D(this,de,Fr(()=>{U(this,J,hr).call(this)},ko))}defer_effect(t){Sa(t,c(this,ms),c(this,ys))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!c(this,ke).pending}update_pending_count(t,s){U(this,J,gr).call(this,t,s),D(this,kt,c(this,kt)+t),!(!c(this,st)||c(this,Bt))&&(D(this,Bt,!0),vt(()=>{D(this,Bt,!1),c(this,st)&&Qt(c(this,st),c(this,kt))}))}get_effect_pending(){return c(this,Us).call(this),n(c(this,st))}error(t){if(!c(this,ke).onerror&&!c(this,ke).failed)throw t;S!=null&&S.is_fork?(c(this,Se)&&S.skip_effect(c(this,Se)),c(this,ce)&&S.skip_effect(c(this,ce)),c(this,me)&&S.skip_effect(c(this,me)),S.on_fork_commit(()=>{U(this,J,br).call(this,t)})):U(this,J,br).call(this,t)}}xe=new WeakMap,kr=new WeakMap,ke=new WeakMap,xt=new WeakMap,de=new WeakMap,Se=new WeakMap,ce=new WeakMap,me=new WeakMap,tt=new WeakMap,kt=new WeakMap,ct=new WeakMap,Bt=new WeakMap,ms=new WeakMap,ys=new WeakMap,st=new WeakMap,Us=new WeakMap,J=new WeakSet,Ao=function(){try{D(this,Se,Te(()=>c(this,xt).call(this,c(this,xe))))}catch(t){this.error(t)}},Ro=function(t){const s=c(this,ke).failed;s&&D(this,me,Te(()=>{s(c(this,xe),()=>t,()=>()=>{})}))},Co=function(){const t=c(this,ke).pending;t&&(this.is_pending=!0,D(this,ce,Te(()=>t(c(this,xe)))),vt(()=>{var s=D(this,tt,document.createDocumentFragment()),r=rt();s.append(r),D(this,Se,U(this,J,Ps).call(this,()=>Te(()=>c(this,xt).call(this,r)))),c(this,ct)===0&&(c(this,xe).before(s),D(this,tt,null),Rt(c(this,ce),()=>{D(this,ce,null)}),U(this,J,Ls).call(this,S))}))},hr=function(){try{if(this.is_pending=this.has_pending_snippet(),D(this,ct,0),D(this,kt,0),D(this,Se,Te(()=>{c(this,xt).call(this,c(this,xe))})),c(this,ct)>0){var t=D(this,tt,document.createDocumentFragment());jr(c(this,Se),t);const s=c(this,ke).pending;D(this,ce,Te(()=>s(c(this,xe))))}else U(this,J,Ls).call(this,S)}catch(s){this.error(s)}},Ls=function(t){this.is_pending=!1,t.transfer_effects(c(this,ms),c(this,ys))},Ps=function(t){var s=O,r=I,a=H;Me(c(this,de)),Ne(c(this,de)),Jt(c(this,de).ctx);try{return Mt.ensure(),t()}catch(i){return xa(i),null}finally{Me(s),Ne(r),Jt(a)}},gr=function(t,s){var r;if(!this.has_pending_snippet()){this.parent&&U(r=this.parent,J,gr).call(r,t,s);return}D(this,ct,c(this,ct)+t),c(this,ct)===0&&(U(this,J,Ls).call(this,s),c(this,ce)&&Rt(c(this,ce),()=>{D(this,ce,null)}),c(this,tt)&&(c(this,xe).before(c(this,tt)),D(this,tt,null)))},br=function(t){c(this,Se)&&(_e(c(this,Se)),D(this,Se,null)),c(this,ce)&&(_e(c(this,ce)),D(this,ce,null)),c(this,me)&&(_e(c(this,me)),D(this,me,null));var s=c(this,ke).onerror;let r=c(this,ke).failed;var a=!1,i=!1;const f=()=>{if(a){vo();return}a=!0,i&&no(),c(this,me)!==null&&Rt(c(this,me),()=>{D(this,me,null)}),U(this,J,Ps).call(this,()=>{U(this,J,hr).call(this)})},v=u=>{try{i=!0,s==null||s(u,f),i=!1}catch(p){ft(p,c(this,de)&&c(this,de).parent)}r&&D(this,me,U(this,J,Ps).call(this,()=>{try{return Te(()=>{var p=O;p.b=this,p.f|=vr,r(c(this,xe),()=>u,()=>f)})}catch(p){return ft(p,c(this,de).parent),null}}))};vt(()=>{var u;try{u=this.transform_error(t)}catch(p){ft(p,c(this,de)&&c(this,de).parent);return}u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(v,p=>ft(p,c(this,de)&&c(this,de).parent)):v(u)})};function No(e,t,s,r){const a=Ss()?Nr:Ma;var i=e.filter(w=>!w.settled);if(s.length===0&&i.length===0){r(t.map(a));return}var f=O,v=Mo(),u=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(w=>w.promise)):null;function p(w){v();try{r(w)}catch(y){f.f&Re||ft(y,f)}Ws()}if(s.length===0){u.then(()=>p(t.map(a)));return}var g=Na();function E(){Promise.all(s.map(w=>Do(w))).then(w=>p([...t.map(a),...w])).catch(w=>ft(w,f)).finally(()=>g())}u?u.then(()=>{v(),E(),Ws()}):E()}function Mo(){var e=O,t=I,s=H,r=S;return function(i=!0){Me(e),Ne(t),Jt(s),i&&!(e.f&Re)&&(r==null||r.activate(),r==null||r.apply())}}function Ws(e=!0){Me(null),Ne(null),Jt(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 Nr(e){var t=le|ne;return O!==null&&(O.f|=Xt),{ctx:H,deps:null,effects:null,equals:ba,f:t,fn:e,reactions:null,rv:0,v:te,wv:0,parent:O,ac:null}}function Do(e,t,s){let r=O;r===null&&Gl();var a=void 0,i=Dt(te),f=!I,v=new Map;return Ko(()=>{var y;var u=O,p=va();a=p.promise;try{Promise.resolve(e()).then(p.resolve,p.reject).finally(Ws)}catch(o){p.reject(o),Ws()}var g=S;if(f){if(u.f&It)var E=Na();if(r.b.is_rendered())(y=v.get(g))==null||y.reject(Xe),v.delete(g);else{for(const o of v.values())o.reject(Xe);v.clear()}v.set(g,p)}const w=(o,T=void 0)=>{if(E){var m=T===Xe;E(m)}if(!(T===Xe||u.f&Re)){if(g.activate(),T)i.f|=ut,Qt(i,T);else{i.f&ut&&(i.f^=ut),Qt(i,o);for(const[R,$]of v){if(v.delete(R),R===g)break;$.reject(Xe)}}g.deactivate()}};p.promise.then(w,o=>w(null,o||"unknown"))}),Ir(()=>{for(const u of v.values())u.reject(Xe)}),new Promise(u=>{function p(g){function E(){g===a?u(i):p(a)}g.then(E,E)}p(a)})}function Ma(e){const t=Nr(e);return t.equals=ma,t}function Oo(e){var t=e.effects;if(t!==null){e.effects=null;for(var s=0;s<t.length;s+=1)_e(t[s])}}function Mr(e){var t,s=O,r=e.parent;if(!pt&&r!==null&&r.f&(Re|fe))return fo(),e.v;Me(r);try{e.f&=~Nt,Oo(e),t=Ja(e)}finally{Me(s)}return t}function Da(e){var t=Mr(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))){G(e,Z);return}pt||(re!==null?(Or()||S!=null&&S.is_fork)&&re.set(e,t):Ar(e))}function Io(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=Bl,r.ac=null,hs(r,0),Lr(r))}function Oa(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&Ot(t)}let mr=new Set;const At=new Map;let Ia=!1;function Dt(e,t){var s={f:0,v:e,reactions:null,equals:ba,rv:0,wv:0};return s}function it(e,t){const s=Dt(e);return Jo(s),s}function X(e,t=!1,s=!0){var a;const r=Dt(e);return t||(r.equals=ma),ks&&s&&H!==null&&H.l!==null&&((a=H.l).s??(a.s=[])).push(r),r}function is(e,t){return M(e,b(()=>n(e))),t}function M(e,t,s=!1){I!==null&&(!je||I.f&dr)&&Ss()&&I.f&(le|Ye|_s|dr)&&(Ce===null||!Kt.call(Ce,e))&&ro();let r=s?cs(t):t;return Qt(e,r,Ds)}function Qt(e,t,s=null){if(!e.equals(t)){At.set(e,pt?t:e.v);var r=Mt.ensure();if(r.capture(e,t),e.f&le){const a=e;e.f&ne&&Mr(a),re===null&&Ar(a)}e.wv=Ya(),Fa(e,ne,s),Ss()&&O!==null&&O.f&Z&&!(O.f&($e|dt))&&(Ee===null?Qo([e]):Ee.push(e)),!r.is_fork&&mr.size>0&&!Ia&&Fo()}return t}function Fo(){Ia=!1;for(const e of mr)e.f&Z&&G(e,We),Zt(e)&&Ot(e);mr.clear()}function ds(e){M(e,e.v+1)}function Fa(e,t,s){var r=e.reactions;if(r!==null)for(var a=Ss(),i=r.length,f=0;f<i;f++){var v=r[f],u=v.f;if(!(!a&&v===O)){var p=(u&ne)===0;if(p&&G(v,t),u&le){var g=v;re==null||re.delete(g),u&Nt||(u&Ae&&(O===null||!(O.f&$s))&&(v.f|=Nt),Fa(g,We,s))}else if(p){var E=v;u&Ye&&Le!==null&&Le.add(E),s!==null?s.push(E):Cr(E)}}}}function cs(e){if(typeof e!="object"||e===null||Tt in e)return e;const t=Tr(e);if(t!==zl&&t!==Hl)return e;var s=new Map,r=Sr(e),a=it(0),i=Ct,f=v=>{if(Ct===i)return v();var u=I,p=Ct;Ne(null),Zn(i);var g=v();return Ne(u),Zn(p),g};return r&&s.set("length",it(e.length)),new Proxy(e,{defineProperty(v,u,p){(!("value"in p)||p.configurable===!1||p.enumerable===!1||p.writable===!1)&&to();var g=s.get(u);return g===void 0?f(()=>{var E=it(p.value);return s.set(u,E),E}):M(g,p.value,!0),!0},deleteProperty(v,u){var p=s.get(u);if(p===void 0){if(u in v){const g=f(()=>it(te));s.set(u,g),ds(a)}}else M(p,te),ds(a);return!0},get(v,u,p){var y;if(u===Tt)return e;var g=s.get(u),E=u in v;if(g===void 0&&(!E||(y=us(v,u))!=null&&y.writable)&&(g=f(()=>{var o=cs(E?v[u]:te),T=it(o);return T}),s.set(u,g)),g!==void 0){var w=n(g);return w===te?void 0:w}return Reflect.get(v,u,p)},getOwnPropertyDescriptor(v,u){var p=Reflect.getOwnPropertyDescriptor(v,u);if(p&&"value"in p){var g=s.get(u);g&&(p.value=n(g))}else if(p===void 0){var E=s.get(u),w=E==null?void 0:E.v;if(E!==void 0&&w!==te)return{enumerable:!0,configurable:!0,value:w,writable:!0}}return p},has(v,u){var w;if(u===Tt)return!0;var p=s.get(u),g=p!==void 0&&p.v!==te||Reflect.has(v,u);if(p!==void 0||O!==null&&(!g||(w=us(v,u))!=null&&w.writable)){p===void 0&&(p=f(()=>{var y=g?cs(v[u]):te,o=it(y);return o}),s.set(u,p));var E=n(p);if(E===te)return!1}return g},set(v,u,p,g){var P;var E=s.get(u),w=u in v;if(r&&u==="length")for(var y=p;y<E.v;y+=1){var o=s.get(y+"");o!==void 0?M(o,te):y in v&&(o=f(()=>it(te)),s.set(y+"",o))}if(E===void 0)(!w||(P=us(v,u))!=null&&P.writable)&&(E=f(()=>it(void 0)),M(E,cs(p)),s.set(u,E));else{w=E.v!==te;var T=f(()=>cs(p));M(E,T)}var m=Reflect.getOwnPropertyDescriptor(v,u);if(m!=null&&m.set&&m.set.call(g,p),!w){if(r&&typeof u=="string"){var R=s.get("length"),$=Number(u);Number.isInteger($)&&$>=R.v&&M(R,$+1)}ds(a)}return!0},ownKeys(v){n(a);var u=Reflect.ownKeys(v).filter(E=>{var w=s.get(E);return w===void 0||w.v!==te});for(var[p,g]of s)g.v!==te&&!(p in v)&&u.push(p);return u},setPrototypeOf(){so()}})}function Gn(e){try{if(e!==null&&typeof e=="object"&&Tt in e)return e[Tt]}catch{}return e}function Lo(e,t){return Object.is(Gn(e),Gn(t))}var Jn,La,Pa,ja;function Po(){if(Jn===void 0){Jn=window,La=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,s=Text.prototype;Pa=us(t,"firstChild").get,ja=us(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 Dr(e){return Pa.call(e)}function Ts(e){return ja.call(e)}function _(e,t){return Dr(e)}function jo(e,t=!1){{var s=Dr(e);return s instanceof Comment&&s.data===""?Ts(s):s}}function h(e,t=1,s=!1){let r=e;for(;t--;)r=Ts(r);return r}function $o(e){e.textContent=""}function $a(){return!1}function Wo(e,t,s){return document.createElementNS(ga,e,void 0)}let Qn=!1;function qo(){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 Hs(e){var t=I,s=O;Ne(null),Me(null);try{return e()}finally{Ne(t),Me(s)}}function Wa(e,t,s,r=s){e.addEventListener(t,()=>Hs(s));const a=e.__on_r;a?e.__on_r=()=>{a(),r(!0)}:e.__on_r=()=>r(!0),qo()}function qa(e){O===null&&(I===null&&Zl(),Xl()),pt&&Ql()}function Uo(e,t){var s=t.last;s===null?t.last=t.first=e:(s.next=e,e.prev=s,t.last=e)}function Ge(e,t){var s=O;s!==null&&s.f&fe&&(e|=fe);var r={ctx:H,deps:null,nodes:null,f:e|ne|Ae,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&Yt)qt!==null?qt.push(r):Mt.ensure().schedule(r);else if(t!==null){try{Ot(r)}catch(f){throw _e(r),f}a.deps===null&&a.teardown===null&&a.nodes===null&&a.first===a.last&&!(a.f&Xt)&&(a=a.first,e&Ye&&e&Gt&&a!==null&&(a.f|=Gt))}if(a!==null&&(a.parent=s,s!==null&&Uo(a,s),I!==null&&I.f&le&&!(e&dt))){var i=I;(i.effects??(i.effects=[])).push(a)}return r}function Or(){return I!==null&&!je}function Ir(e){const t=Ge(xs,null);return G(t,Z),t.teardown=e,t}function yr(e){qa();var t=O.f,s=!I&&(t&$e)!==0&&(t&It)===0;if(s){var r=H;(r.e??(r.e=[])).push(e)}else return Ua(e)}function Ua(e){return Ge(Yt|pa,e)}function Vo(e){return qa(),Ge(xs|pa,e)}function zo(e){Mt.ensure();const t=Ge(dt|Xt,e);return(s={})=>new Promise(r=>{s.outro?Rt(t,()=>{_e(t),r(void 0)}):(_e(t),r(void 0))})}function Ho(e){return Ge(Yt,e)}function we(e,t){var s=H,r={effect:null,ran:!1,deps:e};s.l.$.push(r),r.effect=Bs(()=>{if(e(),!r.ran){r.ran=!0;var a=O;try{Me(a.parent),b(t)}finally{Me(a)}}})}function Bo(){var e=H;Bs(()=>{for(var t of e.l.$){t.deps();var s=t.effect;s.f&Z&&s.deps!==null&&G(s,We),Zt(s)&&Ot(s),t.ran=!1}})}function Ko(e){return Ge(_s|Xt,e)}function Bs(e,t=0){return Ge(xs|t,e)}function V(e,t=[],s=[],r=[]){No(r,t,s,a=>{Ge(xs,()=>e(...a.map(n)))})}function Fr(e,t=0){var s=Ge(Ye|t,e);return s}function Te(e){return Ge($e|Xt,e)}function Va(e){var t=e.teardown;if(t!==null){const s=pt,r=I;Xn(!0),Ne(null);try{t.call(null)}finally{Xn(s),Ne(r)}}}function Lr(e,t=!1){var s=e.first;for(e.first=e.last=null;s!==null;){const a=s.ac;a!==null&&Hs(()=>{a.abort(Xe)});var r=s.next;s.f&dt?s.parent=null:_e(s,t),s=r}}function Yo(e){for(var t=e.first;t!==null;){var s=t.next;t.f&$e||_e(t),t=s}}function _e(e,t=!0){var s=!1;(t||e.f&Yl)&&e.nodes!==null&&e.nodes.end!==null&&(Go(e.nodes.start,e.nodes.end),s=!0),G(e,Bn),Lr(e,t&&!s),hs(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|=Re;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 Go(e,t){for(;e!==null;){var s=e===t?null:Ts(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 Rt(e,t,s=!0){var r=[];Ha(e,r,!0);var a=()=>{s&&_e(e),t&&t()},i=r.length;if(i>0){var f=()=>--i||a();for(var v of r)v.out(f)}else a()}function Ha(e,t,s){if(!(e.f&fe)){e.f^=fe;var r=e.nodes&&e.nodes.t;if(r!==null)for(const v of r)(v.is_global||s)&&t.push(v);for(var a=e.first;a!==null;){var i=a.next;if(!(a.f&dt)){var f=(a.f&Gt)!==0||(a.f&$e)!==0&&(e.f&Ye)!==0;Ha(a,t,f?s:!1)}a=i}}}function Pr(e){Ba(e,!0)}function Ba(e,t){if(e.f&fe){e.f^=fe,e.f&Z||(G(e,ne),Mt.ensure().schedule(e));for(var s=e.first;s!==null;){var r=s.next,a=(s.f&Gt)!==0||(s.f&$e)!==0;Ba(s,a?t:!1),s=r}var i=e.nodes&&e.nodes.t;if(i!==null)for(const f of i)(f.is_global||t)&&f.in()}}function jr(e,t){if(e.nodes)for(var s=e.nodes.start,r=e.nodes.end;s!==null;){var a=s===r?null:Ts(s);t.append(s),s=a}}let js=!1,pt=!1;function Xn(e){pt=e}let I=null,je=!1;function Ne(e){I=e}let O=null;function Me(e){O=e}let Ce=null;function Jo(e){I!==null&&(Ce===null?Ce=[e]:Ce.push(e))}let pe=null,ge=0,Ee=null;function Qo(e){Ee=e}let Ka=1,yt=0,Ct=yt;function Zn(e){Ct=e}function Ya(){return++Ka}function Zt(e){var t=e.f;if(t&ne)return!0;if(t&le&&(e.f&=~Nt),t&We){for(var s=e.deps,r=s.length,a=0;a<r;a++){var i=s[a];if(Zt(i)&&Da(i),i.wv>e.wv)return!0}t&Ae&&re===null&&G(e,Z)}return!1}function Ga(e,t,s=!0){var r=e.reactions;if(r!==null&&!(Ce!==null&&Kt.call(Ce,e)))for(var a=0;a<r.length;a++){var i=r[a];i.f&le?Ga(i,t,!1):t===i&&(s?G(i,ne):i.f&Z&&G(i,We),Cr(i))}}function Ja(e){var T;var t=pe,s=ge,r=Ee,a=I,i=Ce,f=H,v=je,u=Ct,p=e.f;pe=null,ge=0,Ee=null,I=p&($e|dt)?null:e,Ce=null,Jt(e.ctx),je=!1,Ct=++yt,e.ac!==null&&(Hs(()=>{e.ac.abort(Xe)}),e.ac=null);try{e.f|=$s;var g=e.fn,E=g();e.f|=It;var w=e.deps,y=S==null?void 0:S.is_fork;if(pe!==null){var o;if(y||hs(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(Or()&&e.f&Ae)for(o=ge;o<w.length;o++)((T=w[o]).reactions??(T.reactions=[])).push(e)}else!y&&w!==null&&ge<w.length&&(hs(e,ge),w.length=ge);if(Ss()&&Ee!==null&&!je&&w!==null&&!(e.f&(le|We|ne)))for(o=0;o<Ee.length;o++)Ga(Ee[o],e);if(a!==null&&a!==e){if(yt++,a.deps!==null)for(let m=0;m<s;m+=1)a.deps[m].rv=yt;if(t!==null)for(const m of t)m.rv=yt;Ee!==null&&(r===null?r=Ee:r.push(...Ee))}return e.f&ut&&(e.f^=ut),E}catch(m){return xa(m)}finally{e.f^=$s,pe=t,ge=s,Ee=r,I=a,Ce=i,Jt(f),je=v,Ct=u}}function Xo(e,t){let s=t.reactions;if(s!==null){var r=Ul.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&&(pe===null||!Kt.call(pe,t))){var i=t;i.f&Ae&&(i.f^=Ae,i.f&=~Nt),i.v!==te&&Ar(i),Io(i),hs(i,0)}}function hs(e,t){var s=e.deps;if(s!==null)for(var r=t;r<s.length;r++)Xo(e,s[r])}function Ot(e){var t=e.f;if(!(t&Re)){G(e,Z);var s=O,r=js;O=e,js=!0;try{t&(Ye|da)?Yo(e):Lr(e),Va(e);var a=Ja(e);e.teardown=typeof a=="function"?a:null,e.wv=Ka;var i;ql&&_o&&e.f&ne&&e.deps}finally{js=r,O=s}}}async function Zo(){await Promise.resolve(),wo()}function n(e){var t=e.f,s=(t&le)!==0;if(I!==null&&!je){var r=O!==null&&(O.f&Re)!==0;if(!r&&(Ce===null||!Kt.call(Ce,e))){var a=I.deps;if(I.f&$s)e.rv<yt&&(e.rv=yt,pe===null&&a!==null&&a[ge]===e?ge++:pe===null?pe=[e]:pe.push(e));else{(I.deps??(I.deps=[])).push(e);var i=e.reactions;i===null?e.reactions=[I]:Kt.call(i,I)||i.push(I)}}}if(pt&&At.has(e))return At.get(e);if(s){var f=e;if(pt){var v=f.v;return(!(f.f&Z)&&f.reactions!==null||Xa(f))&&(v=Mr(f)),At.set(f,v),v}var u=(f.f&Ae)===0&&!je&&I!==null&&(js||(I.f&Ae)!==0),p=(f.f&It)===0;Zt(f)&&(u&&(f.f|=Ae),Da(f)),u&&!p&&(Oa(f),Qa(f))}if(re!=null&&re.has(e))return re.get(e);if(e.f&ut)throw e.v;return e.v}function Qa(e){if(e.f|=Ae,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),t.f&le&&!(t.f&Ae)&&(Oa(t),Qa(t))}function Xa(e){if(e.v===te)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(At.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 ec(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Tt in e)wr(e);else if(!Array.isArray(e))for(let t in e){const s=e[t];typeof s=="object"&&s&&Tt in s&&wr(s)}}}function wr(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{wr(e[r],t)}catch{}const s=Tr(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 tc=["touchstart","touchmove"];function sc(e){return tc.includes(e)}const Cs=Symbol("events"),rc=new Set,ea=new Set;function nc(e,t,s,r={}){function a(i){if(r.capture||Er.call(t,i),!i.cancelBubble)return Hs(()=>s==null?void 0:s.call(this,i))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?vt(()=>{t.addEventListener(e,a,r)}):t.addEventListener(e,a,r),a}function ta(e,t,s,r,a){var i={capture:r,passive:a},f=nc(e,t,s,i);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Ir(()=>{t.removeEventListener(e,f,i)})}let sa=null;function Er(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 f=0,v=sa===e&&e[Cs];if(v){var u=a.indexOf(v);if(u!==-1&&(t===document||t===window)){e[Cs]=t;return}var p=a.indexOf(t);if(p===-1)return;u<=p&&(f=u)}if(i=a[f]||e.target,i!==t){Vl(e,"currentTarget",{configurable:!0,get(){return i||s}});var g=I,E=O;Ne(null),Me(null);try{for(var w,y=[];i!==null;){var o=i.assignedSlot||i.parentNode||i.host||null;try{var T=(R=i[Cs])==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[Cs]=t,delete e.currentTarget,Ne(g),Me(E)}}}var ca;const lr=((ca=globalThis==null?void 0:globalThis.window)==null?void 0:ca.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function ac(e){return(lr==null?void 0:lr.createHTML(e))??e}function ic(e){var t=Wo("template");return t.innerHTML=ac(e.replaceAll("<!>","<!---->")),t.content}function $r(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&co)!==0,r,a=!e.startsWith("<!>");return()=>{r===void 0&&(r=ic(a?e:"<!>"+e),r=Dr(r));var i=s||La?document.importNode(r,!0):r.cloneNode(!0);return $r(i,i),i}}function ra(e=""){{var t=rt(e+"");return $r(t,t),t}}function lc(){var e=document.createDocumentFragment(),t=document.createComment(""),s=rt();return e.append(t,s),$r(t,s),e}function j(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 oc(e,t){return cc(e,t)}const Ns=new Map;function cc(e,{target:t,anchor:s,props:r={},events:a,context:i,intro:f=!0,transformError:v}){Po();var u=void 0,p=zo(()=>{var g=s??t.appendChild(rt());So(g,{pending:()=>{}},y=>{ya({});var o=H;i&&(o.c=i),a&&(r.$$events=a),u=e(y,r)||{},wa()},v);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=sc(T);for(const P of[t,document]){var R=Ns.get(P);R===void 0&&(R=new Map,Ns.set(P,R));var $=R.get(T);$===void 0?(P.addEventListener(T,Er,{passive:m}),R.set(T,1)):R.set(T,$+1)}}}};return w(zs(rc)),ea.add(w),()=>{var m;for(var y of E)for(const R of[t,document]){var o=Ns.get(R),T=o.get(y);--T==0?(R.removeEventListener(y,Er),o.delete(y),o.size===0&&Ns.delete(R)):o.set(y,T)}ea.delete(w),g!==s&&((m=g.parentNode)==null||m.removeChild(g))}});return fc.set(u,p),u}let fc=new WeakMap;var Pe,Be,ye,St,ws,Es,Vs;class uc{constructor(t,s=!0){Fe(this,"anchor");C(this,Pe,new Map);C(this,Be,new Map);C(this,ye,new Map);C(this,St,new Set);C(this,ws,!0);C(this,Es,t=>{if(c(this,Pe).has(t)){var s=c(this,Pe).get(t),r=c(this,Be).get(s);if(r)Pr(r),c(this,St).delete(s);else{var a=c(this,ye).get(s);a&&(c(this,Be).set(s,a.effect),c(this,ye).delete(s),a.fragment.lastChild.remove(),this.anchor.before(a.fragment),r=a.effect)}for(const[i,f]of c(this,Pe)){if(c(this,Pe).delete(i),i===t)break;const v=c(this,ye).get(f);v&&(_e(v.effect),c(this,ye).delete(f))}for(const[i,f]of c(this,Be)){if(i===s||c(this,St).has(i))continue;const v=()=>{if(Array.from(c(this,Pe).values()).includes(i)){var p=document.createDocumentFragment();jr(f,p),p.append(rt()),c(this,ye).set(i,{effect:f,fragment:p})}else _e(f);c(this,St).delete(i),c(this,Be).delete(i)};c(this,ws)||!r?(c(this,St).add(i),Rt(f,v,!1)):v()}}});C(this,Vs,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)||(_e(a.effect),c(this,ye).delete(r))});this.anchor=t,D(this,ws,s)}ensure(t,s){var r=S,a=$a();if(s&&!c(this,Be).has(t)&&!c(this,ye).has(t))if(a){var i=document.createDocumentFragment(),f=rt();i.append(f),c(this,ye).set(t,{effect:Te(()=>s(f)),fragment:i})}else c(this,Be).set(t,Te(()=>s(this.anchor)));if(c(this,Pe).set(r,t),a){for(const[v,u]of c(this,Be))v===t?r.unskip_effect(u):r.skip_effect(u);for(const[v,u]of c(this,ye))v===t?r.unskip_effect(u.effect):r.skip_effect(u.effect);r.oncommit(c(this,Es)),r.ondiscard(c(this,Vs))}else c(this,Es).call(this,r)}}Pe=new WeakMap,Be=new WeakMap,ye=new WeakMap,St=new WeakMap,ws=new WeakMap,Es=new WeakMap,Vs=new WeakMap;function oe(e,t,s=!1){var r=new uc(e),a=s?Gt:0;function i(f,v){r.ensure(f,v)}Fr(()=>{var f=!1;t((v,u=0)=>{f=!0,i(u,v)}),f||i(-1,null)},a)}function vc(e,t,s){for(var r=[],a=t.length,i,f=t.length,v=0;v<a;v++){let E=t[v];Rt(E,()=>{if(i){if(i.pending.delete(E),i.done.add(E),i.pending.size===0){var w=e.outrogroups;xr(e,zs(i.done)),w.delete(i),w.size===0&&(e.outrogroups=null)}}else f-=1},!1)}if(f===0){var u=r.length===0&&s!==null;if(u){var p=s,g=p.parentNode;$o(g),g.append(p),e.items.clear()}xr(e,t,!u)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function xr(e,t,s=!0){var r;if(e.pending.size>0){r=new Set;for(const f of e.pending.values())for(const v of f)r.add(e.items.get(v).e)}for(var a=0;a<t.length;a++){var i=t[a];if(r!=null&&r.has(i)){i.f|=Ke;const f=document.createDocumentFragment();jr(i,f)}else _e(t[a],s)}}var na;function Wt(e,t,s,r,a,i=null){var f=e,v=new Map,u=(t&ha)!==0;if(u){var p=e;f=p.appendChild(rt())}var g=null,E=Ma(()=>{var P=s();return Sr(P)?P:P==null?[]:zs(P)}),w,y=new Map,o=!0;function T(P){$.effect.f&Re||($.pending.delete(P),$.fallback=g,dc($,w,f,t,r),g!==null&&(w.length===0?g.f&Ke?(g.f^=Ke,fs(g,null,f)):Pr(g):Rt(g,()=>{g=null})))}function m(P){$.pending.delete(P)}var R=Fr(()=>{w=n(E);for(var P=w.length,Q=new Set,ae=S,qe=$a(),F=0;F<P;F+=1){var Je=w[F],nt=r(Je,F),ue=o?null:v.get(nt);ue?(ue.v&&Qt(ue.v,Je),ue.i&&Qt(ue.i,F),qe&&ae.unskip_effect(ue.e)):(ue=pc(v,o?f:na??(na=rt()),Je,nt,F,a,t,s),o||(ue.e.f|=Ke),v.set(nt,ue)),Q.add(nt)}if(P===0&&i&&!g&&(o?g=Te(()=>i(f)):(g=Te(()=>i(na??(na=rt()))),g.f|=Ke)),P>Q.size&&Jl(),!o)if(y.set(ae,Q),qe){for(const[at,_t]of v)Q.has(at)||ae.skip_effect(_t.e);ae.oncommit(T),ae.ondiscard(m)}else T(ae);n(E)}),$={effect:R,items:v,pending:y,outrogroups:null,fallback:g};o=!1}function ls(e){for(;e!==null&&!(e.f&$e);)e=e.next;return e}function dc(e,t,s,r,a){var ue,at,_t,ht,As,es,ts,ss,rs;var i=(r&lo)!==0,f=t.length,v=e.items,u=ls(e.effect.first),p,g=null,E,w=[],y=[],o,T,m,R;if(i)for(R=0;R<f;R+=1)o=t[R],T=a(o,R),m=v.get(T).e,m.f&Ke||((at=(ue=m.nodes)==null?void 0:ue.a)==null||at.measure(),(E??(E=new Set)).add(m));for(R=0;R<f;R+=1){if(o=t[R],T=a(o,R),m=v.get(T).e,e.outrogroups!==null)for(const De of e.outrogroups)De.pending.delete(m),De.done.delete(m);if(m.f&fe&&(Pr(m),i&&((ht=(_t=m.nodes)==null?void 0:_t.a)==null||ht.unfix(),(E??(E=new Set)).delete(m))),m.f&Ke)if(m.f^=Ke,m===u)fs(m,null,s);else{var $=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),lt(e,g,m),lt(e,m,$),fs(m,$,s),g=m,w=[],y=[],u=ls(g.next);continue}if(m!==u){if(p!==void 0&&p.has(m)){if(w.length<y.length){var P=y[0],Q;g=P.prev;var ae=w[0],qe=w[w.length-1];for(Q=0;Q<w.length;Q+=1)fs(w[Q],P,s);for(Q=0;Q<y.length;Q+=1)p.delete(y[Q]);lt(e,ae.prev,qe.next),lt(e,g,ae),lt(e,qe,P),u=P,g=qe,R-=1,w=[],y=[]}else p.delete(m),fs(m,u,s),lt(e,m.prev,m.next),lt(e,m,g===null?e.effect.first:g.next),lt(e,g,m),g=m;continue}for(w=[],y=[];u!==null&&u!==m;)(p??(p=new Set)).add(u),y.push(u),u=ls(u.next);if(u===null)continue}m.f&Ke||w.push(m),g=m,u=ls(m.next)}if(e.outrogroups!==null){for(const De of e.outrogroups)De.pending.size===0&&(xr(e,zs(De.done)),(As=e.outrogroups)==null||As.delete(De));e.outrogroups.size===0&&(e.outrogroups=null)}if(u!==null||p!==void 0){var F=[];if(p!==void 0)for(m of p)m.f&fe||F.push(m);for(;u!==null;)!(u.f&fe)&&u!==e.fallback&&F.push(u),u=ls(u.next);var Je=F.length;if(Je>0){var nt=r&ha&&f===0?s:null;if(i){for(R=0;R<Je;R+=1)(ts=(es=F[R].nodes)==null?void 0:es.a)==null||ts.measure();for(R=0;R<Je;R+=1)(rs=(ss=F[R].nodes)==null?void 0:ss.a)==null||rs.fix()}vc(e,F,nt)}}i&&vt(()=>{var De,Ft;if(E!==void 0)for(m of E)(Ft=(De=m.nodes)==null?void 0:De.a)==null||Ft.apply()})}function pc(e,t,s,r,a,i,f,v){var u=f&ao?f&oo?Dt(s):X(s,!1,!1):null,p=f&io?Dt(a):null;return{v:u,i:p,e:Te(()=>(i(t,u??s,p??a,v),()=>{e.delete(r)}))}}function fs(e,t,s){if(e.nodes)for(var r=e.nodes.start,a=e.nodes.end,i=t&&!(t.f&Ke)?t.nodes.start:s;r!==null;){var f=Ts(r);if(i.before(r),r===a)return;r=f}}function lt(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 _c(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,f=0;(f=r.indexOf(a,f))>=0;){var v=f+i;(f===0||aa.includes(r[f-1]))&&(v===r.length||aa.includes(r[v]))?r=(f===0?"":r.substring(0,f))+r.substring(v+1):f=v}}return r===""?null:r}function hc(e,t){return e==null?null:String(e)}function os(e,t,s,r,a,i){var f=e.__className;if(f!==s||f===void 0){var v=_c(s,r,i);v==null?e.removeAttribute("class"):e.className=v,e.__className=s}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 ia(e,t,s,r){var a=e.__style;if(a!==t){var i=hc(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(!Sr(t))return uo();for(var r of e.options)r.selected=t.includes(ps(r));return}for(r of e.options){var a=ps(r);if(Lo(a,t)){r.selected=!0;return}}(!s||t!==void 0)&&(e.selectedIndex=-1)}function gc(e){var t=new MutationObserver(()=>{Za(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Ir(()=>{t.disconnect()})}function or(e,t,s=t){var r=new WeakSet,a=!0;Wa(e,"change",i=>{var f=i?"[selected]":":checked",v;if(e.multiple)v=[].map.call(e.querySelectorAll(f),ps);else{var u=e.querySelector(f)??e.querySelector("option:not([disabled])");v=u&&ps(u)}s(v),e.__value=v,S!==null&&r.add(S)}),Ho(()=>{var i=t();if(e===document.activeElement){var f=S;if(r.has(f))return}if(Za(e,i,a),a&&i===void 0){var v=e.querySelector(":checked");v!==null&&(i=ps(v),s(i))}e.__value=i,a=!1}),gc(e)}function ps(e){return"__value"in e?e.__value:e.value}const bc=Symbol("is custom element"),mc=Symbol("is html");function yc(e,t,s,r){var a=wc(e);a[t]!==(a[t]=s)&&(s==null?e.removeAttribute(t):typeof s!="string"&&Ec(e).includes(t)?e[t]=s:e.setAttribute(t,s))}function wc(e){return e.__attributes??(e.__attributes={[bc]:e.nodeName.includes("-"),[mc]:e.namespaceURI===ga})}var la=new Map;function Ec(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 f in r)r[f].set&&s.push(f);a=Tr(a)}return s}function Ms(e,t,s=t){var r=new WeakSet;Wa(e,"input",async a=>{var i=a?e.defaultValue:e.value;if(i=cr(e)?fr(i):i,s(i),S!==null&&r.add(S),await Zo(),i!==(i=t())){var f=e.selectionStart,v=e.selectionEnd,u=e.value.length;if(e.value=i??"",v!==null){var p=e.value.length;f===v&&v===u&&p>u?(e.selectionStart=p,e.selectionEnd=p):(e.selectionStart=f,e.selectionEnd=Math.min(v,p))}}}),b(t)==null&&e.value&&(s(cr(e)?fr(e.value):e.value),S!==null&&r.add(S)),Bs(()=>{var a=t();if(e===document.activeElement){var i=S;if(r.has(i))return}cr(e)&&a===fr(e.value)||e.type==="date"&&!a&&!e.value||a!==e.value&&(e.value=a??"")})}function cr(e){var t=e.type;return t==="number"||t==="range"}function fr(e){return e===""?null:+e}function xc(e){return function(...t){var s=t[0];return s.preventDefault(),e==null?void 0:e.apply(this,t)}}function kc(e=!1){const t=H,s=t.l.u;if(!s)return;let r=()=>ec(t.s);if(e){let a=0,i={};const f=Nr(()=>{let v=!1;const u=t.s;for(const p in u)u[p]!==i[p]&&(i[p]=u[p],v=!0);return v&&a++,a});r=()=>n(f)}s.b.length&&Vo(()=>{oa(t,r),ur(s.b)}),yr(()=>{const a=b(()=>s.m.map(Kl));return()=>{for(const i of a)typeof i=="function"&&i()}}),s.a.length&&yr(()=>{oa(t,r),ur(s.a)})}function oa(e,t){if(e.l.s)for(const s of e.l.s)n(s);t()}function Sc(e){H===null&&_a(),ks&&H.l!==null?Ac(H).m.push(e):yr(()=>{const t=b(e);if(typeof t=="function")return t})}function Tc(e){H===null&&_a(),Sc(()=>()=>b(e))}function Ac(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}const Rc="5";var fa;typeof window<"u"&&((fa=window.__svelte??(window.__svelte={})).v??(fa.v=new Set)).add(Rc);ho();var Cc=W('<div class="svelte-d3ct2b"><span class="svelte-d3ct2b">Watch issue</span><strong class="status-warn svelte-d3ct2b"> </strong></div>'),Nc=W('<section class="notice svelte-d3ct2b"> </section>'),Mc=W('<section class="notice danger svelte-d3ct2b"> </section>'),Dc=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>'),Oc=W('<strong class="svelte-d3ct2b"> </strong>'),Ic=W('<strong class="svelte-d3ct2b"> </strong>'),Fc=W('<strong class="svelte-d3ct2b"> </strong>'),Lc=W('<strong class="svelte-d3ct2b"> </strong>'),Pc=W('<strong class="svelte-d3ct2b"> </strong>'),jc=W('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Why:</b> </p>'),$c=W('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Issue:</b> </p>'),Wc=W('<p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Fix:</b> </p>'),qc=W('<pre class="svelte-d3ct2b"> </pre>'),Uc=W('<div class="terminal-detail svelte-d3ct2b"><p class="svelte-d3ct2b"> </p> <p class="svelte-d3ct2b"><b class="svelte-d3ct2b">Rule:</b> </p> <!> <!> <!> <!></div>'),Vc=W('<section><p class="terminal-line svelte-d3ct2b"><time class="svelte-d3ct2b"> </time> <span class="svelte-d3ct2b"> </span> <!></p> <!></section>'),zc=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>'),Hc=W('<p class="empty svelte-d3ct2b">No rule counters yet.</p>'),Bc=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>'),Kc=W('<p class="empty svelte-d3ct2b">No file counters yet.</p>'),Yc=W('<small class="svelte-d3ct2b"> </small>'),Gc=W('<small class="svelte-d3ct2b"> </small>'),Jc=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>'),Qc=W('<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>'),Xc=W('<small class="svelte-d3ct2b"> </small>'),Zc=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>'),ef=W('<p class="empty svelte-d3ct2b">No rules match the current filters.</p>'),tf=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 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 sf(e,t){ya(t,!1);const s=X(),r=X(),a=X(),i=X(),f=X(),v=X(),u=X(),p=X(),g=X(),E=X(),w=X(),y=X();let o=X({config:null,stats:{rules:{},files:{},topRules:[],topFiles:[]},files:[],memories:[]}),T=X([]),m=X(!1),R=X("all"),$=X(""),P=X(!1),Q=X(""),ae,qe=!1,F=X({type:"rule",scope:"project",content:"",reason:"",tags:"dashboard"});const Je=24*60*60*1e3,nt=()=>{var l;return((l=n(o).runtime)==null?void 0:l.project.name)??"memory-core"},ue=()=>{var A,N;const l=((A=n(o).runtime)==null?void 0:A.project.declaredArchitectures)??[],d=((N=n(o).runtime)==null?void 0:N.project.activeArchitectures)??[];return l.length>0?l.join(", "):d.length>0?d.join(", "):"none"};function at(l){M(T,[{...l,id:crypto.randomUUID()},...n(T)].slice(0,80))}function _t(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 ht(l){const d=n(o).files??[],A=d.findIndex(K=>K.file===l.file),N=d.slice();return A===-1?N.push(l):N[A]=l,N.sort((K,ie)=>ie.lastSeen.localeCompare(K.lastSeen))}function As(l){const d=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={...d,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=ht({file:l.file,status:"checking",lastSeen:l.timestamp,violations:[]})),l.type==="clean"&&(A=ht({file:l.file,status:"clean",lastSeen:l.timestamp,violations:[]})),l.type==="skipped"&&(A=ht({file:l.file,status:"skipped",lastSeen:l.timestamp,violations:[],message:l.reason})),l.type==="violations"&&(A=ht({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 K=[l,...n(o).events??[]].slice(0,100);M(o,{...n(o),files:A,events:K,watcher:N})}function es(l=[]){M(T,l.map(_t).map(d=>({...d,id:crypto.randomUUID()})).reverse().slice(0,80))}function ts(l){return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(l))}function ss(l){return Math.max(1,...l.map(d=>d.count))}function rs(l,d){const A=l.file||d;return l.line?`${A}:${l.line}`:A}function De(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 Ft(){const l=await fetch("/api/snapshot");M(o,await l.json()),es(n(o).events)}async function ei(){if(!qe&&document.visibilityState!=="hidden"){qe=!0;try{const l=await fetch("/api/stats",{cache:"no-store"});if(!l.ok)return;const d=await l.json();if(!d.stats)return;M(o,{...n(o),stats:d.stats})}catch{}finally{qe=!1}}}function ti(){ae&&clearInterval(ae),ae=setInterval(()=>{ei()},2e3)}function Wr(){const l=location.protocol==="https:"?"wss:":"ws:",d=new WebSocket(`${l}//${location.host}/ws`);d.addEventListener("open",()=>{M(m,!0),at({type:"system",timestamp:new Date().toISOString(),message:"Dashboard connected"})}),d.addEventListener("close",()=>{M(m,!1),at({type:"error",timestamp:new Date().toISOString(),message:"Dashboard disconnected"}),setTimeout(Wr,1500)}),d.addEventListener("message",A=>{const N=JSON.parse(A.data);if(N.type==="snapshot"){M(o,N.snapshot),n(T).length===0&&es(n(o).events);return}N.type==="watch"&&(As(N.event),at(_t(N.event)))})}async function si(){if(n(F).content.trim()){M(P,!0),M(Q,"");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 Ft()}catch(l){M(Q,l.message)}finally{M(P,!1)}}}async function ri(l){M(Q,"");const d=await fetch(`/api/memories/${l}`,{method:"DELETE"});if(!d.ok){M(Q,(await d.json()).error??"Delete failed");return}await Ft()}Ft().catch(l=>{M(Q,l.message)}),Wr(),ti(),Tc(()=>{ae&&(clearInterval(ae),ae=void 0)}),we(()=>(n(o),n(R),n($)),()=>{M(s,n(o).memories.filter(l=>{const d=n(R)==="all"||l.type===n(R),A=`${l.type} ${l.scope} ${l.content} ${l.reason??""} ${l.tags.join(" ")}`.toLowerCase();return d&&A.includes(n($).toLowerCase())}))}),we(()=>n(o),()=>{M(r,Object.values(n(o).stats.files??{}).reduce((l,d)=>l+d,0))}),we(()=>n(o),()=>{M(a,n(o).files.filter(l=>l.status==="clean").length)}),we(()=>n(o),()=>{M(i,Object.values(n(o).stats.rules).reduce((l,d)=>l+d,0))}),we(()=>n(o),()=>{M(f,n(o).stats.recentViolations??[])}),we(()=>n(f),()=>{M(v,n(f).filter(l=>{if(!(l.source==="hook"||l.source==="ci"))return!1;const d=Date.parse(l.timestamp);return Number.isNaN(d)?!1:Date.now()-d<=Je}))}),we(()=>n(r),()=>{M(u,n(r))}),we(()=>n(o),()=>{M(p,Object.keys(n(o).stats.files??{}).length)}),we(()=>n(o),()=>{M(g,n(o).memories.filter(l=>["rule","pattern","decision"].includes(l.type)).length)}),we(()=>n(o),()=>{var l;M(E,((l=n(o).memoryCount)==null?void 0:l.total)??n(o).memories.length)}),we(()=>n(o),()=>{var l;M(w,((l=n(o).memoryCount)==null?void 0:l.relevant)??n(o).memories.length)}),we(()=>(n(m),n(o)),()=>{var l,d;M(y,n(m)?((l=n(o).watcher)==null?void 0:l.enabled)===!1?{live:!1,label:"Watch off"}:(d=n(o).watcher)!=null&&d.running?{live:!0,label:"Watcher live"}:{live:!1,label:"Watcher idle"}:{live:!1,label:"Disconnected"})}),Bo(),kc();var qr=tf(),Ur=_(qr),ni=h(_(Ur),4),Ks=_(ni);let Vr;var ai=h(_(Ks)),ii=h(Ks,2),li=_(ii),oi=h(Ur,2),zr=_(oi),Hr=_(zr),Br=h(_(Hr),2);let Kr;var ci=h(_(Br),2),fi=_(ci),ui=h(Hr,2),Yr=_(ui),vi=h(_(Yr),2),di=_(vi),Gr=h(Yr,2),pi=h(_(Gr),2),_i=_(pi),hi=h(Gr,2),gi=h(_(hi),2),bi=_(gi),mi=h(zr,2),Jr=_(mi),Qr=_(Jr),Xr=_(Qr),yi=h(_(Xr),2),wi=_(yi),Ei=h(Xr,2),Zr=_(Ei),xi=h(_(Zr)),ki=_(xi),en=h(Zr,2),Si=h(_(en)),Ti=_(Si),tn=h(en,2),Ai=h(_(tn)),Ri=_(Ai),sn=h(tn,2),Ci=h(_(sn)),Ni=_(Ci),rn=h(sn,2),Mi=h(_(rn)),Di=_(Mi),Oi=h(rn,2);{var Ii=l=>{var d=Cc(),A=h(_(d)),N=_(A);V(()=>x(N,(n(o),b(()=>n(o).watcher.error)))),j(l,d)};oe(Oi,l=>{n(o),b(()=>{var d;return(d=n(o).watcher)==null?void 0:d.error})&&l(Ii)})}var nn=h(Qr,2),an=_(nn),Fi=h(_(an),2),Li=_(Fi),Pi=h(an,2),ln=_(Pi),ji=h(_(ln)),$i=_(ji),on=h(ln,2),Wi=h(_(on)),qi=_(Wi),cn=h(on,2),fn=h(_(cn),2);let un;var Ui=_(fn);{var Vi=l=>{var d=ra();V(()=>x(d,(n(o),b(()=>{var A;return(A=n(o).runtime)!=null&&A.model.checkModelInstalled?"installed":"missing"})))),j(l,d)},zi=l=>{var d=ra();V(()=>x(d,(n(o),b(()=>{var A;return(A=n(o).runtime)!=null&&A.model.apiKeyConfigured?"api key set":"api key missing"})))),j(l,d)};oe(Ui,l=>{n(o),b(()=>{var d;return((d=n(o).runtime)==null?void 0:d.model.provider)==="ollama"})?l(Vi):l(zi,-1)})}var vn=h(cn,2),Hi=h(_(vn)),Bi=_(Hi),Ki=h(vn,2),Yi=h(_(Ki)),Gi=_(Yi),Ji=h(nn,2),dn=_(Ji),pn=h(_(dn),2);let _n;var Qi=_(pn),Xi=h(dn,2),hn=_(Xi),Zi=h(_(hn)),el=_(Zi),gn=h(hn,2),tl=h(_(gn)),sl=_(tl),bn=h(gn,2),rl=h(_(bn)),nl=_(rl),al=h(bn,2),il=h(_(al)),ll=_(il),mn=h(Jr,2);{var ol=l=>{var d=Nc(),A=_(d);V(()=>x(A,(n(o),b(()=>n(o).dbError)))),j(l,d)};oe(mn,l=>{n(o),b(()=>n(o).dbError)&&l(ol)})}var yn=h(mn,2);{var cl=l=>{var d=Mc(),A=_(d);V(()=>x(A,n(Q))),j(l,d)};oe(yn,l=>{n(Q)&&l(cl)})}var wn=h(yn,2),fl=h(_(wn),2),En=_(fl);{var ul=l=>{var d=Dc();j(l,d)};oe(En,l=>{n(T),b(()=>n(T).length===0)&&l(ul)})}var vl=h(En,2);Wt(vl,1,()=>(n(T),b(()=>[...n(T)].reverse())),l=>l.id,(l,d)=>{var A=Vc();let N;var K=_(A),ie=_(K),ve=_(ie),L=h(ie,2),k=_(L),q=h(L,2);{var Qe=B=>{var Y=Oc(),he=_(Y);V(()=>x(he,(n(d),b(()=>n(d).message)))),j(B,Y)},ns=B=>{var Y=Ic(),he=_(Y);V(()=>x(he,`saved: ${n(d),b(()=>n(d).file)??""}`)),j(B,Y)},as=B=>{var Y=Fc(),he=_(Y);V(()=>x(he,`${n(d),b(()=>n(d).file)??""} - no violations`)),j(B,Y)},Lt=B=>{var Y=Lc(),he=_(Y);V(()=>x(he,`${n(d),b(()=>n(d).file)??""} - skipped: ${n(d),b(()=>n(d).reason)??""}`)),j(B,Y)},Ue=B=>{var Y=Pc(),he=_(Y);V(()=>x(he,`${n(d),b(()=>n(d).violations.length)??""} violation${n(d),b(()=>n(d).violations.length===1?"":"s")??""} in ${n(d),b(()=>n(d).file)??""}`)),j(B,Y)};oe(q,B=>{n(d),b(()=>n(d).type==="system"||n(d).type==="error")?B(Qe):(n(d),b(()=>n(d).type==="saved")?B(ns,1):(n(d),b(()=>n(d).type==="clean")?B(as,2):(n(d),b(()=>n(d).type==="skipped")?B(Lt,3):B(Ue,-1))))})}var Pt=h(K,2);{var jt=B=>{var Y=lc(),he=jo(Y);Wt(he,3,()=>(n(d),b(()=>n(d).violations)),(Rs,z)=>`${n(d).id}-${z}`,(Rs,z,Oe)=>{var Ve=Uc(),$t=_(Ve),Dl=_($t),Wn=h($t,2),Ol=h(_(Wn)),qn=h(Wn,2);{var Il=se=>{var Ie=jc(),gt=h(_(Ie));V(()=>x(gt,` ${n(z),b(()=>n(z).reason)??""}`)),j(se,Ie)};oe(qn,se=>{n(z),b(()=>n(z).reason)&&se(Il)})}var Un=h(qn,2);{var Fl=se=>{var Ie=$c(),gt=h(_(Ie));V(()=>x(gt,` ${n(z),b(()=>n(z).issue)??""}`)),j(se,Ie)};oe(Un,se=>{n(z),b(()=>n(z).issue)&&se(Fl)})}var Vn=h(Un,2);{var Ll=se=>{var Ie=Wc(),gt=h(_(Ie));V(()=>x(gt,` ${n(z),b(()=>n(z).suggestion)??""}`)),j(se,Ie)};oe(Vn,se=>{n(z),b(()=>n(z).suggestion)&&se(Ll)})}var Pl=h(Vn,2);{var jl=se=>{var Ie=qc(),gt=_(Ie);V(()=>x(gt,(n(z),b(()=>n(z).code)))),j(se,Ie)};oe(Pl,se=>{n(z),b(()=>n(z).code)&&se(jl)})}V(se=>{x(Dl,`[${n(Oe)+1}] ${se??""}`),x(Ol,` ${n(z),b(()=>n(z).rule)??""}`)},[()=>(n(z),n(d),b(()=>rs(n(z),n(d).file)))]),j(Rs,Ve)}),j(B,Y)};oe(Pt,B=>{n(d),b(()=>n(d).type==="violations")&&B(jt)})}V((B,Y)=>{N=os(A,1,"svelte-d3ct2b",null,N,{"error-line":n(d).type==="error","ok-line":n(d).type==="clean","violation-line":n(d).type==="violations"}),x(ve,B),x(k,Y)},[()=>(n(d),b(()=>ts(n(d).timestamp))),()=>(n(d),b(()=>De(n(d))))]),j(l,A)});var dl=h(wn,2),xn=_(dl),kn=h(_(xn),2),pl=h(_(kn),2);Wt(pl,1,()=>(n(o),b(()=>n(o).stats.topRules.slice(0,5))),l=>l.name,(l,d)=>{var A=zc(),N=_(A),K=_(N),ie=_(K),ve=h(K,2),L=_(ve),k=h(N,2);V(q=>{x(ie,(n(d),b(()=>n(d).name))),x(L,(n(d),b(()=>n(d).count))),ia(k,q)},[()=>(n(d),n(o),b(()=>`width: ${n(d).count/ss(n(o).stats.topRules)*100}%`))]),j(l,A)},l=>{var d=Hc();j(l,d)});var Sn=h(kn,2),_l=h(_(Sn),2);Wt(_l,1,()=>(n(o),b(()=>n(o).stats.topFiles.slice(0,5))),l=>l.name,(l,d)=>{var A=Bc(),N=_(A),K=_(N),ie=_(K),ve=h(K,2),L=_(ve),k=h(N,2);V(q=>{x(ie,(n(d),b(()=>n(d).name))),x(L,(n(d),b(()=>n(d).count))),ia(k,q)},[()=>(n(d),n(o),b(()=>`width: ${n(d).count/ss(n(o).stats.topFiles)*100}%`))]),j(l,A)},l=>{var d=Kc();j(l,d)});var hl=h(Sn,2),Tn=_(hl),gl=h(_(Tn)),bl=_(gl),An=h(Tn,2),ml=h(_(An)),yl=_(ml),wl=h(An,2),El=h(_(wl)),xl=_(El),Rn=h(xn,2);{var kl=l=>{var d=Qc(),A=_(d),N=h(_(A),2),K=_(N),ie=h(A,2);Wt(ie,7,()=>(n(v),b(()=>n(v).slice(0,8))),(ve,L)=>`${ve.timestamp}-${L}`,(ve,L)=>{var k=Jc(),q=_(k),Qe=_(q),ns=_(Qe),as=h(Qe,2),Lt=_(as),Ue=h(q,2),Pt=_(Ue),jt=h(Ue,2),B=_(jt),Y=h(jt,2);{var he=Oe=>{var Ve=Yc(),$t=_(Ve);V(()=>x($t,(n(L),b(()=>n(L).issue)))),j(Oe,Ve)};oe(Y,Oe=>{n(L),b(()=>n(L).issue)&&Oe(he)})}var Rs=h(Y,2);{var z=Oe=>{var Ve=Gc(),$t=_(Ve);V(()=>x($t,(n(L),b(()=>n(L).suggestion)))),j(Oe,Ve)};oe(Rs,Oe=>{n(L),b(()=>n(L).suggestion)&&Oe(z)})}V((Oe,Ve)=>{x(ns,(n(L),b(()=>n(L).source==="ci"?"CI":"Hook"))),x(Lt,Oe),x(Pt,(n(L),b(()=>n(L).rule))),x(B,Ve)},[()=>(n(L),b(()=>ts(n(L).timestamp))),()=>(n(L),b(()=>rs(n(L),n(L).file||"staged diff")))]),j(ve,k)}),V(()=>x(K,`${n(v),b(()=>n(v).length)??""} in 24h`)),j(l,d)};oe(Rn,l=>{n(v),b(()=>n(v).length>0)&&l(kl)})}var Sl=h(Rn,2),Cn=_(Sl),Tl=h(_(Cn),2),Al=_(Tl),Ys=h(Cn,2),Nn=_(Ys),Gs=_(Nn),Js=_(Gs);Js.value=Js.__value="rule";var Qs=h(Js);Qs.value=Qs.__value="decision";var Xs=h(Qs);Xs.value=Xs.__value="pattern";var Mn=h(Xs);Mn.value=Mn.__value="ignore";var Dn=h(Gs,2),Zs=_(Dn);Zs.value=Zs.__value="project";var On=h(Zs);On.value=On.__value="global";var In=h(Nn,2),Fn=h(In,2),Ln=_(Fn),Rl=h(Ln,2),Pn=h(Fn,2),Cl=_(Pn),jn=h(Ys,2),er=_(jn),tr=_(er);tr.value=tr.__value="all";var sr=h(tr);sr.value=sr.__value="rule";var rr=h(sr);rr.value=rr.__value="decision";var nr=h(rr);nr.value=nr.__value="pattern";var $n=h(nr);$n.value=$n.__value="ignore";var Nl=h(er,2),Ml=h(jn,2);Wt(Ml,5,()=>n(s),l=>l.id,(l,d)=>{var A=Zc(),N=_(A),K=_(N),ie=_(K),ve=_(ie),L=h(ie,2),k=_(L),q=h(K,2),Qe=_(q),ns=h(q,2);{var as=Ue=>{var Pt=Xc(),jt=_(Pt);V(()=>x(jt,(n(d),b(()=>n(d).reason)))),j(Ue,Pt)};oe(ns,Ue=>{n(d),b(()=>n(d).reason)&&Ue(as)})}var Lt=h(N,2);V(Ue=>{x(ve,(n(d),b(()=>n(d).scope))),x(k,`Rule-${Ue??""}`),x(Qe,(n(d),b(()=>n(d).content))),yc(Lt,"aria-label",(n(d),b(()=>`Delete ${n(d).id}`)))},[()=>(n(d),b(()=>String(n(d).id).padStart(3,"0")))]),ta("click",Lt,()=>ri(n(d).id)),j(l,A)},l=>{var d=ef();j(l,d)}),V((l,d,A)=>{var N,K,ie,ve,L;Vr=os(Ks,1,"status-chip svelte-d3ct2b",null,Vr,{live:n(y).live}),x(ai,` ${n(y),b(()=>n(y).label)??""}`),x(li,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.label)??"runtime pending"}))),Kr=os(Br,1,"live-label svelte-d3ct2b",null,Kr,{live:n(y).live}),x(fi,(n(y),b(()=>n(y).label))),x(di,n(u)),x(_i,n(p)),x(bi,n(g)),x(wi,(n(o),b(()=>{var k;return(k=n(o).runtime)!=null&&k.project.initialized?"Initialized":"Not initialized"}))),x(ki,l),x(Ti,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.project.type)??"unknown"}))),x(Ri,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.project.language)??"unknown"}))),x(Ni,d),x(Di,(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(Li,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.label)??"pending"}))),x($i,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.provider)??"unknown"}))),x(qi,(n(o),b(()=>{var k,q,Qe;return((k=n(o).runtime)==null?void 0:k.model.checkModelResolved)??((q=n(o).runtime)==null?void 0:q.model.checkModel)??((Qe=n(o).runtime)==null?void 0:Qe.model.chatModel)??"unknown"}))),un=os(fn,1,"svelte-d3ct2b",null,un,{"status-ok":((N=n(o).runtime)==null?void 0:N.model.checkModelInstalled)||((K=n(o).runtime)==null?void 0:K.model.apiKeyConfigured),"status-warn":((ie=n(o).runtime)==null?void 0:ie.model.checkModelInstalled)===!1||((ve=n(o).runtime)==null?void 0:ve.model.error)}),x(Bi,(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(Gi,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.model.ollamaUrl)??"unknown"}))),_n=os(pn,1,"svelte-d3ct2b",null,_n,{success:(L=n(o).runtime)==null?void 0:L.postgres.connected}),x(Qi,(n(o),b(()=>{var k;return(k=n(o).runtime)!=null&&k.postgres.connected?"Connected":"Not connected"}))),x(el,(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(sl,(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(nl,`${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(ll,(n(o),b(()=>{var k;return((k=n(o).runtime)==null?void 0:k.postgres.url)??"(not set)"}))),x(bl,n(a)),x(yl,n(u)),x(xl,n(i)),x(Al,`${n(g)??""} rules active`),Pn.disabled=A,x(Cl,n(P)?"Saving...":"Add New Architecture Rule")},[()=>b(nt),()=>b(ue),()=>(n(P),n(F),b(()=>n(P)||!n(F).content.trim()))]),or(Gs,()=>n(F).type,l=>is(F,n(F).type=l)),or(Dn,()=>n(F).scope,l=>is(F,n(F).scope=l)),Ms(In,()=>n(F).content,l=>is(F,n(F).content=l)),Ms(Ln,()=>n(F).reason,l=>is(F,n(F).reason=l)),Ms(Rl,()=>n(F).tags,l=>is(F,n(F).tags=l)),ta("submit",Ys,xc(si)),or(er,()=>n(R),l=>M(R,l)),Ms(Nl,()=>n($),l=>M($,l)),j(e,qr),wa()}oc(sf,{target:document.getElementById("app")});