@flanksource/clicky-ui 0.3.73 → 0.3.74

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.
@@ -55,7 +55,51 @@ function diffLines(a, b) {
55
55
  });
56
56
  return out;
57
57
  }
58
- var HUNK_HEADER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
58
+ var HUNK_HEADER = /^(@@+) ((?:-\d+(?:,\d+)? )+)\+(\d+)(?:,(\d+))? \1(?: |$)/;
59
+ var RANGE = /-(\d+)(?:,(\d+))?/g;
60
+ function openHunk(raw, path) {
61
+ const match = HUNK_HEADER.exec(raw);
62
+ const ranges = match ? Array.from(match[2].matchAll(RANGE)) : [];
63
+ if (!match || ranges.length !== match[1].length - 1) throw new Error(`Malformed unified diff hunk header: ${raw}`);
64
+ return {
65
+ hunk: {
66
+ header: raw,
67
+ lines: [],
68
+ ...path ? { path } : {}
69
+ },
70
+ parents: ranges.map((r) => Number(r[1])),
71
+ parentRemaining: ranges.map((r) => r[2] ? Number(r[2]) : 1),
72
+ result: Number(match[3]),
73
+ resultRemaining: match[4] ? Number(match[4]) : 1
74
+ };
75
+ }
76
+ function appendLine(state, raw) {
77
+ const width = state.parents.length;
78
+ const prefix = raw.slice(0, width).padEnd(width, " ");
79
+ const content = raw.slice(width);
80
+ const removed = prefix.includes("-");
81
+ const type = removed ? "remove" : prefix.includes("+") ? "add" : "context";
82
+ const inParent = [...prefix].map((column) => column === "-" || !removed && column === " ");
83
+ const line = {
84
+ type,
85
+ content
86
+ };
87
+ if (inParent[0] && type !== "add") line.oldNumber = state.parents[0];
88
+ if (!removed) line.newNumber = state.result;
89
+ state.hunk.lines.push(line);
90
+ inParent.forEach((present, i) => {
91
+ if (!present) return;
92
+ state.parents[i]++;
93
+ state.parentRemaining[i]--;
94
+ });
95
+ if (!removed) {
96
+ state.result++;
97
+ state.resultRemaining--;
98
+ }
99
+ }
100
+ function hunkComplete(state) {
101
+ return state.resultRemaining <= 0 && state.parentRemaining.every((n) => n <= 0);
102
+ }
59
103
  function gitHeaderPath(token) {
60
104
  const path = token.split(" ")[0].trim();
61
105
  if (path === "" || path === "/dev/null") return void 0;
@@ -64,61 +108,23 @@ function gitHeaderPath(token) {
64
108
  function parseUnifiedDiff(diff) {
65
109
  const hunks = [];
66
110
  let current = null;
67
- let oldNo = 0;
68
- let newNo = 0;
69
- let oldRemaining = 0;
70
- let newRemaining = 0;
71
111
  let path;
72
112
  let oldPath;
73
113
  const body = diff.endsWith("\n") ? diff.slice(0, -1) : diff;
74
114
  for (const raw of body.split("\n")) {
75
115
  if (current) {
76
116
  if (raw.startsWith("\\")) continue;
77
- if (raw.startsWith("+")) {
78
- current.lines.push({
79
- type: "add",
80
- content: raw.slice(1),
81
- newNumber: newNo++
82
- });
83
- newRemaining--;
84
- } else if (raw.startsWith("-")) {
85
- current.lines.push({
86
- type: "remove",
87
- content: raw.slice(1),
88
- oldNumber: oldNo++
89
- });
90
- oldRemaining--;
91
- } else {
92
- const content = raw.startsWith(" ") ? raw.slice(1) : raw;
93
- current.lines.push({
94
- type: "context",
95
- content,
96
- oldNumber: oldNo++,
97
- newNumber: newNo++
98
- });
99
- oldRemaining--;
100
- newRemaining--;
101
- }
102
- if (oldRemaining <= 0 && newRemaining <= 0) current = null;
117
+ appendLine(current, raw);
118
+ if (hunkComplete(current)) current = null;
103
119
  continue;
104
120
  }
105
121
  if (raw.startsWith("@@")) {
106
- const match = HUNK_HEADER.exec(raw);
107
- if (!match) throw new Error(`Malformed unified diff hunk header: ${raw}`);
108
- oldNo = Number(match[1]);
109
- newNo = Number(match[3]);
110
- oldRemaining = match[2] ? Number(match[2]) : 1;
111
- newRemaining = match[4] ? Number(match[4]) : 1;
112
- current = {
113
- header: raw,
114
- lines: [],
115
- ...path ? { path } : {}
116
- };
117
- hunks.push(current);
118
- if (oldRemaining <= 0 && newRemaining <= 0) current = null;
122
+ current = openHunk(raw, path);
123
+ hunks.push(current.hunk);
124
+ if (hunkComplete(current)) current = null;
119
125
  continue;
120
126
  }
121
- if (raw.startsWith("diff --git ")) {
127
+ if (raw.startsWith("diff --git ") || raw.startsWith("diff --cc ") || raw.startsWith("diff --combined ")) {
122
128
  path = void 0;
123
129
  oldPath = void 0;
124
130
  } else if (raw.startsWith("--- ")) oldPath = gitHeaderPath(raw.slice(4));
@@ -1 +1 @@
1
- {"version":3,"file":"code-diff.cjs","names":[],"sources":["../../src/data/code-diff.ts"],"sourcesContent":["// Pure, React-free diff model shared by `CodeDiff`. Two producers normalize to\n// the same `DiffHunk[]` row model: `computeLineDiff` (LCS over two blobs) and\n// `parseUnifiedDiff` (git-style `@@` hunks). Kept dependency-free — the repo has\n// no diff library and code blocks are small enough for an O(n·m) LCS.\n\nexport type DiffLineType = \"context\" | \"add\" | \"remove\";\n\nexport type DiffLine = {\n type: DiffLineType;\n /** Line text with no trailing newline. */\n content: string;\n /** 1-based line number on the old side — present for `context` and `remove`. */\n oldNumber?: number;\n /** 1-based line number on the new side — present for `context` and `add`. */\n newNumber?: number;\n};\n\nexport type DiffHunk = {\n /** The raw `@@ … @@` header for parsed diffs; absent for computed diffs. */\n header?: string;\n /** The file this hunk belongs to, from a multi-file unified diff's headers. */\n path?: string;\n lines: DiffLine[];\n};\n\n// Strip a single trailing newline before splitting so line counts match Shiki's\n// per-line tokens (Shiki drops one trailing newline). An empty blob is zero\n// lines, not one empty line.\nfunction splitLines(text: string): string[] {\n if (text === \"\") return [];\n const normalized = text.endsWith(\"\\n\") ? text.slice(0, -1) : text;\n return normalized.split(\"\\n\");\n}\n\n// Longest-common-subsequence line diff. Returns a single hunk covering the whole\n// blob (or no hunks when both sides are empty).\nexport function computeLineDiff(original: string, modified: string): DiffHunk[] {\n const a = splitLines(original);\n const b = splitLines(modified);\n const lines = diffLines(a, b);\n return lines.length > 0 ? [{ lines }] : [];\n}\n\nfunction diffLines(a: string[], b: string[]): DiffLine[] {\n const n = a.length;\n const m = b.length;\n const width = m + 1;\n // lcs table: `at(i, j)` = LCS length of a[i:] and b[j:]. Every access is\n // in-bounds by construction (the `!` is safe), so `at` reads as a plain number.\n const lcs = new Int32Array((n + 1) * width);\n const at = (row: number, col: number): number => lcs[row * width + col]!;\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n lcs[i * width + j] =\n a[i] === b[j] ? at(i + 1, j + 1) + 1 : Math.max(at(i + 1, j), at(i, j + 1));\n }\n }\n\n const out: DiffLine[] = [];\n let i = 0;\n let j = 0;\n let oldNo = 1;\n let newNo = 1;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n out.push({ type: \"context\", content: a[i]!, oldNumber: oldNo++, newNumber: newNo++ });\n i++;\n j++;\n } else if (at(i + 1, j) >= at(i, j + 1)) {\n out.push({ type: \"remove\", content: a[i]!, oldNumber: oldNo++ });\n i++;\n } else {\n out.push({ type: \"add\", content: b[j]!, newNumber: newNo++ });\n j++;\n }\n }\n while (i < n) out.push({ type: \"remove\", content: a[i++]!, oldNumber: oldNo++ });\n while (j < m) out.push({ type: \"add\", content: b[j++]!, newNumber: newNo++ });\n return out;\n}\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/;\n\n// Strip the `a/`|`b/` prefix (and any trailing tab-timestamp) from a `---`/`+++`\n// header path; `/dev/null` (add/delete) has no path.\nfunction gitHeaderPath(token: string): string | undefined {\n const path = token.split(\"\\t\")[0]!.trim();\n if (path === \"\" || path === \"/dev/null\") return undefined;\n return path.startsWith(\"a/\") || path.startsWith(\"b/\") ? path.slice(2) : path;\n}\n\n// Parse a unified-diff string. `@@ -a,b +c,d @@` headers drive line numbers and\n// hunk lengths; `+`/`-`/space lines become add/remove/context. Each hunk records\n// the file `path` from the enclosing `diff --git`/`---`/`+++` headers, so a\n// multi-file diff keeps its file boundaries. A line that starts with `@@` but is\n// not a valid hunk header throws rather than being dropped.\nexport function parseUnifiedDiff(diff: string): DiffHunk[] {\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n let oldNo = 0;\n let newNo = 0;\n let oldRemaining = 0;\n let newRemaining = 0;\n let path: string | undefined;\n let oldPath: string | undefined;\n\n const body = diff.endsWith(\"\\n\") ? diff.slice(0, -1) : diff;\n for (const raw of body.split(\"\\n\")) {\n // While a hunk is open, every line is content until its declared line counts\n // are exhausted — so a `+++ …` content line is never read as a file header.\n if (current) {\n if (raw.startsWith(\"\\\\\")) continue; // \"\\"\n if (raw.startsWith(\"+\")) {\n current.lines.push({ type: \"add\", content: raw.slice(1), newNumber: newNo++ });\n newRemaining--;\n } else if (raw.startsWith(\"-\")) {\n current.lines.push({ type: \"remove\", content: raw.slice(1), oldNumber: oldNo++ });\n oldRemaining--;\n } else {\n const content = raw.startsWith(\" \") ? raw.slice(1) : raw;\n current.lines.push({ type: \"context\", content, oldNumber: oldNo++, newNumber: newNo++ });\n oldRemaining--;\n newRemaining--;\n }\n if (oldRemaining <= 0 && newRemaining <= 0) current = null;\n continue;\n }\n\n if (raw.startsWith(\"@@\")) {\n const match = HUNK_HEADER.exec(raw);\n if (!match) throw new Error(`Malformed unified diff hunk header: ${raw}`);\n oldNo = Number(match[1]);\n newNo = Number(match[3]);\n oldRemaining = match[2] ? Number(match[2]) : 1;\n newRemaining = match[4] ? Number(match[4]) : 1;\n current = { header: raw, lines: [], ...(path ? { path } : {}) };\n hunks.push(current);\n if (oldRemaining <= 0 && newRemaining <= 0) current = null;\n continue;\n }\n if (raw.startsWith(\"diff --git \")) {\n path = undefined;\n oldPath = undefined;\n } else if (raw.startsWith(\"--- \")) {\n oldPath = gitHeaderPath(raw.slice(4));\n } else if (raw.startsWith(\"+++ \")) {\n path = gitHeaderPath(raw.slice(4)) ?? oldPath;\n }\n // `index`, mode, and similar metadata lines carry no path — ignored.\n }\n return hunks;\n}\n"],"mappings":";AA4BA,SAAS,WAAW,MAAwB;CAC1C,IAAI,SAAS,IAAI,OAAO,CAAC;CAEzB,QADmB,KAAK,SAAS,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CAAC;IACvF;IACA;GACF;GACA,IAAI,gBAAgB,KAAK,gBAAgB,GAAG,UAAU;GACtD;EACF;EAEA,IAAI,IAAI,WAAW,IAAI,GAAG;GACxB,MAAM,QAAQ,YAAY,KAAK,GAAG;GAClC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,uCAAuC,KAAK;GACxE,QAAQ,OAAO,MAAM,EAAE;GACvB,QAAQ,OAAO,MAAM,EAAE;GACvB,eAAe,MAAM,KAAK,OAAO,MAAM,EAAE,IAAI;GAC7C,eAAe,MAAM,KAAK,OAAO,MAAM,EAAE,IAAI;GAC7C,UAAU;IAAE,QAAQ;IAAK,OAAO,CAAC;IAAG,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;GAAG;GAC9D,MAAM,KAAK,OAAO;GAClB,IAAI,gBAAgB,KAAK,gBAAgB,GAAG,UAAU;GACtD;EACF;EACA,IAAI,IAAI,WAAW,aAAa,GAAG;GACjC,OAAO,KAAA;GACP,UAAU,KAAA;EACZ,OAAO,IAAI,IAAI,WAAW,MAAM,GAC9B,UAAU,cAAc,IAAI,MAAM,CAAC,CAAC;OAC/B,IAAI,IAAI,WAAW,MAAM,GAC9B,OAAO,cAAc,IAAI,MAAM,CAAC,CAAC,KAAK;CAG1C;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"code-diff.cjs","names":[],"sources":["../../src/data/code-diff.ts"],"sourcesContent":["// Pure, React-free diff model shared by `CodeDiff`. Two producers normalize to\n// the same `DiffHunk[]` row model: `computeLineDiff` (LCS over two blobs) and\n// `parseUnifiedDiff` (git-style `@@` hunks). Kept dependency-free — the repo has\n// no diff library and code blocks are small enough for an O(n·m) LCS.\n\nexport type DiffLineType = \"context\" | \"add\" | \"remove\";\n\nexport type DiffLine = {\n type: DiffLineType;\n /** Line text with no trailing newline. */\n content: string;\n /** 1-based line number on the old side — present for `context` and `remove`. */\n oldNumber?: number;\n /** 1-based line number on the new side — present for `context` and `add`. */\n newNumber?: number;\n};\n\nexport type DiffHunk = {\n /** The raw `@@ … @@` header for parsed diffs; absent for computed diffs. */\n header?: string;\n /** The file this hunk belongs to, from a multi-file unified diff's headers. */\n path?: string;\n lines: DiffLine[];\n};\n\n// Strip a single trailing newline before splitting so line counts match Shiki's\n// per-line tokens (Shiki drops one trailing newline). An empty blob is zero\n// lines, not one empty line.\nfunction splitLines(text: string): string[] {\n if (text === \"\") return [];\n const normalized = text.endsWith(\"\\n\") ? text.slice(0, -1) : text;\n return normalized.split(\"\\n\");\n}\n\n// Longest-common-subsequence line diff. Returns a single hunk covering the whole\n// blob (or no hunks when both sides are empty).\nexport function computeLineDiff(original: string, modified: string): DiffHunk[] {\n const a = splitLines(original);\n const b = splitLines(modified);\n const lines = diffLines(a, b);\n return lines.length > 0 ? [{ lines }] : [];\n}\n\nfunction diffLines(a: string[], b: string[]): DiffLine[] {\n const n = a.length;\n const m = b.length;\n const width = m + 1;\n // lcs table: `at(i, j)` = LCS length of a[i:] and b[j:]. Every access is\n // in-bounds by construction (the `!` is safe), so `at` reads as a plain number.\n const lcs = new Int32Array((n + 1) * width);\n const at = (row: number, col: number): number => lcs[row * width + col]!;\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n lcs[i * width + j] =\n a[i] === b[j] ? at(i + 1, j + 1) + 1 : Math.max(at(i + 1, j), at(i, j + 1));\n }\n }\n\n const out: DiffLine[] = [];\n let i = 0;\n let j = 0;\n let oldNo = 1;\n let newNo = 1;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n out.push({ type: \"context\", content: a[i]!, oldNumber: oldNo++, newNumber: newNo++ });\n i++;\n j++;\n } else if (at(i + 1, j) >= at(i, j + 1)) {\n out.push({ type: \"remove\", content: a[i]!, oldNumber: oldNo++ });\n i++;\n } else {\n out.push({ type: \"add\", content: b[j]!, newNumber: newNo++ });\n j++;\n }\n }\n while (i < n) out.push({ type: \"remove\", content: a[i++]!, oldNumber: oldNo++ });\n while (j < m) out.push({ type: \"add\", content: b[j++]!, newNumber: newNo++ });\n return out;\n}\n\n// `@@ -a,b +c,d @@` for a two-way diff; a combined diff (`diff --cc`, e.g. a\n// conflicted file) opens one more `@` and adds one `-a,b` range per parent.\nconst HUNK_HEADER = /^(@@+) ((?:-\\d+(?:,\\d+)? )+)\\+(\\d+)(?:,(\\d+))? \\1(?: |$)/;\nconst RANGE = /-(\\d+)(?:,(\\d+))?/g;\n\ntype HunkState = {\n hunk: DiffHunk;\n /** Next line number per parent (index 0 is the old side) and of the result. */\n parents: number[];\n result: number;\n /** Lines still owed per parent and by the result. */\n parentRemaining: number[];\n resultRemaining: number;\n};\n\nfunction openHunk(raw: string, path: string | undefined): HunkState {\n const match = HUNK_HEADER.exec(raw);\n const ranges = match ? Array.from(match[2]!.matchAll(RANGE)) : [];\n if (!match || ranges.length !== match[1]!.length - 1) {\n throw new Error(`Malformed unified diff hunk header: ${raw}`);\n }\n return {\n hunk: { header: raw, lines: [], ...(path ? { path } : {}) },\n parents: ranges.map((r) => Number(r[1])),\n parentRemaining: ranges.map((r) => (r[2] ? Number(r[2]) : 1)),\n result: Number(match[3]),\n resultRemaining: match[4] ? Number(match[4]) : 1,\n };\n}\n\n// One content line: a prefix column per parent, then the text. Following\n// git's colouring, a `-` in any column is a removal and otherwise a `+` in any\n// column is an addition. A line belongs to parent N when its column is `-`, or\n// is a space on a line with no `-` at all; it belongs to the result unless some\n// column is `-`. Numbers are reported for the first parent and the result.\nfunction appendLine(state: HunkState, raw: string) {\n const width = state.parents.length;\n const prefix = raw.slice(0, width).padEnd(width, \" \");\n const content = raw.slice(width);\n const removed = prefix.includes(\"-\");\n const type: DiffLineType = removed ? \"remove\" : prefix.includes(\"+\") ? \"add\" : \"context\";\n const inParent = [...prefix].map((column) => column === \"-\" || (!removed && column === \" \"));\n const line: DiffLine = { type, content };\n if (inParent[0] && type !== \"add\") line.oldNumber = state.parents[0]!;\n if (!removed) line.newNumber = state.result;\n state.hunk.lines.push(line);\n inParent.forEach((present, i) => {\n if (!present) return;\n state.parents[i]!++;\n state.parentRemaining[i]!--;\n });\n if (!removed) {\n state.result++;\n state.resultRemaining--;\n }\n}\n\nfunction hunkComplete(state: HunkState): boolean {\n return state.resultRemaining <= 0 && state.parentRemaining.every((n) => n <= 0);\n}\n\n// Strip the `a/`|`b/` prefix (and any trailing tab-timestamp) from a `---`/`+++`\n// header path; `/dev/null` (add/delete) has no path.\nfunction gitHeaderPath(token: string): string | undefined {\n const path = token.split(\"\\t\")[0]!.trim();\n if (path === \"\" || path === \"/dev/null\") return undefined;\n return path.startsWith(\"a/\") || path.startsWith(\"b/\") ? path.slice(2) : path;\n}\n\n// Parse a unified-diff string, including git's combined format (`diff --cc`,\n// `@@@` headers) for conflicted files and merges. Hunk headers drive line\n// numbers and hunk lengths; `+`/`-`/space prefixes become add/remove/context.\n// Each hunk records the file `path` from the enclosing `diff --git`/`---`/`+++`\n// headers, so a multi-file diff keeps its file boundaries. A line that starts\n// with `@@` but is not a valid hunk header throws rather than being dropped.\nexport function parseUnifiedDiff(diff: string): DiffHunk[] {\n const hunks: DiffHunk[] = [];\n let current: HunkState | null = null;\n let path: string | undefined;\n let oldPath: string | undefined;\n\n const body = diff.endsWith(\"\\n\") ? diff.slice(0, -1) : diff;\n for (const raw of body.split(\"\\n\")) {\n // While a hunk is open, every line is content until its declared line counts\n // are exhausted — so a `+++ …` content line is never read as a file header.\n if (current) {\n if (raw.startsWith(\"\\\\\")) continue; // \"\\"\n appendLine(current, raw);\n if (hunkComplete(current)) current = null;\n continue;\n }\n\n if (raw.startsWith(\"@@\")) {\n current = openHunk(raw, path);\n hunks.push(current.hunk);\n if (hunkComplete(current)) current = null;\n continue;\n }\n if (raw.startsWith(\"diff --git \") || raw.startsWith(\"diff --cc \") || raw.startsWith(\"diff --combined \")) {\n path = undefined;\n oldPath = undefined;\n } else if (raw.startsWith(\"--- \")) {\n oldPath = gitHeaderPath(raw.slice(4));\n } else if (raw.startsWith(\"+++ \")) {\n path = gitHeaderPath(raw.slice(4)) ?? o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,KAAK,QAAQ,IAAI;GACvB,IAAI,aAAa,OAAO,GAAG,UAAU;GACrC;EACF;EACA,IAAI,IAAI,WAAW,aAAa,KAAK,IAAI,WAAW,YAAY,KAAK,IAAI,WAAW,kBAAkB,GAAG;GACvG,OAAO,KAAA;GACP,UAAU,KAAA;EACZ,OAAO,IAAI,IAAI,WAAW,MAAM,GAC9B,UAAU,cAAc,IAAI,MAAM,CAAC,CAAC;OAC/B,IAAI,IAAI,WAAW,MAAM,GAC9B,OAAO,cAAc,IAAI,MAAM,CAAC,CAAC,KAAK;CAG1C;CACA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"code-diff.d.ts","sourceRoot":"","sources":["../../src/data/code-diff.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,YAAY,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAaF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAK9E;AAuDD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAuDzD"}
1
+ {"version":3,"file":"code-diff.d.ts","sourceRoot":"","sources":["../../src/data/code-diff.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,YAAY,CAAC;IACnB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAaF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAK9E;AAmHD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAkCzD"}
@@ -55,7 +55,51 @@ function diffLines(a, b) {
55
55
  });
56
56
  return out;
57
57
  }
58
- var HUNK_HEADER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
58
+ var HUNK_HEADER = /^(@@+) ((?:-\d+(?:,\d+)? )+)\+(\d+)(?:,(\d+))? \1(?: |$)/;
59
+ var RANGE = /-(\d+)(?:,(\d+))?/g;
60
+ function openHunk(raw, path) {
61
+ const match = HUNK_HEADER.exec(raw);
62
+ const ranges = match ? Array.from(match[2].matchAll(RANGE)) : [];
63
+ if (!match || ranges.length !== match[1].length - 1) throw new Error(`Malformed unified diff hunk header: ${raw}`);
64
+ return {
65
+ hunk: {
66
+ header: raw,
67
+ lines: [],
68
+ ...path ? { path } : {}
69
+ },
70
+ parents: ranges.map((r) => Number(r[1])),
71
+ parentRemaining: ranges.map((r) => r[2] ? Number(r[2]) : 1),
72
+ result: Number(match[3]),
73
+ resultRemaining: match[4] ? Number(match[4]) : 1
74
+ };
75
+ }
76
+ function appendLine(state, raw) {
77
+ const width = state.parents.length;
78
+ const prefix = raw.slice(0, width).padEnd(width, " ");
79
+ const content = raw.slice(width);
80
+ const removed = prefix.includes("-");
81
+ const type = removed ? "remove" : prefix.includes("+") ? "add" : "context";
82
+ const inParent = [...prefix].map((column) => column === "-" || !removed && column === " ");
83
+ const line = {
84
+ type,
85
+ content
86
+ };
87
+ if (inParent[0] && type !== "add") line.oldNumber = state.parents[0];
88
+ if (!removed) line.newNumber = state.result;
89
+ state.hunk.lines.push(line);
90
+ inParent.forEach((present, i) => {
91
+ if (!present) return;
92
+ state.parents[i]++;
93
+ state.parentRemaining[i]--;
94
+ });
95
+ if (!removed) {
96
+ state.result++;
97
+ state.resultRemaining--;
98
+ }
99
+ }
100
+ function hunkComplete(state) {
101
+ return state.resultRemaining <= 0 && state.parentRemaining.every((n) => n <= 0);
102
+ }
59
103
  function gitHeaderPath(token) {
60
104
  const path = token.split(" ")[0].trim();
61
105
  if (path === "" || path === "/dev/null") return void 0;
@@ -64,61 +108,23 @@ function gitHeaderPath(token) {
64
108
  function parseUnifiedDiff(diff) {
65
109
  const hunks = [];
66
110
  let current = null;
67
- let oldNo = 0;
68
- let newNo = 0;
69
- let oldRemaining = 0;
70
- let newRemaining = 0;
71
111
  let path;
72
112
  let oldPath;
73
113
  const body = diff.endsWith("\n") ? diff.slice(0, -1) : diff;
74
114
  for (const raw of body.split("\n")) {
75
115
  if (current) {
76
116
  if (raw.startsWith("\\")) continue;
77
- if (raw.startsWith("+")) {
78
- current.lines.push({
79
- type: "add",
80
- content: raw.slice(1),
81
- newNumber: newNo++
82
- });
83
- newRemaining--;
84
- } else if (raw.startsWith("-")) {
85
- current.lines.push({
86
- type: "remove",
87
- content: raw.slice(1),
88
- oldNumber: oldNo++
89
- });
90
- oldRemaining--;
91
- } else {
92
- const content = raw.startsWith(" ") ? raw.slice(1) : raw;
93
- current.lines.push({
94
- type: "context",
95
- content,
96
- oldNumber: oldNo++,
97
- newNumber: newNo++
98
- });
99
- oldRemaining--;
100
- newRemaining--;
101
- }
102
- if (oldRemaining <= 0 && newRemaining <= 0) current = null;
117
+ appendLine(current, raw);
118
+ if (hunkComplete(current)) current = null;
103
119
  continue;
104
120
  }
105
121
  if (raw.startsWith("@@")) {
106
- const match = HUNK_HEADER.exec(raw);
107
- if (!match) throw new Error(`Malformed unified diff hunk header: ${raw}`);
108
- oldNo = Number(match[1]);
109
- newNo = Number(match[3]);
110
- oldRemaining = match[2] ? Number(match[2]) : 1;
111
- newRemaining = match[4] ? Number(match[4]) : 1;
112
- current = {
113
- header: raw,
114
- lines: [],
115
- ...path ? { path } : {}
116
- };
117
- hunks.push(current);
118
- if (oldRemaining <= 0 && newRemaining <= 0) current = null;
122
+ current = openHunk(raw, path);
123
+ hunks.push(current.hunk);
124
+ if (hunkComplete(current)) current = null;
119
125
  continue;
120
126
  }
121
- if (raw.startsWith("diff --git ")) {
127
+ if (raw.startsWith("diff --git ") || raw.startsWith("diff --cc ") || raw.startsWith("diff --combined ")) {
122
128
  path = void 0;
123
129
  oldPath = void 0;
124
130
  } else if (raw.startsWith("--- ")) oldPath = gitHeaderPath(raw.slice(4));
@@ -1 +1 @@
1
- {"version":3,"file":"code-diff.js","names":[],"sources":["../../src/data/code-diff.ts"],"sourcesContent":["// Pure, React-free diff model shared by `CodeDiff`. Two producers normalize to\n// the same `DiffHunk[]` row model: `computeLineDiff` (LCS over two blobs) and\n// `parseUnifiedDiff` (git-style `@@` hunks). Kept dependency-free — the repo has\n// no diff library and code blocks are small enough for an O(n·m) LCS.\n\nexport type DiffLineType = \"context\" | \"add\" | \"remove\";\n\nexport type DiffLine = {\n type: DiffLineType;\n /** Line text with no trailing newline. */\n content: string;\n /** 1-based line number on the old side — present for `context` and `remove`. */\n oldNumber?: number;\n /** 1-based line number on the new side — present for `context` and `add`. */\n newNumber?: number;\n};\n\nexport type DiffHunk = {\n /** The raw `@@ … @@` header for parsed diffs; absent for computed diffs. */\n header?: string;\n /** The file this hunk belongs to, from a multi-file unified diff's headers. */\n path?: string;\n lines: DiffLine[];\n};\n\n// Strip a single trailing newline before splitting so line counts match Shiki's\n// per-line tokens (Shiki drops one trailing newline). An empty blob is zero\n// lines, not one empty line.\nfunction splitLines(text: string): string[] {\n if (text === \"\") return [];\n const normalized = text.endsWith(\"\\n\") ? text.slice(0, -1) : text;\n return normalized.split(\"\\n\");\n}\n\n// Longest-common-subsequence line diff. Returns a single hunk covering the whole\n// blob (or no hunks when both sides are empty).\nexport function computeLineDiff(original: string, modified: string): DiffHunk[] {\n const a = splitLines(original);\n const b = splitLines(modified);\n const lines = diffLines(a, b);\n return lines.length > 0 ? [{ lines }] : [];\n}\n\nfunction diffLines(a: string[], b: string[]): DiffLine[] {\n const n = a.length;\n const m = b.length;\n const width = m + 1;\n // lcs table: `at(i, j)` = LCS length of a[i:] and b[j:]. Every access is\n // in-bounds by construction (the `!` is safe), so `at` reads as a plain number.\n const lcs = new Int32Array((n + 1) * width);\n const at = (row: number, col: number): number => lcs[row * width + col]!;\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n lcs[i * width + j] =\n a[i] === b[j] ? at(i + 1, j + 1) + 1 : Math.max(at(i + 1, j), at(i, j + 1));\n }\n }\n\n const out: DiffLine[] = [];\n let i = 0;\n let j = 0;\n let oldNo = 1;\n let newNo = 1;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n out.push({ type: \"context\", content: a[i]!, oldNumber: oldNo++, newNumber: newNo++ });\n i++;\n j++;\n } else if (at(i + 1, j) >= at(i, j + 1)) {\n out.push({ type: \"remove\", content: a[i]!, oldNumber: oldNo++ });\n i++;\n } else {\n out.push({ type: \"add\", content: b[j]!, newNumber: newNo++ });\n j++;\n }\n }\n while (i < n) out.push({ type: \"remove\", content: a[i++]!, oldNumber: oldNo++ });\n while (j < m) out.push({ type: \"add\", content: b[j++]!, newNumber: newNo++ });\n return out;\n}\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,(\\d+))? \\+(\\d+)(?:,(\\d+))? @@/;\n\n// Strip the `a/`|`b/` prefix (and any trailing tab-timestamp) from a `---`/`+++`\n// header path; `/dev/null` (add/delete) has no path.\nfunction gitHeaderPath(token: string): string | undefined {\n const path = token.split(\"\\t\")[0]!.trim();\n if (path === \"\" || path === \"/dev/null\") return undefined;\n return path.startsWith(\"a/\") || path.startsWith(\"b/\") ? path.slice(2) : path;\n}\n\n// Parse a unified-diff string. `@@ -a,b +c,d @@` headers drive line numbers and\n// hunk lengths; `+`/`-`/space lines become add/remove/context. Each hunk records\n// the file `path` from the enclosing `diff --git`/`---`/`+++` headers, so a\n// multi-file diff keeps its file boundaries. A line that starts with `@@` but is\n// not a valid hunk header throws rather than being dropped.\nexport function parseUnifiedDiff(diff: string): DiffHunk[] {\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n let oldNo = 0;\n let newNo = 0;\n let oldRemaining = 0;\n let newRemaining = 0;\n let path: string | undefined;\n let oldPath: string | undefined;\n\n const body = diff.endsWith(\"\\n\") ? diff.slice(0, -1) : diff;\n for (const raw of body.split(\"\\n\")) {\n // While a hunk is open, every line is content until its declared line counts\n // are exhausted — so a `+++ …` content line is never read as a file header.\n if (current) {\n if (raw.startsWith(\"\\\\\")) continue; // \"\\"\n if (raw.startsWith(\"+\")) {\n current.lines.push({ type: \"add\", content: raw.slice(1), newNumber: newNo++ });\n newRemaining--;\n } else if (raw.startsWith(\"-\")) {\n current.lines.push({ type: \"remove\", content: raw.slice(1), oldNumber: oldNo++ });\n oldRemaining--;\n } else {\n const content = raw.startsWith(\" \") ? raw.slice(1) : raw;\n current.lines.push({ type: \"context\", content, oldNumber: oldNo++, newNumber: newNo++ });\n oldRemaining--;\n newRemaining--;\n }\n if (oldRemaining <= 0 && newRemaining <= 0) current = null;\n continue;\n }\n\n if (raw.startsWith(\"@@\")) {\n const match = HUNK_HEADER.exec(raw);\n if (!match) throw new Error(`Malformed unified diff hunk header: ${raw}`);\n oldNo = Number(match[1]);\n newNo = Number(match[3]);\n oldRemaining = match[2] ? Number(match[2]) : 1;\n newRemaining = match[4] ? Number(match[4]) : 1;\n current = { header: raw, lines: [], ...(path ? { path } : {}) };\n hunks.push(current);\n if (oldRemaining <= 0 && newRemaining <= 0) current = null;\n continue;\n }\n if (raw.startsWith(\"diff --git \")) {\n path = undefined;\n oldPath = undefined;\n } else if (raw.startsWith(\"--- \")) {\n oldPath = gitHeaderPath(raw.slice(4));\n } else if (raw.startsWith(\"+++ \")) {\n path = gitHeaderPath(raw.slice(4)) ?? oldPath;\n }\n // `index`, mode, and similar metadata lines carry no path — ignored.\n }\n return hunks;\n}\n"],"mappings":";AA4BA,SAAS,WAAW,MAAwB;CAC1C,IAAI,SAAS,IAAI,OAAO,CAAC;CAEzB,QADmB,KAAK,SAAS,IAAI,IAAI,KAAK,MAAM,GAAG,EAAE,IAAI,KAAA,CAC3C,MAAM,IAAI;AAC9B;AAIA,SAAgB,gBAAgB,UAAkB,UAA8B;CAG9E,MAAM,QAAQ,UAFJ,WAAW,QAEG,GADd,WAAW,QACM,CAAC;CAC5B,OAAO,MAAM,SAAS,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;AAC3C;AAEA,SAAS,UAAU,GAAa,GAAyB;CACvD,MAAM,IAAI,EAAE;CACZ,MAAM,IAAI,EAAE;CACZ,MAAM,QAAQ,IAAI;CAGlB,MAAM,MAAM,IAAI,YAAY,IAAI,KAAK,KAAK;CAC1C,MAAM,MAAM,KAAa,QAAwB,IAAI,MAAM,QAAQ;CACnE,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,GAAG,KAC1B,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,GAAG,KAC1B,IAAI,IAAI,QAAQ,KACd,EAAE,OAAO,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;CAIhF,MAAM,MAAkB,CAAC;CACz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MAAM,CAAC,CAAC,KAAK;CAG1C;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"code-diff.js","names":[],"sources":["../../src/data/code-diff.ts"],"sourcesContent":["// Pure, React-free diff model shared by `CodeDiff`. Two producers normalize to\n// the same `DiffHunk[]` row model: `computeLineDiff` (LCS over two blobs) and\n// `parseUnifiedDiff` (git-style `@@` hunks). Kept dependency-free — the repo has\n// no diff library and code blocks are small enough for an O(n·m) LCS.\n\nexport type DiffLineType = \"context\" | \"add\" | \"remove\";\n\nexport type DiffLine = {\n type: DiffLineType;\n /** Line text with no trailing newline. */\n content: string;\n /** 1-based line number on the old side — present for `context` and `remove`. */\n oldNumber?: number;\n /** 1-based line number on the new side — present for `context` and `add`. */\n newNumber?: number;\n};\n\nexport type DiffHunk = {\n /** The raw `@@ … @@` header for parsed diffs; absent for computed diffs. */\n header?: string;\n /** The file this hunk belongs to, from a multi-file unified diff's headers. */\n path?: string;\n lines: DiffLine[];\n};\n\n// Strip a single trailing newline before splitting so line counts match Shiki's\n// per-line tokens (Shiki drops one trailing newline). An empty blob is zero\n// lines, not one empty line.\nfunction splitLines(text: string): string[] {\n if (text === \"\") return [];\n const normalized = text.endsWith(\"\\n\") ? text.slice(0, -1) : text;\n return normalized.split(\"\\n\");\n}\n\n// Longest-common-subsequence line diff. Returns a single hunk covering the whole\n// blob (or no hunks when both sides are empty).\nexport function computeLineDiff(original: string, modified: string): DiffHunk[] {\n const a = splitLines(original);\n const b = splitLines(modified);\n const lines = diffLines(a, b);\n return lines.length > 0 ? [{ lines }] : [];\n}\n\nfunction diffLines(a: string[], b: string[]): DiffLine[] {\n const n = a.length;\n const m = b.length;\n const width = m + 1;\n // lcs table: `at(i, j)` = LCS length of a[i:] and b[j:]. Every access is\n // in-bounds by construction (the `!` is safe), so `at` reads as a plain number.\n const lcs = new Int32Array((n + 1) * width);\n const at = (row: number, col: number): number => lcs[row * width + col]!;\n for (let i = n - 1; i >= 0; i--) {\n for (let j = m - 1; j >= 0; j--) {\n lcs[i * width + j] =\n a[i] === b[j] ? at(i + 1, j + 1) + 1 : Math.max(at(i + 1, j), at(i, j + 1));\n }\n }\n\n const out: DiffLine[] = [];\n let i = 0;\n let j = 0;\n let oldNo = 1;\n let newNo = 1;\n while (i < n && j < m) {\n if (a[i] === b[j]) {\n out.push({ type: \"context\", content: a[i]!, oldNumber: oldNo++, newNumber: newNo++ });\n i++;\n j++;\n } else if (at(i + 1, j) >= at(i, j + 1)) {\n out.push({ type: \"remove\", content: a[i]!, oldNumber: oldNo++ });\n i++;\n } else {\n out.push({ type: \"add\", content: b[j]!, newNumber: newNo++ });\n j++;\n }\n }\n while (i < n) out.push({ type: \"remove\", content: a[i++]!, oldNumber: oldNo++ });\n while (j < m) out.push({ type: \"add\", content: b[j++]!, newNumber: newNo++ });\n return out;\n}\n\n// `@@ -a,b +c,d @@` for a two-way diff; a combined diff (`diff --cc`, e.g. a\n// conflicted file) opens one more `@` and adds one `-a,b` range per parent.\nconst HUNK_HEADER = /^(@@+) ((?:-\\d+(?:,\\d+)? )+)\\+(\\d+)(?:,(\\d+))? \\1(?: |$)/;\nconst RANGE = /-(\\d+)(?:,(\\d+))?/g;\n\ntype HunkState = {\n hunk: DiffHunk;\n /** Next line number per parent (index 0 is the old side) and of the result. */\n parents: number[];\n result: number;\n /** Lines still owed per parent and by the result. */\n parentRemaining: number[];\n resultRemaining: number;\n};\n\nfunction openHunk(raw: string, path: string | undefined): HunkState {\n const match = HUNK_HEADER.exec(raw);\n const ranges = match ? Array.from(match[2]!.matchAll(RANGE)) : [];\n if (!match || ranges.length !== match[1]!.length - 1) {\n throw new Error(`Malformed unified diff hunk header: ${raw}`);\n }\n return {\n hunk: { header: raw, lines: [], ...(path ? { path } : {}) },\n parents: ranges.map((r) => Number(r[1])),\n parentRemaining: ranges.map((r) => (r[2] ? Number(r[2]) : 1)),\n result: Number(match[3]),\n resultRemaining: match[4] ? Number(match[4]) : 1,\n };\n}\n\n// One content line: a prefix column per parent, then the text. Following\n// git's colouring, a `-` in any column is a removal and otherwise a `+` in any\n// column is an addition. A line belongs to parent N when its column is `-`, or\n// is a space on a line with no `-` at all; it belongs to the result unless some\n// column is `-`. Numbers are reported for the first parent and the result.\nfunction appendLine(state: HunkState, raw: string) {\n const width = state.parents.length;\n const prefix = raw.slice(0, width).padEnd(width, \" \");\n const content = raw.slice(width);\n const removed = prefix.includes(\"-\");\n const type: DiffLineType = removed ? \"remove\" : prefix.includes(\"+\") ? \"add\" : \"context\";\n const inParent = [...prefix].map((column) => column === \"-\" || (!removed && column === \" \"));\n const line: DiffLine = { type, content };\n if (inParent[0] && type !== \"add\") line.oldNumber = state.parents[0]!;\n if (!removed) line.newNumber = state.result;\n state.hunk.lines.push(line);\n inParent.forEach((present, i) => {\n if (!present) return;\n state.parents[i]!++;\n state.parentRemaining[i]!--;\n });\n if (!removed) {\n state.result++;\n state.resultRemaining--;\n }\n}\n\nfunction hunkComplete(state: HunkState): boolean {\n return state.resultRemaining <= 0 && state.parentRemaining.every((n) => n <= 0);\n}\n\n// Strip the `a/`|`b/` prefix (and any trailing tab-timestamp) from a `---`/`+++`\n// header path; `/dev/null` (add/delete) has no path.\nfunction gitHeaderPath(token: string): string | undefined {\n const path = token.split(\"\\t\")[0]!.trim();\n if (path === \"\" || path === \"/dev/null\") return undefined;\n return path.startsWith(\"a/\") || path.startsWith(\"b/\") ? path.slice(2) : path;\n}\n\n// Parse a unified-diff string, including git's combined format (`diff --cc`,\n// `@@@` headers) for conflicted files and merges. Hunk headers drive line\n// numbers and hunk lengths; `+`/`-`/space prefixes become add/remove/context.\n// Each hunk records the file `path` from the enclosing `diff --git`/`---`/`+++`\n// headers, so a multi-file diff keeps its file boundaries. A line that starts\n// with `@@` but is not a valid hunk header throws rather than being dropped.\nexport function parseUnifiedDiff(diff: string): DiffHunk[] {\n const hunks: DiffHunk[] = [];\n let current: HunkState | null = null;\n let path: string | undefined;\n let oldPath: string | undefined;\n\n const body = diff.endsWith(\"\\n\") ? diff.slice(0, -1) : diff;\n for (const raw of body.split(\"\\n\")) {\n // While a hunk is open, every line is content until its declared line counts\n // are exhausted — so a `+++ …` content line is never read as a file header.\n if (current) {\n if (raw.startsWith(\"\\\\\")) continue; // \"\\"\n appendLine(current, raw);\n if (hunkComplete(current)) current = null;\n continue;\n }\n\n if (raw.startsWith(\"@@\")) {\n current = openHunk(raw, path);\n hunks.push(current.hunk);\n if (hunkComplete(current)) current = null;\n continue;\n }\n if (raw.startsWith(\"diff --git \") || raw.startsWith(\"diff --cc \") || raw.startsWith(\"diff --combined \")) {\n path = undefined;\n oldPath = undefined;\n } else if (raw.startsWith(\"--- \")) {\n oldPath = gitHeaderPath(raw.slice(4));\n } else if (raw.startsWith(\"+++ \")) {\n path = gitHeaderPath(raw.slice(4)) ?? oldPath;\n }\n // `index`, mode, and similar metadata lines carry no path — ignored.\n }\n return hunks;\n}\n"],"mappings":";AA4BA,SAAS,WAAW,MAAwB;CAC1C,IAAI,SAAS,IAAI,OAAO,CAAC;CAEzB,QADmB,KAAK,SAAS,IAAI,IAAI,KAAK,MAAM,GAAG,EAAE,IAAI,KAAA,CAC3C,MAAM,IAAI;AAC9B;AAIA,SAAgB,gBAAgB,UAAkB,UAA8B;CAG9E,MAAM,QAAQ,UAFJ,WAAW,QAEG,GADd,WAAW,QACM,CAAC;CAC5B,OAAO,MAAM,SAAS,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC;AAC3C;AAEA,SAAS,UAAU,GAAa,GAAyB;CACvD,MAAM,IAAI,EAAE;CACZ,MAAM,IAAI,EAAE;CACZ,MAAM,QAAQ,IAAI;CAGlB,MAAM,MAAM,IAAI,YAAY,IAAI,KAAK,KAAK;CAC1C,MAAM,MAAM,KAAa,QAAwB,IAAI,MAAM,QAAQ;CACnE,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,GAAG,KAC1B,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,GAAG,KAC1B,IAAI,IAAI,QAAQ,KACd,EAAE,OAAO,E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KAAK,WAAW,IAAI,IAAI,KAAK,MAAM,CAAC,IAAI;AAC1E;AAQA,SAAgB,iBAAiB,MAA0B;CACzD,MAAM,QAAoB,CAAC;CAC3B,IAAI,UAA4B;CAChC,IAAI;CACJ,IAAI;CAEJ,MAAM,OAAO,KAAK,SAAS,IAAI,IAAI,KAAK,MAAM,GAAG,EAAE,IAAI;CACvD,KAAK,MAAM,OAAO,KAAK,MAAM,IAAI,GAAG;EAGlC,IAAI,SAAS;GACX,IAAI,IAAI,WAAW,IAAI,GAAG;GAC1B,WAAW,SAAS,GAAG;GACvB,IAAI,aAAa,OAAO,GAAG,UAAU;GACrC;EACF;EAEA,IAAI,IAAI,WAAW,IAAI,GAAG;GACxB,UAAU,SAAS,KAAK,IAAI;GAC5B,MAAM,KAAK,QAAQ,IAAI;GACvB,IAAI,aAAa,OAAO,GAAG,UAAU;GACrC;EACF;EACA,IAAI,IAAI,WAAW,aAAa,KAAK,IAAI,WAAW,YAAY,KAAK,IAAI,WAAW,kBAAkB,GAAG;GACvG,OAAO,KAAA;GACP,UAAU,KAAA;EACZ,OAAO,IAAI,IAAI,WAAW,MAAM,GAC9B,UAAU,cAAc,IAAI,MAAM,CAAC,CAAC;OAC/B,IAAI,IAAI,WAAW,MAAM,GAC9B,OAAO,cAAc,IAAI,MAAM,CAAC,CAAC,KAAK;CAG1C;CACA,OAAO;AACT"}
@@ -14,9 +14,9 @@ function detectMode() {
14
14
  /** Resolve build + runtime version metadata. */
15
15
  function getVersionInfo() {
16
16
  return {
17
- commit: read(() => "a3e6af33a", ""),
18
- tag: read(() => "clicky-ui@0.3.72", ""),
19
- date: read(() => "2026-11-23T21:59:31.803Z", ""),
17
+ commit: read(() => "66d45fd6d", ""),
18
+ tag: read(() => "clicky-ui@0.3.73", ""),
19
+ date: read(() => "2026-11-24T04:28:25.536Z", ""),
20
20
  dirty: read(() => true, false),
21
21
  mode: detectMode()
22
22
  };
@@ -14,9 +14,9 @@ function detectMode() {
14
14
  /** Resolve build + runtime version metadata. */
15
15
  function getVersionInfo() {
16
16
  return {
17
- commit: read(() => "a3e6af33a", ""),
18
- tag: read(() => "clicky-ui@0.3.72", ""),
19
- date: read(() => "2026-11-23T21:58:50.731Z", ""),
17
+ commit: read(() => "66d45fd6d", ""),
18
+ tag: read(() => "clicky-ui@0.3.73", ""),
19
+ date: read(() => "2026-11-24T04:27:48.435Z", ""),
20
20
  dirty: read(() => true, false),
21
21
  mode: detectMode()
22
22
  };