@aiderdesk/aiderdesk 0.76.0 → 0.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/out/cli.js +124 -17
  2. package/out/renderer/assets/{AgentSettings-Dc8h1zSI.js → AgentSettings-B73lGg-P.js} +2 -2
  3. package/out/renderer/assets/{InfoIcon-BuABw5oZ.js → InfoIcon-BaDK-htg.js} +1 -1
  4. package/out/renderer/assets/{Onboarding-lX23sGcW.js → Onboarding-CttlAepw.js} +4 -4
  5. package/out/renderer/assets/{ProviderHeader-s7JSikLR.js → ProviderHeader-B0-K9908.js} +2 -2
  6. package/out/renderer/assets/{SettingsPage-CcsH6kmE.js → SettingsPage-BtyX7Wv1.js} +40 -11
  7. package/out/renderer/assets/{UsageDashboard-oAQNYvYh.js → UsageDashboard-CKuev9SP.js} +3 -3
  8. package/out/renderer/assets/{arc-BiaIwS79.js → arc-CDCMm4PF.js} +1 -1
  9. package/out/renderer/assets/{architectureDiagram-3BPJPVTR-d7fu6X13.js → architectureDiagram-3BPJPVTR-DoyTFQYe.js} +3 -3
  10. package/out/renderer/assets/{blockDiagram-GPEHLZMM-CWD8GVpw.js → blockDiagram-GPEHLZMM-CophuS51.js} +4 -4
  11. package/out/renderer/assets/{c4Diagram-AAUBKEIU-b5nYOm14.js → c4Diagram-AAUBKEIU-Dc3YxNWW.js} +2 -2
  12. package/out/renderer/assets/{channel-B99g0IUF.js → channel-cZzRDUFG.js} +1 -1
  13. package/out/renderer/assets/{chunk-2J33WTMH-DmrXuNY-.js → chunk-2J33WTMH-YV6ZtOyU.js} +1 -1
  14. package/out/renderer/assets/{chunk-4BX2VUAB-4Soxfj2i.js → chunk-4BX2VUAB-DKNGjk29.js} +1 -1
  15. package/out/renderer/assets/{chunk-55IACEB6-BtS727h4.js → chunk-55IACEB6-MkIW5gHI.js} +1 -1
  16. package/out/renderer/assets/{chunk-727SXJPM-CVxcBF7D.js → chunk-727SXJPM-CPUXDO_8.js} +5 -5
  17. package/out/renderer/assets/{chunk-AQP2D5EJ-m8ArTZfD.js → chunk-AQP2D5EJ-CYCp3XBh.js} +3 -3
  18. package/out/renderer/assets/{chunk-FMBD7UC4-yWO_9Kky.js → chunk-FMBD7UC4-DIj-DOVN.js} +1 -1
  19. package/out/renderer/assets/{chunk-ND2GUHAM-BkVCmcvx.js → chunk-ND2GUHAM-BWiS_Ttp.js} +1 -1
  20. package/out/renderer/assets/{chunk-QZHKN3VN-DwLbWeqf.js → chunk-QZHKN3VN-4NHol9Dz.js} +1 -1
  21. package/out/renderer/assets/{classDiagram-4FO5ZUOK-B3t9RWJZ.js → classDiagram-4FO5ZUOK-C1yfJEIb.js} +6 -6
  22. package/out/renderer/assets/{classDiagram-v2-Q7XG4LA2-B3t9RWJZ.js → classDiagram-v2-Q7XG4LA2-C1yfJEIb.js} +6 -6
  23. package/out/renderer/assets/{cose-bilkent-S5V4N54A-W70GNPEp.js → cose-bilkent-S5V4N54A-B8D60fQa.js} +1 -1
  24. package/out/renderer/assets/{dagre-BM42HDAG-D_Val_ih.js → dagre-BM42HDAG-5_V5lQc0.js} +3 -3
  25. package/out/renderer/assets/{diagram-2AECGRRQ-Z7UeOtJN.js → diagram-2AECGRRQ-Bb4cbiKY.js} +3 -3
  26. package/out/renderer/assets/{diagram-5GNKFQAL-DY9Yifty.js → diagram-5GNKFQAL-DQ_vjlxb.js} +4 -4
  27. package/out/renderer/assets/{diagram-KO2AKTUF-CGi0HZww.js → diagram-KO2AKTUF-So0t9fVd.js} +3 -3
  28. package/out/renderer/assets/{diagram-LMA3HP47-bdoVxL2p.js → diagram-LMA3HP47-CbSRJgt4.js} +3 -3
  29. package/out/renderer/assets/{diagram-OG6HWLK6-2K829auL.js → diagram-OG6HWLK6-Bls2tZCJ.js} +4 -4
  30. package/out/renderer/assets/{erDiagram-TEJ5UH35-D4sO1GH8.js → erDiagram-TEJ5UH35-CESbOlvh.js} +4 -4
  31. package/out/renderer/assets/{flowDiagram-I6XJVG4X-DQNz4Jg_.js → flowDiagram-I6XJVG4X-B-35DKDx.js} +6 -6
  32. package/out/renderer/assets/{ganttDiagram-6RSMTGT7-B3dUFX1p.js → ganttDiagram-6RSMTGT7-BL1OQkTj.js} +3 -3
  33. package/out/renderer/assets/{gitGraphDiagram-PVQCEYII-B95Lrq_7.js → gitGraphDiagram-PVQCEYII-SJkGLAAz.js} +4 -4
  34. package/out/renderer/assets/{graph-7kCtdoo_.js → graph-BSxR7Gef.js} +1 -1
  35. package/out/renderer/assets/{index-B2TL7Kll.js → index-BVOpoJw8.js} +1 -1
  36. package/out/renderer/assets/{index-58fbbmhI.js → index-BqZxyppq.js} +1 -1
  37. package/out/renderer/assets/{index-CNgsMipO.js → index-Cmn9J2p1.js} +4692 -1953
  38. package/out/renderer/assets/{index-BnFS7uhp.js → index-DFODyrlX.js} +3 -3
  39. package/out/renderer/assets/{index-BoogYopJ.js → index-DGcKtfCM.js} +1 -1
  40. package/out/renderer/assets/{index-DcD881Q1.css → index-DVEVSdXO.css} +21 -0
  41. package/out/renderer/assets/{index-pvhejocY.js → index-DgDxO_E3.js} +1 -1
  42. package/out/renderer/assets/{index-CRfveI6m.js → index-HJk8ZKtm.js} +1 -1
  43. package/out/renderer/assets/{index-Bihcg0ql.js → index-NF_MxNl9.js} +1 -1
  44. package/out/renderer/assets/{index-BHaWBJe9.js → index-VX8ukL4o.js} +1 -1
  45. package/out/renderer/assets/{index-GRVDmgjb.js → index-xCqv98zj.js} +1 -1
  46. package/out/renderer/assets/{infoDiagram-5YYISTIA-C0OH2to7.js → infoDiagram-5YYISTIA-lRTvqfXx.js} +2 -2
  47. package/out/renderer/assets/{ishikawaDiagram-YF4QCWOH-DsgR-cKp.js → ishikawaDiagram-YF4QCWOH-CtsU-ctO.js} +1 -1
  48. package/out/renderer/assets/{journeyDiagram-JHISSGLW-Bg6okgzG.js → journeyDiagram-JHISSGLW-3MrLeKXj.js} +4 -4
  49. package/out/renderer/assets/{jsx-dev-runtime-DLJNe6VM.js → jsx-dev-runtime-BTcJ8PkQ.js} +1 -1
  50. package/out/renderer/assets/{kanban-definition-UN3LZRKU-1UvLCrWk.js → kanban-definition-UN3LZRKU-CinUVJ12.js} +2 -2
  51. package/out/renderer/assets/{layout-9w0fH2nL.js → layout-C9eRMSnE.js} +2 -2
  52. package/out/renderer/assets/{linear-WTE7GZY2.js → linear-WwW43_Ig.js} +1 -1
  53. package/out/renderer/assets/{mindmap-definition-RKZ34NQL-BlxjYw-a.js → mindmap-definition-RKZ34NQL-B-K0dkdA.js} +3 -3
  54. package/out/renderer/assets/{pieDiagram-4H26LBE5-C4jZuzAH.js → pieDiagram-4H26LBE5-eotxzUOT.js} +4 -4
  55. package/out/renderer/assets/pierre-dark-BL-l9r39.js +4 -0
  56. package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-BBjGuJQU.js +4 -0
  57. package/out/renderer/assets/pierre-dark-soft-B6TBhICr.js +4 -0
  58. package/out/renderer/assets/pierre-dark-tritanopia-f-j_EX9A.js +4 -0
  59. package/out/renderer/assets/pierre-dark-vibrant-yElMGqZN.js +4 -0
  60. package/out/renderer/assets/pierre-light-BUzWTcjO.js +4 -0
  61. package/out/renderer/assets/pierre-light-protanopia-deuteranopia-DlvVSCaI.js +4 -0
  62. package/out/renderer/assets/pierre-light-soft-CCMU-Zh0.js +4 -0
  63. package/out/renderer/assets/pierre-light-tritanopia-v4xacE1C.js +4 -0
  64. package/out/renderer/assets/pierre-light-vibrant-BRUbQnMc.js +4 -0
  65. package/out/renderer/assets/{quadrantDiagram-W4KKPZXB-BLG4PrcM.js → quadrantDiagram-W4KKPZXB-BtKKvYmW.js} +2 -2
  66. package/out/renderer/assets/{requirementDiagram-4Y6WPE33-CTTFFDvR.js → requirementDiagram-4Y6WPE33-k_JQl4AM.js} +3 -3
  67. package/out/renderer/assets/{sankeyDiagram-5OEKKPKP-CjDlOfXf.js → sankeyDiagram-5OEKKPKP-BVDWaFSn.js} +1 -1
  68. package/out/renderer/assets/{sequenceDiagram-3UESZ5HK-6PJo_0SQ.js → sequenceDiagram-3UESZ5HK-dpVnolZO.js} +3 -3
  69. package/out/renderer/assets/{stateDiagram-AJRCARHV-Cnhm9mmx.js → stateDiagram-AJRCARHV-DYd-R9tJ.js} +6 -6
  70. package/out/renderer/assets/{stateDiagram-v2-BHNVJYJU-BxKTEg-3.js → stateDiagram-v2-BHNVJYJU-CyE2HX6z.js} +4 -4
  71. package/out/renderer/assets/{time-YGhgEMYh.js → time-Claj2vse.js} +1 -1
  72. package/out/renderer/assets/{timeline-definition-PNZ67QCA-ooi5Tti4.js → timeline-definition-PNZ67QCA-0vKYrH6S.js} +2 -2
  73. package/out/renderer/assets/{vennDiagram-CIIHVFJN-B_kwCHhU.js → vennDiagram-CIIHVFJN-op3DVQGG.js} +1 -1
  74. package/out/renderer/assets/{wardley-L42UT6IY-Dnx4ZTc4.js → wardley-L42UT6IY-CsNzYaF9.js} +1 -1
  75. package/out/renderer/assets/{wardleyDiagram-YWT4CUSO-cqZcXF7R.js → wardleyDiagram-YWT4CUSO-D3jK8kAv.js} +3 -3
  76. package/out/renderer/assets/{worker-BdXuKH1Q.js → worker-CdcPcIJG.js} +322 -102
  77. package/out/renderer/assets/{xychartDiagram-2RQKCTM6-BBUpFNY4.js → xychartDiagram-2RQKCTM6-C9wPvZAU.js} +2 -2
  78. package/out/renderer/index.html +2 -2
  79. package/out/resources/connector/connector.py +3 -1
  80. package/out/resources/prompts/init-project.hbs +16 -42
  81. package/out/resources/prompts/system-prompt.hbs +25 -60
  82. package/out/resources/prompts/workflow.hbs +17 -52
  83. package/out/resources/skills/extension-creator/SKILL.md +1 -0
  84. package/out/resources/skills/extension-creator/references/event-types.md +13 -1
  85. package/out/runner.js +819 -156
  86. package/package.json +2 -2
  87. package/out/renderer/assets/pierre-dark-C-Drv5KU.js +0 -4
  88. package/out/renderer/assets/pierre-dark-soft-Cd74uQaL.js +0 -4
  89. package/out/renderer/assets/pierre-light-CfQnmt6J.js +0 -4
  90. package/out/renderer/assets/pierre-light-soft-DMVdU74b.js +0 -4
