diff --git a/CHANGELOG.md b/CHANGELOG.md index 20b4822..2fcd939 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## v1.0.12 + +> `2024-05-07` + +### 🎉 Feature +- Added Google Places API script to templates. + ## v1.0.7 - v1.0.11 > `2024-05-07` diff --git a/dist/index.mjs b/dist/index.mjs index 947557f..0258bb0 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1,25 +1,25 @@ -import dr from"readline";import fr from"events";import A from"path";import Fe,{promises as mr}from"fs";import pr from"constants";import yr from"stream";import wr,{promisify as gr}from"util";import vr from"assert";import{exec as br,execSync as Sr,spawn as $r}from"child_process";import{fileURLToPath as Er}from"url";var Xt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Me={};const{FORCE_COLOR:Pr,NODE_DISABLE_COLORS:xr,TERM:Or}=process.env,P={enabled:!xr&&Or!=="dumb"&&Pr!=="0",reset:O(0,0),bold:O(1,22),dim:O(2,22),italic:O(3,23),underline:O(4,24),inverse:O(7,27),hidden:O(8,28),strikethrough:O(9,29),black:O(30,39),red:O(31,39),green:O(32,39),yellow:O(33,39),blue:O(34,39),magenta:O(35,39),cyan:O(36,39),white:O(37,39),gray:O(90,39),grey:O(90,39),bgBlack:O(40,49),bgRed:O(41,49),bgGreen:O(42,49),bgYellow:O(43,49),bgBlue:O(44,49),bgMagenta:O(45,49),bgCyan:O(46,49),bgWhite:O(47,49)};function ke(e,t){let i=0,r,s="",n="";for(;i{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}},ee=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),i=new RegExp(t,"g");return typeof e=="string"?e.replace(i,""):e};const ie="\x1B",M=`${ie}[`,Fr="\x07",re={to(e,t){return t?`${M}${t+1};${e+1}H`:`${M}${e+1}G`},move(e,t){let i="";return e<0?i+=`${M}${-e}D`:e>0&&(i+=`${M}${e}C`),t<0?i+=`${M}${-t}A`:t>0&&(i+=`${M}${t}B`),i},up:(e=1)=>`${M}${e}A`,down:(e=1)=>`${M}${e}B`,forward:(e=1)=>`${M}${e}C`,backward:(e=1)=>`${M}${e}D`,nextLine:(e=1)=>`${M}E`.repeat(e),prevLine:(e=1)=>`${M}F`.repeat(e),left:`${M}G`,hide:`${M}?25l`,show:`${M}?25h`,save:`${ie}7`,restore:`${ie}8`},Mr={up:(e=1)=>`${M}S`.repeat(e),down:(e=1)=>`${M}T`.repeat(e)},kr={screen:`${M}2J`,up:(e=1)=>`${M}1J`.repeat(e),down:(e=1)=>`${M}J`.repeat(e),line:`${M}2K`,lineEnd:`${M}K`,lineStart:`${M}1K`,lines(e){let t="";for(let i=0;i[...Dr(e)].length;var Ir=function(e,t){if(!t)return De.line+_r.to(0);let i=0;const r=e.split(/\r?\n/);for(let s of r)i+=1+Math.floor(Math.max(Ar(s)-1,0)/t);return De.lines(i)};const Ct={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Nr={arrowUp:Ct.arrowUp,arrowDown:Ct.arrowDown,arrowLeft:Ct.arrowLeft,arrowRight:Ct.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rr=process.platform==="win32"?Nr:Ct;var _e=Rr;const wt=K,ft=_e,se=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),jr=e=>se[e]||se.default,Ft=Object.freeze({aborted:wt.red(ft.cross),done:wt.green(ft.tick),exited:wt.yellow(ft.cross),default:wt.cyan("?")}),Lr=(e,t,i)=>t?Ft.aborted:i?Ft.exited:e?Ft.done:Ft.default,Jr=e=>wt.gray(e?ft.ellipsis:ft.pointerSmall),Yr=(e,t)=>wt.gray(e?t?ft.pointerSmall:"+":ft.line);var Br={styles:se,render:jr,symbols:Ft,symbol:Lr,delimiter:Jr,item:Yr};const Wr=ee;var Vr=function(e,t){let i=String(Wr(e)||"").split(/\r?\n/);return t?i.map(r=>Math.ceil(r.length/t)).reduce((r,s)=>r+s):i.length},Hr=(e,t={})=>{const i=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(e||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+i.length>=r||n[n.length-1].length+o.length+1{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(t){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}},ie=e=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),i=new RegExp(t,"g");return typeof e=="string"?e.replace(i,""):e};const re="\x1B",M=`${re}[`,Fr="\x07",se={to(e,t){return t?`${M}${t+1};${e+1}H`:`${M}${e+1}G`},move(e,t){let i="";return e<0?i+=`${M}${-e}D`:e>0&&(i+=`${M}${e}C`),t<0?i+=`${M}${-t}A`:t>0&&(i+=`${M}${t}B`),i},up:(e=1)=>`${M}${e}A`,down:(e=1)=>`${M}${e}B`,forward:(e=1)=>`${M}${e}C`,backward:(e=1)=>`${M}${e}D`,nextLine:(e=1)=>`${M}E`.repeat(e),prevLine:(e=1)=>`${M}F`.repeat(e),left:`${M}G`,hide:`${M}?25l`,show:`${M}?25h`,save:`${re}7`,restore:`${re}8`},Mr={up:(e=1)=>`${M}S`.repeat(e),down:(e=1)=>`${M}T`.repeat(e)},kr={screen:`${M}2J`,up:(e=1)=>`${M}1J`.repeat(e),down:(e=1)=>`${M}J`.repeat(e),line:`${M}2K`,lineEnd:`${M}K`,lineStart:`${M}1K`,lines(e){let t="";for(let i=0;i[...Dr(e)].length;var Ir=function(e,t){if(!t)return De.line+_r.to(0);let i=0;const r=e.split(/\r?\n/);for(let s of r)i+=1+Math.floor(Math.max(Ar(s)-1,0)/t);return De.lines(i)};const Ct={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},Nr={arrowUp:Ct.arrowUp,arrowDown:Ct.arrowDown,arrowLeft:Ct.arrowLeft,arrowRight:Ct.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rr=process.platform==="win32"?Nr:Ct;var _e=Rr;const gt=K,ft=_e,ne=Object.freeze({password:{scale:1,render:e=>"*".repeat(e.length)},emoji:{scale:2,render:e=>"\u{1F603}".repeat(e.length)},invisible:{scale:0,render:e=>""},default:{scale:1,render:e=>`${e}`}}),jr=e=>ne[e]||ne.default,Ft=Object.freeze({aborted:gt.red(ft.cross),done:gt.green(ft.tick),exited:gt.yellow(ft.cross),default:gt.cyan("?")}),Lr=(e,t,i)=>t?Ft.aborted:i?Ft.exited:e?Ft.done:Ft.default,Jr=e=>gt.gray(e?ft.ellipsis:ft.pointerSmall),Yr=(e,t)=>gt.gray(e?t?ft.pointerSmall:"+":ft.line);var Br={styles:ne,render:jr,symbols:Ft,symbol:Lr,delimiter:Jr,item:Yr};const Wr=ie;var Vr=function(e,t){let i=String(Wr(e)||"").split(/\r?\n/);return t?i.map(r=>Math.ceil(r.length/t)).reduce((r,s)=>r+s):i.length},Hr=(e,t={})=>{const i=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return(e||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((n,o)=>(o.length+i.length>=r||n[n.length-1].length+o.length+1{i=i||t;let r=Math.min(t-i,e-Math.floor(i/2));r<0&&(r=0);let s=Math.min(r+i,t);return{startIndex:r,endIndex:s}},Z={action:Cr,clear:Ir,style:Br,strip:ee,figures:_e,lines:Vr,wrap:Hr,entriesToDisplay:Ur};const Ae=dr,{action:Gr}=Z,Kr=fr,{beep:qr,cursor:zr}=q,Zr=K;let Qr=class extends Kr{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const i=Ae.createInterface({input:this.in,escapeCodeTimeout:50});Ae.emitKeypressEvents(this.in,i),this.in.isTTY&&this.in.setRawMode(!0);const r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let l=Gr(o,r);l===!1?this._&&this._(n,o):typeof this[l]=="function"?this[l](o):this.bell()};this.close=()=>{this.out.write(zr.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),i.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(qr)}render(){this.onRender(Zr),this.firstRender&&(this.firstRender=!1)}};var at=Qr;const Lt=K,Xr=at,{erase:ts,cursor:Mt}=q,{style:ne,clear:oe,lines:es,figures:is}=Z;class rs extends Xr{constructor(t={}){super(t),this.transform=ne.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=oe("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Lt.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(` +`)},Ur=(e,t,i)=>{i=i||t;let r=Math.min(t-i,e-Math.floor(i/2));r<0&&(r=0);let s=Math.min(r+i,t);return{startIndex:r,endIndex:s}},Z={action:Cr,clear:Ir,style:Br,strip:ie,figures:_e,lines:Vr,wrap:Hr,entriesToDisplay:Ur};const Ae=dr,{action:Gr}=Z,Kr=fr,{beep:qr,cursor:zr}=q,Zr=K;let Qr=class extends Kr{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const i=Ae.createInterface({input:this.in,escapeCodeTimeout:50});Ae.emitKeypressEvents(this.in,i),this.in.isTTY&&this.in.setRawMode(!0);const r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,s=(n,o)=>{let l=Gr(o,r);l===!1?this._&&this._(n,o):typeof this[l]=="function"?this[l](o):this.bell()};this.close=()=>{this.out.write(zr.show),this.in.removeListener("keypress",s),this.in.isTTY&&this.in.setRawMode(!1),i.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",s)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(qr)}render(){this.onRender(Zr),this.firstRender&&(this.firstRender=!1)}};var at=Qr;const Jt=K,Xr=at,{erase:ts,cursor:Mt}=q,{style:oe,clear:ae,lines:es,figures:is}=Z;class rs extends Xr{constructor(t={}){super(t),this.transform=oe.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=ae("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=Jt.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(` `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` -`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,i){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${t}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),i=this.value.slice(this.cursor);this.value=`${t}${i}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor+1);this.value=`${t}${i}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Mt.down(es(this.outputError,this.out.columns)-1)+oe(this.outputError,this.out.columns)),this.out.write(oe(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ne.symbol(this.done,this.aborted),Lt.bold(this.msg),ne.delimiter(this.done),this.red?Lt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(` +`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,i){let r=this.value.slice(0,this.cursor),s=this.value.slice(this.cursor);this.value=`${r}${t}${s}`,this.red=!1,this.cursor=this.placeholder?0:r.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),i=this.value.slice(this.cursor);this.value=`${t}${i}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor+1);this.value=`${t}${i}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Mt.down(es(this.outputError,this.out.columns)-1)+ae(this.outputError,this.out.columns)),this.out.write(ae(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[oe.symbol(this.done,this.aborted),Jt.bold(this.msg),oe.delimiter(this.done),this.red?Jt.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(` `).reduce((t,i,r)=>t+` -${r?" ":is.pointerSmall} ${Lt.red().italic(i)}`,"")),this.out.write(ts.line+Mt.to(0)+this.outputText+Mt.save+this.outputError+Mt.restore+Mt.move(this.cursorOffset,0)))}}var ss=rs;const it=K,ns=at,{style:Ie,clear:Ne,figures:Jt,wrap:os,entriesToDisplay:as}=Z,{cursor:ls}=q;class cs extends ns{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((i,r)=>(typeof i=="string"&&(i={title:i,value:r}),{title:i&&(i.title||i.value||i),value:i&&(i.value===void 0?r:i.value),description:i&&i.description,selected:i&&i.selected,disabled:i&&i.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Ne("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` +${r?" ":is.pointerSmall} ${Jt.red().italic(i)}`,"")),this.out.write(ts.line+Mt.to(0)+this.outputText+Mt.save+this.outputError+Mt.restore+Mt.move(this.cursorOffset,0)))}}var ss=rs;const it=K,ns=at,{style:Ie,clear:Ne,figures:Yt,wrap:os,entriesToDisplay:as}=Z,{cursor:ls}=q;class cs extends ns{constructor(t={}){super(t),this.msg=t.message,this.hint=t.hint||"- Use arrow-keys. Return to submit.",this.warn=t.warn||"- This option is disabled",this.cursor=t.initial||0,this.choices=t.choices.map((i,r)=>(typeof i=="string"&&(i={title:i,value:r}),{title:i&&(i.title||i.value||i),value:i&&(i.value===void 0?r:i.value),description:i&&i.description,selected:i&&i.selected,disabled:i&&i.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Ne("",this.out.columns),this.render()}moveCursor(t){this.cursor=t,this.value=this.choices[t].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(t,i){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(ls.hide):this.out.write(Ne(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:i}=as(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Ie.symbol(this.done,this.aborted),it.bold(this.msg),Ie.delimiter(!1),this.done?this.selection.title:this.selection.disabled?it.yellow(this.warn):it.gray(this.hint)].join(" "),!this.done){this.outputText+=` -`;for(let r=t;r0?n=Jt.arrowUp:r===i-1&&i=this.out.columns||l.description.split(/\r?\n/).length>1)&&(o=` +`;for(let r=t;r0?n=Yt.arrowUp:r===i-1&&i=this.out.columns||l.description.split(/\r?\n/).length>1)&&(o=` `+os(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${s}${it.gray(o)} -`}}this.out.write(this.outputText)}}var us=cs;const Yt=K,hs=at,{style:Re,clear:ds}=Z,{cursor:je,erase:fs}=q;class ms extends hs{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` +`}}this.out.write(this.outputText)}}var us=cs;const Bt=K,hs=at,{style:Re,clear:ds}=Z,{cursor:je,erase:fs}=q;class ms extends hs{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` -`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,i){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(je.hide):this.out.write(ds(this.outputText,this.out.columns)),super.render(),this.outputText=[Re.symbol(this.done,this.aborted),Yt.bold(this.msg),Re.delimiter(this.done),this.value?this.inactive:Yt.cyan().underline(this.inactive),Yt.gray("/"),this.value?Yt.cyan().underline(this.active):this.active].join(" "),this.out.write(fs.line+je.to(0)+this.outputText))}}var ps=ms;let ys=class Ce{constructor({token:t,date:i,parts:r,locales:s}){this.token=t,this.date=i||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((i,r)=>r>t&&i instanceof Ce)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const i=t.indexOf(this);return t.find((r,s)=>s>i&&r instanceof Ce)}toString(){return String(this.date)}};var rt=ys;const ws=rt;let gs=class extends ws{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};var vs=gs;const bs=rt,Ss=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");let $s=class extends bs{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),i=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Ss(t):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:t}};var Es=$s;const Ps=rt;let xs=class extends Ps{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};var Os=xs;const Ts=rt;let Cs=class extends Ts{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};var Fs=Cs;const Ms=rt;let ks=class extends Ms{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ds=ks;const _s=rt;let As=class extends _s{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),i=this.token.length;return i===2?String(t+1).padStart(2,"0"):i===3?this.locales.monthsShort[t]:i===4?this.locales.months[t]:String(t+1)}};var Is=As;const Ns=rt;let Rs=class extends Ns{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};var js=Rs;const Ls=rt;let Js=class extends Ls{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};var Ys=Js,Bs={DatePart:rt,Meridiem:vs,Day:Es,Hours:Os,Milliseconds:Fs,Minutes:Ds,Month:Is,Seconds:js,Year:Ys};const ae=K,Ws=at,{style:Le,clear:Je,figures:Vs}=Z,{erase:Hs,cursor:Ye}=q,{DatePart:Be,Meridiem:Us,Day:Gs,Hours:Ks,Milliseconds:qs,Minutes:zs,Month:Zs,Seconds:Qs,Year:Xs}=Bs,tn=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,We={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new Gs(e),3:e=>new Zs(e),4:e=>new Xs(e),5:e=>new Us(e),6:e=>new Ks(e),7:e=>new zs(e),8:e=>new Qs(e),9:e=>new qs(e)},en={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class rn extends Ws{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(en,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Je("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let i;for(this.parts=[];i=tn.exec(t);){let s=i.shift(),n=i.findIndex(o=>o!=null);this.parts.push(n in We?We[n]({token:i[n]||s,date:this.date,parts:this.parts,locales:this.locales}):i[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof Be)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` +`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,i){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(je.hide):this.out.write(ds(this.outputText,this.out.columns)),super.render(),this.outputText=[Re.symbol(this.done,this.aborted),Bt.bold(this.msg),Re.delimiter(this.done),this.value?this.inactive:Bt.cyan().underline(this.inactive),Bt.gray("/"),this.value?Bt.cyan().underline(this.active):this.active].join(" "),this.out.write(fs.line+je.to(0)+this.outputText))}}var ps=ms;let ys=class Ce{constructor({token:t,date:i,parts:r,locales:s}){this.token=t,this.date=i||new Date,this.parts=r||[this],this.locales=s||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((i,r)=>r>t&&i instanceof Ce)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const i=t.indexOf(this);return t.find((r,s)=>s>i&&r instanceof Ce)}toString(){return String(this.date)}};var rt=ys;const ws=rt;let gs=class extends ws{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};var vs=gs;const bs=rt,Ss=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");let $s=class extends bs{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),i=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+Ss(t):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:t}};var Es=$s;const Ps=rt;let xs=class extends Ps{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};var Os=xs;const Ts=rt;let Cs=class extends Ts{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};var Fs=Cs;const Ms=rt;let ks=class extends Ms{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ds=ks;const _s=rt;let As=class extends _s{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),i=this.token.length;return i===2?String(t+1).padStart(2,"0"):i===3?this.locales.monthsShort[t]:i===4?this.locales.months[t]:String(t+1)}};var Is=As;const Ns=rt;let Rs=class extends Ns{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};var js=Rs;const Ls=rt;let Js=class extends Ls{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};var Ys=Js,Bs={DatePart:rt,Meridiem:vs,Day:Es,Hours:Os,Milliseconds:Fs,Minutes:Ds,Month:Is,Seconds:js,Year:Ys};const le=K,Ws=at,{style:Le,clear:Je,figures:Vs}=Z,{erase:Hs,cursor:Ye}=q,{DatePart:Be,Meridiem:Us,Day:Gs,Hours:Ks,Milliseconds:qs,Minutes:zs,Month:Zs,Seconds:Qs,Year:Xs}=Bs,tn=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,We={1:({token:e})=>e.replace(/\\(.)/g,"$1"),2:e=>new Gs(e),3:e=>new Zs(e),4:e=>new Xs(e),5:e=>new Us(e),6:e=>new Ks(e),7:e=>new zs(e),8:e=>new Qs(e),9:e=>new qs(e)},en={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class rn extends Ws{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(en,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Je("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let i;for(this.parts=[];i=tn.exec(t);){let s=i.shift(),n=i.findIndex(o=>o!=null);this.parts.push(n in We?We[n]({token:i[n]||s,date:this.date,parts:this.parts,locales:this.locales}):i[n]||s)}let r=this.parts.reduce((s,n)=>(typeof n=="string"&&typeof s[s.length-1]=="string"?s[s.length-1]+=n:s.push(n),s),[]);this.parts.splice(0),this.parts.push(...r),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof Be)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` -`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(i=>i instanceof Be)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Ye.hide):this.out.write(Je(this.outputText,this.out.columns)),super.render(),this.outputText=[Le.symbol(this.done,this.aborted),ae.bold(this.msg),Le.delimiter(!1),this.parts.reduce((t,i,r)=>t.concat(r===this.cursor&&!this.done?ae.cyan().underline(i.toString()):i),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(` +`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(i=>i instanceof Be)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Ye.hide):this.out.write(Je(this.outputText,this.out.columns)),super.render(),this.outputText=[Le.symbol(this.done,this.aborted),le.bold(this.msg),Le.delimiter(!1),this.parts.reduce((t,i,r)=>t.concat(r===this.cursor&&!this.done?le.cyan().underline(i.toString()):i),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(` `).reduce((t,i,r)=>t+` -${r?" ":Vs.pointerSmall} ${ae.red().italic(i)}`,"")),this.out.write(Hs.line+Ye.to(0)+this.outputText))}}var sn=rn;const Bt=K,nn=at,{cursor:Wt,erase:on}=q,{style:le,figures:an,clear:Ve,lines:ln}=Z,cn=/[0-9]/,ce=e=>e!==void 0,He=(e,t)=>{let i=Math.pow(10,t);return Math.round(e*i)/i};class un extends nn{constructor(t={}){super(t),this.transform=le.render(t.style),this.msg=t.message,this.initial=ce(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=ce(t.min)?t.min:-1/0,this.max=ce(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Bt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${He(t,this.round)}`),this._value=He(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||cn.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` +${r?" ":Vs.pointerSmall} ${le.red().italic(i)}`,"")),this.out.write(Hs.line+Ye.to(0)+this.outputText))}}var sn=rn;const Wt=K,nn=at,{cursor:Vt,erase:on}=q,{style:ce,figures:an,clear:Ve,lines:ln}=Z,cn=/[0-9]/,ue=e=>e!==void 0,He=(e,t)=>{let i=Math.pow(10,t);return Math.round(e*i)/i};class un extends nn{constructor(t={}){super(t),this.transform=ce.render(t.style),this.msg=t.message,this.initial=ue(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=ue(t.min)?t.min:-1/0,this.max=ue(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=Wt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${He(t,this.round)}`),this._value=He(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||cn.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(` -`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value1e3&&(this.typed=""),this.typed+=t,this.lastHit=r,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value1e3&&(this.typed=""),this.typed+=t,this.lastHit=r,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.valuet+` -${r?" ":an.pointerSmall} ${Bt.red().italic(i)}`,"")),this.out.write(on.line+Wt.to(0)+this.outputText+Wt.save+this.outputError+Wt.restore))}}var hn=un;const Q=K,{cursor:dn}=q,fn=at,{clear:Ue,figures:lt,style:Ge,wrap:mn,entriesToDisplay:pn}=Z;let yn=class extends fn{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((i,r)=>(typeof i=="string"&&(i={title:i,value:r}),{title:i&&(i.title||i.value||i),description:i&&i.description,value:i&&(i.value===void 0?r:i.value),selected:i&&i.selected,disabled:i&&i.disabled})),this.clear=Ue("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` +${r?" ":an.pointerSmall} ${Wt.red().italic(i)}`,"")),this.out.write(on.line+Vt.to(0)+this.outputText+Vt.save+this.outputError+Vt.restore))}}var hn=un;const Q=K,{cursor:dn}=q,fn=at,{clear:Ue,figures:lt,style:Ge,wrap:mn,entriesToDisplay:pn}=Z;let yn=class extends fn{constructor(t={}){super(t),this.msg=t.message,this.cursor=t.cursor||0,this.scrollIndex=t.cursor||0,this.hint=t.hint||"",this.warn=t.warn||"- This option is disabled -",this.minSelected=t.min,this.showMinError=!1,this.maxChoices=t.max,this.instructions=t.instructions,this.optionsPerPage=t.optionsPerPage||10,this.value=t.choices.map((i,r)=>(typeof i=="string"&&(i={title:i,value:r}),{title:i&&(i.title||i.value||i),description:i&&i.description,value:i&&(i.value===void 0?r:i.value),selected:i&&i.selected,disabled:i&&i.disabled})),this.clear=Ue("",this.out.columns),t.overrideRender||this.render()}reset(){this.value.map(t=>!t.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(t=>t.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){const t=this.value.filter(i=>i.selected);this.minSelected&&t.lengtht.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const t=this.value[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const t=!this.value[this.cursor].selected;this.value.filter(i=>!i.disabled).forEach(i=>i.selected=t),this.render()}_(t,i){if(t===" ")this.handleSpaceToggle();else if(t==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` Instructions: @@ -29,38 +29,40 @@ Instructions: `:"")+" enter/return: Complete answer":""}renderOption(t,i,r,s){const n=(i.selected?Q.green(lt.radioOn):lt.radioOff)+" "+s+" ";let o,l;return i.disabled?o=t===r?Q.gray().underline(i.title):Q.strikethrough().gray(i.title):(o=t===r?Q.cyan().underline(i.title):i.title,t===r&&i.description&&(l=` - ${i.description}`,(n.length+o.length+l.length>=this.out.columns||i.description.split(/\r?\n/).length>1)&&(l=` `+mn(i.description,{margin:n.length,width:this.out.columns})))),n+o+Q.gray(l||"")}paginateOptions(t){if(t.length===0)return Q.red("No matches for this query.");let{startIndex:i,endIndex:r}=pn(this.cursor,t.length,this.optionsPerPage),s,n=[];for(let o=i;o0?s=lt.arrowUp:o===r-1&&ri.selected).map(i=>i.title).join(", ");const t=[Q.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Q.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(dn.hide),super.render();let t=[Ge.symbol(this.done,this.aborted),Q.bold(this.msg),Ge.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Q.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=Ue(t,this.out.columns)}};var Ke=yn;const kt=K,wn=at,{erase:gn,cursor:qe}=q,{style:ue,clear:ze,figures:he,wrap:vn,entriesToDisplay:bn}=Z,Ze=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),Sn=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),$n=(e,t)=>{const i=e.findIndex(r=>r.value===t||r.title===t);return i>-1?i:void 0};class En extends wn{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:$n(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=ue.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=ze("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Ze(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const i=this.completing=this.suggest(this.input,this.choices),r=await i;if(this.completing!==i)return;this.suggestions=r.map((n,o,l)=>({title:Sn(l,o),value:Ze(l,o),description:n.description})),this.completing=!1;const s=Math.max(r.length-1,0);this.moveSelect(Math.min(s,this.select)),t&&t()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` +`)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(i=>i.selected).map(i=>i.title).join(", ");const t=[Q.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(Q.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(dn.hide),super.render();let t=[Ge.symbol(this.done,this.aborted),Q.bold(this.msg),Ge.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=Q.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.value),this.out.write(this.clear+t),this.clear=Ue(t,this.out.columns)}};var Ke=yn;const kt=K,wn=at,{erase:gn,cursor:qe}=q,{style:he,clear:ze,figures:de,wrap:vn,entriesToDisplay:bn}=Z,Ze=(e,t)=>e[t]&&(e[t].value||e[t].title||e[t]),Sn=(e,t)=>e[t]&&(e[t].title||e[t].value||e[t]),$n=(e,t)=>{const i=e.findIndex(r=>r.value===t||r.title===t);return i>-1?i:void 0};class En extends wn{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:$n(t.choices,t.initial),this.select=this.initial||t.cursor||0,this.i18n={noMatches:t.noMatches||"no matches found"},this.fallback=t.fallback||this.initial,this.clearFirst=t.clearFirst||!1,this.suggestions=[],this.input="",this.limit=t.limit||10,this.cursor=0,this.transform=he.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=ze("",this.out.columns),this.complete(this.render),this.render()}set fallback(t){this._fb=Number.isSafeInteger(parseInt(t))?parseInt(t):t}get fallback(){let t;return typeof this._fb=="number"?t=this.choices[this._fb]:typeof this._fb=="string"&&(t={title:this._fb}),t||this._fb||{title:this.i18n.noMatches}}moveSelect(t){this.select=t,this.suggestions.length>0?this.value=Ze(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const i=this.completing=this.suggest(this.input,this.choices),r=await i;if(this.completing!==i)return;this.suggestions=r.map((n,o,l)=>({title:Sn(l,o),value:Ze(l,o),description:n.description})),this.completing=!1;const s=Math.max(r.length-1,0);this.moveSelect(Math.min(s,this.select)),t&&t()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(` -`),this.close()}_(t,i){let r=this.input.slice(0,this.cursor),s=this.input.slice(this.cursor);this.input=`${r}${t}${s}`,this.cursor=r.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let t=this.input.slice(0,this.cursor-1),i=this.input.slice(this.cursor);this.input=`${t}${i}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor+1);this.input=`${t}${i}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,i,r,s){let n,o=r?he.arrowUp:s?he.arrowDown:" ",l=i?kt.cyan().underline(t.title):t.title;return o=(i?kt.cyan(he.pointer)+" ":" ")+o,t.description&&(n=` - ${t.description}`,(o.length+l.length+n.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(n=` -`+vn(t.description,{margin:3,width:this.out.columns}))),o+" "+l+kt.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(qe.hide):this.out.write(ze(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:i}=bn(this.select,this.choices.length,this.limit);if(this.outputText=[ue.symbol(this.done,this.aborted,this.exited),kt.bold(this.msg),ue.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const r=this.suggestions.slice(t,i).map((s,n)=>this.renderOption(s,this.select===n+t,n===0&&t>0,n+t===i-1&&i=this.rendered.length)return this.bell();let t=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor+1);this.input=`${t}${i}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(t,i,r,s){let n,o=r?de.arrowUp:s?de.arrowDown:" ",l=i?kt.cyan().underline(t.title):t.title;return o=(i?kt.cyan(de.pointer)+" ":" ")+o,t.description&&(n=` - ${t.description}`,(o.length+l.length+n.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(n=` +`+vn(t.description,{margin:3,width:this.out.columns}))),o+" "+l+kt.gray(n||"")}render(){if(this.closed)return;this.firstRender?this.out.write(qe.hide):this.out.write(ze(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:i}=bn(this.select,this.choices.length,this.limit);if(this.outputText=[he.symbol(this.done,this.aborted,this.exited),kt.bold(this.msg),he.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const r=this.suggestions.slice(t,i).map((s,n)=>this.renderOption(s,this.select===n+t,n===0&&t>0,n+t===i-1&&it.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const i=this.filteredOptions.findIndex(r=>r===t);this.cursor=i<0?0:i,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,i){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` +`+(r||kt.gray(this.fallback.title))}this.out.write(gn.line+qe.to(0)+this.outputText)}}var Pn=En;const st=K,{cursor:xn}=q,On=Ke,{clear:Qe,style:Xe,figures:vt}=Z;class Tn extends On{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Qe("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const t=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const i=this.filteredOptions.findIndex(r=>r===t);this.cursor=i<0?0:i,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,i){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` Instructions: - ${gt.arrowUp}/${gt.arrowDown}: Highlight option - ${gt.arrowLeft}/${gt.arrowRight}/[space]: Toggle selection + ${vt.arrowUp}/${vt.arrowDown}: Highlight option + ${vt.arrowLeft}/${vt.arrowRight}/[space]: Toggle selection [a,b,c]/delete: Filter choices enter/return: Complete answer `:""}renderCurrentInput(){return` Filtered results for: ${this.inputValue?this.inputValue:st.gray("Enter something to filter")} -`}renderOption(t,i,r){let s;return i.disabled?s=t===r?st.gray().underline(i.title):st.strikethrough().gray(i.title):s=t===r?st.cyan().underline(i.title):i.title,(i.selected?st.green(gt.radioOn):gt.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(i=>i.selected).map(i=>i.title).join(", ");const t=[st.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(st.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xn.hide),super.render();let t=[Xe.symbol(this.done,this.aborted),st.bold(this.msg),Xe.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=st.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Qe(t,this.out.columns)}}var Cn=Tn;const ti=K,Fn=at,{style:ei,clear:Mn}=Z,{erase:kn,cursor:ii}=q;class Dn extends Fn{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` +`}renderOption(t,i,r){let s;return i.disabled?s=t===r?st.gray().underline(i.title):st.strikethrough().gray(i.title):s=t===r?st.cyan().underline(i.title):i.title,(i.selected?st.green(vt.radioOn):vt.radioOff)+" "+s}renderDoneOrInstructions(){if(this.done)return this.value.filter(i=>i.selected).map(i=>i.title).join(", ");const t=[st.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(st.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xn.hide),super.render();let t=[Xe.symbol(this.done,this.aborted),st.bold(this.msg),Xe.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=st.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=Qe(t,this.out.columns)}}var Cn=Tn;const ti=K,Fn=at,{style:ei,clear:Mn}=Z,{erase:kn,cursor:ii}=q;class Dn extends Fn{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` -`),this.close()}_(t,i){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(ii.hide):this.out.write(Mn(this.outputText,this.out.columns)),super.render(),this.outputText=[ei.symbol(this.done,this.aborted),ti.bold(this.msg),ei.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:ti.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(kn.line+ii.to(0)+this.outputText))}}var _n=Dn,An={TextPrompt:ss,SelectPrompt:us,TogglePrompt:ps,DatePrompt:sn,NumberPrompt:hn,MultiselectPrompt:Ke,AutocompletePrompt:Pn,AutocompleteMultiselectPrompt:Cn,ConfirmPrompt:_n};(function(e){const t=e,i=An,r=o=>o;function s(o,l,y={}){return new Promise((d,a)=>{const h=new i[o](l),c=y.onAbort||r,u=y.onSubmit||r,f=y.onExit||r;h.on("state",l.onState||r),h.on("submit",m=>d(u(m))),h.on("exit",m=>d(f(m))),h.on("abort",m=>a(c(m)))})}t.text=o=>s("TextPrompt",o),t.password=o=>(o.style="password",t.text(o)),t.invisible=o=>(o.style="invisible",t.text(o)),t.number=o=>s("NumberPrompt",o),t.date=o=>s("DatePrompt",o),t.confirm=o=>s("ConfirmPrompt",o),t.list=o=>{const l=o.separator||",";return s("TextPrompt",o,{onSubmit:y=>y.split(l).map(d=>d.trim())})},t.toggle=o=>s("TogglePrompt",o),t.select=o=>s("SelectPrompt",o),t.multiselect=o=>{o.choices=[].concat(o.choices||[]);const l=y=>y.filter(d=>d.selected).map(d=>d.value);return s("MultiselectPrompt",o,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=o=>{o.choices=[].concat(o.choices||[]);const l=y=>y.filter(d=>d.selected).map(d=>d.value);return s("AutocompleteMultiselectPrompt",o,{onAbort:l,onSubmit:l})};const n=(o,l)=>Promise.resolve(l.filter(y=>y.title.slice(0,o.length).toLowerCase()===o.toLowerCase()));t.autocomplete=o=>(o.suggest=o.suggest||n,o.choices=[].concat(o.choices||[]),s("AutocompletePrompt",o))})(Me);const de=Me,In=["suggest","format","onState","validate","onRender","type"],ri=()=>{};async function ct(e=[],{onSubmit:t=ri,onCancel:i=ri}={}){const r={},s=ct._override||{};e=[].concat(e);let n,o,l,y,d,a;const h=async(c,u,f=!1)=>{if(!(!f&&c.validate&&c.validate(u)!==!0))return c.format?await c.format(u,r):u};for(o of e)if({name:y,type:d}=o,typeof d=="function"&&(d=await d(n,{...r},o),o.type=d),!!d){for(let c in o){if(In.includes(c))continue;let u=o[c];o[c]=typeof u=="function"?await u(n,{...r},a):u}if(a=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:y,type:d}=o,de[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(s[o.name]!==void 0&&(n=await h(o,s[o.name]),n!==void 0)){r[y]=n;continue}try{n=ct._injected?Nn(ct._injected,o.initial):await de[d](o),r[y]=n=await h(o,n,!0),l=await t(o,n,r)}catch{l=!await i(o,r)}if(l)return r}return r}function Nn(e,t){const i=e.shift();if(i instanceof Error)throw i;return i===void 0?t:i}function Rn(e){ct._injected=(ct._injected||[]).concat(e)}function jn(e){ct._override=Object.assign({},e)}var Ln=Object.assign(ct,{prompt:ct,prompts:de,inject:Rn,override:jn});const si=te(Ln);function Jn(e,t){var i=e;t.slice(0,-1).forEach(function(s){i=i[s]||{}});var r=t[t.length-1];return r in i}function ni(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function oi(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}var Yn=function(e,t){t||(t={});var i={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(i.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?i.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(w){i.bools[w]=!0});var r={};function s(w){return r[w].some(function(D){return i.bools[D]})}Object.keys(t.alias||{}).forEach(function(w){r[w]=[].concat(t.alias[w]),r[w].forEach(function(D){r[D]=[w].concat(r[w].filter(function(G){return D!==G}))})}),[].concat(t.string).filter(Boolean).forEach(function(w){i.strings[w]=!0,r[w]&&[].concat(r[w]).forEach(function(D){i.strings[D]=!0})});var n=t.default||{},o={_:[]};function l(w,D){return i.allBools&&/^--[^=]+$/.test(D)||i.strings[w]||i.bools[w]||r[w]}function y(w,D,G){for(var E=w,et=0;et{t.push((s,n)=>s!=null?r(s):i(n)),e.apply(this,t)})},"name",{value:e.name})},I.fromPromise=function(e){return Object.defineProperty(function(...t){const i=t[t.length-1];if(typeof i!="function")return e.apply(this,t);t.pop(),e.apply(this,t).then(r=>i(null,r),i)},"name",{value:e.name})};var ut=pr,Wn=process.cwd,Vt=null,Vn=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Vt||(Vt=Wn.call(process)),Vt};try{process.cwd()}catch{}if(typeof process.chdir=="function"){var ai=process.chdir;process.chdir=function(e){Vt=null,ai.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ai)}var Hn=Un;function Un(e){ut.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||i(e),e.chown=n(e.chown),e.fchown=n(e.fchown),e.lchown=n(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=o(e.chownSync),e.fchownSync=o(e.fchownSync),e.lchownSync=o(e.lchownSync),e.chmodSync=s(e.chmodSync),e.fchmodSync=s(e.fchmodSync),e.lchmodSync=s(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=y(e.statSync),e.fstatSync=y(e.fstatSync),e.lstatSync=y(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(a,h,c){c&&process.nextTick(c)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(a,h,c,u){u&&process.nextTick(u)},e.lchownSync=function(){}),Vn==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(a){function h(c,u,f){var m=Date.now(),v=0;a(c,u,function b(T){if(T&&(T.code==="EACCES"||T.code==="EPERM"||T.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){e.stat(u,function($,w){$&&$.code==="ENOENT"?a(c,u,b):f(T)})},v),v<100&&(v+=10);return}f&&f(T)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,a),h}(e.rename)),e.read=typeof e.read!="function"?e.read:function(a){function h(c,u,f,m,v,b){var T;if(b&&typeof b=="function"){var $=0;T=function(w,D,G){if(w&&w.code==="EAGAIN"&&$<10)return $++,a.call(e,c,u,f,m,v,T);b.apply(this,arguments)}}return a.call(e,c,u,f,m,v,T)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,a),h}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(a){return function(h,c,u,f,m){for(var v=0;;)try{return a.call(e,h,c,u,f,m)}catch(b){if(b.code==="EAGAIN"&&v<10){v++;continue}throw b}}}(e.readSync);function t(a){a.lchmod=function(h,c,u){a.open(h,ut.O_WRONLY|ut.O_SYMLINK,c,function(f,m){if(f){u&&u(f);return}a.fchmod(m,c,function(v){a.close(m,function(b){u&&u(v||b)})})})},a.lchmodSync=function(h,c){var u=a.openSync(h,ut.O_WRONLY|ut.O_SYMLINK,c),f=!0,m;try{m=a.fchmodSync(u,c),f=!1}finally{if(f)try{a.closeSync(u)}catch{}else a.closeSync(u)}return m}}function i(a){ut.hasOwnProperty("O_SYMLINK")&&a.futimes?(a.lutimes=function(h,c,u,f){a.open(h,ut.O_SYMLINK,function(m,v){if(m){f&&f(m);return}a.futimes(v,c,u,function(b){a.close(v,function(T){f&&f(b||T)})})})},a.lutimesSync=function(h,c,u){var f=a.openSync(h,ut.O_SYMLINK),m,v=!0;try{m=a.futimesSync(f,c,u),v=!1}finally{if(v)try{a.closeSync(f)}catch{}else a.closeSync(f)}return m}):a.futimes&&(a.lutimes=function(h,c,u,f){f&&process.nextTick(f)},a.lutimesSync=function(){})}function r(a){return a&&function(h,c,u){return a.call(e,h,c,function(f){d(f)&&(f=null),u&&u.apply(this,arguments)})}}function s(a){return a&&function(h,c){try{return a.call(e,h,c)}catch(u){if(!d(u))throw u}}}function n(a){return a&&function(h,c,u,f){return a.call(e,h,c,u,function(m){d(m)&&(m=null),f&&f.apply(this,arguments)})}}function o(a){return a&&function(h,c,u){try{return a.call(e,h,c,u)}catch(f){if(!d(f))throw f}}}function l(a){return a&&function(h,c,u){typeof c=="function"&&(u=c,c=null);function f(m,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),u&&u.apply(this,arguments)}return c?a.call(e,h,c,f):a.call(e,h,f)}}function y(a){return a&&function(h,c){var u=c?a.call(e,h,c):a.call(e,h);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}}function d(a){if(!a||a.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(a.code==="EINVAL"||a.code==="EPERM"))}}var li=yr.Stream,Gn=Kn;function Kn(e){return{ReadStream:t,WriteStream:i};function t(r,s){if(!(this instanceof t))return new t(r,s);li.call(this);var n=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var o=Object.keys(s),l=0,y=o.length;lthis.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){n._read()});return}e.open(this.path,this.flags,this.mode,function(a,h){if(a){n.emit("error",a),n.readable=!1;return}n.fd=h,n.emit("open",h),n._read()})}function i(r,s){if(!(this instanceof i))return new i(r,s);li.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var n=Object.keys(s),o=0,l=n.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}var qn=Zn,zn=Object.getPrototypeOf||function(e){return e.__proto__};function Zn(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:zn(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}),t}var k=Fe,Qn=Hn,Xn=Gn,to=qn,Ht=wr,Y,Ut;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Y=Symbol.for("graceful-fs.queue"),Ut=Symbol.for("graceful-fs.previous")):(Y="___graceful-fs.queue",Ut="___graceful-fs.previous");function eo(){}function ci(e,t){Object.defineProperty(e,Y,{get:function(){return t}})}var mt=eo;if(Ht.debuglog?mt=Ht.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(mt=function(){var e=Ht.format.apply(Ht,arguments);e="GFS4: "+e.split(/\n/).join(` -GFS4: `),console.error(e)}),!k[Y]){var io=Xt[Y]||[];ci(k,io),k.close=function(e){function t(i,r){return e.call(k,i,function(s){s||ui(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(t,Ut,{value:e}),t}(k.close),k.closeSync=function(e){function t(i){e.apply(k,arguments),ui()}return Object.defineProperty(t,Ut,{value:e}),t}(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){mt(k[Y]),vr.equal(k[Y].length,0)})}Xt[Y]||ci(Xt,k[Y]);var vt=fe(to(k));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched&&(vt=fe(k),k.__patched=!0);function fe(e){Qn(e),e.gracefulify=fe,e.createReadStream=D,e.createWriteStream=G;var t=e.readFile;e.readFile=i;function i(p,g,S){return typeof g=="function"&&(S=g,g=null),j(p,g,S);function j(L,N,F,_){return t(L,N,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?bt([j,[L,N,F],x,_||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=s;function s(p,g,S,j){return typeof S=="function"&&(j=S,S=null),L(p,g,S,j);function L(N,F,_,x,J){return r(N,F,_,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?bt([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var n=e.appendFile;n&&(e.appendFile=o);function o(p,g,S,j){return typeof S=="function"&&(j=S,S=null),L(p,g,S,j);function L(N,F,_,x,J){return n(N,F,_,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?bt([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=y);function y(p,g,S,j){return typeof S=="function"&&(j=S,S=0),L(p,g,S,j);function L(N,F,_,x,J){return l(N,F,_,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?bt([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var a=/^v[0-5]\./;function h(p,g,S){typeof g=="function"&&(S=g,g=null);var j=a.test(process.version)?function(F,_,x,J){return d(F,L(F,_,x,J))}:function(F,_,x,J){return d(F,_,L(F,_,x,J))};return j(p,g,S);function L(N,F,_,x){return function(J,C){J&&(J.code==="EMFILE"||J.code==="ENFILE")?bt([j,[N,F,_],J,x||Date.now(),Date.now()]):(C&&C.sort&&C.sort(),typeof _=="function"&&_.call(this,J,C))}}}if(process.version.substr(0,4)==="v0.8"){var c=Xn(e);b=c.ReadStream,$=c.WriteStream}var u=e.ReadStream;u&&(b.prototype=Object.create(u.prototype),b.prototype.open=T);var f=e.WriteStream;f&&($.prototype=Object.create(f.prototype),$.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(p){b=p},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return $},set:function(p){$=p},enumerable:!0,configurable:!0});var m=b;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(p){m=p},enumerable:!0,configurable:!0});var v=$;Object.defineProperty(e,"FileWriteStream",{get:function(){return v},set:function(p){v=p},enumerable:!0,configurable:!0});function b(p,g){return this instanceof b?(u.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function T(){var p=this;et(p.path,p.flags,p.mode,function(g,S){g?(p.autoClose&&p.destroy(),p.emit("error",g)):(p.fd=S,p.emit("open",S),p.read())})}function $(p,g){return this instanceof $?(f.apply(this,arguments),this):$.apply(Object.create($.prototype),arguments)}function w(){var p=this;et(p.path,p.flags,p.mode,function(g,S){g?(p.destroy(),p.emit("error",g)):(p.fd=S,p.emit("open",S))})}function D(p,g){return new e.ReadStream(p,g)}function G(p,g){return new e.WriteStream(p,g)}var E=e.open;e.open=et;function et(p,g,S,j){return typeof S=="function"&&(j=S,S=null),L(p,g,S,j);function L(N,F,_,x,J){return E(N,F,_,function(C,Tl){C&&(C.code==="EMFILE"||C.code==="ENFILE")?bt([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}return e}function bt(e){mt("ENQUEUE",e[0].name,e[1]),k[Y].push(e),me()}var Gt;function ui(){for(var e=Date.now(),t=0;t2&&(k[Y][t][3]=e,k[Y][t][4]=e);me()}function me(){if(clearTimeout(Gt),Gt=void 0,k[Y].length!==0){var e=k[Y].shift(),t=e[0],i=e[1],r=e[2],s=e[3],n=e[4];if(s===void 0)mt("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-s>=6e4){mt("TIMEOUT",t.name,i);var o=i.pop();typeof o=="function"&&o.call(null,r)}else{var l=Date.now()-n,y=Math.max(n-s,1),d=Math.min(y*1.2,100);l>=d?(mt("RETRY",t.name,i),t.apply(null,i.concat([s]))):k[Y].push(e)}Gt===void 0&&(Gt=setTimeout(me,0))}}(function(e){const t=I.fromCallback,i=vt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(s=>typeof i[s]=="function");Object.assign(e,i),r.forEach(s=>{e[s]=t(i[s])}),e.exists=function(s,n){return typeof n=="function"?i.exists(s,n):new Promise(o=>i.exists(s,o))},e.read=function(s,n,o,l,y,d){return typeof d=="function"?i.read(s,n,o,l,y,d):new Promise((a,h)=>{i.read(s,n,o,l,y,(c,u,f)=>{if(c)return h(c);a({bytesRead:u,buffer:f})})})},e.write=function(s,n,...o){return typeof o[o.length-1]=="function"?i.write(s,n,...o):new Promise((l,y)=>{i.write(s,n,...o,(d,a,h)=>{if(d)return y(d);l({bytesWritten:a,buffer:h})})})},e.readv=function(s,n,...o){return typeof o[o.length-1]=="function"?i.readv(s,n,...o):new Promise((l,y)=>{i.readv(s,n,...o,(d,a,h)=>{if(d)return y(d);l({bytesRead:a,buffers:h})})})},e.writev=function(s,n,...o){return typeof o[o.length-1]=="function"?i.writev(s,n,...o):new Promise((l,y)=>{i.writev(s,n,...o,(d,a,h)=>{if(d)return y(d);l({bytesWritten:a,buffers:h})})})},typeof i.realpath.native=="function"?e.realpath.native=t(i.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")})(W);var pe={},hi={};const ro=A;hi.checkPath=function(t){if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(ro.parse(t).root,""))){const r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}};const di=W,{checkPath:fi}=hi,mi=e=>{const t={mode:511};return typeof e=="number"?e:{...t,...e}.mode};pe.makeDir=async(e,t)=>(fi(e),di.mkdir(e,{mode:mi(t),recursive:!0})),pe.makeDirSync=(e,t)=>(fi(e),di.mkdirSync(e,{mode:mi(t),recursive:!0}));const so=I.fromPromise,{makeDir:no,makeDirSync:ye}=pe,we=so(no);var X={mkdirs:we,mkdirsSync:ye,mkdirp:we,mkdirpSync:ye,ensureDir:we,ensureDirSync:ye};const oo=I.fromPromise,pi=W;function ao(e){return pi.access(e).then(()=>!0).catch(()=>!1)}var pt={pathExists:oo(ao),pathExistsSync:pi.existsSync};const St=W,lo=I.fromPromise;async function co(e,t,i){const r=await St.open(e,"r+");let s=null;try{await St.futimes(r,t,i)}finally{try{await St.close(r)}catch(n){s=n}}if(s)throw s}function uo(e,t,i){const r=St.openSync(e,"r+");return St.futimesSync(r,t,i),St.closeSync(r)}var yi={utimesMillis:lo(co),utimesMillisSync:uo};const $t=W,R=A,wi=I.fromPromise;function ho(e,t,i){const r=i.dereference?s=>$t.stat(s,{bigint:!0}):s=>$t.lstat(s,{bigint:!0});return Promise.all([r(e),r(t).catch(s=>{if(s.code==="ENOENT")return null;throw s})]).then(([s,n])=>({srcStat:s,destStat:n}))}function fo(e,t,i){let r;const s=i.dereference?o=>$t.statSync(o,{bigint:!0}):o=>$t.lstatSync(o,{bigint:!0}),n=s(e);try{r=s(t)}catch(o){if(o.code==="ENOENT")return{srcStat:n,destStat:null};throw o}return{srcStat:n,destStat:r}}async function mo(e,t,i,r){const{srcStat:s,destStat:n}=await ho(e,t,r);if(n){if(Dt(s,n)){const o=R.basename(e),l=R.basename(t);if(i==="move"&&o!==l&&o.toLowerCase()===l.toLowerCase())return{srcStat:s,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!s.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(s.isDirectory()&&ge(e,t))throw new Error(Kt(e,t,i));return{srcStat:s,destStat:n}}function po(e,t,i,r){const{srcStat:s,destStat:n}=fo(e,t,r);if(n){if(Dt(s,n)){const o=R.basename(e),l=R.basename(t);if(i==="move"&&o!==l&&o.toLowerCase()===l.toLowerCase())return{srcStat:s,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!s.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(s.isDirectory()&&ge(e,t))throw new Error(Kt(e,t,i));return{srcStat:s,destStat:n}}async function gi(e,t,i,r){const s=R.resolve(R.dirname(e)),n=R.resolve(R.dirname(i));if(n===s||n===R.parse(n).root)return;let o;try{o=await $t.stat(n,{bigint:!0})}catch(l){if(l.code==="ENOENT")return;throw l}if(Dt(t,o))throw new Error(Kt(e,i,r));return gi(e,t,n,r)}function vi(e,t,i,r){const s=R.resolve(R.dirname(e)),n=R.resolve(R.dirname(i));if(n===s||n===R.parse(n).root)return;let o;try{o=$t.statSync(n,{bigint:!0})}catch(l){if(l.code==="ENOENT")return;throw l}if(Dt(t,o))throw new Error(Kt(e,i,r));return vi(e,t,n,r)}function Dt(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function ge(e,t){const i=R.resolve(e).split(R.sep).filter(s=>s),r=R.resolve(t).split(R.sep).filter(s=>s);return i.every((s,n)=>r[n]===s)}function Kt(e,t,i){return`Cannot ${i} '${e}' to a subdirectory of itself, '${t}'.`}var Et={checkPaths:wi(mo),checkPathsSync:po,checkParentPaths:wi(gi),checkParentPathsSync:vi,isSrcSubdir:ge,areIdentical:Dt};const B=W,_t=A,{mkdirs:yo}=X,{pathExists:wo}=pt,{utimesMillis:go}=yi,At=Et;async function vo(e,t,i={}){typeof i=="function"&&(i={filter:i}),i.clobber="clobber"in i?!!i.clobber:!0,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended; +`),this.close()}_(t,i){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(ii.hide):this.out.write(Mn(this.outputText,this.out.columns)),super.render(),this.outputText=[ei.symbol(this.done,this.aborted),ti.bold(this.msg),ei.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:ti.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(kn.line+ii.to(0)+this.outputText))}}var _n=Dn,An={TextPrompt:ss,SelectPrompt:us,TogglePrompt:ps,DatePrompt:sn,NumberPrompt:hn,MultiselectPrompt:Ke,AutocompletePrompt:Pn,AutocompleteMultiselectPrompt:Cn,ConfirmPrompt:_n};(function(e){const t=e,i=An,r=o=>o;function s(o,l,y={}){return new Promise((d,a)=>{const h=new i[o](l),c=y.onAbort||r,u=y.onSubmit||r,f=y.onExit||r;h.on("state",l.onState||r),h.on("submit",m=>d(u(m))),h.on("exit",m=>d(f(m))),h.on("abort",m=>a(c(m)))})}t.text=o=>s("TextPrompt",o),t.password=o=>(o.style="password",t.text(o)),t.invisible=o=>(o.style="invisible",t.text(o)),t.number=o=>s("NumberPrompt",o),t.date=o=>s("DatePrompt",o),t.confirm=o=>s("ConfirmPrompt",o),t.list=o=>{const l=o.separator||",";return s("TextPrompt",o,{onSubmit:y=>y.split(l).map(d=>d.trim())})},t.toggle=o=>s("TogglePrompt",o),t.select=o=>s("SelectPrompt",o),t.multiselect=o=>{o.choices=[].concat(o.choices||[]);const l=y=>y.filter(d=>d.selected).map(d=>d.value);return s("MultiselectPrompt",o,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=o=>{o.choices=[].concat(o.choices||[]);const l=y=>y.filter(d=>d.selected).map(d=>d.value);return s("AutocompleteMultiselectPrompt",o,{onAbort:l,onSubmit:l})};const n=(o,l)=>Promise.resolve(l.filter(y=>y.title.slice(0,o.length).toLowerCase()===o.toLowerCase()));t.autocomplete=o=>(o.suggest=o.suggest||n,o.choices=[].concat(o.choices||[]),s("AutocompletePrompt",o))})(Me);const fe=Me,In=["suggest","format","onState","validate","onRender","type"],ri=()=>{};async function ct(e=[],{onSubmit:t=ri,onCancel:i=ri}={}){const r={},s=ct._override||{};e=[].concat(e);let n,o,l,y,d,a;const h=async(c,u,f=!1)=>{if(!(!f&&c.validate&&c.validate(u)!==!0))return c.format?await c.format(u,r):u};for(o of e)if({name:y,type:d}=o,typeof d=="function"&&(d=await d(n,{...r},o),o.type=d),!!d){for(let c in o){if(In.includes(c))continue;let u=o[c];o[c]=typeof u=="function"?await u(n,{...r},a):u}if(a=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:y,type:d}=o,fe[d]===void 0)throw new Error(`prompt type (${d}) is not defined`);if(s[o.name]!==void 0&&(n=await h(o,s[o.name]),n!==void 0)){r[y]=n;continue}try{n=ct._injected?Nn(ct._injected,o.initial):await fe[d](o),r[y]=n=await h(o,n,!0),l=await t(o,n,r)}catch{l=!await i(o,r)}if(l)return r}return r}function Nn(e,t){const i=e.shift();if(i instanceof Error)throw i;return i===void 0?t:i}function Rn(e){ct._injected=(ct._injected||[]).concat(e)}function jn(e){ct._override=Object.assign({},e)}var Ln=Object.assign(ct,{prompt:ct,prompts:fe,inject:Rn,override:jn});const si=ee(Ln);function Jn(e,t){var i=e;t.slice(0,-1).forEach(function(s){i=i[s]||{}});var r=t[t.length-1];return r in i}function ni(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function oi(e,t){return t==="constructor"&&typeof e[t]=="function"||t==="__proto__"}var Yn=function(e,t){t||(t={});var i={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(i.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?i.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(w){i.bools[w]=!0});var r={};function s(w){return r[w].some(function(D){return i.bools[D]})}Object.keys(t.alias||{}).forEach(function(w){r[w]=[].concat(t.alias[w]),r[w].forEach(function(D){r[D]=[w].concat(r[w].filter(function(G){return D!==G}))})}),[].concat(t.string).filter(Boolean).forEach(function(w){i.strings[w]=!0,r[w]&&[].concat(r[w]).forEach(function(D){i.strings[D]=!0})});var n=t.default||{},o={_:[]};function l(w,D){return i.allBools&&/^--[^=]+$/.test(D)||i.strings[w]||i.bools[w]||r[w]}function y(w,D,G){for(var E=w,et=0;et{t.push((s,n)=>s!=null?r(s):i(n)),e.apply(this,t)})},"name",{value:e.name})},I.fromPromise=function(e){return Object.defineProperty(function(...t){const i=t[t.length-1];if(typeof i!="function")return e.apply(this,t);t.pop(),e.apply(this,t).then(r=>i(null,r),i)},"name",{value:e.name})};var ut=pr,Wn=process.cwd,Ht=null,Vn=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Ht||(Ht=Wn.call(process)),Ht};try{process.cwd()}catch{}if(typeof process.chdir=="function"){var ai=process.chdir;process.chdir=function(e){Ht=null,ai.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ai)}var Hn=Un;function Un(e){ut.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||i(e),e.chown=n(e.chown),e.fchown=n(e.fchown),e.lchown=n(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=o(e.chownSync),e.fchownSync=o(e.fchownSync),e.lchownSync=o(e.lchownSync),e.chmodSync=s(e.chmodSync),e.fchmodSync=s(e.fchmodSync),e.lchmodSync=s(e.lchmodSync),e.stat=l(e.stat),e.fstat=l(e.fstat),e.lstat=l(e.lstat),e.statSync=y(e.statSync),e.fstatSync=y(e.fstatSync),e.lstatSync=y(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(a,h,c){c&&process.nextTick(c)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(a,h,c,u){u&&process.nextTick(u)},e.lchownSync=function(){}),Vn==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(a){function h(c,u,f){var m=Date.now(),v=0;a(c,u,function b(T){if(T&&(T.code==="EACCES"||T.code==="EPERM"||T.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){e.stat(u,function($,w){$&&$.code==="ENOENT"?a(c,u,b):f(T)})},v),v<100&&(v+=10);return}f&&f(T)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,a),h}(e.rename)),e.read=typeof e.read!="function"?e.read:function(a){function h(c,u,f,m,v,b){var T;if(b&&typeof b=="function"){var $=0;T=function(w,D,G){if(w&&w.code==="EAGAIN"&&$<10)return $++,a.call(e,c,u,f,m,v,T);b.apply(this,arguments)}}return a.call(e,c,u,f,m,v,T)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,a),h}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(a){return function(h,c,u,f,m){for(var v=0;;)try{return a.call(e,h,c,u,f,m)}catch(b){if(b.code==="EAGAIN"&&v<10){v++;continue}throw b}}}(e.readSync);function t(a){a.lchmod=function(h,c,u){a.open(h,ut.O_WRONLY|ut.O_SYMLINK,c,function(f,m){if(f){u&&u(f);return}a.fchmod(m,c,function(v){a.close(m,function(b){u&&u(v||b)})})})},a.lchmodSync=function(h,c){var u=a.openSync(h,ut.O_WRONLY|ut.O_SYMLINK,c),f=!0,m;try{m=a.fchmodSync(u,c),f=!1}finally{if(f)try{a.closeSync(u)}catch{}else a.closeSync(u)}return m}}function i(a){ut.hasOwnProperty("O_SYMLINK")&&a.futimes?(a.lutimes=function(h,c,u,f){a.open(h,ut.O_SYMLINK,function(m,v){if(m){f&&f(m);return}a.futimes(v,c,u,function(b){a.close(v,function(T){f&&f(b||T)})})})},a.lutimesSync=function(h,c,u){var f=a.openSync(h,ut.O_SYMLINK),m,v=!0;try{m=a.futimesSync(f,c,u),v=!1}finally{if(v)try{a.closeSync(f)}catch{}else a.closeSync(f)}return m}):a.futimes&&(a.lutimes=function(h,c,u,f){f&&process.nextTick(f)},a.lutimesSync=function(){})}function r(a){return a&&function(h,c,u){return a.call(e,h,c,function(f){d(f)&&(f=null),u&&u.apply(this,arguments)})}}function s(a){return a&&function(h,c){try{return a.call(e,h,c)}catch(u){if(!d(u))throw u}}}function n(a){return a&&function(h,c,u,f){return a.call(e,h,c,u,function(m){d(m)&&(m=null),f&&f.apply(this,arguments)})}}function o(a){return a&&function(h,c,u){try{return a.call(e,h,c,u)}catch(f){if(!d(f))throw f}}}function l(a){return a&&function(h,c,u){typeof c=="function"&&(u=c,c=null);function f(m,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),u&&u.apply(this,arguments)}return c?a.call(e,h,c,f):a.call(e,h,f)}}function y(a){return a&&function(h,c){var u=c?a.call(e,h,c):a.call(e,h);return u&&(u.uid<0&&(u.uid+=4294967296),u.gid<0&&(u.gid+=4294967296)),u}}function d(a){if(!a||a.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(a.code==="EINVAL"||a.code==="EPERM"))}}var li=yr.Stream,Gn=Kn;function Kn(e){return{ReadStream:t,WriteStream:i};function t(r,s){if(!(this instanceof t))return new t(r,s);li.call(this);var n=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var o=Object.keys(s),l=0,y=o.length;lthis.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){n._read()});return}e.open(this.path,this.flags,this.mode,function(a,h){if(a){n.emit("error",a),n.readable=!1;return}n.fd=h,n.emit("open",h),n._read()})}function i(r,s){if(!(this instanceof i))return new i(r,s);li.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var n=Object.keys(s),o=0,l=n.length;o= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}var qn=Zn,zn=Object.getPrototypeOf||function(e){return e.__proto__};function Zn(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:zn(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}),t}var k=Fe,Qn=Hn,Xn=Gn,to=qn,Ut=wr,Y,Gt;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Y=Symbol.for("graceful-fs.queue"),Gt=Symbol.for("graceful-fs.previous")):(Y="___graceful-fs.queue",Gt="___graceful-fs.previous");function eo(){}function ci(e,t){Object.defineProperty(e,Y,{get:function(){return t}})}var mt=eo;if(Ut.debuglog?mt=Ut.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(mt=function(){var e=Ut.format.apply(Ut,arguments);e="GFS4: "+e.split(/\n/).join(` +GFS4: `),console.error(e)}),!k[Y]){var io=te[Y]||[];ci(k,io),k.close=function(e){function t(i,r){return e.call(k,i,function(s){s||ui(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(t,Gt,{value:e}),t}(k.close),k.closeSync=function(e){function t(i){e.apply(k,arguments),ui()}return Object.defineProperty(t,Gt,{value:e}),t}(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){mt(k[Y]),vr.equal(k[Y].length,0)})}te[Y]||ci(te,k[Y]);var bt=me(to(k));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched&&(bt=me(k),k.__patched=!0);function me(e){Qn(e),e.gracefulify=me,e.createReadStream=D,e.createWriteStream=G;var t=e.readFile;e.readFile=i;function i(p,g,S){return typeof g=="function"&&(S=g,g=null),j(p,g,S);function j(L,N,F,_){return t(L,N,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?St([j,[L,N,F],x,_||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=s;function s(p,g,S,j){return typeof S=="function"&&(j=S,S=null),L(p,g,S,j);function L(N,F,_,x,J){return r(N,F,_,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?St([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var n=e.appendFile;n&&(e.appendFile=o);function o(p,g,S,j){return typeof S=="function"&&(j=S,S=null),L(p,g,S,j);function L(N,F,_,x,J){return n(N,F,_,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?St([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var l=e.copyFile;l&&(e.copyFile=y);function y(p,g,S,j){return typeof S=="function"&&(j=S,S=0),L(p,g,S,j);function L(N,F,_,x,J){return l(N,F,_,function(C){C&&(C.code==="EMFILE"||C.code==="ENFILE")?St([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}var d=e.readdir;e.readdir=h;var a=/^v[0-5]\./;function h(p,g,S){typeof g=="function"&&(S=g,g=null);var j=a.test(process.version)?function(F,_,x,J){return d(F,L(F,_,x,J))}:function(F,_,x,J){return d(F,_,L(F,_,x,J))};return j(p,g,S);function L(N,F,_,x){return function(J,C){J&&(J.code==="EMFILE"||J.code==="ENFILE")?St([j,[N,F,_],J,x||Date.now(),Date.now()]):(C&&C.sort&&C.sort(),typeof _=="function"&&_.call(this,J,C))}}}if(process.version.substr(0,4)==="v0.8"){var c=Xn(e);b=c.ReadStream,$=c.WriteStream}var u=e.ReadStream;u&&(b.prototype=Object.create(u.prototype),b.prototype.open=T);var f=e.WriteStream;f&&($.prototype=Object.create(f.prototype),$.prototype.open=w),Object.defineProperty(e,"ReadStream",{get:function(){return b},set:function(p){b=p},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return $},set:function(p){$=p},enumerable:!0,configurable:!0});var m=b;Object.defineProperty(e,"FileReadStream",{get:function(){return m},set:function(p){m=p},enumerable:!0,configurable:!0});var v=$;Object.defineProperty(e,"FileWriteStream",{get:function(){return v},set:function(p){v=p},enumerable:!0,configurable:!0});function b(p,g){return this instanceof b?(u.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function T(){var p=this;et(p.path,p.flags,p.mode,function(g,S){g?(p.autoClose&&p.destroy(),p.emit("error",g)):(p.fd=S,p.emit("open",S),p.read())})}function $(p,g){return this instanceof $?(f.apply(this,arguments),this):$.apply(Object.create($.prototype),arguments)}function w(){var p=this;et(p.path,p.flags,p.mode,function(g,S){g?(p.destroy(),p.emit("error",g)):(p.fd=S,p.emit("open",S))})}function D(p,g){return new e.ReadStream(p,g)}function G(p,g){return new e.WriteStream(p,g)}var E=e.open;e.open=et;function et(p,g,S,j){return typeof S=="function"&&(j=S,S=null),L(p,g,S,j);function L(N,F,_,x,J){return E(N,F,_,function(C,Tl){C&&(C.code==="EMFILE"||C.code==="ENFILE")?St([L,[N,F,_,x],C,J||Date.now(),Date.now()]):typeof x=="function"&&x.apply(this,arguments)})}}return e}function St(e){mt("ENQUEUE",e[0].name,e[1]),k[Y].push(e),pe()}var Kt;function ui(){for(var e=Date.now(),t=0;t2&&(k[Y][t][3]=e,k[Y][t][4]=e);pe()}function pe(){if(clearTimeout(Kt),Kt=void 0,k[Y].length!==0){var e=k[Y].shift(),t=e[0],i=e[1],r=e[2],s=e[3],n=e[4];if(s===void 0)mt("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-s>=6e4){mt("TIMEOUT",t.name,i);var o=i.pop();typeof o=="function"&&o.call(null,r)}else{var l=Date.now()-n,y=Math.max(n-s,1),d=Math.min(y*1.2,100);l>=d?(mt("RETRY",t.name,i),t.apply(null,i.concat([s]))):k[Y].push(e)}Kt===void 0&&(Kt=setTimeout(pe,0))}}(function(e){const t=I.fromCallback,i=bt,r=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(s=>typeof i[s]=="function");Object.assign(e,i),r.forEach(s=>{e[s]=t(i[s])}),e.exists=function(s,n){return typeof n=="function"?i.exists(s,n):new Promise(o=>i.exists(s,o))},e.read=function(s,n,o,l,y,d){return typeof d=="function"?i.read(s,n,o,l,y,d):new Promise((a,h)=>{i.read(s,n,o,l,y,(c,u,f)=>{if(c)return h(c);a({bytesRead:u,buffer:f})})})},e.write=function(s,n,...o){return typeof o[o.length-1]=="function"?i.write(s,n,...o):new Promise((l,y)=>{i.write(s,n,...o,(d,a,h)=>{if(d)return y(d);l({bytesWritten:a,buffer:h})})})},e.readv=function(s,n,...o){return typeof o[o.length-1]=="function"?i.readv(s,n,...o):new Promise((l,y)=>{i.readv(s,n,...o,(d,a,h)=>{if(d)return y(d);l({bytesRead:a,buffers:h})})})},e.writev=function(s,n,...o){return typeof o[o.length-1]=="function"?i.writev(s,n,...o):new Promise((l,y)=>{i.writev(s,n,...o,(d,a,h)=>{if(d)return y(d);l({bytesWritten:a,buffers:h})})})},typeof i.realpath.native=="function"?e.realpath.native=t(i.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")})(W);var ye={},hi={};const ro=A;hi.checkPath=function(t){if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(ro.parse(t).root,""))){const r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}};const di=W,{checkPath:fi}=hi,mi=e=>{const t={mode:511};return typeof e=="number"?e:{...t,...e}.mode};ye.makeDir=async(e,t)=>(fi(e),di.mkdir(e,{mode:mi(t),recursive:!0})),ye.makeDirSync=(e,t)=>(fi(e),di.mkdirSync(e,{mode:mi(t),recursive:!0}));const so=I.fromPromise,{makeDir:no,makeDirSync:we}=ye,ge=so(no);var X={mkdirs:ge,mkdirsSync:we,mkdirp:ge,mkdirpSync:we,ensureDir:ge,ensureDirSync:we};const oo=I.fromPromise,pi=W;function ao(e){return pi.access(e).then(()=>!0).catch(()=>!1)}var pt={pathExists:oo(ao),pathExistsSync:pi.existsSync};const $t=W,lo=I.fromPromise;async function co(e,t,i){const r=await $t.open(e,"r+");let s=null;try{await $t.futimes(r,t,i)}finally{try{await $t.close(r)}catch(n){s=n}}if(s)throw s}function uo(e,t,i){const r=$t.openSync(e,"r+");return $t.futimesSync(r,t,i),$t.closeSync(r)}var yi={utimesMillis:lo(co),utimesMillisSync:uo};const Et=W,R=A,wi=I.fromPromise;function ho(e,t,i){const r=i.dereference?s=>Et.stat(s,{bigint:!0}):s=>Et.lstat(s,{bigint:!0});return Promise.all([r(e),r(t).catch(s=>{if(s.code==="ENOENT")return null;throw s})]).then(([s,n])=>({srcStat:s,destStat:n}))}function fo(e,t,i){let r;const s=i.dereference?o=>Et.statSync(o,{bigint:!0}):o=>Et.lstatSync(o,{bigint:!0}),n=s(e);try{r=s(t)}catch(o){if(o.code==="ENOENT")return{srcStat:n,destStat:null};throw o}return{srcStat:n,destStat:r}}async function mo(e,t,i,r){const{srcStat:s,destStat:n}=await ho(e,t,r);if(n){if(Dt(s,n)){const o=R.basename(e),l=R.basename(t);if(i==="move"&&o!==l&&o.toLowerCase()===l.toLowerCase())return{srcStat:s,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!s.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(s.isDirectory()&&ve(e,t))throw new Error(qt(e,t,i));return{srcStat:s,destStat:n}}function po(e,t,i,r){const{srcStat:s,destStat:n}=fo(e,t,r);if(n){if(Dt(s,n)){const o=R.basename(e),l=R.basename(t);if(i==="move"&&o!==l&&o.toLowerCase()===l.toLowerCase())return{srcStat:s,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(s.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!s.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(s.isDirectory()&&ve(e,t))throw new Error(qt(e,t,i));return{srcStat:s,destStat:n}}async function gi(e,t,i,r){const s=R.resolve(R.dirname(e)),n=R.resolve(R.dirname(i));if(n===s||n===R.parse(n).root)return;let o;try{o=await Et.stat(n,{bigint:!0})}catch(l){if(l.code==="ENOENT")return;throw l}if(Dt(t,o))throw new Error(qt(e,i,r));return gi(e,t,n,r)}function vi(e,t,i,r){const s=R.resolve(R.dirname(e)),n=R.resolve(R.dirname(i));if(n===s||n===R.parse(n).root)return;let o;try{o=Et.statSync(n,{bigint:!0})}catch(l){if(l.code==="ENOENT")return;throw l}if(Dt(t,o))throw new Error(qt(e,i,r));return vi(e,t,n,r)}function Dt(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function ve(e,t){const i=R.resolve(e).split(R.sep).filter(s=>s),r=R.resolve(t).split(R.sep).filter(s=>s);return i.every((s,n)=>r[n]===s)}function qt(e,t,i){return`Cannot ${i} '${e}' to a subdirectory of itself, '${t}'.`}var Pt={checkPaths:wi(mo),checkPathsSync:po,checkParentPaths:wi(gi),checkParentPathsSync:vi,isSrcSubdir:ve,areIdentical:Dt};const B=W,_t=A,{mkdirs:yo}=X,{pathExists:wo}=pt,{utimesMillis:go}=yi,At=Pt;async function vo(e,t,i={}){typeof i=="function"&&(i={filter:i}),i.clobber="clobber"in i?!!i.clobber:!0,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended; - see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");const{srcStat:r,destStat:s}=await At.checkPaths(e,t,"copy",i);if(await At.checkParentPaths(e,r,t,"copy"),!await bi(e,t,i))return;const o=_t.dirname(t);await wo(o)||await yo(o),await Si(s,e,t,i)}async function bi(e,t,i){return i.filter?i.filter(e,t):!0}async function Si(e,t,i,r){const n=await(r.dereference?B.stat:B.lstat)(t);if(n.isDirectory())return Eo(n,e,t,i,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return bo(n,e,t,i,r);if(n.isSymbolicLink())return Po(e,t,i,r);throw n.isSocket()?new Error(`Cannot copy a socket file: ${t}`):n.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)}async function bo(e,t,i,r,s){if(!t)return $i(e,i,r,s);if(s.overwrite)return await B.unlink(r),$i(e,i,r,s);if(s.errorOnExist)throw new Error(`'${r}' already exists`)}async function $i(e,t,i,r){if(await B.copyFile(t,i),r.preserveTimestamps){So(e.mode)&&await $o(i,e.mode);const s=await B.stat(t);await go(i,s.atime,s.mtime)}return B.chmod(i,e.mode)}function So(e){return(e&128)===0}function $o(e,t){return B.chmod(e,t|128)}async function Eo(e,t,i,r,s){t||await B.mkdir(r);const n=await B.readdir(i);await Promise.all(n.map(async o=>{const l=_t.join(i,o),y=_t.join(r,o);if(!await bi(l,y,s))return;const{destStat:a}=await At.checkPaths(l,y,"copy",s);return Si(a,l,y,s)})),t||await B.chmod(r,e.mode)}async function Po(e,t,i,r){let s=await B.readlink(t);if(r.dereference&&(s=_t.resolve(process.cwd(),s)),!e)return B.symlink(s,i);let n=null;try{n=await B.readlink(i)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return B.symlink(s,i);throw o}if(r.dereference&&(n=_t.resolve(process.cwd(),n)),At.isSrcSubdir(s,n))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${n}'.`);if(At.isSrcSubdir(n,s))throw new Error(`Cannot overwrite '${n}' with '${s}'.`);return await B.unlink(i),B.symlink(s,i)}var xo=vo;const V=vt,It=A,Oo=X.mkdirsSync,To=yi.utimesMillisSync,Nt=Et;function Co(e,t,i){typeof i=="function"&&(i={filter:i}),i=i||{},i.clobber="clobber"in i?!!i.clobber:!0,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended; + see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");const{srcStat:r,destStat:s}=await At.checkPaths(e,t,"copy",i);if(await At.checkParentPaths(e,r,t,"copy"),!await bi(e,t,i))return;const o=_t.dirname(t);await wo(o)||await yo(o),await Si(s,e,t,i)}async function bi(e,t,i){return i.filter?i.filter(e,t):!0}async function Si(e,t,i,r){const n=await(r.dereference?B.stat:B.lstat)(t);if(n.isDirectory())return Eo(n,e,t,i,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return bo(n,e,t,i,r);if(n.isSymbolicLink())return Po(e,t,i,r);throw n.isSocket()?new Error(`Cannot copy a socket file: ${t}`):n.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)}async function bo(e,t,i,r,s){if(!t)return $i(e,i,r,s);if(s.overwrite)return await B.unlink(r),$i(e,i,r,s);if(s.errorOnExist)throw new Error(`'${r}' already exists`)}async function $i(e,t,i,r){if(await B.copyFile(t,i),r.preserveTimestamps){So(e.mode)&&await $o(i,e.mode);const s=await B.stat(t);await go(i,s.atime,s.mtime)}return B.chmod(i,e.mode)}function So(e){return(e&128)===0}function $o(e,t){return B.chmod(e,t|128)}async function Eo(e,t,i,r,s){t||await B.mkdir(r);const n=await B.readdir(i);await Promise.all(n.map(async o=>{const l=_t.join(i,o),y=_t.join(r,o);if(!await bi(l,y,s))return;const{destStat:a}=await At.checkPaths(l,y,"copy",s);return Si(a,l,y,s)})),t||await B.chmod(r,e.mode)}async function Po(e,t,i,r){let s=await B.readlink(t);if(r.dereference&&(s=_t.resolve(process.cwd(),s)),!e)return B.symlink(s,i);let n=null;try{n=await B.readlink(i)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return B.symlink(s,i);throw o}if(r.dereference&&(n=_t.resolve(process.cwd(),n)),At.isSrcSubdir(s,n))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${n}'.`);if(At.isSrcSubdir(n,s))throw new Error(`Cannot overwrite '${n}' with '${s}'.`);return await B.unlink(i),B.symlink(s,i)}var xo=vo;const V=bt,It=A,Oo=X.mkdirsSync,To=yi.utimesMillisSync,Nt=Pt;function Co(e,t,i){typeof i=="function"&&(i={filter:i}),i=i||{},i.clobber="clobber"in i?!!i.clobber:!0,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended; - see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");const{srcStat:r,destStat:s}=Nt.checkPathsSync(e,t,"copy",i);if(Nt.checkParentPathsSync(e,r,t,"copy"),i.filter&&!i.filter(e,t))return;const n=It.dirname(t);return V.existsSync(n)||Oo(n),Ei(s,e,t,i)}function Ei(e,t,i,r){const n=(r.dereference?V.statSync:V.lstatSync)(t);if(n.isDirectory())return Io(n,e,t,i,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return Fo(n,e,t,i,r);if(n.isSymbolicLink())return jo(e,t,i,r);throw n.isSocket()?new Error(`Cannot copy a socket file: ${t}`):n.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)}function Fo(e,t,i,r,s){return t?Mo(e,i,r,s):Pi(e,i,r,s)}function Mo(e,t,i,r){if(r.overwrite)return V.unlinkSync(i),Pi(e,t,i,r);if(r.errorOnExist)throw new Error(`'${i}' already exists`)}function Pi(e,t,i,r){return V.copyFileSync(t,i),r.preserveTimestamps&&ko(e.mode,t,i),ve(i,e.mode)}function ko(e,t,i){return Do(e)&&_o(i,e),Ao(t,i)}function Do(e){return(e&128)===0}function _o(e,t){return ve(e,t|128)}function ve(e,t){return V.chmodSync(e,t)}function Ao(e,t){const i=V.statSync(e);return To(t,i.atime,i.mtime)}function Io(e,t,i,r,s){return t?xi(i,r,s):No(e.mode,i,r,s)}function No(e,t,i,r){return V.mkdirSync(i),xi(t,i,r),ve(i,e)}function xi(e,t,i){V.readdirSync(e).forEach(r=>Ro(r,e,t,i))}function Ro(e,t,i,r){const s=It.join(t,e),n=It.join(i,e);if(r.filter&&!r.filter(s,n))return;const{destStat:o}=Nt.checkPathsSync(s,n,"copy",r);return Ei(o,s,n,r)}function jo(e,t,i,r){let s=V.readlinkSync(t);if(r.dereference&&(s=It.resolve(process.cwd(),s)),e){let n;try{n=V.readlinkSync(i)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return V.symlinkSync(s,i);throw o}if(r.dereference&&(n=It.resolve(process.cwd(),n)),Nt.isSrcSubdir(s,n))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${n}'.`);if(Nt.isSrcSubdir(n,s))throw new Error(`Cannot overwrite '${n}' with '${s}'.`);return Lo(s,i)}else return V.symlinkSync(s,i)}function Lo(e,t){return V.unlinkSync(t),V.symlinkSync(e,t)}var Jo=Co;const Yo=I.fromPromise;var be={copy:Yo(xo),copySync:Jo};const Oi=vt,Bo=I.fromCallback;function Wo(e,t){Oi.rm(e,{recursive:!0,force:!0},t)}function Vo(e){Oi.rmSync(e,{recursive:!0,force:!0})}var qt={remove:Bo(Wo),removeSync:Vo};const Ho=I.fromPromise,Ti=W,Ci=A,Fi=X,Mi=qt,ki=Ho(async function(t){let i;try{i=await Ti.readdir(t)}catch{return Fi.mkdirs(t)}return Promise.all(i.map(r=>Mi.remove(Ci.join(t,r))))});function Di(e){let t;try{t=Ti.readdirSync(e)}catch{return Fi.mkdirsSync(e)}t.forEach(i=>{i=Ci.join(e,i),Mi.removeSync(i)})}var Uo={emptyDirSync:Di,emptydirSync:Di,emptyDir:ki,emptydir:ki};const Go=I.fromPromise,_i=A,nt=W,Ai=X;async function Ko(e){let t;try{t=await nt.stat(e)}catch{}if(t&&t.isFile())return;const i=_i.dirname(e);let r=null;try{r=await nt.stat(i)}catch(s){if(s.code==="ENOENT"){await Ai.mkdirs(i),await nt.writeFile(e,"");return}else throw s}r.isDirectory()?await nt.writeFile(e,""):await nt.readdir(i)}function qo(e){let t;try{t=nt.statSync(e)}catch{}if(t&&t.isFile())return;const i=_i.dirname(e);try{nt.statSync(i).isDirectory()||nt.readdirSync(i)}catch(r){if(r&&r.code==="ENOENT")Ai.mkdirsSync(i);else throw r}nt.writeFileSync(e,"")}var zo={createFile:Go(Ko),createFileSync:qo};const Zo=I.fromPromise,Ii=A,ht=W,Ni=X,{pathExists:Qo}=pt,{areIdentical:Ri}=Et;async function Xo(e,t){let i;try{i=await ht.lstat(t)}catch{}let r;try{r=await ht.lstat(e)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(i&&Ri(r,i))return;const s=Ii.dirname(t);await Qo(s)||await Ni.mkdirs(s),await ht.link(e,t)}function ta(e,t){let i;try{i=ht.lstatSync(t)}catch{}try{const n=ht.lstatSync(e);if(i&&Ri(n,i))return}catch(n){throw n.message=n.message.replace("lstat","ensureLink"),n}const r=Ii.dirname(t);return ht.existsSync(r)||Ni.mkdirsSync(r),ht.linkSync(e,t)}var ea={createLink:Zo(Xo),createLinkSync:ta};const dt=A,Rt=W,{pathExists:ia}=pt,ra=I.fromPromise;async function sa(e,t){if(dt.isAbsolute(e)){try{await Rt.lstat(e)}catch(n){throw n.message=n.message.replace("lstat","ensureSymlink"),n}return{toCwd:e,toDst:e}}const i=dt.dirname(t),r=dt.join(i,e);if(await ia(r))return{toCwd:r,toDst:e};try{await Rt.lstat(e)}catch(n){throw n.message=n.message.replace("lstat","ensureSymlink"),n}return{toCwd:e,toDst:dt.relative(i,e)}}function na(e,t){if(dt.isAbsolute(e)){if(!Rt.existsSync(e))throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}const i=dt.dirname(t),r=dt.join(i,e);if(Rt.existsSync(r))return{toCwd:r,toDst:e};if(!Rt.existsSync(e))throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:dt.relative(i,e)}}var oa={symlinkPaths:ra(sa),symlinkPathsSync:na};const ji=W,aa=I.fromPromise;async function la(e,t){if(t)return t;let i;try{i=await ji.lstat(e)}catch{return"file"}return i&&i.isDirectory()?"dir":"file"}function ca(e,t){if(t)return t;let i;try{i=ji.lstatSync(e)}catch{return"file"}return i&&i.isDirectory()?"dir":"file"}var ua={symlinkType:aa(la),symlinkTypeSync:ca};const ha=I.fromPromise,Li=A,tt=W,{mkdirs:da,mkdirsSync:fa}=X,{symlinkPaths:ma,symlinkPathsSync:pa}=oa,{symlinkType:ya,symlinkTypeSync:wa}=ua,{pathExists:ga}=pt,{areIdentical:Ji}=Et;async function va(e,t,i){let r;try{r=await tt.lstat(t)}catch{}if(r&&r.isSymbolicLink()){const[l,y]=await Promise.all([tt.stat(e),tt.stat(t)]);if(Ji(l,y))return}const s=await ma(e,t);e=s.toDst;const n=await ya(s.toCwd,i),o=Li.dirname(t);return await ga(o)||await da(o),tt.symlink(e,t,n)}function ba(e,t,i){let r;try{r=tt.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const l=tt.statSync(e),y=tt.statSync(t);if(Ji(l,y))return}const s=pa(e,t);e=s.toDst,i=wa(s.toCwd,i);const n=Li.dirname(t);return tt.existsSync(n)||fa(n),tt.symlinkSync(e,t,i)}var Sa={createSymlink:ha(va),createSymlinkSync:ba};const{createFile:Yi,createFileSync:Bi}=zo,{createLink:Wi,createLinkSync:Vi}=ea,{createSymlink:Hi,createSymlinkSync:Ui}=Sa;var $a={createFile:Yi,createFileSync:Bi,ensureFile:Yi,ensureFileSync:Bi,createLink:Wi,createLinkSync:Vi,ensureLink:Wi,ensureLinkSync:Vi,createSymlink:Hi,createSymlinkSync:Ui,ensureSymlink:Hi,ensureSymlinkSync:Ui};function Ea(e,{EOL:t=` -`,finalEOL:i=!0,replacer:r=null,spaces:s}={}){const n=i?t:"";return JSON.stringify(e,r,s).replace(/\n/g,t)+n}function Pa(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var Se={stringify:Ea,stripBom:Pa};let Pt;try{Pt=vt}catch{Pt=Fe}const zt=I,{stringify:Gi,stripBom:Ki}=Se;async function xa(e,t={}){typeof t=="string"&&(t={encoding:t});const i=t.fs||Pt,r="throws"in t?t.throws:!0;let s=await zt.fromCallback(i.readFile)(e,t);s=Ki(s);let n;try{n=JSON.parse(s,t?t.reviver:null)}catch(o){if(r)throw o.message=`${e}: ${o.message}`,o;return null}return n}const Oa=zt.fromPromise(xa);function Ta(e,t={}){typeof t=="string"&&(t={encoding:t});const i=t.fs||Pt,r="throws"in t?t.throws:!0;try{let s=i.readFileSync(e,t);return s=Ki(s),JSON.parse(s,t.reviver)}catch(s){if(r)throw s.message=`${e}: ${s.message}`,s;return null}}async function Ca(e,t,i={}){const r=i.fs||Pt,s=Gi(t,i);await zt.fromCallback(r.writeFile)(e,s,i)}const Fa=zt.fromPromise(Ca);function Ma(e,t,i={}){const r=i.fs||Pt,s=Gi(t,i);return r.writeFileSync(e,s,i)}const ka={readFile:Oa,readFileSync:Ta,writeFile:Fa,writeFileSync:Ma};var Da=ka;const Zt=Da;var _a={readJson:Zt.readFile,readJsonSync:Zt.readFileSync,writeJson:Zt.writeFile,writeJsonSync:Zt.writeFileSync};const Aa=I.fromPromise,$e=W,qi=A,zi=X,Ia=pt.pathExists;async function Na(e,t,i="utf-8"){const r=qi.dirname(e);return await Ia(r)||await zi.mkdirs(r),$e.writeFile(e,t,i)}function Ra(e,...t){const i=qi.dirname(e);$e.existsSync(i)||zi.mkdirsSync(i),$e.writeFileSync(e,...t)}var Ee={outputFile:Aa(Na),outputFileSync:Ra};const{stringify:ja}=Se,{outputFile:La}=Ee;async function Ja(e,t,i={}){const r=ja(t,i);await La(e,r,i)}var Ya=Ja;const{stringify:Ba}=Se,{outputFileSync:Wa}=Ee;function Va(e,t,i){const r=Ba(t,i);Wa(e,r,i)}var Ha=Va;const Ua=I.fromPromise,H=_a;H.outputJson=Ua(Ya),H.outputJsonSync=Ha,H.outputJSON=H.outputJson,H.outputJSONSync=H.outputJsonSync,H.writeJSON=H.writeJson,H.writeJSONSync=H.writeJsonSync,H.readJSON=H.readJson,H.readJSONSync=H.readJsonSync;var Ga=H;const Ka=W,Zi=A,{copy:qa}=be,{remove:Qi}=qt,{mkdirp:za}=X,{pathExists:Za}=pt,Xi=Et;async function Qa(e,t,i={}){const r=i.overwrite||i.clobber||!1,{srcStat:s,isChangingCase:n=!1}=await Xi.checkPaths(e,t,"move",i);await Xi.checkParentPaths(e,s,t,"move");const o=Zi.dirname(t);return Zi.parse(o).root!==o&&await za(o),Xa(e,t,r,n)}async function Xa(e,t,i,r){if(!r){if(i)await Qi(t);else if(await Za(t))throw new Error("dest already exists.")}try{await Ka.rename(e,t)}catch(s){if(s.code!=="EXDEV")throw s;await tl(e,t,i)}}async function tl(e,t,i){return await qa(e,t,{overwrite:i,errorOnExist:!0,preserveTimestamps:!0}),Qi(e)}var el=Qa;const tr=vt,Pe=A,il=be.copySync,er=qt.removeSync,rl=X.mkdirpSync,ir=Et;function sl(e,t,i){i=i||{};const r=i.overwrite||i.clobber||!1,{srcStat:s,isChangingCase:n=!1}=ir.checkPathsSync(e,t,"move",i);return ir.checkParentPathsSync(e,s,t,"move"),nl(t)||rl(Pe.dirname(t)),ol(e,t,r,n)}function nl(e){const t=Pe.dirname(e);return Pe.parse(t).root===t}function ol(e,t,i,r){if(r)return xe(e,t,i);if(i)return er(t),xe(e,t,i);if(tr.existsSync(t))throw new Error("dest already exists.");return xe(e,t,i)}function xe(e,t,i){try{tr.renameSync(e,t)}catch(r){if(r.code!=="EXDEV")throw r;return al(e,t,i)}}function al(e,t,i){return il(e,t,{overwrite:i,errorOnExist:!0,preserveTimestamps:!0}),er(e)}var ll=sl;const cl=I.fromPromise;var ul={move:cl(el),moveSync:ll},hl={...W,...be,...Uo,...$a,...Ga,...X,...ul,...Ee,...pt,...qt};const ot=te(hl);let yt=!0;const xt=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let jt=0;if(xt.process&&xt.process.env&&xt.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:i,TERM:r,COLORTERM:s}=xt.process.env;t||i||e==="0"?yt=!1:e==="1"||e==="2"||e==="3"?yt=!0:r==="dumb"?yt=!1:"CI"in xt.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(n=>n in xt.process.env)?yt=!0:yt=process.stdout.isTTY,yt&&(process.platform==="win32"||s&&(s==="truecolor"||s==="24bit")?jt=3:r&&(r.endsWith("-256color")||r.endsWith("256"))?jt=2:jt=1)}let rr={enabled:yt,supportLevel:jt};function Oe(e,t,i=1){const r=`\x1B[${e}m`,s=`\x1B[${t}m`,n=new RegExp(`\\x1b\\[${t}m`,"g");return o=>rr.enabled&&rr.supportLevel>=i?r+(""+o).replace(n,r)+s:""+o}const Ot=Oe(31,39),dl=Oe(32,39),Te=Oe(36,39),sr="18.0.0",nr="7.0.0",fl=gr(br),U=Bn(process.argv.slice(2),{string:["_"]}),or="vueform-project",ar=bl(process.env.npm_config_user_agent),Tt=ar?ar.name:"npm",ml=A.dirname(Er(import.meta.url)),pl=!!U.start||!!U.s,lr=!!U.force||!!U.f,cr=[{title:"Vite",value:"vite",command:{npm:"npm create vite@latest %PROJECT_NAME% -- --template %TEMPLATE%",yarn:"yarn create vite %PROJECT_NAME% --template %TEMPLATE%",pnpm:"pnpm create vite %PROJECT_NAME% --template %TEMPLATE%",bun:"bun create vite %PROJECT_NAME% --template %TEMPLATE%"}},{title:"Nuxt",value:"nuxt",command:{npm:"npx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%",yarn:"npx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%",pnpm:"pnpm dlx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%",bun:"bunx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%"}},{title:"Astro",value:"astro",command:{npm:"npm create astro@latest %PROJECT_NAME% -- --install=yes",yarn:"yarn create astro %PROJECT_NAME% --install=yes",pnpm:"pnpm create astro %PROJECT_NAME% --install=yes",bun:"bun create astro %PROJECT_NAME% --install=yes"}},{title:"Laravel",value:"laravel",command:"%COMPOSER_PATH% create-project laravel/laravel %PROJECT_NAME%"}],yl=[{title:"Vueform",value:"vueform"},{title:"Tailwind",value:"tailwind"},{title:"Bootstrap",value:"bootstrap"},{title:"Material",value:"material"},{title:"Tailwind Material",value:"tailwind-material"}],wl={vite:{install:["npm install -D tailwindcss postcss autoprefixer"]},nuxt:{install:["npm install -D @nuxtjs/tailwindcss"]},astro:{install:["npm install @astrojs/tailwind tailwindcss"]},laravel:{install:["npm install -D tailwindcss postcss autoprefixer"]}};process.env.PATH+=":/usr/local/bin",Ol();async function gl(){try{const{projectName:e}=await si({type:"text",name:"projectName",initial:or,message:"Choose a project name:",validate:async m=>/^[a-zA-Z0-9]+[a-zA-Z0-9-_]*$/.test(m)?!lr&&await ur(m)?`The directory '${m}' already exists.`:m?!0:"Please provide a project name":"Invalid project name. Use only alphanumeric, underscore, and hyphen characters and do not start with a hyphen or underscore."},{onCancel:()=>{throw new Error(Ot("\u2716")+" Operation cancelled")}});lr&&await ur(A.join(process.cwd(),e))&&await z("rm",["-r",or]);const t=await si([{type:U.builder||U.b?null:"select",name:"builder",message:"Which libraries do you want to install?",choices:[{title:"Vueform",value:"vueform"},{title:"Vueform + Builder",value:"builder"}]},{type:m=>U.builder||U.b||m==="builder"?"text":null,name:"publicKey",initial:U.publicKey||U.pk||"obtain a FREE one at https://app.vueform.com",message:"Your Public Key: ",validate:async m=>/^[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}$/.test(m)?m?!0:"Please provide your Public Key. If you don't have one go to https://app.vueform.com and generate one for FREE.":"Invalid Public Key. Please go to https://app.vueform.com and generate one for FREE."},{type:"select",name:"framework",message:"Choose a framework:",choices:cr},{type:m=>m!=="vite"||m==="laravel"?null:"toggle",name:"ts",message:"Do you plan to use TypeScript?",initial:"yes",active:"yes",inactive:"no"},{type:(m,{builder:v})=>U.builder||U.b||v==="builder"?null:"select",name:"theme",message:"Select a theme for your project:",choices:yl}],{onCancel:()=>{throw new Error(Ot("\u2716")+" Operation cancelled")}}),{framework:i,ts:r,publicKey:s}=t,n=!!U.builder||!!U.b||t.builder==="builder",o=n?"tailwind":t.theme,l=i==="astro",y=["tailwind","tailwind-material"].indexOf(o)!==-1||n,d=["bootstrap"].indexOf(o)!==-1,a=i==="laravel";if(e&&i){const m=vl(i);Qt(` -Creating project '${e}' using ${m.title}...`);const v=i==="vite"?`vue${r?"-ts":""}`:"";let b="";i==="laravel"&&(b=await xl());let T=typeof m.command=="string"?m.command:m.command[Tt];T=T.replace("%PROJECT_NAME%",e).replace("%TEMPLATE%",v).replace("%PACKAGE_MANAGER%",Tt).replace("%COMPOSER_PATH%",b).split(" "),await z(T[0],T.slice(1),`create project with ${m.title}`)}else{console.error("Project creation canceled.");return}if(!o){console.error("Project creation canceled.");return}process.chdir(e);const h=await Sl(process.cwd(),i,r),c=A.join(ml,"../","templates",n?"builder":"vueform",i,o,h?"ts":"js"),u=process.cwd();Qt(` -Installing dependencies...`),await z("npm",["install"],"install dependencies"),y&&(Qt(` + see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");const{srcStat:r,destStat:s}=Nt.checkPathsSync(e,t,"copy",i);if(Nt.checkParentPathsSync(e,r,t,"copy"),i.filter&&!i.filter(e,t))return;const n=It.dirname(t);return V.existsSync(n)||Oo(n),Ei(s,e,t,i)}function Ei(e,t,i,r){const n=(r.dereference?V.statSync:V.lstatSync)(t);if(n.isDirectory())return Io(n,e,t,i,r);if(n.isFile()||n.isCharacterDevice()||n.isBlockDevice())return Fo(n,e,t,i,r);if(n.isSymbolicLink())return jo(e,t,i,r);throw n.isSocket()?new Error(`Cannot copy a socket file: ${t}`):n.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)}function Fo(e,t,i,r,s){return t?Mo(e,i,r,s):Pi(e,i,r,s)}function Mo(e,t,i,r){if(r.overwrite)return V.unlinkSync(i),Pi(e,t,i,r);if(r.errorOnExist)throw new Error(`'${i}' already exists`)}function Pi(e,t,i,r){return V.copyFileSync(t,i),r.preserveTimestamps&&ko(e.mode,t,i),be(i,e.mode)}function ko(e,t,i){return Do(e)&&_o(i,e),Ao(t,i)}function Do(e){return(e&128)===0}function _o(e,t){return be(e,t|128)}function be(e,t){return V.chmodSync(e,t)}function Ao(e,t){const i=V.statSync(e);return To(t,i.atime,i.mtime)}function Io(e,t,i,r,s){return t?xi(i,r,s):No(e.mode,i,r,s)}function No(e,t,i,r){return V.mkdirSync(i),xi(t,i,r),be(i,e)}function xi(e,t,i){V.readdirSync(e).forEach(r=>Ro(r,e,t,i))}function Ro(e,t,i,r){const s=It.join(t,e),n=It.join(i,e);if(r.filter&&!r.filter(s,n))return;const{destStat:o}=Nt.checkPathsSync(s,n,"copy",r);return Ei(o,s,n,r)}function jo(e,t,i,r){let s=V.readlinkSync(t);if(r.dereference&&(s=It.resolve(process.cwd(),s)),e){let n;try{n=V.readlinkSync(i)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return V.symlinkSync(s,i);throw o}if(r.dereference&&(n=It.resolve(process.cwd(),n)),Nt.isSrcSubdir(s,n))throw new Error(`Cannot copy '${s}' to a subdirectory of itself, '${n}'.`);if(Nt.isSrcSubdir(n,s))throw new Error(`Cannot overwrite '${n}' with '${s}'.`);return Lo(s,i)}else return V.symlinkSync(s,i)}function Lo(e,t){return V.unlinkSync(t),V.symlinkSync(e,t)}var Jo=Co;const Yo=I.fromPromise;var Se={copy:Yo(xo),copySync:Jo};const Oi=bt,Bo=I.fromCallback;function Wo(e,t){Oi.rm(e,{recursive:!0,force:!0},t)}function Vo(e){Oi.rmSync(e,{recursive:!0,force:!0})}var zt={remove:Bo(Wo),removeSync:Vo};const Ho=I.fromPromise,Ti=W,Ci=A,Fi=X,Mi=zt,ki=Ho(async function(t){let i;try{i=await Ti.readdir(t)}catch{return Fi.mkdirs(t)}return Promise.all(i.map(r=>Mi.remove(Ci.join(t,r))))});function Di(e){let t;try{t=Ti.readdirSync(e)}catch{return Fi.mkdirsSync(e)}t.forEach(i=>{i=Ci.join(e,i),Mi.removeSync(i)})}var Uo={emptyDirSync:Di,emptydirSync:Di,emptyDir:ki,emptydir:ki};const Go=I.fromPromise,_i=A,nt=W,Ai=X;async function Ko(e){let t;try{t=await nt.stat(e)}catch{}if(t&&t.isFile())return;const i=_i.dirname(e);let r=null;try{r=await nt.stat(i)}catch(s){if(s.code==="ENOENT"){await Ai.mkdirs(i),await nt.writeFile(e,"");return}else throw s}r.isDirectory()?await nt.writeFile(e,""):await nt.readdir(i)}function qo(e){let t;try{t=nt.statSync(e)}catch{}if(t&&t.isFile())return;const i=_i.dirname(e);try{nt.statSync(i).isDirectory()||nt.readdirSync(i)}catch(r){if(r&&r.code==="ENOENT")Ai.mkdirsSync(i);else throw r}nt.writeFileSync(e,"")}var zo={createFile:Go(Ko),createFileSync:qo};const Zo=I.fromPromise,Ii=A,ht=W,Ni=X,{pathExists:Qo}=pt,{areIdentical:Ri}=Pt;async function Xo(e,t){let i;try{i=await ht.lstat(t)}catch{}let r;try{r=await ht.lstat(e)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(i&&Ri(r,i))return;const s=Ii.dirname(t);await Qo(s)||await Ni.mkdirs(s),await ht.link(e,t)}function ta(e,t){let i;try{i=ht.lstatSync(t)}catch{}try{const n=ht.lstatSync(e);if(i&&Ri(n,i))return}catch(n){throw n.message=n.message.replace("lstat","ensureLink"),n}const r=Ii.dirname(t);return ht.existsSync(r)||Ni.mkdirsSync(r),ht.linkSync(e,t)}var ea={createLink:Zo(Xo),createLinkSync:ta};const dt=A,Rt=W,{pathExists:ia}=pt,ra=I.fromPromise;async function sa(e,t){if(dt.isAbsolute(e)){try{await Rt.lstat(e)}catch(n){throw n.message=n.message.replace("lstat","ensureSymlink"),n}return{toCwd:e,toDst:e}}const i=dt.dirname(t),r=dt.join(i,e);if(await ia(r))return{toCwd:r,toDst:e};try{await Rt.lstat(e)}catch(n){throw n.message=n.message.replace("lstat","ensureSymlink"),n}return{toCwd:e,toDst:dt.relative(i,e)}}function na(e,t){if(dt.isAbsolute(e)){if(!Rt.existsSync(e))throw new Error("absolute srcpath does not exist");return{toCwd:e,toDst:e}}const i=dt.dirname(t),r=dt.join(i,e);if(Rt.existsSync(r))return{toCwd:r,toDst:e};if(!Rt.existsSync(e))throw new Error("relative srcpath does not exist");return{toCwd:e,toDst:dt.relative(i,e)}}var oa={symlinkPaths:ra(sa),symlinkPathsSync:na};const ji=W,aa=I.fromPromise;async function la(e,t){if(t)return t;let i;try{i=await ji.lstat(e)}catch{return"file"}return i&&i.isDirectory()?"dir":"file"}function ca(e,t){if(t)return t;let i;try{i=ji.lstatSync(e)}catch{return"file"}return i&&i.isDirectory()?"dir":"file"}var ua={symlinkType:aa(la),symlinkTypeSync:ca};const ha=I.fromPromise,Li=A,tt=W,{mkdirs:da,mkdirsSync:fa}=X,{symlinkPaths:ma,symlinkPathsSync:pa}=oa,{symlinkType:ya,symlinkTypeSync:wa}=ua,{pathExists:ga}=pt,{areIdentical:Ji}=Pt;async function va(e,t,i){let r;try{r=await tt.lstat(t)}catch{}if(r&&r.isSymbolicLink()){const[l,y]=await Promise.all([tt.stat(e),tt.stat(t)]);if(Ji(l,y))return}const s=await ma(e,t);e=s.toDst;const n=await ya(s.toCwd,i),o=Li.dirname(t);return await ga(o)||await da(o),tt.symlink(e,t,n)}function ba(e,t,i){let r;try{r=tt.lstatSync(t)}catch{}if(r&&r.isSymbolicLink()){const l=tt.statSync(e),y=tt.statSync(t);if(Ji(l,y))return}const s=pa(e,t);e=s.toDst,i=wa(s.toCwd,i);const n=Li.dirname(t);return tt.existsSync(n)||fa(n),tt.symlinkSync(e,t,i)}var Sa={createSymlink:ha(va),createSymlinkSync:ba};const{createFile:Yi,createFileSync:Bi}=zo,{createLink:Wi,createLinkSync:Vi}=ea,{createSymlink:Hi,createSymlinkSync:Ui}=Sa;var $a={createFile:Yi,createFileSync:Bi,ensureFile:Yi,ensureFileSync:Bi,createLink:Wi,createLinkSync:Vi,ensureLink:Wi,ensureLinkSync:Vi,createSymlink:Hi,createSymlinkSync:Ui,ensureSymlink:Hi,ensureSymlinkSync:Ui};function Ea(e,{EOL:t=` +`,finalEOL:i=!0,replacer:r=null,spaces:s}={}){const n=i?t:"";return JSON.stringify(e,r,s).replace(/\n/g,t)+n}function Pa(e){return Buffer.isBuffer(e)&&(e=e.toString("utf8")),e.replace(/^\uFEFF/,"")}var $e={stringify:Ea,stripBom:Pa};let xt;try{xt=bt}catch{xt=Fe}const Zt=I,{stringify:Gi,stripBom:Ki}=$e;async function xa(e,t={}){typeof t=="string"&&(t={encoding:t});const i=t.fs||xt,r="throws"in t?t.throws:!0;let s=await Zt.fromCallback(i.readFile)(e,t);s=Ki(s);let n;try{n=JSON.parse(s,t?t.reviver:null)}catch(o){if(r)throw o.message=`${e}: ${o.message}`,o;return null}return n}const Oa=Zt.fromPromise(xa);function Ta(e,t={}){typeof t=="string"&&(t={encoding:t});const i=t.fs||xt,r="throws"in t?t.throws:!0;try{let s=i.readFileSync(e,t);return s=Ki(s),JSON.parse(s,t.reviver)}catch(s){if(r)throw s.message=`${e}: ${s.message}`,s;return null}}async function Ca(e,t,i={}){const r=i.fs||xt,s=Gi(t,i);await Zt.fromCallback(r.writeFile)(e,s,i)}const Fa=Zt.fromPromise(Ca);function Ma(e,t,i={}){const r=i.fs||xt,s=Gi(t,i);return r.writeFileSync(e,s,i)}const ka={readFile:Oa,readFileSync:Ta,writeFile:Fa,writeFileSync:Ma};var Da=ka;const Qt=Da;var _a={readJson:Qt.readFile,readJsonSync:Qt.readFileSync,writeJson:Qt.writeFile,writeJsonSync:Qt.writeFileSync};const Aa=I.fromPromise,Ee=W,qi=A,zi=X,Ia=pt.pathExists;async function Na(e,t,i="utf-8"){const r=qi.dirname(e);return await Ia(r)||await zi.mkdirs(r),Ee.writeFile(e,t,i)}function Ra(e,...t){const i=qi.dirname(e);Ee.existsSync(i)||zi.mkdirsSync(i),Ee.writeFileSync(e,...t)}var Pe={outputFile:Aa(Na),outputFileSync:Ra};const{stringify:ja}=$e,{outputFile:La}=Pe;async function Ja(e,t,i={}){const r=ja(t,i);await La(e,r,i)}var Ya=Ja;const{stringify:Ba}=$e,{outputFileSync:Wa}=Pe;function Va(e,t,i){const r=Ba(t,i);Wa(e,r,i)}var Ha=Va;const Ua=I.fromPromise,H=_a;H.outputJson=Ua(Ya),H.outputJsonSync=Ha,H.outputJSON=H.outputJson,H.outputJSONSync=H.outputJsonSync,H.writeJSON=H.writeJson,H.writeJSONSync=H.writeJsonSync,H.readJSON=H.readJson,H.readJSONSync=H.readJsonSync;var Ga=H;const Ka=W,Zi=A,{copy:qa}=Se,{remove:Qi}=zt,{mkdirp:za}=X,{pathExists:Za}=pt,Xi=Pt;async function Qa(e,t,i={}){const r=i.overwrite||i.clobber||!1,{srcStat:s,isChangingCase:n=!1}=await Xi.checkPaths(e,t,"move",i);await Xi.checkParentPaths(e,s,t,"move");const o=Zi.dirname(t);return Zi.parse(o).root!==o&&await za(o),Xa(e,t,r,n)}async function Xa(e,t,i,r){if(!r){if(i)await Qi(t);else if(await Za(t))throw new Error("dest already exists.")}try{await Ka.rename(e,t)}catch(s){if(s.code!=="EXDEV")throw s;await tl(e,t,i)}}async function tl(e,t,i){return await qa(e,t,{overwrite:i,errorOnExist:!0,preserveTimestamps:!0}),Qi(e)}var el=Qa;const tr=bt,xe=A,il=Se.copySync,er=zt.removeSync,rl=X.mkdirpSync,ir=Pt;function sl(e,t,i){i=i||{};const r=i.overwrite||i.clobber||!1,{srcStat:s,isChangingCase:n=!1}=ir.checkPathsSync(e,t,"move",i);return ir.checkParentPathsSync(e,s,t,"move"),nl(t)||rl(xe.dirname(t)),ol(e,t,r,n)}function nl(e){const t=xe.dirname(e);return xe.parse(t).root===t}function ol(e,t,i,r){if(r)return Oe(e,t,i);if(i)return er(t),Oe(e,t,i);if(tr.existsSync(t))throw new Error("dest already exists.");return Oe(e,t,i)}function Oe(e,t,i){try{tr.renameSync(e,t)}catch(r){if(r.code!=="EXDEV")throw r;return al(e,t,i)}}function al(e,t,i){return il(e,t,{overwrite:i,errorOnExist:!0,preserveTimestamps:!0}),er(e)}var ll=sl;const cl=I.fromPromise;var ul={move:cl(el),moveSync:ll},hl={...W,...Se,...Uo,...$a,...Ga,...X,...ul,...Pe,...pt,...zt};const ot=ee(hl);let yt=!0;const Ot=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let jt=0;if(Ot.process&&Ot.process.env&&Ot.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:i,TERM:r,COLORTERM:s}=Ot.process.env;t||i||e==="0"?yt=!1:e==="1"||e==="2"||e==="3"?yt=!0:r==="dumb"?yt=!1:"CI"in Ot.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(n=>n in Ot.process.env)?yt=!0:yt=process.stdout.isTTY,yt&&(process.platform==="win32"||s&&(s==="truecolor"||s==="24bit")?jt=3:r&&(r.endsWith("-256color")||r.endsWith("256"))?jt=2:jt=1)}let rr={enabled:yt,supportLevel:jt};function Te(e,t,i=1){const r=`\x1B[${e}m`,s=`\x1B[${t}m`,n=new RegExp(`\\x1b\\[${t}m`,"g");return o=>rr.enabled&&rr.supportLevel>=i?r+(""+o).replace(n,r)+s:""+o}const Tt=Te(31,39),dl=Te(32,39),Lt=Te(36,39),sr="18.0.0",nr="7.0.0",fl=gr(br),U=Bn(process.argv.slice(2),{string:["_"]}),or="vueform-project",ar=bl(process.env.npm_config_user_agent),wt=ar?ar.name:"npm",ml=A.dirname(Er(import.meta.url)),pl=!!U.start||!!U.s,lr=!!U.force||!!U.f,cr=[{title:"Vite",value:"vite",command:{npm:"npm create vite@latest %PROJECT_NAME% -- --template %TEMPLATE%",yarn:"yarn create vite %PROJECT_NAME% --template %TEMPLATE%",pnpm:"pnpm create vite %PROJECT_NAME% --template %TEMPLATE%",bun:"bun create vite %PROJECT_NAME% --template %TEMPLATE%"}},{title:"Nuxt",value:"nuxt",command:{npm:"npx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%",yarn:"npx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%",pnpm:"pnpm dlx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%",bun:"bunx nuxi@latest init %PROJECT_NAME% --packageManager=%PACKAGE_MANAGER%"}},{title:"Astro",value:"astro",command:{npm:"npm create astro@latest %PROJECT_NAME% -- --install=yes",yarn:"yarn create astro %PROJECT_NAME% --install=yes",pnpm:"pnpm create astro %PROJECT_NAME% --install=yes",bun:"bun create astro %PROJECT_NAME% --install=yes"}},{title:"Laravel",value:"laravel",command:"%COMPOSER_PATH% create-project laravel/laravel %PROJECT_NAME%"}],yl=[{title:"Vueform",value:"vueform"},{title:"Tailwind",value:"tailwind"},{title:"Bootstrap",value:"bootstrap"},{title:"Material",value:"material"},{title:"Tailwind Material",value:"tailwind-material"}],wl={vite:{install:["npm install -D tailwindcss postcss autoprefixer"]},nuxt:{install:["npm install -D @nuxtjs/tailwindcss"]},astro:{install:["npm install @astrojs/tailwind tailwindcss"]},laravel:{install:["npm install -D tailwindcss postcss autoprefixer"]}};process.env.PATH+=":/usr/local/bin",Ol();async function gl(){try{const{projectName:e}=await si({type:"text",name:"projectName",initial:or,message:"Choose a project name:",validate:async m=>/^[a-zA-Z0-9]+[a-zA-Z0-9-_]*$/.test(m)?!lr&&await ur(m)?`The directory '${m}' already exists.`:m?!0:"Please provide a project name":"Invalid project name. Use only alphanumeric, underscore, and hyphen characters and do not start with a hyphen or underscore."},{onCancel:()=>{throw new Error(Tt("\u2716")+" Operation cancelled")}});lr&&await ur(A.join(process.cwd(),e))&&await z("rm",["-r",or]);const t=await si([{type:U.builder||U.b?null:"select",name:"builder",message:"Which libraries do you want to install?",choices:[{title:"Vueform",value:"vueform"},{title:"Vueform + Builder",value:"builder"}]},{type:m=>U.builder||U.b||m==="builder"?"text":null,name:"publicKey",initial:U.publicKey||U.pk||"obtain a FREE one at https://app.vueform.com",message:"Your Public Key: ",validate:async m=>/^[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}$/.test(m)?m?!0:"Please provide your Public Key. If you don't have one go to https://app.vueform.com and generate one for FREE.":"Invalid Public Key. Please go to https://app.vueform.com and generate one for FREE."},{type:"select",name:"framework",message:"Choose a framework:",choices:cr},{type:m=>m!=="vite"||m==="laravel"?null:"toggle",name:"ts",message:"Do you plan to use TypeScript?",initial:"yes",active:"yes",inactive:"no"},{type:(m,{builder:v})=>U.builder||U.b||v==="builder"?null:"select",name:"theme",message:"Select a theme for your project:",choices:yl}],{onCancel:()=>{throw new Error(Tt("\u2716")+" Operation cancelled")}}),{framework:i,ts:r,publicKey:s}=t,n=!!U.builder||!!U.b||t.builder==="builder",o=n?"tailwind":t.theme,l=i==="astro",y=["tailwind","tailwind-material"].indexOf(o)!==-1||n,d=["bootstrap"].indexOf(o)!==-1,a=i==="laravel";if(e&&i){const m=vl(i);Xt(` +Creating project '${e}' using ${m.title}...`);const v=i==="vite"?`vue${r?"-ts":""}`:"";let b="";i==="laravel"&&(b=await xl());let T=typeof m.command=="string"?m.command:m.command[wt];T=T.replace("%PROJECT_NAME%",e).replace("%TEMPLATE%",v).replace("%PACKAGE_MANAGER%",wt).replace("%COMPOSER_PATH%",b).split(" "),await z(T[0],T.slice(1),`create project with ${m.title}`)}else{console.error("Project creation canceled.");return}if(!o){console.error("Project creation canceled.");return}process.chdir(e);const h=await Sl(process.cwd(),i,r),c=A.join(ml,"../","templates",n?"builder":"vueform",i,o,h?"ts":"js"),u=process.cwd();Xt(` +Installing dependencies...`),await z("npm",["install"],"install dependencies"),y&&(Xt(` Installing Tailwind...`),await Promise.all(wl[i].install.map(async m=>{const v=m.split(" ");await z(v[0],v.slice(1),"install Tailwind CSS")}))),d&&(console.log(` Installing Bootstrap...`),await z("npm",["install","bootstrap"],"install Bootstrap")),l&&(console.log(` Installing Vue...`),await z("npm",["install","vue","@astrojs/vue"],"install Vue in Astro"),await $l(process.cwd())),a&&(console.log(` -Installing Vue...`),await z("npm",["install","@vitejs/plugin-vue"],"install Vue in Laravel"));const f=n?i==="nuxt"?"@vueform/builder-nuxt":"@vueform/vueform @vueform/builder":i==="nuxt"?"@vueform/nuxt":"@vueform/vueform";Qt(` +Installing Vue...`),await z("npm",["install","@vitejs/plugin-vue"],"install Vue in Laravel"));const f=n?i==="nuxt"?"@vueform/builder-nuxt":"@vueform/vueform @vueform/builder":i==="nuxt"?"@vueform/nuxt":"@vueform/vueform";Xt(` Installing Vueform${n?" Builder":""}...`),await z("npm",["install",...f.split(" ")],`install ${f}`),await Pl(c,u),n&&await El(process.cwd(),s),console.log(dl(` -\u2714 Installation finished`)),console.log(Te(` -cd ${e}`)),console.log(Te(`${Tt} run dev -`)),pl&&(a?(await z("npm",["run","build"]),await z("php",["artisan","serve"])):await z("npm",["run","dev"]))}catch(e){console.log(Ot(e.message));return}}function vl(e){return cr.find(t=>t.value===e)}function bl(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}function z(e,t,i=""){return e==="npm"&&(e=["npm","yarn","pnpm","bun"].indexOf(Tt)!==-1?Tt:"npm",t[0]==="install"&&t.length>1&&["yarn","pnpm"].indexOf(Tt)!==-1&&(t=[...t],t[0]="add")),/^win/.test(process.platform)&&e==="rm"&&(e="rmdir",t=["/s","/q",...t.slice(1)]),new Promise((r,s)=>{const n=$r(e,t,{stdio:"inherit",shell:!0});n.on("close",o=>{o!==0?s(new Error(`${e} exited with code ${o}`)):r()}),n.on("error",o=>{s(new Error(`Failed to ${i||"start process"}: ${o.message}`))})})}function Qt(e){return console.log(Te(e))}async function ur(e){try{return(await mr.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Sl(e,t,i){switch(t){case"nuxt":return!0;case"astro":const r=A.join(e,"tsconfig.json");try{return(await ot.readJson(r)).extends!=="astro/tsconfigs/base"}catch(s){throw new Error(`Error reading tsconfig.json: ${s.message}`)}break;case"laravel":return!1;default:return i}}async function $l(e){const t=A.join(e,"tsconfig.json");try{const i=await ot.readJson(t);i.compilerOptions={jsx:"preserve"},await ot.writeJson(t,i,{spaces:2})}catch(i){throw new Error(`Error updating tsconfig.json: ${i.message}`)}}async function El(e,t){const i=A.join(e,"vueform.config.js"),r=A.join(e,"vueform.config.ts");let s;try{if(await ot.pathExists(i))s=i;else if(await ot.pathExists(r))s=r;else throw new Error(`No vueform.config.js or vueform.config.ts file found: ${err.message}`)}catch(n){throw new Error(`Error checking for config files: ${n.message}`)}try{let n=await ot.readFile(s,"utf8");n=n.replace(/YOUR_PUBLIC_KEY/g,t),await ot.writeFile(s,n,"utf8")}catch(n){throw new Error(`Error inserting Public Key to ${A.basename(s)}: ${n.message}`)}}async function Pl(e,t){try{await ot.copy(e,t,{overwrite:!0})}catch(i){throw new Error(`Error copying files: ${i.message}`)}}async function xl(){const e=["/usr/local/bin/composer","/usr/local/bin/composer.phar","/usr/bin/composer","/usr/bin/composer.phar","C:\\ProgramData\\ComposerSetup\\bin\\composer","C:\\ProgramData\\ComposerSetup\\bin\\composer.phar","C:\\Program Files\\Composer\\composer.phar","C:\\Program Files\\Composer\\composer"];let t="composer";try{return await fl("composer --version"),t}catch{t=""}if(e.forEach(i=>{ot.existsSync(i)&&(t=i)}),t.endsWith(".phar")&&(t=`php ${t}`),!t)throw console.error(Ot(` -Composer not found. Please ensure Composer is installed and added to your PATH.`)),console.error(Ot(`Visit https://getcomposer.org/download/ for installation instructions. -`)),new Error(Ot("\u2716")+" Operation cancelled");return t}function Ol(){const e=process.version.replace("v",""),t=Sr("npm -v").toString().trim();hr(e,sr)<0&&(console.error(`Error: Minimum Node.js version required is ${sr}. Your current version is ${e}. Please upgrade Node.js.`),process.exit(1)),hr(t,nr)<0&&(console.error(`Error: Minimum npm version required is ${nr}. Your current version is ${t}. Please upgrade npm.`),process.exit(1))}function hr(e,t){const i=e.split(".").map(Number),r=t.split(".").map(Number);for(let s=0;s<3;s++)if(i[s]!==r[s])return i[s]-r[s];return 0}gl(); +\u2714 Installation finished`)),console.log(Lt(` +cd ${e}`)),a?(console.log(Lt(`${wt} run build +`)),console.log(Lt(`php artisan serve +`))):console.log(Lt(`${wt} run dev +`)),pl&&(a?(await z("npm",["run","build"]),await z("php",["artisan","serve"])):await z("npm",["run","dev"]))}catch(e){console.log(Tt(e.message));return}}function vl(e){return cr.find(t=>t.value===e)}function bl(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}function z(e,t,i=""){return e==="npm"&&(e=["npm","yarn","pnpm","bun"].indexOf(wt)!==-1?wt:"npm",t[0]==="install"&&t.length>1&&["yarn","pnpm"].indexOf(wt)!==-1&&(t=[...t],t[0]="add")),/^win/.test(process.platform)&&e==="rm"&&(e="rmdir",t=["/s","/q",...t.slice(1)]),new Promise((r,s)=>{const n=$r(e,t,{stdio:"inherit",shell:!0});n.on("close",o=>{o!==0?s(new Error(`${e} exited with code ${o}`)):r()}),n.on("error",o=>{s(new Error(`Failed to ${i||"start process"}: ${o.message}`))})})}function Xt(e){return console.log(Lt(e))}async function ur(e){try{return(await mr.stat(e)).isDirectory()}catch(t){if(t.code==="ENOENT")return!1;throw t}}async function Sl(e,t,i){switch(t){case"nuxt":return!0;case"astro":const r=A.join(e,"tsconfig.json");try{return(await ot.readJson(r)).extends!=="astro/tsconfigs/base"}catch(s){throw new Error(`Error reading tsconfig.json: ${s.message}`)}break;case"laravel":return!1;default:return i}}async function $l(e){const t=A.join(e,"tsconfig.json");try{const i=await ot.readJson(t);i.compilerOptions={jsx:"preserve"},await ot.writeJson(t,i,{spaces:2})}catch(i){throw new Error(`Error updating tsconfig.json: ${i.message}`)}}async function El(e,t){const i=A.join(e,"vueform.config.js"),r=A.join(e,"vueform.config.ts");let s;try{if(await ot.pathExists(i))s=i;else if(await ot.pathExists(r))s=r;else throw new Error(`No vueform.config.js or vueform.config.ts file found: ${err.message}`)}catch(n){throw new Error(`Error checking for config files: ${n.message}`)}try{let n=await ot.readFile(s,"utf8");n=n.replace(/YOUR_PUBLIC_KEY/g,t),await ot.writeFile(s,n,"utf8")}catch(n){throw new Error(`Error inserting Public Key to ${A.basename(s)}: ${n.message}`)}}async function Pl(e,t){try{await ot.copy(e,t,{overwrite:!0})}catch(i){throw new Error(`Error copying files: ${i.message}`)}}async function xl(){const e=["/usr/local/bin/composer","/usr/local/bin/composer.phar","/usr/bin/composer","/usr/bin/composer.phar","C:\\ProgramData\\ComposerSetup\\bin\\composer","C:\\ProgramData\\ComposerSetup\\bin\\composer.phar","C:\\Program Files\\Composer\\composer.phar","C:\\Program Files\\Composer\\composer"];let t="composer";try{return await fl("composer --version"),t}catch{t=""}if(e.forEach(i=>{ot.existsSync(i)&&(t=i)}),t.endsWith(".phar")&&(t=`php ${t}`),!t)throw console.error(Tt(` +Composer not found. Please ensure Composer is installed and added to your PATH.`)),console.error(Tt(`Visit https://getcomposer.org/download/ for installation instructions. +`)),new Error(Tt("\u2716")+" Operation cancelled");return t}function Ol(){const e=process.version.replace("v",""),t=Sr("npm -v").toString().trim();hr(e,sr)<0&&(console.error(`Error: Minimum Node.js version required is ${sr}. Your current version is ${e}. Please upgrade Node.js.`),process.exit(1)),hr(t,nr)<0&&(console.error(`Error: Minimum npm version required is ${nr}. Your current version is ${t}. Please upgrade npm.`),process.exit(1))}function hr(e,t){const i=e.split(".").map(Number),r=t.split(".").map(Number);for(let s=0;s<3;s++)if(i[s]!==r[s])return i[s]-r[s];return 0}gl(); diff --git a/package.json b/package.json index cf27a2e..1787cc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-vueform", - "version": "1.0.11", + "version": "1.0.12", "type": "module", "license": "MIT", "author": "Adam Berecz",