blecsd 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/LICENSE +4 -2
  2. package/README.md +167 -65
  3. package/dist/3d/index.d.ts +2 -2
  4. package/dist/3d/index.js +1 -1
  5. package/dist/audio/index.d.ts +2 -2
  6. package/dist/{border-D_Jb4ZJV.d.ts → border-DGNDfT6T.d.ts} +20 -10
  7. package/dist/chunk-25OEBENM.js +3 -0
  8. package/dist/chunk-26STV7ZS.js +1 -0
  9. package/dist/chunk-2NMGUEFC.js +4 -0
  10. package/dist/{chunk-LYSK5S63.js → chunk-4PRDJTCM.js} +1 -1
  11. package/dist/chunk-5N3O25O7.js +1 -0
  12. package/dist/chunk-5VEKHA3B.js +5 -0
  13. package/dist/chunk-6KEM3OS2.js +11 -0
  14. package/dist/chunk-6PX5R326.js +1 -0
  15. package/dist/chunk-6XWY6GB7.js +1 -0
  16. package/dist/chunk-735KKTP3.js +1 -0
  17. package/dist/chunk-7SWJNDOL.js +26 -0
  18. package/dist/chunk-APKUNIMB.js +1 -0
  19. package/dist/{chunk-FGHEFXLK.js → chunk-CJCSZRV6.js} +1 -1
  20. package/dist/chunk-DMBMCCLN.js +1 -0
  21. package/dist/chunk-DQTVJITR.js +1 -0
  22. package/dist/chunk-DSKQ5J4R.js +1 -0
  23. package/dist/chunk-E4CJRSND.js +1 -0
  24. package/dist/{chunk-OB66FB4F.js → chunk-EF4DC6IN.js} +1 -1
  25. package/dist/chunk-EJAKECSN.js +1 -0
  26. package/dist/chunk-FNQRUMFD.js +1 -0
  27. package/dist/chunk-GJ3RS2VG.js +1 -0
  28. package/dist/{chunk-TYMY2TBR.js → chunk-JHCKPCUH.js} +3 -3
  29. package/dist/{chunk-2UBBZFE4.js → chunk-KTVEMB2I.js} +1 -1
  30. package/dist/chunk-KYAPE44E.js +8 -0
  31. package/dist/chunk-LI4Y7TBZ.js +1 -0
  32. package/dist/chunk-NHOL4BN6.js +1 -0
  33. package/dist/chunk-NPDPBAW6.js +4 -0
  34. package/dist/chunk-NPNUUSIB.js +1 -0
  35. package/dist/chunk-OFRWGW2G.js +1 -0
  36. package/dist/chunk-OMU5BSAS.js +2 -0
  37. package/dist/chunk-P3ZLIQJP.js +1 -0
  38. package/dist/chunk-PWI36BQJ.js +1 -0
  39. package/dist/{chunk-VNZ6CWJA.js → chunk-QQMUDJ32.js} +2 -2
  40. package/dist/chunk-R3ICZOE4.js +1 -0
  41. package/dist/chunk-RJULLVTH.js +1 -0
  42. package/dist/{chunk-3B7MIVW6.js → chunk-RZ7FGVI6.js} +1 -1
  43. package/dist/chunk-S6WS46FE.js +1 -0
  44. package/dist/{chunk-TWSWTBYL.js → chunk-TSARUU56.js} +1 -1
  45. package/dist/chunk-WJRVUAZR.js +33 -0
  46. package/dist/{chunk-JKVHO4LH.js → chunk-WY5EZOOL.js} +1 -1
  47. package/dist/chunk-YY6RZCZH.js +4 -0
  48. package/dist/chunk-ZPGJCHXH.js +1 -0
  49. package/dist/chunk-ZPL2J25N.js +1 -0
  50. package/dist/cli/init.d.ts +1 -1
  51. package/dist/{componentStorage-DTkj1Qyj.d.ts → componentStorage-CJTh-TPO.d.ts} +1 -1
  52. package/dist/components/index.d.ts +7137 -5587
  53. package/dist/components/index.js +1 -1
  54. package/dist/core/index.d.ts +4138 -3169
  55. package/dist/core/index.js +1 -1
  56. package/dist/debug/index.d.ts +491 -98
  57. package/dist/debug/index.js +1 -1
  58. package/dist/dirtyTracking-C4v8MmM9.d.ts +235 -0
  59. package/dist/errors/index.d.ts +12 -12
  60. package/dist/errors/index.js +1 -1
  61. package/dist/{events-BbbxkgvX.d.ts → events-9ForpTfM.d.ts} +75 -2
  62. package/dist/game/index.d.ts +8 -8
  63. package/dist/game/index.js +1 -1
  64. package/dist/{gameLoop-BIPW7-OY.d.ts → gameLoop-CSTb7e0L.d.ts} +2 -2
  65. package/dist/{index-zSGJ2eUk.d.ts → index-DBS5Uefn.d.ts} +2 -2
  66. package/dist/index.d.ts +1005 -26
  67. package/dist/index.js +3 -1
  68. package/dist/input/index.d.ts +1 -1
  69. package/dist/input/index.js +1 -1
  70. package/dist/{inputActions-CefRUBuT.d.ts → inputActions-Fyw14_Gm.d.ts} +11 -722
  71. package/dist/{keyParser-Bwm8-l7v.d.ts → keyParser-m7fWto6g.d.ts} +18 -18
  72. package/dist/{mouseParser-Cfrbn3AX.d.ts → mouseParser-B7p5ow7K.d.ts} +1 -1
  73. package/dist/{packedStore-480t2X74.d.ts → packedStore-BgvnEdE7.d.ts} +1 -1
  74. package/dist/{renderable-jTMOA-GK.d.ts → renderable-CwqGwrEV.d.ts} +9 -9
  75. package/dist/scheduler-DeeZleia.d.ts +150 -0
  76. package/dist/systems/index.d.ts +473 -37
  77. package/dist/systems/index.js +1 -1
  78. package/dist/terminal/index.d.ts +2481 -2225
  79. package/dist/terminal/index.js +1 -1
  80. package/dist/{tilemap-j0twN9-y.d.ts → tilemap-BirMJdbu.d.ts} +2 -2
  81. package/dist/{types-BcsvoKzf.d.ts → types-CPB4CpbH.d.ts} +2 -2
  82. package/dist/utils/index.d.ts +28 -27
  83. package/dist/utils/index.js +1 -1
  84. package/dist/{virtualScrollback-DvZTRU8a.d.ts → virtualScrollback-D9uLFe8l.d.ts} +4 -4
  85. package/dist/{virtualViewport-Dx2iJliO.d.ts → virtualViewport-DTSN6jFk.d.ts} +370 -848
  86. package/dist/widgets/bigText.d.ts +1 -1
  87. package/dist/widgets/bigText.js +1 -1
  88. package/dist/widgets/index.d.ts +12079 -5902
  89. package/dist/widgets/index.js +1 -1
  90. package/package.json +102 -6
  91. package/dist/chunk-35I22JJO.js +0 -1
  92. package/dist/chunk-3APDF6RW.js +0 -1
  93. package/dist/chunk-3EGGGI5J.js +0 -3
  94. package/dist/chunk-4GISPPOH.js +0 -33
  95. package/dist/chunk-4X4N4HNQ.js +0 -2
  96. package/dist/chunk-6N6BRCEM.js +0 -4
  97. package/dist/chunk-AXZQAH4X.js +0 -1
  98. package/dist/chunk-BCADUCOZ.js +0 -1
  99. package/dist/chunk-CIK4AMUA.js +0 -1
  100. package/dist/chunk-EAY7B5GL.js +0 -1
  101. package/dist/chunk-EJ5WVDDZ.js +0 -6
  102. package/dist/chunk-FMFEOAML.js +0 -1
  103. package/dist/chunk-FYEBZAWN.js +0 -1
  104. package/dist/chunk-G7GIWWLE.js +0 -1
  105. package/dist/chunk-GYHI26UE.js +0 -1
  106. package/dist/chunk-H2YAOJDW.js +0 -1
  107. package/dist/chunk-JUWDTH25.js +0 -1
  108. package/dist/chunk-K2B2OXQ5.js +0 -5
  109. package/dist/chunk-K3SX2LY5.js +0 -1
  110. package/dist/chunk-KD55INV7.js +0 -1
  111. package/dist/chunk-KFAK4A3G.js +0 -1
  112. package/dist/chunk-LB3JA744.js +0 -19
  113. package/dist/chunk-LCN2ZITE.js +0 -1
  114. package/dist/chunk-P6CJO3BC.js +0 -1
  115. package/dist/chunk-PSXXMBVJ.js +0 -1
  116. package/dist/chunk-PXXGH3BV.js +0 -1
  117. package/dist/chunk-SHUC6JWA.js +0 -1
  118. package/dist/chunk-VCW7EOZ4.js +0 -12
  119. package/dist/chunk-W5OU7Z6J.js +0 -1
  120. package/dist/chunk-WHF27JF3.js +0 -4
  121. package/dist/chunk-WNG4A3K7.js +0 -4
  122. package/dist/chunk-WY3KY2TR.js +0 -1
  123. package/dist/chunk-XZA63ZPO.js +0 -1
  124. package/dist/scheduler-DcfoFuum.d.ts +0 -86
package/LICENSE CHANGED
@@ -1,5 +1,7 @@
1
- Copyright (c) 2013-2015, Christopher Jeffrey and contributors
2
- https://github.com/chjj/
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jeremy Stover (Kadajett) and contributors
4
+ https://github.com/Kadajett/blECSd
3
5
 
4
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -11,10 +11,10 @@ blECSd provides a complete toolkit for building terminal applications: dashboard
11
11
 
12
12
  ## Features
13
13
 
14
- - **18 Widgets**: Box, Panel, Tabs, List, Table, Tree, VirtualizedList, and more
15
- - **Form Controls**: TextInput, Checkbox, RadioButton, Slider, Select, ProgressBar
16
- - **32 Components**: Position, Renderable, Focusable, Interactive, Animation, Collision, etc.
17
- - **12 Systems**: Layout, Input, Render, Animation, Collision, Camera, Drag, Focus, etc.
14
+ - **43 Widgets**: Box, Panel, Tabs, List, Table, Tree, Terminal, Video, 3D Viewport, and more
15
+ - **Form Controls**: Textarea, Textbox, Checkbox, RadioButton, Switch, Select, ProgressBar, Form
16
+ - **41 Components**: Position, Renderable, Focusable, Interactive, Animation, Collision, Camera, and more
17
+ - **21 Systems**: Layout, Input, Render, Animation, Collision, SpatialHash, VisibilityCulling, and more
18
18
  - **Physics-based Animations**: Velocity, acceleration, friction for smooth transitions
19
19
  - **Virtualized Rendering**: Efficiently render 1000s of items
20
20
  - **State Machines**: Built-in FSM support for complex UI state
@@ -31,35 +31,33 @@ npm install blecsd
31
31
  import {
32
32
  createWorld,
33
33
  addEntity,
34
- setPosition,
35
- setDimensions,
36
- setBorder,
37
- setContent,
38
- createPanel,
34
+ Position,
35
+ Dimensions,
36
+ Border,
37
+ createBox,
39
38
  createList,
40
- createTextInput,
41
39
  createEventBus
42
40
  } from 'blecsd';
43
41
 
44
- // Create a world and entities
42
+ // Create a world and entity
45
43
  const world = createWorld();
