@proxysoul/soulforge 2.14.0 → 2.14.2

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
@@ -39317,7 +39317,9 @@ function buildHearthCallbacks(ctx) {
39317
39317
 
39318
39318
  // src/core/agents/agent-bus.ts
39319
39319
  function normalizePath(p) {
39320
- let n = p;
39320
+ if (typeof p !== "string" || p.length === 0)
39321
+ return "";
39322
+ let n = p.replace(/\\/g, "/");
39321
39323
  while (n.startsWith("./"))
39322
39324
  n = n.slice(2);
39323
39325
  return n.replace(/\/+/g, "/");
@@ -51209,7 +51211,7 @@ function resetUIStore() {
51209
51211
  showReasoning: true,
51210
51212
  reasoningExpanded: {},
51211
51213
  suspended: false,
51212
- lockIn: false
51214
+ lockIn: true
51213
51215
  });
51214
51216
  }
51215
51217
  var INITIAL_MODALS, useUIStore, selectIsAnyModalOpen = (s) => Object.values(s.modals).some(Boolean);
@@ -51264,7 +51266,7 @@ var init_ui = __esm(() => {
51264
51266
  reasoningExpanded: {},
51265
51267
  suspended: false,
51266
51268
  editorSplit: 60,
51267
- lockIn: false,
51269
+ lockIn: true,
51268
51270
  openModal: (name21) => set2(() => ({
51269
51271
  modals: {
51270
51272
  ...INITIAL_MODALS,
@@ -57906,7 +57908,7 @@ var package_default;
57906
57908
  var init_package = __esm(() => {
57907
57909
  package_default = {
57908
57910
  name: "@proxysoul/soulforge",
57909
- version: "2.14.0",
57911
+ version: "2.14.2",
57910
57912
  description: "Graph-powered code intelligence \u2014 multi-agent coding with codebase-aware AI",
57911
57913
  repository: {
57912
57914
  type: "git",
@@ -57958,9 +57960,9 @@ var init_package = __esm(() => {
57958
57960
  },
57959
57961
  devDependencies: {
57960
57962
  "@babel/core": "7.29.0",
57961
- "@biomejs/biome": "2.4.12",
57963
+ "@biomejs/biome": "2.4.13",
57962
57964
  "@types/babel__core": "7.20.5",
57963
- "@types/bun": "1.3.12",
57965
+ "@types/bun": "1.3.13",
57964
57966
  "@types/linkify-it": "5.0.0",
57965
57967
  "@types/node": "25.6.0",
57966
57968
  "@types/react": "19.2.14",
@@ -57980,14 +57982,14 @@ var init_package = __esm(() => {
57980
57982
  "@ai-sdk/openai": "3.0.53",
57981
57983
  "@ai-sdk/openai-compatible": "^2.0.41",
57982
57984
  "@ai-sdk/xai": "3.0.83",
57983
- "@anthropic-ai/sdk": "0.90.0",
57984
- "@llmgateway/ai-sdk-provider": "3.6.0",
57985
+ "@anthropic-ai/sdk": "0.91.1",
57986
+ "@llmgateway/ai-sdk-provider": "3.7.0",
57985
57987
  "@modelcontextprotocol/sdk": "^1.29.0",
57986
57988
  "@mozilla/readability": "0.6.0",
57987
- "@openrouter/ai-sdk-provider": "2.8.0",
57988
- "@opentui/react": "0.1.102",
57989
+ "@openrouter/ai-sdk-provider": "2.8.1",
57990
+ "@opentui/react": "0.2.0",
57989
57991
  ai: "6.0.168",
57990
- "ghostty-opentui": "1.4.10",
57992
+ "ghostty-opentui": "1.4.11",
57991
57993
  isbinaryfile: "6.0.0",
57992
57994
  jsonrepair: "^3.14.0",
57993
57995
  linkedom: "0.18.12",
@@ -58435,26 +58437,36 @@ async function exchangeToken(githubToken) {
58435
58437
  if (cachedBearer && Date.now() / 1000 < cachedBearer.expiresAt - 60) {
58436
58438
  return cachedBearer.token;
58437
58439
  }
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;
58440
+ if (bearerInflight)
58441
+ return bearerInflight;
58442
+ bearerInflight = (async () => {
58443
+ try {
58444
+ const res = await fetch(TOKEN_EXCHANGE, {
58445
+ headers: {
58446
+ Authorization: `Token ${githubToken}`,
58447
+ "User-Agent": `SoulForge/${CURRENT_VERSION}`
58448
+ },
58449
+ signal: AbortSignal.timeout(1e4)
58450
+ });
58451
+ if (!res.ok) {
58452
+ cachedBearer = null;
58453
+ const body2 = await res.text().catch(() => "");
58454
+ 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." : "";
58455
+ throw new Error(`Copilot token exchange failed (${String(res.status)})${body2 ? `: ${body2.slice(0, 200)}` : ""}${hint}`);
58456
+ }
58457
+ const data = await res.json();
58458
+ if (!data.token)
58459
+ throw new Error("Copilot token exchange returned empty token");
58460
+ cachedBearer = {
58461
+ token: data.token,
58462
+ expiresAt: data.expires_at
58463
+ };
58464
+ return data.token;
58465
+ } finally {
58466
+ bearerInflight = null;
58467
+ }
58468
+ })();
58469
+ return bearerInflight;
58458
58470
  }
58459
58471
  function invalidateBearer() {
58460
58472
  cachedBearer = null;
@@ -58465,16 +58477,19 @@ function getGitHubToken() {
58465
58477
  return stored;
58466
58478
  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
58479
  }
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");
58480
+ function detectInitiator(body2) {
58481
+ if (typeof body2 !== "string")
58482
+ return "user";
58483
+ try {
58484
+ const parsed = JSON.parse(body2);
58485
+ if (Array.isArray(parsed.messages)) {
58486
+ for (const m of parsed.messages) {
58487
+ if (m?.role === "assistant" || m?.role === "tool")
58488
+ return "agent";
58489
+ }
58490
+ }
58491
+ } catch {}
58492
+ return "user";
58478
58493
  }
58479
58494
  function createCopilotFetch(githubToken) {
58480
58495
  return async (url2, init2) => {
@@ -58485,38 +58500,41 @@ function createCopilotFetch(githubToken) {
58485
58500
  invalidateBearer();
58486
58501
  bearer = await exchangeToken(githubToken);
58487
58502
  }
58488
- const headers = new Headers(init2?.headers);
58489
- headers.set("Authorization", `Bearer ${bearer}`);
58503
+ const buildHeaders = (token) => {
58504
+ const h = new Headers(init2?.headers);
58505
+ h.set("Authorization", `Bearer ${token}`);
58506
+ h.set("X-Request-Id", crypto.randomUUID());
58507
+ h.set("X-Initiator", detectInitiator(init2?.body));
58508
+ return h;
58509
+ };
58490
58510
  const res = await fetch(url2, {
58491
58511
  ...init2,
58492
- headers
58512
+ headers: buildHeaders(bearer)
58493
58513
  });
58494
58514
  if (res.status === 401) {
58495
58515
  invalidateBearer();
58496
58516
  const retryBearer = await exchangeToken(githubToken);
58497
- const retryHeaders = new Headers(init2?.headers);
58498
- retryHeaders.set("Authorization", `Bearer ${retryBearer}`);
58499
58517
  return fetch(url2, {
58500
58518
  ...init2,
58501
- headers: retryHeaders
58519
+ headers: buildHeaders(retryBearer)
58502
58520
  });
58503
58521
  }
58504
58522
  return res;
58505
58523
  };
58506
58524
  }
58525
+ function assertChatCompletionsSupported(modelId) {
58526
+ const endpoints = supportedEndpoints.get(modelId);
58527
+ if (!endpoints || endpoints.length === 0)
58528
+ return;
58529
+ const hasChat = endpoints.some((e) => e.includes("chat") || e.includes("completions"));
58530
+ if (hasChat)
58531
+ return;
58532
+ 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.");
58533
+ }
58507
58534
  function createCopilotModel(modelId) {
58535
+ assertChatCompletionsSupported(modelId);
58508
58536
  const githubToken = getGitHubToken();
58509
58537
  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
58538
  const client = createOpenAI({
58521
58539
  baseURL: COPILOT_API,
58522
58540
  apiKey: "copilot",
@@ -58525,22 +58543,23 @@ function createCopilotModel(modelId) {
58525
58543
  },
58526
58544
  fetch: copilotFetch
58527
58545
  });
58528
- if (needsResponsesApi(modelId)) {
58529
- return client.responses(modelId);
58530
- }
58531
58546
  return client.chat(modelId);
58532
58547
  }
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;
58548
+ 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
58549
  var init_copilot = __esm(() => {
58535
- init_dist6();
58536
58550
  init_dist8();
58537
58551
  init_secrets();
58538
58552
  init_version();
58539
58553
  COPILOT_HEADERS = {
58540
- "Editor-Version": `SoulForge/${CURRENT_VERSION}`,
58541
- "Editor-Plugin-Version": `SoulForge/${CURRENT_VERSION}`,
58542
- "Copilot-Integration-Id": "vscode-chat"
58543
- };
58554
+ "Editor-Version": "vscode/1.95.0",
58555
+ "Editor-Plugin-Version": `copilot-chat/${COPILOT_CHAT_VERSION}`,
58556
+ "Copilot-Integration-Id": "vscode-chat",
58557
+ "User-Agent": `GitHubCopilotChat/${COPILOT_CHAT_VERSION}`,
58558
+ "OpenAI-Intent": "conversation-panel",
58559
+ "X-GitHub-Api-Version": COPILOT_API_VERSION,
58560
+ "X-VSCode-User-Agent-Library-Version": "electron-fetch"
58561
+ };
58562
+ supportedEndpoints = new Map;
58544
58563
  copilot = {
58545
58564
  id: "copilot",
58546
58565
  name: "GitHub Copilot",
@@ -58575,6 +58594,9 @@ var init_copilot = __esm(() => {
58575
58594
  continue;
58576
58595
  if (result.some((r) => r.id === m.id))
58577
58596
  continue;
58597
+ if (Array.isArray(m.supported_endpoints)) {
58598
+ supportedEndpoints.set(m.id, m.supported_endpoints);
58599
+ }
58578
58600
  result.push({
58579
58601
  id: m.id,
58580
58602
  name: m.id
@@ -66769,7 +66791,8 @@ function createLLMGateway(options = {}) {
66769
66791
  provider: "llmgateway.image",
66770
66792
  url: ({ path }) => `${baseURL}${path}`,
66771
66793
  headers: getHeaders,
66772
- fetch: options.fetch
66794
+ fetch: options.fetch,
66795
+ extraBody: options.extraBody
66773
66796
  });
66774
66797
  const createLanguageModel = (modelId, settings) => {
66775
66798
  if (new.target) {
@@ -68023,13 +68046,19 @@ var __defProp3, __defProps, __getOwnPropDescs, __getOwnPropSymbols, __hasOwnProp
68023
68046
  if (options.aspectRatio != null) {
68024
68047
  body2.aspect_ratio = options.aspectRatio;
68025
68048
  }
68049
+ if (options.quality != null) {
68050
+ body2.quality = options.quality;
68051
+ }
68052
+ const providerOptions = options.providerOptions || {};
68053
+ const llmgatewayOptions = providerOptions.llmgateway || {};
68054
+ const requestBody = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, body2), this.config.extraBody), this.settings.extraBody), llmgatewayOptions);
68026
68055
  const { value: response, responseHeaders } = await postJsonToApi2({
68027
68056
  url: this.config.url({
68028
68057
  path: hasFiles ? "/images/edits" : "/images/generations",
68029
68058
  modelId: this.modelId
68030
68059
  }),
68031
68060
  headers: combineHeaders2(this.config.headers(), options.headers),
68032
- body: body2,
68061
+ body: requestBody,
68033
68062
  failedResponseHandler: llmgatewayFailedResponseHandler,
68034
68063
  successfulResponseHandler: createJsonResponseHandler2(LLMGatewayImageResponseSchema),
68035
68064
  abortSignal: options.abortSignal,
@@ -79984,9 +80013,9 @@ function convertToOpenRouterChatMessages(prompt) {
79984
80013
  const parsedProviderOptions = OpenRouterProviderOptionsSchema.safeParse(providerOptions);
79985
80014
  const messageReasoningDetails = parsedProviderOptions.success ? (_e = (_d = parsedProviderOptions.data) == null ? undefined : _d.openrouter) == null ? undefined : _e.reasoning_details : undefined;
79986
80015
  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);
80016
+ const candidateReasoningDetails = messageReasoningDetails && Array.isArray(messageReasoningDetails) ? messageReasoningDetails : findFirstReasoningDetails(content);
79988
80017
  let finalReasoningDetails;
79989
- if (candidateReasoningDetails && candidateReasoningDetails.length > 0) {
80018
+ if (candidateReasoningDetails) {
79990
80019
  const validDetails = candidateReasoningDetails.filter((detail) => {
79991
80020
  var _a173;
79992
80021
  if (detail.type !== "reasoning.text") {
@@ -80010,9 +80039,9 @@ function convertToOpenRouterChatMessages(prompt) {
80010
80039
  uniqueDetails.push(detail);
80011
80040
  }
80012
80041
  }
80013
- finalReasoningDetails = uniqueDetails.length > 0 ? uniqueDetails : undefined;
80042
+ finalReasoningDetails = uniqueDetails;
80014
80043
  }
80015
- const effectiveReasoning = reasoning && finalReasoningDetails ? reasoning : undefined;
80044
+ const effectiveReasoning = reasoning && finalReasoningDetails && finalReasoningDetails.length > 0 ? reasoning : undefined;
80016
80045
  messages.push({
80017
80046
  role: "assistant",
80018
80047
  content: text2,
@@ -81455,11 +81484,11 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
81455
81484
  controller.enqueue({
81456
81485
  type: "reasoning-end",
81457
81486
  id: reasoningId || generateId5(),
81458
- providerMetadata: accumulatedReasoningDetails.length > 0 ? {
81487
+ providerMetadata: {
81459
81488
  openrouter: {
81460
81489
  reasoning_details: accumulatedReasoningDetails
81461
81490
  }
81462
- } : undefined
81491
+ }
81463
81492
  });
81464
81493
  reasoningStarted = false;
81465
81494
  }
@@ -81690,11 +81719,11 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
81690
81719
  controller.enqueue({
81691
81720
  type: "reasoning-end",
81692
81721
  id: reasoningId || generateId5(),
81693
- providerMetadata: accumulatedReasoningDetails.length > 0 ? {
81722
+ providerMetadata: {
81694
81723
  openrouter: {
81695
81724
  reasoning_details: accumulatedReasoningDetails
81696
81725
  }
81697
- } : undefined
81726
+ }
81698
81727
  });
81699
81728
  }
81700
81729
  if (textStarted) {
@@ -81709,9 +81738,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
81709
81738
  if (provider !== undefined) {
81710
81739
  openrouterMetadata.provider = provider;
81711
81740
  }
81712
- if (accumulatedReasoningDetails.length > 0) {
81713
- openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
81714
- }
81741
+ openrouterMetadata.reasoning_details = accumulatedReasoningDetails;
81715
81742
  if (accumulatedFileAnnotations.length > 0) {
81716
81743
  openrouterMetadata.annotations = accumulatedFileAnnotations;
81717
81744
  }
@@ -82163,7 +82190,7 @@ var __defProp4, __defProps2, __getOwnPropDescs2, __getOwnPropSymbols2, __hasOwnP
82163
82190
  usage
82164
82191
  };
82165
82192
  }
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 {
82193
+ }, 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
82194
  constructor(modelId, settings, config2) {
82168
82195
  this.specificationVersion = "v3";
82169
82196
  this.provider = "openrouter";
@@ -84426,7 +84453,7 @@ var init_lifecycle = __esm(() => {
84426
84453
  });
84427
84454
 
84428
84455
  // src/core/llm/providers/proxy.ts
84429
- function isAnthropicModel2(modelId) {
84456
+ function isAnthropicModel(modelId) {
84430
84457
  return modelId.toLowerCase().startsWith("claude");
84431
84458
  }
84432
84459
  var baseURL, proxy2;
@@ -84446,7 +84473,7 @@ var init_proxy = __esm(() => {
84446
84473
  grouped: true,
84447
84474
  createModel(modelId) {
84448
84475
  const apiKey = getActiveProxyApiKey();
84449
- if (isAnthropicModel2(modelId)) {
84476
+ if (isAnthropicModel(modelId)) {
84450
84477
  return createAnthropic({
84451
84478
  baseURL,
84452
84479
  apiKey
@@ -355487,7 +355514,7 @@ var init_constants = __esm(() => {
355487
355514
  memory: "Read/write persistent memories across sessions",
355488
355515
  editor: "Open file in embedded Neovim editor",
355489
355516
  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"
355517
+ ast_edit: "Surgical AST editing for TS/JS \u2014 prefer over edit_file/multi_edit"
355491
355518
  };
355492
355519
  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
355520
  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 +424585,18 @@ function buildInstructionPrompt(instructions) {
424558
424585
  const globalInstructions = instructions.filter((inst) => inst.scope === "global");
424559
424586
  const parts2 = [];
424560
424587
  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.");
424588
+ parts2.push("Global instruction files apply across all projects, but project-local instruction files take priority when they conflict.");
424589
+ }
424590
+ if (globalInstructions.length > 0) {
424591
+ const globalParts = [];
424592
+ for (const inst of globalInstructions) {
424593
+ globalParts.push(`[global:${inst.file}]
424594
+ ${inst.content}`);
424595
+ }
424596
+ parts2.push(`Global instruction files:
424597
+ ${globalParts.join(`
424598
+
424599
+ `)}`);
424562
424600
  }
424563
424601
  if (projectInstructions.length > 0) {
424564
424602
  const projectParts = [];
@@ -424573,17 +424611,6 @@ ${projectParts.join(`
424573
424611
  `)}` : projectParts.join(`
424574
424612
 
424575
424613
  `));
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
424614
  }
424588
424615
  return `Project instructions:
424589
424616
  ${parts2.join(`
@@ -427994,7 +428021,7 @@ var init_highlights5 = () => {};
427994
428021
  var tree_sitter_zig_default = "./tree-sitter-zig-e78zbjpm.wasm";
427995
428022
  var init_tree_sitter_zig = () => {};
427996
428023
 
427997
- // node_modules/@opentui/core/index-qpcsqve6.js
428024
+ // node_modules/@opentui/core/index-mw2x3082.js
427998
428025
  import { EventEmitter } from "events";
427999
428026
  import { Buffer as Buffer22 } from "buffer";
428000
428027
  import { Buffer as Buffer32 } from "buffer";
@@ -428257,50 +428284,128 @@ class PasteEvent {
428257
428284
  this._propagationStopped = true;
428258
428285
  }
428259
428286
  }
428287
+ function packMeta(intent, slot = 0) {
428288
+ return (slot & 255 | (intent & 255) << 8) >>> 0;
428289
+ }
428290
+ function toU8(value) {
428291
+ return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
428292
+ }
428293
+ function toByte(value) {
428294
+ return Math.round(Math.max(0, Math.min(255, Number.isFinite(value) ? value : 0)));
428295
+ }
428296
+ function packRGBA8(r4, g2, b4, a2, meta3) {
428297
+ return new Uint16Array([
428298
+ toByte(r4) & 255 | (meta3 >>> 0 & 255) << 8,
428299
+ toByte(g2) & 255 | (meta3 >>> 8 & 255) << 8,
428300
+ toByte(b4) & 255 | (meta3 >>> 16 & 255) << 8,
428301
+ toByte(a2) & 255 | (meta3 >>> 24 & 255) << 8
428302
+ ]);
428303
+ }
428304
+ function rgbaForAnsi256Index(index) {
428305
+ const [r4, g2, b4] = ansi256IndexToRgb(index);
428306
+ return RGBA.fromInts(r4, g2, b4);
428307
+ }
428308
+ function normalizeIndexedColorIndex(index) {
428309
+ if (!Number.isInteger(index) || index < 0 || index > 255) {
428310
+ throw new RangeError(`Indexed color must be an integer in the range 0..255, got ${index}`);
428311
+ }
428312
+ return index;
428313
+ }
428314
+ function ansi256IndexToRgb(index) {
428315
+ const normalizedIndex = normalizeIndexedColorIndex(index);
428316
+ if (normalizedIndex < ANSI16_RGB.length) {
428317
+ return ANSI16_RGB[normalizedIndex];
428318
+ }
428319
+ if (normalizedIndex < 232) {
428320
+ const cubeIndex = normalizedIndex - 16;
428321
+ const r4 = Math.floor(cubeIndex / 36);
428322
+ const g2 = Math.floor(cubeIndex / 6) % 6;
428323
+ const b4 = cubeIndex % 6;
428324
+ return [ANSI_256_CUBE_LEVELS[r4], ANSI_256_CUBE_LEVELS[g2], ANSI_256_CUBE_LEVELS[b4]];
428325
+ }
428326
+ const value = 8 + (normalizedIndex - 232) * 10;
428327
+ return [value, value, value];
428328
+ }
428260
428329
 
428261
428330
  class RGBA {
428262
428331
  buffer;
428263
428332
  constructor(buffer) {
428264
- this.buffer = buffer;
428333
+ this.buffer = new Uint16Array(4);
428334
+ this.buffer.set(buffer.subarray(0, 4));
428265
428335
  }
428266
428336
  static fromArray(array3) {
428267
428337
  return new RGBA(array3);
428268
428338
  }
428269
428339
  static fromValues(r4, g2, b4, a2 = 1) {
428270
- return new RGBA(new Float32Array([r4, g2, b4, a2]));
428340
+ return new RGBA(packRGBA8(toU8(r4), toU8(g2), toU8(b4), toU8(a2), packMeta(INTENT_RGB)));
428341
+ }
428342
+ static clone(rgba) {
428343
+ return new RGBA(rgba.buffer);
428271
428344
  }
428272
428345
  static fromInts(r4, g2, b4, a2 = 255) {
428273
- return new RGBA(new Float32Array([r4 / 255, g2 / 255, b4 / 255, a2 / 255]));
428346
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_RGB)));
428274
428347
  }
428275
428348
  static fromHex(hex3) {
428276
428349
  return hexToRgb(hex3);
428277
428350
  }
428351
+ static fromIndex(index, snapshot) {
428352
+ const normalized = normalizeIndexedColorIndex(index);
428353
+ const rgba = snapshot ? parseColor2(snapshot) : rgbaForAnsi256Index(normalized);
428354
+ const [r4, g2, b4, a2] = rgba.toInts();
428355
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_INDEXED, normalized)));
428356
+ }
428357
+ static defaultForeground(snapshot) {
428358
+ const rgba = snapshot ? parseColor2(snapshot) : RGBA.fromInts(...DEFAULT_FOREGROUND_RGB);
428359
+ const [r4, g2, b4, a2] = rgba.toInts();
428360
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_DEFAULT)));
428361
+ }
428362
+ static defaultBackground(snapshot) {
428363
+ const rgba = snapshot ? parseColor2(snapshot) : RGBA.fromInts(...DEFAULT_BACKGROUND_RGB);
428364
+ const [r4, g2, b4, a2] = rgba.toInts();
428365
+ return new RGBA(packRGBA8(r4, g2, b4, a2, packMeta(INTENT_DEFAULT)));
428366
+ }
428278
428367
  toInts() {
428279
- return [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255), Math.round(this.a * 255)];
428368
+ return [this.buffer[0] & 255, this.buffer[1] & 255, this.buffer[2] & 255, this.buffer[3] & 255];
428280
428369
  }
428281
428370
  get r() {
428282
- return this.buffer[0];
428371
+ return (this.buffer[0] & 255) / 255;
428283
428372
  }
428284
428373
  set r(value) {
428285
- this.buffer[0] = value;
428374
+ this.buffer[0] = this.buffer[0] & 65280 | toU8(value);
428286
428375
  }
428287
428376
  get g() {
428288
- return this.buffer[1];
428377
+ return (this.buffer[1] & 255) / 255;
428289
428378
  }
428290
428379
  set g(value) {
428291
- this.buffer[1] = value;
428380
+ this.buffer[1] = this.buffer[1] & 65280 | toU8(value);
428292
428381
  }
428293
428382
  get b() {
428294
- return this.buffer[2];
428383
+ return (this.buffer[2] & 255) / 255;
428295
428384
  }
428296
428385
  set b(value) {
428297
- this.buffer[2] = value;
428386
+ this.buffer[2] = this.buffer[2] & 65280 | toU8(value);
428298
428387
  }
428299
428388
  get a() {
428300
- return this.buffer[3];
428389
+ return (this.buffer[3] & 255) / 255;
428301
428390
  }
428302
428391
  set a(value) {
428303
- this.buffer[3] = value;
428392
+ this.buffer[3] = this.buffer[3] & 65280 | toU8(value);
428393
+ }
428394
+ get meta() {
428395
+ return (this.buffer[0] >>> 8 | this.buffer[1] >>> 8 << 8 | this.buffer[2] >>> 8 << 16 | this.buffer[3] >>> 8 << 24) >>> 0;
428396
+ }
428397
+ get intent() {
428398
+ switch (this.meta >>> 8 & 255) {
428399
+ case INTENT_INDEXED:
428400
+ return "indexed";
428401
+ case INTENT_DEFAULT:
428402
+ return "default";
428403
+ default:
428404
+ return "rgb";
428405
+ }
428406
+ }
428407
+ get slot() {
428408
+ return this.meta & 255;
428304
428409
  }
428305
428410
  map(fn) {
428306
428411
  return [fn(this.r), fn(this.g), fn(this.b), fn(this.a)];
@@ -428311,9 +428416,14 @@ class RGBA {
428311
428416
  equals(other) {
428312
428417
  if (!other)
428313
428418
  return false;
428314
- return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
428419
+ 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
428420
  }
428316
428421
  }
428422
+ function normalizeColorValue(value) {
428423
+ if (value == null)
428424
+ return null;
428425
+ return { rgba: parseColor2(value) };
428426
+ }
428317
428427
  function hexToRgb(hex3) {
428318
428428
  hex3 = hex3.replace(/^#/, "");
428319
428429
  if (hex3.length === 3) {
@@ -428325,18 +428435,16 @@ function hexToRgb(hex3) {
428325
428435
  console.warn(`Invalid hex color: ${hex3}, defaulting to magenta`);
428326
428436
  return RGBA.fromValues(1, 0, 1, 1);
428327
428437
  }
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);
428438
+ const r4 = parseInt(hex3.substring(0, 2), 16);
428439
+ const g2 = parseInt(hex3.substring(2, 4), 16);
428440
+ const b4 = parseInt(hex3.substring(4, 6), 16);
428441
+ const a2 = hex3.length === 8 ? parseInt(hex3.substring(6, 8), 16) : 255;
428442
+ return RGBA.fromInts(r4, g2, b4, a2);
428333
428443
  }
428334
428444
  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("");
428445
+ const [r4, g2, b4, a2] = rgb.toInts();
428446
+ const components = a2 === 255 ? [r4, g2, b4] : [r4, g2, b4, a2];
428447
+ return "#" + components.map((x3) => x3.toString(16).padStart(2, "0")).join("");
428340
428448
  }
428341
428449
  function hsvToRgb(h2, s2, v3) {
428342
428450
  let r4 = 0, g2 = 0, b4 = 0;
@@ -432704,6 +432812,35 @@ class TerminalPalette {
432704
432812
  function createTerminalPalette(stdin, stdout, writeFn, isLegacyTmux, oscSource, clock) {
432705
432813
  return new TerminalPalette(stdin, stdout, writeFn, isLegacyTmux, oscSource, clock);
432706
432814
  }
432815
+ function getFallbackAnsi256Palette() {
432816
+ if (!fallbackAnsi256Palette) {
432817
+ fallbackAnsi256Palette = Array.from({ length: 256 }, (_4, index) => {
432818
+ const [r4, g2, b4] = ansi256IndexToRgb(index);
432819
+ return RGBA.fromInts(r4, g2, b4);
432820
+ });
432821
+ }
432822
+ return fallbackAnsi256Palette;
432823
+ }
432824
+ function normalizeTerminalPalette(colors2) {
432825
+ const fallbackPalette = getFallbackAnsi256Palette();
432826
+ return {
432827
+ palette: Array.from({ length: 256 }, (_4, index) => {
432828
+ const detected = colors2?.palette[index];
432829
+ return detected ? RGBA.fromHex(detected) : RGBA.clone(fallbackPalette[index]);
432830
+ }),
432831
+ defaultForeground: colors2?.defaultForeground ? RGBA.fromHex(colors2.defaultForeground) : RGBA.clone(DEFAULT_FOREGROUND_FALLBACK),
432832
+ defaultBackground: colors2?.defaultBackground ? RGBA.fromHex(colors2.defaultBackground) : RGBA.clone(DEFAULT_BACKGROUND_FALLBACK)
432833
+ };
432834
+ }
432835
+ function buildTerminalPaletteSignature(colors2) {
432836
+ const normalized = normalizeTerminalPalette(colors2);
432837
+ const paletteSignature = normalized.palette.map((color) => color.toInts().join(",")).join(";");
432838
+ return [
432839
+ paletteSignature,
432840
+ normalized.defaultForeground.toInts().join(","),
432841
+ normalized.defaultBackground.toInts().join(",")
432842
+ ].join("|");
432843
+ }
432707
432844
  function decodePasteBytes(bytes) {
432708
432845
  return PASTE_TEXT_DECODER.decode(bytes);
432709
432846
  }
@@ -432796,21 +432933,25 @@ class OptimizedBuffer {
432796
432933
  if (this._destroyed)
432797
432934
  throw new Error(`Buffer ${this.id} is destroyed`);
432798
432935
  }
432936
+ ensureRawBufferViews() {
432937
+ if (this._rawBuffers !== null) {
432938
+ return;
432939
+ }
432940
+ const size = this._width * this._height;
432941
+ const charPtr = this.lib.bufferGetCharPtr(this.bufferPtr);
432942
+ const fgPtr = this.lib.bufferGetFgPtr(this.bufferPtr);
432943
+ const bgPtr = this.lib.bufferGetBgPtr(this.bufferPtr);
432944
+ const attributesPtr = this.lib.bufferGetAttributesPtr(this.bufferPtr);
432945
+ this._rawBuffers = {
432946
+ char: new Uint32Array(toArrayBuffer(charPtr, 0, size * 4)),
432947
+ fg: new Uint16Array(toArrayBuffer(fgPtr, 0, size * 4 * 2)),
432948
+ bg: new Uint16Array(toArrayBuffer(bgPtr, 0, size * 4 * 2)),
432949
+ attributes: new Uint32Array(toArrayBuffer(attributesPtr, 0, size * 4))
432950
+ };
432951
+ }
432799
432952
  get buffers() {
432800
432953
  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
- }
432954
+ this.ensureRawBufferViews();
432814
432955
  return this._rawBuffers;
432815
432956
  }
432816
432957
  constructor(lib2, ptr22, width, height, options) {
@@ -432871,8 +433012,8 @@ class OptimizedBuffer {
432871
433012
  for (let x3 = 0;x3 < this._width; x3++) {
432872
433013
  const i4 = y4 * this._width + x3;
432873
433014
  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]);
433015
+ const cellFg = RGBA.fromArray(fg2.slice(i4 * 4, i4 * 4 + 4));
433016
+ const cellBg = RGBA.fromArray(bg2.slice(i4 * 4, i4 * 4 + 4));
432876
433017
  const cellAttrs = attributes2[i4] & 255;
432877
433018
  const isContinuation = (cp2 & CHAR_FLAG_MASK) === CHAR_FLAG_CONTINUATION;
432878
433019
  const cellChar = isContinuation ? "" : lineChars[charIdx++] ?? " ";
@@ -433644,6 +433785,12 @@ function toPointer(value) {
433644
433785
  function toNumber(value) {
433645
433786
  return typeof value === "bigint" ? Number(value) : value;
433646
433787
  }
433788
+ function rgbaPtr(value) {
433789
+ return ptr4(value.buffer);
433790
+ }
433791
+ function optionalRgbaPtr(value) {
433792
+ return value ? rgbaPtr(value) : null;
433793
+ }
433647
433794
  function getOpenTUILib(libPath) {
433648
433795
  const resolvedLibPath = libPath || targetLibPath;
433649
433796
  const rawSymbols = dlopen(resolvedLibPath, {
@@ -433727,10 +433874,18 @@ function getOpenTUILib(libPath) {
433727
433874
  args: ["ptr"],
433728
433875
  returns: "ptr"
433729
433876
  },
433877
+ rendererSetPaletteState: {
433878
+ args: ["ptr", "ptr", "usize", "ptr", "ptr", "u32"],
433879
+ returns: "void"
433880
+ },
433730
433881
  queryPixelResolution: {
433731
433882
  args: ["ptr"],
433732
433883
  returns: "void"
433733
433884
  },
433885
+ queryThemeColors: {
433886
+ args: ["ptr"],
433887
+ returns: "void"
433888
+ },
433734
433889
  createOptimizedBuffer: {
433735
433890
  args: ["u32", "u32", "bool", "u8", "ptr", "usize"],
433736
433891
  returns: "ptr"
@@ -434568,7 +434723,7 @@ function getOpenTUILib(libPath) {
434568
434723
  returns: "void"
434569
434724
  },
434570
434725
  syntaxStyleRegister: {
434571
- args: ["ptr", "ptr", "usize", "ptr", "ptr", "u8"],
434726
+ args: ["ptr", "ptr", "usize", "ptr", "ptr", "u32"],
434572
434727
  returns: "u32"
434573
434728
  },
434574
434729
  syntaxStyleResolveByName: {
@@ -434929,7 +435084,7 @@ class FFIRenderLib {
434929
435084
  this.opentui.symbols.setClearOnShutdown(renderer, clear);
434930
435085
  }
434931
435086
  setBackgroundColor(renderer, color) {
434932
- this.opentui.symbols.setBackgroundColor(renderer, color.buffer);
435087
+ this.opentui.symbols.setBackgroundColor(renderer, rgbaPtr(color));
434933
435088
  }
434934
435089
  setRenderOffset(renderer, offset) {
434935
435090
  this.opentui.symbols.setRenderOffset(renderer, offset);
@@ -434970,6 +435125,13 @@ class FFIRenderLib {
434970
435125
  const height = this.opentui.symbols.getBufferHeight(bufferPtr);
434971
435126
  return new OptimizedBuffer(this, bufferPtr, width, height, { id: "current buffer", widthMethod: "unicode" });
434972
435127
  }
435128
+ rendererSetPaletteState(renderer, palette, defaultForeground, defaultBackground, paletteEpoch) {
435129
+ const paletteBuffer = new Uint16Array(palette.length * 4);
435130
+ for (let index = 0;index < palette.length; index++) {
435131
+ paletteBuffer.set(palette[index].buffer, index * 4);
435132
+ }
435133
+ this.opentui.symbols.rendererSetPaletteState(renderer, ptr4(paletteBuffer), palette.length, rgbaPtr(defaultForeground), rgbaPtr(defaultBackground), paletteEpoch >>> 0);
435134
+ }
434973
435135
  bufferGetCharPtr(buffer) {
434974
435136
  const ptr5 = this.opentui.symbols.bufferGetCharPtr(buffer);
434975
435137
  if (!ptr5) {
@@ -435025,29 +435187,29 @@ class FFIRenderLib {
435025
435187
  return this.opentui.symbols.getBufferHeight(buffer);
435026
435188
  }
435027
435189
  bufferClear(buffer, color) {
435028
- this.opentui.symbols.bufferClear(buffer, color.buffer);
435190
+ this.opentui.symbols.bufferClear(buffer, rgbaPtr(color));
435029
435191
  }
435030
435192
  bufferDrawText(buffer, text3, x3, y4, color, bgColor, attributes2) {
435031
435193
  const textBytes = this.encoder.encode(text3);
435032
435194
  const textLength = textBytes.byteLength;
435033
- const bg2 = bgColor ? bgColor.buffer : null;
435034
- const fg2 = color.buffer;
435195
+ const bg2 = optionalRgbaPtr(bgColor);
435196
+ const fg2 = rgbaPtr(color);
435035
435197
  this.opentui.symbols.bufferDrawText(buffer, textBytes, textLength, x3, y4, fg2, bg2, attributes2 ?? 0);
435036
435198
  }
435037
435199
  bufferSetCellWithAlphaBlending(buffer, x3, y4, char, color, bgColor, attributes2) {
435038
435200
  const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
435039
- const bg2 = bgColor.buffer;
435040
- const fg2 = color.buffer;
435201
+ const bg2 = rgbaPtr(bgColor);
435202
+ const fg2 = rgbaPtr(color);
435041
435203
  this.opentui.symbols.bufferSetCellWithAlphaBlending(buffer, x3, y4, charPtr, fg2, bg2, attributes2 ?? 0);
435042
435204
  }
435043
435205
  bufferSetCell(buffer, x3, y4, char, color, bgColor, attributes2) {
435044
435206
  const charPtr = char.codePointAt(0) ?? " ".codePointAt(0);
435045
- const bg2 = bgColor.buffer;
435046
- const fg2 = color.buffer;
435207
+ const bg2 = rgbaPtr(bgColor);
435208
+ const fg2 = rgbaPtr(color);
435047
435209
  this.opentui.symbols.bufferSetCell(buffer, x3, y4, charPtr, fg2, bg2, attributes2 ?? 0);
435048
435210
  }
435049
435211
  bufferFillRect(buffer, x3, y4, width, height, color) {
435050
- const bg2 = color.buffer;
435212
+ const bg2 = rgbaPtr(color);
435051
435213
  this.opentui.symbols.bufferFillRect(buffer, x3, y4, width, height, bg2);
435052
435214
  }
435053
435215
  bufferColorMatrix(buffer, matrixPtr, cellMaskPtr, cellMaskCount, strength, target) {
@@ -435064,17 +435226,17 @@ class FFIRenderLib {
435064
435226
  this.opentui.symbols.bufferDrawPackedBuffer(buffer, dataPtr, dataLen, posX, posY, terminalWidthCells, terminalHeightCells);
435065
435227
  }
435066
435228
  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);
435229
+ this.opentui.symbols.bufferDrawGrayscaleBuffer(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, optionalRgbaPtr(fg2), optionalRgbaPtr(bg2));
435068
435230
  }
435069
435231
  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);
435232
+ this.opentui.symbols.bufferDrawGrayscaleBufferSupersampled(buffer, posX, posY, intensitiesPtr, srcWidth, srcHeight, optionalRgbaPtr(fg2), optionalRgbaPtr(bg2));
435071
435233
  }
435072
435234
  bufferDrawGrid(buffer, borderChars, borderFg, borderBg, columnOffsets, columnCount, rowOffsets, rowCount, options) {
435073
435235
  const optionsBuffer = GridDrawOptionsStruct.pack({
435074
435236
  drawInner: options.drawInner,
435075
435237
  drawOuter: options.drawOuter
435076
435238
  });
435077
- this.opentui.symbols.bufferDrawGrid(buffer, borderChars, borderFg.buffer, borderBg.buffer, columnOffsets, columnCount, rowOffsets, rowCount, ptr4(optionsBuffer));
435239
+ this.opentui.symbols.bufferDrawGrid(buffer, borderChars, rgbaPtr(borderFg), rgbaPtr(borderBg), columnOffsets, columnCount, rowOffsets, rowCount, ptr4(optionsBuffer));
435078
435240
  }
435079
435241
  bufferDrawBox(buffer, x3, y4, width, height, borderChars, packedOptions, borderColor, backgroundColor, title, bottomTitle) {
435080
435242
  const titleBytes = title ? this.encoder.encode(title) : null;
@@ -435083,7 +435245,7 @@ class FFIRenderLib {
435083
435245
  const bottomTitleBytes = bottomTitle ? this.encoder.encode(bottomTitle) : null;
435084
435246
  const bottomTitleLen = bottomTitle ? bottomTitleBytes.length : 0;
435085
435247
  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);
435248
+ this.opentui.symbols.bufferDrawBox(buffer, x3, y4, width, height, borderChars, packedOptions, rgbaPtr(borderColor), rgbaPtr(backgroundColor), titlePtr, titleLen, bottomTitlePtr, bottomTitleLen);
435087
435249
  }
435088
435250
  bufferResize(buffer, width, height) {
435089
435251
  this.opentui.symbols.bufferResize(buffer, width, height);
@@ -435110,7 +435272,7 @@ class FFIRenderLib {
435110
435272
  this.opentui.symbols.setCursorPosition(renderer, x3, y4, visible);
435111
435273
  }
435112
435274
  setCursorColor(renderer, color) {
435113
- this.opentui.symbols.setCursorColor(renderer, color.buffer);
435275
+ this.opentui.symbols.setCursorColor(renderer, rgbaPtr(color));
435114
435276
  }
435115
435277
  getCursorState(renderer) {
435116
435278
  const cursorBuffer = new ArrayBuffer(CursorStateStruct.size);
@@ -435248,6 +435410,9 @@ class FFIRenderLib {
435248
435410
  queryPixelResolution(renderer) {
435249
435411
  this.opentui.symbols.queryPixelResolution(renderer);
435250
435412
  }
435413
+ queryThemeColors(renderer) {
435414
+ this.opentui.symbols.queryThemeColors(renderer);
435415
+ }
435251
435416
  writeOut(renderer, data) {
435252
435417
  const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
435253
435418
  if (bytes.length === 0)
@@ -435278,11 +435443,11 @@ class FFIRenderLib {
435278
435443
  this.opentui.symbols.textBufferClear(buffer);
435279
435444
  }
435280
435445
  textBufferSetDefaultFg(buffer, fg2) {
435281
- const fgPtr = fg2 ? fg2.buffer : null;
435446
+ const fgPtr = optionalRgbaPtr(fg2);
435282
435447
  this.opentui.symbols.textBufferSetDefaultFg(buffer, fgPtr);
435283
435448
  }
435284
435449
  textBufferSetDefaultBg(buffer, bg2) {
435285
- const bgPtr = bg2 ? bg2.buffer : null;
435450
+ const bgPtr = optionalRgbaPtr(bg2);
435286
435451
  this.opentui.symbols.textBufferSetDefaultBg(buffer, bgPtr);
435287
435452
  }
435288
435453
  textBufferSetDefaultAttributes(buffer, attributes2) {
@@ -435376,8 +435541,8 @@ class FFIRenderLib {
435376
435541
  this.opentui.symbols.destroyTextBufferView(view);
435377
435542
  }
435378
435543
  textBufferViewSetSelection(view, start2, end, bgColor, fgColor) {
435379
- const bg2 = bgColor ? bgColor.buffer : null;
435380
- const fg2 = fgColor ? fgColor.buffer : null;
435544
+ const bg2 = optionalRgbaPtr(bgColor);
435545
+ const fg2 = optionalRgbaPtr(fgColor);
435381
435546
  this.opentui.symbols.textBufferViewSetSelection(view, start2, end, bg2, fg2);
435382
435547
  }
435383
435548
  textBufferViewResetSelection(view) {
@@ -435396,18 +435561,18 @@ class FFIRenderLib {
435396
435561
  return this.opentui.symbols.textBufferViewGetSelectionInfo(view);
435397
435562
  }
435398
435563
  textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
435399
- const bg2 = bgColor ? bgColor.buffer : null;
435400
- const fg2 = fgColor ? fgColor.buffer : null;
435564
+ const bg2 = optionalRgbaPtr(bgColor);
435565
+ const fg2 = optionalRgbaPtr(fgColor);
435401
435566
  return this.opentui.symbols.textBufferViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
435402
435567
  }
435403
435568
  textBufferViewUpdateSelection(view, end, bgColor, fgColor) {
435404
- const bg2 = bgColor ? bgColor.buffer : null;
435405
- const fg2 = fgColor ? fgColor.buffer : null;
435569
+ const bg2 = optionalRgbaPtr(bgColor);
435570
+ const fg2 = optionalRgbaPtr(fgColor);
435406
435571
  this.opentui.symbols.textBufferViewUpdateSelection(view, end, bg2, fg2);
435407
435572
  }
435408
435573
  textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor) {
435409
- const bg2 = bgColor ? bgColor.buffer : null;
435410
- const fg2 = fgColor ? fgColor.buffer : null;
435574
+ const bg2 = optionalRgbaPtr(bgColor);
435575
+ const fg2 = optionalRgbaPtr(fgColor);
435411
435576
  return this.opentui.symbols.textBufferViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2);
435412
435577
  }
435413
435578
  textBufferViewResetLocalSelection(view) {
@@ -435496,7 +435661,7 @@ class FFIRenderLib {
435496
435661
  this.opentui.symbols.textBufferViewSetTabIndicator(view, indicator);
435497
435662
  }
435498
435663
  textBufferViewSetTabIndicatorColor(view, color) {
435499
- this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, color.buffer);
435664
+ this.opentui.symbols.textBufferViewSetTabIndicatorColor(view, rgbaPtr(color));
435500
435665
  }
435501
435666
  textBufferViewSetTruncate(view, truncate2) {
435502
435667
  this.opentui.symbols.textBufferViewSetTruncate(view, truncate2);
@@ -435825,8 +435990,8 @@ class FFIRenderLib {
435825
435990
  return outBuffer.slice(0, len);
435826
435991
  }
435827
435992
  editorViewSetSelection(view, start2, end, bgColor, fgColor) {
435828
- const bg2 = bgColor ? bgColor.buffer : null;
435829
- const fg2 = fgColor ? fgColor.buffer : null;
435993
+ const bg2 = optionalRgbaPtr(bgColor);
435994
+ const fg2 = optionalRgbaPtr(fgColor);
435830
435995
  this.opentui.symbols.editorViewSetSelection(view, start2, end, bg2, fg2);
435831
435996
  }
435832
435997
  editorViewResetSelection(view) {
@@ -435842,18 +436007,18 @@ class FFIRenderLib {
435842
436007
  return { start: start2, end };
435843
436008
  }
435844
436009
  editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
435845
- const bg2 = bgColor ? bgColor.buffer : null;
435846
- const fg2 = fgColor ? fgColor.buffer : null;
436010
+ const bg2 = optionalRgbaPtr(bgColor);
436011
+ const fg2 = optionalRgbaPtr(fgColor);
435847
436012
  return this.opentui.symbols.editorViewSetLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
435848
436013
  }
435849
436014
  editorViewUpdateSelection(view, end, bgColor, fgColor) {
435850
- const bg2 = bgColor ? bgColor.buffer : null;
435851
- const fg2 = fgColor ? fgColor.buffer : null;
436015
+ const bg2 = optionalRgbaPtr(bgColor);
436016
+ const fg2 = optionalRgbaPtr(fgColor);
435852
436017
  this.opentui.symbols.editorViewUpdateSelection(view, end, bg2, fg2);
435853
436018
  }
435854
436019
  editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bgColor, fgColor, updateCursor, followCursor) {
435855
- const bg2 = bgColor ? bgColor.buffer : null;
435856
- const fg2 = fgColor ? fgColor.buffer : null;
436020
+ const bg2 = optionalRgbaPtr(bgColor);
436021
+ const fg2 = optionalRgbaPtr(fgColor);
435857
436022
  return this.opentui.symbols.editorViewUpdateLocalSelection(view, anchorX, anchorY, focusX, focusY, bg2, fg2, updateCursor, followCursor);
435858
436023
  }
435859
436024
  editorViewResetLocalSelection(view) {
@@ -435952,6 +436117,7 @@ class FFIRenderLib {
435952
436117
  kitty_keyboard: caps.kitty_keyboard,
435953
436118
  kitty_graphics: caps.kitty_graphics,
435954
436119
  rgb: caps.rgb,
436120
+ ansi256: caps.ansi256,
435955
436121
  unicode: caps.unicode,
435956
436122
  sgr_pixels: caps.sgr_pixels,
435957
436123
  color_scheme_updates: caps.color_scheme_updates,
@@ -436000,7 +436166,7 @@ class FFIRenderLib {
436000
436166
  this.opentui.symbols.freeUnicode(encoded.ptr, encoded.data.length);
436001
436167
  }
436002
436168
  bufferDrawChar(buffer, char, x3, y4, fg2, bg2, attributes2 = 0) {
436003
- this.opentui.symbols.bufferDrawChar(buffer, char, x3, y4, fg2.buffer, bg2.buffer, attributes2);
436169
+ this.opentui.symbols.bufferDrawChar(buffer, char, x3, y4, rgbaPtr(fg2), rgbaPtr(bg2), attributes2);
436004
436170
  }
436005
436171
  registerNativeSpanFeedStream(stream, handler4) {
436006
436172
  const callback = this.ensureNativeSpanFeedCallback();
@@ -436081,8 +436247,8 @@ class FFIRenderLib {
436081
436247
  }
436082
436248
  syntaxStyleRegister(style, name39, fg2, bg2, attributes2) {
436083
436249
  const nameBytes = this.encoder.encode(name39);
436084
- const fgPtr = fg2 ? fg2.buffer : null;
436085
- const bgPtr = bg2 ? bg2.buffer : null;
436250
+ const fgPtr = optionalRgbaPtr(fg2);
436251
+ const bgPtr = optionalRgbaPtr(bg2);
436086
436252
  return this.opentui.symbols.syntaxStyleRegister(style, nameBytes, nameBytes.length, fgPtr, bgPtr, attributes2);
436087
436253
  }
436088
436254
  syntaxStyleResolveByName(style, name39) {
@@ -436107,7 +436273,7 @@ class FFIRenderLib {
436107
436273
  this.opentui.symbols.editorViewSetTabIndicator(view, indicator);
436108
436274
  }
436109
436275
  editorViewSetTabIndicatorColor(view, color) {
436110
- this.opentui.symbols.editorViewSetTabIndicatorColor(view, color.buffer);
436276
+ this.opentui.symbols.editorViewSetTabIndicatorColor(view, rgbaPtr(color));
436111
436277
  }
436112
436278
  onNativeEvent(name39, handler4) {
436113
436279
  this._nativeEvents.on(name39, handler4);
@@ -436957,9 +437123,11 @@ class SyntaxStyle {
436957
437123
  underline: style.underline,
436958
437124
  dim: style.dim
436959
437125
  });
436960
- const id = this.lib.syntaxStyleRegister(this.stylePtr, name39, style.fg || null, style.bg || null, attributes2);
437126
+ const fg2 = style.fg ? parseColor2(style.fg) : null;
437127
+ const bg2 = style.bg ? parseColor2(style.bg) : null;
437128
+ const id = this.lib.syntaxStyleRegister(this.stylePtr, name39, fg2, bg2, attributes2);
436961
437129
  this.nameCache.set(name39, id);
436962
- this.styleDefs.set(name39, style);
437130
+ this.styleDefs.set(name39, { ...style, fg: fg2 ?? undefined, bg: bg2 ?? undefined });
436963
437131
  return id;
436964
437132
  }
436965
437133
  resolveStyleId(name39) {
@@ -437412,6 +437580,132 @@ function inferThemeModeFromBackgroundColor(color) {
437412
437580
  const brightness = (r4 * 299 + g2 * 587 + b4 * 114) / 1000;
437413
437581
  return brightness > 128 ? "light" : "dark";
437414
437582
  }
437583
+
437584
+ class RendererThemeMode {
437585
+ host;
437586
+ clock;
437587
+ static QUERY_TIMEOUT_MS = 250;
437588
+ _themeMode = null;
437589
+ themeQueryPending = true;
437590
+ themeOscForeground = null;
437591
+ themeOscBackground = null;
437592
+ themeRefreshTimeoutId = null;
437593
+ waiters = new Set;
437594
+ constructor(host, clock2) {
437595
+ this.host = host;
437596
+ this.clock = clock2;
437597
+ }
437598
+ get themeMode() {
437599
+ return this._themeMode;
437600
+ }
437601
+ waitForThemeMode(timeoutMs, isDestroyed) {
437602
+ if (this._themeMode !== null || isDestroyed || timeoutMs === 0) {
437603
+ return Promise.resolve(this._themeMode);
437604
+ }
437605
+ return new Promise((resolve42) => {
437606
+ const waiter = {
437607
+ resolve: resolve42,
437608
+ timeoutHandle: null
437609
+ };
437610
+ if (timeoutMs > 0) {
437611
+ waiter.timeoutHandle = this.clock.setTimeout(() => {
437612
+ this.waiters.delete(waiter);
437613
+ waiter.timeoutHandle = null;
437614
+ resolve42(this._themeMode);
437615
+ }, timeoutMs);
437616
+ }
437617
+ this.waiters.add(waiter);
437618
+ });
437619
+ }
437620
+ cancelRefresh() {
437621
+ if (this.themeRefreshTimeoutId === null) {
437622
+ return;
437623
+ }
437624
+ this.clock.clearTimeout(this.themeRefreshTimeoutId);
437625
+ this.themeRefreshTimeoutId = null;
437626
+ this.themeQueryPending = false;
437627
+ }
437628
+ dispose() {
437629
+ this.cancelRefresh();
437630
+ for (const waiter of this.waiters) {
437631
+ if (waiter.timeoutHandle !== null) {
437632
+ this.clock.clearTimeout(waiter.timeoutHandle);
437633
+ }
437634
+ waiter.resolve(this._themeMode);
437635
+ }
437636
+ this.waiters.clear();
437637
+ }
437638
+ handleSequence(sequence) {
437639
+ if (sequence === "\x1B[?997;1n" || sequence === "\x1B[?997;2n") {
437640
+ this.requestThemeOscColors();
437641
+ return { handled: true, changedMode: null };
437642
+ }
437643
+ let handledOscThemeResponse = false;
437644
+ let match2;
437645
+ OSC_THEME_RESPONSE.lastIndex = 0;
437646
+ while (match2 = OSC_THEME_RESPONSE.exec(sequence)) {
437647
+ handledOscThemeResponse = true;
437648
+ const color = oscThemeColorToHex(match2[2], match2[3], match2[4], match2[5]);
437649
+ if (match2[1] === "10") {
437650
+ this.themeOscForeground = color;
437651
+ } else {
437652
+ this.themeOscBackground = color;
437653
+ }
437654
+ }
437655
+ if (!handledOscThemeResponse) {
437656
+ return { handled: false, changedMode: null };
437657
+ }
437658
+ if (!this.themeQueryPending) {
437659
+ return { handled: true, changedMode: null };
437660
+ }
437661
+ if (!this.themeOscForeground || !this.themeOscBackground) {
437662
+ return { handled: true, changedMode: null };
437663
+ }
437664
+ const nextMode = inferThemeModeFromBackgroundColor(this.themeOscBackground);
437665
+ const changedMode = this.applyThemeMode(nextMode);
437666
+ this.completeThemeQuery();
437667
+ return { handled: true, changedMode };
437668
+ }
437669
+ clearThemeRefreshTimeout() {
437670
+ if (this.themeRefreshTimeoutId === null) {
437671
+ return;
437672
+ }
437673
+ this.clock.clearTimeout(this.themeRefreshTimeoutId);
437674
+ this.themeRefreshTimeoutId = null;
437675
+ }
437676
+ completeThemeQuery() {
437677
+ this.clearThemeRefreshTimeout();
437678
+ this.themeQueryPending = false;
437679
+ }
437680
+ requestThemeOscColors() {
437681
+ if (this.themeRefreshTimeoutId !== null) {
437682
+ return;
437683
+ }
437684
+ this.themeQueryPending = true;
437685
+ this.themeOscForeground = null;
437686
+ this.themeOscBackground = null;
437687
+ this.host.queryThemeColors();
437688
+ this.clearThemeRefreshTimeout();
437689
+ this.themeRefreshTimeoutId = this.clock.setTimeout(() => {
437690
+ this.completeThemeQuery();
437691
+ }, RendererThemeMode.QUERY_TIMEOUT_MS);
437692
+ }
437693
+ applyThemeMode(mode) {
437694
+ const changed = this._themeMode !== mode;
437695
+ this._themeMode = mode;
437696
+ if (!changed) {
437697
+ return null;
437698
+ }
437699
+ for (const waiter of this.waiters) {
437700
+ if (waiter.timeoutHandle !== null) {
437701
+ this.clock.clearTimeout(waiter.timeoutHandle);
437702
+ }
437703
+ waiter.resolve(mode);
437704
+ }
437705
+ this.waiters.clear();
437706
+ return mode;
437707
+ }
437708
+ }
437415
437709
  function normalizeFooterHeight(footerHeight) {
437416
437710
  if (footerHeight === undefined) {
437417
437711
  return DEFAULT_FOOTER_HEIGHT;
@@ -437575,7 +437869,7 @@ var __defProp8, __returnValue2 = (v3) => v3, __export3 = (target, all2) => {
437575
437869
  configurable: true,
437576
437870
  set: __exportSetter2.bind(all2, name39)
437577
437871
  });
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) => {
437872
+ }, 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
437873
  const chunk = typeof input === "object" && "__isChunk" in input ? input : {
437580
437874
  __isChunk: true,
437581
437875
  text: String(input)
@@ -437584,7 +437878,7 @@ var __defProp8, __returnValue2 = (v3) => v3, __export3 = (target, all2) => {
437584
437878
  ...chunk,
437585
437879
  link: { url: url2 }
437586
437880
  };
437587
- }, kittyKeyMap, functionalKeyMap, tildeKeyMap, metaKeyCodeRe, fnKeyRe, keyName, nonAlphanumericKeys, isShiftKey = (code) => {
437881
+ }, kittyKeyMap, kittyNamedSingleStrokeKeys, functionalKeyMap, tildeKeyMap, metaKeyCodeRe, fnKeyRe, keyName, nonAlphanumericKeys, terminalNamedSingleStrokeKeys, isShiftKey = (code) => {
437588
437882
  return ["[a", "[b", "[c", "[d", "[e", "[2$", "[3$", "[5$", "[6$", "[7$", "[8$", "[Z"].includes(code);
437589
437883
  }, isCtrlKey = (code) => {
437590
437884
  return ["Oa", "Ob", "Oc", "Od", "Oe", "[2^", "[3^", "[5^", "[6^", "[7^", "[8^"].includes(code);
@@ -437780,8 +438074,8 @@ var __defProp8, __returnValue2 = (v3) => v3, __export3 = (target, all2) => {
437780
438074
  key3.code = "[3~";
437781
438075
  }
437782
438076
  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 () => {
438077
+ }, 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;
438078
+ var init_index_mw2x3082 = __esm(async () => {
437785
438079
  init_highlights();
437786
438080
  init_tree_sitter_javascript();
437787
438081
  init_highlights2();
@@ -439476,6 +439770,27 @@ var init_index_qpcsqve6 = __esm(async () => {
439476
439770
  }
439477
439771
  }
439478
439772
  };
439773
+ DEFAULT_FOREGROUND_RGB = [255, 255, 255];
439774
+ DEFAULT_BACKGROUND_RGB = [0, 0, 0];
439775
+ ANSI16_RGB = [
439776
+ [0, 0, 0],
439777
+ [128, 0, 0],
439778
+ [0, 128, 0],
439779
+ [128, 128, 0],
439780
+ [0, 0, 128],
439781
+ [128, 0, 128],
439782
+ [0, 128, 128],
439783
+ [192, 192, 192],
439784
+ [128, 128, 128],
439785
+ [255, 0, 0],
439786
+ [0, 255, 0],
439787
+ [255, 255, 0],
439788
+ [0, 0, 255],
439789
+ [255, 0, 255],
439790
+ [0, 255, 255],
439791
+ [255, 255, 255]
439792
+ ];
439793
+ ANSI_256_CUBE_LEVELS = [0, 95, 135, 175, 215, 255];
439479
439794
  CSS_COLOR_NAMES = {
439480
439795
  black: "#000000",
439481
439796
  white: "#FFFFFF",
@@ -442369,6 +442684,7 @@ var init_index_qpcsqve6 = __esm(async () => {
442369
442684
  57453: "iso_level3_shift",
442370
442685
  57454: "iso_level5_shift"
442371
442686
  };
442687
+ kittyNamedSingleStrokeKeys = [...new Set(Object.values(kittyKeyMap))];
442372
442688
  functionalKeyMap = {
442373
442689
  A: "up",
442374
442690
  B: "down",
@@ -442487,6 +442803,9 @@ var init_index_qpcsqve6 = __esm(async () => {
442487
442803
  "[Z": "tab"
442488
442804
  };
442489
442805
  nonAlphanumericKeys = [...Object.values(keyName), "backspace"];
442806
+ terminalNamedSingleStrokeKeys = [
442807
+ ...new Set(["return", "linefeed", "tab", "escape", "space", ...nonAlphanumericKeys, ...kittyNamedSingleStrokeKeys])
442808
+ ];
442490
442809
  modifyOtherKeysRe = /^\x1b\[27;(\d+);(\d+)~$/;
442491
442810
  MouseParser = class MouseParser {
442492
442811
  mouseButtonsPressed = new Set;
@@ -443365,6 +443684,8 @@ var init_index_qpcsqve6 = __esm(async () => {
443365
443684
  SYSTEM_CLOCK2 = new SystemClock;
443366
443685
  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
443686
  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;
443687
+ DEFAULT_FOREGROUND_FALLBACK = RGBA.fromInts(...DEFAULT_FOREGROUND_RGB);
443688
+ DEFAULT_BACKGROUND_FALLBACK = RGBA.fromInts(...DEFAULT_BACKGROUND_RGB);
443368
443689
  PASTE_TEXT_DECODER = new TextDecoder;
443369
443690
  URL_SCOPES = ["markup.link.url", "string.special.url"];
443370
443691
  pointerSize = process.arch === "x64" || process.arch === "arm64" ? 8 : 4;
@@ -443425,11 +443746,19 @@ var init_index_qpcsqve6 = __esm(async () => {
443425
443746
  ["link_len", "u64", { lengthOf: "link" }]
443426
443747
  ], {
443427
443748
  mapValue: (chunk) => {
443749
+ const normalizedFg = normalizeColorValue(chunk.fg ?? null);
443750
+ const normalizedBg = normalizeColorValue(chunk.bg ?? null);
443428
443751
  if (!chunk.link || typeof chunk.link === "string") {
443429
- return chunk;
443752
+ return {
443753
+ ...chunk,
443754
+ fg: normalizedFg?.rgba ?? null,
443755
+ bg: normalizedBg?.rgba ?? null
443756
+ };
443430
443757
  }
443431
443758
  return {
443432
443759
  ...chunk,
443760
+ fg: normalizedFg?.rgba ?? null,
443761
+ bg: normalizedBg?.rgba ?? null,
443433
443762
  link: chunk.link.url
443434
443763
  };
443435
443764
  }
@@ -443458,6 +443787,7 @@ var init_index_qpcsqve6 = __esm(async () => {
443458
443787
  ["kitty_keyboard", "bool_u8"],
443459
443788
  ["kitty_graphics", "bool_u8"],
443460
443789
  ["rgb", "bool_u8"],
443790
+ ["ansi256", "bool_u8"],
443461
443791
  ["unicode", UnicodeMethodEnum],
443462
443792
  ["sgr_pixels", "bool_u8"],
443463
443793
  ["color_scheme_updates", "bool_u8"],
@@ -443640,6 +443970,7 @@ var init_index_qpcsqve6 = __esm(async () => {
443640
443970
  ((RenderableEvents2) => {
443641
443971
  RenderableEvents2["FOCUSED"] = "focused";
443642
443972
  RenderableEvents2["BLURRED"] = "blurred";
443973
+ RenderableEvents2["DESTROYED"] = "destroyed";
443643
443974
  })(RenderableEvents ||= {});
443644
443975
  BaseRenderable = class BaseRenderable extends EventEmitter5 {
443645
443976
  [BrandedRenderable] = true;
@@ -443827,8 +444158,8 @@ var init_index_qpcsqve6 = __esm(async () => {
443827
444158
  focus() {
443828
444159
  if (this._isDestroyed || this._focused || !this._focusable)
443829
444160
  return;
443830
- this._ctx.focusRenderable(this);
443831
444161
  this._focused = true;
444162
+ this._ctx.focusRenderable(this);
443832
444163
  this.requestRender();
443833
444164
  this.keypressHandler = (key3) => {
443834
444165
  if (this._isDestroyed)
@@ -444711,6 +445042,7 @@ var init_index_qpcsqve6 = __esm(async () => {
444711
445042
  return;
444712
445043
  }
444713
445044
  this._isDestroyed = true;
445045
+ this.emit("destroyed");
444714
445046
  if (this.parent) {
444715
445047
  this.parent.remove(this.id);
444716
445048
  }
@@ -445892,6 +446224,7 @@ var init_index_qpcsqve6 = __esm(async () => {
445892
446224
  this._highlightsDirty = true;
445893
446225
  this._highlightSnapshotId++;
445894
446226
  if (this._streaming && !this._drawUnstyledText && this._filetype) {
446227
+ this.requestRender();
445895
446228
  return;
445896
446229
  }
445897
446230
  this.textBuffer.setText(value);
@@ -448489,6 +448822,7 @@ var init_index_qpcsqve6 = __esm(async () => {
448489
448822
  CliRenderEvents2["RESIZE"] = "resize";
448490
448823
  CliRenderEvents2["FOCUS"] = "focus";
448491
448824
  CliRenderEvents2["BLUR"] = "blur";
448825
+ CliRenderEvents2["FOCUSED_RENDERABLE"] = "focused_renderable";
448492
448826
  CliRenderEvents2["FOCUSED_EDITOR"] = "focused_editor";
448493
448827
  CliRenderEvents2["THEME_MODE"] = "theme_mode";
448494
448828
  CliRenderEvents2["CAPABILITIES"] = "capabilities";
@@ -448624,18 +448958,20 @@ var init_index_qpcsqve6 = __esm(async () => {
448624
448958
  lifecyclePasses = new Set;
448625
448959
  _openConsoleOnError = true;
448626
448960
  _paletteDetector = null;
448961
+ _paletteCache = new Map;
448627
448962
  _cachedPalette = null;
448628
448963
  _paletteDetectionPromise = null;
448964
+ _paletteDetectionSize = 0;
448965
+ _paletteEpoch = 0;
448966
+ _publishedPaletteSignature = null;
448967
+ _palettePublishGeneration = 0;
448629
448968
  _onDestroy;
448630
- _themeMode = null;
448631
- _themeModeSource = "none";
448632
- _themeFallbackPending = true;
448633
- _themeOscForeground = null;
448634
- _themeOscBackground = null;
448969
+ themeModeState;
448635
448970
  _terminalFocusState = null;
448636
448971
  sequenceHandlers = [];
448637
448972
  prependedInputHandlers = [];
448638
448973
  shouldRestoreModesOnNextFocus = false;
448974
+ themeModeHandler;
448639
448975
  idleResolvers = [];
448640
448976
  _debugInputs = [];
448641
448977
  _debugModeEnabled = env.OTUI_DEBUG;
@@ -448715,7 +449051,7 @@ Captured external output:
448715
449051
  this.rendererPtr = rendererPtr;
448716
449052
  this.clearOnShutdown = config2.clearOnShutdown ?? true;
448717
449053
  this.lib.setClearOnShutdown(this.rendererPtr, this.clearOnShutdown);
448718
- const forwardEnvKeys = config2.forwardEnvKeys ?? [...DEFAULT_FORWARDED_ENV_KEYS];
449054
+ const forwardEnvKeys = config2.forwardEnvKeys ?? (config2.remote ? [] : [...DEFAULT_FORWARDED_ENV_KEYS]);
448719
449055
  for (const key3 of forwardEnvKeys) {
448720
449056
  const value = process.env[key3];
448721
449057
  if (value === undefined)
@@ -448738,6 +449074,18 @@ Captured external output:
448738
449074
  this.targetFps = config2.targetFps || 30;
448739
449075
  this.maxFps = config2.maxFps || 60;
448740
449076
  this.clock = config2.clock ?? new SystemClock;
449077
+ this.themeModeState = new RendererThemeMode({
449078
+ queryThemeColors: () => {
449079
+ this.lib.queryThemeColors(this.rendererPtr);
449080
+ }
449081
+ }, this.clock);
449082
+ this.themeModeHandler = (sequence) => {
449083
+ const result = this.themeModeState.handleSequence(sequence);
449084
+ if (result.changedMode) {
449085
+ this.emit("theme_mode", result.changedMode);
449086
+ }
449087
+ return result.handled;
449088
+ };
448741
449089
  this.memorySnapshotInterval = config2.memorySnapshotInterval ?? 0;
448742
449090
  this.gatherStats = config2.gatherStats || false;
448743
449091
  this.maxStatSamples = config2.maxStatSamples || 300;
@@ -448870,20 +449218,29 @@ Captured external output:
448870
449218
  return Math.max(now2 - then, 0);
448871
449219
  }
448872
449220
  focusRenderable(renderable) {
448873
- if (this._currentFocusedRenderable === renderable)
449221
+ if (this._currentFocusedRenderable === renderable) {
448874
449222
  return;
448875
- const prev = this.currentFocusedEditor;
448876
- this._currentFocusedRenderable?.blur();
449223
+ }
449224
+ const previousRenderable = this._currentFocusedRenderable;
449225
+ const previousEditor = this.currentFocusedEditor;
448877
449226
  this._currentFocusedRenderable = renderable;
448878
- const next = this.currentFocusedEditor;
448879
- if (prev !== next) {
448880
- this.emit("focused_editor", next, prev);
449227
+ previousRenderable?.blur();
449228
+ const currentEditor = this.currentFocusedEditor;
449229
+ if (previousEditor !== currentEditor) {
449230
+ this.emit("focused_editor", currentEditor, previousEditor);
448881
449231
  }
449232
+ this.emit("focused_renderable", renderable, previousRenderable);
448882
449233
  }
448883
449234
  blurRenderable(renderable) {
448884
- if (this._currentFocusedRenderable === renderable) {
448885
- this._currentFocusedRenderable = null;
449235
+ if (this._currentFocusedRenderable !== renderable) {
449236
+ return;
448886
449237
  }
449238
+ const previousEditor = this.currentFocusedEditor;
449239
+ this._currentFocusedRenderable = null;
449240
+ if (previousEditor !== null) {
449241
+ this.emit("focused_editor", null, previousEditor);
449242
+ }
449243
+ this.emit("focused_renderable", null, renderable);
448887
449244
  }
448888
449245
  setCapturedRenderable(renderable) {
448889
449246
  if (this.capturedRenderable === renderable) {
@@ -449099,39 +449456,13 @@ Captured external output:
449099
449456
  return this._capabilities;
449100
449457
  }
449101
449458
  get themeMode() {
449102
- return this._themeMode;
449459
+ return this.themeModeState.themeMode;
449103
449460
  }
449104
449461
  waitForThemeMode(timeoutMs = 1000) {
449105
449462
  if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
449106
449463
  throw new Error("timeoutMs must be a non-negative finite number");
449107
449464
  }
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
- });
449465
+ return this.themeModeState.waitForThemeMode(timeoutMs, this._isDestroyed);
449135
449466
  }
449136
449467
  getDebugInputs() {
449137
449468
  return [...this._debugInputs];
@@ -449938,6 +450269,7 @@ Captured external output:
449938
450269
  }, 120);
449939
450270
  }
449940
450271
  this.queryPixelResolution();
450272
+ this.ensureNativePaletteState();
449941
450273
  }
449942
450274
  stdinListener = ((chunk) => {
449943
450275
  const data = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
@@ -449980,6 +450312,10 @@ Captured external output:
449980
450312
  }
449981
450313
  this.lib.processCapabilityResponse(this.rendererPtr, sequence);
449982
450314
  this._capabilities = this.lib.getTerminalCapabilities(this.rendererPtr);
450315
+ if (hasStandardCapabilitySignature) {
450316
+ this.forceFullRepaintRequested = true;
450317
+ this.requestRender();
450318
+ }
449983
450319
  this.emit("capabilities", this._capabilities);
449984
450320
  const hadPendingSplitStartupCursorSeed = this.pendingSplitStartupCursorSeed;
449985
450321
  if (hadPendingSplitStartupCursorSeed && hasCursorReport && this._screenMode === "split-footer" && this._externalOutputMode === "capture-stdout") {
@@ -450021,52 +450357,6 @@ Captured external output:
450021
450357
  }
450022
450358
  return false;
450023
450359
  }).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
450360
  dispatchSequenceHandlers(sequence) {
450071
450361
  if (this._debugModeEnabled) {
450072
450362
  this._debugInputs.push({
@@ -450601,6 +450891,7 @@ Captured external output:
450601
450891
  });
450602
450892
  this.stdinParser?.reset();
450603
450893
  this.stdin.removeListener("data", this.stdinListener);
450894
+ this.themeModeState.cancelRefresh();
450604
450895
  this.lib.suspendRenderer(this.rendererPtr);
450605
450896
  if (this.stdin.setRawMode) {
450606
450897
  this.stdin.setRawMode(false);
@@ -450701,6 +450992,7 @@ Captured external output:
450701
450992
  this.clock.clearTimeout(this.renderTimeout);
450702
450993
  this.renderTimeout = null;
450703
450994
  }
450995
+ this.themeModeState.cancelRefresh();
450704
450996
  this._isRunning = false;
450705
450997
  this.waitingForPixelResolution = false;
450706
450998
  this.updateStdinParserProtocolContext({
@@ -450734,8 +451026,14 @@ Captured external output:
450734
451026
  this._paletteDetector.cleanup();
450735
451027
  this._paletteDetector = null;
450736
451028
  }
451029
+ this._paletteCache.clear();
450737
451030
  this._paletteDetectionPromise = null;
451031
+ this._paletteDetectionSize = 0;
450738
451032
  this._cachedPalette = null;
451033
+ this._publishedPaletteSignature = null;
451034
+ this._paletteEpoch = 0;
451035
+ this._palettePublishGeneration = 0;
451036
+ this.themeModeState.dispose();
450739
451037
  this.emit("destroy");
450740
451038
  try {
450741
451039
  this.root.destroyRecursively();
@@ -450875,9 +451173,10 @@ Captured external output:
450875
451173
  this.flushPendingSplitCommits(forceSplitRepaint);
450876
451174
  this.pendingSplitFooterTransition = null;
450877
451175
  } else {
451176
+ const force = this.forceFullRepaintRequested;
450878
451177
  this.forceFullRepaintRequested = false;
450879
451178
  this.pendingSplitFooterTransition = null;
450880
- this.lib.render(this.rendererPtr, false);
451179
+ this.lib.render(this.rendererPtr, force);
450881
451180
  }
450882
451181
  this.renderingNative = false;
450883
451182
  }
@@ -451022,13 +451321,63 @@ Captured external output:
451022
451321
  }
451023
451322
  }
451024
451323
  get paletteDetectionStatus() {
451025
- if (this._cachedPalette)
451026
- return "cached";
451027
451324
  if (this._paletteDetectionPromise)
451028
451325
  return "detecting";
451326
+ if (this._paletteCache.size > 0)
451327
+ return "cached";
451029
451328
  return "idle";
451030
451329
  }
451330
+ getCachedPaletteBySize(size) {
451331
+ const exactMatch = this._paletteCache.get(size);
451332
+ if (exactMatch) {
451333
+ return exactMatch;
451334
+ }
451335
+ const largerSize = [...this._paletteCache.keys()].sort((a2, b4) => a2 - b4).find((candidate) => candidate >= size);
451336
+ if (largerSize === undefined) {
451337
+ return null;
451338
+ }
451339
+ const source = this._paletteCache.get(largerSize);
451340
+ if (!source) {
451341
+ return null;
451342
+ }
451343
+ const projected = {
451344
+ ...source,
451345
+ palette: source.palette.slice(0, size)
451346
+ };
451347
+ this._paletteCache.set(size, projected);
451348
+ return projected;
451349
+ }
451350
+ ensurePaletteDetector() {
451351
+ if (!this._paletteDetector) {
451352
+ const isLegacyTmux = this.capabilities?.terminal?.name?.toLowerCase()?.includes("tmux") && this.capabilities?.terminal?.version?.localeCompare("3.6") < 0;
451353
+ this._paletteDetector = createTerminalPalette(this.stdin, this.stdout, this.writeOut.bind(this), isLegacyTmux, {
451354
+ subscribeOsc: this.subscribeOsc.bind(this)
451355
+ }, this.clock);
451356
+ }
451357
+ return this._paletteDetector;
451358
+ }
451359
+ syncNativePaletteState(colors2) {
451360
+ const signature = buildTerminalPaletteSignature(colors2);
451361
+ if (this._publishedPaletteSignature !== signature) {
451362
+ this._paletteEpoch = this._paletteEpoch + 1 >>> 0;
451363
+ }
451364
+ this._publishedPaletteSignature = signature;
451365
+ const normalized = normalizeTerminalPalette(colors2);
451366
+ this.lib.rendererSetPaletteState(this.rendererPtr, normalized.palette, normalized.defaultForeground, normalized.defaultBackground, this._paletteEpoch);
451367
+ }
451368
+ ensureNativePaletteState() {
451369
+ if (!this._terminalIsSetup || this._isDestroyed)
451370
+ return;
451371
+ const publishGeneration = this._palettePublishGeneration;
451372
+ this.getPalette({ size: NATIVE_PALETTE_QUERY_SIZE }).then((colors2) => {
451373
+ if (this._palettePublishGeneration === publishGeneration) {
451374
+ this.syncNativePaletteState(colors2);
451375
+ }
451376
+ this.requestRender();
451377
+ }).catch(() => {});
451378
+ }
451031
451379
  clearPaletteCache() {
451380
+ this._paletteCache.clear();
451032
451381
  this._cachedPalette = null;
451033
451382
  }
451034
451383
  async getPalette(options) {
@@ -451036,33 +451385,80 @@ Captured external output:
451036
451385
  throw new Error("Cannot detect palette while renderer is suspended");
451037
451386
  }
451038
451387
  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;
451388
+ const detectionTimeout = options?.timeout;
451389
+ const cachedPalette = this.getCachedPaletteBySize(requestedSize);
451390
+ if (cachedPalette) {
451391
+ this._cachedPalette = cachedPalette;
451392
+ return cachedPalette;
451044
451393
  }
451045
451394
  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);
451395
+ if (this._paletteDetectionSize >= requestedSize) {
451396
+ return this._paletteDetectionPromise.then((palette) => {
451397
+ const cached3 = this.getCachedPaletteBySize(requestedSize);
451398
+ if (cached3) {
451399
+ this._cachedPalette = cached3;
451400
+ return cached3;
451401
+ }
451402
+ const projected = {
451403
+ ...palette,
451404
+ palette: palette.palette.slice(0, requestedSize)
451405
+ };
451406
+ this._paletteCache.set(requestedSize, projected);
451407
+ this._cachedPalette = projected;
451408
+ return projected;
451409
+ });
451410
+ }
451411
+ await this._paletteDetectionPromise;
451412
+ const afterWait = this.getCachedPaletteBySize(requestedSize);
451413
+ if (afterWait) {
451414
+ this._cachedPalette = afterWait;
451415
+ return afterWait;
451416
+ }
451053
451417
  }
451054
- this._paletteDetectionPromise = this._paletteDetector.detect(options).then((result) => {
451418
+ const detector = this.ensurePaletteDetector();
451419
+ const publishGeneration = this._palettePublishGeneration;
451420
+ this._paletteDetectionSize = requestedSize;
451421
+ this._paletteDetectionPromise = detector.detect({ ...options, timeout: detectionTimeout }).then((result) => {
451422
+ this._paletteCache.set(result.palette.length, result);
451055
451423
  this._cachedPalette = result;
451056
451424
  this._paletteDetectionPromise = null;
451425
+ this._paletteDetectionSize = 0;
451426
+ if (this._palettePublishGeneration === publishGeneration) {
451427
+ if (result.palette.length >= NATIVE_PALETTE_QUERY_SIZE) {
451428
+ this.syncNativePaletteState(result);
451429
+ } else if (this._terminalIsSetup && !this._paletteCache.has(NATIVE_PALETTE_QUERY_SIZE)) {
451430
+ this.ensureNativePaletteState();
451431
+ }
451432
+ }
451057
451433
  return result;
451434
+ }).catch((error48) => {
451435
+ this._paletteDetectionPromise = null;
451436
+ this._paletteDetectionSize = 0;
451437
+ throw error48;
451058
451438
  });
451059
- return this._paletteDetectionPromise;
451439
+ const detected = await this._paletteDetectionPromise;
451440
+ const finalPalette = this.getCachedPaletteBySize(requestedSize) ?? detected;
451441
+ this._cachedPalette = finalPalette;
451442
+ return finalPalette;
451060
451443
  }
451061
451444
  };
451062
451445
  });
451063
451446
 
451064
- // node_modules/@opentui/core/index-r3mexem1.js
451447
+ // node_modules/@opentui/core/index-mch6dv67.js
451065
451448
  import { toArrayBuffer as toArrayBuffer5 } from "bun:ffi";
451449
+ function toU82(value) {
451450
+ return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
451451
+ }
451452
+ function channel(buffer, index) {
451453
+ return (buffer[index] & 255) / 255;
451454
+ }
451455
+ function setRgb(buffer, base, r4, g2, b4) {
451456
+ const a2 = buffer[base + 3] & 255;
451457
+ buffer[base] = toU82(r4);
451458
+ buffer[base + 1] = toU82(g2);
451459
+ buffer[base + 2] = toU82(b4);
451460
+ buffer[base + 3] = a2;
451461
+ }
451066
451462
 
451067
451463
  class DistortionEffect {
451068
451464
  glitchChancePerSecond = 0.5;
@@ -451127,8 +451523,8 @@ class DistortionEffect {
451127
451523
  if (glitch.type === "shift" || glitch.type === "flip") {
451128
451524
  if (!tempChar) {
451129
451525
  tempChar = new Uint32Array(width);
451130
- tempFg = new Float32Array(width * 4);
451131
- tempBg = new Float32Array(width * 4);
451526
+ tempFg = new Uint16Array(width * 4);
451527
+ tempBg = new Uint16Array(width * 4);
451132
451528
  tempAttr = new Uint8Array(width);
451133
451529
  }
451134
451530
  try {
@@ -451235,12 +451631,8 @@ class DistortionEffect {
451235
451631
  gBg = 1 - gFg;
451236
451632
  bBg = 1 - bFg;
451237
451633
  }
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;
451634
+ setRgb(buf.fg, destColorIndex, rFg, gFg, bFg);
451635
+ setRgb(buf.bg, destColorIndex, rBg, gBg, bBg);
451244
451636
  }
451245
451637
  }
451246
451638
  }
@@ -451453,9 +451845,7 @@ class FlamesEffect {
451453
451845
  g2 = flameIntensity * 0.5;
451454
451846
  b4 = 0;
451455
451847
  }
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);
451848
+ 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
451849
  }
451460
451850
  }
451461
451851
  }
@@ -451521,12 +451911,8 @@ class CRTRollingBarEffect {
451521
451911
  const rowMultiplier = 1 + this._intensity * barFactor;
451522
451912
  for (let x3 = 0;x3 < width; x3++) {
451523
451913
  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);
451914
+ 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));
451915
+ 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
451916
  }
451531
451917
  }
451532
451918
  }
@@ -451625,22 +452011,33 @@ class RainbowTextEffect {
451625
452011
  for (let y4 = 0;y4 < height; y4++) {
451626
452012
  for (let x3 = 0;x3 < width; x3++) {
451627
452013
  const colorIndex = (y4 * width + x3) * 4;
451628
- const r4 = fg2[colorIndex];
451629
- const g2 = fg2[colorIndex + 1];
451630
- const b4 = fg2[colorIndex + 2];
452014
+ const r4 = channel(fg2, colorIndex);
452015
+ const g2 = channel(fg2, colorIndex + 1);
452016
+ const b4 = channel(fg2, colorIndex + 2);
451631
452017
  if (r4 >= whiteThreshold && g2 >= whiteThreshold && b4 >= whiteThreshold) {
451632
452018
  const projection = x3 * cosAngle + y4 * sinAngle;
451633
452019
  const maxProjection = width * cosAngle + height * sinAngle;
451634
452020
  const hue = (projection / maxProjection * repeats + this.time * 0.1) % 1;
451635
452021
  const [newR, newG, newB] = this.hsvToRgb(hue, saturation, value);
451636
- fg2[colorIndex] = newR;
451637
- fg2[colorIndex + 1] = newG;
451638
- fg2[colorIndex + 2] = newB;
452022
+ setRgb(fg2, colorIndex, newR, newG, newB);
451639
452023
  }
451640
452024
  }
451641
452025
  }
451642
452026
  }
451643
452027
  }
452028
+ function toU822(value) {
452029
+ return Math.round(Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * 255);
452030
+ }
452031
+ function channel2(buffer, index) {
452032
+ return (buffer[index] & 255) / 255;
452033
+ }
452034
+ function setRgb2(buffer, base, r4, g2, b4) {
452035
+ const a2 = buffer[base + 3] & 255;
452036
+ buffer[base] = toU822(r4);
452037
+ buffer[base + 1] = toU822(g2);
452038
+ buffer[base + 2] = toU822(b4);
452039
+ buffer[base + 3] = a2;
452040
+ }
451644
452041
  function applyScanlines(buffer, strength = 0.8, step = 2) {
451645
452042
  if (strength === 1 || step < 1)
451646
452043
  return;
@@ -451740,7 +452137,7 @@ function applyNoise(buffer, strength = 0.1) {
451740
452137
  function applyChromaticAberration(buffer, strength = 1) {
451741
452138
  const width = buffer.width;
451742
452139
  const height = buffer.height;
451743
- const srcFg = Float32Array.from(buffer.buffers.fg);
452140
+ const srcFg = Uint16Array.from(buffer.buffers.fg);
451744
452141
  const destFg = buffer.buffers.fg;
451745
452142
  const centerX = width / 2;
451746
452143
  const centerY = height / 2;
@@ -451755,9 +452152,7 @@ function applyChromaticAberration(buffer, strength = 1) {
451755
452152
  const gIndex = (y4 * width + x3) * 4;
451756
452153
  const bIndex = (y4 * width + bX) * 4;
451757
452154
  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];
452155
+ setRgb2(destFg, destIndex, channel2(srcFg, rIndex), channel2(srcFg, gIndex + 1), channel2(srcFg, bIndex + 2));
451761
452156
  }
451762
452157
  }
451763
452158
  }
@@ -451771,9 +452166,9 @@ function applyAsciiArt(buffer, ramp = ' .\'`^"",:;Il!i><~+_-?][}{1)(|\\/tfjrxnuv
451771
452166
  for (let x3 = 0;x3 < width; x3++) {
451772
452167
  const index = y4 * width + x3;
451773
452168
  const colorIndex = index * 4;
451774
- const bgR = bg2[colorIndex];
451775
- const bgG = bg2[colorIndex + 1];
451776
- const bgB = bg2[colorIndex + 2];
452169
+ const bgR = channel2(bg2, colorIndex);
452170
+ const bgG = channel2(bg2, colorIndex + 1);
452171
+ const bgB = channel2(bg2, colorIndex + 2);
451777
452172
  const lum = 0.299 * bgR + 0.587 * bgG + 0.114 * bgB;
451778
452173
  const rampIndex = Math.min(rampLength - 1, Math.floor(lum * rampLength));
451779
452174
  chars[index] = ramp[rampIndex].charCodeAt(0);
@@ -451954,16 +452349,16 @@ class BloomEffect {
451954
452349
  return;
451955
452350
  const width = buffer.width;
451956
452351
  const height = buffer.height;
451957
- const srcFg = Float32Array.from(buffer.buffers.fg);
451958
- const srcBg = Float32Array.from(buffer.buffers.bg);
452352
+ const srcFg = Uint16Array.from(buffer.buffers.fg);
452353
+ const srcBg = Uint16Array.from(buffer.buffers.bg);
451959
452354
  const destFg = buffer.buffers.fg;
451960
452355
  const destBg = buffer.buffers.bg;
451961
452356
  const brightPixels = [];
451962
452357
  for (let y4 = 0;y4 < height; y4++) {
451963
452358
  for (let x3 = 0;x3 < width; x3++) {
451964
452359
  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];
452360
+ const fgLum = 0.299 * channel2(srcFg, index) + 0.587 * channel2(srcFg, index + 1) + 0.114 * channel2(srcFg, index + 2);
452361
+ const bgLum = 0.299 * channel2(srcBg, index) + 0.587 * channel2(srcBg, index + 1) + 0.114 * channel2(srcBg, index + 2);
451967
452362
  const lum = Math.max(fgLum, bgLum);
451968
452363
  if (lum > threshold) {
451969
452364
  const intensity = (lum - threshold) / (1 - threshold + 0.000001);
@@ -451989,12 +452384,8 @@ class BloomEffect {
451989
452384
  const falloff = 1 - distSq / radiusSq;
451990
452385
  const bloomAmount = bright.intensity * strength * falloff;
451991
452386
  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);
452387
+ 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));
452388
+ 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
452389
  }
451999
452390
  }
452000
452391
  }
@@ -453362,7 +453753,7 @@ function calculateDynamicHeight(showUnderline, showDescription) {
453362
453753
  }
453363
453754
  return height;
453364
453755
  }
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 {
453756
+ 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
453757
  options;
453367
453758
  rules;
453368
453759
  lexer;
@@ -454394,8 +454785,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
454394
454785
  };
454395
454786
  }
454396
454787
  }, _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();
454788
+ var init_index_mch6dv67 = __esm(async () => {
454789
+ await init_index_mw2x3082();
454399
454790
  exports_src2 = {};
454400
454791
  __export3(exports_src2, {
454401
454792
  yellow: () => yellow,
@@ -454407,6 +454798,7 @@ var init_index_r3mexem1 = __esm(async () => {
454407
454798
  underline: () => underline,
454408
454799
  treeSitterToTextChunks: () => treeSitterToTextChunks,
454409
454800
  treeSitterToStyledText: () => treeSitterToStyledText,
454801
+ terminalNamedSingleStrokeKeys: () => terminalNamedSingleStrokeKeys,
454410
454802
  t: () => t,
454411
454803
  stripAnsiSequences: () => stripAnsiSequences,
454412
454804
  stringToStyledText: () => stringToStyledText,
@@ -454440,6 +454832,9 @@ var init_index_r3mexem1 = __esm(async () => {
454440
454832
  parseBorderStyle: () => parseBorderStyle,
454441
454833
  parseAlignItems: () => parseAlignItems,
454442
454834
  parseAlign: () => parseAlign,
454835
+ normalizeTerminalPalette: () => normalizeTerminalPalette,
454836
+ normalizeIndexedColorIndex: () => normalizeIndexedColorIndex,
454837
+ normalizeColorValue: () => normalizeColorValue,
454443
454838
  nonAlphanumericKeys: () => nonAlphanumericKeys,
454444
454839
  measureText: () => measureText,
454445
454840
  maybeMakeRenderable: () => maybeMakeRenderable,
@@ -454478,6 +454873,7 @@ var init_index_r3mexem1 = __esm(async () => {
454478
454873
  dim: () => dim,
454479
454874
  detectLinks: () => detectLinks,
454480
454875
  delegate: () => delegate,
454876
+ defaultTextareaKeyBindings: () => defaultTextareaKeyBindings,
454481
454877
  decodePasteBytes: () => decodePasteBytes,
454482
454878
  cyan: () => cyan,
454483
454879
  createTimeline: () => createTimeline,
@@ -454492,6 +454888,7 @@ var init_index_r3mexem1 = __esm(async () => {
454492
454888
  convertGlobalToLocalSelection: () => convertGlobalToLocalSelection,
454493
454889
  clearEnvCache: () => clearEnvCache,
454494
454890
  capture: () => capture,
454891
+ buildTerminalPaletteSignature: () => buildTerminalPaletteSignature,
454495
454892
  buildKittyKeyboardFlags: () => buildKittyKeyboardFlags,
454496
454893
  brightYellow: () => brightYellow,
454497
454894
  brightWhite: () => brightWhite,
@@ -454525,6 +454922,7 @@ var init_index_r3mexem1 = __esm(async () => {
454525
454922
  applyChromaticAberration: () => applyChromaticAberration,
454526
454923
  applyBrightness: () => applyBrightness,
454527
454924
  applyAsciiArt: () => applyAsciiArt,
454925
+ ansi256IndexToRgb: () => ansi256IndexToRgb,
454528
454926
  addDefaultParsers: () => addDefaultParsers,
454529
454927
  Yoga: () => exports_src,
454530
454928
  VignetteEffect: () => VignetteEffect,
@@ -454612,6 +455010,8 @@ var init_index_r3mexem1 = __esm(async () => {
454612
455010
  DataPathsManager: () => DataPathsManager,
454613
455011
  DEUTERANOPIA_SIM_MATRIX: () => DEUTERANOPIA_SIM_MATRIX,
454614
455012
  DEUTERANOPIA_COMP_MATRIX: () => DEUTERANOPIA_COMP_MATRIX,
455013
+ DEFAULT_FOREGROUND_RGB: () => DEFAULT_FOREGROUND_RGB,
455014
+ DEFAULT_BACKGROUND_RGB: () => DEFAULT_BACKGROUND_RGB,
454615
455015
  ConsolePosition: () => ConsolePosition,
454616
455016
  CodeRenderable: () => CodeRenderable,
454617
455017
  Code: () => Code,
@@ -456950,7 +457350,7 @@ var init_index_r3mexem1 = __esm(async () => {
456950
457350
  this.rightSide?.clearHighlightLines(startLine, endLine);
456951
457351
  }
456952
457352
  };
456953
- defaultTextareaKeybindings = [
457353
+ defaultTextareaKeyBindings = [
456954
457354
  { name: "left", action: "move-left" },
456955
457355
  { name: "right", action: "move-right" },
456956
457356
  { name: "up", action: "move-up" },
@@ -457051,7 +457451,7 @@ var init_index_r3mexem1 = __esm(async () => {
457051
457451
  this._placeholderColor = parseColor2(options.placeholderColor ?? defaults.placeholderColor);
457052
457452
  this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, options.keyAliasMap || {});
457053
457453
  this._keyBindings = options.keyBindings || [];
457054
- const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
457454
+ const mergedBindings = mergeKeyBindings(defaultTextareaKeyBindings, this._keyBindings);
457055
457455
  this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
457056
457456
  this._actionHandlers = this.buildActionHandlers();
457057
457457
  this._submitListener = options.onSubmit;
@@ -457119,11 +457519,13 @@ var init_index_r3mexem1 = __esm(async () => {
457119
457519
  this.insertText(stripAnsiSequences(decodePasteBytes(event.bytes)));
457120
457520
  }
457121
457521
  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();
457522
+ if (this.traits.suspend !== true) {
457523
+ const action = getKeyBindingAction(this._keyBindingsMap, key3);
457524
+ if (action) {
457525
+ const handler4 = this._actionHandlers.get(action);
457526
+ if (handler4) {
457527
+ return handler4();
457528
+ }
457127
457529
  }
457128
457530
  }
457129
457531
  if (!key3.ctrl && !key3.meta && !key3.super && !key3.hyper) {
@@ -457237,12 +457639,12 @@ var init_index_r3mexem1 = __esm(async () => {
457237
457639
  }
457238
457640
  set keyBindings(bindings) {
457239
457641
  this._keyBindings = bindings;
457240
- const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, bindings);
457642
+ const mergedBindings = mergeKeyBindings(defaultTextareaKeyBindings, bindings);
457241
457643
  this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
457242
457644
  }
457243
457645
  set keyAliasMap(aliases2) {
457244
457646
  this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases2);
457245
- const mergedBindings = mergeKeyBindings(defaultTextareaKeybindings, this._keyBindings);
457647
+ const mergedBindings = mergeKeyBindings(defaultTextareaKeyBindings, this._keyBindings);
457246
457648
  this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
457247
457649
  }
457248
457650
  get extmarks() {
@@ -458194,7 +458596,15 @@ var init_index_r3mexem1 = __esm(async () => {
458194
458596
  for (let colIdx = 0;colIdx < this._columnCount; colIdx++) {
458195
458597
  const cellX = (colOffsets[colIdx] ?? 0) + 1;
458196
458598
  const colWidth = colWidths[colIdx] ?? 1;
458197
- buffer.fillRect(cellX, cellY, colWidth, rowHeight, this._backgroundColor);
458599
+ if (this._backgroundColor.a < 1) {
458600
+ for (let y4 = cellY;y4 < cellY + rowHeight; y4++) {
458601
+ for (let x3 = cellX;x3 < cellX + colWidth; x3++) {
458602
+ buffer.setCell(x3, y4, " ", this._defaultFg, this._backgroundColor, this._defaultAttributes);
458603
+ }
458604
+ }
458605
+ } else {
458606
+ buffer.fillRect(cellX, cellY, colWidth, rowHeight, this._backgroundColor);
458607
+ }
458198
458608
  }
458199
458609
  }
458200
458610
  }
@@ -458234,6 +458644,11 @@ var init_index_r3mexem1 = __esm(async () => {
458234
458644
  return { rowIdx, colIdx };
458235
458645
  }
458236
458646
  applySelectionToCells(localSelection, isStart) {
458647
+ if (localSelection.anchorX === localSelection.focusX && localSelection.anchorY === localSelection.focusY) {
458648
+ this.resetCellSelections();
458649
+ this._lastSelectionMode = null;
458650
+ return;
458651
+ }
458237
458652
  const minSelY = Math.min(localSelection.anchorY, localSelection.focusY);
458238
458653
  const maxSelY = Math.max(localSelection.anchorY, localSelection.focusY);
458239
458654
  const firstRow = this.findRowForLocalY(minSelY);
@@ -458264,6 +458679,10 @@ var init_index_r3mexem1 = __esm(async () => {
458264
458679
  focusY: localSelection.focusY - cellTop
458265
458680
  };
458266
458681
  const isAnchorCell = selection.anchorCell !== null && selection.anchorCell.rowIdx === rowIdx && selection.anchorCell.colIdx === colIdx;
458682
+ if (selection.mode === "single-cell" && !isAnchorCell) {
458683
+ cell.textBufferView.resetLocalSelection();
458684
+ continue;
458685
+ }
458267
458686
  const forceSet = isAnchorCell && selection.mode !== "single-cell";
458268
458687
  if (forceSet) {
458269
458688
  coords = this.getFullCellSelectionCoords(rowIdx, colIdx);
@@ -461566,6 +461985,7 @@ __export(exports_core3, {
461566
461985
  underline: () => underline,
461567
461986
  treeSitterToTextChunks: () => treeSitterToTextChunks,
461568
461987
  treeSitterToStyledText: () => treeSitterToStyledText,
461988
+ terminalNamedSingleStrokeKeys: () => terminalNamedSingleStrokeKeys,
461569
461989
  t: () => t,
461570
461990
  stripAnsiSequences: () => stripAnsiSequences,
461571
461991
  stringToStyledText: () => stringToStyledText,
@@ -461599,6 +462019,9 @@ __export(exports_core3, {
461599
462019
  parseBorderStyle: () => parseBorderStyle,
461600
462020
  parseAlignItems: () => parseAlignItems,
461601
462021
  parseAlign: () => parseAlign,
462022
+ normalizeTerminalPalette: () => normalizeTerminalPalette,
462023
+ normalizeIndexedColorIndex: () => normalizeIndexedColorIndex,
462024
+ normalizeColorValue: () => normalizeColorValue,
461602
462025
  nonAlphanumericKeys: () => nonAlphanumericKeys,
461603
462026
  measureText: () => measureText,
461604
462027
  maybeMakeRenderable: () => maybeMakeRenderable,
@@ -461637,6 +462060,7 @@ __export(exports_core3, {
461637
462060
  dim: () => dim,
461638
462061
  detectLinks: () => detectLinks,
461639
462062
  delegate: () => delegate,
462063
+ defaultTextareaKeyBindings: () => defaultTextareaKeyBindings,
461640
462064
  decodePasteBytes: () => decodePasteBytes,
461641
462065
  cyan: () => cyan,
461642
462066
  createTimeline: () => createTimeline,
@@ -461651,6 +462075,7 @@ __export(exports_core3, {
461651
462075
  convertGlobalToLocalSelection: () => convertGlobalToLocalSelection,
461652
462076
  clearEnvCache: () => clearEnvCache,
461653
462077
  capture: () => capture,
462078
+ buildTerminalPaletteSignature: () => buildTerminalPaletteSignature,
461654
462079
  buildKittyKeyboardFlags: () => buildKittyKeyboardFlags,
461655
462080
  brightYellow: () => brightYellow,
461656
462081
  brightWhite: () => brightWhite,
@@ -461684,6 +462109,7 @@ __export(exports_core3, {
461684
462109
  applyChromaticAberration: () => applyChromaticAberration,
461685
462110
  applyBrightness: () => applyBrightness,
461686
462111
  applyAsciiArt: () => applyAsciiArt,
462112
+ ansi256IndexToRgb: () => ansi256IndexToRgb,
461687
462113
  addDefaultParsers: () => addDefaultParsers,
461688
462114
  Yoga: () => exports_src,
461689
462115
  VignetteEffect: () => VignetteEffect,
@@ -461771,6 +462197,8 @@ __export(exports_core3, {
461771
462197
  DataPathsManager: () => DataPathsManager,
461772
462198
  DEUTERANOPIA_SIM_MATRIX: () => DEUTERANOPIA_SIM_MATRIX,
461773
462199
  DEUTERANOPIA_COMP_MATRIX: () => DEUTERANOPIA_COMP_MATRIX,
462200
+ DEFAULT_FOREGROUND_RGB: () => DEFAULT_FOREGROUND_RGB,
462201
+ DEFAULT_BACKGROUND_RGB: () => DEFAULT_BACKGROUND_RGB,
461774
462202
  ConsolePosition: () => ConsolePosition,
461775
462203
  CodeRenderable: () => CodeRenderable,
461776
462204
  Code: () => Code,
@@ -461794,8 +462222,8 @@ __export(exports_core3, {
461794
462222
  });
461795
462223
  var init_core4 = __esm(async () => {
461796
462224
  await __promiseAll([
461797
- init_index_r3mexem1(),
461798
- init_index_qpcsqve6()
462225
+ init_index_mch6dv67(),
462226
+ init_index_mw2x3082()
461799
462227
  ]);
461800
462228
  });
461801
462229
 
@@ -462168,8 +462596,8 @@ var require_scheduler_development = __commonJS((exports) => {
462168
462596
  localSetImmediate(performWorkUntilDeadline);
462169
462597
  };
462170
462598
  else if (typeof MessageChannel !== "undefined") {
462171
- var channel = new MessageChannel, port = channel.port2;
462172
- channel.port1.onmessage = performWorkUntilDeadline;
462599
+ var channel3 = new MessageChannel, port = channel3.port2;
462600
+ channel3.port1.onmessage = performWorkUntilDeadline;
462173
462601
  schedulePerformWorkUntilDeadline = function() {
462174
462602
  port.postMessage(null);
462175
462603
  };
@@ -471793,7 +472221,7 @@ var init_chunk_bdqvmfwv = __esm(async () => {
471793
472221
  react_devtools_core_default.connectToDevTools();
471794
472222
  });
471795
472223
 
471796
- // node_modules/@opentui/react/chunk-msc8jt9j.js
472224
+ // node_modules/@opentui/react/chunk-81sn2skb.js
471797
472225
  function extend2(objects) {
471798
472226
  Object.assign(componentCatalogue, objects);
471799
472227
  }
@@ -471857,6 +472285,8 @@ function setProperty(instance3, type, propKey, propValue, oldPropValue) {
471857
472285
  case "onSubmit":
471858
472286
  if (instance3 instanceof InputRenderable) {
471859
472287
  initEventListeners(instance3, InputRenderableEvents.ENTER, propValue, oldPropValue);
472288
+ } else if (instance3 instanceof TextareaRenderable) {
472289
+ instance3.onSubmit = propValue;
471860
472290
  }
471861
472291
  break;
471862
472292
  case "onSelect":
@@ -471937,7 +472367,7 @@ function createRoot(renderer) {
471937
472367
  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
472368
  return import_react2.useContext(AppContext);
471939
472369
  }, ErrorBoundary, package_default2, idCounter, currentUpdatePriority, hostConfig, reconciler, _r, flushSync, createPortal;
471940
- var init_chunk_msc8jt9j = __esm(async () => {
472370
+ var init_chunk_81sn2skb = __esm(async () => {
471941
472371
  init_chunk_2mx7fq49();
471942
472372
  await __promiseAll([
471943
472373
  init_core4(),
@@ -472058,7 +472488,7 @@ var init_chunk_msc8jt9j = __esm(async () => {
472058
472488
  };
472059
472489
  package_default2 = {
472060
472490
  name: "@opentui/react",
472061
- version: "0.1.102",
472491
+ version: "0.2.0",
472062
472492
  description: "React renderer for building terminal user interfaces using OpenTUI core",
472063
472493
  license: "MIT",
472064
472494
  repository: {
@@ -472100,6 +472530,7 @@ var init_chunk_msc8jt9j = __esm(async () => {
472100
472530
  test: "bun test"
472101
472531
  },
472102
472532
  devDependencies: {
472533
+ "@opentui/keymap": "workspace:*",
472103
472534
  "@types/bun": "latest",
472104
472535
  "@types/node": "^24.0.0",
472105
472536
  "@types/react": "^19.0.0",
@@ -472574,7 +473005,7 @@ var import_react6, import_react7, import_react8, import_react9, import_react10,
472574
473005
  var init_react2 = __esm(async () => {
472575
473006
  init_chunk_2mx7fq49();
472576
473007
  await __promiseAll([
472577
- init_chunk_msc8jt9j(),
473008
+ init_chunk_81sn2skb(),
472578
473009
  init_core4(),
472579
473010
  init_core4(),
472580
473011
  init_core4()
@@ -478296,27 +478727,27 @@ var init_prerequisites = __esm(() => {
478296
478727
 
478297
478728
  // node_modules/ghostty-opentui/dist/darwin-arm64/ghostty-opentui.node
478298
478729
  var require_ghostty_opentui = __commonJS((exports, module3) => {
478299
- module3.exports = __require("./ghostty-opentui-jqndrqz0.node");
478730
+ module3.exports = __require("./ghostty-opentui-f2mew9sn.node");
478300
478731
  });
478301
478732
 
478302
478733
  // node_modules/ghostty-opentui/dist/darwin-x64/ghostty-opentui.node
478303
478734
  var require_ghostty_opentui2 = __commonJS((exports, module3) => {
478304
- module3.exports = __require("./ghostty-opentui-wvtvvtsy.node");
478735
+ module3.exports = __require("./ghostty-opentui-hpb2vcxc.node");
478305
478736
  });
478306
478737
 
478307
478738
  // node_modules/ghostty-opentui/dist/linux-arm64/ghostty-opentui.node
478308
478739
  var require_ghostty_opentui3 = __commonJS((exports, module3) => {
478309
- module3.exports = __require("./ghostty-opentui-wj67em0v.node");
478740
+ module3.exports = __require("./ghostty-opentui-97zf3rxa.node");
478310
478741
  });
478311
478742
 
478312
478743
  // node_modules/ghostty-opentui/dist/linux-x64/ghostty-opentui.node
478313
478744
  var require_ghostty_opentui4 = __commonJS((exports, module3) => {
478314
- module3.exports = __require("./ghostty-opentui-m3jfs005.node");
478745
+ module3.exports = __require("./ghostty-opentui-y599pszh.node");
478315
478746
  });
478316
478747
 
478317
478748
  // node_modules/ghostty-opentui/dist/win32-x64/ghostty-opentui.node
478318
478749
  var require_ghostty_opentui5 = __commonJS((exports, module3) => {
478319
- module3.exports = __require("./ghostty-opentui-rym4fe6k.node");
478750
+ module3.exports = __require("./ghostty-opentui-dgswj2kn.node");
478320
478751
  });
478321
478752
 
478322
478753
  // node_modules/ghostty-opentui/src/native-lib.cjs
@@ -490642,6 +491073,7 @@ var init_InputBox = __esm(async () => {
490642
491073
  }
490643
491074
  }, [fuzzyQuery, fuzzyMode, getHistoryDB]);
490644
491075
  const floatingTermOpen = useUIStore((s2) => s2.modals.floatingTerminal);
491076
+ const lockIn = useUIStore((s_0) => s_0.lockIn);
490645
491077
  const focused = floatingTermOpen ? false : isFocused ?? true;
490646
491078
  import_react36.useEffect(() => {
490647
491079
  if (focused)
@@ -491214,7 +491646,7 @@ var init_InputBox = __esm(async () => {
491214
491646
  onContentChange: handleContentChange,
491215
491647
  onCursorChange: handleCursorChange,
491216
491648
  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...",
491649
+ 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
491650
  placeholderColor: viewingCheckpoint != null ? t_0.warning : t_0.textMuted,
491219
491651
  focused,
491220
491652
  wrapMode: "char",
@@ -491605,7 +492037,7 @@ var init_LockInStreamView = __esm(async () => {
491605
492037
  await init_core4();
491606
492038
  import_compiler_runtime13 = __toESM(require_compiler_runtime(), 1);
491607
492039
  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"]);
492040
+ LOCKIN_EDIT_TOOLS = new Set(["edit_file", "multi_edit", "ast_edit", "write_file", "create_file", "rename_file", "move_symbol", "rename_symbol"]);
491609
492041
  QUIET_TOOLS = new Set(["update_plan_step", "ask_user", "task_list"]);
491610
492042
  SPIN_EXPLORE = ["\u25F4", "\u25F7", "\u25F6", "\u25F5"];
491611
492043
  SPIN_EDIT = ["\u258F", "\u258E", "\u258D", "\u258C", "\u258B", "\u258A", "\u2589", "\u2588", "\u2589", "\u258A", "\u258B", "\u258C", "\u258D", "\u258E", "\u258F"];
@@ -491763,9 +492195,9 @@ var init_LockInStreamView = __esm(async () => {
491763
492195
  t12,
491764
492196
  visible.length > 0 || children ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
491765
492197
  flexDirection: "column",
491766
- border: visible.length + hiddenCount >= 2 || children ? ["left"] : undefined,
492198
+ border: ["left"],
491767
492199
  borderColor: effectiveDone ? t2.textFaint : t2.textMuted,
491768
- paddingLeft: visible.length + hiddenCount >= 2 || children ? 1 : 2,
492200
+ paddingLeft: 1,
491769
492201
  opacity: effectiveDone ? 0.6 : 1,
491770
492202
  children: [
491771
492203
  hiddenCount > 0 ? /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
@@ -491794,7 +492226,7 @@ var init_LockInStreamView = __esm(async () => {
491794
492226
  const doneLabel = TOOL_LABELS_DONE[tc_0.name] ?? label;
491795
492227
  const displayLabel = tc_0.done ? doneLabel : label;
491796
492228
  const isLast = i4 === visible.length - 1 && !children;
491797
- const connector = visible.length < 2 && !children ? " " : isLast ? "\u2514 " : i4 === 0 && hiddenCount === 0 ? "\u250C " : "\u251C ";
492229
+ const connector = isLast ? "\u2514 " : i4 === 0 && hiddenCount === 0 ? "\u250C " : "\u251C ";
491798
492230
  const statusClr = tc_0.done ? tc_0.error ? t2.error : t2.success : t2.brand;
491799
492231
  return /* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV("box", {
491800
492232
  height: 1,