You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@clack/prompts

Package Overview
Dependencies
Maintainers
5
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clack/prompts - npm Package Compare versions

Comparing version
1.0.0-alpha.6
to
1.0.0-alpha.7
+41
-0
CHANGELOG.md
# @clack/prompts
## 1.0.0-alpha.7
### Minor Changes
- 38019c7: Updates the API for stopping spinners and progress bars to be clearer
Previously, both the spinner and progress bar components used a single `stop` method that accepted a code to indicate success, cancellation, or error. This update separates these into distinct methods: `stop()`, `cancel()`, and `error()`:
```diff
const spinner = prompts.spinner();
spinner.start();
// Cancelling a spinner
- spinner.stop(undefined, 1);
+ spinner.cancel();
// Stopping with an error
- spinner.stop(undefined, 2);
+ spinner.error();
```
As before, you can pass a message to each method to customize the output displayed:
```js
spinner.cancel("Operation cancelled by user");
progressBar.error("An error occurred during processing");
```
### Patch Changes
- 4d1d83b: Fixes rendering of multi-line messages and options in select prompt.
- 6176ced: Add withGuide support to note prompt
- 69681ea: Strip destructive ANSI codes from task log messages.
- b0fa7d8: Add support for wrapped messages in multi line prompts
- 7530af0: Fixes wrapping of cancelled and success messages of select prompt
- acc4c3a: Add a new `withGuide` option to all prompts to disable the default clack border
- Updated dependencies [0718b07]
- Updated dependencies [4ba2d78]
- Updated dependencies [acc4c3a]
- @clack/core@1.0.0-alpha.7
## 1.0.0-alpha.6

@@ -4,0 +45,0 @@

+7
-4

@@ -35,2 +35,3 @@ import { State, AutocompletePrompt } from '@clack/core';

declare const symbol: (state: State) => string;
declare const symbolBar: (state: State) => string;
interface CommonOptions {

@@ -40,2 +41,3 @@ input?: Readable;

signal?: AbortSignal;
withGuide?: boolean;
}

@@ -157,3 +159,2 @@

rounded?: boolean;
includePrefix?: boolean;
formatBorder?: (text: string) => string;

@@ -224,3 +225,3 @@ }

