@opentui/core 0.1.93 → 0.1.95

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/3d.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  __export,
7
7
  __require,
8
8
  __toESM
9
- } from "./index-4kfx7p6q.js";
9
+ } from "./index-wv534m5j.js";
10
10
 
11
11
  // ../../node_modules/.bun/omggif@1.0.10/node_modules/omggif/omggif.js
12
12
  var require_omggif = __commonJS((exports) => {
@@ -1,16 +1,20 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_src
4
- } from "./index-adp83v70.js";
4
+ } from "./index-t2rqapaa.js";
5
5
  import {
6
6
  __require
7
- } from "./index-4kfx7p6q.js";
7
+ } from "./index-wv534m5j.js";
8
8
 
9
9
  // src/runtime-plugin.ts
10
10
  var CORE_RUNTIME_SPECIFIER = "@opentui/core";
11
11
  var CORE_TESTING_RUNTIME_SPECIFIER = "@opentui/core/testing";
12
12
  var RUNTIME_MODULE_PREFIX = "opentui:runtime-module:";
13
13
  var MAX_RUNTIME_RESOLVE_PARENTS = 64;
14
+ var DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS = {
15
+ nodeModulesRuntimeSpecifiers: true,
16
+ nodeModulesBareSpecifiers: false
17
+ };
14
18
  var DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS = [CORE_RUNTIME_SPECIFIER, CORE_TESTING_RUNTIME_SPECIFIER];
15
19
  var DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET = new Set(DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS);
