pickety 0.2.3 → 0.3.0
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/.vscodeignore +6 -1
- package/README.md +35 -5
- package/out/cli.js +18 -17
- package/out/extension.js +21 -21
- package/package.json +3 -2
- package/resources/pickety.schema.json +93 -10
package/.vscodeignore
CHANGED
|
@@ -6,6 +6,8 @@ src/**
|
|
|
6
6
|
.yarnrc
|
|
7
7
|
vsc-extension-quickstart.md
|
|
8
8
|
GEMINI.md
|
|
9
|
+
AGENTS.md
|
|
10
|
+
CLAUDE.md
|
|
9
11
|
pickety.json
|
|
10
12
|
node_modules/**
|
|
11
13
|
out/**
|
|
@@ -20,4 +22,7 @@ fix-paths.js
|
|
|
20
22
|
**/*.ts
|
|
21
23
|
**/.vscode-test.*
|
|
22
24
|
picket-boundaries.mermaid
|
|
23
|
-
fixtures/**
|
|
25
|
+
fixtures/**
|
|
26
|
+
|
|
27
|
+
*-debug.log
|
|
28
|
+
*.log
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
Pickety is a VS Code extension that stops architecture erosion before it starts. Define your module boundaries once in a simple JSON file, and every illegal import lights up instantly -- right in your editor,
|
|
13
|
+
Pickety is a VS Code extension that stops architecture erosion before it starts. Define your module boundaries once in a simple JSON file, and every illegal import lights up instantly -- right in your editor, when you save. No more "we don't import that here" comments in code review. No more accidental coupling that quietly rots your codebase over months.
|
|
14
14
|
|
|
15
15
|
Zero runtime dependencies. Zero build steps. Just drop in a config and your entire team — and your AI coding agents — get a **real-time Senior Architect** sitting on their shoulder, enforcing the rules that actually matter.
|
|
16
16
|
|
|
@@ -70,6 +70,8 @@ ESLint's `no-restricted-imports` can block a handful of hard-coded paths. But th
|
|
|
70
70
|
- **On-save enforcement** -- violations appear instantly when you save, keeping feedback fast without noisy mid-keystroke diagnostics
|
|
71
71
|
- **Glob patterns** -- flexible module definitions using [minimatch](https://github.com/isaacs/minimatch) syntax
|
|
72
72
|
- **Interpolation variables** -- enforce scoped relationships like "route X can only import from feature X"
|
|
73
|
+
- **Architecture presets** -- bootstrap configs with built-in presets (`hexagonal`, `feature-modules`, `layered`)
|
|
74
|
+
- **CLI init** -- scaffold `pickety.json` from the terminal, optionally from a preset
|
|
73
75
|
- **Strict enforcement** -- use `only` and `containedTo` to restrict modules to specific consumers
|
|
74
76
|
- **Per-rule severity** -- mark some boundaries as hard errors and others as soft warnings
|
|
75
77
|
- **Debt tracking** -- set a `maxViolations` threshold per rule to adopt boundaries gradually in legacy codebases
|
|
@@ -81,7 +83,7 @@ ESLint's `no-restricted-imports` can block a handful of hard-coded paths. But th
|
|
|
81
83
|
- **Circular dependencies** -- auto-detect feedback loops between your modules
|
|
82
84
|
- **Quick fixes** -- jump directly to the rule in `pickety.json` from any violation
|
|
83
85
|
- **Status bar** -- always know whether Pickety is active and how many violations exist
|
|
84
|
-
- **CLI** -- `pickety check` for CI/CD pipelines,
|
|
86
|
+
- **CLI** -- `pickety check` for CI/CD pipelines, using the same rule logic as the IDE
|
|
85
87
|
- **JSON Schema** -- autocomplete and inline validation for `pickety.json`
|
|
86
88
|
- **No external dependencies** -- self-contained bundle requires zero `npm install` at runtime
|
|
87
89
|
- **Zero config beyond `pickety.json`** -- no build plugins, no complex environment to set up
|
|
@@ -98,6 +100,15 @@ ESLint's `no-restricted-imports` can block a handful of hard-coded paths. But th
|
|
|
98
100
|
|
|
99
101
|
This creates a `pickety.json` in your workspace root and opens it immediately. The generated file includes a starter module map and example rules — edit them to match your project structure.
|
|
100
102
|
|
|
103
|
+
You can also scaffold from the terminal:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pickety init
|
|
107
|
+
pickety init --preset layered
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
You can also set `"preset": "layered"` in `pickety.json` and then override `modules` or `rules`. Preset rules are appended to your own rules.
|
|
111
|
+
|
|
101
112
|
**3. Done.** Pickety activates automatically. Violations appear as red/yellow squiggles in the editor, in the Problems panel, and in the status bar.
|
|
102
113
|
|
|
103
114
|
> **Prefer writing it by hand?** Add a `pickety.json` to your workspace root. The JSON Schema (included via the `$schema` field in the generated file) provides autocomplete and inline validation as you type.
|
|
@@ -153,14 +164,17 @@ Each rule defines an import boundary between modules.
|
|
|
153
164
|
|
|
154
165
|
| Field | Type | Required | Description |
|
|
155
166
|
| ------------- | ------------------- | ----------- | ------------------------------------------------------------------------ |
|
|
156
|
-
| `imports` | `string`
|
|
167
|
+
| `imports` | `string \| string[]` | Yes | Target module name(s), glob(s), or file path pattern(s) |
|
|
157
168
|
| `importer` | `string` | Conditional | Source module name or glob pattern. Required unless using `containedTo`. |
|
|
158
169
|
| `allow` | `boolean` | No | `true` = permit, `false` = forbid. Default: `false` |
|
|
159
170
|
| `only` | `boolean` | No | `true` = the `imports` target can ONLY be used by this `importer`. |
|
|
160
171
|
| `containedTo` | `string \| object` | No | Shortcut for `only: true`. Restricts `imports` to this path pattern. Accepts a plain string or an object with `path` and optional `unless`. |
|
|
172
|
+
| `exports` | `object \| object[]` | No | Allowlist exceptions for `only`/`containedTo` (exported paths and allowed importers) |
|
|
161
173
|
| `message` | `string` | No | Custom diagnostic message shown in the editor |
|
|
162
174
|
| `severity` | `string` | No | `"error"` or `"warn"`. Overrides the global severity |
|
|
163
175
|
| `name` | `string` | No | Rule identifier. Shown in diagnostics and quick fix labels |
|
|
176
|
+
| `group` | `string` | No | Optional group label for diagnostics and CLI summaries |
|
|
177
|
+
| `maxViolations` | `integer` | No | Debt threshold: violations at/below the count are downgraded to warnings |
|
|
164
178
|
|
|
165
179
|
### Glob Patterns
|
|
166
180
|
|
|
@@ -245,11 +259,27 @@ Use `$variable` placeholders to enforce that path segments match between the imp
|
|
|
245
259
|
|
|
246
260
|
With this rule, `routes/auth/index.ts` can import from `features/auth/pages/` but **not** from `features/billing/pages/`.
|
|
247
261
|
|
|
262
|
+
### Export Allowlist (`exports`)
|
|
263
|
+
|
|
264
|
+
Use `exports` to allow specific paths to be imported by specific modules even when `only` or `containedTo` would block them.
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"imports": "features/$name/**",
|
|
269
|
+
"containedTo": "features/$name/**",
|
|
270
|
+
"exports": {
|
|
271
|
+
"path": "features/$name/pages/**",
|
|
272
|
+
"to": "app",
|
|
273
|
+
"message": "Only feature pages are public to the app."
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
248
278
|
---
|
|
249
279
|
|
|
250
280
|
## Boundary Diagrams
|
|
251
281
|
|
|
252
|
-
Pickety can auto-generate a [Mermaid](https://mermaid.js.org/) diagram of your module boundaries. Modules are clustered by their top-level path segment, with edges labeled by rule action and name.
|
|
282
|
+
Pickety can auto-generate a [Mermaid](https://mermaid.js.org/) diagram of your module boundaries. Modules are clustered by their top-level path segment, with edges labeled by rule action and name. Diagrams are generated when the config is saved or via the **Pickety: Generate Boundary Diagram** command.
|
|
253
283
|
|
|
254
284
|
Add this to your `pickety.json`:
|
|
255
285
|
|
|
@@ -297,7 +327,7 @@ View these metrics anytime using **Pickety: Show Module Health**, or enforce pro
|
|
|
297
327
|
The Module Health feature provides two interfaces depending on who is using it:
|
|
298
328
|
|
|
299
329
|
- **For Humans:** Running the VS Code command opens a clean, color-coded HTML Webview panel. The table highlights healthy modules in green and unstable or problematic modules in red, making it easy to spot architectural issues at a glance.
|
|
300
|
-
- **For AI Agents:** Running
|
|
330
|
+
- **For AI Agents:** Running `pickety health` outputs a clean, ASCII-formatted table directly to stdout. This allows agents to ingest the current state of your architecture and make informed decisions about where to place new code or when refactoring is needed.
|
|
301
331
|
|
|
302
332
|
```json
|
|
303
333
|
{
|
package/out/cli.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`;break;case 114:m+="\r";break;case 116:m+=" ";break;case 117:let
|
|
4
|
-
`),c++,
|
|
5
|
-
`+" ".repeat(t)),"\r":new Array(
|
|
6
|
-
`+" ".repeat(t))}," ":{"\n":new Array(
|
|
7
|
-
`+" ".repeat(t)),"\r":new Array(
|
|
8
|
-
`+" ".repeat(t))}};var C;(function(e){e.DEFAULT={allowTrailingComma:!1}})(C||(C={}));function Oe(e,t=[],s=C.DEFAULT){let n=null,i=[],r=[];function o(l){Array.isArray(i)?i.push(l):n!==null&&(i[n]=l)}return $e(e,{onObjectBegin:()=>{let l={};o(l),r.push(i),i=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{i=r.pop()},onArrayBegin:()=>{let l=[];o(l),r.push(i),i=l,n=null},onArrayEnd:()=>{i=r.pop()},onLiteralValue:o,onError:(l,a,u)=>{t.push({error:l,offset:a,length:u})}},s),i[0]}function $e(e,t,s=C.DEFAULT){let n=K(e,!1),i=[],r=0;function o(k){return k?()=>r===0&&k(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(k){return k?E=>r===0&&k(E,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(k){return k?E=>r===0&&k(E,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice()):()=>!0}function a(k){return k?()=>{r>0?r++:k(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice())===!1&&(r=1)}:()=>!0}function u(k){return k?()=>{r>0&&r--,r===0&&k(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let f=a(t.onObjectBegin),h=l(t.onObjectProperty),p=u(t.onObjectEnd),g=a(t.onArrayBegin),d=u(t.onArrayEnd),b=l(t.onLiteralValue),T=c(t.onSeparator),O=o(t.onComment),m=c(t.onError),S=s&&s.disallowComments,x=s&&s.allowTrailingComma;function w(){for(;;){let k=n.scan();switch(n.getTokenError()){case 4:y(14);break;case 5:y(15);break;case 3:y(13);break;case 1:S||y(11);break;case 2:y(12);break;case 6:y(16);break}switch(k){case 12:case 13:S?y(10):O();break;case 16:y(1);break;case 15:case 14:break;default:return k}}}function y(k,E=[],Te=[]){if(m(k),E.length+Te.length>0){let Y=n.getToken();for(;Y!==17;){if(E.indexOf(Y)!==-1){w();break}else if(Te.indexOf(Y)!==-1)break;Y=w()}}}function xe(k){let E=n.getTokenValue();return k?b(E):(h(E),i.push(E)),w(),!0}function xt(){switch(n.getToken()){case 11:let k=n.getTokenValue(),E=Number(k);isNaN(E)&&(y(2),E=0),b(E);break;case 7:b(null);break;case 8:b(!0);break;case 9:b(!1);break;default:return!1}return w(),!0}function Tt(){return n.getToken()!==10?(y(3,[],[2,5]),!1):(xe(!1),n.getToken()===6?(T(":"),w(),le()||y(4,[],[2,5])):y(5,[],[2,5]),i.pop(),!0)}function vt(){f(),w();let k=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(k||y(4,[],[]),T(","),w(),n.getToken()===2&&x)break}else k&&y(6,[],[]);Tt()||y(4,[],[2,5]),k=!0}return p(),n.getToken()!==2?y(7,[2],[]):w(),!0}function Et(){g(),w();let k=!0,E=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(E||y(4,[],[]),T(","),w(),n.getToken()===4&&x)break}else E&&y(6,[],[]);k?(i.push(0),k=!1):i[i.length-1]++,le()||y(4,[],[4,5]),E=!0}return d(),k||i.pop(),n.getToken()!==4?y(8,[4],[]):w(),!0}function le(){switch(n.getToken()){case 3:return Et();case 1:return vt();case 10:return xe(!0);default:return xt()}}return w(),n.getToken()===17?s.allowEmptyContent?!0:(y(4,[],[]),!1):le()?(n.getToken()!==17&&y(9,[],[]),!0):(y(4,[],[]),!1)}var Ae;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Ae||(Ae={}));var Ne;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Ne||(Ne={}));var ee=Oe;var Re;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(Re||(Re={}));var ge=j(require("path"));var ae=(e,t,s)=>{let n=e instanceof RegExp?Ie(e,s):e,i=t instanceof RegExp?Ie(t,s):t,r=n!==null&&i!=null&&Wt(n,i,s);return r&&{start:r[0],end:r[1],pre:s.slice(0,r[0]),body:s.slice(r[0]+n.length,r[1]),post:s.slice(r[1]+i.length)}},Ie=(e,t)=>{let s=t.match(e);return s?s[0]:null},Wt=(e,t,s)=>{let n,i,r,o,c,l=s.indexOf(e),a=s.indexOf(t,l+1),u=l;if(l>=0&&a>0){if(e===t)return[l,a];for(n=[],r=s.length;u>=0&&!c;){if(u===l)n.push(u),l=s.indexOf(e,u+1);else if(n.length===1){let f=n.pop();f!==void 0&&(c=[f,a])}else i=n.pop(),i!==void 0&&i<r&&(r=i,o=a),a=s.indexOf(t,u+1);u=l<a&&l>=0?l:a}n.length&&o!==void 0&&(c=[r,o])}return c};var Le="\0SLASH"+Math.random()+"\0",Me="\0OPEN"+Math.random()+"\0",ue="\0CLOSE"+Math.random()+"\0",Ve="\0COMMA"+Math.random()+"\0",Be="\0PERIOD"+Math.random()+"\0",zt=new RegExp(Le,"g"),Ut=new RegExp(Me,"g"),Ht=new RegExp(ue,"g"),Gt=new RegExp(Ve,"g"),qt=new RegExp(Be,"g"),Xt=/\\\\/g,Jt=/\\{/g,Zt=/\\}/g,Qt=/\\,/g,Yt=/\\./g,Kt=1e5;function fe(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Ct(e){return e.replace(Xt,Le).replace(Jt,Me).replace(Zt,ue).replace(Qt,Ve).replace(Yt,Be)}function en(e){return e.replace(zt,"\\").replace(Ut,"{").replace(Ht,"}").replace(Gt,",").replace(qt,".")}function _e(e){if(!e)return[""];let t=[],s=ae("{","}",e);if(!s)return e.split(",");let{pre:n,body:i,post:r}=s,o=n.split(",");o[o.length-1]+="{"+i+"}";let c=_e(r);return r.length&&(o[o.length-1]+=c.shift(),o.push.apply(o,c)),t.push.apply(t,o),t}function De(e,t={}){if(!e)return[];let{max:s=Kt}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),G(Ct(e),s,!0).map(en)}function tn(e){return"{"+e+"}"}function nn(e){return/^-?0\d/.test(e)}function sn(e,t){return e<=t}function rn(e,t){return e>=t}function G(e,t,s){let n=[],i=ae("{","}",e);if(!i)return[e];let r=i.pre,o=i.post.length?G(i.post,t,!1):[""];if(/\$$/.test(i.pre))for(let c=0;c<o.length&&c<t;c++){let l=r+"{"+i.body+"}"+o[c];n.push(l)}else{let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),a=c||l,u=i.body.indexOf(",")>=0;if(!a&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+"{"+i.body+ue+i.post,G(e,t,!0)):[e];let f;if(a)f=i.body.split(/\.\./);else if(f=_e(i.body),f.length===1&&f[0]!==void 0&&(f=G(f[0],t,!1).map(tn),f.length===1))return o.map(p=>i.pre+f[0]+p);let h;if(a&&f[0]!==void 0&&f[1]!==void 0){let p=fe(f[0]),g=fe(f[1]),d=Math.max(f[0].length,f[1].length),b=f.length===3&&f[2]!==void 0?Math.abs(fe(f[2])):1,T=sn;g<p&&(b*=-1,T=rn);let m=f.some(nn);h=[];for(let S=p;T(S,g);S+=b){let x;if(l)x=String.fromCharCode(S),x==="\\"&&(x="");else if(x=String(S),m){let w=d-x.length;if(w>0){let y=new Array(w+1).join("0");S<0?x="-"+y+x.slice(1):x=y+x}}h.push(x)}}else{h=[];for(let p=0;p<f.length;p++)h.push.apply(h,G(f[p],t,!1))}for(let p=0;p<h.length;p++)for(let g=0;g<o.length&&n.length<t;g++){let d=r+h[p]+o[g];(!s||a||d)&&n.push(d)}}return n}var q=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var on={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},X=e=>e.replace(/[[\]\\-]/g,"\\$&"),ln=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Fe=e=>e.join(""),Pe=(e,t)=>{let s=t;if(e.charAt(s)!=="[")throw new Error("not in a brace expression");let n=[],i=[],r=s+1,o=!1,c=!1,l=!1,a=!1,u=s,f="";e:for(;r<e.length;){let d=e.charAt(r);if((d==="!"||d==="^")&&r===s+1){a=!0,r++;continue}if(d==="]"&&o&&!l){u=r+1;break}if(o=!0,d==="\\"&&!l){l=!0,r++;continue}if(d==="["&&!l){for(let[b,[T,O,m]]of Object.entries(on))if(e.startsWith(b,r)){if(f)return["$.",!1,e.length-s,!0];r+=b.length,m?i.push(T):n.push(T),c=c||O;continue e}}if(l=!1,f){d>f?n.push(X(f)+"-"+X(d)):d===f&&n.push(X(d)),f="",r++;continue}if(e.startsWith("-]",r+1)){n.push(X(d+"-")),r+=2;continue}if(e.startsWith("-",r+1)){f=d,r+=2;continue}n.push(X(d)),r++}if(u<r)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-s,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!a){let d=n[0].length===2?n[0].slice(-1):n[0];return[ln(d),!1,u-s,!1]}let h="["+(a?"^":"")+Fe(n)+"]",p="["+(a?"":"^")+Fe(i)+"]";return[n.length&&i.length?"("+h+"|"+p+")":n.length?h:p,c,u-s,!0]};var I=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!0}={})=>s?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var cn=new Set(["!","?","+","*","@"]),We=e=>cn.has(e),an="(?!(?:^|/)\\.\\.?(?:$|/))",te="(?!\\.)",fn=new Set(["[","."]),un=new Set(["..","."]),pn=new Set("().*{}+?[]^$\\!"),hn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),pe="[^/]",ze=pe+"*?",Ue=pe+"+?",W=class e{type;#n;#s;#r=!1;#e=[];#t;#o;#c;#l=!1;#i;#a;#u=!1;constructor(t,s,n={}){this.type=t,t&&(this.#s=!0),this.#t=s,this.#n=this.#t?this.#t.#n:this,this.#i=this.#n===this?n:this.#n.#i,this.#c=this.#n===this?[]:this.#n.#c,t==="!"&&!this.#n.#l&&this.#c.push(this),this.#o=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#s!==void 0)return this.#s;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#s=!0;return this.#s}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#a=this.#e.map(t=>String(t)).join("")}#h(){if(this!==this.#n)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let t;for(;t=this.#c.pop();){if(t.type!=="!")continue;let s=t,n=s.#t;for(;n;){for(let i=s.#o+1;!n.type&&i<n.#e.length;i++)for(let r of t.#e){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(n.#e[i])}s=n,n=s.#t}}return this}push(...t){for(let s of t)if(s!==""){if(typeof s!="string"&&!(s instanceof e&&s.#t===this))throw new Error("invalid part: "+s);this.#e.push(s)}}toJSON(){let t=this.type===null?this.#e.slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...this.#e.map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#l&&this.#t?.type==="!")&&t.push({}),t}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#o===0)return!0;let t=this.#t;for(let s=0;s<this.#o;s++){let n=t.#e[s];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let t=this.#t?this.#t.#e.length:0;return this.#o===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let s=new e(this.type,t);for(let n of this.#e)s.copyIn(n);return s}static#f(t,s,n,i){let r=!1,o=!1,c=-1,l=!1;if(s.type===null){let p=n,g="";for(;p<t.length;){let d=t.charAt(p++);if(r||d==="\\"){r=!r,g+=d;continue}if(o){p===c+1?(d==="^"||d==="!")&&(l=!0):d==="]"&&!(p===c+2&&l)&&(o=!1),g+=d;continue}else if(d==="["){o=!0,c=p,l=!1,g+=d;continue}if(!i.noext&&We(d)&&t.charAt(p)==="("){s.push(g),g="";let b=new e(d,s);p=e.#f(t,b,p,i),s.push(b);continue}g+=d}return s.push(g),p}let a=n+1,u=new e(null,s),f=[],h="";for(;a<t.length;){let p=t.charAt(a++);if(r||p==="\\"){r=!r,h+=p;continue}if(o){a===c+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(a===c+2&&l)&&(o=!1),h+=p;continue}else if(p==="["){o=!0,c=a,l=!1,h+=p;continue}if(We(p)&&t.charAt(a)==="("){u.push(h),h="";let g=new e(p,u);u.push(g),a=e.#f(t,g,a,i);continue}if(p==="|"){u.push(h),h="",f.push(u),u=new e(null,s);continue}if(p===")")return h===""&&s.#e.length===0&&(s.#u=!0),u.push(h),h="",s.push(...f,u),a;h+=p}return s.type=null,s.#s=void 0,s.#e=[t.substring(n-1)],a}static fromGlob(t,s={}){let n=new e(null,void 0,s);return e.#f(t,n,0,s),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let t=this.toString(),[s,n,i,r]=this.toRegExpSource();if(!(i||this.#s||this.#i.nocase&&!this.#i.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let c=(this.#i.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${s}$`,c),{_src:s,_glob:t})}get options(){return this.#i}toRegExpSource(t){let s=t??!!this.#i.dot;if(this.#n===this&&this.#h(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#e.some(p=>typeof p!="string"),a=this.#e.map(p=>{let[g,d,b,T]=typeof p=="string"?e.#g(p,this.#s,l):p.toRegExpSource(t);return this.#s=this.#s||b,this.#r=this.#r||T,g}).join(""),u="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&un.has(this.#e[0]))){let g=fn,d=s&&g.has(a.charAt(0))||a.startsWith("\\.")&&g.has(a.charAt(2))||a.startsWith("\\.\\.")&&g.has(a.charAt(4)),b=!s&&!t&&g.has(a.charAt(0));u=d?an:b?te:""}let f="";return this.isEnd()&&this.#n.#l&&this.#t?.type==="!"&&(f="(?:$|\\/)"),[u+a+f,I(a),this.#s=!!this.#s,this.#r]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=this.#p(s);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let l=this.toString();return this.#e=[l],this.type=null,this.#s=void 0,[l,I(this.toString()),!1,!1]}let o=!n||t||s||!te?"":this.#p(!0);o===r&&(o=""),o&&(r=`(?:${r})(?:${o})*?`);let c="";if(this.type==="!"&&this.#u)c=(this.isStart()&&!s?te:"")+Ue;else{let l=this.type==="!"?"))"+(this.isStart()&&!s&&!t?te:"")+ze+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;c=i+r+l}return[c,I(r),this.#s=!!this.#s,this.#r]}#p(t){return this.#e.map(s=>{if(typeof s=="string")throw new Error("string type in extglob ast??");let[n,i,r,o]=s.toRegExpSource(t);return this.#r=this.#r||o,n}).filter(s=>!(this.isStart()&&this.isEnd())||!!s).join("|")}static#g(t,s,n=!1){let i=!1,r="",o=!1,c=!1;for(let l=0;l<t.length;l++){let a=t.charAt(l);if(i){i=!1,r+=(pn.has(a)?"\\":"")+a;continue}if(a==="*"){if(c)continue;c=!0,r+=n&&/^[*]+$/.test(t)?Ue:ze,s=!0;continue}else c=!1;if(a==="\\"){l===t.length-1?r+="\\\\":i=!0;continue}if(a==="["){let[u,f,h,p]=Pe(t,l);if(h){r+=u,o=o||f,l+=h-1,s=s||p;continue}}if(a==="?"){r+=pe,s=!0;continue}r+=hn(a)}return[r,I(t),!!s,o]}};var he=(e,{windowsPathsNoEscape:t=!1,magicalBraces:s=!1}={})=>s?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var v=(e,t,s={})=>(q(t),!s.nocomment&&t.charAt(0)==="#"?!1:new z(t,s).match(e)),gn=/^\*+([^+@!?\*\[\(]*)$/,dn=e=>t=>!t.startsWith(".")&&t.endsWith(e),mn=e=>t=>t.endsWith(e),yn=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),bn=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),kn=/^\*+\.\*+$/,wn=e=>!e.startsWith(".")&&e.includes("."),Sn=e=>e!=="."&&e!==".."&&e.includes("."),xn=/^\.\*+$/,Tn=e=>e!=="."&&e!==".."&&e.startsWith("."),vn=/^\*+$/,En=e=>e.length!==0&&!e.startsWith("."),On=e=>e.length!==0&&e!=="."&&e!=="..",$n=/^\?+([^+@!?\*\[\(]*)?$/,An=([e,t=""])=>{let s=qe([e]);return t?(t=t.toLowerCase(),n=>s(n)&&n.toLowerCase().endsWith(t)):s},Nn=([e,t=""])=>{let s=Xe([e]);return t?(t=t.toLowerCase(),n=>s(n)&&n.toLowerCase().endsWith(t)):s},Rn=([e,t=""])=>{let s=Xe([e]);return t?n=>s(n)&&n.endsWith(t):s},jn=([e,t=""])=>{let s=qe([e]);return t?n=>s(n)&&n.endsWith(t):s},qe=([e])=>{let t=e.length;return s=>s.length===t&&!s.startsWith(".")},Xe=([e])=>{let t=e.length;return s=>s.length===t&&s!=="."&&s!==".."},Je=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",He={win32:{sep:"\\"},posix:{sep:"/"}},In=Je==="win32"?He.win32.sep:He.posix.sep;v.sep=In;var R=Symbol("globstar **");v.GLOBSTAR=R;var Ln="[^/]",Mn=Ln+"*?",Vn="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",Bn="(?:(?!(?:\\/|^)\\.).)*?",_n=(e,t={})=>s=>v(s,e,t);v.filter=_n;var N=(e,t={})=>Object.assign({},e,t),Dn=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return v;let t=v;return Object.assign((n,i,r={})=>t(n,i,N(e,r)),{Minimatch:class extends t.Minimatch{constructor(i,r={}){super(i,N(e,r))}static defaults(i){return t.defaults(N(e,i)).Minimatch}},AST:class extends t.AST{constructor(i,r,o={}){super(i,r,N(e,o))}static fromGlob(i,r={}){return t.AST.fromGlob(i,N(e,r))}},unescape:(n,i={})=>t.unescape(n,N(e,i)),escape:(n,i={})=>t.escape(n,N(e,i)),filter:(n,i={})=>t.filter(n,N(e,i)),defaults:n=>t.defaults(N(e,n)),makeRe:(n,i={})=>t.makeRe(n,N(e,i)),braceExpand:(n,i={})=>t.braceExpand(n,N(e,i)),match:(n,i,r={})=>t.match(n,i,N(e,r)),sep:t.sep,GLOBSTAR:R})};v.defaults=Dn;var Ze=(e,t={})=>(q(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:De(e,{max:t.braceExpandMax}));v.braceExpand=Ze;var Fn=(e,t={})=>new z(e,t).makeRe();v.makeRe=Fn;var Pn=(e,t,s={})=>{let n=new z(t,s);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e};v.match=Pn;var Ge=/[?*]|[+@!]\(.*?\)|\[|\]/,Wn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),z=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,s={}){q(t),s=s||{},this.options=s,this.pattern=t,this.platform=s.platform||Je,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!s.windowsPathsNoEscape||s[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!s.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!s.nonegate,this.comment=!1,this.empty=!1,this.partial=!!s.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=s.windowsNoMagicRoot!==void 0?s.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let s of t)if(typeof s!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,s=this.options;if(!s.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],s.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,o,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=r[0]===""&&r[1]===""&&(r[2]==="?"||!Ge.test(r[2]))&&!Ge.test(r[3]),a=/^[a-z]:/i.test(r[0]);if(l)return[...r.slice(0,4),...r.slice(4).map(u=>this.parse(u))];if(a)return[r[0],...r.slice(1).map(u=>this.parse(u))]}return r.map(l=>this.parse(l))});if(this.debug(this.pattern,i),this.set=i.filter(r=>r.indexOf(!1)===-1),this.isWindows)for(let r=0;r<this.set.length;r++){let o=this.set[r];o[0]===""&&o[1]===""&&this.globParts[r][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let i=0;i<t[n].length;i++)t[n][i]==="**"&&(t[n][i]="*");let{optimizationLevel:s=1}=this.options;return s>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):s>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(s=>{let n=-1;for(;(n=s.indexOf("**",n+1))!==-1;){let i=n;for(;s[i+1]==="**";)i++;i!==n&&s.splice(n,i-n)}return s})}levelOneOptimize(t){return t.map(s=>(s=s.reduce((n,i)=>{let r=n[n.length-1];return i==="**"&&r==="**"?n:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(n.pop(),n):(n.push(i),n)},[]),s.length===0?[""]:s))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let s=!1;do{if(s=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let r=t[i];i===1&&r===""&&t[0]===""||(r==="."||r==="")&&(s=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(s=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(s=!0,t.splice(n-1,2),n-=2)}}while(s);return t.length===0?[""]:t}firstPhasePreProcess(t){let s=!1;do{s=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let c=n[i+1],l=n[i+2],a=n[i+3];if(c!==".."||!l||l==="."||l===".."||!a||a==="."||a==="..")continue;s=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let c=n[o];o===1&&c===""&&n[0]===""||(c==="."||c==="")&&(s=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(s=!0,n.pop())}let r=0;for(;(r=n.indexOf("..",r+1))!==-1;){let o=n[r-1];if(o&&o!=="."&&o!==".."&&o!=="**"){s=!0;let l=r===1&&n[r+1]==="**"?["."]:[];n.splice(r-1,2,...l),n.length===0&&n.push(""),r-=2}}}}while(s);return t}secondPhasePreProcess(t){for(let s=0;s<t.length-1;s++)for(let n=s+1;n<t.length;n++){let i=this.partsMatch(t[s],t[n],!this.preserveMultipleSlashes);if(i){t[s]=[],t[n]=i;break}}return t.filter(s=>s.length)}partsMatch(t,s,n=!1){let i=0,r=0,o=[],c="";for(;i<t.length&&r<s.length;)if(t[i]===s[r])o.push(c==="b"?s[r]:t[i]),i++,r++;else if(n&&t[i]==="**"&&s[r]===t[i+1])o.push(t[i]),i++;else if(n&&s[r]==="**"&&t[i]===s[r+1])o.push(s[r]),r++;else if(t[i]==="*"&&s[r]&&(this.options.dot||!s[r].startsWith("."))&&s[r]!=="**"){if(c==="b")return!1;c="a",o.push(t[i]),i++,r++}else if(s[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(c==="a")return!1;c="b",o.push(s[r]),i++,r++}else return!1;return t.length===s.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,s=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)s=!s,n++;n&&(this.pattern=t.slice(n)),this.negate=s}matchOne(t,s,n=!1){let i=this.options;if(this.isWindows){let d=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),b=!d&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),T=typeof s[0]=="string"&&/^[a-z]:$/i.test(s[0]),O=!T&&s[0]===""&&s[1]===""&&s[2]==="?"&&typeof s[3]=="string"&&/^[a-z]:$/i.test(s[3]),m=b?3:d?0:void 0,S=O?3:T?0:void 0;if(typeof m=="number"&&typeof S=="number"){let[x,w]=[t[m],s[S]];x.toLowerCase()===w.toLowerCase()&&(s[S]=x,S>m?s=s.slice(S):m>S&&(t=t.slice(m)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:s}),this.debug("matchOne",t.length,s.length);for(var o=0,c=0,l=t.length,a=s.length;o<l&&c<a;o++,c++){this.debug("matchOne loop");var u=s[c],f=t[o];if(this.debug(s,u,f),u===!1)return!1;if(u===R){this.debug("GLOBSTAR",[s,u,f]);var h=o,p=c+1;if(p===a){for(this.debug("** at the end");o<l;o++)if(t[o]==="."||t[o]===".."||!i.dot&&t[o].charAt(0)===".")return!1;return!0}for(;h<l;){var g=t[h];if(this.debug(`
|
|
9
|
-
globstar while`,t,
|
|
10
|
-
>>> no match, partial?`,t,h,s,p),h===l))}let d;if(typeof u=="string"?(d=f===u,this.debug("string match",u,f,d)):(d=u.test(f),this.debug("pattern match",u,f,d)),!d)return!1}if(o===l&&c===a)return!0;if(o===l)return n;if(c===a)return o===l-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return Ze(this.pattern,this.options)}parse(t){q(t);let s=this.options;if(t==="**")return R;if(t==="")return"";let n,i=null;(n=t.match(vn))?i=s.dot?On:En:(n=t.match(gn))?i=(s.nocase?s.dot?bn:yn:s.dot?mn:dn)(n[1]):(n=t.match($n))?i=(s.nocase?s.dot?Nn:An:s.dot?Rn:jn)(n):(n=t.match(kn))?i=s.dot?Sn:wn:(n=t.match(xn))&&(i=Tn);let r=W.fromGlob(t,this.options).toMMPattern();return i&&typeof r=="object"&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let s=this.options,n=s.noglobstar?Mn:s.dot?Vn:Bn,i=new Set(s.nocase?["i"]:[]),r=t.map(l=>{let a=l.map(f=>{if(f instanceof RegExp)for(let h of f.flags.split(""))i.add(h);return typeof f=="string"?Wn(f):f===R?R:f._src});a.forEach((f,h)=>{let p=a[h+1],g=a[h-1];f!==R||g===R||(g===void 0?p!==void 0&&p!==R?a[h+1]="(?:\\/|"+n+"\\/)?"+p:a[h]=n:p===void 0?a[h-1]=g+"(?:\\/|\\/"+n+")?":p!==R&&(a[h-1]=g+"(?:\\/|\\/"+n+"\\/)"+p,a[h+1]=R))});let u=a.filter(f=>f!==R);if(this.partial&&u.length>=1){let f=[];for(let h=1;h<=u.length;h++)f.push(u.slice(0,h).join("/"));return"(?:"+f.join("|")+")"}return u.join("/")}).join("|"),[o,c]=t.length>1?["(?:",")"]:["",""];r="^"+o+r+c+"$",this.partial&&(r="^(?:\\/|"+o+r.slice(1,-1)+c+")$"),this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,s=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&s)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let r=this.set;this.debug(this.pattern,"set",r);let o=i[i.length-1];if(!o)for(let c=i.length-2;!o&&c>=0;c--)o=i[c];for(let c=0;c<r.length;c++){let l=r[c],a=i;if(n.matchBase&&l.length===1&&(a=[o]),this.matchOne(a,l,s))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return v.defaults(t).Minimatch}};v.AST=W;v.Minimatch=z;v.escape=he;v.unescape=I;var de="pickety.json",U=["ts","tsx","js","jsx","mjs","cjs"],zn=`**/*.{${U.join(",")}}`,ne=new Set(["node_modules",".git",".next","dist","out","build",".turbo",".cache",".nx","coverage"]);function $(e){let t=e.replace(/\\/g,"/");return/^[a-zA-Z]:/.test(t)&&(t=t[0].toLowerCase()+t.slice(1)),t}function J(e,t){return ge.relative(e,t).replace(/\\/g,"/")}function Qe(e,t){return v(e,t)||e===t}function se(e,t){return e==="instability"?t.toFixed(2):String(t)}function Ye(e,t,s){let n=me(e);return{allow:e.allow??!1,severity:e.severity??s,name:e.name??`rule[${t}]`,effectiveImporter:n?.path||e.importer||"*",isOnly:e.only||!!e.containedTo,isAllowStyle:(e.allow??!1)||!!e.containedTo||e.only}}function L(e,t,s){return!!(Qe(e,s)||s.includes("/")&&(v(t,s)||v(t,`**/${s}`)||v(t,`**/${s}/**`)))}function me(e){if(e.containedTo)return typeof e.containedTo=="object"?e.containedTo:{path:e.containedTo}}function B(e,t,s,n,i,r,o){return{file:e,line:t.line,character:t.character,length:t.length,message:`[${s}] ${n} (importing "${t.specifier}")`,severity:i,ruleName:s,sourceModule:r,targetModule:o}}function Ke(e){let t=[],s=new Set,n=new Set,i=[];function r(o){s.add(o),n.add(o),i.push(o);let c=e.get(o);if(c){for(let l of c)if(!s.has(l))r(l);else if(n.has(l)){let a=i.indexOf(l);a!==-1&&t.push([...i.slice(a),l])}}n.delete(o),i.pop()}for(let o of e.keys())s.has(o)||r(o);return t}function Ce(e,t,s,n){if(typeof e.containedTo=="object"&&e.containedTo!==null){let i=e.containedTo;if(typeof i.path!="string"&&n.push({message:`Rule #${t}: "containedTo.path" is required and must be a string`,path:`${s}.containedTo.path`}),i.unless!==void 0)if(typeof i.unless!="object"||i.unless===null||Array.isArray(i.unless))n.push({message:`Rule #${t}: "containedTo.unless" must be an object`,path:`${s}.containedTo.unless`});else{let r=i.unless;Object.keys(r).length===0&&n.push({message:`Rule #${t}: "containedTo.unless" must not be empty`,path:`${s}.containedTo.unless`}),typeof e.imports=="string"&&!e.imports.match(/\$[\w-]+/)&&n.push({message:`Rule #${t}: "containedTo.unless" requires "imports" to contain at least one $variable`,path:`${s}.containedTo.unless`});for(let[c,l]of Object.entries(r))c.startsWith("$")||n.push({message:`Rule #${t}: "containedTo.unless" key "${c}" must start with $`,path:`${s}.containedTo.unless`}),typeof l!="string"&&n.push({message:`Rule #${t}: "containedTo.unless.${c}" must be a string`,path:`${s}.containedTo.unless.${c}`})}}else typeof e.containedTo!="string"&&n.push({message:`Rule #${t}: "containedTo" must be a string or object with a "path" property`,path:`${s}.containedTo`})}function et(e,t){if(e===void 0){t.push({message:'"rules" is required and must be an object',path:"rules"});return}if(typeof e!="object"||e===null){t.push({message:'"rules" must be an object',path:"rules"});return}let n=e["module-boundaries"];if(n===void 0){t.push({message:'"rules.module-boundaries" is required and must be an object',path:"rules.module-boundaries"});return}if(typeof n!="object"||n===null){t.push({message:'"rules.module-boundaries" must be an object',path:"rules.module-boundaries"});return}let i=n,r="error";if(i.severity!==void 0&&(i.severity!=="error"&&i.severity!=="warn"?t.push({message:`"rules.module-boundaries.severity" must be "error" or "warn", got "${i.severity}"`,path:"rules.module-boundaries.severity"}):r=i.severity),i.rules===void 0){t.push({message:'"rules.module-boundaries.rules" is required and must be an array',path:"rules.module-boundaries.rules"});return}if(!Array.isArray(i.rules)){t.push({message:'"rules.module-boundaries.rules" must be an array',path:"rules.module-boundaries.rules"});return}let o=[];return i.rules.forEach((c,l)=>{let a=`rules.module-boundaries.rules[${l}]`;if(typeof c!="object"||c===null){t.push({message:`Rule #${l} must be an object`,path:a});return}let u=c,f=typeof u.containedTo=="string"||typeof u.containedTo=="object"&&u.containedTo!==null;typeof u.importer!="string"&&!f&&t.push({message:`Rule #${l}: "importer" or "containedTo" is required`,path:a}),u.importer!==void 0&&typeof u.importer!="string"&&t.push({message:`Rule #${l}: "importer" must be a string`,path:`${a}.importer`}),typeof u.imports!="string"&&t.push({message:`Rule #${l}: "imports" is required and must be a string`,path:`${a}.imports`}),u.allow!==void 0&&typeof u.allow!="boolean"&&t.push({message:`Rule #${l}: "allow" must be a boolean`,path:`${a}.allow`}),u.only!==void 0&&typeof u.only!="boolean"&&t.push({message:`Rule #${l}: "only" must be a boolean`,path:`${a}.only`}),u.containedTo!==void 0&&Ce(u,l,a,t),u.message!==void 0&&typeof u.message!="string"&&t.push({message:`Rule #${l}: "message" must be a string`,path:`${a}.message`}),u.severity!==void 0&&u.severity!=="error"&&u.severity!=="warn"&&t.push({message:`Rule #${l}: "severity" must be "error" or "warn", got "${u.severity}"`,path:`${a}.severity`}),u.name!==void 0&&typeof u.name!="string"&&t.push({message:`Rule #${l}: "name" must be a string`,path:`${a}.name`}),u.maxViolations!==void 0&&(typeof u.maxViolations!="number"||!Number.isInteger(u.maxViolations)||u.maxViolations<0)&&t.push({message:`Rule #${l}: "maxViolations" must be a non-negative integer`,path:`${a}.maxViolations`}),o.push(u)}),{severity:r,rules:o}}function tt(e,t){if(e===void 0)return;if(typeof e!="object"||e===null){t.push({message:'"health" must be an object',path:"health"});return}let s=e,n={},i=[{key:"maxAfferentCoupling",label:"maxAfferentCoupling"},{key:"maxEfferentCoupling",label:"maxEfferentCoupling"},{key:"maxDepth",label:"maxDepth"}];for(let{key:r,label:o}of i){let c=s[r];c!==void 0&&(typeof c!="number"||!Number.isInteger(c)||c<1?t.push({message:`"health.${o}" must be a positive integer`,path:`health.${o}`}):n[r]=c)}if(s.maxInstability!==void 0){let r=s.maxInstability;typeof r!="number"||r<0||r>1?t.push({message:'"health.maxInstability" must be a number between 0 and 1',path:"health.maxInstability"}):n.maxInstability=r}return Object.keys(n).length>0?n:void 0}function nt(e){let t=[];if(typeof e!="object"||e===null)return{ok:!1,errors:[{message:"Configuration must be a JSON object"}]};let s=e,n=Un(s.modules,t),i=et(s.rules,t),r=Hn(s["boundary-diagrams"],t),o=tt(s.health,t);return t.length>0||!n||!i?{ok:!1,errors:t}:{ok:!0,config:{modules:n,rules:{"module-boundaries":i},"boundary-diagrams":r,health:o}}}function Un(e,t){if(e===void 0){t.push({message:'"modules" is required and must be an object',path:"modules"});return}if(typeof e!="object"||e===null){t.push({message:'"modules" must be an object mapping module names to patterns',path:"modules"});return}let s={};for(let[n,i]of Object.entries(e))typeof i!="string"?t.push({message:`Module "${n}" pattern must be a string, got ${typeof i}`,path:`modules.${n}`}):s[n]=i;return s}function Hn(e,t){if(e!==void 0){if(typeof e!="boolean"&&typeof e!="string"){t.push({message:'"boundary-diagrams" must be a boolean or a string',path:"boundary-diagrams"});return}return e}}function it(e){let t=st.join(e,de);if(!ie.existsSync(t))return{ok:!0,config:void 0};try{let s=ie.readFileSync(t,"utf-8"),n;try{n=ee(s)}catch(i){return{ok:!1,errors:[{message:`pickety.json is not valid JSONC: ${i instanceof Error?i.message:String(i)}`}]}}return nt(n)}catch(s){return{ok:!1,errors:[{message:`Failed to read pickety.json: ${s instanceof Error?s.message:String(s)}`}]}}}var re=j(require("fs")),M=j(require("path"));function rt(e,t){if(t<0)return[];let s=[],n;try{n=re.readdirSync(e,{withFileTypes:!0})}catch{return s}for(let i of n)!ne.has(i.name)&&i.isFile()&&/^tsconfig(\..+)?\.json$/.test(i.name)&&s.push(M.join(e,i.name));for(let i of n)!ne.has(i.name)&&i.isDirectory()&&s.push(...rt(M.join(e,i.name),t-1));return s}function ot(e){let t={},s=rt(e,4);for(let n of s)try{let i=re.readFileSync(n,"utf-8"),o=ee(i).compilerOptions;if(!o?.paths)continue;let c=M.dirname(n),l=M.relative(e,c),a=o.baseUrl||".";for(let[u,f]of Object.entries(o.paths))if(Array.isArray(f)&&f.length>0){let h=f[0];t[u]||(t[u]=$(M.join(l,a,h)))}}catch{}return t}var ke=j(require("path"));var V=j(require("path"));var ct=U.map(e=>`.${e}`),Gn=ct.map(e=>`index${e}`),lt=/(\/\*[\s\S]*?\*\/|\/\/.*)|(['"`](?:\\.|[^'"`])*['"`])|((?:import|export)\s+(?:[\s\S]*?from\s+)?['"`]([^'"`]+)['"`])|(import\s*\(\s*['"`]([^'"`]+)['"`]\s*\))/gm;function qn(e){let t=[],s=e.split(`
|
|
11
|
-
`),n=[],
|
|
12
|
-
`),r.
|
|
13
|
-
`)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
${r.length}
|
|
18
|
-
|
|
2
|
+
"use strict";var Gt=Object.create;var Pe=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var qt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty;var Zt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qt(t))!Xt.call(e,s)&&s!==r&&Pe(e,s,{get:()=>t[s],enumerable:!(n=Ht(t,s))||n.enumerable});return e};var P=(e,t,r)=>(r=e!=null?Gt(Jt(e)):{},Zt(t||!e||!e.__esModule?Pe(r,"default",{value:e,enumerable:!0}):r,e));var j=P(require("fs")),W=P(require("path"));var kt=P(require("path")),pe=P(require("fs"));function ne(e,t=!1){let r=e.length,n=0,s="",o=0,i=16,c=0,l=0,u=0,f=0,a=0;function g(m,k){let v=0,x=0;for(;v<m||!k;){let b=e.charCodeAt(n);if(b>=48&&b<=57)x=x*16+b-48;else if(b>=65&&b<=70)x=x*16+b-65+10;else if(b>=97&&b<=102)x=x*16+b-97+10;else break;n++,v++}return v<m&&(x=-1),x}function p(m){n=m,s="",o=0,i=16,a=0}function h(){let m=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&U(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&U(e.charCodeAt(n)))for(n++;n<e.length&&U(e.charCodeAt(n));)n++;else return a=3,e.substring(m,n);let k=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&U(e.charCodeAt(n))){for(n++;n<e.length&&U(e.charCodeAt(n));)n++;k=n}else a=3;return e.substring(m,k)}function d(){let m="",k=n;for(;;){if(n>=r){m+=e.substring(k,n),a=2;break}let v=e.charCodeAt(n);if(v===34){m+=e.substring(k,n),n++;break}if(v===92){if(m+=e.substring(k,n),n++,n>=r){a=2;break}switch(e.charCodeAt(n++)){case 34:m+='"';break;case 92:m+="\\";break;case 47:m+="/";break;case 98:m+="\b";break;case 102:m+="\f";break;case 110:m+=`
|
|
3
|
+
`;break;case 114:m+="\r";break;case 116:m+=" ";break;case 117:let b=g(4,!0);b>=0?m+=String.fromCharCode(b):a=4;break;default:a=5}k=n;continue}if(v>=0&&v<=31)if(X(v)){m+=e.substring(k,n),a=2;break}else a=6;n++}return m}function y(){if(s="",a=0,o=n,l=c,f=u,n>=r)return o=r,i=17;let m=e.charCodeAt(n);if(me(m)){do n++,s+=String.fromCharCode(m),m=e.charCodeAt(n);while(me(m));return i=15}if(X(m))return n++,s+=String.fromCharCode(m),m===13&&e.charCodeAt(n)===10&&(n++,s+=`
|
|
4
|
+
`),c++,u=n,i=14;switch(m){case 123:return n++,i=1;case 125:return n++,i=2;case 91:return n++,i=3;case 93:return n++,i=4;case 58:return n++,i=6;case 44:return n++,i=5;case 34:return n++,s=d(),i=10;case 47:let k=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!X(e.charCodeAt(n));)n++;return s=e.substring(k,n),i=12}if(e.charCodeAt(n+1)===42){n+=2;let v=r-1,x=!1;for(;n<v;){let b=e.charCodeAt(n);if(b===42&&e.charCodeAt(n+1)===47){n+=2,x=!0;break}n++,X(b)&&(b===13&&e.charCodeAt(n)===10&&n++,c++,u=n)}return x||(n++,a=1),s=e.substring(k,n),i=13}return s+=String.fromCharCode(m),n++,i=16;case 45:if(s+=String.fromCharCode(m),n++,n===r||!U(e.charCodeAt(n)))return i=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return s+=h(),i=11;default:for(;n<r&&w(m);)n++,m=e.charCodeAt(n);if(o!==n){switch(s=e.substring(o,n),s){case"true":return i=8;case"false":return i=9;case"null":return i=7}return i=16}return s+=String.fromCharCode(m),n++,i=16}}function w(m){if(me(m)||X(m))return!1;switch(m){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function $(){let m;do m=y();while(m>=12&&m<=15);return m}return{setPosition:p,getPosition:()=>n,scan:t?$:y,getToken:()=>i,getTokenValue:()=>s,getTokenOffset:()=>o,getTokenLength:()=>n-o,getTokenStartLine:()=>l,getTokenStartCharacter:()=>o-f,getTokenError:()=>a}}function me(e){return e===32||e===9}function X(e){return e===10||e===13}function U(e){return e>=48&&e<=57}var Le;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Le||(Le={}));var Yt=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),z=200,Kt={" ":{"\n":new Array(z).fill(0).map((e,t)=>`
|
|
5
|
+
`+" ".repeat(t)),"\r":new Array(z).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(z).fill(0).map((e,t)=>`\r
|
|
6
|
+
`+" ".repeat(t))}," ":{"\n":new Array(z).fill(0).map((e,t)=>`
|
|
7
|
+
`+" ".repeat(t)),"\r":new Array(z).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(z).fill(0).map((e,t)=>`\r
|
|
8
|
+
`+" ".repeat(t))}};var re;(function(e){e.DEFAULT={allowTrailingComma:!1}})(re||(re={}));function Ve(e,t=[],r=re.DEFAULT){let n=null,s=[],o=[];function i(l){Array.isArray(s)?s.push(l):n!==null&&(s[n]=l)}return Be(e,{onObjectBegin:()=>{let l={};i(l),o.push(s),s=l,n=null},onObjectProperty:l=>{n=l},onObjectEnd:()=>{s=o.pop()},onArrayBegin:()=>{let l=[];i(l),o.push(s),s=l,n=null},onArrayEnd:()=>{s=o.pop()},onLiteralValue:i,onError:(l,u,f)=>{t.push({error:l,offset:u,length:f})}},r),s[0]}function Be(e,t,r=re.DEFAULT){let n=ne(e,!1),s=[],o=0;function i(S){return S?()=>o===0&&S(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(S){return S?R=>o===0&&S(R,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(S){return S?R=>o===0&&S(R,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>s.slice()):()=>!0}function u(S){return S?()=>{o>0?o++:S(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>s.slice())===!1&&(o=1)}:()=>!0}function f(S){return S?()=>{o>0&&o--,o===0&&S(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let a=u(t.onObjectBegin),g=l(t.onObjectProperty),p=f(t.onObjectEnd),h=u(t.onArrayBegin),d=f(t.onArrayEnd),y=l(t.onLiteralValue),w=c(t.onSeparator),$=i(t.onComment),m=c(t.onError),k=r&&r.disallowComments,v=r&&r.allowTrailingComma;function x(){for(;;){let S=n.scan();switch(n.getTokenError()){case 4:b(14);break;case 5:b(15);break;case 3:b(13);break;case 1:k||b(11);break;case 2:b(12);break;case 6:b(16);break}switch(S){case 12:case 13:k?b(10):$();break;case 16:b(1);break;case 15:case 14:break;default:return S}}}function b(S,R=[],je=[]){if(m(S),R.length+je.length>0){let te=n.getToken();for(;te!==17;){if(R.indexOf(te)!==-1){x();break}else if(je.indexOf(te)!==-1)break;te=x()}}}function Ie(S){let R=n.getTokenValue();return S?y(R):(g(R),s.push(R)),x(),!0}function _t(){switch(n.getToken()){case 11:let S=n.getTokenValue(),R=Number(S);isNaN(R)&&(b(2),R=0),y(R);break;case 7:y(null);break;case 8:y(!0);break;case 9:y(!1);break;default:return!1}return x(),!0}function Wt(){return n.getToken()!==10?(b(3,[],[2,5]),!1):(Ie(!1),n.getToken()===6?(w(":"),x(),he()||b(4,[],[2,5])):b(5,[],[2,5]),s.pop(),!0)}function Ut(){a(),x();let S=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(S||b(4,[],[]),w(","),x(),n.getToken()===2&&v)break}else S&&b(6,[],[]);Wt()||b(4,[],[2,5]),S=!0}return p(),n.getToken()!==2?b(7,[2],[]):x(),!0}function zt(){h(),x();let S=!0,R=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(R||b(4,[],[]),w(","),x(),n.getToken()===4&&v)break}else R&&b(6,[],[]);S?(s.push(0),S=!1):s[s.length-1]++,he()||b(4,[],[4,5]),R=!0}return d(),S||s.pop(),n.getToken()!==4?b(8,[4],[]):x(),!0}function he(){switch(n.getToken()){case 3:return zt();case 1:return Ut();case 10:return Ie(!0);default:return _t()}}return x(),n.getToken()===17?r.allowEmptyContent?!0:(b(4,[],[]),!1):he()?(n.getToken()!==17&&b(9,[],[]),!0):(b(4,[],[]),!1)}var Fe;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Fe||(Fe={}));var De;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(De||(De={}));var se=Ve;var _e;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(_e||(_e={}));var ie=P(require("path"));var ye=(e,t,r)=>{let n=e instanceof RegExp?Ue(e,r):e,s=t instanceof RegExp?Ue(t,r):t,o=n!==null&&s!=null&&on(n,s,r);return o&&{start:o[0],end:o[1],pre:r.slice(0,o[0]),body:r.slice(o[0]+n.length,o[1]),post:r.slice(o[1]+s.length)}},Ue=(e,t)=>{let r=t.match(e);return r?r[0]:null},on=(e,t,r)=>{let n,s,o,i,c,l=r.indexOf(e),u=r.indexOf(t,l+1),f=l;if(l>=0&&u>0){if(e===t)return[l,u];for(n=[],o=r.length;f>=0&&!c;){if(f===l)n.push(f),l=r.indexOf(e,f+1);else if(n.length===1){let a=n.pop();a!==void 0&&(c=[a,u])}else s=n.pop(),s!==void 0&&s<o&&(o=s,i=u),u=r.indexOf(t,f+1);f=l<u&&l>=0?l:u}n.length&&i!==void 0&&(c=[o,i])}return c};var ze="\0SLASH"+Math.random()+"\0",Ge="\0OPEN"+Math.random()+"\0",ke="\0CLOSE"+Math.random()+"\0",He="\0COMMA"+Math.random()+"\0",qe="\0PERIOD"+Math.random()+"\0",an=new RegExp(ze,"g"),ln=new RegExp(Ge,"g"),cn=new RegExp(ke,"g"),un=new RegExp(He,"g"),fn=new RegExp(qe,"g"),pn=/\\\\/g,gn=/\\{/g,dn=/\\}/g,hn=/\\,/g,mn=/\\./g,yn=1e5;function be(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function bn(e){return e.replace(pn,ze).replace(gn,Ge).replace(dn,ke).replace(hn,He).replace(mn,qe)}function kn(e){return e.replace(an,"\\").replace(ln,"{").replace(cn,"}").replace(un,",").replace(fn,".")}function Je(e){if(!e)return[""];let t=[],r=ye("{","}",e);if(!r)return e.split(",");let{pre:n,body:s,post:o}=r,i=n.split(",");i[i.length-1]+="{"+s+"}";let c=Je(o);return o.length&&(i[i.length-1]+=c.shift(),i.push.apply(i,c)),t.push.apply(t,i),t}function Xe(e,t={}){if(!e)return[];let{max:r=yn}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Z(bn(e),r,!0).map(kn)}function wn(e){return"{"+e+"}"}function xn(e){return/^-?0\d/.test(e)}function Sn(e,t){return e<=t}function vn(e,t){return e>=t}function Z(e,t,r){let n=[],s=ye("{","}",e);if(!s)return[e];let o=s.pre,i=s.post.length?Z(s.post,t,!1):[""];if(/\$$/.test(s.pre))for(let c=0;c<i.length&&c<t;c++){let l=o+"{"+s.body+"}"+i[c];n.push(l)}else{let c=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),l=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),u=c||l,f=s.body.indexOf(",")>=0;if(!u&&!f)return s.post.match(/,(?!,).*\}/)?(e=s.pre+"{"+s.body+ke+s.post,Z(e,t,!0)):[e];let a;if(u)a=s.body.split(/\.\./);else if(a=Je(s.body),a.length===1&&a[0]!==void 0&&(a=Z(a[0],t,!1).map(wn),a.length===1))return i.map(p=>s.pre+a[0]+p);let g;if(u&&a[0]!==void 0&&a[1]!==void 0){let p=be(a[0]),h=be(a[1]),d=Math.max(a[0].length,a[1].length),y=a.length===3&&a[2]!==void 0?Math.abs(be(a[2])):1,w=Sn;h<p&&(y*=-1,w=vn);let m=a.some(xn);g=[];for(let k=p;w(k,h);k+=y){let v;if(l)v=String.fromCharCode(k),v==="\\"&&(v="");else if(v=String(k),m){let x=d-v.length;if(x>0){let b=new Array(x+1).join("0");k<0?v="-"+b+v.slice(1):v=b+v}}g.push(v)}}else{g=[];for(let p=0;p<a.length;p++)g.push.apply(g,Z(a[p],t,!1))}for(let p=0;p<g.length;p++)for(let h=0;h<i.length&&n.length<t;h++){let d=o+g[p]+i[h];(!r||u||d)&&n.push(d)}}return n}var Q=e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")};var Tn={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Y=e=>e.replace(/[[\]\\-]/g,"\\$&"),Rn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ze=e=>e.join(""),Qe=(e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],s=[],o=r+1,i=!1,c=!1,l=!1,u=!1,f=r,a="";e:for(;o<e.length;){let d=e.charAt(o);if((d==="!"||d==="^")&&o===r+1){u=!0,o++;continue}if(d==="]"&&i&&!l){f=o+1;break}if(i=!0,d==="\\"&&!l){l=!0,o++;continue}if(d==="["&&!l){for(let[y,[w,$,m]]of Object.entries(Tn))if(e.startsWith(y,o)){if(a)return["$.",!1,e.length-r,!0];o+=y.length,m?s.push(w):n.push(w),c=c||$;continue e}}if(l=!1,a){d>a?n.push(Y(a)+"-"+Y(d)):d===a&&n.push(Y(d)),a="",o++;continue}if(e.startsWith("-]",o+1)){n.push(Y(d+"-")),o+=2;continue}if(e.startsWith("-",o+1)){a=d,o+=2;continue}n.push(Y(d)),o++}if(f<o)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,e.length-r,!0];if(s.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let d=n[0].length===2?n[0].slice(-1):n[0];return[Rn(d),!1,f-r,!1]}let g="["+(u?"^":"")+Ze(n)+"]",p="["+(u?"":"^")+Ze(s)+"]";return[n.length&&s.length?"("+g+"|"+p+")":n.length?g:p,c,f-r,!0]};var L=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):t?e.replace(/\[([^\/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var $n=new Set(["!","?","+","*","@"]),Ye=e=>$n.has(e),En="(?!(?:^|/)\\.\\.?(?:$|/))",oe="(?!\\.)",On=new Set(["[","."]),An=new Set(["..","."]),Mn=new Set("().*{}+?[]^$\\!"),Nn=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),we="[^/]",Ke=we+"*?",Ce=we+"+?",G=class e{type;#n;#r;#o=!1;#e=[];#t;#i;#l;#a=!1;#s;#c;#f=!1;constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#t=r,this.#n=this.#t?this.#t.#n:this,this.#s=this.#n===this?n:this.#n.#s,this.#l=this.#n===this?[]:this.#n.#l,t==="!"&&!this.#n.#a&&this.#l.push(this),this.#i=this.#t?this.#t.#e.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#e)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#c!==void 0?this.#c:this.type?this.#c=this.type+"("+this.#e.map(t=>String(t)).join("|")+")":this.#c=this.#e.map(t=>String(t)).join("")}#g(){if(this!==this.#n)throw new Error("should only call on root");if(this.#a)return this;this.toString(),this.#a=!0;let t;for(;t=this.#l.pop();){if(t.type!=="!")continue;let r=t,n=r.#t;for(;n;){for(let s=r.#i+1;!n.type&&s<n.#e.length;s++)for(let o of t.#e){if(typeof o=="string")throw new Error("string part in extglob AST??");o.copyIn(n.#e[s])}r=n,n=r.#t}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof e&&r.#t===this))throw new Error("invalid part: "+r);this.#e.push(r)}}toJSON(){let t=this.type===null?this.#e.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#e.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#n||this.#n.#a&&this.#t?.type==="!")&&t.push({}),t}isStart(){if(this.#n===this)return!0;if(!this.#t?.isStart())return!1;if(this.#i===0)return!0;let t=this.#t;for(let r=0;r<this.#i;r++){let n=t.#e[r];if(!(n instanceof e&&n.type==="!"))return!1}return!0}isEnd(){if(this.#n===this||this.#t?.type==="!")return!0;if(!this.#t?.isEnd())return!1;if(!this.type)return this.#t?.isEnd();let t=this.#t?this.#t.#e.length:0;return this.#i===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new e(this.type,t);for(let n of this.#e)r.copyIn(n);return r}static#u(t,r,n,s){let o=!1,i=!1,c=-1,l=!1;if(r.type===null){let p=n,h="";for(;p<t.length;){let d=t.charAt(p++);if(o||d==="\\"){o=!o,h+=d;continue}if(i){p===c+1?(d==="^"||d==="!")&&(l=!0):d==="]"&&!(p===c+2&&l)&&(i=!1),h+=d;continue}else if(d==="["){i=!0,c=p,l=!1,h+=d;continue}if(!s.noext&&Ye(d)&&t.charAt(p)==="("){r.push(h),h="";let y=new e(d,r);p=e.#u(t,y,p,s),r.push(y);continue}h+=d}return r.push(h),p}let u=n+1,f=new e(null,r),a=[],g="";for(;u<t.length;){let p=t.charAt(u++);if(o||p==="\\"){o=!o,g+=p;continue}if(i){u===c+1?(p==="^"||p==="!")&&(l=!0):p==="]"&&!(u===c+2&&l)&&(i=!1),g+=p;continue}else if(p==="["){i=!0,c=u,l=!1,g+=p;continue}if(Ye(p)&&t.charAt(u)==="("){f.push(g),g="";let h=new e(p,f);f.push(h),u=e.#u(t,h,u,s);continue}if(p==="|"){f.push(g),g="",a.push(f),f=new e(null,r);continue}if(p===")")return g===""&&r.#e.length===0&&(r.#f=!0),f.push(g),g="",r.push(...a,f),u;g+=p}return r.type=null,r.#r=void 0,r.#e=[t.substring(n-1)],u}static fromGlob(t,r={}){let n=new e(null,void 0,r);return e.#u(t,n,0,r),n}toMMPattern(){if(this!==this.#n)return this.#n.toMMPattern();let t=this.toString(),[r,n,s,o]=this.toRegExpSource();if(!(s||this.#r||this.#s.nocase&&!this.#s.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let c=(this.#s.nocase?"i":"")+(o?"u":"");return Object.assign(new RegExp(`^${r}$`,c),{_src:r,_glob:t})}get options(){return this.#s}toRegExpSource(t){let r=t??!!this.#s.dot;if(this.#n===this&&this.#g(),!this.type){let l=this.isStart()&&this.isEnd()&&!this.#e.some(p=>typeof p!="string"),u=this.#e.map(p=>{let[h,d,y,w]=typeof p=="string"?e.#d(p,this.#r,l):p.toRegExpSource(t);return this.#r=this.#r||y,this.#o=this.#o||w,h}).join(""),f="";if(this.isStart()&&typeof this.#e[0]=="string"&&!(this.#e.length===1&&An.has(this.#e[0]))){let h=On,d=r&&h.has(u.charAt(0))||u.startsWith("\\.")&&h.has(u.charAt(2))||u.startsWith("\\.\\.")&&h.has(u.charAt(4)),y=!r&&!t&&h.has(u.charAt(0));f=d?En:y?oe:""}let a="";return this.isEnd()&&this.#n.#a&&this.#t?.type==="!"&&(a="(?:$|\\/)"),[f+u+a,L(u),this.#r=!!this.#r,this.#o]}let n=this.type==="*"||this.type==="+",s=this.type==="!"?"(?:(?!(?:":"(?:",o=this.#p(r);if(this.isStart()&&this.isEnd()&&!o&&this.type!=="!"){let l=this.toString();return this.#e=[l],this.type=null,this.#r=void 0,[l,L(this.toString()),!1,!1]}let i=!n||t||r||!oe?"":this.#p(!0);i===o&&(i=""),i&&(o=`(?:${o})(?:${i})*?`);let c="";if(this.type==="!"&&this.#f)c=(this.isStart()&&!r?oe:"")+Ce;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!t?oe:"")+Ke+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&i?")":this.type==="*"&&i?")?":`)${this.type}`;c=s+o+l}return[c,L(o),this.#r=!!this.#r,this.#o]}#p(t){return this.#e.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,s,o,i]=r.toRegExpSource(t);return this.#o=this.#o||i,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#d(t,r,n=!1){let s=!1,o="",i=!1,c=!1;for(let l=0;l<t.length;l++){let u=t.charAt(l);if(s){s=!1,o+=(Mn.has(u)?"\\":"")+u;continue}if(u==="*"){if(c)continue;c=!0,o+=n&&/^[*]+$/.test(t)?Ce:Ke,r=!0;continue}else c=!1;if(u==="\\"){l===t.length-1?o+="\\\\":s=!0;continue}if(u==="["){let[f,a,g,p]=Qe(t,l);if(g){o+=f,i=i||a,l+=g-1,r=r||p;continue}}if(u==="?"){o+=we,r=!0;continue}o+=Nn(u)}return[o,L(t),!!r,i]}};var xe=(e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&");var T=(e,t,r={})=>(Q(t),!r.nocomment&&t.charAt(0)==="#"?!1:new H(t,r).match(e)),In=/^\*+([^+@!?\*\[\(]*)$/,jn=e=>t=>!t.startsWith(".")&&t.endsWith(e),Pn=e=>t=>t.endsWith(e),Ln=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),Vn=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Bn=/^\*+\.\*+$/,Fn=e=>!e.startsWith(".")&&e.includes("."),Dn=e=>e!=="."&&e!==".."&&e.includes("."),_n=/^\.\*+$/,Wn=e=>e!=="."&&e!==".."&&e.startsWith("."),Un=/^\*+$/,zn=e=>e.length!==0&&!e.startsWith("."),Gn=e=>e.length!==0&&e!=="."&&e!=="..",Hn=/^\?+([^+@!?\*\[\(]*)?$/,qn=([e,t=""])=>{let r=nt([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},Jn=([e,t=""])=>{let r=rt([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},Xn=([e,t=""])=>{let r=rt([e]);return t?n=>r(n)&&n.endsWith(t):r},Zn=([e,t=""])=>{let r=nt([e]);return t?n=>r(n)&&n.endsWith(t):r},nt=([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},rt=([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},st=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",et={win32:{sep:"\\"},posix:{sep:"/"}},Qn=st==="win32"?et.win32.sep:et.posix.sep;T.sep=Qn;var M=Symbol("globstar **");T.GLOBSTAR=M;var Yn="[^/]",Kn=Yn+"*?",Cn="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",er="(?:(?!(?:\\/|^)\\.).)*?",tr=(e,t={})=>r=>T(r,e,t);T.filter=tr;var A=(e,t={})=>Object.assign({},e,t),nr=e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return T;let t=T;return Object.assign((n,s,o={})=>t(n,s,A(e,o)),{Minimatch:class extends t.Minimatch{constructor(s,o={}){super(s,A(e,o))}static defaults(s){return t.defaults(A(e,s)).Minimatch}},AST:class extends t.AST{constructor(s,o,i={}){super(s,o,A(e,i))}static fromGlob(s,o={}){return t.AST.fromGlob(s,A(e,o))}},unescape:(n,s={})=>t.unescape(n,A(e,s)),escape:(n,s={})=>t.escape(n,A(e,s)),filter:(n,s={})=>t.filter(n,A(e,s)),defaults:n=>t.defaults(A(e,n)),makeRe:(n,s={})=>t.makeRe(n,A(e,s)),braceExpand:(n,s={})=>t.braceExpand(n,A(e,s)),match:(n,s,o={})=>t.match(n,s,A(e,o)),sep:t.sep,GLOBSTAR:M})};T.defaults=nr;var ot=(e,t={})=>(Q(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Xe(e,{max:t.braceExpandMax}));T.braceExpand=ot;var rr=(e,t={})=>new H(e,t).makeRe();T.makeRe=rr;var sr=(e,t,r={})=>{let n=new H(t,r);return e=e.filter(s=>n.match(s)),n.options.nonull&&!e.length&&e.push(t),e};T.match=sr;var tt=/[?*]|[+@!]\(.*?\)|\[|\]/,or=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),H=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,r={}){Q(t),r=r||{},this.options=r,this.pattern=t,this.platform=r.platform||st,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...o)=>console.error(...o)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(o=>this.slashSplit(o));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let s=this.globParts.map((o,i,c)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=o[0]===""&&o[1]===""&&(o[2]==="?"||!tt.test(o[2]))&&!tt.test(o[3]),u=/^[a-z]:/i.test(o[0]);if(l)return[...o.slice(0,4),...o.slice(4).map(f=>this.parse(f))];if(u)return[o[0],...o.slice(1).map(f=>this.parse(f))]}return o.map(l=>this.parse(l))});if(this.debug(this.pattern,s),this.set=s.filter(o=>o.indexOf(!1)===-1),this.isWindows)for(let o=0;o<this.set.length;o++){let i=this.set[o];i[0]===""&&i[1]===""&&this.globParts[o][2]==="?"&&typeof i[3]=="string"&&/^[a-z]:$/i.test(i[3])&&(i[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n=0;n<t.length;n++)for(let s=0;s<t[n].length;s++)t[n][s]==="**"&&(t[n][s]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let s=n;for(;r[s+1]==="**";)s++;s!==n&&r.splice(n,s-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,s)=>{let o=n[n.length-1];return s==="**"&&o==="**"?n:s===".."&&o&&o!==".."&&o!=="."&&o!=="**"?(n.pop(),n):(n.push(s),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){let o=t[s];s===1&&o===""&&t[0]===""||(o==="."||o==="")&&(r=!0,t.splice(s,1),s--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let s=t[n-1];s&&s!=="."&&s!==".."&&s!=="**"&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let s=-1;for(;(s=n.indexOf("**",s+1))!==-1;){let i=s;for(;n[i+1]==="**";)i++;i>s&&n.splice(s+1,i-s);let c=n[s+1],l=n[s+2],u=n[s+3];if(c!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(s,1);let f=n.slice(0);f[s]="**",t.push(f),s--}if(!this.preserveMultipleSlashes){for(let i=1;i<n.length-1;i++){let c=n[i];i===1&&c===""&&n[0]===""||(c==="."||c==="")&&(r=!0,n.splice(i,1),i--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let o=0;for(;(o=n.indexOf("..",o+1))!==-1;){let i=n[o-1];if(i&&i!=="."&&i!==".."&&i!=="**"){r=!0;let l=o===1&&n[o+1]==="**"?["."]:[];n.splice(o-1,2,...l),n.length===0&&n.push(""),o-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let s=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(s){t[r]=[],t[n]=s;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let s=0,o=0,i=[],c="";for(;s<t.length&&o<r.length;)if(t[s]===r[o])i.push(c==="b"?r[o]:t[s]),s++,o++;else if(n&&t[s]==="**"&&r[o]===t[s+1])i.push(t[s]),s++;else if(n&&r[o]==="**"&&t[s]===r[o+1])i.push(r[o]),o++;else if(t[s]==="*"&&r[o]&&(this.options.dot||!r[o].startsWith("."))&&r[o]!=="**"){if(c==="b")return!1;c="a",i.push(t[s]),s++,o++}else if(r[o]==="*"&&t[s]&&(this.options.dot||!t[s].startsWith("."))&&t[s]!=="**"){if(c==="a")return!1;c="b",i.push(r[o]),s++,o++}else return!1;return t.length===r.length&&i}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let s=0;s<t.length&&t.charAt(s)==="!";s++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let s=this.options;if(this.isWindows){let d=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),y=!d&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),w=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),$=!w&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),m=y?3:d?0:void 0,k=$?3:w?0:void 0;if(typeof m=="number"&&typeof k=="number"){let[v,x]=[t[m],r[k]];v.toLowerCase()===x.toLowerCase()&&(r[k]=v,k>m?r=r.slice(k):m>k&&(t=t.slice(m)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:r}),this.debug("matchOne",t.length,r.length);for(var i=0,c=0,l=t.length,u=r.length;i<l&&c<u;i++,c++){this.debug("matchOne loop");var f=r[c],a=t[i];if(this.debug(r,f,a),f===!1)return!1;if(f===M){this.debug("GLOBSTAR",[r,f,a]);var g=i,p=c+1;if(p===u){for(this.debug("** at the end");i<l;i++)if(t[i]==="."||t[i]===".."||!s.dot&&t[i].charAt(0)===".")return!1;return!0}for(;g<l;){var h=t[g];if(this.debug(`
|
|
9
|
+
globstar while`,t,g,r,p,h),this.matchOne(t.slice(g),r.slice(p),n))return this.debug("globstar found match!",g,l,h),!0;if(h==="."||h===".."||!s.dot&&h.charAt(0)==="."){this.debug("dot detected!",t,g,r,p);break}this.debug("globstar swallow a segment, and continue"),g++}return!!(n&&(this.debug(`
|
|
10
|
+
>>> no match, partial?`,t,g,r,p),g===l))}let d;if(typeof f=="string"?(d=a===f,this.debug("string match",f,a,d)):(d=f.test(a),this.debug("pattern match",f,a,d)),!d)return!1}if(i===l&&c===u)return!0;if(i===l)return n;if(c===u)return i===l-1&&t[i]==="";throw new Error("wtf?")}braceExpand(){return ot(this.pattern,this.options)}parse(t){Q(t);let r=this.options;if(t==="**")return M;if(t==="")return"";let n,s=null;(n=t.match(Un))?s=r.dot?Gn:zn:(n=t.match(In))?s=(r.nocase?r.dot?Vn:Ln:r.dot?Pn:jn)(n[1]):(n=t.match(Hn))?s=(r.nocase?r.dot?Jn:qn:r.dot?Xn:Zn)(n):(n=t.match(Bn))?s=r.dot?Dn:Fn:(n=t.match(_n))&&(s=Wn);let o=G.fromGlob(t,this.options).toMMPattern();return s&&typeof o=="object"&&Reflect.defineProperty(o,"test",{value:s}),o}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?Kn:r.dot?Cn:er,s=new Set(r.nocase?["i"]:[]),o=t.map(l=>{let u=l.map(a=>{if(a instanceof RegExp)for(let g of a.flags.split(""))s.add(g);return typeof a=="string"?or(a):a===M?M:a._src});u.forEach((a,g)=>{let p=u[g+1],h=u[g-1];a!==M||h===M||(h===void 0?p!==void 0&&p!==M?u[g+1]="(?:\\/|"+n+"\\/)?"+p:u[g]=n:p===void 0?u[g-1]=h+"(?:\\/|\\/"+n+")?":p!==M&&(u[g-1]=h+"(?:\\/|\\/"+n+"\\/)"+p,u[g+1]=M))});let f=u.filter(a=>a!==M);if(this.partial&&f.length>=1){let a=[];for(let g=1;g<=f.length;g++)a.push(f.slice(0,g).join("/"));return"(?:"+a.join("|")+")"}return f.join("/")}).join("|"),[i,c]=t.length>1?["(?:",")"]:["",""];o="^"+i+o+c+"$",this.partial&&(o="^(?:\\/|"+i+o.slice(1,-1)+c+")$"),this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let s=this.slashSplit(t);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let i=s[s.length-1];if(!i)for(let c=s.length-2;!i&&c>=0;c--)i=s[c];for(let c=0;c<o.length;c++){let l=o[c],u=s;if(n.matchBase&&l.length===1&&(u=[i]),this.matchOne(u,l,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return T.defaults(t).Minimatch}};T.AST=G;T.Minimatch=H;T.escape=xe;T.unescape=L;var F="pickety.json",q=["ts","tsx","js","jsx","mjs","cjs"],ir=`**/*.{${q.join(",")}}`,ae=new Set(["node_modules",".git",".next","dist","out","build",".turbo",".cache",".nx","coverage"]);function E(e){let t=e.replace(/\\/g,"/");return/^[a-zA-Z]:/.test(t)&&(t=t[0].toLowerCase()+t.slice(1)),t}function J(e,t){return ie.relative(e,t).replace(/\\/g,"/")}function Se(e,t){return T(e,t)||e===t}function ve(e){return ie.join(e,F)}function le(e,t){return e==="instability"?t.toFixed(2):String(t)}function ce(e){let t=0,r=0,n=0;for(let s of e)s.severity==="error"?t+=1:s.severity==="warn"?r+=1:n+=1;return{errors:t,warnings:r,info:n}}function ar(e,t,r){let n=Te(e),s=e.name??`rule[${t}]`,o=e.group,i=o?`${o}: ${s}`:s;return{allow:e.allow??!1,severity:e.severity??r,name:s,group:o,label:i,effectiveImporter:n?.path||e.importer||"*",isOnly:e.only||!!e.containedTo,isAllowStyle:(e.allow??!1)||!!e.containedTo||!!e.only}}function it(e,t,r){let n=ar(e,t,r),s=Array.isArray(e.imports)?e.imports:[e.imports];return{rule:e,...n,importPatterns:s.filter(o=>typeof o=="string")}}function N(e,t,r){let n=e.includes("[")?e.slice(0,e.indexOf("[")):e;return!!(Se(e,r)||Se(n,r)||r.includes("/")&&(T(t,r)||T(t,`**/${r}`)||T(t,`**/${r}/**`)))}function Te(e){if(e.containedTo)return typeof e.containedTo=="object"?e.containedTo:{path:e.containedTo}}function D(e,t,r,n,s,o,i,c,l){return{file:e,line:t.line,character:t.character,length:t.length,message:`[${n}] ${s} (importing "${t.specifier}")`,severity:o,ruleName:r,ruleGroup:l,sourceModule:i,targetModule:c}}function at(e){let t=[],r=new Set,n=new Set,s=[];function o(i){r.add(i),n.add(i),s.push(i);let c=e.get(i);if(c){for(let l of c)if(!r.has(l))o(l);else if(n.has(l)){let u=s.indexOf(l);u!==-1&&t.push([...s.slice(u),l])}}n.delete(i),s.pop()}for(let i of e.keys())r.has(i)||o(i);return t}var lt={modules:{app:"src/app/**",features:"src/features/**",shared:"src/shared/**"},rules:{"module-boundaries":{severity:"error",rules:[{importer:"shared",imports:["app","features"],allow:!1,message:"Shared code should stay independent of app and feature modules."},{importer:"features",imports:"app",allow:!1,message:"Feature modules should not depend on the app layer."}]}}};var ct={modules:{domain:"src/domain/**",application:"src/application/**",ports:"src/ports/**",adapters:"src/adapters/**",infrastructure:"src/infrastructure/**"},rules:{"module-boundaries":{severity:"error",rules:[{importer:"domain",imports:["application","ports","adapters","infrastructure"],allow:!1,message:"Domain should not depend on outer layers."},{importer:"application",imports:["adapters","infrastructure"],allow:!1,message:"Application should not depend on adapters or infrastructure."},{importer:"ports",imports:["adapters","infrastructure"],allow:!1,message:"Ports should remain independent of adapters and infrastructure."},{importer:"adapters",imports:"infrastructure",allow:!1,message:"Adapters should not depend on infrastructure."}]}}};var ut={modules:{presentation:"src/presentation/**",application:"src/application/**",domain:"src/domain/**",infrastructure:"src/infrastructure/**"},rules:{"module-boundaries":{severity:"error",rules:[{importer:"domain",imports:["application","presentation","infrastructure"],allow:!1,message:"Domain should not depend on outer layers."},{importer:"application",imports:["presentation","infrastructure"],allow:!1,message:"Application should not depend on presentation or infrastructure."},{importer:"presentation",imports:"infrastructure",allow:!1,message:"Presentation should not depend directly on infrastructure."}]}}};var ft={hexagonal:ct,"feature-modules":lt,layered:ut};function ue(e){return ft[e]}function K(){return Object.keys(ft)}function pt(e,t,r,n){if(typeof e.containedTo=="object"&&e.containedTo!==null){let s=e.containedTo;if(typeof s.path!="string"&&n.push({message:`Rule #${t}: "containedTo.path" is required and must be a string`,path:`${r}.containedTo.path`}),s.unless!==void 0)if(typeof s.unless!="object"||s.unless===null||Array.isArray(s.unless))n.push({message:`Rule #${t}: "containedTo.unless" must be an object`,path:`${r}.containedTo.unless`});else{let o=s.unless;Object.keys(o).length===0&&n.push({message:`Rule #${t}: "containedTo.unless" must not be empty`,path:`${r}.containedTo.unless`}),(Array.isArray(e.imports)?e.imports.filter(u=>typeof u=="string"):typeof e.imports=="string"?[e.imports]:[]).some(u=>u.match(/\$[\w-]+/))||n.push({message:`Rule #${t}: "containedTo.unless" requires "imports" to contain at least one $variable`,path:`${r}.containedTo.unless`});for(let[u,f]of Object.entries(o))u.startsWith("$")||n.push({message:`Rule #${t}: "containedTo.unless" key "${u}" must start with $`,path:`${r}.containedTo.unless`}),typeof f!="string"&&n.push({message:`Rule #${t}: "containedTo.unless.${u}" must be a string`,path:`${r}.containedTo.unless.${u}`})}}else typeof e.containedTo!="string"&&n.push({message:`Rule #${t}: "containedTo" must be a string or object with a "path" property`,path:`${r}.containedTo`})}function I(e){return e.match(/\$[\w-]+/g)||[]}function gt(e){let t=new Set;for(let r of e)for(let n of I(r))t.add(n);return[...t]}function C(e,t,r){let n=e.split("/"),s=t.split("/"),o=0,i=n.filter(l=>l!=="**").length,c=s.length-i;for(let l=o;l<=c;l++){let u=dt(n,s,l,r);if(u)return u}}function dt(e,t,r,n){let s={},o=r;for(let i=0;i<e.length;i++){let c=e[i];if(c==="**"){let a=e.slice(i+1);if(a.length===0)return s;for(let g=o;g<=t.length-a.length;g++){let p=dt(a,t,g,n);if(p)return{...s,...p}}return}if(o>=t.length)return;let l=c,u=[];for(let a of n)l.includes(a)&&(l=l.replace(a,`__VAR_${u.length}__`),u.push(a));l=l.replace(/[.+?^{}()|[\]\\]/g,"\\$&"),l=l.replace(/\*/g,"[^/]*");for(let a=0;a<u.length;a++)l=l.replace(`__VAR_${a}__`,"([^/]+)");let f=t[o].match(new RegExp(`^${l}$`));if(!f)return;for(let a=0;a<u.length;a++)s[u[a]]=f[a+1];o++}return s}function _(e,t,r){let n=e;for(let s of t){let o=typeof r=="string"?r:r[s];n=n.replaceAll(s,o)}return n}function mt(e,t,r){if(e===void 0){t.push({message:'"rules" is required and must be an object',path:"rules"});return}if(typeof e!="object"||e===null){t.push({message:'"rules" must be an object',path:"rules"});return}let s=e["module-boundaries"];if(s===void 0){t.push({message:'"rules.module-boundaries" is required and must be an object',path:"rules.module-boundaries"});return}if(typeof s!="object"||s===null){t.push({message:'"rules.module-boundaries" must be an object',path:"rules.module-boundaries"});return}let o=s,i="error";if(o.severity!==void 0&&(o.severity!=="error"&&o.severity!=="warn"?t.push({message:`"rules.module-boundaries.severity" must be "error" or "warn", got "${o.severity}"`,path:"rules.module-boundaries.severity"}):i=o.severity),o.rules===void 0){t.push({message:'"rules.module-boundaries.rules" is required and must be an array',path:"rules.module-boundaries.rules"});return}if(!Array.isArray(o.rules)){t.push({message:'"rules.module-boundaries.rules" must be an array',path:"rules.module-boundaries.rules"});return}let c=[];return o.rules.forEach((l,u)=>{let f=`rules.module-boundaries.rules[${u}]`;if(typeof l!="object"||l===null){t.push({message:`Rule #${u} must be an object`,path:f});return}let a=l,g=typeof a.containedTo=="string"||typeof a.containedTo=="object"&&a.containedTo!==null;typeof a.importer!="string"&&!g&&t.push({message:`Rule #${u}: "importer" or "containedTo" is required`,path:f}),a.importer!==void 0&&typeof a.importer!="string"&&t.push({message:`Rule #${u}: "importer" must be a string`,path:`${f}.importer`});let p;if(typeof a.imports=="string")p=[a.imports];else if(Array.isArray(a.imports)){let y=a.imports.findIndex(w=>typeof w!="string");y!==-1?t.push({message:`Rule #${u}: "imports" entries must be strings`,path:`${f}.imports[${y}]`}):p=a.imports}else t.push({message:`Rule #${u}: "imports" is required and must be a string or string[]`,path:`${f}.imports`});a.allow!==void 0&&typeof a.allow!="boolean"&&t.push({message:`Rule #${u}: "allow" must be a boolean`,path:`${f}.allow`}),a.only!==void 0&&typeof a.only!="boolean"&&t.push({message:`Rule #${u}: "only" must be a boolean`,path:`${f}.only`}),a.containedTo!==void 0&&pt(a,u,f,t),a.message!==void 0&&typeof a.message!="string"&&t.push({message:`Rule #${u}: "message" must be a string`,path:`${f}.message`}),a.severity!==void 0&&a.severity!=="error"&&a.severity!=="warn"&&t.push({message:`Rule #${u}: "severity" must be "error" or "warn", got "${a.severity}"`,path:`${f}.severity`}),a.name!==void 0&&typeof a.name!="string"&&t.push({message:`Rule #${u}: "name" must be a string`,path:`${f}.name`}),a.group!==void 0&&typeof a.group!="string"&&t.push({message:`Rule #${u}: "group" must be a string`,path:`${f}.group`}),a.maxViolations!==void 0&&(typeof a.maxViolations!="number"||!Number.isInteger(a.maxViolations)||a.maxViolations<0)&&t.push({message:`Rule #${u}: "maxViolations" must be a non-negative integer`,path:`${f}.maxViolations`});let h;if(a.exports!==void 0)if(Array.isArray(a.exports)){let y=[];a.exports.forEach((w,$)=>{let m=ht(w,`${f}.exports[${$}]`,t);m&&y.push(m)}),y.length>0&&(h=y)}else{let y=ht(a.exports,`${f}.exports`,t);y&&(h=y)}if(p){let y=new Set(gt(p)),w=($,m,k)=>{let x=I($).filter(b=>!y.has(b));if(x.length>0){let b=Array.from(new Set(x));r.push({message:`Rule #${u}: ${k} references variables not present in "imports": ${b.join(", ")}`,path:m})}};typeof a.importer=="string"&&w(a.importer,`${f}.importer`,'"importer"'),typeof a.containedTo=="string"?w(a.containedTo,`${f}.containedTo`,'"containedTo"'):typeof a.containedTo=="object"&&a.containedTo!==null&&typeof a.containedTo.path=="string"&&w(a.containedTo.path,`${f}.containedTo.path`,'"containedTo.path"')}if(!p)return;let d={imports:typeof a.imports=="string"?a.imports:p};typeof a.importer=="string"&&(d.importer=a.importer),typeof a.allow=="boolean"&&(d.allow=a.allow),typeof a.only=="boolean"&&(d.only=a.only),a.containedTo!==void 0&&(typeof a.containedTo=="string"||typeof a.containedTo=="object"&&a.containedTo!==null)&&(d.containedTo=a.containedTo),typeof a.message=="string"&&(d.message=a.message),(a.severity==="error"||a.severity==="warn")&&(d.severity=a.severity),typeof a.name=="string"&&(d.name=a.name),typeof a.group=="string"&&(d.group=a.group),typeof a.maxViolations=="number"&&Number.isInteger(a.maxViolations)&&a.maxViolations>=0&&(d.maxViolations=a.maxViolations),h&&(d.exports=h),c.push(d)}),{severity:i,rules:c}}function ht(e,t,r){if(typeof e!="object"||e===null){r.push({message:`"${t}" must be an object`,path:t});return}let n=e,s=!1;if(typeof n.path!="string"&&(r.push({message:`"${t}.path" is required and must be a string`,path:`${t}.path`}),s=!0),typeof n.to!="string"&&(r.push({message:`"${t}.to" is required and must be a string`,path:`${t}.to`}),s=!0),n.message!==void 0&&typeof n.message!="string"&&(r.push({message:`"${t}.message" must be a string`,path:`${t}.message`}),s=!0),!s)return{path:n.path,to:n.to,message:typeof n.message=="string"?n.message:void 0}}function yt(e,t){if(e===void 0)return;if(typeof e!="object"||e===null){t.push({message:'"health" must be an object',path:"health"});return}let r=e,n={},s=[{key:"maxAfferentCoupling",label:"maxAfferentCoupling"},{key:"maxEfferentCoupling",label:"maxEfferentCoupling"},{key:"maxDepth",label:"maxDepth"}];for(let{key:o,label:i}of s){let c=r[o];c!==void 0&&(typeof c!="number"||!Number.isInteger(c)||c<1?t.push({message:`"health.${i}" must be a positive integer`,path:`health.${i}`}):n[o]=c)}if(r.maxInstability!==void 0){let o=r.maxInstability;typeof o!="number"||o<0||o>1?t.push({message:'"health.maxInstability" must be a number between 0 and 1',path:"health.maxInstability"}):n.maxInstability=o}return Object.keys(n).length>0?n:void 0}function bt(e){let t=[],r=[];if(typeof e!="object"||e===null)return{ok:!1,errors:[{message:"Configuration must be a JSON object"}]};let n=e,s=lr(n.modules,t),o=mt(n.rules,t,r),i=cr(n["boundary-diagrams"],t),c=yt(n.health,t),l=ur(n.warnOnUntrackedImporters,t);return t.length>0||!s||!o?r.length>0?{ok:!1,errors:t,warnings:r}:{ok:!1,errors:t}:{ok:!0,config:{modules:s,rules:{"module-boundaries":o},warnOnUntrackedImporters:l,"boundary-diagrams":i,health:c},warnings:r.length>0?r:void 0}}function lr(e,t){if(e===void 0){t.push({message:'"modules" is required and must be an object',path:"modules"});return}if(typeof e!="object"||e===null){t.push({message:'"modules" must be an object mapping module names to patterns',path:"modules"});return}let r={};for(let[n,s]of Object.entries(e))typeof s!="string"?t.push({message:`Module "${n}" pattern must be a string, got ${typeof s}`,path:`modules.${n}`}):r[n]=s;return r}function cr(e,t){if(e!==void 0){if(typeof e!="boolean"&&typeof e!="string"){t.push({message:'"boundary-diagrams" must be a boolean or a string',path:"boundary-diagrams"});return}return e}}function ur(e,t){return e===void 0?!0:typeof e!="boolean"?(t.push({message:'"warnOnUntrackedImporters" must be a boolean',path:"warnOnUntrackedImporters"}),!0):e}function wt(e){let t=kt.join(e,F);if(!pe.existsSync(t))return{ok:!0,config:void 0};try{let r=pe.readFileSync(t,"utf-8"),n;try{n=se(r)}catch(s){return{ok:!1,errors:[{message:`pickety.json is not valid JSONC: ${s instanceof Error?s.message:String(s)}`}]}}if(typeof n=="object"&&n!==null){let s=n;if(s.preset!==void 0&&typeof s.preset!="string")return{ok:!1,errors:[{message:'"preset" must be a string',path:"preset"}]};if(typeof s.preset=="string"){let o=ue(s.preset);if(!o)return{ok:!1,errors:[{message:`Unknown preset "${s.preset}". Available presets: ${K().join(", ")}`,path:"preset"}]};n=dr(o,s)}}return bt(n)}catch(r){return{ok:!1,errors:[{message:`Failed to read pickety.json: ${r instanceof Error?r.message:String(r)}`}]}}}function fe(e){return typeof e=="object"&&e!==null}function fr(e,t){return t===void 0?e:!fe(t)||!e?t:{...e,...t}}function Re(e,t,r,n){r[n]!==void 0?e[n]=r[n]:t[n]!==void 0&&(e[n]=t[n])}function pr(e,t){return t===void 0?e:fe(t)?{...e,...t}:t}function gr(e,t){if(t===void 0)return e;if(!fe(t))return t;let r=t["module-boundaries"];if(!fe(r))return t;let n={...e,...t},s=e["module-boundaries"],o={...s,...r},i=Array.isArray(s.rules)?s.rules:[];return r.rules===void 0?o.rules=i:Array.isArray(r.rules)?o.rules=[...i,...r.rules]:o.rules=r.rules,n["module-boundaries"]=o,n}function dr(e,t){let r={...e,...t};r.modules=pr(e.modules,t.modules),r.rules=gr(e.rules,t.rules);let n=e;return Re(r,n,t,"warnOnUntrackedImporters"),Re(r,n,t,"boundary-diagrams"),r.health=fr(e.health,t.health),Re(r,n,t,"version"),r}var ge=P(require("fs")),V=P(require("path"));function xt(e,t){if(t<0)return[];let r=[],n;try{n=ge.readdirSync(e,{withFileTypes:!0})}catch{return r}for(let s of n)!ae.has(s.name)&&s.isFile()&&/^tsconfig(\..+)?\.json$/.test(s.name)&&r.push(V.join(e,s.name));for(let s of n)!ae.has(s.name)&&s.isDirectory()&&r.push(...xt(V.join(e,s.name),t-1));return r}function St(e){let t={},r=xt(e,4);for(let n of r)try{let s=ge.readFileSync(n,"utf-8"),i=se(s).compilerOptions;if(!i?.paths)continue;let c=V.dirname(n),l=V.relative(e,c),u=i.baseUrl||".";for(let[f,a]of Object.entries(i.paths))if(Array.isArray(a)&&a.length>0){let g=a[0];t[f]||(t[f]=E(V.join(l,u,g)))}}catch{}return t}var Ae=P(require("path"));var B=P(require("path"));var Tt=q.map(e=>`.${e}`),hr=Tt.map(e=>`index${e}`),vt=/(\/\*[\s\S]*?\*\/|\/\/.*)|(['"`](?:\\.|[^'"`])*['"`])|((?:import|export)\s+(?:[\s\S]*?from\s+)?['"`]([^'"`]+)['"`])|(import\s*\(\s*['"`]([^'"`]+)['"`]\s*\))/gm;function mr(e){let t=[],r=e.split(`
|
|
11
|
+
`),n=[],s=0;for(let c of r)n.push(s),s+=c.length+1;let o=c=>{let l=0;for(let u=1;u<n.length&&!(n[u]>c);u++)l=u;return{line:l,character:c-n[l]}},i;for(vt.lastIndex=0;(i=vt.exec(e))!==null;){let[c,l,u,f,a,g,p]=i;if(!(l||u)){if(f&&a){let h=o(i.index);t.push({specifier:a,line:h.line,character:h.character,length:f.length})}else if(g&&p){let h=o(i.index);t.push({specifier:p,line:h.line,character:h.character,length:g.length})}}}return t}function yr(e,t,r){let{knownFiles:n,root:s,aliases:o}=r;for(let[i,c]of Object.entries(o))if(i.endsWith("/*")){let l=i.slice(0,-2),u=c.endsWith("/*")?c.slice(0,-2):c==="*"?"./":c;if(e.startsWith(l)){let f=e.replace(l,u);return $e(B.resolve(s,f),n)}}else if(e===i)return $e(B.resolve(s,c),n);if(e.startsWith(".")){let i=B.dirname(t),c=B.resolve(i,e);return $e(c,n)}}function $e(e,t){let r=E(e);if(t.has(r))return r;for(let n of Tt){let s=r+n;if(t.has(s))return s}for(let n of hr){let s=r+"/"+n;if(t.has(s))return s}}function br(e){return e.endsWith("/*")?e.slice(0,-2)+"/**/*":e}function kr(e,t,r){if(t.length===0)return e;let n=t.map(s=>r[s]);return`${e}[${n.join(",")}]`}function wr(e,t,r){let n=E(B.relative(r,e));for(let[s,o]of Object.entries(t)){let i=br(o),c=I(o);if(c.length>0){let l=C(i,n,c)||(i!==o?C(o,n,c):void 0);if(l)return{name:kr(s,c,l),pattern:o,relativePath:n,variables:l};continue}if(T(n,i)||T(n,o))return{name:s,pattern:o,relativePath:n}}}function O(e,t,r){return wr(e,t,r)?.name}function de(e,t,r){let n=mr(t),s=[];for(let o of n){let i=yr(o.specifier,e,r);i&&s.push({statement:o,resolvedPath:i})}return s}function Et(e){return e.isOnly?xr(e):Sr(e)}function Ee(e,t,r,n){let s=e.includes("/")?n:r;return C(e,s,t)}function xr(e){let{rule:t,importsPattern:r,variables:n,effectiveImporter:s,ruleSeverity:o,ruleName:i,ruleLabel:c,ruleGroup:l,ctx:u}=e,f=Ee(r,n,u.targetModule,u.targetRelativePath);if(!f||$r(t,f))return;let a=_(s,n,f);if(!N(u.sourceModule,u.sourceRelativePath,a)){if(Oe(t,u,f))return;let p=t.message||`Module "${u.sourceModule}" is not allowed to import from "${u.targetModule}" (contained to "${a}")`;return D(u.filePath,u.importStmt,i,c,p,o,u.sourceModule,u.targetModule,l)}}function Sr(e){let{rule:t,importsPattern:r,variables:n,allow:s,effectiveImporter:o,ruleSeverity:i,ruleName:c,ruleLabel:l,ruleGroup:u,ctx:f}=e,a=Ee(o,n,f.sourceModule,f.sourceRelativePath);if(a)if(s){let g=_(r,n,"*"),p=_(r,n,a),h=N(f.targetModule,f.targetRelativePath,g),d=N(f.targetModule,f.targetRelativePath,p);if(h&&!d){let y=t.message||`Import must match scoped pattern "${p}"`;return D(f.filePath,f.importStmt,c,l,y,i,f.sourceModule,f.targetModule,u)}}else{let g=_(r,n,a);if(N(f.targetModule,f.targetRelativePath,g)){let h=t.message||`Module "${f.sourceModule}" cannot import from "${f.targetModule}"`;return D(f.filePath,f.importStmt,c,l,h,i,f.sourceModule,f.targetModule,u)}}}function vr(e){return e?Array.isArray(e)?e:[e]:[]}var Rt=new WeakMap;function Tr(e){let t=Rt.get(e);if(t)return t;let n=vr(e.exports).map(s=>({entry:s,pathVars:I(s.path),toVars:I(s.to)}));return Rt.set(e,n),n}function Oe(e,t,r){let n=Tr(e);if(n.length===0)return!1;for(let{entry:s,pathVars:o,toVars:i}of n){let c=o.length>0?$t(s.path,o,r,t.targetModule,t.targetRelativePath):{};if(o.length>0&&!c)continue;let l=i.length>0?$t(s.to,i,void 0,t.sourceModule,t.sourceRelativePath):{};if(i.length>0&&!l)continue;let u=Rr(c??{},l??{});if(!u)continue;let f=o.length>0?_(s.path,o,u):s.path;if(!N(t.targetModule,t.targetRelativePath,f))continue;let a=i.length>0?_(s.to,i,u):s.to;if(N(t.sourceModule,t.sourceRelativePath,a))return!0}return!1}function $t(e,t,r,n,s){return r&&t.every(o=>r[o]!==void 0)?r:Ee(e,t,n,s)}function Rr(e,t){let r={...e};for(let[n,s]of Object.entries(t)){if(r[n]!==void 0&&r[n]!==s)return;r[n]=s}return r}function $r(e,t){let r=Te(e);if(r&&r.unless){let n=Object.entries(r.unless);return n.length>0&&n.every(([s,o])=>t[s]===o)}return!1}function Ot(e,t){let{rule:r,allow:n,severity:s,name:o,label:i,group:c,effectiveImporter:l,isOnly:u,importPatterns:f}=e;for(let a of f){let g=I(u?a:l);if(g.length>0){let d=Et({rule:r,importsPattern:a,variables:g,isOnly:u,allow:n,effectiveImporter:l,ruleSeverity:s,ruleName:o,ruleLabel:i,ruleGroup:c,ctx:t});if(d)return d;continue}let p=N(t.sourceModule,t.sourceRelativePath,l),h=N(t.targetModule,t.targetRelativePath,a);if(u){if(h&&!p){if(Oe(r,t))return;let d=r.message||(r.containedTo?`Import is restricted: "${t.targetModule}" is contained to "${l}"`:`Module "${t.targetModule}" can only be imported by "${l}"`);return D(t.filePath,t.importStmt,o,i,d,s,t.sourceModule,t.targetModule,c)}}else if(p&&h&&!n){let d=r.message||`Module "${t.sourceModule}" cannot import from "${t.targetModule}"`;return D(t.filePath,t.importStmt,o,i,d,s,t.sourceModule,t.targetModule,c)}}}function At(e,t,r,n){let s=[],{modules:o}=r,{severity:i,rules:c}=r.rules["module-boundaries"],{root:l}=n,u=r.warnOnUntrackedImporters??!0,f=c.map((h,d)=>it(h,d,i)),a=O(e,o,l);if(!a)return u&&s.push({file:e,line:0,character:0,length:1,message:"This file is not covered by any declared module. Import rules will not be enforced here.",severity:"info"}),s;let g=E(Ae.relative(l,e)),p=de(e,t,n);for(let{statement:h,resolvedPath:d}of p){let y=O(d,o,l);if(!y)continue;let w=E(Ae.relative(l,d)),$={sourceModule:a,sourceRelativePath:g,targetModule:y,targetRelativePath:w,filePath:e,importStmt:h};for(let m of f){let k=Ot(m,$);k&&s.push(k)}}return s}function Mt(e,t){let r=t.rules["module-boundaries"].rules,n=new Map;if(r.forEach((o,i)=>{if(o.maxViolations!==void 0){let c=o.name??`rule[${i}]`;n.set(c,o.maxViolations)}}),n.size===0)return e;let s=new Map;for(let o of e)o.ruleName&&n.has(o.ruleName)&&s.set(o.ruleName,(s.get(o.ruleName)??0)+1);return e.map(o=>{if(!o.ruleName||!n.has(o.ruleName))return o;let i=s.get(o.ruleName)??0,c=n.get(o.ruleName),l=i<=c?"warn":"error";return l===o.severity?o:{...o,severity:l}})}function Me(e,t,r){let n=new Set,s=de(e,t,r),o=E(e);for(let{resolvedPath:i}of s)i&&i!==o&&n.add(i);return n}var ee=class{dependents=new Map;dependencies=new Map;updateFile(t,r){let n=this.dependencies.get(t);if(n)for(let s of n)this.dependents.get(s)?.delete(t);this.dependencies.set(t,new Set(r));for(let s of r)this.dependents.has(s)||this.dependents.set(s,new Set),this.dependents.get(s).add(t)}removeFile(t){let r=this.dependencies.get(t);if(r)for(let s of r)this.dependents.get(s)?.delete(t);this.dependencies.delete(t);let n=this.dependents.get(t);if(n)for(let s of n)this.dependencies.get(s)?.delete(t);this.dependents.delete(t)}getDependents(t){return this.dependents.get(t)??new Set}getDependencies(t){return this.dependencies.get(t)??new Set}getTransitiveDependents(t){let r=new Set,n=[t];for(;n.length>0;){let s=n.shift(),o=this.dependents.get(s);if(o)for(let i of o)!r.has(i)&&i!==t&&(r.add(i),n.push(i))}return r}getModuleSummary(t,r,n){let s=this.getDependents(t),o=this.getDependencies(t),i=new Set;for(let l of s){let u=O(l,r,n);u&&i.add(u)}let c=new Set;for(let l of o){let u=O(l,r,n);u&&c.add(u)}return{dependentCount:s.size,dependentModules:[...i],dependencyCount:o.size,dependencyModules:[...c]}}getModuleLevelGraph(t,r){let n=new Map;for(let[s,o]of this.dependencies){let i=O(s,t,r);if(i){n.has(i)||n.set(i,new Set);for(let c of o){let l=O(c,t,r);l&&l!==i&&n.get(i).add(l)}}}return n}clear(){this.dependents.clear(),this.dependencies.clear()}};function Nt(e,t,r){let{root:n,knownFiles:s}=r,o=e.getModuleLevelGraph(t,n),i=Object.keys(t),c=new Map;for(let a of i)c.set(a,0);for(let a of s){let g=O(a,t,n);g&&c.set(g,(c.get(g)??0)+1)}let l=new Map;for(let a of i)l.set(a,0);for(let[,a]of o)for(let g of a)l.set(g,(l.get(g)??0)+1);let u=Er(o,i),f=i.map(a=>{let g=l.get(a)??0,p=o.get(a)?.size??0,h=g+p;return{moduleName:a,fileCount:c.get(a)??0,afferentCoupling:g,efferentCoupling:p,instability:h===0?0:p/h,dependencyDepth:u.get(a)??0}});return f.sort((a,g)=>a.instability-g.instability),f}function Er(e,t){let r=new Map,n=new Set;function s(o){if(r.has(o))return r.get(o);if(n.has(o))return 0;n.add(o);let i=e.get(o),c=0;if(i&&i.size>0)for(let l of i)c=Math.max(c,1+s(l));return n.delete(o),r.set(o,c),c}for(let o of t)s(o);return r}function It(e,t){let r=[],n=[{key:"maxAfferentCoupling",label:"afferent coupling",getValue:s=>s.afferentCoupling},{key:"maxEfferentCoupling",label:"efferent coupling",getValue:s=>s.efferentCoupling},{key:"maxInstability",label:"instability",getValue:s=>s.instability},{key:"maxDepth",label:"dependency depth",getValue:s=>s.dependencyDepth}];for(let s of e)for(let o of n){let i=t[o.key],c=o.getValue(s);i!==void 0&&c>i&&r.push({moduleName:s.moduleName,metric:o.label,value:c,threshold:i})}return r}function jt(e,t){let r=J(t,e.file),n=e.line+1,s=e.character+1,o=e.severity==="error"?"error":e.severity==="info"?"info":"warning";return`${r}:${n}:${s}: ${o} ${e.message}`}function Pt(e){let t=new Map,r=0,n=!1;for(let o of e)o.ruleGroup?(n=!0,t.set(o.ruleGroup,(t.get(o.ruleGroup)??0)+1)):r+=1;if(!n)return;let s=[];s.push(""),s.push("Groups:");for(let[o,i]of t.entries())s.push(` ${o}: ${i}`);return r>0&&s.push(` (ungrouped): ${r}`),s.join(`
|
|
12
|
+
`)}function Lt(e,t,r){let n=e.map(f=>({file:J(r,f.file),line:f.line+1,column:f.character+1,length:f.length,message:f.message,severity:f.severity,ruleName:f.ruleName,ruleGroup:f.ruleGroup,sourceModule:f.sourceModule,targetModule:f.targetModule})),s=ce(e),o=s.errors+t.length,i=s.warnings,c=s.info,l={},u=0;for(let f of e)f.ruleGroup?l[f.ruleGroup]=(l[f.ruleGroup]??0)+1:u+=1;return u>0&&(l.ungrouped=u),{violations:n,cycles:t,summary:{violations:e.length,cycles:t.length,errors:o,warnings:i,info:c},groups:l}}function Vt(e,t,r,n){let s=J(n,e),o=t.getDependents(e),i=t.getTransitiveDependents(e);if(console.log(`Impact analysis for ${s}:
|
|
13
|
+
`),o.size===0){console.log(` No dependents found.
|
|
14
|
+
`);return}console.log(` Direct dependents (${o.size} file${o.size===1?"":"s"}):`);for(let l of o){let u=O(l,r.modules,n)??"(unmatched)",f=J(n,l);console.log(` ${f} (${u})`)}let c=new Set;for(let l of i){let u=O(l,r.modules,n);u&&c.add(u)}i.size>o.size&&(console.log(`
|
|
15
|
+
Transitive dependents (${i.size} file${i.size===1?"":"s"} across ${c.size} module${c.size===1?"":"s"}):`),console.log(` ${[...c].join(", ")}`)),console.log(`
|
|
16
|
+
Affected modules: ${[...c].join(", ")||"none"}`),console.log("")}function Bt(e,t){console.log(`Module Health Report:
|
|
17
|
+
`);let r=["Module","Files","Ca","Ce","Instability","Depth"],n=[Math.max(r[0].length,...e.map(i=>i.moduleName.length)),Math.max(r[1].length,...e.map(i=>String(i.fileCount).length)),Math.max(r[2].length,...e.map(i=>String(i.afferentCoupling).length)),Math.max(r[3].length,...e.map(i=>String(i.efferentCoupling).length)),Math.max(r[4].length,11),Math.max(r[5].length,...e.map(i=>String(i.dependencyDepth).length))],s=(i,c)=>i.padEnd(c),o=(i,c)=>i.padStart(c);console.log(" "+r.map((i,c)=>s(i,n[c])).join(" ")),console.log(" "+n.map(i=>"\u2500".repeat(i)).join(" "));for(let i of e){let l=" "+[s(i.moduleName,n[0]),o(String(i.fileCount),n[1]),o(String(i.afferentCoupling),n[2]),o(String(i.efferentCoupling),n[3]),o(le("instability",i.instability),n[4]),o(String(i.dependencyDepth),n[5])].join(" "),u=t.filter(f=>f.moduleName===i.moduleName);if(u.length>0){let f=u.map(a=>{let g=le(a.metric,a.threshold);return`exceeds max${a.metric.charAt(0).toUpperCase()+a.metric.slice(1)} (${g})`});l+=" \u2190 "+f.join(", ")}console.log(l)}}function Or(e){let t=e.slice(2),r=t[0],n=process.cwd(),s="text",o,i=!1,c=t.indexOf("--root");c!==-1&&t[c+1]&&(n=W.resolve(t[c+1]));let l=t.indexOf("--format");if(l!==-1){let a=t[l+1];if(!a||a.startsWith("--"))return console.error('Missing value for "--format". Use "text" or "json".'),{ok:!1,exitCode:1};if(a!=="text"&&a!=="json")return console.error(`Invalid format "${a}". Use "text" or "json".`),{ok:!1,exitCode:1};s=a}let u=t.indexOf("--preset");if(u!==-1){let a=t[u+1];if(!a||a.startsWith("--"))return console.error('Missing value for "--preset".'),{ok:!1,exitCode:1};o=a}t.includes("--verbose")&&(i=!0);let f=r==="impact"&&t[1]&&!t[1].startsWith("--")?W.resolve(n,t[1]):void 0;return{ok:!0,command:r,root:n,target:f,format:s,preset:o,verbose:i}}var Ar=new Set(q.map(e=>`.${e}`));function Mr(e){let t=j.readdirSync(e,{recursive:!0,withFileTypes:!0}),r=new Set;for(let n of t){if(!n.isFile())continue;let s=n.parentPath??n.path??e,o=W.join(s,n.name);o.includes("node_modules")||Ar.has(W.extname(n.name))&&r.add(E(o))}return r}function Ft(){console.log("Usage: pickety <command> [options]"),console.log(""),console.log("Commands:"),console.log(" check Check all files for boundary violations"),console.log(" impact <file> Show which files and modules depend on a file"),console.log(" health Show module health metrics and check thresholds"),console.log(" init Create a starter pickety.json"),console.log(""),console.log("Options:"),console.log(" --root <path> Workspace root (defaults to current directory)"),console.log(" --format <text|json> Output format for check (defaults to text)"),console.log(` --preset <name> Preset name for init (${K().join(", ")})`),console.log(" --verbose Log file read errors")}function Ne(e){let t=wt(e);if(!t.ok){console.error("Configuration errors:");for(let s of t.errors)console.error(` ${s.message}${s.path?` (at ${s.path})`:""}`);if(t.warnings&&t.warnings.length>0){console.warn("Configuration warnings:");for(let s of t.warnings)console.warn(` ${s.message}${s.path?` (at ${s.path})`:""}`)}return{ok:!1,exitCode:1}}if(!t.config)return console.log("No pickety.json found. Skipping check."),{ok:!1,exitCode:0};if(t.warnings&&t.warnings.length>0){console.warn("Configuration warnings:");for(let s of t.warnings)console.warn(` ${s.message}${s.path?` (at ${s.path})`:""}`)}let r=Mr(e),n=St(e);return{ok:!0,config:t.config,ctx:{root:e,knownFiles:r,aliases:n}}}function Dt(e,t){let r=new ee;for(let n of e.knownFiles)try{let s=j.readFileSync(n,"utf-8"),o=Me(n,s,e);r.updateFile(n,o)}catch(s){if(t){let o=s instanceof Error?s.message:String(s);console.warn(`Skipping unreadable file: ${n} (${o})`)}}return r}function Nr(e,t,r){let n=Ne(e);if(!n.ok)return n.exitCode;let{config:s,ctx:o}=n,i=new ee,c=[];for(let y of o.knownFiles)try{let w=j.readFileSync(y,"utf-8"),$=At(y,w,s,o);c.push(...$);let m=Me(y,w,o);i.updateFile(y,m)}catch(w){if(r){let $=w instanceof Error?w.message:String(w);console.warn(`Skipping unreadable file: ${y} (${$})`)}}let l=Mt(c,s),u=i.getModuleLevelGraph(s.modules,e),f=at(u);if(t==="json"){let y=Lt(l,f,e);return console.log(JSON.stringify(y,null,2)),y.summary.errors>0?1:0}if(l.length===0&&f.length===0)return console.log("No boundary violations found."),0;for(let y of l)console.log(jt(y,e));for(let y of f)console.log(`error: Circular dependency detected: ${y.join(" -> ")}`);let a=ce(l),g=a.errors+f.length,p=a.warnings,h=a.info,d=Pt(l);return d&&console.log(d),console.log(""),console.log(`Found ${l.length} violation(s): ${g} error(s), ${p} warning(s), ${h} info(s)`),g>0?1:0}function Ir(e,t,r){if(!t)return console.error("Usage: pickety impact <file> [--root <path>]"),1;if(!j.existsSync(t))return console.error(`File not found: ${t}`),1;let n=Ne(e);if(!n.ok)return n.exitCode;let{config:s,ctx:o}=n,i=Dt(o,r);return Vt(t,i,s,e),0}function jr(e,t){let r=Ne(e);if(!r.ok)return r.exitCode;let{config:n,ctx:s}=r,o=Dt(s,t),i=Nt(o,n.modules,s),c=n.health?It(i,n.health):[];return Bt(i,c),c.length>0?(console.log(`
|
|
18
|
+
${c.length} threshold violation(s) found.`),1):(console.log(`
|
|
19
|
+
All modules within configured thresholds.`),0)}function Pr(e,t){let r=ve(e);if(j.existsSync(r))return console.error(`${F} already exists at ${r}.`),1;if(t&&!ue(t))return console.error(`Unknown preset "${t}". Available presets: ${K().join(", ")}`),1;let n={$schema:"https://raw.githubusercontent.com/DanielSerio/pickety/main/resources/pickety.schema.json",modules:{features:"src/features/*",components:"src/components/**/*",utils:"src/utils/**/*"},rules:{"module-boundaries":{severity:"error",rules:[{importer:"features",imports:"features",allow:!0,message:"Features can import from their own module."},{importer:"features",imports:"components",allow:!0},{importer:"features",imports:"utils",allow:!0}]}},"boundary-diagrams":!0},s=t?{$schema:n.$schema,preset:t}:n;return j.writeFileSync(r,JSON.stringify(s,null,2)),console.log(`Created ${F} at ${r}`),0}function Lr(){let e=Or(process.argv);e.ok||process.exit(e.exitCode);let{command:t,root:r,target:n,format:s,preset:o,verbose:i}=e;(!t||t==="--help"||t==="-h")&&(Ft(),process.exit(0));let c=0;switch(t){case"check":c=Nr(r,s,i);break;case"impact":c=Ir(r,n,i);break;case"health":c=jr(r,i);break;case"init":c=Pr(r,o);break;default:console.error(`Unknown command: "${t}"`),Ft(),c=1}process.exit(c)}Lr();
|