vuetty 0.1.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.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/build/bun-loader.d.ts +1 -0
- package/dist/build/bun-loader.js +32 -0
- package/dist/debug/DebugServer.js +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +1 -0
- package/dist/rollup-plugin/index.d.ts +9 -0
- package/dist/rollup-plugin/index.js +1 -0
- package/dist/static/debug.css +1 -0
- package/dist/static/debug.js +1 -0
- package/dist/static/favicon.ico +0 -0
- package/dist/static/index.html +146 -0
- package/package.json +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thibault Terrasson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Vuetty
|
|
2
|
+
|
|
3
|
+
A Vue.js custom renderer for building Terminal User Interfaces (TUIs). Vuetty brings Vue's reactive system and component model to the terminal, allowing you to build interactive command-line applications using familiar Vue.js syntax.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
For detailed documentation, component references, and advanced usage, visit the [full documentation](https://tterrasson.github.io/vuetty/).
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Vue-Powered Reactivity**: Leverage Vue's reactive system to build dynamic terminal applications. State changes automatically trigger UI updates.
|
|
12
|
+
- **Comprehensive Component Library**: Pre-built components for layout, text, input, and data visualization.
|
|
13
|
+
- **Flexbox-Inspired Layouts**: Create sophisticated terminal layouts using familiar flexbox concepts with Row, Col, and flex ratio components.
|
|
14
|
+
- **Single File Component Support**: Develop with standard Vue SFC syntax using templates, scripts, and styles.
|
|
15
|
+
- **Color Theming Support**: Built-in support for color themes to style your terminal applications.
|
|
16
|
+
- **Advanced Input Management**: Built-in keyboard and mouse input handling with focus management and interactive form components.
|
|
17
|
+
- **Optimized Performance**: Efficient rendering with smart caching for text, images, and markdown content.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun add vuetty vue
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
Create a simple Vue component:
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<!-- Hello.vue -->
|
|
31
|
+
<template>
|
|
32
|
+
<Box :padding="1" color="cyan">
|
|
33
|
+
<TextBox bold>Hello, World!</TextBox>
|
|
34
|
+
</Box>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup>
|
|
38
|
+
import { Box, TextBox } from 'vuetty';
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Run it with Bun:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// app.js
|
|
46
|
+
import 'vuetty/loader';
|
|
47
|
+
import { vuetty } from 'vuetty';
|
|
48
|
+
import Hello from './Hello.vue';
|
|
49
|
+
|
|
50
|
+
const app = vuetty(Hello);
|
|
51
|
+
|
|
52
|
+
process.on('SIGINT', () => {
|
|
53
|
+
app.unmount();
|
|
54
|
+
process.exit(0);
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
bun app.js
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Reactive Counter Example
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<template>
|
|
66
|
+
<Col>
|
|
67
|
+
<Box :padding="1" color="cyan">
|
|
68
|
+
<TextBox bold>Counter: {{ count }}</TextBox>
|
|
69
|
+
</Box>
|
|
70
|
+
<Box :padding="1" :color="countColor">
|
|
71
|
+
<TextBox>{{ message }}</TextBox>
|
|
72
|
+
</Box>
|
|
73
|
+
</Col>
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<script setup>
|
|
77
|
+
import { ref, computed, onMounted } from 'vue';
|
|
78
|
+
import { Box, TextBox, Col } from 'vuetty';
|
|
79
|
+
|
|
80
|
+
const count = ref(0);
|
|
81
|
+
const countColor = computed(() => count.value > 10 ? 'red' : 'green');
|
|
82
|
+
const message = computed(() => count.value < 5 ? 'Just started...' : 'Getting high!');
|
|
83
|
+
|
|
84
|
+
onMounted(() => {
|
|
85
|
+
setInterval(() => count.value++, 1000);
|
|
86
|
+
});
|
|
87
|
+
</script>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Use Cases
|
|
91
|
+
|
|
92
|
+
Vuetty is designed for:
|
|
93
|
+
|
|
94
|
+
- CLI tools and interactive command-line applications
|
|
95
|
+
- Real-time monitoring dashboards for servers and services
|
|
96
|
+
- Development tools, debugging interfaces, and log viewers
|
|
97
|
+
- Data visualization with charts, graphs, and tables
|
|
98
|
+
- Form-based applications with validation
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/build/bun-loader.js
|
|
2
|
+
/**
|
|
3
|
+
* Bun plugin for .vue files - for development/examples only
|
|
4
|
+
* Users should use the Rollup plugin for production builds
|
|
5
|
+
*/
|
|
6
|
+
import { plugin } from 'bun';
|
|
7
|
+
import { compileSFC } from './compiler-core.js';
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
9
|
+
|
|
10
|
+
plugin({
|
|
11
|
+
name: 'vuetty-bun-loader',
|
|
12
|
+
|
|
13
|
+
setup(build) {
|
|
14
|
+
build.onLoad({ filter: /\.vue$/ }, async ({ path }) => {
|
|
15
|
+
const source = readFileSync(path, 'utf-8');
|
|
16
|
+
const { code, errors } = compileSFC(source, path);
|
|
17
|
+
|
|
18
|
+
if (errors.length > 0) {
|
|
19
|
+
console.error(`Vuetty SFC compilation failed for ${path}:`);
|
|
20
|
+
for (const error of errors) {
|
|
21
|
+
console.error(` ${error.message}`);
|
|
22
|
+
}
|
|
23
|
+
throw new Error('SFC compilation failed');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
contents: code,
|
|
28
|
+
loader: 'js'
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fileURLToPath as t}from"url";import{dirname as e,join as r}from"path";class s{constructor(t){this.debugServer=t,this.originalConsole={log:console.log,error:console.error,warn:console.warn},this.isActive=!1}activate(){if(this.isActive)return;const t=this;console.log=(...e)=>{t.debugServer.captureEvent("console.log",{args:e.map(e=>t.serialize(e))})},console.error=(...e)=>{t.debugServer.captureEvent("console.error",{args:e.map(e=>t.serialize(e))})},console.warn=(...e)=>{t.debugServer.captureEvent("console.warn",{args:e.map(e=>t.serialize(e))})},this.isActive=!0}deactivate(){this.isActive&&(console.log=this.originalConsole.log,console.error=this.originalConsole.error,console.warn=this.originalConsole.warn,this.isActive=!1)}interceptVueWarnings(t){const e=this;t.config.warnHandler=(t,r,s)=>{e.debugServer.captureEvent("vue.warn",{message:t,trace:s||"",component:r?.$options?.name||r?.__name||"Anonymous"})},t.config.errorHandler=(t,r,s)=>{e.debugServer.captureEvent("vue.error",{message:t.message||String(t),stack:t.stack||"",info:s||"",component:r?.$options?.name||r?.__name||"Anonymous"})}}serialize(t){if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(null===t)return"null";if(void 0===t)return"undefined";if(t instanceof Error)return`${t.name}: ${t.message}\n${t.stack||""}`;try{return JSON.stringify(t,null,2)}catch(e){return String(t)}}}function n(t){return t?{scrollOffset:t.scrollOffset||0,contentHeight:t.contentHeight||0,terminalHeight:t.terminalHeight||0,terminalWidth:t.terminalWidth||0,autoScrollToBottom:!1!==t.autoScrollToBottom,mouseWheelEnabled:!1!==t.mouseWheelEnabled,mouseWheelScrollLines:t.mouseWheelScrollLines||3,scrollIndicatorMode:t.scrollIndicatorMode||"reserved",mouseTrackingEnabled:!1!==t.mouseTrackingEnabled}:null}var o=Object.freeze({__proto__:null,serializeNodeTree:function t(e,r=0,s=5){if(!e||r>s)return null;const n={type:e.type,text:e.text||null,isDirty:e.isDirty||!1,isLayoutDirty:e.isLayoutDirty||!1};if(e.props&&Object.keys(e.props).length>0){n.props={};for(const[t,r]of Object.entries(e.props))null==r||"string"==typeof r||"number"==typeof r||"boolean"==typeof r?n.props[t]=r:Array.isArray(r)?n.props[t]=`[Array(${r.length})]`:"object"==typeof r?n.props[t]="[Object]":"function"==typeof r&&(n.props[t]="[Function]")}return e.cachedLayoutMetrics&&(n.layout={x:e.cachedLayoutMetrics.left||0,y:e.cachedLayoutMetrics.top||0,width:e.cachedLayoutMetrics.width||0,height:e.cachedLayoutMetrics.height||0}),e.children&&e.children.length>0&&(n.children=e.children.map(e=>t(e,r+1,s)).filter(t=>null!==t)),n},serializeViewport:n});const i=e(t(import.meta.url));class a{constructor(t={}){this.config={port:3e3,host:"localhost",captureConsole:!0,treeCaptureIntervalMs:2e3,treeMaxDepth:4,memoryStatsIntervalMs:5e3,...t},this.clients=new Set,this.eventBuffer=[],this.maxBufferSize=500,this.server=null,this.vuettyInstance=null,this.consoleInterceptor=null,this.latestLayoutTree=null,this.lastTreeCapture=0,this.latestMemoryStats=null,this.memoryStatsInterval=null,this.cleanupInterval=null}shallowSerialize(t){if(null==t)return t;if("object"!=typeof t)return t;try{return JSON.parse(JSON.stringify(t))}catch{return{error:"Serialization failed"}}}setVuettyInstance(t){this.vuettyInstance=t}async start(){if(this.server)return;const t=this,e=r(i,"static");try{this.server=Bun.serve({port:this.config.port,hostname:this.config.host,fetch(t,s){if(s.upgrade(t))return;const n=new URL(t.url),o={"/":"index.html","/debug.js":"debug.js","/debug.css":"debug.css","/favicon.ico":"favicon.ico"},i=o[n.pathname];if(!i){const t=`404: ${n.pathname}\nAvailable routes: ${Object.keys(o).join(", ")}`;return new Response(t,{status:404})}const a=r(e,i),l=Bun.file(a);return new Response(l)},websocket:{open(e){t.clients.add(e);const r=t.eventBuffer.slice(-50);e.send(JSON.stringify({type:"init",data:{viewport:t.vuettyInstance?n(t.vuettyInstance.viewport):null,buffer:r,layoutTree:t.latestLayoutTree,memory:t.latestMemoryStats}}))},close(e){t.clients.delete(e)},message(e,r){try{"clear"===JSON.parse(r).type&&(t.eventBuffer=[],t.broadcast({type:"cleared",data:{}}))}catch(t){}}}}),this.config.captureConsole&&(this.consoleInterceptor=new s(this),this.consoleInterceptor.activate()),this.startMemoryStats(),this.startCleanupInterval(),this.captureEvent("debug.server.started",{port:this.config.port,host:this.config.host,url:`http://${this.config.host}:${this.config.port}`})}catch(t){throw new Error(`Failed to start debug server: ${t.message}`)}}stop(){if(this.server){this.stopMemoryStats(),this.stopCleanupInterval(),this.consoleInterceptor&&(this.consoleInterceptor.deactivate(),this.consoleInterceptor=null);for(const t of this.clients)t.close();this.clients.clear(),this.server.stop(),this.server=null,this.eventBuffer=[],this.latestLayoutTree=null,this.latestMemoryStats=null}}interceptVueWarnings(t){this.consoleInterceptor&&this.consoleInterceptor.interceptVueWarnings(t)}captureRenderComplete({duration:t,outputLength:e,rootContainer:r}){if(this.captureEvent("render.complete",{duration:t,outputLength:e}),!r)return;const s=Date.now();s-this.lastTreeCapture<this.config.treeCaptureIntervalMs||(this.lastTreeCapture=s,Promise.resolve().then(function(){return o}).then(({serializeNodeTree:t})=>{const e=t(r,0,this.config.treeMaxDepth);this.latestLayoutTree=e,this.broadcast({timestamp:Date.now(),type:"layout.tree",data:{tree:e}})}).catch(()=>{}))}startMemoryStats(){this.memoryStatsInterval||!this.config.memoryStatsIntervalMs||this.config.memoryStatsIntervalMs<=0||(this.memoryStatsInterval=setInterval(()=>{if(!this.vuettyInstance||"function"!=typeof this.vuettyInstance.getMemoryStats)return;const t=this.vuettyInstance.getMemoryStats();this.latestMemoryStats=t,this.broadcast({timestamp:t.timestamp||Date.now(),type:"vuetty.memory",data:t})},this.config.memoryStatsIntervalMs))}stopMemoryStats(){this.memoryStatsInterval&&(clearInterval(this.memoryStatsInterval),this.memoryStatsInterval=null)}startCleanupInterval(){this.cleanupInterval||(this.cleanupInterval=setInterval(()=>{this.eventBuffer.length>200&&(this.eventBuffer=this.eventBuffer.slice(-200))},3e4))}stopCleanupInterval(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}captureEvent(t,e){const r={timestamp:Date.now(),type:t,data:this.shallowSerialize(e)};this.eventBuffer.push(r),this.eventBuffer.length>this.maxBufferSize&&this.eventBuffer.shift(),this.broadcast(r)}broadcast(t){const e=JSON.stringify(t);for(const t of this.clients)try{t.send(e)}catch(e){this.clients.delete(t)}}}export{a as DebugServer};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Component, DefineComponent } from "vue";
|
|
2
|
+
|
|
3
|
+
export interface VuettyOptions {
|
|
4
|
+
theme?: Record<string, any>;
|
|
5
|
+
debugServer?: boolean | Record<string, any>;
|
|
6
|
+
viewport?: Record<string, any>;
|
|
7
|
+
forceColors?: boolean;
|
|
8
|
+
scrollIndicatorMode?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class Vuetty {
|
|
13
|
+
constructor(options?: VuettyOptions);
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function createVuetty(options?: VuettyOptions): Vuetty;
|
|
18
|
+
export function vuetty(component: Component, options?: VuettyOptions): Vuetty;
|
|
19
|
+
|
|
20
|
+
export class TUINode {
|
|
21
|
+
constructor(type: string);
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
export class TextNode extends TUINode {}
|
|
25
|
+
export class CommentNode extends TUINode {}
|
|
26
|
+
|
|
27
|
+
export function createTUIRenderer(options?: Record<string, any>): any;
|
|
28
|
+
export function renderToString(root: any): string;
|
|
29
|
+
|
|
30
|
+
export const Box: DefineComponent<any, any, any>;
|
|
31
|
+
export const TextBox: DefineComponent<any, any, any>;
|
|
32
|
+
export const Row: DefineComponent<any, any, any>;
|
|
33
|
+
export const Col: DefineComponent<any, any, any>;
|
|
34
|
+
export const Divider: DefineComponent<any, any, any>;
|
|
35
|
+
export const Spacer: DefineComponent<any, any, any>;
|
|
36
|
+
export const Newline: DefineComponent<any, any, any>;
|
|
37
|
+
export const Spinner: DefineComponent<any, any, any>;
|
|
38
|
+
export const ProgressBar: DefineComponent<any, any, any>;
|
|
39
|
+
export const TextInput: DefineComponent<any, any, any>;
|
|
40
|
+
export const SelectInput: DefineComponent<any, any, any>;
|
|
41
|
+
export const Checkbox: DefineComponent<any, any, any>;
|
|
42
|
+
export const Radiobox: DefineComponent<any, any, any>;
|
|
43
|
+
export const Table: DefineComponent<any, any, any>;
|
|
44
|
+
export const Markdown: DefineComponent<any, any, any>;
|
|
45
|
+
export const Image: DefineComponent<any, any, any>;
|
|
46
|
+
export const BigText: DefineComponent<any, any, any>;
|
|
47
|
+
export const Gradient: DefineComponent<any, any, any>;
|
|
48
|
+
export const Button: DefineComponent<any, any, any>;
|
|
49
|
+
export const Tree: DefineComponent<any, any, any>;
|
|
50
|
+
|
|
51
|
+
export function clearBigTextCache(): void;
|
|
52
|
+
export function getBigTextCacheStats(): {
|
|
53
|
+
figlet: { size: number; maxSize: number };
|
|
54
|
+
final: { size: number; maxSize: number };
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export function createTheme(userTheme?: Record<string, any>): Record<string, any>;
|
|
58
|
+
export const DEFAULT_THEME: Record<string, any>;
|
|
59
|
+
export function resolveThemeColor(
|
|
60
|
+
theme: Record<string, any>,
|
|
61
|
+
path: string
|
|
62
|
+
): string | null;
|
|
63
|
+
|
|
64
|
+
export const VUETTY_INPUT_MANAGER_KEY: string;
|
|
65
|
+
export const VUETTY_THEME_KEY: string;
|
|
66
|
+
|
|
67
|
+
export class RenderContext {
|
|
68
|
+
constructor(options: any);
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}
|
|
71
|
+
export class RenderHandler {
|
|
72
|
+
render(ctx: RenderContext): string;
|
|
73
|
+
}
|
|
74
|
+
export const renderHandlerRegistry: {
|
|
75
|
+
register(type: string, handler: RenderHandler): void;
|
|
76
|
+
get(type: string): RenderHandler | null;
|
|
77
|
+
has(type: string): boolean;
|
|
78
|
+
unregister(type: string): void;
|
|
79
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRenderer as e}from"@vue/runtime-core";import{reactive as t,h as n,ref as r,watch as i,onUnmounted as o,nextTick as s,inject as l,computed as a,provide as c,onMounted as h}from"vue";import u from"chalk";import d from"string-width";import p from"terminal-image";import f from"figlet";import{readFileSync as g}from"fs";import{dirname as m,join as v}from"path";import b from"gradient-string";import{marked as y}from"marked";import{highlight as w}from"cli-highlight";import x from"yoga-layout";import{fileURLToPath as S}from"url";class C{constructor(e){this.type=e,this.props={},this.children=[],this.parent=null,this.text="",this.isDirty=!0,this.childrenDirty=!0,this.renderVersion=0,this.cachedOutput=null,this.cachedChildrenOutput=null,this.isLayoutDirty=!0,this.cachedLayoutMetrics=null,this._renderWidth=void 0,this.componentId=null,this.clickable=!1}appendChild(e){e.parent&&e.parent.removeChild(e),e.parent=this,this.children.push(e)}removeChild(e){const t=this.children.indexOf(e);-1!==t&&(this.children.splice(t,1),e.parent=null,e.clearCaches())}insertBefore(e,t){e.parent&&e.parent.removeChild(e),e.parent=this;const n=this.children.indexOf(t);-1!==n?this.children.splice(n,0,e):this.children.push(e)}setText(e){this.text=e}setProps(e){Object.assign(this.props,e)}markDirty(){this.isDirty=!0,this.cachedOutput=null,this.renderVersion++}markLayoutDirty(){this.isLayoutDirty=!0,this.renderVersion++,this.parent&&this.parent.markLayoutDirty()}invalidateChildrenCache(){this.childrenDirty=!0,this.cachedChildrenOutput=null,this.cachedOutput=null}canSkipRender(){return!this.isDirty&&!this.childrenDirty&&null!==this.cachedOutput}clearCaches(){this.cachedOutput=null,this.cachedChildrenOutput=null,this.cachedLayoutMetrics=null,this.isDirty=!0,this.childrenDirty=!0,this.isLayoutDirty=!0}cleanup(){this.clearCaches(),this.parent=null,this.props={},this.text="",this.componentId=null;for(let e=0;e<this.children.length;e++)this.children[e].cleanup();this.children=[]}}class M extends C{constructor(e=""){super("text"),this.text=e}}class k extends C{constructor(e=""){super("comment"),this.text=e}}function I(e,t){if(!e.children||0===e.children.length)return"";if(!e.childrenDirty&&null!==e.cachedChildrenOutput)return e.cachedChildrenOutput;const n=e.children,r=n.length,i=new Array(r);let o=!1;for(let e=0;e<r;e++){const r=n[e],s=r.cachedOutput;i[e]=t(r),i[e]!==s&&(o=!0)}return(o||null===e.cachedChildrenOutput)&&(e.cachedChildrenOutput=i.join("")),e.childrenDirty=!1,e.cachedChildrenOutput}function _(e){if(!e)return;e.isDirty=!0,e.cachedOutput=null;let t=e.parent;for(;t&&!t.childrenDirty;)t.childrenDirty=!0,t.cachedOutput=null,t=t.parent}function L(e,t=!1){if(!e)return;if(!t)return e.isDirty=!0,e.childrenDirty=!0,e.renderVersion++,e.cachedOutput=null,e.cachedChildrenOutput=null,void(e.cachedLayoutMetrics=null);const n=[e];let r=0;for(;n.length>0&&r<1e4;){const e=n.shift();r++,e.isDirty=!0,e.childrenDirty=!0,e.renderVersion++,e.cachedOutput=null,e.cachedChildrenOutput=null,e.cachedLayoutMetrics=null;const t=e.children;if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}const E=new Set(["width","height","flex","flexGrow","flexShrink","flexBasis","flexDirection","gap","padding","paddingLeft","paddingRight","paddingTop","paddingBottom","margin","marginLeft","marginRight","marginTop","marginBottom","border","borderStyle","rows","headers","options","showHeader","minWidth","maxWidth","minHeight","maxHeight","justifyContent","alignItems","alignSelf","alignContent","flexWrap","responsive","_injectedWidth","_viewportVersion","label","hint","validationError","isFocused","disabled","direction","autoResize","minRows","maxRows","font","length","imageLines","count","lines","text"]);const T=t({terminalWidth:80,terminalHeight:24});function B(e){e&&(T.terminalWidth=e.terminalWidth,T.terminalHeight=e.terminalHeight)}let O=[],H=!1;function R(){O=[],H=!0}function A(){H=!1;const e=O;return O=[],e}let D=class{constructor(e=5e3){this.maxSize=e,this.cache=new Map}get(e){if(!this.cache.has(e))return null;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){if(this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.maxSize){const e=this.cache.keys().next().value;this.cache.delete(e)}}has(e){return this.cache.has(e)}clear(){this.cache.clear()}get size(){return this.cache.size}};const N=new class{constructor(e={}){this.textMeasurementCache=new D(e.textCacheSize||5e3),this.layoutMetricsCache=new WeakMap,this._metricsEntryCount=0}measureText(e){return this.textMeasurementCache.get(e)}setMeasurement(e,t){this.textMeasurementCache.set(e,t)}hasMeasurement(e){return this.textMeasurementCache.has(e)}getLayoutMetrics(e,t){if(!this.layoutMetricsCache.has(e))return null;return this.layoutMetricsCache.get(e).get(t)||null}setLayoutMetrics(e,t,n){this.layoutMetricsCache.has(e)||this.layoutMetricsCache.set(e,new Map);const r=this.layoutMetricsCache.get(e);if(r.has(t)||this._metricsEntryCount++,r.set(t,n),r.size>3){const e=r.keys().next().value;r.delete(e),this._metricsEntryCount--}}invalidateLayoutMetrics(e){if(this.layoutMetricsCache.has(e)){const t=this.layoutMetricsCache.get(e);this._metricsEntryCount-=t.size,this.layoutMetricsCache.delete(e)}}clearAll(){this.textMeasurementCache.clear(),this._metricsEntryCount=0}getStats(){return{textMeasurements:this.textMeasurementCache.size,textCacheMaxSize:this.textMeasurementCache.maxSize,metricsEntries:this._metricsEntryCount,metricsMaxPerNode:3}}},W=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/,$=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i,F={black:[0,0,0],red:[205,49,49],green:[13,188,121],yellow:[229,229,16],blue:[36,114,200],magenta:[188,63,188],cyan:[17,168,205],white:[229,229,229],gray:[102,102,102],grey:[102,102,102],brightRed:[241,76,76],brightGreen:[35,209,139],brightYellow:[245,245,67],brightBlue:[59,142,234],brightMagenta:[214,112,214],brightCyan:[41,184,219],brightWhite:[255,255,255]},z=new Map;function j(e){if(!e)return u.white;const t=function(e){if(!e||"string"!=typeof e)return"";if(e.startsWith("#"))return e.toLowerCase();if(e.startsWith("rgb("))return e.replace(/\s+/g,"");return e}(e);let n=z.get(t);if(n)return n;if(n=P(e)||u.white,z.size>=50){const e=z.keys().next().value;z.delete(e)}return z.set(t,n),n}function P(e,t=u){if(!e)return null;if(t[e])return t[e];if(W.test(e))return t.hex(e);const n=e.match($);if(n){const[,e,r,i]=n,o=parseInt(e),s=parseInt(r),l=parseInt(i);if(o>=0&&o<=255&&s>=0&&s<=255&&l>=0&&l<=255)return t.rgb(o,s,l)}return null}function V(e){if(!e)return null;if(F[e]){const[t,n,r]=F[e];return`[48;2;${t};${n};${r}m`}if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length){const e=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);if(!isNaN(e)&&!isNaN(n)&&!isNaN(r))return`[48;2;${e};${n};${r}m`}}const t=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(t){return`[48;2;${parseInt(t[1],10)};${parseInt(t[2],10)};${parseInt(t[3],10)}m`}return null}const G=/^\x1b\[[0-9;]*m/,U=/\x1b\[[0-9;]*m/g,Y=/^\x1b\[0?m$/,X=(()=>{const e=new Array(201);e[0]="";for(let t=1;t<=200;t++)e[t]=" ".repeat(t);return e})();function q(e){return e<=0?"":X[e]??" ".repeat(e)}function J(e){const t=N.measureText(e);if(null!=t)return t;const n=d(e);return N.setMeasurement(e,n),n}function K(e,t){if(!e||t<=0)return"";let n=0,r="",i=0;const o=e.length;let s=!1;for(;i<o&&n<t;){const o=e.slice(i).match(G);if(o){const e=o[0];r+=e,i+=e.length,s=!Y.test(e);continue}const l=e[i],a=d(l);if(!(n+a<=t))break;r+=l,n+=a,i++}return i<o&&s&&(r+="[0m"),r}function Z(e,t){if(!t||t<=0)return e;const n=e.split("\n"),r=[];for(let e=0;e<n.length;e++){const i=n[e];if(J(i)<=t){r.push(i);continue}let o=i,s=[];for(;o.length>0;){if(J(o)<=t){r.push(o);break}let e=0,n=0,i=-1,l=0,a="";for(;n<o.length&&e<t;){const r=o.slice(n).match(G);if(r){const e=r[0];a+=e,Y.test(e)?s=[]:s.push(e),n+=e.length;continue}const c=o[n],h=d(c);if(!(e+h<=t))break;a+=c,e+=h," "===c&&(i=n,l=e),n++}let c=a,h=n;if(i>=0&&l>.3*t){c="";let e=0;for(;e<=i;){const t=o.slice(e).match(G);t?(c+=t[0],e+=t[0].length):(c+=o[e],e++)}h=i+1}s.length>0&&(c+="[0m"),r.push(c.trimEnd()),o=o.slice(h),s.length>0&&o.length>0&&(o=s.join("")+o)}}return r.join("\n")}function Q(e,t){if(!(t.bold||t.italic||t.underline||t.dim||t.color||t.bg))return e;let n=u;if(t.bold&&(n=n.bold),t.italic&&(n=n.italic),t.underline&&(n=n.underline),t.dim&&(n=n.dim),t.color){const e=P(t.color,n);e&&(n=e)}if(t.bg){const e=function(e,t=u){if(!e)return null;const n=`bg${e.charAt(0).toUpperCase()}${e.slice(1)}`;if(t[n])return t[n];if(W.test(e))return t.bgHex(e);const r=e.match($);if(r){const[,e,n,i]=r,o=parseInt(e),s=parseInt(n),l=parseInt(i);if(o>=0&&o<=255&&s>=0&&s<=255&&l>=0&&l<=255)return t.bgRgb(o,s,l)}return null}(t.bg,n);e&&(n=e)}return n(e)}class ee{constructor({node:e,depth:t,absX:n,absY:r,inRow:i,renderNodeFn:o}){this.node=e,this.depth=t,this.absX=n,this.absY=r,this.inRow=i,this._renderNode=o}get props(){return this.node.props||{}}get text(){return this.node.text||""}get children(){return this.node.children||[]}get metrics(){return this.node.cachedLayoutMetrics}getEffectiveWidth(){return void 0!==this.node._renderWidth?this.node._renderWidth:null!=this.node.props?.width?this.node.props.width:this.metrics?.width?this.metrics.width:null}renderChild(e,t={}){return this._renderNode(e,this.depth+1,{parentAbsX:t.parentAbsX??this.absX,parentAbsY:this.absY,yOffset:t.yOffset??0,inRow:t.inRow??this.inRow})}}class te{render(e){throw new Error("render() must be implemented")}}const ne=new class{constructor(){this.handlers=new Map}register(e,t){this.handlers.set(e,t)}get(e){return this.handlers.get(e)||null}has(e){return this.handlers.has(e)}unregister(e){this.handlers.delete(e)}},re={flex:{type:[Number,String],default:null},flexGrow:{type:Number,default:null},flexShrink:{type:Number,default:null},flexBasis:{type:[Number,String],default:null},alignSelf:{type:String,default:null,validator:e=>null===e||["auto","flex-start","flex-end","center","stretch","baseline"].includes(e)}},ie={width:{type:[Number,String],default:null},height:{type:[Number,String],default:null},minWidth:{type:Number,default:null},maxWidth:{type:Number,default:null},minHeight:{type:Number,default:null},maxHeight:{type:Number,default:null}},oe={padding:{type:Number,default:null},paddingLeft:{type:Number,default:null},paddingRight:{type:Number,default:null},paddingTop:{type:Number,default:null},paddingBottom:{type:Number,default:null}},se={margin:{type:Number,default:null},marginLeft:{type:Number,default:null},marginRight:{type:Number,default:null},marginTop:{type:Number,default:null},marginBottom:{type:Number,default:null}},le={...{justifyContent:{type:String,default:null,validator:e=>null===e||["flex-start","flex-end","center","space-between","space-around","space-evenly"].includes(e)},alignItems:{type:String,default:null,validator:e=>null===e||["flex-start","flex-end","center","stretch","baseline"].includes(e)},alignContent:{type:String,default:null,validator:e=>null===e||["flex-start","flex-end","center","stretch","space-between","space-around"].includes(e)},flexWrap:{type:String,default:null,validator:e=>null===e||["nowrap","wrap","wrap-reverse"].includes(e)},flexDirection:{type:String,default:null,validator:e=>null===e||["row","column","row-reverse","column-reverse"].includes(e)},gap:{type:Number,default:null}},...re,...ie,...oe,...se},ae={...re,...ie,...oe,...se};var ce={name:"Divider",props:{char:{type:String,default:"─"},length:{type:Number,default:40},color:String,...ae},setup:e=>()=>n("divider",e)};ne.register("divider",new class extends te{render(e){return function(e){const{char:t="─",length:n=40}=e;return Q(t.repeat(n)+"\n",e)}(e.props)}});const he={dots:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],line:["-","\\","|","/"],arc:["◐","◓","◑","◒"],arrow:["▹","▸","▹","▸"],bounce:["⠁","⠈","⠐","⠠","⢀","⡀","⠄","⠂"],clock:["🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚","🕛"],box:["▖","▘","▝","▗"]};var ue={name:"Spinner",props:{type:{type:String,default:"dots",validator:e=>["dots","line","arc","arrow","bounce","clock","box"].includes(e)},modelValue:{type:Boolean,default:!0},interval:{type:Number,default:100,validator:e=>e>0},label:{type:String,default:""},labelPosition:{type:String,default:"right",validator:e=>["left","right"].includes(e)},color:String,bold:Boolean,italic:Boolean,underline:Boolean,dim:Boolean,...ae},emits:["update:modelValue"],setup(e){const t=r(0),l=r(!1);let a=null;function c(){l.value||(l.value=!0,t.value=0,u())}function h(){l.value=!1,null!==a&&(clearTimeout(a),a=null),t.value=0}function u(){if(!l.value)return;const n=he[e.type]||he.dots;t.value=(t.value+1)%n.length,s(()=>{l.value&&(a=setTimeout(u,e.interval))})}return i(()=>e.modelValue,e=>{e?c():h()},{immediate:!0}),i(()=>e.type,()=>{l.value&&(t.value=0)}),i(()=>e.interval,()=>{l.value&&(h(),c())}),o(()=>{h()}),()=>n("spinner",{...e,frame:t.value})}};ne.register("spinner",new class extends te{render(e){return function(e){const{type:t="dots",frame:n=0,label:r="",labelPosition:i="right"}=e,o=he[t]||he.dots,s=o[n%o.length];return Q(("left"===i?[r,r?" ":"",s]:[s,r?" ":"",r]).join(""),e)}(e.props)}});var de={name:"Spacer",props:{count:{type:Number,default:1}},setup:e=>()=>n("spacer",e)};ne.register("spacer",new class extends te{render(e){return t=e.props," ".repeat(t&&t.count||1);var t}});var pe={name:"Newline",props:{count:{type:Number,default:1}},setup:e=>()=>n("newline",e)};ne.register("newline",new class extends te{render(e){return function(e){const t=e&&e.count||1;return"\n".repeat(t)}(e.props)}});const fe="vuetty:inputManager",ge="vuetty:viewportState",me="vuetty:instance",ve="vuetty:theme",be=Symbol("vuettyWidthContext");var ye={name:"ProgressBar",props:{value:{type:Number,required:!0,default:0},max:{type:Number,default:100},width:{type:Number,default:40},char:{type:String,default:"█"},emptyChar:{type:String,default:"░"},showPercentage:{type:Boolean,default:!0},label:{type:String,default:""},labelPosition:{type:String,default:"left",validator:e=>["left","right","above","below"].includes(e)},brackets:{type:Boolean,default:!0},color:String,emptyColor:String,percentageColor:String,bold:Boolean,italic:Boolean,underline:Boolean,dim:Boolean,...ae},setup(e){const t=l(ge,null),r=l(be,null);return()=>{const i="function"==typeof r?r():r,o={...e,_injectedWidth:i,_viewportVersion:t?t.version:0};return n("progressbar",o)}}};ne.register("progressbar",new class extends te{render(e){return function(e){const{value:t=0,max:n=100,width:r=40,char:i="█",emptyChar:o="░",showPercentage:s=!0,label:l="",labelPosition:a="left",brackets:c=!0,color:h="green",emptyColor:u="white",percentageColor:d="white"}=e,p=Math.min(100,Math.max(0,t/n*100)),f=Math.round(p/100*r),g=r-f;let m=Q(i.repeat(f),{color:h,bold:e.bold})+Q(o.repeat(g),{color:u,dim:!0});c&&(m="["+m+"]");let v="";s&&(v=Q(` ${p.toFixed(0)}%`,{color:d}));const b=m+v;return"above"===a?Q(l,e)+"\n"+b:"below"===a?b+"\n"+Q(l,e):"left"===a?Q(l,e)+(l?" ":"")+b:b+(l?" ":"")+Q(l,e)}(e.props)}});const we="up",xe="down",Se="left",Ce="right",Me="enter",ke="backspace",Ie="delete",_e="escape",Le="home",Ee="end",Te="pageup",Be="pagedown",Oe="ctrl_c",He="ctrl_d",Re="ctrl_a",Ae="ctrl_e",De="ctrl_enter",Ne={"[A":we,"[B":xe,"[C":Ce,"[D":Se,"[1;2A":we,"[1;2B":xe,"[1;2C":Ce,"[1;2D":Se,"[H":Le,"[F":Ee,"[1~":Le,"[4~":Ee,"[5~":Te,"[6~":Be,"[3~":Ie,"\r":Me,"\n":Me,"":ke,"\b":ke,"\t":"tab","":_e,"":Oe,"":He,"":Re,"":Ae,"\v":"ctrl_k","":"ctrl_w","\r":De,"\n":De};function We(e){return"char"===e.key&&null!==e.char}const $e=0,Fe=1,ze=2,je=64,Pe=65,Ve=4,Ge=8,Ue=16,Ye=32;function Xe(e){let t=e.match(/^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/),n=!0;if(!t&&(t=e.match(/^\x1b\[(\d+);(\d+);(\d+)M$/),n=!1,!t))return null;const r=parseInt(t[1],10),i=parseInt(t[2],10),o=parseInt(t[3],10),s=n&&"m"===t[4],l=-61&r;let a;return a=l===je?"wheel_up":l===Pe?"wheel_down":0!==(r&Ye)&&l<=ze?"drag":l===$e?s?"left_release":"left_click":l===Fe?s?"middle_release":"middle_click":l===ze?s?"right_release":"right_click":"unknown",{type:"mouse",action:a,button:l,x:i,y:o,shift:0!==(r&Ve),ctrl:0!==(r&Ue),alt:0!==(r&Ge)}}let qe=0;var Je={name:"Table",props:{modelValue:{type:Number,default:null},headers:{type:Array,required:!0,default:()=>[]},rows:{type:Array,required:!0,default:()=>[]},label:{type:String,default:""},height:{type:Number,default:10},columnWidths:{type:Array,default:null},striped:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},color:String,bg:String,focusColor:{type:String,default:"cyan"},selectedColor:{type:String,default:"green"},highlightColor:{type:String,default:"yellow"},headerColor:{type:String,default:"white"},stripedColor:{type:String,default:"black"},bold:Boolean,dim:Boolean,...ae},emits:["update:modelValue","change","focus","blur","select"],setup(e,{emit:t}){const s=l(fe),c=l(me,null),h=l(ge,null),u=l(be,null),d="table-"+ ++qe,p=r(0),f=r(0),g=a(()=>null===e.modelValue||void 0===e.modelValue?-1:e.modelValue),m=a(()=>s&&s.isFocused(d));function v(){p.value<f.value?f.value=p.value:p.value>=f.value+e.height&&(f.value=p.value-e.height+1)}function b(){p.value>0&&(p.value--,v())}function y(){p.value<e.rows.length-1&&(p.value++,v())}function w(){p.value=0,v()}return i(m,(e,n)=>{e&&!n?t("focus"):!e&&n&&t("blur")}),i(()=>e.rows,()=>{p.value>=e.rows.length&&(p.value=Math.max(0,e.rows.length-1),v())}),s&&s.registerComponent(d,function(n){if(!e.disabled)if(n.key!==we)if(n.key!==xe)if(n.key!==Le){if(n.key===Ee)return p.value=e.rows.length-1,void v();if(n.key!==Te)if(n.key!==Be)n.key!==Me&&" "!==n.char||0!==e.rows.length&&(t("update:modelValue",p.value),t("change",p.value),t("select",{index:p.value,row:e.rows[p.value]}));else for(let t=0;t<e.height;t++)y();else for(let t=0;t<e.height;t++)b()}else w();else y();else b()},{disabled:e.disabled}),c&&c.registerClickHandler(d,function(t){e.disabled||s.focus(d)}),g.value>=0&&g.value<e.rows.length?(p.value=g.value,v()):e.rows.length>0&&w(),o(()=>{s&&s.unregisterComponent(d),c&&c.unregisterClickHandler(d)}),i(()=>e.disabled,e=>{s&&s.setComponentDisabled(d,e)}),()=>{const t="function"==typeof u?u():u,r=e.rows,i=e.headers;return n("table",{...e,rows:Array.isArray(r)?[...r]:r,headers:Array.isArray(i)?[...i]:i,highlightedIndex:p.value,selectedIndex:g.value,scrollOffset:f.value,isFocused:m.value,_componentId:d,_clickable:!0,_injectedWidth:t,_viewportVersion:h?h.version:0})}}};function Ke(e,t,n,r,i,o,s){const{highlightColor:l,selectedColor:a,isFocused:c,disabled:h}=s;let d=n("│");for(let s=0;s<t.length;s++){const p=String(e[s]||""),f=t[s]-2;let g=p;J(p)>f&&(g=p.substring(0,f-1)+"…");const m=J(g);g=" "+g+" ".repeat(f-m+1);let v=g;if(r&&c&&!h){v=(u[l]?u[l].bold.inverse:u.bold.inverse)(g)}else if(i){v=(u[a]?u[a].bold:u.bold)(g)}else o&&(v=u.bgBlack(g));d+=v+n("│")}return d+"\n"}function Ze(e,t){let n=t("│");for(let r=0;r<e.length;r++)n+=" ".repeat(e[r])+t("│");return n+"\n"}function Qe(e){const{headers:t=[],rows:n=[],label:r="",height:i=10,highlightedIndex:o=0,selectedIndex:s=-1,scrollOffset:l=0,isFocused:a=!1,showHeader:c=!0,striped:h=!0,columnWidths:d=null,focusColor:p="cyan",selectedColor:f="green",highlightColor:g="yellow",headerColor:m="white",stripedColor:v="black",disabled:b=!1}=e;let y="";if(r){y+=Q(a&&!b?u.bold(r):r,e)+"\n"}if(0===t.length&&0===n.length)return y+function(e,t,n){const r=e?t:n.color||"white",i=e?(u[r]||u).bold:u[r]||u;let o="";return o+=i("┌"+"─".repeat(22)+"┐")+"\n",o+=i("│")+" No data".padEnd(22," ")+i("│")+"\n",o+=i("└"+"─".repeat(22)+"┘")+"\n",o}(a,p,e);const w=function(e,t,n){if(n&&n.length>0)return n;const r=Math.max(e.length,...t.map(e=>e.length)),i=Array.from({length:r},()=>0);for(let t=0;t<e.length;t++){const n=String(e[t]||"");i[t]=Math.max(i[t],J(n))}for(const e of t)for(let t=0;t<e.length;t++){const n=String(e[t]||"");i[t]=Math.max(i[t],J(n))}return i.map(e=>e+2)}(t,n,d),x=a&&!b?p:e.color||"white",S=a&&!b?(u[x]||u).bold:u[x]||u;y+=function(e,t){let n="┌";for(let t=0;t<e.length;t++)n+="─".repeat(e[t]),t<e.length-1&&(n+="┬");return n+="┐",t(n)+"\n"}(w,S),c&&t.length>0&&(y+=function(e,t,n,r){let i=n("│");for(let o=0;o<t.length;o++){const s=String(e[o]||""),l=t[o]-2;let a=s;J(s)>l&&(a=s.substring(0,l-1)+"…");const c=J(a);a=" "+a+" ".repeat(l-c+1),i+=(u[r]?u[r].bold:u.bold)(a)+n("│")}return i+"\n"}(t,w,S,m),y+=function(e,t){let n="├";for(let t=0;t<e.length;t++)n+="─".repeat(e[t]),t<e.length-1&&(n+="┼");return n+="┤",t(n)+"\n"}(w,S));const C=n.slice(l,l+i);for(let e=0;e<i;e++){const t=l+e,n=C[e];if(n){y+=Ke(n,w,S,a&&t===o,t===s,h&&t%2==1,{highlightColor:g,selectedColor:f,isFocused:a,disabled:b})}else y+=Ze(w,S)}if(y+=function(e,t){let n="└";for(let t=0;t<e.length;t++)n+="─".repeat(e[t]),t<e.length-1&&(n+="┴");return n+="┘",t(n)+"\n"}(w,S),a&&!b&&(y+=u.dim("↑↓ Navigate • Enter/Space to select • Tab to next field")+"\n"),n.length>i){const e=Math.round(l/Math.max(1,n.length-i)*100);y+=u.dim(`[${e}% - showing ${l+1}-${Math.min(l+i,n.length)} of ${n.length} rows]`)+"\n"}return y}function et(e,t){if(!e||t<=0)return"";const n=e.split("\n"),r=n.length;if(r===t)return e;if(r<t){const e=t-r;for(let t=0;t<e;t++)n.push("");return n.join("\n")}return n.slice(0,t).join("\n")}ne.register("table",new class extends te{render(e){return Qe(e.props)}});const tt=Symbol("vuettyHeightContext"),nt=/\n+$/;class rt{constructor(e=30){this.lines=new Array(e),this.index=0}append(e){if(this.index>=this.lines.length){const e=new Array(2*this.lines.length);for(let t=0;t<this.lines.length;t++)e[t]=this.lines[t];this.lines=e}this.lines[this.index++]=e}toString(){if(0===this.index)return"";if(1===this.index)return this.lines[0];let e=this.lines[0];for(let t=1;t<this.index;t++)e+="\n"+this.lines[t];return e}clear(){for(let e=0;e<this.index;e++)this.lines[e]=null;this.index=0}}const it=[];const ot=new Map;const st={rounded:{topLeft:"╭",topRight:"╮",bottomLeft:"╰",bottomRight:"╯",horizontal:"─",vertical:"│"},square:{topLeft:"┌",topRight:"┐",bottomLeft:"└",bottomRight:"┘",horizontal:"─",vertical:"│"},double:{topLeft:"╔",topRight:"╗",bottomLeft:"╚",bottomRight:"╝",horizontal:"═",vertical:"║"},classic:{topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|"},bold:{topLeft:"┏",topRight:"┓",bottomLeft:"┗",bottomRight:"┛",horizontal:"━",vertical:"┃"},dashed:{topLeft:"┌",topRight:"┐",bottomLeft:"└",bottomRight:"┘",horizontal:"╌",vertical:"╎"},sparse:{topLeft:"·",topRight:"·",bottomLeft:"·",bottomRight:"·",horizontal:"·",vertical:"·"},light:{topLeft:"┌",topRight:"┐",bottomLeft:"└",bottomRight:"┘",horizontal:" ",vertical:" "},button:{topLeft:"╭",topRight:"╮",bottomLeft:"╰",bottomRight:"╯",horizontal:"─",vertical:"│"}};var lt={name:"Box",props:{border:{type:Boolean,default:!0},borderStyle:{type:[String,Object],default:"rounded"},color:String,bg:String,bold:Boolean,italic:Boolean,underline:Boolean,dim:Boolean,title:{type:String,default:null},titleAlign:{type:String,default:"left",validator:e=>["left","center","right"].includes(e)},titlePadding:{type:Number,default:1},...ae,padding:{type:Number,default:0}},setup(e,{slots:t}){const r=l(be,null),i=l(tt,null),o=l(ge,null),s=l(ve,null);let a,h;c(be,()=>{const t=(null!==e.width&&void 0!==e.width?e.width:"function"==typeof r?r():r||T.terminalWidth||process.stdout.columns||80)-(e.border?2:0)-2*e.padding;return t>0?t:null}),c(tt,()=>{const t=null!==e.height&&void 0!==e.height?e.height:"function"==typeof i?i():i;if(null==t)return null;const n=t-(e.border?2:0)-2*e.padding;return n>0?n:null});let u=-1,d=null;return()=>{const l=t.default?t.default():[],c="function"==typeof r?r():r,p="function"==typeof i?i():i,f=o?o.version:0;if(c!==a||p!==h||f!==u||!d){a=c,h=p,u=f;const t=void 0!==e.color?e.color:s?.components?.box?.color,n=void 0!==e.bg?e.bg:s?.components?.box?.bg;d={...e,_injectedWidth:c,_injectedHeight:p,_viewportVersion:f},null!=t&&(d.color=t),null!=n&&(d.bg=n)}return n("box",d,l)}}};function at(e,t){return t&&e?e.replace(/\x1b\[0m/g,"[0m"+t):e}function ct(e,t,n){const{border:r=!1,borderStyle:i="rounded",padding:o=0,paddingLeft:s,paddingRight:l,paddingTop:a,paddingBottom:c,width:h,_injectedWidth:u,_targetHeight:d,title:p=null,titleAlign:f="left",titlePadding:g=1,bg:m,color:v}=t,b=null!=s?s:o,y=null!=l?l:o,w=null!=a?a:o,x=null!=c?c:o;let S=null;if(void 0!==d&&d>0){const e=r?2:0,t=w+x;S=Math.max(0,d-e-t)}const C=m;if(!r&&0===b&&0===y&&0===w&&0===x&&!C)return null!=h?Z(e,h):null!=u?Z(e,u):e.replace(nt,"");const M=r?"string"==typeof i?st[i]||st.rounded:i:{topLeft:" ",topRight:" ",bottomLeft:" ",bottomRight:" ",horizontal:" ",vertical:" "},k=r?2:0,I=b+y;let _,L,E=0;if(p&&p.trim()){E=J(p)+2*g+4}if(null!=h)_=Math.max(0,h-k),E>0&&(_=Math.max(_,E)),L=Math.max(0,_-I);else if(null!=u)L=Math.max(0,u),_=L+I,E>0&&(_=Math.max(_,E),L=Math.max(0,_-I));else{const t=e.split("\n");let n=0;for(let e=0;e<t.length;e++){const r=t[e];if(""!==r.trim()){const e=J(r);e>n&&(n=e)}}_=Math.max(n+I,E),L=Math.max(0,_-I)}let T=e;L>0&&(null!=h||null!=u)&&(T=Z(e,L)),null!==S&&S>0&&(T=et(T,S));let B=T.split("\n");if(null===S||0===S)for(;B.length>0&&""===B[B.length-1].trim();)B.pop();const O=q(b),H=q(y),R=it.pop()||new rt(30),A=C?V(C):null,D=A||"",N=v?function(e){if(!e)return null;const t={black:"[30m",red:"[31m",green:"[32m",yellow:"[33m",blue:"[34m",magenta:"[35m",cyan:"[36m",white:"[37m",gray:"[90m",grey:"[90m",brightRed:"[91m",brightGreen:"[92m",brightYellow:"[93m",brightBlue:"[94m",brightMagenta:"[95m",brightCyan:"[96m",brightWhite:"[97m"};if(t[e])return t[e];if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length){const e=parseInt(t.slice(0,2),16),n=parseInt(t.slice(2,4),16),r=parseInt(t.slice(4,6),16);if(!isNaN(e)&&!isNaN(n)&&!isNaN(r))return`[38;2;${e};${n};${r}m`}}const n=e.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(n)return`[38;2;${parseInt(n[1],10)};${parseInt(n[2],10)};${parseInt(n[3],10)}m`;return null}(v):"";try{if(r){let e;if(p&&p.trim()){const n=q(g)+p+q(g),r=J(n);if(r>_-4){const n=_-4-2*g,r=K(p,Math.max(1,n-1))+"…",i=q(g)+r+q(g),o=_-J(i);let s=Q(i,t);A&&(s=at(s,A));const l=M.topLeft+M.horizontal.repeat(2);e=D+N+l+"[0m"+s+D+N+(M.horizontal.repeat(Math.max(0,o-2))+M.topRight)+"[0m"}else{const i=_-r;let o,s;switch(f){case"right":o=i-2,s=2;break;case"center":o=Math.floor(i/2),s=i-o;break;default:o=2,s=i-2}let l=Q(n,t);A&&(l=at(l,A));const a=M.topLeft+M.horizontal.repeat(Math.max(0,o));e=D+N+a+"[0m"+l+D+N+(M.horizontal.repeat(Math.max(0,s))+M.topRight)+"[0m"}}else e=M.topLeft+M.horizontal.repeat(_)+M.topRight,e=D+N+e+"[0m";R.append(e)}if(w>0){let e;if(r){const t=q(_);e=D+N+M.vertical+"[0m"+D+t+"[0m"+D+N+M.vertical+"[0m"}else e=D+q(_)+"[0m";for(let t=0;t<w;t++)R.append(e)}for(let e=0;e<B.length;e++){const t=B[e],n=J(t),i=q(Math.max(0,L-n)),o=A?at(t,A):t;let s;s=r?D+N+M.vertical+"[0m"+D+O+o+D+i+H+"[0m"+D+N+M.vertical:D+O+o+D+i+H,R.append(s+"[0m")}if(0===B.length&&(r||A)){let e;if(r){const t=q(_);e=D+N+M.vertical+D+t+D+N+M.vertical}else e=D+q(_);R.append(e+"[0m")}if(x>0){let e;if(r){const t=q(_);e=D+N+M.vertical+"[0m"+D+t+"[0m"+D+N+M.vertical+"[0m"}else e=D+q(_)+"[0m";for(let t=0;t<x;t++)R.append(e)}if(r){const e=M.bottomLeft+M.horizontal.repeat(_)+M.bottomRight;R.append(D+N+e+"[0m")}return R.toString()}finally{!function(e){e.clear(),it.length<5&&it.push(e)}(R)}}function ht(e){if(!e)return 0;let t=1;for(let n=0;n<e.length;n++)10===e.charCodeAt(n)&&t++;return t}ne.register("box",new class extends te{render(e){const{node:t,depth:n,absX:r}=e,i=e.props,o=!1!==i.border,s=i.paddingTop??i.padding??0,l=i.paddingLeft??i.padding??0,a=(o?1:0)+s,c=(o?1:0)+l;let h;if(e.children.length>0){if(!e.children.some(e=>"newline"===e.type)&&e.children.length>1){const t=[];let n=0;for(const i of e.children){if("comment"===i.type)continue;const o=e.renderChild(i,{parentAbsX:r+c,yOffset:a+n,inRow:!1});o&&(t.push(o),n+=ht(o))}h=t.join("\n")}else{let n=0;h=I(t,t=>{const i=e.renderChild(t,{parentAbsX:r+c,yOffset:a+n,inRow:!1});return n+=ht(i),i})}}else h=e.text;const u=e.getEffectiveWidth(),d=null!==u&&null==i.width;d&&(t.props.width=u);const p=ct(h,i);return d&&delete t.props.width,p}});var ut={name:"TextBox",props:{color:String,bg:String,bold:Boolean,italic:Boolean,underline:Boolean,dim:Boolean,...ae},setup(e,{slots:t}){const r=l(ge,null),i=l(be,null),o=l(ve,null);let s,a=-1,c="",h=null;return()=>{const l=t.default?t.default():[],u="function"==typeof i?i():i,d=r?r.version:0,p=`${e.color}|${e.bg}|${e.bold}|${e.italic}|${e.underline}|${e.dim}|${e.width}`;if(u!==s||d!==a||p!==c||!h){s=u,a=d,c=p;const t=void 0!==e.color?e.color:o?.foreground,n=void 0!==e.bg?e.bg:o?.components?.textBox?.bg;h={bold:e.bold,italic:e.italic,underline:e.underline,dim:e.dim,width:e.width,padding:e.padding,paddingLeft:e.paddingLeft,paddingRight:e.paddingRight,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,_injectedWidth:u,_viewportVersion:d},null!=t&&(h.color=t),null!=n&&(h.bg=n)}return n("textbox",h,l)}}};ne.register("textbox",new class extends te{render(e){const{node:t}=e;let n=e.text;if(!n){let r=0;n=I(t,t=>{const n=e.renderChild(t,{yOffset:r});return r+=function(e){if(!e)return 0;let t=1;for(let n=0;n<e.length;n++)10===e.charCodeAt(n)&&t++;return t}(n),n})}const r=e.getEffectiveWidth(),i=null!==r&&null==e.props.width;i&&(t.props.width=r);const o=function(e,t){if(!e)return"";const{_injectedWidth:n,_targetHeight:r,width:i,paddingTop:o,paddingBottom:s,paddingLeft:l,paddingRight:a,padding:c=0}=t||{},h=null!=l?l:c,u=null!=a?a:c,d=null!=o?o:c,p=null!=s?s:c,f=null!=i?i:n;let g=e;f&&f>0&&(g=Z(g,Math.max(0,f-h-u)));if(void 0!==r&&r>0){const e=Math.max(0,r-d-p);e>0&&(g=et(g,e))}if(g=Q(g,t||{}),h>0||u>0){const e=g.split("\n"),t=q(h);g=e.map(e=>{const n=J(e),r=q(u+(f?Math.max(0,f-h-u-n):0));return t+e+r}).join("\n")}if(d>0||p>0){const e=g.split("\n"),t=q(f||(e.length>0?J(e[0]):0));for(let n=0;n<d;n++)e.unshift(t);for(let n=0;n<p;n++)e.push(t);g=e.join("\n")}return g}(n,e.props);return i&&delete t.props.width,o}});const dt=new Map;var pt={name:"Image",props:{src:{type:[String,Object],required:!0},width:{type:[Number,String],default:null},height:{type:[Number,String],default:null},preserveAspectRatio:{type:Boolean,default:!0},alt:{type:String,default:""},errorColor:{type:String,default:"red"},errorBorderStyle:{type:String,default:"rounded"},...ae},setup(e){const t=r(null),o=r(!0),s=r(null),l=r(!1),a=r(1);async function c(){o.value=!0,s.value=null;try{l.value=Buffer.isBuffer(e.src);const s=function(){const t=process.stdout.columns||80;if(!e.width&&!e.height){const n=e.maxWidth||t;return Math.min(n,t)}if(e.width){if("number"==typeof e.width)return e.width;if("string"==typeof e.width&&e.width.endsWith("%"))return Math.floor(t*parseFloat(e.width)/100)}return t}(),h=(n=e.src,r=s,i=e.height,c=e.preserveAspectRatio,`${Buffer.isBuffer(n)?`buffer:${n.length}:${n.slice(0,16).toString("hex")}`:`file:${n}`}|${r}|${i}|${c}`),u=dt.get(h);if(u)return t.value=u.data,a.value=u.lines,void(o.value=!1);let d;if(l.value)d=e.src;else{const t=Bun.file(e.src);if(!await t.exists())throw new Error("File not found");d=Buffer.from(await t.arrayBuffer())}const f={width:s,preserveAspectRatio:e.preserveAspectRatio},g=await p.buffer(d,{...f,preferNativeRender:!1}),m=g.split("\n").length;if(dt.size>=20){const e=dt.keys().next().value;dt.delete(e)}dt.set(h,{data:g,lines:m}),a.value=m,t.value=g,o.value=!1}catch(t){s.value={message:t.message||"Failed to load image",path:l.value?"[Buffer]":e.src,code:t.code},o.value=!1}var n,r,i,c}return h(()=>{c()}),i(()=>e.src,()=>{c()}),i(()=>[e.width,e.height,e.maxWidth],()=>{t.value&&!o.value&&c()}),()=>s.value?n(lt,{border:!0,borderStyle:e.errorBorderStyle,padding:1,color:e.errorColor,width:e.width,minWidth:e.minWidth,maxWidth:e.maxWidth},{default:()=>[n(ut,{color:e.errorColor,bold:!0},{default:()=>"✗ Image Load Error"}),n(pe),n(pe),n(ut,{dim:!0},{default:()=>`Path: ${s.value.path}`}),n(pe),n(ut,{},{default:()=>`Error: ${s.value.message}`}),...e.alt?[n(pe),n(pe),n(ut,{italic:!0},{default:()=>`Alt text: ${e.alt}`})]:[]]}):o.value?n(ut,{dim:!0},{default:()=>"Loading image..."}):n("image",{imageData:t.value,imageLines:a.value,width:e.width,minWidth:e.minWidth,maxWidth:e.maxWidth})}};ne.register("image",new class extends te{render(e){return function(e){const{imageData:t=""}=e;return t||""}(e.props)}});const ft="├",gt="└",mt="│",vt="──";var bt={name:"Tree",props:{data:{type:Array,required:!0,default:()=>[]},color:String,bg:String,branchColor:{type:String,default:"gray"},folderColor:{type:String,default:"blue"},fileColor:{type:String,default:null},bold:Boolean,dim:Boolean,indent:{type:Number,default:4},showIcons:{type:Boolean,default:!1},...ae},setup(e,{slots:t}){const r=l(be,null),i=l(ge,null),o=l(ve,null);return()=>{const s="function"==typeof r?r():r,l=t.node||t.default||null,a=t.icon||null,c=e.branchColor??o?.components?.tree?.branchColor??"gray",h=e.folderColor??o?.components?.tree?.folderColor??"blue",u=e.fileColor??o?.components?.tree?.fileColor??e.color??null;return n("tree",{...e,branchColor:c,folderColor:h,fileColor:u,_injectedWidth:s,_viewportVersion:i?i.version:0,_nodeSlot:l,_iconSlot:a})}}};ne.register("tree",new class extends te{render(e){return function(e){const{data:t=[],branchColor:n="gray",folderColor:r="blue",fileColor:i=null,showIcons:o=!1}=e;if(!t||0===t.length)return"";const s=[],l=P(n)||u,a=P(r)||u,c=P(i)||u;function h(e,t,n,r){const i=e.children&&e.children.length>0,d=i;let p="";r>0&&(p=l(n?gt+vt+" ":ft+vt+" "));let f="";o&&(f=d?"📁 ":"📄 ");const g=e.name||"";let m;if(e.color){const t=P(e.color)||u;m=d?t.bold(g):t(g)}else m=d?a.bold(g):c(g);if(s.push(t+p+f+m),i){const i=e.children.length;for(let o=0;o<i;o++){const s=e.children[o],a=o===i-1;let c;c=0===r?"":t+(n?" ":l(mt)+" "),h(s,c,a,r+1)}}}const d=t.length;for(let e=0;e<d;e++)h(t[e],"",!0,0);return s.join("\n")}(e.props)}});class yt{constructor(e=100){this.maxSize=e,this.cache=new Map}get(e){if(!this.cache.has(e))return null;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){if(this.cache.has(e)&&this.cache.delete(e),this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;this.cache.delete(e)}this.cache.set(e,t)}has(e){return this.cache.has(e)}clear(){this.cache.clear()}get size(){return this.cache.size}}function wt(e){if(!f.figFonts||!f.figFonts[e])try{let t;try{const n=import.meta.resolve?.("figlet")||"";if(n){const r=m(n.replace("file://","")),i=v(r,"fonts",`${e}.flf`);t=g(i,"utf-8")}}catch{}if(!t)try{const n=v(process.cwd(),"node_modules","figlet","fonts",`${e}.flf`);t=g(n,"utf-8")}catch{}t&&f.parseFont(e,t)}catch(t){console.warn(`Could not preload font "${e}":`,t.message)}}const xt=["Terrace","Standard","Big","Slant"];for(const e of xt)wt(e);const St=new yt(50),Ct=new yt(100);var Mt={name:"BigText",props:{font:{type:String,default:"Standard"},horizontalLayout:{type:String,default:"default"},align:{type:String,default:"left",validator:e=>["left","center","right"].includes(e)},color:String,bg:String,bold:Boolean,italic:Boolean,underline:Boolean,dim:Boolean,...ae},setup:(e,{slots:t})=>()=>{const r=t.default?t.default():[];return n("bigtext",e,r)}};function kt(e,t){if(!e)return"";const{font:n="Standard",horizontalLayout:r="default",align:i="left"}=t||{},o=function(e,t){const{font:n="Standard",horizontalLayout:r="default",align:i="left"}=t||{};return`${e}|${n}|${r}|${i}|${[t?.color||"",t?.bg||"",t?.bold?"B":"",t?.italic?"I":"",t?.underline?"U":"",t?.dim?"D":""].join("")}`}(e,t),s=Ct.get(o);if(null!==s)return s;const l=function(e,t,n){return`${e}|${t}|${n}`}(e,n,r);let a=St.get(l);if(null===a){a=f.textSync(e,{font:n,horizontalLayout:r});const t=a.split("\n");for(;t.length>0&&""===t[t.length-1].trim();)t.pop();a=t.join("\n"),St.set(l,a)}if("left"!==i){const e=a.split("\n"),t=Math.max(...e.map(e=>J(e))),n=e.map(e=>function(e,t,n="left"){const r=t-J(e);if(r<=0)return e;switch(n){case"right":return q(r)+e;case"center":{const t=r>>1;return q(t)+e+q(r-t)}default:return e+q(r)}}(e,t,i));a=n.join("\n")}let c=a;return t&&(t.color||t.bg||t.bold||t.italic||t.underline||t.dim)&&(c=Q(a,t)),Ct.set(o,c),c}function It(){St.clear(),Ct.clear()}function _t(){return{figlet:{size:St.size,maxSize:50},final:{size:Ct.size,maxSize:100}}}ne.register("bigtext",new class extends te{render(e){const{node:t}=e;return kt(e.text||I(t,t=>e.renderChild(t)),e.props)}});const Lt={fire:["#8B0000","#FF4500","#FFD700"],ocean:["#001F3F","#0074D9","#7FDBFF"],sunset:["#4A148C","#FF6F00","#FFD54F"],forest:["#1B5E20","#66BB6A","#C5E1A5"],night:["#1A237E","#5E35B1","#EC407A"]},Et=new Map;var Tt={name:"Gradient",props:{name:{type:String,default:null},colors:{type:Array,default:null},interpolation:{type:String,default:"hsv",validator:e=>["rgb","hsv"].includes(e)},...ae},setup:(e,{slots:t})=>()=>{const r=t.default?t.default():[];return n("gradient",e,r)}};function Bt(e,t){if(!e)return"";const{name:n=null,colors:r=null,interpolation:i="hsv"}=t||{},o=e.replace(U,"");const s=function(e,t,n){const r=t?`custom:${t.join(",")}:${n}`:`preset:${e}:${n}`;let i=Et.get(r);if(i)return i;const o={interpolation:n};if(i=t&&Array.isArray(t)&&t.length>0?b(t,o):e&&b[e]?b[e]:e&&Lt[e]?b(Lt[e],o):b.rainbow,Et.size>50){const e=Et.keys().next().value;Et.delete(e)}return Et.set(r,i),i}(n,r,i);return o.includes("\n")?s.multiline(o):s(o)}ne.register("gradient",new class extends te{render(e){const{node:t}=e;return Bt(e.text||I(t,t=>e.renderChild(t)),e.props)}});let Ot=0;const Ht=[];function Rt(e){e.length=0,Ht.length<5&&Ht.push(e)}const At={topLeft:"┌",topRight:"┐",bottomLeft:"└",bottomRight:"┘",horizontal:"─",vertical:"│"},Dt=new Set([1,5,4,11,23,13,10]);var Nt={name:"TextInput",props:{modelValue:{type:String,default:""},multiline:{type:Boolean,default:!1},rows:{type:Number,default:3},minRows:{type:Number,default:1},maxRows:{type:Number,default:void 0},autoResize:{type:Boolean,default:!0},wrapLines:{type:Boolean,default:!0},label:{type:String,default:""},placeholder:{type:String,default:""},hint:{type:[String,Boolean],default:"default"},color:String,borderColor:String,bg:String,focusColor:{type:String,default:"cyan"},errorColor:{type:String,default:"red"},bold:Boolean,italic:Boolean,dim:Boolean,pattern:RegExp,required:Boolean,maxLength:Number,disabled:Boolean,readonly:Boolean,...ae},emits:["update:modelValue","change","focus","blur","validate"],setup(e,{emit:r}){const s=l(fe),c=l(me,null),h=l(ve,null),u=l(ge,null),d=l(be,null),p="textinput-"+ ++Ot,f=t({text:e.modelValue||"",cursor:(e.modelValue||"").length,scrollOffset:0,validationError:null,isFocused:!1});let g=e.modelValue||"";function m(){f.cursor>f.text.length?f.cursor=f.text.length:f.cursor<0&&(f.cursor=0),b(),w(),f.text!==g&&(g=f.text,r("update:modelValue",f.text))}const v=a(()=>s&&s.isFocused(p));function b(){const t=[],n=f.text;e.required&&!n.trim()&&t.push("Required"),e.maxLength&&n.length>e.maxLength&&t.push(`Max ${e.maxLength}`),e.pattern&&!e.pattern.test(n)&&t.push("Invalid format");const i=0===t.length;return f.validationError=i?null:t[0],r("validate",{valid:i,errors:t}),i}function y(){const t=(()=>{const t="function"==typeof d?d():d;let n;return n=void 0!==e.width&&null!==e.width?e.width:null!=t?t:40,n})(),n=Wt(f.text,t),r=f.cursor;for(let e=0;e<n.length;e++){const i=n[e];if(r>=i.startIndex&&r<=i.endIndex){const o=i.text.length>=t;if(r===i.endIndex&&o&&e<n.length-1)continue;return r===i.endIndex&&o&&e===n.length-1?{row:e+1,col:0,visualLines:n}:{row:e,col:r-i.startIndex,visualLines:n}}}const i=n[n.length-1]||{startIndex:0};return{row:n.length-1,col:r-i.startIndex,visualLines:n}}function w(){const{row:t,visualLines:n}=y();let r=e.rows;if(e.autoResize&&(r=Math.max(e.minRows,n.length),e.maxRows&&(r=Math.min(r,e.maxRows))),t<f.scrollOffset?f.scrollOffset=t:t>=f.scrollOffset+r&&(f.scrollOffset=t-r+1),f.scrollOffset>0){const e=Math.max(0,n.length-r);f.scrollOffset>e&&(f.scrollOffset=e)}Rt(n)}function x(e){const{row:t,col:n,visualLines:r}=y(),i=t+e;if(i>=0&&i<r.length){const e=r[i],t=Math.min(n,e.text.length);f.cursor=e.startIndex+t}Rt(r)}i(v,e=>{f.isFocused=e,r(e?"focus":"blur")}),s.registerComponent(p,function(t){if(e.disabled||e.readonly)return!1;const{key:n,char:i}=t,o=f.text;if(t.ctrl&&i){const e=i.charCodeAt(0);if(e<32&&!Dt.has(e))return!0}if(n===Se)return f.cursor>0&&f.cursor--,m(),!0;if(n===Ce)return f.cursor<o.length&&f.cursor++,m(),!0;if(n===we)return x(-1),m(),!0;if(n===xe)return x(1),m(),!0;if(n===Le||n===Re){const e=o.lastIndexOf("\n",f.cursor-1);return f.cursor=-1===e?0:e+1,m(),!0}if(n===Ee||n===Ae){const e=o.indexOf("\n",f.cursor);return f.cursor=-1===e?o.length:e,m(),!0}if(n===ke){if(f.cursor>0){const e=f.cursor;f.text=o.slice(0,e-1)+o.slice(e),f.cursor--}return m(),!0}if(n===Ie||n===He){if(f.cursor<o.length){const e=f.cursor;f.text=o.slice(0,e)+o.slice(e+1)}return m(),!0}if(n===Me){if(e.multiline&&t.shift){const e=f.cursor;f.text=o.slice(0,e)+"\n"+o.slice(e),f.cursor++}else r("change",f.text);return m(),!0}if(n===De)return r("change",f.text),m(),!0;if(We(t)){if(e.maxLength&&o.length>=e.maxLength)return!0;const t=f.cursor;return f.text=o.slice(0,t)+i+o.slice(t),f.cursor+=i.length,m(),!0}return!1},{disabled:e.disabled}),c&&c.registerClickHandler(p,function(t){e.disabled||e.readonly||s.focus(p)}),o(()=>{s&&s.unregisterComponent(p),c&&c.unregisterClickHandler(p)}),i(()=>e.disabled,e=>{s.setComponentDisabled(p,e)}),i(()=>e.modelValue,e=>{const t=e||"";t!==f.text&&(f.text=t,f.cursor=Math.min(f.cursor,f.text.length),g=t,b(),w())},{immediate:!0});let S,C=null,M="",k=-1;return()=>{const t=`${f.text}:${f.cursor}:${f.scrollOffset}:${f.isFocused}:${f.validationError}`,r="function"==typeof d?d():d,i=u?u.version:0;if(t!==M||r!==S||i!==k||!C){M=t,S=r,k=i;const n=e.focusColor||h?.components?.textInput?.focusColor||"cyan",o=e.errorColor||h?.components?.textInput?.errorColor||"red",s=void 0!==e.color?e.color:h?.components?.textInput?.color,l=void 0!==e.borderColor?e.borderColor:h?.components?.textInput?.borderColor??h?.components?.textInput?.color,a=void 0!==e.bg?e.bg:h?.components?.textInput?.bg??h?.background;C={multiline:e.multiline,rows:e.rows,minRows:e.minRows,maxRows:e.maxRows,autoResize:e.autoResize,wrapLines:e.wrapLines,label:e.label,placeholder:e.placeholder,hint:e.hint,color:s,borderColor:l,bg:a,focusColor:n,errorColor:o,bold:e.bold,italic:e.italic,dim:e.dim,disabled:e.disabled,readonly:e.readonly,_componentId:p,_clickable:!0,text:f.text,cursor:f.cursor,scrollOffset:f.scrollOffset,isFocused:f.isFocused,validationError:f.validationError,_injectedWidth:r,_viewportVersion:i},void 0!==e.width&&null!==e.width&&(C.width=e.width)}return n("textinput",C)}}};function Wt(e,t){const n=Ht.pop()||[],r=e.split("\n");let i=0;for(let e=0;e<r.length;e++){const o=r[e];if(0===o.length){n.push({text:"",startIndex:i,endIndex:i}),i+=1;continue}let s=o,l=i;for(;s.length>0;){let e,r;if(s.length<=t)e=s,r=e.length;else{let n=t;const i=s.lastIndexOf(" ",t);i>.3*t&&(n=i+1),e=s.slice(0,n),r=e.length}n.push({text:e,startIndex:l,endIndex:l+r}),l+=r,s=s.slice(r)}i+=o.length+1}return n}ne.register("textinput",new class extends te{render(e){const{node:t}=e,n=e.getEffectiveWidth();null!==n&&(t.props.width=Math.max(1,n-2));const r=function(e){let{text:t="",width:n,_injectedWidth:r,rows:i=3,minRows:o=1,maxRows:s,autoResize:l=!1,cursor:a=0,scrollOffset:c=0,label:h="",placeholder:d="",isFocused:p=!1,validationError:f=null,disabled:g=!1,color:m,borderColor:v,bg:b,focusColor:y="cyan",errorColor:w="red",multiline:x=!1,hint:S="default"}=e;t=null==t?"":String(t);const C=null!=n?n:null!=r?r:40,M=[];if(h){const e=p?u.bold:e=>e;M.push(e(h))}let k=v||"white";f?k=w:p&&(k=y);const I=j(k),_=m?j(m):u,L=V(b),E=L||"",T=e=>{return L?E+(t=e,(n=L)&&t?t.replace(/\x1b\[0m/g,"[0m"+n):t)+"[0m":e;var t,n};M.push(T(I(At.topLeft+At.horizontal.repeat(C)+At.topRight)));const B=Wt(t,C);let O=-1,H=-1;for(let e=0;e<B.length;e++){const t=B[e];if(a>=t.startIndex&&a<=t.endIndex){const n=t.text.length>=C;if(a===t.endIndex&&n&&e<B.length-1)continue;a===t.endIndex&&n&&e===B.length-1?(O=e+1,H=0):(O=e,H=a-t.startIndex);break}}let R=i;if(l){let e=B.length;O===B.length&&e++,R=Math.max(o,e),s&&(R=Math.min(R,s))}const A=j(y);for(let e=0;e<R;e++){const n=c+e,r=(n<B.length?B[n].text:"").padEnd(C);let i;if(p&&!g&&n===O){const e=Math.min(H,C-1);if(0===t.length&&d&&0===n)i=A.inverse(d[0]||" ")+_.dim(d.slice(1).padEnd(C-1));else{const t=r[e]||" ",n=r.slice(0,e),o=r.slice(e+1);i=_(n)+A.inverse(t)+_(o)}}else i=0===t.length&&d&&0===n?_.dim(d.padEnd(C)):_(r);M.push(T(I(At.vertical)+i+I(At.vertical)))}if(Rt(B),M.push(T(I(At.bottomLeft+At.horizontal.repeat(C)+At.bottomRight))),f)M.push(j(w)("✗ "+f));else if(p&&!g){let e="";"default"===S?e=x?"Enter to submit, Shift+Enter for new line":"Enter to submit":S&&!1!==S&&""!==S&&(e=S),e&&M.push(_.dim(e))}return M.join("\n")}(e.props);return null!==n&&delete t.props.width,r}});let $t=0;var Ft={name:"SelectInput",props:{modelValue:{type:[String,Number,Object],default:null},options:{type:Array,required:!0,default:()=>[]},label:{type:String,default:""},height:{type:Number,default:10},width:{type:Number,default:void 0},disabled:{type:Boolean,default:!1},color:String,bg:String,focusColor:{type:String,default:"cyan"},selectedColor:{type:String,default:"green"},highlightColor:{type:String,default:"yellow"},bold:Boolean,dim:Boolean,...ae},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:t}){const s=l(fe),c=l(me,null),h=l(ge,null),u=l(be,null),d="selectinput-"+ ++$t,p=r(0),f=r(0),g=a(()=>null===e.modelValue||void 0===e.modelValue?-1:e.options.findIndex(t=>t.value===e.modelValue)),m=a(()=>s&&s.isFocused(d));function v(){p.value<f.value?f.value=p.value:p.value>=f.value+e.height&&(f.value=p.value-e.height+1)}function b(){if(p.value>0){for(p.value--;p.value>0&&e.options[p.value]?.disabled;)p.value--;v()}}function y(){if(p.value<e.options.length-1){for(p.value++;p.value<e.options.length-1&&e.options[p.value]?.disabled;)p.value++;v()}}function w(){for(p.value=0;p.value<e.options.length-1&&e.options[p.value]?.disabled;)p.value++;v()}return i(m,(e,n)=>{e&&!n?t("focus"):!e&&n&&t("blur")}),i(()=>e.options,()=>{p.value>=e.options.length&&(p.value=Math.max(0,e.options.length-1),v())}),s&&s.registerComponent(d,function(n){if(!e.disabled)if(n.key!==we)if(n.key!==xe)if(n.key!==Le)if(n.key!==Ee)if(n.key!==Te)if(n.key!==Be)n.key!==Me&&" "!==n.char?We(n)&&" "!==n.char&&function(t){const n=t.toLowerCase(),r=p.value;for(let t=r+1;t<e.options.length;t++){const r=e.options[t];if((r.label||String(r.value)).toLowerCase().startsWith(n)&&!r.disabled)return p.value=t,void v()}for(let t=0;t<=r;t++){const r=e.options[t];if((r.label||String(r.value)).toLowerCase().startsWith(n)&&!r.disabled)return p.value=t,void v()}}(n.char):function(){const n=e.options[p.value];n&&!n.disabled&&(t("update:modelValue",n.value),t("change",n.value))}();else for(let t=0;t<e.height;t++)y();else for(let t=0;t<e.height;t++)b();else!function(){for(p.value=e.options.length-1;p.value>0&&e.options[p.value]?.disabled;)p.value--;v()}();else w();else y();else b()},{disabled:e.disabled}),c&&c.registerClickHandler(d,function(t){e.disabled||s.focus(d)}),g.value>=0?(p.value=g.value,v()):w(),o(()=>{s&&s.unregisterComponent(d),c&&c.unregisterClickHandler(d)}),i(()=>e.disabled,e=>{s&&s.setComponentDisabled(d,e)}),()=>{const t="function"==typeof u?u():u;return n("selectinput",{...e,_componentId:d,_clickable:!0,highlightedIndex:p.value,selectedIndex:g.value,scrollOffset:f.value,isFocused:m.value,_injectedWidth:t,_viewportVersion:h?h.version:0})}}};ne.register("selectinput",new class extends te{render(e){const{node:t}=e,n=e.getEffectiveWidth();null!==n&&(t.props.width=n);const r=function(e){const{options:t=[],modelValue:n=null,label:r="",height:i=10,highlightedIndex:o=0,selectedIndex:s=-1,scrollOffset:l=0,isFocused:a=!1,focusColor:c="cyan",selectedColor:h="green",highlightColor:d="yellow",disabled:p=!1}=e;let f="";r&&(f+=Q(a&&!p?`${u.bold(r)}`:r,e)+"\n");if(0===t.length){const t=20,n=a&&!p?c:e.color||"white",r=a&&!p?(u[n]||u).bold:u[n]||u;return f+=r("┌"+"─".repeat(t+2)+"┐")+"\n",f+=r("│")+" No options".padEnd(t+2," ")+r("│")+"\n",f+=r("└"+"─".repeat(t+2)+"┘")+"\n",f}const g=Math.max(20,...t.map(e=>J(e.label||String(e.value)))),m=e.width?e.width:g+4,v=m-2,b=a&&!p?c:e.color||"white",y=a&&!p?(u[b]||u).bold:u[b]||u;f+=y("┌"+"─".repeat(m)+"┐")+"\n";for(let e=0;e<Math.min(i,t.length);e++){const r=l+e,i=t[r];if(i){const e=a&&r===o,t=r===s||i.value===n,l=i.label||String(i.value);let c=" ";t?c=u[h].bold("● "):e&&(c=u[d].bold("▸ "));let g=l.padEnd(v," ");J(l)>v&&(g=l.substring(0,v)),e&&a&&!p?g=u[d].bold.inverse(g):t?g=u[h].bold(g):i.disabled&&(g=u.dim(g)),f+=y("│")+c+g+y("│")+"\n"}else f+=y("│")+" ".repeat(m)+y("│")+"\n"}if(f+=y("└"+"─".repeat(m)+"┘"),a&&!p&&(f+="\n"+u.dim("↑↓ Navigate • Enter to select • Tab to next field")),t.length>i){const e=Math.round(l/Math.max(1,t.length-i)*100);f+="\n"+u.dim(`[${e}% - showing ${l+1}-${Math.min(l+i,t.length)} of ${t.length}]`)}return f}(e.props);return null!==n&&delete t.props.width,r}});let zt=0;var jt={name:"Checkbox",props:{modelValue:{type:Array,default:()=>[]},options:{type:Array,required:!0,default:()=>[]},label:{type:String,default:""},direction:{type:String,default:"vertical",validator:e=>["vertical","horizontal"].includes(e)},height:{type:Number,default:10},width:{type:Number,default:null},itemSpacing:{type:Number,default:2},disabled:{type:Boolean,default:!1},color:String,bg:String,focusColor:{type:String,default:"cyan"},selectedColor:{type:String,default:"green"},highlightColor:{type:String,default:"yellow"},bold:Boolean,dim:Boolean,...ae},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:t}){const s=l(fe),c=l(me,null),h=l(ge,null),u=l(be,null),d="checkbox-"+ ++zt,p=r(0),f=r(0),g=a(()=>s&&s.isFocused(d));function m(){p.value<f.value?f.value=p.value:p.value>=f.value+e.height&&(f.value=p.value-e.height+1)}function v(){if(p.value>0){for(p.value--;p.value>0&&e.options[p.value]?.disabled;)p.value--;m()}}function b(){if(p.value<e.options.length-1){for(p.value++;p.value<e.options.length-1&&e.options[p.value]?.disabled;)p.value++;m()}}function y(){for(p.value=0;p.value<e.options.length-1&&e.options[p.value]?.disabled;)p.value++;m()}return i(g,(e,n)=>{e&&!n?t("focus"):!e&&n&&t("blur")}),i(()=>e.options,()=>{p.value>=e.options.length&&(p.value=Math.max(0,e.options.length-1),m())},{deep:!0}),s&&s.registerComponent(d,function(n){if(e.disabled)return;const r="vertical"===e.direction;if(r&&n.key===we||!r&&n.key===Se)v();else if(r&&n.key===xe||!r&&n.key===Ce)b();else if(n.key!==Le)if(n.key!==Ee)if(n.key===Te&&r)for(let t=0;t<e.height;t++)v();else if(n.key===Be&&r)for(let t=0;t<e.height;t++)b();else n.key!==Me&&" "!==n.char?We(n)&&" "!==n.char&&function(t){const n=t.toLowerCase(),r=p.value;for(let t=r+1;t<e.options.length;t++){const r=e.options[t];if((r.label||String(r.value)).toLowerCase().startsWith(n)&&!r.disabled)return p.value=t,void m()}for(let t=0;t<=r;t++){const r=e.options[t];if((r.label||String(r.value)).toLowerCase().startsWith(n)&&!r.disabled)return p.value=t,void m()}}(n.char):function(){const n=e.options[p.value];if(!n||n.disabled)return;const r=[...e.modelValue||[]],i=r.indexOf(n.value);i>=0?r.splice(i,1):r.push(n.value),t("update:modelValue",r),t("change",r)}();else!function(){for(p.value=e.options.length-1;p.value>0&&e.options[p.value]?.disabled;)p.value--;m()}();else y()},{disabled:e.disabled}),c&&c.registerClickHandler(d,function(t){e.disabled||s.focus(d)}),y(),o(()=>{s&&s.unregisterComponent(d),c&&c.unregisterClickHandler(d)}),i(()=>e.disabled,e=>{s&&s.setComponentDisabled(d,e)}),()=>{const t="function"==typeof u?u():u;return n("checkbox",{...e,_componentId:d,_clickable:!0,highlightedIndex:p.value,scrollOffset:f.value,isFocused:g.value,modelValue:e.modelValue,_injectedWidth:t,_viewportVersion:h?h.version:0})}}};function Pt(e){const{direction:t="vertical"}=e;return"horizontal"===t?function(e){const{options:t=[],modelValue:n=[],label:r="",highlightedIndex:i=0,isFocused:o=!1,selectedColor:s="green",highlightColor:l="yellow",disabled:a=!1,width:c=null,itemSpacing:h=2}=e;let d="";r&&(d+=Q(o&&!a?`${u.bold(r)}`:r,e)+"\n");if(0===t.length)return d+=u.dim("No options")+"\n",d;const p=c||process.stdout.columns||80,f=[];let g=[],m=0;for(let e=0;e<t.length;e++){const r=t[e],c=o&&e===i,d=n.includes(r.value),v=r.label||String(r.value);let b;b=d?u[s].bold("[✓]"):"[ ]";let y=`${b} ${v}`;c&&o&&!a?y=u[l].bold.inverse(y):d?y=u[s].bold(y):r.disabled&&(y=u.dim(y));const w=J(y);0===g.length||m+w+h<=p?(g.push(y),m+=w+(g.length>1?h:0)):(f.push(g),g=[y],m=w)}g.length>0&&f.push(g);for(let e=0;e<f.length;e++)e>0&&(d+="\n"),d+=f[e].join(" ".repeat(h));return o&&!a&&(d+="\n"+u.dim("←→ Navigate • Space/Enter to toggle • Tab to next field")),d}(e):function(e){const{options:t=[],modelValue:n=[],label:r="",height:i=10,highlightedIndex:o=0,scrollOffset:s=0,isFocused:l=!1,focusColor:a="cyan",selectedColor:c="green",highlightColor:h="yellow",disabled:d=!1}=e;let p="";r&&(p+=Q(l&&!d?`${u.bold(r)}`:r,e)+"\n");if(0===t.length){const t=20,n=l&&!d?a:e.color||"white",r=l&&!d?(u[n]||u).bold:u[n]||u;return p+=r("┌"+"─".repeat(t+2)+"┐")+"\n",p+=r("│")+" No options".padEnd(t+2," ")+r("│")+"\n",p+=r("└"+"─".repeat(t+2)+"┘")+"\n",p}const f=Math.max(20,...t.map(e=>J(e.label||String(e.value)))),g=e.width?e.width:f+6,m=Math.max(1,g-6),v=l&&!d?a:e.color||"white",b=l&&!d?(u[v]||u).bold:u[v]||u;p+=b("┌"+"─".repeat(g)+"┐")+"\n";for(let e=0;e<Math.min(i,t.length);e++){const r=s+e,i=t[r];if(i){const e=l&&r===o,t=n.includes(i.value),s=i.label||String(i.value);let a=" ";a=t?u[c].bold("[✓]"):"[ ]";let f=s.padEnd(m," ");J(s)>m&&(f=s.substring(0,m)),e&&l&&!d?f=u[h].bold.inverse(f):t?f=u[c].bold(f):i.disabled&&(f=u.dim(f)),p+=b("│")+" "+a+" "+f+b(" │")+"\n"}else p+=b("│")+" ".repeat(g)+b("│")+"\n"}if(p+=b("└"+"─".repeat(g)+"┘"),l&&!d){const t="vertical"===e.direction?"↑↓ Navigate • Space/Enter to toggle • Tab to next field":"←→ Navigate • Space/Enter to toggle • Tab to next field";p+="\n"+u.dim(t)}if(t.length>i){const e=Math.round(s/Math.max(1,t.length-i)*100);p+="\n"+u.dim(`[${e}% - showing ${s+1}-${Math.min(s+i,t.length)} of ${t.length}]`)}return p}(e)}ne.register("checkbox",new class extends te{render(e){const{node:t}=e,n=e.getEffectiveWidth();null!==n&&(t.props.width=Math.max(1,n-2));const r=Pt(e.props);return null!==n&&delete t.props.width,r}});let Vt=0;var Gt={name:"Radiobox",props:{modelValue:{type:[String,Number,Object],default:null},options:{type:Array,required:!0,default:()=>[]},label:{type:String,default:""},direction:{type:String,default:"vertical",validator:e=>["vertical","horizontal"].includes(e)},height:{type:Number,default:10},width:{type:Number,default:null},itemSpacing:{type:Number,default:2},disabled:{type:Boolean,default:!1},color:String,bg:String,focusColor:{type:String,default:"cyan"},selectedColor:{type:String,default:"green"},highlightColor:{type:String,default:"yellow"},bold:Boolean,dim:Boolean,...ae},emits:["update:modelValue","change","focus","blur"],setup(e,{emit:t}){const s=l(fe),c=l(me,null),h="radiobox-"+ ++Vt,u=r(0),d=r(0),p=a(()=>null===e.modelValue||void 0===e.modelValue?-1:e.options.findIndex(t=>t.value===e.modelValue)),f=a(()=>s&&s.isFocused(h));function g(){u.value<d.value?d.value=u.value:u.value>=d.value+e.height&&(d.value=u.value-e.height+1)}function m(){if(u.value>0){for(u.value--;u.value>0&&e.options[u.value]?.disabled;)u.value--;g()}}function v(){if(u.value<e.options.length-1){for(u.value++;u.value<e.options.length-1&&e.options[u.value]?.disabled;)u.value++;g()}}function b(){for(u.value=0;u.value<e.options.length-1&&e.options[u.value]?.disabled;)u.value++;g()}return i(f,(e,n)=>{e&&!n?t("focus"):!e&&n&&t("blur")}),i(()=>e.options,()=>{u.value>=e.options.length&&(u.value=Math.max(0,e.options.length-1),g())},{deep:!0}),s&&s.registerComponent(h,function(n){if(e.disabled)return;const r="vertical"===e.direction;if(r&&n.key===we||!r&&n.key===Se)m();else if(r&&n.key===xe||!r&&n.key===Ce)v();else if(n.key!==Le)if(n.key!==Ee)if(n.key===Te&&r)for(let t=0;t<e.height;t++)m();else if(n.key===Be&&r)for(let t=0;t<e.height;t++)v();else n.key!==Me&&" "!==n.char?We(n)&&" "!==n.char&&function(t){const n=t.toLowerCase(),r=u.value;for(let t=r+1;t<e.options.length;t++){const r=e.options[t];if((r.label||String(r.value)).toLowerCase().startsWith(n)&&!r.disabled)return u.value=t,void g()}for(let t=0;t<=r;t++){const r=e.options[t];if((r.label||String(r.value)).toLowerCase().startsWith(n)&&!r.disabled)return u.value=t,void g()}}(n.char):function(){const n=e.options[u.value];n&&!n.disabled&&(t("update:modelValue",n.value),t("change",n.value))}();else!function(){for(u.value=e.options.length-1;u.value>0&&e.options[u.value]?.disabled;)u.value--;g()}();else b()},{disabled:e.disabled}),c&&c.registerClickHandler(h,function(t){e.disabled||s.focus(h)}),p.value>=0?(u.value=p.value,g()):b(),o(()=>{s&&s.unregisterComponent(h),c&&c.unregisterClickHandler(h)}),i(()=>e.disabled,e=>{s&&s.setComponentDisabled(h,e)}),()=>n("radiobox",{...e,_componentId:h,_clickable:!0,highlightedIndex:u.value,selectedIndex:p.value,scrollOffset:d.value,isFocused:f.value})}};function Ut(e){const{direction:t="vertical"}=e;return"horizontal"===t?function(e){const{options:t=[],modelValue:n=null,label:r="",highlightedIndex:i=0,selectedIndex:o=-1,isFocused:s=!1,selectedColor:l="green",highlightColor:a="yellow",disabled:c=!1,width:h=null,itemSpacing:d=2}=e;let p="";r&&(p+=Q(s&&!c?`${u.bold(r)}`:r,e)+"\n");if(0===t.length)return p+=u.dim("No options")+"\n",p;const f=h||process.stdout.columns||80,g=[];let m=[],v=0;for(let e=0;e<t.length;e++){const r=t[e],h=s&&e===i,p=e===o||r.value===n,b=r.label||String(r.value);let y;y=p?u[l].bold("(●)"):"( )";let w=`${y} ${b}`;h&&s&&!c?w=u[a].bold.inverse(w):p?w=u[l].bold(w):r.disabled&&(w=u.dim(w));const x=J(w);0===m.length||v+x+d<=f?(m.push(w),v+=x+(m.length>1?d:0)):(g.push(m),m=[w],v=x)}m.length>0&&g.push(m);for(let e=0;e<g.length;e++)e>0&&(p+="\n"),p+=g[e].join(" ".repeat(d));return s&&!c&&(p+="\n"+u.dim("←→ Navigate • Space/Enter to select • Tab to next field")),p}(e):function(e){const{options:t=[],modelValue:n=null,label:r="",height:i=10,highlightedIndex:o=0,selectedIndex:s=-1,scrollOffset:l=0,isFocused:a=!1,focusColor:c="cyan",selectedColor:h="green",highlightColor:d="yellow",disabled:p=!1}=e;let f="";r&&(f+=Q(a&&!p?`${u.bold(r)}`:r,e)+"\n");if(0===t.length){const t=20,n=a&&!p?c:e.color||"white",r=a&&!p?(u[n]||u).bold:u[n]||u;return f+=r("┌"+"─".repeat(t+2)+"┐")+"\n",f+=r("│")+" No options".padEnd(t+2," ")+r("│")+"\n",f+=r("└"+"─".repeat(t+2)+"┘")+"\n",f}const g=Math.max(20,...t.map(e=>J(e.label||String(e.value)))),m=e.width?e.width:g+6,v=Math.max(1,m-6),b=a&&!p?c:e.color||"white",y=a&&!p?(u[b]||u).bold:u[b]||u;f+=y("┌"+"─".repeat(m)+"┐")+"\n";for(let e=0;e<Math.min(i,t.length);e++){const r=l+e,i=t[r];if(i){const e=a&&r===o,t=r===s||i.value===n,l=i.label||String(i.value);let c=" ";c=t?u[h].bold("(●)"):"( )";let g=l.padEnd(v," ");J(l)>v&&(g=l.substring(0,v)),e&&a&&!p?g=u[d].bold.inverse(g):t?g=u[h].bold(g):i.disabled&&(g=u.dim(g)),f+=y("│")+" "+c+" "+g+y(" │")+"\n"}else f+=y("│")+" ".repeat(m)+y("│")+"\n"}if(f+=y("└"+"─".repeat(m)+"┘"),a&&!p){const t="vertical"===e.direction?"↑↓ Navigate • Space/Enter to select • Tab to next field":"←→ Navigate • Space/Enter to select • Tab to next field";f+="\n"+u.dim(t)}if(t.length>i){const e=Math.round(l/Math.max(1,t.length-i)*100);f+="\n"+u.dim(`[${e}% - showing ${l+1}-${Math.min(l+i,t.length)} of ${t.length}]`)}return f}(e)}ne.register("radiobox",new class extends te{render(e){const{node:t}=e,n=e.getEffectiveWidth();null!==n&&(t.props.width=Math.max(1,n-2));const r=Ut(e.props);return null!==n&&delete t.props.width,r}});let Yt=0;const Xt={primary:{bg:"brightBlue",color:"white",bold:!0,focusBg:"blue"},secondary:{bg:"brightWhite",color:"white",bold:!1,focusBg:"white"},danger:{bg:"brightRed",color:"white",bold:!0,focusBg:"red"},warning:{bg:"brightYellow",color:"black",bold:!0,focusBg:"yellow"},info:{bg:"brightCyan",color:"black",bold:!1,focusBg:"cyan"},success:{bg:"brightGreen",color:"white",bold:!0,focusBg:"green"}};var qt={name:"Button",props:{label:{type:String,required:!0},variant:{type:String,default:"primary",validator:e=>["primary","secondary","danger","warning","info","success"].includes(e)},color:String,bg:String,bold:Boolean,italic:Boolean,dim:Boolean,disabled:{type:Boolean,default:!1},focusColor:{type:String,default:"brightYellow"},focusBg:{type:String,default:null},fullWidth:{type:Boolean,default:!1},...ae},emits:["click","focus","blur"],setup(e,{emit:t}){const s=l(fe),c=l(ge,null),h=l(be,null),u=l(me,null),d=l(ve,null),p="button-"+ ++Yt,f=r(!1),g=a(()=>s&&s.isFocused(p));return i(g,(e,n)=>{e&&!n?t("focus"):!e&&n&&t("blur")}),s.registerComponent(p,function(n){return!e.disabled&&((n.key===Me||" "===n.char)&&(f.value=!0,t("click"),setTimeout(()=>{f.value=!1},250),!0))},{disabled:e.disabled}),u.registerClickHandler(p,function(n){e.disabled||("left_release"!==n.action?(f.value=!0,t("click",{source:"mouse",x:n.x,y:n.y,shift:n.shift,ctrl:n.ctrl,alt:n.alt}),setTimeout(()=>{f.value=!1},250)):f.value=!1)}),o(()=>{s.unregisterComponent(p),u.unregisterClickHandler(p)}),i(()=>e.disabled,e=>{s.setComponentDisabled(p,e)}),()=>{const t="function"==typeof h?h():h,r=d?.components?.button?.variants?{...Xt,...d.components.button.variants}:Xt;return n("button",{...e,_componentId:p,_clickable:!0,_variants:r,isFocused:g.value,isPressed:f.value,_injectedWidth:t,_viewportVersion:c?c.version:0})}}};function Jt(e,t,n){const{paddingTop:r,paddingBottom:i,padding:o=0}=e.props||{},s=null!=r?r:o||0,l=null!=i?i:o||0;if(!e.children||0===e.children.length){if(s>0||l>0){const e=[];for(let t=0;t<s+l;t++)e.push("");return e.join("\n")}return""}const a=e.cachedLayoutMetrics||{children:[]},c=e.children,h=c.length,u=[];let d=0;for(let e=0;e<h;e++){const r=c[e];if("comment"===r.type)continue;const i=a.children[d++];if(!i){u.push({rendered:n(r,t+1,{yOffset:s}),x:0,width:0,height:1,y:0});continue}const o=i.width>0&&("col"===r.type||"box"===r.type||void 0!==r.props.flex||void 0!==r.props.width)?Qt(r,i.width,t+1,n,{yOffset:s}):n(r,t+1,{yOffset:s});u.push({rendered:o,x:i.x,y:i.y,width:i.width,height:i.height})}const p=e.props?.flexWrap||"nowrap",f=e.props?.responsive;let g;if(("wrap"===p||"wrap-reverse"===p||f)&&u.length>1){const e=function(e){if(0===e.length)return[];const t=e.slice().sort((e,t)=>e.y-t.y),n=[];let r=[t[0]],i=t[0].y+(t[0].height||1);for(let e=1;e<t.length;e++){const o=t[e],s=o.height||1;o.y>=i?(n.push(r),r=[o],i=o.y+s):(r.push(o),i=Math.max(i,o.y+s))}return n.push(r),n}(u);g=e.length>1?function(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];r.sort((e,t)=>e.x-t.x);const i=new Array(r.length);let o=0;for(let e=0;e<r.length;e++){const t=r[e].rendered.split("\n");i[e]={lines:t,x:r[e].x},t.length>o&&(o=t.length)}for(let e=0;e<o;e++){let n="",r=0;for(let t=0;t<i.length;t++){const o=i[t],s=o.lines[e]||"",l=o.x;l>r&&(n+=" ".repeat(l-r),r=l),n+=s,r+=J(s)}t.push(n)}}return t.join("\n")}(e):Zt(u)}else g=Zt(u);if(s>0||l>0){const e=g?g.split("\n"):[];for(let t=0;t<s;t++)e.unshift("");for(let t=0;t<l;t++)e.push("");g=e.join("\n")}return g}function Kt(e){if(!e)return 0;let t=1;for(let n=0;n<e.length;n++)10===e.charCodeAt(n)&&t++;return t}function Zt(e){const t=e.length,n=new Array(t);let r=0;for(let i=0;i<t;i++){const t=e[i].rendered.split("\n");n[i]={lines:t,x:e[i].x},t.length>r&&(r=t.length)}const i=new Array(r);for(let e=0;e<r;e++){let r="",o=0;for(let i=0;i<t;i++){const t=n[i],s=t.lines[e]||"",l=t.x;l>o&&(r+=" ".repeat(l-o),o=l),r+=s,o+=J(s)}i[e]=r}return i.join("\n")}function Qt(e,t,n,r,i={}){const o=e._renderWidth;return e._renderWidth=t,o!==t&&null!==e.cachedOutput&&(e.isDirty=!0,e.cachedOutput=null),r(e,n,i)}function en(e,t,n,r,i={}){const o=e.props.width;e.props.width=t;const s=r(e,n,i);return e.props.width=o,s}ne.register("button",new class extends te{render(e){const{node:t}=e,n=e.props,r=n.width;n.fullWidth||delete t.props.width;const i=function(e){const{label:t="",variant:n="primary",color:r,bg:i,bold:o,italic:s,dim:l,disabled:a=!1,isFocused:c=!1,isPressed:h=!1,_variants:d,_injectedWidth:p,width:f,fullWidth:g=!1}=e,m=d||Xt,v=m[n]||m.primary;let b=i||v.bg;const y=void 0!==o?o:v.bold;let w=r||b,x=t,S=r||b;if(!c||a||r||(S="white"),S){const e=P(S);e&&(x=e(x))}return(c&&!a||y)&&(x=u.bold(x)),s&&(x=u.italic(x)),(a||l)&&(x=u.dim(x)),h&&!a&&(x=u.inverse(x)),ct(x,{border:!0,borderStyle:"button",bg:i||null,color:w,paddingLeft:1,paddingRight:1,paddingTop:0,paddingBottom:0,bold:c&&!a,width:g?f||p:f})}(n);return void 0!==r&&(t.props.width=r),i}});function tn(e){if(!e)return 0;let t=1;for(let n=0;n<e.length;n++)10===e.charCodeAt(n)&&t++;return t}function nn(e,t,n,r,i=null){if(!H)return;const o=e.props||{},s=o._clickable||e.clickable,l=o._componentId||e.componentId;if(!s||!l)return;let a=0,c=0;if(i){const e=function(e){if(!e)return{width:0,height:0};const t=e.split("\n"),n=t.length;let r=0;for(const e of t){const t=J(e);t>r&&(r=t)}return{width:r,height:n}}(i);a=e.width,c=e.height}else{const t=e.cachedLayoutMetrics;a=t?.width||0,c=t?.height||0}var h;a>0&&c>0&&(h={componentId:l,x:Math.round(t),y:Math.round(n),width:Math.round(a),height:Math.round(c),depth:r,nodeType:e.type},H&&h.width>0&&h.height>0&&O.push(h))}function rn(e,t=0,n={}){if(!e)return"";const{parentAbsX:r=0,parentAbsY:i=0,yOffset:o=0,inRow:s=!1}=n;if("comment"===e.type)return"";const l=e.cachedLayoutMetrics,a=r+(l?.x||0),c=i+o;if(function(e){return!!e&&!e.isDirty&&!e.childrenDirty&&null!==e.cachedOutput}(e)){const n=e.cachedOutput;return nn(e,a,c,t,n),n}const h=new ee({node:e,depth:t,absX:a,absY:c,inRow:s,renderNodeFn:rn}),u=ne.get(e.type);let d;if(u)d=u.render(h);else{let n=0;const r=I(e,e=>{const r=rn(e,t+1,{parentAbsX:a,parentAbsY:c,yOffset:n,inRow:s});return n+=tn(r),r});d=e.text||r}return e.actualRenderedHeight=tn(d),nn(e,a,c,t,d),function(e,t){e&&(e.cachedOutput=t,e.isDirty=!1)}(e,d),d}function on(e){if(!e)return"";performance.now();let t;if(R(),e.children?.length>0){const n=[];let r=0;for(const t of e.children){if("comment"===t.type)continue;const e=rn(t,0,{parentAbsX:0,parentAbsY:0,yOffset:r,inRow:!1});e&&(n.push(e),r+=tn(e))}t=n.join("\n")}else t=rn(e,0,{parentAbsX:0,parentAbsY:0,yOffset:0,inRow:!1});const n=A();return e._clickRegions=n,performance.now(),t.endsWith("\n")?t:t+"\n"}function sn(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ln(t={}){const{onUpdate:n=()=>{},rootContainer:r=null,beforeRender:i=()=>{},afterRender:o=()=>{}}=t,s=e({createElement:e=>new C(e),createText:e=>new M(e),createComment:e=>new k(e),setText(e,t){e.text!==t&&(e.setText(t),_(e)),h()},setElementText(e,t){e.text!==t&&(e.setText(t),_(e)),h()},insert(e,t,n=null){n?t.insertBefore(e,n):t.appendChild(e),_(e),t.invalidateChildrenCache(),t.markLayoutDirty(),h()},remove(e){const t=e.parent;t&&(t.removeChild(e),t.invalidateChildrenCache(),_(t),t.markLayoutDirty(),h())},patchProp(e,t,n,r){if("_componentId"===t)return void(e.componentId=r);if("_clickable"===t)return void(e.clickable=r);let i=n!==r;if(!i&&Array.isArray(r)&&Array.isArray(n))i=n.length!==r.length||n.some((e,t)=>e!==r[t]);else if(!i&&sn(r)&&sn(n)){const e=Object.keys(n),t=Object.keys(r);i=e.length!==t.length||t.some(e=>n[e]!==r[e])}var o;null==r?delete e.props[t]:e.props[t]=r,i&&(_(e),o=t,E.has(o)&&e.markLayoutDirty()),h()},parentNode:e=>e.parent,nextSibling(e){if(!e.parent)return null;const t=e.parent.children,n=t.indexOf(e);return t[n+1]||null},querySelector:()=>null,setScopeId(){},cloneNode(e){const t=new C(e.type);return t.props={...e.props},t.text=e.text,t},insertStaticContent(e,t,n){const r=new M(e);return n?t.insertBefore(r,n):t.appendChild(r),t.invalidateChildrenCache(),h(),[r,r]}});let l=!1,a=!1,c="";function h(){a=!0,l||u()}function u(){l||(l=!0,Promise.resolve().then(d))}function d(){const e=performance.now();if(l=!1,a=!1,r){i(r);const t=on(r);if(o(r),t!==c&&(c=t,n(t),s.vuettyInstance?.debugServer)){const n=performance.now()-e;s.vuettyInstance.debugServer.captureRenderComplete({duration:n,outputLength:t.length,rootContainer:r})}}a&&u()}return s.forceUpdate=()=>{c="",h()},s.vuettyInstance=null,s}ne.register("row",new class extends te{render(e){const{node:t,depth:n,absX:r}=e;return Jt(t,n,(t,n,i={})=>{const o=i.yOffset||0;return e.renderChild(t,{parentAbsX:r,yOffset:o,inRow:!0})})}}),ne.register("col",new class extends te{render(e){const{node:t,depth:n,absX:r}=e;return function(e,t,n){const{gap:r=0,paddingTop:i,paddingBottom:o,padding:s=0}=e.props||{},l=null!=i?i:s||0,a=null!=o?o:s||0;if(!e.children||0===e.children.length){if(l>0||a>0){const e=[];for(let t=0;t<l+a;t++)e.push("");return e.join("\n")}return""}const c=e.props?.width,h=e.props?._injectedWidth,u=e._renderWidth,d=null!=c?c:void 0!==u?u:h,p=e.cachedLayoutMetrics||{children:[]},f=[];let g,m=0,v=l;for(const i of e.children){if("comment"===i.type)continue;const e=p.children[m];if(m++,f.length>0&&r>0&&(v+=r),!e){const e=n(i,t+1,{yOffset:v});f.push(e),v+=Kt(e);continue}const o=i.props||{},s=e.height>0&&(void 0!==o.flex||void 0!==o.flexGrow||void 0!==o.height||void 0!==o._injectedHeight||"col"===i.type||"row"===i.type),l=null!=d?d:e.width,a=s&&("box"===i.type||"row"===i.type);if(a){const r=i.props._targetHeight;i.props._targetHeight=e.height,r!==e.height&&null!==i.cachedOutput&&(i.isDirty=!0,i.cachedOutput=null);const o=en(i,l,t+1,n,{yOffset:v});void 0!==r?i.props._targetHeight=r:delete i.props._targetHeight,f.push(o),v+=Kt(o);continue}const c=en(i,l,t+1,n,{yOffset:v}),h=s&&!a?et(c,e.height):c;f.push(h),v+=Kt(h)}if(r>0){const e="\n"+"\n".repeat(r);g=f.join(e)}else g=f.join("\n");if(l>0||a>0){const e=g?g.split("\n"):[];for(let t=0;t<l;t++)e.unshift("");for(let t=0;t<a;t++)e.push("");g=e.join("\n")}return g}(t,n,(t,n,i={})=>{const o=i.yOffset||0;return e.renderChild(t,{parentAbsX:r,yOffset:o,inRow:!1})})}});class an{constructor(e={}){this.components=new Map,this.componentOrder=[],this.focusedId=r(null),this.enabled=!1,this.onInputChange=e.onInputChange||(()=>{}),this.onExit=e.onExit||(()=>{}),this.viewportHandler=null,this.vuettyInstance=null,this.handleData=this.handleData.bind(this),this.buffer=""}enable(){this.enabled||(process.stdin.isTTY&&process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8"),process.stdin.on("data",this.handleData),this.enabled=!0)}disable(){this.enabled&&(process.stdin.removeListener("data",this.handleData),process.stdin.pause(),process.stdin.isTTY&&process.stdin.setRawMode(!1),this.enabled=!1)}registerComponent(e,t,n={}){this.components.set(e,{handler:t,disabled:n.disabled||!1,focusable:void 0===n.focusable||n.focusable}),this.componentOrder.push(e),this.focusedId.value||n.disabled||!1===n.focusable||this.focus(e)}unregisterComponent(e){this.components.delete(e);const t=this.componentOrder.indexOf(e);-1!==t&&this.componentOrder.splice(t,1),this.focusedId.value===e&&(this.focusedId.value=null,this.focusNext())}setComponentDisabled(e,t){const n=this.components.get(e);n&&(n.disabled=t,t&&this.focusedId.value===e&&this.focusNext())}setViewportHandler(e){this.viewportHandler=e}setVuettyInstance(e){this.vuettyInstance=e}blur(){return!!this.focusedId.value&&(this.focusedId.value=null,this.onInputChange(),!0)}focus(e){const t=this.components.get(e);return!(!t||t.disabled)&&(this.focusedId.value!==e&&(this.focusedId.value=e,this.onInputChange(),!0))}focusNext(){if(0===this.componentOrder.length)return!1;let e=(this.componentOrder.indexOf(this.focusedId.value)+1)%this.componentOrder.length,t=0;for(;t<this.componentOrder.length;){const n=this.componentOrder[e],r=this.components.get(n);if(r&&!r.disabled&&!1!==r.focusable)return this.focus(n);e=(e+1)%this.componentOrder.length,t++}return this.focusedId.value=null,!1}focusPrevious(){if(0===this.componentOrder.length)return!1;const e=this.componentOrder.indexOf(this.focusedId.value);let t=e<=0?this.componentOrder.length-1:e-1,n=0;for(;n<this.componentOrder.length;){const e=this.componentOrder[t],r=this.components.get(e);if(r&&!r.disabled&&!1!==r.focusable)return this.focus(e);t=t<=0?this.componentOrder.length-1:t-1,n++}return this.focusedId.value=null,!1}isFocused(e){return this.focusedId.value===e}handleData(e){for(this.buffer+=e;this.buffer.length>0;)if(this.buffer.startsWith("")){let e=-1;if(this.buffer.startsWith("[<")){const e=this.buffer.match(/^\x1b\[<\d+;\d+;\d+[Mm]/);if(e){const t=e[0];this.buffer=this.buffer.slice(t.length),this.handleMouseEvent(t);continue}if(this.buffer.match(/^\x1b\[<[\d;]*$/))break}const t=this.buffer.match(/^\x1b\[\d+;\d+;\d+M/);if(t){const e=t[0];this.buffer=this.buffer.slice(e.length),this.handleMouseEvent(e);continue}if(this.buffer.length>=2&&"["===this.buffer[1])for(let t=2;t<this.buffer.length;t++){const n=this.buffer.charCodeAt(t);if(n>=65&&n<=90||n>=97&&n<=122||126===n){e=t+1;break}}else this.buffer.length>=2&&(e=2);if(e>0){const t=this.buffer.slice(0,e);this.buffer=this.buffer.slice(e),this.handleKeyPress(t)}else{if(1!==this.buffer.length)break;this.buffer="",this.handleKeyPress("")}}else{const e=this.buffer[0];this.buffer=this.buffer.slice(1),this.handleKeyPress(e)}}handleKeyPress(e){if(Xe(e))return void this.handleMouseEvent(e);const t=function(e){const t=e.match(/^\x1b\[1;(\d+)([A-Z~])$/);if(t){const e=parseInt(t[1],10),n=t[2],r=e-1;return{key:{A:we,B:xe,C:Ce,D:Se,H:Le,F:Ee}[n]||"unknown",char:null,shift:!!(1&r),ctrl:!!(4&r),alt:!1}}if(Ne[e]){const t=e.includes(";2");return{key:Ne[e],char:null,ctrl:!1,shift:t||"\n"===e,alt:!1}}if(2===e.length&&27===e.charCodeAt(0)){const t=e[1];if(t.charCodeAt(0)>=32&&t.charCodeAt(0)<=126)return{key:t.toLowerCase(),char:t,ctrl:!1,alt:!0,shift:t!==t.toLowerCase()}}return 1===e.length&&e.charCodeAt(0)<32?{key:"char",char:e,ctrl:!0,shift:!1,alt:!1}:1===e.length&&e.charCodeAt(0)>=32&&e.charCodeAt(0)<=126?{key:"char",char:e,ctrl:!1,shift:e!==e.toLowerCase(),alt:!1}:e.length>=1&&!e.startsWith("")?{key:"char",char:e,ctrl:!1,shift:!1,alt:!1}:{key:"unknown",char:e,ctrl:!1,shift:!1,alt:!1}}(e);if(this.vuettyInstance?.debugServer&&this.vuettyInstance.debugServer.captureEvent("input.key",{key:t.key,char:t.char,shift:t.shift,ctrl:t.ctrl,alt:t.alt}),t.key!==Oe)if(t.alt&&"m"===t.key)this.vuettyInstance&&this.vuettyInstance.toggleMouseTracking();else if("tab"!==t.key){if(this.viewportHandler){if(this.viewportHandler(t))return}if(this.focusedId.value){const e=this.components.get(this.focusedId.value);if(e&&!e.disabled&&e.handler){if(e.handler(t))return void this.onInputChange()}}for(const e of this.componentOrder){const n=this.components.get(e);if(!n||n.disabled||!1!==n.focusable)continue;if(n.handler(t))return void this.onInputChange()}}else t.shift?this.focusPrevious():this.focusNext();else this.onExit()}handleMouseEvent(e){const t=Xe(e);if(t&&(this.vuettyInstance?.debugServer&&this.vuettyInstance.debugServer.captureEvent("input.mouse",{action:t.action,x:t.x,y:t.y,button:t.button}),this.viewportHandler)){if(this.viewportHandler(t))return}}getFocusedId(){return this.focusedId.value}getComponentCount(){return this.components.size}clear(){this.components.clear(),this.componentOrder=[],this.focusedId.value=null}}var cn={name:"Row",props:{...le,gap:{type:Number,default:0},justifyContent:{type:String,default:"flex-start",validator:e=>["flex-start","flex-end","center","space-between","space-around","space-evenly"].includes(e)},alignItems:{type:String,default:"stretch",validator:e=>["flex-start","flex-end","center","stretch","baseline"].includes(e)},flexWrap:{type:String,default:"nowrap",validator:e=>["nowrap","wrap","wrap-reverse"].includes(e)},responsive:{type:Boolean,default:!1}},setup(e,{slots:t}){const r=l(be,null),i=l(tt,null),o=l(ge,null);return c(tt,()=>{if(void 0!==e.height&&null!==e.height)return e.height;const t="function"==typeof i?i():i;return null!=t?t:null}),()=>{const s="function"==typeof r?r():r,l="function"==typeof i?i():i,a={...e,_injectedWidth:s,_injectedHeight:l,_viewportVersion:o?o.version:0};return n("row",a,t.default?.())}}},hn={name:"Col",props:{...le,flex:{type:[Number,String],default:"1"},gap:{type:Number,default:0},justifyContent:{type:String,default:"flex-start",validator:e=>["flex-start","flex-end","center","space-between","space-around","space-evenly"].includes(e)},alignItems:{type:String,default:"stretch",validator:e=>["flex-start","flex-end","center","stretch","baseline"].includes(e)},flexWrap:{type:String,default:"nowrap",validator:e=>["nowrap","wrap","wrap-reverse"].includes(e)},responsive:{type:Boolean,default:!1}},setup(e,{slots:t}){const r=l(be,null),i=l(tt,null),o=l(ge,null);return c(tt,()=>{if(void 0!==e.height&&null!==e.height)return e.height;const t="function"==typeof i?i():i;return null!=t?t:null}),()=>{const s=t.default?t.default():[],l="function"==typeof r?r():r,a="function"==typeof i?i():i,c={...e,_injectedWidth:l,_injectedHeight:a,_viewportVersion:o?o.version:0};return n("col",c,s)}}};const un=Object.freeze({}),dn=new Map;function pn(e){if(!e||0===Object.keys(e).length)return un;const t=Object.keys(e).sort().map(t=>`${t}:${e[t]}`).join("|");let n=dn.get(t);if(n)return n;if(n=Object.freeze({...e}),dn.size>=30){const e=dn.keys().next().value;dn.delete(e)}return dn.set(t,n),n}function fn(e){if(!e||!Array.isArray(e))return"";const t=[];for(const n of e)switch(n.type){case"text":n.text&&t.push(n.text);break;case"strong":case"em":t.push(n.tokens?fn(n.tokens):n.text||"");break;case"codespan":t.push(` ${n.text} `);break;case"link":t.push(`${n.text} (${n.href})`);break;case"del":t.push(`~~${n.text}~~`);break;case"br":t.push("\n");break;default:n.raw&&t.push(n.raw)}return t.join("")}function gn(e,t,r){if(!e||!Array.isArray(e))return[];const{TextBox:i}=t,o=[];for(const s of e)switch(s.type){case"text":s.text&&o.push(n(i,{bg:r.bg},{default:()=>s.text}));break;case"strong":o.push(n(i,{bold:!0,color:r.strongColor,bg:r.bg},{default:()=>s.tokens?gn(s.tokens,t,r):s.text}));break;case"em":o.push(n(i,{italic:!0,color:r.emphasisColor,bg:r.bg},{default:()=>s.tokens?gn(s.tokens,t,r):s.text}));break;case"codespan":o.push(n(i,{color:r.codeColor,bg:r.codeBg},{default:()=>` ${s.text} `}));break;case"link":o.push(n(i,{color:r.linkColor,underline:!0,bg:r.bg},{default:()=>`${s.text} (${s.href})`}));break;case"del":o.push(n(i,{dim:!0,bg:r.bg},{default:()=>`~~${s.text}~~`}));break;case"br":o.push(n(t.Newline));break;default:s.raw&&o.push(n(i,{bg:r.bg},{default:()=>s.raw}))}return o}function mn(e,t,r,i){const{TextBox:o,Newline:s}=t;if(!i||i<=0)return[...gn(e.tokens,t,r),n(s)];const l=bn(vn(e.tokens,r),i),a=[];for(let e=0;e<l.length;e++){const t=l[e];for(const e of t)a.push(n(o,e.style,{default:()=>e.text}));e<l.length-1&&a.push(n(s))}return a.push(n(s)),a}function vn(e,t,n=null){const r=[];if(!e||!Array.isArray(e))return r;const i=n||un;for(const n of e)switch(n.type){case"text":n.text&&r.push({text:n.text,style:i});break;case"strong":if(n.tokens){const e=pn({...i,bold:!0,color:t.strongColor});r.push(...vn(n.tokens,t,e))}else n.text&&r.push({text:n.text,style:pn({...i,bold:!0,color:t.strongColor})});break;case"em":if(n.tokens){const e=pn({...i,italic:!0,color:t.emphasisColor});r.push(...vn(n.tokens,t,e))}else n.text&&r.push({text:n.text,style:pn({...i,italic:!0,color:t.emphasisColor})});break;case"codespan":r.push({text:` ${n.text} `,style:pn({...i,color:t.codeColor,bg:t.codeBg})});break;case"link":r.push({text:`${n.text} (${n.href})`,style:pn({...i,color:t.linkColor,underline:!0})});break;case"del":r.push({text:`~~${n.text}~~`,style:pn({...i,dim:!0})});break;default:n.raw&&r.push({text:n.raw,style:i})}return r}function bn(e,t){const n=[[]];let r=0;for(const i of e){const e=i.text.split(/(\s+)/);for(const o of e){if(!o)continue;const e=J(o);if(r+e<=t){n[n.length-1].push({text:o,style:i.style}),r+=e}else if(e>t){let e=o;for(;e.length>0;){const o=t-r;if(o<=0){n.push([]),r=0;continue}let s="",l=0;for(const t of e){const e=J(t);if(!(l+e<=o))break;s+=t,l+=e}s&&(n[n.length-1].push({text:s,style:i.style}),r+=l,e=e.slice(s.length)),e.length>0&&(n.push([]),r=0)}}else n.push([{text:o,style:i.style}]),r=e}}return n.filter(e=>e.length>0).map(e=>e.length>0&&e[0].text.match(/^\s+$/)?e.slice(1):(e.length>0&&(e[0]={...e[0],text:e[0].text.trimStart()}),e)).filter(e=>e.length>0)}function yn(e,t,r,i=0,o=null){const{TextBox:s,Newline:l}=t,a=[],c=" ".repeat(i),h=2*i;return e.items.forEach((u,d)=>{const p=e.ordered?`${e.start+d}. `:"• ",f=J(p);let g="",m=0;u.task&&(g=u.checked?"[✓] ":"[ ] ",m=J(g));const v=o?o-h-f-m:null;if(a.push(n(s,{color:r.listBulletColor},{default:()=>c+g+p})),u.tokens)for(const e of u.tokens)if("text"===e.type)if(v&&e.text){bn(vn(e.tokens||[{type:"text",text:e.text}],r),v).forEach((e,t)=>{t>0&&(a.push(n(l)),a.push(n(s,{},{default:()=>" ".repeat(h+f+m)})));for(const t of e)a.push(n(s,t.style,{default:()=>t.text}))})}else a.push(...gn(e.tokens||[{type:"text",text:e.text}],t,r));else if("list"===e.type)a.push(n(l)),a.push(...yn(e,t,r,i+1,o));else if("paragraph"===e.type)if(v){const n=mn(e,t,r,v);for(;n.length>0&&n[n.length-1].type===l;)n.pop();a.push(...n)}else a.push(...gn(e.tokens,t,r));a.push(n(l))}),a}function wn(e){if(!e||!Array.isArray(e))return"";let t="";for(const n of e)n.text?t+=n.text:n.tokens?t+=wn(n.tokens):n.raw&&(t+=n.raw);return t}const xn=2166136261,Sn=16777619;function Cn(e,t=0){if(!e)return 0;let n=xn;const r=e.type||"";for(let e=0;e<r.length;e++)n^=r.charCodeAt(e),n=Math.imul(n,Sn);const i=e.text;if(i){n^=i.length,n=Math.imul(n,Sn);const e=Math.min(i.length,50);for(let t=0;t<e;t++)n^=i.charCodeAt(t),n=Math.imul(n,Sn)}const o=e.props;if(o)for(const e of E){const t=o[e];if(void 0!==t)if("number"==typeof t)n^=0|t,n=Math.imul(n,Sn);else if("boolean"==typeof t)n^=t?1:0,n=Math.imul(n,Sn);else if("string"==typeof t){const e=Math.min(t.length,30);for(let r=0;r<e;r++)n^=t.charCodeAt(r),n=Math.imul(n,Sn)}else Array.isArray(t)&&(n^=t.length,n=Math.imul(n,Sn))}const s=e.children;if(s&&s.length>0&&t<10){n^=s.length,n=Math.imul(n,Sn);const e=s.length;if(e<=20)for(let r=0;r<e;r++){n^=Cn(s[r],t+1),n=Math.imul(n,Sn)}else{const r=[0,1,2,3,4,Math.floor(e/2)-2,Math.floor(e/2)-1,Math.floor(e/2),Math.floor(e/2)+1,Math.floor(e/2)+2,e-5,e-4,e-3,e-2,e-1];for(const i of r)if(i>=0&&i<e){n^=Cn(s[i],t+1),n=Math.imul(n,Sn)}}}else s&&s.length>0&&(n^=s.length,n=Math.imul(n,Sn));return n>>>0}function Mn(e,t=null,n=1/0){const r=function(e,t=1/0){if(!e)return 0;let n=xn;const r=t===1/0?e.length:Math.min(e.length,t);let i=0;const o=r-3;for(;i<o;)n^=e.charCodeAt(i),n=Math.imul(n,Sn),n^=e.charCodeAt(i+1),n=Math.imul(n,Sn),n^=e.charCodeAt(i+2),n=Math.imul(n,Sn),n^=e.charCodeAt(i+3),n=Math.imul(n,Sn),i+=4;for(;i<r;)n^=e.charCodeAt(i++),n=Math.imul(n,Sn);return n>>>0}(e,n);return`${r}:${null!=t?String(t):"auto"}`}let kn=null;class In{constructor(e=5,t=500){this.maxSize=e,this.maxTotalTokens=t,this.cache=new Map,this.totalTokens=0}_countTokens(e){if(!Array.isArray(e))return 0;let t=e.length;for(const n of e)if(n.tokens&&(t+=this._countTokens(n.tokens)),n.items)for(const e of n.items)e.tokens&&(t+=this._countTokens(e.tokens));return t}get(e){const t=this.cache.get(e);return t?(this.cache.delete(e),this.cache.set(e,t),t.tokens):null}set(e,t){const n=this.cache.get(e);n&&(this.totalTokens-=n.count,this.cache.delete(e));const r=this._countTokens(t);for(;this.totalTokens+r>this.maxTotalTokens&&this.cache.size>0;){const e=this.cache.keys().next().value,t=this.cache.get(e);this.totalTokens-=t.count,this.cache.delete(e)}for(;this.cache.size>=this.maxSize;){const e=this.cache.keys().next().value,t=this.cache.get(e);this.totalTokens-=t.count,this.cache.delete(e)}this.cache.set(e,{tokens:t,count:r}),this.totalTokens+=r}clear(){this.cache.clear(),this.totalTokens=0}get size(){return this.cache.size}}var _n={name:"Markdown",props:{content:{type:String,required:!0,default:""},h1Color:{type:String,default:"cyan"},h2Color:{type:String,default:"cyan"},h3Color:{type:String,default:"blue"},h4Color:{type:String,default:"blue"},h5Color:{type:String,default:"blue"},h6Color:{type:String,default:"blue"},codeColor:{type:String,default:"yellow"},codeBg:{type:String,default:"#1a1a24"},linkColor:{type:String,default:"blue"},emphasisColor:{type:String,default:"white"},strongColor:{type:String,default:"white"},blockquoteColor:{type:String,default:"gray"},blockquoteBorderColor:{type:String,default:"gray"},listBulletColor:{type:String,default:"green"},listNumberColor:{type:String,default:"green"},hrColor:{type:String,default:"gray"},hrChar:{type:String,default:"─"},hrLength:{type:Number,default:60},tableHeaderColor:{type:String,default:"cyan"},tableBorderColor:{type:String,default:"white"},color:String,bg:String,bold:Boolean,italic:Boolean,dim:Boolean,...ae,padding:{type:Number,default:0}},setup(e){const t={TextBox:ut,Box:lt,Divider:ce,Newline:pe,Table:Je,Row:cn},r=l(be,null),i=new In(5,500);kn=i;let o="",s=null;function a(){if(null!==e.width&&void 0!==e.width)return e.width;if(null!==r){const e="function"==typeof r?r():r;if(null!=e&&e>0)return e}return null}function c(e,t,r,i,o){const{TextBox:s,Divider:l,Newline:a}=t,c=[];switch(e.type){case"heading":{const i="#".repeat(e.depth)+" ",o=r[`h${e.depth}Color`];c.push(n(s,{bold:!0,color:o,bg:r.bg},{default:()=>[i,...gn(e.tokens,t,r)]})),c.push(n(a));break}case"paragraph":if(!(e.tokens&&e.tokens.some(e=>"strong"===e.type||"em"===e.type||"codespan"===e.type))&&e.tokens){const t=fn(e.tokens);c.push(n(s,{bg:r.bg},{default:()=>t}))}else c.push(...mn(e,t,r,o));break;case"code":c.push(...function(e,t,r,i=null){const{TextBox:o,Box:s,Newline:l}=t,a=e.text,c=e.lang||"text",h=[];"text"!==c&&(h.push(n(o,{color:r.codeColor,dim:!0},{default:()=>`[${c}]`})),h.push(n(l)));const u=i?i-4:null;let d,p=a;if(u&&u>0){const e=a.split("\n").map(e=>J(e)>u?Z(e,u):e);p=e.join("\n")}try{const e=w(p,{language:c,ignoreIllegals:!0});d=n(o,{},{default:()=>e})}catch(e){d=n(o,{color:r.codeColor},{default:()=>p})}const f={border:!0,padding:1,color:r.tableBorderColor,bg:r.codeBg};return i&&(f.width=i),h.push(n(s,f,{default:()=>d})),h}(e,t,r)),c.push(n(a));break;case"blockquote":c.push(function(e,t,r,i,o=null){const{Box:s}=t,l=o?o-4:null,a=e.tokens.map(e=>i(e,t,r,i,l)).flat();for(;a.length>0&&a[a.length-1].type===t.Newline;)a.pop();const c={border:!0,padding:1,color:r.blockquoteBorderColor};return o&&(c.width=o),n(s,c,{default:()=>a})}(e,t,r,i)),c.push(n(a));break;case"list":c.push(...yn(e,t,r,0,o));break;case"table":c.push(function(e,t,r,i=null){const{TextBox:o,Newline:s}=t,l=e.header.map(e=>wn(e.tokens)),a=e.rows.map(e=>e.map(e=>wn(e.tokens)));let c=l.map((e,t)=>{const n=J(e),r=Math.max(...a.map(e=>J(e[t]||"")),0);return Math.max(n,r)+2});if(i&&c.reduce((e,t)=>e+t,0)+c.length+1>i){const e=i-c.length-1,t=c.reduce((e,t)=>e+t,0);if(e>0){const n=e/t;c=c.map(e=>Math.max(4,Math.floor(e*n)))}}const h=[],u=(e,t)=>{const n=String(e||""),r=J(n),i=t-2;if(r>i){let e="",t=0;for(const r of n){const n=J(r);if(t+n>i-1)break;e+=r,t+=n}return" "+e+"…"+" ".repeat(Math.max(0,i-t-1))}return" "+n+" ".repeat(Math.max(0,i-r+1))};let d="┌";c.forEach((e,t)=>{d+="─".repeat(e),d+=t<c.length-1?"┬":"┐"}),h.push(n(o,{color:r.tableBorderColor},{default:()=>d})),h.push(n(s)),h.push(n(o,{color:r.tableBorderColor},{default:()=>"│"})),l.forEach((e,t)=>{h.push(n(o,{color:r.tableHeaderColor,bold:!0},{default:()=>u(e,c[t])})),h.push(n(o,{color:r.tableBorderColor},{default:()=>"│"}))}),h.push(n(s));let p="├";c.forEach((e,t)=>{p+="─".repeat(e),p+=t<c.length-1?"┼":"┤"}),h.push(n(o,{color:r.tableBorderColor},{default:()=>p})),h.push(n(s)),a.forEach(e=>{h.push(n(o,{color:r.tableBorderColor},{default:()=>"│"})),e.forEach((e,t)=>{h.push(n(o,{},{default:()=>u(e,c[t])})),h.push(n(o,{color:r.tableBorderColor},{default:()=>"│"}))}),h.push(n(s))});let f="└";return c.forEach((e,t)=>{f+="─".repeat(e),f+=t<c.length-1?"┴":"┘"}),h.push(n(o,{color:r.tableBorderColor},{default:()=>f})),h}(e,t,r)),c.push(n(a));break;case"hr":{const e=o||r.hrLength;c.push(n(l,{char:r.hrChar,length:e,color:r.hrColor})),c.push(n(a));break}case"html":c.push(n(s,{dim:!0},{default:()=>e.text})),c.push(n(a));break;case"space":c.push(n(a));break;default:e.raw&&(c.push(n(s,{},{default:()=>e.raw})),c.push(n(a)))}return c}return()=>{const r=function(){const t=a();if(null===t)return null;const n=2*e.padding;return Math.max(0,t-n)}(),l=e.content||"";l!==o&&(o=l,s=function(e){if(!e||""===e.trim())return[];const t=Mn(e,null,1e4),n=i.get(t);if(n)return n;try{const n=y.lexer(e);return i.set(t,n),n}catch(e){return console.error("Markdown parse error:",e),[]}}(l));const h=e.bg,u=function(r,i,o){if(!r||0===r.length)return[n(ut,{bg:o},{default:()=>""})];const s={...e,bg:o},l=[];for(const e of r)l.push(...c(e,t,s,c,i));for(;l.length>0&&l[l.length-1].type===pe;)l.pop();return l.length>0?l:[n(ut,{bg:o},{default:()=>""})]}(s,r,h),d={padding:e.padding,width:a(),color:e.color,bg:h,bold:e.bold,italic:e.italic,dim:e.dim,border:!1};return n(lt,d,{default:()=>u})}}},Ln=Object.freeze({__proto__:null,BigText:Mt,Box:lt,Button:qt,Checkbox:jt,Col:hn,Divider:ce,Gradient:Tt,Image:pt,Markdown:_n,Newline:pe,ProgressBar:ye,Radiobox:Gt,Row:cn,SelectInput:Ft,Spacer:de,Spinner:ue,Table:Je,TextBox:ut,TextInput:Nt,Tree:bt,clearBigTextCache:It,getBigTextCacheStats:_t});const En="[2K";class Tn{static cursorCache=(()=>{const e=new Array(500);for(let t=0;t<500;t++)e[t]=`[${t+1};1H`;return e})();static cursorTo(e){return Tn.cursorCache[e]??`[${e+1};1H`}constructor(e=process.stdout){this.stream=e,this.previousLines=[],this.previousLineCount=0,this.previousContent="",this.bufferParts=[]}_detectChangeRegion(e,t){const n=[],r=Math.max(e.length,t.length);for(let i=0;i<r;i++)e[i]!==t[i]&&n.push(i);return 0===n.length?null:{firstChanged:n[0],lastChanged:n[n.length-1],totalChanged:n.length}}render(e){if(e===this.previousContent)return;this.previousContent=e;const t=e.split("\n"),n=this.previousLines,r=t.length,i=n.length;if(!this._detectChangeRegion(t,n))return this.previousLines=t,void(this.previousLineCount=r);this.bufferParts.length=0,this.bufferParts.push("[?2026h"),0===i||Math.abs(r-i)>20?this._fullRedraw(t):this._incrementalUpdate(t,n),this.bufferParts.push("[?2026l"),this.stream.write(this.bufferParts.join("")),this.previousLines=t,this.previousLineCount=r}_fullRedraw(e){this.bufferParts.push("[H");const t=e.length;for(let n=0;n<t;n++)n>0&&this.bufferParts.push("\n"),this.bufferParts.push(En,e[n]);this.bufferParts.push("[J")}_incrementalUpdate(e,t){const n=e.length,r=t.length,i=Math.max(n,r);let o=0;for(let n=0;n<i;n++)e[n]!==t[n]&&o++;if(o>.7*i)this._fullRedraw(e);else{for(let r=0;r<i;r++){const i=e[r],o=t[r];r>=n?this.bufferParts.push(Tn.cursorTo(r),En):i!==o&&this.bufferParts.push(Tn.cursorTo(r),En,i)}n<r&&this.bufferParts.push(Tn.cursorTo(n),"[J")}}renderScroll(e){this.render(e)}clear(){this.previousLines=[],this.previousLineCount=0,this.previousContent=""}done(){this.stream.write("[?25h"),this.clear()}}function Bn(e,t){if(!e)return 0;if(t<=0)return 1;if(!(-1!==e.indexOf("\n"))){const n=J(e);return n<=t?1:Math.ceil(n/t)}const n=e.split("\n");let r=0;for(let e=0;e<n.length;e++){const i=n[e];if(0===i.length){r+=1;continue}const o=J(i);r+=o<=t?1:Math.ceil(o/t)}return Math.max(1,r)}function On(e){if(!e)return"";if(e.text)return e.text;if(e.props?.text)return e.props.text;const t=e.children;if(!t||0===t.length)return"";if(1===t.length){const e=t[0];return"string"==typeof e?e:"text"===e?.type?e.text||"":On(e)}const n=[];for(let e=0;e<t.length;e++){const r=t[e];if("string"==typeof r)n.push(r);else if("text"===r?.type)r.text&&n.push(r.text);else if(r){const e=On(r);e&&n.push(e)}}return n.join("")}class Hn{applyLayout(e,t,n){return{}}}class Rn extends Hn{applyLayout(e,t,n){const{containerWidth:r,containerHeight:i}=n;return e.setFlexDirection(x.FLEX_DIRECTION_COLUMN),e.setWidth(r),i&&i!==1/0&&(e.setHeight(i),e.setMaxHeight(i)),e.setAlignItems(x.ALIGN_STRETCH),{}}}class An extends Hn{applyLayout(e,t,n){const r=t.props||{};return e.setFlexDirection(x.FLEX_DIRECTION_ROW),void 0!==r.width&&null!==r.width||e.setWidthPercent(100),void 0!==r.height?"string"==typeof r.height&&r.height.endsWith("%")?e.setHeightPercent(parseFloat(r.height)):(e.setHeight(r.height),e.setMinHeight(r.height),e.setMaxHeight(r.height)):void 0!==r._injectedHeight&&null!==r._injectedHeight&&(e.setMaxHeight(r._injectedHeight),process.env.DEBUG_FLEX&&console.log(`[DEBUG] ${t.type}Handler: setting maxHeight=${r._injectedHeight} (from injected)`)),{}}}class Dn extends Hn{applyLayout(e,t,n){e.setFlexDirection(x.FLEX_DIRECTION_COLUMN);const r=t.props||{},{containerHeight:i}=n;return void 0!==r.height?"string"==typeof r.height&&r.height.endsWith("%")?e.setHeightPercent(parseFloat(r.height)):(e.setHeight(r.height),e.setMinHeight(r.height),e.setMaxHeight(r.height),process.env.DEBUG_FLEX&&console.log(`[DEBUG] ColHandler: setting height=${r.height} (min/max enforced)`)):void 0!==r._injectedHeight&&null!==r._injectedHeight?(e.setMaxHeight(r._injectedHeight),process.env.DEBUG_FLEX&&console.log(`[DEBUG] ColHandler: setting maxHeight=${r._injectedHeight} (from injected)`)):i&&i!==1/0&&(e.setHeight(i),e.setMaxHeight(i),process.env.DEBUG_FLEX&&console.log(`[DEBUG] ColHandler: setting height+maxHeight=${i} (from containerHeight)`)),{}}}class Nn extends Hn{applyLayout(e,t,n){const r=J(t.text||"");return e.setWidth(r),e.setHeight(1),{}}}class Wn extends Hn{applyLayout(e,t,n){const{containerWidth:r}=n,i=t.props||{},o=On(t);let s=r;null!=i.width?s="string"==typeof i.width&&i.width.endsWith("%")?Math.floor(r*parseFloat(i.width)/100):i.width:void 0!==i._injectedWidth&&null!==i._injectedWidth&&(s=i._injectedWidth);const l=Bn(o,s);return e.setHeight(l),{hasTextBoxes:!0}}}class $n extends Hn{applyLayout(e,t,n){const r=t.props||{},i=function(e,t){return e?{Standard:6,Big:8,Slant:6,Small:5,Banner:8,Block:8,Bubble:7,Digital:6,Ivrit:6,Lean:7,Mini:4,Script:6,Shadow:7,Smscript:5,Smshadow:6,Smslant:5,Terrace:6,Thick:6}[t]||6:0}(On(t),r.font||"Standard");return e.setHeight(i),void 0===r.width&&void 0===r.flex&&e.setWidthPercent(100),{}}}class Fn extends Hn{applyLayout(e,t,n){const r=t.props||{};return e.setHeight(1),void 0!==r.length?e.setWidth(r.length):void 0===r.width&&void 0===r.flex&&e.setWidthPercent(100),{}}}class zn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=r.label||"",o=r.height||10,s=r.headers||[],l=r.rows||[],a=!1!==r.showHeader,c=r.isFocused||!1,h=r.disabled||!1;if(0===s.length&&0===l.length){let t=3;i&&(t+=1),e.setHeight(t)}else{let t=1;i&&(t+=1),a&&s.length>0&&(t+=2),t+=o,t+=1,c&&!h&&(t+=1),l.length>o&&(t+=1),e.setHeight(t)}return void 0===r.width&&void 0===r.flex&&e.setWidthPercent(100),{}}}class jn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=r.imageLines||1;return e.setHeight(i),void 0===r.width&&void 0===r.flex&&e.setWidthPercent(100),{}}}class Pn extends Hn{applyLayout(e,t,n){const r=(t.props||{}).count||1;return e.setHeight(Math.max(1,r)),{}}}class Vn extends Hn{applyLayout(e,t,n){const r=(t.props||{}).lines||1;return e.setHeight(Math.max(1,r)),{}}}class Gn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=4+J(r.label||"");return e.setHeight(1),void 0===r.width&&void 0===r.flex&&e.setWidth(i),{}}}class Un extends Hn{applyLayout(e,t,n){const{containerWidth:r}=n,i=t.props||{},o=i.label||"",s=i.rows||3,l=i.minRows||1,a=i.maxRows,c=i.autoResize||!1,h=i.text||"",u=i.hint,d=i.validationError,p=i.isFocused||!1,f=i.disabled||!1;let g=r;null!=i.width?g="string"==typeof i.width&&i.width.endsWith("%")?Math.floor(r*parseFloat(i.width)/100):i.width:void 0!==i._injectedWidth&&null!==i._injectedWidth&&(g=i._injectedWidth);let m=s;if(c){const e=h?Bn(h,g):l;m=Math.max(l,e),a&&(m=Math.min(m,a))}let v=1+m+1;return o&&(v+=1),(d||p&&!f&&!1!==u&&""!==u)&&(v+=1),e.setHeight(v),null!=i.width&&("string"==typeof i.width&&i.width.endsWith("%")?e.setWidthPercent(parseFloat(i.width)):e.setWidth(i.width+2)),{}}}class Yn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=r.label||"",o=r.height||10,s=r.options||[],l=r.isFocused||!1,a=r.disabled||!1;if("vertical"===(r.direction||"vertical")){let t=1+(0===s.length?1:Math.min(o,s.length))+1;if(i&&(t+=1),l&&!a&&(t+=1),s.length>o&&(t+=1),e.setHeight(t),void 0===r.width&&void 0===r.flex){let t=20;for(let e=0;e<s.length;e++){const n=J(s[e].label||String(s[e].value));n>t&&(t=n)}e.setWidth(t+8)}}else e.setHeight(i?4:3);return{}}}class Xn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=r.label||"",o=r.height||10,s=r.options||[],l=r.isFocused||!1,a=r.disabled||!1;if("vertical"===(r.direction||"vertical")){let t=1+(0===s.length?1:Math.min(o,s.length))+1;if(i&&(t+=1),l&&!a&&(t+=1),s.length>o&&(t+=1),e.setHeight(t),void 0===r.width&&void 0===r.flex){let t=20;for(let e=0;e<s.length;e++){const n=J(s[e].label||String(s[e].value));n>t&&(t=n)}e.setWidth(t+8)}}else e.setHeight(i?4:3);return{}}}class qn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=r.label||"",o=r.height||10,s=r.options||[],l=r.isFocused||!1,a=r.disabled||!1;let c=1+(0===s.length?1:Math.min(o,s.length))+1;if(i&&(c+=1),l&&!a&&(c+=1),s.length>o&&(c+=1),e.setHeight(c),void 0===r.width&&void 0===r.flex){let t=20;for(let e=0;e<s.length;e++){const n=J(s[e].label||String(s[e].value));n>t&&(t=n)}e.setWidth(t+4)}return{}}}class Jn extends Hn{applyLayout(e,t,n){const r=t.props||{},i=r.border,o=r.padding||0,s=!1!==i,l=!!r.bg;if((s||0!==o||l)&&(s?e.setBorder(x.EDGE_ALL,1):l&&(e.setPadding(x.EDGE_TOP,1),e.setPadding(x.EDGE_BOTTOM,1))),void 0!==r.maxHeight){const t=s||l?2:0,n=2*o,i=r.maxHeight+t+n;e.setMaxHeight(i)}return{}}}class Kn extends Hn{applyLayout(e,t,n){const r=t.props||{};const i=function e(t){if(!t||0===t.length)return 0;let n=0;for(const r of t)n++,r.children&&r.children.length>0&&(n+=e(r.children));return n}(r.data||[]);return e.setHeight(Math.max(1,i)),void 0===r.width&&void 0===r.flex&&e.setWidthPercent(100),{}}}const Zn=new class{constructor(){this.handlers=new Map,this._registerDefaultHandlers()}_registerDefaultHandlers(){this.register("root",new Rn),this.register("row",new An),this.register("col",new Dn),this.register("text",new Nn),this.register("textbox",new Wn),this.register("bigtext",new $n),this.register("divider",new Fn),this.register("table",new zn),this.register("image",new jn),this.register("newline",new Pn),this.register("spacer",new Vn),this.register("button",new Gn),this.register("textinput",new Un),this.register("checkbox",new Yn),this.register("radiobox",new Xn),this.register("selectinput",new qn),this.register("box",new Jn),this.register("tree",new Kn)}register(e,t){this.handlers.set(e,t)}get(e){return this.handlers.get(e)||null}has(e){return this.handlers.has(e)}};class Qn{constructor(){this.cache=N,this._lastCacheKey=null}computeLayout(e,t,n){if(!e)return{width:0,height:0,x:0,y:0,children:[]};const r=`${t}:${n}:${Cn(e)}`,i=this.cache.getLayoutMetrics(e,r);if(i)return this.restoreCachedMetrics(e,i),e.isLayoutDirty=!1,i;this._hasTextBoxes=!1;const o=this.buildYogaTree(e,t,n,null,0,0);try{if(o.calculateLayout(t,n,x.DIRECTION_LTR),this._hasTextBoxes){this.updateTextHeights(o,e)&&o.calculateLayout(t,n,x.DIRECTION_LTR)}const i=this.extractMetrics(o,e);return this.cache.setLayoutMetrics(e,r,i),e.cachedLayoutMetrics=i,e.isLayoutDirty=!1,i}finally{this.freeYogaTree(o)}}updateTextHeights(e,t){let n=!1;if("textbox"===t.type){const r=e.getComputedWidth(),i=Bn(On(t),r),o=e.getComputedHeight();i!==o&&Math.abs(i-o)>.5&&(e.setHeight(i),n=!0)}const r=t.children;if(r&&r.length>0){let t=0;for(let i=0;i<r.length;i++){const o=r[i];if("comment"!==o.type){const r=e.getChild(t);r&&this.updateTextHeights(r,o)&&(n=!0),t++}}}return n}restoreCachedMetrics(e,t){if(e.cachedLayoutMetrics===t)return;e.cachedLayoutMetrics=t;const n=e.children,r=t.children;if(r&&n){let e=0;for(let t=0;t<n.length;t++){const i=n[t];if("comment"!==i.type){const t=r[e];t&&this.restoreCachedMetrics(i,t),e++}}}}_getComponentType(e,t){return"row"===t.flexDirection?"row":"column"===t.flexDirection?"col":e.type}_applyFlexProperties(e,t){if(void 0!==t.flex)if("number"==typeof t.flex)e.setFlexGrow(t.flex),e.setFlexShrink(1);else if("string"==typeof t.flex){const n=t.flex.split(/\s+/);if(1!==n.length||isNaN(parseFloat(n[0])))n[0]&&e.setFlexGrow(parseFloat(n[0])||0),n[1]&&e.setFlexShrink(parseFloat(n[1])||1),n[2]&&"auto"!==n[2]&&e.setFlexBasis(parseFloat(n[2])||0);else{const t=parseFloat(n[0]);e.setFlexGrow(t),e.setFlexShrink(1),0!==t&&e.setFlexBasis(0)}}if(void 0!==t.flexGrow&&null!==t.flexGrow&&e.setFlexGrow(t.flexGrow),void 0!==t.flexShrink&&null!==t.flexShrink&&e.setFlexShrink(t.flexShrink),void 0!==t.flexBasis&&null!==t.flexBasis&&e.setFlexBasis(t.flexBasis),t.justifyContent){const n={"flex-start":x.JUSTIFY_FLEX_START,"flex-end":x.JUSTIFY_FLEX_END,center:x.JUSTIFY_CENTER,"space-between":x.JUSTIFY_SPACE_BETWEEN,"space-around":x.JUSTIFY_SPACE_AROUND,"space-evenly":x.JUSTIFY_SPACE_EVENLY}[t.justifyContent];void 0!==n&&e.setJustifyContent(n)}if(t.alignItems){const n={"flex-start":x.ALIGN_FLEX_START,"flex-end":x.ALIGN_FLEX_END,center:x.ALIGN_CENTER,stretch:x.ALIGN_STRETCH,baseline:x.ALIGN_BASELINE}[t.alignItems];void 0!==n&&e.setAlignItems(n)}if(t.alignSelf){const n={auto:x.ALIGN_AUTO,"flex-start":x.ALIGN_FLEX_START,"flex-end":x.ALIGN_FLEX_END,center:x.ALIGN_CENTER,stretch:x.ALIGN_STRETCH,baseline:x.ALIGN_BASELINE}[t.alignSelf];void 0!==n&&e.setAlignSelf(n)}if(t.responsive)e.setFlexWrap(x.WRAP_WRAP);else if(t.flexWrap){const n={wrap:x.WRAP_WRAP,nowrap:x.WRAP_NO_WRAP,"wrap-reverse":x.WRAP_WRAP_REVERSE}[t.flexWrap];void 0!==n&&e.setFlexWrap(n)}if(t.alignContent){const n={"flex-start":x.ALIGN_FLEX_START,"flex-end":x.ALIGN_FLEX_END,center:x.ALIGN_CENTER,stretch:x.ALIGN_STRETCH,"space-between":x.ALIGN_SPACE_BETWEEN,"space-around":x.ALIGN_SPACE_AROUND}[t.alignContent];void 0!==n&&e.setAlignContent(n)}}_applyPaddingProperties(e,t){void 0!==t.padding&&null!==t.padding&&e.setPadding(x.EDGE_ALL,t.padding),void 0!==t.paddingLeft&&null!==t.paddingLeft&&e.setPadding(x.EDGE_LEFT,t.paddingLeft),void 0!==t.paddingRight&&null!==t.paddingRight&&e.setPadding(x.EDGE_RIGHT,t.paddingRight),void 0!==t.paddingTop&&null!==t.paddingTop&&e.setPadding(x.EDGE_TOP,t.paddingTop),void 0!==t.paddingBottom&&null!==t.paddingBottom&&e.setPadding(x.EDGE_BOTTOM,t.paddingBottom)}_applyMarginProperties(e,t,n,r,i,o){if(void 0!==t.margin){const s=n>0&&r>0&&i?n:0,l=n>0&&r>0&&o?n:0;e.setMargin(x.EDGE_LEFT,s+t.margin),e.setMargin(x.EDGE_RIGHT,t.margin),e.setMargin(x.EDGE_TOP,l+t.margin),e.setMargin(x.EDGE_BOTTOM,t.margin)}else{if(void 0!==t.marginLeft){const o=n>0&&r>0&&i?n:0;e.setMargin(x.EDGE_LEFT,o+t.marginLeft)}if(void 0!==t.marginRight&&e.setMargin(x.EDGE_RIGHT,t.marginRight),void 0!==t.marginTop){const i=n>0&&r>0&&o?n:0;e.setMargin(x.EDGE_TOP,i+t.marginTop)}void 0!==t.marginBottom&&e.setMargin(x.EDGE_BOTTOM,t.marginBottom)}}buildYogaTree(e,t,n,r=null,i=0,o=0){const s=x.Node.create(),l=e.props||{},a=r?.props||{},c=a.gap||0,h="row"===r?.type||"row"===a.flexDirection,u="col"===r?.type||"column"===a.flexDirection;c>0&&i>0&&(h?s.setMargin(x.EDGE_LEFT,c):u&&s.setMargin(x.EDGE_TOP,c)),this._applyFlexProperties(s,l),this._applyPaddingProperties(s,l),this._applyMarginProperties(s,l,c,i,h,u),null!=l.width&&("string"==typeof l.width&&l.width.endsWith("%")?s.setWidthPercent(parseFloat(l.width)):s.setWidth(l.width)),void 0!==l.minWidth&&s.setMinWidth(l.minWidth),void 0!==l.maxWidth&&s.setMaxWidth(l.maxWidth),void 0!==l.minHeight&&s.setMinHeight(l.minHeight),void 0!==l.maxHeight&&s.setMaxHeight(l.maxHeight);const d=this._getComponentType(e,l),p=Zn.get(d);if(p){p.applyLayout(s,e,{containerWidth:t,containerHeight:n,parentNode:r,childIndex:i,siblingCount:o}).hasTextBoxes&&(this._hasTextBoxes=!0)}void 0===l.height||p||("string"==typeof l.height&&l.height.endsWith("%")?s.setHeightPercent(parseFloat(l.height)):s.setHeight(l.height)),void 0===l.flex&&"col"===e.type&&void 0===l.height&&(s.setFlexGrow(1),s.setFlexShrink(1),s.setFlexBasis(0));let f=t;if("box"===e.type){const e=!1!==l.border?2:0,n=2*(l.padding||0),r=l.width||l._injectedWidth||t;f=Math.max(0,r-e-n)}"col"!==e.type&&"row"!==e.type||!l.width||(f=l.width);let g=n;if("box"===e.type){const e=!1!==l.border?2:0,t=2*(l.padding||0),r=l.height||l._injectedHeight||n;g=Math.max(0,r-e-t)}"col"!==e.type&&"row"!==e.type||!l.height||(g=l.height);let m=0;for(let t=0;t<e.children.length;t++)"comment"!==e.children[t].type&&m++;let v=0;for(const t of e.children)if("comment"!==t.type){const n=this.buildYogaTree(t,f,g,e,v,m);s.insertChild(n,v),v++}return s}extractMetrics(e,t){const n=e.getComputedLayout(),r=t.children;let i=0;if(r)for(let e=0;e<r.length;e++)"comment"!==r[e].type&&i++;const o={width:Math.round(n.width),height:Math.round(n.height),x:Math.round(n.left),y:Math.round(n.top),children:i>0?new Array(i):[]};if(r&&i>0){let t=0;for(let n=0;n<r.length;n++){const i=r[n];if("comment"!==i.type){const n=e.getChild(t),r=this.extractMetrics(n,i);o.children[t]=r,i.cachedLayoutMetrics=r,t++}}}return o}freeYogaTree(e){if(!e)return;for(let t=e.getChildCount()-1;t>=0;t--){const n=e.getChild(t);this.freeYogaTree(n)}e.freeRecursive()}invalidateLayout(e){if(!e)return;const t=[e];let n=0;for(;t.length>0&&n<1e4;){const e=t.shift();n++,e.isLayoutDirty=!0,this.cache.invalidateLayoutMetrics(e);const r=e.children;if(r)for(let e=0;e<r.length;e++)t.push(r[e])}}clearCache(){this.cache.clearAll()}getStats(){return this.cache.getStats()}}class er{constructor(e=2e3){this.maxSize=e,this.cache=new Map}get(e){const t=this.cache.get(e);if(void 0!==t)return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){if(this.cache.delete(e),this.cache.set(e,t),this.cache.size>this.maxSize){const e=this.cache.keys().next().value;this.cache.delete(e)}}clear(){this.cache.clear()}get size(){return this.cache.size}}const tr=new er(2e3),nr=new Map;function rr(e,t){let n=tr.get(e);return void 0===n&&(n=t(e),tr.set(e,n)),n}function ir(e,t,n){let r=nr.get(t);if(!r){if(nr.size>=5){const e=nr.keys().next().value;nr.delete(e)}r=new er(500),nr.set(t,r)}let i=r.get(e);return void 0===i&&(i=n(e,t),r.set(e,i)),i}function or(e,t,n,r,i=null){const o=e.length,s=new Array(o);for(let l=0;l<o;l++){const o=e[l],a=rr(o,n);let c;if(c=a>t?ir(o,t,r):o,i){const e=a>t?t:a,n=Math.max(0,t-e);s[l]=i+c+i+" ".repeat(n)+"[0m"}else s[l]=c}return s}function sr(){tr.clear(),nr.clear()}class lr{constructor(){this.regions=[],this.isDirty=!0,this._scrollOffset=0,this.viewportHeight=0,this.debugServer=null}build(e,t=0,n=0){const r=e._clickRegions||[];this._scrollOffset=t,this.viewportHeight=n;this.regions=[];for(const e of r){const r=e.y-t;r<n+50&&r+e.height>-50&&this.regions.push({componentId:e.componentId,x:e.x,absY:e.y,screenY:r,width:e.width,height:e.height,depth:e.depth,nodeType:e.nodeType})}this.regions.length>500&&(this.regions=this.regions.slice(-500)),this.isDirty=!1,this.debugServer&&this.debugServer.captureEvent("clickmap.build",{sourceCount:r.length,filteredCount:this.regions.length,scrollOffset:t,viewportHeight:n})}hitTest(e,t){const n=e-1,r=t-1;this.debugServer&&this.debugServer.captureEvent("clickmap.hittest",{terminalX:e,terminalY:t,layoutX:n,layoutY:r,scrollOffset:this._scrollOffset,regionCount:this.regions.length});for(let e=this.regions.length-1;e>=0;e--){const t=this.regions[e],i=n>=t.x&&n<t.x+t.width,o=r>=t.screenY&&r<t.screenY+t.height;if(i&&o)return this.debugServer&&this.debugServer.captureEvent("clickmap.hit",{componentId:t.componentId,nodeType:t.nodeType,region:{x:t.x,screenY:t.screenY,width:t.width,height:t.height}}),t.componentId}return this.debugServer&&this.debugServer.captureEvent("clickmap.miss",{layoutX:n,layoutY:r}),null}adjustForScroll(e){if(this._scrollOffset===e)return;const t=e-this._scrollOffset;this._scrollOffset=e;for(let e=0;e<this.regions.length;e++)this.regions[e].screenY-=t;this.debugServer&&this.debugServer.captureEvent("clickmap.scroll",{delta:t,newScrollOffset:e,regionCount:this.regions.length})}invalidate(){this.isDirty=!0}clear(){this.regions.length=0,this.isDirty=!0,this._scrollOffset=0,this.viewportHeight=0}setDebugServer(e){this.debugServer=e}getRegions(){return this.regions}getStats(){return{regionCount:this.regions.length,maxRegions:500,isDirty:this.isDirty,scrollOffset:this._scrollOffset,viewportHeight:this.viewportHeight}}debugPrint(){console.error("=== ClickMap Debug ==="),console.error(`Scroll: ${this._scrollOffset}, Viewport: ${this.viewportHeight}, Dirty: ${this.isDirty}`),console.error(`Regions (${this.regions.length}):`);for(let e=0;e<this.regions.length;e++){const t=this.regions[e];console.error(` [${e}] ${t.nodeType} "${t.componentId}" x:${t.x}-${t.x+t.width} screenY:${t.screenY}-${t.screenY+t.height} (absY:${t.absY})`)}console.error("======================")}}const ar={background:"#0a0a0f",foreground:"#e6e8f0",primary:"#3d5eff",secondary:"#969ebd",success:"#4ecca3",warning:"#c97945",danger:"#d64d64",info:"#5eb3d6",components:{box:{color:"#4a4f6a",bg:null},textBox:{color:"#e6e8f0",bg:null},textInput:{color:"#e6e8f0",borderColor:"#3d5eff",bg:null,focusColor:"#7d5fff",errorColor:"#d64d64"},button:{variants:{primary:{bg:"#3d5eff",color:"#ffffff",bold:!0},secondary:{bg:"#5a617a",color:"#e6e8f0",bold:!1},danger:{bg:"#d64d64",color:"#ffffff",bold:!0},warning:{bg:"#c97945",color:"#ffffff",bold:!0},info:{bg:"#5eb3d6",color:"#0a0a0f",bold:!1},success:{bg:"#4ecca3",color:"#0a0a0f",bold:!0}}},checkbox:{color:"#5a617a",checkedColor:"#7d5fff",uncheckedColor:"#4a4f6a"},radiobox:{color:"#5a617a",selectedColor:"#7d5fff",unselectedColor:"#4a4f6a"}}};function cr(e,t){const n={...e};for(const r in t)void 0!==t[r]&&null!==t[r]&&("object"!=typeof t[r]||Array.isArray(t[r])?n[r]=t[r]:n[r]=cr(e[r]||{},t[r]));return n}function hr(e={}){return e&&"object"==typeof e?cr(ar,e):{...ar}}function ur(e,t){if(!e||!t)return null;const n=t.split(".");let r=e;for(const e of n){if(!r||"object"!=typeof r||!(e in r))return null;r=r[e]}return"string"==typeof r?r:null}class dr{constructor(e={}){var n;this.config={...e},e.forceColors&&(u.level=3),this.theme=hr(e.theme||{}),this.themeBgCode=(n=this.theme?.background,V(n)),this.debugServer=null,this.debugServerConfig=this.config.debugServer,this.rootContainer=new C("root"),this.rootContainer.vuettyViewport=this.viewport,this.viewportState=t({version:0,width:0,height:0}),this.app=null,this.renderer=null,this.currentOutput="",this.resizeHandler=null,this.cleanupHandler=null,this.resizeTimeout=null,this.layoutEngine=null,this.logUpdate=null,this.scrollThrottleMs=16,this.lastScrollTime=0,this.pendingScrollRender=null,this.lastScrollOffset=0,this.accumulatedScrollDelta=0,this.visibleLinesCache={offset:-1,lines:null,output:null},this.viewport={scrollOffset:0,contentHeight:0,terminalHeight:0,terminalWidth:0,enabled:!0,autoScrollToBottom:!0,mouseWheelEnabled:!0,mouseWheelScrollLines:3,scrollIndicatorMode:e.scrollIndicatorMode||"reserved",mouseTrackingEnabled:!0,...e.viewport},this.inputManager=new an({onExit:()=>this.handleExit()}),this.clickMap=new lr,this.clickHandlers=new Map,this._handlerOrder=[]}use(e,...t){if(!this.app)throw new Error("No app created. Call createApp() first.");return this.app.use(e,...t),this}handleExit(){this.unmount(),process.exit(0)}enableMouseTracking(){this.viewport.mouseTrackingEnabled||(process.stdout.write("[?1000h"),process.stdout.write("[?1006h"),this.viewport.mouseTrackingEnabled=!0,this.render())}disableMouseTracking(){this.viewport.mouseTrackingEnabled&&(process.stdout.write("[?1006l"),process.stdout.write("[?1000l"),this.viewport.mouseTrackingEnabled=!1,this.render())}toggleMouseTracking(){this.viewport.mouseTrackingEnabled?this.disableMouseTracking():this.enableMouseTracking()}handleResize(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this._resizeStartTime||(this._resizeStartTime=Date.now());const e=Date.now()-this._resizeStartTime<500?100:50;this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=null,this._resizeStartTime=null,this.performResize()},e)}performResize(){this.viewport.terminalHeight=process.stdout.rows||24,this.viewport.terminalWidth=process.stdout.columns||80,"reserved"===this.viewport.scrollIndicatorMode&&(this.viewport.terminalHeight-=1),this.updateMaxScrollOffset(),B(this.viewport),this.clampScrollOffset(),this.viewportState.version++,this.viewportState.width=this.viewport.terminalWidth,this.viewportState.height=this.viewport.terminalHeight,this.debugServer&&this.debugServer.captureEvent("vuetty.resize",{width:this.viewport.terminalWidth,height:this.viewport.terminalHeight,version:this.viewportState.version}),this.logUpdate.clear(),sr(),this.visibleLinesCache={offset:-1,lines:null,output:null},this.layoutEngine&&this.rootContainer&&this.layoutEngine.invalidateLayout(this.rootContainer),this.rootContainer&&L(this.rootContainer,!0),this.clickMap.invalidate(),this.renderer&&this.renderer.forceUpdate&&this.renderer.forceUpdate()}scrollUp(e=1){const t=Date.now(),n=Math.max(0,this.viewport.scrollOffset-e);if(n!==this.viewport.scrollOffset){if(this.viewport.scrollOffset=n,this.clickMap.isDirty||this.clickMap.adjustForScroll(n),t-this.lastScrollTime<this.scrollThrottleMs)return this.accumulatedScrollDelta-=e,void(this.pendingScrollRender||(this.pendingScrollRender=setTimeout(()=>{this.pendingScrollRender=null;const e=this.accumulatedScrollDelta;this.accumulatedScrollDelta=0,this.renderScrollSafe(e)},this.scrollThrottleMs)));this.lastScrollTime=t,this.accumulatedScrollDelta=0,this.renderScroll(-e)}}scrollDown(e=1){const t=Date.now(),n=this.viewport.maxScrollOffset,r=Math.min(n,this.viewport.scrollOffset+e);if(r!==this.viewport.scrollOffset){if(this.viewport.scrollOffset=r,this.clickMap.isDirty||this.clickMap.adjustForScroll(r),t-this.lastScrollTime<this.scrollThrottleMs)return this.accumulatedScrollDelta+=e,void(this.pendingScrollRender||(this.pendingScrollRender=setTimeout(()=>{this.pendingScrollRender=null;const e=this.accumulatedScrollDelta;this.accumulatedScrollDelta=0,this.renderScrollSafe(e)},this.scrollThrottleMs)));this.lastScrollTime=t,this.accumulatedScrollDelta=0,this.renderScroll(e)}}renderScrollSafe(e){Math.abs(e)>this.viewport.terminalHeight/2?(this.logUpdate.clear(),this.render()):this.renderScroll(e)}renderScroll(e=0){const t=this.currentOutput,n=this.visibleLinesCache;let r;n.output===t?r=n.lines:(r=t.split("\n"),n.output=t,n.lines=r),this.viewport.contentHeight=r.length,this.updateMaxScrollOffset(),this.clampScrollOffset();const i=this.viewport.scrollOffset,o=Math.min(this.viewport.scrollOffset+this.viewport.terminalHeight,this.viewport.contentHeight),s=r.slice(i,o),l=this.shouldShowScrollIndicator(),a=or(s,this.viewport.terminalWidth,J,K,this.themeBgCode);let c=a.join("\n");const h=a.length;l&&(c+="\n"+this.getScrollIndicator()),this.logUpdate.renderScroll(c,e,h),this.lastScrollOffset=this.viewport.scrollOffset}scrollToTop(){0!==this.viewport.scrollOffset&&(this.viewport.scrollOffset=0,!this.clickMap.isDirty&&this.clickMap.regions.length>0&&this.clickMap.adjustForScroll(0),this.render())}scrollToBottom(){const e=this.viewport.maxScrollOffset;this.viewport.scrollOffset!==e&&(this.viewport.scrollOffset=e,!this.clickMap.isDirty&&this.clickMap.regions.length>0&&this.clickMap.adjustForScroll(e),this.render())}pageUp(){this.scrollUp(this.viewport.terminalHeight)}pageDown(){this.scrollDown(this.viewport.terminalHeight)}clampScrollOffset(){const e=this.viewport.maxScrollOffset;this.viewport.scrollOffset=Math.max(0,Math.min(this.viewport.scrollOffset,e))}isAtBottom(){const e=this.viewport.maxScrollOffset;return this.viewport.scrollOffset>=e}handleViewportKey(e){const t=null!==this.inputManager.getFocusedId();if(e.shift&&e.key===we)return this.scrollUp(),!0;if(e.shift&&e.key===xe)return this.scrollDown(),!0;if(!t){if(e.key===Te)return this.pageUp(),!0;if(e.key===Be)return this.pageDown(),!0;if(e.key===we)return this.scrollUp(),!0;if(e.key===xe)return this.scrollDown(),!0;if(e.key===Le)return this.scrollToTop(),!0;if(e.key===Ee)return this.scrollToBottom(),!0}return!(e.key!==_e||!t)&&(this.inputManager.blur(),!0)}registerClickHandler(e,t){const n=this._handlerOrder.indexOf(e);for(-1!==n&&this._handlerOrder.splice(n,1),this._handlerOrder.push(e);this._handlerOrder.length>200;){const e=this._handlerOrder.shift();this.clickHandlers.delete(e)}this.clickHandlers.set(e,t)}unregisterClickHandler(e){this.clickHandlers.delete(e);const t=this._handlerOrder.indexOf(e);-1!==t&&this._handlerOrder.splice(t,1)}handleClick(e,t,n){this.clickMap.isDirty&&this.clickMap.build(this.rootContainer,this.viewport.scrollOffset,this.viewport.terminalHeight);const r=this.clickMap.hitTest(e,t);if(this.debugServer&&this.debugServer.captureEvent("input.click",{x:e,y:t,componentId:r,handled:!!r}),r){const e=this.clickHandlers.get(r);if(e)return this._pressedComponentId=r,e(n),this.inputManager.onInputChange(),!0}return!1}handleRelease(e,t,n){if(!this._pressedComponentId)return!1;const r=this._pressedComponentId;this._pressedComponentId=null,this.debugServer&&this.debugServer.captureEvent("input.release",{x:e,y:t,componentId:r});const i=this.clickHandlers.get(r);return!!i&&(i({...n,action:"left_release"}),this.inputManager.onInputChange(),!0)}handleViewportMouse(e){return!!this.viewport.mouseWheelEnabled&&("wheel_up"===e.action?(this.scrollUp(this.viewport.mouseWheelScrollLines),!0):"wheel_down"===e.action?(this.scrollDown(this.viewport.mouseWheelScrollLines),!0):"left_click"===e.action?this.handleClick(e.x,e.y,e):"left_release"===e.action&&this.handleRelease(e.x,e.y,e))}provideRouter(e){if(!this.app)throw new Error("No app created. Call createApp() first.");this.app.provide("vuetty:router",e)}setupCleanupHandlers(){const e=()=>{this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),process.stdout.write("[?25h"),process.stdout.write("[?1049l")};this.cleanupHandler=e,process.on("exit",this.cleanupHandler),process.on("SIGTERM",()=>{e(),process.exit(0)}),process.on("SIGHUP",()=>{e(),process.exit(0)}),process.on("uncaughtException",t=>{e(),console.error("Uncaught exception:",t),process.exit(1)}),process.on("unhandledRejection",(t,n)=>{e(),console.error("Unhandled rejection at:",n,"reason:",t),process.exit(1)})}createApp(e,t=null){return this.renderer=ln({onUpdate:e=>this.handleUpdate(e),rootContainer:this.rootContainer,beforeRender:e=>{this.debugServer&&this.debugServer.captureEvent("layout.compute",{width:this.viewport.terminalWidth,height:this.viewport.terminalHeight});const t=e.isLayoutDirty||e.childrenDirty;this.layoutEngine.computeLayout(e,this.viewport.terminalWidth,this.viewport.terminalHeight),t&&this.clickMap.invalidate()},afterRender:e=>{this.clickMap.isDirty&&this.clickMap.build(e,this.viewport.scrollOffset,this.viewport.terminalHeight)}}),this.renderer.vuettyInstance=this,this.app=this.renderer.createApp(e,t),this.debugServer&&this.debugServer.interceptVueWarnings(this.app),this.app}mount(){if(!this.app)throw new Error("No app created. Call createApp() first.");let e="";if(e+="[?1049h[2J[H",this.theme?.background){const t=function(e){if(!e)return null;let t,n,r;if(F[e])[t,n,r]=F[e];else if(W.test(e)){let i=e.slice(1);3===i.length&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),6===i.length&&(t=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),r=parseInt(i.slice(4,6),16))}else{const i=e.match($);i&&(t=parseInt(i[1],10),n=parseInt(i[2],10),r=parseInt(i[3],10))}if(void 0===t||void 0===n||void 0===r)return null;if(t<0||t>255||n<0||n>255||r<0||r>255)return null;const i=t.toString(16).padStart(2,"0"),o=n.toString(16).padStart(2,"0"),s=r.toString(16).padStart(2,"0");return`rgb:${i+i}/${o+o}/${s+s}`}(this.theme.background);t&&(e+=`]11;${t}`)}return e+="[?25l",this.viewport.mouseTrackingEnabled&&(e+="[?1000h",e+="[?1006h"),process.stdout.write(e),this.viewport.terminalHeight=process.stdout.rows||24,this.viewport.terminalWidth=process.stdout.columns||80,"reserved"===this.viewport.scrollIndicatorMode&&(this.viewport.terminalHeight-=1),this.logUpdate=new Tn(process.stdout),this.layoutEngine=new Qn,this.setupCleanupHandlers(),this.viewportState.width=this.viewport.terminalWidth,this.viewportState.height=this.viewport.terminalHeight,B(this.viewport),this.app.provide(fe,this.inputManager),this.app.provide("vuetty:renderer",this.renderer),this.app.provide(ge,this.viewportState),this.app.provide(me,this),this.app.provide(ve,this.theme),this.app.mount(this.rootContainer),this.inputManager.setVuettyInstance(this),this.inputManager.setViewportHandler(e=>e.action?this.handleViewportMouse(e):this.handleViewportKey(e)),this.inputManager.enable(),this.registerGlobalComponents(),this.resizeHandler=()=>this.handleResize(),process.on("SIGWINCH",this.resizeHandler),this.debugServerConfig?.enabled&&Promise.resolve().then(function(){return wr}).then(async({DebugServer:e})=>{const{serializeViewport:t}=await Promise.resolve().then(function(){return vr});this.debugServer=new e(this.debugServerConfig),this.debugServer.setVuettyInstance(this),this.clickMap.setDebugServer(this.debugServer);try{await this.debugServer.start(),this.debugServer.consoleInterceptor?.isActive||console.log(`Debug server running at http://${this.debugServer.config.host}:${this.debugServer.config.port}`),this.debugServer.captureEvent("vuetty.mount",{viewport:t(this.viewport)})}catch(e){console.error("[Vuetty] Failed to start debug server:",e)}}),this}unmount(){return this.pendingScrollRender&&(clearTimeout(this.pendingScrollRender),this.pendingScrollRender=null),this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),this.inputManager.disable(),this.inputManager.clear(),this.resizeHandler&&(process.removeListener("SIGWINCH",this.resizeHandler),this.resizeHandler=null),this.cleanupHandler&&(process.removeListener("exit",this.cleanupHandler),process.removeListener("SIGTERM",this.cleanupHandler),process.removeListener("SIGHUP",this.cleanupHandler),process.removeListener("uncaughtException",this.cleanupHandler),process.removeListener("unhandledRejection",this.cleanupHandler),this.cleanupHandler=null),this.app&&this.app.unmount(),this.logUpdate&&(this.logUpdate.done(),this.logUpdate=null),this.layoutEngine&&(this.layoutEngine.clearCache(),this.layoutEngine=null),this.clickHandlers.clear(),this._handlerOrder.length=0,this.clickMap&&this.clickMap.clear(),this.rootContainer&&this.rootContainer.cleanup(),this.visibleLinesCache={offset:-1,lines:null,output:null},this.viewport.mouseTrackingEnabled&&(process.stdout.write("[?1006l"),process.stdout.write("[?1000l")),this.debugServer&&(this.debugServer.captureEvent("vuetty.unmount",{}),this.debugServer.stop()),process.stdout.write("]111"),process.stdout.write("[?1049l"),process.stdout.write("[?25h"),this}registerGlobalComponents(){try{Object.entries(Ln).filter(([e,t])=>t&&"object"==typeof t&&t.name&&"function"==typeof t.setup).forEach(([e,t])=>{this.app&&"function"==typeof this.app.component&&this.app.component(t.name,t)})}catch(e){this.debugServer&&this.debugServer.captureEvent("vue.error",{message:"Failed to register global components",error:e.message,stack:e.stack})}}handleUpdate(e){const t=this.currentOutput!==e;this.currentOutput=e,this.visibleLinesCache.output=null,t&&this.clickMap.invalidate(),this.render()}shouldShowScrollIndicator(){const e="reserved"===this.viewport.scrollIndicatorMode?this.viewport.terminalHeight:process.stdout.rows||24;return this.viewport.contentHeight>e}render(){const e=this.currentOutput,t=this.visibleLinesCache;let n;t.output===e&&t.lines?n=t.lines:(n=e.split("\n"),t.output=e,t.lines=n);const r=this.viewport.contentHeight;if(this.viewport.contentHeight=n.length,this.updateMaxScrollOffset(),this.viewport.autoScrollToBottom&&r>0){if(this.viewport.scrollOffset>=Math.max(0,r-this.viewport.terminalHeight)-1&&this.viewport.contentHeight>r){const e=Math.max(0,this.viewport.contentHeight-this.viewport.terminalHeight);this.viewport.scrollOffset=e}}this.clampScrollOffset();const i=this.viewport.scrollOffset,o=Math.min(this.viewport.scrollOffset+this.viewport.terminalHeight,this.viewport.contentHeight),s=n.slice(i,o),l=this.shouldShowScrollIndicator();let a=or(s,this.viewport.terminalWidth,J,K,this.themeBgCode).join("\n");l&&(a+="\n"+this.getScrollIndicator()),this.logUpdate.render(a),this.clickMap.isDirty?this.clickMap.build(this.rootContainer,this.viewport.scrollOffset,this.viewport.terminalHeight):this.clickMap.regions.length>0&&this.clickMap._scrollOffset!==this.viewport.scrollOffset&&this.clickMap.adjustForScroll(this.viewport.scrollOffset)}getScrollIndicator(){const{scrollOffset:e,contentHeight:t,terminalHeight:n,mouseTrackingEnabled:r}=this.viewport,i=e+1,o=Math.min(e+n,t),s=Math.max(0,t-n),l=s>0?Math.round(e/s*100):0,a=0===e,c=e>=s;let h="";h=a&&c?`Lines ${i}-${o} of ${t}`:a?`[Top] ↓ Lines ${i}-${o} of ${t}`:c?`↑ [Bottom] Lines ${i}-${o} of ${t}`:`↑ ${l}% ↓ Lines ${i}-${o} of ${t}`;h+=(r?" [Scroll]":" [Select]")+" (Alt+M)";const u=J(h),d=Math.max(0,this.viewport.terminalWidth-u),p=h+" ".repeat(d);return this.themeBgCode?this.themeBgCode+"[2m"+p+"[0m":"[2m"+p+"[0m"}clear(){process.stdout.write("[2J[0f"),this.logUpdate.clear()}getOutput(){return this.currentOutput}updateMaxScrollOffset(){this.viewport.maxScrollOffset=Math.max(0,this.viewport.contentHeight-this.viewport.terminalHeight)}getMemoryStats(){const e={timestamp:Date.now(),caches:{},nodeTree:{},viewport:{},process:{}};this.layoutEngine&&(e.caches.layoutEngine=this.layoutEngine.getStats());try{e.caches.lineCache=function(){let e=0;for(const t of nr.values())e+=t.size;return{widthCacheSize:tr.size,widthCacheMaxSize:2e3,truncateBuckets:nr.size,truncateBucketsMaxSize:5,truncateCacheSize:e,truncateMaxPerBucket:500,maxPossibleMemory:4500}}()}catch(t){e.caches.lineCache={error:t.message}}if(this.clickMap&&(e.caches.clickMap=this.clickMap.getStats?this.clickMap.getStats():{regions:this.clickMap.regions?.length||0,isDirty:this.clickMap.isDirty}),e.caches.clickHandlers=this.clickHandlers?.size||0,this.rootContainer&&(e.nodeTree=this._countNodes(this.rootContainer)),e.viewport={contentHeight:this.viewport.contentHeight,outputLength:this.currentOutput?.length||0,visibleLinesCached:null!==this.visibleLinesCache?.output},"undefined"!=typeof process&&process.memoryUsage){const t=process.memoryUsage();e.process={heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100,externalMB:Math.round((t.external||0)/1024/1024*100)/100}}return e}clearAllCaches(){return this.layoutEngine&&this.layoutEngine.clearCache(),sr(),ot.clear(),it.length=0,kn&&kn.clear(),dn.clear(),this.visibleLinesCache={offset:-1,lines:null,output:null},this.rootContainer&&L(this.rootContainer,!0),this.clickMap&&this.clickMap.clear(),this.logUpdate&&this.logUpdate.clear(),"undefined"!=typeof global&&global.gc&&global.gc(),this.getMemoryStats()}_countNodes(e,t=0){if(!e)return{total:0,maxDepth:0,withCache:0,withLayoutCache:0};let n=1,r=t,i=null!==e.cachedOutput?1:0,o=null!==e.cachedLayoutMetrics?1:0;if(e.children)for(const s of e.children){const e=this._countNodes(s,t+1);n+=e.total,r=Math.max(r,e.maxDepth),i+=e.withCache,o+=e.withLayoutCache}return{total:n,maxDepth:r,withCache:i,withLayoutCache:o}}}function pr(e){return new dr(e)}function fr(e,t={}){const n=new dr(t);return n.createApp(e),n.mount(),n}class gr{constructor(e){this.debugServer=e,this.originalConsole={log:console.log,error:console.error,warn:console.warn},this.isActive=!1}activate(){if(this.isActive)return;const e=this;console.log=(...t)=>{e.debugServer.captureEvent("console.log",{args:t.map(t=>e.serialize(t))})},console.error=(...t)=>{e.debugServer.captureEvent("console.error",{args:t.map(t=>e.serialize(t))})},console.warn=(...t)=>{e.debugServer.captureEvent("console.warn",{args:t.map(t=>e.serialize(t))})},this.isActive=!0}deactivate(){this.isActive&&(console.log=this.originalConsole.log,console.error=this.originalConsole.error,console.warn=this.originalConsole.warn,this.isActive=!1)}interceptVueWarnings(e){const t=this;e.config.warnHandler=(e,n,r)=>{t.debugServer.captureEvent("vue.warn",{message:e,trace:r||"",component:n?.$options?.name||n?.__name||"Anonymous"})},e.config.errorHandler=(e,n,r)=>{t.debugServer.captureEvent("vue.error",{message:e.message||String(e),stack:e.stack||"",info:r||"",component:n?.$options?.name||n?.__name||"Anonymous"})}}serialize(e){if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return String(e);if(null===e)return"null";if(void 0===e)return"undefined";if(e instanceof Error)return`${e.name}: ${e.message}\n${e.stack||""}`;try{return JSON.stringify(e,null,2)}catch(t){return String(e)}}}function mr(e){return e?{scrollOffset:e.scrollOffset||0,contentHeight:e.contentHeight||0,terminalHeight:e.terminalHeight||0,terminalWidth:e.terminalWidth||0,autoScrollToBottom:!1!==e.autoScrollToBottom,mouseWheelEnabled:!1!==e.mouseWheelEnabled,mouseWheelScrollLines:e.mouseWheelScrollLines||3,scrollIndicatorMode:e.scrollIndicatorMode||"reserved",mouseTrackingEnabled:!1!==e.mouseTrackingEnabled}:null}var vr=Object.freeze({__proto__:null,serializeNodeTree:function e(t,n=0,r=5){if(!t||n>r)return null;const i={type:t.type,text:t.text||null,isDirty:t.isDirty||!1,isLayoutDirty:t.isLayoutDirty||!1};if(t.props&&Object.keys(t.props).length>0){i.props={};for(const[e,n]of Object.entries(t.props))null==n||"string"==typeof n||"number"==typeof n||"boolean"==typeof n?i.props[e]=n:Array.isArray(n)?i.props[e]=`[Array(${n.length})]`:"object"==typeof n?i.props[e]="[Object]":"function"==typeof n&&(i.props[e]="[Function]")}return t.cachedLayoutMetrics&&(i.layout={x:t.cachedLayoutMetrics.left||0,y:t.cachedLayoutMetrics.top||0,width:t.cachedLayoutMetrics.width||0,height:t.cachedLayoutMetrics.height||0}),t.children&&t.children.length>0&&(i.children=t.children.map(t=>e(t,n+1,r)).filter(e=>null!==e)),i},serializeViewport:mr});const br=S(import.meta.url),yr=m(br);var wr=Object.freeze({__proto__:null,DebugServer:class{constructor(e={}){this.config={port:3e3,host:"localhost",captureConsole:!0,treeCaptureIntervalMs:2e3,treeMaxDepth:4,memoryStatsIntervalMs:5e3,...e},this.clients=new Set,this.eventBuffer=[],this.maxBufferSize=500,this.server=null,this.vuettyInstance=null,this.consoleInterceptor=null,this.latestLayoutTree=null,this.lastTreeCapture=0,this.latestMemoryStats=null,this.memoryStatsInterval=null,this.cleanupInterval=null}shallowSerialize(e){if(null==e)return e;if("object"!=typeof e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return{error:"Serialization failed"}}}setVuettyInstance(e){this.vuettyInstance=e}async start(){if(this.server)return;const e=this,t=v(yr,"static");try{this.server=Bun.serve({port:this.config.port,hostname:this.config.host,fetch(e,n){if(n.upgrade(e))return;const r=new URL(e.url),i={"/":"index.html","/debug.js":"debug.js","/debug.css":"debug.css","/favicon.ico":"favicon.ico"},o=i[r.pathname];if(!o){const e=`404: ${r.pathname}\nAvailable routes: ${Object.keys(i).join(", ")}`;return new Response(e,{status:404})}const s=v(t,o),l=Bun.file(s);return new Response(l)},websocket:{open(t){e.clients.add(t);const n=e.eventBuffer.slice(-50);t.send(JSON.stringify({type:"init",data:{viewport:e.vuettyInstance?mr(e.vuettyInstance.viewport):null,buffer:n,layoutTree:e.latestLayoutTree,memory:e.latestMemoryStats}}))},close(t){e.clients.delete(t)},message(t,n){try{"clear"===JSON.parse(n).type&&(e.eventBuffer=[],e.broadcast({type:"cleared",data:{}}))}catch(e){}}}}),this.config.captureConsole&&(this.consoleInterceptor=new gr(this),this.consoleInterceptor.activate()),this.startMemoryStats(),this.startCleanupInterval(),this.captureEvent("debug.server.started",{port:this.config.port,host:this.config.host,url:`http://${this.config.host}:${this.config.port}`})}catch(e){throw new Error(`Failed to start debug server: ${e.message}`)}}stop(){if(this.server){this.stopMemoryStats(),this.stopCleanupInterval(),this.consoleInterceptor&&(this.consoleInterceptor.deactivate(),this.consoleInterceptor=null);for(const e of this.clients)e.close();this.clients.clear(),this.server.stop(),this.server=null,this.eventBuffer=[],this.latestLayoutTree=null,this.latestMemoryStats=null}}interceptVueWarnings(e){this.consoleInterceptor&&this.consoleInterceptor.interceptVueWarnings(e)}captureRenderComplete({duration:e,outputLength:t,rootContainer:n}){if(this.captureEvent("render.complete",{duration:e,outputLength:t}),!n)return;const r=Date.now();r-this.lastTreeCapture<this.config.treeCaptureIntervalMs||(this.lastTreeCapture=r,Promise.resolve().then(function(){return vr}).then(({serializeNodeTree:e})=>{const t=e(n,0,this.config.treeMaxDepth);this.latestLayoutTree=t,this.broadcast({timestamp:Date.now(),type:"layout.tree",data:{tree:t}})}).catch(()=>{}))}startMemoryStats(){this.memoryStatsInterval||!this.config.memoryStatsIntervalMs||this.config.memoryStatsIntervalMs<=0||(this.memoryStatsInterval=setInterval(()=>{if(!this.vuettyInstance||"function"!=typeof this.vuettyInstance.getMemoryStats)return;const e=this.vuettyInstance.getMemoryStats();this.latestMemoryStats=e,this.broadcast({timestamp:e.timestamp||Date.now(),type:"vuetty.memory",data:e})},this.config.memoryStatsIntervalMs))}stopMemoryStats(){this.memoryStatsInterval&&(clearInterval(this.memoryStatsInterval),this.memoryStatsInterval=null)}startCleanupInterval(){this.cleanupInterval||(this.cleanupInterval=setInterval(()=>{this.eventBuffer.length>200&&(this.eventBuffer=this.eventBuffer.slice(-200))},3e4))}stopCleanupInterval(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}captureEvent(e,t){const n={timestamp:Date.now(),type:e,data:this.shallowSerialize(t)};this.eventBuffer.push(n),this.eventBuffer.length>this.maxBufferSize&&this.eventBuffer.shift(),this.broadcast(n)}broadcast(e){const t=JSON.stringify(e);for(const e of this.clients)try{e.send(t)}catch(t){this.clients.delete(e)}}}});export{Mt as BigText,lt as Box,qt as Button,jt as Checkbox,hn as Col,k as CommentNode,ar as DEFAULT_THEME,ce as Divider,Tt as Gradient,pt as Image,_n as Markdown,pe as Newline,ye as ProgressBar,Gt as Radiobox,ee as RenderContext,te as RenderHandler,cn as Row,Ft as SelectInput,de as Spacer,ue as Spinner,C as TUINode,Je as Table,ut as TextBox,Nt as TextInput,M as TextNode,bt as Tree,fe as VUETTY_INPUT_MANAGER_KEY,ve as VUETTY_THEME_KEY,dr as Vuetty,It as clearBigTextCache,ln as createTUIRenderer,hr as createTheme,pr as createVuetty,_t as getBigTextCacheStats,ne as renderHandlerRegistry,on as renderToString,ur as resolveThemeColor,fr as vuetty};
|