create-bc-app 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,49 +1,49 @@
1
- import y from"fs";import O from"path";import{fileURLToPath as re}from"url";import ne from"readline";import oe from"events";function vt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var bt={};const{FORCE_COLOR:le,NODE_DISABLE_COLORS:he,TERM:ae}=process.env,d={enabled:!he&&ae!=="dumb"&&le!=="0",reset:m(0,0),bold:m(1,22),dim:m(2,22),italic:m(3,23),underline:m(4,24),inverse:m(7,27),hidden:m(8,28),strikethrough:m(9,29),black:m(30,39),red:m(31,39),green:m(32,39),yellow:m(33,39),blue:m(34,39),magenta:m(35,39),cyan:m(36,39),white:m(37,39),gray:m(90,39),grey:m(90,39),bgBlack:m(40,49),bgRed:m(41,49),bgGreen:m(42,49),bgYellow:m(43,49),bgBlue:m(44,49),bgMagenta:m(45,49),bgCyan:m(46,49),bgWhite:m(47,49)};function wt(s,t){let e=0,i,n="",o="";for(;e<s.length;e++)i=s[e],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function ue(s,t){let e={has:s,keys:t};return e.reset=d.reset.bind(e),e.bold=d.bold.bind(e),e.dim=d.dim.bind(e),e.italic=d.italic.bind(e),e.underline=d.underline.bind(e),e.inverse=d.inverse.bind(e),e.hidden=d.hidden.bind(e),e.strikethrough=d.strikethrough.bind(e),e.black=d.black.bind(e),e.red=d.red.bind(e),e.green=d.green.bind(e),e.yellow=d.yellow.bind(e),e.blue=d.blue.bind(e),e.magenta=d.magenta.bind(e),e.cyan=d.cyan.bind(e),e.white=d.white.bind(e),e.gray=d.gray.bind(e),e.grey=d.grey.bind(e),e.bgBlack=d.bgBlack.bind(e),e.bgRed=d.bgRed.bind(e),e.bgGreen=d.bgGreen.bind(e),e.bgYellow=d.bgYellow.bind(e),e.bgBlue=d.bgBlue.bind(e),e.bgMagenta=d.bgMagenta.bind(e),e.bgCyan=d.bgCyan.bind(e),e.bgWhite=d.bgWhite.bind(e),e}function m(s,t){let e={open:`\x1B[${s}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(s)||(this.has.push(s),this.keys.push(e)),i===void 0?this:d.enabled?wt(this.keys,i+""):i+""):i===void 0?ue([s],[e]):d.enabled?wt([e],i+""):i+""}}var M=d,ce=(s,t)=>{if(!(s.meta&&s.name!=="escape")){if(s.ctrl){if(s.name==="a")return"first";if(s.name==="c"||s.name==="d")return"abort";if(s.name==="e")return"last";if(s.name==="g")return"reset"}if(t){if(s.name==="j")return"down";if(s.name==="k")return"up"}return s.name==="return"||s.name==="enter"?"submit":s.name==="backspace"?"delete":s.name==="delete"?"deleteForward":s.name==="abort"?"abort":s.name==="escape"?"exit":s.name==="tab"?"next":s.name==="pagedown"?"nextPage":s.name==="pageup"?"prevPage":s.name==="home"?"home":s.name==="end"?"end":s.name==="up"?"up":s.name==="down"?"down":s.name==="right"?"right":s.name==="left"?"left":!1}},it=s=>{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("|"),e=new RegExp(t,"g");return typeof s=="string"?s.replace(e,""):s};const rt="\x1B",b=`${rt}[`,de="\x07",nt={to(s,t){return t?`${b}${t+1};${s+1}H`:`${b}${s+1}G`},move(s,t){let e="";return s<0?e+=`${b}${-s}D`:s>0&&(e+=`${b}${s}C`),t<0?e+=`${b}${-t}A`:t>0&&(e+=`${b}${t}B`),e},up:(s=1)=>`${b}${s}A`,down:(s=1)=>`${b}${s}B`,forward:(s=1)=>`${b}${s}C`,backward:(s=1)=>`${b}${s}D`,nextLine:(s=1)=>`${b}E`.repeat(s),prevLine:(s=1)=>`${b}F`.repeat(s),left:`${b}G`,hide:`${b}?25l`,show:`${b}?25h`,save:`${rt}7`,restore:`${rt}8`},fe={up:(s=1)=>`${b}S`.repeat(s),down:(s=1)=>`${b}T`.repeat(s)},pe={screen:`${b}2J`,up:(s=1)=>`${b}1J`.repeat(s),down:(s=1)=>`${b}J`.repeat(s),line:`${b}2K`,lineEnd:`${b}K`,lineStart:`${b}1K`,lines(s){let t="";for(let e=0;e<s;e++)t+=this.line+(e<s-1?nt.up():"");return s&&(t+=nt.left),t}};var P={cursor:nt,scroll:fe,erase:pe,beep:de};const me=it,{erase:$t,cursor:ge}=P,ve=s=>[...me(s)].length;var be=function(s,t){if(!t)return $t.line+ge.to(0);let e=0;const i=s.split(/\r?\n/);for(let n of i)e+=1+Math.floor(Math.max(ve(n)-1,0)/t);return $t.lines(e)};const J={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},we={arrowUp:J.arrowUp,arrowDown:J.arrowDown,arrowLeft:J.arrowLeft,arrowRight:J.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},$e=process.platform==="win32"?we:J;var yt=$e;const H=M,Y=yt,ot=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),ye=s=>ot[s]||ot.default,k=Object.freeze({aborted:H.red(Y.cross),done:H.green(Y.tick),exited:H.yellow(Y.cross),default:H.cyan("?")}),xe=(s,t,e)=>t?k.aborted:e?k.exited:s?k.done:k.default,Se=s=>H.gray(s?Y.ellipsis:Y.pointerSmall),Oe=(s,t)=>H.gray(s?t?Y.pointerSmall:"+":Y.line);var Me={styles:ot,render:ye,symbols:k,symbol:xe,delimiter:Se,item:Oe};const Pe=it;var Te=function(s,t){let e=String(Pe(s)||"").split(/\r?\n/);return t?e.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):e.length},Ce=(s,t={})=>{const e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(s||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+e.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${e}${r}`),o),[e]).join(`
1
+ import S from"fs";import O from"path";import{fileURLToPath as oe}from"url";import le from"readline";import he from"events";import vt from"handlebars";function bt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var wt={};const{FORCE_COLOR:ae,NODE_DISABLE_COLORS:ue,TERM:ce}=process.env,d={enabled:!ue&&ce!=="dumb"&&ae!=="0",reset:g(0,0),bold:g(1,22),dim:g(2,22),italic:g(3,23),underline:g(4,24),inverse:g(7,27),hidden:g(8,28),strikethrough:g(9,29),black:g(30,39),red:g(31,39),green:g(32,39),yellow:g(33,39),blue:g(34,39),magenta:g(35,39),cyan:g(36,39),white:g(37,39),gray:g(90,39),grey:g(90,39),bgBlack:g(40,49),bgRed:g(41,49),bgGreen:g(42,49),bgYellow:g(43,49),bgBlue:g(44,49),bgMagenta:g(45,49),bgCyan:g(46,49),bgWhite:g(47,49)};function $t(s,t){let e=0,i,n="",o="";for(;e<s.length;e++)i=s[e],n+=i.open,o+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return n+t+o}function de(s,t){let e={has:s,keys:t};return e.reset=d.reset.bind(e),e.bold=d.bold.bind(e),e.dim=d.dim.bind(e),e.italic=d.italic.bind(e),e.underline=d.underline.bind(e),e.inverse=d.inverse.bind(e),e.hidden=d.hidden.bind(e),e.strikethrough=d.strikethrough.bind(e),e.black=d.black.bind(e),e.red=d.red.bind(e),e.green=d.green.bind(e),e.yellow=d.yellow.bind(e),e.blue=d.blue.bind(e),e.magenta=d.magenta.bind(e),e.cyan=d.cyan.bind(e),e.white=d.white.bind(e),e.gray=d.gray.bind(e),e.grey=d.grey.bind(e),e.bgBlack=d.bgBlack.bind(e),e.bgRed=d.bgRed.bind(e),e.bgGreen=d.bgGreen.bind(e),e.bgYellow=d.bgYellow.bind(e),e.bgBlue=d.bgBlue.bind(e),e.bgMagenta=d.bgMagenta.bind(e),e.bgCyan=d.bgCyan.bind(e),e.bgWhite=d.bgWhite.bind(e),e}function g(s,t){let e={open:`\x1B[${s}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(s)||(this.has.push(s),this.keys.push(e)),i===void 0?this:d.enabled?$t(this.keys,i+""):i+""):i===void 0?de([s],[e]):d.enabled?$t([e],i+""):i+""}}var P=d,fe=(s,t)=>{if(!(s.meta&&s.name!=="escape")){if(s.ctrl){if(s.name==="a")return"first";if(s.name==="c"||s.name==="d")return"abort";if(s.name==="e")return"last";if(s.name==="g")return"reset"}if(t){if(s.name==="j")return"down";if(s.name==="k")return"up"}return s.name==="return"||s.name==="enter"?"submit":s.name==="backspace"?"delete":s.name==="delete"?"deleteForward":s.name==="abort"?"abort":s.name==="escape"?"exit":s.name==="tab"?"next":s.name==="pagedown"?"nextPage":s.name==="pageup"?"prevPage":s.name==="home"?"home":s.name==="end"?"end":s.name==="up"?"up":s.name==="down"?"down":s.name==="right"?"right":s.name==="left"?"left":!1}},it=s=>{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("|"),e=new RegExp(t,"g");return typeof s=="string"?s.replace(e,""):s};const rt="\x1B",v=`${rt}[`,pe="\x07",nt={to(s,t){return t?`${v}${t+1};${s+1}H`:`${v}${s+1}G`},move(s,t){let e="";return s<0?e+=`${v}${-s}D`:s>0&&(e+=`${v}${s}C`),t<0?e+=`${v}${-t}A`:t>0&&(e+=`${v}${t}B`),e},up:(s=1)=>`${v}${s}A`,down:(s=1)=>`${v}${s}B`,forward:(s=1)=>`${v}${s}C`,backward:(s=1)=>`${v}${s}D`,nextLine:(s=1)=>`${v}E`.repeat(s),prevLine:(s=1)=>`${v}F`.repeat(s),left:`${v}G`,hide:`${v}?25l`,show:`${v}?25h`,save:`${rt}7`,restore:`${rt}8`},me={up:(s=1)=>`${v}S`.repeat(s),down:(s=1)=>`${v}T`.repeat(s)},ge={screen:`${v}2J`,up:(s=1)=>`${v}1J`.repeat(s),down:(s=1)=>`${v}J`.repeat(s),line:`${v}2K`,lineEnd:`${v}K`,lineStart:`${v}1K`,lines(s){let t="";for(let e=0;e<s;e++)t+=this.line+(e<s-1?nt.up():"");return s&&(t+=nt.left),t}};var T={cursor:nt,scroll:me,erase:ge,beep:pe};const ve=it,{erase:yt,cursor:be}=T,we=s=>[...ve(s)].length;var $e=function(s,t){if(!t)return yt.line+be.to(0);let e=0;const i=s.split(/\r?\n/);for(let n of i)e+=1+Math.floor(Math.max(we(n)-1,0)/t);return yt.lines(e)};const G={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},ye={arrowUp:G.arrowUp,arrowDown:G.arrowDown,arrowLeft:G.arrowLeft,arrowRight:G.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Se=process.platform==="win32"?ye:G;var St=Se;const U=P,V=St,ot=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),xe=s=>ot[s]||ot.default,K=Object.freeze({aborted:U.red(V.cross),done:U.green(V.tick),exited:U.yellow(V.cross),default:U.cyan("?")}),Oe=(s,t,e)=>t?K.aborted:e?K.exited:s?K.done:K.default,Me=s=>U.gray(s?V.ellipsis:V.pointerSmall),Pe=(s,t)=>U.gray(s?t?V.pointerSmall:"+":V.line);var Te={styles:ot,render:xe,symbols:K,symbol:Oe,delimiter:Me,item:Pe};const Ce=it;var De=function(s,t){let e=String(Ce(s)||"").split(/\r?\n/);return t?e.map(i=>Math.ceil(i.length/t)).reduce((i,n)=>i+n):e.length},Ee=(s,t={})=>{const e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(s||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((o,r)=>(r.length+e.length>=i||o[o.length-1].length+r.length+1<i?o[o.length-1]+=` ${r}`:o.push(`${e}${r}`),o),[e]).join(`
2
2
  `)).join(`
3
- `)},De=(s,t,e)=>{e=e||t;let i=Math.min(t-e,s-Math.floor(e/2));i<0&&(i=0);let n=Math.min(i+e,t);return{startIndex:i,endIndex:n}},D={action:ce,clear:be,style:Me,strip:it,figures:yt,lines:Te,wrap:Ce,entriesToDisplay:De};const xt=ne,{action:Ee}=D,Ie=oe,{beep:_e,cursor:Re}=P,Ae=M;let je=class extends Ie{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 e=xt.createInterface({input:this.in,escapeCodeTimeout:50});xt.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(o,r)=>{let l=Ee(r,i);l===!1?this._&&this._(o,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(Re.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(_e)}render(){this.onRender(Ae),this.firstRender&&(this.firstRender=!1)}};var F=je;const q=M,Fe=F,{erase:Le,cursor:G}=P,{style:lt,clear:ht,lines:Ne,figures:Ye}=D;class Ve extends Fe{constructor(t={}){super(t),this.transform=lt.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=ht("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=q.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(`
3
+ `)},Ie=(s,t,e)=>{e=e||t;let i=Math.min(t-e,s-Math.floor(e/2));i<0&&(i=0);let n=Math.min(i+e,t);return{startIndex:i,endIndex:n}},E={action:fe,clear:$e,style:Te,strip:it,figures:St,lines:De,wrap:Ee,entriesToDisplay:Ie};const xt=le,{action:_e}=E,Re=he,{beep:Ae,cursor:je}=T,Fe=P;let Le=class extends Re{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 e=xt.createInterface({input:this.in,escapeCodeTimeout:50});xt.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(o,r)=>{let l=_e(r,i);l===!1?this._&&this._(o,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(je.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",n)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ae)}render(){this.onRender(Fe),this.firstRender&&(this.firstRender=!1)}};var L=Le;const X=P,Ne=L,{erase:He,cursor:W}=T,{style:lt,clear:ht,lines:Ye,figures:Ve}=E;class Be extends Ne{constructor(t={}){super(t),this.transform=lt.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=ht("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=X.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(`
4
4
  `),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(`
5
- `),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,e){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(G.down(Ne(this.outputError,this.out.columns)-1)+ht(this.outputError,this.out.columns)),this.out.write(ht(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[lt.symbol(this.done,this.aborted),q.bold(this.msg),lt.delimiter(this.done),this.red?q.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
5
+ `),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,e){let i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor);this.value=`${i}${t}${n}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,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),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,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(W.down(Ye(this.outputError,this.out.columns)-1)+ht(this.outputError,this.out.columns)),this.out.write(ht(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[lt.symbol(this.done,this.aborted),X.bold(this.msg),lt.delimiter(this.done),this.red?X.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
6
6
  `).reduce((t,e,i)=>t+`
7
- ${i?" ":Ye.pointerSmall} ${q.red().italic(e)}`,"")),this.out.write(Le.line+G.to(0)+this.outputText+G.save+this.outputError+G.restore+G.move(this.cursorOffset,0)))}}var He=Ve;const R=M,Be=F,{style:St,clear:Ot,figures:X,wrap:Ue,entriesToDisplay:ze}=D,{cursor:Je}=P;class ke extends Be{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((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?i:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Ot("",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(`
7
+ ${i?" ":Ve.pointerSmall} ${X.red().italic(e)}`,"")),this.out.write(He.line+W.to(0)+this.outputText+W.save+this.outputError+W.restore+W.move(this.cursorOffset,0)))}}var Ue=Be;const A=P,ze=L,{style:Ot,clear:Mt,figures:Q,wrap:Je,entriesToDisplay:ke}=E,{cursor:Ge}=T;class Ke extends ze{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((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),value:e&&(e.value===void 0?i:e.value),description:e&&e.description,selected:e&&e.selected,disabled:e&&e.disabled})),this.optionsPerPage=t.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=Mt("",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(`
8
8
  `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
9
- `),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,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Je.hide):this.out.write(Ot(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ze(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[St.symbol(this.done,this.aborted),R.bold(this.msg),St.delimiter(!1),this.done?this.selection.title:this.selection.disabled?R.yellow(this.warn):R.gray(this.hint)].join(" "),!this.done){this.outputText+=`
10
- `;for(let i=t;i<e;i++){let n,o,r="",l=this.choices[i];i===t&&t>0?o=X.arrowUp:i===e-1&&e<this.choices.length?o=X.arrowDown:o=" ",l.disabled?(n=this.cursor===i?R.gray().underline(l.title):R.strikethrough().gray(l.title),o=(this.cursor===i?R.bold().gray(X.pointer)+" ":" ")+o):(n=this.cursor===i?R.cyan().underline(l.title):l.title,o=(this.cursor===i?R.cyan(X.pointer)+" ":" ")+o,l.description&&this.cursor===i&&(r=` - ${l.description}`,(o.length+n.length+r.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(r=`
11
- `+Ue(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${R.gray(r)}
12
- `}}this.out.write(this.outputText)}}var Ge=ke;const Q=M,Ke=F,{style:Mt,clear:We}=D,{cursor:Pt,erase:Ze}=P;class qe extends Ke{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(`
9
+ `),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,e){if(t===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Ge.hide):this.out.write(Mt(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ke(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[Ot.symbol(this.done,this.aborted),A.bold(this.msg),Ot.delimiter(!1),this.done?this.selection.title:this.selection.disabled?A.yellow(this.warn):A.gray(this.hint)].join(" "),!this.done){this.outputText+=`
10
+ `;for(let i=t;i<e;i++){let n,o,r="",l=this.choices[i];i===t&&t>0?o=Q.arrowUp:i===e-1&&e<this.choices.length?o=Q.arrowDown:o=" ",l.disabled?(n=this.cursor===i?A.gray().underline(l.title):A.strikethrough().gray(l.title),o=(this.cursor===i?A.bold().gray(Q.pointer)+" ":" ")+o):(n=this.cursor===i?A.cyan().underline(l.title):l.title,o=(this.cursor===i?A.cyan(Q.pointer)+" ":" ")+o,l.description&&this.cursor===i&&(r=` - ${l.description}`,(o.length+n.length+r.length>=this.out.columns||l.description.split(/\r?\n/).length>1)&&(r=`
11
+ `+Je(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${n}${A.gray(r)}
12
+ `}}this.out.write(this.outputText)}}var We=Ke;const tt=P,Ze=L,{style:Pt,clear:qe}=E,{cursor:Tt,erase:Xe}=T;class Qe extends Ze{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(`
13
13
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
14
- `),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,e){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(Pt.hide):this.out.write(We(this.outputText,this.out.columns)),super.render(),this.outputText=[Mt.symbol(this.done,this.aborted),Q.bold(this.msg),Mt.delimiter(this.done),this.value?this.inactive:Q.cyan().underline(this.inactive),Q.gray("/"),this.value?Q.cyan().underline(this.active):this.active].join(" "),this.out.write(Ze.line+Pt.to(0)+this.outputText))}}var Xe=qe;let Qe=class gt{constructor({token:t,date:e,parts:i,locales:n}){this.token=t,this.date=e||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,i)=>i>t&&e instanceof gt)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((i,n)=>n>e&&i instanceof gt)}toString(){return String(this.date)}};var A=Qe;const ts=A;let es=class extends ts{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 ss=es;const is=A,rs=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");let ns=class extends is{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(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+rs(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};var os=ns;const ls=A;let hs=class extends ls{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 as=hs;const us=A;let cs=class extends us{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 ds=cs;const fs=A;let ps=class extends fs{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 ms=ps;const gs=A;let vs=class extends gs{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(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};var bs=vs;const ws=A;let $s=class extends ws{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 ys=$s;const xs=A;let Ss=class extends xs{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 Os=Ss,Ms={DatePart:A,Meridiem:ss,Day:os,Hours:as,Milliseconds:ds,Minutes:ms,Month:bs,Seconds:ys,Year:Os};const at=M,Ps=F,{style:Tt,clear:Ct,figures:Ts}=D,{erase:Cs,cursor:Dt}=P,{DatePart:Et,Meridiem:Ds,Day:Es,Hours:Is,Milliseconds:_s,Minutes:Rs,Month:As,Seconds:js,Year:Fs}=Ms,Ls=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,It={1:({token:s})=>s.replace(/\\(.)/g,"$1"),2:s=>new Es(s),3:s=>new As(s),4:s=>new Fs(s),5:s=>new Ds(s),6:s=>new Is(s),7:s=>new Rs(s),8:s=>new js(s),9:s=>new _s(s)},Ns={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 Ys extends Ps{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ns,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=Ct("",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 e;for(this.parts=[];e=Ls.exec(t);){let n=e.shift(),o=e.findIndex(r=>r!=null);this.parts.push(o in It?It[o]({token:e[o]||n,date:this.date,parts:this.parts,locales:this.locales}):e[o]||n)}let i=this.parts.reduce((n,o)=>(typeof o=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=o:n.push(o),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof Et)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
14
+ `),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,e){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(Tt.hide):this.out.write(qe(this.outputText,this.out.columns)),super.render(),this.outputText=[Pt.symbol(this.done,this.aborted),tt.bold(this.msg),Pt.delimiter(this.done),this.value?this.inactive:tt.cyan().underline(this.inactive),tt.gray("/"),this.value?tt.cyan().underline(this.active):this.active].join(" "),this.out.write(Xe.line+Tt.to(0)+this.outputText))}}var ts=Qe;let es=class gt{constructor({token:t,date:e,parts:i,locales:n}){this.token=t,this.date=e||new Date,this.parts=i||[this],this.locales=n||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,i)=>i>t&&e instanceof gt)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((i,n)=>n>e&&i instanceof gt)}toString(){return String(this.date)}};var j=es;const ss=j;let is=class extends ss{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 rs=is;const ns=j,os=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");let ls=class extends ns{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(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+os(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};var hs=ls;const as=j;let us=class extends as{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 cs=us;const ds=j;let fs=class extends ds{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 ps=fs;const ms=j;let gs=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 vs=gs;const bs=j;let ws=class extends bs{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(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};var $s=ws;const ys=j;let Ss=class extends ys{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 xs=Ss;const Os=j;let Ms=class extends Os{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 Ps=Ms,Ts={DatePart:j,Meridiem:rs,Day:hs,Hours:cs,Milliseconds:ps,Minutes:vs,Month:$s,Seconds:xs,Year:Ps};const at=P,Cs=L,{style:Ct,clear:Dt,figures:Ds}=E,{erase:Es,cursor:Et}=T,{DatePart:It,Meridiem:Is,Day:_s,Hours:Rs,Milliseconds:As,Minutes:js,Month:Fs,Seconds:Ls,Year:Ns}=Ts,Hs=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,_t={1:({token:s})=>s.replace(/\\(.)/g,"$1"),2:s=>new _s(s),3:s=>new Fs(s),4:s=>new Ns(s),5:s=>new Is(s),6:s=>new Rs(s),7:s=>new js(s),8:s=>new Ls(s),9:s=>new As(s)},Ys={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 Vs extends Cs{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Ys,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=Dt("",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 e;for(this.parts=[];e=Hs.exec(t);){let n=e.shift(),o=e.findIndex(r=>r!=null);this.parts.push(o in _t?_t[o]({token:e[o]||n,date:this.date,parts:this.parts,locales:this.locales}):e[o]||n)}let i=this.parts.reduce((n,o)=>(typeof o=="string"&&typeof n[n.length-1]=="string"?n[n.length-1]+=o:n.push(o),n),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof It)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
15
15
  `),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(`
16
- `),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(e=>e instanceof Et)),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(Dt.hide):this.out.write(Ct(this.outputText,this.out.columns)),super.render(),this.outputText=[Tt.symbol(this.done,this.aborted),at.bold(this.msg),Tt.delimiter(!1),this.parts.reduce((t,e,i)=>t.concat(i===this.cursor&&!this.done?at.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
16
+ `),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(e=>e instanceof It)),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(Et.hide):this.out.write(Dt(this.outputText,this.out.columns)),super.render(),this.outputText=[Ct.symbol(this.done,this.aborted),at.bold(this.msg),Ct.delimiter(!1),this.parts.reduce((t,e,i)=>t.concat(i===this.cursor&&!this.done?at.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
17
17
  `).reduce((t,e,i)=>t+`
18
- ${i?" ":Ts.pointerSmall} ${at.red().italic(e)}`,"")),this.out.write(Cs.line+Dt.to(0)+this.outputText))}}var Vs=Ys;const tt=M,Hs=F,{cursor:et,erase:Bs}=P,{style:ut,figures:Us,clear:_t,lines:zs}=D,Js=/[0-9]/,ct=s=>s!==void 0,Rt=(s,t)=>{let e=Math.pow(10,t);return Math.round(s*e)/e};class ks extends Hs{constructor(t={}){super(t),this.transform=ut.render(t.style),this.msg=t.message,this.initial=ct(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=ct(t.min)?t.min:-1/0,this.max=ct(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=tt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Rt(t,this.round)}`),this._value=Rt(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||Js.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(`
18
+ ${i?" ":Ds.pointerSmall} ${at.red().italic(e)}`,"")),this.out.write(Es.line+Et.to(0)+this.outputText))}}var Bs=Vs;const et=P,Us=L,{cursor:st,erase:zs}=T,{style:ut,figures:Js,clear:Rt,lines:ks}=E,Gs=/[0-9]/,ct=s=>s!==void 0,At=(s,t)=>{let e=Math.pow(10,t);return Math.round(s*e)/e};class Ks extends Us{constructor(t={}){super(t),this.transform=ut.render(t.style),this.msg=t.message,this.initial=ct(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=ct(t.min)?t.min:-1/0,this.max=ct(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=et.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${At(t,this.round)}`),this._value=At(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||Gs.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(`
19
19
  `),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(`
20
- `),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.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,e){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,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.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(et.down(zs(this.outputError,this.out.columns)-1)+_t(this.outputError,this.out.columns)),this.out.write(_t(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ut.symbol(this.done,this.aborted),tt.bold(this.msg),ut.delimiter(this.done),!this.done||!this.done&&!this.placeholder?tt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
20
+ `),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.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,e){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,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.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(st.down(ks(this.outputError,this.out.columns)-1)+Rt(this.outputError,this.out.columns)),this.out.write(Rt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[ut.symbol(this.done,this.aborted),et.bold(this.msg),ut.delimiter(this.done),!this.done||!this.done&&!this.placeholder?et[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
21
21
  `).reduce((t,e,i)=>t+`
22
- ${i?" ":Us.pointerSmall} ${tt.red().italic(e)}`,"")),this.out.write(Bs.line+et.to(0)+this.outputText+et.save+this.outputError+et.restore))}}var Gs=ks;const E=M,{cursor:Ks}=P,Ws=F,{clear:At,figures:L,style:jt,wrap:Zs,entriesToDisplay:qs}=D;let Xs=class extends Ws{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((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?i:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=At("",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(`
22
+ ${i?" ":Js.pointerSmall} ${et.red().italic(e)}`,"")),this.out.write(zs.line+st.to(0)+this.outputText+st.save+this.outputError+st.restore))}}var Ws=Ks;const I=P,{cursor:Zs}=T,qs=L,{clear:jt,figures:N,style:Ft,wrap:Xs,entriesToDisplay:Qs}=E;let ti=class extends qs{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((e,i)=>(typeof e=="string"&&(e={title:e,value:i}),{title:e&&(e.title||e.value||e),description:e&&e.description,value:e&&(e.value===void 0?i:e.value),selected:e&&e.selected,disabled:e&&e.disabled})),this.clear=jt("",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(`
23
23
  `),this.close()}submit(){const t=this.value.filter(e=>e.selected);this.minSelected&&t.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
24
24
  `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(t=>t.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(e=>e.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(e=>!e.disabled).forEach(e=>e.selected=t),this.render()}_(t,e){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:`
25
25
  Instructions:
26
- ${L.arrowUp}/${L.arrowDown}: Highlight option
27
- ${L.arrowLeft}/${L.arrowRight}/[space]: Toggle selection
26
+ ${N.arrowUp}/${N.arrowDown}: Highlight option
27
+ ${N.arrowLeft}/${N.arrowRight}/[space]: Toggle selection
28
28
  `+(this.maxChoices===void 0?` a: Toggle all
29
- `:"")+" enter/return: Complete answer":""}renderOption(t,e,i,n){const o=(e.selected?E.green(L.radioOn):L.radioOff)+" "+n+" ";let r,l;return e.disabled?r=t===i?E.gray().underline(e.title):E.strikethrough().gray(e.title):(r=t===i?E.cyan().underline(e.title):e.title,t===i&&e.description&&(l=` - ${e.description}`,(o.length+r.length+l.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(l=`
30
- `+Zs(e.description,{margin:o.length,width:this.out.columns})))),o+r+E.gray(l||"")}paginateOptions(t){if(t.length===0)return E.red("No matches for this query.");let{startIndex:e,endIndex:i}=qs(this.cursor,t.length,this.optionsPerPage),n,o=[];for(let r=e;r<i;r++)r===e&&e>0?n=L.arrowUp:r===i-1&&i<t.length?n=L.arrowDown:n=" ",o.push(this.renderOption(this.cursor,t[r],r,n));return`
29
+ `:"")+" enter/return: Complete answer":""}renderOption(t,e,i,n){const o=(e.selected?I.green(N.radioOn):N.radioOff)+" "+n+" ";let r,l;return e.disabled?r=t===i?I.gray().underline(e.title):I.strikethrough().gray(e.title):(r=t===i?I.cyan().underline(e.title):e.title,t===i&&e.description&&(l=` - ${e.description}`,(o.length+r.length+l.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(l=`
30
+ `+Xs(e.description,{margin:o.length,width:this.out.columns})))),o+r+I.gray(l||"")}paginateOptions(t){if(t.length===0)return I.red("No matches for this query.");let{startIndex:e,endIndex:i}=Qs(this.cursor,t.length,this.optionsPerPage),n,o=[];for(let r=e;r<i;r++)r===e&&e>0?n=N.arrowUp:r===i-1&&i<t.length?n=N.arrowDown:n=" ",o.push(this.renderOption(this.cursor,t[r],r,n));return`
31
31
  `+o.join(`
32
- `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[E.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(E.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ks.hide),super.render();let t=[jt.symbol(this.done,this.aborted),E.bold(this.msg),jt.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=E.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=At(t,this.out.columns)}};var Ft=Xs;const K=M,Qs=F,{erase:ti,cursor:Lt}=P,{style:dt,clear:Nt,figures:ft,wrap:ei,entriesToDisplay:si}=D,Yt=(s,t)=>s[t]&&(s[t].value||s[t].title||s[t]),ii=(s,t)=>s[t]&&(s[t].title||s[t].value||s[t]),ri=(s,t)=>{const e=s.findIndex(i=>i.value===t||i.title===t);return e>-1?e:void 0};class ni extends Qs{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:ri(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=dt.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Nt("",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=Yt(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const e=this.completing=this.suggest(this.input,this.choices),i=await e;if(this.completing!==e)return;this.suggestions=i.map((o,r,l)=>({title:ii(l,r),value:Yt(l,r),description:o.description})),this.completing=!1;const n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,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(`
32
+ `)}renderOptions(t){return this.done?"":this.paginateOptions(t)}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[I.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&t.push(I.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Zs.hide),super.render();let t=[Ft.symbol(this.done,this.aborted),I.bold(this.msg),Ft.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=I.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=jt(t,this.out.columns)}};var Lt=ti;const Z=P,ei=L,{erase:si,cursor:Nt}=T,{style:dt,clear:Ht,figures:ft,wrap:ii,entriesToDisplay:ri}=E,Yt=(s,t)=>s[t]&&(s[t].value||s[t].title||s[t]),ni=(s,t)=>s[t]&&(s[t].title||s[t].value||s[t]),oi=(s,t)=>{const e=s.findIndex(i=>i.value===t||i.title===t);return e>-1?e:void 0};class li extends ei{constructor(t={}){super(t),this.msg=t.message,this.suggest=t.suggest,this.choices=t.choices,this.initial=typeof t.initial=="number"?t.initial:oi(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=dt.render(t.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=Ht("",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=Yt(this.suggestions,t):this.value=this.fallback.value,this.fire()}async complete(t){const e=this.completing=this.suggest(this.input,this.choices),i=await e;if(this.completing!==e)return;this.suggestions=i.map((o,r,l)=>({title:ni(l,r),value:Yt(l,r),description:o.description})),this.completing=!1;const n=Math.max(i.length-1,0);this.moveSelect(Math.min(n,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(`
33
33
  `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
34
34
  `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
35
- `),this.close()}_(t,e){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.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),e=this.input.slice(this.cursor);this.input=`${t}${e}`,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),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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,e,i,n){let o,r=i?ft.arrowUp:n?ft.arrowDown:" ",l=e?K.cyan().underline(t.title):t.title;return r=(e?K.cyan(ft.pointer)+" ":" ")+r,t.description&&(o=` - ${t.description}`,(r.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
36
- `+ei(t.description,{margin:3,width:this.out.columns}))),r+" "+l+K.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Lt.hide):this.out.write(Nt(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=si(this.select,this.choices.length,this.limit);if(this.outputText=[dt.symbol(this.done,this.aborted,this.exited),K.bold(this.msg),dt.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 i=this.suggestions.slice(t,e).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===e-1&&e<this.choices.length)).join(`
35
+ `),this.close()}_(t,e){let i=this.input.slice(0,this.cursor),n=this.input.slice(this.cursor);this.input=`${i}${t}${n}`,this.cursor=i.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),e=this.input.slice(this.cursor);this.input=`${t}${e}`,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),e=this.input.slice(this.cursor+1);this.input=`${t}${e}`,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,e,i,n){let o,r=i?ft.arrowUp:n?ft.arrowDown:" ",l=e?Z.cyan().underline(t.title):t.title;return r=(e?Z.cyan(ft.pointer)+" ":" ")+r,t.description&&(o=` - ${t.description}`,(r.length+l.length+o.length>=this.out.columns||t.description.split(/\r?\n/).length>1)&&(o=`
36
+ `+ii(t.description,{margin:3,width:this.out.columns}))),r+" "+l+Z.gray(o||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Nt.hide):this.out.write(Ht(this.outputText,this.out.columns)),super.render();let{startIndex:t,endIndex:e}=ri(this.select,this.choices.length,this.limit);if(this.outputText=[dt.symbol(this.done,this.aborted,this.exited),Z.bold(this.msg),dt.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 i=this.suggestions.slice(t,e).map((n,o)=>this.renderOption(n,this.select===o+t,o===0&&t>0,o+t===e-1&&e<this.choices.length)).join(`
37
37
  `);this.outputText+=`
38
- `+(i||K.gray(this.fallback.title))}this.out.write(ti.line+Lt.to(0)+this.outputText)}}var oi=ni;const j=M,{cursor:li}=P,hi=Ft,{clear:Vt,style:Ht,figures:B}=D;class ai extends hi{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Vt("",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(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const e=this.filteredOptions.findIndex(i=>i===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
38
+ `+(i||Z.gray(this.fallback.title))}this.out.write(si.line+Nt.to(0)+this.outputText)}}var hi=li;const F=P,{cursor:ai}=T,ui=Lt,{clear:Vt,style:Bt,figures:z}=E;class ci extends ui{constructor(t={}){t.overrideRender=!0,super(t),this.inputValue="",this.clear=Vt("",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(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const e=this.filteredOptions.findIndex(i=>i===t);this.cursor=e<0?0:e,this.render()}handleSpaceToggle(){const t=this.filteredOptions[this.cursor];if(t.selected)t.selected=!1,this.render();else{if(t.disabled||this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();t.selected=!0,this.render()}}handleInputChange(t){this.inputValue=this.inputValue+t,this.updateFilteredOptions()}_(t,e){t===" "?this.handleSpaceToggle():this.handleInputChange(t)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
39
39
  Instructions:
40
- ${B.arrowUp}/${B.arrowDown}: Highlight option
41
- ${B.arrowLeft}/${B.arrowRight}/[space]: Toggle selection
40
+ ${z.arrowUp}/${z.arrowDown}: Highlight option
41
+ ${z.arrowLeft}/${z.arrowRight}/[space]: Toggle selection
42
42
  [a,b,c]/delete: Filter choices
43
43
  enter/return: Complete answer
44
44
  `:""}renderCurrentInput(){return`
45
- Filtered results for: ${this.inputValue?this.inputValue:j.gray("Enter something to filter")}
46
- `}renderOption(t,e,i){let n;return e.disabled?n=t===i?j.gray().underline(e.title):j.strikethrough().gray(e.title):n=t===i?j.cyan().underline(e.title):e.title,(e.selected?j.green(B.radioOn):B.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[j.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(j.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(li.hide),super.render();let t=[Ht.symbol(this.done,this.aborted),j.bold(this.msg),Ht.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=j.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=Vt(t,this.out.columns)}}var ui=ai;const Bt=M,ci=F,{style:Ut,clear:di}=D,{erase:fi,cursor:zt}=P;class pi extends ci{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(`
45
+ Filtered results for: ${this.inputValue?this.inputValue:F.gray("Enter something to filter")}
46
+ `}renderOption(t,e,i){let n;return e.disabled?n=t===i?F.gray().underline(e.title):F.strikethrough().gray(e.title):n=t===i?F.cyan().underline(e.title):e.title,(e.selected?F.green(z.radioOn):z.radioOff)+" "+n}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[F.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(F.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ai.hide),super.render();let t=[Bt.symbol(this.done,this.aborted),F.bold(this.msg),Bt.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=F.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=Vt(t,this.out.columns)}}var di=ci;const Ut=P,fi=L,{style:zt,clear:pi}=E,{erase:mi,cursor:Jt}=T;class gi extends fi{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(`
47
47
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
48
- `),this.close()}_(t,e){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(zt.hide):this.out.write(di(this.outputText,this.out.columns)),super.render(),this.outputText=[Ut.symbol(this.done,this.aborted),Bt.bold(this.msg),Ut.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Bt.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(fi.line+zt.to(0)+this.outputText))}}var mi=pi,gi={TextPrompt:He,SelectPrompt:Ge,TogglePrompt:Xe,DatePrompt:Vs,NumberPrompt:Gs,MultiselectPrompt:Ft,AutocompletePrompt:oi,AutocompleteMultiselectPrompt:ui,ConfirmPrompt:mi};(function(s){const t=s,e=gi,i=r=>r;function n(r,l,g={}){return new Promise((u,T)=>{const p=new e[r](l),a=g.onAbort||i,h=g.onSubmit||i,v=g.onExit||i;p.on("state",l.onState||i),p.on("submit",x=>u(h(x))),p.on("exit",x=>u(v(x))),p.on("abort",x=>T(a(x)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:g=>g.split(l).map(u=>u.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=g=>g.filter(u=>u.selected).map(u=>u.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=g=>g.filter(u=>u.selected).map(u=>u.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(g=>g.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(bt);const pt=bt,vi=["suggest","format","onState","validate","onRender","type"],Jt=()=>{};async function N(s=[],{onSubmit:t=Jt,onCancel:e=Jt}={}){const i={},n=N._override||{};s=[].concat(s);let o,r,l,g,u,T;const p=async(a,h,v=!1)=>{if(!(!v&&a.validate&&a.validate(h)!==!0))return a.format?await a.format(h,i):h};for(r of s)if({name:g,type:u}=r,typeof u=="function"&&(u=await u(o,{...i},r),r.type=u),!!u){for(let a in r){if(vi.includes(a))continue;let h=r[a];r[a]=typeof h=="function"?await h(o,{...i},T):h}if(T=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:g,type:u}=r,pt[u]===void 0)throw new Error(`prompt type (${u}) is not defined`);if(n[r.name]!==void 0&&(o=await p(r,n[r.name]),o!==void 0)){i[g]=o;continue}try{o=N._injected?bi(N._injected,r.initial):await pt[u](r),i[g]=o=await p(r,o,!0),l=await t(r,o,i)}catch{l=!await e(r,i)}if(l)return i}return i}function bi(s,t){const e=s.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function wi(s){N._injected=(N._injected||[]).concat(s)}function $i(s){N._override=Object.assign({},s)}var yi=Object.assign(N,{prompt:N,prompts:pt,inject:wi,override:$i});const kt=vt(yi);function xi(s,t){var e=s;t.slice(0,-1).forEach(function(n){e=e[n]||{}});var i=t[t.length-1];return i in e}function Gt(s){return typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Kt(s,t){return t==="constructor"&&typeof s[t]=="function"||t==="__proto__"}var Si=function(s,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(c){e.bools[c]=!0});var i={};function n(c){return i[c].some(function(w){return e.bools[w]})}Object.keys(t.alias||{}).forEach(function(c){i[c]=[].concat(t.alias[c]),i[c].forEach(function(w){i[w]=[c].concat(i[c].filter(function(I){return w!==I}))})}),[].concat(t.string).filter(Boolean).forEach(function(c){e.strings[c]=!0,i[c]&&[].concat(i[c]).forEach(function(w){e.strings[w]=!0})});var o=t.default||{},r={_:[]};function l(c,w){return e.allBools&&/^--[^=]+$/.test(w)||e.strings[c]||e.bools[c]||i[c]}function g(c,w,I){for(var f=c,z=0;z<w.length-1;z++){var C=w[z];if(Kt(f,C))return;f[C]===void 0&&(f[C]={}),(f[C]===Object.prototype||f[C]===Number.prototype||f[C]===String.prototype)&&(f[C]={}),f[C]===Array.prototype&&(f[C]=[]),f=f[C]}var _=w[w.length-1];Kt(f,_)||((f===Object.prototype||f===Number.prototype||f===String.prototype)&&(f={}),f===Array.prototype&&(f=[]),f[_]===void 0||e.bools[_]||typeof f[_]=="boolean"?f[_]=I:Array.isArray(f[_])?f[_].push(I):f[_]=[f[_],I])}function u(c,w,I){if(!(I&&e.unknownFn&&!l(c,I)&&e.unknownFn(I)===!1)){var f=!e.strings[c]&&Gt(w)?Number(w):w;g(r,c.split("."),f),(i[c]||[]).forEach(function(z){g(r,z.split("."),f)})}}Object.keys(e.bools).forEach(function(c){u(c,o[c]===void 0?!1:o[c])});var T=[];s.indexOf("--")!==-1&&(T=s.slice(s.indexOf("--")+1),s=s.slice(0,s.indexOf("--")));for(var p=0;p<s.length;p++){var a=s[p],h,v;if(/^--.+=/.test(a)){var x=a.match(/^--([^=]+)=([\s\S]*)$/);h=x[1];var st=x[2];e.bools[h]&&(st=st!=="false"),u(h,st,a)}else if(/^--no-.+/.test(a))h=a.match(/^--no-(.+)/)[1],u(h,!1,a);else if(/^--.+/.test(a))h=a.match(/^--(.+)/)[1],v=s[p+1],v!==void 0&&!/^(-|--)[^-]/.test(v)&&!e.bools[h]&&!e.allBools&&(!i[h]||!n(h))?(u(h,v,a),p+=1):/^(true|false)$/.test(v)?(u(h,v==="true",a),p+=1):u(h,e.strings[h]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var S=a.slice(1,-1).split(""),Z=!1,$=0;$<S.length;$++){if(v=a.slice($+2),v==="-"){u(S[$],v,a);continue}if(/[A-Za-z]/.test(S[$])&&v[0]==="="){u(S[$],v.slice(1),a),Z=!0;break}if(/[A-Za-z]/.test(S[$])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(v)){u(S[$],v,a),Z=!0;break}if(S[$+1]&&S[$+1].match(/\W/)){u(S[$],a.slice($+2),a),Z=!0;break}else u(S[$],e.strings[S[$]]?"":!0,a)}h=a.slice(-1)[0],!Z&&h!=="-"&&(s[p+1]&&!/^(-|--)[^-]/.test(s[p+1])&&!e.bools[h]&&(!i[h]||!n(h))?(u(h,s[p+1],a),p+=1):s[p+1]&&/^(true|false)$/.test(s[p+1])?(u(h,s[p+1]==="true",a),p+=1):u(h,e.strings[h]?"":!0,a))}else if((!e.unknownFn||e.unknownFn(a)!==!1)&&r._.push(e.strings._||!Gt(a)?a:Number(a)),t.stopEarly){r._.push.apply(r._,s.slice(p+1));break}}return Object.keys(o).forEach(function(c){xi(r,c.split("."))||(g(r,c.split("."),o[c]),(i[c]||[]).forEach(function(w){g(r,w.split("."),o[c])}))}),t["--"]?r["--"]=T.slice():T.forEach(function(c){r._.push(c)}),r};const Oi=vt(Si);let V=!0;const U=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let W=0;if(U.process&&U.process.env&&U.process.stdout){const{FORCE_COLOR:s,NODE_DISABLE_COLORS:t,NO_COLOR:e,TERM:i,COLORTERM:n}=U.process.env;t||e||s==="0"?V=!1:s==="1"||s==="2"||s==="3"?V=!0:i==="dumb"?V=!1:"CI"in U.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in U.process.env)?V=!0:V=process.stdout.isTTY,V&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?W=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?W=2:W=1)}let Wt={enabled:V,supportLevel:W};function Zt(s,t,e=1){const i=`\x1B[${s}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Wt.enabled&&Wt.supportLevel>=e?i+(""+r).replace(o,i)+n:""+r}const qt=Zt(0,0),Xt=Zt(31,39),mt=process.cwd(),Qt=Oi(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),Mi={_gitignore:".gitignore"},te="fsapp-project";async function Pi(){let s=se(Qt._[0])||te;const t=()=>s==="."?O.basename(O.resolve()):s;let e;kt.override({overwrite:Qt.overwrite});try{e=await kt([{type:"text",name:"projectName",message:qt("Project name:"),onState:h=>{s=se(h.value)||te}},{type:()=>!y.existsSync(s)||Ci(s)?null:"select",name:"overwrite",message:()=>(s==="."?"Current directory":`Target directory ${s}`)+"is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(h,{overwrite:v})=>{if(v==="no")throw new Error(Xt("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>ie(t())?null:"text",name:"packageName",message:qt("Package name:"),initial:()=>Di(t()),validate:h=>ie(h)||"Invalid package.json name"},{type:"select",name:"template",message:"Select a template",choices:[{title:"Vue",value:"vue"},{title:"Docs",value:"docs"},{title:"Protocut",value:"protocut"}]},{type:"select",name:"variant",message:"Select a templateUse arrow-keys. Return to submit.",choices:h=>h==="vue"?[{title:"TypeScript",value:"ts"},{title:"JavaScript",value:"js"}]:h==="docs"?[{title:"VitePress",value:"vitepress"},{title:"VuePress",value:"vuepress"}]:h==="protocut"?[{title:"2D",value:"2d"},{title:"3D",value:"3d"}]:[]}],{onCancel:()=>{throw new Error(Xt("\u2716")+" Operation cancelled")}})}catch(h){console.log(h.message);return}const{overwrite:i,template:n,packageName:o,variant:r}=e,l=O.join(mt,s);i==="yes"?Ei(l):y.existsSync(l)||y.mkdirSync(l,{recursive:!0});const g=O.resolve(re(import.meta.url),"../..",`template-${n}-${r}`),u=(h,v)=>{const x=O.join(l,Mi[h]??h);v?y.writeFileSync(x,v):ee(O.join(g,h),x)},T=y.readdirSync(g);for(const h of T.filter(v=>v!=="package.json"))u(h);const p=JSON.parse(y.readFileSync(O.join(g,"package.json"),"utf-8"));p.name=o||t(),u("package.json",JSON.stringify(p,null,2)+`
49
- `);const a=O.relative(mt,l);console.log("Done. Now run:"),l!==mt&&console.log(` cd ${a.includes(" ")?`"${a}"`:a}`),(n==="vue"||n==="protocut")&&(console.log(" npm install"),console.log(" npm run dev")),n==="docs"&&(console.log(" npm install"),console.log(" npm run docs:dev"))}function ee(s,t){y.statSync(s).isDirectory()?Ti(s,t):y.copyFileSync(s,t)}function Ti(s,t){y.mkdirSync(t,{recursive:!0});for(const e of y.readdirSync(s)){const i=O.resolve(s,e),n=O.resolve(t,e);ee(i,n)}}function Ci(s){const t=y.readdirSync(s);return t.length===0||t.length===1&&t[0]===".git"}function se(s){return s?.trim().replace(/\/+$/g,"")}function ie(s){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(s)}function Di(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Ei(s){if(y.existsSync(s))for(const t of y.readdirSync(s))t!==".git"&&y.rmSync(O.resolve(s,t),{recursive:!0,force:!0})}Pi().catch(console.error);
48
+ `),this.close()}_(t,e){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(Jt.hide):this.out.write(pi(this.outputText,this.out.columns)),super.render(),this.outputText=[zt.symbol(this.done,this.aborted),Ut.bold(this.msg),zt.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Ut.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(mi.line+Jt.to(0)+this.outputText))}}var vi=gi,bi={TextPrompt:Ue,SelectPrompt:We,TogglePrompt:ts,DatePrompt:Bs,NumberPrompt:Ws,MultiselectPrompt:Lt,AutocompletePrompt:hi,AutocompleteMultiselectPrompt:di,ConfirmPrompt:vi};(function(s){const t=s,e=bi,i=r=>r;function n(r,l,p={}){return new Promise((h,C)=>{const m=new e[r](l),a=p.onAbort||i,u=p.onSubmit||i,b=p.onExit||i;m.on("state",l.onState||i),m.on("submit",M=>h(u(M))),m.on("exit",M=>h(b(M))),m.on("abort",M=>C(a(M)))})}t.text=r=>n("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>n("NumberPrompt",r),t.date=r=>n("DatePrompt",r),t.confirm=r=>n("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return n("TextPrompt",r,{onSubmit:p=>p.split(l).map(h=>h.trim())})},t.toggle=r=>n("TogglePrompt",r),t.select=r=>n("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=p=>p.filter(h=>h.selected).map(h=>h.value);return n("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=p=>p.filter(h=>h.selected).map(h=>h.value);return n("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const o=(r,l)=>Promise.resolve(l.filter(p=>p.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||o,r.choices=[].concat(r.choices||[]),n("AutocompletePrompt",r))})(wt);const pt=wt,wi=["suggest","format","onState","validate","onRender","type"],kt=()=>{};async function H(s=[],{onSubmit:t=kt,onCancel:e=kt}={}){const i={},n=H._override||{};s=[].concat(s);let o,r,l,p,h,C;const m=async(a,u,b=!1)=>{if(!(!b&&a.validate&&a.validate(u)!==!0))return a.format?await a.format(u,i):u};for(r of s)if({name:p,type:h}=r,typeof h=="function"&&(h=await h(o,{...i},r),r.type=h),!!h){for(let a in r){if(wi.includes(a))continue;let u=r[a];r[a]=typeof u=="function"?await u(o,{...i},C):u}if(C=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:p,type:h}=r,pt[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(n[r.name]!==void 0&&(o=await m(r,n[r.name]),o!==void 0)){i[p]=o;continue}try{o=H._injected?$i(H._injected,r.initial):await pt[h](r),i[p]=o=await m(r,o,!0),l=await t(r,o,i)}catch{l=!await e(r,i)}if(l)return i}return i}function $i(s,t){const e=s.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function yi(s){H._injected=(H._injected||[]).concat(s)}function Si(s){H._override=Object.assign({},s)}var xi=Object.assign(H,{prompt:H,prompts:pt,inject:yi,override:Si});const Gt=bt(xi);function Oi(s,t){var e=s;t.slice(0,-1).forEach(function(n){e=e[n]||{}});var i=t[t.length-1];return i in e}function Kt(s){return typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Wt(s,t){return t==="constructor"&&typeof s[t]=="function"||t==="__proto__"}var Mi=function(s,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(c){e.bools[c]=!0});var i={};function n(c){return i[c].some(function(y){return e.bools[y]})}Object.keys(t.alias||{}).forEach(function(c){i[c]=[].concat(t.alias[c]),i[c].forEach(function(y){i[y]=[c].concat(i[c].filter(function(_){return y!==_}))})}),[].concat(t.string).filter(Boolean).forEach(function(c){e.strings[c]=!0,i[c]&&[].concat(i[c]).forEach(function(y){e.strings[y]=!0})});var o=t.default||{},r={_:[]};function l(c,y){return e.allBools&&/^--[^=]+$/.test(y)||e.strings[c]||e.bools[c]||i[c]}function p(c,y,_){for(var f=c,k=0;k<y.length-1;k++){var D=y[k];if(Wt(f,D))return;f[D]===void 0&&(f[D]={}),(f[D]===Object.prototype||f[D]===Number.prototype||f[D]===String.prototype)&&(f[D]={}),f[D]===Array.prototype&&(f[D]=[]),f=f[D]}var R=y[y.length-1];Wt(f,R)||((f===Object.prototype||f===Number.prototype||f===String.prototype)&&(f={}),f===Array.prototype&&(f=[]),f[R]===void 0||e.bools[R]||typeof f[R]=="boolean"?f[R]=_:Array.isArray(f[R])?f[R].push(_):f[R]=[f[R],_])}function h(c,y,_){if(!(_&&e.unknownFn&&!l(c,_)&&e.unknownFn(_)===!1)){var f=!e.strings[c]&&Kt(y)?Number(y):y;p(r,c.split("."),f),(i[c]||[]).forEach(function(k){p(r,k.split("."),f)})}}Object.keys(e.bools).forEach(function(c){h(c,o[c]===void 0?!1:o[c])});var C=[];s.indexOf("--")!==-1&&(C=s.slice(s.indexOf("--")+1),s=s.slice(0,s.indexOf("--")));for(var m=0;m<s.length;m++){var a=s[m],u,b;if(/^--.+=/.test(a)){var M=a.match(/^--([^=]+)=([\s\S]*)$/);u=M[1];var w=M[2];e.bools[u]&&(w=w!=="false"),h(u,w,a)}else if(/^--no-.+/.test(a))u=a.match(/^--no-(.+)/)[1],h(u,!1,a);else if(/^--.+/.test(a))u=a.match(/^--(.+)/)[1],b=s[m+1],b!==void 0&&!/^(-|--)[^-]/.test(b)&&!e.bools[u]&&!e.allBools&&(!i[u]||!n(u))?(h(u,b,a),m+=1):/^(true|false)$/.test(b)?(h(u,b==="true",a),m+=1):h(u,e.strings[u]?"":!0,a);else if(/^-[^-]+/.test(a)){for(var $=a.slice(1,-1).split(""),Y=!1,x=0;x<$.length;x++){if(b=a.slice(x+2),b==="-"){h($[x],b,a);continue}if(/[A-Za-z]/.test($[x])&&b[0]==="="){h($[x],b.slice(1),a),Y=!0;break}if(/[A-Za-z]/.test($[x])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(b)){h($[x],b,a),Y=!0;break}if($[x+1]&&$[x+1].match(/\W/)){h($[x],a.slice(x+2),a),Y=!0;break}else h($[x],e.strings[$[x]]?"":!0,a)}u=a.slice(-1)[0],!Y&&u!=="-"&&(s[m+1]&&!/^(-|--)[^-]/.test(s[m+1])&&!e.bools[u]&&(!i[u]||!n(u))?(h(u,s[m+1],a),m+=1):s[m+1]&&/^(true|false)$/.test(s[m+1])?(h(u,s[m+1]==="true",a),m+=1):h(u,e.strings[u]?"":!0,a))}else if((!e.unknownFn||e.unknownFn(a)!==!1)&&r._.push(e.strings._||!Kt(a)?a:Number(a)),t.stopEarly){r._.push.apply(r._,s.slice(m+1));break}}return Object.keys(o).forEach(function(c){Oi(r,c.split("."))||(p(r,c.split("."),o[c]),(i[c]||[]).forEach(function(y){p(r,y.split("."),o[c])}))}),t["--"]?r["--"]=C.slice():C.forEach(function(c){r._.push(c)}),r};const Pi=bt(Mi);let B=!0;const J=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let q=0;if(J.process&&J.process.env&&J.process.stdout){const{FORCE_COLOR:s,NODE_DISABLE_COLORS:t,NO_COLOR:e,TERM:i,COLORTERM:n}=J.process.env;t||e||s==="0"?B=!1:s==="1"||s==="2"||s==="3"?B=!0:i==="dumb"?B=!1:"CI"in J.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(o=>o in J.process.env)?B=!0:B=process.stdout.isTTY,B&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?q=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?q=2:q=1)}let Zt={enabled:B,supportLevel:q};function qt(s,t,e=1){const i=`\x1B[${s}m`,n=`\x1B[${t}m`,o=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Zt.enabled&&Zt.supportLevel>=e?i+(""+r).replace(o,i)+n:""+r}const Xt=qt(0,0),Qt=qt(31,39),mt=process.cwd(),te=Pi(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),Ti={_gitignore:".gitignore"},ee={"protocut-2d":{"@fsdev/cadui-2d":"^0.0.2","@fsdev/cutui-2d":"^0.0.2","@fsdev/webcad-js":"1.1.0"},"protocut-3d":{"@fsdev/cutui-3d":"^0.0.2","@fsdev/webcad-platform":"1.1.0"}},se="fsapp-project";async function Ci(){let s=re(te._[0])||se;const t=()=>s==="."?O.basename(O.resolve()):s;let e;Gt.override({overwrite:te.overwrite});try{e=await Gt([{type:"text",name:"projectName",message:Xt("Project name:"),onState:w=>{s=re(w.value)||se}},{type:()=>!S.existsSync(s)||Ei(s)?null:"select",name:"overwrite",message:()=>(s==="."?"Current directory":`Target directory ${s}`)+"is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Remove existing files and continue",value:"yes"},{title:"Cancel operation",value:"no"},{title:"Ignore files and continue",value:"ignore"}]},{type:(w,{overwrite:$})=>{if($==="no")throw new Error(Qt("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>ne(t())?null:"text",name:"packageName",message:Xt("Package name:"),initial:()=>Ii(t()),validate:w=>ne(w)||"Invalid package.json name"},{type:"select",name:"template",message:"Select a template",choices:[{title:"Vue",value:"vue"},{title:"Docs",value:"docs"},{title:"Protocut",value:"protocut"}]},{type:"select",name:"variant",message:"Select a templateUse arrow-keys. Return to submit.",choices:w=>w==="vue"?[{title:"TypeScript",value:"ts"},{title:"JavaScript",value:"js"}]:w==="docs"?[{title:"VitePress",value:"vitepress"},{title:"VuePress",value:"vuepress"}]:w==="protocut"?[{title:"2D",value:"2d"},{title:"3D",value:"3d"}]:[]}],{onCancel:()=>{throw new Error(Qt("\u2716")+" Operation cancelled")}})}catch(w){console.log(w.message);return}const{overwrite:i,template:n,packageName:o,variant:r}=e,l=O.join(mt,s);i==="yes"?_i(l):S.existsSync(l)||S.mkdirSync(l,{recursive:!0});const p=O.resolve(oe(import.meta.url),"../..",n==="protocut"?"template-protocut":`template-${n}-${r}`),h=(w,$)=>{const Y=O.join(l,Ti[w]??w);$?S.writeFileSync(Y,$):ie(O.join(p,w),Y)},C=S.readdirSync(p);for(const w of C.filter($=>$!=="package.json"&&!$.includes("template")))h(w);const m=JSON.parse(S.readFileSync(O.join(p,"package.json"),"utf-8"));m.name=o||t(),ee[`${n}-${r}`]&&Object.assign(m.dependencies,ee[`${n}-${r}`]),h("package.json",JSON.stringify(m,null,2)+`
49
+ `);const a=r==="2d";let u=S.readFileSync(O.join(p,"template/Home.handlebars"),"utf-8"),b=vt.compile(u)({is2D:a});h("src/views/Home.vue",b),u=S.readFileSync(O.join(p,"template/main.handlebars"),"utf-8"),b=vt.compile(u)({is2D:a}),h("src/main.ts",b);const M=O.relative(mt,l);console.log("Done. Now run:"),l!==mt&&console.log(` cd ${M.includes(" ")?`"${M}"`:M}`),(n==="vue"||n==="protocut")&&(console.log(" npm install"),console.log(" npm run dev")),n==="docs"&&(console.log(" npm install"),console.log(" npm run docs:dev"))}function ie(s,t){S.statSync(s).isDirectory()?Di(s,t):S.copyFileSync(s,t)}function Di(s,t){S.mkdirSync(t,{recursive:!0});for(const e of S.readdirSync(s)){const i=O.resolve(s,e),n=O.resolve(t,e);ie(i,n)}}function Ei(s){const t=S.readdirSync(s);return t.length===0||t.length===1&&t[0]===".git"}function re(s){return s?.trim().replace(/\/+$/g,"")}function ne(s){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(s)}function Ii(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function _i(s){if(S.existsSync(s))for(const t of S.readdirSync(s))t!==".git"&&S.rmSync(O.resolve(s,t),{recursive:!0,force:!0})}Ci().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bc-app",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "bin": "index.js",
6
6
  "type": "module",
@@ -15,9 +15,10 @@
15
15
  "cross-spawn": "^7.0.3",
16
16
  "kolorist": "^1.8.0",
17
17
  "minimist": "^1.2.8",
18
- "prompts": "^2.4.2",
18
+ "prompts": "^2.4.2",
19
19
  "typescript": "^5.5.4",
20
- "unbuild": "^2.0.0"
20
+ "unbuild": "^2.0.0",
21
+ "handlebars": "^4.7.8"
21
22
  },
22
23
  "publishConfig": {
23
24
  "registry": "https://registry.npmjs.org"
@@ -34,4 +35,4 @@
34
35
  "dist/",
35
36
  "index.js"
36
37
  ]
37
- }
38
+ }
@@ -1,203 +0,0 @@
1
- /* eslint-env node */
2
- require('@rushstack/eslint-patch/modern-module-resolution')
3
-
4
- module.exports = {
5
- root: true,
6
- extends: [
7
- 'plugin:vue/recommended',
8
- 'plugin:vue/vue3-essential',
9
- 'plugin:vue/vue3-strongly-recommended',
10
- 'plugin:@typescript-eslint/recommended',
11
- 'eslint:recommended'
12
- ],
13
- ignorePatterns: ['sdk/'], globals: {
14
- 'process': true
15
- },
16
- parser: 'vue-eslint-parser',
17
- parserOptions: {
18
- ecmaVersion: 'latest',
19
- parser: '@typescript-eslint/parser'
20
- },
21
- rules: {
22
- '@typescript-eslint/no-unused-vars': 'error',
23
- '@typescript-eslint/no-explicit-any': 'off',
24
- '@typescript-eslint/ban-ts-comment': 'off',
25
- 'vue/multi-word-component-names': ['off'],
26
- 'vue/no-v-for-template-key': 'off',
27
- 'vue/no-multiple-template-root': 'off',
28
- 'vue/no-v-model-argument': 'off',
29
- 'vue/max-attributes-per-line': ['error', {
30
- 'singleline': {
31
- 'max': 3
32
- },
33
- 'multiline': {
34
- 'max': 3
35
- }
36
- }],
37
- 'accessor-pairs': 2,
38
- 'arrow-spacing': [2, {
39
- 'before': true,
40
- 'after': true
41
- }],
42
- 'block-spacing': [2, 'always'],
43
- 'brace-style': [2, '1tbs', {
44
- 'allowSingleLine': true
45
- }],
46
- 'camelcase': [2, {
47
- 'properties': 'always'
48
- }],
49
- 'comma-dangle': [2, 'never'],
50
- 'comma-spacing': [2, {
51
- 'before': false,
52
- 'after': true
53
- }],
54
- 'comma-style': [2, 'last'],
55
- 'constructor-super': 2,
56
- 'curly': [2, 'multi-line'],
57
- 'dot-location': [2, 'property'],
58
- 'eol-last': 2,
59
- 'eqeqeq': [2, 'allow-null'],
60
- 'generator-star-spacing': [2, {
61
- 'before': true,
62
- 'after': true
63
- }],
64
- 'handle-callback-err': [2, '^(err|error)$'],
65
- 'indent': [1, 2, {
66
- 'SwitchCase': 1
67
- }],
68
- 'jsx-quotes': [2, 'prefer-single'],
69
- 'key-spacing': [2, {
70
- 'beforeColon': false,
71
- 'afterColon': true
72
- }],
73
- 'keyword-spacing': [2, {
74
- 'before': true,
75
- 'after': true
76
- }],
77
- 'new-cap': [2, {
78
- 'newIsCap': true,
79
- 'capIsNew': false
80
- }],
81
- 'new-parens': 2,
82
- 'no-array-constructor': 2,
83
- 'no-caller': 2,
84
- 'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
85
- 'no-class-assign': 2,
86
- 'no-cond-assign': 2,
87
- 'no-const-assign': 2,
88
- 'no-control-regex': 0,
89
- 'no-delete-var': 2,
90
- 'no-dupe-args': 2,
91
- 'no-dupe-class-members': 2,
92
- 'no-dupe-keys': 2,
93
- 'no-duplicate-case': 2,
94
- 'no-empty-character-class': 2,
95
- 'no-empty-pattern': 2,
96
- 'no-eval': 2,
97
- 'no-ex-assign': 2,
98
- 'no-extend-native': 2,
99
- 'no-extra-bind': 2,
100
- 'no-extra-boolean-cast': 2,
101
- 'no-extra-parens': [2, 'functions'],
102
- 'no-fallthrough': 2,
103
- 'no-floating-decimal': 2,
104
- 'no-func-assign': 2,
105
- 'no-implied-eval': 2,
106
- 'no-inner-declarations': [2, 'functions'],
107
- 'no-invalid-regexp': 2,
108
- 'no-irregular-whitespace': 2,
109
- 'no-iterator': 2,
110
- 'no-label-var': 2,
111
- 'no-labels': [2, {
112
- 'allowLoop': false,
113
- 'allowSwitch': false
114
- }],
115
- 'no-lone-blocks': 2,
116
- 'no-mixed-spaces-and-tabs': 2,
117
- 'no-multi-spaces': 2,
118
- 'no-multi-str': 2,
119
- 'no-multiple-empty-lines': [2, {
120
- 'max': 1
121
- }],
122
- 'no-native-reassign': 2,
123
- 'no-negated-in-lhs': 2,
124
- 'no-new-object': 2,
125
- 'no-new-require': 2,
126
- 'no-new-symbol': 2,
127
- 'no-new-wrappers': 2,
128
- 'no-obj-calls': 2,
129
- 'no-octal': 2,
130
- 'no-octal-escape': 2,
131
- 'no-path-concat': 2,
132
- 'no-proto': 2,
133
- 'no-redeclare': 2,
134
- 'no-regex-spaces': 2,
135
- 'no-return-assign': [2, 'except-parens'],
136
- 'no-self-assign': 2,
137
- 'no-self-compare': 2,
138
- 'no-sequences': 2,
139
- 'no-shadow-restricted-names': 2,
140
- 'no-spaced-func': 2,
141
- 'no-sparse-arrays': 2,
142
- 'no-this-before-super': 2,
143
- 'no-throw-literal': 2,
144
- 'no-trailing-spaces': 2,
145
- 'no-undef': 2,
146
- 'no-undef-init': 2,
147
- 'no-unexpected-multiline': 2,
148
- 'no-unmodified-loop-condition': 2,
149
- 'no-unneeded-ternary': [2, {
150
- 'defaultAssignment': false
151
- }],
152
- 'no-unreachable': 2,
153
- 'no-unsafe-finally': 2,
154
- 'no-unused-vars': 'off',
155
- 'no-useless-call': 2,
156
- 'no-useless-computed-key': 2,
157
- 'no-useless-constructor': 2,
158
- 'no-useless-escape': 1,
159
- 'no-whitespace-before-property': 2,
160
- 'no-with': 2,
161
- 'one-var': [2, {
162
- 'initialized': 'never'
163
- }],
164
- 'operator-linebreak': [2, 'after', {
165
- 'overrides': {
166
- '?': 'before',
167
- ':': 'before'
168
- }
169
- }],
170
- 'padded-blocks': [2, 'never'],
171
- 'quotes': [1, 'single', {
172
- 'avoidEscape': true,
173
- 'allowTemplateLiterals': true
174
- }],
175
- 'semi': [2, 'never'],
176
- 'semi-spacing': [2, {
177
- 'before': false,
178
- 'after': true
179
- }],
180
- 'space-before-blocks': [2, 'always'],
181
- 'space-in-parens': [2, 'never'],
182
- 'space-infix-ops': 2,
183
- 'space-unary-ops': [2, {
184
- 'words': true,
185
- 'nonwords': false
186
- }],
187
- 'spaced-comment': [2, 'always', {
188
- 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
189
- }],
190
- 'template-curly-spacing': [2, 'never'],
191
- 'use-isnan': 2,
192
- 'valid-typeof': 2,
193
- 'wrap-iife': [2, 'any'],
194
- 'yield-star-spacing': [2, 'both'],
195
- 'yoda': [2, 'never'],
196
- 'prefer-const': 0,
197
- 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
198
- 'object-curly-spacing': [2, 'always', {
199
- objectsInObjects: false
200
- }],
201
- 'array-bracket-spacing': [2, 'never']
202
- }
203
- }
@@ -1,24 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- dist
12
- dist-ssr
13
- *.local
14
-
15
- # Editor directories and files
16
- .vscode/*
17
- !.vscode/extensions.json
18
- .idea
19
- .DS_Store
20
- *.suo
21
- *.ntvs*
22
- *.njsproj
23
- *.sln
24
- *.sw?
@@ -1,41 +0,0 @@
1
- stages:
2
- - install
3
- - eslint
4
- - notify
5
-
6
- cache:
7
- key: '$CI_COMMIT_REF_SLUG'
8
-
9
- install:
10
- stage: install
11
- cache:
12
- paths:
13
- - node_modules/
14
- script:
15
- - cnpm install
16
- tags:
17
- - sonar
18
-
19
- eslint:
20
- stage: eslint
21
- cache:
22
- paths:
23
- - node_modules/
24
- script:
25
- - npm run lint
26
- tags:
27
- - sonar
28
-
29
- notify-fail:
30
- stage: notify
31
- cache:
32
- paths:
33
- - node_modules/
34
- script:
35
- - >
36
- curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=10a543ce-7d15-4339-9ef4-48f1ac5f5c87'
37
- -H 'Content-Type: application/json'
38
- -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"项目构建结果:<font color=\\"warning\\">失败</font>\n>本次构建由: $GITLAB_USER_NAME 触发\n>项目名称:$CI_PROJECT_NAME\n>提交号:$CI_COMMIT_SHA\n>提交日志:$CI_COMMIT_MESSAGE\n>构建分支: $CI_COMMIT_REF_NAME\n>流水线地址:[$CI_PIPELINE_URL]($CI_PIPELINE_URL)\"}}"
39
- when: on_failure
40
- tags:
41
- - sonar