bob-core 2.0.0-beta.18 → 2.0.0-beta.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bob-core",t="2.0.0-beta.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="bob-core",t="2.0.0-beta.19",s="BOB Core",i="module",n="./dist/cjs/src/index.js",r="./dist/esm/src/index.js",c="./dist/esm/src/index.d.ts",o=["dist"],d={".":{import:{types:"./dist/esm/src/index.d.ts",default:"./dist/esm/src/index.js"},require:{types:"./dist/cjs/src/index.d.ts",default:"./dist/cjs/src/index.js"}}},p={start:"node -r @swc-node/register debug/main.ts",build:"rimraf ./dist && vite build",typecheck:"tsc --noEmit",prepack:"npm run build",test:"vitest run",lint:"eslint .","lint:fix":"eslint . --fix"},l="Léo Hubert",m="ISC",a={"@eslint/js":"^9.37.0","@faker-js/faker":"^10.0.0","@swc-node/register":"^1.11.1","@trivago/prettier-plugin-sort-imports":"^5.2.2","@types/minimist":"^1.2.5","@types/node":"^20.14.5","@types/prompts":"^2.4.9","@types/string-similarity":"^4.0.2","@vitest/coverage-v8":"^3.2.4",eslint:"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4",prettier:"^3.6.2",rimraf:"^6.0.1",tsx:"^4.20.6",typescript:"^5.9.3","typescript-eslint":"^8.46.0",vite:"^7.2.7","vite-plugin-dts":"^4.5.4",vitest:"^3.2.4"},u={chalk:"^5.6.2",minimist:"^1.2.8",prompts:"^2.4.2"},y={name:e,version:t,description:s,type:i,main:n,module:r,types:c,files:o,exports:d,scripts:p,author:l,license:m,devDependencies:a,dependencies:u};exports.author=l;exports.default=y;exports.dependencies=u;exports.description=s;exports.devDependencies=a;exports.exports=d;exports.files=o;exports.license=m;exports.main=n;exports.module=r;exports.name=e;exports.scripts=p;exports.type=i;exports.types=c;exports.version=t;
|
package/dist/cjs/src/index.js
CHANGED
|
@@ -1,17 +1,117 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`),this.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
${
|
|
9
|
-
`),this.
|
|
10
|
-
`)
|
|
11
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function rr(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function pr(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var t=i.default;if(typeof t=="function"){var r=function e(){var s=!1;try{s=this instanceof e}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(i).forEach(function(e){var s=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(r,e,s.get?s:{enumerable:!0,get:function(){return i[e]}})}),r}var ot={},at,_e;function D(){if(_e)return at;_e=1;const{FORCE_COLOR:i,NODE_DISABLE_COLORS:t,TERM:r}=process.env,e={enabled:!t&&r!=="dumb"&&i!=="0",reset:n(0,0),bold:n(1,22),dim:n(2,22),italic:n(3,23),underline:n(4,24),inverse:n(7,27),hidden:n(8,28),strikethrough:n(9,29),black:n(30,39),red:n(31,39),green:n(32,39),yellow:n(33,39),blue:n(34,39),magenta:n(35,39),cyan:n(36,39),white:n(37,39),gray:n(90,39),grey:n(90,39),bgBlack:n(40,49),bgRed:n(41,49),bgGreen:n(42,49),bgYellow:n(43,49),bgBlue:n(44,49),bgMagenta:n(45,49),bgCyan:n(46,49),bgWhite:n(47,49)};function s(g,a){let u=0,o,d="",f="";for(;u<g.length;u++)o=g[u],d+=o.open,f+=o.close,a.includes(o.close)&&(a=a.replace(o.rgx,o.close+o.open));return d+a+f}function l(g,a){let u={has:g,keys:a};return u.reset=e.reset.bind(u),u.bold=e.bold.bind(u),u.dim=e.dim.bind(u),u.italic=e.italic.bind(u),u.underline=e.underline.bind(u),u.inverse=e.inverse.bind(u),u.hidden=e.hidden.bind(u),u.strikethrough=e.strikethrough.bind(u),u.black=e.black.bind(u),u.red=e.red.bind(u),u.green=e.green.bind(u),u.yellow=e.yellow.bind(u),u.blue=e.blue.bind(u),u.magenta=e.magenta.bind(u),u.cyan=e.cyan.bind(u),u.white=e.white.bind(u),u.gray=e.gray.bind(u),u.grey=e.grey.bind(u),u.bgBlack=e.bgBlack.bind(u),u.bgRed=e.bgRed.bind(u),u.bgGreen=e.bgGreen.bind(u),u.bgYellow=e.bgYellow.bind(u),u.bgBlue=e.bgBlue.bind(u),u.bgMagenta=e.bgMagenta.bind(u),u.bgCyan=e.bgCyan.bind(u),u.bgWhite=e.bgWhite.bind(u),u}function n(g,a){let u={open:`\x1B[${g}m`,close:`\x1B[${a}m`,rgx:new RegExp(`\\x1b\\[${a}m`,"g")};return function(o){return this!==void 0&&this.has!==void 0?(this.has.includes(g)||(this.has.push(g),this.keys.push(u)),o===void 0?this:e.enabled?s(this.keys,o+""):o+""):o===void 0?l([g],[u]):e.enabled?s([u],o+""):o+""}}return at=e,at}const xe={},mr=Object.freeze(Object.defineProperty({__proto__:null,default:xe},Symbol.toStringTag,{value:"Module"})),rt=pr(mr);var lt,Ee;function gr(){return Ee||(Ee=1,lt=(i,t)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(t){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}),lt}var ht,Ie;function Pe(){return Ie||(Ie=1,ht=i=>{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("|"),r=new RegExp(t,"g");return typeof i=="string"?i.replace(r,""):i}),ht}var ut,je;function _(){if(je)return ut;je=1;const i="\x1B",t=`${i}[`,r="\x07",e={to(n,g){return g?`${t}${g+1};${n+1}H`:`${t}${n+1}G`},move(n,g){let a="";return n<0?a+=`${t}${-n}D`:n>0&&(a+=`${t}${n}C`),g<0?a+=`${t}${-g}A`:g>0&&(a+=`${t}${g}B`),a},up:(n=1)=>`${t}${n}A`,down:(n=1)=>`${t}${n}B`,forward:(n=1)=>`${t}${n}C`,backward:(n=1)=>`${t}${n}D`,nextLine:(n=1)=>`${t}E`.repeat(n),prevLine:(n=1)=>`${t}F`.repeat(n),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${i}7`,restore:`${i}8`},s={up:(n=1)=>`${t}S`.repeat(n),down:(n=1)=>`${t}T`.repeat(n)},l={screen:`${t}2J`,up:(n=1)=>`${t}1J`.repeat(n),down:(n=1)=>`${t}J`.repeat(n),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(n){let g="";for(let a=0;a<n;a++)g+=this.line+(a<n-1?e.up():"");return n&&(g+=e.left),g}};return ut={cursor:e,scroll:s,erase:l,beep:r},ut}var ct,Fe;function vr(){if(Fe)return ct;Fe=1;function i(a,u){var o=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(!o){if(Array.isArray(a)||(o=t(a))||u){o&&(a=o);var d=0,f=function(){};return{s:f,n:function(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function(p){throw p},f}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var h=!0,c=!1,b;return{s:function(){o=o.call(a)},n:function(){var p=o.next();return h=p.done,p},e:function(p){c=!0,b=p},f:function(){try{!h&&o.return!=null&&o.return()}finally{if(c)throw b}}}}function t(a,u){if(a){if(typeof a=="string")return r(a,u);var o=Object.prototype.toString.call(a).slice(8,-1);if(o==="Object"&&a.constructor&&(o=a.constructor.name),o==="Map"||o==="Set")return Array.from(a);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return r(a,u)}}function r(a,u){(u==null||u>a.length)&&(u=a.length);for(var o=0,d=new Array(u);o<u;o++)d[o]=a[o];return d}const e=Pe(),s=_(),l=s.erase,n=s.cursor,g=a=>[...e(a)].length;return ct=function(a,u){if(!u)return l.line+n.to(0);let o=0;const d=a.split(/\r?\n/);var f=i(d),h;try{for(f.s();!(h=f.n()).done;){let c=h.value;o+=1+Math.floor(Math.max(g(c)-1,0)/u)}}catch(c){f.e(c)}finally{f.f()}return l.lines(o)},ct}var dt,Ne;function sr(){if(Ne)return dt;Ne=1;const i={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},t={arrowUp:i.arrowUp,arrowDown:i.arrowDown,arrowLeft:i.arrowLeft,arrowRight:i.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};return dt=process.platform==="win32"?t:i,dt}var ft,He;function br(){if(He)return ft;He=1;const i=D(),t=sr(),r=Object.freeze({password:{scale:1,render:a=>"*".repeat(a.length)},emoji:{scale:2,render:a=>"😃".repeat(a.length)},invisible:{scale:0,render:a=>""},default:{scale:1,render:a=>`${a}`}}),e=a=>r[a]||r.default,s=Object.freeze({aborted:i.red(t.cross),done:i.green(t.tick),exited:i.yellow(t.cross),default:i.cyan("?")});return ft={styles:r,render:e,symbols:s,symbol:(a,u,o)=>u?s.aborted:o?s.exited:a?s.done:s.default,delimiter:a=>i.gray(a?t.ellipsis:t.pointerSmall),item:(a,u)=>i.gray(a?u?t.pointerSmall:"+":t.line)},ft}var pt,Le;function yr(){if(Le)return pt;Le=1;const i=Pe();return pt=function(t,r){let e=String(i(t)||"").split(/\r?\n/);return r?e.map(s=>Math.ceil(s.length/r)).reduce((s,l)=>s+l):e.length},pt}var mt,Ve;function wr(){return Ve||(Ve=1,mt=(i,t={})=>{const r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",e=t.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((l,n)=>(n.length+r.length>=e||l[l.length-1].length+n.length+1<e?l[l.length-1]+=` ${n}`:l.push(`${r}${n}`),l),[r]).join(`
|
|
3
|
+
`)).join(`
|
|
4
|
+
`)}),mt}var gt,Be;function xr(){return Be||(Be=1,gt=(i,t,r)=>{r=r||t;let e=Math.min(t-r,i-Math.floor(r/2));e<0&&(e=0);let s=Math.min(e+r,t);return{startIndex:e,endIndex:s}}),gt}var vt,ke;function H(){return ke||(ke=1,vt={action:gr(),clear:vr(),style:br(),strip:Pe(),figures:sr(),lines:yr(),wrap:wr(),entriesToDisplay:xr()}),vt}var bt,Ye;function Y(){if(Ye)return bt;Ye=1;const i=rt,t=H(),r=t.action,e=rt,s=_(),l=s.beep,n=s.cursor,g=D();class a extends e{constructor(o={}){super(),this.firstRender=!0,this.in=o.stdin||process.stdin,this.out=o.stdout||process.stdout,this.onRender=(o.onRender||(()=>{})).bind(this);const d=i.createInterface({input:this.in,escapeCodeTimeout:50});i.emitKeypressEvents(this.in,d),this.in.isTTY&&this.in.setRawMode(!0);const f=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,h=(c,b)=>{let v=r(b,f);v===!1?this._&&this._(c,b):typeof this[v]=="function"?this[v](b):this.bell()};this.close=()=>{this.out.write(n.show),this.in.removeListener("keypress",h),this.in.isTTY&&this.in.setRawMode(!1),d.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",h)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(l)}render(){this.onRender(g),this.firstRender&&(this.firstRender=!1)}}return bt=a,bt}var yt,Ue;function $r(){if(Ue)return yt;Ue=1;function i(h,c,b,v,p,m,y){try{var w=h[m](y),x=w.value}catch(S){b(S);return}w.done?c(x):Promise.resolve(x).then(v,p)}function t(h){return function(){var c=this,b=arguments;return new Promise(function(v,p){var m=h.apply(c,b);function y(x){i(m,v,p,y,w,"next",x)}function w(x){i(m,v,p,y,w,"throw",x)}y(void 0)})}}const r=D(),e=Y(),s=_(),l=s.erase,n=s.cursor,g=H(),a=g.style,u=g.clear,o=g.lines,d=g.figures;class f extends e{constructor(c={}){super(c),this.transform=a.render(c.style),this.scale=this.transform.scale,this.msg=c.message,this.initial=c.initial||"",this.validator=c.validate||(()=>!0),this.value="",this.errorMsg=c.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=u("",this.out.columns),this.render()}set value(c){!c&&this.initial?(this.placeholder=!0,this.rendered=r.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(c)),this._value=c,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(`
|
|
5
|
+
`),this.close()}validate(){var c=this;return t(function*(){let b=yield c.validator(c.value);typeof b=="string"&&(c.errorMsg=b,b=!1),c.error=!b})()}submit(){var c=this;return t(function*(){if(c.value=c.value||c.initial,c.cursorOffset=0,c.cursor=c.rendered.length,yield c.validate(),c.error){c.red=!0,c.fire(),c.render();return}c.done=!0,c.aborted=!1,c.fire(),c.render(),c.out.write(`
|
|
6
|
+
`),c.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(c){this.placeholder||(this.cursor=this.cursor+c,this.cursorOffset+=c)}_(c,b){let v=this.value.slice(0,this.cursor),p=this.value.slice(this.cursor);this.value=`${v}${c}${p}`,this.red=!1,this.cursor=this.placeholder?0:v.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let c=this.value.slice(0,this.cursor-1),b=this.value.slice(this.cursor);this.value=`${c}${b}`,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 c=this.value.slice(0,this.cursor),b=this.value.slice(this.cursor+1);this.value=`${c}${b}`,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(n.down(o(this.outputError,this.out.columns)-1)+u(this.outputError,this.out.columns)),this.out.write(u(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[a.symbol(this.done,this.aborted),r.bold(this.msg),a.delimiter(this.done),this.red?r.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
7
|
+
`).reduce((c,b,v)=>c+`
|
|
8
|
+
${v?" ":d.pointerSmall} ${r.red().italic(b)}`,"")),this.out.write(l.line+n.to(0)+this.outputText+n.save+this.outputError+n.restore+n.move(this.cursorOffset,0)))}}return yt=f,yt}var wt,We;function Sr(){if(We)return wt;We=1;const i=D(),t=Y(),r=H(),e=r.style,s=r.clear,l=r.figures,n=r.wrap,g=r.entriesToDisplay,a=_(),u=a.cursor;class o extends t{constructor(f={}){super(f),this.msg=f.message,this.hint=f.hint||"- Use arrow-keys. Return to submit.",this.warn=f.warn||"- This option is disabled",this.cursor=f.initial||0,this.choices=f.choices.map((h,c)=>(typeof h=="string"&&(h={title:h,value:c}),{title:h&&(h.title||h.value||h),value:h&&(h.value===void 0?c:h.value),description:h&&h.description,selected:h&&h.selected,disabled:h&&h.disabled})),this.optionsPerPage=f.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=s("",this.out.columns),this.render()}moveCursor(f){this.cursor=f,this.value=this.choices[f].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(`
|
|
9
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
10
|
+
`),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()}_(f,h){if(f===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(u.hide):this.out.write(s(this.outputText,this.out.columns)),super.render();let f=g(this.cursor,this.choices.length,this.optionsPerPage),h=f.startIndex,c=f.endIndex;if(this.outputText=[e.symbol(this.done,this.aborted),i.bold(this.msg),e.delimiter(!1),this.done?this.selection.title:this.selection.disabled?i.yellow(this.warn):i.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
11
|
+
`;for(let b=h;b<c;b++){let v,p,m="",y=this.choices[b];b===h&&h>0?p=l.arrowUp:b===c-1&&c<this.choices.length?p=l.arrowDown:p=" ",y.disabled?(v=this.cursor===b?i.gray().underline(y.title):i.strikethrough().gray(y.title),p=(this.cursor===b?i.bold().gray(l.pointer)+" ":" ")+p):(v=this.cursor===b?i.cyan().underline(y.title):y.title,p=(this.cursor===b?i.cyan(l.pointer)+" ":" ")+p,y.description&&this.cursor===b&&(m=` - ${y.description}`,(p.length+v.length+m.length>=this.out.columns||y.description.split(/\r?\n/).length>1)&&(m=`
|
|
12
|
+
`+n(y.description,{margin:3,width:this.out.columns})))),this.outputText+=`${p} ${v}${i.gray(m)}
|
|
13
|
+
`}}this.out.write(this.outputText)}}return wt=o,wt}var xt,Ge;function Or(){if(Ge)return xt;Ge=1;const i=D(),t=Y(),r=H(),e=r.style,s=r.clear,l=_(),n=l.cursor,g=l.erase;class a extends t{constructor(o={}){super(o),this.msg=o.message,this.value=!!o.initial,this.active=o.active||"on",this.inactive=o.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(`
|
|
14
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
15
|
+
`),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()}_(o,d){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(n.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[e.symbol(this.done,this.aborted),i.bold(this.msg),e.delimiter(this.done),this.value?this.inactive:i.cyan().underline(this.inactive),i.gray("/"),this.value?i.cyan().underline(this.active):this.active].join(" "),this.out.write(g.line+n.to(0)+this.outputText))}}return xt=a,xt}var $t,Je;function V(){if(Je)return $t;Je=1;class i{constructor({token:r,date:e,parts:s,locales:l}){this.token=r,this.date=e||new Date,this.parts=s||[this],this.locales=l||{}}up(){}down(){}next(){const r=this.parts.indexOf(this);return this.parts.find((e,s)=>s>r&&e instanceof i)}setTo(r){}prev(){let r=[].concat(this.parts).reverse();const e=r.indexOf(this);return r.find((s,l)=>l>e&&s instanceof i)}toString(){return String(this.date)}}return $t=i,$t}var St,ze;function Mr(){if(ze)return St;ze=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}return St=t,St}var Ot,Ke;function Cr(){if(Ke)return Ot;Ke=1;const i=V(),t=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class r extends i{constructor(s={}){super(s)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(s){this.date.setDate(parseInt(s.substr(-2)))}toString(){let s=this.date.getDate(),l=this.date.getDay();return this.token==="DD"?String(s).padStart(2,"0"):this.token==="Do"?s+t(s):this.token==="d"?l+1:this.token==="ddd"?this.locales.weekdaysShort[l]:this.token==="dddd"?this.locales.weekdays[l]:s}}return Ot=r,Ot}var Mt,Ze;function Pr(){if(Ze)return Mt;Ze=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}return Mt=t,Mt}var Ct,Xe;function Ar(){if(Xe)return Ct;Xe=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Ct=t,Ct}var Pt,Qe;function Rr(){if(Qe)return Pt;Qe=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}return Pt=t,Pt}var At,ti;function Tr(){if(ti)return At;ti=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),s=this.token.length;return s===2?String(e+1).padStart(2,"0"):s===3?this.locales.monthsShort[e]:s===4?this.locales.months[e]:String(e+1)}}return At=t,At}var Rt,ei;function qr(){if(ei)return Rt;ei=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}return Rt=t,Rt}var Tt,ii;function Dr(){if(ii)return Tt;ii=1;const i=V();class t extends i{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}}return Tt=t,Tt}var qt,ri;function _r(){return ri||(ri=1,qt={DatePart:V(),Meridiem:Mr(),Day:Cr(),Hours:Pr(),Milliseconds:Ar(),Minutes:Rr(),Month:Tr(),Seconds:qr(),Year:Dr()}),qt}var Dt,si;function Er(){if(si)return Dt;si=1;function i(M,$,A,T,R,E,F){try{var j=M[E](F),I=j.value}catch(G){A(G);return}j.done?$(I):Promise.resolve(I).then(T,R)}function t(M){return function(){var $=this,A=arguments;return new Promise(function(T,R){var E=M.apply($,A);function F(I){i(E,T,R,F,j,"next",I)}function j(I){i(E,T,R,F,j,"throw",I)}F(void 0)})}}const r=D(),e=Y(),s=H(),l=s.style,n=s.clear,g=s.figures,a=_(),u=a.erase,o=a.cursor,d=_r(),f=d.DatePart,h=d.Meridiem,c=d.Day,b=d.Hours,v=d.Milliseconds,p=d.Minutes,m=d.Month,y=d.Seconds,w=d.Year,x=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,S={1:({token:M})=>M.replace(/\\(.)/g,"$1"),2:M=>new c(M),3:M=>new m(M),4:M=>new w(M),5:M=>new h(M),6:M=>new b(M),7:M=>new p(M),8:M=>new y(M),9:M=>new v(M)},O={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 C extends e{constructor($={}){super($),this.msg=$.message,this.cursor=0,this.typed="",this.locales=Object.assign(O,$.locales),this._date=$.initial||new Date,this.errorMsg=$.error||"Please Enter A Valid Value",this.validator=$.validate||(()=>!0),this.mask=$.mask||"YYYY-MM-DD HH:mm:ss",this.clear=n("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date($){$&&this._date.setTime($.getTime())}set mask($){let A;for(this.parts=[];A=x.exec($);){let R=A.shift(),E=A.findIndex(F=>F!=null);this.parts.push(E in S?S[E]({token:A[E]||R,date:this.date,parts:this.parts,locales:this.locales}):A[E]||R)}let T=this.parts.reduce((R,E)=>(typeof E=="string"&&typeof R[R.length-1]=="string"?R[R.length-1]+=E:R.push(E),R),[]);this.parts.splice(0),this.parts.push(...T),this.reset()}moveCursor($){this.typed="",this.cursor=$,this.fire()}reset(){this.moveCursor(this.parts.findIndex($=>$ instanceof f)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
16
|
+
`),this.close()}validate(){var $=this;return t(function*(){let A=yield $.validator($.value);typeof A=="string"&&($.errorMsg=A,A=!1),$.error=!A})()}submit(){var $=this;return t(function*(){if(yield $.validate(),$.error){$.color="red",$.fire(),$.render();return}$.done=!0,$.aborted=!1,$.fire(),$.render(),$.out.write(`
|
|
17
|
+
`),$.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let $=this.parts[this.cursor].prev();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}right(){let $=this.parts[this.cursor].next();if($==null)return this.bell();this.moveCursor(this.parts.indexOf($)),this.render()}next(){let $=this.parts[this.cursor].next();this.moveCursor($?this.parts.indexOf($):this.parts.findIndex(A=>A instanceof f)),this.render()}_($){/\d/.test($)&&(this.typed+=$,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(n(this.outputText,this.out.columns)),super.render(),this.outputText=[l.symbol(this.done,this.aborted),r.bold(this.msg),l.delimiter(!1),this.parts.reduce(($,A,T)=>$.concat(T===this.cursor&&!this.done?r.cyan().underline(A.toString()):A),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
18
|
+
`).reduce(($,A,T)=>$+`
|
|
19
|
+
${T?" ":g.pointerSmall} ${r.red().italic(A)}`,"")),this.out.write(u.line+o.to(0)+this.outputText))}}return Dt=C,Dt}var _t,ni;function Ir(){if(ni)return _t;ni=1;function i(v,p,m,y,w,x,S){try{var O=v[x](S),C=O.value}catch(M){m(M);return}O.done?p(C):Promise.resolve(C).then(y,w)}function t(v){return function(){var p=this,m=arguments;return new Promise(function(y,w){var x=v.apply(p,m);function S(C){i(x,y,w,S,O,"next",C)}function O(C){i(x,y,w,S,O,"throw",C)}S(void 0)})}}const r=D(),e=Y(),s=_(),l=s.cursor,n=s.erase,g=H(),a=g.style,u=g.figures,o=g.clear,d=g.lines,f=/[0-9]/,h=v=>v!==void 0,c=(v,p)=>{let m=Math.pow(10,p);return Math.round(v*m)/m};class b extends e{constructor(p={}){super(p),this.transform=a.render(p.style),this.msg=p.message,this.initial=h(p.initial)?p.initial:"",this.float=!!p.float,this.round=p.round||2,this.inc=p.increment||1,this.min=h(p.min)?p.min:-1/0,this.max=h(p.max)?p.max:1/0,this.errorMsg=p.error||"Please Enter A Valid Value",this.validator=p.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(p){!p&&p!==0?(this.placeholder=!0,this.rendered=r.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${c(p,this.round)}`),this._value=c(p,this.round)),this.fire()}get value(){return this._value}parse(p){return this.float?parseFloat(p):parseInt(p)}valid(p){return p==="-"||p==="."&&this.float||f.test(p)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let p=this.value;this.value=p!==""?p:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
20
|
+
`),this.close()}validate(){var p=this;return t(function*(){let m=yield p.validator(p.value);typeof m=="string"&&(p.errorMsg=m,m=!1),p.error=!m})()}submit(){var p=this;return t(function*(){if(yield p.validate(),p.error){p.color="red",p.fire(),p.render();return}let m=p.value;p.value=m!==""?m:p.initial,p.done=!0,p.aborted=!1,p.error=!1,p.fire(),p.render(),p.out.write(`
|
|
21
|
+
`),p.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 p=this.value.toString();if(p.length===0)return this.bell();this.value=this.parse(p=p.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()}_(p,m){if(!this.valid(p))return this.bell();const y=Date.now();if(y-this.lastHit>1e3&&(this.typed=""),this.typed+=p,this.lastHit=y,this.color="cyan",p===".")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(l.down(d(this.outputError,this.out.columns)-1)+o(this.outputError,this.out.columns)),this.out.write(o(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[a.symbol(this.done,this.aborted),r.bold(this.msg),a.delimiter(this.done),!this.done||!this.done&&!this.placeholder?r[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
22
|
+
`).reduce((p,m,y)=>p+`
|
|
23
|
+
${y?" ":u.pointerSmall} ${r.red().italic(m)}`,"")),this.out.write(n.line+l.to(0)+this.outputText+l.save+this.outputError+l.restore))}}return _t=b,_t}var Et,oi;function nr(){if(oi)return Et;oi=1;const i=D(),t=_(),r=t.cursor,e=Y(),s=H(),l=s.clear,n=s.figures,g=s.style,a=s.wrap,u=s.entriesToDisplay;class o extends e{constructor(f={}){super(f),this.msg=f.message,this.cursor=f.cursor||0,this.scrollIndex=f.cursor||0,this.hint=f.hint||"",this.warn=f.warn||"- This option is disabled -",this.minSelected=f.min,this.showMinError=!1,this.maxChoices=f.max,this.instructions=f.instructions,this.optionsPerPage=f.optionsPerPage||10,this.value=f.choices.map((h,c)=>(typeof h=="string"&&(h={title:h,value:c}),{title:h&&(h.title||h.value||h),description:h&&h.description,value:h&&(h.value===void 0?c:h.value),selected:h&&h.selected,disabled:h&&h.disabled})),this.clear=l("",this.out.columns),f.overrideRender||this.render()}reset(){this.value.map(f=>!f.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(f=>f.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
24
|
+
`),this.close()}submit(){const f=this.value.filter(h=>h.selected);this.minSelected&&f.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
25
|
+
`),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(f=>f.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const f=this.value[this.cursor];if(f.selected)f.selected=!1,this.render();else{if(f.disabled||this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();f.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const f=!this.value[this.cursor].selected;this.value.filter(h=>!h.disabled).forEach(h=>h.selected=f),this.render()}_(f,h){if(f===" ")this.handleSpaceToggle();else if(f==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
26
|
+
Instructions:
|
|
27
|
+
${n.arrowUp}/${n.arrowDown}: Highlight option
|
|
28
|
+
${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
|
|
29
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
30
|
+
`:"")+" enter/return: Complete answer":""}renderOption(f,h,c,b){const v=(h.selected?i.green(n.radioOn):n.radioOff)+" "+b+" ";let p,m;return h.disabled?p=f===c?i.gray().underline(h.title):i.strikethrough().gray(h.title):(p=f===c?i.cyan().underline(h.title):h.title,f===c&&h.description&&(m=` - ${h.description}`,(v.length+p.length+m.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(m=`
|
|
31
|
+
`+a(h.description,{margin:v.length,width:this.out.columns})))),v+p+i.gray(m||"")}paginateOptions(f){if(f.length===0)return i.red("No matches for this query.");let h=u(this.cursor,f.length,this.optionsPerPage),c=h.startIndex,b=h.endIndex,v,p=[];for(let m=c;m<b;m++)m===c&&c>0?v=n.arrowUp:m===b-1&&b<f.length?v=n.arrowDown:v=" ",p.push(this.renderOption(this.cursor,f[m],m,v));return`
|
|
32
|
+
`+p.join(`
|
|
33
|
+
`)}renderOptions(f){return this.done?"":this.paginateOptions(f)}renderDoneOrInstructions(){if(this.done)return this.value.filter(h=>h.selected).map(h=>h.title).join(", ");const f=[i.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&f.push(i.yellow(this.warn)),f.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let f=[g.symbol(this.done,this.aborted),i.bold(this.msg),g.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(f+=i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),f+=this.renderOptions(this.value),this.out.write(this.clear+f),this.clear=l(f,this.out.columns)}}return Et=o,Et}var It,ai;function jr(){if(ai)return It;ai=1;function i(p,m,y,w,x,S,O){try{var C=p[S](O),M=C.value}catch($){y($);return}C.done?m(M):Promise.resolve(M).then(w,x)}function t(p){return function(){var m=this,y=arguments;return new Promise(function(w,x){var S=p.apply(m,y);function O(M){i(S,w,x,O,C,"next",M)}function C(M){i(S,w,x,O,C,"throw",M)}O(void 0)})}}const r=D(),e=Y(),s=_(),l=s.erase,n=s.cursor,g=H(),a=g.style,u=g.clear,o=g.figures,d=g.wrap,f=g.entriesToDisplay,h=(p,m)=>p[m]&&(p[m].value||p[m].title||p[m]),c=(p,m)=>p[m]&&(p[m].title||p[m].value||p[m]),b=(p,m)=>{const y=p.findIndex(w=>w.value===m||w.title===m);return y>-1?y:void 0};class v extends e{constructor(m={}){super(m),this.msg=m.message,this.suggest=m.suggest,this.choices=m.choices,this.initial=typeof m.initial=="number"?m.initial:b(m.choices,m.initial),this.select=this.initial||m.cursor||0,this.i18n={noMatches:m.noMatches||"no matches found"},this.fallback=m.fallback||this.initial,this.clearFirst=m.clearFirst||!1,this.suggestions=[],this.input="",this.limit=m.limit||10,this.cursor=0,this.transform=a.render(m.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=u("",this.out.columns),this.complete(this.render),this.render()}set fallback(m){this._fb=Number.isSafeInteger(parseInt(m))?parseInt(m):m}get fallback(){let m;return typeof this._fb=="number"?m=this.choices[this._fb]:typeof this._fb=="string"&&(m={title:this._fb}),m||this._fb||{title:this.i18n.noMatches}}moveSelect(m){this.select=m,this.suggestions.length>0?this.value=h(this.suggestions,m):this.value=this.fallback.value,this.fire()}complete(m){var y=this;return t(function*(){const w=y.completing=y.suggest(y.input,y.choices),x=yield w;if(y.completing!==w)return;y.suggestions=x.map((O,C,M)=>({title:c(M,C),value:h(M,C),description:O.description})),y.completing=!1;const S=Math.max(x.length-1,0);y.moveSelect(Math.min(S,y.select)),m&&m()})()}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(`
|
|
34
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
35
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
36
|
+
`),this.close()}_(m,y){let w=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${w}${m}${x}`,this.cursor=w.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let m=this.input.slice(0,this.cursor-1),y=this.input.slice(this.cursor);this.input=`${m}${y}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let m=this.input.slice(0,this.cursor),y=this.input.slice(this.cursor+1);this.input=`${m}${y}`,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(m,y,w,x){let S,O=w?o.arrowUp:x?o.arrowDown:" ",C=y?r.cyan().underline(m.title):m.title;return O=(y?r.cyan(o.pointer)+" ":" ")+O,m.description&&(S=` - ${m.description}`,(O.length+C.length+S.length>=this.out.columns||m.description.split(/\r?\n/).length>1)&&(S=`
|
|
37
|
+
`+d(m.description,{margin:3,width:this.out.columns}))),O+" "+C+r.gray(S||"")}render(){if(this.closed)return;this.firstRender?this.out.write(n.hide):this.out.write(u(this.outputText,this.out.columns)),super.render();let m=f(this.select,this.choices.length,this.limit),y=m.startIndex,w=m.endIndex;if(this.outputText=[a.symbol(this.done,this.aborted,this.exited),r.bold(this.msg),a.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 x=this.suggestions.slice(y,w).map((S,O)=>this.renderOption(S,this.select===O+y,O===0&&y>0,O+y===w-1&&w<this.choices.length)).join(`
|
|
38
|
+
`);this.outputText+=`
|
|
39
|
+
`+(x||r.gray(this.fallback.title))}this.out.write(l.line+n.to(0)+this.outputText)}}return It=v,It}var jt,li;function Fr(){if(li)return jt;li=1;const i=D(),t=_(),r=t.cursor,e=nr(),s=H(),l=s.clear,n=s.style,g=s.figures;class a extends e{constructor(o={}){o.overrideRender=!0,super(o),this.inputValue="",this.clear=l("",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(o=>o.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 o=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(f=>this.inputValue?!!(typeof f.title=="string"&&f.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof f.value=="string"&&f.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const d=this.filteredOptions.findIndex(f=>f===o);this.cursor=d<0?0:d,this.render()}handleSpaceToggle(){const o=this.filteredOptions[this.cursor];if(o.selected)o.selected=!1,this.render();else{if(o.disabled||this.value.filter(d=>d.selected).length>=this.maxChoices)return this.bell();o.selected=!0,this.render()}}handleInputChange(o){this.inputValue=this.inputValue+o,this.updateFilteredOptions()}_(o,d){o===" "?this.handleSpaceToggle():this.handleInputChange(o)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
40
|
+
Instructions:
|
|
41
|
+
${g.arrowUp}/${g.arrowDown}: Highlight option
|
|
42
|
+
${g.arrowLeft}/${g.arrowRight}/[space]: Toggle selection
|
|
43
|
+
[a,b,c]/delete: Filter choices
|
|
44
|
+
enter/return: Complete answer
|
|
45
|
+
`:""}renderCurrentInput(){return`
|
|
46
|
+
Filtered results for: ${this.inputValue?this.inputValue:i.gray("Enter something to filter")}
|
|
47
|
+
`}renderOption(o,d,f){let h;return d.disabled?h=o===f?i.gray().underline(d.title):i.strikethrough().gray(d.title):h=o===f?i.cyan().underline(d.title):d.title,(d.selected?i.green(g.radioOn):g.radioOff)+" "+h}renderDoneOrInstructions(){if(this.done)return this.value.filter(d=>d.selected).map(d=>d.title).join(", ");const o=[i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&o.push(i.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(r.hide),super.render();let o=[n.symbol(this.done,this.aborted),i.bold(this.msg),n.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+o),this.clear=l(o,this.out.columns)}}return jt=a,jt}var Ft,hi;function Nr(){if(hi)return Ft;hi=1;const i=D(),t=Y(),r=H(),e=r.style,s=r.clear,l=_(),n=l.erase,g=l.cursor;class a extends t{constructor(o={}){super(o),this.msg=o.message,this.value=o.initial,this.initialValue=!!o.initial,this.yesMsg=o.yes||"yes",this.yesOption=o.yesOption||"(Y/n)",this.noMsg=o.no||"no",this.noOption=o.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(`
|
|
48
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
49
|
+
`),this.close()}_(o,d){return o.toLowerCase()==="y"?(this.value=!0,this.submit()):o.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(g.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[e.symbol(this.done,this.aborted),i.bold(this.msg),e.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:i.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(n.line+g.to(0)+this.outputText))}}return Ft=a,Ft}var Nt,ui;function Hr(){return ui||(ui=1,Nt={TextPrompt:$r(),SelectPrompt:Sr(),TogglePrompt:Or(),DatePrompt:Er(),NumberPrompt:Ir(),MultiselectPrompt:nr(),AutocompletePrompt:jr(),AutocompleteMultiselectPrompt:Fr(),ConfirmPrompt:Nr()}),Nt}var ci;function Lr(){return ci||(ci=1,(function(i){const t=i,r=Hr(),e=n=>n;function s(n,g,a={}){return new Promise((u,o)=>{const d=new r[n](g),f=a.onAbort||e,h=a.onSubmit||e,c=a.onExit||e;d.on("state",g.onState||e),d.on("submit",b=>u(h(b))),d.on("exit",b=>u(c(b))),d.on("abort",b=>o(f(b)))})}t.text=n=>s("TextPrompt",n),t.password=n=>(n.style="password",t.text(n)),t.invisible=n=>(n.style="invisible",t.text(n)),t.number=n=>s("NumberPrompt",n),t.date=n=>s("DatePrompt",n),t.confirm=n=>s("ConfirmPrompt",n),t.list=n=>{const g=n.separator||",";return s("TextPrompt",n,{onSubmit:a=>a.split(g).map(u=>u.trim())})},t.toggle=n=>s("TogglePrompt",n),t.select=n=>s("SelectPrompt",n),t.multiselect=n=>{n.choices=[].concat(n.choices||[]);const g=a=>a.filter(u=>u.selected).map(u=>u.value);return s("MultiselectPrompt",n,{onAbort:g,onSubmit:g})},t.autocompleteMultiselect=n=>{n.choices=[].concat(n.choices||[]);const g=a=>a.filter(u=>u.selected).map(u=>u.value);return s("AutocompleteMultiselectPrompt",n,{onAbort:g,onSubmit:g})};const l=(n,g)=>Promise.resolve(g.filter(a=>a.title.slice(0,n.length).toLowerCase()===n.toLowerCase()));t.autocomplete=n=>(n.suggest=n.suggest||l,n.choices=[].concat(n.choices||[]),s("AutocompletePrompt",n))})(ot)),ot}var Ht,di;function Vr(){if(di)return Ht;di=1;function i(v,p){var m=Object.keys(v);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(v);p&&(y=y.filter(function(w){return Object.getOwnPropertyDescriptor(v,w).enumerable})),m.push.apply(m,y)}return m}function t(v){for(var p=1;p<arguments.length;p++){var m=arguments[p]!=null?arguments[p]:{};p%2?i(Object(m),!0).forEach(function(y){r(v,y,m[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(m)):i(Object(m)).forEach(function(y){Object.defineProperty(v,y,Object.getOwnPropertyDescriptor(m,y))})}return v}function r(v,p,m){return p in v?Object.defineProperty(v,p,{value:m,enumerable:!0,configurable:!0,writable:!0}):v[p]=m,v}function e(v,p){var m=typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"];if(!m){if(Array.isArray(v)||(m=s(v))||p){m&&(v=m);var y=0,w=function(){};return{s:w,n:function(){return y>=v.length?{done:!0}:{done:!1,value:v[y++]}},e:function(M){throw M},f:w}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
50
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var x=!0,S=!1,O;return{s:function(){m=m.call(v)},n:function(){var M=m.next();return x=M.done,M},e:function(M){S=!0,O=M},f:function(){try{!x&&m.return!=null&&m.return()}finally{if(S)throw O}}}}function s(v,p){if(v){if(typeof v=="string")return l(v,p);var m=Object.prototype.toString.call(v).slice(8,-1);if(m==="Object"&&v.constructor&&(m=v.constructor.name),m==="Map"||m==="Set")return Array.from(v);if(m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return l(v,p)}}function l(v,p){(p==null||p>v.length)&&(p=v.length);for(var m=0,y=new Array(p);m<p;m++)y[m]=v[m];return y}function n(v,p,m,y,w,x,S){try{var O=v[x](S),C=O.value}catch(M){m(M);return}O.done?p(C):Promise.resolve(C).then(y,w)}function g(v){return function(){var p=this,m=arguments;return new Promise(function(y,w){var x=v.apply(p,m);function S(C){n(x,y,w,S,O,"next",C)}function O(C){n(x,y,w,S,O,"throw",C)}S(void 0)})}}const a=Lr(),u=["suggest","format","onState","validate","onRender","type"],o=()=>{};function d(){return f.apply(this,arguments)}function f(){return f=g(function*(v=[],{onSubmit:p=o,onCancel:m=o}={}){const y={},w=d._override||{};v=[].concat(v);let x,S,O,C,M,$;const A=(function(){var j=g(function*(I,G,De=!1){if(!(!De&&I.validate&&I.validate(G)!==!0))return I.format?yield I.format(G,y):G});return function(G,De){return j.apply(this,arguments)}})();var T=e(v),R;try{for(T.s();!(R=T.n()).done;){S=R.value;var E=S;if(C=E.name,M=E.type,typeof M=="function"&&(M=yield M(x,t({},y),S),S.type=M),!!M){for(let j in S){if(u.includes(j))continue;let I=S[j];S[j]=typeof I=="function"?yield I(x,t({},y),$):I}if($=S,typeof S.message!="string")throw new Error("prompt message is required");var F=S;if(C=F.name,M=F.type,a[M]===void 0)throw new Error(`prompt type (${M}) is not defined`);if(w[S.name]!==void 0&&(x=yield A(S,w[S.name]),x!==void 0)){y[C]=x;continue}try{x=d._injected?h(d._injected,S.initial):yield a[M](S),y[C]=x=yield A(S,x,!0),O=yield p(S,x,y)}catch{O=!(yield m(S,y))}if(O)return y}}}catch(j){T.e(j)}finally{T.f()}return y}),f.apply(this,arguments)}function h(v,p){const m=v.shift();if(m instanceof Error)throw m;return m===void 0?p:m}function c(v){d._injected=(d._injected||[]).concat(v)}function b(v){d._override=Object.assign({},v)}return Ht=Object.assign(d,{prompt:d,prompts:a,inject:c,override:b}),Ht}var Lt={},Vt,fi;function Br(){return fi||(fi=1,Vt=(i,t)=>{if(!(i.meta&&i.name!=="escape")){if(i.ctrl){if(i.name==="a")return"first";if(i.name==="c"||i.name==="d")return"abort";if(i.name==="e")return"last";if(i.name==="g")return"reset"}if(t){if(i.name==="j")return"down";if(i.name==="k")return"up"}return i.name==="return"||i.name==="enter"?"submit":i.name==="backspace"?"delete":i.name==="delete"?"deleteForward":i.name==="abort"?"abort":i.name==="escape"?"exit":i.name==="tab"?"next":i.name==="pagedown"?"nextPage":i.name==="pageup"?"prevPage":i.name==="home"?"home":i.name==="end"?"end":i.name==="up"?"up":i.name==="down"?"down":i.name==="right"?"right":i.name==="left"?"left":!1}}),Vt}var Bt,pi;function Ae(){return pi||(pi=1,Bt=i=>{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("|"),r=new RegExp(t,"g");return typeof i=="string"?i.replace(r,""):i}),Bt}var kt,mi;function kr(){if(mi)return kt;mi=1;const i=Ae(),{erase:t,cursor:r}=_(),e=s=>[...i(s)].length;return kt=function(s,l){if(!l)return t.line+r.to(0);let n=0;const g=s.split(/\r?\n/);for(let a of g)n+=1+Math.floor(Math.max(e(a)-1,0)/l);return t.lines(n)},kt}var Yt,gi;function or(){if(gi)return Yt;gi=1;const i={arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",radioOn:"◉",radioOff:"◯",tick:"✔",cross:"✖",ellipsis:"…",pointerSmall:"›",line:"─",pointer:"❯"},t={arrowUp:i.arrowUp,arrowDown:i.arrowDown,arrowLeft:i.arrowLeft,arrowRight:i.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"√",cross:"×",ellipsis:"...",pointerSmall:"»",line:"─",pointer:">"};return Yt=process.platform==="win32"?t:i,Yt}var Ut,vi;function Yr(){if(vi)return Ut;vi=1;const i=D(),t=or(),r=Object.freeze({password:{scale:1,render:a=>"*".repeat(a.length)},emoji:{scale:2,render:a=>"😃".repeat(a.length)},invisible:{scale:0,render:a=>""},default:{scale:1,render:a=>`${a}`}}),e=a=>r[a]||r.default,s=Object.freeze({aborted:i.red(t.cross),done:i.green(t.tick),exited:i.yellow(t.cross),default:i.cyan("?")});return Ut={styles:r,render:e,symbols:s,symbol:(a,u,o)=>u?s.aborted:o?s.exited:a?s.done:s.default,delimiter:a=>i.gray(a?t.ellipsis:t.pointerSmall),item:(a,u)=>i.gray(a?u?t.pointerSmall:"+":t.line)},Ut}var Wt,bi;function Ur(){if(bi)return Wt;bi=1;const i=Ae();return Wt=function(t,r){let e=String(i(t)||"").split(/\r?\n/);return r?e.map(s=>Math.ceil(s.length/r)).reduce((s,l)=>s+l):e.length},Wt}var Gt,yi;function Wr(){return yi||(yi=1,Gt=(i,t={})=>{const r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",e=t.width;return(i||"").split(/\r?\n/g).map(s=>s.split(/\s+/g).reduce((l,n)=>(n.length+r.length>=e||l[l.length-1].length+n.length+1<e?l[l.length-1]+=` ${n}`:l.push(`${r}${n}`),l),[r]).join(`
|
|
51
|
+
`)).join(`
|
|
52
|
+
`)}),Gt}var Jt,wi;function Gr(){return wi||(wi=1,Jt=(i,t,r)=>{r=r||t;let e=Math.min(t-r,i-Math.floor(r/2));e<0&&(e=0);let s=Math.min(e+r,t);return{startIndex:e,endIndex:s}}),Jt}var zt,xi;function L(){return xi||(xi=1,zt={action:Br(),clear:kr(),style:Yr(),strip:Ae(),figures:or(),lines:Ur(),wrap:Wr(),entriesToDisplay:Gr()}),zt}var Kt,$i;function U(){if($i)return Kt;$i=1;const i=rt,{action:t}=L(),r=rt,{beep:e,cursor:s}=_(),l=D();class n extends r{constructor(a={}){super(),this.firstRender=!0,this.in=a.stdin||process.stdin,this.out=a.stdout||process.stdout,this.onRender=(a.onRender||(()=>{})).bind(this);const u=i.createInterface({input:this.in,escapeCodeTimeout:50});i.emitKeypressEvents(this.in,u),this.in.isTTY&&this.in.setRawMode(!0);const o=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,d=(f,h)=>{let c=t(h,o);c===!1?this._&&this._(f,h):typeof this[c]=="function"?this[c](h):this.bell()};this.close=()=>{this.out.write(s.show),this.in.removeListener("keypress",d),this.in.isTTY&&this.in.setRawMode(!1),u.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",d)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(e)}render(){this.onRender(l),this.firstRender&&(this.firstRender=!1)}}return Kt=n,Kt}var Zt,Si;function Jr(){if(Si)return Zt;Si=1;const i=D(),t=U(),{erase:r,cursor:e}=_(),{style:s,clear:l,lines:n,figures:g}=L();class a extends t{constructor(o={}){super(o),this.transform=s.render(o.style),this.scale=this.transform.scale,this.msg=o.message,this.initial=o.initial||"",this.validator=o.validate||(()=>!0),this.value="",this.errorMsg=o.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=l("",this.out.columns),this.render()}set value(o){!o&&this.initial?(this.placeholder=!0,this.rendered=i.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(o)),this._value=o,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(`
|
|
53
|
+
`),this.close()}async validate(){let o=await this.validator(this.value);typeof o=="string"&&(this.errorMsg=o,o=!1),this.error=!o}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(`
|
|
54
|
+
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(o){this.placeholder||(this.cursor=this.cursor+o,this.cursorOffset+=o)}_(o,d){let f=this.value.slice(0,this.cursor),h=this.value.slice(this.cursor);this.value=`${f}${o}${h}`,this.red=!1,this.cursor=this.placeholder?0:f.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let o=this.value.slice(0,this.cursor-1),d=this.value.slice(this.cursor);this.value=`${o}${d}`,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 o=this.value.slice(0,this.cursor),d=this.value.slice(this.cursor+1);this.value=`${o}${d}`,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(e.down(n(this.outputError,this.out.columns)-1)+l(this.outputError,this.out.columns)),this.out.write(l(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[s.symbol(this.done,this.aborted),i.bold(this.msg),s.delimiter(this.done),this.red?i.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
55
|
+
`).reduce((o,d,f)=>o+`
|
|
56
|
+
${f?" ":g.pointerSmall} ${i.red().italic(d)}`,"")),this.out.write(r.line+e.to(0)+this.outputText+e.save+this.outputError+e.restore+e.move(this.cursorOffset,0)))}}return Zt=a,Zt}var Xt,Oi;function zr(){if(Oi)return Xt;Oi=1;const i=D(),t=U(),{style:r,clear:e,figures:s,wrap:l,entriesToDisplay:n}=L(),{cursor:g}=_();class a extends t{constructor(o={}){super(o),this.msg=o.message,this.hint=o.hint||"- Use arrow-keys. Return to submit.",this.warn=o.warn||"- This option is disabled",this.cursor=o.initial||0,this.choices=o.choices.map((d,f)=>(typeof d=="string"&&(d={title:d,value:f}),{title:d&&(d.title||d.value||d),value:d&&(d.value===void 0?f:d.value),description:d&&d.description,selected:d&&d.selected,disabled:d&&d.disabled})),this.optionsPerPage=o.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=e("",this.out.columns),this.render()}moveCursor(o){this.cursor=o,this.value=this.choices[o].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(`
|
|
57
|
+
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
58
|
+
`),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()}_(o,d){if(o===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(g.hide):this.out.write(e(this.outputText,this.out.columns)),super.render();let{startIndex:o,endIndex:d}=n(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[r.symbol(this.done,this.aborted),i.bold(this.msg),r.delimiter(!1),this.done?this.selection.title:this.selection.disabled?i.yellow(this.warn):i.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
59
|
+
`;for(let f=o;f<d;f++){let h,c,b="",v=this.choices[f];f===o&&o>0?c=s.arrowUp:f===d-1&&d<this.choices.length?c=s.arrowDown:c=" ",v.disabled?(h=this.cursor===f?i.gray().underline(v.title):i.strikethrough().gray(v.title),c=(this.cursor===f?i.bold().gray(s.pointer)+" ":" ")+c):(h=this.cursor===f?i.cyan().underline(v.title):v.title,c=(this.cursor===f?i.cyan(s.pointer)+" ":" ")+c,v.description&&this.cursor===f&&(b=` - ${v.description}`,(c.length+h.length+b.length>=this.out.columns||v.description.split(/\r?\n/).length>1)&&(b=`
|
|
60
|
+
`+l(v.description,{margin:3,width:this.out.columns})))),this.outputText+=`${c} ${h}${i.gray(b)}
|
|
61
|
+
`}}this.out.write(this.outputText)}}return Xt=a,Xt}var Qt,Mi;function Kr(){if(Mi)return Qt;Mi=1;const i=D(),t=U(),{style:r,clear:e}=L(),{cursor:s,erase:l}=_();class n extends t{constructor(a={}){super(a),this.msg=a.message,this.value=!!a.initial,this.active=a.active||"on",this.inactive=a.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(`
|
|
62
|
+
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
63
|
+
`),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()}_(a,u){if(a===" ")this.value=!this.value;else if(a==="1")this.value=!0;else if(a==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(s.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),i.bold(this.msg),r.delimiter(this.done),this.value?this.inactive:i.cyan().underline(this.inactive),i.gray("/"),this.value?i.cyan().underline(this.active):this.active].join(" "),this.out.write(l.line+s.to(0)+this.outputText))}}return Qt=n,Qt}var te,Ci;function B(){if(Ci)return te;Ci=1;class i{constructor({token:r,date:e,parts:s,locales:l}){this.token=r,this.date=e||new Date,this.parts=s||[this],this.locales=l||{}}up(){}down(){}next(){const r=this.parts.indexOf(this);return this.parts.find((e,s)=>s>r&&e instanceof i)}setTo(r){}prev(){let r=[].concat(this.parts).reverse();const e=r.indexOf(this);return r.find((s,l)=>l>e&&s instanceof i)}toString(){return String(this.date)}}return te=i,te}var ee,Pi;function Zr(){if(Pi)return ee;Pi=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}return ee=t,ee}var ie,Ai;function Xr(){if(Ai)return ie;Ai=1;const i=B(),t=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class r extends i{constructor(s={}){super(s)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(s){this.date.setDate(parseInt(s.substr(-2)))}toString(){let s=this.date.getDate(),l=this.date.getDay();return this.token==="DD"?String(s).padStart(2,"0"):this.token==="Do"?s+t(s):this.token==="d"?l+1:this.token==="ddd"?this.locales.weekdaysShort[l]:this.token==="dddd"?this.locales.weekdays[l]:s}}return ie=r,ie}var re,Ri;function Qr(){if(Ri)return re;Ri=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}return re=t,re}var se,Ti;function ts(){if(Ti)return se;Ti=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return se=t,se}var ne,qi;function es(){if(qi)return ne;qi=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}return ne=t,ne}var oe,Di;function is(){if(Di)return oe;Di=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),s=this.token.length;return s===2?String(e+1).padStart(2,"0"):s===3?this.locales.monthsShort[e]:s===4?this.locales.months[e]:String(e+1)}}return oe=t,oe}var ae,_i;function rs(){if(_i)return ae;_i=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}return ae=t,ae}var le,Ei;function ss(){if(Ei)return le;Ei=1;const i=B();class t extends i{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}}return le=t,le}var he,Ii;function ns(){return Ii||(Ii=1,he={DatePart:B(),Meridiem:Zr(),Day:Xr(),Hours:Qr(),Milliseconds:ts(),Minutes:es(),Month:is(),Seconds:rs(),Year:ss()}),he}var ue,ji;function os(){if(ji)return ue;ji=1;const i=D(),t=U(),{style:r,clear:e,figures:s}=L(),{erase:l,cursor:n}=_(),{DatePart:g,Meridiem:a,Day:u,Hours:o,Milliseconds:d,Minutes:f,Month:h,Seconds:c,Year:b}=ns(),v=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,p={1:({token:w})=>w.replace(/\\(.)/g,"$1"),2:w=>new u(w),3:w=>new h(w),4:w=>new b(w),5:w=>new a(w),6:w=>new o(w),7:w=>new f(w),8:w=>new c(w),9:w=>new d(w)},m={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 y extends t{constructor(x={}){super(x),this.msg=x.message,this.cursor=0,this.typed="",this.locales=Object.assign(m,x.locales),this._date=x.initial||new Date,this.errorMsg=x.error||"Please Enter A Valid Value",this.validator=x.validate||(()=>!0),this.mask=x.mask||"YYYY-MM-DD HH:mm:ss",this.clear=e("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(x){x&&this._date.setTime(x.getTime())}set mask(x){let S;for(this.parts=[];S=v.exec(x);){let C=S.shift(),M=S.findIndex($=>$!=null);this.parts.push(M in p?p[M]({token:S[M]||C,date:this.date,parts:this.parts,locales:this.locales}):S[M]||C)}let O=this.parts.reduce((C,M)=>(typeof M=="string"&&typeof C[C.length-1]=="string"?C[C.length-1]+=M:C.push(M),C),[]);this.parts.splice(0),this.parts.push(...O),this.reset()}moveCursor(x){this.typed="",this.cursor=x,this.fire()}reset(){this.moveCursor(this.parts.findIndex(x=>x instanceof g)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
64
|
+
`),this.close()}async validate(){let x=await this.validator(this.value);typeof x=="string"&&(this.errorMsg=x,x=!1),this.error=!x}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(`
|
|
65
|
+
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let x=this.parts[this.cursor].prev();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}right(){let x=this.parts[this.cursor].next();if(x==null)return this.bell();this.moveCursor(this.parts.indexOf(x)),this.render()}next(){let x=this.parts[this.cursor].next();this.moveCursor(x?this.parts.indexOf(x):this.parts.findIndex(S=>S instanceof g)),this.render()}_(x){/\d/.test(x)&&(this.typed+=x,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(n.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),i.bold(this.msg),r.delimiter(!1),this.parts.reduce((x,S,O)=>x.concat(O===this.cursor&&!this.done?i.cyan().underline(S.toString()):S),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
66
|
+
`).reduce((x,S,O)=>x+`
|
|
67
|
+
${O?" ":s.pointerSmall} ${i.red().italic(S)}`,"")),this.out.write(l.line+n.to(0)+this.outputText))}}return ue=y,ue}var ce,Fi;function as(){if(Fi)return ce;Fi=1;const i=D(),t=U(),{cursor:r,erase:e}=_(),{style:s,figures:l,clear:n,lines:g}=L(),a=/[0-9]/,u=f=>f!==void 0,o=(f,h)=>{let c=Math.pow(10,h);return Math.round(f*c)/c};class d extends t{constructor(h={}){super(h),this.transform=s.render(h.style),this.msg=h.message,this.initial=u(h.initial)?h.initial:"",this.float=!!h.float,this.round=h.round||2,this.inc=h.increment||1,this.min=u(h.min)?h.min:-1/0,this.max=u(h.max)?h.max:1/0,this.errorMsg=h.error||"Please Enter A Valid Value",this.validator=h.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(h){!h&&h!==0?(this.placeholder=!0,this.rendered=i.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${o(h,this.round)}`),this._value=o(h,this.round)),this.fire()}get value(){return this._value}parse(h){return this.float?parseFloat(h):parseInt(h)}valid(h){return h==="-"||h==="."&&this.float||a.test(h)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let h=this.value;this.value=h!==""?h:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
68
|
+
`),this.close()}async validate(){let h=await this.validator(this.value);typeof h=="string"&&(this.errorMsg=h,h=!1),this.error=!h}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let h=this.value;this.value=h!==""?h:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
69
|
+
`),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 h=this.value.toString();if(h.length===0)return this.bell();this.value=this.parse(h=h.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()}_(h,c){if(!this.valid(h))return this.bell();const b=Date.now();if(b-this.lastHit>1e3&&(this.typed=""),this.typed+=h,this.lastHit=b,this.color="cyan",h===".")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(r.down(g(this.outputError,this.out.columns)-1)+n(this.outputError,this.out.columns)),this.out.write(n(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[s.symbol(this.done,this.aborted),i.bold(this.msg),s.delimiter(this.done),!this.done||!this.done&&!this.placeholder?i[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
70
|
+
`).reduce((h,c,b)=>h+`
|
|
71
|
+
${b?" ":l.pointerSmall} ${i.red().italic(c)}`,"")),this.out.write(e.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore))}}return ce=d,ce}var de,Ni;function ar(){if(Ni)return de;Ni=1;const i=D(),{cursor:t}=_(),r=U(),{clear:e,figures:s,style:l,wrap:n,entriesToDisplay:g}=L();class a extends r{constructor(o={}){super(o),this.msg=o.message,this.cursor=o.cursor||0,this.scrollIndex=o.cursor||0,this.hint=o.hint||"",this.warn=o.warn||"- This option is disabled -",this.minSelected=o.min,this.showMinError=!1,this.maxChoices=o.max,this.instructions=o.instructions,this.optionsPerPage=o.optionsPerPage||10,this.value=o.choices.map((d,f)=>(typeof d=="string"&&(d={title:d,value:f}),{title:d&&(d.title||d.value||d),description:d&&d.description,value:d&&(d.value===void 0?f:d.value),selected:d&&d.selected,disabled:d&&d.disabled})),this.clear=e("",this.out.columns),o.overrideRender||this.render()}reset(){this.value.map(o=>!o.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(o=>o.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
72
|
+
`),this.close()}submit(){const o=this.value.filter(d=>d.selected);this.minSelected&&o.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
73
|
+
`),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(o=>o.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const o=this.value[this.cursor];if(o.selected)o.selected=!1,this.render();else{if(o.disabled||this.value.filter(d=>d.selected).length>=this.maxChoices)return this.bell();o.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const o=!this.value[this.cursor].selected;this.value.filter(d=>!d.disabled).forEach(d=>d.selected=o),this.render()}_(o,d){if(o===" ")this.handleSpaceToggle();else if(o==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
74
|
+
Instructions:
|
|
75
|
+
${s.arrowUp}/${s.arrowDown}: Highlight option
|
|
76
|
+
${s.arrowLeft}/${s.arrowRight}/[space]: Toggle selection
|
|
77
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
78
|
+
`:"")+" enter/return: Complete answer":""}renderOption(o,d,f,h){const c=(d.selected?i.green(s.radioOn):s.radioOff)+" "+h+" ";let b,v;return d.disabled?b=o===f?i.gray().underline(d.title):i.strikethrough().gray(d.title):(b=o===f?i.cyan().underline(d.title):d.title,o===f&&d.description&&(v=` - ${d.description}`,(c.length+b.length+v.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&(v=`
|
|
79
|
+
`+n(d.description,{margin:c.length,width:this.out.columns})))),c+b+i.gray(v||"")}paginateOptions(o){if(o.length===0)return i.red("No matches for this query.");let{startIndex:d,endIndex:f}=g(this.cursor,o.length,this.optionsPerPage),h,c=[];for(let b=d;b<f;b++)b===d&&d>0?h=s.arrowUp:b===f-1&&f<o.length?h=s.arrowDown:h=" ",c.push(this.renderOption(this.cursor,o[b],b,h));return`
|
|
80
|
+
`+c.join(`
|
|
81
|
+
`)}renderOptions(o){return this.done?"":this.paginateOptions(o)}renderDoneOrInstructions(){if(this.done)return this.value.filter(d=>d.selected).map(d=>d.title).join(", ");const o=[i.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&o.push(i.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let o=[l.symbol(this.done,this.aborted),i.bold(this.msg),l.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.value),this.out.write(this.clear+o),this.clear=e(o,this.out.columns)}}return de=a,de}var fe,Hi;function ls(){if(Hi)return fe;Hi=1;const i=D(),t=U(),{erase:r,cursor:e}=_(),{style:s,clear:l,figures:n,wrap:g,entriesToDisplay:a}=L(),u=(h,c)=>h[c]&&(h[c].value||h[c].title||h[c]),o=(h,c)=>h[c]&&(h[c].title||h[c].value||h[c]),d=(h,c)=>{const b=h.findIndex(v=>v.value===c||v.title===c);return b>-1?b:void 0};class f extends t{constructor(c={}){super(c),this.msg=c.message,this.suggest=c.suggest,this.choices=c.choices,this.initial=typeof c.initial=="number"?c.initial:d(c.choices,c.initial),this.select=this.initial||c.cursor||0,this.i18n={noMatches:c.noMatches||"no matches found"},this.fallback=c.fallback||this.initial,this.clearFirst=c.clearFirst||!1,this.suggestions=[],this.input="",this.limit=c.limit||10,this.cursor=0,this.transform=s.render(c.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=l("",this.out.columns),this.complete(this.render),this.render()}set fallback(c){this._fb=Number.isSafeInteger(parseInt(c))?parseInt(c):c}get fallback(){let c;return typeof this._fb=="number"?c=this.choices[this._fb]:typeof this._fb=="string"&&(c={title:this._fb}),c||this._fb||{title:this.i18n.noMatches}}moveSelect(c){this.select=c,this.suggestions.length>0?this.value=u(this.suggestions,c):this.value=this.fallback.value,this.fire()}async complete(c){const b=this.completing=this.suggest(this.input,this.choices),v=await b;if(this.completing!==b)return;this.suggestions=v.map((m,y,w)=>({title:o(w,y),value:u(w,y),description:m.description})),this.completing=!1;const p=Math.max(v.length-1,0);this.moveSelect(Math.min(p,this.select)),c&&c()}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(`
|
|
82
|
+
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
83
|
+
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
84
|
+
`),this.close()}_(c,b){let v=this.input.slice(0,this.cursor),p=this.input.slice(this.cursor);this.input=`${v}${c}${p}`,this.cursor=v.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let c=this.input.slice(0,this.cursor-1),b=this.input.slice(this.cursor);this.input=`${c}${b}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let c=this.input.slice(0,this.cursor),b=this.input.slice(this.cursor+1);this.input=`${c}${b}`,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(c,b,v,p){let m,y=v?n.arrowUp:p?n.arrowDown:" ",w=b?i.cyan().underline(c.title):c.title;return y=(b?i.cyan(n.pointer)+" ":" ")+y,c.description&&(m=` - ${c.description}`,(y.length+w.length+m.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(m=`
|
|
85
|
+
`+g(c.description,{margin:3,width:this.out.columns}))),y+" "+w+i.gray(m||"")}render(){if(this.closed)return;this.firstRender?this.out.write(e.hide):this.out.write(l(this.outputText,this.out.columns)),super.render();let{startIndex:c,endIndex:b}=a(this.select,this.choices.length,this.limit);if(this.outputText=[s.symbol(this.done,this.aborted,this.exited),i.bold(this.msg),s.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 v=this.suggestions.slice(c,b).map((p,m)=>this.renderOption(p,this.select===m+c,m===0&&c>0,m+c===b-1&&b<this.choices.length)).join(`
|
|
86
|
+
`);this.outputText+=`
|
|
87
|
+
`+(v||i.gray(this.fallback.title))}this.out.write(r.line+e.to(0)+this.outputText)}}return fe=f,fe}var pe,Li;function hs(){if(Li)return pe;Li=1;const i=D(),{cursor:t}=_(),r=ar(),{clear:e,style:s,figures:l}=L();class n extends r{constructor(a={}){a.overrideRender=!0,super(a),this.inputValue="",this.clear=e("",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(a=>a.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 a=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(o=>this.inputValue?!!(typeof o.title=="string"&&o.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof o.value=="string"&&o.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const u=this.filteredOptions.findIndex(o=>o===a);this.cursor=u<0?0:u,this.render()}handleSpaceToggle(){const a=this.filteredOptions[this.cursor];if(a.selected)a.selected=!1,this.render();else{if(a.disabled||this.value.filter(u=>u.selected).length>=this.maxChoices)return this.bell();a.selected=!0,this.render()}}handleInputChange(a){this.inputValue=this.inputValue+a,this.updateFilteredOptions()}_(a,u){a===" "?this.handleSpaceToggle():this.handleInputChange(a)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
88
|
+
Instructions:
|
|
89
|
+
${l.arrowUp}/${l.arrowDown}: Highlight option
|
|
90
|
+
${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection
|
|
91
|
+
[a,b,c]/delete: Filter choices
|
|
92
|
+
enter/return: Complete answer
|
|
93
|
+
`:""}renderCurrentInput(){return`
|
|
94
|
+
Filtered results for: ${this.inputValue?this.inputValue:i.gray("Enter something to filter")}
|
|
95
|
+
`}renderOption(a,u,o){let d;return u.disabled?d=a===o?i.gray().underline(u.title):i.strikethrough().gray(u.title):d=a===o?i.cyan().underline(u.title):u.title,(u.selected?i.green(l.radioOn):l.radioOff)+" "+d}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");const a=[i.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&a.push(i.yellow(this.warn)),a.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let a=[s.symbol(this.done,this.aborted),i.bold(this.msg),s.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(a+=i.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),a+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+a),this.clear=e(a,this.out.columns)}}return pe=n,pe}var me,Vi;function us(){if(Vi)return me;Vi=1;const i=D(),t=U(),{style:r,clear:e}=L(),{erase:s,cursor:l}=_();class n extends t{constructor(a={}){super(a),this.msg=a.message,this.value=a.initial,this.initialValue=!!a.initial,this.yesMsg=a.yes||"yes",this.yesOption=a.yesOption||"(Y/n)",this.noMsg=a.no||"no",this.noOption=a.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(`
|
|
96
|
+
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
97
|
+
`),this.close()}_(a,u){return a.toLowerCase()==="y"?(this.value=!0,this.submit()):a.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),i.bold(this.msg),r.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:i.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(s.line+l.to(0)+this.outputText))}}return me=n,me}var ge,Bi;function cs(){return Bi||(Bi=1,ge={TextPrompt:Jr(),SelectPrompt:zr(),TogglePrompt:Kr(),DatePrompt:os(),NumberPrompt:as(),MultiselectPrompt:ar(),AutocompletePrompt:ls(),AutocompleteMultiselectPrompt:hs(),ConfirmPrompt:us()}),ge}var ki;function ds(){return ki||(ki=1,(function(i){const t=i,r=cs(),e=n=>n;function s(n,g,a={}){return new Promise((u,o)=>{const d=new r[n](g),f=a.onAbort||e,h=a.onSubmit||e,c=a.onExit||e;d.on("state",g.onState||e),d.on("submit",b=>u(h(b))),d.on("exit",b=>u(c(b))),d.on("abort",b=>o(f(b)))})}t.text=n=>s("TextPrompt",n),t.password=n=>(n.style="password",t.text(n)),t.invisible=n=>(n.style="invisible",t.text(n)),t.number=n=>s("NumberPrompt",n),t.date=n=>s("DatePrompt",n),t.confirm=n=>s("ConfirmPrompt",n),t.list=n=>{const g=n.separator||",";return s("TextPrompt",n,{onSubmit:a=>a.split(g).map(u=>u.trim())})},t.toggle=n=>s("TogglePrompt",n),t.select=n=>s("SelectPrompt",n),t.multiselect=n=>{n.choices=[].concat(n.choices||[]);const g=a=>a.filter(u=>u.selected).map(u=>u.value);return s("MultiselectPrompt",n,{onAbort:g,onSubmit:g})},t.autocompleteMultiselect=n=>{n.choices=[].concat(n.choices||[]);const g=a=>a.filter(u=>u.selected).map(u=>u.value);return s("AutocompleteMultiselectPrompt",n,{onAbort:g,onSubmit:g})};const l=(n,g)=>Promise.resolve(g.filter(a=>a.title.slice(0,n.length).toLowerCase()===n.toLowerCase()));t.autocomplete=n=>(n.suggest=n.suggest||l,n.choices=[].concat(n.choices||[]),s("AutocompletePrompt",n))})(Lt)),Lt}var ve,Yi;function fs(){if(Yi)return ve;Yi=1;const i=ds(),t=["suggest","format","onState","validate","onRender","type"],r=()=>{};async function e(g=[],{onSubmit:a=r,onCancel:u=r}={}){const o={},d=e._override||{};g=[].concat(g);let f,h,c,b,v,p;const m=async(y,w,x=!1)=>{if(!(!x&&y.validate&&y.validate(w)!==!0))return y.format?await y.format(w,o):w};for(h of g)if({name:b,type:v}=h,typeof v=="function"&&(v=await v(f,{...o},h),h.type=v),!!v){for(let y in h){if(t.includes(y))continue;let w=h[y];h[y]=typeof w=="function"?await w(f,{...o},p):w}if(p=h,typeof h.message!="string")throw new Error("prompt message is required");if({name:b,type:v}=h,i[v]===void 0)throw new Error(`prompt type (${v}) is not defined`);if(d[h.name]!==void 0&&(f=await m(h,d[h.name]),f!==void 0)){o[b]=f;continue}try{f=e._injected?s(e._injected,h.initial):await i[v](h),o[b]=f=await m(h,f,!0),c=await a(h,f,o)}catch{c=!await u(h,o)}if(c)return o}return o}function s(g,a){const u=g.shift();if(u instanceof Error)throw u;return u===void 0?a:u}function l(g){e._injected=(e._injected||[]).concat(g)}function n(g){e._override=Object.assign({},g)}return ve=Object.assign(e,{prompt:e,prompts:i,inject:l,override:n}),ve}var be,Ui;function ps(){if(Ui)return be;Ui=1;function i(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let r=0,e=process.versions.node.split(".").map(Number);for(;r<t.length;r++){if(e[r]>t[r])return!1;if(t[r]>e[r])return!0}return!1}return be=i("8.6.0")?Vr():fs(),be}var ms=ps();const J=rr(ms);class Re{logger;constructor(t){this.logger=t.logger}log(...t){this.logger.log(...t)}info(...t){this.logger.info(...t)}warn(...t){this.logger.warn(...t)}error(...t){this.logger.error(...t)}debug(...t){this.logger.debug(...t)}async askForConfirmation(t="Do you want to continue?",r){return(await J({type:"confirm",name:"value",message:t,initial:r??!1})).value}async askForInput(t,r,e){return(await J({type:"text",name:"value",message:t,initial:r,...e}))?.value??null}async askForDate(t,r,e){return(await J({type:"date",name:"value",message:t,initial:r,...e}))?.value??null}async askForList(t,r,e){return(await J({type:"list",name:"value",message:t,initial:r,...e}))?.value??null}async askForToggle(t,r,e){return(await J({type:"toggle",name:"value",message:t,initial:r,...e}))?.value??null}async askForSelect(t,r,e){if(r.length===0)throw new Error("No options provided");const s=[];for(const n of r)typeof n=="string"?s.push({title:n,value:n}):s.push(n);return(await J({type:"select",name:"value",message:t,choices:s,...e}))?.value??null}newLoader(t="",r=["⠙","⠘","⠰","⠴","⠤","⠦","⠆","⠃","⠋","⠉"],e=100){let s=t,l=null,n=0;const g=setInterval(function(){l&&(process.stdout.write(new TextEncoder().encode("\r"+" ".repeat(l.length+5)+"\r")),l=null),process.stdout.write(new TextEncoder().encode("\r"+r[n++]+" "+s)),n=n%r.length},e),a=()=>{clearInterval(g),process.stdout.write(new TextEncoder().encode("\r"+" ".repeat(s.length+5)+"\r"))};return{[Symbol.dispose]:a,[Symbol.asyncDispose]:a,updateText:u=>{l=s,s=u},stop:a}}}const ye=10,Wi=(i=0)=>t=>`\x1B[${t+i}m`,Gi=(i=0)=>t=>`\x1B[${38+i};5;${t}m`,Ji=(i=0)=>(t,r,e)=>`\x1B[${38+i};2;${t};${r};${e}m`,q={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(q.modifier);const gs=Object.keys(q.color),vs=Object.keys(q.bgColor);[...gs,...vs];function bs(){const i=new Map;for(const[t,r]of Object.entries(q)){for(const[e,s]of Object.entries(r))q[e]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[e]=q[e],i.set(s[0],s[1]);Object.defineProperty(q,t,{value:r,enumerable:!1})}return Object.defineProperty(q,"codes",{value:i,enumerable:!1}),q.color.close="\x1B[39m",q.bgColor.close="\x1B[49m",q.color.ansi=Wi(),q.color.ansi256=Gi(),q.color.ansi16m=Ji(),q.bgColor.ansi=Wi(ye),q.bgColor.ansi256=Gi(ye),q.bgColor.ansi16m=Ji(ye),Object.defineProperties(q,{rgbToAnsi256:{value(t,r,e){return t===r&&r===e?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(e/255*5)},enumerable:!1},hexToRgb:{value(t){const r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[e]=r;e.length===3&&(e=[...e].map(l=>l+l).join(""));const s=Number.parseInt(e,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:t=>q.rgbToAnsi256(...q.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,e,s;if(t>=232)r=((t-232)*10+8)/255,e=r,s=r;else{t-=16;const g=t%36;r=Math.floor(t/36)/5,e=Math.floor(g/6)/5,s=g%6/5}const l=Math.max(r,e,s)*2;if(l===0)return 30;let n=30+(Math.round(s)<<2|Math.round(e)<<1|Math.round(r));return l===2&&(n+=60),n},enumerable:!1},rgbToAnsi:{value:(t,r,e)=>q.ansi256ToAnsi(q.rgbToAnsi256(t,r,e)),enumerable:!1},hexToAnsi:{value:t=>q.ansi256ToAnsi(q.hexToAnsi256(t)),enumerable:!1}}),q}const N=bs(),zi=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const i=navigator.userAgentData.brands.find(({brand:t})=>t==="Chromium");if(i&&i.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),Ki=zi!==0&&{level:zi},ys={stdout:Ki,stderr:Ki};function ws(i,t,r){let e=i.indexOf(t);if(e===-1)return i;const s=t.length;let l=0,n="";do n+=i.slice(l,e)+t+r,l=e+s,e=i.indexOf(t,l);while(e!==-1);return n+=i.slice(l),n}function xs(i,t,r,e){let s=0,l="";do{const n=i[e-1]==="\r";l+=i.slice(s,n?e-1:e)+t+(n?`\r
|
|
98
|
+
`:`
|
|
99
|
+
`)+r,s=e+1,e=i.indexOf(`
|
|
100
|
+
`,s)}while(e!==-1);return l+=i.slice(s),l}const{stdout:Zi,stderr:Xi}=ys,$e=Symbol("GENERATOR"),z=Symbol("STYLER"),X=Symbol("IS_EMPTY"),Qi=["ansi","ansi","ansi256","ansi16m"],K=Object.create(null),$s=(i,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=Zi?Zi.level:0;i.level=t.level===void 0?r:t.level},Ss=i=>{const t=(...r)=>r.join(" ");return $s(t,i),Object.setPrototypeOf(t,et.prototype),t};function et(i){return Ss(i)}Object.setPrototypeOf(et.prototype,Function.prototype);for(const[i,t]of Object.entries(N))K[i]={get(){const r=st(this,Oe(t.open,t.close,this[z]),this[X]);return Object.defineProperty(this,i,{value:r}),r}};K.visible={get(){const i=st(this,this[z],!0);return Object.defineProperty(this,"visible",{value:i}),i}};const Se=(i,t,r,...e)=>i==="rgb"?t==="ansi16m"?N[r].ansi16m(...e):t==="ansi256"?N[r].ansi256(N.rgbToAnsi256(...e)):N[r].ansi(N.rgbToAnsi(...e)):i==="hex"?Se("rgb",t,r,...N.hexToRgb(...e)):N[r][i](...e),Os=["rgb","hex","ansi256"];for(const i of Os){K[i]={get(){const{level:r}=this;return function(...e){const s=Oe(Se(i,Qi[r],"color",...e),N.color.close,this[z]);return st(this,s,this[X])}}};const t="bg"+i[0].toUpperCase()+i.slice(1);K[t]={get(){const{level:r}=this;return function(...e){const s=Oe(Se(i,Qi[r],"bgColor",...e),N.bgColor.close,this[z]);return st(this,s,this[X])}}}}const Ms=Object.defineProperties(()=>{},{...K,level:{enumerable:!0,get(){return this[$e].level},set(i){this[$e].level=i}}}),Oe=(i,t,r)=>{let e,s;return r===void 0?(e=i,s=t):(e=r.openAll+i,s=t+r.closeAll),{open:i,close:t,openAll:e,closeAll:s,parent:r}},st=(i,t,r)=>{const e=(...s)=>Cs(e,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(e,Ms),e[$e]=i,e[z]=t,e[X]=r,e},Cs=(i,t)=>{if(i.level<=0||!t)return i[X]?"":t;let r=i[z];if(r===void 0)return t;const{openAll:e,closeAll:s}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=ws(t,r.close,r.open),r=r.parent;const l=t.indexOf(`
|
|
101
|
+
`);return l!==-1&&(t=xs(t,s,e,l)),e+t+s};Object.defineProperties(et.prototype,K);const P=et();et({level:Xi?Xi.level:0});var we,tr;function Ps(){if(tr)return we;tr=1;function i(e,s){var l=e;s.slice(0,-1).forEach(function(g){l=l[g]||{}});var n=s[s.length-1];return n in l}function t(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function r(e,s){return s==="constructor"&&typeof e[s]=="function"||s==="__proto__"}return we=function(e,s){s||(s={});var l={bools:{},strings:{},unknownFn:null};typeof s.unknown=="function"&&(l.unknownFn=s.unknown),typeof s.boolean=="boolean"&&s.boolean?l.allBools=!0:[].concat(s.boolean).filter(Boolean).forEach(function(O){l.bools[O]=!0});var n={};function g(O){return n[O].some(function(C){return l.bools[C]})}Object.keys(s.alias||{}).forEach(function(O){n[O]=[].concat(s.alias[O]),n[O].forEach(function(C){n[C]=[O].concat(n[O].filter(function(M){return C!==M}))})}),[].concat(s.string).filter(Boolean).forEach(function(O){l.strings[O]=!0,n[O]&&[].concat(n[O]).forEach(function(C){l.strings[C]=!0})});var a=s.default||{},u={_:[]};function o(O,C){return l.allBools&&/^--[^=]+$/.test(C)||l.strings[O]||l.bools[O]||n[O]}function d(O,C,M){for(var $=O,A=0;A<C.length-1;A++){var T=C[A];if(r($,T))return;$[T]===void 0&&($[T]={}),($[T]===Object.prototype||$[T]===Number.prototype||$[T]===String.prototype)&&($[T]={}),$[T]===Array.prototype&&($[T]=[]),$=$[T]}var R=C[C.length-1];r($,R)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[R]===void 0||l.bools[R]||typeof $[R]=="boolean"?$[R]=M:Array.isArray($[R])?$[R].push(M):$[R]=[$[R],M])}function f(O,C,M){if(!(M&&l.unknownFn&&!o(O,M)&&l.unknownFn(M)===!1)){var $=!l.strings[O]&&t(C)?Number(C):C;d(u,O.split("."),$),(n[O]||[]).forEach(function(A){d(u,A.split("."),$)})}}Object.keys(l.bools).forEach(function(O){f(O,a[O]===void 0?!1:a[O])});var h=[];e.indexOf("--")!==-1&&(h=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var c=0;c<e.length;c++){var b=e[c],v,p;if(/^--.+=/.test(b)){var m=b.match(/^--([^=]+)=([\s\S]*)$/);v=m[1];var y=m[2];l.bools[v]&&(y=y!=="false"),f(v,y,b)}else if(/^--no-.+/.test(b))v=b.match(/^--no-(.+)/)[1],f(v,!1,b);else if(/^--.+/.test(b))v=b.match(/^--(.+)/)[1],p=e[c+1],p!==void 0&&!/^(-|--)[^-]/.test(p)&&!l.bools[v]&&!l.allBools&&(!n[v]||!g(v))?(f(v,p,b),c+=1):/^(true|false)$/.test(p)?(f(v,p==="true",b),c+=1):f(v,l.strings[v]?"":!0,b);else if(/^-[^-]+/.test(b)){for(var w=b.slice(1,-1).split(""),x=!1,S=0;S<w.length;S++){if(p=b.slice(S+2),p==="-"){f(w[S],p,b);continue}if(/[A-Za-z]/.test(w[S])&&p[0]==="="){f(w[S],p.slice(1),b),x=!0;break}if(/[A-Za-z]/.test(w[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){f(w[S],p,b),x=!0;break}if(w[S+1]&&w[S+1].match(/\W/)){f(w[S],b.slice(S+2),b),x=!0;break}else f(w[S],l.strings[w[S]]?"":!0,b)}v=b.slice(-1)[0],!x&&v!=="-"&&(e[c+1]&&!/^(-|--)[^-]/.test(e[c+1])&&!l.bools[v]&&(!n[v]||!g(v))?(f(v,e[c+1],b),c+=1):e[c+1]&&/^(true|false)$/.test(e[c+1])?(f(v,e[c+1]==="true",b),c+=1):f(v,l.strings[v]?"":!0,b))}else if((!l.unknownFn||l.unknownFn(b)!==!1)&&u._.push(l.strings._||!t(b)?b:Number(b)),s.stopEarly){u._.push.apply(u._,e.slice(c+1));break}}return Object.keys(a).forEach(function(O){i(u,O.split("."))||(d(u,O.split("."),a[O]),(n[O]||[]).forEach(function(C){d(u,C.split("."),a[O])}))}),s["--"]?u["--"]=h.slice():h.forEach(function(O){u._.push(O)}),u},we}var As=Ps();const Rs=rr(As);class W extends Error{}function er(i){if(i==="string"||i==="number")return null;if(i==="boolean")return!1;if(Array.isArray(i)&&i.length===1){if(i[0]==="string")return[];if(i[0]==="number")return[]}throw new Error("Invalid option type: "+i)}function ir(i){return typeof i=="string"||Array.isArray(i)?er(i):i.default!==void 0?i.default:er(i.type)}function k(i){return typeof i=="string"||Array.isArray(i)?{alias:[],default:ir(i),description:"",required:!1,secret:!1,type:i,variadic:!1}:{alias:i.alias?Array.isArray(i.alias)?i.alias:[i.alias]:[],default:i.default??ir(i.type),description:i.description??"",required:i.required??!1,secret:i.secret??!1,type:i.type,variadic:i.variadic??!1}}class it extends W{constructor(t,r={}){super(`Invalid option ${t} in not recognized`),this.option=t,this.optionsSchema=r}pretty(t){const r=Object.entries(this.optionsSchema);if(r.length>0){t.log(`
|
|
102
|
+
${P.yellow("Available options")}:`);for(const[e,s]of r){const l=k(s),n=l.alias?typeof l.alias=="string"?[l.alias]:l.alias:[],g=Array.isArray(l.type)?`[${l.type[0]}]`:l.type,a=`--${e}${n.length>0?n.map(o=>`, -${o}`).join(""):""}`,u=" ".repeat(30-a.length);t.log(` ${P.green(a)} ${u} ${l.description||"\b"} ${P.white(`(${g})`)}`)}t.log("")}t.log(`${P.white.bgRed(" ERROR ")} Option ${P.bold.yellow(this.option)} is not recognized.`)}}class Me extends W{constructor(t){super(`Argument "${t}" is required.`),this.argument=t}pretty(t){t.log(`${P.white.bgRed(" ERROR ")} Argument ${P.bold.yellow(this.argument)} is required.`)}}class lr extends W{constructor(t){super(`Argument "${t}" is required.`),this.option=t}pretty(t){t.log(`${P.white.bgRed(" ERROR ")} Option ${P.bold.yellow(this.option)} is required.`)}}class Ts extends W{constructor(t){let r=`Argument "${t.param}" value is invalid.`;t.reason?r+=` Reason: ${t.reason}`:r+=` Value: "${t.value}"`,super(r),this.param=t}pretty(t){t.log(` ${P.white.bgRed(" ERROR ")} Argument ${P.bold.yellow(this.param.param)} value is invalid. `),(this.param.value||this.param.reason)&&t.log(""),this.param.value&&t.log(` ${P.blue("Value")}: ${this.param.value}`),this.param.reason&&t.log(` ${P.yellow("Reason")}: ${this.param.reason}`)}}class nt extends W{constructor(t){let r=`Option "${t.option}" value is invalid.`;t.reason?r+=` Reason: ${t.reason}`:r+=` Value: "${t.value}"`,super(r),this.param=t}pretty(t){t.log(` ${P.white.bgRed(" ERROR ")} Option ${P.bold.yellow(this.param.option)} value is invalid. `),(this.param.value||this.param.reason)&&t.log(""),this.param.value&&t.log(` ${P.blue("Value")}: ${this.param.value}`),this.param.reason&&t.log(` ${P.yellow("Reason")}: ${this.param.reason}`)}}class hr extends W{constructor(t){super(`Command "${t}" not found.`),this.command=t}pretty(t){t.log(`${P.bgRed(" ERROR ")} Command ${P.yellow(this.command)} not found.`)}}function Z(i,t,r,e){if(i==null)return e??null;if(t==="string")return String(i);if(t==="number"){const s=Number(i);if(isNaN(s))throw new nt({option:r,reason:`Expected a number, got "${i}"`});return s}if(t==="boolean")return typeof i=="boolean"?i:i==="true"||i==="1"?!0:i==="false"||i==="0"?!1:!!i;if(Array.isArray(t)){const s=t[0],l=Array.isArray(i)?i:[i];if(s==="string")return l.map(n=>String(n));if(s==="number")return l.map(n=>{const g=Number(n);if(isNaN(g))throw new nt({option:r,reason:`Expected array of numbers, got "${n}" in array`});return g})}return i}class Te{options;parsedOptions=null;arguments;parsedArguments=null;io;shouldPromptForMissingOptions=!0;constructor(t){this.options=t.options,this.arguments=t.arguments,this.io=t.io}init(t){const{_:r,...e}=Rs(t);return this.validateUnknownOptions(e),this.parsedOptions=this.handleOptions(e),this.parsedArguments=this.handleArguments(r),{options:this.parsedOptions,arguments:this.parsedArguments}}async validate(){for(const t in this.options)if(k(this.options[t]).required&&(this.parsedOptions?.[t]===void 0||this.parsedOptions?.[t]===null))throw new lr(t);for(const t in this.arguments){const r=k(this.arguments[t]),e=this.parsedArguments?.[t];if(r.required&&e==null){if(this.shouldPromptForMissingOptions){const s=await this.promptForArgument(t,r);if(s&&this.parsedArguments){this.parsedArguments[t]=Z(s,r.type,t);continue}}throw new Me(t)}if(r.required&&r.variadic&&Array.isArray(e)&&e.length===0){if(this.shouldPromptForMissingOptions){const s=await this.promptForArgument(t,r);if(s&&this.parsedArguments){this.parsedArguments[t]=Z(s,r.type,t);continue}}throw new Me(t)}}}option(t,r){if(!this.parsedOptions)throw new Error("Options have not been parsed yet. Call init() first.");return this.isEmptyValue(this.parsedOptions[t])&&r!==void 0?r:this.parsedOptions[t]}setOption(t,r){if(!this.parsedOptions)throw new Error("Options have not been parsed yet. Call init() first.");if(!(t in this.options))throw new it(t,this.options);this.parsedOptions[t]=r}argument(t,r){if(!this.parsedArguments)throw new Error("Arguments have not been parsed yet. Call init() first.");return this.isEmptyValue(this.parsedArguments[t])&&r!==void 0?r:this.parsedArguments[t]}setArgument(t,r){if(!this.parsedArguments)throw new Error("Arguments have not been parsed yet. Call init() first.");if(!(t in this.arguments))throw new it(t,this.arguments);this.parsedArguments[t]=r}isEmptyValue(t){return t==null||Array.isArray(t)&&t.length===0}validateUnknownOptions(t){const r=new Set;for(const e in this.options){r.add(e);const s=k(this.options[e]);for(const l of s.alias)r.add(l)}for(const e in t)if(!r.has(e))throw new it(e,this.options)}handleOptions(t){const r={};for(const e in this.options){const s=k(this.options[e]);r[e]=this.resolveOptionValue(e,s,t)}return r}handleArguments(t){const r={},e=[...t];for(const s in this.arguments){const l=k(this.arguments[s]);if(l.variadic){r[s]=this.handleVariadicArgument(s,l,e);continue}r[s]=this.resolveArgumentValue(s,l,e.shift())}return r}handleVariadicArgument(t,r,e){return e.length?Z(e,r.type,t,r.default):r.default}resolveArgumentValue(t,r,e){return e===void 0?r.default:Z(e,r.type,t,r.default)}resolveOptionValue(t,r,e){let s;const l=[t,...r.alias];for(const n of l)if(n in e){s=e[n];break}if(s===void 0){if(r.required)throw new nt({option:t,reason:"Required option is missing"});return r.default}return Z(s,r.type,t,r.default)}optionDefinitions(){const t={};for(const r in this.options)t[r]=k(this.options[r]);return t}argumentDefinitions(){const t={};for(const r in this.arguments)t[r]=k(this.arguments[r]);return t}availableOptions(){return Object.keys(this.options)}availableArguments(){return Object.keys(this.arguments)}disablePrompting(){return this.shouldPromptForMissingOptions=!1,this}async promptForArgument(t,r){if(!Array.isArray(r.type)&&!["string","number","secret"].includes(r.type))return null;let e=`${P.yellow.bold(t)} is required`;return r.description&&(e+=`: ${P.gray(`(${r.description})`)}`),e+=` ${P.green(`(${r.type}${r.variadic==!0?"[]":""})`)}
|
|
103
|
+
`,Array.isArray(r.type)?(e+=`Please provide one or more values, separated by commas:
|
|
104
|
+
`,await this.io.askForList(e,void 0,{separator:",",validate:s=>{if(!s.length)return"Please enter at least one value";if(r.type[0]==="number"){for(const l of s.split(","))if(isNaN(Number(l)))return"Please enter only valid numbers"}return!0}})):await this.io.askForInput(e,void 0,{type:r.type==="number"?"number":r.secret?"password":"text",validate:s=>{if(s==null||typeof s=="string"&&!s.length)return"This value is required";if(r.type==="number"){const l=Number(s);if(isNaN(l))return"Please enter a valid number"}else if(r.type==="string"&&(typeof s!="string"||!s.length))return"Please enter a valid text";return!0}})}}function Ce(i){return new Array(i+5).join(" ")}class ur{type="boolean";option="help";alias=["h"];default=!1;description=`Display help for the given command. When no command is given display help for the ${P.green("list")} command`;async handler(){const t=this.parser.argumentDefinitions(),r=this.parser.optionDefinitions(),e=Object.entries(t),s=Object.entries(r),l=s.map(([o,d])=>{const f=Array.isArray(d.alias)?d.alias:d.alias?[d.alias]:[];return{name:o,...d,optionWithAlias:`--${o}${f.map(h=>`, -${h}`).join("")}`}}),n=e.filter(([,o])=>o.required);this.io.log(P.yellow("Description:")),this.io.log(` ${this.description}
|
|
105
|
+
`),this.io.log(P.yellow("Usage:")),this.io.log(` ${this.command} ${n.length>0?n.map(([o])=>`<${o}>`).join(" "):"\b"} [options]`);const g=Math.max(...l.map(o=>o.optionWithAlias.length),0),a=Math.max(...e.map(([o])=>o.length),0),u=a>g?a:g;if(e.length>0){this.io.log(`
|
|
106
|
+
${P.yellow("Arguments")}:`);for(const[o,d]of e){const f=Ce(u-o.length);let h=` ${P.green(o)} ${f} ${d.description??"\b"}`;if(d.default!==void 0&&!d.required){const b=(Array.isArray(d.type)?`[${d.type[0]}]`:d.type)==="array"||Array.isArray(d.type)?JSON.stringify(d.default):d.default;h+=` ${P.yellow(`[default: ${b}]`)}`}d.variadic&&(h+=` ${P.white("(variadic)")}`),this.io.log(h)}}if(s.length>0){this.io.log(`
|
|
107
|
+
${P.yellow("Options")}:`);for(const o of l){const d=Ce(u-o.optionWithAlias.length);let f=`${P.green(o.optionWithAlias)} ${d} ${o.description??"\b"}`;if(o.type){const h=Array.isArray(o.type)?`[${o.type[0]}]`:o.type;f+=` ${P.white(`(${h})`)}`}if(o.default!==void 0&&!o.required){const c=(Array.isArray(o.type)?`[${o.type[0]}]`:o.type)==="array"||Array.isArray(o.type)?JSON.stringify(o.default):o.default;f+=` ${P.yellow(`[default: ${c}]`)}`}this.io.log(f)}}if(this.commandsExamples.length>0){this.io.log(`
|
|
108
|
+
${P.yellow("Examples")}:`);let o=process.argv[0].split("/").pop();o==="node"&&(o+=" "+process.argv[1].split("/").pop());for(const[d,f]of this.commandsExamples.entries())d>0&&this.io.log(""),this.io.log(` ${f.description}
|
|
109
|
+
`),this.io.log(` ${P.green(`${o} ${f.command}`)}`)}return-1}}class Q{_command;description;group;commandsExamples=[];get command(){return this._command}ctx;io;parser;disablePromptingFlag=!1;_preHandler;_handler;tmp;defaultOptions(){return[new ur]}newCommandParser(t){return new Te({io:t.io,options:t.options,arguments:t.arguments})}newCommandIO(t){return new Re(t)}constructor(t,r){this._command=t,this.description=r?.description??"",this.group=r?.group,this.tmp={options:r?.options??{},arguments:r?.arguments??{}};const e=this.defaultOptions();if(e.length>0)for(const s of e)this.tmp.options[s.option]=s}disablePrompting(){return this.disablePromptingFlag=!0,this}preHandler(t){return this._preHandler=t,this}handler(t){return this._handler=t,this}options(t){return this.tmp={options:{...this.tmp?.options??{},...t},arguments:this.tmp?.arguments??{}},this}arguments(t){return this.tmp={options:this.tmp?.options??{},arguments:{...this.tmp?.arguments??{},...t}},this}async run(t){if(!this._handler&&!this.handle)throw new Error(`No handler defined for command ${this.command||"(unknown)"}`);let r;if(this.ctx=t.ctx,this.io=this.newCommandIO({logger:t.logger}),t&&"args"in t){const s=this.tmp?.options??{};for(const l of this.defaultOptions())l.option in s||(s[l.option]=l);this.parser=this.newCommandParser({io:this.io,options:s,arguments:this.tmp?.arguments??{}}),r=this.parser.init(t.args);for(const l of this.defaultOptions())if(r.options[l.option]===!0){const n=await l.handler.call(this);if(n&&n!==0)return n}this.disablePromptingFlag&&this.parser.disablePrompting(),await this.parser.validate()}else r={options:t.options,arguments:t.arguments};if(!this._preHandler&&this.preHandle&&(this._preHandler=this.preHandle.bind(this)),this._preHandler){const s=await this._preHandler(t.ctx,r);if(s&&s!==0)return s}if(!this._handler&&this.handle)this._handler=this.handle.bind(this);else if(!this._handler)throw new Error(`No handler defined for command ${this.command||"(unknown)"}`);return await this._handler(t.ctx,r)??0}}class tt extends Te{command;constructor(t){const r=tt.parseSignature(t.signature,t.helperDefinitions,t.defaultOptions);super({io:t.io,options:r.options,arguments:r.arguments}),this.command=r.command}static parseSignature(t,r,e){const[s,...l]=t.split(/\{(.*?)\}/g).map(a=>a.trim()).filter(Boolean),n={},g={};for(const a of l){const{name:u,isOption:o,definition:d}=tt.parseParamSignature(a,r);o?n[u]=d:g[u]=d}for(const a of e)n[a.option]={type:a.type,required:a.required,alias:a.alias,variadic:a.variadic??!1,description:a.description,default:a.default??null};return{command:s,options:n,arguments:g}}static parseParamSignature(t,r){let e=t,s=!1;const l={required:!0,type:"string",description:void 0,default:null,variadic:!1};if(e.includes(":")){const[n,g]=e.split(":");e=n.trim(),l.description=g.trim()}if(e.includes("=")){const[n,g]=e.split("=");e=n.trim(),l.default=g.trim(),l.required=!1,typeof l.default=="string"&&!l.default.length?l.default=null:l.default==="true"?(l.default=!0,l.type="boolean"):l.default==="false"&&(l.default=!1,l.type="boolean")}else e.startsWith("--")&&(l.required=!1,l.default=!1,l.type="boolean");if(e.includes("|")){const[n,...g]=e.split("|");e=n.trim(),l.alias=g.map(a=>a.trim())}return e.startsWith("--")&&(s=!0,e=e.slice(2)),l.default==="*"&&(l.default=[],l.type=["string"]),e.endsWith("?")&&(l.required=!1,e=e.slice(0,-1)),e.endsWith("*")&&(l.type=["string"],l.variadic=!0,l.default=[],e=e.slice(0,-1)),l.description=l.description??r[e]??r[`--${e}`],{name:e,isOption:s,definition:l}}}class qs extends Q{helperDefinitions={};get command(){return this.parser?this.parser.command:this.signature.split(" ")[0]}newCommandParser(t){return new tt({io:t.io,signature:this.signature,helperDefinitions:this.helperDefinitions,defaultOptions:this.defaultOptions()})}constructor(){super("")}option(t,r=null){return this.parser.option(t,r)}argument(t,r=null){return this.parser.argument(t,r)}async askForConfirmation(...t){return this.io.askForConfirmation(...t)}async askForInput(...t){return this.io.askForInput(...t)}async askForSelect(...t){return this.io.askForSelect(...t)}newLoader(...t){return this.io.newLoader(...t)}}class qe{level;constructor(t={}){this.level=t.level??"info"}shouldLog(t){const r=["debug","info","warn","error"],e=r.indexOf(this.level);return r.indexOf(t)>=e}setLevel(t){this.level=t}getLevel(){return this.level}log(...t){console.log(...t)}info(...t){this.shouldLog("info")&&console.log(...t)}warn(...t){this.shouldLog("warn")&&console.warn(...t)}error(...t){this.shouldLog("error")&&console.error(...t)}debug(...t){this.shouldLog("debug")&&console.log(...t)}}class cr{getBigrams(t){const r=[],e=t.toLowerCase();for(let s=0;s<e.length-1;s++)r.push(e.slice(s,s+2));return r}calculateSimilarity(t,r){if(t===r)return 1;if(t.length<2||r.length<2)return 0;const e=this.getBigrams(t),s=this.getBigrams(r),l=new Set(s);let n=0;for(const g of e)l.has(g)&&(n++,l.delete(g));return 2*n/(e.length+s.length)}findBestMatch(t,r){const e=r.map(n=>({target:n,rating:this.calculateSimilarity(t,n)}));let s=0,l=e[0]?.rating??0;for(let n=1;n<e.length;n++)e[n].rating>l&&(l=e[n].rating,s=n);return{ratings:e,bestMatch:e[s],bestMatchIndex:s}}}class dr{commands={};io;logger;stringSimilarity;newCommandIO(t){return new Re(t)}constructor(t){this.logger=t?.logger??new qe,this.io=this.newCommandIO({logger:this.logger}),this.stringSimilarity=t?.stringSimilarity??new cr}getAvailableCommands(){return Object.keys(this.commands)}getCommands(){return Object.values(this.commands)}importFile=async t=>(await import(t)).default;commandResolver=async t=>{let r=await this.importFile(t);if(!r)throw new Error(`The command at path ${t} does not have a default export.`);return r&&typeof r=="object"&&"default"in r&&(r=r.default),typeof r=="function"?new r:r instanceof Q?r:null};withCommandResolver(t){return this.commandResolver=t,this}withFileImporter(t){return this.importFile=t,this}registerCommand(t,r=!1){const e=t.command;if(!e)throw new Error("Command signature is invalid, it must have a command name.");if(!r&&this.commands[e])throw new Error(`Command ${e} already registered.`);this.commands[e]=t}async loadCommandsPath(t){for await(const r of this.listCommandsFiles(t))try{const e=await this.commandResolver(r);e instanceof Q&&this.registerCommand(e)}catch(e){throw new Error(`Command ${r} failed to load. ${e}`,{cause:e})}}async runCommand(t,r,...e){const s=typeof r=="string"?this.commands[r]:r,l=typeof r=="string"?r:s.command;if(!s){const n=await this.suggestCommand(l);return n?await this.runCommand(t,n,...e):1}return await s.run({ctx:t,logger:this.logger,args:e})??0}async suggestCommand(t){const r=this.getAvailableCommands(),{bestMatch:e,bestMatchIndex:s,ratings:l}=this.stringSimilarity.findBestMatch(t,r),n=l.filter(g=>g.rating>.3).map(g=>g.target);if(e.rating>0&&n.length<=1||e.rating>.7&&n.length>1){const g=r[s];return await this.askRunSimilarCommand(t,g)?g:null}if(n.length){this.io.error(`${P.bgRed(" ERROR ")} Command ${P.yellow(t)} not found.
|
|
110
|
+
`);const g=await this.io.askForSelect(P.green("Did you mean to run one of these commands instead?"),n);if(g)return g}throw new hr(t)}async askRunSimilarCommand(t,r){return this.io.error(`${P.bgRed(" ERROR ")} Command ${P.yellow(t)} not found.
|
|
111
|
+
`),this.io.askForConfirmation(`${P.green(`Do you want to run ${P.yellow(r)} instead?`)} `)}async*listCommandsFiles(t){const r=(void 0)(t,{withFileTypes:!0});for(const e of r){const s=xe.resolve(t,e.name);if(e.isDirectory())yield*this.listCommandsFiles(xe.resolve(t,e.name));else{if(!s.endsWith(".ts")&&!s.endsWith(".js")&&!s.endsWith(".mjs")&&!s.endsWith(".cjs"))continue;yield s}}}}class fr{logger;constructor(t){this.logger=t}handle(t){if(t instanceof W)return t.pretty(this.logger),-1;throw t}}class Ds extends Q{constructor(t){super("help",{description:P.bold("Show help information about the CLI and its commands")}),this.opts=t}async handle(){const t=this.opts.commandRegistry.getCommands(),r=this.opts.cliName??"Bob CLI",e=this.opts.cliVersion??"0.0.0",s=(await Promise.resolve().then(()=>require("../package-Bc9feA2X.cjs")))?.default?.version??"0.0.0";this.io.log(`${r} ${P.green(e)} (core: ${P.yellow(s)})
|
|
12
112
|
|
|
13
|
-
${
|
|
113
|
+
${P.yellow("Usage")}:
|
|
14
114
|
command [options] [arguments]
|
|
15
115
|
|
|
16
|
-
${
|
|
17
|
-
`);const
|
|
116
|
+
${P.yellow("Available commands")}:
|
|
117
|
+
`);const l=Math.max(...t.map(a=>a.command.length))??0,n={};for(const a of t){const u=a.group??a.command.split(":")[0];n[u]||(n[u]=[]),n[u].push(a)}const g=Object.entries(n).sort(([a],[u])=>a.toLowerCase().localeCompare(u.toLowerCase())).sort(([,a],[,u])=>a.length-u.length);for(const[a,u]of g){const o=u.length>1;o&&this.io.log(P.yellow(`${a}:`));const d=u.sort((f,h)=>f.command.toLowerCase().localeCompare(h.command.toLowerCase()));for(const f of d){let h=Ce(l-f.command.length);o&&(h=h.slice(2)),this.io.log(`${o?" ":""}${P.green(f.command)} ${h} ${f.description}`)}}}}class _s{ctx;logger;commandRegistry;exceptionHandler;helpCommand;newCommandRegistry(t){return new dr(t)}newHelpCommand(t){return new Ds(t)}newExceptionHandler(t){return new fr(t.logger)}constructor(t={}){this.ctx=t.ctx,this.logger=t.logger??new qe,this.commandRegistry=this.newCommandRegistry({logger:this.logger}),this.exceptionHandler=this.newExceptionHandler({logger:this.logger}),this.helpCommand=this.newHelpCommand({cliName:t.name,cliVersion:t.version,commandRegistry:this.commandRegistry})}withCommandResolver(t){return this.commandRegistry.withCommandResolver(t),this}withFileImporter(t){return this.commandRegistry.withFileImporter(t),this}async withCommands(...t){for(const r of t)typeof r=="string"?await this.commandRegistry.loadCommandsPath(r):typeof r=="function"?this.registerCommand(new r):this.registerCommand(r)}async runCommand(t,...r){return t?await this.commandRegistry.runCommand(this.ctx??{},t,...r).catch(this.exceptionHandler.handle.bind(this.exceptionHandler)):await this.runHelpCommand()}async runHelpCommand(){return await this.runCommand(this.helpCommand)}registerCommand(t){this.commandRegistry.registerCommand(t)}}exports.BadCommandOption=nt;exports.BadCommandParameter=Ts;exports.BobError=W;exports.Cli=_s;exports.Command=Q;exports.CommandIO=Re;exports.CommandNotFoundError=hr;exports.CommandParser=Te;exports.CommandRegistry=dr;exports.CommandSignatureParser=tt;exports.CommandWithSignature=qs;exports.ExceptionHandler=fr;exports.HelpOption=ur;exports.InvalidOption=it;exports.Logger=qe;exports.MissingRequiredArgumentValue=Me;exports.MissingRequiredOptionValue=lr;exports.StringSimilarity=cr;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const t = "bob-core", s = "2.0.0-beta.
|
|
1
|
+
const t = "bob-core", s = "2.0.0-beta.19", e = "BOB Core", i = "module", n = "./dist/cjs/src/index.js", r = "./dist/esm/src/index.js", c = "./dist/esm/src/index.d.ts", o = ["dist"], d = { ".": { import: { types: "./dist/esm/src/index.d.ts", default: "./dist/esm/src/index.js" }, require: { types: "./dist/cjs/src/index.d.ts", default: "./dist/cjs/src/index.js" } } }, p = { start: "node -r @swc-node/register debug/main.ts", build: "rimraf ./dist && vite build", typecheck: "tsc --noEmit", prepack: "npm run build", test: "vitest run", lint: "eslint .", "lint:fix": "eslint . --fix" }, l = "Léo Hubert", m = "ISC", a = { "@eslint/js": "^9.37.0", "@faker-js/faker": "^10.0.0", "@swc-node/register": "^1.11.1", "@trivago/prettier-plugin-sort-imports": "^5.2.2", "@types/minimist": "^1.2.5", "@types/node": "^20.14.5", "@types/prompts": "^2.4.9", "@types/string-similarity": "^4.0.2", "@vitest/coverage-v8": "^3.2.4", eslint: "^9.37.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-prettier": "^5.5.4", prettier: "^3.6.2", rimraf: "^6.0.1", tsx: "^4.20.6", typescript: "^5.9.3", "typescript-eslint": "^8.46.0", vite: "^7.2.7", "vite-plugin-dts": "^4.5.4", vitest: "^3.2.4" }, u = { chalk: "^5.6.2", minimist: "^1.2.8", prompts: "^2.4.2" }, x = {
|
|
2
2
|
name: t,
|
|
3
3
|
version: s,
|
|
4
4
|
description: e,
|