Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
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
to
1.0.1
+18
-0
CHANGELOG.md
# @clack/prompts
## 1.0.1
### Patch Changes
- 6404dc1: Disallows selection of `disabled` options in autocomplete.
- 86e36d8: Adds `withGuide` support to select prompt.
- c697439: Fixes line wrapping behavior in autocomplete.
- 0ded19c: Simplifies `withGuide` option checks.
- 0e4ddc9: Fixes `withGuide` support in password and path prompts.
- 76550d6: Adds `withGuide` support to selectKey prompt.
- f9b9953: Adds `withGuide` support to password prompt.
- 0e93ccb: Adds `vertical` arrangement option to `confirm` prompt.
- 4e9ae13: Adds `withGuide` support to confirm prompt.
- 0256238: Adds `withGuide` support to spinner prompt.
- Updated dependencies [6404dc1]
- Updated dependencies [2533180]
- @clack/core@1.0.1
## 1.0.0

@@ -4,0 +22,0 @@

+1
-0

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

initialValue?: boolean;
vertical?: boolean;
}

@@ -173,0 +174,0 @@ declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;

+119
-117

@@ -1,133 +0,135 @@

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

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

"sisteransi": "^1.0.5",
"@clack/core": "1.0.0"
"@clack/core": "1.0.1"
},

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

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