@mherod/get-cookie 2.1.3 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +2 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/README.md +163 -18
- package/commitlint.config.js +12 -0
- package/dist/chunk-56Z35D5R.js +2 -0
- package/dist/chunk-56Z35D5R.js.map +1 -0
- package/dist/chunk-5FUMK7M3.js +4 -0
- package/dist/chunk-5FUMK7M3.js.map +1 -0
- package/dist/chunk-5ZT2G45S.js +2 -0
- package/dist/chunk-5ZT2G45S.js.map +1 -0
- package/dist/chunk-FR2MKDHT.js +2 -0
- package/dist/chunk-FR2MKDHT.js.map +1 -0
- package/dist/chunk-HMKSQBDC.js +2 -0
- package/dist/chunk-HMKSQBDC.js.map +1 -0
- package/dist/chunk-VMBA4NVU.js +2 -0
- package/dist/chunk-VMBA4NVU.js.map +1 -0
- package/dist/chunk-W3JALMAX.js +2 -0
- package/dist/chunk-W3JALMAX.js.map +1 -0
- package/dist/cli.cjs +19 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/getChromeCookie-4ZWACG6M.js +2 -0
- package/dist/getChromeCookie-4ZWACG6M.js.map +1 -0
- package/dist/getChromePassword-GTIXL733.js +2 -0
- package/dist/getChromePassword-GTIXL733.js.map +1 -0
- package/dist/getCookie-43FKMQEZ.js +2 -0
- package/dist/getCookie-43FKMQEZ.js.map +1 -0
- package/dist/getFirefoxCookie-OJYYZFZP.js +2 -0
- package/dist/getFirefoxCookie-OJYYZFZP.js.map +1 -0
- package/dist/getGroupedRenderedCookies-P5VZXZUC.js +2 -0
- package/dist/getGroupedRenderedCookies-P5VZXZUC.js.map +1 -0
- package/dist/getMergedRenderedCookies-C6TXK2I4.js +2 -0
- package/dist/getMergedRenderedCookies-C6TXK2I4.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +252 -0
- package/dist/index.d.ts +252 -0
- package/dist/index.js +2 -24712
- package/dist/index.js.map +1 -0
- package/eslint.config.js +243 -0
- package/jest.setup.js +11 -0
- package/package.json +87 -36
- package/tsconfig.build.json +9 -0
- package/tsup.cli.ts +27 -0
- package/tsup.config.ts +27 -0
- package/tsup.lib.ts +27 -0
- package/typedoc.json +22 -0
- package/.parcelrc +0 -7
- package/.prettierignore +0 -5
- package/.prettierrc +0 -12
- package/.terserrc +0 -26
- package/build-indexes.ts +0 -108
- package/bun.lockb +0 -0
- package/dist/cli.js +0 -18319
- package/dist/types.d.ts +0 -361
- package/jest.config.ts +0 -14
- package/package-lock.json +0 -5608
- package/src/CookieRow.ts +0 -43
- package/src/CookieSpec.ts +0 -42
- package/src/ExportedCookie.ts +0 -19
- package/src/FetchResponse.ts +0 -13
- package/src/SpecialCases.ts +0 -15
- package/src/StringToRegex.ts +0 -16
- package/src/argv.ts +0 -30
- package/src/browsers/CompositeCookieQueryStrategy.ts +0 -76
- package/src/browsers/CookieQueryStrategy.ts +0 -7
- package/src/browsers/CookieStoreQueryStrategy.ts +0 -115
- package/src/browsers/QuerySqliteThenTransform.ts +0 -48
- package/src/browsers/chrome/ChromeApplicationSupport.ts +0 -14
- package/src/browsers/chrome/ChromeCookieQueryStrategy.ts +0 -158
- package/src/browsers/chrome/decrypt.ts +0 -154
- package/src/browsers/chrome/getChromePassword.ts +0 -28
- package/src/browsers/firefox/FirefoxCookieQueryStrategy.ts +0 -109
- package/src/browsers/getEncryptedChromeCookie.ts +0 -122
- package/src/browsers/index.ts +0 -12
- package/src/browsers/mock/MockCookieQueryStrategy.ts +0 -22
- package/src/browsers/safari/SafariCookieQueryStrategy.ts +0 -42
- package/src/cli.ts +0 -94
- package/src/cliQueryCookies.ts +0 -65
- package/src/comboQueryCookieSpec.test.ts +0 -92
- package/src/comboQueryCookieSpec.ts +0 -26
- package/src/cookieQueryOptions.ts +0 -27
- package/src/cookieSpecsFromUrl.test.ts +0 -65
- package/src/cookieSpecsFromUrl.ts +0 -73
- package/src/decodeBinaryCookies.ts +0 -72
- package/src/execSimple.ts +0 -12
- package/src/fetchWithCookies.test.ts +0 -32
- package/src/fetchWithCookies.ts +0 -217
- package/src/findAllFiles.ts +0 -48
- package/src/getChromeCookie.ts +0 -19
- package/src/getCookie.ts +0 -22
- package/src/getFirefoxCookie.ts +0 -25
- package/src/getGroupedRenderedCookies.ts +0 -42
- package/src/getMergedRenderedCookies.test.ts +0 -43
- package/src/getMergedRenderedCookies.ts +0 -19
- package/src/global.ts +0 -8
- package/src/index.ts +0 -16
- package/src/isValidJwt.ts +0 -26
- package/src/listChromeProfiles.ts +0 -53
- package/src/logger.ts +0 -12
- package/src/processBeforeReturn.ts +0 -29
- package/src/queryCookies.ts +0 -41
- package/src/resultsRendered.ts +0 -24
- package/src/unpackHeaders.ts +0 -18
- package/src/util/flatMapAsync.test.ts +0 -55
- package/src/util/flatMapAsync.ts +0 -41
- package/src/util/index.ts +0 -1
- package/tsconfig.json +0 -26
package/.husky/pre-push
ADDED
package/README.md
CHANGED
|
@@ -1,33 +1,178 @@
|
|
|
1
|
-
# get-cookie
|
|
1
|
+
# get-cookie 🍪
|
|
2
2
|
|
|
3
|
-
## What is it?
|
|
3
|
+
## What is it? 🤔
|
|
4
4
|
|
|
5
|
-
get-cookie is a command
|
|
6
|
-
It is useful for testing web pages that require authentication.
|
|
5
|
+
get-cookie is a powerful command-line utility and Node.js module that allows you to securely retrieve browser cookies from your locally installed browsers. Perfect for:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- 🔐 Testing authenticated web applications
|
|
8
|
+
- 🔍 Debugging cookie-related issues
|
|
9
|
+
- 🤖 Automating browser cookie extraction
|
|
10
|
+
- 🧪 Integration testing with real browser cookies
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## Documentation 📚
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
Visit our [comprehensive documentation](https://mherod.github.io/get-cookie/) for:
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
- Detailed API reference
|
|
17
|
+
- Getting started guides
|
|
18
|
+
- Advanced usage examples
|
|
19
|
+
- TypeScript type definitions
|
|
15
20
|
|
|
16
|
-
##
|
|
21
|
+
## Features ✨
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
- 🌐 **Multi-Browser Support**: Works with Chrome, Firefox, and Safari
|
|
24
|
+
- 🔒 **Secure**: Safe cookie extraction with proper encryption handling
|
|
25
|
+
- 📝 **TypeScript Ready**: Built with TypeScript for excellent type safety
|
|
26
|
+
- 🎯 **Flexible Querying**: Search by name, domain, or URL pattern
|
|
27
|
+
- 🔄 **Multiple Output Formats**: JSON, rendered, or grouped results
|
|
28
|
+
- 👥 **Profile Support**: Query cookies from different browser profiles
|
|
19
29
|
|
|
20
|
-
|
|
30
|
+
## Installation 📦
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
Install from npm registry using your preferred package manager:
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
```bash
|
|
35
|
+
# Using pnpm (recommended)
|
|
36
|
+
pnpm add @mherod/get-cookie
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
# Using npm
|
|
39
|
+
npm install @mherod/get-cookie
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
# Using yarn
|
|
42
|
+
yarn add @mherod/get-cookie
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For global installation:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Using pnpm (recommended)
|
|
49
|
+
pnpm add -g @mherod/get-cookie
|
|
50
|
+
|
|
51
|
+
# Using npm
|
|
52
|
+
npm install -g @mherod/get-cookie
|
|
53
|
+
|
|
54
|
+
# Using yarn
|
|
55
|
+
yarn global add @mherod/get-cookie
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Note: Currently only macOS is supported. Windows support is planned for a future release.** 🚧
|
|
59
|
+
|
|
60
|
+
## How do I use it? 🚀
|
|
61
|
+
|
|
62
|
+
### CLI Usage 💻
|
|
63
|
+
|
|
64
|
+
Basic cookie retrieval:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Get a specific cookie
|
|
68
|
+
get-cookie auth example.com
|
|
69
|
+
|
|
70
|
+
# Get all cookies for a domain
|
|
71
|
+
get-cookie % example.com
|
|
72
|
+
|
|
73
|
+
# Get cookies with output formatting
|
|
74
|
+
get-cookie auth example.com --render
|
|
75
|
+
get-cookie auth example.com --dump-grouped
|
|
76
|
+
|
|
77
|
+
# Get cookies from a specific URL
|
|
78
|
+
get-cookie --url https://example.com/path
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Node.js Module Usage 📚
|
|
82
|
+
|
|
83
|
+
Basic usage:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { getCookie } from "@mherod/get-cookie";
|
|
87
|
+
|
|
88
|
+
// Get a specific cookie
|
|
89
|
+
const authCookies = await getCookie({
|
|
90
|
+
name: "auth",
|
|
91
|
+
domain: "example.com",
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// Get all cookies for a domain
|
|
95
|
+
const allCookies = await getCookie({
|
|
96
|
+
name: "%",
|
|
97
|
+
domain: "example.com",
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Get cookies from multiple specifications
|
|
101
|
+
import { comboQueryCookieSpec } from "@mherod/get-cookie";
|
|
102
|
+
|
|
103
|
+
const cookies = await comboQueryCookieSpec(
|
|
104
|
+
[
|
|
105
|
+
{ name: "session", domain: "api.example.com" },
|
|
106
|
+
{ name: "auth", domain: "auth.example.com" },
|
|
107
|
+
],
|
|
108
|
+
{
|
|
109
|
+
removeExpired: true,
|
|
110
|
+
limit: 10,
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Advanced Usage 🔧
|
|
116
|
+
|
|
117
|
+
Using browser-specific strategies:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import {
|
|
121
|
+
ChromeCookieQueryStrategy,
|
|
122
|
+
FirefoxCookieQueryStrategy,
|
|
123
|
+
} from "@mherod/get-cookie";
|
|
124
|
+
|
|
125
|
+
// Query Chrome cookies
|
|
126
|
+
const chromeStrategy = new ChromeCookieQueryStrategy();
|
|
127
|
+
const chromeCookies = await chromeStrategy.queryCookies(
|
|
128
|
+
"sessionId",
|
|
129
|
+
"example.com",
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Query Firefox cookies
|
|
133
|
+
const firefoxStrategy = new FirefoxCookieQueryStrategy();
|
|
134
|
+
const firefoxCookies = await firefoxStrategy.queryCookies(
|
|
135
|
+
"auth",
|
|
136
|
+
"example.com",
|
|
137
|
+
);
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Using URL-based cookie extraction:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { cookieSpecsFromUrl } from "@mherod/get-cookie";
|
|
144
|
+
|
|
145
|
+
// Get all cookies needed for a specific URL
|
|
146
|
+
const specs = cookieSpecsFromUrl("https://example.com/dashboard");
|
|
147
|
+
const cookies = await comboQueryCookieSpec(specs);
|
|
148
|
+
```
|
|
29
149
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
150
|
+
## Output Formats 📊
|
|
151
|
+
|
|
152
|
+
The CLI supports various output formats:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Default output (just values)
|
|
156
|
+
get-cookie auth example.com
|
|
157
|
+
|
|
158
|
+
# JSON output
|
|
159
|
+
get-cookie auth example.com --output json
|
|
160
|
+
|
|
161
|
+
# Rendered output (human-readable)
|
|
162
|
+
get-cookie auth example.com --render
|
|
163
|
+
|
|
164
|
+
# Grouped by browser/profile
|
|
165
|
+
get-cookie auth example.com --dump-grouped
|
|
33
166
|
```
|
|
167
|
+
|
|
168
|
+
## Contributing 🤝
|
|
169
|
+
|
|
170
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
171
|
+
|
|
172
|
+
## License 📄
|
|
173
|
+
|
|
174
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
175
|
+
|
|
176
|
+
## Security 🛡️
|
|
177
|
+
|
|
178
|
+
This tool handles sensitive data (cookies). Always be careful when extracting and storing cookie information. Never share your cookies or use this tool on untrusted machines.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: ["@commitlint/config-conventional"],
|
|
3
|
+
rules: {
|
|
4
|
+
"body-max-line-length": [2, "always", 100],
|
|
5
|
+
"header-max-length": [2, "always", 72],
|
|
6
|
+
"subject-case": [
|
|
7
|
+
2,
|
|
8
|
+
"never",
|
|
9
|
+
["sentence-case", "start-case", "pascal-case", "upper-case"],
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createConsola as g}from"consola";var a=g({fancy:!0,formatOptions:{showLogLevel:!1,colors:!0,date:!1,compact:!0,columns:typeof process.stdout.columns=="number"?process.stdout.columns:80},level:typeof process.env.LOG_LEVEL=="string"&&process.env.LOG_LEVEL==="debug"?5:2}),t=a;function u(n,o,e){let s=`${o?"\u2705":"\u274C"} ${n} ${o?"succeeded":"failed"}`;o?t.success(s,e):t.error(s,e)}function l(n,o,e){let r={...e!=null?e:{},error:o instanceof Error?{name:o.name,message:o.message,stack:o.stack}:o};t.error(n,r)}function f(n,o,e){t.withTag(n).debug(o,e)}function m(n){return t.withTag(n)}function d(n,o,e){t.withTag(n).warn(o,e)}export{t as a,u as b,l as c,f as d,m as e,d as f};
|
|
2
|
+
//# sourceMappingURL=chunk-56Z35D5R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/logger.ts","../src/utils/logHelpers.ts"],"sourcesContent":["import { createConsola } from \"consola\";\n\n/**\n * Standard log levels and their usage:\n * - debug: Detailed information for debugging\n * - info: General operational information\n * - success: Successful operations\n * - warn: Warning conditions\n * - error: Error conditions that might still allow the app to continue\n * - fatal: Critical errors that prevent the app from continuing\n */\nconst consola = createConsola({\n fancy: true,\n formatOptions: {\n showLogLevel: false,\n colors: true,\n date: false,\n compact: true,\n columns:\n typeof process.stdout.columns === \"number\" ? process.stdout.columns : 80,\n },\n level:\n typeof process.env.LOG_LEVEL === \"string\" &&\n process.env.LOG_LEVEL === \"debug\"\n ? 5\n : 2,\n});\n\n/**\n * Configured consola logger instance with standardized formatting and colored output.\n * Used for consistent logging throughout the application.\n * @example\n * // Basic usage\n * logger.info('Operation started');\n * logger.success('Task completed');\n * logger.error('Failed to process', error);\n *\n * // Tagged logging for module context\n * const moduleLogger = logger.withTag('ModuleName');\n * moduleLogger.info('Module specific log');\n *\n * // Structured logging\n * logger.info('User action', {\n * userId: '123',\n * action: 'login',\n * timestamp: new Date()\n * });\n *\n * // Error logging with full context\n * logger.error('Operation failed', {\n * error: error,\n * context: 'operation name',\n * input: data\n * });\n */\nexport default consola;\n","import logger from \"./logger\";\n\n/**\n * Helper functions for common logging patterns.\n * @module\n * @example\n * ```typescript\n * import { logOperationResult, logError } from './logHelpers';\n *\n * try {\n * const result = await someOperation();\n * logOperationResult('Operation', true, { data: result });\n * } catch (error) {\n * logError('Operation failed', error);\n * }\n * ```\n */\n\ninterface OperationContext {\n [key: string]: unknown;\n}\n\n/**\n * Logs the result of an operation with consistent formatting.\n * @param operation - Name of the operation.\n * @param success - Whether the operation succeeded.\n * @param [context] - Additional context about the operation.\n * @example\n * ```typescript\n * logOperationResult('Database Backup', true, { size: '1.2GB' });\n * // ✅ Database Backup succeeded\n *\n * logOperationResult('File Upload', false, { error: 'Network timeout' });\n * // ❌ File Upload failed\n * ```\n */\nexport function logOperationResult(\n operation: string,\n success: boolean,\n context?: OperationContext,\n): void {\n const icon = success ? \"✅\" : \"❌\";\n const message = `${icon} ${operation} ${success ? \"succeeded\" : \"failed\"}`;\n\n if (success) {\n logger.success(message, context);\n } else {\n logger.error(message, context);\n }\n}\n\n/**\n * Logs an error with consistent formatting and context.\n * @param message - Error message to display.\n * @param error - Error object or error information.\n * @param [context] - Additional context about the error.\n * @example\n * ```typescript\n * try {\n * throw new Error('Connection failed');\n * } catch (error) {\n * logError('Database error', error, { retries: 3 });\n * }\n * ```\n */\nexport function logError(\n message: string,\n error: unknown,\n context?: OperationContext,\n): void {\n const errorContext = {\n ...(context ?? {}),\n error:\n error instanceof Error\n ? {\n name: error.name,\n message: error.message,\n stack: error.stack,\n }\n : error,\n };\n\n logger.error(message, errorContext);\n}\n\n/**\n * Logs debug information with consistent formatting.\n * @param component - Component or module name.\n * @param message - Debug message to log.\n * @param [data] - Optional debug data to include.\n * @example\n * ```typescript\n * logDebug('AuthService', 'Token refresh started', { userId: '123' });\n * ```\n */\nexport function logDebug(\n component: string,\n message: string,\n data?: unknown,\n): void {\n const componentLogger = logger.withTag(component);\n componentLogger.debug(message, data);\n}\n\n/**\n * Creates a tagged logger with consistent naming.\n * @param component - Component or module name.\n * @returns A tagged logger instance.\n * @example\n * ```typescript\n * const dbLogger = createTaggedLogger('Database');\n * dbLogger.info('Connection established');\n * ```\n */\nexport function createTaggedLogger(\n component: string,\n): ReturnType<typeof logger.withTag> {\n return logger.withTag(component);\n}\n\n/**\n * Logs a warning with consistent formatting.\n * @param component - Component or module name.\n * @param message - Warning message to display.\n * @param [context] - Additional context about the warning.\n * @example\n * ```typescript\n * logWarn('Cache', 'Cache miss', { key: 'user-123' });\n * ```\n */\nexport function logWarn(\n component: string,\n message: string,\n context?: OperationContext,\n): void {\n const componentLogger = logger.withTag(component);\n componentLogger.warn(message, context);\n}\n\n// Re-export the base logger for direct usage\n/**\n * Re-export of the base logger for direct usage.\n */\nexport { default as logger } from \"./logger\";\n"],"mappings":"AAAA,OAAS,iBAAAA,MAAqB,UAW9B,IAAMC,EAAUD,EAAc,CAC5B,MAAO,GACP,cAAe,CACb,aAAc,GACd,OAAQ,GACR,KAAM,GACN,QAAS,GACT,QACE,OAAO,QAAQ,OAAO,SAAY,SAAW,QAAQ,OAAO,QAAU,EAC1E,EACA,MACE,OAAO,QAAQ,IAAI,WAAc,UACjC,QAAQ,IAAI,YAAc,QACtB,EACA,CACR,CAAC,EA6BME,EAAQD,ECnBR,SAASE,EACdC,EACAC,EACAC,EACM,CAEN,IAAMC,EAAU,GADHF,EAAU,SAAM,QACN,IAAID,CAAS,IAAIC,EAAU,YAAc,QAAQ,GAEpEA,EACFG,EAAO,QAAQD,EAASD,CAAO,EAE/BE,EAAO,MAAMD,EAASD,CAAO,CAEjC,CAgBO,SAASG,EACdF,EACAG,EACAJ,EACM,CACN,IAAMK,EAAe,CACnB,GAAIL,GAAA,KAAAA,EAAW,CAAC,EAChB,MACEI,aAAiB,MACb,CACE,KAAMA,EAAM,KACZ,QAASA,EAAM,QACf,MAAOA,EAAM,KACf,EACAA,CACR,EAEAF,EAAO,MAAMD,EAASI,CAAY,CACpC,CAYO,SAASC,EACdC,EACAN,EACAO,EACM,CACkBN,EAAO,QAAQK,CAAS,EAChC,MAAMN,EAASO,CAAI,CACrC,CAYO,SAASC,EACdF,EACmC,CACnC,OAAOL,EAAO,QAAQK,CAAS,CACjC,CAYO,SAASG,EACdH,EACAN,EACAD,EACM,CACkBE,EAAO,QAAQK,CAAS,EAChC,KAAKN,EAASD,CAAO,CACvC","names":["createConsola","consola","logger_default","logOperationResult","operation","success","context","message","logger_default","logError","error","errorContext","logDebug","component","data","createTaggedLogger","logWarn"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{c as Ie}from"./chunk-56Z35D5R.js";import{a as Fs,b as ir,c as f,d as o,e as w,f as p,g as b}from"./chunk-VMBA4NVU.js";var $s=Fs((Un,Ws)=>{"use strict";Ws.exports=Bs;function Bs(n,t,e){n instanceof RegExp&&(n=js(n,e)),t instanceof RegExp&&(t=js(t,e));var s=Is(n,t,e);return s&&{start:s[0],end:s[1],pre:e.slice(0,s[0]),body:e.slice(s[0]+n.length,s[1]),post:e.slice(s[1]+t.length)}}function js(n,t){var e=t.match(n);return e?e[0]:null}Bs.range=Is;function Is(n,t,e){var s,i,r,h,l,a=e.indexOf(n),c=e.indexOf(t,a+1),u=a;if(a>=0&&c>0){if(n===t)return[a,c];for(s=[],r=e.length;u>=0&&!l;)u==a?(s.push(u),a=e.indexOf(n,u+1)):s.length==1?l=[s.pop(),c]:(i=s.pop(),i<r&&(r=i,h=c),c=e.indexOf(t,u+1)),u=a<c&&a>=0?a:c;s.length&&(l=[r,h])}return l}});var Vs=Fs((_n,Ks)=>{"use strict";var Us=$s();Ks.exports=cr;var _s="\0SLASH"+Math.random()+"\0",zs="\0OPEN"+Math.random()+"\0",hs="\0CLOSE"+Math.random()+"\0",Gs="\0COMMA"+Math.random()+"\0",qs="\0PERIOD"+Math.random()+"\0";function os(n){return parseInt(n,10)==n?parseInt(n,10):n.charCodeAt(0)}function ar(n){return n.split("\\\\").join(_s).split("\\{").join(zs).split("\\}").join(hs).split("\\,").join(Gs).split("\\.").join(qs)}function lr(n){return n.split(_s).join("\\").split(zs).join("{").split(hs).join("}").split(Gs).join(",").split(qs).join(".")}function Hs(n){if(!n)return[""];var t=[],e=Us("{","}",n);if(!e)return n.split(",");var s=e.pre,i=e.body,r=e.post,h=s.split(",");h[h.length-1]+="{"+i+"}";var l=Hs(r);return r.length&&(h[h.length-1]+=l.shift(),h.push.apply(h,l)),t.push.apply(t,h),t}function cr(n){return n?(n.substr(0,2)==="{}"&&(n="\\{\\}"+n.substr(2)),Xt(ar(n),!0).map(lr)):[]}function fr(n){return"{"+n+"}"}function ur(n){return/^-?0\d/.test(n)}function pr(n,t){return n<=t}function dr(n,t){return n>=t}function Xt(n,t){var e=[],s=Us("{","}",n);if(!s)return[n];var i=s.pre,r=s.post.length?Xt(s.post,!1):[""];if(/\$$/.test(s.pre))for(var h=0;h<r.length;h++){var l=i+"{"+s.body+"}"+r[h];e.push(l)}else{var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),u=a||c,m=s.body.indexOf(",")>=0;if(!u&&!m)return s.post.match(/,.*\}/)?(n=s.pre+"{"+s.body+hs+s.post,Xt(n)):[n];var d;if(u)d=s.body.split(/\.\./);else if(d=Hs(s.body),d.length===1&&(d=Xt(d[0],!1).map(fr),d.length===1))return r.map(function(sr){return s.pre+d[0]+sr});var y;if(u){var k=os(d[0]),g=os(d[1]),v=Math.max(d[0].length,d[1].length),x=d.length==3?Math.abs(os(d[2])):1,T=pr,C=g<k;C&&(x*=-1,T=dr);var N=d.some(ur);y=[];for(var q=k;T(q,g);q+=x){var Y;if(c)Y=String.fromCharCode(q),Y==="\\"&&(Y="");else if(Y=String(q),N){var Ls=v-Y.length;if(Ls>0){var Ps=new Array(Ls+1).join("0");q<0?Y="-"+Ps+Y.slice(1):Y=Ps+Y}}y.push(Y)}}else{y=[];for(var Rt=0;Rt<d.length;Rt++)y.push.apply(y,Xt(d[Rt],!1))}for(var Rt=0;Rt<y.length;Rt++)for(var h=0;h<r.length;h++){var l=i+y[Rt]+r[h];(!t||u||l)&&e.push(l)}}return e}});import rr from"better-sqlite3";import{memoize as nr}from"lodash-es";var or=nr(n=>{try{return Promise.resolve(new rr(n,{readonly:!0}))}catch(t){throw Ie("Database open failed",t,{file:n}),t}});function hr(n){try{return n.close(),Promise.resolve()}catch(t){return Ie("Database close failed",t),Promise.reject(t instanceof Error?t:new Error("Failed to close database: Unknown error"))}}async function Wn({file:n,sql:t,params:e,rowFilter:s,rowTransform:i}){let r;try{r=await or(n);let l=r.prepare(t).all(e),a=s?l.filter(s):l;return i?a.map(i):a}catch(h){throw Ie("Database query failed",h,{file:n,sql:t}),h}finally{r&&await hr(r)}}var ri=ir(Vs(),1);var te=n=>{if(typeof n!="string")throw new TypeError("invalid pattern");if(n.length>65536)throw new TypeError("pattern is too long")};var mr={"[: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]},ee=n=>n.replace(/[[\]\\-]/g,"\\$&"),gr=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ys=n=>n.join(""),Js=(n,t)=>{let e=t;if(n.charAt(e)!=="[")throw new Error("not in a brace expression");let s=[],i=[],r=e+1,h=!1,l=!1,a=!1,c=!1,u=e,m="";t:for(;r<n.length;){let g=n.charAt(r);if((g==="!"||g==="^")&&r===e+1){c=!0,r++;continue}if(g==="]"&&h&&!a){u=r+1;break}if(h=!0,g==="\\"&&!a){a=!0,r++;continue}if(g==="["&&!a){for(let[v,[x,T,C]]of Object.entries(mr))if(n.startsWith(v,r)){if(m)return["$.",!1,n.length-e,!0];r+=v.length,C?i.push(x):s.push(x),l=l||T;continue t}}if(a=!1,m){g>m?s.push(ee(m)+"-"+ee(g)):g===m&&s.push(ee(g)),m="",r++;continue}if(n.startsWith("-]",r+1)){s.push(ee(g+"-")),r+=2;continue}if(n.startsWith("-",r+1)){m=g,r+=2;continue}s.push(ee(g)),r++}if(u<r)return["",!1,0,!1];if(!s.length&&!i.length)return["$.",!1,n.length-e,!0];if(i.length===0&&s.length===1&&/^\\?.$/.test(s[0])&&!c){let g=s[0].length===2?s[0].slice(-1):s[0];return[gr(g),!1,u-e,!1]}let d="["+(c?"^":"")+Ys(s)+"]",y="["+(c?"":"^")+Ys(i)+"]";return[s.length&&i.length?"("+d+"|"+y+")":s.length?d:y,l,u-e,!0]};var tt=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/\[([^\/\\])\]/g,"$1"):n.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var wr=new Set(["!","?","+","*","@"]),Zs=n=>wr.has(n),yr="(?!(?:^|/)\\.\\.?(?:$|/))",We="(?!\\.)",br=new Set(["[","."]),Sr=new Set(["..","."]),Er=new Set("().*{}+?[]^$\\!"),xr=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),ls="[^/]",Qs=ls+"*?",Xs=ls+"+?",A,L,ct,R,D,yt,Mt,bt,nt,Dt,se,Nt,ti,St,$e,as,ei,U=class U{constructor(t,e,s={}){w(this,Nt);f(this,"type");w(this,A);w(this,L);w(this,ct,!1);w(this,R,[]);w(this,D);w(this,yt);w(this,Mt);w(this,bt,!1);w(this,nt);w(this,Dt);w(this,se,!1);this.type=t,t&&p(this,L,!0),p(this,D,e),p(this,A,o(this,D)?o(o(this,D),A):this),p(this,nt,o(this,A)===this?s:o(o(this,A),nt)),p(this,Mt,o(this,A)===this?[]:o(o(this,A),Mt)),t==="!"&&!o(o(this,A),bt)&&o(this,Mt).push(this),p(this,yt,o(this,D)?o(o(this,D),R).length:0)}get hasMagic(){if(o(this,L)!==void 0)return o(this,L);for(let t of o(this,R))if(typeof t!="string"&&(t.type||t.hasMagic))return p(this,L,!0);return o(this,L)}toString(){return o(this,Dt)!==void 0?o(this,Dt):this.type?p(this,Dt,this.type+"("+o(this,R).map(t=>String(t)).join("|")+")"):p(this,Dt,o(this,R).map(t=>String(t)).join(""))}push(...t){for(let e of t)if(e!==""){if(typeof e!="string"&&!(e instanceof U&&o(e,D)===this))throw new Error("invalid part: "+e);o(this,R).push(e)}}toJSON(){var e;let t=this.type===null?o(this,R).slice().map(s=>typeof s=="string"?s:s.toJSON()):[this.type,...o(this,R).map(s=>s.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===o(this,A)||o(o(this,A),bt)&&((e=o(this,D))==null?void 0:e.type)==="!")&&t.push({}),t}isStart(){var e;if(o(this,A)===this)return!0;if(!((e=o(this,D))!=null&&e.isStart()))return!1;if(o(this,yt)===0)return!0;let t=o(this,D);for(let s=0;s<o(this,yt);s++){let i=o(t,R)[s];if(!(i instanceof U&&i.type==="!"))return!1}return!0}isEnd(){var e,s,i;if(o(this,A)===this||((e=o(this,D))==null?void 0:e.type)==="!")return!0;if(!((s=o(this,D))!=null&&s.isEnd()))return!1;if(!this.type)return(i=o(this,D))==null?void 0:i.isEnd();let t=o(this,D)?o(o(this,D),R).length:0;return o(this,yt)===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let e=new U(this.type,t);for(let s of o(this,R))e.copyIn(s);return e}static fromGlob(t,e={}){var i;let s=new U(null,void 0,e);return b(i=U,St,$e).call(i,t,s,0,e),s}toMMPattern(){if(this!==o(this,A))return o(this,A).toMMPattern();let t=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||o(this,L)||o(this,nt).nocase&&!o(this,nt).nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;let l=(o(this,nt).nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,l),{_src:e,_glob:t})}get options(){return o(this,nt)}toRegExpSource(t){var a;let e=t!=null?t:!!o(this,nt).dot;if(o(this,A)===this&&b(this,Nt,ti).call(this),!this.type){let c=this.isStart()&&this.isEnd(),u=o(this,R).map(k=>{var C;let[g,v,x,T]=typeof k=="string"?b(C=U,St,ei).call(C,k,o(this,L),c):k.toRegExpSource(t);return p(this,L,o(this,L)||x),p(this,ct,o(this,ct)||T),g}).join(""),m="";if(this.isStart()&&typeof o(this,R)[0]=="string"&&!(o(this,R).length===1&&Sr.has(o(this,R)[0]))){let g=br,v=e&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),x=!e&&!t&&g.has(u.charAt(0));m=v?yr:x?We:""}let d="";return this.isEnd()&&o(o(this,A),bt)&&((a=o(this,D))==null?void 0:a.type)==="!"&&(d="(?:$|\\/)"),[m+u+d,tt(u),p(this,L,!!o(this,L)),o(this,ct)]}let s=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",r=b(this,Nt,as).call(this,e);if(this.isStart()&&this.isEnd()&&!r&&this.type!=="!"){let c=this.toString();return p(this,R,[c]),this.type=null,p(this,L,void 0),[c,tt(this.toString()),!1,!1]}let h=!s||t||e||!We?"":b(this,Nt,as).call(this,!0);h===r&&(h=""),h&&(r=`(?:${r})(?:${h})*?`);let l="";if(this.type==="!"&&o(this,se))l=(this.isStart()&&!e?We:"")+Xs;else{let c=this.type==="!"?"))"+(this.isStart()&&!e&&!t?We:"")+Qs+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&h?")":this.type==="*"&&h?")?":`)${this.type}`;l=i+r+c}return[l,tt(r),p(this,L,!!o(this,L)),o(this,ct)]}};A=new WeakMap,L=new WeakMap,ct=new WeakMap,R=new WeakMap,D=new WeakMap,yt=new WeakMap,Mt=new WeakMap,bt=new WeakMap,nt=new WeakMap,Dt=new WeakMap,se=new WeakMap,Nt=new WeakSet,ti=function(){if(this!==o(this,A))throw new Error("should only call on root");if(o(this,bt))return this;this.toString(),p(this,bt,!0);let t;for(;t=o(this,Mt).pop();){if(t.type!=="!")continue;let e=t,s=o(e,D);for(;s;){for(let i=o(e,yt)+1;!s.type&&i<o(s,R).length;i++)for(let r of o(t,R)){if(typeof r=="string")throw new Error("string part in extglob AST??");r.copyIn(o(s,R)[i])}e=s,s=o(e,D)}}return this},St=new WeakSet,$e=function(t,e,s,i){var y,k;let r=!1,h=!1,l=-1,a=!1;if(e.type===null){let g=s,v="";for(;g<t.length;){let x=t.charAt(g++);if(r||x==="\\"){r=!r,v+=x;continue}if(h){g===l+1?(x==="^"||x==="!")&&(a=!0):x==="]"&&!(g===l+2&&a)&&(h=!1),v+=x;continue}else if(x==="["){h=!0,l=g,a=!1,v+=x;continue}if(!i.noext&&Zs(x)&&t.charAt(g)==="("){e.push(v),v="";let T=new U(x,e);g=b(y=U,St,$e).call(y,t,T,g,i),e.push(T);continue}v+=x}return e.push(v),g}let c=s+1,u=new U(null,e),m=[],d="";for(;c<t.length;){let g=t.charAt(c++);if(r||g==="\\"){r=!r,d+=g;continue}if(h){c===l+1?(g==="^"||g==="!")&&(a=!0):g==="]"&&!(c===l+2&&a)&&(h=!1),d+=g;continue}else if(g==="["){h=!0,l=c,a=!1,d+=g;continue}if(Zs(g)&&t.charAt(c)==="("){u.push(d),d="";let v=new U(g,u);u.push(v),c=b(k=U,St,$e).call(k,t,v,c,i);continue}if(g==="|"){u.push(d),d="",m.push(u),u=new U(null,e);continue}if(g===")")return d===""&&o(e,R).length===0&&p(e,se,!0),u.push(d),d="",e.push(...m,u),c;d+=g}return e.type=null,p(e,L,void 0),p(e,R,[t.substring(s-1)]),c},as=function(t){return o(this,R).map(e=>{if(typeof e=="string")throw new Error("string type in extglob ast??");let[s,i,r,h]=e.toRegExpSource(t);return p(this,ct,o(this,ct)||h),s}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")},ei=function(t,e,s=!1){let i=!1,r="",h=!1;for(let l=0;l<t.length;l++){let a=t.charAt(l);if(i){i=!1,r+=(Er.has(a)?"\\":"")+a;continue}if(a==="\\"){l===t.length-1?r+="\\\\":i=!0;continue}if(a==="["){let[c,u,m,d]=Js(t,l);if(m){r+=c,h=h||u,l+=m-1,e=e||d;continue}}if(a==="*"){s&&t==="*"?r+=Xs:r+=Qs,e=!0;continue}if(a==="?"){r+=ls,e=!0;continue}r+=xr(a)}return[r,tt(t),!!e,h]},w(U,St);var Wt=U;var $t=(n,{windowsPathsNoEscape:t=!1}={})=>t?n.replace(/[?*()[\]]/g,"[$&]"):n.replace(/[?*()[\]\\]/g,"\\$&");var _=(n,t,e={})=>(te(t),!e.nocomment&&t.charAt(0)==="#"?!1:new H(t,e).match(n)),vr=/^\*+([^+@!?\*\[\(]*)$/,kr=n=>t=>!t.startsWith(".")&&t.endsWith(n),Tr=n=>t=>t.endsWith(n),Cr=n=>(n=n.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(n)),Rr=n=>(n=n.toLowerCase(),t=>t.toLowerCase().endsWith(n)),Mr=/^\*+\.\*+$/,Dr=n=>!n.startsWith(".")&&n.includes("."),Nr=n=>n!=="."&&n!==".."&&n.includes("."),Ar=/^\.\*+$/,Or=n=>n!=="."&&n!==".."&&n.startsWith("."),Lr=/^\*+$/,Pr=n=>n.length!==0&&!n.startsWith("."),Fr=n=>n.length!==0&&n!=="."&&n!=="..",jr=/^\?+([^+@!?\*\[\(]*)?$/,Br=([n,t=""])=>{let e=ni([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Ir=([n,t=""])=>{let e=oi([n]);return t?(t=t.toLowerCase(),s=>e(s)&&s.toLowerCase().endsWith(t)):e},Wr=([n,t=""])=>{let e=oi([n]);return t?s=>e(s)&&s.endsWith(t):e},$r=([n,t=""])=>{let e=ni([n]);return t?s=>e(s)&&s.endsWith(t):e},ni=([n])=>{let t=n.length;return e=>e.length===t&&!e.startsWith(".")},oi=([n])=>{let t=n.length;return e=>e.length===t&&e!=="."&&e!==".."},hi=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",si={win32:{sep:"\\"},posix:{sep:"/"}},Ur=hi==="win32"?si.win32.sep:si.posix.sep;_.sep=Ur;var I=Symbol("globstar **");_.GLOBSTAR=I;var _r="[^/]",zr=_r+"*?",Gr="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",qr="(?:(?!(?:\\/|^)\\.).)*?",Hr=(n,t={})=>e=>_(e,n,t);_.filter=Hr;var J=(n,t={})=>Object.assign({},n,t),Kr=n=>{if(!n||typeof n!="object"||!Object.keys(n).length)return _;let t=_;return Object.assign((s,i,r={})=>t(s,i,J(n,r)),{Minimatch:class extends t.Minimatch{constructor(i,r={}){super(i,J(n,r))}static defaults(i){return t.defaults(J(n,i)).Minimatch}},AST:class extends t.AST{constructor(i,r,h={}){super(i,r,J(n,h))}static fromGlob(i,r={}){return t.AST.fromGlob(i,J(n,r))}},unescape:(s,i={})=>t.unescape(s,J(n,i)),escape:(s,i={})=>t.escape(s,J(n,i)),filter:(s,i={})=>t.filter(s,J(n,i)),defaults:s=>t.defaults(J(n,s)),makeRe:(s,i={})=>t.makeRe(s,J(n,i)),braceExpand:(s,i={})=>t.braceExpand(s,J(n,i)),match:(s,i,r={})=>t.match(s,i,J(n,r)),sep:t.sep,GLOBSTAR:I})};_.defaults=Kr;var ai=(n,t={})=>(te(n),t.nobrace||!/\{(?:(?!\{).)*\}/.test(n)?[n]:(0,ri.default)(n));_.braceExpand=ai;var Vr=(n,t={})=>new H(n,t).makeRe();_.makeRe=Vr;var Yr=(n,t,e={})=>{let s=new H(t,e);return n=n.filter(i=>s.match(i)),s.options.nonull&&!n.length&&n.push(t),n};_.match=Yr;var ii=/[?*]|[+@!]\(.*?\)|\[|\]/,Jr=n=>n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),H=class{constructor(t,e={}){f(this,"options");f(this,"set");f(this,"pattern");f(this,"windowsPathsNoEscape");f(this,"nonegate");f(this,"negate");f(this,"comment");f(this,"empty");f(this,"preserveMultipleSlashes");f(this,"partial");f(this,"globSet");f(this,"globParts");f(this,"nocase");f(this,"isWindows");f(this,"platform");f(this,"windowsNoMagicRoot");f(this,"regexp");te(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||hi,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=e.windowsNoMagicRoot!==void 0?e.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 e of t)if(typeof e!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,e=this.options;if(!e.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...r)=>console.error(...r)),this.debug(this.pattern,this.globSet);let s=this.globSet.map(r=>this.slashSplit(r));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map((r,h,l)=>{if(this.isWindows&&this.windowsNoMagicRoot){let a=r[0]===""&&r[1]===""&&(r[2]==="?"||!ii.test(r[2]))&&!ii.test(r[3]),c=/^[a-z]:/i.test(r[0]);if(a)return[...r.slice(0,4),...r.slice(4).map(u=>this.parse(u))];if(c)return[r[0],...r.slice(1).map(u=>this.parse(u))]}return r.map(a=>this.parse(a))});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 h=this.set[r];h[0]===""&&h[1]===""&&this.globParts[r][2]==="?"&&typeof h[3]=="string"&&/^[a-z]:$/i.test(h[3])&&(h[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let s=0;s<t.length;s++)for(let i=0;i<t[s].length;i++)t[s][i]==="**"&&(t[s][i]="*");let{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):e>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(e=>{let s=-1;for(;(s=e.indexOf("**",s+1))!==-1;){let i=s;for(;e[i+1]==="**";)i++;i!==s&&e.splice(s,i-s)}return e})}levelOneOptimize(t){return t.map(e=>(e=e.reduce((s,i)=>{let r=s[s.length-1];return i==="**"&&r==="**"?s:i===".."&&r&&r!==".."&&r!=="."&&r!=="**"?(s.pop(),s):(s.push(i),s)},[]),e.length===0?[""]:e))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let r=t[i];i===1&&r===""&&t[0]===""||(r==="."||r==="")&&(e=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(e=!0,t.pop())}let s=0;for(;(s=t.indexOf("..",s+1))!==-1;){let i=t[s-1];i&&i!=="."&&i!==".."&&i!=="**"&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return t.length===0?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let i=-1;for(;(i=s.indexOf("**",i+1))!==-1;){let h=i;for(;s[h+1]==="**";)h++;h>i&&s.splice(i+1,h-i);let l=s[i+1],a=s[i+2],c=s[i+3];if(l!==".."||!a||a==="."||a===".."||!c||c==="."||c==="..")continue;e=!0,s.splice(i,1);let u=s.slice(0);u[i]="**",t.push(u),i--}if(!this.preserveMultipleSlashes){for(let h=1;h<s.length-1;h++){let l=s[h];h===1&&l===""&&s[0]===""||(l==="."||l==="")&&(e=!0,s.splice(h,1),h--)}s[0]==="."&&s.length===2&&(s[1]==="."||s[1]==="")&&(e=!0,s.pop())}let r=0;for(;(r=s.indexOf("..",r+1))!==-1;){let h=s[r-1];if(h&&h!=="."&&h!==".."&&h!=="**"){e=!0;let a=r===1&&s[r+1]==="**"?["."]:[];s.splice(r-1,2,...a),s.length===0&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){let i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter(e=>e.length)}partsMatch(t,e,s=!1){let i=0,r=0,h=[],l="";for(;i<t.length&&r<e.length;)if(t[i]===e[r])h.push(l==="b"?e[r]:t[i]),i++,r++;else if(s&&t[i]==="**"&&e[r]===t[i+1])h.push(t[i]),i++;else if(s&&e[r]==="**"&&t[i]===e[r+1])h.push(e[r]),r++;else if(t[i]==="*"&&e[r]&&(this.options.dot||!e[r].startsWith("."))&&e[r]!=="**"){if(l==="b")return!1;l="a",h.push(t[i]),i++,r++}else if(e[r]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(l==="a")return!1;l="b",h.push(e[r]),i++,r++}else return!1;return t.length===e.length&&h}parseNegate(){if(this.nonegate)return;let t=this.pattern,e=!1,s=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){let i=this.options;if(this.isWindows){let g=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),v=!g&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),x=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!x&&e[0]===""&&e[1]===""&&e[2]==="?"&&typeof e[3]=="string"&&/^[a-z]:$/i.test(e[3]),C=v?3:g?0:void 0,N=T?3:x?0:void 0;if(typeof C=="number"&&typeof N=="number"){let[q,Y]=[t[C],e[N]];q.toLowerCase()===Y.toLowerCase()&&(e[N]=q,N>C?e=e.slice(N):C>N&&(t=t.slice(C)))}}let{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var h=0,l=0,a=t.length,c=e.length;h<a&&l<c;h++,l++){this.debug("matchOne loop");var u=e[l],m=t[h];if(this.debug(e,u,m),u===!1)return!1;if(u===I){this.debug("GLOBSTAR",[e,u,m]);var d=h,y=l+1;if(y===c){for(this.debug("** at the end");h<a;h++)if(t[h]==="."||t[h]===".."||!i.dot&&t[h].charAt(0)===".")return!1;return!0}for(;d<a;){var k=t[d];if(this.debug(`
|
|
2
|
+
globstar while`,t,d,e,y,k),this.matchOne(t.slice(d),e.slice(y),s))return this.debug("globstar found match!",d,a,k),!0;if(k==="."||k===".."||!i.dot&&k.charAt(0)==="."){this.debug("dot detected!",t,d,e,y);break}this.debug("globstar swallow a segment, and continue"),d++}return!!(s&&(this.debug(`
|
|
3
|
+
>>> no match, partial?`,t,d,e,y),d===a))}let g;if(typeof u=="string"?(g=m===u,this.debug("string match",u,m,g)):(g=u.test(m),this.debug("pattern match",u,m,g)),!g)return!1}if(h===a&&l===c)return!0;if(h===a)return s;if(l===c)return h===a-1&&t[h]==="";throw new Error("wtf?")}braceExpand(){return ai(this.pattern,this.options)}parse(t){te(t);let e=this.options;if(t==="**")return I;if(t==="")return"";let s,i=null;(s=t.match(Lr))?i=e.dot?Fr:Pr:(s=t.match(vr))?i=(e.nocase?e.dot?Rr:Cr:e.dot?Tr:kr)(s[1]):(s=t.match(jr))?i=(e.nocase?e.dot?Ir:Br:e.dot?Wr:$r)(s):(s=t.match(Mr))?i=e.dot?Nr:Dr:(s=t.match(Ar))&&(i=Or);let r=Wt.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 e=this.options,s=e.noglobstar?zr:e.dot?Gr:qr,i=new Set(e.nocase?["i"]:[]),r=t.map(a=>{let c=a.map(u=>{if(u instanceof RegExp)for(let m of u.flags.split(""))i.add(m);return typeof u=="string"?Jr(u):u===I?I:u._src});return c.forEach((u,m)=>{let d=c[m+1],y=c[m-1];u!==I||y===I||(y===void 0?d!==void 0&&d!==I?c[m+1]="(?:\\/|"+s+"\\/)?"+d:c[m]=s:d===void 0?c[m-1]=y+"(?:\\/|"+s+")?":d!==I&&(c[m-1]=y+"(?:\\/|\\/"+s+"\\/)"+d,c[m+1]=I))}),c.filter(u=>u!==I).join("/")}).join("|"),[h,l]=t.length>1?["(?:",")"]:["",""];r="^"+h+r+l+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch(a){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&e)return!0;let s=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 h=i[i.length-1];if(!h)for(let l=i.length-2;!h&&l>=0;l--)h=i[l];for(let l=0;l<r.length;l++){let a=r[l],c=i;if(s.matchBase&&a.length===1&&(c=[h]),this.matchOne(c,a,e))return s.flipNegate?!0:!this.negate}return s.flipNegate?!1:this.negate}static defaults(t){return _.defaults(t).Minimatch}};_.AST=Wt;_.Minimatch=H;_.escape=$t;_.unescape=tt;import{fileURLToPath as Mn}from"node:url";import{LRUCache as Bi}from"lru-cache";import{posix as an,win32 as bs}from"node:path";import{fileURLToPath as ln}from"node:url";import{lstatSync as cn,readdir as fn,readdirSync as un,readlinkSync as pn,realpathSync as dn}from"fs";import*as mn from"node:fs";import{lstat as wn,readdir as yn,readlink as bn,realpath as Sn}from"node:fs/promises";import{EventEmitter as gs}from"node:events";import Oi from"node:stream";import{StringDecoder as Zr}from"node:string_decoder";var li=typeof process=="object"&&process?process:{stdout:null,stderr:null},Qr=n=>!!n&&typeof n=="object"&&(n instanceof xt||n instanceof Oi||Xr(n)||tn(n)),Xr=n=>!!n&&typeof n=="object"&&n instanceof gs&&typeof n.pipe=="function"&&n.pipe!==Oi.Writable.prototype.pipe,tn=n=>!!n&&typeof n=="object"&&n instanceof gs&&typeof n.write=="function"&&typeof n.end=="function",ft=Symbol("EOF"),ut=Symbol("maybeEmitEnd"),Et=Symbol("emittedEnd"),Ue=Symbol("emittingEnd"),ie=Symbol("emittedError"),_e=Symbol("closed"),ci=Symbol("read"),ze=Symbol("flush"),fi=Symbol("flushChunk"),et=Symbol("encoding"),Ut=Symbol("decoder"),P=Symbol("flowing"),re=Symbol("paused"),_t=Symbol("resume"),F=Symbol("buffer"),z=Symbol("pipes"),j=Symbol("bufferLength"),cs=Symbol("bufferPush"),Ge=Symbol("bufferShift"),W=Symbol("objectMode"),M=Symbol("destroyed"),fs=Symbol("error"),us=Symbol("emitData"),ui=Symbol("emitEnd"),ps=Symbol("emitEnd2"),ot=Symbol("async"),ds=Symbol("abort"),qe=Symbol("aborted"),ne=Symbol("signal"),At=Symbol("dataListeners"),K=Symbol("discarded"),oe=n=>Promise.resolve().then(n),en=n=>n(),sn=n=>n==="end"||n==="finish"||n==="prefinish",rn=n=>n instanceof ArrayBuffer||!!n&&typeof n=="object"&&n.constructor&&n.constructor.name==="ArrayBuffer"&&n.byteLength>=0,nn=n=>!Buffer.isBuffer(n)&&ArrayBuffer.isView(n),He=class{constructor(t,e,s){f(this,"src");f(this,"dest");f(this,"opts");f(this,"ondrain");this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[_t](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ms=class extends He{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=i=>e.emit("error",i),t.on("error",this.proxyErrors)}},on=n=>!!n.objectMode,hn=n=>!n.objectMode&&!!n.encoding&&n.encoding!=="buffer",pi,di,mi,gi,wi,yi,bi,Si,Ei,xi,vi,ki,Ti,Ci,Ri,Mi,Di,Ni,Ai,xt=class extends gs{constructor(...e){let s=e[0]||{};super();f(this,Ai,!1);f(this,Ni,!1);f(this,Di,[]);f(this,Mi,[]);f(this,Ri);f(this,Ci);f(this,Ti);f(this,ki);f(this,vi,!1);f(this,xi,!1);f(this,Ei,!1);f(this,Si,!1);f(this,bi,null);f(this,yi,0);f(this,wi,!1);f(this,gi);f(this,mi,!1);f(this,di,0);f(this,pi,!1);f(this,"writable",!0);f(this,"readable",!0);if(s.objectMode&&typeof s.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");on(s)?(this[W]=!0,this[et]=null):hn(s)?(this[et]=s.encoding,this[W]=!1):(this[W]=!1,this[et]=null),this[ot]=!!s.async,this[Ut]=this[et]?new Zr(this[et]):null,s&&s.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[F]}),s&&s.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[z]});let{signal:i}=s;i&&(this[ne]=i,i.aborted?this[ds]():i.addEventListener("abort",()=>this[ds]()))}get bufferLength(){return this[j]}get encoding(){return this[et]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[W]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[ot]}set async(e){this[ot]=this[ot]||!!e}[(Ai=P,Ni=re,Di=z,Mi=F,Ri=W,Ci=et,Ti=ot,ki=Ut,vi=ft,xi=Et,Ei=Ue,Si=_e,bi=ie,yi=j,wi=M,gi=ne,mi=qe,di=At,pi=K,ds)](){var e,s;this[qe]=!0,this.emit("abort",(e=this[ne])==null?void 0:e.reason),this.destroy((s=this[ne])==null?void 0:s.reason)}get aborted(){return this[qe]}set aborted(e){}write(e,s,i){var h;if(this[qe])return!1;if(this[ft])throw new Error("write after end");if(this[M])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof s=="function"&&(i=s,s="utf8"),s||(s="utf8");let r=this[ot]?oe:en;if(!this[W]&&!Buffer.isBuffer(e)){if(nn(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(rn(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[W]?(this[P]&&this[j]!==0&&this[ze](!0),this[P]?this.emit("data",e):this[cs](e),this[j]!==0&&this.emit("readable"),i&&r(i),this[P]):e.length?(typeof e=="string"&&!(s===this[et]&&!((h=this[Ut])!=null&&h.lastNeed))&&(e=Buffer.from(e,s)),Buffer.isBuffer(e)&&this[et]&&(e=this[Ut].write(e)),this[P]&&this[j]!==0&&this[ze](!0),this[P]?this.emit("data",e):this[cs](e),this[j]!==0&&this.emit("readable"),i&&r(i),this[P]):(this[j]!==0&&this.emit("readable"),i&&r(i),this[P])}read(e){if(this[M])return null;if(this[K]=!1,this[j]===0||e===0||e&&e>this[j])return this[ut](),null;this[W]&&(e=null),this[F].length>1&&!this[W]&&(this[F]=[this[et]?this[F].join(""):Buffer.concat(this[F],this[j])]);let s=this[ci](e||null,this[F][0]);return this[ut](),s}[ci](e,s){if(this[W])this[Ge]();else{let i=s;e===i.length||e===null?this[Ge]():typeof i=="string"?(this[F][0]=i.slice(e),s=i.slice(0,e),this[j]-=e):(this[F][0]=i.subarray(e),s=i.subarray(0,e),this[j]-=e)}return this.emit("data",s),!this[F].length&&!this[ft]&&this.emit("drain"),s}end(e,s,i){return typeof e=="function"&&(i=e,e=void 0),typeof s=="function"&&(i=s,s="utf8"),e!==void 0&&this.write(e,s),i&&this.once("end",i),this[ft]=!0,this.writable=!1,(this[P]||!this[re])&&this[ut](),this}[_t](){this[M]||(!this[At]&&!this[z].length&&(this[K]=!0),this[re]=!1,this[P]=!0,this.emit("resume"),this[F].length?this[ze]():this[ft]?this[ut]():this.emit("drain"))}resume(){return this[_t]()}pause(){this[P]=!1,this[re]=!0,this[K]=!1}get destroyed(){return this[M]}get flowing(){return this[P]}get paused(){return this[re]}[cs](e){this[W]?this[j]+=1:this[j]+=e.length,this[F].push(e)}[Ge](){return this[W]?this[j]-=1:this[j]-=this[F][0].length,this[F].shift()}[ze](e=!1){do;while(this[fi](this[Ge]())&&this[F].length);!e&&!this[F].length&&!this[ft]&&this.emit("drain")}[fi](e){return this.emit("data",e),this[P]}pipe(e,s){if(this[M])return e;this[K]=!1;let i=this[Et];return s=s||{},e===li.stdout||e===li.stderr?s.end=!1:s.end=s.end!==!1,s.proxyErrors=!!s.proxyErrors,i?s.end&&e.end():(this[z].push(s.proxyErrors?new ms(this,e,s):new He(this,e,s)),this[ot]?oe(()=>this[_t]()):this[_t]()),e}unpipe(e){let s=this[z].find(i=>i.dest===e);s&&(this[z].length===1?(this[P]&&this[At]===0&&(this[P]=!1),this[z]=[]):this[z].splice(this[z].indexOf(s),1),s.unpipe())}addListener(e,s){return this.on(e,s)}on(e,s){let i=super.on(e,s);if(e==="data")this[K]=!1,this[At]++,!this[z].length&&!this[P]&&this[_t]();else if(e==="readable"&&this[j]!==0)super.emit("readable");else if(sn(e)&&this[Et])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ie]){let r=s;this[ot]?oe(()=>r.call(this,this[ie])):r.call(this,this[ie])}return i}removeListener(e,s){return this.off(e,s)}off(e,s){let i=super.off(e,s);return e==="data"&&(this[At]=this.listeners("data").length,this[At]===0&&!this[K]&&!this[z].length&&(this[P]=!1)),i}removeAllListeners(e){let s=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[At]=0,!this[K]&&!this[z].length&&(this[P]=!1)),s}get emittedEnd(){return this[Et]}[ut](){!this[Ue]&&!this[Et]&&!this[M]&&this[F].length===0&&this[ft]&&(this[Ue]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[_e]&&this.emit("close"),this[Ue]=!1)}emit(e,...s){let i=s[0];if(e!=="error"&&e!=="close"&&e!==M&&this[M])return!1;if(e==="data")return!this[W]&&!i?!1:this[ot]?(oe(()=>this[us](i)),!0):this[us](i);if(e==="end")return this[ui]();if(e==="close"){if(this[_e]=!0,!this[Et]&&!this[M])return!1;let h=super.emit("close");return this.removeAllListeners("close"),h}else if(e==="error"){this[ie]=i,super.emit(fs,i);let h=!this[ne]||this.listeners("error").length?super.emit("error",i):!1;return this[ut](),h}else if(e==="resume"){let h=super.emit("resume");return this[ut](),h}else if(e==="finish"||e==="prefinish"){let h=super.emit(e);return this.removeAllListeners(e),h}let r=super.emit(e,...s);return this[ut](),r}[us](e){for(let i of this[z])i.dest.write(e)===!1&&this.pause();let s=this[K]?!1:super.emit("data",e);return this[ut](),s}[ui](){return this[Et]?!1:(this[Et]=!0,this.readable=!1,this[ot]?(oe(()=>this[ps]()),!0):this[ps]())}[ps](){if(this[Ut]){let s=this[Ut].end();if(s){for(let i of this[z])i.dest.write(s);this[K]||super.emit("data",s)}}for(let s of this[z])s.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[W]||(e.dataLength=0);let s=this.promise();return this.on("data",i=>{e.push(i),this[W]||(e.dataLength+=i.length)}),await s,e}async concat(){if(this[W])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[et]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,s)=>{this.on(M,()=>s(new Error("stream destroyed"))),this.on("error",i=>s(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[K]=!1;let e=!1,s=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return s();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[ft])return s();let h,l,a=d=>{this.off("data",c),this.off("end",u),this.off(M,m),s(),l(d)},c=d=>{this.off("error",a),this.off("end",u),this.off(M,m),this.pause(),h({value:d,done:!!this[ft]})},u=()=>{this.off("error",a),this.off("data",c),this.off(M,m),s(),h({done:!0,value:void 0})},m=()=>a(new Error("stream destroyed"));return new Promise((d,y)=>{l=y,h=d,this.once(M,m),this.once("error",a),this.once("end",u),this.once("data",c)})},throw:s,return:s,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[K]=!1;let e=!1,s=()=>(this.pause(),this.off(fs,s),this.off(M,s),this.off("end",s),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return s();let r=this.read();return r===null?s():{done:!1,value:r}};return this.once("end",s),this.once(fs,s),this.once(M,s),{next:i,throw:s,return:s,[Symbol.iterator](){return this}}}destroy(e){if(this[M])return e?this.emit("error",e):this.emit(M),this;this[M]=!0,this[K]=!0,this[F].length=0,this[j]=0;let s=this;return typeof s.close=="function"&&!this[_e]&&s.close(),e?this.emit("error",e):this.emit(M),this}static get isStream(){return Qr}};var gn=dn.native,ae={lstatSync:cn,readdir:fn,readdirSync:un,readlinkSync:pn,realpathSync:gn,promises:{lstat:wn,readdir:yn,readlink:bn,realpath:Sn}},Ii=n=>!n||n===ae||n===mn?ae:{...ae,...n,promises:{...ae.promises,...n.promises||{}}},Wi=/^\\\\\?\\([a-z]:)\\?$/i,En=n=>n.replace(/\//g,"\\").replace(Wi,"$1\\"),xn=/[\\\/]/,Q=0,$i=1,Ui=2,ht=4,_i=6,zi=8,Ot=10,Gi=12,Z=15,he=~Z,ws=16,Li=32,le=64,st=128,Ke=256,Ye=512,Pi=le|st|Ye,vn=1023,ys=n=>n.isFile()?zi:n.isDirectory()?ht:n.isSymbolicLink()?Ot:n.isCharacterDevice()?Ui:n.isBlockDevice()?_i:n.isSocket()?Gi:n.isFIFO()?$i:Q,Fi=new Map,ce=n=>{let t=Fi.get(n);if(t)return t;let e=n.normalize("NFKD");return Fi.set(n,e),e},ji=new Map,Ve=n=>{let t=ji.get(n);if(t)return t;let e=ce(n.toLowerCase());return ji.set(n,e),e},Xe=class extends Bi{constructor(){super({max:256})}},Ss=class extends Bi{constructor(t=16*1024){super({maxSize:t,sizeCalculation:e=>e.length+1})}},qi=Symbol("PathScurry setAsCwd"),G,de,me,ge,we,ye,be,Se,Ee,xe,ve,ke,Te,Ce,Re,Me,De,Ne,Ae,vt,Lt,at,pt,dt,mt,E,Pt,gt,lt,S,Es,Je,fe,xs,vs,ue,Ze,ks,Ts,Qe,Hi,Ki,Vi,Cs,zt,Gt,Yi,Ft,$=class{constructor(t,e=Q,s,i,r,h,l){w(this,S);f(this,"name");f(this,"root");f(this,"roots");f(this,"parent");f(this,"nocase");f(this,"isCWD",!1);w(this,G);w(this,de);w(this,me);w(this,ge);w(this,we);w(this,ye);w(this,be);w(this,Se);w(this,Ee);w(this,xe);w(this,ve);w(this,ke);w(this,Te);w(this,Ce);w(this,Re);w(this,Me);w(this,De);w(this,Ne);w(this,Ae);w(this,vt);w(this,Lt);w(this,at);w(this,pt);w(this,dt);w(this,mt);w(this,E);w(this,Pt);w(this,gt);w(this,lt);w(this,zt,[]);w(this,Gt,!1);w(this,Ft);this.name=t,p(this,vt,r?Ve(t):ce(t)),p(this,E,e&vn),this.nocase=r,this.roots=i,this.root=s||this,p(this,Pt,h),p(this,at,l.fullpath),p(this,dt,l.relative),p(this,mt,l.relativePosix),this.parent=l.parent,this.parent?p(this,G,o(this.parent,G)):p(this,G,Ii(l.fs))}get dev(){return o(this,de)}get mode(){return o(this,me)}get nlink(){return o(this,ge)}get uid(){return o(this,we)}get gid(){return o(this,ye)}get rdev(){return o(this,be)}get blksize(){return o(this,Se)}get ino(){return o(this,Ee)}get size(){return o(this,xe)}get blocks(){return o(this,ve)}get atimeMs(){return o(this,ke)}get mtimeMs(){return o(this,Te)}get ctimeMs(){return o(this,Ce)}get birthtimeMs(){return o(this,Re)}get atime(){return o(this,Me)}get mtime(){return o(this,De)}get ctime(){return o(this,Ne)}get birthtime(){return o(this,Ae)}get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}depth(){return o(this,Lt)!==void 0?o(this,Lt):this.parent?p(this,Lt,this.parent.depth()+1):p(this,Lt,0)}childrenCache(){return o(this,Pt)}resolve(t){var h;if(!t)return this;let e=this.getRootString(t),i=t.substring(e.length).split(this.splitSep);return e?b(h=this.getRoot(e),S,Es).call(h,i):b(this,S,Es).call(this,i)}children(){let t=o(this,Pt).get(this);if(t)return t;let e=Object.assign([],{provisional:0});return o(this,Pt).set(this,e),p(this,E,o(this,E)&~ws),e}child(t,e){if(t===""||t===".")return this;if(t==="..")return this.parent||this;let s=this.children(),i=this.nocase?Ve(t):ce(t);for(let a of s)if(o(a,vt)===i)return a;let r=this.parent?this.sep:"",h=o(this,at)?o(this,at)+r+t:void 0,l=this.newChild(t,Q,{...e,parent:this,fullpath:h});return this.canReaddir()||p(l,E,o(l,E)|st),s.push(l),l}relative(){if(this.isCWD)return"";if(o(this,dt)!==void 0)return o(this,dt);let t=this.name,e=this.parent;if(!e)return p(this,dt,this.name);let s=e.relative();return s+(!s||!e.parent?"":this.sep)+t}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(o(this,mt)!==void 0)return o(this,mt);let t=this.name,e=this.parent;if(!e)return p(this,mt,this.fullpathPosix());let s=e.relativePosix();return s+(!s||!e.parent?"":"/")+t}fullpath(){if(o(this,at)!==void 0)return o(this,at);let t=this.name,e=this.parent;if(!e)return p(this,at,this.name);let i=e.fullpath()+(e.parent?this.sep:"")+t;return p(this,at,i)}fullpathPosix(){if(o(this,pt)!==void 0)return o(this,pt);if(this.sep==="/")return p(this,pt,this.fullpath());if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?p(this,pt,`//?/${i}`):p(this,pt,i)}let t=this.parent,e=t.fullpathPosix(),s=e+(!e||!t.parent?"":"/")+this.name;return p(this,pt,s)}isUnknown(){return(o(this,E)&Z)===Q}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(o(this,E)&Z)===zi}isDirectory(){return(o(this,E)&Z)===ht}isCharacterDevice(){return(o(this,E)&Z)===Ui}isBlockDevice(){return(o(this,E)&Z)===_i}isFIFO(){return(o(this,E)&Z)===$i}isSocket(){return(o(this,E)&Z)===Gi}isSymbolicLink(){return(o(this,E)&Ot)===Ot}lstatCached(){return o(this,E)&Li?this:void 0}readlinkCached(){return o(this,gt)}realpathCached(){return o(this,lt)}readdirCached(){let t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(o(this,gt))return!0;if(!this.parent)return!1;let t=o(this,E)&Z;return!(t!==Q&&t!==Ot||o(this,E)&Ke||o(this,E)&st)}calledReaddir(){return!!(o(this,E)&ws)}isENOENT(){return!!(o(this,E)&st)}isNamed(t){return this.nocase?o(this,vt)===Ve(t):o(this,vt)===ce(t)}async readlink(){var e;let t=o(this,gt);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=await o(this,G).promises.readlink(this.fullpath()),i=(e=await this.parent.realpath())==null?void 0:e.resolve(s);if(i)return p(this,gt,i)}catch(s){b(this,S,Ts).call(this,s.code);return}}readlinkSync(){var e;let t=o(this,gt);if(t)return t;if(this.canReadlink()&&this.parent)try{let s=o(this,G).readlinkSync(this.fullpath()),i=(e=this.parent.realpathSync())==null?void 0:e.resolve(s);if(i)return p(this,gt,i)}catch(s){b(this,S,Ts).call(this,s.code);return}}async lstat(){if(!(o(this,E)&st))try{return b(this,S,Cs).call(this,await o(this,G).promises.lstat(this.fullpath())),this}catch(t){b(this,S,ks).call(this,t.code)}}lstatSync(){if(!(o(this,E)&st))try{return b(this,S,Cs).call(this,o(this,G).lstatSync(this.fullpath())),this}catch(t){b(this,S,ks).call(this,t.code)}}readdirCB(t,e=!1){if(!this.canReaddir()){e?t(null,[]):queueMicrotask(()=>t(null,[]));return}let s=this.children();if(this.calledReaddir()){let r=s.slice(0,s.provisional);e?t(null,r):queueMicrotask(()=>t(null,r));return}if(o(this,zt).push(t),o(this,Gt))return;p(this,Gt,!0);let i=this.fullpath();o(this,G).readdir(i,{withFileTypes:!0},(r,h)=>{if(r)b(this,S,Ze).call(this,r.code),s.provisional=0;else{for(let l of h)b(this,S,Qe).call(this,l,s);b(this,S,Je).call(this,s)}b(this,S,Yi).call(this,s.slice(0,s.provisional))})}async readdir(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();if(o(this,Ft))await o(this,Ft);else{let s=()=>{};p(this,Ft,new Promise(i=>s=i));try{for(let i of await o(this,G).promises.readdir(e,{withFileTypes:!0}))b(this,S,Qe).call(this,i,t);b(this,S,Je).call(this,t)}catch(i){b(this,S,Ze).call(this,i.code),t.provisional=0}p(this,Ft,void 0),s()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];let t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);let e=this.fullpath();try{for(let s of o(this,G).readdirSync(e,{withFileTypes:!0}))b(this,S,Qe).call(this,s,t);b(this,S,Je).call(this,t)}catch(s){b(this,S,Ze).call(this,s.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(o(this,E)&Pi)return!1;let t=Z&o(this,E);return t===Q||t===ht||t===Ot}shouldWalk(t,e){return(o(this,E)&ht)===ht&&!(o(this,E)&Pi)&&!t.has(this)&&(!e||e(this))}async realpath(){if(o(this,lt))return o(this,lt);if(!((Ye|Ke|st)&o(this,E)))try{let t=await o(this,G).promises.realpath(this.fullpath());return p(this,lt,this.resolve(t))}catch(t){b(this,S,vs).call(this)}}realpathSync(){if(o(this,lt))return o(this,lt);if(!((Ye|Ke|st)&o(this,E)))try{let t=o(this,G).realpathSync(this.fullpath());return p(this,lt,this.resolve(t))}catch(t){b(this,S,vs).call(this)}}[qi](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;let e=new Set([]),s=[],i=this;for(;i&&i.parent;)e.add(i),p(i,dt,s.join(this.sep)),p(i,mt,s.join("/")),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)p(i,dt,void 0),p(i,mt,void 0),i=i.parent}};G=new WeakMap,de=new WeakMap,me=new WeakMap,ge=new WeakMap,we=new WeakMap,ye=new WeakMap,be=new WeakMap,Se=new WeakMap,Ee=new WeakMap,xe=new WeakMap,ve=new WeakMap,ke=new WeakMap,Te=new WeakMap,Ce=new WeakMap,Re=new WeakMap,Me=new WeakMap,De=new WeakMap,Ne=new WeakMap,Ae=new WeakMap,vt=new WeakMap,Lt=new WeakMap,at=new WeakMap,pt=new WeakMap,dt=new WeakMap,mt=new WeakMap,E=new WeakMap,Pt=new WeakMap,gt=new WeakMap,lt=new WeakMap,S=new WeakSet,Es=function(t){let e=this;for(let s of t)e=e.child(s);return e},Je=function(t){var e;p(this,E,o(this,E)|ws);for(let s=t.provisional;s<t.length;s++){let i=t[s];i&&b(e=i,S,fe).call(e)}},fe=function(){o(this,E)&st||(p(this,E,(o(this,E)|st)&he),b(this,S,xs).call(this))},xs=function(){var e;let t=this.children();t.provisional=0;for(let s of t)b(e=s,S,fe).call(e)},vs=function(){p(this,E,o(this,E)|Ye),b(this,S,ue).call(this)},ue=function(){if(o(this,E)&le)return;let t=o(this,E);(t&Z)===ht&&(t&=he),p(this,E,t|le),b(this,S,xs).call(this)},Ze=function(t=""){t==="ENOTDIR"||t==="EPERM"?b(this,S,ue).call(this):t==="ENOENT"?b(this,S,fe).call(this):this.children().provisional=0},ks=function(t=""){var e;if(t==="ENOTDIR"){let s=this.parent;b(e=s,S,ue).call(e)}else t==="ENOENT"&&b(this,S,fe).call(this)},Ts=function(t=""){var s;let e=o(this,E);e|=Ke,t==="ENOENT"&&(e|=st),(t==="EINVAL"||t==="UNKNOWN")&&(e&=he),p(this,E,e),t==="ENOTDIR"&&this.parent&&b(s=this.parent,S,ue).call(s)},Qe=function(t,e){return b(this,S,Ki).call(this,t,e)||b(this,S,Hi).call(this,t,e)},Hi=function(t,e){let s=ys(t),i=this.newChild(t.name,s,{parent:this}),r=o(i,E)&Z;return r!==ht&&r!==Ot&&r!==Q&&p(i,E,o(i,E)|le),e.unshift(i),e.provisional++,i},Ki=function(t,e){for(let s=e.provisional;s<e.length;s++){let i=e[s];if((this.nocase?Ve(t.name):ce(t.name))===o(i,vt))return b(this,S,Vi).call(this,t,i,s,e)}},Vi=function(t,e,s,i){let r=e.name;return p(e,E,o(e,E)&he|ys(t)),r!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e},Cs=function(t){let{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:h,blocks:l,ctime:a,ctimeMs:c,dev:u,gid:m,ino:d,mode:y,mtime:k,mtimeMs:g,nlink:v,rdev:x,size:T,uid:C}=t;p(this,Me,e),p(this,ke,s),p(this,Ae,i),p(this,Re,r),p(this,Se,h),p(this,ve,l),p(this,Ne,a),p(this,Ce,c),p(this,de,u),p(this,ye,m),p(this,Ee,d),p(this,me,y),p(this,De,k),p(this,Te,g),p(this,ge,v),p(this,be,x),p(this,xe,T),p(this,we,C);let N=ys(t);p(this,E,o(this,E)&he|N|Li),N!==Q&&N!==ht&&N!==Ot&&p(this,E,o(this,E)|le)},zt=new WeakMap,Gt=new WeakMap,Yi=function(t){p(this,Gt,!1);let e=o(this,zt).slice();o(this,zt).length=0,e.forEach(s=>s(null,t))},Ft=new WeakMap;var ts=class n extends ${constructor(e,s=Q,i,r,h,l,a){super(e,s,i,r,h,l,a);f(this,"sep","\\");f(this,"splitSep",xn)}newChild(e,s=Q,i={}){return new n(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return bs.parse(e).root}getRoot(e){if(e=En(e.toUpperCase()),e===this.root.name)return this.root;for(let[s,i]of Object.entries(this.roots))if(this.sameRoot(e,s))return this.roots[e]=i;return this.roots[e]=new Kt(e,this).root}sameRoot(e,s=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Wi,"$1\\"),e===s}},es=class n extends ${constructor(e,s=Q,i,r,h,l,a){super(e,s,i,r,h,l,a);f(this,"splitSep","/");f(this,"sep","/")}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,s=Q,i={}){return new n(e,s,this.root,this.roots,this.nocase,this.childrenCache(),i)}},qt,Ht,Oe,Le,ss=class{constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16*1024,fs:h=ae}={}){f(this,"root");f(this,"rootPath");f(this,"roots");f(this,"cwd");w(this,qt);w(this,Ht);w(this,Oe);f(this,"nocase");w(this,Le);p(this,Le,Ii(h)),(t instanceof URL||t.startsWith("file://"))&&(t=ln(t));let l=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(l),p(this,qt,new Xe),p(this,Ht,new Xe),p(this,Oe,new Ss(r));let a=l.substring(this.rootPath.length).split(s);if(a.length===1&&!a[0]&&a.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(o(this,Le)),this.roots[this.rootPath]=this.root;let c=this.root,u=a.length-1,m=e.sep,d=this.rootPath,y=!1;for(let k of a){let g=u--;c=c.child(k,{relative:new Array(g).fill("..").join(m),relativePosix:new Array(g).fill("..").join("/"),fullpath:d+=(y?"":m)+k}),y=!0}this.cwd=c}depth(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return o(this,Oe)}resolve(...t){let e="";for(let r=t.length-1;r>=0;r--){let h=t[r];if(!(!h||h===".")&&(e=e?`${h}/${e}`:h,this.isAbsolute(h)))break}let s=o(this,qt).get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpath();return o(this,qt).set(e,i),i}resolvePosix(...t){let e="";for(let r=t.length-1;r>=0;r--){let h=t[r];if(!(!h||h===".")&&(e=e?`${h}/${e}`:h,this.isAbsolute(h)))break}let s=o(this,Ht).get(e);if(s!==void 0)return s;let i=this.cwd.resolve(e).fullpathPosix();return o(this,Ht).set(e,i),i}relative(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s}=e;if(t.canReaddir()){let i=await t.readdir();return s?i:i.map(r=>r.name)}else return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map(i=>i.name):[]}async lstat(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return typeof t=="string"&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t.withFileTypes,t=this.cwd);let s=await t.readlink();return e?s:s==null?void 0:s.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t.withFileTypes,t=this.cwd);let s=t.readlinkSync();return e?s:s==null?void 0:s.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t.withFileTypes,t=this.cwd);let s=await t.realpath();return e?s:s==null?void 0:s.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t.withFileTypes,t=this.cwd);let s=t.realpathSync();return e?s:s==null?void 0:s.fullpath()}async walk(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,l=[];(!r||r(t))&&l.push(s?t:t.fullpath());let a=new Set,c=(m,d)=>{a.add(m),m.readdirCB((y,k)=>{if(y)return d(y);let g=k.length;if(!g)return d();let v=()=>{--g===0&&d()};for(let x of k)(!r||r(x))&&l.push(s?x:x.fullpath()),i&&x.isSymbolicLink()?x.realpath().then(T=>T!=null&&T.isUnknown()?T.lstat():T).then(T=>T!=null&&T.shouldWalk(a,h)?c(T,v):v()):x.shouldWalk(a,h)?c(x,v):v()},!0)},u=t;return new Promise((m,d)=>{c(u,y=>{if(y)return d(y);m(l)})})}walkSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,l=[];(!r||r(t))&&l.push(s?t:t.fullpath());let a=new Set([t]);for(let c of a){let u=c.readdirSync();for(let m of u){(!r||r(m))&&l.push(s?m:m.fullpath());let d=m;if(m.isSymbolicLink()){if(!(i&&(d=m.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(a,h)&&a.add(d)}}return l}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e;(!r||r(t))&&(yield s?t:t.fullpath());let l=new Set([t]);for(let a of l){let c=a.readdirSync();for(let u of c){(!r||r(u))&&(yield s?u:u.fullpath());let m=u;if(u.isSymbolicLink()){if(!(i&&(m=u.realpathSync())))continue;m.isUnknown()&&m.lstatSync()}m.shouldWalk(l,h)&&l.add(m)}}}stream(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,l=new xt({objectMode:!0});(!r||r(t))&&l.write(s?t:t.fullpath());let a=new Set,c=[t],u=0,m=()=>{let d=!1;for(;!d;){let y=c.shift();if(!y){u===0&&l.end();return}u++,a.add(y);let k=(v,x,T=!1)=>{if(v)return l.emit("error",v);if(i&&!T){let C=[];for(let N of x)N.isSymbolicLink()&&C.push(N.realpath().then(q=>q!=null&&q.isUnknown()?q.lstat():q));if(C.length){Promise.all(C).then(()=>k(null,x,!0));return}}for(let C of x)C&&(!r||r(C))&&(l.write(s?C:C.fullpath())||(d=!0));u--;for(let C of x){let N=C.realpathCached()||C;N.shouldWalk(a,h)&&c.push(N)}d&&!l.flowing?l.once("drain",m):g||m()},g=!0;y.readdirCB(k,!0),g=!1}};return m(),l}streamSync(t=this.cwd,e={}){typeof t=="string"?t=this.cwd.resolve(t):t instanceof $||(e=t,t=this.cwd);let{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:h}=e,l=new xt({objectMode:!0}),a=new Set;(!r||r(t))&&l.write(s?t:t.fullpath());let c=[t],u=0,m=()=>{let d=!1;for(;!d;){let y=c.shift();if(!y){u===0&&l.end();return}u++,a.add(y);let k=y.readdirSync();for(let g of k)(!r||r(g))&&(l.write(s?g:g.fullpath())||(d=!0));u--;for(let g of k){let v=g;if(g.isSymbolicLink()){if(!(i&&(v=g.realpathSync())))continue;v.isUnknown()&&v.lstatSync()}v.shouldWalk(a,h)&&c.push(v)}}d&&!l.flowing&&l.once("drain",m)};return m(),l}chdir(t=this.cwd){let e=this.cwd;this.cwd=typeof t=="string"?this.cwd.resolve(t):t,this.cwd[qi](e)}};qt=new WeakMap,Ht=new WeakMap,Oe=new WeakMap,Le=new WeakMap;var Kt=class extends ss{constructor(e=process.cwd(),s={}){let{nocase:i=!0}=s;super(e,bs,"\\",{...s,nocase:i});f(this,"sep","\\");this.nocase=i;for(let r=this.cwd;r;r=r.parent)r.nocase=this.nocase}parseRootPath(e){return bs.parse(e).root.toUpperCase()}newRoot(e){return new ts(this.rootPath,ht,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Vt=class extends ss{constructor(e=process.cwd(),s={}){let{nocase:i=!1}=s;super(e,an,"/",{...s,nocase:i});f(this,"sep","/");this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new es(this.rootPath,ht,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},pe=class extends Vt{constructor(t=process.cwd(),e={}){let{nocase:s=!0}=e;super(t,{...e,nocase:s})}},So=process.platform==="win32"?ts:es,Ji=process.platform==="win32"?Kt:process.platform==="darwin"?pe:Vt;var kn=n=>n.length>=1,Tn=n=>n.length>=1,O,V,B,jt,it,Pe,kt,Tt,Ct,Yt,Rs=class Rs{constructor(t,e,s,i){w(this,O);w(this,V);w(this,B);f(this,"length");w(this,jt);w(this,it);w(this,Pe);w(this,kt);w(this,Tt);w(this,Ct);w(this,Yt,!0);if(!kn(t))throw new TypeError("empty pattern list");if(!Tn(e))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(p(this,O,t),p(this,V,e),p(this,B,s),p(this,jt,i),o(this,B)===0){if(this.isUNC()){let[r,h,l,a,...c]=o(this,O),[u,m,d,y,...k]=o(this,V);c[0]===""&&(c.shift(),k.shift());let g=[r,h,l,a,""].join("/"),v=[u,m,d,y,""].join("/");p(this,O,[g,...c]),p(this,V,[v,...k]),this.length=o(this,O).length}else if(this.isDrive()||this.isAbsolute()){let[r,...h]=o(this,O),[l,...a]=o(this,V);h[0]===""&&(h.shift(),a.shift());let c=r+"/",u=l+"/";p(this,O,[c,...h]),p(this,V,[u,...a]),this.length=o(this,O).length}}}pattern(){return o(this,O)[o(this,B)]}isString(){return typeof o(this,O)[o(this,B)]=="string"}isGlobstar(){return o(this,O)[o(this,B)]===I}isRegExp(){return o(this,O)[o(this,B)]instanceof RegExp}globString(){return p(this,Pe,o(this,Pe)||(o(this,B)===0?this.isAbsolute()?o(this,V)[0]+o(this,V).slice(1).join("/"):o(this,V).join("/"):o(this,V).slice(o(this,B)).join("/")))}hasMore(){return this.length>o(this,B)+1}rest(){return o(this,it)!==void 0?o(this,it):this.hasMore()?(p(this,it,new Rs(o(this,O),o(this,V),o(this,B)+1,o(this,jt))),p(o(this,it),Ct,o(this,Ct)),p(o(this,it),Tt,o(this,Tt)),p(o(this,it),kt,o(this,kt)),o(this,it)):p(this,it,null)}isUNC(){let t=o(this,O);return o(this,Tt)!==void 0?o(this,Tt):p(this,Tt,o(this,jt)==="win32"&&o(this,B)===0&&t[0]===""&&t[1]===""&&typeof t[2]=="string"&&!!t[2]&&typeof t[3]=="string"&&!!t[3])}isDrive(){let t=o(this,O);return o(this,kt)!==void 0?o(this,kt):p(this,kt,o(this,jt)==="win32"&&o(this,B)===0&&this.length>1&&typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]))}isAbsolute(){let t=o(this,O);return o(this,Ct)!==void 0?o(this,Ct):p(this,Ct,t[0]===""&&t.length>1||this.isDrive()||this.isUNC())}root(){let t=o(this,O)[0];return typeof t=="string"&&this.isAbsolute()&&o(this,B)===0?t:""}checkFollowGlobstar(){return!(o(this,B)===0||!this.isGlobstar()||!o(this,Yt))}markFollowGlobstar(){return o(this,B)===0||!this.isGlobstar()||!o(this,Yt)?!1:(p(this,Yt,!1),!0)}};O=new WeakMap,V=new WeakMap,B=new WeakMap,jt=new WeakMap,it=new WeakMap,Pe=new WeakMap,kt=new WeakMap,Tt=new WeakMap,Ct=new WeakMap,Yt=new WeakMap;var Jt=Rs;var Cn=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Zt=class{constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:h=Cn}){f(this,"relative");f(this,"relativeChildren");f(this,"absolute");f(this,"absoluteChildren");f(this,"platform");f(this,"mmopts");this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=h,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:h,nocomment:!0,nonegate:!0};for(let l of t)this.add(l)}add(t){let e=new H(t,this.mmopts);for(let s=0;s<e.set.length;s++){let i=e.set[s],r=e.globParts[s];if(!i||!r)throw new Error("invalid pattern object");for(;i[0]==="."&&r[0]===".";)i.shift(),r.shift();let h=new Jt(i,r,0,this.platform),l=new H(h.globString(),this.mmopts),a=r[r.length-1]==="**",c=h.isAbsolute();c?this.absolute.push(l):this.relative.push(l),a&&(c?this.absoluteChildren.push(l):this.relativeChildren.push(l))}}ignored(t){let e=t.fullpath(),s=`${e}/`,i=t.relative()||".",r=`${i}/`;for(let h of this.relative)if(h.match(i)||h.match(r))return!0;for(let h of this.absolute)if(h.match(e)||h.match(s))return!0;return!1}childrenIgnored(t){let e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(s))return!0;for(let i of this.absoluteChildren)if(i.match(e))return!0;return!1}};var Ms=class n{constructor(t=new Map){f(this,"store");this.store=t}copy(){return new n(new Map(this.store))}hasWalked(t,e){var s;return(s=this.store.get(t.fullpath()))==null?void 0:s.has(e.globString())}storeWalked(t,e){let s=t.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}},Ds=class{constructor(){f(this,"store",new Map)}add(t,e,s){let i=(e?2:0)|(s?1:0),r=this.store.get(t);this.store.set(t,r===void 0?i:i&r)}entries(){return[...this.store.entries()].map(([t,e])=>[t,!!(e&2),!!(e&1)])}},Ns=class{constructor(){f(this,"store",new Map)}add(t,e){if(!t.canReaddir())return;let s=this.store.get(t);s?s.find(i=>i.globString()===e.globString())||s.push(e):this.store.set(t,[e])}get(t){let e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map(t=>[t,this.store.get(t)])}keys(){return[...this.store.keys()].filter(t=>t.canReaddir())}},Fe=class n{constructor(t,e){f(this,"hasWalkedCache");f(this,"matches",new Ds);f(this,"subwalks",new Ns);f(this,"patterns");f(this,"follow");f(this,"dot");f(this,"opts");this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new Ms}processPatterns(t,e){this.patterns=e;let s=e.map(i=>[t,i]);for(let[i,r]of s){this.hasWalkedCache.storeWalked(i,r);let h=r.root(),l=r.isAbsolute()&&this.opts.absolute!==!1;if(h){i=i.resolve(h==="/"&&this.opts.root!==void 0?this.opts.root:h);let m=r.rest();if(m)r=m;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let a,c,u=!1;for(;typeof(a=r.pattern())=="string"&&(c=r.rest());)i=i.resolve(a),r=c,u=!0;if(a=r.pattern(),c=r.rest(),u){if(this.hasWalkedCache.hasWalked(i,r))continue;this.hasWalkedCache.storeWalked(i,r)}if(typeof a=="string"){let m=a===".."||a===""||a===".";this.matches.add(i.resolve(a),l,m);continue}else if(a===I){(!i.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(i,r);let m=c==null?void 0:c.pattern(),d=c==null?void 0:c.rest();if(!c||(m===""||m===".")&&!d)this.matches.add(i,l,m===""||m===".");else if(m===".."){let y=i.parent||i;d?this.hasWalkedCache.hasWalked(y,d)||this.subwalks.add(y,d):this.matches.add(y,l,!0)}}else a instanceof RegExp&&this.subwalks.add(i,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new n(this.opts,this.hasWalkedCache)}filterEntries(t,e){let s=this.subwalks.get(t),i=this.child();for(let r of e)for(let h of s){let l=h.isAbsolute(),a=h.pattern(),c=h.rest();a===I?i.testGlobstar(r,h,c,l):a instanceof RegExp?i.testRegExp(r,a,c,l):i.testString(r,a,c,l)}return i}testGlobstar(t,e,s,i){if((this.dot||!t.name.startsWith("."))&&(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){let r=s.pattern();if(typeof r=="string"&&r!==".."&&r!==""&&r!==".")this.testString(t,r,s.rest(),i);else if(r===".."){let h=t.parent||t;this.subwalks.add(h,s)}else r instanceof RegExp&&this.testRegExp(t,r,s.rest(),i)}}testRegExp(t,e,s,i){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}};var Rn=(n,t)=>typeof n=="string"?new Zt([n],t):Array.isArray(n)?new Zt(n,t):n,Qt,wt,It,X,Bt,As,is=class{constructor(t,e,s){w(this,X);f(this,"path");f(this,"patterns");f(this,"opts");f(this,"seen",new Set);f(this,"paused",!1);f(this,"aborted",!1);w(this,Qt,[]);w(this,wt);w(this,It);f(this,"signal");f(this,"maxDepth");f(this,"includeChildMatches");var i;if(this.patterns=t,this.path=e,this.opts=s,p(this,It,!s.posix&&s.platform==="win32"?"\\":"/"),this.includeChildMatches=s.includeChildMatches!==!1,(s.ignore||!this.includeChildMatches)&&(p(this,wt,Rn((i=s.ignore)!=null?i:[],s)),!this.includeChildMatches&&typeof o(this,wt).add!="function")){let r="cannot ignore child matches, ignore lacks add() method.";throw new Error(r)}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",()=>{o(this,Qt).length=0}))}pause(){this.paused=!0}resume(){var e;if((e=this.signal)!=null&&e.aborted)return;this.paused=!1;let t;for(;!this.paused&&(t=o(this,Qt).shift());)t()}onResume(t){var e;(e=this.signal)!=null&&e.aborted||(this.paused?o(this,Qt).push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&(r!=null&&r.isSymbolicLink())){let h=await r.realpath();h&&(h.isUnknown()||this.opts.stat)&&await h.lstat()}return this.matchCheckTest(r,e)}matchCheckTest(t,e){var s;return t&&(this.maxDepth===1/0||t.depth()<=this.maxDepth)&&(!e||t.canReaddir())&&(!this.opts.nodir||!t.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!t.isSymbolicLink()||!((s=t.realpathCached())!=null&&s.isDirectory()))&&!b(this,X,Bt).call(this,t)?t:void 0}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}let r=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&(r!=null&&r.isSymbolicLink())){let h=r.realpathSync();h&&(h!=null&&h.isUnknown()||this.opts.stat)&&h.lstatSync()}return this.matchCheckTest(r,e)}matchFinish(t,e){var r;if(b(this,X,Bt).call(this,t))return;if(!this.includeChildMatches&&((r=o(this,wt))!=null&&r.add)){let h=`${t.relativePosix()}/**`;o(this,wt).add(h)}let s=this.opts.absolute===void 0?e:this.opts.absolute;this.seen.add(t);let i=this.opts.mark&&t.isDirectory()?o(this,It):"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){let h=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(h+i)}else{let h=this.opts.posix?t.relativePosix():t.relative(),l=this.opts.dotRelative&&!h.startsWith(".."+o(this,It))?"."+o(this,It):"";this.matchEmit(h?l+h+i:"."+i)}}async match(t,e,s){let i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){let i=this.matchCheckSync(t,s);i&&this.matchFinish(i,e)}walkCB(t,e,s){var i;(i=this.signal)!=null&&i.aborted&&s(),this.walkCB2(t,e,new Fe(this.opts),s)}walkCB2(t,e,s,i){var l;if(b(this,X,As).call(this,t))return i();if((l=this.signal)!=null&&l.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(t,e,s,i));return}s.processPatterns(t,e);let r=1,h=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())b(this,X,Bt).call(this,a)||(r++,this.match(a,c,u).then(()=>h()));for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,s,h):a.readdirCB((u,m)=>this.walkCB3(a,m,s,h),!0)}h()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let r=1,h=()=>{--r===0&&i()};for(let[l,a,c]of s.matches.entries())b(this,X,Bt).call(this,l)||(r++,this.match(l,a,c).then(()=>h()));for(let[l,a]of s.subwalks.entries())r++,this.walkCB2(l,a,s.child(),h);h()}walkCBSync(t,e,s){var i;(i=this.signal)!=null&&i.aborted&&s(),this.walkCB2Sync(t,e,new Fe(this.opts),s)}walkCB2Sync(t,e,s,i){var l;if(b(this,X,As).call(this,t))return i();if((l=this.signal)!=null&&l.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(t,e,s,i));return}s.processPatterns(t,e);let r=1,h=()=>{--r===0&&i()};for(let[a,c,u]of s.matches.entries())b(this,X,Bt).call(this,a)||this.matchSync(a,c,u);for(let a of s.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;r++;let c=a.readdirSync();this.walkCB3Sync(a,c,s,h)}h()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let r=1,h=()=>{--r===0&&i()};for(let[l,a,c]of s.matches.entries())b(this,X,Bt).call(this,l)||this.matchSync(l,a,c);for(let[l,a]of s.subwalks.entries())r++,this.walkCB2Sync(l,a,s.child(),h);h()}};Qt=new WeakMap,wt=new WeakMap,It=new WeakMap,X=new WeakSet,Bt=function(t){var e,s;return this.seen.has(t)||!!((s=(e=o(this,wt))==null?void 0:e.ignored)!=null&&s.call(e,t))},As=function(t){var e,s;return!!((s=(e=o(this,wt))==null?void 0:e.childrenIgnored)!=null&&s.call(e,t))};var je=class extends is{constructor(e,s,i){super(e,s,i);f(this,"matches",new Set)}matchEmit(e){this.matches.add(e)}async walk(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((s,i)=>{this.walkCB(this.path,this.patterns,()=>{var r;(r=this.signal)!=null&&r.aborted?i(this.signal.reason):s(this.matches)})}),this.matches}walkSync(){var e;if((e=this.signal)!=null&&e.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{var s;if((s=this.signal)!=null&&s.aborted)throw this.signal.reason}),this.matches}},Be=class extends is{constructor(e,s,i){super(e,s,i);f(this,"results");this.results=new xt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var Dn=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",rt=class{constructor(t,e){f(this,"absolute");f(this,"cwd");f(this,"root");f(this,"dot");f(this,"dotRelative");f(this,"follow");f(this,"ignore");f(this,"magicalBraces");f(this,"mark");f(this,"matchBase");f(this,"maxDepth");f(this,"nobrace");f(this,"nocase");f(this,"nodir");f(this,"noext");f(this,"noglobstar");f(this,"pattern");f(this,"platform");f(this,"realpath");f(this,"scurry");f(this,"stat");f(this,"signal");f(this,"windowsPathsNoEscape");f(this,"withFileTypes");f(this,"includeChildMatches");f(this,"opts");f(this,"patterns");if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=Mn(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=e.includeChildMatches!==!1,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof t=="string"&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||e.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(t=t.map(a=>a.replace(/\\/g,"/"))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map(a=>a.includes("/")?a:`./**/${a}`)}if(this.pattern=t,this.platform=e.platform||Dn,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,e.nocase!==void 0&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let a=e.platform==="win32"?Kt:e.platform==="darwin"?pe:e.platform?Vt:Ji;this.scurry=new a(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;let s=this.platform==="darwin"||this.platform==="win32",i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map(a=>new H(a,i)),[h,l]=r.reduce((a,c)=>(a[0].push(...c.set),a[1].push(...c.globParts),a),[[],[]]);this.patterns=h.map((a,c)=>{let u=l[c];if(!u)throw new Error("invalid pattern object");return new Jt(a,u,0,this.platform)})}async walk(){return[...await new je(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new je(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Be(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Be(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var Os=(n,t={})=>{Array.isArray(n)||(n=[n]);for(let e of n)if(new H(e,t).hasMagic())return!0;return!1};function rs(n,t={}){return new rt(n,t).streamSync()}function Xi(n,t={}){return new rt(n,t).stream()}function tr(n,t={}){return new rt(n,t).walkSync()}async function Zi(n,t={}){return new rt(n,t).walk()}function ns(n,t={}){return new rt(n,t).iterateSync()}function er(n,t={}){return new rt(n,t).iterate()}var Nn=rs,An=Object.assign(Xi,{sync:rs}),On=ns,Ln=Object.assign(er,{sync:ns}),Pn=Object.assign(tr,{stream:rs,iterate:ns}),Qi=Object.assign(Zi,{glob:Zi,globSync:tr,sync:Pn,globStream:Xi,stream:An,globStreamSync:rs,streamSync:Nn,globIterate:er,iterate:Ln,globIterateSync:ns,iterateSync:On,Glob:rt,hasMagic:Os,escape:$t,unescape:tt});Qi.glob=Qi;export{Wn as a,Pn as b};
|
|
4
|
+
//# sourceMappingURL=chunk-5FUMK7M3.js.map
|