token-goat 2.9.21 → 2.9.22

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.
Files changed (49) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -2
  2. package/dist/{token-goat-chunk-QUM3UNWS.mjs → token-goat-chunk-273O227F.mjs} +5 -5
  3. package/dist/{token-goat-chunk-BKHJRFDE.mjs → token-goat-chunk-2GAK6LNK.mjs} +13 -12
  4. package/dist/{token-goat-chunk-QCQUIPIP.mjs → token-goat-chunk-3U6ZYVX5.mjs} +1582 -773
  5. package/dist/{token-goat-chunk-64OEF3UN.mjs → token-goat-chunk-4642QVSQ.mjs} +6 -6
  6. package/dist/{token-goat-chunk-VXKT3W4C.mjs → token-goat-chunk-47MFMDCL.mjs} +3 -3
  7. package/dist/{token-goat-chunk-MEKVJZUN.mjs → token-goat-chunk-4NS4CAKI.mjs} +2 -2
  8. package/dist/{token-goat-chunk-BIEDTF6V.mjs → token-goat-chunk-4QGFVPFJ.mjs} +3 -3
  9. package/dist/{token-goat-chunk-FZN77SZD.mjs → token-goat-chunk-4W2SZZIL.mjs} +27 -27
  10. package/dist/{token-goat-chunk-IAMIQLCV.mjs → token-goat-chunk-646GCK7P.mjs} +200 -207
  11. package/dist/{token-goat-chunk-GO7OWONJ.mjs → token-goat-chunk-6MTX77BB.mjs} +17 -17
  12. package/dist/{token-goat-chunk-PDYQA3AP.mjs → token-goat-chunk-75DLQORE.mjs} +4 -4
  13. package/dist/{token-goat-chunk-CZ5ZFJSN.mjs → token-goat-chunk-765U7OJS.mjs} +23 -21
  14. package/dist/{token-goat-chunk-MZQORUX5.mjs → token-goat-chunk-7TAFIQS4.mjs} +1 -1
  15. package/dist/{token-goat-chunk-T6M7DAW3.mjs → token-goat-chunk-CHLHM42P.mjs} +13 -1
  16. package/dist/{token-goat-chunk-2ZHD3XCD.mjs → token-goat-chunk-CTPTUL7L.mjs} +16 -2
  17. package/dist/{token-goat-chunk-MQACN7VG.mjs → token-goat-chunk-CVPCUQON.mjs} +3 -3
  18. package/dist/{token-goat-chunk-CAHN4QU7.mjs → token-goat-chunk-DMCYWDMB.mjs} +10 -10
  19. package/dist/{token-goat-chunk-M6CDVASA.mjs → token-goat-chunk-DN4HSMH7.mjs} +1 -1
  20. package/dist/{token-goat-chunk-ORRDWKLA.mjs → token-goat-chunk-EU5KDBII.mjs} +1 -1
  21. package/dist/{token-goat-chunk-XJUPKJF5.mjs → token-goat-chunk-FI4MIIER.mjs} +40 -32
  22. package/dist/{token-goat-chunk-KRPJIXCT.mjs → token-goat-chunk-G7NIU2HH.mjs} +2 -2
  23. package/dist/{token-goat-chunk-PCR43MCM.mjs → token-goat-chunk-GKZLHNGN.mjs} +2 -2
  24. package/dist/{token-goat-chunk-KQI24O4B.mjs → token-goat-chunk-HCEW3KTN.mjs} +2 -2
  25. package/dist/{token-goat-chunk-KVAXTA2W.mjs → token-goat-chunk-HGXKWLYQ.mjs} +10 -10
  26. package/dist/{token-goat-chunk-4IIU3GNS.mjs → token-goat-chunk-I4OCEISJ.mjs} +8 -8
  27. package/dist/{token-goat-chunk-MECDAPXB.mjs → token-goat-chunk-JGQ2SBAA.mjs} +4 -4
  28. package/dist/{token-goat-chunk-TGBSMHPM.mjs → token-goat-chunk-K5KG65OI.mjs} +1 -1
  29. package/dist/{token-goat-chunk-DISVHOW6.mjs → token-goat-chunk-KJCMNJCG.mjs} +4 -4
  30. package/dist/{token-goat-chunk-XQSSPX3X.mjs → token-goat-chunk-LPOEPINH.mjs} +2 -2
  31. package/dist/{token-goat-chunk-SMUYPBF5.mjs → token-goat-chunk-N3UUZAYN.mjs} +51 -17
  32. package/dist/{token-goat-chunk-LK3YOKDF.mjs → token-goat-chunk-N6WCYKW5.mjs} +2 -2
  33. package/dist/{token-goat-chunk-SHV6QQAS.mjs → token-goat-chunk-ONXXR7MS.mjs} +1 -1
  34. package/dist/{token-goat-chunk-CMAJGP3E.mjs → token-goat-chunk-OSLK5MBY.mjs} +4 -4
  35. package/dist/{token-goat-chunk-ZJWPJL7O.mjs → token-goat-chunk-PQD6JTXN.mjs} +3 -3
  36. package/dist/{token-goat-chunk-QTIRVK3M.mjs → token-goat-chunk-SLE5MVTU.mjs} +1 -1
  37. package/dist/{token-goat-chunk-DDP64XR7.mjs → token-goat-chunk-TD5JS4ST.mjs} +3 -3
  38. package/dist/{token-goat-chunk-PPYZS7TI.mjs → token-goat-chunk-TEK5LV6B.mjs} +3 -3
  39. package/dist/{token-goat-chunk-6AQLZMCO.mjs → token-goat-chunk-VRS6B7UD.mjs} +10 -14
  40. package/dist/{token-goat-chunk-4V4OZHHV.mjs → token-goat-chunk-VVPAGLLE.mjs} +8 -8
  41. package/dist/{token-goat-chunk-OMNQUUIT.mjs → token-goat-chunk-XBESNWEX.mjs} +1 -1
  42. package/dist/token-goat-chunk-YDPJCY62.mjs +41 -0
  43. package/dist/{token-goat-chunk-M43UJVYQ.mjs → token-goat-chunk-YHCUBOVZ.mjs} +5 -5
  44. package/dist/{token-goat-chunk-PHDNWISV.mjs → token-goat-chunk-YVCGELLH.mjs} +3 -3
  45. package/dist/{token-goat-chunk-IJUHQX2M.mjs → token-goat-chunk-ZO6OALTM.mjs} +1 -1
  46. package/dist/token-goat-hook.mjs +17 -17
  47. package/dist/token-goat.core.mjs +27 -27
  48. package/package.json +1 -1
  49. package/dist/token-goat-chunk-CMHBTXMY.mjs +0 -41
@@ -4,7 +4,7 @@ import {
4
4
  pathEqClause,
5
5
  projectScopeClause,
6
6
  querySymbols
7
- } from "./token-goat-chunk-XQSSPX3X.mjs";
7
+ } from "./token-goat-chunk-LPOEPINH.mjs";
8
8
  import {
9
9
  TREE_SITTER_LANGUAGES,
10
10
  _detectOpenQuote,
@@ -13,6 +13,7 @@ import {
13
13
  detectLanguage,
14
14
  findHtmlHeadingMatches,
15
15
  getDb,
16
+ lineTextAt,
16
17
  offsetToLine,
17
18
  precedingDocComment,
18
19
  redactIfDotenv,
@@ -21,11 +22,11 @@ import {
21
22
  stripJsComments,
22
23
  stripStringLiterals,
23
24
  stripXmlComments
24
- } from "./token-goat-chunk-2ZHD3XCD.mjs";
25
+ } from "./token-goat-chunk-CTPTUL7L.mjs";
25
26
  import {
26
27
  fingerprintContent,
27
28
  loadConfig
28
- } from "./token-goat-chunk-M6CDVASA.mjs";
29
+ } from "./token-goat-chunk-DN4HSMH7.mjs";
29
30
  import {
30
31
  registerReset
31
32
  } from "./token-goat-chunk-EEIDFMEM.mjs";
@@ -39,7 +40,7 @@ import {
39
40
  foldPath,
40
41
  globalDbPath,
41
42
  isCaseInsensitiveFs
42
- } from "./token-goat-chunk-TGBSMHPM.mjs";
43
+ } from "./token-goat-chunk-K5KG65OI.mjs";
43
44
  import {
44
45
  displaySafeText,
45
46
  normalizePath
@@ -74,11 +75,11 @@ async function extractEmbeddableDocumentText(filePath) {
74
75
  return text;
75
76
  }
76
77
  case ".docx":
77
- return await (await import("./token-goat-chunk-VXKT3W4C.mjs")).docxText(filePath);
78
+ return await (await import("./token-goat-chunk-47MFMDCL.mjs")).docxText(filePath);
78
79
  case ".pptx":
79
- return await (await import("./token-goat-chunk-BIEDTF6V.mjs")).pptxAllSlidesText(filePath, true);
80
+ return await (await import("./token-goat-chunk-4QGFVPFJ.mjs")).pptxAllSlidesText(filePath, true);
80
81
  case ".xlsx":
81
- return await (await import("./token-goat-chunk-DISVHOW6.mjs")).allSheetsHeadText(filePath, XLSX_SHEET_ROW_CAP);
82
+ return await (await import("./token-goat-chunk-KJCMNJCG.mjs")).allSheetsHeadText(filePath, XLSX_SHEET_ROW_CAP);
82
83
  default:
83
84
  return null;
84
85
  }
