@abhi-arya1/wt 0.0.2 → 0.0.3
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 +20 -14
- package/dist/index.js +48 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,13 +56,11 @@ bun run dev -- <command>
|
|
|
56
56
|
You're in a git repo. You want an isolated copy to mess around in without touching your working tree.
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
wt local my-experiment
|
|
60
|
-
|
|
61
|
-
# you're now in a detached worktree at .wt/sandboxes/<id>
|
|
62
|
-
# do whatever, then exit the shell
|
|
59
|
+
wt local my-experiment --enter
|
|
60
|
+
# you're now in a worktree at .wt/sandboxes/my-experiment
|
|
63
61
|
|
|
64
62
|
# or just let it pick the name from your current branch
|
|
65
|
-
wt local
|
|
63
|
+
wt local --enter
|
|
66
64
|
# sandbox named after your current branch
|
|
67
65
|
```
|
|
68
66
|
|
|
@@ -72,8 +70,7 @@ You have a server you can SSH into. Register it as a host, then spin up sandboxe
|
|
|
72
70
|
|
|
73
71
|
```bash
|
|
74
72
|
wt host add prod-box --ssh user@10.0.0.5 --root /srv/wt
|
|
75
|
-
wt up my-feature --host prod-box
|
|
76
|
-
wt enter my-feature
|
|
73
|
+
wt up my-feature --host prod-box --enter
|
|
77
74
|
```
|
|
78
75
|
|
|
79
76
|
### Clean up
|
|
@@ -117,8 +114,7 @@ wt doctor --host myserver
|
|
|
117
114
|
|
|
118
115
|
```bash
|
|
119
116
|
cd ~/projects/my-app
|
|
120
|
-
wt up test-sandbox --host myserver
|
|
121
|
-
wt enter test-sandbox
|
|
117
|
+
wt up test-sandbox --host myserver --enter
|
|
122
118
|
```
|
|
123
119
|
|
|
124
120
|
You're now in a shell on `myserver` inside a worktree of your repo. `.env` files from your local directory get copied over automatically.
|
|
@@ -234,19 +230,29 @@ wt sessions --host prod-box # list sessions on a remote host
|
|
|
234
230
|
|
|
235
231
|
### `wt up [name]`
|
|
236
232
|
|
|
237
|
-
Create a sandbox worktree on a host. If `name` is omitted, it defaults to the branch name from
|
|
233
|
+
Create a sandbox worktree on a host. If `name` is omitted, it defaults to the branch name from `-b` / `--ref`, or the current branch.
|
|
238
234
|
|
|
239
235
|
| Flag | Description |
|
|
240
236
|
|---|---|
|
|
241
237
|
| `-H, --host <name>` | Target host (defaults to configured default, falls back to `local`) |
|
|
242
|
-
| `-b, --branch <
|
|
243
|
-
| `-r, --ref <ref>` |
|
|
238
|
+
| `-b, --branch <name>` | Create or use a branch with this name |
|
|
239
|
+
| `-r, --ref <ref>` | Git ref to check out (branch, tag, or sha that must exist) |
|
|
240
|
+
| `-e, --enter` | Enter the sandbox after creating it |
|
|
241
|
+
| `--tmux` | Use tmux when entering (implies `--enter`) |
|
|
244
242
|
| `--json` | JSON output |
|
|
245
243
|
|
|
246
244
|
### `wt local [name]`
|
|
247
245
|
|
|
248
246
|
Shorthand for `wt up [name]` on the local host. Same options minus `--host`.
|
|
249
247
|
|
|
248
|
+
| Flag | Description |
|
|
249
|
+
|---|---|
|
|
250
|
+
| `-b, --branch <name>` | Create or use a branch with this name |
|
|
251
|
+
| `-r, --ref <ref>` | Git ref to check out (branch, tag, or sha that must exist) |
|
|
252
|
+
| `-e, --enter` | Enter the sandbox after creating it |
|
|
253
|
+
| `--tmux` | Use tmux when entering (implies `--enter`) |
|
|
254
|
+
| `--json` | JSON output |
|
|
255
|
+
|
|
250
256
|
### `wt rename <old> <new>`
|
|
251
257
|
|
|
252
258
|
Rename a sandbox.
|
|
@@ -382,7 +388,7 @@ Remove a host.
|
|
|
382
388
|
|
|
383
389
|
| Flag | Description |
|
|
384
390
|
|---|---|
|
|
385
|
-
| `-
|
|
391
|
+
| `-y, --yes` | Skip confirmation prompt |
|
|
386
392
|
| `--json` | JSON output |
|
|
387
393
|
|
|
388
394
|
## How it works
|
|
@@ -394,7 +400,7 @@ Remove a host.
|
|
|
394
400
|
mirrors/
|
|
395
401
|
<repoId>.git/ # bare mirror
|
|
396
402
|
sandboxes/
|
|
397
|
-
<
|
|
403
|
+
<name>/ # worktree checkout
|
|
398
404
|
meta/
|
|
399
405
|
<sandboxId>.json # sandbox metadata
|
|
400
406
|
```
|
package/dist/index.js
CHANGED
|
@@ -1,62 +1,65 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var LE=Object.create;var{getPrototypeOf:YE,defineProperty:
|
|
4
|
-
`)}displayWidth(D){return
|
|
5
|
-
`+" ".repeat(u
|
|
6
|
-
${B}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),E=/[\s]*[^\s]+/g,C=[];return F.forEach((B)=>{let
|
|
7
|
-
`)}}function
|
|
3
|
+
var LE=Object.create;var{getPrototypeOf:YE,defineProperty:EF,getOwnPropertyNames:QE}=Object;var KE=Object.prototype.hasOwnProperty;var dD=(D,u,F)=>{F=D!=null?LE(YE(D)):{};let E=u||!D||!D.__esModule?EF(F,"default",{value:D,enumerable:!0}):F;for(let C of QE(D))if(!KE.call(E,C))EF(E,C,{get:()=>D[C],enumerable:!0});return E};var V=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var s=import.meta.require;var cD=V((WE)=>{class ru extends Error{constructor(D,u,F){super(F);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=u,this.exitCode=D,this.nestedError=void 0}}class CF extends ru{constructor(D){super(1,"commander.invalidArgument",D);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}WE.CommanderError=ru;WE.InvalidArgumentError=CF});var $u=V((mE)=>{var{InvalidArgumentError:VE}=cD();class BF{constructor(D,u){switch(this.description=u||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,D[0]){case"<":this.required=!0,this._name=D.slice(1,-1);break;case"[":this.required=!1,this._name=D.slice(1,-1);break;default:this.required=!0,this._name=D;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}argParser(D){return this.parseArg=D,this}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new VE(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function kE(D){let u=D.name()+(D.variadic===!0?"...":"");return D.required?"<"+u+">":"["+u+"]"}mE.Argument=BF;mE.humanReadableArgName=kE});var bu=V((oE)=>{var{humanReadableArgName:vE}=$u();class tF{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(D){this.helpWidth=this.helpWidth??D.helpWidth??80}visibleCommands(D){let u=D.commands.filter((E)=>!E._hidden),F=D._getHelpCommand();if(F&&!F._hidden)u.push(F);if(this.sortSubcommands)u.sort((E,C)=>{return E.name().localeCompare(C.name())});return u}compareOptions(D,u){let F=(E)=>{return E.short?E.short.replace(/^-/,""):E.long.replace(/^--/,"")};return F(D).localeCompare(F(u))}visibleOptions(D){let u=D.options.filter((E)=>!E.hidden),F=D._getHelpOption();if(F&&!F.hidden){let E=F.short&&D._findOption(F.short),C=F.long&&D._findOption(F.long);if(!E&&!C)u.push(F);else if(F.long&&!C)u.push(D.createOption(F.long,F.description));else if(F.short&&!E)u.push(D.createOption(F.short,F.description))}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleGlobalOptions(D){if(!this.showGlobalOptions)return[];let u=[];for(let F=D.parent;F;F=F.parent){let E=F.options.filter((C)=>!C.hidden);u.push(...E)}if(this.sortOptions)u.sort(this.compareOptions);return u}visibleArguments(D){if(D._argsDescription)D.registeredArguments.forEach((u)=>{u.description=u.description||D._argsDescription[u.name()]||""});if(D.registeredArguments.find((u)=>u.description))return D.registeredArguments;return[]}subcommandTerm(D){let u=D.registeredArguments.map((F)=>vE(F)).join(" ");return D._name+(D._aliases[0]?"|"+D._aliases[0]:"")+(D.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(D){return D.flags}argumentTerm(D){return D.name()}longestSubcommandTermLength(D,u){return u.visibleCommands(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleSubcommandTerm(u.subcommandTerm(E))))},0)}longestOptionTermLength(D,u){return u.visibleOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestGlobalOptionTermLength(D,u){return u.visibleGlobalOptions(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleOptionTerm(u.optionTerm(E))))},0)}longestArgumentTermLength(D,u){return u.visibleArguments(D).reduce((F,E)=>{return Math.max(F,this.displayWidth(u.styleArgumentTerm(u.argumentTerm(E))))},0)}commandUsage(D){let u=D._name;if(D._aliases[0])u=u+"|"+D._aliases[0];let F="";for(let E=D.parent;E;E=E.parent)F=E.name()+" "+F;return F+u+" "+D.usage()}commandDescription(D){return D.description()}subcommandDescription(D){return D.summary()||D.description()}optionDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0){if(D.required||D.optional||D.isBoolean()&&typeof D.defaultValue==="boolean")u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`)}if(D.presetArg!==void 0&&D.optional)u.push(`preset: ${JSON.stringify(D.presetArg)}`);if(D.envVar!==void 0)u.push(`env: ${D.envVar}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}argumentDescription(D){let u=[];if(D.argChoices)u.push(`choices: ${D.argChoices.map((F)=>JSON.stringify(F)).join(", ")}`);if(D.defaultValue!==void 0)u.push(`default: ${D.defaultValueDescription||JSON.stringify(D.defaultValue)}`);if(u.length>0){let F=`(${u.join(", ")})`;if(D.description)return`${D.description} ${F}`;return F}return D.description}formatItemList(D,u,F){if(u.length===0)return[];return[F.styleTitle(D),...u,""]}groupItems(D,u,F){let E=new Map;return D.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[])}),u.forEach((C)=>{let B=F(C);if(!E.has(B))E.set(B,[]);E.get(B).push(C)}),E}formatHelp(D,u){let F=u.padWidth(D,u),E=u.helpWidth??80;function C(x,H){return u.formatItem(x,F,H,u)}let B=[`${u.styleTitle("Usage:")} ${u.styleUsage(u.commandUsage(D))}`,""],t=u.commandDescription(D);if(t.length>0)B=B.concat([u.boxWrap(u.styleCommandDescription(t),E),""]);let $=u.visibleArguments(D).map((x)=>{return C(u.styleArgumentTerm(u.argumentTerm(x)),u.styleArgumentDescription(u.argumentDescription(x)))});if(B=B.concat(this.formatItemList("Arguments:",$,u)),this.groupItems(D.options,u.visibleOptions(D),(x)=>x.helpGroupHeading??"Options:").forEach((x,H)=>{let R=x.map((w)=>{return C(u.styleOptionTerm(u.optionTerm(w)),u.styleOptionDescription(u.optionDescription(w)))});B=B.concat(this.formatItemList(H,R,u))}),u.showGlobalOptions){let x=u.visibleGlobalOptions(D).map((H)=>{return C(u.styleOptionTerm(u.optionTerm(H)),u.styleOptionDescription(u.optionDescription(H)))});B=B.concat(this.formatItemList("Global Options:",x,u))}return this.groupItems(D.commands,u.visibleCommands(D),(x)=>x.helpGroup()||"Commands:").forEach((x,H)=>{let R=x.map((w)=>{return C(u.styleSubcommandTerm(u.subcommandTerm(w)),u.styleSubcommandDescription(u.subcommandDescription(w)))});B=B.concat(this.formatItemList(H,R,u))}),B.join(`
|
|
4
|
+
`)}displayWidth(D){return $F(D).length}styleTitle(D){return D}styleUsage(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u==="[command]")return this.styleSubcommandText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleCommandText(u)}).join(" ")}styleCommandDescription(D){return this.styleDescriptionText(D)}styleOptionDescription(D){return this.styleDescriptionText(D)}styleSubcommandDescription(D){return this.styleDescriptionText(D)}styleArgumentDescription(D){return this.styleDescriptionText(D)}styleDescriptionText(D){return D}styleOptionTerm(D){return this.styleOptionText(D)}styleSubcommandTerm(D){return D.split(" ").map((u)=>{if(u==="[options]")return this.styleOptionText(u);if(u[0]==="["||u[0]==="<")return this.styleArgumentText(u);return this.styleSubcommandText(u)}).join(" ")}styleArgumentTerm(D){return this.styleArgumentText(D)}styleOptionText(D){return D}styleArgumentText(D){return D}styleSubcommandText(D){return D}styleCommandText(D){return D}padWidth(D,u){return Math.max(u.longestOptionTermLength(D,u),u.longestGlobalOptionTermLength(D,u),u.longestSubcommandTermLength(D,u),u.longestArgumentTermLength(D,u))}preformatted(D){return/\n[^\S\r\n]/.test(D)}formatItem(D,u,F,E){let B=" ".repeat(2);if(!F)return B+D;let t=D.padEnd(u+D.length-E.displayWidth(D)),$=2,A=(this.helpWidth??80)-u-$-2,x;if(A<this.minWidthToWrap||E.preformatted(F))x=F;else x=E.boxWrap(F,A).replace(/\n/g,`
|
|
5
|
+
`+" ".repeat(u+$));return B+t+" ".repeat($)+x.replace(/\n/g,`
|
|
6
|
+
${B}`)}boxWrap(D,u){if(u<this.minWidthToWrap)return D;let F=D.split(/\r\n|\n/),E=/[\s]*[^\s]+/g,C=[];return F.forEach((B)=>{let t=B.match(E);if(t===null){C.push("");return}let $=[t.shift()],n=this.displayWidth($[0]);t.forEach((A)=>{let x=this.displayWidth(A);if(n+x<=u){$.push(A),n+=x;return}C.push($.join(""));let H=A.trimStart();$=[H],n=this.displayWidth(H)}),C.push($.join(""))}),C.join(`
|
|
7
|
+
`)}}function $F(D){let u=/\x1b\[\d*(;\d*)*m/g;return D.replace(u,"")}oE.Help=tF;oE.stripColor=$F});var vu=V((sE)=>{var{InvalidArgumentError:gE}=cD();class AF{constructor(D,u){this.flags=D,this.description=u||"",this.required=D.includes("<"),this.optional=D.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(D),this.mandatory=!1;let F=iE(D);if(this.short=F.shortFlag,this.long=F.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,this.helpGroupHeading=void 0}default(D,u){return this.defaultValue=D,this.defaultValueDescription=u,this}preset(D){return this.presetArg=D,this}conflicts(D){return this.conflictsWith=this.conflictsWith.concat(D),this}implies(D){let u=D;if(typeof D==="string")u={[D]:!0};return this.implied=Object.assign(this.implied||{},u),this}env(D){return this.envVar=D,this}argParser(D){return this.parseArg=D,this}makeOptionMandatory(D=!0){return this.mandatory=!!D,this}hideHelp(D=!0){return this.hidden=!!D,this}_collectValue(D,u){if(u===this.defaultValue||!Array.isArray(u))return[D];return u.push(D),u}choices(D){return this.argChoices=D.slice(),this.parseArg=(u,F)=>{if(!this.argChoices.includes(u))throw new gE(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(u,F);return u},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return xF(this.name().replace(/^no-/,""));return xF(this.name())}helpGroup(D){return this.helpGroupHeading=D,this}is(D){return this.short===D||this.long===D}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class HF{constructor(D){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,D.forEach((u)=>{if(u.negate)this.negativeOptions.set(u.attributeName(),u);else this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,F)=>{if(this.positiveOptions.has(F))this.dualOptions.add(F)})}valueFromOption(D,u){let F=u.attributeName();if(!this.dualOptions.has(F))return!0;let E=this.negativeOptions.get(F).presetArg,C=E!==void 0?E:!1;return u.negate===(C===D)}}function xF(D){return D.split("-").reduce((u,F)=>{return u+F[0].toUpperCase()+F.slice(1)})}function iE(D){let u,F,E=/^-[^-]$/,C=/^--[^-]/,B=D.split(/[ |,]+/).concat("guard");if(E.test(B[0]))u=B.shift();if(C.test(B[0]))F=B.shift();if(!u&&E.test(B[0]))u=B.shift();if(!u&&C.test(B[0]))u=F,F=B.shift();if(B[0].startsWith("-")){let t=B[0],$=`option creation failed due to '${t}' in option flags '${D}'`;if(/^-[^-][^-]/.test(t))throw Error(`${$}
|
|
8
8
|
- a short flag is a single dash and a single character
|
|
9
9
|
- either use a single dash and a single character (for a short flag)
|
|
10
|
-
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test(
|
|
11
|
-
- too many short flags`);if(C.test(
|
|
12
|
-
- too many long flags`);throw Error(`${
|
|
13
|
-
- unrecognised flag format`)}if(u===void 0&&F===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}sE.Option
|
|
10
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(E.test(t))throw Error(`${$}
|
|
11
|
+
- too many short flags`);if(C.test(t))throw Error(`${$}
|
|
12
|
+
- too many long flags`);throw Error(`${$}
|
|
13
|
+
- unrecognised flag format`)}if(u===void 0&&F===void 0)throw Error(`option creation failed due to no flags found in '${D}'.`);return{shortFlag:u,longFlag:F}}sE.Option=AF;sE.DualOptions=HF});var nF=V((DC)=>{function pE(D,u){if(Math.abs(D.length-u.length)>3)return Math.max(D.length,u.length);let F=[];for(let E=0;E<=D.length;E++)F[E]=[E];for(let E=0;E<=u.length;E++)F[0][E]=E;for(let E=1;E<=u.length;E++)for(let C=1;C<=D.length;C++){let B=1;if(D[C-1]===u[E-1])B=0;else B=1;if(F[C][E]=Math.min(F[C-1][E]+1,F[C][E-1]+1,F[C-1][E-1]+B),C>1&&E>1&&D[C-1]===u[E-2]&&D[C-2]===u[E-1])F[C][E]=Math.min(F[C][E],F[C-2][E-2]+1)}return F[D.length][u.length]}function eE(D,u){if(!u||u.length===0)return"";u=Array.from(new Set(u));let F=D.startsWith("--");if(F)D=D.slice(2),u=u.map((t)=>t.slice(2));let E=[],C=3,B=0.4;if(u.forEach((t)=>{if(t.length<=1)return;let $=pE(D,t),n=Math.max(D.length,t.length);if((n-$)/n>B){if($<C)C=$,E=[t];else if($===C)E.push(t)}}),E.sort((t,$)=>t.localeCompare($)),F)E=E.map((t)=>`--${t}`);if(E.length>1)return`
|
|
14
14
|
(Did you mean one of ${E.join(", ")}?)`;if(E.length===1)return`
|
|
15
|
-
(Did you mean ${E[0]}?)`;return""}DC.suggestSimilar=eE});var
|
|
16
|
-
- specify the name in Command constructor or using .name()`);if(u=u||{},u.isDefault)this._defaultCommandName=D._name;if(u.noHelp||u.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,u){return new EC(D,u)}argument(D,u,F,E){let C=this.createArgument(D,u);if(typeof F==="function")C.default(E).argParser(F);else C.default(F);return this.addArgument(C),this}arguments(D){return D.trim().split(/ +/).forEach((u)=>{this.argument(u)}),this}addArgument(D){let u=this.registeredArguments.slice(-1)[0];if(u?.variadic)throw Error(`only the last argument can be variadic '${u.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,u){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let F=D??"help [command]",[,E,C]=F.match(/([^ ]+) *(.*)/),B=u??"display help for command"
|
|
17
|
-
Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new
|
|
18
|
-
- already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(E)=>{return[E.name()].concat(E.aliases())},F=u(D).find((E)=>this._findCommand(E));if(F){let E=u(this._findCommand(F)).join("|"),C=u(D).join("|");throw Error(`cannot add command '${C}' as already have command '${E}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let C=D.long.replace(/^--no-/,"--");if(!this._findOption(C))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let E=(C,B
|
|
19
|
-
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,u,F){if(
|
|
15
|
+
(Did you mean ${E[0]}?)`;return""}DC.suggestSimilar=eE});var hF=V((xC)=>{var FC=s("events").EventEmitter,ou=s("child_process"),xD=s("path"),xu=s("fs"),G=s("process"),{Argument:EC,humanReadableArgName:CC}=$u(),{CommanderError:du}=cD(),{Help:BC,stripColor:tC}=bu(),{Option:SF,DualOptions:$C}=vu(),{suggestSimilar:wF}=nF();class gu extends FC{constructor(D){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=D||"",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._savedState=null,this._outputConfiguration={writeOut:(u)=>G.stdout.write(u),writeErr:(u)=>G.stderr.write(u),outputError:(u,F)=>F(u),getOutHelpWidth:()=>G.stdout.isTTY?G.stdout.columns:void 0,getErrHelpWidth:()=>G.stderr.isTTY?G.stderr.columns:void 0,getOutHasColors:()=>cu()??(G.stdout.isTTY&&G.stdout.hasColors?.()),getErrHasColors:()=>cu()??(G.stderr.isTTY&&G.stderr.hasColors?.()),stripColor:(u)=>tC(u)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(D){return this._outputConfiguration=D._outputConfiguration,this._helpOption=D._helpOption,this._helpCommand=D._helpCommand,this._helpConfiguration=D._helpConfiguration,this._exitCallback=D._exitCallback,this._storeOptionsAsProperties=D._storeOptionsAsProperties,this._combineFlagAndOptionalValue=D._combineFlagAndOptionalValue,this._allowExcessArguments=D._allowExcessArguments,this._enablePositionalOptions=D._enablePositionalOptions,this._showHelpAfterError=D._showHelpAfterError,this._showSuggestionAfterError=D._showSuggestionAfterError,this}_getCommandAndAncestors(){let D=[];for(let u=this;u;u=u.parent)D.push(u);return D}command(D,u,F){let E=u,C=F;if(typeof E==="object"&&E!==null)C=E,E=null;C=C||{};let[,B,t]=D.match(/([^ ]+) *(.*)/),$=this.createCommand(B);if(E)$.description(E),$._executableHandler=!0;if(C.isDefault)this._defaultCommandName=$._name;if($._hidden=!!(C.noHelp||C.hidden),$._executableFile=C.executableFile||null,t)$.arguments(t);if(this._registerCommand($),$.parent=this,$.copyInheritedSettings(this),E)return this;return $}createCommand(D){return new gu(D)}createHelp(){return Object.assign(new BC,this.configureHelp())}configureHelp(D){if(D===void 0)return this._helpConfiguration;return this._helpConfiguration=D,this}configureOutput(D){if(D===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...D},this}showHelpAfterError(D=!0){if(typeof D!=="string")D=!!D;return this._showHelpAfterError=D,this}showSuggestionAfterError(D=!0){return this._showSuggestionAfterError=!!D,this}addCommand(D,u){if(!D._name)throw Error(`Command passed to .addCommand() must have a name
|
|
16
|
+
- specify the name in Command constructor or using .name()`);if(u=u||{},u.isDefault)this._defaultCommandName=D._name;if(u.noHelp||u.hidden)D._hidden=!0;return this._registerCommand(D),D.parent=this,D._checkForBrokenPassThrough(),this}createArgument(D,u){return new EC(D,u)}argument(D,u,F,E){let C=this.createArgument(D,u);if(typeof F==="function")C.default(E).argParser(F);else C.default(F);return this.addArgument(C),this}arguments(D){return D.trim().split(/ +/).forEach((u)=>{this.argument(u)}),this}addArgument(D){let u=this.registeredArguments.slice(-1)[0];if(u?.variadic)throw Error(`only the last argument can be variadic '${u.name()}'`);if(D.required&&D.defaultValue!==void 0&&D.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${D.name()}'`);return this.registeredArguments.push(D),this}helpCommand(D,u){if(typeof D==="boolean"){if(this._addImplicitHelpCommand=D,D&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let F=D??"help [command]",[,E,C]=F.match(/([^ ]+) *(.*)/),B=u??"display help for command",t=this.createCommand(E);if(t.helpOption(!1),C)t.arguments(C);if(B)t.description(B);if(this._addImplicitHelpCommand=!0,this._helpCommand=t,D||u)this._initCommandGroup(t);return this}addHelpCommand(D,u){if(typeof D!=="object")return this.helpCommand(D,u),this;return this._addImplicitHelpCommand=!0,this._helpCommand=D,this._initCommandGroup(D),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook(D,u){let F=["preSubcommand","preAction","postAction"];if(!F.includes(D))throw Error(`Unexpected value for event passed to hook : '${D}'.
|
|
17
|
+
Expecting one of '${F.join("', '")}'`);if(this._lifeCycleHooks[D])this._lifeCycleHooks[D].push(u);else this._lifeCycleHooks[D]=[u];return this}exitOverride(D){if(D)this._exitCallback=D;else this._exitCallback=(u)=>{if(u.code!=="commander.executeSubCommandAsync")throw u};return this}_exit(D,u,F){if(this._exitCallback)this._exitCallback(new du(D,u,F));G.exit(D)}action(D){let u=(F)=>{let E=this.registeredArguments.length,C=F.slice(0,E);if(this._storeOptionsAsProperties)C[E]=this;else C[E]=this.opts();return C.push(this),D.apply(this,C)};return this._actionHandler=u,this}createOption(D,u){return new SF(D,u)}_callParseArg(D,u,F,E){try{return D.parseArg(u,F)}catch(C){if(C.code==="commander.invalidArgument"){let B=`${E} ${C.message}`;this.error(B,{exitCode:C.exitCode,code:C.code})}throw C}}_registerOption(D){let u=D.short&&this._findOption(D.short)||D.long&&this._findOption(D.long);if(u){let F=D.long&&this._findOption(D.long)?D.long:D.short;throw Error(`Cannot add option '${D.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${F}'
|
|
18
|
+
- already used by option '${u.flags}'`)}this._initOptionGroup(D),this.options.push(D)}_registerCommand(D){let u=(E)=>{return[E.name()].concat(E.aliases())},F=u(D).find((E)=>this._findCommand(E));if(F){let E=u(this._findCommand(F)).join("|"),C=u(D).join("|");throw Error(`cannot add command '${C}' as already have command '${E}'`)}this._initCommandGroup(D),this.commands.push(D)}addOption(D){this._registerOption(D);let u=D.name(),F=D.attributeName();if(D.negate){let C=D.long.replace(/^--no-/,"--");if(!this._findOption(C))this.setOptionValueWithSource(F,D.defaultValue===void 0?!0:D.defaultValue,"default")}else if(D.defaultValue!==void 0)this.setOptionValueWithSource(F,D.defaultValue,"default");let E=(C,B,t)=>{if(C==null&&D.presetArg!==void 0)C=D.presetArg;let $=this.getOptionValue(F);if(C!==null&&D.parseArg)C=this._callParseArg(D,C,$,B);else if(C!==null&&D.variadic)C=D._collectValue(C,$);if(C==null)if(D.negate)C=!1;else if(D.isBoolean()||D.optional)C=!0;else C="";this.setOptionValueWithSource(F,C,t)};if(this.on("option:"+u,(C)=>{let B=`error: option '${D.flags}' argument '${C}' is invalid.`;E(C,B,"cli")}),D.envVar)this.on("optionEnv:"+u,(C)=>{let B=`error: option '${D.flags}' value '${C}' from env '${D.envVar}' is invalid.`;E(C,B,"env")});return this}_optionEx(D,u,F,E,C){if(typeof u==="object"&&u instanceof SF)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let B=this.createOption(u,F);if(B.makeOptionMandatory(!!D.mandatory),typeof E==="function")B.default(C).argParser(E);else if(E instanceof RegExp){let t=E;E=($,n)=>{let A=t.exec($);return A?A[0]:n},B.default(C).argParser(E)}else B.default(E);return this.addOption(B)}option(D,u,F,E){return this._optionEx({},D,u,F,E)}requiredOption(D,u,F,E){return this._optionEx({mandatory:!0},D,u,F,E)}combineFlagAndOptionalValue(D=!0){return this._combineFlagAndOptionalValue=!!D,this}allowUnknownOption(D=!0){return this._allowUnknownOption=!!D,this}allowExcessArguments(D=!0){return this._allowExcessArguments=!!D,this}enablePositionalOptions(D=!0){return this._enablePositionalOptions=!!D,this}passThroughOptions(D=!0){return this._passThroughOptions=!!D,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(D=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!D,this}getOptionValue(D){if(this._storeOptionsAsProperties)return this[D];return this._optionValues[D]}setOptionValue(D,u){return this.setOptionValueWithSource(D,u,void 0)}setOptionValueWithSource(D,u,F){if(this._storeOptionsAsProperties)this[D]=u;else this._optionValues[D]=u;return this._optionValueSources[D]=F,this}getOptionValueSource(D){return this._optionValueSources[D]}getOptionValueSourceWithGlobals(D){let u;return this._getCommandAndAncestors().forEach((F)=>{if(F.getOptionValueSource(D)!==void 0)u=F.getOptionValueSource(D)}),u}_prepareUserArgs(D,u){if(D!==void 0&&!Array.isArray(D))throw Error("first parameter to parse must be array or undefined");if(u=u||{},D===void 0&&u.from===void 0){if(G.versions?.electron)u.from="electron";let E=G.execArgv??[];if(E.includes("-e")||E.includes("--eval")||E.includes("-p")||E.includes("--print"))u.from="eval"}if(D===void 0)D=G.argv;this.rawArgs=D.slice();let F;switch(u.from){case void 0:case"node":this._scriptPath=D[1],F=D.slice(2);break;case"electron":if(G.defaultApp)this._scriptPath=D[1],F=D.slice(2);else F=D.slice(1);break;case"user":F=D.slice(0);break;case"eval":F=D.slice(1);break;default:throw Error(`unexpected parse option { from: '${u.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",F}parse(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return this._parseCommand([],F),this}async parseAsync(D,u){this._prepareForParse();let F=this._prepareUserArgs(D,u);return await this._parseCommand([],F),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
19
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(D,u,F){if(xu.existsSync(D))return;let E=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",C=`'${D}' does not exist
|
|
20
20
|
- if '${F}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
21
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
|
-
- ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(A,
|
|
22
|
+
- ${E}`;throw Error(C)}_executeSubCommand(D,u){u=u.slice();let F=!1,E=[".js",".ts",".tsx",".mjs",".cjs"];function C(A,x){let H=xD.resolve(A,x);if(xu.existsSync(H))return H;if(E.includes(xD.extname(x)))return;let R=E.find((w)=>xu.existsSync(`${H}${w}`));if(R)return`${H}${R}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let B=D._executableFile||`${this._name}-${D._name}`,t=this._executableDir||"";if(this._scriptPath){let A;try{A=xu.realpathSync(this._scriptPath)}catch{A=this._scriptPath}t=xD.resolve(xD.dirname(A),t)}if(t){let A=C(t,B);if(!A&&!D._executableFile&&this._scriptPath){let x=xD.basename(this._scriptPath,xD.extname(this._scriptPath));if(x!==this._name)A=C(t,`${x}-${D._name}`)}B=A||B}F=E.includes(xD.extname(B));let $;if(G.platform!=="win32")if(F)u.unshift(B),u=RF(G.execArgv).concat(u),$=ou.spawn(G.argv[0],u,{stdio:"inherit"});else $=ou.spawn(B,u,{stdio:"inherit"});else this._checkForMissingExecutable(B,t,D._name),u.unshift(B),u=RF(G.execArgv).concat(u),$=ou.spawn(G.execPath,u,{stdio:"inherit"});if(!$.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((x)=>{G.on(x,()=>{if($.killed===!1&&$.exitCode===null)$.kill(x)})});let n=this._exitCallback;$.on("close",(A)=>{if(A=A??1,!n)G.exit(A);else n(new du(A,"commander.executeSubCommandAsync","(close)"))}),$.on("error",(A)=>{if(A.code==="ENOENT")this._checkForMissingExecutable(B,t,D._name);else if(A.code==="EACCES")throw Error(`'${B}' not executable`);if(!n)G.exit(1);else{let x=new du(1,"commander.executeSubCommandAsync","(error)");x.nestedError=A,n(x)}}),this.runningCommand=$}_dispatchSubcommand(D,u,F){let E=this._findCommand(D);if(!E)this.help({error:!0});E._prepareForParse();let C;return C=this._chainOrCallSubCommandHook(C,E,"preSubcommand"),C=this._chainOrCall(C,()=>{if(E._executableHandler)this._executeSubCommand(E,u.concat(F));else return E._parseCommand(u,F)}),C}_dispatchHelpCommand(D){if(!D)this.help();let u=this._findCommand(D);if(u&&!u._executableHandler)u.help();return this._dispatchSubcommand(D,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((D,u)=>{if(D.required&&this.args[u]==null)this.missingArgument(D.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let D=(F,E,C)=>{let B=E;if(E!==null&&F.parseArg){let t=`error: command-argument value '${E}' is invalid for argument '${F.name()}'.`;B=this._callParseArg(F,E,C,t)}return B};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((F,E)=>{let C=F.defaultValue;if(F.variadic){if(E<this.args.length){if(C=this.args.slice(E),F.parseArg)C=C.reduce((B,t)=>{return D(F,t,B)},F.defaultValue)}else if(C===void 0)C=[]}else if(E<this.args.length){if(C=this.args[E],F.parseArg)C=D(F,C,F.defaultValue)}u[E]=C}),this.processedArgs=u}_chainOrCall(D,u){if(D?.then&&typeof D.then==="function")return D.then(()=>u());return u()}_chainOrCallHooks(D,u){let F=D,E=[];if(this._getCommandAndAncestors().reverse().filter((C)=>C._lifeCycleHooks[u]!==void 0).forEach((C)=>{C._lifeCycleHooks[u].forEach((B)=>{E.push({hookedCommand:C,callback:B})})}),u==="postAction")E.reverse();return E.forEach((C)=>{F=this._chainOrCall(F,()=>{return C.callback(C.hookedCommand,this)})}),F}_chainOrCallSubCommandHook(D,u,F){let E=D;if(this._lifeCycleHooks[F]!==void 0)this._lifeCycleHooks[F].forEach((C)=>{E=this._chainOrCall(E,()=>{return C(this,u)})});return E}_parseCommand(D,u){let F=this.parseOptions(u);if(this._parseOptionsEnv(),this._parseOptionsImplied(),D=D.concat(F.operands),u=F.unknown,this.args=D.concat(u),D&&this._findCommand(D[0]))return this._dispatchSubcommand(D[0],D.slice(1),u);if(this._getHelpCommand()&&D[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(D[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(u),this._dispatchSubcommand(this._defaultCommandName,D,u);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(F.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let E=()=>{if(F.unknown.length>0)this.unknownOption(F.unknown[0])},C=`command:${this.name()}`;if(this._actionHandler){E(),this._processArguments();let B;if(B=this._chainOrCallHooks(B,"preAction"),B=this._chainOrCall(B,()=>this._actionHandler(this.processedArgs)),this.parent)B=this._chainOrCall(B,()=>{this.parent.emit(C,D,u)});return B=this._chainOrCallHooks(B,"postAction"),B}if(this.parent?.listenerCount(C))E(),this._processArguments(),this.parent.emit(C,D,u);else if(D.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",D,u);if(this.listenerCount("command:*"))this.emit("command:*",D,u);else if(this.commands.length)this.unknownCommand();else E(),this._processArguments()}else if(this.commands.length)E(),this.help({error:!0});else E(),this._processArguments()}_findCommand(D){if(!D)return;return this.commands.find((u)=>u._name===D||u._aliases.includes(D))}_findOption(D){return this.options.find((u)=>u.is(D))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((D)=>{D.options.forEach((u)=>{if(u.mandatory&&D.getOptionValue(u.attributeName())===void 0)D.missingMandatoryOptionValue(u)})})}_checkForConflictingLocalOptions(){let D=this.options.filter((F)=>{let E=F.attributeName();if(this.getOptionValue(E)===void 0)return!1;return this.getOptionValueSource(E)!=="default"});D.filter((F)=>F.conflictsWith.length>0).forEach((F)=>{let E=D.find((C)=>F.conflictsWith.includes(C.attributeName()));if(E)this._conflictingOption(F,E)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((D)=>{D._checkForConflictingLocalOptions()})}parseOptions(D){let u=[],F=[],E=u;function C(A){return A.length>1&&A[0]==="-"}let B=(A)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(A))return!1;return!this._getCommandAndAncestors().some((x)=>x.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},t=null,$=null,n=0;while(n<D.length||$){let A=$??D[n++];if($=null,A==="--"){if(E===F)E.push(A);E.push(...D.slice(n));break}if(t&&(!C(A)||B(A))){this.emit(`option:${t.name()}`,A);continue}if(t=null,C(A)){let x=this._findOption(A);if(x){if(x.required){let H=D[n++];if(H===void 0)this.optionMissingArgument(x);this.emit(`option:${x.name()}`,H)}else if(x.optional){let H=null;if(n<D.length&&(!C(D[n])||B(D[n])))H=D[n++];this.emit(`option:${x.name()}`,H)}else this.emit(`option:${x.name()}`);t=x.variadic?x:null;continue}}if(A.length>2&&A[0]==="-"&&A[1]!=="-"){let x=this._findOption(`-${A[1]}`);if(x){if(x.required||x.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${x.name()}`,A.slice(2));else this.emit(`option:${x.name()}`),$=`-${A.slice(2)}`;continue}}if(/^--[^=]+=/.test(A)){let x=A.indexOf("="),H=this._findOption(A.slice(0,x));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,A.slice(x+1));continue}}if(E===u&&C(A)&&!(this.commands.length===0&&B(A)))E=F;if((this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&F.length===0){if(this._findCommand(A)){u.push(A),F.push(...D.slice(n));break}else if(this._getHelpCommand()&&A===this._getHelpCommand().name()){u.push(A,...D.slice(n));break}else if(this._defaultCommandName){F.push(A,...D.slice(n));break}}if(this._passThroughOptions){E.push(A,...D.slice(n));break}E.push(A)}return{operands:u,unknown:F}}opts(){if(this._storeOptionsAsProperties){let D={},u=this.options.length;for(let F=0;F<u;F++){let E=this.options[F].attributeName();D[E]=E===this._versionOptionName?this._version:this[E]}return D}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((D,u)=>Object.assign(D,u.opts()),{})}error(D,u){if(this._outputConfiguration.outputError(`${D}
|
|
23
23
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
24
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
25
|
-
`),this.outputHelp({error:!0});let F=u||{},E=F.exitCode||1,C=F.code||"commander.error";this._exit(E,C,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in G.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,G.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new
|
|
26
|
-
`),this._exit(0,"commander.version",D)}),this}description(D,u){if(D===void 0&&u===void 0)return this._description;if(this._description=D,u)this._argsDescription=u;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)u=this.commands[this.commands.length-1];if(D===u._name)throw Error("Command alias can't be the same as its name");let F=this.parent?._findCommand(D);if(F){let E=[F.name()].concat(F.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return u._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((u)=>this.alias(u)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map((F)=>{return CC(F)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=xD.basename(D,xD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let u=this.createHelp(),F=this._getOutputContext(D);u.prepareContext({error:F.error,helpWidth:F.helpWidth,outputHasColors:F.hasColors});let E=u.formatHelp(this,u);if(F.hasColors)return E;return this._outputConfiguration.stripColor(E)}_getOutputContext(D){D=D||{};let u=!!D.error,F,E,C;if(u)F=(
|
|
25
|
+
`),this.outputHelp({error:!0});let F=u||{},E=F.exitCode||1,C=F.code||"commander.error";this._exit(E,C,D)}_parseOptionsEnv(){this.options.forEach((D)=>{if(D.envVar&&D.envVar in G.env){let u=D.attributeName();if(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))if(D.required||D.optional)this.emit(`optionEnv:${D.name()}`,G.env[D.envVar]);else this.emit(`optionEnv:${D.name()}`)}})}_parseOptionsImplied(){let D=new $C(this.options),u=(F)=>{return this.getOptionValue(F)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(F))};this.options.filter((F)=>F.implied!==void 0&&u(F.attributeName())&&D.valueFromOption(this.getOptionValue(F.attributeName()),F)).forEach((F)=>{Object.keys(F.implied).filter((E)=>!u(E)).forEach((E)=>{this.setOptionValueWithSource(E,F.implied[E],"implied")})})}missingArgument(D){let u=`error: missing required argument '${D}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(D){let u=`error: option '${D.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(D){let u=`error: required option '${D.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(D,u){let F=(B)=>{let t=B.attributeName(),$=this.getOptionValue(t),n=this.options.find((x)=>x.negate&&t===x.attributeName()),A=this.options.find((x)=>!x.negate&&t===x.attributeName());if(n&&(n.presetArg===void 0&&$===!1||n.presetArg!==void 0&&$===n.presetArg))return n;return A||B},E=(B)=>{let t=F(B),$=t.attributeName();if(this.getOptionValueSource($)==="env")return`environment variable '${t.envVar}'`;return`option '${t.flags}'`},C=`error: ${E(D)} cannot be used with ${E(u)}`;this.error(C,{code:"commander.conflictingOption"})}unknownOption(D){if(this._allowUnknownOption)return;let u="";if(D.startsWith("--")&&this._showSuggestionAfterError){let E=[],C=this;do{let B=C.createHelp().visibleOptions(C).filter((t)=>t.long).map((t)=>t.long);E=E.concat(B),C=C.parent}while(C&&!C._enablePositionalOptions);u=wF(D,E)}let F=`error: unknown option '${D}'${u}`;this.error(F,{code:"commander.unknownOption"})}_excessArguments(D){if(this._allowExcessArguments)return;let u=this.registeredArguments.length,F=u===1?"":"s",C=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${F} but got ${D.length}.`;this.error(C,{code:"commander.excessArguments"})}unknownCommand(){let D=this.args[0],u="";if(this._showSuggestionAfterError){let E=[];this.createHelp().visibleCommands(this).forEach((C)=>{if(E.push(C.name()),C.alias())E.push(C.alias())}),u=wF(D,E)}let F=`error: unknown command '${D}'${u}`;this.error(F,{code:"commander.unknownCommand"})}version(D,u,F){if(D===void 0)return this._version;this._version=D,u=u||"-V, --version",F=F||"output the version number";let E=this.createOption(u,F);return this._versionOptionName=E.attributeName(),this._registerOption(E),this.on("option:"+E.name(),()=>{this._outputConfiguration.writeOut(`${D}
|
|
26
|
+
`),this._exit(0,"commander.version",D)}),this}description(D,u){if(D===void 0&&u===void 0)return this._description;if(this._description=D,u)this._argsDescription=u;return this}summary(D){if(D===void 0)return this._summary;return this._summary=D,this}alias(D){if(D===void 0)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)u=this.commands[this.commands.length-1];if(D===u._name)throw Error("Command alias can't be the same as its name");let F=this.parent?._findCommand(D);if(F){let E=[F.name()].concat(F.aliases()).join("|");throw Error(`cannot add alias '${D}' to command '${this.name()}' as already have command '${E}'`)}return u._aliases.push(D),this}aliases(D){if(D===void 0)return this._aliases;return D.forEach((u)=>this.alias(u)),this}usage(D){if(D===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map((F)=>{return CC(F)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=D,this}name(D){if(D===void 0)return this._name;return this._name=D,this}helpGroup(D){if(D===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=D,this}commandsGroup(D){if(D===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=D,this}optionsGroup(D){if(D===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=D,this}_initOptionGroup(D){if(this._defaultOptionGroup&&!D.helpGroupHeading)D.helpGroup(this._defaultOptionGroup)}_initCommandGroup(D){if(this._defaultCommandGroup&&!D.helpGroup())D.helpGroup(this._defaultCommandGroup)}nameFromFilename(D){return this._name=xD.basename(D,xD.extname(D)),this}executableDir(D){if(D===void 0)return this._executableDir;return this._executableDir=D,this}helpInformation(D){let u=this.createHelp(),F=this._getOutputContext(D);u.prepareContext({error:F.error,helpWidth:F.helpWidth,outputHasColors:F.hasColors});let E=u.formatHelp(this,u);if(F.hasColors)return E;return this._outputConfiguration.stripColor(E)}_getOutputContext(D){D=D||{};let u=!!D.error,F,E,C;if(u)F=(t)=>this._outputConfiguration.writeErr(t),E=this._outputConfiguration.getErrHasColors(),C=this._outputConfiguration.getErrHelpWidth();else F=(t)=>this._outputConfiguration.writeOut(t),E=this._outputConfiguration.getOutHasColors(),C=this._outputConfiguration.getOutHelpWidth();return{error:u,write:(t)=>{if(!E)t=this._outputConfiguration.stripColor(t);return F(t)},hasColors:E,helpWidth:C}}outputHelp(D){let u;if(typeof D==="function")u=D,D=void 0;let F=this._getOutputContext(D),E={error:F.error,write:F.write,command:this};this._getCommandAndAncestors().reverse().forEach((B)=>B.emit("beforeAllHelp",E)),this.emit("beforeHelp",E);let C=this.helpInformation({error:F.error});if(u){if(C=u(C),typeof C!=="string"&&!Buffer.isBuffer(C))throw Error("outputHelp callback must return a string or a Buffer")}if(F.write(C),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",E),this._getCommandAndAncestors().forEach((B)=>B.emit("afterAllHelp",E))}helpOption(D,u){if(typeof D==="boolean"){if(D){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(D??"-h, --help",u??"display help for command"),D||u)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(D){return this._helpOption=D,this._initOptionGroup(D),this}help(D){this.outputHelp(D);let u=Number(G.exitCode??0);if(u===0&&D&&typeof D!=="function"&&D.error)u=1;this._exit(u,"commander.help","(outputHelp)")}addHelpText(D,u){let F=["beforeAll","before","after","afterAll"];if(!F.includes(D))throw Error(`Unexpected value for position to addHelpText.
|
|
27
27
|
Expecting one of '${F.join("', '")}'`);let E=`${D}Help`;return this.on(E,(C)=>{let B;if(typeof u==="function")B=u({error:C.error,command:C.command});else B=u;if(B)C.write(`${B}
|
|
28
|
-
`)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((E)=>u.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function
|
|
29
|
-
GFS4: `),console.error(D)};if(!W[c]){if(f0=global[c]||[],j2(W,f0),W.close=function(D){function u(F,E){return D.call(W,F,function(C){if(!C)G2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,_u,{value:D}),u}(W.close),W.closeSync=function(D){function u(F){D.apply(W,arguments),G2()}return Object.defineProperty(u,_u,{value:D}),u}(W.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){JD(W[c]),s("assert").equal(W[c].length,0)})}var f0;if(!global[c])j2(global,W[c]);T0.exports=_0(M3(W));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!W.__patched)T0.exports=_0(W),W.__patched=!0;function _0(D){X3(D),D.gracefulify=_0,D.createReadStream=e,D.createWriteStream=SD;var u=D.readFile;D.readFile=F;function F(n,j,q){if(typeof j==="function")q=j,j=null;return v(n,j,q);function v(d,r,K,P){return u(d,r,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))QD([v,[d,r,K],X,P||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,P,X,o){return E(r,K,P,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=$;function $(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,P,X,o){return B(r,K,P,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var x=D.copyFile;if(x)D.copyFile=S;function S(n,j,q,v){if(typeof q==="function")v=q,q=0;return d(n,j,q,v);function d(r,K,P,X,o){return x(r,K,P,function(U){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var A=D.readdir;D.readdir=H;var t=/^v[0-5]\./;function H(n,j,q){if(typeof j==="function")q=j,j=null;var v=t.test(process.version)?function(K,P,X,o){return A(K,d(K,P,X,o))}:function(K,P,X,o){return A(K,P,d(K,P,X,o))};return v(n,j,q);function d(r,K,P,X){return function(o,U){if(o&&(o.code==="EMFILE"||o.code==="ENFILE"))QD([v,[r,K,P],o,X||Date.now(),Date.now()]);else{if(U&&U.sort)U.sort();if(typeof P==="function")P.call(this,o,U)}}}}if(process.version.substr(0,4)==="v0.8"){var N=z3(D);I=N.ReadStream,T=N.WriteStream}var w=D.ReadStream;if(w)I.prototype=Object.create(w.prototype),I.prototype.open=J;var h=D.WriteStream;if(h)T.prototype=Object.create(h.prototype),T.prototype.open=b;Object.defineProperty(D,"ReadStream",{get:function(){return I},set:function(n){I=n},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return T},set:function(n){T=n},enumerable:!0,configurable:!0});var O=I;Object.defineProperty(D,"FileReadStream",{get:function(){return O},set:function(n){O=n},enumerable:!0,configurable:!0});var _=T;Object.defineProperty(D,"FileWriteStream",{get:function(){return _},set:function(n){_=n},enumerable:!0,configurable:!0});function I(n,j){if(this instanceof I)return w.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function J(){var n=this;Pu(n.path,n.flags,n.mode,function(j,q){if(j){if(n.autoClose)n.destroy();n.emit("error",j)}else n.fd=q,n.emit("open",q),n.read()})}function T(n,j){if(this instanceof T)return h.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function b(){var n=this;Pu(n.path,n.flags,n.mode,function(j,q){if(j)n.destroy(),n.emit("error",j);else n.fd=q,n.emit("open",q)})}function e(n,j){return new D.ReadStream(n,j)}function SD(n,j){return new D.WriteStream(n,j)}var bD=D.open;D.open=Pu;function Pu(n,j,q,v){if(typeof q==="function")v=q,q=null;return d(n,j,q,v);function d(r,K,P,X,o){return bD(r,K,P,function(U,U8){if(U&&(U.code==="EMFILE"||U.code==="ENFILE"))QD([d,[r,K,P,X],U,o||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}return D}function QD(D){JD("ENQUEUE",D[0].name,D[1]),W[c].push(D),n0()}var fu;function G2(){var D=Date.now();for(var u=0;u<W[c].length;++u)if(W[c][u].length>2)W[c][u][3]=D,W[c][u][4]=D;n0()}function n0(){if(clearTimeout(fu),fu=void 0,W[c].length===0)return;var D=W[c].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)JD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){JD("TIMEOUT",u.name,F);var $=F.pop();if(typeof $==="function")$.call(null,E)}else{var x=Date.now()-B,S=Math.max(B-C,1),A=Math.min(S*1.2,100);if(x>=A)JD("RETRY",u.name,F),u.apply(null,F.concat([C]));else W[c].push(D)}if(fu===void 0)fu=setTimeout(n0,0)}});var z2=V((a1,X2)=>{function uD(D,u){if(typeof u==="boolean")u={forever:u};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=u||{},this._maxRetryTime=u&&u.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}X2.exports=uD;uD.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};uD.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};uD.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var u=new Date().getTime();if(D&&u-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var E=this,C=setTimeout(function(){if(E._attempts++,E._operationTimeoutCb){if(E._timeout=setTimeout(function(){E._operationTimeoutCb(E._attempts)},E._operationTimeout),E._options.unref)E._timeout.unref()}E._fn(E._attempts)},F);if(this._options.unref)C.unref();return!0};uD.prototype.attempt=function(D,u){if(this._fn=D,u){if(u.timeout)this._operationTimeout=u.timeout;if(u.cb)this._operationTimeoutCb=u.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};uD.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};uD.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};uD.prototype.start=uD.prototype.try;uD.prototype.errors=function(){return this._errors};uD.prototype.attempts=function(){return this._attempts};uD.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},u=null,F=0;for(var E=0;E<this._errors.length;E++){var C=this._errors[E],B=C.message,$=(D[B]||0)+1;if(D[B]=$,$>=F)u=C,F=$}return u}});var U2=V((L3)=>{var Z3=z2();L3.operation=function(D){var u=L3.timeouts(D);return new Z3(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};L3.timeouts=function(D){if(D instanceof Array)return[].concat(D);var u={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)u[F]=D[F];if(u.minTimeout>u.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var E=[];for(var C=0;C<u.retries;C++)E.push(this.createTimeout(C,u));if(D&&D.forever&&!E.length)E.push(this.createTimeout(C,u));return E.sort(function(B,$){return B-$}),E};L3.createTimeout=function(D,u){var F=u.randomize?Math.random()+1:1,E=Math.round(F*u.minTimeout*Math.pow(u.factor,D));return E=Math.min(E,u.maxTimeout),E};L3.wrap=function(D,u,F){if(u instanceof Array)F=u,u=null;if(!F){F=[];for(var E in D)if(typeof D[E]==="function")F.push(E)}for(var C=0;C<F.length;C++){var B=F[C],$=D[B];D[B]=function(S){var A=L3.operation(u),t=Array.prototype.slice.call(arguments,1),H=t.pop();t.push(function(N){if(A.retry(N))return;if(N)arguments[0]=A.mainError();H.apply(this,arguments)}),A.attempt(function(){S.apply(D,t)})}.bind(D,$),D[B].options=u}}});var Z2=V((p1,nu)=>{nu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")nu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")nu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var L2=V((e1,WD)=>{var Q=global.process,qD=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!qD(Q))WD.exports=function(){return function(){}};else{if(J0=s("assert"),GD=Z2(),q0=/^win/i.test(Q.platform),KD=s("events"),typeof KD!=="function")KD=KD.EventEmitter;if(Q.__signal_exit_emitter__)m=Q.__signal_exit_emitter__;else m=Q.__signal_exit_emitter__=new KD,m.count=0,m.emitted={};if(!m.infinite)m.setMaxListeners(1/0),m.infinite=!0;WD.exports=function(D,u){if(!qD(global.process))return function(){};if(J0.equal(typeof D,"function","a callback must be provided for exit handler"),jD===!1)Tu();var F="exit";if(u&&u.alwaysLast)F="afterexit";var E=function(){if(m.removeListener(F,D),m.listeners("exit").length===0&&m.listeners("afterexit").length===0)Du()};return m.on(F,D),E},Du=function(){if(!jD||!qD(global.process))return;jD=!1,GD.forEach(function(u){try{Q.removeListener(u,uu[u])}catch(F){}}),Q.emit=Fu,Q.reallyExit=Iu,m.count-=1},WD.exports.unload=Du,wD=function(u,F,E){if(m.emitted[u])return;m.emitted[u]=!0,m.emit(u,F,E)},uu={},GD.forEach(function(D){uu[D]=function(){if(!qD(global.process))return;var F=Q.listeners(D);if(F.length===m.count){if(Du(),wD("exit",null,D),wD("afterexit",null,D),q0&&D==="SIGHUP")D="SIGINT";Q.kill(Q.pid,D)}}}),WD.exports.signals=function(){return GD},jD=!1,Tu=function(){if(jD||!qD(global.process))return;jD=!0,m.count+=1,GD=GD.filter(function(u){try{return Q.on(u,uu[u]),!0}catch(F){return!1}}),Q.emit=j0,Q.reallyExit=G0},WD.exports.load=Tu,Iu=Q.reallyExit,G0=function(u){if(!qD(global.process))return;Q.exitCode=u||0,wD("exit",Q.exitCode,null),wD("afterexit",Q.exitCode,null),Iu.call(Q,Q.exitCode)},Fu=Q.emit,j0=function(u,F){if(u==="exit"&&qD(global.process)){if(F!==void 0)Q.exitCode=F;var E=Fu.apply(this,arguments);return wD("exit",Q.exitCode,null),wD("afterexit",Q.exitCode,null),E}else return Fu.apply(this,arguments)}}var J0,GD,q0,KD,m,Du,wD,uu,jD,Tu,Iu,G0,Fu,j0});var Q2=V((P3,X0)=>{var Y2=Symbol();function W3(D,u,F){let E=u[Y2];if(E)return u.stat(D,(B,$)=>{if(B)return F(B);F(null,$.mtime,E)});let C=new Date(Math.ceil(Date.now()/1000)*1000+5);u.utimes(D,C,C,(B)=>{if(B)return F(B);u.stat(D,($,x)=>{if($)return F($);let S=x.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,Y2,{value:S}),F(null,x.mtime,S)})})}function y3(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}P3.probe=W3;P3.getMtime=y3});var V2=V((c3,Cu)=>{var m3=s("path"),U0=I0(),r3=U2(),b3=L2(),K2=Q2(),tD={};function Eu(D,u){return u.lockfilePath||`${D}.lock`}function Z0(D,u,F){if(!u.realpath)return F(null,m3.resolve(D));u.fs.realpath(D,F)}function M0(D,u,F){let E=Eu(D,u);u.fs.mkdir(E,(C)=>{if(!C)return K2.probe(E,u.fs,(B,$,x)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,$,x)});if(C.code!=="EEXIST")return F(C);if(u.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));u.fs.stat(E,(B,$)=>{if(B){if(B.code==="ENOENT")return M0(D,{...u,stale:0},F);return F(B)}if(!W2($,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));y2(D,u,(x)=>{if(x)return F(x);M0(D,{...u,stale:0},F)})})})}function W2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function y2(D,u,F){u.fs.rmdir(Eu(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function Ju(D,u){let F=tD[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||u.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,u.fs.stat(F.lockfilePath,(E,C)=>{let B=F.lastUpdate+u.stale<Date.now();if(E){if(E.code==="ENOENT"||B)return z0(D,F,Object.assign(E,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Ju(D,u)}if(F.mtime.getTime()!==C.mtime.getTime())return z0(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let x=K2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,x,x,(S)=>{let A=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(S){if(S.code==="ENOENT"||A)return z0(D,F,Object.assign(S,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Ju(D,u)}F.mtime=x,F.lastUpdate=Date.now(),F.updateDelay=null,Ju(D,u)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function z0(D,u,F){if(u.released=!0,u.updateTimeout)clearTimeout(u.updateTimeout);if(tD[D]===u)delete tD[D];u.options.onCompromised(F)}function v3(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:U0,onCompromised:(E)=>{throw E},...u},u.retries=u.retries||0,u.retries=typeof u.retries==="number"?{retries:u.retries}:u.retries,u.stale=Math.max(u.stale||0,2000),u.update=u.update==null?u.stale/2:u.update||0,u.update=Math.max(Math.min(u.update,u.stale/2),1000),Z0(D,u,(E,C)=>{if(E)return F(E);let B=r3.operation(u.retries);B.attempt(()=>{M0(C,u,($,x,S)=>{if(B.retry($))return;if($)return F(B.mainError());let A=tD[C]={lockfilePath:Eu(C,u),mtime:x,mtimePrecision:S,options:u,lastUpdate:Date.now()};Ju(C,u),F(null,(t)=>{if(A.released)return t&&t(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));P2(C,{...u,realpath:!1},t)})})})})}function P2(D,u,F){u={fs:U0,realpath:!0,...u},Z0(D,u,(E,C)=>{if(E)return F(E);let B=tD[C];if(!B)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));B.updateTimeout&&clearTimeout(B.updateTimeout),B.released=!0,delete tD[C],y2(C,u,F)})}function d3(D,u,F){u={stale:1e4,realpath:!0,fs:U0,...u},u.stale=Math.max(u.stale||0,2000),Z0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Eu(C,u),(B,$)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!W2($,u))})})}function o3(){return tD}b3(()=>{for(let D in tD){let u=tD[D].options;try{u.fs.rmdirSync(Eu(D,u))}catch(F){}}});c3.lock=v3;c3.unlock=P2;c3.check=d3;c3.getLocks=o3});var m2=V((DB,k2)=>{var l3=I0();function p3(D){let u=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return u.forEach((E)=>{F[E]=(...C)=>{let B=C.pop(),$;try{$=D[`${E}Sync`](...C)}catch(x){return B(x)}B(null,$)}}),F}function e3(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function D8(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function u8(D){if(D={...D},D.fs=p3(D.fs||l3),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}k2.exports={toPromise:e3,toSync:D8,toSyncOptions:u8}});var b2=V((uB,ND)=>{var yD=V2(),{toPromise:qu,toSync:Gu,toSyncOptions:L0}=m2();async function r2(D,u){let F=await qu(yD.lock)(D,u);return qu(F)}function F8(D,u){let F=Gu(yD.lock)(D,L0(u));return Gu(F)}function E8(D,u){return qu(yD.unlock)(D,u)}function C8(D,u){return Gu(yD.unlock)(D,L0(u))}function B8(D,u){return qu(yD.check)(D,u)}function $8(D,u){return Gu(yD.check)(D,L0(u))}ND.exports=r2;ND.exports.lock=r2;ND.exports.unlock=E8;ND.exports.lockSync=F8;ND.exports.unlockSync=C8;ND.exports.check=B8;ND.exports.checkSync=$8});var JE=V((t$,IE)=>{var kD=1000,mD=kD*60,rD=mD*60,UD=rD*24,T8=UD*7,I8=UD*365.25;IE.exports=function(D,u){u=u||{};var F=typeof D;if(F==="string"&&D.length>0)return J8(D);else if(F==="number"&&isFinite(D))return u.long?G8(D):q8(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function J8(D){if(D=String(D),D.length>100)return;var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!u)return;var F=parseFloat(u[1]),E=(u[2]||"ms").toLowerCase();switch(E){case"years":case"year":case"yrs":case"yr":case"y":return F*I8;case"weeks":case"week":case"w":return F*T8;case"days":case"day":case"d":return F*UD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*rD;case"minutes":case"minute":case"mins":case"min":case"m":return F*mD;case"seconds":case"second":case"secs":case"sec":case"s":return F*kD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function q8(D){var u=Math.abs(D);if(u>=UD)return Math.round(D/UD)+"d";if(u>=rD)return Math.round(D/rD)+"h";if(u>=mD)return Math.round(D/mD)+"m";if(u>=kD)return Math.round(D/kD)+"s";return D+"ms"}function G8(D){var u=Math.abs(D);if(u>=UD)return yu(D,u,UD,"day");if(u>=rD)return yu(D,u,rD,"hour");if(u>=mD)return yu(D,u,mD,"minute");if(u>=kD)return yu(D,u,kD,"second");return D+" ms"}function yu(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var fF=vD(OF(),1),{program:V8,createCommand:k8,createArgument:m8,createOption:r8,CommanderError:b8,InvalidArgumentError:v8,InvalidOptionArgumentError:d8,Command:_F,Argument:o8,Option:c8,Help:g8}=fF.default;var nF=(D=0)=>(u)=>`\x1B[${u+D}m`,TF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,IF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,Z={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]}},s8=Object.keys(Z.modifier),jC=Object.keys(Z.color),XC=Object.keys(Z.bgColor),a8=[...jC,...XC];function zC(){let D=new Map;for(let[u,F]of Object.entries(Z)){for(let[E,C]of Object.entries(F))Z[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=Z[E],D.set(C[0],C[1]);Object.defineProperty(Z,u,{value:F,enumerable:!1})}return Object.defineProperty(Z,"codes",{value:D,enumerable:!1}),Z.color.close="\x1B[39m",Z.bgColor.close="\x1B[49m",Z.color.ansi=nF(),Z.color.ansi256=TF(),Z.color.ansi16m=IF(),Z.bgColor.ansi=nF(10),Z.bgColor.ansi256=TF(10),Z.bgColor.ansi16m=IF(10),Object.defineProperties(Z,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>Z.rgbToAnsi256(...Z.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let x=u%36;F=Math.floor(u/36)/5,E=Math.floor(x/6)/5,C=x%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let $=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Z.ansi256ToAnsi(Z.hexToAnsi256(u)),enumerable:!1}}),Z}var MC=zC(),FD=MC;import cu from"process";import UC from"os";import JF from"tty";function DD(D,u=globalThis.Deno?globalThis.Deno.args:cu.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",E=u.indexOf(F+D),C=u.indexOf("--");return E!==-1&&(C===-1||E<C)}var{env:L}=cu,xu;if(DD("no-color")||DD("no-colors")||DD("color=false")||DD("color=never"))xu=0;else if(DD("color")||DD("colors")||DD("color=true")||DD("color=always"))xu=1;function ZC(){if("FORCE_COLOR"in L){if(L.FORCE_COLOR==="true")return 1;if(L.FORCE_COLOR==="false")return 0;return L.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(L.FORCE_COLOR,10),3)}}function LC(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function YC(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=ZC();if(E!==void 0)xu=E;let C=F?xu:E;if(C===0)return 0;if(F){if(DD("color=16m")||DD("color=full")||DD("color=truecolor"))return 3;if(DD("color=256"))return 2}if("TF_BUILD"in L&&"AGENT_NAME"in L)return 1;if(D&&!u&&C===void 0)return 0;let B=C||0;if(L.TERM==="dumb")return B;if(cu.platform==="win32"){let $=UC.release().split(".");if(Number($[0])>=10&&Number($[2])>=10586)return Number($[2])>=14931?3:2;return 1}if("CI"in L){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(($)=>($ in L)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(($)=>($ in L))||L.CI_NAME==="codeship")return 1;return B}if("TEAMCITY_VERSION"in L)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(L.TEAMCITY_VERSION)?1:0;if(L.COLORTERM==="truecolor")return 3;if(L.TERM==="xterm-kitty")return 3;if(L.TERM==="xterm-ghostty")return 3;if(L.TERM==="wezterm")return 3;if("TERM_PROGRAM"in L){let $=Number.parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return $>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(L.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(L.TERM))return 1;if("COLORTERM"in L)return 1;return B}function qF(D,u={}){let F=YC(D,{streamIsTTY:D&&D.isTTY,...u});return LC(F)}var QC={stdout:qF({isTTY:JF.isatty(1)}),stderr:qF({isTTY:JF.isatty(2)})},GF=QC;function jF(D,u,F){let E=D.indexOf(u);if(E===-1)return D;let C=u.length,B=0,$="";do $+=D.slice(B,E)+u+F,B=E+C,E=D.indexOf(u,B);while(E!==-1);return $+=D.slice(B),$}function XF(D,u,F,E){let C=0,B="";do{let $=D[E-1]==="\r";B+=D.slice(C,$?E-1:E)+u+($?`\r
|
|
28
|
+
`)}),this}_outputHelpIfRequested(D){let u=this._getHelpOption();if(u&&D.find((E)=>u.is(E)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function RF(D){return D.map((u)=>{if(!u.startsWith("--inspect"))return u;let F,E="127.0.0.1",C="9229",B;if((B=u.match(/^(--inspect(-brk)?)$/))!==null)F=B[1];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(F=B[1],/^\d+$/.test(B[3]))C=B[3];else E=B[3];else if((B=u.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)F=B[1],E=B[3],C=B[4];if(F&&C!=="0")return`${F}=${E}:${parseInt(C)+1}`;return u})}function cu(){if(G.env.NO_COLOR||G.env.FORCE_COLOR==="0"||G.env.FORCE_COLOR==="false")return!1;if(G.env.FORCE_COLOR||G.env.CLICOLOR_FORCE!==void 0)return!0;return}xC.Command=gu;xC.useColor=cu});var _F=V((wC)=>{var{Argument:fF}=$u(),{Command:iu}=hF(),{CommanderError:nC,InvalidArgumentError:NF}=cD(),{Help:SC}=bu(),{Option:OF}=vu();wC.program=new iu;wC.createCommand=(D)=>new iu(D);wC.createOption=(D,u)=>new OF(D,u);wC.createArgument=(D,u)=>new fF(D,u);wC.Command=iu;wC.Option=OF;wC.Argument=fF;wC.Help=SC;wC.CommanderError=nC;wC.InvalidArgumentError=NF;wC.InvalidOptionArgumentError=NF});var oF=V((y6,vF)=>{vF.exports=lC;function aC(D){let u={defaultWidth:0,output:process.stdout,tty:s("tty")};if(!D)return u;return Object.keys(u).forEach(function(F){if(!D[F])D[F]=u[F]}),D}function lC(D){let u=aC(D);if(u.output.getWindowSize)return u.output.getWindowSize()[0]||u.defaultWidth;if(u.tty.getWindowSize)return u.tty.getWindowSize()[1]||u.defaultWidth;if(u.output.columns)return u.output.columns;if(process.env.CLI_WIDTH){let F=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(F)&&F!==0)return F}return u.defaultWidth}});var x2=V((B1,$2)=>{var n3=s("stream");class t2 extends n3{#F=null;constructor(D={}){super(D);this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=D.replace,this._prompt=D.prompt||null,this._hadControl=!1}#u(D,u){if(this._dest)return this._dest[D];if(this._src)return this._src[D];return u}#D(D,...u){if(typeof this._dest?.[D]==="function")this._dest[D](...u);if(typeof this._src?.[D]==="function")this._src[D](...u)}get isTTY(){if(this.#F!==null)return this.#F;return this.#u("isTTY",!1)}set isTTY(D){this.#F=D}get rows(){return this.#u("rows")}get columns(){return this.#u("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(D){this._src=D}pipe(D,u){return this._dest=D,super.pipe(D,u)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(D){if(this.muted){if(!this.replace)return!0;if(D.match(/^\u001b/)){if(D.indexOf(this._prompt)===0)D=D.slice(this._prompt.length),D=D.replace(/./g,this.replace),D=this._prompt+D;return this._hadControl=!0,this.emit("data",D)}else{if(this._prompt&&this._hadControl&&D.indexOf(this._prompt)===0)this._hadControl=!1,this.emit("data",this._prompt),D=D.slice(this._prompt.length);D=D.toString().replace(/./g,this.replace)}}this.emit("data",D)}end(D){if(this.muted)if(D&&this.replace)D=D.toString().replace(/./g,this.replace);else D=null;if(D)this.emit("data",D);this.emit("end")}destroy(...D){return this.#D("destroy",...D)}destroySoon(...D){return this.#D("destroySoon",...D)}close(...D){return this.#D("close",...D)}}$2.exports=t2});var I2=V((c1,T2)=>{var wD=s("constants"),T3=process.cwd,fu=null,I3=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!fu)fu=T3.call(process);return fu};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(Nu=process.chdir,process.chdir=function(D){fu=null,Nu.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,Nu)}var Nu;T2.exports=J3;function J3(D){if(wD.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))u(D);if(!D.lutimes)F(D);if(D.chown=B(D.chown),D.fchown=B(D.fchown),D.lchown=B(D.lchown),D.chmod=E(D.chmod),D.fchmod=E(D.fchmod),D.lchmod=E(D.lchmod),D.chownSync=t(D.chownSync),D.fchownSync=t(D.fchownSync),D.lchownSync=t(D.lchownSync),D.chmodSync=C(D.chmodSync),D.fchmodSync=C(D.fchmodSync),D.lchmodSync=C(D.lchmodSync),D.stat=$(D.stat),D.fstat=$(D.fstat),D.lstat=$(D.lstat),D.statSync=n(D.statSync),D.fstatSync=n(D.fstatSync),D.lstatSync=n(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(x,H,R){if(R)process.nextTick(R)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(x,H,R,w){if(w)process.nextTick(w)},D.lchownSync=function(){};if(I3==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(x){function H(R,w,h){var f=Date.now(),O=0;x(R,w,function I(J){if(J&&(J.code==="EACCES"||J.code==="EPERM"||J.code==="EBUSY")&&Date.now()-f<60000){if(setTimeout(function(){D.stat(w,function(T,b){if(T&&T.code==="ENOENT")x(R,w,I);else h(J)})},O),O<100)O+=10;return}if(h)h(J)})}if(Object.setPrototypeOf)Object.setPrototypeOf(H,x);return H}(D.rename);D.read=typeof D.read!=="function"?D.read:function(x){function H(R,w,h,f,O,I){var J;if(I&&typeof I==="function"){var T=0;J=function(b,e,SD){if(b&&b.code==="EAGAIN"&&T<10)return T++,x.call(D,R,w,h,f,O,J);I.apply(this,arguments)}}return x.call(D,R,w,h,f,O,J)}if(Object.setPrototypeOf)Object.setPrototypeOf(H,x);return H}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(x){return function(H,R,w,h,f){var O=0;while(!0)try{return x.call(D,H,R,w,h,f)}catch(I){if(I.code==="EAGAIN"&&O<10){O++;continue}throw I}}}(D.readSync);function u(x){x.lchmod=function(H,R,w){x.open(H,wD.O_WRONLY|wD.O_SYMLINK,R,function(h,f){if(h){if(w)w(h);return}x.fchmod(f,R,function(O){x.close(f,function(I){if(w)w(O||I)})})})},x.lchmodSync=function(H,R){var w=x.openSync(H,wD.O_WRONLY|wD.O_SYMLINK,R),h=!0,f;try{f=x.fchmodSync(w,R),h=!1}finally{if(h)try{x.closeSync(w)}catch(O){}else x.closeSync(w)}return f}}function F(x){if(wD.hasOwnProperty("O_SYMLINK")&&x.futimes)x.lutimes=function(H,R,w,h){x.open(H,wD.O_SYMLINK,function(f,O){if(f){if(h)h(f);return}x.futimes(O,R,w,function(I){x.close(O,function(J){if(h)h(I||J)})})})},x.lutimesSync=function(H,R,w){var h=x.openSync(H,wD.O_SYMLINK),f,O=!0;try{f=x.futimesSync(h,R,w),O=!1}finally{if(O)try{x.closeSync(h)}catch(I){}else x.closeSync(h)}return f};else if(x.futimes)x.lutimes=function(H,R,w,h){if(h)process.nextTick(h)},x.lutimesSync=function(){}}function E(x){if(!x)return x;return function(H,R,w){return x.call(D,H,R,function(h){if(A(h))h=null;if(w)w.apply(this,arguments)})}}function C(x){if(!x)return x;return function(H,R){try{return x.call(D,H,R)}catch(w){if(!A(w))throw w}}}function B(x){if(!x)return x;return function(H,R,w,h){return x.call(D,H,R,w,function(f){if(A(f))f=null;if(h)h.apply(this,arguments)})}}function t(x){if(!x)return x;return function(H,R,w){try{return x.call(D,H,R,w)}catch(h){if(!A(h))throw h}}}function $(x){if(!x)return x;return function(H,R,w){if(typeof R==="function")w=R,R=null;function h(f,O){if(O){if(O.uid<0)O.uid+=4294967296;if(O.gid<0)O.gid+=4294967296}if(w)w.apply(this,arguments)}return R?x.call(D,H,R,h):x.call(D,H,h)}}function n(x){if(!x)return x;return function(H,R){var w=R?x.call(D,H,R):x.call(D,H);if(w){if(w.uid<0)w.uid+=4294967296;if(w.gid<0)w.gid+=4294967296}return w}}function A(x){if(!x)return!0;if(x.code==="ENOSYS")return!0;var H=!process.getuid||process.getuid()!==0;if(H){if(x.code==="EINVAL"||x.code==="EPERM")return!0}return!1}}});var G2=V((g1,q2)=>{var J2=s("stream").Stream;q2.exports=q3;function q3(D){return{ReadStream:u,WriteStream:F};function u(E,C){if(!(this instanceof u))return new u(E,C);J2.call(this);var B=this;this.path=E,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,C=C||{};var t=Object.keys(C);for(var $=0,n=t.length;$<n;$++){var A=t[$];this[A]=C[A]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){B._read()});return}D.open(this.path,this.flags,this.mode,function(x,H){if(x){B.emit("error",x),B.readable=!1;return}B.fd=H,B.emit("open",H),B._read()})}function F(E,C){if(!(this instanceof F))return new F(E,C);J2.call(this),this.path=E,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,C=C||{};var B=Object.keys(C);for(var t=0,$=B.length;t<$;t++){var n=B[t];this[n]=C[n]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var X2=V((i1,j2)=>{j2.exports=j3;var G3=Object.getPrototypeOf||function(D){return D.__proto__};function j3(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var u={__proto__:G3(D)};else var u=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty(u,F,Object.getOwnPropertyDescriptor(D,F))}),u}});var G0=V((s1,q0)=>{var W=s("fs"),X3=I2(),z3=G2(),U3=X2(),Ou=s("util"),c,Tu;if(typeof Symbol==="function"&&typeof Symbol.for==="function")c=Symbol.for("graceful-fs.queue"),Tu=Symbol.for("graceful-fs.previous");else c="___graceful-fs.queue",Tu="___graceful-fs.previous";function M3(){}function U2(D,u){Object.defineProperty(D,c,{get:function(){return u}})}var qD=M3;if(Ou.debuglog)qD=Ou.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))qD=function(){var D=Ou.format.apply(Ou,arguments);D="GFS4: "+D.split(/\n/).join(`
|
|
29
|
+
GFS4: `),console.error(D)};if(!W[c]){if(T0=global[c]||[],U2(W,T0),W.close=function(D){function u(F,E){return D.call(W,F,function(C){if(!C)z2();if(typeof E==="function")E.apply(this,arguments)})}return Object.defineProperty(u,Tu,{value:D}),u}(W.close),W.closeSync=function(D){function u(F){D.apply(W,arguments),z2()}return Object.defineProperty(u,Tu,{value:D}),u}(W.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){qD(W[c]),s("assert").equal(W[c].length,0)})}var T0;if(!global[c])U2(global,W[c]);q0.exports=I0(U3(W));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!W.__patched)q0.exports=I0(W),W.__patched=!0;function I0(D){X3(D),D.gracefulify=I0,D.createReadStream=e,D.createWriteStream=SD;var u=D.readFile;D.readFile=F;function F(_,j,q){if(typeof j==="function")q=j,j=null;return v(_,j,q);function v(o,r,K,P){return u(o,r,function(X){if(X&&(X.code==="EMFILE"||X.code==="ENFILE"))QD([v,[o,r,K],X,P||Date.now(),Date.now()]);else if(typeof K==="function")K.apply(this,arguments)})}}var E=D.writeFile;D.writeFile=C;function C(_,j,q,v){if(typeof q==="function")v=q,q=null;return o(_,j,q,v);function o(r,K,P,X,d){return E(r,K,P,function(M){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var B=D.appendFile;if(B)D.appendFile=t;function t(_,j,q,v){if(typeof q==="function")v=q,q=null;return o(_,j,q,v);function o(r,K,P,X,d){return B(r,K,P,function(M){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var $=D.copyFile;if($)D.copyFile=n;function n(_,j,q,v){if(typeof q==="function")v=q,q=0;return o(_,j,q,v);function o(r,K,P,X,d){return $(r,K,P,function(M){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}var A=D.readdir;D.readdir=H;var x=/^v[0-5]\./;function H(_,j,q){if(typeof j==="function")q=j,j=null;var v=x.test(process.version)?function(K,P,X,d){return A(K,o(K,P,X,d))}:function(K,P,X,d){return A(K,P,o(K,P,X,d))};return v(_,j,q);function o(r,K,P,X){return function(d,M){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))QD([v,[r,K,P],d,X||Date.now(),Date.now()]);else{if(M&&M.sort)M.sort();if(typeof P==="function")P.call(this,d,M)}}}}if(process.version.substr(0,4)==="v0.8"){var R=z3(D);I=R.ReadStream,T=R.WriteStream}var w=D.ReadStream;if(w)I.prototype=Object.create(w.prototype),I.prototype.open=J;var h=D.WriteStream;if(h)T.prototype=Object.create(h.prototype),T.prototype.open=b;Object.defineProperty(D,"ReadStream",{get:function(){return I},set:function(_){I=_},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return T},set:function(_){T=_},enumerable:!0,configurable:!0});var f=I;Object.defineProperty(D,"FileReadStream",{get:function(){return f},set:function(_){f=_},enumerable:!0,configurable:!0});var O=T;Object.defineProperty(D,"FileWriteStream",{get:function(){return O},set:function(_){O=_},enumerable:!0,configurable:!0});function I(_,j){if(this instanceof I)return w.apply(this,arguments),this;else return I.apply(Object.create(I.prototype),arguments)}function J(){var _=this;mu(_.path,_.flags,_.mode,function(j,q){if(j){if(_.autoClose)_.destroy();_.emit("error",j)}else _.fd=q,_.emit("open",q),_.read()})}function T(_,j){if(this instanceof T)return h.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function b(){var _=this;mu(_.path,_.flags,_.mode,function(j,q){if(j)_.destroy(),_.emit("error",j);else _.fd=q,_.emit("open",q)})}function e(_,j){return new D.ReadStream(_,j)}function SD(_,j){return new D.WriteStream(_,j)}var oD=D.open;D.open=mu;function mu(_,j,q,v){if(typeof q==="function")v=q,q=null;return o(_,j,q,v);function o(r,K,P,X,d){return oD(r,K,P,function(M,M8){if(M&&(M.code==="EMFILE"||M.code==="ENFILE"))QD([o,[r,K,P,X],M,d||Date.now(),Date.now()]);else if(typeof X==="function")X.apply(this,arguments)})}}return D}function QD(D){qD("ENQUEUE",D[0].name,D[1]),W[c].push(D),J0()}var _u;function z2(){var D=Date.now();for(var u=0;u<W[c].length;++u)if(W[c][u].length>2)W[c][u][3]=D,W[c][u][4]=D;J0()}function J0(){if(clearTimeout(_u),_u=void 0,W[c].length===0)return;var D=W[c].shift(),u=D[0],F=D[1],E=D[2],C=D[3],B=D[4];if(C===void 0)qD("RETRY",u.name,F),u.apply(null,F);else if(Date.now()-C>=60000){qD("TIMEOUT",u.name,F);var t=F.pop();if(typeof t==="function")t.call(null,E)}else{var $=Date.now()-B,n=Math.max(B-C,1),A=Math.min(n*1.2,100);if($>=A)qD("RETRY",u.name,F),u.apply(null,F.concat([C]));else W[c].push(D)}if(_u===void 0)_u=setTimeout(J0,0)}});var Z2=V((a1,M2)=>{function FD(D,u){if(typeof u==="boolean")u={forever:u};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=u||{},this._maxRetryTime=u&&u.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}M2.exports=FD;FD.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};FD.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};FD.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var u=new Date().getTime();if(D&&u-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var E=this,C=setTimeout(function(){if(E._attempts++,E._operationTimeoutCb){if(E._timeout=setTimeout(function(){E._operationTimeoutCb(E._attempts)},E._operationTimeout),E._options.unref)E._timeout.unref()}E._fn(E._attempts)},F);if(this._options.unref)C.unref();return!0};FD.prototype.attempt=function(D,u){if(this._fn=D,u){if(u.timeout)this._operationTimeout=u.timeout;if(u.cb)this._operationTimeoutCb=u.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};FD.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};FD.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};FD.prototype.start=FD.prototype.try;FD.prototype.errors=function(){return this._errors};FD.prototype.attempts=function(){return this._attempts};FD.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},u=null,F=0;for(var E=0;E<this._errors.length;E++){var C=this._errors[E],B=C.message,t=(D[B]||0)+1;if(D[B]=t,t>=F)u=C,F=t}return u}});var Y2=V((L3)=>{var Z3=Z2();L3.operation=function(D){var u=L3.timeouts(D);return new Z3(u,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};L3.timeouts=function(D){if(D instanceof Array)return[].concat(D);var u={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)u[F]=D[F];if(u.minTimeout>u.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var E=[];for(var C=0;C<u.retries;C++)E.push(this.createTimeout(C,u));if(D&&D.forever&&!E.length)E.push(this.createTimeout(C,u));return E.sort(function(B,t){return B-t}),E};L3.createTimeout=function(D,u){var F=u.randomize?Math.random()+1:1,E=Math.round(F*u.minTimeout*Math.pow(u.factor,D));return E=Math.min(E,u.maxTimeout),E};L3.wrap=function(D,u,F){if(u instanceof Array)F=u,u=null;if(!F){F=[];for(var E in D)if(typeof D[E]==="function")F.push(E)}for(var C=0;C<F.length;C++){var B=F[C],t=D[B];D[B]=function(n){var A=L3.operation(u),x=Array.prototype.slice.call(arguments,1),H=x.pop();x.push(function(R){if(A.retry(R))return;if(R)arguments[0]=A.mainError();H.apply(this,arguments)}),A.attempt(function(){n.apply(D,x)})}.bind(D,t),D[B].options=u}}});var Q2=V((p1,Iu)=>{Iu.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")Iu.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")Iu.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var K2=V((e1,WD)=>{var Q=global.process,GD=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!GD(Q))WD.exports=function(){return function(){}};else{if(j0=s("assert"),jD=Q2(),X0=/^win/i.test(Q.platform),KD=s("events"),typeof KD!=="function")KD=KD.EventEmitter;if(Q.__signal_exit_emitter__)m=Q.__signal_exit_emitter__;else m=Q.__signal_exit_emitter__=new KD,m.count=0,m.emitted={};if(!m.infinite)m.setMaxListeners(1/0),m.infinite=!0;WD.exports=function(D,u){if(!GD(global.process))return function(){};if(j0.equal(typeof D,"function","a callback must be provided for exit handler"),XD===!1)Ju();var F="exit";if(u&&u.alwaysLast)F="afterexit";var E=function(){if(m.removeListener(F,D),m.listeners("exit").length===0&&m.listeners("afterexit").length===0)Fu()};return m.on(F,D),E},Fu=function(){if(!XD||!GD(global.process))return;XD=!1,jD.forEach(function(u){try{Q.removeListener(u,Eu[u])}catch(F){}}),Q.emit=Cu,Q.reallyExit=qu,m.count-=1},WD.exports.unload=Fu,RD=function(u,F,E){if(m.emitted[u])return;m.emitted[u]=!0,m.emit(u,F,E)},Eu={},jD.forEach(function(D){Eu[D]=function(){if(!GD(global.process))return;var F=Q.listeners(D);if(F.length===m.count){if(Fu(),RD("exit",null,D),RD("afterexit",null,D),X0&&D==="SIGHUP")D="SIGINT";Q.kill(Q.pid,D)}}}),WD.exports.signals=function(){return jD},XD=!1,Ju=function(){if(XD||!GD(global.process))return;XD=!0,m.count+=1,jD=jD.filter(function(u){try{return Q.on(u,Eu[u]),!0}catch(F){return!1}}),Q.emit=U0,Q.reallyExit=z0},WD.exports.load=Ju,qu=Q.reallyExit,z0=function(u){if(!GD(global.process))return;Q.exitCode=u||0,RD("exit",Q.exitCode,null),RD("afterexit",Q.exitCode,null),qu.call(Q,Q.exitCode)},Cu=Q.emit,U0=function(u,F){if(u==="exit"&&GD(global.process)){if(F!==void 0)Q.exitCode=F;var E=Cu.apply(this,arguments);return RD("exit",Q.exitCode,null),RD("afterexit",Q.exitCode,null),E}else return Cu.apply(this,arguments)}}var j0,jD,X0,KD,m,Fu,RD,Eu,XD,Ju,qu,z0,Cu,U0});var y2=V((P3,M0)=>{var W2=Symbol();function W3(D,u,F){let E=u[W2];if(E)return u.stat(D,(B,t)=>{if(B)return F(B);F(null,t.mtime,E)});let C=new Date(Math.ceil(Date.now()/1000)*1000+5);u.utimes(D,C,C,(B)=>{if(B)return F(B);u.stat(D,(t,$)=>{if(t)return F(t);let n=$.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(u,W2,{value:n}),F(null,$.mtime,n)})})}function y3(D){let u=Date.now();if(D==="s")u=Math.ceil(u/1000)*1000;return new Date(u)}P3.probe=W3;P3.getMtime=y3});var r2=V((c3,tu)=>{var m3=s("path"),Y0=G0(),r3=Y2(),b3=K2(),P2=y2(),AD={};function Bu(D,u){return u.lockfilePath||`${D}.lock`}function Q0(D,u,F){if(!u.realpath)return F(null,m3.resolve(D));u.fs.realpath(D,F)}function L0(D,u,F){let E=Bu(D,u);u.fs.mkdir(E,(C)=>{if(!C)return P2.probe(E,u.fs,(B,t,$)=>{if(B)return u.fs.rmdir(E,()=>{}),F(B);F(null,t,$)});if(C.code!=="EEXIST")return F(C);if(u.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));u.fs.stat(E,(B,t)=>{if(B){if(B.code==="ENOENT")return L0(D,{...u,stale:0},F);return F(B)}if(!V2(t,u))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));k2(D,u,($)=>{if($)return F($);L0(D,{...u,stale:0},F)})})})}function V2(D,u){return D.mtime.getTime()<Date.now()-u.stale}function k2(D,u,F){u.fs.rmdir(Bu(D,u),(E)=>{if(E&&E.code!=="ENOENT")return F(E);F()})}function Gu(D,u){let F=AD[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||u.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,u.fs.stat(F.lockfilePath,(E,C)=>{let B=F.lastUpdate+u.stale<Date.now();if(E){if(E.code==="ENOENT"||B)return Z0(D,F,Object.assign(E,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Gu(D,u)}if(F.mtime.getTime()!==C.mtime.getTime())return Z0(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let $=P2.getMtime(F.mtimePrecision);u.fs.utimes(F.lockfilePath,$,$,(n)=>{let A=F.lastUpdate+u.stale<Date.now();if(F.released)return;if(n){if(n.code==="ENOENT"||A)return Z0(D,F,Object.assign(n,{code:"ECOMPROMISED"}));return F.updateDelay=1000,Gu(D,u)}F.mtime=$,F.lastUpdate=Date.now(),F.updateDelay=null,Gu(D,u)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function Z0(D,u,F){if(u.released=!0,u.updateTimeout)clearTimeout(u.updateTimeout);if(AD[D]===u)delete AD[D];u.options.onCompromised(F)}function v3(D,u,F){u={stale:1e4,update:null,realpath:!0,retries:0,fs:Y0,onCompromised:(E)=>{throw E},...u},u.retries=u.retries||0,u.retries=typeof u.retries==="number"?{retries:u.retries}:u.retries,u.stale=Math.max(u.stale||0,2000),u.update=u.update==null?u.stale/2:u.update||0,u.update=Math.max(Math.min(u.update,u.stale/2),1000),Q0(D,u,(E,C)=>{if(E)return F(E);let B=r3.operation(u.retries);B.attempt(()=>{L0(C,u,(t,$,n)=>{if(B.retry(t))return;if(t)return F(B.mainError());let A=AD[C]={lockfilePath:Bu(C,u),mtime:$,mtimePrecision:n,options:u,lastUpdate:Date.now()};Gu(C,u),F(null,(x)=>{if(A.released)return x&&x(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));m2(C,{...u,realpath:!1},x)})})})})}function m2(D,u,F){u={fs:Y0,realpath:!0,...u},Q0(D,u,(E,C)=>{if(E)return F(E);let B=AD[C];if(!B)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));B.updateTimeout&&clearTimeout(B.updateTimeout),B.released=!0,delete AD[C],k2(C,u,F)})}function o3(D,u,F){u={stale:1e4,realpath:!0,fs:Y0,...u},u.stale=Math.max(u.stale||0,2000),Q0(D,u,(E,C)=>{if(E)return F(E);u.fs.stat(Bu(C,u),(B,t)=>{if(B)return B.code==="ENOENT"?F(null,!1):F(B);return F(null,!V2(t,u))})})}function d3(){return AD}b3(()=>{for(let D in AD){let u=AD[D].options;try{u.fs.rmdirSync(Bu(D,u))}catch(F){}}});c3.lock=v3;c3.unlock=m2;c3.check=o3;c3.getLocks=d3});var v2=V((DB,b2)=>{var l3=G0();function p3(D){let u=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return u.forEach((E)=>{F[E]=(...C)=>{let B=C.pop(),t;try{t=D[`${E}Sync`](...C)}catch($){return B($)}B(null,t)}}),F}function e3(D){return(...u)=>new Promise((F,E)=>{u.push((C,B)=>{if(C)E(C);else F(B)}),D(...u)})}function D8(D){return(...u)=>{let F,E;if(u.push((C,B)=>{F=C,E=B}),D(...u),F)throw F;return E}}function u8(D){if(D={...D},D.fs=p3(D.fs||l3),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}b2.exports={toPromise:e3,toSync:D8,toSyncOptions:u8}});var d2=V((uB,hD)=>{var yD=r2(),{toPromise:ju,toSync:Xu,toSyncOptions:K0}=v2();async function o2(D,u){let F=await ju(yD.lock)(D,u);return ju(F)}function F8(D,u){let F=Xu(yD.lock)(D,K0(u));return Xu(F)}function E8(D,u){return ju(yD.unlock)(D,u)}function C8(D,u){return Xu(yD.unlock)(D,K0(u))}function B8(D,u){return ju(yD.check)(D,u)}function t8(D,u){return Xu(yD.check)(D,K0(u))}hD.exports=o2;hD.exports.lock=o2;hD.exports.unlock=E8;hD.exports.lockSync=F8;hD.exports.unlockSync=C8;hD.exports.check=B8;hD.exports.checkSync=t8});var JE=V((Ht,IE)=>{var rD=1000,bD=rD*60,vD=bD*60,ZD=vD*24,T8=ZD*7,I8=ZD*365.25;IE.exports=function(D,u){u=u||{};var F=typeof D;if(F==="string"&&D.length>0)return J8(D);else if(F==="number"&&isFinite(D))return u.long?G8(D):q8(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function J8(D){if(D=String(D),D.length>100)return;var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!u)return;var F=parseFloat(u[1]),E=(u[2]||"ms").toLowerCase();switch(E){case"years":case"year":case"yrs":case"yr":case"y":return F*I8;case"weeks":case"week":case"w":return F*T8;case"days":case"day":case"d":return F*ZD;case"hours":case"hour":case"hrs":case"hr":case"h":return F*vD;case"minutes":case"minute":case"mins":case"min":case"m":return F*bD;case"seconds":case"second":case"secs":case"sec":case"s":return F*rD;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function q8(D){var u=Math.abs(D);if(u>=ZD)return Math.round(D/ZD)+"d";if(u>=vD)return Math.round(D/vD)+"h";if(u>=bD)return Math.round(D/bD)+"m";if(u>=rD)return Math.round(D/rD)+"s";return D+"ms"}function G8(D){var u=Math.abs(D);if(u>=ZD)return ku(D,u,ZD,"day");if(u>=vD)return ku(D,u,vD,"hour");if(u>=bD)return ku(D,u,bD,"minute");if(u>=rD)return ku(D,u,rD,"second");return D+" ms"}function ku(D,u,F,E){var C=u>=F*1.5;return Math.round(D/F)+" "+E+(C?"s":"")}});var TF=dD(_F(),1),{program:V8,createCommand:k8,createArgument:m8,createOption:r8,CommanderError:b8,InvalidArgumentError:v8,InvalidOptionArgumentError:o8,Command:IF,Argument:d8,Option:c8,Help:g8}=TF.default;var JF=(D=0)=>(u)=>`\x1B[${u+D}m`,qF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,GF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,Z={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]}},s8=Object.keys(Z.modifier),jC=Object.keys(Z.color),XC=Object.keys(Z.bgColor),a8=[...jC,...XC];function zC(){let D=new Map;for(let[u,F]of Object.entries(Z)){for(let[E,C]of Object.entries(F))Z[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=Z[E],D.set(C[0],C[1]);Object.defineProperty(Z,u,{value:F,enumerable:!1})}return Object.defineProperty(Z,"codes",{value:D,enumerable:!1}),Z.color.close="\x1B[39m",Z.bgColor.close="\x1B[49m",Z.color.ansi=JF(),Z.color.ansi256=qF(),Z.color.ansi16m=GF(),Z.bgColor.ansi=JF(10),Z.bgColor.ansi256=qF(10),Z.bgColor.ansi16m=GF(10),Object.defineProperties(Z,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>Z.rgbToAnsi256(...Z.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let $=u%36;F=Math.floor(u/36)/5,E=Math.floor($/6)/5,C=$%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let t=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)t+=60;return t},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>Z.ansi256ToAnsi(Z.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Z.ansi256ToAnsi(Z.hexToAnsi256(u)),enumerable:!1}}),Z}var UC=zC(),ED=UC;import su from"process";import MC from"os";import jF from"tty";function DD(D,u=globalThis.Deno?globalThis.Deno.args:su.argv){let F=D.startsWith("-")?"":D.length===1?"-":"--",E=u.indexOf(F+D),C=u.indexOf("--");return E!==-1&&(C===-1||E<C)}var{env:L}=su,Au;if(DD("no-color")||DD("no-colors")||DD("color=false")||DD("color=never"))Au=0;else if(DD("color")||DD("colors")||DD("color=true")||DD("color=always"))Au=1;function ZC(){if("FORCE_COLOR"in L){if(L.FORCE_COLOR==="true")return 1;if(L.FORCE_COLOR==="false")return 0;return L.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(L.FORCE_COLOR,10),3)}}function LC(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function YC(D,{streamIsTTY:u,sniffFlags:F=!0}={}){let E=ZC();if(E!==void 0)Au=E;let C=F?Au:E;if(C===0)return 0;if(F){if(DD("color=16m")||DD("color=full")||DD("color=truecolor"))return 3;if(DD("color=256"))return 2}if("TF_BUILD"in L&&"AGENT_NAME"in L)return 1;if(D&&!u&&C===void 0)return 0;let B=C||0;if(L.TERM==="dumb")return B;if(su.platform==="win32"){let t=MC.release().split(".");if(Number(t[0])>=10&&Number(t[2])>=10586)return Number(t[2])>=14931?3:2;return 1}if("CI"in L){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((t)=>(t in L)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((t)=>(t in L))||L.CI_NAME==="codeship")return 1;return B}if("TEAMCITY_VERSION"in L)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(L.TEAMCITY_VERSION)?1:0;if(L.COLORTERM==="truecolor")return 3;if(L.TERM==="xterm-kitty")return 3;if(L.TERM==="xterm-ghostty")return 3;if(L.TERM==="wezterm")return 3;if("TERM_PROGRAM"in L){let t=Number.parseInt((L.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(L.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(L.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(L.TERM))return 1;if("COLORTERM"in L)return 1;return B}function XF(D,u={}){let F=YC(D,{streamIsTTY:D&&D.isTTY,...u});return LC(F)}var QC={stdout:XF({isTTY:jF.isatty(1)}),stderr:XF({isTTY:jF.isatty(2)})},zF=QC;function UF(D,u,F){let E=D.indexOf(u);if(E===-1)return D;let C=u.length,B=0,t="";do t+=D.slice(B,E)+u+F,B=E+C,E=D.indexOf(u,B);while(E!==-1);return t+=D.slice(B),t}function MF(D,u,F,E){let C=0,B="";do{let t=D[E-1]==="\r";B+=D.slice(C,t?E-1:E)+u+(t?`\r
|
|
30
30
|
`:`
|
|
31
31
|
`)+F,C=E+1,E=D.indexOf(`
|
|
32
|
-
`,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:
|
|
33
|
-
`);if(B!==-1)u=XF(u,C,E,B);return E+u+C};Object.defineProperties(cD.prototype,LD);var kC=cD(),$6=cD({level:MF?MF.level:0});var R=kC;var au=(D)=>D.name==="backspace",gD=(D)=>D.name==="tab";var iD=(D)=>D.name==="enter"||D.name==="return";class lu extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class pu extends Error{name="CancelPromptError";message="Prompt was canceled"}class YD extends Error{name="ExitPromptError"}class eu extends Error{name="HookError"}class D0 extends Error{name="ValidationError"}import{AsyncResource as vC}from"async_hooks";import{AsyncLocalStorage as mC,AsyncResource as rC}from"async_hooks";var ZF=new mC;function bC(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function LF(D,u){let F=bC(D);return ZF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function OD(){let D=ZF.getStore();if(!D)throw new eu("[Inquirer] Hook functions can only be called from within a prompt");return D}function u0(){return OD().rl}function F0(D){let u=(...F)=>{let E=OD(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let $=D(...F);if(C)B();return E.handleChange=B,$};return rC.bind(u)}function Au(D){let u=OD(),{index:F}=u,E={get(){return u.hooks[F]},set(B){u.hooks[F]=B},initialized:F in u.hooks},C=D(E);return u.index++,C}function YF(){OD().handleChange()}var fD={queue(D){let u=OD(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D(u0());if(E!=null&&typeof E!=="function")throw new D0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=OD();F0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=OD();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function l(D){return Au((u)=>{let F=vC.bind(function(B){if(u.get()!==B)u.set(B),YF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function _D(D,u){Au((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,$)=>!Object.is(B,E[$])))fD.queue(D);F.set(u)})}import{styleText as ED}from"util";import CD from"process";function dC(){if(CD.platform!=="win32")return CD.env.TERM!=="linux";return Boolean(CD.env.WT_SESSION)||Boolean(CD.env.TERMINUS_SUBLIME)||CD.env.ConEmuTask==="{cmd::Cmder}"||CD.env.TERM_PROGRAM==="Terminus-Sublime"||CD.env.TERM_PROGRAM==="vscode"||CD.env.TERM==="xterm-256color"||CD.env.TERM==="alacritty"||CD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var QF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},KF={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},oC={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cC={...QF,...KF},gC={...QF,...oC},iC=dC(),sC=iC?cC:gC,WF=sC,n6=Object.entries(KF);var yF={prefix:{idle:ED("blue","?"),done:ED("green",WF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>ED("yellow",D))},style:{answer:(D)=>ED("cyan",D),message:(D)=>ED("bold",D),error:(D)=>ED("red",`> ${D}`),defaultAnswer:(D)=>ED("dim",`(${D})`),help:(D)=>ED("dim",D),highlight:(D)=>ED("cyan",D),key:(D)=>ED("cyan",ED("bold",`<${D}>`))}};function PF(D){if(typeof D!=="object"||D===null)return!1;let u=D;while(Object.getPrototypeOf(u)!==null)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(D)===u}function VF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=PF(B)&&PF(C)?VF(B,C):C}return u}function nD(...D){let u=[yF,...D.filter((F)=>F!=null)];return VF(...u)}function sD({status:D="idle",theme:u}){let[F,E]=l(!1),[C,B]=l(0),{prefix:$,spinner:x}=nD(u);if(_D(()=>{if(D==="loading"){let A,t=-1,H=setTimeout(()=>{E(!0),A=setInterval(()=>{t=t+1,B(t%x.frames.length)},x.interval)},300);return()=>{clearTimeout(H),clearInterval(A)}}else E(!1)},[D]),F)return x.frames[C];return typeof $==="string"?$:$[D==="loading"?"idle":D]??$.idle}function kF(D){return l({current:D})[0]}function aD(D){let u=kF(D);u.current=D,_D((F)=>{let E=!1,C=F0((B,$)=>{if(E)return;u.current($,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var u2=vD(rF(),1);function E0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var pC=E0();function lD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(pC,"")}function bF(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function vF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function dF(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function eC(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function oF(D,{ambiguousAsWide:u=!1}={}){if(eC(D),vF(D)||dF(D)||u&&bF(D))return 2;return 1}var cF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var D3=new Intl.Segmenter,u3=/^\p{Default_Ignorable_Code_Point}$/u;function TD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=lD(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:$}of D3.segment(D)){let x=$.codePointAt(0);if(x<=31||x>=127&&x<=159)continue;if(x>=8203&&x<=8207||x===65279)continue;if(x>=768&&x<=879||x>=6832&&x<=6911||x>=7616&&x<=7679||x>=8400&&x<=8447||x>=65056&&x<=65071)continue;if(x>=55296&&x<=57343)continue;if(x>=65024&&x<=65039)continue;if(u3.test($))continue;if(cF().test($)){C+=2;continue}C+=oF(x,B)}return C}var gF=(D=0)=>(u)=>`\x1B[${u+D}m`,iF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,sF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,Y={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]}},s6=Object.keys(Y.modifier),F3=Object.keys(Y.color),E3=Object.keys(Y.bgColor),a6=[...F3,...E3];function C3(){let D=new Map;for(let[u,F]of Object.entries(Y)){for(let[E,C]of Object.entries(F))Y[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=Y[E],D.set(C[0],C[1]);Object.defineProperty(Y,u,{value:F,enumerable:!1})}return Object.defineProperty(Y,"codes",{value:D,enumerable:!1}),Y.color.close="\x1B[39m",Y.bgColor.close="\x1B[49m",Y.color.ansi=gF(),Y.color.ansi256=iF(),Y.color.ansi16m=sF(),Y.bgColor.ansi=gF(10),Y.bgColor.ansi256=iF(10),Y.bgColor.ansi16m=sF(10),Object.defineProperties(Y,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>Y.rgbToAnsi256(...Y.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let x=u%36;F=Math.floor(u/36)/5,E=Math.floor(x/6)/5,C=x%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let $=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>Y.ansi256ToAnsi(Y.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Y.ansi256ToAnsi(Y.hexToAnsi256(u)),enumerable:!1}}),Y}var B3=C3(),aF=B3;var Su=new Set(["\x1B","\x9B"]),$3=39,B0="\x07",eF="[",x3="]",D2="m",Hu=`${x3}8;;`,lF=(D)=>`${Su.values().next().value}${eF}${D}${D2}`,pF=(D)=>`${Su.values().next().value}${Hu}${D}${B0}`,t3=(D)=>D.split(" ").map((u)=>TD(u)),C0=(D,u,F)=>{let E=[...u],C=!1,B=!1,$=TD(lD(D.at(-1)));for(let[x,S]of E.entries()){let A=TD(S);if($+A<=F)D[D.length-1]+=S;else D.push(S),$=0;if(Su.has(S))C=!0,B=E.slice(x+1,x+1+Hu.length).join("")===Hu;if(C){if(B){if(S===B0)C=!1,B=!1}else if(S===D2)C=!1;continue}if($+=A,$===F&&x<E.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},A3=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(TD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},H3=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,$=t3(D),x=[""];for(let[H,N]of D.split(" ").entries()){if(F.trim!==!1)x[x.length-1]=x.at(-1).trimStart();let w=TD(x.at(-1));if(H!==0){if(w>=u&&(F.wordWrap===!1||F.trim===!1))x.push(""),w=0;if(w>0||F.trim===!1)x[x.length-1]+=" ",w++}if(F.hard&&$[H]>u){let h=u-w,O=1+Math.floor(($[H]-h-1)/u);if(Math.floor(($[H]-1)/u)<O)x.push("");C0(x,N,u);continue}if(w+$[H]>u&&w>0&&$[H]>0){if(F.wordWrap===!1&&w<u){C0(x,N,u);continue}x.push("")}if(w+$[H]>u&&F.wordWrap===!1){C0(x,N,u);continue}x[x.length-1]+=N}if(F.trim!==!1)x=x.map((H)=>A3(H));let S=x.join(`
|
|
34
|
-
`),A=[...
|
|
35
|
-
`){if(B)E+=
|
|
36
|
-
`){if(C&&w)E+=
|
|
32
|
+
`,C)}while(E!==-1);return B+=D.slice(C),B}var{stdout:ZF,stderr:LF}=zF,au=Symbol("GENERATOR"),LD=Symbol("STYLER"),gD=Symbol("IS_EMPTY"),YF=["ansi","ansi","ansi256","ansi16m"],YD=Object.create(null),KC=(D,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let F=ZF?ZF.level:0;D.level=u.level===void 0?F:u.level};var WC=(D)=>{let u=(...F)=>F.join(" ");return KC(u,D),Object.setPrototypeOf(u,iD.prototype),u};function iD(D){return WC(D)}Object.setPrototypeOf(iD.prototype,Function.prototype);for(let[D,u]of Object.entries(ED))YD[D]={get(){let F=Hu(this,pu(u.open,u.close,this[LD]),this[gD]);return Object.defineProperty(this,D,{value:F}),F}};YD.visible={get(){let D=Hu(this,this[LD],!0);return Object.defineProperty(this,"visible",{value:D}),D}};var lu=(D,u,F,...E)=>{if(D==="rgb"){if(u==="ansi16m")return ED[F].ansi16m(...E);if(u==="ansi256")return ED[F].ansi256(ED.rgbToAnsi256(...E));return ED[F].ansi(ED.rgbToAnsi(...E))}if(D==="hex")return lu("rgb",u,F,...ED.hexToRgb(...E));return ED[F][D](...E)},yC=["rgb","hex","ansi256"];for(let D of yC){YD[D]={get(){let{level:F}=this;return function(...E){let C=pu(lu(D,YF[F],"color",...E),ED.color.close,this[LD]);return Hu(this,C,this[gD])}}};let u="bg"+D[0].toUpperCase()+D.slice(1);YD[u]={get(){let{level:F}=this;return function(...E){let C=pu(lu(D,YF[F],"bgColor",...E),ED.bgColor.close,this[LD]);return Hu(this,C,this[gD])}}}}var PC=Object.defineProperties(()=>{},{...YD,level:{enumerable:!0,get(){return this[au].level},set(D){this[au].level=D}}}),pu=(D,u,F)=>{let E,C;if(F===void 0)E=D,C=u;else E=F.openAll+D,C=u+F.closeAll;return{open:D,close:u,openAll:E,closeAll:C,parent:F}},Hu=(D,u,F)=>{let E=(...C)=>VC(E,C.length===1?""+C[0]:C.join(" "));return Object.setPrototypeOf(E,PC),E[au]=D,E[LD]=u,E[gD]=F,E},VC=(D,u)=>{if(D.level<=0||!u)return D[gD]?"":u;let F=D[LD];if(F===void 0)return u;let{openAll:E,closeAll:C}=F;if(u.includes("\x1B"))while(F!==void 0)u=UF(u,F.close,F.open),F=F.parent;let B=u.indexOf(`
|
|
33
|
+
`);if(B!==-1)u=MF(u,C,E,B);return E+u+C};Object.defineProperties(iD.prototype,YD);var kC=iD(),t6=iD({level:LF?LF.level:0});var S=kC;var eu=(D)=>D.name==="backspace",sD=(D)=>D.name==="tab";var aD=(D)=>D.name==="enter"||D.name==="return";class D0 extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(D){super();this.cause=D?.cause}}class u0 extends Error{name="CancelPromptError";message="Prompt was canceled"}class uD extends Error{name="ExitPromptError"}class F0 extends Error{name="HookError"}class E0 extends Error{name="ValidationError"}import{AsyncResource as vC}from"async_hooks";import{AsyncLocalStorage as mC,AsyncResource as rC}from"async_hooks";var QF=new mC;function bC(D){return{rl:D,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function KF(D,u){let F=bC(D);return QF.run(F,()=>{function E(C){F.handleChange=()=>{F.index=0,C()},F.handleChange()}return u(E)})}function ND(){let D=QF.getStore();if(!D)throw new F0("[Inquirer] Hook functions can only be called from within a prompt");return D}function C0(){return ND().rl}function B0(D){let u=(...F)=>{let E=ND(),C=!1,B=E.handleChange;E.handleChange=()=>{C=!0};let t=D(...F);if(C)B();return E.handleChange=B,t};return rC.bind(u)}function nu(D){let u=ND(),{index:F}=u,E={get(){return u.hooks[F]},set(B){u.hooks[F]=B},initialized:F in u.hooks},C=D(E);return u.index++,C}function WF(){ND().handleChange()}var OD={queue(D){let u=ND(),{index:F}=u;u.hooksEffect.push(()=>{u.hooksCleanup[F]?.();let E=D(C0());if(E!=null&&typeof E!=="function")throw new E0("useEffect return value must be a cleanup function or nothing.");u.hooksCleanup[F]=E})},run(){let D=ND();B0(()=>{D.hooksEffect.forEach((u)=>{u()}),D.hooksEffect.length=0})()},clearAll(){let D=ND();D.hooksCleanup.forEach((u)=>{u?.()}),D.hooksEffect.length=0,D.hooksCleanup.length=0}};function l(D){return nu((u)=>{let F=vC.bind(function(B){if(u.get()!==B)u.set(B),WF()});if(u.initialized)return[u.get(),F];let E=typeof D==="function"?D():D;return u.set(E),[E,F]})}function _D(D,u){nu((F)=>{let E=F.get();if(!Array.isArray(E)||u.some((B,t)=>!Object.is(B,E[t])))OD.queue(D);F.set(u)})}import{styleText as CD}from"util";import BD from"process";function oC(){if(BD.platform!=="win32")return BD.env.TERM!=="linux";return Boolean(BD.env.WT_SESSION)||Boolean(BD.env.TERMINUS_SUBLIME)||BD.env.ConEmuTask==="{cmd::Cmder}"||BD.env.TERM_PROGRAM==="Terminus-Sublime"||BD.env.TERM_PROGRAM==="vscode"||BD.env.TERM==="xterm-256color"||BD.env.TERM==="alacritty"||BD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var yF={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},PF={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},dC={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},cC={...yF,...PF},gC={...yF,...dC},iC=oC(),sC=iC?cC:gC,VF=sC,_6=Object.entries(PF);var kF={prefix:{idle:CD("blue","?"),done:CD("green",VF.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map((D)=>CD("yellow",D))},style:{answer:(D)=>CD("cyan",D),message:(D)=>CD("bold",D),error:(D)=>CD("red",`> ${D}`),defaultAnswer:(D)=>CD("dim",`(${D})`),help:(D)=>CD("dim",D),highlight:(D)=>CD("cyan",D),key:(D)=>CD("cyan",CD("bold",`<${D}>`))}};function mF(D){if(typeof D!=="object"||D===null)return!1;let u=D;while(Object.getPrototypeOf(u)!==null)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(D)===u}function rF(...D){let u={};for(let F of D)for(let[E,C]of Object.entries(F)){let B=u[E];u[E]=mF(B)&&mF(C)?rF(B,C):C}return u}function TD(...D){let u=[kF,...D.filter((F)=>F!=null)];return rF(...u)}function lD({status:D="idle",theme:u}){let[F,E]=l(!1),[C,B]=l(0),{prefix:t,spinner:$}=TD(u);if(_D(()=>{if(D==="loading"){let A,x=-1,H=setTimeout(()=>{E(!0),A=setInterval(()=>{x=x+1,B(x%$.frames.length)},$.interval)},300);return()=>{clearTimeout(H),clearInterval(A)}}else E(!1)},[D]),F)return $.frames[C];return typeof t==="string"?t:t[D==="loading"?"idle":D]??t.idle}function bF(D){return l({current:D})[0]}function pD(D){let u=bF(D);u.current=D,_D((F)=>{let E=!1,C=B0((B,t)=>{if(E)return;u.current(t,F)});return F.input.on("keypress",C),()=>{E=!0,F.input.removeListener("keypress",C)}},[])}var C2=dD(oF(),1);function t0({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var pC=t0();function eD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(pC,"")}function dF(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function cF(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function gF(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D>=94192&&D<=94198||D>=94208&&D<=101589||D>=101631&&D<=101662||D>=101760&&D<=101874||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128728||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129674||D>=129678&&D<=129734||D===129736||D>=129741&&D<=129756||D>=129759&&D<=129770||D>=129775&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function eC(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function iF(D,{ambiguousAsWide:u=!1}={}){if(eC(D),cF(D)||gF(D)||u&&dF(D))return 2;return 1}var sF=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var D3=new Intl.Segmenter,u3=/^\p{Default_Ignorable_Code_Point}$/u;function ID(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:E=!1}=u;if(!E)D=eD(D);if(D.length===0)return 0;let C=0,B={ambiguousAsWide:!F};for(let{segment:t}of D3.segment(D)){let $=t.codePointAt(0);if($<=31||$>=127&&$<=159)continue;if($>=8203&&$<=8207||$===65279)continue;if($>=768&&$<=879||$>=6832&&$<=6911||$>=7616&&$<=7679||$>=8400&&$<=8447||$>=65056&&$<=65071)continue;if($>=55296&&$<=57343)continue;if($>=65024&&$<=65039)continue;if(u3.test(t))continue;if(sF().test(t)){C+=2;continue}C+=iF($,B)}return C}var aF=(D=0)=>(u)=>`\x1B[${u+D}m`,lF=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,pF=(D=0)=>(u,F,E)=>`\x1B[${38+D};2;${u};${F};${E}m`,Y={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]}},s6=Object.keys(Y.modifier),F3=Object.keys(Y.color),E3=Object.keys(Y.bgColor),a6=[...F3,...E3];function C3(){let D=new Map;for(let[u,F]of Object.entries(Y)){for(let[E,C]of Object.entries(F))Y[E]={open:`\x1B[${C[0]}m`,close:`\x1B[${C[1]}m`},F[E]=Y[E],D.set(C[0],C[1]);Object.defineProperty(Y,u,{value:F,enumerable:!1})}return Object.defineProperty(Y,"codes",{value:D,enumerable:!1}),Y.color.close="\x1B[39m",Y.bgColor.close="\x1B[49m",Y.color.ansi=aF(),Y.color.ansi256=lF(),Y.color.ansi16m=pF(),Y.bgColor.ansi=aF(10),Y.bgColor.ansi256=lF(10),Y.bgColor.ansi16m=pF(10),Object.defineProperties(Y,{rgbToAnsi256:{value(u,F,E){if(u===F&&F===E){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(E/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[E]=F;if(E.length===3)E=[...E].map((B)=>B+B).join("");let C=Number.parseInt(E,16);return[C>>16&255,C>>8&255,C&255]},enumerable:!1},hexToAnsi256:{value:(u)=>Y.rgbToAnsi256(...Y.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,E,C;if(u>=232)F=((u-232)*10+8)/255,E=F,C=F;else{u-=16;let $=u%36;F=Math.floor(u/36)/5,E=Math.floor($/6)/5,C=$%6/5}let B=Math.max(F,E,C)*2;if(B===0)return 30;let t=30+(Math.round(C)<<2|Math.round(E)<<1|Math.round(F));if(B===2)t+=60;return t},enumerable:!1},rgbToAnsi:{value:(u,F,E)=>Y.ansi256ToAnsi(Y.rgbToAnsi256(u,F,E)),enumerable:!1},hexToAnsi:{value:(u)=>Y.ansi256ToAnsi(Y.hexToAnsi256(u)),enumerable:!1}}),Y}var B3=C3(),eF=B3;var wu=new Set(["\x1B","\x9B"]),t3=39,x0="\x07",F2="[",$3="]",E2="m",Su=`${$3}8;;`,D2=(D)=>`${wu.values().next().value}${F2}${D}${E2}`,u2=(D)=>`${wu.values().next().value}${Su}${D}${x0}`,x3=(D)=>D.split(" ").map((u)=>ID(u)),$0=(D,u,F)=>{let E=[...u],C=!1,B=!1,t=ID(eD(D.at(-1)));for(let[$,n]of E.entries()){let A=ID(n);if(t+A<=F)D[D.length-1]+=n;else D.push(n),t=0;if(wu.has(n))C=!0,B=E.slice($+1,$+1+Su.length).join("")===Su;if(C){if(B){if(n===x0)C=!1,B=!1}else if(n===E2)C=!1;continue}if(t+=A,t===F&&$<E.length-1)D.push(""),t=0}if(!t&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},A3=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(ID(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},H3=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let E="",C,B,t=x3(D),$=[""];for(let[H,R]of D.split(" ").entries()){if(F.trim!==!1)$[$.length-1]=$.at(-1).trimStart();let w=ID($.at(-1));if(H!==0){if(w>=u&&(F.wordWrap===!1||F.trim===!1))$.push(""),w=0;if(w>0||F.trim===!1)$[$.length-1]+=" ",w++}if(F.hard&&t[H]>u){let h=u-w,f=1+Math.floor((t[H]-h-1)/u);if(Math.floor((t[H]-1)/u)<f)$.push("");$0($,R,u);continue}if(w+t[H]>u&&w>0&&t[H]>0){if(F.wordWrap===!1&&w<u){$0($,R,u);continue}$.push("")}if(w+t[H]>u&&F.wordWrap===!1){$0($,R,u);continue}$[$.length-1]+=R}if(F.trim!==!1)$=$.map((H)=>A3(H));let n=$.join(`
|
|
34
|
+
`),A=[...n],x=0;for(let[H,R]of A.entries()){if(E+=R,wu.has(R)){let{groups:h}=new RegExp(`(?:\\${F2}(?<code>\\d+)m|\\${Su}(?<uri>.*)${x0})`).exec(n.slice(x))||{groups:{}};if(h.code!==void 0){let f=Number.parseFloat(h.code);C=f===t3?void 0:f}else if(h.uri!==void 0)B=h.uri.length===0?void 0:h.uri}let w=eF.codes.get(Number(C));if(A[H+1]===`
|
|
35
|
+
`){if(B)E+=u2("");if(C&&w)E+=D2(w)}else if(R===`
|
|
36
|
+
`){if(C&&w)E+=D2(C);if(B)E+=u2(B)}x+=R.length}return E};function A0(D,u,F){return String(D).normalize().replaceAll(`\r
|
|
37
37
|
`,`
|
|
38
38
|
`).split(`
|
|
39
39
|
`).map((E)=>H3(E,u,F)).join(`
|
|
40
|
-
`)}function
|
|
41
|
-
`).flatMap((F)
|
|
40
|
+
`)}function H0(D,u){return D.split(`
|
|
41
|
+
`).flatMap((F)=>A0(F,u,{trim:!1,hard:!0}).split(`
|
|
42
42
|
`).map((E)=>E.trimEnd())).join(`
|
|
43
|
-
`)}function
|
|
44
|
-
`).length,
|
|
45
|
-
`).pop()??"";class
|
|
46
|
-
`;let
|
|
47
|
-
`+u:""),
|
|
48
|
-
`,u+=
|
|
49
|
-
at ${SD}`)}let[b,e]=typeof T==="string"?[T]:T;
|
|
50
|
-
`);if(D.checks.directories.ok)u.push(` ${
|
|
51
|
-
`)}async function h8(){console.log(
|
|
43
|
+
`)}function B2(){return C2.default({defaultWidth:80,output:C0().output})}var N2=dD(x2(),1);import*as f2 from"readline";import{AsyncResource as N3}from"async_hooks";var JD=[];JD.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")JD.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")JD.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var Ru=(D)=>!!D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function",n0=Symbol.for("signal-exit emitter"),S0=globalThis,S3=Object.defineProperty.bind(Object);class A2{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(S0[n0])return S0[n0];S3(S0,n0,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(D,u){this.listeners[D].push(u)}removeListener(D,u){let F=this.listeners[D],E=F.indexOf(u);if(E===-1)return;if(E===0&&F.length===1)F.length=0;else F.splice(E,1)}emit(D,u,F){if(this.emitted[D])return!1;this.emitted[D]=!0;let E=!1;for(let C of this.listeners[D])E=C(u,F)===!0||E;if(D==="exit")E=this.emit("afterExit",u,F)||E;return E}}class R0{}var w3=(D)=>{return{onExit(u,F){return D.onExit(u,F)},load(){return D.load()},unload(){return D.unload()}}};class H2 extends R0{onExit(){return()=>{}}load(){}unload(){}}class n2 extends R0{#F=w0.platform==="win32"?"SIGINT":"SIGHUP";#u=new A2;#D;#B;#t;#C={};#E=!1;constructor(D){super();this.#D=D,this.#C={};for(let u of JD)this.#C[u]=()=>{let F=this.#D.listeners(u),{count:E}=this.#u,C=D;if(typeof C.__signal_exit_emitter__==="object"&&typeof C.__signal_exit_emitter__.count==="number")E+=C.__signal_exit_emitter__.count;if(F.length===E){this.unload();let B=this.#u.emit("exit",null,u),t=u==="SIGHUP"?this.#F:u;if(!B)D.kill(D.pid,t)}};this.#t=D.reallyExit,this.#B=D.emit}onExit(D,u){if(!Ru(this.#D))return()=>{};if(this.#E===!1)this.load();let F=u?.alwaysLast?"afterExit":"exit";return this.#u.on(F,D),()=>{if(this.#u.removeListener(F,D),this.#u.listeners.exit.length===0&&this.#u.listeners.afterExit.length===0)this.unload()}}load(){if(this.#E)return;this.#E=!0,this.#u.count+=1;for(let D of JD)try{let u=this.#C[D];if(u)this.#D.on(D,u)}catch(u){}this.#D.emit=(D,...u)=>{return this.#x(D,...u)},this.#D.reallyExit=(D)=>{return this.#$(D)}}unload(){if(!this.#E)return;this.#E=!1,JD.forEach((D)=>{let u=this.#C[D];if(!u)throw Error("Listener not defined for signal: "+D);try{this.#D.removeListener(D,u)}catch(F){}}),this.#D.emit=this.#B,this.#D.reallyExit=this.#t,this.#u.count-=1}#$(D){if(!Ru(this.#D))return 0;return this.#D.exitCode=D||0,this.#u.emit("exit",this.#D.exitCode,null),this.#t.call(this.#D,this.#D.exitCode)}#x(D,...u){let F=this.#B;if(D==="exit"&&Ru(this.#D)){if(typeof u[0]==="number")this.#D.exitCode=u[0];let E=F.call(this.#D,D,...u);return this.#u.emit("exit",this.#D.exitCode,null),E}else return F.call(this.#D,D,...u)}}var w0=globalThis.process,{onExit:S2,load:x1,unload:A1}=w3(Ru(w0)?new n2(w0):new H2);import{stripVTControlCharacters as h3}from"util";var R3="\x1B[G";var R2="\x1B[?25h",h0=(D=1)=>D>0?`\x1B[${D}A`:"",f0=(D=1)=>D>0?`\x1B[${D}B`:"",N0=(D,u)=>{if(typeof u==="number"&&!Number.isNaN(u))return`\x1B[${u+1};${D+1}H`;return`\x1B[${D+1}G`},w2="\x1B[2K",O0=(D)=>D>0?(w2+h0(1)).repeat(D-1)+w2+R3:"";var h2=(D)=>D.split(`
|
|
44
|
+
`).length,f3=(D)=>D.split(`
|
|
45
|
+
`).pop()??"";class hu{height=0;extraLinesUnderPrompt=0;cursorPos;rl;constructor(D){this.rl=D,this.cursorPos=D.getCursorPos()}write(D){this.rl.output.unmute(),this.rl.output.write(D),this.rl.output.mute()}render(D,u=""){let F=f3(D),E=h3(F),C=E;if(this.rl.line.length>0)C=C.slice(0,-this.rl.line.length);this.rl.setPrompt(C),this.cursorPos=this.rl.getCursorPos();let B=B2();if(D=H0(D,B),u=H0(u,B),E.length%B===0)D+=`
|
|
46
|
+
`;let t=D+(u?`
|
|
47
|
+
`+u:""),n=Math.floor(E.length/B)-this.cursorPos.rows+(u?h2(u):0);if(n>0)t+=h0(n);t+=N0(this.cursorPos.cols),this.write(f0(this.extraLinesUnderPrompt)+O0(this.height)+t),this.extraLinesUnderPrompt=n,this.height=h2(t)}checkCursorPos(){let D=this.rl.getCursorPos();if(D.cols!==this.cursorPos.cols)this.write(N0(D.cols)),this.cursorPos=D}done({clearContent:D}){this.rl.setPrompt("");let u=f0(this.extraLinesUnderPrompt);u+=D?O0(this.height):`
|
|
48
|
+
`,u+=R2,this.write(u),this.rl.close()}}class _0 extends Promise{static withResolver(){let D,u;return{promise:new Promise((E,C)=>{D=E,u=C}),resolve:D,reject:u}}}function O3(){let D=Error.prepareStackTrace,u=[];try{Error.prepareStackTrace=(F,E)=>{let C=E.slice(1);return u=C,C},Error().stack}catch{return u}return Error.prepareStackTrace=D,u}function Du(D){let u=O3();return(E,C={})=>{let{input:B=process.stdin,signal:t}=C,$=new Set,n=new N2.default;n.pipe(C.output??process.stdout);let A=f2.createInterface({terminal:!0,input:B,output:n}),x=new hu(A),{promise:H,resolve:R,reject:w}=_0.withResolver(),h=()=>w(new u0);if(t){let I=()=>w(new D0({cause:t.reason}));if(t.aborted)return I(),Object.assign(H,{cancel:h});t.addEventListener("abort",I),$.add(()=>t.removeEventListener("abort",I))}$.add(S2((I,J)=>{w(new uD(`User force closed the prompt with ${I} ${J}`))}));let f=()=>w(new uD("User force closed the prompt with SIGINT"));A.on("SIGINT",f),$.add(()=>A.removeListener("SIGINT",f));let O=()=>x.checkCursorPos();return A.input.on("keypress",O),$.add(()=>A.input.removeListener("keypress",O)),KF(A,(I)=>{let J=N3.bind(()=>OD.clearAll());return A.on("close",J),$.add(()=>A.removeListener("close",J)),I(()=>{try{let T=D(E,(SD)=>{setImmediate(()=>R(SD))});if(T===void 0){let SD=u[1]?.getFileName();throw Error(`Prompt functions must return a string.
|
|
49
|
+
at ${SD}`)}let[b,e]=typeof T==="string"?[T]:T;x.render(b,e),OD.run()}catch(T){w(T)}}),Object.assign(H.then((T)=>{return OD.clearAll(),T},(T)=>{throw OD.clearAll(),T}).finally(()=>{$.forEach((T)=>T()),x.done({clearContent:Boolean(C.clearPromptOnDone)}),n.end()}).then(()=>H),{cancel:h})})}}function O2(D,u){let F=u!==!1;if(/^(y|yes)/i.test(D))F=!0;else if(/^(n|no)/i.test(D))F=!1;return F}function _2(D){return D?"Yes":"No"}var tD=Du((D,u)=>{let{transformer:F=_2}=D,[E,C]=l("idle"),[B,t]=l(""),$=TD(D.theme),n=lD({status:E,theme:$});pD((R,w)=>{if(E!=="idle")return;if(aD(R)){let h=O2(B,D.default);t(F(h)),C("done"),u(h)}else if(sD(R)){let h=_2(!O2(B,D.default));w.clearLine(0),w.write(h),t(h)}else t(w.line)});let A=B,x="";if(E==="done")A=$.style.answer(B);else x=` ${$.style.defaultAnswer(D.default===!1?"y/N":"Y/n")}`;let H=$.style.message(D.message,E);return`${n} ${H}${x} ${A}`});var _3={validationFailureMode:"keep"},uu=Du((D,u)=>{let{prefill:F="tab"}=D,E=TD(_3,D.theme),[C,B]=l("idle"),[t="",$]=l(D.default),[n,A]=l(),[x,H]=l(""),R=lD({status:C,theme:E});async function w(J){let{required:T,pattern:b,patternError:e="Invalid input"}=D;if(T&&!J)return"You must provide a value";if(b&&!b.test(J))return e;if(typeof D.validate==="function")return await D.validate(J)||"You must provide a valid value";return!0}pD(async(J,T)=>{if(C!=="idle")return;if(aD(J)){let b=x||t;B("loading");let e=await w(b);if(e===!0)H(b),B("done"),u(b);else{if(E.validationFailureMode==="clear")H("");else T.write(x);A(e),B("idle")}}else if(eu(J)&&!x)$(void 0);else if(sD(J)&&!x)$(void 0),T.clearLine(0),T.write(t),H(t);else H(T.line),A(void 0)}),_D((J)=>{if(F==="editable"&&t)J.write(t),H(t)},[]);let h=E.style.message(D.message,C),f=x;if(typeof D.transformer==="function")f=D.transformer(x,{isFinal:C==="done"});else if(C==="done")f=E.style.answer(x);let O;if(t&&C!=="done"&&!x)O=E.style.defaultAnswer(t);let I="";if(n)I=E.style.error(n);return[[R,h,O,f].filter((J)=>J!==void 0).join(" "),I]});class k extends Error{code;constructor(D,u){super(u);this.code=D;this.name="HostError"}}var c2=dD(d2(),1),z="local",$8={stale:5000,retries:{retries:5,minTimeout:100,maxTimeout:1000,factor:2}};function zu(){return`${Bun.env.HOME||Bun.env.USERPROFILE||"~"}/.config/wt/config.json`}function g2(){let D=new Date().toISOString();return{name:z,ssh:"",root:"",connectTimeout:10,labels:{},createdAt:D,updatedAt:D,lastCheckedAt:D,lastStatus:"ok"}}function i2(){return{version:1,defaultHost:z,hosts:{[z]:g2()},sandboxes:{}}}async function a(){let D=zu(),u=Bun.file(D);if(!await u.exists())return i2();try{let F=await u.json();if(F.version!==1)throw Error(`Unsupported config version: ${F.version}`);if(!F.sandboxes)F.sandboxes={};if(!F.hosts[z])F.hosts[z]=g2();if(!F.defaultHost)F.defaultHost=z;return F}catch(F){if(F instanceof SyntaxError)throw Error(`Invalid config file at ${D}: ${F.message}`);throw F}}async function s2(D){let u=zu(),F=u.slice(0,u.lastIndexOf("/"));await Bun.$`mkdir -p ${F}`.quiet();let E=JSON.stringify(D,null,2);await Bun.write(u,E)}async function p(D){let u=zu(),F=u.slice(0,u.lastIndexOf("/"));if(await Bun.$`mkdir -p ${F}`.quiet(),!await Bun.file(u).exists())await Bun.write(u,JSON.stringify(i2(),null,2));let C=await c2.default.lock(u,$8);try{let B=await a(),t=await D(B);return await s2(B),t}finally{await C()}}async function g(D){return(await a()).hosts[D]}async function zD(){let D=await a();if(!D.defaultHost)return;return D.hosts[D.defaultHost]}async function W0(D){return p((u)=>{if(!u.hosts[D])return!1;if(delete u.hosts[D],u.defaultHost===D)u.defaultHost=null;return!0})}var x8=/^[a-z][a-z0-9_-]{0,31}$/;function a2(D){if(!D)throw new k("VALIDATION_ERROR","Host name is required");if(!x8.test(D))throw new k("VALIDATION_ERROR","Host name must match pattern: starts with a-z, followed by 0-31 chars of a-z, 0-9, _, or -")}function l2(D){if(!D||D.trim()==="")throw new k("VALIDATION_ERROR","SSH target is required")}function p2(D){if(!D)throw new k("VALIDATION_ERROR","Root path is required");if(!D.startsWith("/"))throw new k("VALIDATION_ERROR","Root path must be absolute (start with /)")}function e2(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>65535)throw new k("VALIDATION_ERROR","Port must be an integer between 1 and 65535")}function DE(D){if(D===void 0)return;if(!Number.isInteger(D)||D<1||D>300)throw new k("VALIDATION_ERROR","Connect timeout must be an integer between 1 and 300 seconds")}function y0(D){if(!D)return{};let u={},F=D.split(",");for(let E of F){let C=E.trim();if(!C)continue;let B=C.indexOf("=");if(B===-1)throw new k("VALIDATION_ERROR",`Invalid label format "${C}": expected key=value`);let t=C.slice(0,B).trim(),$=C.slice(B+1).trim();if(!t)throw new k("VALIDATION_ERROR",`Invalid label: empty key in "${C}"`);u[t]=$}return u}function P0(D){a2(D.name),l2(D.ssh),p2(D.root),e2(D.port),DE(D.connectTimeout)}function PD(D){let u=[];if(D.connectTimeout)u.push("-o",`ConnectTimeout=${D.connectTimeout}`);if(u.push("-o","BatchMode=yes"),u.push("-o","StrictHostKeyChecking=accept-new"),D.port)u.push("-p",String(D.port));if(D.identity)u.push("-i",D.identity);return u.push(D.ssh),u}function HD(D){return{ssh:D.ssh,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout}}async function U(D,u){let F=PD(D);F.push(u);try{let E=await Bun.$`ssh ${F}`.quiet().nothrow();return{ok:E.exitCode===0,exitCode:E.exitCode,stdout:E.stdout.toString().trim(),stderr:E.stderr.toString().trim()}}catch(E){return{ok:!1,exitCode:-1,stdout:"",stderr:E instanceof Error?E.message:String(E)}}}async function Mu(D){return U(D,"echo ok")}async function uE(D){return U(D,"git --version")}async function FE(D){return U(D,"node --version")}async function EE(D,u){let F=["mirrors","sandboxes","meta"],C=[`mkdir -p ${F.map((B)=>`${u}/${B}`).join(" ")}`,...F.map((B)=>`test -w ${u}/${B}`)].join(" && ");return U(D,C)}function A8(D){let u=D.match(/git version (\d+\.\d+(?:\.\d+)?)/);return u?u[1]:null}function H8(D){let u=D.match(/v?(\d+\.\d+\.\d+)/);return u?u[1]:null}function n8(D){let[u,F]=D.split(".").map(Number);return u>2||u===2&&F>=5}async function CE(D){let F=(await a()).hosts[D];if(!F)throw new k("HOST_NOT_FOUND",`Host "${D}" not found`);return Zu(F)}async function Zu(D){let u=HD(D),F=[],E=[],C={ok:!1,host:D.name,checks:{ssh:{ok:!1},directories:{ok:!1},git:{ok:!1},node:{ok:!1}},errors:F,warnings:E},B=await Mu(u);if(B.ok)C.checks.ssh={ok:!0};else return C.checks.ssh={ok:!1,error:B.stderr||"Connection failed"},F.push(`SSH connection failed: ${B.stderr||"unknown error"}`),C;let t=await EE(u,D.root);if(t.ok)C.checks.directories={ok:!0};else C.checks.directories={ok:!1,error:t.stderr||"Failed to create directories"},F.push(`Directory check failed: ${t.stderr||"unknown error"}`);let $=await uE(u);if($.ok){let A=A8($.stdout);if(A)if(n8(A))C.checks.git={ok:!0,version:A};else C.checks.git={ok:!1,version:A,error:`Git ${A} does not support worktrees (need 2.5+)`},F.push(`Git ${A} does not support worktrees (need 2.5+)`);else C.checks.git={ok:!1,error:"Could not parse git version"},F.push("Could not parse git version")}else C.checks.git={ok:!1,error:"git not found"},F.push("git not found on remote");let n=await FE(u);if(n.ok){let A=H8(n.stdout);if(A)C.checks.node={ok:!0,version:A};else C.checks.node={ok:!0,warning:!0},E.push("Could not parse node version")}else C.checks.node={ok:!1,warning:!0,error:"not found"},E.push("node not found (optional)");return C.ok=C.checks.ssh.ok&&C.checks.directories.ok&&C.checks.git.ok,C}async function S8(D,u){await p((F)=>{let E=F.hosts[D];if(!E)throw new k("HOST_NOT_FOUND",`Host "${D}" not found`);E.lastCheckedAt=new Date().toISOString(),E.lastStatus=u.ok?"ok":"error",E.updatedAt=new Date().toISOString()})}async function V0(D){let u=await CE(D);return await S8(D,u),u}var w8=10;async function k0(D){P0({name:D.name,ssh:D.ssh,root:D.root,port:D.port,connectTimeout:D.connectTimeout});let{host:u,action:F}=await p((C)=>{let B=C.hosts[D.name],t=new Date().toISOString(),$={name:D.name,ssh:D.ssh,root:D.root,port:D.port,identity:D.identity,connectTimeout:D.connectTimeout??w8,labels:D.labels??{},createdAt:B?.createdAt??t,updatedAt:t,lastCheckedAt:B?.lastCheckedAt??null,lastStatus:B?.lastStatus??"unchecked"},n=B?"updated":"created";if(C.hosts[D.name]=$,D.setDefault)C.defaultHost=D.name;return{host:$,action:n}}),E;if(!D.skipCheck)E=await Zu(u),await p((C)=>{let B=C.hosts[D.name];if(B)B.lastCheckedAt=new Date().toISOString(),B.lastStatus=E.ok?"ok":"error",B.updatedAt=new Date().toISOString()}),u.lastCheckedAt=new Date().toISOString(),u.lastStatus=E.ok?"ok":"error";return{ok:!0,action:F,host:u,checkResult:E}}async function m0(){let D=await a(),u=Object.values(D.hosts).sort((F,E)=>F.name.localeCompare(E.name));return{defaultHost:D.defaultHost,hosts:u}}function R8(D){let u=[];if(D.checks.ssh.ok)u.push(` ${S.green("\u2713")} SSH connection`);else return u.push(` ${S.red("\u2717")} SSH connection: ${D.checks.ssh.error}`),u.join(`
|
|
50
|
+
`);if(D.checks.directories.ok)u.push(` ${S.green("\u2713")} Directory structure`);else u.push(` ${S.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)u.push(` ${S.green("\u2713")} git ${D.checks.git.version}`);else u.push(` ${S.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)u.push(` ${S.green("\u2713")} node ${D.checks.node.version}`);else u.push(` ${S.yellow("\u26A0")} node not found (optional)`);return u.join(`
|
|
51
|
+
`)}async function h8(){console.log(S.cyan(`
|
|
52
52
|
Add a new host
|
|
53
|
-
`));let D=await
|
|
54
|
-
Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await
|
|
55
|
-
Cancelled.`)),process.exit(130);if(E instanceof k){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(
|
|
56
|
-
`)}function
|
|
57
|
-
|
|
58
|
-
`).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*"),E=[];for await(let S of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(S);if(E.length===0)return;let C=PD(this.sshOpts),B=C.pop(),$=C.filter((S)=>S!=="-o"||!0),x=[];for(let S=0;S<C.length;S++)if(C[S]==="-p")x.push("-P",C[S+1]),S++;else if(C[S]==="-i")x.push("-i",C[S+1]),S++;else if(C[S]==="-o")x.push("-o",C[S+1]),S++;for(let S of E){let A=`${D}/${S}`,t=`${B}:${u}/${S}`;await Bun.$`scp ${x} ${A} ${t}`.quiet().nothrow()}}async checkGit(){let D=await M(this.sshOpts,"git --version");if(!D.ok)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.trim()}}async checkTmux(){let D=await M(this.sshOpts,"tmux -V");if(!D.ok)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.trim()}}async checkRuntime(){let D=await M(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await M(this.sshOpts,"node --version");if(u.ok)return{name:"node",ok:!0,detail:u.stdout.trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}async function y(D){if(D===z)return new Yu;let u=await g(D);if(!u)throw new f("HOST_NOT_FOUND",`Host "${D}" not found`);return new Qu(u)}async function $D(D){if(D===z)return`${await tE()}/.wt`;let u=await g(D);if(!u)throw new f("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function m0(D){return(await a()).sandboxes[D]}async function NE(D){await p((u)=>{u.sandboxes[D.name]=D})}async function hE(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function HD(D){let u=await m0(D);if(!u)throw new f("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function OE(D,u){let F=await p((E)=>{let C=E.sandboxes[D];if(!C)throw new f("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new f("SANDBOX_EXISTS",`Sandbox "${u}" already exists`);let B={...C,name:u};return delete E.sandboxes[D],E.sandboxes[u]=B,B});try{let E=await y(F.host),C=await $D(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function Ku(D){let u=await $E(),F=await wE(u),E=D.ref??await xE(),C=await y(D.hostName),B=await $D(D.hostName),$=await m0(D.name);if($){if($.host===D.hostName&&$.repoId===F){if(await C.dirExists($.path))return{entry:$,isIdempotent:!0}}throw new f("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${$.host}, repoId=${$.repoId})`)}let x=RE(),S=`${B}/sandboxes/${x}`;try{await C.ensureLayout(B);let A=await C.ensureMirror(B,F,u);await C.createWorktree(A,S,E),await C.copyEnvFiles(process.cwd(),S);let t={name:D.name,id:x,host:D.hostName,origin:u,repoId:F,ref:E,path:S,createdAt:new Date().toISOString()};return await C.writeMeta(B,x,t),await NE(t),{entry:t,isIdempotent:!1}}catch(A){if(A instanceof f)throw A;throw new f("CREATION_FAILED",A instanceof Error?A.message:String(A))}}async function fE(D){let u=await HD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new f("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);return F.execInteractive(u.path,{WT_SANDBOX:u.name,WT_SANDBOX_ID:u.id})}async function _E(D){let u=await HD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new f("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new f("CREATION_FAILED","tmux not found on host. Run: wt bootstrap --tmux --host <host>");let B=`wt-${u.id}`;return F.execTmux(u.path,B)}function Wu(D,u){if(D.host===z)return`wt enter ${D.name}`;if(!u)return`wt enter ${D.name}`;let F=["ssh","-t"];if(u.port)F.push("-p",String(u.port));if(u.identity)F.push("-i",u.identity);return F.push(u.ssh,`'cd ${D.path} && exec $SHELL -l'`),F.join(" ")}function r0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from --ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <ref>","Git branch, tag, or sha (defaults to HEAD)").option("-r, --ref <ref>","Alias for --branch").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Uu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(R.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(R.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let E=F.branch??F.ref,C=u;if(!C){let A=E??await Zu();if(A)C=Lu(A);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(R.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let B;if(F.host){if(B=F.host,B!==z){if(!await g(B)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${B}" not found`},null,2));else console.error(R.red(`Error: Host "${B}" not found`));process.exit(1)}}}else B=(await XD())?.name??z;let $=await Ku({name:C,hostName:B,ref:E});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(R.dim(`Sandbox "${C}" already exists`));let x=B!==z?await g(B):void 0,S=Wu($.entry,x??void 0);console.log(S)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function b0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from --ref or current branch)").option("-b, --branch <ref>","Git branch, tag, or sha (defaults to HEAD)").option("-r, --ref <ref>","Alias for --branch").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Uu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(R.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(R.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let E=F.branch??F.ref,C=u;if(!C){let x=E??await Zu();if(x)C=Lu(x);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(R.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let B=await Ku({name:C,hostName:z,ref:E});if(F.json){console.log(JSON.stringify(B.entry,null,2));return}if(B.isIdempotent)console.log(R.dim(`Sandbox "${C}" already exists`));let $=Wu(B.entry);console.log($)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function v0(D){D.command("enter").description("Enter an existing sandbox").argument("<name>","Sandbox name").option("--json","Output sandbox record as JSON without entering").option("--tmux","Attach or create a tmux session in the sandbox").action(async(u,F)=>{try{if(F.json){let E=await HD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await _E(u);else await fE(u)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function nE(D,u,F){let E=await HD(D),C=await y(E.host);if(!await C.dirExists(E.path))throw new f("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let x=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:x.exitCode,stdout:x.stdout,stderr:x.stderr}}let $=await C.execStream(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:$,stdout:"",stderr:""}}function d0(D){D.command("run").description("Run a command in a sandbox").argument("<name>","Sandbox name").argument("<cmd...>","Command to run").option("--json","Capture output and return as JSON").option("--quiet","Suppress non-error output").passThroughOptions().action(async(u,F,E)=>{try{let C=F[0]==="--"?F.slice(1):F;if(C.length===0)console.error(R.red("Error: No command specified")),process.exit(1);let B=await nE(u,C,{capture:!!E.json});if(E.json)console.log(JSON.stringify(B,null,2)),process.exit(B.exitCode);process.exit(B.exitCode)}catch(C){if(C instanceof f){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(R.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function TE(D){let u=await y(D);if(!(await u.checkTmux()).ok)return{host:D,sessions:[],ok:!0,warnings:["tmux not installed"]};let E=await u.listTmuxSessions();return{host:D,sessions:E,ok:!0,warnings:[]}}function o0(D){D.command("sessions").description("List running tmux sessions for wt sandboxes").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await XD())?.name??z;let E=await TE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.warnings.length>0)for(let C of E.warnings)console.error(R.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(R.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?R.green("attached"):R.dim("detached");console.log(`${C.name} ${B}`)}})}var qE=vD(JE(),1);async function c0(D){let u=qE.default(D.olderThan);if(u===void 0||u<=0)throw Error(`Invalid duration: ${D.olderThan}`);let F=await a(),C=Date.now()-u,B=Object.values(F.sandboxes),$=D.hostName?B.filter((H)=>H.host===D.hostName):B,x=[],S=[],A=[],t=new Set;for(let H of $){let w=new Date(H.createdAt).getTime()<C;if(!w)try{if(!await(await y(H.host)).dirExists(H.path))w=!0}catch{w=!0}if(!w){S.push(H);continue}if(D.dryRun){x.push(H);continue}try{let h=await y(H.host),O=await $D(H.host);await h.removeSandboxDir(H.path),await h.removeMeta(O,H.id),t.add(`${H.host}:${O}/mirrors/${H.repoId}.git`),x.push(H)}catch(h){A.push({sandbox:H.name,error:h instanceof Error?h.message:String(h)})}}if(!D.dryRun&&x.length>0)await p((H)=>{for(let N of x)delete H.sandboxes[N.name]});if(!D.dryRun)for(let H of t){let[N,w]=H.split(":",2);try{await(await y(N)).pruneWorktrees(w)}catch{}}return{deleted:x,kept:S,errors:A}}function g0(D){D.command("gc").description("Remove stale sandboxes").option("-H, --host <hostName>","Target host (omit for all hosts)").option("--older-than <duration>","Age threshold (e.g. 7d, 24h, 1w)","7d").option("--dry-run","Show what would be deleted without deleting").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u)=>{try{let F=await c0({hostName:u.host,olderThan:u.olderThan,dryRun:!0});if(u.json&&u.dryRun){console.log(JSON.stringify(F,null,2));return}if(F.deleted.length===0&&F.errors.length===0){if(u.json)console.log(JSON.stringify(F,null,2));else console.log(R.dim("Nothing to clean up."));return}if(u.dryRun){if(F.deleted.length>0){console.log(`Would delete ${F.deleted.length} sandbox(es)`);for(let C of F.deleted)console.log(` ${R.red("-")} ${C.name} (${C.host})`)}return}if(!u.json){console.log(`Found ${F.deleted.length} sandbox(es) to delete:`);for(let C of F.deleted)console.log(` ${R.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await BD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(R.dim("Cancelled."));return}}let E=await c0({hostName:u.host,olderThan:u.olderThan,dryRun:!1});if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.deleted.length>0)console.log(`Deleted ${E.deleted.length} sandbox(es)`);if(E.errors.length>0){for(let C of E.errors)console.error(R.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(R.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function GE(D){let u=[],F=[],E=[];if(D!==z){let A=await g(D);if(!A)return{ok:!1,host:D,checks:[{name:"host",ok:!1,detail:"not found in config"}],warnings:[],errors:[`Host "${D}" not found`]};let t=await zu(AD(A)),H=t.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:t.stderr||"connection failed"};if(u.push(H),!H.ok)return E.push(`SSH connection failed: ${H.detail}`),{ok:!1,host:D,checks:u,warnings:F,errors:E}}let C=await y(D),B=await C.checkGit();if(u.push(B),!B.ok)E.push(`git: ${B.detail}`);let $=await C.checkRuntime();if(u.push($),!$.ok)F.push(`runtime: ${$.detail}`);let x=await C.checkTmux();if(u.push(x),!x.ok)F.push(`tmux: ${x.detail}`);return{ok:u.every((A)=>A.ok||A.name==="tmux"||A.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function i0(D){D.command("doctor").description("Check system prerequisites and host health").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await XD())?.name??z;let E=await GE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${R.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${R.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${R.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(R.green(`Host "${F}" is healthy.`));else console.log(R.red(`Host "${F}" has issues.`)),process.exit(1)})}async function j8(D){let u=await g(D);if(!u)return null;let F=AD(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await M(F,`command -v ${E}`)).ok)return E;return null}function X8(D,u){switch(u){case"apt-get":return`sudo apt-get install -y ${D}`;case"apk":return`sudo apk add ${D}`;case"dnf":return`sudo dnf install -y ${D}`;case"yum":return`sudo yum install -y ${D}`;case"brew":return`brew install ${D}`;default:return`install ${D} manually`}}async function jE(D){let u=[],F=[],E=[],C=D.hostName===z,B=await y(D.hostName),$=await B.checkGit();if(u.push($),!$.ok)F.push("git");let x=await B.checkRuntime();if(u.push(x),!x.ok)F.push("bun or node");if(D.tmux){let A=await B.checkTmux();if(u.push(A),!A.ok)F.push("tmux")}if(!C){let A=await g(D.hostName);if(!A)throw new f("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let t=AD(A);for(let H of["bash","curl"]){let w=(await M(t,`command -v ${H}`)).ok?{name:H,ok:!0}:{name:H,ok:!1,detail:"not found"};if(u.push(w),!w.ok)F.push(H)}for(let H of D.agents){let w=(await M(t,`command -v ${H}`)).ok?{name:H,ok:!0}:{name:H,ok:!1,detail:"not found"};if(u.push(w),!w.ok)F.push(H)}if(F.length>0){let H=await j8(D.hostName);if(H)for(let N of F)if(N==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(N==="claude"||N==="opencode")E.push(`npm install -g ${N}`);else E.push(X8(N,H));else E.push(`No package manager found. Install manually: ${F.join(", ")}`)}}else if(F.length>0)for(let A of F)if(A==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else E.push(`Install ${A} using your system package manager`);try{let A=await $D(D.hostName);await B.ensureLayout(A),u.push({name:"layout",ok:!0})}catch(A){u.push({name:"layout",ok:!1,detail:A instanceof Error?A.message:String(A)})}let S=F.length===0&&u.every((A)=>A.ok);return{host:D.hostName,ok:S,checks:u,missing:F,instructions:E}}function s0(D){D.command("bootstrap").description("Check host readiness and report missing packages").requiredOption("-H, --host <hostName>","Target host").option("--tmux","Include tmux in checks").option("--agents <list>","Comma-separated agent CLIs to check (e.g. claude,opencode)").option("--json","Output as JSON").action(async(u)=>{try{let F=u.agents?u.agents.split(",").map((C)=>C.trim()).filter(Boolean):[],E=await jE({hostName:u.host,tmux:!!u.tmux,agents:F});if(u.json){if(console.log(JSON.stringify(E,null,2)),!E.ok)process.exit(1);return}for(let C of E.checks)if(C.ok)console.log(` ${R.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${R.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(R.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(R.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(R.green(`Host "${u.host}" is ready.`));else console.log(R.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof f){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(R.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function XE(D){let u=await hE(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function a0(D){D.command("ls").description("List sandboxes").option("-H, --host <hostName>","Filter by host").option("--json","Output as JSON").action(async(u)=>{try{let F=await XE({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(R.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map(($)=>$.name.length),4),C=Math.max(...F.sandboxes.map(($)=>$.host.length),4),B=Math.max(...F.sandboxes.map(($)=>$.ref.substring(0,8).length),3);console.log(R.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd(B)} CREATED`));for(let $ of F.sandboxes){let x=$.ref.substring(0,8),S=new Date($.createdAt).toLocaleDateString();console.log(`${R.cyan($.name.padEnd(E))} ${$.host.padEnd(C)} ${R.yellow(x.padEnd(B))} ${R.dim(S)}`)}console.log(R.dim(`
|
|
59
|
-
${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(R.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function zE(D){let F=(await a()).sandboxes[D];if(!F)throw new f("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await y(F.host),C=await $D(F.host),B={dir:!1,meta:!1,config:!1};try{await E.removeSandboxDir(F.path),B.dir=!0}catch{}try{await E.removeMeta(C,F.id),B.meta=!0}catch{}await p(($)=>{delete $.sandboxes[D]}),B.config=!0;try{let $=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees($)}catch{}return{entry:F,cleaned:B}}function l0(D){D.command("rm").description("Remove a sandbox").argument("<name>","Sandbox name").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u,F)=>{try{if(!F.yes&&!F.json){if(!await BD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(R.dim("Cancelled."));return}}let E=await zE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${R.cyan(E.entry.name)}`);let C=[];if(!E.cleaned.dir)C.push("directory");if(!E.cleaned.meta)C.push("metadata");if(C.length>0)console.log(R.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function z8(D){let u=Date.now()-new Date(D).getTime(),F=Math.floor(u/1000);if(F<60)return`${F}s`;let E=Math.floor(F/60);if(E<60)return`${E}m`;let C=Math.floor(E/60);if(C<24)return`${C}h`;return`${Math.floor(C/24)}d`}async function ME(D){let u=await HD(D),F=await y(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),$=`wt-${u.id}`,x=B.find((S)=>S.name===$);if(x)C=x.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:z8(u.createdAt)}}function p0(D){D.command("status").description("Show sandbox status").argument("<name>","Sandbox name").option("--json","Output as JSON").action(async(u,F)=>{try{let E=await ME(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:$,age:x}=E;console.log(R.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${R.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${R.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${R.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${x}`);let S=B?R.green("exists"):R.red("missing");console.log(` ${"Dir".padEnd(10)} ${S}`);let A=$?R.green($):R.dim("none");console.log(` ${"Tmux".padEnd(10)} ${A}`)}catch(E){if(E instanceof f){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(R.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function e0(D){D.command("rename").description("Rename a sandbox").argument("<old>","Current sandbox name").argument("<new>","New sandbox name").option("--json","Output result as JSON").action(async(u,F,E)=>{try{let C=await OE(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(R.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof f){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(R.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new _F,UE="0.0.2";function M8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map((x)=>x.required?`<${x.name()}>`:`[${x.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let $=D.commands.filter((x)=>x.name()!=="help");return $.forEach((x,S)=>{let A=S===$.length-1,t=A?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",H=u+(A?" ":"\u2502 "),N=x.name(),w=x.registeredArguments.map((_)=>_.required?`<${_.name()}>`:`[${_.name()}]`).join(" "),h=w?`${N} ${w}`:N,O=x.commands.filter((_)=>_.name()!=="help");if(O.length>0)F.push(`${u}${t}${h}`),O.forEach((_,I)=>{let T=I===O.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",b=_.name(),e=_.registeredArguments.map((bD)=>bD.required?`<${bD.name()}>`:`[${bD.name()}]`).join(" "),SD=e?`${b} ${e}`:b;F.push(`${H}${T}${SD}`)});else F.push(`${u}${t}${h}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(UE,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(M8(i).join(`
|
|
53
|
+
`));let D=await uu({message:"Host name:",validate:(B)=>{if(!B)return"Host name is required";if(!/^[a-z][a-z0-9_-]{0,31}$/.test(B))return"Must start with a-z, followed by a-z, 0-9, _, or - (max 32 chars)";return!0}}),u=await uu({message:"SSH target (alias or user@host):",validate:(B)=>B?!0:"SSH target is required"}),F=await uu({message:"Remote base directory:",default:"/srv/wt",validate:(B)=>{if(!B)return"Root path is required";if(!B.startsWith("/"))return"Must be an absolute path (start with /)";return!0}}),E=await tD({message:"Set as default host?",default:!0}),C=await tD({message:"Run connectivity check?",default:!0});return{name:D,ssh:u,root:F,setDefault:E,skipCheck:!C,runCheck:C}}function BE(D){D.command("add").description("Register or update a remote host").argument("[name]","Host identifier (a-z, 0-9, _, - ; max 32 chars)").option("-s, --ssh <target>","SSH target (alias, user@host, or ssh://user@host:port)").option("-r, --root <path>","Remote base directory (absolute path)").option("-d, --default","Set as default host").option("-p, --port <number>","SSH port (overrides target/config)").option("-i, --identity <path>","Path to SSH identity file").option("-t, --connect-timeout <seconds>","Connection timeout in seconds","10").option("--no-check","Skip connectivity check after adding").option("-l, --labels <k=v,...>","Comma-separated key=value labels").option("--json","Output result as JSON").action(async(u,F)=>{try{let E,C=!u||!F.ssh||!F.root;if(C&&F.json)console.log(JSON.stringify({ok:!1,error:"Missing required arguments (name, --ssh, --root) and --json prevents interactive mode"},null,2)),process.exit(1);if(C)E=await h8();else E={name:u,ssh:F.ssh,root:F.root,setDefault:F.default,port:F.port?parseInt(F.port,10):void 0,identity:F.identity,connectTimeout:F.connectTimeout?parseInt(F.connectTimeout,10):void 0,skipCheck:F.check===!1,labels:y0(F.labels)};if(!E.skipCheck&&!F.json)console.log(`
|
|
54
|
+
Checking ${E.name} (${E.ssh}:${E.root})...`);let B=await k0(E);if(F.json)console.log(JSON.stringify(B,null,2));else{if(B.checkResult)console.log(R8(B.checkResult)),console.log();let t=E.setDefault?S.dim(" (default)"):"",$=B.action==="created"?"Added":"Updated";if(B.checkResult?.ok===!1)console.log(S.yellow(`${$} host "${B.host.name}"${t}, but check failed.`));else console.log(S.green(`${$} host "${B.host.name}"${t}`))}if(B.checkResult&&!B.checkResult.ok)process.exit(2)}catch(E){if(E instanceof uD)console.log(S.dim(`
|
|
55
|
+
Cancelled.`)),process.exit(130);if(E instanceof k){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(E.code==="VALIDATION_ERROR"?1:1)}throw E}})}function f8(D){switch(D){case"ok":return S.green("ok");case"error":return S.red("error");default:return S.dim("unchecked")}}function fD(D,u){return D.padEnd(u)}function tE(D){D.command("ls").description("List all configured hosts").option("--json","Output as JSON").action(async(u)=>{let F=await m0();if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.hosts.length===0){console.log(S.dim("No hosts configured. Run `wt host add` to add one."));return}let E=Math.max(4,...F.hosts.map((t)=>t.name.length))+2,C=Math.max(3,...F.hosts.map((t)=>t.ssh.length))+2,B=Math.max(4,...F.hosts.map((t)=>t.root.length))+2;console.log(S.bold(fD("NAME",E)+fD("SSH",C)+fD("ROOT",B)+fD("DEFAULT",9)+"STATUS"));for(let t of F.hosts){let n=t.name===F.defaultHost?S.cyan("*"):S.dim("-");console.log(fD(t.name,E)+fD(t.ssh,C)+fD(t.root,B)+fD(n,9)+f8(t.lastStatus))}})}function N8(D,u,F){let E=[];if(E.push(`Checking ${D.host} (${u}:${F})...`),D.checks.ssh.ok)E.push(` ${S.green("\u2713")} SSH connection`);else E.push(` ${S.red("\u2717")} SSH connection: ${D.checks.ssh.error}`);if(D.checks.ssh.ok){if(D.checks.directories.ok)E.push(` ${S.green("\u2713")} Directory structure`);else E.push(` ${S.red("\u2717")} Directory structure: ${D.checks.directories.error||"failed"}`);if(D.checks.git.ok)E.push(` ${S.green("\u2713")} git ${D.checks.git.version}`);else E.push(` ${S.red("\u2717")} git: ${D.checks.git.error||"not found"}`);if(D.checks.node.ok)E.push(` ${S.green("\u2713")} node ${D.checks.node.version}`);else E.push(` ${S.yellow("\u26A0")} node not found (optional)`)}return E.join(`
|
|
56
|
+
`)}function $E(D){D.command("check").description("Test connectivity and capabilities of a host").argument("<name>","Host to check").option("--json","Output result as JSON").action(async(u,F)=>{try{let E=await g(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(S.red(`Error: Host "${u}" not found`));process.exit(1)}let C=await V0(u);if(F.json)console.log(JSON.stringify(C,null,2));else if(console.log(N8(C,E.ssh,E.root)),console.log(),C.ok)console.log(S.green(`Host "${u}" is ready.`));else console.log(S.red(`Host "${u}" check failed.`));if(!C.ok){if(!C.checks.ssh.ok)process.exit(2);process.exit(3)}}catch(E){if(E instanceof k){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(E.code==="HOST_NOT_FOUND"?1:1)}throw E}})}function xE(D){D.command("rm").description("Remove a host configuration").argument("<name>","Host to remove").option("-y, --yes","Skip confirmation prompt").option("--json","Output result as JSON").action(async(u,F)=>{let E=await g(u);if(!E){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${u}" not found`},null,2));else console.error(S.red(`Error: Host "${u}" not found`));process.exit(1)}try{if(!F.yes&&!F.json){if(!await tD({message:`Remove host "${u}" (${E.ssh})?`,default:!1})){console.log(S.dim("Cancelled."));return}}}catch(B){if(B instanceof uD)console.log(S.dim(`
|
|
57
|
+
Cancelled.`)),process.exit(130);throw B}let C=await W0(u);if(F.json)console.log(JSON.stringify({ok:C,removed:u},null,2));else console.log(S.green(`Removed host "${u}"`))})}function r0(D){let u=D.command("host").description("Manage remote compute hosts");BE(u),tE(u),$E(u),xE(u)}class N extends Error{code;constructor(D,u){super(u);this.code=D;this.name="SandboxError"}}async function AE(){try{let D=await Bun.$`git remote get-url origin`.quiet().nothrow();if(D.exitCode!==0)throw new N("GIT_ERROR","No git remote 'origin' found");return D.stdout.toString().trim()}catch(D){if(D instanceof N)throw D;throw new N("NOT_IN_GIT_REPO","Not inside a git repository")}}async function HE(){let D=await Bun.$`git rev-parse HEAD`.quiet().nothrow();if(D.exitCode!==0)throw new N("GIT_ERROR","Failed to resolve HEAD");return D.stdout.toString().trim()}async function Lu(){let D=await Bun.$`git rev-parse --show-toplevel`.quiet().nothrow();if(D.exitCode!==0)throw new N("NOT_IN_GIT_REPO","Not inside a git repository");return D.stdout.toString().trim()}async function Yu(){return(await Bun.$`git rev-parse --is-inside-work-tree`.quiet().nothrow()).exitCode===0}async function Qu(){let D=await Bun.$`git rev-parse --abbrev-ref HEAD`.quiet().nothrow();if(D.exitCode!==0)return null;let u=D.stdout.toString().trim();return u==="HEAD"?null:u}function Ku(D){return(D.includes("/")?D.split("/").pop():D).replace(/[^a-zA-Z0-9._-]/g,"-").replace(/^-+|-+$/g,"")}import{webcrypto as SE}from"crypto";var nE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var O8=128,MD,VD;function _8(D){if(!MD||MD.length<D)MD=Buffer.allocUnsafe(D*O8),SE.getRandomValues(MD),VD=0;else if(VD+D>MD.length)SE.getRandomValues(MD),VD=0;VD+=D}function wE(D=21){_8(D|=0);let u="";for(let F=VD-D;F<VD;F++)u+=nE[MD[F]&63];return u}function RE(){return wE(12)}async function hE(D){let u=D.replace(/\.git$/,"").toLowerCase().trim(),F=new TextEncoder().encode(u);return new Bun.CryptoHasher("sha256").update(F).digest("hex").slice(0,16)}class Wu{async ensureLayout(D){await Bun.$`mkdir -p ${D}/mirrors ${D}/sandboxes ${D}/meta`.quiet()}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!await Bun.file(`${E}/HEAD`).exists()){let t=await Bun.$`git clone --bare --mirror ${F} ${E}`.quiet().nothrow();if(t.exitCode!==0)throw Error(`Failed to create mirror: ${t.stderr.toString().trim()}`)}else await Bun.$`git -C ${E} fetch --prune origin`.quiet().nothrow();let B=await Lu();return await Bun.$`git -C ${E} fetch ${B} '+refs/heads/*:refs/heads/*'`.quiet().nothrow(),E}async createWorktree(D,u,F,E){let C=E?await Bun.$`git -C ${D} worktree add -B ${E} ${u}`.quiet().nothrow():await Bun.$`git -C ${D} worktree add --detach ${u} ${F}`.quiet().nothrow();if(C.exitCode!==0)throw Error(`Failed to create worktree: ${C.stderr.toString().trim()}`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`;await Bun.write(E,JSON.stringify(F,null,2))}async removeSandboxDir(D){await Bun.$`rm -rf ${D}`.quiet().nothrow()}async pruneWorktrees(D){await Bun.$`git -C ${D} worktree prune`.quiet().nothrow()}async removeMeta(D,u){let F=`${D}/meta/${u}.json`;await Bun.$`rm -f ${F}`.quiet().nothrow()}async dirExists(D){return Bun.file(`${D}/.git`).exists()}async exec(D,u){let[F,...E]=u,C=await Bun.$`${F} ${E}`.cwd(D).quiet().nothrow();return{exitCode:C.exitCode,stdout:C.stdout.toString().trim(),stderr:C.stderr.toString().trim()}}async execStream(D,u){return Bun.spawn(u,{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=Bun.env.SHELL||"/bin/sh",C=await Bun.spawn([F,"-l"],{cwd:D,stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}).exited;process.exit(C)}async execTmux(D,u){let E=await Bun.spawn(["tmux","new-session","-A","-s",u,"-c",D],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited;process.exit(E)}async listTmuxSessions(){let D=await Bun.$`tmux ls -F '#{session_name}\t#{session_attached}'`.quiet().nothrow();if(D.exitCode!==0)return[];return D.stdout.toString().trim().split(`
|
|
58
|
+
`).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*");for await(let E of F.scan({cwd:D,onlyFiles:!0,dot:!0})){let C=Bun.file(`${D}/${E}`);await Bun.write(`${u}/${E}`,C)}}async checkGit(){let D=await Bun.$`git --version`.quiet().nothrow();if(D.exitCode!==0)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.toString().trim()}}async checkTmux(){let D=await Bun.$`tmux -V`.quiet().nothrow();if(D.exitCode!==0)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.toString().trim()}}async checkRuntime(){let D=await Bun.$`bun --version`.quiet().nothrow();if(D.exitCode===0)return{name:"bun",ok:!0,detail:D.stdout.toString().trim()};let u=await Bun.$`node --version`.quiet().nothrow();if(u.exitCode===0)return{name:"node",ok:!0,detail:u.stdout.toString().trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}function b0(D){let u=[];for(let F=0;F<D.length;F++){if(D[F]==="-o"&&D[F+1]?.startsWith("BatchMode")){F++;continue}u.push(D[F])}return u}class yu{host;constructor(D){this.host=D}get sshOpts(){return HD(this.host)}async ensureLayout(D){let u=["mirrors","sandboxes","meta"].map((E)=>`${D}/${E}`).join(" "),F=await U(this.sshOpts,`mkdir -p ${u}`);if(!F.ok)throw Error(`Failed to create remote layout: ${F.stderr}`)}async ensureMirror(D,u,F){let E=`${D}/mirrors/${u}.git`;if(!(await U(this.sshOpts,`test -f ${E}/HEAD`)).ok){let B=await U(this.sshOpts,`git clone --bare --mirror ${F} ${E}`);if(!B.ok)throw Error(`Failed to create remote mirror: ${B.stderr}`)}else await U(this.sshOpts,`git -C ${E} fetch --prune origin`);return E}async createWorktree(D,u,F,E){let C=E?`git -C ${D} worktree add -B ${E} ${u}`:`git -C ${D} worktree add --detach ${u} ${F}`,B=await U(this.sshOpts,C);if(!B.ok)throw Error(`Failed to create remote worktree: ${B.stderr}`)}async writeMeta(D,u,F){let E=`${D}/meta/${u}.json`,B=JSON.stringify(F,null,2).replace(/'/g,"'\\''"),t=await U(this.sshOpts,`printf '%s' '${B}' > ${E}`);if(!t.ok)throw Error(`Failed to write remote meta: ${t.stderr}`)}async removeSandboxDir(D){await U(this.sshOpts,`rm -rf ${D}`)}async pruneWorktrees(D){await U(this.sshOpts,`git -C ${D} worktree prune`)}async removeMeta(D,u){await U(this.sshOpts,`rm -f ${D}/meta/${u}.json`)}async dirExists(D){return(await U(this.sshOpts,`test -d ${D}`)).ok}async exec(D,u){let F=u.map((C)=>`'${C.replace(/'/g,"'\\''")}'`).join(" "),E=await U(this.sshOpts,`cd ${D} && ${F}`);return{exitCode:E.exitCode,stdout:E.stdout,stderr:E.stderr}}async execStream(D,u){let F=u.map((t)=>`'${t.replace(/'/g,"'\\''")}'`).join(" "),E=b0(PD(this.sshOpts)),C=`cd ${D} && ${F}`;return Bun.spawn(["ssh","-t",...E,C],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}async execInteractive(D,u){let F=b0(PD(this.sshOpts)),E=`cd ${D} && exec $SHELL -l`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async execTmux(D,u){let F=b0(PD(this.sshOpts)),E=`cd ${D} && tmux new-session -A -s ${u}`,B=await Bun.spawn(["ssh","-t",...F,E],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:process.env}).exited;process.exit(B)}async listTmuxSessions(){let D=await U(this.sshOpts,"tmux ls -F '#{session_name}\t#{session_attached}'");if(!D.ok)return[];return D.stdout.trim().split(`
|
|
59
|
+
`).filter(Boolean).map((F)=>{let[E,C]=F.split("\t");return{name:E,attached:C==="1"}}).filter((F)=>F.name.startsWith("wt-"))}async copyEnvFiles(D,u){let F=new Bun.Glob(".env*"),E=[];for await(let n of F.scan({cwd:D,onlyFiles:!0,dot:!0}))E.push(n);if(E.length===0)return;let C=PD(this.sshOpts),B=C.pop(),t=C.filter((n)=>n!=="-o"||!0),$=[];for(let n=0;n<C.length;n++)if(C[n]==="-p")$.push("-P",C[n+1]),n++;else if(C[n]==="-i")$.push("-i",C[n+1]),n++;else if(C[n]==="-o")$.push("-o",C[n+1]),n++;for(let n of E){let A=`${D}/${n}`,x=`${B}:${u}/${n}`;await Bun.$`scp ${$} ${A} ${x}`.quiet().nothrow()}}async checkGit(){let D=await U(this.sshOpts,"git --version");if(!D.ok)return{name:"git",ok:!1,detail:"not found"};return{name:"git",ok:!0,detail:D.stdout.trim()}}async checkTmux(){let D=await U(this.sshOpts,"tmux -V");if(!D.ok)return{name:"tmux",ok:!1,detail:"not found"};return{name:"tmux",ok:!0,detail:D.stdout.trim()}}async checkRuntime(){let D=await U(this.sshOpts,"bun --version");if(D.ok)return{name:"bun",ok:!0,detail:D.stdout.trim()};let u=await U(this.sshOpts,"node --version");if(u.ok)return{name:"node",ok:!0,detail:u.stdout.trim()};return{name:"runtime",ok:!1,detail:"neither bun nor node found"}}}async function y(D){if(D===z)return new Wu;let u=await g(D);if(!u)throw new N("HOST_NOT_FOUND",`Host "${D}" not found`);return new yu(u)}async function $D(D){if(D===z)return`${await Lu()}/.wt`;let u=await g(D);if(!u)throw new N("HOST_NOT_FOUND",`Host "${D}" not found`);return u.root}async function v0(D){return(await a()).sandboxes[D]}async function fE(D){await p((u)=>{u.sandboxes[D.name]=D})}async function NE(){let D=await a();return Object.values(D.sandboxes).sort((u,F)=>u.name.localeCompare(F.name))}async function nD(D){let u=await v0(D);if(!u)throw new N("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);return u}async function OE(D,u){let F=await p((E)=>{let C=E.sandboxes[D];if(!C)throw new N("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);if(E.sandboxes[u])throw new N("SANDBOX_EXISTS",`Sandbox "${u}" already exists`);let B={...C,name:u};return delete E.sandboxes[D],E.sandboxes[u]=B,B});try{let E=await y(F.host),C=await $D(F.host);await E.writeMeta(C,F.id,F)}catch{}return F}async function Pu(D){let u=await AE(),F=await hE(u),E=D.branch??D.ref??await HE(),C=D.branch,B=await y(D.hostName),t=await $D(D.hostName),$=await v0(D.name);if($){if($.host===D.hostName&&$.repoId===F){if(await B.dirExists($.path))return{entry:$,isIdempotent:!0}}throw new N("SANDBOX_EXISTS",`Sandbox "${D.name}" already exists (host=${$.host}, repoId=${$.repoId})`)}let n=RE(),A=`${t}/sandboxes/${D.name}`;try{await B.ensureLayout(t);let x=await B.ensureMirror(t,F,u);await B.createWorktree(x,A,E,C),await B.copyEnvFiles(process.cwd(),A);let H={name:D.name,id:n,host:D.hostName,origin:u,repoId:F,ref:E,path:A,createdAt:new Date().toISOString()};return await B.writeMeta(t,n,H),await fE(H),{entry:H,isIdempotent:!1}}catch(x){if(x instanceof N)throw x;throw new N("CREATION_FAILED",x instanceof Error?x.message:String(x))}}async function kD(D){let u=await nD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new N("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);return F.execInteractive(u.path,{WT_SANDBOX:u.name,WT_SANDBOX_ID:u.id})}async function mD(D){let u=await nD(D),F=await y(u.host);if(!await F.dirExists(u.path))throw new N("PATH_MISSING",`Sandbox path does not exist: ${u.path}`);if(!(await F.checkTmux()).ok)throw new N("CREATION_FAILED","tmux not found on host. Run: wt bootstrap --tmux --host <host>");let B=`wt-${u.id}`;return F.execTmux(u.path,B)}function Vu(D,u){if(D.host===z)return`wt enter ${D.name}`;if(!u)return`wt enter ${D.name}`;let F=["ssh","-t"];if(u.port)F.push("-p",String(u.port));if(u.identity)F.push("-i",u.identity);return F.push(u.ssh,`'cd ${D.path} && exec $SHELL -l'`),F.join(" ")}function o0(D){D.command("up").description("Create a sandbox worktree on a host").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-H, --host <hostName>","Target host (defaults to configured default)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Yu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(S.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(S.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let x=C??E??await Qu();if(x)B=Ku(x);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(S.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let t;if(F.host){if(t=F.host,t!==z){if(!await g(t)){if(F.json)console.log(JSON.stringify({ok:!1,error:`Host "${t}" not found`},null,2));else console.error(S.red(`Error: Host "${t}" not found`));process.exit(1)}}}else t=(await zD())?.name??z;let $=await Pu({name:B,hostName:t,ref:E,branch:C});if(F.json){console.log(JSON.stringify($.entry,null,2));return}if($.isIdempotent)console.log(S.dim(`Sandbox "${B}" already exists`));else console.log(S.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await mD(B);else await kD(B);return}let n=t!==z?await g(t):void 0,A=Vu($.entry,n??void 0);if(process.stdout.isTTY)console.log(`Enter with: ${S.cyan(A)}`);else console.log(A)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function d0(D){D.command("local").description("Create a local sandbox worktree").argument("[name]","Sandbox name (defaults to branch name from -b/--ref or current branch)").option("-b, --branch <name>","Create or use a branch with this name").option("-r, --ref <ref>","Git ref to check out (branch, tag, or sha that must exist)").option("-e, --enter","Enter the sandbox after creating it").option("--tmux","Use tmux when entering (implies --enter)").option("--json","Output result as JSON").action(async(u,F)=>{try{if(!await Yu()){if(F.json)console.log(JSON.stringify({ok:!1,error:"Not inside a git repository"},null,2));else console.error(S.red("Error: Not inside a git repository"));process.exit(1)}if(F.branch&&F.ref){if(F.json)console.log(JSON.stringify({ok:!1,error:"Cannot use both --branch and --ref"},null,2));else console.error(S.red("Error: Cannot use both --branch and --ref"));process.exit(1)}let{ref:E,branch:C}=F,B=u;if(!B){let n=C??E??await Qu();if(n)B=Ku(n);else{if(F.json)console.log(JSON.stringify({ok:!1,error:"No name provided and could not determine branch name"},null,2));else console.error(S.red("Error: No name provided and could not determine branch name"));process.exit(1)}}let t=await Pu({name:B,hostName:z,ref:E,branch:C});if(F.json){console.log(JSON.stringify(t.entry,null,2));return}if(t.isIdempotent)console.log(S.dim(`Sandbox "${B}" already exists`));else console.log(S.green(`Created sandbox "${B}"`));if(F.enter||F.tmux){if(F.tmux)await mD(B);else await kD(B);return}let $=Vu(t.entry);if(process.stdout.isTTY)console.log(`Enter with: ${S.cyan($)}`);else console.log($)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function c0(D){D.command("enter").description("Enter an existing sandbox").argument("<name>","Sandbox name").option("--json","Output sandbox record as JSON without entering").option("--tmux","Attach or create a tmux session in the sandbox").action(async(u,F)=>{try{if(F.json){let E=await nD(u);console.log(JSON.stringify(E,null,2));return}if(F.tmux)await mD(u);else await kD(u)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}async function _E(D,u,F){let E=await nD(D),C=await y(E.host);if(!await C.dirExists(E.path))throw new N("PATH_MISSING",`Sandbox path does not exist: ${E.path}`);if(F.capture){let $=await C.exec(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:$.exitCode,stdout:$.stdout,stderr:$.stderr}}let t=await C.execStream(E.path,u);return{name:E.name,id:E.id,host:E.host,path:E.path,command:u,exitCode:t,stdout:"",stderr:""}}function g0(D){D.command("run").description("Run a command in a sandbox").argument("<name>","Sandbox name").argument("<cmd...>","Command to run").option("--json","Capture output and return as JSON").option("--quiet","Suppress non-error output").passThroughOptions().action(async(u,F,E)=>{try{let C=F[0]==="--"?F.slice(1):F;if(C.length===0)console.error(S.red("Error: No command specified")),process.exit(1);let B=await _E(u,C,{capture:!!E.json});if(E.json)console.log(JSON.stringify(B,null,2)),process.exit(B.exitCode);process.exit(B.exitCode)}catch(C){if(C instanceof N){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else if(!E.quiet)console.error(S.red(`Error: ${C.message}`));process.exit(1)}throw C}})}async function TE(D){let u=await y(D);if(!(await u.checkTmux()).ok)return{host:D,sessions:[],ok:!0,warnings:["tmux not installed"]};let E=await u.listTmuxSessions();return{host:D,sessions:E,ok:!0,warnings:[]}}function i0(D){D.command("sessions").description("List running tmux sessions for wt sandboxes").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await zD())?.name??z;let E=await TE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.warnings.length>0)for(let C of E.warnings)console.error(S.yellow(`Warning: ${C}`));if(E.sessions.length===0){console.log(S.dim("No active sessions."));return}for(let C of E.sessions){let B=C.attached?S.green("attached"):S.dim("detached");console.log(`${C.name} ${B}`)}})}var qE=dD(JE(),1);async function s0(D){let u=qE.default(D.olderThan);if(u===void 0||u<=0)throw Error(`Invalid duration: ${D.olderThan}`);let F=await a(),C=Date.now()-u,B=Object.values(F.sandboxes),t=D.hostName?B.filter((H)=>H.host===D.hostName):B,$=[],n=[],A=[],x=new Set;for(let H of t){let w=new Date(H.createdAt).getTime()<C;if(!w)try{if(!await(await y(H.host)).dirExists(H.path))w=!0}catch{w=!0}if(!w){n.push(H);continue}if(D.dryRun){$.push(H);continue}try{let h=await y(H.host),f=await $D(H.host);await h.removeSandboxDir(H.path),await h.removeMeta(f,H.id),x.add(`${H.host}:${f}/mirrors/${H.repoId}.git`),$.push(H)}catch(h){A.push({sandbox:H.name,error:h instanceof Error?h.message:String(h)})}}if(!D.dryRun&&$.length>0)await p((H)=>{for(let R of $)delete H.sandboxes[R.name]});if(!D.dryRun)for(let H of x){let[R,w]=H.split(":",2);try{await(await y(R)).pruneWorktrees(w)}catch{}}return{deleted:$,kept:n,errors:A}}function a0(D){D.command("gc").description("Remove stale sandboxes").option("-H, --host <hostName>","Target host (omit for all hosts)").option("--older-than <duration>","Age threshold (e.g. 7d, 24h, 1w)","7d").option("--dry-run","Show what would be deleted without deleting").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u)=>{try{let F=await s0({hostName:u.host,olderThan:u.olderThan,dryRun:!0});if(u.json&&u.dryRun){console.log(JSON.stringify(F,null,2));return}if(F.deleted.length===0&&F.errors.length===0){if(u.json)console.log(JSON.stringify(F,null,2));else console.log(S.dim("Nothing to clean up."));return}if(u.dryRun){if(F.deleted.length>0){console.log(`Would delete ${F.deleted.length} sandbox(es)`);for(let C of F.deleted)console.log(` ${S.red("-")} ${C.name} (${C.host})`)}return}if(!u.json){console.log(`Found ${F.deleted.length} sandbox(es) to delete:`);for(let C of F.deleted)console.log(` ${S.red("-")} ${C.name} (${C.host})`)}if(!u.yes&&!u.json){if(!await tD({message:`Delete ${F.deleted.length} sandbox(es)?`,default:!1})){console.log(S.dim("Cancelled."));return}}let E=await s0({hostName:u.host,olderThan:u.olderThan,dryRun:!1});if(u.json){console.log(JSON.stringify(E,null,2));return}if(E.deleted.length>0)console.log(`Deleted ${E.deleted.length} sandbox(es)`);if(E.errors.length>0){for(let C of E.errors)console.error(S.red(`Error (${C.sandbox}): ${C.error}`));process.exit(1)}}catch(F){if(F instanceof uD)console.log(S.dim(`
|
|
60
|
+
Cancelled.`)),process.exit(130);if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(S.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function GE(D){let u=[],F=[],E=[];if(D!==z){let A=await g(D);if(!A)return{ok:!1,host:D,checks:[{name:"host",ok:!1,detail:"not found in config"}],warnings:[],errors:[`Host "${D}" not found`]};let x=await Mu(HD(A)),H=x.ok?{name:"ssh",ok:!0,detail:"connected"}:{name:"ssh",ok:!1,detail:x.stderr||"connection failed"};if(u.push(H),!H.ok)return E.push(`SSH connection failed: ${H.detail}`),{ok:!1,host:D,checks:u,warnings:F,errors:E}}let C=await y(D),B=await C.checkGit();if(u.push(B),!B.ok)E.push(`git: ${B.detail}`);let t=await C.checkRuntime();if(u.push(t),!t.ok)F.push(`runtime: ${t.detail}`);let $=await C.checkTmux();if(u.push($),!$.ok)F.push(`tmux: ${$.detail}`);return{ok:u.every((A)=>A.ok||A.name==="tmux"||A.name==="runtime"),host:D,checks:u,warnings:F,errors:E}}function l0(D){D.command("doctor").description("Check system prerequisites and host health").option("-H, --host <hostName>","Target host").option("--json","Output as JSON").action(async(u)=>{let F;if(u.host)F=u.host;else F=(await zD())?.name??z;let E=await GE(F);if(u.json){console.log(JSON.stringify(E,null,2));return}for(let C of E.checks)if(C.ok)console.log(` ${S.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${S.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.warnings.length>0)for(let C of E.warnings)console.log(` ${S.yellow("\u26A0")} ${C}`);if(console.log(),E.ok)console.log(S.green(`Host "${F}" is healthy.`));else console.log(S.red(`Host "${F}" has issues.`)),process.exit(1)})}async function j8(D){let u=await g(D);if(!u)return null;let F=HD(u);for(let E of["apt-get","apk","dnf","yum","brew"])if((await U(F,`command -v ${E}`)).ok)return E;return null}function X8(D,u){switch(u){case"apt-get":return`sudo apt-get install -y ${D}`;case"apk":return`sudo apk add ${D}`;case"dnf":return`sudo dnf install -y ${D}`;case"yum":return`sudo yum install -y ${D}`;case"brew":return`brew install ${D}`;default:return`install ${D} manually`}}async function jE(D){let u=[],F=[],E=[],C=D.hostName===z,B=await y(D.hostName),t=await B.checkGit();if(u.push(t),!t.ok)F.push("git");let $=await B.checkRuntime();if(u.push($),!$.ok)F.push("bun or node");if(D.tmux){let A=await B.checkTmux();if(u.push(A),!A.ok)F.push("tmux")}if(!C){let A=await g(D.hostName);if(!A)throw new N("HOST_NOT_FOUND",`Host "${D.hostName}" not found`);let x=HD(A);for(let H of["bash","curl"]){let w=(await U(x,`command -v ${H}`)).ok?{name:H,ok:!0}:{name:H,ok:!1,detail:"not found"};if(u.push(w),!w.ok)F.push(H)}for(let H of D.agents){let w=(await U(x,`command -v ${H}`)).ok?{name:H,ok:!0}:{name:H,ok:!1,detail:"not found"};if(u.push(w),!w.ok)F.push(H)}if(F.length>0){let H=await j8(D.hostName);if(H)for(let R of F)if(R==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else if(R==="claude"||R==="opencode")E.push(`npm install -g ${R}`);else E.push(X8(R,H));else E.push(`No package manager found. Install manually: ${F.join(", ")}`)}}else if(F.length>0)for(let A of F)if(A==="bun or node")E.push("curl -fsSL https://bun.sh/install | bash");else E.push(`Install ${A} using your system package manager`);try{let A=await $D(D.hostName);await B.ensureLayout(A),u.push({name:"layout",ok:!0})}catch(A){u.push({name:"layout",ok:!1,detail:A instanceof Error?A.message:String(A)})}let n=F.length===0&&u.every((A)=>A.ok);return{host:D.hostName,ok:n,checks:u,missing:F,instructions:E}}function p0(D){D.command("bootstrap").description("Check host readiness and report missing packages").requiredOption("-H, --host <hostName>","Target host").option("--tmux","Include tmux in checks").option("--agents <list>","Comma-separated agent CLIs to check (e.g. claude,opencode)").option("--json","Output as JSON").action(async(u)=>{try{let F=u.agents?u.agents.split(",").map((C)=>C.trim()).filter(Boolean):[],E=await jE({hostName:u.host,tmux:!!u.tmux,agents:F});if(u.json){if(console.log(JSON.stringify(E,null,2)),!E.ok)process.exit(1);return}for(let C of E.checks)if(C.ok)console.log(` ${S.green("\u2713")} ${C.name}${C.detail?` (${C.detail})`:""}`);else console.log(` ${S.red("\u2717")} ${C.name}${C.detail?`: ${C.detail}`:""}`);if(E.missing.length>0)console.log(),console.log(S.yellow(`Missing: ${E.missing.join(", ")}`));if(E.instructions.length>0){console.log(),console.log(S.dim("Install instructions:"));for(let C of E.instructions)console.log(` ${C}`)}if(console.log(),E.ok)console.log(S.green(`Host "${u.host}" is ready.`));else console.log(S.red(`Host "${u.host}" is not ready.`)),process.exit(1)}catch(F){if(F instanceof N){if(u.json)console.log(JSON.stringify({ok:!1,error:F.message},null,2));else console.error(S.red(`Error: ${F.message}`));process.exit(1)}throw F}})}async function XE(D){let u=await NE(),F=D.hostName?u.filter((E)=>E.host===D.hostName):u;return{sandboxes:F,total:F.length}}function e0(D){D.command("ls").description("List sandboxes").option("-H, --host <hostName>","Filter by host").option("--json","Output as JSON").action(async(u)=>{try{let F=await XE({hostName:u.host});if(u.json){console.log(JSON.stringify(F,null,2));return}if(F.total===0){console.log(S.dim("No sandboxes found."));return}let E=Math.max(...F.sandboxes.map((t)=>t.name.length),4),C=Math.max(...F.sandboxes.map((t)=>t.host.length),4),B=Math.max(...F.sandboxes.map((t)=>t.ref.substring(0,8).length),3);console.log(S.bold(`${"NAME".padEnd(E)} ${"HOST".padEnd(C)} ${"REF".padEnd(B)} CREATED`));for(let t of F.sandboxes){let $=t.ref.substring(0,8),n=new Date(t.createdAt).toLocaleDateString();console.log(`${S.cyan(t.name.padEnd(E))} ${t.host.padEnd(C)} ${S.yellow($.padEnd(B))} ${S.dim(n)}`)}console.log(S.dim(`
|
|
61
|
+
${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,error:F instanceof Error?F.message:String(F)},null,2));else console.error(S.red(`Error: ${F instanceof Error?F.message:String(F)}`));process.exit(1)}})}async function zE(D){let F=(await a()).sandboxes[D];if(!F)throw new N("SANDBOX_NOT_FOUND",`Sandbox "${D}" not found`);let E=await y(F.host),C=await $D(F.host),B={dir:!1,meta:!1,config:!1};try{await E.removeSandboxDir(F.path),B.dir=!0}catch{}try{await E.removeMeta(C,F.id),B.meta=!0}catch{}await p((t)=>{delete t.sandboxes[D]}),B.config=!0;try{let t=`${C}/mirrors/${F.repoId}.git`;await E.pruneWorktrees(t)}catch{}return{entry:F,cleaned:B}}function DF(D){D.command("rm").description("Remove a sandbox").argument("<name>","Sandbox name").option("-y, --yes","Skip confirmation prompt").option("--json","Output as JSON").action(async(u,F)=>{try{if(!F.yes&&!F.json){if(!await tD({message:`Remove sandbox "${u}"?`,default:!1})){console.log(S.dim("Cancelled."));return}}let E=await zE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}console.log(`Removed sandbox ${S.cyan(E.entry.name)}`);let C=[];if(!E.cleaned.dir)C.push("directory");if(!E.cleaned.meta)C.push("metadata");if(C.length>0)console.log(S.yellow(` Warning: could not clean ${C.join(", ")}`))}catch(E){if(E instanceof uD)console.log(S.dim(`
|
|
62
|
+
Cancelled.`)),process.exit(130);if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function z8(D){let u=Date.now()-new Date(D).getTime(),F=Math.floor(u/1000);if(F<60)return`${F}s`;let E=Math.floor(F/60);if(E<60)return`${E}m`;let C=Math.floor(E/60);if(C<24)return`${C}h`;return`${Math.floor(C/24)}d`}async function UE(D){let u=await nD(D),F=await y(u.host),E=!1;try{E=await F.dirExists(u.path)}catch{}let C=null;try{let B=await F.listTmuxSessions(),t=`wt-${u.id}`,$=B.find((n)=>n.name===t);if($)C=$.name}catch{}return{entry:u,dirExists:E,tmuxSession:C,age:z8(u.createdAt)}}function uF(D){D.command("status").description("Show sandbox status").argument("<name>","Sandbox name").option("--json","Output as JSON").action(async(u,F)=>{try{let E=await UE(u);if(F.json){console.log(JSON.stringify(E,null,2));return}let{entry:C,dirExists:B,tmuxSession:t,age:$}=E;console.log(S.bold(C.name)),console.log(` ${"ID".padEnd(10)} ${S.dim(C.id)}`),console.log(` ${"Host".padEnd(10)} ${C.host}`),console.log(` ${"Ref".padEnd(10)} ${S.yellow(C.ref.substring(0,8))}`),console.log(` ${"Origin".padEnd(10)} ${S.dim(C.origin)}`),console.log(` ${"Path".padEnd(10)} ${C.path}`),console.log(` ${"Age".padEnd(10)} ${$}`);let n=B?S.green("exists"):S.red("missing");console.log(` ${"Dir".padEnd(10)} ${n}`);let A=t?S.green(t):S.dim("none");console.log(` ${"Tmux".padEnd(10)} ${A}`)}catch(E){if(E instanceof N){if(F.json)console.log(JSON.stringify({ok:!1,error:E.message},null,2));else console.error(S.red(`Error: ${E.message}`));process.exit(1)}throw E}})}function FF(D){D.command("rename").description("Rename a sandbox").argument("<old>","Current sandbox name").argument("<new>","New sandbox name").option("--json","Output result as JSON").action(async(u,F,E)=>{try{let C=await OE(u,F);if(E.json){console.log(JSON.stringify(C,null,2));return}console.log(S.green(`Renamed "${u}" -> "${F}"`))}catch(C){if(C instanceof N){if(E.json)console.log(JSON.stringify({ok:!1,error:C.message},null,2));else console.error(S.red(`Error: ${C.message}`));process.exit(1)}throw C}})}var i=new IF,ME="0.0.2";function U8(D,u=""){let F=[],E=D.name(),C=D.registeredArguments.map(($)=>$.required?`<${$.name()}>`:`[${$.name()}]`).join(" "),B=C?`${E} ${C}`:E;F.push(`${u}${B}`);let t=D.commands.filter(($)=>$.name()!=="help");return t.forEach(($,n)=>{let A=n===t.length-1,x=A?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",H=u+(A?" ":"\u2502 "),R=$.name(),w=$.registeredArguments.map((O)=>O.required?`<${O.name()}>`:`[${O.name()}]`).join(" "),h=w?`${R} ${w}`:R,f=$.commands.filter((O)=>O.name()!=="help");if(f.length>0)F.push(`${u}${x}${h}`),f.forEach((O,I)=>{let T=I===f.length-1?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ",b=O.name(),e=O.registeredArguments.map((oD)=>oD.required?`<${oD.name()}>`:`[${oD.name()}]`).join(" "),SD=e?`${b} ${e}`:b;F.push(`${H}${T}${SD}`)});else F.push(`${u}${x}${h}`)}),F}i.name("wt").enablePositionalOptions().description("Run worktrees, coding agents, and more all from the cloud. SSH included, agents too!").version(ME,"-v, --version").option("--tree","Show command tree").action((D)=>{if(D.tree){console.log(U8(i).join(`
|
|
60
63
|
`));return}let u=`
|
|
61
64
|
__
|
|
62
65
|
/\\ \\__
|
|
@@ -65,6 +68,6 @@ ${F.total} sandbox(es)`))}catch(F){if(u.json)console.log(JSON.stringify({ok:!1,e
|
|
|
65
68
|
\\ \\ \\_/ \\_/ \\\\ \\ \\_
|
|
66
69
|
\\ \\_______/' \\ \\__\\
|
|
67
70
|
\\/__//__/ \\/__/
|
|
68
|
-
`;console.log(
|
|
69
|
-
`)),console.log(
|
|
70
|
-
`))});
|
|
71
|
+
`;console.log(S.green(u)),console.log(S.cyan("Start worktrees in the cloud.")),console.log(S.white.bold.italic("wt --help"),S.gray.italic(`to get started.
|
|
72
|
+
`)),console.log(S.dim(`v${ME} \u2022 https://github.com/abhi-arya1/wt
|
|
73
|
+
`))});r0(i);o0(i);d0(i);c0(i);g0(i);i0(i);a0(i);l0(i);p0(i);e0(i);DF(i);uF(i);FF(i);function ZE(){i.parse(process.argv)}ZE();export{ZE as run,i as program};
|