shadcn 4.0.7 → 4.0.8

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.
@@ -0,0 +1,119 @@
1
+ import {va,ba,f,da}from'./chunk-2QWB2ZQC.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {ListToolsRequestSchema,CallToolRequestSchema}from'@modelcontextprotocol/sdk/types.js';import P from'dedent';import {z}from'zod';import {zodToJsonSchema}from'zod-to-json-schema';import I,{join,normalize,delimiter,resolve,dirname}from'path';import R,{cwd}from'process';import Wr from'readline';import es from'events';import Qe from'fs/promises';import {createRequire}from'module';import {spawn}from'child_process';import {PassThrough}from'stream';import Kt from'fs';import ts from'os';import rs from'tty';var K=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],X={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","pnpm-workspace.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"},Z={"node_modules/.deno/":"deno","node_modules/.pnpm/":"pnpm","node_modules/.yarn-state.yml":"yarn","node_modules/.yarn_integrity":"yarn","node_modules/.package-lock.json":"npm",".pnp.cjs":"yarn",".pnp.js":"yarn","bun.lock":"bun","bun.lockb":"bun"},Xe={bun:"https://bun.sh",deno:"https://deno.com",pnpm:"https://pnpm.io/installation","pnpm@6":"https://pnpm.io/6.x/installation",yarn:"https://classic.yarnpkg.com/en/docs/install","yarn@berry":"https://yarnpkg.com/getting-started/install",npm:"https://docs.npmjs.com/cli/configuring-npm/install"};async function Q(e,t){try{let o=await Qe.stat(e);return t==="file"?o.isFile():o.isDirectory()}catch{return false}}function*ar(e=R.cwd()){let t=I.resolve(e),{root:o}=I.parse(t);for(;t&&t!==o;)yield t,t=I.dirname(t);}async function Ze(e,t){return !e||!Q(e,"file")?null:await ur(e,t)}async function ee(e={}){let{cwd:t,strategies:o=["lockfile","packageManager-field","devEngines-field"],onUnknown:r}=e,u;if(typeof e.stopDir=="string"){let c=I.resolve(e.stopDir);u=l=>l===c;}else u=e.stopDir;for(let c of ar(t)){for(let l of o)switch(l){case "lockfile":{for(let a of Object.keys(X))if(await Q(I.join(c,a),"file")){let s=X[a],h=await Ze(I.join(c,"package.json"),r);return h||{name:s,agent:s}}break}case "packageManager-field":case "devEngines-field":{let a=await Ze(I.join(c,"package.json"),r);if(a)return a;break}case "install-metadata":{for(let a of Object.keys(Z)){let s=a.endsWith("/")?"dir":"file";if(await Q(I.join(c,a),s)){let h=Z[a],i=h==="yarn"?cr(a)?"yarn":"yarn@berry":h;return {name:h,agent:i}}}break}}if(u?.(c))break}return null}function lr(e){let t=o=>o?.match(/\d+(\.\d+){0,2}/)?.[0]??o;if(typeof e.packageManager=="string"){let[o,r]=e.packageManager.replace(/^\^/,"").split("@");return {name:o,ver:t(r)}}if(typeof e.devEngines?.packageManager?.name=="string")return {name:e.devEngines.packageManager.name,ver:t(e.devEngines.packageManager.version)}}async function ur(e,t){try{let o=JSON.parse(await Qe.readFile(e,"utf8")),r,u=lr(o);if(u){let c=u.name,l=u.ver,a=l;return c==="yarn"&&l&&Number.parseInt(l)>1?(r="yarn@berry",a="berry",{name:c,agent:r,version:a}):c==="pnpm"&&l&&Number.parseInt(l)<7?(r="pnpm@6",{name:c,agent:r,version:a}):K.includes(c)?(r=c,{name:c,agent:r,version:a}):t?.(o.packageManager)??null}}catch{}return null}function cr(e){return e.endsWith(".yarn_integrity")}var H=createRequire(import.meta.url),dr=Object.create,st=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,pr=Object.getOwnPropertyNames,mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty,q=(e=>typeof H<"u"?H:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof H<"u"?H:t)[o]}):e)(function(e){if(typeof H<"u")return H.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),O=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yr=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of pr(t))!gr.call(e,u)&&u!==o&&st(e,u,{get:()=>t[u],enumerable:!(r=fr(t,u))||r.enumerable});return e},vr=(e,t,o)=>(o=e!=null?dr(mr(e)):{},yr(st(o,"default",{value:e,enumerable:true}),e)),br=O((e,t)=>{t.exports=c,c.sync=l;var o=q("fs");function r(a,s){var h=s.pathExt!==void 0?s.pathExt:process.env.PATHEXT;if(!h||(h=h.split(";"),h.indexOf("")!==-1))return true;for(var i=0;i<h.length;i++){var n=h[i].toLowerCase();if(n&&a.substr(-n.length).toLowerCase()===n)return true}return false}function u(a,s,h){return !a.isSymbolicLink()&&!a.isFile()?false:r(s,h)}function c(a,s,h){o.stat(a,function(i,n){h(i,i?false:u(n,a,s));});}function l(a,s){return u(o.statSync(a),a,s)}}),wr=O((e,t)=>{t.exports=r,r.sync=u;var o=q("fs");function r(a,s,h){o.stat(a,function(i,n){h(i,i?false:c(n,s));});}function u(a,s){return c(o.statSync(a),s)}function c(a,s){return a.isFile()&&l(a,s)}function l(a,s){var h=a.mode,i=a.uid,n=a.gid,f=s.uid!==void 0?s.uid:process.getuid&&process.getuid(),d=s.gid!==void 0?s.gid:process.getgid&&process.getgid(),p=parseInt("100",8),g=parseInt("010",8),m=parseInt("001",8),b=p|g,x=h&m||h&g&&n===d||h&p&&i===f||h&b&&f===0;return x}}),xr=O((e,t)=>{q("fs");var r;process.platform==="win32"||global.TESTING_WINDOWS?r=br():r=wr(),t.exports=u,u.sync=c;function u(l,a,s){if(typeof a=="function"&&(s=a,a={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(h,i){u(l,a||{},function(n,f){n?i(n):h(f);});})}r(l,a||{},function(h,i){h&&(h.code==="EACCES"||a&&a.ignoreErrors)&&(h=null,i=false),s(h,i);});}function c(l,a){try{return r.sync(l,a||{})}catch(s){if(a&&a.ignoreErrors||s.code==="EACCES")return false;throw s}}}),_r=O((e,t)=>{var o=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",r=q("path"),u=o?";":":",c=xr(),l=i=>Object.assign(new Error(`not found: ${i}`),{code:"ENOENT"}),a=(i,n)=>{let f=n.colon||u,d=i.match(/\//)||o&&i.match(/\\/)?[""]:[...o?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(f)],p=o?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=o?p.split(f):[""];return o&&i.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:p}},s=(i,n,f)=>{typeof n=="function"&&(f=n,n={}),n||(n={});let{pathEnv:d,pathExt:p,pathExtExe:g}=a(i,n),m=[],b=w=>new Promise((y,v)=>{if(w===d.length)return n.all&&m.length?y(m):v(l(i));let E=d[w],$=/^".*"$/.test(E)?E.slice(1,-1):E,S=r.join($,i),T=!$&&/^\.[\\\/]/.test(i)?i.slice(0,2)+S:S;y(x(T,w,0));}),x=(w,y,v)=>new Promise((E,$)=>{if(v===p.length)return E(b(y+1));let S=p[v];c(w+S,{pathExt:g},(T,z)=>{if(!T&&z)if(n.all)m.push(w+S);else return E(w+S);return E(x(w,y,v+1))});});return f?b(0).then(w=>f(null,w),f):b(0)},h=(i,n)=>{n=n||{};let{pathEnv:f,pathExt:d,pathExtExe:p}=a(i,n),g=[];for(let m=0;m<f.length;m++){let b=f[m],x=/^".*"$/.test(b)?b.slice(1,-1):b,w=r.join(x,i),y=!x&&/^\.[\\\/]/.test(i)?i.slice(0,2)+w:w;for(let v=0;v<d.length;v++){let E=y+d[v];try{if(c.sync(E,{pathExt:p}))if(n.all)g.push(E);else return E}catch{}}}if(n.all&&g.length)return g;if(n.nothrow)return null;throw l(i)};t.exports=s,s.sync=h;}),Er=O((e,t)=>{var o=(r={})=>{let u=r.env||process.env;return (r.platform||process.platform)!=="win32"?"PATH":Object.keys(u).reverse().find(c=>c.toUpperCase()==="PATH")||"Path"};t.exports=o,t.exports.default=o;}),Sr=O((e,t)=>{var o=q("path"),r=_r(),u=Er();function c(a,s){let h=a.options.env||process.env,i=process.cwd(),n=a.options.cwd!=null,f=n&&process.chdir!==void 0&&!process.chdir.disabled;if(f)try{process.chdir(a.options.cwd);}catch{}let d;try{d=r.sync(a.command,{path:h[u({env:h})],pathExt:s?o.delimiter:void 0});}catch{}finally{f&&process.chdir(i);}return d&&(d=o.resolve(n?a.options.cwd:"",d)),d}function l(a){return c(a)||c(a,true)}t.exports=l;}),$r=O((e,t)=>{var o=/([()\][%!^"`<>&|;, *?])/g;function r(c){return c=c.replace(o,"^$1"),c}function u(c,l){return c=`${c}`,c=c.replace(/(\\*)"/g,'$1$1\\"'),c=c.replace(/(\\*)$/,"$1$1"),c=`"${c}"`,c=c.replace(o,"^$1"),l&&(c=c.replace(o,"^$1")),c}t.exports.command=r,t.exports.argument=u;}),Or=O((e,t)=>{t.exports=/^#!(.*)/;}),Tr=O((e,t)=>{var o=Or();t.exports=(r="")=>{let u=r.match(o);if(!u)return null;let[c,l]=u[0].replace(/#! ?/,"").split(" "),a=c.split("/").pop();return a==="env"?l:l?`${a} ${l}`:a};}),Cr=O((e,t)=>{var o=q("fs"),r=Tr();function u(c){let l=Buffer.alloc(150),a;try{a=o.openSync(c,"r"),o.readSync(a,l,0,150,0),o.closeSync(a);}catch{}return r(l.toString())}t.exports=u;}),Ar=O((e,t)=>{var o=q("path"),r=Sr(),u=$r(),c=Cr(),l=process.platform==="win32",a=/\.(?:com|exe)$/i,s=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function h(f){f.file=r(f);let d=f.file&&c(f.file);return d?(f.args.unshift(f.file),f.command=d,r(f)):f.file}function i(f){if(!l)return f;let d=h(f),p=!a.test(d);if(f.options.forceShell||p){let g=s.test(d);f.command=o.normalize(f.command),f.command=u.command(f.command),f.args=f.args.map(b=>u.argument(b,g));let m=[f.command].concat(f.args).join(" ");f.args=["/d","/s","/c",`"${m}"`],f.command=process.env.comspec||"cmd.exe",f.options.windowsVerbatimArguments=true;}return f}function n(f,d,p){d&&!Array.isArray(d)&&(p=d,d=null),d=d?d.slice(0):[],p=Object.assign({},p);let g={command:f,args:d,options:p,file:void 0,original:{command:f,args:d}};return p.shell?g:i(g)}t.exports=n;}),Mr=O((e,t)=>{var o=process.platform==="win32";function r(a,s){return Object.assign(new Error(`${s} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${a.command}`,path:a.command,spawnargs:a.args})}function u(a,s){if(!o)return;let h=a.emit;a.emit=function(i,n){if(i==="exit"){let f=c(n,s);if(f)return h.call(a,"error",f)}return h.apply(a,arguments)};}function c(a,s){return o&&a===1&&!s.file?r(s.original,"spawn"):null}function l(a,s){return o&&a===1&&!s.file?r(s.original,"spawnSync"):null}t.exports={hookChildProcess:u,verifyENOENT:c,verifyENOENTSync:l,notFoundError:r};}),Pr=O((e,t)=>{var o=q("child_process"),r=Ar(),u=Mr();function c(a,s,h){let i=r(a,s,h),n=o.spawn(i.command,i.args,i.options);return u.hookChildProcess(n,i),n}function l(a,s,h){let i=r(a,s,h),n=o.spawnSync(i.command,i.args,i.options);return n.error=n.error||u.verifyENOENTSync(n.status,i),n}t.exports=c,t.exports.spawn=c,t.exports.sync=l,t.exports._parse=r,t.exports._enoent=u;}),Nr=/^path$/i,tt={key:"PATH",value:""};function Dr(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Nr.test(t))continue;let o=e[t];return o?{key:t,value:o}:tt}return tt}function Lr(e,t){let o=t.value.split(delimiter),r=e,u;do o.push(resolve(r,"node_modules",".bin")),u=r,r=dirname(r);while(r!==u);return {key:t.key,value:o.join(delimiter)}}function Fr(e,t){let o={...process.env,...t},r=Lr(e,Dr(o));return o[r.key]=r.value,o}var Gr=e=>{let t=e.length,o=new PassThrough,r=()=>{--t===0&&o.emit("end");};for(let u of e)u.pipe(o,{end:false}),u.on("end",r);return o},Vr=vr(Pr()),rt=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t;}},Yr={timeout:void 0,persist:false},Ur={windowsHide:true};function Br(e,t){return {command:normalize(e),args:t??[]}}function zr(e){let t=new AbortController;for(let o of e){if(o.aborted)return t.abort(),o;let r=()=>{t.abort(o.reason);};o.addEventListener("abort",r,{signal:t.signal});}return t.signal}var Jr=class{_process;_aborted=false;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,o){this._options={...Yr,...o},this._command=e,this._args=t??[],this._processClosed=new Promise(r=>{this._resolveClose=r;});}kill(e){return this._process?.kill(e)===true}get aborted(){return this._aborted}get killed(){return this._process?.killed===true}pipe(e,t,o){return Kr(e,t,{...o,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let o=Gr(t),r=Wr.createInterface({input:o});for await(let u of r)yield u.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new rt(this)}async _waitForOutput(){let e=this._process;if(!e)throw new Error("No process was started");let t="",o="";if(this._streamOut)for await(let u of this._streamOut)o+=u.toString();if(this._streamErr)for await(let u of this._streamErr)t+=u.toString();if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let r={stderr:t,stdout:o,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new rt(this,r);return r}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=cwd(),t=this._options,o={...Ur,...t.nodeOptions},r=[];this._resetState(),t.timeout!==void 0&&r.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&r.push(t.signal),t.persist===true&&(o.detached=true),r.length>0&&(o.signal=zr(r)),o.env=Fr(e,o.env);let{command:u,args:c}=Br(this._command,this._args),l=(0, Vr._parse)(u,c,o),a=spawn(l.command,l.args,l.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once("error",this._onError),a.once("close",this._onClose),t.stdin!==void 0&&a.stdin&&t.stdin.process){let{stdout:s}=t.stdin.process;s&&s.pipe(a.stdin);}}_resetState(){this._aborted=false,this._processClosed=new Promise(e=>{this._resolveClose=e;}),this._thrownError=void 0;}_onError=e=>{if(e.name==="AbortError"&&(!(e.cause instanceof Error)||e.cause.name!=="TimeoutError")){this._aborted=true;return}this._thrownError=e;};_onClose=()=>{this._resolveClose&&this._resolveClose();}},te=(e,t,o)=>{let r=new Jr(e,t,o);return r.spawn(),r},Kr=te;function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var se={},ie,nt;function A(){if(nt)return ie;nt=1;let e,t,o,r,u=true;typeof process<"u"&&({FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:o,TERM:r}=process.env||{},u=process.stdout&&process.stdout.isTTY);let c={enabled:!t&&o==null&&r!=="dumb"&&(e!=null&&e!=="0"||u),reset:s(0,0),bold:s(1,22),dim:s(2,22),italic:s(3,23),underline:s(4,24),inverse:s(7,27),hidden:s(8,28),strikethrough:s(9,29),black:s(30,39),red:s(31,39),green:s(32,39),yellow:s(33,39),blue:s(34,39),magenta:s(35,39),cyan:s(36,39),white:s(37,39),gray:s(90,39),grey:s(90,39),bgBlack:s(40,49),bgRed:s(41,49),bgGreen:s(42,49),bgYellow:s(43,49),bgBlue:s(44,49),bgMagenta:s(45,49),bgCyan:s(46,49),bgWhite:s(47,49)};function l(h,i){let n=0,f,d="",p="";for(;n<h.length;n++)f=h[n],d+=f.open,p+=f.close,~i.indexOf(f.close)&&(i=i.replace(f.rgx,f.close+f.open));return d+i+p}function a(h,i){let n={has:h,keys:i};return n.reset=c.reset.bind(n),n.bold=c.bold.bind(n),n.dim=c.dim.bind(n),n.italic=c.italic.bind(n),n.underline=c.underline.bind(n),n.inverse=c.inverse.bind(n),n.hidden=c.hidden.bind(n),n.strikethrough=c.strikethrough.bind(n),n.black=c.black.bind(n),n.red=c.red.bind(n),n.green=c.green.bind(n),n.yellow=c.yellow.bind(n),n.blue=c.blue.bind(n),n.magenta=c.magenta.bind(n),n.cyan=c.cyan.bind(n),n.white=c.white.bind(n),n.gray=c.gray.bind(n),n.grey=c.grey.bind(n),n.bgBlack=c.bgBlack.bind(n),n.bgRed=c.bgRed.bind(n),n.bgGreen=c.bgGreen.bind(n),n.bgYellow=c.bgYellow.bind(n),n.bgBlue=c.bgBlue.bind(n),n.bgMagenta=c.bgMagenta.bind(n),n.bgCyan=c.bgCyan.bind(n),n.bgWhite=c.bgWhite.bind(n),n}function s(h,i){let n={open:`\x1B[${h}m`,close:`\x1B[${i}m`,rgx:new RegExp(`\\x1b\\[${i}m`,"g")};return function(f){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(h)||(this.has.push(h),this.keys.push(n)),f===void 0?this:c.enabled?l(this.keys,f+""):f+""):f===void 0?a([h],[n]):c.enabled?l([n],f+""):f+""}}return ie=c,ie}var ne,ot;function os(){return ot||(ot=1,ne=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl)return e.name==="a"?"first":e.name==="c"||e.name==="d"?"abort":e.name==="e"?"last":e.name==="g"?"reset":e.name==="n"?"down":e.name==="p"?"up":void 0;if(t){if(e.name==="j")return "down";if(e.name==="k")return "up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":false}}),ne}var oe,at;function We(){return at||(at=1,oe=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),o=new RegExp(t,"g");return typeof e=="string"?e.replace(o,""):e}),oe}var ae,lt;function M(){if(lt)return ae;lt=1;let e="\x1B",t=`${e}[`,o="\x07",r={to(l,a){return a?`${t}${a+1};${l+1}H`:`${t}${l+1}G`},move(l,a){let s="";return l<0?s+=`${t}${-l}D`:l>0&&(s+=`${t}${l}C`),a<0?s+=`${t}${-a}A`:a>0&&(s+=`${t}${a}B`),s},up:(l=1)=>`${t}${l}A`,down:(l=1)=>`${t}${l}B`,forward:(l=1)=>`${t}${l}C`,backward:(l=1)=>`${t}${l}D`,nextLine:(l=1)=>`${t}E`.repeat(l),prevLine:(l=1)=>`${t}F`.repeat(l),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},u={up:(l=1)=>`${t}S`.repeat(l),down:(l=1)=>`${t}T`.repeat(l)},c={screen:`${t}2J`,up:(l=1)=>`${t}1J`.repeat(l),down:(l=1)=>`${t}J`.repeat(l),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(l){let a="";for(let s=0;s<l;s++)a+=this.line+(s<l-1?r.up():"");return l&&(a+=r.left),a}};return ae={cursor:r,scroll:u,erase:c,beep:o},ae}var le,ut;function as(){if(ut)return le;ut=1;let e=We(),{erase:t,cursor:o}=M(),r=u=>[...e(u)].length;return le=function(u,c){if(!c)return t.line+o.to(0);let l=0,a=u.split(/\r?\n/);for(let s of a)l+=1+Math.floor(Math.max(r(s)-1,0)/c);return t.lines(l)},le}var ue,ct;function Zt(){if(ct)return ue;ct=1;let 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"},t={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 ue=process.platform==="win32"?t:e,ue}var ce,ht;function ls(){if(ht)return ce;ht=1;let e=A(),t=Zt(),o=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),r=s=>o[s]||o.default,u=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return ce={styles:o,render:r,symbols:u,symbol:(s,h,i)=>h?u.aborted:i?u.exited:s?u.done:u.default,delimiter:s=>e.gray(s?t.ellipsis:t.pointerSmall),item:(s,h)=>e.gray(s?h?t.pointerSmall:"+":t.line)},ce}var he,dt;function us(){if(dt)return he;dt=1;let e=We();return he=function(t,o){let r=String(e(t)||"").split(/\r?\n/);return o?r.map(u=>Math.ceil(u.length/o)).reduce((u,c)=>u+c):r.length},he}var de,ft;function cs(){return ft||(ft=1,de=(e,t={})=>{let o=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",r=t.width;return (e||"").split(/\r?\n/g).map(u=>u.split(/\s+/g).reduce((c,l)=>(l.length+o.length>=r||c[c.length-1].length+l.length+1<r?c[c.length-1]+=` ${l}`:c.push(`${o}${l}`),c),[o]).join(`
2
+ `)).join(`
3
+ `)}),de}var fe,pt;function hs(){return pt||(pt=1,fe=(e,t,o)=>{o=o||t;let r=Math.min(t-o,e-Math.floor(o/2));r<0&&(r=0);let u=Math.min(r+o,t);return {startIndex:r,endIndex:u}}),fe}var pe,mt;function k(){return mt||(mt=1,pe={action:os(),clear:as(),style:ls(),strip:We(),figures:Zt(),lines:us(),wrap:cs(),entriesToDisplay:hs()}),pe}var me,gt;function N(){if(gt)return me;gt=1;let e=Wr,{action:t}=k(),o=es,{beep:r,cursor:u}=M(),c=A();class l extends o{constructor(s={}){super(),this.firstRender=true,this.in=s.stdin||process.stdin,this.out=s.stdout||process.stdout,this.onRender=(s.onRender||(()=>{})).bind(this);let h=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,h),this.in.isTTY&&this.in.setRawMode(true);let i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,n=(f,d)=>{let p=t(d,i);p===false?this._&&this._(f,d):typeof this[p]=="function"?this[p](d):this.bell();};this.close=()=>{this.out.write(u.show),this.in.removeListener("keypress",n),this.in.isTTY&&this.in.setRawMode(false),h.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=true;},this.in.on("keypress",n);}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited});}bell(){this.out.write(r);}render(){this.onRender(c),this.firstRender&&(this.firstRender=false);}}return me=l,me}var ge,yt;function ds(){if(yt)return ge;yt=1;let e=A(),t=N(),{erase:o,cursor:r}=M(),{style:u,clear:c,lines:l,figures:a}=k();class s extends t{constructor(i={}){super(i),this.transform=u.render(i.style),this.scale=this.transform.scale,this.msg=i.message,this.initial=i.initial||"",this.validator=i.validate||(()=>true),this.value="",this.errorMsg=i.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=c("",this.out.columns),this.render();}set value(i){!i&&this.initial?(this.placeholder=true,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=false,this.rendered=this.transform.render(i)),this._value=i,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=true,this.error=false,this.red=false,this.fire(),this.render(),this.out.write(`
4
+ `),this.close();}async validate(){let i=await this.validator(this.value);typeof i=="string"&&(this.errorMsg=i,i=false),this.error=!i;}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=true,this.fire(),this.render();return}this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
5
+ `),this.close();}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render();}moveCursor(i){this.placeholder||(this.cursor=this.cursor+i,this.cursorOffset+=i);}_(i,n){let f=this.value.slice(0,this.cursor),d=this.value.slice(this.cursor);this.value=`${f}${i}${d}`,this.red=false,this.cursor=this.placeholder?0:f.length+1,this.render();}delete(){if(this.isCursorAtStart())return this.bell();let i=this.value.slice(0,this.cursor-1),n=this.value.slice(this.cursor);this.value=`${i}${n}`,this.red=false,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 i=this.value.slice(0,this.cursor),n=this.value.slice(this.cursor+1);this.value=`${i}${n}`,this.red=false,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(r.down(l(this.outputError,this.out.columns)-1)+c(this.outputError,this.out.columns)),this.out.write(c(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
6
+ `).reduce((i,n,f)=>i+`
7
+ ${f?" ":a.pointerSmall} ${e.red().italic(n)}`,"")),this.out.write(o.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore+r.move(this.cursorOffset,0)));}}return ge=s,ge}var ye,vt;function fs(){if(vt)return ye;vt=1;let e=A(),t=N(),{style:o,clear:r,figures:u,wrap:c,entriesToDisplay:l}=k(),{cursor:a}=M();class s extends t{constructor(i={}){super(i),this.msg=i.message,this.hint=i.hint||"- Use arrow-keys. Return to submit.",this.warn=i.warn||"- This option is disabled",this.cursor=i.initial||0,this.choices=i.choices.map((n,f)=>(typeof n=="string"&&(n={title:n,value:f}),{title:n&&(n.title||n.value||n),value:n&&(n.value===void 0?f:n.value),description:n&&n.description,selected:n&&n.selected,disabled:n&&n.disabled})),this.optionsPerPage=i.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=r("",this.out.columns),this.render();}moveCursor(i){this.cursor=i,this.value=this.choices[i].value,this.fire();}reset(){this.moveCursor(0),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
8
+ `),this.close();}submit(){this.selection.disabled?this.bell():(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
9
+ `),this.close());}first(){this.moveCursor(0),this.render();}last(){this.moveCursor(this.choices.length-1),this.render();}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render();}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render();}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render();}_(i,n){if(i===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(a.hide):this.out.write(r(this.outputText,this.out.columns)),super.render();let{startIndex:i,endIndex:n}=l(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(false),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
10
+ `;for(let f=i;f<n;f++){let d,p,g="",m=this.choices[f];f===i&&i>0?p=u.arrowUp:f===n-1&&n<this.choices.length?p=u.arrowDown:p=" ",m.disabled?(d=this.cursor===f?e.gray().underline(m.title):e.strikethrough().gray(m.title),p=(this.cursor===f?e.bold().gray(u.pointer)+" ":" ")+p):(d=this.cursor===f?e.cyan().underline(m.title):m.title,p=(this.cursor===f?e.cyan(u.pointer)+" ":" ")+p,m.description&&this.cursor===f&&(g=` - ${m.description}`,(p.length+d.length+g.length>=this.out.columns||m.description.split(/\r?\n/).length>1)&&(g=`
11
+ `+c(m.description,{margin:3,width:this.out.columns})))),this.outputText+=`${p} ${d}${e.gray(g)}
12
+ `;}}this.out.write(this.outputText);}}return ye=s,ye}var ve,bt;function ps(){if(bt)return ve;bt=1;let e=A(),t=N(),{style:o,clear:r}=k(),{cursor:u,erase:c}=M();class l extends t{constructor(s={}){super(s),this.msg=s.message,this.value=!!s.initial,this.active=s.active||"on",this.inactive=s.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=true,this.fire(),this.render(),this.out.write(`
13
+ `),this.close();}submit(){this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
14
+ `),this.close();}deactivate(){if(this.value===false)return this.bell();this.value=false,this.render();}activate(){if(this.value===true)return this.bell();this.value=true,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();}_(s,h){if(s===" ")this.value=!this.value;else if(s==="1")this.value=true;else if(s==="0")this.value=false;else return this.bell();this.render();}render(){this.closed||(this.firstRender?this.out.write(u.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.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(c.line+u.to(0)+this.outputText));}}return ve=l,ve}var be,wt;function j(){if(wt)return be;wt=1;class e{constructor({token:o,date:r,parts:u,locales:c}){this.token=o,this.date=r||new Date,this.parts=u||[this],this.locales=c||{};}up(){}down(){}next(){let o=this.parts.indexOf(this);return this.parts.find((r,u)=>u>o&&r instanceof e)}setTo(o){}prev(){let o=[].concat(this.parts).reverse(),r=o.indexOf(this);return o.find((u,c)=>c>r&&u instanceof e)}toString(){return String(this.date)}}return be=e,be}var we,xt;function ms(){if(xt)return we;xt=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setHours((this.date.getHours()+12)%24);}down(){this.up();}toString(){let r=this.date.getHours()>12?"pm":"am";return /\A/.test(this.token)?r.toUpperCase():r}}return we=t,we}var xe,_t;function gs(){if(_t)return xe;_t=1;let e=j(),t=r=>(r=r%10,r===1?"st":r===2?"nd":r===3?"rd":"th");class o extends e{constructor(u={}){super(u);}up(){this.date.setDate(this.date.getDate()+1);}down(){this.date.setDate(this.date.getDate()-1);}setTo(u){this.date.setDate(parseInt(u.substr(-2)));}toString(){let u=this.date.getDate(),c=this.date.getDay();return this.token==="DD"?String(u).padStart(2,"0"):this.token==="Do"?u+t(u):this.token==="d"?c+1:this.token==="ddd"?this.locales.weekdaysShort[c]:this.token==="dddd"?this.locales.weekdays[c]:u}}return xe=o,xe}var _e,Et;function ys(){if(Et)return _e;Et=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setHours(this.date.getHours()+1);}down(){this.date.setHours(this.date.getHours()-1);}setTo(r){this.date.setHours(parseInt(r.substr(-2)));}toString(){let r=this.date.getHours();return /h/.test(this.token)&&(r=r%12||12),this.token.length>1?String(r).padStart(2,"0"):r}}return _e=t,_e}var Ee,St;function vs(){if(St)return Ee;St=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1);}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1);}setTo(r){this.date.setMilliseconds(parseInt(r.substr(-this.token.length)));}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Ee=t,Ee}var Se,$t;function bs(){if($t)return Se;$t=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setMinutes(this.date.getMinutes()+1);}down(){this.date.setMinutes(this.date.getMinutes()-1);}setTo(r){this.date.setMinutes(parseInt(r.substr(-2)));}toString(){let r=this.date.getMinutes();return this.token.length>1?String(r).padStart(2,"0"):r}}return Se=t,Se}var $e,Ot;function ws(){if(Ot)return $e;Ot=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setMonth(this.date.getMonth()+1);}down(){this.date.setMonth(this.date.getMonth()-1);}setTo(r){r=parseInt(r.substr(-2))-1,this.date.setMonth(r<0?0:r);}toString(){let r=this.date.getMonth(),u=this.token.length;return u===2?String(r+1).padStart(2,"0"):u===3?this.locales.monthsShort[r]:u===4?this.locales.months[r]:String(r+1)}}return $e=t,$e}var Oe,Tt;function xs(){if(Tt)return Oe;Tt=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setSeconds(this.date.getSeconds()+1);}down(){this.date.setSeconds(this.date.getSeconds()-1);}setTo(r){this.date.setSeconds(parseInt(r.substr(-2)));}toString(){let r=this.date.getSeconds();return this.token.length>1?String(r).padStart(2,"0"):r}}return Oe=t,Oe}var Te,Ct;function _s(){if(Ct)return Te;Ct=1;let e=j();class t extends e{constructor(r={}){super(r);}up(){this.date.setFullYear(this.date.getFullYear()+1);}down(){this.date.setFullYear(this.date.getFullYear()-1);}setTo(r){this.date.setFullYear(r.substr(-4));}toString(){let r=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?r.substr(-2):r}}return Te=t,Te}var Ce,At;function Es(){return At||(At=1,Ce={DatePart:j(),Meridiem:ms(),Day:gs(),Hours:ys(),Milliseconds:vs(),Minutes:bs(),Month:ws(),Seconds:xs(),Year:_s()}),Ce}var Ae,Mt;function Ss(){if(Mt)return Ae;Mt=1;let e=A(),t=N(),{style:o,clear:r,figures:u}=k(),{erase:c,cursor:l}=M(),{DatePart:a,Meridiem:s,Day:h,Hours:i,Milliseconds:n,Minutes:f,Month:d,Seconds:p,Year:g}=Es(),m=/\\(.)|"((?:\\["\\]|[^"])+)"|(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,b={1:({token:y})=>y.replace(/\\(.)/g,"$1"),2:y=>new h(y),3:y=>new d(y),4:y=>new g(y),5:y=>new s(y),6:y=>new i(y),7:y=>new f(y),8:y=>new p(y),9:y=>new n(y)},x={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 w extends t{constructor(v={}){super(v),this.msg=v.message,this.cursor=0,this.typed="",this.locales=Object.assign(x,v.locales),this._date=v.initial||new Date,this.errorMsg=v.error||"Please Enter A Valid Value",this.validator=v.validate||(()=>true),this.mask=v.mask||"YYYY-MM-DD HH:mm:ss",this.clear=r("",this.out.columns),this.render();}get value(){return this.date}get date(){return this._date}set date(v){v&&this._date.setTime(v.getTime());}set mask(v){let E;for(this.parts=[];E=m.exec(v);){let S=E.shift(),T=E.findIndex(z=>z!=null);this.parts.push(T in b?b[T]({token:E[T]||S,date:this.date,parts:this.parts,locales:this.locales}):E[T]||S);}let $=this.parts.reduce((S,T)=>(typeof T=="string"&&typeof S[S.length-1]=="string"?S[S.length-1]+=T:S.push(T),S),[]);this.parts.splice(0),this.parts.push(...$),this.reset();}moveCursor(v){this.typed="",this.cursor=v,this.fire();}reset(){this.moveCursor(this.parts.findIndex(v=>v instanceof a)),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
15
+ `),this.close();}async validate(){let v=await this.validator(this.value);typeof v=="string"&&(this.errorMsg=v,v=false),this.error=!v;}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
16
+ `),this.close();}up(){this.typed="",this.parts[this.cursor].up(),this.render();}down(){this.typed="",this.parts[this.cursor].down(),this.render();}left(){let v=this.parts[this.cursor].prev();if(v==null)return this.bell();this.moveCursor(this.parts.indexOf(v)),this.render();}right(){let v=this.parts[this.cursor].next();if(v==null)return this.bell();this.moveCursor(this.parts.indexOf(v)),this.render();}next(){let v=this.parts[this.cursor].next();this.moveCursor(v?this.parts.indexOf(v):this.parts.findIndex(E=>E instanceof a)),this.render();}_(v){/\d/.test(v)&&(this.typed+=v,this.parts[this.cursor].setTo(this.typed),this.render());}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(false),this.parts.reduce((v,E,$)=>v.concat($===this.cursor&&!this.done?e.cyan().underline(E.toString()):E),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
17
+ `).reduce((v,E,$)=>v+`
18
+ ${$?" ":u.pointerSmall} ${e.red().italic(E)}`,"")),this.out.write(c.line+l.to(0)+this.outputText));}}return Ae=w,Ae}var Me,Pt;function $s(){if(Pt)return Me;Pt=1;let e=A(),t=N(),{cursor:o,erase:r}=M(),{style:u,figures:c,clear:l,lines:a}=k(),s=/[0-9]/,h=f=>f!==void 0,i=(f,d)=>{let p=Math.pow(10,d);return Math.round(f*p)/p};class n extends t{constructor(d={}){super(d),this.transform=u.render(d.style),this.msg=d.message,this.initial=h(d.initial)?d.initial:"",this.float=!!d.float,this.round=d.round||2,this.inc=d.increment||1,this.min=h(d.min)?d.min:-1/0,this.max=h(d.max)?d.max:1/0,this.errorMsg=d.error||"Please Enter A Valid Value",this.validator=d.validate||(()=>true),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render();}set value(d){!d&&d!==0?(this.placeholder=true,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=false,this.rendered=this.transform.render(`${i(d,this.round)}`),this._value=i(d,this.round)),this.fire();}get value(){return this._value}parse(d){return this.float?parseFloat(d):parseInt(d)}valid(d){return d==="-"||d==="."&&this.float||s.test(d)}reset(){this.typed="",this.value="",this.fire(),this.render();}exit(){this.abort();}abort(){let d=this.value;this.value=d!==""?d:this.initial,this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
19
+ `),this.close();}async validate(){let d=await this.validator(this.value);typeof d=="string"&&(this.errorMsg=d,d=false),this.error=!d;}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let d=this.value;this.value=d!==""?d:this.initial,this.done=true,this.aborted=false,this.error=false,this.fire(),this.render(),this.out.write(`
20
+ `),this.close();}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render();}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render();}delete(){let d=this.value.toString();if(d.length===0)return this.bell();this.value=this.parse(d=d.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();}_(d,p){if(!this.valid(d))return this.bell();let g=Date.now();if(g-this.lastHit>1e3&&(this.typed=""),this.typed+=d,this.lastHit=g,this.color="cyan",d===".")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(o.down(a(this.outputError,this.out.columns)-1)+l(this.outputError,this.out.columns)),this.out.write(l(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.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(`
21
+ `).reduce((d,p,g)=>d+`
22
+ ${g?" ":c.pointerSmall} ${e.red().italic(p)}`,"")),this.out.write(r.line+o.to(0)+this.outputText+o.save+this.outputError+o.restore));}}return Me=n,Me}var Pe,Rt;function Qt(){if(Rt)return Pe;Rt=1;let e=A(),{cursor:t}=M(),o=N(),{clear:r,figures:u,style:c,wrap:l,entriesToDisplay:a}=k();class s extends o{constructor(i={}){super(i),this.msg=i.message,this.cursor=i.cursor||0,this.scrollIndex=i.cursor||0,this.hint=i.hint||"",this.warn=i.warn||"- This option is disabled -",this.minSelected=i.min,this.showMinError=false,this.maxChoices=i.max,this.instructions=i.instructions,this.optionsPerPage=i.optionsPerPage||10,this.value=i.choices.map((n,f)=>(typeof n=="string"&&(n={title:n,value:f}),{title:n&&(n.title||n.value||n),description:n&&n.description,value:n&&(n.value===void 0?f:n.value),selected:n&&n.selected,disabled:n&&n.disabled})),this.clear=r("",this.out.columns),i.overrideRender||this.render();}reset(){this.value.map(i=>!i.selected),this.cursor=0,this.fire(),this.render();}selected(){return this.value.filter(i=>i.selected)}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
23
+ `),this.close();}submit(){let i=this.value.filter(n=>n.selected);this.minSelected&&i.length<this.minSelected?(this.showMinError=true,this.render()):(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
24
+ `),this.close());}first(){this.cursor=0,this.render();}last(){this.cursor=this.value.length-1,this.render();}next(){this.cursor=(this.cursor+1)%this.value.length,this.render();}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render();}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render();}left(){this.value[this.cursor].selected=false,this.render();}right(){if(this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true,this.render();}handleSpaceToggle(){let i=this.value[this.cursor];if(i.selected)i.selected=false,this.render();else {if(i.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();i.selected=true,this.render();}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let i=!this.value[this.cursor].selected;this.value.filter(n=>!n.disabled).forEach(n=>n.selected=i),this.render();}_(i,n){if(i===" ")this.handleSpaceToggle();else if(i==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
25
+ Instructions:
26
+ ${u.arrowUp}/${u.arrowDown}: Highlight option
27
+ ${u.arrowLeft}/${u.arrowRight}/[space]: Toggle selection
28
+ `+(this.maxChoices===void 0?` a: Toggle all
29
+ `:"")+" enter/return: Complete answer":""}renderOption(i,n,f,d){let p=(n.selected?e.green(u.radioOn):u.radioOff)+" "+d+" ",g,m;return n.disabled?g=i===f?e.gray().underline(n.title):e.strikethrough().gray(n.title):(g=i===f?e.cyan().underline(n.title):n.title,i===f&&n.description&&(m=` - ${n.description}`,(p.length+g.length+m.length>=this.out.columns||n.description.split(/\r?\n/).length>1)&&(m=`
30
+ `+l(n.description,{margin:p.length,width:this.out.columns})))),p+g+e.gray(m||"")}paginateOptions(i){if(i.length===0)return e.red("No matches for this query.");let{startIndex:n,endIndex:f}=a(this.cursor,i.length,this.optionsPerPage),d,p=[];for(let g=n;g<f;g++)g===n&&n>0?d=u.arrowUp:g===f-1&&f<i.length?d=u.arrowDown:d=" ",p.push(this.renderOption(this.cursor,i[g],g,d));return `
31
+ `+p.join(`
32
+ `)}renderOptions(i){return this.done?"":this.paginateOptions(i)}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");let i=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&i.push(e.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let i=[c.symbol(this.done,this.aborted),e.bold(this.msg),c.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),i+=this.renderOptions(this.value),this.out.write(this.clear+i),this.clear=r(i,this.out.columns);}}return Pe=s,Pe}var Re,kt;function Os(){if(kt)return Re;kt=1;let e=A(),t=N(),{erase:o,cursor:r}=M(),{style:u,clear:c,figures:l,wrap:a,entriesToDisplay:s}=k(),h=(d,p)=>d[p]&&(d[p].value||d[p].title||d[p]),i=(d,p)=>d[p]&&(d[p].title||d[p].value||d[p]),n=(d,p)=>{let g=d.findIndex(m=>m.value===p||m.title===p);return g>-1?g:void 0};class f extends t{constructor(p={}){super(p),this.msg=p.message,this.suggest=p.suggest,this.choices=p.choices,this.initial=typeof p.initial=="number"?p.initial:n(p.choices,p.initial),this.select=this.initial||p.cursor||0,this.i18n={noMatches:p.noMatches||"no matches found"},this.fallback=p.fallback||this.initial,this.clearFirst=p.clearFirst||false,this.suggestions=[],this.input="",this.limit=p.limit||10,this.cursor=0,this.transform=u.render(p.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=c("",this.out.columns),this.complete(this.render),this.render();}set fallback(p){this._fb=Number.isSafeInteger(parseInt(p))?parseInt(p):p;}get fallback(){let p;return typeof this._fb=="number"?p=this.choices[this._fb]:typeof this._fb=="string"&&(p={title:this._fb}),p||this._fb||{title:this.i18n.noMatches}}moveSelect(p){this.select=p,this.suggestions.length>0?this.value=h(this.suggestions,p):this.value=this.fallback.value,this.fire();}async complete(p){let g=this.completing=this.suggest(this.input,this.choices),m=await g;if(this.completing!==g)return;this.suggestions=m.map((x,w,y)=>({title:i(y,w),value:h(y,w),description:x.description})),this.completing=false;let b=Math.max(m.length-1,0);this.moveSelect(Math.min(b,this.select)),p&&p();}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=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
33
+ `),this.close());}abort(){this.done=this.aborted=true,this.exited=false,this.fire(),this.render(),this.out.write(`
34
+ `),this.close();}submit(){this.done=true,this.aborted=this.exited=false,this.fire(),this.render(),this.out.write(`
35
+ `),this.close();}_(p,g){let m=this.input.slice(0,this.cursor),b=this.input.slice(this.cursor);this.input=`${m}${p}${b}`,this.cursor=m.length+1,this.complete(this.render),this.render();}delete(){if(this.cursor===0)return this.bell();let p=this.input.slice(0,this.cursor-1),g=this.input.slice(this.cursor);this.input=`${p}${g}`,this.complete(this.render),this.cursor=this.cursor-1,this.render();}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let p=this.input.slice(0,this.cursor),g=this.input.slice(this.cursor+1);this.input=`${p}${g}`,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(p,g,m,b){let x,w=m?l.arrowUp:b?l.arrowDown:" ",y=g?e.cyan().underline(p.title):p.title;return w=(g?e.cyan(l.pointer)+" ":" ")+w,p.description&&(x=` - ${p.description}`,(w.length+y.length+x.length>=this.out.columns||p.description.split(/\r?\n/).length>1)&&(x=`
36
+ `+a(p.description,{margin:3,width:this.out.columns}))),w+" "+y+e.gray(x||"")}render(){if(this.closed)return;this.firstRender?this.out.write(r.hide):this.out.write(c(this.outputText,this.out.columns)),super.render();let{startIndex:p,endIndex:g}=s(this.select,this.choices.length,this.limit);if(this.outputText=[u.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),u.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let m=this.suggestions.slice(p,g).map((b,x)=>this.renderOption(b,this.select===x+p,x===0&&p>0,x+p===g-1&&g<this.choices.length)).join(`
37
+ `);this.outputText+=`
38
+ `+(m||e.gray(this.fallback.title));}this.out.write(o.line+r.to(0)+this.outputText);}}return Re=f,Re}var ke,jt;function Ts(){if(jt)return ke;jt=1;let e=A(),{cursor:t}=M(),o=Qt(),{clear:r,style:u,figures:c}=k();class l extends o{constructor(s={}){s.overrideRender=true,super(s),this.inputValue="",this.clear=r("",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=false,this.render();}right(){if(this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true,this.render();}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions());}updateFilteredOptions(){let s=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(i=>this.inputValue?!!(typeof i.title=="string"&&i.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof i.value=="string"&&i.value.toLowerCase().includes(this.inputValue.toLowerCase())):true);let h=this.filteredOptions.findIndex(i=>i===s);this.cursor=h<0?0:h,this.render();}handleSpaceToggle(){let s=this.filteredOptions[this.cursor];if(s.selected)s.selected=false,this.render();else {if(s.disabled||this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();s.selected=true,this.render();}}handleInputChange(s){this.inputValue=this.inputValue+s,this.updateFilteredOptions();}_(s,h){s===" "?this.handleSpaceToggle():this.handleInputChange(s);}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
39
+ Instructions:
40
+ ${c.arrowUp}/${c.arrowDown}: Highlight option
41
+ ${c.arrowLeft}/${c.arrowRight}/[space]: Toggle selection
42
+ [a,b,c]/delete: Filter choices
43
+ enter/return: Complete answer
44
+ `:""}renderCurrentInput(){return `
45
+ Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
46
+ `}renderOption(s,h,i,n){let f=(h.selected?e.green(c.radioOn):c.radioOff)+" "+n+" ",d;return h.disabled?d=s===i?e.gray().underline(h.title):e.strikethrough().gray(h.title):d=s===i?e.cyan().underline(h.title):h.title,f+d}renderDoneOrInstructions(){if(this.done)return this.value.filter(h=>h.selected).map(h=>h.title).join(", ");let s=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&s.push(e.yellow(this.warn)),s.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let s=[u.symbol(this.done,this.aborted),e.bold(this.msg),u.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(s+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),s+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+s),this.clear=r(s,this.out.columns);}}return ke=l,ke}var je,It;function Cs(){if(It)return je;It=1;let e=A(),t=N(),{style:o,clear:r}=k(),{erase:u,cursor:c}=M();class l extends t{constructor(s={}){super(s),this.msg=s.message,this.value=s.initial,this.initialValue=!!s.initial,this.yesMsg=s.yes||"yes",this.yesOption=s.yesOption||"(Y/n)",this.noMsg=s.no||"no",this.noOption=s.noOption||"(y/N)",this.render();}reset(){this.value=this.initialValue,this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
47
+ `),this.close();}submit(){this.value=this.value||false,this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
48
+ `),this.close();}_(s,h){return s.toLowerCase()==="y"?(this.value=true,this.submit()):s.toLowerCase()==="n"?(this.value=false,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(c.hide):this.out.write(r(this.outputText,this.out.columns)),super.render(),this.outputText=[o.symbol(this.done,this.aborted),e.bold(this.msg),o.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(u.line+c.to(0)+this.outputText));}}return je=l,je}var Ie,qt;function As(){return qt||(qt=1,Ie={TextPrompt:ds(),SelectPrompt:fs(),TogglePrompt:ps(),DatePrompt:Ss(),NumberPrompt:$s(),MultiselectPrompt:Qt(),AutocompletePrompt:Os(),AutocompleteMultiselectPrompt:Ts(),ConfirmPrompt:Cs()}),Ie}var Nt;function Ms(){return Nt||(Nt=1,function(e){let t=e,o=As(),r=l=>l;function u(l,a,s={}){return new Promise((h,i)=>{let n=new o[l](a),f=s.onAbort||r,d=s.onSubmit||r,p=s.onExit||r;n.on("state",a.onState||r),n.on("submit",g=>h(d(g))),n.on("exit",g=>h(p(g))),n.on("abort",g=>i(f(g)));})}t.text=l=>u("TextPrompt",l),t.password=l=>(l.style="password",t.text(l)),t.invisible=l=>(l.style="invisible",t.text(l)),t.number=l=>u("NumberPrompt",l),t.date=l=>u("DatePrompt",l),t.confirm=l=>u("ConfirmPrompt",l),t.list=l=>{let a=l.separator||",";return u("TextPrompt",l,{onSubmit:s=>s.split(a).map(h=>h.trim())})},t.toggle=l=>u("TogglePrompt",l),t.select=l=>u("SelectPrompt",l),t.multiselect=l=>{l.choices=[].concat(l.choices||[]);let a=s=>s.filter(h=>h.selected).map(h=>h.value);return u("MultiselectPrompt",l,{onAbort:a,onSubmit:a})},t.autocompleteMultiselect=l=>{l.choices=[].concat(l.choices||[]);let a=s=>s.filter(h=>h.selected).map(h=>h.value);return u("AutocompleteMultiselectPrompt",l,{onAbort:a,onSubmit:a})};let c=(l,a)=>Promise.resolve(a.filter(s=>s.title.slice(0,l.length).toLowerCase()===l.toLowerCase()));t.autocomplete=l=>(l.suggest=l.suggest||c,l.choices=[].concat(l.choices||[]),u("AutocompletePrompt",l));}(se)),se}var qe,Dt;function Ps(){if(Dt)return qe;Dt=1;let e=Ms(),t=["suggest","format","onState","validate","onRender","type"],o=()=>{};async function r(a=[],{onSubmit:s=o,onCancel:h=o}={}){let i={},n=r._override||{};a=[].concat(a);let f,d,p,g,m,b,x=async(w,y,v=false)=>{if(!(!v&&w.validate&&w.validate(y)!==true))return w.format?await w.format(y,i):y};for(d of a)if({name:g,type:m}=d,typeof m=="function"&&(m=await m(f,{...i},d),d.type=m),!!m){for(let w in d){if(t.includes(w))continue;let y=d[w];d[w]=typeof y=="function"?await y(f,{...i},b):y;}if(b=d,typeof d.message!="string")throw new Error("prompt message is required");if({name:g,type:m}=d,e[m]===void 0)throw new Error(`prompt type (${m}) is not defined`);if(n[d.name]!==void 0&&(f=await x(d,n[d.name]),f!==void 0)){i[g]=f;continue}try{f=r._injected?u(r._injected,d.initial):await e[m](d),i[g]=f=await x(d,f,!0),p=await s(d,f,i);}catch{p=!await h(d,i);}if(p)return i}return i}function u(a,s){let h=a.shift();if(h instanceof Error)throw h;return h===void 0?s:h}function c(a){r._injected=(r._injected||[]).concat(a);}function l(a){r._override=Object.assign({},a);}return qe=Object.assign(r,{prompt:r,prompts:e,inject:c,override:l}),qe}var Ne,Lt;function Rs(){return Lt||(Lt=1,Ne=Ps()),Ne}var ks=Rs(),js=Ve(ks),Ye=globalThis.window?.document!==void 0;globalThis.process?.versions?.node;globalThis.process?.versions?.bun;globalThis.Deno?.version?.deno;globalThis.process?.versions?.electron;globalThis.navigator?.userAgent?.includes("jsdom");typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope;typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope;typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope;var B=globalThis.navigator?.userAgentData?.platform;B==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===true||globalThis.process?.platform;B==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform;B==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===true||globalThis.navigator?.userAgent?.includes(" Linux ")===true||globalThis.process?.platform;B==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===true||globalThis.process?.platform;var Ft="\x1B]",Ht="\x07",U=";";!Ye&&R.env.TERM_PROGRAM;!Ye&&R.platform;Ye||R.cwd;var Is=(e,t)=>[Ft,"8",U,U,t,Ht,e,Ft,"8",U,U,Ht].join(""),De,Gt;function er(){return Gt||(Gt=1,De=(e,t=process.argv)=>{let o=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(o+e),u=t.indexOf("--");return r!==-1&&(u===-1||r<u)}),De}var Le,Vt;function qs(){if(Vt)return Le;Vt=1;let e=ts,t=rs,o=er(),{env:r}=process,u;o("no-color")||o("no-colors")||o("color=false")||o("color=never")?u=0:(o("color")||o("colors")||o("color=true")||o("color=always"))&&(u=1),"FORCE_COLOR"in r&&(r.FORCE_COLOR==="true"?u=1:r.FORCE_COLOR==="false"?u=0:u=r.FORCE_COLOR.length===0?1:Math.min(parseInt(r.FORCE_COLOR,10),3));function c(s){return s===0?false:{level:s,hasBasic:true,has256:s>=2,has16m:s>=3}}function l(s,h){if(u===0)return 0;if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2;if(s&&!h&&u===void 0)return 0;let i=u||0;if(r.TERM==="dumb")return i;if(process.platform==="win32"){let n=e.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in r)return ["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in r)||r.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in r)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(r.TEAMCITY_VERSION)?1:0;if(r.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in r){let n=parseInt((r.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(r.TERM_PROGRAM){case "iTerm.app":return n>=3?3:2;case "Apple_Terminal":return 2}}return /-256(color)?$/i.test(r.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(r.TERM)||"COLORTERM"in r?1:i}function a(s){let h=l(s,s&&s.isTTY);return c(h)}return Le={supportsColor:a,stdout:c(l(true,t.isatty(1))),stderr:c(l(true,t.isatty(2)))},Le}var Fe,Wt;function Ns(){if(Wt)return Fe;Wt=1;let e=qs(),t=er();function o(u){if(/^\d{3,4}$/.test(u)){let l=/(\d{1,2})(\d{2})/.exec(u)||[];return {major:0,minor:parseInt(l[1],10),patch:parseInt(l[2],10)}}let c=(u||"").split(".").map(l=>parseInt(l,10));return {major:c[0],minor:c[1],patch:c[2]}}function r(u){let{CI:c,FORCE_HYPERLINK:l,NETLIFY:a,TEAMCITY_VERSION:s,TERM_PROGRAM:h,TERM_PROGRAM_VERSION:i,VTE_VERSION:n,TERM:f}=process.env;if(l)return !(l.length>0&&parseInt(l,10)===0);if(t("no-hyperlink")||t("no-hyperlinks")||t("hyperlink=false")||t("hyperlink=never"))return false;if(t("hyperlink=true")||t("hyperlink=always")||a)return true;if(!e.supportsColor(u)||u&&!u.isTTY)return false;if("WT_SESSION"in process.env)return true;if(process.platform==="win32"||c||s)return false;if(h){let d=o(i||"");switch(h){case "iTerm.app":return d.major===3?d.minor>=1:d.major>3;case "WezTerm":return d.major>=20200620;case "vscode":return d.major>1||d.major===1&&d.minor>=72;case "ghostty":return true}}if(n){if(n==="0.50.0")return false;let d=o(n);return d.major>0||d.minor>=50}switch(f){case "alacritty":return true}return false}return Fe={supportsHyperlink:r,stdout:r(process.stdout),stderr:r(process.stderr)},Fe}var Ds=Ns(),Ue=Ve(Ds);function W(e,t,{target:o="stdout",...r}={}){return Ue[o]?Is(e,t):r.fallback===false?e:typeof r.fallback=="function"?r.fallback(e,t):`${e} (\u200B${t}\u200B)`}W.isSupported=Ue.stdout;W.stderr=(e,t,o={})=>W(e,t,{target:"stderr",...o});W.stderr.isSupported=Ue.stderr;var C={},D={},Yt;function Ls(){if(Yt)return D;Yt=1,Object.defineProperty(D,"__esModule",{value:true}),D.sync=D.isexe=void 0;let e=Kt,t=Qe,o=async(l,a={})=>{let{ignoreErrors:s=false}=a;try{return u(await(0,t.stat)(l),a)}catch(h){let i=h;if(s||i.code==="EACCES")return false;throw i}};D.isexe=o;let r=(l,a={})=>{let{ignoreErrors:s=false}=a;try{return u((0,e.statSync)(l),a)}catch(h){let i=h;if(s||i.code==="EACCES")return false;throw i}};D.sync=r;let u=(l,a)=>l.isFile()&&c(l,a),c=(l,a)=>{let s=a.uid??process.getuid?.(),h=a.groups??process.getgroups?.()??[],i=a.gid??process.getgid?.()??h[0];if(s===void 0||i===void 0)throw new Error("cannot get uid or gid");let n=new Set([i,...h]),f=l.mode,d=l.uid,p=l.gid,g=parseInt("100",8),m=parseInt("010",8),b=parseInt("001",8),x=g|m;return !!(f&b||f&m&&n.has(p)||f&g&&d===s||f&x&&s===0)};return D}var L={},Ut;function Fs(){if(Ut)return L;Ut=1,Object.defineProperty(L,"__esModule",{value:true}),L.sync=L.isexe=void 0;let e=Kt,t=Qe,o=async(l,a={})=>{let{ignoreErrors:s=false}=a;try{return c(await(0,t.stat)(l),l,a)}catch(h){let i=h;if(s||i.code==="EACCES")return false;throw i}};L.isexe=o;let r=(l,a={})=>{let{ignoreErrors:s=false}=a;try{return c((0,e.statSync)(l),l,a)}catch(h){let i=h;if(s||i.code==="EACCES")return false;throw i}};L.sync=r;let u=(l,a)=>{let{pathExt:s=process.env.PATHEXT||""}=a,h=s.split(";");if(h.indexOf("")!==-1)return true;for(let i=0;i<h.length;i++){let n=h[i].toLowerCase(),f=l.substring(l.length-n.length).toLowerCase();if(n&&f===n)return true}return false},c=(l,a,s)=>l.isFile()&&u(a,s);return L}var He={},Bt;function Hs(){return Bt||(Bt=1,Object.defineProperty(He,"__esModule",{value:true})),He}var zt;function Gs(){return zt||(zt=1,function(e){var t=C&&C.__createBinding||(Object.create?function(h,i,n,f){f===void 0&&(f=n);var d=Object.getOwnPropertyDescriptor(i,n);(!d||("get"in d?!i.__esModule:d.writable||d.configurable))&&(d={enumerable:true,get:function(){return i[n]}}),Object.defineProperty(h,f,d);}:function(h,i,n,f){f===void 0&&(f=n),h[f]=i[n];}),o=C&&C.__setModuleDefault||(Object.create?function(h,i){Object.defineProperty(h,"default",{enumerable:true,value:i});}:function(h,i){h.default=i;}),r=C&&C.__importStar||function(h){if(h&&h.__esModule)return h;var i={};if(h!=null)for(var n in h)n!=="default"&&Object.prototype.hasOwnProperty.call(h,n)&&t(i,h,n);return o(i,h),i},u=C&&C.__exportStar||function(h,i){for(var n in h)n!=="default"&&!Object.prototype.hasOwnProperty.call(i,n)&&t(i,h,n);};Object.defineProperty(e,"__esModule",{value:true}),e.sync=e.isexe=e.posix=e.win32=void 0;let c=r(Ls());e.posix=c;let l=r(Fs());e.win32=l,u(Hs(),e);let s=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?l:c;e.isexe=s.isexe,e.sync=s.sync;}(C)),C}var Ge,Jt;function Vs(){if(Jt)return Ge;Jt=1;let{isexe:e,sync:t}=Gs(),{join:o,delimiter:r,sep:u,posix:c}=I,l=process.platform==="win32",a=new RegExp(`[${c.sep}${u===c.sep?"":u}]`.replace(/(\\)/g,"\\$1")),s=new RegExp(`^\\.${a.source}`),h=p=>Object.assign(new Error(`not found: ${p}`),{code:"ENOENT"}),i=(p,{path:g=process.env.PATH,pathExt:m=process.env.PATHEXT,delimiter:b=r})=>{let x=p.match(a)?[""]:[...l?[process.cwd()]:[],...(g||"").split(b)];if(l){let w=m||[".EXE",".CMD",".BAT",".COM"].join(b),y=w.split(b).flatMap(v=>[v,v.toLowerCase()]);return p.includes(".")&&y[0]!==""&&y.unshift(""),{pathEnv:x,pathExt:y,pathExtExe:w}}return {pathEnv:x,pathExt:[""]}},n=(p,g)=>{let m=/^".*"$/.test(p)?p.slice(1,-1):p;return (!m&&s.test(g)?g.slice(0,2):"")+o(m,g)},f=async(p,g={})=>{let{pathEnv:m,pathExt:b,pathExtExe:x}=i(p,g),w=[];for(let y of m){let v=n(y,p);for(let E of b){let $=v+E;if(await e($,{pathExt:x,ignoreErrors:true})){if(!g.all)return $;w.push($);}}}if(g.all&&w.length)return w;if(g.nothrow)return null;throw h(p)},d=(p,g={})=>{let{pathEnv:m,pathExt:b,pathExtExe:x}=i(p,g),w=[];for(let y of m){let v=n(y,p);for(let E of b){let $=v+E;if(t($,{pathExt:x,ignoreErrors:true})){if(!g.all)return $;w.push($);}}}if(g.all&&w.length)return w;if(g.nothrow)return null;throw h(p)};return Ge=f,f.sync=d,Ge}var Ws=Vs(),Ys=Ve(Ws);join(ts.tmpdir(),"antfu-ni");function tr(e){return Ys.sync(e,{nothrow:true})!==null}async function Be({autoInstall:e,programmatic:t,cwd:o}={}){let{name:r,agent:u,version:c}=await ee({cwd:o,onUnknown:l=>{t||console.warn("[ni] Unknown packageManager:",l);}})||{};if(r&&!tr(r)&&!t){if(!e){console.warn(`[ni] Detected ${r} but it doesn't seem to be installed.
49
+ `),R.env.CI&&R.exit(1);let l=W(r,Xe[r]),{tryInstall:a}=await js({name:"tryInstall",type:"confirm",message:`Would you like to globally install ${l}?`});a||R.exit(1);}await te("npm",["i","-g",`${r}${c?`@${c}`:""}`],{nodeOptions:{stdio:"inherit",cwd:o},throwOnError:true});}return u}R.env.NI_CONFIG_FILE;var Bs=R.platform==="win32"?R.env.USERPROFILE:R.env.HOME;I.join(Bs||"~/",".nirc");async function zs(e,{withFallback:t}={withFallback:false}){let o=await Be({programmatic:true,cwd:e});if(o==="yarn@berry")return "yarn";if(o==="pnpm@6")return "pnpm";if(o==="bun")return "bun";if(o==="deno")return "deno";if(!t)return o??"npm";let r=process.env.npm_config_user_agent||"";return r.startsWith("yarn")?"yarn":r.startsWith("pnpm")?"pnpm":r.startsWith("bun")?"bun":"npm"}async function rr(e){let t=await zs(e);return t==="pnpm"?"pnpm dlx":t==="bun"?"bunx":"npx"}var Js="shadcn@latest";async function G(e){return `${await rr(process.cwd())} ${Js} ${e}`}async function V(e=process.cwd()){return {registries:(await da(e,{useCache:false})).registries}}function ze(e,t){let{query:o,registries:r}=t||{},u=e.items.map(s=>{let h=[`- ${s.name}`];return s.type&&h.push(`(${s.type})`),s.description&&h.push(`- ${s.description}`),s.registry&&h.push(`[${s.registry}]`),h.push(`
50
+ Add command: \`${G(`add ${s.addCommandArgument}`)}\``),h.join(" ")}),c=`Found ${e.pagination.total} items`;o&&(c+=` matching "${o}"`),r&&r.length>0&&(c+=` in registries ${r.join(", ")}`),c+=":";let l=`Showing items ${e.pagination.offset+1}-${Math.min(e.pagination.offset+e.pagination.limit,e.pagination.total)} of ${e.pagination.total}:`,a=`${c}
51
+
52
+ ${l}
53
+
54
+ ${u.join(`
55
+
56
+ `)}`;return e.pagination.hasMore&&(a+=`
57
+
58
+ More items available. Use offset: ${e.pagination.offset+e.pagination.limit} to see the next page.`),a}function sr(e){return e.map(t=>[`## ${t.name}`,t.description?`
59
+ ${t.description}
60
+ `:"",t.type?`**Type:** ${t.type}`:"",t.files&&t.files.length>0?`**Files:** ${t.files.length} file(s)`:"",t.dependencies&&t.dependencies.length>0?`**Dependencies:** ${t.dependencies.join(", ")}`:"",t.devDependencies&&t.devDependencies.length>0?`**Dev Dependencies:** ${t.devDependencies.join(", ")}`:""].filter(Boolean).join(`
61
+ `))}function ir(e,t){let o=e.map(u=>{let c=[`## Example: ${u.name}`,u.description?`
62
+ ${u.description}
63
+ `:""];return u.files?.length&&u.files.forEach(l=>{l.content&&(c.push(`### Code (${l.path}):
64
+ `),c.push("```tsx"),c.push(l.content),c.push("```"));}),c.filter(Boolean).join(`
65
+ `)});return `# Usage Examples
66
+
67
+ Found ${e.length} example${e.length>1?"s":""} matching "${t}":
68
+ `+o.join(`
69
+
70
+ ---
71
+
72
+ `)}var nr=new Server({name:"shadcn",version:"1.0.0"},{capabilities:{resources:{},tools:{}}});nr.setRequestHandler(ListToolsRequestSchema,async()=>({tools:[{name:"get_project_registries",description:"Get configured registry names from components.json - Returns error if no components.json exists (use init_project to create one)",inputSchema:zodToJsonSchema(z.object({}))},{name:"list_items_in_registries",description:"List items from registries (requires components.json - use init_project if missing)",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),limit:z.number().optional().describe("Maximum number of items to return"),offset:z.number().optional().describe("Number of items to skip for pagination")}))},{name:"search_items_in_registries",description:"Search for components in registries using fuzzy matching (requires components.json). After finding an item, use get_item_examples_from_registries to see usage examples.",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),query:z.string().describe("Search query string for fuzzy matching against item names and descriptions"),limit:z.number().optional().describe("Maximum number of items to return"),offset:z.number().optional().describe("Number of items to skip for pagination")}))},{name:"view_items_in_registries",description:"View detailed information about specific registry items including the name, description, type and files content. For usage examples, use get_item_examples_from_registries instead.",inputSchema:zodToJsonSchema(z.object({items:z.array(z.string()).describe("Array of item names with registry prefix (e.g., ['@shadcn/button', '@shadcn/card'])")}))},{name:"get_item_examples_from_registries",description:"Find usage examples and demos with their complete code. Search for patterns like 'accordion-demo', 'button example', 'card-demo', etc. Returns full implementation code with dependencies.",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),query:z.string().describe("Search query for examples (e.g., 'accordion-demo', 'button demo', 'card example', 'tooltip-demo', 'example-booking-form', 'example-hero'). Common patterns: '{item-name}-demo', '{item-name} example', 'example {item-name}'")}))},{name:"get_add_command_for_items",description:"Get the shadcn CLI add command for specific items in a registry. This is useful for adding one or more components to your project.",inputSchema:zodToJsonSchema(z.object({items:z.array(z.string()).describe("Array of items to get the add command for prefixed with the registry name (e.g., ['@shadcn/button', '@shadcn/card'])")}))},{name:"get_audit_checklist",description:"After creating new components or generating new code files, use this tool for a quick checklist to verify that everything is working as expected. Make sure to run the tool after all required steps have been completed.",inputSchema:zodToJsonSchema(z.object({}))}]}));nr.setRequestHandler(CallToolRequestSchema,async e=>{try{if(!e.params.arguments)throw new Error("No tool arguments provided.");switch(e.params.name){case "get_project_registries":{let t=await V(process.cwd());return t?.registries?{content:[{type:"text",text:P`The following registries are configured in the current project:
73
+
74
+ ${Object.keys(t.registries).map(o=>`- ${o}`).join(`
75
+ `)}
76
+
77
+ You can view the items in a registry by running:
78
+ \`${await G("view @name-of-registry")}\`
79
+
80
+ For example: \`${await G("view @shadcn")}\` or \`${await G("view @shadcn @acme")}\` to view multiple registries.
81
+ `}]}:{content:[{type:"text",text:P`No components.json found or no registries configured.
82
+
83
+ To fix this:
84
+ 1. Use the \`init\` command to create a components.json file
85
+ 2. Or manually create components.json with a registries section`}]}}case "search_items_in_registries":{let o=z.object({registries:z.array(z.string()),query:z.string(),limit:z.number().optional(),offset:z.number().optional()}).parse(e.params.arguments),r=await va(o.registries,{query:o.query,limit:o.limit,offset:o.offset,config:await V(process.cwd()),useCache:!1});return r.items.length===0?{content:[{type:"text",text:P`No items found matching "${o.query}" in registries ${o.registries.join(", ")}, Try searching with a different query or registry.`}]}:{content:[{type:"text",text:ze(r,{query:o.query,registries:o.registries})}]}}case "list_items_in_registries":{let o=z.object({registries:z.array(z.string()),limit:z.number().optional(),offset:z.number().optional(),cwd:z.string().optional()}).parse(e.params.arguments),r=await va(o.registries,{limit:o.limit,offset:o.offset,config:await V(process.cwd()),useCache:!1});return r.items.length===0?{content:[{type:"text",text:P`No items found in registries ${o.registries.join(", ")}.`}]}:{content:[{type:"text",text:ze(r,{registries:o.registries})}]}}case "view_items_in_registries":{let o=z.object({items:z.array(z.string())}).parse(e.params.arguments),r=await ba(o.items,{config:await V(process.cwd()),useCache:!1});if(r?.length===0)return {content:[{type:"text",text:P`No items found for: ${o.items.join(", ")}
86
+
87
+ Make sure the item names are correct and include the registry prefix (e.g., @shadcn/button).`}]};let u=sr(r);return {content:[{type:"text",text:P`Item Details:
88
+
89
+ ${u.join(`
90
+
91
+ ---
92
+
93
+ `)}`}]}}case "get_item_examples_from_registries":{let o=z.object({query:z.string(),registries:z.array(z.string())}).parse(e.params.arguments),r=await V(),u=await va(o.registries,{query:o.query,config:r,useCache:!1});if(u.items.length===0)return {content:[{type:"text",text:P`No examples found for query "${o.query}".
94
+
95
+ Try searching with patterns like:
96
+ - "accordion-demo" for accordion examples
97
+ - "button demo" or "button example"
98
+ - Component name followed by "-demo" or "example"
99
+
100
+ You can also:
101
+ 1. Use search_items_in_registries to find all items matching your query
102
+ 2. View the main component with view_items_in_registries for inline usage documentation`}]};let c=u.items.map(a=>a.addCommandArgument),l=await ba(c,{config:r,useCache:!1});return {content:[{type:"text",text:ir(l,o.query)}]}}case "get_add_command_for_items":{let t=z.object({items:z.array(z.string())}).parse(e.params.arguments);return {content:[{type:"text",text:await G(`add ${t.items.join(" ")}`)}]}}case "get_audit_checklist":return {content:[{type:"text",text:P`## Component Audit Checklist
103
+
104
+ After adding or generating components, check the following common issues:
105
+
106
+ - [ ] Ensure imports are correct i.e named vs default imports
107
+ - [ ] If using next/image, ensure images.remotePatterns next.config.js is configured correctly.
108
+ - [ ] Ensure all dependencies are installed.
109
+ - [ ] Check for linting errors or warnings
110
+ - [ ] Check for TypeScript errors
111
+ - [ ] Use the Playwright MCP if available.
112
+ `}]};default:throw new Error(`Tool ${e.params.name} not found`)}}catch(t){if(t instanceof z.ZodError)return {content:[{type:"text",text:P`Invalid input parameters:
113
+ ${t.errors.map(r=>`- ${r.path.join(".")}: ${r.message}`).join(`
114
+ `)}
115
+ `}],isError:true};if(t instanceof f){let r=t.message;return t.suggestion&&(r+=`
116
+
117
+ \u{1F4A1} ${t.suggestion}`),t.context&&(r+=`
118
+
119
+ Context: ${JSON.stringify(t.context,null,2)}`),{content:[{type:"text",text:P`Error (${t.code}): ${r}`}],isError:true}}let o=t instanceof Error?t.message:String(t);return {content:[{type:"text",text:P`Error: ${o}`}],isError:true}}});export{zs as a,nr as b};