@ooneex/cli 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,38 +1,226 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var Do=Object.create;var{getPrototypeOf:Bo,defineProperty:Dt,getOwnPropertyNames:Oo}=Object;var Po=Object.prototype.hasOwnProperty;function Io(e){return this[e]}var Lo,$o,Y=(e,t,s)=>{var r=e!=null&&typeof e==="object";if(r){var i=t?Lo??=new WeakMap:$o??=new WeakMap,o=i.get(e);if(o)return o}s=e!=null?Do(Bo(e)):{};let n=t||!e||!e.__esModule?Dt(s,"default",{value:e,enumerable:!0}):s;for(let a of Oo(e))if(!Po.call(n,a))Dt(n,a,{get:Io.bind(e,a),enumerable:!0});if(r)i.set(e,n);return n};var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=function(e,t,s,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,s):r,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)if(n=e[a])o=(i<3?n(o):i>3?n(t,s,o):n(t,s))||o;return i>3&&o&&Object.defineProperty(t,s,o),o};var he=import.meta.require;var Lt=g((_d,fe)=>{var Ko=typeof process<"u"&&process.env.TERM_PROGRAM==="Hyper",Wo=typeof process<"u"&&process.platform==="win32",Ot=typeof process<"u"&&process.platform==="linux",ke={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",question:"?",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},Pt=Object.assign({},ke,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),It=Object.assign({},ke,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:Ot?"\u25B8":"\u276F",pointerSmall:Ot?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});fe.exports=Wo&&!Ko?Pt:It;Reflect.defineProperty(fe.exports,"common",{enumerable:!1,value:ke});Reflect.defineProperty(fe.exports,"windows",{enumerable:!1,value:Pt});Reflect.defineProperty(fe.exports,"other",{enumerable:!1,value:It})});var Se=g((Rd,et)=>{var Ho=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),Yo=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Vo=()=>{if(typeof process<"u")return process.env.FORCE_COLOR!=="0";return!1},$t=()=>{let e={enabled:Vo(),visible:!0,styles:{},keys:{}},t=(o)=>{let n=o.open=`\x1B[${o.codes[0]}m`,a=o.close=`\x1B[${o.codes[1]}m`,p=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(l,d)=>{if(l.includes(a))l=l.replace(p,a+n);let c=n+l+a;return d?c.replace(/\r*\n/g,`${a}$&${n}`):c},o},s=(o,n,a)=>{return typeof o==="function"?o(n):o.wrap(n,a)},r=(o,n)=>{if(o===""||o==null)return"";if(e.enabled===!1)return o;if(e.visible===!1)return"";let a=""+o,p=a.includes(`
4
- `),l=n.length;if(l>0&&n.includes("unstyle"))n=[...new Set(["unstyle",...n])].reverse();while(l-- >0)a=s(e.styles[n[l]],a,p);return a},i=(o,n,a)=>{e.styles[o]=t({name:o,codes:n}),(e.keys[a]||(e.keys[a]=[])).push(o),Reflect.defineProperty(e,o,{configurable:!0,enumerable:!0,set(l){e.alias(o,l)},get(){let l=(d)=>r(d,l.stack);return Reflect.setPrototypeOf(l,e),l.stack=this.stack?this.stack.concat(o):[o],l}})};return i("reset",[0,0],"modifier"),i("bold",[1,22],"modifier"),i("dim",[2,22],"modifier"),i("italic",[3,23],"modifier"),i("underline",[4,24],"modifier"),i("inverse",[7,27],"modifier"),i("hidden",[8,28],"modifier"),i("strikethrough",[9,29],"modifier"),i("black",[30,39],"color"),i("red",[31,39],"color"),i("green",[32,39],"color"),i("yellow",[33,39],"color"),i("blue",[34,39],"color"),i("magenta",[35,39],"color"),i("cyan",[36,39],"color"),i("white",[37,39],"color"),i("gray",[90,39],"color"),i("grey",[90,39],"color"),i("bgBlack",[40,49],"bg"),i("bgRed",[41,49],"bg"),i("bgGreen",[42,49],"bg"),i("bgYellow",[43,49],"bg"),i("bgBlue",[44,49],"bg"),i("bgMagenta",[45,49],"bg"),i("bgCyan",[46,49],"bg"),i("bgWhite",[47,49],"bg"),i("blackBright",[90,39],"bright"),i("redBright",[91,39],"bright"),i("greenBright",[92,39],"bright"),i("yellowBright",[93,39],"bright"),i("blueBright",[94,39],"bright"),i("magentaBright",[95,39],"bright"),i("cyanBright",[96,39],"bright"),i("whiteBright",[97,39],"bright"),i("bgBlackBright",[100,49],"bgBright"),i("bgRedBright",[101,49],"bgBright"),i("bgGreenBright",[102,49],"bgBright"),i("bgYellowBright",[103,49],"bgBright"),i("bgBlueBright",[104,49],"bgBright"),i("bgMagentaBright",[105,49],"bgBright"),i("bgCyanBright",[106,49],"bgBright"),i("bgWhiteBright",[107,49],"bgBright"),e.ansiRegex=Yo,e.hasColor=e.hasAnsi=(o)=>{return e.ansiRegex.lastIndex=0,typeof o==="string"&&o!==""&&e.ansiRegex.test(o)},e.alias=(o,n)=>{let a=typeof n==="string"?e[n]:n;if(typeof a!=="function")throw TypeError("Expected alias to be the name of an existing color (string) or a function");if(!a.stack)Reflect.defineProperty(a,"name",{value:o}),e.styles[o]=a,a.stack=[o];Reflect.defineProperty(e,o,{configurable:!0,enumerable:!0,set(p){e.alias(o,p)},get(){let p=(l)=>r(l,p.stack);return Reflect.setPrototypeOf(p,e),p.stack=this.stack?this.stack.concat(a.stack):a.stack,p}})},e.theme=(o)=>{if(!Ho(o))throw TypeError("Expected theme to be an object");for(let n of Object.keys(o))e.alias(n,o[n]);return e},e.alias("unstyle",(o)=>{if(typeof o==="string"&&o!=="")return e.ansiRegex.lastIndex=0,o.replace(e.ansiRegex,"");return""}),e.alias("noop",(o)=>o),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=Lt(),e.define=i,e};et.exports=$t();et.exports.create=$t});var R=g((Qo)=>{var Fo=Object.prototype.toString,P=Se(),Ut=!1,ye=new Set,qt={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};Qo.longest=(e,t)=>{return e.reduce((s,r)=>Math.max(s,t?r[t].length:r.length),0)};Qo.hasColor=(e)=>!!e&&P.hasColor(e);var Ne=Qo.isObject=(e)=>{return e!==null&&typeof e==="object"&&!Array.isArray(e)};Qo.nativeType=(e)=>{return Fo.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")};Qo.isAsyncFn=(e)=>{return Qo.nativeType(e)==="asyncfunction"};Qo.isPrimitive=(e)=>{return e!=null&&typeof e!=="object"&&typeof e!=="function"};Qo.resolve=(e,t,...s)=>{if(typeof t==="function")return t.call(e,...s);return t};Qo.scrollDown=(e=[])=>[...e.slice(1),e[0]];Qo.scrollUp=(e=[])=>[e.pop(),...e];Qo.reorder=(e=[])=>{let t=e.slice();return t.sort((s,r)=>{if(s.index>r.index)return 1;if(s.index<r.index)return-1;return 0}),t};Qo.swap=(e,t,s)=>{let r=e.length,i=s===r?0:s<0?r-1:s,o=e[t];e[t]=e[i],e[i]=o};Qo.width=(e,t=80)=>{let s=e&&e.columns?e.columns:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[0];if(process.platform==="win32")return s-1;return s};Qo.height=(e,t=20)=>{let s=e&&e.rows?e.rows:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[1];return s};Qo.wordWrap=(e,t={})=>{if(!e)return e;if(typeof t==="number")t={width:t};let{indent:s="",newline:r=`
5
- `+s,width:i=80}=t,o=(r+s).match(/[^\S\n]/g)||[];i-=o.length;let n=`.{1,${i}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,a=e.trim(),p=new RegExp(n,"g"),l=a.match(p)||[];if(l=l.map((d)=>d.replace(/\n$/,"")),t.padEnd)l=l.map((d)=>d.padEnd(i," "));if(t.padStart)l=l.map((d)=>d.padStart(i," "));return s+l.join(r)};Qo.unmute=(e)=>{let t=e.stack.find((r)=>P.keys.color.includes(r));if(t)return P[t];if(e.stack.find((r)=>r.slice(2)==="bg"))return P[t.slice(2)];return(r)=>r};Qo.pascal=(e)=>e?e[0].toUpperCase()+e.slice(1):"";Qo.inverse=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>P.keys.color.includes(r));if(t){let r=P["bg"+Qo.pascal(t)];return r?r.black:e}let s=e.stack.find((r)=>r.slice(0,2)==="bg");if(s)return P[s.slice(2).toLowerCase()]||e;return P.none};Qo.complement=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>P.keys.color.includes(r)),s=e.stack.find((r)=>r.slice(0,2)==="bg");if(t&&!s)return P[qt[t]||t];if(s){let r=s.slice(2).toLowerCase(),i=qt[r];if(!i)return e;return P["bg"+Qo.pascal(i)]||e}return P.none};Qo.meridiem=(e)=>{let t=e.getHours(),s=e.getMinutes(),r=t>=12?"pm":"am";t=t%12;let i=t===0?12:t,o=s<10?"0"+s:s;return i+":"+o+" "+r};Qo.set=(e={},t="",s)=>{return t.split(".").reduce((r,i,o,n)=>{let a=n.length-1>o?r[i]||{}:s;if(!Qo.isObject(a)&&o<n.length-1)a={};return r[i]=a},e)};Qo.get=(e={},t="",s)=>{let r=e[t]==null?t.split(".").reduce((i,o)=>i&&i[o],e):e[t];return r==null?s:r};Qo.mixin=(e,t)=>{if(!Ne(e))return t;if(!Ne(t))return e;for(let s of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,s);if(hasOwnProperty.call(r,"value"))if(hasOwnProperty.call(e,s)&&Ne(r.value)){let i=Object.getOwnPropertyDescriptor(e,s);if(Ne(i.value)&&i.value!==r.value)e[s]=Qo.merge({},e[s],t[s]);else Reflect.defineProperty(e,s,r)}else Reflect.defineProperty(e,s,r);else Reflect.defineProperty(e,s,r)}return e};Qo.merge=(...e)=>{let t={};for(let s of e)Qo.mixin(t,s);return t};Qo.mixinEmitter=(e,t)=>{let s=t.constructor.prototype;for(let r of Object.keys(s)){let i=s[r];if(typeof i==="function")Qo.define(e,r,i.bind(t));else Qo.define(e,r,i)}};var Me=(e,t)=>{if(Ut)return;if(Ut=!0,ye.forEach((s)=>s()),e===!0)process.exit(128+t)},Gt=Me.bind(null,!0,15),Kt=Me.bind(null,!0,2);Qo.onExit=(e)=>{if(ye.size===0)process.once("SIGTERM",Gt),process.once("SIGINT",Kt),process.once("exit",Me);return ye.add(e),()=>{if(ye.delete(e),ye.size===0)process.off("SIGTERM",Gt),process.off("SIGINT",Kt),process.off("exit",Me)}};Qo.define=(e,t,s)=>{Reflect.defineProperty(e,t,{value:s})};Qo.defineExport=(e,t,s)=>{let r;Reflect.defineProperty(e,t,{enumerable:!0,configurable:!0,set(i){r=i},get(){return r?r():s()}})}});var Ft=g((Dd,Vt)=>{Vt.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var V=g((Bd,Qt)=>{var En=Ft();Qt.exports=(e)=>typeof e==="string"?e.replace(En(),""):e});var Zt=g((An)=>{An.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};An.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};An.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};An.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};An.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var Xt=g((Pd,zt)=>{zt.exports=class{_queue=[];_executing=!1;_jobRunner=null;constructor(t){this._jobRunner=t}enqueue=(...t)=>{this._queue.push(t),this._dequeue()};destroy(){this._queue.length=0,this._jobRunner=null}_dequeue(){if(this._executing||!this._queue.length)return;this._executing=!0,this._jobRunner(...this._queue.shift()),setTimeout(()=>{this._executing=!1,this._dequeue()})}}});var st=g((Id,jt)=>{var Jt=he("readline"),Mn=Zt(),Tn=Xt(),vn=/^(?:\x1b)([a-zA-Z0-9])$/,_n=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,Rn={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function Cn(e){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e)}function Dn(e){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(e)}var Te=(e="",t={})=>{let s,r={name:t.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:e,raw:e,...t};if(Buffer.isBuffer(e))if(e[0]>127&&e[1]===void 0)e[0]-=128,e="\x1B"+String(e);else e=String(e);else if(e!==void 0&&typeof e!=="string")e=String(e);else if(!e)e=r.sequence||"";if(r.sequence=r.sequence||e||r.name,e==="\r")r.raw=void 0,r.name="return";else if(e===`
6
- `)r.name="enter";else if(e==="\t")r.name="tab";else if(e==="\b"||e==="\x7F"||e==="\x1B\x7F"||e==="\x1B\b")r.name="backspace",r.meta=e.charAt(0)==="\x1B";else if(e==="\x1B"||e==="\x1B\x1B")r.name="escape",r.meta=e.length===2;else if(e===" "||e==="\x1B ")r.name="space",r.meta=e.length===2;else if(e<="\x1A")r.name=String.fromCharCode(e.charCodeAt(0)+97-1),r.ctrl=!0;else if(e.length===1&&e>="0"&&e<="9")r.name="number";else if(e.length===1&&e>="a"&&e<="z")r.name=e;else if(e.length===1&&e>="A"&&e<="Z")r.name=e.toLowerCase(),r.shift=!0;else if(s=vn.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(s[1]);else if(s=_n.exec(e)){let i=[...e];if(i[0]==="\x1B"&&i[1]==="\x1B")r.option=!0;let o=[s[1],s[2],s[4],s[6]].filter(Boolean).join(""),n=(s[3]||s[5]||1)-1;r.ctrl=!!(n&4),r.meta=!!(n&10),r.shift=!!(n&1),r.code=o,r.name=Rn[o],r.shift=Cn(o)||r.shift,r.ctrl=Dn(o)||r.ctrl}return r};Te.listen=(e={},t)=>{let{stdin:s}=e;if(!s||s!==process.stdin&&!s.isTTY)throw Error("Invalid stream passed");let r=Jt.createInterface({terminal:!0,input:s});Jt.emitKeypressEvents(s,r);let i=new Tn((a,p)=>t(a,Te(a,p),r)),o=s.isRaw;if(s.isTTY)s.setRawMode(!0);return s.on("keypress",i.enqueue),r.resume(),()=>{if(s.isTTY)s.setRawMode(o);s.removeListener("keypress",i.enqueue),i.destroy(),r.pause(),r.close()}};Te.action=(e,t,s)=>{let r={...Mn,...s};if(t.ctrl)return t.action=r.ctrl[t.name],t;if(t.option&&r.option)return t.action=r.option[t.name],t;if(t.shift)return t.action=r.shift[t.name],t;return t.action=r.keys[t.name],t};jt.exports=Te});var es=g((Ld,kt)=>{kt.exports=(e)=>{e.timers=e.timers||{};let t=e.options.timers;if(!t)return;for(let s of Object.keys(t)){let r=t[s];if(typeof r==="number")r={interval:r};Bn(e,s,r)}};function Bn(e,t,s={}){let r=e.timers[t]={name:t,start:Date.now(),ms:0,tick:0},i=s.interval||120;r.frames=s.frames||[],r.loading=!0;let o=setInterval(()=>{r.ms=Date.now()-r.start,r.tick++,e.render()},i);return r.stop=()=>{r.loading=!1,clearInterval(o)},Reflect.defineProperty(r,"interval",{value:o}),e.once("close",()=>r.stop()),r.stop}});var rs=g(($d,ss)=>{var{define:On,width:Pn}=R();class ts{constructor(e){let t=e.options;On(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=Pn(t.stdout||process.stdout),Object.assign(this,t),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let t=this._color||e[this.status];return typeof t==="function"?t:e.pending}set loading(e){this._loading=e}get loading(){if(typeof this._loading==="boolean")return this._loading;if(this.loadingChoices)return"choices";return!1}get status(){if(this.cancelled)return"cancelled";if(this.submitted)return"submitted";return"pending"}}ss.exports=ts});var os=g((Ud,is)=>{var rt=R(),v=Se(),it={default:v.noop,noop:v.noop,set inverse(e){this._inverse=e},get inverse(){return this._inverse||rt.inverse(this.primary)},set complement(e){this._complement=e},get complement(){return this._complement||rt.complement(this.primary)},primary:v.cyan,success:v.green,danger:v.magenta,strong:v.bold,warning:v.yellow,muted:v.dim,disabled:v.gray,dark:v.dim.gray,underline:v.underline,set info(e){this._info=e},get info(){return this._info||this.primary},set em(e){this._em=e},get em(){return this._em||this.primary.underline},set heading(e){this._heading=e},get heading(){return this._heading||this.muted.underline},set pending(e){this._pending=e},get pending(){return this._pending||this.primary},set submitted(e){this._submitted=e},get submitted(){return this._submitted||this.success},set cancelled(e){this._cancelled=e},get cancelled(){return this._cancelled||this.danger},set typing(e){this._typing=e},get typing(){return this._typing||this.dim},set placeholder(e){this._placeholder=e},get placeholder(){return this._placeholder||this.primary.dim},set highlight(e){this._highlight=e},get highlight(){return this._highlight||this.inverse}};it.merge=(e={})=>{if(e.styles&&typeof e.styles.enabled==="boolean")v.enabled=e.styles.enabled;if(e.styles&&typeof e.styles.visible==="boolean")v.visible=e.styles.visible;let t=rt.merge({},it,e.styles);delete t.merge;for(let s of Object.keys(v))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>v[s]});for(let s of Object.keys(v.styles))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>v[s]});return t};is.exports=it});var as=g((qd,ns)=>{var ot=process.platform==="win32",U=Se(),In=R(),nt={...U.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:U.symbols.check,leftAngle:"\u2039",mark:"\u203B",minus:"\u2212",multiplication:"\xD7",obelus:"\xF7",percent:"%",pilcrow:"\xB6",pilcrow2:"\u2761",pencilUpRight:"\u2710",pencilDownRight:"\u270E",pencilRight:"\u270F",plus:"+",plusMinus:"\xB1",pointRight:"\u261E",rightAngle:"\u203A",section:"\xA7",hexagon:{off:"\u2B21",on:"\u2B22",disabled:"\u2B22"},ballot:{on:"\u2611",off:"\u2610",disabled:"\u2612"},stars:{on:"\u2605",off:"\u2606",disabled:"\u2606"},folder:{on:"\u25BC",off:"\u25B6",disabled:"\u25B6"},prefix:{pending:U.symbols.question,submitted:U.symbols.check,cancelled:U.symbols.cross},separator:{pending:U.symbols.pointerSmall,submitted:U.symbols.middot,cancelled:U.symbols.middot},radio:{off:ot?"( )":"\u25EF",on:ot?"(*)":"\u25C9",disabled:ot?"(|)":"\u24BE"},numbers:["\u24EA","\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246A","\u246B","\u246C","\u246D","\u246E","\u246F","\u2470","\u2471","\u2472","\u2473","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325A","\u325B","\u325C","\u325D","\u325E","\u325F","\u32B1","\u32B2","\u32B3","\u32B4","\u32B5","\u32B6","\u32B7","\u32B8","\u32B9","\u32BA","\u32BB","\u32BC","\u32BD","\u32BE","\u32BF"]};nt.merge=(e)=>{let t=In.merge({},U.symbols,nt,e.symbols);return delete t.merge,t};ns.exports=nt});var ls=g((Gd,ps)=>{var Ln=os(),$n=as(),Un=R();ps.exports=(e)=>{e.options=Un.merge({},e.options.theme,e.options),e.symbols=$n.merge(e.options),e.styles=Ln.merge(e.options)}});var ms=g((us,cs)=>{var ds=process.env.TERM_PROGRAM==="Apple_Terminal",qn=V(),at=R(),L=cs.exports=us,pt=!1,F=L.code={bell:"\x07",beep:"\x07",beginning:"\x1B[G",down:"\x1B[J",esc:"\x1B[",getPosition:"\x1B[6n",hide:"\x1B[?25l",line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",restorePosition:"\x1B["+(ds?"8":"u"),savePosition:"\x1B["+(ds?"7":"s"),screen:"\x1B[2J",show:"\x1B[?25h",up:"\x1B[1J"},ne=L.cursor={get hidden(){return pt},hide(){return pt=!0,F.hide},show(){return pt=!1,F.show},forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),up:(e=1)=>e?`\x1B[${e}A`:"",down:(e=1)=>e?`\x1B[${e}B`:"",right:(e=1)=>e?`\x1B[${e}C`:"",left:(e=1)=>e?`\x1B[${e}D`:"",to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e=0,t=0){let s="";return s+=e<0?ne.left(-e):e>0?ne.right(e):"",s+=t<0?ne.up(-t):t>0?ne.down(t):"",s},strLen(e){var t=0,s=e.length,r=-1;for(var i=0;i<s;i++)if(r=e.charCodeAt(i),r>=0&&r<=128)t+=1;else t+=2;return t},restore(e={}){let{after:t,cursor:s,initial:r,input:i,prompt:o,size:n,value:a}=e;if(r=at.isPrimitive(r)?String(r):"",i=at.isPrimitive(i)?String(i):"",a=at.isPrimitive(a)?String(a):"",n){let p=L.cursor.up(n)+L.cursor.to(this.strLen(o)),l=i.length-s;if(l>0)p+=L.cursor.left(l);return p}if(a||t){let p=!i&&!!r?-this.strLen(r):-this.strLen(i)+s;if(t)p-=this.strLen(t);if(i===""&&r&&!o.includes(r))p+=this.strLen(r);return L.cursor.move(p)}}},lt=L.erase={screen:F.screen,up:F.up,down:F.down,line:F.line,lineEnd:F.lineEnd,lineStart:F.lineStart,lines(e){let t="";for(let s=0;s<e;s++)t+=L.erase.line+(s<e-1?L.cursor.up(1):"");if(e)t+=L.code.beginning;return t}};L.clear=(e="",t=process.stdout.columns)=>{if(!t)return lt.line+ne.to(0);let s=(o)=>[...qn(o)].length,r=e.split(/\r?\n/),i=0;for(let o of r)i+=1+Math.floor(Math.max(s(o)-1,0)/t);return(lt.line+ne.prevLine()).repeat(i-1)+lt.line+ne.to(0)}});var de=g((Kd,fs)=>{var Gn=he("events"),hs=V(),dt=st(),Kn=es(),Wn=rs(),Hn=ls(),C=R(),ae=ms();class ut extends Gn{constructor(e={}){super();this.name=e.name,this.type=e.type,this.options=e,Hn(this),Kn(this),this.state=new Wn(this),this.initial=[e.initial,e.default].find((t)=>t!=null),this.stdout=e.stdout||process.stdout,this.stdin=e.stdin||process.stdin,this.scale=e.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=Vn(this.options.margin),this.setMaxListeners(0),Yn(this)}async keypress(e,t={}){this.keypressed=!0;let s=dt.action(e,dt(e,t),this.options.actions);this.state.keypress=s,this.emit("keypress",e,s),this.emit("state",this.state.clone());let r=this.options[s.action]||this[s.action]||this.dispatch;if(typeof r==="function")return await r.call(this,e,s);this.alert()}alert(){if(delete this.state.alert,this.options.show===!1)this.emit("alert");else this.stdout.write(ae.code.beep)}cursorHide(){this.stdout.write(ae.cursor.hide());let e=C.onExit(()=>this.cursorShow());this.on("close",()=>{this.cursorShow(),e()})}cursorShow(){this.stdout.write(ae.cursor.show())}write(e){if(!e)return;if(this.stdout&&this.state.show!==!1)this.stdout.write(e);this.state.buffer+=e}clear(e=0){let t=this.state.buffer;if(this.state.buffer="",!t&&!e||this.options.show===!1)return;this.stdout.write(ae.cursor.down(e)+ae.clear(t,this.width))}restore(){if(this.state.closed||this.options.show===!1)return;let{prompt:e,after:t,rest:s}=this.sections(),{cursor:r,initial:i="",input:o="",value:n=""}=this,a=this.state.size=s.length,p={after:t,cursor:r,initial:i,input:o,prompt:e,size:a,value:n},l=ae.cursor.restore(p);if(l)this.stdout.write(l)}sections(){let{buffer:e,input:t,prompt:s}=this.state;s=hs(s);let r=hs(e),i=r.indexOf(s),o=r.slice(0,i),a=r.slice(i).split(`
7
- `),p=a[0],l=a[a.length-1],c=(s+(t?" "+t:"")).length,h=c<p.length?p.slice(c+1):"";return{header:o,prompt:p,after:h,rest:a.slice(1),last:l}}async submit(){if(this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit)await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let t=`
3
+ var Io=Object.create;var{getPrototypeOf:Lo,defineProperty:Ot,getOwnPropertyNames:$o}=Object;var Go=Object.prototype.hasOwnProperty;function Uo(e){return this[e]}var qo,Ko,Y=(e,t,s)=>{var r=e!=null&&typeof e==="object";if(r){var i=t?qo??=new WeakMap:Ko??=new WeakMap,o=i.get(e);if(o)return o}s=e!=null?Io(Lo(e)):{};let n=t||!e||!e.__esModule?Ot(s,"default",{value:e,enumerable:!0}):s;for(let a of $o(e))if(!Go.call(n,a))Ot(n,a,{get:Uo.bind(e,a),enumerable:!0});if(r)i.set(e,n);return n};var A=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var g=function(e,t,s,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,s):r,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)if(n=e[a])o=(i<3?n(o):i>3?n(t,s,o):n(t,s))||o;return i>3&&o&&Object.defineProperty(t,s,o),o};var he=import.meta.require;var qt=A((Fc,fe)=>{var Zo=typeof process<"u"&&process.env.TERM_PROGRAM==="Hyper",Xo=typeof process<"u"&&process.platform==="win32",$t=typeof process<"u"&&process.platform==="linux",tt={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",question:"?",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},Gt=Object.assign({},tt,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),Ut=Object.assign({},tt,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:$t?"\u25B8":"\u276F",pointerSmall:$t?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});fe.exports=Xo&&!Zo?Gt:Ut;Reflect.defineProperty(fe.exports,"common",{enumerable:!1,value:tt});Reflect.defineProperty(fe.exports,"windows",{enumerable:!1,value:Gt});Reflect.defineProperty(fe.exports,"other",{enumerable:!1,value:Ut})});var Ne=A((Qc,st)=>{var Jo=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),jo=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,ko=()=>{if(typeof process<"u")return process.env.FORCE_COLOR!=="0";return!1},Kt=()=>{let e={enabled:ko(),visible:!0,styles:{},keys:{}},t=(o)=>{let n=o.open=`\x1B[${o.codes[0]}m`,a=o.close=`\x1B[${o.codes[1]}m`,p=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(l,c)=>{if(l.includes(a))l=l.replace(p,a+n);let d=n+l+a;return c?d.replace(/\r*\n/g,`${a}$&${n}`):d},o},s=(o,n,a)=>{return typeof o==="function"?o(n):o.wrap(n,a)},r=(o,n)=>{if(o===""||o==null)return"";if(e.enabled===!1)return o;if(e.visible===!1)return"";let a=""+o,p=a.includes(`
4
+ `),l=n.length;if(l>0&&n.includes("unstyle"))n=[...new Set(["unstyle",...n])].reverse();while(l-- >0)a=s(e.styles[n[l]],a,p);return a},i=(o,n,a)=>{e.styles[o]=t({name:o,codes:n}),(e.keys[a]||(e.keys[a]=[])).push(o),Reflect.defineProperty(e,o,{configurable:!0,enumerable:!0,set(l){e.alias(o,l)},get(){let l=(c)=>r(c,l.stack);return Reflect.setPrototypeOf(l,e),l.stack=this.stack?this.stack.concat(o):[o],l}})};return i("reset",[0,0],"modifier"),i("bold",[1,22],"modifier"),i("dim",[2,22],"modifier"),i("italic",[3,23],"modifier"),i("underline",[4,24],"modifier"),i("inverse",[7,27],"modifier"),i("hidden",[8,28],"modifier"),i("strikethrough",[9,29],"modifier"),i("black",[30,39],"color"),i("red",[31,39],"color"),i("green",[32,39],"color"),i("yellow",[33,39],"color"),i("blue",[34,39],"color"),i("magenta",[35,39],"color"),i("cyan",[36,39],"color"),i("white",[37,39],"color"),i("gray",[90,39],"color"),i("grey",[90,39],"color"),i("bgBlack",[40,49],"bg"),i("bgRed",[41,49],"bg"),i("bgGreen",[42,49],"bg"),i("bgYellow",[43,49],"bg"),i("bgBlue",[44,49],"bg"),i("bgMagenta",[45,49],"bg"),i("bgCyan",[46,49],"bg"),i("bgWhite",[47,49],"bg"),i("blackBright",[90,39],"bright"),i("redBright",[91,39],"bright"),i("greenBright",[92,39],"bright"),i("yellowBright",[93,39],"bright"),i("blueBright",[94,39],"bright"),i("magentaBright",[95,39],"bright"),i("cyanBright",[96,39],"bright"),i("whiteBright",[97,39],"bright"),i("bgBlackBright",[100,49],"bgBright"),i("bgRedBright",[101,49],"bgBright"),i("bgGreenBright",[102,49],"bgBright"),i("bgYellowBright",[103,49],"bgBright"),i("bgBlueBright",[104,49],"bgBright"),i("bgMagentaBright",[105,49],"bgBright"),i("bgCyanBright",[106,49],"bgBright"),i("bgWhiteBright",[107,49],"bgBright"),e.ansiRegex=jo,e.hasColor=e.hasAnsi=(o)=>{return e.ansiRegex.lastIndex=0,typeof o==="string"&&o!==""&&e.ansiRegex.test(o)},e.alias=(o,n)=>{let a=typeof n==="string"?e[n]:n;if(typeof a!=="function")throw TypeError("Expected alias to be the name of an existing color (string) or a function");if(!a.stack)Reflect.defineProperty(a,"name",{value:o}),e.styles[o]=a,a.stack=[o];Reflect.defineProperty(e,o,{configurable:!0,enumerable:!0,set(p){e.alias(o,p)},get(){let p=(l)=>r(l,p.stack);return Reflect.setPrototypeOf(p,e),p.stack=this.stack?this.stack.concat(a.stack):a.stack,p}})},e.theme=(o)=>{if(!Jo(o))throw TypeError("Expected theme to be an object");for(let n of Object.keys(o))e.alias(n,o[n]);return e},e.alias("unstyle",(o)=>{if(typeof o==="string"&&o!=="")return e.ansiRegex.lastIndex=0,o.replace(e.ansiRegex,"");return""}),e.alias("noop",(o)=>o),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=qt(),e.define=i,e};st.exports=Kt();st.exports.create=Kt});var R=A((tn)=>{var en=Object.prototype.toString,P=Ne(),Ht=!1,ye=new Set,Wt={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};tn.longest=(e,t)=>{return e.reduce((s,r)=>Math.max(s,t?r[t].length:r.length),0)};tn.hasColor=(e)=>!!e&&P.hasColor(e);var Me=tn.isObject=(e)=>{return e!==null&&typeof e==="object"&&!Array.isArray(e)};tn.nativeType=(e)=>{return en.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")};tn.isAsyncFn=(e)=>{return tn.nativeType(e)==="asyncfunction"};tn.isPrimitive=(e)=>{return e!=null&&typeof e!=="object"&&typeof e!=="function"};tn.resolve=(e,t,...s)=>{if(typeof t==="function")return t.call(e,...s);return t};tn.scrollDown=(e=[])=>[...e.slice(1),e[0]];tn.scrollUp=(e=[])=>[e.pop(),...e];tn.reorder=(e=[])=>{let t=e.slice();return t.sort((s,r)=>{if(s.index>r.index)return 1;if(s.index<r.index)return-1;return 0}),t};tn.swap=(e,t,s)=>{let r=e.length,i=s===r?0:s<0?r-1:s,o=e[t];e[t]=e[i],e[i]=o};tn.width=(e,t=80)=>{let s=e&&e.columns?e.columns:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[0];if(process.platform==="win32")return s-1;return s};tn.height=(e,t=20)=>{let s=e&&e.rows?e.rows:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[1];return s};tn.wordWrap=(e,t={})=>{if(!e)return e;if(typeof t==="number")t={width:t};let{indent:s="",newline:r=`
5
+ `+s,width:i=80}=t,o=(r+s).match(/[^\S\n]/g)||[];i-=o.length;let n=`.{1,${i}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,a=e.trim(),p=new RegExp(n,"g"),l=a.match(p)||[];if(l=l.map((c)=>c.replace(/\n$/,"")),t.padEnd)l=l.map((c)=>c.padEnd(i," "));if(t.padStart)l=l.map((c)=>c.padStart(i," "));return s+l.join(r)};tn.unmute=(e)=>{let t=e.stack.find((r)=>P.keys.color.includes(r));if(t)return P[t];if(e.stack.find((r)=>r.slice(2)==="bg"))return P[t.slice(2)];return(r)=>r};tn.pascal=(e)=>e?e[0].toUpperCase()+e.slice(1):"";tn.inverse=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>P.keys.color.includes(r));if(t){let r=P["bg"+tn.pascal(t)];return r?r.black:e}let s=e.stack.find((r)=>r.slice(0,2)==="bg");if(s)return P[s.slice(2).toLowerCase()]||e;return P.none};tn.complement=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>P.keys.color.includes(r)),s=e.stack.find((r)=>r.slice(0,2)==="bg");if(t&&!s)return P[Wt[t]||t];if(s){let r=s.slice(2).toLowerCase(),i=Wt[r];if(!i)return e;return P["bg"+tn.pascal(i)]||e}return P.none};tn.meridiem=(e)=>{let t=e.getHours(),s=e.getMinutes(),r=t>=12?"pm":"am";t=t%12;let i=t===0?12:t,o=s<10?"0"+s:s;return i+":"+o+" "+r};tn.set=(e={},t="",s)=>{return t.split(".").reduce((r,i,o,n)=>{let a=n.length-1>o?r[i]||{}:s;if(!tn.isObject(a)&&o<n.length-1)a={};return r[i]=a},e)};tn.get=(e={},t="",s)=>{let r=e[t]==null?t.split(".").reduce((i,o)=>i&&i[o],e):e[t];return r==null?s:r};tn.mixin=(e,t)=>{if(!Me(e))return t;if(!Me(t))return e;for(let s of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,s);if(hasOwnProperty.call(r,"value"))if(hasOwnProperty.call(e,s)&&Me(r.value)){let i=Object.getOwnPropertyDescriptor(e,s);if(Me(i.value)&&i.value!==r.value)e[s]=tn.merge({},e[s],t[s]);else Reflect.defineProperty(e,s,r)}else Reflect.defineProperty(e,s,r);else Reflect.defineProperty(e,s,r)}return e};tn.merge=(...e)=>{let t={};for(let s of e)tn.mixin(t,s);return t};tn.mixinEmitter=(e,t)=>{let s=t.constructor.prototype;for(let r of Object.keys(s)){let i=s[r];if(typeof i==="function")tn.define(e,r,i.bind(t));else tn.define(e,r,i)}};var Te=(e,t)=>{if(Ht)return;if(Ht=!0,ye.forEach((s)=>s()),e===!0)process.exit(128+t)},Yt=Te.bind(null,!0,15),Vt=Te.bind(null,!0,2);tn.onExit=(e)=>{if(ye.size===0)process.once("SIGTERM",Yt),process.once("SIGINT",Vt),process.once("exit",Te);return ye.add(e),()=>{if(ye.delete(e),ye.size===0)process.off("SIGTERM",Yt),process.off("SIGINT",Vt),process.off("exit",Te)}};tn.define=(e,t,s)=>{Reflect.defineProperty(e,t,{value:s})};tn.defineExport=(e,t,s)=>{let r;Reflect.defineProperty(e,t,{enumerable:!0,configurable:!0,set(i){r=i},get(){return r?r():s()}})}});var Xt=A((Zc,Zt)=>{Zt.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var V=A((Xc,Jt)=>{var Tn=Xt();Jt.exports=(e)=>typeof e==="string"?e.replace(Tn(),""):e});var jt=A((_n)=>{_n.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};_n.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};_n.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};_n.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};_n.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var es=A((jc,kt)=>{kt.exports=class{_queue=[];_executing=!1;_jobRunner=null;constructor(t){this._jobRunner=t}enqueue=(...t)=>{this._queue.push(t),this._dequeue()};destroy(){this._queue.length=0,this._jobRunner=null}_dequeue(){if(this._executing||!this._queue.length)return;this._executing=!0,this._jobRunner(...this._queue.shift()),setTimeout(()=>{this._executing=!1,this._dequeue()})}}});var it=A((kc,ss)=>{var ts=he("readline"),On=jt(),Pn=es(),In=/^(?:\x1b)([a-zA-Z0-9])$/,Ln=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,$n={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function Gn(e){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e)}function Un(e){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(e)}var _e=(e="",t={})=>{let s,r={name:t.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:e,raw:e,...t};if(Buffer.isBuffer(e))if(e[0]>127&&e[1]===void 0)e[0]-=128,e="\x1B"+String(e);else e=String(e);else if(e!==void 0&&typeof e!=="string")e=String(e);else if(!e)e=r.sequence||"";if(r.sequence=r.sequence||e||r.name,e==="\r")r.raw=void 0,r.name="return";else if(e===`
6
+ `)r.name="enter";else if(e==="\t")r.name="tab";else if(e==="\b"||e==="\x7F"||e==="\x1B\x7F"||e==="\x1B\b")r.name="backspace",r.meta=e.charAt(0)==="\x1B";else if(e==="\x1B"||e==="\x1B\x1B")r.name="escape",r.meta=e.length===2;else if(e===" "||e==="\x1B ")r.name="space",r.meta=e.length===2;else if(e<="\x1A")r.name=String.fromCharCode(e.charCodeAt(0)+97-1),r.ctrl=!0;else if(e.length===1&&e>="0"&&e<="9")r.name="number";else if(e.length===1&&e>="a"&&e<="z")r.name=e;else if(e.length===1&&e>="A"&&e<="Z")r.name=e.toLowerCase(),r.shift=!0;else if(s=In.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(s[1]);else if(s=Ln.exec(e)){let i=[...e];if(i[0]==="\x1B"&&i[1]==="\x1B")r.option=!0;let o=[s[1],s[2],s[4],s[6]].filter(Boolean).join(""),n=(s[3]||s[5]||1)-1;r.ctrl=!!(n&4),r.meta=!!(n&10),r.shift=!!(n&1),r.code=o,r.name=$n[o],r.shift=Gn(o)||r.shift,r.ctrl=Un(o)||r.ctrl}return r};_e.listen=(e={},t)=>{let{stdin:s}=e;if(!s||s!==process.stdin&&!s.isTTY)throw Error("Invalid stream passed");let r=ts.createInterface({terminal:!0,input:s});ts.emitKeypressEvents(s,r);let i=new Pn((a,p)=>t(a,_e(a,p),r)),o=s.isRaw;if(s.isTTY)s.setRawMode(!0);return s.on("keypress",i.enqueue),r.resume(),()=>{if(s.isTTY)s.setRawMode(o);s.removeListener("keypress",i.enqueue),i.destroy(),r.pause(),r.close()}};_e.action=(e,t,s)=>{let r={...On,...s};if(t.ctrl)return t.action=r.ctrl[t.name],t;if(t.option&&r.option)return t.action=r.option[t.name],t;if(t.shift)return t.action=r.shift[t.name],t;return t.action=r.keys[t.name],t};ss.exports=_e});var is=A((em,rs)=>{rs.exports=(e)=>{e.timers=e.timers||{};let t=e.options.timers;if(!t)return;for(let s of Object.keys(t)){let r=t[s];if(typeof r==="number")r={interval:r};qn(e,s,r)}};function qn(e,t,s={}){let r=e.timers[t]={name:t,start:Date.now(),ms:0,tick:0},i=s.interval||120;r.frames=s.frames||[],r.loading=!0;let o=setInterval(()=>{r.ms=Date.now()-r.start,r.tick++,e.render()},i);return r.stop=()=>{r.loading=!1,clearInterval(o)},Reflect.defineProperty(r,"interval",{value:o}),e.once("close",()=>r.stop()),r.stop}});var as=A((tm,ns)=>{var{define:Kn,width:Hn}=R();class os{constructor(e){let t=e.options;Kn(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=Hn(t.stdout||process.stdout),Object.assign(this,t),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let t=this._color||e[this.status];return typeof t==="function"?t:e.pending}set loading(e){this._loading=e}get loading(){if(typeof this._loading==="boolean")return this._loading;if(this.loadingChoices)return"choices";return!1}get status(){if(this.cancelled)return"cancelled";if(this.submitted)return"submitted";return"pending"}}ns.exports=os});var ls=A((sm,ps)=>{var ot=R(),_=Ne(),nt={default:_.noop,noop:_.noop,set inverse(e){this._inverse=e},get inverse(){return this._inverse||ot.inverse(this.primary)},set complement(e){this._complement=e},get complement(){return this._complement||ot.complement(this.primary)},primary:_.cyan,success:_.green,danger:_.magenta,strong:_.bold,warning:_.yellow,muted:_.dim,disabled:_.gray,dark:_.dim.gray,underline:_.underline,set info(e){this._info=e},get info(){return this._info||this.primary},set em(e){this._em=e},get em(){return this._em||this.primary.underline},set heading(e){this._heading=e},get heading(){return this._heading||this.muted.underline},set pending(e){this._pending=e},get pending(){return this._pending||this.primary},set submitted(e){this._submitted=e},get submitted(){return this._submitted||this.success},set cancelled(e){this._cancelled=e},get cancelled(){return this._cancelled||this.danger},set typing(e){this._typing=e},get typing(){return this._typing||this.dim},set placeholder(e){this._placeholder=e},get placeholder(){return this._placeholder||this.primary.dim},set highlight(e){this._highlight=e},get highlight(){return this._highlight||this.inverse}};nt.merge=(e={})=>{if(e.styles&&typeof e.styles.enabled==="boolean")_.enabled=e.styles.enabled;if(e.styles&&typeof e.styles.visible==="boolean")_.visible=e.styles.visible;let t=ot.merge({},nt,e.styles);delete t.merge;for(let s of Object.keys(_))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>_[s]});for(let s of Object.keys(_.styles))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>_[s]});return t};ps.exports=nt});var ms=A((rm,cs)=>{var at=process.platform==="win32",G=Ne(),Wn=R(),pt={...G.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:G.symbols.check,leftAngle:"\u2039",mark:"\u203B",minus:"\u2212",multiplication:"\xD7",obelus:"\xF7",percent:"%",pilcrow:"\xB6",pilcrow2:"\u2761",pencilUpRight:"\u2710",pencilDownRight:"\u270E",pencilRight:"\u270F",plus:"+",plusMinus:"\xB1",pointRight:"\u261E",rightAngle:"\u203A",section:"\xA7",hexagon:{off:"\u2B21",on:"\u2B22",disabled:"\u2B22"},ballot:{on:"\u2611",off:"\u2610",disabled:"\u2612"},stars:{on:"\u2605",off:"\u2606",disabled:"\u2606"},folder:{on:"\u25BC",off:"\u25B6",disabled:"\u25B6"},prefix:{pending:G.symbols.question,submitted:G.symbols.check,cancelled:G.symbols.cross},separator:{pending:G.symbols.pointerSmall,submitted:G.symbols.middot,cancelled:G.symbols.middot},radio:{off:at?"( )":"\u25EF",on:at?"(*)":"\u25C9",disabled:at?"(|)":"\u24BE"},numbers:["\u24EA","\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246A","\u246B","\u246C","\u246D","\u246E","\u246F","\u2470","\u2471","\u2472","\u2473","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325A","\u325B","\u325C","\u325D","\u325E","\u325F","\u32B1","\u32B2","\u32B3","\u32B4","\u32B5","\u32B6","\u32B7","\u32B8","\u32B9","\u32BA","\u32BB","\u32BC","\u32BD","\u32BE","\u32BF"]};pt.merge=(e)=>{let t=Wn.merge({},G.symbols,pt,e.symbols);return delete t.merge,t};cs.exports=pt});var us=A((im,ds)=>{var Yn=ls(),Vn=ms(),Fn=R();ds.exports=(e)=>{e.options=Fn.merge({},e.options.theme,e.options),e.symbols=Vn.merge(e.options),e.styles=Yn.merge(e.options)}});var gs=A((fs,ys)=>{var hs=process.env.TERM_PROGRAM==="Apple_Terminal",Qn=V(),lt=R(),L=ys.exports=fs,ct=!1,F=L.code={bell:"\x07",beep:"\x07",beginning:"\x1B[G",down:"\x1B[J",esc:"\x1B[",getPosition:"\x1B[6n",hide:"\x1B[?25l",line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",restorePosition:"\x1B["+(hs?"8":"u"),savePosition:"\x1B["+(hs?"7":"s"),screen:"\x1B[2J",show:"\x1B[?25h",up:"\x1B[1J"},ne=L.cursor={get hidden(){return ct},hide(){return ct=!0,F.hide},show(){return ct=!1,F.show},forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),up:(e=1)=>e?`\x1B[${e}A`:"",down:(e=1)=>e?`\x1B[${e}B`:"",right:(e=1)=>e?`\x1B[${e}C`:"",left:(e=1)=>e?`\x1B[${e}D`:"",to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e=0,t=0){let s="";return s+=e<0?ne.left(-e):e>0?ne.right(e):"",s+=t<0?ne.up(-t):t>0?ne.down(t):"",s},strLen(e){var t=0,s=e.length,r=-1;for(var i=0;i<s;i++)if(r=e.charCodeAt(i),r>=0&&r<=128)t+=1;else t+=2;return t},restore(e={}){let{after:t,cursor:s,initial:r,input:i,prompt:o,size:n,value:a}=e;if(r=lt.isPrimitive(r)?String(r):"",i=lt.isPrimitive(i)?String(i):"",a=lt.isPrimitive(a)?String(a):"",n){let p=L.cursor.up(n)+L.cursor.to(this.strLen(o)),l=i.length-s;if(l>0)p+=L.cursor.left(l);return p}if(a||t){let p=!i&&!!r?-this.strLen(r):-this.strLen(i)+s;if(t)p-=this.strLen(t);if(i===""&&r&&!o.includes(r))p+=this.strLen(r);return L.cursor.move(p)}}},mt=L.erase={screen:F.screen,up:F.up,down:F.down,line:F.line,lineEnd:F.lineEnd,lineStart:F.lineStart,lines(e){let t="";for(let s=0;s<e;s++)t+=L.erase.line+(s<e-1?L.cursor.up(1):"");if(e)t+=L.code.beginning;return t}};L.clear=(e="",t=process.stdout.columns)=>{if(!t)return mt.line+ne.to(0);let s=(o)=>[...Qn(o)].length,r=e.split(/\r?\n/),i=0;for(let o of r)i+=1+Math.floor(Math.max(s(o)-1,0)/t);return(mt.line+ne.prevLine()).repeat(i-1)+mt.line+ne.to(0)}});var ce=A((om,As)=>{var zn=he("events"),Es=V(),dt=it(),Zn=is(),Xn=as(),Jn=us(),C=R(),ae=gs();class ut extends zn{constructor(e={}){super();this.name=e.name,this.type=e.type,this.options=e,Jn(this),Zn(this),this.state=new Xn(this),this.initial=[e.initial,e.default].find((t)=>t!=null),this.stdout=e.stdout||process.stdout,this.stdin=e.stdin||process.stdin,this.scale=e.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=kn(this.options.margin),this.setMaxListeners(0),jn(this)}async keypress(e,t={}){this.keypressed=!0;let s=dt.action(e,dt(e,t),this.options.actions);this.state.keypress=s,this.emit("keypress",e,s),this.emit("state",this.state.clone());let r=this.options[s.action]||this[s.action]||this.dispatch;if(typeof r==="function")return await r.call(this,e,s);this.alert()}alert(){if(delete this.state.alert,this.options.show===!1)this.emit("alert");else this.stdout.write(ae.code.beep)}cursorHide(){this.stdout.write(ae.cursor.hide());let e=C.onExit(()=>this.cursorShow());this.on("close",()=>{this.cursorShow(),e()})}cursorShow(){this.stdout.write(ae.cursor.show())}write(e){if(!e)return;if(this.stdout&&this.state.show!==!1)this.stdout.write(e);this.state.buffer+=e}clear(e=0){let t=this.state.buffer;if(this.state.buffer="",!t&&!e||this.options.show===!1)return;this.stdout.write(ae.cursor.down(e)+ae.clear(t,this.width))}restore(){if(this.state.closed||this.options.show===!1)return;let{prompt:e,after:t,rest:s}=this.sections(),{cursor:r,initial:i="",input:o="",value:n=""}=this,a=this.state.size=s.length,p={after:t,cursor:r,initial:i,input:o,prompt:e,size:a,value:n},l=ae.cursor.restore(p);if(l)this.stdout.write(l)}sections(){let{buffer:e,input:t,prompt:s}=this.state;s=Es(s);let r=Es(e),i=r.indexOf(s),o=r.slice(0,i),a=r.slice(i).split(`
7
+ `),p=a[0],l=a[a.length-1],d=(s+(t?" "+t:"")).length,h=d<p.length?p.slice(d+1):"";return{header:o,prompt:p,after:h,rest:a.slice(1),last:l}}async submit(){if(this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit)await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let t=`
8
8
  `+this.symbols.pointer+" ";if(typeof e==="string")t+=e.trim();else t+="Invalid input";this.state.error=`
9
9
  `+this.styles.danger(t),this.state.submitted=!1,await this.render(),await this.alert(),this.state.validating=!1,this.state.error=void 0;return}this.state.validating=!1,await this.render(),await this.close(),this.value=await this.result(this.value),this.emit("submit",this.value)}async cancel(e){if(this.state.cancelled=this.state.submitted=!0,await this.render(),await this.close(),typeof this.options.onCancel==="function")await this.options.onCancel.call(this,this.name,this.value,this);this.emit("cancel",await this.error(e))}async close(){this.state.closed=!0;try{let e=this.sections(),t=Math.ceil(e.prompt.length/this.width);if(e.rest)this.write(ae.cursor.down(e.rest.length));this.write(`
10
- `.repeat(t))}catch(e){}this.emit("close")}start(){if(!this.stop&&this.options.show!==!1)this.stop=dt.listen(this,this.keypress.bind(this)),this.once("close",this.stop),this.emit("start",this)}async skip(){if(this.skipped=this.options.skip===!0,typeof this.options.skip==="function")this.skipped=await this.options.skip.call(this,this.name,this.value);return this.skipped}async initialize(){let{format:e,options:t,result:s}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>s.call(this,this.value),typeof t.initial==="function")this.initial=await t.initial.call(this,this);if(typeof t.onRun==="function")await t.onRun.call(this,this);if(typeof t.onSubmit==="function"){let r=t.onSubmit.bind(this),i=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>{return await r(this.name,this.value,this),i()}}await this.start(),await this.render()}render(){throw Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,t)=>{if(this.once("submit",e),this.once("cancel",t),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,t,s){let{options:r,state:i,symbols:o,timers:n}=this,a=n&&n[e];i.timer=a;let p=r[e]||i[e]||o[e],l=t&&t[e]!=null?t[e]:await p;if(l==="")return l;let d=await this.resolve(l,i,t,s);if(!d&&t&&t[e])return this.resolve(p,i,t,s);return d}async prefix(){let e=await this.element("prefix")||this.symbols,t=this.timers&&this.timers.prefix,s=this.state;if(s.timer=t,C.isObject(e))e=e[s.status]||e.pending;if(!C.hasColor(e))return(this.styles[s.status]||this.styles.pending)(e);return e}async message(){let e=await this.element("message");if(!C.hasColor(e))return this.styles.strong(e);return e}async separator(){let e=await this.element("separator")||this.symbols,t=this.timers&&this.timers.separator,s=this.state;s.timer=t;let r=e[s.status]||e.pending||s.separator,i=await this.resolve(r,s);if(C.isObject(i))i=i[s.status]||i.pending;if(!C.hasColor(i))return this.styles.muted(i);return i}async pointer(e,t){let s=await this.element("pointer",e,t);if(typeof s==="string"&&C.hasColor(s))return s;if(s){let r=this.styles,i=this.index===t,o=i?r.primary:(p)=>p,n=await this.resolve(s[i?"on":"off"]||s,this.state),a=!C.hasColor(n)?o(n):n;return i?a:" ".repeat(n.length)}}async indicator(e,t){let s=await this.element("indicator",e,t);if(typeof s==="string"&&C.hasColor(s))return s;if(s){let r=this.styles,i=e.enabled===!0,o=i?r.success:r.dark,n=s[i?"on":"off"]||s;return!C.hasColor(n)?o(n):n}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");if(!C.hasColor(e))return this.styles.muted(e);return e}}error(e){return!this.state.submitted?e||this.state.error:""}format(e){return e}result(e){return e}validate(e){if(this.options.required===!0)return this.isValue(e);return!0}isValue(e){return e!=null&&e!==""}resolve(e,...t){return C.resolve(this,e,...t)}get base(){return ut.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||C.height(this.stdout,25)}get width(){return this.options.columns||C.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:t}=this.state,s=[t,e].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return(e)=>new this(e).run()}}function Yn(e){let t=(i)=>{return e[i]===void 0||typeof e[i]==="function"},s=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],r=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let i of Object.keys(e.options)){if(s.includes(i))continue;if(/^on[A-Z]/.test(i))continue;let o=e.options[i];if(typeof o==="function"&&t(i)){if(!r.includes(i))e[i]=o.bind(e)}else if(typeof e[i]!=="function")e[i]=o}}function Vn(e){if(typeof e==="number")e=[e,e,e,e];let t=[].concat(e||[]),s=(i)=>i%2===0?`
11
- `:" ",r=[];for(let i=0;i<4;i++){let o=s(i);if(t[i])r.push(o.repeat(t[i]));else r.push("")}return r}fs.exports=ut});var Es=g((Wd,gs)=>{var Fn=R(),ys={default(e,t){return t},checkbox(e,t){throw Error("checkbox role is not implemented yet")},editable(e,t){throw Error("editable role is not implemented yet")},expandable(e,t){throw Error("expandable role is not implemented yet")},heading(e,t){return t.disabled="",t.indicator=[t.indicator," "].find((s)=>s!=null),t.message=t.message||"",t},input(e,t){throw Error("input role is not implemented yet")},option(e,t){return ys.default(e,t)},radio(e,t){throw Error("radio role is not implemented yet")},separator(e,t){return t.disabled="",t.indicator=[t.indicator," "].find((s)=>s!=null),t.message=t.message||e.symbols.line.repeat(5),t},spacer(e,t){return t}};gs.exports=(e,t={})=>{let s=Fn.merge({},ys,t.roles);return s[e]||s.default}});var ge=g((Hd,ws)=>{var Qn=V(),Zn=de(),zn=Es(),ve=R(),{reorder:ct,scrollUp:Xn,scrollDown:Jn,isObject:As,swap:jn}=ve;class xs extends Zn{constructor(e){super(e);this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){if(typeof this.options.initial==="function")this.initial=await this.options.initial.call(this);await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:t,autofocus:s,suggest:r}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach((i)=>i.enabled=!1),typeof r!=="function"&&this.selectable.length===0)throw Error("At least one choice must be selectable");if(As(t))t=Object.keys(t);if(Array.isArray(t)){if(s!=null)this.index=this.findIndex(s);t.forEach((i)=>this.enable(this.find(i))),await this.render()}else{if(s!=null)t=s;if(typeof t==="string")t=this.findIndex(t);if(typeof t==="number"&&t>-1)this.index=Math.max(0,Math.min(t,this.choices.length)),this.enable(this.find(this.index))}if(this.isDisabled(this.focused))await this.down()}async toChoices(e,t){this.state.loadingChoices=!0;let s=[],r=0,i=async(o,n)=>{if(typeof o==="function")o=await o.call(this);if(o instanceof Promise)o=await o;for(let a=0;a<o.length;a++){let p=o[a]=await this.toChoice(o[a],r++,n);if(s.push(p),p.choices)await i(p.choices,p)}return s};return i(e,t).then((o)=>{return this.state.loadingChoices=!1,o})}async toChoice(e,t,s){if(typeof e==="function")e=await e.call(this,this);if(e instanceof Promise)e=await e;if(typeof e==="string")e={name:e};if(e.normalized)return e;e.normalized=!0;let r=e.value;if(e=zn(e.role,this.options)(this,e),typeof e.disabled==="string"&&!e.hint)e.hint=e.disabled,e.disabled=!0;if(e.disabled===!0&&e.hint==null)e.hint="(disabled)";if(e.index!=null)return e;if(e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=t,e.cursor=0,ve.define(e,"parent",s),e.level=s?s.level+1:1,e.indent==null)e.indent=s?s.indent+" ":e.indent||"";if(e.path=s?s.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),!this.isDisabled(e))this.longest=Math.max(this.longest,Qn(e.message).length);let o={...e};if(e.reset=(n=o.input,a=o.value)=>{for(let p of Object.keys(o))e[p]=o[p];e.input=n,e.value=a},r==null&&typeof e.initial==="function")e.input=await e.initial.call(this,this.state,e,t);return e}async onChoice(e,t){if(this.emit("choice",e,t,this),typeof e.onChoice==="function")await e.onChoice.call(this,this.state,e,t)}async addChoice(e,t,s){let r=await this.toChoice(e,t,s);return this.choices.push(r),this.index=this.choices.length-1,this.limit=this.choices.length,r}async newItem(e,t,s){let r={name:"New choice name?",editable:!0,newChoice:!0,...e},i=await this.addChoice(r,t,s);return i.updateChoice=()=>{delete i.newChoice,i.name=i.message=i.input,i.input="",i.cursor=0},this.render()}indent(e){if(e.indent==null)return e.level>1?" ".repeat(e.level-1):"";return e.indent}dispatch(e,t){if(this.multiple&&this[t.name])return this[t.name]();this.alert()}focus(e,t){if(typeof t!=="boolean")t=e.enabled;if(t&&!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();return this.index=e.index,e.enabled=t&&!this.isDisabled(e),e}space(){if(!this.multiple)return this.alert();if(!this.focused)return;return this.toggle(this.focused),this.render()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every((t)=>t.enabled);return this.choices.forEach((t)=>t.enabled=!e),this.render()}i(){if(this.choices.length-this.selected.length>this.maxSelected)return this.alert();return this.choices.forEach((e)=>e.enabled=!e.enabled),this.render()}g(){if(!this.choices.some((t)=>!!t.parent))return this.a();let e=this.focused;return this.toggle(e.parent&&!e.choices?e.parent:e),this.render()}toggle(e,t){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(typeof t!=="boolean")t=!e.enabled;if(e.enabled=t,e.choices)e.choices.forEach((r)=>this.toggle(r,t));let s=e.parent;while(s){let r=s.choices.filter((i)=>this.isDisabled(i));s.enabled=r.every((i)=>i.enabled===!0),s=s.parent}return bs(this,this.choices),this.emit("toggle",e,this),e}enable(e){if(this.selected.length>=this.maxSelected)return this.alert();return e.enabled=!this.isDisabled(e),e.choices&&e.choices.forEach(this.enable.bind(this)),e}disable(e){return e.enabled=!1,e.choices&&e.choices.forEach(this.disable.bind(this)),e}number(e){this.num+=e;let t=(s)=>{let r=Number(s);if(r>this.choices.length-1)return this.alert();let i=this.focused,o=this.choices.find((n)=>r===n.index);if(!o.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(o)===-1){let n=ct(this.choices),a=n.indexOf(o);if(i.index>a){let p=n.slice(a,a+this.limit),l=n.filter((d)=>!p.includes(d));this.choices=p.concat(l)}else{let p=a-this.limit+1;this.choices=n.slice(p).concat(n.slice(0,p))}}return this.index=this.choices.indexOf(o),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise((s)=>{let r=this.choices.length,i=this.num,o=(n=!1,a)=>{if(clearTimeout(this.numberTimeout),n)a=t(i);this.num="",s(a)};if(i==="0"||i.length===1&&Number(i+"0")>r)return o(!0);if(Number(i)>r)return o(!1,this.alert());this.numberTimeout=setTimeout(()=>o(!0),this.delay)})}home(){return this.choices=ct(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,t=ct(this.choices);return this.choices=t.slice(e).concat(t.slice(0,e)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){if(this.visible.length<=1)return this.alert();return this.up()}next(){if(this.visible.length<=1)return this.alert();return this.down()}right(){if(this.cursor>=this.input.length)return this.alert();return this.cursor++,this.render()}left(){if(this.cursor<=0)return this.alert();return this.cursor--,this.render()}up(){let e=this.choices.length,t=this.visible.length,s=this.index;if(this.options.scroll===!1&&s===0)return this.alert();if(e>t&&s===0)return this.scrollUp();if(this.index=(s-1%e+e)%e,this.isDisabled()&&!this.allChoicesAreDisabled())return this.up();return this.render()}down(){let e=this.choices.length,t=this.visible.length,s=this.index;if(this.options.scroll===!1&&s===t-1)return this.alert();if(e>t&&s===t-1)return this.scrollDown();if(this.index=(s+1)%e,this.isDisabled()&&!this.allChoicesAreDisabled())return this.down();return this.render()}scrollUp(e=0){if(this.choices=Xn(this.choices),this.index=e,this.isDisabled())return this.up();return this.render()}scrollDown(e=this.visible.length-1){if(this.choices=Jn(this.choices),this.index=e,this.isDisabled())return this.down();return this.render()}async shiftUp(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index-1),await this.up(),this.sorting=!1;return}return this.scrollUp(this.index)}async shiftDown(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index+1),await this.down(),this.sorting=!1;return}return this.scrollDown(this.index)}pageUp(){if(this.visible.length<=1)return this.alert();if(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled())return this.up();return this.render()}pageDown(){if(this.visible.length>=this.choices.length)return this.alert();if(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled())return this.down();return this.render()}swap(e){jn(this.choices,this.index,e)}allChoicesAreDisabled(e=this.choices){return e.every((t)=>this.isDisabled(t))}isDisabled(e=this.focused){if(e&&["disabled","collapsed","hidden","completing","readonly"].some((s)=>e[s]===!0))return!0;return e&&e.role==="heading"}isEnabled(e=this.focused){if(Array.isArray(e))return e.every((t)=>this.isEnabled(t));if(e.choices){let t=e.choices.filter((s)=>!this.isDisabled(s));return e.enabled&&t.every((s)=>this.isEnabled(s))}return e.enabled&&!this.isDisabled(e)}isChoice(e,t){return e.name===t||e.index===Number(t)}isSelected(e){if(Array.isArray(this.initial))return this.initial.some((t)=>this.isChoice(e,t));return this.isChoice(e,this.initial)}map(e=[],t="value"){return[].concat(e||[]).reduce((s,r)=>{return s[r]=this.find(r,t),s},{})}filter(e,t){let r=typeof e==="function"?e:(n,a)=>[n.name,a].includes(e),o=(this.options.multiple?this.state._choices:this.choices).filter(r);if(t)return o.map((n)=>n[t]);return o}find(e,t){if(As(e))return t?e[t]:e;let r=typeof e==="function"?e:(o,n)=>[o.name,n].includes(e),i=this.choices.find(r);if(i)return t?i[t]:i}findIndex(e){return this.choices.indexOf(this.find(e))}async submit(){let e=this.focused;if(!e)return this.alert();if(e.newChoice){if(!e.input)return this.alert();return e.updateChoice(),this.render()}if(this.choices.some((o)=>o.newChoice))return this.alert();let{reorder:t,sort:s}=this.options,r=this.multiple===!0,i=this.selected;if(i===void 0)return this.alert();if(Array.isArray(i)&&t!==!1&&s!==!0)i=ve.reorder(i);return this.value=r?i.map((o)=>o.name):i.name,super.submit()}set choices(e=[]){this.state._choices=this.state._choices||[],this.state.choices=e;for(let t of e)if(!this.state._choices.some((s)=>s.name===t.name))this.state._choices.push(t);if(!this._initial&&this.options.initial){this._initial=!0;let t=this.initial;if(typeof t==="string"||typeof t==="number"){let s=this.find(t);if(s)this.initial=s.index,this.focus(s,!0)}}}get choices(){return bs(this,this.state.choices||[])}set visible(e){this.state.visible=e}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(e){this.state.limit=e}get limit(){let{state:e,options:t,choices:s}=this,r=e.limit||this._limit||t.limit||s.length;return Math.min(r,this.height)}set value(e){super.value=e}get value(){if(typeof super.value!=="string"&&super.value===this.initial)return this.input;return super.value}set index(e){this.state.index=e}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let e=this.choices[this.index];if(e&&this.state.submitted&&this.multiple!==!0)e.enabled=!0;return e}get selectable(){return this.choices.filter((e)=>!this.isDisabled(e))}get selected(){return this.multiple?this.enabled:this.focused}}function bs(e,t){if(t instanceof Promise)return t;if(typeof t==="function"){if(ve.isAsyncFn(t))return t;t=t.call(e,e)}for(let s of t){if(Array.isArray(s.choices)){let r=s.choices.filter((i)=>!e.isDisabled(i));s.enabled=r.every((i)=>i.enabled===!0)}if(e.isDisabled(s)===!0)delete s.enabled}return t}ws.exports=xs});var Q=g((Yd,Ns)=>{var kn=ge(),mt=R();class Ss extends kn{constructor(e){super(e);this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(e,t){if(this.multiple)return this[t.name]?await this[t.name](e,t):await super.dispatch(e,t);this.alert()}separator(){if(this.options.separator)return super.separator();let e=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():e}pointer(e,t){return!this.multiple||this.options.pointer?super.pointer(e,t):""}indicator(e,t){return this.multiple?super.indicator(e,t):""}choiceMessage(e,t){let s=this.resolve(e.message,this.state,e,t);if(e.role==="heading"&&!mt.hasColor(s))s=this.styles.strong(s);return this.resolve(s,this.state,e,t)}choiceSeparator(){return":"}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=await this.pointer(e,t),i=await this.indicator(e,t)+(e.pad||""),o=await this.resolve(e.hint,this.state,e,t);if(o&&!mt.hasColor(o))o=this.styles.muted(o);let n=this.indent(e),a=await this.choiceMessage(e,t),p=()=>[this.margin[3],n+r+i,a,this.margin[1],o].filter(Boolean).join(" ");if(e.role==="heading")return p();if(e.disabled){if(!mt.hasColor(a))a=this.styles.disabled(a);return p()}if(s)a=this.styles.em(a);return p()}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(i,o)=>await this.renderChoice(i,o)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));let s=this.margin[0]+t.join(`
10
+ `.repeat(t))}catch(e){}this.emit("close")}start(){if(!this.stop&&this.options.show!==!1)this.stop=dt.listen(this,this.keypress.bind(this)),this.once("close",this.stop),this.emit("start",this)}async skip(){if(this.skipped=this.options.skip===!0,typeof this.options.skip==="function")this.skipped=await this.options.skip.call(this,this.name,this.value);return this.skipped}async initialize(){let{format:e,options:t,result:s}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>s.call(this,this.value),typeof t.initial==="function")this.initial=await t.initial.call(this,this);if(typeof t.onRun==="function")await t.onRun.call(this,this);if(typeof t.onSubmit==="function"){let r=t.onSubmit.bind(this),i=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>{return await r(this.name,this.value,this),i()}}await this.start(),await this.render()}render(){throw Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,t)=>{if(this.once("submit",e),this.once("cancel",t),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,t,s){let{options:r,state:i,symbols:o,timers:n}=this,a=n&&n[e];i.timer=a;let p=r[e]||i[e]||o[e],l=t&&t[e]!=null?t[e]:await p;if(l==="")return l;let c=await this.resolve(l,i,t,s);if(!c&&t&&t[e])return this.resolve(p,i,t,s);return c}async prefix(){let e=await this.element("prefix")||this.symbols,t=this.timers&&this.timers.prefix,s=this.state;if(s.timer=t,C.isObject(e))e=e[s.status]||e.pending;if(!C.hasColor(e))return(this.styles[s.status]||this.styles.pending)(e);return e}async message(){let e=await this.element("message");if(!C.hasColor(e))return this.styles.strong(e);return e}async separator(){let e=await this.element("separator")||this.symbols,t=this.timers&&this.timers.separator,s=this.state;s.timer=t;let r=e[s.status]||e.pending||s.separator,i=await this.resolve(r,s);if(C.isObject(i))i=i[s.status]||i.pending;if(!C.hasColor(i))return this.styles.muted(i);return i}async pointer(e,t){let s=await this.element("pointer",e,t);if(typeof s==="string"&&C.hasColor(s))return s;if(s){let r=this.styles,i=this.index===t,o=i?r.primary:(p)=>p,n=await this.resolve(s[i?"on":"off"]||s,this.state),a=!C.hasColor(n)?o(n):n;return i?a:" ".repeat(n.length)}}async indicator(e,t){let s=await this.element("indicator",e,t);if(typeof s==="string"&&C.hasColor(s))return s;if(s){let r=this.styles,i=e.enabled===!0,o=i?r.success:r.dark,n=s[i?"on":"off"]||s;return!C.hasColor(n)?o(n):n}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");if(!C.hasColor(e))return this.styles.muted(e);return e}}error(e){return!this.state.submitted?e||this.state.error:""}format(e){return e}result(e){return e}validate(e){if(this.options.required===!0)return this.isValue(e);return!0}isValue(e){return e!=null&&e!==""}resolve(e,...t){return C.resolve(this,e,...t)}get base(){return ut.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||C.height(this.stdout,25)}get width(){return this.options.columns||C.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:t}=this.state,s=[t,e].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return(e)=>new this(e).run()}}function jn(e){let t=(i)=>{return e[i]===void 0||typeof e[i]==="function"},s=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],r=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let i of Object.keys(e.options)){if(s.includes(i))continue;if(/^on[A-Z]/.test(i))continue;let o=e.options[i];if(typeof o==="function"&&t(i)){if(!r.includes(i))e[i]=o.bind(e)}else if(typeof e[i]!=="function")e[i]=o}}function kn(e){if(typeof e==="number")e=[e,e,e,e];let t=[].concat(e||[]),s=(i)=>i%2===0?`
11
+ `:" ",r=[];for(let i=0;i<4;i++){let o=s(i);if(t[i])r.push(o.repeat(t[i]));else r.push("")}return r}As.exports=ut});var xs=A((nm,ws)=>{var ea=R(),bs={default(e,t){return t},checkbox(e,t){throw Error("checkbox role is not implemented yet")},editable(e,t){throw Error("editable role is not implemented yet")},expandable(e,t){throw Error("expandable role is not implemented yet")},heading(e,t){return t.disabled="",t.indicator=[t.indicator," "].find((s)=>s!=null),t.message=t.message||"",t},input(e,t){throw Error("input role is not implemented yet")},option(e,t){return bs.default(e,t)},radio(e,t){throw Error("radio role is not implemented yet")},separator(e,t){return t.disabled="",t.indicator=[t.indicator," "].find((s)=>s!=null),t.message=t.message||e.symbols.line.repeat(5),t},spacer(e,t){return t}};ws.exports=(e,t={})=>{let s=ea.merge({},bs,t.roles);return s[e]||s.default}});var ge=A((am,Ts)=>{var ta=V(),sa=ce(),ra=xs(),ve=R(),{reorder:ht,scrollUp:ia,scrollDown:oa,isObject:Ss,swap:na}=ve;class Ms extends sa{constructor(e){super(e);this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){if(typeof this.options.initial==="function")this.initial=await this.options.initial.call(this);await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:t,autofocus:s,suggest:r}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach((i)=>i.enabled=!1),typeof r!=="function"&&this.selectable.length===0)throw Error("At least one choice must be selectable");if(Ss(t))t=Object.keys(t);if(Array.isArray(t)){if(s!=null)this.index=this.findIndex(s);t.forEach((i)=>this.enable(this.find(i))),await this.render()}else{if(s!=null)t=s;if(typeof t==="string")t=this.findIndex(t);if(typeof t==="number"&&t>-1)this.index=Math.max(0,Math.min(t,this.choices.length)),this.enable(this.find(this.index))}if(this.isDisabled(this.focused))await this.down()}async toChoices(e,t){this.state.loadingChoices=!0;let s=[],r=0,i=async(o,n)=>{if(typeof o==="function")o=await o.call(this);if(o instanceof Promise)o=await o;for(let a=0;a<o.length;a++){let p=o[a]=await this.toChoice(o[a],r++,n);if(s.push(p),p.choices)await i(p.choices,p)}return s};return i(e,t).then((o)=>{return this.state.loadingChoices=!1,o})}async toChoice(e,t,s){if(typeof e==="function")e=await e.call(this,this);if(e instanceof Promise)e=await e;if(typeof e==="string")e={name:e};if(e.normalized)return e;e.normalized=!0;let r=e.value;if(e=ra(e.role,this.options)(this,e),typeof e.disabled==="string"&&!e.hint)e.hint=e.disabled,e.disabled=!0;if(e.disabled===!0&&e.hint==null)e.hint="(disabled)";if(e.index!=null)return e;if(e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=t,e.cursor=0,ve.define(e,"parent",s),e.level=s?s.level+1:1,e.indent==null)e.indent=s?s.indent+" ":e.indent||"";if(e.path=s?s.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),!this.isDisabled(e))this.longest=Math.max(this.longest,ta(e.message).length);let o={...e};if(e.reset=(n=o.input,a=o.value)=>{for(let p of Object.keys(o))e[p]=o[p];e.input=n,e.value=a},r==null&&typeof e.initial==="function")e.input=await e.initial.call(this,this.state,e,t);return e}async onChoice(e,t){if(this.emit("choice",e,t,this),typeof e.onChoice==="function")await e.onChoice.call(this,this.state,e,t)}async addChoice(e,t,s){let r=await this.toChoice(e,t,s);return this.choices.push(r),this.index=this.choices.length-1,this.limit=this.choices.length,r}async newItem(e,t,s){let r={name:"New choice name?",editable:!0,newChoice:!0,...e},i=await this.addChoice(r,t,s);return i.updateChoice=()=>{delete i.newChoice,i.name=i.message=i.input,i.input="",i.cursor=0},this.render()}indent(e){if(e.indent==null)return e.level>1?" ".repeat(e.level-1):"";return e.indent}dispatch(e,t){if(this.multiple&&this[t.name])return this[t.name]();this.alert()}focus(e,t){if(typeof t!=="boolean")t=e.enabled;if(t&&!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();return this.index=e.index,e.enabled=t&&!this.isDisabled(e),e}space(){if(!this.multiple)return this.alert();if(!this.focused)return;return this.toggle(this.focused),this.render()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every((t)=>t.enabled);return this.choices.forEach((t)=>t.enabled=!e),this.render()}i(){if(this.choices.length-this.selected.length>this.maxSelected)return this.alert();return this.choices.forEach((e)=>e.enabled=!e.enabled),this.render()}g(){if(!this.choices.some((t)=>!!t.parent))return this.a();let e=this.focused;return this.toggle(e.parent&&!e.choices?e.parent:e),this.render()}toggle(e,t){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(typeof t!=="boolean")t=!e.enabled;if(e.enabled=t,e.choices)e.choices.forEach((r)=>this.toggle(r,t));let s=e.parent;while(s){let r=s.choices.filter((i)=>this.isDisabled(i));s.enabled=r.every((i)=>i.enabled===!0),s=s.parent}return Ns(this,this.choices),this.emit("toggle",e,this),e}enable(e){if(this.selected.length>=this.maxSelected)return this.alert();return e.enabled=!this.isDisabled(e),e.choices&&e.choices.forEach(this.enable.bind(this)),e}disable(e){return e.enabled=!1,e.choices&&e.choices.forEach(this.disable.bind(this)),e}number(e){this.num+=e;let t=(s)=>{let r=Number(s);if(r>this.choices.length-1)return this.alert();let i=this.focused,o=this.choices.find((n)=>r===n.index);if(!o.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(o)===-1){let n=ht(this.choices),a=n.indexOf(o);if(i.index>a){let p=n.slice(a,a+this.limit),l=n.filter((c)=>!p.includes(c));this.choices=p.concat(l)}else{let p=a-this.limit+1;this.choices=n.slice(p).concat(n.slice(0,p))}}return this.index=this.choices.indexOf(o),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise((s)=>{let r=this.choices.length,i=this.num,o=(n=!1,a)=>{if(clearTimeout(this.numberTimeout),n)a=t(i);this.num="",s(a)};if(i==="0"||i.length===1&&Number(i+"0")>r)return o(!0);if(Number(i)>r)return o(!1,this.alert());this.numberTimeout=setTimeout(()=>o(!0),this.delay)})}home(){return this.choices=ht(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,t=ht(this.choices);return this.choices=t.slice(e).concat(t.slice(0,e)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){if(this.visible.length<=1)return this.alert();return this.up()}next(){if(this.visible.length<=1)return this.alert();return this.down()}right(){if(this.cursor>=this.input.length)return this.alert();return this.cursor++,this.render()}left(){if(this.cursor<=0)return this.alert();return this.cursor--,this.render()}up(){let e=this.choices.length,t=this.visible.length,s=this.index;if(this.options.scroll===!1&&s===0)return this.alert();if(e>t&&s===0)return this.scrollUp();if(this.index=(s-1%e+e)%e,this.isDisabled()&&!this.allChoicesAreDisabled())return this.up();return this.render()}down(){let e=this.choices.length,t=this.visible.length,s=this.index;if(this.options.scroll===!1&&s===t-1)return this.alert();if(e>t&&s===t-1)return this.scrollDown();if(this.index=(s+1)%e,this.isDisabled()&&!this.allChoicesAreDisabled())return this.down();return this.render()}scrollUp(e=0){if(this.choices=ia(this.choices),this.index=e,this.isDisabled())return this.up();return this.render()}scrollDown(e=this.visible.length-1){if(this.choices=oa(this.choices),this.index=e,this.isDisabled())return this.down();return this.render()}async shiftUp(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index-1),await this.up(),this.sorting=!1;return}return this.scrollUp(this.index)}async shiftDown(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index+1),await this.down(),this.sorting=!1;return}return this.scrollDown(this.index)}pageUp(){if(this.visible.length<=1)return this.alert();if(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled())return this.up();return this.render()}pageDown(){if(this.visible.length>=this.choices.length)return this.alert();if(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled())return this.down();return this.render()}swap(e){na(this.choices,this.index,e)}allChoicesAreDisabled(e=this.choices){return e.every((t)=>this.isDisabled(t))}isDisabled(e=this.focused){if(e&&["disabled","collapsed","hidden","completing","readonly"].some((s)=>e[s]===!0))return!0;return e&&e.role==="heading"}isEnabled(e=this.focused){if(Array.isArray(e))return e.every((t)=>this.isEnabled(t));if(e.choices){let t=e.choices.filter((s)=>!this.isDisabled(s));return e.enabled&&t.every((s)=>this.isEnabled(s))}return e.enabled&&!this.isDisabled(e)}isChoice(e,t){return e.name===t||e.index===Number(t)}isSelected(e){if(Array.isArray(this.initial))return this.initial.some((t)=>this.isChoice(e,t));return this.isChoice(e,this.initial)}map(e=[],t="value"){return[].concat(e||[]).reduce((s,r)=>{return s[r]=this.find(r,t),s},{})}filter(e,t){let r=typeof e==="function"?e:(n,a)=>[n.name,a].includes(e),o=(this.options.multiple?this.state._choices:this.choices).filter(r);if(t)return o.map((n)=>n[t]);return o}find(e,t){if(Ss(e))return t?e[t]:e;let r=typeof e==="function"?e:(o,n)=>[o.name,n].includes(e),i=this.choices.find(r);if(i)return t?i[t]:i}findIndex(e){return this.choices.indexOf(this.find(e))}async submit(){let e=this.focused;if(!e)return this.alert();if(e.newChoice){if(!e.input)return this.alert();return e.updateChoice(),this.render()}if(this.choices.some((o)=>o.newChoice))return this.alert();let{reorder:t,sort:s}=this.options,r=this.multiple===!0,i=this.selected;if(i===void 0)return this.alert();if(Array.isArray(i)&&t!==!1&&s!==!0)i=ve.reorder(i);return this.value=r?i.map((o)=>o.name):i.name,super.submit()}set choices(e=[]){this.state._choices=this.state._choices||[],this.state.choices=e;for(let t of e)if(!this.state._choices.some((s)=>s.name===t.name))this.state._choices.push(t);if(!this._initial&&this.options.initial){this._initial=!0;let t=this.initial;if(typeof t==="string"||typeof t==="number"){let s=this.find(t);if(s)this.initial=s.index,this.focus(s,!0)}}}get choices(){return Ns(this,this.state.choices||[])}set visible(e){this.state.visible=e}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(e){this.state.limit=e}get limit(){let{state:e,options:t,choices:s}=this,r=e.limit||this._limit||t.limit||s.length;return Math.min(r,this.height)}set value(e){super.value=e}get value(){if(typeof super.value!=="string"&&super.value===this.initial)return this.input;return super.value}set index(e){this.state.index=e}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let e=this.choices[this.index];if(e&&this.state.submitted&&this.multiple!==!0)e.enabled=!0;return e}get selectable(){return this.choices.filter((e)=>!this.isDisabled(e))}get selected(){return this.multiple?this.enabled:this.focused}}function Ns(e,t){if(t instanceof Promise)return t;if(typeof t==="function"){if(ve.isAsyncFn(t))return t;t=t.call(e,e)}for(let s of t){if(Array.isArray(s.choices)){let r=s.choices.filter((i)=>!e.isDisabled(i));s.enabled=r.every((i)=>i.enabled===!0)}if(e.isDisabled(s)===!0)delete s.enabled}return t}Ts.exports=Ms});var Q=A((pm,vs)=>{var aa=ge(),ft=R();class _s extends aa{constructor(e){super(e);this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(e,t){if(this.multiple)return this[t.name]?await this[t.name](e,t):await super.dispatch(e,t);this.alert()}separator(){if(this.options.separator)return super.separator();let e=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():e}pointer(e,t){return!this.multiple||this.options.pointer?super.pointer(e,t):""}indicator(e,t){return this.multiple?super.indicator(e,t):""}choiceMessage(e,t){let s=this.resolve(e.message,this.state,e,t);if(e.role==="heading"&&!ft.hasColor(s))s=this.styles.strong(s);return this.resolve(s,this.state,e,t)}choiceSeparator(){return":"}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=await this.pointer(e,t),i=await this.indicator(e,t)+(e.pad||""),o=await this.resolve(e.hint,this.state,e,t);if(o&&!ft.hasColor(o))o=this.styles.muted(o);let n=this.indent(e),a=await this.choiceMessage(e,t),p=()=>[this.margin[3],n+r+i,a,this.margin[1],o].filter(Boolean).join(" ");if(e.role==="heading")return p();if(e.disabled){if(!ft.hasColor(a))a=this.styles.disabled(a);return p()}if(s)a=this.styles.em(a);return p()}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(i,o)=>await this.renderChoice(i,o)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));let s=this.margin[0]+t.join(`
12
12
  `),r;if(this.options.choicesHeader)r=await this.resolve(this.options.choicesHeader,this.state);return[r,s].filter(Boolean).join(`
13
- `)}format(){if(!this.state.submitted||this.state.cancelled)return"";if(Array.isArray(this.selected))return this.selected.map((e)=>this.styles.primary(e.name)).join(", ");return this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:t}=this.state,s="",r=await this.header(),i=await this.prefix(),o=await this.separator(),n=await this.message();if(this.options.promptLine!==!1)s=[i,n,o,""].join(" "),this.state.prompt=s;let a=await this.format(),p=await this.error()||await this.hint(),l=await this.renderChoices(),d=await this.footer();if(a)s+=a;if(p&&!s.includes(p))s+=" "+p;if(e&&!a&&!l.trim()&&this.multiple&&this.emptyError!=null)s+=this.styles.danger(this.emptyError);this.clear(t),this.write([r,s,l,d].filter(Boolean).join(`
14
- `)),this.write(this.margin[2]),this.restore()}}Ns.exports=Ss});var vs=g((Vd,Ts)=>{var ea=Q(),ta=(e,t)=>{let s=e?new RegExp(e,"ig"):/$^/;return(r)=>{return e?r.replace(s,(i)=>t(i)):r}};class Ms extends ea{constructor(e){super(e);this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:t,input:s}=this.state;return this.input=s.slice(0,t)+e+s.slice(t),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:t}=this.state;if(!t)return this.alert();return this.input=t.slice(0,e-1)+t.slice(e),this.moveCursor(-1),this.complete()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();return this.input=`${t}`.slice(0,e)+`${t}`.slice(e+1),this.complete()}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,t=this.state._choices){if(typeof this.options.suggest==="function")return this.options.suggest.call(this,e,t);let s=e.toLowerCase();return t.filter((r)=>r.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map((e)=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight||this.styles.complement,t=(i,o)=>{if(!i)return i;if(e.stack)return e(i);return e.call(this,i)},s=ta(this.input,t),r=this.choices;this.choices=r.map((i)=>({...i,message:s(i.message)})),await super.render(),this.choices=r}submit(){if(this.options.multiple)this.value=this.selected.map((e)=>e.name);return super.submit()}}Ts.exports=Ms});var ft=g((Fd,_s)=>{var ht=R();_s.exports=(e,t={})=>{e.cursorHide();let{input:s="",initial:r="",pos:i,showCursor:o=!0,color:n}=t,a=n||e.styles.placeholder,p=ht.inverse(e.styles.primary),l=(y)=>p(e.styles.black(y)),d=s,c=" ",h=l(c);if(e.blink&&e.blink.off===!0)l=(y)=>y,h="";if(o&&i===0&&r===""&&s==="")return l(c);if(o&&i===0&&(s===r||s===""))return l(r[0])+a(r.slice(1));r=ht.isPrimitive(r)?`${r}`:"",s=ht.isPrimitive(s)?`${s}`:"";let u=r&&r.startsWith(s)&&r!==s,m=u?l(r[s.length]):h;if(i!==s.length&&o===!0)d=s.slice(0,i)+l(s[i])+s.slice(i+1),m="";if(o===!1)m="";if(u){let y=e.styles.unstyle(d+m);return d+m+a(r.slice(y.length))}return d+m}});var _e=g((Qd,Cs)=>{var sa=V(),ra=Q(),ia=ft();class Rs extends ra{constructor(e){super({...e,multiple:!0});this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find((t)=>t!=null),this.emptyError="",this.values={}}async reset(e){if(await super.reset(),e===!0)this._index=this.index;return this.index=this._index,this.values={},this.choices.forEach((t)=>t.reset&&t.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let t=this.focused;if(!t)return this.alert();let{cursor:s,input:r}=t;return t.value=t.input=r.slice(0,s)+e+r.slice(s),t.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:t,input:s}=e;return e.value=e.input=s.slice(0,t-1)+s.slice(t),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:t,input:s}=e;if(s[t]===void 0)return this.alert();let r=`${s}`.slice(0,t)+`${s}`.slice(t+1);return e.value=e.input=r,this.render()}right(){let e=this.focused;if(!e)return this.alert();if(e.cursor>=e.input.length)return this.alert();return e.cursor++,this.render()}left(){let e=this.focused;if(!e)return this.alert();if(e.cursor<=0)return this.alert();return e.cursor--,this.render()}space(e,t){return this.dispatch(e,t)}number(e,t){return this.dispatch(e,t)}next(){let e=this.focused;if(!e)return this.alert();let{initial:t,input:s}=e;if(t&&t.startsWith(s)&&s!==t)return e.value=e.input=t,e.cursor=e.value.length,this.render();return super.next()}prev(){let e=this.focused;if(!e)return this.alert();if(e.cursor===0)return super.prev();return e.value=e.input="",e.cursor=0,this.render()}separator(){return""}format(e){return!this.state.submitted?super.format(e):""}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,t){let s=await this.resolve(e.separator,this.state,e,t)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(e,t){await this.onChoice(e,t);let{state:s,styles:r}=this,{cursor:i,initial:o="",name:n,input:a=""}=e,{muted:p,submitted:l,primary:d,danger:c}=r,h=this.index===t,u=e.validate||(()=>!0),m=await this.choiceSeparator(e,t),y=e.message;if(this.align==="right")y=y.padStart(this.longest+1," ");if(this.align==="left")y=y.padEnd(this.longest+1," ");let S=this.values[n]=a||o,f=a?"success":"dark";if(await u.call(e,S,this.state)!==!0)f="danger";let E=r[f],w=E(await this.indicator(e,t))+(e.pad||""),N=this.indent(e),T=()=>[N,w,y+m,a].filter(Boolean).join(" ");if(s.submitted)return y=sa(y),a=l(a),T();if(e.format)a=await e.format.call(this,a,e,t);else{let _=this.styles.muted;a=ia(this,{input:a,initial:o,pos:i,showCursor:h,color:_})}if(!this.isValue(a))a=this.styles.muted(this.symbols.ellipsis);if(e.result)this.values[n]=await e.result.call(this,S,e,t);if(h)y=d(y);if(e.error)a+=(a?" ":"")+c(e.error.trim());else if(e.hint)a+=(a?" ":"")+p(e.hint.trim());return T()}async submit(){return this.value=this.values,super.base.submit.call(this)}}Cs.exports=Rs});var yt=g((Zd,Bs)=>{var oa=_e(),na=()=>{throw Error("expected prompt to have a custom authenticate method")},Ds=(e=na)=>{class t extends oa{constructor(s){super(s)}async submit(){this.value=await e.call(this,this.values,this.state),super.base.submit.call(this)}static create(s){return Ds(s)}}return t};Bs.exports=Ds()});var Is=g((zd,Ps)=>{var aa=yt();function pa(e,t){if(e.username===this.options.username&&e.password===this.options.password)return!0;return!1}var Os=(e=pa)=>{let t=[{name:"username",message:"username"},{name:"password",message:"password",format(r){if(this.options.showPassword)return r;return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(r.length))}}];class s extends aa.create(e){constructor(r){super({...r,choices:t})}static create(r){return Os(r)}}return s};Ps.exports=Os()});var Re=g((Xd,$s)=>{var la=de(),{isPrimitive:da,hasColor:ua}=R();class Ls extends la{constructor(e){super(e);this.cursorHide()}async initialize(){let e=await this.resolve(this.initial,this.state);this.input=await this.cast(e),await super.initialize()}dispatch(e){if(!this.isValue(e))return this.alert();return this.input=e,this.submit()}format(e){let{styles:t,state:s}=this;return!s.submitted?t.primary(e):t.success(e)}cast(e){return this.isTrue(e)}isTrue(e){return/^[ty1]/i.test(e)}isFalse(e){return/^[fn0]/i.test(e)}isValue(e){return da(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");if(!ua(e))return this.styles.muted(e);return e}}async render(){let{input:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o=this.styles.muted(this.default),n=[s,i,o,r].filter(Boolean).join(" ");this.state.prompt=n;let a=await this.header(),p=this.value=this.cast(e),l=await this.format(p),d=await this.error()||await this.hint(),c=await this.footer();if(d&&!n.includes(d))l+=" "+d;n+=" "+l,this.clear(t),this.write([a,n,c].filter(Boolean).join(`
15
- `)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}}$s.exports=Ls});var Gs=g((Jd,qs)=>{var ca=Re();class Us extends ca{constructor(e){super(e);this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}}qs.exports=Us});var Hs=g((jd,Ws)=>{var ma=Q(),ha=_e(),ue=ha.prototype;class Ks extends ma{constructor(e){super({...e,multiple:!0});this.align=[this.options.align,"left"].find((t)=>t!=null),this.emptyError="",this.values={}}dispatch(e,t){let s=this.focused,r=s.parent||{};if(!s.editable&&!r.editable){if(e==="a"||e==="i")return super[e]()}return ue.dispatch.call(this,e,t)}append(e,t){return ue.append.call(this,e,t)}delete(e,t){return ue.delete.call(this,e,t)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?ue.next.call(this):super.next()}prev(){return this.focused.editable?ue.prev.call(this):super.prev()}async indicator(e,t){let s=e.indicator||"",r=e.editable?s:super.indicator(e,t);return await this.resolve(r,this.state,e,t)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,t){if(e.indent="",e.editable)return ue.renderChoice.call(this,e,t);return super.renderChoice(e,t)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let t of this.choices){if(typeof t.validate!=="function")continue;if(t.role==="heading")continue;let s=t.parent?this.value[t.parent.name]:this.value;if(t.editable)s=t.value===t.name?t.initial||"":t.value;else if(!this.isDisabled(t))s=t.enabled===!0;if(e=await t.validate(s,this.state),e!==!0)break}if(e!==!0)this.state.error=typeof e==="string"?e:"Invalid Input";return e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some((e)=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let t=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}if(e.editable)t[e.name]=e.value===e.name?e.initial||"":e.value;else if(!this.isDisabled(e))t[e.name]=e.enabled===!0}return this.base.submit.call(this)}}Ws.exports=Ks});var pe=g((kd,Vs)=>{var fa=de(),ya=st(),ga=ft(),{isPrimitive:Ea}=R();class Ys extends fa{constructor(e){super(e);if(this.initial=Ea(this.initial)?String(this.initial):"",this.initial)this.cursorHide();this.state.prevCursor=0,this.state.clipboard=[],this.keypressTimeout=this.options.keypressTimeout!==void 0?this.options.keypressTimeout:null}async keypress(e,t=e?ya(e,{}):{}){let s=Date.now(),r=s-this.lastKeypress;this.lastKeypress=s;let i=t.name==="return"||t.name==="enter",o=this.state.prevKeypress,n;if(this.state.prevKeypress=t,this.keypressTimeout!=null&&i){if(r<this.keypressTimeout)return this.submit();this.state.multilineBuffer=this.state.multilineBuffer||"",this.state.multilineBuffer+=e,n=!0,o=null}if(n||this.options.multiline&&i){if(!o||o.name!=="return")return this.append(`
16
- `,t)}return super.keypress(e,t)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,t){if(!e||t.ctrl||t.code)return this.alert();this.append(e)}append(e){let{cursor:t,input:s}=this.state;this.input=`${s}`.slice(0,t)+e+`${s}`.slice(t),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:t}=this.state;if(e<=0)return this.alert();this.input=`${t}`.slice(0,e-1)+`${t}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();this.input=`${t}`.slice(0,e)+`${t}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let t=this.input.slice(0,e),s=this.input.slice(e),r=t.split(" ");this.state.clipboard.push(r.pop()),this.input=r.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){if(this.state.prevCursor)this.cursor=this.state.prevCursor,this.state.prevCursor=0;else this.state.prevCursor=this.cursor,this.cursor=0;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){if(this.cursor>=this.input.length)return this.alert();return this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();return this.moveCursor(-1),this.render()}isValue(e){return!!e}async format(e=this.value){let t=await this.resolve(this.initial,this.state);if(!this.state.submitted)return ga(this,{input:e,initial:t,pos:this.cursor});return this.styles.submitted(e||t)}async render(){let e=this.state.size,t=await this.prefix(),s=await this.separator(),r=await this.message(),i=[t,r,s].filter(Boolean).join(" ");this.state.prompt=i;let o=await this.header(),n=await this.format(),a=await this.error()||await this.hint(),p=await this.footer();if(a&&!n.includes(a))n+=" "+a;i+=" "+n,this.clear(e),this.write([o,i,p].filter(Boolean).join(`
17
- `)),this.restore()}}Vs.exports=Ys});var Qs=g((eu,Fs)=>{var Aa=(e)=>e.filter((t,s)=>e.lastIndexOf(t)===s),Ce=(e)=>Aa(e).filter(Boolean);Fs.exports=(e,t={},s="")=>{let{past:r=[],present:i=""}=t,o,n;switch(e){case"prev":case"undo":return o=r.slice(0,r.length-1),n=r[r.length-1]||"",{past:Ce([s,...o]),present:n};case"next":case"redo":return o=r.slice(1),n=r[0]||"",{past:Ce([...o,s]),present:n};case"save":return{past:Ce([...r,s]),present:""};case"remove":if(n=Ce(r.filter((a)=>a!==s)),i="",n.length)i=n.pop();return{past:n,present:i};default:throw Error(`Invalid action: "${e}"`)}}});var gt=g((tu,Xs)=>{var ba=pe(),Zs=Qs();class zs extends ba{constructor(e){super(e);let t=this.options.history;if(t&&t.store){let s=t.values||this.initial;this.autosave=!!t.autosave,this.store=t.store,this.data=this.store.get("values")||{past:[],present:s},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){if(!this.store)return this.alert();if(this.data=Zs(e,this.data,this.input),!this.data.present)return this.alert();return this.input=this.data.present,this.cursor=this.input.length,this.render()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){if(!this.store)return;this.data=Zs("save",this.data,this.input),this.store.set("values",this.data)}submit(){if(this.store&&this.autosave===!0)this.save();return super.submit()}}Xs.exports=zs});var ks=g((su,js)=>{var xa=pe();class Js extends xa{format(){return""}}js.exports=Js});var sr=g((ru,tr)=>{var wa=pe();class er extends wa{constructor(e={}){super(e);this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:(t)=>t;return this.list.map(e).join(", ")}async submit(e){let t=this.state.error||await this.validate(this.list,this.state);if(t!==!0)return this.state.error=t,super.submit();return this.value=this.list,super.submit()}get list(){return this.split()}}tr.exports=er});var or=g((iu,ir)=>{var Sa=Q();class rr extends Sa{constructor(e){super({...e,multiple:!0})}}ir.exports=rr});var Et=g((ou,ar)=>{var Na=pe();class nr extends Na{constructor(e={}){super({style:"number",...e});this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1000,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){if(!/[-+.]/.test(e)||e==="."&&this.input.includes("."))return this.alert("invalid number");return super.append(e)}number(e){return super.append(e)}next(){if(this.input&&this.input!==this.initial)return this.alert();if(!this.isValue(this.initial))return this.alert();return this.input=this.initial,this.cursor=String(this.initial).length,this.render()}up(e){let t=e||this.minor,s=this.toNumber(this.input);if(s>this.max+t)return this.alert();return this.input=`${s+t}`,this.render()}down(e){let t=e||this.minor,s=this.toNumber(this.input);if(s<this.min-t)return this.alert();return this.input=`${s-t}`,this.render()}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){if(typeof this.options.format==="function")return this.options.format.call(this,e);return this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find((t)=>this.isValue(t));return this.value=this.toNumber(e||0),super.submit()}}ar.exports=nr});var dr=g((nu,lr)=>{var Ma=pe();class pr extends Ma{constructor(e){super(e);this.cursorShow()}format(e=this.input){if(!this.keypressed)return"";return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length))}}lr.exports=pr});var hr=g((au,mr)=>{var Ta=V(),va=ge(),ur=R();class cr extends va{constructor(e={}){super(e);this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
13
+ `)}format(){if(!this.state.submitted||this.state.cancelled)return"";if(Array.isArray(this.selected))return this.selected.map((e)=>this.styles.primary(e.name)).join(", ");return this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:t}=this.state,s="",r=await this.header(),i=await this.prefix(),o=await this.separator(),n=await this.message();if(this.options.promptLine!==!1)s=[i,n,o,""].join(" "),this.state.prompt=s;let a=await this.format(),p=await this.error()||await this.hint(),l=await this.renderChoices(),c=await this.footer();if(a)s+=a;if(p&&!s.includes(p))s+=" "+p;if(e&&!a&&!l.trim()&&this.multiple&&this.emptyError!=null)s+=this.styles.danger(this.emptyError);this.clear(t),this.write([r,s,l,c].filter(Boolean).join(`
14
+ `)),this.write(this.margin[2]),this.restore()}}vs.exports=_s});var Ds=A((lm,Cs)=>{var pa=Q(),la=(e,t)=>{let s=e?new RegExp(e,"ig"):/$^/;return(r)=>{return e?r.replace(s,(i)=>t(i)):r}};class Rs extends pa{constructor(e){super(e);this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:t,input:s}=this.state;return this.input=s.slice(0,t)+e+s.slice(t),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:t}=this.state;if(!t)return this.alert();return this.input=t.slice(0,e-1)+t.slice(e),this.moveCursor(-1),this.complete()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();return this.input=`${t}`.slice(0,e)+`${t}`.slice(e+1),this.complete()}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,t=this.state._choices){if(typeof this.options.suggest==="function")return this.options.suggest.call(this,e,t);let s=e.toLowerCase();return t.filter((r)=>r.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map((e)=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight||this.styles.complement,t=(i,o)=>{if(!i)return i;if(e.stack)return e(i);return e.call(this,i)},s=la(this.input,t),r=this.choices;this.choices=r.map((i)=>({...i,message:s(i.message)})),await super.render(),this.choices=r}submit(){if(this.options.multiple)this.value=this.selected.map((e)=>e.name);return super.submit()}}Cs.exports=Rs});var gt=A((cm,Bs)=>{var yt=R();Bs.exports=(e,t={})=>{e.cursorHide();let{input:s="",initial:r="",pos:i,showCursor:o=!0,color:n}=t,a=n||e.styles.placeholder,p=yt.inverse(e.styles.primary),l=(y)=>p(e.styles.black(y)),c=s,d=" ",h=l(d);if(e.blink&&e.blink.off===!0)l=(y)=>y,h="";if(o&&i===0&&r===""&&s==="")return l(d);if(o&&i===0&&(s===r||s===""))return l(r[0])+a(r.slice(1));r=yt.isPrimitive(r)?`${r}`:"",s=yt.isPrimitive(s)?`${s}`:"";let m=r&&r.startsWith(s)&&r!==s,u=m?l(r[s.length]):h;if(i!==s.length&&o===!0)c=s.slice(0,i)+l(s[i])+s.slice(i+1),u="";if(o===!1)u="";if(m){let y=e.styles.unstyle(c+u);return c+u+a(r.slice(y.length))}return c+u}});var Re=A((mm,Ps)=>{var ca=V(),ma=Q(),da=gt();class Os extends ma{constructor(e){super({...e,multiple:!0});this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find((t)=>t!=null),this.emptyError="",this.values={}}async reset(e){if(await super.reset(),e===!0)this._index=this.index;return this.index=this._index,this.values={},this.choices.forEach((t)=>t.reset&&t.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let t=this.focused;if(!t)return this.alert();let{cursor:s,input:r}=t;return t.value=t.input=r.slice(0,s)+e+r.slice(s),t.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:t,input:s}=e;return e.value=e.input=s.slice(0,t-1)+s.slice(t),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:t,input:s}=e;if(s[t]===void 0)return this.alert();let r=`${s}`.slice(0,t)+`${s}`.slice(t+1);return e.value=e.input=r,this.render()}right(){let e=this.focused;if(!e)return this.alert();if(e.cursor>=e.input.length)return this.alert();return e.cursor++,this.render()}left(){let e=this.focused;if(!e)return this.alert();if(e.cursor<=0)return this.alert();return e.cursor--,this.render()}space(e,t){return this.dispatch(e,t)}number(e,t){return this.dispatch(e,t)}next(){let e=this.focused;if(!e)return this.alert();let{initial:t,input:s}=e;if(t&&t.startsWith(s)&&s!==t)return e.value=e.input=t,e.cursor=e.value.length,this.render();return super.next()}prev(){let e=this.focused;if(!e)return this.alert();if(e.cursor===0)return super.prev();return e.value=e.input="",e.cursor=0,this.render()}separator(){return""}format(e){return!this.state.submitted?super.format(e):""}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,t){let s=await this.resolve(e.separator,this.state,e,t)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(e,t){await this.onChoice(e,t);let{state:s,styles:r}=this,{cursor:i,initial:o="",name:n,input:a=""}=e,{muted:p,submitted:l,primary:c,danger:d}=r,h=this.index===t,m=e.validate||(()=>!0),u=await this.choiceSeparator(e,t),y=e.message;if(this.align==="right")y=y.padStart(this.longest+1," ");if(this.align==="left")y=y.padEnd(this.longest+1," ");let S=this.values[n]=a||o,f=a?"success":"dark";if(await m.call(e,S,this.state)!==!0)f="danger";let b=r[f],x=b(await this.indicator(e,t))+(e.pad||""),N=this.indent(e),T=()=>[N,x,y+u,a].filter(Boolean).join(" ");if(s.submitted)return y=ca(y),a=l(a),T();if(e.format)a=await e.format.call(this,a,e,t);else{let v=this.styles.muted;a=da(this,{input:a,initial:o,pos:i,showCursor:h,color:v})}if(!this.isValue(a))a=this.styles.muted(this.symbols.ellipsis);if(e.result)this.values[n]=await e.result.call(this,S,e,t);if(h)y=c(y);if(e.error)a+=(a?" ":"")+d(e.error.trim());else if(e.hint)a+=(a?" ":"")+p(e.hint.trim());return T()}async submit(){return this.value=this.values,super.base.submit.call(this)}}Ps.exports=Os});var Et=A((dm,Ls)=>{var ua=Re(),ha=()=>{throw Error("expected prompt to have a custom authenticate method")},Is=(e=ha)=>{class t extends ua{constructor(s){super(s)}async submit(){this.value=await e.call(this,this.values,this.state),super.base.submit.call(this)}static create(s){return Is(s)}}return t};Ls.exports=Is()});var Us=A((um,Gs)=>{var fa=Et();function ya(e,t){if(e.username===this.options.username&&e.password===this.options.password)return!0;return!1}var $s=(e=ya)=>{let t=[{name:"username",message:"username"},{name:"password",message:"password",format(r){if(this.options.showPassword)return r;return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(r.length))}}];class s extends fa.create(e){constructor(r){super({...r,choices:t})}static create(r){return $s(r)}}return s};Gs.exports=$s()});var Ce=A((hm,Ks)=>{var ga=ce(),{isPrimitive:Ea,hasColor:Aa}=R();class qs extends ga{constructor(e){super(e);this.cursorHide()}async initialize(){let e=await this.resolve(this.initial,this.state);this.input=await this.cast(e),await super.initialize()}dispatch(e){if(!this.isValue(e))return this.alert();return this.input=e,this.submit()}format(e){let{styles:t,state:s}=this;return!s.submitted?t.primary(e):t.success(e)}cast(e){return this.isTrue(e)}isTrue(e){return/^[ty1]/i.test(e)}isFalse(e){return/^[fn0]/i.test(e)}isValue(e){return Ea(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");if(!Aa(e))return this.styles.muted(e);return e}}async render(){let{input:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o=this.styles.muted(this.default),n=[s,i,o,r].filter(Boolean).join(" ");this.state.prompt=n;let a=await this.header(),p=this.value=this.cast(e),l=await this.format(p),c=await this.error()||await this.hint(),d=await this.footer();if(c&&!n.includes(c))l+=" "+c;n+=" "+l,this.clear(t),this.write([a,n,d].filter(Boolean).join(`
15
+ `)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}}Ks.exports=qs});var Ys=A((fm,Ws)=>{var ba=Ce();class Hs extends ba{constructor(e){super(e);this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}}Ws.exports=Hs});var Qs=A((ym,Fs)=>{var wa=Q(),xa=Re(),me=xa.prototype;class Vs extends wa{constructor(e){super({...e,multiple:!0});this.align=[this.options.align,"left"].find((t)=>t!=null),this.emptyError="",this.values={}}dispatch(e,t){let s=this.focused,r=s.parent||{};if(!s.editable&&!r.editable){if(e==="a"||e==="i")return super[e]()}return me.dispatch.call(this,e,t)}append(e,t){return me.append.call(this,e,t)}delete(e,t){return me.delete.call(this,e,t)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?me.next.call(this):super.next()}prev(){return this.focused.editable?me.prev.call(this):super.prev()}async indicator(e,t){let s=e.indicator||"",r=e.editable?s:super.indicator(e,t);return await this.resolve(r,this.state,e,t)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,t){if(e.indent="",e.editable)return me.renderChoice.call(this,e,t);return super.renderChoice(e,t)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let t of this.choices){if(typeof t.validate!=="function")continue;if(t.role==="heading")continue;let s=t.parent?this.value[t.parent.name]:this.value;if(t.editable)s=t.value===t.name?t.initial||"":t.value;else if(!this.isDisabled(t))s=t.enabled===!0;if(e=await t.validate(s,this.state),e!==!0)break}if(e!==!0)this.state.error=typeof e==="string"?e:"Invalid Input";return e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some((e)=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let t=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}if(e.editable)t[e.name]=e.value===e.name?e.initial||"":e.value;else if(!this.isDisabled(e))t[e.name]=e.enabled===!0}return this.base.submit.call(this)}}Fs.exports=Vs});var pe=A((gm,Zs)=>{var Sa=ce(),Na=it(),Ma=gt(),{isPrimitive:Ta}=R();class zs extends Sa{constructor(e){super(e);if(this.initial=Ta(this.initial)?String(this.initial):"",this.initial)this.cursorHide();this.state.prevCursor=0,this.state.clipboard=[],this.keypressTimeout=this.options.keypressTimeout!==void 0?this.options.keypressTimeout:null}async keypress(e,t=e?Na(e,{}):{}){let s=Date.now(),r=s-this.lastKeypress;this.lastKeypress=s;let i=t.name==="return"||t.name==="enter",o=this.state.prevKeypress,n;if(this.state.prevKeypress=t,this.keypressTimeout!=null&&i){if(r<this.keypressTimeout)return this.submit();this.state.multilineBuffer=this.state.multilineBuffer||"",this.state.multilineBuffer+=e,n=!0,o=null}if(n||this.options.multiline&&i){if(!o||o.name!=="return")return this.append(`
16
+ `,t)}return super.keypress(e,t)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,t){if(!e||t.ctrl||t.code)return this.alert();this.append(e)}append(e){let{cursor:t,input:s}=this.state;this.input=`${s}`.slice(0,t)+e+`${s}`.slice(t),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:t}=this.state;if(e<=0)return this.alert();this.input=`${t}`.slice(0,e-1)+`${t}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();this.input=`${t}`.slice(0,e)+`${t}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let t=this.input.slice(0,e),s=this.input.slice(e),r=t.split(" ");this.state.clipboard.push(r.pop()),this.input=r.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){if(this.state.prevCursor)this.cursor=this.state.prevCursor,this.state.prevCursor=0;else this.state.prevCursor=this.cursor,this.cursor=0;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){if(this.cursor>=this.input.length)return this.alert();return this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();return this.moveCursor(-1),this.render()}isValue(e){return!!e}async format(e=this.value){let t=await this.resolve(this.initial,this.state);if(!this.state.submitted)return Ma(this,{input:e,initial:t,pos:this.cursor});return this.styles.submitted(e||t)}async render(){let e=this.state.size,t=await this.prefix(),s=await this.separator(),r=await this.message(),i=[t,r,s].filter(Boolean).join(" ");this.state.prompt=i;let o=await this.header(),n=await this.format(),a=await this.error()||await this.hint(),p=await this.footer();if(a&&!n.includes(a))n+=" "+a;i+=" "+n,this.clear(e),this.write([o,i,p].filter(Boolean).join(`
17
+ `)),this.restore()}}Zs.exports=zs});var Js=A((Em,Xs)=>{var _a=(e)=>e.filter((t,s)=>e.lastIndexOf(t)===s),De=(e)=>_a(e).filter(Boolean);Xs.exports=(e,t={},s="")=>{let{past:r=[],present:i=""}=t,o,n;switch(e){case"prev":case"undo":return o=r.slice(0,r.length-1),n=r[r.length-1]||"",{past:De([s,...o]),present:n};case"next":case"redo":return o=r.slice(1),n=r[0]||"",{past:De([...o,s]),present:n};case"save":return{past:De([...r,s]),present:""};case"remove":if(n=De(r.filter((a)=>a!==s)),i="",n.length)i=n.pop();return{past:n,present:i};default:throw Error(`Invalid action: "${e}"`)}}});var At=A((Am,er)=>{var va=pe(),js=Js();class ks extends va{constructor(e){super(e);let t=this.options.history;if(t&&t.store){let s=t.values||this.initial;this.autosave=!!t.autosave,this.store=t.store,this.data=this.store.get("values")||{past:[],present:s},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){if(!this.store)return this.alert();if(this.data=js(e,this.data,this.input),!this.data.present)return this.alert();return this.input=this.data.present,this.cursor=this.input.length,this.render()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){if(!this.store)return;this.data=js("save",this.data,this.input),this.store.set("values",this.data)}submit(){if(this.store&&this.autosave===!0)this.save();return super.submit()}}er.exports=ks});var rr=A((bm,sr)=>{var Ra=pe();class tr extends Ra{format(){return""}}sr.exports=tr});var nr=A((wm,or)=>{var Ca=pe();class ir extends Ca{constructor(e={}){super(e);this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:(t)=>t;return this.list.map(e).join(", ")}async submit(e){let t=this.state.error||await this.validate(this.list,this.state);if(t!==!0)return this.state.error=t,super.submit();return this.value=this.list,super.submit()}get list(){return this.split()}}or.exports=ir});var lr=A((xm,pr)=>{var Da=Q();class ar extends Da{constructor(e){super({...e,multiple:!0})}}pr.exports=ar});var bt=A((Sm,mr)=>{var Ba=pe();class cr extends Ba{constructor(e={}){super({style:"number",...e});this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1000,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){if(!/[-+.]/.test(e)||e==="."&&this.input.includes("."))return this.alert("invalid number");return super.append(e)}number(e){return super.append(e)}next(){if(this.input&&this.input!==this.initial)return this.alert();if(!this.isValue(this.initial))return this.alert();return this.input=this.initial,this.cursor=String(this.initial).length,this.render()}up(e){let t=e||this.minor,s=this.toNumber(this.input);if(s>this.max+t)return this.alert();return this.input=`${s+t}`,this.render()}down(e){let t=e||this.minor,s=this.toNumber(this.input);if(s<this.min-t)return this.alert();return this.input=`${s-t}`,this.render()}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){if(typeof this.options.format==="function")return this.options.format.call(this,e);return this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find((t)=>this.isValue(t));return this.value=this.toNumber(e||0),super.submit()}}mr.exports=cr});var hr=A((Nm,ur)=>{var Oa=pe();class dr extends Oa{constructor(e){super(e);this.cursorShow()}format(e=this.input){if(!this.keypressed)return"";return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length))}}ur.exports=dr});var Er=A((Mm,gr)=>{var Pa=V(),Ia=ge(),fr=R();class yr extends Ia{constructor(e={}){super(e);this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
18
18
  `;let t=e.startNumber||1;if(typeof this.scale==="number")this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((s,r)=>({name:r+t}))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let t of this.choices){e=Math.max(e,t.message.length),t.scaleIndex=t.initial||2,t.scale=[];for(let s=0;s<this.scale.length;s++)t.scale.push({index:s})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,t){if(this.multiple)return this[t.name]?await this[t.name](e,t):await super.dispatch(e,t);this.alert()}heading(e,t,s){return this.styles.strong(e)}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;if(e.scaleIndex>=this.scale.length-1)return this.alert();return e.scaleIndex++,this.render()}left(){let e=this.focused;if(e.scaleIndex<=0)return this.alert();return e.scaleIndex--,this.render()}indent(){return""}format(){if(this.state.submitted)return this.choices.map((t)=>this.styles.info(t.index)).join(", ");return""}pointer(){return""}renderScaleKey(){if(this.scaleKey===!1)return"";if(this.state.submitted)return"";return["",...this.scale.map((s)=>` ${s.name} - ${s.message}`)].map((s)=>this.styles.muted(s)).join(`
19
- `)}renderScaleHeading(e){let t=this.scale.map((a)=>a.name);if(typeof this.options.renderScaleHeading==="function")t=this.options.renderScaleHeading.call(this,e);let s=this.scaleLength-t.join("").length,r=Math.round(s/(t.length-1)),o=t.map((a)=>this.styles.strong(a)).join(" ".repeat(r)),n=" ".repeat(this.widths[0]);return this.margin[3]+n+this.margin[1]+o}scaleIndicator(e,t,s){if(typeof this.options.scaleIndicator==="function")return this.options.scaleIndicator.call(this,e,t,s);let r=e.scaleIndex===t.index;if(t.disabled)return this.styles.hint(this.symbols.radio.disabled);if(r)return this.styles.success(this.symbols.radio.on);return this.symbols.radio.off}renderScale(e,t){let s=e.scale.map((i)=>this.scaleIndicator(e,i,t)),r=this.term==="Hyper"?"":" ";return s.join(r+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=await this.pointer(e,t),i=await e.hint;if(i&&!ur.hasColor(i))i=this.styles.muted(i);let o=(u)=>this.margin[3]+u.replace(/\s+$/,"").padEnd(this.widths[0]," "),n=this.newline,a=this.indent(e),p=await this.resolve(e.message,this.state,e,t),l=await this.renderScale(e,t),d=this.margin[1]+this.margin[3];this.scaleLength=Ta(l).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-d.length);let h=ur.wordWrap(p,{width:this.widths[0],newline:n}).split(`
20
- `).map((u)=>o(u)+this.margin[1]);if(s)l=this.styles.info(l),h=h.map((u)=>this.styles.info(u));if(h[0]+=l,this.linebreak)h.push("");return[a+r,h.join(`
19
+ `)}renderScaleHeading(e){let t=this.scale.map((a)=>a.name);if(typeof this.options.renderScaleHeading==="function")t=this.options.renderScaleHeading.call(this,e);let s=this.scaleLength-t.join("").length,r=Math.round(s/(t.length-1)),o=t.map((a)=>this.styles.strong(a)).join(" ".repeat(r)),n=" ".repeat(this.widths[0]);return this.margin[3]+n+this.margin[1]+o}scaleIndicator(e,t,s){if(typeof this.options.scaleIndicator==="function")return this.options.scaleIndicator.call(this,e,t,s);let r=e.scaleIndex===t.index;if(t.disabled)return this.styles.hint(this.symbols.radio.disabled);if(r)return this.styles.success(this.symbols.radio.on);return this.symbols.radio.off}renderScale(e,t){let s=e.scale.map((i)=>this.scaleIndicator(e,i,t)),r=this.term==="Hyper"?"":" ";return s.join(r+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=await this.pointer(e,t),i=await e.hint;if(i&&!fr.hasColor(i))i=this.styles.muted(i);let o=(m)=>this.margin[3]+m.replace(/\s+$/,"").padEnd(this.widths[0]," "),n=this.newline,a=this.indent(e),p=await this.resolve(e.message,this.state,e,t),l=await this.renderScale(e,t),c=this.margin[1]+this.margin[3];this.scaleLength=Pa(l).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-c.length);let h=fr.wordWrap(p,{width:this.widths[0],newline:n}).split(`
20
+ `).map((m)=>o(m)+this.margin[1]);if(s)l=this.styles.info(l),h=h.map((m)=>this.styles.info(m));if(h[0]+=l,this.linebreak)h.push("");return[a+r,h.join(`
21
21
  `)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(r,i)=>await this.renderChoice(r,i)),t=await Promise.all(e),s=await this.renderScaleHeading();return this.margin[0]+[s,...t.map((r)=>r.join(" "))].join(`
22
- `)}async render(){let{submitted:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o="";if(this.options.promptLine!==!1)o=[s,i,r,""].join(" "),this.state.prompt=o;let n=await this.header(),a=await this.format(),p=await this.renderScaleKey(),l=await this.error()||await this.hint(),d=await this.renderChoices(),c=await this.footer(),h=this.emptyError;if(a)o+=a;if(l&&!o.includes(l))o+=" "+l;if(e&&!a&&!d.trim()&&this.multiple&&h!=null)o+=this.styles.danger(h);if(this.clear(t),this.write([n,o,p,d,c].filter(Boolean).join(`
23
- `)),!this.state.submitted)this.write(this.margin[2]);this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}}mr.exports=cr});var Er=g((pu,gr)=>{var fr=V(),_a=(e="")=>{return typeof e==="string"?e.replace(/^['"]|['"]$/g,""):""};class yr{constructor(e){this.name=e.key,this.field=e.field||{},this.value=_a(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}}var Ra=async(e={},t={},s=(r)=>r)=>{let r=new Set,i=e.fields||[],o=e.template,n=[],a=[],p=[],l=1;if(typeof o==="function")o=await o();let d=-1,c=()=>o[++d],h=()=>o[d+1],u=(m)=>{m.line=l,n.push(m)};u({type:"bos",value:""});while(d<o.length-1){let m=c();if(/^[^\S\n ]$/.test(m)){u({type:"text",value:m});continue}if(m===`
24
- `){u({type:"newline",value:m}),l++;continue}if(m==="\\"){m+=c(),u({type:"text",value:m});continue}if((m==="$"||m==="#"||m==="{")&&h()==="{"){let S=c();m+=S;let f={type:"template",open:m,inner:"",close:"",value:m},E;while(E=c()){if(E==="}"){if(h()==="}")E+=c();f.value+=E,f.close=E;break}if(E===":")f.initial="",f.key=f.inner;else if(f.initial!==void 0)f.initial+=E;f.value+=E,f.inner+=E}if(f.template=f.open+(f.initial||f.inner)+f.close,f.key=f.key||f.inner,hasOwnProperty.call(t,f.key))f.initial=t[f.key];f=s(f),u(f),p.push(f.key),r.add(f.key);let w=a.find((N)=>N.name===f.key);if(f.field=i.find((N)=>N.name===f.key),!w)w=new yr(f),a.push(w);w.lines.push(f.line-1);continue}let y=n[n.length-1];if(y.type==="text"&&y.line===l)y.value+=m;else u({type:"text",value:m})}return u({type:"eos",value:""}),{input:o,tabstops:n,unique:r,keys:p,items:a}};gr.exports=async(e)=>{let t=e.options,s=new Set(t.required===!0?[]:t.required||[]),r={...t.values,...t.initial},{tabstops:i,items:o,keys:n}=await Ra(t,r),a=At("result",e,t),p=At("format",e,t),l=At("validate",e,t,!0),d=e.isValue.bind(e);return async(c={},h=!1)=>{let u=0;c.required=s,c.items=o,c.keys=n,c.output="";let m=async(E,w,N,T)=>{let _=await l(E,w,N,T);if(_===!1)return"Invalid field "+N.name;return _};for(let E of i){let{value:w,key:N}=E;if(E.type!=="template"){if(w)c.output+=w;continue}if(E.type==="template"){let T=o.find((le)=>le.name===N);if(t.required===!0)c.required.add(T.name);let _=[T.input,c.values[T.value],T.value,w].find(d),xe=(T.field||{}).message||E.inner;if(h){let le=await m(c.values[N],c,T,u);if(le&&typeof le==="string"||le===!1){c.invalid.set(N,le);continue}c.invalid.delete(N);let Co=await a(c.values[N],c,T,u);c.output+=fr(Co);continue}T.placeholder=!1;let Ro=w;if(w=await p(w,c,T,u),_!==w)c.values[N]=_,w=e.styles.typing(_),c.missing.delete(xe);else if(c.values[N]=void 0,_=`<${xe}>`,w=e.styles.primary(_),T.placeholder=!0,c.required.has(N))c.missing.add(xe);if(c.missing.has(xe)&&c.validating)w=e.styles.warning(_);if(c.invalid.has(N)&&c.validating)w=e.styles.danger(_);if(u===c.index)if(Ro!==w)w=e.styles.underline(w);else w=e.styles.heading(fr(w));u++}if(w)c.output+=w}let y=c.output.split(`
25
- `).map((E)=>" "+E),S=o.length,f=0;for(let E of o){if(c.invalid.has(E.name))E.lines.forEach((w)=>{if(y[w][0]!==" ")return;y[w]=c.styles.danger(c.symbols.bullet)+y[w].slice(1)});if(e.isValue(c.values[E.name]))f++}return c.completed=(f/S*100).toFixed(0),c.output=y.join(`
26
- `),c.output}};function At(e,t,s,r){return(i,o,n,a)=>{if(typeof n.field[e]==="function")return n.field[e].call(t,i,o,n,a);return[r,i].find((p)=>t.isValue(p))}}});var xr=g((lu,br)=>{var Ca=V(),Da=Er(),Ba=de();class Ar extends Ba{constructor(e){super(e);this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Da(this),await super.initialize()}async reset(e){if(this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0)await this.initialize(),await this.render()}moveCursor(e){let t=this.getItem();this.cursor+=e,t.cursor+=e}dispatch(e,t){if(!t.code&&!t.ctrl&&e!=null&&this.getItem()){this.append(e,t);return}this.alert()}append(e,t){let s=this.getItem(),r=s.input.slice(0,this.cursor),i=s.input.slice(this.cursor);this.input=s.input=`${r}${e}${i}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let t=e.input.slice(this.cursor),s=e.input.slice(0,this.cursor-1);this.input=e.input=`${s}${t}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let t=this.state.completed<100?this.styles.warning:this.styles.success;if(this.state.submitted===!0&&this.state.completed!==100)t=this.styles.danger;return t(`${this.state.completed}% completed`)}async render(){let{index:e,keys:t=[],submitted:s,size:r}=this.state,i=[this.options.newline,`
27
- `].find((f)=>f!=null),o=await this.prefix(),n=await this.separator(),a=await this.message(),p=[o,a,n].filter(Boolean).join(" ");this.state.prompt=p;let l=await this.header(),d=await this.error()||"",c=await this.hint()||"",h=s?"":await this.interpolate(this.state),u=this.state.key=t[e]||"",m=await this.format(u),y=await this.footer();if(m)p+=" "+m;if(c&&!m&&this.state.completed===0)p+=" "+c;this.clear(r);let S=[l,p,h,y,d.trim()];this.write(S.filter(Boolean).join(i)),this.restore()}getItem(e){let{items:t,keys:s,index:r}=this.state,i=t.find((o)=>o.name===s[r]);if(i&&i.input!=null)this.input=i.input,this.cursor=i.cursor;return i}async submit(){if(typeof this.interpolate!=="function")await this.initialize();await this.interpolate(this.state,!0);let{invalid:e,missing:t,output:s,values:r}=this.state;if(e.size){let n="";for(let[a,p]of e)n+=`Invalid ${a}: ${p}
28
- `;return this.state.error=n,super.submit()}if(t.size)return this.state.error="Required: "+[...t.keys()].join(", "),super.submit();let o=Ca(s).split(`
22
+ `)}async render(){let{submitted:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o="";if(this.options.promptLine!==!1)o=[s,i,r,""].join(" "),this.state.prompt=o;let n=await this.header(),a=await this.format(),p=await this.renderScaleKey(),l=await this.error()||await this.hint(),c=await this.renderChoices(),d=await this.footer(),h=this.emptyError;if(a)o+=a;if(l&&!o.includes(l))o+=" "+l;if(e&&!a&&!c.trim()&&this.multiple&&h!=null)o+=this.styles.danger(h);if(this.clear(t),this.write([n,o,p,c,d].filter(Boolean).join(`
23
+ `)),!this.state.submitted)this.write(this.margin[2]);this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}}gr.exports=yr});var xr=A((Tm,wr)=>{var Ar=V(),La=(e="")=>{return typeof e==="string"?e.replace(/^['"]|['"]$/g,""):""};class br{constructor(e){this.name=e.key,this.field=e.field||{},this.value=La(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}}var $a=async(e={},t={},s=(r)=>r)=>{let r=new Set,i=e.fields||[],o=e.template,n=[],a=[],p=[],l=1;if(typeof o==="function")o=await o();let c=-1,d=()=>o[++c],h=()=>o[c+1],m=(u)=>{u.line=l,n.push(u)};m({type:"bos",value:""});while(c<o.length-1){let u=d();if(/^[^\S\n ]$/.test(u)){m({type:"text",value:u});continue}if(u===`
24
+ `){m({type:"newline",value:u}),l++;continue}if(u==="\\"){u+=d(),m({type:"text",value:u});continue}if((u==="$"||u==="#"||u==="{")&&h()==="{"){let S=d();u+=S;let f={type:"template",open:u,inner:"",close:"",value:u},b;while(b=d()){if(b==="}"){if(h()==="}")b+=d();f.value+=b,f.close=b;break}if(b===":")f.initial="",f.key=f.inner;else if(f.initial!==void 0)f.initial+=b;f.value+=b,f.inner+=b}if(f.template=f.open+(f.initial||f.inner)+f.close,f.key=f.key||f.inner,hasOwnProperty.call(t,f.key))f.initial=t[f.key];f=s(f),m(f),p.push(f.key),r.add(f.key);let x=a.find((N)=>N.name===f.key);if(f.field=i.find((N)=>N.name===f.key),!x)x=new br(f),a.push(x);x.lines.push(f.line-1);continue}let y=n[n.length-1];if(y.type==="text"&&y.line===l)y.value+=u;else m({type:"text",value:u})}return m({type:"eos",value:""}),{input:o,tabstops:n,unique:r,keys:p,items:a}};wr.exports=async(e)=>{let t=e.options,s=new Set(t.required===!0?[]:t.required||[]),r={...t.values,...t.initial},{tabstops:i,items:o,keys:n}=await $a(t,r),a=wt("result",e,t),p=wt("format",e,t),l=wt("validate",e,t,!0),c=e.isValue.bind(e);return async(d={},h=!1)=>{let m=0;d.required=s,d.items=o,d.keys=n,d.output="";let u=async(b,x,N,T)=>{let v=await l(b,x,N,T);if(v===!1)return"Invalid field "+N.name;return v};for(let b of i){let{value:x,key:N}=b;if(b.type!=="template"){if(x)d.output+=x;continue}if(b.type==="template"){let T=o.find((le)=>le.name===N);if(t.required===!0)d.required.add(T.name);let v=[T.input,d.values[T.value],T.value,x].find(c),we=(T.field||{}).message||b.inner;if(h){let le=await u(d.values[N],d,T,m);if(le&&typeof le==="string"||le===!1){d.invalid.set(N,le);continue}d.invalid.delete(N);let Po=await a(d.values[N],d,T,m);d.output+=Ar(Po);continue}T.placeholder=!1;let Oo=x;if(x=await p(x,d,T,m),v!==x)d.values[N]=v,x=e.styles.typing(v),d.missing.delete(we);else if(d.values[N]=void 0,v=`<${we}>`,x=e.styles.primary(v),T.placeholder=!0,d.required.has(N))d.missing.add(we);if(d.missing.has(we)&&d.validating)x=e.styles.warning(v);if(d.invalid.has(N)&&d.validating)x=e.styles.danger(v);if(m===d.index)if(Oo!==x)x=e.styles.underline(x);else x=e.styles.heading(Ar(x));m++}if(x)d.output+=x}let y=d.output.split(`
25
+ `).map((b)=>" "+b),S=o.length,f=0;for(let b of o){if(d.invalid.has(b.name))b.lines.forEach((x)=>{if(y[x][0]!==" ")return;y[x]=d.styles.danger(d.symbols.bullet)+y[x].slice(1)});if(e.isValue(d.values[b.name]))f++}return d.completed=(f/S*100).toFixed(0),d.output=y.join(`
26
+ `),d.output}};function wt(e,t,s,r){return(i,o,n,a)=>{if(typeof n.field[e]==="function")return n.field[e].call(t,i,o,n,a);return[r,i].find((p)=>t.isValue(p))}}});var Mr=A((_m,Nr)=>{var Ga=V(),Ua=xr(),qa=ce();class Sr extends qa{constructor(e){super(e);this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Ua(this),await super.initialize()}async reset(e){if(this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0)await this.initialize(),await this.render()}moveCursor(e){let t=this.getItem();this.cursor+=e,t.cursor+=e}dispatch(e,t){if(!t.code&&!t.ctrl&&e!=null&&this.getItem()){this.append(e,t);return}this.alert()}append(e,t){let s=this.getItem(),r=s.input.slice(0,this.cursor),i=s.input.slice(this.cursor);this.input=s.input=`${r}${e}${i}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let t=e.input.slice(this.cursor),s=e.input.slice(0,this.cursor-1);this.input=e.input=`${s}${t}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let t=this.state.completed<100?this.styles.warning:this.styles.success;if(this.state.submitted===!0&&this.state.completed!==100)t=this.styles.danger;return t(`${this.state.completed}% completed`)}async render(){let{index:e,keys:t=[],submitted:s,size:r}=this.state,i=[this.options.newline,`
27
+ `].find((f)=>f!=null),o=await this.prefix(),n=await this.separator(),a=await this.message(),p=[o,a,n].filter(Boolean).join(" ");this.state.prompt=p;let l=await this.header(),c=await this.error()||"",d=await this.hint()||"",h=s?"":await this.interpolate(this.state),m=this.state.key=t[e]||"",u=await this.format(m),y=await this.footer();if(u)p+=" "+u;if(d&&!u&&this.state.completed===0)p+=" "+d;this.clear(r);let S=[l,p,h,y,c.trim()];this.write(S.filter(Boolean).join(i)),this.restore()}getItem(e){let{items:t,keys:s,index:r}=this.state,i=t.find((o)=>o.name===s[r]);if(i&&i.input!=null)this.input=i.input,this.cursor=i.cursor;return i}async submit(){if(typeof this.interpolate!=="function")await this.initialize();await this.interpolate(this.state,!0);let{invalid:e,missing:t,output:s,values:r}=this.state;if(e.size){let n="";for(let[a,p]of e)n+=`Invalid ${a}: ${p}
28
+ `;return this.state.error=n,super.submit()}if(t.size)return this.state.error="Required: "+[...t.keys()].join(", "),super.submit();let o=Ga(s).split(`
29
29
  `).map((n)=>n.slice(1)).join(`
30
- `);return this.value={values:r,result:o},super.submit()}}br.exports=Ar});var Nr=g((du,Sr)=>{var Oa=Q();class wr extends Oa{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0});this.state.hint=[this.options.hint,"(Use <shift>+<up/down> to sort)"].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,t){let s=await super.renderChoice(e,t),r=this.symbols.identicalTo+" ",i=this.index===t&&this.sorting?this.styles.muted(r):" ";if(this.options.drag===!1)i="";if(this.options.numbered===!0)return i+`${t+1} - `+s;return i+s}get selected(){return this.choices}submit(){return this.value=this.choices.map((e)=>e.value),super.submit()}}Sr.exports=wr});var vr=g((uu,Tr)=>{var Pa=ge();class Mr extends Pa{constructor(e={}){super(e);if(this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let t=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];t=t.map((s)=>this.styles.muted(s)),this.state.header=t.join(`
31
- `)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let t=await super.toChoices(...e);for(let s of t)s.scale=Ia(5,this.options),s.scaleIdx=2;return t}dispatch(){this.alert()}space(){let e=this.focused,t=e.scale[e.scaleIdx],s=t.selected;return e.scale.forEach((r)=>r.selected=!1),t.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;if(e.scaleIdx>=e.scale.length-1)return this.alert();return e.scaleIdx++,this.render()}left(){let e=this.focused;if(e.scaleIdx<=0)return this.alert();return e.scaleIdx--,this.render()}indent(){return" "}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=this.term==="Hyper",i=!r?8:9,o=!r?" ":"",n=this.symbols.line.repeat(i),a=" ".repeat(i+(r?0:1)),p=(E)=>(E?this.styles.success("\u25C9"):"\u25EF")+o,l=t+1+".",d=s?this.styles.heading:this.styles.noop,c=await this.resolve(e.message,this.state,e,t),h=this.indent(e),u=h+e.scale.map((E,w)=>p(w===e.scaleIdx)).join(n),m=(E)=>E===e.scaleIdx?d(E):E,y=h+e.scale.map((E,w)=>m(w)).join(a),S=()=>[l,c].filter(Boolean).join(" "),f=()=>[S(),u,y," "].filter(Boolean).join(`
32
- `);if(s)u=this.styles.cyan(u),y=this.styles.cyan(y);return f()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(s,r)=>await this.renderChoice(s,r)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));return t.join(`
33
- `)}format(){if(this.state.submitted)return this.choices.map((t)=>this.styles.info(t.scaleIdx)).join(", ");return""}async render(){let{submitted:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o=[s,i,r].filter(Boolean).join(" ");this.state.prompt=o;let n=await this.header(),a=await this.format(),p=await this.error()||await this.hint(),l=await this.renderChoices(),d=await this.footer();if(a||!p)o+=" "+a;if(p&&!o.includes(p))o+=" "+p;if(e&&!a&&!l&&this.multiple&&this.type!=="form")o+=this.styles.danger(this.emptyError);this.clear(t),this.write([o,n,l,d].filter(Boolean).join(`
34
- `)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}}function Ia(e,t={}){if(Array.isArray(t.scale))return t.scale.map((r)=>({...r}));let s=[];for(let r=1;r<e+1;r++)s.push({i:r,selected:!1});return s}Tr.exports=Mr});var Cr=g((cu,Rr)=>{var La=Re();class _r extends La{async initialize(){await super.initialize(),this.value=this.initial=this.resolve(this.options.initial),this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",t){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=(s)=>this.styles.primary.underline(s);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,t=await this.header(),s=await this.prefix(),r=await this.separator(),i=await this.message(),o=await this.format(),n=await this.error()||await this.hint(),a=await this.footer(),p=[s,i,r,o].join(" ");if(this.state.prompt=p,n&&!p.includes(n))p+=" "+n;this.clear(e),this.write([t,p,a].filter(Boolean).join(`
35
- `)),this.write(this.margin[2]),this.restore()}}Rr.exports=_r});var Or=g((mu,Br)=>{var $a=Q();class Dr extends $a{constructor(e){super(e);if(typeof this.options.correctChoice!=="number"||this.options.correctChoice<0)throw Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,t){let s=await super.toChoices(e,t);if(s.length<2)throw Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw Error("Please specify the index of the correct answer from the list of choices");return s}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}}Br.exports=Dr});var Ir=g((bt)=>{var Pr=R(),M=(e,t)=>{Pr.defineExport(bt,e,t),Pr.defineExport(bt,e.toLowerCase(),t)};M("AutoComplete",()=>vs());M("BasicAuth",()=>Is());M("Confirm",()=>Gs());M("Editable",()=>Hs());M("Form",()=>_e());M("Input",()=>gt());M("Invisible",()=>ks());M("List",()=>sr());M("MultiSelect",()=>or());M("Numeral",()=>Et());M("Password",()=>dr());M("Scale",()=>hr());M("Select",()=>Q());M("Snippet",()=>xr());M("Sort",()=>Nr());M("Survey",()=>vr());M("Text",()=>gt());M("Toggle",()=>Cr());M("Quiz",()=>Or())});var $r=g((fu,Lr)=>{Lr.exports={ArrayPrompt:ge(),AuthPrompt:yt(),BooleanPrompt:Re(),NumberPrompt:Et(),StringPrompt:pe()}});var z=g((yu,qr)=>{var Ur=he("assert"),wt=he("events"),Z=R();class $ extends wt{constructor(e,t){super();this.options=Z.merge({},e),this.answers={...t}}register(e,t){if(Z.isObject(e)){for(let r of Object.keys(e))this.register(r,e[r]);return this}Ur.equal(typeof t,"function","expected a function");let s=e.toLowerCase();if(t.prototype instanceof this.Prompt)this.prompts[s]=t;else this.prompts[s]=t(this.Prompt,this);return this}async prompt(e=[]){for(let t of[].concat(e))try{if(typeof t==="function")t=await t.call(this);await this.ask(Z.merge({},this.options,t))}catch(s){return Promise.reject(s)}return this.answers}async ask(e){if(typeof e==="function")e=await e.call(this);let t=Z.merge({},this.options,e),{type:s,name:r}=e,{set:i,get:o}=Z;if(typeof s==="function")s=await s.call(this,e,this.answers);if(!s)return this.answers[r];if(s==="number")s="numeral";Ur(this.prompts[s],`Prompt "${s}" is not registered`);let n=new this.prompts[s](t),a=o(this.answers,r);if(n.state.answers=this.answers,n.enquirer=this,r)n.on("submit",(l)=>{this.emit("answer",r,l,n),i(this.answers,r,l)});let p=n.emit.bind(n);if(n.emit=(...l)=>{return this.emit.call(this,...l),p(...l)},this.emit("prompt",n,this),t.autofill&&a!=null){if(n.value=n.input=a,t.autofill==="show")await n.submit()}else a=n.value=await n.run();return a}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||de()}static get prompts(){return Ir()}static get types(){return $r()}static get prompt(){let e=(t,...s)=>{let r=new this(...s),i=r.emit.bind(r);return r.emit=(...o)=>{return e.emit(...o),i(...o)},r.prompt(t)};return Z.mixinEmitter(e,new wt),e}}Z.mixinEmitter($,new wt);var xt=$.prompts;for(let e of Object.keys(xt)){let t=e.toLowerCase(),s=(r)=>new xt[e](r).run();if($.prompt[t]=s,$[t]=s,!$[e])Reflect.defineProperty($,e,{get:()=>xt[e]})}var Ee=(e)=>{Z.defineExport($,e,()=>$.types[e])};Ee("ArrayPrompt");Ee("AuthPrompt");Ee("BooleanPrompt");Ee("NumberPrompt");Ee("StringPrompt");qr.exports=$});var Xi=g((_t,Rt)=>{(function(e,t){if(typeof _t==="object"&&typeof Rt==="object")Rt.exports=t();else if(typeof define==="function"&&define.amd)define(function(){return t()});else e.pluralize=t()})(_t,function(){var e=[],t=[],s={},r={},i={};function o(u){if(typeof u==="string")return new RegExp("^"+u+"$","i");return u}function n(u,m){if(u===m)return m;if(u===u.toLowerCase())return m.toLowerCase();if(u===u.toUpperCase())return m.toUpperCase();if(u[0]===u[0].toUpperCase())return m.charAt(0).toUpperCase()+m.substr(1).toLowerCase();return m.toLowerCase()}function a(u,m){return u.replace(/\$(\d{1,2})/g,function(y,S){return m[S]||""})}function p(u,m){return u.replace(m[0],function(y,S){var f=a(m[1],arguments);if(y==="")return n(u[S-1],f);return n(y,f)})}function l(u,m,y){if(!u.length||s.hasOwnProperty(u))return m;var S=y.length;while(S--){var f=y[S];if(f[0].test(m))return p(m,f)}return m}function d(u,m,y){return function(S){var f=S.toLowerCase();if(m.hasOwnProperty(f))return n(S,f);if(u.hasOwnProperty(f))return n(S,u[f]);return l(f,S,y)}}function c(u,m,y,S){return function(f){var E=f.toLowerCase();if(m.hasOwnProperty(E))return!0;if(u.hasOwnProperty(E))return!1;return l(E,E,y)===E}}function h(u,m,y){var S=m===1?h.singular(u):h.plural(u);return(y?m+" ":"")+S}return h.plural=d(i,r,e),h.isPlural=c(i,r,e),h.singular=d(r,i,t),h.isSingular=c(r,i,t),h.addPluralRule=function(u,m){e.push([o(u),m])},h.addSingularRule=function(u,m){t.push([o(u),m])},h.addUncountableRule=function(u){if(typeof u==="string"){s[u.toLowerCase()]=!0;return}h.addPluralRule(u,"$0"),h.addSingularRule(u,"$0")},h.addIrregularRule=function(u,m){m=m.toLowerCase(),u=u.toLowerCase(),i[u]=m,r[m]=u},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(u){return h.addIrregularRule(u[0],u[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(u){return h.addPluralRule(u[0],u[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(u){return h.addSingularRule(u[0],u[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[e\u00E9]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(h.addUncountableRule),h})});import{parseArgs as yd}from"util";import{TerminalLogger as gd}from"@ooneex/logger";import{container as Uo}from"@ooneex/container";var we=[];var Bt=(e)=>{let t=null;return we.find((s)=>{return t=Uo.get(s),t.getName()===e}),t};import{join as X}from"path";import{TerminalLogger as Ya}from"@ooneex/logger";import{toPascalCase as Va}from"@ooneex/utils";import{container as qo,EContainerScope as Go}from"@ooneex/container";var b={command:(e=Go.Singleton)=>{return(t)=>{qo.add(t,e),we.push(t)}}};var Gr=Y(z(),1);import{Assert as Ua,Validation as qa}from"@ooneex/validation";var Ga=1,Ka=/^[a-zA-Z][a-zA-Z0-9-]*$/;class Ae extends qa{getConstraint(){return Ua(`string >= ${Ga}`)}getErrorMessage(){return"Name must start with a letter and contain only letters, numbers, and hyphens"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(!Ka.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid name format"};return{isValid:!0}}}var x=async(e)=>{return(await Gr.prompt({type:"input",name:"name",message:e.message,validate:(s)=>{let i=new Ae().validate(s);if(!i.isValid)return i.message||"Controller name is invalid";return!0}})).name};var Kr=`import { describe, expect, test } from "bun:test";
30
+ `);return this.value={values:r,result:o},super.submit()}}Nr.exports=Sr});var vr=A((vm,_r)=>{var Ka=Q();class Tr extends Ka{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0});this.state.hint=[this.options.hint,"(Use <shift>+<up/down> to sort)"].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,t){let s=await super.renderChoice(e,t),r=this.symbols.identicalTo+" ",i=this.index===t&&this.sorting?this.styles.muted(r):" ";if(this.options.drag===!1)i="";if(this.options.numbered===!0)return i+`${t+1} - `+s;return i+s}get selected(){return this.choices}submit(){return this.value=this.choices.map((e)=>e.value),super.submit()}}_r.exports=Tr});var Dr=A((Rm,Cr)=>{var Ha=ge();class Rr extends Ha{constructor(e={}){super(e);if(this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let t=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];t=t.map((s)=>this.styles.muted(s)),this.state.header=t.join(`
31
+ `)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let t=await super.toChoices(...e);for(let s of t)s.scale=Wa(5,this.options),s.scaleIdx=2;return t}dispatch(){this.alert()}space(){let e=this.focused,t=e.scale[e.scaleIdx],s=t.selected;return e.scale.forEach((r)=>r.selected=!1),t.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;if(e.scaleIdx>=e.scale.length-1)return this.alert();return e.scaleIdx++,this.render()}left(){let e=this.focused;if(e.scaleIdx<=0)return this.alert();return e.scaleIdx--,this.render()}indent(){return" "}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=this.term==="Hyper",i=!r?8:9,o=!r?" ":"",n=this.symbols.line.repeat(i),a=" ".repeat(i+(r?0:1)),p=(b)=>(b?this.styles.success("\u25C9"):"\u25EF")+o,l=t+1+".",c=s?this.styles.heading:this.styles.noop,d=await this.resolve(e.message,this.state,e,t),h=this.indent(e),m=h+e.scale.map((b,x)=>p(x===e.scaleIdx)).join(n),u=(b)=>b===e.scaleIdx?c(b):b,y=h+e.scale.map((b,x)=>u(x)).join(a),S=()=>[l,d].filter(Boolean).join(" "),f=()=>[S(),m,y," "].filter(Boolean).join(`
32
+ `);if(s)m=this.styles.cyan(m),y=this.styles.cyan(y);return f()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(s,r)=>await this.renderChoice(s,r)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));return t.join(`
33
+ `)}format(){if(this.state.submitted)return this.choices.map((t)=>this.styles.info(t.scaleIdx)).join(", ");return""}async render(){let{submitted:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o=[s,i,r].filter(Boolean).join(" ");this.state.prompt=o;let n=await this.header(),a=await this.format(),p=await this.error()||await this.hint(),l=await this.renderChoices(),c=await this.footer();if(a||!p)o+=" "+a;if(p&&!o.includes(p))o+=" "+p;if(e&&!a&&!l&&this.multiple&&this.type!=="form")o+=this.styles.danger(this.emptyError);this.clear(t),this.write([o,n,l,c].filter(Boolean).join(`
34
+ `)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}}function Wa(e,t={}){if(Array.isArray(t.scale))return t.scale.map((r)=>({...r}));let s=[];for(let r=1;r<e+1;r++)s.push({i:r,selected:!1});return s}Cr.exports=Rr});var Pr=A((Cm,Or)=>{var Ya=Ce();class Br extends Ya{async initialize(){await super.initialize(),this.value=this.initial=this.resolve(this.options.initial),this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",t){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=(s)=>this.styles.primary.underline(s);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,t=await this.header(),s=await this.prefix(),r=await this.separator(),i=await this.message(),o=await this.format(),n=await this.error()||await this.hint(),a=await this.footer(),p=[s,i,r,o].join(" ");if(this.state.prompt=p,n&&!p.includes(n))p+=" "+n;this.clear(e),this.write([t,p,a].filter(Boolean).join(`
35
+ `)),this.write(this.margin[2]),this.restore()}}Or.exports=Br});var $r=A((Dm,Lr)=>{var Va=Q();class Ir extends Va{constructor(e){super(e);if(typeof this.options.correctChoice!=="number"||this.options.correctChoice<0)throw Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,t){let s=await super.toChoices(e,t);if(s.length<2)throw Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw Error("Please specify the index of the correct answer from the list of choices");return s}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}}Lr.exports=Ir});var Ur=A((xt)=>{var Gr=R(),M=(e,t)=>{Gr.defineExport(xt,e,t),Gr.defineExport(xt,e.toLowerCase(),t)};M("AutoComplete",()=>Ds());M("BasicAuth",()=>Us());M("Confirm",()=>Ys());M("Editable",()=>Qs());M("Form",()=>Re());M("Input",()=>At());M("Invisible",()=>rr());M("List",()=>nr());M("MultiSelect",()=>lr());M("Numeral",()=>bt());M("Password",()=>hr());M("Scale",()=>Er());M("Select",()=>Q());M("Snippet",()=>Mr());M("Sort",()=>vr());M("Survey",()=>Dr());M("Text",()=>At());M("Toggle",()=>Pr());M("Quiz",()=>$r())});var Kr=A((Om,qr)=>{qr.exports={ArrayPrompt:ge(),AuthPrompt:Et(),BooleanPrompt:Ce(),NumberPrompt:bt(),StringPrompt:pe()}});var Z=A((Pm,Wr)=>{var Hr=he("assert"),Nt=he("events"),z=R();class $ extends Nt{constructor(e,t){super();this.options=z.merge({},e),this.answers={...t}}register(e,t){if(z.isObject(e)){for(let r of Object.keys(e))this.register(r,e[r]);return this}Hr.equal(typeof t,"function","expected a function");let s=e.toLowerCase();if(t.prototype instanceof this.Prompt)this.prompts[s]=t;else this.prompts[s]=t(this.Prompt,this);return this}async prompt(e=[]){for(let t of[].concat(e))try{if(typeof t==="function")t=await t.call(this);await this.ask(z.merge({},this.options,t))}catch(s){return Promise.reject(s)}return this.answers}async ask(e){if(typeof e==="function")e=await e.call(this);let t=z.merge({},this.options,e),{type:s,name:r}=e,{set:i,get:o}=z;if(typeof s==="function")s=await s.call(this,e,this.answers);if(!s)return this.answers[r];if(s==="number")s="numeral";Hr(this.prompts[s],`Prompt "${s}" is not registered`);let n=new this.prompts[s](t),a=o(this.answers,r);if(n.state.answers=this.answers,n.enquirer=this,r)n.on("submit",(l)=>{this.emit("answer",r,l,n),i(this.answers,r,l)});let p=n.emit.bind(n);if(n.emit=(...l)=>{return this.emit.call(this,...l),p(...l)},this.emit("prompt",n,this),t.autofill&&a!=null){if(n.value=n.input=a,t.autofill==="show")await n.submit()}else a=n.value=await n.run();return a}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||ce()}static get prompts(){return Ur()}static get types(){return Kr()}static get prompt(){let e=(t,...s)=>{let r=new this(...s),i=r.emit.bind(r);return r.emit=(...o)=>{return e.emit(...o),i(...o)},r.prompt(t)};return z.mixinEmitter(e,new Nt),e}}z.mixinEmitter($,new Nt);var St=$.prompts;for(let e of Object.keys(St)){let t=e.toLowerCase(),s=(r)=>new St[e](r).run();if($.prompt[t]=s,$[t]=s,!$[e])Reflect.defineProperty($,e,{get:()=>St[e]})}var Ee=(e)=>{z.defineExport($,e,()=>$.types[e])};Ee("ArrayPrompt");Ee("AuthPrompt");Ee("BooleanPrompt");Ee("NumberPrompt");Ee("StringPrompt");Wr.exports=$});var eo=A((Ct,Dt)=>{(function(e,t){if(typeof Ct==="object"&&typeof Dt==="object")Dt.exports=t();else if(typeof define==="function"&&define.amd)define(function(){return t()});else e.pluralize=t()})(Ct,function(){var e=[],t=[],s={},r={},i={};function o(m){if(typeof m==="string")return new RegExp("^"+m+"$","i");return m}function n(m,u){if(m===u)return u;if(m===m.toLowerCase())return u.toLowerCase();if(m===m.toUpperCase())return u.toUpperCase();if(m[0]===m[0].toUpperCase())return u.charAt(0).toUpperCase()+u.substr(1).toLowerCase();return u.toLowerCase()}function a(m,u){return m.replace(/\$(\d{1,2})/g,function(y,S){return u[S]||""})}function p(m,u){return m.replace(u[0],function(y,S){var f=a(u[1],arguments);if(y==="")return n(m[S-1],f);return n(y,f)})}function l(m,u,y){if(!m.length||s.hasOwnProperty(m))return u;var S=y.length;while(S--){var f=y[S];if(f[0].test(u))return p(u,f)}return u}function c(m,u,y){return function(S){var f=S.toLowerCase();if(u.hasOwnProperty(f))return n(S,f);if(m.hasOwnProperty(f))return n(S,m[f]);return l(f,S,y)}}function d(m,u,y,S){return function(f){var b=f.toLowerCase();if(u.hasOwnProperty(b))return!0;if(m.hasOwnProperty(b))return!1;return l(b,b,y)===b}}function h(m,u,y){var S=u===1?h.singular(m):h.plural(m);return(y?u+" ":"")+S}return h.plural=c(i,r,e),h.isPlural=d(i,r,e),h.singular=c(r,i,t),h.isSingular=d(r,i,t),h.addPluralRule=function(m,u){e.push([o(m),u])},h.addSingularRule=function(m,u){t.push([o(m),u])},h.addUncountableRule=function(m){if(typeof m==="string"){s[m.toLowerCase()]=!0;return}h.addPluralRule(m,"$0"),h.addSingularRule(m,"$0")},h.addIrregularRule=function(m,u){u=u.toLowerCase(),m=m.toLowerCase(),i[m]=u,r[u]=m},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(m){return h.addIrregularRule(m[0],m[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(m){return h.addPluralRule(m[0],m[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(m){return h.addSingularRule(m[0],m[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[e\u00E9]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(h.addUncountableRule),h})});import{parseArgs as Nc}from"util";import{TerminalLogger as Mc}from"@ooneex/logger";import{container as Ho}from"@ooneex/container";var xe=[];var Pt=(e)=>{let t=null;return xe.find((s)=>{return t=Ho.get(s),t.getName()===e}),t};import{homedir as Qo}from"os";import{join as et}from"path";import{TerminalLogger as zo}from"@ooneex/logger";import{container as Wo,EContainerScope as Yo}from"@ooneex/container";var E={command:(e=Yo.Singleton)=>{return(t)=>{Wo.add(t,e),xe.push(t)}}};var It=`#compdef oo ooneex
36
+
37
+ _oo() {
38
+ local -a commands
39
+ commands=(
40
+ 'completion\\:zsh:Install Zsh completion for oo command'
41
+ 'make\\:ai:Generate a new AI class'
42
+ 'make\\:analytics:Generate a new analytics class'
43
+ 'make\\:app:Generate a new application'
44
+ 'make\\:cache:Generate a new cache class'
45
+ 'make\\:claude\\:skill:Generate Claude skills from templates'
46
+ 'make\\:controller:Generate a new controller class'
47
+ 'make\\:cron:Generate a new cron class'
48
+ 'make\\:database:Generate a new database class'
49
+ 'make\\:docker:Add a docker service to docker-compose.yml'
50
+ 'make\\:entity:Generate a new entity class'
51
+ 'make\\:logger:Generate a new logger class'
52
+ 'make\\:mailer:Generate a new mailer class'
53
+ 'make\\:middleware:Generate a new middleware class'
54
+ 'make\\:migration:Generate a new migration file'
55
+ 'make\\:module:Generate a new module'
56
+ 'make\\:permission:Generate a new permission class'
57
+ 'make\\:pubsub:Generate a new PubSub event class'
58
+ 'make\\:repository:Generate a new repository class'
59
+ 'make\\:seed:Generate a new seed file'
60
+ 'make\\:service:Generate a new service class'
61
+ 'make\\:storage:Generate a new storage class'
62
+ 'make\\:vector-database:Generate a new vector database class'
63
+ )
64
+
65
+ _arguments -s \\
66
+ '1:command:->cmds' \\
67
+ '*::options:->opts' \\
68
+ && return 0
69
+
70
+ case "$state" in
71
+ cmds)
72
+ _describe -t commands 'oo command' commands
73
+ ;;
74
+ opts)
75
+ case "$words[1]" in
76
+ make:controller)
77
+ _arguments -s \\
78
+ '--name=[Name of the resource]:name' \\
79
+ '--route-name=[Route name]:route_name' \\
80
+ '--route-path=[Route path]:route_path' \\
81
+ '--route-method=[Route HTTP method]:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \\
82
+ '--is-socket[Socket mode]'
83
+ ;;
84
+ make:middleware)
85
+ _arguments -s \\
86
+ '--name=[Name of the resource]:name' \\
87
+ '--is-socket[Socket mode]'
88
+ ;;
89
+ make:entity)
90
+ _arguments -s \\
91
+ '--name=[Name of the resource]:name' \\
92
+ '--table-name=[Database table name]:table_name'
93
+ ;;
94
+ make:pubsub)
95
+ _arguments -s \\
96
+ '--name=[Name of the resource]:name' \\
97
+ '--channel=[Channel name]:channel'
98
+ ;;
99
+ make:migration)
100
+ _arguments -s \\
101
+ '--dir=[Directory]:dir:_files -/'
102
+ ;;
103
+ make:seed)
104
+ _arguments -s \\
105
+ '--name=[Name of the resource]:name' \\
106
+ '--dir=[Directory]:dir:_files -/'
107
+ ;;
108
+ make:module)
109
+ _arguments -s \\
110
+ '--name=[Name of the resource]:name'
111
+ ;;
112
+ make:docker)
113
+ _arguments -s \\
114
+ '--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)'
115
+ ;;
116
+ make:ai|make:analytics|make:app|make:cache|make:cron|make:database|make:logger|make:mailer|make:permission|make:repository|make:service|make:storage|make:vector-database)
117
+ _arguments -s \\
118
+ '--name=[Name of the resource]:name'
119
+ ;;
120
+ make:claude:skill|completion:zsh)
121
+ ;;
122
+ esac
123
+ ;;
124
+ esac
125
+ }
126
+
127
+ _oo "$@"
128
+ `;var Lt=`#compdef oo ooneex
129
+
130
+ _ooneex() {
131
+ local -a commands
132
+ commands=(
133
+ 'completion\\:zsh:Install Zsh completion for oo command'
134
+ 'make\\:ai:Generate a new AI class'
135
+ 'make\\:analytics:Generate a new analytics class'
136
+ 'make\\:app:Generate a new application'
137
+ 'make\\:cache:Generate a new cache class'
138
+ 'make\\:claude\\:skill:Generate Claude skills from templates'
139
+ 'make\\:controller:Generate a new controller class'
140
+ 'make\\:cron:Generate a new cron class'
141
+ 'make\\:database:Generate a new database class'
142
+ 'make\\:docker:Add a docker service to docker-compose.yml'
143
+ 'make\\:entity:Generate a new entity class'
144
+ 'make\\:logger:Generate a new logger class'
145
+ 'make\\:mailer:Generate a new mailer class'
146
+ 'make\\:middleware:Generate a new middleware class'
147
+ 'make\\:migration:Generate a new migration file'
148
+ 'make\\:module:Generate a new module'
149
+ 'make\\:permission:Generate a new permission class'
150
+ 'make\\:pubsub:Generate a new PubSub event class'
151
+ 'make\\:repository:Generate a new repository class'
152
+ 'make\\:seed:Generate a new seed file'
153
+ 'make\\:service:Generate a new service class'
154
+ 'make\\:storage:Generate a new storage class'
155
+ 'make\\:vector-database:Generate a new vector database class'
156
+ )
157
+
158
+ _arguments -s \\
159
+ '1:command:->cmds' \\
160
+ '*::options:->opts' \\
161
+ && return 0
162
+
163
+ case "$state" in
164
+ cmds)
165
+ _describe -t commands 'oo command' commands
166
+ ;;
167
+ opts)
168
+ case "$words[1]" in
169
+ make:controller)
170
+ _arguments -s \\
171
+ '--name=[Name of the resource]:name' \\
172
+ '--route-name=[Route name]:route_name' \\
173
+ '--route-path=[Route path]:route_path' \\
174
+ '--route-method=[Route HTTP method]:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \\
175
+ '--is-socket[Socket mode]'
176
+ ;;
177
+ make:middleware)
178
+ _arguments -s \\
179
+ '--name=[Name of the resource]:name' \\
180
+ '--is-socket[Socket mode]'
181
+ ;;
182
+ make:entity)
183
+ _arguments -s \\
184
+ '--name=[Name of the resource]:name' \\
185
+ '--table-name=[Database table name]:table_name'
186
+ ;;
187
+ make:pubsub)
188
+ _arguments -s \\
189
+ '--name=[Name of the resource]:name' \\
190
+ '--channel=[Channel name]:channel'
191
+ ;;
192
+ make:migration)
193
+ _arguments -s \\
194
+ '--dir=[Directory]:dir:_files -/'
195
+ ;;
196
+ make:seed)
197
+ _arguments -s \\
198
+ '--name=[Name of the resource]:name' \\
199
+ '--dir=[Directory]:dir:_files -/'
200
+ ;;
201
+ make:module)
202
+ _arguments -s \\
203
+ '--name=[Name of the resource]:name'
204
+ ;;
205
+ make:docker)
206
+ _arguments -s \\
207
+ '--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)'
208
+ ;;
209
+ make:ai|make:analytics|make:app|make:cache|make:cron|make:database|make:logger|make:mailer|make:permission|make:repository|make:service|make:storage|make:vector-database)
210
+ _arguments -s \\
211
+ '--name=[Name of the resource]:name'
212
+ ;;
213
+ make:claude:skill|completion:zsh)
214
+ ;;
215
+ esac
216
+ ;;
217
+ esac
218
+ }
219
+
220
+ _ooneex "$@"
221
+ `;class Se{getName(){return"completion:zsh"}getDescription(){return"Install Zsh completion for oo command"}async run(){let e=et(Qo(),".zsh"),t=et(e,"_oo");await Bun.write(t,It);let s=et(e,"_ooneex");await Bun.write(s,Lt);let r=new zo;r.success(`${t} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),r.success(`${s} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),r.info(`Add the following to your .zshrc if not already present:
222
+ fpath=(~/.zsh $fpath)
223
+ autoload -Uz compinit && compinit`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Se=g([E.command()],Se);import{join as X}from"path";import{TerminalLogger as ja}from"@ooneex/logger";import{toPascalCase as ka}from"@ooneex/utils";var Yr=Y(Z(),1);import{Assert as Fa,Validation as Qa}from"@ooneex/validation";var za=1,Za=/^[a-zA-Z][a-zA-Z0-9-]*$/;class Ae extends Qa{getConstraint(){return Fa(`string >= ${za}`)}getErrorMessage(){return"Name must start with a letter and contain only letters, numbers, and hyphens"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(!Za.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid name format"};return{isValid:!0}}}var w=async(e)=>{return(await Yr.prompt({type:"input",name:"name",message:e.message,validate:(s)=>{let i=new Ae().validate(s);if(!i.isValid)return i.message||"Controller name is invalid";return!0}})).name};var Vr=`import { describe, expect, test } from "bun:test";
36
224
  import { {{NAME}}Ai } from "@/ai/{{NAME}}Ai";
37
225
 
38
226
  describe("{{NAME}}Ai", () => {
@@ -50,7 +238,7 @@ describe("{{NAME}}Ai", () => {
50
238
  expect(typeof {{NAME}}Ai.prototype.runStream).toBe("function");
51
239
  });
52
240
  });
53
- `;var Wr=`import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
241
+ `;var Fr=`import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
54
242
  import { inject } from "@ooneex/container";
55
243
 
56
244
  @decorator.ai()
@@ -68,7 +256,7 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
68
256
  yield* this.ai.runStream(prompt || "My prompt", config);
69
257
  }