46
-
47
- // Create a panel with a title
48
- const panel = createPanel(world, {
49
- x: 2,
50
- y: 1,
51
- width: 40,
52
- height: 10,
53
- title: 'My Application',
54
- border: { type: 'rounded' }
44
+ const entity = addEntity(world);
45
+
46
+ // Set position and dimensions using components
47
+ Position.x[entity] = 2;
48
+ Position.y[entity] = 1;
49
+ Dimensions.width[entity] = 40;
50
+ Dimensions.height[entity] = 10;
51
+
52
+ // Create a box widget
53
+ const box = createBox(world, entity, {
54
+ border: { type: 'rounded' },
55
+ title: 'My Application'
55
56
  });
56
57
 
57
- // Create an interactive list
58
- const list = createList(world, {
59
- x: 4,
60
- y: 3,
61
- width: 36,
62
- height: 6,
58
+ // Create a list in another entity
59
+ const listEntity = addEntity(world);
60
+ const list = createList(world, listEntity, {
63
61
  items: [
64
62
  { label: 'Option 1', value: 'opt1' },
65
63
  { label: 'Option 2', value: 'opt2' },
@@ -79,34 +77,63 @@ events.on('item:selected', (e) => console.log(`Selected: ${e.value}`));
79
77
 
80
78
  | Widget | Description |
81
79
  |--------|-------------|
80
+ | BarChart | Bar chart visualization |
81
+ | BigText | Large ASCII art text |
82
82
  | Box | Base container with borders, padding, content |
83
- | Panel | Box with title bar, collapsible, close button |
84
- | Tabs | Tabbed container with keyboard navigation |
85
- | Text | Text display with alignment, wrapping |
83
+ | Button | Clickable button with hover/focus states |
84
+ | Checkbox | Boolean toggle with customizable characters |
85
+ | FileManager | File browser with directory navigation |
86
+ | Form | Form field management, validation, submit |
87
+ | Gauge | Circular/radial gauge display |
88
+ | HoverText | Tooltip/hover text display |
89
+ | Image | Image rendering with various formats |
90
+ | Layout | Flex/grid layout container |
91
+ | Line | Horizontal/vertical separator |
92
+ | LineChart | Line chart visualization |
86
93
  | List | Selectable list with keyboard/mouse support |
87
- | Table | Data table with headers, columns, sorting |
88
- | Tree | Hierarchical tree view with expand/collapse |
89
- | VirtualizedList | Efficient list for large datasets |
90
- | ListTable | Table-style list display |
91
94
  | Listbar | Horizontal navigation bar |
92
- | Line | Horizontal/vertical separator |
95
+ | ListTable | Table-style list display |
93
96
  | Loading | Loading indicator with spinner |
97
+ | Log | Scrollable log viewer |
98
+ | Message | Message box with buttons |
99
+ | Modal | Modal dialog overlay |
100
+ | Panel | Box with title bar, collapsible, close button |
101
+ | ProgressBar | Progress indicator, horizontal/vertical |
102
+ | Prompt | Input prompt dialog |
103
+ | Question | Question dialog with yes/no buttons |
104
+ | RadioButton | Single selection from group |
94
105
  | ScrollableBox | Container with scroll support |
95
106
  | ScrollableText | Scrollable text area |
96
- | HoverText | Tooltip/hover text display |
97
- | Layout | Flex/grid layout container |
107
+ | Sparkline | Sparkline chart visualization |
108
+ | SplitPane | Split pane container with resize |
109
+ | StreamingText | Text display with typewriter effect |
110
+ | Switch | Toggle switch control |
111
+ | Table | Data table with headers, columns, sorting |
112
+ | Tabs | Tabbed container with keyboard navigation |
113
+ | Terminal | ANSI terminal emulator with PTY support |
114
+ | Text | Text display with alignment, wrapping |
115
+ | Textarea | Multi-line text editor |
116
+ | Textbox | Single-line text input |
117
+ | TextEditing | Text editing utilities |
118
+ | Toast | Toast notification popup |
119
+ | Tree | Hierarchical tree view with expand/collapse |
120
+ | Video | Video playback widget |
121
+ | Viewport3d | 3D scene renderer |
122
+ | VirtualizedList | Efficient list for large datasets |
98
123
 
99
124
  ## Form Controls
100
125
 
101
126
  | Control | Description |
102
127
  |---------|-------------|
103
- | TextInput | Single/multi-line text entry with cursor, selection |
128
+ | Textarea | Multi-line text editor with cursor, selection |
129
+ | Textbox | Single-line text input with cursor support |
104
130
  | Checkbox | Boolean toggle with customizable characters |
105
131
  | RadioButton | Single selection from group |
106
- | Slider | Range value selection, horizontal/vertical |
107
- | Select | Dropdown selection menu |
132
+ | Switch | Toggle switch control |
133
+ | Select | Dropdown selection menu (via List component) |
108
134
  | ProgressBar | Progress indicator, horizontal/vertical |
109
135
  | Form | Form field management, validation, submit |
136
+ | Button | Clickable button with hover/focus states |
110
137
 
111
138
  ## Components
112
139
 
@@ -114,24 +141,46 @@ blECSd provides ECS components that work with any bitECS world:
114
141
 
115
142
  | Component | Purpose |
116
143
  |-----------|---------|
117
- | Position | X/Y coordinates, z-index, absolute positioning |
118
- | Renderable | Colors, visibility, dirty tracking |
144
+ | Animation | Frame-based sprite animations |
145
+ | Behavior | Behavior tree execution |
146
+ | Border | Box borders (single, double, rounded, bold, ascii) |
147
+ | Button | Button state and configuration |
148
+ | Camera | Viewport, target following, bounds |
149
+ | Checkbox | Checkbox state |
150
+ | Collision | AABB/circle collision detection, layers, triggers |
151
+ | Content | Text content, alignment, wrapping, tag parsing |
119
152
  | Dimensions | Width, height, min/max constraints, percentages |
120
- | Hierarchy | Parent-child relationships, traversal |
121
153
  | Focusable | Keyboard focus, tab order |
154
+ | Form | Form field management |
155
+ | Health | Health/damage system |
156
+ | Hierarchy | Parent-child relationships, traversal |
157
+ | Input | Input capture state |
122
158
  | Interactive | Click, hover, drag states |
123
- | Scrollable | Scroll position, content size, scrollbars |
124
- | Border | Box borders (single, double, rounded, bold, ascii) |
125
- | Content | Text content, alignment, wrapping, tag parsing |
126
- | Padding | Inner spacing |
127
159
  | Label | Text labels with positioning |
128
- | Animation | Frame-based sprite animations |
129
- | Velocity | Movement with speed, friction, max speed |
130
- | Collision | AABB/circle collision detection, layers, triggers |
131
- | Camera | Viewport, target following, bounds |
132
- | StateMachine | Finite state machine with events, transitions |
133
- | Sprite | Sprite sheets, frames |
160
+ | List | List widget state |
161
+ | Padding | Inner spacing |
162
+ | Particle | Particle system data |
163
+ | Position | X/Y coordinates, z-index, absolute positioning |
164
+ | ProgressBar | Progress bar state |
165
+ | RadioButton | Radio button state |
166
+ | Renderable | Colors, visibility, dirty tracking |
167
+ | Screen | Screen buffer data |
168
+ | Scrollable | Scroll position, content size, scrollbars |
169
+ | Scrollbar | Scrollbar state |
170
+ | Select | Selection dropdown state |
134
171
  | Shadow | Drop shadows with opacity, blending |
172
+ | Slider | Slider state |
173
+ | Spinner | Loading spinner state |
174
+ | Sprite | Sprite sheets, frames |
175
+ | StateMachine | Finite state machine with events, transitions |
176
+ | Table | Table widget state |
177
+ | TerminalBuffer | Terminal emulator buffer |
178
+ | TextInput | Text input state |
179
+ | TextSelection | Text selection state |
180
+ | Tilemap | Tilemap rendering data |
181
+ | Timer | Timer/countdown state |
182
+ | UserData | Custom user data storage |
183
+ | Velocity | Movement with speed, friction, max speed |
135
184
  | VirtualViewport | Virtualized content rendering |
136
185
 
137
186
  See [API Reference](./docs/api/index.md) for the complete list.
@@ -140,18 +189,27 @@ See [API Reference](./docs/api/index.md) for the complete list.
140
189
 
141
190
  | System | Purpose |
142
191
  |--------|---------|
143
- | inputSystem | Process keyboard/mouse input |
144
- | focusSystem | Manage focus, tab navigation |
145
- | layoutSystem | Calculate positions, dimensions |
146
- | renderSystem | Render entities to screen buffer |
147
- | virtualizedRenderSystem | Efficient rendering for large datasets |
148
192
  | animationSystem | Update sprite animations |
149
- | movementSystem | Apply velocity to position |
150
- | collisionSystem | Detect and resolve collisions |
193
+ | behaviorSystem | Execute behavior trees |
151
194
  | cameraSystem | Update camera following target |
195
+ | collisionSystem | Detect and resolve collisions |
152
196
  | dragSystem | Handle drag and drop |
153
- | stateMachineSystem | Process state machine transitions |
197
+ | focusSystem | Manage focus, tab navigation |
198
+ | frameBudget | Frame time profiling and budget management |
199
+ | inputSystem | Process keyboard/mouse input |
200
+ | layoutSystem | Calculate positions, dimensions |
201
+ | movementSystem | Apply velocity to position |
154
202
  | outputSystem | Write buffer to terminal |
203
+ | panelMovement | Handle panel drag/resize |
204
+ | particleSystem | Update particle effects |
205
+ | renderSystem | Render entities to screen buffer |
206
+ | smoothScroll | Smooth scrolling animations |
207
+ | spatialHash | Spatial partitioning for collision |
208
+ | stateMachineSystem | Process state machine transitions |
209
+ | tilemapRenderer | Render tilemap layers |
210
+ | virtualizedRenderSystem | Efficient rendering for large datasets |
211
+ | visibilityCulling | Frustum/viewport culling |
212
+ | workerPool | Background task processing |
155
213
 
156
214
  ## Library Design
157
215
 
@@ -164,13 +222,22 @@ blECSd is a library, not a framework:
164
222
 
165
223
  ```typescript
166
224
  // Your world, your control
167
- import { createWorld, addEntity, setPosition, setRenderable, layoutSystem, renderSystem } from 'blecsd';
225
+ import {
226
+ createWorld,
227
+ addEntity,
228
+ Position,
229
+ Renderable,
230
+ layoutSystem,
231
+ renderSystem
232
+ } from 'blecsd';
168
233
 
169
234
  const world = createWorld();
170
235
  const eid = addEntity(world);
171
236
 
172
- // Use components without our update loop
173
- setPosition(world, eid, 10, 5);
237
+ // Use components directly - no setters needed
238
+ Position.x[eid] = 10;
239
+ Position.y[eid] = 5;
240
+ Renderable.visible[eid] = 1;
174
241
 
175
242
  // Call systems when you want
176
243
  layoutSystem(world);
@@ -229,7 +296,7 @@ const callbacks = createComponentStore<() => void>({ iterable: false });
229
296
  |---------|--------|-----|---------|---------|
230
297
  | Architecture | ECS + PackedStore (data-oriented) | React (component) | Class-based | Widget classes |
231
298
  | Language | TypeScript | TypeScript/JSX | JavaScript | Python |
232
- | Widgets | 18 built-in | Few built-in | Many built-in | Many built-in |
299
+ | Widgets | 43 built-in | Few built-in | Many built-in | Many built-in |
233
300
  | Animation | Physics-based | Manual | Manual | CSS-like |
234
301
  | Virtualization | Built-in | Manual | Manual | Built-in |
235
302
  | Game support | First-class | Limited | Limited | Limited |
@@ -238,13 +305,25 @@ Choose blECSd if you want data-oriented design, physics-based animations, or gam
238
305
 
239
306
  ## Documentation
240
307
 
308
+ ### Getting Started
241
309
  - [Installation](./docs/getting-started/installation.md): Requirements, terminal compatibility, setup
242
310
  - [Core Concepts](./docs/getting-started/concepts.md): ECS, scheduler, events
243
311
  - [Hello World](./docs/getting-started/hello-world.md): Your first blECSd application
312
+
313
+ ### API Reference
244
314
  - [API Reference](./docs/api/index.md): Components, widgets, systems, terminal I/O
245
315
  - [Terminal Widget](./docs/api/widgets/terminal.md): ANSI rendering and PTY shell support
246
- - [Examples](./docs/examples/index.md): File manager, multiplexer, system monitor, ANSI viewer, telnet server
316
+
317
+ ### Guides
247
318
  - [Guides](./docs/guides/): Animations, forms, layouts, and more
319
+ - [Error Handling](./docs/guides/error-handling.md): Error boundaries and recovery
320
+ - [Testing Guide](./docs/guides/testing.md): Unit and integration testing
321
+ - [Performance Optimization](./docs/guides/performance.md): Profiling and optimization
322
+ - [Migration Guide](./docs/guides/migration.md): Migrating from other libraries
323
+ - [Keyboard Shortcuts](./docs/guides/keyboard-shortcuts.md): Custom keybindings
324
+
325
+ ### Examples
326
+ - [Examples Repository](https://github.com/Kadajett/blECSd-Examples): File manager, multiplexer, system monitor, ANSI viewer, telnet server, and more
248
327
 
249
328
  ## Development
250
329
 
@@ -255,6 +334,29 @@ pnpm lint
255
334
  pnpm build
256
335
  ```
257
336
 
337
+ ### Benchmarking
338
+
339
+ Run performance benchmarks to measure system performance:
340
+
341
+ ```bash
342
+ # Run all benchmarks
343
+ pnpm bench
344
+
345
+ # Run CI benchmarks (fast subset for regression detection)
346
+ pnpm bench:ci
347
+
348
+ # Run real-world scenario benchmarks
349
+ pnpm bench:scenarios
350
+
351
+ # Update performance baseline
352
+ pnpm bench:update-baseline
353
+
354
+ # Check for performance regressions (vs baseline)
355
+ pnpm bench:check-regression
356
+ ```
357
+
358
+ The CI automatically checks for performance regressions on pull requests. If any benchmark regresses by more than 20%, the build will fail.
359
+
258
360
  ## License
259
361
 
260
362
  MIT
@@ -1,5 +1,5 @@
1
- export { A as AmbientLight, a as AmbientLightSchema, b as Animation3D, c as Animation3DData, B as BackendCapabilities, d as BackendCapabilitiesSchema, e as BackendPreference, f as BackendPreferenceSchema, g as BackendSelection, h as BackendSelectionSchema, j as BackendType, k as BackendTypeSchema, l as BrailleConfig, m as BrailleConfigSchema, C as Camera3D, n as Camera3DData, o as ClipRect, p as ClipRectSchema, q as ClippedLine, r as CubeMeshOptions, s as CubeMeshOptionsSchema, t as CylinderMeshOptions, u as CylinderMeshOptionsSchema, D as DirectionalLight, v as DirectionalLightSchema, E as EncodedCell, w as EncodedCellSchema, x as EncodedOutput, y as EncodedOutputSchema, z as EulerAngles, F as EulerAnglesSchema, G as FrustumPlane, H as GraphicsCapabilities, I as HalfBlockConfig, J as HalfBlockConfigSchema, K as KittyConfig, L as KittyConfigSchema, M as LineEndpoint, N as LineEndpointSchema, O as Mat4, P as Mat4Schema, Q as Material3D, R as Material3DData, S as Mesh, T as MeshData, U as MeshProjection, V as MouseDragInput, W as MouseInteraction3D, X as MouseInteraction3DData, Y as ObjFace, Z as ObjGroup, _ as ObjLoadOptions, $ as ObjLoadOptionsSchema, a0 as ObjParseResult, a1 as ObjVertex, a2 as OrthographicConfig, a3 as OrthographicConfigSchema, a4 as PerspectiveConfig, a5 as PerspectiveConfigSchema, a6 as PixelBufferConfig, a7 as PixelBufferConfigSchema, a8 as PixelFramebuffer, a9 as PlaneMeshOptions, aa as PlaneMeshOptionsSchema, ab as ProjectedVertex, ac as RGBAColor, ad as RGBAColorSchema, ae as RendererBackend, af as ScreenCoord, ag as SextantConfig, ah as SextantConfigSchema, ai as SixelConfig, aj as SixelConfigSchema, ak as SphereMeshOptions, al as SphereMeshOptionsSchema, am as Transform3D, an as Transform3DData, ao as TriangleBBox, ap as TriangleVertex, aq as TriangleVertexSchema, ar as Vec3, as as Vec3Input, at as Vec3InputSchema, au as Vec3Schema, av as Viewport3D, aw as Viewport3DData, ax as ViewportConfig, ay as ViewportConfigSchema, az as ViewportOutput, aA as ViewportProjection, aB as animation3DSystem, aC as backendStore, aD as blendPixel, aE as buildMVP, aF as clearBackendStore, aG as clearFramebuffer, aH as clearFramebufferStore, aI as clearMeshStore, aJ as clearMouseInputStore, aK as clearOutputStore, aL as clearProjectionStore, aM as clipLine, aN as computeBoundingBox, aO as computeFaceNormal, aP as computeFlatShading, aQ as computeOutcode, aR as createBackendByType, aS as createBrailleBackend, aT as createCubeMesh, aU as createCylinderMesh, aV as createHalfBlockBackend, aW as createKittyBackend, aX as createMeshFromArrays, aY as createPixelFramebuffer, aZ as createPlaneMesh, a_ as createSextantBackend, a$ as createSixelBackend, b0 as createSphereMesh, b1 as detectBestBackend, b2 as disableMouseInteraction, b3 as drawLine, b4 as drawLineAA, b5 as drawLineColor, b6 as drawLineDepth, b7 as enableMouseInteraction, b8 as extractFrustumPlanes, b9 as feedMouseDrag, ba as feedMouseScroll, bb as fillRect, bc as fillTriangle, bd as fillTriangleFlat, be as framebufferStore, bf as getAnimation3D, bg as getCamera3D, bh as getDepth, bi as getMaterial3D, bj as getMesh, bk as getMeshCount, bl as getMeshData, bm as getMouseInteraction3D, bn as getPixel, bo as getProjMatrix, bp as getTransform3D, bq as getViewMatrix, br as getViewport3D, bs as getWorldMatrix, bt as isDirty, bu as isInBounds, bv as isPointInFrustum, bw as isSphereInFrustum, bx as loadObjAsMesh, by as lookAt, bz as markDirty, bA as mat4Determinant, bB as mat4Equals, bC as mat4FromTRS, bD as mat4Identity, bE as mat4Invert, bF as mat4IsIdentity, bG as mat4Multiply, bH as mat4RotateX, bI as mat4RotateY, bJ as mat4RotateZ, bK as mat4Scale, bL as mat4TransformDirection, bM as mat4TransformVec3, bN as mat4Translate, bO as mat4Transpose, bP as mouseInputStore, bQ as mouseInteraction3DSystem, bR as orthographicMatrix, bS as outputStore, bT as parseObj, bU as perspectiveMatrix, bV as projectVertex, bW as projectionStore, bX as projectionSystem, bY as rasterSystem, bZ as registerMesh, b_ as sceneGraphSystem, b$ as setAnimation3D, c0 as setCamera3D, c1 as setMaterial3D, c2 as setMesh, c3 as setPixel, c4 as setPixelUnsafe, c5 as setRotation, c6 as setScale, c7 as setTransform3D, c8 as setTranslation, c9 as setViewport3D, ca as shadeFace, cb as testAndSetDepth, cc as triangleArea2, cd as triangleBoundingBox, ce as unprojectVertex, cf as unregisterMesh, cg as vec3, ch as vec3Add, ci as vec3Cross, cj as vec3Distance, ck as vec3Dot, cl as vec3Equals, cm as vec3FromArray, cn as vec3Length, co as vec3LengthSq, cp as vec3Lerp, cq as vec3Negate, cr as vec3Normalize, cs as vec3Scale, ct as vec3Sub, cu as vec3Zero, cv as viewportOutputSystem, cw as viewportTransform } from '../index-zSGJ2eUk.js';
1
+ export { A as AmbientLight, a as AmbientLightSchema, b as Animation3D, c as Animation3DData, B as BackendCapabilities, d as BackendCapabilitiesSchema, e as BackendPreference, f as BackendPreferenceSchema, g as BackendSelection, h as BackendSelectionSchema, j as BackendType, k as BackendTypeSchema, l as BrailleConfig, m as BrailleConfigSchema, C as Camera3D, n as Camera3DData, o as ClipRect, p as ClipRectSchema, q as ClippedLine, r as CubeMeshOptions, s as CubeMeshOptionsSchema, t as CylinderMeshOptions, u as CylinderMeshOptionsSchema, D as DirectionalLight, v as DirectionalLightSchema, E as EncodedCell, w as EncodedCellSchema, x as EncodedOutput, y as EncodedOutputSchema, z as EulerAngles, F as EulerAnglesSchema, G as FrustumPlane, H as GraphicsCapabilities, I as HalfBlockConfig, J as HalfBlockConfigSchema, K as KittyConfig, L as KittyConfigSchema, M as LineEndpoint, N as LineEndpointSchema, O as Mat4, P as Mat4Schema, Q as Material3D, R as Material3DData, S as Mesh, T as MeshData, U as MeshProjection, V as MouseDragInput, W as MouseInteraction3D, X as MouseInteraction3DData, Y as ObjFace, Z as ObjGroup, _ as ObjLoadOptions, $ as ObjLoadOptionsSchema, a0 as ObjParseResult, a1 as ObjVertex, a2 as OrthographicConfig, a3 as OrthographicConfigSchema, a4 as PerspectiveConfig, a5 as PerspectiveConfigSchema, a6 as PixelBufferConfig, a7 as PixelBufferConfigSchema, a8 as PixelFramebuffer, a9 as PlaneMeshOptions, aa as PlaneMeshOptionsSchema, ab as ProjectedVertex, ac as RGBAColor, ad as RGBAColorSchema, ae as RendererBackend, af as ScreenCoord, ag as SextantConfig, ah as SextantConfigSchema, ai as SixelConfig, aj as SixelConfigSchema, ak as SphereMeshOptions, al as SphereMeshOptionsSchema, am as Transform3D, an as Transform3DData, ao as TriangleBBox, ap as TriangleVertex, aq as TriangleVertexSchema, ar as Vec3, as as Vec3Input, at as Vec3InputSchema, au as Vec3Schema, av as Viewport3D, aw as Viewport3DData, ax as ViewportConfig, ay as ViewportConfigSchema, az as ViewportOutput, aA as ViewportProjection, aB as animation3DSystem, aC as backendStore, aD as blendPixel, aE as buildMVP, aF as clearBackendStore, aG as clearFramebuffer, aH as clearFramebufferStore, aI as clearMeshStore, aJ as clearMouseInputStore, aK as clearOutputStore, aL as clearProjectionStore, aM as clipLine, aN as computeBoundingBox, aO as computeFaceNormal, aP as computeFlatShading, aQ as computeOutcode, aR as createBackendByType, aS as createBrailleBackend, aT as createCubeMesh, aU as createCylinderMesh, aV as createHalfBlockBackend, aW as createKittyBackend, aX as createMeshFromArrays, aY as createPixelFramebuffer, aZ as createPlaneMesh, a_ as createSextantBackend, a$ as createSixelBackend, b0 as createSphereMesh, b1 as detectBestBackend, b2 as disableMouseInteraction, b3 as drawLine, b4 as drawLineAA, b5 as drawLineColor, b6 as drawLineDepth, b7 as enableMouseInteraction, b8 as extractFrustumPlanes, b9 as feedMouseDrag, ba as feedMouseScroll, bb as fillRect, bc as fillTriangle, bd as fillTriangleFlat, be as framebufferStore, bf as getAnimation3D, bg as getCamera3D, bh as getDepth, bi as getMaterial3D, bj as getMesh, bk as getMeshCount, bl as getMeshData, bm as getMouseInteraction3D, bn as getPixel, bo as getProjMatrix, bp as getTransform3D, bq as getViewMatrix, br as getViewport3D, bs as getWorldMatrix, bt as isDirty, bu as isInBounds, bv as isPointInFrustum, bw as isSphereInFrustum, bx as loadObjAsMesh, by as lookAt, bz as markDirty, bA as mat4Determinant, bB as mat4Equals, bC as mat4FromTRS, bD as mat4Identity, bE as mat4Invert, bF as mat4IsIdentity, bG as mat4Multiply, bH as mat4RotateX, bI as mat4RotateY, bJ as mat4RotateZ, bK as mat4Scale, bL as mat4TransformDirection, bM as mat4TransformVec3, bN as mat4Translate, bO as mat4Transpose, bP as mouseInputStore, bQ as mouseInteraction3DSystem, bR as orthographicMatrix, bS as outputStore, bT as parseObj, bU as perspectiveMatrix, bV as projectVertex, bW as projectionStore, bX as projectionSystem, bY as rasterSystem, bZ as registerMesh, b_ as sceneGraphSystem, b$ as setAnimation3D, c0 as setCamera3D, c1 as setMaterial3D, c2 as setMesh, c3 as setPixel, c4 as setPixelUnsafe, c5 as setRotation, c6 as setScale, c7 as setTransform3D, c8 as setTranslation, c9 as setViewport3D, ca as shadeFace, cb as testAndSetDepth, cc as triangleArea2, cd as triangleBoundingBox, ce as unprojectVertex, cf as unregisterMesh, cg as vec3, ch as vec3Add, ci as vec3Cross, cj as vec3Distance, ck as vec3Dot, cl as vec3Equals, cm as vec3FromArray, cn as vec3Length, co as vec3LengthSq, cp as vec3Lerp, cq as vec3Negate, cr as vec3Normalize, cs as vec3Scale, ct as vec3Sub, cu as vec3Zero, cv as viewportOutputSystem, cw as viewportTransform } from '../index-DBS5Uefn.js';
2
2
  export { A as Animation3DConfig, b as Animation3DConfigSchema, C as Camera3DConfig, c as Camera3DConfigSchema, M as Material3DConfig, d as Material3DConfigSchema, a as MouseInteraction3DConfig, e as MouseInteraction3DConfigSchema, T as Transform3DConfig, f as Transform3DConfigSchema, V as Viewport3DConfig, g as Viewport3DConfigSchema, h as Viewport3DWidgetConfig, i as Viewport3DWidgetConfigSchema } from '../viewport3d-xI33-_wq.js';
3
3
  import 'zod';
4
- import '../types-BcsvoKzf.js';
4
+ import '../types-CPB4CpbH.js';
5
5
  import 'bitecs';
package/dist/3d/index.js CHANGED
@@ -1 +1 @@
1
- export{a as Animation3D,m as CubeMeshOptionsSchema,p as CylinderMeshOptionsSchema,d as MouseInteraction3D,l as ObjLoadOptionsSchema,o as PlaneMeshOptionsSchema,n as SphereMeshOptionsSchema,H as animation3DSystem,K as backendStore,y as blendPixel,M as clearBackendStore,f as clearMouseInputStore,N as clearOutputStore,u as clipLine,r as computeBoundingBox,A as computeFaceNormal,B as computeFlatShading,t as computeOutcode,D as createCubeMesh,G as createCylinderMesh,F as createPlaneMesh,E as createSphereMesh,j as disableMouseInteraction,z as drawLineAA,i as enableMouseInteraction,v as extractFrustumPlanes,g as feedMouseDrag,h as feedMouseScroll,c as getAnimation3D,k as getMouseInteraction3D,w as isPointInFrustum,x as isSphereInFrustum,s as loadObjAsMesh,e as mouseInputStore,I as mouseInteraction3DSystem,L as outputStore,q as parseObj,J as sceneGraphSystem,b as setAnimation3D,C as shadeFace,O as viewportOutputSystem}from'../chunk-VNZ6CWJA.js';export{Xa as AmbientLightSchema,w as Animation3DConfigSchema,b as BackendCapabilitiesSchema,k as BackendPreferenceSchema,e as BackendSelectionSchema,a as BackendTypeSchema,f as BrailleConfigSchema,y as Camera3D,t as Camera3DConfigSchema,ga as ClipRectSchema,Wa as DirectionalLightSchema,c as EncodedCellSchema,d as EncodedOutputSchema,ca as EulerAnglesSchema,g as HalfBlockConfigSchema,j as KittyConfigSchema,Ta as LineEndpointSchema,ba as Mat4Schema,D as Material3D,u as Material3DConfigSchema,G as Mesh,x as MouseInteraction3DConfigSchema,ea as OrthographicConfigSchema,da as PerspectiveConfigSchema,Sa as PixelBufferConfigSchema,Ua as RGBAColorSchema,h as SextantConfigSchema,i as SixelConfigSchema,P as Transform3D,s as Transform3DConfigSchema,Va as TriangleVertexSchema,aa as Vec3InputSchema,$ as Vec3Schema,Y as Viewport3D,v as Viewport3DConfigSchema,mb as Viewport3DWidgetConfigSchema,fa as ViewportConfigSchema,Ra as buildMVP,Za as clearFramebuffer,rb as clearFramebufferStore,O as clearMeshStore,ob as clearProjectionStore,q as createBackendByType,l as createBrailleBackend,m as createHalfBlockBackend,n as createKittyBackend,I as createMeshFromArrays,Ya as createPixelFramebuffer,o as createSextantBackend,p as createSixelBackend,r as detectBestBackend,fb as drawLine,hb as drawLineColor,gb as drawLineDepth,eb as fillRect,kb as fillTriangle,lb as fillTriangleFlat,qb as framebufferStore,A as getCamera3D,cb as getDepth,F as getMaterial3D,M as getMesh,N as getMeshCount,J as getMeshData,$a as getPixel,B as getProjMatrix,R as getTransform3D,C as getViewMatrix,_ as getViewport3D,V as getWorldMatrix,X as isDirty,_a as isInBounds,Na as lookAt,W as markDirty,Ea as mat4Determinant,Ka as mat4Equals,Ia as mat4FromTRS,wa as mat4Identity,Fa as mat4Invert,Ja as mat4IsIdentity,xa as mat4Multiply,za as mat4RotateX,Aa as mat4RotateY,Ba as mat4RotateZ,Ca as mat4Scale,Ha as mat4TransformDirection,Ga as mat4TransformVec3,ya as mat4Translate,Da as mat4Transpose,Ma as orthographicMatrix,La as perspectiveMatrix,Pa as projectVertex,nb as projectionStore,pb as projectionSystem,sb as rasterSystem,H as registerMesh,z as setCamera3D,E as setMaterial3D,L as setMesh,ab as setPixel,bb as setPixelUnsafe,T as setRotation,U as setScale,Q as setTransform3D,S as setTranslation,Z as setViewport3D,db as testAndSetDepth,ib as triangleArea2,jb as triangleBoundingBox,Qa as unprojectVertex,K as unregisterMesh,ha as vec3,ja as vec3Add,na as vec3Cross,ta as vec3Distance,ma as vec3Dot,ua as vec3Equals,ia as vec3FromArray,pa as vec3Length,oa as vec3LengthSq,ra as vec3Lerp,sa as vec3Negate,qa as vec3Normalize,la as vec3Scale,ka as vec3Sub,va as vec3Zero,Oa as viewportTransform}from'../chunk-LYSK5S63.js';import'../chunk-H2YAOJDW.js';import'../chunk-G7GIWWLE.js';import'../chunk-PXXGH3BV.js';import'../chunk-5PELJRUQ.js';
1
+ export{a as Animation3D,m as CubeMeshOptionsSchema,p as CylinderMeshOptionsSchema,d as MouseInteraction3D,l as ObjLoadOptionsSchema,o as PlaneMeshOptionsSchema,n as SphereMeshOptionsSchema,H as animation3DSystem,K as backendStore,y as blendPixel,M as clearBackendStore,f as clearMouseInputStore,N as clearOutputStore,u as clipLine,r as computeBoundingBox,A as computeFaceNormal,B as computeFlatShading,t as computeOutcode,D as createCubeMesh,G as createCylinderMesh,F as createPlaneMesh,E as createSphereMesh,j as disableMouseInteraction,z as drawLineAA,i as enableMouseInteraction,v as extractFrustumPlanes,g as feedMouseDrag,h as feedMouseScroll,c as getAnimation3D,k as getMouseInteraction3D,w as isPointInFrustum,x as isSphereInFrustum,s as loadObjAsMesh,e as mouseInputStore,I as mouseInteraction3DSystem,L as outputStore,q as parseObj,J as sceneGraphSystem,b as setAnimation3D,C as shadeFace,O as viewportOutputSystem}from'../chunk-QQMUDJ32.js';export{Xa as AmbientLightSchema,w as Animation3DConfigSchema,b as BackendCapabilitiesSchema,k as BackendPreferenceSchema,e as BackendSelectionSchema,a as BackendTypeSchema,f as BrailleConfigSchema,y as Camera3D,t as Camera3DConfigSchema,ga as ClipRectSchema,Wa as DirectionalLightSchema,c as EncodedCellSchema,d as EncodedOutputSchema,ca as EulerAnglesSchema,g as HalfBlockConfigSchema,j as KittyConfigSchema,Ta as LineEndpointSchema,ba as Mat4Schema,D as Material3D,u as Material3DConfigSchema,G as Mesh,x as MouseInteraction3DConfigSchema,ea as OrthographicConfigSchema,da as PerspectiveConfigSchema,Sa as PixelBufferConfigSchema,Ua as RGBAColorSchema,h as SextantConfigSchema,i as SixelConfigSchema,P as Transform3D,s as Transform3DConfigSchema,Va as TriangleVertexSchema,aa as Vec3InputSchema,$ as Vec3Schema,Y as Viewport3D,v as Viewport3DConfigSchema,mb as Viewport3DWidgetConfigSchema,fa as ViewportConfigSchema,Ra as buildMVP,Za as clearFramebuffer,rb as clearFramebufferStore,O as clearMeshStore,ob as clearProjectionStore,q as createBackendByType,l as createBrailleBackend,m as createHalfBlockBackend,n as createKittyBackend,I as createMeshFromArrays,Ya as createPixelFramebuffer,o as createSextantBackend,p as createSixelBackend,r as detectBestBackend,fb as drawLine,hb as drawLineColor,gb as drawLineDepth,eb as fillRect,kb as fillTriangle,lb as fillTriangleFlat,qb as framebufferStore,A as getCamera3D,cb as getDepth,F as getMaterial3D,M as getMesh,N as getMeshCount,J as getMeshData,$a as getPixel,B as getProjMatrix,R as getTransform3D,C as getViewMatrix,_ as getViewport3D,V as getWorldMatrix,X as isDirty,_a as isInBounds,Na as lookAt,W as markDirty,Ea as mat4Determinant,Ka as mat4Equals,Ia as mat4FromTRS,wa as mat4Identity,Fa as mat4Invert,Ja as mat4IsIdentity,xa as mat4Multiply,za as mat4RotateX,Aa as mat4RotateY,Ba as mat4RotateZ,Ca as mat4Scale,Ha as mat4TransformDirection,Ga as mat4TransformVec3,ya as mat4Translate,Da as mat4Transpose,Ma as orthographicMatrix,La as perspectiveMatrix,Pa as projectVertex,nb as projectionStore,pb as projectionSystem,sb as rasterSystem,H as registerMesh,z as setCamera3D,E as setMaterial3D,L as setMesh,ab as setPixel,bb as setPixelUnsafe,T as setRotation,U as setScale,Q as setTransform3D,S as setTranslation,Z as setViewport3D,db as testAndSetDepth,ib as triangleArea2,jb as triangleBoundingBox,Qa as unprojectVertex,K as unregisterMesh,ha as vec3,ja as vec3Add,na as vec3Cross,ta as vec3Distance,ma as vec3Dot,ua as vec3Equals,ia as vec3FromArray,pa as vec3Length,oa as vec3LengthSq,ra as vec3Lerp,sa as vec3Negate,qa as vec3Normalize,la as vec3Scale,ka as vec3Sub,va as vec3Zero,Oa as viewportTransform}from'../chunk-4PRDJTCM.js';import'../chunk-NPNUUSIB.js';import'../chunk-DMBMCCLN.js';import'../chunk-5N3O25O7.js';import'../chunk-GJ3RS2VG.js';import'../chunk-Z4EZERNE.js';import'../chunk-P3ZLIQJP.js';import'../chunk-5PELJRUQ.js';
@@ -1,5 +1,5 @@
1
- import { b as EventMap, E as EventBus } from '../events-BbbxkgvX.js';
2
- import { U as Unsubscribe } from '../types-BcsvoKzf.js';
1
+ import { c as EventMap, a as EventBus } from '../events-9ForpTfM.js';
2
+ import { U as Unsubscribe } from '../types-CPB4CpbH.js';
3
3
  import 'bitecs';
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { W as World, E as Entity } from './types-BcsvoKzf.js';
1
+ import { W as World, E as Entity } from './types-CPB4CpbH.js';
2
2
 
3
3
  /**
4
4
  * Border component for element borders.
@@ -49,6 +49,16 @@ declare const BORDER_BOLD: BorderCharset;
49
49
  * ASCII border characters (- | + + + +).
50
50
  */
51
51
  declare const BORDER_ASCII: BorderCharset;
52
+ /**
53
+ * Dashed border characters (┄ ┆ + + + +).
54
+ * Uses light dashed lines with simple corners.
55
+ */
56
+ declare const BORDER_DASHED: BorderCharset;
57
+ /**
58
+ * Heavy dashed border characters (┅ ┇ + + + +).
59
+ * Uses heavy dashed lines with simple corners.
60
+ */
61
+ declare const BORDER_DASHED_HEAVY: BorderCharset;
52
62
  /**
53
63
  * Default foreground color for borders (white).
54
64
  */
@@ -109,21 +119,21 @@ declare const Border: {
109
119
  */
110
120
  interface BorderOptions {
111
121
  /** Border type */
112
- type?: BorderType;
122
+ type?: BorderType | undefined;
113
123
  /** Enable left side */
114
- left?: boolean;
124
+ left?: boolean | undefined;
115
125
  /** Enable top side */
116
- top?: boolean;
126
+ top?: boolean | undefined;
117
127
  /** Enable right side */
118
- right?: boolean;
128
+ right?: boolean | undefined;
119
129
  /** Enable bottom side */
120
- bottom?: boolean;
130
+ bottom?: boolean | undefined;
121
131
  /** Foreground color (hex string or packed number) */
122
- fg?: string | number;
132
+ fg?: string | number | undefined;
123
133
  /** Background color (hex string or packed number) */
124
- bg?: string | number;
134
+ bg?: string | number | undefined;
125
135
  /** Preset border charset or custom characters */
126
- chars?: BorderCharset;
136
+ chars?: BorderCharset | undefined;
127
137
  }
128
138
  /**
129
139
  * Border data returned by getBorder.
@@ -254,4 +264,4 @@ declare function disableAllBorders(world: World, eid: Entity): Entity;
254
264
  */
255
265
  declare function getBorderChar(world: World, eid: Entity, position: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'horizontal' | 'vertical'): number | undefined;
256
266
 
257
- export { BORDER_ASCII as B, DEFAULT_BORDER_BG as D, BORDER_BOLD as a, BORDER_DOUBLE as b, BORDER_ROUNDED as c, BORDER_SINGLE as d, Border as e, type BorderCharset as f, type BorderData as g, type BorderOptions as h, BorderType as i, DEFAULT_BORDER_FG as j, disableAllBorders as k, enableAllBorders as l, getBorder as m, getBorderChar as n, hasBorder as o, hasBorderVisible as p, setBorderChars as q, setBorder as s };
267
+ export { type BorderCharset as B, DEFAULT_BORDER_BG as D, BORDER_ASCII as a, BORDER_BOLD as b, BORDER_DASHED as c, BORDER_DASHED_HEAVY as d, BORDER_DOUBLE as e, BORDER_ROUNDED as f, BORDER_SINGLE as g, Border as h, type BorderData as i, type BorderOptions as j, BorderType as k, DEFAULT_BORDER_FG as l, disableAllBorders as m, enableAllBorders as n, getBorder as o, getBorderChar as p, hasBorder as q, hasBorderVisible as r, setBorder as s, setBorderChars as t };
@@ -0,0 +1,3 @@
1
+ import {b,e as e$2,d as d$1,f as f$3,g}from'./chunk-DNRXW56C.js';import {e}from'./chunk-735KKTP3.js';import {d,f as f$1,i,h}from'./chunk-APKUNIMB.js';import {oa,s,q as q$1,U as U$1,Z as Z$1,ra,f as f$2,i as i$1,la}from'./chunk-GJ3RS2VG.js';import {n,t,e as e$1,s as s$1}from'./chunk-P3ZLIQJP.js';import {readFileSync}from'fs';import {z}from'zod';n();t();var N=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.literal("auto")]),f=z.union([z.number(),z.string().regex(/^\d+(\.\d+)?%$/,'Percentage must be in format "50%"'),z.enum(["center","left","right","top","bottom"])]),J=z.object({left:f.optional(),top:f.optional(),right:f.optional(),bottom:f.optional(),width:N.optional(),height:N.optional(),fg:z.union([z.string(),z.number()]).optional(),bg:z.union([z.string(),z.number()]).optional(),text:z.string(),font:z.union([z.string(),b]).optional(),shrink:z.boolean().optional()}),Y=1e4,c={isBigText:new Uint8Array(Y)},U="terminus-14-bold",T=new Map,a=new Map;function _(t){if(t===void 0)return 0;if(typeof t=="number")return t;switch(t){case "left":case "top":return 0;case "center":return 0;case "right":case "bottom":return 0}return 0}function M(t){return t===void 0||typeof t=="string"&&t==="auto"?"auto":t}async function j(t){return t?typeof t!="string"?t:t==="terminus-14-bold"||t==="terminus-14-normal"?d$1(t):H(t):d$1(U)}function q(t){return t?typeof t!="string"?t:t==="terminus-14-bold"||t==="terminus-14-normal"?e$2(t):T.get(t):e$2(U)}function K(t,i){let n=" ".repeat(t);return Array.from({length:i},()=>n)}function Q(t,i){let n=t.charHeight,r=Array.from({length:n},()=>"");for(let e of Array.from(i)){let u=f$3(t,e)?g(t,e):K(t.charWidth,t.charHeight);for(let g=0;g<n;g+=1){let O=u[g]??"";r[g]=`${r[g]}${O}`;}}return r}function B(t,i){let n=i.split(`
2
+ `),r=[];for(let e of n)r.push(...Q(t,e));return r.join(`
3
+ `)}function H(t){let i=T.get(t);if(i)return i;let n=readFileSync(t,"utf8"),r=JSON.parse(n),e=b.parse(r);return T.set(t,e),e}var ft=H;function R(t,i,n){let r=_(n.left),e=_(n.top);U$1(t,i,r,e);let s=M(n.width),u=M(n.height);f$2(t,i,s,u);let g=n.shrink!==false;i$1(t,i,g);}function X(t,i,n){n.fg===void 0&&n.bg===void 0||la(t,i,{fg:n.fg!==void 0?s$1(n.fg):void 0,bg:n.bg!==void 0?s$1(n.bg):void 0});}async function Z(t,i,n){let r=await j(n.font),e$1=B(r,n.text);a.set(i,n.text),e(t,i,e$1);}async function ct(t,i$1,n){let r=J.parse(n),e=i$1;c.isBigText[e]=1,R(t,e,r),X(t,e,r),await Z(t,e,r),d(t,e,{focusable:true});let s$1={eid:e,show(){return ra(t,e,true),s$1},hide(){return ra(t,e,false),s$1},move(u,g){return Z$1(t,e,u,g),oa(t,e),s$1},setPosition(u,g){return U$1(t,e,u,g),oa(t,e),s$1},setText(u){return tt(t,e,u,r.font),s$1},getText(){return a.get(e)??""},focus(){return h(t,e),s$1},blur(){return i(t,e),s$1},isFocused(){return f$1(t,e)},append(u){return q$1(t,e,u),s$1},getChildren(){return s(t,e)},destroy(){c.isBigText[e]=0,a.delete(e),e$1(t,e);}};return s$1}function w(t,i,n,r){let e$1=q(r);if(e$1){let s=B(e$1,n);a.set(i,n),e(t,i,s),oa(t,i);return}j(r).then(s=>{let u=B(s,n);a.set(i,n),e(t,i,u),oa(t,i);});}function tt(t,i,n,r){return w(t,i,n,r),i}function pt(t,i){return c.isBigText[i]===1}function lt(){c.isBigText.fill(0),a.clear();}export{J as a,c as b,H as c,ft as d,ct as e,w as f,pt as g,lt as h};
@@ -0,0 +1 @@
1
+ import {b,d as d$2}from'./chunk-4LWWONFK.js';import {c,a as a$1}from'./chunk-FNQRUMFD.js';import {d as d$1,A,i,B as B$1}from'./chunk-TSARUU56.js';import {a,e,r,o,t}from'./chunk-C5PCEQ6G.js';import {k as k$2}from'./chunk-VOCM5T2G.js';import {u,p as p$1,k as k$1}from'./chunk-ZPGJCHXH.js';import {T,ka,xa,pa,ma}from'./chunk-GJ3RS2VG.js';import {n,k,i as i$1}from'./chunk-P3ZLIQJP.js';import {z}from'zod';u();n();var d=z.number().int().min(0).max(4294967295),J=z.number().int().min(0).max(65535),ne=z.object({fg:d.optional(),bg:d.optional(),selectedFg:d.optional(),selectedBg:d.optional(),cursorFg:d.optional(),cursorBg:d.optional(),showLineNumbers:z.boolean().optional(),lineNumberWidth:z.number().int().nonnegative().max(20).optional(),attrs:J.optional()}),Re=z.object({fg:d.default(4294967295),bg:d.default(255),selectedFg:d.default(255),selectedBg:d.default(4294967295),cursorFg:d.default(255),cursorBg:d.default(16711935),showLineNumbers:z.boolean().default(false),lineNumberWidth:z.number().int().nonnegative().max(20).default(0),attrs:J.default(a.NONE)}),Q={fg:4294967295,bg:255,selectedFg:255,selectedBg:4294967295,cursorFg:255,cursorBg:16711935,showLineNumbers:false,lineNumberWidth:0,attrs:a.NONE},p=null,L=new Map,B=new Map;function Ne(t){p=t;}function Se(){return p}function Ve(){p=null;}function ve(t,e){L.set(t,e);}function we(t){return L.get(t)}function De(t){L.delete(t);}function ze(t,e){L.set(t,e);}function We(t,e){let r=ne.parse(e),f={};for(let[n,o]of Object.entries(r))o!==void 0&&(f[n]=o);let i=B.get(t)??Q;B.set(t,{...i,...f});}function re(t){return B.get(t)??Q}function Fe(t){B.delete(t);}function ie(t,e){if(!i$1(t,e,ka))return a.NONE;let r=a.NONE;return ka.bold[e]===1&&(r|=a.BOLD),ka.underline[e]===1&&(r|=a.UNDERLINE),ka.blink[e]===1&&(r|=a.BLINK),ka.inverse[e]===1&&(r|=a.INVERSE),r}function oe(t,e){if(c(t,e))return {x:a$1.x[e],y:a$1.y[e],width:a$1.width[e],height:a$1.height[e]}}function fe(t,e){return p$1(t,e)?{top:k$1.top[e]===1?1:0,right:k$1.right[e]===1?1:0,bottom:k$1.bottom[e]===1?1:0,left:k$1.left[e]===1?1:0}:{top:0,right:0,bottom:0,left:0}}function ue(t,e){return {x:t.x+e.left,y:t.y+e.top,width:Math.max(0,t.width-e.left-e.right),height:Math.max(0,t.height-e.top-e.bottom)}}function M(t$1,e$1,r,f,i,n,o$1,u){let m=e(" ",n,o$1,u);for(let l=0;l<f;l++)o(t$1,e$1+l,r,m);let a=i.length>f?i.slice(0,f):i;a.length>0&&t(t$1,e$1,r,a,n,o$1,u);}function le(t$1,e,r,f,i,n,o){let u=`${String(i+1).padStart(f-1," ")} `;t(t$1,e,r,u.slice(0,f),n,o,a.DIM);}function ae(t,e,r,f,i,n){let{buffer:o}=t,{x:u,y:m,width:a$1,height:l}=r,x=k$2(i,f.start,f.end),S=n.showLineNumbers?u+n.lineNumberWidth:u,V=n.showLineNumbers?Math.max(0,a$1-n.lineNumberWidth):a$1,b=d$1.selectedLine[e],v=d$1.cursorLine[e];for(let c=0;c<x.lines.length;c++){let E=m+c;if(c>=l)break;let D=x.startLine+c,Z=x.lines[c]??"",z=n.fg,W=n.bg;D===v?(z=n.cursorFg,W=n.cursorBg):D===b&&(z=n.selectedFg,W=n.selectedBg),n.showLineNumbers&&le(o,u,E,n.lineNumberWidth,D,n.fg,n.bg),M(o,S,E,V,Z,z,W,n.attrs);}let T=Math.min(x.lines.length,l);for(let c=T;c<l;c++){let E=m+c;n.showLineNumbers&&M(o,u,E,n.lineNumberWidth,"",n.fg,n.bg,a.NONE),M(o,S,E,V,"",n.fg,n.bg,a.NONE);}}function se(t,e$1,r,f,i){if(r<=i)return;let{buffer:n}=t,o$1=e$1.height,u=e$1.x+e$1.width-1,m=e$1.y,a=i/r,l=Math.max(1,Math.floor(o$1*a)),x=Math.floor(f/r*o$1),S=e("\u2502",1717987071,255);for(let b=0;b<o$1;b++)o(n,u,m+b,S);let V=e("\u2588",2863311615,255);for(let b=0;b<l;b++){let v=m+x+b;v<m+o$1&&o(n,u,v,V);}}function de(t,e$1,r$1){let{world:f,buffer:i}=t,n=ma(f,e$1);if(!n||n.transparent)return;let o=ie(f,e$1),u=e(" ",n.fg,n.bg,o);r(i,r$1.x,r$1.y,r$1.width,r$1.height,u);}function me(t,e){let{world:r,doubleBuffer:f}=t,i$1=oe(r,e);if(!i$1||i$1.width<=0||i$1.height<=0)return;let n=L.get(e);if(!n)return;let o=i(r,e);if(!o)return;let u=re(e);de(t,e,i$1);let m=fe(r,e),a=ue(i$1,m);a.width>0&&a.height>0&&ae(t,e,a,o,n,u);let l={firstVisibleLine:d$1.firstVisibleLine[e],visibleLineCount:d$1.visibleLineCount[e],totalLineCount:d$1.totalLineCount[e]};l.totalLineCount>l.visibleLineCount&&se(t,a,l.totalLineCount,l.firstVisibleLine,l.visibleLineCount),d$2(f,i$1.x,i$1.y,i$1.width,i$1.height),B$1(r,e),pa(r,e);}var ce=t=>{if(!p)return t;let e=b(p),r={world:t,buffer:e,doubleBuffer:p},f=k(t,[d$1,T,ka]);for(let i of f)xa(t,i)&&(!A(t,i)&&ka.dirty[i]!==1||me(r,i));return t};function Me(){return ce}function Oe(){p=null,L.clear(),B.clear();}function ke(t){L.delete(t),B.delete(t);}export{Re as a,Ne as b,Se as c,Ve as d,ve as e,we as f,De as g,ze as h,We as i,re as j,Fe as k,ce as l,Me as m,Oe as n,ke as o};
@@ -0,0 +1,4 @@
1
+ import {f as f$2,e as e$1}from'./chunk-AEJIX2MW.js';import {e,f as f$4,k as k$2,c as c$1,b as b$1}from'./chunk-C5PCEQ6G.js';import {f as f$3,e as e$2,g as g$1,j}from'./chunk-JHCKPCUH.js';import {m}from'./chunk-RJULLVTH.js';import {b,k as k$1,d as d$1,f as f$1}from'./chunk-DSKQ5J4R.js';import {oa}from'./chunk-GJ3RS2VG.js';import {q as q$1,p as p$1}from'./chunk-Z4EZERNE.js';import {n,i as i$1,h as h$1}from'./chunk-P3ZLIQJP.js';import {z as z$1}from'zod';n();var Nt=1e4,h={role:new Uint8Array(Nt),labelId:new Uint32Array(Nt)},fe={button:1,checkbox:2,list:3,listitem:4,textbox:5,dialog:6,menu:7,menuitem:8,tree:9,treeitem:10},me={1:"button",2:"checkbox",3:"list",4:"listitem",5:"textbox",6:"dialog",7:"menu",8:"menuitem",9:"tree",10:"treeitem"},rt=new Map,Ot=1;function _n(e,t,r){i$1(e,t,h)||(h$1(e,t,h),h.labelId[t]=0),h.role[t]=fe[r];}function kn(e,t){if(!i$1(e,t,h))return;let r=h.role[t];if(!(r===void 0||r===0))return me[r]}function Mn(e,t,r){i$1(e,t,h)||(h$1(e,t,h),h.role[t]=0);let n=h.labelId[t];if(n&&n>0)rt.set(n,r);else {let o=Ot++;rt.set(o,r),h.labelId[t]=o;}}function Rn(e,t){if(!i$1(e,t,h))return;let r=h.labelId[t];if(!(r===void 0||r===0))return rt.get(r)}function Un(e){if(typeof process<"u"&&process.stdout){let t=e.replace(/[\x00-\x1F\x7F]/g,"");process.stdout.write(`\x1B]2;${t}\x07`);}}function Xn(){rt.clear(),Ot=1;}var mt="> ",bt=" ",pt=4294967295,dt=6750207,gt=3435973887,yt=255,xt=1717987071;var Gt="Loading...";var c={isList:new Uint8Array(1e4),selectedIndex:new Int32Array(1e4).fill(-1),itemCount:new Uint32Array(1e4),firstVisible:new Uint32Array(1e4),visibleCount:new Uint32Array(1e4),interactive:new Uint8Array(1e4),mouse:new Uint8Array(1e4),keys:new Uint8Array(1e4),searchEnabled:new Uint8Array(1e4),totalCount:new Uint32Array(1e4),isLoading:new Uint8Array(1e4)},d=m({iterable:true}),X=new Map,H=new Map,Z=new Map,V=new Map,D=new Map,B=new Map,A=new Map,P=new Map,_=new Map,J=new Map,I=new Map,z=new Map,Y=new Map;function k(e){return d.get(e)??[]}function be(e,t,r){d.set(t,[...r]),c.itemCount[t]=r.length,(c.selectedIndex[t]??-1)>=r.length&&(c.selectedIndex[t]=r.length>0?r.length-1:-1),(c.firstVisible[t]??0)>=r.length&&(c.firstVisible[t]=Math.max(0,r.length-1)),oa(e,t);}function pe(e,t,r,n){let o=d.get(t)??[],l=n??o.length;o.splice(l,0,r),d.set(t,o),c.itemCount[t]=o.length;let s=c.selectedIndex[t]??-1;s>=0&&l<=s&&(c.selectedIndex[t]=s+1),oa(e,t);}function de(e,t,r){let n=d.get(t)??[];if(r<0||r>=n.length)return;let o=n.splice(r,1)[0];c.itemCount[t]=n.length;let l=c.selectedIndex[t]??-1;return l>=0&&(r<l?c.selectedIndex[t]=l-1:r===l&&(c.selectedIndex[t]=n.length>0?Math.min(r,n.length-1):-1)),oa(e,t),o}function w(e,t){return d.get(e)?.[t]}function ge(e,t,r,n){let o=d.get(t);return !o||r<0||r>=o.length?false:(o[r]=n,oa(e,t),true)}function ye(e){return c.itemCount[e]??0}function xe(e,t){d.set(t,[]),c.itemCount[t]=0,c.selectedIndex[t]=-1,c.firstVisible[t]=0,oa(e,t);}function he(e){return c.firstVisible[e]??0}function Ee(e,t){let r=H.get(e);if(!r||r.size===0)return;let n=c.firstVisible[e]??0,o=c.visibleCount[e]??0,l=c.itemCount[e]??0,s=c.totalCount[e]??l,a=o,m={firstVisible:n,visibleCount:o,loadedCount:l,totalCount:s,nearEnd:n+o>=l-a,nearStart:n<=a};for(let b of r)b(m);}function nt(e,t,r){let n=c.itemCount[t]??0,o=c.totalCount[t]??n,l=Math.max(0,Math.max(n,o)-1),s=Math.max(0,Math.min(r,l));c.firstVisible[t]=s,oa(e,t),Ee(t);}function Ce(e){return c.visibleCount[e]??0}function Le(e,t,r){c.visibleCount[t]=Math.max(1,r),oa(e,t);}function Ct(e,t,r){if(r<0)return;let n=c.firstVisible[t]??0,o=c.visibleCount[t]??0,l=n+o-1;r<n?nt(e,t,r):r>l&&nt(e,t,r-o+1);}var ht=null;function Ht(e){ht=e;}function Se(e,t,r){let n=c.firstVisible[t]??0,o=c.visibleCount[t]??0,l=c.itemCount[t]??0,s=n+r*o;if(s<0||s>=l)return false;nt(e,t,s);let a=c.selectedIndex[t]??-1;if(a>=0&&ht){let m=a+r*o;ht(e,t,Math.max(0,Math.min(m,l-1)));}return true}function Lt(e){let t=d.get(e)??[],r=c.firstVisible[e]??0,n=c.visibleCount[e]??t.length,o=[];for(let l=0;l<n&&r+l<t.length;l++){let s=r+l,a=t[s];a&&o.push({index:s,item:a});}return o}function ve(e,t,r){c.totalCount[t]=r,oa(e,t);}function zt(e){let t=c.totalCount[e]??0;return t===0?c.itemCount[e]??0:t}function Te(e,t){X.set(e,t);}function Ae(e){return X.get(e)}function Ie(e){X.delete(e);}function we(e,t){let r=H.get(e);return r||(r=new Set,H.set(e,r)),r.add(t),()=>{r?.delete(t);}}function Et(e,t,r){c.isLoading[t]=r?1:0,oa(e,t);}function We(e){return c.isLoading[e]===1}function Fe(e,t){Z.set(e,t);}function De(e){return Z.get(e)??Gt}async function Be(e,t,r,n){let o=X.get(t);if(o&&c.isLoading[t]!==1){Et(e,t,true);try{let l=await o(r,n),s=d.get(t)??[];for(;s.length<r+l.length;)s.push({text:"",disabled:!0});for(let a=0;a<l.length;a++){let m=l[a];m&&(s[r+a]=m);}d.set(t,s),c.itemCount[t]=s.length,oa(e,t);}finally{Et(e,t,false);}}}function _e(e){let t=c.firstVisible[e]??0,r=c.visibleCount[e]??0,n=c.totalCount[e]??0,o=d.get(e)??[],l=Math.min(t+r,n);for(let s=t;s<l;s++){let a=o[s];if(!a||a.text==="")return {needsLoad:true,startIndex:t,count:r}}return {needsLoad:false,startIndex:0,count:0}}function ke(e,t){let r=c.firstVisible[e]??0,n=c.visibleCount[e]??0,o=c.itemCount[e]??0,l=zt(e),s=t??n;return {firstVisible:r,visibleCount:n,loadedCount:o,totalCount:l,nearEnd:r+n>=o-s,nearStart:r<=s}}function Me(e,t,r){let n=d.get(t)??[];n.push(...r),d.set(t,n),c.itemCount[t]=n.length,oa(e,t);}function Re(e){return c.selectedIndex[e]??-1}function Ue(e){let t=c.selectedIndex[e]??-1;if(!(t<0))return w(e,t)}function Xe(e,t,r){return t<-1||t>=r?false:t<0?true:!w(e,t)?.disabled}function Ve(e,t){if(t<0)return;let r=w(e,t);if(!r)return;let n=D.get(e);if(n)for(let o of n)o(t,r);}function E(e,t,r){let n=c.itemCount[t]??0,o=c.selectedIndex[t]??-1;return !Xe(t,r,n)||o===r?false:(c.selectedIndex[t]=r,oa(e,t),Ve(t,r),Ct(e,t,r),true)}function Pe(e,t,r=true){let n=c.itemCount[t]??0;if(n===0)return false;let o=c.selectedIndex[t]??-1,l=o;do{if(o--,o<0)if(r)o=n-1;else return false;if(!w(t,o)?.disabled)return E(e,t,o)}while(o!==l);return false}function Ye(e,t,r=true){let n=c.itemCount[t]??0;if(n===0)return false;let o=c.selectedIndex[t]??-1,l=o;do{if(o++,o>=n)if(r)o=0;else return false;if(!w(t,o)?.disabled)return E(e,t,o)}while(o!==l);return false}function Ne(e,t){let r=c.itemCount[t]??0;for(let n=0;n<r;n++)if(!w(t,n)?.disabled)return E(e,t,n);return false}function Oe(e,t){let r=c.itemCount[t]??0;for(let n=r-1;n>=0;n--)if(!w(t,n)?.disabled)return E(e,t,n);return false}function Ge(e,t,r){let o=(d.get(t)??[]).findIndex(l=>l.value===r);return o>=0?E(e,t,o):false}function He(e,t){E(e,t,-1);}function ze(e,t){let r=c.selectedIndex[t]??-1;if(r<0)return false;let n=w(t,r);if(!n||n.disabled)return false;let o=B.get(t);if(o)for(let l of o)l(r,n);return true}function Qe(e,t){let r=D.get(e)??[];return r.push(t),D.set(e,r),()=>{let n=D.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function Ke(e,t){let r=B.get(e)??[];return r.push(t),B.set(e,r),()=>{let n=B.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function $e(e,t){let r=_.get(e)??[];return r.push(t),_.set(e,r),()=>{let n=_.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function je(e){let t=_.get(e);if(t)for(let r of t)r();}function Ze(e){D.delete(e),B.delete(e),_.delete(e);}var St={initial:"idle",states:{idle:{on:{focus:"focused",disable:"disabled"}},focused:{on:{blur:"idle",startSelect:"selecting",startSearch:"searching",disable:"disabled"}},selecting:{on:{endSelect:"focused",blur:"idle",disable:"disabled"}},searching:{on:{endSearch:"focused",blur:"idle",disable:"disabled"}},disabled:{on:{enable:"idle"}}}};function qe(e,t,r=[],n={}){z$1.array(q$1).parse(r),p$1.parse(n),c.isList[t]=1,c.selectedIndex[t]=n.selectedIndex??-1,c.itemCount[t]=r.length,c.firstVisible[t]=0,c.visibleCount[t]=n.visibleCount??r.length,c.interactive[t]=n.interactive!==false?1:0,c.mouse[t]=n.mouse!==false?1:0,c.keys[t]=n.keys!==false?1:0,c.searchEnabled[t]=n.search===true?1:0,d.set(t,[...r]),b(e,t,St);}function N(e,t){return c.isList[t]===1&&k$1(e,t)}function vt(e,t){return d$1(e,t)??"idle"}function ot(e,t,r){return vt(e,t)===r}function tr(e,t){let r=vt(e,t);return r==="focused"||r==="selecting"}function Tt(e,t){return ot(e,t,"disabled")}function M(e,t,r){if(!N(e,t))return false;let n=f$1(e,t,r);return n&&oa(e,t),n}function er(e,t){return M(e,t,"focus")}function rr(e,t){return M(e,t,"blur")}function nr(e,t){return M(e,t,"disable")}function or(e,t){return M(e,t,"enable")}function lr(e,t){let r=V.get(e);V.set(e,{selectedPrefix:t.selectedPrefix??r?.selectedPrefix??"> ",unselectedPrefix:t.unselectedPrefix??r?.unselectedPrefix??" ",selectedFg:t.selectedFg??r?.selectedFg??4294967295,selectedBg:t.selectedBg??r?.selectedBg??6750207,itemFg:t.itemFg??r?.itemFg??3435973887,itemBg:t.itemBg??r?.itemBg??255,disabledFg:t.disabledFg??r?.disabledFg??1717987071});}function At(e){return V.get(e)??{selectedPrefix:"> ",unselectedPrefix:" ",selectedFg:4294967295,selectedBg:6750207,itemFg:3435973887,itemBg:255,disabledFg:1717987071}}function sr(e){V.delete(e);}function ir(e,t,r){let n=r.toLowerCase();z.set(t,n);let o=k(t),l=n===""?[...o]:o.filter(s=>s.text.toLowerCase().includes(n));Y.set(t,l),l.length>0?c.selectedIndex[t]=0:c.selectedIndex[t]=-1,c.firstVisible[t]=0,oa(e,t);}function cr(e,t){z.delete(t),Y.delete(t),c.firstVisible[t]=0,k(t).length>0&&(c.selectedIndex[t]=0),oa(e,t);}function ar(e){let t=z.get(e);if(t===void 0||t==="")return k(e);let r=Y.get(e);if(r)return r;let o=k(e).filter(l=>l.text.toLowerCase().includes(t.toLowerCase()));return Y.set(e,o),o}function ur(e,t){J.set(e,t),t&&!I.has(e)&&I.set(e,new Set);}function R(e){return J.get(e)??false}function fr(e,t){if(!R(e))throw new Error("Multi-select is not enabled for this list");let r=I.get(e);return r?r.has(t)?(r.delete(t),false):(r.add(t),true):false}function mr(e){if(!R(e))throw new Error("Multi-select is not enabled for this list");let t=I.get(e);return t?Array.from(t).sort((r,n)=>r-n):[]}function br(e){if(!R(e))return;let t=k(e),r=I.get(e);if(r){r.clear();for(let n=0;n<t.length;n++)r.add(n);}}function pr(e){if(!R(e))return;let t=I.get(e);t&&t.clear();}function dr(e,t){return R(e)?I.get(e)?.has(t)??false:false}function gr(e){return c.interactive[e]===1}function yr(e,t,r){c.interactive[t]=r?1:0,oa(e,t);}function xr(e){return c.mouse[e]===1}function hr(e,t,r){c.mouse[t]=r?1:0,oa(e,t);}function It(e){return c.keys[e]===1}function Er(e,t,r){c.keys[t]=r?1:0,oa(e,t);}function Qt(e){return c.searchEnabled[e]===1}function Cr(e,t,r){c.searchEnabled[t]=r?1:0,oa(e,t);}function wt(e,t){return ot(e,t,"searching")}function Lr(e,t){if(!N(e,t)||!Qt(t))return false;let r=M(e,t,"startSearch");return r&&A.set(t,""),r}function Sr(e,t){if(!N(e,t))return false;let r=M(e,t,"endSearch");return r&&A.delete(t),r}function vr(e){return A.get(e)??""}function lt(e,t,r){A.set(t,r),oa(e,t);let n=P.get(t);if(n)for(let o of n)o(r);return r.length>0?Kt(e,t,r):false}function Tr(e,t,r){let n=A.get(t)??"";return lt(e,t,n+r)}function Ar(e,t){let r=A.get(t)??"";return r.length===0?false:lt(e,t,r.slice(0,-1))}function Ir(e,t){lt(e,t,"");}function Kt(e,t,r){let n=d.get(t)??[],o=r.toLowerCase();for(let l=0;l<n.length;l++){let s=n[l];if(s&&!s.disabled&&s.text.toLowerCase().startsWith(o))return E(e,t,l)}return false}function wr(e,t){let r=A.get(t);if(!r||r.length===0)return false;let n=d.get(t)??[],o=c.selectedIndex[t]??-1,l=r.toLowerCase();for(let s=o+1;s<n.length;s++){let a=n[s];if(a&&!a.disabled&&a.text.toLowerCase().startsWith(l))return E(e,t,s)}for(let s=0;s<=o;s++){let a=n[s];if(a&&!a.disabled&&a.text.toLowerCase().startsWith(l))return E(e,t,s)}return false}function Wr(e,t){let r=P.get(e)??[];return r.push(t),P.set(e,r),()=>{let n=P.get(e);if(n){let o=n.indexOf(t);o!==-1&&n.splice(o,1);}}}function Fr(e,t,r){if(!N(e,t)||Tt(e,t)||!It(t))return null;if(wt(e,t))return Dr(r);switch(r){case "up":case "k":return {type:"selectPrev"};case "down":case "j":return {type:"selectNext"};case "home":case "g":return {type:"selectFirst"};case "end":case "G":return {type:"selectLast"};case "pageup":return {type:"pageUp"};case "pagedown":return {type:"pageDown"};case "enter":return {type:"confirm"};case " ":case "space":return R(t)?{type:"toggleSelect"}:{type:"confirm"};case "escape":return {type:"cancel"};case "/":return {type:"startSearch"};default:return null}}function Dr(e){switch(e){case "escape":return {type:"endSearch"};case "enter":return {type:"endSearch"};case "backspace":return {type:"searchBackspace"};case "up":case "down":return {type:"endSearch"};case "tab":case "C-n":return {type:"searchNextMatch"};default:return e.length===1&&e>=" "?{type:"searchChar",char:e}:null}}function Br(e,t){let r=At(e),n=Lt(e),o=c.selectedIndex[e]??-1,l=[];for(let{index:s,item:a}of n){let b=s===o?r.selectedPrefix:r.unselectedPrefix,y=a.text,L=t-b.length,S=y.length>L?`${y.slice(0,L-1)}\u2026`:y;l.push(b+S);}return l}function _r(){c.isList.fill(0),c.selectedIndex.fill(-1),c.itemCount.fill(0),c.firstVisible.fill(0),c.visibleCount.fill(0),c.interactive.fill(0),c.mouse.fill(0),c.keys.fill(0),c.searchEnabled.fill(0),c.totalCount.fill(0),c.isLoading.fill(0),d.clear(),V.clear(),D.clear(),B.clear(),_.clear(),J.clear(),I.clear(),z.clear(),Y.clear(),A.clear(),P.clear(),X.clear(),H.clear(),Z.clear();}Ht(E);var kr=["|","/","-","\\"],sl=[". ",".. ","..."," .."," ."," "],il=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],cl=["\u2596","\u2598","\u259D","\u2597"],al=100,p={frame:new Uint8Array(1e4),frameCount:new Uint8Array(1e4),interval:new Uint16Array(1e4),elapsed:new Float32Array(1e4)},Q=new Map,q=new Set;function ul(e,t,r={}){let n=r.frames??kr,o=r.interval??100;p.frame[t]=0,p.frameCount[t]=n.length,p.interval[t]=o,p.elapsed[t]=0,Q.set(t,n),q.add(t);}function fl(e,t){q.has(t)&&(p.frame[t]=0,p.frameCount[t]=0,p.interval[t]=0,p.elapsed[t]=0,Q.delete(t),q.delete(t));}function ml(e,t){return q.has(t)}function bl(e){let t=Q.get(e);if(!t)return "";let r=p.frame[e]??0;return t[r%t.length]??""}function pl(e){let t=Q.get(e);return t?{frame:p.frame[e]??0,frameCount:p.frameCount[e]??0,interval:p.interval[e]??100,elapsed:p.elapsed[e]??0,frames:t}:null}function dl(e,t){p.interval[e]=t;}function gl(e,t){Q.set(e,t),p.frameCount[e]=t.length,(p.frame[e]??0)>=t.length&&(p.frame[e]=0);}function Mr(e){let t=p.frameCount[e]??1,r=((p.frame[e]??0)+1)%t;return p.frame[e]=r,r}function yl(e,t){let r=(p.elapsed[e]??0)+t,n=p.interval[e]??100;return r>=n?(Mr(e),p.elapsed[e]=r%n,true):(p.elapsed[e]=r,false)}function xl(e){p.frame[e]=0,p.elapsed[e]=0;}function hl(){Q.clear(),q.clear();}var $t=4294967295,jt=858993663,Zt=3435973887,Jt=255,qt=1717987071,te=255,v=1e4,W={rowCount:new Uint32Array(v),colCount:new Uint16Array(v),headerRows:new Uint8Array(v).fill(1),pad:new Uint8Array(v).fill(1),cellBorders:new Uint8Array(v)},f={isTable:new Uint8Array(v),rowCount:new Uint32Array(v),colCount:new Uint16Array(v),headerRows:new Uint8Array(v).fill(1),pad:new Uint8Array(v).fill(1),cellBorders:new Uint8Array(v)},g=new Map,$=new Map,K=new Map;function Ll(e,t,r={}){f.isTable[t]=1,f.rowCount[t]=0,f.colCount[t]=0,f.headerRows[t]=r.headerRows??1,f.pad[t]=r.pad??1,f.cellBorders[t]=r.cellBorders===true?1:0,W.rowCount[t]=0,W.colCount[t]=0,W.headerRows[t]=r.headerRows??1,W.pad[t]=r.pad??1,W.cellBorders[t]=r.cellBorders===true?1:0,g.set(t,[]),$.set(t,[]);}function Sl(e,t){return f.isTable[t]===1}function vl(e,t){f.isTable[t]=0,f.rowCount[t]=0,f.colCount[t]=0,f.headerRows[t]=1,f.pad[t]=1,f.cellBorders[t]=0,W.rowCount[t]=0,W.colCount[t]=0,W.headerRows[t]=1,W.pad[t]=1,W.cellBorders[t]=0,g.delete(t),$.delete(t),K.delete(t);}function Tl(e,t,r){let n=r.map(o=>o.map(l=>typeof l=="string"?{value:l}:l));g.set(t,n),f.rowCount[t]=n.length,f.colCount[t]=n.reduce((o,l)=>Math.max(o,l.length),0),oa(e,t);}function Al(e,t){return g.get(t)??[]}function Il(e,t){return (g.get(t)??[]).map(n=>n.map(o=>o.value))}function wl(e,t,r,n,o){let l=g.get(t);if(!l||r<0||n<0)return false;for(;l.length<=r;)l.push([]);let s=l[r];if(!s)return false;for(;s.length<=n;)s.push({value:""});s[n]=typeof o=="string"?{value:o}:o;let a=l.reduce((m,b)=>Math.max(m,b.length),0);return f.colCount[t]=a,f.rowCount[t]=l.length,oa(e,t),true}function Rr(e,t,r,n){let o=g.get(t);if(!(!o||r<0||n<0))return o[r]?.[n]}function Wl(e,t,r,n){return Rr(e,t,r,n)?.value}function Fl(e,t,r){return g.get(t)?.[r]}function Dl(e,t,r){return (g.get(t)??[]).map(o=>o[r]??{value:""})}function Bl(e,t){return f.rowCount[t]??0}function _l(e,t){return f.colCount[t]??0}function kl(e,t,r){let n=g.get(t)??[],o=r.map(l=>typeof l=="string"?{value:l}:l);n.push(o),f.rowCount[t]=n.length,f.colCount[t]=Math.max(f.colCount[t]??0,o.length),oa(e,t);}function Ml(e,t,r,n){let o=g.get(t)??[],l=n.map(a=>typeof a=="string"?{value:a}:a),s=Math.max(0,Math.min(r,o.length));o.splice(s,0,l),f.rowCount[t]=o.length,f.colCount[t]=Math.max(f.colCount[t]??0,l.length),oa(e,t);}function Rl(e,t,r){let n=g.get(t);if(!n||r<0||r>=n.length)return;let o=n.splice(r,1)[0];return f.rowCount[t]=n.length,f.colCount[t]=n.reduce((l,s)=>Math.max(l,s.length),0),oa(e,t),o}function Ul(e,t){g.set(t,[]),f.rowCount[t]=0,f.colCount[t]=0,oa(e,t);}function Xl(e,t,r){$.set(t,[...r]);let n=g.get(t)??[];if((f.headerRows[t]??1)>0){let l=r.map(s=>({value:s.header,align:s.align??"left"}));n.length===0?n.unshift(l):n[0]=l,f.rowCount[t]=n.length,f.colCount[t]=r.length;}oa(e,t);}function Vl(e,t){return $.get(t)??[]}function Pl(e,t){let r=g.get(t)??[],n=f.headerRows[t]??1;return r.slice(0,n)}function Yl(e,t){let r=g.get(t)??[],n=f.headerRows[t]??1;return r.slice(n)}function Nl(e,t,r){f.headerRows[t]=Math.max(0,Math.min(255,r)),oa(e,t);}function Ol(e,t){return f.headerRows[t]??1}function Gl(e,t,r){let n=K.get(t),o=r.altRowBg??n?.altRowBg,l=r.selectedFg??n?.selectedFg,s=r.selectedBg??n?.selectedBg,a={headerFg:r.headerFg??n?.headerFg??$t,headerBg:r.headerBg??n?.headerBg??jt,cellFg:r.cellFg??n?.cellFg??Zt,cellBg:r.cellBg??n?.cellBg??Jt,borderFg:r.borderFg??n?.borderFg??qt,borderBg:r.borderBg??n?.borderBg??te,...o!==void 0&&{altRowBg:o},...l!==void 0&&{selectedFg:l},...s!==void 0&&{selectedBg:s}};K.set(t,a);}function Hl(e,t){return K.get(t)??{headerFg:$t,headerBg:jt,cellFg:Zt,cellBg:Jt,borderFg:qt,borderBg:te}}function zl(e,t){K.delete(t);}function Ql(e,t){return f.pad[t]??1}function Kl(e,t,r){f.pad[t]=Math.max(0,Math.min(255,r)),oa(e,t);}function $l(e,t){return f.cellBorders[t]===1}function jl(e,t,r){f.cellBorders[t]=r?1:0,oa(e,t);}function Ur(e,t,r){let n=new Array(t).fill(0);for(let o of e)for(let l=0;l<o.length;l++){let s=o[l];s&&(n[l]=Math.max(n[l]??0,s.value.length+r*2));}return n}function Xr(e,t){for(let r=0;r<t.length;r++){let n=t[r];n&&(n.width!==void 0?e[r]=n.width:(n.minWidth!==void 0&&(e[r]=Math.max(e[r]??0,n.minWidth)),n.maxWidth!==void 0&&(e[r]=Math.min(e[r]??0,n.maxWidth))));}}function Vr(e,t){let r=e.reduce((n,o)=>n+o,0);if(r>t){let n=t/r;for(let o=0;o<e.length;o++)e[o]=Math.floor((e[o]??0)*n);}}function Pr(e,t,r){let n=g.get(t)??[],o=$.get(t)??[],l=f.colCount[t]??0,s=f.pad[t]??1,a=Ur(n,l,s);return Xr(a,o),r!==void 0&&Vr(a,r),a}function Yr(e,t,r){if(r==="right")return e.padStart(t);if(r==="center"){let n=Math.floor((t-e.length)/2);return e.padStart(n+e.length).padEnd(t)}return e.padEnd(t)}function Nr(e,t,r,n){let o=t-r*2,l=e.value;l.length>o&&(l=`${l.slice(0,o-1)}\u2026`);let s=Yr(l,o,e.align??"left");return n+s+n}function Or(e,t,r,n){let o=" ".repeat(r),l=n?"\u2502":"",s="";for(let a=0;a<t.length;a++){let m=e[a]??{value:""};a>0&&n&&(s+=l),s+=Nr(m,t[a]??0,r,o);}return s}function Zl(e,t,r){let n=g.get(t)??[],o=Pr(e,t,r),l=f.pad[t]??1,s=f.cellBorders[t]===1,a=f.headerRows[t]??1,m=[];for(let b=0;b<n.length;b++)m.push(Or(n[b]??[],o,l,s)),s&&b===a-1&&b<n.length-1&&m.push(o.map(y=>"\u2500".repeat(y)).join("\u253C"));return m}function Jl(){f.isTable.fill(0),f.rowCount.fill(0),f.colCount.fill(0),f.headerRows.fill(1),f.pad.fill(1),f.cellBorders.fill(0),g.clear(),$.clear(),K.clear();}var U=1e4,Gr=80,Hr=24,zr=1e3,i={isTerminal:new Uint8Array(U),width:new Uint16Array(U),height:new Uint16Array(U),cursorX:new Uint16Array(U),cursorY:new Uint16Array(U),cursorVisible:new Uint8Array(U),scrollOffset:new Uint32Array(U),altScreenActive:new Uint8Array(U)},C=new Map,Qr=z$1.object({width:z$1.number().int().positive().default(Gr),height:z$1.number().int().positive().default(Hr),scrollbackLines:z$1.number().int().nonnegative().default(zr),cursorVisible:z$1.boolean().default(true),cursorShape:z$1.enum(["block","underline","bar"]).default("block"),cursorBlink:z$1.boolean().default(true)});function Kr(e,t,r,n,o){let l={maxLines:r,chunkSize:Math.min(r,1e3)};return {buffer:k$2(e,t),scrollback:e$2(l),currentAttr:e$1(),escapeBuffer:"",inEscape:false,savedCursorX:0,savedCursorY:0,savedAttr:e$1(),altBuffer:null,cursorShape:n,cursorBlink:o}}function $r(e,t,r){return r*e+t}function jr(e){let t=b$1,r=c$1,n=[255,2852126975,11141375,2863268095,43775,2852170495,11184895,2863311615,1431655935,4283782655,1442797055,4294923775,1431699455,4283826175,1442840575,4294967295];return e.fg.type===1?t=n[e.fg.value]??b$1:e.fg.type===3&&(t=e.fg.value<<8|255),e.bg.type===1?r=n[e.bg.value]??c$1:e.bg.type===3&&(r=e.bg.value<<8|255),{fg:t,bg:r,attrs:e.styles}}function Ft(e$1,t,r){let n=Zr(e$1.buffer,0,t);g$1(e$1.scrollback,n);for(let l=0;l<r-1;l++)for(let s=0;s<t;s++){let a=(l+1)*t+s,m=l*t+s,b=e$1.buffer.cells[a];b&&(e$1.buffer.cells[m]=f$4(b));}let o=e();for(let l=0;l<t;l++){let s=(r-1)*t+l;e$1.buffer.cells[s]=f$4(o);}}function Zr(e,t,r){let n="";for(let o=0;o<r;o++){let l=t*r+o,s=e.cells[l];n+=s?.char??" ";}return n.trimEnd()}function ls(e,t,r={}){let n=Qr.parse(r);i.isTerminal[t]=1,i.width[t]=n.width,i.height[t]=n.height,i.cursorX[t]=0,i.cursorY[t]=0,i.cursorVisible[t]=n.cursorVisible?1:0,i.scrollOffset[t]=0,i.altScreenActive[t]=0;let o=Kr(n.width,n.height,n.scrollbackLines,n.cursorShape,n.cursorBlink);C.set(t,o),oa(e,t);}function Jr(e){return i.isTerminal[e]===1}function ss(e){return C.get(e)}function is(e){if(Jr(e))return {width:i.width[e]??0,height:i.height[e]??0,cursorX:i.cursorX[e]??0,cursorY:i.cursorY[e]??0,cursorVisible:i.cursorVisible[e]===1,scrollOffset:i.scrollOffset[e]??0}}function qr(e,t,r,n,o){let l=(i.cursorY[t]??0)+1;l>=o&&(Ft(r,n,o),l=o-1),i.cursorX[t]=0,i.cursorY[t]=l,oa(e,t);}function tn(e,t,r){let n=i.cursorX[t]??0,o=Math.min((Math.floor(n/8)+1)*8,r-1);i.cursorX[t]=o,oa(e,t);}function en(e$1,t,r,n,o,l){let s=i.cursorX[t]??0,a=i.cursorY[t]??0,{fg:m,bg:b,attrs:y}=jr(r.currentAttr),L=$r(o,s,a);r.buffer.cells[L]=e(n,m,b,y);let S=s+1;S>=o&&(S=0,a++,a>=l&&(Ft(r,o,l),a=l-1)),i.cursorX[t]=S,i.cursorY[t]=a,oa(e$1,t);}function rn(e,t,r){let n=C.get(t);if(!n)return;let o=i.width[t]??0,l=i.height[t]??0;if(r===`
2
+ `){qr(e,t,n,o,l);return}if(r==="\r"){i.cursorX[t]=0,oa(e,t);return}if(r==="\b"){let s=i.cursorX[t]??0;s>0&&(i.cursorX[t]=s-1),oa(e,t);return}if(r===" "){tn(e,t,o);return}en(e,t,n,r,o,l);}function cs(e,t,r){let n=C.get(t);if(n)for(let o=0;o<r.length;o++){let l=r[o];if(l!==void 0){if(l==="\x1B"){n.inEscape=true,n.escapeBuffer=l;continue}if(n.inEscape){n.escapeBuffer+=l,nn(n.escapeBuffer)&&(on(e,t,n,n.escapeBuffer),n.inEscape=false,n.escapeBuffer="");continue}rn(e,t,l);}}}function nn(e){if(e.length<2)return false;if(e[1]==="["){let t=e[e.length-1];return t===void 0?false:/[A-Za-z@`~]/.test(t)}return e[1]==="]"?e.endsWith("\x07")||e.endsWith("\x1B\\"):e.length>=2}function on(e,t,r,n){if(n.length<2)return;let o=n[1];if(o==="["){ln(e,t,r,n);return}switch(o){case "c":Wn(e,t);break;case "7":r.savedCursorX=i.cursorX[t]??0,r.savedCursorY=i.cursorY[t]??0,r.savedAttr=f$2(r.currentAttr);break;case "8":i.cursorX[t]=r.savedCursorX,i.cursorY[t]=r.savedCursorY,r.currentAttr=f$2(r.savedAttr),oa(e,t);break;case "D":st(e,t,r,1);break;case "M":Wt(e,t,1);break;case "E":i.cursorX[t]=0,st(e,t,r,1);break}}function ln(e,t,r,n){let o=n.match(/^\x1b\[(\??[\d;]*)([A-Za-z@`~])$/);if(!o)return;let l=o[1]??"",s=o[2],a=l===""?[]:l.split(";").map(S=>parseInt(S,10)||0),m=a[0]??1,b=a[1]??1,y=i.width[t]??0,L=i.height[t]??0;switch(s){case "A":Wt(e,t,m);break;case "B":st(e,t,r,m);break;case "C":un(e,t,m,y);break;case "D":fn(e,t,m);break;case "E":i.cursorX[t]=0,st(e,t,r,m);break;case "F":i.cursorX[t]=0,Wt(e,t,m);break;case "G":i.cursorX[t]=Math.min(Math.max(m-1,0),y-1),oa(e,t);break;case "H":case "f":i.cursorY[t]=Math.min(Math.max(m-1,0),L-1),i.cursorX[t]=Math.min(Math.max(b-1,0),y-1),oa(e,t);break;case "J":pn(e,t,r,a[0]??0);break;case "K":dn(e,t,r,a[0]??0);break;case "m":In(r,a.length===0?[0]:a);break;case "h":ee(e,t,r,l,true);break;case "l":ee(e,t,r,l,false);break;case "s":r.savedCursorX=i.cursorX[t]??0,r.savedCursorY=i.cursorY[t]??0;break;case "u":i.cursorX[t]=r.savedCursorX,i.cursorY[t]=r.savedCursorY,oa(e,t);break}}function sn(e,t,r){i.cursorVisible[t]=r?1:0,oa(e,t);}function cn(e,t,r,n){n?(r.savedCursorX=i.cursorX[t]??0,r.savedCursorY=i.cursorY[t]??0,ne(e,t,r)):(oe(e,t,r),i.cursorX[t]=r.savedCursorX,i.cursorY[t]=r.savedCursorY),oa(e,t);}function an(e,t,r,n,o){o?(ne(e,t,r),n==="1047"&&le(r,0,r.buffer.cells.length)):oe(e,t,r),oa(e,t);}function ee(e,t,r,n,o){let l=n.startsWith("?")?n.slice(1):n;if(l==="25"){sn(e,t,o);return}if(l==="1049"){cn(e,t,r,o);return}if(l==="47"||l==="1047"){an(e,t,r,l,o);return}}function ne(e$1,t,r){if(i.altScreenActive[t]===1)return;let n=i.width[t]??0,o=i.height[t]??0;r.altBuffer||(r.altBuffer=k$2(n,o));for(let s=0;s<r.buffer.cells.length&&s<r.altBuffer.cells.length;s++){let a=r.buffer.cells[s];a&&(r.altBuffer.cells[s]=f$4(a));}let l=e();for(let s=0;s<r.buffer.cells.length;s++)r.buffer.cells[s]=f$4(l);i.cursorX[t]=0,i.cursorY[t]=0,i.altScreenActive[t]=1;}function oe(e,t,r){if(i.altScreenActive[t]!==0){if(r.altBuffer)for(let n=0;n<r.altBuffer.cells.length&&n<r.buffer.cells.length;n++){let o=r.altBuffer.cells[n];o&&(r.buffer.cells[n]=f$4(o));}i.altScreenActive[t]=0;}}function Wt(e,t,r){let n=i.cursorY[t]??0;i.cursorY[t]=Math.max(0,n-r),oa(e,t);}function st(e,t,r,n){let o=i.width[t]??0,l=i.height[t]??0,s=i.cursorY[t]??0;for(s+=n;s>=l;)Ft(r,o,l),s--;i.cursorY[t]=s,oa(e,t);}function un(e,t,r,n){let o=i.cursorX[t]??0;i.cursorX[t]=Math.min(n-1,o+r),oa(e,t);}function fn(e,t,r){let n=i.cursorX[t]??0;i.cursorX[t]=Math.max(0,n-r),oa(e,t);}function le(e$1,t,r){let n=e();for(let o=t;o<r;o++)e$1.buffer.cells[o]=f$4(n);}function se(e$1,t,r,n,o){let l=e();for(let s=n;s<=o;s++){let a=r*t+s;e$1.buffer.cells[a]=f$4(l);}}function ie(e$1,t,r,n){let o=e();for(let l=r;l<n;l++)for(let s=0;s<t;s++){let a=l*t+s;e$1.buffer.cells[a]=f$4(o);}}function mn(e,t,r,n,o){se(e,t,o,n,t-1),ie(e,t,o+1,r);}function bn(e,t,r,n){ie(e,t,0,n),se(e,t,n,0,r);}function pn(e,t,r,n){let o=i.width[t]??0,l=i.height[t]??0,s=i.cursorX[t]??0,a=i.cursorY[t]??0;n===0?mn(r,o,l,s,a):n===1?bn(r,o,s,a):(n===2||n===3)&&(le(r,0,r.buffer.cells.length),n===3&&f$3(r.scrollback)),oa(e,t);}function dn(e$1,t,r,n){let o=i.width[t]??0,l=i.cursorX[t]??0,s=i.cursorY[t]??0,a=e();switch(n){case 0:for(let m=l;m<o;m++){let b=s*o+m;r.buffer.cells[b]=f$4(a);}break;case 1:for(let m=0;m<=l;m++){let b=s*o+m;r.buffer.cells[b]=f$4(a);}break;case 2:for(let m=0;m<o;m++){let b=s*o+m;r.buffer.cells[b]=f$4(a);}break}oa(e$1,t);}function gn(e){return e.currentAttr=e$1(),1}function yn(e,t,r){let n=t[r]??0;return e.currentAttr.styles|=1<<n-1,1}function xn(e,t,r){let n=t[r]??0;return e.currentAttr.styles&=~(1<<n-22+1),1}function hn(e,t,r){let n=t[r]??0;return e.currentAttr.fg={type:1,value:n-30},1}function En(e){return e.currentAttr.fg={type:0,value:0},1}function Cn(e,t,r){let n=t[r]??0;return e.currentAttr.bg={type:1,value:n-40},1}function Ln(e){return e.currentAttr.bg={type:0,value:0},1}function Sn(e,t,r){let n=t[r]??0;return e.currentAttr.fg={type:1,value:n-90+8},1}function vn(e,t,r){let n=t[r]??0;return e.currentAttr.bg={type:1,value:n-100+8},1}function Tn(e){return e===0?gn:e>=1&&e<=9?yn:e>=22&&e<=29?xn:e>=30&&e<=37?hn:e===39?En:e>=90&&e<=97?Sn:e>=40&&e<=47?Cn:e===49?Ln:e>=100&&e<=107?vn:null}function An(e,t,r){let n=t[r]??0;if(n===38){let l=re(e,t,r,"fg");return l>0?l:1}if(n===48){let l=re(e,t,r,"bg");return l>0?l:1}let o=Tn(n);return o?o(e,t,r):1}function re(e,t,r,n){if(r+1>=t.length)return 0;let o=t[r+1];if(o===5&&r+2<t.length){let l=t[r+2]??0;return e.currentAttr[n]={type:2,value:l},3}if(o===2&&r+4<t.length){let l=t[r+2]??0,s=t[r+3]??0,a=t[r+4]??0;return e.currentAttr[n]={type:3,value:l<<16|s<<8|a},5}return 0}function In(e,t){let r=0;for(;r<t.length;){let n=An(e,t,r);r+=n;}}function wn(e$2,t){let r=C.get(t);if(!r)return;let n=e();for(let o=0;o<r.buffer.cells.length;o++)r.buffer.cells[o]=f$4(n);i.cursorX[t]=0,i.cursorY[t]=0,r.currentAttr=e$1(),oa(e$2,t);}function Wn(e,t){let r=C.get(t);r&&(wn(e,t),f$3(r.scrollback),r.escapeBuffer="",r.inEscape=false,r.savedCursorX=0,r.savedCursorY=0,r.savedAttr=e$1(),i.cursorVisible[t]=1,i.scrollOffset[t]=0,oa(e,t));}function as(e,t,r,n){let o=i.width[t]??0,l=i.height[t]??0;i.cursorX[t]=Math.min(Math.max(r,0),o-1),i.cursorY[t]=Math.min(Math.max(n,0),l-1),oa(e,t);}function us(e,t,r){i.cursorVisible[t]=r?1:0,oa(e,t);}function fs(e,t,r){let n=C.get(t);if(!n)return;let o=i.scrollOffset[t]??0,l=n.scrollback.totalLines;i.scrollOffset[t]=Math.min(o+r,l),oa(e,t);}function ms(e,t,r){let n=i.scrollOffset[t]??0;i.scrollOffset[t]=Math.max(0,n-r),oa(e,t);}function bs(e,t){let r=C.get(t);r&&(i.scrollOffset[t]=r.scrollback.totalLines,oa(e,t));}function ps(e,t){i.scrollOffset[t]=0,oa(e,t);}function ds(e,t,r,n){let o=C.get(t);if(!o)return;let l=i.width[t]??0,s=i.height[t]??0,a=k$2(r,n),m=Math.min(l,r),b=Math.min(s,n);for(let S=0;S<b;S++)for(let tt=0;tt<m;tt++){let ce=S*l+tt,ae=S*r+tt,Dt=o.buffer.cells[ce];Dt&&(a.cells[ae]=f$4(Dt));}o.buffer=a,i.width[t]=r,i.height[t]=n;let y=i.cursorX[t]??0,L=i.cursorY[t]??0;i.cursorX[t]=Math.min(y,r-1),i.cursorY[t]=Math.min(L,n-1),oa(e,t);}function gs(e){i.isTerminal[e]=0,i.width[e]=0,i.height[e]=0,i.cursorX[e]=0,i.cursorY[e]=0,i.cursorVisible[e]=0,i.scrollOffset[e]=0,i.altScreenActive[e]=0,C.delete(e);}function Fn(e,t,r){let n=j(e.scrollback,e.scrollback.totalLines-r,e.scrollback.totalLines-r+t),o="";for(let l of n.lines)o+=l.ansi??l.text,o+=`
3
+ `;return o}function Dn(e,t){let r="";return (e.fg!==t.fg||e.bg!==t.bg)&&(r+="\x1B[0m",t.fg=e.fg,t.bg=e.bg),r+=e.char,{output:r,fg:t.fg,bg:t.bg}}function ys(e){let t=C.get(e);if(!t)return "";let r=i.width[e]??0,n=i.height[e]??0,o=i.scrollOffset[e]??0;if(o>0)return Fn(t,n,o);let l="",s={fg:-1,bg:-1};for(let a=0;a<n;a++){for(let m=0;m<r;m++){let b=a*r+m,y=t.buffer.cells[b];if(!y)continue;let L=Dn(y,s);l+=L.output,s.fg=L.fg,s.bg=L.bg;}a<n-1&&(l+=`
4
+ `);}return l}function xs(e){return C.get(e)?.buffer.cells}function hs(){i.isTerminal.fill(0),i.width.fill(0),i.height.fill(0),i.cursorX.fill(0),i.cursorY.fill(0),i.cursorVisible.fill(0),i.scrollOffset.fill(0),i.altScreenActive.fill(0),C.clear();}export{ze as $,sl as $a,Pr as $b,Le as A,mr as Aa,Tl as Ab,Ct as B,br as Ba,Al as Bb,Se as C,pr as Ca,Il as Cb,Lt as D,dr as Da,wl as Db,ve as E,gr as Ea,Rr as Eb,zt as F,yr as Fa,Wl as Fb,Te as G,xr as Ga,Fl as Gb,Ae as H,hr as Ha,Dl as Hb,Ie as I,It as Ia,Bl as Ib,we as J,Er as Ja,_l as Jb,Et as K,Qt as Ka,kl as Kb,We as L,Cr as La,Ml as Lb,Fe as M,wt as Ma,Rl as Mb,De as N,Lr as Na,Ul as Nb,Be as O,Sr as Oa,Xl as Ob,_e as P,vr as Pa,Vl as Pb,ke as Q,lt as Qa,Pl as Qb,Me as R,Tr as Ra,Yl as Rb,Re as S,Ar as Sa,Nl as Sb,Ue as T,Ir as Ta,Ol as Tb,E as U,Kt as Ua,Gl as Ub,Pe as V,wr as Va,Hl as Vb,Ye as W,Wr as Wa,zl as Wb,Ne as X,Fr as Xa,Ql as Xb,Oe as Y,Br as Ya,Kl as Yb,Ge as Z,_r as Za,$l as Zb,He as _,kr as _a,jl as _b,h as a,Qe as aa,il as ab,Zl as ac,_n as b,Ke as ba,cl as bb,Jl as bc,kn as c,$e as ca,al as cb,Gr as cc,Mn as d,je as da,p as db,Hr as dc,Rn as e,Ze as ea,ul as eb,zr as ec,Un as f,St as fa,fl as fb,i as fc,Xn as g,qe as ga,ml as gb,Qr as gc,mt as h,N as ha,bl as hb,ls as hc,bt as i,vt as ia,pl as ib,Jr as ic,pt as j,ot as ja,dl as jb,ss as jc,dt as k,tr as ka,gl as kb,is as kc,gt as l,Tt as la,Mr as lb,rn as lc,yt as m,M as ma,yl as mb,cs as mc,xt as n,er as na,xl as nb,wn as nc,c as o,rr as oa,hl as ob,Wn as oc,k as p,nr as pa,$t as pb,as as pc,be as q,or as qa,jt as qb,us as qc,pe as r,lr as ra,Zt as rb,fs as rc,de as s,At as sa,Jt as sb,ms as sc,w as t,sr as ta,qt as tb,bs as tc,ge as u,ir as ua,te as ub,ps as uc,ye as v,cr as va,W as vb,ds as vc,xe as w,ar as wa,f as wb,gs as wc,he as x,ur as xa,Ll as xb,ys as xc,nt as y,R as ya,Sl as yb,xs as yc,Ce as z,fr as za,vl as zb,hs as zc};