@@ -872,14 +873,14 @@ function packVec(vec) {
872
873
  }
873
874
  return Buffer.from(view.buffer);
874
875
  }
875
- function splitRangeIntoChunks(filePath, lines2, rangeStart, rangeEnd, chunkSize, overlap, kind, countTokens) {
876
+ function splitRangeIntoChunks(filePath, lines, rangeStart, rangeEnd, chunkSize, overlap, kind, countTokens) {
876
877
  const chunks = [];
877
878
  const lineTokenCache = /* @__PURE__ */ new Map();
878
879
  const tokensOf = (lineNo) => {
879
880
  if (countTokens === void 0) return 0;
880
881
  let n = lineTokenCache.get(lineNo);
881
882
  if (n === void 0) {
882
- n = countTokens(lines2[lineNo - 1] ?? "");
883
+ n = countTokens(lines[lineNo - 1] ?? "");
883
884
  lineTokenCache.set(lineNo, n);
884
885
  }
885
886
  return n;
@@ -889,7 +890,7 @@ function splitRangeIntoChunks(filePath, lines2, rangeStart, rangeEnd, chunkSize,
889
890
  let startLine = rangeStart;
890
891
  let currentLine = rangeStart;
891
892
  for (let lineNo = rangeStart; lineNo <= rangeEnd; lineNo++) {
892
- const line = lines2[lineNo - 1] ?? "";
893
+ const line = lines[lineNo - 1] ?? "";
893
894
  const lineWithNewline = line + "\n";
894
895
  const lineTokens = tokensOf(lineNo);
895
896
  if ((currentChunk.length + lineWithNewline.length > chunkSize || currentTokens + lineTokens > MAX_CHUNK_TOKENS) && currentChunk.length > 0) {
@@ -908,7 +909,7 @@ function splitRangeIntoChunks(filePath, lines2, rangeStart, rangeEnd, chunkSize,
908
909
  let overlapTokens = 0;
909
910
  let computedOverlapStart = currentLine;
910
911
  while (computedOverlapStart > rangeStart) {
911
- const candidateChars = (lines2[computedOverlapStart - 2] ?? "").length + 1;
912
+ const candidateChars = (lines[computedOverlapStart - 2] ?? "").length + 1;
912
913
  if (overlapChars + candidateChars > overlap) break;
913
914
  const candidateTokens = tokensOf(computedOverlapStart - 1);
914
915
  if (overlapTokens + candidateTokens + lineTokens > MAX_CHUNK_TOKENS) break;
@@ -919,7 +920,7 @@ function splitRangeIntoChunks(filePath, lines2, rangeStart, rangeEnd, chunkSize,
919
920
  const droppedChunkHadContent = currentChunkTooSmall && trimmedLength > 0;
920
921
  const overlapStart = droppedChunkHadContent ? Math.min(computedOverlapStart, startLine) : computedOverlapStart;
921
922
  if (overlapStart !== startLine) {
922
- const overlapText = lines2.slice(overlapStart - 1, currentLine - 1).join("\n");
923
+ const overlapText = lines.slice(overlapStart - 1, currentLine - 1).join("\n");
923
924
  currentChunk = overlapText + "\n";
924
925
  currentTokens = overlapTokens;
925
926
  startLine = overlapStart;
@@ -955,7 +956,7 @@ function splitRangeIntoChunks(filePath, lines2, rangeStart, rangeEnd, chunkSize,
955
956
  for (let lineNo = last.startLine; lineNo <= rangeEnd; lineNo++) mergedTokens += tokensOf(lineNo);
956
957
  if (mergedTokens <= MAX_CHUNK_TOKENS) {
957
958
  last.endLine = rangeEnd;
958
- last.text = lines2.slice(last.startLine - 1, rangeEnd).join("\n").trim();
959
+ last.text = lines.slice(last.startLine - 1, rangeEnd).join("\n").trim();
959
960
  } else if (currentChunk.trim().length > 0) {
960
961
  chunks.push({ filePath, startLine, endLine: rangeEnd, text: currentChunk.trim(), kind });
961
962
  }
@@ -982,11 +983,11 @@ function splitToFit(text, fits) {
982
983
  return [...splitToFit(text.slice(0, cut), fits), ...splitToFit(text.slice(cut), fits)];
983
984
  }
984
985
  function chunkFile(filePath, content, chunkSize = MAX_CHUNK_CHARS, overlap = 200, boundaries = [], countTokens) {
985
- const lines2 = content.split(/\r?\n/);
986
- if (lines2.length > 1 && lines2[lines2.length - 1] === "") lines2.pop();
987
- const totalLines = lines2.length;
986
+ const lines = content.split(/\r?\n/);
987
+ if (lines.length > 1 && lines[lines.length - 1] === "") lines.pop();
988
+ const totalLines = lines.length;
988
989
  if (boundaries.length === 0) {
989
- return splitRangeIntoChunks(filePath, lines2, 1, totalLines, chunkSize, overlap, "window", countTokens);
990
+ return splitRangeIntoChunks(filePath, lines, 1, totalLines, chunkSize, overlap, "window", countTokens);
990
991
  }
991
992
  const clipped = boundaries.map((b) => ({
992
993
  start: Math.max(1, Math.min(b.start, totalLines)),
@@ -994,7 +995,7 @@ function chunkFile(filePath, content, chunkSize = MAX_CHUNK_CHARS, overlap = 200
994
995
  kind: b.kind
995
996
  })).filter((b) => b.end >= b.start).sort((a, b) => a.start - b.start || b.end - a.end);
996
997
  if (clipped.length === 0) {
997
- return splitRangeIntoChunks(filePath, lines2, 1, totalLines, chunkSize, overlap, "window", countTokens);
998
+ return splitRangeIntoChunks(filePath, lines, 1, totalLines, chunkSize, overlap, "window", countTokens);
998
999
  }
999
1000
  const flattened = [];
1000
1001
  let openEnd = 0;
@@ -1006,7 +1007,7 @@ function chunkFile(filePath, content, chunkSize = MAX_CHUNK_CHARS, overlap = 200
1006
1007
  }
1007
1008
  const gapLength = (start, end) => {
1008
1009
  let text = "";
1009
- for (let lineNo = start; lineNo <= end; lineNo++) text += (lines2[lineNo - 1] ?? "") + "\n";
1010
+ for (let lineNo = start; lineNo <= end; lineNo++) text += (lines[lineNo - 1] ?? "") + "\n";
1010
1011
  return text.trim().length;
1011
1012
  };
1012
1013
  const ranges = [];
@@ -1061,7 +1062,7 @@ function chunkFile(filePath, content, chunkSize = MAX_CHUNK_CHARS, overlap = 200
1061
1062
  }
1062
1063
  const chunks = [];
1063
1064
  for (const r of ranges) {
1064
- chunks.push(...splitRangeIntoChunks(filePath, lines2, r.start, r.end, chunkSize, overlap, r.kind, countTokens));
1065
+ chunks.push(...splitRangeIntoChunks(filePath, lines, r.start, r.end, chunkSize, overlap, r.kind, countTokens));
1065
1066
  }
1066
1067
  return chunks;
1067
1068
  }
@@ -1469,60 +1470,60 @@ init_define_import_meta_env();
1469
1470
 
1470
1471
  // src/parser_fingerprint.ts
1471
1472
  init_define_import_meta_env();
1472
- var PARSER_FINGERPRINT = "6aa8597ec9d03c45";
1473
+ var PARSER_FINGERPRINT = "4a3655d5cfe03a53";
1473
1474
  var LANGUAGE_PARSER_FINGERPRINTS = /* @__PURE__ */ new Map([
1474
- ["abap", "f04854be73660475"],
1475
- ["abl", "92fd58c2ee0b918b"],
1476
- ["apache", "7c95ef50634c1e09"],
1477
- ["apex", "be6bbaefcb5acddb"],
1478
- ["asm", "35e5d09b5cfbdb5f"],
1479
- ["bash", "98979a536200c7c9"],
1480
- ["batch", "9db39636b1d69081"],
1481
- ["caddy", "76dba4266f9139dd"],
1482
- ["clojure", "cfb5e36a85980247"],
1483
- ["cmake", "6186c70e61c9d839"],
1484
- ["common_lisp", "e0a4e8032901773b"],
1485
- ["csharp", "75e6ce02f1b0f78a"],
1486
- ["dart", "2284bca2faefe5fb"],
1487
- ["elixir", "d63188b2f0c64139"],
1488
- ["emacs_lisp", "98ea21315946c308"],
1489
- ["erlang", "0471440a285fc4cb"],
1490
- ["fortran", "c3b563bc9ce74947"],
1491
- ["fsharp", "a9476da9ac62bbc9"],
1492
- ["graphql", "c9b2180a2a0af6b0"],
1493
- ["groovy", "8442e7c34152b2b2"],
1494
- ["haskell", "23dec895c732def8"],
1495
- ["jcl", "73a786da77c4db23"],
1496
- ["kotlin", "ab4460277c29b952"],
1497
- ["liquid", "6cc72f94e2d6ba68"],
1498
- ["lua", "75f1e747e58a9d15"],
1499
- ["makefile", "5c73d6f841946735"],
1500
- ["matlab", "9f6e3c63639e078e"],
1501
- ["nginx", "7ebbbaf472f741da"],
1502
- ["nix", "d94c2fd10455cb4b"],
1503
- ["objc", "27764c4b2f960cf3"],
1504
- ["ocaml", "9566d1d93ca334bf"],
1505
- ["pascal", "e3ba20a3551174e4"],
1506
- ["perl", "56b8de695b8acacf"],
1507
- ["php", "e2f49f0a0b595a16"],
1508
- ["pli", "c1821a23de239675"],
1509
- ["powershell", "a3b02edf7b027c66"],
1510
- ["proto", "a2f887c45f9bf1d2"],
1511
- ["r", "806be2f03be7dd1f"],
1512
- ["racket", "b093081d200e8d68"],
1513
- ["rpg", "4c9668b3c61396e6"],
1514
- ["salesforce_metadata", "03e76181b0045245"],
1515
- ["sas", "bf7c36acb99e0759"],
1516
- ["scala", "f7198d0d39def4ae"],
1517
- ["scheme", "d905c93ab9e766a8"],
1518
- ["solidity", "7766122d1f3c7cbc"],
1519
- ["sql", "824fcaff44f3ed5c"],
1520
- ["swift", "b18ac1ef016d5137"],
1521
- ["terraform", "fac96a1cef8d11e5"],
1522
- ["thrift", "cf18f8d114adfd6f"],
1523
- ["vb", "78c117ff3d925cf1"],
1524
- ["vhdl", "62c11e0fb39472ad"],
1525
- ["zig", "80c5e52bbe1455fb"]
1475
+ ["abap", "4ef985e32a1f383b"],
1476
+ ["abl", "bdd5e1f26e45ff2c"],
1477
+ ["apache", "0b27b69726292efb"],
1478
+ ["apex", "e32b7db5f4712f5b"],
1479
+ ["asm", "39cb0f03768e600d"],
1480
+ ["bash", "c3e48283ab19e193"],
1481
+ ["batch", "851214ae15af3639"],
1482
+ ["caddy", "bbeb0a2da1560633"],
1483
+ ["clojure", "d0884e88ac85075a"],
1484
+ ["cmake", "03340ace9b2aa883"],
1485
+ ["common_lisp", "ae28e72ef28c9551"],
1486
+ ["csharp", "a2c491f606bb57b9"],
1487
+ ["dart", "a4dd5573b9546228"],
1488
+ ["elixir", "4a81648264545c56"],
1489
+ ["emacs_lisp", "316bfa0b437eeb85"],
1490
+ ["erlang", "3bc366622ec4cc3b"],
1491
+ ["fortran", "291bc41f505cdda6"],
1492
+ ["fsharp", "10933683d81d8d1c"],
1493
+ ["graphql", "1a20ee76f923313e"],
1494
+ ["groovy", "9cb3181f3f4a11fe"],
1495
+ ["haskell", "730181cb830a1030"],
1496
+ ["jcl", "9a57499031ed347b"],
1497
+ ["kotlin", "f3dfa562584b3c1e"],
1498
+ ["liquid", "2c0c5e6ba3115c8a"],
1499
+ ["lua", "6ce08b73a44c644e"],
1500
+ ["makefile", "3ba22553e6f132b2"],
1501
+ ["matlab", "f746df0ae9a5b830"],
1502
+ ["nginx", "3c41efc524de3986"],
1503
+ ["nix", "3fd1e8d077a7bf35"],
1504
+ ["objc", "01f9ad87531b18b3"],
1505
+ ["ocaml", "45102e7f975163f4"],
1506
+ ["pascal", "294cd5e1691c743c"],
1507
+ ["perl", "0e3da9140e016fcc"],
1508
+ ["php", "3284d2b4728c415c"],
1509
+ ["pli", "e231b4d9e03f468c"],
1510
+ ["powershell", "a00cb003902e7925"],
1511
+ ["proto", "295d025fcbb1530b"],
1512
+ ["r", "a085d6e71e01a30c"],
1513
+ ["racket", "67784484d09eb4b2"],
1514
+ ["rpg", "c62e068dcdc9560f"],
1515
+ ["salesforce_metadata", "355abf5e3004314b"],
1516
+ ["sas", "3989a1cb67d116ab"],
1517
+ ["scala", "4c26cbe2d384c6f3"],
1518
+ ["scheme", "5002c53a7c5b2494"],
1519
+ ["solidity", "73c98aebc6e118a3"],
1520
+ ["sql", "2d4253d05fc034c0"],
1521
+ ["swift", "37c62bf09376b09b"],
1522
+ ["terraform", "eb990ef3cdcc442a"],
1523
+ ["thrift", "5087a9dd0676c7b4"],
1524
+ ["vb", "8f4399c3ff337841"],
1525
+ ["vhdl", "940490b5125328d9"],
1526
+ ["zig", "216a30e17966e444"]
1526
1527
  ]);
1527
1528
 
1528
1529
  // src/parser_stamp.ts
@@ -1621,10 +1622,10 @@ init_define_import_meta_env();
1621
1622
 
1622
1623
  // src/markdown_lines.ts
1623
1624
  init_define_import_meta_env();
1624
- function* eachUnfencedLine(lines2) {
1625
+ function* eachUnfencedLine(lines) {
1625
1626
  let fence = null;
1626
- for (let i = 0; i < lines2.length; i++) {
1627
- const line = lines2[i];
1627
+ for (let i = 0; i < lines.length; i++) {
1628
+ const line = lines[i];
1628
1629
  if (line === void 0) continue;
1629
1630
  const fm = /^\s*(`{3,}|~{3,})([^\n]*)$/.exec(line);
1630
1631
  if (fm !== null && fm[1] !== void 0) {
@@ -1649,8 +1650,8 @@ var MAX_HEADINGS = 40;
1649
1650
  var MAX_OUTPUT_LINES = 60;
1650
1651
  function extractMarkdownHeadings(content, limit = MAX_HEADINGS) {
1651
1652
  const headings = [];
1652
- const lines2 = content.split("\n");
1653
- const unfenced = Array.from(eachUnfencedLine(lines2));
1653
+ const lines = content.split("\n");
1654
+ const unfenced = Array.from(eachUnfencedLine(lines));
1654
1655
  for (let u = 0; u < unfenced.length; u++) {
1655
1656
  const [i, line] = unfenced[u];
1656
1657
  if (!line) continue;
@@ -1739,10 +1740,10 @@ function getWellKnownSections(basename2) {
1739
1740
  return WELL_KNOWN_SECTIONS[basename2] ?? [];
1740
1741
  }
1741
1742
  function extractChangelogVersionHint(content, filePath) {
1742
- const lines2 = content.split("\n");
1743
+ const lines = content.split("\n");
1743
1744
  let foundUnreleased = false;
1744
1745
  let firstVersion = null;
1745
- for (const line of lines2) {
1746
+ for (const line of lines) {
1746
1747
  const m = /^##\s+(\[?[\d]+\.[\d]+\.[\d]+\]?)/.exec(line);
1747
1748
  if (m) {
1748
1749
  if (foundUnreleased) {
@@ -1779,9 +1780,6 @@ function buildEmbeddingBoundaries(filePath, content, dbPath) {
1779
1780
  // src/languages/salesforce_frontend.ts
1780
1781
  init_define_import_meta_env();
1781
1782
  import * as path5 from "node:path";
1782
- function lines(content) {
1783
- return content.split("\n");
1784
- }
1785
1783
  function bundleName(filePath) {
1786
1784
  const normalized = filePath.replaceAll("\\", "/");
1787
1785
  const parent = path5.posix.basename(path5.posix.dirname(normalized));
@@ -1808,7 +1806,7 @@ function dedupe(values, key) {
1808
1806
  });
1809
1807
  }
1810
1808
  function extractLwcJavaScript(content, filePath) {
1811
- const sourceLines = lines(content);
1809
+ const lineIndex = buildLineIndex(content);
1812
1810
  const bundle = bundleName(filePath);
1813
1811
  const symbols = [
1814
1812
  symbol(filePath, bundle, "lwc_bundle", 1, countContentLines(content)),
@@ -1818,16 +1816,15 @@ function extractLwcJavaScript(content, filePath) {
1818
1816
  const commentFree = stripJsComments(content);
1819
1817
  const apiRe = /@api\s*(?:\r?\n\s*)?(?:(get|set)\s+)?(?:async\s+)?([A-Za-z_$][\w$]*)\s*(\()?/g;
1820
1818
  for (const match of commentFree.matchAll(apiRe)) {
1821
- const before = commentFree.slice(0, match.index ?? 0);
1822
- const line = before.split("\n").length;
1819
+ const line = offsetToLine(lineIndex, match.index ?? 0);
1823
1820
  const kind = match[3] && !match[1] ? "lwc_api_method" : "lwc_api_property";
1824
1821
  symbols.push(symbol(filePath, match[2] ?? "", kind, line));
1825
1822
  }
1826
1823
  const importRe = /from\s+['"]@salesforce\/(apex|schema|label|resourceUrl|messageChannel|customPermission|userPermission)\/([^'"]+)['"]/g;
1827
1824
  for (const match of commentFree.matchAll(importRe)) {
1828
1825
  const offset = match.index ?? 0;
1829
- const line = commentFree.slice(0, offset).split("\n").length;
1830
- const context = sourceLines[line - 1]?.trim() ?? "";
1826
+ const line = offsetToLine(lineIndex, offset);
1827
+ const context = lineTextAt(content, lineIndex, line);
1831
1828
  const target = match[2] ?? "";
1832
1829
  const targetOffset = offset + (match[0]?.indexOf(target) ?? 0);
1833
1830
  const col = targetOffset - (commentFree.lastIndexOf("\n", targetOffset) + 1);
@@ -1842,33 +1839,28 @@ function extractLwcJavaScript(content, filePath) {
1842
1839
  refs: dedupe(refs, (entry) => `${entry.filePath}\0${entry.name}\0${entry.line}\0${entry.col}`)
1843
1840
  };
1844
1841
  }
1845
- function matchLine(content, offset) {
1846
- return content.slice(0, offset).split("\n").length;
1847
- }
1848
- function lineContext(content, line) {
1849
- return lines(content)[line - 1]?.trim() ?? "";
1850
- }
1851
1842
  function extractLwcTemplate(content, filePath) {
1852
1843
  const symbols = [];
1853
1844
  const refs = [];
1854
1845
  const markupNoComments = stripXmlComments(content);
1846
+ const lineIndex = buildLineIndex(content);
1855
1847
  for (const match of markupNoComments.matchAll(/\blwc:ref\s*=\s*["']([^"']+)["']/gi)) {
1856
- const line = matchLine(markupNoComments, match.index ?? 0);
1848
+ const line = offsetToLine(lineIndex, match.index ?? 0);
1857
1849
  symbols.push(symbol(filePath, match[1] ?? "", "lwc_ref", line));
1858
1850
  }
1859
1851
  for (const match of markupNoComments.matchAll(/\bid\s*=\s*["']([^"'{}:]+)["']/gi)) {
1860
- const line = matchLine(markupNoComments, match.index ?? 0);
1852
+ const line = offsetToLine(lineIndex, match.index ?? 0);
1861
1853
  symbols.push(symbol(filePath, match[1] ?? "", "lwc_id", line));
1862
1854
  }
1863
1855
  for (const match of markupNoComments.matchAll(/\bon[a-z][\w-]*\s*=\s*\{\s*([A-Za-z_$][\w$]*)\s*\}/gi)) {
1864
1856
  const offset = match.index ?? 0;
1865
- const line = matchLine(markupNoComments, offset);
1866
- refs.push(ref(filePath, match[1] ?? "", line, 0, lineContext(content, line)));
1857
+ const line = offsetToLine(lineIndex, offset);
1858
+ refs.push(ref(filePath, match[1] ?? "", line, 0, lineTextAt(content, lineIndex, line)));
1867
1859
  }
1868
1860
  for (const match of markupNoComments.matchAll(/<\s*(c-[a-z][\w-]*)\b/gi)) {
1869
1861
  const offset = match.index ?? 0;
1870
- const line = matchLine(markupNoComments, offset);
1871
- refs.push(ref(filePath, (match[1] ?? "").toLowerCase(), line, 0, lineContext(content, line)));
1862
+ const line = offsetToLine(lineIndex, offset);
1863
+ refs.push(ref(filePath, (match[1] ?? "").toLowerCase(), line, 0, lineTextAt(content, lineIndex, line)));
1872
1864
  }
1873
1865
  return {
1874
1866
  symbols: dedupe(symbols, (entry) => `${entry.name}\0${entry.kind}\0${entry.lineStart}`),
@@ -1893,18 +1885,18 @@ function markupArtifactName(filePath, extension) {
1893
1885
  }
1894
1886
  return bundleName(filePath);
1895
1887
  }
1896
- function addAttributeSymbols(symbols, content, filePath, tag, kind) {
1888
+ function addAttributeSymbols(symbols, content, lineIndex, filePath, tag, kind) {
1897
1889
  const tagRe = new RegExp(`<\\s*${tag}\\b[^>]*\\bname\\s*=\\s*["']([^"']+)["'][^>]*>`, "gi");
1898
1890
  for (const match of content.matchAll(tagRe)) {
1899
- symbols.push(symbol(filePath, match[1] ?? "", kind, matchLine(content, match.index ?? 0)));
1891
+ symbols.push(symbol(filePath, match[1] ?? "", kind, offsetToLine(lineIndex, match.index ?? 0)));
1900
1892
  }
1901
1893
  }
1902
- function attributeRefs(refs, content, filePath, attribute, split = false) {
1894
+ function attributeRefs(refs, content, lineIndex, filePath, attribute, split = false) {
1903
1895
  const attributeRe = new RegExp(`\\b${attribute}\\s*=\\s*["']([^"']+)["']`, "gi");
1904
1896
  for (const match of content.matchAll(attributeRe)) {
1905
- const line = matchLine(content, match.index ?? 0);
1897
+ const line = offsetToLine(lineIndex, match.index ?? 0);
1906
1898
  const values = split ? (match[1] ?? "").split(",").map((value) => value.trim()).filter(Boolean) : [match[1] ?? ""];
1907
- for (const value of values) refs.push(ref(filePath, value, line, 0, lineContext(content, line)));
1899
+ for (const value of values) refs.push(ref(filePath, value, line, 0, lineTextAt(content, lineIndex, line)));
1908
1900
  }
1909
1901
  }
1910
1902
  function extractSalesforceMarkup(content, filePath) {
@@ -1917,22 +1909,23 @@ function extractSalesforceMarkup(content, filePath) {
1917
1909
  const refs = [];
1918
1910
  const isAura = [".cmp", ".app", ".evt", ".intf", ".design", ".auradoc", ".tokens"].includes(extension);
1919
1911
  const markupNoComments = stripXmlComments(content);
1912
+ const lineIndex = buildLineIndex(content);
1920
1913
  if (isAura) {
1921
- addAttributeSymbols(symbols, markupNoComments, filePath, "aura:attribute", "aura_attribute");
1922
- addAttributeSymbols(symbols, markupNoComments, filePath, "aura:handler", "aura_handler");
1923
- addAttributeSymbols(symbols, markupNoComments, filePath, "aura:registerEvent", "aura_event");
1924
- addAttributeSymbols(symbols, markupNoComments, filePath, "design:attribute", "aura_design_attribute");
1914
+ addAttributeSymbols(symbols, markupNoComments, lineIndex, filePath, "aura:attribute", "aura_attribute");
1915
+ addAttributeSymbols(symbols, markupNoComments, lineIndex, filePath, "aura:handler", "aura_handler");
1916
+ addAttributeSymbols(symbols, markupNoComments, lineIndex, filePath, "aura:registerEvent", "aura_event");
1917
+ addAttributeSymbols(symbols, markupNoComments, lineIndex, filePath, "design:attribute", "aura_design_attribute");
1925
1918
  }
1926
- attributeRefs(refs, markupNoComments, filePath, "controller");
1927
- attributeRefs(refs, markupNoComments, filePath, "extensions", true);
1919
+ attributeRefs(refs, markupNoComments, lineIndex, filePath, "controller");
1920
+ attributeRefs(refs, markupNoComments, lineIndex, filePath, "extensions", true);
1928
1921
  const actionRe = isAura ? /\{!\s*c\.([A-Za-z_$][\w$]*)(?:[^}\w$][^}]*)?\}/gi : /\baction\s*=\s*["']\{!\s*(?:c\.)?([A-Za-z_$][\w$]*)(?:[^}\w$][^}]*)?\}["']/gi;
1929
1922
  for (const match of markupNoComments.matchAll(actionRe)) {
1930
- const line = matchLine(markupNoComments, match.index ?? 0);
1931
- refs.push(ref(filePath, match[1] ?? "", line, 0, lineContext(content, line)));
1923
+ const line = offsetToLine(lineIndex, match.index ?? 0);
1924
+ refs.push(ref(filePath, match[1] ?? "", line, 0, lineTextAt(content, lineIndex, line)));
1932
1925
  }
1933
1926
  for (const match of markupNoComments.matchAll(/\bc:[A-Za-z_$][\w$]*/g)) {
1934
- const line = matchLine(markupNoComments, match.index ?? 0);
1935
- refs.push(ref(filePath, match[0], line, 0, lineContext(content, line)));
1927
+ const line = offsetToLine(lineIndex, match.index ?? 0);
1928
+ refs.push(ref(filePath, match[0], line, 0, lineTextAt(content, lineIndex, line)));
1936
1929
  }
1937
1930
  return {
1938
1931
  symbols: dedupe(symbols, (entry) => `${entry.name}\0${entry.kind}\0${entry.lineStart}`),
@@ -1945,10 +1938,10 @@ init_define_import_meta_env();
1945
1938
  function normalizeSource(source) {
1946
1939
  if (typeof source === "string") return source;
1947
1940
  if (!Array.isArray(source)) return "";
1948
- const lines2 = source.filter((s) => typeof s === "string");
1949
- if (lines2.length === 0) return "";
1950
- const noneEndWithNewline = lines2.every((l) => !l.endsWith("\n"));
1951
- return noneEndWithNewline ? lines2.join("\n") : lines2.join("");
1941
+ const lines = source.filter((s) => typeof s === "string");
1942
+ if (lines.length === 0) return "";
1943
+ const noneEndWithNewline = lines.every((l) => !l.endsWith("\n"));
1944
+ return noneEndWithNewline ? lines.join("\n") : lines.join("");
1952
1945
  }
1953
1946
  function resolveKernelLanguage(metadata) {
1954
1947
  const kernelspecLang = metadata?.kernelspec?.language;
@@ -2078,7 +2071,7 @@ function widenToDeclaration(node) {
2078
2071
  widened = parent;
2079
2072
  }
2080
2073
  }
2081
- function makeSymbol(filePath, name, kind, node, lines2, style) {
2074
+ function makeSymbol(filePath, name, kind, node, lines, style) {
2082
2075
  const ranged = widenToDeclaration(node);
2083
2076
  const lineStart = ranged.startPosition.row + 1;
2084
2077
  return {
@@ -2088,7 +2081,7 @@ function makeSymbol(filePath, name, kind, node, lines2, style) {
2088
2081
  lineStart,
2089
2082
  lineEnd: ranged.endPosition.row + 1,
2090
2083
  body: ranged.text,
2091
- docstring: lines2 !== void 0 && style !== void 0 ? precedingDocComment(lines2, lineStart, style) : "",
2084
+ docstring: lines !== void 0 && style !== void 0 ? precedingDocComment(lines, lineStart, style) : "",
2092
2085
  parent: ""
2093
2086
  };
2094
2087
  }
@@ -2160,7 +2153,7 @@ function isModuleWrapperCallback(node) {
2160
2153
  }
2161
2154
  return false;
2162
2155
  }
2163
- function extractTsJsSymbols(root, filePath, lines2) {
2156
+ function extractTsJsSymbols(root, filePath, lines) {
2164
2157
  const out = [];
2165
2158
  const visit = (node, insideFunction) => {
2166
2159
  const kind = TSJS_KIND_BY_TYPE.get(node.type);
@@ -2171,7 +2164,7 @@ function extractTsJsSymbols(root, filePath, lines2) {
2171
2164
  if (name !== null && name !== "") {
2172
2165
  const decorators = leadingTsDecorators(node);
2173
2166
  if (decorators.length === 0) {
2174
- out.push(makeSymbol(filePath, name, kind, node, lines2, "c"));
2167
+ out.push(makeSymbol(filePath, name, kind, node, lines, "c"));
2175
2168
  } else {
2176
2169
  const lineStart = decorators[0].startPosition.row + 1;
2177
2170
  const decoratedEnd = widenToDeclaration(node).endPosition.row + 1;
@@ -2190,8 +2183,8 @@ function extractTsJsSymbols(root, filePath, lines2) {
2190
2183
  // tree-sitter node never carries the indentation of its own first line,
2191
2184
  // because it starts at the first real character. Reading the span off the
2192
2185
  // file would otherwise make decorated symbols the one shape that does.
2193
- body: lines2.slice(lineStart - 1, decoratedEnd).join("\n").replace(/^[ \t]+/, ""),
2194
- docstring: precedingDocComment(lines2, lineStart, "c"),
2186
+ body: lines.slice(lineStart - 1, decoratedEnd).join("\n").replace(/^[ \t]+/, ""),
2187
+ docstring: precedingDocComment(lines, lineStart, "c"),
2195
2188
  parent: ""
2196
2189
  });
2197
2190
  }
@@ -2205,12 +2198,12 @@ function extractTsJsSymbols(root, filePath, lines2) {
2205
2198
  if (name === null) continue;
2206
2199
  if (name.type === "identifier") {
2207
2200
  const isFn = value !== null && (value.type === "arrow_function" || value.type === "function_expression" || value.type === "function");
2208
- out.push(makeSymbol(filePath, name.text, isFn ? "function" : "variable", child, lines2, "c"));
2201
+ out.push(makeSymbol(filePath, name.text, isFn ? "function" : "variable", child, lines, "c"));
2209
2202
  } else {
2210
2203
  const bindings = collectPatternBindings(name);
2211
2204
  const elideBodies = fanOutElidesBodies(bindings.length, child.text.length);
2212
2205
  for (const bound of bindings) {
2213
- const sym = makeSymbol(filePath, bound, "variable", child, lines2, "c");
2206
+ const sym = makeSymbol(filePath, bound, "variable", child, lines, "c");
2214
2207
  out.push(elideBodies ? { ...sym, body: "" } : sym);
2215
2208
  }
2216
2209
  }
@@ -2220,7 +2213,7 @@ function extractTsJsSymbols(root, filePath, lines2) {
2220
2213
  const fieldName = node.childForFieldName("name") ?? node.childForFieldName("property");
2221
2214
  const value = node.childForFieldName("value");
2222
2215
  if (fieldName !== null && value !== null && (value.type === "arrow_function" || value.type === "function_expression" || value.type === "function")) {
2223
- out.push(makeSymbol(filePath, fieldName.text, "method", node, lines2, "c"));
2216
+ out.push(makeSymbol(filePath, fieldName.text, "method", node, lines, "c"));
2224
2217
  }
2225
2218
  }
2226
2219
  if (node.type === "pair" && node.parent?.type === "object") {
@@ -2232,9 +2225,9 @@ function extractTsJsSymbols(root, filePath, lines2) {
2232
2225
  const isFn = value.type === "arrow_function" || value.type === "function_expression" || value.type === "function";
2233
2226
  const isObjectOrArray = value.type === "object" || value.type === "array";
2234
2227
  if (isFn) {
2235
- out.push(makeSymbol(filePath, keyName, "method", node, lines2, "c"));
2228
+ out.push(makeSymbol(filePath, keyName, "method", node, lines, "c"));
2236
2229
  } else if (isObjectOrArray && node.endPosition.row - node.startPosition.row >= 1) {
2237
- out.push(makeSymbol(filePath, keyName, "config", node, lines2, "c"));
2230
+ out.push(makeSymbol(filePath, keyName, "config", node, lines, "c"));
2238
2231
  }
2239
2232
  }
2240
2233
  }
@@ -2345,7 +2338,7 @@ var GO_LOCAL_KINDS = /* @__PURE__ */ new Set([
2345
2338
  "method_elem"
2346
2339
  ]);
2347
2340
  var GO_MULTI_NAME_SPECS = /* @__PURE__ */ new Set(["var_spec", "const_spec"]);
2348
- function extractGoSymbols(root, filePath, lines2) {
2341
+ function extractGoSymbols(root, filePath, lines) {
2349
2342
  const out = [];
2350
2343
  const visit = (node, insideFunction) => {
2351
2344
  const kind = GO_KIND_BY_TYPE.get(node.type);
@@ -2356,13 +2349,13 @@ function extractGoSymbols(root, filePath, lines2) {
2356
2349
  );
2357
2350
  const elideBodies = fanOutElidesBodies(declared.length, node.text.length);
2358
2351
  for (const child of declared) {
2359
- const sym = makeSymbol(filePath, child.text, kind, node, lines2, "c");
2352
+ const sym = makeSymbol(filePath, child.text, kind, node, lines, "c");
2360
2353
  out.push(elideBodies ? { ...sym, body: "" } : sym);
2361
2354
  }
2362
2355
  } else {
2363
2356
  const name = nodeName(node);
2364
2357
  if (name !== null && name !== "") {
2365
- out.push(makeSymbol(filePath, name, kind, node, lines2, "c"));
2358
+ out.push(makeSymbol(filePath, name, kind, node, lines, "c"));
2366
2359
  }
2367
2360
  }
2368
2361
  }
@@ -2453,7 +2446,7 @@ function leadingRustAttributes(node) {
2453
2446
  }
2454
2447
  return attrs;
2455
2448
  }
2456
- function extractRustSymbols(root, filePath, lines2) {
2449
+ function extractRustSymbols(root, filePath, lines) {
2457
2450
  const out = [];
2458
2451
  const visit = (node, insideFunction) => {
2459
2452
  const kind = RUST_KIND_BY_TYPE.get(node.type);
@@ -2462,7 +2455,7 @@ function extractRustSymbols(root, filePath, lines2) {
2462
2455
  if (name !== null && name !== "") {
2463
2456
  const attrs = leadingRustAttributes(node);
2464
2457
  if (attrs.length === 0) {
2465
- out.push(makeSymbol(filePath, name, kind, node, lines2, "c"));
2458
+ out.push(makeSymbol(filePath, name, kind, node, lines, "c"));
2466
2459
  } else {
2467
2460
  const lineStart = attrs[0].startPosition.row + 1;
2468
2461
  out.push({
@@ -2472,7 +2465,7 @@ function extractRustSymbols(root, filePath, lines2) {
2472
2465
  lineStart,
2473
2466
  lineEnd: node.endPosition.row + 1,
2474
2467
  body: [...attrs, node].map((n) => n.text).join("\n"),
2475
- docstring: precedingDocComment(lines2, lineStart, "c"),
2468
+ docstring: precedingDocComment(lines, lineStart, "c"),
2476
2469
  parent: ""
2477
2470
  });
2478
2471
  }
@@ -2492,14 +2485,14 @@ var RUBY_KIND_BY_TYPE = /* @__PURE__ */ new Map([
2492
2485
  ["class", "class"],
2493
2486
  ["module", "module"]
2494
2487
  ]);
2495
- function extractSimpleSymbols(root, filePath, kindByType, lines2, style, nameFor = nodeName) {
2488
+ function extractSimpleSymbols(root, filePath, kindByType, lines, style, nameFor = nodeName) {
2496
2489
  const out = [];
2497
2490
  const visit = (node) => {
2498
2491
  const kind = kindByType.get(node.type);
2499
2492
  if (kind !== void 0) {
2500
2493
  const name = nameFor(node);
2501
2494
  if (name !== null && name !== "") {
2502
- out.push(makeSymbol(filePath, name, kind, node, lines2, style));
2495
+ out.push(makeSymbol(filePath, name, kind, node, lines, style));
2503
2496
  }
2504
2497
  }
2505
2498
  for (const child of node.namedChildren) {
@@ -2509,8 +2502,8 @@ function extractSimpleSymbols(root, filePath, kindByType, lines2, style, nameFor
2509
2502
  visit(root);
2510
2503
  return out;
2511
2504
  }
2512
- function extractRubySymbols(root, filePath, lines2) {
2513
- return extractSimpleSymbols(root, filePath, RUBY_KIND_BY_TYPE, lines2, "hash");
2505
+ function extractRubySymbols(root, filePath, lines) {
2506
+ return extractSimpleSymbols(root, filePath, RUBY_KIND_BY_TYPE, lines, "hash");
2514
2507
  }
2515
2508
  var JAVA_KIND_BY_TYPE = /* @__PURE__ */ new Map([
2516
2509
  ["method_declaration", "method"],
@@ -2531,8 +2524,8 @@ var JAVA_KIND_BY_TYPE = /* @__PURE__ */ new Map([
2531
2524
  // the same kind as their bodied counterparts.
2532
2525
  ["annotation_type_element_declaration", "method"]
2533
2526
  ]);
2534
- function extractJavaSymbols(root, filePath, lines2) {
2535
- return extractSimpleSymbols(root, filePath, JAVA_KIND_BY_TYPE, lines2, "c");
2527
+ function extractJavaSymbols(root, filePath, lines) {
2528
+ return extractSimpleSymbols(root, filePath, JAVA_KIND_BY_TYPE, lines, "c");
2536
2529
  }
2537
2530
  var CPP_KIND_BY_TYPE = /* @__PURE__ */ new Map([
2538
2531
  ["function_definition", "function"],
@@ -2582,12 +2575,12 @@ var CPP_KIND_BY_TYPE = /* @__PURE__ */ new Map([
2582
2575
  // tag is skipped) for anything that isn't a genuine function prototype.
2583
2576
  ["declaration", "function"]
2584
2577
  ]);
2585
- function extractCppSymbols(root, filePath, lines2) {
2578
+ function extractCppSymbols(root, filePath, lines) {
2586
2579
  return extractSimpleSymbols(
2587
2580
  root,
2588
2581
  filePath,
2589
2582
  CPP_KIND_BY_TYPE,
2590
- lines2,
2583
+ lines,
2591
2584
  "c",
2592
2585
  (node) => node.type === "function_definition" ? cFunctionName(node) : node.type === "type_definition" ? cTypedefAliasName(node) : node.type === "declaration" ? cFunctionPrototypeName(node) : nodeName(node)
2593
2586
  );
@@ -3197,8 +3190,8 @@ function countNewlines(s) {
3197
3190
  }
3198
3191
  function extractMarkdownSymbols(content, filePath) {
3199
3192
  const out = [];
3200
- const lines2 = content.split(/\r?\n/);
3201
- const unfenced = Array.from(eachUnfencedLine(lines2));
3193
+ const lines = content.split(/\r?\n/);
3194
+ const unfenced = Array.from(eachUnfencedLine(lines));
3202
3195
  for (let u = 0; u < unfenced.length; u++) {
3203
3196
  const [i, line] = unfenced[u];
3204
3197
  const atxMatch = /^(#{1,6})\s+(.+?)(?:\s+#+\s*)?$/.exec(line);
@@ -3406,10 +3399,10 @@ function yamlLineClosesQuote(line, quote) {
3406
3399
  }
3407
3400
  function extractYamlSymbols(content, filePath) {
3408
3401
  const out = [];
3409
- const lines2 = content.split(/\r?\n/);
3402
+ const lines = content.split(/\r?\n/);
3410
3403
  let openQuote = null;
3411
- for (let i = 0; i < lines2.length; i++) {
3412
- const line = lines2[i];
3404
+ for (let i = 0; i < lines.length; i++) {
3405
+ const line = lines[i];
3413
3406
  if (line === void 0) continue;
3414
3407
  if (openQuote !== null) {
3415
3408
  if (yamlLineClosesQuote(line, openQuote)) openQuote = null;
@@ -3488,8 +3481,8 @@ var TOML_SIMPLE_KEY = `(?:[A-Za-z0-9_-]+|"(?:[^"\\\\]|\\\\.)*"|'[^']*')`;
3488
3481
  var TOML_KEY_RE = new RegExp(`^\\s*(${TOML_SIMPLE_KEY}(?:\\s*\\.\\s*${TOML_SIMPLE_KEY})*)\\s*=`);
3489
3482
  function extractTomlSymbols(content, filePath) {
3490
3483
  const out = [];
3491
- const lines2 = content.split(/\r?\n/);
3492
- function matchLine2(line, lineNum) {
3484
+ const lines = content.split(/\r?\n/);
3485
+ function matchLine(line, lineNum) {
3493
3486
  const sectionMatch = /^\s*\[\[?\s*([^\]]+)\s*\]/.exec(line);
3494
3487
  if (sectionMatch !== null && sectionMatch[1] !== void 0) {
3495
3488
  out.push({
@@ -3519,14 +3512,14 @@ function extractTomlSymbols(content, filePath) {
3519
3512
  }
3520
3513
  let openDelim = null;
3521
3514
  let arrayDepth = 0;
3522
- for (let i = 0; i < lines2.length; i++) {
3523
- const line = lines2[i];
3515
+ for (let i = 0; i < lines.length; i++) {
3516
+ const line = lines[i];
3524
3517
  if (line === void 0) continue;
3525
3518
  if (openDelim !== null) {
3526
3519
  const closeIdx = line.indexOf(openDelim);
3527
3520
  if (closeIdx === -1) continue;
3528
3521
  const restStart = closeIdx + openDelim.length;
3529
- matchLine2(line.slice(restStart), i);
3522
+ matchLine(line.slice(restStart), i);
3530
3523
  openDelim = lineOpenDelimiterAfter(stripTomlComment(line.slice(restStart)), 0);
3531
3524
  continue;
3532
3525
  }
@@ -3534,7 +3527,7 @@ function extractTomlSymbols(content, filePath) {
3534
3527
  arrayDepth = Math.max(0, arrayDepth + tomlBracketDelta(stripTomlComment(line)));
3535
3528
  continue;
3536
3529
  }
3537
- matchLine2(line, i);
3530
+ matchLine(line, i);
3538
3531
  const code = stripTomlComment(line);
3539
3532
  openDelim = lineOpenDelimiterAfter(code, 0);
3540
3533
  if (openDelim === null) arrayDepth = Math.max(0, tomlBracketDelta(code));
@@ -3557,9 +3550,9 @@ function splitTopLevelSelectors(rawCapture, strippedCapture) {
3557
3550
  parts.push(rawCapture.slice(start));
3558
3551
  return parts;
3559
3552
  }
3560
- function nextContentLineOpensBrace(lines2, i) {
3561
- for (let j = i + 1; j < lines2.length; j++) {
3562
- const next = lines2[j]?.trim() ?? "";
3553
+ function nextContentLineOpensBrace(lines, i) {
3554
+ for (let j = i + 1; j < lines.length; j++) {
3555
+ const next = lines[j]?.trim() ?? "";
3563
3556
  if (next.length === 0) continue;
3564
3557
  return next === "{";
3565
3558
  }
@@ -3567,11 +3560,11 @@ function nextContentLineOpensBrace(lines2, i) {
3567
3560
  }
3568
3561
  function extractCssSymbols(content, filePath) {
3569
3562
  const out = [];
3570
- const lines2 = stripCstyleComments(content).split(/\r?\n/);
3563
+ const lines = stripCstyleComments(content).split(/\r?\n/);
3571
3564
  const rawLines = content.split(/\r?\n/);
3572
3565
  let pending = [];
3573
- for (let i = 0; i < lines2.length; i++) {
3574
- const line = lines2[i];
3566
+ for (let i = 0; i < lines.length; i++) {
3567
+ const line = lines[i];
3575
3568
  if (line === void 0) continue;
3576
3569
  const trimmed = line.trim();
3577
3570
  if (trimmed.length === 0 && (rawLines[i]?.trim().length ?? 0) > 0) {
@@ -3631,7 +3624,7 @@ function extractCssSymbols(content, filePath) {
3631
3624
  }
3632
3625
  if (trimmed.length > 0 && !trimmed.startsWith("@") && !trimmed.includes("{") && !trimmed.includes("}") && !trimmed.includes(";")) {
3633
3626
  const endsWithComma = trimmed.endsWith(",");
3634
- if (endsWithComma || pending.length > 0 || nextContentLineOpensBrace(lines2, i)) {
3627
+ if (endsWithComma || pending.length > 0 || nextContentLineOpensBrace(lines, i)) {
3635
3628
  const name = endsWithComma ? trimmed.slice(0, -1).trim() : trimmed;
3636
3629
  if (name) pending.push({ name, line: i + 1, body: trimmed });
3637
3630
  continue;
@@ -3643,10 +3636,10 @@ function extractCssSymbols(content, filePath) {
3643
3636
  }
3644
3637
  function extractDockerfileSymbols(content, filePath) {
3645
3638
  const out = [];
3646
- const lines2 = content.split(/\r?\n/);
3639
+ const lines = content.split(/\r?\n/);
3647
3640
  let continuing = false;
3648
- for (let i = 0; i < lines2.length; i++) {
3649
- const line = lines2[i];
3641
+ for (let i = 0; i < lines.length; i++) {
3642
+ const line = lines[i];
3650
3643
  if (line === void 0) continue;
3651
3644
  if (continuing) {
3652
3645
  continuing = line.trimEnd().endsWith("\\");
@@ -3705,9 +3698,9 @@ var FALLBACK_PATTERNS = [
3705
3698
  ];
3706
3699
  function extractWithRegex(content, filePath) {
3707
3700
  const out = [];
3708
- const lines2 = content.split(/\r?\n/);
3709
- for (let i = 0; i < lines2.length; i++) {
3710
- const line = lines2[i];
3701
+ const lines = content.split(/\r?\n/);
3702
+ for (let i = 0; i < lines.length; i++) {
3703
+ const line = lines[i];
3711
3704
  if (line === void 0) continue;
3712
3705
  for (const { re, kind, style } of FALLBACK_PATTERNS) {
3713
3706
  const m = re.exec(line);
@@ -3719,7 +3712,7 @@ function extractWithRegex(content, filePath) {
3719
3712
  lineStart: i + 1,
3720
3713
  lineEnd: i + 1,
3721
3714
  body: line.trim(),
3722
- docstring: precedingDocComment(lines2, i + 1, style),
3715
+ docstring: precedingDocComment(lines, i + 1, style),
3723
3716
  parent: ""
3724
3717
  });
3725
3718
  break;
@@ -3929,7 +3922,7 @@ function parseSourceSymbolsTreeSitterOnly(content, filePath, language) {
3929
3922
  var REGEX_ADAPTERS_SLOT = /* @__PURE__ */ Symbol.for("token-goat.regex-adapters");
3930
3923
  var adapterSlot = globalThis;
3931
3924
  async function loadRegexExtractors() {
3932
- adapterSlot[REGEX_ADAPTERS_SLOT] ??= await import("./token-goat-chunk-6AQLZMCO.mjs");
3925
+ adapterSlot[REGEX_ADAPTERS_SLOT] ??= await import("./token-goat-chunk-VRS6B7UD.mjs");
3933
3926
  }
3934
3927
  function regexAdapters() {
3935
3928
  const loaded = adapterSlot[REGEX_ADAPTERS_SLOT];
@@ -4305,9 +4298,9 @@ var TABLE_HEADER_RE = /^\s*\[+\s*([^\]]+?)\s*\]+\s*(?:[#;].*)?$/;
4305
4298
  var PYTHON_HEADER_RE = /^(\s*)(?:async\s+)?(?:def|class)\s+([A-Za-z_]\w*)/;
4306
4299
  var KEYVALUE_HEADER_RE = /^([A-Za-z_][\w.-]*)\s*(?:=|:(?!\/\/))/;
4307
4300
  var ENV_KEYVALUE_HEADER_RE = /^(?:export\s+)?([A-Za-z_][\w.-]*)\s*(?:=|:(?!\/\/))/;
4308
- function findMarkdownHeaders(lines2) {
4301
+ function findMarkdownHeaders(lines) {
4309
4302
  const headers = [];
4310
- const unfenced = Array.from(eachUnfencedLine(lines2));
4303
+ const unfenced = Array.from(eachUnfencedLine(lines));
4311
4304
  for (let u = 0; u < unfenced.length; u++) {
4312
4305
  const [i, line] = unfenced[u];
4313
4306
  const m = MARKDOWN_HEADER_RE.exec(line);
@@ -4335,12 +4328,12 @@ function findMarkdownHeaders(lines2) {
4335
4328
  }
4336
4329
  return headers;
4337
4330
  }
4338
- function findTableHeaders(lines2, isToml) {
4331
+ function findTableHeaders(lines, isToml) {
4339
4332
  const headers = [];
4340
4333
  let openDelim = null;
4341
4334
  let arrayDepth = 0;
4342
- for (let i = 0; i < lines2.length; i++) {
4343
- const line = lines2[i];
4335
+ for (let i = 0; i < lines.length; i++) {
4336
+ const line = lines[i];
4344
4337
  if (line === void 0) continue;
4345
4338
  if (openDelim !== null) {
4346
4339
  const closeIdx = line.indexOf(openDelim);
@@ -4401,10 +4394,10 @@ function extractShellBannerHeading(line) {
4401
4394
  }
4402
4395
  return null;
4403
4396
  }
4404
- function findShellBannerHeaders(lines2) {
4397
+ function findShellBannerHeaders(lines) {
4405
4398
  const headers = [];
4406
- for (let i = 0; i < lines2.length; i++) {
4407
- const line = lines2[i] ?? "";
4399
+ for (let i = 0; i < lines.length; i++) {
4400
+ const line = lines[i] ?? "";
4408
4401
  const banner = extractShellBannerHeading(line);
4409
4402
  if (banner !== null) {
4410
4403
  headers.push({ heading: banner.heading, level: banner.level, index: i });
@@ -4412,11 +4405,11 @@ function findShellBannerHeaders(lines2) {
4412
4405
  }
4413
4406
  return headers;
4414
4407
  }
4415
- function findVbRegionHeaders(lines2) {
4408
+ function findVbRegionHeaders(lines) {
4416
4409
  const headers = [];
4417
4410
  const open = [];
4418
- for (let i = 0; i < lines2.length; i++) {
4419
- const line = lines2[i] ?? "";
4411
+ for (let i = 0; i < lines.length; i++) {
4412
+ const line = lines[i] ?? "";
4420
4413
  const m = VB_REGION_RE.exec(line);
4421
4414
  if (m !== null) {
4422
4415
  open.push(headers.length);
@@ -4436,12 +4429,12 @@ function headerEndIndex(headers, kind, headerPos, totalLines) {
4436
4429
  if (explicit !== void 0) return explicit;
4437
4430
  return kind === "table-toml" ? tableSectionEndIndex(headers, headerPos, totalLines) : sectionEndIndex(headers, headerPos, totalLines);
4438
4431
  }
4439
- function findPythonHeaders(lines2) {
4432
+ function findPythonHeaders(lines) {
4440
4433
  const headers = [];
4441
4434
  const indentStack = [];
4442
4435
  let openDelim = null;
4443
- for (let i = 0; i < lines2.length; i++) {
4444
- const line = lines2[i];
4436
+ for (let i = 0; i < lines.length; i++) {
4437
+ const line = lines[i];
4445
4438
  if (line === void 0) continue;
4446
4439
  if (openDelim !== null) {
4447
4440
  const closeIdx = line.indexOf(openDelim);
@@ -4465,12 +4458,12 @@ function findPythonHeaders(lines2) {
4465
4458
  }
4466
4459
  return headers;
4467
4460
  }
4468
- function findKeyValueHeaders(lines2, language) {
4461
+ function findKeyValueHeaders(lines, language) {
4469
4462
  const headers = [];
4470
4463
  const isEnv = language === "env_file";
4471
4464
  let openQuote = null;
4472
- for (let i = 0; i < lines2.length; i++) {
4473
- const line = lines2[i];
4465
+ for (let i = 0; i < lines.length; i++) {
4466
+ const line = lines[i];
4474
4467
  if (line === void 0) continue;
4475
4468
  if (openQuote !== null) {
4476
4469
  const closed = isEnv ? _lineClosesQuote(line, openQuote) : yamlLineClosesQuote(line, openQuote);
@@ -4496,24 +4489,24 @@ function findHtmlHeaders(text) {
4496
4489
  return headers;
4497
4490
  }
4498
4491
  function findHeaders(text, language) {
4499
- const lines2 = text.split("\n");
4500
- if (language === "markdown") return { headers: findMarkdownHeaders(lines2), kind: "markdown" };
4492
+ const lines = text.split("\n");
4493
+ if (language === "markdown") return { headers: findMarkdownHeaders(lines), kind: "markdown" };
4501
4494
  if (language === "html" || language === "liquid") return { headers: findHtmlHeaders(text), kind: "markdown" };
4502
- if (language === "toml") return { headers: findTableHeaders(lines2, true), kind: "table-toml" };
4503
- if (language === "python") return { headers: findPythonHeaders(lines2), kind: "python" };
4495
+ if (language === "toml") return { headers: findTableHeaders(lines, true), kind: "table-toml" };
4496
+ if (language === "python") return { headers: findPythonHeaders(lines), kind: "python" };
4504
4497
  if (language === "bash") {
4505
- const banners = findShellBannerHeaders(lines2);
4498
+ const banners = findShellBannerHeaders(lines);
4506
4499
  if (banners.length > 0) return { headers: banners, kind: "banner" };
4507
4500
  }
4508
- if (language === "vb") return { headers: findVbRegionHeaders(lines2), kind: "region" };
4509
- if (language === "ini") return { headers: findTableHeaders(lines2, false), kind: "table-flat" };
4501
+ if (language === "vb") return { headers: findVbRegionHeaders(lines), kind: "region" };
4502
+ if (language === "ini") return { headers: findTableHeaders(lines, false), kind: "table-flat" };
4510
4503
  if (language === "yaml" || language === "env_file")
4511
- return { headers: findKeyValueHeaders(lines2, language), kind: "keyvalue" };
4512
- const md = findMarkdownHeaders(lines2);
4504
+ return { headers: findKeyValueHeaders(lines, language), kind: "keyvalue" };
4505
+ const md = findMarkdownHeaders(lines);
4513
4506
  if (md.length > 0) return { headers: md, kind: "markdown" };
4514
- const tbl = findTableHeaders(lines2, false);
4507
+ const tbl = findTableHeaders(lines, false);
4515
4508
  if (tbl.length > 0) return { headers: tbl, kind: "table-toml" };
4516
- return { headers: findKeyValueHeaders(lines2, language), kind: "keyvalue" };
4509
+ return { headers: findKeyValueHeaders(lines, language), kind: "keyvalue" };
4517
4510
  }
4518
4511
  function sectionEndIndex(headers, headerPos, totalLines) {
4519
4512
  const current = headers[headerPos];
@@ -4699,15 +4692,15 @@ function resolveHeaderPos(headers, base, ordinal, allowFuzzy = true) {
4699
4692
  }
4700
4693
  return null;
4701
4694
  }
4702
- function buildSectionResult(headers, kind, lines2, headerPos, redirectedFrom) {
4695
+ function buildSectionResult(headers, kind, lines, headerPos, redirectedFrom) {
4703
4696
  const header = headers[headerPos];
4704
4697
  if (header === void 0) return null;
4705
- const endIndex = headerEndIndex(headers, kind, headerPos, lines2.length);
4698
+ const endIndex = headerEndIndex(headers, kind, headerPos, lines.length);
4706
4699
  let endExclusive = endIndex;
4707
- while (endExclusive > header.index + 1 && (lines2[endExclusive - 1] === "" || lines2[endExclusive - 1] === "\r")) {
4700
+ while (endExclusive > header.index + 1 && (lines[endExclusive - 1] === "" || lines[endExclusive - 1] === "\r")) {
4708
4701
  endExclusive--;
4709
4702
  }
4710
- const content = lines2.slice(header.index, endExclusive).join("\n");
4703
+ const content = lines.slice(header.index, endExclusive).join("\n");
4711
4704
  const result = {
4712
4705
  heading: header.heading,
4713
4706
  content,
@@ -4720,10 +4713,10 @@ function resolveSectionFromText(text, headingSpec, language, allowFuzzy = true)
4720
4713
  const { headers, kind } = findHeaders(text, language);
4721
4714
  const { base, ordinal } = parseHeadingSpec(headingSpec, headers);
4722
4715
  if (base.length === 0) return null;
4723
- const lines2 = text.split("\n");
4716
+ const lines = text.split("\n");
4724
4717
  const resolved = resolveHeaderPos(headers, base, ordinal, allowFuzzy);
4725
4718
  if (resolved === null) return null;
4726
- const built = buildSectionResult(headers, kind, lines2, resolved.headerPos, resolved.redirectedFrom);
4719
+ const built = buildSectionResult(headers, kind, lines, resolved.headerPos, resolved.redirectedFrom);
4727
4720
  if (built === null || resolved.occurrences === null) return built;
4728
4721
  return { ...built, occurrences: resolved.occurrences };
4729
4722
  }
@@ -4759,13 +4752,13 @@ function findContainingSection(filePath, lineStart, lineEnd, readFn) {
4759
4752
  const language = refineLanguageByContent(filePath, detectLanguage(filePath), text);
4760
4753
  const { headers, kind } = findHeaders(text, language);
4761
4754
  if (headers.length === 0) return null;
4762
- const lines2 = text.split("\n");
4755
+ const lines = text.split("\n");
4763
4756
  let bestPos = -1;
4764
4757
  let bestHeaderLine = -1;
4765
4758
  for (let i = 0; i < headers.length; i++) {
4766
4759
  const header = headers[i];
4767
4760
  if (header === void 0) continue;
4768
- const endIndex = headerEndIndex(headers, kind, i, lines2.length);
4761
+ const endIndex = headerEndIndex(headers, kind, i, lines.length);
4769
4762
  const sectionLineStart = header.index + 1;
4770
4763
  if (sectionLineStart <= lineStart && lineEnd <= endIndex) {
4771
4764
  if (header.index > bestHeaderLine) {
@@ -4775,7 +4768,7 @@ function findContainingSection(filePath, lineStart, lineEnd, readFn) {
4775
4768
  }
4776
4769
  }
4777
4770
  if (bestPos === -1) return null;
4778
- const result = buildSectionResult(headers, kind, lines2, bestPos, null);
4771
+ const result = buildSectionResult(headers, kind, lines, bestPos, null);
4779
4772
  if (result === null) return null;
4780
4773
  const bestHeader = headers[bestPos];
4781
4774
  if (bestHeader === void 0) return result;