70
258
  }
71
- `;class De{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter name"});t=Va(t).replace(/Ai$/,"");let s=Wr.replace(/{{NAME}}/g,t),r=X("src","ai"),i=X(process.cwd(),r),o=X(i,`${t}Ai.ts`);await Bun.write(o,s);let n=Kr.replace(/{{NAME}}/g,t),a=X("tests","ai"),p=X(process.cwd(),a),l=X(p,`${t}Ai.spec.ts`);await Bun.write(l,n);let d=new Ya;d.success(`${X(r,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${X(a,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}De=A([b.command()],De);import{join as J}from"path";import{TerminalLogger as Za}from"@ooneex/logger";import{toPascalCase as za}from"@ooneex/utils";var Hr=`import { describe, expect, test } from "bun:test";
259
+ `;class Be{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter name"});t=ka(t).replace(/Ai$/,"");let s=Fr.replace(/{{NAME}}/g,t),r=X("src","ai"),i=X(process.cwd(),r),o=X(i,`${t}Ai.ts`);await Bun.write(o,s);let n=Vr.replace(/{{NAME}}/g,t),a=X("tests","ai"),p=X(process.cwd(),a),l=X(p,`${t}Ai.spec.ts`);await Bun.write(l,n);let c=new ja;c.success(`${X(r,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${X(a,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Be=g([E.command()],Be);import{join as J}from"path";import{TerminalLogger as sp}from"@ooneex/logger";import{toPascalCase as rp}from"@ooneex/utils";var Qr=`import { describe, expect, test } from "bun:test";
72
260
  import { {{NAME}}Analytics } from "@/analytics/{{NAME}}Analytics";
73
261
 
74
262
  describe("{{NAME}}Analytics", () => {
@@ -81,7 +269,7 @@ describe("{{NAME}}Analytics", () => {
81
269
  expect(typeof {{NAME}}Analytics.prototype.capture).toBe("function");
82
270
  });
83
271
  });
84
- `;var Yr=`import { decorator } from "@ooneex/analytics";
272
+ `;var zr=`import { decorator } from "@ooneex/analytics";
85
273
  import type { IAnalytics } from "@ooneex/analytics";
86
274
 
87
275
  type CaptureOptionsType = Record<string, unknown>;
@@ -92,7 +280,7 @@ export class {{NAME}}Analytics<T extends CaptureOptionsType = CaptureOptionsType
92
280
  // console.log("Analytics captured:", options);
93
281
  }
94
282
  }
95
- `;class Be{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter analytics name"});t=za(t).replace(/Analytics$/,"");let s=Yr.replace(/{{NAME}}/g,t),r=J("src","analytics"),i=J(process.cwd(),r),o=J(i,`${t}Analytics.ts`);await Bun.write(o,s);let n=Hr.replace(/{{NAME}}/g,t),a=J("tests","analytics"),p=J(process.cwd(),a),l=J(p,`${t}Analytics.spec.ts`);await Bun.write(l,n);let d=new Za;d.success(`${J(r,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${J(a,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Be=A([b.command()],Be);import{join as B}from"path";import{TerminalLogger as hp}from"@ooneex/logger";import{toKebabCase as fp}from"@ooneex/utils";var Vr=Y(z(),1);var Fr=async(e)=>{let t=new Ae;return(await Vr.prompt({type:"input",name:"destination",message:e.message,initial:e.initial||".",validate:(r)=>{let i=t.validate(r);if(!i.isValid)return i.message||"Invalid destination";return!0}})).destination};var Qr=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
283
+ `;class Oe{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter analytics name"});t=rp(t).replace(/Analytics$/,"");let s=zr.replace(/{{NAME}}/g,t),r=J("src","analytics"),i=J(process.cwd(),r),o=J(i,`${t}Analytics.ts`);await Bun.write(o,s);let n=Qr.replace(/{{NAME}}/g,t),a=J("tests","analytics"),p=J(process.cwd(),a),l=J(p,`${t}Analytics.spec.ts`);await Bun.write(l,n);let c=new sp;c.success(`${J(r,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${J(a,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Oe=g([E.command()],Oe);import{join as B}from"path";import{TerminalLogger as xp}from"@ooneex/logger";import{toKebabCase as Sp}from"@ooneex/utils";var Zr=Y(Z(),1);var Xr=async(e)=>{let t=new Ae;return(await Zr.prompt({type:"input",name:"destination",message:e.message,initial:e.initial||".",validate:(r)=>{let i=t.validate(r);if(!i.isValid)return i.message||"Invalid destination";return!0}})).destination};var Jr=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
96
284
 
97
285
  const Configuration: UserConfig = {
98
286
  extends: ["@commitlint/config-conventional"],
@@ -233,7 +421,7 @@ const Configuration: UserConfig = {
233
421
  };
234
422
 
235
423
  export default Configuration;
236
- `;var Zr=`# Logs
424
+ `;var jr=`# Logs
237
425
  logs
238
426
  *.log
239
427
  npm-debug.log*
@@ -383,7 +571,7 @@ vite.config.ts.timestamp-*
383
571
 
384
572
  # Application
385
573
  var/
386
- `;var zr=`{
574
+ `;var kr=`{
387
575
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
388
576
  "vcs": {
389
577
  "enabled": true,
@@ -462,7 +650,7 @@ var/
462
650
  }
463
651
  }
464
652
  }
465
- `;var Xr=`[test]
653
+ `;var ei=`[test]
466
654
  coverage = true
467
655
 
468
656
  [workspace]
@@ -495,7 +683,7 @@ buildDependencies = [
495
683
  "@swc/core",
496
684
  "nx",
497
685
  ]
498
- `;var St=`# =============================================================================
686
+ `;var Mt=`# =============================================================================
499
687
  # App
500
688
  # =============================================================================
501
689
 
@@ -651,7 +839,7 @@ POLAR_ENVIRONMENT=
651
839
 
652
840
  # Clerk authentication secret key
653
841
  CLERK_SECRET_KEY=
654
- `;var Jr=`import { PostHogAnalytics } from "@ooneex/analytics";
842
+ `;var ti=`import { PostHogAnalytics } from "@ooneex/analytics";
655
843
  import { App } from "@ooneex/app";
656
844
  import { AppEnv, type EnvType } from "@ooneex/app-env";
657
845
  import { RedisCache } from "@ooneex/cache";
@@ -683,7 +871,7 @@ const app = new App({
683
871
  });
684
872
 
685
873
  await app.run();
686
- `;var jr=`{
874
+ `;var si=`{
687
875
  "$schema": "./node_modules/nx/schemas/nx-schema.json",
688
876
  "targetDefaults": {
689
877
  "build": {
@@ -713,7 +901,7 @@ await app.run();
713
901
  ],
714
902
  "packageManager": "bun"
715
903
  }
716
- `;var kr=`{
904
+ `;var ri=`{
717
905
  "name": "{{NAME}}",
718
906
  "module": "index.ts",
719
907
  "private": true,
@@ -788,7 +976,7 @@ await app.run();
788
976
  ]
789
977
  }
790
978
  }
791
- `;var ei=`{
979
+ `;var ii=`{
792
980
  "compilerOptions": {
793
981
  "jsx": "react-jsx",
794
982
  "lib": ["ES2022", "DOM"],
@@ -816,7 +1004,7 @@ await app.run();
816
1004
  },
817
1005
  "exclude": ["node_modules", ".github", ".husky", ".nx", ".zed", ".vscode"]
818
1006
  }
819
- `;import{join as D}from"path";import{TerminalLogger as up}from"@ooneex/logger";import{toKebabCase as cp,toPascalCase as mp}from"@ooneex/utils";var ti=`#!/usr/bin/env bun
1007
+ `;import{join as D}from"path";import{TerminalLogger as Ap}from"@ooneex/logger";import{toKebabCase as bp,toPascalCase as wp}from"@ooneex/utils";var oi=`#!/usr/bin/env bun
820
1008
 
821
1009
  import { migrationUp } from "@ooneex/migrations";
822
1010
  import "@/migrations/migrations";
@@ -825,7 +1013,7 @@ await migrationUp({
825
1013
  databaseUrl: Bun.env.DATABASE_URL || ":memory:",
826
1014
  tableName: "migrations",
827
1015
  });
828
- `;var si=`import type { ModuleType } from "@ooneex/module";
1016
+ `;var ni=`import type { ModuleType } from "@ooneex/module";
829
1017
 
830
1018
  export const {{NAME}}Module: ModuleType = {
831
1019
  controllers: [],
@@ -835,7 +1023,7 @@ export const {{NAME}}Module: ModuleType = {
835
1023
  cronJobs: [],
836
1024
  events: [],
837
1025
  };
838
- `;var ri=`{
1026
+ `;var ai=`{
839
1027
  "name": "@module/{{NAME}}",
840
1028
  "description": "",
841
1029
  "version": "0.0.1",
@@ -846,13 +1034,13 @@ export const {{NAME}}Module: ModuleType = {
846
1034
  "seed:run": "bun run ./bin/bin/run.ts"
847
1035
  }
848
1036
  }
849
- `;var ii=`#!/usr/bin/env bun
1037
+ `;var pi=`#!/usr/bin/env bun
850
1038
 
851
1039
  import { seedRun } from "@ooneex/seeds";
852
1040
  import "@/seeds/seeds";
853
1041
 
854
1042
  await seedRun();
855
- `;var oi=`import { describe, expect, test } from "bun:test";
1043
+ `;var li=`import { describe, expect, test } from "bun:test";
856
1044
  import { {{NAME}}Module } from "@/{{NAME}}Module";
857
1045
 
858
1046
  describe("{{NAME}}Module", () => {
@@ -876,7 +1064,7 @@ describe("{{NAME}}Module", () => {
876
1064
  expect(Array.isArray({{NAME}}Module.events)).toBe(true);
877
1065
  });
878
1066
  });
879
- `;var ni=`{
1067
+ `;var ci=`{
880
1068
  "extends": "../../tsconfig.json",
881
1069
  "compilerOptions": {
882
1070
  "types": ["@types/bun"],
@@ -887,10 +1075,10 @@ describe("{{NAME}}Module", () => {
887
1075
  "include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx"],
888
1076
  "exclude": ["node_modules", "dist"]
889
1077
  }
890
- `;class ce{getName(){return"make:module"}getDescription(){return"Generate a new module"}async addToAppModule(e,t,s){let r=await Bun.file(e).text(),i=`${t}Module`,o=`@${s}/${i}`,n=`import { ${i} } from "${o}";
1078
+ `;class de{getName(){return"make:module"}getDescription(){return"Generate a new module"}async addToAppModule(e,t,s){let r=await Bun.file(e).text(),i=`${t}Module`,o=`@${s}/${i}`,n=`import { ${i} } from "${o}";
891
1079
  `,a=r.lastIndexOf("import "),p=r.indexOf(`
892
- `,a);r=`${r.slice(0,p+1)}${n}${r.slice(p+1)}`;let l=["controllers","entities","permissions","middlewares","cronJobs","events"];for(let d of l){let c=new RegExp(`(${d}:\\s*\\[)([^\\]]*)`,"s"),h=r.match(c);if(h){let u=h[2]?.trim(),m=`...${i}.${d}`,y=u?`${u}, ${m}`:m;r=r.replace(c,`$1${y}`)}}await Bun.write(e,r)}async addPathAlias(e,t){let s=await Bun.file(e).text(),r=JSON.parse(s);r.compilerOptions??={},r.compilerOptions.paths??={},r.compilerOptions.paths[`@${t}/*`]=[`../${t}/src/*`],await Bun.write(e,`${JSON.stringify(r,null,2)}
893
- `)}async run(e){let{cwd:t=process.cwd(),silent:s=!1,skipBin:r=!1,skipMigrations:i=!1,skipSeeds:o=!1}=e,{name:n}=e;if(!n)n=await x({message:"Enter module name"});let a=mp(n).replace(/Module$/,""),p=cp(a),l=D(t,"modules",p),d=D(l,"bin"),c=D(l,"src"),h=D(l,"tests"),u=si.replace(/{{NAME}}/g,a),m=ri.replace(/{{NAME}}/g,p),y=oi.replace(/{{NAME}}/g,a);if(!r)await Bun.write(D(d,"migration","up.ts"),ti),await Bun.write(D(d,"seed","run.ts"),ii);if(await Bun.write(D(c,`${a}Module.ts`),u),!i)await Bun.write(D(c,"migrations","migrations.ts"),"");if(!o)await Bun.write(D(c,"seeds","seeds.ts"),"");await Bun.write(D(l,"package.json"),m),await Bun.write(D(l,"tsconfig.json"),ni),await Bun.write(D(h,`${a}Module.spec.ts`),y);let S=D(t,"modules","app","src","AppModule.ts");if(await Bun.file(S).exists())await this.addToAppModule(S,a,p);let f=D(t,"modules","app","tsconfig.json");if(await Bun.file(f).exists())await this.addPathAlias(f,p);if(!s)new up().success(`modules/${p} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ce=A([b.command()],ce);class Oe{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(e){let{name:t,destination:s}=e;if(!t)t=await x({message:"Enter application name"});let r=fp(t);if(!s)s=await Fr({message:"Enter destination path",initial:r});let i=kr.replace(/{{NAME}}/g,r);await Bun.write(B(s,".commitlintrc.ts"),Qr),await Bun.write(B(s,".env"),St),await Bun.write(B(s,".env.example"),St),await Bun.write(B(s,".gitignore"),Zr),await Bun.write(B(s,"biome.jsonc"),zr),await Bun.write(B(s,"bunfig.toml"),Xr),await Bun.write(B(s,"nx.json"),jr),await Bun.write(B(s,"package.json"),i),await Bun.write(B(s,"tsconfig.json"),ei),await new ce().run({name:"app",cwd:s,silent:!0,skipBin:!0,skipMigrations:!0,skipSeeds:!0}),await Bun.write(B(s,".husky","commit-msg"),'bunx commitlint --edit "$1"'),await Bun.write(B(s,".husky","pre-commit"),"lint-staged"),await Bun.write(B(s,"modules","app","src","index.ts"),Jr),await Bun.write(B(s,"modules","app","var",".gitkeep"),""),new hp().success(`${r} created successfully at ${s}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Oe=A([b.command()],Oe);import{join as j}from"path";import{TerminalLogger as Ep}from"@ooneex/logger";import{toPascalCase as Ap}from"@ooneex/utils";var ai=`import { describe, expect, test } from "bun:test";
1080
+ `,a);r=`${r.slice(0,p+1)}${n}${r.slice(p+1)}`;let l=["controllers","entities","permissions","middlewares","cronJobs","events"];for(let c of l){let d=new RegExp(`(${c}:\\s*\\[)([^\\]]*)`,"s"),h=r.match(d);if(h){let m=h[2]?.trim(),u=`...${i}.${c}`,y=m?`${m}, ${u}`:u;r=r.replace(d,`$1${y}`)}}await Bun.write(e,r)}async addPathAlias(e,t){let s=await Bun.file(e).text(),r=JSON.parse(s);r.compilerOptions??={},r.compilerOptions.paths??={},r.compilerOptions.paths[`@${t}/*`]=[`../${t}/src/*`],await Bun.write(e,`${JSON.stringify(r,null,2)}
1081
+ `)}async run(e){let{cwd:t=process.cwd(),silent:s=!1,skipBin:r=!1,skipMigrations:i=!1,skipSeeds:o=!1}=e,{name:n}=e;if(!n)n=await w({message:"Enter module name"});let a=wp(n).replace(/Module$/,""),p=bp(a),l=D(t,"modules",p),c=D(l,"bin"),d=D(l,"src"),h=D(l,"tests"),m=ni.replace(/{{NAME}}/g,a),u=ai.replace(/{{NAME}}/g,p),y=li.replace(/{{NAME}}/g,a);if(!r)await Bun.write(D(c,"migration","up.ts"),oi),await Bun.write(D(c,"seed","run.ts"),pi);if(await Bun.write(D(d,`${a}Module.ts`),m),!i)await Bun.write(D(d,"migrations","migrations.ts"),"");if(!o)await Bun.write(D(d,"seeds","seeds.ts"),"");await Bun.write(D(l,"package.json"),u),await Bun.write(D(l,"tsconfig.json"),ci),await Bun.write(D(h,`${a}Module.spec.ts`),y);let S=D(t,"modules","app","src","AppModule.ts");if(await Bun.file(S).exists())await this.addToAppModule(S,a,p);let f=D(t,"modules","app","tsconfig.json");if(await Bun.file(f).exists())await this.addPathAlias(f,p);if(!s)new Ap().success(`modules/${p} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}de=g([E.command()],de);class Pe{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(e){let{name:t,destination:s}=e;if(!t)t=await w({message:"Enter application name"});let r=Sp(t);if(!s)s=await Xr({message:"Enter destination path",initial:r});let i=ri.replace(/{{NAME}}/g,r);await Bun.write(B(s,".commitlintrc.ts"),Jr),await Bun.write(B(s,".env"),Mt),await Bun.write(B(s,".env.example"),Mt),await Bun.write(B(s,".gitignore"),jr),await Bun.write(B(s,"biome.jsonc"),kr),await Bun.write(B(s,"bunfig.toml"),ei),await Bun.write(B(s,"nx.json"),si),await Bun.write(B(s,"package.json"),i),await Bun.write(B(s,"tsconfig.json"),ii),await new de().run({name:"app",cwd:s,silent:!0,skipBin:!0,skipMigrations:!0,skipSeeds:!0}),await Bun.write(B(s,".husky","commit-msg"),'bunx commitlint --edit "$1"'),await Bun.write(B(s,".husky","pre-commit"),"lint-staged"),await Bun.write(B(s,"modules","app","src","index.ts"),ti),await Bun.write(B(s,"modules","app","var",".gitkeep"),""),new xp().success(`${r} created successfully at ${s}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Pe=g([E.command()],Pe);import{join as j}from"path";import{TerminalLogger as Tp}from"@ooneex/logger";import{toPascalCase as _p}from"@ooneex/utils";var mi=`import { describe, expect, test } from "bun:test";
894
1082
  import { {{NAME}}Cache } from "@/cache/{{NAME}}Cache";
895
1083
 
896
1084
  describe("{{NAME}}Cache", () => {
@@ -918,7 +1106,7 @@ describe("{{NAME}}Cache", () => {
918
1106
  expect(typeof {{NAME}}Cache.prototype.has).toBe("function");
919
1107
  });
920
1108
  });
921
- `;var pi=`import { CacheException, decorator } from "@ooneex/cache";
1109
+ `;var di=`import { CacheException, decorator } from "@ooneex/cache";
922
1110
  import type { ICache } from "@ooneex/cache";
923
1111
 
924
1112
  @decorator.cache()
@@ -939,7 +1127,7 @@ export class {{NAME}}Cache implements ICache {
939
1127
  throw new CacheException(\`Failed to check if key "\${key}" exists: Not implemented\`);
940
1128
  }
941
1129
  }
942
- `;class Pe{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter cache name"});t=Ap(t).replace(/Cache$/,"");let s=pi.replace(/{{NAME}}/g,t),r=j("src","cache"),i=j(process.cwd(),r),o=j(i,`${t}Cache.ts`);await Bun.write(o,s);let n=ai.replace(/{{NAME}}/g,t),a=j("tests","cache"),p=j(process.cwd(),a),l=j(p,`${t}Cache.spec.ts`);await Bun.write(l,n);let d=new Ep;d.success(`${j(r,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${j(a,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Pe=A([b.command()],Pe);import{basename as bp,join as me}from"path";import{TerminalLogger as xp}from"@ooneex/logger";var{Glob:wp}=globalThis.Bun;class Ie{getName(){return"make:claude:skill"}getDescription(){return"Generate Claude skills from templates"}async run(){let e=me(import.meta.dir,"..","templates","claude","skills"),t=me(".claude","skills"),s=me(process.cwd(),t),r=new wp("*.md.txt"),i=new xp;for await(let o of r.scan(e)){let n=await Bun.file(me(e,o)).text(),a=bp(o,".md.txt"),p=me(s,`${a}.md`);await Bun.write(p,n),i.success(`${me(t,a)}.md created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}}Ie=A([b.command()],Ie);import{basename as Up,join as O}from"path";import{TerminalLogger as qp}from"@ooneex/logger";import{toKebabCase as Gp,toPascalCase as vt,trim as Kp}from"@ooneex/utils";var li=Y(z(),1),Le=async(e)=>{return(await li.prompt({type:"confirm",name:"confirm",message:e.message})).confirm};var be=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];var di=Y(z(),1);import{Assert as Sp,Validation as Np}from"@ooneex/validation";class Nt extends Np{getConstraint(){return Sp("string >= 3")}getErrorMessage(){return`Route method must be one of: ${be.join(", ")}`}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route method format"};let i=r.toUpperCase();if(!be.includes(i))return{isValid:!1,message:this.getErrorMessage()||"Invalid route method"};return{isValid:!0}}}var ui=async(e)=>{return(await di.prompt({type:"select",name:"method",message:e.message,initial:e.initial??0,choices:be.map((s)=>s),validate:(s)=>{let i=new Nt().validate(s);if(!i.isValid)return i.message||"Route method is invalid";return!0}})).method};var ci=Y(z(),1);import{Assert as Mp,Validation as Tp}from"@ooneex/validation";var vp=/^[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/;class Mt extends Tp{getConstraint(){return Mp("string >= 7")}getErrorMessage(){return"Route name must follow format: namespace.resource.action (e.g., 'api.users.list')"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};if(!vp.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let i=r.split(".");if(i.length!==3)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let[o,n,a]=i;if(!o||!n||!a)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};return{isValid:!0}}}var mi=async(e)=>{return(await ci.prompt({type:"input",name:"routeName",message:e.message,validate:(s)=>{let i=new Mt().validate(s);if(!i.isValid)return i.message||"Route name is invalid";return!0}})).routeName};var hi=Y(z(),1);import{Assert as _p,Validation as Rp}from"@ooneex/validation";var Cp=1,Dp=/^\/[\w\-/:]*$/,Bp=/^[a-zA-Z0-9\-_]+$/,Op=/^:[a-zA-Z][a-zA-Z0-9]*$/;class Tt extends Rp{getConstraint(){return _p(`string >= ${Cp}`)}getErrorMessage(){return"Route path must start with '/' and contain only valid segments (e.g., '/users', '/api/users/:id')"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(!r.startsWith("/"))return{isValid:!1,message:"Route path must start with '/'"};if(r.length>1&&r.endsWith("/"))return{isValid:!1,message:"Route path cannot end with '/' (except for root path)"};if(!Dp.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(r==="/")return{isValid:!0};let i=r.slice(1).split("/");for(let o of i){if(!o)return{isValid:!1,message:"Route path cannot contain empty segments (double slashes)"};if(o.startsWith(":")){if(!Op.test(o))return{isValid:!1,message:`Invalid parameter segment '${o}'. Parameters must follow format ':paramName' with alphanumeric characters only`}}else if(!Bp.test(o))return{isValid:!1,message:`Invalid path segment '${o}'. Segments must contain only letters, numbers, hyphens, and underscores`}}return{isValid:!0}}}var fi=async(e)=>{return(await hi.prompt({type:"input",name:"path",message:e.message,initial:e.initial??"/",validate:(s)=>{let i=new Tt().validate(s);if(!i.isValid)return i.message||"Route path is invalid";return!0}})).path};var yi=`import type { ContextType } from "@ooneex/socket";
1130
+ `;class Ie{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter cache name"});t=_p(t).replace(/Cache$/,"");let s=di.replace(/{{NAME}}/g,t),r=j("src","cache"),i=j(process.cwd(),r),o=j(i,`${t}Cache.ts`);await Bun.write(o,s);let n=mi.replace(/{{NAME}}/g,t),a=j("tests","cache"),p=j(process.cwd(),a),l=j(p,`${t}Cache.spec.ts`);await Bun.write(l,n);let c=new Tp;c.success(`${j(r,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${j(a,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ie=g([E.command()],Ie);import{basename as vp,join as ue}from"path";import{TerminalLogger as Rp}from"@ooneex/logger";var{Glob:Cp}=globalThis.Bun;class Le{getName(){return"make:claude:skill"}getDescription(){return"Generate Claude skills from templates"}async run(){let e=ue(import.meta.dir,"..","templates","claude","skills"),t=ue(".claude","skills"),s=ue(process.cwd(),t),r=new Cp("*.md.txt"),i=new Rp;for await(let o of r.scan(e)){let n=await Bun.file(ue(e,o)).text(),a=vp(o,".md.txt"),p=ue(s,`${a}.md`);await Bun.write(p,n),i.success(`${ue(t,a)}.md created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}}Le=g([E.command()],Le);import{basename as Fp,join as O}from"path";import{TerminalLogger as Qp}from"@ooneex/logger";import{toKebabCase as zp,toPascalCase as Rt,trim as Zp}from"@ooneex/utils";var ui=Y(Z(),1),$e=async(e)=>{return(await ui.prompt({type:"confirm",name:"confirm",message:e.message})).confirm};var be=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];var hi=Y(Z(),1);import{Assert as Dp,Validation as Bp}from"@ooneex/validation";class Tt extends Bp{getConstraint(){return Dp("string >= 3")}getErrorMessage(){return`Route method must be one of: ${be.join(", ")}`}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route method format"};let i=r.toUpperCase();if(!be.includes(i))return{isValid:!1,message:this.getErrorMessage()||"Invalid route method"};return{isValid:!0}}}var fi=async(e)=>{return(await hi.prompt({type:"select",name:"method",message:e.message,initial:e.initial??0,choices:be.map((s)=>s),validate:(s)=>{let i=new Tt().validate(s);if(!i.isValid)return i.message||"Route method is invalid";return!0}})).method};var yi=Y(Z(),1);import{Assert as Op,Validation as Pp}from"@ooneex/validation";var Ip=/^[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/;class _t extends Pp{getConstraint(){return Op("string >= 7")}getErrorMessage(){return"Route name must follow format: namespace.resource.action (e.g., 'api.users.list')"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};if(!Ip.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let i=r.split(".");if(i.length!==3)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let[o,n,a]=i;if(!o||!n||!a)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};return{isValid:!0}}}var gi=async(e)=>{return(await yi.prompt({type:"input",name:"routeName",message:e.message,validate:(s)=>{let i=new _t().validate(s);if(!i.isValid)return i.message||"Route name is invalid";return!0}})).routeName};var Ei=Y(Z(),1);import{Assert as Lp,Validation as $p}from"@ooneex/validation";var Gp=1,Up=/^\/[\w\-/:]*$/,qp=/^[a-zA-Z0-9\-_]+$/,Kp=/^:[a-zA-Z][a-zA-Z0-9]*$/;class vt extends $p{getConstraint(){return Lp(`string >= ${Gp}`)}getErrorMessage(){return"Route path must start with '/' and contain only valid segments (e.g., '/users', '/api/users/:id')"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(!r.startsWith("/"))return{isValid:!1,message:"Route path must start with '/'"};if(r.length>1&&r.endsWith("/"))return{isValid:!1,message:"Route path cannot end with '/' (except for root path)"};if(!Up.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(r==="/")return{isValid:!0};let i=r.slice(1).split("/");for(let o of i){if(!o)return{isValid:!1,message:"Route path cannot contain empty segments (double slashes)"};if(o.startsWith(":")){if(!Kp.test(o))return{isValid:!1,message:`Invalid parameter segment '${o}'. Parameters must follow format ':paramName' with alphanumeric characters only`}}else if(!qp.test(o))return{isValid:!1,message:`Invalid path segment '${o}'. Segments must contain only letters, numbers, hyphens, and underscores`}}return{isValid:!0}}}var Ai=async(e)=>{return(await Ei.prompt({type:"input",name:"path",message:e.message,initial:e.initial??"/",validate:(s)=>{let i=new vt().validate(s);if(!i.isValid)return i.message||"Route path is invalid";return!0}})).path};var bi=`import type { ContextType } from "@ooneex/socket";
943
1131
  import { ERole } from "@ooneex/role";
944
1132
  import { Route } from "@ooneex/routing";
945
1133
  import { Assert } from "@ooneex/validation";
@@ -972,7 +1160,7 @@ export class {{NAME}}Controller {
972
1160
  });
973
1161
  }
974
1162
  }
975
- `;var gi=`import { describe, expect, test } from "bun:test";
1163
+ `;var wi=`import { describe, expect, test } from "bun:test";
976
1164
  import { {{NAME}}Controller } from "@/controllers/{{NAME}}Controller";
977
1165
 
978
1166
  describe("{{NAME}}Controller", () => {
@@ -985,7 +1173,7 @@ describe("{{NAME}}Controller", () => {
985
1173
  expect(typeof {{NAME}}Controller.prototype.index).toBe("function");
986
1174
  });
987
1175
  });
988
- `;var Ei=`import type { ContextType } from "@ooneex/controller";
1176
+ `;var xi=`import type { ContextType } from "@ooneex/controller";
989
1177
  import { ERole } from "@ooneex/role";
990
1178
  import { Route } from "@ooneex/routing";
991
1179
  import { Assert } from "@ooneex/validation";
@@ -1018,7 +1206,7 @@ export class {{NAME}}Controller {
1018
1206
  });
1019
1207
  }
1020
1208
  }
1021
- `;var Ai=`export type {{TYPE_NAME}}RouteType = {
1209
+ `;var Si=`export type {{TYPE_NAME}}RouteType = {
1022
1210
  params: {
1023
1211
 
1024
1212
  },
@@ -1032,9 +1220,9 @@ export class {{NAME}}Controller {
1032
1220
 
1033
1221
  },
1034
1222
  };
1035
- `;class $e{getName(){return"make:controller"}getDescription(){return"Generate a new controller class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Controller`,i=`import { ${r} } from "./controllers/${r}";
1223
+ `;class Ge{getName(){return"make:controller"}getDescription(){return"Generate a new controller class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Controller`,i=`import { ${r} } from "./controllers/${r}";
1036
1224
  `,o=s.lastIndexOf("import "),n=s.indexOf(`
1037
- `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(controllers:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),d=l?`${l}, ${r}`:r;s=s.replace(a,`$1${d}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await x({message:"Enter controller name"});if(s===void 0)s=await Le({message:"Is this a socket controller?"});t=vt(t).replace(/Controller$/,"");let{route:r={}}=e,o=(s?yi:Ei).replaceAll("{{NAME}}",t),n="",a="";if(!r.name)r.name=await mi({message:"Enter route name (e.g., api.user.create)"});if(n=vt(r.name),a=r.name,o=o.replaceAll("{{ROUTE_NAME}}",r.name).replaceAll("{{TYPE_NAME}}",n).replaceAll("{{TYPE_NAME_FILE}}",a),!r.path)r.path=await fi({message:"Enter route path",initial:"/"});let p=`/${Gp(Kp(r.path,"/"))}`;if(o=o.replaceAll("{{ROUTE_PATH}}",p),!s&&!r.method)r.method=await ui({message:"Enter route method"});if(!s&&r.method)o=o.replaceAll("{{ROUTE_METHOD}}",r.method.toLowerCase());let l=O("src","controllers"),d=O(process.cwd(),l),c=O(d,`${t}Controller.ts`);await Bun.write(c,o);let h=O("src","types","routes"),u=O(process.cwd(),h),m=O(u,`${a}.ts`),y=Ai.replaceAll("{{TYPE_NAME}}",n);await Bun.write(m,y);let S=gi.replace(/{{NAME}}/g,t),f=O("tests","controllers"),E=O(process.cwd(),f),w=O(E,`${t}Controller.spec.ts`);await Bun.write(w,S);let N=vt(Up(process.cwd())),T=O(process.cwd(),"src",`${N}Module.ts`);if(await Bun.file(T).exists())await this.addToModule(T,t);let _=new qp;_.success(`${O(l,t)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),_.success(`${O(h,a)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),_.success(`${O(f,t)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}$e=A([b.command()],$e);import{basename as Yp,join as q}from"path";import{TerminalLogger as Vp}from"@ooneex/logger";import{toPascalCase as wi}from"@ooneex/utils";var bi=`import { describe, expect, test } from "bun:test";
1225
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(controllers:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await w({message:"Enter controller name"});if(s===void 0)s=await $e({message:"Is this a socket controller?"});t=Rt(t).replace(/Controller$/,"");let{route:r={}}=e,o=(s?bi:xi).replaceAll("{{NAME}}",t),n="",a="";if(!r.name)r.name=await gi({message:"Enter route name (e.g., api.user.create)"});if(n=Rt(r.name),a=r.name,o=o.replaceAll("{{ROUTE_NAME}}",r.name).replaceAll("{{TYPE_NAME}}",n).replaceAll("{{TYPE_NAME_FILE}}",a),!r.path)r.path=await Ai({message:"Enter route path",initial:"/"});let p=`/${zp(Zp(r.path,"/"))}`;if(o=o.replaceAll("{{ROUTE_PATH}}",p),!s&&!r.method)r.method=await fi({message:"Enter route method"});if(!s&&r.method)o=o.replaceAll("{{ROUTE_METHOD}}",r.method.toLowerCase());let l=O("src","controllers"),c=O(process.cwd(),l),d=O(c,`${t}Controller.ts`);await Bun.write(d,o);let h=O("src","types","routes"),m=O(process.cwd(),h),u=O(m,`${a}.ts`),y=Si.replaceAll("{{TYPE_NAME}}",n);await Bun.write(u,y);let S=wi.replace(/{{NAME}}/g,t),f=O("tests","controllers"),b=O(process.cwd(),f),x=O(b,`${t}Controller.spec.ts`);await Bun.write(x,S);let N=Rt(Fp(process.cwd())),T=O(process.cwd(),"src",`${N}Module.ts`);if(await Bun.file(T).exists())await this.addToModule(T,t);let v=new Qp;v.success(`${O(l,t)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),v.success(`${O(h,a)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),v.success(`${O(f,t)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ge=g([E.command()],Ge);import{basename as jp,join as U}from"path";import{TerminalLogger as kp}from"@ooneex/logger";import{toPascalCase as Ti}from"@ooneex/utils";var Ni=`import { describe, expect, test } from "bun:test";
1038
1226
  import { {{NAME}}Cron } from "@/cron/{{NAME}}Cron";
1039
1227
 
1040
1228
  describe("{{NAME}}Cron", () => {
@@ -1057,7 +1245,7 @@ describe("{{NAME}}Cron", () => {
1057
1245
  expect(typeof {{NAME}}Cron.prototype.handler).toBe("function");
1058
1246
  });
1059
1247
  });
1060
- `;var xi=`import type { TimeZoneType } from "@ooneex/country";
1248
+ `;var Mi=`import type { TimeZoneType } from "@ooneex/country";
1061
1249
  import type { CronTimeType } from "@ooneex/cron";
1062
1250
  import { Cron, decorator } from "@ooneex/cron";
1063
1251
 
@@ -1080,7 +1268,7 @@ export class {{NAME}}Cron extends Cron {
1080
1268
  }
1081
1269
  `;class Ue{getName(){return"make:cron"}getDescription(){return"Generate a new cron class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Cron`,i=`import { ${r} } from "./cron/${r}";
1082
1270
  `,o=s.lastIndexOf("import "),n=s.indexOf(`
1083
- `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(cronJobs:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),d=l?`${l}, ${r}`:r;s=s.replace(a,`$1${d}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter cron name"});t=wi(t).replace(/Cron$/,"");let s=xi.replace(/{{NAME}}/g,t),r=q("src","cron"),i=q(process.cwd(),r),o=q(i,`${t}Cron.ts`);await Bun.write(o,s);let n=bi.replace(/{{NAME}}/g,t),a=q("tests","cron"),p=q(process.cwd(),a),l=q(p,`${t}Cron.spec.ts`);await Bun.write(l,n);let d=wi(Yp(process.cwd())),c=q(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(c).exists())await this.addToModule(c,t);let h=new Vp;h.success(`${q(r,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${q(a,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ue=A([b.command()],Ue);import{join as k}from"path";import{TerminalLogger as Zp}from"@ooneex/logger";import{toPascalCase as zp}from"@ooneex/utils";var Si=`import { describe, expect, test } from "bun:test";
1271
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(cronJobs:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter cron name"});t=Ti(t).replace(/Cron$/,"");let s=Mi.replace(/{{NAME}}/g,t),r=U("src","cron"),i=U(process.cwd(),r),o=U(i,`${t}Cron.ts`);await Bun.write(o,s);let n=Ni.replace(/{{NAME}}/g,t),a=U("tests","cron"),p=U(process.cwd(),a),l=U(p,`${t}Cron.spec.ts`);await Bun.write(l,n);let c=Ti(jp(process.cwd())),d=U(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,t);let h=new kp;h.success(`${U(r,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${U(a,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ue=g([E.command()],Ue);import{join as k}from"path";import{TerminalLogger as sl}from"@ooneex/logger";import{toPascalCase as rl}from"@ooneex/utils";var _i=`import { describe, expect, test } from "bun:test";
1084
1272
  import { {{NAME}}Database } from "@/databases/{{NAME}}Database";
1085
1273
 
1086
1274
  describe("{{NAME}}Database", () => {
@@ -1093,7 +1281,7 @@ describe("{{NAME}}Database", () => {
1093
1281
  expect(typeof {{NAME}}Database.prototype.getSource).toBe("function");
1094
1282
  });
1095
1283
  });
1096
- `;var Ni=`import { DataSource } from "typeorm";
1284
+ `;var vi=`import { DataSource } from "typeorm";
1097
1285
  import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
1098
1286
 
1099
1287
  @decorator.database()
@@ -1116,7 +1304,7 @@ export class {{NAME}}Database extends TypeormDatabase {
1116
1304
  return this.source;
1117
1305
  }
1118
1306
  }
1119
- `;class qe{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter database name"});t=zp(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let s=Ni.replace(/{{NAME}}/g,t),r=k("src","databases"),i=k(process.cwd(),r),o=k(i,`${t}Database.ts`);await Bun.write(o,s);let n=Si.replace(/{{NAME}}/g,t),a=k("tests","databases"),p=k(process.cwd(),a),l=k(p,`${t}Database.spec.ts`);await Bun.write(l,n);let d=new Zp;d.success(`${k(r,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${k(a,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}qe=A([b.command()],qe);import{join as Zi}from"path";import{TerminalLogger as fl}from"@ooneex/logger";var{YAML:zi}=globalThis.Bun;var Ti=Y(z(),1),Mi=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],vi=async(e)=>{return(await Ti.prompt({type:"autocomplete",name:"service",message:e.message,initial:e.initial,choices:Mi.map((s)=>s),validate:(s)=>{if(!Mi.includes(s))return"Docker service is invalid";return!0}})).service};var _i=`services:
1307
+ `;class qe{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter database name"});t=rl(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let s=vi.replace(/{{NAME}}/g,t),r=k("src","databases"),i=k(process.cwd(),r),o=k(i,`${t}Database.ts`);await Bun.write(o,s);let n=_i.replace(/{{NAME}}/g,t),a=k("tests","databases"),p=k(process.cwd(),a),l=k(p,`${t}Database.spec.ts`);await Bun.write(l,n);let c=new sl;c.success(`${k(r,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${k(a,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}qe=g([E.command()],qe);import{join as ji}from"path";import{TerminalLogger as Sl}from"@ooneex/logger";var{YAML:ki}=globalThis.Bun;var Ci=Y(Z(),1),Ri=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],Di=async(e)=>{return(await Ci.prompt({type:"autocomplete",name:"service",message:e.message,initial:e.initial,choices:Ri.map((s)=>s),validate:(s)=>{if(!Ri.includes(s))return"Docker service is invalid";return!0}})).service};var Bi=`services:
1120
1308
  # ClickHouse - Column-oriented OLAP database for analytics
1121
1309
  # Docs: https://clickhouse.com/docs
1122
1310
  # HTTP API: http://localhost:8123
@@ -1137,7 +1325,7 @@ export class {{NAME}}Database extends TypeormDatabase {
1137
1325
 
1138
1326
  volumes:
1139
1327
  clickhouse_data:
1140
- `;var Ri=`services:
1328
+ `;var Oi=`services:
1141
1329
  # Elasticsearch - Full-text search and analytics engine
1142
1330
  # Docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
1143
1331
  # HTTP API: http://localhost:9200
@@ -1158,7 +1346,7 @@ volumes:
1158
1346
 
1159
1347
  volumes:
1160
1348
  elasticsearch_data:
1161
- `;var Ci=`services:
1349
+ `;var Pi=`services:
1162
1350
  # Grafana - Metrics visualization and dashboards
1163
1351
  # Docs: https://grafana.com/docs/grafana/latest/
1164
1352
  # Web UI: http://localhost:3000 (ooneex/ooneex)
@@ -1176,25 +1364,7 @@ volumes:
1176
1364
 
1177
1365
  volumes:
1178
1366
  grafana_data:
1179
- `;var Di=`services:
1180
- # Jade - FastAPI REST API to fetch YouTube metadata and download videos or audio via Dockerized microservice.
1181
- # API: http://localhost:8000
1182
- # Docs: http://localhost:8000/docs
1183
- # Docker: https://hub.docker.com/r/ooneex/jade
1184
- ooneex-jade:
1185
- image: ooneex/jade:v3
1186
- container_name: ooneex-jade
1187
- restart: "on-failure"
1188
- environment:
1189
- - WORKERS=4
1190
- ports:
1191
- - "8000:8000"
1192
- volumes:
1193
- - jade_data:/code/var:rw
1194
-
1195
- volumes:
1196
- jade_data:
1197
- `;var Bi=`services:
1367
+ `;var Ii=`services:
1198
1368
  # Jaeger - Distributed tracing system
1199
1369
  # Docs: https://www.jaegertracing.io/docs/
1200
1370
  # Web UI: http://localhost:16686
@@ -1208,7 +1378,7 @@ volumes:
1208
1378
  - "16686:16686"
1209
1379
  - "6831:6831/udp"
1210
1380
  - "14268:14268"
1211
- `;var Oi=`services:
1381
+ `;var Li=`services:
1212
1382
  # Keycloak - Identity and access management
1213
1383
  # Docs: https://www.keycloak.org/documentation
1214
1384
  # Admin Console: http://localhost:8080 (ooneex/ooneex)
@@ -1222,7 +1392,7 @@ volumes:
1222
1392
  - KEYCLOAK_ADMIN=ooneex
1223
1393
  - KEYCLOAK_ADMIN_PASSWORD=ooneex
1224
1394
  command: start-dev
1225
- `;var Pi=`services:
1395
+ `;var $i=`services:
1226
1396
  # LibreTranslate - Self-hosted machine translation API
1227
1397
  # Docs: https://libretranslate.com/docs/
1228
1398
  # API: http://localhost:4000
@@ -1249,7 +1419,7 @@ volumes:
1249
1419
 
1250
1420
  volumes:
1251
1421
  libretranslate_models:
1252
- `;var Ii=`services:
1422
+ `;var Gi=`services:
1253
1423
  # MailDev - Email testing tool with web UI
1254
1424
  # Docs: https://github.com/maildev/maildev
1255
1425
  # Web UI: http://localhost:1080
@@ -1260,7 +1430,7 @@ volumes:
1260
1430
  ports:
1261
1431
  - "1080:1080"
1262
1432
  - "1025:1025"
1263
- `;var Li=`services:
1433
+ `;var Ui=`services:
1264
1434
  # Memcached - Distributed memory caching system
1265
1435
  # Docs: https://memcached.org/
1266
1436
  # Connection: localhost:11211
@@ -1270,7 +1440,7 @@ volumes:
1270
1440
  restart: "on-failure"
1271
1441
  ports:
1272
1442
  - "11211:11211"
1273
- `;var $i=`services:
1443
+ `;var qi=`services:
1274
1444
  # MinIO - S3-compatible object storage
1275
1445
  # Docs: https://min.io/docs/minio/container/index.html
1276
1446
  # API: http://localhost:9000
@@ -1291,7 +1461,7 @@ volumes:
1291
1461
 
1292
1462
  volumes:
1293
1463
  minio_data:
1294
- `;var Ui=`services:
1464
+ `;var Ki=`services:
1295
1465
  # MongoDB - NoSQL document database
1296
1466
  # Docs: https://www.mongodb.com/docs/
1297
1467
  # Connection: mongodb://ooneex:ooneex@localhost:27017/ooneex
@@ -1310,7 +1480,7 @@ volumes:
1310
1480
 
1311
1481
  volumes:
1312
1482
  mongodb_data:
1313
- `;var qi=`services:
1483
+ `;var Hi=`services:
1314
1484
  # MySQL - Alternative relational database
1315
1485
  # Docs: https://dev.mysql.com/doc/
1316
1486
  # Connection: mysql://ooneex:ooneex@localhost:3306/ooneex
@@ -1330,7 +1500,7 @@ volumes:
1330
1500
 
1331
1501
  volumes:
1332
1502
  mysql_db:
1333
- `;var Gi=`services:
1503
+ `;var Wi=`services:
1334
1504
  # NATS - High-performance messaging system with JetStream
1335
1505
  # Docs: https://docs.nats.io/
1336
1506
  # Client: localhost:4222
@@ -1343,7 +1513,25 @@ volumes:
1343
1513
  - "4222:4222"
1344
1514
  - "8222:8222"
1345
1515
  command: "--jetstream --http_port 8222"
1346
- `;var Ki=`services:
1516
+ `;var Yi=`services:
1517
+ # Jade - FastAPI REST API to fetch YouTube metadata and download videos or audio via Dockerized microservice.
1518
+ # API: http://localhost:8000
1519
+ # Docs: http://localhost:8000/docs
1520
+ # Docker: https://hub.docker.com/r/ooneex/jade
1521
+ ooneex-jade:
1522
+ image: ooneex/jade:v3
1523
+ container_name: ooneex-jade
1524
+ restart: "on-failure"
1525
+ environment:
1526
+ - WORKERS=4
1527
+ ports:
1528
+ - "8000:8000"
1529
+ volumes:
1530
+ - jade_data:/code/var:rw
1531
+
1532
+ volumes:
1533
+ jade_data:
1534
+ `;var Vi=`services:
1347
1535
  # PostgreSQL - Primary relational database
1348
1536
  # Docs: https://www.postgresql.org/docs/
1349
1537
  # Connection: postgresql://ooneex:ooneex@localhost:5432/ooneex
@@ -1364,7 +1552,7 @@ volumes:
1364
1552
 
1365
1553
  volumes:
1366
1554
  postgres_db:
1367
- `;var Wi=`services:
1555
+ `;var Fi=`services:
1368
1556
  # Prometheus - Metrics collection and monitoring
1369
1557
  # Docs: https://prometheus.io/docs/
1370
1558
  # Web UI: http://localhost:9090
@@ -1379,7 +1567,7 @@ volumes:
1379
1567
 
1380
1568
  volumes:
1381
1569
  prometheus_data:
1382
- `;var Hi=`services:
1570
+ `;var Qi=`services:
1383
1571
  # RabbitMQ - Message broker for async processing
1384
1572
  # Docs: https://www.rabbitmq.com/docs
1385
1573
  # AMQP: amqp://ooneex:ooneex@localhost:5672/ooneex
@@ -1401,7 +1589,7 @@ volumes:
1401
1589
 
1402
1590
  volumes:
1403
1591
  rabbitmq_data:
1404
- `;var Yi=`services:
1592
+ `;var zi=`services:
1405
1593
  # Redis - In-memory data store for caching and sessions
1406
1594
  # Docs: https://redis.io/docs/
1407
1595
  # Connection: redis://localhost:6379
@@ -1416,7 +1604,7 @@ volumes:
1416
1604
 
1417
1605
  volumes:
1418
1606
  redis_data:
1419
- `;var Vi=`services:
1607
+ `;var Zi=`services:
1420
1608
  # Temporal - Workflow orchestration engine
1421
1609
  # Docs: https://docs.temporal.io/
1422
1610
  # gRPC: localhost:7233
@@ -1433,7 +1621,7 @@ volumes:
1433
1621
  - POSTGRES_USER=ooneex
1434
1622
  - POSTGRES_PWD=ooneex
1435
1623
  - POSTGRES_SEEDS=postgres
1436
- `;var Fi=`services:
1624
+ `;var Xi=`services:
1437
1625
  # Vault - Secrets management and encryption
1438
1626
  # Docs: https://developer.hashicorp.com/vault/docs
1439
1627
  # Web UI: http://localhost:8200 (token: ooneex)
@@ -1448,20 +1636,20 @@ volumes:
1448
1636
  - VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200
1449
1637
  cap_add:
1450
1638
  - IPC_LOCK
1451
- `;var Qi={clickhouse:_i,elasticsearch:Ri,grafana:Ci,"ooneex-jade":Di,jaeger:Bi,keycloak:Oi,libretranslate:Pi,maildev:Ii,memcached:Li,minio:$i,mongodb:Ui,mysql:qi,nats:Gi,postgres:Ki,prometheus:Wi,rabbitmq:Hi,redis:Yi,temporal:Vi,vault:Fi};function yl(e){let t=e.split(`
1639
+ `;var Ji={clickhouse:Bi,elasticsearch:Oi,grafana:Pi,"ooneex-jade":Yi,jaeger:Ii,keycloak:Li,libretranslate:$i,maildev:Gi,memcached:Ui,minio:qi,mongodb:Ki,mysql:Hi,nats:Wi,postgres:Vi,prometheus:Fi,rabbitmq:Qi,redis:zi,temporal:Zi,vault:Xi};function Nl(e){let t=e.split(`
1452
1640
  `),s=[],r=!1;for(let i of t){if(i.startsWith("services:")){r=!0;continue}if(r){if(i.startsWith("volumes:")||i.startsWith("networks:"))break;s.push(i)}}return s.join(`
1453
- `)}function gl(e){let t=zi.parse(e);return t.volumes?Object.keys(t.volumes):[]}class Ge{getName(){return"make:docker"}getDescription(){return"Add a docker service to docker-compose.yml"}async run(e){let{name:t}=e;if(!t)t=await vi({message:"Select docker service"});let s=Qi[t],r=Zi(process.cwd(),"docker-compose.yml"),i=new fl,o=Bun.file(r);if(await o.exists()){let p=await o.text(),l=zi.parse(p);if(l.services&&t in l.services){i.warn(`Service "${t}" already exists in docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});return}let d=yl(s),c=gl(s),h=p,u=h.indexOf(`
1454
- volumes:`),m=h.indexOf(`
1455
- networks:`),y=-1;if(u!==-1&&m!==-1)y=Math.min(u,m);else if(u!==-1)y=u;else if(m!==-1)y=m;if(y!==-1)h=`${h.slice(0,y)}
1456
- ${d}${h.slice(y)}`;else h=`${h.trimEnd()}
1457
- ${d}`;for(let S of c)if(!h.includes(` ${S}:`))if(h.includes(`
1641
+ `)}function Ml(e){let t=ki.parse(e);return t.volumes?Object.keys(t.volumes):[]}class Ke{getName(){return"make:docker"}getDescription(){return"Add a docker service to docker-compose.yml"}async run(e){let{name:t}=e;if(!t)t=await Di({message:"Select docker service"});let s=Ji[t],r=ji(process.cwd(),"docker-compose.yml"),i=new Sl,o=Bun.file(r);if(await o.exists()){let p=await o.text(),l=ki.parse(p);if(l.services&&t in l.services){i.warn(`Service "${t}" already exists in docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});return}let c=Nl(s),d=Ml(s),h=p,m=h.indexOf(`
1642
+ volumes:`),u=h.indexOf(`
1643
+ networks:`),y=-1;if(m!==-1&&u!==-1)y=Math.min(m,u);else if(m!==-1)y=m;else if(u!==-1)y=u;if(y!==-1)h=`${h.slice(0,y)}
1644
+ ${c}${h.slice(y)}`;else h=`${h.trimEnd()}
1645
+ ${c}`;for(let S of d)if(!h.includes(` ${S}:`))if(h.includes(`
1458
1646
  volumes:`)){let f=h.indexOf(`
1459
- volumes:`),E=h.slice(f+9);h=`${h.slice(0,f+9)}
1460
- ${S}:${E}`}else h=`${h.trimEnd()}
1647
+ volumes:`),b=h.slice(f+9);h=`${h.slice(0,f+9)}
1648
+ ${S}:${b}`}else h=`${h.trimEnd()}
1461
1649
 
1462
1650
  volumes:
1463
1651
  ${S}:
1464
- `;await Bun.write(r,h)}else await Bun.write(r,s);let n=Zi(process.cwd(),"package.json"),a=Bun.file(n);if(await a.exists()){let p=await a.json();p.scripts=p.scripts||{},p.scripts.docker="docker compose up -d",await Bun.write(n,JSON.stringify(p,null,2))}i.success(`Service "${t}" added to docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),i.info("Run 'bun run docker' to start docker containers",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Ge=A([b.command()],Ge);var eo=Y(Xi(),1);import{basename as bl,join as G}from"path";import{TerminalLogger as xl}from"@ooneex/logger";import{toPascalCase as ki,toSnakeCase as wl}from"@ooneex/utils";var Ji=`import { describe, expect, test } from "bun:test";
1652
+ `;await Bun.write(r,h)}else await Bun.write(r,s);let n=ji(process.cwd(),"package.json"),a=Bun.file(n);if(await a.exists()){let p=await a.json();p.scripts=p.scripts||{},p.scripts.docker="docker compose up -d",await Bun.write(n,JSON.stringify(p,null,2))}i.success(`Service "${t}" added to docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),i.info("Run 'bun run docker' to start docker containers",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Ke=g([E.command()],Ke);var io=Y(eo(),1);import{basename as vl,join as q}from"path";import{TerminalLogger as Rl}from"@ooneex/logger";import{toPascalCase as ro,toSnakeCase as Cl}from"@ooneex/utils";var to=`import { describe, expect, test } from "bun:test";
1465
1653
  import { {{NAME}}Entity } from "@/entities/{{NAME}}Entity";
1466
1654
 
1467
1655
  describe("{{NAME}}Entity", () => {
@@ -1526,7 +1714,7 @@ describe("{{NAME}}Entity", () => {
1526
1714
  expect("deletedAt" in entity).toBe(true);
1527
1715
  });
1528
1716
  });
1529
- `;var ji=`import type { LocaleType } from "@ooneex/translation";
1717
+ `;var so=`import type { LocaleType } from "@ooneex/translation";
1530
1718
  import { random } from "@ooneex/utils";
1531
1719
  import { Column, CreateDateColumn, DeleteDateColumn, PrimaryColumn, UpdateDateColumn } from "typeorm";
1532
1720
 
@@ -1577,9 +1765,9 @@ export class {{NAME}}Entity extends BaseEntity {
1577
1765
  @DeleteDateColumn({ name: "deleted_at" })
1578
1766
  deletedAt?: Date;
1579
1767
  }
1580
- `;class Ke{getName(){return"make:entity"}getDescription(){return"Generate a new entity class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Entity`,i=`import { ${r} } from "./entities/${r}";
1768
+ `;class He{getName(){return"make:entity"}getDescription(){return"Generate a new entity class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Entity`,i=`import { ${r} } from "./entities/${r}";
1581
1769
  `,o=s.lastIndexOf("import "),n=s.indexOf(`
1582
- `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(entities:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),d=l?`${l}, ${r}`:r;s=s.replace(a,`$1${d}`)}await Bun.write(e,s)}async run(e){let{name:t,tableName:s}=e;if(!t)t=await x({message:"Enter entity name"});if(t=ki(t).replace(/Entity$/,""),!s)s=wl(eo.default(t));let r=ji.replace(/{{NAME}}/g,t).replace(/{{TABLE_NAME}}/g,s),i=G("src","entities"),o=G(process.cwd(),i),n=G(o,`${t}Entity.ts`);await Bun.write(n,r);let a=Ji.replace(/{{NAME}}/g,t),p=G("tests","entities"),l=G(process.cwd(),p),d=G(l,`${t}Entity.spec.ts`);await Bun.write(d,a);let c=ki(bl(process.cwd())),h=G(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let u=new xl;u.success(`${G(i,t)}Entity.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${G(p,t)}Entity.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ke=A([b.command()],Ke);import{join as ee}from"path";import{TerminalLogger as Ml}from"@ooneex/logger";import{toPascalCase as Tl}from"@ooneex/utils";var to=`import { describe, expect, test } from "bun:test";
1770
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(entities:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,tableName:s}=e;if(!t)t=await w({message:"Enter entity name"});if(t=ro(t).replace(/Entity$/,""),!s)s=Cl(io.default(t));let r=so.replace(/{{NAME}}/g,t).replace(/{{TABLE_NAME}}/g,s),i=q("src","entities"),o=q(process.cwd(),i),n=q(o,`${t}Entity.ts`);await Bun.write(n,r);let a=to.replace(/{{NAME}}/g,t),p=q("tests","entities"),l=q(process.cwd(),p),c=q(l,`${t}Entity.spec.ts`);await Bun.write(c,a);let d=ro(vl(process.cwd())),h=q(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let m=new Rl;m.success(`${q(i,t)}Entity.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${q(p,t)}Entity.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}He=g([E.command()],He);import{join as ee}from"path";import{TerminalLogger as Ol}from"@ooneex/logger";import{toPascalCase as Pl}from"@ooneex/utils";var oo=`import { describe, expect, test } from "bun:test";
1583
1771
  import { {{NAME}}Logger } from "@/loggers/{{NAME}}Logger";
1584
1772
 
1585
1773
  describe("{{NAME}}Logger", () => {
@@ -1622,7 +1810,7 @@ describe("{{NAME}}Logger", () => {
1622
1810
  expect(typeof {{NAME}}Logger.prototype.error).toBe("function");
1623
1811
  });
1624
1812
  });
1625
- `;var so=`import type { IException } from "@ooneex/exception";
1813
+ `;var no=`import type { IException } from "@ooneex/exception";
1626
1814
  import type { ILogger } from "@ooneex/logger";
1627
1815
  import type { ScalarType } from "@ooneex/types";
1628
1816
  import { decorator } from "@ooneex/logger";
@@ -1657,7 +1845,7 @@ export class {{NAME}}Logger implements ILogger {
1657
1845
  // Handle error logging
1658
1846
  }
1659
1847
  }
1660
- `;class We{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter logger name"});t=Tl(t).replace(/Logger$/,"");let s=so.replace(/{{NAME}}/g,t),r=ee("src","loggers"),i=ee(process.cwd(),r),o=ee(i,`${t}Logger.ts`);await Bun.write(o,s);let n=to.replace(/{{NAME}}/g,t),a=ee("tests","loggers"),p=ee(process.cwd(),a),l=ee(p,`${t}Logger.spec.ts`);await Bun.write(l,n);let d=new Ml;d.success(`${ee(r,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${ee(a,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}We=A([b.command()],We);import{join as I}from"path";import{TerminalLogger as Dl}from"@ooneex/logger";import{toPascalCase as Bl}from"@ooneex/utils";var ro=`import { describe, expect, test } from "bun:test";
1848
+ `;class We{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter logger name"});t=Pl(t).replace(/Logger$/,"");let s=no.replace(/{{NAME}}/g,t),r=ee("src","loggers"),i=ee(process.cwd(),r),o=ee(i,`${t}Logger.ts`);await Bun.write(o,s);let n=oo.replace(/{{NAME}}/g,t),a=ee("tests","loggers"),p=ee(process.cwd(),a),l=ee(p,`${t}Logger.spec.ts`);await Bun.write(l,n);let c=new Ol;c.success(`${ee(r,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${ee(a,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}We=g([E.command()],We);import{join as I}from"path";import{TerminalLogger as Ul}from"@ooneex/logger";import{toPascalCase as ql}from"@ooneex/utils";var ao=`import { describe, expect, test } from "bun:test";
1661
1849
  import { {{NAME}}Mailer } from "@/mailers/{{NAME}}Mailer";
1662
1850
 
1663
1851
  describe("{{NAME}}Mailer", () => {
@@ -1670,7 +1858,7 @@ describe("{{NAME}}Mailer", () => {
1670
1858
  expect(typeof {{NAME}}Mailer.prototype.send).toBe("function");
1671
1859
  });
1672
1860
  });
1673
- `;var io=`import { inject } from "@ooneex/container";
1861
+ `;var po=`import { inject } from "@ooneex/container";
1674
1862
  import type { IMailer } from "@ooneex/mailer";
1675
1863
  import { type {{NAME}}MailerPropsType, {{NAME}}MailerTemplate } from "./{{NAME}}MailerTemplate";
1676
1864
 
@@ -1694,7 +1882,7 @@ export class {{NAME}}Mailer implements IMailer {
1694
1882
  });
1695
1883
  }
1696
1884
  }
1697
- `;var oo=`import { describe, expect, test } from "bun:test";
1885
+ `;var lo=`import { describe, expect, test } from "bun:test";
1698
1886
  import { {{NAME}}MailerTemplate } from "@/mailers/{{NAME}}MailerTemplate";
1699
1887
 
1700
1888
  describe("{{NAME}}MailerTemplate", () => {
@@ -1706,7 +1894,7 @@ describe("{{NAME}}MailerTemplate", () => {
1706
1894
  expect(typeof {{NAME}}MailerTemplate).toBe("function");
1707
1895
  });
1708
1896
  });
1709
- `;var no=`import { MailerLayout } from "@ooneex/mailer";
1897
+ `;var co=`import { MailerLayout } from "@ooneex/mailer";
1710
1898
 
1711
1899
  export type {{NAME}}MailerPropsType = {
1712
1900
  link: string;
@@ -1721,7 +1909,7 @@ export const {{NAME}}MailerTemplate = (props?: {{NAME}}MailerPropsType) => (
1721
1909
  <MailerLayout.Footer />
1722
1910
  </MailerLayout>
1723
1911
  );
1724
- `;class He{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter mailer name"});t=Bl(t).replace(/Mailer$/,"");let s=io.replace(/{{NAME}}/g,t),r=no.replace(/{{NAME}}/g,t),i=I("src","mailers"),o=I(process.cwd(),i),n=I(o,`${t}Mailer.ts`),a=I(o,`${t}MailerTemplate.tsx`);await Bun.write(n,s),await Bun.write(a,r);let p=ro.replace(/{{NAME}}/g,t),l=oo.replace(/{{NAME}}/g,t),d=I("tests","mailers"),c=I(process.cwd(),d),h=I(c,`${t}Mailer.spec.ts`),u=I(c,`${t}MailerTemplate.spec.ts`);await Bun.write(h,p),await Bun.write(u,l);let m=new Dl;m.success(`${I(i,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${I(i,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${I(d,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${I(d,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}He=A([b.command()],He);import{basename as Ll,join as K}from"path";import{TerminalLogger as $l}from"@ooneex/logger";import{toPascalCase as uo}from"@ooneex/utils";var ao=`import type { ContextType } from "@ooneex/socket";
1912
+ `;class Ye{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter mailer name"});t=ql(t).replace(/Mailer$/,"");let s=po.replace(/{{NAME}}/g,t),r=co.replace(/{{NAME}}/g,t),i=I("src","mailers"),o=I(process.cwd(),i),n=I(o,`${t}Mailer.ts`),a=I(o,`${t}MailerTemplate.tsx`);await Bun.write(n,s),await Bun.write(a,r);let p=ao.replace(/{{NAME}}/g,t),l=lo.replace(/{{NAME}}/g,t),c=I("tests","mailers"),d=I(process.cwd(),c),h=I(d,`${t}Mailer.spec.ts`),m=I(d,`${t}MailerTemplate.spec.ts`);await Bun.write(h,p),await Bun.write(m,l);let u=new Ul;u.success(`${I(i,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${I(i,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${I(c,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${I(c,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ye=g([E.command()],Ye);import{basename as Yl,join as K}from"path";import{TerminalLogger as Vl}from"@ooneex/logger";import{toPascalCase as fo}from"@ooneex/utils";var mo=`import type { ContextType } from "@ooneex/socket";
1725
1913
  import { decorator, type IMiddleware } from "@ooneex/middleware";
1726
1914
 
1727
1915
  @decorator.middleware()
@@ -1733,7 +1921,7 @@ export class {{NAME}}Middleware implements IMiddleware {
1733
1921
  return context
1734
1922
  }
1735
1923
  }
1736
- `;var po=`import { describe, expect, test } from "bun:test";
1924
+ `;var uo=`import { describe, expect, test } from "bun:test";
1737
1925
  import { {{NAME}}Middleware } from "@/middlewares/{{NAME}}Middleware";
1738
1926
 
1739
1927
  describe("{{NAME}}Middleware", () => {
@@ -1746,7 +1934,7 @@ describe("{{NAME}}Middleware", () => {
1746
1934
  expect(typeof {{NAME}}Middleware.prototype.handler).toBe("function");
1747
1935
  });
1748
1936
  });
1749
- `;var lo=`import type { ContextType } from "@ooneex/controller";
1937
+ `;var ho=`import type { ContextType } from "@ooneex/controller";
1750
1938
  import { decorator, type IMiddleware } from "@ooneex/middleware";
1751
1939
 
1752
1940
  @decorator.middleware()
@@ -1758,9 +1946,9 @@ export class {{NAME}}Middleware implements IMiddleware {
1758
1946
  return context
1759
1947
  }
1760
1948
  }
1761
- `;class Ye{getName(){return"make:middleware"}getDescription(){return"Generate a new middleware class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Middleware`,i=`import { ${r} } from "./middlewares/${r}";
1949
+ `;class Ve{getName(){return"make:middleware"}getDescription(){return"Generate a new middleware class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Middleware`,i=`import { ${r} } from "./middlewares/${r}";
1762
1950
  `,o=s.lastIndexOf("import "),n=s.indexOf(`
1763
- `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(middlewares:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),d=l?`${l}, ${r}`:r;s=s.replace(a,`$1${d}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await x({message:"Enter middleware name"});if(s===void 0)s=await Le({message:"Is this a socket middleware?"});t=uo(t).replace(/Middleware$/,"");let i=(s?ao:lo).replace(/{{NAME}}/g,t),o=K("src","middlewares"),n=K(process.cwd(),o),a=K(n,`${t}Middleware.ts`);await Bun.write(a,i);let p=po.replace(/{{NAME}}/g,t),l=K("tests","middlewares"),d=K(process.cwd(),l),c=K(d,`${t}Middleware.spec.ts`);await Bun.write(c,p);let h=uo(Ll(process.cwd())),u=K(process.cwd(),"src",`${h}Module.ts`);if(await Bun.file(u).exists())await this.addToModule(u,t);let m=new $l;m.success(`${K(o,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${K(l,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ye=A([b.command()],Ye);import{join as Ul}from"path";import{TerminalLogger as ql}from"@ooneex/logger";import{migrationCreate as Gl}from"@ooneex/migrations";class Ve{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(){await Gl({dir:"src/migrations"});let e=Ul(process.cwd(),"package.json"),t=Bun.file(e);if(await t.exists()){let r=await t.json();r.scripts=r.scripts||{},r.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(e,JSON.stringify(r,null,2))}let s=new ql;s.success("Migration file created successfully",void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),s.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Ve=A([b.command()],Ve);import{basename as Hl,join as W}from"path";import{TerminalLogger as Yl}from"@ooneex/logger";import{toPascalCase as ho}from"@ooneex/utils";var co=`import { describe, expect, test } from "bun:test";
1951
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(middlewares:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await w({message:"Enter middleware name"});if(s===void 0)s=await $e({message:"Is this a socket middleware?"});t=fo(t).replace(/Middleware$/,"");let i=(s?mo:ho).replace(/{{NAME}}/g,t),o=K("src","middlewares"),n=K(process.cwd(),o),a=K(n,`${t}Middleware.ts`);await Bun.write(a,i);let p=uo.replace(/{{NAME}}/g,t),l=K("tests","middlewares"),c=K(process.cwd(),l),d=K(c,`${t}Middleware.spec.ts`);await Bun.write(d,p);let h=fo(Yl(process.cwd())),m=K(process.cwd(),"src",`${h}Module.ts`);if(await Bun.file(m).exists())await this.addToModule(m,t);let u=new Vl;u.success(`${K(o,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${K(l,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ve=g([E.command()],Ve);import{join as Fl}from"path";import{TerminalLogger as Ql}from"@ooneex/logger";import{migrationCreate as zl}from"@ooneex/migrations";class Fe{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(){await zl({dir:"src/migrations"});let e=Fl(process.cwd(),"package.json"),t=Bun.file(e);if(await t.exists()){let r=await t.json();r.scripts=r.scripts||{},r.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(e,JSON.stringify(r,null,2))}let s=new Ql;s.success("Migration file created successfully",void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),s.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Fe=g([E.command()],Fe);import{basename as Jl,join as H}from"path";import{TerminalLogger as jl}from"@ooneex/logger";import{toPascalCase as Eo}from"@ooneex/utils";var yo=`import { describe, expect, test } from "bun:test";
1764
1952
  import { Permission } from "@ooneex/permission";
1765
1953
  import { {{NAME}}Permission } from "@/permissions/{{NAME}}Permission";
1766
1954
 
@@ -1785,7 +1973,7 @@ describe("{{NAME}}Permission", () => {
1785
1973
  });
1786
1974
 
1787
1975
  });
1788
- `;var mo=`import { decorator, Permission } from "@ooneex/permission";
1976
+ `;var go=`import { decorator, Permission } from "@ooneex/permission";
1789
1977
  import type { IUser } from "@ooneex/user";
1790
1978
 
1791
1979
  @decorator.permission()
@@ -1824,9 +2012,9 @@ export class {{NAME}}Permission extends Permission {
1824
2012
  return this;
1825
2013
  }
1826
2014
  }
1827
- `;class Fe{getName(){return"make:permission"}getDescription(){return"Generate a new permission class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Permission`,i=`import { ${r} } from "./permissions/${r}";
2015
+ `;class Qe{getName(){return"make:permission"}getDescription(){return"Generate a new permission class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Permission`,i=`import { ${r} } from "./permissions/${r}";
1828
2016
  `,o=s.lastIndexOf("import "),n=s.indexOf(`
1829
- `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(permissions:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),d=l?`${l}, ${r}`:r;s=s.replace(a,`$1${d}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter permission name"});t=ho(t).replace(/Permission$/,"");let s=mo.replace(/{{NAME}}/g,t),r=W("src","permissions"),i=W(process.cwd(),r),o=W(i,`${t}Permission.ts`);await Bun.write(o,s);let n=co.replace(/{{NAME}}/g,t),a=W("tests","permissions"),p=W(process.cwd(),a),l=W(p,`${t}Permission.spec.ts`);await Bun.write(l,n);let d=ho(Hl(process.cwd())),c=W(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(c).exists())await this.addToModule(c,t);let h=new Yl;h.success(`${W(r,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${W(a,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Fe=A([b.command()],Fe);import{basename as Ql,join as H}from"path";import{TerminalLogger as Zl}from"@ooneex/logger";import{toKebabCase as zl,toPascalCase as go}from"@ooneex/utils";var fo=`import { describe, expect, test } from "bun:test";
2017
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(permissions:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter permission name"});t=Eo(t).replace(/Permission$/,"");let s=go.replace(/{{NAME}}/g,t),r=H("src","permissions"),i=H(process.cwd(),r),o=H(i,`${t}Permission.ts`);await Bun.write(o,s);let n=yo.replace(/{{NAME}}/g,t),a=H("tests","permissions"),p=H(process.cwd(),a),l=H(p,`${t}Permission.spec.ts`);await Bun.write(l,n);let c=Eo(Jl(process.cwd())),d=H(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,t);let h=new jl;h.success(`${H(r,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${H(a,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Qe=g([E.command()],Qe);import{basename as tc,join as W}from"path";import{TerminalLogger as sc}from"@ooneex/logger";import{toKebabCase as rc,toPascalCase as wo}from"@ooneex/utils";var Ao=`import { describe, expect, test } from "bun:test";
1830
2018
  import { {{NAME}}PubSub } from "@/pubsub/{{NAME}}PubSub";
1831
2019
 
1832
2020
  describe("{{NAME}}PubSub", () => {
@@ -1864,7 +2052,7 @@ describe("{{NAME}}PubSub", () => {
1864
2052
  expect(typeof {{NAME}}PubSub.prototype.unsubscribeAll).toBe("function");
1865
2053
  });
1866
2054
  });
1867
- `;var yo=`import { inject } from "@ooneex/container";
2055
+ `;var bo=`import { inject } from "@ooneex/container";
1868
2056
  import type { ScalarType } from "@ooneex/types";
1869
2057
  import { decorator, PubSub, RedisPubSub } from "@ooneex/pub-sub";
1870
2058
 
@@ -1886,9 +2074,9 @@ export class {{NAME}}Event<Data extends Record<string, ScalarType> = Record<stri
1886
2074
  // TODO: Implement handler logic here
1887
2075
  }
1888
2076
  }
1889
- `;class Qe{getName(){return"make:pubsub"}getDescription(){return"Generate a new PubSub event class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Event`,i=`import { ${r} } from "./events/${r}";
2077
+ `;class ze{getName(){return"make:pubsub"}getDescription(){return"Generate a new PubSub event class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Event`,i=`import { ${r} } from "./events/${r}";
1890
2078
  `,o=s.lastIndexOf("import "),n=s.indexOf(`
1891
- `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(events:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),d=l?`${l}, ${r}`:r;s=s.replace(a,`$1${d}`)}await Bun.write(e,s)}async run(e){let{name:t,channel:s}=e;if(!t)t=await x({message:"Enter name"});if(t=go(t).replace(/PubSub$/,""),!s)s=zl(t);let r=yo.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,s),i=H("src","events"),o=H(process.cwd(),i),n=H(o,`${t}Event.ts`);await Bun.write(n,r);let a=fo.replace(/{{NAME}}/g,t),p=H("tests","events"),l=H(process.cwd(),p),d=H(l,`${t}Event.spec.ts`);await Bun.write(d,a);let c=go(Ql(process.cwd())),h=H(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let u=new Zl;u.success(`${H(i,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${H(p,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Qe=A([b.command()],Qe);import{join as te}from"path";import{TerminalLogger as jl}from"@ooneex/logger";import{toPascalCase as kl}from"@ooneex/utils";var Eo=`import { describe, expect, test } from "bun:test";
2079
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(events:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,channel:s}=e;if(!t)t=await w({message:"Enter name"});if(t=wo(t).replace(/PubSub$/,""),!s)s=rc(t);let r=bo.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,s),i=W("src","events"),o=W(process.cwd(),i),n=W(o,`${t}Event.ts`);await Bun.write(n,r);let a=Ao.replace(/{{NAME}}/g,t),p=W("tests","events"),l=W(process.cwd(),p),c=W(l,`${t}Event.spec.ts`);await Bun.write(c,a);let d=wo(tc(process.cwd())),h=W(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let m=new sc;m.success(`${W(i,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${W(p,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ze=g([E.command()],ze);import{join as te}from"path";import{TerminalLogger as nc}from"@ooneex/logger";import{toPascalCase as ac}from"@ooneex/utils";var xo=`import { describe, expect, test } from "bun:test";
1892
2080
  import { {{NAME}}Repository } from "@/repositories/{{NAME}}Repository";
1893
2081
 
1894
2082
  describe("{{NAME}}Repository", () => {
@@ -1951,7 +2139,7 @@ describe("{{NAME}}Repository", () => {
1951
2139
  expect(typeof {{NAME}}Repository.prototype.count).toBe("function");
1952
2140
  });
1953
2141
  });
1954
- `;var Ao=`import { inject } from "@ooneex/container";
2142
+ `;var So=`import { inject } from "@ooneex/container";
1955
2143
  import type { ITypeormDatabase } from "@ooneex/database";
1956
2144
  import { decorator } from "@ooneex/repository";
1957
2145
  import type { FilterResultType } from "@ooneex/types";
@@ -2073,7 +2261,7 @@ export class {{NAME}}Repository {
2073
2261
  return await repository.count(criteria ? { where: criteria } : {});
2074
2262
  }
2075
2263
  }
2076
- `;class Ze{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter repository name"});t=kl(t).replace(/Repository$/,"");let s=Ao.replace(/{{NAME}}/g,t),r=te("src","repositories"),i=te(process.cwd(),r),o=te(i,`${t}Repository.ts`);await Bun.write(o,s);let n=Eo.replace(/{{NAME}}/g,t),a=te("tests","repositories"),p=te(process.cwd(),a),l=te(p,`${t}Repository.spec.ts`);await Bun.write(l,n);let d=new jl;d.success(`${te(r,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${te(a,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ze=A([b.command()],Ze);import{join as ed}from"path";import{TerminalLogger as td}from"@ooneex/logger";import{seedCreate as sd}from"@ooneex/seeds";class ze{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter seed name"});let s=await sd({name:t,dir:"src/seeds"}),r=ed(process.cwd(),"package.json"),i=Bun.file(r);if(await i.exists()){let n=await i.json();n.scripts=n.scripts||{},n.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(r,JSON.stringify(n,null,2))}let o=new td;o.success(`${s} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),o.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}ze=A([b.command()],ze);import{join as se}from"path";import{TerminalLogger as od}from"@ooneex/logger";import{toPascalCase as nd}from"@ooneex/utils";var bo=`import { describe, expect, test } from "bun:test";
2264
+ `;class Ze{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter repository name"});t=ac(t).replace(/Repository$/,"");let s=So.replace(/{{NAME}}/g,t),r=te("src","repositories"),i=te(process.cwd(),r),o=te(i,`${t}Repository.ts`);await Bun.write(o,s);let n=xo.replace(/{{NAME}}/g,t),a=te("tests","repositories"),p=te(process.cwd(),a),l=te(p,`${t}Repository.spec.ts`);await Bun.write(l,n);let c=new nc;c.success(`${te(r,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${te(a,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ze=g([E.command()],Ze);import{join as pc}from"path";import{TerminalLogger as lc}from"@ooneex/logger";import{seedCreate as cc}from"@ooneex/seeds";class Xe{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter seed name"});let s=await cc({name:t,dir:"src/seeds"}),r=pc(process.cwd(),"package.json"),i=Bun.file(r);if(await i.exists()){let n=await i.json();n.scripts=n.scripts||{},n.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(r,JSON.stringify(n,null,2))}let o=new lc;o.success(`${s} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),o.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Xe=g([E.command()],Xe);import{join as se}from"path";import{TerminalLogger as uc}from"@ooneex/logger";import{toPascalCase as hc}from"@ooneex/utils";var No=`import { describe, expect, test } from "bun:test";
2077
2265
  import { {{NAME}}Service } from "@/services/{{NAME}}Service";
2078
2266
 
2079
2267
  describe("{{NAME}}Service", () => {
@@ -2086,7 +2274,7 @@ describe("{{NAME}}Service", () => {
2086
2274
  expect(typeof {{NAME}}Service.prototype.execute).toBe("function");
2087
2275
  });
2088
2276
  });
2089
- `;var xo=`import { decorator } from "@ooneex/service";
2277
+ `;var Mo=`import { decorator } from "@ooneex/service";
2090
2278
  import type { IService } from "@ooneex/service";
2091
2279
 
2092
2280
  type ServiceDataType = Record<string, unknown>;
@@ -2097,7 +2285,7 @@ export class {{NAME}}Service<T extends ServiceDataType = ServiceDataType> implem
2097
2285
  // TODO: Implement service logic
2098
2286
  }
2099
2287
  }
2100
- `;class Xe{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter service name"});t=nd(t).replace(/Service$/,"");let s=xo.replace(/{{NAME}}/g,t),r=se("src","services"),i=se(process.cwd(),r),o=se(i,`${t}Service.ts`);await Bun.write(o,s);let n=bo.replace(/{{NAME}}/g,t),a=se("tests","services"),p=se(process.cwd(),a),l=se(p,`${t}Service.spec.ts`);await Bun.write(l,n);let d=new od;d.success(`${se(r,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${se(a,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Xe=A([b.command()],Xe);import{join as re}from"path";import{TerminalLogger as ld}from"@ooneex/logger";import{toPascalCase as dd,toSnakeCase as ud}from"@ooneex/utils";var wo=`import { describe, expect, test } from "bun:test";
2288
+ `;class Je{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter service name"});t=hc(t).replace(/Service$/,"");let s=Mo.replace(/{{NAME}}/g,t),r=se("src","services"),i=se(process.cwd(),r),o=se(i,`${t}Service.ts`);await Bun.write(o,s);let n=No.replace(/{{NAME}}/g,t),a=se("tests","services"),p=se(process.cwd(),a),l=se(p,`${t}Service.spec.ts`);await Bun.write(l,n);let c=new uc;c.success(`${se(r,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${se(a,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Je=g([E.command()],Je);import{join as re}from"path";import{TerminalLogger as gc}from"@ooneex/logger";import{toPascalCase as Ec,toSnakeCase as Ac}from"@ooneex/utils";var To=`import { describe, expect, test } from "bun:test";
2101
2289
  import { {{NAME}}StorageAdapter } from "@/storage/{{NAME}}StorageAdapter";
2102
2290
 
2103
2291
  describe("{{NAME}}StorageAdapter", () => {
@@ -2114,7 +2302,7 @@ describe("{{NAME}}StorageAdapter", () => {
2114
2302
  expect(typeof {{NAME}}StorageAdapter.prototype.getOptions).toBe("function");
2115
2303
  });
2116
2304
  });
2117
- `;var So=`import { Storage, decorator, StorageException } from "@ooneex/storage";
2305
+ `;var _o=`import { Storage, decorator, StorageException } from "@ooneex/storage";
2118
2306
  import type { S3Options } from "bun";
2119
2307
 
2120
2308
  @decorator.storage()
@@ -2169,7 +2357,7 @@ export class {{NAME}}Storage extends Storage {
2169
2357
  };
2170
2358
  }
2171
2359
  }
2172
- `;class Je{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter storage name"});t=dd(t).replace(/Storage$/,"");let s=ud(t).toUpperCase(),r=So.replace(/{{NAME}}/g,t).replace(/{{NAME_UPPER}}/g,s),i=re("src","storage"),o=re(process.cwd(),i),n=re(o,`${t}Storage.ts`);await Bun.write(n,r);let a=wo.replace(/{{NAME}}/g,t),p=re("tests","storage"),l=re(process.cwd(),p),d=re(l,`${t}Storage.spec.ts`);await Bun.write(d,a);let c=new ld;c.success(`${re(i,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${re(p,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Je=A([b.command()],Je);import{join as ie}from"path";import{TerminalLogger as hd}from"@ooneex/logger";import{toPascalCase as fd}from"@ooneex/utils";var No=`import { describe, expect, test } from "bun:test";
2360
+ `;class je{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter storage name"});t=Ec(t).replace(/Storage$/,"");let s=Ac(t).toUpperCase(),r=_o.replace(/{{NAME}}/g,t).replace(/{{NAME_UPPER}}/g,s),i=re("src","storage"),o=re(process.cwd(),i),n=re(o,`${t}Storage.ts`);await Bun.write(n,r);let a=To.replace(/{{NAME}}/g,t),p=re("tests","storage"),l=re(process.cwd(),p),c=re(l,`${t}Storage.spec.ts`);await Bun.write(c,a);let d=new gc;d.success(`${re(i,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${re(p,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}je=g([E.command()],je);import{join as ie}from"path";import{TerminalLogger as xc}from"@ooneex/logger";import{toPascalCase as Sc}from"@ooneex/utils";var vo=`import { describe, expect, test } from "bun:test";
2173
2361
  import { {{NAME}}VectorDatabase } from "@/databases/{{NAME}}VectorDatabase";
2174
2362
 
2175
2363
  describe("{{NAME}}VectorDatabase", () => {
@@ -2192,7 +2380,7 @@ describe("{{NAME}}VectorDatabase", () => {
2192
2380
  expect(typeof {{NAME}}VectorDatabase.prototype.getSchema).toBe("function");
2193
2381
  });
2194
2382
  });
2195
- `;var Mo=`import { VectorDatabase, decorator } from "@ooneex/rag";
2383
+ `;var Ro=`import { VectorDatabase, decorator } from "@ooneex/rag";
2196
2384
  import type { EmbeddingModelType, EmbeddingProviderType, FieldValueType } from "@ooneex/rag";
2197
2385
  import { Utf8 } from "apache-arrow";
2198
2386
 
@@ -2216,8 +2404,8 @@ export class {{NAME}}VectorDatabase extends VectorDatabase<DataType> {
2216
2404
  };
2217
2405
  }
2218
2406
  }
2219
- `;class je{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter vector database name"});t=fd(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let s=Mo.replace(/{{NAME}}/g,t),r=ie("src","databases"),i=ie(process.cwd(),r),o=ie(i,`${t}VectorDatabase.ts`);await Bun.write(o,s);let n=No.replace(/{{NAME}}/g,t),a=ie("tests","databases"),p=ie(process.cwd(),a),l=ie(p,`${t}VectorDatabase.spec.ts`);await Bun.write(l,n);let d=new hd;d.success(`${ie(r,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${ie(a,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}je=A([b.command()],je);var{values:oe,positionals:Ed}=yd({args:Bun.argv,options:{name:{type:"string"},"route-name":{type:"string"},"route-path":{type:"string"},"route-method":{type:"string"},"is-socket":{type:"boolean"},dir:{type:"string"},channel:{type:"string"},"table-name":{type:"string"}},strict:!0,allowPositionals:!0}),Ct=new gd,To=Ed[2];if(!To)Ct.error(`Command name is required
2220
- `),process.exit(1);var vo=Bt(To);if(!vo)Ct.info(`No commands found
2221
- `),process.exit(1);var Ad={name:oe.name,dir:oe.dir,channel:oe.channel,isSocket:oe["is-socket"],tableName:oe["table-name"],route:{name:oe["route-name"],path:oe["route-path"],method:oe["route-method"]}};try{await vo.run(Ad)}catch(e){Ct.error(e,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
2407
+ `;class ke{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter vector database name"});t=Sc(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let s=Ro.replace(/{{NAME}}/g,t),r=ie("src","databases"),i=ie(process.cwd(),r),o=ie(i,`${t}VectorDatabase.ts`);await Bun.write(o,s);let n=vo.replace(/{{NAME}}/g,t),a=ie("tests","databases"),p=ie(process.cwd(),a),l=ie(p,`${t}VectorDatabase.spec.ts`);await Bun.write(l,n);let c=new xc;c.success(`${ie(r,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${ie(a,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ke=g([E.command()],ke);var{values:oe,positionals:Tc}=Nc({args:Bun.argv,options:{name:{type:"string"},"route-name":{type:"string"},"route-path":{type:"string"},"route-method":{type:"string"},"is-socket":{type:"boolean"},dir:{type:"string"},channel:{type:"string"},"table-name":{type:"string"}},strict:!0,allowPositionals:!0}),Bt=new Mc,Co=Tc[2];if(!Co)Bt.error(`Command name is required
2408
+ `),process.exit(1);var Do=Pt(Co);if(!Do)Bt.info(`No commands found
2409
+ `),process.exit(1);var _c={name:oe.name,dir:oe.dir,channel:oe.channel,isSocket:oe["is-socket"],tableName:oe["table-name"],route:{name:oe["route-name"],path:oe["route-path"],method:oe["route-method"]}};try{await Do.run(_c)}catch(e){Bt.error(e,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
2222
2410
 
2223
- //# debugId=0E00F3324027A63564756E2164756E21
2411
+ //# debugId=379BE11F6545E8B464756E2164756E21