@visulima/cerebro 3.0.0-alpha.6 → 3.0.0-alpha.7

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## @visulima/cerebro [3.0.0-alpha.7](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.6...@visulima/cerebro@3.0.0-alpha.7) (2026-03-16)
2
+
3
+ ### Miscellaneous Chores
4
+
5
+ * **cerebro:** update dependencies ([401f0bf](https://github.com/visulima/visulima/commit/401f0bf2bab395ac191e48cded78fa354970b245))
6
+ * visulima website ([#591](https://github.com/visulima/visulima/issues/591)) ([59ab2e2](https://github.com/visulima/visulima/commit/59ab2e2befb03e51cd2088956f83d9b87de6d033))
7
+
8
+
9
+ ### Dependencies
10
+
11
+ * **@visulima/pail:** upgraded to 4.0.0-alpha.7
12
+
1
13
  ## @visulima/cerebro [3.0.0-alpha.6](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.5...@visulima/cerebro@3.0.0-alpha.6) (2026-03-06)
2
14
 
3
15
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -92,7 +92,7 @@ Repository: git+https://github.com/visulima/visulima.git
92
92
  >
93
93
  > > MIT License
94
94
  > >
95
- > > Copyright (c) 2025 visulima
95
+ > > Copyright (c) 2026 visulima
96
96
  > >
97
97
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
98
98
  > > of this software and associated documentation files (the "Software"), to deal
@@ -126,7 +126,7 @@ Repository: git+https://github.com/visulima/visulima.git
126
126
  > >
127
127
  > > > MIT License
128
128
  > > >
129
- > > > Copyright (c) 2025 visulima
129
+ > > > Copyright (c) 2026 visulima
130
130
  > > >
131
131
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
132
132
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -312,7 +312,7 @@ Repository: git+https://github.com/visulima/visulima.git
312
312
  >
313
313
  > > MIT License
314
314
  > >
315
- > > Copyright (c) 2025 visulima
315
+ > > Copyright (c) 2026 visulima
316
316
  > >
317
317
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
318
318
  > > of this software and associated documentation files (the "Software"), to deal
@@ -346,7 +346,7 @@ Repository: git+https://github.com/visulima/visulima.git
346
346
  > >
347
347
  > > > MIT License
348
348
  > > >
349
- > > > Copyright (c) 2025 visulima
349
+ > > > Copyright (c) 2026 visulima
350
350
  > > >
351
351
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
352
352
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -488,7 +488,7 @@ Repository: git+https://github.com/visulima/visulima.git
488
488
 
489
489
  > MIT License
490
490
  >
491
- > Copyright (c) 2025 visulima
491
+ > Copyright (c) 2026 visulima
492
492
  >
493
493
  > Permission is hereby granted, free of charge, to any person obtaining a copy
494
494
  > of this software and associated documentation files (the "Software"), to deal
@@ -522,7 +522,7 @@ Repository: git+https://github.com/visulima/visulima.git
522
522
  >
523
523
  > > MIT License
524
524
  > >
525
- > > Copyright (c) 2025 visulima
525
+ > > Copyright (c) 2026 visulima
526
526
  > >
527
527
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
528
528
  > > of this software and associated documentation files (the "Software"), to deal
@@ -1463,7 +1463,7 @@ Repository: git+https://github.com/visulima/visulima.git
1463
1463
  >
1464
1464
  > > MIT License
1465
1465
  > >
1466
- > > Copyright (c) 2025 visulima
1466
+ > > Copyright (c) 2026 visulima
1467
1467
  > >
1468
1468
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
1469
1469
  > > of this software and associated documentation files (the "Software"), to deal
@@ -1497,7 +1497,7 @@ Repository: git+https://github.com/visulima/visulima.git
1497
1497
  > >
1498
1498
  > > > MIT License
1499
1499
  > > >
1500
- > > > Copyright (c) 2025 visulima
1500
+ > > > Copyright (c) 2026 visulima
1501
1501
  > > >
1502
1502
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
1503
1503
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -1683,7 +1683,7 @@ Repository: git+https://github.com/visulima/visulima.git
1683
1683
  >
1684
1684
  > > MIT License
1685
1685
  > >
1686
- > > Copyright (c) 2025 visulima
1686
+ > > Copyright (c) 2026 visulima
1687
1687
  > >
1688
1688
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
1689
1689
  > > of this software and associated documentation files (the "Software"), to deal
@@ -1717,7 +1717,7 @@ Repository: git+https://github.com/visulima/visulima.git
1717
1717
  > >
1718
1718
  > > > MIT License
1719
1719
  > > >
1720
- > > > Copyright (c) 2025 visulima
1720
+ > > > Copyright (c) 2026 visulima
1721
1721
  > > >
1722
1722
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
1723
1723
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -1859,7 +1859,7 @@ Repository: git+https://github.com/visulima/visulima.git
1859
1859
 
1860
1860
  > MIT License
1861
1861
  >
1862
- > Copyright (c) 2025 visulima
1862
+ > Copyright (c) 2026 visulima
1863
1863
  >
1864
1864
  > Permission is hereby granted, free of charge, to any person obtaining a copy
1865
1865
  > of this software and associated documentation files (the "Software"), to deal
@@ -1893,7 +1893,7 @@ Repository: git+https://github.com/visulima/visulima.git
1893
1893
  >
1894
1894
  > > MIT License
1895
1895
  > >
1896
- > > Copyright (c) 2025 visulima
1896
+ > > Copyright (c) 2026 visulima
1897
1897
  > >
1898
1898
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
1899
1899
  > > of this software and associated documentation files (the "Software"), to deal
@@ -2808,7 +2808,7 @@ Repository: git+https://github.com/visulima/visulima.git
2808
2808
  >
2809
2809
  > > MIT License
2810
2810
  > >
2811
- > > Copyright (c) 2025 visulima
2811
+ > > Copyright (c) 2026 visulima
2812
2812
  > >
2813
2813
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
2814
2814
  > > of this software and associated documentation files (the "Software"), to deal
@@ -2842,7 +2842,7 @@ Repository: git+https://github.com/visulima/visulima.git
2842
2842
  > >
2843
2843
  > > > MIT License
2844
2844
  > > >
2845
- > > > Copyright (c) 2025 visulima
2845
+ > > > Copyright (c) 2026 visulima
2846
2846
  > > >
2847
2847
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
2848
2848
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -3028,7 +3028,7 @@ Repository: git+https://github.com/visulima/visulima.git
3028
3028
  >
3029
3029
  > > MIT License
3030
3030
  > >
3031
- > > Copyright (c) 2025 visulima
3031
+ > > Copyright (c) 2026 visulima
3032
3032
  > >
3033
3033
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
3034
3034
  > > of this software and associated documentation files (the "Software"), to deal
@@ -3062,7 +3062,7 @@ Repository: git+https://github.com/visulima/visulima.git
3062
3062
  > >
3063
3063
  > > > MIT License
3064
3064
  > > >
3065
- > > > Copyright (c) 2025 visulima
3065
+ > > > Copyright (c) 2026 visulima
3066
3066
  > > >
3067
3067
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
3068
3068
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -3204,7 +3204,7 @@ Repository: git+https://github.com/visulima/visulima.git
3204
3204
 
3205
3205
  > MIT License
3206
3206
  >
3207
- > Copyright (c) 2025 visulima
3207
+ > Copyright (c) 2026 visulima
3208
3208
  >
3209
3209
  > Permission is hereby granted, free of charge, to any person obtaining a copy
3210
3210
  > of this software and associated documentation files (the "Software"), to deal
@@ -3238,7 +3238,7 @@ Repository: git+https://github.com/visulima/visulima.git
3238
3238
  >
3239
3239
  > > MIT License
3240
3240
  > >
3241
- > > Copyright (c) 2025 visulima
3241
+ > > Copyright (c) 2026 visulima
3242
3242
  > >
3243
3243
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
3244
3244
  > > of this software and associated documentation files (the "Software"), to deal
@@ -4148,7 +4148,7 @@ Repository: git+https://github.com/visulima/visulima.git
4148
4148
  >
4149
4149
  > > MIT License
4150
4150
  > >
4151
- > > Copyright (c) 2025 visulima
4151
+ > > Copyright (c) 2026 visulima
4152
4152
  > >
4153
4153
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
4154
4154
  > > of this software and associated documentation files (the "Software"), to deal
@@ -4182,7 +4182,7 @@ Repository: git+https://github.com/visulima/visulima.git
4182
4182
  > >
4183
4183
  > > > MIT License
4184
4184
  > > >
4185
- > > > Copyright (c) 2025 visulima
4185
+ > > > Copyright (c) 2026 visulima
4186
4186
  > > >
4187
4187
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
4188
4188
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -4368,7 +4368,7 @@ Repository: git+https://github.com/visulima/visulima.git
4368
4368
  >
4369
4369
  > > MIT License
4370
4370
  > >
4371
- > > Copyright (c) 2025 visulima
4371
+ > > Copyright (c) 2026 visulima
4372
4372
  > >
4373
4373
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
4374
4374
  > > of this software and associated documentation files (the "Software"), to deal
@@ -4402,7 +4402,7 @@ Repository: git+https://github.com/visulima/visulima.git
4402
4402
  > >
4403
4403
  > > > MIT License
4404
4404
  > > >
4405
- > > > Copyright (c) 2025 visulima
4405
+ > > > Copyright (c) 2026 visulima
4406
4406
  > > >
4407
4407
  > > > Permission is hereby granted, free of charge, to any person obtaining a copy
4408
4408
  > > > of this software and associated documentation files (the "Software"), to deal
@@ -4544,7 +4544,7 @@ Repository: git+https://github.com/visulima/visulima.git
4544
4544
 
4545
4545
  > MIT License
4546
4546
  >
4547
- > Copyright (c) 2025 visulima
4547
+ > Copyright (c) 2026 visulima
4548
4548
  >
4549
4549
  > Permission is hereby granted, free of charge, to any person obtaining a copy
4550
4550
  > of this software and associated documentation files (the "Software"), to deal
@@ -4578,7 +4578,7 @@ Repository: git+https://github.com/visulima/visulima.git
4578
4578
  >
4579
4579
  > > MIT License
4580
4580
  > >
4581
- > > Copyright (c) 2025 visulima
4581
+ > > Copyright (c) 2026 visulima
4582
4582
  > >
4583
4583
  > > Permission is hereby granted, free of charge, to any person obtaining a copy
4584
4584
  > > of this software and associated documentation files (the "Software"), to deal
@@ -1,4 +1,4 @@
1
- var g=Object.defineProperty;var a=(e,t)=>g(e,"name",{value:t,configurable:!0});import S from"@bomb.sh/tab";import{c as $}from"../packem_shared/cerebro-error-CXXSmFtP.js";var w=Object.defineProperty,y=a((e,t)=>w(e,"name",{value:t,configurable:!0}),"n");class p extends ${static{a(this,"l")}static{y(this,"CompletionError")}troubleshooting;constructor(t,o,n=[]){super(t,o,{troubleshooting:n}),this.name="CompletionError",this.troubleshooting=n,n.length>0&&(this.hint=n.join(`
1
+ var g=Object.defineProperty;var a=(e,t)=>g(e,"name",{value:t,configurable:!0});import S from"@bomb.sh/tab";import{c as $}from"../packem_shared/cerebro-error-BnJTixb2.js";var w=Object.defineProperty,y=a((e,t)=>w(e,"name",{value:t,configurable:!0}),"n");class p extends ${static{a(this,"l")}static{y(this,"CompletionError")}troubleshooting;constructor(t,o,n=[]){super(t,o,{troubleshooting:n}),this.name="CompletionError",this.troubleshooting=n,n.length>0&&(this.hint=n.join(`
2
2
  `))}}var C=Object.defineProperty,s=a((e,t)=>C(e,"name",{value:t,configurable:!0}),"s");const h=["bash","zsh","fish","powershell"],d=["node","bun","deno"],v=s(e=>"Deno"in e,"hasDeno"),L=s(e=>"Bun"in e,"hasBun"),u=s(()=>v(globalThis)?"deno":L(globalThis)?"bun":"node","detectRuntime"),m=s(e=>{const t=e?.starshipShell??e?.shell;if(t){const r=t.toLowerCase();if(r.includes("zsh"))return"zsh";if(r.includes("bash"))return"bash";if(r.includes("fish"))return"fish"}const o=e?.psModulePath,n=e?.prompt;if(o||n?.includes("PS"))return"powershell";if(e?.comSpec?.toLowerCase().includes("cmd.exe"))return"bash"},"detectShell"),f=S,I=s((e,t)=>{for(const o of t)o.hidden||(o.name&&e.option(o.name,o.description||""),o.alias&&e.option(o.alias,o.description||""))},"registerCommandOptions"),P=s((e,t)=>{for(const[o,n]of t){if(n.name!==o||n.hidden)continue;const r=e.command(n.name,n.description||"");n.options&&I(r,n.options)}},"registerCommands"),E=s(e=>{if(!h.includes(e))throw new p(`Invalid shell type: ${e}`,"INVALID_SHELL",[`Valid shells are: ${h.join(", ")}`,"Shell will be auto-detected if not specified"])},"validateShell"),j=s(e=>{if(e&&!d.includes(e))throw new p(`Invalid runtime: ${e}`,"INVALID_RUNTIME",[`Valid runtimes are: ${d.join(", ")}`,"Runtime will be auto-detected if not specified"])},"validateRuntime"),z=s((e,t)=>{e.error("Could not detect current shell");const o=[`Usage: ${t} completion --shell=<bash|zsh|fish|powershell> [--runtime=<node|bun|deno>]`,"","Examples:"," # Install completions for zsh:",` ${t} completion --shell=zsh > ~/.${t}-completion.zsh`,` echo 'source ~/.${t}-completion.zsh' >> ~/.zshrc`,""," # Install completions for bash with custom runtime:",` ${t} completion --shell=bash --runtime=bun > ~/.${t}-completion.bash`,` echo 'source ~/.${t}-completion.bash' >> ~/.bashrc`,""," # Install completions for fish:",` ${t} completion --shell=fish > ~/.config/fish/completions/${t}.fish`].join(`
3
3
  `);e.info(o)},"printUsageInstructions"),x={description:"Generate shell completion scripts",env:[{description:"Shell path (Unix-like systems). Used for shell detection.",name:"SHELL",type:String},{description:"Starship shell configuration. Takes precedence over SHELL for detection.",name:"STARSHIP_SHELL",type:String},{description:"PowerShell module path (Windows). Used for PowerShell detection.",name:"PSModulePath",type:String},{description:"Command prompt variable (Windows). Used for PowerShell detection.",name:"PROMPT",type:String},{description:"Command processor (Windows). Used for Windows Command Prompt detection.",name:"ComSpec",type:String}],execute:s(async({env:e,logger:t,options:o,runtime:n})=>{const r=n.getCliName(),c=o?.shell||m(e);if(!c){z(t,r);return}try{E(c),j(o?.runtime),P(f,n.getCommands());const i=`${o?.runtime||u()} ${r}`;f.setup(r,i,c)}catch(i){if(i instanceof p){const l=[`Failed to generate completion script: ${i.message}`,`Error code: ${i.code}`];throw i.troubleshooting.length>0&&l.push("","Troubleshooting:",...i.troubleshooting.map(b=>` • ${b}`)),t.error(l.join(`
4
4
  `)),i}else{const l=["Failed to generate completion script",`Error: ${i instanceof Error?i.message:String(i)}`,"","Troubleshooting:"," • Ensure @bomb.sh/tab is installed: pnpm add @bomb.sh/tab",` • Verify shell is supported: ${h.join(", ")}`,` • Verify runtime is supported: ${d.join(", ")}`," • Check that your CLI name is correct"];t.error(l.join(`
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var t=Object.defineProperty;var o=(r,e)=>t(r,"name",{value:e,configurable:!0});import{Cli as a}from"./packem_shared/Cerebro-CI6nbG1o.js";import{VERBOSITY_DEBUG as b,VERBOSITY_NORMAL as c,VERBOSITY_QUIET as f,VERBOSITY_VERBOSE as n}from"./packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{VisulimaError as I}from"./packem_shared/VisulimaError-rZ7cJo5A.js";var E=Object.defineProperty,O=o((r,e)=>E(r,"name",{value:e,configurable:!0}),"t");const B=O((r,e)=>new a(r,e),"createCerebro");export{a as Cerebro,b as VERBOSITY_DEBUG,c as VERBOSITY_NORMAL,f as VERBOSITY_QUIET,n as VERBOSITY_VERBOSE,I as VisulimaError,B as createCerebro};
1
+ var t=Object.defineProperty;var o=(r,e)=>t(r,"name",{value:e,configurable:!0});import{Cli as a}from"./packem_shared/Cerebro-aPZjbfzf.js";import{VERBOSITY_DEBUG as V,VERBOSITY_NORMAL as b,VERBOSITY_QUIET as c,VERBOSITY_VERBOSE as f}from"./packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{p as I}from"./packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js";var E=Object.defineProperty,O=o((r,e)=>E(r,"name",{value:e,configurable:!0}),"t");const p=O((r,e)=>new a(r,e),"createCerebro");export{a as Cerebro,V as VERBOSITY_DEBUG,b as VERBOSITY_NORMAL,c as VERBOSITY_QUIET,f as VERBOSITY_VERBOSE,I as VisulimaError,p as createCerebro};
@@ -1 +1 @@
1
- var Xt=Object.defineProperty;var _=(r,a)=>Xt(r,"name",{value:a,configurable:!0});import{createRequire as en}from"node:module";import{findCacheDirSync as sn}from"@visulima/find-cache-dir";import{c as an}from"../packem_shared/cerebro-error-CXXSmFtP.js";const tn=en(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ve=_(r=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[a,i]=U.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return U.getBuiltinModule(r)}return tn(r)},"__cjs_getBuiltinModule"),{existsSync:be,readFileSync:nn,mkdirSync:rn,writeFileSync:on}=ve("node:fs"),{get:cn}=ve("node:https");var un=Object.defineProperty,ln=_((r,a)=>un(r,"name",{value:a,configurable:!0}),"o$1");const fn=ln((r,a)=>{const i=r.split(".").map(Number),f=a.split(".").map(Number);for(const[d,h]of i.entries()){if(h>f[d])return!0;if(h<f[d])return!1}return!1},"semverGt");var pn=Object.defineProperty,gn=_((r,a)=>pn(r,"name",{value:a,configurable:!0}),"$e"),dn=Object.defineProperty,H=gn((r,a)=>dn(r,"name",{value:a,configurable:!0}),"W"),hn=Object.defineProperty,u=H((r,a)=>hn(r,"name",{value:a,configurable:!0}),"u$1");let xe=u(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,h=u((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),$=u((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!d.call(e,o)&&o!==n&&a(e,o,{get:u(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),m=u(e=>$(a({},"__esModule",{value:!0}),e),"oe"),y={};h(y,{zeptomatch:u(()=>me,"zeptomatch")});var K=u(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:c}=o;if(c?.length)for(let l=0,g=c.length;l<g;l++)n.push(c[l])}return Array.from(t)},"M"),Ee=u(e=>{let t="";const n=K(e);for(let s=0,o=n.length;s<o;s++){const c=n[s];if(!c.regex)continue;const l=c.regex.flags;if(t||(t=l),t!==l)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${l}"`)}return t},"se"),Q=u((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let c="";if(e.regex&&(c+=o?"(?:$|":"",c+=e.regex.source),e.children?.length){const l=Re(e.children.map(g=>Q(g,t,n)).filter(Boolean));if(l?.length){const g=e.children.some(I=>!I.regex||!(I.partial??t)),v=l.length>1||o&&(!c.length||g);c+=v?o?"(?:$|":"(?:":"",c+=l.join("|"),c+=v?")":""}}return e.regex&&(c+=o?")":""),n.set(e,c),c},"O"),ke=u((e,t)=>{const n=new Map,s=K(e);for(let o=s.length-1;o>=0;o--){const c=Q(s[o],t,n);if(!(o>0))return c}return""},"ie"),Re=u(e=>Array.from(new Set(e)),"ue"),D=u((e,t,n)=>D.compile(e,n).test(t),"R");D.compile=(e,t)=>{const n=t?.partial??!1,s=ke(e,n),o=Ee(e);return new RegExp(`^(?:${s})$`,o)};var Ae=D,Me=u((e,t)=>{const n=Ae.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ne=Me,Pe=u(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Pe,X=u(e=>Array.isArray(e),"j"),z=u(e=>typeof e=="function","_"),Ce=u(e=>e.length===0,"he"),Ie=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Se=u(e=>typeof e=="number","de"),Ue=u(e=>typeof e=="object"&&e!==null,"xe"),Te=u(e=>e instanceof RegExp,"me"),Be=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),De=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ee=u(e=>typeof e=="string","A"),O=u(e=>e===void 0,"f"),Fe=u(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),te=u((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=E(t)(s),c=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${c}`)},"I"),p=u((e,t)=>X(e)?Le(e,t):ee(e)?ne(e,t):qe(e,t),"i"),Le=u((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let c=s.index,l=c;for(;l<o.length&&o.charCodeAt(l)in n;)l+=1;if(l>c){if(!O(t)&&!s.options.silent){const g=o.slice(c,l),v=z(t)?t(g,o,`${c}`):t;O(v)||s.output.push(v)}s.index=l}return!0}},"we"),qe=u((e,t)=>{if(De(e))return ne(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return Be(e)&&z(t)&&!Ie(t)?We(o,t):Ze(o,t)}},"$e"),We=u((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const c=e.exec(o);if(c){const l=e.lastIndex;if(!n.options.silent){const g=t(...c,o,`${s}`);O(g)||n.output.push(g)}return n.index=l,!0}else return!1},"Ee"),Ze=u((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const c=e.lastIndex;if(!O(t)&&!n.options.silent){const l=z(t)?t(o.slice(s,c),o,`${s}`):t;O(l)||n.output.push(l)}return n.index=c,!0}else return!1},"Ce"),ne=u((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!O(t)&&!n.options.silent){const c=z(t)?t(e,o,`${s}`):t;O(c)||n.output.push(c)}return n.index+=e.length,!0}else return!1},"F"),F=u((e,t,n,s)=>{const o=E(e),c=t>1;return q(L(oe(l=>{let g=0;for(;g<n;){const v=l.index;if(!o(l)||(g+=1,l.index===v))break}return g>=t},c),s))},"k"),re=u((e,t)=>F(e,0,1,t),"L"),B=u((e,t)=>F(e,0,1/0,t),"$"),Ve=u((e,t)=>F(e,1,1/0,t),"Re"),M=u((e,t)=>{const n=e.map(E);return q(L(oe(s=>{for(let o=0,c=n.length;o<c;o++)if(!n[o](s))return!1;return!0}),t))},"x"),w=u((e,t)=>{const n=e.map(E);return q(L(s=>{for(let o=0,c=n.length;o<c;o++)if(n[o](s))return!0;return!1},t))},"p"),oe=u((e,t=!0,n=!1)=>{const s=E(e);return t?o=>{const c=o.index,l=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=c,o.output.length!==l&&(o.output.length=l)),g}:s},"q"),L=u((e,t)=>{const n=E(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const c=s.output.splice(o,1/0),l=t(c);return O(l)||s.output.push(l),!0}else return!1}:n},"B"),q=(()=>{let e=0;return t=>{const n=E(t),s=e+=1;return o=>{var c;if(o.options.memoization===!1)return n(o);const l=o.index,g=(c=o.cache)[s]||(c[s]={indexMax:-1,queue:[]}),v=g.queue;if(l<=g.indexMax){const S=g.store||(g.store=new Map);if(v.length){for(let P=0,Yt=v.length;P<Yt;P+=2){const Kt=v[P*2],Qt=v[P*2+1];S.set(Kt,Qt)}v.length=0}const j=S.get(l);if(j===!1)return!1;if(Se(j))return o.index=j,!0;if(j)return o.index=j.index,j.output?.length&&o.output.push(...j.output),!0}const I=o.output.length,Ht=n(o);if(g.indexMax=Math.max(g.indexMax,l),Ht){const S=o.index,j=o.output.length;if(j>I){const P=o.output.slice(I,j);v.push(l,{index:S,output:P})}else v.push(l,S);return!0}else return v.push(l,!1),!1}}})(),se=u(e=>{let t;return n=>(t||(t=E(e())),t(n))},"G"),E=Fe(e=>{if(z(e))return Ce(e)?se(e):e;if(ee(e)||Te(e))return p(e);if(X(e))return M(e);if(Ue(e))return w(Object.values(e));throw new Error("Invalid rule")}),R=u(e=>e,"d"),Ge=u(e=>typeof e=="string","ke"),Je=u(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const c=o?.partial?n:t,l=c.get(s);if(l!==void 0)return l;const g=e(s,o);return c.set(s,g),g}},"Be"),He=u(e=>{const t={},n={};return(s,o)=>{const c=o?.partial?n:t;return c[s]??(c[s]=e(s,o))}},"Pe"),Ye=p(/\\./,R),Ke=p(/./,R),Qe=p(/\*\*\*+/,"*"),Xe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),et=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),tt=B(w([Ye,Qe,Xe,et,Ke])),nt=tt,rt=u(e=>te(e,nt,{memoization:!1}).join(""),"Ie"),ot=rt,ae="abcdefghijklmnopqrstuvwxyz",st=u(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ae[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ie=u(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ae.indexOf(e[n])+1;return t},"V"),W=u((e,t)=>{if(t<e)return W(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),at=u((e,t,n)=>W(e,t).map(s=>String(s).padStart(n,"0")),"qe"),ce=u((e,t)=>W(ie(e),ie(t)).map(st),"W"),x=u(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),C=u(e=>({children:e}),"y"),N=(()=>{const e=u((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let c=0,l=o.length;c<l;c++)e(o[c],n,s)},"e");return t=>{if(!t.length)return C([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],c=t[n];e(o,c,s)}return t[0]}})(),k=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),it=p(/\\./,x),ct=p(/[$.*+?^(){}[\]\|]/,e=>x(`\\${e}`)),ut=p(/[\\\/]/,k),lt=p(/[^$.*+?^(){}[\]\|\\\/]+/,x),ft=p(/^(?:!!)*!(.*)$/,(e,t)=>x(`(?!^${me.compile(t).source}$).*?`)),pt=p(/^(!!)+/),gt=w([ft,pt]),dt=p(/\/(\*\*\/)+/,()=>C([N([k(),x(".+?"),k()]),k()])),ht=p(/^(\*\*\/)+/,()=>C([x("^"),N([x(".*?"),k()])])),mt=p(/\/(\*\*)$/,()=>C([N([k(),x(".*?")]),x("$")])),xt=p(/\*\*/,()=>x(".*?")),ue=w([dt,ht,mt,xt]),$t=p(/\*\/(?!\*\*\/|\*$)/,()=>N([x("[^\\\\/]*?"),k()])),vt=p(/\*/,()=>x("[^\\\\/]*")),le=w([$t,vt]),fe=p("?",()=>x("[^\\\\/]")),bt=p("[",R),yt=p("]",R),wt=p(/[!^]/,"^\\\\/"),jt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,R),_t=p(/\\./,R),Ot=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,R),Rt=w([_t,Ot,Et,jt,kt]),pe=M([bt,re(wt),B(Rt),yt],e=>x(e.join(""))),At=p("{","(?:"),Mt=p("}",")"),Nt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>at(+t,+n,Math.min(t.length,n.length)).join("|")),Pt=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),zt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ct=w([Nt,Pt,zt]),ge=M([At,Ct,Mt],e=>x(e.join(""))),It=p("{"),St=p("}"),Ut=p(","),Tt=p(/\\./,x),Bt=p(/[$.*+?^(){[\]\|]/,e=>x(`\\${e}`)),Dt=p(/[\\\/]/,k),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,x),Lt=se(()=>he),qt=p("",()=>x("(?:)")),Wt=Ve(w([ue,le,fe,pe,ge,Lt,Tt,Bt,Dt,Ft]),N),de=w([Wt,qt]),he=M([It,re(M([de,B(M([Ut,de]))])),St],C),Zt=B(w([gt,ue,le,fe,pe,ge,he,it,ct,ut,lt]),N),Vt=Zt,Gt=u(e=>te(e,Vt,{memoization:!1})[0],"kr"),Jt=Gt,Z=u((e,t,n)=>Z.compile(e,n).test(t),"N");Z.compile=(()=>{const e=He((n,s)=>Ne(Jt(ot(n)),s)),t=Je((n,s)=>ze(n.map(o=>e(o,s))));return(n,s)=>Ge(n)?e(n,s):t(n,s)})();var me=Z;return m(y)})();return r.default||r},"_lazyMatch"),V;const mn=u((r,a)=>(V||(V=xe(),xe=null),V(r,a)),"default");var xn=Object.defineProperty,$n=H((r,a)=>xn(r,"name",{value:a,configurable:!0}),"t$1");const vn=/^[A-Z]:\//i,A=$n((r="")=>r&&r.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var bn=Object.defineProperty,b=H((r,a)=>bn(r,"name",{value:a,configurable:!0}),"r");const yn=/^[/\\]{2}/,wn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ye=/^[A-Z]:$/i,$e=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,_n=/^[/\\]|^[a-z]:[/\\]/i,On=b(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),we=b((r,a)=>{let i="",f=0,d=-1,h=0,$;for(let m=0;m<=r.length;++m){if(m<r.length)$=r[m];else{if($==="/")break;$="/"}if($==="/"){if(!(d===m-1||h===1))if(h===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const y=i.lastIndexOf("/");y===-1?(i="",f=0):(i=i.slice(0,y),f=i.length-1-i.lastIndexOf("/")),d=m,h=0;continue}else if(i.length>0){i="",f=0,d=m,h=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${r.slice(d+1,m)}`:i=r.slice(d+1,m),f=m-d-1;d=m,h=0}else $==="."&&h!==-1?++h:h=-1}return i},"normalizeString"),T=b(r=>wn.test(r),"isAbsolute"),je=b(function(r){if(r.length===0)return".";r=A(r);const a=yn.exec(r),i=T(r),f=r.at(-1)==="/";return r=we(r,!i),r.length===0?i?"/":f?"./":".":(f&&(r+="/"),ye.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!T(r)?`/${r}`:r)},"normalize"),En=b((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const f=a[a.length-1]==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return je(a)},"join"),G=b(function(...r){r=r.map(f=>A(f));let a="",i=!1;for(let f=r.length-1;f>=-1&&!i;f--){const d=f>=0?r[f]:On();!d||d.length===0||(a=`${d}/${a}`,i=T(d))}return a=we(a,!i),i&&!T(a)?`/${a}`:a.length>0?a:"."},"resolve");b(function(r){return A(r)},"toNamespacedPath");const kn=b(function(r){return jn.exec(A(r))?.[1]??""},"extname");b(function(r,a){const i=G(r).replace($e,"$1").split("/"),f=G(a).replace($e,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const h of d){if(f[0]!==h)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const _e=b(r=>{const a=A(r).replace(/\/$/,"").split("/").slice(0,-1);return a.length===1&&ye.test(a[0])&&(a[0]+="/"),a.join("/")||(T(r)?"/":".")},"dirname");b(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return A(r.root?G(...a):a.join("/"))},"format");const Rn=b((r,a)=>{const i=A(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");b(function(r){const a=_n.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Rn(r),f=kn(i);return{base:i,dir:_e(r),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");b((r,a)=>mn(a,je(r)),"matchesGlob");var An=Object.defineProperty,Mn=_((r,a)=>An(r,"name",{value:a,configurable:!0}),"e");let J=class extends an{static{_(this,"p")}static{Mn(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",f){super(a,i,f),this.name="UpdateNotifierError"}};var Nn=Object.defineProperty,Y=_((r,a)=>Nn(r,"name",{value:a,configurable:!0}),"n");const Pn="last-update-check.json",Oe=Y(r=>{const a=sn(r);if(a===void 0)throw new J("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return En(a,Pn)},"getConfigFile"),zn=Y(r=>{const a=Oe(r);try{if(!be(a))return;const{lastUpdateCheck:i}=JSON.parse(nn(a,"utf8"));return i}catch{return}},"getLastUpdate"),Cn=Y(r=>{const a=Oe(r),i=_e(a);be(i)||rn(i,{recursive:!0}),on(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var In=Object.defineProperty,Sn=_((r,a)=>In(r,"name",{value:a,configurable:!0}),"g");const Un=Sn(async(r,a,i)=>{const f=i.replace("__NAME__",r);return await new Promise((d,h)=>{cn(f,$=>{let m="";$.on("data",y=>m+=y),$.on("end",()=>{try{const y=JSON.parse(m)[a];y||h(new J("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d(y)}catch{h(new J("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",$=>h($))})},"getDistributionVersion");var Tn=Object.defineProperty,Bn=_((r,a)=>Tn(r,"name",{value:a,configurable:!0}),"i");const Zn=Bn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:f,registryUrl:d="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:h=1e3*60*60*24})=>{const $=zn(f.name);if(r||!$||$<Date.now()-h){const m=await Un(f.name,i,d);if(Cn(f.name),fn(m,f.version))return m;a&&console.error(`Latest version (${m}) not newer than current version (${f.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${h}ms but only ${Date.now()-$}ms since last check.`)},"hasNewVersion");export{Zn as default};
1
+ var Xt=Object.defineProperty;var _=(r,a)=>Xt(r,"name",{value:a,configurable:!0});import{createRequire as en}from"node:module";import{findCacheDirSync as sn}from"@visulima/find-cache-dir";import{c as an}from"../packem_shared/cerebro-error-BnJTixb2.js";const tn=en(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ve=_(r=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[a,i]=U.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return U.getBuiltinModule(r)}return tn(r)},"__cjs_getBuiltinModule"),{existsSync:be,readFileSync:nn,mkdirSync:rn,writeFileSync:on}=ve("node:fs"),{get:cn}=ve("node:https");var un=Object.defineProperty,ln=_((r,a)=>un(r,"name",{value:a,configurable:!0}),"o$1");const fn=ln((r,a)=>{const i=r.split(".").map(Number),f=a.split(".").map(Number);for(const[d,h]of i.entries()){if(h>f[d])return!0;if(h<f[d])return!1}return!1},"semverGt");var pn=Object.defineProperty,gn=_((r,a)=>pn(r,"name",{value:a,configurable:!0}),"$e"),dn=Object.defineProperty,H=gn((r,a)=>dn(r,"name",{value:a,configurable:!0}),"W"),hn=Object.defineProperty,u=H((r,a)=>hn(r,"name",{value:a,configurable:!0}),"u$1");let xe=u(()=>{var r=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,h=u((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),$=u((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!d.call(e,o)&&o!==n&&a(e,o,{get:u(()=>t[o],"get"),enumerable:!(s=i(t,o))||s.enumerable});return e},"ae"),m=u(e=>$(a({},"__esModule",{value:!0}),e),"oe"),y={};h(y,{zeptomatch:u(()=>me,"zeptomatch")});var K=u(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const o=n[s];if(t.has(o))continue;t.add(o);const{children:c}=o;if(c?.length)for(let l=0,g=c.length;l<g;l++)n.push(c[l])}return Array.from(t)},"M"),Ee=u(e=>{let t="";const n=K(e);for(let s=0,o=n.length;s<o;s++){const c=n[s];if(!c.regex)continue;const l=c.regex.flags;if(t||(t=l),t!==l)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${l}"`)}return t},"se"),Q=u((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const o=e.partial??t;let c="";if(e.regex&&(c+=o?"(?:$|":"",c+=e.regex.source),e.children?.length){const l=Re(e.children.map(g=>Q(g,t,n)).filter(Boolean));if(l?.length){const g=e.children.some(I=>!I.regex||!(I.partial??t)),v=l.length>1||o&&(!c.length||g);c+=v?o?"(?:$|":"(?:":"",c+=l.join("|"),c+=v?")":""}}return e.regex&&(c+=o?")":""),n.set(e,c),c},"O"),ke=u((e,t)=>{const n=new Map,s=K(e);for(let o=s.length-1;o>=0;o--){const c=Q(s[o],t,n);if(!(o>0))return c}return""},"ie"),Re=u(e=>Array.from(new Set(e)),"ue"),D=u((e,t,n)=>D.compile(e,n).test(t),"R");D.compile=(e,t)=>{const n=t?.partial??!1,s=ke(e,n),o=Ee(e);return new RegExp(`^(?:${s})$`,o)};var Ae=D,Me=u((e,t)=>{const n=Ae.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(s,o)},"le"),Ne=Me,Pe=u(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),ze=Pe,X=u(e=>Array.isArray(e),"j"),z=u(e=>typeof e=="function","_"),Ce=u(e=>e.length===0,"he"),Ie=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Se=u(e=>typeof e=="number","de"),Ue=u(e=>typeof e=="object"&&e!==null,"xe"),Te=u(e=>e instanceof RegExp,"me"),Be=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),De=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ee=u(e=>typeof e=="string","A"),O=u(e=>e===void 0,"f"),Fe=u(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n);return t.set(n,o),o}},"ye"),te=u((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=E(t)(s),c=Math.max(s.index,s.indexBacktrackMax);if(o&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${c}`)},"I"),p=u((e,t)=>X(e)?Le(e,t):ee(e)?ne(e,t):qe(e,t),"i"),Le=u((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const o=s.charCodeAt(0);n[o]=!0}return s=>{const o=s.input;let c=s.index,l=c;for(;l<o.length&&o.charCodeAt(l)in n;)l+=1;if(l>c){if(!O(t)&&!s.options.silent){const g=o.slice(c,l),v=z(t)?t(g,o,`${c}`):t;O(v)||s.output.push(v)}s.index=l}return!0}},"we"),qe=u((e,t)=>{if(De(e))return ne(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),o=new RegExp(n,s);return Be(e)&&z(t)&&!Ie(t)?We(o,t):Ze(o,t)}},"$e"),We=u((e,t)=>n=>{const s=n.index,o=n.input;e.lastIndex=s;const c=e.exec(o);if(c){const l=e.lastIndex;if(!n.options.silent){const g=t(...c,o,`${s}`);O(g)||n.output.push(g)}return n.index=l,!0}else return!1},"Ee"),Ze=u((e,t)=>n=>{const s=n.index,o=n.input;if(e.lastIndex=s,e.test(o)){const c=e.lastIndex;if(!O(t)&&!n.options.silent){const l=z(t)?t(o.slice(s,c),o,`${s}`):t;O(l)||n.output.push(l)}return n.index=c,!0}else return!1},"Ce"),ne=u((e,t)=>n=>{const s=n.index,o=n.input;if(o.startsWith(e,s)){if(!O(t)&&!n.options.silent){const c=z(t)?t(e,o,`${s}`):t;O(c)||n.output.push(c)}return n.index+=e.length,!0}else return!1},"F"),F=u((e,t,n,s)=>{const o=E(e),c=t>1;return q(L(oe(l=>{let g=0;for(;g<n;){const v=l.index;if(!o(l)||(g+=1,l.index===v))break}return g>=t},c),s))},"k"),re=u((e,t)=>F(e,0,1,t),"L"),B=u((e,t)=>F(e,0,1/0,t),"$"),Ve=u((e,t)=>F(e,1,1/0,t),"Re"),M=u((e,t)=>{const n=e.map(E);return q(L(oe(s=>{for(let o=0,c=n.length;o<c;o++)if(!n[o](s))return!1;return!0}),t))},"x"),w=u((e,t)=>{const n=e.map(E);return q(L(s=>{for(let o=0,c=n.length;o<c;o++)if(n[o](s))return!0;return!1},t))},"p"),oe=u((e,t=!0,n=!1)=>{const s=E(e);return t?o=>{const c=o.index,l=o.output.length,g=s(o);return!g&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!g||n)&&(o.index=c,o.output.length!==l&&(o.output.length=l)),g}:s},"q"),L=u((e,t)=>{const n=E(e);return t?s=>{if(s.options.silent)return n(s);const o=s.output.length;if(n(s)){const c=s.output.splice(o,1/0),l=t(c);return O(l)||s.output.push(l),!0}else return!1}:n},"B"),q=(()=>{let e=0;return t=>{const n=E(t),s=e+=1;return o=>{var c;if(o.options.memoization===!1)return n(o);const l=o.index,g=(c=o.cache)[s]||(c[s]={indexMax:-1,queue:[]}),v=g.queue;if(l<=g.indexMax){const S=g.store||(g.store=new Map);if(v.length){for(let P=0,Yt=v.length;P<Yt;P+=2){const Kt=v[P*2],Qt=v[P*2+1];S.set(Kt,Qt)}v.length=0}const j=S.get(l);if(j===!1)return!1;if(Se(j))return o.index=j,!0;if(j)return o.index=j.index,j.output?.length&&o.output.push(...j.output),!0}const I=o.output.length,Ht=n(o);if(g.indexMax=Math.max(g.indexMax,l),Ht){const S=o.index,j=o.output.length;if(j>I){const P=o.output.slice(I,j);v.push(l,{index:S,output:P})}else v.push(l,S);return!0}else return v.push(l,!1),!1}}})(),se=u(e=>{let t;return n=>(t||(t=E(e())),t(n))},"G"),E=Fe(e=>{if(z(e))return Ce(e)?se(e):e;if(ee(e)||Te(e))return p(e);if(X(e))return M(e);if(Ue(e))return w(Object.values(e));throw new Error("Invalid rule")}),R=u(e=>e,"d"),Ge=u(e=>typeof e=="string","ke"),Je=u(e=>{const t=new WeakMap,n=new WeakMap;return(s,o)=>{const c=o?.partial?n:t,l=c.get(s);if(l!==void 0)return l;const g=e(s,o);return c.set(s,g),g}},"Be"),He=u(e=>{const t={},n={};return(s,o)=>{const c=o?.partial?n:t;return c[s]??(c[s]=e(s,o))}},"Pe"),Ye=p(/\\./,R),Ke=p(/./,R),Qe=p(/\*\*\*+/,"*"),Xe=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),et=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),tt=B(w([Ye,Qe,Xe,et,Ke])),nt=tt,rt=u(e=>te(e,nt,{memoization:!1}).join(""),"Ie"),ot=rt,ae="abcdefghijklmnopqrstuvwxyz",st=u(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=ae[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),ie=u(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+ae.indexOf(e[n])+1;return t},"V"),W=u((e,t)=>{if(t<e)return W(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),at=u((e,t,n)=>W(e,t).map(s=>String(s).padStart(n,"0")),"qe"),ce=u((e,t)=>W(ie(e),ie(t)).map(st),"W"),x=u(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),C=u(e=>({children:e}),"y"),N=(()=>{const e=u((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let c=0,l=o.length;c<l;c++)e(o[c],n,s)},"e");return t=>{if(!t.length)return C([]);for(let n=t.length-1;n>=1;n--){const s=new Set,o=t[n-1],c=t[n];e(o,c,s)}return t[0]}})(),k=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),it=p(/\\./,x),ct=p(/[$.*+?^(){}[\]\|]/,e=>x(`\\${e}`)),ut=p(/[\\\/]/,k),lt=p(/[^$.*+?^(){}[\]\|\\\/]+/,x),ft=p(/^(?:!!)*!(.*)$/,(e,t)=>x(`(?!^${me.compile(t).source}$).*?`)),pt=p(/^(!!)+/),gt=w([ft,pt]),dt=p(/\/(\*\*\/)+/,()=>C([N([k(),x(".+?"),k()]),k()])),ht=p(/^(\*\*\/)+/,()=>C([x("^"),N([x(".*?"),k()])])),mt=p(/\/(\*\*)$/,()=>C([N([k(),x(".*?")]),x("$")])),xt=p(/\*\*/,()=>x(".*?")),ue=w([dt,ht,mt,xt]),$t=p(/\*\/(?!\*\*\/|\*$)/,()=>N([x("[^\\\\/]*?"),k()])),vt=p(/\*/,()=>x("[^\\\\/]*")),le=w([$t,vt]),fe=p("?",()=>x("[^\\\\/]")),bt=p("[",R),yt=p("]",R),wt=p(/[!^]/,"^\\\\/"),jt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,R),_t=p(/\\./,R),Ot=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Et=p(/[\\\/]/,"\\\\/"),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,R),Rt=w([_t,Ot,Et,jt,kt]),pe=M([bt,re(wt),B(Rt),yt],e=>x(e.join(""))),At=p("{","(?:"),Mt=p("}",")"),Nt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>at(+t,+n,Math.min(t.length,n.length)).join("|")),Pt=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ce(t,n).join("|")),zt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ce(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ct=w([Nt,Pt,zt]),ge=M([At,Ct,Mt],e=>x(e.join(""))),It=p("{"),St=p("}"),Ut=p(","),Tt=p(/\\./,x),Bt=p(/[$.*+?^(){[\]\|]/,e=>x(`\\${e}`)),Dt=p(/[\\\/]/,k),Ft=p(/[^$.*+?^(){}[\]\|\\\/,]+/,x),Lt=se(()=>he),qt=p("",()=>x("(?:)")),Wt=Ve(w([ue,le,fe,pe,ge,Lt,Tt,Bt,Dt,Ft]),N),de=w([Wt,qt]),he=M([It,re(M([de,B(M([Ut,de]))])),St],C),Zt=B(w([gt,ue,le,fe,pe,ge,he,it,ct,ut,lt]),N),Vt=Zt,Gt=u(e=>te(e,Vt,{memoization:!1})[0],"kr"),Jt=Gt,Z=u((e,t,n)=>Z.compile(e,n).test(t),"N");Z.compile=(()=>{const e=He((n,s)=>Ne(Jt(ot(n)),s)),t=Je((n,s)=>ze(n.map(o=>e(o,s))));return(n,s)=>Ge(n)?e(n,s):t(n,s)})();var me=Z;return m(y)})();return r.default||r},"_lazyMatch"),V;const mn=u((r,a)=>(V||(V=xe(),xe=null),V(r,a)),"default");var xn=Object.defineProperty,$n=H((r,a)=>xn(r,"name",{value:a,configurable:!0}),"t$1");const vn=/^[A-Z]:\//i,A=$n((r="")=>r&&r.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var bn=Object.defineProperty,b=H((r,a)=>bn(r,"name",{value:a,configurable:!0}),"r");const yn=/^[/\\]{2}/,wn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ye=/^[A-Z]:$/i,$e=/^\/([A-Z]:)?$/i,jn=/.(\.[^./]+)$/,_n=/^[/\\]|^[a-z]:[/\\]/i,On=b(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),we=b((r,a)=>{let i="",f=0,d=-1,h=0,$;for(let m=0;m<=r.length;++m){if(m<r.length)$=r[m];else{if($==="/")break;$="/"}if($==="/"){if(!(d===m-1||h===1))if(h===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const y=i.lastIndexOf("/");y===-1?(i="",f=0):(i=i.slice(0,y),f=i.length-1-i.lastIndexOf("/")),d=m,h=0;continue}else if(i.length>0){i="",f=0,d=m,h=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${r.slice(d+1,m)}`:i=r.slice(d+1,m),f=m-d-1;d=m,h=0}else $==="."&&h!==-1?++h:h=-1}return i},"normalizeString"),T=b(r=>wn.test(r),"isAbsolute"),je=b(function(r){if(r.length===0)return".";r=A(r);const a=yn.exec(r),i=T(r),f=r.at(-1)==="/";return r=we(r,!i),r.length===0?i?"/":f?"./":".":(f&&(r+="/"),ye.test(r)&&(r+="/"),a?i?`//${r}`:`//./${r}`:i&&!T(r)?`/${r}`:r)},"normalize"),En=b((...r)=>{let a="";for(const i of r)if(i)if(a.length>0){const f=a[a.length-1]==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return je(a)},"join"),G=b(function(...r){r=r.map(f=>A(f));let a="",i=!1;for(let f=r.length-1;f>=-1&&!i;f--){const d=f>=0?r[f]:On();!d||d.length===0||(a=`${d}/${a}`,i=T(d))}return a=we(a,!i),i&&!T(a)?`/${a}`:a.length>0?a:"."},"resolve");b(function(r){return A(r)},"toNamespacedPath");const kn=b(function(r){return jn.exec(A(r))?.[1]??""},"extname");b(function(r,a){const i=G(r).replace($e,"$1").split("/"),f=G(a).replace($e,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const h of d){if(f[0]!==h)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const _e=b(r=>{const a=A(r).replace(/\/$/,"").split("/").slice(0,-1);return a.length===1&&ye.test(a[0])&&(a[0]+="/"),a.join("/")||(T(r)?"/":".")},"dirname");b(function(r){const a=[r.root,r.dir,r.base??r.name+r.ext].filter(Boolean);return A(r.root?G(...a):a.join("/"))},"format");const Rn=b((r,a)=>{const i=A(r).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");b(function(r){const a=_n.exec(r)?.[0]?.replaceAll("\\","/")??"",i=Rn(r),f=kn(i);return{base:i,dir:_e(r),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");b((r,a)=>mn(a,je(r)),"matchesGlob");var An=Object.defineProperty,Mn=_((r,a)=>An(r,"name",{value:a,configurable:!0}),"e");let J=class extends an{static{_(this,"p")}static{Mn(this,"UpdateNotifierError")}constructor(a,i="UPDATE_NOTIFIER_ERROR",f){super(a,i,f),this.name="UpdateNotifierError"}};var Nn=Object.defineProperty,Y=_((r,a)=>Nn(r,"name",{value:a,configurable:!0}),"n");const Pn="last-update-check.json",Oe=Y(r=>{const a=sn(r);if(a===void 0)throw new J("Could not find cache directory","CACHE_DIRECTORY_NOT_FOUND",{packageName:r});return En(a,Pn)},"getConfigFile"),zn=Y(r=>{const a=Oe(r);try{if(!be(a))return;const{lastUpdateCheck:i}=JSON.parse(nn(a,"utf8"));return i}catch{return}},"getLastUpdate"),Cn=Y(r=>{const a=Oe(r),i=_e(a);be(i)||rn(i,{recursive:!0}),on(a,JSON.stringify({lastUpdateCheck:Date.now()}))},"saveLastUpdate");var In=Object.defineProperty,Sn=_((r,a)=>In(r,"name",{value:a,configurable:!0}),"g");const Un=Sn(async(r,a,i)=>{const f=i.replace("__NAME__",r);return await new Promise((d,h)=>{cn(f,$=>{let m="";$.on("data",y=>m+=y),$.on("end",()=>{try{const y=JSON.parse(m)[a];y||h(new J("Error getting version","VERSION_FETCH_ERROR",{distributionTag:a,packageName:r})),d(y)}catch{h(new J("Could not parse version response","VERSION_PARSE_ERROR",{distributionTag:a,packageName:r}))}})}).on("error",$=>h($))})},"getDistributionVersion");var Tn=Object.defineProperty,Bn=_((r,a)=>Tn(r,"name",{value:a,configurable:!0}),"i");const Zn=Bn(async({alwaysRun:r,debug:a,distTag:i="latest",pkg:f,registryUrl:d="https://registry.npmjs.org/-/package/__NAME__/dist-tags",updateCheckInterval:h=1e3*60*60*24})=>{const $=zn(f.name);if(r||!$||$<Date.now()-h){const m=await Un(f.name,i,d);if(Cn(f.name),fn(m,f.version))return m;a&&console.error(`Latest version (${m}) not newer than current version (${f.version})`)}else a&&console.error(`Too recent to check for a new update. simpleUpdateNotifier() interval set to ${h}ms but only ${Date.now()-$}ms since last check.`)},"hasNewVersion");export{Zn as default};
@@ -0,0 +1,4 @@
1
+ var It=Object.defineProperty;var $=(t,e)=>It(t,"name",{value:e,configurable:!0});import{createRequire as St}from"node:module";import{o as Vt,D as Tt}from"./help-command-CIRIXN03.js";import{VERBOSITY_DEBUG as W,POSITIONALS_KEY as te,VERBOSITY_QUIET as Rt,VERBOSITY_VERBOSE as Dt,VERBOSITY_NORMAL as Ne}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as k}from"./cerebro-error-BnJTixb2.js";import{d as q,f as Ee,e as ie,o as xe,a as Bt,h as zt,i as Wt}from"./runtime-process-G-n-wOub.js";import{distance as Ft}from"fastest-levenshtein";const Ut=St(import.meta.url),Y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mt=$(t=>{if(typeof Y<"u"&&Y.versions&&Y.versions.node){const[e,n]=Y.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Y.getBuiltinModule(t)}return Ut(t)},"__cjs_getBuiltinModule"),{createRequire:qt}=Mt("node:module");var Gt=Object.defineProperty,Ht=$((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"t$9");let D=class extends k{static{$(this,"a")}static{Ht(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const a=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(a,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var Kt=Object.defineProperty,Yt=$((t,e)=>Kt(t,"name",{value:e,configurable:!0}),"e$6");let Qe=class extends k{static{$(this,"o")}static{Yt(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var Jt=Object.defineProperty,Qt=$((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"e$5");let Zt=class extends k{static{$(this,"o")}static{Qt(this,"PluginError")}pluginName;constructor(e,n,a){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:a,pluginName:e}),this.name="PluginError",this.pluginName=e,a&&(this.cause=a)}};var Xt=Object.defineProperty,je=$((t,e)=>Xt(t,"name",{value:e,configurable:!0}),"d$6");let en=class{static{$(this,"p")}static{je(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);q().CEREBRO_OUTPUT_LEVEL===String(W)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${n.length} plugin(s)...`);for(const a of n)if(typeof a.init=="function"){this.logger.debug(`initializing plugin: ${a.name}`);try{await a.init(e)}catch(o){const i=new Zt(a.name,`Failed to initialize: ${o instanceof Error?o.message:String(o)}`,o instanceof Error?o:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,a){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const o=this.getDependencyOrder();for(const i of o){const u=i[e];if(typeof u=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?u(n,a):u(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const a=this.getDependencyOrder();for(const o of a)if(typeof o.onError=="function"){this.logger.debug(`executing error handler for plugin: ${o.name}`);try{await o.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${o.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,a=new Set,o=je(i=>{if(n.has(i))return;if(a.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const u=this.plugins.get(i);if(!u)throw new Error(`Plugin "${i}" not found`);if(a.add(i),u.dependencies)for(const s of u.dependencies)o(s);a.delete(i),n.add(i),e.push(u)},"visit");for(const i of this.plugins.keys())o(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var tn=Object.defineProperty,nn=$((t,e)=>tn(t,"name",{value:e,configurable:!0}),"n$b");const X=nn(t=>t.type?.name==="Boolean","optionIsBoolean");var an=Object.defineProperty,Ze=$((t,e)=>an(t,"name",{value:e,configurable:!0}),"p$b");const rn=Ze(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),on=Ze(t=>(X(t)||(t.typeLabel=t.typeLabel??rn(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var sn=Object.defineProperty,Xe=$((t,e)=>sn(t,"name",{value:e,configurable:!0}),"e$3");const ln=new RegExp(/^-([^\d-])$/),cn=new RegExp(/^--(\S+)/),un=new RegExp(/^-([^\d-]{2,})$/),pn=Xe(t=>ln.test(t)||cn.test(t)||un.test(t),"isOption"),fn=Xe((t,e)=>{const n=e[0]&&pn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const a=new Error(`Command not recognised: ${n}`);throw a.command=n,a.name="INVALID_COMMAND",a}return{argv:e,command:n}},"commandLineCommands");var hn=Object.defineProperty,et=$((t,e)=>hn(t,"name",{value:e,configurable:!0}),"i$a"),dn=Object.defineProperty,tt=et((t,e)=>dn(t,"name",{value:e,configurable:!0}),"i"),mn=Object.defineProperty,nt=tt((t,e)=>mn(t,"name",{value:e,configurable:!0}),"s"),gn=Object.defineProperty,it=nt((t,e)=>gn(t,"name",{value:e,configurable:!0}),"i"),vn=Object.defineProperty,at=it((t,e)=>vn(t,"name",{value:e,configurable:!0}),"t");at(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");class re extends Error{static{$(this,"v")}static{et(this,"g")}static{tt(this,"p")}static{nt(this,"V")}static{it(this,"VisulimaError")}static{at(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:a,message:o,name:i,stack:u,title:s}){super(o,{cause:e}),this.title=s,this.name=i,this.stack=u??this.stack,this.loc=a,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}var yn=Object.defineProperty,rt=$((t,e)=>yn(t,"name",{value:e,configurable:!0}),"o$b"),wn=Object.defineProperty,ot=rt((t,e)=>wn(t,"name",{value:e,configurable:!0}),"o"),bn=Object.defineProperty,$n=ot((t,e)=>bn(t,"name",{value:e,configurable:!0}),"i");let On=class st extends re{static{$(this,"a")}static{rt(this,"a")}static{ot(this,"t")}static{$n(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,st.prototype)}};var En=Object.defineProperty,lt=$((t,e)=>En(t,"name",{value:e,configurable:!0}),"t$7"),An=Object.defineProperty,ct=lt((t,e)=>An(t,"name",{value:e,configurable:!0}),"e"),Pn=Object.defineProperty,Cn=ct((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"e");let _e=class ut extends re{static{$(this,"n")}static{lt(this,"n")}static{ct(this,"o")}static{Cn(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,ut.prototype)}};var kn=Object.defineProperty,pt=$((t,e)=>kn(t,"name",{value:e,configurable:!0}),"a$6"),Nn=Object.defineProperty,ft=pt((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"a"),xn=Object.defineProperty,jn=ft((t,e)=>xn(t,"name",{value:e,configurable:!0}),"o");let _n=class ht extends re{static{$(this,"n")}static{pt(this,"o")}static{ft(this,"e")}static{jn(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,ht.prototype)}};var Ln=Object.defineProperty,dt=$((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"i$7"),In=Object.defineProperty,mt=dt((t,e)=>In(t,"name",{value:e,configurable:!0}),"i"),Sn=Object.defineProperty,Un=mt((t,e)=>Sn(t,"name",{value:e,configurable:!0}),"i");let j=class gt extends re{static{$(this,"a")}static{dt(this,"o")}static{mt(this,"e")}static{Un(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,gt.prototype)}};var Mn=Object.defineProperty,Vn=$((t,e)=>Mn(t,"name",{value:e,configurable:!0}),"T$1"),Tn=Object.defineProperty,H=Vn((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"P"),Rn=Object.defineProperty,oe=H((t,e)=>Rn(t,"name",{value:e,configurable:!0}),"o");const Le=oe(t=>t===Boolean||typeof t=="function"&&t.name?.startsWith("Boolean"),"isBooleanType"),Ie=oe(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Se=oe(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Dn=oe((t,e)=>Array.isArray(t)?Le(e)?t.map(Boolean):Ie(e)?t.map(Number):Se(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Le(e)?!!t:Ie(e)?Number(t):Se(e)?String(t):e(String(t)),"convertValue");var Bn=Object.defineProperty,zn=H((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"e");const x=zn((t,e,n,...a)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...a)},"debug");var Wn=Object.defineProperty,T=H((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"A");const Fn=/-([a-z])/g,me=T(t=>t===Boolean||typeof t=="function"&&t.name?.startsWith("Boolean"),"isBooleanType"),qn=T(t=>t.codePointAt(0)===95,"isSpecialKey"),Ue=T((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),Me=T(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ve=T((t,e,n,a=!1)=>{t[e]===void 0?t[e]=a?[n]:n:a&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),Gn=T((t,e,n,a,o)=>{let i=e.get(t)||n.get(t);if(!i&&a){const u=t.toLowerCase();i=a.get(u)||o?.get(u)}return i},"getDefinition"),Hn=T((t,e,n,a)=>{const o=n.debug||!1;x(o,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(o,"Starting argument resolution","resolver"),x(o,"Tokens:","resolver",t),x(o,"Definitions:","resolver",e),x(o,"Processing tokens...","resolver");const i=new Map,u=new Map,s=n.caseInsensitive?new Map:void 0,g=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,p=n.camelCase?new Map:void 0;for(const f of e)if(i.set(f.name,f),f.alias&&u.set(f.alias,f),n.caseInsensitive&&s&&(s.set(f.name.toLowerCase(),f),f.alias&&g&&g.set(f.alias.toLowerCase(),f)),n.camelCase&&r&&p){const m=f.name.replaceAll(Fn,(v,y)=>y.toUpperCase());r.set(f.name,m),p.set(m,f.name)}const c={},l={},d=[],h=new Set;let O=!1;const b=e.find(f=>f.defaultOption),w=e.some(f=>f.group),P=e.some(f=>f.type===Number);for(let f=0;f<t.length;f++){const m=t[f];if(m.kind==="option-terminator"){c._unknown=a.slice(m.index),O=!0;break}if(m.kind==="option"&&m.name){let v=Gn(m.name,i,u,s,g);if(!v&&m.value===void 0&&P&&/^\d+$/.test(m.name)){const A=e.find(I=>I.type===Number);A&&(v=A,m.value=m.name,m.name=A.name)}const y=v?v.name:m.name,E=v&&v.multiple,N=v&&v.lazyMultiple;if(l[y]!==void 0&&!E&&!N&&!n.partial)throw new On(y);if(!v&&n.partial){const A=m.rawName||`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;d.push({index:m.index,value:A});continue}if(!v&&n.stopAtFirstUnknown){c._unknown=a.slice(m.index);break}if(!v&&!n.partial)throw new _e(m.name);if(m.value===void 0){const A=t[f+1],I=A&&A.kind==="option"&&!("name"in A)&&A.value!==void 0,L=A&&v&&!(v.type&&me(v.type))&&(A.kind==="positional"||I),Lt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(L&&(!v?.defaultOption||Lt))if(E){let S=f+1;const de=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)de.push(t[S].value),h.add(t[S].index),S++;l[y]=l[y]===void 0?de:Ue(l[y],de),f=S-1}else N?(Ve(l,y,A.value,!0),h.add(A.index),f++):(l[y]=A.value,h.add(A.index),f++);else v&&v.type&&me(v.type)?Ve(l,y,!0,E):l[y]=E?[]:null}else{let{value:A}=m;if(v&&v.type&&me(v.type))switch(A){case"":{if(n.partial)l._unknown||(l._unknown=[]),l._unknown.push(`${m.rawName||`--${m.name}`}${m.value?`=${m.value}`:""}`),A=!0;else throw new _e(m.name);break}case"false":{A=!1;break}case"true":{A=!0;break}default:A=!0}const I=A===void 0?[]:[A];if(E){let L=f+1;for(;L<t.length&&t[L].kind==="positional";)I.push(t[L].value),h.add(t[L].index),L++;f=L-1}l[y]===void 0?l[y]=E||N?I:A:E||N?l[y]=Ue(l[y],I):l[y]=A}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!h.has(m.index)){x(o,`Found unconsumed positional token at index ${m.index}, stopping processing`,"resolver"),c._unknown=a.slice(m.index);break}}for(const[f,m]of Object.entries(l)){const v=i.get(f);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(m)&&(l[f]=[m])}if(b){const f=[],m=[];for(const v of t)v.kind==="positional"&&!h.has(v.index)&&(f.push(v.value),m.push(v));if(f.length>0){const v=l[b.name],y=b.multiple||b.lazyMultiple;v===void 0?y?(m.forEach(E=>h.add(E.index)),l[b.name]=f):(h.add(m[0].index),l[b.name]=f[0]):y&&(m.forEach(E=>h.add(E.index)),l[b.name]=Array.isArray(v)?[...f,...v]:[...f,v])}}if(!n.partial){for(const f of t)if(f.kind==="positional"&&!h.has(f.index))throw new _n(a[f.index])}if(n.partial&&!n.stopAtFirstUnknown){const f=[...d];if(l._unknown){const m=new Map;for(const[v,y]of a.entries())m.set(y,v);for(const v of l._unknown){const y=m.get(v);y!==void 0&&f.push({index:y,value:v})}}for(const m of t)m.kind==="positional"&&!h.has(m.index)&&f.push({index:m.index,value:a[m.index]});f.length>0&&(f.sort((m,v)=>m.index-v.index),c._unknown=f.map(m=>m.value))}if(n.stopAtFirstUnknown&&!O){const f=t.findIndex(y=>y.kind==="option"&&!i.has(y.name||"")&&!u.has(y.name||"")&&(!n.caseInsensitive||!s?.has(y.name?.toLowerCase()||"")&&!g?.has(y.name?.toLowerCase()||""))),m=t.findIndex(y=>y.kind==="positional"&&!h.has(y.index));let v=-1;if(f!==-1&&m!==-1?v=Math.min(f,m):f!==-1?v=f:m!==-1&&(v=m),v>=0){const y=t[v].index;c._unknown=a.slice(y)}}else d.length>0&&!n.partial&&(c._unknown=d.map(f=>f.value));for(const[f,m]of Object.entries(l)){const v=n.camelCase&&r?.get(f)||f,y=i.get(f);c[v]=y&&y.type?Dn(m,y.type):m===void 0?null:m}for(const f of e){const m=n.camelCase&&r?.get(f.name)||f.name;!(m in c)&&f.defaultValue!==void 0&&(f.multiple||f.lazyMultiple?c[m]=Array.isArray(f.defaultValue)?[...f.defaultValue]:[f.defaultValue]:c[m]=f.defaultValue)}if(w){const f={},m={},v={};for(const E of e)if(E.group){const N=Array.isArray(E.group)?E.group:[E.group];for(const A of N)Me(A)||f[A]||(f[A]={})}for(const E of Object.keys(c))if(!qn(E)){m[E]=c[E];let N=E;n.camelCase&&(N=p?.get(E)||E);const A=i.get(N);if(A&&A.group){const I=Array.isArray(A.group)?A.group:[A.group];for(const L of I)Me(L)||f[L]&&(f[L][E]=c[E])}else v[E]=c[E]}const y={_all:m};for(const[E,N]of Object.entries(f))y[E]=N;Object.keys(v).length>0&&(y._none=v),c._unknown&&(y._unknown=c._unknown),Object.keys(c).forEach(E=>delete c[E]),Object.assign(c,y)}return x(o,"Final parsed result:","resolver",c),c},"resolveArgs");var Kn=Object.defineProperty,R=H((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"l");const V="-".codePointAt(0),M="=",Yn=M.codePointAt(0),Jn="--",Qn="-",Zn="--",vt=R(t=>t.length>2&&t.startsWith(Zn),"hasLongOptionPrefix"),Xn=R(t=>vt(t)&&!t.includes(M,3),"isLongOption"),ei=R(t=>vt(t)&&t.includes(M,3),"isLongOptionAndValue"),ti=R(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==V,"hasOptionValue"),ni=R(t=>{if(t.length!==2||t.codePointAt(0)!==V||t.codePointAt(1)===V)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),ii=R(t=>!(t.length<=2||t.codePointAt(0)!==V||t.codePointAt(1)===V),"isShortOptionGroup"),ai=R(t=>{const e=[],n=[...t];let a=-1,o=0;for(;n.length>0;){const i=n.shift();if(i===void 0)break;const u=n[0];if(o>0?o--:a++,i===Jn){e.push({index:a,kind:"option-terminator"});const s=n.map((g,r)=>({index:a+r+1,kind:"positional",value:g}));e.push(...s),a+=n.length;break}if(ni(i)){const s=i.charAt(1);let g,r;o?(e.push({index:a,inlineValue:r,kind:"option",name:s,rawName:i,value:g}),o===1&&ti(u)&&(g=n.shift(),e.push({index:a,inlineValue:r,kind:"option",value:g}))):e.push({index:a,inlineValue:r,kind:"option",name:s,rawName:i,value:g}),g!==void 0&&++a;continue}if(ii(i)&&!i.includes(M)){const s=[];let g="",r=!1;for(let p=1;p<i.length;p++){const c=i.charAt(p);r?g+=c:c.codePointAt(0)===Yn?r=!0:s.push(`${Qn}${c}`)}if(r)if(s.length>0){const p=s.pop();s.push(`${p}=${g}`)}else s.push(g);n.unshift(...s),o=s.length;continue}if(Xn(i)){const s=i.slice(2);e.push({index:a,kind:"option",name:s,rawName:i});continue}if(ei(i)){const s=i.indexOf(M),g=i.slice(2,s),r=i.slice(s+1);e.push({index:a,inlineValue:!0,kind:"option",name:g,rawName:i,value:r});continue}if(i.length>2&&i.codePointAt(0)===V&&i.codePointAt(1)!==V&&i.includes(M)){const s=i.indexOf(M),g=i.charAt(1),r=i.slice(s+1);e.push({index:a,inlineValue:!0,kind:"option",name:g,rawName:i,value:r});continue}e.push({index:a,kind:"positional",value:i})}return e},"parseArgsTokens");var ri=Object.defineProperty,Pe=H((t,e)=>ri(t,"name",{value:e,configurable:!0}),"d");const oi=Pe(t=>t&&(t===Boolean||typeof t=="function"&&t.name?.startsWith("Boolean")),"isBooleanType"),si=Pe(t=>typeof t=="function","isValidCustomTypeFunction"),li=Pe((t,e,n)=>{const a=n?.debug||!1;x(a,"Validating definitions:","validation",t,"caseInsensitive:",e);const o=new Set,i=new Set,u=new Set,s=new Set;let g=0;for(const r of t){if(x(a,"Checking definition:","validation",r),!r.name)throw x(a,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof r.name!="string")throw new j("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const p=e?r.name.toLowerCase():"";if(o.has(r.name)||e&&u.has(p))throw new j(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&s.has(p))throw new j(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(o.add(r.name),e&&u.add(p),r.alias!==void 0){if(typeof r.alias!="string")throw new j("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(/\d/.test(r.alias))throw new j("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const c=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&s.has(c))throw new j(`Invalid option definition: duplicate alias '${r.alias}'`);if(o.has(r.alias)||e&&u.has(c))throw new j(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&s.add(c)}if(r.defaultOption&&(g++,r.type!==void 0&&oi(r.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&si(r.type)))throw new j("Invalid option definition: invalid type")}if(g>1)throw x(a,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");x(a,"Validation completed successfully","validation")},"validateDefinitions");var ci=Object.defineProperty,ui=H((t,e)=>ci(t,"name",{value:e,configurable:!0}),"O");const pi=ui((t,e={})=>{const n=e.debug||!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const a={...e};a.stopAtFirstUnknown&&(a.partial=!0);const o=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",o),li(o,a.caseInsensitive,n?a:void 0);let{argv:i}=a;if(!i&&(i=process.argv.slice(2),process.execArgv?.length)){const r=new Set(process.execArgv);i=i.filter(p=>!r.has(p))}x(n,"Using argv:","index",i);let u=i;a.caseInsensitive&&i&&(u=i.map(r=>{if(r.startsWith("--")){const p=r.indexOf("="),c=(p===-1?r.slice(2):r.slice(2,p)).toLowerCase();return p===-1?`--${c}`:`--${c}${r.slice(p)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const p=r.slice(1).split("=",2),c=p[0],l=p[1];if(!c)return r;const d=c.toLowerCase();return l===void 0?`-${d}`:`-${d}=${l}`}return r}));const s=ai((u??i??[]).map(String));x(n,"Tokenized arguments:","index",s);const g=Hn(s,o,a,i??[]);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");var fi=Object.defineProperty,hi=$((t,e)=>fi(t,"name",{value:e,configurable:!0}),"m$6");let di=class{static{$(this,"a")}static{hi(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;constructor(e,n){this.commandName=e,this.command=n}};var mi=Object.defineProperty,gi=$((t,e)=>mi(t,"name",{value:e,configurable:!0}),"f$4");const vi=/^-{1,2}(\w+)(=(.+))?$/,yt=gi((t,e,n,a)=>{const o=vi.exec(t);if(o==null)return{};const i=o[1];if(!i)return{};const u=n&&a?n.get(i)??a.get(i):e.find(s=>s.name===i||s.alias===i);return u!==void 0?{argName:u.name,argValue:o[3],option:u}:{}},"getParameterOption");var yi=Object.defineProperty,Ae=$((t,e)=>yi(t,"name",{value:e,configurable:!0}),"e$2");const Te=Ae((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),wi=new Set(["0","1","false","true"]),bi=Ae((t,e,n,a)=>{if(e.length===0||t.length===0)return{};const o=Ae((i,u)=>{const{argName:s,argValue:g,option:r}=yt(u,e,n,a),{lastOption:p}=i;return r&&X(r)&&g&&s?i.partial[s]=Te(g,r):i.lastName&&p&&X(p)&&wi.has(u)&&(i.partial[i.lastName]=Te(u,p)),{lastName:s,lastOption:r,partial:i.partial}},"getBooleanValue");return t.reduce(o,{partial:{}}).partial},"getBooleanValues");var $i=Object.defineProperty,Re=$((t,e)=>$i(t,"name",{value:e,configurable:!0}),"s$8");const Oi=new Set(["0","1","false","true"]),Ei=Re((t,e,n,a)=>{if(e.length===0||t.length===0)return t;const o=Re((i,u)=>{const{argValue:s,option:g}=yt(u,e,n,a),{lastOption:r}=i;if(r&&X(r)&&Oi.has(u)){const{args:p}=i;return{args:p.slice(0,-1)}}return g&&X(g)&&s?{args:i.args}:{args:[...i.args,u],lastOption:g}},"removeBooleanArguments");return t.reduce(o,{args:[]}).args},"removeBooleanValues");var Ai=Object.defineProperty,Pi=$((t,e)=>Ai(t,"name",{value:e,configurable:!0}),"o$8");const De=Pi(t=>{const e=new Map;for(const n of t){const a=e.get(n.name);a?e.set(n.name,{...a,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Ci=Object.defineProperty,se=$((t,e)=>Ci(t,"name",{value:e,configurable:!0}),"o$7");const ki=se(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),Ni=se((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ki(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),xi=se(t=>t.toLowerCase().replaceAll(/_./g,e=>e[1]?.toUpperCase()??e).replace(/^[A-Z]/,e=>e.toLowerCase()),"toCamelCase"),ji=se(t=>{if(!t||t.length===0)return{};const e={},n=q();for(const a of t){const o=n[a.name],i=Ni(a,o),u=i===void 0?a.defaultValue:i,s=xi(a.name);e[s]=u}return e},"processEnvVariables");var _i=Object.defineProperty,le=$((t,e)=>_i(t,"name",{value:e,configurable:!0}),"l$a");const Li=le(t=>{const e=new Map,n=new Map;for(const a of t)if(e.set(a.name,a),a.alias){const o=Array.isArray(a.alias)?a.alias:[a.alias];for(const i of o)n.set(i,a)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),Ii=le((t,e,n,a)=>{const o=new di(t.name,t),{_all:i,positionals:u}=e,s=Object.keys(n).length>0?{...i,...n}:i;te in s&&delete s[te],o.argument=u?.[te]??[];const g=Object.keys(a).length>0;return o.options=g?{...s,...a}:s,o.env=ji(t.env),o},"prepareToolbox"),Si=le((t,e,n)=>{const a=t.options??[],o=a.length>0;let i=De(o?[...a,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument?.description,group:"positionals",multiple:!0,name:te,type:t.argument?.type,typeLabel:t.argument?.typeLabel},...i]);let u,s;if(o){const{optionMapByAlias:r,optionMapByName:p}=Li(a);u=Ei(e,a,p,r),s=bi(e,a,p,r)}else u=e,s={};const g=pi(i,{argv:u,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:s,parsedArgs:g}},"processCommandArgs"),B=le(async(t,e,n)=>await t.execute(e),"executeCommand");var Ui=Object.defineProperty,Mi=$((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"n$6");let Vi=class extends k{static{$(this,"s")}static{Mi(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var Ti=Object.defineProperty,Ri=$((t,e)=>Ti(t,"name",{value:e,configurable:!0}),"t$5");const Be=Ri((t,e,n=!1)=>{const a=[];for(const o of t)if(!(!n&&!o.required)&&e[o.name]===void 0){if(o.type?.name==="Boolean"){e[o.name]=!1;continue}a.push(o)}return a},"listMissingArguments");var Di=Object.defineProperty,wt=$((t,e)=>Di(t,"name",{value:e,configurable:!0}),"n$5");const Bi=wt((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Ft(t,e)<=t.length/3,"isSimilar"),F=wt((t,e)=>{const n=t.toLowerCase();return e.filter(a=>Bi(a.toLowerCase(),n))},"findAlternatives");var zi=Object.defineProperty,ce=$((t,e)=>zi(t,"name",{value:e,configurable:!0}),"a$2");const Wi=ce((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(a=>{const o=a.startsWith("--");let i=`Found unknown ${o?"option":"argument"} "${a}"`;if(o){const u=F(a.replace("--",""),(e.options??[]).map(s=>s.name));if(u.length>0){const[s,...g]=u.map(r=>`--${r}`);i+=g.length>0?`, did you mean ${s} or ${g.join(", ")}?`:`, did you mean ${s}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
2
+ `))},"validateUnknownOptions"),Fi=ce((t,e,n)=>{const a=n.__requiredOptions__?Be(n.__requiredOptions__,e,!0):Be(t,e,!1);if(a.length>0)throw new Vi(n.name,a.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Wi(e,n)},"validateRequiredOptions"),qi=ce((t,e,n)=>{const a=n.__conflictingOptions__??t.filter(o=>o.conflicts!==void 0);if(a.length>0){const o=a.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(u=>e[u]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(o)throw new Qe(o.name,typeof o.conflicts=="string"?o.conflicts:o.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),Gi=ce(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const o of t.options){if(o.name){const i=e.get(o.name)??[];i.push(o),e.set(o.name,i)}if(typeof o.alias=="string"&&o.alias.length>0){const i=n.get(o.alias)??[];i.push(o),n.set(o.alias,i)}else if(Array.isArray(o.alias)){for(const i of o.alias)if(i.length>0){const u=n.get(i)??[];u.push(o),n.set(i,u)}}}const a=[];for(const[o,i]of e)i.length>1&&a.push(`Duplicate option name "${o}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[o,i]of n)i.length>1&&a.push(`Duplicate option alias "-${o}" used by options ${i.map(u=>`"${u.name}"`).join(", ")} in command "${t.name}"`);if(a.length>0)throw new Error(a.join(`
3
+ `))},"validateDuplicateOptions");var Hi=Object.defineProperty,Ce=$((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"r$7");const Ki=Ce((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];for(let a=1;a<=e.length;a+=1){const o=e[a-1];if(o===void 0)break;n.push(o);const i=n.join(" ");if(t.has(i))return{argv:e.slice(a),commandPath:[...n]}}return{argv:e,commandPath:void 0}},"parseNestedCommand"),J=Ce(t=>t.join(" "),"getCommandPathKey"),Yi=Ce((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Ji=Object.defineProperty,Qi=$((t,e)=>Ji(t,"name",{value:e,configurable:!0}),"p$4"),Zi=Object.defineProperty,bt=Qi((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"e"),Xi=Object.defineProperty,ea=bt((t,e)=>Xi(t,"name",{value:e,configurable:!0}),"E");const $t=String.raw,ze=$t`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,ta=ea(()=>new RegExp($t`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${ze}(?:\u200D${ze})*`,"gu"),"default");var na=Object.defineProperty,ia=bt((t,e)=>na(t,"name",{value:e,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const G=ta(),aa=/[-_./\s]+/g,Z=/(\u001B\[[0-9;]*[a-z])/i,We=new RegExp("\\p{Script=Arabic}","u"),ra=new RegExp("\\p{Script=Bengali}","u"),z=new RegExp("\\p{Script=Cyrillic}","u"),oa=new RegExp("\\p{Script=Devanagari}","u"),sa=new RegExp("\\p{Script=Ethiopic}","u"),ge=new RegExp("\\p{Script=Greek}","u"),la=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ca=new RegExp("\\p{Script=Gujarati}","u"),ua=new RegExp("\\p{Script=Gurmukhi}","u"),Fe=new RegExp("\\p{Script=Hangul}","u"),qe=new RegExp("\\p{Script=Hebrew}","u"),pa=new RegExp("\\p{Script=Hiragana}","u"),Ge=new RegExp("\\p{Script=Han}","u"),fa=new RegExp("\\p{Script=Kannada}","u"),ha=new RegExp("\\p{Script=Katakana}","u"),da=new RegExp("\\p{Script=Khmer}","u"),ma=new RegExp("\\p{Script=Lao}","u"),_=new RegExp("\\p{Script=Latin}","u"),ga=new RegExp("\\p{Script=Malayalam}","u"),va=new RegExp("\\p{Script=Myanmar}","u"),ya=new RegExp("\\p{Script=Oriya}","u"),wa=new RegExp("\\p{Script=Sinhala}","u"),ba=new RegExp("\\p{Script=Tamil}","u"),$a=new RegExp("\\p{Script=Telugu}","u"),Oa=new RegExp("\\p{Script=Thai}","u"),Ea=new RegExp("\\p{Script=Tibetan}","u"),He=/[\u02BB\u02BC\u0027]/u,Aa=ia(t=>t.replace(G,""),"stripEmoji");var Pa=Object.defineProperty,Ot=$((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"i$6"),Ca=Object.defineProperty,Et=Ot((t,e)=>Ca(t,"name",{value:e,configurable:!0}),"r"),ka=Object.defineProperty,Na=Et((t,e)=>ka(t,"name",{value:e,configurable:!0}),"c");let At=class{static{$(this,"l")}static{Ot(this,"y")}static{Et(this,"s")}static{Na(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(a=>a!==e);else if(this.cache.size>=this.capacity){const a=this.keyOrder.shift();a!==void 0&&this.cache.delete(a)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var xa=Object.defineProperty,ja=$((t,e)=>xa(t,"name",{value:e,configurable:!0}),"r$5"),_a=Object.defineProperty,La=ja((t,e)=>_a(t,"name",{value:e,configurable:!0}),"a"),Ia=Object.defineProperty,Sa=La((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"s");const Ua=Sa((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Ma=Object.defineProperty,Va=$((t,e)=>Ma(t,"name",{value:e,configurable:!0}),"I"),Ta=Object.defineProperty,ue=Va((t,e)=>Ta(t,"name",{value:e,configurable:!0}),"j");const Ra=qt(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Da=ue(t=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[e,n]=Q.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Q.getBuiltinModule(t)}return Ra(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ba}=Da("node:util");var za=Object.defineProperty,Wa=ue((t,e)=>za(t,"name",{value:e,configurable:!0}),"g");const ve=new At(1e3),Fa=Wa(t=>{const e=t.join("");if(ve.has(e))return ve.get(e);const n=t.map(o=>o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)).join("|"),a=new RegExp(n,"g");return ve.set(e,a),a},"getSeparatorsRegex");var qa=Object.defineProperty,Ga=ue((t,e)=>qa(t,"name",{value:e,configurable:!0}),"t");const Ha=Ga(t=>{const e=[];let n=0,a;for(G.lastIndex=0;(a=G.exec(t))!==null;)a.index>n&&e.push(t.slice(n,a.index)),e.push(a[0]),n=G.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Ka=Object.defineProperty,C=ue((t,e)=>Ka(t,"name",{value:e,configurable:!0}),"u");const Pt=new Uint8Array(128),Ct=new Uint8Array(128),kt=new Uint8Array(128);for(let t=0;t<128;t++)Pt[t]=t>=65&&t<=90?1:0,Ct[t]=t>=97&&t<=122?1:0,kt[t]=t>=48&&t<=57?1:0;const ye=C(t=>Pt[t],"isUpper"),Ke=C(t=>Ct[t],"isLower"),we=C(t=>kt[t],"isDigit"),U=C((t,e,n,a,o)=>{if(t.length===0)return[];let i=!1;for(const c of Object.values(e))if(c(t[0])){i=!0;break}if(!i&&!n)return[t];const u=[...t],s=[];let g=u[0],r="other";for(const[c,l]of Object.entries(e))if(l(u[0])){r=c;break}let p=n&&a?u[0]===u[0].toLocaleUpperCase(a):!1;for(let c=1;c<u.length;c++){const l=u[c];let d="other";for(const[b,w]of Object.entries(e))if(w(l)){d=b;break}const h=n&&a?l===l.toLocaleUpperCase(a):!1;let O=!1;o?O=o(r,d,p,h,l,c,u):(r!==d&&r!=="other"&&d!=="other"&&(O=!0),n&&d!=="other"&&!p&&h&&(O=!0)),O?(s.push(g),g=l):g+=l,r=d,n&&(p=h)}return g&&g.length>0&&s.push(g),s.length>0?s:[t]},"handleScriptTransitions"),Ya=C((t,e,n,a)=>{if(n.size===0)return e;for(const o of n)if(t.startsWith(o,e))return a.push(o),e+o.length;return e},"detectAndProcessAcronym"),Nt=C((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const a=[],o=t.length;for(let i=1;i<o;i++){const u=Ya(t,n,e,a);if(u!==n){n=u,i=n-1;continue}const s=t.codePointAt(i-1),g=t.codePointAt(i),r=s&&s<128&&ye(s),p=g&&g<128&&ye(g),c=s&&s<128&&Ke(s),l=s&&s<128&&we(s),d=g&&g<128&&we(g);if(c&&p){a.push(t.slice(n,i)),n=i;continue}if(l&&!d||!l&&d){a.push(t.slice(n,i)),n=i;continue}if(d&&!l){let h=!1,O=!1;if(i+1<o){const b=t.codePointAt(i+1);h=b&&b<128&&ye(b),O=b&&b<128&&we(b)}if(!O&&h){a.push(t.slice(n,i),t.slice(i,i+1)),n=i+1;continue}}if(i+1<o){const h=t.codePointAt(i+1),O=h&&h<128&&Ke(h);if(r&&p&&O){const b=t.slice(n,i+1);e.has(b)||(a.push(t.slice(n,i)),n=i)}}}return n<o&&a.push(t.slice(n)),a.filter(i=>i!=="")},"splitCamelCaseFast"),xt=C((t,e,n)=>{if(t.length===0)return[];const a=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!a&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],p=r.length,c=[];let l=r[0],d=r[0]===r[0].toLocaleUpperCase(e),h=d,O=d?0:-1;for(let b=1;b<p;b++){const w=r[b],P=w===w.toLocaleUpperCase(e);if(P===d)l+=w;else if(P)l&&l.length>0&&(c.push(l),l=w),h=!0,O=b;else{if(h&&b-O>1){const f=r[b-1],m=l.slice(0,-1);m&&m.length>0&&c.push(m),l=f+w}else l+=w;h=!1,O=-1}d=P}return l&&l.length>0&&c.push(l),c}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!z.test(t)&&!_.test(t))return[t];const r=[...t],p=r.length,c=[];let l=r[0];const d=r[0];let h;z.test(d)?h=1:_.test(d)?h=2:h=0;let O=d===d.toLocaleUpperCase(e);for(let w=1;w<p;w++){const P=r[w];let f;z.test(P)?f=1:_.test(P)?f=2:f=0;const m=P===P.toLocaleUpperCase(e);h!==f&&(h===1||h===2)&&(f===1||f===2)||f===h&&!O&&m?(c.push(l),l=P):l+=P,h=f,O=m}l&&l.length>0&&c.push(l);const b=[];for(let w=0;w<c.length;w++)w<c.length-1&&c[w].length===1&&_.test(c[w])&&z.test(c[w+1][0])?(b.push(c[w]+c[w+1]),w+=1):b.push(c[w]);return b}if(e.startsWith("el")){if(!ge.test(t)&&!_.test(t))return[t];const r=t.match(la)??[t],p=[];if(r.length===1){const c=r[0];if(!c||!ge.test(c[0])||c.length===1)return[c||t]}for(const c of r){if(!c)continue;if(!ge.test(c[0])||c.length===1){p.push(c);continue}const l=c.length;let d=c[0],h=c[0]===c[0].toLocaleUpperCase(e);for(let O=1;O<l;O++){const b=c[O],w=b===b.toLocaleUpperCase(e);!h&&w?(p.push(d),d=b):d+=b,h=w}d&&p.push(d)}return p}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),p=r?{hiragana:C(l=>pa.test(l),"hiragana"),kanji:C(l=>Ge.test(l),"kanji"),katakana:C(l=>ha.test(l),"katakana"),latin:C(l=>_.test(l),"latin")}:{hangul:C(l=>Fe.test(l),"hangul"),latin:C(l=>_.test(l),"latin")},c=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const l=U(t,p,!1,e,(h,O)=>h==="hiragana"&&O==="katakana"||h==="katakana"&&O==="hiragana"||h==="hiragana"&&O==="latin"||h==="katakana"&&O==="latin"||h==="kanji"&&O==="latin"||h==="latin"&&(O==="hiragana"||O==="katakana"||O==="kanji")),d=[];for(const h of l)h.length===1&&c.has(h)&&d.length>0?d[d.length-1]+=h:d.push(h);return d.length>0?d:[t]}return U(t,p,!1,e,(l,d)=>l==="hangul"&&d==="latin"||l==="latin"&&d==="hangul")}if(e.startsWith("sl")){const r=[...t],p=r.length,c=[];let l=r[0],d=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<p;h++){const O=r[h],b=O===O.toLocaleUpperCase(e),w=/[ČŠŽĐ]/i.test(O),P=h<p-1&&r[h+1]===r[h+1].toLocaleUpperCase(e);!d&&b||w&&P?(c.push(l),l=O,w&&P&&(c.push(l),l="")):l+=O,d=b}return l&&l.length>0&&c.push(l),c}if(e.startsWith("zh"))return U(t,{han:C(r=>Ge.test(r),"han"),latin:C(r=>_.test(r),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=C(p=>qe.test(p)||We.test(p),"isRtlChar");return U(t,{latin:C(p=>_.test(p),"latin"),rtl:C(p=>r(p),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=C(p=>oa.test(p)||ra.test(p)||ca.test(p)||ua.test(p)||fa.test(p)||ba.test(p)||$a.test(p)||ga.test(p)||wa.test(p)||Oa.test(p)||ma.test(p)||Ea.test(p)||va.test(p)||sa.test(p)||da.test(p)||ya.test(p),"isIndicChar");return U(t,{indic:C(p=>r(p),"indic"),latin:C(p=>_.test(p),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return U(t,{cyrillic:C(r=>z.test(r),"cyrillic"),latin:C(r=>_.test(r),"latin")},!0,e);if(["ar","fa","he"].includes(e))return U(t,{latin:C(r=>_.test(r),"latin"),rtl:C(r=>qe.test(r)||We.test(r),"rtl")},!1,e);if(e.startsWith("ko"))return U(t,{hangul:C(r=>Fe.test(r),"hangul"),latin:C(r=>_.test(r),"latin")},!1,e);if(e.startsWith("uz")){if(!z.test(t)&&!_.test(t))return[t];const r=[...t],p=r.length,c=[];let l=r[0],d=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<p;h++){const O=r[h],b=O===O.toLocaleUpperCase(e);if(He.test(O)||He.test(r[h-1])){l+=O;continue}!d&&b?(c.push(l),l=O):l+=O,d=b}return l&&l.length>0&&c.push(l),c}const o=[...t],i=o.length,u=[];let s=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){u.push(r),s=o[r.length],g=s===s.toLocaleUpperCase(e);break}for(let r=1;r<i;r++){const p=o[r],c=p===p.toLocaleUpperCase(e);let l=0;for(const d of n)if(t.startsWith(d,r)){u.push(s,d),l=d.length,s="";const h=d[d.length-1];h&&(g=h===h.toLocaleUpperCase(e));break}if(l>0){r+=l-1;continue}!g&&c?(u.push(s),s=p):s+=p,g=c}return s&&u.push(s),u},"splitCamelCaseLocale"),Ja=C((t,e,n)=>{const a=[],o=Z.test(t)?t.split(Z).filter(Boolean):[t];for(const i of o)if(Z.test(i))a.push(i);else{const u=G.test(i)?Ha(i).filter(Boolean):[i];for(const s of u)if(G.test(s))a.push(s);else if(e){const g=e.toLowerCase().split("-")[0];a.push(...xt(s,g,n))}else a.push(...Nt(s,n))}return a},"processTextWithAnsiEmoji"),Qa=C((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:a=!1,knownAcronyms:o=[],locale:i,normalize:u=!1,separators:s,stripAnsi:g=!1,stripEmoji:r=!1}=e,p=new Set([...o].toSorted((w,P)=>P.length-w.length));let c=t;g&&(c=Ba(c)),r&&(c=Aa(c));let l;Array.isArray(s)?l=Fa(s):s instanceof RegExp?l=s:l=aa;const d=[];let h=c;const O=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;h.length>0;){const w=O.exec(h);if(!w){h===".."?d.push(".."):h==="."?d.push("."):h.length>0&&d.push(h);break}const P=w.index,f=w[0],m=f.length,v=h.slice(0,P),y=h.slice(P+m);if(f.startsWith("../"))d.push(".."),h=h.slice(P+3);else if(f.startsWith("./"))d.push("."),h=h.slice(P+2);else if(P===0&&f==="..")d.push(".."),h=h.slice(2);else if(P===0&&f===".")d.push("."),h=h.slice(1);else{v.length>0&&d.push(v);let E=0;for(;(E=f.indexOf("../",E))!==-1;)d.push(".."),E+=3;for(E=0;(E=f.indexOf("./",E))!==-1;)(E===0||f[E-1]!==".")&&d.push("."),E+=2;let N=y;for(;N.startsWith("../");)d.push(".."),N=N.slice(3);for(;N.startsWith("./");)d.push("."),N=N.slice(2);if(N===".."){d.push("..");break}else if(N==="."){d.push(".");break}else h=N}O.lastIndex=0}if(d.length===0){const w=c.split(l).filter(Boolean);d.push(...w)}let b=[];for(const w of d)n||a?b.push(...Ja(w,i,p)):i?b.push(...xt(w,i,p)):b.push(...Nt(w,p));return u&&(b=b.map(w=>p.has(w)?w:i&&w===w.toLocaleUpperCase(i)?w[0]+w.slice(1).toLocaleLowerCase(i):w.toUpperCase()===w&&!p.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),b},"splitByCase");var Za=Object.defineProperty,Xa=$((t,e)=>Za(t,"name",{value:e,configurable:!0}),"r$4"),er=Object.defineProperty,tr=Xa((t,e)=>er(t,"name",{value:e,configurable:!0}),"o"),nr=Object.defineProperty,ir=tr((t,e)=>nr(t,"name",{value:e,configurable:!0}),"s");const ar=ir((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var rr=Object.defineProperty,or=$((t,e)=>rr(t,"name",{value:e,configurable:!0}),"r$3"),sr=Object.defineProperty,lr=or((t,e)=>sr(t,"name",{value:e,configurable:!0}),"r"),cr=Object.defineProperty,ur=lr((t,e)=>cr(t,"name",{value:e,configurable:!0}),"n");const pr=ur((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var fr=Object.defineProperty,hr=$((t,e)=>fr(t,"name",{value:e,configurable:!0}),"i$4"),dr=Object.defineProperty,mr=hr((t,e)=>dr(t,"name",{value:e,configurable:!0}),"a"),gr=Object.defineProperty,vr=mr((t,e)=>gr(t,"name",{value:e,configurable:!0}),"l");const yr=vr((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const a=[];let o="",i="";for(let u=0;u<n;u++){const s=t[u];if(Z.test(s)){o?(a.push(o+i+s),o="",i=""):(a.length>0&&a.push(e),o=s);continue}o?(i&&(i+=e),i+=s):(a.length>0&&a.push(e),a.push(s))}return a.join("")},"joinSegments");var wr=Object.defineProperty,br=$((t,e)=>wr(t,"name",{value:e,configurable:!0}),"r$2"),$r=Object.defineProperty,Or=br((t,e)=>$r(t,"name",{value:e,configurable:!0}),"a"),Er=Object.defineProperty,Ar=Or((t,e)=>Er(t,"name",{value:e,configurable:!0}),"t");const Pr=Ar(t=>t.replaceAll(/(?<![a-zß])SS(?![a-z])/g,"ß"),"normalizeGermanEszett");var Cr=Object.defineProperty,kr=$((t,e)=>Cr(t,"name",{value:e,configurable:!0}),"l$2"),Nr=Object.defineProperty,xr=kr((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"n"),jr=Object.defineProperty,_r=xr((t,e)=>jr(t,"name",{value:e,configurable:!0}),"l");const Lr=new At(1e3),jt=_r((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,a=e?.cacheStore??Lr;let o;if(n&&(o=pr(t,e)),n&&o&&a.has(o))return a.get(o);let i=!0;const u=yr(Qa(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>e?.handleAnsi&&Z.test(s)?s:(s=e?.locale?.startsWith("de")?Pr(s):s,s=e?.locale?s.toLocaleLowerCase(e.locale):s.toLowerCase(),i?(i=!1,Ua(s,e)):ar(s,e))),"");return n&&o&&a.set(o,u),u},"camelCase");var Ir=Object.defineProperty,pe=$((t,e)=>Ir(t,"name",{value:e,configurable:!0}),"a");const Sr=pe(t=>{t.options?.forEach(e=>{e.__camelCaseName__=jt(e.name)})},"processOptionNames"),Ur=pe(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const a of t.options)e.add(a.name);const n=[];for(const a of t.options)if(a.name.startsWith("no-")){const o=a.name.replace("no-","");if(!e.has(o)){if(a.type!==Boolean)throw new Error(`Cannot add negated option "${a.name}" to command "${t.name}" because it is not a boolean.`);const i={...a,defaultValue:a.defaultValue===void 0?!0:!a.defaultValue,name:o};n.push(i),e.add(o)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Mr=pe((t,e)=>{if(!e.options||e.options.length===0)return;const n=t.options,a=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const u=jt(i.name);a.set(u,i)}const o=Object.keys(n).filter(i=>a.has(i));if(o.length!==0)for(const i of o){const u=i.charAt(2);if(!u)continue;const s=u.toLowerCase()+i.slice(3),g=a.get(i);g&&(g.__negated__=!0),n[s]=!n[i],Reflect.deleteProperty(n,i)}},"mapNegatableOptions"),Vr=pe((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const o of e.options)o.__camelCaseName__&&o.__negated__===void 0&&o.implies!==void 0&&n.set(o.__camelCaseName__,o);if(n.size===0)return;const a=t.options;for(const o of Object.keys(a)){const i=n.get(o);if(i?.implies){const u=i.implies;for(const[s,g]of Object.entries(u))a[s]===void 0&&(a[s]=g)}}},"mapImpliedOptions");var Tr=Object.defineProperty,fe=$((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"e$1");const Rr=fe(()=>!!process.versions.electron,"isElectronApp"),Dr=fe(()=>Rr()&&!process.defaultApp,"isBundledElectronApp"),Br=fe(()=>Dr()?0:1,"getProcessArgvBinIndex"),zr=fe(t=>t.slice(Br()+1),"hideBin");var Wr=Object.defineProperty,_t=$((t,e)=>Wr(t,"name",{value:e,configurable:!0}),"s$2");const Fr=" ",qr=_t((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,a)=>n===e[a]),"equals"),Gr=_t(t=>{if(typeof t=="string")return t.split(Fr);const e=Ee();return qr(t,e)?zr(t):t},"parseRawCommand");var Hr=Object.defineProperty,be=$((t,e)=>Hr(t,"name",{value:e,configurable:!0}),"r");const Kr=be(t=>{const e=be(i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),ie(1)},"uncaughtExceptionHandler"),n=be((i,u)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let s;if(typeof i=="string")s=i;else try{s=JSON.stringify(i)}catch{s=String(i)}t.error(`Promise rejection: ${s}`)}ie(1)},"unhandledRejectionHandler"),a=xe("uncaughtException",e),o=xe("unhandledRejection",n);return()=>{a(),o()}},"registerExceptionHandler");var Yr=Object.defineProperty,K=$((t,e)=>Yr(t,"name",{value:e,configurable:!0}),"e");const ae=100,ke=K((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new k(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),Ye=K((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new k(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");K((t,e)=>{if(typeof t!="function")throw new k(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const $e=K((t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),ee=K(t=>{const e=ke(t,"Command name");if(e.length>ae)throw new k(`Command name is too long (maximum ${ae} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!/^[a-z][\w-]*$/i.test(e))throw new k(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");K(t=>{const e=ke(t,"Plugin name");if(e.length>ae)throw new k(`Plugin name is too long (maximum ${ae} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!/^[a-z][\w-]*$/i.test(e))throw new k(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var Jr=Object.defineProperty,he=$((t,e)=>Jr(t,"name",{value:e,configurable:!0}),"s");const Qr=new Set([`
4
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Zr=he(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error("Argument is too long (maximum 10000 characters)");for(const e of t)if(Qr.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),Je=he(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error("Too many arguments (maximum 100)");return t.map(e=>Zr(e))},"sanitizeArguments");he(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||/^[A-Z]:/i.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class yo{static{$(this,"RateLimiter")}static{he(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),a=this.attempts.get(e);return!a||n>a.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):a.count>=this.maxAttempts?!1:(a.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,a]of this.attempts.entries())e>a.resetTime&&this.attempts.delete(n)}}var Xr=Object.defineProperty,ne=$((t,e)=>Xr(t,"name",{value:e,configurable:!0}),"_");const eo=/^-([^\d-])$/,to=/^--(\S+)/,no=/^-([^\d-]{2,})$/,Oe=ne(t=>eo.test(t)||to.test(t)||no.test(t),"isOption");class wo{static{$(this,"Cli")}static{ne(this,"Cli")}#t;#e;#r;#c;#g;#u;#v;#o;#n;#i;#p;#s;#l;#f=!1;#y;#w=!1;#h;#d;#m;#E(){return this.#h===void 0&&(this.#h=[...this.#i.keys()]),this.#h}#b(){return this.#d===void 0&&(this.#d=[...this.#n.keys()]),this.#d}#a(){return this.#m===void 0&&(this.#m=[...this.#E(),...this.#b()]),this.#m}#A(){this.#h=void 0,this.#d=void 0,this.#m=void 0}#$(){if(this.#r===void 0){const e=Gr(this.#e.argv);this.#r=Je(e),this.#P()}return this.#r}#P(){if(!this.#r)return;const e=q();let n=!1;for(const a of this.#r){if(a==="--quiet"||a==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Rt),n=!0;break}if(a==="--verbose"||a==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Dt),n=!0;break}if(a==="--debug"||a==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(W),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(W):String(Ne))}#C(){this.#w||(this.#y=Kr(this.#t),this.#w=!0)}#O(e,n,a,o){this.#t.debug(`command '${o}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:u,parsedArgs:s}=Si(e,n,Vt),g=Object.keys(u).length>0?{...s,_all:{...s._all,...u}}:s;Fi(i,g,e);const r=Ii(e,s,u,a);r.runtime=this,r.argv=this.#$();const p=e.options&&e.options.length>0;if(p&&e.options){const c=e.options.filter(l=>l.name.startsWith("no-"));for(const l of c){const d=l.name.replace("no-",""),h=`--${l.name}`,O=`--${d}`,b=n.includes(h),w=n.includes(O);if(b&&w)throw new Qe(d,l.name)}}return p&&(Mr(r,e),Vr(r,e)),qi(i,r.options,e),q().CEREBRO_OUTPUT_LEVEL===String(W)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(r.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(r.argument,null,2))),{arguments_:i,booleanValues:u,commandArgs:g,parsedArgs:s,toolbox:r}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#g=e.trim();const a=n.argv??Ee(),o=n.cwd??Bt();if(this.#e={...n,argv:a,cwd:o},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const i=q();if(i.CEREBRO_OUTPUT_LEVEL=String(Ne),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],s=[],g=this.#e.logger;for(const r of u)typeof g[r]!="function"&&s.push(r);if(s.length>0)throw new k(`Logger object is missing required methods: ${s.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:s});this.#t=this.#e.logger}else this.#t={...console,debug:ne((...u)=>{i.CEREBRO_OUTPUT_LEVEL===String(W)&&console.debug(...u)},"debug")};this.#u=this.#e.packageVersion,this.#v=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#i=new Map,this.#p=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#g}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){$e(e,"Command"),ee(e.name),e.alias&&(typeof e.alias=="string"?ee(e.alias):Ye(e.alias,"Command alias").forEach(o=>ee(o))),e.argument&&$e(e.argument,"Command argument"),e.options&&$e(e.options,"Command options"),e.commandPath&&(Ye(e.commandPath,"Command commandPath"),e.commandPath.forEach(o=>{ee(o)}));const n=Yi(e.name,e.commandPath),a=J(n);if(this.#i.has(a))throw new k(`Command with path "${a}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});if(this.#n.has(e.name)&&!e.commandPath)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const o of e.options)on(o);if(Gi(e),Ur(e),Sr(e),e.options&&(e.__conflictingOptions__=e.options.filter(o=>o.conflicts!==void 0),e.__requiredOptions__=e.options.filter(o=>o.required===!0)),this.#n.set(e.name,e),this.#i.set(a,n),this.#p.set(a,e),this.#A(),e.alias!==void 0){const o=typeof e.alias=="string"?[e.alias]:e.alias;for(const i of o){if(q().CEREBRO_OUTPUT_LEVEL===String(W)&&this.#t.debug("adding alias",i),this.#n.has(i))throw new k(`Command alias "${i}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:i,commandName:e.name});this.#n.set(i,e)}}return this}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#o?this.#o:(this.#o=new en(this.#t),this.#o.register({description:"Attaches the logger to the toolbox",execute:ne(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#o)}getCliName(){return this.#g}getPackageVersion(){return this.#u}getPackageName(){return this.#v}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:a=!0,...o}=e;this.#n.has("help")||this.addCommand(new Tt(this.#n));const i=this.#b(),u=this.#i;this.#C();const s=this.#$();let g,r=[...s];const p=zt(),c=Wt(),l=Ee();this.#t.debug(`process.execPath: ${p}`),this.#t.debug(`process.execArgv: ${c.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const d=Ki(u,[...s]);if(d.commandPath)g=d.commandPath,r=d.argv;else{if(s.length>1&&s[0]&&s[1]&&!Oe(s[0])&&!Oe(s[1])){const y=[];let E=0;for(;E<s.length;){const A=s[E];if(!A||Oe(A))break;y.push(A),E+=1}const N=J(y);if(y[0]&&!i.includes(y[0])){const A=this.#a(),I=F(N,A);throw new D(N,I)}}let v;try{v=fn([null,...i],[...s])}catch(y){if(y instanceof Error&&y.name==="INVALID_COMMAND"&&"command"in y){const E=y.command,N=this.#a(),A=F(E,N);throw new D(E,A)}throw y}v.command&&(g=[v.command],r=v.argv)}if(!g)if(this.#s)g=[this.#s];else{const v=this.#a();throw new D("",v)}const h=J(g),O=this.#i.get(h);let b;if(O){if(b=this.#p.get(h),!b||J(O)!==h){const v=this.#a(),y=F(h,v);throw new D(h,y)}}else{const v=g[g.length-1];if(b=v?this.#n.get(v):void 0,!b){const y=this.#a(),E=F(h,y);throw new D(h,E)}}if(typeof b.execute!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),a?ie(1):void 0;const w=r,{commandArgs:P,toolbox:f}=this.#O(b,w,o,h),m=this.getPluginManager();try{!this.#f&&m.hasPlugins()&&(await m.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await m.executeLifecycle("execute",f),await m.executeLifecycle("beforeCommand",f);let v;if(P.global?.help){const y=this.#n.get("help");if(!y)throw new k("Help command not found","COMMAND_NOT_FOUND");v=await B(y,f,P)}else if(P.global?.version||P.global?.V){const y=this.#n.get("version");if(!y)throw new k("Version command not found","COMMAND_NOT_FOUND");v=await B(y,f,P)}else v=await B(b,f,P);return await m.executeLifecycle("afterCommand",f,v),a?ie(0):void 0}catch(v){throw await m.executeErrorHandlers(v,f),v}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:a=[],...o}=n;ke(e,"Command name");const i=e.split(" ").filter(Boolean),u=J(i),s=this.#i.get(u)?this.#p.get(u):this.#n.get(e);if(!s){const l=this.#a(),d=F(u||e,l);throw new D(e,d)}if(typeof s.execute!="function")throw new k(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const g=[...Je(a)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:r,toolbox:p}=this.#O(s,g,o,u||e),c=this.getPluginManager();try{!this.#f&&c.hasPlugins()&&(await c.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await c.executeLifecycle("execute",p),await c.executeLifecycle("beforeCommand",p);let l;if(r.global?.help){const d=this.#n.get("help");if(!d)throw new k("Help command not found","COMMAND_NOT_FOUND");l=await B(d,p,r)}else if(r.global?.version||r.global?.V){const d=this.#n.get("version");if(!d)throw new k("Version command not found","COMMAND_NOT_FOUND");l=await B(d,p,r)}else l=await B(s,p,r);return await c.executeLifecycle("afterCommand",p,l),l}catch(l){throw await c.executeErrorHandlers(l,p),l}}}export{wo as Cli};
@@ -0,0 +1,76 @@
1
+ var z=Object.defineProperty;var s=(e,r)=>z(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{k as Rr,N as Mr,P as Vr,G as Ur}from"./renderError-ZMlMvw1N-eVUSdl6c.js";import{p as zr,V as Br}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";const K=B(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Y=s(e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[r,t]=b.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return b.getBuiltinModule(e)}return K(e)},"__cjs_getBuiltinModule"),{createRequire:H}=Y("node:module");var X=Object.defineProperty,W=s((e,r)=>X(e,"name",{value:r,configurable:!0}),"s$6"),G=Object.defineProperty,Q=W((e,r)=>G(e,"name",{value:r,configurable:!0}),"o"),Z=Object.defineProperty,k=Q((e,r)=>Z(e,"name",{value:r,configurable:!0}),"l");const T=k((e,r)=>{let t=0,n=r.length-2;for(;t<n;){const o=t+(n-t>>1);if(e<r[o])n=o-1;else if(e>=r[o+1])t=o+1;else{t=o;break}}return t},"binarySearch"),ee=k(e=>e.split(/\n|\r(?!\n)/).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),"getLineStartIndexes"),Pr=k((e,r,t)=>{const n=t?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!n&&(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){const a=ee(e),i=T(r,a);return{column:r-a[i]+1,line:i+1}}const o=T(r,e);return{column:r-e[o]+1,line:o+1}},"indexToLineColumn");var re=Object.defineProperty,te=s((e,r)=>re(e,"name",{value:r,configurable:!0}),"t$5"),ne=Object.defineProperty,oe=te((e,r)=>ne(e,"name",{value:r,configurable:!0}),"n"),ae=Object.defineProperty,ie=oe((e,r)=>ae(e,"name",{value:r,configurable:!0}),"t");const wr=ie(({applicationType:e,error:r,file:t})=>`You are a very skilled ${t.language} programmer.
2
+
3
+ ${e?`You are working on a ${e} application.`:""}
4
+
5
+ Use the following context to find a possible fix for the exception message at the end. Limit your answer to 4 or 5 sentences. Also include a few links to documentation that might help.
6
+
7
+ Use this format in your answer, make sure links are json:
8
+
9
+ FIX
10
+ insert the possible fix here
11
+ ENDFIX
12
+ LINKS
13
+ {"title": "Title link 1", "url": "URL link 1"}
14
+ {"title": "Title link 2", "url": "URL link 2"}
15
+ ENDLINKS
16
+ ---
17
+
18
+ Here comes the context and the exception message:
19
+
20
+ Line: ${t.line}
21
+
22
+ File:
23
+ ${t.file}
24
+
25
+ Snippet including line numbers:
26
+ ${t.snippet}
27
+
28
+ Exception class:
29
+ ${r.name}
30
+
31
+ Exception message:
32
+ ${r.message}`,"aiPrompt");var se=Object.defineProperty,ue=s((e,r)=>se(e,"name",{value:r,configurable:!0}),"o$5"),ce=Object.defineProperty,le=ue((e,r)=>ce(e,"name",{value:r,configurable:!0}),"i"),fe=Object.defineProperty,_=le((e,r)=>fe(e,"name",{value:r,configurable:!0}),"i");const I=_((e,r,t)=>{const n=t.indexOf(e);if(n===-1)return"";const o=n+e.length,a=t.indexOf(r,o);return a===-1?"":t.slice(o,a).trim()},"between"),xr=_(e=>{const r=I("FIX","ENDFIX",e);if(!r)return["No solution found.",'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',`"${e}"`].join("</br></br>");const t=I("LINKS","ENDLINKS",e).split(`
33
+ `).map(n=>JSON.parse(n));return`${r.replaceAll(/"([^"]*)"(\s|\.)/g,"<code>$1</code> ")}
34
+
35
+ ## Links
36
+
37
+ ${t.map(n=>`- <a href="${n.url}" target="_blank" rel="noopener noreferrer">${n.title}</a>`).join(`
38
+ `)}
39
+
40
+ --------------------
41
+ This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`},"aiSolutionResponse");var pe=Object.defineProperty,me=s((e,r)=>pe(e,"name",{value:r,configurable:!0}),"r$2"),de=Object.defineProperty,be=me((e,r)=>de(e,"name",{value:r,configurable:!0}),"r"),ge=Object.defineProperty,ye=be((e,r)=>ge(e,"name",{value:r,configurable:!0}),"i");const kr={handle:ye(async e=>{if(!(e.hint===void 0||e.hint===null)){if(typeof e.hint=="string"&&e.hint!=="")return{body:e.hint};if(typeof e.hint=="object"&&typeof e.hint.body=="string")return e.hint;if(Array.isArray(e.hint))return{body:e.hint.join(`
42
+ `)}}},"handle"),name:"errorHint",priority:1};var he=Object.defineProperty,ve=s((e,r)=>he(e,"name",{value:r,configurable:!0}),"m$1"),$e=Object.defineProperty,je=ve((e,r)=>$e(e,"name",{value:r,configurable:!0}),"m"),Oe=Object.defineProperty,u=je((e,r)=>Oe(e,"name",{value:r,configurable:!0}),"t");const Se=u(e=>`\`\`\`
43
+ ${e.trim()}
44
+ \`\`\``,"code"),$=u(e=>`\`\`\`bash
45
+ ${e.trim()}
46
+ \`\`\``,"bash"),j=u(e=>`\`\`\`ts
47
+ ${e.trim()}
48
+ \`\`\``,"ts"),Ee=u(e=>`\`\`\`js
49
+ ${e.trim()}
50
+ \`\`\``,"js"),p=u((e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},"has"),Pe=[{name:"esm-cjs-interop",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(p(r,"err_require_esm","cannot use import statement outside a module","must use import to load es module","require() of es module","does not provide an export named"))return{md:["Your project or a dependency may be mixing CommonJS and ES Modules.","","Try:","- Ensure package.json has the correct `type` (either `module` or `commonjs`).","- Use dynamic `import()` when requiring ESM from CJS.","- Prefer ESM-compatible entrypoints from dependencies.","- In Node, align `module` resolution with your bundler config.","","Check Node resolution:",$(`node -v
51
+ cat package.json | jq .type`),"","Example dynamic import in CJS:",Ee("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
52
+ `),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(p(r,"default export not found","has no default export","does not provide an export named 'default'","is not exported from"))return{md:["Verify your import/export shapes.","","Default export example:",j(`export default function Component() {}
53
+ // import Component from './file'`),"","Named export example:",j(`export function Component() {}
54
+ // import { Component } from './file'`)].join(`
55
+ `),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(p(r,"eaddrinuse","address already in use","listen eaddrinuse"))return{md:["Another process is using the port.","","Change the port or stop the other process.","","On macOS/Linux:",$(`lsof -i :3000
56
+ kill -9 <PID>`),"","On Windows (PowerShell):",$(`netstat -ano | findstr :3000
57
+ taskkill /PID <PID> /F`)].join(`
58
+ `),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:u((e,r)=>{const t=(e?.message||String(e||"")).toString();if(p(t,"enoent","module not found","cannot find module"))return{md:["Check the import path and filename case (Linux/macOS are case-sensitive).","If using TS path aliases, verify `tsconfig.paths` and bundler aliases.","","Current file:",Se(`${r.file}:${r.line}`)].join(`
59
+ `),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(p(r,"ts2307","cannot find module")||r.includes("TS2307"))return{md:["If you use path aliases, align TS `paths` with Vite/Webpack resolve aliases.","Ensure file extensions are correct and included in resolver.","","tsconfig.json excerpt:",j(`{
60
+ "compilerOptions": {
61
+ "baseUrl": ".",
62
+ "paths": { "@/*": ["src/*"] }
63
+ }
64
+ }`)].join(`
65
+ `),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(p(r,"enotfound","getaddrinfo enotfound","dns","fetch failed","ecconnrefused","econnrefused"))return{md:["The host may be unreachable or misconfigured.","","Try:","- Verify the hostname and protocol (http/https).","- Check VPN/proxy and firewall.","- Confirm the service is running and listening on the expected port.","",$(`ping <host>
66
+ nslookup <host>
67
+ curl -v http://<host>:<port>`)].join(`
68
+ `),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(p(r,"cannot read properties of undefined","reading '"))return{md:["A variable or function returned `undefined`.","","Mitigations:","- Add nullish checks before property access.","- Validate function return values and input props/state.","",j("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
69
+ `),title:"Accessing property of undefined"}},"test")}],Nr={handle:u(async(e,r)=>{try{const t=Pe.map(o=>({match:o.test(e,r),rule:o})).filter(o=>!!o.match);if(t.length===0)return;const n=t.toSorted((o,a)=>(o.match.priority||0)-(a.match.priority||0)).map(o=>`#### ${o.match.title}
70
+
71
+ ${o.match.md}`).join(`
72
+
73
+ ---
74
+
75
+ `);return n===""?void 0:{body:n,header:"### Potential fixes detected"}}catch{return}},"handle"),name:"ruleBasedHints",priority:0};var we=Object.defineProperty,D=s((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$3"),xe=Object.defineProperty,J=D((e,r)=>xe(e,"name",{value:r,configurable:!0}),"t"),ke=Object.defineProperty,Ne=J((e,r)=>ke(e,"name",{value:r,configurable:!0}),"s");let m=class extends Error{static{s(this,"i")}static{D(this,"c")}static{J(this,"e")}static{Ne(this,"NonError")}constructor(r){super(r),this.name="NonError"}};var Ae=Object.defineProperty,Te=s((e,r)=>Ae(e,"name",{value:r,configurable:!0}),"a$2"),Ie=Object.defineProperty,Ce=Te((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"a"),_e=Object.defineProperty,De=Ce((e,r)=>_e(e,"name",{value:r,configurable:!0}),"e");const Tr=De(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace");var Je=Object.defineProperty,L=s((e,r)=>Je(e,"name",{value:r,configurable:!0}),"r"),Le=Object.defineProperty,F=L((e,r)=>Le(e,"name",{value:r,configurable:!0}),"o"),Fe=Object.defineProperty,Re=F((e,r)=>Fe(e,"name",{value:r,configurable:!0}),"e");function d(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}s(d,"o$1");L(d,"i");F(d,"r");Re(d,"isPlainObject");var Me=Object.defineProperty,Ve=s((e,r)=>Me(e,"name",{value:r,configurable:!0}),"E$1"),Ue=Object.defineProperty,qe=Ve((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"E"),ze=Object.defineProperty,S=qe((e,r)=>ze(e,"name",{value:r,configurable:!0}),"n");const y=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&y.set("AggregateError",AggregateError);const Ir=S((e,r)=>{let t;try{t=new e}catch(o){throw new Error(`The error constructor "${e.name}" is not compatible`,{cause:o})}const n=r??t.name;if(y.has(n))throw new Error(`The error constructor "${n}" is already known.`);y.set(n,e)},"addKnownErrorConstructor");S(()=>new Map(y),"getKnownErrorConstructors");const R=S(e=>y.get(e),"getErrorConstructor"),E=S(e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(R(e.name)!==void 0||e.name==="Error"),"isErrorLike");var Be=Object.defineProperty,Ke=s((e,r)=>Be(e,"name",{value:r,configurable:!0}),"b$2"),Ye=Object.defineProperty,He=Ke((e,r)=>Ye(e,"name",{value:r,configurable:!0}),"d"),Xe=Object.defineProperty,c=He((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"s");const We={maxDepth:Number.POSITIVE_INFINITY},M=c((e,r,t=0)=>E(e)?N(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new m(JSON.stringify(e)):new m(JSON.stringify(e)),"deserializePlainObject"),Ge=c((e,r,t,n,o)=>{const a=r.map(i=>h(i,n,o+1));return new e(a,t)},"reconstructAggregateError"),N=c((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new m(JSON.stringify(e));const{cause:n,errors:o,message:a,name:i,stack:l,...P}=e,A=R(i)||Error,f=i==="AggregateError"&&Array.isArray(o)?Ge(A,o,a,r,t):new A(a);return!f.name&&i&&(f.name=i),a!==void 0&&(f.message=a),l&&(f.stack=l),Qe(f,P,n,i,r,t),n!==void 0&&(f.cause=h(n,r,t+1)),Ze(f,e),f},"reconstructError"),h=c((e,r,t)=>{if(d(e)){if(E(e))return M(e,r,t);const n={};for(const[o,a]of Object.entries(e))n[o]=h(a,r,t+1);return n}return Array.isArray(e)?e.map(n=>h(n,r,t)):e},"deserializeValue"),Qe=c((e,r,t,n,o,a)=>{const i=e;for(const[l,P]of Object.entries(r))if(!(l==="cause"&&t!==void 0)){if(l==="errors"&&n==="AggregateError")continue;i[l]=h(P,o,a+1)}},"restoreErrorProperties"),Ze=c((e,r)=>{const t=new Set(["message","name","stack"]);for(const n of Object.keys(r))t.add(n);for(const n of t)if(n in e){const o=Object.getOwnPropertyDescriptor(e,n);o&&!o.enumerable&&Object.defineProperty(e,n,{...o,enumerable:!0})}},"makePropertiesEnumerable"),C=c(e=>new m(JSON.stringify(e)),"handlePrimitive"),er=c(e=>new m(JSON.stringify(e)),"handleArray"),rr=c((e,r)=>E(e)?N(e,r,0):M(e,r),"handlePlainObject"),Cr=c((e,r={})=>{const t={...We,...r};return e instanceof Error?e:e===null?C(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?C(e):Array.isArray(e)?er(e):E(e)?N(e,t,0):d(e)?rr(e,t):new m(JSON.stringify(e))},"deserialize");var tr=Object.defineProperty,nr=s((e,r)=>tr(e,"name",{value:r,configurable:!0}),"a"),or=Object.defineProperty,V=nr((e,r)=>or(e,"name",{value:r,configurable:!0}),"n");const ar=H(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ir=V(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[r,t]=g.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return g.getBuiltinModule(e)}return ar(e)},"__cjs_getBuiltinModule"),{inspect:sr}=ir("node:util");var ur=Object.defineProperty,cr=V((e,r)=>ur(e,"name",{value:r,configurable:!0}),"a");const _r=cr(e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${sr(e)}`);break}if(t.push(n),r.add(n),!n.cause)break;n=n.cause}return t},"getErrorCauses");var lr=Object.defineProperty,fr=s((e,r)=>lr(e,"name",{value:r,configurable:!0}),"o"),pr=Object.defineProperty,mr=fr((e,r)=>pr(e,"name",{value:r,configurable:!0}),"n"),dr=Object.defineProperty,U=mr((e,r)=>dr(e,"name",{value:r,configurable:!0}),"s");const br=U(e=>{const r=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",t=e.file??"<unknown>",n=e.line??0,o=e.column??0;return r.trim()?` at ${r}(${t}:${n}:${o})`:` at ${t}:${n}:${o}`},"formatStackFrameLine"),Dr=U((e,r)=>{const t=[];if(r?.header&&(r.header.name||r.header.message)){const n=String(r.header.name||"Error"),o=String(r.header.message||"");t.push(`${n}${o?": ":""}${o}`)}for(const n of e)t.push(br(n));return t.join(`
76
+ `)},"formatStacktrace");var gr=Object.defineProperty,yr=s((e,r)=>gr(e,"name",{value:r,configurable:!0}),"b"),hr=Object.defineProperty,vr=yr((e,r)=>hr(e,"name",{value:r,configurable:!0}),"f");const $r=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}});var jr=Object.defineProperty,v=vr((e,r)=>jr(e,"name",{value:r,configurable:!0}),"u");const w=new WeakSet,q=v(e=>{if(!e||typeof e!="object")return;const r=Object.getOwnPropertyNames(e);for(const t of r){const n=Object.getOwnPropertyDescriptor(e,t);n&&(n.enumerable||Object.defineProperty(e,t,{...n,enumerable:!0}),n.value&&typeof n.value=="object"&&!Array.isArray(n.value)&&(Object.getPrototypeOf(n.value)===Object.prototype||Object.getPrototypeOf(n.value)===null)&&q(n.value))}},"makePropertiesEnumerable"),Or=v(e=>{w.add(e);const r=e.toJSON();return w.delete(e),r&&typeof r=="object"&&Object.isExtensible(r)&&q(r),r},"toJSON"),x=v((e,r,t,n)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(t+=1,O(e,n,r,t));if(n.useToJSON&&typeof e.toJSON=="function")return e.toJSON();if(typeof e=="object"&&e instanceof Date)return e.toISOString();if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${e}n`;if(d(e)){if(n.maxDepth!==void 0&&n.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=n.maxDepth)return{};t+=1;const o={};for(const a in e)o[a]=x(e[a],r,t,n);return o}try{return e}catch{return"[Not Available]"}},"serializeValue"),O=v((e,r,t,n)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!w.has(e))return Or(e);const o=Object.create($r);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,writable:!0}),Object.defineProperty(o,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(o,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const a=[];for(const i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(i))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;a.push(O(i,r,t,n))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:a,writable:!0})}if(e.cause!==void 0&&e.cause!==null)if(e.cause instanceof Error)t.has(e.cause)?Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:O(e.cause,r,t,n),writable:!0});else{const a=x(e.cause,t,n,r);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:a,writable:!0})}for(const a in e){if(a==="name"||a==="message"||a==="stack"||a==="cause"||a==="errors")continue;const i=e[a],l=x(i,t,n,r);Object.defineProperty(o,a,{configurable:!0,enumerable:!0,value:l,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const a of r.exclude)try{delete o[a]}catch{}return o},"_serialize"),Jr=v((e,r={})=>O(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0),"serialize");export{Rr as CODE_FRAME_POINTER,m as NonError,zr as VisulimaError,Ir as addKnownErrorConstructor,wr as aiPrompt,xr as aiSolutionResponse,Tr as captureRawStackTrace,Mr as codeFrame,Cr as deserializeError,kr as errorHintFinder,br as formatStackFrameLine,Dr as formatStacktrace,_r as getErrorCauses,Pr as indexToLineColumn,E as isErrorLike,Br as isVisulimaError,Vr as parseStacktrace,Ur as renderError,Nr as ruleBasedFinder,Jr as serializeError};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var t=(r,e)=>s(r,"name",{value:e,configurable:!0});import{p as a}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";var i=Object.defineProperty,n=t((r,e)=>i(r,"name",{value:e,configurable:!0}),"e");class u extends a{static{t(this,"c")}static{n(this,"CerebroError")}code;context;constructor(e,o,c){super({message:e,name:"CerebroError"}),this.code=o,this.context=c}}export{u as c};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var s=(e,t)=>m(e,"name",{value:t,configurable:!0});var p=Object.defineProperty,i=s((e,t)=>p(e,"name",{value:t,configurable:!0}),"s"),E=Object.defineProperty,r=i((e,t)=>E(e,"name",{value:t,configurable:!0}),"i"),f=Object.defineProperty,a=r((e,t)=>f(e,"name",{value:t,configurable:!0}),"t");const b=a(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class g extends Error{static{s(this,"p")}static{i(this,"V")}static{r(this,"VisulimaError")}static{a(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:o,location:c,message:n,name:l,stack:u,title:h}){super(n,{cause:t}),this.title=h,this.name=l,this.stack=u??this.stack,this.loc=c,this.hint=o}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{b as V,g as p};
@@ -0,0 +1,24 @@
1
+ var Y=Object.defineProperty;var N=(r,e)=>Y(r,"name",{value:e,configurable:!0});import{createRequire as K}from"node:module";const Q=K(import.meta.url),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=N(r=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[e,t]=S.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return S.getBuiltinModule(r)}return Q(r)},"__cjs_getBuiltinModule"),{createRequire:Z}=X("node:module");var ee=Object.defineProperty,re=N((r,e)=>ee(r,"name",{value:e,configurable:!0}),"A$2"),te=Object.defineProperty,A=re((r,e)=>te(r,"name",{value:e,configurable:!0}),"v"),ie=Object.defineProperty,oe=A((r,e)=>ie(r,"name",{value:e,configurable:!0}),"r$1");const ne=oe(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
+ `),"normalizeLF"),se=globalThis.process||Object.create(null),M={versions:{}},_=new Proxy(se,{get(r,e){if(e in r)return r[e];if(e in M)return M[e]}});var ae=Object.defineProperty,le=A((r,e)=>ae(r,"name",{value:e,configurable:!0}),"b");const ce=le((r,e,t,i)=>{const o={column:0,line:-1,...r.start},n={...o,...r.end},s=o.line,a=o.column,c=n.line,u=n.column;let l=Math.max(s-(t+1),0),g=Math.min(e.length,c+i);s===-1&&(l=0),c===-1&&(g=e.length);const w=c-s,m={};if(w)for(let d=0;d<=w;d++){const v=d+s;if(!a)m[v]=!0;else if(d===0){const $=e[v-1]?.length;m[v]=[a,($??0)-a+1]}else if(d===w)m[v]=[0,u];else{const $=e[v-d]?.length;m[v]=[0,$]}}else a===u?m[s]=a?[a,0]:!0:m[s]=[a,(u??0)-(a??0)];return{end:g,markerLines:m,start:l}},"getMarkerLines");var ue=Object.defineProperty,E=A((r,e)=>ue(r,"name",{value:e,configurable:!0}),"o");const de=_.platform==="win32"&&!_.env?.WT_SESSION?">":"❯",fe=E((r,e,t)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:E(d=>d,"gutter"),marker:E(d=>d,"marker"),message:E(d=>d,"message"),...t?.color}},o=e.start&&typeof e.start.column=="number";let n=ne(r).split(`
3
+ `);typeof i?.tabWidth=="number"&&(n=n.map(d=>d.replaceAll(" "," ".repeat(i.tabWidth))));const{end:s,markerLines:a,start:c}=ce(e,n,i.linesAbove,i.linesBelow),u=String(s).length,{gutter:l,marker:g,message:w}=i.color;let m=n.slice(c,s).map((d,v)=>{const $=c+1+v,k=a[$],z=` ${$}`.slice(-u),D=!a[$+1],j=` ${z}${i.showGutter?" |":""}`;if(k){let O="";if(Array.isArray(k)){const U=d.replaceAll(/[^\t]/g," ").slice(0,Math.max(k[0]-1,0)),H=k[1]||1;O=[`
4
+ `,i.prefix+l(j.replaceAll(/\d/g," "))," ",U,g("^").repeat(H)].join(""),D&&i.message&&(O+=` ${w(i.message)}`)}return[i.prefix+g(de),l(j),d.length>0?` ${d}`:"",O].join("")}return`${i.prefix} ${l(j)}${d.length>0?` ${d}`:""}`}).join(`
5
+ `);return i.message&&!o&&(m=`${i.prefix+" ".repeat(u+1)+i.message}
6
+ ${m}`),m},"codeFrame");var me=Object.defineProperty,pe=N((r,e)=>me(r,"name",{value:e,configurable:!0}),"v$1"),ve=Object.defineProperty,ge=pe((r,e)=>ve(r,"name",{value:e,configurable:!0}),"v"),$e=Object.defineProperty,p=ge((r,e)=>$e(r,"name",{value:e,configurable:!0}),"u");const h=p((r,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),b="<unknown>",he=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,be=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ye=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,xe=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,we=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Ne=/in\s(.*)\s\(at\s(.+)\)\sat/,Se=/^(?:.*@)?(.*):(\d+):(\d+)$/,ke=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ee=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,je=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,T=/\(error: (.*)\)/,B=p((r,e)=>{const t=r.includes("safari-extension"),i=r.includes("safari-web-extension");return t||i?[r.includes("@")?r.split("@")[0]:b,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),C=p((r,e)=>{const t=ye.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),Oe=p(r=>{const e=Ne.exec(r);if(e){h(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]||b,raw:r,type:void 0}}const t=we.exec(r);if(t){h(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(/at\s/,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]||b,raw:r,type:r.startsWith("internal")?"internal":void 0};return C(i,`${t[2]}:${t[3]}:${t[4]}`),i}},"parseNode"),Ae=p(r=>{const e=he.exec(r);if(e){h(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,n;if(i){const u=be.exec(r);if(u){const l=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(u[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):u[2]&&(e[2]=u[1]),u[2]&&(o={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const l=xe.exec(r);l&&(n={column:l[5]?+l[5]:void 0,file:l[3],line:l[4]?+l[4]:void 0},o={column:l[8]?+l[8]:void 0,file:l[2],line:l[7]?+l[7]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[s,a]=B(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):b,e[2]),c={column:e[4]?+e[4]:void 0,evalOrigin:o,file:a,line:e[3]?+e[3]:void 0,methodName:s,raw:r,type:i?"eval":t?"native":void 0};return n?(c.column=n.column,c.file=n.file,c.line=n.line):C(c,`${a}:${e[3]}:${e[4]}`),c}},"parseChromium"),Le=p((r,e)=>{const t=ke.exec(r);if(t){h(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i=t[3]?.includes(" > eval"),o=i&&t[3]&&Ee.exec(t[3]);let n;i&&o&&(t[3]=o[1],n={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:r,type:"eval"},t[4]=o[2]);const[s,a]=B(t[1]?t[1].replace(/^Anonymous function$/,"<anonymous>"):b,t[3]);let c;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?c=e.column:!i&&t[5]&&(c=+t[5]);let u;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?u=e.line:t[4]&&(u=+t[4]),{column:c,evalOrigin:n,file:a,line:u,methodName:s,raw:r,type:i?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Pe=p((r,e)=>{const t=je.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return h(`parse firefox error stack line: "${r}"`,`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:e?.column??void 0,file:t[2],line:t[3]?+t[3]:e?.line??void 0,methodName:t[1]||b,raw:r,type:void 0}},"parseFirefox"),Me=p(r=>{const e=Se.exec(r);if(e)return h(`parse react android native error stack line: "${r}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:b,raw:r,type:void 0}},"parseReactAndroidNative"),W=p((r,{filter:e,frameLimit:t=50}={})=>{let i=(r.stacktrace??r.stack??"").split(`
7
+ `).map(o=>(T.test(o)?o.replace(T,"$1"):o).replace(/^\s+|\s+$/g,"")).filter(o=>!/\S*(?:Error: |AggregateError:)/.test(o)&&o!=="eval code");return e&&(i=i.filter(o=>e(o))),i=i.slice(0,t),i.reduce((o,n,s)=>{if(!n||n.length>1024)return o;let a;if(/^\s*in\s.*/.test(n))a=Oe(n);else if(/^.*?\s*at\s.*/.test(n))a=Ae(n);else if(/^.*?\s*@.*|\[native code\]/.test(n)){let c;s===0&&(r.columnNumber||r.lineNumber?c={column:r.columnNumber,line:r.lineNumber,type:"firefox"}:(r.line||r.column)&&(c={column:r.column,line:r.line,type:"safari"})),a=Pe(n,c)||Le(n,c)}else a=Me(n);return a?o.push(a):h(`parse error stack line: "${n}"`,"not parser found"),o},[])},"parseStacktrace");var _e=Object.defineProperty,Te=N((r,e)=>_e(r,"name",{value:e,configurable:!0}),"p"),Be=Object.defineProperty,G=Te((r,e)=>Be(r,"name",{value:e,configurable:!0}),"m");const Ce=Z(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,L=G(r=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(r)}return Ce(r)},"__cjs_getBuiltinModule"),{existsSync:We,readFileSync:Ge}=L("node:fs"),{relative:Re}=L("node:path"),{cwd:Ve}=y,{fileURLToPath:Fe}=L("node:url");var Ie=Object.defineProperty,f=G((r,e)=>Ie(r,"name",{value:e,configurable:!0}),"o");const x=f((r,e,t)=>t===0?r.toString():e===" "?r+" ".repeat(t):r+" ".repeat(e*t),"getPrefix"),Je=f((r,e)=>{const t=r.replace("async file:","file:");return Re(e,t.startsWith("file:")?Fe(t):t)},"getRelativePath"),qe=f((r,e,t)=>{if(e)return t.title(r.message);const i=r.message?`: ${r.message}`:"";return t.title(r.name+i)},"getTitleText"),R=f((r,{color:e,hideErrorTitle:t,indentation:i,prefix:o},n)=>`${x(o,i,n)}${qe(r,t,e)}
8
+ `,"getMessage"),V=f((r,{color:e,indentation:t,prefix:i},o)=>{if(r.hint===void 0)return;const n=x(i,t,o);let s="";if(Array.isArray(r.hint))for(const a of r.hint)s+=`${(n+a).toString()}
9
+ `;else s+=n+r.hint;return e.hint(s)},"getHint"),P=f((r,{color:e,cwd:t,displayShortPath:i,indentation:o,prefix:n},s=0)=>{const a=i?Je(r.file,t):r.file,{fileLine:c,method:u}=e;return`${x(n,o,s)}at ${r.methodName?`${u(r.methodName)} `:""}${c(a)}:${c(r.line?.toString()??"")}`.toString()},"getMainFrame"),F=f((r,{color:e,indentation:t,linesAbove:i,linesBelow:o,prefix:n,showGutter:s,showLineNumbers:a,tabWidth:c},u)=>{if(r.file===void 0)return;const l=r.file.replace("file://","");if(!We(l))return;const g=Ge(l,"utf8");return fe(g,{start:{column:r.column,line:r.line}},{color:e,linesAbove:i,linesBelow:o,prefix:x(n,t,u),showGutter:s,showLineNumbers:a,tabWidth:c})},"getCode"),I=f((r,e,t)=>{if(r.errors.length===0)return;let i=`${x(e.prefix,e.indentation,t)}Errors:
10
+
11
+ `,o=!0;for(const n of r.errors)o?o=!1:i+=`
12
+
13
+ `,i+=q(n,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},t+1);return`
14
+ ${i}`},"getErrors"),J=f((r,e,t)=>{let i=`${x(e.prefix,e.indentation,t)}Caused by:
15
+
16
+ `;const o=r.cause;i+=R(o,e,t);const n=W(o).shift(),s=V(o,e,t);if(s&&(i+=`${s}
17
+ `),n&&(i+=P(n,e,t),!e.hideErrorCauseCodeView)){const a=F(n,e,t);a!==void 0&&(i+=`
18
+ ${a}`)}if(o.cause)i+=`
19
+ ${J(o,e,t+1)}`;else if(o instanceof AggregateError){const a=I(o,e,t);a!==void 0&&(i+=`
20
+ ${a}`)}return`
21
+ ${i}`},"getCause"),ze=f((r,e)=>(r.length>0?`
22
+ `:"")+r.map(t=>P(t,e)).join(`
23
+ `),"getStacktrace"),q=f((r,e,t)=>{const i={cwd:Ve(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:f(s=>s,"fileLine"),gutter:f(s=>s,"gutter"),hint:f(s=>s,"hint"),marker:f(s=>s,"marker"),message:f(s=>s,"message"),method:f(s=>s,"method"),title:f(s=>s,"title"),...e.color}},o=W(r,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),n=o.shift();return[e.hideMessage?void 0:R(r,i,t),V(r,i,t),n?P(n,i,t):void 0,n&&!i.hideErrorCodeView?F(n,i,t):void 0,r instanceof AggregateError?I(r,i,t):void 0,r.cause===void 0?void 0:J(r,i,t),o.length>0?ze(o,i):void 0].filter(Boolean).join(`
24
+ `).replaceAll("\\","/")},"internalRenderError"),He=f((r,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return q(r,e,0)},"renderError");export{He as G,fe as N,W as P,de as k};
@@ -1,24 +1 @@
1
- var U=Object.defineProperty;var x=(r,e)=>U(r,"name",{value:e,configurable:!0});import{createRequire as X}from"node:module";import{e as Q}from"../packem_shared/runtime-process-G-n-wOub.js";const Y=X(import.meta.url),N=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,K=x(r=>{if(typeof N<"u"&&N.versions&&N.versions.node){const[e,t]=N.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return N.getBuiltinModule(r)}return Y(r)},"__cjs_getBuiltinModule"),{createRequire:Z}=K("node:module");var ee=Object.defineProperty,w=x((r,e)=>ee(r,"name",{value:e,configurable:!0}),"m$2");const re=w(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
- `),"normalizeLF"),te=globalThis.process||Object.create(null),O={versions:{}},_=new Proxy(te,{get(r,e){if(e in r)return r[e];if(e in O)return O[e]}}),ie=w((r,e,t,i)=>{const o={column:0,line:-1,...r.start},s={...o,...r.end},n=o.line,a=o.column,c=s.line,d=s.column;let l=Math.max(n-(t+1),0),p=Math.min(e.length,c+i);n===-1&&(l=0),c===-1&&(p=e.length);const S=c-n,m={};if(S)for(let f=0;f<=S;f++){const v=f+n;if(!a)m[v]=!0;else if(f===0){const h=e[v-1]?.length;m[v]=[a,(h??0)-a+1]}else if(f===S)m[v]=[0,d];else{const h=e[v-f]?.length;m[v]=[0,h]}}else a===d?m[n]=a?[a,0]:!0:m[n]=[a,(d??0)-(a??0)];return{end:p,markerLines:m,start:l}},"getMarkerLines"),oe=_.platform==="win32"&&!_.env?.WT_SESSION?">":"❯",se=w((r,e,t)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:w(f=>f,"gutter"),marker:w(f=>f,"marker"),message:w(f=>f,"message"),...t?.color}},o=e.start&&typeof e.start.column=="number";let s=re(r).split(`
3
- `);typeof i?.tabWidth=="number"&&(s=s.map(f=>f.replaceAll(" "," ".repeat(i.tabWidth))));const{end:n,markerLines:a,start:c}=ie(e,s,i.linesAbove,i.linesBelow),d=String(n).length,{gutter:l,marker:p,message:S}=i.color;let m=s.slice(c,n).map((f,v)=>{const h=c+1+v,k=a[h],q=` ${h}`.slice(-d),z=!a[h+1],A=` ${q}${i.showGutter?" |":""}`;if(k){let L="";if(Array.isArray(k)){const D=f.replaceAll(/[^\t]/g," ").slice(0,Math.max(k[0]-1,0)),H=k[1]||1;L=[`
4
- `,i.prefix+l(A.replaceAll(/\d/g," "))," ",D,p("^").repeat(H)].join(""),z&&i.message&&(L+=` ${S(i.message)}`)}return[i.prefix+p(oe),l(A),f.length>0?` ${f}`:"",L].join("")}return`${i.prefix} ${l(A)}${f.length>0?` ${f}`:""}`}).join(`
5
- `);return i.message&&!o&&(m=`${i.prefix+" ".repeat(d+1)+i.message}
6
- ${m}`),m},"codeFrame");var ne=Object.defineProperty,g=x((r,e)=>ne(r,"name",{value:e,configurable:!0}),"d$1");const $=g((r,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),y="<unknown>",ae=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,le=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ce=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,de=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,fe=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,ue=/in\s(.*)\s\(at\s(.+)\)\sat/,me=/^(?:.*@)?(.*):(\d+):(\d+)$/,pe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ge=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ve=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,T=/\(error: (.*)\)/,P=g((r,e)=>{const t=r.includes("safari-extension"),i=r.includes("safari-web-extension");return t||i?[r.includes("@")?r.split("@")[0]:y,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),B=g((r,e)=>{const t=ce.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),he=g(r=>{const e=ue.exec(r);if(e){$(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]||y,raw:r,type:void 0}}const t=fe.exec(r);if(t){$(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(/at\s/,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]||y,raw:r,type:r.startsWith("internal")?"internal":void 0};return B(i,`${t[2]}:${t[3]}:${t[4]}`),i}},"parseNode"),$e=g(r=>{const e=ae.exec(r);if(e){$(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,s;if(i){const d=le.exec(r);if(d){const l=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(d[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):d[2]&&(e[2]=d[1]),d[2]&&(o={column:d[4]?+d[4]:void 0,file:d[2],line:d[3]?+d[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const l=de.exec(r);l&&(s={column:l[5]?+l[5]:void 0,file:l[3],line:l[4]?+l[4]:void 0},o={column:l[8]?+l[8]:void 0,file:l[2],line:l[7]?+l[7]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[n,a]=P(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):y,e[2]),c={column:e[4]?+e[4]:void 0,evalOrigin:o,file:a,line:e[3]?+e[3]:void 0,methodName:n,raw:r,type:i?"eval":t?"native":void 0};return s?(c.column=s.column,c.file=s.file,c.line=s.line):B(c,`${a}:${e[3]}:${e[4]}`),c}},"parseChromium"),ye=g((r,e)=>{const t=pe.exec(r);if(t){$(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i=t[3]?.includes(" > eval"),o=i&&t[3]&&ge.exec(t[3]);let s;i&&o&&(t[3]=o[1],s={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:r,type:"eval"},t[4]=o[2]);const[n,a]=P(t[1]?t[1].replace(/^Anonymous function$/,"<anonymous>"):y,t[3]);let c;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?c=e.column:!i&&t[5]&&(c=+t[5]);let d;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?d=e.line:t[4]&&(d=+t[4]),{column:c,evalOrigin:s,file:a,line:d,methodName:n,raw:r,type:i?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),xe=g((r,e)=>{const t=ve.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return $(`parse firefox error stack line: "${r}"`,`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:e?.column??void 0,file:t[2],line:t[3]?+t[3]:e?.line??void 0,methodName:t[1]||y,raw:r,type:void 0}},"parseFirefox"),be=g(r=>{const e=me.exec(r);if(e)return $(`parse react android native error stack line: "${r}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:y,raw:r,type:void 0}},"parseReactAndroidNative"),W=g((r,{filter:e,frameLimit:t=50}={})=>{let i=(r.stacktrace??r.stack??"").split(`
7
- `).map(o=>(T.test(o)?o.replace(T,"$1"):o).replace(/^\s+|\s+$/g,"")).filter(o=>!/\S*(?:Error: |AggregateError:)/.test(o)&&o!=="eval code");return e&&(i=i.filter(o=>e(o))),i=i.slice(0,t),i.reduce((o,s,n)=>{if(!s||s.length>1024)return o;let a;if(/^\s*in\s.*/.test(s))a=he(s);else if(/^.*?\s*at\s.*/.test(s))a=$e(s);else if(/^.*?\s*@.*|\[native code\]/.test(s)){let c;n===0&&(r.columnNumber||r.lineNumber?c={column:r.columnNumber,line:r.lineNumber,type:"firefox"}:(r.line||r.column)&&(c={column:r.column,line:r.line,type:"safari"})),a=xe(s,c)||ye(s,c)}else a=be(s);return a?o.push(a):$(`parse error stack line: "${s}"`,"not parser found"),o},[])},"parseStacktrace");var we=Object.defineProperty,u=x((r,e)=>we(r,"name",{value:e,configurable:!0}),"o");const Ee=Z(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=u(r=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,t]=b.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return b.getBuiltinModule(r)}return Ee(r)},"__cjs_getBuiltinModule"),{existsSync:Se,readFileSync:Ne}=M("node:fs"),{relative:ke}=M("node:path"),{cwd:Ae}=b,{fileURLToPath:Le}=M("node:url"),E=u((r,e,t)=>t===0?r.toString():e===" "?r+" ".repeat(t):r+" ".repeat(e*t),"getPrefix"),Me=u((r,e)=>{const t=r.replace("async file:","file:");return ke(e,t.startsWith("file:")?Le(t):t)},"getRelativePath"),je=u((r,e,t)=>{if(e)return t.title(r.message);const i=r.message?`: ${r.message}`:"";return t.title(r.name+i)},"getTitleText"),R=u((r,{color:e,hideErrorTitle:t,indentation:i,prefix:o},s)=>`${E(o,i,s)}${je(r,t,e)}
8
- `,"getMessage"),V=u((r,{color:e,indentation:t,prefix:i},o)=>{if(r.hint===void 0)return;const s=E(i,t,o);let n="";if(Array.isArray(r.hint))for(const a of r.hint)n+=`${(s+a).toString()}
9
- `;else n+=s+r.hint;return e.hint(n)},"getHint"),j=u((r,{color:e,cwd:t,displayShortPath:i,indentation:o,prefix:s},n=0)=>{const a=i?Me(r.file,t):r.file,{fileLine:c,method:d}=e;return`${E(s,o,n)}at ${r.methodName?`${d(r.methodName)} `:""}${c(a)}:${c(r.line?.toString()??"")}`.toString()},"getMainFrame"),G=u((r,{color:e,indentation:t,linesAbove:i,linesBelow:o,prefix:s,showGutter:n,showLineNumbers:a,tabWidth:c},d)=>{if(r.file===void 0)return;const l=r.file.replace("file://","");if(!Se(l))return;const p=Ne(l,"utf8");return se(p,{start:{column:r.column,line:r.line}},{color:e,linesAbove:i,linesBelow:o,prefix:E(s,t,d),showGutter:n,showLineNumbers:a,tabWidth:c})},"getCode"),F=u((r,e,t)=>{if(r.errors.length===0)return;let i=`${E(e.prefix,e.indentation,t)}Errors:
10
-
11
- `,o=!0;for(const s of r.errors)o?o=!1:i+=`
12
-
13
- `,i+=J(s,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},t+1);return`
14
- ${i}`},"getErrors"),I=u((r,e,t)=>{let i=`${E(e.prefix,e.indentation,t)}Caused by:
15
-
16
- `;const o=r.cause;i+=R(o,e,t);const s=W(o).shift(),n=V(o,e,t);if(n&&(i+=`${n}
17
- `),s&&(i+=j(s,e,t),!e.hideErrorCauseCodeView)){const a=G(s,e,t);a!==void 0&&(i+=`
18
- ${a}`)}if(o.cause)i+=`
19
- ${I(o,e,t+1)}`;else if(o instanceof AggregateError){const a=F(o,e,t);a!==void 0&&(i+=`
20
- ${a}`)}return`
21
- ${i}`},"getCause"),Oe=u((r,e)=>(r.length>0?`
22
- `:"")+r.map(t=>j(t,e)).join(`
23
- `),"getStacktrace"),J=u((r,e,t)=>{const i={cwd:Ae(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:u(n=>n,"fileLine"),gutter:u(n=>n,"gutter"),hint:u(n=>n,"hint"),marker:u(n=>n,"marker"),message:u(n=>n,"message"),method:u(n=>n,"method"),title:u(n=>n,"title"),...e.color}},o=W(r,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),s=o.shift();return[e.hideMessage?void 0:R(r,i,t),V(r,i,t),s?j(s,i,t):void 0,s&&!i.hideErrorCodeView?G(s,i,t):void 0,r instanceof AggregateError?F(r,i,t):void 0,r.cause===void 0?void 0:I(r,i,t),o.length>0?Oe(o,i):void 0].filter(Boolean).join(`
24
- `).replaceAll("\\","/")},"internalRenderError"),_e=u((r,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return J(r,e,0)},"renderError");var Te=Object.defineProperty,C=x((r,e)=>Te(r,"name",{value:e,configurable:!0}),"n");const We=C((r={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:C(async(e,t)=>{const{logger:i,runtime:o}=t,{detailed:s=!1,exitOnError:n=!0,formatter:a,logErrors:c=!0,renderOptions:d={}}=r;if(c)if(a)i.error(a(e));else if(s){const l=o.getCwd(),p=_e(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...d});i.error(p)}else i.error(e);n&&Q(1)},"handleError"),version:"1.0.0"}),"errorHandlerPlugin");export{We as errorHandlerPlugin};
1
+ var u=Object.defineProperty;var i=(e,r)=>u(e,"name",{value:r,configurable:!0});import{G as h}from"../packem_shared/renderError-ZMlMvw1N-eVUSdl6c.js";import{e as p}from"../packem_shared/runtime-process-G-n-wOub.js";var E=Object.defineProperty,a=i((e,r)=>E(e,"name",{value:r,configurable:!0}),"n");const P=a((e={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:a(async(r,t)=>{const{logger:o,runtime:l}=t,{detailed:s=!1,exitOnError:d=!0,formatter:n,logErrors:f=!0,renderOptions:c={}}=e;if(f)if(n)o.error(n(r));else if(s){const g=l.getCwd(),m=h(r,{cwd:g,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...c});o.error(m)}else o.error(r);d&&p(1)},"handleError"),version:"1.0.0"}),"errorHandlerPlugin");export{P as errorHandlerPlugin};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "3.0.0-alpha.6",
3
+ "version": "3.0.0-alpha.7",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -111,7 +111,7 @@
111
111
  "@bomb.sh/tab": "^0.0.7",
112
112
  "@visulima/boxen": "3.0.0-alpha.6",
113
113
  "@visulima/find-cache-dir": "3.0.0-alpha.4",
114
- "@visulima/pail": "4.0.0-alpha.6",
114
+ "@visulima/pail": "4.0.0-alpha.7",
115
115
  "github-slugger": "2.0.0"
116
116
  },
117
117
  "peerDependenciesMeta": {
@@ -1,4 +0,0 @@
1
- var _t=Object.defineProperty;var $=(t,e)=>_t(t,"name",{value:e,configurable:!0});import{createRequire as Lt}from"node:module";import{o as Ut,D as Mt}from"./help-command-CIRIXN03.js";import{VERBOSITY_DEBUG as W,POSITIONALS_KEY as te,VERBOSITY_QUIET as Vt,VERBOSITY_VERBOSE as Tt,VERBOSITY_NORMAL as Ne}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as k}from"./cerebro-error-CXXSmFtP.js";import{d as q,f as Ee,e as ie,o as xe,a as Rt,h as Dt,i as Bt}from"./runtime-process-G-n-wOub.js";import{distance as zt}from"fastest-levenshtein";const It=Lt(import.meta.url),Y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,St=$(t=>{if(typeof Y<"u"&&Y.versions&&Y.versions.node){const[e,n]=Y.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Y.getBuiltinModule(t)}return It(t)},"__cjs_getBuiltinModule"),{createRequire:Wt}=St("node:module");var Ft=Object.defineProperty,qt=$((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"t$9");let D=class extends k{static{$(this,"a")}static{qt(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const a=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(a,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var Gt=Object.defineProperty,Ht=$((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"e$6");let Qe=class extends k{static{$(this,"o")}static{Ht(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var Kt=Object.defineProperty,Yt=$((t,e)=>Kt(t,"name",{value:e,configurable:!0}),"e$5");let Jt=class extends k{static{$(this,"o")}static{Yt(this,"PluginError")}pluginName;constructor(e,n,a){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:a,pluginName:e}),this.name="PluginError",this.pluginName=e,a&&(this.cause=a)}};var Qt=Object.defineProperty,je=$((t,e)=>Qt(t,"name",{value:e,configurable:!0}),"d$6");let Zt=class{static{$(this,"p")}static{je(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);q().CEREBRO_OUTPUT_LEVEL===String(W)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${n.length} plugin(s)...`);for(const a of n)if(typeof a.init=="function"){this.logger.debug(`initializing plugin: ${a.name}`);try{await a.init(e)}catch(o){const i=new Jt(a.name,`Failed to initialize: ${o instanceof Error?o.message:String(o)}`,o instanceof Error?o:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,a){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const o=this.getDependencyOrder();for(const i of o){const u=i[e];if(typeof u=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?u(n,a):u(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const a=this.getDependencyOrder();for(const o of a)if(typeof o.onError=="function"){this.logger.debug(`executing error handler for plugin: ${o.name}`);try{await o.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${o.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,a=new Set,o=je(i=>{if(n.has(i))return;if(a.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const u=this.plugins.get(i);if(!u)throw new Error(`Plugin "${i}" not found`);if(a.add(i),u.dependencies)for(const s of u.dependencies)o(s);a.delete(i),n.add(i),e.push(u)},"visit");for(const i of this.plugins.keys())o(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var Xt=Object.defineProperty,en=$((t,e)=>Xt(t,"name",{value:e,configurable:!0}),"n$b");const X=en(t=>t.type?.name==="Boolean","optionIsBoolean");var tn=Object.defineProperty,Ze=$((t,e)=>tn(t,"name",{value:e,configurable:!0}),"p$9");const nn=Ze(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),an=Ze(t=>(X(t)||(t.typeLabel=t.typeLabel??nn(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var rn=Object.defineProperty,Xe=$((t,e)=>rn(t,"name",{value:e,configurable:!0}),"e$3");const on=new RegExp(/^-([^\d-])$/),sn=new RegExp(/^--(\S+)/),ln=new RegExp(/^-([^\d-]{2,})$/),cn=Xe(t=>on.test(t)||sn.test(t)||ln.test(t),"isOption"),un=Xe((t,e)=>{const n=e[0]&&cn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const a=new Error(`Command not recognised: ${n}`);throw a.command=n,a.name="INVALID_COMMAND",a}return{argv:e,command:n}},"commandLineCommands");var pn=Object.defineProperty,et=$((t,e)=>pn(t,"name",{value:e,configurable:!0}),"i$a"),fn=Object.defineProperty,tt=et((t,e)=>fn(t,"name",{value:e,configurable:!0}),"i"),hn=Object.defineProperty,nt=tt((t,e)=>hn(t,"name",{value:e,configurable:!0}),"i");nt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let re=class extends Error{static{$(this,"p")}static{et(this,"E")}static{tt(this,"m")}static{nt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:a,message:o,name:i,stack:u,title:s}){super(o,{cause:e}),this.title=s,this.name=i,this.stack=u??this.stack,this.loc=a,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var dn=Object.defineProperty,it=$((t,e)=>dn(t,"name",{value:e,configurable:!0}),"o$b"),mn=Object.defineProperty,at=it((t,e)=>mn(t,"name",{value:e,configurable:!0}),"o"),gn=Object.defineProperty,vn=at((t,e)=>gn(t,"name",{value:e,configurable:!0}),"i");let yn=class rt extends re{static{$(this,"a")}static{it(this,"a")}static{at(this,"t")}static{vn(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,rt.prototype)}};var wn=Object.defineProperty,ot=$((t,e)=>wn(t,"name",{value:e,configurable:!0}),"t$7"),bn=Object.defineProperty,st=ot((t,e)=>bn(t,"name",{value:e,configurable:!0}),"e"),$n=Object.defineProperty,On=st((t,e)=>$n(t,"name",{value:e,configurable:!0}),"e");let _e=class lt extends re{static{$(this,"n")}static{ot(this,"n")}static{st(this,"o")}static{On(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,lt.prototype)}};var En=Object.defineProperty,ct=$((t,e)=>En(t,"name",{value:e,configurable:!0}),"a$6"),An=Object.defineProperty,ut=ct((t,e)=>An(t,"name",{value:e,configurable:!0}),"a"),Pn=Object.defineProperty,Cn=ut((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"o");let kn=class pt extends re{static{$(this,"n")}static{ct(this,"o")}static{ut(this,"e")}static{Cn(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,pt.prototype)}};var Nn=Object.defineProperty,ft=$((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"i$7"),xn=Object.defineProperty,ht=ft((t,e)=>xn(t,"name",{value:e,configurable:!0}),"i"),jn=Object.defineProperty,_n=ht((t,e)=>jn(t,"name",{value:e,configurable:!0}),"i");let j=class dt extends re{static{$(this,"a")}static{ft(this,"o")}static{ht(this,"e")}static{_n(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,dt.prototype)}};var Ln=Object.defineProperty,In=$((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"T$1"),Sn=Object.defineProperty,H=In((t,e)=>Sn(t,"name",{value:e,configurable:!0}),"P"),Un=Object.defineProperty,oe=H((t,e)=>Un(t,"name",{value:e,configurable:!0}),"o");const Le=oe(t=>t===Boolean||typeof t=="function"&&t.name?.startsWith("Boolean"),"isBooleanType"),Ie=oe(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Se=oe(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Mn=oe((t,e)=>Array.isArray(t)?Le(e)?t.map(Boolean):Ie(e)?t.map(Number):Se(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Le(e)?!!t:Ie(e)?Number(t):Se(e)?String(t):e(String(t)),"convertValue");var Vn=Object.defineProperty,Tn=H((t,e)=>Vn(t,"name",{value:e,configurable:!0}),"e");const x=Tn((t,e,n,...a)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...a)},"debug");var Rn=Object.defineProperty,T=H((t,e)=>Rn(t,"name",{value:e,configurable:!0}),"A");const Dn=/-([a-z])/g,me=T(t=>t===Boolean||typeof t=="function"&&t.name?.startsWith("Boolean"),"isBooleanType"),Bn=T(t=>t.codePointAt(0)===95,"isSpecialKey"),Ue=T((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),Me=T(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ve=T((t,e,n,a=!1)=>{t[e]===void 0?t[e]=a?[n]:n:a&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),zn=T((t,e,n,a,o)=>{let i=e.get(t)||n.get(t);if(!i&&a){const u=t.toLowerCase();i=a.get(u)||o?.get(u)}return i},"getDefinition"),Wn=T((t,e,n,a)=>{const o=n.debug||!1;x(o,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(o,"Starting argument resolution","resolver"),x(o,"Tokens:","resolver",t),x(o,"Definitions:","resolver",e),x(o,"Processing tokens...","resolver");const i=new Map,u=new Map,s=n.caseInsensitive?new Map:void 0,g=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,p=n.camelCase?new Map:void 0;for(const f of e)if(i.set(f.name,f),f.alias&&u.set(f.alias,f),n.caseInsensitive&&s&&(s.set(f.name.toLowerCase(),f),f.alias&&g&&g.set(f.alias.toLowerCase(),f)),n.camelCase&&r&&p){const m=f.name.replaceAll(Dn,(v,y)=>y.toUpperCase());r.set(f.name,m),p.set(m,f.name)}const c={},l={},d=[],h=new Set;let O=!1;const b=e.find(f=>f.defaultOption),w=e.some(f=>f.group),P=e.some(f=>f.type===Number);for(let f=0;f<t.length;f++){const m=t[f];if(m.kind==="option-terminator"){c._unknown=a.slice(m.index),O=!0;break}if(m.kind==="option"&&m.name){let v=zn(m.name,i,u,s,g);if(!v&&m.value===void 0&&P&&/^\d+$/.test(m.name)){const A=e.find(I=>I.type===Number);A&&(v=A,m.value=m.name,m.name=A.name)}const y=v?v.name:m.name,E=v&&v.multiple,N=v&&v.lazyMultiple;if(l[y]!==void 0&&!E&&!N&&!n.partial)throw new yn(y);if(!v&&n.partial){const A=m.rawName||`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;d.push({index:m.index,value:A});continue}if(!v&&n.stopAtFirstUnknown){c._unknown=a.slice(m.index);break}if(!v&&!n.partial)throw new _e(m.name);if(m.value===void 0){const A=t[f+1],I=A&&A.kind==="option"&&!("name"in A)&&A.value!==void 0,L=A&&v&&!(v.type&&me(v.type))&&(A.kind==="positional"||I),jt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(L&&(!v?.defaultOption||jt))if(E){let S=f+1;const de=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)de.push(t[S].value),h.add(t[S].index),S++;l[y]=l[y]===void 0?de:Ue(l[y],de),f=S-1}else N?(Ve(l,y,A.value,!0),h.add(A.index),f++):(l[y]=A.value,h.add(A.index),f++);else v&&v.type&&me(v.type)?Ve(l,y,!0,E):l[y]=E?[]:null}else{let{value:A}=m;if(v&&v.type&&me(v.type))switch(A){case"":{if(n.partial)l._unknown||(l._unknown=[]),l._unknown.push(`${m.rawName||`--${m.name}`}${m.value?`=${m.value}`:""}`),A=!0;else throw new _e(m.name);break}case"false":{A=!1;break}case"true":{A=!0;break}default:A=!0}const I=A===void 0?[]:[A];if(E){let L=f+1;for(;L<t.length&&t[L].kind==="positional";)I.push(t[L].value),h.add(t[L].index),L++;f=L-1}l[y]===void 0?l[y]=E||N?I:A:E||N?l[y]=Ue(l[y],I):l[y]=A}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!h.has(m.index)){x(o,`Found unconsumed positional token at index ${m.index}, stopping processing`,"resolver"),c._unknown=a.slice(m.index);break}}for(const[f,m]of Object.entries(l)){const v=i.get(f);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(m)&&(l[f]=[m])}if(b){const f=[],m=[];for(const v of t)v.kind==="positional"&&!h.has(v.index)&&(f.push(v.value),m.push(v));if(f.length>0){const v=l[b.name],y=b.multiple||b.lazyMultiple;v===void 0?y?(m.forEach(E=>h.add(E.index)),l[b.name]=f):(h.add(m[0].index),l[b.name]=f[0]):y&&(m.forEach(E=>h.add(E.index)),l[b.name]=Array.isArray(v)?[...f,...v]:[...f,v])}}if(!n.partial){for(const f of t)if(f.kind==="positional"&&!h.has(f.index))throw new kn(a[f.index])}if(n.partial&&!n.stopAtFirstUnknown){const f=[...d];if(l._unknown){const m=new Map;for(const[v,y]of a.entries())m.set(y,v);for(const v of l._unknown){const y=m.get(v);y!==void 0&&f.push({index:y,value:v})}}for(const m of t)m.kind==="positional"&&!h.has(m.index)&&f.push({index:m.index,value:a[m.index]});f.length>0&&(f.sort((m,v)=>m.index-v.index),c._unknown=f.map(m=>m.value))}if(n.stopAtFirstUnknown&&!O){const f=t.findIndex(y=>y.kind==="option"&&!i.has(y.name||"")&&!u.has(y.name||"")&&(!n.caseInsensitive||!s?.has(y.name?.toLowerCase()||"")&&!g?.has(y.name?.toLowerCase()||""))),m=t.findIndex(y=>y.kind==="positional"&&!h.has(y.index));let v=-1;if(f!==-1&&m!==-1?v=Math.min(f,m):f!==-1?v=f:m!==-1&&(v=m),v>=0){const y=t[v].index;c._unknown=a.slice(y)}}else d.length>0&&!n.partial&&(c._unknown=d.map(f=>f.value));for(const[f,m]of Object.entries(l)){const v=n.camelCase&&r?.get(f)||f,y=i.get(f);c[v]=y&&y.type?Mn(m,y.type):m===void 0?null:m}for(const f of e){const m=n.camelCase&&r?.get(f.name)||f.name;!(m in c)&&f.defaultValue!==void 0&&(f.multiple||f.lazyMultiple?c[m]=Array.isArray(f.defaultValue)?[...f.defaultValue]:[f.defaultValue]:c[m]=f.defaultValue)}if(w){const f={},m={},v={};for(const E of e)if(E.group){const N=Array.isArray(E.group)?E.group:[E.group];for(const A of N)Me(A)||f[A]||(f[A]={})}for(const E of Object.keys(c))if(!Bn(E)){m[E]=c[E];let N=E;n.camelCase&&(N=p?.get(E)||E);const A=i.get(N);if(A&&A.group){const I=Array.isArray(A.group)?A.group:[A.group];for(const L of I)Me(L)||f[L]&&(f[L][E]=c[E])}else v[E]=c[E]}const y={_all:m};for(const[E,N]of Object.entries(f))y[E]=N;Object.keys(v).length>0&&(y._none=v),c._unknown&&(y._unknown=c._unknown),Object.keys(c).forEach(E=>delete c[E]),Object.assign(c,y)}return x(o,"Final parsed result:","resolver",c),c},"resolveArgs");var Fn=Object.defineProperty,R=H((t,e)=>Fn(t,"name",{value:e,configurable:!0}),"l");const V="-".codePointAt(0),M="=",qn=M.codePointAt(0),Gn="--",Hn="-",Kn="--",mt=R(t=>t.length>2&&t.startsWith(Kn),"hasLongOptionPrefix"),Yn=R(t=>mt(t)&&!t.includes(M,3),"isLongOption"),Jn=R(t=>mt(t)&&t.includes(M,3),"isLongOptionAndValue"),Qn=R(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==V,"hasOptionValue"),Zn=R(t=>{if(t.length!==2||t.codePointAt(0)!==V||t.codePointAt(1)===V)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),Xn=R(t=>!(t.length<=2||t.codePointAt(0)!==V||t.codePointAt(1)===V),"isShortOptionGroup"),ei=R(t=>{const e=[],n=[...t];let a=-1,o=0;for(;n.length>0;){const i=n.shift();if(i===void 0)break;const u=n[0];if(o>0?o--:a++,i===Gn){e.push({index:a,kind:"option-terminator"});const s=n.map((g,r)=>({index:a+r+1,kind:"positional",value:g}));e.push(...s),a+=n.length;break}if(Zn(i)){const s=i.charAt(1);let g,r;o?(e.push({index:a,inlineValue:r,kind:"option",name:s,rawName:i,value:g}),o===1&&Qn(u)&&(g=n.shift(),e.push({index:a,inlineValue:r,kind:"option",value:g}))):e.push({index:a,inlineValue:r,kind:"option",name:s,rawName:i,value:g}),g!==void 0&&++a;continue}if(Xn(i)&&!i.includes(M)){const s=[];let g="",r=!1;for(let p=1;p<i.length;p++){const c=i.charAt(p);r?g+=c:c.codePointAt(0)===qn?r=!0:s.push(`${Hn}${c}`)}if(r)if(s.length>0){const p=s.pop();s.push(`${p}=${g}`)}else s.push(g);n.unshift(...s),o=s.length;continue}if(Yn(i)){const s=i.slice(2);e.push({index:a,kind:"option",name:s,rawName:i});continue}if(Jn(i)){const s=i.indexOf(M),g=i.slice(2,s),r=i.slice(s+1);e.push({index:a,inlineValue:!0,kind:"option",name:g,rawName:i,value:r});continue}if(i.length>2&&i.codePointAt(0)===V&&i.codePointAt(1)!==V&&i.includes(M)){const s=i.indexOf(M),g=i.charAt(1),r=i.slice(s+1);e.push({index:a,inlineValue:!0,kind:"option",name:g,rawName:i,value:r});continue}e.push({index:a,kind:"positional",value:i})}return e},"parseArgsTokens");var ti=Object.defineProperty,Pe=H((t,e)=>ti(t,"name",{value:e,configurable:!0}),"d");const ni=Pe(t=>t&&(t===Boolean||typeof t=="function"&&t.name?.startsWith("Boolean")),"isBooleanType"),ii=Pe(t=>typeof t=="function","isValidCustomTypeFunction"),ai=Pe((t,e,n)=>{const a=n?.debug||!1;x(a,"Validating definitions:","validation",t,"caseInsensitive:",e);const o=new Set,i=new Set,u=new Set,s=new Set;let g=0;for(const r of t){if(x(a,"Checking definition:","validation",r),!r.name)throw x(a,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof r.name!="string")throw new j("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const p=e?r.name.toLowerCase():"";if(o.has(r.name)||e&&u.has(p))throw new j(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&s.has(p))throw new j(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(o.add(r.name),e&&u.add(p),r.alias!==void 0){if(typeof r.alias!="string")throw new j("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(/\d/.test(r.alias))throw new j("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const c=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&s.has(c))throw new j(`Invalid option definition: duplicate alias '${r.alias}'`);if(o.has(r.alias)||e&&u.has(c))throw new j(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&s.add(c)}if(r.defaultOption&&(g++,r.type!==void 0&&ni(r.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&ii(r.type)))throw new j("Invalid option definition: invalid type")}if(g>1)throw x(a,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");x(a,"Validation completed successfully","validation")},"validateDefinitions");var ri=Object.defineProperty,oi=H((t,e)=>ri(t,"name",{value:e,configurable:!0}),"O");const si=oi((t,e={})=>{const n=e.debug||!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const a={...e};a.stopAtFirstUnknown&&(a.partial=!0);const o=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",o),ai(o,a.caseInsensitive,n?a:void 0);let{argv:i}=a;if(!i&&(i=process.argv.slice(2),process.execArgv?.length)){const r=new Set(process.execArgv);i=i.filter(p=>!r.has(p))}x(n,"Using argv:","index",i);let u=i;a.caseInsensitive&&i&&(u=i.map(r=>{if(r.startsWith("--")){const p=r.indexOf("="),c=(p===-1?r.slice(2):r.slice(2,p)).toLowerCase();return p===-1?`--${c}`:`--${c}${r.slice(p)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const p=r.slice(1).split("=",2),c=p[0],l=p[1];if(!c)return r;const d=c.toLowerCase();return l===void 0?`-${d}`:`-${d}=${l}`}return r}));const s=ei((u??i??[]).map(String));x(n,"Tokenized arguments:","index",s);const g=Wn(s,o,a,i??[]);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");var li=Object.defineProperty,ci=$((t,e)=>li(t,"name",{value:e,configurable:!0}),"m$6");let ui=class{static{$(this,"a")}static{ci(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;constructor(e,n){this.commandName=e,this.command=n}};var pi=Object.defineProperty,fi=$((t,e)=>pi(t,"name",{value:e,configurable:!0}),"f$4");const hi=/^-{1,2}(\w+)(=(.+))?$/,gt=fi((t,e,n,a)=>{const o=hi.exec(t);if(o==null)return{};const i=o[1];if(!i)return{};const u=n&&a?n.get(i)??a.get(i):e.find(s=>s.name===i||s.alias===i);return u!==void 0?{argName:u.name,argValue:o[3],option:u}:{}},"getParameterOption");var di=Object.defineProperty,Ae=$((t,e)=>di(t,"name",{value:e,configurable:!0}),"e$2");const Te=Ae((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),mi=new Set(["0","1","false","true"]),gi=Ae((t,e,n,a)=>{if(e.length===0||t.length===0)return{};const o=Ae((i,u)=>{const{argName:s,argValue:g,option:r}=gt(u,e,n,a),{lastOption:p}=i;return r&&X(r)&&g&&s?i.partial[s]=Te(g,r):i.lastName&&p&&X(p)&&mi.has(u)&&(i.partial[i.lastName]=Te(u,p)),{lastName:s,lastOption:r,partial:i.partial}},"getBooleanValue");return t.reduce(o,{partial:{}}).partial},"getBooleanValues");var vi=Object.defineProperty,Re=$((t,e)=>vi(t,"name",{value:e,configurable:!0}),"s$8");const yi=new Set(["0","1","false","true"]),wi=Re((t,e,n,a)=>{if(e.length===0||t.length===0)return t;const o=Re((i,u)=>{const{argValue:s,option:g}=gt(u,e,n,a),{lastOption:r}=i;if(r&&X(r)&&yi.has(u)){const{args:p}=i;return{args:p.slice(0,-1)}}return g&&X(g)&&s?{args:i.args}:{args:[...i.args,u],lastOption:g}},"removeBooleanArguments");return t.reduce(o,{args:[]}).args},"removeBooleanValues");var bi=Object.defineProperty,$i=$((t,e)=>bi(t,"name",{value:e,configurable:!0}),"o$8");const De=$i(t=>{const e=new Map;for(const n of t){const a=e.get(n.name);a?e.set(n.name,{...a,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Oi=Object.defineProperty,se=$((t,e)=>Oi(t,"name",{value:e,configurable:!0}),"o$7");const Ei=se(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),Ai=se((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Ei(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),Pi=se(t=>t.toLowerCase().replaceAll(/_./g,e=>e[1]?.toUpperCase()??e).replace(/^[A-Z]/,e=>e.toLowerCase()),"toCamelCase"),Ci=se(t=>{if(!t||t.length===0)return{};const e={},n=q();for(const a of t){const o=n[a.name],i=Ai(a,o),u=i===void 0?a.defaultValue:i,s=Pi(a.name);e[s]=u}return e},"processEnvVariables");var ki=Object.defineProperty,le=$((t,e)=>ki(t,"name",{value:e,configurable:!0}),"l$a");const Ni=le(t=>{const e=new Map,n=new Map;for(const a of t)if(e.set(a.name,a),a.alias){const o=Array.isArray(a.alias)?a.alias:[a.alias];for(const i of o)n.set(i,a)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),xi=le((t,e,n,a)=>{const o=new ui(t.name,t),{_all:i,positionals:u}=e,s=Object.keys(n).length>0?{...i,...n}:i;te in s&&delete s[te],o.argument=u?.[te]??[];const g=Object.keys(a).length>0;return o.options=g?{...s,...a}:s,o.env=Ci(t.env),o},"prepareToolbox"),ji=le((t,e,n)=>{const a=t.options??[],o=a.length>0;let i=De(o?[...a,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument?.description,group:"positionals",multiple:!0,name:te,type:t.argument?.type,typeLabel:t.argument?.typeLabel},...i]);let u,s;if(o){const{optionMapByAlias:r,optionMapByName:p}=Ni(a);u=wi(e,a,p,r),s=gi(e,a,p,r)}else u=e,s={};const g=si(i,{argv:u,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:s,parsedArgs:g}},"processCommandArgs"),B=le(async(t,e,n)=>await t.execute(e),"executeCommand");var _i=Object.defineProperty,Li=$((t,e)=>_i(t,"name",{value:e,configurable:!0}),"n$6");let Ii=class extends k{static{$(this,"s")}static{Li(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var Si=Object.defineProperty,Ui=$((t,e)=>Si(t,"name",{value:e,configurable:!0}),"t$5");const Be=Ui((t,e,n=!1)=>{const a=[];for(const o of t)if(!(!n&&!o.required)&&e[o.name]===void 0){if(o.type?.name==="Boolean"){e[o.name]=!1;continue}a.push(o)}return a},"listMissingArguments");var Mi=Object.defineProperty,vt=$((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"n$5");const Vi=vt((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:zt(t,e)<=t.length/3,"isSimilar"),F=vt((t,e)=>{const n=t.toLowerCase();return e.filter(a=>Vi(a.toLowerCase(),n))},"findAlternatives");var Ti=Object.defineProperty,ce=$((t,e)=>Ti(t,"name",{value:e,configurable:!0}),"a$2");const Ri=ce((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(a=>{const o=a.startsWith("--");let i=`Found unknown ${o?"option":"argument"} "${a}"`;if(o){const u=F(a.replace("--",""),(e.options??[]).map(s=>s.name));if(u.length>0){const[s,...g]=u.map(r=>`--${r}`);i+=g.length>0?`, did you mean ${s} or ${g.join(", ")}?`:`, did you mean ${s}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
2
- `))},"validateUnknownOptions"),Di=ce((t,e,n)=>{const a=n.__requiredOptions__?Be(n.__requiredOptions__,e,!0):Be(t,e,!1);if(a.length>0)throw new Ii(n.name,a.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Ri(e,n)},"validateRequiredOptions"),Bi=ce((t,e,n)=>{const a=n.__conflictingOptions__??t.filter(o=>o.conflicts!==void 0);if(a.length>0){const o=a.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(u=>e[u]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(o)throw new Qe(o.name,typeof o.conflicts=="string"?o.conflicts:o.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),zi=ce(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const o of t.options){if(o.name){const i=e.get(o.name)??[];i.push(o),e.set(o.name,i)}if(typeof o.alias=="string"&&o.alias.length>0){const i=n.get(o.alias)??[];i.push(o),n.set(o.alias,i)}else if(Array.isArray(o.alias)){for(const i of o.alias)if(i.length>0){const u=n.get(i)??[];u.push(o),n.set(i,u)}}}const a=[];for(const[o,i]of e)i.length>1&&a.push(`Duplicate option name "${o}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[o,i]of n)i.length>1&&a.push(`Duplicate option alias "-${o}" used by options ${i.map(u=>`"${u.name}"`).join(", ")} in command "${t.name}"`);if(a.length>0)throw new Error(a.join(`
3
- `))},"validateDuplicateOptions");var Wi=Object.defineProperty,Ce=$((t,e)=>Wi(t,"name",{value:e,configurable:!0}),"r$7");const Fi=Ce((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];for(let a=1;a<=e.length;a+=1){const o=e[a-1];if(o===void 0)break;n.push(o);const i=n.join(" ");if(t.has(i))return{argv:e.slice(a),commandPath:[...n]}}return{argv:e,commandPath:void 0}},"parseNestedCommand"),J=Ce(t=>t.join(" "),"getCommandPathKey"),qi=Ce((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Gi=Object.defineProperty,Hi=$((t,e)=>Gi(t,"name",{value:e,configurable:!0}),"p$4"),Ki=Object.defineProperty,yt=Hi((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"e"),Yi=Object.defineProperty,Ji=yt((t,e)=>Yi(t,"name",{value:e,configurable:!0}),"E");const wt=String.raw,ze=wt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Qi=Ji(()=>new RegExp(wt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${ze}(?:\u200D${ze})*`,"gu"),"default");var Zi=Object.defineProperty,Xi=yt((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const G=Qi(),ea=/[-_./\s]+/g,Z=/(\u001B\[[0-9;]*[a-z])/i,We=new RegExp("\\p{Script=Arabic}","u"),ta=new RegExp("\\p{Script=Bengali}","u"),z=new RegExp("\\p{Script=Cyrillic}","u"),na=new RegExp("\\p{Script=Devanagari}","u"),ia=new RegExp("\\p{Script=Ethiopic}","u"),ge=new RegExp("\\p{Script=Greek}","u"),aa=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ra=new RegExp("\\p{Script=Gujarati}","u"),oa=new RegExp("\\p{Script=Gurmukhi}","u"),Fe=new RegExp("\\p{Script=Hangul}","u"),qe=new RegExp("\\p{Script=Hebrew}","u"),sa=new RegExp("\\p{Script=Hiragana}","u"),Ge=new RegExp("\\p{Script=Han}","u"),la=new RegExp("\\p{Script=Kannada}","u"),ca=new RegExp("\\p{Script=Katakana}","u"),ua=new RegExp("\\p{Script=Khmer}","u"),pa=new RegExp("\\p{Script=Lao}","u"),_=new RegExp("\\p{Script=Latin}","u"),fa=new RegExp("\\p{Script=Malayalam}","u"),ha=new RegExp("\\p{Script=Myanmar}","u"),da=new RegExp("\\p{Script=Oriya}","u"),ma=new RegExp("\\p{Script=Sinhala}","u"),ga=new RegExp("\\p{Script=Tamil}","u"),va=new RegExp("\\p{Script=Telugu}","u"),ya=new RegExp("\\p{Script=Thai}","u"),wa=new RegExp("\\p{Script=Tibetan}","u"),He=/[\u02BB\u02BC\u0027]/u,ba=Xi(t=>t.replace(G,""),"stripEmoji");var $a=Object.defineProperty,bt=$((t,e)=>$a(t,"name",{value:e,configurable:!0}),"i$6"),Oa=Object.defineProperty,$t=bt((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"r"),Ea=Object.defineProperty,Aa=$t((t,e)=>Ea(t,"name",{value:e,configurable:!0}),"c");let Ot=class{static{$(this,"l")}static{bt(this,"y")}static{$t(this,"s")}static{Aa(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(a=>a!==e);else if(this.cache.size>=this.capacity){const a=this.keyOrder.shift();a!==void 0&&this.cache.delete(a)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Pa=Object.defineProperty,Ca=$((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"r$5"),ka=Object.defineProperty,Na=Ca((t,e)=>ka(t,"name",{value:e,configurable:!0}),"a"),xa=Object.defineProperty,ja=Na((t,e)=>xa(t,"name",{value:e,configurable:!0}),"s");const _a=ja((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var La=Object.defineProperty,Ia=$((t,e)=>La(t,"name",{value:e,configurable:!0}),"I"),Sa=Object.defineProperty,ue=Ia((t,e)=>Sa(t,"name",{value:e,configurable:!0}),"j");const Ua=Wt(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ma=ue(t=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[e,n]=Q.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Q.getBuiltinModule(t)}return Ua(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Va}=Ma("node:util");var Ta=Object.defineProperty,Ra=ue((t,e)=>Ta(t,"name",{value:e,configurable:!0}),"g");const ve=new Ot(1e3),Da=Ra(t=>{const e=t.join("");if(ve.has(e))return ve.get(e);const n=t.map(o=>o.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)).join("|"),a=new RegExp(n,"g");return ve.set(e,a),a},"getSeparatorsRegex");var Ba=Object.defineProperty,za=ue((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"t");const Wa=za(t=>{const e=[];let n=0,a;for(G.lastIndex=0;(a=G.exec(t))!==null;)a.index>n&&e.push(t.slice(n,a.index)),e.push(a[0]),n=G.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Fa=Object.defineProperty,C=ue((t,e)=>Fa(t,"name",{value:e,configurable:!0}),"u");const Et=new Uint8Array(128),At=new Uint8Array(128),Pt=new Uint8Array(128);for(let t=0;t<128;t++)Et[t]=t>=65&&t<=90?1:0,At[t]=t>=97&&t<=122?1:0,Pt[t]=t>=48&&t<=57?1:0;const ye=C(t=>Et[t],"isUpper"),Ke=C(t=>At[t],"isLower"),we=C(t=>Pt[t],"isDigit"),U=C((t,e,n,a,o)=>{if(t.length===0)return[];let i=!1;for(const c of Object.values(e))if(c(t[0])){i=!0;break}if(!i&&!n)return[t];const u=[...t],s=[];let g=u[0],r="other";for(const[c,l]of Object.entries(e))if(l(u[0])){r=c;break}let p=n&&a?u[0]===u[0].toLocaleUpperCase(a):!1;for(let c=1;c<u.length;c++){const l=u[c];let d="other";for(const[b,w]of Object.entries(e))if(w(l)){d=b;break}const h=n&&a?l===l.toLocaleUpperCase(a):!1;let O=!1;o?O=o(r,d,p,h,l,c,u):(r!==d&&r!=="other"&&d!=="other"&&(O=!0),n&&d!=="other"&&!p&&h&&(O=!0)),O?(s.push(g),g=l):g+=l,r=d,n&&(p=h)}return g&&g.length>0&&s.push(g),s.length>0?s:[t]},"handleScriptTransitions"),qa=C((t,e,n,a)=>{if(n.size===0)return e;for(const o of n)if(t.startsWith(o,e))return a.push(o),e+o.length;return e},"detectAndProcessAcronym"),Ct=C((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const a=[],o=t.length;for(let i=1;i<o;i++){const u=qa(t,n,e,a);if(u!==n){n=u,i=n-1;continue}const s=t.codePointAt(i-1),g=t.codePointAt(i),r=s&&s<128&&ye(s),p=g&&g<128&&ye(g),c=s&&s<128&&Ke(s),l=s&&s<128&&we(s),d=g&&g<128&&we(g);if(c&&p){a.push(t.slice(n,i)),n=i;continue}if(l&&!d||!l&&d){a.push(t.slice(n,i)),n=i;continue}if(d&&!l){let h=!1,O=!1;if(i+1<o){const b=t.codePointAt(i+1);h=b&&b<128&&ye(b),O=b&&b<128&&we(b)}if(!O&&h){a.push(t.slice(n,i),t.slice(i,i+1)),n=i+1;continue}}if(i+1<o){const h=t.codePointAt(i+1),O=h&&h<128&&Ke(h);if(r&&p&&O){const b=t.slice(n,i+1);e.has(b)||(a.push(t.slice(n,i)),n=i)}}}return n<o&&a.push(t.slice(n)),a.filter(i=>i!=="")},"splitCamelCaseFast"),kt=C((t,e,n)=>{if(t.length===0)return[];const a=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!a&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],p=r.length,c=[];let l=r[0],d=r[0]===r[0].toLocaleUpperCase(e),h=d,O=d?0:-1;for(let b=1;b<p;b++){const w=r[b],P=w===w.toLocaleUpperCase(e);if(P===d)l+=w;else if(P)l&&l.length>0&&(c.push(l),l=w),h=!0,O=b;else{if(h&&b-O>1){const f=r[b-1],m=l.slice(0,-1);m&&m.length>0&&c.push(m),l=f+w}else l+=w;h=!1,O=-1}d=P}return l&&l.length>0&&c.push(l),c}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!z.test(t)&&!_.test(t))return[t];const r=[...t],p=r.length,c=[];let l=r[0];const d=r[0];let h;z.test(d)?h=1:_.test(d)?h=2:h=0;let O=d===d.toLocaleUpperCase(e);for(let w=1;w<p;w++){const P=r[w];let f;z.test(P)?f=1:_.test(P)?f=2:f=0;const m=P===P.toLocaleUpperCase(e);h!==f&&(h===1||h===2)&&(f===1||f===2)||f===h&&!O&&m?(c.push(l),l=P):l+=P,h=f,O=m}l&&l.length>0&&c.push(l);const b=[];for(let w=0;w<c.length;w++)w<c.length-1&&c[w].length===1&&_.test(c[w])&&z.test(c[w+1][0])?(b.push(c[w]+c[w+1]),w+=1):b.push(c[w]);return b}if(e.startsWith("el")){if(!ge.test(t)&&!_.test(t))return[t];const r=t.match(aa)??[t],p=[];if(r.length===1){const c=r[0];if(!c||!ge.test(c[0])||c.length===1)return[c||t]}for(const c of r){if(!c)continue;if(!ge.test(c[0])||c.length===1){p.push(c);continue}const l=c.length;let d=c[0],h=c[0]===c[0].toLocaleUpperCase(e);for(let O=1;O<l;O++){const b=c[O],w=b===b.toLocaleUpperCase(e);!h&&w?(p.push(d),d=b):d+=b,h=w}d&&p.push(d)}return p}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),p=r?{hiragana:C(l=>sa.test(l),"hiragana"),kanji:C(l=>Ge.test(l),"kanji"),katakana:C(l=>ca.test(l),"katakana"),latin:C(l=>_.test(l),"latin")}:{hangul:C(l=>Fe.test(l),"hangul"),latin:C(l=>_.test(l),"latin")},c=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const l=U(t,p,!1,e,(h,O)=>h==="hiragana"&&O==="katakana"||h==="katakana"&&O==="hiragana"||h==="hiragana"&&O==="latin"||h==="katakana"&&O==="latin"||h==="kanji"&&O==="latin"||h==="latin"&&(O==="hiragana"||O==="katakana"||O==="kanji")),d=[];for(const h of l)h.length===1&&c.has(h)&&d.length>0?d[d.length-1]+=h:d.push(h);return d.length>0?d:[t]}return U(t,p,!1,e,(l,d)=>l==="hangul"&&d==="latin"||l==="latin"&&d==="hangul")}if(e.startsWith("sl")){const r=[...t],p=r.length,c=[];let l=r[0],d=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<p;h++){const O=r[h],b=O===O.toLocaleUpperCase(e),w=/[ČŠŽĐ]/i.test(O),P=h<p-1&&r[h+1]===r[h+1].toLocaleUpperCase(e);!d&&b||w&&P?(c.push(l),l=O,w&&P&&(c.push(l),l="")):l+=O,d=b}return l&&l.length>0&&c.push(l),c}if(e.startsWith("zh"))return U(t,{han:C(r=>Ge.test(r),"han"),latin:C(r=>_.test(r),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=C(p=>qe.test(p)||We.test(p),"isRtlChar");return U(t,{latin:C(p=>_.test(p),"latin"),rtl:C(p=>r(p),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=C(p=>na.test(p)||ta.test(p)||ra.test(p)||oa.test(p)||la.test(p)||ga.test(p)||va.test(p)||fa.test(p)||ma.test(p)||ya.test(p)||pa.test(p)||wa.test(p)||ha.test(p)||ia.test(p)||ua.test(p)||da.test(p),"isIndicChar");return U(t,{indic:C(p=>r(p),"indic"),latin:C(p=>_.test(p),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return U(t,{cyrillic:C(r=>z.test(r),"cyrillic"),latin:C(r=>_.test(r),"latin")},!0,e);if(["ar","fa","he"].includes(e))return U(t,{latin:C(r=>_.test(r),"latin"),rtl:C(r=>qe.test(r)||We.test(r),"rtl")},!1,e);if(e.startsWith("ko"))return U(t,{hangul:C(r=>Fe.test(r),"hangul"),latin:C(r=>_.test(r),"latin")},!1,e);if(e.startsWith("uz")){if(!z.test(t)&&!_.test(t))return[t];const r=[...t],p=r.length,c=[];let l=r[0],d=r[0]===r[0].toLocaleUpperCase(e);for(let h=1;h<p;h++){const O=r[h],b=O===O.toLocaleUpperCase(e);if(He.test(O)||He.test(r[h-1])){l+=O;continue}!d&&b?(c.push(l),l=O):l+=O,d=b}return l&&l.length>0&&c.push(l),c}const o=[...t],i=o.length,u=[];let s=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){u.push(r),s=o[r.length],g=s===s.toLocaleUpperCase(e);break}for(let r=1;r<i;r++){const p=o[r],c=p===p.toLocaleUpperCase(e);let l=0;for(const d of n)if(t.startsWith(d,r)){u.push(s,d),l=d.length,s="";const h=d[d.length-1];h&&(g=h===h.toLocaleUpperCase(e));break}if(l>0){r+=l-1;continue}!g&&c?(u.push(s),s=p):s+=p,g=c}return s&&u.push(s),u},"splitCamelCaseLocale"),Ga=C((t,e,n)=>{const a=[],o=Z.test(t)?t.split(Z).filter(Boolean):[t];for(const i of o)if(Z.test(i))a.push(i);else{const u=G.test(i)?Wa(i).filter(Boolean):[i];for(const s of u)if(G.test(s))a.push(s);else if(e){const g=e.toLowerCase().split("-")[0];a.push(...kt(s,g,n))}else a.push(...Ct(s,n))}return a},"processTextWithAnsiEmoji"),Ha=C((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:a=!1,knownAcronyms:o=[],locale:i,normalize:u=!1,separators:s,stripAnsi:g=!1,stripEmoji:r=!1}=e,p=new Set([...o].toSorted((w,P)=>P.length-w.length));let c=t;g&&(c=Va(c)),r&&(c=ba(c));let l;Array.isArray(s)?l=Da(s):s instanceof RegExp?l=s:l=ea;const d=[];let h=c;const O=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;h.length>0;){const w=O.exec(h);if(!w){h===".."?d.push(".."):h==="."?d.push("."):h.length>0&&d.push(h);break}const P=w.index,f=w[0],m=f.length,v=h.slice(0,P),y=h.slice(P+m);if(f.startsWith("../"))d.push(".."),h=h.slice(P+3);else if(f.startsWith("./"))d.push("."),h=h.slice(P+2);else if(P===0&&f==="..")d.push(".."),h=h.slice(2);else if(P===0&&f===".")d.push("."),h=h.slice(1);else{v.length>0&&d.push(v);let E=0;for(;(E=f.indexOf("../",E))!==-1;)d.push(".."),E+=3;for(E=0;(E=f.indexOf("./",E))!==-1;)(E===0||f[E-1]!==".")&&d.push("."),E+=2;let N=y;for(;N.startsWith("../");)d.push(".."),N=N.slice(3);for(;N.startsWith("./");)d.push("."),N=N.slice(2);if(N===".."){d.push("..");break}else if(N==="."){d.push(".");break}else h=N}O.lastIndex=0}if(d.length===0){const w=c.split(l).filter(Boolean);d.push(...w)}let b=[];for(const w of d)n||a?b.push(...Ga(w,i,p)):i?b.push(...kt(w,i,p)):b.push(...Ct(w,p));return u&&(b=b.map(w=>p.has(w)?w:i&&w===w.toLocaleUpperCase(i)?w[0]+w.slice(1).toLocaleLowerCase(i):w.toUpperCase()===w&&!p.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),b},"splitByCase");var Ka=Object.defineProperty,Ya=$((t,e)=>Ka(t,"name",{value:e,configurable:!0}),"r$4"),Ja=Object.defineProperty,Qa=Ya((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"o"),Za=Object.defineProperty,Xa=Qa((t,e)=>Za(t,"name",{value:e,configurable:!0}),"s");const er=Xa((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var tr=Object.defineProperty,nr=$((t,e)=>tr(t,"name",{value:e,configurable:!0}),"r$3"),ir=Object.defineProperty,ar=nr((t,e)=>ir(t,"name",{value:e,configurable:!0}),"r"),rr=Object.defineProperty,or=ar((t,e)=>rr(t,"name",{value:e,configurable:!0}),"n");const sr=or((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var lr=Object.defineProperty,cr=$((t,e)=>lr(t,"name",{value:e,configurable:!0}),"i$4"),ur=Object.defineProperty,pr=cr((t,e)=>ur(t,"name",{value:e,configurable:!0}),"a"),fr=Object.defineProperty,hr=pr((t,e)=>fr(t,"name",{value:e,configurable:!0}),"l");const dr=hr((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const a=[];let o="",i="";for(let u=0;u<n;u++){const s=t[u];if(Z.test(s)){o?(a.push(o+i+s),o="",i=""):(a.length>0&&a.push(e),o=s);continue}o?(i&&(i+=e),i+=s):(a.length>0&&a.push(e),a.push(s))}return a.join("")},"joinSegments");var mr=Object.defineProperty,gr=$((t,e)=>mr(t,"name",{value:e,configurable:!0}),"r$2"),vr=Object.defineProperty,yr=gr((t,e)=>vr(t,"name",{value:e,configurable:!0}),"a"),wr=Object.defineProperty,br=yr((t,e)=>wr(t,"name",{value:e,configurable:!0}),"t");const $r=br(t=>t.replaceAll(/(?<![a-zß])SS(?![a-z])/g,"ß"),"normalizeGermanEszett");var Or=Object.defineProperty,Er=$((t,e)=>Or(t,"name",{value:e,configurable:!0}),"l$2"),Ar=Object.defineProperty,Pr=Er((t,e)=>Ar(t,"name",{value:e,configurable:!0}),"n"),Cr=Object.defineProperty,kr=Pr((t,e)=>Cr(t,"name",{value:e,configurable:!0}),"l");const Nr=new Ot(1e3),Nt=kr((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,a=e?.cacheStore??Nr;let o;if(n&&(o=sr(t,e)),n&&o&&a.has(o))return a.get(o);let i=!0;const u=dr(Ha(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>e?.handleAnsi&&Z.test(s)?s:(s=e?.locale?.startsWith("de")?$r(s):s,s=e?.locale?s.toLocaleLowerCase(e.locale):s.toLowerCase(),i?(i=!1,_a(s,e)):er(s,e))),"");return n&&o&&a.set(o,u),u},"camelCase");var xr=Object.defineProperty,pe=$((t,e)=>xr(t,"name",{value:e,configurable:!0}),"a");const jr=pe(t=>{t.options?.forEach(e=>{e.__camelCaseName__=Nt(e.name)})},"processOptionNames"),_r=pe(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const a of t.options)e.add(a.name);const n=[];for(const a of t.options)if(a.name.startsWith("no-")){const o=a.name.replace("no-","");if(!e.has(o)){if(a.type!==Boolean)throw new Error(`Cannot add negated option "${a.name}" to command "${t.name}" because it is not a boolean.`);const i={...a,defaultValue:a.defaultValue===void 0?!0:!a.defaultValue,name:o};n.push(i),e.add(o)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Lr=pe((t,e)=>{if(!e.options||e.options.length===0)return;const n=t.options,a=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const u=Nt(i.name);a.set(u,i)}const o=Object.keys(n).filter(i=>a.has(i));if(o.length!==0)for(const i of o){const u=i.charAt(2);if(!u)continue;const s=u.toLowerCase()+i.slice(3),g=a.get(i);g&&(g.__negated__=!0),n[s]=!n[i],Reflect.deleteProperty(n,i)}},"mapNegatableOptions"),Ir=pe((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const o of e.options)o.__camelCaseName__&&o.__negated__===void 0&&o.implies!==void 0&&n.set(o.__camelCaseName__,o);if(n.size===0)return;const a=t.options;for(const o of Object.keys(a)){const i=n.get(o);if(i?.implies){const u=i.implies;for(const[s,g]of Object.entries(u))a[s]===void 0&&(a[s]=g)}}},"mapImpliedOptions");var Sr=Object.defineProperty,fe=$((t,e)=>Sr(t,"name",{value:e,configurable:!0}),"e$1");const Ur=fe(()=>!!process.versions.electron,"isElectronApp"),Mr=fe(()=>Ur()&&!process.defaultApp,"isBundledElectronApp"),Vr=fe(()=>Mr()?0:1,"getProcessArgvBinIndex"),Tr=fe(t=>t.slice(Vr()+1),"hideBin");var Rr=Object.defineProperty,xt=$((t,e)=>Rr(t,"name",{value:e,configurable:!0}),"s$2");const Dr=" ",Br=xt((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,a)=>n===e[a]),"equals"),zr=xt(t=>{if(typeof t=="string")return t.split(Dr);const e=Ee();return Br(t,e)?Tr(t):t},"parseRawCommand");var Wr=Object.defineProperty,be=$((t,e)=>Wr(t,"name",{value:e,configurable:!0}),"r");const Fr=be(t=>{const e=be(i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),ie(1)},"uncaughtExceptionHandler"),n=be((i,u)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let s;if(typeof i=="string")s=i;else try{s=JSON.stringify(i)}catch{s=String(i)}t.error(`Promise rejection: ${s}`)}ie(1)},"unhandledRejectionHandler"),a=xe("uncaughtException",e),o=xe("unhandledRejection",n);return()=>{a(),o()}},"registerExceptionHandler");var qr=Object.defineProperty,K=$((t,e)=>qr(t,"name",{value:e,configurable:!0}),"e");const ae=100,ke=K((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new k(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),Ye=K((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new k(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");K((t,e)=>{if(typeof t!="function")throw new k(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const $e=K((t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),ee=K(t=>{const e=ke(t,"Command name");if(e.length>ae)throw new k(`Command name is too long (maximum ${ae} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!/^[a-z][\w-]*$/i.test(e))throw new k(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");K(t=>{const e=ke(t,"Plugin name");if(e.length>ae)throw new k(`Plugin name is too long (maximum ${ae} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!/^[a-z][\w-]*$/i.test(e))throw new k(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var Gr=Object.defineProperty,he=$((t,e)=>Gr(t,"name",{value:e,configurable:!0}),"s");const Hr=new Set([`
4
- `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Kr=he(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error("Argument is too long (maximum 10000 characters)");for(const e of t)if(Hr.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),Je=he(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error("Too many arguments (maximum 100)");return t.map(e=>Kr(e))},"sanitizeArguments");he(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||/^[A-Z]:/i.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class mo{static{$(this,"RateLimiter")}static{he(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),a=this.attempts.get(e);return!a||n>a.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):a.count>=this.maxAttempts?!1:(a.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,a]of this.attempts.entries())e>a.resetTime&&this.attempts.delete(n)}}var Yr=Object.defineProperty,ne=$((t,e)=>Yr(t,"name",{value:e,configurable:!0}),"_");const Jr=/^-([^\d-])$/,Qr=/^--(\S+)/,Zr=/^-([^\d-]{2,})$/,Oe=ne(t=>Jr.test(t)||Qr.test(t)||Zr.test(t),"isOption");class go{static{$(this,"Cli")}static{ne(this,"Cli")}#t;#e;#r;#c;#g;#u;#v;#o;#n;#i;#p;#s;#l;#f=!1;#y;#w=!1;#h;#d;#m;#E(){return this.#h===void 0&&(this.#h=[...this.#i.keys()]),this.#h}#b(){return this.#d===void 0&&(this.#d=[...this.#n.keys()]),this.#d}#a(){return this.#m===void 0&&(this.#m=[...this.#E(),...this.#b()]),this.#m}#A(){this.#h=void 0,this.#d=void 0,this.#m=void 0}#$(){if(this.#r===void 0){const e=zr(this.#e.argv);this.#r=Je(e),this.#P()}return this.#r}#P(){if(!this.#r)return;const e=q();let n=!1;for(const a of this.#r){if(a==="--quiet"||a==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Vt),n=!0;break}if(a==="--verbose"||a==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Tt),n=!0;break}if(a==="--debug"||a==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(W),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(W):String(Ne))}#C(){this.#w||(this.#y=Fr(this.#t),this.#w=!0)}#O(e,n,a,o){this.#t.debug(`command '${o}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:u,parsedArgs:s}=ji(e,n,Ut),g=Object.keys(u).length>0?{...s,_all:{...s._all,...u}}:s;Di(i,g,e);const r=xi(e,s,u,a);r.runtime=this,r.argv=this.#$();const p=e.options&&e.options.length>0;if(p&&e.options){const c=e.options.filter(l=>l.name.startsWith("no-"));for(const l of c){const d=l.name.replace("no-",""),h=`--${l.name}`,O=`--${d}`,b=n.includes(h),w=n.includes(O);if(b&&w)throw new Qe(d,l.name)}}return p&&(Lr(r,e),Ir(r,e)),Bi(i,r.options,e),q().CEREBRO_OUTPUT_LEVEL===String(W)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(r.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(r.argument,null,2))),{arguments_:i,booleanValues:u,commandArgs:g,parsedArgs:s,toolbox:r}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#g=e.trim();const a=n.argv??Ee(),o=n.cwd??Rt();if(this.#e={...n,argv:a,cwd:o},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const i=q();if(i.CEREBRO_OUTPUT_LEVEL=String(Ne),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],s=[],g=this.#e.logger;for(const r of u)typeof g[r]!="function"&&s.push(r);if(s.length>0)throw new k(`Logger object is missing required methods: ${s.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:s});this.#t=this.#e.logger}else this.#t={...console,debug:ne((...u)=>{i.CEREBRO_OUTPUT_LEVEL===String(W)&&console.debug(...u)},"debug")};this.#u=this.#e.packageVersion,this.#v=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#i=new Map,this.#p=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#g}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){$e(e,"Command"),ee(e.name),e.alias&&(typeof e.alias=="string"?ee(e.alias):Ye(e.alias,"Command alias").forEach(o=>ee(o))),e.argument&&$e(e.argument,"Command argument"),e.options&&$e(e.options,"Command options"),e.commandPath&&(Ye(e.commandPath,"Command commandPath"),e.commandPath.forEach(o=>{ee(o)}));const n=qi(e.name,e.commandPath),a=J(n);if(this.#i.has(a))throw new k(`Command with path "${a}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});if(this.#n.has(e.name)&&!e.commandPath)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const o of e.options)an(o);if(zi(e),_r(e),jr(e),e.options&&(e.__conflictingOptions__=e.options.filter(o=>o.conflicts!==void 0),e.__requiredOptions__=e.options.filter(o=>o.required===!0)),this.#n.set(e.name,e),this.#i.set(a,n),this.#p.set(a,e),this.#A(),e.alias!==void 0){const o=typeof e.alias=="string"?[e.alias]:e.alias;for(const i of o){if(q().CEREBRO_OUTPUT_LEVEL===String(W)&&this.#t.debug("adding alias",i),this.#n.has(i))throw new k(`Command alias "${i}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:i,commandName:e.name});this.#n.set(i,e)}}return this}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#o?this.#o:(this.#o=new Zt(this.#t),this.#o.register({description:"Attaches the logger to the toolbox",execute:ne(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#o)}getCliName(){return this.#g}getPackageVersion(){return this.#u}getPackageName(){return this.#v}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:a=!0,...o}=e;this.#n.has("help")||this.addCommand(new Mt(this.#n));const i=this.#b(),u=this.#i;this.#C();const s=this.#$();let g,r=[...s];const p=Dt(),c=Bt(),l=Ee();this.#t.debug(`process.execPath: ${p}`),this.#t.debug(`process.execArgv: ${c.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const d=Fi(u,[...s]);if(d.commandPath)g=d.commandPath,r=d.argv;else{if(s.length>1&&s[0]&&s[1]&&!Oe(s[0])&&!Oe(s[1])){const y=[];let E=0;for(;E<s.length;){const A=s[E];if(!A||Oe(A))break;y.push(A),E+=1}const N=J(y);if(y[0]&&!i.includes(y[0])){const A=this.#a(),I=F(N,A);throw new D(N,I)}}let v;try{v=un([null,...i],[...s])}catch(y){if(y instanceof Error&&y.name==="INVALID_COMMAND"&&"command"in y){const E=y.command,N=this.#a(),A=F(E,N);throw new D(E,A)}throw y}v.command&&(g=[v.command],r=v.argv)}if(!g)if(this.#s)g=[this.#s];else{const v=this.#a();throw new D("",v)}const h=J(g),O=this.#i.get(h);let b;if(O){if(b=this.#p.get(h),!b||J(O)!==h){const v=this.#a(),y=F(h,v);throw new D(h,y)}}else{const v=g[g.length-1];if(b=v?this.#n.get(v):void 0,!b){const y=this.#a(),E=F(h,y);throw new D(h,E)}}if(typeof b.execute!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),a?ie(1):void 0;const w=r,{commandArgs:P,toolbox:f}=this.#O(b,w,o,h),m=this.getPluginManager();try{!this.#f&&m.hasPlugins()&&(await m.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await m.executeLifecycle("execute",f),await m.executeLifecycle("beforeCommand",f);let v;if(P.global?.help){const y=this.#n.get("help");if(!y)throw new k("Help command not found","COMMAND_NOT_FOUND");v=await B(y,f,P)}else if(P.global?.version||P.global?.V){const y=this.#n.get("version");if(!y)throw new k("Version command not found","COMMAND_NOT_FOUND");v=await B(y,f,P)}else v=await B(b,f,P);return await m.executeLifecycle("afterCommand",f,v),a?ie(0):void 0}catch(v){throw await m.executeErrorHandlers(v,f),v}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:a=[],...o}=n;ke(e,"Command name");const i=e.split(" ").filter(Boolean),u=J(i),s=this.#i.get(u)?this.#p.get(u):this.#n.get(e);if(!s){const l=this.#a(),d=F(u||e,l);throw new D(e,d)}if(typeof s.execute!="function")throw new k(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const g=[...Je(a)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:r,toolbox:p}=this.#O(s,g,o,u||e),c=this.getPluginManager();try{!this.#f&&c.hasPlugins()&&(await c.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await c.executeLifecycle("execute",p),await c.executeLifecycle("beforeCommand",p);let l;if(r.global?.help){const d=this.#n.get("help");if(!d)throw new k("Help command not found","COMMAND_NOT_FOUND");l=await B(d,p,r)}else if(r.global?.version||r.global?.V){const d=this.#n.get("version");if(!d)throw new k("Version command not found","COMMAND_NOT_FOUND");l=await B(d,p,r)}else l=await B(s,p,r);return await c.executeLifecycle("afterCommand",p,l),l}catch(l){throw await c.executeErrorHandlers(l,p),l}}}export{go as Cli};
@@ -1 +0,0 @@
1
- var h=Object.defineProperty;var i=(s,t)=>h(s,"name",{value:t,configurable:!0});var m=Object.defineProperty,e=i((s,t)=>m(s,"name",{value:t,configurable:!0}),"i");const E=e(s=>s instanceof Error&&s.type==="VisulimaError","isVisulimaError");class V extends Error{static{i(this,"m")}static{e(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:a,message:o,name:c,stack:n,title:l}){super(o,{cause:t}),this.title=l,this.name=c,this.stack=n??this.stack,this.loc=a,this.hint=r}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{V as VisulimaError,E as isVisulimaError};
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});import{VisulimaError as c}from"./VisulimaError-rZ7cJo5A.js";var i=Object.defineProperty,n=t((e,r)=>i(e,"name",{value:r,configurable:!0}),"e");class b extends c{static{t(this,"c")}static{n(this,"CerebroError")}code;context;constructor(r,o,s){super({message:r,name:"CerebroError"}),this.code=o,this.context=s}}export{b as c};