16
20
  var isCoreRuntimeModuleSpecifier = (specifier) => {
@@ -40,6 +44,15 @@ var sourcePath = (path) => {
40
44
  const end = [searchIndex, hashIndex].filter((index) => index >= 0).sort((a, b) => a - b)[0];
41
45
  return end === undefined ? path : path.slice(0, end);
42
46
  };
47
+ var isNodeModulesPath = (path) => {
48
+ return /(?:^|[/\\])node_modules(?:[/\\])/.test(path);
49
+ };
50
+ var resolveRuntimePluginRewriteOptions = (options) => {
51
+ return {
52
+ nodeModulesRuntimeSpecifiers: options?.nodeModulesRuntimeSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesRuntimeSpecifiers,
53
+ nodeModulesBareSpecifiers: options?.nodeModulesBareSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesBareSpecifiers
54
+ };
55
+ };
43
56
  var runtimeLoaderForPath = (path) => {
44
57
  const cleanPath = sourcePath(path);
45
58
  if (cleanPath.endsWith(".tsx")) {
@@ -56,7 +69,7 @@ var runtimeLoaderForPath = (path) => {
56
69
  }
57
70
  return null;
58
71
  };
59
- var runtimeSourceFilter = /^(?!.*(?:\/|\\)node_modules(?:\/|\\)).*\.(?:[cm]?js|[cm]?ts|jsx|tsx)(?:[?#].*)?$/;
72
+ var runtimeSourceFilter = /\.(?:[cm]?js|[cm]?ts|jsx|tsx)(?:[?#].*)?$/;
60
73
  var resolveImportSpecifierPatterns = [
61
74
  /(from\s+["'])([^"']+)(["'])/g,
62
75
  /(import\s+["'])([^"']+)(["'])/g,
@@ -138,6 +151,7 @@ function createRuntimePlugin(input = {}) {
138
151
  const runtimeModules = new Map;
139
152
  runtimeModules.set(CORE_RUNTIME_SPECIFIER, input.core ?? exports_src);
140
153
  runtimeModules.set(CORE_TESTING_RUNTIME_SPECIFIER, loadCoreTestingRuntimeModule);
154
+ const rewriteOptions = resolveRuntimePluginRewriteOptions(input.rewrite);
141
155
  for (const [specifier, moduleEntry] of Object.entries(input.additional ?? {})) {
142
156
  runtimeModules.set(specifier, moduleEntry);
143
157
  }
@@ -162,17 +176,23 @@ function createRuntimePlugin(input = {}) {
162
176
  }
163
177
  build.onLoad({ filter: runtimeSourceFilter }, async (args) => {
164
178
  const path = sourcePath(args.path);
179
+ const nodeModulesPath = isNodeModulesPath(path);
180
+ const shouldRewriteRuntimeSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesRuntimeSpecifiers;
181
+ const shouldRewriteBareSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesBareSpecifiers;
182
+ if (!shouldRewriteRuntimeSpecifiers && !shouldRewriteBareSpecifiers) {
183
+ return;
184
+ }
165
185
  const loader = runtimeLoaderForPath(args.path);
166
186
  if (!loader) {
167
187
  throw new Error(`Unable to determine runtime loader for path: ${args.path}`);
168
188
  }
169
189
  const file = Bun.file(path);
170
190
  const contents = await file.text();
171
- const runtimeRewrittenContents = rewriteRuntimeSpecifiers(contents, runtimeModuleIdsBySpecifier);
172
- if (runtimeRewrittenContents !== contents) {
191
+ const runtimeRewrittenContents = shouldRewriteRuntimeSpecifiers ? rewriteRuntimeSpecifiers(contents, runtimeModuleIdsBySpecifier) : contents;
192
+ if (runtimeRewrittenContents !== contents && shouldRewriteBareSpecifiers) {
173
193
  registerResolveParent(resolveParentsByRecency, path);
174
194
  }
175
- const transformedContents = rewriteImportsFromResolveParents(runtimeRewrittenContents, resolveParentsByRecency);
195
+ const transformedContents = shouldRewriteBareSpecifiers ? rewriteImportsFromResolveParents(runtimeRewrittenContents, resolveParentsByRecency) : runtimeRewrittenContents;
176
196
  return {
177
197
  contents: transformedContents,
178
198
  loader
@@ -184,5 +204,5 @@ function createRuntimePlugin(input = {}) {
184
204
 
185
205
  export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin };
186
206
 
187
- //# debugId=320B34A5E2C7118F64756E2164756E21
188
- //# sourceMappingURL=index-bhw3bbqb.js.map
207
+ //# debugId=28B0B69C36E6FDF764756E2164756E21
208
+ //# sourceMappingURL=index-d991k25n.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/runtime-plugin.ts"],
4
+ "sourcesContent": [
5
+ "import { type BunPlugin } from \"bun\"\nimport * as coreRuntime from \"./index.js\"\n\nexport type RuntimeModuleExports = Record<string, unknown>\nexport type RuntimeModuleLoader = () => RuntimeModuleExports | Promise<RuntimeModuleExports>\nexport type RuntimeModuleEntry = RuntimeModuleExports | RuntimeModuleLoader\n\nexport interface RuntimePluginRewriteOptions {\n nodeModulesRuntimeSpecifiers?: boolean\n nodeModulesBareSpecifiers?: boolean\n}\n\nexport interface CreateRuntimePluginOptions {\n core?: RuntimeModuleEntry\n additional?: Record<string, RuntimeModuleEntry>\n rewrite?: RuntimePluginRewriteOptions\n}\n\nconst CORE_RUNTIME_SPECIFIER = \"@opentui/core\"\nconst CORE_TESTING_RUNTIME_SPECIFIER = \"@opentui/core/testing\"\nconst RUNTIME_MODULE_PREFIX = \"opentui:runtime-module:\"\nconst MAX_RUNTIME_RESOLVE_PARENTS = 64\nconst DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS: Required<RuntimePluginRewriteOptions> = {\n nodeModulesRuntimeSpecifiers: true,\n nodeModulesBareSpecifiers: false,\n}\n\nconst DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS = [CORE_RUNTIME_SPECIFIER, CORE_TESTING_RUNTIME_SPECIFIER] as const\n\nconst DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET = new Set<string>(DEFAULT_CORE_RUNTIME_MODULE_SPECIFIERS)\n\nexport const isCoreRuntimeModuleSpecifier = (specifier: string): boolean => {\n return DEFAULT_CORE_RUNTIME_MODULE_SPECIFIER_SET.has(specifier)\n}\n\nconst loadCoreTestingRuntimeModule = async (): Promise<RuntimeModuleExports> => {\n return (await import(\"./testing.js\")) as RuntimeModuleExports\n}\n\nconst escapeRegExp = (value: string): string => {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\nconst exactSpecifierFilter = (specifier: string): RegExp => {\n return new RegExp(`^${escapeRegExp(specifier)}$`)\n}\n\nexport const runtimeModuleIdForSpecifier = (specifier: string): string => {\n return `${RUNTIME_MODULE_PREFIX}${encodeURIComponent(specifier)}`\n}\n\nconst resolveRuntimeModuleExports = async (moduleEntry: RuntimeModuleEntry): Promise<RuntimeModuleExports> => {\n if (typeof moduleEntry === \"function\") {\n return await moduleEntry()\n }\n\n return moduleEntry\n}\n\nconst sourcePath = (path: string): string => {\n const searchIndex = path.indexOf(\"?\")\n const hashIndex = path.indexOf(\"#\")\n const end = [searchIndex, hashIndex].filter((index) => index >= 0).sort((a, b) => a - b)[0]\n return end === undefined ? path : path.slice(0, end)\n}\n\nconst isNodeModulesPath = (path: string): boolean => {\n return /(?:^|[/\\\\])node_modules(?:[/\\\\])/.test(path)\n}\n\nconst resolveRuntimePluginRewriteOptions = (\n options: RuntimePluginRewriteOptions | undefined,\n): Required<RuntimePluginRewriteOptions> => {\n return {\n nodeModulesRuntimeSpecifiers:\n options?.nodeModulesRuntimeSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesRuntimeSpecifiers,\n nodeModulesBareSpecifiers:\n options?.nodeModulesBareSpecifiers ?? DEFAULT_RUNTIME_PLUGIN_REWRITE_OPTIONS.nodeModulesBareSpecifiers,\n }\n}\n\nconst runtimeLoaderForPath = (path: string): \"js\" | \"ts\" | \"jsx\" | \"tsx\" | null => {\n const cleanPath = sourcePath(path)\n\n if (cleanPath.endsWith(\".tsx\")) {\n return \"tsx\"\n }\n\n if (cleanPath.endsWith(\".jsx\")) {\n return \"jsx\"\n }\n\n if (cleanPath.endsWith(\".ts\") || cleanPath.endsWith(\".mts\") || cleanPath.endsWith(\".cts\")) {\n return \"ts\"\n }\n\n if (cleanPath.endsWith(\".js\") || cleanPath.endsWith(\".mjs\") || cleanPath.endsWith(\".cjs\")) {\n return \"js\"\n }\n\n return null\n}\n\nconst runtimeSourceFilter = /\\.(?:[cm]?js|[cm]?ts|jsx|tsx)(?:[?#].*)?$/\n\nconst resolveImportSpecifierPatterns = [\n /(from\\s+[\"'])([^\"']+)([\"'])/g,\n /(import\\s+[\"'])([^\"']+)([\"'])/g,\n /(import\\s*\\(\\s*[\"'])([^\"']+)([\"']\\s*\\))/g,\n /(require\\s*\\(\\s*[\"'])([^\"']+)([\"']\\s*\\))/g,\n] as const\n\nconst isBareSpecifier = (specifier: string): boolean => {\n if (specifier.startsWith(\".\") || specifier.startsWith(\"/\") || specifier.startsWith(\"\\\\\")) {\n return false\n }\n\n if (\n specifier.startsWith(\"node:\") ||\n specifier.startsWith(\"bun:\") ||\n specifier.startsWith(\"http:\") ||\n specifier.startsWith(\"https:\") ||\n specifier.startsWith(\"file:\") ||\n specifier.startsWith(\"data:\")\n ) {\n return false\n }\n\n if (specifier.startsWith(RUNTIME_MODULE_PREFIX)) {\n return false\n }\n\n return true\n}\n\nconst registerResolveParent = (resolveParentsByRecency: string[], resolveParent: string): void => {\n const existingIndex = resolveParentsByRecency.indexOf(resolveParent)\n if (existingIndex >= 0) {\n resolveParentsByRecency.splice(existingIndex, 1)\n }\n\n resolveParentsByRecency.push(resolveParent)\n\n if (resolveParentsByRecency.length > MAX_RUNTIME_RESOLVE_PARENTS) {\n resolveParentsByRecency.shift()\n }\n}\n\nconst rewriteImportSpecifiers = (code: string, resolveReplacement: (specifier: string) => string | null): string => {\n let transformedCode = code\n\n for (const pattern of resolveImportSpecifierPatterns) {\n transformedCode = transformedCode.replace(pattern, (fullMatch, prefix, specifier, suffix) => {\n const replacement = resolveReplacement(specifier)\n if (!replacement || replacement === specifier) {\n return fullMatch\n }\n\n return `${prefix}${replacement}${suffix}`\n })\n }\n\n return transformedCode\n}\n\nconst resolveFromParent = (specifier: string, parent: string): string | null => {\n try {\n const resolvedSpecifier = import.meta.resolve(specifier, parent)\n if (\n resolvedSpecifier === specifier ||\n resolvedSpecifier.startsWith(\"node:\") ||\n resolvedSpecifier.startsWith(\"bun:\")\n ) {\n return null\n }\n\n return resolvedSpecifier\n } catch {\n return null\n }\n}\n\nconst rewriteImportsFromResolveParents = (code: string, resolveParentsByRecency: string[]): string => {\n if (resolveParentsByRecency.length === 0) {\n return code\n }\n\n const resolveFromParents = (specifier: string): string | null => {\n if (!isBareSpecifier(specifier)) {\n return null\n }\n\n for (let index = resolveParentsByRecency.length - 1; index >= 0; index -= 1) {\n const resolveParent = resolveParentsByRecency[index]\n const resolvedSpecifier = resolveFromParent(specifier, resolveParent)\n if (resolvedSpecifier) {\n return resolvedSpecifier\n }\n }\n\n return null\n }\n\n return rewriteImportSpecifiers(code, resolveFromParents)\n}\n\nconst rewriteRuntimeSpecifiers = (code: string, runtimeModuleIdsBySpecifier: Map<string, string>): string => {\n return rewriteImportSpecifiers(code, (specifier) => {\n const runtimeModuleId = runtimeModuleIdsBySpecifier.get(specifier)\n return runtimeModuleId ?? null\n })\n}\n\nexport function createRuntimePlugin(input: CreateRuntimePluginOptions = {}): BunPlugin {\n const runtimeModules = new Map<string, RuntimeModuleEntry>()\n runtimeModules.set(CORE_RUNTIME_SPECIFIER, input.core ?? (coreRuntime as RuntimeModuleExports))\n runtimeModules.set(CORE_TESTING_RUNTIME_SPECIFIER, loadCoreTestingRuntimeModule)\n const rewriteOptions = resolveRuntimePluginRewriteOptions(input.rewrite)\n\n for (const [specifier, moduleEntry] of Object.entries(input.additional ?? {})) {\n runtimeModules.set(specifier, moduleEntry)\n }\n\n const runtimeModuleIdsBySpecifier = new Map<string, string>()\n for (const specifier of runtimeModules.keys()) {\n runtimeModuleIdsBySpecifier.set(specifier, runtimeModuleIdForSpecifier(specifier))\n }\n\n return {\n name: \"bun-plugin-opentui-runtime-modules\",\n setup: (build) => {\n const resolveParentsByRecency: string[] = []\n\n for (const [specifier, moduleEntry] of runtimeModules.entries()) {\n const moduleId = runtimeModuleIdsBySpecifier.get(specifier)\n\n if (!moduleId) {\n continue\n }\n\n build.module(moduleId, async () => ({\n exports: await resolveRuntimeModuleExports(moduleEntry),\n loader: \"object\",\n }))\n\n build.onResolve({ filter: exactSpecifierFilter(specifier) }, () => ({ path: moduleId }))\n }\n\n build.onLoad({ filter: runtimeSourceFilter }, async (args) => {\n const path = sourcePath(args.path)\n const nodeModulesPath = isNodeModulesPath(path)\n const shouldRewriteRuntimeSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesRuntimeSpecifiers\n const shouldRewriteBareSpecifiers = !nodeModulesPath || rewriteOptions.nodeModulesBareSpecifiers\n\n if (!shouldRewriteRuntimeSpecifiers && !shouldRewriteBareSpecifiers) {\n return undefined\n }\n\n const loader = runtimeLoaderForPath(args.path)\n if (!loader) {\n throw new Error(`Unable to determine runtime loader for path: ${args.path}`)\n }\n\n const file = Bun.file(path)\n const contents = await file.text()\n const runtimeRewrittenContents = shouldRewriteRuntimeSpecifiers\n ? rewriteRuntimeSpecifiers(contents, runtimeModuleIdsBySpecifier)\n : contents\n\n if (runtimeRewrittenContents !== contents && shouldRewriteBareSpecifiers) {\n registerResolveParent(resolveParentsByRecency, path)\n }\n\n const transformedContents = shouldRewriteBareSpecifiers\n ? rewriteImportsFromResolveParents(runtimeRewrittenContents, resolveParentsByRecency)\n : runtimeRewrittenContents\n\n return {\n contents: transformedContents,\n loader,\n }\n })\n },\n }\n}\n"
6
+ ],
7
+ "mappings": ";;;;;;;;;AAkBA,IAAM,yBAAyB;AAC/B,IAAM,iCAAiC;AACvC,IAAM,wBAAwB;AAC9B,IAAM,8BAA8B;AACpC,IAAM,yCAAgF;AAAA,EACpF,8BAA8B;AAAA,EAC9B,2BAA2B;AAC7B;AAEA,IAAM,yCAAyC,CAAC,wBAAwB,8BAA8B;AAEtG,IAAM,4CAA4C,IAAI,IAAY,sCAAsC;AAEjG,IAAM,+BAA+B,CAAC,cAA+B;AAAA,EAC1E,OAAO,0CAA0C,IAAI,SAAS;AAAA;AAGhE,IAAM,+BAA+B,YAA2C;AAAA,EAC9E,OAAQ,MAAa;AAAA;AAGvB,IAAM,eAAe,CAAC,UAA0B;AAAA,EAC9C,OAAO,MAAM,QAAQ,uBAAuB,MAAM;AAAA;AAGpD,IAAM,uBAAuB,CAAC,cAA8B;AAAA,EAC1D,OAAO,IAAI,OAAO,IAAI,aAAa,SAAS,IAAI;AAAA;AAG3C,IAAM,8BAA8B,CAAC,cAA8B;AAAA,EACxE,OAAO,GAAG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2BAA2B,IAC9D;AAAA,QAEJ,IAAI,6BAA6B,YAAY,6BAA6B;AAAA,UACxE,sBAAsB,yBAAyB,IAAI;AAAA,QACrD;AAAA,QAEA,MAAM,sBAAsB,8BACxB,iCAAiC,0BAA0B,uBAAuB,IAClF;AAAA,QAEJ,OAAO;AAAA,UACL,UAAU;AAAA,UACV;AAAA,QACF;AAAA,OACD;AAAA;AAAA,EAEL;AAAA;",
8
+ "debugId": "28B0B69C36E6FDF764756E2164756E21",
9
+ "names": []
10
+ }
@@ -162,7 +162,7 @@ import {
162
162
  white,
163
163
  wrapWithDelegates,
164
164
  yellow
165
- } from "./index-4kfx7p6q.js";
165
+ } from "./index-wv534m5j.js";
166
166
 
167
167
  // src/index.ts
168
168
  var exports_src2 = {};
@@ -13339,4 +13339,4 @@ class TimeToFirstDrawRenderable extends Renderable {
13339
13339
  export { TextBufferView, EditBuffer, EditorView, convertThemeToStyles, SyntaxStyle, DistortionEffect, VignetteEffect, CloudsEffect, FlamesEffect, CRTRollingBarEffect, RainbowTextEffect, applyScanlines, applyInvert, applyNoise, applyChromaticAberration, applyAsciiArt, applyBrightness, applyGain, applySaturation, BloomEffect, 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, Timeline, engine, createTimeline, SlotRegistry, createSlotRegistry, createCoreSlotRegistry, registerCorePlugin, resolveCoreSlot, SlotRenderable, NativeSpanFeed, FrameBufferRenderable, ASCIIFontRenderable, BoxRenderable, TextBufferRenderable, CodeRenderable, isTextNodeRenderable, TextNodeRenderable, RootTextNodeRenderable, Generic, Box, Text, ASCIIFont, Input, Select, TabSelect, FrameBuffer, Code, ScrollBox, vstyles, VRenderable, LineNumberRenderable, TextRenderable, DiffRenderable, TextareaRenderable, InputRenderableEvents, InputRenderable, TextTableRenderable, MarkdownRenderable, SliderRenderable, ScrollBarRenderable, ArrowRenderable, ScrollBoxRenderable, SelectRenderableEvents, SelectRenderable, TabSelectRenderableEvents, TabSelectRenderable, TimeToFirstDrawRenderable, exports_src2 as exports_src };
13340
13340
 
13341
13341
  //# debugId=7EDA3B41AC71805164756E2164756E21
13342
- //# sourceMappingURL=index-adp83v70.js.map
13342
+ //# sourceMappingURL=index-t2rqapaa.js.map
@@ -6843,7 +6843,7 @@ var env = new Proxy({}, {
6843
6843
 
6844
6844
  // src/lib/stdin-parser.ts
6845
6845
  import { Buffer as Buffer3 } from "buffer";
6846
- var DEFAULT_TIMEOUT_MS = 10;
6846
+ var DEFAULT_TIMEOUT_MS = 20;
6847
6847
  var DEFAULT_MAX_PENDING_BYTES = 64 * 1024;
6848
6848
  var INITIAL_PENDING_CAPACITY = 256;
6849
6849
  var ESC = 27;
@@ -7014,6 +7014,28 @@ function parsePositiveDecimalPrefix(sequence, start, endExclusive) {
7014
7014
  }
7015
7015
  return sawDigit ? value : null;
7016
7016
  }
7017
+ function parseKittyFirstFieldCodepoint(sequence, start, endExclusive) {
7018
+ if (start >= endExclusive)
7019
+ return null;
7020
+ let firstColon = -1;
7021
+ for (let index = start;index < endExclusive; index += 1) {
7022
+ if (sequence[index] === 58) {
7023
+ firstColon = index;
7024
+ break;
7025
+ }
7026
+ }
7027
+ if (firstColon === -1)
7028
+ return null;
7029
+ const codepoint = parsePositiveDecimalPrefix(sequence, start, firstColon);
7030
+ if (codepoint === null)
7031
+ return null;
7032
+ for (let index = firstColon + 1;index < endExclusive; index += 1) {
7033
+ const byte = sequence[index];
7034
+ if (byte !== 58 && !isAsciiDigit(byte))
7035
+ return null;
7036
+ }
7037
+ return codepoint;
7038
+ }
7017
7039
  function canStillBeKittyU(state) {
7018
7040
  return state.semicolons >= 1;
7019
7041
  }
@@ -7215,10 +7237,13 @@ class StdinParser {
7215
7237
  }
7216
7238
  flushTimeout(nowMsValue = this.clock.now()) {
7217
7239
  this.ensureAlive();
7218
- if (this.paste || this.pendingSinceMs === null || this.pending.length === 0) {
7240
+ if (this.pendingSinceMs !== null && (nowMsValue < this.pendingSinceMs || nowMsValue - this.pendingSinceMs < this.timeoutMs)) {
7219
7241
  return;
7220
7242
  }
7221
- if (nowMsValue < this.pendingSinceMs || nowMsValue - this.pendingSinceMs < this.timeoutMs) {
7243
+ this.tryForceFlush();
7244
+ }
7245
+ tryForceFlush() {
7246
+ if (this.paste || this.pendingSinceMs === null || this.pending.length === 0) {
7222
7247
  return;
7223
7248
  }
7224
7249
  this.forceFlush = true;
@@ -7480,7 +7505,12 @@ class StdinParser {
7480
7505
  continue;
7481
7506
  }
7482
7507
  if (byte === 59) {
7483
- const firstParamValue = parsePositiveDecimalPrefix(bytes, this.unitStart + 2, this.cursor);
7508
+ const firstParamStart = this.unitStart + 2;
7509
+ const firstParamEnd = this.cursor;
7510
+ let firstParamValue = parsePositiveDecimalPrefix(bytes, firstParamStart, firstParamEnd);
7511
+ if (firstParamValue === null && this.protocolContext.kittyKeyboardEnabled) {
7512
+ firstParamValue = parseKittyFirstFieldCodepoint(bytes, firstParamStart, firstParamEnd);
7513
+ }
7484
7514
  if (firstParamValue !== null) {
7485
7515
  this.cursor += 1;
7486
7516
  this.state = {
@@ -8078,7 +8108,7 @@ class StdinParser {
8078
8108
  return;
8079
8109
  }
8080
8110
  try {
8081
- this.flushTimeout(this.clock.now());
8111
+ this.tryForceFlush();
8082
8112
  this.onTimeoutFlush?.();
8083
8113
  } catch (error) {
8084
8114
  console.error("stdin parser timeout flush failed", error);
@@ -17680,7 +17710,7 @@ Captured output:
17680
17710
  this.addExitListeners();
17681
17711
  const stdinParserMaxBufferBytes = config.stdinParserMaxBufferBytes ?? DEFAULT_STDIN_PARSER_MAX_BUFFER_BYTES;
17682
17712
  this.stdinParser = new StdinParser({
17683
- timeoutMs: 10,
17713
+ timeoutMs: 20,
17684
17714
  maxPendingBytes: stdinParserMaxBufferBytes,
17685
17715
  armTimeouts: true,
17686
17716
  onTimeoutFlush: () => {
@@ -19138,5 +19168,5 @@ Captured output:
19138
19168
 
19139
19169
  export { __toESM, __commonJS, __export, __require, Edge, Gutter, MeasureMode, exports_src, isValidBorderStyle, parseBorderStyle, BorderChars, getBorderFromSides, getBorderSides, borderCharsToArray, BorderCharArrays, KeyEvent, PasteEvent, KeyHandler, InternalKeyHandler, RGBA, hexToRgb, rgbToHex, hsvToRgb, parseColor, fonts, measureText, getCharacterPositions, coordinateToCharacterIndex, renderFontToFrameBuffer, TextAttributes, ATTRIBUTE_BASE_BITS, ATTRIBUTE_BASE_MASK, getBaseAttributes, DebugOverlayCorner, TargetChannel, createTextAttributes, attributesWithLink, getLinkId, visualizeRenderableTree, isStyledText, StyledText, stringToStyledText, black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bold, italic, underline, strikethrough, dim, reverse, blink, fg, bg, link, t, hastToStyledText, SystemClock, nonAlphanumericKeys, parseKeypress, LinearScrollAccel, MacOSScrollAccel, parseAlign, parseAlignItems, parseBoxSizing, parseDimension, parseDirection, parseDisplay, parseEdge, parseFlexDirection, parseGutter, parseJustify, parseLogLevel, parseMeasureMode, parseOverflow, parsePositionType, parseUnit, parseWrap, MouseParser, Selection, convertGlobalToLocalSelection, ASCIIFontSelectionHelper, envRegistry, registerEnvVar, clearEnvCache, generateEnvMarkdown, generateEnvColored, env, StdinParser, treeSitterToTextChunks, treeSitterToStyledText, addDefaultParsers, TreeSitterClient, DataPathsManager, getDataPaths, extensionToFiletype, basenameToFiletype, extToFiletype, pathToFiletype, infoStringToFiletype, main, getTreeSitterClient, ExtmarksController, createExtmarksController, TerminalPalette, createTerminalPalette, decodePasteBytes, stripAnsiSequences, detectLinks, TextBuffer, SpanInfoStruct, LogLevel2 as LogLevel, setRenderLibPath, resolveRenderLib, OptimizedBuffer, h, isVNode, maybeMakeRenderable, wrapWithDelegates, instantiate, delegate, isValidPercentage, LayoutEvents, RenderableEvents, isRenderable, BaseRenderable, Renderable, RootRenderable, ANSI, defaultKeyAliases, mergeKeyAliases, mergeKeyBindings, getKeyBindingKey, buildKeyBindingsMap, capture, ConsolePosition, TerminalConsole, getObjectsInViewport, buildKittyKeyboardFlags, MouseEvent, MouseButton, createCliRenderer, CliRenderEvents, RendererControlState, CliRenderer };
19140
19170
 
19141
- //# debugId=9E4159165560DCDE64756E2164756E21
19142
- //# sourceMappingURL=index-4kfx7p6q.js.map
19171
+ //# debugId=AAC1AF32CFE7F73F64756E2164756E21
19172
+ //# sourceMappingURL=index-wv534m5j.js.map