UNPKG

create-vite

Version:

> **Compatibility Note:** > Vite requires [Node.js](https://nodejs.org/en/) version 20.19+, 22.12+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.

84 lines (79 loc) 55.8 kB
import{createRequire as e}from"node:module";import t from"node:fs";import n from"node:path";import{fileURLToPath as r}from"node:url";import{stripVTControlCharacters as i,styleText as a}from"node:util";import o,{stdin as s,stdout as c}from"node:process";import"node:readline";import l from"node:readline";import"node:tty";var u=Object.create,d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=p(t),a=0,o=i.length,s;a<o;a++)s=i[a],!h.call(e,s)&&s!==n&&d(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=f(t,s))||r.enumerable});return e},v=(e,t,n)=>(n=e==null?{}:u(m(e)),_(t||!e||!e.__esModule?d(n,`default`,{value:e,enumerable:!0}):n,e)),y=e(import.meta.url),b=g(((e,t)=>{t.exports=a,a.sync=o;var n=y(`fs`);function r(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function i(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:r(t,n)}function a(e,t,r){n.stat(e,function(n,a){r(n,n?!1:i(a,e,t))})}function o(e,t){return i(n.statSync(e),e,t)}})),x=g(((e,t)=>{t.exports=r,r.sync=i;var n=y(`fs`);function r(e,t,r){n.stat(e,function(e,n){r(e,e?!1:a(n,t))})}function i(e,t){return a(n.statSync(e),t)}function a(e,t){return e.isFile()&&o(e,t)}function o(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),S=g(((e,t)=>{y(`fs`);var n=process.platform===`win32`||global.TESTING_WINDOWS?b():x();t.exports=r,r.sync=i;function r(e,t,i){if(typeof t==`function`&&(i=t,t={}),!i){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,i){r(e,t||{},function(e,t){e?i(e):n(t)})})}n(e,t||{},function(e,n){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,n=!1),i(e,n)})}function i(e,t){try{return n.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),C=g(((e,t)=>{let n=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,r=y(`path`),i=n?`;`:`:`,a=S(),o=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),s=(e,t)=>{let r=t.colon||i,a=e.match(/\//)||n&&e.match(/\\/)?[``]:[...n?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(r)],o=n?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=n?o.split(r):[``];return n&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:a,pathExt:s,pathExtExe:o}},c=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:i,pathExt:c,pathExtExe:l}=s(e,t),u=[],d=n=>new Promise((a,s)=>{if(n===i.length)return t.all&&u.length?a(u):s(o(e));let c=i[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=r.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,o)=>{if(r===c.length)return i(d(n+1));let s=c[r];a(e+s,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+s);else return i(e+s);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};t.exports=c,c.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:i,pathExtExe:c}=s(e,t),l=[];for(let o=0;o<n.length;o++){let s=n[o],u=/^".*"$/.test(s)?s.slice(1,-1):s,d=r.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<i.length;e++){let n=f+i[e];try{if(a.sync(n,{pathExt:c}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw o(e)}})),w=g(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),ee=g(((e,t)=>{let n=y(`path`),r=C(),i=w();function a(e,t){let a=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=r.sync(e.command,{path:a[i({env:a})],pathExt:t?n.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=n.resolve(s?e.options.cwd:``,l),l}function o(e){return a(e)||a(e,!0)}t.exports=o})),te=g(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),ne=g(((e,t)=>{t.exports=/^#!(.*)/})),re=g(((e,t)=>{let n=ne();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),ie=g(((e,t)=>{let n=y(`fs`),r=re();function i(e){let t=Buffer.alloc(150),i;try{i=n.openSync(e,`r`),n.readSync(i,t,0,150,0),n.closeSync(i)}catch{}return r(t.toString())}t.exports=i})),ae=g(((e,t)=>{let n=y(`path`),r=ee(),i=te(),a=ie(),o=process.platform===`win32`,s=/\.(?:com|exe)$/i,c=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(e){e.file=r(e);let t=e.file&&a(e.file);return t?(e.args.unshift(e.file),e.command=t,r(e)):e.file}function u(e){if(!o)return e;let t=l(e),r=!s.test(t);if(e.options.forceShell||r){let r=c.test(t);e.command=n.normalize(e.command),e.command=i.command(e.command),e.args=e.args.map(e=>i.argument(e,r)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function d(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:u(r)}t.exports=d})),oe=g(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),se=g(((e,t)=>{let n=y(`child_process`),r=ae(),i=oe();function a(e,t,a){let o=r(e,t,a),s=n.spawn(o.command,o.args,o.options);return i.hookChildProcess(s,o),s}function o(e,t,a){let o=r(e,t,a),s=n.spawnSync(o.command,o.args,o.options);return s.error=s.error||i.verifyENOENTSync(s.status,o),s}t.exports=a,t.exports.spawn=a,t.exports.sync=o,t.exports._parse=r,t.exports._enoent=i})),ce=g(((e,t)=>{function n(e){return e==null?[]:Array.isArray(e)?e:[e]}function r(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}t.exports=function(e,t){e||=[],t||={};var i,a,o,s,c,l={_:[]},u=0,d=0,f=0,p=e.length;let m=t.alias!==void 0,h=t.unknown!==void 0,g=t.default!==void 0;if(t.alias=t.alias||{},t.string=n(t.string),t.boolean=n(t.boolean),m)for(i in t.alias)for(a=t.alias[i]=n(t.alias[i]),u=0;u<a.length;u++)(t.alias[a[u]]=a.concat(i)).splice(u,1);for(u=t.boolean.length;u-- >0;)for(a=t.alias[t.boolean[u]]||[],d=a.length;d-- >0;)t.boolean.push(a[d]);for(u=t.string.length;u-- >0;)for(a=t.alias[t.string[u]]||[],d=a.length;d-- >0;)t.string.push(a[d]);if(g){for(i in t.default)if(s=typeof t.default[i],a=t.alias[i]=t.alias[i]||[],t[s]!==void 0)for(t[s].push(i),u=0;u<a.length;u++)t[s].push(a[u])}let _=h?Object.keys(t.alias):[];for(u=0;u<p;u++){if(o=e[u],o===`--`){l._=l._.concat(e.slice(++u));break}for(d=0;d<o.length&&o.charCodeAt(d)===45;d++);if(d===0)l._.push(o);else if(o.substring(d,d+3)===`no-`){if(s=o.substring(d+3),h&&!~_.indexOf(s))return t.unknown(o);l[s]=!1}else{for(f=d+1;f<o.length&&o.charCodeAt(f)!==61;f++);for(s=o.substring(d,f),c=o.substring(++f)||u+1===p||(``+e[u+1]).charCodeAt(0)===45||e[++u],a=d===2?[s]:s,f=0;f<a.length;f++){if(s=a[f],h&&!~_.indexOf(s))return t.unknown(`-`.repeat(d)+s);r(l,s,f+1<a.length||c,t)}}}if(g)for(i in t.default)l[i]===void 0&&(l[i]=t.default[i]);if(m)for(i in l)for(a=t.alias[i]||[];a.length>0;)l[a.shift()]=l[i];return l}})),le=g(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),ue=v(ce(),1),de=v(se(),1),T=le();function E(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a].disabled?E(a,t<0?-1:1,n):a}const fe=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,pe=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,me=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,he=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,D=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,O=/\t{1,1000}/y,ge=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,k=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,_e=/\p{M}+/gu,ve={limit:1/0,ellipsis:``},ye=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?ye(i,ve,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;t:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(_e,``)){let t=e.codePointAt(0)||0;if(w=pe(t)?d:me(t)?p:l!==f&&fe(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break t}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(k.lastIndex=h,k.test(e)){if(_=k.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=k.lastIndex;continue}if(he.lastIndex=h,he.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=he.lastIndex;continue}if(D.lastIndex=h,D.test(e)){if(_=D.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=D.lastIndex;continue}if(O.lastIndex=h,O.test(e)){if(_=O.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=O.lastIndex;continue}if(ge.lastIndex=h,ge.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=ge.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},be={limit:1/0,ellipsis:``,ellipsisWidth:0},A=(e,t={})=>ye(e,be,t).width,xe=`]8;;`,Se=RegExp(`(?:\\[(?<code>\\d+)m|\\${xe}(?<uri>.*))`,`y`),Ce=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},we=e=>`[${e}m`,Te=e=>`${xe}${e}`,Ee=e=>e.map(e=>A(e)),De=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:A(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=A(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(xe,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},Oe=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(A(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=Ee(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=A(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),De(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){De(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){De(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>Oe(e)));let l=c.join(` `),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===`›`){Se.lastIndex=p+1;let e=Se.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?Ce(i):void 0;t===` `?(a&&(r+=Te(``)),i&&n&&(r+=we(n))):e===` `&&(i&&n&&(r+=we(i)),a&&(r+=Te(a))),p+=e.length,d=f,f=u.next()}return r};function Ae(e,t,n){return String(e).normalize().replaceAll(`\r `,` `).split(` `).map(e=>ke(e,t,n)).join(` `)}const j={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0};function je(e,t){if(typeof e==`string`)return j.aliases.get(e)===t;for(let n of e)if(n!==void 0&&je(n,t))return!0;return!1}function Me(e,t){if(e===t)return;let n=e.split(` `),r=t.split(` `),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}globalThis.process.platform.startsWith(`win`);const Ne=Symbol(`clack:cancel`);function M(e){return e===Ne}function N(e,t){let n=e;n.isTTY&&n.setRawMode(t)}const Pe=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,Fe=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function Ie(e,t,n,r=n){return Ae(t,Pe(e??c)-n.length,{hard:!0,trim:!1}).split(` `).map((e,t)=>`${t===0?r:n}${e}`).join(` `)}var Le=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;constructor(e,t=!0){let{input:n=s,output:r=c,render:i,signal:a,...o}=e;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=t,this._abortSignal=a,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(Ne);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=l.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),N(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(T.cursor.show),this.output.off(`resize`,this.render),N(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(T.cursor.show),this.output.off(`resize`,this.render),N(this.input,!1),e(Ne)})})}_isActionKey(e,t){return e===` `}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}onKeypress(e,t){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&j.aliases.has(t.name)&&this.emit(`cursor`,j.aliases.get(t.name)),j.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e?.toLowerCase(),t),t?.name===`return`){if(this.opts.validate){let e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}je([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(` `),N(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Ae(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(` `).length-1;this.output.write(T.cursor.move(-999,e*-1))}render(){let e=Ae(this._render(this)??``,process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(T.cursor.hide);else{let t=Me(this._prevFrame,e),n=Fe(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(T.cursor.move(0,a-i)),this.output.write(T.erase.lines(1));let t=e.split(` `);this.output.write(t[a]),this._prevFrame=e,this.output.write(T.cursor.move(0,t.length-a-1));return}else if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(T.cursor.move(0,e))}this.output.write(T.erase.down());let t=e.split(` `).slice(a);this.output.write(t.join(` `)),this._prevFrame=e;return}}this.output.write(T.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},Re=class extends Le{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on(`userInput`,()=>{this.value=this._value}),this.on(`confirm`,e=>{this.output.write(T.cursor.move(0,-1)),this.value=e,this.state=`submit`,this.close()}),this.on(`cursor`,()=>{this.value=!this.value})}},ze=class extends Le{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n].disabled?E(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=E(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=E(this.cursor,1,this.options);break}this.changeValue()})}},Be=class extends Le{get userInputWithCursor(){if(this.state===`submit`)return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let t=e.slice(0,this.cursor),[n,...r]=e.slice(this.cursor);return`${t}${a(`inverse`,n)}${r.join(``)}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on(`userInput`,e=>{this._setValue(e)}),this.on(`finalize`,()=>{this.value||=e.defaultValue,this.value===void 0&&(this.value=``)})}};function Ve(){return o.platform===`win32`?!!o.env.CI||!!o.env.WT_SESSION||!!o.env.TERMINUS_SUBLIME||o.env.ConEmuTask===`{cmd::Cmder}`||o.env.TERM_PROGRAM===`Terminus-Sublime`||o.env.TERM_PROGRAM===`vscode`||o.env.TERM===`xterm-256color`||o.env.TERM===`alacritty`||o.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:o.env.TERM!==`linux`}const He=Ve(),P=(e,t)=>He?e:t,Ue=P(`◆`,`*`),We=P(`■`,`x`),Ge=P(`▲`,`x`),Ke=P(`◇`,`o`),F=P(`│`,`|`),I=P(`└`,`—`),qe=P(`●`,`>`),L=P(`○`,` `),Je=P(`●`,`•`),Ye=P(`◆`,`*`),Xe=P(`▲`,`!`),Ze=P(`■`,`x`),Qe=e=>{switch(e){case`initial`:case`active`:return a(`cyan`,Ue);case`cancel`:return a(`red`,We);case`error`:return a(`yellow`,Ge);case`submit`:return a(`green`,Ke)}},$e=e=>{switch(e){case`initial`:case`active`:return a(`cyan`,F);case`cancel`:return a(`red`,F);case`error`:return a(`yellow`,F);case`submit`:return a(`green`,F)}},et=e=>e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109,tt=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,nt=e=>e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9800&&e<=9811||e===9855||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101632&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129672||e>=129680&&e<=129725||e>=129727&&e<=129733||e>=129742&&e<=129755||e>=129760&&e<=129768||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141,rt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y,R=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,z=/\t{1,1000}/y,it=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,B=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,at=/\p{M}+/gu,ot={limit:1/0,ellipsis:``},st=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?st(i,ot,n).width:0),o=n.ansiWidth??0,s=n.controlWidth??0,c=n.tabWidth??8,l=n.ambiguousWidth??1,u=n.emojiWidth??2,d=n.fullWidthWidth??2,f=n.regularWidth??1,p=n.wideWidth??2,m=0,h=0,g=e.length,_=0,v=!1,y=g,b=Math.max(0,r-a),x=0,S=0,C=0,w=0;e:for(;;){if(S>x||h>=g&&h>m){let t=e.slice(x,S)||e.slice(m,h);_=0;for(let e of t.replaceAll(at,``)){let t=e.codePointAt(0)||0;if(w=tt(t)?d:nt(t)?p:l!==f&&et(t)?l:f,C+w>b&&(y=Math.min(y,Math.max(x,m)+_)),C+w>r){v=!0;break e}_+=e.length,C+=w}x=S=0}if(h>=g)break;if(B.lastIndex=h,B.test(e)){if(_=B.lastIndex-h,w=_*f,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/f))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=B.lastIndex;continue}if(rt.lastIndex=h,rt.test(e)){if(C+o>b&&(y=Math.min(y,h)),C+o>r){v=!0;break}C+=o,x=m,S=h,h=m=rt.lastIndex;continue}if(R.lastIndex=h,R.test(e)){if(_=R.lastIndex-h,w=_*s,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/s))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=R.lastIndex;continue}if(z.lastIndex=h,z.test(e)){if(_=z.lastIndex-h,w=_*c,C+w>b&&(y=Math.min(y,h+Math.floor((b-C)/c))),C+w>r){v=!0;break}C+=w,x=m,S=h,h=m=z.lastIndex;continue}if(it.lastIndex=h,it.test(e)){if(C+u>b&&(y=Math.min(y,h)),C+u>r){v=!0;break}C+=u,x=m,S=h,h=m=it.lastIndex;continue}h+=1}return{width:v?b:C,index:v?y:g,truncated:v,ellipsed:v&&r>=a}},ct={limit:1/0,ellipsis:``,ellipsisWidth:0},V=(e,t={})=>st(e,ct,t).width,lt=`]8;;`,ut=RegExp(`(?:\\[(?<code>\\d+)m|\\${lt}(?<uri>.*))`,`y`),dt=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},ft=e=>`[${e}m`,pt=e=>`${lt}${e}`,mt=e=>e.map(e=>V(e)),ht=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:V(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=V(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(lt,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length>0&&e.length>1&&(e[e.length-2]+=e.pop())},gt=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(V(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},_t=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=mt(o),c=[``];for(let[e,r]of o.entries()){n.trim!==!1&&(c[c.length-1]=(c.at(-1)??``).trimStart());let i=V(c.at(-1)??``);if(e!==0&&(i>=t&&(n.wordWrap===!1||n.trim===!1)&&(c.push(``),i=0),(i>0||n.trim===!1)&&(c[c.length-1]+=` `,i++)),n.hard&&s[e]>t){let n=t-i,a=1+Math.floor((s[e]-n-1)/t);Math.floor((s[e]-1)/t)<a&&c.push(``),ht(c,r,t);continue}if(i+s[e]>t&&i>0&&s[e]>0){if(n.wordWrap===!1&&i<t){ht(c,r,t);continue}c.push(``)}if(i+s[e]>t&&n.wordWrap===!1){ht(c,r,t);continue}c[c.length-1]+=r}n.trim!==!1&&(c=c.map(e=>gt(e)));let l=c.join(` `),u=l[Symbol.iterator](),d=u.next(),f=u.next(),p=0;for(;!d.done;){let e=d.value,t=f.value;if(r+=e,e===`\x1B`||e===`›`){ut.lastIndex=p+1;let e=ut.exec(l)?.groups;if(e?.code!==void 0){let t=Number.parseFloat(e.code);i=t===39?void 0:t}else e?.uri!==void 0&&(a=e.uri.length===0?void 0:e.uri)}let n=i?dt(i):void 0;t===` `?(a&&(r+=pt(``)),i&&n&&(r+=ft(n))):e===` `&&(i&&n&&(r+=ft(i)),a&&(r+=pt(a))),p+=e.length,d=f,f=u.next()}return r};function vt(e,t,n){return String(e).normalize().replaceAll(`\r `,` `).split(` `).map(e=>_t(e,t,n)).join(` `)}const yt=(e,t,n,r,i)=>{let a=t,o=0;for(let t=n;t<r;t++){let n=e[t];if(a-=n.length,o++,a<=i)break}return{lineCount:a,removals:o}},bt=({cursor:e,options:t,style:n,output:r=process.stdout,maxItems:i=1/0,columnPadding:o=0,rowPadding:s=4})=>{let c=Pe(r)-o,l=Fe(r),u=a(`dim`,`...`),d=Math.max(l-s,0),f=Math.max(Math.min(i,d),5),p=0;e>=f-3&&(p=Math.max(Math.min(e-f+3,t.length-f),0));let m=f<t.length&&p>0,h=f<t.length&&p+f<t.length,g=Math.min(p+f,t.length),_=[],v=0;m&&v++,h&&v++;let y=p+(m?1:0),b=g-(h?1:0);for(let r=y;r<b;r++){let i=vt(n(t[r],r===e),c,{hard:!0,trim:!1}).split(` `);_.push(i),v+=i.length}if(v>d){let t=0,n=0,r=v,i=e-y,a=(e,t)=>yt(_,r,e,t,d);m?({lineCount:r,removals:t}=a(0,i),r>d&&({lineCount:r,removals:n}=a(i+1,_.length))):({lineCount:r,removals:n}=a(i+1,_.length),r>d&&({lineCount:r,removals:t}=a(0,i))),t>0&&(m=!0,_.splice(0,t)),n>0&&(h=!0,_.splice(_.length-n,n))}let x=[];m&&x.push(u);for(let e of _)for(let t of e)x.push(t);return h&&x.push(u),x},xt=e=>{let t=e.active??`Yes`,n=e.inactive??`No`;return new Re({active:t,inactive:n,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let r=e.withGuide??j.withGuide,i=`${r?`${a(`gray`,F)} `:``}${Qe(this.state)} ${e.message} `,o=this.value?t:n;switch(this.state){case`submit`:return`${i}${r?`${a(`gray`,F)} `:``}${a(`dim`,o)}`;case`cancel`:return`${i}${r?`${a(`gray`,F)} `:``}${a([`strikethrough`,`dim`],o)}${r?` ${a(`gray`,F)}`:``}`;default:{let o=r?`${a(`cyan`,F)} `:``,s=r?a(`cyan`,I):``;return`${i}${o}${this.value?`${a(`green`,qe)} ${t}`:`${a(`dim`,L)} ${a(`dim`,t)}`}${e.vertical?r?` ${a(`cyan`,F)} `:` `:` ${a(`dim`,`/`)} `}${this.value?`${a(`dim`,L)} ${a(`dim`,n)}`:`${a(`green`,qe)} ${n}`} ${s} `}}}}).prompt()},H={message:(e=[],{symbol:t=a(`gray`,F),secondarySymbol:n=a(`gray`,F),output:r=process.stdout,spacing:i=1,withGuide:o}={})=>{let s=[],c=o??j.withGuide,l=c?n:``,u=c?`${t} `:``,d=c?`${n} `:``;for(let e=0;e<i;e++)s.push(l);let f=Array.isArray(e)?e:e.split(` `);if(f.length>0){let[e,...r]=f;e.length>0?s.push(`${u}${e}`):s.push(c?t:``);for(let e of r)e.length>0?s.push(`${d}${e}`):s.push(c?n:``)}r.write(`${s.join(` `)} `)},info:(e,t)=>{H.message(e,{...t,symbol:a(`blue`,Je)})},success:(e,t)=>{H.message(e,{...t,symbol:a(`green`,Ye)})},step:(e,t)=>{H.message(e,{...t,symbol:a(`green`,Ke)})},warn:(e,t)=>{H.message(e,{...t,symbol:a(`yellow`,Xe)})},warning:(e,t)=>{H.warn(e,t)},error:(e,t)=>{H.message(e,{...t,symbol:a(`red`,Ze)})}},St=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??j.withGuide?`${a(`gray`,I)} `:``;n.write(`${r}${a(`red`,e)} `)},Ct=(e=``,t)=>{let n=t?.output??process.stdout,r=t?.withGuide??j.withGuide?`${a(`gray`,F)} ${a(`gray`,I)} `:``;n.write(`${r}${e} `)},U=(e,t)=>e.includes(` `)?e.split(` `).map(e=>t(e)).join(` `):t(e),wt=e=>{let t=(e,t)=>{let n=e.label??String(e.value);switch(t){case`disabled`:return`${a(`gray`,L)} ${U(n,e=>a(`gray`,e))}${e.hint?` ${a(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${U(n,e=>a(`dim`,e))}`;case`active`:return`${a(`green`,qe)} ${n}${e.hint?` ${a(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${U(n,e=>a([`strikethrough`,`dim`],e))}`;default:return`${a(`dim`,L)} ${U(n,e=>a(`dim`,e))}`}};return new ze({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let n=e.withGuide??j.withGuide,r=`${Qe(this.state)} `,i=`${$e(this.state)} `,o=Ie(e.output,e.message,i,r),s=`${n?`${a(`gray`,F)} `:``}${o} `;switch(this.state){case`submit`:{let r=n?`${a(`gray`,F)} `:``;return`${s}${Ie(e.output,t(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=n?`${a(`gray`,F)} `:``;return`${s}${Ie(e.output,t(this.options[this.cursor],`cancelled`),r)}${n?` ${a(`gray`,F)}`:``}`}default:{let r=n?`${a(`cyan`,F)} `:``,i=n?a(`cyan`,I):``,o=s.split(` `).length,c=n?2:1;return`${s}${r}${bt({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:r.length,rowPadding:o+c,style:(e,n)=>t(e,e.disabled?`disabled`:n?`active`:`inactive`)}).join(` ${r}`)} ${i} `}}}}).prompt()},Tt=`${a(`gray`,F)} `,W={message:async(e,{symbol:t=a(`gray`,F)}={})=>{process.stdout.write(`${a(`gray`,F)} ${t} `);let n=3;for await(let t of e){t=t.replace(/\n/g,` ${Tt}`),t.includes(` `)&&(n=3+i(t.slice(t.lastIndexOf(` `))).length);let e=i(t).length;n+e<process.stdout.columns?(n+=e,process.stdout.write(t)):(process.stdout.write(` ${Tt}${t.trimStart()}`),n=3+i(t.trimStart()).length)}process.stdout.write(` `)},info:e=>W.message(e,{symbol:a(`blue`,Je)}),success:e=>W.message(e,{symbol:a(`green`,Ye)}),step:e=>W.message(e,{symbol:a(`green`,Ke)}),warn:e=>W.message(e,{symbol:a(`yellow`,Xe)}),warning:e=>W.warn(e),error:e=>W.message(e,{symbol:a(`red`,Ze)})},Et=e=>new Be({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let t=e?.withGuide??j.withGuide,n=`${`${t?`${a(`gray`,F)} `:``}${Qe(this.state)} `}${e.message} `,r=e.placeholder?a(`inverse`,e.placeholder[0])+a(`dim`,e.placeholder.slice(1)):a([`inverse`,`hidden`],`_`),i=this.userInput?this.userInputWithCursor:r,o=this.value??``;switch(this.state){case`error`:{let e=this.error?` ${a(`yellow`,this.error)}`:``,r=t?`${a(`yellow`,F)} `:``,o=t?a(`yellow`,I):``;return`${n.trim()} ${r}${i} ${o}${e} `}case`submit`:{let e=o?` ${a(`dim`,o)}`:``;return`${n}${t?a(`gray`,F):``}${e}`}case`cancel`:{let e=o?` ${a([`strikethrough`,`dim`],o)}`:``,r=t?a(`gray`,F):``;return`${n}${r}${e}${o.trim()?` ${r}`:``}`}default:return`${n}${t?`${a(`cyan`,F)} `:``}${i} ${t?a(`cyan`,I):``} `}}}).prompt();var Dt=g(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),Ot=g(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{KNOWN_AGENTS:()=>ee,determineAgent:()=>te}),t.exports=c(l);var u=y(`node:fs/promises`),d=y(`node:fs`);let f=`cursor`,p=`cursor-cli`,m=`claude`,h=`cowork`,g=`devin`,_=`replit`,v=`gemini`,b=`codex`,x=`antigravity`,S=`augment-cli`,C=`opencode`,w=`github-copilot`,ee={CURSOR:f,CURSOR_CLI:p,CLAUDE:m,COWORK:h,DEVIN:g,REPLIT:_,GEMINI:v,CODEX:b,ANTIGRAVITY:x,AUGMENT_CLI:S,OPENCODE:C,GITHUB_COPILOT:w};async function te(){if(process.env.AI_AGENT){let e=process.env.AI_AGENT.trim();if(e)return e===w||e===`github-copilot-cli`?{isAgent:!0,agent:{name:w}}:{isAgent:!0,agent:{name:e}}}if(process.env.CURSOR_TRACE_ID)return{isAgent:!0,agent:{name:f}};if(process.env.CURSOR_AGENT)return{isAgent:!0,agent:{name:p}};if(process.env.GEMINI_CLI)return{isAgent:!0,agent:{name:v}};if(process.env.CODEX_SANDBOX||process.env.CODEX_CI||process.env.CODEX_THREAD_ID)return{isAgent:!0,agent:{name:b}};if(process.env.ANTIGRAVITY_AGENT)return{isAgent:!0,agent:{name:x}};if(process.env.AUGMENT_AGENT)return{isAgent:!0,agent:{name:S}};if(process.env.OPENCODE_CLIENT)return{isAgent:!0,agent:{name:C}};if(process.env.CLAUDECODE||process.env.CLAUDE_CODE)return process.env.CLAUDE_CODE_IS_COWORK?{isAgent:!0,agent:{name:h}}:{isAgent:!0,agent:{name:m}};if(process.env.REPL_ID)return{isAgent:!0,agent:{name:_}};if(process.env.COPILOT_MODEL||process.env.COPILOT_ALLOW_ALL||process.env.COPILOT_GITHUB_TOKEN)return{isAgent:!0,agent:{name:w}};try{return await(0,u.access)(`/opt/.devin`,d.constants.F_OK),{isAgent:!0,agent:{name:g}}}catch{}return{isAgent:!1,agent:void 0}}})),kt=v(Dt(),1),At=Ot();const{blue:G,blueBright:K,cyan:q,green:jt,greenBright:Mt,magenta:J,red:Y,redBright:X,reset:Z,underline:Nt,yellow:Q}=kt.default,$=(0,ue.default)(process.argv.slice(2),{boolean:[`help`,`overwrite`,`immediate`,`interactive`],alias:{h:`help`,t:`template`,i:`immediate`},string:[`template`]}),Pt=process.cwd(),Ft=`\ Usage: create-vite [OPTION]... [DIRECTORY] Create a new Vite project in JavaScript or TypeScript. When running in TTY, the CLI will start in interactive mode. Options: -t, --template NAME use a specific template -i, --immediate install dependencies and start dev --interactive / --no-interactive force interactive / non-interactive mode Available templates: ${Q(`vanilla-ts vanilla`)} ${jt(`vue-ts vue`)} ${q(`react-ts react`)} ${q(`react-compiler-ts react-compiler`)} ${J(`preact-ts preact`)} ${X(`lit-ts lit`)} ${Y(`svelte-ts svelte`)} ${G(`solid-ts solid`)} ${K(`qwik-ts qwik`)}`,It=[{name:`vanilla`,display:`Vanilla`,color:Q,variants:[{name:`vanilla-ts`,display:`TypeScript`,color:G},{name:`vanilla`,display:`JavaScript`,color:Q}]},{name:`vue`,display:`Vue`,color:jt,variants:[{name:`vue-ts`,display:`TypeScript`,color:G},{name:`vue`,display:`JavaScript`,color:Q},{name:`custom-create-vue`,display:`Official Vue Starter ↗`,color:jt,customCommand:`npm create vue@latest TARGET_DIR`},{name:`custom-nuxt`,display:`Nuxt ↗`,link:`https://nuxt.com`,color:Mt,customCommand:`npm exec nuxi init TARGET_DIR`},{name:`custom-vike-vue`,display:`Vike ↗`,link:`https://vike.dev`,color:Mt,customCommand:`npm create -- vike@latest --vue TARGET_DIR`}]},{name:`react`,display:`React`,color:q,variants:[{name:`react-ts`,display:`TypeScript`,color:G},{name:`react-compiler-ts`,display:`TypeScript + React Compiler`,color:G},{name:`react`,display:`JavaScript`,color:Q},{name:`react-compiler`,display:`JavaScript + React Compiler`,color:Q},{name:`rsc`,display:`RSC`,color:J,customCommand:`npm exec tiged vitejs/vite-plugin-react/packages/plugin-rsc/examples/starter TARGET_DIR`},{name:`custom-react-router`,display:`React Router v7 ↗`,link:`https://reactrouter.com`,color:q,customCommand:`npm create react-router@latest TARGET_DIR`},{name:`custom-tanstack-router-react`,display:`TanStack Router ↗`,link:`https://tanstack.com/router`,color:q,customCommand:`npm exec -- @tanstack/cli@latest create TARGET_DIR --interactive`},{name:`redwoodsdk-standard`,display:`RedwoodSDK ↗`,link:`https://rwsdk.com`,color:q,customCommand:`npm create rwsdk@latest TARGET_DIR`},{name:`custom-vike-react`,display:`Vike ↗`,link:`https://vike.dev`,color:q,customCommand:`npm create -- vike@latest --react TARGET_DIR`}]},{name:`preact`,display:`Preact`,color:J,variants:[{name:`preact-ts`,display:`TypeScript`,color:G},{name:`preact`,display:`JavaScript`,color:Q},{name:`custom-create-preact`,display:`Official Preact Starter ↗`,color:J,customCommand:`npm create preact@latest TARGET_DIR`}]},{name:`lit`,display:`Lit`,color:X,variants:[{name:`lit-ts`,display:`TypeScript`,color:G},{name:`lit`,display:`JavaScript`,color:Q}]},{name:`svelte`,display:`Svelte`,color:Y,variants:[{name:`svelte-ts`,display:`TypeScript`,color:G},{name:`svelte`,display:`JavaScript`,color:Q},{name:`custom-svelte-kit`,display:`SvelteKit ↗`,color:Y,customCommand:`npm exec sv create TARGET_DIR`}]},{name:`solid`,display:`Solid`,color:G,variants:[{name:`solid-ts`,display:`TypeScript`,color:G},{name:`solid`,display:`JavaScript`,color:Q},{name:`custom-tanstack-router-solid`,display:`TanStack Router ↗`,link:`https://tanstack.com/router`,color:q,customCommand:`npm exec -- @tanstack/cli@latest create TARGET_DIR --framework solid --interactive`},{name:`custom-vike-solid`,display:`Vike ↗`,link:`https://vike.dev`,color:q,customCommand:`npm create -- vike@latest --solid TARGET_DIR`}]},{name:`ember`,display:`Ember`,color:X,variants:[{name:`ember-app-ts`,display:`TypeScript ↗`,color:K,customCommand:`npm exec -- ember-cli@latest new TARGET_DIR --typescript`},{name:`ember-app`,display:`JavaScript ↗`,color:X,customCommand:`npm exec -- ember-cli@latest new TARGET_DIR`}]},{name:`qwik`,display:`Qwik`,color:K,variants:[{name:`qwik-ts`,display:`TypeScript`,color:K},{name:`qwik`,display:`JavaScript`,color:Q},{name:`custom-qwik-city`,display:`QwikCity ↗`,color:K,customCommand:`npm create qwik@latest empty TARGET_DIR`}]},{name:`angular`,display:`Angular`,color:Y,variants:[{name:`custom-angular`,display:`Angular ↗`,color:Y,customCommand:`npm exec @angular/cli@latest new TARGET_DIR`},{name:`custom-analog`,display:`Analog ↗`,color:Q,customCommand:`npm create analog@latest TARGET_DIR`}]},{name:`marko`,display:`Marko`,color:J,variants:[{name:`marko-run`,display:`Marko Run ↗`,color:J,customCommand:`npm create -- marko@latest --name TARGET_DIR`}]},{name:`others`,display:`Others`,color:Z,variants:[{name:`create-vite-extra`,display:`Extra Vite Starters ↗`,color:Z,customCommand:`npm create vite-extra@latest TARGET_DIR`},{name:`create-electron-vite`,display:`Electron ↗`,color:Z,customCommand:`npm create electron-vite@latest TARGET_DIR`}]}],Lt=It.map(e=>e.variants.map(e=>e.name)).reduce((e,t)=>e.concat(t),[]),Rt={_gitignore:`.gitignore`},zt=`vite-project`;function Bt([e,...t],n){let{status:r,error:i}=de.default.sync(e,t,n);r!=null&&r>0&&process.exit(r),i&&(console.error(`\n${e} ${t.join(` `)} error!`),console.error(i),process.exit(1))}function Vt(e,t){if(process.env._VITE_TEST_CLI){H.step(`Installing dependencies with ${t}... (skipped in test)`);return}H.step(`Installing dependencies with ${t}...`),Bt(rn(t),{stdio:`inherit`,cwd:e})}function Ht(e,t){if(process.env._VITE_TEST_CLI){H.step(`Starting dev server... (skipped in test)`);return}H.step(`Starting dev server...`),Bt(an(t,`dev`),{stdio:`inherit`,cwd:e})}async function Ut(){let e=$._[0]?Wt(String($._[0])):void 0,i=$.temp