@@ -10273,7 +10273,7 @@ class JavaScriptScanner {
10273
10273
  this.options = options;
10274
10274
  const {
10275
10275
  forgiving = false,
10276
- cache,
10276
+ cache: cache2,
10277
10277
  regexConstructor
10278
10278
  } = options;
10279
10279
  if (!regexConstructor) {
@@ -10283,7 +10283,7 @@ class JavaScriptScanner {
10283
10283
  if (typeof p2 !== "string") {
10284
10284
  return p2;
10285
10285
  }
10286
- const cached = cache?.get(p2);
10286
+ const cached = cache2?.get(p2);
10287
10287
  if (cached) {
10288
10288
  if (cached instanceof RegExp) {
10289
10289
  return cached;
@@ -10294,10 +10294,10 @@ class JavaScriptScanner {
10294
10294
  }
10295
10295
  try {
10296
10296
  const regex = regexConstructor(p2);
10297
- cache?.set(p2, regex);
10297
+ cache2?.set(p2, regex);
10298
10298
  return regex;
10299
10299
  } catch (e) {
10300
- cache?.set(p2, e);
10300
+ cache2?.set(p2, e);
10301
10301
  if (forgiving)
10302
10302
  return null;
10303
10303
  throw e;
@@ -10839,6 +10839,118 @@ async function createOnigurumaEngine(options) {
10839
10839
  }
10840
10840
  };
10841
10841
  }
10842
+ function unwrapDefault(value) {
10843
+ return value !== null && typeof value === "object" && "default" in value ? value.default : value;
10844
+ }
10845
+ var DuplicateThemeError = class extends Error {
10846
+ constructor(name) {
10847
+ super(`Theme "${name}" is already registered`);
10848
+ this.name = "DuplicateThemeError";
10849
+ }
10850
+ };
10851
+ var UnregisteredThemeError = class extends Error {
10852
+ constructor(name) {
10853
+ super(`No loader registered for theme "${name}"`);
10854
+ this.name = "UnregisteredThemeError";
10855
+ }
10856
+ };
10857
+ var UnresolvedThemeError = class extends Error {
10858
+ constructor(name) {
10859
+ super(`Theme "${name}" has not been resolved`);
10860
+ this.name = "UnresolvedThemeError";
10861
+ }
10862
+ };
10863
+ function createThemeResolver() {
10864
+ const loaders = /* @__PURE__ */ new Map();
10865
+ const resolved = /* @__PURE__ */ new Map();
10866
+ const inflight = /* @__PURE__ */ new Map();
10867
+ let cacheGeneration = 0;
10868
+ function registerTheme(name, loader) {
10869
+ if (loaders.has(name)) throw new DuplicateThemeError(name);
10870
+ loaders.set(name, loader);
10871
+ }
10872
+ function registerThemeIfAbsent(name, loader) {
10873
+ if (loaders.has(name)) return false;
10874
+ loaders.set(name, loader);
10875
+ return true;
10876
+ }
10877
+ function hasRegisteredTheme(name) {
10878
+ return loaders.has(name);
10879
+ }
10880
+ function resolveTheme(name) {
10881
+ const cached = resolved.get(name);
10882
+ if (cached !== void 0) return Promise.resolve(cached);
10883
+ const existing = inflight.get(name);
10884
+ if (existing !== void 0) return existing;
10885
+ const loader = loaders.get(name);
10886
+ if (loader === void 0) return Promise.reject(new UnregisteredThemeError(name));
10887
+ const generation = cacheGeneration;
10888
+ const promise = loader().then((result) => {
10889
+ const theme = unwrapDefault(result);
10890
+ if (generation === cacheGeneration) resolved.set(name, theme);
10891
+ if (inflight.get(name) === promise) inflight.delete(name);
10892
+ return theme;
10893
+ }).catch((err) => {
10894
+ if (inflight.get(name) === promise) inflight.delete(name);
10895
+ throw err;
10896
+ });
10897
+ inflight.set(name, promise);
10898
+ return promise;
10899
+ }
10900
+ function resolveThemes2(names) {
10901
+ return Promise.all(names.map((name) => resolveTheme(name)));
10902
+ }
10903
+ function seedResolvedTheme(name, theme) {
10904
+ resolved.set(name, theme);
10905
+ }
10906
+ function seedResolvedThemes(entries) {
10907
+ for (const [name, theme] of entries) seedResolvedTheme(name, theme);
10908
+ }
10909
+ function getResolvedTheme(name) {
10910
+ return resolved.get(name);
10911
+ }
10912
+ function getResolvedThemes(names) {
10913
+ const themes = [];
10914
+ for (const name of names) {
10915
+ const theme = resolved.get(name);
10916
+ if (theme === void 0) throw new UnresolvedThemeError(name);
10917
+ themes.push(theme);
10918
+ }
10919
+ return themes;
10920
+ }
10921
+ function hasResolvedTheme(name) {
10922
+ return resolved.has(name);
10923
+ }
10924
+ function hasResolvedThemes(names) {
10925
+ for (const name of names) if (!resolved.has(name)) return false;
10926
+ return true;
10927
+ }
10928
+ function getResolvedOrResolveTheme(name) {
10929
+ const cached = resolved.get(name);
10930
+ if (cached !== void 0) return cached;
10931
+ return resolveTheme(name);
10932
+ }
10933
+ function clearResolvedThemes() {
10934
+ cacheGeneration++;
10935
+ resolved.clear();
10936
+ inflight.clear();
10937
+ }
10938
+ return {
10939
+ clearResolvedThemes,
10940
+ getResolvedOrResolveTheme,
10941
+ getResolvedTheme,
10942
+ getResolvedThemes,
10943
+ hasRegisteredTheme,
10944
+ hasResolvedTheme,
10945
+ hasResolvedThemes,
10946
+ registerTheme,
10947
+ registerThemeIfAbsent,
10948
+ resolveTheme,
10949
+ resolveThemes: resolveThemes2,
10950
+ seedResolvedTheme,
10951
+ seedResolvedThemes
10952
+ };
10953
+ }
10842
10954
  class Diff {
10843
10955
  diff(oldStr, newStr, options = {}) {
10844
10956
  let callback;
@@ -11131,6 +11243,108 @@ function cyrb53(str, seed = 0) {
11131
11243
  h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
11132
11244
  return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36).slice(0, 6);
11133
11245
  }
11246
+ const HEX_TRANSPARENT_RE = /^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i;
11247
+ const ALPHA_ZERO_RE = /^0(?:\.0+)?%?$/;
11248
+ function getFunctionalAlpha(color) {
11249
+ const openParen = color.indexOf("(");
11250
+ if (openParen <= 0 || !color.endsWith(")")) return;
11251
+ const fn = color.slice(0, openParen).trim();
11252
+ if (!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(fn)) return;
11253
+ const inner = color.slice(openParen + 1, -1).trim();
11254
+ if (inner.length === 0) return;
11255
+ const slashIndex = inner.lastIndexOf("/");
11256
+ if (slashIndex !== -1) return inner.slice(slashIndex + 1).trim();
11257
+ if (/^(?:rgba|hsla)$/i.test(fn)) {
11258
+ const parts = inner.split(",");
11259
+ if (parts.length === 4) return parts[3]?.trim();
11260
+ }
11261
+ }
11262
+ function parseHexRgba(color) {
11263
+ const match = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(color.trim());
11264
+ if (match == null) return null;
11265
+ const hex = match[1];
11266
+ let expanded;
11267
+ let alpha = 1;
11268
+ if (hex.length === 3) expanded = hex.split("").map((c) => c + c).join("");
11269
+ else if (hex.length === 6) expanded = hex;
11270
+ else {
11271
+ expanded = hex.slice(0, 6);
11272
+ alpha = parseInt(hex.slice(6, 8), 16) / 255;
11273
+ }
11274
+ return [
11275
+ parseInt(expanded.slice(0, 2), 16),
11276
+ parseInt(expanded.slice(2, 4), 16),
11277
+ parseInt(expanded.slice(4, 6), 16),
11278
+ alpha
11279
+ ];
11280
+ }
11281
+ function relativeLuminance(color) {
11282
+ if (color == null) return null;
11283
+ const rgba = parseHexRgba(color);
11284
+ if (rgba == null) return null;
11285
+ const r2 = rgba[0] / 255;
11286
+ const g = rgba[1] / 255;
11287
+ const b2 = rgba[2] / 255;
11288
+ const channel = (v2) => v2 <= 0.03928 ? v2 / 12.92 : ((v2 + 0.055) / 1.055) ** 2.4;
11289
+ return 0.2126 * channel(r2) + 0.7152 * channel(g) + 0.0722 * channel(b2);
11290
+ }
11291
+ function isFullyTransparent(color) {
11292
+ if (color == null) return false;
11293
+ const normalized = color.trim().toLowerCase();
11294
+ if (normalized === "transparent") return true;
11295
+ if (HEX_TRANSPARENT_RE.test(normalized)) return true;
11296
+ const alpha = getFunctionalAlpha(normalized);
11297
+ return alpha != null && ALPHA_ZERO_RE.test(alpha);
11298
+ }
11299
+ function hoverWouldEraseText(hover, bg, fg) {
11300
+ if (bg == null || fg == null) return false;
11301
+ const hoverL = relativeLuminance(hover);
11302
+ const bgL = relativeLuminance(bg);
11303
+ const fgL = relativeLuminance(fg);
11304
+ if (hoverL == null || bgL == null || fgL == null) return false;
11305
+ return Math.abs(hoverL - fgL) < Math.abs(hoverL - bgL);
11306
+ }
11307
+ const cache = /* @__PURE__ */ new WeakMap();
11308
+ function normalizeThemeColors(theme) {
11309
+ const cached = cache.get(theme);
11310
+ if (cached != null) return cached;
11311
+ const originalColors = theme.colors ?? {};
11312
+ const colors = { ...originalColors };
11313
+ const editorBackground = originalColors["editor.background"] ?? theme.bg;
11314
+ const editorForeground = originalColors["editor.foreground"] ?? theme.fg;
11315
+ const sidebarBackground = originalColors["sideBar.background"] ?? editorBackground;
11316
+ const sidebarForeground = originalColors["sideBar.foreground"] ?? editorForeground;
11317
+ fill(colors, "editor.background", editorBackground);
11318
+ fill(colors, "editor.foreground", editorForeground);
11319
+ fill(colors, "sideBar.background", sidebarBackground);
11320
+ fill(colors, "sideBar.foreground", sidebarForeground);
11321
+ fill(colors, "input.background", originalColors["input.background"] ?? sidebarBackground);
11322
+ fill(colors, "sideBarSectionHeader.foreground", originalColors["sideBarSectionHeader.foreground"] ?? sidebarForeground);
11323
+ fill(colors, "list.activeSelectionForeground", originalColors["list.activeSelectionForeground"] ?? sidebarForeground);
11324
+ fill(colors, "gitDecoration.addedResourceForeground", firstColor(originalColors["gitDecoration.addedResourceForeground"], originalColors["terminal.ansiGreen"], originalColors["editorGutter.addedBackground"]));
11325
+ fill(colors, "gitDecoration.modifiedResourceForeground", firstColor(originalColors["gitDecoration.modifiedResourceForeground"], originalColors["terminal.ansiBlue"], originalColors["editorGutter.modifiedBackground"]));
11326
+ fill(colors, "gitDecoration.deletedResourceForeground", firstColor(originalColors["gitDecoration.deletedResourceForeground"], originalColors["terminal.ansiRed"], originalColors["editorGutter.deletedBackground"]));
11327
+ const focusRing = (isFullyTransparent(originalColors["list.focusOutline"]) ? void 0 : originalColors["list.focusOutline"]) ?? (isFullyTransparent(originalColors["focusBorder"]) ? void 0 : originalColors["focusBorder"]);
11328
+ if (focusRing != null) colors["list.focusOutline"] = focusRing;
11329
+ else delete colors["list.focusOutline"];
11330
+ const hover = originalColors["list.hoverBackground"];
11331
+ if (hover != null && (matchesSurface(hover, sidebarBackground) || hoverWouldEraseText(hover, sidebarBackground, sidebarForeground))) delete colors["list.hoverBackground"];
11332
+ const result = Object.freeze({
11333
+ ...theme,
11334
+ colors: Object.freeze(colors)
11335
+ });
11336
+ cache.set(theme, result);
11337
+ return result;
11338
+ }
11339
+ function fill(colors, key2, value) {
11340
+ if (value != null && value !== "") colors[key2] = value;
11341
+ }
11342
+ function firstColor(...candidates) {
11343
+ for (const candidate of candidates) if (candidate != null && candidate !== "") return candidate;
11344
+ }
11345
+ function matchesSurface(color, surface) {
11346
+ return surface != null && color.toLowerCase() === surface.toLowerCase();
11347
+ }
11134
11348
  (() => {
11135
11349
  try {
11136
11350
  return false;
@@ -11143,10 +11357,9 @@ const DEFAULT_THEMES = {
11143
11357
  dark: "pierre-dark",
11144
11358
  light: "pierre-light"
11145
11359
  };
11146
- const DEFAULT_COLLAPSED_CONTEXT_THRESHOLD = 1;
11147
11360
  const ResolvedLanguages = /* @__PURE__ */ new Map();
11148
11361
  const AttachedLanguages = /* @__PURE__ */ new Set();
11149
- function attachResolvedLanguages(resolvedLanguages, highlighter$1) {
11362
+ function attachResolvedLanguages(resolvedLanguages, highlighter2) {
11150
11363
  resolvedLanguages = Array.isArray(resolvedLanguages) ? resolvedLanguages : [resolvedLanguages];
11151
11364
  for (const resolvedLang of resolvedLanguages) {
11152
11365
  if (AttachedLanguages.has(resolvedLang.name)) continue;
@@ -11156,26 +11369,26 @@ function attachResolvedLanguages(resolvedLanguages, highlighter$1) {
11156
11369
  ResolvedLanguages.set(resolvedLang.name, lang);
11157
11370
  }
11158
11371
  AttachedLanguages.add(lang.name);
11159
- highlighter$1.loadLanguageSync(lang.data);
11372
+ highlighter2.loadLanguageSync(lang.data);
11160
11373
  }
11161
11374
  }
11162
- const ResolvedThemes = /* @__PURE__ */ new Map();
11163
11375
  const AttachedThemes = /* @__PURE__ */ new Set();
11164
- function attachResolvedThemes(themes, highlighter$1) {
11376
+ const themeResolver = createThemeResolver();
11377
+ function attachResolvedThemes(themes, highlighter2) {
11165
11378
  themes = Array.isArray(themes) ? themes : [themes];
11166
11379
  for (let themeRef of themes) {
11167
11380
  let resolvedTheme;
11168
11381
  if (typeof themeRef === "string") {
11169
- resolvedTheme = ResolvedThemes.get(themeRef);
11382
+ resolvedTheme = themeResolver.getResolvedTheme(themeRef);
11170
11383
  if (resolvedTheme == null) throw new Error(`loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`);
11171
11384
  } else {
11172
11385
  resolvedTheme = themeRef;
11173
11386
  themeRef = themeRef.name;
11174
- if (!ResolvedThemes.has(themeRef)) ResolvedThemes.set(themeRef, resolvedTheme);
11387
+ if (themeResolver.getResolvedTheme(themeRef) == null) themeResolver.seedResolvedTheme(themeRef, resolvedTheme);
11175
11388
  }
11176
11389
  if (AttachedThemes.has(themeRef)) continue;
11177
11390
  AttachedThemes.add(themeRef);
11178
- highlighter$1.loadThemeSync(resolvedTheme);
11391
+ highlighter2.loadThemeSync(resolvedTheme);
11179
11392
  }
11180
11393
  }
11181
11394
  const CUSTOM_EXTENSION_TO_FILE_FORMAT = /* @__PURE__ */ new Map();
@@ -11740,28 +11953,31 @@ const tokenStyleNormalizer = {
11740
11953
  function formatCSSVariablePrefix(type) {
11741
11954
  return `--${type === "token" ? "diffs-token" : "diffs"}-`;
11742
11955
  }
11743
- function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highlighter$1, prefix }) {
11956
+ function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highlighter2, prefix }) {
11744
11957
  let styles = "";
11745
11958
  if (typeof theme === "string") {
11746
- const themeData = highlighter$1.getTheme(theme);
11747
- styles += `color:${themeData.fg};`;
11748
- styles += `background-color:${themeData.bg};`;
11749
- styles += `${formatCSSVariablePrefix("global")}fg:${themeData.fg};`;
11750
- styles += `${formatCSSVariablePrefix("global")}bg:${themeData.bg};`;
11751
- styles += getThemeVariables(themeData, prefix);
11959
+ const themeData = highlighter2.getTheme(theme);
11960
+ const normalized = normalizeThemeColors(themeData);
11961
+ styles += `color:${normalized.fg};`;
11962
+ styles += `background-color:${normalized.bg};`;
11963
+ styles += `${formatCSSVariablePrefix("global")}fg:${normalized.fg};`;
11964
+ styles += `${formatCSSVariablePrefix("global")}bg:${normalized.bg};`;
11965
+ styles += getGitVariables(themeData, prefix);
11752
11966
  } else {
11753
- let themeData = highlighter$1.getTheme(theme.dark);
11754
- styles += `${formatCSSVariablePrefix("global")}dark:${themeData.fg};`;
11755
- styles += `${formatCSSVariablePrefix("global")}dark-bg:${themeData.bg};`;
11756
- styles += getThemeVariables(themeData, "dark");
11757
- themeData = highlighter$1.getTheme(theme.light);
11758
- styles += `${formatCSSVariablePrefix("global")}light:${themeData.fg};`;
11759
- styles += `${formatCSSVariablePrefix("global")}light-bg:${themeData.bg};`;
11760
- styles += getThemeVariables(themeData, "light");
11967
+ let themeData = highlighter2.getTheme(theme.dark);
11968
+ let normalized = normalizeThemeColors(themeData);
11969
+ styles += `${formatCSSVariablePrefix("global")}dark:${normalized.fg};`;
11970
+ styles += `${formatCSSVariablePrefix("global")}dark-bg:${normalized.bg};`;
11971
+ styles += getGitVariables(themeData, "dark");
11972
+ themeData = highlighter2.getTheme(theme.light);
11973
+ normalized = normalizeThemeColors(themeData);
11974
+ styles += `${formatCSSVariablePrefix("global")}light:${normalized.fg};`;
11975
+ styles += `${formatCSSVariablePrefix("global")}light-bg:${normalized.bg};`;
11976
+ styles += getGitVariables(themeData, "light");
11761
11977
  }
11762
11978
  return styles;
11763
11979
  }
11764
- function getThemeVariables(themeData, modePrefix) {
11980
+ function getGitVariables(themeData, modePrefix) {
11765
11981
  modePrefix = modePrefix != null ? `${modePrefix}-` : "";
11766
11982
  let styles = "";
11767
11983
  const additionGreen = themeData.colors?.["gitDecoration.addedResourceForeground"] ?? themeData.colors?.["terminal.ansiGreen"];
@@ -11844,7 +12060,7 @@ function getTrailingExpandedRegion({ fileDiff, hunkIndex, expandedHunks, collaps
11844
12060
  renderAll: fromStart >= trailingRangeSize
11845
12061
  };
11846
12062
  }
11847
- function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infinity, expandedHunks, collapsedContextThreshold = DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, callback }) {
12063
+ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infinity, expandedHunks, collapsedContextThreshold = 1, callback }) {
11848
12064
  const iterationStart = getIterationStartState({
11849
12065
  diff,
11850
12066
  diffStyle,
@@ -11893,9 +12109,9 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
11893
12109
  }
11894
12110
  };
11895
12111
  hunkIterator: for (let hunkIndex = iterationStart.hunkIndex; hunkIndex < diff.hunks.length; hunkIndex++) {
11896
- let getTrailingCollapsedAfter = function(unifiedLineIndex$1, splitLineIndex$1) {
12112
+ let getTrailingCollapsedAfter = function(unifiedLineIndex2, splitLineIndex2) {
11897
12113
  if (trailingRegion == null || trailingRegion.collapsedLines <= 0 || trailingRegion.fromStart + trailingRegion.fromEnd > 0) return 0;
11898
- return splitLineIndex$1 === hunk.splitLineStart + hunk.splitLineCount - 1 ? trailingRegion.collapsedLines : 0;
12114
+ return splitLineIndex2 === hunk.splitLineStart + hunk.splitLineCount - 1 ? trailingRegion.collapsedLines : 0;
11899
12115
  }, consumePendingCollapsed = function() {
11900
12116
  if (consumedCollapsed) return 0;
11901
12117
  consumedCollapsed = true;
@@ -11921,12 +12137,12 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
11921
12137
  const expandedLineCount = leadingRegion.fromStart + leadingRegion.fromEnd;
11922
12138
  let consumedCollapsed = leadingRegion.collapsedLines === 0;
11923
12139
  if (!state.shouldSkip(expandedLineCount, expandedLineCount)) {
11924
- let unifiedLineIndex$1 = hunk.unifiedLineStart - leadingRegion.rangeSize;
11925
- let splitLineIndex$1 = hunk.splitLineStart - leadingRegion.rangeSize;
11926
- let deletionLineIndex$1 = hunk.deletionLineIndex - leadingRegion.rangeSize;
11927
- let additionLineIndex$1 = hunk.additionLineIndex - leadingRegion.rangeSize;
11928
- let deletionLineNumber$1 = hunk.deletionStart - leadingRegion.rangeSize;
11929
- let additionLineNumber$1 = hunk.additionStart - leadingRegion.rangeSize;
12140
+ let unifiedLineIndex2 = hunk.unifiedLineStart - leadingRegion.rangeSize;
12141
+ let splitLineIndex2 = hunk.splitLineStart - leadingRegion.rangeSize;
12142
+ let deletionLineIndex2 = hunk.deletionLineIndex - leadingRegion.rangeSize;
12143
+ let additionLineIndex2 = hunk.additionLineIndex - leadingRegion.rangeSize;
12144
+ let deletionLineNumber2 = hunk.deletionStart - leadingRegion.rangeSize;
12145
+ let additionLineNumber2 = hunk.additionStart - leadingRegion.rangeSize;
11930
12146
  if (walkContextLines(state, leadingRegion.fromStart, diffStyle, (index) => {
11931
12147
  return state.emit({
11932
12148
  hunkIndex,
@@ -11935,27 +12151,27 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
11935
12151
  collapsedAfter: 0,
11936
12152
  type: "context-expanded",
11937
12153
  deletionLine: {
11938
- lineNumber: deletionLineNumber$1 + index,
11939
- lineIndex: deletionLineIndex$1 + index,
12154
+ lineNumber: deletionLineNumber2 + index,
12155
+ lineIndex: deletionLineIndex2 + index,
11940
12156
  noEOFCR: false,
11941
- unifiedLineIndex: unifiedLineIndex$1 + index,
11942
- splitLineIndex: splitLineIndex$1 + index
12157
+ unifiedLineIndex: unifiedLineIndex2 + index,
12158
+ splitLineIndex: splitLineIndex2 + index
11943
12159
  },
11944
12160
  additionLine: {
11945
- unifiedLineIndex: unifiedLineIndex$1 + index,
11946
- splitLineIndex: splitLineIndex$1 + index,
11947
- lineIndex: additionLineIndex$1 + index,
11948
- lineNumber: additionLineNumber$1 + index,
12161
+ unifiedLineIndex: unifiedLineIndex2 + index,
12162
+ splitLineIndex: splitLineIndex2 + index,
12163
+ lineIndex: additionLineIndex2 + index,
12164
+ lineNumber: additionLineNumber2 + index,
11949
12165
  noEOFCR: false
11950
12166
  }
11951
12167
  });
11952
12168
  })) break hunkIterator;
11953
- unifiedLineIndex$1 = hunk.unifiedLineStart - leadingRegion.fromEnd;
11954
- splitLineIndex$1 = hunk.splitLineStart - leadingRegion.fromEnd;
11955
- deletionLineIndex$1 = hunk.deletionLineIndex - leadingRegion.fromEnd;
11956
- additionLineIndex$1 = hunk.additionLineIndex - leadingRegion.fromEnd;
11957
- deletionLineNumber$1 = hunk.deletionStart - leadingRegion.fromEnd;
11958
- additionLineNumber$1 = hunk.additionStart - leadingRegion.fromEnd;
12169
+ unifiedLineIndex2 = hunk.unifiedLineStart - leadingRegion.fromEnd;
12170
+ splitLineIndex2 = hunk.splitLineStart - leadingRegion.fromEnd;
12171
+ deletionLineIndex2 = hunk.deletionLineIndex - leadingRegion.fromEnd;
12172
+ additionLineIndex2 = hunk.additionLineIndex - leadingRegion.fromEnd;
12173
+ deletionLineNumber2 = hunk.deletionStart - leadingRegion.fromEnd;
12174
+ additionLineNumber2 = hunk.additionStart - leadingRegion.fromEnd;
11959
12175
  if (walkContextLines(state, leadingRegion.fromEnd, diffStyle, (index) => {
11960
12176
  return state.emit({
11961
12177
  hunkIndex,
@@ -11964,17 +12180,17 @@ function iterateOverDiff({ diff, diffStyle, startingLine = 0, totalLines = Infin
11964
12180
  collapsedAfter: 0,
11965
12181
  type: "context-expanded",
11966
12182
  deletionLine: {
11967
- lineNumber: deletionLineNumber$1 + index,
11968
- lineIndex: deletionLineIndex$1 + index,
12183
+ lineNumber: deletionLineNumber2 + index,
12184
+ lineIndex: deletionLineIndex2 + index,
11969
12185
  noEOFCR: false,
11970
- unifiedLineIndex: unifiedLineIndex$1 + index,
11971
- splitLineIndex: splitLineIndex$1 + index
12186
+ unifiedLineIndex: unifiedLineIndex2 + index,
12187
+ splitLineIndex: splitLineIndex2 + index
11972
12188
  },
11973
12189
  additionLine: {
11974
- unifiedLineIndex: unifiedLineIndex$1 + index,
11975
- splitLineIndex: splitLineIndex$1 + index,
11976
- lineIndex: additionLineIndex$1 + index,
11977
- lineNumber: additionLineNumber$1 + index,
12190
+ unifiedLineIndex: unifiedLineIndex2 + index,
12191
+ splitLineIndex: splitLineIndex2 + index,
12192
+ lineIndex: additionLineIndex2 + index,
12193
+ lineNumber: additionLineNumber2 + index,
11978
12194
  noEOFCR: false
11979
12195
  }
11980
12196
  });
@@ -12114,9 +12330,9 @@ function getContextLineIterationBounds(state, count, diffStyle) {
12114
12330
  if (!state.isWindowedHighlight || count <= 0) return [0, count];
12115
12331
  const ranges = [];
12116
12332
  function pushRange(currentCount) {
12117
- const start$1 = Math.max(0, state.viewportStart - currentCount);
12118
- const end$1 = Math.min(count, state.viewportEnd - currentCount);
12119
- if (end$1 > start$1) ranges.push([start$1, end$1]);
12333
+ const start2 = Math.max(0, state.viewportStart - currentCount);
12334
+ const end2 = Math.min(count, state.viewportEnd - currentCount);
12335
+ if (end2 > start2) ranges.push([start2, end2]);
12120
12336
  }
12121
12337
  pushRange(state.unifiedCount);
12122
12338
  pushRange(state.splitCount);
@@ -12266,7 +12482,7 @@ function pushOrJoinSpan({ item, arr, enableJoin, isNeutral = false, isLastItem =
12266
12482
  arr.push([isNeutral ? 0 : 1, item.value]);
12267
12483
  }
12268
12484
  const DEFAULT_PLAIN_TEXT_OPTIONS$1 = { forcePlainText: false };
12269
- function renderDiffWithHighlighter(diff, highlighter$1, options, { forcePlainText, startingLine, totalLines, expandedHunks, collapsedContextThreshold = DEFAULT_COLLAPSED_CONTEXT_THRESHOLD } = DEFAULT_PLAIN_TEXT_OPTIONS$1) {
12485
+ function renderDiffWithHighlighter(diff, highlighter2, options, { forcePlainText, startingLine, totalLines, expandedHunks, collapsedContextThreshold = 1 } = DEFAULT_PLAIN_TEXT_OPTIONS$1) {
12270
12486
  if (forcePlainText) {
12271
12487
  startingLine ??= 0;
12272
12488
  totalLines ??= Infinity;
@@ -12275,10 +12491,10 @@ function renderDiffWithHighlighter(diff, highlighter$1, options, { forcePlainTex
12275
12491
  totalLines = Infinity;
12276
12492
  }
12277
12493
  const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
12278
- const baseThemeType = typeof options.theme === "string" ? highlighter$1.getTheme(options.theme).type : void 0;
12494
+ const baseThemeType = typeof options.theme === "string" ? highlighter2.getTheme(options.theme).type : void 0;
12279
12495
  const themeStyles = getHighlighterThemeStyles({
12280
12496
  theme: options.theme,
12281
- highlighter: highlighter$1
12497
+ highlighter: highlighter2
12282
12498
  });
12283
12499
  const lineDiffType = forcePlainText && !isWindowedHighlight && (diff.unifiedLineCount > 1e3 || diff.splitLineCount > 1e3) ? "none" : options.lineDiffType;
12284
12500
  const code = {
@@ -12367,7 +12583,7 @@ function renderDiffWithHighlighter(diff, highlighter$1, options, { forcePlainTex
12367
12583
  additionFile,
12368
12584
  additionInfo: bucket.additionInfo,
12369
12585
  additionDecorations: bucket.additionDecorations,
12370
- highlighter: highlighter$1,
12586
+ highlighter: highlighter2,
12371
12587
  options,
12372
12588
  languageOverride: forcePlainText ? "text" : diff.lang
12373
12589
  });
@@ -12472,7 +12688,7 @@ function createBucket() {
12472
12688
  additionSegments: []
12473
12689
  };
12474
12690
  }
12475
- function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter$1, deletionDecorations, additionDecorations, languageOverride, options: { theme: themeOrThemes = DEFAULT_THEMES, ...options } }) {
12691
+ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter2, deletionDecorations, additionDecorations, languageOverride, options: { theme: themeOrThemes = DEFAULT_THEMES, ...options } }) {
12476
12692
  const deletionLang = languageOverride ?? getFiletypeFromFileName(deletionFile.name);
12477
12693
  const additionLang = languageOverride ?? getFiletypeFromFileName(additionFile.name);
12478
12694
  const { state, transformers } = createTransformerWithState(options.useTokenTransformer);
@@ -12484,7 +12700,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
12484
12700
  transformers,
12485
12701
  decorations: void 0,
12486
12702
  defaultColor: false,
12487
- cssVariablePrefix: formatCSSVariablePrefix("token")
12703
+ cssVariablePrefix: formatCSSVariablePrefix("token"),
12704
+ tokenizeTimeLimit: 0
12488
12705
  } : {
12489
12706
  ...options,
12490
12707
  lang: "text",
@@ -12492,7 +12709,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
12492
12709
  transformers,
12493
12710
  decorations: void 0,
12494
12711
  defaultColor: false,
12495
- cssVariablePrefix: formatCSSVariablePrefix("token")
12712
+ cssVariablePrefix: formatCSSVariablePrefix("token"),
12713
+ tokenizeTimeLimit: 0
12496
12714
  };
12497
12715
  })();
12498
12716
  return {
@@ -12501,14 +12719,14 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
12501
12719
  hastConfig.lang = deletionLang;
12502
12720
  state.lineInfo = deletionInfo;
12503
12721
  hastConfig.decorations = deletionDecorations;
12504
- return getLineNodes(highlighter$1.codeToHast(cleanLastNewline(deletionFile.contents), hastConfig));
12722
+ return getLineNodes(highlighter2.codeToHast(cleanLastNewline(deletionFile.contents), hastConfig));
12505
12723
  })(),
12506
12724
  additionLines: (() => {
12507
12725
  if (additionFile.contents === "") return [];
12508
12726
  hastConfig.lang = additionLang;
12509
12727
  hastConfig.decorations = additionDecorations;
12510
12728
  state.lineInfo = additionInfo;
12511
- return getLineNodes(highlighter$1.codeToHast(cleanLastNewline(additionFile.contents), hastConfig));
12729
+ return getLineNodes(highlighter2.codeToHast(cleanLastNewline(additionFile.contents), hastConfig));
12512
12730
  })()
12513
12731
  };
12514
12732
  }
@@ -12533,7 +12751,7 @@ function splitFileContents(contents) {
12533
12751
  return contents !== "" ? contents.split(SPLIT_WITH_NEWLINES) : [];
12534
12752
  }
12535
12753
  const DEFAULT_PLAIN_TEXT_OPTIONS = { forcePlainText: false };
12536
- function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES, tokenizeMaxLineLength, useTokenTransformer }, { forcePlainText, startingLine, totalLines, lines } = DEFAULT_PLAIN_TEXT_OPTIONS) {
12754
+ function renderFileWithHighlighter(file, highlighter2, { theme = DEFAULT_THEMES, tokenizeMaxLineLength, useTokenTransformer }, { forcePlainText, startingLine, totalLines, lines } = DEFAULT_PLAIN_TEXT_OPTIONS) {
12537
12755
  if (forcePlainText) {
12538
12756
  startingLine ??= 0;
12539
12757
  totalLines ??= Infinity;
@@ -12544,10 +12762,10 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
12544
12762
  const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
12545
12763
  const { state, transformers } = createTransformerWithState(useTokenTransformer);
12546
12764
  const lang = forcePlainText ? "text" : file.lang ?? getFiletypeFromFileName(file.name);
12547
- const baseThemeType = typeof theme === "string" ? highlighter$1.getTheme(theme).type : void 0;
12765
+ const baseThemeType = typeof theme === "string" ? highlighter2.getTheme(theme).type : void 0;
12548
12766
  const themeStyles = getHighlighterThemeStyles({
12549
12767
  theme,
12550
- highlighter: highlighter$1
12768
+ highlighter: highlighter2
12551
12769
  });
12552
12770
  state.lineInfo = (shikiLineNumber) => ({
12553
12771
  type: "context",
@@ -12561,7 +12779,8 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
12561
12779
  transformers,
12562
12780
  defaultColor: false,
12563
12781
  cssVariablePrefix: formatCSSVariablePrefix("token"),
12564
- tokenizeMaxLineLength
12782
+ tokenizeMaxLineLength,
12783
+ tokenizeTimeLimit: 0
12565
12784
  };
12566
12785
  return {
12567
12786
  lang,
@@ -12569,10 +12788,11 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
12569
12788
  transformers,
12570
12789
  defaultColor: false,
12571
12790
  cssVariablePrefix: formatCSSVariablePrefix("token"),
12572
- tokenizeMaxLineLength
12791
+ tokenizeMaxLineLength,
12792
+ tokenizeTimeLimit: 0
12573
12793
  };
12574
12794
  })();
12575
- const highlightedLines = getLineNodes(highlighter$1.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? splitFileContents(file.contents), startingLine, totalLines) : cleanLastNewline(file.contents), hastConfig));
12795
+ const highlightedLines = getLineNodes(highlighter2.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? splitFileContents(file.contents), startingLine, totalLines) : cleanLastNewline(file.contents), hastConfig));
12576
12796
  const code = isWindowedHighlight ? new Array(startingLine) : highlightedLines;
12577
12797
  if (isWindowedHighlight) code.push(...highlightedLines);
12578
12798
  return {
@@ -12631,15 +12851,15 @@ async function handleMessage(request) {
12631
12851
  } finally {
12632
12852
  }
12633
12853
  }
12634
- async function handleInitialize({ id, renderOptions: options, preferredHighlighter, resolvedThemes, resolvedLanguages, customExtensionsVersion: customExtensionsVersion$1, customExtensionMap }) {
12635
- let highlighter$1 = getHighlighter(preferredHighlighter);
12636
- if ("then" in highlighter$1) highlighter$1 = await highlighter$1;
12854
+ async function handleInitialize({ id, renderOptions: options, preferredHighlighter, resolvedThemes, resolvedLanguages, customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
12855
+ let highlighter2 = getHighlighter(preferredHighlighter);
12856
+ if ("then" in highlighter2) highlighter2 = await highlighter2;
12637
12857
  syncCustomExtensionsFromRequest({
12638
- customExtensionsVersion: customExtensionsVersion$1,
12858
+ customExtensionsVersion: customExtensionsVersion2,
12639
12859
  customExtensionMap
12640
12860
  });
12641
- attachResolvedThemes(resolvedThemes, highlighter$1);
12642
- if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter$1);
12861
+ attachResolvedThemes(resolvedThemes, highlighter2);
12862
+ if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter2);
12643
12863
  renderOptions = options;
12644
12864
  postMessage({
12645
12865
  type: "success",
@@ -12649,9 +12869,9 @@ async function handleInitialize({ id, renderOptions: options, preferredHighlight
12649
12869
  });
12650
12870
  }
12651
12871
  async function handleSetRenderOptions({ id, renderOptions: options, resolvedThemes }) {
12652
- let highlighter$1 = getHighlighter();
12653
- if ("then" in highlighter$1) highlighter$1 = await highlighter$1;
12654
- attachResolvedThemes(resolvedThemes, highlighter$1);
12872
+ let highlighter2 = getHighlighter();
12873
+ if ("then" in highlighter2) highlighter2 = await highlighter2;
12874
+ attachResolvedThemes(resolvedThemes, highlighter2);
12655
12875
  renderOptions = options;
12656
12876
  postMessage({
12657
12877
  type: "success",
@@ -12660,30 +12880,30 @@ async function handleSetRenderOptions({ id, renderOptions: options, resolvedThem
12660
12880
  sentAt: Date.now()
12661
12881
  });
12662
12882
  }
12663
- async function handleRenderFile({ id, file, resolvedLanguages, customExtensionsVersion: customExtensionsVersion$1, customExtensionMap }) {
12664
- let highlighter$1 = getHighlighter();
12665
- if ("then" in highlighter$1) highlighter$1 = await highlighter$1;
12883
+ async function handleRenderFile({ id, file, resolvedLanguages, customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
12884
+ let highlighter2 = getHighlighter();
12885
+ if ("then" in highlighter2) highlighter2 = await highlighter2;
12666
12886
  syncCustomExtensionsFromRequest({
12667
- customExtensionsVersion: customExtensionsVersion$1,
12887
+ customExtensionsVersion: customExtensionsVersion2,
12668
12888
  customExtensionMap
12669
12889
  });
12670
- if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter$1);
12890
+ if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter2);
12671
12891
  const fileOptions = {
12672
12892
  theme: renderOptions.theme,
12673
12893
  useTokenTransformer: renderOptions.useTokenTransformer,
12674
12894
  tokenizeMaxLineLength: renderOptions.tokenizeMaxLineLength
12675
12895
  };
12676
- sendFileSuccess(id, renderFileWithHighlighter(file, highlighter$1, fileOptions), fileOptions);
12896
+ sendFileSuccess(id, renderFileWithHighlighter(file, highlighter2, fileOptions), fileOptions);
12677
12897
  }
12678
- async function handleRenderDiff({ id, diff, resolvedLanguages, customExtensionsVersion: customExtensionsVersion$1, customExtensionMap }) {
12679
- let highlighter$1 = getHighlighter();
12680
- if ("then" in highlighter$1) highlighter$1 = await highlighter$1;
12898
+ async function handleRenderDiff({ id, diff, resolvedLanguages, customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
12899
+ let highlighter2 = getHighlighter();
12900
+ if ("then" in highlighter2) highlighter2 = await highlighter2;
12681
12901
  syncCustomExtensionsFromRequest({
12682
- customExtensionsVersion: customExtensionsVersion$1,
12902
+ customExtensionsVersion: customExtensionsVersion2,
12683
12903
  customExtensionMap
12684
12904
  });
12685
- if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter$1);
12686
- sendDiffSuccess(id, renderDiffWithHighlighter(diff, highlighter$1, renderOptions), renderOptions);
12905
+ if (resolvedLanguages != null) attachResolvedLanguages(resolvedLanguages, highlighter2);
12906
+ sendDiffSuccess(id, renderDiffWithHighlighter(diff, highlighter2, renderOptions), renderOptions);
12687
12907
  }
12688
12908
  function getHighlighter(preferredHighlighter = "shiki-js") {
12689
12909
  highlighter ??= createHighlighterCore({
@@ -12693,10 +12913,10 @@ function getHighlighter(preferredHighlighter = "shiki-js") {
12693
12913
  });
12694
12914
  return highlighter;
12695
12915
  }
12696
- function syncCustomExtensionsFromRequest({ customExtensionsVersion: customExtensionsVersion$1, customExtensionMap }) {
12697
- if (customExtensionsVersion$1 == null && customExtensionMap == null) return;
12698
- if (customExtensionsVersion$1 == null || customExtensionMap == null) throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");
12699
- replaceCustomExtensions(customExtensionsVersion$1, customExtensionMap);
12916
+ function syncCustomExtensionsFromRequest({ customExtensionsVersion: customExtensionsVersion2, customExtensionMap }) {
12917
+ if (customExtensionsVersion2 == null && customExtensionMap == null) return;
12918
+ if (customExtensionsVersion2 == null || customExtensionMap == null) throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");
12919
+ replaceCustomExtensions(customExtensionsVersion2, customExtensionMap);
12700
12920
  }
12701
12921
  function sendFileSuccess(id, result, options) {
12702
12922
  postMessage({