@proxysoul/soulforge 2.14.0 → 2.14.1

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.
package/dist/index.js CHANGED
@@ -51209,7 +51209,7 @@ function resetUIStore() {
51209
51209
  showReasoning: true,
51210
51210
  reasoningExpanded: {},
51211
51211
  suspended: false,
51212
- lockIn: false
51212
+ lockIn: true
51213
51213
  });
51214
51214
  }
51215
51215
  var INITIAL_MODALS, useUIStore, selectIsAnyModalOpen = (s) => Object.values(s.modals).some(Boolean);
@@ -51264,7 +51264,7 @@ var init_ui = __esm(() => {
51264
51264
  reasoningExpanded: {},
51265
51265
  suspended: false,
51266
51266
  editorSplit: 60,
51267
- lockIn: false,
51267
+ lockIn: true,
51268
51268
  openModal: (name21) => set2(() => ({
51269
51269
  modals: {
51270
51270
  ...INITIAL_MODALS,
@@ -57906,7 +57906,7 @@ var package_default;
57906
57906
  var init_package = __esm(() => {
57907
57907
  package_default = {
57908
57908
  name: "@proxysoul/soulforge",
57909
- version: "2.14.0",
57909
+ version: "2.14.1",
57910
57910
  description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
57911
57911
  repository: {
57912
57912
  type: "git",
@@ -57958,9 +57958,9 @@ var init_package = __esm(() => {
57958
57958
  },
57959
57959
  devDependencies: {
57960
57960
  "@babel/core": "7.29.0",
57961
- "@biomejs/biome": "2.4.12",
57961
+ "@biomejs/biome": "2.4.13",
57962
57962
  "@types/babel__core": "7.20.5",
57963
- "@types/bun": "1.3.12",
57963
+ "@types/bun": "1.3.13",
57964
57964
  "@types/linkify-it": "5.0.0",
57965
57965
  "@types/node": "25.6.0",
57966
57966
  "@types/react": "19.2.14",
@@ -57980,14 +57980,14 @@ var init_package = __esm(() => {
57980
57980
  "@ai-sdk/openai": "3.0.53",
57981
57981
  "@ai-sdk/openai-compatible": "^2.0.41",
57982
57982
  "@ai-sdk/xai": "3.0.83",
57983
- "@anthropic-ai/sdk": "0.90.0",
57984
- "@llmgateway/ai-sdk-provider": "3.6.0",
57983
+ "@anthropic-ai/sdk": "0.91.1",
57984
+ "@llmgateway/ai-sdk-provider": "3.7.0",
57985
57985
  "@modelcontextprotocol/sdk": "^1.29.0",
57986
57986
  "@mozilla/readability": "0.6.0",
57987
- "@openrouter/ai-sdk-provider": "2.8.0",
57988
- "@opentui/react": "0.1.102",
57987
+ "@openrouter/ai-sdk-provider": "2.8.1",
57988
+ "@opentui/react": "0.2.0",
57989
57989
  ai: "6.0.168",
57990
- "ghostty-opentui": "1.4.10",
57990
+ "ghostty-opentui": "1.4.11",
57991
57991
  isbinaryfile: "6.0.0",
57992
57992
  jsonrepair: "^3.14.0",
57993
57993
  linkedom: "0.18.12",
@@ -58435,26 +58435,36 @@ async function exchangeToken(githubToken) {
58435
58435
  if (cachedBearer && Date.now() / 1000 < cachedBearer.expiresAt - 60) {
58436
58436
  return cachedBearer.token;
58437
58437
  }
58438
- const res = await fetch(TOKEN_EXCHANGE, {
58439
- headers: {
58440
- Authorization: `Token ${githubToken}`,
58441
- "User-Agent": `SoulForge/${CURRENT_VERSION}`
58442
- },
58443
- signal: AbortSignal.timeout(1e4)
58444
- });
58445
- if (!res.ok) {
58446
- cachedBearer = null;
58447
- const body2 = await res.text().catch(() => "");
58448
- throw new Error(`Copilot token exchange failed (${String(res.status)})${body2 ? `: ${body2.slice(0, 200)}` : ""}`);
58449
- }
58450
- const data = await res.json();
58451
- if (!data.token)
58452
- throw new Error("Copilot token exchange returned empty token");
58453
- cachedBearer = {
58454
- token: data.token,
58455
- expiresAt: data.expires_at
58456
- };
58457
- return data.token;
58438
+ if (bearerInflight)
58439
+ return bearerInflight;
58440
+ bearerInflight = (async () => {
58441
+ try {
58442
+ const res = await fetch(TOKEN_EXCHANGE, {
58443
+ headers: {
58444
+ Authorization: `Token ${githubToken}`,
58445
+ "User-Agent": `SoulForge/${CURRENT_VERSION}`
58446
+ },
58447
+ signal: AbortSignal.timeout(1e4)
58448
+ });
58449
+ if (!res.ok) {
58450
+ cachedBearer = null;
58451
+ const body2 = await res.text().catch(() => "");
58452
+ const hint = res.status === 401 || res.status === 403 ? " \u2014 your GitHub OAuth token is invalid or expired. Re-run the login flow in VS Code/JetBrains and copy the fresh oauth_token from ~/.config/github-copilot/apps.json." : res.status >= 500 ? " \u2014 GitHub is having issues, try again in a moment." : "";
58453
+ throw new Error(`Copilot token exchange failed (${String(res.status)})${body2 ? `: ${body2.slice(0, 200)}` : ""}${hint}`);
58454
+ }
58455
+ const data = await res.json();
58456
+ if (!data.token)
58457
+ throw new Error("Copilot token exchange returned empty token");
58458
+ cachedBearer = {
58459
+ token: data.token,
58460
+ expiresAt: data.expires_at
58461
+ };
58462
+ return data.token;
58463
+ } finally {
58464
+ bearerInflight = null;
58465
+ }
58466
+ })();
58467
+ return bearerInflight;
58458
58468
  }
58459
58469
  function invalidateBearer() {
58460
58470
  cachedBearer = null;
@@ -58465,16 +58475,19 @@ function getGitHubToken() {
58465
58475
  return stored;
58466
58476
  throw new Error("GitHub Copilot requires an OAuth token. Sign in via VS Code or JetBrains, then copy oauth_token from ~/.config/github-copilot/apps.json and save it with /keys or --set-key copilot.");
58467
58477
  }
58468
- function needsResponsesApi(modelId) {
58469
- const id = modelId.toLowerCase();
58470
- if (id.includes("codex"))
58471
- return true;
58472
- if (id.startsWith("gpt-5"))
58473
- return true;
58474
- return false;
58475
- }
58476
- function isAnthropicModel(modelId) {
58477
- return modelId.toLowerCase().startsWith("claude");
58478
+ function detectInitiator(body2) {
58479
+ if (typeof body2 !== "string")
58480
+ return "user";
58481
+ try {
58482
+ const parsed = JSON.parse(body2);
58483
+ if (Array.isArray(parsed.messages)) {
58484
+ for (const m of parsed.messages) {
58485
+ if (m?.role === "assistant" || m?.role === "tool")
58486
+ return "agent";
58487
+ }
58488
+ }
58489
+ } catch {}
58490
+ return "user";
58478
58491
  }
58479
58492
  function createCopilotFetch(githubToken) {
58480
58493
  return async (url2, init2) => {
@@ -58485,38 +58498,41 @@ function createCopilotFetch(githubToken) {
58485
58498
  invalidateBearer();
58486
58499
  bearer = await exchangeToken(githubToken);
58487
58500
  }
58488
- const headers = new Headers(init2?.headers);
58489
- headers.set("Authorization", `Bearer ${bearer}`);
58501
+ const buildHeaders = (token) => {
58502
+ const h = new Headers(init2?.headers);
58503
+ h.set("Authorization", `Bearer ${token}`);
58504
+ h.set("X-Request-Id", crypto.randomUUID());
58505
+ h.set("X-Initiator", detectInitiator(init2?.body));
58506
+ return h;
58507
+ };
58490
58508
  const res = await fetch(url2, {
58491
58509
  ...init2,
58492
- headers
58510
+ headers: buildHeaders(bearer)
58493
58511
  });
58494
58512
  if (res.status === 401) {
58495
58513
  invalidateBearer();
58496
58514
  const retryBearer = await exchangeToken(githubToken);
58497
- const retryHeaders = new Headers(init2?.headers);
58498
- retryHeaders.set("Authorization", `Bearer ${retryBearer}`);
58499
58515
  return fetch(url2, {
58500
58516
  ...init2,
58501
- headers: retryHeaders
58517
+ headers: buildHeaders(retryBearer)
58502
58518
  });
58503
58519
  }
58504
58520
  return res;
58505
58521
  };
58506
58522
  }
58523
+ function assertChatCompletionsSupported(modelId) {
58524
+ const endpoints = supportedEndpoints.get(modelId);
58525
+ if (!endpoints || endpoints.length === 0)
58526
+ return;
58527
+ const hasChat = endpoints.some((e) => e.includes("chat") || e.includes("completions"));
58528
+ if (hasChat)
58529
+ return;
58530
+ throw new Error(`Copilot model "${modelId}" only supports ${endpoints.join(", ")} \u2014 ` + "SoulForge routes Copilot through /chat/completions. " + "Try claude-sonnet-4.6, gpt-4.1, or another chat-compatible model.");
58531
+ }
58507
58532
  function createCopilotModel(modelId) {
58533
+ assertChatCompletionsSupported(modelId);
58508
58534
  const githubToken = getGitHubToken();
58509
58535
  const copilotFetch = createCopilotFetch(githubToken);
58510
- if (isAnthropicModel(modelId)) {
58511
- return createAnthropic({
58512
- baseURL: COPILOT_API,
58513
- apiKey: "copilot",
58514
- headers: {
58515
- ...COPILOT_HEADERS
58516
- },
58517
- fetch: copilotFetch
58518
- })(modelId);
58519
- }
58520
58536
  const client = createOpenAI({
58521
58537
  baseURL: COPILOT_API,
58522
58538
  apiKey: "copilot",
@@ -58525,22 +58541,23 @@ function createCopilotModel(modelId) {
58525
58541
  },
58526
58542
  fetch: copilotFetch
58527
58543
  });
58528
- if (needsResponsesApi(modelId)) {
58529
- return client.responses(modelId);
58530
- }
58531
58544
  return client.chat(modelId);
58532
58545
  }
58533
- var ENV_VAR = "COPILOT_API_KEY", COPILOT_API = "https://api.githubcopilot.com", TOKEN_EXCHANGE = "https://api.github.com/copilot_internal/v2/token", COPILOT_HEADERS, cachedBearer = null, copilot;
58546
+ var ENV_VAR = "COPILOT_API_KEY", COPILOT_API = "https://api.githubcopilot.com", TOKEN_EXCHANGE = "https://api.github.com/copilot_internal/v2/token", COPILOT_CHAT_VERSION = "0.26.7", COPILOT_API_VERSION = "2025-04-01", COPILOT_HEADERS, cachedBearer = null, bearerInflight = null, supportedEndpoints, copilot;
58534
58547
  var init_copilot = __esm(() => {
58535
- init_dist6();
58536
58548
  init_dist8();
58537
58549
  init_secrets();
58538
58550
  init_version();
58539
58551
  COPILOT_HEADERS = {
58540
- "Editor-Version": `SoulForge/${CURRENT_VERSION}`,
58541
- "Editor-Plugin-Version": `SoulForge/${CURRENT_VERSION}`,
58542
- "Copilot-Integration-Id": "vscode-chat"
58543
- };
58552
+ "Editor-Version": "vscode/1.95.0",
58553
+ "Editor-Plugin-Version": `copilot-chat/${COPILOT_CHAT_VERSION}`,
58554
+ "Copilot-Integration-Id": "vscode-chat",
58555
+ "User-Agent": `GitHubCopilotChat/${COPILOT_CHAT_VERSION}`,
58556
+ "OpenAI-Intent": "conversation-panel",
58557
+ "X-GitHub-Api-Version": COPILOT_API_VERSION,
58558
+ "X-VSCode-User-Agent-Library-Version": "electron-fetch"
58559
+ };
58560
+ supportedEndpoints = new Map;
58544
58561
  copilot = {
58545
58562
  id: "copilot",
58546
58563
  name: "GitHub Copilot",
@@ -58575,6 +58592,9 @@ var init_copilot = __esm(() => {
58575
58592
  continue;
58576
58593
  if (result.some((r) => r.id === m.id))
58577
58594
  continue;
58595
+ if (Array.isArray(m.supported_endpoints)) {
58596
+ supportedEndpoints.set(m.id, m.supported_endpoints);
58597
+ }
58578
58598
  result.push({
58579
58599
  id: m.id,
58580
58600
  name: m.id
@@ -66769,7 +66789,8 @@ function createLLMGateway(options = {}) {
66769
66789
  provider: "llmgateway.image",
66770
66790
  url: ({ path }) => `${baseURL}${path}`,
66771
66791
  headers: getHeaders,
66772
- fetch: options.fetch
66792
+ fetch: options.fetch,
66793
+ extraBody: options.extraBody
66773
66794
  });
66774
66795
  const createLanguageModel = (modelId, settings) => {
66775
66796
  if (new.target) {
@@ -68023,13 +68044,19 @@ var __defProp3, __defProps, __getOwnPropDescs, __getOwnPropSymbols, __hasOwnProp
68023
68044
  if (options.aspectRatio != null) {
68024
68045
  body2.aspect_ratio = options.aspectRatio;
68025
68046
  }
68047
+ if (options.quality != null) {
68048
+ body2.quality = options.quality;
68049
+ }
68050
+ const providerOptions = options.providerOptions || {};
68051
+ const llmgatewayOptions = providerOptions.llmgateway || {};
68052
+ const requestBody = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, body2), this.config.extraBody), this.settings.extraBody), llmgatewayOptions);
68026
68053
  const { value: response, responseHeaders } = await postJsonToApi2({
68027
68054
  url: this.config.url({
68028
68055
  path: hasFiles ? "/images/edits" : "/images/generations",
68029
68056
  modelId: this.modelId
68030
68057
  }),
68031
68058
  headers: combineHeaders2(this.config.headers(), options.headers),
68032
- body: body2,
68059
+ body: requestBody,
68033
68060
  failedResponseHandler: llmgatewayFailedResponseHandler,
68034
68061
  successfulResponseHandler: createJsonResponseHandler2(LLMGatewayImageResponseSchema),
68035
68062
  abortSignal: options.abortSignal,
@@ -79984,9 +80011,9 @@ function convertToOpenRouterChatMessages(prompt) {
79984
80011
  const parsedProviderOptions = OpenRouterProviderOptionsSchema.safeParse(providerOptions);
79985
80012
  const messageReasoningDetails = parsedProviderOptions.success ? (_e = (_d = parsedProviderOptions.data) == null ? undefined : _d.openrouter) == null ? undefined : _e.reasoning_details : undefined;
79986
80013
  const messageAnnotations = parsedProviderOptions.success ? (_g = (_f = parsedProviderOptions.data) == null ? undefined : _f.openrouter) == null ? undefined : _g.annotations : undefined;
79987
- const candidateReasoningDetails = messageReasoningDetails && Array.isArray(messageReasoningDetails) && messageReasoningDetails.length > 0 ? messageReasoningDetails : findFirstReasoningDetails(content);
80014
+ const candidateReasoningDetails = messageReasoningDetails && Array.isArray(messageReasoningDetails) ? messageReasoningDetails : findFirstReasoningDetails(content);
79988
80015
  let finalReasoningDetails;
79989
- if (candidateReasoningDetails && candidateReasoningDetails.length > 0) {
80016
+ if (candidateReasoningDetails) {
79990
80017
  const validDetails = candidateReasoningDetails.filter((detail) => {
79991
80018
  var _a173;
79992
80019
  if (detail.type !== "reasoning.text") {
@@ -80010,9 +80037,9 @@ function convertToOpenRouterChatMessages(prompt) {
80010
80037
  uniqueDetails.push(detail);
80011
80038
  }
80012
80039
  }
80013
- finalReasoningDetails = uniqueDetails.length > 0 ? uniqueDetails : undefined;
80040
+ finalReasoningDetails = uniqueDetails;
80014
80041
  }
80015
- const effectiveReasoning = reasoning && finalReasoningDetails ? reasoning : undefined;
80042
+ const effectiveReasoning = reasoning && finalReasoningDetails && finalReasoningDetails.length > 0 ? reasoning : undefined;
80016
80043
  messages.push({
80017
80044
  role: "assistant",
80018
80045
  content: text2,
@@ -81455,11 +81482,11 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
81455
81482
  controller.enqueue({
81456
81483
  type: "reasoning-end",
81457
81484
  id: reasoningId || generateId5(),
81458
- providerMetadata: accumulatedReasoningDetails.length > 0 ? {
81485
+ providerMetadata: {
81459
81486
  openrouter: {
81460
81487
  reasoning_details: accumulatedReasoningDetails
81461
81488
  }
81462
- } : undefined
81489
+ }
81463
81490
  });
81464
81491
  reasoningStarted = false;
81465
81492
  }
@@ -81690,11 +81717,11 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
81690
81717
  controller.enqueue({
81691
81718
  type: "reasoning-end",
81692
81719
  id: reasoningId || generateId5(),
81693
- providerMetadata: accumulatedReasoningDetails.length > 0 ? {
81720
+ providerMetadata: {
81694
81721
  openrouter: {
81695
81722
  reasoning_details: accumulatedReasoningDetails
81696
81723
  }
81697
- } : undefined
81724
+ }
81698
81725
  });
81699
81726
  }
81700
81727
  if (textStarted) {
@@ -81709,9 +81736,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
81709
81736
  if (provider !== undefined) {
81710
81737
  openrouterMetadata.provider = provider;
81711
81738
  }
81712
- if (accumulatedReasoningDetails.length > 0) {
81713
- openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
81714
- }
81739
+ openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
81715
81740
  if (accumulatedFileAnnotations.length > 0) {
81716
81741
  openrouterMetadata.annotations = accumulatedFileAnnotations;
81717
81742
  }
@@ -82163,7 +82188,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
82163
82188
  usage
82164
82189
  };
82165
82190
  }
82166
- }, DEFAULT_IMAGE_MEDIA_TYPE = "image/png", webSearchInputSchema2, webSearch2, VERSION22 = "2.8.0", VideoGenerationSubmitResponseSchema, VideoGenerationPollResponseSchema, DEFAULT_POLL_INTERVAL_MS = 2000, DEFAULT_MAX_POLL_TIME_MS = 600000, OpenRouterVideoModel = class {
82191
+ }, DEFAULT_IMAGE_MEDIA_TYPE = "image/png", webSearchInputSchema2, webSearch2, VERSION22 = "2.8.1", VideoGenerationSubmitResponseSchema, VideoGenerationPollResponseSchema, DEFAULT_POLL_INTERVAL_MS = 2000, DEFAULT_MAX_POLL_TIME_MS = 600000, OpenRouterVideoModel = class {
82167
82192
  constructor(modelId, settings, config2) {
82168
82193
  this.specificationVersion = "v3";
82169
82194
  this.provider = "openrouter";
@@ -84426,7 +84451,7 @@ var init_lifecycle = __esm(() => {
84426
84451
  });
84427
84452
 
84428
84453
  // src/core/llm/providers/proxy.ts
84429
- function isAnthropicModel2(modelId) {
84454
+ function isAnthropicModel(modelId) {
84430
84455
  return modelId.toLowerCase().startsWith("claude");
84431
84456
  }
84432
84457
  var baseURL, proxy2;
@@ -84446,7 +84471,7 @@ var init_proxy = __esm(() => {
84446
84471
  grouped: true,
84447
84472
  createModel(modelId) {
84448
84473
  const apiKey = getActiveProxyApiKey();
84449
- if (isAnthropicModel2(modelId)) {
84474
+ if (isAnthropicModel(modelId)) {
84450
84475
  return createAnthropic({
84451
84476
  baseURL,
84452
84477
  apiKey
@@ -355487,7 +355512,7 @@ var init_constants = __esm(() => {
355487
355512
  memory: "Read/write persistent memories across sessions",
355488
355513
  editor: "Open file in embedded Neovim editor",
355489
355514
  task_list: "Create and track tasks for the current session",
355490
- ast_edit: "Surgical AST editing for TS/JS (prefer over edit_file/multi_edit) \u2014 65+ ops, create_file, atomic multi-op, zero string matching"
355515
+ ast_edit: "Surgical AST editing for TS/JS \u2014 prefer over edit_file/multi_edit"
355491
355516
  };
355492
355517
  RESTRICTED_TOOL_NAMES = ["read", "grep", "glob", "soul_grep", "soul_find", "soul_analyze", "soul_impact", "list_dir", "web_search", "editor", "navigate", "analyze", "discover_pattern", "memory", "skills", "fetch_page", "ask_user", "plan", "update_plan_step"];
355493
355518
  PLAN_EXECUTION_TOOL_NAMES = ["read", "edit_file", "undo_edit", "multi_edit", "task_list", "list_dir", "shell", "project", "grep", "glob", "navigate", "analyze", "git", "editor", "rename_symbol", "move_symbol", "rename_file", "refactor", "update_plan_step", "memory", "skills", "soul_grep", "soul_find", "soul_analyze", "soul_impact"];
@@ -424558,7 +424583,18 @@ function buildInstructionPrompt(instructions) {
424558
424583
  const globalInstructions = instructions.filter((inst) => inst.scope === "global");
424559
424584
  const parts2 = [];
424560
424585
  if (globalInstructions.length > 0) {
424561
- parts2.push("Global instruction files apply across all projects and take priority over project-local instruction files when they conflict.");
424586
+ parts2.push("Global instruction files apply across all projects, but project-local instruction files take priority when they conflict.");
424587
+ }
424588
+ if (globalInstructions.length > 0) {
424589
+ const globalParts = [];
424590
+ for (const inst of globalInstructions) {
424591
+ globalParts.push(`[global:${inst.file}]
424592
+ ${inst.content}`);
424593
+ }
424594
+ parts2.push(`Global instruction files:
424595
+ ${globalParts.join(`
424596
+
424597
+ `)}`);
424562
424598
  }
424563
424599
  if (projectInstructions.length > 0) {
424564
424600
  const projectParts = [];
@@ -424573,17 +424609,6 @@ ${projectParts.join(`
424573
424609
  `)}` : projectParts.join(`
424574
424610
 
424575
424611
  `));
424576
- }
424577
- if (globalInstructions.length > 0) {
424578
- const globalParts = [];
424579
- for (const inst of globalInstructions) {
424580
- globalParts.push(`[global:${inst.file}]
424581
- ${inst.content}`);
424582
- }
424583
- parts2.push(`Global instruction files:
424584
- ${globalParts.join(`
424585
-
424586
- `)}`);
424587
424612
  }
424588
424613
  return `Project instructions:
424589
424614
  ${parts2.join(`
@@ -427994,7 +428019,7 @@ var init_highlights5 = () => {};
427994
428019
  var tree_sitter_zig_default = "./tree-sitter-zig-e78zbjpm.wasm";
427995
428020
  var init_tree_sitter_zig = () => {};
427996
428021
 
427997
- // node_modules/@opentui/core/index-qpcsqve6.js
428022
+ // node_modules/@opentui/core/index-mw2x3082.js
427998
428023
  import { EventEmitter } from "events";
427999
428024
  import { Buffer as Buffer22 } from "buffer";
428000
428025
  import { Buffer as Buffer32 } from "buffer";
@@ -428257,50 +428282,128 @@ class PasteEvent {
428257
428282
  this._propagationStopped = true;
428258
428283
  }
428259
428284
  }
428285
+ function packMeta(intent, slot = 0) {
428286
+ return (slot & 255 | (intent & 255) << 8) >>> 0;
428287
+ }
428288
+ function toU8(value) {
428289
+ return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
428290
+ }
428291
+ function toByte(value) {
428292
+ return Math.round(Math.max(0, Math.min(255, Number.isFinite(value) ? value : 0)));
428293
+ }
428294
+ function packRGBA8(r4, g2, b4, a2, meta3) {
428295
+ return new Uint16Array([
428296
+ toByte(r4) & 255 | (meta3 >>> 0 & 255) << 8,
428297
+ toByte(g2) & 255 | (meta3 >>> 8 & 255) << 8,
428298
+ toByte(b4) & 255 | (meta3 >>> 16 & 255) << 8,
428299
+ toByte(a2) & 255 | (meta3 >>> 24 & 255) << 8
428300
+ ]);
428301
+ }
428302
+ function rgbaForAnsi256Index(index) {
428303
+ const [r4, g2, b4] = ansi256IndexToRgb(index);
428304
+ return RGBA.fromInts(r4, g2, b4);
428305
+ }
428306
+ function normalizeIndexedColorIndex(index) {
428307
+ if (!Number.isInteger(index) || index < 0 || index > 255) {
428308
+ throw new RangeError(`Indexed color must be an integer in the range 0..255, got ${index}`);
428309
+ }
428310
+ return index;
428311
+ }
428312
+ function ansi256IndexToRgb(index) {
428313
+ const normalizedIndex = normalizeIndexedColorIndex(index);
428314
+ if (normalizedIndex < ANSI16_RGB.length) {
428315
+ return ANSI16_RGB[normalizedIndex];
428316
+ }
428317
+ if (normalizedIndex < 232) {
428318
+ const cubeIndex = normalizedIndex - 16;
428319
+ const r4 = Math.floor(cubeIndex / 36);
428320
+ const g2 = Math.floor(cubeIndex / 6) % 6;
428321
+ const b4 = cubeIndex % 6;
428322
+ return [ANSI_256_CUBE_LEVELS[r4], ANSI_256_CUBE_LEVELS[g2], ANSI_256_CUBE_LEVELS[b4]];
428323
+ }
428324
+ const value = 8 + (normalizedIndex - 232) * 10;
428325
+ return [value, value, value];
428326
+ }
428260
428327
 
428261
428328
  class RGBA {
428262
428329
  buffer;
428263
428330
  constructor(buffer) {
428264
- this.buffer = buffer;
428331
+ this.buffer = new Uint16Array(4);
428332
+ this.buffer.set(buffer.subarray(0, 4));
428265
428333
  }
428266
428334
  static fromArray(array3) {
428267
428335
  return new RGBA(array3);
428268
428336
  }
428269
428337
  static fromValues(r4, g2, b4, a2 = 1) {
428270
- return new RGBA(new Float32Array([r4, g2, b4, a2]));
428338
+ return new RGBA(packRGBA8(toU8(r4), toU8(g2), toU8(b4), toU8(a2), packMeta(INTENT_RGB)));
428339
+ }
428340
+ static clone(rgba) {
428341
+ return new RGBA(rgba.buffer);
428271
428342
  }
428272
428343
  static fromInts(r4, g2, b4, a2 = 255) {
428273
- return new RGBA(new Float32Array([r4 / 255, g2 / 255, b4 / 255, a2 / 255]));
428344
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_RGB)));
428274
428345
  }
428275
428346
  static fromHex(hex3) {
428276
428347
  return hexToRgb(hex3);
428277
428348
  }
428349
+ static fromIndex(index, snapshot) {
428350
+ const normalized = normalizeIndexedColorIndex(index);
428351
+ const rgba = snapshot ? parseColor2(snapshot) : rgbaForAnsi256Index(normalized);
428352
+ const [r4, g2, b4, a2] = rgba.toInts();
428353
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_INDEXED, normalized)));
428354
+ }
428355
+ static defaultForeground(snapshot) {
428356
+ const rgba = snapshot ? parseColor2(snapshot) : RGBA.fromInts(...DEFAULT_FOREGROUND_RGB);
428357
+ const [r4, g2, b4, a2] = rgba.toInts();
428358
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_DEFAULT)));
428359
+ }
428360
+ static defaultBackground(snapshot) {
428361
+ const rgba = snapshot ? parseColor2(snapshot) : RGBA.fromInts(...DEFAULT_BACKGROUND_RGB);
428362
+ const [r4, g2, b4, a2] = rgba.toInts();
428363
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_DEFAULT)));
428364
+ }
428278
428365
  toInts() {
428279
- return [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255), Math.round(this.a * 255)];
428366
+ return [this.buffer[0] & 255, this.buffer[1] & 255, this.buffer[2] & 255, this.buffer[3] & 255];
428280
428367
  }
428281
428368
  get r() {
428282
- return this.buffer[0];
428369
+ return (this.buffer[0] & 255) / 255;
428283
428370
  }
428284
428371
  set r(value) {
428285
- this.buffer[0] = value;
428372
+ this.buffer[0] = this.buffer[0] & 65280 | toU8(value);
428286
428373
  }
428287
428374
  get g() {
428288
- return this.buffer[1];
428375
+ return (this.buffer[1] & 255) / 255;
428289
428376
  }
428290
428377
  set g(value) {
428291
- this.buffer[1] = value;
428378
+ this.buffer[1] = this.buffer[1] & 65280 | toU8(value);
428292
428379
  }
428293
428380
  get b() {
428294
- return this.buffer[2];
428381
+ return (this.buffer[2] & 255) / 255;
428295
428382
  }
428296
428383
  set b(value) {
428297
- this.buffer[2] = value;
428384
+ this.buffer[2] = this.buffer[2] & 65280 | toU8(value);
428298
428385
  }
428299
428386
  get a() {
428300
- return this.buffer[3];
428387
+ return (this.buffer[3] & 255) / 255;
428301
428388
  }
428302
428389
  set a(value) {
428303
- this.buffer[3] = value;
428390
+ this.buffer[3] = this.buffer[3] & 65280 | toU8(value);
428391
+ }
428392
+ get meta() {
428393
+ return (this.buffer[0] >>> 8 | this.buffer[1] >>> 8 << 8 | this.buffer[2] >>> 8 << 16 | this.buffer[3] >>> 8 << 24) >>> 0;
428394
+ }
428395
+ get intent() {
428396
+ switch (this.meta >>> 8 & 255) {
428397
+ case INTENT_INDEXED:
428398
+ return "indexed";
428399
+ case INTENT_DEFAULT:
428400
+ return "default";
428401
+ default:
428402
+ return "rgb";
428403
+ }
428404
+ }
428405
+ get slot() {
428406
+ return this.meta & 255;
428304
428407
  }
428305
428408
  map(fn) {
428306
428409
  return [fn(this.r), fn(this.g), fn(this.b), fn(this.a)];
@@ -428311,9 +428414,14 @@ class RGBA {
428311
428414
  equals(other) {
428312
428415
  if (!other)
428313
428416
  return false;
428314
- return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
428417
+ return this.buffer[0] === other.buffer[0] && this.buffer[1] === other.buffer[1] && this.buffer[2] === other.buffer[2] && this.buffer[3] === other.buffer[3];
428315
428418
  }
428316
428419
  }
428420
+ function normalizeColorValue(value) {
428421
+ if (value == null)
428422
+ return null;
428423
+ return { rgba: parseColor2(value) };
428424
+ }
428317
428425
  function hexToRgb(hex3) {
428318
428426
  hex3 = hex3.replace(/^#/, "");
428319
428427
  if (hex3.length === 3) {
@@ -428325,18 +428433,16 @@ function hexToRgb(hex3) {
428325
428433
  console.warn(`Invalid hex color: ${hex3}, defaulting to magenta`);
428326
428434
  return RGBA.fromValues(1, 0, 1, 1);
428327
428435
  }
428328
- const r4 = parseInt(hex3.substring(0, 2), 16) / 255;
428329
- const g2 = parseInt(hex3.substring(2, 4), 16) / 255;
428330
- const b4 = parseInt(hex3.substring(4, 6), 16) / 255;
428331
- const a2 = hex3.length === 8 ? parseInt(hex3.substring(6, 8), 16) / 255 : 1;
428332
- return RGBA.fromValues(r4, g2, b4, a2);
428436
+ const r4 = parseInt(hex3.substring(0, 2), 16);
428437
+ const g2 = parseInt(hex3.substring(2, 4), 16);
428438
+ const b4 = parseInt(hex3.substring(4, 6), 16);
428439
+ const a2 = hex3.length === 8 ? parseInt(hex3.substring(6, 8), 16) : 255;
428440
+ return RGBA.fromInts(r4, g2, b4, a2);
428333
428441
  }
428334
428442
  function rgbToHex(rgb) {
428335
- const components = rgb.a === 1 ? [rgb.r, rgb.g, rgb.b] : [rgb.r, rgb.g, rgb.b, rgb.a];
428336
- return "#" + components.map((x3) => {
428337
- const hex3 = Math.floor(Math.max(0, Math.min(1, x3) * 255)).toString(16);
428338
- return hex3.length === 1 ? "0" + hex3 : hex3;
428339
- }).join("");
428443
+ const [r4, g2, b4, a2] = rgb.toInts();
428444
+ const components = a2 === 255 ? [r4, g2, b4] : [r4, g2, b4, a2];
428445
+ return "#" + components.map((x3) => x3.toString(16).padStart(2, "0")).join("");
428340
428446
  }
428341
428447
  function hsvToRgb(h2, s2, v3) {
428342
428448
  let r4 = 0, g2 = 0, b4 = 0;
@@ -432704,6 +432810,35 @@ class TerminalPalette {
432704
432810
  function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux, oscSource, clock) {
432705
432811
  return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux, oscSource, clock);
432706
432812
  }
432813
+ function getFallbackAnsi256Palette() {
432814
+ if (!fallbackAnsi256Palette) {
432815
+ fallbackAnsi256Palette = Array.from({ length: 256 }, (_4, index) => {
432816
+ const [r4, g2, b4] = ansi256IndexToRgb(index);
432817
+ return RGBA.fromInts(r4, g2, b4);
432818
+ });
432819
+ }
432820
+ return fallbackAnsi256Palette;
432821
+ }
432822
+ function normalizeTerminalPalette(colors2) {
432823
+ const fallbackPalette = getFallbackAnsi256Palette();
432824
+ return {
432825
+ palette: Array.from({ length: 256 }, (_4, index) => {
432826
+ const detected = colors2?.palette[index];
432827
+ return detected ? RGBA.fromHex(detected) : RGBA.clone(fallbackPalette[index]);
432828
+ }),
432829
+ defaultForeground: colors2?.defaultForeground ? RGBA.fromHex(colors2.defaultForeground) : RGBA.clone(DEFAULT_FOREGROUND_FALLBACK),
432830
+ defaultBackground: colors2?.defaultBackground ? RGBA.fromHex(colors2.defaultBackground) : RGBA.clone(DEFAULT_BACKGROUND_FALLBACK)
432831
+ };
432832
+ }
432833
+ function buildTerminalPaletteSignature(colors2) {
432834
+ const normalized = normalizeTerminalPalette(colors2);
432835
+ const paletteSignature = normalized.palette.map((color) => color.toInts().join(",")).join(";");
432836
+ return [
432837
+ paletteSignature,
432838
+ normalized.defaultForeground.toInts().join(","),
432839
+ normalized.defaultBackground.toInts().join(",")
432840
+ ].join("|");
432841
+ }
432707
432842
  function decodePasteBytes(bytes) {
432708
432843
  return PASTE_TEXT_DECODER.decode(bytes);
432709
432844
  }
@@ -432796,21 +432931,25 @@ class OptimizedBuffer {
432796
432931
  if (this._destroyed)
432797
432932
  throw new Error(`Buffer ${this.id} is destroyed`);
432798
432933
  }
432934
+ ensureRawBufferViews() {
432935
+ if (this._rawBuffers !== null) {
432936
+ return;
432937
+ }
432938
+ const size = this._width * this._height;
432939
+ const charPtr = this.lib.bufferGetCharPtr(this.bufferPtr);
432940
+ const fgPtr = this.lib.bufferGetFgPtr(this.bufferPtr);
432941
+ const bgPtr = this.lib.bufferGetBgPtr(this.bufferPtr);
432942
+ const attributesPtr = this.lib.bufferGetAttributesPtr(this.bufferPtr);
432943
+ this._rawBuffers = {
432944
+ char: new Uint32Array(toArrayBuffer(charPtr, 0, size * 4)),
432945
+ fg: new Uint16Array(toArrayBuffer(fgPtr, 0, size * 4 * 2)),
432946
+ bg: new Uint16Array(toArrayBuffer(bgPtr, 0, size * 4 * 2)),
432947
+ attributes: new Uint32Array(toArrayBuffer(attributesPtr, 0, size * 4))
432948
+ };
432949
+ }
432799
432950
  get buffers() {
432800
432951
  this.guard();
432801
- if (this._rawBuffers === null) {
432802
- const size = this._width * this._height;
432803
- const charPtr = this.lib.bufferGetCharPtr(this.bufferPtr);
432804
- const fgPtr = this.lib.bufferGetFgPtr(this.bufferPtr);
432805
- const bgPtr = this.lib.bufferGetBgPtr(this.bufferPtr);
432806
- const attributesPtr = this.lib.bufferGetAttributesPtr(this.bufferPtr);
432807
- this._rawBuffers = {
432808
- char: new Uint32Array(toArrayBuffer(charPtr, 0, size * 4)),
432809
- fg: new Float32Array(toArrayBuffer(fgPtr, 0, size * 4 * 4)),
432810
- bg: new Float32Array(toArrayBuffer(bgPtr, 0, size * 4 * 4)),
432811
- attributes: new Uint32Array(toArrayBuffer(attributesPtr, 0, size * 4))
432812
- };
432813
- }
432952
+ this.ensureRawBufferViews();
432814
432953
  return this._rawBuffers;
432815
432954
  }
432816
432955
  constructor(lib2, ptr22, width, height, options) {
@@ -432871,8 +433010,8 @@ class OptimizedBuffer {
432871
433010
  for (let x3 = 0;x3 < this._width; x3++) {
432872
433011
  const i4 = y4 * this._width + x3;
432873
433012
  const cp2 = char[i4];
432874
- const cellFg = RGBA.fromValues(fg2[i4 * 4], fg2[i4 * 4 + 1], fg2[i4 * 4 + 2], fg2[i4 * 4 + 3]);
432875
- const cellBg = RGBA.fromValues(bg2[i4 * 4], bg2[i4 * 4 + 1], bg2[i4 * 4 + 2], bg2[i4 * 4 + 3]);
433013
+ const cellFg = RGBA.fromArray(fg2.slice(i4 * 4, i4 * 4 + 4));
433014
+ const cellBg = RGBA.fromArray(bg2.slice(i4 * 4, i4 * 4 + 4));
432876
433015
  const cellAttrs = attributes2[i4] & 255;
432877
433016
  const isContinuation = (cp2 & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
432878
433017
  const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
@@ -433644,6 +433783,12 @@ function toPointer(value) {
433644
433783
  function toNumber(value) {
433645
433784
  return typeof value === "bigint" ? Number(value) : value;
433646
433785
  }
433786
+ function rgbaPtr(value) {
433787
+ return ptr4(value.buffer);
433788
+ }
433789
+ function optionalRgbaPtr(value) {
433790
+ return value ? rgbaPtr(value) : null;
433791
+ }
433647
433792
  function getOpenTUILib(libPath) {
433648
433793
  const resolvedLibPath = libPath || targetLibPath;
433649
433794
  const rawSymbols = dlopen(resolvedLibPath, {
@@ -433727,10 +433872,18 @@ function getOpenTUILib(libPath) {
433727
433872
  args: ["ptr"],
433728
433873
  returns: "ptr"
433729
433874
  },
433875
+ rendererSetPaletteState: {
433876
+ args: ["ptr", "ptr", "usize", "ptr", "ptr", "u32"],
433877
+ returns: "void"
433878
+ },
433730
433879
  queryPixelResolution: {
433731
433880
  args: ["ptr"],
433732
433881
  returns: "void"
433733
433882
  },
433883
+ queryThemeColors: {
433884
+ args: ["ptr"],
433885
+ returns: "void"
433886
+ },
433734
433887
  createOptimizedBuffer: {
433735
433888
  args: ["u32", "u32", "bool", "u8", "ptr", "usize"],
433736
433889
  returns: "ptr"
@@ -434568,7 +434721,7 @@ function getOpenTUILib(libPath) {
434568
434721
  returns: "void"
434569
434722
  },
434570
434723
  syntaxStyleRegister: {
434571
- args: ["ptr", "ptr", "usize", "ptr", "ptr", "u8"],
434724
+ args: ["ptr", "ptr", "usize", "ptr", "ptr", "u32"],
434572
434725
  returns: "u32"
434573
434726
  },
434574
434727
  syntaxStyleResolveByName: {
@@ -434929,7 +435082,7 @@ class FFIRenderLib {
434929
435082
  this.opentui.symbols.setClearOnShutdown(renderer, clear);
434930
435083
  }
434931
435084
  setBackgroundColor(renderer, color) {
434932
- this.opentui.symbols.setBackgroundColor(renderer, color.buffer);
435085
+ this.opentui.symbols.setBackgroundColor(renderer, rgbaPtr(color));
434933
435086
  }
434934
435087
  setRenderOffset(renderer, offset) {
434935
435088
  this.opentui.symbols.setRenderOffset(renderer, offset);
@@ -434970,6 +435123,13 @@ class FFIRenderLib {
434970
435123
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
434971
435124
  return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
434972
435125
  }
435126
+ rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
435127
+ const paletteBuffer = new Uint16Array(palette.length * 4);
435128
+ for (let index = 0;index < palette.length; index++) {
435129
+ paletteBuffer.set(palette[index].buffer, index * 4);
435130
+ }
435131
+ this.opentui.symbols.rendererSetPaletteState(renderer, ptr4(paletteBuffer), palette.length, rgbaPtr(defaultForeground), rgbaPtr(defaultBackground), paletteEpoch >>> 0);
435132
+ }
434973
435133
  bufferGetCharPtr(buffer) {
434974
435134
  const ptr5 = this.opentui.symbols.bufferGetCharPtr(buffer);
434975
435135
  if (!ptr5) {
@@ -435025,29 +435185,29 @@ class FFIRenderLib {
435025
435185
  return this.opentui.symbols.getBufferHeight(buffer);
435026
435186
  }
435027
435187
  bufferClear(buffer, color) {
435028
- this.opentui.symbols.bufferClear(buffer, color.buffer);
435188
+ this.opentui.symbols.bufferClear(buffer, rgbaPtr(color));
435029
435189
  }
435030
435190
  bufferDrawText(buffer, text3, x3, y4, color, bgColor, attributes2) {
435031
435191
  const textBytes = this.encoder.encode(text3);
435032
435192
  const textLength = textBytes.byteLength;
435033
- const bg2 = bgColor ? bgColor.buffer : null;
435034
- const fg2 = color.buffer;
435193
+ const bg2 = optionalRgbaPtr(bgColor);
435194
+ const fg2 = rgbaPtr(color);
435035
435195
  this.opentui.symbols.bufferDrawText(buffer, textBytes, textLength, x3, y4, fg2, bg2, attributes2 ?? 0);
435036
435196
  }
435037
435197
  bufferSetCellWithAlphaBlending(buffer, x3, y4, char, color, bgColor, attributes2) {
435038
435198
  const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
435039
- const bg2 = bgColor.buffer;
435040
- const fg2 = color.buffer;
435199
+ const bg2 = rgbaPtr(bgColor);
435200
+ const fg2 = rgbaPtr(color);
435041
435201
  this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x3, y4, charPtr, fg2, bg2, attributes2 ?? 0);
435042
435202
  }
435043
435203
  bufferSetCell(buffer, x3, y4, char, color, bgColor, attributes2) {
435044
435204
  const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
435045
- const bg2 = bgColor.buffer;
435046
- const fg2 = color.buffer;
435205
+ const bg2 = rgbaPtr(bgColor);
435206
+ const fg2 = rgbaPtr(color);
435047
435207
  this.opentui.symbols.bufferSetCell(buffer, x3, y4, charPtr, fg2, bg2, attributes2 ?? 0);
435048
435208
  }
435049
435209
  bufferFillRect(buffer, x3, y4, width, height, color) {
435050
- const bg2 = color.buffer;
435210
+ const bg2 = rgbaPtr(color);
435051
435211
  this.opentui.symbols.bufferFillRect(buffer, x3, y4, width, height, bg2);
435052
435212
  }
435053
435213
  bufferColorMatrix(buffer, matrixPtr, cellMaskPtr, cellMaskCount, strength, target) {
@@ -435064,17 +435224,17 @@ class FFIRenderLib {
435064
435224
  this.opentui.symbols.bufferDrawPackedBuffer(buffer, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
435065
435225
  }
435066
435226
  bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
435067
- this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2?.buffer ?? null, bg2?.buffer ?? null);
435227
+ this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, optionalRgbaPtr(fg2), optionalRgbaPtr(bg2));
435068
435228
  }
435069
435229
  bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2, bg2) {
435070
- this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, fg2?.buffer ?? null, bg2?.buffer ?? null);
435230
+ this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, optionalRgbaPtr(fg2), optionalRgbaPtr(bg2));
435071
435231
  }
435072
435232
  bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
435073
435233
  const optionsBuffer = GridDrawOptionsStruct.pack({
435074
435234
  drawInner: options.drawInner,
435075
435235
  drawOuter: options.drawOuter
435076
435236
  });
435077
- this.opentui.symbols.bufferDrawGrid(buffer, borderChars, borderFg.buffer, borderBg.buffer, columnOffsets, columnCount, rowOffsets, rowCount, ptr4(optionsBuffer));
435237
+ this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaPtr(borderFg), rgbaPtr(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, ptr4(optionsBuffer));
435078
435238
  }
435079
435239
  bufferDrawBox(buffer, x3, y4, width, height, borderChars, packedOptions, borderColor, backgroundColor, title, bottomTitle) {
435080
435240
  const titleBytes = title ? this.encoder.encode(title) : null;
@@ -435083,7 +435243,7 @@ class FFIRenderLib {
435083
435243
  const bottomTitleBytes = bottomTitle ? this.encoder.encode(bottomTitle) : null;
435084
435244
  const bottomTitleLen = bottomTitle ? bottomTitleBytes.length : 0;
435085
435245
  const bottomTitlePtr = bottomTitle ? bottomTitleBytes : null;
435086
- this.opentui.symbols.bufferDrawBox(buffer, x3, y4, width, height, borderChars, packedOptions, borderColor.buffer, backgroundColor.buffer, titlePtr, titleLen, bottomTitlePtr, bottomTitleLen);
435246
+ this.opentui.symbols.bufferDrawBox(buffer, x3, y4, width, height, borderChars, packedOptions, rgbaPtr(borderColor), rgbaPtr(backgroundColor), titlePtr, titleLen, bottomTitlePtr, bottomTitleLen);
435087
435247
  }
435088
435248
  bufferResize(buffer, width, height) {
435089
435249
  this.opentui.symbols.bufferResize(buffer, width, height);
@@ -435110,7 +435270,7 @@ class FFIRenderLib {
435110
435270
  this.opentui.symbols.setCursorPosition(renderer, x3, y4, visible);
435111
435271
  }
435112
435272
  setCursorColor(renderer, color) {
435113
- this.opentui.symbols.setCursorColor(renderer, color.buffer);
435273
+ this.opentui.symbols.setCursorColor(renderer, rgbaPtr(color));
435114
435274
  }
435115
435275
  getCursorState(renderer) {
435116
435276
  const cursorBuffer = new ArrayBuffer(CursorStateStruct.size);
@@ -435248,6 +435408,9 @@ class FFIRenderLib {
435248
435408
  queryPixelResolution(renderer) {
435249
435409
  this.opentui.symbols.queryPixelResolution(renderer);
435250
435410
  }
435411
+ queryThemeColors(renderer) {
435412
+ this.opentui.symbols.queryThemeColors(renderer);
435413
+ }
435251
435414
  writeOut(renderer, data) {
435252
435415
  const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
435253
435416
  if (bytes.length === 0)
@@ -435278,11 +435441,11 @@ class FFIRenderLib {
435278
435441
  this.opentui.symbols.textBufferClear(buffer);
435279
435442
  }
435280
435443
  textBufferSetDefaultFg(buffer, fg2) {
435281
- const fgPtr = fg2 ? fg2.buffer : null;
435444
+ const fgPtr = optionalRgbaPtr(fg2);
435282
435445
  this.opentui.symbols.textBufferSetDefaultFg(buffer, fgPtr);
435283
435446
  }
435284
435447
  textBufferSetDefaultBg(buffer, bg2) {
435285
- const bgPtr = bg2 ? bg2.buffer : null;
435448
+ const bgPtr = optionalRgbaPtr(bg2);
435286
435449
  this.opentui.symbols.textBufferSetDefaultBg(buffer, bgPtr);
435287
435450
  }
435288
435451
  textBufferSetDefaultAttributes(buffer, attributes2) {
@@ -435376,8 +435539,8 @@ class FFIRenderLib {
435376
435539
  this.opentui.symbols.destroyTextBufferView(view);
435377
435540
  }
435378
435541
  textBufferViewSetSelection(view, start2, end, bgColor, fgColor) {
435379
- const bg2 = bgColor ? bgColor.buffer : null;
435380
- const fg2 = fgColor ? fgColor.buffer : null;
435542
+ const bg2 = optionalRgbaPtr(bgColor);
435543
+ const fg2 = optionalRgbaPtr(fgColor);
435381
435544
  this.opentui.symbols.textBufferViewSetSelection(view, start2, end, bg2, fg2);
435382
435545
  }
435383
435546
  textBufferViewResetSelection(view) {
@@ -435396,18 +435559,18 @@ class FFIRenderLib {
435396
435559
  return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
435397
435560
  }
435398
435561
  textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
435399
- const bg2 = bgColor ? bgColor.buffer : null;
435400
- const fg2 = fgColor ? fgColor.buffer : null;
435562
+ const bg2 = optionalRgbaPtr(bgColor);
435563
+ const fg2 = optionalRgbaPtr(fgColor);
435401
435564
  return this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
435402
435565
  }
435403
435566
  textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
435404
- const bg2 = bgColor ? bgColor.buffer : null;
435405
- const fg2 = fgColor ? fgColor.buffer : null;
435567
+ const bg2 = optionalRgbaPtr(bgColor);
435568
+ const fg2 = optionalRgbaPtr(fgColor);
435406
435569
  this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
435407
435570
  }
435408
435571
  textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
435409
- const bg2 = bgColor ? bgColor.buffer : null;
435410
- const fg2 = fgColor ? fgColor.buffer : null;
435572
+ const bg2 = optionalRgbaPtr(bgColor);
435573
+ const fg2 = optionalRgbaPtr(fgColor);
435411
435574
  return this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
435412
435575
  }
435413
435576
  textBufferViewResetLocalSelection(view) {
@@ -435496,7 +435659,7 @@ class FFIRenderLib {
435496
435659
  this.opentui.symbols.textBufferViewSetTabIndicator(view, indicator);
435497
435660
  }
435498
435661
  textBufferViewSetTabIndicatorColor(view, color) {
435499
- this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, color.buffer);
435662
+ this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, rgbaPtr(color));
435500
435663
  }
435501
435664
  textBufferViewSetTruncate(view, truncate2) {
435502
435665
  this.opentui.symbols.textBufferViewSetTruncate(view, truncate2);
@@ -435825,8 +435988,8 @@ class FFIRenderLib {
435825
435988
  return outBuffer.slice(0, len);
435826
435989
  }
435827
435990
  editorViewSetSelection(view, start2, end, bgColor, fgColor) {
435828
- const bg2 = bgColor ? bgColor.buffer : null;
435829
- const fg2 = fgColor ? fgColor.buffer : null;
435991
+ const bg2 = optionalRgbaPtr(bgColor);
435992
+ const fg2 = optionalRgbaPtr(fgColor);
435830
435993
  this.opentui.symbols.editorViewSetSelection(view, start2, end, bg2, fg2);
435831
435994
  }
435832
435995
  editorViewResetSelection(view) {
@@ -435842,18 +436005,18 @@ class FFIRenderLib {
435842
436005
  return { start: start2, end };
435843
436006
  }
435844
436007
  editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
435845
- const bg2 = bgColor ? bgColor.buffer : null;
435846
- const fg2 = fgColor ? fgColor.buffer : null;
436008
+ const bg2 = optionalRgbaPtr(bgColor);
436009
+ const fg2 = optionalRgbaPtr(fgColor);
435847
436010
  return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
435848
436011
  }
435849
436012
  editorViewUpdateSelection(view, end, bgColor, fgColor) {
435850
- const bg2 = bgColor ? bgColor.buffer : null;
435851
- const fg2 = fgColor ? fgColor.buffer : null;
436013
+ const bg2 = optionalRgbaPtr(bgColor);
436014
+ const fg2 = optionalRgbaPtr(fgColor);
435852
436015
  this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
435853
436016
  }
435854
436017
  editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
435855
- const bg2 = bgColor ? bgColor.buffer : null;
435856
- const fg2 = fgColor ? fgColor.buffer : null;
436018
+ const bg2 = optionalRgbaPtr(bgColor);
436019
+ const fg2 = optionalRgbaPtr(fgColor);
435857
436020
  return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
435858
436021
  }
435859
436022
  editorViewResetLocalSelection(view) {
@@ -435952,6 +436115,7 @@ class FFIRenderLib {
435952
436115
  kitty_keyboard: caps.kitty_keyboard,
435953
436116
  kitty_graphics: caps.kitty_graphics,
435954
436117
  rgb: caps.rgb,
436118
+ ansi256: caps.ansi256,
435955
436119
  unicode: caps.unicode,
435956
436120
  sgr_pixels: caps.sgr_pixels,
435957
436121
  color_scheme_updates: caps.color_scheme_updates,
@@ -436000,7 +436164,7 @@ class FFIRenderLib {
436000
436164
  this.opentui.symbols.freeUnicode(encoded.ptr, encoded.data.length);
436001
436165
  }
436002
436166
  bufferDrawChar(buffer, char, x3, y4, fg2, bg2, attributes2 = 0) {
436003
- this.opentui.symbols.bufferDrawChar(buffer, char, x3, y4, fg2.buffer, bg2.buffer, attributes2);
436167
+ this.opentui.symbols.bufferDrawChar(buffer, char, x3, y4, rgbaPtr(fg2), rgbaPtr(bg2), attributes2);
436004
436168
  }
436005
436169
  registerNativeSpanFeedStream(stream, handler4) {
436006
436170
  const callback = this.ensureNativeSpanFeedCallback();
@@ -436081,8 +436245,8 @@ class FFIRenderLib {
436081
436245
  }
436082
436246
  syntaxStyleRegister(style, name39, fg2, bg2, attributes2) {
436083
436247
  const nameBytes = this.encoder.encode(name39);
436084
- const fgPtr = fg2 ? fg2.buffer : null;
436085
- const bgPtr = bg2 ? bg2.buffer : null;
436248
+ const fgPtr = optionalRgbaPtr(fg2);
436249
+ const bgPtr = optionalRgbaPtr(bg2);
436086
436250
  return this.opentui.symbols.syntaxStyleRegister(style, nameBytes, nameBytes.length, fgPtr, bgPtr, attributes2);
436087
436251
  }
436088
436252
  syntaxStyleResolveByName(style, name39) {
@@ -436107,7 +436271,7 @@ class FFIRenderLib {
436107
436271
  this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
436108
436272
  }
436109
436273
  editorViewSetTabIndicatorColor(view, color) {
436110
- this.opentui.symbols.editorViewSetTabIndicatorColor(view, color.buffer);
436274
+ this.opentui.symbols.editorViewSetTabIndicatorColor(view, rgbaPtr(color));
436111
436275
  }
436112
436276
  onNativeEvent(name39, handler4) {
436113
436277
  this._nativeEvents.on(name39, handler4);
@@ -436957,9 +437121,11 @@ class SyntaxStyle {
436957
437121
  underline: style.underline,
436958
437122
  dim: style.dim
436959
437123
  });
436960
- const id = this.lib.syntaxStyleRegister(this.stylePtr, name39, style.fg || null, style.bg || null, attributes2);
437124
+ const fg2 = style.fg ? parseColor2(style.fg) : null;
437125
+ const bg2 = style.bg ? parseColor2(style.bg) : null;
437126
+ const id = this.lib.syntaxStyleRegister(this.stylePtr, name39, fg2, bg2, attributes2);
436961
437127
  this.nameCache.set(name39, id);
436962
- this.styleDefs.set(name39, style);
437128
+ this.styleDefs.set(name39, { ...style, fg: fg2 ?? undefined, bg: bg2 ?? undefined });
436963
437129
  return id;
436964
437130
  }
436965
437131
  resolveStyleId(name39) {
@@ -437412,6 +437578,132 @@ function inferThemeModeFromBackgroundColor(color) {
437412
437578
  const brightness = (r4 * 299 + g2 * 587 + b4 * 114) / 1000;
437413
437579
  return brightness > 128 ? "light" : "dark";
437414
437580
  }
437581
+
437582
+ class RendererThemeMode {
437583
+ host;
437584
+ clock;
437585
+ static QUERY_TIMEOUT_MS = 250;
437586
+ _themeMode = null;
437587
+ themeQueryPending = true;
437588
+ themeOscForeground = null;
437589
+ themeOscBackground = null;
437590
+ themeRefreshTimeoutId = null;
437591
+ waiters = new Set;
437592
+ constructor(host, clock2) {
437593
+ this.host = host;
437594
+ this.clock = clock2;
437595
+ }
437596
+ get themeMode() {
437597
+ return this._themeMode;
437598
+ }
437599
+ waitForThemeMode(timeoutMs, isDestroyed) {
437600
+ if (this._themeMode !== null || isDestroyed || timeoutMs === 0) {
437601
+ return Promise.resolve(this._themeMode);
437602
+ }
437603
+ return new Promise((resolve42) => {
437604
+ const waiter = {
437605
+ resolve: resolve42,
437606
+ timeoutHandle: null
437607
+ };
437608
+ if (timeoutMs > 0) {
437609
+ waiter.timeoutHandle = this.clock.setTimeout(() => {
437610
+ this.waiters.delete(waiter);
437611
+ waiter.timeoutHandle = null;
437612
+ resolve42(this._themeMode);
437613
+ }, timeoutMs);
437614
+ }
437615
+ this.waiters.add(waiter);
437616
+ });
437617
+ }
437618
+ cancelRefresh() {
437619
+ if (this.themeRefreshTimeoutId === null) {
437620
+ return;
437621
+ }
437622
+ this.clock.clearTimeout(this.themeRefreshTimeoutId);
437623
+ this.themeRefreshTimeoutId = null;
437624
+ this.themeQueryPending = false;
437625
+ }
437626
+ dispose() {
437627
+ this.cancelRefresh();
437628
+ for (const waiter of this.waiters) {
437629
+ if (waiter.timeoutHandle !== null) {
437630
+ this.clock.clearTimeout(waiter.timeoutHandle);
437631
+ }
437632
+ waiter.resolve(this._themeMode);
437633
+ }
437634
+ this.waiters.clear();
437635
+ }
437636
+ handleSequence(sequence) {
437637
+ if (sequence === "\x1B[?997;1n" || sequence === "\x1B[?997;2n") {
437638
+ this.requestThemeOscColors();
437639
+ return { handled: true, changedMode: null };
437640
+ }
437641
+ let handledOscThemeResponse = false;
437642
+ let match2;
437643
+ OSC_THEME_RESPONSE.lastIndex = 0;
437644
+ while (match2 = OSC_THEME_RESPONSE.exec(sequence)) {
437645
+ handledOscThemeResponse = true;
437646
+ const color = oscThemeColorToHex(match2[2], match2[3], match2[4], match2[5]);
437647
+ if (match2[1] === "10") {
437648
+ this.themeOscForeground = color;
437649
+ } else {
437650
+ this.themeOscBackground = color;
437651
+ }
437652
+ }
437653
+ if (!handledOscThemeResponse) {
437654
+ return { handled: false, changedMode: null };
437655
+ }
437656
+ if (!this.themeQueryPending) {
437657
+ return { handled: true, changedMode: null };
437658
+ }
437659
+ if (!this.themeOscForeground || !this.themeOscBackground) {
437660
+ return { handled: true, changedMode: null };
437661
+ }
437662
+ const nextMode = inferThemeModeFromBackgroundColor(this.themeOscBackground);
437663
+ const changedMode = this.applyThemeMode(nextMode);
437664
+ this.completeThemeQuery();
437665
+ return { handled: true, changedMode };
437666
+ }
437667
+ clearThemeRefreshTimeout() {
437668
+ if (this.themeRefreshTimeoutId === null) {
437669
+ return;
437670
+ }
437671
+ this.clock.clearTimeout(this.themeRefreshTimeoutId);
437672
+ this.themeRefreshTimeoutId = null;
437673
+ }
437674
+ completeThemeQuery() {
437675
+ this.clearThemeRefreshTimeout();
437676
+ this.themeQueryPending = false;
437677
+ }
437678
+ requestThemeOscColors() {
437679
+ if (this.themeRefreshTimeoutId !== null) {
437680
+ return;
437681
+ }
437682
+ this.themeQueryPending = true;
437683
+ this.themeOscForeground = null;
437684
+ this.themeOscBackground = null;
437685
+ this.host.queryThemeColors();
437686
+ this.clearThemeRefreshTimeout();
437687
+ this.themeRefreshTimeoutId = this.clock.setTimeout(() => {
437688
+ this.completeThemeQuery();
437689
+ }, RendererThemeMode.QUERY_TIMEOUT_MS);
437690
+ }
437691
+ applyThemeMode(mode) {
437692
+ const changed = this._themeMode !== mode;
437693
+ this._themeMode = mode;
437694
+ if (!changed) {
437695
+ return null;
437696
+ }
437697
+ for (const waiter of this.waiters) {
437698
+ if (waiter.timeoutHandle !== null) {
437699
+ this.clock.clearTimeout(waiter.timeoutHandle);
437700
+ }
437701
+ waiter.resolve(mode);
437702
+ }
437703
+ this.waiters.clear();
437704
+ return mode;
437705
+ }
437706
+ }
437415
437707
  function normalizeFooterHeight(footerHeight) {
437416
437708
  if (footerHeight === undefined) {
437417
437709
  return DEFAULT_FOOTER_HEIGHT;
@@ -437575,7 +437867,7 @@ var __defProp8, __returnValue2 = (v3) => v3, __export3 = (target, all2) => {
437575
437867
  configurable: true,
437576
437868
  set: __exportSetter2.bind(all2, name39)
437577
437869
  });
437578
- }, exports_src, loadYoga, yoga_wasm_base64_esm_default, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, constants2, YGEnums_default, Yoga, src_default, VALID_BORDER_STYLES, BorderChars, BorderCharArrays, KeyHandler, InternalKeyHandler, CSS_COLOR_NAMES, block_default, shade_default, slick_default, tiny_default, huge_default, grid_default, pallet_default, fonts, parsedFonts, TextAttributes, ATTRIBUTE_BASE_BITS = 8, ATTRIBUTE_BASE_MASK = 255, DebugOverlayCorner, TargetChannel, ATTRIBUTE_BASE_MASK2 = 255, LINK_ID_SHIFT = 8, LINK_ID_PAYLOAD_MASK = 16777215, BrandedStyledText, StyledText, black = (input) => applyStyle(input, { fg: "black" }), red = (input) => applyStyle(input, { fg: "red" }), green = (input) => applyStyle(input, { fg: "green" }), yellow = (input) => applyStyle(input, { fg: "yellow" }), blue = (input) => applyStyle(input, { fg: "blue" }), magenta = (input) => applyStyle(input, { fg: "magenta" }), cyan = (input) => applyStyle(input, { fg: "cyan" }), white = (input) => applyStyle(input, { fg: "white" }), brightBlack = (input) => applyStyle(input, { fg: "brightBlack" }), brightRed = (input) => applyStyle(input, { fg: "brightRed" }), brightGreen = (input) => applyStyle(input, { fg: "brightGreen" }), brightYellow = (input) => applyStyle(input, { fg: "brightYellow" }), brightBlue = (input) => applyStyle(input, { fg: "brightBlue" }), brightMagenta = (input) => applyStyle(input, { fg: "brightMagenta" }), brightCyan = (input) => applyStyle(input, { fg: "brightCyan" }), brightWhite = (input) => applyStyle(input, { fg: "brightWhite" }), bgBlack = (input) => applyStyle(input, { bg: "black" }), bgRed = (input) => applyStyle(input, { bg: "red" }), bgGreen = (input) => applyStyle(input, { bg: "green" }), bgYellow = (input) => applyStyle(input, { bg: "yellow" }), bgBlue = (input) => applyStyle(input, { bg: "blue" }), bgMagenta = (input) => applyStyle(input, { bg: "magenta" }), bgCyan = (input) => applyStyle(input, { bg: "cyan" }), bgWhite = (input) => applyStyle(input, { bg: "white" }), bold = (input) => applyStyle(input, { bold: true }), italic = (input) => applyStyle(input, { italic: true }), underline = (input) => applyStyle(input, { underline: true }), strikethrough = (input) => applyStyle(input, { strikethrough: true }), dim = (input) => applyStyle(input, { dim: true }), reverse = (input) => applyStyle(input, { reverse: true }), blink = (input) => applyStyle(input, { blink: true }), fg = (color) => (input) => applyStyle(input, { fg: color }), bg = (color) => (input) => applyStyle(input, { bg: color }), link = (url2) => (input) => {
437870
+ }, exports_src, loadYoga, yoga_wasm_base64_esm_default, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, constants2, YGEnums_default, Yoga, src_default, VALID_BORDER_STYLES, BorderChars, BorderCharArrays, KeyHandler, InternalKeyHandler, DEFAULT_FOREGROUND_RGB, DEFAULT_BACKGROUND_RGB, INTENT_RGB = 0, INTENT_INDEXED = 1, INTENT_DEFAULT = 2, ANSI16_RGB, ANSI_256_CUBE_LEVELS, CSS_COLOR_NAMES, block_default, shade_default, slick_default, tiny_default, huge_default, grid_default, pallet_default, fonts, parsedFonts, TextAttributes, ATTRIBUTE_BASE_BITS = 8, ATTRIBUTE_BASE_MASK = 255, DebugOverlayCorner, TargetChannel, ATTRIBUTE_BASE_MASK2 = 255, LINK_ID_SHIFT = 8, LINK_ID_PAYLOAD_MASK = 16777215, BrandedStyledText, StyledText, black = (input) => applyStyle(input, { fg: "black" }), red = (input) => applyStyle(input, { fg: "red" }), green = (input) => applyStyle(input, { fg: "green" }), yellow = (input) => applyStyle(input, { fg: "yellow" }), blue = (input) => applyStyle(input, { fg: "blue" }), magenta = (input) => applyStyle(input, { fg: "magenta" }), cyan = (input) => applyStyle(input, { fg: "cyan" }), white = (input) => applyStyle(input, { fg: "white" }), brightBlack = (input) => applyStyle(input, { fg: "brightBlack" }), brightRed = (input) => applyStyle(input, { fg: "brightRed" }), brightGreen = (input) => applyStyle(input, { fg: "brightGreen" }), brightYellow = (input) => applyStyle(input, { fg: "brightYellow" }), brightBlue = (input) => applyStyle(input, { fg: "brightBlue" }), brightMagenta = (input) => applyStyle(input, { fg: "brightMagenta" }), brightCyan = (input) => applyStyle(input, { fg: "brightCyan" }), brightWhite = (input) => applyStyle(input, { fg: "brightWhite" }), bgBlack = (input) => applyStyle(input, { bg: "black" }), bgRed = (input) => applyStyle(input, { bg: "red" }), bgGreen = (input) => applyStyle(input, { bg: "green" }), bgYellow = (input) => applyStyle(input, { bg: "yellow" }), bgBlue = (input) => applyStyle(input, { bg: "blue" }), bgMagenta = (input) => applyStyle(input, { bg: "magenta" }), bgCyan = (input) => applyStyle(input, { bg: "cyan" }), bgWhite = (input) => applyStyle(input, { bg: "white" }), bold = (input) => applyStyle(input, { bold: true }), italic = (input) => applyStyle(input, { italic: true }), underline = (input) => applyStyle(input, { underline: true }), strikethrough = (input) => applyStyle(input, { strikethrough: true }), dim = (input) => applyStyle(input, { dim: true }), reverse = (input) => applyStyle(input, { reverse: true }), blink = (input) => applyStyle(input, { blink: true }), fg = (color) => (input) => applyStyle(input, { fg: color }), bg = (color) => (input) => applyStyle(input, { bg: color }), link = (url2) => (input) => {
437579
437871
  const chunk = typeof input === "object" && "__isChunk" in input ? input : {
437580
437872
  __isChunk: true,
437581
437873
  text: String(input)
@@ -437584,7 +437876,7 @@ var __defProp8, __returnValue2 = (v3) => v3, __export3 = (target, all2) => {
437584
437876
  ...chunk,
437585
437877
  link: { url: url2 }
437586
437878
  };
437587
- }, kittyKeyMap, functionalKeyMap, tildeKeyMap, metaKeyCodeRe, fnKeyRe, keyName, nonAlphanumericKeys, isShiftKey = (code) => {
437879
+ }, kittyKeyMap, kittyNamedSingleStrokeKeys, functionalKeyMap, tildeKeyMap, metaKeyCodeRe, fnKeyRe, keyName, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, isShiftKey = (code) => {
437588
437880
  return ["[a", "[b", "[c", "[d", "[e", "[2$", "[3$", "[5$", "[6$", "[7$", "[8$", "[Z"].includes(code);
437589
437881
  }, isCtrlKey = (code) => {
437590
437882
  return ["Oa", "Ob", "Oc", "Od", "Oe", "[2^", "[3^", "[5^", "[6^", "[7^", "[8^"].includes(code);
@@ -437780,8 +438072,8 @@ var __defProp8, __returnValue2 = (v3) => v3, __export3 = (target, all2) => {
437780
438072
  key3.code = "[3~";
437781
438073
  }
437782
438074
  return key3;
437783
- }, MouseParser, singletonCacheSymbol, envRegistry, envStore, env, DEFAULT_TIMEOUT_MS = 20, DEFAULT_MAX_PENDING_BYTES, INITIAL_PENDING_CAPACITY = 256, ESC = 27, BEL = 7, BRACKETED_PASTE_START, BRACKETED_PASTE_END, EMPTY_BYTES, KEY_DECODER, DEFAULT_PROTOCOL_CONTEXT, RXVT_DOLLAR_CSI_RE, SYSTEM_CLOCK, TIMERS_MAP, _cachedParsers, DEFAULT_PARSERS, isUrl3 = (path6) => path6.startsWith("http://") || path6.startsWith("https://"), TreeSitterClient, DataPathsManager, extensionToFiletype, basenameToFiletype, __dirname2 = "/Users/runner/work/opentui/opentui/packages/core/src/lib/tree-sitter/assets", SYSTEM_CLOCK2, OSC4_RESPONSE, OSC_SPECIAL_RESPONSE, PASTE_TEXT_DECODER, URL_SCOPES, pointerSize, typeSizes, primitiveKeys, typeAlignments, typeGetters, pointerPacker, pointerUnpacker, encoder3, decoder, rgbaPackTransform = (rgba) => rgba ? ptr3(rgba.buffer) : null, rgbaUnpackTransform = (ptr42) => ptr42 ? RGBA.fromArray(new Float32Array(toArrayBuffer3(ptr42))) : undefined, StyledChunkStruct, HighlightStruct, LogicalCursorStruct, VisualCursorStruct, UnicodeMethodEnum, TerminalCapabilitiesStruct, EncodedCharStruct, LineInfoStruct, MeasureResultStruct, CursorStateStruct, CursorStyleOptionsStruct, GridDrawOptionsStruct, BuildOptionsStruct, AllocatorStatsStruct, GrowthPolicyEnum, NativeSpanFeedOptionsStruct, NativeSpanFeedStatsStruct, SpanInfoStruct, ReserveInfoStruct, module2, targetLibPath, CURSOR_STYLE_TO_ID, CURSOR_ID_TO_STYLE, MOUSE_STYLE_TO_ID, globalTraceSymbols = null, globalFFILogPath = null, exitHandlerRegistered = false, LogLevel2, opentuiLibPath, opentuiLib, BrandedRenderable, LayoutEvents, RenderableEvents, BaseRenderable, yogaConfig, Renderable, RootRenderable, BrandedVNode, EditBuffer, BoxRenderable, TextBufferRenderable, CodeRenderable, BrandedTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, TextRenderable, Capture, CapturedWritableStream, defaultKeyAliases, capture, TerminalConsoleCache, terminalConsoleCache, ConsolePosition, defaultConsoleKeybindings, DEFAULT_CONSOLE_OPTIONS, INDENT_WIDTH = 2, TerminalConsole, BrandedEditBufferRenderable, EditBufferRenderableEvents, EditBufferRenderable, ANSI, OSC_THEME_RESPONSE, DEFAULT_FOOTER_HEIGHT = 12, MAX_SCROLLBACK_SURFACE_HEIGHT_PASSES = 4, TRANSPARENT_RGBA, scrollbackSurfaceCounter = 0, CHAR_FLAG_CONTINUATION = 3221225472, CHAR_FLAG_MASK = 3221225472, ScrollbackSnapshotRenderContext, DEFAULT_FORWARDED_ENV_KEYS, KITTY_FLAG_DISAMBIGUATE = 1, KITTY_FLAG_EVENT_TYPES = 2, KITTY_FLAG_ALTERNATE_KEYS = 4, KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8, KITTY_FLAG_REPORT_TEXT = 16, DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES = 67108864, MouseButton, rendererTracker, CliRenderEvents, RendererControlState, CliRenderer;
437784
- var init_index_qpcsqve6 = __esm(async () => {
438075
+ }, MouseParser, singletonCacheSymbol, envRegistry, envStore, env, DEFAULT_TIMEOUT_MS = 20, DEFAULT_MAX_PENDING_BYTES, INITIAL_PENDING_CAPACITY = 256, ESC = 27, BEL = 7, BRACKETED_PASTE_START, BRACKETED_PASTE_END, EMPTY_BYTES, KEY_DECODER, DEFAULT_PROTOCOL_CONTEXT, RXVT_DOLLAR_CSI_RE, SYSTEM_CLOCK, TIMERS_MAP, _cachedParsers, DEFAULT_PARSERS, isUrl3 = (path6) => path6.startsWith("http://") || path6.startsWith("https://"), TreeSitterClient, DataPathsManager, extensionToFiletype, basenameToFiletype, __dirname2 = "/Users/runner/work/opentui/opentui/packages/core/src/lib/tree-sitter/assets", SYSTEM_CLOCK2, OSC4_RESPONSE, OSC_SPECIAL_RESPONSE, DEFAULT_FOREGROUND_FALLBACK, DEFAULT_BACKGROUND_FALLBACK, fallbackAnsi256Palette = null, PASTE_TEXT_DECODER, URL_SCOPES, pointerSize, typeSizes, primitiveKeys, typeAlignments, typeGetters, pointerPacker, pointerUnpacker, encoder3, decoder, rgbaPackTransform = (rgba) => rgba ? ptr3(rgba.buffer) : null, rgbaUnpackTransform = (ptr42) => ptr42 ? RGBA.fromArray(new Uint16Array(toArrayBuffer3(ptr42, 0, 8))) : undefined, StyledChunkStruct, HighlightStruct, LogicalCursorStruct, VisualCursorStruct, UnicodeMethodEnum, TerminalCapabilitiesStruct, EncodedCharStruct, LineInfoStruct, MeasureResultStruct, CursorStateStruct, CursorStyleOptionsStruct, GridDrawOptionsStruct, BuildOptionsStruct, AllocatorStatsStruct, GrowthPolicyEnum, NativeSpanFeedOptionsStruct, NativeSpanFeedStatsStruct, SpanInfoStruct, ReserveInfoStruct, module2, targetLibPath, CURSOR_STYLE_TO_ID, CURSOR_ID_TO_STYLE, MOUSE_STYLE_TO_ID, globalTraceSymbols = null, globalFFILogPath = null, exitHandlerRegistered = false, LogLevel2, opentuiLibPath, opentuiLib, BrandedRenderable, LayoutEvents, RenderableEvents, BaseRenderable, yogaConfig, Renderable, RootRenderable, BrandedVNode, EditBuffer, BoxRenderable, TextBufferRenderable, CodeRenderable, BrandedTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, TextRenderable, Capture, CapturedWritableStream, defaultKeyAliases, capture, TerminalConsoleCache, terminalConsoleCache, ConsolePosition, defaultConsoleKeybindings, DEFAULT_CONSOLE_OPTIONS, INDENT_WIDTH = 2, TerminalConsole, BrandedEditBufferRenderable, EditBufferRenderableEvents, EditBufferRenderable, ANSI, OSC_THEME_RESPONSE, DEFAULT_FOOTER_HEIGHT = 12, MAX_SCROLLBACK_SURFACE_HEIGHT_PASSES = 4, TRANSPARENT_RGBA, scrollbackSurfaceCounter = 0, CHAR_FLAG_CONTINUATION = 3221225472, CHAR_FLAG_MASK = 3221225472, ScrollbackSnapshotRenderContext, DEFAULT_FORWARDED_ENV_KEYS, KITTY_FLAG_DISAMBIGUATE = 1, KITTY_FLAG_EVENT_TYPES = 2, KITTY_FLAG_ALTERNATE_KEYS = 4, KITTY_FLAG_ALL_KEYS_AS_ESCAPES = 8, KITTY_FLAG_REPORT_TEXT = 16, DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES = 67108864, NATIVE_PALETTE_QUERY_SIZE = 16, MouseButton, rendererTracker, CliRenderEvents, RendererControlState, CliRenderer;
438076
+ var init_index_mw2x3082 = __esm(async () => {
437785
438077
  init_highlights();
437786
438078
  init_tree_sitter_javascript();
437787
438079
  init_highlights2();
@@ -439476,6 +439768,27 @@ var init_index_qpcsqve6 = __esm(async () => {
439476
439768
  }
439477
439769
  }
439478
439770
  };
439771
+ DEFAULT_FOREGROUND_RGB = [255, 255, 255];
439772
+ DEFAULT_BACKGROUND_RGB = [0, 0, 0];
439773
+ ANSI16_RGB = [
439774
+ [0, 0, 0],
439775
+ [128, 0, 0],
439776
+ [0, 128, 0],
439777
+ [128, 128, 0],
439778
+ [0, 0, 128],
439779
+ [128, 0, 128],
439780
+ [0, 128, 128],
439781
+ [192, 192, 192],
439782
+ [128, 128, 128],
439783
+ [255, 0, 0],
439784
+ [0, 255, 0],
439785
+ [255, 255, 0],
439786
+ [0, 0, 255],
439787
+ [255, 0, 255],
439788
+ [0, 255, 255],
439789
+ [255, 255, 255]
439790
+ ];
439791
+ ANSI_256_CUBE_LEVELS = [0, 95, 135, 175, 215, 255];
439479
439792
  CSS_COLOR_NAMES = {
439480
439793
  black: "#000000",
439481
439794
  white: "#FFFFFF",
@@ -442369,6 +442682,7 @@ var init_index_qpcsqve6 = __esm(async () => {
442369
442682
  57453: "iso_level3_shift",
442370
442683
  57454: "iso_level5_shift"
442371
442684
  };
442685
+ kittyNamedSingleStrokeKeys = [...new Set(Object.values(kittyKeyMap))];
442372
442686
  functionalKeyMap = {
442373
442687
  A: "up",
442374
442688
  B: "down",
@@ -442487,6 +442801,9 @@ var init_index_qpcsqve6 = __esm(async () => {
442487
442801
  "[Z": "tab"
442488
442802
  };
442489
442803
  nonAlphanumericKeys = [...Object.values(keyName), "backspace"];
442804
+ terminalNamedSingleStrokeKeys = [
442805
+ ...new Set(["return", "linefeed", "tab", "escape", "space", ...nonAlphanumericKeys, ...kittyNamedSingleStrokeKeys])
442806
+ ];
442490
442807
  modifyOtherKeysRe = /^\x1b\[27;(\d+);(\d+)~$/;
442491
442808
  MouseParser = class MouseParser {
442492
442809
  mouseButtonsPressed = new Set;
@@ -443365,6 +443682,8 @@ var init_index_qpcsqve6 = __esm(async () => {
443365
443682
  SYSTEM_CLOCK2 = new SystemClock;
443366
443683
  OSC4_RESPONSE = /\x1b]4;(\d+);(?:(?:rgb:)([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)|#([0-9a-fA-F]{6}))(?:\x07|\x1b\\)/g;
443367
443684
  OSC_SPECIAL_RESPONSE = /\x1b](\d+);(?:(?:rgb:)([0-9a-fA-F]+)\/([0-9a-fA-F]+)\/([0-9a-fA-F]+)|#([0-9a-fA-F]{6}))(?:\x07|\x1b\\)/g;
443685
+ DEFAULT_FOREGROUND_FALLBACK = RGBA.fromInts(...DEFAULT_FOREGROUND_RGB);
443686
+ DEFAULT_BACKGROUND_FALLBACK = RGBA.fromInts(...DEFAULT_BACKGROUND_RGB);
443368
443687
  PASTE_TEXT_DECODER = new TextDecoder;
443369
443688
  URL_SCOPES = ["markup.link.url", "string.special.url"];
443370
443689
  pointerSize = process.arch === "x64" || process.arch === "arm64" ? 8 : 4;
@@ -443425,11 +443744,19 @@ var init_index_qpcsqve6 = __esm(async () => {
443425
443744
  ["link_len", "u64", { lengthOf: "link" }]
443426
443745
  ], {
443427
443746
  mapValue: (chunk) => {
443747
+ const normalizedFg = normalizeColorValue(chunk.fg ?? null);
443748
+ const normalizedBg = normalizeColorValue(chunk.bg ?? null);
443428
443749
  if (!chunk.link || typeof chunk.link === "string") {
443429
- return chunk;
443750
+ return {
443751
+ ...chunk,
443752
+ fg: normalizedFg?.rgba ?? null,
443753
+ bg: normalizedBg?.rgba ?? null
443754
+ };
443430
443755
  }
443431
443756
  return {
443432
443757
  ...chunk,
443758
+ fg: normalizedFg?.rgba ?? null,
443759
+ bg: normalizedBg?.rgba ?? null,
443433
443760
  link: chunk.link.url
443434
443761
  };
443435
443762
  }
@@ -443458,6 +443785,7 @@ var init_index_qpcsqve6 = __esm(async () => {
443458
443785
  ["kitty_keyboard", "bool_u8"],
443459
443786
  ["kitty_graphics", "bool_u8"],
443460
443787
  ["rgb", "bool_u8"],
443788
+ ["ansi256", "bool_u8"],
443461
443789
  ["unicode", UnicodeMethodEnum],
443462
443790
  ["sgr_pixels", "bool_u8"],
443463
443791
  ["color_scheme_updates", "bool_u8"],
@@ -443640,6 +443968,7 @@ var init_index_qpcsqve6 = __esm(async () => {
443640
443968
  ((RenderableEvents2) => {
443641
443969
  RenderableEvents2["FOCUSED"] = "focused";
443642
443970
  RenderableEvents2["BLURRED"] = "blurred";
443971
+ RenderableEvents2["DESTROYED"] = "destroyed";
443643
443972
  })(RenderableEvents ||= {});
443644
443973
  BaseRenderable = class BaseRenderable extends EventEmitter5 {
443645
443974
  [BrandedRenderable] = true;
@@ -443827,8 +444156,8 @@ var init_index_qpcsqve6 = __esm(async () => {
443827
444156
  focus() {
443828
444157
  if (this._isDestroyed || this._focused || !this._focusable)
443829
444158
  return;
443830
- this._ctx.focusRenderable(this);
443831
444159
  this._focused = true;
444160
+ this._ctx.focusRenderable(this);
443832
444161
  this.requestRender();
443833
444162
  this.keypressHandler = (key3) => {
443834
444163
  if (this._isDestroyed)
@@ -444711,6 +445040,7 @@ var init_index_qpcsqve6 = __esm(async () => {
444711
445040
  return;
444712
445041
  }
444713
445042
  this._isDestroyed = true;
445043
+ this.emit("destroyed");
444714
445044
  if (this.parent) {
444715
445045
  this.parent.remove(this.id);
444716
445046
  }
@@ -445892,6 +446222,7 @@ var init_index_qpcsqve6 = __esm(async () => {
445892
446222
  this._highlightsDirty = true;
445893
446223
  this._highlightSnapshotId++;
445894
446224
  if (this._streaming && !this._drawUnstyledText && this._filetype) {
446225
+ this.requestRender();
445895
446226
  return;
445896
446227
  }
445897
446228
  this.textBuffer.setText(value);
@@ -448489,6 +448820,7 @@ var init_index_qpcsqve6 = __esm(async () => {
448489
448820
  CliRenderEvents2["RESIZE"] = "resize";
448490
448821
  CliRenderEvents2["FOCUS"] = "focus";
448491
448822
  CliRenderEvents2["BLUR"] = "blur";
448823
+ CliRenderEvents2["FOCUSED_RENDERABLE"] = "focused_renderable";
448492
448824
  CliRenderEvents2["FOCUSED_EDITOR"] = "focused_editor";
448493
448825
  CliRenderEvents2["THEME_MODE"] = "theme_mode";
448494
448826
  CliRenderEvents2["CAPABILITIES"] = "capabilities";
@@ -448624,18 +448956,20 @@ var init_index_qpcsqve6 = __esm(async () => {
448624
448956
  lifecyclePasses = new Set;
448625
448957
  _openConsoleOnError = true;
448626
448958
  _paletteDetector = null;
448959
+ _paletteCache = new Map;
448627
448960
  _cachedPalette = null;
448628
448961
  _paletteDetectionPromise = null;
448962
+ _paletteDetectionSize = 0;
448963
+ _paletteEpoch = 0;
448964
+ _publishedPaletteSignature = null;
448965
+ _palettePublishGeneration = 0;
448629
448966
  _onDestroy;
448630
- _themeMode = null;
448631
- _themeModeSource = "none";
448632
- _themeFallbackPending = true;
448633
- _themeOscForeground = null;
448634
- _themeOscBackground = null;
448967
+ themeModeState;
448635
448968
  _terminalFocusState = null;
448636
448969
  sequenceHandlers = [];
448637
448970
  prependedInputHandlers = [];
448638
448971
  shouldRestoreModesOnNextFocus = false;
448972
+ themeModeHandler;
448639
448973
  idleResolvers = [];
448640
448974
  _debugInputs = [];
448641
448975
  _debugModeEnabled = env.OTUI_DEBUG;
@@ -448715,7 +449049,7 @@ Captured external output:
448715
449049
  this.rendererPtr = rendererPtr;
448716
449050
  this.clearOnShutdown = config2.clearOnShutdown ?? true;
448717
449051
  this.lib.setClearOnShutdown(this.rendererPtr, this.clearOnShutdown);
448718
- const forwardEnvKeys = config2.forwardEnvKeys ?? [...DEFAULT_FORWARDED_ENV_KEYS];
449052
+ const forwardEnvKeys = config2.forwardEnvKeys ?? (config2.remote ? [] : [...DEFAULT_FORWARDED_ENV_KEYS]);
448719
449053
  for (const key3 of forwardEnvKeys) {
448720
449054
  const value = process.env[key3];
448721
449055
  if (value === undefined)
@@ -448738,6 +449072,18 @@ Captured external output:
448738
449072
  this.targetFps = config2.targetFps || 30;
448739
449073
  this.maxFps = config2.maxFps || 60;
448740
449074
  this.clock = config2.clock ?? new SystemClock;
449075
+ this.themeModeState = new RendererThemeMode({
449076
+ queryThemeColors: () => {
449077
+ this.lib.queryThemeColors(this.rendererPtr);
449078
+ }
449079
+ }, this.clock);
449080
+ this.themeModeHandler = (sequence) => {
449081
+ const result = this.themeModeState.handleSequence(sequence);
449082
+ if (result.changedMode) {
449083
+ this.emit("theme_mode", result.changedMode);
449084
+ }
449085
+ return result.handled;
449086
+ };
448741
449087
  this.memorySnapshotInterval = config2.memorySnapshotInterval ?? 0;
448742
449088
  this.gatherStats = config2.gatherStats || false;
448743
449089
  this.maxStatSamples = config2.maxStatSamples || 300;
@@ -448870,20 +449216,29 @@ Captured external output:
448870
449216
  return Math.max(now2 - then, 0);
448871
449217
  }
448872
449218
  focusRenderable(renderable) {
448873
- if (this._currentFocusedRenderable === renderable)
449219
+ if (this._currentFocusedRenderable === renderable) {
448874
449220
  return;
448875
- const prev = this.currentFocusedEditor;
448876
- this._currentFocusedRenderable?.blur();
449221
+ }
449222
+ const previousRenderable = this._currentFocusedRenderable;
449223
+ const previousEditor = this.currentFocusedEditor;
448877
449224
  this._currentFocusedRenderable = renderable;
448878
- const next = this.currentFocusedEditor;
448879
- if (prev !== next) {
448880
- this.emit("focused_editor", next, prev);
449225
+ previousRenderable?.blur();
449226
+ const currentEditor = this.currentFocusedEditor;
449227
+ if (previousEditor !== currentEditor) {
449228
+ this.emit("focused_editor", currentEditor, previousEditor);
448881
449229
  }
449230
+ this.emit("focused_renderable", renderable, previousRenderable);
448882
449231
  }
448883
449232
  blurRenderable(renderable) {
448884
- if (this._currentFocusedRenderable === renderable) {
448885
- this._currentFocusedRenderable = null;
449233
+ if (this._currentFocusedRenderable !== renderable) {
449234
+ return;
448886
449235
  }
449236
+ const previousEditor = this.currentFocusedEditor;
449237
+ this._currentFocusedRenderable = null;
449238
+ if (previousEditor !== null) {
449239
+ this.emit("focused_editor", null, previousEditor);
449240
+ }
449241
+ this.emit("focused_renderable", null, renderable);
448887
449242
  }
448888
449243
  setCapturedRenderable(renderable) {
448889
449244
  if (this.capturedRenderable === renderable) {
@@ -449099,39 +449454,13 @@ Captured external output:
449099
449454
  return this._capabilities;
449100
449455
  }
449101
449456
  get themeMode() {
449102
- return this._themeMode;
449457
+ return this.themeModeState.themeMode;
449103
449458
  }
449104
449459
  waitForThemeMode(timeoutMs = 1000) {
449105
449460
  if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
449106
449461
  throw new Error("timeoutMs must be a non-negative finite number");
449107
449462
  }
449108
- if (this._themeMode !== null || this._isDestroyed || timeoutMs === 0) {
449109
- return Promise.resolve(this._themeMode);
449110
- }
449111
- return new Promise((resolve42) => {
449112
- let timeoutHandle = null;
449113
- const cleanup = () => {
449114
- if (timeoutHandle !== null) {
449115
- this.clock.clearTimeout(timeoutHandle);
449116
- timeoutHandle = null;
449117
- }
449118
- this.off("theme_mode", handleThemeMode);
449119
- this.off("destroy", handleDestroy);
449120
- };
449121
- const finish = () => {
449122
- cleanup();
449123
- resolve42(this._themeMode);
449124
- };
449125
- const handleThemeMode = () => {
449126
- finish();
449127
- };
449128
- const handleDestroy = () => {
449129
- finish();
449130
- };
449131
- this.on("theme_mode", handleThemeMode);
449132
- this.on("destroy", handleDestroy);
449133
- timeoutHandle = this.clock.setTimeout(finish, timeoutMs);
449134
- });
449463
+ return this.themeModeState.waitForThemeMode(timeoutMs, this._isDestroyed);
449135
449464
  }
449136
449465
  getDebugInputs() {
449137
449466
  return [...this._debugInputs];
@@ -449938,6 +450267,7 @@ Captured external output:
449938
450267
  }, 120);
449939
450268
  }
449940
450269
  this.queryPixelResolution();
450270
+ this.ensureNativePaletteState();
449941
450271
  }
449942
450272
  stdinListener = ((chunk) => {
449943
450273
  const data = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
@@ -449980,6 +450310,10 @@ Captured external output:
449980
450310
  }
449981
450311
  this.lib.processCapabilityResponse(this.rendererPtr, sequence);
449982
450312
  this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
450313
+ if (hasStandardCapabilitySignature) {
450314
+ this.forceFullRepaintRequested = true;
450315
+ this.requestRender();
450316
+ }
449983
450317
  this.emit("capabilities", this._capabilities);
449984
450318
  const hadPendingSplitStartupCursorSeed = this.pendingSplitStartupCursorSeed;
449985
450319
  if (hadPendingSplitStartupCursorSeed && hasCursorReport && this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout") {
@@ -450021,52 +450355,6 @@ Captured external output:
450021
450355
  }
450022
450356
  return false;
450023
450357
  }).bind(this);
450024
- themeModeHandler = ((sequence) => {
450025
- if (sequence === "\x1B[?997;1n") {
450026
- this.applyThemeMode("dark", "csi");
450027
- this._themeFallbackPending = false;
450028
- return true;
450029
- }
450030
- if (sequence === "\x1B[?997;2n") {
450031
- this.applyThemeMode("light", "csi");
450032
- this._themeFallbackPending = false;
450033
- return true;
450034
- }
450035
- let handledOscThemeResponse = false;
450036
- let match2;
450037
- OSC_THEME_RESPONSE.lastIndex = 0;
450038
- while (match2 = OSC_THEME_RESPONSE.exec(sequence)) {
450039
- handledOscThemeResponse = true;
450040
- const color = oscThemeColorToHex(match2[2], match2[3], match2[4], match2[5]);
450041
- if (match2[1] === "10") {
450042
- this._themeOscForeground = color;
450043
- } else {
450044
- this._themeOscBackground = color;
450045
- }
450046
- }
450047
- if (!handledOscThemeResponse) {
450048
- return false;
450049
- }
450050
- if (!this._themeFallbackPending) {
450051
- return true;
450052
- }
450053
- if (this._themeOscForeground && this._themeOscBackground) {
450054
- this.applyThemeMode(inferThemeModeFromBackgroundColor(this._themeOscBackground), "osc");
450055
- this._themeFallbackPending = false;
450056
- }
450057
- return true;
450058
- }).bind(this);
450059
- applyThemeMode(mode, source) {
450060
- if (source === "osc" && this._themeModeSource === "csi") {
450061
- return;
450062
- }
450063
- const changed = this._themeMode !== mode;
450064
- this._themeMode = mode;
450065
- this._themeModeSource = source;
450066
- if (changed) {
450067
- this.emit("theme_mode", mode);
450068
- }
450069
- }
450070
450358
  dispatchSequenceHandlers(sequence) {
450071
450359
  if (this._debugModeEnabled) {
450072
450360
  this._debugInputs.push({
@@ -450601,6 +450889,7 @@ Captured external output:
450601
450889
  });
450602
450890
  this.stdinParser?.reset();
450603
450891
  this.stdin.removeListener("data", this.stdinListener);
450892
+ this.themeModeState.cancelRefresh();
450604
450893
  this.lib.suspendRenderer(this.rendererPtr);
450605
450894
  if (this.stdin.setRawMode) {
450606
450895
  this.stdin.setRawMode(false);
@@ -450701,6 +450990,7 @@ Captured external output:
450701
450990
  this.clock.clearTimeout(this.renderTimeout);
450702
450991
  this.renderTimeout = null;
450703
450992
  }
450993
+ this.themeModeState.cancelRefresh();
450704
450994
  this._isRunning = false;
450705
450995
  this.waitingForPixelResolution = false;
450706
450996
  this.updateStdinParserProtocolContext({
@@ -450734,8 +451024,14 @@ Captured external output:
450734
451024
  this._paletteDetector.cleanup();
450735
451025
  this._paletteDetector = null;
450736
451026
  }
451027
+ this._paletteCache.clear();
450737
451028
  this._paletteDetectionPromise = null;
451029
+ this._paletteDetectionSize = 0;
450738
451030
  this._cachedPalette = null;
451031
+ this._publishedPaletteSignature = null;
451032
+ this._paletteEpoch = 0;
451033
+ this._palettePublishGeneration = 0;
451034
+ this.themeModeState.dispose();
450739
451035
  this.emit("destroy");
450740
451036
  try {
450741
451037
  this.root.destroyRecursively();
@@ -450875,9 +451171,10 @@ Captured external output:
450875
451171
  this.flushPendingSplitCommits(forceSplitRepaint);
450876
451172
  this.pendingSplitFooterTransition = null;
450877
451173
  } else {
451174
+ const force = this.forceFullRepaintRequested;
450878
451175
  this.forceFullRepaintRequested = false;
450879
451176
  this.pendingSplitFooterTransition = null;
450880
- this.lib.render(this.rendererPtr, false);
451177
+ this.lib.render(this.rendererPtr, force);
450881
451178
  }
450882
451179
  this.renderingNative = false;
450883
451180
  }
@@ -451022,13 +451319,63 @@ Captured external output:
451022
451319
  }
451023
451320
  }
451024
451321
  get paletteDetectionStatus() {
451025
- if (this._cachedPalette)
451026
- return "cached";
451027
451322
  if (this._paletteDetectionPromise)
451028
451323
  return "detecting";
451324
+ if (this._paletteCache.size > 0)
451325
+ return "cached";
451029
451326
  return "idle";
451030
451327
  }
451328
+ getCachedPaletteBySize(size) {
451329
+ const exactMatch = this._paletteCache.get(size);
451330
+ if (exactMatch) {
451331
+ return exactMatch;
451332
+ }
451333
+ const largerSize = [...this._paletteCache.keys()].sort((a2, b4) => a2 - b4).find((candidate) => candidate >= size);
451334
+ if (largerSize === undefined) {
451335
+ return null;
451336
+ }
451337
+ const source = this._paletteCache.get(largerSize);
451338
+ if (!source) {
451339
+ return null;
451340
+ }
451341
+ const projected = {
451342
+ ...source,
451343
+ palette: source.palette.slice(0, size)
451344
+ };
451345
+ this._paletteCache.set(size, projected);
451346
+ return projected;
451347
+ }
451348
+ ensurePaletteDetector() {
451349
+ if (!this._paletteDetector) {
451350
+ const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
451351
+ this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isLegacyTmux, {
451352
+ subscribeOsc: this.subscribeOsc.bind(this)
451353
+ }, this.clock);
451354
+ }
451355
+ return this._paletteDetector;
451356
+ }
451357
+ syncNativePaletteState(colors2) {
451358
+ const signature = buildTerminalPaletteSignature(colors2);
451359
+ if (this._publishedPaletteSignature !== signature) {
451360
+ this._paletteEpoch = this._paletteEpoch + 1 >>> 0;
451361
+ }
451362
+ this._publishedPaletteSignature = signature;
451363
+ const normalized = normalizeTerminalPalette(colors2);
451364
+ this.lib.rendererSetPaletteState(this.rendererPtr, normalized.palette, normalized.defaultForeground, normalized.defaultBackground, this._paletteEpoch);
451365
+ }
451366
+ ensureNativePaletteState() {
451367
+ if (!this._terminalIsSetup || this._isDestroyed)
451368
+ return;
451369
+ const publishGeneration = this._palettePublishGeneration;
451370
+ this.getPalette({ size: NATIVE_PALETTE_QUERY_SIZE }).then((colors2) => {
451371
+ if (this._palettePublishGeneration === publishGeneration) {
451372
+ this.syncNativePaletteState(colors2);
451373
+ }
451374
+ this.requestRender();
451375
+ }).catch(() => {});
451376
+ }
451031
451377
  clearPaletteCache() {
451378
+ this._paletteCache.clear();
451032
451379
  this._cachedPalette = null;
451033
451380
  }
451034
451381
  async getPalette(options) {
@@ -451036,33 +451383,80 @@ Captured external output:
451036
451383
  throw new Error("Cannot detect palette while renderer is suspended");
451037
451384
  }
451038
451385
  const requestedSize = options?.size ?? 16;
451039
- if (this._cachedPalette && this._cachedPalette.palette.length !== requestedSize) {
451040
- this._cachedPalette = null;
451041
- }
451042
- if (this._cachedPalette) {
451043
- return this._cachedPalette;
451386
+ const detectionTimeout = options?.timeout;
451387
+ const cachedPalette = this.getCachedPaletteBySize(requestedSize);
451388
+ if (cachedPalette) {
451389
+ this._cachedPalette = cachedPalette;
451390
+ return cachedPalette;
451044
451391
  }
451045
451392
  if (this._paletteDetectionPromise) {
451046
- return this._paletteDetectionPromise;
451047
- }
451048
- if (!this._paletteDetector) {
451049
- const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
451050
- this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isLegacyTmux, {
451051
- subscribeOsc: this.subscribeOsc.bind(this)
451052
- }, this.clock);
451393
+ if (this._paletteDetectionSize >= requestedSize) {
451394
+ return this._paletteDetectionPromise.then((palette) => {
451395
+ const cached3 = this.getCachedPaletteBySize(requestedSize);
451396
+ if (cached3) {
451397
+ this._cachedPalette = cached3;
451398
+ return cached3;
451399
+ }
451400
+ const projected = {
451401
+ ...palette,
451402
+ palette: palette.palette.slice(0, requestedSize)
451403
+ };
451404
+ this._paletteCache.set(requestedSize, projected);
451405
+ this._cachedPalette = projected;
451406
+ return projected;
451407
+ });
451408
+ }
451409
+ await this._paletteDetectionPromise;
451410
+ const afterWait = this.getCachedPaletteBySize(requestedSize);
451411
+ if (afterWait) {
451412
+ this._cachedPalette = afterWait;
451413
+ return afterWait;
451414
+ }
451053
451415
  }
451054
- this._paletteDetectionPromise = this._paletteDetector.detect(options).then((result) => {
451416
+ const detector = this.ensurePaletteDetector();
451417
+ const publishGeneration = this._palettePublishGeneration;
451418
+ this._paletteDetectionSize = requestedSize;
451419
+ this._paletteDetectionPromise = detector.detect({ ...options, timeout: detectionTimeout }).then((result) => {
451420
+ this._paletteCache.set(result.palette.length, result);
451055
451421
  this._cachedPalette = result;
451056
451422
  this._paletteDetectionPromise = null;
451423
+ this._paletteDetectionSize = 0;
451424
+ if (this._palettePublishGeneration === publishGeneration) {
451425
+ if (result.palette.length >= NATIVE_PALETTE_QUERY_SIZE) {
451426
+ this.syncNativePaletteState(result);
451427
+ } else if (this._terminalIsSetup && !this._paletteCache.has(NATIVE_PALETTE_QUERY_SIZE)) {
451428
+ this.ensureNativePaletteState();
451429
+ }
451430
+ }
451057
451431
  return result;
451432
+ }).catch((error48) => {
451433
+ this._paletteDetectionPromise = null;
451434
+ this._paletteDetectionSize = 0;
451435
+ throw error48;
451058
451436
  });
451059
- return this._paletteDetectionPromise;
451437
+ const detected = await this._paletteDetectionPromise;
451438
+ const finalPalette = this.getCachedPaletteBySize(requestedSize) ?? detected;
451439
+ this._cachedPalette = finalPalette;
451440
+ return finalPalette;
451060
451441
  }
451061
451442
  };
451062
451443
  });
451063
451444
 
451064
- // node_modules/@opentui/core/index-r3mexem1.js
451445
+ // node_modules/@opentui/core/index-mch6dv67.js
451065
451446
  import { toArrayBuffer as toArrayBuffer5 } from "bun:ffi";
451447
+ function toU82(value) {
451448
+ return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
451449
+ }
451450
+ function channel(buffer, index) {
451451
+ return (buffer[index] & 255) / 255;
451452
+ }
451453
+ function setRgb(buffer, base, r4, g2, b4) {
451454
+ const a2 = buffer[base + 3] & 255;
451455
+ buffer[base] = toU82(r4);
451456
+ buffer[base + 1] = toU82(g2);
451457
+ buffer[base + 2] = toU82(b4);
451458
+ buffer[base + 3] = a2;
451459
+ }
451066
451460
 
451067
451461
  class DistortionEffect {
451068
451462
  glitchChancePerSecond = 0.5;
@@ -451127,8 +451521,8 @@ class DistortionEffect {
451127
451521
  if (glitch.type === "shift" || glitch.type === "flip") {
451128
451522
  if (!tempChar) {
451129
451523
  tempChar = new Uint32Array(width);
451130
- tempFg = new Float32Array(width * 4);
451131
- tempBg = new Float32Array(width * 4);
451524
+ tempFg = new Uint16Array(width * 4);
451525
+ tempBg = new Uint16Array(width * 4);
451132
451526
  tempAttr = new Uint8Array(width);
451133
451527
  }
451134
451528
  try {
@@ -451235,12 +451629,8 @@ class DistortionEffect {
451235
451629
  gBg = 1 - gFg;
451236
451630
  bBg = 1 - bFg;
451237
451631
  }
451238
- buf.fg[destColorIndex] = rFg;
451239
- buf.fg[destColorIndex + 1] = gFg;
451240
- buf.fg[destColorIndex + 2] = bFg;
451241
- buf.bg[destColorIndex] = rBg;
451242
- buf.bg[destColorIndex + 1] = gBg;
451243
- buf.bg[destColorIndex + 2] = bBg;
451632
+ setRgb(buf.fg, destColorIndex, rFg, gFg, bFg);
451633
+ setRgb(buf.bg, destColorIndex, rBg, gBg, bBg);
451244
451634
  }
451245
451635
  }
451246
451636
  }
@@ -451453,9 +451843,7 @@ class FlamesEffect {
451453
451843
  g2 = flameIntensity * 0.5;
451454
451844
  b4 = 0;
451455
451845
  }
451456
- bg2[colorIndex] = Math.max(bg2[colorIndex], r4 * flameIntensity);
451457
- bg2[colorIndex + 1] = Math.max(bg2[colorIndex + 1], g2 * flameIntensity);
451458
- bg2[colorIndex + 2] = Math.max(bg2[colorIndex + 2], b4 * flameIntensity);
451846
+ setRgb(bg2, colorIndex, Math.max(channel(bg2, colorIndex), r4 * flameIntensity), Math.max(channel(bg2, colorIndex + 1), g2 * flameIntensity), Math.max(channel(bg2, colorIndex + 2), b4 * flameIntensity));
451459
451847
  }
451460
451848
  }
451461
451849
  }
@@ -451521,12 +451909,8 @@ class CRTRollingBarEffect {
451521
451909
  const rowMultiplier = 1 + this._intensity * barFactor;
451522
451910
  for (let x3 = 0;x3 < width; x3++) {
451523
451911
  const colorIndex = (y4 * width + x3) * 4;
451524
- fg2[colorIndex] = Math.min(1, fg2[colorIndex] * rowMultiplier);
451525
- fg2[colorIndex + 1] = Math.min(1, fg2[colorIndex + 1] * rowMultiplier);
451526
- fg2[colorIndex + 2] = Math.min(1, fg2[colorIndex + 2] * rowMultiplier);
451527
- bg2[colorIndex] = Math.min(1, bg2[colorIndex] * rowMultiplier);
451528
- bg2[colorIndex + 1] = Math.min(1, bg2[colorIndex + 1] * rowMultiplier);
451529
- bg2[colorIndex + 2] = Math.min(1, bg2[colorIndex + 2] * rowMultiplier);
451912
+ setRgb(fg2, colorIndex, Math.min(1, channel(fg2, colorIndex) * rowMultiplier), Math.min(1, channel(fg2, colorIndex + 1) * rowMultiplier), Math.min(1, channel(fg2, colorIndex + 2) * rowMultiplier));
451913
+ setRgb(bg2, colorIndex, Math.min(1, channel(bg2, colorIndex) * rowMultiplier), Math.min(1, channel(bg2, colorIndex + 1) * rowMultiplier), Math.min(1, channel(bg2, colorIndex + 2) * rowMultiplier));
451530
451914
  }
451531
451915
  }
451532
451916
  }
@@ -451625,22 +452009,33 @@ class RainbowTextEffect {
451625
452009
  for (let y4 = 0;y4 < height; y4++) {
451626
452010
  for (let x3 = 0;x3 < width; x3++) {
451627
452011
  const colorIndex = (y4 * width + x3) * 4;
451628
- const r4 = fg2[colorIndex];
451629
- const g2 = fg2[colorIndex + 1];
451630
- const b4 = fg2[colorIndex + 2];
452012
+ const r4 = channel(fg2, colorIndex);
452013
+ const g2 = channel(fg2, colorIndex + 1);
452014
+ const b4 = channel(fg2, colorIndex + 2);
451631
452015
  if (r4 >= whiteThreshold && g2 >= whiteThreshold && b4 >= whiteThreshold) {
451632
452016
  const projection = x3 * cosAngle + y4 * sinAngle;
451633
452017
  const maxProjection = width * cosAngle + height * sinAngle;
451634
452018
  const hue = (projection / maxProjection * repeats + this.time * 0.1) % 1;
451635
452019
  const [newR, newG, newB] = this.hsvToRgb(hue, saturation, value);
451636
- fg2[colorIndex] = newR;
451637
- fg2[colorIndex + 1] = newG;
451638
- fg2[colorIndex + 2] = newB;
452020
+ setRgb(fg2, colorIndex, newR, newG, newB);
451639
452021
  }
451640
452022
  }
451641
452023
  }
451642
452024
  }
451643
452025
  }
452026
+ function toU822(value) {
452027
+ return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
452028
+ }
452029
+ function channel2(buffer, index) {
452030
+ return (buffer[index] & 255) / 255;
452031
+ }
452032
+ function setRgb2(buffer, base, r4, g2, b4) {
452033
+ const a2 = buffer[base + 3] & 255;
452034
+ buffer[base] = toU822(r4);
452035
+ buffer[base + 1] = toU822(g2);
452036
+ buffer[base + 2] = toU822(b4);
452037
+ buffer[base + 3] = a2;
452038
+ }
451644
452039
  function applyScanlines(buffer, strength = 0.8, step = 2) {
451645
452040
  if (strength === 1 || step < 1)
451646
452041
  return;
@@ -451740,7 +452135,7 @@ function applyNoise(buffer, strength = 0.1) {
451740
452135
  function applyChromaticAberration(buffer, strength = 1) {
451741
452136
  const width = buffer.width;
451742
452137
  const height = buffer.height;
451743
- const srcFg = Float32Array.from(buffer.buffers.fg);
452138
+ const srcFg = Uint16Array.from(buffer.buffers.fg);
451744
452139
  const destFg = buffer.buffers.fg;
451745
452140
  const centerX = width / 2;
451746
452141
  const centerY = height / 2;
@@ -451755,9 +452150,7 @@ function applyChromaticAberration(buffer, strength = 1) {
451755
452150
  const gIndex = (y4 * width + x3) * 4;
451756
452151
  const bIndex = (y4 * width + bX) * 4;
451757
452152
  const destIndex = (y4 * width + x3) * 4;
451758
- destFg[destIndex] = srcFg[rIndex];
451759
- destFg[destIndex + 1] = srcFg[gIndex + 1];
451760
- destFg[destIndex + 2] = srcFg[bIndex + 2];
452153
+ setRgb2(destFg, destIndex, channel2(srcFg, rIndex), channel2(srcFg, gIndex + 1), channel2(srcFg, bIndex + 2));
451761
452154
  }
451762
452155
  }
451763
452156
  }
@@ -451771,9 +452164,9 @@ function applyAsciiArt(buffer, ramp = ' .\'`^"",:;Il!i><~+_-?][}{1)(|\\/tfjrxnuv
451771
452164
  for (let x3 = 0;x3 < width; x3++) {
451772
452165
  const index = y4 * width + x3;
451773
452166
  const colorIndex = index * 4;
451774
- const bgR = bg2[colorIndex];
451775
- const bgG = bg2[colorIndex + 1];
451776
- const bgB = bg2[colorIndex + 2];
452167
+ const bgR = channel2(bg2, colorIndex);
452168
+ const bgG = channel2(bg2, colorIndex + 1);
452169
+ const bgB = channel2(bg2, colorIndex + 2);
451777
452170
  const lum = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB;
451778
452171
  const rampIndex = Math.min(rampLength - 1, Math.floor(lum * rampLength));
451779
452172
  chars[index] = ramp[rampIndex].charCodeAt(0);
@@ -451954,16 +452347,16 @@ class BloomEffect {
451954
452347
  return;
451955
452348
  const width = buffer.width;
451956
452349
  const height = buffer.height;
451957
- const srcFg = Float32Array.from(buffer.buffers.fg);
451958
- const srcBg = Float32Array.from(buffer.buffers.bg);
452350
+ const srcFg = Uint16Array.from(buffer.buffers.fg);
452351
+ const srcBg = Uint16Array.from(buffer.buffers.bg);
451959
452352
  const destFg = buffer.buffers.fg;
451960
452353
  const destBg = buffer.buffers.bg;
451961
452354
  const brightPixels = [];
451962
452355
  for (let y4 = 0;y4 < height; y4++) {
451963
452356
  for (let x3 = 0;x3 < width; x3++) {
451964
452357
  const index = (y4 * width + x3) * 4;
451965
- const fgLum = 0.299 * srcFg[index] + 0.587 * srcFg[index + 1] + 0.114 * srcFg[index + 2];
451966
- const bgLum = 0.299 * srcBg[index] + 0.587 * srcBg[index + 1] + 0.114 * srcBg[index + 2];
452358
+ const fgLum = 0.299 * channel2(srcFg, index) + 0.587 * channel2(srcFg, index + 1) + 0.114 * channel2(srcFg, index + 2);
452359
+ const bgLum = 0.299 * channel2(srcBg, index) + 0.587 * channel2(srcBg, index + 1) + 0.114 * channel2(srcBg, index + 2);
451967
452360
  const lum = Math.max(fgLum, bgLum);
451968
452361
  if (lum > threshold) {
451969
452362
  const intensity = (lum - threshold) / (1 - threshold + 0.000001);
@@ -451989,12 +452382,8 @@ class BloomEffect {
451989
452382
  const falloff = 1 - distSq / radiusSq;
451990
452383
  const bloomAmount = bright.intensity * strength * falloff;
451991
452384
  const destIndex = (sampleY * width + sampleX) * 4;
451992
- destFg[destIndex] = Math.min(1, destFg[destIndex] + bloomAmount);
451993
- destFg[destIndex + 1] = Math.min(1, destFg[destIndex + 1] + bloomAmount);
451994
- destFg[destIndex + 2] = Math.min(1, destFg[destIndex + 2] + bloomAmount);
451995
- destBg[destIndex] = Math.min(1, destBg[destIndex] + bloomAmount);
451996
- destBg[destIndex + 1] = Math.min(1, destBg[destIndex + 1] + bloomAmount);
451997
- destBg[destIndex + 2] = Math.min(1, destBg[destIndex + 2] + bloomAmount);
452385
+ setRgb2(destFg, destIndex, Math.min(1, channel2(destFg, destIndex) + bloomAmount), Math.min(1, channel2(destFg, destIndex + 1) + bloomAmount), Math.min(1, channel2(destFg, destIndex + 2) + bloomAmount));
452386
+ setRgb2(destBg, destIndex, Math.min(1, channel2(destBg, destIndex) + bloomAmount), Math.min(1, channel2(destBg, destIndex + 1) + bloomAmount), Math.min(1, channel2(destBg, destIndex + 2) + bloomAmount));
451998
452387
  }
451999
452388
  }
452000
452389
  }
@@ -453362,7 +453751,7 @@ function calculateDynamicHeight(showUnderline, showDescription) {
453362
453751
  }
453363
453752
  return height;
453364
453753
  }
453365
- var exports_src2, VignetteEffect, SEPIA_MATRIX, PROTANOPIA_SIM_MATRIX, DEUTERANOPIA_SIM_MATRIX, TRITANOPIA_SIM_MATRIX, ACHROMATOPSIA_MATRIX, PROTANOPIA_COMP_MATRIX, DEUTERANOPIA_COMP_MATRIX, TRITANOPIA_COMP_MATRIX, TECHNICOLOR_MATRIX, SOLARIZATION_MATRIX, SYNTHWAVE_MATRIX, GREENSCALE_MATRIX, GRAYSCALE_MATRIX, INVERT_MATRIX, easingFunctions, engine, noop4 = () => {}, DEFAULT_DEBUG_PLUGIN_ERRORS = false, DEFAULT_MAX_PLUGIN_ERRORS = 100, slotRegistriesByRenderer, SlotRenderable, FrameBufferRenderable, ASCIIFontRenderable, vstyles, VRenderable, DEFAULT_GUTTER_FG = "#888888", DEFAULT_GUTTER_BG = "transparent", GutterRenderable, LineNumberRenderable, DiffRenderable, defaultTextareaKeybindings, TextareaRenderable, InputRenderableEvents, InputRenderable, MEASURE_HEIGHT = 1e4, TextTableRenderable, T4, C4, me2, m4, xe, be, Re2, I4, Te2, N2, re4, se3, Oe2, Q4, we2, F4, ye2, Pe2, v3 = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", j3, Se2, ie3, $e2, U4, te3, _e2, Le2, Me2, ze2, oe3, Ae2, D4, K4, ae3, Ce2, le2, Ie2, Ee2, Be2, ue2, qe2, ve2, pe3 = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De2, He2, Ze2, Ge2, Ne2, Qe2, Fe2, q3, je2, ce2, he2, Ue2, ne2, W4, Ke2, G3, We2, E4, M4, Xe2, ke2 = (u2) => Xe2[u2], y4 = class {
453754
+ var exports_src2, VignetteEffect, SEPIA_MATRIX, PROTANOPIA_SIM_MATRIX, DEUTERANOPIA_SIM_MATRIX, TRITANOPIA_SIM_MATRIX, ACHROMATOPSIA_MATRIX, PROTANOPIA_COMP_MATRIX, DEUTERANOPIA_COMP_MATRIX, TRITANOPIA_COMP_MATRIX, TECHNICOLOR_MATRIX, SOLARIZATION_MATRIX, SYNTHWAVE_MATRIX, GREENSCALE_MATRIX, GRAYSCALE_MATRIX, INVERT_MATRIX, easingFunctions, engine, noop4 = () => {}, DEFAULT_DEBUG_PLUGIN_ERRORS = false, DEFAULT_MAX_PLUGIN_ERRORS = 100, slotRegistriesByRenderer, SlotRenderable, FrameBufferRenderable, ASCIIFontRenderable, vstyles, VRenderable, DEFAULT_GUTTER_FG = "#888888", DEFAULT_GUTTER_BG = "transparent", GutterRenderable, LineNumberRenderable, DiffRenderable, defaultTextareaKeyBindings, TextareaRenderable, InputRenderableEvents, InputRenderable, MEASURE_HEIGHT = 1e4, TextTableRenderable, T4, C4, me2, m4, xe, be, Re2, I4, Te2, N2, re4, se3, Oe2, Q4, we2, F4, ye2, Pe2, v3 = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", j3, Se2, ie3, $e2, U4, te3, _e2, Le2, Me2, ze2, oe3, Ae2, D4, K4, ae3, Ce2, le2, Ie2, Ee2, Be2, ue2, qe2, ve2, pe3 = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", De2, He2, Ze2, Ge2, Ne2, Qe2, Fe2, q3, je2, ce2, he2, Ue2, ne2, W4, Ke2, G3, We2, E4, M4, Xe2, ke2 = (u2) => Xe2[u2], y4 = class {
453366
453755
  options;
453367
453756
  rules;
453368
453757
  lexer;
@@ -454394,8 +454783,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
454394
454783
  };
454395
454784
  }
454396
454785
  }, _4, Dt, Ht, Zt, Gt, Nt, Ft2, jt2, TRAILING_MARKDOWN_BLOCK_BREAKS_RE, TRAILING_MARKDOWN_BLOCK_NEWLINES_RE, MarkdownRenderable, defaultThumbBackgroundColor, defaultTrackBackgroundColor, SliderRenderable, ScrollBarRenderable, ArrowRenderable, ContentRenderable, SCROLLBOX_PADDING_KEYS, ScrollBoxRenderable, defaultSelectKeybindings, SelectRenderableEvents, SelectRenderable, defaultTabSelectKeybindings, TabSelectRenderableEvents, TabSelectRenderable, TimeToFirstDrawRenderable;
454397
- var init_index_r3mexem1 = __esm(async () => {
454398
- await init_index_qpcsqve6();
454786
+ var init_index_mch6dv67 = __esm(async () => {
454787
+ await init_index_mw2x3082();
454399
454788
  exports_src2 = {};
454400
454789
  __export3(exports_src2, {
454401
454790
  yellow: () => yellow,
@@ -454407,6 +454796,7 @@ var init_index_r3mexem1 = __esm(async () => {
454407
454796
  underline: () => underline,
454408
454797
  treeSitterToTextChunks: () => treeSitterToTextChunks,
454409
454798
  treeSitterToStyledText: () => treeSitterToStyledText,
454799
+ terminalNamedSingleStrokeKeys: () => terminalNamedSingleStrokeKeys,
454410
454800
  t: () => t,
454411
454801
  stripAnsiSequences: () => stripAnsiSequences,
454412
454802
  stringToStyledText: () => stringToStyledText,
@@ -454440,6 +454830,9 @@ var init_index_r3mexem1 = __esm(async () => {
454440
454830
  parseBorderStyle: () => parseBorderStyle,
454441
454831
  parseAlignItems: () => parseAlignItems,
454442
454832
  parseAlign: () => parseAlign,
454833
+ normalizeTerminalPalette: () => normalizeTerminalPalette,
454834
+ normalizeIndexedColorIndex: () => normalizeIndexedColorIndex,
454835
+ normalizeColorValue: () => normalizeColorValue,
454443
454836
  nonAlphanumericKeys: () => nonAlphanumericKeys,
454444
454837
  measureText: () => measureText,
454445
454838
  maybeMakeRenderable: () => maybeMakeRenderable,
@@ -454478,6 +454871,7 @@ var init_index_r3mexem1 = __esm(async () => {
454478
454871
  dim: () => dim,
454479
454872
  detectLinks: () => detectLinks,
454480
454873
  delegate: () => delegate,
454874
+ defaultTextareaKeyBindings: () => defaultTextareaKeyBindings,
454481
454875
  decodePasteBytes: () => decodePasteBytes,
454482
454876
  cyan: () => cyan,
454483
454877
  createTimeline: () => createTimeline,
@@ -454492,6 +454886,7 @@ var init_index_r3mexem1 = __esm(async () => {
454492
454886
  convertGlobalToLocalSelection: () => convertGlobalToLocalSelection,
454493
454887
  clearEnvCache: () => clearEnvCache,
454494
454888
  capture: () => capture,
454889
+ buildTerminalPaletteSignature: () => buildTerminalPaletteSignature,
454495
454890
  buildKittyKeyboardFlags: () => buildKittyKeyboardFlags,
454496
454891
  brightYellow: () => brightYellow,
454497
454892
  brightWhite: () => brightWhite,
@@ -454525,6 +454920,7 @@ var init_index_r3mexem1 = __esm(async () => {
454525
454920
  applyChromaticAberration: () => applyChromaticAberration,
454526
454921
  applyBrightness: () => applyBrightness,
454527
454922
  applyAsciiArt: () => applyAsciiArt,
454923
+ ansi256IndexToRgb: () => ansi256IndexToRgb,
454528
454924
  addDefaultParsers: () => addDefaultParsers,
454529
454925
  Yoga: () => exports_src,
454530
454926
  VignetteEffect: () => VignetteEffect,
@@ -454612,6 +455008,8 @@ var init_index_r3mexem1 = __esm(async () => {
454612
455008
  DataPathsManager: () => DataPathsManager,
454613
455009
  DEUTERANOPIA_SIM_MATRIX: () => DEUTERANOPIA_SIM_MATRIX,
454614
455010
  DEUTERANOPIA_COMP_MATRIX: () => DEUTERANOPIA_COMP_MATRIX,
455011
+ DEFAULT_FOREGROUND_RGB: () => DEFAULT_FOREGROUND_RGB,
455012
+ DEFAULT_BACKGROUND_RGB: () => DEFAULT_BACKGROUND_RGB,
454615
455013
  ConsolePosition: () => ConsolePosition,
454616
455014
  CodeRenderable: () => CodeRenderable,
454617
455015
  Code: () => Code,
@@ -456950,7 +457348,7 @@ var init_index_r3mexem1 = __esm(async () => {
456950
457348
  this.rightSide?.clearHighlightLines(startLine, endLine);
456951
457349
  }
456952
457350
  };
456953
- defaultTextareaKeybindings = [
457351
+ defaultTextareaKeyBindings = [
456954
457352
  { name: "left", action: "move-left" },
456955
457353
  { name: "right", action: "move-right" },
456956
457354
  { name: "up", action: "move-up" },
@@ -457051,7 +457449,7 @@ var init_index_r3mexem1 = __esm(async () => {
457051
457449
  this._placeholderColor = parseColor2(options.placeholderColor ?? defaults.placeholderColor);
457052
457450
  this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
457053
457451
  this._keyBindings = options.keyBindings || [];
457054
- const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
457452
+ const mergedBindings = mergeKeyBindings(defaultTextareaKeyBindings, this._keyBindings);
457055
457453
  this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
457056
457454
  this._actionHandlers = this.buildActionHandlers();
457057
457455
  this._submitListener = options.onSubmit;
@@ -457119,11 +457517,13 @@ var init_index_r3mexem1 = __esm(async () => {
457119
457517
  this.insertText(stripAnsiSequences(decodePasteBytes(event.bytes)));
457120
457518
  }
457121
457519
  handleKeyPress(key3) {
457122
- const action = getKeyBindingAction(this._keyBindingsMap, key3);
457123
- if (action) {
457124
- const handler4 = this._actionHandlers.get(action);
457125
- if (handler4) {
457126
- return handler4();
457520
+ if (this.traits.suspend !== true) {
457521
+ const action = getKeyBindingAction(this._keyBindingsMap, key3);
457522
+ if (action) {
457523
+ const handler4 = this._actionHandlers.get(action);
457524
+ if (handler4) {
457525
+ return handler4();
457526
+ }
457127
457527
  }
457128
457528
  }
457129
457529
  if (!key3.ctrl && !key3.meta && !key3.super && !key3.hyper) {
@@ -457237,12 +457637,12 @@ var init_index_r3mexem1 = __esm(async () => {
457237
457637
  }
457238
457638
  set keyBindings(bindings) {
457239
457639
  this._keyBindings = bindings;
457240
- const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, bindings);
457640
+ const mergedBindings = mergeKeyBindings(defaultTextareaKeyBindings, bindings);
457241
457641
  this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
457242
457642
  }
457243
457643
  set keyAliasMap(aliases2) {
457244
457644
  this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases2);
457245
- const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
457645
+ const mergedBindings = mergeKeyBindings(defaultTextareaKeyBindings, this._keyBindings);
457246
457646
  this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
457247
457647
  }
457248
457648
  get extmarks() {
@@ -458194,7 +458594,15 @@ var init_index_r3mexem1 = __esm(async () => {
458194
458594
  for (let colIdx = 0;colIdx < this._columnCount; colIdx++) {
458195
458595
  const cellX = (colOffsets[colIdx] ?? 0) + 1;
458196
458596
  const colWidth = colWidths[colIdx] ?? 1;
458197
- buffer.fillRect(cellX, cellY, colWidth, rowHeight, this._backgroundColor);
458597
+ if (this._backgroundColor.a < 1) {
458598
+ for (let y4 = cellY;y4 < cellY + rowHeight; y4++) {
458599
+ for (let x3 = cellX;x3 < cellX + colWidth; x3++) {
458600
+ buffer.setCell(x3, y4, " ", this._defaultFg, this._backgroundColor, this._defaultAttributes);
458601
+ }
458602
+ }
458603
+ } else {
458604
+ buffer.fillRect(cellX, cellY, colWidth, rowHeight, this._backgroundColor);
458605
+ }
458198
458606
  }
458199
458607
  }
458200
458608
  }
@@ -458234,6 +458642,11 @@ var init_index_r3mexem1 = __esm(async () => {
458234
458642
  return { rowIdx, colIdx };
458235
458643
  }
458236
458644
  applySelectionToCells(localSelection, isStart) {
458645
+ if (localSelection.anchorX === localSelection.focusX && localSelection.anchorY === localSelection.focusY) {
458646
+ this.resetCellSelections();
458647
+ this._lastSelectionMode = null;
458648
+ return;
458649
+ }
458237
458650
  const minSelY = Math.min(localSelection.anchorY, localSelection.focusY);
458238
458651
  const maxSelY = Math.max(localSelection.anchorY, localSelection.focusY);
458239
458652
  const firstRow = this.findRowForLocalY(minSelY);
@@ -458264,6 +458677,10 @@ var init_index_r3mexem1 = __esm(async () => {
458264
458677
  focusY: localSelection.focusY - cellTop
458265
458678
  };
458266
458679
  const isAnchorCell = selection.anchorCell !== null && selection.anchorCell.rowIdx === rowIdx && selection.anchorCell.colIdx === colIdx;
458680
+ if (selection.mode === "single-cell" && !isAnchorCell) {
458681
+ cell.textBufferView.resetLocalSelection();
458682
+ continue;
458683
+ }
458267
458684
  const forceSet = isAnchorCell && selection.mode !== "single-cell";
458268
458685
  if (forceSet) {
458269
458686
  coords = this.getFullCellSelectionCoords(rowIdx, colIdx);
@@ -461566,6 +461983,7 @@ __export(exports_core3, {
461566
461983
  underline: () => underline,
461567
461984
  treeSitterToTextChunks: () => treeSitterToTextChunks,
461568
461985
  treeSitterToStyledText: () => treeSitterToStyledText,
461986
+ terminalNamedSingleStrokeKeys: () => terminalNamedSingleStrokeKeys,
461569
461987
  t: () => t,
461570
461988
  stripAnsiSequences: () => stripAnsiSequences,
461571
461989
  stringToStyledText: () => stringToStyledText,
@@ -461599,6 +462017,9 @@ __export(exports_core3, {
461599
462017
  parseBorderStyle: () => parseBorderStyle,
461600
462018
  parseAlignItems: () => parseAlignItems,
461601
462019
  parseAlign: () => parseAlign,
462020
+ normalizeTerminalPalette: () => normalizeTerminalPalette,
462021
+ normalizeIndexedColorIndex: () => normalizeIndexedColorIndex,
462022
+ normalizeColorValue: () => normalizeColorValue,
461602
462023
  nonAlphanumericKeys: () => nonAlphanumericKeys,
461603
462024
  measureText: () => measureText,
461604
462025
  maybeMakeRenderable: () => maybeMakeRenderable,
@@ -461637,6 +462058,7 @@ __export(exports_core3, {
461637
462058
  dim: () => dim,
461638
462059
  detectLinks: () => detectLinks,
461639
462060
  delegate: () => delegate,
462061
+ defaultTextareaKeyBindings: () => defaultTextareaKeyBindings,
461640
462062
  decodePasteBytes: () => decodePasteBytes,
461641
462063
  cyan: () => cyan,
461642
462064
  createTimeline: () => createTimeline,
@@ -461651,6 +462073,7 @@ __export(exports_core3, {
461651
462073
  convertGlobalToLocalSelection: () => convertGlobalToLocalSelection,
461652
462074
  clearEnvCache: () => clearEnvCache,
461653
462075
  capture: () => capture,
462076
+ buildTerminalPaletteSignature: () => buildTerminalPaletteSignature,
461654
462077
  buildKittyKeyboardFlags: () => buildKittyKeyboardFlags,
461655
462078
  brightYellow: () => brightYellow,
461656
462079
  brightWhite: () => brightWhite,
@@ -461684,6 +462107,7 @@ __export(exports_core3, {
461684
462107
  applyChromaticAberration: () => applyChromaticAberration,
461685
462108
  applyBrightness: () => applyBrightness,
461686
462109
  applyAsciiArt: () => applyAsciiArt,
462110
+ ansi256IndexToRgb: () => ansi256IndexToRgb,
461687
462111
  addDefaultParsers: () => addDefaultParsers,
461688
462112
  Yoga: () => exports_src,
461689
462113
  VignetteEffect: () => VignetteEffect,
@@ -461771,6 +462195,8 @@ __export(exports_core3, {
461771
462195
  DataPathsManager: () => DataPathsManager,
461772
462196
  DEUTERANOPIA_SIM_MATRIX: () => DEUTERANOPIA_SIM_MATRIX,
461773
462197
  DEUTERANOPIA_COMP_MATRIX: () => DEUTERANOPIA_COMP_MATRIX,
462198
+ DEFAULT_FOREGROUND_RGB: () => DEFAULT_FOREGROUND_RGB,
462199
+ DEFAULT_BACKGROUND_RGB: () => DEFAULT_BACKGROUND_RGB,
461774
462200
  ConsolePosition: () => ConsolePosition,
461775
462201
  CodeRenderable: () => CodeRenderable,
461776
462202
  Code: () => Code,
@@ -461794,8 +462220,8 @@ __export(exports_core3, {
461794
462220
  });
461795
462221
  var init_core4 = __esm(async () => {
461796
462222
  await __promiseAll([
461797
- init_index_r3mexem1(),
461798
- init_index_qpcsqve6()
462223
+ init_index_mch6dv67(),
462224
+ init_index_mw2x3082()
461799
462225
  ]);
461800
462226
  });
461801
462227
 
@@ -462168,8 +462594,8 @@ var require_scheduler_development = __commonJS((exports) => {
462168
462594
  localSetImmediate(performWorkUntilDeadline);
462169
462595
  };
462170
462596
  else if (typeof MessageChannel !== "undefined") {
462171
- var channel = new MessageChannel, port = channel.port2;
462172
- channel.port1.onmessage = performWorkUntilDeadline;
462597
+ var channel3 = new MessageChannel, port = channel3.port2;
462598
+ channel3.port1.onmessage = performWorkUntilDeadline;
462173
462599
  schedulePerformWorkUntilDeadline = function() {
462174
462600
  port.postMessage(null);
462175
462601
  };
@@ -471793,7 +472219,7 @@ var init_chunk_bdqvmfwv = __esm(async () => {
471793
472219
  react_devtools_core_default.connectToDevTools();
471794
472220
  });
471795
472221
 
471796
- // node_modules/@opentui/react/chunk-msc8jt9j.js
472222
+ // node_modules/@opentui/react/chunk-81sn2skb.js
471797
472223
  function extend2(objects) {
471798
472224
  Object.assign(componentCatalogue, objects);
471799
472225
  }
@@ -471857,6 +472283,8 @@ function setProperty(instance3, type, propKey, propValue, oldPropValue) {
471857
472283
  case "onSubmit":
471858
472284
  if (instance3 instanceof InputRenderable) {
471859
472285
  initEventListeners(instance3, InputRenderableEvents.ENTER, propValue, oldPropValue);
472286
+ } else if (instance3 instanceof TextareaRenderable) {
472287
+ instance3.onSubmit = propValue;
471860
472288
  }
471861
472289
  break;
471862
472290
  case "onSelect":
@@ -471937,7 +472365,7 @@ function createRoot(renderer) {
471937
472365
  var import_react2, import_react3, import_react4, import_jsx_dev_runtime, import_react_reconciler, import_constants33, import_react5, import_constants34, textNodeKeys, SpanRenderable, TextModifierRenderable, BoldSpanRenderable, ItalicSpanRenderable, UnderlineSpanRenderable, LineBreakRenderable, LinkRenderable, baseComponents, componentCatalogue, AppContext, useAppContext = () => {
471938
472366
  return import_react2.useContext(AppContext);
471939
472367
  }, ErrorBoundary, package_default2, idCounter, currentUpdatePriority, hostConfig, reconciler, _r, flushSync, createPortal;
471940
- var init_chunk_msc8jt9j = __esm(async () => {
472368
+ var init_chunk_81sn2skb = __esm(async () => {
471941
472369
  init_chunk_2mx7fq49();
471942
472370
  await __promiseAll([
471943
472371
  init_core4(),
@@ -472058,7 +472486,7 @@ var init_chunk_msc8jt9j = __esm(async () => {
472058
472486
  };
472059
472487
  package_default2 = {
472060
472488
  name: "@opentui/react",
472061
- version: "0.1.102",
472489
+ version: "0.2.0",
472062
472490
  description: "React renderer for building terminal user interfaces using OpenTUI core",
472063
472491
  license: "MIT",
472064
472492
  repository: {
@@ -472100,6 +472528,7 @@ var init_chunk_msc8jt9j = __esm(async () => {
472100
472528
  test: "bun test"
472101
472529
  },
472102
472530
  devDependencies: {
472531
+ "@opentui/keymap": "workspace:*",
472103
472532
  "@types/bun": "latest",
472104
472533
  "@types/node": "^24.0.0",
472105
472534
  "@types/react": "^19.0.0",
@@ -472574,7 +473003,7 @@ var import_react6, import_react7, import_react8, import_react9, import_react10,
472574
473003
  var init_react2 = __esm(async () => {
472575
473004
  init_chunk_2mx7fq49();
472576
473005
  await __promiseAll([
472577
- init_chunk_msc8jt9j(),
473006
+ init_chunk_81sn2skb(),
472578
473007
  init_core4(),
472579
473008
  init_core4(),
472580
473009
  init_core4()
@@ -478296,27 +478725,27 @@ var init_prerequisites = __esm(() => {
478296
478725
 
478297
478726
  // node_modules/ghostty-opentui/dist/darwin-arm64/ghostty-opentui.node
478298
478727
  var require_ghostty_opentui = __commonJS((exports, module3) => {
478299
- module3.exports = __require("./ghostty-opentui-jqndrqz0.node");
478728
+ module3.exports = __require("./ghostty-opentui-f2mew9sn.node");
478300
478729
  });
478301
478730
 
478302
478731
  // node_modules/ghostty-opentui/dist/darwin-x64/ghostty-opentui.node
478303
478732
  var require_ghostty_opentui2 = __commonJS((exports, module3) => {
478304
- module3.exports = __require("./ghostty-opentui-wvtvvtsy.node");
478733
+ module3.exports = __require("./ghostty-opentui-hpb2vcxc.node");
478305
478734
  });
478306
478735
 
478307
478736
  // node_modules/ghostty-opentui/dist/linux-arm64/ghostty-opentui.node
478308
478737
  var require_ghostty_opentui3 = __commonJS((exports, module3) => {
478309
- module3.exports = __require("./ghostty-opentui-wj67em0v.node");
478738
+ module3.exports = __require("./ghostty-opentui-97zf3rxa.node");
478310
478739
  });
478311
478740
 
478312
478741
  // node_modules/ghostty-opentui/dist/linux-x64/ghostty-opentui.node
478313
478742
  var require_ghostty_opentui4 = __commonJS((exports, module3) => {
478314
- module3.exports = __require("./ghostty-opentui-m3jfs005.node");
478743
+ module3.exports = __require("./ghostty-opentui-y599pszh.node");
478315
478744
  });
478316
478745
 
478317
478746
  // node_modules/ghostty-opentui/dist/win32-x64/ghostty-opentui.node
478318
478747
  var require_ghostty_opentui5 = __commonJS((exports, module3) => {
478319
- module3.exports = __require("./ghostty-opentui-rym4fe6k.node");
478748
+ module3.exports = __require("./ghostty-opentui-dgswj2kn.node");
478320
478749
  });
478321
478750
 
478322
478751
  // node_modules/ghostty-opentui/src/native-lib.cjs
@@ -490642,6 +491071,7 @@ var init_InputBox = __esm(async () => {
490642
491071
  }
490643
491072
  }, [fuzzyQuery, fuzzyMode, getHistoryDB]);
490644
491073
  const floatingTermOpen = useUIStore((s2) => s2.modals.floatingTerminal);
491074
+ const lockIn = useUIStore((s_0) => s_0.lockIn);
490645
491075
  const focused = floatingTermOpen ? false : isFocused ?? true;
490646
491076
  import_react36.useEffect(() => {
490647
491077
  if (focused)
@@ -491214,7 +491644,7 @@ var init_InputBox = __esm(async () => {
491214
491644
  onContentChange: handleContentChange,
491215
491645
  onCursorChange: handleCursorChange,
491216
491646
  keyBindings: INPUT_KEY_BINDINGS,
491217
- placeholder: viewingCheckpoint != null ? `${icon("rewind")} send a message to rewind to checkpoint #${String(viewingCheckpoint)}` : showBusy && !showAutocomplete ? "'/' for commands \xB7 or steer by sending a new message" : "speak to the forge...",
491647
+ placeholder: viewingCheckpoint != null ? `${icon("rewind")} send a message to rewind to checkpoint #${String(viewingCheckpoint)}` : showBusy && !showAutocomplete ? "'/' for commands \xB7 or steer by sending a new message" : lockIn ? "speak to the forge... \xB7 /lock-in to see full narration" : "speak to the forge...",
491218
491648
  placeholderColor: viewingCheckpoint != null ? t_0.warning : t_0.textMuted,
491219
491649
  focused,
491220
491650
  wrapMode: "char",
@@ -491605,7 +492035,7 @@ var init_LockInStreamView = __esm(async () => {
491605
492035
  await init_core4();
491606
492036
  import_compiler_runtime13 = __toESM(require_compiler_runtime(), 1);
491607
492037
  import_react38 = __toESM(require_react(), 1);
491608
- LOCKIN_EDIT_TOOLS = new Set(["edit_file", "multi_edit", "write_file", "create_file", "rename_file", "move_symbol", "rename_symbol"]);
492038
+ LOCKIN_EDIT_TOOLS = new Set(["edit_file", "multi_edit", "ast_edit", "write_file", "create_file", "rename_file", "move_symbol", "rename_symbol"]);
491609
492039
  QUIET_TOOLS = new Set(["update_plan_step", "ask_user", "task_list"]);
491610
492040
  SPIN_EXPLORE = ["\u25F4", "\u25F7", "\u25F6", "\u25F5"];
491611
492041
  SPIN_EDIT = ["\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589", "\u2588", "\u2589", "\u258A", "\u258B", "\u258C", "\u258D", "\u258E", "\u258F"];
@@ -491763,9 +492193,9 @@ var init_LockInStreamView = __esm(async () => {
491763
492193
  t12,
491764
492194
  visible.length > 0 || children ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
491765
492195
  flexDirection: "column",
491766
- border: visible.length + hiddenCount >= 2 || children ? ["left"] : undefined,
492196
+ border: ["left"],
491767
492197
  borderColor: effectiveDone ? t2.textFaint : t2.textMuted,
491768
- paddingLeft: visible.length + hiddenCount >= 2 || children ? 1 : 2,
492198
+ paddingLeft: 1,
491769
492199
  opacity: effectiveDone ? 0.6 : 1,
491770
492200
  children: [
491771
492201
  hiddenCount > 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
@@ -491794,7 +492224,7 @@ var init_LockInStreamView = __esm(async () => {
491794
492224
  const doneLabel = TOOL_LABELS_DONE[tc_0.name] ?? label;
491795
492225
  const displayLabel = tc_0.done ? doneLabel : label;
491796
492226
  const isLast = i4 === visible.length - 1 && !children;
491797
- const connector = visible.length < 2 && !children ? " " : isLast ? "\u2514 " : i4 === 0 && hiddenCount === 0 ? "\u250C " : "\u251C ";
492227
+ const connector = isLast ? "\u2514 " : i4 === 0 && hiddenCount === 0 ? "\u250C " : "\u251C ";
491798
492228
  const statusClr = tc_0.done ? tc_0.error ? t2.error : t2.success : t2.brand;
491799
492229
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
491800
492230
  height: 1,