create-nexo 1.7.2 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -25
- package/dist/bin/nexo.js +291 -217
- package/package.json +7 -2
package/dist/bin/nexo.js
CHANGED
|
@@ -5,133 +5,136 @@ import { dirname } from 'node:path';
|
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = dirname(__filename);
|
|
8
|
-
var
|
|
9
|
-
`).replace(/^/gm," ".repeat(o))}let c=[`Usage: ${r.commandUsage(t)}`,""],l=r.commandDescription(t);l.length>0&&(c=c.concat([r.wrap(l,n,0),""]));let
|
|
8
|
+
var Rf=Object.create;var ss=Object.defineProperty;var $f=Object.getOwnPropertyDescriptor;var Pf=Object.getOwnPropertyNames;var If=Object.getPrototypeOf,Nf=Object.prototype.hasOwnProperty;var le=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var D=(e,t)=>()=>(e&&(t=e(e=0)),t);var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),k=(e,t)=>{for(var r in t)ss(e,r,{get:t[r],enumerable:!0})},jf=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Pf(t))!Nf.call(e,n)&&n!==r&&ss(e,n,{get:()=>t[n],enumerable:!(i=$f(t,n))||i.enumerable});return e};var V=(e,t,r)=>(r=e!=null?Rf(If(e)):{},jf(t||!e||!e.__esModule?ss(r,"default",{value:e,enumerable:!0}):r,e));var dr=I(as=>{var li=class extends Error{constructor(t,r,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},os=class extends li{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};as.CommanderError=li;as.InvalidArgumentError=os});var pi=I(cs=>{var{InvalidArgumentError:Bf}=dr(),us=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new Bf(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,i):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Lf(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}cs.Argument=us;cs.humanReadableArgName=Lf});var ps=I(Pu=>{var{humanReadableArgName:Mf}=pi(),ls=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden),i=t._getHelpCommand();return i&&!i._hidden&&r.push(i),this.sortSubcommands&&r.sort((n,o)=>n.name().localeCompare(o.name())),r}compareOptions(t,r){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(t).localeCompare(i(r))}visibleOptions(t){let r=t.options.filter(n=>!n.hidden),i=t._getHelpOption();if(i&&!i.hidden){let n=i.short&&t._findOption(i.short),o=i.long&&t._findOption(i.long);!n&&!o?r.push(i):i.long&&!o?r.push(t.createOption(i.long,i.description)):i.short&&!n&&r.push(t.createOption(i.short,i.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let i=t.parent;i;i=i.parent){let n=i.options.filter(o=>!o.hidden);r.push(...n)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(i=>Mf(i)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((i,n)=>Math.max(i,r.subcommandTerm(n).length),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((i,n)=>Math.max(i,r.optionTerm(n).length),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((i,n)=>Math.max(i,r.optionTerm(n).length),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((i,n)=>Math.max(i,r.argumentTerm(n).length),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let i="";for(let n=t.parent;n;n=n.parent)i=n.name()+" "+i;return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];return t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0?`${t.description} (${r.join(", ")})`:t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let i=`(${r.join(", ")})`;return t.description?`${t.description} ${i}`:i}return t.description}formatHelp(t,r){let i=r.padWidth(t,r),n=r.helpWidth||80,o=2,s=2;function a(g,y){if(y){let v=`${g.padEnd(i+s)}${y}`;return r.wrap(v,n-o,i+s)}return g}function u(g){return g.join(`
|
|
9
|
+
`).replace(/^/gm," ".repeat(o))}let c=[`Usage: ${r.commandUsage(t)}`,""],l=r.commandDescription(t);l.length>0&&(c=c.concat([r.wrap(l,n,0),""]));let p=r.visibleArguments(t).map(g=>a(r.argumentTerm(g),r.argumentDescription(g)));p.length>0&&(c=c.concat(["Arguments:",u(p),""]));let h=r.visibleOptions(t).map(g=>a(r.optionTerm(g),r.optionDescription(g)));if(h.length>0&&(c=c.concat(["Options:",u(h),""])),this.showGlobalOptions){let g=r.visibleGlobalOptions(t).map(y=>a(r.optionTerm(y),r.optionDescription(y)));g.length>0&&(c=c.concat(["Global Options:",u(g),""]))}let d=r.visibleCommands(t).map(g=>a(r.subcommandTerm(g),r.subcommandDescription(g)));return d.length>0&&(c=c.concat(["Commands:",u(d),""])),c.join(`
|
|
10
10
|
`)}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,i,n=40){let o=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",s=new RegExp(`[\\n][${o}]+`);if(t.match(s))return t;let a=r-i;if(a<n)return t;let u=t.slice(0,i),c=t.slice(i).replace(`\r
|
|
11
11
|
`,`
|
|
12
|
-
`),l=" ".repeat(i),
|
|
13
|
-
|.{1,${a-1}}([${
|
|
12
|
+
`),l=" ".repeat(i),h="\\s\u200B",d=new RegExp(`
|
|
13
|
+
|.{1,${a-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g"),g=c.match(d)||[];return u+g.map((y,v)=>y===`
|
|
14
14
|
`?"":(v>0?l:"")+y.trimEnd()).join(`
|
|
15
|
-
`)}};
|
|
15
|
+
`)}};Pu.Help=ls});var fs=I(ds=>{var{InvalidArgumentError:Uf}=dr(),hs=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let i=Hf(t);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,i)=>{if(!this.argChoices.includes(r))throw new Uf(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,i):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return zf(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},ms=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(t,r){let i=r.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,o=n!==void 0?n:!1;return r.negate===(o===t)}};function zf(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function Hf(e){let t,r,i=e.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(t=i.shift()),r=i.shift(),!t&&/^-[^-]$/.test(r)&&(t=r,r=void 0),{shortFlag:t,longFlag:r}}ds.Option=hs;ds.DualOptions=ms});var Nu=I(Iu=>{function Wf(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let i=0;i<=e.length;i++)r[i]=[i];for(let i=0;i<=t.length;i++)r[0][i]=i;for(let i=1;i<=t.length;i++)for(let n=1;n<=e.length;n++){let o=1;e[n-1]===t[i-1]?o=0:o=1,r[n][i]=Math.min(r[n-1][i]+1,r[n][i-1]+1,r[n-1][i-1]+o),n>1&&i>1&&e[n-1]===t[i-2]&&e[n-2]===t[i-1]&&(r[n][i]=Math.min(r[n][i],r[n-2][i-2]+1))}return r[e.length][t.length]}function Gf(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(s=>s.slice(2)));let i=[],n=3,o=.4;return t.forEach(s=>{if(s.length<=1)return;let a=Wf(e,s),u=Math.max(e.length,s.length);(u-a)/u>o&&(a<n?(n=a,i=[s]):a===n&&i.push(s))}),i.sort((s,a)=>s.localeCompare(a)),r&&(i=i.map(s=>`--${s}`)),i.length>1?`
|
|
16
16
|
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
17
|
-
(Did you mean ${i[0]}?)`:""}
|
|
18
|
-
- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new
|
|
19
|
-
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,i){this._exitCallback&&this._exitCallback(new
|
|
20
|
-
- already used by option '${r.flags}'`)}this.options.push(t)}_registerCommand(t){let r=n=>[n.name()].concat(n.aliases()),i=r(t).find(n=>this._findCommand(n));if(i){let n=r(this._findCommand(i)).join("|"),o=r(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${n}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),i=t.attributeName();if(t.negate){let o=t.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(o,s,a)=>{o==null&&t.presetArg!==void 0&&(o=t.presetArg);let u=this.getOptionValue(i);o!==null&&t.parseArg?o=this._callParseArg(t,o,u,s):o!==null&&t.variadic&&(o=t._concatValue(o,u)),o==null&&(t.negate?o=!1:t.isBoolean()||t.optional?o=!0:o=""),this.setOptionValueWithSource(i,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${t.flags}' argument '${o}' is invalid.`;n(o,s,"cli")}),t.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${t.flags}' value '${o}' from env '${t.envVar}' is invalid.`;n(o,s,"env")}),this}_optionEx(t,r,i,n,o){if(typeof r=="object"&&r instanceof
|
|
17
|
+
(Did you mean ${i[0]}?)`:""}Iu.suggestSimilar=Gf});var Uu=I(Mu=>{var Vf=le("node:events").EventEmitter,gs=le("node:child_process"),ze=le("node:path"),Ds=le("node:fs"),B=le("node:process"),{Argument:qf,humanReadableArgName:Yf}=pi(),{CommanderError:ys}=dr(),{Help:Kf}=ps(),{Option:ju,DualOptions:Zf}=fs(),{suggestSimilar:Bu}=Nu(),bs=class e extends Vf{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:r=>B.stdout.write(r),writeErr:r=>B.stderr.write(r),getOutHelpWidth:()=>B.stdout.isTTY?B.stdout.columns:void 0,getErrHelpWidth:()=>B.stderr.isTTY?B.stderr.columns:void 0,outputError:(r,i)=>i(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,i){let n=r,o=i;typeof n=="object"&&n!==null&&(o=n,n=null),o=o||{};let[,s,a]=t.match(/([^ ]+) *(.*)/),u=this.createCommand(s);return n&&(u.description(n),u._executableHandler=!0),o.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(o.noHelp||o.hidden),u._executableFile=o.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),n?this:u}createCommand(t){return new e(t)}createHelp(){return Object.assign(new Kf,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
18
|
+
- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new qf(t,r)}argument(t,r,i,n){let o=this.createArgument(t,r);return typeof i=="function"?o.default(n).argParser(i):o.default(i),this.addArgument(o),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r&&r.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,i,n]=t.match(/([^ ]+) *(.*)/),o=r??"display help for command",s=this.createCommand(i);return s.helpOption(!1),n&&s.arguments(n),o&&s.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=s,this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,r){let i=["preSubcommand","preAction","postAction"];if(!i.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
|
|
19
|
+
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,i){this._exitCallback&&this._exitCallback(new ys(t,r,i)),B.exit(t)}action(t){let r=i=>{let n=this.registeredArguments.length,o=i.slice(0,n);return this._storeOptionsAsProperties?o[n]=this:o[n]=this.opts(),o.push(this),t.apply(this,o)};return this._actionHandler=r,this}createOption(t,r){return new ju(t,r)}_callParseArg(t,r,i,n){try{return t.parseArg(r,i)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${n} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
|
|
20
|
+
- already used by option '${r.flags}'`)}this.options.push(t)}_registerCommand(t){let r=n=>[n.name()].concat(n.aliases()),i=r(t).find(n=>this._findCommand(n));if(i){let n=r(this._findCommand(i)).join("|"),o=r(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${n}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),i=t.attributeName();if(t.negate){let o=t.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(i,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(i,t.defaultValue,"default");let n=(o,s,a)=>{o==null&&t.presetArg!==void 0&&(o=t.presetArg);let u=this.getOptionValue(i);o!==null&&t.parseArg?o=this._callParseArg(t,o,u,s):o!==null&&t.variadic&&(o=t._concatValue(o,u)),o==null&&(t.negate?o=!1:t.isBoolean()||t.optional?o=!0:o=""),this.setOptionValueWithSource(i,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${t.flags}' argument '${o}' is invalid.`;n(o,s,"cli")}),t.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${t.flags}' value '${o}' from env '${t.envVar}' is invalid.`;n(o,s,"env")}),this}_optionEx(t,r,i,n,o){if(typeof r=="object"&&r instanceof ju)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,i);if(s.makeOptionMandatory(!!t.mandatory),typeof n=="function")s.default(o).argParser(n);else if(n instanceof RegExp){let a=n;n=(u,c)=>{let l=a.exec(u);return l?l[0]:c},s.default(o).argParser(n)}else s.default(n);return this.addOption(s)}option(t,r,i,n){return this._optionEx({},t,r,i,n)}requiredOption(t,r,i,n){return this._optionEx({mandatory:!0},t,r,i,n)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,i){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=i,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(t)!==void 0&&(r=i.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){B.versions?.electron&&(r.from="electron");let n=B.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(r.from="eval")}t===void 0&&(t=B.argv),this.rawArgs=t.slice();let i;switch(r.from){case void 0:case"node":this._scriptPath=t[1],i=t.slice(2);break;case"electron":B.defaultApp?(this._scriptPath=t[1],i=t.slice(2)):i=t.slice(1);break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(t,r){let i=this._prepareUserArgs(t,r);return this._parseCommand([],i),this}async parseAsync(t,r){let i=this._prepareUserArgs(t,r);return await this._parseCommand([],i),this}_executeSubCommand(t,r){r=r.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function o(l,p){let h=ze.resolve(l,p);if(Ds.existsSync(h))return h;if(n.includes(ze.extname(p)))return;let d=n.find(g=>Ds.existsSync(`${h}${g}`));if(d)return`${h}${d}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=Ds.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=ze.resolve(ze.dirname(l),a)}if(a){let l=o(a,s);if(!l&&!t._executableFile&&this._scriptPath){let p=ze.basename(this._scriptPath,ze.extname(this._scriptPath));p!==this._name&&(l=o(a,`${p}-${t._name}`))}s=l||s}i=n.includes(ze.extname(s));let u;B.platform!=="win32"?i?(r.unshift(s),r=Lu(B.execArgv).concat(r),u=gs.spawn(B.argv[0],r,{stdio:"inherit"})):u=gs.spawn(s,r,{stdio:"inherit"}):(r.unshift(s),r=Lu(B.execArgv).concat(r),u=gs.spawn(B.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{B.on(p,()=>{u.killed===!1&&u.exitCode===null&&u.kill(p)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new ys(l,"commander.executeSubCommandAsync","(close)")):B.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT"){let p=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",h=`'${s}' does not exist
|
|
21
21
|
- if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
22
22
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
23
|
-
- ${
|
|
23
|
+
- ${p}`;throw new Error(h)}else if(l.code==="EACCES")throw new Error(`'${s}' not executable`);if(!c)B.exit(1);else{let p=new ys(1,"commander.executeSubCommandAsync","(error)");p.nestedError=l,c(p)}}),this.runningCommand=u}_dispatchSubcommand(t,r,i){let n=this._findCommand(t);n||this.help({error:!0});let o;return o=this._chainOrCallSubCommandHook(o,n,"preSubcommand"),o=this._chainOrCall(o,()=>{if(n._executableHandler)this._executeSubCommand(n,r.concat(i));else return n._parseCommand(r,i)}),o}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(i,n,o)=>{let s=n;if(n!==null&&i.parseArg){let a=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;s=this._callParseArg(i,n,o,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((i,n)=>{let o=i.defaultValue;i.variadic?n<this.args.length?(o=this.args.slice(n),i.parseArg&&(o=o.reduce((s,a)=>t(i,a,s),i.defaultValue))):o===void 0&&(o=[]):n<this.args.length&&(o=this.args[n],i.parseArg&&(o=t(i,o,i.defaultValue))),r[n]=o}),this.processedArgs=r}_chainOrCall(t,r){return t&&t.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let i=t,n=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(s=>{n.push({hookedCommand:o,callback:s})})}),r==="postAction"&&n.reverse(),n.forEach(o=>{i=this._chainOrCall(i,()=>o.callback(o.hookedCommand,this))}),i}_chainOrCallSubCommandHook(t,r,i){let n=t;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(o=>{n=this._chainOrCall(n,()=>o(this,r))}),n}_parseCommand(t,r){let i=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(i.operands),r=i.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,t,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(o))n(),this._processArguments(),this.parent.emit(o,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});t.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=t.find(o=>i.conflictsWith.includes(o.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],i=[],n=r,o=t.slice();function s(u){return u.length>1&&u[0]==="-"}let a=null;for(;o.length;){let u=o.shift();if(u==="--"){n===i&&n.push(u),n.push(...o);break}if(a&&!s(u)){this.emit(`option:${a.name()}`,u);continue}if(a=null,s(u)){let c=this._findOption(u);if(c){if(c.required){let l=o.shift();l===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,l)}else if(c.optional){let l=null;o.length>0&&!s(o[0])&&(l=o.shift()),this.emit(`option:${c.name()}`,l)}else this.emit(`option:${c.name()}`);a=c.variadic?c:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let c=this._findOption(`-${u[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,u.slice(2)):(this.emit(`option:${c.name()}`),o.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let c=u.indexOf("="),l=this._findOption(u.slice(0,c));if(l&&(l.required||l.optional)){this.emit(`option:${l.name()}`,u.slice(c+1));continue}}if(s(u)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(u)){r.push(u),o.length>0&&i.push(...o);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){r.push(u),o.length>0&&r.push(...o);break}else if(this._defaultCommandName){i.push(u),o.length>0&&i.push(...o);break}}if(this._passThroughOptions){n.push(u),o.length>0&&n.push(...o);break}n.push(u)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let i=0;i<r;i++){let n=this.options[i].attributeName();t[n]=n===this._versionOptionName?this._version:this[n]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
|
|
24
24
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
25
25
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
26
|
-
`),this.outputHelp({error:!0}));let i=r||{},n=i.exitCode||1,o=i.code||"commander.error";this._exit(n,o,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in
|
|
27
|
-
`),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>
|
|
26
|
+
`),this.outputHelp({error:!0}));let i=r||{},n=i.exitCode||1,o=i.code||"commander.error";this._exit(n,o,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in B.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,B.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Zf(this.options),r=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&r(i.attributeName())&&t.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!r(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let i=s=>{let a=s.attributeName(),u=this.getOptionValue(a),c=this.options.find(p=>p.negate&&a===p.attributeName()),l=this.options.find(p=>!p.negate&&a===p.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||s},n=s=>{let a=i(s),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${n(t)} cannot be used with ${n(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let n=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);n=n.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);r=Bu(t,n)}let i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,i=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${i} but got ${t.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(o=>{n.push(o.name()),o.alias()&&n.push(o.alias())}),r=Bu(t,n)}let i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",i=i||"output the version number";let n=this.createOption(r,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
27
|
+
`),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(t);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${n}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(i=>Yf(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=ze.basename(t,ze.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp();return r.helpWidth===void 0&&(r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),r.formatHelp(this,r)}_getHelpContext(t){t=t||{};let r={error:!!t.error},i;return r.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),r.write=t.write||i,r.command=this,r}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let i=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(r&&(n=r(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.emit("afterAllHelp",i))}helpOption(t,r){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",r=r??"display help for command",this._helpOption=this.createOption(t,r),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let r=B.exitCode||0;r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let i=["beforeAll","before","after","afterAll"];if(!i.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
28
28
|
Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,o=>{let s;typeof r=="function"?s=r({error:o.error,command:o.command}):s=r,s&&o.write(`${s}
|
|
29
|
-
`)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(n=>r.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function
|
|
29
|
+
`)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(n=>r.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Lu(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,i="127.0.0.1",n="9229",o;return(o=t.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?n=o[3]:i=o[3]):(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],i=o[3],n=o[4]),r&&n!=="0"?`${r}=${i}:${parseInt(n)+1}`:t})}Mu.Command=bs});var Gu=I(be=>{var{Argument:zu}=pi(),{Command:Cs}=Uu(),{CommanderError:Jf,InvalidArgumentError:Hu}=dr(),{Help:Xf}=ps(),{Option:Wu}=fs();be.program=new Cs;be.createCommand=e=>new Cs(e);be.createOption=(e,t)=>new Wu(e,t);be.createArgument=(e,t)=>new zu(e,t);be.Command=Cs;be.Option=Wu;be.Argument=zu;be.Help=Xf;be.CommanderError=Jf;be.InvalidArgumentError=Hu;be.InvalidOptionArgumentError=Hu});var vs=I((Sv,Yu)=>{"use strict";var Es="\x1B",N=`${Es}[`,Qf="\x07",ws={to(e,t){return t?`${N}${t+1};${e+1}H`:`${N}${e+1}G`},move(e,t){let r="";return e<0?r+=`${N}${-e}D`:e>0&&(r+=`${N}${e}C`),t<0?r+=`${N}${-t}A`:t>0&&(r+=`${N}${t}B`),r},up:(e=1)=>`${N}${e}A`,down:(e=1)=>`${N}${e}B`,forward:(e=1)=>`${N}${e}C`,backward:(e=1)=>`${N}${e}D`,nextLine:(e=1)=>`${N}E`.repeat(e),prevLine:(e=1)=>`${N}F`.repeat(e),left:`${N}G`,hide:`${N}?25l`,show:`${N}?25h`,save:`${Es}7`,restore:`${Es}8`},eg={up:(e=1)=>`${N}S`.repeat(e),down:(e=1)=>`${N}T`.repeat(e)},tg={screen:`${N}2J`,up:(e=1)=>`${N}1J`.repeat(e),down:(e=1)=>`${N}J`.repeat(e),line:`${N}2K`,lineEnd:`${N}K`,lineStart:`${N}1K`,lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?ws.up():"");return e&&(t+=ws.left),t}};Yu.exports={cursor:ws,scroll:eg,erase:tg,beep:Qf}});var ae=I((Fv,Ss)=>{var mi=process||{},Ku=mi.argv||[],hi=mi.env||{},rg=!(hi.NO_COLOR||Ku.includes("--no-color"))&&(!!hi.FORCE_COLOR||Ku.includes("--color")||mi.platform==="win32"||(mi.stdout||{}).isTTY&&hi.TERM!=="dumb"||!!hi.CI),ig=(e,t,r=e)=>i=>{let n=""+i,o=n.indexOf(t,e.length);return~o?e+ng(n,t,r,o)+t:e+n+t},ng=(e,t,r,i)=>{let n="",o=0;do n+=e.substring(o,i)+r,o=i+t.length,i=e.indexOf(t,o);while(~i);return n+e.substring(o)},Zu=(e=rg)=>{let t=e?ig:()=>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")}};Ss.exports=Zu();Ss.exports.createColors=Zu});import{stdin as ac,stdout as uc}from"node:process";import*as et from"node:readline";import Ju from"node:readline";import{WriteStream as sg}from"node:tty";function og({onlyFirst:e=!1}={}){let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}function cc(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(ag,"")}function lc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function fr(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=cc(e),e.length===0))return 0;e=e.replace(pg()," ");let r=t.ambiguousIsNarrow?1:2,i=0;for(let n of e){let o=n.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(cg.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=r;break;default:i+=1}}return i}function dg(){let e=new Map;for(let[t,r]of Object.entries($)){for(let[i,n]of Object.entries(r))$[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=$[i],e.set(n[0],n[1]);Object.defineProperty($,t,{value:r,enumerable:!1})}return Object.defineProperty($,"codes",{value:e,enumerable:!1}),$.color.close="\x1B[39m",$.bgColor.close="\x1B[49m",$.color.ansi=Xu(),$.color.ansi256=Qu(),$.color.ansi16m=ec(),$.bgColor.ansi=Xu(Fs),$.bgColor.ansi256=Qu(Fs),$.bgColor.ansi16m=ec(Fs),Object.defineProperties($,{rgbToAnsi256:{value:(t,r,i)=>t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(o=>o+o).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>$.rgbToAnsi256(...$.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,i=Math.floor(a/6)/5,n=a%6/5}let o=Math.max(r,i,n)*2;if(o===0)return 30;let s=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>$.ansi256ToAnsi($.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>$.ansi256ToAnsi($.hexToAnsi256(t)),enumerable:!1}}),$}function ic(e,t,r){return String(e).normalize().replace(/\r\n/g,`
|
|
30
30
|
`).split(`
|
|
31
|
-
`).map(i=>
|
|
32
|
-
`)}function
|
|
31
|
+
`).map(i=>Cg(i,t,r)).join(`
|
|
32
|
+
`)}function vg(e,t){if(e===t)return;let r=e.split(`
|
|
33
33
|
`),i=t.split(`
|
|
34
|
-
`),n=[];for(let o=0;o<Math.max(r.length,i.length);o++)r[o]!==i[o]&&n.push(o);return n}function I(e){return e===tc}function hi(e,t){e.isTTY&&e.setRawMode(t)}function nc({input:e=Yu,output:t=Zu,overwrite:r=!0,hideCursor:i=!0}={}){let n=Xe.createInterface({input:e,output:t,prompt:"",tabSize:1});Xe.emitKeypressEvents(e,n),e.isTTY&&e.setRawMode(!0);let o=(s,{name:a})=>{if(String(s)===""){i&&t.write(ee.cursor.show),process.exit(0);return}if(!r)return;Xe.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{Xe.clearLine(t,1,()=>{e.once("keypress",o)})})};return i&&t.write(ee.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),i&&t.write(ee.cursor.show),e.isTTY&&!xg&&e.setRawMode(!1),n.terminal=!1,n.close()}}var ee,pi,tg,Ku,rg,ig,ng,sg,ys,Lu,Mu,Uu,P,og,ag,cg,fi,lg,Cs,Qu,hg,ec,ws,zu,Wu,pg,bs,mg,dg,fg,gg,De,tc,Gu,yg,jt,mi,bg,Cg,Vu,rc,wg,vg,qu,ic,Eg,Sg,Fg,di,xg,vs=D(()=>{ee=V(gs(),1),pi=V(se(),1);tg=eg();Ku={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(i){var n=i.charCodeAt(0),o=i.length==2?i.charCodeAt(1):0,s=n;return 55296<=n&&n<=56319&&56320<=o&&o<=57343&&(n&=1023,o&=1023,s=n<<10|o,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},t.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function r(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(i){for(var n=r(i),o=0,s=0;s<n.length;s++)o=o+this.characterLength(n[s]);return o},t.slice=function(i,n,o){textLen=t.length(i),n=n||0,o=o||1,n<0&&(n=textLen+n),o<0&&(o=textLen+o);for(var s="",a=0,u=r(i),c=0;c<u.length;c++){var l=u[c],h=t.length(l);if(a>=n-(h==2?1:0))if(a+h<=o)s+=l;else break;a+=h}return s}})(Ku);rg=Ku.exports,ig=Xu(rg),ng=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},sg=Xu(ng);ys=10,Lu=(e=0)=>t=>`\x1B[${t+e}m`,Mu=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Uu=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,P={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(P.modifier);og=Object.keys(P.color),ag=Object.keys(P.bgColor);[...og,...ag];cg=ug(),fi=new Set(["\x1B","\x9B"]),lg=39,Cs="\x07",Qu="[",hg="]",ec="m",ws=`${hg}8;;`,zu=e=>`${fi.values().next().value}${Qu}${e}${ec}`,Wu=e=>`${fi.values().next().value}${ws}${e}${Cs}`,pg=e=>e.split(" ").map(t=>hr(t)),bs=(e,t,r)=>{let i=[...t],n=!1,o=!1,s=hr(Ju(e[e.length-1]));for(let[a,u]of i.entries()){let c=hr(u);if(s+c<=r?e[e.length-1]+=u:(e.push(u),s=0),fi.has(u)&&(n=!0,o=i.slice(a+1).join("").startsWith(ws)),n){o?u===Cs&&(n=!1,o=!1):u===ec&&(n=!1);continue}s+=c,s===r&&a<i.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},mg=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(hr(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},dg=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,o,s=pg(e),a=[""];for(let[c,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=hr(a[a.length-1]);if(c!==0&&(h>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&s[c]>t){let p=t-h,m=1+Math.floor((s[c]-p-1)/t);Math.floor((s[c]-1)/t)<m&&a.push(""),bs(a,l,t);continue}if(h+s[c]>t&&h>0&&s[c]>0){if(r.wordWrap===!1&&h<t){bs(a,l,t);continue}a.push("")}if(h+s[c]>t&&r.wordWrap===!1){bs(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>mg(c)));let u=[...a.join(`
|
|
35
|
-
`)];for(let[c,l]of u.entries()){if(i+=l,
|
|
36
|
-
`?(o&&(i+=
|
|
37
|
-
`&&(n&&
|
|
38
|
-
`),
|
|
39
|
-
`).length-1;this.output.write(ee.cursor.move(-999,t*-1))}render(){let t=
|
|
34
|
+
`),n=[];for(let o=0;o<Math.max(r.length,i.length);o++)r[o]!==i[o]&&n.push(o);return n}function O(e){return e===dc}function di(e,t){e.isTTY&&e.setRawMode(t)}function Dc({input:e=ac,output:t=uc,overwrite:r=!0,hideCursor:i=!0}={}){let n=et.createInterface({input:e,output:t,prompt:"",tabSize:1});et.emitKeypressEvents(e,n),e.isTTY&&e.setRawMode(!0);let o=(s,{name:a})=>{if(String(s)===""){i&&t.write(ee.cursor.show),process.exit(0);return}if(!r)return;et.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{et.clearLine(t,1,()=>{e.once("keypress",o)})})};return i&&t.write(ee.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),i&&t.write(ee.cursor.show),e.isTTY&&!Rg&&e.setRawMode(!1),n.terminal=!1,n.close()}}var ee,fi,ag,pc,ug,cg,lg,pg,Fs,Xu,Qu,ec,$,hg,mg,fg,yi,gg,ks,hc,Dg,mc,As,tc,rc,yg,xs,bg,Cg,Eg,wg,Ce,dc,nc,Sg,Mt,gi,Fg,xg,sc,fc,kg,Ag,oc,gc,_g,Tg,Og,Di,Rg,_s=D(()=>{ee=V(vs(),1),fi=V(ae(),1);ag=og();pc={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(i){var n=i.charCodeAt(0),o=i.length==2?i.charCodeAt(1):0,s=n;return 55296<=n&&n<=56319&&56320<=o&&o<=57343&&(n&=1023,o&=1023,s=n<<10|o,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},t.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function r(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(i){for(var n=r(i),o=0,s=0;s<n.length;s++)o=o+this.characterLength(n[s]);return o},t.slice=function(i,n,o){textLen=t.length(i),n=n||0,o=o||1,n<0&&(n=textLen+n),o<0&&(o=textLen+o);for(var s="",a=0,u=r(i),c=0;c<u.length;c++){var l=u[c],p=t.length(l);if(a>=n-(p==2?1:0))if(a+p<=o)s+=l;else break;a+=p}return s}})(pc);ug=pc.exports,cg=lc(ug),lg=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},pg=lc(lg);Fs=10,Xu=(e=0)=>t=>`\x1B[${t+e}m`,Qu=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ec=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,$={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys($.modifier);hg=Object.keys($.color),mg=Object.keys($.bgColor);[...hg,...mg];fg=dg(),yi=new Set(["\x1B","\x9B"]),gg=39,ks="\x07",hc="[",Dg="]",mc="m",As=`${Dg}8;;`,tc=e=>`${yi.values().next().value}${hc}${e}${mc}`,rc=e=>`${yi.values().next().value}${As}${e}${ks}`,yg=e=>e.split(" ").map(t=>fr(t)),xs=(e,t,r)=>{let i=[...t],n=!1,o=!1,s=fr(cc(e[e.length-1]));for(let[a,u]of i.entries()){let c=fr(u);if(s+c<=r?e[e.length-1]+=u:(e.push(u),s=0),yi.has(u)&&(n=!0,o=i.slice(a+1).join("").startsWith(As)),n){o?u===ks&&(n=!1,o=!1):u===mc&&(n=!1);continue}s+=c,s===r&&a<i.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},bg=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(fr(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},Cg=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,o,s=yg(e),a=[""];for(let[c,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=fr(a[a.length-1]);if(c!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),p=0),(p>0||r.trim===!1)&&(a[a.length-1]+=" ",p++)),r.hard&&s[c]>t){let h=t-p,d=1+Math.floor((s[c]-h-1)/t);Math.floor((s[c]-1)/t)<d&&a.push(""),xs(a,l,t);continue}if(p+s[c]>t&&p>0&&s[c]>0){if(r.wordWrap===!1&&p<t){xs(a,l,t);continue}a.push("")}if(p+s[c]>t&&r.wordWrap===!1){xs(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>bg(c)));let u=[...a.join(`
|
|
35
|
+
`)];for(let[c,l]of u.entries()){if(i+=l,yi.has(l)){let{groups:h}=new RegExp(`(?:\\${hc}(?<code>\\d+)m|\\${As}(?<uri>.*)${ks})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let d=Number.parseFloat(h.code);n=d===gg?void 0:d}else h.uri!==void 0&&(o=h.uri.length===0?void 0:h.uri)}let p=fg.codes.get(Number(n));u[c+1]===`
|
|
36
|
+
`?(o&&(i+=rc("")),n&&p&&(i+=tc(p))):l===`
|
|
37
|
+
`&&(n&&p&&(i+=tc(n)),o&&(i+=rc(o)))}return i};Eg=Object.defineProperty,wg=(e,t,r)=>t in e?Eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ce=(e,t,r)=>(wg(e,typeof t!="symbol"?t+"":t,r),r);dc=Symbol("clack:cancel");nc=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),Sg=new Set(["up","down","left","right","space","enter"]),Mt=class{constructor({render:t,input:r=ac,output:i=uc,...n},o=!0){Ce(this,"input"),Ce(this,"output"),Ce(this,"rl"),Ce(this,"opts"),Ce(this,"_track",!1),Ce(this,"_render"),Ce(this,"_cursor",0),Ce(this,"state","initial"),Ce(this,"value"),Ce(this,"error",""),Ce(this,"subscribers",new Map),Ce(this,"_prevFrame",""),this.opts=n,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=t.bind(this),this._track=o,this.input=r,this.output=i}prompt(){let t=new sg(0);return t._write=(r,i,n)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),n()},this.input.pipe(t),this.rl=Ju.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),Ju.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),di(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((r,i)=>{this.once("submit",()=>{this.output.write(ee.cursor.show),this.output.off("resize",this.render),di(this.input,!1),r(this.value)}),this.once("cancel",()=>{this.output.write(ee.cursor.show),this.output.off("resize",this.render),di(this.input,!1),r(dc)})})}on(t,r){let i=this.subscribers.get(t)??[];i.push({cb:r}),this.subscribers.set(t,i)}once(t,r){let i=this.subscribers.get(t)??[];i.push({cb:r,once:!0}),this.subscribers.set(t,i)}emit(t,...r){let i=this.subscribers.get(t)??[],n=[];for(let o of i)o.cb(...r),o.once&&n.push(()=>i.splice(i.indexOf(o),1));for(let o of n)o()}unsubscribe(){this.subscribers.clear()}onKeypress(t,r){if(this.state==="error"&&(this.state="active"),r?.name&&!this._track&&nc.has(r.name)&&this.emit("cursor",nc.get(r.name)),r?.name&&Sg.has(r.name)&&this.emit("cursor",r.name),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),t===" "&&this.opts.placeholder&&(this.value||(this.rl.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),t&&this.emit("key",t.toLowerCase()),r?.name==="return"){if(this.opts.validate){let i=this.opts.validate(this.value);i&&(this.error=i,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}t===""&&(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(`
|
|
38
|
+
`),di(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=ic(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
39
|
+
`).length-1;this.output.write(ee.cursor.move(-999,t*-1))}render(){let t=ic(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(ee.cursor.hide);else{let r=vg(this._prevFrame,t);if(this.restoreCursor(),r&&r?.length===1){let i=r[0];this.output.write(ee.cursor.move(0,i)),this.output.write(ee.erase.lines(1));let n=t.split(`
|
|
40
40
|
`);this.output.write(n[i]),this._prevFrame=t,this.output.write(ee.cursor.move(0,n.length-i-1));return}else if(r&&r?.length>1){let i=r[0];this.output.write(ee.cursor.move(0,i)),this.output.write(ee.erase.down());let n=t.split(`
|
|
41
41
|
`).slice(i);this.output.write(n.join(`
|
|
42
|
-
`)),this._prevFrame=t;return}this.output.write(ee.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},
|
|
43
|
-
${
|
|
42
|
+
`)),this._prevFrame=t;return}this.output.write(ee.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},gi=class extends Mt{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(ee.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},Fg=Object.defineProperty,xg=(e,t,r)=>t in e?Fg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sc=(e,t,r)=>(xg(e,typeof t!="symbol"?t+"":t,r),r),fc=class extends Mt{constructor(e){super(e,!1),sc(this,"options"),sc(this,"cursor",0),this.options=e.options,this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0),this.on("key",t=>{t==="a"&&this.toggleAll()}),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let e=this.value.length===this.options.length;this.value=e?[]:this.options.map(t=>t.value)}toggleValue(){let e=this.value.includes(this._value);this.value=e?this.value.filter(t=>t!==this._value):[...this.value,this._value]}},kg=Object.defineProperty,Ag=(e,t,r)=>t in e?kg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oc=(e,t,r)=>(Ag(e,typeof t!="symbol"?t+"":t,r),r),gc=class extends Mt{constructor(e){super(e,!1),oc(this,"options"),oc(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",t=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},_g=Object.defineProperty,Tg=(e,t,r)=>t in e?_g(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Og=(e,t,r)=>(Tg(e,typeof t!="symbol"?t+"":t,r),r),Di=class extends Mt{constructor(t){super(t),Og(this,"valueWithCursor",""),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${fi.default.inverse(fi.default.hidden("_"))}`;else{let r=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${r}${fi.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}},Rg=globalThis.process.platform.startsWith("win")});import Fe from"node:process";function $g(){return Fe.platform!=="win32"?Fe.env.TERM!=="linux":!!Fe.env.CI||!!Fe.env.WT_SESSION||!!Fe.env.TERMINUS_SUBLIME||Fe.env.ConEmuTask==="{cmd::Cmder}"||Fe.env.TERM_PROGRAM==="Terminus-Sublime"||Fe.env.TERM_PROGRAM==="vscode"||Fe.env.TERM==="xterm-256color"||Fe.env.TERM==="alacritty"||Fe.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function Gg(){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,"g")}var f,Ut,Os,M,Pg,Cc,Ec,bi,Ig,F,rt,Rs,$s,Ng,yc,jg,jv,bc,Bg,Lg,Mg,Ug,zg,Hg,Wg,Ci,zt,ge,He,Ps,Ts,pe,xe,Ei,gr,tt,wc,Dr=D(()=>{_s();_s();f=V(ae(),1),Ut=V(vs(),1);Os=$g(),M=(e,t)=>Os?e:t,Pg=M("\u25C6","*"),Cc=M("\u25A0","x"),Ec=M("\u25B2","x"),bi=M("\u25C7","o"),Ig=M("\u250C","T"),F=M("\u2502","|"),rt=M("\u2514","\u2014"),Rs=M("\u25CF",">"),$s=M("\u25CB"," "),Ng=M("\u25FB","[\u2022]"),yc=M("\u25FC","[+]"),jg=M("\u25FB","[ ]"),jv=M("\u25AA","\u2022"),bc=M("\u2500","-"),Bg=M("\u256E","+"),Lg=M("\u251C","+"),Mg=M("\u256F","+"),Ug=M("\u25CF","\u2022"),zg=M("\u25C6","*"),Hg=M("\u25B2","!"),Wg=M("\u25A0","x"),Ci=e=>{switch(e){case"initial":case"active":return f.default.cyan(Pg);case"cancel":return f.default.red(Cc);case"error":return f.default.yellow(Ec);case"submit":return f.default.green(bi)}},zt=e=>new Di({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${f.default.gray(F)}
|
|
43
|
+
${Ci(this.state)} ${e.message}
|
|
44
44
|
`,r=e.placeholder?f.default.inverse(e.placeholder[0])+f.default.dim(e.placeholder.slice(1)):f.default.inverse(f.default.hidden("_")),i=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${t.trim()}
|
|
45
|
-
${f.default.yellow(
|
|
46
|
-
${f.default.yellow(
|
|
47
|
-
`;case"submit":return`${t}${f.default.gray(
|
|
48
|
-
`+f.default.gray(
|
|
49
|
-
${f.default.cyan(
|
|
50
|
-
`}}}).prompt(),
|
|
51
|
-
${
|
|
52
|
-
`,n=this.value?t:r;switch(this.state){case"submit":return`${i}${f.default.gray(
|
|
53
|
-
${f.default.gray(
|
|
54
|
-
${f.default.cyan(
|
|
55
|
-
`}}}).prompt()},
|
|
56
|
-
${
|
|
57
|
-
`;switch(this.state){case"submit":return`${i}${f.default.gray(
|
|
58
|
-
${f.default.gray(
|
|
59
|
-
${f.default.cyan(
|
|
60
|
-
${f.default.cyan(
|
|
61
|
-
`}}}}).prompt()},
|
|
62
|
-
${f.default.reset(f.default.dim(`Press ${f.default.gray(f.default.bgWhite(f.default.inverse(" space ")))} to select, ${f.default.gray(f.default.bgWhite(f.default.inverse(" enter ")))} to submit`))}`},render(){let r=`${f.default.gray(
|
|
63
|
-
${
|
|
64
|
-
`;switch(this.state){case"submit":return`${r}${f.default.gray(
|
|
65
|
-
${f.default.gray(
|
|
66
|
-
`).map((n,o)=>o===0?`${f.default.yellow(
|
|
67
|
-
`);return r+f.default.yellow(
|
|
68
|
-
${f.default.yellow(
|
|
45
|
+
${f.default.yellow(F)} ${i}
|
|
46
|
+
${f.default.yellow(rt)} ${f.default.yellow(this.error)}
|
|
47
|
+
`;case"submit":return`${t}${f.default.gray(F)} ${f.default.dim(this.value||e.placeholder)}`;case"cancel":return`${t}${f.default.gray(F)} ${f.default.strikethrough(f.default.dim(this.value??""))}${this.value?.trim()?`
|
|
48
|
+
`+f.default.gray(F):""}`;default:return`${t}${f.default.cyan(F)} ${i}
|
|
49
|
+
${f.default.cyan(rt)}
|
|
50
|
+
`}}}).prompt(),ge=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new gi({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let i=`${f.default.gray(F)}
|
|
51
|
+
${Ci(this.state)} ${e.message}
|
|
52
|
+
`,n=this.value?t:r;switch(this.state){case"submit":return`${i}${f.default.gray(F)} ${f.default.dim(n)}`;case"cancel":return`${i}${f.default.gray(F)} ${f.default.strikethrough(f.default.dim(n))}
|
|
53
|
+
${f.default.gray(F)}`;default:return`${i}${f.default.cyan(F)} ${this.value?`${f.default.green(Rs)} ${t}`:`${f.default.dim($s)} ${f.default.dim(t)}`} ${f.default.dim("/")} ${this.value?`${f.default.dim($s)} ${f.default.dim(r)}`:`${f.default.green(Rs)} ${r}`}
|
|
54
|
+
${f.default.cyan(rt)}
|
|
55
|
+
`}}}).prompt()},He=e=>{let t=(i,n)=>{let o=i.label??String(i.value);return n==="active"?`${f.default.green(Rs)} ${o} ${i.hint?f.default.dim(`(${i.hint})`):""}`:n==="selected"?`${f.default.dim(o)}`:n==="cancelled"?`${f.default.strikethrough(f.default.dim(o))}`:`${f.default.dim($s)} ${f.default.dim(o)}`},r=0;return new gc({options:e.options,initialValue:e.initialValue,render(){let i=`${f.default.gray(F)}
|
|
56
|
+
${Ci(this.state)} ${e.message}
|
|
57
|
+
`;switch(this.state){case"submit":return`${i}${f.default.gray(F)} ${t(this.options[this.cursor],"selected")}`;case"cancel":return`${i}${f.default.gray(F)} ${t(this.options[this.cursor],"cancelled")}
|
|
58
|
+
${f.default.gray(F)}`;default:{let n=e.maxItems===void 0?1/0:Math.max(e.maxItems,5);this.cursor>=r+n-3?r=Math.max(Math.min(this.cursor-n+3,this.options.length-n),0):this.cursor<r+2&&(r=Math.max(this.cursor-2,0));let o=n<this.options.length&&r>0,s=n<this.options.length&&r+n<this.options.length;return`${i}${f.default.cyan(F)} ${this.options.slice(r,r+n).map((a,u,c)=>u===0&&o?f.default.dim("..."):u===c.length-1&&s?f.default.dim("..."):t(a,u+r===this.cursor?"active":"inactive")).join(`
|
|
59
|
+
${f.default.cyan(F)} `)}
|
|
60
|
+
${f.default.cyan(rt)}
|
|
61
|
+
`}}}}).prompt()},Ps=e=>{let t=(r,i)=>{let n=r.label??String(r.value);return i==="active"?`${f.default.cyan(Ng)} ${n} ${r.hint?f.default.dim(`(${r.hint})`):""}`:i==="selected"?`${f.default.green(yc)} ${f.default.dim(n)}`:i==="cancelled"?`${f.default.strikethrough(f.default.dim(n))}`:i==="active-selected"?`${f.default.green(yc)} ${n} ${r.hint?f.default.dim(`(${r.hint})`):""}`:i==="submitted"?`${f.default.dim(n)}`:`${f.default.dim(jg)} ${f.default.dim(n)}`};return new fc({options:e.options,initialValues:e.initialValues,required:e.required??!0,cursorAt:e.cursorAt,validate(r){if(this.required&&r.length===0)return`Please select at least one option.
|
|
62
|
+
${f.default.reset(f.default.dim(`Press ${f.default.gray(f.default.bgWhite(f.default.inverse(" space ")))} to select, ${f.default.gray(f.default.bgWhite(f.default.inverse(" enter ")))} to submit`))}`},render(){let r=`${f.default.gray(F)}
|
|
63
|
+
${Ci(this.state)} ${e.message}
|
|
64
|
+
`;switch(this.state){case"submit":return`${r}${f.default.gray(F)} ${this.options.filter(({value:i})=>this.value.includes(i)).map(i=>t(i,"submitted")).join(f.default.dim(", "))||f.default.dim("none")}`;case"cancel":{let i=this.options.filter(({value:n})=>this.value.includes(n)).map(n=>t(n,"cancelled")).join(f.default.dim(", "));return`${r}${f.default.gray(F)} ${i.trim()?`${i}
|
|
65
|
+
${f.default.gray(F)}`:""}`}case"error":{let i=this.error.split(`
|
|
66
|
+
`).map((n,o)=>o===0?`${f.default.yellow(rt)} ${f.default.yellow(n)}`:` ${n}`).join(`
|
|
67
|
+
`);return r+f.default.yellow(F)+" "+this.options.map((n,o)=>{let s=this.value.includes(n.value),a=o===this.cursor;return a&&s?t(n,"active-selected"):s?t(n,"selected"):t(n,a?"active":"inactive")}).join(`
|
|
68
|
+
${f.default.yellow(F)} `)+`
|
|
69
69
|
`+i+`
|
|
70
|
-
`}default:return`${r}${f.default.cyan(
|
|
71
|
-
${f.default.cyan(
|
|
72
|
-
${f.default.cyan(
|
|
73
|
-
`}}}).prompt()},
|
|
70
|
+
`}default:return`${r}${f.default.cyan(F)} ${this.options.map((i,n)=>{let o=this.value.includes(i.value),s=n===this.cursor;return s&&o?t(i,"active-selected"):o?t(i,"selected"):t(i,s?"active":"inactive")}).join(`
|
|
71
|
+
${f.default.cyan(F)} `)}
|
|
72
|
+
${f.default.cyan(rt)}
|
|
73
|
+
`}}}).prompt()},Ts=e=>e.replace(Gg(),""),pe=(e="",t="")=>{let r=`
|
|
74
74
|
${e}
|
|
75
75
|
`.split(`
|
|
76
|
-
`),i=
|
|
77
|
-
`);process.stdout.write(`${f.default.gray(
|
|
78
|
-
${f.default.green(
|
|
76
|
+
`),i=Ts(t).length,n=Math.max(r.reduce((s,a)=>(a=Ts(a),a.length>s?a.length:s),0),i)+2,o=r.map(s=>`${f.default.gray(F)} ${f.default.dim(s)}${" ".repeat(n-Ts(s).length)}${f.default.gray(F)}`).join(`
|
|
77
|
+
`);process.stdout.write(`${f.default.gray(F)}
|
|
78
|
+
${f.default.green(bi)} ${f.default.reset(t)} ${f.default.gray(bc.repeat(Math.max(n-i-1,1))+Bg)}
|
|
79
79
|
${o}
|
|
80
|
-
${f.default.gray(
|
|
81
|
-
`)},
|
|
82
|
-
|
|
83
|
-
`)},
|
|
84
|
-
`)},
|
|
85
|
-
${f.default.gray(
|
|
86
|
-
|
|
87
|
-
`)},
|
|
88
|
-
`);
|
|
89
|
-
`)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
${
|
|
94
|
-
${
|
|
95
|
-
${
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`):""}`)}async function WD(e={}){let t=e.cwd||process.cwd(),r={...process.env,...e.env},i=(typeof e.packageManager=="string"?bt.find(n=>n.name===e.packageManager):e.packageManager)||await el(e.cwd||process.cwd());if(!i)throw Error("No package manager auto-detected.");return{cwd:t,env:r,silent:e.silent??!1,packageManager:i,dev:e.dev??!1,workspace:e.workspace,global:e.global??!1,dry:e.dry??!1,corepack:e.corepack??!0}}function HD(e){let[t,r]=(e||"").split("@"),[i,n]=r?.split("+")||[];if(t&&t!=="-"&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t))return{name:t,version:i,buildMeta:n};let o=(t||"").replace(/\W+/g,"");return{name:o,version:i,buildMeta:n,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${t}\` to \`${o}\``]}}async function el(e,t={}){let r=await LD(ce(e||"."),async i=>{if(!t.ignorePackageJSON){let n=Gc(i,"package.json");if(zs(n)){let o=JSON.parse(await Yg(n,"utf8"));if(o?.packageManager){let{name:s,version:a="0.0.0",buildMeta:u,warnings:c}=HD(o.packageManager);if(s){let l=a.split(".")[0],h=bt.find(p=>p.name===s&&p.majorVersion===l)||bt.find(p=>p.name===s);return{name:s,command:s,version:a,majorVersion:l,buildMeta:u,warnings:c,files:h?.files,lockFile:h?.lockFile}}}}if(zs(Gc(i,"deno.json")))return bt.find(o=>o.name==="deno")}if(!t.ignoreLockFile){for(let n of bt)if([n.lockFile,n.files].flat().filter(Boolean).some(o=>zs(ce(i,o))))return{...n}}},{includeParentDirs:t.includeParentDirs??!0});if(!r&&!t.ignoreArgv){let i=process.argv[1];if(i){for(let n of bt)if(RegExp(`[/\\\\]\\.?${n.command}`).test(i))return n}}return r}async function GD(e={}){let t=await WD(e),r=e.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"]}[t.packageManager.name]:["install"];return e.ignoreWorkspace&&t.packageManager.name==="pnpm"&&r.push("--ignore-workspace"),t.dry||await zD(t.packageManager.command,r,{cwd:t.cwd,silent:t.silent,corepack:t.corepack}),{exec:{command:t.packageManager.command,args:r}}}var iD,nD,sD,Zc,Hc,Jc,Gc,ce,Cr,Kc,Ws,Hs,aD,Qc,uD,cD,lD,hD,de,pD,mD,it,dD,Vc,yD,bD,CD,wD,vD,ED,SD,FD,xD,kD,AD,_D,TD,OD,qc,RD,$D,ND,Gs,jD,BD,UD,bt,Vs=D(()=>{Us();iD=/^[A-Za-z]:\//;nD=/^[/\\]{2}/,sD=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Zc=/^[A-Za-z]:$/,Hc=/^\/([A-Za-z]:)?$/,Jc=function(e){if(e.length===0)return".";e=Ti(e);let t=e.match(nD),r=Cr(e),i=e[e.length-1]==="/";return e=Xc(e,!r),e.length===0?r?"/":i?"./":".":(i&&(e+="/"),Zc.test(e)&&(e+="/"),t?r?`//${e}`:`//./${e}`:r&&!Cr(e)?`/${e}`:e)},Gc=function(...e){let t="";for(let r of e)if(r)if(t.length>0){let i=t[t.length-1]==="/",n=r[0]==="/";i&&n?t+=r.slice(1):t+=i||n?r:`/${r}`}else t+=r;return Jc(t)};ce=function(...e){e=e.map(i=>Ti(i));let t="",r=!1;for(let i=e.length-1;i>=-1&&!r;i--){let n=i>=0?e[i]:oD();!n||n.length===0||(t=`${n}/${t}`,r=Cr(n))}return t=Xc(t,!r),r&&!Cr(t)?`/${t}`:t.length>0?t:"."};Cr=function(e){return sD.test(e)},Kc=function(e,t){let r=ce(e).replace(Hc,"$1").split("/"),i=ce(t).replace(Hc,"$1").split("/");if(i[0][1]===":"&&r[0][1]===":"&&r[0]!==i[0])return i.join("/");let n=[...r];for(let o of n){if(i[0]!==o)break;r.shift(),i.shift()}return[...r.map(()=>".."),...i].join("/")},Ws=function(e){let t=Ti(e).replace(/\/$/,"").split("/").slice(0,-1);return t.length===1&&Zc.test(t[0])&&(t[0]+="/"),t.join("/")||(Cr(e)?"/":".")},Hs=function(e,t){let r=Ti(e).split("/"),i="";for(let n=r.length-1;n>=0;n--){let o=r[n];if(o){i=o;break}}return t&&i.endsWith(t)?i.slice(0,-t.length):i},aD=Object.create,Qc=Object.defineProperty,uD=Object.getOwnPropertyDescriptor,cD=Object.getOwnPropertyNames,lD=Object.getPrototypeOf,hD=Object.prototype.hasOwnProperty,de=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),pD=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=cD(t),o=0,s=n.length,a;o<s;o++)a=n[o],!hD.call(e,a)&&a!==r&&Qc(e,a,{get:(u=>t[u]).bind(null,a),enumerable:!(i=uD(t,a))||i.enumerable});return e},mD=(e,t,r)=>(r=e==null?{}:aD(lD(e)),pD(t||!e||!e.__esModule?Qc(r,"default",{value:e,enumerable:!0}):r,e)),it=Xg(import.meta.url),dD=/^path$/i,Vc={key:"PATH",value:""};yD=e=>{let t=e.length,r=new Zg,i=()=>{--t===0&&r.emit("end")};for(let n of e)n.pipe(r,{end:!1}),n.on("end",i);return r},bD=de((e,t)=>{t.exports=o,o.sync=s;var r=it("fs");function i(a,u){var c=u.pathExt===void 0?process.env.PATHEXT:u.pathExt;if(!c||(c=c.split(";"),c.indexOf("")!==-1))return!0;for(var l=0;l<c.length;l++){var h=c[l].toLowerCase();if(h&&a.substr(-h.length).toLowerCase()===h)return!0}return!1}function n(a,u,c){return!a.isSymbolicLink()&&!a.isFile()?!1:i(u,c)}function o(a,u,c){r.stat(a,function(l,h){c(l,l?!1:n(h,a,u))})}function s(a,u){return n(r.statSync(a),a,u)}}),CD=de((e,t)=>{t.exports=i,i.sync=n;var r=it("fs");function i(a,u,c){r.stat(a,function(l,h){c(l,l?!1:o(h,u))})}function n(a,u){return o(r.statSync(a),u)}function o(a,u){return a.isFile()&&s(a,u)}function s(a,u){var c=a.mode,l=a.uid,h=a.gid,p=u.uid===void 0?process.getuid&&process.getuid():u.uid,m=u.gid===void 0?process.getgid&&process.getgid():u.gid,g=64,y=8,v=1,w=g|y;return c&v||c&y&&h===m||c&g&&l===p||c&w&&p===0}}),wD=de((e,t)=>{it("fs");var r=process.platform==="win32"||global.TESTING_WINDOWS?bD():CD();t.exports=i,i.sync=n;function i(o,s,a){if(typeof s=="function"&&(a=s,s={}),!a){if(typeof Promise!="function")throw TypeError("callback not provided");return new Promise(function(u,c){i(o,s||{},function(l,h){l?c(l):u(h)})})}r(o,s||{},function(u,c){u&&(u.code==="EACCES"||s&&s.ignoreErrors)&&(u=null,c=!1),a(u,c)})}function n(o,s){try{return r.sync(o,s||{})}catch(a){if(s&&s.ignoreErrors||a.code==="EACCES")return!1;throw a}}}),vD=de((e,t)=>{let r=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",i=it("path"),n=r?";":":",o=wD(),s=c=>Object.assign(Error(`not found: ${c}`),{code:"ENOENT"}),a=(c,l)=>{let h=l.colon||n,p=c.match(/\//)||r&&c.match(/\\/)?[""]:[...r?[process.cwd()]:[],...(l.path||process.env.PATH||"").split(h)],m=r?l.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=r?m.split(h):[""];return r&&c.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:p,pathExt:g,pathExtExe:m}},u=(c,l,h)=>{typeof l=="function"&&(h=l,l={}),l||={};let{pathEnv:p,pathExt:m,pathExtExe:g}=a(c,l),y=[],v=C=>new Promise(($,Y)=>{if(C===p.length)return l.all&&y.length?$(y):Y(s(c));let T=p[C],Nt=/^".*"$/.test(T)?T.slice(1,-1):T,Be=i.join(Nt,c);$(w(!Nt&&/^\.[\\\/]/.test(c)?c.slice(0,2)+Be:Be,C,0))}),w=(C,$,Y)=>new Promise((T,Nt)=>{if(Y===m.length)return T(v($+1));let Be=m[Y];o(C+Be,{pathExt:g},(Sf,Ff)=>{if(!Sf&&Ff)if(l.all)y.push(C+Be);else return T(C+Be);return T(w(C,$,Y+1))})});return h?v(0).then(C=>h(null,C),h):v(0)};t.exports=u,u.sync=(c,l)=>{l||={};let{pathEnv:h,pathExt:p,pathExtExe:m}=a(c,l),g=[];for(let y=0;y<h.length;y++){let v=h[y],w=/^".*"$/.test(v)?v.slice(1,-1):v,C=i.join(w,c),$=!w&&/^\.[\\\/]/.test(c)?c.slice(0,2)+C:C;for(let Y=0;Y<p.length;Y++){let T=$+p[Y];try{if(o.sync(T,{pathExt:m}))if(l.all)g.push(T);else return T}catch{}}}if(l.all&&g.length)return g;if(l.nothrow)return null;throw s(c)}}),ED=de((e,t)=>{let r=(i={})=>{let n=i.env||process.env;return(i.platform||process.platform)==="win32"?Object.keys(n).reverse().find(o=>o.toUpperCase()==="PATH")||"Path":"PATH"};t.exports=r,t.exports.default=r}),SD=de((e,t)=>{let r=it("path"),i=vD(),n=ED();function o(a,u){let c=a.options.env||process.env,l=process.cwd(),h=a.options.cwd!=null,p=h&&process.chdir!==void 0&&!process.chdir.disabled;if(p)try{process.chdir(a.options.cwd)}catch{}let m;try{m=i.sync(a.command,{path:c[n({env:c})],pathExt:u?r.delimiter:void 0})}catch{}finally{p&&process.chdir(l)}return m&&=r.resolve(h?a.options.cwd:"",m),m}function s(a){return o(a)||o(a,!0)}t.exports=s}),FD=de((e,t)=>{let r=/([()\][%!^"`<>&|;, *?])/g;function i(o){return o=o.replace(r,"^$1"),o}function n(o,s){return o=`${o}`,o=o.replace(/(\\*)"/g,'$1$1\\"'),o=o.replace(/(\\*)$/,"$1$1"),o=`"${o}"`,o=o.replace(r,"^$1"),s&&(o=o.replace(r,"^$1")),o}t.exports.command=i,t.exports.argument=n}),xD=de((e,t)=>{t.exports=/^#!(.*)/}),kD=de((e,t)=>{let r=xD();t.exports=(i="")=>{let n=i.match(r);if(!n)return null;let[o,s]=n[0].replace(/#! ?/,"").split(" "),a=o.split("/").pop();return a==="env"?s:s?`${a} ${s}`:a}}),AD=de((e,t)=>{let r=it("fs"),i=kD();function n(o){let s=Buffer.alloc(150),a;try{a=r.openSync(o,"r"),r.readSync(a,s,0,150,0),r.closeSync(a)}catch{}return i(s.toString())}t.exports=n}),_D=de((e,t)=>{let r=it("path"),i=SD(),n=FD(),o=AD(),s=process.platform==="win32",a=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function c(p){p.file=i(p);let m=p.file&&o(p.file);return m?(p.args.unshift(p.file),p.command=m,i(p)):p.file}function l(p){if(!s)return p;let m=c(p),g=!a.test(m);if(p.options.forceShell||g){let y=u.test(m);p.command=r.normalize(p.command),p.command=n.command(p.command),p.args=p.args.map(v=>n.argument(v,y)),p.args=["/d","/s","/c",`"${[p.command].concat(p.args).join(" ")}"`],p.command=process.env.comspec||"cmd.exe",p.options.windowsVerbatimArguments=!0}return p}function h(p,m,g){m&&!Array.isArray(m)&&(g=m,m=null),m=m?m.slice(0):[],g=Object.assign({},g);let y={command:p,args:m,options:g,file:void 0,original:{command:p,args:m}};return g.shell?y:l(y)}t.exports=h}),TD=de((e,t)=>{let r=process.platform==="win32";function i(a,u){return Object.assign(Error(`${u} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${u} ${a.command}`,path:a.command,spawnargs:a.args})}function n(a,u){if(!r)return;let c=a.emit;a.emit=function(l,h){if(l==="exit"){let p=o(h,u,"spawn");if(p)return c.call(a,"error",p)}return c.apply(a,arguments)}}function o(a,u){return r&&a===1&&!u.file?i(u.original,"spawn"):null}function s(a,u){return r&&a===1&&!u.file?i(u.original,"spawnSync"):null}t.exports={hookChildProcess:n,verifyENOENT:o,verifyENOENTSync:s,notFoundError:i}}),OD=mD(de((e,t)=>{let r=it("child_process"),i=_D(),n=TD();function o(a,u,c){let l=i(a,u,c),h=r.spawn(l.command,l.args,l.options);return n.hookChildProcess(h,l),h}function s(a,u,c){let l=i(a,u,c),h=r.spawnSync(l.command,l.args,l.options);return h.error=h.error||n.verifyENOENTSync(h.status,l),h}t.exports=o,t.exports.spawn=o,t.exports.sync=s,t.exports._parse=i,t.exports._enoent=n})(),1),qc=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}},RD={timeout:void 0,persist:!1},$D={windowsHide:!0};ND=class{_process;_aborted=!1;_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,r){this._options={...RD,...r},this._command=e,this._args=t??[],this._processClosed=new Promise(i=>{this._resolveClose=i})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,r){return jD(e,t,{...r,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 r=yD(t),i=rD.createInterface({input:r});for await(let n of i)yield n.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 qc(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error("No process was started");let[t,r]=await Promise.all([this._streamOut?Yc(this._streamOut):"",this._streamErr?Yc(this._streamErr):""]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let i={stderr:r,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new qc(this,i);return i}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=tD(),t=this._options,r={...$D,...t.nodeOptions},i=[];this._resetState(),t.timeout!==void 0&&i.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&i.push(t.signal),t.persist===!0&&(r.detached=!0),i.length>0&&(r.signal=ID(i)),r.env=DD(e,r.env);let{command:n,args:o}=PD(this._command,this._args),s=(0,OD._parse)(n,o,r),a=Jg(s.command,s.args,s.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:u}=t.stdin.process;u&&u.pipe(a.stdin)}}_resetState(){this._aborted=!1,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=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}},Gs=(e,t,r)=>{let i=new ND(e,t,r);return i.spawn(),i},jD=Gs,BD=_i({detectPackageManager:()=>el,installDependencies:()=>GD,packageManagers:()=>bt});UD=MD(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:e}=await Gs("corepack",["--version"]);return e===0}catch{return!1}});bt=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}]});import ol from"node:stream";import VD from"events";import le from"fs";import{EventEmitter as so}from"node:events";import{StringDecoder as qD}from"node:string_decoder";var rl,YD,ZD,JD,We,He,nt,Oi,wr,Ri,il,$i,nl,Se,Ut,Z,vr,zt,J,oe,X,qs,Pi,te,z,Ys,Zs,sl,Js,Oe,Xs,Ii,Er,Ct,fe,Sr,XD,KD,QD,ey,al,ty,ry,iy,qe,ny,ot,xe,Fr,A,Ks,Ve,Qs,io,no,kr,Ni,Gt,Vt,eo,Wt,at,Fe,st,Re,Ht,to,Ge,xr,ro,ji,wt,Bi,vt,Li,ul,Ar,oo,ao=D(()=>{rl=typeof process=="object"&&process?process:{stdout:null,stderr:null},YD=e=>!!e&&typeof e=="object"&&(e instanceof qe||e instanceof ol||ZD(e)||JD(e)),ZD=e=>!!e&&typeof e=="object"&&e instanceof so&&typeof e.pipe=="function"&&e.pipe!==ol.Writable.prototype.pipe,JD=e=>!!e&&typeof e=="object"&&e instanceof so&&typeof e.write=="function"&&typeof e.end=="function",We=Symbol("EOF"),He=Symbol("maybeEmitEnd"),nt=Symbol("emittedEnd"),Oi=Symbol("emittingEnd"),wr=Symbol("emittedError"),Ri=Symbol("closed"),il=Symbol("read"),$i=Symbol("flush"),nl=Symbol("flushChunk"),Se=Symbol("encoding"),Ut=Symbol("decoder"),Z=Symbol("flowing"),vr=Symbol("paused"),zt=Symbol("resume"),J=Symbol("buffer"),oe=Symbol("pipes"),X=Symbol("bufferLength"),qs=Symbol("bufferPush"),Pi=Symbol("bufferShift"),te=Symbol("objectMode"),z=Symbol("destroyed"),Ys=Symbol("error"),Zs=Symbol("emitData"),sl=Symbol("emitEnd"),Js=Symbol("emitEnd2"),Oe=Symbol("async"),Xs=Symbol("abort"),Ii=Symbol("aborted"),Er=Symbol("signal"),Ct=Symbol("dataListeners"),fe=Symbol("discarded"),Sr=e=>Promise.resolve().then(e),XD=e=>e(),KD=e=>e==="end"||e==="finish"||e==="prefinish",QD=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,ey=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),al=class{src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[zt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ty=class extends al{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},ry=e=>!!e.objectMode,iy=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",qe=class extends so{[Z]=!1;[vr]=!1;[oe]=[];[J]=[];[te];[Se];[Oe];[Ut];[We]=!1;[nt]=!1;[Oi]=!1;[Ri]=!1;[wr]=null;[X]=0;[z]=!1;[Er];[Ii]=!1;[Ct]=0;[fe]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");ry(t)?(this[te]=!0,this[Se]=null):iy(t)?(this[Se]=t.encoding,this[te]=!1):(this[te]=!1,this[Se]=null),this[Oe]=!!t.async,this[Ut]=this[Se]?new qD(this[Se]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[J]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[oe]});let{signal:r}=t;r&&(this[Er]=r,r.aborted?this[Xs]():r.addEventListener("abort",()=>this[Xs]()))}get bufferLength(){return this[X]}get encoding(){return this[Se]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[te]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[Oe]}set async(e){this[Oe]=this[Oe]||!!e}[Xs](){this[Ii]=!0,this.emit("abort",this[Er]?.reason),this.destroy(this[Er]?.reason)}get aborted(){return this[Ii]}set aborted(e){}write(e,t,r){if(this[Ii])return!1;if(this[We])throw Error("write after end");if(this[z])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||="utf8";let i=this[Oe]?Sr:XD;if(!this[te]&&!Buffer.isBuffer(e)){if(ey(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(QD(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[te]?(this[Z]&&this[X]!==0&&this[$i](!0),this[Z]?this.emit("data",e):this[qs](e),this[X]!==0&&this.emit("readable"),r&&i(r),this[Z]):e.length?(typeof e=="string"&&!(t===this[Se]&&!this[Ut]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Se]&&(e=this[Ut].write(e)),this[Z]&&this[X]!==0&&this[$i](!0),this[Z]?this.emit("data",e):this[qs](e),this[X]!==0&&this.emit("readable"),r&&i(r),this[Z]):(this[X]!==0&&this.emit("readable"),r&&i(r),this[Z])}read(e){if(this[z])return null;if(this[fe]=!1,this[X]===0||e===0||e&&e>this[X])return this[He](),null;this[te]&&(e=null),this[J].length>1&&!this[te]&&(this[J]=[this[Se]?this[J].join(""):Buffer.concat(this[J],this[X])]);let t=this[il](e||null,this[J][0]);return this[He](),t}[il](e,t){if(this[te])this[Pi]();else{let r=t;e===r.length||e===null?this[Pi]():typeof r=="string"?(this[J][0]=r.slice(e),t=r.slice(0,e),this[X]-=e):(this[J][0]=r.subarray(e),t=r.subarray(0,e),this[X]-=e)}return this.emit("data",t),!this[J].length&&!this[We]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[We]=!0,this.writable=!1,(this[Z]||!this[vr])&&this[He](),this}[zt](){this[z]||(!this[Ct]&&!this[oe].length&&(this[fe]=!0),this[vr]=!1,this[Z]=!0,this.emit("resume"),this[J].length?this[$i]():this[We]?this[He]():this.emit("drain"))}resume(){return this[zt]()}pause(){this[Z]=!1,this[vr]=!0,this[fe]=!1}get destroyed(){return this[z]}get flowing(){return this[Z]}get paused(){return this[vr]}[qs](e){this[te]?this[X]+=1:this[X]+=e.length,this[J].push(e)}[Pi](){return this[te]?--this[X]:this[X]-=this[J][0].length,this[J].shift()}[$i](e=!1){do;while(this[nl](this[Pi]())&&this[J].length);!e&&!this[J].length&&!this[We]&&this.emit("drain")}[nl](e){return this.emit("data",e),this[Z]}pipe(e,t){if(this[z])return e;this[fe]=!1;let r=this[nt];return t||={},e===rl.stdout||e===rl.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[oe].push(t.proxyErrors?new ty(this,e,t):new al(this,e,t)),this[Oe]?Sr(()=>this[zt]()):this[zt]()),e}unpipe(e){let t=this[oe].find(r=>r.dest===e);t&&(this[oe].length===1?(this[Z]&&this[Ct]===0&&(this[Z]=!1),this[oe]=[]):this[oe].splice(this[oe].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[fe]=!1,this[Ct]++,!this[oe].length&&!this[Z]&&this[zt]();else if(e==="readable"&&this[X]!==0)super.emit("readable");else if(KD(e)&&this[nt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[wr]){let i=t;this[Oe]?Sr(()=>i.call(this,this[wr])):i.call(this,this[wr])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[Ct]=this.listeners("data").length,this[Ct]===0&&!this[fe]&&!this[oe].length&&(this[Z]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Ct]=0,!this[fe]&&!this[oe].length&&(this[Z]=!1)),t}get emittedEnd(){return this[nt]}[He](){!this[Oi]&&!this[nt]&&!this[z]&&this[J].length===0&&this[We]&&(this[Oi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ri]&&this.emit("close"),this[Oi]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==z&&this[z])return!1;if(e==="data")return!this[te]&&!r?!1:this[Oe]?(Sr(()=>this[Zs](r)),!0):this[Zs](r);if(e==="end")return this[sl]();if(e==="close"){if(this[Ri]=!0,!this[nt]&&!this[z])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[wr]=r,super.emit(Ys,r);let n=!this[Er]||this.listeners("error").length?super.emit("error",r):!1;return this[He](),n}else if(e==="resume"){let n=super.emit("resume");return this[He](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let i=super.emit(e,...t);return this[He](),i}[Zs](e){for(let r of this[oe])r.dest.write(e)===!1&&this.pause();let t=this[fe]?!1:super.emit("data",e);return this[He](),t}[sl](){return this[nt]?!1:(this[nt]=!0,this.readable=!1,this[Oe]?(Sr(()=>this[Js]()),!0):this[Js]())}[Js](){if(this[Ut]){let t=this[Ut].end();if(t){for(let r of this[oe])r.dest.write(t);this[fe]||super.emit("data",t)}}for(let t of this[oe])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[te]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[te]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[te])throw Error("cannot concat in objectMode");let e=await this.collect();return this[Se]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(z,()=>t(Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[fe]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[We])return t();let i,n,o=c=>{this.off("data",s),this.off("end",a),this.off(z,u),t(),n(c)},s=c=>{this.off("error",o),this.off("end",a),this.off(z,u),this.pause(),i({value:c,done:!!this[We]})},a=()=>{this.off("error",o),this.off("data",s),this.off(z,u),t(),i({done:!0,value:void 0})},u=()=>o(Error("stream destroyed"));return new Promise((c,l)=>{n=l,i=c,this.once(z,u),this.once("error",o),this.once("end",a),this.once("data",s)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[fe]=!1;let e=!1,t=()=>(this.pause(),this.off(Ys,t),this.off(z,t),this.off("end",t),e=!0,{done:!0,value:void 0});return this.once("end",t),this.once(Ys,t),this.once(z,t),{next:()=>{if(e)return t();let r=this.read();return r===null?t():{done:!1,value:r}},throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[z])return e?this.emit("error",e):this.emit(z),this;this[z]=!0,this[fe]=!0,this[J].length=0,this[X]=0;let t=this;return typeof t.close=="function"&&!this[Ri]&&t.close(),e?this.emit("error",e):this.emit(z),this}static get isStream(){return YD}},ny=le.writev,ot=Symbol("_autoClose"),xe=Symbol("_close"),Fr=Symbol("_ended"),A=Symbol("_fd"),Ks=Symbol("_finished"),Ve=Symbol("_flags"),Qs=Symbol("_flush"),io=Symbol("_handleChunk"),no=Symbol("_makeBuf"),kr=Symbol("_mode"),Ni=Symbol("_needDrain"),Gt=Symbol("_onerror"),Vt=Symbol("_onopen"),eo=Symbol("_onread"),Wt=Symbol("_onwrite"),at=Symbol("_open"),Fe=Symbol("_path"),st=Symbol("_pos"),Re=Symbol("_queue"),Ht=Symbol("_read"),to=Symbol("_readSize"),Ge=Symbol("_reading"),xr=Symbol("_remain"),ro=Symbol("_size"),ji=Symbol("_write"),wt=Symbol("_writing"),Bi=Symbol("_defaultFlag"),vt=Symbol("_errored"),Li=class extends qe{[vt]=!1;[A];[Fe];[to];[Ge]=!1;[ro];[xr];[ot];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[vt]=!1,this[A]=typeof t.fd=="number"?t.fd:void 0,this[Fe]=e,this[to]=t.readSize||16*1024*1024,this[Ge]=!1,this[ro]=typeof t.size=="number"?t.size:1/0,this[xr]=this[ro],this[ot]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[A]=="number"?this[Ht]():this[at]()}get fd(){return this[A]}get path(){return this[Fe]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[at](){le.open(this[Fe],"r",(e,t)=>this[Vt](e,t))}[Vt](e,t){e?this[Gt](e):(this[A]=t,this.emit("open",t),this[Ht]())}[no](){return Buffer.allocUnsafe(Math.min(this[to],this[xr]))}[Ht](){if(!this[Ge]){this[Ge]=!0;let e=this[no]();if(e.length===0)return process.nextTick(()=>this[eo](null,0,e));le.read(this[A],e,0,e.length,null,(t,r,i)=>this[eo](t,r,i))}}[eo](e,t,r){this[Ge]=!1,e?this[Gt](e):this[io](t,r)&&this[Ht]()}[xe](){if(this[ot]&&typeof this[A]=="number"){let e=this[A];this[A]=void 0,le.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Gt](e){this[Ge]=!0,this[xe](),this.emit("error",e)}[io](e,t){let r=!1;return this[xr]-=e,e>0&&(r=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[xr]<=0)&&(r=!1,this[xe](),super.end()),r}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[A]=="number"&&this[Ht](),!1;case"error":return this[vt]?!1:(this[vt]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},ul=class extends Li{[at](){let e=!0;try{this[Vt](null,le.openSync(this[Fe],"r")),e=!1}finally{e&&this[xe]()}}[Ht](){let e=!0;try{if(!this[Ge]){this[Ge]=!0;do{let t=this[no](),r=t.length===0?0:le.readSync(this[A],t,0,t.length,null);if(!this[io](r,t))break}while(!0);this[Ge]=!1}e=!1}finally{e&&this[xe]()}}[xe](){if(this[ot]&&typeof this[A]=="number"){let e=this[A];this[A]=void 0,le.closeSync(e),this.emit("close")}}},Ar=class extends VD{readable=!1;writable=!0;[vt]=!1;[wt]=!1;[Fr]=!1;[Re]=[];[Ni]=!1;[Fe];[kr];[ot];[A];[Bi];[Ve];[Ks]=!1;[st];constructor(e,t){t||={},super(t),this[Fe]=e,this[A]=typeof t.fd=="number"?t.fd:void 0,this[kr]=t.mode===void 0?438:t.mode,this[st]=typeof t.start=="number"?t.start:void 0,this[ot]=typeof t.autoClose=="boolean"?t.autoClose:!0;let r=this[st]===void 0?"w":"r+";this[Bi]=t.flags===void 0,this[Ve]=t.flags===void 0?r:t.flags,this[A]===void 0&&this[at]()}emit(e,...t){if(e==="error"){if(this[vt])return!1;this[vt]=!0}return super.emit(e,...t)}get fd(){return this[A]}get path(){return this[Fe]}[Gt](e){this[xe](),this[wt]=!0,this.emit("error",e)}[at](){le.open(this[Fe],this[Ve],this[kr],(e,t)=>this[Vt](e,t))}[Vt](e,t){this[Bi]&&this[Ve]==="r+"&&e&&e.code==="ENOENT"?(this[Ve]="w",this[at]()):e?this[Gt](e):(this[A]=t,this.emit("open",t),this[wt]||this[Qs]())}end(e,t){return e&&this.write(e,t),this[Fr]=!0,!this[wt]&&!this[Re].length&&typeof this[A]=="number"&&this[Wt](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[Fr]?(this.emit("error",Error("write() after end()")),!1):this[A]===void 0||this[wt]||this[Re].length?(this[Re].push(e),this[Ni]=!0,!1):(this[wt]=!0,this[ji](e),!0)}[ji](e){le.write(this[A],e,0,e.length,this[st],(t,r)=>this[Wt](t,r))}[Wt](e,t){e?this[Gt](e):(this[st]!==void 0&&typeof t=="number"&&(this[st]+=t),this[Re].length?this[Qs]():(this[wt]=!1,this[Fr]&&!this[Ks]?(this[Ks]=!0,this[xe](),this.emit("finish")):this[Ni]&&(this[Ni]=!1,this.emit("drain"))))}[Qs](){if(this[Re].length===0)this[Fr]&&this[Wt](null,0);else if(this[Re].length===1)this[ji](this[Re].pop());else{let e=this[Re];this[Re]=[],ny(this[A],e,this[st],(t,r)=>this[Wt](t,r))}}[xe](){if(this[ot]&&typeof this[A]=="number"){let e=this[A];this[A]=void 0,le.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},oo=class extends Ar{[at](){let e;if(this[Bi]&&this[Ve]==="r+")try{e=le.openSync(this[Fe],this[Ve],this[kr])}catch(t){if(t?.code==="ENOENT")return this[Ve]="w",this[at]();throw t}else e=le.openSync(this[Fe],this[Ve],this[kr]);this[Vt](null,e)}[xe](){if(this[ot]&&typeof this[A]=="number"){let e=this[A];this[A]=void 0,le.closeSync(e),this.emit("close")}}[ji](e){let t=!0;try{this[Wt](null,le.writeSync(this[A],e,0,e.length,this[st])),t=!1}finally{if(t)try{this[xe]()}catch{}}}}});import lo from"assert";import{Buffer as Et}from"buffer";import*as cl from"zlib";import sy from"zlib";var oy,$e,ay,ll,uy,uo,St,Mi,co,ho,hl,pl,ml,dl,fl,gl,Dl,yl,bl,Cl=D(()=>{ao();oy=sy.constants||{ZLIB_VERNUM:4736},$e=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},oy)),ay=Et.concat,ll=Object.getOwnPropertyDescriptor(Et,"concat"),uy=e=>e,uo=ll?.writable===!0||ll?.set!==void 0?e=>{Et.concat=e?uy:ay}:e=>{},St=Symbol("_superWrite"),Mi=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},co=Symbol("flushFlag"),ho=class extends qe{#e=!1;#i=!1;#t;#o;#s;#r;#n;get sawError(){return this.#e}get handle(){return this.#r}get flushFlag(){return this.#t}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#t=e.flush??0,this.#o=e.finishFlush??0,this.#s=e.fullFlushFlag??0,typeof cl[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#r=new cl[t](e)}catch(r){throw new Mi(r,this.constructor)}this.#n=r=>{this.#e||(this.#e=!0,this.close(),this.emit("error",r))},this.#r?.on("error",r=>this.#n(new Mi(r))),this.once("end",()=>this.close)}close(){this.#r&&(this.#r.close(),this.#r=void 0,this.emit("close"))}reset(){if(!this.#e)return lo(this.#r,"zlib binding closed"),this.#r.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#s),this.write(Object.assign(Et.alloc(0),{[co]:e})))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#o),this.#i=!0,super.end(r)}get ended(){return this.#i}[St](e){return super.write(e)}write(e,t,r){if(typeof t=="function"&&(r=t,t="utf8"),typeof e=="string"&&(e=Et.from(e,t)),this.#e)return;lo(this.#r,"zlib binding closed");let i=this.#r._handle,n=i.close;i.close=()=>{};let o=this.#r.close;this.#r.close=()=>{},uo(!0);let s;try{let u=typeof e[co]=="number"?e[co]:this.#t;s=this.#r._processChunk(e,u),uo(!1)}catch(u){uo(!1),this.#n(new Mi(u,this.write))}finally{this.#r&&(this.#r._handle=i,i.close=n,this.#r.close=o,this.#r.removeAllListeners("error"))}this.#r&&this.#r.on("error",u=>this.#n(new Mi(u,this.write)));let a;if(s)if(Array.isArray(s)&&s.length>0){let u=s[0];a=this[St](Et.from(u));for(let c=1;c<s.length;c++)a=this[St](s[c])}else a=this[St](Et.from(s));return r&&r(),a}},hl=class extends ho{#e;#i;constructor(e,t){e||={},e.flush=e.flush||$e.Z_NO_FLUSH,e.finishFlush=e.finishFlush||$e.Z_FINISH,e.fullFlushFlag=$e.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush($e.Z_SYNC_FLUSH),lo(this.handle,"zlib binding closed");let r=this.handle.flush;this.handle.flush=(i,n)=>{typeof i=="function"&&(n=i,i=this.flushFlag),this.flush(i),n?.()};try{this.handle.params(e,t)}finally{this.handle.flush=r}this.handle&&(this.#e=e,this.#i=t)}}}},pl=class extends hl{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[St](e){return this.#e?(this.#e=!1,e[9]=255,super[St](e)):super[St](e)}},ml=class extends hl{constructor(e){super(e,"Unzip")}},dl=class extends ho{constructor(e,t){e||={},e.flush=e.flush||$e.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||$e.BROTLI_OPERATION_FINISH,e.fullFlushFlag=$e.BROTLI_OPERATION_FLUSH,super(e,t)}},fl=class extends dl{constructor(e){super(e,"BrotliCompress")}},gl=class extends dl{constructor(e){super(e,"BrotliDecompress")}},Dl=class extends ho{constructor(e,t){e||={},e.flush=e.flush||$e.ZSTD_e_continue,e.finishFlush=e.finishFlush||$e.ZSTD_e_end,e.fullFlushFlag=$e.ZSTD_e_flush,super(e,t)}},yl=class extends Dl{constructor(e){super(e,"ZstdCompress")}},bl=class extends Dl{constructor(e){super(e,"ZstdDecompress")}}});import zi from"node:fs";import _r from"node:path";var po,Ui,cy,mo,ly,fo,wl=D(()=>{po=(e,t,r)=>{try{return zi.lchownSync(e,t,r)}catch(i){if(i?.code!=="ENOENT")throw i}},Ui=(e,t,r,i)=>{zi.lchown(e,t,r,n=>{i(n&&n?.code!=="ENOENT"?n:null)})},cy=(e,t,r,i,n)=>{t.isDirectory()?mo(_r.resolve(e,t.name),r,i,o=>{if(o)return n(o);Ui(_r.resolve(e,t.name),r,i,n)}):Ui(_r.resolve(e,t.name),r,i,n)},mo=(e,t,r,i)=>{zi.readdir(e,{withFileTypes:!0},(n,o)=>{if(n){if(n.code==="ENOENT")return i();if(n.code!=="ENOTDIR"&&n.code!=="ENOTSUP")return i(n)}if(n||!o.length)return Ui(e,t,r,i);let s=o.length,a=null,u=c=>{if(!a){if(c)return i(a=c);if(--s===0)return Ui(e,t,r,i)}};for(let c of o)cy(e,c,t,r,u)})},ly=(e,t,r,i)=>{t.isDirectory()&&fo(_r.resolve(e,t.name),r,i),po(_r.resolve(e,t.name),r,i)},fo=(e,t,r)=>{let i;try{i=zi.readdirSync(e,{withFileTypes:!0})}catch(n){let o=n;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return po(e,t,r);throw o}for(let n of i)ly(e,n,t,r);return po(e,t,r)}});var uh={};O(uh,{t:()=>k0});import hy from"node:fs/promises";import b from"node:fs";import H,{basename as py,join as Gl,posix as qt,win32 as my}from"node:path";import{EventEmitter as dy}from"events";import ie from"fs";import on,{dirname as fy,parse as gy}from"path";import Dy from"node:assert";import{randomBytes as Vl}from"node:crypto";function Qy(e,t,r){let i=new na(r,t,t?t.next:e.head,e);return i.next===void 0&&(e.tail=i),i.prev===void 0&&(e.head=i),e.length++,i}function e0(e,t){e.tail=new na(t,e.tail,void 0,e),e.head||=e.tail,e.length++}function t0(e,t){e.head=new na(t,void 0,e.head,e),e.tail||=e.head,e.length++}var yy,by,Cy,wy,vy,Ey,Sy,Xo,zr,Fy,xy,ky,Ay,_y,Ty,ql,Yl,go,Ko,Oy,ft,Ry,Ft,Do,$y,ht,Py,Iy,Ny,pt,jy,By,Ly,yo,My,xt,Ur,Uy,zy,Wy,S,Qo,cn,Ro,$o,Hy,Ce,kt,Ye,bo,vl,Pe,Tr,ut,El,R,Ze,ct,Co,At,W,Wi,Hi,wo,Sl,Fl,Or,vo,Gi,Yt,lt,Vi,_t,qi,Yi,xl,Gy,Qt,Ir,Vy,ea,Wr,Jl,qy,kl,ta,ln,ra,Yy,Zy,Al,Jy,Xl,_l,Tl,Ol,Po,Rl,Rr,Xi,Io,Ki,No,jo,Bo,Lo,mt,an,Mo,Eo,Ie,ia,Kl,Ql,Xy,Ky,na,Uo,$l,Qi,$r,ke,Tt,Ot,Pr,So,Ae,Fo,en,Pl,zo,Wo,tn,rn,Il,xo,nn,eh,ko,Hr,hn,r0,i0,th,rh,n0,s0,o0,a0,ih,u0,c0,nh,sh,oh,l0,h0,Ho,ah,p0,m0,Ao,Nl,Zt,d0,f0,g0,D0,jl,Go,Bl,Vo,we,qo,Yo,sn,Ll,Ml,Ul,zl,_o,dt,re,Zi,Wl,Jt,To,Oo,Zo,Nr,jr,Br,Lr,Mr,y0,b0,Hl,un,Ji,Jo,C0,w0,v0,E0,S0,F0,Kt,x0,k0,ch=D(()=>{Us();ao();Cl();wl();yy=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),by=e=>!!e.sync&&!!e.file,Cy=e=>!e.sync&&!!e.file,wy=e=>!!e.sync&&!e.file,vy=e=>!e.sync&&!e.file,Ey=e=>!!e.file,Sy=e=>yy.get(e)||e,Xo=(e={})=>{if(!e)return{};let t={};for(let[r,i]of Object.entries(e)){let n=Sy(r);t[n]=i}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},zr=(e,t,r,i,n)=>Object.assign((o=[],s,a)=>{Array.isArray(o)&&(s=o,o={}),typeof s=="function"&&(a=s,s=void 0),s=s?Array.from(s):[];let u=Xo(o);if(n?.(u,s),by(u)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(u,s)}else if(Cy(u)){let c=t(u,s),l=a||void 0;return l?c.then(()=>l(),l):c}else if(wy(u)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return r(u,s)}else if(vy(u)){if(typeof a=="function")throw TypeError("callback only supported with file option");return i(u,s)}else throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:r,asyncNoFile:i,validate:n}),Fy=(e,t)=>{if(Number.isSafeInteger(e))e<0?ky(e,t):xy(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},xy=(e,t)=>{t[0]=128;for(var r=t.length;r>1;r--)t[r-1]=e&255,e=Math.floor(e/256)},ky=(e,t)=>{t[0]=255;var r=!1;e*=-1;for(var i=t.length;i>1;i--){var n=e&255;e=Math.floor(e/256),r?t[i-1]=ql(n):n===0?t[i-1]=0:(r=!0,t[i-1]=Yl(n))}},Ay=e=>{let t=e[0],r=t===128?Ty(e.subarray(1,e.length)):t===255?_y(e):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},_y=e=>{for(var t=e.length,r=0,i=!1,n=t-1;n>-1;n--){var o=Number(e[n]),s;i?s=ql(o):o===0?s=o:(i=!0,s=Yl(o)),s!==0&&(r-=s*256**(t-n-1))}return r},Ty=e=>{for(var t=e.length,r=0,i=t-1;i>-1;i--){var n=Number(e[i]);n!==0&&(r+=n*256**(t-i-1))}return r},ql=e=>(255^e)&255,Yl=e=>(255^e)+1&255,go=e=>Ko.has(e),Ko=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Oy=new Map(Array.from(Ko).map(e=>[e[1],e[0]])),ft=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,r,i){Buffer.isBuffer(e)?this.decode(e,t||0,r,i):e&&this.#i(e)}decode(e,t,r,i){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");this.path=r?.path??Ft(e,t,100),this.mode=r?.mode??i?.mode??ht(e,t+100,8),this.uid=r?.uid??i?.uid??ht(e,t+108,8),this.gid=r?.gid??i?.gid??ht(e,t+116,8),this.size=r?.size??i?.size??ht(e,t+124,12),this.mtime=r?.mtime??i?.mtime??Do(e,t+136,12),this.cksum=ht(e,t+148,12),i&&this.#i(i,!0),r&&this.#i(r);let n=Ft(e,t+156,1);if(go(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=Ft(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=r?.uname??i?.uname??Ft(e,t+265,32),this.gname=r?.gname??i?.gname??Ft(e,t+297,32),this.devmaj=r?.devmaj??i?.devmaj??ht(e,t+329,8)??0,this.devmin=r?.devmin??i?.devmin??ht(e,t+337,8)??0,e[t+475]!==0)this.path=Ft(e,t+345,155)+"/"+this.path;else{let s=Ft(e,t+345,130);s&&(this.path=s+"/"+this.path),this.atime=r?.atime??i?.atime??Do(e,t+476,12),this.ctime=r?.ctime??i?.ctime??Do(e,t+488,12)}let o=256;for(let s=t;s<t+148;s++)o+=e[s];for(let s=t+156;s<t+512;s++)o+=e[s];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,i])=>!(i==null||r==="path"&&t||r==="linkpath"&&t||r==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let r=this.ctime||this.atime?130:155,i=Ry(this.path||"",r),n=i[0],o=i[1];this.needPax=!!i[2],this.needPax=xt(e,t,100,n)||this.needPax,this.needPax=pt(e,t+100,8,this.mode)||this.needPax,this.needPax=pt(e,t+108,8,this.uid)||this.needPax,this.needPax=pt(e,t+116,8,this.gid)||this.needPax,this.needPax=pt(e,t+124,12,this.size)||this.needPax,this.needPax=yo(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this.#e.charCodeAt(0),this.needPax=xt(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=xt(e,t+265,32,this.uname)||this.needPax,this.needPax=xt(e,t+297,32,this.gname)||this.needPax,this.needPax=pt(e,t+329,8,this.devmaj)||this.needPax,this.needPax=pt(e,t+337,8,this.devmin)||this.needPax,this.needPax=xt(e,t+345,r,o)||this.needPax,e[t+475]===0?(this.needPax=xt(e,t+345,130,o)||this.needPax,this.needPax=yo(e,t+476,12,this.atime)||this.needPax,this.needPax=yo(e,t+488,12,this.ctime)||this.needPax):this.needPax=xt(e,t+345,155,o)||this.needPax;let s=256;for(let a=t;a<t+148;a++)s+=e[a];for(let a=t+156;a<t+512;a++)s+=e[a];return this.cksum=s,pt(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Ko.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Oy.get(e));if(go(t)||t==="Unsupported")this.#e=t;else if(go(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},Ry=(e,t)=>{let r=e,i="",n,o=qt.parse(e).root||".";if(Buffer.byteLength(r)<100)n=[r,i,!1];else{i=qt.dirname(r),r=qt.basename(r);do Buffer.byteLength(r)<=100&&Buffer.byteLength(i)<=t?n=[r,i,!1]:Buffer.byteLength(r)>100&&Buffer.byteLength(i)<=t?n=[r.slice(0,99),i,!0]:(r=qt.join(qt.basename(i),r),i=qt.dirname(i));while(i!==o&&n===void 0);n||=[e.slice(0,99),"",!0]}return n},Ft=(e,t,r)=>e.subarray(t,t+r).toString("utf8").replace(/\0.*/,""),Do=(e,t,r)=>$y(ht(e,t,r)),$y=e=>e===void 0?void 0:new Date(e*1e3),ht=(e,t,r)=>Number(e[t])&128?Ay(e.subarray(t,t+r)):Iy(e,t,r),Py=e=>isNaN(e)?void 0:e,Iy=(e,t,r)=>Py(parseInt(e.subarray(t,t+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),Ny={12:8589934591,8:2097151},pt=(e,t,r,i)=>i===void 0?!1:i>Ny[r]||i<0?(Fy(i,e.subarray(t,t+r)),!0):(jy(e,t,r,i),!1),jy=(e,t,r,i)=>e.write(By(i,r),t,r,"ascii"),By=(e,t)=>Ly(Math.floor(e).toString(8),t),Ly=(e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0",yo=(e,t,r,i)=>i===void 0?!1:pt(e,t,r,i.getTime()/1e3),My=Array(156).join("\0"),xt=(e,t,r,i)=>i===void 0?!1:(e.write(i+My,t,r,"utf8"),i.length!==Buffer.byteLength(i)||i.length>r),Ur=class Zl{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=r,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let r=Buffer.byteLength(t),i=512*Math.ceil(1+r/512),n=Buffer.allocUnsafe(i);for(let o=0;o<512;o++)n[o]=0;new ft({path:("PaxHeader/"+py(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(n),n.write(t,512,r,"utf8");for(let o=r+512;o<n.length;o++)n[o]=0;return n}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let r=this[t],i=r instanceof Date?r.getTime()/1e3:r,n=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+i+`
|
|
101
|
-
|
|
102
|
-
`).reduce(Wy,Object.create(null)),Wy=(e,t)=>{let r=parseInt(t,10);if(r!==Buffer.byteLength(t)+1)return e;t=t.slice((r+" ").length);let i=t.split("="),n=i.shift();if(!n)return e;let o=n.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),s=i.join("=");return e[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,e},S=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?e=>e&&e.replace(/\\/g,"/"):e=>e,Qo=class extends qe{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,r){switch(super({}),this.pause(),this.extended=t,this.globalExtended=r,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw Error("no path provided for tar.ReadEntry");this.path=S(e.path),this.mode=e.mode,this.mode&&(this.mode&=4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?S(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),r&&this.#e(r,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw Error("writing more to entry than is appropriate");let r=this.remain,i=this.blockRemain;return this.remain=Math.max(0,r-t),this.blockRemain=Math.max(0,i-t),this.ignore?!0:r>=t?super.write(e):super.write(e.subarray(0,r))}#e(e,t=!1){e.path&&=S(e.path),e.linkpath&&=S(e.linkpath),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,i])=>!(i==null||r==="path"&&t))))}},cn=(e,t,r,i={})=>{e.file&&(i.file=e.file),e.cwd&&(i.cwd=e.cwd),i.code=r instanceof Error&&r.code||t,i.tarCode=t,!e.strict&&i.recoverable!==!1?(r instanceof Error&&(i=Object.assign(r,i),r=r.message),e.emit("warn",t,r,i)):r instanceof Error?e.emit("error",Object.assign(r,i)):e.emit("error",Object.assign(Error(`${t}: ${r}`),i))},Ro=Buffer.from([31,139]),$o=Buffer.from([40,181,47,253]),Hy=Math.max(Ro.length,$o.length),Ce=Symbol("state"),kt=Symbol("writeEntry"),Ye=Symbol("readEntry"),bo=Symbol("nextEntry"),vl=Symbol("processEntry"),Pe=Symbol("extendedHeader"),Tr=Symbol("globalExtendedHeader"),ut=Symbol("meta"),El=Symbol("emitMeta"),R=Symbol("buffer"),Ze=Symbol("queue"),ct=Symbol("ended"),Co=Symbol("emittedEnd"),At=Symbol("emit"),W=Symbol("unzip"),Wi=Symbol("consumeChunk"),Hi=Symbol("consumeChunkSub"),wo=Symbol("consumeBody"),Sl=Symbol("consumeMeta"),Fl=Symbol("consumeHeader"),Or=Symbol("consuming"),vo=Symbol("bufferConcat"),Gi=Symbol("maybeEnd"),Yt=Symbol("writing"),lt=Symbol("aborted"),Vi=Symbol("onDone"),_t=Symbol("sawValidEntry"),qi=Symbol("sawNullBlock"),Yi=Symbol("sawEOF"),xl=Symbol("closeStream"),Gy=()=>!0,Qt=class extends dy{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Ze]=[];[R];[Ye];[kt];[Ce]="begin";[ut]="";[Pe];[Tr];[ct]=!1;[W];[lt]=!1;[_t];[qi]=!1;[Yi]=!1;[Yt]=!1;[Or]=!1;[Co]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Vi,()=>{(this[Ce]==="begin"||this[_t]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Vi,e.ondone):this.on(Vi,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||1048576,this.filter=typeof e.filter=="function"?e.filter:Gy;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let r=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:r?!0:void 0,this.on("end",()=>this[xl]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,r={}){cn(this,e,t,r)}[Fl](e,t){this[_t]===void 0&&(this[_t]=!1);let r;try{r=new ft(e,t,this[Pe],this[Tr])}catch(i){return this.warn("TAR_ENTRY_INVALID",i)}if(r.nullBlock)this[qi]?(this[Yi]=!0,this[Ce]==="begin"&&(this[Ce]="header"),this[At]("eof")):(this[qi]=!0,this[At]("nullBlock"));else if(this[qi]=!1,!r.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r});else if(!r.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:r});else{let i=r.type;if(/^(Symbolic)?Link$/.test(i)&&!r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r});else if(!/^(Symbolic)?Link$/.test(i)&&!/^(Global)?ExtendedHeader$/.test(i)&&r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:r});else{let n=this[kt]=new Qo(r,this[Pe],this[Tr]);this[_t]||(n.remain?n.on("end",()=>{n.invalid||(this[_t]=!0)}):this[_t]=!0),n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[At]("ignoredEntry",n),this[Ce]="ignore",n.resume()):n.size>0&&(this[ut]="",n.on("data",o=>this[ut]+=o),this[Ce]="meta"):(this[Pe]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[At]("ignoredEntry",n),this[Ce]=n.remain?"ignore":"header",n.resume()):(n.remain?this[Ce]="body":(this[Ce]="header",n.end()),this[Ye]?this[Ze].push(n):(this[Ze].push(n),this[bo]())))}}}[xl](){queueMicrotask(()=>this.emit("close"))}[vl](e){let t=!0;if(!e)this[Ye]=void 0,t=!1;else if(Array.isArray(e)){let[r,...i]=e;this.emit(r,...i)}else this[Ye]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[bo]()),t=!1);return t}[bo](){do;while(this[vl](this[Ze].shift()));if(!this[Ze].length){let e=this[Ye];!e||e.flowing||e.size===e.remain?this[Yt]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[wo](e,t){let r=this[kt];if(!r)throw Error("attempt to consume body without entry??");let i=r.blockRemain??0,n=i>=e.length&&t===0?e:e.subarray(t,t+i);return r.write(n),r.blockRemain||(this[Ce]="header",this[kt]=void 0,r.end()),n.length}[Sl](e,t){let r=this[kt],i=this[wo](e,t);return!this[kt]&&r&&this[El](r),i}[At](e,t,r){!this[Ze].length&&!this[Ye]?this.emit(e,t,r):this[Ze].push([e,t,r])}[El](e){switch(this[At]("meta",this[ut]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Pe]=Ur.parse(this[ut],this[Pe],!1);break;case"GlobalExtendedHeader":this[Tr]=Ur.parse(this[ut],this[Tr],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Pe]??Object.create(null);this[Pe]=t,t.path=this[ut].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Pe]||Object.create(null);this[Pe]=t,t.linkpath=this[ut].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[lt]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[lt])return r?.(),!1;if((this[W]===void 0||this.brotli===void 0&&this[W]===!1)&&e){if(this[R]&&(e=Buffer.concat([this[R],e]),this[R]=void 0),e.length<Hy)return this[R]=e,r?.(),!0;for(let s=0;this[W]===void 0&&s<Ro.length;s++)e[s]!==Ro[s]&&(this[W]=!1);let n=!1;if(this[W]===!1&&this.zstd!==!1){n=!0;for(let s=0;s<$o.length;s++)if(e[s]!==$o[s]){n=!1;break}}let o=this.brotli===void 0&&!n;if(this[W]===!1&&o)if(e.length<512)if(this[ct])this.brotli=!0;else return this[R]=e,r?.(),!0;else try{new ft(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[W]===void 0||this[W]===!1&&(this.brotli||n)){let s=this[ct];this[ct]=!1,this[W]=this[W]===void 0?new ml({}):n?new bl({}):new gl({}),this[W].on("data",u=>this[Wi](u)),this[W].on("error",u=>this.abort(u)),this[W].on("end",()=>{this[ct]=!0,this[Wi]()}),this[Yt]=!0;let a=!!this[W][s?"end":"write"](e);return this[Yt]=!1,r?.(),a}}this[Yt]=!0,this[W]?this[W].write(e):this[Wi](e),this[Yt]=!1;let i=this[Ze].length?!1:this[Ye]?this[Ye].flowing:!0;return!i&&!this[Ze].length&&this[Ye]?.once("drain",()=>this.emit("drain")),r?.(),i}[vo](e){e&&!this[lt]&&(this[R]=this[R]?Buffer.concat([this[R],e]):e)}[Gi](){if(this[ct]&&!this[Co]&&!this[lt]&&!this[Or]){this[Co]=!0;let e=this[kt];if(e&&e.blockRemain){let t=this[R]?this[R].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[R]&&e.write(this[R]),e.end()}this[At](Vi)}}[Wi](e){if(this[Or]&&e)this[vo](e);else if(!e&&!this[R])this[Gi]();else if(e){if(this[Or]=!0,this[R]){this[vo](e);let t=this[R];this[R]=void 0,this[Hi](t)}else this[Hi](e);for(;this[R]&&this[R]?.length>=512&&!this[lt]&&!this[Yi];){let t=this[R];this[R]=void 0,this[Hi](t)}this[Or]=!1}(!this[R]||this[ct])&&this[Gi]()}[Hi](e){let t=0,r=e.length;for(;t+512<=r&&!this[lt]&&!this[Yi];)switch(this[Ce]){case"begin":case"header":this[Fl](e,t),t+=512;break;case"ignore":case"body":t+=this[wo](e,t);break;case"meta":t+=this[Sl](e,t);break;default:throw Error("invalid state: "+this[Ce])}t<r&&(this[R]?this[R]=Buffer.concat([e.subarray(t),this[R]]):this[R]=e.subarray(t))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),r&&this.once("finish",r),this[lt]||(this[W]?(e&&this[W].write(e),this[W].end()):(this[ct]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[Gi]())),this}},Ir=e=>{let t=e.length-1,r=-1;for(;t>-1&&e.charAt(t)==="/";)r=t,t--;return r===-1?e:e.slice(0,r)},Vy=e=>{let t=e.onReadEntry;e.onReadEntry=t?r=>{t(r),r.resume()}:r=>r.resume()},ea=(e,t)=>{let r=new Map(t.map(o=>[Ir(o),!0])),i=e.filter,n=(o,s="")=>{let a=s||gy(o).root||".",u;if(o===a)u=!1;else{let c=r.get(o);u=c===void 0?n(fy(o),a):c}return r.set(o,u),u};e.filter=i?(o,s)=>i(o,s)&&n(Ir(o)):o=>n(Ir(o))},Wr=zr(e=>{let t=new Qt(e),r=e.file,i;try{i=b.openSync(r,"r");let n=b.fstatSync(i),o=e.maxReadSize||16*1024*1024;if(n.size<o){let s=Buffer.allocUnsafe(n.size),a=b.readSync(i,s,0,n.size,0);t.end(a===s.byteLength?s:s.subarray(0,a))}else{let s=0,a=Buffer.allocUnsafe(o);for(;s<n.size;){let u=b.readSync(i,a,0,o,s);if(u===0)break;s+=u,t.write(a.subarray(0,u))}t.end()}}finally{if(typeof i=="number")try{b.closeSync(i)}catch{}}},(e,t)=>{let r=new Qt(e),i=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("end",o),b.stat(n,(a,u)=>{if(a)s(a);else{let c=new Li(n,{readSize:i,size:u.size});c.on("error",s),c.pipe(r)}})})},e=>new Qt(e),e=>new Qt(e),(e,t)=>{t?.length&&ea(e,t),e.noResume||Vy(e)}),Jl=(e,t,r)=>(e&=4095,r&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:qy,parse:kl}=my,ta=e=>{let t="",r=kl(e);for(;qy(e)||r.root;){let i=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":r.root;e=e.slice(i.length),t+=i,r=kl(e)}return[t,e]},ln=["|","<",">","?",":"],ra=ln.map(e=>String.fromCharCode(61440+e.charCodeAt(0))),Yy=new Map(ln.map((e,t)=>[e,ra[t]])),Zy=new Map(ra.map((e,t)=>[e,ln[t]])),Al=e=>ln.reduce((t,r)=>t.split(r).join(Yy.get(r)),e),Jy=e=>ra.reduce((t,r)=>t.split(r).join(Zy.get(r)),e),Xl=(e,t)=>t?(e=S(e).replace(/^\.(\/|$)/,""),Ir(t)+"/"+e):S(e),_l=Symbol("process"),Tl=Symbol("file"),Ol=Symbol("directory"),Po=Symbol("symlink"),Rl=Symbol("hardlink"),Rr=Symbol("header"),Xi=Symbol("read"),Io=Symbol("lstat"),Ki=Symbol("onlstat"),No=Symbol("onread"),jo=Symbol("onreadlink"),Bo=Symbol("openfile"),Lo=Symbol("onopenfile"),mt=Symbol("close"),an=Symbol("mode"),Mo=Symbol("awaitDrain"),Eo=Symbol("ondrain"),Ie=Symbol("prefix"),ia=class extends qe{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let r=Xo(t);super(),this.path=S(e),this.portable=!!r.portable,this.maxReadSize=r.maxReadSize||16777216,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=S(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime,this.prefix=r.prefix?S(r.prefix):void 0,this.onWriteEntry=r.onWriteEntry,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let i=!1;if(!this.preservePaths){let[o,s]=ta(this.path);o&&typeof s=="string"&&(this.path=s,i=o)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=Jy(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=S(r.absolute||on.resolve(this.cwd,e)),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path});let n=this.statCache.get(this.absolute);n?this[Ki](n):this[Io]()}warn(e,t,r={}){return cn(this,e,t,r)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Io](){ie.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Ki](t)})}[Ki](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Xy(e),this.emit("stat",e),this[_l]()}[_l](){switch(this.type){case"File":return this[Tl]();case"Directory":return this[Ol]();case"SymbolicLink":return this[Po]();default:return this.end()}}[an](e){return Jl(e,this.type==="Directory",this.portable)}[Ie](e){return Xl(e,this.prefix)}[Rr](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ft({path:this[Ie](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ie](this.linkpath):this.linkpath,mode:this[an](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Ur({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Ie](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ie](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw Error("failed to encode header");super.write(e)}[Ol](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Rr](),this.end()}[Po](){ie.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[jo](t)})}[jo](e){this.linkpath=S(e),this[Rr](),this.end()}[Rl](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=S(on.relative(this.cwd,e)),this.stat.size=0,this[Rr](),this.end()}[Tl](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[Rl](t);this.linkCache.set(e,this.absolute)}if(this[Rr](),this.stat.size===0)return this.end();this[Bo]()}[Bo](){ie.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Lo](t)})}[Lo](e){if(this.fd=e,this.#e)return this[mt]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Xi]()}[Xi](){let{fd:e,buf:t,offset:r,length:i,pos:n}=this;if(e===void 0||t===void 0)throw Error("cannot read file without first opening");ie.read(e,t,r,i,n,(o,s)=>{if(o)return this[mt](()=>this.emit("error",o));this[No](s)})}[mt](e=()=>{}){this.fd!==void 0&&ie.close(this.fd,e)}[No](e){if(e<=0&&this.remain>0){let r=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[mt](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[mt](()=>this.emit("error",r))}if(!this.buf)throw Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[Eo]():this[Mo](()=>this[Eo]())}[Mo](e){this.once("drain",e)}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let i=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",i)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,r)}[Eo](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[mt](e=>e?this.emit("error",e):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Xi]()}},Kl=class extends ia{sync=!0;[Io](){this[Ki](ie.lstatSync(this.absolute))}[Po](){this[jo](ie.readlinkSync(this.absolute))}[Bo](){this[Lo](ie.openSync(this.absolute,"r"))}[Xi](){let e=!0;try{let{fd:t,buf:r,offset:i,length:n,pos:o}=this;if(t===void 0||r===void 0)throw Error("fd and buf must be set in READ method");let s=ie.readSync(t,r,i,n,o);this[No](s),e=!1}finally{if(e)try{this[mt](()=>{})}catch{}}}[Mo](e){e()}[mt](e=()=>{}){this.fd!==void 0&&ie.closeSync(this.fd),e()}},Ql=class extends qe{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,r={}){return cn(this,e,t,r)}constructor(e,t={}){let r=Xo(t);super(),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.onWriteEntry=r.onWriteEntry,this.readEntry=e;let{type:i}=e;if(i==="Unsupported")throw Error("writing entry that should be ignored");this.type=i,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix,this.path=S(e.path),this.mode=e.mode===void 0?void 0:this[an](e.mode),this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:r.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath===void 0?void 0:S(e.linkpath),typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let n=!1;if(!this.preservePaths){let[s,a]=ta(this.path);s&&typeof a=="string"&&(this.path=a,n=s)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ft({path:this[Ie](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ie](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new Ur({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Ie](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Ie](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw Error("failed to encode header");super.write(o),e.pipe(this)}[Ie](e){return Xl(e,this.prefix)}[an](e){return Jl(e,this.type==="Directory",this.portable)}write(e,t,r){typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let i=e.length;if(i>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=i,super.write(e,r)}end(e,t,r){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),r&&this.once("finish",r),e?super.end(e,r):super.end(r),this}},Xy=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",Ky=class Xt{tail;head;length=0;static create(t=[]){return new Xt(t)}constructor(t=[]){for(let r of t)this.push(r)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let r=t.next,i=t.prev;return r&&(r.prev=i),i&&(i.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,r}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||=t,this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||=t,this.length++}push(...t){for(let r=0,i=t.length;r<i;r++)e0(this,t[r]);return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++)t0(this,t[r]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,r=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,r.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,r=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,r.list=void 0,this.length--,t}forEach(t,r){r||=this;for(let i=this.head,n=0;i;n++)t.call(r,i.value,n,this),i=i.next}forEachReverse(t,r){r||=this;for(let i=this.tail,n=this.length-1;i;n--)t.call(r,i.value,n,this),i=i.prev}get(t){let r=0,i=this.head;for(;i&&r<t;r++)i=i.next;if(r===t&&i)return i.value}getReverse(t){let r=0,i=this.tail;for(;i&&r<t;r++)i=i.prev;if(r===t&&i)return i.value}map(t,r){r||=this;let i=new Xt;for(let n=this.head;n;)i.push(t.call(r,n.value,this)),n=n.next;return i}mapReverse(t,r){r||=this;var i=new Xt;for(let n=this.tail;n;)i.push(t.call(r,n.value,this)),n=n.prev;return i}reduce(t,r){let i,n=this.head;if(arguments.length>1)i=r;else if(this.head)n=this.head.next,i=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var o=0;n;o++)i=t(i,n.value,o),n=n.next;return i}reduceReverse(t,r){let i,n=this.tail;if(arguments.length>1)i=r;else if(this.tail)n=this.tail.prev,i=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;n;o--)i=t(i,n.value,o),n=n.prev;return i}toArray(){let t=Array(this.length);for(let r=0,i=this.head;i;r++)t[r]=i.value,i=i.next;return t}toArrayReverse(){let t=Array(this.length);for(let r=0,i=this.tail;i;r++)t[r]=i.value,i=i.prev;return t}slice(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let i=new Xt;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);let n=this.head,o=0;for(o=0;n&&o<t;o++)n=n.next;for(;n&&o<r;o++,n=n.next)i.push(n.value);return i}sliceReverse(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let i=new Xt;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);let n=this.length,o=this.tail;for(;o&&n>r;n--)o=o.prev;for(;o&&n>t;n--,o=o.prev)i.push(o.value);return i}splice(t,r=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let n=this.head;for(let s=0;n&&s<t;s++)n=n.next;let o=[];for(let s=0;n&&s<r;s++)o.push(n.value),n=this.removeNode(n);n?n!==this.tail&&(n=n.prev):n=this.tail;for(let s of i)n=Qy(this,n,s);return o}reverse(){let t=this.head,r=this.tail;for(let i=t;i;i=i.prev){let n=i.prev;i.prev=i.next,i.next=n}return this.head=r,this.tail=t,this}};na=class{list;next;prev;value;constructor(e,t,r,i){this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,r?(r.prev=this,this.next=r):this.next=void 0}},Uo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},$l=Buffer.alloc(1024),Qi=Symbol("onStat"),$r=Symbol("ended"),ke=Symbol("queue"),Tt=Symbol("current"),Ot=Symbol("process"),Pr=Symbol("processing"),So=Symbol("processJob"),Ae=Symbol("jobs"),Fo=Symbol("jobDone"),en=Symbol("addFSEntry"),Pl=Symbol("addTarEntry"),zo=Symbol("stat"),Wo=Symbol("readdir"),tn=Symbol("onreaddir"),rn=Symbol("pipe"),Il=Symbol("entry"),xo=Symbol("entryOpt"),nn=Symbol("writeEntryClass"),eh=Symbol("write"),ko=Symbol("ondrain"),Hr=class extends qe{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[nn];onWriteEntry;[ke];[Ae]=0;[Pr]=!1;[$r]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=S(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[nn]=ia,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new pl(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new fl(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new yl(e.zstd)),!this.zip)throw Error("impossible");let t=this.zip;t.on("data",r=>super.write(r)),t.on("end",()=>super.end()),t.on("drain",()=>this[ko]()),this.on("resume",()=>t.resume())}else this.on("drain",this[ko]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[ke]=new Ky,this[Ae]=0,this.jobs=Number(e.jobs)||4,this[Pr]=!1,this[$r]=!1}[eh](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&this.add(e),this[$r]=!0,this[Ot](),r&&r(),this}write(e){if(this[$r])throw Error("write after end");return e instanceof Qo?this[Pl](e):this[en](e),this.flowing}[Pl](e){let t=S(on.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let r=new Uo(e.path,t);r.entry=new Ql(e,this[xo](r)),r.entry.on("end",()=>this[Fo](r)),this[Ae]+=1,this[ke].push(r)}this[Ot]()}[en](e){let t=S(on.resolve(this.cwd,e));this[ke].push(new Uo(e,t)),this[Ot]()}[zo](e){e.pending=!0,this[Ae]+=1,ie[this.follow?"stat":"lstat"](e.absolute,(t,r)=>{e.pending=!1,--this[Ae],t?this.emit("error",t):this[Qi](e,r)})}[Qi](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[Tt]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[So](e):e.ignore=!0,this[Ot]()}[Wo](e){e.pending=!0,this[Ae]+=1,ie.readdir(e.absolute,(t,r)=>{if(e.pending=!1,--this[Ae],t)return this.emit("error",t);this[tn](e,r)})}[tn](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Ot]()}[Ot](){if(!this[Pr]){this[Pr]=!0;for(let e=this[ke].head;e&&this[Ae]<this.jobs;e=e.next)if(this[So](e.value),e.value.ignore){let t=e.next;this[ke].removeNode(e),e.next=t}this[Pr]=!1,this[$r]&&!this[ke].length&&this[Ae]===0&&(this.zip?this.zip.end($l):(super.write($l),super.end()))}}get[Tt](){return this[ke]&&this[ke].head&&this[ke].head.value}[Fo](e){this[ke].shift(),--this[Ae],this[Ot]()}[So](e){if(!e.pending){if(e.entry){e===this[Tt]&&!e.piped&&this[rn](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[Qi](e,t):this[zo](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[tn](e,t):this[Wo](e),!e.readdir)return}if(e.entry=this[Il](e),!e.entry){e.ignore=!0;return}e===this[Tt]&&!e.piped&&this[rn](e)}}}[xo](e){return{onwarn:(t,r,i)=>this.warn(t,r,i),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Il](e){this[Ae]+=1;try{return new this[nn](e.path,this[xo](e)).on("end",()=>this[Fo](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[ko](){this[Tt]&&this[Tt].entry&&this[Tt].entry.resume()}[rn](e){e.piped=!0,e.readdir&&e.readdir.forEach(i=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[en](o+i)});let t=e.entry,r=this.zip;if(!t)throw Error("cannot pipe without source");r?t.on("data",i=>{r.write(i)||t.pause()}):t.on("data",i=>{super.write(i)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,r={}){cn(this,e,t,r)}},hn=class extends Hr{sync=!0;constructor(e){super(e),this[nn]=Kl}pause(){}resume(){}[zo](e){let t=this.follow?"statSync":"lstatSync";this[Qi](e,ie[t](e.absolute))}[Wo](e){this[tn](e,ie.readdirSync(e.absolute))}[rn](e){let t=e.entry,r=this.zip;if(e.readdir&&e.readdir.forEach(i=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[en](o+i)}),!t)throw Error("Cannot pipe without source");r?t.on("data",i=>{r.write(i)}):t.on("data",i=>{super[eh](i)})}},r0=(e,t)=>{let r=new hn(e),i=new oo(e.file,{mode:e.mode||438});r.pipe(i),th(r,t)},i0=(e,t)=>{let r=new Hr(e),i=new Ar(e.file,{mode:e.mode||438});r.pipe(i);let n=new Promise((o,s)=>{i.on("error",s),i.on("close",o),r.on("error",s)});return rh(r,t),n},th=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?Wr({file:H.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>e.add(i)}):e.add(r)}),e.end()},rh=async(e,t)=>{for(let r=0;r<t.length;r++){let i=String(t[r]);i.charAt(0)==="@"?await Wr({file:H.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:n=>{e.add(n)}}):e.add(i)}e.end()};zr(r0,i0,(e,t)=>{let r=new hn(e);return th(r,t),r},(e,t)=>{let r=new Hr(e);return rh(r,t),r},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")});n0=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:s0,O_TRUNC:o0,O_WRONLY:a0}=ie.constants,ih=Number(process.env.__FAKE_FS_O_FILENAME__)||ie.constants.UV_FS_O_FILEMAP||0,u0=n0&&!!ih,c0=ih|o0|s0|a0,nh=u0?e=>e<524288?c0:"w":()=>"w",sh=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},oh=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},l0=(e,t)=>{b.stat(e,(r,i)=>{(r||!i.isDirectory())&&(r=new sh(e,r?.code||"ENOTDIR")),t(r)})},h0=(e,t,r)=>{e=S(e);let i=t.umask??18,n=t.mode|448,o=(n&i)!==0,s=t.uid,a=t.gid,u=typeof s=="number"&&typeof a=="number"&&(s!==t.processUid||a!==t.processGid),c=t.preserve,l=t.unlink,h=S(t.cwd),p=(m,g)=>{m?r(m):g&&u?mo(g,s,a,y=>p(y)):o?b.chmod(e,n,r):r()};if(e===h)return l0(e,p);if(c)return hy.mkdir(e,{mode:n,recursive:!0}).then(m=>p(null,m??void 0),p);Ho(h,S(H.relative(h,e)).split("/"),n,l,h,void 0,p)},Ho=(e,t,r,i,n,o,s)=>{if(!t.length)return s(null,o);let a=t.shift(),u=S(H.resolve(e+"/"+a));b.mkdir(u,r,ah(u,t,r,i,n,o,s))},ah=(e,t,r,i,n,o,s)=>a=>{a?b.lstat(e,(u,c)=>{if(u)u.path=u.path&&S(u.path),s(u);else if(c.isDirectory())Ho(e,t,r,i,n,o,s);else if(i)b.unlink(e,l=>{if(l)return s(l);b.mkdir(e,r,ah(e,t,r,i,n,o,s))});else{if(c.isSymbolicLink())return s(new oh(e,e+"/"+t.join("/")));s(a)}}):(o||=e,Ho(e,t,r,i,n,o,s))},p0=e=>{let t=!1,r;try{t=b.statSync(e).isDirectory()}catch(i){r=i?.code}finally{if(!t)throw new sh(e,r??"ENOTDIR")}},m0=(e,t)=>{e=S(e);let r=t.umask??18,i=t.mode|448,n=(i&r)!==0,o=t.uid,s=t.gid,a=typeof o=="number"&&typeof s=="number"&&(o!==t.processUid||s!==t.processGid),u=t.preserve,c=t.unlink,l=S(t.cwd),h=g=>{g&&a&&fo(g,o,s),n&&b.chmodSync(e,i)};if(e===l)return p0(l),h();if(u)return h(b.mkdirSync(e,{mode:i,recursive:!0})??void 0);let p=S(H.relative(l,e)).split("/"),m;for(let g=p.shift(),y=l;g&&(y+="/"+g);g=p.shift()){y=S(H.resolve(y));try{b.mkdirSync(y,i),m||=y}catch{let v=b.lstatSync(y);if(v.isDirectory())continue;if(c){b.unlinkSync(y),b.mkdirSync(y,i),m||=y;continue}else if(v.isSymbolicLink())return new oh(y,y+"/"+p.join("/"))}}return h(m)},Ao=Object.create(null),Nl=1e4,Zt=new Set,d0=e=>{Zt.has(e)?Zt.delete(e):Ao[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Zt.add(e);let t=Ao[e],r=Zt.size-Nl;if(r>Nl/10){for(let i of Zt)if(Zt.delete(i),delete Ao[i],--r<=0)break}return t},f0=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",g0=e=>e.split("/").slice(0,-1).reduce((t,r)=>{let i=t[t.length-1];return i!==void 0&&(r=Gl(i,r)),t.push(r||"/"),t},[]),D0=class{#e=new Map;#i=new Map;#t=new Set;reserve(e,t){e=f0?["win32 parallelization disabled"]:e.map(i=>Ir(Gl(d0(i))));let r=new Set(e.map(i=>g0(i)).reduce((i,n)=>i.concat(n)));this.#i.set(t,{dirs:r,paths:e});for(let i of e){let n=this.#e.get(i);n?n.push(t):this.#e.set(i,[t])}for(let i of r){let n=this.#e.get(i);if(!n)this.#e.set(i,[new Set([t])]);else{let o=n[n.length-1];o instanceof Set?o.add(t):n.push(new Set([t]))}}return this.#s(t)}#o(e){let t=this.#i.get(e);if(!t)throw Error("function does not have any path reservations");return{paths:t.paths.map(r=>this.#e.get(r)),dirs:[...t.dirs].map(r=>this.#e.get(r))}}check(e){let{paths:t,dirs:r}=this.#o(e);return t.every(i=>i&&i[0]===e)&&r.every(i=>i&&i[0]instanceof Set&&i[0].has(e))}#s(e){return this.#t.has(e)||!this.check(e)?!1:(this.#t.add(e),e(()=>this.#r(e)),!0)}#r(e){if(!this.#t.has(e))return!1;let t=this.#i.get(e);if(!t)throw Error("invalid reservation");let{paths:r,dirs:i}=t,n=new Set;for(let o of r){let s=this.#e.get(o);if(!s||s?.[0]!==e)continue;let a=s[1];if(!a){this.#e.delete(o);continue}if(s.shift(),typeof a=="function")n.add(a);else for(let u of a)n.add(u)}for(let o of i){let s=this.#e.get(o),a=s?.[0];if(!(!s||!(a instanceof Set)))if(a.size===1&&s.length===1){this.#e.delete(o);continue}else if(a.size===1){s.shift();let u=s[0];typeof u=="function"&&n.add(u)}else a.delete(e)}return this.#t.delete(e),n.forEach(o=>this.#s(o)),!0}},jl=Symbol("onEntry"),Go=Symbol("checkFs"),Bl=Symbol("checkFs2"),Vo=Symbol("isReusable"),we=Symbol("makeFs"),qo=Symbol("file"),Yo=Symbol("directory"),sn=Symbol("link"),Ll=Symbol("symlink"),Ml=Symbol("hardlink"),Ul=Symbol("unsupported"),zl=Symbol("checkPath"),_o=Symbol("stripAbsolutePath"),dt=Symbol("mkdir"),re=Symbol("onError"),Zi=Symbol("pending"),Wl=Symbol("pend"),Jt=Symbol("unpend"),To=Symbol("ended"),Oo=Symbol("maybeClose"),Zo=Symbol("skip"),Nr=Symbol("doChown"),jr=Symbol("uid"),Br=Symbol("gid"),Lr=Symbol("checkedCwd"),Mr=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",y0=(e,t)=>{if(!Mr)return b.unlink(e,t);let r=e+".DELETE."+Vl(16).toString("hex");b.rename(e,r,i=>{if(i)return t(i);b.unlink(r,t)})},b0=e=>{if(!Mr)return b.unlinkSync(e);let t=e+".DELETE."+Vl(16).toString("hex");b.renameSync(e,t),b.unlinkSync(t)},Hl=(e,t,r)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:r,un=class extends Qt{[To]=!1;[Lr]=!1;[Zi]=0;reservations=new D0;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[To]=!0,this[Oo]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1024,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Mr,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=S(H.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[jl](t))}warn(e,t,r={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(r.recoverable=!1),super.warn(e,t,r)}[Oo](){this[To]&&this[Zi]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[_o](e,t){let r=e[t];if(!r||this.preservePaths)return!0;let i=r.split("/");if(i.includes("..")||Mr&&/^[a-z]:\.\.$/i.test(i[0]??"")){if(t==="path")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:r}),!1;{let s=H.posix.dirname(e.path),a=H.posix.normalize(H.posix.join(s,r));if(a.startsWith("../")||a==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:r}),!1}}let[n,o]=ta(r);return n&&(e[t]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:r})),!0}[zl](e){let t=S(e.path),r=t.split("/");if(this.strip){if(r.length<this.strip)return!1;if(e.type==="Link"){let i=S(String(e.linkpath)).split("/");if(i.length>=this.strip)e.linkpath=i.slice(this.strip).join("/");else return!1}r.splice(0,this.strip),e.path=r.join("/")}if(isFinite(this.maxDepth)&&r.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:r.length,maxDepth:this.maxDepth}),!1;if(!this[_o](e,"path")||!this[_o](e,"linkpath"))return!1;if(H.isAbsolute(e.path)?e.absolute=S(H.resolve(e.path)):e.absolute=S(H.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:S(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:i}=H.win32.parse(String(e.absolute));e.absolute=i+Al(String(e.absolute).slice(i.length));let{root:n}=H.win32.parse(e.path);e.path=n+Al(e.path.slice(n.length))}return!0}[jl](e){if(!this[zl](e))return e.resume();switch(Dy.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Go](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[Ul](e)}}[re](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Jt](),t.resume())}[dt](e,t,r){h0(S(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},r)}[Nr](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[jr](e){return Hl(this.uid,e.uid,this.processUid)}[Br](e){return Hl(this.gid,e.gid,this.processGid)}[qo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,i=new Ar(String(e.absolute),{flags:nh(e.size),mode:r,autoClose:!1});i.on("error",a=>{i.fd&&b.close(i.fd,()=>{}),i.write=()=>!0,this[re](a,e),t()});let n=1,o=a=>{if(a){i.fd&&b.close(i.fd,()=>{}),this[re](a,e),t();return}--n===0&&i.fd!==void 0&&b.close(i.fd,u=>{u?this[re](u,e):this[Jt](),t()})};i.on("finish",()=>{let a=String(e.absolute),u=i.fd;if(typeof u=="number"&&e.mtime&&!this.noMtime){n++;let c=e.atime||new Date,l=e.mtime;b.futimes(u,c,l,h=>h?b.utimes(a,c,l,p=>o(p&&h)):o())}if(typeof u=="number"&&this[Nr](e)){n++;let c=this[jr](e),l=this[Br](e);typeof c=="number"&&typeof l=="number"&&b.fchown(u,c,l,h=>h?b.chown(a,c,l,p=>o(p&&h)):o())}o()});let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>{this[re](a,e),t()}),e.pipe(s)),s.pipe(i)}[Yo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode;this[dt](String(e.absolute),r,i=>{if(i){this[re](i,e),t();return}let n=1,o=()=>{--n===0&&(t(),this[Jt](),e.resume())};e.mtime&&!this.noMtime&&(n++,b.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[Nr](e)&&(n++,b.chown(String(e.absolute),Number(this[jr](e)),Number(this[Br](e)),o)),o()})}[Ul](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Ll](e,t){this[sn](e,String(e.linkpath),"symlink",t)}[Ml](e,t){let r=S(H.resolve(this.cwd,String(e.linkpath)));this[sn](e,r,"link",t)}[Wl](){this[Zi]++}[Jt](){this[Zi]--,this[Oo]()}[Zo](e){this[Jt](),e.resume()}[Vo](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!Mr}[Go](e){this[Wl]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,r=>this[Bl](e,r))}[Bl](e,t){let r=s=>{t(s)},i=()=>{this[dt](this.cwd,this.dmode,s=>{if(s){this[re](s,e),r();return}this[Lr]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let s=S(H.dirname(String(e.absolute)));if(s!==this.cwd)return this[dt](s,this.dmode,a=>{if(a){this[re](a,e),r();return}o()})}o()},o=()=>{b.lstat(String(e.absolute),(s,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[Zo](e),r();return}if(s||this[Vo](e,a))return this[we](null,e,r);if(a.isDirectory()){if(e.type==="Directory"){let u=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,c=l=>this[we](l??null,e,r);return u?b.chmod(String(e.absolute),Number(e.mode),c):c()}if(e.absolute!==this.cwd)return b.rmdir(String(e.absolute),u=>this[we](u??null,e,r))}if(e.absolute===this.cwd)return this[we](null,e,r);y0(String(e.absolute),u=>this[we](u??null,e,r))})};this[Lr]?n():i()}[we](e,t,r){if(e){this[re](e,t),r();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[qo](t,r);case"Link":return this[Ml](t,r);case"SymbolicLink":return this[Ll](t,r);case"Directory":case"GNUDumpDir":return this[Yo](t,r)}}[sn](e,t,r,i){b[r](t,String(e.absolute),n=>{n?this[re](n,e):(this[Jt](),e.resume()),i()})}},Ji=e=>{try{return[null,e()]}catch(t){return[t,null]}},Jo=class extends un{sync=!0;[we](e,t){return super[we](e,t,()=>{})}[Go](e){if(!this[Lr]){let n=this[dt](this.cwd,this.dmode);if(n)return this[re](n,e);this[Lr]=!0}if(e.absolute!==this.cwd){let n=S(H.dirname(String(e.absolute)));if(n!==this.cwd){let o=this[dt](n,this.dmode);if(o)return this[re](o,e)}}let[t,r]=Ji(()=>b.lstatSync(String(e.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(e.mtime??r.mtime)))return this[Zo](e);if(t||this[Vo](e,r))return this[we](null,e);if(r.isDirectory()){if(e.type==="Directory"){let[o]=this.chmod&&e.mode&&(r.mode&4095)!==e.mode?Ji(()=>{b.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[we](o,e)}let[n]=Ji(()=>b.rmdirSync(String(e.absolute)));this[we](n,e)}let[i]=e.absolute===this.cwd?[]:Ji(()=>b0(String(e.absolute)));this[we](i,e)}[qo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,i=s=>{let a;try{b.closeSync(n)}catch(u){a=u}(s||a)&&this[re](s||a,e),t()},n;try{n=b.openSync(String(e.absolute),nh(e.size),r)}catch(s){return i(s)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",s=>this[re](s,e)),e.pipe(o)),o.on("data",s=>{try{b.writeSync(n,s,0,s.length)}catch(a){i(a)}}),o.on("end",()=>{let s=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,u=e.mtime;try{b.futimesSync(n,a,u)}catch(c){try{b.utimesSync(String(e.absolute),a,u)}catch{s=c}}}if(this[Nr](e)){let a=this[jr](e),u=this[Br](e);try{b.fchownSync(n,Number(a),Number(u))}catch(c){try{b.chownSync(String(e.absolute),Number(a),Number(u))}catch{s||=c}}}i(s)})}[Yo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode,i=this[dt](String(e.absolute),r);if(i){this[re](i,e),t();return}if(e.mtime&&!this.noMtime)try{b.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Nr](e))try{b.chownSync(String(e.absolute),Number(this[jr](e)),Number(this[Br](e)))}catch{}t(),e.resume()}[dt](e,t){try{return m0(S(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(r){return r}}[sn](e,t,r,i){let n=`${r}Sync`;try{b[n](t,String(e.absolute)),i(),e.resume()}catch(o){return this[re](o,e)}}},C0=zr(e=>{let t=new Jo(e),r=e.file,i=b.statSync(r);new ul(r,{readSize:e.maxReadSize||16*1024*1024,size:i.size}).pipe(t)},(e,t)=>{let r=new un(e),i=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("close",o),b.stat(n,(a,u)=>{if(a)s(a);else{let c=new Li(n,{readSize:i,size:u.size});c.on("error",s),c.pipe(r)}})})},e=>new Jo(e),e=>new un(e),(e,t)=>{t?.length&&ea(e,t)}),w0=(e,t)=>{let r=new hn(e),i=!0,n,o;try{try{n=b.openSync(e.file,"r+")}catch(u){if(u?.code==="ENOENT")n=b.openSync(e.file,"w+");else throw u}let s=b.fstatSync(n),a=Buffer.alloc(512);e:for(o=0;o<s.size;o+=512){for(let l=0,h=0;l<512;l+=h){if(h=b.readSync(n,a,l,a.length-l,o+l),o===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!h)break e}let u=new ft(a);if(!u.cksumValid)break;let c=512*Math.ceil((u.size||0)/512);if(o+c+512>s.size)break;o+=c,e.mtimeCache&&u.mtime&&e.mtimeCache.set(String(u.path),u.mtime)}i=!1,v0(e,r,o,n,t)}finally{if(i)try{b.closeSync(n)}catch{}}},v0=(e,t,r,i,n)=>{let o=new oo(e.file,{fd:i,start:r});t.pipe(o),S0(t,n)},E0=(e,t)=>{t=Array.from(t);let r=new Hr(e),i=(n,o,s)=>{let a=(p,m)=>{p?b.close(n,g=>s(p)):s(null,m)},u=0;if(o===0)return a(null,0);let c=0,l=Buffer.alloc(512),h=(p,m)=>{if(p||m===void 0)return a(p);if(c+=m,c<512&&m)return b.read(n,l,c,l.length-c,u+c,h);if(u===0&&l[0]===31&&l[1]===139)return a(Error("cannot append to compressed archives"));if(c<512)return a(null,u);let g=new ft(l);if(!g.cksumValid)return a(null,u);let y=512*Math.ceil((g.size??0)/512);if(u+y+512>o||(u+=y+512,u>=o))return a(null,u);e.mtimeCache&&g.mtime&&e.mtimeCache.set(String(g.path),g.mtime),c=0,b.read(n,l,0,512,u,h)};b.read(n,l,0,512,u,h)};return new Promise((n,o)=>{r.on("error",o);let s="r+",a=(u,c)=>{if(u&&u.code==="ENOENT"&&s==="r+")return s="w+",b.open(e.file,s,a);if(u||!c)return o(u);b.fstat(c,(l,h)=>{if(l)return b.close(c,()=>o(l));i(c,h.size,(p,m)=>{if(p)return o(p);let g=new Ar(e.file,{fd:c,start:m});r.pipe(g),g.on("error",o),g.on("close",n),F0(r,t)})})};b.open(e.file,s,a)})},S0=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?Wr({file:H.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>e.add(i)}):e.add(r)}),e.end()},F0=async(e,t)=>{for(let r=0;r<t.length;r++){let i=String(t[r]);i.charAt(0)==="@"?await Wr({file:H.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:n=>e.add(n)}):e.add(i)}e.end()},Kt=zr(w0,E0,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!Ey(e))throw TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!t?.length)throw TypeError("no paths specified to add/replace")});zr(Kt.syncFile,Kt.asyncFile,Kt.syncNoFile,Kt.asyncNoFile,(e,t=[])=>{Kt.validate?.(e,t),x0(e)});x0=e=>{let t=e.filter;e.mtimeCache||=new Map,e.filter=t?(r,i)=>t(r,i)&&!((e.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0)):(r,i)=>!((e.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0))},k0=_i({Header:()=>ft,Pack:()=>Hr,PackJob:()=>Uo,PackSync:()=>hn,Parser:()=>Qt,Pax:()=>Ur,ReadEntry:()=>Qo,Unpack:()=>un,UnpackSync:()=>Jo,WriteEntry:()=>ia,WriteEntrySync:()=>Kl,WriteEntryTar:()=>Ql,extract:()=>C0,filesFilter:()=>ea,list:()=>Wr,replace:()=>Kt})});import{mkdir as lh,readFile as A0,rm as _0,writeFile as T0}from"node:fs/promises";import{createWriteStream as O0,existsSync as Rt,readdirSync as R0,renameSync as $0}from"node:fs";import{pipeline as P0}from"node:stream";import{homedir as I0,tmpdir as N0}from"node:os";import{promisify as j0}from"node:util";async function B0(e,t,r={}){let i=t+".json",n=JSON.parse(await A0(i,"utf8").catch(()=>"{}")),o=(await Gr(e,{method:"HEAD",headers:r.headers}).catch(()=>{}))?.headers.get("etag");if(n.etag===o&&Rt(t))return;typeof o=="string"&&(n.etag=o);let s=await Gr(e,{headers:r.headers});if(s.status>=400)throw new Error(`Failed to download ${e}: ${s.status} ${s.statusText}`);let a=O0(t);await j0(P0)(s.body,a),await T0(i,JSON.stringify(n),"utf8")}function pn(e){let t=e.match(L0)?.groups||{};return{repo:t.repo||"",subdir:t.subdir||"/",ref:t.ref?t.ref.slice(1):"main"}}function er(...e){process.env.DEBUG&&console.debug("[giget]",...e)}async function Gr(e,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);let r=await fetch(e,{...t,headers:dh(t.headers)}).catch(i=>{throw new Error(`Failed to download ${e}: ${i}`,{cause:i})});if(t.validateStatus&&r.status>=400)throw new Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`);return r}function M0(){let e=process.env.XDG_CACHE_HOME?ce(process.env.XDG_CACHE_HOME,"giget"):ce(I0(),".cache/giget");if(process.platform==="win32"){let t=ce(N0(),"giget");if(!Rt(t)&&Rt(e))try{$0(e,t)}catch{}return t}return e}function dh(e={}){let t={};for(let[r,i]of Object.entries(e))i&&(t[r.toLowerCase()]=i);return t}async function sa(e,t={}){t.registry=process.env.GIGET_REGISTRY??t.registry,t.auth=process.env.GIGET_AUTH??t.auth;let r=t.registry===!1?void 0:fh(t.registry,{auth:t.auth}),i=t.provider||(r?"registry":"github"),n=e,o=e.match(V0);o&&(i=o[1],n=e.slice(o[0].length),(i==="http"||i==="https")&&(n=e));let s=t.providers?.[i]||H0[i]||r;if(!s)throw new Error(`Unsupported provider: ${i}`);let a=await Promise.resolve().then(()=>s(n,{auth:t.auth})).catch(m=>{throw new Error(`Failed to download template from ${i}: ${m.message}`)});if(!a)throw new Error(`Failed to resolve template from ${i}`);a.name=(a.name||"template").replace(/[^\da-z-]/gi,"-"),a.defaultDir=(a.defaultDir||a.name).replace(/[^\da-z-]/gi,"-");let u=ce(ce(M0(),i,a.name),(a.version||a.name)+".tar.gz");if(t.preferOffline&&Rt(u)&&(t.offline=!0),!t.offline){await lh(Ws(u),{recursive:!0});let m=Date.now();await B0(a.tar,u,{headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,...dh(a.headers)}}).catch(g=>{if(!Rt(u))throw g;er("Download error. Using cached version:",g),t.offline=!0}),er(`Downloaded ${a.tar} to ${u} in ${Date.now()-m}ms`)}if(!Rt(u))throw new Error(`Tarball not found: ${u} (offline: ${t.offline})`);let c=ce(ce(t.cwd||"."),t.dir||a.defaultDir);if(t.forceClean&&await _0(c,{recursive:!0,force:!0}),!t.force&&Rt(c)&&R0(c).length>0)throw new Error(`Destination ${c} already exists.`);await lh(c,{recursive:!0});let l=Date.now(),h=a.subdir?.replace(/^\//,"")||"",{extract:p}=await Promise.resolve().then(()=>(ch(),uh)).then(m=>m.t);if(await p({file:u,cwd:c,onReadEntry(m){m.path=m.path.split("/").splice(1).join("/"),h&&(m.path.startsWith(h+"/")?m.path=m.path.slice(h.length):m.path="")}}),er(`Extracted to ${c} in ${Date.now()-l}ms`),t.install){er("Installing dependencies...");let{installDependencies:m}=await Promise.resolve().then(()=>(Vs(),tl)).then(g=>g.t);await m({cwd:c,silent:t.silent,...typeof t.install=="object"?t.install:{}})}return{...a,source:n,dir:c}}var L0,hh,ph,mh,U0,z0,W0,H0,G0,fh,V0,gh=D(()=>{Vs();L0=/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;hh=async(e,t)=>{if(e.endsWith(".json"))return await ph(e,t);let r=new URL(e),i=Hs(r.pathname);try{let n=await Gr(r.href,{method:"HEAD",validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if((n.headers.get("content-type")||"").includes("application/json"))return await ph(e,t);let o=n.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];o&&(i=o.split(".")[0])}catch(n){er(`Failed to fetch HEAD for ${r.href}:`,n)}return{name:`${i}-${r.href.slice(0,8)}`,version:"",subdir:"",tar:r.href,defaultDir:i,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0}}},ph=async(e,t)=>{let r=await(await Gr(e,{validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}})).json();if(!r.tar||!r.name)throw new Error(`Invalid template info from ${e}. name or tar fields are missing!`);return r},mh=(e,t)=>{let r=pn(e),i=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${i.replace("api.github.com","github.com")}/${r.repo}/tree/${r.ref}${r.subdir}`,tar:`${i}/repos/${r.repo}/tarball/${r.ref}`}},U0=(e,t)=>{let r=pn(e),i=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${i}/${r.repo}/tree/${r.ref}${r.subdir}`,tar:`${i}/${r.repo}/-/archive/${r.ref}.tar.gz`}},z0=(e,t)=>{let r=pn(e);return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://bitbucket.com/${r.repo}/src/${r.ref}${r.subdir}`,tar:`https://bitbucket.org/${r.repo}/get/${r.ref}.tar.gz`}},W0=(e,t)=>{let r=pn(e);return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://git.sr.ht/~${r.repo}/tree/${r.ref}/item${r.subdir}`,tar:`https://git.sr.ht/~${r.repo}/archive/${r.ref}.tar.gz`}},H0={http:hh,https:hh,github:mh,gh:mh,gitlab:U0,bitbucket:z0,sourcehut:W0},G0="https://raw.githubusercontent.com/unjs/giget/main/templates",fh=(e=G0,t={})=>async r=>{let i=Date.now(),n=`${e}/${r}.json`,o=await Gr(n,{headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if(o.status>=400)throw new Error(`Failed to download ${r} template info from ${n}: ${o.status} ${o.statusText}`);let s=await o.json();if(!s.tar||!s.name)throw new Error(`Invalid template info from ${n}. name or tar fields are missing!`);return er(`Fetched ${r} template info from ${n} in ${Date.now()-i}ms`),s},V0=/^([\w-.]+):/});var Dh=D(()=>{gh()});var mn,yh,q0,Y0,oa,Je,aa=D(()=>{"use strict";mn=V(se(),1),yh=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],q0=mn.default.green("\u2714"),Y0=mn.default.red("\u2716"),oa=()=>{let e=null,t=0,r="",i=()=>{process.stdout.write("\r\x1B[K")},n=()=>{i(),process.stdout.write(`${mn.default.cyan(yh[t])} ${r}`),t=(t+1)%yh.length};return{start:o=>{r=o,t=0,e&&clearInterval(e),e=setInterval(n,80),n()},succeed:o=>{e&&(clearInterval(e),e=null),i(),console.log(`${q0} ${o||r}`)},fail:o=>{e&&(clearInterval(e),e=null),i(),console.log(`${Y0} ${o||r}`)},stop:()=>{e&&(clearInterval(e),e=null),i()}}},Je=e=>{let t=oa();return t.start(e),t}});var bh,Ch,dn,wh,vh,Z0,J0,ua,ca,Eh=D(()=>{"use strict";Dh();bh=V(se(),1);Dr();aa();Ch={saas:"gh:Moshaban09/nexo-templates/react/saas",landing:"gh:Moshaban09/nexo-templates/react/landing",dashboard:"gh:Moshaban09/nexo-templates/react/dashboard",portfolio:"gh:Moshaban09/nexo-templates/react/portfolio",ecommerce:"gh:Moshaban09/nexo-templates/react/ecommerce","blog-docs":"gh:Moshaban09/nexo-templates/react/blog-docs","components-ui":"gh:Moshaban09/nexo-templates/react/components-ui"},dn=e=>e instanceof Error?e.message.toLowerCase():String(e).toLowerCase(),wh=e=>{let t=dn(e);return t.includes("network")||t.includes("enotfound")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("unable to connect")||t.includes("unable to access")||t.includes("fetch failed")},vh=e=>{let t=dn(e);return t.includes("403")||t.includes("rate limit")},Z0=e=>{let r=dn(e).match(/retry[- ]?after[:\s]+(\d+)/i);if(r)return parseInt(r[1],10)},J0=e=>{let t=dn(e);return wh(e)||vh(e)||t.includes("500")||t.includes("502")||t.includes("503")||t.includes("504")},ua=async(e,t,r=Ci)=>{let i;for(let n=0;n<=r.maxRetries;n++){let s=n>0?`Retrying (${n}/${r.maxRetries})...`:`Cloning template from ${e}...`,a=Je(s);try{await sa(e,{dir:t,force:!0}),a.succeed("Template cloned successfully");return}catch(u){if(a.fail(),i=u,n<r.maxRetries&&J0(u)){let c=vc(n,r);console.log(bh.default.yellow(` \u23F3 Waiting ${c/1e3}s before retry...`)),await Ec(c);continue}break}}if(vh(i)){let n=Z0(i);throw new Ei(`GitHub rate limit exceeded while cloning "${e}"`,n,n?new Date(Date.now()+n*1e3):void 0)}throw wh(i)?new Si(`Unable to clone "${e}" - no network connection.
|
|
103
|
-
Try again when online, or use a local template with --template-dir.`):new vi(`Failed to clone template "${e}" after ${r.maxRetries+1} attempts: ${i?.message||"Unknown error"}`,`https://github.com/${e}`,void 0,r.maxRetries+1)},ca=e=>Ch[e.toLowerCase()]});import Vr from"node:path";var la,X0,Sh,Fh,K0,xh,Q0,eb,tb,rb,ib,nb,sb,ob,ab,kh=D(()=>{"use strict";rt();la=async(e,t)=>{let r=await tt(e);if(t.dependencies)for(let[i,n]of Object.entries(t.dependencies))br(r,i,n,!1);if(t.devDependencies)for(let[i,n]of Object.entries(t.devDependencies))br(r,i,n,!0);return await Ai(e,r),r},X0=async(e,t,r)=>t?la(e,r):null,Sh=async(e,t)=>{await Promise.all(t.map(async r=>{let i=Vr.join(e.projectPath,r.path);await k(Vr.dirname(i)),await E(i,r.content)}))},Fh=async(e,t)=>{let r=Object.entries(t).map(([i,n])=>({path:i,content:n}));await Sh(e,r)},K0=async(e,t,r)=>{let i=Vr.join(e.projectPath,t),{pathExists:n}=await Promise.resolve().then(()=>(rt(),Ic));return await n(i)?!1:(await k(Vr.dirname(i)),await E(i,r),!0)},xh=async(e,t)=>{await Promise.all(t.map(r=>k(Vr.join(e.projectPath,r))))},Q0=(e,t)=>{let r=e;for(let[i,n]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${i}\\}\\}`,"g"),n);return r},eb=e=>e.map(({from:t,imports:r,default:i})=>{let n=[];return i&&n.push(i),Array.isArray(r)&&r.length>0?n.push(`{ ${r.join(", ")} }`):typeof r=="string"&&r&&n.push(`{ ${r} }`),`import ${n.join(", ")} from '${t}'`}).join(`
|
|
104
|
-
`),tb=(e,t)=>e.selections[t]==="none",rb=e=>{let t=e.selections.variant.startsWith("ts");return{ts:t,ext:t?"tsx":"jsx",configExt:t?"ts":"js"}},ib=e=>async t=>{let r=t.selections[e.selectionKey];if(r==="none")return;let i=e.configs[r];if(i){if((i.dependencies||i.devDependencies)&&await la(t,{dependencies:i.dependencies,devDependencies:i.devDependencies}),i.directories&&await xh(t,i.directories),i.files){let n=i.files(t);await Fh(t,n)}i.setup&&await i.setup(t)}},nb=async(e,t)=>e?t():null,sb=(e,t,r)=>e?t:r,ob=(...e)=>e.filter(t=>t!==!1&&t!==null&&t!==void 0),ab=(...e)=>{let t={};for(let r of e)if(r&&Array.isArray(r)){let[i,n]=r;n!=null&&(t[i]=n)}return t}});var Ih={};O(Ih,{checkNetworkConnectivity:()=>$h,clearCache:()=>lb,fetchWithTimeout:()=>ma,getCached:()=>Th,getLatestVersion:()=>Rh,getPackageVersions:()=>Ph,isOffline:()=>pb,setCache:()=>Oh,setOfflineMode:()=>mb,startPrefetch:()=>fb,waitForPrefetch:()=>gb});var Ah,ub,_h,cb,ha,fn,Th,Oh,lb,tr,pa,hb,pb,mb,ma,Rh,$h,Ph,qr,db,fb,gb,Nh=D(()=>{"use strict";Ah=V(se(),1),ub=3e3,_h="https://registry.npmjs.org",cb=36e5,ha={react:"^19.0.0","react-dom":"^19.0.0","@vitejs/plugin-react":"^4.3.4",zustand:"^5.0.0","@reduxjs/toolkit":"^2.5.0",jotai:"^2.11.0","react-router-dom":"^7.13.0","@tanstack/react-router":"^1.157.0","@tanstack/react-query":"^5.64.0",axios:"^1.7.0","react-hook-form":"^7.54.0",zod:"^3.24.0",tailwindcss:"^4.0.0","lucide-react":"^0.553.0"},fn=new Map,Th=e=>{let t=fn.get(e);return t?Date.now()-t.timestamp>cb?(fn.delete(e),null):t.value:null},Oh=(e,t)=>{fn.set(e,{value:t,timestamp:Date.now()})},lb=()=>{fn.clear()},tr=!1,pa=0,hb=3e4,pb=()=>tr,mb=e=>{tr=e,e&&console.log(Ah.default.yellow("\u26A0 Offline mode enabled. Using built-in stable versions."))},ma=async(e,t={},r=ub)=>{let i=new AbortController,n=setTimeout(()=>i.abort(),r);try{let o=await fetch(e,{...t,signal:i.signal});return clearTimeout(n),o}catch(o){throw clearTimeout(n),o.name==="AbortError"?new Error(`Network timeout after ${r}ms`):o}},Rh=async e=>{let t=Th(`version:${e}`);if(t)return t;if(tr)return ha[e]||"latest";try{let r=await ma(`${_h}/${e}/latest`,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`HTTP ${r.status}`);let n=`^${(await r.json()).version}`;return Oh(`version:${e}`,n),n}catch{return ha[e]?ha[e]:"latest"}},$h=async()=>{let e=Date.now();if(e-pa<hb)return!tr;try{return await ma(`${_h}/react`,{},2e3),pa=e,tr=!1,!0}catch{return pa=e,tr=!0,!1}},Ph=async e=>{let t={};return await Promise.all(e.map(async r=>{t[r]=await Rh(r)})),t},qr=null,db=["react","react-dom","zustand","react-router-dom","@tanstack/react-query","react-hook-form","zod","tailwindcss","lucide-react"],fb=()=>{qr||(qr=(async()=>{try{if(!await $h())return;await Ph(db)}catch{}finally{qr=null}})())},gb=async()=>{qr&&await qr}});var da={};O(da,{PackageManager:()=>gn});import Db from"node:path";var gn,Dn=D(()=>{"use strict";rt();gn=class{projectPath;pkg=null;dependencies=new Map;devDependencies=new Map;scripts=new Map;constructor(t){this.projectPath=t}async load(t){this.pkg=await tt(t),this.pkg.dependencies&&Object.entries(this.pkg.dependencies).forEach(([r,i])=>this.dependencies.set(r,i)),this.pkg.devDependencies&&Object.entries(this.pkg.devDependencies).forEach(([r,i])=>this.devDependencies.set(r,i)),this.pkg.scripts&&Object.entries(this.pkg.scripts).forEach(([r,i])=>this.scripts.set(r,i))}add(t,r,i=!1){i?this.devDependencies.set(t,r):this.dependencies.set(t,r)}addScript(t,r){this.scripts.set(t,r)}set(t,r){this.pkg&&(this.pkg[t]=r)}async resolveLatestVersions(){if(process.env.NODE_ENV==="test")return;let t=[...this.dependencies.keys()],r=[...this.devDependencies.keys()],i=[...new Set([...t,...r])];if(i.length===0)return;let{getLatestVersion:n}=await Promise.resolve().then(()=>(Nh(),Ih)),o=await Promise.allSettled(i.map(async s=>{try{let a=await n(s);return{name:s,version:a}}catch{return{name:s,version:null}}}));for(let s of o)if(s.status==="fulfilled"&&s.value.version){let{name:a,version:u}=s.value;if(u==="latest"||/^\^?\d+\.\d+\.\d+/.test(u)){let c=u==="latest"||u.startsWith("^")?u:`^${u}`;this.dependencies.has(a)&&this.dependencies.set(a,c),this.devDependencies.has(a)&&this.devDependencies.set(a,c)}}}async save(){if(!this.pkg)throw new Error("Package.json not loaded. Call load() first.");let t=r=>Object.fromEntries([...r.entries()].sort((i,n)=>i[0].localeCompare(n[0])));this.pkg.dependencies=t(this.dependencies),this.pkg.devDependencies=t(this.devDependencies),this.pkg.scripts=t(this.scripts),await ze(Db.join(this.projectPath,"package.json"),this.pkg)}}});var Bh={};O(Bh,{detectAvailableManagers:()=>rr,detectPackageManagerUsed:()=>yn,getInstallCommand:()=>$t,getPrefetchCommand:()=>bn,getRunCommand:()=>jh});import{execSync as fa}from"node:child_process";var yn,bn,rr,$t,jh,Cn=D(()=>{"use strict";yn=()=>{let e=process.env.npm_config_user_agent;if(e){if(e.startsWith("pnpm"))return"pnpm";if(e.startsWith("yarn"))return"yarn";if(e.startsWith("bun"))return"bun"}return"npm"},bn=e=>{switch(e){case"npm":return{command:"npm",args:["cache","add"]};case"pnpm":return{command:"pnpm",args:["store","add"]};case"yarn":return{command:"yarn",args:["cache","add"]};case"bun":return null;default:return{command:"npm",args:["cache","add"]}}},rr=()=>{let e=["npm"];try{fa("pnpm --version",{stdio:"ignore"}),e.push("pnpm")}catch{}try{fa("yarn --version",{stdio:"ignore"}),e.push("yarn")}catch{}try{fa("bun --version",{stdio:"ignore"}),e.push("bun")}catch{}return e},$t=(e,t={})=>{let{audit:r=!1,strict:i=!1}=t;switch(e){case"npm":return`npm install ${r?"":"--no-audit"} ${i?"":"--legacy-peer-deps"}`.replace(/\s+/g," ").trim();case"pnpm":return"pnpm install";case"bun":return"bun install";case"yarn":return"yarn install";default:return"npm install"}},jh=(e,t)=>{switch(e){case"npm":return`npm run ${t}`;case"pnpm":return`pnpm run ${t}`;case"bun":return`bun run ${t}`;case"yarn":return`yarn ${t}`;default:return`npm run ${t}`}}});var Wh=j((G1,zh)=>{zh.exports=Uh;Uh.sync=bb;var Lh=ue("fs");function yb(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Mh(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:yb(t,r)}function Uh(e,t,r){Lh.stat(e,function(i,n){r(i,i?!1:Mh(n,e,t))})}function bb(e,t){return Mh(Lh.statSync(e),e,t)}});var Yh=j((V1,qh)=>{qh.exports=Gh;Gh.sync=Cb;var Hh=ue("fs");function Gh(e,t,r){Hh.stat(e,function(i,n){r(i,i?!1:Vh(n,t))})}function Cb(e,t){return Vh(Hh.statSync(e),t)}function Vh(e,t){return e.isFile()&&wb(e,t)}function wb(e,t){var r=e.mode,i=e.uid,n=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&n===s||r&a&&i===o||r&l&&o===0;return h}});var Jh=j((Y1,Zh)=>{var q1=ue("fs"),wn;process.platform==="win32"||global.TESTING_WINDOWS?wn=Wh():wn=Yh();Zh.exports=ga;ga.sync=vb;function ga(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){ga(e,t||{},function(o,s){o?n(o):i(s)})})}wn(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function vb(e,t){try{return wn.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var ip=j((Z1,rp)=>{var ir=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Xh=ue("path"),Eb=ir?";":":",Kh=Jh(),Qh=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),ep=(e,t)=>{let r=t.colon||Eb,i=e.match(/\//)||ir&&e.match(/\\/)?[""]:[...ir?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=ir?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=ir?n.split(r):[""];return ir&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},tp=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:o}=ep(e,t),s=[],a=c=>new Promise((l,h)=>{if(c===i.length)return t.all&&s.length?l(s):h(Qh(e));let p=i[c],m=/^".*"$/.test(p)?p.slice(1,-1):p,g=Xh.join(m,e),y=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;l(u(y,c,0))}),u=(c,l,h)=>new Promise((p,m)=>{if(h===n.length)return p(a(l+1));let g=n[h];Kh(c+g,{pathExt:o},(y,v)=>{if(!y&&v)if(t.all)s.push(c+g);else return p(c+g);return p(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},Sb=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=ep(e,t),o=[];for(let s=0;s<r.length;s++){let a=r[s],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=Xh.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let h=0;h<i.length;h++){let p=l+i[h];try{if(Kh.sync(p,{pathExt:n}))if(t.all)o.push(p);else return p}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw Qh(e)};rp.exports=tp;tp.sync=Sb});var sp=j((J1,Da)=>{"use strict";var np=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};Da.exports=np;Da.exports.default=np});var cp=j((X1,up)=>{"use strict";var op=ue("path"),Fb=ip(),xb=sp();function ap(e,t){let r=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Fb.sync(e.command,{path:r[xb({env:r})],pathExt:t?op.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return s&&(s=op.resolve(n?e.options.cwd:"",s)),s}function kb(e){return ap(e)||ap(e,!0)}up.exports=kb});var lp=j((K1,ba)=>{"use strict";var ya=/([()\][%!^"`<>&|;, *?])/g;function Ab(e){return e=e.replace(ya,"^$1"),e}function _b(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(ya,"^$1"),t&&(e=e.replace(ya,"^$1")),e}ba.exports.command=Ab;ba.exports.argument=_b});var pp=j((Q1,hp)=>{"use strict";hp.exports=/^#!(.*)/});var dp=j((e2,mp)=>{"use strict";var Tb=pp();mp.exports=(e="")=>{let t=e.match(Tb);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var gp=j((t2,fp)=>{"use strict";var Ca=ue("fs"),Ob=dp();function Rb(e){let r=Buffer.alloc(150),i;try{i=Ca.openSync(e,"r"),Ca.readSync(i,r,0,150,0),Ca.closeSync(i)}catch{}return Ob(r.toString())}fp.exports=Rb});var Cp=j((r2,bp)=>{"use strict";var $b=ue("path"),Dp=cp(),yp=lp(),Pb=gp(),Ib=process.platform==="win32",Nb=/\.(?:com|exe)$/i,jb=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Bb(e){e.file=Dp(e);let t=e.file&&Pb(e.file);return t?(e.args.unshift(e.file),e.command=t,Dp(e)):e.file}function Lb(e){if(!Ib)return e;let t=Bb(e),r=!Nb.test(t);if(e.options.forceShell||r){let i=jb.test(t);e.command=$b.normalize(e.command),e.command=yp.command(e.command),e.args=e.args.map(o=>yp.argument(o,i));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Mb(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:Lb(i)}bp.exports=Mb});var Ep=j((i2,vp)=>{"use strict";var wa=process.platform==="win32";function va(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Ub(e,t){if(!wa)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let o=wp(n,t);if(o)return r.call(e,"error",o)}return r.apply(e,arguments)}}function wp(e,t){return wa&&e===1&&!t.file?va(t.original,"spawn"):null}function zb(e,t){return wa&&e===1&&!t.file?va(t.original,"spawnSync"):null}vp.exports={hookChildProcess:Ub,verifyENOENT:wp,verifyENOENTSync:zb,notFoundError:va}});var xp=j((n2,nr)=>{"use strict";var Sp=ue("child_process"),Ea=Cp(),Sa=Ep();function Fp(e,t,r){let i=Ea(e,t,r),n=Sp.spawn(i.command,i.args,i.options);return Sa.hookChildProcess(n,i),n}function Wb(e,t,r){let i=Ea(e,t,r),n=Sp.spawnSync(i.command,i.args,i.options);return n.error=n.error||Sa.verifyENOENTSync(n.status,i),n}nr.exports=Fp;nr.exports.spawn=Fp;nr.exports.sync=Wb;nr.exports._parse=Ea;nr.exports._enoent=Sa});function Fa(e){let t=typeof e=="string"?`
|
|
105
|
-
`:10,r=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}var kp=D(()=>{});function vn(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"}var Ap=D(()=>{});import En from"node:process";import Yr from"node:path";import{fileURLToPath as _p}from"node:url";var Hb,Gb,Vb,Tp,Op=D(()=>{Ap();Hb=({cwd:e=En.cwd(),path:t=En.env[vn()],preferLocal:r=!0,execPath:i=En.execPath,addExecPath:n=!0}={})=>{let o=e instanceof URL?_p(e):e,s=Yr.resolve(o),a=[];return r&&Gb(a,s),n&&Vb(a,i,s),[...a,t].join(Yr.delimiter)},Gb=(e,t)=>{let r;for(;r!==t;)e.push(Yr.join(t,"node_modules/.bin")),r=t,t=Yr.resolve(t,"..")},Vb=(e,t,r)=>{let i=t instanceof URL?_p(t):t;e.push(Yr.resolve(r,i,".."))},Tp=({env:e=En.env,...t}={})=>{e={...e};let r=vn({env:e});return t.path=e[r],e[r]=Hb(t),e}});function xa(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:i}=e;for(let n of Reflect.ownKeys(t))qb(e,t,n,r);return Zb(e,t),Qb(e,t,i),e}var qb,Yb,Zb,Jb,Xb,Kb,Qb,Rp=D(()=>{qb=(e,t,r,i)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let n=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);!Yb(n,o)&&i||Object.defineProperty(e,r,o)},Yb=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Zb=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},Jb=(e,t)=>`/* Wrapped ${e}*/
|
|
106
|
-
|
|
107
|
-
${i.message}`:v,$=[C,t,e].filter(Boolean).join(`
|
|
108
|
-
`);return w?(i.originalMessage=i.message,i.message=$):i=new Error($),i.shortMessage=C,i.command=s,i.escapedCommand=a,i.exitCode=o,i.signal=n,i.signalDescription=m,i.stdout=e,i.stderr=t,i.cwd=p,r!==void 0&&(i.all=r),"bufferedData"in i&&delete i.bufferedData,i.failed=!0,i.timedOut=!!u,i.isCanceled=c,i.killed=l&&!u,i}});var Fn,hC,Aa,Vp,qp=D(()=>{Fn=["stdin","stdout","stderr"],hC=e=>Fn.some(t=>e[t]!==void 0),Aa=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return Fn.map(i=>e[i]);if(hC(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Fn.map(i=>`\`${i}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Fn.length);return Array.from({length:r},(i,n)=>t[n])},Vp=e=>{let t=Aa(e);return t==="ipc"?"ipc":t===void 0||typeof t=="string"?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}});var Pt,Yp=D(()=>{Pt=[];Pt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Pt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Pt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var xn,_a,Ta,pC,Oa,kn,mC,Ra,$a,Pa,Zp,O2,R2,Jp=D(()=>{Yp();xn=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",_a=Symbol.for("signal-exit emitter"),Ta=globalThis,pC=Object.defineProperty.bind(Object),Oa=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Ta[_a])return Ta[_a];pC(Ta,_a,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let i=this.listeners[t],n=i.indexOf(r);n!==-1&&(n===0&&i.length===1?i.length=0:i.splice(n,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let o of this.listeners[t])n=o(r,i)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,i)||n),n}},kn=class{},mC=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Ra=class extends kn{onExit(){return()=>{}}load(){}unload(){}},$a=class extends kn{#e=Pa.platform==="win32"?"SIGINT":"SIGHUP";#i=new Oa;#t;#o;#s;#r={};#n=!1;constructor(t){super(),this.#t=t,this.#r={};for(let r of Pt)this.#r[r]=()=>{let i=this.#t.listeners(r),{count:n}=this.#i,o=t;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(n+=o.__signal_exit_emitter__.count),i.length===n){this.unload();let s=this.#i.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||t.kill(t.pid,a)}};this.#s=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!xn(this.#t))return()=>{};this.#n===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#i.on(i,t),()=>{this.#i.removeListener(i,t),this.#i.listeners.exit.length===0&&this.#i.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#n){this.#n=!0,this.#i.count+=1;for(let t of Pt)try{let r=this.#r[t];r&&this.#t.on(t,r)}catch{}this.#t.emit=(t,...r)=>this.#u(t,...r),this.#t.reallyExit=t=>this.#a(t)}}unload(){this.#n&&(this.#n=!1,Pt.forEach(t=>{let r=this.#r[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,r)}catch{}}),this.#t.emit=this.#o,this.#t.reallyExit=this.#s,this.#i.count-=1)}#a(t){return xn(this.#t)?(this.#t.exitCode=t||0,this.#i.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#u(t,...r){let i=this.#o;if(t==="exit"&&xn(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let n=i.call(this.#t,t,...r);return this.#i.emit("exit",this.#t.exitCode,null),n}else return i.call(this.#t,t,...r)}},Pa=globalThis.process,{onExit:Zp,load:O2,unload:R2}=mC(xn(Pa)?new $a(Pa):new Ra)});import dC from"node:os";var fC,Xp,gC,DC,yC,bC,Kp,CC,Qp,em,tm,rm=D(()=>{Jp();fC=1e3*5,Xp=(e,t="SIGTERM",r={})=>{let i=e(t);return gC(e,t,r,i),i},gC=(e,t,r,i)=>{if(!DC(t,r,i))return;let n=bC(r),o=setTimeout(()=>{e("SIGKILL")},n);o.unref&&o.unref()},DC=(e,{forceKillAfterTimeout:t},r)=>yC(e)&&t!==!1&&r,yC=e=>e===dC.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",bC=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return fC;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},Kp=(e,t)=>{e.kill()&&(t.isCanceled=!0)},CC=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},Qp=(e,{timeout:t,killSignal:r="SIGTERM"},i)=>{if(t===0||t===void 0)return i;let n,o=new Promise((a,u)=>{n=setTimeout(()=>{CC(e,r,u)},t)}),s=i.finally(()=>{clearTimeout(n)});return Promise.race([o,s])},em=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},tm=async(e,{cleanup:t,detached:r},i)=>{if(!t||r)return i;let n=Zp(()=>{e.kill()});return i.finally(()=>{n()})}});function An(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function Ia(e){return An(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}var Na=D(()=>{});import{createWriteStream as wC}from"node:fs";import{ChildProcess as vC}from"node:child_process";var EC,ja,im,nm=D(()=>{Na();EC=e=>e instanceof vC&&typeof e.then=="function",ja=(e,t,r)=>{if(typeof r=="string")return e[t].pipe(wC(r)),e;if(Ia(r))return e[t].pipe(r),e;if(!EC(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Ia(r.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(r.stdin),r},im=e=>{e.stdout!==null&&(e.pipeStdout=ja.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=ja.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=ja.bind(void 0,e,"all"))}});var Jr,SC,am,sm,FC,xC,om,_n,Xr=D(()=>{Jr=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:u=Number.POSITIVE_INFINITY}={})=>{if(!FC(e))throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");let c=t();c.length=0;try{for await(let l of e){let h=xC(l),p=r[h](l,c);am({convertedChunk:p,state:c,getSize:i,truncateChunk:n,addChunk:o,maxBuffer:u})}return SC({state:c,convertChunk:r,getSize:i,truncateChunk:n,addChunk:o,getFinalChunk:s,maxBuffer:u}),a(c)}catch(l){throw l.bufferedData=a(c),l}},SC=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:o})=>{let s=n(e);s!==void 0&&am({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:o})},am=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:o})=>{let s=r(e),a=t.length+s;if(a<=o){sm(e,t,n,a);return}let u=i(e,o-t.length);throw u!==void 0&&sm(u,t,n,o),new _n},sm=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},FC=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",xC=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=om.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&om.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:om}=Object.prototype,_n=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Ba,La,Ma,Tn,On,Rn=D(()=>{Ba=e=>e,La=()=>{},Ma=({contents:e})=>e,Tn=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},On=e=>e.length});var um=D(()=>{Xr();Rn()});async function Ua(e,t){return Jr(e,IC,t)}var kC,AC,_C,cm,lm,TC,OC,RC,$C,pm,hm,PC,mm,IC,za=D(()=>{Xr();Rn();kC=()=>({contents:new ArrayBuffer(0)}),AC=e=>_C.encode(e),_C=new TextEncoder,cm=e=>new Uint8Array(e),lm=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),TC=(e,t)=>e.slice(0,t),OC=(e,{contents:t,length:r},i)=>{let n=mm()?$C(t,i):RC(t,i);return new Uint8Array(n).set(e,r),n},RC=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(pm(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},$C=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:pm(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},pm=e=>hm**Math.ceil(Math.log(e)/Math.log(hm)),hm=2,PC=({contents:e,length:t})=>mm()?e:e.slice(0,t),mm=()=>"resize"in ArrayBuffer.prototype,IC={init:kC,convertChunk:{string:AC,buffer:cm,arrayBuffer:cm,dataView:lm,typedArray:lm,others:Tn},getSize:On,truncateChunk:TC,addChunk:OC,getFinalChunk:La,finalize:PC}});async function $n(e,t){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return dm(await Ua(e,t))}catch(r){throw r.bufferedData!==void 0&&(r.bufferedData=dm(r.bufferedData)),r}}var dm,fm=D(()=>{za();dm=e=>globalThis.Buffer.from(e)});async function Wa(e,t){return Jr(e,MC,t)}var NC,Pn,jC,BC,LC,MC,gm=D(()=>{Xr();Rn();NC=()=>({contents:"",textDecoder:new TextDecoder}),Pn=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),jC=(e,{contents:t})=>t+e,BC=(e,t)=>e.slice(0,t),LC=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},MC={init:NC,convertChunk:{string:Ba,buffer:Pn,arrayBuffer:Pn,dataView:Pn,typedArray:Pn,others:Tn},getSize:On,truncateChunk:BC,addChunk:jC,getFinalChunk:LC,finalize:Ma}});var Dm=D(()=>{um();za();fm();gm();Xr()});var bm=j((uF,ym)=>{"use strict";var{PassThrough:UC}=ue("stream");ym.exports=function(){var e=[],t=new UC({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=i,t.on("unpipe",n),Array.prototype.slice.call(arguments).forEach(r),t;function r(o){return Array.isArray(o)?(o.forEach(r),this):(e.push(o),o.once("end",n.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function i(){return e.length==0}function n(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});import{createReadStream as zC,readFileSync as WC}from"node:fs";import{setTimeout as HC}from"node:timers/promises";var Cm,wm,GC,vm,VC,Em,Sm,Ha,Ga,qC,Fm,xm=D(()=>{Na();Dm();Cm=V(bm(),1),wm=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},GC=({input:e,inputFile:t})=>typeof t!="string"?e:(wm(e),WC(t)),vm=e=>{let t=GC(e);if(An(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},VC=({input:e,inputFile:t})=>typeof t!="string"?e:(wm(e),zC(t)),Em=(e,t)=>{let r=VC(t);r!==void 0&&(An(r)?r.pipe(e.stdin):e.stdin.end(r))},Sm=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let r=(0,Cm.default)();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},Ha=async(e,t)=>{if(!(!e||t===void 0)){await HC(0),e.destroy();try{return await t}catch(r){return r.bufferedData}}},Ga=(e,{encoding:t,buffer:r,maxBuffer:i})=>{if(!(!e||!r))return t==="utf8"||t==="utf-8"?Wa(e,{maxBuffer:i}):t===null||t==="buffer"?$n(e,{maxBuffer:i}):qC(e,i,t)},qC=async(e,t,r)=>(await $n(e,{maxBuffer:t})).toString(r),Fm=async({stdout:e,stderr:t,all:r},{encoding:i,buffer:n,maxBuffer:o},s)=>{let a=Ga(e,{encoding:i,buffer:n,maxBuffer:o}),u=Ga(t,{encoding:i,buffer:n,maxBuffer:o}),c=Ga(r,{encoding:i,buffer:n,maxBuffer:o*2});try{return await Promise.all([s,a,u,c])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},Ha(e,a),Ha(t,u),Ha(r,c)])}}});var YC,ZC,Va,km,Am=D(()=>{YC=(async()=>{})().constructor.prototype,ZC=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(YC,e)]),Va=(e,t)=>{for(let[r,i]of ZC){let n=typeof t=="function"?(...o)=>Reflect.apply(i.value,t(),o):i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},km=e=>new Promise((t,r)=>{e.on("exit",(i,n)=>{t({exitCode:i,signal:n})}),e.on("error",i=>{r(i)}),e.stdin&&e.stdin.on("error",i=>{r(i)})})});import{Buffer as JC}from"node:buffer";import{ChildProcess as XC}from"node:child_process";var Om,KC,QC,qa,Ya,Rm,Za,_m,Tm,ew,Ja,$m=D(()=>{Om=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],KC=/^[\w.-]+$/,QC=e=>typeof e!="string"||KC.test(e)?e:`"${e.replaceAll('"','\\"')}"`,qa=(e,t)=>Om(e,t).join(" "),Ya=(e,t)=>Om(e,t).map(r=>QC(r)).join(" "),Rm=/ +/g,Za=e=>{let t=[];for(let r of e.trim().split(Rm)){let i=t.at(-1);i&&i.endsWith("\\")?t[t.length-1]=`${i.slice(0,-1)} ${r}`:t.push(r)}return t},_m=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof XC)&&"stdout"in e){let r=typeof e.stdout;if(r==="string")return e.stdout;if(JC.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},Tm=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],ew=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{let o=n??e.raw[i],s=o.split(Rm).filter(Boolean),a=Tm(r,s,o.startsWith(" "));if(i===t.length)return a;let u=t[i],c=Array.isArray(u)?u.map(l=>_m(l)):[_m(u)];return Tm(a,c,o.endsWith(" "))},Ja=(e,t)=>{let r=[];for(let[i,n]of e.entries())r=ew({templates:e,expressions:t,tokens:r,index:i,template:n});return r}});import{debuglog as tw}from"node:util";import rw from"node:process";var Pm,In,iw,Xa,Im=D(()=>{Pm=tw("execa").enabled,In=(e,t)=>String(e).padStart(t,"0"),iw=()=>{let e=new Date;return`${In(e.getHours(),2)}:${In(e.getMinutes(),2)}:${In(e.getSeconds(),2)}.${In(e.getMilliseconds(),3)}`},Xa=(e,{verbose:t})=>{t&&rw.stderr.write(`[${iw()}] ${e}
|
|
109
|
-
|
|
80
|
+
${f.default.gray(Lg+bc.repeat(n+2)+Mg)}
|
|
81
|
+
`)},xe=(e="")=>{process.stdout.write(`${f.default.gray(rt)} ${f.default.red(e)}
|
|
82
|
+
|
|
83
|
+
`)},Ei=(e="")=>{process.stdout.write(`${f.default.gray(Ig)} ${e}
|
|
84
|
+
`)},gr=(e="")=>{process.stdout.write(`${f.default.gray(F)}
|
|
85
|
+
${f.default.gray(rt)} ${e}
|
|
86
|
+
|
|
87
|
+
`)},tt={message:(e="",{symbol:t=f.default.gray(F)}={})=>{let r=[`${f.default.gray(F)}`];if(e){let[i,...n]=e.split(`
|
|
88
|
+
`);r.push(`${t} ${i}`,...n.map(o=>`${f.default.gray(F)} ${o}`))}process.stdout.write(`${r.join(`
|
|
89
|
+
`)}
|
|
90
|
+
`)},info:e=>{tt.message(e,{symbol:f.default.blue(Ug)})},success:e=>{tt.message(e,{symbol:f.default.green(zg)})},step:e=>{tt.message(e,{symbol:f.default.green(bi)})},warn:e=>{tt.message(e,{symbol:f.default.yellow(Hg)})},warning:e=>{tt.warn(e)},error:e=>{tt.message(e,{symbol:f.default.red(Wg)})}},wc=()=>{let e=Os?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=Os?80:120,r,i,n=!1,o="",s=(l="")=>{n=!0,r=Dc(),o=l.replace(/\.+$/,""),process.stdout.write(`${f.default.gray(F)}
|
|
91
|
+
`);let p=0,h=0;i=setInterval(()=>{let d=f.default.magenta(e[p]),g=".".repeat(Math.floor(h)).slice(0,3);process.stdout.write(Ut.cursor.move(-999,0)),process.stdout.write(Ut.erase.down(1)),process.stdout.write(`${d} ${o}${g}`),p=p+1<e.length?p+1:0,h=h<e.length?h+.125:0},t)},a=(l="",p=0)=>{o=l??o,n=!1,clearInterval(i);let h=p===0?f.default.green(bi):p===1?f.default.red(Cc):f.default.red(Ec);process.stdout.write(Ut.cursor.move(-999,0)),process.stdout.write(Ut.erase.down(1)),process.stdout.write(`${h} ${o}
|
|
92
|
+
`),r()},u=(l="")=>{o=l??o},c=l=>{let p=l>1?"Something went wrong":"Canceled";n&&a(p,l)};return process.on("uncaughtExceptionMonitor",()=>c(2)),process.on("unhandledRejection",()=>c(2)),process.on("SIGINT",()=>c(1)),process.on("SIGTERM",()=>c(1)),process.on("exit",c),{start:s,stop:a,message:u}}});import{createRequire as Vg}from"node:module";var wt,qg,Yg,vi,Is=D(()=>{"use strict";wt=V(ae(),1),qg=Vg(import.meta.url),Yg=qg("../../package.json"),vi=`
|
|
93
|
+
${wt.default.cyan(" _ _ _____ __ __ ___ ")}
|
|
94
|
+
${wt.default.cyan(" | \\ | || ____|\\ \\/ / / _ \\ ")}
|
|
95
|
+
${wt.default.cyan(" | \\| || _| \\ / | | | |")}
|
|
96
|
+
${wt.default.cyan(" | |\\ || |___ / \\ | |_| |")}
|
|
97
|
+
${wt.default.cyan(" |_| \\_||_____|/_/\\_\\ \\___/ ")}
|
|
98
|
+
${wt.default.dim(" v"+Yg.version)}
|
|
99
|
+
`});var yr,Ns=D(()=>{"use strict";yr={minimal:{framework:"react",variant:"ts",language:"typescript",styling:"css-modules",ui:"none",forms:"none",state:"none",routing:"none",dataFetching:"none",icons:"none",structure:"simple",optionalFeatures:[]},saas:{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"zustand",routing:"react-router",dataFetching:"tanstack-query",icons:"lucide",structure:"feature-based"},dashboard:{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"zustand",routing:"react-router",dataFetching:"tanstack-query",icons:"lucide",structure:"feature-based",aiInstructions:["universal"]},landing:{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"shadcn",forms:"none",state:"none",routing:"none",dataFetching:"none",icons:"lucide",structure:"simple",optionalFeatures:["animation","aiInstructions"],animation:"framer-motion",aiInstructions:["universal"]},portfolio:{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"none",forms:"rhf-zod",state:"none",routing:"none",dataFetching:"none",icons:"lucide",structure:"feature-based",optionalFeatures:["animation"],animation:"framer-motion"},ecommerce:{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"zustand",routing:"react-router",dataFetching:"tanstack-query",icons:"lucide",structure:"feature-based"},"blog-docs":{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"none",forms:"none",state:"none",routing:"react-router",dataFetching:"none",icons:"lucide",structure:"feature-based"},"components-ui":{framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"none",routing:"react-router",dataFetching:"none",icons:"lucide",structure:"feature-based"}}});var vc,Sc,Fc,xc,kc,Ac,_c,Tc,Oc,Rc,$e,it,br,$c,Si,Cr=D(()=>{"use strict";vc={SHADCN:"shadcn",RADIX:"radix",HEROUI:"heroui",ANTD:"antd",CHAKRA:"chakra",NONE:"none"},Sc={TAILWIND:"tailwind",CSS_MODULES:"css-modules"},Fc={REACT:"react"},xc={TS:"ts",TS_COMPILER:"ts-compiler",TS_SWC:"ts-swc",JS:"js",JS_COMPILER:"js-compiler",JS_SWC:"js-swc"},kc={ZUSTAND:"zustand",REDUX:"redux",JOTAI:"jotai",NONE:"none"},Ac={RHF_ZOD:"rhf-zod",RHF_YUP:"rhf-yup",TANSTACK_FORM:"tanstack-form",NONE:"none"},_c={REACT_ROUTER:"react-router",TANSTACK_ROUTER:"tanstack-router",NONE:"none"},Tc={TANSTACK_QUERY:"tanstack-query",AXIOS:"axios",FETCH:"fetch",NONE:"none"},Oc={LUCIDE:"lucide",HEROICONS:"heroicons",NONE:"none"},Rc={FEATURE_BASED:"feature-based",SIMPLE:"simple"},$e=260,it=255,br=100*1024*1024,$c="my-nexo-app",Si={maxRetries:3,initialDelayMs:1e3,backoffMultiplier:2,maxDelayMs:1e4}});var Ee,Fi=D(()=>{"use strict";Ee=class extends Error{constructor(r,i,n){super(r);this.code=i;this.context=n;this.name="NexoError",Error.captureStackTrace?.(this,this.constructor)}}});var Pc=D(()=>{"use strict"});var xi,ki,Ai,Ic,Nc,jc=D(()=>{"use strict";Cr();Fi();xi=class extends Ee{constructor(r,i,n,o){super(r,"NETWORK_ERROR",{url:i,statusCode:n,retryCount:o});this.url=i;this.statusCode=n;this.retryCount=o;this.name="NetworkError"}},ki=class extends Ee{constructor(r,i,n){super(r,"RATE_LIMIT_ERROR",{retryAfter:i,resetTime:n?.toISOString()});this.retryAfter=i;this.resetTime=n;this.name="RateLimitError"}},Ai=class extends Ee{constructor(t="No network connection available"){super(t,"OFFLINE_ERROR",{}),this.name="OfflineError"}},Ic=(e,t=Si)=>{let r=t.initialDelayMs*Math.pow(t.backoffMultiplier,e);return Math.min(r,t.maxDelayMs)},Nc=e=>new Promise(t=>setTimeout(t,e))});var L,_i,nt,Ti,Bc,Lc,Er=D(()=>{"use strict";L=V(ae(),1);Fi();Fi();Pc();jc();_i=class extends Ee{constructor(t,r){super(t,"VALIDATION_ERROR",r),this.name="ValidationError"}},nt=class extends Ee{constructor(t,r,i){super(t,"FS_ERROR",{path:r,originalError:i?.message}),this.name="FileSystemError"}},Ti=class extends Ee{constructor(t,r){super(t,"COMPATIBILITY_ERROR",{selections:r}),this.name="CompatibilityError"}},Bc={ENOENT:{title:"File not found",description:"The specified file or directory does not exist.",suggestions:["Check if the path is correct","Ensure you have the necessary permissions"]},EACCES:{title:"Permission denied",description:"You do not have permission to access this file.",suggestions:["Try running with administrator/sudo privileges","Check file permissions"]},EEXIST:{title:"Directory already exists",description:e=>`A directory named "${e.projectName||"unknown"}" already exists.`,suggestions:["Choose a different project name","Delete the existing directory first","Use --force to overwrite"]},VALIDATION_ERROR:{title:"Validation Error",description:"The provided input is invalid.",suggestions:["Check your input values","Run with --help to see available options"]},COMPATIBILITY_ERROR:{title:"Compatibility Error",description:"The selected options are not compatible with each other.",suggestions:["Review your selections","Check the documentation for compatible options"]},FS_ERROR:{title:"File System Error",description:"An error occurred while performing file operations.",suggestions:["Check disk space","Ensure you have write permissions"]},CONFIGURATOR_ERROR:{title:"Configuration Error",description:"An error occurred during project configuration.",suggestions:["Try running the command again","Check if all dependencies are available"]},SECURITY_ERROR:{title:"Security Error",description:"A security violation was detected.",suggestions:["Check the target path","Ensure input values are safe"]},NETWORK_ERROR:{title:"Network Error",description:"A network request failed after multiple attempts.",suggestions:["Check your internet connection","Try again in a few minutes","Use offline mode with --offline flag"]},RATE_LIMIT_ERROR:{title:"Rate Limit Exceeded",description:"GitHub API rate limit has been exceeded.",suggestions:["Wait a few minutes before trying again","Authenticate with GitHub to increase rate limits","Use a local template instead"]},OFFLINE_ERROR:{title:"No Internet Connection",description:"Unable to reach remote servers.",suggestions:["Check your internet connection","Use --offline flag for offline mode","Use a local template with --template-dir"]}},Lc=(e,t)=>{if(console.log(),e instanceof Ee){let r=Bc[e.code]||{title:e.name,description:e.message};console.log(L.default.bgRed(L.default.white(L.default.bold(` ${r.title} `)))),console.log();let i=typeof r.description=="function"?r.description({...e.context,...t}):r.description;console.log(L.default.red(i)),e.context&&Object.keys(e.context).length>0&&(console.log(),console.log(L.default.dim("Details:")),Object.entries(e.context).forEach(([n,o])=>{o!==void 0&&console.log(L.default.dim(` ${n}: ${o}`))})),r.suggestions&&r.suggestions.length>0&&(console.log(),console.log(L.default.yellow("Suggestions:")),r.suggestions.forEach(n=>console.log(L.default.dim(` \u2022 ${n}`))))}else if(e instanceof Error){let i=Bc[e.code||""]||{title:"Unexpected Error",description:e.message};console.log(L.default.bgRed(L.default.white(L.default.bold(` ${i.title} `)))),console.log(),console.log(L.default.red(typeof i.description=="function"?i.description(t||{}):i.description)),i.suggestions&&(console.log(),console.log(L.default.yellow("Suggestions:")),i.suggestions.forEach(n=>console.log(L.default.dim(` \u2022 ${n}`)))),process.env.DEBUG&&(console.log(),console.log(L.default.dim("Stack trace:")),console.log(L.default.dim(e.stack||"No stack trace available")))}else console.log(L.default.bgRed(L.default.white(L.default.bold(" Unknown Error ")))),console.log(),console.log(L.default.red("An unexpected error occurred")),console.log(L.default.dim(String(e)));console.log()}});import wr from"node:fs/promises";import Kg from"node:os";import js from"node:path";var Uc,Zg,Mc,zc,Hc,Bs,Ls=D(()=>{"use strict";Cr();Er();Uc=async e=>{let t=js.dirname(e),r=js.join(t,`.nexo-write-test-${Date.now()}`);try{await wr.mkdir(t,{recursive:!0}),await wr.writeFile(r,""),await wr.unlink(r)}catch(i){let n=i;if(n.code==="EACCES"||n.code==="EPERM")throw new nt(`Permission denied: Cannot write to "${t}"`,t,i);if(n.code!=="ENOENT")throw new nt(`Cannot access directory "${t}": ${n.message}`,t,i)}},Zg=async e=>{try{let t=await wr.statfs(e);return{available:t.bavail*t.bsize,total:t.blocks*t.bsize}}catch{let t=js.dirname(e);if(t!==e)try{let r=await wr.statfs(t);return{available:r.bavail*r.bsize,total:r.blocks*r.bsize}}catch{return null}return null}},Mc=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`,zc=async(e,t=br)=>{let r=await Zg(e);if(r===null){console.warn("\u26A0 Unable to check disk space. Proceeding anyway...");return}if(r.available<t)throw new nt(`Insufficient disk space: ${Mc(r.available)} available, ${Mc(t)} required`,e)},Hc=e=>{if(Kg.platform()==="win32"&&e.length>=$e)throw new nt(`Path too long: ${e.length} characters exceeds Windows limit of ${$e}.
|
|
100
|
+
Consider using a shorter project name or parent directory.`,e);let r=e.split(/[/\\]/).filter(Boolean);for(let i of r)if(i.length>it)throw new nt(`Path component "${i.slice(0,50)}..." is too long (${i.length} chars). Maximum is ${it} characters.`,e)},Bs=async(e,t={})=>{let{checkPermissions:r=!0,checkDisk:i=!0,requiredDiskSpace:n=br,validatePath:o=!0}=t;o&&Hc(e),r&&await Uc(e),i&&await zc(e,n)}});var Yc={};k(Yc,{addDependency:()=>vr,addScript:()=>qc,appendFile:()=>Ht,copy:()=>Vc,createProjectDir:()=>Oi,ensureDir:()=>x,getPackageJson:()=>st,pathExists:()=>ke,readJson:()=>Us,remove:()=>Gc,removeFile:()=>Wc,savePackageJson:()=>Ri,writeFile:()=>w,writeJson:()=>We});import Pe from"node:fs/promises";import Ms from"node:path";var ke,x,Us,We,w,Ht,Wc,Gc,Vc,Oi,st,Ri,vr,qc,ot=D(()=>{"use strict";Ls();ke=async e=>{try{return await Pe.access(e),!0}catch{return!1}},x=async e=>{await Pe.mkdir(e,{recursive:!0})},Us=async e=>{let t=await Pe.readFile(e,"utf-8");return JSON.parse(t)},We=async(e,t,r=2)=>{await Pe.writeFile(e,JSON.stringify(t,null,r)+`
|
|
101
|
+
`)},w=async(e,t)=>{if(await ke(e))try{if(await Pe.readFile(e,"utf-8")===t)return}catch{}await Pe.writeFile(e,t)},Ht=async(e,t)=>{await Pe.appendFile(e,t)},Wc=async e=>{await Pe.unlink(e)},Gc=async e=>{await Pe.rm(e,{recursive:!0,force:!0})},Vc=async(e,t)=>{await Pe.cp(e,t,{recursive:!0})},Oi=async e=>{await Bs(e.projectPath),await x(e.projectPath),await x(Ms.join(e.projectPath,"src"))},st=async e=>{let t=Ms.join(e.projectPath,"package.json");return await ke(t)?await Us(t):{name:e.selections?.projectName||"my-nexo-app",version:"0.1.0",private:!0,type:"module",dependencies:{},devDependencies:{},scripts:{}}},Ri=async(e,t)=>{await We(Ms.join(e.projectPath,"package.json"),t)},vr=(e,t,r,i=!1)=>{i?(e.devDependencies=e.devDependencies||{},e.devDependencies[t]=r):(e.dependencies=e.dependencies||{},e.dependencies[t]=r)},qc=(e,t,r)=>{e.scripts=e.scripts||{},e.scripts[t]=r}});import zs from"node:fs/promises";import Jg from"node:os";import Kc from"node:path";var Hs,Ie,Xg,Qg,eD,tD,rD,iD,Ws=D(()=>{"use strict";ot();Hs=class{cache=new Map;defaultTTL=24*60*60*1e3;cacheDir=Kc.join(Jg.homedir(),".nexo");cacheFile=Kc.join(this.cacheDir,"cache.json");version="1.0.0";async load(){try{if(!await zs.access(this.cacheFile).then(()=>!0).catch(()=>!1))return;let r=await zs.readFile(this.cacheFile,"utf-8"),i=JSON.parse(r);if(i.version!==this.version)return;this.cache=new Map(Object.entries(i.entries))}catch{}}async save(){try{await x(this.cacheDir);let t=Date.now();for(let[i,n]of this.cache.entries())t-n.timestamp>this.defaultTTL&&this.cache.delete(i);let r={version:this.version,entries:Object.fromEntries(this.cache)};await zs.writeFile(this.cacheFile,JSON.stringify(r,null,2))}catch{}}async get(t,r,i){let n=this.cache.get(t),o=Date.now();if(n&&o-n.timestamp<(i??this.defaultTTL))return n.value;let s=await r();return this.cache.set(t,{value:s,timestamp:o}),s}getSync(t,r,i){let n=this.cache.get(t),o=Date.now();if(n&&o-n.timestamp<(i??this.defaultTTL))return n.value;let s=r();return this.cache.set(t,{value:s,timestamp:o}),s}has(t,r){let i=this.cache.get(t);return i?Date.now()-i.timestamp<(r??this.defaultTTL):!1}set(t,r){this.cache.set(t,{value:r,timestamp:Date.now()})}invalidate(t){this.cache.delete(t)}invalidatePattern(t){let r=new RegExp(t);for(let i of this.cache.keys())r.test(i)&&this.cache.delete(i)}clear(){this.cache.clear()}stats(){return{size:this.cache.size,keys:[...this.cache.keys()]}}},Ie=new Hs,Xg=(e,t,r)=>Ie.get(e,t,r),Qg=(e,t,r)=>Ie.getSync(e,t,r),eD=e=>{Ie.invalidate(e)},tD=()=>{Ie.clear()},rD=(e,t)=>{let r=t??((...i)=>JSON.stringify(i));return async(...i)=>{let n=`memoize:${e.name}:${r(...i)}`;return Ie.get(n,()=>e(...i))}},iD=(e,t)=>{let r=t??((...i)=>JSON.stringify(i));return(...i)=>{let n=`memoize:${e.name}:${r(...i)}`;return Ie.getSync(n,()=>e(...i))}}});import Jc from"node:fs/promises";import Zc from"node:path";var Gs,Vs,Xc=D(()=>{"use strict";Gs=async e=>{try{return(await Jc.readdir(e)).filter(i=>i!==".git"&&i!==".DS_Store"&&i!=="Thumbs.db").length===0}catch{return!0}},Vs=async e=>{try{let t=Zc.join(e,"package.json"),r=await Jc.readFile(t,"utf-8"),i=JSON.parse(r),n={...i.dependencies,...i.devDependencies},o={projectName:i.name||Zc.basename(e)};return n.react&&(o.framework="react"),n.typescript?o.variant="ts":o.variant="js",n.tailwindcss?o.styling="tailwind":n.sass&&(o.styling="sass"),o}catch{return null}}});var Wt,Qc,el=D(()=>{"use strict";Wt=e=>{let t=[],r=e.variant.startsWith("ts"),i=r?"ts":"js",n=r?"tsx":"jsx";t.push({name:"package.json"}),t.push({name:`vite.config.${i}`}),t.push({name:"index.html"}),r&&t.push({name:"tsconfig.json"}),e.styling==="tailwind"&&(t.push({name:"tailwind.config.js"}),t.push({name:"postcss.config.js"})),t.push({name:"README.md"}),t.push({name:"DOCS.md"}),t.push({name:".env.example"}),e.ui==="shadcn"&&t.push({name:"components.json"}),e.backend==="prisma"&&t.push({name:"prisma/",children:[{name:"schema.prisma"}]});let o=[{name:`main.${n}`},{name:`App.${n}`},{name:"index.css"}];e.structure==="feature-based"?o.push({name:"app/",children:[]},{name:"features/",children:[]},{name:"shared/",children:[{name:"components/",children:[]},{name:"hooks/",children:[]},{name:"utils/",children:[]},{name:"types/",children:[]}]},{name:"pages/",children:[]}):o.push({name:"components/",children:[]},{name:"hooks/",children:[]},{name:"utils/",children:[]},{name:"assets/",children:[]});let s=[];return e.ui==="shadcn"&&s.push({name:`utils.${i}`}),e.backend==="supabase"?s.push({name:`supabase.${i}`}):e.backend==="firebase"?s.push({name:`firebase.${i}`}):e.backend==="prisma"&&s.push({name:`prisma.${i}`}),s.length>0&&o.push({name:"lib/",children:s}),e.backend==="clerk"&&o.push({name:"providers/",children:[{name:`clerk.${n}`}]}),t.push({name:"src/",children:o}),Qc(t)},Qc=(e,t="")=>{let r="";return e.forEach((i,n)=>{let o=n===e.length-1,s=o?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",a=o?" ":"\u2502 ";r+=`${t}${s}${i.name}
|
|
102
|
+
`,i.children&&(r+=Qc(i.children,t+a))}),r}});var tl,$i,qs=D(()=>{tl=Object.defineProperty,$i=(e,t)=>{let r={};for(var i in e)tl(r,i,{get:e[i],enumerable:!0});return t&&tl(r,Symbol.toStringTag,{value:"Module"}),r}});var dl={};k(dl,{a:()=>he,i:()=>pl,n:()=>Zs,r:()=>Ks,t:()=>YD});import{readFile as nD}from"node:fs/promises";import{existsSync as Ys}from"node:fs";import{PassThrough as sD}from"node:stream";import{spawn as oD}from"node:child_process";import{createRequire as aD}from"module";import{delimiter as rl,dirname as uD,normalize as cD,resolve as lD}from"node:path";import{cwd as pD}from"node:process";import hD from"node:readline";function Pi(e=""){return e&&e.replace(/\\/g,"/").replace(mD,t=>t.toUpperCase())}function gD(){return typeof process<"u"&&typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}function ll(e,t){let r="",i=0,n=-1,o=0,s=null;for(let a=0;a<=e.length;++a){if(a<e.length)s=e[a];else{if(s==="/")break;s="/"}if(s==="/"){if(!(n===a-1||o===1))if(o===2){if(r.length<2||i!==2||r[r.length-1]!=="."||r[r.length-2]!=="."){if(r.length>2){let u=r.lastIndexOf("/");u===-1?(r="",i=0):(r=r.slice(0,u),i=r.length-1-r.lastIndexOf("/")),n=a,o=0;continue}else if(r.length>0){r="",i=0,n=a,o=0;continue}}t&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+=`/${e.slice(n+1,a)}`:r=e.slice(n+1,a),i=a-n-1;n=a,o=0}else s==="."&&o!==-1?++o:o=-1}return r}function FD(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!SD.test(t))continue;let r=e[t];return r?{key:t,value:r}:sl}return sl}function xD(e,t){let r=t.value.split(rl),i=e,n;do r.push(lD(i,"node_modules",".bin")),n=i,i=uD(i);while(i!==n);return{key:t.key,value:r.join(rl)}}function kD(e,t){let r={...process.env,...t},i=xD(e,FD(r));return r[i.key]=i.value,r}function WD(e,t){return{command:cD(e),args:t??[]}}function GD(e){let t=new AbortController;for(let r of e){if(r.aborted)return t.abort(),r;r.addEventListener("abort",()=>{t.abort(r.reason)},{signal:t.signal})}return t.signal}async function al(e){let t="";for await(let r of e)t+=r.toString();return t}async function KD(e,t,r={}){let i=cl(e).split("/");for(;i.length>0;){let n=await t(i.join("/")||"/");if(n||!r.includeParentDirs)return n;i.pop()}}function ZD(e){let t;return()=>(t===void 0&&(t=e().then(r=>(t=r,t))),t)}async function XD(e,t,r={}){let i=e!=="npm"&&e!=="bun"&&e!=="deno"&&r.corepack!==!1&&await JD()?["corepack",[e,...t]]:[e,t],{exitCode:n,stdout:o,stderr:s}=await Js(i[0],i[1],{nodeOptions:{cwd:he(r.cwd||process.cwd()),env:r.env,stdio:r.silent?"pipe":"inherit"}});if(n!==0)throw Error(`\`${i.flat().join(" ")}\` failed.${r.silent?["",o,s].join(`
|
|
103
|
+
`):""}`)}async function QD(e={}){let t=e.cwd||process.cwd(),r={...process.env,...e.env},i=(typeof e.packageManager=="string"?vt.find(n=>n.name===e.packageManager):e.packageManager)||await ml(e.cwd||process.cwd());if(!i)throw Error("No package manager auto-detected.");return{cwd:t,env:r,silent:e.silent??!1,packageManager:i,dev:e.dev??!1,workspace:e.workspace,global:e.global??!1,dry:e.dry??!1,corepack:e.corepack??!0}}function ey(e){let[t,r]=(e||"").split("@"),[i,n]=r?.split("+")||[];if(t&&t!=="-"&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(t))return{name:t,version:i,buildMeta:n};let o=(t||"").replace(/\W+/g,"");return{name:o,version:i,buildMeta:n,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${t}\` to \`${o}\``]}}async function ml(e,t={}){let r=await KD(he(e||"."),async i=>{if(!t.ignorePackageJSON){let n=nl(i,"package.json");if(Ys(n)){let o=JSON.parse(await nD(n,"utf8"));if(o?.packageManager){let{name:s,version:a="0.0.0",buildMeta:u,warnings:c}=ey(o.packageManager);if(s){let l=a.split(".")[0],p=vt.find(h=>h.name===s&&h.majorVersion===l)||vt.find(h=>h.name===s);return{name:s,command:s,version:a,majorVersion:l,buildMeta:u,warnings:c,files:p?.files,lockFile:p?.lockFile}}}}if(Ys(nl(i,"deno.json")))return vt.find(o=>o.name==="deno")}if(!t.ignoreLockFile){for(let n of vt)if([n.lockFile,n.files].flat().filter(Boolean).some(o=>Ys(he(i,o))))return{...n}}},{includeParentDirs:t.includeParentDirs??!0});if(!r&&!t.ignoreArgv){let i=process.argv[1];if(i){for(let n of vt)if(RegExp(`[/\\\\]\\.?${n.command}`).test(i))return n}}return r}async function ty(e={}){let t=await QD(e),r=e.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"]}[t.packageManager.name]:["install"];return e.ignoreWorkspace&&t.packageManager.name==="pnpm"&&r.push("--ignore-workspace"),t.dry||await XD(t.packageManager.command,r,{cwd:t.cwd,silent:t.silent,corepack:t.corepack}),{exec:{command:t.packageManager.command,args:r}}}var mD,dD,fD,ul,il,cl,nl,he,Sr,pl,Ks,Zs,DD,hl,yD,bD,CD,ED,De,wD,vD,at,SD,sl,AD,_D,TD,OD,RD,$D,PD,ID,ND,jD,BD,LD,MD,UD,ol,zD,HD,VD,Js,qD,YD,JD,vt,Xs=D(()=>{qs();mD=/^[A-Za-z]:\//;dD=/^[/\\]{2}/,fD=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ul=/^[A-Za-z]:$/,il=/^\/([A-Za-z]:)?$/,cl=function(e){if(e.length===0)return".";e=Pi(e);let t=e.match(dD),r=Sr(e),i=e[e.length-1]==="/";return e=ll(e,!r),e.length===0?r?"/":i?"./":".":(i&&(e+="/"),ul.test(e)&&(e+="/"),t?r?`//${e}`:`//./${e}`:r&&!Sr(e)?`/${e}`:e)},nl=function(...e){let t="";for(let r of e)if(r)if(t.length>0){let i=t[t.length-1]==="/",n=r[0]==="/";i&&n?t+=r.slice(1):t+=i||n?r:`/${r}`}else t+=r;return cl(t)};he=function(...e){e=e.map(i=>Pi(i));let t="",r=!1;for(let i=e.length-1;i>=-1&&!r;i--){let n=i>=0?e[i]:gD();!n||n.length===0||(t=`${n}/${t}`,r=Sr(n))}return t=ll(t,!r),r&&!Sr(t)?`/${t}`:t.length>0?t:"."};Sr=function(e){return fD.test(e)},pl=function(e,t){let r=he(e).replace(il,"$1").split("/"),i=he(t).replace(il,"$1").split("/");if(i[0][1]===":"&&r[0][1]===":"&&r[0]!==i[0])return i.join("/");let n=[...r];for(let o of n){if(i[0]!==o)break;r.shift(),i.shift()}return[...r.map(()=>".."),...i].join("/")},Ks=function(e){let t=Pi(e).replace(/\/$/,"").split("/").slice(0,-1);return t.length===1&&ul.test(t[0])&&(t[0]+="/"),t.join("/")||(Sr(e)?"/":".")},Zs=function(e,t){let r=Pi(e).split("/"),i="";for(let n=r.length-1;n>=0;n--){let o=r[n];if(o){i=o;break}}return t&&i.endsWith(t)?i.slice(0,-t.length):i},DD=Object.create,hl=Object.defineProperty,yD=Object.getOwnPropertyDescriptor,bD=Object.getOwnPropertyNames,CD=Object.getPrototypeOf,ED=Object.prototype.hasOwnProperty,De=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wD=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=bD(t),o=0,s=n.length,a;o<s;o++)a=n[o],!ED.call(e,a)&&a!==r&&hl(e,a,{get:(u=>t[u]).bind(null,a),enumerable:!(i=yD(t,a))||i.enumerable});return e},vD=(e,t,r)=>(r=e==null?{}:DD(CD(e)),wD(t||!e||!e.__esModule?hl(r,"default",{value:e,enumerable:!0}):r,e)),at=aD(import.meta.url),SD=/^path$/i,sl={key:"PATH",value:""};AD=e=>{let t=e.length,r=new sD,i=()=>{--t===0&&r.emit("end")};for(let n of e)n.pipe(r,{end:!1}),n.on("end",i);return r},_D=De((e,t)=>{t.exports=o,o.sync=s;var r=at("fs");function i(a,u){var c=u.pathExt===void 0?process.env.PATHEXT:u.pathExt;if(!c||(c=c.split(";"),c.indexOf("")!==-1))return!0;for(var l=0;l<c.length;l++){var p=c[l].toLowerCase();if(p&&a.substr(-p.length).toLowerCase()===p)return!0}return!1}function n(a,u,c){return!a.isSymbolicLink()&&!a.isFile()?!1:i(u,c)}function o(a,u,c){r.stat(a,function(l,p){c(l,l?!1:n(p,a,u))})}function s(a,u){return n(r.statSync(a),a,u)}}),TD=De((e,t)=>{t.exports=i,i.sync=n;var r=at("fs");function i(a,u,c){r.stat(a,function(l,p){c(l,l?!1:o(p,u))})}function n(a,u){return o(r.statSync(a),u)}function o(a,u){return a.isFile()&&s(a,u)}function s(a,u){var c=a.mode,l=a.uid,p=a.gid,h=u.uid===void 0?process.getuid&&process.getuid():u.uid,d=u.gid===void 0?process.getgid&&process.getgid():u.gid,g=64,y=8,v=1,z=g|y;return c&v||c&y&&p===d||c&g&&l===h||c&z&&h===0}}),OD=De((e,t)=>{at("fs");var r=process.platform==="win32"||global.TESTING_WINDOWS?_D():TD();t.exports=i,i.sync=n;function i(o,s,a){if(typeof s=="function"&&(a=s,s={}),!a){if(typeof Promise!="function")throw TypeError("callback not provided");return new Promise(function(u,c){i(o,s||{},function(l,p){l?c(l):u(p)})})}r(o,s||{},function(u,c){u&&(u.code==="EACCES"||s&&s.ignoreErrors)&&(u=null,c=!1),a(u,c)})}function n(o,s){try{return r.sync(o,s||{})}catch(a){if(s&&s.ignoreErrors||a.code==="EACCES")return!1;throw a}}}),RD=De((e,t)=>{let r=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",i=at("path"),n=r?";":":",o=OD(),s=c=>Object.assign(Error(`not found: ${c}`),{code:"ENOENT"}),a=(c,l)=>{let p=l.colon||n,h=c.match(/\//)||r&&c.match(/\\/)?[""]:[...r?[process.cwd()]:[],...(l.path||process.env.PATH||"").split(p)],d=r?l.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=r?d.split(p):[""];return r&&c.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:h,pathExt:g,pathExtExe:d}},u=(c,l,p)=>{typeof l=="function"&&(p=l,l={}),l||={};let{pathEnv:h,pathExt:d,pathExtExe:g}=a(c,l),y=[],v=C=>new Promise((se,oe)=>{if(C===h.length)return l.all&&y.length?se(y):oe(s(c));let E=h[C],Y=/^".*"$/.test(E)?E.slice(1,-1):E,j=i.join(Y,c);se(z(!Y&&/^\.[\\\/]/.test(c)?c.slice(0,2)+j:j,C,0))}),z=(C,se,oe)=>new Promise((E,Y)=>{if(oe===d.length)return E(v(se+1));let j=d[oe];o(C+j,{pathExt:g},(Et,Se)=>{if(!Et&&Se)if(l.all)y.push(C+j);else return E(C+j);return E(z(C,se,oe+1))})});return p?v(0).then(C=>p(null,C),p):v(0)};t.exports=u,u.sync=(c,l)=>{l||={};let{pathEnv:p,pathExt:h,pathExtExe:d}=a(c,l),g=[];for(let y=0;y<p.length;y++){let v=p[y],z=/^".*"$/.test(v)?v.slice(1,-1):v,C=i.join(z,c),se=!z&&/^\.[\\\/]/.test(c)?c.slice(0,2)+C:C;for(let oe=0;oe<h.length;oe++){let E=se+h[oe];try{if(o.sync(E,{pathExt:d}))if(l.all)g.push(E);else return E}catch{}}}if(l.all&&g.length)return g;if(l.nothrow)return null;throw s(c)}}),$D=De((e,t)=>{let r=(i={})=>{let n=i.env||process.env;return(i.platform||process.platform)==="win32"?Object.keys(n).reverse().find(o=>o.toUpperCase()==="PATH")||"Path":"PATH"};t.exports=r,t.exports.default=r}),PD=De((e,t)=>{let r=at("path"),i=RD(),n=$D();function o(a,u){let c=a.options.env||process.env,l=process.cwd(),p=a.options.cwd!=null,h=p&&process.chdir!==void 0&&!process.chdir.disabled;if(h)try{process.chdir(a.options.cwd)}catch{}let d;try{d=i.sync(a.command,{path:c[n({env:c})],pathExt:u?r.delimiter:void 0})}catch{}finally{h&&process.chdir(l)}return d&&=r.resolve(p?a.options.cwd:"",d),d}function s(a){return o(a)||o(a,!0)}t.exports=s}),ID=De((e,t)=>{let r=/([()\][%!^"`<>&|;, *?])/g;function i(o){return o=o.replace(r,"^$1"),o}function n(o,s){return o=`${o}`,o=o.replace(/(\\*)"/g,'$1$1\\"'),o=o.replace(/(\\*)$/,"$1$1"),o=`"${o}"`,o=o.replace(r,"^$1"),s&&(o=o.replace(r,"^$1")),o}t.exports.command=i,t.exports.argument=n}),ND=De((e,t)=>{t.exports=/^#!(.*)/}),jD=De((e,t)=>{let r=ND();t.exports=(i="")=>{let n=i.match(r);if(!n)return null;let[o,s]=n[0].replace(/#! ?/,"").split(" "),a=o.split("/").pop();return a==="env"?s:s?`${a} ${s}`:a}}),BD=De((e,t)=>{let r=at("fs"),i=jD();function n(o){let s=Buffer.alloc(150),a;try{a=r.openSync(o,"r"),r.readSync(a,s,0,150,0),r.closeSync(a)}catch{}return i(s.toString())}t.exports=n}),LD=De((e,t)=>{let r=at("path"),i=PD(),n=ID(),o=BD(),s=process.platform==="win32",a=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function c(h){h.file=i(h);let d=h.file&&o(h.file);return d?(h.args.unshift(h.file),h.command=d,i(h)):h.file}function l(h){if(!s)return h;let d=c(h),g=!a.test(d);if(h.options.forceShell||g){let y=u.test(d);h.command=r.normalize(h.command),h.command=n.command(h.command),h.args=h.args.map(v=>n.argument(v,y)),h.args=["/d","/s","/c",`"${[h.command].concat(h.args).join(" ")}"`],h.command=process.env.comspec||"cmd.exe",h.options.windowsVerbatimArguments=!0}return h}function p(h,d,g){d&&!Array.isArray(d)&&(g=d,d=null),d=d?d.slice(0):[],g=Object.assign({},g);let y={command:h,args:d,options:g,file:void 0,original:{command:h,args:d}};return g.shell?y:l(y)}t.exports=p}),MD=De((e,t)=>{let r=process.platform==="win32";function i(a,u){return Object.assign(Error(`${u} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${u} ${a.command}`,path:a.command,spawnargs:a.args})}function n(a,u){if(!r)return;let c=a.emit;a.emit=function(l,p){if(l==="exit"){let h=o(p,u,"spawn");if(h)return c.call(a,"error",h)}return c.apply(a,arguments)}}function o(a,u){return r&&a===1&&!u.file?i(u.original,"spawn"):null}function s(a,u){return r&&a===1&&!u.file?i(u.original,"spawnSync"):null}t.exports={hookChildProcess:n,verifyENOENT:o,verifyENOENTSync:s,notFoundError:i}}),UD=vD(De((e,t)=>{let r=at("child_process"),i=LD(),n=MD();function o(a,u,c){let l=i(a,u,c),p=r.spawn(l.command,l.args,l.options);return n.hookChildProcess(p,l),p}function s(a,u,c){let l=i(a,u,c),p=r.spawnSync(l.command,l.args,l.options);return p.error=p.error||n.verifyENOENTSync(p.status,l),p}t.exports=o,t.exports.spawn=o,t.exports.sync=s,t.exports._parse=i,t.exports._enoent=n})(),1),ol=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}},zD={timeout:void 0,persist:!1},HD={windowsHide:!0};VD=class{_process;_aborted=!1;_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,r){this._options={...zD,...r},this._command=e,this._args=t??[],this._processClosed=new Promise(i=>{this._resolveClose=i})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,r){return qD(e,t,{...r,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 r=AD(t),i=hD.createInterface({input:r});for await(let n of i)yield n.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 ol(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error("No process was started");let[t,r]=await Promise.all([this._streamOut?al(this._streamOut):"",this._streamErr?al(this._streamErr):""]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let i={stderr:r,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ol(this,i);return i}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=pD(),t=this._options,r={...HD,...t.nodeOptions},i=[];this._resetState(),t.timeout!==void 0&&i.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&i.push(t.signal),t.persist===!0&&(r.detached=!0),i.length>0&&(r.signal=GD(i)),r.env=kD(e,r.env);let{command:n,args:o}=WD(this._command,this._args),s=(0,UD._parse)(n,o,r),a=oD(s.command,s.args,s.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:u}=t.stdin.process;u&&u.pipe(a.stdin)}}_resetState(){this._aborted=!1,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=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}},Js=(e,t,r)=>{let i=new VD(e,t,r);return i.spawn(),i},qD=Js,YD=$i({detectPackageManager:()=>ml,installDependencies:()=>ty,packageManagers:()=>vt});JD=ZD(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:e}=await Js("corepack",["--version"]);return e===0}catch{return!1}});vt=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}]});import bl from"node:stream";import ry from"events";import me from"fs";import{EventEmitter as po}from"node:events";import{StringDecoder as iy}from"node:string_decoder";var fl,ny,sy,oy,Ge,Ve,ut,Ii,Fr,Ni,gl,ji,Dl,Ae,Gt,K,xr,Vt,Z,ue,J,Qs,Bi,te,U,eo,to,yl,ro,Ne,io,Li,kr,St,ye,Ar,ay,uy,cy,ly,Cl,py,hy,my,Ke,dy,lt,Te,_r,_,no,Ye,so,co,lo,Or,Mi,Kt,Zt,oo,qt,pt,_e,ct,je,Yt,ao,qe,Tr,uo,Ui,Ft,zi,xt,Hi,El,Rr,ho,mo=D(()=>{fl=typeof process=="object"&&process?process:{stdout:null,stderr:null},ny=e=>!!e&&typeof e=="object"&&(e instanceof Ke||e instanceof bl||sy(e)||oy(e)),sy=e=>!!e&&typeof e=="object"&&e instanceof po&&typeof e.pipe=="function"&&e.pipe!==bl.Writable.prototype.pipe,oy=e=>!!e&&typeof e=="object"&&e instanceof po&&typeof e.write=="function"&&typeof e.end=="function",Ge=Symbol("EOF"),Ve=Symbol("maybeEmitEnd"),ut=Symbol("emittedEnd"),Ii=Symbol("emittingEnd"),Fr=Symbol("emittedError"),Ni=Symbol("closed"),gl=Symbol("read"),ji=Symbol("flush"),Dl=Symbol("flushChunk"),Ae=Symbol("encoding"),Gt=Symbol("decoder"),K=Symbol("flowing"),xr=Symbol("paused"),Vt=Symbol("resume"),Z=Symbol("buffer"),ue=Symbol("pipes"),J=Symbol("bufferLength"),Qs=Symbol("bufferPush"),Bi=Symbol("bufferShift"),te=Symbol("objectMode"),U=Symbol("destroyed"),eo=Symbol("error"),to=Symbol("emitData"),yl=Symbol("emitEnd"),ro=Symbol("emitEnd2"),Ne=Symbol("async"),io=Symbol("abort"),Li=Symbol("aborted"),kr=Symbol("signal"),St=Symbol("dataListeners"),ye=Symbol("discarded"),Ar=e=>Promise.resolve().then(e),ay=e=>e(),uy=e=>e==="end"||e==="finish"||e==="prefinish",cy=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,ly=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),Cl=class{src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Vt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},py=class extends Cl{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,r){super(e,t,r),this.proxyErrors=i=>t.emit("error",i),e.on("error",this.proxyErrors)}},hy=e=>!!e.objectMode,my=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Ke=class extends po{[K]=!1;[xr]=!1;[ue]=[];[Z]=[];[te];[Ae];[Ne];[Gt];[Ge]=!1;[ut]=!1;[Ii]=!1;[Ni]=!1;[Fr]=null;[J]=0;[U]=!1;[kr];[Li]=!1;[St]=0;[ye]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");hy(t)?(this[te]=!0,this[Ae]=null):my(t)?(this[Ae]=t.encoding,this[te]=!1):(this[te]=!1,this[Ae]=null),this[Ne]=!!t.async,this[Gt]=this[Ae]?new iy(this[Ae]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Z]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ue]});let{signal:r}=t;r&&(this[kr]=r,r.aborted?this[io]():r.addEventListener("abort",()=>this[io]()))}get bufferLength(){return this[J]}get encoding(){return this[Ae]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[te]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[Ne]}set async(e){this[Ne]=this[Ne]||!!e}[io](){this[Li]=!0,this.emit("abort",this[kr]?.reason),this.destroy(this[kr]?.reason)}get aborted(){return this[Li]}set aborted(e){}write(e,t,r){if(this[Li])return!1;if(this[Ge])throw Error("write after end");if(this[U])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(r=t,t="utf8"),t||="utf8";let i=this[Ne]?Ar:ay;if(!this[te]&&!Buffer.isBuffer(e)){if(ly(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(cy(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[te]?(this[K]&&this[J]!==0&&this[ji](!0),this[K]?this.emit("data",e):this[Qs](e),this[J]!==0&&this.emit("readable"),r&&i(r),this[K]):e.length?(typeof e=="string"&&!(t===this[Ae]&&!this[Gt]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[Ae]&&(e=this[Gt].write(e)),this[K]&&this[J]!==0&&this[ji](!0),this[K]?this.emit("data",e):this[Qs](e),this[J]!==0&&this.emit("readable"),r&&i(r),this[K]):(this[J]!==0&&this.emit("readable"),r&&i(r),this[K])}read(e){if(this[U])return null;if(this[ye]=!1,this[J]===0||e===0||e&&e>this[J])return this[Ve](),null;this[te]&&(e=null),this[Z].length>1&&!this[te]&&(this[Z]=[this[Ae]?this[Z].join(""):Buffer.concat(this[Z],this[J])]);let t=this[gl](e||null,this[Z][0]);return this[Ve](),t}[gl](e,t){if(this[te])this[Bi]();else{let r=t;e===r.length||e===null?this[Bi]():typeof r=="string"?(this[Z][0]=r.slice(e),t=r.slice(0,e),this[J]-=e):(this[Z][0]=r.subarray(e),t=r.subarray(0,e),this[J]-=e)}return this.emit("data",t),!this[Z].length&&!this[Ge]&&this.emit("drain"),t}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t="utf8"),e!==void 0&&this.write(e,t),r&&this.once("end",r),this[Ge]=!0,this.writable=!1,(this[K]||!this[xr])&&this[Ve](),this}[Vt](){this[U]||(!this[St]&&!this[ue].length&&(this[ye]=!0),this[xr]=!1,this[K]=!0,this.emit("resume"),this[Z].length?this[ji]():this[Ge]?this[Ve]():this.emit("drain"))}resume(){return this[Vt]()}pause(){this[K]=!1,this[xr]=!0,this[ye]=!1}get destroyed(){return this[U]}get flowing(){return this[K]}get paused(){return this[xr]}[Qs](e){this[te]?this[J]+=1:this[J]+=e.length,this[Z].push(e)}[Bi](){return this[te]?--this[J]:this[J]-=this[Z][0].length,this[Z].shift()}[ji](e=!1){do;while(this[Dl](this[Bi]())&&this[Z].length);!e&&!this[Z].length&&!this[Ge]&&this.emit("drain")}[Dl](e){return this.emit("data",e),this[K]}pipe(e,t){if(this[U])return e;this[ye]=!1;let r=this[ut];return t||={},e===fl.stdout||e===fl.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[ue].push(t.proxyErrors?new py(this,e,t):new Cl(this,e,t)),this[Ne]?Ar(()=>this[Vt]()):this[Vt]()),e}unpipe(e){let t=this[ue].find(r=>r.dest===e);t&&(this[ue].length===1?(this[K]&&this[St]===0&&(this[K]=!1),this[ue]=[]):this[ue].splice(this[ue].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let r=super.on(e,t);if(e==="data")this[ye]=!1,this[St]++,!this[ue].length&&!this[K]&&this[Vt]();else if(e==="readable"&&this[J]!==0)super.emit("readable");else if(uy(e)&&this[ut])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Fr]){let i=t;this[Ne]?Ar(()=>i.call(this,this[Fr])):i.call(this,this[Fr])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[St]=this.listeners("data").length,this[St]===0&&!this[ye]&&!this[ue].length&&(this[K]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[St]=0,!this[ye]&&!this[ue].length&&(this[K]=!1)),t}get emittedEnd(){return this[ut]}[Ve](){!this[Ii]&&!this[ut]&&!this[U]&&this[Z].length===0&&this[Ge]&&(this[Ii]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ni]&&this.emit("close"),this[Ii]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==U&&this[U])return!1;if(e==="data")return!this[te]&&!r?!1:this[Ne]?(Ar(()=>this[to](r)),!0):this[to](r);if(e==="end")return this[yl]();if(e==="close"){if(this[Ni]=!0,!this[ut]&&!this[U])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[Fr]=r,super.emit(eo,r);let n=!this[kr]||this.listeners("error").length?super.emit("error",r):!1;return this[Ve](),n}else if(e==="resume"){let n=super.emit("resume");return this[Ve](),n}else if(e==="finish"||e==="prefinish"){let n=super.emit(e);return this.removeAllListeners(e),n}let i=super.emit(e,...t);return this[Ve](),i}[to](e){for(let r of this[ue])r.dest.write(e)===!1&&this.pause();let t=this[ye]?!1:super.emit("data",e);return this[Ve](),t}[yl](){return this[ut]?!1:(this[ut]=!0,this.readable=!1,this[Ne]?(Ar(()=>this[ro]()),!0):this[ro]())}[ro](){if(this[Gt]){let t=this[Gt].end();if(t){for(let r of this[ue])r.dest.write(t);this[ye]||super.emit("data",t)}}for(let t of this[ue])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[te]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[te]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[te])throw Error("cannot concat in objectMode");let e=await this.collect();return this[Ae]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(U,()=>t(Error("stream destroyed"))),this.on("error",r=>t(r)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ye]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Ge])return t();let i,n,o=c=>{this.off("data",s),this.off("end",a),this.off(U,u),t(),n(c)},s=c=>{this.off("error",o),this.off("end",a),this.off(U,u),this.pause(),i({value:c,done:!!this[Ge]})},a=()=>{this.off("error",o),this.off("data",s),this.off(U,u),t(),i({done:!0,value:void 0})},u=()=>o(Error("stream destroyed"));return new Promise((c,l)=>{n=l,i=c,this.once(U,u),this.once("error",o),this.once("end",a),this.once("data",s)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ye]=!1;let e=!1,t=()=>(this.pause(),this.off(eo,t),this.off(U,t),this.off("end",t),e=!0,{done:!0,value:void 0});return this.once("end",t),this.once(eo,t),this.once(U,t),{next:()=>{if(e)return t();let r=this.read();return r===null?t():{done:!1,value:r}},throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[U])return e?this.emit("error",e):this.emit(U),this;this[U]=!0,this[ye]=!0,this[Z].length=0,this[J]=0;let t=this;return typeof t.close=="function"&&!this[Ni]&&t.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return ny}},dy=me.writev,lt=Symbol("_autoClose"),Te=Symbol("_close"),_r=Symbol("_ended"),_=Symbol("_fd"),no=Symbol("_finished"),Ye=Symbol("_flags"),so=Symbol("_flush"),co=Symbol("_handleChunk"),lo=Symbol("_makeBuf"),Or=Symbol("_mode"),Mi=Symbol("_needDrain"),Kt=Symbol("_onerror"),Zt=Symbol("_onopen"),oo=Symbol("_onread"),qt=Symbol("_onwrite"),pt=Symbol("_open"),_e=Symbol("_path"),ct=Symbol("_pos"),je=Symbol("_queue"),Yt=Symbol("_read"),ao=Symbol("_readSize"),qe=Symbol("_reading"),Tr=Symbol("_remain"),uo=Symbol("_size"),Ui=Symbol("_write"),Ft=Symbol("_writing"),zi=Symbol("_defaultFlag"),xt=Symbol("_errored"),Hi=class extends Ke{[xt]=!1;[_];[_e];[ao];[qe]=!1;[uo];[Tr];[lt];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[xt]=!1,this[_]=typeof t.fd=="number"?t.fd:void 0,this[_e]=e,this[ao]=t.readSize||16*1024*1024,this[qe]=!1,this[uo]=typeof t.size=="number"?t.size:1/0,this[Tr]=this[uo],this[lt]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[_]=="number"?this[Yt]():this[pt]()}get fd(){return this[_]}get path(){return this[_e]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[pt](){me.open(this[_e],"r",(e,t)=>this[Zt](e,t))}[Zt](e,t){e?this[Kt](e):(this[_]=t,this.emit("open",t),this[Yt]())}[lo](){return Buffer.allocUnsafe(Math.min(this[ao],this[Tr]))}[Yt](){if(!this[qe]){this[qe]=!0;let e=this[lo]();if(e.length===0)return process.nextTick(()=>this[oo](null,0,e));me.read(this[_],e,0,e.length,null,(t,r,i)=>this[oo](t,r,i))}}[oo](e,t,r){this[qe]=!1,e?this[Kt](e):this[co](t,r)&&this[Yt]()}[Te](){if(this[lt]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,me.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Kt](e){this[qe]=!0,this[Te](),this.emit("error",e)}[co](e,t){let r=!1;return this[Tr]-=e,e>0&&(r=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[Tr]<=0)&&(r=!1,this[Te](),super.end()),r}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[_]=="number"&&this[Yt](),!1;case"error":return this[xt]?!1:(this[xt]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},El=class extends Hi{[pt](){let e=!0;try{this[Zt](null,me.openSync(this[_e],"r")),e=!1}finally{e&&this[Te]()}}[Yt](){let e=!0;try{if(!this[qe]){this[qe]=!0;do{let t=this[lo](),r=t.length===0?0:me.readSync(this[_],t,0,t.length,null);if(!this[co](r,t))break}while(!0);this[qe]=!1}e=!1}finally{e&&this[Te]()}}[Te](){if(this[lt]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,me.closeSync(e),this.emit("close")}}},Rr=class extends ry{readable=!1;writable=!0;[xt]=!1;[Ft]=!1;[_r]=!1;[je]=[];[Mi]=!1;[_e];[Or];[lt];[_];[zi];[Ye];[no]=!1;[ct];constructor(e,t){t||={},super(t),this[_e]=e,this[_]=typeof t.fd=="number"?t.fd:void 0,this[Or]=t.mode===void 0?438:t.mode,this[ct]=typeof t.start=="number"?t.start:void 0,this[lt]=typeof t.autoClose=="boolean"?t.autoClose:!0;let r=this[ct]===void 0?"w":"r+";this[zi]=t.flags===void 0,this[Ye]=t.flags===void 0?r:t.flags,this[_]===void 0&&this[pt]()}emit(e,...t){if(e==="error"){if(this[xt])return!1;this[xt]=!0}return super.emit(e,...t)}get fd(){return this[_]}get path(){return this[_e]}[Kt](e){this[Te](),this[Ft]=!0,this.emit("error",e)}[pt](){me.open(this[_e],this[Ye],this[Or],(e,t)=>this[Zt](e,t))}[Zt](e,t){this[zi]&&this[Ye]==="r+"&&e&&e.code==="ENOENT"?(this[Ye]="w",this[pt]()):e?this[Kt](e):(this[_]=t,this.emit("open",t),this[Ft]||this[so]())}end(e,t){return e&&this.write(e,t),this[_r]=!0,!this[Ft]&&!this[je].length&&typeof this[_]=="number"&&this[qt](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[_r]?(this.emit("error",Error("write() after end()")),!1):this[_]===void 0||this[Ft]||this[je].length?(this[je].push(e),this[Mi]=!0,!1):(this[Ft]=!0,this[Ui](e),!0)}[Ui](e){me.write(this[_],e,0,e.length,this[ct],(t,r)=>this[qt](t,r))}[qt](e,t){e?this[Kt](e):(this[ct]!==void 0&&typeof t=="number"&&(this[ct]+=t),this[je].length?this[so]():(this[Ft]=!1,this[_r]&&!this[no]?(this[no]=!0,this[Te](),this.emit("finish")):this[Mi]&&(this[Mi]=!1,this.emit("drain"))))}[so](){if(this[je].length===0)this[_r]&&this[qt](null,0);else if(this[je].length===1)this[Ui](this[je].pop());else{let e=this[je];this[je]=[],dy(this[_],e,this[ct],(t,r)=>this[qt](t,r))}}[Te](){if(this[lt]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,me.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},ho=class extends Rr{[pt](){let e;if(this[zi]&&this[Ye]==="r+")try{e=me.openSync(this[_e],this[Ye],this[Or])}catch(t){if(t?.code==="ENOENT")return this[Ye]="w",this[pt]();throw t}else e=me.openSync(this[_e],this[Ye],this[Or]);this[Zt](null,e)}[Te](){if(this[lt]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,me.closeSync(e),this.emit("close")}}[Ui](e){let t=!0;try{this[qt](null,me.writeSync(this[_],e,0,e.length,this[ct])),t=!1}finally{if(t)try{this[Te]()}catch{}}}}});import Do from"assert";import{Buffer as kt}from"buffer";import*as wl from"zlib";import fy from"zlib";var gy,Be,Dy,vl,yy,fo,At,Wi,go,yo,Sl,Fl,xl,kl,Al,_l,Tl,Ol,Rl,$l=D(()=>{mo();gy=fy.constants||{ZLIB_VERNUM:4736},Be=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},gy)),Dy=kt.concat,vl=Object.getOwnPropertyDescriptor(kt,"concat"),yy=e=>e,fo=vl?.writable===!0||vl?.set!==void 0?e=>{kt.concat=e?yy:Dy}:e=>{},At=Symbol("_superWrite"),Wi=class extends Error{code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},go=Symbol("flushFlag"),yo=class extends Ke{#e=!1;#i=!1;#t;#o;#s;#r;#n;get sawError(){return this.#e}get handle(){return this.#r}get flushFlag(){return this.#t}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#t=e.flush??0,this.#o=e.finishFlush??0,this.#s=e.fullFlushFlag??0,typeof wl[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#r=new wl[t](e)}catch(r){throw new Wi(r,this.constructor)}this.#n=r=>{this.#e||(this.#e=!0,this.close(),this.emit("error",r))},this.#r?.on("error",r=>this.#n(new Wi(r))),this.once("end",()=>this.close)}close(){this.#r&&(this.#r.close(),this.#r=void 0,this.emit("close"))}reset(){if(!this.#e)return Do(this.#r,"zlib binding closed"),this.#r.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#s),this.write(Object.assign(kt.alloc(0),{[go]:e})))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#o),this.#i=!0,super.end(r)}get ended(){return this.#i}[At](e){return super.write(e)}write(e,t,r){if(typeof t=="function"&&(r=t,t="utf8"),typeof e=="string"&&(e=kt.from(e,t)),this.#e)return;Do(this.#r,"zlib binding closed");let i=this.#r._handle,n=i.close;i.close=()=>{};let o=this.#r.close;this.#r.close=()=>{},fo(!0);let s;try{let u=typeof e[go]=="number"?e[go]:this.#t;s=this.#r._processChunk(e,u),fo(!1)}catch(u){fo(!1),this.#n(new Wi(u,this.write))}finally{this.#r&&(this.#r._handle=i,i.close=n,this.#r.close=o,this.#r.removeAllListeners("error"))}this.#r&&this.#r.on("error",u=>this.#n(new Wi(u,this.write)));let a;if(s)if(Array.isArray(s)&&s.length>0){let u=s[0];a=this[At](kt.from(u));for(let c=1;c<s.length;c++)a=this[At](s[c])}else a=this[At](kt.from(s));return r&&r(),a}},Sl=class extends yo{#e;#i;constructor(e,t){e||={},e.flush=e.flush||Be.Z_NO_FLUSH,e.finishFlush=e.finishFlush||Be.Z_FINISH,e.fullFlushFlag=Be.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(Be.Z_SYNC_FLUSH),Do(this.handle,"zlib binding closed");let r=this.handle.flush;this.handle.flush=(i,n)=>{typeof i=="function"&&(n=i,i=this.flushFlag),this.flush(i),n?.()};try{this.handle.params(e,t)}finally{this.handle.flush=r}this.handle&&(this.#e=e,this.#i=t)}}}},Fl=class extends Sl{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[At](e){return this.#e?(this.#e=!1,e[9]=255,super[At](e)):super[At](e)}},xl=class extends Sl{constructor(e){super(e,"Unzip")}},kl=class extends yo{constructor(e,t){e||={},e.flush=e.flush||Be.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Be.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Be.BROTLI_OPERATION_FLUSH,super(e,t)}},Al=class extends kl{constructor(e){super(e,"BrotliCompress")}},_l=class extends kl{constructor(e){super(e,"BrotliDecompress")}},Tl=class extends yo{constructor(e,t){e||={},e.flush=e.flush||Be.ZSTD_e_continue,e.finishFlush=e.finishFlush||Be.ZSTD_e_end,e.fullFlushFlag=Be.ZSTD_e_flush,super(e,t)}},Ol=class extends Tl{constructor(e){super(e,"ZstdCompress")}},Rl=class extends Tl{constructor(e){super(e,"ZstdDecompress")}}});import Vi from"node:fs";import $r from"node:path";var bo,Gi,by,Co,Cy,Eo,Pl=D(()=>{bo=(e,t,r)=>{try{return Vi.lchownSync(e,t,r)}catch(i){if(i?.code!=="ENOENT")throw i}},Gi=(e,t,r,i)=>{Vi.lchown(e,t,r,n=>{i(n&&n?.code!=="ENOENT"?n:null)})},by=(e,t,r,i,n)=>{t.isDirectory()?Co($r.resolve(e,t.name),r,i,o=>{if(o)return n(o);Gi($r.resolve(e,t.name),r,i,n)}):Gi($r.resolve(e,t.name),r,i,n)},Co=(e,t,r,i)=>{Vi.readdir(e,{withFileTypes:!0},(n,o)=>{if(n){if(n.code==="ENOENT")return i();if(n.code!=="ENOTDIR"&&n.code!=="ENOTSUP")return i(n)}if(n||!o.length)return Gi(e,t,r,i);let s=o.length,a=null,u=c=>{if(!a){if(c)return i(a=c);if(--s===0)return Gi(e,t,r,i)}};for(let c of o)by(e,c,t,r,u)})},Cy=(e,t,r,i)=>{t.isDirectory()&&Eo($r.resolve(e,t.name),r,i),bo($r.resolve(e,t.name),r,i)},Eo=(e,t,r)=>{let i;try{i=Vi.readdirSync(e,{withFileTypes:!0})}catch(n){let o=n;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return bo(e,t,r);throw o}for(let n of i)Cy(e,n,t,r);return bo(e,t,r)}});var Ep={};k(Ep,{t:()=>j0});import Ey from"node:fs/promises";import b from"node:fs";import W,{basename as wy,join as np,posix as Jt,win32 as vy}from"node:path";import{EventEmitter as Sy}from"events";import ie from"fs";import ln,{dirname as Fy,parse as xy}from"path";import ky from"node:assert";import{randomBytes as sp}from"node:crypto";function c0(e,t,r){let i=new la(r,t,t?t.next:e.head,e);return i.next===void 0&&(e.tail=i),i.prev===void 0&&(e.head=i),e.length++,i}function l0(e,t){e.tail=new la(t,e.tail,void 0,e),e.head||=e.tail,e.length++}function p0(e,t){e.head=new la(t,void 0,e.head,e),e.tail||=e.head,e.length++}var Ay,_y,Ty,Oy,Ry,$y,Py,ia,Vr,Iy,Ny,jy,By,Ly,My,op,ap,wo,na,Uy,bt,zy,_t,vo,Hy,ft,Wy,Gy,Vy,gt,qy,Yy,Ky,So,Zy,Tt,Gr,Jy,Xy,Qy,S,sa,mn,Bo,Lo,e0,we,Ot,Ze,Fo,Il,Le,Pr,ht,Nl,R,Je,mt,xo,Rt,H,qi,Yi,ko,jl,Bl,Ir,Ao,Ki,Xt,dt,Zi,$t,Ji,Xi,Ll,t0,ir,Lr,r0,oa,qr,cp,i0,Ml,aa,dn,ua,n0,s0,Ul,o0,lp,zl,Hl,Wl,Mo,Gl,Nr,tn,Uo,rn,zo,Ho,Wo,Go,Dt,pn,Vo,_o,Me,ca,pp,hp,a0,u0,la,qo,Vl,nn,jr,Oe,Pt,It,Br,To,Re,Oo,sn,ql,Yo,Ko,on,an,Yl,Ro,un,mp,$o,Yr,fn,h0,m0,dp,fp,d0,f0,g0,D0,gp,y0,b0,Dp,yp,bp,C0,E0,Zo,Cp,w0,v0,Po,Kl,Qt,S0,F0,x0,k0,Zl,Jo,Jl,Xo,ve,Qo,ea,cn,Xl,Ql,ep,tp,Io,yt,re,Qi,rp,er,No,jo,ta,Mr,Ur,zr,Hr,Wr,A0,_0,ip,hn,en,ra,T0,O0,R0,$0,P0,I0,rr,N0,j0,wp=D(()=>{qs();mo();$l();Pl();Ay=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),_y=e=>!!e.sync&&!!e.file,Ty=e=>!e.sync&&!!e.file,Oy=e=>!!e.sync&&!e.file,Ry=e=>!e.sync&&!e.file,$y=e=>!!e.file,Py=e=>Ay.get(e)||e,ia=(e={})=>{if(!e)return{};let t={};for(let[r,i]of Object.entries(e)){let n=Py(r);t[n]=i}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},Vr=(e,t,r,i,n)=>Object.assign((o=[],s,a)=>{Array.isArray(o)&&(s=o,o={}),typeof s=="function"&&(a=s,s=void 0),s=s?Array.from(s):[];let u=ia(o);if(n?.(u,s),_y(u)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(u,s)}else if(Ty(u)){let c=t(u,s),l=a||void 0;return l?c.then(()=>l(),l):c}else if(Oy(u)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return r(u,s)}else if(Ry(u)){if(typeof a=="function")throw TypeError("callback only supported with file option");return i(u,s)}else throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:r,asyncNoFile:i,validate:n}),Iy=(e,t)=>{if(Number.isSafeInteger(e))e<0?jy(e,t):Ny(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},Ny=(e,t)=>{t[0]=128;for(var r=t.length;r>1;r--)t[r-1]=e&255,e=Math.floor(e/256)},jy=(e,t)=>{t[0]=255;var r=!1;e*=-1;for(var i=t.length;i>1;i--){var n=e&255;e=Math.floor(e/256),r?t[i-1]=op(n):n===0?t[i-1]=0:(r=!0,t[i-1]=ap(n))}},By=e=>{let t=e[0],r=t===128?My(e.subarray(1,e.length)):t===255?Ly(e):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},Ly=e=>{for(var t=e.length,r=0,i=!1,n=t-1;n>-1;n--){var o=Number(e[n]),s;i?s=op(o):o===0?s=o:(i=!0,s=ap(o)),s!==0&&(r-=s*256**(t-n-1))}return r},My=e=>{for(var t=e.length,r=0,i=t-1;i>-1;i--){var n=Number(e[i]);n!==0&&(r+=n*256**(t-i-1))}return r},op=e=>(255^e)&255,ap=e=>(255^e)+1&255,wo=e=>na.has(e),na=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Uy=new Map(Array.from(na).map(e=>[e[1],e[0]])),bt=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,r,i){Buffer.isBuffer(e)?this.decode(e,t||0,r,i):e&&this.#i(e)}decode(e,t,r,i){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");this.path=r?.path??_t(e,t,100),this.mode=r?.mode??i?.mode??ft(e,t+100,8),this.uid=r?.uid??i?.uid??ft(e,t+108,8),this.gid=r?.gid??i?.gid??ft(e,t+116,8),this.size=r?.size??i?.size??ft(e,t+124,12),this.mtime=r?.mtime??i?.mtime??vo(e,t+136,12),this.cksum=ft(e,t+148,12),i&&this.#i(i,!0),r&&this.#i(r);let n=_t(e,t+156,1);if(wo(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=_t(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=r?.uname??i?.uname??_t(e,t+265,32),this.gname=r?.gname??i?.gname??_t(e,t+297,32),this.devmaj=r?.devmaj??i?.devmaj??ft(e,t+329,8)??0,this.devmin=r?.devmin??i?.devmin??ft(e,t+337,8)??0,e[t+475]!==0)this.path=_t(e,t+345,155)+"/"+this.path;else{let s=_t(e,t+345,130);s&&(this.path=s+"/"+this.path),this.atime=r?.atime??i?.atime??vo(e,t+476,12),this.ctime=r?.ctime??i?.ctime??vo(e,t+488,12)}let o=256;for(let s=t;s<t+148;s++)o+=e[s];for(let s=t+156;s<t+512;s++)o+=e[s];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,i])=>!(i==null||r==="path"&&t||r==="linkpath"&&t||r==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let r=this.ctime||this.atime?130:155,i=zy(this.path||"",r),n=i[0],o=i[1];this.needPax=!!i[2],this.needPax=Tt(e,t,100,n)||this.needPax,this.needPax=gt(e,t+100,8,this.mode)||this.needPax,this.needPax=gt(e,t+108,8,this.uid)||this.needPax,this.needPax=gt(e,t+116,8,this.gid)||this.needPax,this.needPax=gt(e,t+124,12,this.size)||this.needPax,this.needPax=So(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this.#e.charCodeAt(0),this.needPax=Tt(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=Tt(e,t+265,32,this.uname)||this.needPax,this.needPax=Tt(e,t+297,32,this.gname)||this.needPax,this.needPax=gt(e,t+329,8,this.devmaj)||this.needPax,this.needPax=gt(e,t+337,8,this.devmin)||this.needPax,this.needPax=Tt(e,t+345,r,o)||this.needPax,e[t+475]===0?(this.needPax=Tt(e,t+345,130,o)||this.needPax,this.needPax=So(e,t+476,12,this.atime)||this.needPax,this.needPax=So(e,t+488,12,this.ctime)||this.needPax):this.needPax=Tt(e,t+345,155,o)||this.needPax;let s=256;for(let a=t;a<t+148;a++)s+=e[a];for(let a=t+156;a<t+512;a++)s+=e[a];return this.cksum=s,gt(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:na.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Uy.get(e));if(wo(t)||t==="Unsupported")this.#e=t;else if(wo(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},zy=(e,t)=>{let r=e,i="",n,o=Jt.parse(e).root||".";if(Buffer.byteLength(r)<100)n=[r,i,!1];else{i=Jt.dirname(r),r=Jt.basename(r);do Buffer.byteLength(r)<=100&&Buffer.byteLength(i)<=t?n=[r,i,!1]:Buffer.byteLength(r)>100&&Buffer.byteLength(i)<=t?n=[r.slice(0,99),i,!0]:(r=Jt.join(Jt.basename(i),r),i=Jt.dirname(i));while(i!==o&&n===void 0);n||=[e.slice(0,99),"",!0]}return n},_t=(e,t,r)=>e.subarray(t,t+r).toString("utf8").replace(/\0.*/,""),vo=(e,t,r)=>Hy(ft(e,t,r)),Hy=e=>e===void 0?void 0:new Date(e*1e3),ft=(e,t,r)=>Number(e[t])&128?By(e.subarray(t,t+r)):Gy(e,t,r),Wy=e=>isNaN(e)?void 0:e,Gy=(e,t,r)=>Wy(parseInt(e.subarray(t,t+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),Vy={12:8589934591,8:2097151},gt=(e,t,r,i)=>i===void 0?!1:i>Vy[r]||i<0?(Iy(i,e.subarray(t,t+r)),!0):(qy(e,t,r,i),!1),qy=(e,t,r,i)=>e.write(Yy(i,r),t,r,"ascii"),Yy=(e,t)=>Ky(Math.floor(e).toString(8),t),Ky=(e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0",So=(e,t,r,i)=>i===void 0?!1:gt(e,t,r,i.getTime()/1e3),Zy=Array(156).join("\0"),Tt=(e,t,r,i)=>i===void 0?!1:(e.write(i+Zy,t,r,"utf8"),i.length!==Buffer.byteLength(i)||i.length>r),Gr=class up{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=r,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let r=Buffer.byteLength(t),i=512*Math.ceil(1+r/512),n=Buffer.allocUnsafe(i);for(let o=0;o<512;o++)n[o]=0;new bt({path:("PaxHeader/"+wy(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(n),n.write(t,512,r,"utf8");for(let o=r+512;o<n.length;o++)n[o]=0;return n}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let r=this[t],i=r instanceof Date?r.getTime()/1e3:r,n=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+i+`
|
|
104
|
+
`,o=Buffer.byteLength(n),s=Math.floor(Math.log(o)/Math.log(10))+1;return o+s>=10**s&&(s+=1),s+o+n}static parse(t,r,i=!1){return new up(Jy(Xy(t),r),i)}},Jy=(e,t)=>t?Object.assign({},t,e):e,Xy=e=>e.replace(/\n$/,"").split(`
|
|
105
|
+
`).reduce(Qy,Object.create(null)),Qy=(e,t)=>{let r=parseInt(t,10);if(r!==Buffer.byteLength(t)+1)return e;t=t.slice((r+" ").length);let i=t.split("="),n=i.shift();if(!n)return e;let o=n.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),s=i.join("=");return e[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,e},S=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?e=>e&&e.replace(/\\/g,"/"):e=>e,sa=class extends Ke{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,r){switch(super({}),this.pause(),this.extended=t,this.globalExtended=r,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw Error("no path provided for tar.ReadEntry");this.path=S(e.path),this.mode=e.mode,this.mode&&(this.mode&=4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?S(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),r&&this.#e(r,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw Error("writing more to entry than is appropriate");let r=this.remain,i=this.blockRemain;return this.remain=Math.max(0,r-t),this.blockRemain=Math.max(0,i-t),this.ignore?!0:r>=t?super.write(e):super.write(e.subarray(0,r))}#e(e,t=!1){e.path&&=S(e.path),e.linkpath&&=S(e.linkpath),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([r,i])=>!(i==null||r==="path"&&t))))}},mn=(e,t,r,i={})=>{e.file&&(i.file=e.file),e.cwd&&(i.cwd=e.cwd),i.code=r instanceof Error&&r.code||t,i.tarCode=t,!e.strict&&i.recoverable!==!1?(r instanceof Error&&(i=Object.assign(r,i),r=r.message),e.emit("warn",t,r,i)):r instanceof Error?e.emit("error",Object.assign(r,i)):e.emit("error",Object.assign(Error(`${t}: ${r}`),i))},Bo=Buffer.from([31,139]),Lo=Buffer.from([40,181,47,253]),e0=Math.max(Bo.length,Lo.length),we=Symbol("state"),Ot=Symbol("writeEntry"),Ze=Symbol("readEntry"),Fo=Symbol("nextEntry"),Il=Symbol("processEntry"),Le=Symbol("extendedHeader"),Pr=Symbol("globalExtendedHeader"),ht=Symbol("meta"),Nl=Symbol("emitMeta"),R=Symbol("buffer"),Je=Symbol("queue"),mt=Symbol("ended"),xo=Symbol("emittedEnd"),Rt=Symbol("emit"),H=Symbol("unzip"),qi=Symbol("consumeChunk"),Yi=Symbol("consumeChunkSub"),ko=Symbol("consumeBody"),jl=Symbol("consumeMeta"),Bl=Symbol("consumeHeader"),Ir=Symbol("consuming"),Ao=Symbol("bufferConcat"),Ki=Symbol("maybeEnd"),Xt=Symbol("writing"),dt=Symbol("aborted"),Zi=Symbol("onDone"),$t=Symbol("sawValidEntry"),Ji=Symbol("sawNullBlock"),Xi=Symbol("sawEOF"),Ll=Symbol("closeStream"),t0=()=>!0,ir=class extends Sy{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Je]=[];[R];[Ze];[Ot];[we]="begin";[ht]="";[Le];[Pr];[mt]=!1;[H];[dt]=!1;[$t];[Ji]=!1;[Xi]=!1;[Xt]=!1;[Ir]=!1;[xo]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Zi,()=>{(this[we]==="begin"||this[$t]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Zi,e.ondone):this.on(Zi,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||1048576,this.filter=typeof e.filter=="function"?e.filter:t0;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let r=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:r?!0:void 0,this.on("end",()=>this[Ll]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,r={}){mn(this,e,t,r)}[Bl](e,t){this[$t]===void 0&&(this[$t]=!1);let r;try{r=new bt(e,t,this[Le],this[Pr])}catch(i){return this.warn("TAR_ENTRY_INVALID",i)}if(r.nullBlock)this[Ji]?(this[Xi]=!0,this[we]==="begin"&&(this[we]="header"),this[Rt]("eof")):(this[Ji]=!0,this[Rt]("nullBlock"));else if(this[Ji]=!1,!r.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:r});else if(!r.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:r});else{let i=r.type;if(/^(Symbolic)?Link$/.test(i)&&!r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:r});else if(!/^(Symbolic)?Link$/.test(i)&&!/^(Global)?ExtendedHeader$/.test(i)&&r.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:r});else{let n=this[Ot]=new sa(r,this[Le],this[Pr]);this[$t]||(n.remain?n.on("end",()=>{n.invalid||(this[$t]=!0)}):this[$t]=!0),n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[Rt]("ignoredEntry",n),this[we]="ignore",n.resume()):n.size>0&&(this[ht]="",n.on("data",o=>this[ht]+=o),this[we]="meta"):(this[Le]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[Rt]("ignoredEntry",n),this[we]=n.remain?"ignore":"header",n.resume()):(n.remain?this[we]="body":(this[we]="header",n.end()),this[Ze]?this[Je].push(n):(this[Je].push(n),this[Fo]())))}}}[Ll](){queueMicrotask(()=>this.emit("close"))}[Il](e){let t=!0;if(!e)this[Ze]=void 0,t=!1;else if(Array.isArray(e)){let[r,...i]=e;this.emit(r,...i)}else this[Ze]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Fo]()),t=!1);return t}[Fo](){do;while(this[Il](this[Je].shift()));if(!this[Je].length){let e=this[Ze];!e||e.flowing||e.size===e.remain?this[Xt]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ko](e,t){let r=this[Ot];if(!r)throw Error("attempt to consume body without entry??");let i=r.blockRemain??0,n=i>=e.length&&t===0?e:e.subarray(t,t+i);return r.write(n),r.blockRemain||(this[we]="header",this[Ot]=void 0,r.end()),n.length}[jl](e,t){let r=this[Ot],i=this[ko](e,t);return!this[Ot]&&r&&this[Nl](r),i}[Rt](e,t,r){!this[Je].length&&!this[Ze]?this.emit(e,t,r):this[Je].push([e,t,r])}[Nl](e){switch(this[Rt]("meta",this[ht]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Le]=Gr.parse(this[ht],this[Le],!1);break;case"GlobalExtendedHeader":this[Pr]=Gr.parse(this[ht],this[Pr],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Le]??Object.create(null);this[Le]=t,t.path=this[ht].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Le]||Object.create(null);this[Le]=t,t.linkpath=this[ht].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[dt]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[dt])return r?.(),!1;if((this[H]===void 0||this.brotli===void 0&&this[H]===!1)&&e){if(this[R]&&(e=Buffer.concat([this[R],e]),this[R]=void 0),e.length<e0)return this[R]=e,r?.(),!0;for(let s=0;this[H]===void 0&&s<Bo.length;s++)e[s]!==Bo[s]&&(this[H]=!1);let n=!1;if(this[H]===!1&&this.zstd!==!1){n=!0;for(let s=0;s<Lo.length;s++)if(e[s]!==Lo[s]){n=!1;break}}let o=this.brotli===void 0&&!n;if(this[H]===!1&&o)if(e.length<512)if(this[mt])this.brotli=!0;else return this[R]=e,r?.(),!0;else try{new bt(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[H]===void 0||this[H]===!1&&(this.brotli||n)){let s=this[mt];this[mt]=!1,this[H]=this[H]===void 0?new xl({}):n?new Rl({}):new _l({}),this[H].on("data",u=>this[qi](u)),this[H].on("error",u=>this.abort(u)),this[H].on("end",()=>{this[mt]=!0,this[qi]()}),this[Xt]=!0;let a=!!this[H][s?"end":"write"](e);return this[Xt]=!1,r?.(),a}}this[Xt]=!0,this[H]?this[H].write(e):this[qi](e),this[Xt]=!1;let i=this[Je].length?!1:this[Ze]?this[Ze].flowing:!0;return!i&&!this[Je].length&&this[Ze]?.once("drain",()=>this.emit("drain")),r?.(),i}[Ao](e){e&&!this[dt]&&(this[R]=this[R]?Buffer.concat([this[R],e]):e)}[Ki](){if(this[mt]&&!this[xo]&&!this[dt]&&!this[Ir]){this[xo]=!0;let e=this[Ot];if(e&&e.blockRemain){let t=this[R]?this[R].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[R]&&e.write(this[R]),e.end()}this[Rt](Zi)}}[qi](e){if(this[Ir]&&e)this[Ao](e);else if(!e&&!this[R])this[Ki]();else if(e){if(this[Ir]=!0,this[R]){this[Ao](e);let t=this[R];this[R]=void 0,this[Yi](t)}else this[Yi](e);for(;this[R]&&this[R]?.length>=512&&!this[dt]&&!this[Xi];){let t=this[R];this[R]=void 0,this[Yi](t)}this[Ir]=!1}(!this[R]||this[mt])&&this[Ki]()}[Yi](e){let t=0,r=e.length;for(;t+512<=r&&!this[dt]&&!this[Xi];)switch(this[we]){case"begin":case"header":this[Bl](e,t),t+=512;break;case"ignore":case"body":t+=this[ko](e,t);break;case"meta":t+=this[jl](e,t);break;default:throw Error("invalid state: "+this[we])}t<r&&(this[R]?this[R]=Buffer.concat([e.subarray(t),this[R]]):this[R]=e.subarray(t))}end(e,t,r){return typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),r&&this.once("finish",r),this[dt]||(this[H]?(e&&this[H].write(e),this[H].end()):(this[mt]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[Ki]())),this}},Lr=e=>{let t=e.length-1,r=-1;for(;t>-1&&e.charAt(t)==="/";)r=t,t--;return r===-1?e:e.slice(0,r)},r0=e=>{let t=e.onReadEntry;e.onReadEntry=t?r=>{t(r),r.resume()}:r=>r.resume()},oa=(e,t)=>{let r=new Map(t.map(o=>[Lr(o),!0])),i=e.filter,n=(o,s="")=>{let a=s||xy(o).root||".",u;if(o===a)u=!1;else{let c=r.get(o);u=c===void 0?n(Fy(o),a):c}return r.set(o,u),u};e.filter=i?(o,s)=>i(o,s)&&n(Lr(o)):o=>n(Lr(o))},qr=Vr(e=>{let t=new ir(e),r=e.file,i;try{i=b.openSync(r,"r");let n=b.fstatSync(i),o=e.maxReadSize||16*1024*1024;if(n.size<o){let s=Buffer.allocUnsafe(n.size),a=b.readSync(i,s,0,n.size,0);t.end(a===s.byteLength?s:s.subarray(0,a))}else{let s=0,a=Buffer.allocUnsafe(o);for(;s<n.size;){let u=b.readSync(i,a,0,o,s);if(u===0)break;s+=u,t.write(a.subarray(0,u))}t.end()}}finally{if(typeof i=="number")try{b.closeSync(i)}catch{}}},(e,t)=>{let r=new ir(e),i=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("end",o),b.stat(n,(a,u)=>{if(a)s(a);else{let c=new Hi(n,{readSize:i,size:u.size});c.on("error",s),c.pipe(r)}})})},e=>new ir(e),e=>new ir(e),(e,t)=>{t?.length&&oa(e,t),e.noResume||r0(e)}),cp=(e,t,r)=>(e&=4095,r&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),{isAbsolute:i0,parse:Ml}=vy,aa=e=>{let t="",r=Ml(e);for(;i0(e)||r.root;){let i=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":r.root;e=e.slice(i.length),t+=i,r=Ml(e)}return[t,e]},dn=["|","<",">","?",":"],ua=dn.map(e=>String.fromCharCode(61440+e.charCodeAt(0))),n0=new Map(dn.map((e,t)=>[e,ua[t]])),s0=new Map(ua.map((e,t)=>[e,dn[t]])),Ul=e=>dn.reduce((t,r)=>t.split(r).join(n0.get(r)),e),o0=e=>ua.reduce((t,r)=>t.split(r).join(s0.get(r)),e),lp=(e,t)=>t?(e=S(e).replace(/^\.(\/|$)/,""),Lr(t)+"/"+e):S(e),zl=Symbol("process"),Hl=Symbol("file"),Wl=Symbol("directory"),Mo=Symbol("symlink"),Gl=Symbol("hardlink"),Nr=Symbol("header"),tn=Symbol("read"),Uo=Symbol("lstat"),rn=Symbol("onlstat"),zo=Symbol("onread"),Ho=Symbol("onreadlink"),Wo=Symbol("openfile"),Go=Symbol("onopenfile"),Dt=Symbol("close"),pn=Symbol("mode"),Vo=Symbol("awaitDrain"),_o=Symbol("ondrain"),Me=Symbol("prefix"),ca=class extends Ke{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let r=ia(t);super(),this.path=S(e),this.portable=!!r.portable,this.maxReadSize=r.maxReadSize||16777216,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=S(r.cwd||process.cwd()),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime,this.prefix=r.prefix?S(r.prefix):void 0,this.onWriteEntry=r.onWriteEntry,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let i=!1;if(!this.preservePaths){let[o,s]=aa(this.path);o&&typeof s=="string"&&(this.path=s,i=o)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=o0(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=S(r.absolute||ln.resolve(this.cwd,e)),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path});let n=this.statCache.get(this.absolute);n?this[rn](n):this[Uo]()}warn(e,t,r={}){return mn(this,e,t,r)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Uo](){ie.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[rn](t)})}[rn](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=a0(e),this.emit("stat",e),this[zl]()}[zl](){switch(this.type){case"File":return this[Hl]();case"Directory":return this[Wl]();case"SymbolicLink":return this[Mo]();default:return this.end()}}[pn](e){return cp(e,this.type==="Directory",this.portable)}[Me](e){return lp(e,this.prefix)}[Nr](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new bt({path:this[Me](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Me](this.linkpath):this.linkpath,mode:this[pn](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Gr({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Me](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Me](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw Error("failed to encode header");super.write(e)}[Wl](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Nr](),this.end()}[Mo](){ie.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Ho](t)})}[Ho](e){this.linkpath=S(e),this[Nr](),this.end()}[Gl](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=S(ln.relative(this.cwd,e)),this.stat.size=0,this[Nr](),this.end()}[Hl](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[Gl](t);this.linkCache.set(e,this.absolute)}if(this[Nr](),this.stat.size===0)return this.end();this[Wo]()}[Wo](){ie.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Go](t)})}[Go](e){if(this.fd=e,this.#e)return this[Dt]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[tn]()}[tn](){let{fd:e,buf:t,offset:r,length:i,pos:n}=this;if(e===void 0||t===void 0)throw Error("cannot read file without first opening");ie.read(e,t,r,i,n,(o,s)=>{if(o)return this[Dt](()=>this.emit("error",o));this[zo](s)})}[Dt](e=()=>{}){this.fd!==void 0&&ie.close(this.fd,e)}[zo](e){if(e<=0&&this.remain>0){let r=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Dt](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Dt](()=>this.emit("error",r))}if(!this.buf)throw Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[_o]():this[Vo](()=>this[_o]())}[Vo](e){this.once("drain",e)}write(e,t,r){if(typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let i=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",i)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,r)}[_o](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Dt](e=>e?this.emit("error",e):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[tn]()}},pp=class extends ca{sync=!0;[Uo](){this[rn](ie.lstatSync(this.absolute))}[Mo](){this[Ho](ie.readlinkSync(this.absolute))}[Wo](){this[Go](ie.openSync(this.absolute,"r"))}[tn](){let e=!0;try{let{fd:t,buf:r,offset:i,length:n,pos:o}=this;if(t===void 0||r===void 0)throw Error("fd and buf must be set in READ method");let s=ie.readSync(t,r,i,n,o);this[zo](s),e=!1}finally{if(e)try{this[Dt](()=>{})}catch{}}}[Vo](e){e()}[Dt](e=()=>{}){this.fd!==void 0&&ie.closeSync(this.fd),e()}},hp=class extends Ke{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,r={}){return mn(this,e,t,r)}constructor(e,t={}){let r=ia(t);super(),this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.onWriteEntry=r.onWriteEntry,this.readEntry=e;let{type:i}=e;if(i==="Unsupported")throw Error("writing entry that should be ignored");this.type=i,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=r.prefix,this.path=S(e.path),this.mode=e.mode===void 0?void 0:this[pn](e.mode),this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:r.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath===void 0?void 0:S(e.linkpath),typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let n=!1;if(!this.preservePaths){let[s,a]=aa(this.path);s&&typeof a=="string"&&(this.path=a,n=s)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new bt({path:this[Me](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Me](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),n&&this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path}),this.header.encode()&&!this.noPax&&super.write(new Gr({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Me](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Me](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let o=this.header?.block;if(!o)throw Error("failed to encode header");super.write(o),e.pipe(this)}[Me](e){return lp(e,this.prefix)}[pn](e){return cp(e,this.type==="Directory",this.portable)}write(e,t,r){typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let i=e.length;if(i>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=i,super.write(e,r)}end(e,t,r){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(r=e,t=void 0,e=void 0),typeof t=="function"&&(r=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),r&&this.once("finish",r),e?super.end(e,r):super.end(r),this}},a0=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",u0=class tr{tail;head;length=0;static create(t=[]){return new tr(t)}constructor(t=[]){for(let r of t)this.push(r)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let r=t.next,i=t.prev;return r&&(r.prev=i),i&&(i.next=r),t===this.head&&(this.head=r),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,r}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let r=this.head;t.list=this,t.next=r,r&&(r.prev=t),this.head=t,this.tail||=t,this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let r=this.tail;t.list=this,t.prev=r,r&&(r.next=t),this.tail=t,this.head||=t,this.length++}push(...t){for(let r=0,i=t.length;r<i;r++)l0(this,t[r]);return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++)p0(this,t[r]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,r=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,r.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,r=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,r.list=void 0,this.length--,t}forEach(t,r){r||=this;for(let i=this.head,n=0;i;n++)t.call(r,i.value,n,this),i=i.next}forEachReverse(t,r){r||=this;for(let i=this.tail,n=this.length-1;i;n--)t.call(r,i.value,n,this),i=i.prev}get(t){let r=0,i=this.head;for(;i&&r<t;r++)i=i.next;if(r===t&&i)return i.value}getReverse(t){let r=0,i=this.tail;for(;i&&r<t;r++)i=i.prev;if(r===t&&i)return i.value}map(t,r){r||=this;let i=new tr;for(let n=this.head;n;)i.push(t.call(r,n.value,this)),n=n.next;return i}mapReverse(t,r){r||=this;var i=new tr;for(let n=this.tail;n;)i.push(t.call(r,n.value,this)),n=n.prev;return i}reduce(t,r){let i,n=this.head;if(arguments.length>1)i=r;else if(this.head)n=this.head.next,i=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var o=0;n;o++)i=t(i,n.value,o),n=n.next;return i}reduceReverse(t,r){let i,n=this.tail;if(arguments.length>1)i=r;else if(this.tail)n=this.tail.prev,i=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;n;o--)i=t(i,n.value,o),n=n.prev;return i}toArray(){let t=Array(this.length);for(let r=0,i=this.head;i;r++)t[r]=i.value,i=i.next;return t}toArrayReverse(){let t=Array(this.length);for(let r=0,i=this.tail;i;r++)t[r]=i.value,i=i.prev;return t}slice(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let i=new tr;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);let n=this.head,o=0;for(o=0;n&&o<t;o++)n=n.next;for(;n&&o<r;o++,n=n.next)i.push(n.value);return i}sliceReverse(t=0,r=this.length){r<0&&(r+=this.length),t<0&&(t+=this.length);let i=new tr;if(r<t||r<0)return i;t<0&&(t=0),r>this.length&&(r=this.length);let n=this.length,o=this.tail;for(;o&&n>r;n--)o=o.prev;for(;o&&n>t;n--,o=o.prev)i.push(o.value);return i}splice(t,r=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let n=this.head;for(let s=0;n&&s<t;s++)n=n.next;let o=[];for(let s=0;n&&s<r;s++)o.push(n.value),n=this.removeNode(n);n?n!==this.tail&&(n=n.prev):n=this.tail;for(let s of i)n=c0(this,n,s);return o}reverse(){let t=this.head,r=this.tail;for(let i=t;i;i=i.prev){let n=i.prev;i.prev=i.next,i.next=n}return this.head=r,this.tail=t,this}};la=class{list;next;prev;value;constructor(e,t,r,i){this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,r?(r.prev=this,this.next=r):this.next=void 0}},qo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},Vl=Buffer.alloc(1024),nn=Symbol("onStat"),jr=Symbol("ended"),Oe=Symbol("queue"),Pt=Symbol("current"),It=Symbol("process"),Br=Symbol("processing"),To=Symbol("processJob"),Re=Symbol("jobs"),Oo=Symbol("jobDone"),sn=Symbol("addFSEntry"),ql=Symbol("addTarEntry"),Yo=Symbol("stat"),Ko=Symbol("readdir"),on=Symbol("onreaddir"),an=Symbol("pipe"),Yl=Symbol("entry"),Ro=Symbol("entryOpt"),un=Symbol("writeEntryClass"),mp=Symbol("write"),$o=Symbol("ondrain"),Yr=class extends Ke{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[un];onWriteEntry;[Oe];[Re]=0;[Br]=!1;[jr]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=S(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[un]=ca,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Fl(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Al(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Ol(e.zstd)),!this.zip)throw Error("impossible");let t=this.zip;t.on("data",r=>super.write(r)),t.on("end",()=>super.end()),t.on("drain",()=>this[$o]()),this.on("resume",()=>t.resume())}else this.on("drain",this[$o]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[Oe]=new u0,this[Re]=0,this.jobs=Number(e.jobs)||4,this[Br]=!1,this[jr]=!1}[mp](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,r){return typeof e=="function"&&(r=e,e=void 0),typeof t=="function"&&(r=t,t=void 0),e&&this.add(e),this[jr]=!0,this[It](),r&&r(),this}write(e){if(this[jr])throw Error("write after end");return e instanceof sa?this[ql](e):this[sn](e),this.flowing}[ql](e){let t=S(ln.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let r=new qo(e.path,t);r.entry=new hp(e,this[Ro](r)),r.entry.on("end",()=>this[Oo](r)),this[Re]+=1,this[Oe].push(r)}this[It]()}[sn](e){let t=S(ln.resolve(this.cwd,e));this[Oe].push(new qo(e,t)),this[It]()}[Yo](e){e.pending=!0,this[Re]+=1,ie[this.follow?"stat":"lstat"](e.absolute,(t,r)=>{e.pending=!1,--this[Re],t?this.emit("error",t):this[nn](e,r)})}[nn](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[Pt]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[To](e):e.ignore=!0,this[It]()}[Ko](e){e.pending=!0,this[Re]+=1,ie.readdir(e.absolute,(t,r)=>{if(e.pending=!1,--this[Re],t)return this.emit("error",t);this[on](e,r)})}[on](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[It]()}[It](){if(!this[Br]){this[Br]=!0;for(let e=this[Oe].head;e&&this[Re]<this.jobs;e=e.next)if(this[To](e.value),e.value.ignore){let t=e.next;this[Oe].removeNode(e),e.next=t}this[Br]=!1,this[jr]&&!this[Oe].length&&this[Re]===0&&(this.zip?this.zip.end(Vl):(super.write(Vl),super.end()))}}get[Pt](){return this[Oe]&&this[Oe].head&&this[Oe].head.value}[Oo](e){this[Oe].shift(),--this[Re],this[It]()}[To](e){if(!e.pending){if(e.entry){e===this[Pt]&&!e.piped&&this[an](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[nn](e,t):this[Yo](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[on](e,t):this[Ko](e),!e.readdir)return}if(e.entry=this[Yl](e),!e.entry){e.ignore=!0;return}e===this[Pt]&&!e.piped&&this[an](e)}}}[Ro](e){return{onwarn:(t,r,i)=>this.warn(t,r,i),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Yl](e){this[Re]+=1;try{return new this[un](e.path,this[Ro](e)).on("end",()=>this[Oo](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[$o](){this[Pt]&&this[Pt].entry&&this[Pt].entry.resume()}[an](e){e.piped=!0,e.readdir&&e.readdir.forEach(i=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[sn](o+i)});let t=e.entry,r=this.zip;if(!t)throw Error("cannot pipe without source");r?t.on("data",i=>{r.write(i)||t.pause()}):t.on("data",i=>{super.write(i)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,r={}){mn(this,e,t,r)}},fn=class extends Yr{sync=!0;constructor(e){super(e),this[un]=pp}pause(){}resume(){}[Yo](e){let t=this.follow?"statSync":"lstatSync";this[nn](e,ie[t](e.absolute))}[Ko](e){this[on](e,ie.readdirSync(e.absolute))}[an](e){let t=e.entry,r=this.zip;if(e.readdir&&e.readdir.forEach(i=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[sn](o+i)}),!t)throw Error("Cannot pipe without source");r?t.on("data",i=>{r.write(i)}):t.on("data",i=>{super[mp](i)})}},h0=(e,t)=>{let r=new fn(e),i=new ho(e.file,{mode:e.mode||438});r.pipe(i),dp(r,t)},m0=(e,t)=>{let r=new Yr(e),i=new Rr(e.file,{mode:e.mode||438});r.pipe(i);let n=new Promise((o,s)=>{i.on("error",s),i.on("close",o),r.on("error",s)});return fp(r,t),n},dp=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?qr({file:W.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>e.add(i)}):e.add(r)}),e.end()},fp=async(e,t)=>{for(let r=0;r<t.length;r++){let i=String(t[r]);i.charAt(0)==="@"?await qr({file:W.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:n=>{e.add(n)}}):e.add(i)}e.end()};Vr(h0,m0,(e,t)=>{let r=new fn(e);return dp(r,t),r},(e,t)=>{let r=new Yr(e);return fp(r,t),r},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")});d0=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:f0,O_TRUNC:g0,O_WRONLY:D0}=ie.constants,gp=Number(process.env.__FAKE_FS_O_FILENAME__)||ie.constants.UV_FS_O_FILEMAP||0,y0=d0&&!!gp,b0=gp|g0|f0|D0,Dp=y0?e=>e<524288?b0:"w":()=>"w",yp=class extends Error{path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},bp=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},C0=(e,t)=>{b.stat(e,(r,i)=>{(r||!i.isDirectory())&&(r=new yp(e,r?.code||"ENOTDIR")),t(r)})},E0=(e,t,r)=>{e=S(e);let i=t.umask??18,n=t.mode|448,o=(n&i)!==0,s=t.uid,a=t.gid,u=typeof s=="number"&&typeof a=="number"&&(s!==t.processUid||a!==t.processGid),c=t.preserve,l=t.unlink,p=S(t.cwd),h=(d,g)=>{d?r(d):g&&u?Co(g,s,a,y=>h(y)):o?b.chmod(e,n,r):r()};if(e===p)return C0(e,h);if(c)return Ey.mkdir(e,{mode:n,recursive:!0}).then(d=>h(null,d??void 0),h);Zo(p,S(W.relative(p,e)).split("/"),n,l,p,void 0,h)},Zo=(e,t,r,i,n,o,s)=>{if(!t.length)return s(null,o);let a=t.shift(),u=S(W.resolve(e+"/"+a));b.mkdir(u,r,Cp(u,t,r,i,n,o,s))},Cp=(e,t,r,i,n,o,s)=>a=>{a?b.lstat(e,(u,c)=>{if(u)u.path=u.path&&S(u.path),s(u);else if(c.isDirectory())Zo(e,t,r,i,n,o,s);else if(i)b.unlink(e,l=>{if(l)return s(l);b.mkdir(e,r,Cp(e,t,r,i,n,o,s))});else{if(c.isSymbolicLink())return s(new bp(e,e+"/"+t.join("/")));s(a)}}):(o||=e,Zo(e,t,r,i,n,o,s))},w0=e=>{let t=!1,r;try{t=b.statSync(e).isDirectory()}catch(i){r=i?.code}finally{if(!t)throw new yp(e,r??"ENOTDIR")}},v0=(e,t)=>{e=S(e);let r=t.umask??18,i=t.mode|448,n=(i&r)!==0,o=t.uid,s=t.gid,a=typeof o=="number"&&typeof s=="number"&&(o!==t.processUid||s!==t.processGid),u=t.preserve,c=t.unlink,l=S(t.cwd),p=g=>{g&&a&&Eo(g,o,s),n&&b.chmodSync(e,i)};if(e===l)return w0(l),p();if(u)return p(b.mkdirSync(e,{mode:i,recursive:!0})??void 0);let h=S(W.relative(l,e)).split("/"),d;for(let g=h.shift(),y=l;g&&(y+="/"+g);g=h.shift()){y=S(W.resolve(y));try{b.mkdirSync(y,i),d||=y}catch{let v=b.lstatSync(y);if(v.isDirectory())continue;if(c){b.unlinkSync(y),b.mkdirSync(y,i),d||=y;continue}else if(v.isSymbolicLink())return new bp(y,y+"/"+h.join("/"))}}return p(d)},Po=Object.create(null),Kl=1e4,Qt=new Set,S0=e=>{Qt.has(e)?Qt.delete(e):Po[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Qt.add(e);let t=Po[e],r=Qt.size-Kl;if(r>Kl/10){for(let i of Qt)if(Qt.delete(i),delete Po[i],--r<=0)break}return t},F0=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",x0=e=>e.split("/").slice(0,-1).reduce((t,r)=>{let i=t[t.length-1];return i!==void 0&&(r=np(i,r)),t.push(r||"/"),t},[]),k0=class{#e=new Map;#i=new Map;#t=new Set;reserve(e,t){e=F0?["win32 parallelization disabled"]:e.map(i=>Lr(np(S0(i))));let r=new Set(e.map(i=>x0(i)).reduce((i,n)=>i.concat(n)));this.#i.set(t,{dirs:r,paths:e});for(let i of e){let n=this.#e.get(i);n?n.push(t):this.#e.set(i,[t])}for(let i of r){let n=this.#e.get(i);if(!n)this.#e.set(i,[new Set([t])]);else{let o=n[n.length-1];o instanceof Set?o.add(t):n.push(new Set([t]))}}return this.#s(t)}#o(e){let t=this.#i.get(e);if(!t)throw Error("function does not have any path reservations");return{paths:t.paths.map(r=>this.#e.get(r)),dirs:[...t.dirs].map(r=>this.#e.get(r))}}check(e){let{paths:t,dirs:r}=this.#o(e);return t.every(i=>i&&i[0]===e)&&r.every(i=>i&&i[0]instanceof Set&&i[0].has(e))}#s(e){return this.#t.has(e)||!this.check(e)?!1:(this.#t.add(e),e(()=>this.#r(e)),!0)}#r(e){if(!this.#t.has(e))return!1;let t=this.#i.get(e);if(!t)throw Error("invalid reservation");let{paths:r,dirs:i}=t,n=new Set;for(let o of r){let s=this.#e.get(o);if(!s||s?.[0]!==e)continue;let a=s[1];if(!a){this.#e.delete(o);continue}if(s.shift(),typeof a=="function")n.add(a);else for(let u of a)n.add(u)}for(let o of i){let s=this.#e.get(o),a=s?.[0];if(!(!s||!(a instanceof Set)))if(a.size===1&&s.length===1){this.#e.delete(o);continue}else if(a.size===1){s.shift();let u=s[0];typeof u=="function"&&n.add(u)}else a.delete(e)}return this.#t.delete(e),n.forEach(o=>this.#s(o)),!0}},Zl=Symbol("onEntry"),Jo=Symbol("checkFs"),Jl=Symbol("checkFs2"),Xo=Symbol("isReusable"),ve=Symbol("makeFs"),Qo=Symbol("file"),ea=Symbol("directory"),cn=Symbol("link"),Xl=Symbol("symlink"),Ql=Symbol("hardlink"),ep=Symbol("unsupported"),tp=Symbol("checkPath"),Io=Symbol("stripAbsolutePath"),yt=Symbol("mkdir"),re=Symbol("onError"),Qi=Symbol("pending"),rp=Symbol("pend"),er=Symbol("unpend"),No=Symbol("ended"),jo=Symbol("maybeClose"),ta=Symbol("skip"),Mr=Symbol("doChown"),Ur=Symbol("uid"),zr=Symbol("gid"),Hr=Symbol("checkedCwd"),Wr=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",A0=(e,t)=>{if(!Wr)return b.unlink(e,t);let r=e+".DELETE."+sp(16).toString("hex");b.rename(e,r,i=>{if(i)return t(i);b.unlink(r,t)})},_0=e=>{if(!Wr)return b.unlinkSync(e);let t=e+".DELETE."+sp(16).toString("hex");b.renameSync(e,t),b.unlinkSync(t)},ip=(e,t,r)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:r,hn=class extends ir{[No]=!1;[Hr]=!1;[Qi]=0;reservations=new k0;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[No]=!0,this[jo]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1024,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Wr,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=S(W.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Zl](t))}warn(e,t,r={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(r.recoverable=!1),super.warn(e,t,r)}[jo](){this[No]&&this[Qi]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Io](e,t){let r=e[t];if(!r||this.preservePaths)return!0;let i=r.split("/");if(i.includes("..")||Wr&&/^[a-z]:\.\.$/i.test(i[0]??"")){if(t==="path")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:r}),!1;{let s=W.posix.dirname(e.path),a=W.posix.normalize(W.posix.join(s,r));if(a.startsWith("../")||a==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:r}),!1}}let[n,o]=aa(r);return n&&(e[t]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:r})),!0}[tp](e){let t=S(e.path),r=t.split("/");if(this.strip){if(r.length<this.strip)return!1;if(e.type==="Link"){let i=S(String(e.linkpath)).split("/");if(i.length>=this.strip)e.linkpath=i.slice(this.strip).join("/");else return!1}r.splice(0,this.strip),e.path=r.join("/")}if(isFinite(this.maxDepth)&&r.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:r.length,maxDepth:this.maxDepth}),!1;if(!this[Io](e,"path")||!this[Io](e,"linkpath"))return!1;if(W.isAbsolute(e.path)?e.absolute=S(W.resolve(e.path)):e.absolute=S(W.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:S(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:i}=W.win32.parse(String(e.absolute));e.absolute=i+Ul(String(e.absolute).slice(i.length));let{root:n}=W.win32.parse(e.path);e.path=n+Ul(e.path.slice(n.length))}return!0}[Zl](e){if(!this[tp](e))return e.resume();switch(ky.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Jo](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[ep](e)}}[re](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[er](),t.resume())}[yt](e,t,r){E0(S(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},r)}[Mr](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[Ur](e){return ip(this.uid,e.uid,this.processUid)}[zr](e){return ip(this.gid,e.gid,this.processGid)}[Qo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,i=new Rr(String(e.absolute),{flags:Dp(e.size),mode:r,autoClose:!1});i.on("error",a=>{i.fd&&b.close(i.fd,()=>{}),i.write=()=>!0,this[re](a,e),t()});let n=1,o=a=>{if(a){i.fd&&b.close(i.fd,()=>{}),this[re](a,e),t();return}--n===0&&i.fd!==void 0&&b.close(i.fd,u=>{u?this[re](u,e):this[er](),t()})};i.on("finish",()=>{let a=String(e.absolute),u=i.fd;if(typeof u=="number"&&e.mtime&&!this.noMtime){n++;let c=e.atime||new Date,l=e.mtime;b.futimes(u,c,l,p=>p?b.utimes(a,c,l,h=>o(h&&p)):o())}if(typeof u=="number"&&this[Mr](e)){n++;let c=this[Ur](e),l=this[zr](e);typeof c=="number"&&typeof l=="number"&&b.fchown(u,c,l,p=>p?b.chown(a,c,l,h=>o(h&&p)):o())}o()});let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",a=>{this[re](a,e),t()}),e.pipe(s)),s.pipe(i)}[ea](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode;this[yt](String(e.absolute),r,i=>{if(i){this[re](i,e),t();return}let n=1,o=()=>{--n===0&&(t(),this[er](),e.resume())};e.mtime&&!this.noMtime&&(n++,b.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[Mr](e)&&(n++,b.chown(String(e.absolute),Number(this[Ur](e)),Number(this[zr](e)),o)),o()})}[ep](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Xl](e,t){this[cn](e,String(e.linkpath),"symlink",t)}[Ql](e,t){let r=S(W.resolve(this.cwd,String(e.linkpath)));this[cn](e,r,"link",t)}[rp](){this[Qi]++}[er](){this[Qi]--,this[jo]()}[ta](e){this[er](),e.resume()}[Xo](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!Wr}[Jo](e){this[rp]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,r=>this[Jl](e,r))}[Jl](e,t){let r=s=>{t(s)},i=()=>{this[yt](this.cwd,this.dmode,s=>{if(s){this[re](s,e),r();return}this[Hr]=!0,n()})},n=()=>{if(e.absolute!==this.cwd){let s=S(W.dirname(String(e.absolute)));if(s!==this.cwd)return this[yt](s,this.dmode,a=>{if(a){this[re](a,e),r();return}o()})}o()},o=()=>{b.lstat(String(e.absolute),(s,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[ta](e),r();return}if(s||this[Xo](e,a))return this[ve](null,e,r);if(a.isDirectory()){if(e.type==="Directory"){let u=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,c=l=>this[ve](l??null,e,r);return u?b.chmod(String(e.absolute),Number(e.mode),c):c()}if(e.absolute!==this.cwd)return b.rmdir(String(e.absolute),u=>this[ve](u??null,e,r))}if(e.absolute===this.cwd)return this[ve](null,e,r);A0(String(e.absolute),u=>this[ve](u??null,e,r))})};this[Hr]?n():i()}[ve](e,t,r){if(e){this[re](e,t),r();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Qo](t,r);case"Link":return this[Ql](t,r);case"SymbolicLink":return this[Xl](t,r);case"Directory":case"GNUDumpDir":return this[ea](t,r)}}[cn](e,t,r,i){b[r](t,String(e.absolute),n=>{n?this[re](n,e):(this[er](),e.resume()),i()})}},en=e=>{try{return[null,e()]}catch(t){return[t,null]}},ra=class extends hn{sync=!0;[ve](e,t){return super[ve](e,t,()=>{})}[Jo](e){if(!this[Hr]){let n=this[yt](this.cwd,this.dmode);if(n)return this[re](n,e);this[Hr]=!0}if(e.absolute!==this.cwd){let n=S(W.dirname(String(e.absolute)));if(n!==this.cwd){let o=this[yt](n,this.dmode);if(o)return this[re](o,e)}}let[t,r]=en(()=>b.lstatSync(String(e.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(e.mtime??r.mtime)))return this[ta](e);if(t||this[Xo](e,r))return this[ve](null,e);if(r.isDirectory()){if(e.type==="Directory"){let[o]=this.chmod&&e.mode&&(r.mode&4095)!==e.mode?en(()=>{b.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[ve](o,e)}let[n]=en(()=>b.rmdirSync(String(e.absolute)));this[ve](n,e)}let[i]=e.absolute===this.cwd?[]:en(()=>_0(String(e.absolute)));this[ve](i,e)}[Qo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,i=s=>{let a;try{b.closeSync(n)}catch(u){a=u}(s||a)&&this[re](s||a,e),t()},n;try{n=b.openSync(String(e.absolute),Dp(e.size),r)}catch(s){return i(s)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",s=>this[re](s,e)),e.pipe(o)),o.on("data",s=>{try{b.writeSync(n,s,0,s.length)}catch(a){i(a)}}),o.on("end",()=>{let s=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,u=e.mtime;try{b.futimesSync(n,a,u)}catch(c){try{b.utimesSync(String(e.absolute),a,u)}catch{s=c}}}if(this[Mr](e)){let a=this[Ur](e),u=this[zr](e);try{b.fchownSync(n,Number(a),Number(u))}catch(c){try{b.chownSync(String(e.absolute),Number(a),Number(u))}catch{s||=c}}}i(s)})}[ea](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode,i=this[yt](String(e.absolute),r);if(i){this[re](i,e),t();return}if(e.mtime&&!this.noMtime)try{b.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Mr](e))try{b.chownSync(String(e.absolute),Number(this[Ur](e)),Number(this[zr](e)))}catch{}t(),e.resume()}[yt](e,t){try{return v0(S(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(r){return r}}[cn](e,t,r,i){let n=`${r}Sync`;try{b[n](t,String(e.absolute)),i(),e.resume()}catch(o){return this[re](o,e)}}},T0=Vr(e=>{let t=new ra(e),r=e.file,i=b.statSync(r);new El(r,{readSize:e.maxReadSize||16*1024*1024,size:i.size}).pipe(t)},(e,t)=>{let r=new hn(e),i=e.maxReadSize||16*1024*1024,n=e.file;return new Promise((o,s)=>{r.on("error",s),r.on("close",o),b.stat(n,(a,u)=>{if(a)s(a);else{let c=new Hi(n,{readSize:i,size:u.size});c.on("error",s),c.pipe(r)}})})},e=>new ra(e),e=>new hn(e),(e,t)=>{t?.length&&oa(e,t)}),O0=(e,t)=>{let r=new fn(e),i=!0,n,o;try{try{n=b.openSync(e.file,"r+")}catch(u){if(u?.code==="ENOENT")n=b.openSync(e.file,"w+");else throw u}let s=b.fstatSync(n),a=Buffer.alloc(512);e:for(o=0;o<s.size;o+=512){for(let l=0,p=0;l<512;l+=p){if(p=b.readSync(n,a,l,a.length-l,o+l),o===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!p)break e}let u=new bt(a);if(!u.cksumValid)break;let c=512*Math.ceil((u.size||0)/512);if(o+c+512>s.size)break;o+=c,e.mtimeCache&&u.mtime&&e.mtimeCache.set(String(u.path),u.mtime)}i=!1,R0(e,r,o,n,t)}finally{if(i)try{b.closeSync(n)}catch{}}},R0=(e,t,r,i,n)=>{let o=new ho(e.file,{fd:i,start:r});t.pipe(o),P0(t,n)},$0=(e,t)=>{t=Array.from(t);let r=new Yr(e),i=(n,o,s)=>{let a=(h,d)=>{h?b.close(n,g=>s(h)):s(null,d)},u=0;if(o===0)return a(null,0);let c=0,l=Buffer.alloc(512),p=(h,d)=>{if(h||d===void 0)return a(h);if(c+=d,c<512&&d)return b.read(n,l,c,l.length-c,u+c,p);if(u===0&&l[0]===31&&l[1]===139)return a(Error("cannot append to compressed archives"));if(c<512)return a(null,u);let g=new bt(l);if(!g.cksumValid)return a(null,u);let y=512*Math.ceil((g.size??0)/512);if(u+y+512>o||(u+=y+512,u>=o))return a(null,u);e.mtimeCache&&g.mtime&&e.mtimeCache.set(String(g.path),g.mtime),c=0,b.read(n,l,0,512,u,p)};b.read(n,l,0,512,u,p)};return new Promise((n,o)=>{r.on("error",o);let s="r+",a=(u,c)=>{if(u&&u.code==="ENOENT"&&s==="r+")return s="w+",b.open(e.file,s,a);if(u||!c)return o(u);b.fstat(c,(l,p)=>{if(l)return b.close(c,()=>o(l));i(c,p.size,(h,d)=>{if(h)return o(h);let g=new Rr(e.file,{fd:c,start:d});r.pipe(g),g.on("error",o),g.on("close",n),I0(r,t)})})};b.open(e.file,s,a)})},P0=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?qr({file:W.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>e.add(i)}):e.add(r)}),e.end()},I0=async(e,t)=>{for(let r=0;r<t.length;r++){let i=String(t[r]);i.charAt(0)==="@"?await qr({file:W.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:n=>e.add(n)}):e.add(i)}e.end()},rr=Vr(O0,$0,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!$y(e))throw TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!t?.length)throw TypeError("no paths specified to add/replace")});Vr(rr.syncFile,rr.asyncFile,rr.syncNoFile,rr.asyncNoFile,(e,t=[])=>{rr.validate?.(e,t),N0(e)});N0=e=>{let t=e.filter;e.mtimeCache||=new Map,e.filter=t?(r,i)=>t(r,i)&&!((e.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0)):(r,i)=>!((e.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0))},j0=$i({Header:()=>bt,Pack:()=>Yr,PackJob:()=>qo,PackSync:()=>fn,Parser:()=>ir,Pax:()=>Gr,ReadEntry:()=>sa,Unpack:()=>hn,UnpackSync:()=>ra,WriteEntry:()=>ca,WriteEntrySync:()=>pp,WriteEntryTar:()=>hp,extract:()=>T0,filesFilter:()=>oa,list:()=>qr,replace:()=>rr})});import{mkdir as vp,readFile as B0,rm as L0,writeFile as M0}from"node:fs/promises";import{createWriteStream as U0,existsSync as Nt,readdirSync as z0,renameSync as H0}from"node:fs";import{pipeline as W0}from"node:stream";import{homedir as G0,tmpdir as V0}from"node:os";import{promisify as q0}from"node:util";async function Y0(e,t,r={}){let i=t+".json",n=JSON.parse(await B0(i,"utf8").catch(()=>"{}")),o=(await Kr(e,{method:"HEAD",headers:r.headers}).catch(()=>{}))?.headers.get("etag");if(n.etag===o&&Nt(t))return;typeof o=="string"&&(n.etag=o);let s=await Kr(e,{headers:r.headers});if(s.status>=400)throw new Error(`Failed to download ${e}: ${s.status} ${s.statusText}`);let a=U0(t);await q0(W0)(s.body,a),await M0(i,JSON.stringify(n),"utf8")}function gn(e){let t=e.match(K0)?.groups||{};return{repo:t.repo||"",subdir:t.subdir||"/",ref:t.ref?t.ref.slice(1):"main"}}function nr(...e){process.env.DEBUG&&console.debug("[giget]",...e)}async function Kr(e,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);let r=await fetch(e,{...t,headers:kp(t.headers)}).catch(i=>{throw new Error(`Failed to download ${e}: ${i}`,{cause:i})});if(t.validateStatus&&r.status>=400)throw new Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`);return r}function Z0(){let e=process.env.XDG_CACHE_HOME?he(process.env.XDG_CACHE_HOME,"giget"):he(G0(),".cache/giget");if(process.platform==="win32"){let t=he(V0(),"giget");if(!Nt(t)&&Nt(e))try{H0(e,t)}catch{}return t}return e}function kp(e={}){let t={};for(let[r,i]of Object.entries(e))i&&(t[r.toLowerCase()]=i);return t}async function pa(e,t={}){t.registry=process.env.GIGET_REGISTRY??t.registry,t.auth=process.env.GIGET_AUTH??t.auth;let r=t.registry===!1?void 0:Ap(t.registry,{auth:t.auth}),i=t.provider||(r?"registry":"github"),n=e,o=e.match(rb);o&&(i=o[1],n=e.slice(o[0].length),(i==="http"||i==="https")&&(n=e));let s=t.providers?.[i]||eb[i]||r;if(!s)throw new Error(`Unsupported provider: ${i}`);let a=await Promise.resolve().then(()=>s(n,{auth:t.auth})).catch(d=>{throw new Error(`Failed to download template from ${i}: ${d.message}`)});if(!a)throw new Error(`Failed to resolve template from ${i}`);a.name=(a.name||"template").replace(/[^\da-z-]/gi,"-"),a.defaultDir=(a.defaultDir||a.name).replace(/[^\da-z-]/gi,"-");let u=he(he(Z0(),i,a.name),(a.version||a.name)+".tar.gz");if(t.preferOffline&&Nt(u)&&(t.offline=!0),!t.offline){await vp(Ks(u),{recursive:!0});let d=Date.now();await Y0(a.tar,u,{headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,...kp(a.headers)}}).catch(g=>{if(!Nt(u))throw g;nr("Download error. Using cached version:",g),t.offline=!0}),nr(`Downloaded ${a.tar} to ${u} in ${Date.now()-d}ms`)}if(!Nt(u))throw new Error(`Tarball not found: ${u} (offline: ${t.offline})`);let c=he(he(t.cwd||"."),t.dir||a.defaultDir);if(t.forceClean&&await L0(c,{recursive:!0,force:!0}),!t.force&&Nt(c)&&z0(c).length>0)throw new Error(`Destination ${c} already exists.`);await vp(c,{recursive:!0});let l=Date.now(),p=a.subdir?.replace(/^\//,"")||"",{extract:h}=await Promise.resolve().then(()=>(wp(),Ep)).then(d=>d.t);if(await h({file:u,cwd:c,onReadEntry(d){d.path=d.path.split("/").splice(1).join("/"),p&&(d.path.startsWith(p+"/")?d.path=d.path.slice(p.length):d.path="")}}),nr(`Extracted to ${c} in ${Date.now()-l}ms`),t.install){nr("Installing dependencies...");let{installDependencies:d}=await Promise.resolve().then(()=>(Xs(),dl)).then(g=>g.t);await d({cwd:c,silent:t.silent,...typeof t.install=="object"?t.install:{}})}return{...a,source:n,dir:c}}var K0,Sp,Fp,xp,J0,X0,Q0,eb,tb,Ap,rb,_p=D(()=>{Xs();K0=/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;Sp=async(e,t)=>{if(e.endsWith(".json"))return await Fp(e,t);let r=new URL(e),i=Zs(r.pathname);try{let n=await Kr(r.href,{method:"HEAD",validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if((n.headers.get("content-type")||"").includes("application/json"))return await Fp(e,t);let o=n.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];o&&(i=o.split(".")[0])}catch(n){nr(`Failed to fetch HEAD for ${r.href}:`,n)}return{name:`${i}-${r.href.slice(0,8)}`,version:"",subdir:"",tar:r.href,defaultDir:i,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0}}},Fp=async(e,t)=>{let r=await(await Kr(e,{validateStatus:!0,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}})).json();if(!r.tar||!r.name)throw new Error(`Invalid template info from ${e}. name or tar fields are missing!`);return r},xp=(e,t)=>{let r=gn(e),i=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${i.replace("api.github.com","github.com")}/${r.repo}/tree/${r.ref}${r.subdir}`,tar:`${i}/repos/${r.repo}/tarball/${r.ref}`}},J0=(e,t)=>{let r=gn(e),i=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${i}/${r.repo}/tree/${r.ref}${r.subdir}`,tar:`${i}/${r.repo}/-/archive/${r.ref}.tar.gz`}},X0=(e,t)=>{let r=gn(e);return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://bitbucket.com/${r.repo}/src/${r.ref}${r.subdir}`,tar:`https://bitbucket.org/${r.repo}/get/${r.ref}.tar.gz`}},Q0=(e,t)=>{let r=gn(e);return{name:r.repo.replace("/","-"),version:r.ref,subdir:r.subdir,headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0},url:`https://git.sr.ht/~${r.repo}/tree/${r.ref}/item${r.subdir}`,tar:`https://git.sr.ht/~${r.repo}/archive/${r.ref}.tar.gz`}},eb={http:Sp,https:Sp,github:xp,gh:xp,gitlab:J0,bitbucket:X0,sourcehut:Q0},tb="https://raw.githubusercontent.com/unjs/giget/main/templates",Ap=(e=tb,t={})=>async r=>{let i=Date.now(),n=`${e}/${r}.json`,o=await Kr(n,{headers:{authorization:t.auth?`Bearer ${t.auth}`:void 0}});if(o.status>=400)throw new Error(`Failed to download ${r} template info from ${n}: ${o.status} ${o.statusText}`);let s=await o.json();if(!s.tar||!s.name)throw new Error(`Invalid template info from ${n}. name or tar fields are missing!`);return nr(`Fetched ${r} template info from ${n} in ${Date.now()-i}ms`),s},rb=/^([\w-.]+):/});var Tp=D(()=>{_p()});var Dn,Op,ib,nb,ha,Xe,ma=D(()=>{"use strict";Dn=V(ae(),1),Op=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],ib=Dn.default.green("\u2714"),nb=Dn.default.red("\u2716"),ha=()=>{let e=null,t=0,r="",i=()=>{process.stdout.write("\r\x1B[K")},n=()=>{i(),process.stdout.write(`${Dn.default.cyan(Op[t])} ${r}`),t=(t+1)%Op.length};return{start:o=>{r=o,t=0,e&&clearInterval(e),e=setInterval(n,80),n()},succeed:o=>{e&&(clearInterval(e),e=null),i(),console.log(`${ib} ${o||r}`)},fail:o=>{e&&(clearInterval(e),e=null),i(),console.log(`${nb} ${o||r}`)},stop:()=>{e&&(clearInterval(e),e=null),i()}}},Xe=e=>{let t=ha();return t.start(e),t}});var Rp,$p,yn,Pp,Ip,sb,ob,da,fa,Np=D(()=>{"use strict";Tp();Rp=V(ae(),1);Er();ma();$p={saas:"gh:Moshaban09/nexo-templates/react/saas",landing:"gh:Moshaban09/nexo-templates/react/landing",dashboard:"gh:Moshaban09/nexo-templates/react/dashboard",portfolio:"gh:Moshaban09/nexo-templates/react/portfolio",ecommerce:"gh:Moshaban09/nexo-templates/react/ecommerce","blog-docs":"gh:Moshaban09/nexo-templates/react/blog-docs","components-ui":"gh:Moshaban09/nexo-templates/react/components-ui"},yn=e=>e instanceof Error?e.message.toLowerCase():String(e).toLowerCase(),Pp=e=>{let t=yn(e);return t.includes("network")||t.includes("enotfound")||t.includes("econnrefused")||t.includes("etimedout")||t.includes("unable to connect")||t.includes("unable to access")||t.includes("fetch failed")},Ip=e=>{let t=yn(e);return t.includes("403")||t.includes("rate limit")},sb=e=>{let r=yn(e).match(/retry[- ]?after[:\s]+(\d+)/i);if(r)return parseInt(r[1],10)},ob=e=>{let t=yn(e);return Pp(e)||Ip(e)||t.includes("500")||t.includes("502")||t.includes("503")||t.includes("504")},da=async(e,t,r=Si)=>{let i;for(let n=0;n<=r.maxRetries;n++){let s=n>0?`Retrying (${n}/${r.maxRetries})...`:`Cloning template from ${e}...`,a=Xe(s);try{await pa(e,{dir:t,force:!0}),a.succeed("Template cloned successfully");return}catch(u){if(a.fail(),i=u,n<r.maxRetries&&ob(u)){let c=Ic(n,r);console.log(Rp.default.yellow(` \u23F3 Waiting ${c/1e3}s before retry...`)),await Nc(c);continue}break}}if(Ip(i)){let n=sb(i);throw new ki(`GitHub rate limit exceeded while cloning "${e}"`,n,n?new Date(Date.now()+n*1e3):void 0)}throw Pp(i)?new Ai(`Unable to clone "${e}" - no network connection.
|
|
106
|
+
Try again when online, or use a local template with --template-dir.`):new xi(`Failed to clone template "${e}" after ${r.maxRetries+1} attempts: ${i?.message||"Unknown error"}`,`https://github.com/${e}`,void 0,r.maxRetries+1)},fa=e=>$p[e.toLowerCase()]});import Zr from"node:path";var ga,ab,jp,Bp,ub,Lp,cb,lb,pb,hb,mb,db,fb,gb,Db,Mp=D(()=>{"use strict";ot();ga=async(e,t)=>{let r=await st(e);if(t.dependencies)for(let[i,n]of Object.entries(t.dependencies))vr(r,i,n,!1);if(t.devDependencies)for(let[i,n]of Object.entries(t.devDependencies))vr(r,i,n,!0);return await Ri(e,r),r},ab=async(e,t,r)=>t?ga(e,r):null,jp=async(e,t)=>{await Promise.all(t.map(async r=>{let i=Zr.join(e.projectPath,r.path);await x(Zr.dirname(i)),await w(i,r.content)}))},Bp=async(e,t)=>{let r=Object.entries(t).map(([i,n])=>({path:i,content:n}));await jp(e,r)},ub=async(e,t,r)=>{let i=Zr.join(e.projectPath,t),{pathExists:n}=await Promise.resolve().then(()=>(ot(),Yc));return await n(i)?!1:(await x(Zr.dirname(i)),await w(i,r),!0)},Lp=async(e,t)=>{await Promise.all(t.map(r=>x(Zr.join(e.projectPath,r))))},cb=(e,t)=>{let r=e;for(let[i,n]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${i}\\}\\}`,"g"),n);return r},lb=e=>e.map(({from:t,imports:r,default:i})=>{let n=[];return i&&n.push(i),Array.isArray(r)&&r.length>0?n.push(`{ ${r.join(", ")} }`):typeof r=="string"&&r&&n.push(`{ ${r} }`),`import ${n.join(", ")} from '${t}'`}).join(`
|
|
107
|
+
`),pb=(e,t)=>e.selections[t]==="none",hb=e=>{let t=e.selections.variant.startsWith("ts");return{ts:t,ext:t?"tsx":"jsx",configExt:t?"ts":"js"}},mb=e=>async t=>{let r=t.selections[e.selectionKey];if(r==="none")return;let i=e.configs[r];if(i){if((i.dependencies||i.devDependencies)&&await ga(t,{dependencies:i.dependencies,devDependencies:i.devDependencies}),i.directories&&await Lp(t,i.directories),i.files){let n=i.files(t);await Bp(t,n)}i.setup&&await i.setup(t)}},db=async(e,t)=>e?t():null,fb=(e,t,r)=>e?t:r,gb=(...e)=>e.filter(t=>t!==!1&&t!==null&&t!==void 0),Db=(...e)=>{let t={};for(let r of e)if(r&&Array.isArray(r)){let[i,n]=r;n!=null&&(t[i]=n)}return t}});var Yp={};k(Yp,{checkNetworkConnectivity:()=>Vp,clearCache:()=>Cb,fetchWithTimeout:()=>ba,getCached:()=>Hp,getLatestVersion:()=>Gp,getPackageVersions:()=>qp,isOffline:()=>wb,setCache:()=>Wp,setOfflineMode:()=>vb,startPrefetch:()=>Fb,waitForPrefetch:()=>xb});var Up,yb,zp,bb,Da,bn,Hp,Wp,Cb,sr,ya,Eb,wb,vb,ba,Gp,Vp,qp,Jr,Sb,Fb,xb,Kp=D(()=>{"use strict";Up=V(ae(),1),yb=3e3,zp="https://registry.npmjs.org",bb=36e5,Da={react:"^19.0.0","react-dom":"^19.0.0","@vitejs/plugin-react":"^4.3.4",zustand:"^5.0.0","@reduxjs/toolkit":"^2.5.0",jotai:"^2.11.0","react-router-dom":"^7.13.0","@tanstack/react-router":"^1.157.0","@tanstack/react-query":"^5.64.0",axios:"^1.7.0","react-hook-form":"^7.54.0",zod:"^3.24.0",tailwindcss:"^4.0.0","lucide-react":"^0.553.0"},bn=new Map,Hp=e=>{let t=bn.get(e);return t?Date.now()-t.timestamp>bb?(bn.delete(e),null):t.value:null},Wp=(e,t)=>{bn.set(e,{value:t,timestamp:Date.now()})},Cb=()=>{bn.clear()},sr=!1,ya=0,Eb=3e4,wb=()=>sr,vb=e=>{sr=e,e&&console.log(Up.default.yellow("\u26A0 Offline mode enabled. Using built-in stable versions."))},ba=async(e,t={},r=yb)=>{let i=new AbortController,n=setTimeout(()=>i.abort(),r);try{let o=await fetch(e,{...t,signal:i.signal});return clearTimeout(n),o}catch(o){throw clearTimeout(n),o.name==="AbortError"?new Error(`Network timeout after ${r}ms`):o}},Gp=async e=>{let t=Hp(`version:${e}`);if(t)return t;if(sr)return Da[e]||"latest";try{let r=await ba(`${zp}/${e}/latest`,{headers:{Accept:"application/json"}});if(!r.ok)throw new Error(`HTTP ${r.status}`);let n=`^${(await r.json()).version}`;return Wp(`version:${e}`,n),n}catch{return Da[e]?Da[e]:"latest"}},Vp=async()=>{let e=Date.now();if(e-ya<Eb)return!sr;try{return await ba(`${zp}/react`,{},2e3),ya=e,sr=!1,!0}catch{return ya=e,sr=!0,!1}},qp=async e=>{let t={};return await Promise.all(e.map(async r=>{t[r]=await Gp(r)})),t},Jr=null,Sb=["react","react-dom","zustand","react-router-dom","@tanstack/react-query","react-hook-form","zod","tailwindcss","lucide-react"],Fb=()=>{Jr||(Jr=(async()=>{try{if(!await Vp())return;await qp(Sb)}catch{}finally{Jr=null}})())},xb=async()=>{Jr&&await Jr}});var Ca={};k(Ca,{PackageManager:()=>Cn});import kb from"node:path";var Cn,En=D(()=>{"use strict";ot();Cn=class{projectPath;pkg=null;dependencies=new Map;devDependencies=new Map;scripts=new Map;constructor(t){this.projectPath=t}async load(t){this.pkg=await st(t),this.pkg.dependencies&&Object.entries(this.pkg.dependencies).forEach(([r,i])=>this.dependencies.set(r,i)),this.pkg.devDependencies&&Object.entries(this.pkg.devDependencies).forEach(([r,i])=>this.devDependencies.set(r,i)),this.pkg.scripts&&Object.entries(this.pkg.scripts).forEach(([r,i])=>this.scripts.set(r,i))}add(t,r,i=!1){i?this.devDependencies.set(t,r):this.dependencies.set(t,r)}addScript(t,r){this.scripts.set(t,r)}set(t,r){this.pkg&&(this.pkg[t]=r)}async resolveLatestVersions(){if(process.env.NODE_ENV==="test")return;let t=[...this.dependencies.keys()],r=[...this.devDependencies.keys()],i=[...new Set([...t,...r])];if(i.length===0)return;let{getLatestVersion:n}=await Promise.resolve().then(()=>(Kp(),Yp)),o=await Promise.allSettled(i.map(async s=>{try{let a=await n(s);return{name:s,version:a}}catch{return{name:s,version:null}}}));for(let s of o)if(s.status==="fulfilled"&&s.value.version){let{name:a,version:u}=s.value;if(u==="latest"||/^\^?\d+\.\d+\.\d+/.test(u)){let c=u==="latest"||u.startsWith("^")?u:`^${u}`;this.dependencies.has(a)&&this.dependencies.set(a,c),this.devDependencies.has(a)&&this.devDependencies.set(a,c)}}}async save(){if(!this.pkg)throw new Error("Package.json not loaded. Call load() first.");let t=r=>Object.fromEntries([...r.entries()].sort((i,n)=>i[0].localeCompare(n[0])));this.pkg.dependencies=t(this.dependencies),this.pkg.devDependencies=t(this.devDependencies),this.pkg.scripts=t(this.scripts),await We(kb.join(this.projectPath,"package.json"),this.pkg)}}});var Jp={};k(Jp,{detectAvailableManagers:()=>Sn,detectPackageManagerUsed:()=>wn,getInstallCommand:()=>jt,getPrefetchCommand:()=>vn,getRunCommand:()=>Zp});import{execSync as Ea}from"node:child_process";var wn,vn,Sn,jt,Zp,Fn=D(()=>{"use strict";wn=()=>{let e=process.env.npm_config_user_agent;if(e){if(e.startsWith("pnpm"))return"pnpm";if(e.startsWith("yarn"))return"yarn";if(e.startsWith("bun"))return"bun"}return"npm"},vn=e=>{switch(e){case"npm":return{command:"npm",args:["cache","add"]};case"pnpm":return{command:"pnpm",args:["store","add"]};case"yarn":return{command:"yarn",args:["cache","add"]};case"bun":return null;default:return{command:"npm",args:["cache","add"]}}},Sn=()=>{let e=["npm"];try{Ea("pnpm --version",{stdio:"ignore"}),e.push("pnpm")}catch{}try{Ea("yarn --version",{stdio:"ignore"}),e.push("yarn")}catch{}try{Ea("bun --version",{stdio:"ignore"}),e.push("bun")}catch{}return e},jt=(e,t={})=>{let{audit:r=!1,strict:i=!1}=t;switch(e){case"npm":return`npm install ${r?"":"--no-audit"} ${i?"":"--legacy-peer-deps"}`.replace(/\s+/g," ").trim();case"pnpm":return"pnpm install";case"bun":return"bun install";case"yarn":return"yarn install";default:return"npm install"}},Zp=(e,t)=>{switch(e){case"npm":return`npm run ${t}`;case"pnpm":return`pnpm run ${t}`;case"bun":return`bun run ${t}`;case"yarn":return`yarn ${t}`;default:return`npm run ${t}`}}});var rh=I((s2,th)=>{th.exports=eh;eh.sync=_b;var Xp=le("fs");function Ab(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Qp(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:Ab(t,r)}function eh(e,t,r){Xp.stat(e,function(i,n){r(i,i?!1:Qp(n,e,t))})}function _b(e,t){return Qp(Xp.statSync(e),e,t)}});var ah=I((o2,oh)=>{oh.exports=nh;nh.sync=Tb;var ih=le("fs");function nh(e,t,r){ih.stat(e,function(i,n){r(i,i?!1:sh(n,t))})}function Tb(e,t){return sh(ih.statSync(e),t)}function sh(e,t){return e.isFile()&&Ob(e,t)}function Ob(e,t){var r=e.mode,i=e.uid,n=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,p=r&c||r&u&&n===s||r&a&&i===o||r&l&&o===0;return p}});var ch=I((u2,uh)=>{var a2=le("fs"),xn;process.platform==="win32"||global.TESTING_WINDOWS?xn=rh():xn=ah();uh.exports=wa;wa.sync=Rb;function wa(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){wa(e,t||{},function(o,s){o?n(o):i(s)})})}xn(e,t||{},function(i,n){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function Rb(e,t){try{return xn.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var gh=I((c2,fh)=>{var or=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",lh=le("path"),$b=or?";":":",ph=ch(),hh=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),mh=(e,t)=>{let r=t.colon||$b,i=e.match(/\//)||or&&e.match(/\\/)?[""]:[...or?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=or?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=or?n.split(r):[""];return or&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},dh=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:o}=mh(e,t),s=[],a=c=>new Promise((l,p)=>{if(c===i.length)return t.all&&s.length?l(s):p(hh(e));let h=i[c],d=/^".*"$/.test(h)?h.slice(1,-1):h,g=lh.join(d,e),y=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;l(u(y,c,0))}),u=(c,l,p)=>new Promise((h,d)=>{if(p===n.length)return h(a(l+1));let g=n[p];ph(c+g,{pathExt:o},(y,v)=>{if(!y&&v)if(t.all)s.push(c+g);else return h(c+g);return h(u(c,l,p+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},Pb=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=mh(e,t),o=[];for(let s=0;s<r.length;s++){let a=r[s],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=lh.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let p=0;p<i.length;p++){let h=l+i[p];try{if(ph.sync(h,{pathExt:n}))if(t.all)o.push(h);else return h}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw hh(e)};fh.exports=dh;dh.sync=Pb});var yh=I((l2,va)=>{"use strict";var Dh=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};va.exports=Dh;va.exports.default=Dh});var wh=I((p2,Eh)=>{"use strict";var bh=le("path"),Ib=gh(),Nb=yh();function Ch(e,t){let r=e.options.env||process.env,i=process.cwd(),n=e.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Ib.sync(e.command,{path:r[Nb({env:r})],pathExt:t?bh.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return s&&(s=bh.resolve(n?e.options.cwd:"",s)),s}function jb(e){return Ch(e)||Ch(e,!0)}Eh.exports=jb});var vh=I((h2,Fa)=>{"use strict";var Sa=/([()\][%!^"`<>&|;, *?])/g;function Bb(e){return e=e.replace(Sa,"^$1"),e}function Lb(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Sa,"^$1"),t&&(e=e.replace(Sa,"^$1")),e}Fa.exports.command=Bb;Fa.exports.argument=Lb});var Fh=I((m2,Sh)=>{"use strict";Sh.exports=/^#!(.*)/});var kh=I((d2,xh)=>{"use strict";var Mb=Fh();xh.exports=(e="")=>{let t=e.match(Mb);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var _h=I((f2,Ah)=>{"use strict";var xa=le("fs"),Ub=kh();function zb(e){let r=Buffer.alloc(150),i;try{i=xa.openSync(e,"r"),xa.readSync(i,r,0,150,0),xa.closeSync(i)}catch{}return Ub(r.toString())}Ah.exports=zb});var $h=I((g2,Rh)=>{"use strict";var Hb=le("path"),Th=wh(),Oh=vh(),Wb=_h(),Gb=process.platform==="win32",Vb=/\.(?:com|exe)$/i,qb=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Yb(e){e.file=Th(e);let t=e.file&&Wb(e.file);return t?(e.args.unshift(e.file),e.command=t,Th(e)):e.file}function Kb(e){if(!Gb)return e;let t=Yb(e),r=!Vb.test(t);if(e.options.forceShell||r){let i=qb.test(t);e.command=Hb.normalize(e.command),e.command=Oh.command(e.command),e.args=e.args.map(o=>Oh.argument(o,i));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zb(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let i={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?i:Kb(i)}Rh.exports=Zb});var Nh=I((D2,Ih)=>{"use strict";var ka=process.platform==="win32";function Aa(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Jb(e,t){if(!ka)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let o=Ph(n,t);if(o)return r.call(e,"error",o)}return r.apply(e,arguments)}}function Ph(e,t){return ka&&e===1&&!t.file?Aa(t.original,"spawn"):null}function Xb(e,t){return ka&&e===1&&!t.file?Aa(t.original,"spawnSync"):null}Ih.exports={hookChildProcess:Jb,verifyENOENT:Ph,verifyENOENTSync:Xb,notFoundError:Aa}});var Lh=I((y2,ar)=>{"use strict";var jh=le("child_process"),_a=$h(),Ta=Nh();function Bh(e,t,r){let i=_a(e,t,r),n=jh.spawn(i.command,i.args,i.options);return Ta.hookChildProcess(n,i),n}function Qb(e,t,r){let i=_a(e,t,r),n=jh.spawnSync(i.command,i.args,i.options);return n.error=n.error||Ta.verifyENOENTSync(n.status,i),n}ar.exports=Bh;ar.exports.spawn=Bh;ar.exports.sync=Qb;ar.exports._parse=_a;ar.exports._enoent=Ta});function Oa(e){let t=typeof e=="string"?`
|
|
108
|
+
`:10,r=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e}var Mh=D(()=>{});function kn(e={}){let{env:t=process.env,platform:r=process.platform}=e;return r!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"}var Uh=D(()=>{});import An from"node:process";import Xr from"node:path";import{fileURLToPath as zh}from"node:url";var eC,tC,rC,Hh,Wh=D(()=>{Uh();eC=({cwd:e=An.cwd(),path:t=An.env[kn()],preferLocal:r=!0,execPath:i=An.execPath,addExecPath:n=!0}={})=>{let o=e instanceof URL?zh(e):e,s=Xr.resolve(o),a=[];return r&&tC(a,s),n&&rC(a,i,s),[...a,t].join(Xr.delimiter)},tC=(e,t)=>{let r;for(;r!==t;)e.push(Xr.join(t,"node_modules/.bin")),r=t,t=Xr.resolve(t,"..")},rC=(e,t,r)=>{let i=t instanceof URL?zh(t):t;e.push(Xr.resolve(r,i,".."))},Hh=({env:e=An.env,...t}={})=>{e={...e};let r=kn({env:e});return t.path=e[r],e[r]=eC(t),e}});function Ra(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:i}=e;for(let n of Reflect.ownKeys(t))iC(e,t,n,r);return sC(e,t),cC(e,t,i),e}var iC,nC,sC,oC,aC,uC,cC,Gh=D(()=>{iC=(e,t,r,i)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let n=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);!nC(n,o)&&i||Object.defineProperty(e,r,o)},nC=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},sC=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},oC=(e,t)=>`/* Wrapped ${e}*/
|
|
109
|
+
${t}`,aC=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),uC=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),cC=(e,t,r)=>{let i=r===""?"":`with ${r.trim()}() `,n=oC.bind(null,i,t.toString());Object.defineProperty(n,"name",uC),Object.defineProperty(e,"toString",{...aC,value:n})}});var _n,Vh,qh,Yh=D(()=>{Gh();_n=new WeakMap,Vh=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,i=0,n=e.displayName||e.name||"<anonymous>",o=function(...s){if(_n.set(o,++i),i===1)r=e.apply(this,s),e=null;else if(t.throw===!0)throw new Error(`Function \`${n}\` can only be called once`);return r};return Ra(o,e),_n.set(o,i),o};Vh.callCount=e=>{if(!_n.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return _n.get(e)};qh=Vh});var Kh,lC,Zh,Jh,Xh=D(()=>{Kh=()=>{let e=Jh-Zh+1;return Array.from({length:e},lC)},lC=(e,t)=>({name:`SIGRT${t+1}`,number:Zh+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Zh=34,Jh=64});var Qh,em=D(()=>{Qh=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as pC}from"node:os";var $a,hC,tm=D(()=>{em();Xh();$a=()=>{let e=Kh();return[...Qh,...e].map(hC)},hC=({name:e,number:t,description:r,action:i,forced:n=!1,standard:o})=>{let{signals:{[e]:s}}=pC,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:i,forced:n,standard:o}}});import{constants as mC}from"node:os";var dC,fC,rm,gC,DC,yC,j2,im=D(()=>{tm();dC=()=>{let e=$a();return Object.fromEntries(e.map(fC))},fC=({name:e,number:t,description:r,supported:i,action:n,forced:o,standard:s})=>[e,{name:e,number:t,description:r,supported:i,action:n,forced:o,standard:s}],rm=dC(),gC=()=>{let e=$a(),t=65,r=Array.from({length:t},(i,n)=>DC(n,e));return Object.assign({},...r)},DC=(e,t)=>{let r=yC(e,t);if(r===void 0)return{};let{name:i,description:n,supported:o,action:s,forced:a,standard:u}=r;return{[e]:{name:i,number:e,description:n,supported:o,action:s,forced:a,standard:u}}},yC=(e,t)=>{let r=t.find(({name:i})=>mC.signals[i]===e);return r!==void 0?r:t.find(i=>i.number===e)},j2=gC()});import bC from"node:process";var CC,Qr,nm=D(()=>{im();CC=({timedOut:e,timeout:t,errorCode:r,signal:i,signalDescription:n,exitCode:o,isCanceled:s})=>e?`timed out after ${t} milliseconds`:s?"was canceled":r!==void 0?`failed with ${r}`:i!==void 0?`was killed with ${i} (${n})`:o!==void 0?`failed with exit code ${o}`:"failed",Qr=({stdout:e,stderr:t,all:r,error:i,signal:n,exitCode:o,command:s,escapedCommand:a,timedOut:u,isCanceled:c,killed:l,parsed:{options:{timeout:p,cwd:h=bC.cwd()}}})=>{o=o===null?void 0:o,n=n===null?void 0:n;let d=n===void 0?void 0:rm[n].description,g=i&&i.code,v=`Command ${CC({timedOut:u,timeout:p,errorCode:g,signal:n,signalDescription:d,exitCode:o,isCanceled:c})}: ${s}`,z=Object.prototype.toString.call(i)==="[object Error]",C=z?`${v}
|
|
110
|
+
${i.message}`:v,se=[C,t,e].filter(Boolean).join(`
|
|
111
|
+
`);return z?(i.originalMessage=i.message,i.message=se):i=new Error(se),i.shortMessage=C,i.command=s,i.escapedCommand=a,i.exitCode=o,i.signal=n,i.signalDescription=d,i.stdout=e,i.stderr=t,i.cwd=h,r!==void 0&&(i.all=r),"bufferedData"in i&&delete i.bufferedData,i.failed=!0,i.timedOut=!!u,i.isCanceled=c,i.killed=l&&!u,i}});var Tn,EC,Pa,sm,om=D(()=>{Tn=["stdin","stdout","stderr"],EC=e=>Tn.some(t=>e[t]!==void 0),Pa=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return Tn.map(i=>e[i]);if(EC(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Tn.map(i=>`\`${i}\``).join(", ")}`);if(typeof t=="string")return t;if(!Array.isArray(t))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);let r=Math.max(t.length,Tn.length);return Array.from({length:r},(i,n)=>t[n])},sm=e=>{let t=Pa(e);return t==="ipc"?"ipc":t===void 0||typeof t=="string"?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}});var Bt,am=D(()=>{Bt=[];Bt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Bt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Bt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var On,Ia,Na,wC,ja,Rn,vC,Ba,La,Ma,um,G2,V2,cm=D(()=>{am();On=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",Ia=Symbol.for("signal-exit emitter"),Na=globalThis,wC=Object.defineProperty.bind(Object),ja=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Na[Ia])return Na[Ia];wC(Na,Ia,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){let i=this.listeners[t],n=i.indexOf(r);n!==-1&&(n===0&&i.length===1?i.length=0:i.splice(n,1))}emit(t,r,i){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(let o of this.listeners[t])n=o(r,i)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,i)||n),n}},Rn=class{},vC=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Ba=class extends Rn{onExit(){return()=>{}}load(){}unload(){}},La=class extends Rn{#e=Ma.platform==="win32"?"SIGINT":"SIGHUP";#i=new ja;#t;#o;#s;#r={};#n=!1;constructor(t){super(),this.#t=t,this.#r={};for(let r of Bt)this.#r[r]=()=>{let i=this.#t.listeners(r),{count:n}=this.#i,o=t;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(n+=o.__signal_exit_emitter__.count),i.length===n){this.unload();let s=this.#i.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;s||t.kill(t.pid,a)}};this.#s=t.reallyExit,this.#o=t.emit}onExit(t,r){if(!On(this.#t))return()=>{};this.#n===!1&&this.load();let i=r?.alwaysLast?"afterExit":"exit";return this.#i.on(i,t),()=>{this.#i.removeListener(i,t),this.#i.listeners.exit.length===0&&this.#i.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#n){this.#n=!0,this.#i.count+=1;for(let t of Bt)try{let r=this.#r[t];r&&this.#t.on(t,r)}catch{}this.#t.emit=(t,...r)=>this.#u(t,...r),this.#t.reallyExit=t=>this.#a(t)}}unload(){this.#n&&(this.#n=!1,Bt.forEach(t=>{let r=this.#r[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#t.removeListener(t,r)}catch{}}),this.#t.emit=this.#o,this.#t.reallyExit=this.#s,this.#i.count-=1)}#a(t){return On(this.#t)?(this.#t.exitCode=t||0,this.#i.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#u(t,...r){let i=this.#o;if(t==="exit"&&On(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let n=i.call(this.#t,t,...r);return this.#i.emit("exit",this.#t.exitCode,null),n}else return i.call(this.#t,t,...r)}},Ma=globalThis.process,{onExit:um,load:G2,unload:V2}=vC(On(Ma)?new La(Ma):new Ba)});import SC from"node:os";var FC,lm,xC,kC,AC,_C,pm,TC,hm,mm,dm,fm=D(()=>{cm();FC=1e3*5,lm=(e,t="SIGTERM",r={})=>{let i=e(t);return xC(e,t,r,i),i},xC=(e,t,r,i)=>{if(!kC(t,r,i))return;let n=_C(r),o=setTimeout(()=>{e("SIGKILL")},n);o.unref&&o.unref()},kC=(e,{forceKillAfterTimeout:t},r)=>AC(e)&&t!==!1&&r,AC=e=>e===SC.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",_C=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return FC;if(!Number.isFinite(e)||e<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e},pm=(e,t)=>{e.kill()&&(t.isCanceled=!0)},TC=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},hm=(e,{timeout:t,killSignal:r="SIGTERM"},i)=>{if(t===0||t===void 0)return i;let n,o=new Promise((a,u)=>{n=setTimeout(()=>{TC(e,r,u)},t)}),s=i.finally(()=>{clearTimeout(n)});return Promise.race([o,s])},mm=({timeout:e})=>{if(e!==void 0&&(!Number.isFinite(e)||e<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`)},dm=async(e,{cleanup:t,detached:r},i)=>{if(!t||r)return i;let n=um(()=>{e.kill()});return i.finally(()=>{n()})}});function $n(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function Ua(e){return $n(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}var za=D(()=>{});import{createWriteStream as OC}from"node:fs";import{ChildProcess as RC}from"node:child_process";var $C,Ha,gm,Dm=D(()=>{za();$C=e=>e instanceof RC&&typeof e.then=="function",Ha=(e,t,r)=>{if(typeof r=="string")return e[t].pipe(OC(r)),e;if(Ua(r))return e[t].pipe(r),e;if(!$C(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Ua(r.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(r.stdin),r},gm=e=>{e.stdout!==null&&(e.pipeStdout=Ha.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=Ha.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=Ha.bind(void 0,e,"all"))}});var ei,PC,Cm,ym,IC,NC,bm,Pn,ti=D(()=>{ei=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:u=Number.POSITIVE_INFINITY}={})=>{if(!IC(e))throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");let c=t();c.length=0;try{for await(let l of e){let p=NC(l),h=r[p](l,c);Cm({convertedChunk:h,state:c,getSize:i,truncateChunk:n,addChunk:o,maxBuffer:u})}return PC({state:c,convertChunk:r,getSize:i,truncateChunk:n,addChunk:o,getFinalChunk:s,maxBuffer:u}),a(c)}catch(l){throw l.bufferedData=a(c),l}},PC=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:o})=>{let s=n(e);s!==void 0&&Cm({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:o})},Cm=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:o})=>{let s=r(e),a=t.length+s;if(a<=o){ym(e,t,n,a);return}let u=i(e,o-t.length);throw u!==void 0&&ym(u,t,n,o),new Pn},ym=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},IC=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",NC=e=>{let t=typeof e;if(t==="string")return"string";if(t!=="object"||e===null)return"others";if(globalThis.Buffer?.isBuffer(e))return"buffer";let r=bm.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&bm.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:bm}=Object.prototype,Pn=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var Wa,Ga,Va,In,Nn,jn=D(()=>{Wa=e=>e,Ga=()=>{},Va=({contents:e})=>e,In=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},Nn=e=>e.length});var Em=D(()=>{ti();jn()});async function qa(e,t){return ei(e,GC,t)}var jC,BC,LC,wm,vm,MC,UC,zC,HC,Fm,Sm,WC,xm,GC,Ya=D(()=>{ti();jn();jC=()=>({contents:new ArrayBuffer(0)}),BC=e=>LC.encode(e),LC=new TextEncoder,wm=e=>new Uint8Array(e),vm=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),MC=(e,t)=>e.slice(0,t),UC=(e,{contents:t,length:r},i)=>{let n=xm()?HC(t,i):zC(t,i);return new Uint8Array(n).set(e,r),n},zC=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(Fm(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},HC=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:Fm(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Fm=e=>Sm**Math.ceil(Math.log(e)/Math.log(Sm)),Sm=2,WC=({contents:e,length:t})=>xm()?e:e.slice(0,t),xm=()=>"resize"in ArrayBuffer.prototype,GC={init:jC,convertChunk:{string:BC,buffer:wm,arrayBuffer:wm,dataView:vm,typedArray:vm,others:In},getSize:Nn,truncateChunk:MC,addChunk:UC,getFinalChunk:Ga,finalize:WC}});async function Bn(e,t){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return km(await qa(e,t))}catch(r){throw r.bufferedData!==void 0&&(r.bufferedData=km(r.bufferedData)),r}}var km,Am=D(()=>{Ya();km=e=>globalThis.Buffer.from(e)});async function Ka(e,t){return ei(e,ZC,t)}var VC,Ln,qC,YC,KC,ZC,_m=D(()=>{ti();jn();VC=()=>({contents:"",textDecoder:new TextDecoder}),Ln=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),qC=(e,{contents:t})=>t+e,YC=(e,t)=>e.slice(0,t),KC=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},ZC={init:VC,convertChunk:{string:Wa,buffer:Ln,arrayBuffer:Ln,dataView:Ln,typedArray:Ln,others:In},getSize:Nn,truncateChunk:YC,addChunk:qC,getFinalChunk:KC,finalize:Va}});var Tm=D(()=>{Em();Ya();Am();_m();ti()});var Rm=I((wF,Om)=>{"use strict";var{PassThrough:JC}=le("stream");Om.exports=function(){var e=[],t=new JC({objectMode:!0});return t.setMaxListeners(0),t.add=r,t.isEmpty=i,t.on("unpipe",n),Array.prototype.slice.call(arguments).forEach(r),t;function r(o){return Array.isArray(o)?(o.forEach(r),this):(e.push(o),o.once("end",n.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function i(){return e.length==0}function n(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});import{createReadStream as XC,readFileSync as QC}from"node:fs";import{setTimeout as eE}from"node:timers/promises";var $m,Pm,tE,Im,rE,Nm,jm,Za,Ja,iE,Bm,Lm=D(()=>{za();Tm();$m=V(Rm(),1),Pm=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},tE=({input:e,inputFile:t})=>typeof t!="string"?e:(Pm(e),QC(t)),Im=e=>{let t=tE(e);if($n(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},rE=({input:e,inputFile:t})=>typeof t!="string"?e:(Pm(e),XC(t)),Nm=(e,t)=>{let r=rE(t);r!==void 0&&($n(r)?r.pipe(e.stdin):e.stdin.end(r))},jm=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let r=(0,$m.default)();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},Za=async(e,t)=>{if(!(!e||t===void 0)){await eE(0),e.destroy();try{return await t}catch(r){return r.bufferedData}}},Ja=(e,{encoding:t,buffer:r,maxBuffer:i})=>{if(!(!e||!r))return t==="utf8"||t==="utf-8"?Ka(e,{maxBuffer:i}):t===null||t==="buffer"?Bn(e,{maxBuffer:i}):iE(e,i,t)},iE=async(e,t,r)=>(await Bn(e,{maxBuffer:t})).toString(r),Bm=async({stdout:e,stderr:t,all:r},{encoding:i,buffer:n,maxBuffer:o},s)=>{let a=Ja(e,{encoding:i,buffer:n,maxBuffer:o}),u=Ja(t,{encoding:i,buffer:n,maxBuffer:o}),c=Ja(r,{encoding:i,buffer:n,maxBuffer:o*2});try{return await Promise.all([s,a,u,c])}catch(l){return Promise.all([{error:l,signal:l.signal,timedOut:l.timedOut},Za(e,a),Za(t,u),Za(r,c)])}}});var nE,sE,Xa,Mm,Um=D(()=>{nE=(async()=>{})().constructor.prototype,sE=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(nE,e)]),Xa=(e,t)=>{for(let[r,i]of sE){let n=typeof t=="function"?(...o)=>Reflect.apply(i.value,t(),o):i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},Mm=e=>new Promise((t,r)=>{e.on("exit",(i,n)=>{t({exitCode:i,signal:n})}),e.on("error",i=>{r(i)}),e.stdin&&e.stdin.on("error",i=>{r(i)})})});import{Buffer as oE}from"node:buffer";import{ChildProcess as aE}from"node:child_process";var Wm,uE,cE,Qa,eu,Gm,tu,zm,Hm,lE,ru,Vm=D(()=>{Wm=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],uE=/^[\w.-]+$/,cE=e=>typeof e!="string"||uE.test(e)?e:`"${e.replaceAll('"','\\"')}"`,Qa=(e,t)=>Wm(e,t).join(" "),eu=(e,t)=>Wm(e,t).map(r=>cE(r)).join(" "),Gm=/ +/g,tu=e=>{let t=[];for(let r of e.trim().split(Gm)){let i=t.at(-1);i&&i.endsWith("\\")?t[t.length-1]=`${i.slice(0,-1)} ${r}`:t.push(r)}return t},zm=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof aE)&&"stdout"in e){let r=typeof e.stdout;if(r==="string")return e.stdout;if(oE.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},Hm=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],lE=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{let o=n??e.raw[i],s=o.split(Gm).filter(Boolean),a=Hm(r,s,o.startsWith(" "));if(i===t.length)return a;let u=t[i],c=Array.isArray(u)?u.map(l=>zm(l)):[zm(u)];return Hm(a,c,o.endsWith(" "))},ru=(e,t)=>{let r=[];for(let[i,n]of e.entries())r=lE({templates:e,expressions:t,tokens:r,index:i,template:n});return r}});import{debuglog as pE}from"node:util";import hE from"node:process";var qm,Mn,mE,iu,Ym=D(()=>{qm=pE("execa").enabled,Mn=(e,t)=>String(e).padStart(t,"0"),mE=()=>{let e=new Date;return`${Mn(e.getHours(),2)}:${Mn(e.getMinutes(),2)}:${Mn(e.getSeconds(),2)}.${Mn(e.getMilliseconds(),3)}`},iu=(e,{verbose:t})=>{t&&hE.stderr.write(`[${mE()}] ${e}
|
|
112
|
+
`)}});var Qm={};k(Qm,{$:()=>bE,execa:()=>ce,execaCommand:()=>CE,execaCommandSync:()=>EE,execaNode:()=>wE,execaSync:()=>su});import{Buffer as dE}from"node:buffer";import fE from"node:path";import nu from"node:child_process";import ur from"node:process";function ce(e,t,r){let i=Jm(e,t,r),n=Qa(e,t),o=eu(e,t);iu(o,i.options),mm(i.options);let s;try{s=nu.spawn(i.file,i.args,i.options)}catch(d){let g=new nu.ChildProcess,y=Promise.reject(Qr({error:d,stdout:"",stderr:"",all:"",command:n,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1}));return Xa(g,y),g}let a=Mm(s),u=hm(s,i.options,a),c=dm(s,i.options,u),l={isCanceled:!1};s.kill=lm.bind(null,s.kill.bind(s)),s.cancel=pm.bind(null,s,l);let h=qh(async()=>{let[{error:d,exitCode:g,signal:y,timedOut:v},z,C,se]=await Bm(s,i.options,c),oe=ri(i.options,z),E=ri(i.options,C),Y=ri(i.options,se);if(d||g!==0||y!==null){let j=Qr({error:d,exitCode:g,signal:y,stdout:oe,stderr:E,all:Y,command:n,escapedCommand:o,parsed:i,timedOut:v,isCanceled:l.isCanceled||(i.options.signal?i.options.signal.aborted:!1),killed:s.killed});if(!i.options.reject)return j;throw j}return{command:n,escapedCommand:o,exitCode:0,stdout:oe,stderr:E,all:Y,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Nm(s,i.options),s.all=jm(s,i.options),gm(s),Xa(s,h),s}function su(e,t,r){let i=Jm(e,t,r),n=Qa(e,t),o=eu(e,t);iu(o,i.options);let s=Im(i.options),a;try{a=nu.spawnSync(i.file,i.args,{...i.options,input:s})}catch(l){throw Qr({error:l,stdout:"",stderr:"",all:"",command:n,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let u=ri(i.options,a.stdout,a.error),c=ri(i.options,a.stderr,a.error);if(a.error||a.status!==0||a.signal!==null){let l=Qr({stdout:u,stderr:c,error:a.error,signal:a.signal,exitCode:a.status,command:n,escapedCommand:o,parsed:i,timedOut:a.error&&a.error.code==="ETIMEDOUT",isCanceled:!1,killed:a.signal!==null});if(!i.options.reject)return l;throw l}return{command:n,escapedCommand:o,exitCode:0,stdout:u,stderr:c,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}function Xm(e){function t(r,...i){if(!Array.isArray(r))return Xm({...e,...r});let[n,...o]=ru(r,i);return ce(n,o,Km(e))}return t.sync=(r,...i)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[n,...o]=ru(r,i);return su(n,o,Km(e))},t}function CE(e,t){let[r,...i]=tu(e);return ce(r,i,t)}function EE(e,t){let[r,...i]=tu(e);return su(r,i,t)}function wE(e,t,r={}){t&&!Array.isArray(t)&&typeof t=="object"&&(r=t,t=[]);let i=sm(r),n=ur.execArgv.filter(a=>!a.startsWith("--inspect")),{nodePath:o=ur.execPath,nodeOptions:s=n}=r;return ce(o,[...s,e,...Array.isArray(t)?t:[]],{...r,stdin:void 0,stdout:void 0,stderr:void 0,stdio:i,shell:!1})}var Zm,gE,DE,Jm,ri,yE,Km,bE,ii=D(()=>{Zm=V(Lh(),1);Mh();Wh();Yh();nm();om();fm();Dm();Lm();Um();Vm();Ym();gE=1e3*1e3*100,DE=({env:e,extendEnv:t,preferLocal:r,localDir:i,execPath:n})=>{let o=t?{...ur.env,...e}:e;return r?Hh({env:o,cwd:i,execPath:n}):o},Jm=(e,t,r={})=>{let i=Zm.default._parse(e,t,r);return e=i.command,t=i.args,r=i.options,r={maxBuffer:gE,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||ur.cwd(),execPath:ur.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:qm,...r},r.env=DE(r),r.stdio=Pa(r),ur.platform==="win32"&&fE.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:i}},ri=(e,t,r)=>typeof t!="string"&&!dE.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?Oa(t):t;yE=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Km=(e={})=>({preferLocal:!0,...yE(e),...e});bE=Xm()});var ed={};k(ed,{prefetchCommonPackages:()=>cr,prefetchPackages:()=>Ue,prefetchedStats:()=>Un});var Ue,Un,cr,zn=D(()=>{"use strict";ii();Fn();Ue=e=>{if(e.length===0)return;let t=wn(),r=vn(t);if(!r)return;let{command:i,args:n}=r,o=[...n,...e];ce(i,o,{stdio:"ignore",detached:!1}).then(()=>{Un.successCount+=e.length}).catch(s=>{Un.failCount+=1})},Un={successCount:0,failCount:0},cr=()=>{Ue(["react@latest","react-dom@latest","vite@latest","typescript@latest","@vitejs/plugin-react@latest","tailwindcss@latest","postcss@latest","autoprefixer@latest"])}});var ne,vE,SE,FE,xE,td=D(()=>{"use strict";ne=V(ae(),1),vE=e=>{let{total:t,width:r=30,showPercentage:i=!0,showStepCount:n=!0,completeChar:o="\u2588",incompleteChar:s="\u2591",filledColor:a=ne.default.cyan,emptyColor:u=ne.default.dim}=e,c=0,l="",p=()=>{let h=Math.round(c/t*100),d=Math.round(c/t*r),g=r-d,v=`\r${a(o.repeat(d))+u(s.repeat(g))}`;i&&(v+=` ${h.toString().padStart(3)}%`),n&&(v+=` (${c}/${t})`),l&&(v+=` ${ne.default.dim(l)}`),v+="\x1B[K",process.stdout.write(v)};return{increment:h=>{c=Math.min(c+1,t),l=h||"",p()},update:(h,d)=>{c=Math.min(Math.max(0,h),t),l=d||"",p()},complete:h=>{c=t,l="",p(),console.log(),h&&console.log(ne.default.green(`\u2713 ${h}`))},fail:h=>{l="",console.log(),h&&console.log(ne.default.red(`\u2717 ${h}`))},getPercentage:()=>Math.round(c/t*100)}},SE=e=>{let{total:t,showStepNumbers:r=!0}=e,i=0,n="",o=()=>r?`[${i}/${t}]`:"";return{start:s=>{i++,n=s,process.stdout.write(`${ne.default.cyan("\u25CF")} ${o()} ${s}...`)},succeed:s=>{process.stdout.write(`\r${ne.default.green("\u2713")} ${o()} ${s||n}\x1B[K
|
|
110
113
|
`)},fail:s=>{process.stdout.write(`\r${ne.default.red("\u2717")} ${o()} ${s||n}\x1B[K
|
|
111
114
|
`)},skip:s=>{let a=s?` (${s})`:"";process.stdout.write(`\r${ne.default.yellow("\u25CB")} ${o()} ${n}${ne.default.dim(a)}\x1B[K
|
|
112
|
-
`)},complete:()=>{console.log(),console.log(ne.default.green(`\u2713 All ${t} steps completed successfully!`))}}},
|
|
115
|
+
`)},complete:()=>{console.log(),console.log(ne.default.green(`\u2713 All ${t} steps completed successfully!`))}}},FE=()=>({log:e=>{console.log(` ${e}`)},success:e=>{console.log(`${ne.default.green("\u2713")} ${e}`)},error:e=>{console.log(`${ne.default.red("\u2717")} ${e}`)},warn:e=>{console.log(`${ne.default.yellow("\u26A0")} ${e}`)},info:e=>{console.log(`${ne.default.blue("\u2139")} ${e}`)}}),xE=()=>{let e=Date.now(),t=null;return{elapsed:()=>(t||Date.now())-e,format:()=>{let r=(t||Date.now())-e;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`},stop:()=>{t=Date.now();let r=t-e;return r<1e3?`${r}ms`:`${(r/1e3).toFixed(2)}s`}}}});import kE from"node:os";var Hn,ni,Wn,ou,au,rd,id,nd,sd,AE,od,ad=D(()=>{"use strict";Cr();Er();Hn={framework:Object.values(Fc),variant:Object.values(xc),language:["typescript","javascript"],styling:Object.values(Sc),ui:Object.values(vc),forms:Object.values(Ac),state:Object.values(kc),routing:Object.values(_c),dataFetching:Object.values(Tc),icons:Object.values(Oc),structure:Object.values(Rc),testing:["vitest","jest"],linting:["eslint-prettier","biome"],api:["openapi","graphql","trpc"],animation:["framer-motion","gsap"]},ni=[{name:"shadcn-requires-tailwind",check:e=>e.ui==="shadcn"&&e.styling!=="tailwind",message:"shadcn/ui requires Tailwind CSS as the styling solution",suggestion:'Change styling to "tailwind" or choose a different UI library',severity:"error"},{name:"heroui-requires-tailwind",check:e=>e.ui==="heroui"&&e.styling!=="tailwind",message:"HeroUI requires Tailwind CSS as the styling solution",suggestion:'Change styling to "tailwind" or choose a different UI library',severity:"error"},{name:"react-compiler-react-only",check:e=>e.variant?.includes("compiler")&&e.framework!=="react",message:"React Compiler is only available for React framework",suggestion:'Change framework to "react" or choose a different variant',severity:"error"},{name:"swc-react-only",check:e=>e.variant?.includes("swc")&&e.framework!=="react",message:"SWC plugin is currently only configured for React",suggestion:"Use default variant for non-React frameworks",severity:"warning"},{name:"tanstack-router-typescript",check:e=>e.routing==="tanstack-router"&&!e.variant?.startsWith("ts"),message:"TanStack Router works best with TypeScript for full type safety",suggestion:"Consider using TypeScript variant for better DX",severity:"warning"},{name:"antd-bundle-warning",check:e=>e.ui==="antd",message:"Ant Design has a large bundle size (~120KB gzipped)",suggestion:"Consider shadcn/ui for smaller bundle size",severity:"warning"},{name:"chakra-bundle-warning",check:e=>e.ui==="chakra",message:"Chakra UI has a moderate bundle size (~80KB gzipped)",suggestion:"Consider shadcn/ui for smaller bundle with similar features",severity:"warning"}],Wn=e=>{let t=[],r=[],i=[];return!e||e.trim().length===0?t.push("Project name is required"):(e.length>214&&t.push("Project name must be less than 214 characters"),/^[a-z0-9]/.test(e)||t.push("Project name must start with a lowercase letter or number"),/^[a-z0-9._-]+$/.test(e)||(t.push("Project name can only contain lowercase letters, numbers, hyphens, underscores, and dots"),i.push("Use kebab-case: my-project-name")),["node_modules","favicon.ico","package","test"].includes(e.toLowerCase())&&t.push(`"${e}" is a reserved name`),e.startsWith(".")&&r.push('Project names starting with "." are hidden on Unix systems'),e.includes("..")&&t.push('Project name cannot contain ".."')),{valid:t.length===0,errors:t,warnings:r,suggestions:i}},ou=(e,t,r)=>{let i=[],n=[],o=[];if(!t||t==="")return{valid:!0,errors:i,warnings:n,suggestions:o};let s=r||Hn[e];return s&&!s.includes(t)&&(i.push(`Invalid ${e}: "${t}". Valid options: ${s.join(", ")}`),o.push(`Choose one of: ${s.join(", ")}`)),{valid:i.length===0,errors:i,warnings:n,suggestions:o}},au=e=>{let t=[],r=[],i=[];if(e.projectName){let s=Wn(e.projectName);t.push(...s.errors),r.push(...s.warnings),i.push(...s.suggestions)}let n=Object.keys(Hn);for(let s of n){let a=e[s];if(a!=null){let u=ou(s,a);t.push(...u.errors),r.push(...u.warnings),i.push(...u.suggestions)}}let o=Object.fromEntries(Object.entries(e).map(([s,a])=>[s,String(a)]));for(let s of ni)s.check(o)&&(s.severity==="error"?t.push(s.message):r.push(s.message),s.suggestion&&i.push(s.suggestion));return{valid:t.length===0,errors:[...new Set(t)],warnings:[...new Set(r)],suggestions:[...new Set(i)]}},rd=e=>{let t=au(e);if(!t.valid)throw new _i(t.errors.join("; "),{errors:t.errors,selections:e})},id=e=>{let t=ni.filter(r=>r.severity==="error"&&r.check(e));if(t.length>0)throw new Ti(t.map(r=>r.message).join("; "),e)},nd=e=>ni.filter(t=>t.severity==="warning"&&t.check(e)).map(t=>t.message),sd=e=>e.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,214),AE=e=>{let t=[],r=[],i=[],n=kE.platform()==="win32";n&&e.length>=$e?(t.push(`Path too long: ${e.length} characters exceeds Windows limit of ${$e}`),i.push("Use a shorter project name or parent directory")):e.length>=$e&&r.push(`Path length (${e.length}) may cause issues on Windows (limit: ${$e})`);let o=n?/[\\/]/:/\//,s=e.split(o).filter(Boolean);for(let a of s)a.length>it&&t.push(`Path component "${a.slice(0,30)}..." is too long (${a.length} chars, max: ${it})`);return{valid:t.length===0,errors:t,warnings:r,suggestions:i}},od=(e,t)=>{let r=[],i=[],n=[],o=t||e.split(/[\\/]/).pop()||"",s=Wn(o);r.push(...s.errors),i.push(...s.warnings),n.push(...s.suggestions);let a=AE(e);return r.push(...a.errors),i.push(...a.warnings),n.push(...a.suggestions),{valid:r.length===0,errors:[...new Set(r)],warnings:[...new Set(i)],suggestions:[...new Set(n)]}}});var X,ud,Gn,de,m,Ct=D(()=>{"use strict";X=V(ae(),1),ud={debug:0,info:1,warn:2,error:3,silent:4},Gn=class{level;prefix;colors;constructor(t={}){this.level=t.level||(process.env.DEBUG?"debug":"info"),this.prefix=t.prefix||"",this.colors=t.colors!==!1}shouldLog(t){return ud[t]>=ud[this.level]}format(t){return this.prefix?`${this.prefix} ${t}`:t}newline(){this.shouldLog("info")&&process.stdout.write(`
|
|
113
116
|
`)}print(t){this.shouldLog("info")&&process.stdout.write(t+`
|
|
114
|
-
`)}debug(t){this.shouldLog("debug")&&process.stdout.write(this.colors?
|
|
117
|
+
`)}debug(t){this.shouldLog("debug")&&process.stdout.write(this.colors?X.default.dim(`[debug] ${t}`)+`
|
|
115
118
|
`:`[debug] ${t}
|
|
116
|
-
`)}verbose(t){process.env.NEXO_VERBOSE==="true"&&process.stdout.write(this.colors?
|
|
119
|
+
`)}verbose(t){process.env.NEXO_VERBOSE==="true"&&process.stdout.write(this.colors?X.default.dim(`[verbose] ${t}`)+`
|
|
117
120
|
`:`[verbose] ${t}
|
|
118
121
|
`)}info(t){this.shouldLog("info")&&process.stdout.write(this.format(t)+`
|
|
119
|
-
`)}success(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
122
|
+
`)}success(t){this.shouldLog("info")&&process.stdout.write(this.colors?X.default.green(this.format(t))+`
|
|
120
123
|
`:this.format(t)+`
|
|
121
|
-
`)}warn(t){this.shouldLog("warn")&&process.stderr.write(this.colors?
|
|
124
|
+
`)}warn(t){this.shouldLog("warn")&&process.stderr.write(this.colors?X.default.yellow(`\u26A0 ${t}`)+`
|
|
122
125
|
`:`Warning: ${t}
|
|
123
|
-
`)}error(t){this.shouldLog("error")&&process.stderr.write(this.colors?
|
|
126
|
+
`)}error(t){this.shouldLog("error")&&process.stderr.write(this.colors?X.default.red(`\u2716 ${t}`)+`
|
|
124
127
|
`:`Error: ${t}
|
|
125
|
-
`)}dim(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
128
|
+
`)}dim(t){this.shouldLog("info")&&process.stdout.write(this.colors?X.default.dim(t)+`
|
|
126
129
|
`:t+`
|
|
127
|
-
`)}cyan(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
130
|
+
`)}cyan(t){this.shouldLog("info")&&process.stdout.write(this.colors?X.default.cyan(t)+`
|
|
128
131
|
`:t+`
|
|
129
|
-
`)}bold(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
132
|
+
`)}bold(t){this.shouldLog("info")&&process.stdout.write(this.colors?X.default.bold(t)+`
|
|
130
133
|
`:t+`
|
|
131
|
-
`)}header(t,r="info"){if(!this.shouldLog("info"))return;let i=this.colors?r==="error"?
|
|
132
|
-
`)}list(t,r=2){if(!this.shouldLog("info"))return;let i=" ".repeat(r);for(let n of t)process.stdout.write(this.colors?
|
|
134
|
+
`)}header(t,r="info"){if(!this.shouldLog("info"))return;let i=this.colors?r==="error"?X.default.bgRed(X.default.white(X.default.bold(` ${t} `))):r==="warning"?X.default.bgYellow(X.default.black(` ${t} `)):X.default.bgCyan(X.default.white(` ${t} `)):`[ ${t} ]`;process.stdout.write(i+`
|
|
135
|
+
`)}list(t,r=2){if(!this.shouldLog("info"))return;let i=" ".repeat(r);for(let n of t)process.stdout.write(this.colors?X.default.dim(`${i}${n}`)+`
|
|
133
136
|
`:`${i}${n}
|
|
134
|
-
`)}},
|
|
137
|
+
`)}},de=new Gn,m={newline:()=>de.newline(),print:e=>de.print(e),debug:e=>de.debug(e),verbose:e=>de.verbose(e),info:e=>de.info(e),success:e=>de.success(e),warn:e=>de.warn(e),error:e=>de.error(e),dim:e=>de.dim(e),cyan:e=>de.cyan(e),bold:e=>de.bold(e),header:(e,t)=>de.header(e,t),list:(e,t)=>de.list(e,t)}});var uu={};k(uu,{DEFAULT_PROJECT_NAME:()=>$c,Logger:()=>Gn,MAX_PATH_COMPONENT:()=>it,MIN_DISK_SPACE_BYTES:()=>br,PRESET_TEMPLATES:()=>$p,PackageManager:()=>Cn,VALID_OPTIONS:()=>Hn,WINDOWS_MAX_PATH:()=>$e,addDependencies:()=>ga,addDependenciesIf:()=>ab,addDependency:()=>vr,addScript:()=>qc,appendFile:()=>Ht,buildArray:()=>gb,buildObject:()=>Db,cache:()=>Ie,checkCompatibilityOrThrow:()=>id,checkDiskSpace:()=>zc,checkWritePermission:()=>Uc,clearCache:()=>tD,cloneTemplate:()=>da,compatibilityRules:()=>ni,copy:()=>Vc,createDirectories:()=>Lp,createFileIfNotExists:()=>ub,createFiles:()=>jp,createFilesFromRecord:()=>Bp,createProgressBar:()=>vE,createProjectDir:()=>Oi,createSimpleProgress:()=>FE,createSpinner:()=>ha,createStandardConfigurator:()=>mb,createStepProgress:()=>SE,createTimer:()=>xE,detectAvailableManagers:()=>Sn,detectPackageManagerUsed:()=>wn,detectProjectConfig:()=>Vs,doIf:()=>db,ensureDir:()=>x,generateFileTree:()=>Wt,generateImports:()=>lb,getCached:()=>Xg,getCachedSync:()=>Qg,getCompatibilityWarnings:()=>nd,getExtension:()=>hb,getInstallCommand:()=>jt,getPackageJson:()=>st,getPrefetchCommand:()=>vn,getPresetTemplate:()=>fa,getRunCommand:()=>Zp,invalidateCache:()=>eD,isDirEmpty:()=>Gs,log:()=>m,logger:()=>de,memoize:()=>rD,memoizeSync:()=>iD,pathExists:()=>ke,preWriteChecks:()=>Bs,prefetchCommonPackages:()=>cr,prefetchPackages:()=>Ue,prefetchedStats:()=>Un,readJson:()=>Us,remove:()=>Gc,removeFile:()=>Wc,sanitizeProjectName:()=>sd,savePackageJson:()=>Ri,selectIf:()=>fb,skipIfNone:()=>pb,spinner:()=>Xe,template:()=>cb,validateOption:()=>ou,validateOrThrow:()=>rd,validatePathLength:()=>Hc,validateProjectName:()=>Wn,validateProjectPath:()=>od,validateSelections:()=>au,writeFile:()=>w,writeJson:()=>We});var G=D(()=>{"use strict";Ws();Xc();el();Ls();ot();Np();Mp();En();Fn();zn();td();ma();Cr();ad();Ct()});var cd={};k(cd,{frameworkConfigurator:()=>_E});import Vn from"node:path";var _E,TE,ld=D(()=>{"use strict";G();_E=async e=>{let{variant:t}=e.selections,r=t.startsWith("ts");await TE(e,r,r?"ts":"js")},TE=async(e,t,r)=>{let{variant:i}=e.selections,n=i.includes("swc");e.pkg&&(e.pkg.add("react","^19.0.0"),e.pkg.add("react-dom","^19.0.0"),e.pkg.add("vite","^6.0.0",!0),n?e.pkg.add("@vitejs/plugin-react-swc","^3.7.0",!0):(e.pkg.add("@vitejs/plugin-react","^4.3.0",!0),e.pkg.add("@babel/core","^7.26.0",!0)),e.pkg.addScript("dev","vite"),e.pkg.addScript("build","vite build"),e.pkg.addScript("preview","vite preview"),e.pkg.set("type","module"));let o=n?"import react from '@vitejs/plugin-react-swc'":"import react from '@vitejs/plugin-react'",s=e.selections.importAlias,c=`${s?`import path from 'path';
|
|
135
138
|
import { fileURLToPath } from 'url';
|
|
136
139
|
`:""}${o}
|
|
137
140
|
import { defineConfig } from 'vite'${s?`
|
|
@@ -146,7 +149,7 @@ export default defineConfig({
|
|
|
146
149
|
},
|
|
147
150
|
},`:""}
|
|
148
151
|
})
|
|
149
|
-
`;await
|
|
152
|
+
`;await w(Vn.join(e.projectPath,`vite.config.${r}`),c);let l=e.selections.rtl===!0,p=`<!DOCTYPE html>
|
|
150
153
|
<html lang="${l?"ar":"en"}" dir="${l?"rtl":"ltr"}">
|
|
151
154
|
<head>
|
|
152
155
|
<meta charset="UTF-8" />
|
|
@@ -162,7 +165,7 @@ export default defineConfig({
|
|
|
162
165
|
<script type="module" src="/src/main.${t?"tsx":"jsx"}"></script>
|
|
163
166
|
</body>
|
|
164
167
|
</html>
|
|
165
|
-
`;await
|
|
168
|
+
`;await w(Vn.join(e.projectPath,"index.html"),p),await x(Vn.join(e.projectPath,"public")),await w(Vn.join(e.projectPath,"public","vite.svg"),'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFBD4F"></stop><stop offset="100%" stop-color="#FF980E"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>')}});var pd={};k(pd,{variantConfigurator:()=>OE});var OE,hd=D(()=>{"use strict";OE=async e=>{let{variant:t,framework:r}=e.selections;if(r!=="react")return;let i=t.includes("compiler"),n=t.includes("swc");e.pkg&&(i&&(e.pkg.add("babel-plugin-react-compiler","^19.0.0-beta-e552027-20250112",!0),e.pkg.add("eslint-plugin-react-compiler","^19.0.0-beta-e552027-20250112",!0),e.pkg.add("@babel/core","^7.26.0",!0),e.pkg.add("@babel/preset-react","^7.26.0",!0)),n&&e.pkg.add("@vitejs/plugin-react-swc","^3.7.0",!0))}});var md={};k(md,{languageConfigurator:()=>RE});import si from"node:path";var RE,dd=D(()=>{"use strict";G();RE=async e=>{let{variant:t,framework:r}=e.selections,i=t.startsWith("ts");if(e.pkg){if(i){e.pkg.add("typescript","^5.7.0",!0),r==="react"&&(e.pkg.add("@types/react","^19.0.0",!0),e.pkg.add("@types/react-dom","^19.0.0",!0));let a={compilerOptions:{target:"ES2022",useDefineForClassFields:!0,lib:["ES2022","DOM","DOM.Iterable"],module:"ESNext",skipLibCheck:!0,moduleResolution:"bundler",allowImportingTsExtensions:!0,resolveJsonModule:!0,isolatedModules:!0,noEmit:!0,jsx:r==="react"?"react-jsx":"preserve",strict:!0,noUnusedLocals:!0,noUnusedParameters:!0,noFallthroughCasesInSwitch:!0,...e.selections.importAlias?{baseUrl:".",paths:{"@/*":["./src/*"]}}:{}},include:["src"],references:[{path:"./tsconfig.node.json"}]};await We(si.join(e.projectPath,"tsconfig.json"),a);let u={compilerOptions:{composite:!0,skipLibCheck:!0,module:"ESNext",moduleResolution:"bundler",allowSyntheticDefaultImports:!0,strict:!0},include:["vite.config.ts"]};await We(si.join(e.projectPath,"tsconfig.node.json"),u)}e.pkg.addScript("build",i?"tsc && vite build":"vite build");let n=`import js from '@eslint/js';
|
|
166
169
|
import globals from 'globals';
|
|
167
170
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
168
171
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
@@ -195,7 +198,7 @@ export default tseslint.config(
|
|
|
195
198
|
},
|
|
196
199
|
},
|
|
197
200
|
);
|
|
198
|
-
`,{writeFile:o}=await Promise.resolve().then(()=>(
|
|
201
|
+
`,{writeFile:o}=await Promise.resolve().then(()=>(G(),uu));await o(si.join(e.projectPath,"eslint.config.js"),n),e.pkg.add("eslint","^9.15.0",!0),e.pkg.add("eslint-plugin-react-hooks","^5.0.0",!0),e.pkg.add("eslint-plugin-react-refresh","^0.4.14",!0),e.pkg.add("globals","^15.12.0",!0),e.pkg.add("typescript-eslint","^8.15.0",!0),e.pkg.add("@eslint/js","^9.15.0",!0)}await x(si.join(e.projectPath,".vscode")),await We(si.join(e.projectPath,".vscode","settings.json"),{"json.schemas":[],"typescript.tsdk":"node_modules/typescript/lib"})}});var fd={};k(fd,{stylingConfigurator:()=>$E});import oi from"node:path";var $E,gd=D(()=>{"use strict";G();$E=async e=>{let{variant:t}=e.selections,i=t.startsWith("ts")?"ts":"js",n=e.selections.rtl===!0;switch(e.selections.styling){case"tailwind":e.pkg&&(e.pkg.add("tailwindcss","^4.1.0",!0),e.pkg.add("@tailwindcss/vite","^4.1.0",!0));let s=`${t.includes("swc")?"import react from '@vitejs/plugin-react-swc'":"import react from '@vitejs/plugin-react'"}
|
|
199
202
|
import { defineConfig } from 'vite'
|
|
200
203
|
import tailwindcss from '@tailwindcss/vite'
|
|
201
204
|
|
|
@@ -205,7 +208,7 @@ export default defineConfig({
|
|
|
205
208
|
tailwindcss(),
|
|
206
209
|
],
|
|
207
210
|
})
|
|
208
|
-
`;await
|
|
211
|
+
`;await w(oi.join(e.projectPath,`vite.config.${i}`),s);let a=`@import "tailwindcss";
|
|
209
212
|
${n?`
|
|
210
213
|
@theme {
|
|
211
214
|
--font-sans: "Cairo", ui-sans-serif, system-ui, sans-serif;
|
|
@@ -217,65 +220,20 @@ ${n?`
|
|
|
217
220
|
|
|
218
221
|
body {
|
|
219
222
|
text-align: right;
|
|
220
|
-
}`:""}`;await
|
|
223
|
+
}`:""}`;await x(oi.join(e.projectPath,"src")),await w(oi.join(e.projectPath,"src","index.css"),a);break;case"css-modules":await x(oi.join(e.projectPath,"src")),await w(oi.join(e.projectPath,"src","index.css"),`/* CSS Modules - import styles from './Component.module.css' */
|
|
221
224
|
:root {
|
|
222
225
|
font-family: ${n?"'Cairo', ":""}system-ui, sans-serif;
|
|
223
226
|
}
|
|
224
227
|
${n?`body { text-align: right; }
|
|
225
|
-
`:""}`);break;
|
|
226
|
-
@import './styles/variables';
|
|
227
|
-
@import './styles/mixins';
|
|
228
|
+
`:""}`);break;default:break}}});var Dd={};k(Dd,{uiConfigurator:()=>IE});import lr from"node:path";var PE,IE,yd=D(()=>{"use strict";G();PE={shadcn:{"@radix-ui/react-slot":"^1.1.0","class-variance-authority":"^0.7.1",clsx:"^2.1.1","tailwind-merge":"^3.4.0"},radix:{"@radix-ui/react-dialog":"^1.4.0","@radix-ui/react-dropdown-menu":"^2.1.4","@radix-ui/react-slot":"^1.1.1"},heroui:{"@heroui/react":"^2.8.0","framer-motion":"^12.0.0"},mui:{"@mui/material":"^7.3.7","@emotion/react":"^11.14.0","@emotion/styled":"^11.14.0"},antd:{antd:"^6.0.0","@ant-design/icons":"^6.0.0"},chakra:{"@chakra-ui/react":"^3.31.0","@emotion/react":"^11.14.0"}},IE=async e=>{if(e.selections.ui==="none")return;let t=PE[e.selections.ui];if(t){if(e.pkg)for(let[r,i]of Object.entries(t))e.pkg.add(r,i);if(e.selections.ui==="heroui"){let i=e.selections.variant.startsWith("ts")?"ts":"js";await w(lr.join(e.projectPath,`src/hero.${i}`),`import { heroui } from "@heroui/react";
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
margin: 0;
|
|
231
|
-
padding: 0;
|
|
232
|
-
box-sizing: border-box;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
:root {
|
|
236
|
-
font-family: $font-family;
|
|
237
|
-
line-height: 1.5;
|
|
238
|
-
}
|
|
239
|
-
`),await E(je.join(e.projectPath,"src","styles","_variables.scss"),`// Colors
|
|
240
|
-
$primary: #646cff;
|
|
241
|
-
$secondary: #535bf2;
|
|
242
|
-
$background: #ffffff;
|
|
243
|
-
$text: #213547;
|
|
244
|
-
|
|
245
|
-
// Typography
|
|
246
|
-
$font-family: ${n?"'Cairo', ":""}system-ui, -apple-system, sans-serif;
|
|
247
|
-
$font-size-base: 16px;
|
|
248
|
-
|
|
249
|
-
// Spacing
|
|
250
|
-
$spacing-unit: 8px;
|
|
251
|
-
`),await E(je.join(e.projectPath,"src","styles","_mixins.scss"),`// Responsive breakpoints
|
|
252
|
-
@mixin mobile {
|
|
253
|
-
@media (max-width: 768px) {
|
|
254
|
-
@content;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
@mixin tablet {
|
|
259
|
-
@media (max-width: 1024px) {
|
|
260
|
-
@content;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Flexbox helpers
|
|
265
|
-
@mixin flex-center {
|
|
266
|
-
display: flex;
|
|
267
|
-
align-items: center;
|
|
268
|
-
justify-content: center;
|
|
269
|
-
}
|
|
270
|
-
`);break;default:break}}});var nd={};O(nd,{uiConfigurator:()=>xw});import{appendFile as Sw}from"node:fs/promises";import ar from"node:path";var Fw,xw,sd=D(()=>{"use strict";q();Fw={shadcn:{"@radix-ui/react-slot":"^1.1.0","class-variance-authority":"^0.7.1",clsx:"^2.1.1","tailwind-merge":"^3.4.0"},radix:{"@radix-ui/react-dialog":"^1.4.0","@radix-ui/react-dropdown-menu":"^2.1.4","@radix-ui/react-slot":"^1.1.1"},heroui:{"@heroui/react":"^2.8.0","framer-motion":"^12.0.0"},mui:{"@mui/material":"^7.3.7","@emotion/react":"^11.14.0","@emotion/styled":"^11.14.0"},antd:{antd:"^6.0.0","@ant-design/icons":"^6.0.0"},chakra:{"@chakra-ui/react":"^3.31.0","@emotion/react":"^11.14.0"},"styled-components":{"styled-components":"^6.3.8"}},xw=async e=>{if(e.selections.ui==="none")return;let t=Fw[e.selections.ui];if(t){if(e.pkg)for(let[r,i]of Object.entries(t))e.pkg.add(r,i);if(e.selections.ui==="heroui"){let i=e.selections.variant.startsWith("ts")?"ts":"js";await E(ar.join(e.projectPath,`src/hero.${i}`),`import { heroui } from "@heroui/react";
|
|
271
|
-
|
|
272
|
-
export default heroui();`)}if(e.selections.ui==="shadcn"){let r=e.selections.variant.startsWith("ts"),i=r?"ts":"js";await k(ar.join(e.projectPath,"src/lib")),await E(ar.join(e.projectPath,"src/lib",`utils.${i}`),`import { clsx, type ClassValue } from "clsx"
|
|
230
|
+
export default heroui();`)}if(e.selections.ui==="shadcn"){let r=e.selections.variant.startsWith("ts"),i=r?"ts":"js";await x(lr.join(e.projectPath,"src/lib")),await w(lr.join(e.projectPath,"src/lib",`utils.${i}`),`import { clsx, type ClassValue } from "clsx"
|
|
273
231
|
import { twMerge } from "tailwind-merge"
|
|
274
232
|
|
|
275
233
|
export function cn(...inputs: ClassValue[]) {
|
|
276
234
|
return twMerge(clsx(inputs))
|
|
277
235
|
}
|
|
278
|
-
`);let o={$schema:"https://ui.shadcn.com/schema.json",style:"new-york",rsc:!1,tsx:r,tailwind:{config:"tailwind.config.js",css:"src/index.css",baseColor:"slate",cssVariables:!0,prefix:""},aliases:{components:"@/components",utils:"@/lib/utils"}};await
|
|
236
|
+
`);let o={$schema:"https://ui.shadcn.com/schema.json",style:"new-york",rsc:!1,tsx:r,tailwind:{config:"tailwind.config.js",css:"src/index.css",baseColor:"slate",cssVariables:!0,prefix:""},aliases:{components:"@/components",utils:"@/lib/utils"}};await w(lr.join(e.projectPath,"components.json"),JSON.stringify(o,null,2)),await Ht(lr.join(e.projectPath,"src/index.css"),`
|
|
279
237
|
@layer base {
|
|
280
238
|
:root {
|
|
281
239
|
--background: 0 0% 100%;
|
|
@@ -347,7 +305,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
347
305
|
@plugin "./hero.${e.selections.variant.startsWith("ts")?"ts":"js"}";
|
|
348
306
|
@source "../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}";
|
|
349
307
|
@custom-variant dark (&:is(.dark *));
|
|
350
|
-
`;await
|
|
308
|
+
`;await w(lr.join(e.projectPath,"src/index.css"),n)}}}});var pr,qn=D(()=>{"use strict";pr=(e,t,r={})=>async i=>{let n=i.selections[e];if(!n||n==="none"||r.skipIf?.(i))return;let o=t[n];if(o){if(i.pkg)for(let[s,a]of Object.entries(o))i.pkg.add(s,a);r.afterInstall&&await r.afterInstall(i,n)}}});var bd={};k(bd,{iconsConfigurator:()=>jE});var NE,jE,Cd=D(()=>{"use strict";qn();NE={lucide:{"lucide-react":"^0.563.0"},"react-icons":{"react-icons":"^5.5.0"},iconify:{"@iconify/react":"^6.0.2"},heroicons:{"@heroicons/react":"^2.2.0"}},jE=pr("icons",NE)});var Ed={};k(Ed,{formsConfigurator:()=>LE});var BE,LE,wd=D(()=>{"use strict";qn();BE={"rhf-zod":{"react-hook-form":"^7.60.0",zod:"^3.25.0","@hookform/resolvers":"^3.9.0"},"rhf-yup":{"react-hook-form":"^7.60.0",yup:"^1.6.0","@hookform/resolvers":"^3.9.0"},"tanstack-form":{"@tanstack/react-form":"^1.31.0",zod:"^3.25.0"}},LE=pr("forms",BE)});var vd={};k(vd,{stateConfigurator:()=>UE});var ME,UE,Sd=D(()=>{"use strict";ME={zustand:{zustand:"^5.0.0"},redux:{"@reduxjs/toolkit":"^2.11.0","react-redux":"^9.2.0"},jotai:{jotai:"^2.17.0"}},UE=async e=>{if(e.selections.state==="none")return;let t=ME[e.selections.state];if(t&&t){if(e.pkg)for(let[r,i]of Object.entries(t))e.pkg.add(r,i);if(e.selections.state==="redux"){let r=e.selections.variant.startsWith("ts"),i=r?"ts":"js",{writeFile:n,ensureDir:o}=await Promise.resolve().then(()=>(G(),uu)),s=await import("node:path");await o(s.join(e.projectPath,"src/store"));let a=`import { configureStore } from '@reduxjs/toolkit'
|
|
351
309
|
import counterReducer from './counterSlice'
|
|
352
310
|
|
|
353
311
|
export const store = configureStore({
|
|
@@ -398,7 +356,123 @@ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
|
|
|
398
356
|
|
|
399
357
|
export const useAppDispatch = useDispatch
|
|
400
358
|
export const useAppSelector = useSelector
|
|
401
|
-
`;await n(s.join(e.projectPath,"src/store",`hooks.${i}`),c),await n(s.join(e.projectPath,"src/store",`hooks.${i}`),c)}}}});var
|
|
359
|
+
`;await n(s.join(e.projectPath,"src/store",`hooks.${i}`),c),await n(s.join(e.projectPath,"src/store",`hooks.${i}`),c)}}}});var Fd={};k(Fd,{routingConfigurator:()=>zE});var zE,xd=D(()=>{"use strict";zE=async e=>{let{routing:t}=e.selections;t==="react-router"?e.pkg&&e.pkg.add("react-router-dom","^7.13.0"):t==="tanstack-router"&&e.pkg&&(e.pkg.add("@tanstack/react-router","^1.157.0"),e.pkg.add("@tanstack/react-router-devtools","^1.157.0"))}});var kd={};k(kd,{dataFetchingConfigurator:()=>HE});var HE,Ad=D(()=>{"use strict";HE=async e=>{let{dataFetching:t,framework:r}=e.selections;!t||t==="none"||t==="fetch"||e.pkg&&(t==="tanstack-query"&&r==="react"?(e.pkg.add("@tanstack/react-query","^5.90.0"),e.pkg.add("@tanstack/react-query-devtools","^5.90.0")):t==="axios"&&e.pkg.add("axios","^1.9.0"))}});var _d={};k(_d,{animationConfigurator:()=>GE});var WE,GE,Td=D(()=>{"use strict";qn();WE={"framer-motion":{"framer-motion":"^12.0.0"},gsap:{gsap:"^3.14.2","@gsap/react":"^2.1.2"}},GE=pr("animation",WE)});var Od={};k(Od,{backendConfigurator:()=>QE});import Qe from"node:path";var VE,qE,YE,KE,ZE,JE,XE,QE,Rd=D(()=>{"use strict";G();VE={supabase:{"@supabase/supabase-js":"^2.93.0"},firebase:{firebase:"^12.8.0"},clerk:{"@clerk/clerk-react":"^5.60.0"},prisma:{"@prisma/client":"^7.3.0"}},qE=e=>`import { createClient } from '@supabase/supabase-js'
|
|
360
|
+
|
|
361
|
+
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
|
|
362
|
+
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY
|
|
363
|
+
|
|
364
|
+
if (!supabaseUrl || !supabaseAnonKey) {
|
|
365
|
+
throw new Error('Missing Supabase environment variables')
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
|
369
|
+
`,YE=e=>`import { initializeApp } from 'firebase/app'
|
|
370
|
+
import { getAuth } from 'firebase/auth'
|
|
371
|
+
import { getFirestore } from 'firebase/firestore'
|
|
372
|
+
|
|
373
|
+
const firebaseConfig = {
|
|
374
|
+
apiKey: import.meta.env.VITE_FIREBASE_API_KEY,
|
|
375
|
+
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN,
|
|
376
|
+
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID,
|
|
377
|
+
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET,
|
|
378
|
+
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID,
|
|
379
|
+
appId: import.meta.env.VITE_FIREBASE_APP_ID,
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export const app = initializeApp(firebaseConfig)
|
|
383
|
+
export const auth = getAuth(app)
|
|
384
|
+
export const db = getFirestore(app)
|
|
385
|
+
`,KE=e=>e?`import { ClerkProvider } from '@clerk/clerk-react'
|
|
386
|
+
|
|
387
|
+
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY
|
|
388
|
+
|
|
389
|
+
if (!PUBLISHABLE_KEY) {
|
|
390
|
+
throw new Error('Missing Clerk Publishable Key')
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
interface ClerkAuthProviderProps {
|
|
394
|
+
children: React.ReactNode
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export function ClerkAuthProvider({ children }: ClerkAuthProviderProps) {
|
|
398
|
+
return (
|
|
399
|
+
<ClerkProvider publishableKey={PUBLISHABLE_KEY}>
|
|
400
|
+
{children}
|
|
401
|
+
</ClerkProvider>
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
`:`import { ClerkProvider } from '@clerk/clerk-react'
|
|
405
|
+
|
|
406
|
+
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY
|
|
407
|
+
|
|
408
|
+
if (!PUBLISHABLE_KEY) {
|
|
409
|
+
throw new Error('Missing Clerk Publishable Key')
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export function ClerkAuthProvider({ children }) {
|
|
413
|
+
return (
|
|
414
|
+
<ClerkProvider publishableKey={PUBLISHABLE_KEY}>
|
|
415
|
+
{children}
|
|
416
|
+
</ClerkProvider>
|
|
417
|
+
)
|
|
418
|
+
}
|
|
419
|
+
`,ZE=e=>e?`import { PrismaClient } from '@prisma/client'
|
|
420
|
+
|
|
421
|
+
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
|
|
422
|
+
|
|
423
|
+
export const prisma = globalForPrisma.prisma || new PrismaClient()
|
|
424
|
+
|
|
425
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
|
426
|
+
|
|
427
|
+
export default prisma
|
|
428
|
+
`:`import { PrismaClient } from '@prisma/client'
|
|
429
|
+
|
|
430
|
+
const globalForPrisma = globalThis
|
|
431
|
+
|
|
432
|
+
export const prisma = globalForPrisma.prisma || new PrismaClient()
|
|
433
|
+
|
|
434
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
|
435
|
+
|
|
436
|
+
export default prisma
|
|
437
|
+
`,JE=`// Prisma Schema
|
|
438
|
+
// Learn more: https://pris.ly/d/prisma-schema
|
|
439
|
+
|
|
440
|
+
generator client {
|
|
441
|
+
provider = "prisma-client-js"
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
datasource db {
|
|
445
|
+
provider = "postgresql"
|
|
446
|
+
url = env("DATABASE_URL")
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Example model - customize as needed
|
|
450
|
+
model User {
|
|
451
|
+
id String @id @default(cuid())
|
|
452
|
+
email String @unique
|
|
453
|
+
name String?
|
|
454
|
+
createdAt DateTime @default(now())
|
|
455
|
+
updatedAt DateTime @updatedAt
|
|
456
|
+
}
|
|
457
|
+
`,XE={supabase:`
|
|
458
|
+
# Supabase Configuration
|
|
459
|
+
VITE_SUPABASE_URL=your-supabase-project-url
|
|
460
|
+
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key
|
|
461
|
+
`,firebase:`
|
|
462
|
+
# Firebase Configuration
|
|
463
|
+
VITE_FIREBASE_API_KEY=your-api-key
|
|
464
|
+
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
|
|
465
|
+
VITE_FIREBASE_PROJECT_ID=your-project-id
|
|
466
|
+
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
|
|
467
|
+
VITE_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
|
|
468
|
+
VITE_FIREBASE_APP_ID=your-app-id
|
|
469
|
+
`,clerk:`
|
|
470
|
+
# Clerk Authentication
|
|
471
|
+
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your-publishable-key
|
|
472
|
+
`,prisma:`
|
|
473
|
+
# Database Connection (Prisma)
|
|
474
|
+
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
|
|
475
|
+
`},QE=async e=>{let t=e.selections.backend;if(!t||t==="none")return;let r=VE[t];if(!r)return;let i=e.selections.variant.startsWith("ts"),n=i?"ts":"js",o=i?"tsx":"jsx";if(e.pkg)for(let[a,u]of Object.entries(r))e.pkg.add(a,u);await x(Qe.join(e.projectPath,"src/lib")),t==="supabase"&&await w(Qe.join(e.projectPath,"src/lib",`supabase.${n}`),qE(i)),t==="firebase"&&await w(Qe.join(e.projectPath,"src/lib",`firebase.${n}`),YE(i)),t==="clerk"&&(await x(Qe.join(e.projectPath,"src/providers")),await w(Qe.join(e.projectPath,"src/providers",`clerk.${o}`),KE(i))),t==="prisma"&&(await w(Qe.join(e.projectPath,"src/lib",`prisma.${n}`),ZE(i)),await x(Qe.join(e.projectPath,"prisma")),await w(Qe.join(e.projectPath,"prisma","schema.prisma"),JE));let s=XE[t];if(s){let a=Qe.join(e.projectPath,".env.example");await ke(a)?await Ht(a,s):await w(a,`# Environment Variables${s}`)}}});var $d={};k($d,{structureConfigurator:()=>tw});import ew from"node:path";var tw,Pd=D(()=>{"use strict";G();tw=async e=>{let t=[];switch(e.selections.structure){case"feature-based":t.push("src/app","src/features","src/shared/components","src/shared/hooks","src/shared/utils","src/shared/types");break;case"simple":default:t.push("src/components","src/hooks","src/utils","src/assets");break}for(let r of t){let i=ew.join(e.projectPath,r);await x(i)}}});var Id={};k(Id,{mandatoryConfigurator:()=>sw});import{exec as rw}from"node:child_process";import Yn from"node:path";import{promisify as iw}from"node:util";var nw,sw,Nd=D(()=>{"use strict";G();nw=iw(rw),sw=async e=>{let{projectName:t}=e.selections,r={name:t,short_name:t,theme_color:"#ffffff",background_color:"#ffffff",display:"standalone",start_url:"/",icons:[{src:"/icon-192.png",sizes:"192x192",type:"image/png"},{src:"/icon-512.png",sizes:"512x512",type:"image/png"}]};await x(Yn.join(e.projectPath,"public")),await w(Yn.join(e.projectPath,"public","manifest.json"),JSON.stringify(r,null,2)),await w(Yn.join(e.projectPath,".gitignore"),`# Dependencies
|
|
402
476
|
node_modules
|
|
403
477
|
.pnp
|
|
404
478
|
.pnp.js
|
|
@@ -495,7 +569,7 @@ npm run dev
|
|
|
495
569
|
## License
|
|
496
570
|
|
|
497
571
|
MIT
|
|
498
|
-
`;await
|
|
572
|
+
`;await w(Yn.join(e.projectPath,"README.md"),n);try{await nw('git init && git add -A && git commit -m "Initial commit from NEXO"',{cwd:e.projectPath})}catch{}}});var jd={};k(jd,{aiInstructionsConfigurator:()=>yw});import Lt from"path";var ai,ow,aw,uw,cw,lw,pw,hw,mw,dw,fw,gw,Dw,yw,Bd=D(()=>{"use strict";ot();ai=(e,t)=>`# ${t} - ${e.projectName}
|
|
499
573
|
|
|
500
574
|
## Project Overview
|
|
501
575
|
This is a **${e.framework}** application built with modern best practices and tools.
|
|
@@ -764,7 +838,7 @@ npm run lint # Lint code
|
|
|
764
838
|
- **Respect the project structure** - Place files in the correct directories
|
|
765
839
|
- **Write self-documenting code** - Clear names over comments when possible
|
|
766
840
|
- **Generate complete code** - No placeholders or incomplete implementations
|
|
767
|
-
`,
|
|
841
|
+
`,ow=e=>`# Cursor Rules for ${e.projectName}
|
|
768
842
|
|
|
769
843
|
You are an expert ${e.framework} developer working on this project.
|
|
770
844
|
|
|
@@ -806,7 +880,7 @@ ${e.hasTesting?"5. Write tests alongside features":""}
|
|
|
806
880
|
- Handle errors gracefully
|
|
807
881
|
- Consider accessibility
|
|
808
882
|
- Optimize for performance
|
|
809
|
-
`,
|
|
883
|
+
`,aw=e=>`# Windsurf Rules for ${e.projectName}
|
|
810
884
|
|
|
811
885
|
Project: ${e.framework} with ${e.variant}
|
|
812
886
|
Architecture: ${e.structure}
|
|
@@ -834,7 +908,7 @@ ${e.structure}
|
|
|
834
908
|
dev: npm run dev
|
|
835
909
|
build: npm run build
|
|
836
910
|
${e.hasTesting?"test: npm test":""}
|
|
837
|
-
`,
|
|
911
|
+
`,uw=e=>`# Cline Rules
|
|
838
912
|
|
|
839
913
|
## Project Details
|
|
840
914
|
- Framework: ${e.framework}
|
|
@@ -882,7 +956,7 @@ npm run dev # Development
|
|
|
882
956
|
npm run build # Production build
|
|
883
957
|
${e.hasTesting?"npm test # Run tests":""}
|
|
884
958
|
\`\`\`
|
|
885
|
-
`,
|
|
959
|
+
`,cw=e=>`# Roo-Cline Instructions for ${e.projectName}
|
|
886
960
|
|
|
887
961
|
## Project Configuration
|
|
888
962
|
- **Framework**: ${e.framework}
|
|
@@ -967,7 +1041,7 @@ npm run lint \u2192 Lint code
|
|
|
967
1041
|
- Keep code clean and well-organized
|
|
968
1042
|
- Write self-documenting code
|
|
969
1043
|
- Ask before introducing new patterns
|
|
970
|
-
`,
|
|
1044
|
+
`,lw=e=>`# Aider configuration for ${e.projectName}
|
|
971
1045
|
|
|
972
1046
|
## Project Info
|
|
973
1047
|
framework: ${e.framework}
|
|
@@ -992,7 +1066,7 @@ ${e.structure}
|
|
|
992
1066
|
dev: "npm run dev"
|
|
993
1067
|
build: "npm run build"
|
|
994
1068
|
${e.hasTesting?'test: "npm test"':""}
|
|
995
|
-
`,
|
|
1069
|
+
`,pw=e=>ai(e,"Claude Development Instructions"),hw=e=>ai(e,"Gemini Development Instructions"),mw=e=>ai(e,"OpenAI Codex Instructions"),dw=e=>ai(e,"AI Development Instructions"),fw=e=>`---
|
|
996
1070
|
description: React & UI Best Practices
|
|
997
1071
|
globs: ["**/*.tsx", "**/*.jsx"]
|
|
998
1072
|
---
|
|
@@ -1004,7 +1078,7 @@ globs: ["**/*.tsx", "**/*.jsx"]
|
|
|
1004
1078
|
${e.ui!=="none"?`- Use ${e.ui} components`:""}
|
|
1005
1079
|
- Implement error boundaries
|
|
1006
1080
|
- Use React.memo/useMemo/useCallback appropriately
|
|
1007
|
-
`,
|
|
1081
|
+
`,gw=e=>`---
|
|
1008
1082
|
description: TypeScript & Code Quality
|
|
1009
1083
|
globs: ["**/*.ts", "**/*.tsx"]
|
|
1010
1084
|
---
|
|
@@ -1014,7 +1088,7 @@ globs: ["**/*.ts", "**/*.tsx"]
|
|
|
1014
1088
|
- Explicit return types for exported functions
|
|
1015
1089
|
- Use interfaces for object definitions
|
|
1016
1090
|
- Strict null checks enabled
|
|
1017
|
-
`,
|
|
1091
|
+
`,Dw=e=>`---
|
|
1018
1092
|
description: General Project Context & Architecture
|
|
1019
1093
|
globs: ["*"]
|
|
1020
1094
|
---
|
|
@@ -1029,46 +1103,46 @@ globs: ["*"]
|
|
|
1029
1103
|
${e.structure==="feature-based"?"Feature-based: src/features/[feature]":""}
|
|
1030
1104
|
${e.structure==="fsd"?"FSD Layers: app/pages/widgets/features/entities/shared":""}
|
|
1031
1105
|
${e.structure==="simple"?"Simple: components/hooks/utils":""}
|
|
1032
|
-
`,
|
|
1106
|
+
`,yw=async({projectPath:e,selections:t})=>{let r=t.aiInstructions||[],i={projectName:t.projectName||Lt.basename(e),framework:t.framework,variant:t.variant,styling:t.styling,ui:t.ui||"none",forms:t.forms||"none",state:t.state||"none",routing:t.routing||"none",dataFetching:t.dataFetching||"none",structure:t.structure||"feature-based",icons:t.icons||"none",hasTesting:t.testing!==void 0&&t.testing!=="none",language:"en"},n=Lt.join(e,".nexo");if(await x(n),await w(Lt.join(n,"ai-context.md"),ai(i,"Project Context")),r.length===0)return;let o={cursor:{file:".cursorrules",generate:ow},"cursor-modular":{isModular:!0,generators:{".cursor/rules/react.mdc":fw,".cursor/rules/typescript.mdc":gw,".cursor/rules/general.mdc":Dw}},windsurf:{file:".windsurfrules",generate:aw},cline:{file:".clinerules",generate:uw},"roo-cline":{file:".roo-clinerules",generate:cw},aider:{file:".aider.conf.yml",generate:lw},claude:{file:"CLAUDE_INSTRUCTIONS.md",generate:pw},gemini:{file:"GEMINI_INSTRUCTIONS.md",generate:hw},codex:{file:"CODEX_INSTRUCTIONS.md",generate:mw},universal:{file:"AI_INSTRUCTIONS.md",generate:dw}};for(let s of r){let a=o[s];if(a)if(a.isModular&&a.generators)for(let[u,c]of Object.entries(a.generators))await x(Lt.dirname(Lt.join(e,u))),await w(Lt.join(e,u),c(i));else a.file&&a.generate&&await w(Lt.join(e,a.file),a.generate(i))}}});var Ld={};k(Ld,{testingConfigurator:()=>bw});var bw,Md=D(()=>{"use strict";bw=async e=>{let{testing:t}=e.selections;!t||t==="none"||e.pkg&&(t==="vitest"?(e.pkg.add("vitest","^3.4.0",!0),e.pkg.add("@testing-library/react","^16.3.0",!0),e.pkg.add("@testing-library/dom","^10.0.0",!0),e.pkg.add("jsdom","^26.0.0",!0),e.pkg.addScript("test","vitest"),e.pkg.addScript("test:ui","vitest --ui"),e.pkg.addScript("test:run","vitest run")):t==="jest"&&(e.pkg.add("jest","^29.7.0",!0),e.pkg.add("jest-environment-jsdom","^29.7.0",!0),e.pkg.add("@testing-library/react","^16.3.0",!0),e.pkg.add("@testing-library/dom","^10.0.0",!0),e.pkg.add("@types/jest","^29.5.0",!0),e.pkg.add("ts-jest","^29.1.0",!0),e.pkg.addScript("test","jest"),e.pkg.addScript("test:watch","jest --watch")))}});var Ud={};k(Ud,{lintingConfigurator:()=>Cw});var Cw,zd=D(()=>{"use strict";Cw=async e=>{let{linting:t}=e.selections;!t||t==="none"||e.pkg&&(t==="eslint-prettier"?(e.pkg.add("eslint","^9.39.0",!0),e.pkg.add("prettier","^3.7.0",!0),e.pkg.add("eslint-plugin-react-hooks","^5.0.0",!0),e.pkg.add("eslint-plugin-react-refresh","^0.4.0",!0),e.pkg.addScript("lint","eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"),e.pkg.addScript("format",'prettier --write "src/**/*.{ts,tsx,css,json}"')):t==="biome"&&(e.pkg.add("@biomejs/biome","^2.0.0",!0),e.pkg.addScript("lint","biome lint ."),e.pkg.addScript("format","biome format . --write"),e.pkg.addScript("check","biome check --apply .")))}});var Hd={};k(Hd,{docsConfigurator:()=>ww});import Ew from"node:path";function vw(e){switch(e){case"Core":return"\u{1F3AF}";case"Styling":return"\u{1F3A8}";case"UI Components":return"\u{1F9E9}";case"State Management":return"\u{1F4CA}";case"Routing":return"\u{1F500}";case"Data Fetching":return"\u{1F4E1}";case"Forms":return"\u{1F4DD}";case"Icons":return"\u2728";case"Animation":return"\u{1F3AD}";case"Quality Assurance":return"\u2705";default:return"\u{1F4C4}"}}var P,ww,Wd=D(()=>{"use strict";G();P={react:{name:"React",url:"https://react.dev"},vite:{name:"Vite",url:"https://vitejs.dev"},"next.js":{name:"Next.js",url:"https://nextjs.org/docs"},tailwind:{name:"Tailwind CSS",url:"https://tailwindcss.com/docs"},"css-modules":{name:"CSS Modules",url:"https://github.com/css-modules/css-modules"},shadcn:{name:"Shadcn/ui",url:"https://ui.shadcn.com/docs"},mui:{name:"Material UI",url:"https://mui.com/material-ui/getting-started"},antd:{name:"Ant Design",url:"https://ant.design/components/overview"},chakra:{name:"Chakra UI",url:"https://chakra-ui.com/docs/get-started"},heroui:{name:"HeroUI",url:"https://heroui.com/docs/guide/introduction"},radix:{name:"Radix UI",url:"https://www.radix-ui.com/primitives/docs/overview/introduction"},zustand:{name:"Zustand",url:"https://zustand.docs.pmnd.rs"},redux:{name:"Redux Toolkit",url:"https://redux-toolkit.js.org/introduction/getting-started"},jotai:{name:"Jotai",url:"https://jotai.org/docs/introduction"},"react-router":{name:"React Router",url:"https://reactrouter.com/en/main"},"tanstack-router":{name:"TanStack Router",url:"https://tanstack.com/router/latest/docs/framework/react/overview"},"tanstack-query":{name:"TanStack Query",url:"https://tanstack.com/query/latest/docs/react/overview"},axios:{name:"Axios",url:"https://axios-http.com/docs/intro"},"rhf-zod":{name:"React Hook Form + Zod",url:"https://react-hook-form.com/get-started"},"rhf-yup":{name:"React Hook Form + Yup",url:"https://react-hook-form.com/get-started"},"tanstack-form":{name:"TanStack Form",url:"https://tanstack.com/form/latest/docs/overview"},lucide:{name:"Lucide Icons",url:"https://lucide.dev/guide"},"react-icons":{name:"React Icons",url:"https://react-icons.github.io/react-icons"},iconify:{name:"Iconify",url:"https://iconify.design/docs"},heroicons:{name:"Heroicons",url:"https://heroicons.com"},"framer-motion":{name:"Framer Motion",url:"https://motion.dev/docs/react-quick-start"},gsap:{name:"GSAP",url:"https://gsap.com/docs/v3"},vitest:{name:"Vitest",url:"https://vitest.dev/guide"},jest:{name:"Jest",url:"https://jestjs.io/docs/getting-started"},"eslint-prettier":{name:"ESLint + Prettier",url:"https://eslint.org/docs/latest/use/getting-started"},biome:{name:"Biome",url:"https://biomejs.dev/guides/getting-started"}},ww=async e=>{let{framework:t,styling:r,ui:i,state:n,routing:o,dataFetching:s,forms:a,icons:u,animation:c,testing:l,linting:p}=e.selections,h={Core:[],Styling:[],"UI Components":[],"State Management":[],Routing:[],"Data Fetching":[],Forms:[],Icons:[],Animation:[],"Quality Assurance":[]};t&&P[t]&&h.Core.push(P[t]),P.vite&&h.Core.push(P.vite),r&&P[r]&&h.Styling.push(P[r]),i&&P[i]&&h["UI Components"].push(P[i]),n&&P[n]&&h["State Management"].push(P[n]),o&&P[o]&&h.Routing.push(P[o]),s&&P[s]&&h["Data Fetching"].push(P[s]),a&&P[a]&&h.Forms.push(P[a]),u&&P[u]&&h.Icons.push(P[u]),c&&P[c]&&h.Animation.push(P[c]),l&&P[l]&&h["Quality Assurance"].push(P[l]),p&&P[p]&&h["Quality Assurance"].push(P[p]);let d=`# \u{1F4DA} Documentation Links
|
|
1033
1107
|
|
|
1034
1108
|
Quick reference to official documentation for your project stack.
|
|
1035
1109
|
|
|
1036
|
-
`;for(let[g,y]of Object.entries(
|
|
1037
|
-
`,y.forEach(v=>{
|
|
1038
|
-
`}),
|
|
1039
|
-
`);
|
|
1110
|
+
`;for(let[g,y]of Object.entries(h))y.length>0&&(d+=`## ${vw(g)} ${g}
|
|
1111
|
+
`,y.forEach(v=>{d+=`- [${v.name}](${v.url})
|
|
1112
|
+
`}),d+=`
|
|
1113
|
+
`);d+=`---
|
|
1040
1114
|
Generated by NEXO CLI
|
|
1041
|
-
`,await
|
|
1115
|
+
`,await w(Ew.join(e.projectPath,"DOCS.md"),d)}});var lu,cu,Vd,Gd,qd,Yd,Kd=D(()=>{"use strict";lu={framework:{loader:()=>Promise.resolve().then(()=>(ld(),cd)),exportName:"frameworkConfigurator"},variant:{loader:()=>Promise.resolve().then(()=>(hd(),pd)),exportName:"variantConfigurator",dependencies:["framework"]},language:{loader:()=>Promise.resolve().then(()=>(dd(),md)),exportName:"languageConfigurator",dependencies:["variant"]},styling:{loader:()=>Promise.resolve().then(()=>(gd(),fd)),exportName:"stylingConfigurator",dependencies:["language"]},ui:{loader:()=>Promise.resolve().then(()=>(yd(),Dd)),exportName:"uiConfigurator",dependencies:["styling"],condition:e=>e.selections.ui!=="none"},icons:{loader:()=>Promise.resolve().then(()=>(Cd(),bd)),exportName:"iconsConfigurator",dependencies:["language"],condition:e=>e.selections.icons!=="none"},forms:{loader:()=>Promise.resolve().then(()=>(wd(),Ed)),exportName:"formsConfigurator",dependencies:["language"],condition:e=>e.selections.forms!=="none"},state:{loader:()=>Promise.resolve().then(()=>(Sd(),vd)),exportName:"stateConfigurator",dependencies:["language"],condition:e=>e.selections.state!=="none"},routing:{loader:()=>Promise.resolve().then(()=>(xd(),Fd)),exportName:"routingConfigurator",dependencies:["language"],condition:e=>e.selections.routing!=="none"},dataFetching:{loader:()=>Promise.resolve().then(()=>(Ad(),kd)),exportName:"dataFetchingConfigurator",dependencies:["language"],condition:e=>e.selections.dataFetching!=="none"},animation:{loader:()=>Promise.resolve().then(()=>(Td(),_d)),exportName:"animationConfigurator",dependencies:["language"],condition:e=>e.selections.animation!==void 0&&e.selections.animation!=="none"},backend:{loader:()=>Promise.resolve().then(()=>(Rd(),Od)),exportName:"backendConfigurator",dependencies:["language"],condition:e=>e.selections.backend!==void 0&&e.selections.backend!=="none"},structure:{loader:()=>Promise.resolve().then(()=>(Pd(),$d)),exportName:"structureConfigurator",dependencies:["language"]},mandatory:{loader:()=>Promise.resolve().then(()=>(Nd(),Id)),exportName:"mandatoryConfigurator",dependencies:["styling","structure"]},"ai-instructions":{loader:()=>Promise.resolve().then(()=>(Bd(),jd)),exportName:"aiInstructionsConfigurator",dependencies:["language"],condition:e=>{let t=e.selections.aiInstructions;return t!==void 0&&t.length>0}},testing:{loader:()=>Promise.resolve().then(()=>(Md(),Ld)),exportName:"testingConfigurator",dependencies:["mandatory"],condition:e=>e.selections.testing!==void 0&&e.selections.testing!=="none"},linting:{loader:()=>Promise.resolve().then(()=>(zd(),Ud)),exportName:"lintingConfigurator",dependencies:["mandatory"],condition:e=>e.selections.linting!==void 0&&e.selections.linting!=="none"},docs:{loader:()=>Promise.resolve().then(()=>(Wd(),Hd)),exportName:"docsConfigurator",dependencies:["mandatory"]}},cu=new Map,Vd=async(e,t={})=>{let r=lu[e];if(!r)return console.warn(`Unknown configurator: ${e}`),null;let{cache:i=!0}=t,n=e;if(i&&cu.has(n)){let o=cu.get(n);return Gd(o,r.exportName||e)}try{let o=await r.loader();return i&&cu.set(n,o),Gd(o,r.exportName||e)}catch(o){return console.error(`Failed to load configurator "${e}":`,o),null}},Gd=(e,t)=>{if(e[t])return e[t];if(e.default)return e.default;let r=`${t}Configurator`;return e[r]?e[r]:null},qd=e=>{let t=[];for(let[r,i]of Object.entries(lu))i.condition&&!i.condition(e)||t.push(r);return t},Yd=e=>{let t=[],r=new Set,i=new Set,n=o=>{if(r.has(o))return;if(i.has(o))throw new Error(`Circular dependency detected: ${o}`);i.add(o);let s=lu[o];if(s?.dependencies)for(let a of s.dependencies)e.includes(a)&&n(a);i.delete(o),r.add(o),t.push(o)};for(let o of e)n(o);return t}});import pu from"node:path";var ui,hu=D(()=>{"use strict";G();ui=async(e,t)=>{let r=pu.join(e.projectPath,"src"),{variant:i,ui:n,state:o,routing:s,dataFetching:a}=e.selections,u=i.startsWith("ts"),l=["import { StrictMode } from 'react'","import { createRoot } from 'react-dom/client'","import './index.css'",`import App from './App.${t}'`],p=[];if(o==="redux"&&(l.push("import { Provider } from 'react-redux'"),l.push("import { store } from './store/store'"),p.push({start:"<Provider store={store}>",end:"</Provider>"})),a==="tanstack-query"&&(l.push("import { QueryClient, QueryClientProvider } from '@tanstack/react-query'"),p.push({start:"<QueryClientProvider client={queryClient}>",end:"</QueryClientProvider>"})),n==="heroui")l.push("import { HeroUIProvider } from '@heroui/react'"),p.push({start:"<HeroUIProvider>",end:"</HeroUIProvider>"});else if(n==="chakra")l.push("import { ChakraProvider, defaultSystem } from '@chakra-ui/react'"),p.push({start:"<ChakraProvider value={defaultSystem}>",end:"</ChakraProvider>"});else if(n==="antd"){let y=e.selections.rtl===!0;l.push("import { ConfigProvider } from 'antd'"),p.push({start:`<ConfigProvider${y?' direction="rtl"':""}>`,end:"</ConfigProvider>"})}let h="",d="<App />";s==="react-router"?(l.push("import { createBrowserRouter, RouterProvider } from 'react-router-dom'"),h=`
|
|
1042
1116
|
const router = createBrowserRouter([
|
|
1043
1117
|
{
|
|
1044
1118
|
path: "*",
|
|
1045
1119
|
element: <App />,
|
|
1046
1120
|
}
|
|
1047
|
-
]);`,
|
|
1121
|
+
]);`,d="<RouterProvider router={router} />"):s==="tanstack-router"&&(l.push("import { RouterProvider, createRouter, createRootRoute } from '@tanstack/react-router'"),h=`
|
|
1048
1122
|
const rootRoute = createRootRoute({
|
|
1049
1123
|
component: App,
|
|
1050
1124
|
});
|
|
1051
1125
|
|
|
1052
1126
|
const router = createRouter({ routeTree: rootRoute });
|
|
1053
|
-
${
|
|
1127
|
+
${u?`
|
|
1054
1128
|
declare module '@tanstack/react-router' {
|
|
1055
1129
|
interface Register {
|
|
1056
1130
|
router: typeof router
|
|
1057
1131
|
}
|
|
1058
|
-
}`:""}`,
|
|
1059
|
-
`);
|
|
1132
|
+
}`:""}`,d="<RouterProvider router={router} />");let g=l.join(`
|
|
1133
|
+
`);g+=`
|
|
1060
1134
|
|
|
1061
|
-
`,
|
|
1062
|
-
`),
|
|
1063
|
-
`,
|
|
1135
|
+
`,a==="tanstack-query"&&(g+=`const queryClient = new QueryClient()
|
|
1136
|
+
`),g+=h+`
|
|
1137
|
+
`,g+=`createRoot(document.getElementById('root')${u?"!":""}).render(
|
|
1064
1138
|
<StrictMode>
|
|
1065
|
-
`,p.forEach(
|
|
1066
|
-
`),
|
|
1067
|
-
`,[...p].reverse().forEach(
|
|
1068
|
-
`),
|
|
1139
|
+
`,p.forEach(y=>g+=` ${y.start}
|
|
1140
|
+
`),g+=` ${d}
|
|
1141
|
+
`,[...p].reverse().forEach(y=>g+=` ${y.end}
|
|
1142
|
+
`),g+=` </StrictMode>,
|
|
1069
1143
|
)
|
|
1070
|
-
`,await
|
|
1071
|
-
`)}});import
|
|
1144
|
+
`,await w(pu.join(r,`main.${t}`),g),u&&await w(pu.join(r,"vite-env.d.ts"),`/// <reference types="vite/client" />
|
|
1145
|
+
`)}});import Zd from"node:path";var fe,Sw,Fw,xw,Kn,mu,du=D(()=>{"use strict";G();fe={"React 19":"\u269B\uFE0F",Vite:"\u26A1",TypeScript:"\u{1F537}",JavaScript:"\u{1F7E8}","React Compiler":"\u{1F680}",SWC:"\u{1F980}","Tailwind CSS":"\u{1F30A}","CSS Modules":"\u{1F4E6}","shadcn/ui":"\u{1F3A8}","Radix UI":"\u{1F518}",HeroUI:"\u{1F9B8}","Ant Design":"\u{1F41C}","Chakra UI":"\u26A1",Zustand:"\u{1F43B}","Redux Toolkit":"\u{1F504}",Jotai:"\u{1F47B}","React Router":"\u{1F9ED}","TanStack Router":"\u{1F6E4}\uFE0F","TanStack Query":"\u{1F504}",Axios:"\u{1F4E1}","Fetch API":"\u{1F310}","React Hook Form + Zod":"\u{1F4DD}","React Hook Form + Yup":"\u{1F4DD}","TanStack Form":"\u{1F4DD}",Vitest:"\u{1F9EA}",Jest:"\u{1F0CF}","ESLint + Prettier":"\u2728",Biome:"\u{1F33F}","Framer Motion":"\u{1F3AC}",GSAP:"\u{1F4AB}"},Sw=e=>{let{variant:t,styling:r,ui:i,forms:n,state:o,routing:s,dataFetching:a,testing:u,linting:c,animation:l}=e.selections,p=[{name:"React 19",icon:fe["React 19"]??"\u269B\uFE0F"},{name:"Vite",icon:fe.Vite??"\u26A1"}];t.includes("ts")&&p.push({name:"TypeScript",icon:fe.TypeScript??"\u{1F537}"}),t.includes("compiler")&&p.push({name:"React Compiler",icon:fe["React Compiler"]??"\u{1F680}"}),t.includes("swc")&&p.push({name:"SWC",icon:fe.SWC??"\u{1F980}"});let h={tailwind:"Tailwind CSS","css-modules":"CSS Modules"};if(h[r]){let C=h[r];p.push({name:C,icon:fe[C]??"\u{1F3A8}"})}let d={shadcn:"shadcn/ui",radix:"Radix UI",heroui:"HeroUI",antd:"Ant Design",chakra:"Chakra UI"};if(i&&i!=="none"&&d[i]){let C=d[i];p.push({name:C,icon:fe[C]??"\u{1F4E6}"})}let g={zustand:"Zustand",redux:"Redux Toolkit",jotai:"Jotai"};if(o&&o!=="none"&&g[o]){let C=g[o];p.push({name:C,icon:fe[C]??"\u{1F4E6}"})}let y={"react-router":"React Router","tanstack-router":"TanStack Router"};if(s&&s!=="none"&&y[s]){let C=y[s];p.push({name:C,icon:fe[C]??"\u{1F4E6}"})}let v={"tanstack-query":"TanStack Query",axios:"Axios",fetch:"Fetch API"};if(a&&a!=="none"&&v[a]){let C=v[a];p.push({name:C,icon:fe[C]??"\u{1F4E6}"})}let z={"rhf-zod":"React Hook Form + Zod","rhf-yup":"React Hook Form + Yup","tanstack-form":"TanStack Form"};if(n&&n!=="none"&&z[n]){let C=z[n];p.push({name:C,icon:fe[C]??"\u{1F4DD}"})}if(u){let C=u==="vitest"?"Vitest":"Jest";p.push({name:C,icon:fe[C]??"\u{1F9EA}"})}if(c){let C=c==="biome"?"Biome":"ESLint + Prettier";p.push({name:C,icon:fe[C]??"\u2728"})}if(l){let C=l==="framer-motion"?"Framer Motion":"React Spring";p.push({name:C,icon:fe[C]??"\u{1F3AC}"})}return p},Fw=(e,t,r)=>{let i=t.map(o=>`{ name: '${o.name}', icon: '${o.icon}' }`).join(", "),n={badge:"NEXO CLI",ready:r?"\u062A\u0637\u0628\u064A\u0642 React \u0639\u0627\u0644\u064A \u0627\u0644\u0623\u062F\u0627\u0621 \u062C\u0627\u0647\u0632 \u0644\u0644\u0625\u0637\u0644\u0627\u0642.":"Your high-performance React application is ready for takeoff.",techTitle:r?"\u0627\u0644\u062A\u0642\u0646\u064A\u0627\u062A \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645\u0629":"Tech Stack",startTitle:r?"\u0627\u0628\u062F\u0623 \u0627\u0644\u0622\u0646":"Get Started",step1:r?"\u0642\u0645 \u0628\u062A\u0639\u062F\u064A\u0644 src/App.tsx":"Edit src/App.tsx",step2:r?"\u0627\u062D\u0641\u0638 \u0627\u0644\u0645\u0644\u0641 \u0648\u0634\u0627\u0647\u062F \u0627\u0644\u062A\u063A\u064A\u064A\u0631\u0627\u062A":"Save and see changes",step3:r?"\u0627\u0628\u062F\u0623 \u0641\u064A \u0628\u0646\u0627\u0621 \u0645\u0634\u0631\u0648\u0639\u0643 \u0627\u0644\u0645\u0630\u0647\u0644! \u2728":"Build something amazing! \u2728",footer:r?"\u062A\u0645 \u0627\u0644\u062A\u0637\u0648\u064A\u0631 \u0628\u0643\u0644 \u2764\uFE0F \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645":"Made with \u2764\uFE0F using"};return`const techStack = [${i}]
|
|
1072
1146
|
|
|
1073
1147
|
function App() {
|
|
1074
1148
|
return (
|
|
@@ -1165,7 +1239,7 @@ function App() {
|
|
|
1165
1239
|
}
|
|
1166
1240
|
|
|
1167
1241
|
export default App
|
|
1168
|
-
`},
|
|
1242
|
+
`},xw=(e,t,r)=>{let i=t.map(o=>`{ name: '${o.name}', icon: '${o.icon}' }`).join(", "),n={ready:r?"\u062A\u0637\u0628\u064A\u0642 React \u0639\u0627\u0644\u064A \u0627\u0644\u0623\u062F\u0627\u0621 \u062C\u0627\u0647\u0632.":"Your high-performance React application is ready.",techTitle:r?"\u0627\u0644\u062A\u0642\u0646\u064A\u0627\u062A \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645\u0629":"Tech Stack",startTitle:r?"\u0627\u0628\u062F\u0623 \u0627\u0644\u0622\u0646":"Get Started",step1:r?"\u0642\u0645 \u0628\u062A\u0639\u062F\u064A\u0644 src/App.tsx":"Edit src/App.tsx",step2:r?"\u0627\u062D\u0641\u0638 \u0627\u0644\u0645\u0644\u0641 \u0648\u0634\u0627\u0647\u062F \u0627\u0644\u062A\u063A\u064A\u064A\u0631\u0627\u062A":"Save and see changes",step3:r?"\u0627\u0628\u062F\u0623 \u0641\u064A \u0628\u0646\u0627\u0621 \u0645\u0634\u0631\u0648\u0639\u0643 \u0627\u0644\u0645\u0630\u0647\u0644!":"Build something amazing!",footer:r?"\u062A\u0645 \u0627\u0644\u062A\u0637\u0648\u064A\u0631 \u0628\u0643\u0644 \u2764\uFE0F \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645":"Made with \u2764\uFE0F using"};return`import './App.css'
|
|
1169
1243
|
|
|
1170
1244
|
const techStack = [${i}]
|
|
1171
1245
|
|
|
@@ -1221,7 +1295,7 @@ function App() {
|
|
|
1221
1295
|
}
|
|
1222
1296
|
|
|
1223
1297
|
export default App
|
|
1224
|
-
`},
|
|
1298
|
+
`},Kn=e=>{let{projectName:t,styling:r,rtl:i}=e.selections,n=Sw(e),o=r==="tailwind",s=i===!0;return o?Fw(t,n,s):xw(t,n,s)},mu=async(e,t)=>{let r=Zd.join(e.projectPath,"src"),i=Kn(e);await w(Zd.join(r,`App.${t}`),i)}});import Jd from"node:path";var kw,Zn,fu=D(()=>{"use strict";G();kw=e=>`
|
|
1225
1299
|
:root {
|
|
1226
1300
|
--bg-dark: #0a0a0a;
|
|
1227
1301
|
--text-white: #ffffff;
|
|
@@ -1414,7 +1488,7 @@ code {
|
|
|
1414
1488
|
color: #525252;
|
|
1415
1489
|
font-size: 0.875rem;
|
|
1416
1490
|
}
|
|
1417
|
-
`,
|
|
1491
|
+
`,Zn=async e=>{let{styling:t}=e.selections;if(t!=="tailwind"){let r=Jd.join(e.projectPath,"src");await w(Jd.join(r,"App.css"),kw(e.selections.rtl===!0))}}});import Aw from"node:path";var Xd,Qd=D(()=>{"use strict";G();hu();du();hu();fu();du();Xd=async e=>{let{variant:t}=e.selections,i=t.startsWith("ts")?"tsx":"jsx",n=Aw.join(e.projectPath,"src");await x(n),await ui(e,i),await mu(e,i)}});import _w from"node:path";function Tw(e){return{tailwind:"Tailwind CSS","css-modules":"CSS Modules"}[e]||e}function Ow(e){return{shadcn:"shadcn/ui",heroui:"HeroUI",chakra:"Chakra UI",antd:"Ant Design"}[e]||e}function Rw(e){return{redux:"Redux Toolkit",zustand:"Zustand",jotai:"Jotai"}[e]||e}function $w(e){return{"react-router":"React Router","tanstack-router":"TanStack Router"}[e]||e}function Pw(e){return{"tanstack-query":"TanStack Query",axios:"Axios"}[e]||e}var ef,tf=D(()=>{"use strict";G();ef=async e=>{let{projectName:t,variant:r,styling:i,ui:n,state:o,routing:s,dataFetching:a,testing:u}=e.selections,c="npm run",p=`# ${t}
|
|
1418
1492
|
|
|
1419
1493
|
Built with **NEXO CLI** \u{1F680}
|
|
1420
1494
|
|
|
@@ -1422,12 +1496,12 @@ Built with **NEXO CLI** \u{1F680}
|
|
|
1422
1496
|
|
|
1423
1497
|
- **Framework**: React 19 + Vite 6
|
|
1424
1498
|
- **Language**: ${r.includes("ts")?"TypeScript":"JavaScript"}
|
|
1425
|
-
- **Styling**: ${
|
|
1426
|
-
${n!=="none"?`- **UI Library**: ${
|
|
1427
|
-
${o!=="none"?`- **State Management**: ${
|
|
1428
|
-
${s!=="none"?`- **Routing**: ${
|
|
1429
|
-
${a!=="none"?`- **Data Fetching**: ${
|
|
1430
|
-
${
|
|
1499
|
+
- **Styling**: ${Tw(i)}
|
|
1500
|
+
${n!=="none"?`- **UI Library**: ${Ow(n)}`:""}
|
|
1501
|
+
${o!=="none"?`- **State Management**: ${Rw(o)}`:""}
|
|
1502
|
+
${s!=="none"?`- **Routing**: ${$w(s)}`:""}
|
|
1503
|
+
${a!=="none"?`- **Data Fetching**: ${Pw(a)}`:""}
|
|
1504
|
+
${u?`- **Testing**: ${u}`:""}
|
|
1431
1505
|
|
|
1432
1506
|
## \u{1F680} Getting Started
|
|
1433
1507
|
|
|
@@ -1438,12 +1512,12 @@ ${c?`- **Testing**: ${c}`:""}
|
|
|
1438
1512
|
|
|
1439
1513
|
2. **Start the dev server**:
|
|
1440
1514
|
\`\`\`bash
|
|
1441
|
-
${
|
|
1515
|
+
${c} dev
|
|
1442
1516
|
\`\`\`
|
|
1443
1517
|
|
|
1444
1518
|
3. **Build for production**:
|
|
1445
1519
|
\`\`\`bash
|
|
1446
|
-
${
|
|
1520
|
+
${c} build
|
|
1447
1521
|
\`\`\`
|
|
1448
1522
|
|
|
1449
1523
|
`;i==="tailwind"&&(p+=`## \u{1F3A8} Styling (Tailwind CSS v4)
|
|
@@ -1451,44 +1525,44 @@ This project uses Tailwind CSS v4.
|
|
|
1451
1525
|
- Configuration is handled in \`vite.config.ts\` via \`@tailwindcss/vite\`.
|
|
1452
1526
|
- ${n==="shadcn"||n==="heroui"?"Includes extensions for UI library.":"Standard configuration."}
|
|
1453
1527
|
|
|
1454
|
-
`),n==="shadcn"&&(p+="## \u{1F9E9} Shadcn UI\n- **Add components**:\n ```bash\n npx shadcn@latest add button\n ```\n- Configuration: `components.json`\n- Utils: `src/lib/utils.ts`\n\n"),o==="redux"&&(p+="## \u{1F4E6} State Management (Redux Toolkit)\n- **Store**: `src/store/store.ts`\n- **Hooks**: Use `useAppDispatch` and `useAppSelector` from `src/store/hooks.ts` instead of raw hooks.\n- **Slices**: Add new slices in `src/store` and register them in the store.\n\n"),u
|
|
1528
|
+
`),n==="shadcn"&&(p+="## \u{1F9E9} Shadcn UI\n- **Add components**:\n ```bash\n npx shadcn@latest add button\n ```\n- Configuration: `components.json`\n- Utils: `src/lib/utils.ts`\n\n"),o==="redux"&&(p+="## \u{1F4E6} State Management (Redux Toolkit)\n- **Store**: `src/store/store.ts`\n- **Hooks**: Use `useAppDispatch` and `useAppSelector` from `src/store/hooks.ts` instead of raw hooks.\n- **Slices**: Add new slices in `src/store` and register them in the store.\n\n"),u&&(p+=`## \u{1F9EA} Testing
|
|
1455
1529
|
Run unit tests:
|
|
1456
1530
|
\`\`\`bash
|
|
1457
|
-
${
|
|
1531
|
+
${c} test:run
|
|
1458
1532
|
\`\`\`
|
|
1459
1533
|
|
|
1460
1534
|
`),p+=`## \u{1F4C4} License
|
|
1461
1535
|
|
|
1462
1536
|
This project is licensed under the MIT License.
|
|
1463
|
-
`,await E(pv.join(e.projectPath,"README.md"),p)}});var Ud={};O(Ud,{createAppCss:()=>Gn,createEntryFiles:()=>jd,createMainFile:()=>ii,createReadme:()=>Ld,createStyles:()=>Gn,createWelcomePage:()=>Hn});var zd=D(()=>{"use strict";Bd();cu();Md()});import yv from"node:path";var lu,bv,Cv,wv,Vn,hu=D(()=>{"use strict";q();gt();Pd();lu=async(e,t)=>{let r=await Od(e);r&&await r(t)},bv=async(e,t)=>{let r={framework:"Setting up framework",variant:"Configuring build variant",language:"Setting up language",styling:"Configuring styling",ui:"Adding UI library",forms:"Setting up forms",state:"Configuring state management",routing:"Setting up routing",dataFetching:"Configuring data fetching",icons:"Adding icon library",structure:"Creating project structure",animation:"Adding animation library","ai-instructions":"Generating AI instructions",testing:"Setting up testing framework",linting:"Configuring linting and formatting",docs:"Generating documentation links"};for(let i of e){let n=r[i]||`Configuring ${i}`,o=Je(n);try{await lu(i,t),o.succeed()}catch(s){throw o.fail(),s}}},Cv=async(e,t)=>{let r=["framework","variant","language"],i=["styling","forms","state","routing","dataFetching","icons","structure","animation","ai-instructions"],n=["ui"],o=["mandatory","docs"],s=["testing","linting"],a=async(u,c=!1)=>{let l=u.filter(h=>e.includes(h));if(l.length!==0)if(c)await Promise.all(l.map(h=>lu(h,t)));else for(let h of l)await lu(h,t)};d.info(" Setting up project..."),await a(r,!1),await a(i,!0),await a(n,!1),await a(o,!1),await a(s,!0)},wv=async e=>{let{createEntryFiles:t,createReadme:r,createStyles:i}=await Promise.resolve().then(()=>(zd(),Ud));await t(e),await i(e),await r(e)},Vn=async({selections:e,targetDir:t,parallel:r=!0})=>{let i=Je("Initializing..."),n=yv.resolve(t,e.projectName),{PackageManager:o}=await Promise.resolve().then(()=>(Dn(),da)),s=new o(n);i.stop();let a={projectPath:n,selections:e,pkg:s};await s.load(a),await ki(a);let u=Rd(a),c=$d(u);r?await Cv(c,a):await bv(c,a);let l=Je("Creating project files");d.newline(),d.dim(" \u251C\u2500 Base setup"),d.dim(" \u251C\u2500 Styling configuration"),d.dim(" \u251C\u2500 UI library setup"),await wv(a),l.succeed();let h=Je("Resolving latest dependencies...");try{await s.resolveLatestVersions(),h.succeed()}catch(p){h.fail("Unable to resolve latest versions (using fallback)"),d.dim(` ${p instanceof Error?p.message:"Unknown error"}`)}await s.save()}});var pu,qn,mu=D(()=>{"use strict";pu=class e{static instance;isLearningMode=!1;isDebugMode=!1;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}},qn=pu.getInstance()});function Wd(e,t){let r=e.toLowerCase();if(!Object.keys(dr).includes(r))return null;let i=dr[r],n={projectName:t,framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"none",forms:"none",state:"none",routing:"none",dataFetching:"none",icons:"none",structure:"simple",hasCompiler:!1,hasSWC:!1,packageManager:"npm",optionalFeatures:[],...i},o=n.variant;return n.hasCompiler=o.includes("compiler"),n.hasSWC=o.includes("swc"),n.language=o.startsWith("ts")?"typescript":"javascript",n}var Hd=D(()=>{"use strict";Ts()});var Q,Gd,Vd,qd=D(()=>{"use strict";Q={react:2.5,"react-dom":42,remix:50,"class-variance-authority":1,clsx:.4,"tailwind-merge":1,"@chakra-ui/react":100,zustand:1.1,"@reduxjs/toolkit":12,"react-redux":4.5,jotai:2.5,"react-router-dom":16,"@tanstack/react-router":13,"@tanstack/react-query":13,axios:12,"react-hook-form":9,zod:13,"@hookform/resolvers":2,"lucide-react":5},Gd=e=>{let t=0;return t+=Q.react||0,t+=Q["react-dom"]||0,e.ui==="shadcn"&&(t+=(Q["class-variance-authority"]||0)+(Q.clsx||0)+(Q["tailwind-merge"]||0)),e.state==="zustand"?t+=Q.zustand||0:e.state==="redux"?t+=(Q["@reduxjs/toolkit"]||0)+(Q["react-redux"]||0):e.state==="jotai"&&(t+=Q.jotai||0),e.routing==="react-router"?t+=Q["react-router-dom"]||0:e.routing==="tanstack-router"&&(t+=Q["@tanstack/react-router"]||0),e.dataFetching==="tanstack-query"?t+=Q["@tanstack/react-query"]||0:e.dataFetching==="axios"&&(t+=Q.axios||0),e.forms?.includes("rhf")&&(t+=Q["react-hook-form"]||0,e.forms.includes("zod")&&(t+=(Q.zod||0)+(Q["@hookform/resolvers"]||0))),e.icons==="lucide"&&(t+=Q["lucide-react"]||0),Number(t.toFixed(1))},Vd=e=>e>=1024?`${(e/1024).toFixed(2)} MB`:`${e} kB`});var vv,Yd,Zd,Jd,Xd,Kd,Qd,ef,tf,rf,ni,du=D(()=>{"use strict";vv={name:"packageManager",message:"Select a package manager:",type:"list",options:[{value:"npm",name:"npm",comment:"Default",hover_note:"Standard Node Package Manager (Optimized)"},{value:"pnpm",name:"pnpm",comment:"Fast, disk efficient",hover_note:"Uses hard links to save space and time"},{value:"bun",name:"bun",comment:"Super fast runtime",hover_note:"All-in-one toolkit for JavaScript apps"},{value:"yarn",name:"yarn",comment:"Fast, reliable",hover_note:"Fast, reliable, and secure dependency management"}]},Yd={name:"variant",message:"Select a variant:",type:"list",options:[{value:"ts",name:"TypeScript",comment:"Type-safe JavaScript",hover_note:"Standard TypeScript setup with full type checking"},{value:"ts-compiler",name:"TypeScript + React Compiler",comment:"Auto-optimization with React 19",hover_note:"Uses React Compiler for automatic memoization - best for React 19+"},{value:"ts-swc",name:"TypeScript + SWC",comment:"Faster builds with SWC",hover_note:"Rust-based compiler for 20x faster builds than Babel"},{value:"js",name:"JavaScript",comment:"Standard JavaScript",hover_note:"No type system, simpler setup"},{value:"js-compiler",name:"JavaScript + React Compiler",comment:"Auto-optimization without types",hover_note:"React Compiler benefits without TypeScript overhead"},{value:"js-swc",name:"JavaScript + SWC",comment:"Faster builds without types",hover_note:"Fast SWC compilation for JavaScript projects"}]},Zd={name:"styling",message:"Select a styling solution:",type:"list",options:[{value:"tailwind",name:"Tailwind CSS",comment:"Utility-first CSS framework",hover_note:"Rapidly build modern websites without leaving your HTML - includes dark mode"},{value:"css-modules",name:"CSS Modules",comment:"Scoped CSS by default",hover_note:"CSS files where class names are scoped locally to avoid conflicts"},{value:"sass",name:"Sass/SCSS",comment:"CSS with superpowers",hover_note:"Variables, nesting, mixins, and more - industry standard preprocessor"},{value:"styled-components",name:"Styled Components",comment:"CSS-in-JS solution",hover_note:"Write actual CSS code inside your React components"}]},Jd={name:"ui",message:"Select a UI library:",type:"list",options:[{value:"shadcn",name:"shadcn/ui",comment:"Beautifully designed components (~0KB base)",hover_note:"Copy-paste components built with Radix and Tailwind - only import what you use"},{value:"radix",name:"Radix UI",comment:"Unstyled, accessible (~5KB per component)",hover_note:"Low-level primitives for building custom design systems"},{value:"heroui",name:"HeroUI",comment:"Beautiful, fast UI (~30KB gzipped)",hover_note:"Modern components built on Tailwind CSS and Radix primitives"},{value:"mui",name:"Material UI (MUI)",comment:"Google Material Design",hover_note:"Comprehensive component library following Material Design guidelines"},{value:"antd",name:"Ant Design",comment:"Enterprise-class UI (~120KB gzipped)",hover_note:"Feature-rich for enterprise apps with design system"},{value:"chakra",name:"Chakra UI",comment:"Simple, modular (~80KB gzipped)",hover_note:"Good developer experience with accessible components"},{value:"none",name:"None",comment:"No UI library (0KB)",hover_note:"Build your own components from scratch"}]},Xd={name:"forms",message:"Select a forms solution:",type:"list",options:[{value:"rhf-zod",name:"React Hook Form + Zod",comment:"Best performance + type safety",hover_note:"Minimal re-renders with TypeScript-first validation schema"},{value:"rhf-yup",name:"React Hook Form + Yup",comment:"Performant with Yup validation",hover_note:"Well-established validation library with good ecosystem"},{value:"formik-zod",name:"Formik + Zod",comment:"Popular form library + Zod",hover_note:"Formik's simplicity with Zod's type inference"},{value:"formik-yup",name:"Formik + Yup",comment:"Traditional Formik setup",hover_note:"Classic combination for form handling"},{value:"tanstack-form",name:"TanStack Form",comment:"Type-safe forms by TanStack",hover_note:"Framework-agnostic with first-class TypeScript support"},{value:"none",name:"None",comment:"No forms library",hover_note:"Use native form handling or add later"}]},Kd={name:"state",message:"Select a state management solution:",type:"list",options:[{value:"zustand",name:"Zustand",comment:"Small, fast, scalable",hover_note:"Minimal API with excellent TypeScript support - no boilerplate"},{value:"redux",name:"Redux Toolkit",comment:"Industry standard",hover_note:"Best for complex state with devtools, middleware, and persistence"},{value:"jotai",name:"Jotai",comment:"Primitive atoms approach",hover_note:"Atomic state management - great for derived state"},{value:"none",name:"None",comment:"React built-in state",hover_note:"Use useState, useReducer, and Context API"}]},Qd={name:"routing",message:"Select a routing solution:",type:"list",options:[{value:"react-router",name:"React Router",comment:"Most popular routing",hover_note:"Declarative routing with data loading and actions support"},{value:"tanstack-router",name:"TanStack Router",comment:"Fully type-safe routing",hover_note:"Type-safe from route definition to component - great DX"},{value:"none",name:"None",comment:"No routing",hover_note:"Single page app without navigation"}]},ef={name:"dataFetching",message:"Select a data fetching solution:",type:"list",options:[{value:"tanstack-query",name:"TanStack Query",comment:"Powerful async state",hover_note:"Caching, background updates, optimistic UI, infinite scroll built-in"},{value:"axios",name:"Axios",comment:"Promise-based HTTP client",hover_note:"Simple API with interceptors, transforms, and automatic JSON parsing"},{value:"fetch",name:"Native Fetch",comment:"Built-in browser API",hover_note:"No dependencies - use browser's native fetch API"},{value:"none",name:"None",comment:"No data fetching setup",hover_note:"Add data fetching solution later"}]},tf={name:"icons",message:"Select an icon library:",type:"list",options:[{value:"lucide",name:"Lucide",comment:"Beautiful & consistent",hover_note:"Community-driven fork of Feather Icons - tree-shakeable"},{value:"react-icons",name:"React Icons",comment:"Largest collection (Fa, Md, Ai...)",hover_note:"Includes Font Awesome, Material, Ant Design, Bootstrap icons and more"},{value:"iconify",name:"Iconify",comment:"Universal icon framework",hover_note:"Access to 100,000+ icons from 100+ icon sets in one library"},{value:"heroicons",name:"Heroicons",comment:"By Tailwind Labs",hover_note:"Hand-crafted SVG icons designed to pair with Tailwind CSS"},{value:"fontawesome",name:"Font Awesome",comment:"Extensive icon library",hover_note:"Thousands of icons in multiple styles (solid, regular, brands)"},{value:"none",name:"None",comment:"No icon library",hover_note:"Use your own SVGs or add icons later"}]},rf={name:"structure",message:"Select a project structure:",type:"list",options:[{value:"feature-based",name:"Feature-based",comment:"Organize by features",hover_note:"Group files by feature/domain - scales well for large apps",folder_info:["src/features/*","src/shared/*","src/app/*"]},{value:"fsd",name:"FSD (Feature-Sliced Design)",comment:"Architectural methodology",hover_note:"Layers \u2192 Slices \u2192 Segments - highly scalable architecture",folder_info:["src/app","src/pages","src/widgets","src/features","src/entities","src/shared"]},{value:"atomic",name:"Atomic Design",comment:"Atoms \u2192 Molecules \u2192 Organisms",hover_note:"Design system methodology by Brad Frost - great for component libraries",folder_info:["src/components/atoms","src/components/molecules","src/components/organisms"]},{value:"clean",name:"Clean Architecture",comment:"Domain-driven layers",hover_note:"Separation of concerns with domain, application, and infrastructure layers",folder_info:["src/domain","src/application","src/infrastructure","src/presentation"]},{value:"mvc",name:"MVC Pattern",comment:"Model-View-Controller",hover_note:"Classic pattern separating data, UI, and business logic",folder_info:["src/models","src/views","src/controllers"]},{value:"simple",name:"Simple",comment:"Minimal structure",hover_note:"Basic folders for small projects - easy to reorganize later",folder_info:["src/components","src/hooks","src/utils","src/assets"]}]},ni=[Yd,Zd,Jd,Xd,Kd,Qd,ef,tf,rf,vv]});var si,nf,Ev,sf,Sv,fu,gu=D(()=>{"use strict";si={name:"optionalFeatures",message:"Select optional features (Space to select, Enter to continue):",type:"checkbox",options:[{value:"testing",name:"Testing",comment:"Unit & integration tests",hover_note:"Vitest or Jest configuration with React Testing Library"},{value:"linting",name:"Linting & Formatting",comment:"Code quality tools",hover_note:"ESLint + Prettier or Biome for consistent code style"},{value:"animation",name:"Animation Library",comment:"Motion & transitions",hover_note:"Framer Motion, GSAP, or React Spring for smooth animations"},{value:"rtl-starter",name:"Arabic & RTL Support",comment:"Native RTL with Cairo font",hover_note:"Native RTL support with Cairo font and Arabic lang configuration"},{value:"ai-instructions",name:"AI Instructions",comment:"AI IDE/CLI guidance files",hover_note:"Generate instruction files for AI tools (Cursor, Windsurf, Claude, etc.)"}]},nf={name:"testing",message:"Select testing framework:",type:"list",options:[{value:"vitest",name:"Vitest",comment:"Vite-native testing",hover_note:"Blazing fast with Vite - compatible with Jest API"},{value:"jest",name:"Jest",comment:"Industry standard",hover_note:"Mature ecosystem with extensive documentation"}]},Ev={name:"linting",message:"Select linting setup:",type:"list",options:[{value:"eslint-prettier",name:"ESLint + Prettier",comment:"Standard combo",hover_note:"ESLint for linting, Prettier for formatting - widely adopted"},{value:"biome",name:"Biome",comment:"All-in-one tool",hover_note:"Fast Rust-based linter and formatter in one - simpler config"}]},sf={name:"animation",message:"Select animation library:",type:"list",options:[{value:"framer-motion",name:"Framer Motion",comment:"Production-ready",hover_note:"Declarative animations with gestures, layout animations, and SVG support"},{value:"gsap",name:"GSAP",comment:"Professional-grade",hover_note:"Industry-standard animation library with timeline control and ScrollTrigger"},{value:"react-spring",name:"React Spring",comment:"Physics-based",hover_note:"Spring-physics animations for natural motion feel"}]},Sv={name:"aiInstructions",message:"Select AI tools to generate instructions for:",type:"checkbox",options:[{value:"cursor",name:"Cursor",comment:"AI-first code editor",hover_note:"Generate .cursorrules for Cursor IDE"},{value:"windsurf",name:"Windsurf",comment:"AI-powered IDE",hover_note:"Generate .windsurfrules for Windsurf"},{value:"cline",name:"Cline",comment:"VS Code AI extension",hover_note:"Generate .clinerules for Cline (formerly Claude Dev)"},{value:"roo-cline",name:"Roo Cline",comment:"Enhanced Cline fork",hover_note:"Generate .roo-clinerules for Roo Cline"},{value:"aider",name:"Aider",comment:"AI pair programming in terminal",hover_note:"Generate .aider.conf.yml for Aider CLI"},{value:"claude",name:"Claude",comment:"Anthropic Claude AI",hover_note:"Generate CLAUDE_INSTRUCTIONS.md for Claude CLI/API"},{value:"gemini",name:"Google Gemini",comment:"Google Gemini AI",hover_note:"Generate GEMINI_INSTRUCTIONS.md for Gemini"},{value:"codex",name:"OpenAI Codex",comment:"OpenAI Codex/ChatGPT",hover_note:"Generate CODEX_INSTRUCTIONS.md for Codex/ChatGPT"},{value:"universal",name:"Universal (All AI Tools)",comment:"Generic AI instructions",hover_note:"Generate AI_INSTRUCTIONS.md for any AI assistant"}]},fu={"ai-instructions":Sv,testing:nf,linting:Ev,animation:sf}});var of=D(()=>{"use strict"});var fk,af=D(()=>{"use strict";du();gu();of();du();gu();fk=[...ni,si]});var uf=D(()=>{"use strict";af()});var yu={};O(yu,{deletePreset:()=>_v,getPreset:()=>Av,loadPresets:()=>Yn,savePreset:()=>kv});import cr from"node:fs/promises";import Fv from"node:os";import cf from"node:path";var Du,xv,Yn,kv,Av,_v,bu=D(()=>{"use strict";Du=()=>{let e=Fv.homedir();return cf.join(e,".nexo","presets.json")},xv=async e=>{let t=cf.dirname(e);try{await cr.access(t)}catch{await cr.mkdir(t,{recursive:!0})}},Yn=async()=>{let e=Du();try{await cr.access(e);let t=await cr.readFile(e,"utf-8");return JSON.parse(t)}catch{return[]}},kv=async(e,t)=>{let r=Du();await xv(r);let i=await Yn(),{projectName:n,installDependencies:o,...s}=t,a={name:e,selections:s,createAt:new Date().toISOString()},u=i.findIndex(c=>c.name===e);u>=0?i[u]=a:i.push(a),await cr.writeFile(r,JSON.stringify(i,null,2))},Av=async e=>(await Yn()).find(r=>r.name===e),_v=async e=>{let t=Du(),i=(await Yn()).filter(n=>n.name!==e);await cr.writeFile(t,JSON.stringify(i,null,2))}});import lf from"node:fs/promises";import Tv from"node:path";async function hf(e,t){let r=rr(),i=Tv.resolve(t,e);if(!await Ls(i)){let s=await Ms(i),a="";s&&(a=`
|
|
1464
|
-
${
|
|
1465
|
-
${
|
|
1466
|
-
${
|
|
1467
|
-
${
|
|
1468
|
-
`);let u=await
|
|
1469
|
-
The "React Compiler" variant uses the new experimental compiler for auto-memoization.`):
|
|
1470
|
-
CSS Modules provide scoped CSS to avoid global conflicts.`):
|
|
1537
|
+
`,await w(_w.join(e.projectPath,"README.md"),p)}});var rf={};k(rf,{createAppCss:()=>Zn,createEntryFiles:()=>Xd,createMainFile:()=>ui,createReadme:()=>ef,createStyles:()=>Zn,createWelcomePage:()=>Kn});var nf=D(()=>{"use strict";Qd();fu();tf()});import Iw from"node:path";var gu,Nw,jw,Bw,Jn,Du=D(()=>{"use strict";G();Ct();Kd();gu=async(e,t)=>{let r=await Vd(e);r&&await r(t)},Nw=async(e,t)=>{let r={framework:"Setting up framework",variant:"Configuring build variant",language:"Setting up language",styling:"Configuring styling",ui:"Adding UI library",forms:"Setting up forms",state:"Configuring state management",routing:"Setting up routing",dataFetching:"Configuring data fetching",icons:"Adding icon library",structure:"Creating project structure",animation:"Adding animation library","ai-instructions":"Generating AI instructions",testing:"Setting up testing framework",linting:"Configuring linting and formatting",docs:"Generating documentation links"};for(let i of e){let n=r[i]||`Configuring ${i}`,o=Xe(n);try{await gu(i,t),o.succeed()}catch(s){throw o.fail(),s}}},jw=async(e,t)=>{let r=["framework","variant","language"],i=["styling","forms","state","routing","dataFetching","icons","structure","animation","ai-instructions"],n=["ui"],o=["mandatory","docs"],s=["testing","linting"],a=async(u,c=!1)=>{let l=u.filter(p=>e.includes(p));if(l.length!==0)if(c)await Promise.all(l.map(p=>gu(p,t)));else for(let p of l)await gu(p,t)};m.info(" Setting up project..."),await a(r,!1),await a(i,!0),await a(n,!1),await a(o,!1),await a(s,!0)},Bw=async e=>{let{createEntryFiles:t,createReadme:r,createStyles:i}=await Promise.resolve().then(()=>(nf(),rf));await t(e),await i(e),await r(e)},Jn=async({selections:e,targetDir:t,parallel:r=!0})=>{let i=Xe("Initializing..."),n=Iw.resolve(t,e.projectName),{PackageManager:o}=await Promise.resolve().then(()=>(En(),Ca)),s=new o(n);i.stop();let a={projectPath:n,selections:e,pkg:s};await s.load(a),await Oi(a);let u=qd(a),c=Yd(u);r?await jw(c,a):await Nw(c,a);let l=Xe("Creating project files");m.newline(),m.dim(" \u251C\u2500 Base setup"),m.dim(" \u251C\u2500 Styling configuration"),m.dim(" \u251C\u2500 UI library setup"),await Bw(a),l.succeed();let p=Xe("Resolving latest dependencies...");try{await s.resolveLatestVersions(),p.succeed()}catch(h){p.fail("Unable to resolve latest versions (using fallback)"),m.dim(` ${h instanceof Error?h.message:"Unknown error"}`)}await s.save()}});var yu,Xn,bu=D(()=>{"use strict";yu=class e{static instance;isLearningMode=!1;isDebugMode=!1;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}},Xn=yu.getInstance()});function sf(e,t){let r=e.toLowerCase();if(!Object.keys(yr).includes(r))return null;let i=yr[r],n={projectName:t,framework:"react",variant:"ts",language:"typescript",styling:"tailwind",ui:"none",forms:"none",state:"none",routing:"none",dataFetching:"none",icons:"none",structure:"simple",hasCompiler:!1,hasSWC:!1,packageManager:"npm",optionalFeatures:[],...i},o=n.variant;return n.hasCompiler=o.includes("compiler"),n.hasSWC=o.includes("swc"),n.language=o.startsWith("ts")?"typescript":"javascript",n}var of=D(()=>{"use strict";Ns()});var Q,af,uf,cf=D(()=>{"use strict";Q={react:2.5,"react-dom":42,remix:50,"class-variance-authority":1,clsx:.4,"tailwind-merge":1,"@chakra-ui/react":100,zustand:1.1,"@reduxjs/toolkit":12,"react-redux":4.5,jotai:2.5,"react-router-dom":16,"@tanstack/react-router":13,"@tanstack/react-query":13,axios:12,"react-hook-form":9,zod:13,"@hookform/resolvers":2,"lucide-react":5},af=e=>{let t=0;return t+=Q.react||0,t+=Q["react-dom"]||0,e.ui==="shadcn"&&(t+=(Q["class-variance-authority"]||0)+(Q.clsx||0)+(Q["tailwind-merge"]||0)),e.state==="zustand"?t+=Q.zustand||0:e.state==="redux"?t+=(Q["@reduxjs/toolkit"]||0)+(Q["react-redux"]||0):e.state==="jotai"&&(t+=Q.jotai||0),e.routing==="react-router"?t+=Q["react-router-dom"]||0:e.routing==="tanstack-router"&&(t+=Q["@tanstack/react-router"]||0),e.dataFetching==="tanstack-query"?t+=Q["@tanstack/react-query"]||0:e.dataFetching==="axios"&&(t+=Q.axios||0),e.forms?.includes("rhf")&&(t+=Q["react-hook-form"]||0,e.forms.includes("zod")&&(t+=(Q.zod||0)+(Q["@hookform/resolvers"]||0))),e.icons==="lucide"&&(t+=Q["lucide-react"]||0),Number(t.toFixed(1))},uf=e=>e>=1024?`${(e/1024).toFixed(2)} MB`:`${e} kB`});var pf={};k(pf,{corePrompts:()=>hr,dataFetchingPrompt:()=>xu,formsPrompt:()=>vu,iconsPrompt:()=>ku,packageManagerPrompt:()=>Lw,routingPrompt:()=>Fu,statePrompt:()=>Su,structurePrompt:()=>lf,stylingPrompt:()=>Eu,uiPrompt:()=>wu,variantPrompt:()=>Cu});var Lw,Cu,Eu,wu,vu,Su,Fu,xu,ku,lf,hr,Qn=D(()=>{"use strict";Lw={name:"packageManager",message:"Select a package manager:",type:"list",options:[{value:"npm",name:"npm",comment:"Default",hover_note:"Standard Node Package Manager (Optimized)"},{value:"pnpm",name:"pnpm",comment:"Fast, disk efficient",hover_note:"Uses hard links to save space and time"},{value:"bun",name:"bun",comment:"Super fast runtime",hover_note:"All-in-one toolkit for JavaScript apps"},{value:"yarn",name:"yarn",comment:"Fast, reliable",hover_note:"Fast, reliable, and secure dependency management"}]},Cu={name:"variant",message:"Select a variant:",type:"list",options:[{value:"ts",name:"TypeScript",comment:"Type-safe JavaScript",hover_note:"Standard TypeScript setup with full type checking"},{value:"ts-compiler",name:"TypeScript + React Compiler",comment:"Auto-optimization with React 19",hover_note:"Uses React Compiler for automatic memoization - best for React 19+"},{value:"ts-swc",name:"TypeScript + SWC",comment:"Faster builds with SWC",hover_note:"Rust-based compiler for 20x faster builds than Babel"},{value:"js",name:"JavaScript",comment:"Standard JavaScript",hover_note:"No type system, simpler setup"},{value:"js-compiler",name:"JavaScript + React Compiler",comment:"Auto-optimization without types",hover_note:"React Compiler benefits without TypeScript overhead"},{value:"js-swc",name:"JavaScript + SWC",comment:"Faster builds without types",hover_note:"Fast SWC compilation for JavaScript projects"}]},Eu={name:"styling",message:"Select a styling solution:",type:"list",options:[{value:"tailwind",name:"Tailwind CSS",comment:"Utility-first CSS framework",hover_note:"Rapidly build modern websites without leaving your HTML - includes dark mode"},{value:"css-modules",name:"CSS Modules",comment:"Scoped CSS by default",hover_note:"CSS files where class names are scoped locally to avoid conflicts"}]},wu={name:"ui",message:"Select a UI library:",type:"list",options:[{value:"shadcn",name:"shadcn/ui",comment:"Beautifully designed components (~0KB base)",hover_note:"Copy-paste components built with Radix and Tailwind - only import what you use"},{value:"radix",name:"Radix UI",comment:"Unstyled, accessible (~5KB per component)",hover_note:"Low-level primitives for building custom design systems"},{value:"heroui",name:"HeroUI",comment:"Beautiful, fast UI (~30KB gzipped)",hover_note:"Modern components built on Tailwind CSS and Radix primitives"},{value:"mui",name:"Material UI (MUI)",comment:"Google Material Design",hover_note:"Comprehensive component library following Material Design guidelines"},{value:"antd",name:"Ant Design",comment:"Enterprise-class UI (~120KB gzipped)",hover_note:"Feature-rich for enterprise apps with design system"},{value:"chakra",name:"Chakra UI",comment:"Simple, modular (~80KB gzipped)",hover_note:"Good developer experience with accessible components"},{value:"none",name:"None",comment:"No UI library (0KB)",hover_note:"Build your own components from scratch"}]},vu={name:"forms",message:"Select a forms solution:",type:"list",options:[{value:"rhf-zod",name:"React Hook Form + Zod",comment:"Best performance + type safety",hover_note:"Minimal re-renders with TypeScript-first validation schema"},{value:"rhf-yup",name:"React Hook Form + Yup",comment:"Performant with Yup validation",hover_note:"Well-established validation library with good ecosystem"},{value:"tanstack-form",name:"TanStack Form",comment:"Type-safe forms by TanStack",hover_note:"Framework-agnostic with first-class TypeScript support"},{value:"none",name:"None",comment:"No forms library",hover_note:"Use native form handling or add later"}]},Su={name:"state",message:"Select a state management solution:",type:"list",options:[{value:"zustand",name:"Zustand",comment:"Small, fast, scalable",hover_note:"Minimal API with excellent TypeScript support - no boilerplate"},{value:"redux",name:"Redux Toolkit",comment:"Industry standard",hover_note:"Best for complex state with devtools, middleware, and persistence"},{value:"jotai",name:"Jotai",comment:"Primitive atoms approach",hover_note:"Atomic state management - great for derived state"},{value:"none",name:"None",comment:"React built-in state",hover_note:"Use useState, useReducer, and Context API"}]},Fu={name:"routing",message:"Select a routing solution:",type:"list",options:[{value:"react-router",name:"React Router",comment:"Most popular routing",hover_note:"Declarative routing with data loading and actions support"},{value:"tanstack-router",name:"TanStack Router",comment:"Fully type-safe routing",hover_note:"Type-safe from route definition to component - great DX"},{value:"none",name:"None",comment:"No routing",hover_note:"Single page app without navigation"}]},xu={name:"dataFetching",message:"Select a data fetching solution:",type:"list",options:[{value:"tanstack-query",name:"TanStack Query",comment:"Powerful async state",hover_note:"Caching, background updates, optimistic UI, infinite scroll built-in"},{value:"axios",name:"Axios",comment:"Promise-based HTTP client",hover_note:"Simple API with interceptors, transforms, and automatic JSON parsing"},{value:"fetch",name:"Native Fetch",comment:"Built-in browser API",hover_note:"No dependencies - use browser's native fetch API"},{value:"none",name:"None",comment:"No data fetching setup",hover_note:"Add data fetching solution later"}]},ku={name:"icons",message:"Select an icon library:",type:"list",options:[{value:"lucide",name:"Lucide",comment:"Beautiful & consistent",hover_note:"Community-driven fork of Feather Icons - tree-shakeable"},{value:"react-icons",name:"React Icons",comment:"Largest collection (Fa, Md, Ai...)",hover_note:"Includes Font Awesome, Material, Ant Design, Bootstrap icons and more"},{value:"iconify",name:"Iconify",comment:"Universal icon framework",hover_note:"Access to 100,000+ icons from 100+ icon sets in one library"},{value:"heroicons",name:"Heroicons",comment:"By Tailwind Labs",hover_note:"Hand-crafted SVG icons designed to pair with Tailwind CSS"},{value:"none",name:"None",comment:"No icon library",hover_note:"Use your own SVGs or add icons later"}]},lf={name:"structure",message:"Select a project structure:",type:"list",options:[{value:"feature-based",name:"Feature-based",comment:"Organize by features",hover_note:"Group files by feature/domain - scales well for large apps",folder_info:["src/features/*","src/shared/*","src/app/*"]},{value:"simple",name:"Simple",comment:"Minimal structure",hover_note:"Basic folders for small projects - easy to reorganize later",folder_info:["src/components","src/hooks","src/utils","src/assets"]}]},hr=[Cu,Eu,wu,vu,Su,Fu,xu,ku]});var ci,hf,Mw,mf,Uw,zw,Au,_u=D(()=>{"use strict";ci={name:"optionalFeatures",message:"Select optional features (Space to select, Enter to continue):",type:"checkbox",options:[{value:"testing",name:"Testing",comment:"Unit & integration tests",hover_note:"Vitest or Jest configuration with React Testing Library"},{value:"linting",name:"Linting & Formatting",comment:"Code quality tools",hover_note:"ESLint + Prettier or Biome for consistent code style"},{value:"animation",name:"Animation Library",comment:"Motion & transitions",hover_note:"Framer Motion, GSAP, or React Spring for smooth animations"},{value:"backend",name:"Backend Integration",comment:"BaaS SDK setup",hover_note:"Supabase, Firebase, Clerk, or Prisma client configuration"},{value:"rtl-starter",name:"Arabic & RTL Support",comment:"Native RTL with Cairo font",hover_note:"Native RTL support with Cairo font and Arabic lang configuration"},{value:"ai-instructions",name:"AI Instructions",comment:"AI IDE/CLI guidance files",hover_note:"Generate instruction files for AI tools (Cursor, Windsurf, Claude, etc.)"}]},hf={name:"testing",message:"Select testing framework:",type:"list",options:[{value:"vitest",name:"Vitest",comment:"Vite-native testing",hover_note:"Blazing fast with Vite - compatible with Jest API"},{value:"jest",name:"Jest",comment:"Industry standard",hover_note:"Mature ecosystem with extensive documentation"}]},Mw={name:"linting",message:"Select linting setup:",type:"list",options:[{value:"eslint-prettier",name:"ESLint + Prettier",comment:"Standard combo",hover_note:"ESLint for linting, Prettier for formatting - widely adopted"},{value:"biome",name:"Biome",comment:"All-in-one tool",hover_note:"Fast Rust-based linter and formatter in one - simpler config"}]},mf={name:"animation",message:"Select animation library:",type:"list",options:[{value:"framer-motion",name:"Framer Motion",comment:"Production-ready",hover_note:"Declarative animations with gestures, layout animations, and SVG support"},{value:"gsap",name:"GSAP",comment:"Professional-grade",hover_note:"Industry-standard animation library with timeline control and ScrollTrigger"}]},Uw={name:"aiInstructions",message:"Select AI tools to generate instructions for:",type:"checkbox",options:[{value:"cursor",name:"Cursor",comment:"AI-first code editor",hover_note:"Generate .cursorrules for Cursor IDE"},{value:"windsurf",name:"Windsurf",comment:"AI-powered IDE",hover_note:"Generate .windsurfrules for Windsurf"},{value:"cline",name:"Cline",comment:"VS Code AI extension",hover_note:"Generate .clinerules for Cline (formerly Claude Dev)"},{value:"roo-cline",name:"Roo Cline",comment:"Enhanced Cline fork",hover_note:"Generate .roo-clinerules for Roo Cline"},{value:"aider",name:"Aider",comment:"AI pair programming in terminal",hover_note:"Generate .aider.conf.yml for Aider CLI"},{value:"claude",name:"Claude",comment:"Anthropic Claude AI",hover_note:"Generate CLAUDE_INSTRUCTIONS.md for Claude CLI/API"},{value:"gemini",name:"Google Gemini",comment:"Google Gemini AI",hover_note:"Generate GEMINI_INSTRUCTIONS.md for Gemini"},{value:"codex",name:"OpenAI Codex",comment:"OpenAI Codex/ChatGPT",hover_note:"Generate CODEX_INSTRUCTIONS.md for Codex/ChatGPT"},{value:"universal",name:"Universal (All AI Tools)",comment:"Generic AI instructions",hover_note:"Generate AI_INSTRUCTIONS.md for any AI assistant"}]},zw={name:"backend",message:"Select a backend integration:",type:"list",options:[{value:"supabase",name:"Supabase",comment:"Open-source Firebase alternative",hover_note:"PostgreSQL database, Auth, Storage, and Realtime subscriptions"},{value:"firebase",name:"Firebase",comment:"Google BaaS platform",hover_note:"Authentication, Firestore, Cloud Functions, and Hosting"},{value:"clerk",name:"Clerk",comment:"Modern authentication",hover_note:"Drop-in authentication with user management and session handling"},{value:"prisma",name:"Prisma",comment:"Next-gen ORM",hover_note:"Type-safe database client for PostgreSQL, MySQL, SQLite, and more"}]},Au={"ai-instructions":Uw,testing:hf,linting:Mw,animation:mf,backend:zw}});var df=D(()=>{"use strict"});var _k,ff=D(()=>{"use strict";Qn();_u();df();Qn();_u();_k=[...hr,ci]});var gf=D(()=>{"use strict";ff()});var Ou={};k(Ou,{deletePreset:()=>qw,getPreset:()=>Vw,loadPresets:()=>es,savePreset:()=>Gw});import mr from"node:fs/promises";import Hw from"node:os";import Df from"node:path";var Tu,Ww,es,Gw,Vw,qw,Ru=D(()=>{"use strict";Tu=()=>{let e=Hw.homedir();return Df.join(e,".nexo","presets.json")},Ww=async e=>{let t=Df.dirname(e);try{await mr.access(t)}catch{await mr.mkdir(t,{recursive:!0})}},es=async()=>{let e=Tu();try{await mr.access(e);let t=await mr.readFile(e,"utf-8");return JSON.parse(t)}catch{return[]}},Gw=async(e,t)=>{let r=Tu();await Ww(r);let i=await es(),{projectName:n,installDependencies:o,...s}=t,a={name:e,selections:s,createAt:new Date().toISOString()},u=i.findIndex(c=>c.name===e);u>=0?i[u]=a:i.push(a),await mr.writeFile(r,JSON.stringify(i,null,2))},Vw=async e=>(await es()).find(r=>r.name===e),qw=async e=>{let t=Tu(),i=(await es()).filter(n=>n.name!==e);await mr.writeFile(t,JSON.stringify(i,null,2))}});import yf from"node:fs/promises";import Yw from"node:path";async function bf(e,t){let r=Yw.resolve(t,e);if(!await Gs(r)){let s=await Vs(r),a="";s&&(a=`
|
|
1538
|
+
${q.default.bold("Previous Configuration Found:")}
|
|
1539
|
+
${q.default.dim("\u2022 Framework:")} ${s.framework||"Unknown"}
|
|
1540
|
+
${q.default.dim("\u2022 Language:")} ${s.variant==="ts"?"TypeScript":"JavaScript"}
|
|
1541
|
+
${q.default.dim("\u2022 Styling:")} ${s.styling||"Unknown"}
|
|
1542
|
+
`);let u=await He({message:`Folder "${e}" already exists and is not empty.${a}`,options:[...s?[{value:"continue",label:"Continue with previous setup",hint:"Uses detected configuration"}]:[],{value:"overwrite",label:"Start fresh",hint:"\u26A0\uFE0F Clears directory and starts new setup"},{value:"cancel",label:"Cancel",hint:"Exit operation"}]});if(O(u)||u==="cancel")return null;if(u==="continue"&&s)return{projectName:e,framework:s.framework||"react",variant:s.variant||"ts",language:s.variant==="js"?"javascript":"typescript",styling:s.styling||"tailwind",ui:s.ui||"none",forms:s.forms||"none",state:s.state||"none",routing:s.routing||"none",dataFetching:s.dataFetching||"none",structure:s.structure||"feature",icons:s.icons||"lucide",optionalFeatures:[],...s};if(u==="overwrite"){let c=await ge({message:`Are you sure you want to clear "${e}"? This action cannot be undone.`});if(O(c)||!c)return null;await yf.rm(r,{recursive:!0,force:!0}),await yf.mkdir(r,{recursive:!0})}}let{loadPresets:i,deletePreset:n}=await Promise.resolve().then(()=>(Ru(),Ou)),o=await i();if(o.length>0){let s=await He({message:"Found custom presets. How would you like to proceed?",options:[{value:"none",label:"Start from scratch",hint:"Configure manually"},...o.map(a=>({value:a.name,label:a.name,hint:`Last used: ${new Date(a.createAt).toLocaleDateString()}`})),{value:"manage",label:"\u{1F5D1}\uFE0F Manage presets",hint:"Delete saved presets"}]});if(O(s))return null;if(s==="manage"){let a=!0;for(;a&&o.length>0;){let u=await He({message:"Select a preset to delete:",options:[...o.map(c=>({value:c.name,label:`\u{1F5D1}\uFE0F ${c.name}`,hint:`Created: ${new Date(c.createAt).toLocaleDateString()}`})),{value:"done",label:"\u2190 Back",hint:"Return to setup"}]});if(O(u)||u==="done")a=!1;else{let c=await ge({message:`Delete preset "${u}"?`,initialValue:!1});!O(c)&&c&&(await n(u),o=await i(),tt.success(`Deleted preset "${u}"`))}}}else if(s!=="none"){let a=o.find(u=>u.name===s);if(a)return pe(`Loaded preset "${a.name}"`,"\u2728 Preset Loaded"),{...a.selections,projectName:e,installDependencies:!0}}}for(;;){let s={projectName:e,packageManager:"npm"},{detectPackageManagerUsed:a}=await Promise.resolve().then(()=>(Fn(),Jp));s.packageManager=a();for(let E of hr){if(E.options.length===0||E.options.length===1&&E.options[0].value==="none"){s[E.name]="none";continue}E.name==="variant"?ts(`We recommend TypeScript for better type safety and developer experience.
|
|
1543
|
+
The "React Compiler" variant uses the new experimental compiler for auto-memoization.`):E.name==="styling"?ts(`Tailwind CSS offers a utility-first approach for rapid UI development.
|
|
1544
|
+
CSS Modules provide scoped CSS to avoid global conflicts.`):E.name==="state"?ts(`Local state (useState) is sufficient for simple apps.
|
|
1471
1545
|
Zustand is a lightweight, scalable global state manager.
|
|
1472
|
-
Redux is powerful but has more boilerplate.`):
|
|
1473
|
-
|
|
1474
|
-
`),"\u{1F4C1} Folders")
|
|
1475
|
-
`),"\u{1F4CB} Summary");let
|
|
1476
|
-
`),
|
|
1546
|
+
Redux is powerful but has more boilerplate.`):E.name==="dataFetching"&&ts("TanStack Query (React Query) handles caching, deduplication, and background updates automatically.");let Y=E.options.map(Se=>({value:Se.value,label:Se.name,hint:Se.hover_note})),j=await He({message:E.message,options:Y});if(O(j))return null;s[E.name]=j,E.name==="styling"&&j==="tailwind"?Ue(["tailwindcss","postcss","autoprefixer"]):E.name==="ui"?(j==="heroui"&&Ue(["@heroui/react","framer-motion"]),j==="chakra"&&Ue(["@chakra-ui/react","@emotion/react","@emotion/styled"]),j==="antd"&&Ue(["antd"]),j==="mui"&&Ue(["@mui/material","@emotion/react","@emotion/styled"])):E.name==="dataFetching"&&j==="tanstack-query"&&Ue(["@tanstack/react-query"]);let Et=E.options.find(Se=>Se.value===j);Et?.folder_info&&pe(Et.folder_info.join(`
|
|
1547
|
+
`),"\u{1F4C1} Folders")}let u=await Ps({message:"Select optional features (Space to select):",options:ci.options.map(E=>({value:E.value,label:E.name,hint:E.hover_note})),required:!1});if(O(u))return null;s.optionalFeatures=u;for(let E of u){let Y=Au[E];if(Y){let j=Y.options.map(Se=>({value:Se.value,label:Se.name,hint:Se.hover_note})),Et=Y.type==="checkbox"?await Ps({message:Y.message,options:j,required:!1}):await He({message:Y.message,options:j});if(O(Et))return null;s[E]=Et}}let c=await ge({message:"Do you want to configure import alias (@/*)?",initialValue:!0});if(O(c))return null;let{structurePrompt:l}=await Promise.resolve().then(()=>(Qn(),pf)),p=await He({message:l.message,options:l.options.map(E=>({value:E.value,label:E.name,hint:E.hover_note}))});if(O(p))return null;s.structure=p;let h=l.options.find(E=>E.value===p);h?.folder_info&&pe(h.folder_info.join(`
|
|
1548
|
+
`),"\u{1F4C1} Folders");let d={framework:"react",variant:s.variant,styling:s.styling,ui:s.ui,forms:s.forms,state:s.state,routing:s.routing,dataFetching:s.dataFetching,icons:s.icons},g=af(d),y=[`Project: ${q.default.cyan(s.projectName)}`,`Framework: ${q.default.cyan("react")}`,`Variant: ${q.default.cyan(s.variant)}`,`Styling: ${q.default.cyan(s.styling)}`,`UI Library: ${q.default.cyan(s.ui)}`,`Forms: ${q.default.cyan(s.forms)}`,`State: ${q.default.cyan(s.state)}`,`Routing: ${q.default.cyan(s.routing)}`,`Import Alias: ${q.default.cyan(c?"@/*":"None")}`,`Bundle Est.: ${q.default.green(uf(g))} ${q.default.dim("(Initial JS)")}`];pe(y.join(`
|
|
1549
|
+
`),"\u{1F4CB} Summary");let v=await ge({message:"Create project with these settings?"});if(O(v))return null;if(!v){let E=await ge({message:"Restart from beginning?",initialValue:!0});if(O(E)||!E)return null;console.clear(),Ei(q.default.bgCyan(q.default.black(" NEXO (Restarted) ")));continue}let z=await ge({message:`Install dependencies now? ${q.default.dim("(Recommended)")}`,initialValue:!0});if(O(z))return null;let C=s.variant,se={projectName:s.projectName,framework:"react",variant:C,language:C.startsWith("ts")?"typescript":"javascript",styling:s.styling,ui:s.ui,forms:s.forms,state:s.state,routing:s.routing,dataFetching:s.dataFetching,icons:s.icons,structure:s.structure,aiInstructions:s.optionalFeatures.includes("ai-instructions")?s["ai-instructions"]:void 0,hasCompiler:C.includes("compiler"),hasSWC:C.includes("swc"),packageManager:s.packageManager||"npm",installDependencies:z,rtl:s.optionalFeatures.includes("rtl-starter"),importAlias:c,testing:s.optionalFeatures.includes("testing")?s.testing:void 0,linting:s.optionalFeatures.includes("linting")?s.linting:void 0,animation:s.optionalFeatures.includes("animation")?s.animation:void 0,backend:s.optionalFeatures.includes("backend")?s.backend:void 0},oe=await ge({message:"Save this configuration as a preset?",initialValue:!1});if(!O(oe)&&oe){let E=await zt({message:"Preset name:",placeholder:"my-stack",validate:Y=>{if(!Y)return"Please enter a name"}});if(!O(E)){let{savePreset:Y}=await Promise.resolve().then(()=>(Ru(),Ou));await Y(E,se),pe(`Configuration saved as "${E}"`,"\u2728 Preset Saved")}}return se}}var q,ts,Cf=D(()=>{"use strict";Dr();q=V(ae(),1);cf();gf();bu();G();zn();ts=(e,t="\u{1F4A1} Educational Context")=>{Xn.isLearningMode&&pe(e,t)}});var Ef={};k(Ef,{createAction:()=>Kw});import rs from"node:path";async function Kw(e,t){cr(),t.learn&&(Xn.isLearningMode=!0),t.silent&&(console.log=()=>{},console.error=()=>{},console.warn=()=>{}),m.dim(` NEXO is a next-generation, extensible CLI for scaffolding and orchestrating modern frontend projects
|
|
1550
|
+
`),m.print(vi),Ei(A.default.bgCyan(A.default.black(" NEXO "))),await Ie.load();try{let r=e;r||(r=await zt({message:"Where should the project be created? (name, path, or . for current):",placeholder:"my-app",defaultValue:".",validate:l=>{}})),O(r)&&(xe("Operation cancelled."),process.exit(0));let i=rs.resolve(t.dir,r),n=rs.basename(i);t.dir=rs.dirname(i);let o;if(t.preset?(o=sf(t.preset,n),o||(m.error(`Invalid preset: "${t.preset}". Available items: ${Object.keys(yr).join(", ")}`),process.exit(1)),m.info(`Using preset: ${A.default.cyan(t.preset.toLowerCase())}`)):o=await bf(n,t.dir),o&&t.rtl!==void 0&&(o.rtl=t.rtl),o||(xe("Operation cancelled."),process.exit(0)),t.dryRun){Zw(o,t.dir);return}let s=Date.now(),a=rs.resolve(t.dir,o.projectName),u=t.template||fa(t.preset||"");if(u?await Jw(u,a,o):await Jn({selections:o,targetDir:t.dir,parallel:t.parallel}),o.installDependencies){let l=wc(),p=performance.now();l.start("Installing dependencies...");try{let h=o.packageManager||"npm",d=jt(h,{audit:t.audit,strict:t.strict}),[g,...y]=d.split(" "),{execa:v}=await Promise.resolve().then(()=>(ii(),Qm));await v(g,y,{cwd:a,stdio:"ignore"});let z=((performance.now()-p)/1e3).toFixed(2);l.stop(A.default.green(`\u2714 Dependencies installed successfully in ${z}s!`));let{prefetchedStats:C}=await Promise.resolve().then(()=>(zn(),ed));C.successCount>0?(m.newline(),m.dim(" \u{1F4E6} Prefetch Summary:"),m.print(` ${A.default.green("\u2713")} Cached: ${C.successCount} packages`),m.dim(" \u26A1 Speed boost active for next runs")):C.failCount>0}catch{l.stop(A.default.red("\u2716 Failed to install dependencies.")),m.warn("You can try installing manually.")}}let c=((Date.now()-s)/1e3).toFixed(2);gr(A.default.green(`\u2728 Project created successfully in ${c}s!`)),Xw(o,t)}catch(r){xe("Error creating project"),Lc(r,{projectName:e||"unknown"}),process.exit(1)}finally{await Ie.save()}}function Zw(e,t){m.newline(),m.header("DRY RUN MODE","warning"),m.warn("No files will be created."),m.newline();let r=Wt(e);pe(r,"\u{1F4C2} Files that would be created"),gr(A.default.cyan("Dry run complete. Run without --dry-run to create the project."))}async function Jw(e,t,r){await da(e,t);let{PackageManager:i}=await Promise.resolve().then(()=>(En(),Ca)),n=new i(t);await n.load({projectPath:t,selections:r,pkg:n}),n.set("name",r.projectName),await n.save()}function Xw(e,t){let r=e.packageManager||"npm",i=t.audit===!0,n=t.strict===!0,o=jt(r,{audit:i,strict:n}),s=`${r} run dev`;m.newline(),m.print(A.default.bold(A.default.cyan(" \u{1F680} Next Steps:"))),m.newline(),m.print(` ${A.default.dim("1.")} cd ${A.default.cyan(e.projectName)}`),m.newline(),e.installDependencies?(m.newline(),m.print(` ${A.default.dim("2.")} ${A.default.white(s)}`)):(r==="npm"&&!i&&!n&&m.print(` ${A.default.yellow("\u26A1")} ${A.default.bold(A.default.italic(A.default.red("Optimized & fast installation ready")))} ${A.default.dim("(Bypass security checks for 2x faster setup)")}`),m.print(` ${A.default.dim("2.")} ${A.default.white(o)}`),r==="npm"&&!i&&!n&&(m.newline(),m.print(` ${A.default.blue("\u{1F6E1}\uFE0F")} ${A.default.dim("Standard install (Secure & verified)")}`),m.print(` ${A.default.white("npm install")}`)),m.newline(),m.print(` ${A.default.dim("3.")} ${A.default.white(s)}`)),m.newline(),m.print(` ${A.default.magenta(A.default.bold("Happy coding!"))} ${A.default.dim("\u2014")} ${A.default.cyan("NEXO CLI")}`),m.newline()}var A,wf=D(()=>{"use strict";Dr();A=V(ae(),1);Is();Ns();Du();bu();Er();Ws();G();Ct();of();Cf()});var Vu=V(Gu(),1),{program:mv,createCommand:dv,createArgument:fv,createOption:gv,CommanderError:Dv,InvalidArgumentError:yv,InvalidOptionArgumentError:bv,Command:qu,Argument:Cv,Option:Ev,Help:wv}=Vu.default;import{createRequire as rv}from"node:module";var vf={name:"create",description:"Create a new project",isDefault:!0,args:[{name:"[name]",description:"Project name"}],options:[{flags:"-d, --dir <directory>",description:"Target directory",defaultValue:"."},{flags:"--dry-run",description:"Preview changes without creating files"},{flags:"-p, --preset <preset>",description:"Use a preset configuration (saas, dashboard, landing, ecommerce, etc.)"},{flags:"--parallel",description:"Use parallel execution for faster setup"},{flags:"--learn",description:"Enable educational mode with explanations"},{flags:"--template <repo>",description:"Clone a template from GitHub (e.g., user/repo)"},{flags:"--audit",description:"Enable security audit during installation"},{flags:"--strict",description:"Enable strict dependency resolution (disable --legacy-peer-deps)"},{flags:"--rtl",description:"Enable Arabic & RTL support with Cairo font"},{flags:"--silent",description:"Run in silent mode without console output"}],action:async(e,t)=>{let{createAction:r}=await Promise.resolve().then(()=>(wf(),Ef));return r(e,t)}};ii();var Sf=V(ae(),1);ot();Ct();import is from"node:path";async function Qw(){m.cyan(`
|
|
1477
1551
|
\u{1F5A5}\uFE0F System Environment
|
|
1478
|
-
`);let e=[{name:"Node.js",check:async()=>process.version},{name:"npm",check:async()=>{let{stdout:r}=await
|
|
1552
|
+
`);let e=[{name:"Node.js",check:async()=>process.version},{name:"npm",check:async()=>{let{stdout:r}=await ce("npm",["--version"]);return r.trim()}},{name:"Git",check:async()=>{let{stdout:r}=await ce("git",["--version"]);return r.trim().replace("git version ","")}},{name:"Git User",check:async()=>{try{let r=(await ce("git",["config","user.name"])).stdout.trim(),i=(await ce("git",["config","user.email"])).stdout.trim();return`${r} <${i}>`}catch{throw new Error("Git user not configured")}}}],t=!0;for(let{name:r,check:i}of e)try{let n=await i();m.success(` \u2713 ${r}: ${n}`)}catch{t=!1,m.error(` \u2717 ${r}: Not found or error`)}return t}async function ev(){m.cyan(`
|
|
1479
1553
|
\u{1F4E6} Project Health
|
|
1480
|
-
`);let e=process.cwd();if(!await
|
|
1554
|
+
`);let e=process.cwd();if(!await ke(is.join(e,"package.json")))return m.error("No package.json found. Run this in a project root."),!1;let t=!0;try{let r=await st({projectPath:e});m.info(`Project: ${Sf.default.bold(r.name||"unnamed")} v${r.version||"0.0.0"}`),m.newline(),m.dim("Running security audit...");try{let{stdout:a}=await ce("npm",["audit","--json"],{reject:!1}),c=JSON.parse(a).metadata?.vulnerabilities||{},l=Object.values(c).reduce((p,h)=>p+h,0);l===0?m.success("\u2713 Security: No known vulnerabilities found."):(t=!1,m.warn(`\u26A0\uFE0F Security: Found ${l} vulnerabilities.`),(c.high||c.critical)&&m.error(` Critical: ${c.critical||0}, High: ${c.high||0}`),m.dim(' Run "npm audit fix" to resolve.'))}catch{m.warn("Could not complete security audit.")}m.newline(),m.dim("Checking best practices..."),await ke(is.join(e,"package-lock.json"))||await ke(is.join(e,"yarn.lock"))||await ke(is.join(e,"pnpm-lock.yaml"))?m.success("\u2713 Lockfile present"):(t=!1,m.warn("\u26A0\uFE0F No lockfile found (package-lock.json, yarn.lock, etc).")),r.scripts&&(r.scripts.test?m.success("\u2713 Test script found"):m.warn("\u25CB No test script defined"),r.scripts.lint?m.success("\u2713 Lint script found"):m.warn("\u25CB No lint script defined")),m.newline(),m.dim("Bundle Analysis...");let n=["three","d3","lodash","moment","framer-motion"],o={...r.dependencies,...r.devDependencies},s=n.filter(a=>o[a]);s.length>0?(m.info(`\u2139\uFE0F Detected heavy dependencies: ${s.join(", ")}`),m.dim(" Consider using light-weight alternatives or tree-shaking.")):m.success("\u2713 No obviously heavy dependencies detected.")}catch(r){t=!1,m.error("Health check failed: "+(r instanceof Error?r.message:String(r)))}return t}var Ff={name:"check",description:"Run system and project health checks",options:[{flags:"-s, --system",description:"Run system checks only (Node, npm, Git)"},{flags:"-p, --project",description:"Run project checks only (security, lockfile, bundle)"}],action:async e=>{m.cyan(`
|
|
1481
1555
|
\u{1FA7A} NEXO Health Check
|
|
1482
|
-
`);let t=e.system||!e.system&&!e.project,r=e.project||!e.system&&!e.project,i=!0,n=!0;t&&(i=await
|
|
1556
|
+
`);let t=e.system||!e.system&&!e.project,r=e.project||!e.system&&!e.project,i=!0,n=!0;t&&(i=await Qw()),r&&(n=await ev()),m.newline(),i&&n?m.success("\u2728 All checks passed! System is ready for NEXO."):m.warn("\u26A0\uFE0F Some checks failed. Review the issues above."),m.newline()}};Ct();var xf={name:"presets",description:"List available project presets",action:async()=>{m.cyan(`
|
|
1483
1557
|
\u{1F4E6} Available Presets:
|
|
1484
|
-
`),
|
|
1485
|
-
`)}};
|
|
1486
|
-
\u{1F50D} Dry Run - Would update to: v${r}`),
|
|
1487
|
-
\u2728 NEXO CLI updated to v${r}!`)}catch(t){
|
|
1488
|
-
`),
|
|
1558
|
+
`),m.dim(" saas - Full-stack SaaS with auth and API"),m.dim(" dashboard - Admin dashboard with charts"),m.dim(" landing - Fast, SEO-optimized marketing page"),m.dim(" minimal - Bare-bones React + TypeScript"),m.newline(),m.dim(`Usage: nexo create my-app --preset=saas
|
|
1559
|
+
`)}};ii();Ct();var kf={name:"update",description:"Update NEXO CLI to the latest version",options:[{flags:"--dry-run",description:"Show what version would be installed without updating"}],action:async e=>{m.info("Checking for updates...");try{let{stdout:t}=await ce("npm",["view","create-nexo","version"]),r=t.trim();if(m.info(`Latest version: ${r}`),e.dryRun){m.cyan(`
|
|
1560
|
+
\u{1F50D} Dry Run - Would update to: v${r}`),m.dim(" Run without --dry-run to perform the update."),m.newline();return}m.info("Updating NEXO CLI..."),await ce("npm",["install","-g","create-nexo@latest"],{stdio:"inherit"}),m.success(`
|
|
1561
|
+
\u2728 NEXO CLI updated to v${r}!`)}catch(t){m.error("Failed to update NEXO CLI."),t instanceof Error&&m.dim(t.message)}}};Dr();var T=V(ae(),1);Is();Du();Dr();var ns=V(ae(),1);Ct();var Af={webapp:{name:"Web Application",description:"Interactive web application with forms and state",icon:"\u{1F310}",recommendations:{variant:"ts",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"zustand",routing:"react-router",dataFetching:"tanstack-query",icons:"lucide",structure:"feature-based",linting:"eslint-prettier",testing:"vitest"},features:["TypeScript for type safety","Tailwind CSS + shadcn/ui","Form handling with validation","State management","Client-side routing","TanStack Query for data fetching"]},dashboard:{name:"Admin Dashboard",description:"Data-rich admin panel with charts and tables",icon:"\u{1F4CA}",recommendations:{variant:"ts",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"redux",routing:"react-router",dataFetching:"tanstack-query",icons:"lucide",structure:"fsd",linting:"eslint-prettier",testing:"vitest"},features:["TypeScript for type safety","Tailwind CSS + shadcn/ui","Redux for complex state","FSD architecture","TanStack Query for data fetching"]},landing:{name:"Landing Page",description:"Fast, SEO-optimized marketing page",icon:"\u{1F680}",recommendations:{variant:"ts",styling:"tailwind",ui:"none",forms:"none",state:"none",routing:"none",dataFetching:"none",icons:"lucide",structure:"simple"},features:["TypeScript for type safety","Tailwind CSS for styling","Minimal dependencies","Fast load times","Simple structure","Easy to customize"]},"api-client":{name:"API Client",description:"Application consuming external APIs",icon:"\u{1F50C}",recommendations:{variant:"ts",styling:"tailwind",ui:"none",forms:"rhf-zod",state:"zustand",routing:"react-router",dataFetching:"tanstack-query",icons:"lucide",structure:"feature-based"},features:["TypeScript for type safety","TanStack Query for API calls","Zustand for client state","Form handling","Feature-based structure"]},portfolio:{name:"Portfolio Website",description:"Personal portfolio or showcase site",icon:"\u{1F464}",recommendations:{variant:"ts",styling:"tailwind",ui:"none",forms:"none",state:"none",routing:"react-router",dataFetching:"none",icons:"lucide",structure:"simple"},features:["TypeScript for type safety","Tailwind CSS for styling","Client-side routing","Lucide icons","Simple structure","Easy to personalize"]},ecommerce:{name:"E-Commerce",description:"Online store with cart and checkout",icon:"\u{1F6D2}",recommendations:{variant:"ts",styling:"tailwind",ui:"shadcn",forms:"rhf-zod",state:"zustand",routing:"tanstack-router",dataFetching:"tanstack-query",icons:"lucide",structure:"fsd"},features:["TypeScript for type safety","Tailwind CSS + shadcn/ui","Zustand for cart state","TanStack Router (type-safe)","TanStack Query for data fetching"]}},tv=e=>e.map(t=>` ${ns.default.green("\u2713")} ${t}`).join(`
|
|
1562
|
+
`),_f=async()=>{m.print(ns.default.cyan(`
|
|
1489
1563
|
\u{1F9D9} Welcome to NEXO Wizard!
|
|
1490
|
-
`)),
|
|
1491
|
-
`);let e=await
|
|
1564
|
+
`)),m.dim(`Let me help you set up your project.
|
|
1565
|
+
`);let e=await zt({message:"What is your project name?",placeholder:"my-awesome-app",defaultValue:"my-app",validate:a=>{let u=a||"my-app";if(!/^[a-z0-9-_]+$/i.test(u))return"Project name can only contain letters, numbers, hyphens, and underscores"}});if(O(e))return xe("Wizard cancelled."),null;let t=await He({message:"What are you building?",options:Object.entries(Af).map(([a,u])=>({value:a,label:`${u.icon} ${u.name}`,hint:u.description}))});if(O(t))return xe("Wizard cancelled."),null;let r=Af[t];console.log(),pe(`${ns.default.bold("Recommended stack for "+r.name+":")}
|
|
1492
1566
|
|
|
1493
|
-
${
|
|
1494
|
-
`),"\u{1F4CB} Configuration");let i=
|
|
1567
|
+
${tv(r.features)}`,"\u{1F4E6} Configuration");let i=await ge({message:"Use these recommended settings?",initialValue:!0});if(O(i))return xe("Wizard cancelled."),null;let n=await ge({message:"Do you want to enable Arabic & RTL support? (Cairo font, rtl dir)",initialValue:!1});if(O(n))return xe("Wizard cancelled."),null;let o=r.recommendations,s={projectName:e,framework:"react",variant:o.variant||"ts",language:(o.variant||"ts").startsWith("ts")?"typescript":"javascript",styling:o.styling||"tailwind",ui:o.ui||"none",forms:o.forms||"none",state:o.state||"none",routing:o.routing||"none",dataFetching:o.dataFetching||"none",icons:o.icons||"none",structure:o.structure||"simple",linting:o.linting||"none",testing:o.testing||"none",backend:o.backend||"none",rtl:n};return{projectName:e,projectType:t,selections:s,useRecommended:i}};G();var Tf={name:"wizard",alias:"w",description:"Guided project creation for beginners",options:[{flags:"-d, --dir <directory>",description:"Target directory",defaultValue:"."},{flags:"--audit",description:"Enable security audit during installation"},{flags:"--strict",description:"Enable strict dependency resolution"}],action:async e=>{cr(),m.print(vi);let t=await _f();t||process.exit(0);let r=[`Project: ${T.default.cyan(t.projectName)}`,`Type: ${T.default.cyan(t.projectType)}`,`Styling: ${T.default.cyan(t.selections.styling)}`,`UI: ${T.default.cyan(t.selections.ui)}`,`State: ${T.default.cyan(t.selections.state)}`,`Routing: ${T.default.cyan(t.selections.routing)}`];pe(r.join(`
|
|
1568
|
+
`),"\u{1F4CB} Configuration");let i=Wt(t.selections);pe(i,"\u{1F4C2} Files to be created");let n=await ge({message:"Create project with these settings?"});(O(n)||!n)&&(xe("Project creation cancelled."),process.exit(0));let o=Date.now();await Jn({selections:t.selections,targetDir:e.dir});let s=((Date.now()-o)/1e3).toFixed(2);gr(T.default.green(`\u2728 Project created successfully in ${s}s!`));let a=Sn(),u=t.selections.packageManager||"npm",c=e.audit===!0,l=e.strict===!0,p=jt(u,{audit:c,strict:l}),h=`${u} run dev`;m.newline(),m.print(T.default.bold(T.default.cyan(" \u{1F680} Next Steps:"))),m.newline(),m.print(` ${T.default.dim("1.")} cd ${T.default.cyan(t.projectName)}`),m.newline(),t.selections.installDependencies?(m.newline(),m.print(` ${T.default.dim("2.")} ${T.default.white(h)}`)):(u==="npm"&&!c&&!l&&m.print(` ${T.default.yellow("\u26A1")} ${T.default.bold(T.default.italic(T.default.red("Optimized & fast installation ready")))} ${T.default.dim("(Bypass security checks for 2x faster setup)")}`),m.print(` ${T.default.dim("2.")} ${T.default.white(p)}`),u==="npm"&&!c&&!l&&(m.newline(),m.print(` ${T.default.blue("\u{1F6E1}\uFE0F")} ${T.default.dim("Standard install (Secure & verified)")}`),m.print(` ${T.default.white("npm install")}`)),m.newline(),m.print(` ${T.default.dim("3.")} ${T.default.white(h)}`)),u==="npm"&&a.includes("pnpm")&&(m.newline(),m.warn(" \u26A1 Pro tip: Using pnpm can be 3x faster for this project.")),m.newline(),m.print(` ${T.default.magenta(T.default.bold("Happy coding!"))} ${T.default.dim("\u2014")} ${T.default.cyan("NEXO CLI")}`),m.newline()}};var Of=[Ff,xf,Tf,vf,kf];var iv=rv(import.meta.url),{version:nv}=iv("../../package.json"),$u=new qu;$u.name("nexo").description("NEXO is a next-generation, extensible CLI for scaffolding and orchestrating modern frontend projects").version(nv).option("--verbose","Enable verbose output for detailed logs").hook("preAction",e=>{e.opts().verbose&&(process.env.NEXO_VERBOSE="true")});for(let e of Of){let t=$u.command(e.name,{isDefault:e.isDefault});if(e.alias&&t.alias(e.alias),t.description(e.description),e.args)for(let r of e.args)t.argument(r.name,r.description);if(e.options)for(let r of e.options)r.defaultValue!==void 0?t.option(r.flags,r.description,r.defaultValue):t.option(r.flags,r.description);t.action(e.action)}$u.parse();
|