declare const log: {
message: (message?: string | string[], { symbol, secondarySymbol, output, spacing, }?: LogMessageOptions) => void;
message: (message?: string | string[], { symbol, secondarySymbol, output, spacing, withGuide, }?: LogMessageOptions) => void;
info: (message: string, opts?: LogMessageOptions) => void;

@@ -283,3 +284,5 @@ success: (message: string, opts?: LogMessageOptions) => void;

start(msg?: string): void;
stop(msg?: string, code?: number): void;
stop(msg?: string): void;
cancel(msg?: string): void;
error(msg?: string): void;
message(msg?: string): void;

@@ -367,3 +370,3 @@ readonly isCancelled: boolean;

export { S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, autocomplete, autocompleteMultiselect, box, cancel, confirm, group, groupMultiselect, intro, isCI, isTTY, limitOptions, log, multiselect, note, outro, password, path, progress, select, selectKey, spinner, stream, symbol, taskLog, tasks, text, unicode, unicodeOr };
export { S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, autocomplete, autocompleteMultiselect, box, cancel, confirm, group, groupMultiselect, intro, isCI, isTTY, limitOptions, log, multiselect, note, outro, password, path, progress, select, selectKey, spinner, stream, symbol, symbolBar, taskLog, tasks, text, unicode, unicodeOr };
export type { AutocompleteMultiSelectOptions, AutocompleteOptions, BoxAlignment, BoxOptions, CommonOptions, ConfirmOptions, GroupMultiSelectOptions, LimitOptionsParams, LogMessageOptions, MultiSelectOptions, NoteOptions, Option, PasswordOptions, PathOptions, ProgressOptions, ProgressResult, PromptGroup, PromptGroupAwaitedReturn, PromptGroupOptions, SelectOptions, SpinnerOptions, SpinnerResult, Task, TaskLogCompletionOptions, TaskLogMessageOptions, TaskLogOptions, TextOptions };

@@ -1,123 +0,128 @@

import{getColumns as q,getRows as Ye,AutocompletePrompt as ve,ConfirmPrompt as ze,isCancel as Ze,GroupMultiSelectPrompt as Qe,MultiSelectPrompt as et,PasswordPrompt as tt,block as st,settings as Ae,SelectPrompt as rt,SelectKeyPrompt as it,TextPrompt as nt}from"@clack/core";export{isCancel,settings,updateSettings}from"@clack/core";import t from"picocolors";import N from"node:process";import{readdirSync as at,existsSync as ot,lstatSync as Ce}from"node:fs";import{dirname as Ie,join as lt}from"node:path";import{cursor as Se,erase as we}from"sisteransi";import{stripVTControlCharacters as ie}from"node:util";function ut(){return N.platform!=="win32"?N.env.TERM!=="linux":!!N.env.CI||!!N.env.WT_SESSION||!!N.env.TERMINUS_SUBLIME||N.env.ConEmuTask==="{cmd::Cmder}"||N.env.TERM_PROGRAM==="Terminus-Sublime"||N.env.TERM_PROGRAM==="vscode"||N.env.TERM==="xterm-256color"||N.env.TERM==="alacritty"||N.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const z=ut(),ne=()=>process.env.CI==="true",Be=e=>e.isTTY===!0,I=(e,i)=>z?e:i,be=I("\u25C6","*"),ae=I("\u25A0","x"),oe=I("\u25B2","x"),W=I("\u25C7","o"),le=I("\u250C","T"),d=I("\u2502","|"),x=I("\u2514","\u2014"),xe=I("\u2510","T"),_e=I("\u2518","\u2014"),J=I("\u25CF",">"),H=I("\u25CB"," "),Z=I("\u25FB","[\u2022]"),j=I("\u25FC","[+]"),X=I("\u25FB","[ ]"),De=I("\u25AA","\u2022"),Q=I("\u2500","-"),ue=I("\u256E","+"),Te=I("\u251C","+"),ce=I("\u256F","+"),Me=I("\u2570","+"),Re=I("\u256D","+"),de=I("\u25CF","\u2022"),$e=I("\u25C6","*"),he=I("\u25B2","!"),me=I("\u25A0","x"),L=e=>{switch(e){case"initial":case"active":return t.cyan(be);case"cancel":return t.red(ae);case"error":return t.yellow(oe);case"submit":return t.green(W)}},ct=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,dt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,$t=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,pe=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,ee=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,te=/\t{1,1000}/y,ge=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,se=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,ht=/\p{M}+/gu,mt={limit:1/0,ellipsis:""},Oe=(e,i={},s={})=>{const r=i.limit??1/0,n=i.ellipsis??"",o=i?.ellipsisWidth??(n?Oe(n,mt,s).width:0),l=s.ansiWidth??0,u=s.controlWidth??0,a=s.tabWidth??8,h=s.ambiguousWidth??1,y=s.emojiWidth??2,E=s.fullWidthWidth??2,f=s.regularWidth??1,F=s.wideWidth??2;let c=0,m=0,$=e.length,p=0,g=!1,v=$,S=Math.max(0,r-o),w=0,b=0,A=0,C=0;e:for(;;){if(b>w||m>=$&&m>c){const _=e.slice(w,b)||e.slice(c,m);p=0;for(const D of _.replaceAll(ht,"")){const T=D.codePointAt(0)||0;if(dt(T)?C=E:$t(T)?C=F:h!==f&&ct(T)?C=h:C=f,A+C>S&&(v=Math.min(v,Math.max(w,c)+p)),A+C>r){g=!0;break e}p+=D.length,A+=C}w=b=0}if(m>=$)break;if(se.lastIndex=m,se.test(e)){if(p=se.lastIndex-m,C=p*f,A+C>S&&(v=Math.min(v,m+Math.floor((S-A)/f))),A+C>r){g=!0;break}A+=C,w=c,b=m,m=c=se.lastIndex;continue}if(pe.lastIndex=m,pe.test(e)){if(A+l>S&&(v=Math.min(v,m)),A+l>r){g=!0;break}A+=l,w=c,b=m,m=c=pe.lastIndex;continue}if(ee.lastIndex=m,ee.test(e)){if(p=ee.lastIndex-m,C=p*u,A+C>S&&(v=Math.min(v,m+Math.floor((S-A)/u))),A+C>r){g=!0;break}A+=C,w=c,b=m,m=c=ee.lastIndex;continue}if(te.lastIndex=m,te.test(e)){if(p=te.lastIndex-m,C=p*a,A+C>S&&(v=Math.min(v,m+Math.floor((S-A)/a))),A+C>r){g=!0;break}A+=C,w=c,b=m,m=c=te.lastIndex;continue}if(ge.lastIndex=m,ge.test(e)){if(A+y>S&&(v=Math.min(v,m)),A+y>r){g=!0;break}A+=y,w=c,b=m,m=c=ge.lastIndex;continue}m+=1}return{width:g?S:A,index:g?v:$,truncated:g,ellipsed:g&&r>=o}},pt={limit:1/0,ellipsis:"",ellipsisWidth:0},M=(e,i={})=>Oe(e,pt,i).width,re="\x1B",Ne="\x9B",gt=39,fe="\x07",Pe="[",ft="]",Le="m",Fe=`${ft}8;;`,We=new RegExp(`(?:\\${Pe}(?<code>\\d+)m|\\${Fe}(?<uri>.*)${fe})`,"y"),Ft=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},je=e=>`${re}${Pe}${e}${Le}`,Ve=e=>`${re}${Fe}${e}${fe}`,yt=e=>e.map(i=>M(i)),ye=(e,i,s)=>{const r=i[Symbol.iterator]();let n=!1,o=!1,l=e.at(-1),u=l===void 0?0:M(l),a=r.next(),h=r.next(),y=0;for(;!a.done;){const E=a.value,f=M(E);u+f<=s?e[e.length-1]+=E:(e.push(E),u=0),(E===re||E===Ne)&&(n=!0,o=i.startsWith(Fe,y+1)),n?o?E===fe&&(n=!1,o=!1):E===Le&&(n=!1):(u+=f,u===s&&!h.done&&(e.push(""),u=0)),a=h,h=r.next(),y+=E.length}l=e.at(-1),!u&&l!==void 0&&l.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Et=e=>{const i=e.split(" ");let s=i.length;for(;s>0&&!(M(i[s-1])>0);)s--;return s===i.length?e:i.slice(0,s).join(" ")+i.slice(s).join("")},vt=(e,i,s={})=>{if(s.trim!==!1&&e.trim()==="")return"";let r="",n,o;const l=e.split(" "),u=yt(l);let a=[""];for(const[c,m]of l.entries()){s.trim!==!1&&(a[a.length-1]=(a.at(-1)??"").trimStart());let $=M(a.at(-1)??"");if(c!==0&&($>=i&&(s.wordWrap===!1||s.trim===!1)&&(a.push(""),$=0),($>0||s.trim===!1)&&(a[a.length-1]+=" ",$++)),s.hard&&u[c]>i){const p=i-$,g=1+Math.floor((u[c]-p-1)/i);Math.floor((u[c]-1)/i)<g&&a.push(""),ye(a,m,i);continue}if($+u[c]>i&&$>0&&u[c]>0){if(s.wordWrap===!1&&$<i){ye(a,m,i);continue}a.push("")}if($+u[c]>i&&s.wordWrap===!1){ye(a,m,i);continue}a[a.length-1]+=m}s.trim!==!1&&(a=a.map(c=>Et(c)));const h=a.join(`
`),y=h[Symbol.iterator]();let E=y.next(),f=y.next(),F=0;for(;!E.done;){const c=E.value,m=f.value;if(r+=c,c===re||c===Ne){We.lastIndex=F+1;const g=We.exec(h)?.groups;if(g?.code!==void 0){const v=Number.parseFloat(g.code);n=v===gt?void 0:v}else g?.uri!==void 0&&(o=g.uri.length===0?void 0:g.uri)}const $=n?Ft(n):void 0;m===`
`?(o&&(r+=Ve("")),n&&$&&(r+=je($))):c===`
`&&(n&&$&&(r+=je(n)),o&&(r+=Ve(o))),F+=c.length,E=f,f=y.next()}return r};function U(e,i,s){return String(e).normalize().replaceAll(`\r
import{getColumns as X,getRows as et,AutocompletePrompt as Be,settings as H,ConfirmPrompt as tt,isCancel as st,GroupMultiSelectPrompt as rt,MultiSelectPrompt as it,wrapTextWithPrefix as U,PasswordPrompt as nt,block as at,SelectPrompt as ot,SelectKeyPrompt as lt,TextPrompt as ut}from"@clack/core";export{isCancel,settings,updateSettings}from"@clack/core";import t from"picocolors";import N from"node:process";import{readdirSync as ct,existsSync as dt,lstatSync as be}from"node:fs";import{dirname as xe,join as $t}from"node:path";import{cursor as _e,erase as De}from"sisteransi";import{stripVTControlCharacters as le}from"node:util";function ht(){return N.platform!=="win32"?N.env.TERM!=="linux":!!N.env.CI||!!N.env.WT_SESSION||!!N.env.TERMINUS_SUBLIME||N.env.ConEmuTask==="{cmd::Cmder}"||N.env.TERM_PROGRAM==="Terminus-Sublime"||N.env.TERM_PROGRAM==="vscode"||N.env.TERM==="xterm-256color"||N.env.TERM==="alacritty"||N.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const ee=ht(),ue=()=>process.env.CI==="true",Te=e=>e.isTTY===!0,I=(e,r)=>ee?e:r,Me=I("\u25C6","*"),ce=I("\u25A0","x"),de=I("\u25B2","x"),j=I("\u25C7","o"),$e=I("\u250C","T"),d=I("\u2502","|"),x=I("\u2514","\u2014"),Re=I("\u2510","T"),Oe=I("\u2518","\u2014"),Y=I("\u25CF",">"),K=I("\u25CB"," "),te=I("\u25FB","[\u2022]"),V=I("\u25FC","[+]"),z=I("\u25FB","[ ]"),Ne=I("\u25AA","\u2022"),se=I("\u2500","-"),he=I("\u256E","+"),Pe=I("\u251C","+"),me=I("\u256F","+"),pe=I("\u2570","+"),We=I("\u256D","+"),ge=I("\u25CF","\u2022"),fe=I("\u25C6","*"),Fe=I("\u25B2","!"),ye=I("\u25A0","x"),W=e=>{switch(e){case"initial":case"active":return t.cyan(Me);case"cancel":return t.red(ce);case"error":return t.yellow(de);case"submit":return t.green(j)}},Ee=e=>{switch(e){case"initial":case"active":return t.cyan(d);case"cancel":return t.red(d);case"error":return t.yellow(d);case"submit":return t.green(d)}},mt=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,pt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,gt=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,ve=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,re=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,ie=/\t{1,1000}/y,Ae=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,ne=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,ft=/\p{M}+/gu,Ft={limit:1/0,ellipsis:""},Le=(e,r={},s={})=>{const i=r.limit??1/0,n=r.ellipsis??"",l=r?.ellipsisWidth??(n?Le(n,Ft,s).width:0),u=s.ansiWidth??0,a=s.controlWidth??0,o=s.tabWidth??8,$=s.ambiguousWidth??1,y=s.emojiWidth??2,E=s.fullWidthWidth??2,p=s.regularWidth??1,f=s.wideWidth??2;let c=0,m=0,h=e.length,g=0,F=!1,v=h,S=Math.max(0,i-l),B=0,b=0,A=0,C=0;e:for(;;){if(b>B||m>=h&&m>c){const _=e.slice(B,b)||e.slice(c,m);g=0;for(const D of _.replaceAll(ft,"")){const T=D.codePointAt(0)||0;if(pt(T)?C=E:gt(T)?C=f:$!==p&&mt(T)?C=$:C=p,A+C>S&&(v=Math.min(v,Math.max(B,c)+g)),A+C>i){F=!0;break e}g+=D.length,A+=C}B=b=0}if(m>=h)break;if(ne.lastIndex=m,ne.test(e)){if(g=ne.lastIndex-m,C=g*p,A+C>S&&(v=Math.min(v,m+Math.floor((S-A)/p))),A+C>i){F=!0;break}A+=C,B=c,b=m,m=c=ne.lastIndex;continue}if(ve.lastIndex=m,ve.test(e)){if(A+u>S&&(v=Math.min(v,m)),A+u>i){F=!0;break}A+=u,B=c,b=m,m=c=ve.lastIndex;continue}if(re.lastIndex=m,re.test(e)){if(g=re.lastIndex-m,C=g*a,A+C>S&&(v=Math.min(v,m+Math.floor((S-A)/a))),A+C>i){F=!0;break}A+=C,B=c,b=m,m=c=re.lastIndex;continue}if(ie.lastIndex=m,ie.test(e)){if(g=ie.lastIndex-m,C=g*o,A+C>S&&(v=Math.min(v,m+Math.floor((S-A)/o))),A+C>i){F=!0;break}A+=C,B=c,b=m,m=c=ie.lastIndex;continue}if(Ae.lastIndex=m,Ae.test(e)){if(A+y>S&&(v=Math.min(v,m)),A+y>i){F=!0;break}A+=y,B=c,b=m,m=c=Ae.lastIndex;continue}m+=1}return{width:F?S:A,index:F?v:h,truncated:F,ellipsed:F&&i>=l}},yt={limit:1/0,ellipsis:"",ellipsisWidth:0},M=(e,r={})=>Le(e,yt,r).width,ae="\x1B",je="\x9B",Et=39,Ce="\x07",Ve="[",vt="]",ke="m",Ie=`${vt}8;;`,Ge=new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${Ie}(?<uri>.*)${Ce})`,"y"),At=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`${ae}${Ve}${e}${ke}`,Ue=e=>`${ae}${Ie}${e}${Ce}`,Ct=e=>e.map(r=>M(r)),Se=(e,r,s)=>{const i=r[Symbol.iterator]();let n=!1,l=!1,u=e.at(-1),a=u===void 0?0:M(u),o=i.next(),$=i.next(),y=0;for(;!o.done;){const E=o.value,p=M(E);a+p<=s?e[e.length-1]+=E:(e.push(E),a=0),(E===ae||E===je)&&(n=!0,l=r.startsWith(Ie,y+1)),n?l?E===Ce&&(n=!1,l=!1):E===ke&&(n=!1):(a+=p,a===s&&!$.done&&(e.push(""),a=0)),o=$,$=i.next(),y+=E.length}u=e.at(-1),!a&&u!==void 0&&u.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},It=e=>{const r=e.split(" ");let s=r.length;for(;s>0&&!(M(r[s-1])>0);)s--;return s===r.length?e:r.slice(0,s).join(" ")+r.slice(s).join("")},St=(e,r,s={})=>{if(s.trim!==!1&&e.trim()==="")return"";let i="",n,l;const u=e.split(" "),a=Ct(u);let o=[""];for(const[c,m]of u.entries()){s.trim!==!1&&(o[o.length-1]=(o.at(-1)??"").trimStart());let h=M(o.at(-1)??"");if(c!==0&&(h>=r&&(s.wordWrap===!1||s.trim===!1)&&(o.push(""),h=0),(h>0||s.trim===!1)&&(o[o.length-1]+=" ",h++)),s.hard&&a[c]>r){const g=r-h,F=1+Math.floor((a[c]-g-1)/r);Math.floor((a[c]-1)/r)<F&&o.push(""),Se(o,m,r);continue}if(h+a[c]>r&&h>0&&a[c]>0){if(s.wordWrap===!1&&h<r){Se(o,m,r);continue}o.push("")}if(h+a[c]>r&&s.wordWrap===!1){Se(o,m,r);continue}o[o.length-1]+=m}s.trim!==!1&&(o=o.map(c=>It(c)));const $=o.join(`
`),y=$[Symbol.iterator]();let E=y.next(),p=y.next(),f=0;for(;!E.done;){const c=E.value,m=p.value;if(i+=c,c===ae||c===je){Ge.lastIndex=f+1;const F=Ge.exec($)?.groups;if(F?.code!==void 0){const v=Number.parseFloat(F.code);n=v===Et?void 0:v}else F?.uri!==void 0&&(l=F.uri.length===0?void 0:F.uri)}const h=n?At(n):void 0;m===`
`?(l&&(i+=Ue("")),n&&h&&(i+=He(h))):c===`
`&&(n&&h&&(i+=He(n)),l&&(i+=Ue(l))),f+=c.length,E=p,p=y.next()}return i};function q(e,r,s){return String(e).normalize().replaceAll(`\r
`,`
`).split(`
`).map(r=>vt(r,i,s)).join(`
`)}const At=(e,i,s,r,n)=>{let o=i,l=0;for(let u=s;u<r;u++){const a=e[u];if(o=o-a.length,l++,o<=n)break}return{lineCount:o,removals:l}},K=e=>{const{cursor:i,options:s,style:r}=e,n=e.output??process.stdout,o=q(n),l=e.columnPadding??0,u=e.rowPadding??4,a=o-l,h=Ye(n),y=t.dim("..."),E=e.maxItems??Number.POSITIVE_INFINITY,f=Math.max(h-u,0),F=Math.max(Math.min(E,f),5);let c=0;i>=F-3&&(c=Math.max(Math.min(i-F+3,s.length-F),0));let m=F<s.length&&c>0,$=F<s.length&&c+F<s.length;const p=Math.min(c+F,s.length),g=[];let v=0;m&&v++,$&&v++;const S=c+(m?1:0),w=p-($?1:0);for(let A=S;A<w;A++){const C=U(r(s[A],A===i),a,{hard:!0,trim:!1}).split(`
`);g.push(C),v+=C.length}if(v>f){let A=0,C=0,_=v;const D=i-S,T=(k,B)=>At(g,_,k,B,f);m?({lineCount:_,removals:A}=T(0,D),_>f&&({lineCount:_,removals:C}=T(D+1,g.length))):({lineCount:_,removals:C}=T(D+1,g.length),_>f&&({lineCount:_,removals:A}=T(0,D))),A>0&&(m=!0,g.splice(0,A)),C>0&&($=!0,g.splice(g.length-C,C))}const b=[];m&&b.push(y);for(const A of g)for(const C of A)b.push(C);return $&&b.push(y),b};function ke(e){return e.label??String(e.value??"")}function Ge(e,i){if(!e)return!0;const s=(i.label??String(i.value??"")).toLowerCase(),r=(i.hint??"").toLowerCase(),n=String(i.value).toLowerCase(),o=e.toLowerCase();return s.includes(o)||r.includes(o)||n.includes(o)}function Ct(e,i){const s=[];for(const r of i)e.includes(r.value)&&s.push(r);return s}const He=e=>new ve({options:e.options,initialValue:e.initialValue?[e.initialValue]:void 0,initialUserInput:e.initialUserInput,filter:(i,s)=>Ge(i,s),signal:e.signal,input:e.input,output:e.output,validate:e.validate,render(){const i=[`${t.gray(d)}`,`${L(this.state)} ${e.message}`],s=this.userInput,r=String(this.value??""),n=this.options,o=e.placeholder,l=r===""&&o!==void 0;switch(this.state){case"submit":{const u=Ct(this.selectedValues,n),a=u.length>0?` ${t.dim(u.map(ke).join(", "))}`:"";return`${i.join(`
`).map(i=>St(i,r,s)).join(`
`)}const wt=(e,r,s,i,n)=>{let l=r,u=0;for(let a=s;a<i;a++){const o=e[a];if(l=l-o.length,u++,l<=n)break}return{lineCount:l,removals:u}},J=e=>{const{cursor:r,options:s,style:i}=e,n=e.output??process.stdout,l=X(n),u=e.columnPadding??0,a=e.rowPadding??4,o=l-u,$=et(n),y=t.dim("..."),E=e.maxItems??Number.POSITIVE_INFINITY,p=Math.max($-a,0),f=Math.max(Math.min(E,p),5);let c=0;r>=f-3&&(c=Math.max(Math.min(r-f+3,s.length-f),0));let m=f<s.length&&c>0,h=f<s.length&&c+f<s.length;const g=Math.min(c+f,s.length),F=[];let v=0;m&&v++,h&&v++;const S=c+(m?1:0),B=g-(h?1:0);for(let A=S;A<B;A++){const C=q(i(s[A],A===r),o,{hard:!0,trim:!1}).split(`
`);F.push(C),v+=C.length}if(v>p){let A=0,C=0,_=v;const D=r-S,T=(L,w)=>wt(F,_,L,w,p);m?({lineCount:_,removals:A}=T(0,D),_>p&&({lineCount:_,removals:C}=T(D+1,F.length))):({lineCount:_,removals:C}=T(D+1,F.length),_>p&&({lineCount:_,removals:A}=T(0,D))),A>0&&(m=!0,F.splice(0,A)),C>0&&(h=!0,F.splice(F.length-C,C))}const b=[];m&&b.push(y);for(const A of F)for(const C of A)b.push(C);return h&&b.push(y),b};function Ke(e){return e.label??String(e.value??"")}function qe(e,r){if(!e)return!0;const s=(r.label??String(r.value??"")).toLowerCase(),i=(r.hint??"").toLowerCase(),n=String(r.value).toLowerCase(),l=e.toLowerCase();return s.includes(l)||i.includes(l)||n.includes(l)}function Bt(e,r){const s=[];for(const i of r)e.includes(i.value)&&s.push(i);return s}const Je=e=>new Be({options:e.options,initialValue:e.initialValue?[e.initialValue]:void 0,initialUserInput:e.initialUserInput,filter:(r,s)=>qe(r,s),signal:e.signal,input:e.input,output:e.output,validate:e.validate,render(){const r=[`${t.gray(d)}`,`${W(this.state)} ${e.message}`],s=this.userInput,i=String(this.value??""),n=this.options,l=e.placeholder,u=i===""&&l!==void 0;switch(this.state){case"submit":{const a=Bt(this.selectedValues,n),o=a.length>0?` ${t.dim(a.map(Ke).join(", "))}`:"";return`${r.join(`
`)}
${t.gray(d)}${a}`}case"cancel":{const u=s?` ${t.strikethrough(t.dim(s))}`:"";return`${i.join(`
${t.gray(d)}${o}`}case"cancel":{const a=s?` ${t.strikethrough(t.dim(s))}`:"";return`${r.join(`
`)}
${t.gray(d)}${u}`}default:{let u="";if(this.isNavigating||l){const c=l?o:s;u=c!==""?` ${t.dim(c)}`:""}else u=` ${this.userInputWithCursor}`;const a=this.filteredOptions.length!==n.length?t.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",h=this.filteredOptions.length===0&&s?[`${t.cyan(d)} ${t.yellow("No matches found")}`]:[],y=this.state==="error"?[`${t.yellow(d)} ${t.yellow(this.error)}`]:[];i.push(`${t.cyan(d)}`,`${t.cyan(d)} ${t.dim("Search:")}${u}${a}`,...h,...y);const E=[`${t.dim("\u2191/\u2193")} to select`,`${t.dim("Enter:")} confirm`,`${t.dim("Type:")} to search`],f=[`${t.cyan(d)} ${t.dim(E.join(" \u2022 "))}`,`${t.cyan(x)}`],F=this.filteredOptions.length===0?[]:K({cursor:this.cursor,options:this.filteredOptions,columnPadding:3,rowPadding:i.length+f.length,style:(c,m)=>{const $=ke(c),p=c.hint&&c.value===this.focusedValue?t.dim(` (${c.hint})`):"";return m?`${t.green(J)} ${$}${p}`:`${t.dim(H)} ${t.dim($)}${p}`},maxItems:e.maxItems,output:e.output});return[...i,...F.map(c=>`${t.cyan(d)} ${c}`),...f].join(`
`)}}}}).prompt(),It=e=>{const i=(r,n,o,l)=>{const u=o.includes(r.value),a=r.label??String(r.value??""),h=r.hint&&l!==void 0&&r.value===l?t.dim(` (${r.hint})`):"",y=u?t.green(j):t.dim(X);return n?`${y} ${a}${h}`:`${y} ${t.dim(a)}`},s=new ve({options:e.options,multiple:!0,filter:(r,n)=>Ge(r,n),validate:()=>{if(e.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:e.initialValues,signal:e.signal,input:e.input,output:e.output,render(){const r=`${t.gray(d)}
${L(this.state)} ${e.message}
`,n=this.userInput,o=e.placeholder,l=n===""&&o!==void 0,u=this.isNavigating||l?t.dim(l?o:n):this.userInputWithCursor,a=this.options,h=this.filteredOptions.length!==a.length?t.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${r}${t.gray(d)} ${t.dim(`${this.selectedValues.length} items selected`)}`;case"cancel":return`${r}${t.gray(d)} ${t.strikethrough(t.dim(n))}`;default:{const y=[`${t.dim("\u2191/\u2193")} to navigate`,`${t.dim(this.isNavigating?"Space/Tab:":"Tab:")} select`,`${t.dim("Enter:")} confirm`,`${t.dim("Type:")} to search`],E=this.filteredOptions.length===0&&n?[`${t.cyan(d)} ${t.yellow("No matches found")}`]:[],f=this.state==="error"?[`${t.cyan(d)} ${t.yellow(this.error)}`]:[],F=K({cursor:this.cursor,options:this.filteredOptions,style:(c,m)=>i(c,m,this.selectedValues,this.focusedValue),maxItems:e.maxItems,output:e.output});return[r,`${t.cyan(d)} ${t.dim("Search:")} ${u}${h}`,...E,...f,...F.map(c=>`${t.cyan(d)} ${c}`),`${t.cyan(d)} ${t.dim(y.join(" \u2022 "))}`,`${t.cyan(x)}`].join(`
`)}}}});return s.prompt()},St=[Re,ue,Me,ce],wt=[le,xe,x,_e];function Ue(e,i,s,r){let n=s,o=s;return r==="center"?n=Math.floor((i-e)/2):r==="right"&&(n=i-e-s),o=i-n-e,[n,o]}const Bt=e=>e,bt=(e="",i="",s)=>{const r=s?.output??process.stdout,n=q(r),o=2,l=s?.titlePadding??1,u=s?.contentPadding??2,a=s?.width===void 0||s.width==="auto"?1:Math.min(1,s.width),h=s?.includePrefix?`${d} `:"",y=s?.formatBorder??Bt,E=(s?.rounded?St:wt).map(y),f=y(Q),F=y(d),c=M(h),m=M(i),$=n-c;let p=Math.floor(n*a)-c;if(s?.width==="auto"){const _=e.split(`
`);let D=m+l*2;for(const k of _){const B=M(k)+u*2;B>D&&(D=B)}const T=D+o;T<p&&(p=T)}p%2!==0&&(p<$?p++:p--);const g=p-o,v=g-l*2,S=m>v?`${i.slice(0,v-3)}...`:i,[w,b]=Ue(M(S),g,l,s?.titleAlign),A=U(e,g-u*2,{hard:!0,trim:!1});r.write(`${h}${E[0]}${f.repeat(w)}${S}${f.repeat(b)}${E[1]}
${t.gray(d)}${a}`}default:{let a="";if(this.isNavigating||u){const c=u?l:s;a=c!==""?` ${t.dim(c)}`:""}else a=` ${this.userInputWithCursor}`;const o=this.filteredOptions.length!==n.length?t.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",$=this.filteredOptions.length===0&&s?[`${t.cyan(d)} ${t.yellow("No matches found")}`]:[],y=this.state==="error"?[`${t.yellow(d)} ${t.yellow(this.error)}`]:[];r.push(`${t.cyan(d)}`,`${t.cyan(d)} ${t.dim("Search:")}${a}${o}`,...$,...y);const E=[`${t.dim("\u2191/\u2193")} to select`,`${t.dim("Enter:")} confirm`,`${t.dim("Type:")} to search`],p=[`${t.cyan(d)} ${t.dim(E.join(" \u2022 "))}`,`${t.cyan(x)}`],f=this.filteredOptions.length===0?[]:J({cursor:this.cursor,options:this.filteredOptions,columnPadding:3,rowPadding:r.length+p.length,style:(c,m)=>{const h=Ke(c),g=c.hint&&c.value===this.focusedValue?t.dim(` (${c.hint})`):"";return m?`${t.green(Y)} ${h}${g}`:`${t.dim(K)} ${t.dim(h)}${g}`},maxItems:e.maxItems,output:e.output});return[...r,...f.map(c=>`${t.cyan(d)} ${c}`),...p].join(`
`)}}}}).prompt(),bt=e=>{const r=(i,n,l,u)=>{const a=l.includes(i.value),o=i.label??String(i.value??""),$=i.hint&&u!==void 0&&i.value===u?t.dim(` (${i.hint})`):"",y=a?t.green(V):t.dim(z);return n?`${y} ${o}${$}`:`${y} ${t.dim(o)}`},s=new Be({options:e.options,multiple:!0,filter:(i,n)=>qe(i,n),validate:()=>{if(e.required&&s.selectedValues.length===0)return"Please select at least one item"},initialValue:e.initialValues,signal:e.signal,input:e.input,output:e.output,render(){const i=`${t.gray(d)}
${W(this.state)} ${e.message}
`,n=this.userInput,l=e.placeholder,u=n===""&&l!==void 0,a=this.isNavigating||u?t.dim(u?l:n):this.userInputWithCursor,o=this.options,$=this.filteredOptions.length!==o.length?t.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${i}${t.gray(d)} ${t.dim(`${this.selectedValues.length} items selected`)}`;case"cancel":return`${i}${t.gray(d)} ${t.strikethrough(t.dim(n))}`;default:{const y=[`${t.dim("\u2191/\u2193")} to navigate`,`${t.dim(this.isNavigating?"Space/Tab:":"Tab:")} select`,`${t.dim("Enter:")} confirm`,`${t.dim("Type:")} to search`],E=this.filteredOptions.length===0&&n?[`${t.cyan(d)} ${t.yellow("No matches found")}`]:[],p=this.state==="error"?[`${t.cyan(d)} ${t.yellow(this.error)}`]:[],f=J({cursor:this.cursor,options:this.filteredOptions,style:(c,m)=>r(c,m,this.selectedValues,this.focusedValue),maxItems:e.maxItems,output:e.output});return[i,`${t.cyan(d)} ${t.dim("Search:")} ${a}${$}`,...E,...p,...f.map(c=>`${t.cyan(d)} ${c}`),`${t.cyan(d)} ${t.dim(y.join(" \u2022 "))}`,`${t.cyan(x)}`].join(`
`)}}}});return s.prompt()},xt=[We,he,pe,me],_t=[$e,Re,x,Oe];function Xe(e,r,s,i){let n=s,l=s;return i==="center"?n=Math.floor((r-e)/2):i==="right"&&(n=r-e-s),l=r-n-e,[n,l]}const Dt=e=>e,Tt=(e="",r="",s)=>{const i=s?.output??process.stdout,n=X(i),l=2,u=s?.titlePadding??1,a=s?.contentPadding??2,o=s?.width===void 0||s.width==="auto"?1:Math.min(1,s.width),$=(s?.withGuide??H.withGuide)!==!1?`${d} `:"",y=s?.formatBorder??Dt,E=(s?.rounded?xt:_t).map(y),p=y(se),f=y(d),c=M($),m=M(r),h=n-c;let g=Math.floor(n*o)-c;if(s?.width==="auto"){const _=e.split(`
`);let D=m+u*2;for(const L of _){const w=M(L)+a*2;w>D&&(D=w)}const T=D+l;T<g&&(g=T)}g%2!==0&&(g<h?g++:g--);const F=g-l,v=F-u*2,S=m>v?`${r.slice(0,v-3)}...`:r,[B,b]=Xe(M(S),F,u,s?.titleAlign),A=q(e,F-a*2,{hard:!0,trim:!1});i.write(`${$}${E[0]}${p.repeat(B)}${S}${p.repeat(b)}${E[1]}
`);const C=A.split(`
`);for(const _ of C){const[D,T]=Ue(M(_),g,u,s?.contentAlign);r.write(`${h}${F}${" ".repeat(D)}${_}${" ".repeat(T)}${F}
`)}r.write(`${h}${E[2]}${f.repeat(g)}${E[3]}
`)},xt=e=>{const i=e.active??"Yes",s=e.inactive??"No";return new ze({active:i,inactive:s,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){const r=`${t.gray(d)}
${L(this.state)} ${e.message}
`,n=this.value?i:s;switch(this.state){case"submit":return`${r}${t.gray(d)} ${t.dim(n)}`;case"cancel":return`${r}${t.gray(d)} ${t.strikethrough(t.dim(n))}
${t.gray(d)}`;default:return`${r}${t.cyan(d)} ${this.value?`${t.green(J)} ${i}`:`${t.dim(H)} ${t.dim(i)}`} ${t.dim("/")} ${this.value?`${t.dim(H)} ${t.dim(s)}`:`${t.green(J)} ${s}`}
`);for(const _ of C){const[D,T]=Xe(M(_),F,a,s?.contentAlign);i.write(`${$}${f}${" ".repeat(D)}${_}${" ".repeat(T)}${f}
`)}i.write(`${$}${E[2]}${p.repeat(F)}${E[3]}
`)},Mt=e=>{const r=e.active??"Yes",s=e.inactive??"No";return new tt({active:r,inactive:s,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){const i=`${t.gray(d)}
${W(this.state)} ${e.message}
`,n=this.value?r:s;switch(this.state){case"submit":return`${i}${t.gray(d)} ${t.dim(n)}`;case"cancel":return`${i}${t.gray(d)} ${t.strikethrough(t.dim(n))}
${t.gray(d)}`;default:return`${i}${t.cyan(d)} ${this.value?`${t.green(Y)} ${r}`:`${t.dim(K)} ${t.dim(r)}`} ${t.dim("/")} ${this.value?`${t.dim(K)} ${t.dim(s)}`:`${t.green(Y)} ${s}`}
${t.cyan(x)}
`}}}).prompt()},_t=async(e,i)=>{const s={},r=Object.keys(e);for(const n of r){const o=e[n],l=await o({results:s})?.catch(u=>{throw u});if(typeof i?.onCancel=="function"&&Ze(l)){s[n]="canceled",i.onCancel({results:s});continue}s[n]=l}return s},Dt=e=>{const{selectableGroups:i=!0,groupSpacing:s=0}=e,r=(o,l,u=[])=>{const a=o.label??String(o.value),h=typeof o.group=="string",y=h&&(u[u.indexOf(o)+1]??{group:!0}),E=h&&y&&y.group===!0,f=h?i?`${E?x:d} `:" ":"";let F="";if(s>0&&!h){const m=`
${t.cyan(d)}`;F=`${m.repeat(s-1)}${m} `}if(l==="active")return`${F}${t.dim(f)}${t.cyan(Z)} ${a}${o.hint?` ${t.dim(`(${o.hint})`)}`:""}`;if(l==="group-active")return`${F}${f}${t.cyan(Z)} ${t.dim(a)}`;if(l==="group-active-selected")return`${F}${f}${t.green(j)} ${t.dim(a)}`;if(l==="selected"){const m=h||i?t.green(j):"";return`${F}${t.dim(f)}${m} ${t.dim(a)}${o.hint?` ${t.dim(`(${o.hint})`)}`:""}`}if(l==="cancelled")return`${t.strikethrough(t.dim(a))}`;if(l==="active-selected")return`${F}${t.dim(f)}${t.green(j)} ${a}${o.hint?` ${t.dim(`(${o.hint})`)}`:""}`;if(l==="submitted")return`${t.dim(a)}`;const c=h||i?t.dim(X):"";return`${F}${t.dim(f)}${c} ${t.dim(a)}`},n=e.required??!0;return new Qe({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:n,cursorAt:e.cursorAt,selectableGroups:i,validate(o){if(n&&(o===void 0||o.length===0))return`Please select at least one option.
${t.reset(t.dim(`Press ${t.gray(t.bgWhite(t.inverse(" space ")))} to select, ${t.gray(t.bgWhite(t.inverse(" enter ")))} to submit`))}`},render(){const o=`${t.gray(d)}
${L(this.state)} ${e.message}
`,l=this.value??[];switch(this.state){case"submit":{const u=this.options.filter(({value:h})=>l.includes(h)).map(h=>r(h,"submitted")),a=u.length===0?"":` ${u.join(t.dim(", "))}`;return`${o}${t.gray(d)}${a}`}case"cancel":{const u=this.options.filter(({value:a})=>l.includes(a)).map(a=>r(a,"cancelled")).join(t.dim(", "));return`${o}${t.gray(d)} ${u.trim()?`${u}
${t.gray(d)}`:""}`}case"error":{const u=this.error.split(`
`).map((a,h)=>h===0?`${t.yellow(x)} ${t.yellow(a)}`:` ${a}`).join(`
`);return`${o}${t.yellow(d)} ${this.options.map((a,h,y)=>{const E=l.includes(a.value)||a.group===!0&&this.isGroupSelected(`${a.value}`),f=h===this.cursor;return!f&&typeof a.group=="string"&&this.options[this.cursor].value===a.group?r(a,E?"group-active-selected":"group-active",y):f&&E?r(a,"active-selected",y):E?r(a,"selected",y):r(a,f?"active":"inactive",y)}).join(`
`}}}).prompt()},Rt=async(e,r)=>{const s={},i=Object.keys(e);for(const n of i){const l=e[n],u=await l({results:s})?.catch(a=>{throw a});if(typeof r?.onCancel=="function"&&st(u)){s[n]="canceled",r.onCancel({results:s});continue}s[n]=u}return s},Ot=e=>{const{selectableGroups:r=!0,groupSpacing:s=0}=e,i=(l,u,a=[])=>{const o=l.label??String(l.value),$=typeof l.group=="string",y=$&&(a[a.indexOf(l)+1]??{group:!0}),E=$&&y&&y.group===!0,p=$?r?`${E?x:d} `:" ":"";let f="";if(s>0&&!$){const m=`
${t.cyan(d)}`;f=`${m.repeat(s-1)}${m} `}if(u==="active")return`${f}${t.dim(p)}${t.cyan(te)} ${o}${l.hint?` ${t.dim(`(${l.hint})`)}`:""}`;if(u==="group-active")return`${f}${p}${t.cyan(te)} ${t.dim(o)}`;if(u==="group-active-selected")return`${f}${p}${t.green(V)} ${t.dim(o)}`;if(u==="selected"){const m=$||r?t.green(V):"";return`${f}${t.dim(p)}${m} ${t.dim(o)}${l.hint?` ${t.dim(`(${l.hint})`)}`:""}`}if(u==="cancelled")return`${t.strikethrough(t.dim(o))}`;if(u==="active-selected")return`${f}${t.dim(p)}${t.green(V)} ${o}${l.hint?` ${t.dim(`(${l.hint})`)}`:""}`;if(u==="submitted")return`${t.dim(o)}`;const c=$||r?t.dim(z):"";return`${f}${t.dim(p)}${c} ${t.dim(o)}`},n=e.required??!0;return new rt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:n,cursorAt:e.cursorAt,selectableGroups:r,validate(l){if(n&&(l===void 0||l.length===0))return`Please select at least one option.
${t.reset(t.dim(`Press ${t.gray(t.bgWhite(t.inverse(" space ")))} to select, ${t.gray(t.bgWhite(t.inverse(" enter ")))} to submit`))}`},render(){const l=`${t.gray(d)}
${W(this.state)} ${e.message}
`,u=this.value??[];switch(this.state){case"submit":{const a=this.options.filter(({value:$})=>u.includes($)).map($=>i($,"submitted")),o=a.length===0?"":` ${a.join(t.dim(", "))}`;return`${l}${t.gray(d)}${o}`}case"cancel":{const a=this.options.filter(({value:o})=>u.includes(o)).map(o=>i(o,"cancelled")).join(t.dim(", "));return`${l}${t.gray(d)} ${a.trim()?`${a}
${t.gray(d)}`:""}`}case"error":{const a=this.error.split(`
`).map((o,$)=>$===0?`${t.yellow(x)} ${t.yellow(o)}`:` ${o}`).join(`
`);return`${l}${t.yellow(d)} ${this.options.map((o,$,y)=>{const E=u.includes(o.value)||o.group===!0&&this.isGroupSelected(`${o.value}`),p=$===this.cursor;return!p&&typeof o.group=="string"&&this.options[this.cursor].value===o.group?i(o,E?"group-active-selected":"group-active",y):p&&E?i(o,"active-selected",y):E?i(o,"selected",y):i(o,p?"active":"inactive",y)}).join(`
${t.yellow(d)} `)}
${u}
`}default:{const u=this.options.map((h,y,E)=>{const f=l.includes(h.value)||h.group===!0&&this.isGroupSelected(`${h.value}`),F=y===this.cursor,c=!F&&typeof h.group=="string"&&this.options[this.cursor].value===h.group;let m="";return c?m=r(h,f?"group-active-selected":"group-active",E):F&&f?m=r(h,"active-selected",E):f?m=r(h,"selected",E):m=r(h,F?"active":"inactive",E),`${y!==0&&!m.startsWith(`
${a}
`}default:{const a=this.options.map(($,y,E)=>{const p=u.includes($.value)||$.group===!0&&this.isGroupSelected(`${$.value}`),f=y===this.cursor,c=!f&&typeof $.group=="string"&&this.options[this.cursor].value===$.group;let m="";return c?m=i($,p?"group-active-selected":"group-active",E):f&&p?m=i($,"active-selected",E):p?m=i($,"selected",E):m=i($,f?"active":"inactive",E),`${y!==0&&!m.startsWith(`
`)?" ":""}${m}`}).join(`
${t.cyan(d)}`),a=u.startsWith(`
`)?"":" ";return`${o}${t.cyan(d)}${a}${u}
${t.cyan(d)}`),o=a.startsWith(`
`)?"":" ";return`${l}${t.cyan(d)}${o}${a}
${t.cyan(x)}
`}}}}).prompt()},R={message:(e=[],{symbol:i=t.gray(d),secondarySymbol:s=t.gray(d),output:r=process.stdout,spacing:n=1}={})=>{const o=[];for(let u=0;u<n;u++)o.push(`${s}`);const l=Array.isArray(e)?e:e.split(`
`);if(l.length>0){const[u,...a]=l;u.length>0?o.push(`${i} ${u}`):o.push(i);for(const h of a)h.length>0?o.push(`${s} ${h}`):o.push(s)}r.write(`${o.join(`
`}}}}).prompt()},R={message:(e=[],{symbol:r=t.gray(d),secondarySymbol:s=t.gray(d),output:i=process.stdout,spacing:n=1,withGuide:l}={})=>{const u=[],a=(l??H.withGuide)!==!1,o=a?s:"",$=a?`${r} `:"",y=a?`${s} `:"";for(let p=0;p<n;p++)u.push(o);const E=Array.isArray(e)?e:e.split(`
`);if(E.length>0){const[p,...f]=E;p.length>0?u.push(`${$}${p}`):u.push(a?"":r);for(const c of f)c.length>0?u.push(`${y}${c}`):u.push(a?"":s)}i.write(`${u.join(`
`)}
`)},info:(e,i)=>{R.message(e,{...i,symbol:t.blue(de)})},success:(e,i)=>{R.message(e,{...i,symbol:t.green($e)})},step:(e,i)=>{R.message(e,{...i,symbol:t.green(W)})},warn:(e,i)=>{R.message(e,{...i,symbol:t.yellow(he)})},warning:(e,i)=>{R.warn(e,i)},error:(e,i)=>{R.message(e,{...i,symbol:t.red(me)})}},Tt=(e="",i)=>{(i?.output??process.stdout).write(`${t.gray(x)} ${t.red(e)}
`)},info:(e,r)=>{R.message(e,{...r,symbol:t.blue(ge)})},success:(e,r)=>{R.message(e,{...r,symbol:t.green(fe)})},step:(e,r)=>{R.message(e,{...r,symbol:t.green(j)})},warn:(e,r)=>{R.message(e,{...r,symbol:t.yellow(Fe)})},warning:(e,r)=>{R.warn(e,r)},error:(e,r)=>{R.message(e,{...r,symbol:t.red(ye)})}},Nt=(e="",r)=>{(r?.output??process.stdout).write(`${t.gray(x)} ${t.red(e)}
`)},Mt=(e="",i)=>{(i?.output??process.stdout).write(`${t.gray(le)} ${e}
`)},Rt=(e="",i)=>{(i?.output??process.stdout).write(`${t.gray(d)}
`)},Pt=(e="",r)=>{(r?.output??process.stdout).write(`${t.gray($e)} ${e}
`)},Wt=(e="",r)=>{(r?.output??process.stdout).write(`${t.gray(d)}
${t.gray(x)} ${e}
`)},Ot=e=>{const i=(r,n)=>{const o=r.label??String(r.value);return n==="disabled"?`${t.gray(X)} ${t.gray(o)}${r.hint?` ${t.dim(`(${r.hint??"disabled"})`)}`:""}`:n==="active"?`${t.cyan(Z)} ${o}${r.hint?` ${t.dim(`(${r.hint})`)}`:""}`:n==="selected"?`${t.green(j)} ${t.dim(o)}${r.hint?` ${t.dim(`(${r.hint})`)}`:""}`:n==="cancelled"?`${t.strikethrough(t.dim(o))}`:n==="active-selected"?`${t.green(j)} ${o}${r.hint?` ${t.dim(`(${r.hint})`)}`:""}`:n==="submitted"?`${t.dim(o)}`:`${t.dim(X)} ${t.dim(o)}`},s=e.required??!0;return new et({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:s,cursorAt:e.cursorAt,validate(r){if(s&&(r===void 0||r.length===0))return`Please select at least one option.
${t.reset(t.dim(`Press ${t.gray(t.bgWhite(t.inverse(" space ")))} to select, ${t.gray(t.bgWhite(t.inverse(" enter ")))} to submit`))}`},render(){const r=`${t.gray(d)}
${L(this.state)} ${e.message}
`,n=this.value??[],o=(l,u)=>{if(l.disabled)return i(l,"disabled");const a=n.includes(l.value);return u&&a?i(l,"active-selected"):a?i(l,"selected"):i(l,u?"active":"inactive")};switch(this.state){case"submit":return`${r}${t.gray(d)} ${this.options.filter(({value:l})=>n.includes(l)).map(l=>i(l,"submitted")).join(t.dim(", "))||t.dim("none")}`;case"cancel":{const l=this.options.filter(({value:u})=>n.includes(u)).map(u=>i(u,"cancelled")).join(t.dim(", "));return`${r}${t.gray(d)}${l.trim()?` ${l}
${t.gray(d)}`:""}`}case"error":{const l=`${t.yellow(d)} `,u=this.error.split(`
`).map((a,h)=>h===0?`${t.yellow(x)} ${t.yellow(a)}`:` ${a}`).join(`
`);return`${r}${l}${K({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:l.length,style:o}).join(`
${l}`)}
${u}
`}default:{const l=`${t.cyan(d)} `;return`${r}${l}${K({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:l.length,style:o}).join(`
${l}`)}
`)},Q=(e,r)=>e.split(`
`).map(s=>r(s)).join(`
`),Lt=e=>{const r=(i,n)=>{const l=i.label??String(i.value);return n==="disabled"?`${t.gray(z)} ${Q(l,t.gray)}${i.hint?` ${t.dim(`(${i.hint??"disabled"})`)}`:""}`:n==="active"?`${t.cyan(te)} ${l}${i.hint?` ${t.dim(`(${i.hint})`)}`:""}`:n==="selected"?`${t.green(V)} ${Q(l,t.dim)}${i.hint?` ${t.dim(`(${i.hint})`)}`:""}`:n==="cancelled"?`${Q(l,u=>t.strikethrough(t.dim(u)))}`:n==="active-selected"?`${t.green(V)} ${l}${i.hint?` ${t.dim(`(${i.hint})`)}`:""}`:n==="submitted"?`${Q(l,t.dim)}`:`${t.dim(z)} ${Q(l,t.dim)}`},s=e.required??!0;return new it({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:s,cursorAt:e.cursorAt,validate(i){if(s&&(i===void 0||i.length===0))return`Please select at least one option.
${t.reset(t.dim(`Press ${t.gray(t.bgWhite(t.inverse(" space ")))} to select, ${t.gray(t.bgWhite(t.inverse(" enter ")))} to submit`))}`},render(){const i=U(e.output,e.message,`${Ee(this.state)} `,`${W(this.state)} `),n=`${t.gray(d)}
${i}
`,l=this.value??[],u=(a,o)=>{if(a.disabled)return r(a,"disabled");const $=l.includes(a.value);return o&&$?r(a,"active-selected"):$?r(a,"selected"):r(a,o?"active":"inactive")};switch(this.state){case"submit":{const a=this.options.filter(({value:$})=>l.includes($)).map($=>r($,"submitted")).join(t.dim(", "))||t.dim("none"),o=U(e.output,a,`${t.gray(d)} `);return`${n}${o}`}case"cancel":{const a=this.options.filter(({value:$})=>l.includes($)).map($=>r($,"cancelled")).join(t.dim(", "));if(a.trim()==="")return`${n}${t.gray(d)}`;const o=U(e.output,a,`${t.gray(d)} `);return`${n}${o}
${t.gray(d)}`}case"error":{const a=`${t.yellow(d)} `,o=this.error.split(`
`).map(($,y)=>y===0?`${t.yellow(x)} ${t.yellow($)}`:` ${$}`).join(`
`);return`${n}${a}${J({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:a.length,style:u}).join(`
${a}`)}
${o}
`}default:{const a=`${t.cyan(d)} `;return`${n}${a}${J({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:a.length,style:u}).join(`
${a}`)}
${t.cyan(x)}
`}}}}).prompt()},Nt=e=>t.dim(e),Pt=(e,i,s)=>{const r={hard:!0,trim:!1},n=U(e,i,r).split(`
`),o=n.reduce((a,h)=>Math.max(M(h),a),0),l=n.map(s).reduce((a,h)=>Math.max(M(h),a),0),u=i-(l-o);return U(e,u,r)},Lt=(e="",i="",s)=>{const r=s?.output??N.stdout,n=s?.format??Nt,o=["",...Pt(e,q(r)-6,n).split(`
`).map(n),""],l=M(i),u=Math.max(o.reduce((h,y)=>{const E=M(y);return E>h?E:h},0),l)+2,a=o.map(h=>`${t.gray(d)} ${h}${" ".repeat(u-M(h))}${t.gray(d)}`).join(`
`);r.write(`${t.gray(d)}
${t.green(W)} ${t.reset(i)} ${t.gray(Q.repeat(Math.max(u-l-1,1))+ue)}
${a}
${t.gray(Te+Q.repeat(u+2)+ce)}
`)},Wt=e=>new tt({validate:e.validate,mask:e.mask??De,signal:e.signal,input:e.input,output:e.output,render(){const i=`${t.gray(d)}
${L(this.state)} ${e.message}
`,s=this.userInputWithCursor,r=this.masked;switch(this.state){case"error":{const n=r?` ${r}`:"";return e.clearOnError&&this.clear(),`${i.trim()}
`}}}}).prompt()},jt=e=>t.dim(e),Vt=(e,r,s)=>{const i={hard:!0,trim:!1},n=q(e,r,i).split(`
`),l=n.reduce((o,$)=>Math.max(M($),o),0),u=n.map(s).reduce((o,$)=>Math.max(M($),o),0),a=r-(u-l);return q(e,a,i)},kt=(e="",r="",s)=>{const i=s?.output??N.stdout,n=(s?.withGuide??H.withGuide)!==!1,l=s?.format??jt,u=["",...Vt(e,X(i)-6,l).split(`
`).map(l),""],a=M(r),o=Math.max(u.reduce((p,f)=>{const c=M(f);return c>p?c:p},0),a)+2,$=u.map(p=>`${t.gray(d)} ${p}${" ".repeat(o-M(p))}${t.gray(d)}`).join(`
`),y=n?`${t.gray(d)}
`:"",E=n?Pe:pe;i.write(`${y}${t.green(j)} ${t.reset(r)} ${t.gray(se.repeat(Math.max(o-a-1,1))+he)}
${$}
${t.gray(E+se.repeat(o+2)+me)}
`)},Gt=e=>new nt({validate:e.validate,mask:e.mask??Ne,signal:e.signal,input:e.input,output:e.output,render(){const r=`${t.gray(d)}
${W(this.state)} ${e.message}
`,s=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{const n=i?` ${i}`:"";return e.clearOnError&&this.clear(),`${r.trim()}
${t.yellow(d)}${n}
${t.yellow(x)} ${t.yellow(this.error)}
`}case"submit":{const n=r?` ${t.dim(r)}`:"";return`${i}${t.gray(d)}${n}`}case"cancel":{const n=r?` ${t.strikethrough(t.dim(r))}`:"";return`${i}${t.gray(d)}${n}${r?`
${t.gray(d)}`:""}`}default:return`${i}${t.cyan(d)} ${s}
`}case"submit":{const n=i?` ${t.dim(i)}`:"";return`${r}${t.gray(d)}${n}`}case"cancel":{const n=i?` ${t.strikethrough(t.dim(i))}`:"";return`${r}${t.gray(d)}${n}${i?`
${t.gray(d)}`:""}`}default:return`${r}${t.cyan(d)} ${s}
${t.cyan(x)}
`}}}).prompt(),jt=e=>{const i=e.validate;return He({...e,initialUserInput:e.initialValue??e.root??process.cwd(),maxItems:5,validate(s){if(!Array.isArray(s)){if(!s)return"Please select a path";if(i)return i(s)}},options(){const s=this.userInput;if(s==="")return[];try{let r;return ot(s)?Ce(s).isDirectory()?r=s:r=Ie(s):r=Ie(s),at(r).map(n=>{const o=lt(r,n),l=Ce(o);return{name:n,path:o,isDirectory:l.isDirectory()}}).filter(({path:n,isDirectory:o})=>n.startsWith(s)&&(e.directory||!o)).map(n=>({value:n.path}))}catch{return[]}}})},Vt=t.magenta,Ee=({indicator:e="dots",onCancel:i,output:s=process.stdout,cancelMessage:r,errorMessage:n,frames:o=z?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:l=z?80:120,signal:u,...a}={})=>{const h=ne();let y,E,f=!1,F=!1,c="",m,$=performance.now();const p=q(s),g=a?.styleFrame??Vt,v=B=>{const O=B>1?n??Ae.messages.error:r??Ae.messages.cancel;F=B===1,f&&(k(O,B),F&&typeof i=="function"&&i())},S=()=>v(2),w=()=>v(1),b=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",w),process.on("SIGTERM",w),process.on("exit",v),u&&u.addEventListener("abort",w)},A=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",w),process.removeListener("SIGTERM",w),process.removeListener("exit",v),u&&u.removeEventListener("abort",w)},C=()=>{if(m===void 0)return;h&&s.write(`
`);const B=U(m,p,{hard:!0,trim:!1}).split(`
`);B.length>1&&s.write(Se.up(B.length-1)),s.write(Se.to(0)),s.write(we.down())},_=B=>B.replace(/\.+$/,""),D=B=>{const O=(performance.now()-B)/1e3,P=Math.floor(O/60),G=Math.floor(O%60);return P>0?`[${P}m ${G}s]`:`[${G}s]`},T=(B="")=>{f=!0,y=st({output:s}),c=_(B),$=performance.now(),s.write(`${t.gray(d)}
`);let O=0,P=0;b(),E=setInterval(()=>{if(h&&c===m)return;C(),m=c;const G=g(o[O]);let Y;if(h)Y=`${G} ${c}...`;else if(e==="timer")Y=`${G} ${c} ${D($)}`;else{const Xe=".".repeat(Math.floor(P)).slice(0,3);Y=`${G} ${c}${Xe}`}const Je=U(Y,p,{hard:!0,trim:!1});s.write(Je),O=O+1<o.length?O+1:0,P=P<4?P+.125:0},l)},k=(B="",O=0)=>{if(!f)return;f=!1,clearInterval(E),C();const P=O===0?t.green(W):O===1?t.red(ae):t.red(oe);c=B??c,e==="timer"?s.write(`${P} ${c} ${D($)}
`}}}).prompt(),Ht=e=>{const r=e.validate;return Je({...e,initialUserInput:e.initialValue??e.root??process.cwd(),maxItems:5,validate(s){if(!Array.isArray(s)){if(!s)return"Please select a path";if(r)return r(s)}},options(){const s=this.userInput;if(s==="")return[];try{let i;return dt(s)?be(s).isDirectory()?i=s:i=xe(s):i=xe(s),ct(i).map(n=>{const l=$t(i,n),u=be(l);return{name:n,path:l,isDirectory:u.isDirectory()}}).filter(({path:n,isDirectory:l})=>n.startsWith(s)&&(e.directory||!l)).map(n=>({value:n.path}))}catch{return[]}}})},Ut=t.magenta,we=({indicator:e="dots",onCancel:r,output:s=process.stdout,cancelMessage:i,errorMessage:n,frames:l=ee?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:u=ee?80:120,signal:a,...o}={})=>{const $=ue();let y,E,p=!1,f=!1,c="",m,h=performance.now();const g=X(s),F=o?.styleFrame??Ut,v=w=>{const O=w>1?n??H.messages.error:i??H.messages.cancel;f=w===1,p&&(L(O,w),f&&typeof r=="function"&&r())},S=()=>v(2),B=()=>v(1),b=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",B),process.on("SIGTERM",B),process.on("exit",v),a&&a.addEventListener("abort",B)},A=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",B),process.removeListener("SIGTERM",B),process.removeListener("exit",v),a&&a.removeEventListener("abort",B)},C=()=>{if(m===void 0)return;$&&s.write(`
`);const w=q(m,g,{hard:!0,trim:!1}).split(`
`);w.length>1&&s.write(_e.up(w.length-1)),s.write(_e.to(0)),s.write(De.down())},_=w=>w.replace(/\.+$/,""),D=w=>{const O=(performance.now()-w)/1e3,P=Math.floor(O/60),G=Math.floor(O%60);return P>0?`[${P}m ${G}s]`:`[${G}s]`},T=(w="")=>{p=!0,y=at({output:s}),c=_(w),h=performance.now(),s.write(`${t.gray(d)}
`);let O=0,P=0;b(),E=setInterval(()=>{if($&&c===m)return;C(),m=c;const G=F(l[O]);let Z;if($)Z=`${G} ${c}...`;else if(e==="timer")Z=`${G} ${c} ${D(h)}`;else{const Ze=".".repeat(Math.floor(P)).slice(0,3);Z=`${G} ${c}${Ze}`}const Qe=q(Z,g,{hard:!0,trim:!1});s.write(Qe),O=O+1<l.length?O+1:0,P=P<4?P+.125:0},u)},L=(w="",O=0)=>{if(!p)return;p=!1,clearInterval(E),C();const P=O===0?t.green(j):O===1?t.red(ce):t.red(de);c=w??c,e==="timer"?s.write(`${P} ${c} ${D(h)}
`):s.write(`${P} ${c}
`),A(),y()};return{start:T,stop:k,message:(B="")=>{c=_(B??c)},get isCancelled(){return F}}},Ke={light:I("\u2500","-"),heavy:I("\u2501","="),block:I("\u2588","#")};function kt({style:e="heavy",max:i=100,size:s=40,...r}={}){const n=Ee(r);let o=0,l="";const u=Math.max(1,i),a=Math.max(1,s),h=F=>{switch(F){case"initial":case"active":return t.magenta;case"error":case"cancel":return t.red;case"submit":return t.green;default:return t.magenta}},y=(F,c)=>{const m=Math.floor(o/u*a);return`${h(F)(Ke[e].repeat(m))}${t.dim(Ke[e].repeat(a-m))} ${c}`},E=(F="")=>{l=F,n.start(y("initial",F))},f=(F=1,c)=>{o=Math.min(u,F+o),n.message(y("active",c??l)),l=c??l};return{start:E,stop:n.stop,advance:f,isCancelled:n.isCancelled,message:F=>f(0,F)}}const Gt=e=>{const i=(s,r)=>{const n=s.label??String(s.value);switch(r){case"disabled":return`${t.gray(H)} ${t.gray(n)}${s.hint?` ${t.dim(`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${t.dim(n)}`;case"active":return`${t.green(J)} ${n}${s.hint?` ${t.dim(`(${s.hint})`)}`:""}`;case"cancelled":return`${t.strikethrough(t.dim(n))}`;default:return`${t.dim(H)} ${t.dim(n)}`}};return new rt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const s=`${t.gray(d)}
${L(this.state)} ${e.message}
`;switch(this.state){case"submit":return`${s}${t.gray(d)} ${i(this.options[this.cursor],"selected")}`;case"cancel":return`${s}${t.gray(d)} ${i(this.options[this.cursor],"cancelled")}
${t.gray(d)}`;default:{const r=`${t.cyan(d)} `;return`${s}${r}${K({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:r.length,style:(n,o)=>i(n,n.disabled?"disabled":o?"active":"inactive")}).join(`
${r}`)}
`),A(),y()};return{start:T,stop:(w="")=>L(w,0),message:(w="")=>{c=_(w??c)},cancel:(w="")=>L(w,1),error:(w="")=>L(w,2),get isCancelled(){return f}}},Ye={light:I("\u2500","-"),heavy:I("\u2501","="),block:I("\u2588","#")};function Kt({style:e="heavy",max:r=100,size:s=40,...i}={}){const n=we(i);let l=0,u="";const a=Math.max(1,r),o=Math.max(1,s),$=f=>{switch(f){case"initial":case"active":return t.magenta;case"error":case"cancel":return t.red;case"submit":return t.green;default:return t.magenta}},y=(f,c)=>{const m=Math.floor(l/a*o);return`${$(f)(Ye[e].repeat(m))}${t.dim(Ye[e].repeat(o-m))} ${c}`},E=(f="")=>{u=f,n.start(y("initial",f))},p=(f=1,c)=>{l=Math.min(a,f+l),n.message(y("active",c??u)),u=c??u};return{start:E,stop:n.stop,cancel:n.cancel,error:n.error,advance:p,isCancelled:n.isCancelled,message:f=>p(0,f)}}const oe=(e,r)=>e.includes(`
`)?e.split(`
`).map(s=>r(s)).join(`
`):r(e),qt=e=>{const r=(s,i)=>{const n=s.label??String(s.value);switch(i){case"disabled":return`${t.gray(K)} ${oe(n,t.gray)}${s.hint?` ${t.dim(`(${s.hint??"disabled"})`)}`:""}`;case"selected":return`${oe(n,t.dim)}`;case"active":return`${t.green(Y)} ${n}${s.hint?` ${t.dim(`(${s.hint})`)}`:""}`;case"cancelled":return`${oe(n,l=>t.strikethrough(t.dim(l)))}`;default:return`${t.dim(K)} ${oe(n,t.dim)}`}};return new ot({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const s=`${W(this.state)} `,i=`${Ee(this.state)} `,n=U(e.output,e.message,i,s),l=`${t.gray(d)}
${n}
`;switch(this.state){case"submit":{const u=`${t.gray(d)} `,a=U(e.output,r(this.options[this.cursor],"selected"),u);return`${l}${a}`}case"cancel":{const u=`${t.gray(d)} `,a=U(e.output,r(this.options[this.cursor],"cancelled"),u);return`${l}${a}
${t.gray(d)}`}default:{const u=`${t.cyan(d)} `;return`${l}${u}${J({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:u.length,style:(a,o)=>r(a,a.disabled?"disabled":o?"active":"inactive")}).join(`
${u}`)}
${t.cyan(x)}
`}}}}).prompt()},Ht=e=>{const i=(s,r="inactive")=>{const n=s.label??String(s.value);return r==="selected"?`${t.dim(n)}`:r==="cancelled"?`${t.strikethrough(t.dim(n))}`:r==="active"?`${t.bgCyan(t.gray(` ${s.value} `))} ${n} ${s.hint?t.dim(`(${s.hint})`):""}`:`${t.gray(t.bgWhite(t.inverse(` ${s.value} `)))} ${n} ${s.hint?t.dim(`(${s.hint})`):""}`};return new it({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const s=`${t.gray(d)}
${L(this.state)} ${e.message}
`;switch(this.state){case"submit":return`${s}${t.gray(d)} ${i(this.options.find(r=>r.value===this.value)??e.options[0],"selected")}`;case"cancel":return`${s}${t.gray(d)} ${i(this.options[0],"cancelled")}
${t.gray(d)}`;default:return`${s}${t.cyan(d)} ${this.options.map((r,n)=>i(r,n===this.cursor?"active":"inactive")).join(`
`}}}}).prompt()},Jt=e=>{const r=(s,i="inactive")=>{const n=s.label??String(s.value);return i==="selected"?`${t.dim(n)}`:i==="cancelled"?`${t.strikethrough(t.dim(n))}`:i==="active"?`${t.bgCyan(t.gray(` ${s.value} `))} ${n} ${s.hint?t.dim(`(${s.hint})`):""}`:`${t.gray(t.bgWhite(t.inverse(` ${s.value} `)))} ${n} ${s.hint?t.dim(`(${s.hint})`):""}`};return new lt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const s=`${t.gray(d)}
${W(this.state)} ${e.message}
`;switch(this.state){case"submit":return`${s}${t.gray(d)} ${r(this.options.find(i=>i.value===this.value)??e.options[0],"selected")}`;case"cancel":return`${s}${t.gray(d)} ${r(this.options[0],"cancelled")}
${t.gray(d)}`;default:return`${s}${t.cyan(d)} ${this.options.map((i,n)=>r(i,n===this.cursor?"active":"inactive")).join(`
${t.cyan(d)} `)}
${t.cyan(x)}
`}}}).prompt()},qe=`${t.gray(d)} `,V={message:async(e,{symbol:i=t.gray(d)}={})=>{process.stdout.write(`${t.gray(d)}
${i} `);let s=3;for await(let r of e){r=r.replace(/\n/g,`
${qe}`),r.includes(`
`)&&(s=3+ie(r.slice(r.lastIndexOf(`
`))).length);const n=ie(r).length;s+n<process.stdout.columns?(s+=n,process.stdout.write(r)):(process.stdout.write(`
${qe}${r.trimStart()}`),s=3+ie(r.trimStart()).length)}process.stdout.write(`
`)},info:e=>V.message(e,{symbol:t.blue(de)}),success:e=>V.message(e,{symbol:t.green($e)}),step:e=>V.message(e,{symbol:t.green(W)}),warn:e=>V.message(e,{symbol:t.yellow(he)}),warning:e=>V.warn(e),error:e=>V.message(e,{symbol:t.red(me)})},Ut=async(e,i)=>{for(const s of e){if(s.enabled===!1)continue;const r=Ee(i);r.start(s.title);const n=await s.task(r.message);r.stop(n||s.title)}},Kt=e=>{const i=e.output??process.stdout,s=q(i),r=t.gray(d),n=e.spacing??1,o=3,l=e.retainLog===!0,u=!ne()&&Be(i);i.write(`${r}
`),i.write(`${t.green(W)} ${e.title}
`);for(let $=0;$<n;$++)i.write(`${r}
`);const a=[{value:"",full:""}];let h=!1;const y=$=>{if(a.length===0)return;let p=0;$&&(p+=n+2);for(const g of a){const{value:v,result:S}=g;let w=S?.message??v;if(w.length===0)continue;S===void 0&&g.header!==void 0&&g.header!==""&&(w+=`
${g.header}`);const b=w.split(`
`).reduce((A,C)=>C===""?A+1:A+Math.ceil((C.length+o)/s),0);p+=b}p>0&&(p+=1,i.write(we.lines(p)))},E=($,p,g)=>{const v=g?`${$.full}
${$.value}`:$.value;$.header!==void 0&&$.header!==""&&R.message($.header.split(`
`).map(t.bold),{output:i,secondarySymbol:r,symbol:r,spacing:0}),R.message(v.split(`
`).map(t.dim),{output:i,secondarySymbol:r,symbol:r,spacing:p??n})},f=()=>{for(const $ of a){const{header:p,value:g,full:v}=$;(p===void 0||p.length===0)&&g.length===0||E($,void 0,l===!0&&v.length>0)}},F=($,p,g)=>{if(y(!1),(g?.raw!==!0||!h)&&$.value!==""&&($.value+=`
`),$.value+=p,h=g?.raw===!0,e.limit!==void 0){const v=$.value.split(`
`),S=v.length-e.limit;if(S>0){const w=v.splice(0,S);l&&($.full+=($.full===""?"":`
`)+w.join(`
`))}$.value=v.join(`
`)}u&&c()},c=()=>{for(const $ of a)$.result?$.result.status==="error"?R.error($.result.message,{output:i,secondarySymbol:r,spacing:0}):R.success($.result.message,{output:i,secondarySymbol:r,spacing:0}):$.value!==""&&E($,0)},m=($,p)=>{y(!1),$.result=p,u&&c()};return{message($,p){F(a[0],$,p)},group($){const p={header:$,value:"",full:""};return a.push(p),{message(g,v){F(p,g,v)},error(g){m(p,{status:"error",message:g})},success(g){m(p,{status:"success",message:g})}}},error($,p){y(!0),R.error($,{output:i,secondarySymbol:r,spacing:1}),p?.showLog!==!1&&f(),a.splice(1,a.length-1),a[0].value="",a[0].full=""},success($,p){y(!0),R.success($,{output:i,secondarySymbol:r,spacing:1}),p?.showLog===!0&&f(),a.splice(1,a.length-1),a[0].value="",a[0].full=""}}},qt=e=>new nt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const i=`${t.gray(d)}
${L(this.state)} ${e.message}
`,s=e.placeholder?t.inverse(e.placeholder[0])+t.dim(e.placeholder.slice(1)):t.inverse(t.hidden("_")),r=this.userInput?this.userInputWithCursor:s,n=this.value??"";switch(this.state){case"error":{const o=this.error?` ${t.yellow(this.error)}`:"";return`${i.trim()}
${t.yellow(d)} ${r}
${t.yellow(x)}${o}
`}case"submit":{const o=n?` ${t.dim(n)}`:"";return`${i}${t.gray(d)}${o}`}case"cancel":{const o=n?` ${t.strikethrough(t.dim(n))}`:"";return`${i}${t.gray(d)}${o}${n.trim()?`
${t.gray(d)}`:""}`}default:return`${i}${t.cyan(d)} ${r}
${t.cyan(x)}
`}}}).prompt();export{d as S_BAR,x as S_BAR_END,_e as S_BAR_END_RIGHT,Q as S_BAR_H,le as S_BAR_START,xe as S_BAR_START_RIGHT,Z as S_CHECKBOX_ACTIVE,X as S_CHECKBOX_INACTIVE,j as S_CHECKBOX_SELECTED,Te as S_CONNECT_LEFT,Me as S_CORNER_BOTTOM_LEFT,ce as S_CORNER_BOTTOM_RIGHT,Re as S_CORNER_TOP_LEFT,ue as S_CORNER_TOP_RIGHT,me as S_ERROR,de as S_INFO,De as S_PASSWORD_MASK,J as S_RADIO_ACTIVE,H as S_RADIO_INACTIVE,be as S_STEP_ACTIVE,ae as S_STEP_CANCEL,oe as S_STEP_ERROR,W as S_STEP_SUBMIT,$e as S_SUCCESS,he as S_WARN,He as autocomplete,It as autocompleteMultiselect,bt as box,Tt as cancel,xt as confirm,_t as group,Dt as groupMultiselect,Mt as intro,ne as isCI,Be as isTTY,K as limitOptions,R as log,Ot as multiselect,Lt as note,Rt as outro,Wt as password,jt as path,kt as progress,Gt as select,Ht as selectKey,Ee as spinner,V as stream,L as symbol,Kt as taskLog,Ut as tasks,qt as text,z as unicode,I as unicodeOr};
`}}}).prompt()},ze=`${t.gray(d)} `,k={message:async(e,{symbol:r=t.gray(d)}={})=>{process.stdout.write(`${t.gray(d)}
${r} `);let s=3;for await(let i of e){i=i.replace(/\n/g,`
${ze}`),i.includes(`
`)&&(s=3+le(i.slice(i.lastIndexOf(`
`))).length);const n=le(i).length;s+n<process.stdout.columns?(s+=n,process.stdout.write(i)):(process.stdout.write(`
${ze}${i.trimStart()}`),s=3+le(i.trimStart()).length)}process.stdout.write(`
`)},info:e=>k.message(e,{symbol:t.blue(ge)}),success:e=>k.message(e,{symbol:t.green(fe)}),step:e=>k.message(e,{symbol:t.green(j)}),warn:e=>k.message(e,{symbol:t.yellow(Fe)}),warning:e=>k.warn(e),error:e=>k.message(e,{symbol:t.red(ye)})},Xt=async(e,r)=>{for(const s of e){if(s.enabled===!1)continue;const i=we(r);i.start(s.title);const n=await s.task(i.message);i.stop(n||s.title)}},Yt=e=>e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g,""),zt=e=>{const r=e.output??process.stdout,s=X(r),i=t.gray(d),n=e.spacing??1,l=3,u=e.retainLog===!0,a=!ue()&&Te(r);r.write(`${i}
`),r.write(`${t.green(j)} ${e.title}
`);for(let h=0;h<n;h++)r.write(`${i}
`);const o=[{value:"",full:""}];let $=!1;const y=h=>{if(o.length===0)return;let g=0;h&&(g+=n+2);for(const F of o){const{value:v,result:S}=F;let B=S?.message??v;if(B.length===0)continue;S===void 0&&F.header!==void 0&&F.header!==""&&(B+=`
${F.header}`);const b=B.split(`
`).reduce((A,C)=>C===""?A+1:A+Math.ceil((C.length+l)/s),0);g+=b}g>0&&(g+=1,r.write(De.lines(g)))},E=(h,g,F)=>{const v=F?`${h.full}
${h.value}`:h.value;h.header!==void 0&&h.header!==""&&R.message(h.header.split(`
`).map(t.bold),{output:r,secondarySymbol:i,symbol:i,spacing:0}),R.message(v.split(`
`).map(t.dim),{output:r,secondarySymbol:i,symbol:i,spacing:g??n})},p=()=>{for(const h of o){const{header:g,value:F,full:v}=h;(g===void 0||g.length===0)&&F.length===0||E(h,void 0,u===!0&&v.length>0)}},f=(h,g,F)=>{if(y(!1),(F?.raw!==!0||!$)&&h.value!==""&&(h.value+=`
`),h.value+=Yt(g),$=F?.raw===!0,e.limit!==void 0){const v=h.value.split(`
`),S=v.length-e.limit;if(S>0){const B=v.splice(0,S);u&&(h.full+=(h.full===""?"":`
`)+B.join(`
`))}h.value=v.join(`
`)}a&&c()},c=()=>{for(const h of o)h.result?h.result.status==="error"?R.error(h.result.message,{output:r,secondarySymbol:i,spacing:0}):R.success(h.result.message,{output:r,secondarySymbol:i,spacing:0}):h.value!==""&&E(h,0)},m=(h,g)=>{y(!1),h.result=g,a&&c()};return{message(h,g){f(o[0],h,g)},group(h){const g={header:h,value:"",full:""};return o.push(g),{message(F,v){f(g,F,v)},error(F){m(g,{status:"error",message:F})},success(F){m(g,{status:"success",message:F})}}},error(h,g){y(!0),R.error(h,{output:r,secondarySymbol:i,spacing:1}),g?.showLog!==!1&&p(),o.splice(1,o.length-1),o[0].value="",o[0].full=""},success(h,g){y(!0),R.success(h,{output:r,secondarySymbol:i,spacing:1}),g?.showLog===!0&&p(),o.splice(1,o.length-1),o[0].value="",o[0].full=""}}},Qt=e=>new ut({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const r=(e?.withGuide??H.withGuide)!==!1,s=`${`${r?`${t.gray(d)}
`:""}${W(this.state)} `}${e.message}
`,i=e.placeholder?t.inverse(e.placeholder[0])+t.dim(e.placeholder.slice(1)):t.inverse(t.hidden("_")),n=this.userInput?this.userInputWithCursor:i,l=this.value??"";switch(this.state){case"error":{const u=this.error?` ${t.yellow(this.error)}`:"",a=r?`${t.yellow(d)} `:"",o=r?t.yellow(x):"";return`${s.trim()}
${a}${n}
${o}${u}
`}case"submit":{const u=l?` ${t.dim(l)}`:"",a=r?t.gray(d):"";return`${s}${a}${u}`}case"cancel":{const u=l?` ${t.strikethrough(t.dim(l))}`:"",a=r?t.gray(d):"";return`${s}${a}${u}${l.trim()?`
${a}`:""}`}default:{const u=r?`${t.cyan(d)} `:"",a=r?t.cyan(x):"";return`${s}${u}${n}
${a}
`}}}}).prompt();export{d as S_BAR,x as S_BAR_END,Oe as S_BAR_END_RIGHT,se as S_BAR_H,$e as S_BAR_START,Re as S_BAR_START_RIGHT,te as S_CHECKBOX_ACTIVE,z as S_CHECKBOX_INACTIVE,V as S_CHECKBOX_SELECTED,Pe as S_CONNECT_LEFT,pe as S_CORNER_BOTTOM_LEFT,me as S_CORNER_BOTTOM_RIGHT,We as S_CORNER_TOP_LEFT,he as S_CORNER_TOP_RIGHT,ye as S_ERROR,ge as S_INFO,Ne as S_PASSWORD_MASK,Y as S_RADIO_ACTIVE,K as S_RADIO_INACTIVE,Me as S_STEP_ACTIVE,ce as S_STEP_CANCEL,de as S_STEP_ERROR,j as S_STEP_SUBMIT,fe as S_SUCCESS,Fe as S_WARN,Je as autocomplete,bt as autocompleteMultiselect,Tt as box,Nt as cancel,Mt as confirm,Rt as group,Ot as groupMultiselect,Pt as intro,ue as isCI,Te as isTTY,J as limitOptions,R as log,Lt as multiselect,kt as note,Wt as outro,Gt as password,Ht as path,Kt as progress,qt as select,Jt as selectKey,we as spinner,k as stream,W as symbol,Ee as symbolBar,zt as taskLog,Xt as tasks,Qt as text,ee as unicode,I as unicodeOr};
//# sourceMappingURL=index.mjs.map
{
"name": "@clack/prompts",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"type": "module",

@@ -52,3 +52,3 @@ "main": "./dist/index.mjs",

"sisteransi": "^1.0.5",
"@clack/core": "1.0.0-alpha.6"
"@clack/core": "1.0.0-alpha.7"
},

@@ -55,0 +55,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display