create-nexo 1.8.0 → 1.8.2
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 +57 -25
- package/dist/bin/nexo.js +163 -163
- package/package.json +12 -6
package/dist/bin/nexo.js
CHANGED
|
@@ -5,136 +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 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
|
|
8
|
+
var Of=Object.create;var ss=Object.defineProperty;var Rf=Object.getOwnPropertyDescriptor;var $f=Object.getOwnPropertyNames;var Pf=Object.getPrototypeOf,If=Object.prototype.hasOwnProperty;var ce=(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})},Nf=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $f(t))!If.call(e,n)&&n!==r&&ss(e,n,{get:()=>t[n],enumerable:!(i=Rf(t,n))||i.enumerable});return e};var G=(e,t,r)=>(r=e!=null?Of(Pf(e)):{},Nf(t||!e||!e.__esModule?ss(r,"default",{value:e,enumerable:!0}):r,e));var mr=I(as=>{var ci=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 ci{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};as.CommanderError=ci;as.InvalidArgumentError=os});var li=I(cs=>{var{InvalidArgumentError:jf}=mr(),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 jf(`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 Bf(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}cs.Argument=us;cs.humanReadableArgName=Bf});var ps=I(Ru=>{var{humanReadableArgName:Lf}=li(),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=>Lf(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 w=`${g.padEnd(i+s)}${y}`;return r.wrap(w,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 m=r.visibleCommands(t).map(g=>a(r.subcommandTerm(g),r.subcommandDescription(g)));return m.length>0&&(c=c.concat(["Commands:",u(m),""])),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),h="\\s\u200B",
|
|
13
|
-
|.{1,${a-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g"),g=c.match(
|
|
12
|
+
`),l=" ".repeat(i),h="\\s\u200B",m=new RegExp(`
|
|
13
|
+
|.{1,${a-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g"),g=c.match(m)||[];return u+g.map((y,w)=>y===`
|
|
14
14
|
`?"":(w>0?l:"")+y.trimEnd()).join(`
|
|
15
|
-
`)}};
|
|
15
|
+
`)}};Ru.Help=ls});var fs=I(ds=>{var{InvalidArgumentError:Mf}=mr(),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=zf(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 Mf(`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 Uf(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 Uf(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function zf(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 Pu=I($u=>{function Hf(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 Wf(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=Hf(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 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
|
|
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]}?)`:""}$u.suggestSimilar=Wf});var Lu=I(Bu=>{var Gf=ce("node:events").EventEmitter,gs=ce("node:child_process"),Ue=ce("node:path"),Ds=ce("node:fs"),B=ce("node:process"),{Argument:Vf,humanReadableArgName:qf}=li(),{CommanderError:ys}=mr(),{Help:Yf}=ps(),{Option:Iu,DualOptions:Kf}=fs(),{suggestSimilar:Nu}=Pu(),bs=class e extends Gf{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 Yf,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 Vf(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 Iu(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 Iu)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=Ue.resolve(l,p);if(Ds.existsSync(h))return h;if(n.includes(Ue.extname(p)))return;let m=n.find(g=>Ds.existsSync(`${h}${g}`));if(m)return`${h}${m}`}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=Ue.resolve(Ue.dirname(l),a)}if(a){let l=o(a,s);if(!l&&!t._executableFile&&this._scriptPath){let p=Ue.basename(this._scriptPath,Ue.extname(this._scriptPath));p!==this._name&&(l=o(a,`${p}-${t._name}`))}s=l||s}i=n.includes(Ue.extname(s));let u;B.platform!=="win32"?i?(r.unshift(s),r=ju(B.execArgv).concat(r),u=gs.spawn(B.argv[0],r,{stdio:"inherit"})):u=gs.spawn(s,r,{stdio:"inherit"}):(r.unshift(s),r=ju(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 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
|
|
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 Kf(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=Nu(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=Nu(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=>qf(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=Ue.basename(t,Ue.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 ju(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})}Bu.Command=bs});var Hu=I(ye=>{var{Argument:Mu}=li(),{Command:Cs}=Lu(),{CommanderError:Zf,InvalidArgumentError:Uu}=mr(),{Help:Jf}=ps(),{Option:zu}=fs();ye.program=new Cs;ye.createCommand=e=>new Cs(e);ye.createOption=(e,t)=>new zu(e,t);ye.createArgument=(e,t)=>new Mu(e,t);ye.Command=Cs;ye.Option=zu;ye.Argument=Mu;ye.Help=Jf;ye.CommanderError=Zf;ye.InvalidArgumentError=Uu;ye.InvalidOptionArgumentError=Uu});var ws=I((wv,Vu)=>{"use strict";var Es={to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e,t){let r="";return e<0?r+=`\x1B[${-e}D`:e>0&&(r+=`\x1B[${e}C`),t<0?r+=`\x1B[${-t}A`:t>0&&(r+=`\x1B[${t}B`),r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Xf={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Qf={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Es.up():"");return e&&(t+=Es.left),t}};Vu.exports={cursor:Es,scroll:Xf,erase:Qf,beep:"\x07"}});var oe=I((vv,vs)=>{var hi=process||{},qu=hi.argv||[],pi=hi.env||{},eg=!(pi.NO_COLOR||qu.includes("--no-color"))&&(!!pi.FORCE_COLOR||qu.includes("--color")||hi.platform==="win32"||(hi.stdout||{}).isTTY&&pi.TERM!=="dumb"||!!pi.CI),tg=(e,t,r=e)=>i=>{let n=""+i,o=n.indexOf(t,e.length);return~o?e+rg(n,t,r,o)+t:e+n+t},rg=(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)},Yu=(e=eg)=>{let t=e?tg:()=>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")}};vs.exports=Yu();vs.exports.createColors=Yu});import{stdin as sc,stdout as oc}from"node:process";import*as Qe from"node:readline";import Ku from"node:readline";import{WriteStream as ig}from"node:tty";function ng({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 ac(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(sg,"")}function uc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function dr(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=ac(e),e.length===0))return 0;e=e.replace(cg()," ");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(ag.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=r;break;default:i+=1}}return i}function hg(){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=Zu(),$.color.ansi256=Ju(),$.color.ansi16m=Xu(),$.bgColor.ansi=Zu(Ss),$.bgColor.ansi256=Ju(Ss),$.bgColor.ansi16m=Xu(Ss),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 tc(e,t,r){return String(e).normalize().replace(/\r\n/g,`
|
|
30
30
|
`).split(`
|
|
31
|
-
`).map(i=>
|
|
32
|
-
`)}function
|
|
31
|
+
`).map(i=>yg(i,t,r)).join(`
|
|
32
|
+
`)}function Eg(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 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,
|
|
36
|
-
`?(o&&(i+=
|
|
37
|
-
`&&(n&&p&&(i+=
|
|
38
|
-
`),
|
|
39
|
-
`).length-1;this.output.write(
|
|
40
|
-
`);this.output.write(n[i]),this._prevFrame=t,this.output.write(
|
|
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===hc}function mi(e,t){e.isTTY&&e.setRawMode(t)}function fc({input:e=sc,output:t=oc,overwrite:r=!0,hideCursor:i=!0}={}){let n=Qe.createInterface({input:e,output:t,prompt:"",tabSize:1});Qe.emitKeypressEvents(e,n),e.isTTY&&e.setRawMode(!0);let o=(s,{name:a})=>{if(String(s)===""){i&&t.write(Q.cursor.show),process.exit(0);return}if(!r)return;Qe.moveCursor(t,a==="return"?0:-1,a==="return"?-1:0,()=>{Qe.clearLine(t,1,()=>{e.once("keypress",o)})})};return i&&t.write(Q.cursor.hide),e.once("keypress",o),()=>{e.off("keypress",o),i&&t.write(Q.cursor.show),e.isTTY&&!Tg&&e.setRawMode(!1),n.terminal=!1,n.close()}}var Q,di,sg,cc,og,ag,ug,cg,Ss,Zu,Ju,Xu,$,lg,pg,mg,Di,dg,xs,lc,fg,pc,ks,Qu,ec,gg,Fs,Dg,yg,bg,Cg,be,hc,rc,wg,Lt,fi,vg,Sg,ic,mc,Fg,xg,nc,dc,kg,Ag,_g,gi,Tg,As=D(()=>{Q=G(ws(),1),di=G(oe(),1);sg=ng();cc={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}})(cc);og=cc.exports,ag=uc(og),ug=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},cg=uc(ug);Ss=10,Zu=(e=0)=>t=>`\x1B[${t+e}m`,Ju=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Xu=(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);lg=Object.keys($.color),pg=Object.keys($.bgColor);[...lg,...pg];mg=hg(),Di=new Set(["\x1B","\x9B"]),dg=39,xs="\x07",lc="[",fg="]",pc="m",ks=`${fg}8;;`,Qu=e=>`${Di.values().next().value}${lc}${e}${pc}`,ec=e=>`${Di.values().next().value}${ks}${e}${xs}`,gg=e=>e.split(" ").map(t=>dr(t)),Fs=(e,t,r)=>{let i=[...t],n=!1,o=!1,s=dr(ac(e[e.length-1]));for(let[a,u]of i.entries()){let c=dr(u);if(s+c<=r?e[e.length-1]+=u:(e.push(u),s=0),Di.has(u)&&(n=!0,o=i.slice(a+1).join("").startsWith(ks)),n){o?u===xs&&(n=!1,o=!1):u===pc&&(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())},Dg=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(dr(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},yg=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,o,s=gg(e),a=[""];for(let[c,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=dr(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,m=1+Math.floor((s[c]-h-1)/t);Math.floor((s[c]-1)/t)<m&&a.push(""),Fs(a,l,t);continue}if(p+s[c]>t&&p>0&&s[c]>0){if(r.wordWrap===!1&&p<t){Fs(a,l,t);continue}a.push("")}if(p+s[c]>t&&r.wordWrap===!1){Fs(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>Dg(c)));let u=[...a.join(`
|
|
35
|
+
`)];for(let[c,l]of u.entries()){if(i+=l,Di.has(l)){let{groups:h}=new RegExp(`(?:\\${lc}(?<code>\\d+)m|\\${ks}(?<uri>.*)${xs})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let m=Number.parseFloat(h.code);n=m===dg?void 0:m}else h.uri!==void 0&&(o=h.uri.length===0?void 0:h.uri)}let p=mg.codes.get(Number(n));u[c+1]===`
|
|
36
|
+
`?(o&&(i+=ec("")),n&&p&&(i+=Qu(p))):l===`
|
|
37
|
+
`&&(n&&p&&(i+=Qu(n)),o&&(i+=ec(o)))}return i};bg=Object.defineProperty,Cg=(e,t,r)=>t in e?bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,be=(e,t,r)=>(Cg(e,typeof t!="symbol"?t+"":t,r),r);hc=Symbol("clack:cancel");rc=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),wg=new Set(["up","down","left","right","space","enter"]),Lt=class{constructor({render:t,input:r=sc,output:i=oc,...n},o=!0){be(this,"input"),be(this,"output"),be(this,"rl"),be(this,"opts"),be(this,"_track",!1),be(this,"_render"),be(this,"_cursor",0),be(this,"state","initial"),be(this,"value"),be(this,"error",""),be(this,"subscribers",new Map),be(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 ig(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=Ku.createInterface({input:this.input,output:t,tabSize:2,prompt:"",escapeCodeTimeout:50}),Ku.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),mi(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((r,i)=>{this.once("submit",()=>{this.output.write(Q.cursor.show),this.output.off("resize",this.render),mi(this.input,!1),r(this.value)}),this.once("cancel",()=>{this.output.write(Q.cursor.show),this.output.off("resize",this.render),mi(this.input,!1),r(hc)})})}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&&rc.has(r.name)&&this.emit("cursor",rc.get(r.name)),r?.name&&wg.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
|
+
`),mi(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let t=tc(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
39
|
+
`).length-1;this.output.write(Q.cursor.move(-999,t*-1))}render(){let t=tc(this._render(this)??"",process.stdout.columns,{hard:!0});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(Q.cursor.hide);else{let r=Eg(this._prevFrame,t);if(this.restoreCursor(),r&&r?.length===1){let i=r[0];this.output.write(Q.cursor.move(0,i)),this.output.write(Q.erase.lines(1));let n=t.split(`
|
|
40
|
+
`);this.output.write(n[i]),this._prevFrame=t,this.output.write(Q.cursor.move(0,n.length-i-1));return}else if(r&&r?.length>1){let i=r[0];this.output.write(Q.cursor.move(0,i)),this.output.write(Q.erase.down());let n=t.split(`
|
|
41
41
|
`).slice(i);this.output.write(n.join(`
|
|
42
|
-
`)),this._prevFrame=t;return}this.output.write(
|
|
43
|
-
${
|
|
42
|
+
`)),this._prevFrame=t;return}this.output.write(Q.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}},fi=class extends Lt{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(Q.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},vg=Object.defineProperty,Sg=(e,t,r)=>t in e?vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ic=(e,t,r)=>(Sg(e,typeof t!="symbol"?t+"":t,r),r),mc=class extends Lt{constructor(e){super(e,!1),ic(this,"options"),ic(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]}},Fg=Object.defineProperty,xg=(e,t,r)=>t in e?Fg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nc=(e,t,r)=>(xg(e,typeof t!="symbol"?t+"":t,r),r),dc=class extends Lt{constructor(e){super(e,!1),nc(this,"options"),nc(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}},kg=Object.defineProperty,Ag=(e,t,r)=>t in e?kg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_g=(e,t,r)=>(Ag(e,typeof t!="symbol"?t+"":t,r),r),gi=class extends Lt{constructor(t){super(t),_g(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}${di.default.inverse(di.default.hidden("_"))}`;else{let r=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.valueWithCursor=`${r}${di.default.inverse(i[0])}${i.slice(1)}`}})}get cursor(){return this._cursor}},Tg=globalThis.process.platform.startsWith("win")});import Se from"node:process";function Og(){return Se.platform!=="win32"?Se.env.TERM!=="linux":!!Se.env.CI||!!Se.env.WT_SESSION||!!Se.env.TERMINUS_SUBLIME||Se.env.ConEmuTask==="{cmd::Cmder}"||Se.env.TERM_PROGRAM==="Terminus-Sublime"||Se.env.TERM_PROGRAM==="vscode"||Se.env.TERM==="xterm-256color"||Se.env.TERM==="alacritty"||Se.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}function Hg(){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,Mt,Ts,M,Rg,yc,bc,yi,$g,F,tt,Os,Rs,Pg,gc,Ig,Iv,Dc,Ng,jg,Bg,Lg,Mg,Ug,zg,bi,Ut,fe,ze,$s,_s,le,Fe,Ci,fr,et,Cc,gr=D(()=>{As();As();f=G(oe(),1),Mt=G(ws(),1);Ts=Og(),M=(e,t)=>Ts?e:t,Rg=M("\u25C6","*"),yc=M("\u25A0","x"),bc=M("\u25B2","x"),yi=M("\u25C7","o"),$g=M("\u250C","T"),F=M("\u2502","|"),tt=M("\u2514","\u2014"),Os=M("\u25CF",">"),Rs=M("\u25CB"," "),Pg=M("\u25FB","[\u2022]"),gc=M("\u25FC","[+]"),Ig=M("\u25FB","[ ]"),Iv=M("\u25AA","\u2022"),Dc=M("\u2500","-"),Ng=M("\u256E","+"),jg=M("\u251C","+"),Bg=M("\u256F","+"),Lg=M("\u25CF","\u2022"),Mg=M("\u25C6","*"),Ug=M("\u25B2","!"),zg=M("\u25A0","x"),bi=e=>{switch(e){case"initial":case"active":return f.default.cyan(Rg);case"cancel":return f.default.red(yc);case"error":return f.default.yellow(bc);case"submit":return f.default.green(yi)}},Ut=e=>new gi({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${f.default.gray(F)}
|
|
43
|
+
${bi(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
45
|
${f.default.yellow(F)} ${i}
|
|
46
|
-
${f.default.yellow(
|
|
46
|
+
${f.default.yellow(tt)} ${f.default.yellow(this.error)}
|
|
47
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
48
|
`+f.default.gray(F):""}`;default:return`${t}${f.default.cyan(F)} ${i}
|
|
49
|
-
${f.default.cyan(
|
|
50
|
-
`}}}).prompt(),
|
|
51
|
-
${
|
|
49
|
+
${f.default.cyan(tt)}
|
|
50
|
+
`}}}).prompt(),fe=e=>{let t=e.active??"Yes",r=e.inactive??"No";return new fi({active:t,inactive:r,initialValue:e.initialValue??!0,render(){let i=`${f.default.gray(F)}
|
|
51
|
+
${bi(this.state)} ${e.message}
|
|
52
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(
|
|
54
|
-
${f.default.cyan(
|
|
55
|
-
`}}}).prompt()},
|
|
56
|
-
${
|
|
53
|
+
${f.default.gray(F)}`;default:return`${i}${f.default.cyan(F)} ${this.value?`${f.default.green(Os)} ${t}`:`${f.default.dim(Rs)} ${f.default.dim(t)}`} ${f.default.dim("/")} ${this.value?`${f.default.dim(Rs)} ${f.default.dim(r)}`:`${f.default.green(Os)} ${r}`}
|
|
54
|
+
${f.default.cyan(tt)}
|
|
55
|
+
`}}}).prompt()},ze=e=>{let t=(i,n)=>{let o=i.label??String(i.value);return n==="active"?`${f.default.green(Os)} ${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(Rs)} ${f.default.dim(o)}`},r=0;return new dc({options:e.options,initialValue:e.initialValue,render(){let i=`${f.default.gray(F)}
|
|
56
|
+
${bi(this.state)} ${e.message}
|
|
57
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
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
59
|
${f.default.cyan(F)} `)}
|
|
60
|
-
${f.default.cyan(
|
|
61
|
-
`}}}}).prompt()}
|
|
60
|
+
${f.default.cyan(tt)}
|
|
61
|
+
`}}}}).prompt()},$s=e=>{let t=(r,i)=>{let n=r.label??String(r.value);return i==="active"?`${f.default.cyan(Pg)} ${n} ${r.hint?f.default.dim(`(${r.hint})`):""}`:i==="selected"?`${f.default.green(gc)} ${f.default.dim(n)}`:i==="cancelled"?`${f.default.strikethrough(f.default.dim(n))}`:i==="active-selected"?`${f.default.green(gc)} ${n} ${r.hint?f.default.dim(`(${r.hint})`):""}`:i==="submitted"?`${f.default.dim(n)}`:`${f.default.dim(Ig)} ${f.default.dim(n)}`};return new mc({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
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
|
-
${
|
|
63
|
+
${bi(this.state)} ${e.message}
|
|
64
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
65
|
${f.default.gray(F)}`:""}`}case"error":{let i=this.error.split(`
|
|
66
|
-
`).map((n,o)=>o===0?`${f.default.yellow(
|
|
66
|
+
`).map((n,o)=>o===0?`${f.default.yellow(tt)} ${f.default.yellow(n)}`:` ${n}`).join(`
|
|
67
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
68
|
${f.default.yellow(F)} `)+`
|
|
69
69
|
`+i+`
|
|
70
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
71
|
${f.default.cyan(F)} `)}
|
|
72
|
-
${f.default.cyan(
|
|
73
|
-
`}}}).prompt()},
|
|
72
|
+
${f.default.cyan(tt)}
|
|
73
|
+
`}}}).prompt()},_s=e=>e.replace(Hg(),""),le=(e="",t="")=>{let r=`
|
|
74
74
|
${e}
|
|
75
75
|
`.split(`
|
|
76
|
-
`),i=
|
|
76
|
+
`),i=_s(t).length,n=Math.max(r.reduce((s,a)=>(a=_s(a),a.length>s?a.length:s),0),i)+2,o=r.map(s=>`${f.default.gray(F)} ${f.default.dim(s)}${" ".repeat(n-_s(s).length)}${f.default.gray(F)}`).join(`
|
|
77
77
|
`);process.stdout.write(`${f.default.gray(F)}
|
|
78
|
-
${f.default.green(
|
|
78
|
+
${f.default.green(yi)} ${f.default.reset(t)} ${f.default.gray(Dc.repeat(Math.max(n-i-1,1))+Ng)}
|
|
79
79
|
${o}
|
|
80
|
-
${f.default.gray(
|
|
81
|
-
`)},
|
|
80
|
+
${f.default.gray(jg+Dc.repeat(n+2)+Bg)}
|
|
81
|
+
`)},Fe=(e="")=>{process.stdout.write(`${f.default.gray(tt)} ${f.default.red(e)}
|
|
82
82
|
|
|
83
|
-
`)},
|
|
84
|
-
`)},
|
|
85
|
-
${f.default.gray(
|
|
83
|
+
`)},Ci=(e="")=>{process.stdout.write(`${f.default.gray($g)} ${e}
|
|
84
|
+
`)},fr=(e="")=>{process.stdout.write(`${f.default.gray(F)}
|
|
85
|
+
${f.default.gray(tt)} ${e}
|
|
86
86
|
|
|
87
|
-
`)},
|
|
87
|
+
`)},et={message:(e="",{symbol:t=f.default.gray(F)}={})=>{let r=[`${f.default.gray(F)}`];if(e){let[i,...n]=e.split(`
|
|
88
88
|
`);r.push(`${t} ${i}`,...n.map(o=>`${f.default.gray(F)} ${o}`))}process.stdout.write(`${r.join(`
|
|
89
89
|
`)}
|
|
90
|
-
`)},info:e=>{
|
|
91
|
-
`);let p=0,h=0;i=setInterval(()=>{let
|
|
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
|
|
93
|
-
${
|
|
94
|
-
${
|
|
95
|
-
${
|
|
96
|
-
${
|
|
97
|
-
${
|
|
98
|
-
${
|
|
99
|
-
`});var
|
|
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>
|
|
101
|
-
`)},v=async(e,t)=>{if(await
|
|
102
|
-
`,i.children&&(r+=
|
|
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,w=1,z=g|y;return c&w||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=[],w=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(w(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?w(0).then(C=>p(null,C),p):w(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 w=p[y],z=/^".*"$/.test(w)?w.slice(1,-1):w,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(w=>n.argument(w,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
|
|
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 w=b.lstatSync(y);if(w.isDirectory())continue;if(c){b.unlinkSync(y),b.mkdirSync(y,i),d||=y;continue}else if(w.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
|
|
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,w)=>{if(!y&&w)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
|
|
109
|
-
${t}`,
|
|
110
|
-
${i.message}`:w,
|
|
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
|
|
113
|
-
`)},fail:s=>{process.stdout.write(`\r${
|
|
114
|
-
`)},skip:s=>{let a=s?` (${s})`:"";process.stdout.write(`\r${
|
|
115
|
-
`)},complete:()=>{console.log(),console.log(
|
|
90
|
+
`)},info:e=>{et.message(e,{symbol:f.default.blue(Lg)})},success:e=>{et.message(e,{symbol:f.default.green(Mg)})},step:e=>{et.message(e,{symbol:f.default.green(yi)})},warn:e=>{et.message(e,{symbol:f.default.yellow(Ug)})},warning:e=>{et.warn(e)},error:e=>{et.message(e,{symbol:f.default.red(zg)})}},Cc=()=>{let e=Ts?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=Ts?80:120,r,i,n=!1,o="",s=(l="")=>{n=!0,r=fc(),o=l.replace(/\.+$/,""),process.stdout.write(`${f.default.gray(F)}
|
|
91
|
+
`);let p=0,h=0;i=setInterval(()=>{let m=f.default.magenta(e[p]),g=".".repeat(Math.floor(h)).slice(0,3);process.stdout.write(Mt.cursor.move(-999,0)),process.stdout.write(Mt.erase.down(1)),process.stdout.write(`${m} ${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(yi):p===1?f.default.red(yc):f.default.red(bc);process.stdout.write(Mt.cursor.move(-999,0)),process.stdout.write(Mt.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 Wg}from"node:module";var Et,Gg,Vg,wi,Ps=D(()=>{"use strict";Et=G(oe(),1),Gg=Wg(import.meta.url),Vg=Gg("../../package.json"),wi=`
|
|
93
|
+
${Et.default.cyan(" _ _ _____ __ __ ___ ")}
|
|
94
|
+
${Et.default.cyan(" | \\ | || ____|\\ \\/ / / _ \\ ")}
|
|
95
|
+
${Et.default.cyan(" | \\| || _| \\ / | | | |")}
|
|
96
|
+
${Et.default.cyan(" | |\\ || |___ / \\ | |_| |")}
|
|
97
|
+
${Et.default.cyan(" |_| \\_||_____|/_/\\_\\ \\___/ ")}
|
|
98
|
+
${Et.default.dim(" v"+Vg.version)}
|
|
99
|
+
`});var Dr,Is=D(()=>{"use strict";Dr={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 Ec,wc,vc,Sc,Fc,xc,kc,Ac,_c,Tc,Re,rt,yr,Oc,vi,br=D(()=>{"use strict";Ec={SHADCN:"shadcn",RADIX:"radix",HEROUI:"heroui",ANTD:"antd",CHAKRA:"chakra",NONE:"none"},wc={TAILWIND:"tailwind",CSS_MODULES:"css-modules"},vc={REACT:"react"},Sc={TS:"ts",TS_COMPILER:"ts-compiler",TS_SWC:"ts-swc",JS:"js",JS_COMPILER:"js-compiler",JS_SWC:"js-swc"},Fc={ZUSTAND:"zustand",REDUX:"redux",JOTAI:"jotai",NONE:"none"},xc={RHF_ZOD:"rhf-zod",RHF_YUP:"rhf-yup",TANSTACK_FORM:"tanstack-form",NONE:"none"},kc={REACT_ROUTER:"react-router",TANSTACK_ROUTER:"tanstack-router",NONE:"none"},Ac={TANSTACK_QUERY:"tanstack-query",AXIOS:"axios",FETCH:"fetch",NONE:"none"},_c={LUCIDE:"lucide",HEROICONS:"heroicons",NONE:"none"},Tc={FEATURE_BASED:"feature-based",SIMPLE:"simple"},Re=260,rt=255,yr=100*1024*1024,Oc="my-nexo-app",vi={maxRetries:3,initialDelayMs:1e3,backoffMultiplier:2,maxDelayMs:1e4}});var Ce,Si=D(()=>{"use strict";Ce=class extends Error{constructor(r,i,n){super(r);this.code=i;this.context=n;this.name="NexoError",Error.captureStackTrace?.(this,this.constructor)}}});var Rc=D(()=>{"use strict"});var Fi,xi,ki,$c,Pc,Ic=D(()=>{"use strict";br();Si();Fi=class extends Ce{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"}},xi=class extends Ce{constructor(r,i,n){super(r,"RATE_LIMIT_ERROR",{retryAfter:i,resetTime:n?.toISOString()});this.retryAfter=i;this.resetTime=n;this.name="RateLimitError"}},ki=class extends Ce{constructor(t="No network connection available"){super(t,"OFFLINE_ERROR",{}),this.name="OfflineError"}},$c=(e,t=vi)=>{let r=t.initialDelayMs*Math.pow(t.backoffMultiplier,e);return Math.min(r,t.maxDelayMs)},Pc=e=>new Promise(t=>setTimeout(t,e))});var L,Ai,it,_i,Nc,jc,Cr=D(()=>{"use strict";L=G(oe(),1);Si();Si();Rc();Ic();Ai=class extends Ce{constructor(t,r){super(t,"VALIDATION_ERROR",r),this.name="ValidationError"}},it=class extends Ce{constructor(t,r,i){super(t,"FS_ERROR",{path:r,originalError:i?.message}),this.name="FileSystemError"}},_i=class extends Ce{constructor(t,r){super(t,"COMPATIBILITY_ERROR",{selections:r}),this.name="CompatibilityError"}},Nc={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"]}},jc=(e,t)=>{if(console.log(),e instanceof Ce){let r=Nc[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=Nc[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 Er from"node:fs/promises";import qg from"node:os";import Ns from"node:path";var Lc,Yg,Bc,Mc,Uc,js,Bs=D(()=>{"use strict";br();Cr();Lc=async e=>{let t=Ns.dirname(e),r=Ns.join(t,`.nexo-write-test-${Date.now()}`);try{await Er.mkdir(t,{recursive:!0}),await Er.writeFile(r,""),await Er.unlink(r)}catch(i){let n=i;if(n.code==="EACCES"||n.code==="EPERM")throw new it(`Permission denied: Cannot write to "${t}"`,t,i);if(n.code!=="ENOENT")throw new it(`Cannot access directory "${t}": ${n.message}`,t,i)}},Yg=async e=>{try{let t=await Er.statfs(e);return{available:t.bavail*t.bsize,total:t.blocks*t.bsize}}catch{let t=Ns.dirname(e);if(t!==e)try{let r=await Er.statfs(t);return{available:r.bavail*r.bsize,total:r.blocks*r.bsize}}catch{return null}return null}},Bc=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`,Mc=async(e,t=yr)=>{let r=await Yg(e);if(r===null){console.warn("\u26A0 Unable to check disk space. Proceeding anyway...");return}if(r.available<t)throw new it(`Insufficient disk space: ${Bc(r.available)} available, ${Bc(t)} required`,e)},Uc=e=>{if(qg.platform()==="win32"&&e.length>=Re)throw new it(`Path too long: ${e.length} characters exceeds Windows limit of ${Re}.
|
|
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>rt)throw new it(`Path component "${i.slice(0,50)}..." is too long (${i.length} chars). Maximum is ${rt} characters.`,e)},js=async(e,t={})=>{let{checkPermissions:r=!0,checkDisk:i=!0,requiredDiskSpace:n=yr,validatePath:o=!0}=t;o&&Uc(e),r&&await Lc(e),i&&await Mc(e,n)}});var Vc={};k(Vc,{addDependency:()=>wr,addScript:()=>Gc,appendFile:()=>zt,copy:()=>Wc,createProjectDir:()=>Ti,ensureDir:()=>x,getPackageJson:()=>nt,pathExists:()=>xe,readJson:()=>Ms,remove:()=>Hc,removeFile:()=>zc,savePackageJson:()=>Oi,writeFile:()=>v,writeJson:()=>He});import $e from"node:fs/promises";import Ls from"node:path";var xe,x,Ms,He,v,zt,zc,Hc,Wc,Ti,nt,Oi,wr,Gc,st=D(()=>{"use strict";Bs();xe=async e=>{try{return await $e.access(e),!0}catch{return!1}},x=async e=>{await $e.mkdir(e,{recursive:!0})},Ms=async e=>{let t=await $e.readFile(e,"utf-8");return JSON.parse(t)},He=async(e,t,r=2)=>{await $e.writeFile(e,JSON.stringify(t,null,r)+`
|
|
101
|
+
`)},v=async(e,t)=>{if(await xe(e))try{if(await $e.readFile(e,"utf-8")===t)return}catch{}await $e.writeFile(e,t)},zt=async(e,t)=>{await $e.appendFile(e,t)},zc=async e=>{await $e.unlink(e)},Hc=async e=>{await $e.rm(e,{recursive:!0,force:!0})},Wc=async(e,t)=>{await $e.cp(e,t,{recursive:!0})},Ti=async e=>{await js(e.projectPath),await x(e.projectPath),await x(Ls.join(e.projectPath,"src"))},nt=async e=>{let t=Ls.join(e.projectPath,"package.json");return await xe(t)?await Ms(t):{name:e.selections?.projectName||"my-nexo-app",version:"0.1.0",private:!0,type:"module",dependencies:{},devDependencies:{},scripts:{}}},Oi=async(e,t)=>{await He(Ls.join(e.projectPath,"package.json"),t)},wr=(e,t,r,i=!1)=>{i?(e.devDependencies=e.devDependencies||{},e.devDependencies[t]=r):(e.dependencies=e.dependencies||{},e.dependencies[t]=r)},Gc=(e,t,r)=>{e.scripts=e.scripts||{},e.scripts[t]=r}});import Us from"node:fs/promises";import Kg from"node:os";import qc from"node:path";var zs,Pe,Zg,Jg,Xg,Qg,eD,tD,Hs=D(()=>{"use strict";st();zs=class{cache=new Map;defaultTTL=1440*60*1e3;cacheDir=qc.join(Kg.homedir(),".nexo");cacheFile=qc.join(this.cacheDir,"cache.json");version="1.0.0";async load(){try{if(!await Us.access(this.cacheFile).then(()=>!0).catch(()=>!1))return;let r=await Us.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 Us.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()]}}},Pe=new zs,Zg=(e,t,r)=>Pe.get(e,t,r),Jg=(e,t,r)=>Pe.getSync(e,t,r),Xg=e=>{Pe.invalidate(e)},Qg=()=>{Pe.clear()},eD=(e,t)=>{let r=t??((...i)=>JSON.stringify(i));return async(...i)=>{let n=`memoize:${e.name}:${r(...i)}`;return Pe.get(n,()=>e(...i))}},tD=(e,t)=>{let r=t??((...i)=>JSON.stringify(i));return(...i)=>{let n=`memoize:${e.name}:${r(...i)}`;return Pe.getSync(n,()=>e(...i))}}});import Kc from"node:fs/promises";import Yc from"node:path";var Ws,Gs,Zc=D(()=>{"use strict";Ws=async e=>{try{return(await Kc.readdir(e)).filter(i=>i!==".git"&&i!==".DS_Store"&&i!=="Thumbs.db").length===0}catch{return!0}},Gs=async e=>{try{let t=Yc.join(e,"package.json"),r=await Kc.readFile(t,"utf-8"),i=JSON.parse(r),n={...i.dependencies,...i.devDependencies},o={projectName:i.name||Yc.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 Ht,Jc,Xc=D(()=>{"use strict";Ht=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}),Jc(t)},Jc=(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+=Jc(i.children,t+a))}),r}});var Qc,Ri,Vs=D(()=>{Qc=Object.defineProperty,Ri=(e,t)=>{let r={};for(var i in e)Qc(r,i,{get:e[i],enumerable:!0});return t&&Qc(r,Symbol.toStringTag,{value:"Module"}),r}});var hl={};k(hl,{a:()=>pe,i:()=>cl,n:()=>Ks,r:()=>Ys,t:()=>VD});import{readFile as rD}from"node:fs/promises";import{existsSync as qs}from"node:fs";import{PassThrough as iD}from"node:stream";import{spawn as nD}from"node:child_process";import{createRequire as sD}from"module";import{delimiter as el,dirname as oD,normalize as aD,resolve as uD}from"node:path";import{cwd as cD}from"node:process";import lD from"node:readline";function $i(e=""){return e&&e.replace(/\\/g,"/").replace(pD,t=>t.toUpperCase())}function dD(){return typeof process<"u"&&typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}function ul(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 vD(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!wD.test(t))continue;let r=e[t];return r?{key:t,value:r}:il}return il}function SD(e,t){let r=t.value.split(el),i=e,n;do r.push(uD(i,"node_modules",".bin")),n=i,i=oD(i);while(i!==n);return{key:t.key,value:r.join(el)}}function FD(e,t){let r={...process.env,...t},i=SD(e,vD(r));return r[i.key]=i.value,r}function zD(e,t){return{command:aD(e),args:t??[]}}function HD(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 sl(e){let t="";for await(let r of e)t+=r.toString();return t}async function qD(e,t,r={}){let i=al(e).split("/");for(;i.length>0;){let n=await t(i.join("/")||"/");if(n||!r.includeParentDirs)return n;i.pop()}}function YD(e){let t;return()=>(t===void 0&&(t=e().then(r=>(t=r,t))),t)}async function ZD(e,t,r={}){let i=e!=="npm"&&e!=="bun"&&e!=="deno"&&r.corepack!==!1&&await KD()?["corepack",[e,...t]]:[e,t],{exitCode:n,stdout:o,stderr:s}=await Zs(i[0],i[1],{nodeOptions:{cwd:pe(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 JD(e={}){let t=e.cwd||process.cwd(),r={...process.env,...e.env},i=(typeof e.packageManager=="string"?wt.find(n=>n.name===e.packageManager):e.packageManager)||await pl(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 XD(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 pl(e,t={}){let r=await qD(pe(e||"."),async i=>{if(!t.ignorePackageJSON){let n=rl(i,"package.json");if(qs(n)){let o=JSON.parse(await rD(n,"utf8"));if(o?.packageManager){let{name:s,version:a="0.0.0",buildMeta:u,warnings:c}=XD(o.packageManager);if(s){let l=a.split(".")[0],p=wt.find(h=>h.name===s&&h.majorVersion===l)||wt.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(qs(rl(i,"deno.json")))return wt.find(o=>o.name==="deno")}if(!t.ignoreLockFile){for(let n of wt)if([n.lockFile,n.files].flat().filter(Boolean).some(o=>qs(pe(i,o))))return{...n}}},{includeParentDirs:t.includeParentDirs??!0});if(!r&&!t.ignoreArgv){let i=process.argv[1];if(i){for(let n of wt)if(RegExp(`[/\\\\]\\.?${n.command}`).test(i))return n}}return r}async function QD(e={}){let t=await JD(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 pD,hD,mD,ol,tl,al,rl,pe,vr,cl,Ys,Ks,fD,ll,gD,DD,yD,bD,ge,CD,ED,ot,wD,il,xD,kD,AD,_D,TD,OD,RD,$D,PD,ID,ND,jD,BD,LD,nl,MD,UD,WD,Zs,GD,VD,KD,wt,Js=D(()=>{Vs();pD=/^[A-Za-z]:\//;hD=/^[/\\]{2}/,mD=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ol=/^[A-Za-z]:$/,tl=/^\/([A-Za-z]:)?$/,al=function(e){if(e.length===0)return".";e=$i(e);let t=e.match(hD),r=vr(e),i=e[e.length-1]==="/";return e=ul(e,!r),e.length===0?r?"/":i?"./":".":(i&&(e+="/"),ol.test(e)&&(e+="/"),t?r?`//${e}`:`//./${e}`:r&&!vr(e)?`/${e}`:e)},rl=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 al(t)};pe=function(...e){e=e.map(i=>$i(i));let t="",r=!1;for(let i=e.length-1;i>=-1&&!r;i--){let n=i>=0?e[i]:dD();!n||n.length===0||(t=`${n}/${t}`,r=vr(n))}return t=ul(t,!r),r&&!vr(t)?`/${t}`:t.length>0?t:"."};vr=function(e){return mD.test(e)},cl=function(e,t){let r=pe(e).replace(tl,"$1").split("/"),i=pe(t).replace(tl,"$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("/")},Ys=function(e){let t=$i(e).replace(/\/$/,"").split("/").slice(0,-1);return t.length===1&&ol.test(t[0])&&(t[0]+="/"),t.join("/")||(vr(e)?"/":".")},Ks=function(e,t){let r=$i(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},fD=Object.create,ll=Object.defineProperty,gD=Object.getOwnPropertyDescriptor,DD=Object.getOwnPropertyNames,yD=Object.getPrototypeOf,bD=Object.prototype.hasOwnProperty,ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),CD=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=DD(t),o=0,s=n.length,a;o<s;o++)a=n[o],!bD.call(e,a)&&a!==r&&ll(e,a,{get:(u=>t[u]).bind(null,a),enumerable:!(i=gD(t,a))||i.enumerable});return e},ED=(e,t,r)=>(r=e==null?{}:fD(yD(e)),CD(t||!e||!e.__esModule?ll(r,"default",{value:e,enumerable:!0}):r,e)),ot=sD(import.meta.url),wD=/^path$/i,il={key:"PATH",value:""};xD=e=>{let t=e.length,r=new iD,i=()=>{--t===0&&r.emit("end")};for(let n of e)n.pipe(r,{end:!1}),n.on("end",i);return r},kD=ge((e,t)=>{t.exports=o,o.sync=s;var r=ot("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)}}),AD=ge((e,t)=>{t.exports=i,i.sync=n;var r=ot("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,m=u.gid===void 0?process.getgid&&process.getgid():u.gid,g=64,y=8,w=1,N=g|y;return c&w||c&y&&p===m||c&g&&l===h||c&N&&h===0}}),_D=ge((e,t)=>{ot("fs");var r=process.platform==="win32"||global.TESTING_WINDOWS?kD():AD();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}}}),TD=ge((e,t)=>{let r=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",i=ot("path"),n=r?";":":",o=_D(),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)],m=r?l.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=r?m.split(p):[""];return r&&c.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:h,pathExt:g,pathExtExe:m}},u=(c,l,p)=>{typeof l=="function"&&(p=l,l={}),l||={};let{pathEnv:h,pathExt:m,pathExtExe:g}=a(c,l),y=[],w=C=>new Promise((ne,se)=>{if(C===h.length)return l.all&&y.length?ne(y):se(s(c));let E=h[C],q=/^".*"$/.test(E)?E.slice(1,-1):E,j=i.join(q,c);ne(N(!q&&/^\.[\\\/]/.test(c)?c.slice(0,2)+j:j,C,0))}),N=(C,ne,se)=>new Promise((E,q)=>{if(se===m.length)return E(w(ne+1));let j=m[se];o(C+j,{pathExt:g},(Ct,ve)=>{if(!Ct&&ve)if(l.all)y.push(C+j);else return E(C+j);return E(N(C,ne,se+1))})});return p?w(0).then(C=>p(null,C),p):w(0)};t.exports=u,u.sync=(c,l)=>{l||={};let{pathEnv:p,pathExt:h,pathExtExe:m}=a(c,l),g=[];for(let y=0;y<p.length;y++){let w=p[y],N=/^".*"$/.test(w)?w.slice(1,-1):w,C=i.join(N,c),ne=!N&&/^\.[\\\/]/.test(c)?c.slice(0,2)+C:C;for(let se=0;se<h.length;se++){let E=ne+h[se];try{if(o.sync(E,{pathExt:m}))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)}}),OD=ge((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}),RD=ge((e,t)=>{let r=ot("path"),i=TD(),n=OD();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 m;try{m=i.sync(a.command,{path:c[n({env:c})],pathExt:u?r.delimiter:void 0})}catch{}finally{h&&process.chdir(l)}return m&&=r.resolve(p?a.options.cwd:"",m),m}function s(a){return o(a)||o(a,!0)}t.exports=s}),$D=ge((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}),PD=ge((e,t)=>{t.exports=/^#!(.*)/}),ID=ge((e,t)=>{let r=PD();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}}),ND=ge((e,t)=>{let r=ot("fs"),i=ID();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}),jD=ge((e,t)=>{let r=ot("path"),i=RD(),n=$D(),o=ND(),s=process.platform==="win32",a=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function c(h){h.file=i(h);let m=h.file&&o(h.file);return m?(h.args.unshift(h.file),h.command=m,i(h)):h.file}function l(h){if(!s)return h;let m=c(h),g=!a.test(m);if(h.options.forceShell||g){let y=u.test(m);h.command=r.normalize(h.command),h.command=n.command(h.command),h.args=h.args.map(w=>n.argument(w,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,m,g){m&&!Array.isArray(m)&&(g=m,m=null),m=m?m.slice(0):[],g=Object.assign({},g);let y={command:h,args:m,options:g,file:void 0,original:{command:h,args:m}};return g.shell?y:l(y)}t.exports=p}),BD=ge((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}}),LD=ED(ge((e,t)=>{let r=ot("child_process"),i=jD(),n=BD();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),nl=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}},MD={timeout:void 0,persist:!1},UD={windowsHide:!0};WD=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={...MD,...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 GD(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=xD(t),i=lD.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 nl(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error("No process was started");let[t,r]=await Promise.all([this._streamOut?sl(this._streamOut):"",this._streamErr?sl(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 nl(this,i);return i}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=cD(),t=this._options,r={...UD,...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=HD(i)),r.env=FD(e,r.env);let{command:n,args:o}=zD(this._command,this._args),s=(0,LD._parse)(n,o,r),a=nD(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()}},Zs=(e,t,r)=>{let i=new WD(e,t,r);return i.spawn(),i},GD=Zs,VD=Ri({detectPackageManager:()=>pl,installDependencies:()=>QD,packageManagers:()=>wt});KD=YD(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:e}=await Zs("corepack",["--version"]);return e===0}catch{return!1}});wt=[{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 Dl from"node:stream";import ey from"events";import he from"fs";import{EventEmitter as lo}from"node:events";import{StringDecoder as ty}from"node:string_decoder";var ml,ry,iy,ny,We,Ge,at,Pi,Sr,Ii,dl,Ni,fl,ke,Wt,Y,Fr,Gt,K,ae,Z,Xs,ji,ee,U,Qs,eo,gl,to,Ie,ro,Bi,xr,vt,De,kr,sy,oy,ay,uy,yl,cy,ly,py,Ye,hy,ct,_e,Ar,_,io,qe,no,uo,co,Tr,Li,Yt,Kt,so,Vt,lt,Ae,ut,Ne,qt,oo,Ve,_r,ao,Mi,St,Ui,Ft,zi,bl,Or,po,ho=D(()=>{ml=typeof process=="object"&&process?process:{stdout:null,stderr:null},ry=e=>!!e&&typeof e=="object"&&(e instanceof Ye||e instanceof Dl||iy(e)||ny(e)),iy=e=>!!e&&typeof e=="object"&&e instanceof lo&&typeof e.pipe=="function"&&e.pipe!==Dl.Writable.prototype.pipe,ny=e=>!!e&&typeof e=="object"&&e instanceof lo&&typeof e.write=="function"&&typeof e.end=="function",We=Symbol("EOF"),Ge=Symbol("maybeEmitEnd"),at=Symbol("emittedEnd"),Pi=Symbol("emittingEnd"),Sr=Symbol("emittedError"),Ii=Symbol("closed"),dl=Symbol("read"),Ni=Symbol("flush"),fl=Symbol("flushChunk"),ke=Symbol("encoding"),Wt=Symbol("decoder"),Y=Symbol("flowing"),Fr=Symbol("paused"),Gt=Symbol("resume"),K=Symbol("buffer"),ae=Symbol("pipes"),Z=Symbol("bufferLength"),Xs=Symbol("bufferPush"),ji=Symbol("bufferShift"),ee=Symbol("objectMode"),U=Symbol("destroyed"),Qs=Symbol("error"),eo=Symbol("emitData"),gl=Symbol("emitEnd"),to=Symbol("emitEnd2"),Ie=Symbol("async"),ro=Symbol("abort"),Bi=Symbol("aborted"),xr=Symbol("signal"),vt=Symbol("dataListeners"),De=Symbol("discarded"),kr=e=>Promise.resolve().then(e),sy=e=>e(),oy=e=>e==="end"||e==="finish"||e==="prefinish",ay=e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,uy=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),yl=class{src;dest;opts;ondrain;constructor(e,t,r){this.src=e,this.dest=t,this.opts=r,this.ondrain=()=>e[Gt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},cy=class extends yl{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)}},ly=e=>!!e.objectMode,py=e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer",Ye=class extends lo{[Y]=!1;[Fr]=!1;[ae]=[];[K]=[];[ee];[ke];[Ie];[Wt];[We]=!1;[at]=!1;[Pi]=!1;[Ii]=!1;[Sr]=null;[Z]=0;[U]=!1;[xr];[Bi]=!1;[vt]=0;[De]=!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");ly(t)?(this[ee]=!0,this[ke]=null):py(t)?(this[ke]=t.encoding,this[ee]=!1):(this[ee]=!1,this[ke]=null),this[Ie]=!!t.async,this[Wt]=this[ke]?new ty(this[ke]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[K]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[ae]});let{signal:r}=t;r&&(this[xr]=r,r.aborted?this[ro]():r.addEventListener("abort",()=>this[ro]()))}get bufferLength(){return this[Z]}get encoding(){return this[ke]}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[ee]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[Ie]}set async(e){this[Ie]=this[Ie]||!!e}[ro](){this[Bi]=!0,this.emit("abort",this[xr]?.reason),this.destroy(this[xr]?.reason)}get aborted(){return this[Bi]}set aborted(e){}write(e,t,r){if(this[Bi])return!1;if(this[We])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[Ie]?kr:sy;if(!this[ee]&&!Buffer.isBuffer(e)){if(uy(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ay(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[ee]?(this[Y]&&this[Z]!==0&&this[Ni](!0),this[Y]?this.emit("data",e):this[Xs](e),this[Z]!==0&&this.emit("readable"),r&&i(r),this[Y]):e.length?(typeof e=="string"&&!(t===this[ke]&&!this[Wt]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ke]&&(e=this[Wt].write(e)),this[Y]&&this[Z]!==0&&this[Ni](!0),this[Y]?this.emit("data",e):this[Xs](e),this[Z]!==0&&this.emit("readable"),r&&i(r),this[Y]):(this[Z]!==0&&this.emit("readable"),r&&i(r),this[Y])}read(e){if(this[U])return null;if(this[De]=!1,this[Z]===0||e===0||e&&e>this[Z])return this[Ge](),null;this[ee]&&(e=null),this[K].length>1&&!this[ee]&&(this[K]=[this[ke]?this[K].join(""):Buffer.concat(this[K],this[Z])]);let t=this[dl](e||null,this[K][0]);return this[Ge](),t}[dl](e,t){if(this[ee])this[ji]();else{let r=t;e===r.length||e===null?this[ji]():typeof r=="string"?(this[K][0]=r.slice(e),t=r.slice(0,e),this[Z]-=e):(this[K][0]=r.subarray(e),t=r.subarray(0,e),this[Z]-=e)}return this.emit("data",t),!this[K].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[Y]||!this[Fr])&&this[Ge](),this}[Gt](){this[U]||(!this[vt]&&!this[ae].length&&(this[De]=!0),this[Fr]=!1,this[Y]=!0,this.emit("resume"),this[K].length?this[Ni]():this[We]?this[Ge]():this.emit("drain"))}resume(){return this[Gt]()}pause(){this[Y]=!1,this[Fr]=!0,this[De]=!1}get destroyed(){return this[U]}get flowing(){return this[Y]}get paused(){return this[Fr]}[Xs](e){this[ee]?this[Z]+=1:this[Z]+=e.length,this[K].push(e)}[ji](){return this[ee]?--this[Z]:this[Z]-=this[K][0].length,this[K].shift()}[Ni](e=!1){do;while(this[fl](this[ji]())&&this[K].length);!e&&!this[K].length&&!this[We]&&this.emit("drain")}[fl](e){return this.emit("data",e),this[Y]}pipe(e,t){if(this[U])return e;this[De]=!1;let r=this[at];return t||={},e===ml.stdout||e===ml.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,r?t.end&&e.end():(this[ae].push(t.proxyErrors?new cy(this,e,t):new yl(this,e,t)),this[Ie]?kr(()=>this[Gt]()):this[Gt]()),e}unpipe(e){let t=this[ae].find(r=>r.dest===e);t&&(this[ae].length===1?(this[Y]&&this[vt]===0&&(this[Y]=!1),this[ae]=[]):this[ae].splice(this[ae].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[De]=!1,this[vt]++,!this[ae].length&&!this[Y]&&this[Gt]();else if(e==="readable"&&this[Z]!==0)super.emit("readable");else if(oy(e)&&this[at])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Sr]){let i=t;this[Ie]?kr(()=>i.call(this,this[Sr])):i.call(this,this[Sr])}return r}removeListener(e,t){return this.off(e,t)}off(e,t){let r=super.off(e,t);return e==="data"&&(this[vt]=this.listeners("data").length,this[vt]===0&&!this[De]&&!this[ae].length&&(this[Y]=!1)),r}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[vt]=0,!this[De]&&!this[ae].length&&(this[Y]=!1)),t}get emittedEnd(){return this[at]}[Ge](){!this[Pi]&&!this[at]&&!this[U]&&this[K].length===0&&this[We]&&(this[Pi]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Ii]&&this.emit("close"),this[Pi]=!1)}emit(e,...t){let r=t[0];if(e!=="error"&&e!=="close"&&e!==U&&this[U])return!1;if(e==="data")return!this[ee]&&!r?!1:this[Ie]?(kr(()=>this[eo](r)),!0):this[eo](r);if(e==="end")return this[gl]();if(e==="close"){if(this[Ii]=!0,!this[at]&&!this[U])return!1;let n=super.emit("close");return this.removeAllListeners("close"),n}else if(e==="error"){this[Sr]=r,super.emit(Qs,r);let n=!this[xr]||this.listeners("error").length?super.emit("error",r):!1;return this[Ge](),n}else if(e==="resume"){let n=super.emit("resume");return this[Ge](),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[Ge](),i}[eo](e){for(let r of this[ae])r.dest.write(e)===!1&&this.pause();let t=this[De]?!1:super.emit("data",e);return this[Ge](),t}[gl](){return this[at]?!1:(this[at]=!0,this.readable=!1,this[Ie]?(kr(()=>this[to]()),!0):this[to]())}[to](){if(this[Wt]){let t=this[Wt].end();if(t){for(let r of this[ae])r.dest.write(t);this[De]||super.emit("data",t)}}for(let t of this[ae])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[ee]||(e.dataLength=0);let t=this.promise();return this.on("data",r=>{e.push(r),this[ee]||(e.dataLength+=r.length)}),await t,e}async concat(){if(this[ee])throw Error("cannot concat in objectMode");let e=await this.collect();return this[ke]?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[De]=!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(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[We]})},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[De]=!1;let e=!1,t=()=>(this.pause(),this.off(Qs,t),this.off(U,t),this.off("end",t),e=!0,{done:!0,value:void 0});return this.once("end",t),this.once(Qs,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[De]=!0,this[K].length=0,this[Z]=0;let t=this;return typeof t.close=="function"&&!this[Ii]&&t.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return ry}},hy=he.writev,ct=Symbol("_autoClose"),_e=Symbol("_close"),Ar=Symbol("_ended"),_=Symbol("_fd"),io=Symbol("_finished"),qe=Symbol("_flags"),no=Symbol("_flush"),uo=Symbol("_handleChunk"),co=Symbol("_makeBuf"),Tr=Symbol("_mode"),Li=Symbol("_needDrain"),Yt=Symbol("_onerror"),Kt=Symbol("_onopen"),so=Symbol("_onread"),Vt=Symbol("_onwrite"),lt=Symbol("_open"),Ae=Symbol("_path"),ut=Symbol("_pos"),Ne=Symbol("_queue"),qt=Symbol("_read"),oo=Symbol("_readSize"),Ve=Symbol("_reading"),_r=Symbol("_remain"),ao=Symbol("_size"),Mi=Symbol("_write"),St=Symbol("_writing"),Ui=Symbol("_defaultFlag"),Ft=Symbol("_errored"),zi=class extends Ye{[Ft]=!1;[_];[Ae];[oo];[Ve]=!1;[ao];[_r];[ct];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[Ft]=!1,this[_]=typeof t.fd=="number"?t.fd:void 0,this[Ae]=e,this[oo]=t.readSize||16*1024*1024,this[Ve]=!1,this[ao]=typeof t.size=="number"?t.size:1/0,this[_r]=this[ao],this[ct]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[_]=="number"?this[qt]():this[lt]()}get fd(){return this[_]}get path(){return this[Ae]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[lt](){he.open(this[Ae],"r",(e,t)=>this[Kt](e,t))}[Kt](e,t){e?this[Yt](e):(this[_]=t,this.emit("open",t),this[qt]())}[co](){return Buffer.allocUnsafe(Math.min(this[oo],this[_r]))}[qt](){if(!this[Ve]){this[Ve]=!0;let e=this[co]();if(e.length===0)return process.nextTick(()=>this[so](null,0,e));he.read(this[_],e,0,e.length,null,(t,r,i)=>this[so](t,r,i))}}[so](e,t,r){this[Ve]=!1,e?this[Yt](e):this[uo](t,r)&&this[qt]()}[_e](){if(this[ct]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,he.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Yt](e){this[Ve]=!0,this[_e](),this.emit("error",e)}[uo](e,t){let r=!1;return this[_r]-=e,e>0&&(r=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[_r]<=0)&&(r=!1,this[_e](),super.end()),r}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[_]=="number"&&this[qt](),!1;case"error":return this[Ft]?!1:(this[Ft]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},bl=class extends zi{[lt](){let e=!0;try{this[Kt](null,he.openSync(this[Ae],"r")),e=!1}finally{e&&this[_e]()}}[qt](){let e=!0;try{if(!this[Ve]){this[Ve]=!0;do{let t=this[co](),r=t.length===0?0:he.readSync(this[_],t,0,t.length,null);if(!this[uo](r,t))break}while(!0);this[Ve]=!1}e=!1}finally{e&&this[_e]()}}[_e](){if(this[ct]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,he.closeSync(e),this.emit("close")}}},Or=class extends ey{readable=!1;writable=!0;[Ft]=!1;[St]=!1;[Ar]=!1;[Ne]=[];[Li]=!1;[Ae];[Tr];[ct];[_];[Ui];[qe];[io]=!1;[ut];constructor(e,t){t||={},super(t),this[Ae]=e,this[_]=typeof t.fd=="number"?t.fd:void 0,this[Tr]=t.mode===void 0?438:t.mode,this[ut]=typeof t.start=="number"?t.start:void 0,this[ct]=typeof t.autoClose=="boolean"?t.autoClose:!0;let r=this[ut]===void 0?"w":"r+";this[Ui]=t.flags===void 0,this[qe]=t.flags===void 0?r:t.flags,this[_]===void 0&&this[lt]()}emit(e,...t){if(e==="error"){if(this[Ft])return!1;this[Ft]=!0}return super.emit(e,...t)}get fd(){return this[_]}get path(){return this[Ae]}[Yt](e){this[_e](),this[St]=!0,this.emit("error",e)}[lt](){he.open(this[Ae],this[qe],this[Tr],(e,t)=>this[Kt](e,t))}[Kt](e,t){this[Ui]&&this[qe]==="r+"&&e&&e.code==="ENOENT"?(this[qe]="w",this[lt]()):e?this[Yt](e):(this[_]=t,this.emit("open",t),this[St]||this[no]())}end(e,t){return e&&this.write(e,t),this[Ar]=!0,!this[St]&&!this[Ne].length&&typeof this[_]=="number"&&this[Vt](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[Ar]?(this.emit("error",Error("write() after end()")),!1):this[_]===void 0||this[St]||this[Ne].length?(this[Ne].push(e),this[Li]=!0,!1):(this[St]=!0,this[Mi](e),!0)}[Mi](e){he.write(this[_],e,0,e.length,this[ut],(t,r)=>this[Vt](t,r))}[Vt](e,t){e?this[Yt](e):(this[ut]!==void 0&&typeof t=="number"&&(this[ut]+=t),this[Ne].length?this[no]():(this[St]=!1,this[Ar]&&!this[io]?(this[io]=!0,this[_e](),this.emit("finish")):this[Li]&&(this[Li]=!1,this.emit("drain"))))}[no](){if(this[Ne].length===0)this[Ar]&&this[Vt](null,0);else if(this[Ne].length===1)this[Mi](this[Ne].pop());else{let e=this[Ne];this[Ne]=[],hy(this[_],e,this[ut],(t,r)=>this[Vt](t,r))}}[_e](){if(this[ct]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,he.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},po=class extends Or{[lt](){let e;if(this[Ui]&&this[qe]==="r+")try{e=he.openSync(this[Ae],this[qe],this[Tr])}catch(t){if(t?.code==="ENOENT")return this[qe]="w",this[lt]();throw t}else e=he.openSync(this[Ae],this[qe],this[Tr]);this[Kt](null,e)}[_e](){if(this[ct]&&typeof this[_]=="number"){let e=this[_];this[_]=void 0,he.closeSync(e),this.emit("close")}}[Mi](e){let t=!0;try{this[Vt](null,he.writeSync(this[_],e,0,e.length,this[ut])),t=!1}finally{if(t)try{this[_e]()}catch{}}}}});import go from"assert";import{Buffer as xt}from"buffer";import*as Cl from"zlib";import my from"zlib";var dy,je,fy,El,gy,mo,kt,Hi,fo,Do,wl,vl,Sl,Fl,xl,kl,Al,_l,Tl,Ol=D(()=>{ho();dy=my.constants||{ZLIB_VERNUM:4736},je=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},dy)),fy=xt.concat,El=Object.getOwnPropertyDescriptor(xt,"concat"),gy=e=>e,mo=El?.writable===!0||El?.set!==void 0?e=>{xt.concat=e?gy:fy}:e=>{},kt=Symbol("_superWrite"),Hi=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"}},fo=Symbol("flushFlag"),Do=class extends Ye{#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 Hi(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 Hi(r))),this.once("end",()=>this.close)}close(){this.#r&&(this.#r.close(),this.#r=void 0,this.emit("close"))}reset(){if(!this.#e)return go(this.#r,"zlib binding closed"),this.#r.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#s),this.write(Object.assign(xt.alloc(0),{[fo]: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}[kt](e){return super.write(e)}write(e,t,r){if(typeof t=="function"&&(r=t,t="utf8"),typeof e=="string"&&(e=xt.from(e,t)),this.#e)return;go(this.#r,"zlib binding closed");let i=this.#r._handle,n=i.close;i.close=()=>{};let o=this.#r.close;this.#r.close=()=>{},mo(!0);let s;try{let u=typeof e[fo]=="number"?e[fo]:this.#t;s=this.#r._processChunk(e,u),mo(!1)}catch(u){mo(!1),this.#n(new Hi(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 Hi(u,this.write)));let a;if(s)if(Array.isArray(s)&&s.length>0){let u=s[0];a=this[kt](xt.from(u));for(let c=1;c<s.length;c++)a=this[kt](s[c])}else a=this[kt](xt.from(s));return r&&r(),a}},wl=class extends Do{#e;#i;constructor(e,t){e||={},e.flush=e.flush||je.Z_NO_FLUSH,e.finishFlush=e.finishFlush||je.Z_FINISH,e.fullFlushFlag=je.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(je.Z_SYNC_FLUSH),go(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)}}}},vl=class extends wl{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[kt](e){return this.#e?(this.#e=!1,e[9]=255,super[kt](e)):super[kt](e)}},Sl=class extends wl{constructor(e){super(e,"Unzip")}},Fl=class extends Do{constructor(e,t){e||={},e.flush=e.flush||je.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||je.BROTLI_OPERATION_FINISH,e.fullFlushFlag=je.BROTLI_OPERATION_FLUSH,super(e,t)}},xl=class extends Fl{constructor(e){super(e,"BrotliCompress")}},kl=class extends Fl{constructor(e){super(e,"BrotliDecompress")}},Al=class extends Do{constructor(e,t){e||={},e.flush=e.flush||je.ZSTD_e_continue,e.finishFlush=e.finishFlush||je.ZSTD_e_end,e.fullFlushFlag=je.ZSTD_e_flush,super(e,t)}},_l=class extends Al{constructor(e){super(e,"ZstdCompress")}},Tl=class extends Al{constructor(e){super(e,"ZstdDecompress")}}});import Gi from"node:fs";import Rr from"node:path";var yo,Wi,Dy,bo,yy,Co,Rl=D(()=>{yo=(e,t,r)=>{try{return Gi.lchownSync(e,t,r)}catch(i){if(i?.code!=="ENOENT")throw i}},Wi=(e,t,r,i)=>{Gi.lchown(e,t,r,n=>{i(n&&n?.code!=="ENOENT"?n:null)})},Dy=(e,t,r,i,n)=>{t.isDirectory()?bo(Rr.resolve(e,t.name),r,i,o=>{if(o)return n(o);Wi(Rr.resolve(e,t.name),r,i,n)}):Wi(Rr.resolve(e,t.name),r,i,n)},bo=(e,t,r,i)=>{Gi.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 Wi(e,t,r,i);let s=o.length,a=null,u=c=>{if(!a){if(c)return i(a=c);if(--s===0)return Wi(e,t,r,i)}};for(let c of o)Dy(e,c,t,r,u)})},yy=(e,t,r,i)=>{t.isDirectory()&&Co(Rr.resolve(e,t.name),r,i),yo(Rr.resolve(e,t.name),r,i)},Co=(e,t,r)=>{let i;try{i=Gi.readdirSync(e,{withFileTypes:!0})}catch(n){let o=n;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return yo(e,t,r);throw o}for(let n of i)yy(e,n,t,r);return yo(e,t,r)}});var bp={};k(bp,{t:()=>I0});import by from"node:fs/promises";import b from"node:fs";import H,{basename as Cy,join as rp,posix as Zt,win32 as Ey}from"node:path";import{EventEmitter as wy}from"events";import re from"fs";import cn,{dirname as vy,parse as Sy}from"path";import Fy from"node:assert";import{randomBytes as ip}from"node:crypto";function a0(e,t,r){let i=new ca(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 u0(e,t){e.tail=new ca(t,e.tail,void 0,e),e.head||=e.tail,e.length++}function c0(e,t){e.head=new ca(t,void 0,e.head,e),e.tail||=e.head,e.length++}var xy,ky,Ay,_y,Ty,Oy,Ry,ra,Gr,$y,Py,Iy,Ny,jy,By,np,sp,Eo,ia,Ly,yt,My,At,wo,Uy,dt,zy,Hy,Wy,ft,Gy,Vy,qy,vo,Yy,_t,Wr,Ky,Zy,Jy,S,na,hn,jo,Bo,Xy,Ee,Tt,Ke,So,$l,Be,$r,pt,Pl,R,Ze,ht,Fo,Ot,z,Vi,qi,xo,Il,Nl,Pr,ko,Yi,Jt,mt,Ki,Rt,Zi,Ji,jl,Qy,rr,Br,e0,sa,Vr,ap,t0,Bl,oa,mn,aa,r0,i0,Ll,n0,up,Ml,Ul,zl,Lo,Hl,Ir,en,Mo,tn,Uo,zo,Ho,Wo,gt,ln,Go,Ao,Le,ua,cp,lp,s0,o0,ca,Vo,Wl,rn,Nr,Te,$t,Pt,jr,_o,Oe,To,nn,Gl,qo,Yo,sn,on,Vl,Oo,an,pp,Ro,qr,dn,l0,p0,hp,mp,h0,m0,d0,f0,dp,g0,D0,fp,gp,Dp,y0,b0,Ko,yp,C0,E0,$o,ql,Xt,w0,v0,S0,F0,Yl,Zo,Kl,Jo,we,Xo,Qo,un,Zl,Jl,Xl,Ql,Po,Dt,te,Xi,ep,Qt,Io,No,ea,Lr,Mr,Ur,zr,Hr,x0,k0,tp,pn,Qi,ta,A0,_0,T0,O0,R0,$0,tr,P0,I0,Cp=D(()=>{Vs();ho();Ol();Rl();xy=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"]]),ky=e=>!!e.sync&&!!e.file,Ay=e=>!e.sync&&!!e.file,_y=e=>!!e.sync&&!e.file,Ty=e=>!e.sync&&!e.file,Oy=e=>!!e.file,Ry=e=>xy.get(e)||e,ra=(e={})=>{if(!e)return{};let t={};for(let[r,i]of Object.entries(e)){let n=Ry(r);t[n]=i}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},Gr=(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=ra(o);if(n?.(u,s),ky(u)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(u,s)}else if(Ay(u)){let c=t(u,s),l=a||void 0;return l?c.then(()=>l(),l):c}else if(_y(u)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return r(u,s)}else if(Ty(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}),$y=(e,t)=>{if(Number.isSafeInteger(e))e<0?Iy(e,t):Py(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},Py=(e,t)=>{t[0]=128;for(var r=t.length;r>1;r--)t[r-1]=e&255,e=Math.floor(e/256)},Iy=(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]=np(n):n===0?t[i-1]=0:(r=!0,t[i-1]=sp(n))}},Ny=e=>{let t=e[0],r=t===128?By(e.subarray(1,e.length)):t===255?jy(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},jy=e=>{for(var t=e.length,r=0,i=!1,n=t-1;n>-1;n--){var o=Number(e[n]),s;i?s=np(o):o===0?s=o:(i=!0,s=sp(o)),s!==0&&(r-=s*256**(t-n-1))}return r},By=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},np=e=>(255^e)&255,sp=e=>(255^e)+1&255,Eo=e=>ia.has(e),ia=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"]]),Ly=new Map(Array.from(ia).map(e=>[e[1],e[0]])),yt=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??At(e,t,100),this.mode=r?.mode??i?.mode??dt(e,t+100,8),this.uid=r?.uid??i?.uid??dt(e,t+108,8),this.gid=r?.gid??i?.gid??dt(e,t+116,8),this.size=r?.size??i?.size??dt(e,t+124,12),this.mtime=r?.mtime??i?.mtime??wo(e,t+136,12),this.cksum=dt(e,t+148,12),i&&this.#i(i,!0),r&&this.#i(r);let n=At(e,t+156,1);if(Eo(n)&&(this.#e=n||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=At(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=r?.uname??i?.uname??At(e,t+265,32),this.gname=r?.gname??i?.gname??At(e,t+297,32),this.devmaj=r?.devmaj??i?.devmaj??dt(e,t+329,8)??0,this.devmin=r?.devmin??i?.devmin??dt(e,t+337,8)??0,e[t+475]!==0)this.path=At(e,t+345,155)+"/"+this.path;else{let s=At(e,t+345,130);s&&(this.path=s+"/"+this.path),this.atime=r?.atime??i?.atime??wo(e,t+476,12),this.ctime=r?.ctime??i?.ctime??wo(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=My(this.path||"",r),n=i[0],o=i[1];this.needPax=!!i[2],this.needPax=_t(e,t,100,n)||this.needPax,this.needPax=ft(e,t+100,8,this.mode)||this.needPax,this.needPax=ft(e,t+108,8,this.uid)||this.needPax,this.needPax=ft(e,t+116,8,this.gid)||this.needPax,this.needPax=ft(e,t+124,12,this.size)||this.needPax,this.needPax=vo(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this.#e.charCodeAt(0),this.needPax=_t(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=_t(e,t+265,32,this.uname)||this.needPax,this.needPax=_t(e,t+297,32,this.gname)||this.needPax,this.needPax=ft(e,t+329,8,this.devmaj)||this.needPax,this.needPax=ft(e,t+337,8,this.devmin)||this.needPax,this.needPax=_t(e,t+345,r,o)||this.needPax,e[t+475]===0?(this.needPax=_t(e,t+345,130,o)||this.needPax,this.needPax=vo(e,t+476,12,this.atime)||this.needPax,this.needPax=vo(e,t+488,12,this.ctime)||this.needPax):this.needPax=_t(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,ft(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:ia.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Ly.get(e));if(Eo(t)||t==="Unsupported")this.#e=t;else if(Eo(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},My=(e,t)=>{let r=e,i="",n,o=Zt.parse(e).root||".";if(Buffer.byteLength(r)<100)n=[r,i,!1];else{i=Zt.dirname(r),r=Zt.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=Zt.join(Zt.basename(i),r),i=Zt.dirname(i));while(i!==o&&n===void 0);n||=[e.slice(0,99),"",!0]}return n},At=(e,t,r)=>e.subarray(t,t+r).toString("utf8").replace(/\0.*/,""),wo=(e,t,r)=>Uy(dt(e,t,r)),Uy=e=>e===void 0?void 0:new Date(e*1e3),dt=(e,t,r)=>Number(e[t])&128?Ny(e.subarray(t,t+r)):Hy(e,t,r),zy=e=>isNaN(e)?void 0:e,Hy=(e,t,r)=>zy(parseInt(e.subarray(t,t+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),Wy={12:8589934591,8:2097151},ft=(e,t,r,i)=>i===void 0?!1:i>Wy[r]||i<0?($y(i,e.subarray(t,t+r)),!0):(Gy(e,t,r,i),!1),Gy=(e,t,r,i)=>e.write(Vy(i,r),t,r,"ascii"),Vy=(e,t)=>qy(Math.floor(e).toString(8),t),qy=(e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0",vo=(e,t,r,i)=>i===void 0?!1:ft(e,t,r,i.getTime()/1e3),Yy=Array(156).join("\0"),_t=(e,t,r,i)=>i===void 0?!1:(e.write(i+Yy,t,r,"utf8"),i.length!==Buffer.byteLength(i)||i.length>r),Wr=class op{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 yt({path:("PaxHeader/"+Cy(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 op(Ky(Zy(t),r),i)}},Ky=(e,t)=>t?Object.assign({},t,e):e,Zy=e=>e.replace(/\n$/,"").split(`
|
|
105
|
+
`).reduce(Jy,Object.create(null)),Jy=(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,na=class extends Ye{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))))}},hn=(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))},jo=Buffer.from([31,139]),Bo=Buffer.from([40,181,47,253]),Xy=Math.max(jo.length,Bo.length),Ee=Symbol("state"),Tt=Symbol("writeEntry"),Ke=Symbol("readEntry"),So=Symbol("nextEntry"),$l=Symbol("processEntry"),Be=Symbol("extendedHeader"),$r=Symbol("globalExtendedHeader"),pt=Symbol("meta"),Pl=Symbol("emitMeta"),R=Symbol("buffer"),Ze=Symbol("queue"),ht=Symbol("ended"),Fo=Symbol("emittedEnd"),Ot=Symbol("emit"),z=Symbol("unzip"),Vi=Symbol("consumeChunk"),qi=Symbol("consumeChunkSub"),xo=Symbol("consumeBody"),Il=Symbol("consumeMeta"),Nl=Symbol("consumeHeader"),Pr=Symbol("consuming"),ko=Symbol("bufferConcat"),Yi=Symbol("maybeEnd"),Jt=Symbol("writing"),mt=Symbol("aborted"),Ki=Symbol("onDone"),Rt=Symbol("sawValidEntry"),Zi=Symbol("sawNullBlock"),Ji=Symbol("sawEOF"),jl=Symbol("closeStream"),Qy=()=>!0,rr=class extends wy{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[Ze]=[];[R];[Ke];[Tt];[Ee]="begin";[pt]="";[Be];[$r];[ht]=!1;[z];[mt]=!1;[Rt];[Zi]=!1;[Ji]=!1;[Jt]=!1;[Pr]=!1;[Fo]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Ki,()=>{(this[Ee]==="begin"||this[Rt]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Ki,e.ondone):this.on(Ki,()=>{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:Qy;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[jl]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,r={}){hn(this,e,t,r)}[Nl](e,t){this[Rt]===void 0&&(this[Rt]=!1);let r;try{r=new yt(e,t,this[Be],this[$r])}catch(i){return this.warn("TAR_ENTRY_INVALID",i)}if(r.nullBlock)this[Zi]?(this[Ji]=!0,this[Ee]==="begin"&&(this[Ee]="header"),this[Ot]("eof")):(this[Zi]=!0,this[Ot]("nullBlock"));else if(this[Zi]=!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[Tt]=new na(r,this[Be],this[$r]);this[Rt]||(n.remain?n.on("end",()=>{n.invalid||(this[Rt]=!0)}):this[Rt]=!0),n.meta?n.size>this.maxMetaEntrySize?(n.ignore=!0,this[Ot]("ignoredEntry",n),this[Ee]="ignore",n.resume()):n.size>0&&(this[pt]="",n.on("data",o=>this[pt]+=o),this[Ee]="meta"):(this[Be]=void 0,n.ignore=n.ignore||!this.filter(n.path,n),n.ignore?(this[Ot]("ignoredEntry",n),this[Ee]=n.remain?"ignore":"header",n.resume()):(n.remain?this[Ee]="body":(this[Ee]="header",n.end()),this[Ke]?this[Ze].push(n):(this[Ze].push(n),this[So]())))}}}[jl](){queueMicrotask(()=>this.emit("close"))}[$l](e){let t=!0;if(!e)this[Ke]=void 0,t=!1;else if(Array.isArray(e)){let[r,...i]=e;this.emit(r,...i)}else this[Ke]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[So]()),t=!1);return t}[So](){do;while(this[$l](this[Ze].shift()));if(!this[Ze].length){let e=this[Ke];!e||e.flowing||e.size===e.remain?this[Jt]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[xo](e,t){let r=this[Tt];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[Ee]="header",this[Tt]=void 0,r.end()),n.length}[Il](e,t){let r=this[Tt],i=this[xo](e,t);return!this[Tt]&&r&&this[Pl](r),i}[Ot](e,t,r){!this[Ze].length&&!this[Ke]?this.emit(e,t,r):this[Ze].push([e,t,r])}[Pl](e){switch(this[Ot]("meta",this[pt]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Be]=Wr.parse(this[pt],this[Be],!1);break;case"GlobalExtendedHeader":this[$r]=Wr.parse(this[pt],this[$r],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Be]??Object.create(null);this[Be]=t,t.path=this[pt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Be]||Object.create(null);this[Be]=t,t.linkpath=this[pt].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[mt]=!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[mt])return r?.(),!1;if((this[z]===void 0||this.brotli===void 0&&this[z]===!1)&&e){if(this[R]&&(e=Buffer.concat([this[R],e]),this[R]=void 0),e.length<Xy)return this[R]=e,r?.(),!0;for(let s=0;this[z]===void 0&&s<jo.length;s++)e[s]!==jo[s]&&(this[z]=!1);let n=!1;if(this[z]===!1&&this.zstd!==!1){n=!0;for(let s=0;s<Bo.length;s++)if(e[s]!==Bo[s]){n=!1;break}}let o=this.brotli===void 0&&!n;if(this[z]===!1&&o)if(e.length<512)if(this[ht])this.brotli=!0;else return this[R]=e,r?.(),!0;else try{new yt(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[z]===void 0||this[z]===!1&&(this.brotli||n)){let s=this[ht];this[ht]=!1,this[z]=this[z]===void 0?new Sl({}):n?new Tl({}):new kl({}),this[z].on("data",u=>this[Vi](u)),this[z].on("error",u=>this.abort(u)),this[z].on("end",()=>{this[ht]=!0,this[Vi]()}),this[Jt]=!0;let a=!!this[z][s?"end":"write"](e);return this[Jt]=!1,r?.(),a}}this[Jt]=!0,this[z]?this[z].write(e):this[Vi](e),this[Jt]=!1;let i=this[Ze].length?!1:this[Ke]?this[Ke].flowing:!0;return!i&&!this[Ze].length&&this[Ke]?.once("drain",()=>this.emit("drain")),r?.(),i}[ko](e){e&&!this[mt]&&(this[R]=this[R]?Buffer.concat([this[R],e]):e)}[Yi](){if(this[ht]&&!this[Fo]&&!this[mt]&&!this[Pr]){this[Fo]=!0;let e=this[Tt];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[Ot](Ki)}}[Vi](e){if(this[Pr]&&e)this[ko](e);else if(!e&&!this[R])this[Yi]();else if(e){if(this[Pr]=!0,this[R]){this[ko](e);let t=this[R];this[R]=void 0,this[qi](t)}else this[qi](e);for(;this[R]&&this[R]?.length>=512&&!this[mt]&&!this[Ji];){let t=this[R];this[R]=void 0,this[qi](t)}this[Pr]=!1}(!this[R]||this[ht])&&this[Yi]()}[qi](e){let t=0,r=e.length;for(;t+512<=r&&!this[mt]&&!this[Ji];)switch(this[Ee]){case"begin":case"header":this[Nl](e,t),t+=512;break;case"ignore":case"body":t+=this[xo](e,t);break;case"meta":t+=this[Il](e,t);break;default:throw Error("invalid state: "+this[Ee])}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[mt]||(this[z]?(e&&this[z].write(e),this[z].end()):(this[ht]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[Yi]())),this}},Br=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)},e0=e=>{let t=e.onReadEntry;e.onReadEntry=t?r=>{t(r),r.resume()}:r=>r.resume()},sa=(e,t)=>{let r=new Map(t.map(o=>[Br(o),!0])),i=e.filter,n=(o,s="")=>{let a=s||Sy(o).root||".",u;if(o===a)u=!1;else{let c=r.get(o);u=c===void 0?n(vy(o),a):c}return r.set(o,u),u};e.filter=i?(o,s)=>i(o,s)&&n(Br(o)):o=>n(Br(o))},Vr=Gr(e=>{let t=new rr(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 rr(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 zi(n,{readSize:i,size:u.size});c.on("error",s),c.pipe(r)}})})},e=>new rr(e),e=>new rr(e),(e,t)=>{t?.length&&sa(e,t),e.noResume||e0(e)}),ap=(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:t0,parse:Bl}=Ey,oa=e=>{let t="",r=Bl(e);for(;t0(e)||r.root;){let i=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":r.root;e=e.slice(i.length),t+=i,r=Bl(e)}return[t,e]},mn=["|","<",">","?",":"],aa=mn.map(e=>String.fromCharCode(61440+e.charCodeAt(0))),r0=new Map(mn.map((e,t)=>[e,aa[t]])),i0=new Map(aa.map((e,t)=>[e,mn[t]])),Ll=e=>mn.reduce((t,r)=>t.split(r).join(r0.get(r)),e),n0=e=>aa.reduce((t,r)=>t.split(r).join(i0.get(r)),e),up=(e,t)=>t?(e=S(e).replace(/^\.(\/|$)/,""),Br(t)+"/"+e):S(e),Ml=Symbol("process"),Ul=Symbol("file"),zl=Symbol("directory"),Lo=Symbol("symlink"),Hl=Symbol("hardlink"),Ir=Symbol("header"),en=Symbol("read"),Mo=Symbol("lstat"),tn=Symbol("onlstat"),Uo=Symbol("onread"),zo=Symbol("onreadlink"),Ho=Symbol("openfile"),Wo=Symbol("onopenfile"),gt=Symbol("close"),ln=Symbol("mode"),Go=Symbol("awaitDrain"),Ao=Symbol("ondrain"),Le=Symbol("prefix"),ua=class extends Ye{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=ra(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]=oa(this.path);o&&typeof s=="string"&&(this.path=s,i=o)}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=n0(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=S(r.absolute||cn.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[tn](n):this[Mo]()}warn(e,t,r={}){return hn(this,e,t,r)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Mo](){re.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[tn](t)})}[tn](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=s0(e),this.emit("stat",e),this[Ml]()}[Ml](){switch(this.type){case"File":return this[Ul]();case"Directory":return this[zl]();case"SymbolicLink":return this[Lo]();default:return this.end()}}[ln](e){return ap(e,this.type==="Directory",this.portable)}[Le](e){return up(e,this.prefix)}[Ir](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new yt({path:this[Le](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Le](this.linkpath):this.linkpath,mode:this[ln](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 Wr({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[Le](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Le](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)}[zl](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Ir](),this.end()}[Lo](){re.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[zo](t)})}[zo](e){this.linkpath=S(e),this[Ir](),this.end()}[Hl](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=S(cn.relative(this.cwd,e)),this.stat.size=0,this[Ir](),this.end()}[Ul](){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[Hl](t);this.linkCache.set(e,this.absolute)}if(this[Ir](),this.stat.size===0)return this.end();this[Ho]()}[Ho](){re.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Wo](t)})}[Wo](e){if(this.fd=e,this.#e)return this[gt]();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[en]()}[en](){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");re.read(e,t,r,i,n,(o,s)=>{if(o)return this[gt](()=>this.emit("error",o));this[Uo](s)})}[gt](e=()=>{}){this.fd!==void 0&&re.close(this.fd,e)}[Uo](e){if(e<=0&&this.remain>0){let r=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[gt](()=>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[gt](()=>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[Ao]():this[Go](()=>this[Ao]())}[Go](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)}[Ao](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[gt](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[en]()}},cp=class extends ua{sync=!0;[Mo](){this[tn](re.lstatSync(this.absolute))}[Lo](){this[zo](re.readlinkSync(this.absolute))}[Ho](){this[Wo](re.openSync(this.absolute,"r"))}[en](){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=re.readSync(t,r,i,n,o);this[Uo](s),e=!1}finally{if(e)try{this[gt](()=>{})}catch{}}}[Go](e){e()}[gt](e=()=>{}){this.fd!==void 0&&re.closeSync(this.fd),e()}},lp=class extends Ye{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 hn(this,e,t,r)}constructor(e,t={}){let r=ra(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[ln](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]=oa(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 yt({path:this[Le](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Le](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 Wr({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[Le](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Le](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)}[Le](e){return up(e,this.prefix)}[ln](e){return ap(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}},s0=e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",o0=class er{tail;head;length=0;static create(t=[]){return new er(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++)u0(this,t[r]);return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++)c0(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 er;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 er;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 er;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 er;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=a0(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}};ca=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}},Vo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},Wl=Buffer.alloc(1024),rn=Symbol("onStat"),Nr=Symbol("ended"),Te=Symbol("queue"),$t=Symbol("current"),Pt=Symbol("process"),jr=Symbol("processing"),_o=Symbol("processJob"),Oe=Symbol("jobs"),To=Symbol("jobDone"),nn=Symbol("addFSEntry"),Gl=Symbol("addTarEntry"),qo=Symbol("stat"),Yo=Symbol("readdir"),sn=Symbol("onreaddir"),on=Symbol("pipe"),Vl=Symbol("entry"),Oo=Symbol("entryOpt"),an=Symbol("writeEntryClass"),pp=Symbol("write"),Ro=Symbol("ondrain"),qr=class extends Ye{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[an];onWriteEntry;[Te];[Oe]=0;[jr]=!1;[Nr]=!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[an]=ua,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 vl(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new xl(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new _l(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[Ro]()),this.on("resume",()=>t.resume())}else this.on("drain",this[Ro]);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[Te]=new o0,this[Oe]=0,this.jobs=Number(e.jobs)||4,this[jr]=!1,this[Nr]=!1}[pp](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[Nr]=!0,this[Pt](),r&&r(),this}write(e){if(this[Nr])throw Error("write after end");return e instanceof na?this[Gl](e):this[nn](e),this.flowing}[Gl](e){let t=S(cn.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let r=new Vo(e.path,t);r.entry=new lp(e,this[Oo](r)),r.entry.on("end",()=>this[To](r)),this[Oe]+=1,this[Te].push(r)}this[Pt]()}[nn](e){let t=S(cn.resolve(this.cwd,e));this[Te].push(new Vo(e,t)),this[Pt]()}[qo](e){e.pending=!0,this[Oe]+=1,re[this.follow?"stat":"lstat"](e.absolute,(t,r)=>{e.pending=!1,--this[Oe],t?this.emit("error",t):this[rn](e,r)})}[rn](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[$t]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[_o](e):e.ignore=!0,this[Pt]()}[Yo](e){e.pending=!0,this[Oe]+=1,re.readdir(e.absolute,(t,r)=>{if(e.pending=!1,--this[Oe],t)return this.emit("error",t);this[sn](e,r)})}[sn](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Pt]()}[Pt](){if(!this[jr]){this[jr]=!0;for(let e=this[Te].head;e&&this[Oe]<this.jobs;e=e.next)if(this[_o](e.value),e.value.ignore){let t=e.next;this[Te].removeNode(e),e.next=t}this[jr]=!1,this[Nr]&&!this[Te].length&&this[Oe]===0&&(this.zip?this.zip.end(Wl):(super.write(Wl),super.end()))}}get[$t](){return this[Te]&&this[Te].head&&this[Te].head.value}[To](e){this[Te].shift(),--this[Oe],this[Pt]()}[_o](e){if(!e.pending){if(e.entry){e===this[$t]&&!e.piped&&this[on](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[rn](e,t):this[qo](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[sn](e,t):this[Yo](e),!e.readdir)return}if(e.entry=this[Vl](e),!e.entry){e.ignore=!0;return}e===this[$t]&&!e.piped&&this[on](e)}}}[Oo](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}}[Vl](e){this[Oe]+=1;try{return new this[an](e.path,this[Oo](e)).on("end",()=>this[To](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[Ro](){this[$t]&&this[$t].entry&&this[$t].entry.resume()}[on](e){e.piped=!0,e.readdir&&e.readdir.forEach(i=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[nn](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={}){hn(this,e,t,r)}},dn=class extends qr{sync=!0;constructor(e){super(e),this[an]=cp}pause(){}resume(){}[qo](e){let t=this.follow?"statSync":"lstatSync";this[rn](e,re[t](e.absolute))}[Yo](e){this[sn](e,re.readdirSync(e.absolute))}[on](e){let t=e.entry,r=this.zip;if(e.readdir&&e.readdir.forEach(i=>{let n=e.path,o=n==="./"?"":n.replace(/\/*$/,"/");this[nn](o+i)}),!t)throw Error("Cannot pipe without source");r?t.on("data",i=>{r.write(i)}):t.on("data",i=>{super[pp](i)})}},l0=(e,t)=>{let r=new dn(e),i=new po(e.file,{mode:e.mode||438});r.pipe(i),hp(r,t)},p0=(e,t)=>{let r=new qr(e),i=new Or(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 mp(r,t),n},hp=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?Vr({file:H.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>e.add(i)}):e.add(r)}),e.end()},mp=async(e,t)=>{for(let r=0;r<t.length;r++){let i=String(t[r]);i.charAt(0)==="@"?await Vr({file:H.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:n=>{e.add(n)}}):e.add(i)}e.end()};Gr(l0,p0,(e,t)=>{let r=new dn(e);return hp(r,t),r},(e,t)=>{let r=new qr(e);return mp(r,t),r},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")});h0=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:m0,O_TRUNC:d0,O_WRONLY:f0}=re.constants,dp=Number(process.env.__FAKE_FS_O_FILENAME__)||re.constants.UV_FS_O_FILEMAP||0,g0=h0&&!!dp,D0=dp|d0|m0|f0,fp=g0?e=>e<524288?D0:"w":()=>"w",gp=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"}},Dp=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"}},y0=(e,t)=>{b.stat(e,(r,i)=>{(r||!i.isDirectory())&&(r=new gp(e,r?.code||"ENOTDIR")),t(r)})},b0=(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=(m,g)=>{m?r(m):g&&u?bo(g,s,a,y=>h(y)):o?b.chmod(e,n,r):r()};if(e===p)return y0(e,h);if(c)return by.mkdir(e,{mode:n,recursive:!0}).then(m=>h(null,m??void 0),h);Ko(p,S(H.relative(p,e)).split("/"),n,l,p,void 0,h)},Ko=(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,yp(u,t,r,i,n,o,s))},yp=(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())Ko(e,t,r,i,n,o,s);else if(i)b.unlink(e,l=>{if(l)return s(l);b.mkdir(e,r,yp(e,t,r,i,n,o,s))});else{if(c.isSymbolicLink())return s(new Dp(e,e+"/"+t.join("/")));s(a)}}):(o||=e,Ko(e,t,r,i,n,o,s))},C0=e=>{let t=!1,r;try{t=b.statSync(e).isDirectory()}catch(i){r=i?.code}finally{if(!t)throw new gp(e,r??"ENOTDIR")}},E0=(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&&Co(g,o,s),n&&b.chmodSync(e,i)};if(e===l)return C0(l),p();if(u)return p(b.mkdirSync(e,{mode:i,recursive:!0})??void 0);let h=S(H.relative(l,e)).split("/"),m;for(let g=h.shift(),y=l;g&&(y+="/"+g);g=h.shift()){y=S(H.resolve(y));try{b.mkdirSync(y,i),m||=y}catch{let w=b.lstatSync(y);if(w.isDirectory())continue;if(c){b.unlinkSync(y),b.mkdirSync(y,i),m||=y;continue}else if(w.isSymbolicLink())return new Dp(y,y+"/"+h.join("/"))}}return p(m)},$o=Object.create(null),ql=1e4,Xt=new Set,w0=e=>{Xt.has(e)?Xt.delete(e):$o[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Xt.add(e);let t=$o[e],r=Xt.size-ql;if(r>ql/10){for(let i of Xt)if(Xt.delete(i),delete $o[i],--r<=0)break}return t},v0=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",S0=e=>e.split("/").slice(0,-1).reduce((t,r)=>{let i=t[t.length-1];return i!==void 0&&(r=rp(i,r)),t.push(r||"/"),t},[]),F0=class{#e=new Map;#i=new Map;#t=new Set;reserve(e,t){e=v0?["win32 parallelization disabled"]:e.map(i=>Br(rp(w0(i))));let r=new Set(e.map(i=>S0(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}},Yl=Symbol("onEntry"),Zo=Symbol("checkFs"),Kl=Symbol("checkFs2"),Jo=Symbol("isReusable"),we=Symbol("makeFs"),Xo=Symbol("file"),Qo=Symbol("directory"),un=Symbol("link"),Zl=Symbol("symlink"),Jl=Symbol("hardlink"),Xl=Symbol("unsupported"),Ql=Symbol("checkPath"),Po=Symbol("stripAbsolutePath"),Dt=Symbol("mkdir"),te=Symbol("onError"),Xi=Symbol("pending"),ep=Symbol("pend"),Qt=Symbol("unpend"),Io=Symbol("ended"),No=Symbol("maybeClose"),ea=Symbol("skip"),Lr=Symbol("doChown"),Mr=Symbol("uid"),Ur=Symbol("gid"),zr=Symbol("checkedCwd"),Hr=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",x0=(e,t)=>{if(!Hr)return b.unlink(e,t);let r=e+".DELETE."+ip(16).toString("hex");b.rename(e,r,i=>{if(i)return t(i);b.unlink(r,t)})},k0=e=>{if(!Hr)return b.unlinkSync(e);let t=e+".DELETE."+ip(16).toString("hex");b.renameSync(e,t),b.unlinkSync(t)},tp=(e,t,r)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:r,pn=class extends rr{[Io]=!1;[zr]=!1;[Xi]=0;reservations=new F0;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[Io]=!0,this[No]()},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||Hr,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[Yl](t))}warn(e,t,r={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(r.recoverable=!1),super.warn(e,t,r)}[No](){this[Io]&&this[Xi]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Po](e,t){let r=e[t];if(!r||this.preservePaths)return!0;let i=r.split("/");if(i.includes("..")||Hr&&/^[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]=oa(r);return n&&(e[t]=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute ${t}`,{entry:e,[t]:r})),!0}[Ql](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[Po](e,"path")||!this[Po](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+Ll(String(e.absolute).slice(i.length));let{root:n}=H.win32.parse(e.path);e.path=n+Ll(e.path.slice(n.length))}return!0}[Yl](e){if(!this[Ql](e))return e.resume();switch(Fy.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[Zo](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[Xl](e)}}[te](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Qt](),t.resume())}[Dt](e,t,r){b0(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)}[Lr](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}[Mr](e){return tp(this.uid,e.uid,this.processUid)}[Ur](e){return tp(this.gid,e.gid,this.processGid)}[Xo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.fmode,i=new Or(String(e.absolute),{flags:fp(e.size),mode:r,autoClose:!1});i.on("error",a=>{i.fd&&b.close(i.fd,()=>{}),i.write=()=>!0,this[te](a,e),t()});let n=1,o=a=>{if(a){i.fd&&b.close(i.fd,()=>{}),this[te](a,e),t();return}--n===0&&i.fd!==void 0&&b.close(i.fd,u=>{u?this[te](u,e):this[Qt](),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[Lr](e)){n++;let c=this[Mr](e),l=this[Ur](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[te](a,e),t()}),e.pipe(s)),s.pipe(i)}[Qo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode;this[Dt](String(e.absolute),r,i=>{if(i){this[te](i,e),t();return}let n=1,o=()=>{--n===0&&(t(),this[Qt](),e.resume())};e.mtime&&!this.noMtime&&(n++,b.utimes(String(e.absolute),e.atime||new Date,e.mtime,o)),this[Lr](e)&&(n++,b.chown(String(e.absolute),Number(this[Mr](e)),Number(this[Ur](e)),o)),o()})}[Xl](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Zl](e,t){this[un](e,String(e.linkpath),"symlink",t)}[Jl](e,t){let r=S(H.resolve(this.cwd,String(e.linkpath)));this[un](e,r,"link",t)}[ep](){this[Xi]++}[Qt](){this[Xi]--,this[No]()}[ea](e){this[Qt](),e.resume()}[Jo](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!Hr}[Zo](e){this[ep]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,r=>this[Kl](e,r))}[Kl](e,t){let r=s=>{t(s)},i=()=>{this[Dt](this.cwd,this.dmode,s=>{if(s){this[te](s,e),r();return}this[zr]=!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[te](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[ea](e),r();return}if(s||this[Jo](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);x0(String(e.absolute),u=>this[we](u??null,e,r))})};this[zr]?n():i()}[we](e,t,r){if(e){this[te](e,t),r();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Xo](t,r);case"Link":return this[Jl](t,r);case"SymbolicLink":return this[Zl](t,r);case"Directory":case"GNUDumpDir":return this[Qo](t,r)}}[un](e,t,r,i){b[r](t,String(e.absolute),n=>{n?this[te](n,e):(this[Qt](),e.resume()),i()})}},Qi=e=>{try{return[null,e()]}catch(t){return[t,null]}},ta=class extends pn{sync=!0;[we](e,t){return super[we](e,t,()=>{})}[Zo](e){if(!this[zr]){let n=this[Dt](this.cwd,this.dmode);if(n)return this[te](n,e);this[zr]=!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[te](o,e)}}let[t,r]=Qi(()=>b.lstatSync(String(e.absolute)));if(r&&(this.keep||this.newer&&r.mtime>(e.mtime??r.mtime)))return this[ea](e);if(t||this[Jo](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?Qi(()=>{b.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[we](o,e)}let[n]=Qi(()=>b.rmdirSync(String(e.absolute)));this[we](n,e)}let[i]=e.absolute===this.cwd?[]:Qi(()=>k0(String(e.absolute)));this[we](i,e)}[Xo](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[te](s||a,e),t()},n;try{n=b.openSync(String(e.absolute),fp(e.size),r)}catch(s){return i(s)}let o=this.transform&&this.transform(e)||e;o!==e&&(o.on("error",s=>this[te](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[Lr](e)){let a=this[Mr](e),u=this[Ur](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)})}[Qo](e,t){let r=typeof e.mode=="number"?e.mode&4095:this.dmode,i=this[Dt](String(e.absolute),r);if(i){this[te](i,e),t();return}if(e.mtime&&!this.noMtime)try{b.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Lr](e))try{b.chownSync(String(e.absolute),Number(this[Mr](e)),Number(this[Ur](e)))}catch{}t(),e.resume()}[Dt](e,t){try{return 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})}catch(r){return r}}[un](e,t,r,i){let n=`${r}Sync`;try{b[n](t,String(e.absolute)),i(),e.resume()}catch(o){return this[te](o,e)}}},A0=Gr(e=>{let t=new ta(e),r=e.file,i=b.statSync(r);new bl(r,{readSize:e.maxReadSize||16*1024*1024,size:i.size}).pipe(t)},(e,t)=>{let r=new pn(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 zi(n,{readSize:i,size:u.size});c.on("error",s),c.pipe(r)}})})},e=>new ta(e),e=>new pn(e),(e,t)=>{t?.length&&sa(e,t)}),_0=(e,t)=>{let r=new dn(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 yt(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,T0(e,r,o,n,t)}finally{if(i)try{b.closeSync(n)}catch{}}},T0=(e,t,r,i,n)=>{let o=new po(e.file,{fd:i,start:r});t.pipe(o),R0(t,n)},O0=(e,t)=>{t=Array.from(t);let r=new qr(e),i=(n,o,s)=>{let a=(h,m)=>{h?b.close(n,g=>s(h)):s(null,m)},u=0;if(o===0)return a(null,0);let c=0,l=Buffer.alloc(512),p=(h,m)=>{if(h||m===void 0)return a(h);if(c+=m,c<512&&m)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 yt(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,m)=>{if(h)return o(h);let g=new Or(e.file,{fd:c,start:m});r.pipe(g),g.on("error",o),g.on("close",n),$0(r,t)})})};b.open(e.file,s,a)})},R0=(e,t)=>{t.forEach(r=>{r.charAt(0)==="@"?Vr({file:H.resolve(e.cwd,r.slice(1)),sync:!0,noResume:!0,onReadEntry:i=>e.add(i)}):e.add(r)}),e.end()},$0=async(e,t)=>{for(let r=0;r<t.length;r++){let i=String(t[r]);i.charAt(0)==="@"?await Vr({file:H.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:n=>e.add(n)}):e.add(i)}e.end()},tr=Gr(_0,O0,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!Oy(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")});Gr(tr.syncFile,tr.asyncFile,tr.syncNoFile,tr.asyncNoFile,(e,t=[])=>{tr.validate?.(e,t),P0(e)});P0=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))},I0=Ri({Header:()=>yt,Pack:()=>qr,PackJob:()=>Vo,PackSync:()=>dn,Parser:()=>rr,Pax:()=>Wr,ReadEntry:()=>na,Unpack:()=>pn,UnpackSync:()=>ta,WriteEntry:()=>ua,WriteEntrySync:()=>cp,WriteEntryTar:()=>lp,extract:()=>A0,filesFilter:()=>sa,list:()=>Vr,replace:()=>tr})});import{mkdir as Ep,readFile as N0,rm as j0,writeFile as B0}from"node:fs/promises";import{createWriteStream as L0,existsSync as It,readdirSync as M0,renameSync as U0}from"node:fs";import{pipeline as z0}from"node:stream";import{homedir as H0,tmpdir as W0}from"node:os";import{promisify as G0}from"node:util";async function V0(e,t,r={}){let i=t+".json",n=JSON.parse(await N0(i,"utf8").catch(()=>"{}")),o=(await Yr(e,{method:"HEAD",headers:r.headers}).catch(()=>{}))?.headers.get("etag");if(n.etag===o&&It(t))return;typeof o=="string"&&(n.etag=o);let s=await Yr(e,{headers:r.headers});if(s.status>=400)throw new Error(`Failed to download ${e}: ${s.status} ${s.statusText}`);let a=L0(t);await G0(z0)(s.body,a),await B0(i,JSON.stringify(n),"utf8")}function fn(e){let t=e.match(q0)?.groups||{};return{repo:t.repo||"",subdir:t.subdir||"/",ref:t.ref?t.ref.slice(1):"main"}}function ir(...e){process.env.DEBUG&&console.debug("[giget]",...e)}async function Yr(e,t={}){t.headers?.["sec-fetch-mode"]&&(t.mode=t.headers["sec-fetch-mode"]);let r=await fetch(e,{...t,headers:Fp(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 Y0(){let e=process.env.XDG_CACHE_HOME?pe(process.env.XDG_CACHE_HOME,"giget"):pe(H0(),".cache/giget");if(process.platform==="win32"){let t=pe(W0(),"giget");if(!It(t)&&It(e))try{U0(e,t)}catch{}return t}return e}function Fp(e={}){let t={};for(let[r,i]of Object.entries(e))i&&(t[r.toLowerCase()]=i);return t}async function la(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:xp(t.registry,{auth:t.auth}),i=t.provider||(r?"registry":"github"),n=e,o=e.match(eb);o&&(i=o[1],n=e.slice(o[0].length),(i==="http"||i==="https")&&(n=e));let s=t.providers?.[i]||X0[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=pe(pe(Y0(),i,a.name),(a.version||a.name)+".tar.gz");if(t.preferOffline&&It(u)&&(t.offline=!0),!t.offline){await Ep(Ys(u),{recursive:!0});let m=Date.now();await V0(a.tar,u,{headers:{Authorization:t.auth?`Bearer ${t.auth}`:void 0,...Fp(a.headers)}}).catch(g=>{if(!It(u))throw g;ir("Download error. Using cached version:",g),t.offline=!0}),ir(`Downloaded ${a.tar} to ${u} in ${Date.now()-m}ms`)}if(!It(u))throw new Error(`Tarball not found: ${u} (offline: ${t.offline})`);let c=pe(pe(t.cwd||"."),t.dir||a.defaultDir);if(t.forceClean&&await j0(c,{recursive:!0,force:!0}),!t.force&&It(c)&&M0(c).length>0)throw new Error(`Destination ${c} already exists.`);await Ep(c,{recursive:!0});let l=Date.now(),p=a.subdir?.replace(/^\//,"")||"",{extract:h}=await Promise.resolve().then(()=>(Cp(),bp)).then(m=>m.t);if(await h({file:u,cwd:c,onReadEntry(m){m.path=m.path.split("/").splice(1).join("/"),p&&(m.path.startsWith(p+"/")?m.path=m.path.slice(p.length):m.path="")}}),ir(`Extracted to ${c} in ${Date.now()-l}ms`),t.install){ir("Installing dependencies...");let{installDependencies:m}=await Promise.resolve().then(()=>(Js(),hl)).then(g=>g.t);await m({cwd:c,silent:t.silent,...typeof t.install=="object"?t.install:{}})}return{...a,source:n,dir:c}}var q0,wp,vp,Sp,K0,Z0,J0,X0,Q0,xp,eb,kp=D(()=>{Js();q0=/^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;wp=async(e,t)=>{if(e.endsWith(".json"))return await vp(e,t);let r=new URL(e),i=Ks(r.pathname);try{let n=await Yr(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 vp(e,t);let o=n.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];o&&(i=o.split(".")[0])}catch(n){ir(`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}}},vp=async(e,t)=>{let r=await(await Yr(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},Sp=(e,t)=>{let r=fn(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}`}},K0=(e,t)=>{let r=fn(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=fn(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`}},J0=(e,t)=>{let r=fn(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`}},X0={http:wp,https:wp,github:Sp,gh:Sp,gitlab:K0,bitbucket:Z0,sourcehut:J0},Q0="https://raw.githubusercontent.com/unjs/giget/main/templates",xp=(e=Q0,t={})=>(async r=>{let i=Date.now(),n=`${e}/${r}.json`,o=await Yr(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 ir(`Fetched ${r} template info from ${n} in ${Date.now()-i}ms`),s}),eb=/^([\w-.]+):/});var Ap=D(()=>{kp()});var gn,_p,tb,rb,pa,Je,ha=D(()=>{"use strict";gn=G(oe(),1),_p=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],tb=gn.default.green("\u2714"),rb=gn.default.red("\u2716"),pa=()=>{let e=null,t=0,r="",i=()=>{process.stdout.write("\r\x1B[K")},n=()=>{i(),process.stdout.write(`${gn.default.cyan(_p[t])} ${r}`),t=(t+1)%_p.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(`${tb} ${o||r}`)},fail:o=>{e&&(clearInterval(e),e=null),i(),console.log(`${rb} ${o||r}`)},stop:()=>{e&&(clearInterval(e),e=null),i()}}},Je=e=>{let t=pa();return t.start(e),t}});var Tp,Op,Dn,Rp,$p,ib,nb,ma,da,Pp=D(()=>{"use strict";Ap();Tp=G(oe(),1);Cr();ha();Op={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(),Rp=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")},$p=e=>{let t=Dn(e);return t.includes("403")||t.includes("rate limit")},ib=e=>{let r=Dn(e).match(/retry[- ]?after[:\s]+(\d+)/i);if(r)return parseInt(r[1],10)},nb=e=>{let t=Dn(e);return Rp(e)||$p(e)||t.includes("500")||t.includes("502")||t.includes("503")||t.includes("504")},ma=async(e,t,r=vi)=>{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 la(e,{dir:t,force:!0}),a.succeed("Template cloned successfully");return}catch(u){if(a.fail(),i=u,n<r.maxRetries&&nb(u)){let c=$c(n,r);console.log(Tp.default.yellow(` \u23F3 Waiting ${c/1e3}s before retry...`)),await Pc(c);continue}break}}if($p(i)){let n=ib(i);throw new xi(`GitHub rate limit exceeded while cloning "${e}"`,n,n?new Date(Date.now()+n*1e3):void 0)}throw Rp(i)?new ki(`Unable to clone "${e}" - no network connection.
|
|
106
|
+
Try again when online, or use a local template with --template-dir.`):new Fi(`Failed to clone template "${e}" after ${r.maxRetries+1} attempts: ${i?.message||"Unknown error"}`,`https://github.com/${e}`,void 0,r.maxRetries+1)},da=e=>Op[e.toLowerCase()]});import Kr from"node:path";var fa,sb,Ip,Np,ob,jp,ab,ub,cb,lb,pb,hb,mb,db,fb,Bp=D(()=>{"use strict";st();fa=async(e,t)=>{let r=await nt(e);if(t.dependencies)for(let[i,n]of Object.entries(t.dependencies))wr(r,i,n,!1);if(t.devDependencies)for(let[i,n]of Object.entries(t.devDependencies))wr(r,i,n,!0);return await Oi(e,r),r},sb=async(e,t,r)=>t?fa(e,r):null,Ip=async(e,t)=>{await Promise.all(t.map(async r=>{let i=Kr.join(e.projectPath,r.path);await x(Kr.dirname(i)),await v(i,r.content)}))},Np=async(e,t)=>{let r=Object.entries(t).map(([i,n])=>({path:i,content:n}));await Ip(e,r)},ob=async(e,t,r)=>{let i=Kr.join(e.projectPath,t),{pathExists:n}=await Promise.resolve().then(()=>(st(),Vc));return await n(i)?!1:(await x(Kr.dirname(i)),await v(i,r),!0)},jp=async(e,t)=>{await Promise.all(t.map(r=>x(Kr.join(e.projectPath,r))))},ab=(e,t)=>{let r=e;for(let[i,n]of Object.entries(t))r=r.replace(new RegExp(`\\{\\{${i}\\}\\}`,"g"),n);return r},ub=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
|
+
`),cb=(e,t)=>e.selections[t]==="none",lb=e=>{let t=e.selections.variant.startsWith("ts");return{ts:t,ext:t?"tsx":"jsx",configExt:t?"ts":"js"}},pb=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 fa(t,{dependencies:i.dependencies,devDependencies:i.devDependencies}),i.directories&&await jp(t,i.directories),i.files){let n=i.files(t);await Np(t,n)}i.setup&&await i.setup(t)}},hb=async(e,t)=>e?t():null,mb=(e,t,r)=>e?t:r,db=(...e)=>e.filter(t=>t!==!1&&t!==null&&t!==void 0),fb=(...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 qp={};k(qp,{MAX_MAJOR_CONSTRAINTS:()=>Up,checkNetworkConnectivity:()=>Gp,clearCache:()=>yb,fetchWithTimeout:()=>bn,getCached:()=>zp,getLatestVersion:()=>Wp,getPackageVersions:()=>Vp,isOffline:()=>Cb,setCache:()=>Hp,setOfflineMode:()=>Eb,startPrefetch:()=>vb,waitForPrefetch:()=>Sb});var Mp,gb,Da,Db,Lp,Up,yn,zp,Hp,yb,nr,ga,bb,Cb,Eb,bn,Wp,Gp,Vp,Zr,wb,vb,Sb,Yp=D(()=>{"use strict";Mp=G(oe(),1),gb=3e3,Da="https://registry.npmjs.org",Db=36e5,Lp={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",eslint:"^9.29.0","@eslint/js":"^9.29.0",globals:"^16.0.0","typescript-eslint":"^8.33.0","eslint-plugin-react-hooks":"^5.2.0","eslint-plugin-react-refresh":"^0.4.20"},Up={eslint:9,"@eslint/js":9},yn=new Map,zp=e=>{let t=yn.get(e);return t?Date.now()-t.timestamp>Db?(yn.delete(e),null):t.value:null},Hp=(e,t)=>{yn.set(e,{value:t,timestamp:Date.now()})},yb=()=>{yn.clear()},nr=!1,ga=0,bb=3e4,Cb=()=>nr,Eb=e=>{nr=e,e&&console.log(Mp.default.yellow("\u26A0 Offline mode enabled. Using built-in stable versions."))},bn=async(e,t={},r=gb)=>{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}},Wp=async e=>{let t=zp(`version:${e}`);if(t)return t;if(nr)return Lp[e]||"latest";let r=Up[e];try{let i;if(r!==void 0){let n=await bn(`${Da}/${encodeURIComponent(e)}`,{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}`);let o=await n.json(),a=Object.keys(o.versions??{}).filter(u=>{let c=u.match(/^(\d+)\./);return c&&parseInt(c[1],10)<=r}).sort((u,c)=>{let l=N=>N.split(".").map(Number),[p,h,m]=l(u),[g,y,w]=l(c);return g-p||y-h||w-m});if(a.length===0)throw new Error("No compatible version found");i=`^${a[0]}`}else{let n=await bn(`${Da}/${encodeURIComponent(e)}/latest`,{headers:{Accept:"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}`);i=`^${(await n.json()).version}`}return Hp(`version:${e}`,i),i}catch{return Lp[e]??"latest"}},Gp=async()=>{let e=Date.now();if(e-ga<bb)return!nr;try{return await bn(`${Da}/react`,{},2e3),ga=e,nr=!1,!0}catch{return ga=e,nr=!0,!1}},Vp=async e=>{let t={};return await Promise.all(e.map(async r=>{t[r]=await Wp(r)})),t},Zr=null,wb=["react","react-dom","zustand","react-router-dom","@tanstack/react-query","react-hook-form","zod","tailwindcss","lucide-react"],vb=()=>{Zr||(Zr=(async()=>{try{if(!await Gp())return;await Vp(wb)}catch{}finally{Zr=null}})())},Sb=async()=>{Zr&&await Zr}});var ya={};k(ya,{PackageManager:()=>Cn});import Fb from"node:path";var Cn,En=D(()=>{"use strict";st();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 nt(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(()=>(Yp(),qp)),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 He(Fb.join(this.projectPath,"package.json"),this.pkg)}}});var Zp={};k(Zp,{detectAvailableManagers:()=>Sn,detectPackageManagerUsed:()=>wn,getInstallCommand:()=>Nt,getPrefetchCommand:()=>vn,getRunCommand:()=>Kp});import{execSync as ba}from"node:child_process";var wn,vn,Sn,Nt,Kp,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{ba("pnpm --version",{stdio:"ignore"}),e.push("pnpm")}catch{}try{ba("yarn --version",{stdio:"ignore"}),e.push("yarn")}catch{}try{ba("bun --version",{stdio:"ignore"}),e.push("bun")}catch{}return e},Nt=(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"}},Kp=(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 th=I((i2,eh)=>{eh.exports=Qp;Qp.sync=kb;var Jp=ce("fs");function xb(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 Xp(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:xb(t,r)}function Qp(e,t,r){Jp.stat(e,function(i,n){r(i,i?!1:Xp(n,e,t))})}function kb(e,t){return Xp(Jp.statSync(e),e,t)}});var oh=I((n2,sh)=>{sh.exports=ih;ih.sync=Ab;var rh=ce("fs");function ih(e,t,r){rh.stat(e,function(i,n){r(i,i?!1:nh(n,t))})}function Ab(e,t){return nh(rh.statSync(e),t)}function nh(e,t){return e.isFile()&&_b(e,t)}function _b(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 uh=I((o2,ah)=>{var s2=ce("fs"),xn;process.platform==="win32"||global.TESTING_WINDOWS?xn=th():xn=oh();ah.exports=Ca;Ca.sync=Tb;function Ca(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){Ca(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 Tb(e,t){try{return xn.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var fh=I((a2,dh)=>{var sr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ch=ce("path"),Ob=sr?";":":",lh=uh(),ph=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),hh=(e,t)=>{let r=t.colon||Ob,i=e.match(/\//)||sr&&e.match(/\\/)?[""]:[...sr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=sr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=sr?n.split(r):[""];return sr&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},mh=(e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:i,pathExt:n,pathExtExe:o}=hh(e,t),s=[],a=c=>new Promise((l,p)=>{if(c===i.length)return t.all&&s.length?l(s):p(ph(e));let h=i[c],m=/^".*"$/.test(h)?h.slice(1,-1):h,g=ch.join(m,e),y=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;l(u(y,c,0))}),u=(c,l,p)=>new Promise((h,m)=>{if(p===n.length)return h(a(l+1));let g=n[p];lh(c+g,{pathExt:o},(y,w)=>{if(!y&&w)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)},Rb=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=hh(e,t),o=[];for(let s=0;s<r.length;s++){let a=r[s],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=ch.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(lh.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 ph(e)};dh.exports=mh;mh.sync=Rb});var Dh=I((u2,Ea)=>{"use strict";var gh=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};Ea.exports=gh;Ea.exports.default=gh});var Eh=I((c2,Ch)=>{"use strict";var yh=ce("path"),$b=fh(),Pb=Dh();function bh(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=$b.sync(e.command,{path:r[Pb({env:r})],pathExt:t?yh.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return s&&(s=yh.resolve(n?e.options.cwd:"",s)),s}function Ib(e){return bh(e)||bh(e,!0)}Ch.exports=Ib});var wh=I((l2,va)=>{"use strict";var wa=/([()\][%!^"`<>&|;, *?])/g;function Nb(e){return e=e.replace(wa,"^$1"),e}function jb(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(wa,"^$1"),t&&(e=e.replace(wa,"^$1")),e}va.exports.command=Nb;va.exports.argument=jb});var Sh=I((p2,vh)=>{"use strict";vh.exports=/^#!(.*)/});var xh=I((h2,Fh)=>{"use strict";var Bb=Sh();Fh.exports=(e="")=>{let t=e.match(Bb);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var Ah=I((m2,kh)=>{"use strict";var Sa=ce("fs"),Lb=xh();function Mb(e){let r=Buffer.alloc(150),i;try{i=Sa.openSync(e,"r"),Sa.readSync(i,r,0,150,0),Sa.closeSync(i)}catch{}return Lb(r.toString())}kh.exports=Mb});var Rh=I((d2,Oh)=>{"use strict";var Ub=ce("path"),_h=Eh(),Th=wh(),zb=Ah(),Hb=process.platform==="win32",Wb=/\.(?:com|exe)$/i,Gb=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Vb(e){e.file=_h(e);let t=e.file&&zb(e.file);return t?(e.args.unshift(e.file),e.command=t,_h(e)):e.file}function qb(e){if(!Hb)return e;let t=Vb(e),r=!Wb.test(t);if(e.options.forceShell||r){let i=Gb.test(t);e.command=Ub.normalize(e.command),e.command=Th.command(e.command),e.args=e.args.map(o=>Th.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 Yb(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:qb(i)}Oh.exports=Yb});var Ih=I((f2,Ph)=>{"use strict";var Fa=process.platform==="win32";function xa(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 Kb(e,t){if(!Fa)return;let r=e.emit;e.emit=function(i,n){if(i==="exit"){let o=$h(n,t);if(o)return r.call(e,"error",o)}return r.apply(e,arguments)}}function $h(e,t){return Fa&&e===1&&!t.file?xa(t.original,"spawn"):null}function Zb(e,t){return Fa&&e===1&&!t.file?xa(t.original,"spawnSync"):null}Ph.exports={hookChildProcess:Kb,verifyENOENT:$h,verifyENOENTSync:Zb,notFoundError:xa}});var Bh=I((g2,or)=>{"use strict";var Nh=ce("child_process"),ka=Rh(),Aa=Ih();function jh(e,t,r){let i=ka(e,t,r),n=Nh.spawn(i.command,i.args,i.options);return Aa.hookChildProcess(n,i),n}function Jb(e,t,r){let i=ka(e,t,r),n=Nh.spawnSync(i.command,i.args,i.options);return n.error=n.error||Aa.verifyENOENTSync(n.status,i),n}or.exports=jh;or.exports.spawn=jh;or.exports.sync=Jb;or.exports._parse=ka;or.exports._enoent=Aa});function _a(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 Lh=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 Mh=D(()=>{});import An from"node:process";import Jr from"node:path";import{fileURLToPath as Uh}from"node:url";var Xb,Qb,eC,zh,Hh=D(()=>{Mh();Xb=({cwd:e=An.cwd(),path:t=An.env[kn()],preferLocal:r=!0,execPath:i=An.execPath,addExecPath:n=!0}={})=>{let o=e instanceof URL?Uh(e):e,s=Jr.resolve(o),a=[];return r&&Qb(a,s),n&&eC(a,i,s),[...a,t].join(Jr.delimiter)},Qb=(e,t)=>{let r;for(;r!==t;)e.push(Jr.join(t,"node_modules/.bin")),r=t,t=Jr.resolve(t,"..")},eC=(e,t,r)=>{let i=t instanceof URL?Uh(t):t;e.push(Jr.resolve(r,i,".."))},zh=({env:e=An.env,...t}={})=>{e={...e};let r=kn({env:e});return t.path=e[r],e[r]=Xb(t),e}});function Ta(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:i}=e;for(let n of Reflect.ownKeys(t))tC(e,t,n,r);return iC(e,t),aC(e,t,i),e}var tC,rC,iC,nC,sC,oC,aC,Wh=D(()=>{tC=(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);!rC(n,o)&&i||Object.defineProperty(e,r,o)},rC=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)},iC=(e,t)=>{let r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},nC=(e,t)=>`/* Wrapped ${e}*/
|
|
109
|
+
${t}`,sC=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),oC=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),aC=(e,t,r)=>{let i=r===""?"":`with ${r.trim()}() `,n=nC.bind(null,i,t.toString());Object.defineProperty(n,"name",oC),Object.defineProperty(e,"toString",{...sC,value:n})}});var _n,Gh,Vh,qh=D(()=>{Wh();_n=new WeakMap,Gh=(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 Ta(o,e),_n.set(o,i),o};Gh.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)};Vh=Gh});var Yh,uC,Kh,Zh,Jh=D(()=>{Yh=()=>{let e=Zh-Kh+1;return Array.from({length:e},uC)},uC=(e,t)=>({name:`SIGRT${t+1}`,number:Kh+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Kh=34,Zh=64});var Xh,Qh=D(()=>{Xh=[{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 cC}from"node:os";var Oa,lC,em=D(()=>{Qh();Jh();Oa=()=>{let e=Yh();return[...Xh,...e].map(lC)},lC=({name:e,number:t,description:r,action:i,forced:n=!1,standard:o})=>{let{signals:{[e]:s}}=cC,a=s!==void 0;return{name:e,number:a?s:t,description:r,supported:a,action:i,forced:n,standard:o}}});import{constants as pC}from"node:os";var hC,mC,tm,dC,fC,gC,I2,rm=D(()=>{em();hC=()=>{let e=Oa();return Object.fromEntries(e.map(mC))},mC=({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}],tm=hC(),dC=()=>{let e=Oa(),t=65,r=Array.from({length:t},(i,n)=>fC(n,e));return Object.assign({},...r)},fC=(e,t)=>{let r=gC(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}}},gC=(e,t)=>{let r=t.find(({name:i})=>pC.signals[i]===e);return r!==void 0?r:t.find(i=>i.number===e)},I2=dC()});import DC from"node:process";var yC,Xr,im=D(()=>{rm();yC=({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",Xr=({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=DC.cwd()}}})=>{o=o===null?void 0:o,n=n===null?void 0:n;let m=n===void 0?void 0:tm[n].description,g=i&&i.code,w=`Command ${yC({timedOut:u,timeout:p,errorCode:g,signal:n,signalDescription:m,exitCode:o,isCanceled:c})}: ${s}`,N=Object.prototype.toString.call(i)==="[object Error]",C=N?`${w}
|
|
110
|
+
${i.message}`:w,ne=[C,t,e].filter(Boolean).join(`
|
|
111
|
+
`);return N?(i.originalMessage=i.message,i.message=ne):i=new Error(ne),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=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,bC,Ra,nm,sm=D(()=>{Tn=["stdin","stdout","stderr"],bC=e=>Tn.some(t=>e[t]!==void 0),Ra=e=>{if(!e)return;let{stdio:t}=e;if(t===void 0)return Tn.map(i=>e[i]);if(bC(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])},nm=e=>{let t=Ra(e);return t==="ipc"?"ipc":t===void 0||typeof t=="string"?[t,t,t,"ipc"]:t.includes("ipc")?t:[...t,"ipc"]}});var jt,om=D(()=>{jt=[];jt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&jt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var On,$a,Pa,CC,Ia,Rn,EC,Na,ja,Ba,am,H2,W2,um=D(()=>{om();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",$a=Symbol.for("signal-exit emitter"),Pa=globalThis,CC=Object.defineProperty.bind(Object),Ia=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Pa[$a])return Pa[$a];CC(Pa,$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}},Rn=class{},EC=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}}),Na=class extends Rn{onExit(){return()=>{}}load(){}unload(){}},ja=class extends Rn{#e=Ba.platform==="win32"?"SIGINT":"SIGHUP";#i=new Ia;#t;#o;#s;#r={};#n=!1;constructor(t){super(),this.#t=t,this.#r={};for(let r of jt)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 jt)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,jt.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)}},Ba=globalThis.process,{onExit:am,load:H2,unload:W2}=EC(On(Ba)?new ja(Ba):new Na)});import wC from"node:os";var vC,cm,SC,FC,xC,kC,lm,AC,pm,hm,mm,dm=D(()=>{um();vC=1e3*5,cm=(e,t="SIGTERM",r={})=>{let i=e(t);return SC(e,t,r,i),i},SC=(e,t,r,i)=>{if(!FC(t,r,i))return;let n=kC(r),o=setTimeout(()=>{e("SIGKILL")},n);o.unref&&o.unref()},FC=(e,{forceKillAfterTimeout:t},r)=>xC(e)&&t!==!1&&r,xC=e=>e===wC.constants.signals.SIGTERM||typeof e=="string"&&e.toUpperCase()==="SIGTERM",kC=({forceKillAfterTimeout:e=!0})=>{if(e===!0)return vC;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},lm=(e,t)=>{e.kill()&&(t.isCanceled=!0)},AC=(e,t,r)=>{e.kill(t),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:t}))},pm=(e,{timeout:t,killSignal:r="SIGTERM"},i)=>{if(t===0||t===void 0)return i;let n,o=new Promise((a,u)=>{n=setTimeout(()=>{AC(e,r,u)},t)}),s=i.finally(()=>{clearTimeout(n)});return Promise.race([o,s])},hm=({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})`)},mm=async(e,{cleanup:t,detached:r},i)=>{if(!t||r)return i;let n=am(()=>{e.kill()});return i.finally(()=>{n()})}});function $n(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function La(e){return $n(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}var Ma=D(()=>{});import{createWriteStream as _C}from"node:fs";import{ChildProcess as TC}from"node:child_process";var OC,Ua,fm,gm=D(()=>{Ma();OC=e=>e instanceof TC&&typeof e.then=="function",Ua=(e,t,r)=>{if(typeof r=="string")return e[t].pipe(_C(r)),e;if(La(r))return e[t].pipe(r),e;if(!OC(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!La(r.stdin))throw new TypeError("The target child process's stdin must be available.");return e[t].pipe(r.stdin),r},fm=e=>{e.stdout!==null&&(e.pipeStdout=Ua.bind(void 0,e,"stdout")),e.stderr!==null&&(e.pipeStderr=Ua.bind(void 0,e,"stderr")),e.all!==void 0&&(e.pipeAll=Ua.bind(void 0,e,"all"))}});var Qr,RC,bm,Dm,$C,PC,ym,Pn,ei=D(()=>{Qr=async(e,{init:t,convertChunk:r,getSize:i,truncateChunk:n,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:u=Number.POSITIVE_INFINITY}={})=>{if(!$C(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=PC(l),h=r[p](l,c);bm({convertedChunk:h,state:c,getSize:i,truncateChunk:n,addChunk:o,maxBuffer:u})}return RC({state:c,convertChunk:r,getSize:i,truncateChunk:n,addChunk:o,getFinalChunk:s,maxBuffer:u}),a(c)}catch(l){throw l.bufferedData=a(c),l}},RC=({state:e,getSize:t,truncateChunk:r,addChunk:i,getFinalChunk:n,maxBuffer:o})=>{let s=n(e);s!==void 0&&bm({convertedChunk:s,state:e,getSize:t,truncateChunk:r,addChunk:i,maxBuffer:o})},bm=({convertedChunk:e,state:t,getSize:r,truncateChunk:i,addChunk:n,maxBuffer:o})=>{let s=r(e),a=t.length+s;if(a<=o){Dm(e,t,n,a);return}let u=i(e,o-t.length);throw u!==void 0&&Dm(u,t,n,o),new Pn},Dm=(e,t,r,i)=>{t.contents=r(e,t,i),t.length=i},$C=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",PC=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=ym.call(e);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(e.byteLength)&&Number.isInteger(e.byteOffset)&&ym.call(e.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:ym}=Object.prototype,Pn=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var za,Ha,Wa,In,Nn,jn=D(()=>{za=e=>e,Ha=()=>{},Wa=({contents:e})=>e,In=e=>{throw new Error(`Streams in object mode are not supported: ${String(e)}`)},Nn=e=>e.length});var Cm=D(()=>{ei();jn()});async function Ga(e,t){return Qr(e,HC,t)}var IC,NC,jC,Em,wm,BC,LC,MC,UC,Sm,vm,zC,Fm,HC,Va=D(()=>{ei();jn();IC=()=>({contents:new ArrayBuffer(0)}),NC=e=>jC.encode(e),jC=new TextEncoder,Em=e=>new Uint8Array(e),wm=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),BC=(e,t)=>e.slice(0,t),LC=(e,{contents:t,length:r},i)=>{let n=Fm()?UC(t,i):MC(t,i);return new Uint8Array(n).set(e,r),n},MC=(e,t)=>{if(t<=e.byteLength)return e;let r=new ArrayBuffer(Sm(t));return new Uint8Array(r).set(new Uint8Array(e),0),r},UC=(e,t)=>{if(t<=e.maxByteLength)return e.resize(t),e;let r=new ArrayBuffer(t,{maxByteLength:Sm(t)});return new Uint8Array(r).set(new Uint8Array(e),0),r},Sm=e=>vm**Math.ceil(Math.log(e)/Math.log(vm)),vm=2,zC=({contents:e,length:t})=>Fm()?e:e.slice(0,t),Fm=()=>"resize"in ArrayBuffer.prototype,HC={init:IC,convertChunk:{string:NC,buffer:Em,arrayBuffer:Em,dataView:wm,typedArray:wm,others:In},getSize:Nn,truncateChunk:BC,addChunk:LC,getFinalChunk:Ha,finalize:zC}});async function Bn(e,t){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return xm(await Ga(e,t))}catch(r){throw r.bufferedData!==void 0&&(r.bufferedData=xm(r.bufferedData)),r}}var xm,km=D(()=>{Va();xm=e=>globalThis.Buffer.from(e)});async function qa(e,t){return Qr(e,YC,t)}var WC,Ln,GC,VC,qC,YC,Am=D(()=>{ei();jn();WC=()=>({contents:"",textDecoder:new TextDecoder}),Ln=(e,{textDecoder:t})=>t.decode(e,{stream:!0}),GC=(e,{contents:t})=>t+e,VC=(e,t)=>e.slice(0,t),qC=({textDecoder:e})=>{let t=e.decode();return t===""?void 0:t},YC={init:WC,convertChunk:{string:za,buffer:Ln,arrayBuffer:Ln,dataView:Ln,typedArray:Ln,others:In},getSize:Nn,truncateChunk:VC,addChunk:GC,getFinalChunk:qC,finalize:Wa}});var _m=D(()=>{Cm();Va();km();Am();ei()});var Om=I((CF,Tm)=>{"use strict";var{PassThrough:KC}=ce("stream");Tm.exports=function(){var e=[],t=new KC({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 JC}from"node:fs";import{setTimeout as XC}from"node:timers/promises";var Rm,$m,QC,Pm,eE,Im,Nm,Ya,Ka,tE,jm,Bm=D(()=>{Ma();_m();Rm=G(Om(),1),$m=e=>{if(e!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},QC=({input:e,inputFile:t})=>typeof t!="string"?e:($m(e),JC(t)),Pm=e=>{let t=QC(e);if($n(t))throw new TypeError("The `input` option cannot be a stream in sync mode");return t},eE=({input:e,inputFile:t})=>typeof t!="string"?e:($m(e),ZC(t)),Im=(e,t)=>{let r=eE(t);r!==void 0&&($n(r)?r.pipe(e.stdin):e.stdin.end(r))},Nm=(e,{all:t})=>{if(!t||!e.stdout&&!e.stderr)return;let r=(0,Rm.default)();return e.stdout&&r.add(e.stdout),e.stderr&&r.add(e.stderr),r},Ya=async(e,t)=>{if(!(!e||t===void 0)){await XC(0),e.destroy();try{return await t}catch(r){return r.bufferedData}}},Ka=(e,{encoding:t,buffer:r,maxBuffer:i})=>{if(!(!e||!r))return t==="utf8"||t==="utf-8"?qa(e,{maxBuffer:i}):t===null||t==="buffer"?Bn(e,{maxBuffer:i}):tE(e,i,t)},tE=async(e,t,r)=>(await Bn(e,{maxBuffer:t})).toString(r),jm=async({stdout:e,stderr:t,all:r},{encoding:i,buffer:n,maxBuffer:o},s)=>{let a=Ka(e,{encoding:i,buffer:n,maxBuffer:o}),u=Ka(t,{encoding:i,buffer:n,maxBuffer:o}),c=Ka(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},Ya(e,a),Ya(t,u),Ya(r,c)])}}});var rE,iE,Za,Lm,Mm=D(()=>{rE=(async()=>{})().constructor.prototype,iE=["then","catch","finally"].map(e=>[e,Reflect.getOwnPropertyDescriptor(rE,e)]),Za=(e,t)=>{for(let[r,i]of iE){let n=typeof t=="function"?(...o)=>Reflect.apply(i.value,t(),o):i.value.bind(t);Reflect.defineProperty(e,r,{...i,value:n})}},Lm=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 nE}from"node:buffer";import{ChildProcess as sE}from"node:child_process";var Hm,oE,aE,Ja,Xa,Wm,Qa,Um,zm,uE,eu,Gm=D(()=>{Hm=(e,t=[])=>Array.isArray(t)?[e,...t]:[e],oE=/^[\w.-]+$/,aE=e=>typeof e!="string"||oE.test(e)?e:`"${e.replaceAll('"','\\"')}"`,Ja=(e,t)=>Hm(e,t).join(" "),Xa=(e,t)=>Hm(e,t).map(r=>aE(r)).join(" "),Wm=/ +/g,Qa=e=>{let t=[];for(let r of e.trim().split(Wm)){let i=t.at(-1);i&&i.endsWith("\\")?t[t.length-1]=`${i.slice(0,-1)} ${r}`:t.push(r)}return t},Um=e=>{let t=typeof e;if(t==="string")return e;if(t==="number")return String(e);if(t==="object"&&e!==null&&!(e instanceof sE)&&"stdout"in e){let r=typeof e.stdout;if(r==="string")return e.stdout;if(nE.isBuffer(e.stdout))return e.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${t}" in template expression`)},zm=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],uE=({templates:e,expressions:t,tokens:r,index:i,template:n})=>{let o=n??e.raw[i],s=o.split(Wm).filter(Boolean),a=zm(r,s,o.startsWith(" "));if(i===t.length)return a;let u=t[i],c=Array.isArray(u)?u.map(l=>Um(l)):[Um(u)];return zm(a,c,o.endsWith(" "))},eu=(e,t)=>{let r=[];for(let[i,n]of e.entries())r=uE({templates:e,expressions:t,tokens:r,index:i,template:n});return r}});import{debuglog as cE}from"node:util";import lE from"node:process";var Vm,Mn,pE,tu,qm=D(()=>{Vm=cE("execa").enabled,Mn=(e,t)=>String(e).padStart(t,"0"),pE=()=>{let e=new Date;return`${Mn(e.getHours(),2)}:${Mn(e.getMinutes(),2)}:${Mn(e.getSeconds(),2)}.${Mn(e.getMilliseconds(),3)}`},tu=(e,{verbose:t})=>{t&&lE.stderr.write(`[${pE()}] ${e}
|
|
112
|
+
`)}});var Xm={};k(Xm,{$:()=>DE,execa:()=>ue,execaCommand:()=>yE,execaCommandSync:()=>bE,execaNode:()=>CE,execaSync:()=>iu});import{Buffer as hE}from"node:buffer";import mE from"node:path";import ru from"node:child_process";import ar from"node:process";function ue(e,t,r){let i=Zm(e,t,r),n=Ja(e,t),o=Xa(e,t);tu(o,i.options),hm(i.options);let s;try{s=ru.spawn(i.file,i.args,i.options)}catch(m){let g=new ru.ChildProcess,y=Promise.reject(Xr({error:m,stdout:"",stderr:"",all:"",command:n,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1}));return Za(g,y),g}let a=Lm(s),u=pm(s,i.options,a),c=mm(s,i.options,u),l={isCanceled:!1};s.kill=cm.bind(null,s.kill.bind(s)),s.cancel=lm.bind(null,s,l);let h=Vh(async()=>{let[{error:m,exitCode:g,signal:y,timedOut:w},N,C,ne]=await jm(s,i.options,c),se=ti(i.options,N),E=ti(i.options,C),q=ti(i.options,ne);if(m||g!==0||y!==null){let j=Xr({error:m,exitCode:g,signal:y,stdout:se,stderr:E,all:q,command:n,escapedCommand:o,parsed:i,timedOut:w,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:se,stderr:E,all:q,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return Im(s,i.options),s.all=Nm(s,i.options),fm(s),Za(s,h),s}function iu(e,t,r){let i=Zm(e,t,r),n=Ja(e,t),o=Xa(e,t);tu(o,i.options);let s=Pm(i.options),a;try{a=ru.spawnSync(i.file,i.args,{...i.options,input:s})}catch(l){throw Xr({error:l,stdout:"",stderr:"",all:"",command:n,escapedCommand:o,parsed:i,timedOut:!1,isCanceled:!1,killed:!1})}let u=ti(i.options,a.stdout,a.error),c=ti(i.options,a.stderr,a.error);if(a.error||a.status!==0||a.signal!==null){let l=Xr({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 Jm(e){function t(r,...i){if(!Array.isArray(r))return Jm({...e,...r});let[n,...o]=eu(r,i);return ue(n,o,Ym(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]=eu(r,i);return iu(n,o,Ym(e))},t}function yE(e,t){let[r,...i]=Qa(e);return ue(r,i,t)}function bE(e,t){let[r,...i]=Qa(e);return iu(r,i,t)}function CE(e,t,r={}){t&&!Array.isArray(t)&&typeof t=="object"&&(r=t,t=[]);let i=nm(r),n=ar.execArgv.filter(a=>!a.startsWith("--inspect")),{nodePath:o=ar.execPath,nodeOptions:s=n}=r;return ue(o,[...s,e,...Array.isArray(t)?t:[]],{...r,stdin:void 0,stdout:void 0,stderr:void 0,stdio:i,shell:!1})}var Km,dE,fE,Zm,ti,gE,Ym,DE,ri=D(()=>{Km=G(Bh(),1);Lh();Hh();qh();im();sm();dm();gm();Bm();Mm();Gm();qm();dE=1e3*1e3*100,fE=({env:e,extendEnv:t,preferLocal:r,localDir:i,execPath:n})=>{let o=t?{...ar.env,...e}:e;return r?zh({env:o,cwd:i,execPath:n}):o},Zm=(e,t,r={})=>{let i=Km.default._parse(e,t,r);return e=i.command,t=i.args,r=i.options,r={maxBuffer:dE,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||ar.cwd(),execPath:ar.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:Vm,...r},r.env=fE(r),r.stdio=Ra(r),ar.platform==="win32"&&mE.basename(e,".exe")==="cmd"&&t.unshift("/q"),{file:e,args:t,options:r,parsed:i}},ti=(e,t,r)=>typeof t!="string"&&!hE.isBuffer(t)?r===void 0?void 0:"":e.stripFinalNewline?_a(t):t;gE=({input:e,inputFile:t,stdio:r})=>e===void 0&&t===void 0&&r===void 0?{stdin:"inherit"}:{},Ym=(e={})=>({preferLocal:!0,...gE(e),...e});DE=Jm()});var Qm={};k(Qm,{prefetchCommonPackages:()=>ur,prefetchPackages:()=>Me,prefetchedStats:()=>Un});var Me,Un,ur,zn=D(()=>{"use strict";ri();Fn();Me=e=>{if(e.length===0)return;let t=wn(),r=vn(t);if(!r)return;let{command:i,args:n}=r,o=[...n,...e];ue(i,o,{stdio:"ignore",detached:!1}).then(()=>{Un.successCount+=e.length}).catch(s=>{Un.failCount+=1})},Un={successCount:0,failCount:0},ur=()=>{Me(["react@latest","react-dom@latest","vite@latest","typescript@latest","@vitejs/plugin-react@latest","tailwindcss@latest","postcss@latest","autoprefixer@latest"])}});var ie,EE,wE,vE,SE,ed=D(()=>{"use strict";ie=G(oe(),1),EE=e=>{let{total:t,width:r=30,showPercentage:i=!0,showStepCount:n=!0,completeChar:o="\u2588",incompleteChar:s="\u2591",filledColor:a=ie.default.cyan,emptyColor:u=ie.default.dim}=e,c=0,l="",p=()=>{let h=Math.round(c/t*100),m=Math.round(c/t*r),g=r-m,w=`\r${a(o.repeat(m))+u(s.repeat(g))}`;i&&(w+=` ${h.toString().padStart(3)}%`),n&&(w+=` (${c}/${t})`),l&&(w+=` ${ie.default.dim(l)}`),w+="\x1B[K",process.stdout.write(w)};return{increment:h=>{c=Math.min(c+1,t),l=h||"",p()},update:(h,m)=>{c=Math.min(Math.max(0,h),t),l=m||"",p()},complete:h=>{c=t,l="",p(),console.log(),h&&console.log(ie.default.green(`\u2713 ${h}`))},fail:h=>{l="",console.log(),h&&console.log(ie.default.red(`\u2717 ${h}`))},getPercentage:()=>Math.round(c/t*100)}},wE=e=>{let{total:t,showStepNumbers:r=!0}=e,i=0,n="",o=()=>r?`[${i}/${t}]`:"";return{start:s=>{i++,n=s,process.stdout.write(`${ie.default.cyan("\u25CF")} ${o()} ${s}...`)},succeed:s=>{process.stdout.write(`\r${ie.default.green("\u2713")} ${o()} ${s||n}\x1B[K
|
|
113
|
+
`)},fail:s=>{process.stdout.write(`\r${ie.default.red("\u2717")} ${o()} ${s||n}\x1B[K
|
|
114
|
+
`)},skip:s=>{let a=s?` (${s})`:"";process.stdout.write(`\r${ie.default.yellow("\u25CB")} ${o()} ${n}${ie.default.dim(a)}\x1B[K
|
|
115
|
+
`)},complete:()=>{console.log(),console.log(ie.default.green(`\u2713 All ${t} steps completed successfully!`))}}},vE=()=>({log:e=>{console.log(` ${e}`)},success:e=>{console.log(`${ie.default.green("\u2713")} ${e}`)},error:e=>{console.log(`${ie.default.red("\u2717")} ${e}`)},warn:e=>{console.log(`${ie.default.yellow("\u26A0")} ${e}`)},info:e=>{console.log(`${ie.default.blue("\u2139")} ${e}`)}}),SE=()=>{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 FE from"node:os";var Hn,ii,Wn,nu,su,td,rd,id,nd,xE,sd,od=D(()=>{"use strict";br();Cr();Hn={framework:Object.values(vc),variant:Object.values(Sc),language:["typescript","javascript"],styling:Object.values(wc),ui:Object.values(Ec),forms:Object.values(xc),state:Object.values(Fc),routing:Object.values(kc),dataFetching:Object.values(Ac),icons:Object.values(_c),structure:Object.values(Tc),testing:["vitest","jest"],linting:["eslint-prettier","biome"],api:["openapi","graphql","trpc"],animation:["framer-motion","gsap"]},ii=[{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}},nu=(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}},su=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=nu(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 ii)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)]}},td=e=>{let t=su(e);if(!t.valid)throw new Ai(t.errors.join("; "),{errors:t.errors,selections:e})},rd=e=>{let t=ii.filter(r=>r.severity==="error"&&r.check(e));if(t.length>0)throw new _i(t.map(r=>r.message).join("; "),e)},id=e=>ii.filter(t=>t.severity==="warning"&&t.check(e)).map(t=>t.message),nd=e=>e.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,214),xE=e=>{let t=[],r=[],i=[],n=FE.platform()==="win32";n&&e.length>=Re?(t.push(`Path too long: ${e.length} characters exceeds Windows limit of ${Re}`),i.push("Use a shorter project name or parent directory")):e.length>=Re&&r.push(`Path length (${e.length}) may cause issues on Windows (limit: ${Re})`);let o=n?/[\\/]/:/\//,s=e.split(o).filter(Boolean);for(let a of s)a.length>rt&&t.push(`Path component "${a.slice(0,30)}..." is too long (${a.length} chars, max: ${rt})`);return{valid:t.length===0,errors:t,warnings:r,suggestions:i}},sd=(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=xE(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 J,ad,Gn,me,d,bt=D(()=>{"use strict";J=G(oe(),1),ad={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 ad[t]>=ad[this.level]}format(t){return this.prefix?`${this.prefix} ${t}`:t}newline(){this.shouldLog("info")&&process.stdout.write(`
|
|
116
116
|
`)}print(t){this.shouldLog("info")&&process.stdout.write(t+`
|
|
117
|
-
`)}debug(t){this.shouldLog("debug")&&process.stdout.write(this.colors?
|
|
117
|
+
`)}debug(t){this.shouldLog("debug")&&process.stdout.write(this.colors?J.default.dim(`[debug] ${t}`)+`
|
|
118
118
|
`:`[debug] ${t}
|
|
119
|
-
`)}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?J.default.dim(`[verbose] ${t}`)+`
|
|
120
120
|
`:`[verbose] ${t}
|
|
121
121
|
`)}info(t){this.shouldLog("info")&&process.stdout.write(this.format(t)+`
|
|
122
|
-
`)}success(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
122
|
+
`)}success(t){this.shouldLog("info")&&process.stdout.write(this.colors?J.default.green(this.format(t))+`
|
|
123
123
|
`:this.format(t)+`
|
|
124
|
-
`)}warn(t){this.shouldLog("warn")&&process.stderr.write(this.colors?
|
|
124
|
+
`)}warn(t){this.shouldLog("warn")&&process.stderr.write(this.colors?J.default.yellow(`\u26A0 ${t}`)+`
|
|
125
125
|
`:`Warning: ${t}
|
|
126
|
-
`)}error(t){this.shouldLog("error")&&process.stderr.write(this.colors?
|
|
126
|
+
`)}error(t){this.shouldLog("error")&&process.stderr.write(this.colors?J.default.red(`\u2716 ${t}`)+`
|
|
127
127
|
`:`Error: ${t}
|
|
128
|
-
`)}dim(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
128
|
+
`)}dim(t){this.shouldLog("info")&&process.stdout.write(this.colors?J.default.dim(t)+`
|
|
129
129
|
`:t+`
|
|
130
|
-
`)}cyan(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
130
|
+
`)}cyan(t){this.shouldLog("info")&&process.stdout.write(this.colors?J.default.cyan(t)+`
|
|
131
131
|
`:t+`
|
|
132
|
-
`)}bold(t){this.shouldLog("info")&&process.stdout.write(this.colors?
|
|
132
|
+
`)}bold(t){this.shouldLog("info")&&process.stdout.write(this.colors?J.default.bold(t)+`
|
|
133
133
|
`:t+`
|
|
134
|
-
`)}header(t,r="info"){if(!this.shouldLog("info"))return;let i=this.colors?r==="error"?
|
|
135
|
-
`)}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"?J.default.bgRed(J.default.white(J.default.bold(` ${t} `))):r==="warning"?J.default.bgYellow(J.default.black(` ${t} `)):J.default.bgCyan(J.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?J.default.dim(`${i}${n}`)+`
|
|
136
136
|
`:`${i}${n}
|
|
137
|
-
`)}},
|
|
137
|
+
`)}},me=new Gn,d={newline:()=>me.newline(),print:e=>me.print(e),debug:e=>me.debug(e),verbose:e=>me.verbose(e),info:e=>me.info(e),success:e=>me.success(e),warn:e=>me.warn(e),error:e=>me.error(e),dim:e=>me.dim(e),cyan:e=>me.cyan(e),bold:e=>me.bold(e),header:(e,t)=>me.header(e,t),list:(e,t)=>me.list(e,t)}});var ou={};k(ou,{DEFAULT_PROJECT_NAME:()=>Oc,Logger:()=>Gn,MAX_PATH_COMPONENT:()=>rt,MIN_DISK_SPACE_BYTES:()=>yr,PRESET_TEMPLATES:()=>Op,PackageManager:()=>Cn,VALID_OPTIONS:()=>Hn,WINDOWS_MAX_PATH:()=>Re,addDependencies:()=>fa,addDependenciesIf:()=>sb,addDependency:()=>wr,addScript:()=>Gc,appendFile:()=>zt,buildArray:()=>db,buildObject:()=>fb,cache:()=>Pe,checkCompatibilityOrThrow:()=>rd,checkDiskSpace:()=>Mc,checkWritePermission:()=>Lc,clearCache:()=>Qg,cloneTemplate:()=>ma,compatibilityRules:()=>ii,copy:()=>Wc,createDirectories:()=>jp,createFileIfNotExists:()=>ob,createFiles:()=>Ip,createFilesFromRecord:()=>Np,createProgressBar:()=>EE,createProjectDir:()=>Ti,createSimpleProgress:()=>vE,createSpinner:()=>pa,createStandardConfigurator:()=>pb,createStepProgress:()=>wE,createTimer:()=>SE,detectAvailableManagers:()=>Sn,detectPackageManagerUsed:()=>wn,detectProjectConfig:()=>Gs,doIf:()=>hb,ensureDir:()=>x,generateFileTree:()=>Ht,generateImports:()=>ub,getCached:()=>Zg,getCachedSync:()=>Jg,getCompatibilityWarnings:()=>id,getExtension:()=>lb,getInstallCommand:()=>Nt,getPackageJson:()=>nt,getPrefetchCommand:()=>vn,getPresetTemplate:()=>da,getRunCommand:()=>Kp,invalidateCache:()=>Xg,isDirEmpty:()=>Ws,log:()=>d,logger:()=>me,memoize:()=>eD,memoizeSync:()=>tD,pathExists:()=>xe,preWriteChecks:()=>js,prefetchCommonPackages:()=>ur,prefetchPackages:()=>Me,prefetchedStats:()=>Un,readJson:()=>Ms,remove:()=>Hc,removeFile:()=>zc,sanitizeProjectName:()=>nd,savePackageJson:()=>Oi,selectIf:()=>mb,skipIfNone:()=>cb,spinner:()=>Je,template:()=>ab,validateOption:()=>nu,validateOrThrow:()=>td,validatePathLength:()=>Uc,validateProjectName:()=>Wn,validateProjectPath:()=>sd,validateSelections:()=>su,writeFile:()=>v,writeJson:()=>He});var W=D(()=>{"use strict";Hs();Zc();Xc();Bs();st();Pp();Bp();En();Fn();zn();ed();ha();br();od();bt()});var ud={};k(ud,{frameworkConfigurator:()=>kE});import Vn from"node:path";var kE,AE,cd=D(()=>{"use strict";W();kE=async e=>{let{variant:t}=e.selections,r=t.startsWith("ts");await AE(e,r,r?"ts":"js")},AE=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';
|
|
138
138
|
import { fileURLToPath } from 'url';
|
|
139
139
|
`:""}${o}
|
|
140
140
|
import { defineConfig } from 'vite'${s?`
|
|
@@ -165,7 +165,7 @@ export default defineConfig({
|
|
|
165
165
|
<script type="module" src="/src/main.${t?"tsx":"jsx"}"></script>
|
|
166
166
|
</body>
|
|
167
167
|
</html>
|
|
168
|
-
`;await v(Vn.join(e.projectPath,"index.html"),p),await x(Vn.join(e.projectPath,"public")),await v(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
|
|
168
|
+
`;await v(Vn.join(e.projectPath,"index.html"),p),await x(Vn.join(e.projectPath,"public")),await v(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 ld={};k(ld,{variantConfigurator:()=>_E});var _E,pd=D(()=>{"use strict";_E=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 hd={};k(hd,{languageConfigurator:()=>TE});import ni from"node:path";var TE,md=D(()=>{"use strict";W();TE=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 He(ni.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 He(ni.join(e.projectPath,"tsconfig.node.json"),u)}e.pkg.addScript("build",i?"tsc && vite build":"vite build");let n=`import js from '@eslint/js';
|
|
169
169
|
import globals from 'globals';
|
|
170
170
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
171
171
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
@@ -198,7 +198,7 @@ export default tseslint.config(
|
|
|
198
198
|
},
|
|
199
199
|
},
|
|
200
200
|
);
|
|
201
|
-
`,{writeFile:o}=await Promise.resolve().then(()=>(
|
|
201
|
+
`,{writeFile:o}=await Promise.resolve().then(()=>(W(),ou));await o(ni.join(e.projectPath,"eslint.config.js"),n),e.pkg.add("eslint","^9.29.0",!0),e.pkg.add("eslint-plugin-react-hooks","^5.2.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.29.0",!0)}await x(ni.join(e.projectPath,".vscode")),await He(ni.join(e.projectPath,".vscode","settings.json"),{"json.schemas":[],"typescript.tsdk":"node_modules/typescript/lib"})}});var dd={};k(dd,{stylingConfigurator:()=>OE});import si from"node:path";var OE,fd=D(()=>{"use strict";W();OE=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'"}
|
|
202
202
|
import { defineConfig } from 'vite'
|
|
203
203
|
import tailwindcss from '@tailwindcss/vite'
|
|
204
204
|
|
|
@@ -208,7 +208,7 @@ export default defineConfig({
|
|
|
208
208
|
tailwindcss(),
|
|
209
209
|
],
|
|
210
210
|
})
|
|
211
|
-
`;await v(
|
|
211
|
+
`;await v(si.join(e.projectPath,`vite.config.${i}`),s);let a=`@import "tailwindcss";
|
|
212
212
|
${n?`
|
|
213
213
|
@theme {
|
|
214
214
|
--font-sans: "Cairo", ui-sans-serif, system-ui, sans-serif;
|
|
@@ -220,20 +220,20 @@ ${n?`
|
|
|
220
220
|
|
|
221
221
|
body {
|
|
222
222
|
text-align: right;
|
|
223
|
-
}`:""}`;await x(
|
|
223
|
+
}`:""}`;await x(si.join(e.projectPath,"src")),await v(si.join(e.projectPath,"src","index.css"),a);break;case"css-modules":await x(si.join(e.projectPath,"src")),await v(si.join(e.projectPath,"src","index.css"),`/* CSS Modules - import styles from './Component.module.css' */
|
|
224
224
|
:root {
|
|
225
225
|
font-family: ${n?"'Cairo', ":""}system-ui, sans-serif;
|
|
226
226
|
}
|
|
227
227
|
${n?`body { text-align: right; }
|
|
228
|
-
`:""}`);break;default:break}}});var
|
|
228
|
+
`:""}`);break;default:break}}});var gd={};k(gd,{uiConfigurator:()=>$E});import cr from"node:path";var RE,$E,Dd=D(()=>{"use strict";W();RE={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"}},$E=async e=>{if(e.selections.ui==="none")return;let t=RE[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 v(cr.join(e.projectPath,`src/hero.${i}`),`import { heroui } from "@heroui/react";
|
|
229
229
|
|
|
230
|
-
export default heroui();`)}if(e.selections.ui==="shadcn"){let r=e.selections.variant.startsWith("ts"),i=r?"ts":"js";await x(
|
|
230
|
+
export default heroui();`)}if(e.selections.ui==="shadcn"){let r=e.selections.variant.startsWith("ts"),i=r?"ts":"js";await x(cr.join(e.projectPath,"src/lib")),await v(cr.join(e.projectPath,"src/lib",`utils.${i}`),`import { clsx, type ClassValue } from "clsx"
|
|
231
231
|
import { twMerge } from "tailwind-merge"
|
|
232
232
|
|
|
233
233
|
export function cn(...inputs: ClassValue[]) {
|
|
234
234
|
return twMerge(clsx(inputs))
|
|
235
235
|
}
|
|
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 v(
|
|
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 v(cr.join(e.projectPath,"components.json"),JSON.stringify(o,null,2)),await zt(cr.join(e.projectPath,"src/index.css"),`
|
|
237
237
|
@layer base {
|
|
238
238
|
:root {
|
|
239
239
|
--background: 0 0% 100%;
|
|
@@ -305,7 +305,7 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
305
305
|
@plugin "./hero.${e.selections.variant.startsWith("ts")?"ts":"js"}";
|
|
306
306
|
@source "../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}";
|
|
307
307
|
@custom-variant dark (&:is(.dark *));
|
|
308
|
-
`;await v(
|
|
308
|
+
`;await v(cr.join(e.projectPath,"src/index.css"),n)}}}});var lr,qn=D(()=>{"use strict";lr=(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 yd={};k(yd,{iconsConfigurator:()=>IE});var PE,IE,bd=D(()=>{"use strict";qn();PE={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"}},IE=lr("icons",PE)});var Cd={};k(Cd,{formsConfigurator:()=>jE});var NE,jE,Ed=D(()=>{"use strict";qn();NE={"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"}},jE=lr("forms",NE)});var wd={};k(wd,{stateConfigurator:()=>LE});var BE,LE,vd=D(()=>{"use strict";BE={zustand:{zustand:"^5.0.0"},redux:{"@reduxjs/toolkit":"^2.11.0","react-redux":"^9.2.0"},jotai:{jotai:"^2.17.0"}},LE=async e=>{if(e.selections.state==="none")return;let t=BE[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(()=>(W(),ou)),s=await import("node:path");await o(s.join(e.projectPath,"src/store"));let a=`import { configureStore } from '@reduxjs/toolkit'
|
|
309
309
|
import counterReducer from './counterSlice'
|
|
310
310
|
|
|
311
311
|
export const store = configureStore({
|
|
@@ -356,7 +356,7 @@ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
|
|
|
356
356
|
|
|
357
357
|
export const useAppDispatch = useDispatch
|
|
358
358
|
export const useAppSelector = useSelector
|
|
359
|
-
`;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 Sd={};k(Sd,{routingConfigurator:()=>ME});var ME,Fd=D(()=>{"use strict";ME=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 xd={};k(xd,{dataFetchingConfigurator:()=>UE});var UE,kd=D(()=>{"use strict";UE=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 Ad={};k(Ad,{animationConfigurator:()=>HE});var zE,HE,_d=D(()=>{"use strict";qn();zE={"framer-motion":{"framer-motion":"^12.0.0"},gsap:{gsap:"^3.14.2","@gsap/react":"^2.1.2"}},HE=lr("animation",zE)});var Td={};k(Td,{backendConfigurator:()=>JE});import Xe from"node:path";var WE,GE,VE,qE,YE,KE,ZE,JE,Od=D(()=>{"use strict";W();WE={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"}},GE=e=>`import { createClient } from '@supabase/supabase-js'
|
|
360
360
|
|
|
361
361
|
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
|
|
362
362
|
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY
|
|
@@ -366,7 +366,7 @@ if (!supabaseUrl || !supabaseAnonKey) {
|
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
|
369
|
-
`,
|
|
369
|
+
`,VE=e=>`import { initializeApp } from 'firebase/app'
|
|
370
370
|
import { getAuth } from 'firebase/auth'
|
|
371
371
|
import { getFirestore } from 'firebase/firestore'
|
|
372
372
|
|
|
@@ -382,7 +382,7 @@ const firebaseConfig = {
|
|
|
382
382
|
export const app = initializeApp(firebaseConfig)
|
|
383
383
|
export const auth = getAuth(app)
|
|
384
384
|
export const db = getFirestore(app)
|
|
385
|
-
`,
|
|
385
|
+
`,qE=e=>e?`import { ClerkProvider } from '@clerk/clerk-react'
|
|
386
386
|
|
|
387
387
|
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY
|
|
388
388
|
|
|
@@ -416,7 +416,7 @@ export function ClerkAuthProvider({ children }) {
|
|
|
416
416
|
</ClerkProvider>
|
|
417
417
|
)
|
|
418
418
|
}
|
|
419
|
-
`,
|
|
419
|
+
`,YE=e=>e?`import { PrismaClient } from '@prisma/client'
|
|
420
420
|
|
|
421
421
|
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
|
|
422
422
|
|
|
@@ -434,7 +434,7 @@ export const prisma = globalForPrisma.prisma || new PrismaClient()
|
|
|
434
434
|
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
|
435
435
|
|
|
436
436
|
export default prisma
|
|
437
|
-
`,
|
|
437
|
+
`,KE=`// Prisma Schema
|
|
438
438
|
// Learn more: https://pris.ly/d/prisma-schema
|
|
439
439
|
|
|
440
440
|
generator client {
|
|
@@ -454,7 +454,7 @@ model User {
|
|
|
454
454
|
createdAt DateTime @default(now())
|
|
455
455
|
updatedAt DateTime @updatedAt
|
|
456
456
|
}
|
|
457
|
-
`,
|
|
457
|
+
`,ZE={supabase:`
|
|
458
458
|
# Supabase Configuration
|
|
459
459
|
VITE_SUPABASE_URL=your-supabase-project-url
|
|
460
460
|
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key
|
|
@@ -472,7 +472,7 @@ VITE_CLERK_PUBLISHABLE_KEY=pk_test_your-publishable-key
|
|
|
472
472
|
`,prisma:`
|
|
473
473
|
# Database Connection (Prisma)
|
|
474
474
|
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
|
|
475
|
-
`},
|
|
475
|
+
`},JE=async e=>{let t=e.selections.backend;if(!t||t==="none")return;let r=WE[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(Xe.join(e.projectPath,"src/lib")),t==="supabase"&&await v(Xe.join(e.projectPath,"src/lib",`supabase.${n}`),GE(i)),t==="firebase"&&await v(Xe.join(e.projectPath,"src/lib",`firebase.${n}`),VE(i)),t==="clerk"&&(await x(Xe.join(e.projectPath,"src/providers")),await v(Xe.join(e.projectPath,"src/providers",`clerk.${o}`),qE(i))),t==="prisma"&&(await v(Xe.join(e.projectPath,"src/lib",`prisma.${n}`),YE(i)),await x(Xe.join(e.projectPath,"prisma")),await v(Xe.join(e.projectPath,"prisma","schema.prisma"),KE));let s=ZE[t];if(s){let a=Xe.join(e.projectPath,".env.example");await xe(a)?await zt(a,s):await v(a,`# Environment Variables${s}`)}}});var Rd={};k(Rd,{structureConfigurator:()=>QE});import XE from"node:path";var QE,$d=D(()=>{"use strict";W();QE=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=XE.join(e.projectPath,r);await x(i)}}});var Pd={};k(Pd,{mandatoryConfigurator:()=>iw});import{exec as ew}from"node:child_process";import Yn from"node:path";import{promisify as tw}from"node:util";var rw,iw,Id=D(()=>{"use strict";W();rw=tw(ew),iw=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 v(Yn.join(e.projectPath,"public","manifest.json"),JSON.stringify(r,null,2)),await v(Yn.join(e.projectPath,".gitignore"),`# Dependencies
|
|
476
476
|
node_modules
|
|
477
477
|
.pnp
|
|
478
478
|
.pnp.js
|
|
@@ -569,7 +569,7 @@ npm run dev
|
|
|
569
569
|
## License
|
|
570
570
|
|
|
571
571
|
MIT
|
|
572
|
-
`;await v(Yn.join(e.projectPath,"README.md"),n);try{await
|
|
572
|
+
`;await v(Yn.join(e.projectPath,"README.md"),n);try{await rw('git init && git add -A && git commit -m "Initial commit from NEXO"',{cwd:e.projectPath})}catch{}}});var Nd={};k(Nd,{aiInstructionsConfigurator:()=>gw});import Bt from"path";var oi,nw,sw,ow,aw,uw,cw,lw,pw,hw,mw,dw,fw,gw,jd=D(()=>{"use strict";st();oi=(e,t)=>`# ${t} - ${e.projectName}
|
|
573
573
|
|
|
574
574
|
## Project Overview
|
|
575
575
|
This is a **${e.framework}** application built with modern best practices and tools.
|
|
@@ -838,7 +838,7 @@ npm run lint # Lint code
|
|
|
838
838
|
- **Respect the project structure** - Place files in the correct directories
|
|
839
839
|
- **Write self-documenting code** - Clear names over comments when possible
|
|
840
840
|
- **Generate complete code** - No placeholders or incomplete implementations
|
|
841
|
-
`,
|
|
841
|
+
`,nw=e=>`# Cursor Rules for ${e.projectName}
|
|
842
842
|
|
|
843
843
|
You are an expert ${e.framework} developer working on this project.
|
|
844
844
|
|
|
@@ -880,7 +880,7 @@ ${e.hasTesting?"5. Write tests alongside features":""}
|
|
|
880
880
|
- Handle errors gracefully
|
|
881
881
|
- Consider accessibility
|
|
882
882
|
- Optimize for performance
|
|
883
|
-
`,
|
|
883
|
+
`,sw=e=>`# Windsurf Rules for ${e.projectName}
|
|
884
884
|
|
|
885
885
|
Project: ${e.framework} with ${e.variant}
|
|
886
886
|
Architecture: ${e.structure}
|
|
@@ -908,7 +908,7 @@ ${e.structure}
|
|
|
908
908
|
dev: npm run dev
|
|
909
909
|
build: npm run build
|
|
910
910
|
${e.hasTesting?"test: npm test":""}
|
|
911
|
-
`,
|
|
911
|
+
`,ow=e=>`# Cline Rules
|
|
912
912
|
|
|
913
913
|
## Project Details
|
|
914
914
|
- Framework: ${e.framework}
|
|
@@ -956,7 +956,7 @@ npm run dev # Development
|
|
|
956
956
|
npm run build # Production build
|
|
957
957
|
${e.hasTesting?"npm test # Run tests":""}
|
|
958
958
|
\`\`\`
|
|
959
|
-
`,
|
|
959
|
+
`,aw=e=>`# Roo-Cline Instructions for ${e.projectName}
|
|
960
960
|
|
|
961
961
|
## Project Configuration
|
|
962
962
|
- **Framework**: ${e.framework}
|
|
@@ -1041,7 +1041,7 @@ npm run lint \u2192 Lint code
|
|
|
1041
1041
|
- Keep code clean and well-organized
|
|
1042
1042
|
- Write self-documenting code
|
|
1043
1043
|
- Ask before introducing new patterns
|
|
1044
|
-
`,
|
|
1044
|
+
`,uw=e=>`# Aider configuration for ${e.projectName}
|
|
1045
1045
|
|
|
1046
1046
|
## Project Info
|
|
1047
1047
|
framework: ${e.framework}
|
|
@@ -1066,7 +1066,7 @@ ${e.structure}
|
|
|
1066
1066
|
dev: "npm run dev"
|
|
1067
1067
|
build: "npm run build"
|
|
1068
1068
|
${e.hasTesting?'test: "npm test"':""}
|
|
1069
|
-
`,
|
|
1069
|
+
`,cw=e=>oi(e,"Claude Development Instructions"),lw=e=>oi(e,"Gemini Development Instructions"),pw=e=>oi(e,"OpenAI Codex Instructions"),hw=e=>oi(e,"AI Development Instructions"),mw=e=>`---
|
|
1070
1070
|
description: React & UI Best Practices
|
|
1071
1071
|
globs: ["**/*.tsx", "**/*.jsx"]
|
|
1072
1072
|
---
|
|
@@ -1078,7 +1078,7 @@ globs: ["**/*.tsx", "**/*.jsx"]
|
|
|
1078
1078
|
${e.ui!=="none"?`- Use ${e.ui} components`:""}
|
|
1079
1079
|
- Implement error boundaries
|
|
1080
1080
|
- Use React.memo/useMemo/useCallback appropriately
|
|
1081
|
-
`,
|
|
1081
|
+
`,dw=e=>`---
|
|
1082
1082
|
description: TypeScript & Code Quality
|
|
1083
1083
|
globs: ["**/*.ts", "**/*.tsx"]
|
|
1084
1084
|
---
|
|
@@ -1088,7 +1088,7 @@ globs: ["**/*.ts", "**/*.tsx"]
|
|
|
1088
1088
|
- Explicit return types for exported functions
|
|
1089
1089
|
- Use interfaces for object definitions
|
|
1090
1090
|
- Strict null checks enabled
|
|
1091
|
-
`,
|
|
1091
|
+
`,fw=e=>`---
|
|
1092
1092
|
description: General Project Context & Architecture
|
|
1093
1093
|
globs: ["*"]
|
|
1094
1094
|
---
|
|
@@ -1103,46 +1103,46 @@ globs: ["*"]
|
|
|
1103
1103
|
${e.structure==="feature-based"?"Feature-based: src/features/[feature]":""}
|
|
1104
1104
|
${e.structure==="fsd"?"FSD Layers: app/pages/widgets/features/entities/shared":""}
|
|
1105
1105
|
${e.structure==="simple"?"Simple: components/hooks/utils":""}
|
|
1106
|
-
`,
|
|
1106
|
+
`,gw=async({projectPath:e,selections:t})=>{let r=t.aiInstructions||[],i={projectName:t.projectName||Bt.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=Bt.join(e,".nexo");if(await x(n),await v(Bt.join(n,"ai-context.md"),oi(i,"Project Context")),r.length===0)return;let o={cursor:{file:".cursorrules",generate:nw},"cursor-modular":{isModular:!0,generators:{".cursor/rules/react.mdc":mw,".cursor/rules/typescript.mdc":dw,".cursor/rules/general.mdc":fw}},windsurf:{file:".windsurfrules",generate:sw},cline:{file:".clinerules",generate:ow},"roo-cline":{file:".roo-clinerules",generate:aw},aider:{file:".aider.conf.yml",generate:uw},claude:{file:"CLAUDE_INSTRUCTIONS.md",generate:cw},gemini:{file:"GEMINI_INSTRUCTIONS.md",generate:lw},codex:{file:"CODEX_INSTRUCTIONS.md",generate:pw},universal:{file:"AI_INSTRUCTIONS.md",generate:hw}};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(Bt.dirname(Bt.join(e,u))),await v(Bt.join(e,u),c(i));else a.file&&a.generate&&await v(Bt.join(e,a.file),a.generate(i))}}});var Bd={};k(Bd,{testingConfigurator:()=>Dw});var Dw,Ld=D(()=>{"use strict";Dw=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 Md={};k(Md,{lintingConfigurator:()=>yw});var yw,Ud=D(()=>{"use strict";yw=async e=>{let{linting:t}=e.selections;!t||t==="none"||e.pkg&&(t==="eslint-prettier"?(e.pkg.add("eslint","^9.29.0",!0),e.pkg.add("prettier","^3.7.0",!0),e.pkg.add("eslint-plugin-react-hooks","^5.2.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 zd={};k(zd,{docsConfigurator:()=>Cw});import bw from"node:path";function Ew(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,Cw,Hd=D(()=>{"use strict";W();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"}},Cw=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 m=`# \u{1F4DA} Documentation Links
|
|
1107
1107
|
|
|
1108
1108
|
Quick reference to official documentation for your project stack.
|
|
1109
1109
|
|
|
1110
|
-
`;for(let[g,y]of Object.entries(h))y.length>0&&(
|
|
1111
|
-
`,y.forEach(w=>{
|
|
1112
|
-
`}),
|
|
1113
|
-
`);
|
|
1110
|
+
`;for(let[g,y]of Object.entries(h))y.length>0&&(m+=`## ${Ew(g)} ${g}
|
|
1111
|
+
`,y.forEach(w=>{m+=`- [${w.name}](${w.url})
|
|
1112
|
+
`}),m+=`
|
|
1113
|
+
`);m+=`---
|
|
1114
1114
|
Generated by NEXO CLI
|
|
1115
|
-
`,await v(
|
|
1115
|
+
`,await v(bw.join(e.projectPath,"DOCS.md"),m)}});var uu,au,Gd,Wd,Vd,qd,Yd=D(()=>{"use strict";uu={framework:{loader:()=>Promise.resolve().then(()=>(cd(),ud)),exportName:"frameworkConfigurator"},variant:{loader:()=>Promise.resolve().then(()=>(pd(),ld)),exportName:"variantConfigurator",dependencies:["framework"]},language:{loader:()=>Promise.resolve().then(()=>(md(),hd)),exportName:"languageConfigurator",dependencies:["variant"]},styling:{loader:()=>Promise.resolve().then(()=>(fd(),dd)),exportName:"stylingConfigurator",dependencies:["language"]},ui:{loader:()=>Promise.resolve().then(()=>(Dd(),gd)),exportName:"uiConfigurator",dependencies:["styling"],condition:e=>e.selections.ui!=="none"},icons:{loader:()=>Promise.resolve().then(()=>(bd(),yd)),exportName:"iconsConfigurator",dependencies:["language"],condition:e=>e.selections.icons!=="none"},forms:{loader:()=>Promise.resolve().then(()=>(Ed(),Cd)),exportName:"formsConfigurator",dependencies:["language"],condition:e=>e.selections.forms!=="none"},state:{loader:()=>Promise.resolve().then(()=>(vd(),wd)),exportName:"stateConfigurator",dependencies:["language"],condition:e=>e.selections.state!=="none"},routing:{loader:()=>Promise.resolve().then(()=>(Fd(),Sd)),exportName:"routingConfigurator",dependencies:["language"],condition:e=>e.selections.routing!=="none"},dataFetching:{loader:()=>Promise.resolve().then(()=>(kd(),xd)),exportName:"dataFetchingConfigurator",dependencies:["language"],condition:e=>e.selections.dataFetching!=="none"},animation:{loader:()=>Promise.resolve().then(()=>(_d(),Ad)),exportName:"animationConfigurator",dependencies:["language"],condition:e=>e.selections.animation!==void 0&&e.selections.animation!=="none"},backend:{loader:()=>Promise.resolve().then(()=>(Od(),Td)),exportName:"backendConfigurator",dependencies:["language"],condition:e=>e.selections.backend!==void 0&&e.selections.backend!=="none"},structure:{loader:()=>Promise.resolve().then(()=>($d(),Rd)),exportName:"structureConfigurator",dependencies:["language"]},mandatory:{loader:()=>Promise.resolve().then(()=>(Id(),Pd)),exportName:"mandatoryConfigurator",dependencies:["styling","structure"]},"ai-instructions":{loader:()=>Promise.resolve().then(()=>(jd(),Nd)),exportName:"aiInstructionsConfigurator",dependencies:["language"],condition:e=>{let t=e.selections.aiInstructions;return t!==void 0&&t.length>0}},testing:{loader:()=>Promise.resolve().then(()=>(Ld(),Bd)),exportName:"testingConfigurator",dependencies:["mandatory"],condition:e=>e.selections.testing!==void 0&&e.selections.testing!=="none"},linting:{loader:()=>Promise.resolve().then(()=>(Ud(),Md)),exportName:"lintingConfigurator",dependencies:["mandatory"],condition:e=>e.selections.linting!==void 0&&e.selections.linting!=="none"},docs:{loader:()=>Promise.resolve().then(()=>(Hd(),zd)),exportName:"docsConfigurator",dependencies:["mandatory"]}},au=new Map,Gd=async(e,t={})=>{let r=uu[e];if(!r)return console.warn(`Unknown configurator: ${e}`),null;let{cache:i=!0}=t,n=e;if(i&&au.has(n)){let o=au.get(n);return Wd(o,r.exportName||e)}try{let o=await r.loader();return i&&au.set(n,o),Wd(o,r.exportName||e)}catch(o){return console.error(`Failed to load configurator "${e}":`,o),null}},Wd=(e,t)=>{if(e[t])return e[t];if(e.default)return e.default;let r=`${t}Configurator`;return e[r]?e[r]:null},Vd=e=>{let t=[];for(let[r,i]of Object.entries(uu))i.condition&&!i.condition(e)||t.push(r);return t},qd=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=uu[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 cu from"node:path";var ai,lu=D(()=>{"use strict";W();ai=async(e,t)=>{let r=cu.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="",m="<App />";s==="react-router"?(l.push("import { createBrowserRouter, RouterProvider } from 'react-router-dom'"),h=`
|
|
1116
1116
|
const router = createBrowserRouter([
|
|
1117
1117
|
{
|
|
1118
1118
|
path: "*",
|
|
1119
1119
|
element: <App />,
|
|
1120
1120
|
}
|
|
1121
|
-
]);`,
|
|
1121
|
+
]);`,m="<RouterProvider router={router} />"):s==="tanstack-router"&&(l.push("import { RouterProvider, createRouter, createRootRoute } from '@tanstack/react-router'"),h=`
|
|
1122
1122
|
const rootRoute = createRootRoute({
|
|
1123
1123
|
component: App,
|
|
1124
1124
|
});
|
|
1125
1125
|
|
|
1126
1126
|
const router = createRouter({ routeTree: rootRoute });
|
|
1127
|
-
${
|
|
1127
|
+
${u?`
|
|
1128
1128
|
declare module '@tanstack/react-router' {
|
|
1129
1129
|
interface Register {
|
|
1130
1130
|
router: typeof router
|
|
1131
1131
|
}
|
|
1132
|
-
}`:""}`,
|
|
1133
|
-
`);
|
|
1132
|
+
}`:""}`,m="<RouterProvider router={router} />");let g=l.join(`
|
|
1133
|
+
`);g+=`
|
|
1134
1134
|
|
|
1135
|
-
`,
|
|
1136
|
-
`),
|
|
1137
|
-
`,
|
|
1135
|
+
`,a==="tanstack-query"&&(g+=`const queryClient = new QueryClient()
|
|
1136
|
+
`),g+=h+`
|
|
1137
|
+
`,g+=`createRoot(document.getElementById('root')${u?"!":""}).render(
|
|
1138
1138
|
<StrictMode>
|
|
1139
|
-
`,
|
|
1140
|
-
`),
|
|
1141
|
-
`,[...
|
|
1142
|
-
`),
|
|
1139
|
+
`,p.forEach(y=>g+=` ${y.start}
|
|
1140
|
+
`),g+=` ${m}
|
|
1141
|
+
`,[...p].reverse().forEach(y=>g+=` ${y.end}
|
|
1142
|
+
`),g+=` </StrictMode>,
|
|
1143
1143
|
)
|
|
1144
|
-
`,await v(
|
|
1145
|
-
`)}});import
|
|
1144
|
+
`,await v(cu.join(r,`main.${t}`),g),u&&await v(cu.join(r,"vite-env.d.ts"),`/// <reference types="vite/client" />
|
|
1145
|
+
`)}});import Kd from"node:path";var de,ww,vw,Sw,Kn,pu,hu=D(()=>{"use strict";W();de={"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}"},ww=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:de["React 19"]??"\u269B\uFE0F"},{name:"Vite",icon:de.Vite??"\u26A1"}];t.includes("ts")&&p.push({name:"TypeScript",icon:de.TypeScript??"\u{1F537}"}),t.includes("compiler")&&p.push({name:"React Compiler",icon:de["React Compiler"]??"\u{1F680}"}),t.includes("swc")&&p.push({name:"SWC",icon:de.SWC??"\u{1F980}"});let h={tailwind:"Tailwind CSS","css-modules":"CSS Modules"};if(h[r]){let C=h[r];p.push({name:C,icon:de[C]??"\u{1F3A8}"})}let m={shadcn:"shadcn/ui",radix:"Radix UI",heroui:"HeroUI",antd:"Ant Design",chakra:"Chakra UI"};if(i&&i!=="none"&&m[i]){let C=m[i];p.push({name:C,icon:de[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:de[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:de[C]??"\u{1F4E6}"})}let w={"tanstack-query":"TanStack Query",axios:"Axios",fetch:"Fetch API"};if(a&&a!=="none"&&w[a]){let C=w[a];p.push({name:C,icon:de[C]??"\u{1F4E6}"})}let N={"rhf-zod":"React Hook Form + Zod","rhf-yup":"React Hook Form + Yup","tanstack-form":"TanStack Form"};if(n&&n!=="none"&&N[n]){let C=N[n];p.push({name:C,icon:de[C]??"\u{1F4DD}"})}if(u){let C=u==="vitest"?"Vitest":"Jest";p.push({name:C,icon:de[C]??"\u{1F9EA}"})}if(c){let C=c==="biome"?"Biome":"ESLint + Prettier";p.push({name:C,icon:de[C]??"\u2728"})}if(l){let C=l==="framer-motion"?"Framer Motion":"React Spring";p.push({name:C,icon:de[C]??"\u{1F3AC}"})}return p},vw=(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}]
|
|
1146
1146
|
|
|
1147
1147
|
function App() {
|
|
1148
1148
|
return (
|
|
@@ -1239,7 +1239,7 @@ function App() {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
|
|
1241
1241
|
export default App
|
|
1242
|
-
`},
|
|
1242
|
+
`},Sw=(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'
|
|
1243
1243
|
|
|
1244
1244
|
const techStack = [${i}]
|
|
1245
1245
|
|
|
@@ -1295,7 +1295,7 @@ function App() {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
|
|
1297
1297
|
export default App
|
|
1298
|
-
`},Kn=e=>{let{projectName:t,styling:r,rtl:i}=e.selections,n=
|
|
1298
|
+
`},Kn=e=>{let{projectName:t,styling:r,rtl:i}=e.selections,n=ww(e),o=r==="tailwind",s=i===!0;return o?vw(t,n,s):Sw(t,n,s)},pu=async(e,t)=>{let r=Kd.join(e.projectPath,"src"),i=Kn(e);await v(Kd.join(r,`App.${t}`),i)}});import Zd from"node:path";var Fw,Zn,mu=D(()=>{"use strict";W();Fw=e=>`
|
|
1299
1299
|
:root {
|
|
1300
1300
|
--bg-dark: #0a0a0a;
|
|
1301
1301
|
--text-white: #ffffff;
|
|
@@ -1488,7 +1488,7 @@ code {
|
|
|
1488
1488
|
color: #525252;
|
|
1489
1489
|
font-size: 0.875rem;
|
|
1490
1490
|
}
|
|
1491
|
-
`,Zn=async e=>{let{styling:t}=e.selections;if(t!=="tailwind"){let r=
|
|
1491
|
+
`,Zn=async e=>{let{styling:t}=e.selections;if(t!=="tailwind"){let r=Zd.join(e.projectPath,"src");await v(Zd.join(r,"App.css"),Fw(e.selections.rtl===!0))}}});import xw from"node:path";var Jd,Xd=D(()=>{"use strict";W();lu();hu();lu();mu();hu();Jd=async e=>{let{variant:t}=e.selections,i=t.startsWith("ts")?"tsx":"jsx",n=xw.join(e.projectPath,"src");await x(n),await ai(e,i),await pu(e,i)}});import kw from"node:path";function Aw(e){return{tailwind:"Tailwind CSS","css-modules":"CSS Modules"}[e]||e}function _w(e){return{shadcn:"shadcn/ui",heroui:"HeroUI",chakra:"Chakra UI",antd:"Ant Design"}[e]||e}function Tw(e){return{redux:"Redux Toolkit",zustand:"Zustand",jotai:"Jotai"}[e]||e}function Ow(e){return{"react-router":"React Router","tanstack-router":"TanStack Router"}[e]||e}function Rw(e){return{"tanstack-query":"TanStack Query",axios:"Axios"}[e]||e}var Qd,ef=D(()=>{"use strict";W();Qd=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}
|
|
1492
1492
|
|
|
1493
1493
|
Built with **NEXO CLI** \u{1F680}
|
|
1494
1494
|
|
|
@@ -1496,12 +1496,12 @@ Built with **NEXO CLI** \u{1F680}
|
|
|
1496
1496
|
|
|
1497
1497
|
- **Framework**: React 19 + Vite 6
|
|
1498
1498
|
- **Language**: ${r.includes("ts")?"TypeScript":"JavaScript"}
|
|
1499
|
-
- **Styling**: ${
|
|
1500
|
-
${n!=="none"?`- **UI Library**: ${
|
|
1501
|
-
${o!=="none"?`- **State Management**: ${
|
|
1502
|
-
${s!=="none"?`- **Routing**: ${
|
|
1503
|
-
${a!=="none"?`- **Data Fetching**: ${
|
|
1504
|
-
${
|
|
1499
|
+
- **Styling**: ${Aw(i)}
|
|
1500
|
+
${n!=="none"?`- **UI Library**: ${_w(n)}`:""}
|
|
1501
|
+
${o!=="none"?`- **State Management**: ${Tw(o)}`:""}
|
|
1502
|
+
${s!=="none"?`- **Routing**: ${Ow(s)}`:""}
|
|
1503
|
+
${a!=="none"?`- **Data Fetching**: ${Rw(a)}`:""}
|
|
1504
|
+
${u?`- **Testing**: ${u}`:""}
|
|
1505
1505
|
|
|
1506
1506
|
## \u{1F680} Getting Started
|
|
1507
1507
|
|
|
@@ -1512,57 +1512,57 @@ ${c?`- **Testing**: ${c}`:""}
|
|
|
1512
1512
|
|
|
1513
1513
|
2. **Start the dev server**:
|
|
1514
1514
|
\`\`\`bash
|
|
1515
|
-
${
|
|
1515
|
+
${c} dev
|
|
1516
1516
|
\`\`\`
|
|
1517
1517
|
|
|
1518
1518
|
3. **Build for production**:
|
|
1519
1519
|
\`\`\`bash
|
|
1520
|
-
${
|
|
1520
|
+
${c} build
|
|
1521
1521
|
\`\`\`
|
|
1522
1522
|
|
|
1523
|
-
`;i==="tailwind"&&(
|
|
1523
|
+
`;i==="tailwind"&&(p+=`## \u{1F3A8} Styling (Tailwind CSS v4)
|
|
1524
1524
|
This project uses Tailwind CSS v4.
|
|
1525
1525
|
- Configuration is handled in \`vite.config.ts\` via \`@tailwindcss/vite\`.
|
|
1526
1526
|
- ${n==="shadcn"||n==="heroui"?"Includes extensions for UI library.":"Standard configuration."}
|
|
1527
1527
|
|
|
1528
|
-
`),n==="shadcn"&&(
|
|
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
|
|
1529
1529
|
Run unit tests:
|
|
1530
1530
|
\`\`\`bash
|
|
1531
|
-
${
|
|
1531
|
+
${c} test:run
|
|
1532
1532
|
\`\`\`
|
|
1533
1533
|
|
|
1534
|
-
`),
|
|
1534
|
+
`),p+=`## \u{1F4C4} License
|
|
1535
1535
|
|
|
1536
1536
|
This project is licensed under the MIT License.
|
|
1537
|
-
`,await v(_w.join(e.projectPath,"README.md"),h)}});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
|
-
${
|
|
1539
|
-
${
|
|
1540
|
-
${
|
|
1541
|
-
${
|
|
1542
|
-
`);let u=await
|
|
1537
|
+
`,await v(kw.join(e.projectPath,"README.md"),p)}});var tf={};k(tf,{createAppCss:()=>Zn,createEntryFiles:()=>Jd,createMainFile:()=>ai,createReadme:()=>Qd,createStyles:()=>Zn,createWelcomePage:()=>Kn});var rf=D(()=>{"use strict";Xd();mu();ef()});import $w from"node:path";var du,Pw,Iw,Nw,Jn,fu=D(()=>{"use strict";W();bt();Yd();du=async(e,t)=>{let r=await Gd(e);r&&await r(t)},Pw=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 du(i,t),o.succeed()}catch(s){throw o.fail(),s}}},Iw=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=>du(p,t)));else for(let p of l)await du(p,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)},Nw=async e=>{let{createEntryFiles:t,createReadme:r,createStyles:i}=await Promise.resolve().then(()=>(rf(),tf));await t(e),await i(e),await r(e)},Jn=async({selections:e,targetDir:t,parallel:r=!0})=>{let i=Je("Initializing..."),n=$w.resolve(t,e.projectName),{PackageManager:o}=await Promise.resolve().then(()=>(En(),ya)),s=new o(n);i.stop();let a={projectPath:n,selections:e,pkg:s};await s.load(a),await Ti(a);let u=Vd(a),c=qd(u);r?await Iw(c,a):await Pw(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 Nw(a),l.succeed();let p=Je("Resolving latest dependencies...");try{await s.resolveLatestVersions(),p.succeed()}catch(h){p.fail("Unable to resolve latest versions (using fallback)"),d.dim(` ${h instanceof Error?h.message:"Unknown error"}`)}await s.save()}});var gu,Xn,Du=D(()=>{"use strict";gu=class e{static instance;isLearningMode=!1;isDebugMode=!1;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}},Xn=gu.getInstance()});function nf(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 sf=D(()=>{"use strict";Is()});var X,of,af,uf=D(()=>{"use strict";X={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},of=e=>{let t=0;return t+=X.react||0,t+=X["react-dom"]||0,e.ui==="shadcn"&&(t+=(X["class-variance-authority"]||0)+(X.clsx||0)+(X["tailwind-merge"]||0)),e.state==="zustand"?t+=X.zustand||0:e.state==="redux"?t+=(X["@reduxjs/toolkit"]||0)+(X["react-redux"]||0):e.state==="jotai"&&(t+=X.jotai||0),e.routing==="react-router"?t+=X["react-router-dom"]||0:e.routing==="tanstack-router"&&(t+=X["@tanstack/react-router"]||0),e.dataFetching==="tanstack-query"?t+=X["@tanstack/react-query"]||0:e.dataFetching==="axios"&&(t+=X.axios||0),e.forms?.includes("rhf")&&(t+=X["react-hook-form"]||0,e.forms.includes("zod")&&(t+=(X.zod||0)+(X["@hookform/resolvers"]||0))),e.icons==="lucide"&&(t+=X["lucide-react"]||0),Number(t.toFixed(1))},af=e=>e>=1024?`${(e/1024).toFixed(2)} MB`:`${e} kB`});var lf={};k(lf,{corePrompts:()=>pr,dataFetchingPrompt:()=>Su,formsPrompt:()=>Eu,iconsPrompt:()=>Fu,packageManagerPrompt:()=>jw,routingPrompt:()=>vu,statePrompt:()=>wu,structurePrompt:()=>cf,stylingPrompt:()=>bu,uiPrompt:()=>Cu,variantPrompt:()=>yu});var jw,yu,bu,Cu,Eu,wu,vu,Su,Fu,cf,pr,Qn=D(()=>{"use strict";jw={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"}]},yu={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"}]},bu={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"}]},Cu={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"}]},Eu={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"}]},wu={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"}]},vu={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"}]},Su={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"}]},Fu={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"}]},cf={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"]}]},pr=[yu,bu,Cu,Eu,wu,vu,Su,Fu]});var ui,pf,Bw,hf,Lw,Mw,xu,ku=D(()=>{"use strict";ui={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.)"}]},pf={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"}]},Bw={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"}]},hf={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"}]},Lw={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"}]},Mw={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"}]},xu={"ai-instructions":Lw,testing:pf,linting:Bw,animation:hf,backend:Mw}});var mf=D(()=>{"use strict"});var kk,df=D(()=>{"use strict";Qn();ku();mf();Qn();ku();kk=[...pr,ui]});var ff=D(()=>{"use strict";df()});var _u={};k(_u,{deletePreset:()=>Gw,getPreset:()=>Ww,loadPresets:()=>es,savePreset:()=>Hw});import hr from"node:fs/promises";import Uw from"node:os";import gf from"node:path";var Au,zw,es,Hw,Ww,Gw,Tu=D(()=>{"use strict";Au=()=>{let e=Uw.homedir();return gf.join(e,".nexo","presets.json")},zw=async e=>{let t=gf.dirname(e);try{await hr.access(t)}catch{await hr.mkdir(t,{recursive:!0})}},es=async()=>{let e=Au();try{await hr.access(e);let t=await hr.readFile(e,"utf-8");return JSON.parse(t)}catch{return[]}},Hw=async(e,t)=>{let r=Au();await zw(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 hr.writeFile(r,JSON.stringify(i,null,2))},Ww=async e=>(await es()).find(r=>r.name===e),Gw=async e=>{let t=Au(),i=(await es()).filter(n=>n.name!==e);await hr.writeFile(t,JSON.stringify(i,null,2))}});import Df from"node:fs/promises";import Vw from"node:path";async function yf(e,t){let r=Vw.resolve(t,e);if(!await Ws(r)){let s=await Gs(r),a="";s&&(a=`
|
|
1538
|
+
${V.default.bold("Previous Configuration Found:")}
|
|
1539
|
+
${V.default.dim("\u2022 Framework:")} ${s.framework||"Unknown"}
|
|
1540
|
+
${V.default.dim("\u2022 Language:")} ${s.variant==="ts"?"TypeScript":"JavaScript"}
|
|
1541
|
+
${V.default.dim("\u2022 Styling:")} ${s.styling||"Unknown"}
|
|
1542
|
+
`);let u=await ze({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 fe({message:`Are you sure you want to clear "${e}"? This action cannot be undone.`});if(O(c)||!c)return null;await Df.rm(r,{recursive:!0,force:!0}),await Df.mkdir(r,{recursive:!0})}}let{loadPresets:i,deletePreset:n}=await Promise.resolve().then(()=>(Tu(),_u)),o=await i();if(o.length>0){let s=await ze({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 ze({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 fe({message:`Delete preset "${u}"?`,initialValue:!1});!O(c)&&c&&(await n(u),o=await i(),et.success(`Deleted preset "${u}"`))}}}else if(s!=="none"){let a=o.find(u=>u.name===s);if(a)return le(`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(),Zp));s.packageManager=a();for(let E of pr){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
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
1544
|
CSS Modules provide scoped CSS to avoid global conflicts.`):E.name==="state"?ts(`Local state (useState) is sufficient for simple apps.
|
|
1545
1545
|
Zustand is a lightweight, scalable global state manager.
|
|
1546
|
-
Redux is powerful but has more boilerplate.`):E.name==="dataFetching"&&ts("TanStack Query (React Query) handles caching, deduplication, and background updates automatically.");let
|
|
1547
|
-
`),"\u{1F4C1} Folders")}let u=await
|
|
1548
|
-
`),"\u{1F4C1} Folders");let
|
|
1549
|
-
`),"\u{1F4CB} Summary");let w=await
|
|
1550
|
-
`),
|
|
1546
|
+
Redux is powerful but has more boilerplate.`):E.name==="dataFetching"&&ts("TanStack Query (React Query) handles caching, deduplication, and background updates automatically.");let q=E.options.map(ve=>({value:ve.value,label:ve.name,hint:ve.hover_note})),j=await ze({message:E.message,options:q});if(O(j))return null;s[E.name]=j,E.name==="styling"&&j==="tailwind"?Me(["tailwindcss","postcss","autoprefixer"]):E.name==="ui"?(j==="heroui"&&Me(["@heroui/react","framer-motion"]),j==="chakra"&&Me(["@chakra-ui/react","@emotion/react","@emotion/styled"]),j==="antd"&&Me(["antd"]),j==="mui"&&Me(["@mui/material","@emotion/react","@emotion/styled"])):E.name==="dataFetching"&&j==="tanstack-query"&&Me(["@tanstack/react-query"]);let Ct=E.options.find(ve=>ve.value===j);Ct?.folder_info&&le(Ct.folder_info.join(`
|
|
1547
|
+
`),"\u{1F4C1} Folders")}let u=await $s({message:"Select optional features (Space to select):",options:ui.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 q=xu[E];if(q){let j=q.options.map(ve=>({value:ve.value,label:ve.name,hint:ve.hover_note})),Ct=q.type==="checkbox"?await $s({message:q.message,options:j,required:!1}):await ze({message:q.message,options:j});if(O(Ct))return null;s[E]=Ct}}let c=await fe({message:"Do you want to configure import alias (@/*)?",initialValue:!0});if(O(c))return null;let{structurePrompt:l}=await Promise.resolve().then(()=>(Qn(),lf)),p=await ze({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&&le(h.folder_info.join(`
|
|
1548
|
+
`),"\u{1F4C1} Folders");let m={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=of(m),y=[`Project: ${V.default.cyan(s.projectName)}`,`Framework: ${V.default.cyan("react")}`,`Variant: ${V.default.cyan(s.variant)}`,`Styling: ${V.default.cyan(s.styling)}`,`UI Library: ${V.default.cyan(s.ui)}`,`Forms: ${V.default.cyan(s.forms)}`,`State: ${V.default.cyan(s.state)}`,`Routing: ${V.default.cyan(s.routing)}`,`Import Alias: ${V.default.cyan(c?"@/*":"None")}`,`Bundle Est.: ${V.default.green(af(g))} ${V.default.dim("(Initial JS)")}`];le(y.join(`
|
|
1549
|
+
`),"\u{1F4CB} Summary");let w=await fe({message:"Create project with these settings?"});if(O(w))return null;if(!w){let E=await fe({message:"Restart from beginning?",initialValue:!0});if(O(E)||!E)return null;console.clear(),Ci(V.default.bgCyan(V.default.black(" NEXO (Restarted) ")));continue}let N=await fe({message:`Install dependencies now? ${V.default.dim("(Recommended)")}`,initialValue:!0});if(O(N))return null;let C=s.variant,ne={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:N,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},se=await fe({message:"Save this configuration as a preset?",initialValue:!1});if(!O(se)&&se){let E=await Ut({message:"Preset name:",placeholder:"my-stack",validate:q=>{if(!q)return"Please enter a name"}});if(!O(E)){let{savePreset:q}=await Promise.resolve().then(()=>(Tu(),_u));await q(E,ne),le(`Configuration saved as "${E}"`,"\u2728 Preset Saved")}}return ne}}var V,ts,bf=D(()=>{"use strict";gr();V=G(oe(),1);uf();ff();Du();W();zn();ts=(e,t="\u{1F4A1} Educational Context")=>{Xn.isLearningMode&&le(e,t)}});var Cf={};k(Cf,{createAction:()=>qw});import rs from"node:path";async function qw(e,t){ur(),t.learn&&(Xn.isLearningMode=!0),t.silent&&(console.log=()=>{},console.error=()=>{},console.warn=()=>{}),d.dim(` NEXO is a next-generation, extensible CLI for scaffolding and orchestrating modern frontend projects
|
|
1550
|
+
`),d.print(wi),Ci(A.default.bgCyan(A.default.black(" NEXO "))),await Pe.load();try{let r=e;r||(r=await Ut({message:"Where should the project be created? (name, path, or . for current):",placeholder:"my-app",defaultValue:".",validate:l=>{}})),O(r)&&(Fe("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=nf(t.preset,n),o||(d.error(`Invalid preset: "${t.preset}". Available items: ${Object.keys(Dr).join(", ")}`),process.exit(1)),d.info(`Using preset: ${A.default.cyan(t.preset.toLowerCase())}`)):o=await yf(n,t.dir),o&&t.rtl!==void 0&&(o.rtl=t.rtl),o||(Fe("Operation cancelled."),process.exit(0)),t.dryRun){Yw(o,t.dir);return}let s=Date.now(),a=rs.resolve(t.dir,o.projectName),u=t.template||da(t.preset||"");if(u?await Kw(u,a,o):await Jn({selections:o,targetDir:t.dir,parallel:t.parallel}),o.installDependencies){let l=Cc(),p=performance.now();l.start("Installing dependencies...");try{let h=o.packageManager||"npm",m=Nt(h,{audit:t.audit,strict:t.strict}),[g,...y]=m.split(" "),{execa:w}=await Promise.resolve().then(()=>(ri(),Xm));await w(g,y,{cwd:a,stdio:"ignore"});let N=((performance.now()-p)/1e3).toFixed(2);l.stop(A.default.green(`\u2714 Dependencies installed successfully in ${N}s!`));let{prefetchedStats:C}=await Promise.resolve().then(()=>(zn(),Qm));C.successCount>0?(d.newline(),d.dim(" \u{1F4E6} Prefetch Summary:"),d.print(` ${A.default.green("\u2713")} Cached: ${C.successCount} packages`),d.dim(" \u26A1 Speed boost active for next runs")):C.failCount>0}catch{l.stop(A.default.red("\u2716 Failed to install dependencies.")),d.warn("You can try installing manually.")}}let c=((Date.now()-s)/1e3).toFixed(2);fr(A.default.green(`\u2728 Project created successfully in ${c}s!`)),Zw(o,t)}catch(r){Fe("Error creating project"),jc(r,{projectName:e||"unknown"}),process.exit(1)}finally{await Pe.save()}}function Yw(e,t){d.newline(),d.header("DRY RUN MODE","warning"),d.warn("No files will be created."),d.newline();let r=Ht(e);le(r,"\u{1F4C2} Files that would be created"),fr(A.default.cyan("Dry run complete. Run without --dry-run to create the project."))}async function Kw(e,t,r){await ma(e,t);let{PackageManager:i}=await Promise.resolve().then(()=>(En(),ya)),n=new i(t);await n.load({projectPath:t,selections:r,pkg:n}),n.set("name",r.projectName),await n.save()}function Zw(e,t){let r=e.packageManager||"npm",i=t.audit===!0,n=t.strict===!0,o=Nt(r,{audit:i,strict:n}),s=`${r} run dev`;d.newline(),d.print(A.default.bold(A.default.cyan(" \u{1F680} Next Steps:"))),d.newline(),d.print(` ${A.default.dim("1.")} cd ${A.default.cyan(e.projectName)}`),d.newline(),e.installDependencies?(d.newline(),d.print(` ${A.default.dim("2.")} ${A.default.white(s)}`)):(r==="npm"&&!i&&!n&&d.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)")}`),d.print(` ${A.default.dim("2.")} ${A.default.white(o)}`),r==="npm"&&!i&&!n&&(d.newline(),d.print(` ${A.default.blue("\u{1F6E1}\uFE0F")} ${A.default.dim("Standard install (Secure & verified)")}`),d.print(` ${A.default.white("npm install")}`)),d.newline(),d.print(` ${A.default.dim("3.")} ${A.default.white(s)}`)),d.newline(),d.print(` ${A.default.magenta(A.default.bold("Happy coding!"))} ${A.default.dim("\u2014")} ${A.default.cyan("NEXO CLI")}`),d.newline()}var A,Ef=D(()=>{"use strict";gr();A=G(oe(),1);Ps();Is();fu();Du();Cr();Hs();W();bt();sf();bf()});var Wu=G(Hu(),1),{program:pv,createCommand:hv,createArgument:mv,createOption:dv,CommanderError:fv,InvalidArgumentError:gv,InvalidOptionArgumentError:Dv,Command:Gu,Argument:yv,Option:bv,Help:Cv}=Wu.default;import{createRequire as ev}from"node:module";var wf={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(()=>(Ef(),Cf));return r(e,t)}};ri();var vf=G(oe(),1);st();bt();import is from"node:path";async function Jw(){d.cyan(`
|
|
1551
1551
|
\u{1F5A5}\uFE0F System Environment
|
|
1552
|
-
`);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 ue("npm",["--version"]);return r.trim()}},{name:"Git",check:async()=>{let{stdout:r}=await ue("git",["--version"]);return r.trim().replace("git version ","")}},{name:"Git User",check:async()=>{try{let r=(await ue("git",["config","user.name"])).stdout.trim(),i=(await ue("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();d.success(` \u2713 ${r}: ${n}`)}catch{t=!1,d.error(` \u2717 ${r}: Not found or error`)}return t}async function Xw(){d.cyan(`
|
|
1553
1553
|
\u{1F4E6} Project Health
|
|
1554
|
-
`);let e=process.cwd();if(!await
|
|
1554
|
+
`);let e=process.cwd();if(!await xe(is.join(e,"package.json")))return d.error("No package.json found. Run this in a project root."),!1;let t=!0;try{let r=await nt({projectPath:e});d.info(`Project: ${vf.default.bold(r.name||"unnamed")} v${r.version||"0.0.0"}`),d.newline(),d.dim("Running security audit...");try{let{stdout:a}=await ue("npm",["audit","--json"],{reject:!1}),c=JSON.parse(a).metadata?.vulnerabilities||{},l=Object.values(c).reduce((p,h)=>p+h,0);l===0?d.success("\u2713 Security: No known vulnerabilities found."):(t=!1,d.warn(`\u26A0\uFE0F Security: Found ${l} vulnerabilities.`),(c.high||c.critical)&&d.error(` Critical: ${c.critical||0}, High: ${c.high||0}`),d.dim(' Run "npm audit fix" to resolve.'))}catch{d.warn("Could not complete security audit.")}d.newline(),d.dim("Checking best practices..."),await xe(is.join(e,"package-lock.json"))||await xe(is.join(e,"yarn.lock"))||await xe(is.join(e,"pnpm-lock.yaml"))?d.success("\u2713 Lockfile present"):(t=!1,d.warn("\u26A0\uFE0F No lockfile found (package-lock.json, yarn.lock, etc).")),r.scripts&&(r.scripts.test?d.success("\u2713 Test script found"):d.warn("\u25CB No test script defined"),r.scripts.lint?d.success("\u2713 Lint script found"):d.warn("\u25CB No lint script defined")),d.newline(),d.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?(d.info(`\u2139\uFE0F Detected heavy dependencies: ${s.join(", ")}`),d.dim(" Consider using light-weight alternatives or tree-shaking.")):d.success("\u2713 No obviously heavy dependencies detected.")}catch(r){t=!1,d.error("Health check failed: "+(r instanceof Error?r.message:String(r)))}return t}var Sf={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=>{d.cyan(`
|
|
1555
1555
|
\u{1FA7A} NEXO Health Check
|
|
1556
|
-
`);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 Jw()),r&&(n=await Xw()),d.newline(),i&&n?d.success("\u2728 All checks passed! System is ready for NEXO."):d.warn("\u26A0\uFE0F Some checks failed. Review the issues above."),d.newline()}};bt();var Ff={name:"presets",description:"List available project presets",action:async()=>{d.cyan(`
|
|
1557
1557
|
\u{1F4E6} Available Presets:
|
|
1558
|
-
`),
|
|
1559
|
-
`)}};
|
|
1560
|
-
\u{1F50D} Dry Run - Would update to: v${r}`),
|
|
1561
|
-
\u2728 NEXO CLI updated to v${r}!`)}catch(t){
|
|
1562
|
-
`),
|
|
1558
|
+
`),d.dim(" saas - Full-stack SaaS with auth and API"),d.dim(" dashboard - Admin dashboard with charts"),d.dim(" landing - Fast, SEO-optimized marketing page"),d.dim(" minimal - Bare-bones React + TypeScript"),d.newline(),d.dim(`Usage: nexo create my-app --preset=saas
|
|
1559
|
+
`)}};ri();bt();var xf={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=>{d.info("Checking for updates...");try{let{stdout:t}=await ue("npm",["view","create-nexo","version"]),r=t.trim();if(d.info(`Latest version: ${r}`),e.dryRun){d.cyan(`
|
|
1560
|
+
\u{1F50D} Dry Run - Would update to: v${r}`),d.dim(" Run without --dry-run to perform the update."),d.newline();return}d.info("Updating NEXO CLI..."),await ue("npm",["install","-g","create-nexo@latest"],{stdio:"inherit"}),d.success(`
|
|
1561
|
+
\u2728 NEXO CLI updated to v${r}!`)}catch(t){d.error("Failed to update NEXO CLI."),t instanceof Error&&d.dim(t.message)}}};gr();var T=G(oe(),1);Ps();fu();gr();var ns=G(oe(),1);bt();var kf={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"]}},Qw=e=>e.map(t=>` ${ns.default.green("\u2713")} ${t}`).join(`
|
|
1562
|
+
`),Af=async()=>{d.print(ns.default.cyan(`
|
|
1563
1563
|
\u{1F9D9} Welcome to NEXO Wizard!
|
|
1564
|
-
`)),
|
|
1565
|
-
`);let e=await
|
|
1564
|
+
`)),d.dim(`Let me help you set up your project.
|
|
1565
|
+
`);let e=await Ut({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 Fe("Wizard cancelled."),null;let t=await ze({message:"What are you building?",options:Object.entries(kf).map(([a,u])=>({value:a,label:`${u.icon} ${u.name}`,hint:u.description}))});if(O(t))return Fe("Wizard cancelled."),null;let r=kf[t];console.log(),le(`${ns.default.bold("Recommended stack for "+r.name+":")}
|
|
1566
1566
|
|
|
1567
|
-
${
|
|
1568
|
-
`),"\u{1F4CB} Configuration");let i=
|
|
1567
|
+
${Qw(r.features)}`,"\u{1F4E6} Configuration");let i=await fe({message:"Use these recommended settings?",initialValue:!0});if(O(i))return Fe("Wizard cancelled."),null;let n=await fe({message:"Do you want to enable Arabic & RTL support? (Cairo font, rtl dir)",initialValue:!1});if(O(n))return Fe("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}};W();var _f={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=>{ur(),d.print(wi);let t=await Af();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)}`];le(r.join(`
|
|
1568
|
+
`),"\u{1F4CB} Configuration");let i=Ht(t.selections);le(i,"\u{1F4C2} Files to be created");let n=await fe({message:"Create project with these settings?"});(O(n)||!n)&&(Fe("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);fr(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=Nt(u,{audit:c,strict:l}),h=`${u} run dev`;d.newline(),d.print(T.default.bold(T.default.cyan(" \u{1F680} Next Steps:"))),d.newline(),d.print(` ${T.default.dim("1.")} cd ${T.default.cyan(t.projectName)}`),d.newline(),t.selections.installDependencies?(d.newline(),d.print(` ${T.default.dim("2.")} ${T.default.white(h)}`)):(u==="npm"&&!c&&!l&&d.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)")}`),d.print(` ${T.default.dim("2.")} ${T.default.white(p)}`),u==="npm"&&!c&&!l&&(d.newline(),d.print(` ${T.default.blue("\u{1F6E1}\uFE0F")} ${T.default.dim("Standard install (Secure & verified)")}`),d.print(` ${T.default.white("npm install")}`)),d.newline(),d.print(` ${T.default.dim("3.")} ${T.default.white(h)}`)),u==="npm"&&a.includes("pnpm")&&(d.newline(),d.warn(" \u26A1 Pro tip: Using pnpm can be 3x faster for this project.")),d.newline(),d.print(` ${T.default.magenta(T.default.bold("Happy coding!"))} ${T.default.dim("\u2014")} ${T.default.cyan("NEXO CLI")}`),d.newline()}};var Tf=[Sf,Ff,_f,wf,xf];var tv=ev(import.meta.url),{version:rv}=tv("../../package.json"),Ou=new Gu;Ou.name("nexo").description("NEXO is a next-generation, extensible CLI for scaffolding and orchestrating modern frontend projects").version(rv).option("--verbose","Enable verbose output for detailed logs").hook("preAction",e=>{e.opts().verbose&&(process.env.NEXO_VERBOSE="true")});for(let e of Tf){let t=Ou.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)}Ou.parse();
|