UNPKG

@vite-pwa/create-pwa

Version:
48 lines 60.7 kB
import C from"node:fs";import A from"node:path";import K from"node:process";import{fileURLToPath as di}from"node:url";import fi from"child_process";import se from"path";import ne from"fs";import pi from"readline";import mi from"events";var gi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function U(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var H={exports:{}},oe,st;function vi(){if(st)return oe;st=1,oe=t,t.sync=l;var e=ne;function s(a,i){var f=i.pathExt!==void 0?i.pathExt:process.env.PATHEXT;if(!f||(f=f.split(";"),f.indexOf("")!==-1))return!0;for(var o=0;o<f.length;o++){var n=f[o].toLowerCase();if(n&&a.substr(-n.length).toLowerCase()===n)return!0}return!1}function u(a,i,f){return!a.isSymbolicLink()&&!a.isFile()?!1:s(i,f)}function t(a,i,f){e.stat(a,function(o,n){f(o,o?!1:u(n,a,i))})}function l(a,i){return u(e.statSync(a),a,i)}return oe}var ae,nt;function bi(){if(nt)return ae;nt=1,ae=s,s.sync=u;var e=ne;function s(a,i,f){e.stat(a,function(o,n){f(o,o?!1:t(n,i))})}function u(a,i){return t(e.statSync(a),i)}function t(a,i){return a.isFile()&&l(a,i)}function l(a,i){var f=a.mode,o=a.uid,n=a.gid,r=i.uid!==void 0?i.uid:process.getuid&&process.getuid(),h=i.gid!==void 0?i.gid:process.getgid&&process.getgid(),m=parseInt("100",8),c=parseInt("010",8),d=parseInt("001",8),p=m|c,g=f&d||f&c&&n===h||f&m&&o===r||f&p&&r===0;return g}return ae}var le,ot;function wi(){if(ot)return le;ot=1;var e;process.platform==="win32"||gi.TESTING_WINDOWS?e=vi():e=bi(),le=s,s.sync=u;function s(t,l,a){if(typeof l=="function"&&(a=l,l={}),!a){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,f){s(t,l||{},function(o,n){o?f(o):i(n)})})}e(t,l||{},function(i,f){i&&(i.code==="EACCES"||l&&l.ignoreErrors)&&(i=null,f=!1),a(i,f)})}function u(t,l){try{return e.sync(t,l||{})}catch(a){if(l&&l.ignoreErrors||a.code==="EACCES")return!1;throw a}}return le}var ue,at;function yi(){if(at)return ue;at=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",s=se,u=e?";":":",t=wi(),l=o=>Object.assign(new Error(`not found: ${o}`),{code:"ENOENT"}),a=(o,n)=>{const r=n.colon||u,h=o.match(/\//)||e&&o.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(r)],m=e?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",c=e?m.split(r):[""];return e&&o.indexOf(".")!==-1&&c[0]!==""&&c.unshift(""),{pathEnv:h,pathExt:c,pathExtExe:m}},i=(o,n,r)=>{typeof n=="function"&&(r=n,n={}),n||(n={});const{pathEnv:h,pathExt:m,pathExtExe:c}=a(o,n),d=[],p=y=>new Promise((T,x)=>{if(y===h.length)return n.all&&d.length?T(d):x(l(o));const v=h[y],b=/^".*"$/.test(v)?v.slice(1,-1):v,$=s.join(b,o),w=!b&&/^\.[\\\/]/.test(o)?o.slice(0,2)+$:$;T(g(w,y,0))}),g=(y,T,x)=>new Promise((v,b)=>{if(x===m.length)return v(p(T+1));const $=m[x];t(y+$,{pathExt:c},(w,E)=>{if(!w&&E)if(n.all)d.push(y+$);else return v(y+$);return v(g(y,T,x+1))})});return r?p(0).then(y=>r(null,y),r):p(0)},f=(o,n)=>{n=n||{};const{pathEnv:r,pathExt:h,pathExtExe:m}=a(o,n),c=[];for(let d=0;d<r.length;d++){const p=r[d],g=/^".*"$/.test(p)?p.slice(1,-1):p,y=s.join(g,o),T=!g&&/^\.[\\\/]/.test(o)?o.slice(0,2)+y:y;for(let x=0;x<h.length;x++){const v=T+h[x];try{if(t.sync(v,{pathExt:m}))if(n.all)c.push(v);else return v}catch{}}}if(n.all&&c.length)return c;if(n.nothrow)return null;throw l(o)};return ue=i,i.sync=f,ue}var Z={exports:{}},lt;function Si(){if(lt)return Z.exports;lt=1;const e=(s={})=>{const u=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(u).reverse().find(l=>l.toUpperCase()==="PATH")||"Path"};return Z.exports=e,Z.exports.default=e,Z.exports}var he,ut;function xi(){if(ut)return he;ut=1;const e=se,s=yi(),u=Si();function t(a,i){const f=a.options.env||process.env,o=process.cwd(),n=a.options.cwd!=null,r=n&&process.chdir!==void 0&&!process.chdir.disabled;if(r)try{process.chdir(a.options.cwd)}catch{}let h;try{h=s.sync(a.command,{path:f[u({env:f})],pathExt:i?e.delimiter:void 0})}catch{}finally{r&&process.chdir(o)}return h&&(h=e.resolve(n?a.options.cwd:"",h)),h}function l(a){return t(a)||t(a,!0)}return he=l,he}var X={},ht;function $i(){if(ht)return X;ht=1;const e=/([()\][%!^"`<>&|;, *?])/g;function s(t){return t=t.replace(e,"^$1"),t}function u(t,l){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(e,"^$1"),l&&(t=t.replace(e,"^$1")),t}return X.command=s,X.argument=u,X}var ce,ct;function Ei(){return ct||(ct=1,ce=/^#!(.*)/),ce}var de,dt;function Pi(){if(dt)return de;dt=1;const e=Ei();return de=(s="")=>{const u=s.match(e);if(!u)return null;const[t,l]=u[0].replace(/#! ?/,"").split(" "),a=t.split("/").pop();return a==="env"?l:l?`${a} ${l}`:a},de}var fe,ft;function Ri(){if(ft)return fe;ft=1;const e=ne,s=Pi();function u(t){const a=Buffer.alloc(150);let i;try{i=e.openSync(t,"r"),e.readSync(i,a,0,150,0),e.closeSync(i)}catch{}return s(a.toString())}return fe=u,fe}var pe,pt;function Ti(){if(pt)return pe;pt=1;const e=se,s=xi(),u=$i(),t=Ri(),l=process.platform==="win32",a=/\.(?:com|exe)$/i,i=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function f(r){r.file=s(r);const h=r.file&&t(r.file);return h?(r.args.unshift(r.file),r.command=h,s(r)):r.file}function o(r){if(!l)return r;const h=f(r),m=!a.test(h);if(r.options.forceShell||m){const c=i.test(h);r.command=e.normalize(r.command),r.command=u.command(r.command),r.args=r.args.map(p=>u.argument(p,c));const d=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${d}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function n(r,h,m){h&&!Array.isArray(h)&&(m=h,h=null),h=h?h.slice(0):[],m=Object.assign({},m);const c={command:r,args:h,options:m,file:void 0,original:{command:r,args:h}};return m.shell?c:o(c)}return pe=n,pe}var me,mt;function Oi(){if(mt)return me;mt=1;const e=process.platform==="win32";function s(a,i){return Object.assign(new Error(`${i} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${i} ${a.command}`,path:a.command,spawnargs:a.args})}function u(a,i){if(!e)return;const f=a.emit;a.emit=function(o,n){if(o==="exit"){const r=t(n,i);if(r)return f.call(a,"error",r)}return f.apply(a,arguments)}}function t(a,i){return e&&a===1&&!i.file?s(i.original,"spawn"):null}function l(a,i){return e&&a===1&&!i.file?s(i.original,"spawnSync"):null}return me={hookChildProcess:u,verifyENOENT:t,verifyENOENTSync:l,notFoundError:s},me}var gt;function Ci(){if(gt)return H.exports;gt=1;const e=fi,s=Ti(),u=Oi();function t(a,i,f){const o=s(a,i,f),n=e.spawn(o.command,o.args,o.options);return u.hookChildProcess(n,o),n}function l(a,i,f){const o=s(a,i,f),n=e.spawnSync(o.command,o.args,o.options);return n.error=n.error||u.verifyENOENTSync(n.status,o),n}return H.exports=t,H.exports.spawn=t,H.exports.sync=l,H.exports._parse=s,H.exports._enoent=u,H.exports}var Mi=Ci();const qi=U(Mi);let Y=!0;const G=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let J=0;if(G.process&&G.process.env&&G.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:s,NO_COLOR:u,TERM:t,COLORTERM:l}=G.process.env;s||u||e==="0"?Y=!1:e==="1"||e==="2"||e==="3"?Y=!0:t==="dumb"?Y=!1:"CI"in G.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(a=>a in G.process.env)?Y=!0:Y=process.stdout.isTTY,Y&&(process.platform==="win32"||l&&(l==="truecolor"||l==="24bit")?J=3:t&&(t.endsWith("-256color")||t.endsWith("256"))?J=2:J=1)}let vt={enabled:Y,supportLevel:J};function N(e,s,u=1){const t=`\x1B[${e}m`,l=`\x1B[${s}m`,a=new RegExp(`\\x1b\\[${s}m`,"g");return i=>vt.enabled&&vt.supportLevel>=u?t+(""+i).replace(a,t)+l:""+i}const M=N(0,0),Q=N(31,39),ge=N(32,39),V=N(33,39),j=N(34,39),Ai=N(35,39),bt=N(36,39),Di=N(91,39),Ii=N(92,39),wt=N(94,39);var ve,yt;function _i(){if(yt)return ve;yt=1;function e(t,l){var a=t;l.slice(0,-1).forEach(function(f){a=a[f]||{}});var i=l[l.length-1];return i in a}function s(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function u(t,l){return l==="constructor"&&typeof t[l]=="function"||l==="__proto__"}return ve=function(t,l){l||(l={});var a={bools:{},strings:{},unknownFn:null};typeof l.unknown=="function"&&(a.unknownFn=l.unknown),typeof l.boolean=="boolean"&&l.boolean?a.allBools=!0:[].concat(l.boolean).filter(Boolean).forEach(function(w){a.bools[w]=!0});var i={};function f(w){return i[w].some(function(E){return a.bools[E]})}Object.keys(l.alias||{}).forEach(function(w){i[w]=[].concat(l.alias[w]),i[w].forEach(function(E){i[E]=[w].concat(i[w].filter(function(R){return E!==R}))})}),[].concat(l.string).filter(Boolean).forEach(function(w){a.strings[w]=!0,i[w]&&[].concat(i[w]).forEach(function(E){a.strings[E]=!0})});var o=l.default||{},n={_:[]};function r(w,E){return a.allBools&&/^--[^=]+$/.test(E)||a.strings[w]||a.bools[w]||i[w]}function h(w,E,R){for(var P=w,k=0;k<E.length-1;k++){var q=E[k];if(u(P,q))return;P[q]===void 0&&(P[q]={}),(P[q]===Object.prototype||P[q]===Number.prototype||P[q]===String.prototype)&&(P[q]={}),P[q]===Array.prototype&&(P[q]=[]),P=P[q]}var D=E[E.length-1];u(P,D)||((P===Object.prototype||P===Number.prototype||P===String.prototype)&&(P={}),P===Array.prototype&&(P=[]),P[D]===void 0||a.bools[D]||typeof P[D]=="boolean"?P[D]=R:Array.isArray(P[D])?P[D].push(R):P[D]=[P[D],R])}function m(w,E,R){if(!(R&&a.unknownFn&&!r(w,R)&&a.unknownFn(R)===!1)){var P=!a.strings[w]&&s(E)?Number(E):E;h(n,w.split("."),P),(i[w]||[]).forEach(function(k){h(n,k.split("."),P)})}}Object.keys(a.bools).forEach(function(w){m(w,o[w]===void 0?!1:o[w])});var c=[];t.indexOf("--")!==-1&&(c=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var d=0;d<t.length;d++){var p=t[d],g,y;if(/^--.+=/.test(p)){var T=p.match(/^--([^=]+)=([\s\S]*)$/);g=T[1];var x=T[2];a.bools[g]&&(x=x!=="false"),m(g,x,p)}else if(/^--no-.+/.test(p))g=p.match(/^--no-(.+)/)[1],m(g,!1,p);else if(/^--.+/.test(p))g=p.match(/^--(.+)/)[1],y=t[d+1],y!==void 0&&!/^(-|--)[^-]/.test(y)&&!a.bools[g]&&!a.allBools&&(!i[g]||!f(g))?(m(g,y,p),d+=1):/^(true|false)$/.test(y)?(m(g,y==="true",p),d+=1):m(g,a.strings[g]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var v=p.slice(1,-1).split(""),b=!1,$=0;$<v.length;$++){if(y=p.slice($+2),y==="-"){m(v[$],y,p);continue}if(/[A-Za-z]/.test(v[$])&&y[0]==="="){m(v[$],y.slice(1),p),b=!0;break}if(/[A-Za-z]/.test(v[$])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(y)){m(v[$],y,p),b=!0;break}if(v[$+1]&&v[$+1].match(/\W/)){m(v[$],p.slice($+2),p),b=!0;break}else m(v[$],a.strings[v[$]]?"":!0,p)}g=p.slice(-1)[0],!b&&g!=="-"&&(t[d+1]&&!/^(-|--)[^-]/.test(t[d+1])&&!a.bools[g]&&(!i[g]||!f(g))?(m(g,t[d+1],p),d+=1):t[d+1]&&/^(true|false)$/.test(t[d+1])?(m(g,t[d+1]==="true",p),d+=1):m(g,a.strings[g]?"":!0,p))}else if((!a.unknownFn||a.unknownFn(p)!==!1)&&n._.push(a.strings._||!s(p)?p:Number(p)),l.stopEarly){n._.push.apply(n._,t.slice(d+1));break}}return Object.keys(o).forEach(function(w){e(n,w.split("."))||(h(n,w.split("."),o[w]),(i[w]||[]).forEach(function(E){h(n,E.split("."),o[w])}))}),l["--"]?n["--"]=c.slice():c.forEach(function(w){n._.push(w)}),n},ve}var Ni=_i();const ji=U(Ni);var be={},we,St;function I(){if(St)return we;St=1;const{FORCE_COLOR:e,NODE_DISABLE_COLORS:s,TERM:u}=process.env,t={enabled:!s&&u!=="dumb"&&e!=="0",reset:i(0,0),bold:i(1,22),dim:i(2,22),italic:i(3,23),underline:i(4,24),inverse:i(7,27),hidden:i(8,28),strikethrough:i(9,29),black:i(30,39),red:i(31,39),green:i(32,39),yellow:i(33,39),blue:i(34,39),magenta:i(35,39),cyan:i(36,39),white:i(37,39),gray:i(90,39),grey:i(90,39),bgBlack:i(40,49),bgRed:i(41,49),bgGreen:i(42,49),bgYellow:i(43,49),bgBlue:i(44,49),bgMagenta:i(45,49),bgCyan:i(46,49),bgWhite:i(47,49)};function l(f,o){let n=0,r,h="",m="";for(;n<f.length;n++)r=f[n],h+=r.open,m+=r.close,o.includes(r.close)&&(o=o.replace(r.rgx,r.close+r.open));return h+o+m}function a(f,o){let n={has:f,keys:o};return n.reset=t.reset.bind(n),n.bold=t.bold.bind(n),n.dim=t.dim.bind(n),n.italic=t.italic.bind(n),n.underline=t.underline.bind(n),n.inverse=t.inverse.bind(n),n.hidden=t.hidden.bind(n),n.strikethrough=t.strikethrough.bind(n),n.black=t.black.bind(n),n.red=t.red.bind(n),n.green=t.green.bind(n),n.yellow=t.yellow.bind(n),n.blue=t.blue.bind(n),n.magenta=t.magenta.bind(n),n.cyan=t.cyan.bind(n),n.white=t.white.bind(n),n.gray=t.gray.bind(n),n.grey=t.grey.bind(n),n.bgBlack=t.bgBlack.bind(n),n.bgRed=t.bgRed.bind(n),n.bgGreen=t.bgGreen.bind(n),n.bgYellow=t.bgYellow.bind(n),n.bgBlue=t.bgBlue.bind(n),n.bgMagenta=t.bgMagenta.bind(n),n.bgCyan=t.bgCyan.bind(n),n.bgWhite=t.bgWhite.bind(n),n}function i(f,o){let n={open:`\x1B[${f}m`,close:`\x1B[${o}m`,rgx:new RegExp(`\\x1b\\[${o}m`,"g")};return function(r){return this!==void 0&&this.has!==void 0?(this.has.includes(f)||(this.has.push(f),this.keys.push(n)),r===void 0?this:t.enabled?l(this.keys,r+""):r+""):r===void 0?a([f],[n]):t.enabled?l([n],r+""):r+""}}return we=t,we}var ye,xt;function Fi(){return xt||(xt=1,ye=(e,s)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl){if(e.name==="a")return"first";if(e.name==="c"||e.name==="d")return"abort";if(e.name==="e")return"last";if(e.name==="g")return"reset"}if(s){if(e.name==="j")return"down";if(e.name==="k")return"up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":!1}}),ye}var Se,$t;function xe(){return $t||($t=1,Se=e=>{const s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),u=new RegExp(s,"g");return typeof e=="string"?e.replace(u,""):e}),Se}var $e,Et;function _(){if(Et)return $e;Et=1;const e="\x1B",s=`${e}[`,u="\x07",t={to(i,f){return f?`${s}${f+1};${i+1}H`:`${s}${i+1}G`},move(i,f){let o="";return i<0?o+=`${s}${-i}D`:i>0&&(o+=`${s}${i}C`),f<0?o+=`${s}${-f}A`:f>0&&(o+=`${s}${f}B`),o},up:(i=1)=>`${s}${i}A`,down:(i=1)=>`${s}${i}B`,forward:(i=1)=>`${s}${i}C`,backward:(i=1)=>`${s}${i}D`,nextLine:(i=1)=>`${s}E`.repeat(i),prevLine:(i=1)=>`${s}F`.repeat(i),left:`${s}G`,hide:`${s}?25l`,show:`${s}?25h`,save:`${e}7`,restore:`${e}8`},l={up:(i=1)=>`${s}S`.repeat(i),down:(i=1)=>`${s}T`.repeat(i)},a={screen:`${s}2J`,up:(i=1)=>`${s}1J`.repeat(i),down:(i=1)=>`${s}J`.repeat(i),line:`${s}2K`,lineEnd:`${s}K`,lineStart:`${s}1K`,lines(i){let f="";for(let o=0;o<i;o++)f+=this.line+(o<i-1?t.up():"");return i&&(f+=t.left),f}};return $e={cursor:t,scroll:l,erase:a,beep:u},$e}var Ee,Pt;function Wi(){if(Pt)return Ee;Pt=1;const e=xe(),{erase:s,cursor:u}=_(),t=l=>[...e(l)].length;return Ee=function(l,a){if(!a)return s.line+u.to(0);let i=0;const f=l.split(/\r?\n/);for(let o of f)i+=1+Math.floor(Math.max(t(o)-1,0)/a);return s.lines(i)},Ee}var Pe,Rt;function Tt(){if(Rt)return Pe;Rt=1;const e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},s={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Pe=process.platform==="win32"?s:e,Pe}var Re,Ot;function ki(){if(Ot)return Re;Ot=1;const e=I(),s=Tt(),u=Object.freeze({password:{scale:1,render:o=>"*".repeat(o.length)},emoji:{scale:2,render:o=>"\u{1F603}".repeat(o.length)},invisible:{scale:0,render:o=>""},default:{scale:1,render:o=>`${o}`}}),t=o=>u[o]||u.default,l=Object.freeze({aborted:e.red(s.cross),done:e.green(s.tick),exited:e.yellow(s.cross),default:e.cyan("?")});return Re={styles:u,render:t,symbols:l,symbol:(o,n,r)=>n?l.aborted:r?l.exited:o?l.done:l.default,delimiter:o=>e.gray(o?s.ellipsis:s.pointerSmall),item:(o,n)=>e.gray(o?n?s.pointerSmall:"+":s.line)},Re}var Te,Ct;function Vi(){if(Ct)return Te;Ct=1;const e=xe();return Te=function(s,u){let t=String(e(s)||"").split(/\r?\n/);return u?t.map(l=>Math.ceil(l.length/u)).reduce((l,a)=>l+a):t.length},Te}var Oe,Mt;function Li(){return Mt||(Mt=1,Oe=(e,s={})=>{const u=Number.isSafeInteger(parseInt(s.margin))?new Array(parseInt(s.margin)).fill(" ").join(""):s.margin||"",t=s.width;return(e||"").split(/\r?\n/g).map(l=>l.split(/\s+/g).reduce((a,i)=>(i.length+u.length>=t||a[a.length-1].length+i.length+1<t?a[a.length-1]+=` ${i}`:a.push(`${u}${i}`),a),[u]).join(` `)).join(` `)}),Oe}var Ce,qt;function Hi(){return qt||(qt=1,Ce=(e,s,u)=>{u=u||s;let t=Math.min(s-u,e-Math.floor(u/2));t<0&&(t=0);let l=Math.min(t+u,s);return{startIndex:t,endIndex:l}}),Ce}var Me,At;function F(){return At||(At=1,Me={action:Fi(),clear:Wi(),style:ki(),strip:xe(),figures:Tt(),lines:Vi(),wrap:Li(),entriesToDisplay:Hi()}),Me}var qe,Dt;function L(){if(Dt)return qe;Dt=1;const e=pi,{action:s}=F(),u=mi,{beep:t,cursor:l}=_(),a=I();class i extends u{constructor(o={}){super(),this.firstRender=!0,this.in=o.stdin||process.stdin,this.out=o.stdout||process.stdout,this.onRender=(o.onRender||(()=>{})).bind(this);const n=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);const r=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,h=(m,c)=>{let d=s(c,r);d===!1?this._&&this._(m,c):typeof this[d]=="function"?this[d](c):this.bell()};this.close=()=>{this.out.write(l.show),this.in.removeListener("keypress",h),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",h)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(t)}render(){this.onRender(a),this.firstRender&&(this.firstRender=!1)}}return qe=i,qe}var Ae,It;function Yi(){if(It)return Ae;It=1;const e=I(),s=L(),{erase:u,cursor:t}=_(),{style:l,clear:a,lines:i,figures:f}=F();class o extends s{constructor(r={}){super(r),this.transform=l.render(r.style),this.scale=this.transform.scale,this.msg=r.message,this.initial=r.initial||"",this.validator=r.validate||(()=>!0),this.value="",this.errorMsg=r.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=a("",this.out.columns),this.render()}set value(r){!r&&this.initial?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(r)),this._value=r,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(` `),this.close()}async validate(){let r=await this.validator(this.value);typeof r=="string"&&(this.errorMsg=r,r=!1),this.error=!r}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(r){this.placeholder||(this.cursor=this.cursor+r,this.cursorOffset+=r)}_(r,h){let m=this.value.slice(0,this.cursor),c=this.value.slice(this.cursor);this.value=`${m}${r}${c}`,this.red=!1,this.cursor=this.placeholder?0:m.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let r=this.value.slice(0,this.cursor-1),h=this.value.slice(this.cursor);this.value=`${r}${h}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let r=this.value.slice(0,this.cursor),h=this.value.slice(this.cursor+1);this.value=`${r}${h}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(t.down(i(this.outputError,this.out.columns)-1)+a(this.outputError,this.out.columns)),this.out.write(a(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[l.symbol(this.done,this.aborted),e.bold(this.msg),l.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(` `).reduce((r,h,m)=>r+` ${m?" ":f.pointerSmall} ${e.red().italic(h)}`,"")),this.out.write(u.line+t.to(0)+this.outputText+t.save+this.outputError+t.restore+t.move(this.cursorOffset,0)))}}return Ae=o,Ae}var De,_t;function Bi(){if(_t)return De;_t=1;const e=I(),s=L(),{style:u,clear:t,figures:l,wrap:a,entriesToDisplay:i}=F(),{cursor:f}=_();class o extends s{constructor(r={}){super(r),this.msg=r.message,this.hint=r.hint||"- Use arrow-keys. Return to submit.",this.warn=r.warn||"- This option is disabled",this.cursor=r.initial||0,this.choices=r.choices.map((h,m)=>(typeof h=="string"&&(h={title:h,value:m}),{title:h&&(h.title||h.value||h),value:h&&(h.value===void 0?m:h.value),description:h&&h.description,selected:h&&h.selected,disabled:h&&h.disabled})),this.optionsPerPage=r.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=t("",this.out.columns),this.render()}moveCursor(r){this.cursor=r,this.value=this.choices[r].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(r,h){if(r===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(f.hide):this.out.write(t(this.outputText,this.out.columns)),super.render();let{startIndex:r,endIndex:h}=i(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(!1),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=` `;for(let m=r;m<h;m++){let c,d,p="",g=this.choices[m];m===r&&r>0?d=l.arrowUp:m===h-1&&h<this.choices.length?d=l.arrowDown:d=" ",g.disabled?(c=this.cursor===m?e.gray().underline(g.title):e.strikethrough().gray(g.title),d=(this.cursor===m?e.bold().gray(l.pointer)+" ":" ")+d):(c=this.cursor===m?e.cyan().underline(g.title):g.title,d=(this.cursor===m?e.cyan(l.pointer)+" ":" ")+d,g.description&&this.cursor===m&&(p=` - ${g.description}`,(d.length+c.length+p.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(p=` `+a(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${d} ${c}${e.gray(p)} `}}this.out.write(this.outputText)}}return De=o,De}var Ie,Nt;function Gi(){if(Nt)return Ie;Nt=1;const e=I(),s=L(),{style:u,clear:t}=F(),{cursor:l,erase:a}=_();class i extends s{constructor(o={}){super(o),this.msg=o.message,this.value=!!o.initial,this.active=o.active||"on",this.inactive=o.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(o,n){if(o===" ")this.value=!this.value;else if(o==="1")this.value=!0;else if(o==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(a.line+l.to(0)+this.outputText))}}return Ie=i,Ie}var _e,jt;function W(){if(jt)return _e;jt=1;class e{constructor({token:u,date:t,parts:l,locales:a}){this.token=u,this.date=t||new Date,this.parts=l||[this],this.locales=a||{}}up(){}down(){}next(){const u=this.parts.indexOf(this);return this.parts.find((t,l)=>l>u&&t instanceof e)}setTo(u){}prev(){let u=[].concat(this.parts).reverse();const t=u.indexOf(this);return u.find((l,a)=>a>t&&l instanceof e)}toString(){return String(this.date)}}return _e=e,_e}var Ne,Ft;function zi(){if(Ft)return Ne;Ft=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}}return Ne=s,Ne}var je,Wt;function Ji(){if(Wt)return je;Wt=1;const e=W(),s=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th");class u extends e{constructor(l={}){super(l)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(l){this.date.setDate(parseInt(l.substr(-2)))}toString(){let l=this.date.getDate(),a=this.date.getDay();return this.token==="DD"?String(l).padStart(2,"0"):this.token==="Do"?l+s(l):this.token==="d"?a+1:this.token==="ddd"?this.locales.weekdaysShort[a]:this.token==="dddd"?this.locales.weekdays[a]:l}}return je=u,je}var Fe,kt;function Ki(){if(kt)return Fe;kt=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}}return Fe=s,Fe}var We,Vt;function Ui(){if(Vt)return We;Vt=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return We=s,We}var ke,Lt;function Zi(){if(Lt)return ke;Lt=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}}return ke=s,ke}var Ve,Ht;function Xi(){if(Ht)return Ve;Ht=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),l=this.token.length;return l===2?String(t+1).padStart(2,"0"):l===3?this.locales.monthsShort[t]:l===4?this.locales.months[t]:String(t+1)}}return Ve=s,Ve}var Le,Yt;function Qi(){if(Yt)return Le;Yt=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}}return Le=s,Le}var He,Bt;function er(){if(Bt)return He;Bt=1;const e=W();class s extends e{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}}return He=s,He}var Ye,Gt;function tr(){return Gt||(Gt=1,Ye={DatePart:W(),Meridiem:zi(),Day:Ji(),Hours:Ki(),Milliseconds:Ui(),Minutes:Zi(),Month:Xi(),Seconds:Qi(),Year:er()}),Ye}var Be,zt;function ir(){if(zt)return Be;zt=1;const e=I(),s=L(),{style:u,clear:t,figures:l}=F(),{erase:a,cursor:i}=_(),{DatePart:f,Meridiem:o,Day:n,Hours:r,Milliseconds:h,Minutes:m,Month:c,Seconds:d,Year:p}=tr(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,y={1:({token:v})=>v.replace(/\\(.)/g,"$1"),2:v=>new n(v),3:v=>new c(v),4:v=>new p(v),5:v=>new o(v),6:v=>new r(v),7:v=>new m(v),8:v=>new d(v),9:v=>new h(v)},T={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class x extends s{constructor(b={}){super(b),this.msg=b.message,this.cursor=0,this.typed="",this.locales=Object.assign(T,b.locales),this._date=b.initial||new Date,this.errorMsg=b.error||"Please Enter A Valid Value",this.validator=b.validate||(()=>!0),this.mask=b.mask||"YYYY-MM-DD HH:mm:ss",this.clear=t("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(b){b&&this._date.setTime(b.getTime())}set mask(b){let $;for(this.parts=[];$=g.exec(b);){let E=$.shift(),R=$.findIndex(P=>P!=null);this.parts.push(R in y?y[R]({token:$[R]||E,date:this.date,parts:this.parts,locales:this.locales}):$[R]||E)}let w=this.parts.reduce((E,R)=>(typeof R=="string"&&typeof E[E.length-1]=="string"?E[E.length-1]+=R:E.push(R),E),[]);this.parts.splice(0),this.parts.push(...w),this.reset()}moveCursor(b){this.typed="",this.cursor=b,this.fire()}reset(){this.moveCursor(this.parts.findIndex(b=>b instanceof f)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` `),this.close()}async validate(){let b=await this.validator(this.value);typeof b=="string"&&(this.errorMsg=b,b=!1),this.error=!b}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let b=this.parts[this.cursor].prev();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render()}right(){let b=this.parts[this.cursor].next();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render()}next(){let b=this.parts[this.cursor].next();this.moveCursor(b?this.parts.indexOf(b):this.parts.findIndex($=>$ instanceof f)),this.render()}_(b){/\d/.test(b)&&(this.typed+=b,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(!1),this.parts.reduce((b,$,w)=>b.concat(w===this.cursor&&!this.done?e.cyan().underline($.toString()):$),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(` `).reduce((b,$,w)=>b+` ${w?" ":l.pointerSmall} ${e.red().italic($)}`,"")),this.out.write(a.line+i.to(0)+this.outputText))}}return Be=x,Be}var Ge,Jt;function rr(){if(Jt)return Ge;Jt=1;const e=I(),s=L(),{cursor:u,erase:t}=_(),{style:l,figures:a,clear:i,lines:f}=F(),o=/[0-9]/,n=m=>m!==void 0,r=(m,c)=>{let d=Math.pow(10,c);return Math.round(m*d)/d};class h extends s{constructor(c={}){super(c),this.transform=l.render(c.style),this.msg=c.message,this.initial=n(c.initial)?c.initial:"",this.float=!!c.float,this.round=c.round||2,this.inc=c.increment||1,this.min=n(c.min)?c.min:-1/0,this.max=n(c.max)?c.max:1/0,this.errorMsg=c.error||"Please Enter A Valid Value",this.validator=c.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(c){!c&&c!==0?(this.placeholder=!0,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${r(c,this.round)}`),this._value=r(c,this.round)),this.fire()}get value(){return this._value}parse(c){return this.float?parseFloat(c):parseInt(c)}valid(c){return c==="-"||c==="."&&this.float||o.test(c)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let c=this.value;this.value=c!==""?c:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(` `),this.close()}async validate(){let c=await this.validator(this.value);typeof c=="string"&&(this.errorMsg=c,c=!1),this.error=!c}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let c=this.value;this.value=c!==""?c:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(` `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let c=this.value.toString();if(c.length===0)return this.bell();this.value=this.parse(c=c.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(c,d){if(!this.valid(c))return this.bell();const p=Date.now();if(p-this.lastHit>1e3&&(this.typed=""),this.typed+=c,this.lastHit=p,this.color="cyan",c===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(u.down(f(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[l.symbol(this.done,this.aborted),e.bold(this.msg),l.delimiter(this.done),!this.done||!this.done&&!this.placeholder?e[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(` `).reduce((c,d,p)=>c+` ${p?" ":a.pointerSmall} ${e.red().italic(d)}`,"")),this.out.write(t.line+u.to(0)+this.outputText+u.save+this.outputError+u.restore))}}return Ge=h,Ge}var ze,Kt;function Ut(){if(Kt)return ze;Kt=1;const e=I(),{cursor:s}=_(),u=L(),{clear:t,figures:l,style:a,wrap:i,entriesToDisplay:f}=F();class o extends u{constructor(r={}){super(r),this.msg=r.message,this.cursor=r.cursor||0,this.scrollIndex=r.cursor||0,this.hint=r.hint||"",this.warn=r.warn||"- This option is disabled -",this.minSelected=r.min,this.showMinError=!1,this.maxChoices=r.max,this.instructions=r.instructions,this.optionsPerPage=r.optionsPerPage||10,this.value=r.choices.map((h,m)=>(typeof h=="string"&&(h={title:h,value:m}),{title:h&&(h.title||h.value||h),description:h&&h.description,value:h&&(h.value===void 0?m:h.value),selected:h&&h.selected,disabled:h&&h.disabled})),this.clear=t("",this.out.columns),r.overrideRender||this.render()}reset(){this.value.map(r=>!r.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(r=>r.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){const r=this.value.filter(h=>h.selected);this.minSelected&&r.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const r=this.value[this.cursor];if(r.selected)r.selected=!1,this.render();else{if(r.disabled||this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();r.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const r=!this.value[this.cursor].selected;this.value.filter(h=>!h.disabled).forEach(h=>h.selected=r),this.render()}_(r,h){if(r===" ")this.handleSpaceToggle();else if(r==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` Instructions: ${l.arrowUp}/${l.arrowDown}: Highlight option ${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection `+(this.maxChoices===void 0?` a: Toggle all `:"")+" enter/return: Complete answer":""}renderOption(r,h,m,c){const d=(h.selected?e.green(l.radioOn):l.radioOff)+" "+c+" ";let p,g;return h.disabled?p=r===m?e.gray().underline(h.title):e.strikethrough().gray(h.title):(p=r===m?e.cyan().underline(h.title):h.title,r===m&&h.description&&(g=` - ${h.description}`,(d.length+p.length+g.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(g=` `+i(h.description,{margin:d.length,width:this.out.columns})))),d+p+e.gray(g||"")}paginateOptions(r){if(r.length===0)return e.red("No matches for this query.");let{startIndex:h,endIndex:m}=f(this.cursor,r.length,this.optionsPerPage),c,d=[];for(let p=h;p<m;p++)p===h&&h>0?c=l.arrowUp:p===m-1&&m<r.length?c=l.arrowDown:c=" ",d.push(this.renderOption(this.cursor,r[p],p,c));return` `+d.join(` `)}renderOptions(r){return this.done?"":this.paginateOptions(r)}renderDoneOrInstructions(){if(this.done)return this.value.filter(h=>h.selected).map(h=>h.title).join(", ");const r=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&r.push(e.yellow(this.warn)),r.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(s.hide),super.render();let r=[a.symbol(this.done,this.aborted),e.bold(this.msg),a.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(r+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),r+=this.renderOptions(this.value),this.out.write(this.clear+r),this.clear=t(r,this.out.columns)}}return ze=o,ze}var Je,Zt;function sr(){if(Zt)return Je;Zt=1;const e=I(),s=L(),{erase:u,cursor:t}=_(),{style:l,clear:a,figures:i,wrap:f,entriesToDisplay:o}=F(),n=(c,d)=>c[d]&&(c[d].value||c[d].title||c[d]),r=(c,d)=>c[d]&&(c[d].title||c[d].value||c[d]),h=(c,d)=>{const p=c.findIndex(g=>g.value===d||g.title===d);return p>-1?p:void 0};class m extends s{constructor(d={}){super(d),this.msg=d.message,this.suggest=d.suggest,this.choices=d.choices,this.initial=typeof d.initial=="number"?d.initial:h(d.choices,d.initial),this.select=this.initial||d.cursor||0,this.i18n={noMatches:d.noMatches||"no matches found"},this.fallback=d.fallback||this.initial,this.clearFirst=d.clearFirst||!1,this.suggestions=[],this.input="",this.limit=d.limit||10,this.cursor=0,this.transform=l.render(d.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=a("",this.out.columns),this.complete(this.render),this.render()}set fallback(d){this._fb=Number.isSafeInteger(parseInt(d))?parseInt(d):d}get fallback(){let d;return typeof this._fb=="number"?d=this.choices[this._fb]:typeof this._fb=="string"&&(d={title:this._fb}),d||this._fb||{title:this.i18n.noMatches}}moveSelect(d){this.select=d,this.suggestions.length>0?this.value=n(this.suggestions,d):this.value=this.fallback.value,this.fire()}async complete(d){const p=this.completing=this.suggest(this.input,this.choices),g=await p;if(this.completing!==p)return;this.suggestions=g.map((T,x,v)=>({title:r(v,x),value:n(v,x),description:T.description})),this.completing=!1;const y=Math.max(g.length-1,0);this.moveSelect(Math.min(y,this.select)),d&&d()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(` `),this.close()}_(d,p){let g=this.input.slice(0,this.cursor),y=this.input.slice(this.cursor);this.input=`${g}${d}${y}`,this.cursor=g.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let d=this.input.slice(0,this.cursor-1),p=this.input.slice(this.cursor);this.input=`${d}${p}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let d=this.input.slice(0,this.cursor),p=this.input.slice(this.cursor+1);this.input=`${d}${p}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(d,p,g,y){let T,x=g?i.arrowUp:y?i.arrowDown:" ",v=p?e.cyan().underline(d.title):d.title;return x=(p?e.cyan(i.pointer)+" ":" ")+x,d.description&&(T=` - ${d.description}`,(x.length+v.length+T.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&(T=` `+f(d.description,{margin:3,width:this.out.columns}))),x+" "+v+e.gray(T||"")}render(){if(this.closed)return;this.firstRender?this.out.write(t.hide):this.out.write(a(this.outputText,this.out.columns)),super.render();let{startIndex:d,endIndex:p}=o(this.select,this.choices.length,this.limit);if(this.outputText=[l.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),l.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const g=this.suggestions.slice(d,p).map((y,T)=>this.renderOption(y,this.select===T+d,T===0&&d>0,T+d===p-1&&p<this.choices.length)).join(` `);this.outputText+=` `+(g||e.gray(this.fallback.title))}this.out.write(u.line+t.to(0)+this.outputText)}}return Je=m,Je}var Ke,Xt;function nr(){if(Xt)return Ke;Xt=1;const e=I(),{cursor:s}=_(),u=Ut(),{clear:t,style:l,figures:a}=F();class i extends u{constructor(o={}){o.overrideRender=!0,super(o),this.inputValue="",this.clear=t("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(o=>o.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const o=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(r=>this.inputValue?!!(typeof r.title=="string"&&r.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof r.value=="string"&&r.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const n=this.filteredOptions.findIndex(r=>r===o);this.cursor=n<0?0:n,this.render()}handleSpaceToggle(){const o=this.filteredOptions[this.cursor];if(o.selected)o.selected=!1,this.render();else{if(o.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();o.selected=!0,this.render()}}handleInputChange(o){this.inputValue=this.inputValue+o,this.updateFilteredOptions()}_(o,n){o===" "?this.handleSpaceToggle():this.handleInputChange(o)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:` Instructions: ${a.arrowUp}/${a.arrowDown}: Highlight option ${a.arrowLeft}/${a.arrowRight}/[space]: Toggle selection [a,b,c]/delete: Filter choices enter/return: Complete answer `:""}renderCurrentInput(){return` Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")} `}renderOption(o,n,r){let h;return n.disabled?h=o===r?e.gray().underline(n.title):e.strikethrough().gray(n.title):h=o===r?e.cyan().underline(n.title):n.title,(n.selected?e.green(a.radioOn):a.radioOff)+" "+h}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");const o=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&o.push(e.yellow(this.warn)),o.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(s.hide),super.render();let o=[l.symbol(this.done,this.aborted),e.bold(this.msg),l.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(o+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),o+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+o),this.clear=t(o,this.out.columns)}}return Ke=i,Ke}var Ue,Qt;function or(){if(Qt)return Ue;Qt=1;const e=I(),s=L(),{style:u,clear:t}=F(),{erase:l,cursor:a}=_();class i extends s{constructor(o={}){super(o),this.msg=o.message,this.value=o.initial,this.initialValue=!!o.initial,this.yesMsg=o.yes||"yes",this.yesOption=o.yesOption||"(Y/n)",this.noMsg=o.no||"no",this.noOption=o.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(` `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(` `),this.close()}_(o,n){return o.toLowerCase()==="y"?(this.value=!0,this.submit()):o.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(a.hide):this.out.write(t(this.outputText,this.out.columns)),super.render(),this.outputText=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(l.line+a.to(0)+this.outputText))}}return Ue=i,Ue}var Ze,ei;function ar(){return ei||(ei=1,Ze={TextPrompt:Yi(),SelectPrompt:Bi(),TogglePrompt:Gi(),DatePrompt:ir(),NumberPrompt:rr(),MultiselectPrompt:Ut(),AutocompletePrompt:sr(),AutocompleteMultiselectPrompt:nr(),ConfirmPrompt:or()}),Ze}var ti;function lr(){return ti||(ti=1,function(e){const s=e,u=ar(),t=i=>i;function l(i,f,o={}){return new Promise((n,r)=>{const h=new u[i](f),m=o.onAbort||t,c=o.onSubmit||t,d=o.onExit||t;h.on("state",f.onState||t),h.on("submit",p=>n(c(p))),h.on("exit",p=>n(d(p))),h.on("abort",p=>r(m(p)))})}s.text=i=>l("TextPrompt",i),s.password=i=>(i.style="password",s.text(i)),s.invisible=i=>(i.style="invisible",s.text(i)),s.number=i=>l("NumberPrompt",i),s.date=i=>l("DatePrompt",i),s.confirm=i=>l("ConfirmPrompt",i),s.list=i=>{const f=i.separator||",";return l("TextPrompt",i,{onSubmit:o=>o.split(f).map(n=>n.trim())})},s.toggle=i=>l("TogglePrompt",i),s.select=i=>l("SelectPrompt",i),s.multiselect=i=>{i.choices=[]