codetraxis 1.0.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/README.md +245 -0
- package/bin/cli.js +225 -0
- package/client/dist/assets/axios-vendor-B_3Om2-t.js +6 -0
- package/client/dist/assets/babel-vendor-B4E1Dfn4.js +818 -0
- package/client/dist/assets/index-BHUsNYUv.css +1 -0
- package/client/dist/assets/index-BMv7qJps.js +193 -0
- package/client/dist/assets/monaco-vendor-Bo5GWDbL.js +11 -0
- package/client/dist/assets/react-vendor-BhKDh-5n.js +49 -0
- package/client/dist/assets/redux-vendor-D-3X9xqH.js +9 -0
- package/client/dist/index.html +18 -0
- package/package.json +68 -0
- package/server/dist/index.js +62 -0
- package/server/dist/routes/agent.route.js +94 -0
- package/server/dist/routes/file.route.js +58 -0
- package/server/dist/routes/tree.route.js +13 -0
- package/server/dist/utils/agent/agentInstaller.js +1027 -0
- package/server/dist/utils/agent/debugHub.js +50 -0
- package/server/dist/utils/file/buildTree.js +79 -0
- package/server/dist/utils/file/gitignoreLoader.js +38 -0
- package/server/dist/utils/git/getGitStatus.js +58 -0
- package/server/dist/utils/watcher/gitignoreWatcher.js +22 -0
- package/server/dist/utils/watcher/watcherService.js +117 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# codetraxis
|
|
2
|
+
|
|
3
|
+
**A local DevTools alternative for any JavaScript project.**
|
|
4
|
+
|
|
5
|
+
Tired of jumping between DevTools tabs, losing console logs, and not seeing the full network flow?
|
|
6
|
+
|
|
7
|
+
`codetraxis` gives you a **file explorer**, **network inspector**, and **console timeline** โ all in one browser UI, running completely on localhost.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx codetraxis .
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Open **http://localhost:3333** โ that's it.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why codetraxis?
|
|
18
|
+
|
|
19
|
+
| Problem | codetraxis |
|
|
20
|
+
|---|---|
|
|
21
|
+
| Switching between DevTools tabs | Everything in one UI |
|
|
22
|
+
| Console logs disappearing on refresh | Persistent timeline |
|
|
23
|
+
| Can't track full request lifecycle | Request + response + headers + duration |
|
|
24
|
+
| No file tree in DevTools | Built-in live project explorer |
|
|
25
|
+
| Hard to debug React Native / Expo | Works over WebSocket โ no browser required |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
| | Feature | Description |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| ๐ | **Live file tree** | Browse your project in real time โ respects `.gitignore` |
|
|
34
|
+
| ๐งพ | **Code viewer** | Monaco-based syntax-highlighted file viewer |
|
|
35
|
+
| ๐ | **Network inspector** | `fetch` / `axios` / `XHR` โ method, URL, status, body, headers, duration |
|
|
36
|
+
| ๐ง | **Console timeline** | `log` / `info` / `warn` / `error` โ persistent, in order |
|
|
37
|
+
| โก | **Real-time updates** | File changes pushed via WebSocket โ no refresh needed |
|
|
38
|
+
| ๐ | **Any project** | React, React Native, Next.js, Expo, Vite, CRA, plain Node |
|
|
39
|
+
| ๐ | **100% local** | Bound to `127.0.0.1` โ no data ever leaves your machine |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# No install needed
|
|
47
|
+
npx codetraxis .
|
|
48
|
+
|
|
49
|
+
# Or globally
|
|
50
|
+
npm install -g codetraxis
|
|
51
|
+
codetraxis .
|
|
52
|
+
|
|
53
|
+
# Point at a specific project
|
|
54
|
+
codetraxis ~/projects/my-app
|
|
55
|
+
|
|
56
|
+
# Custom port
|
|
57
|
+
PORT=4000 codetraxis .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Opens **`http://localhost:3333`** automatically.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## How it works
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
Your App (React / React Native / Next.js / Expo / etc.)
|
|
68
|
+
โ
|
|
69
|
+
โ codetraxisAgent โ auto-injected into your entry file
|
|
70
|
+
โ intercepts: console.* ยท fetch ยท axios ยท XMLHttpRequest
|
|
71
|
+
โ sends events over WebSocket
|
|
72
|
+
โผ
|
|
73
|
+
codetraxis server (Express + WS, 127.0.0.1:3333)
|
|
74
|
+
โ serves the browser UI as static files
|
|
75
|
+
โ exposes REST API + WebSocket endpoints
|
|
76
|
+
โ watches your project for file changes
|
|
77
|
+
โผ
|
|
78
|
+
Browser โ http://localhost:3333
|
|
79
|
+
file tree ยท code viewer ยท network inspector ยท console timeline
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## CLI flags
|
|
85
|
+
|
|
86
|
+
| Flag | Description |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `[path]` | Target project directory (default: current dir) |
|
|
89
|
+
| `--dev` | Dev mode โ starts `ts-node-dev` + Vite dev server separately |
|
|
90
|
+
| `--help` | Show usage |
|
|
91
|
+
| `PORT=XXXX` | Override default port `3333` via env var |
|
|
92
|
+
|
|
93
|
+
If port `3333` is busy, codetraxis automatically finds the next available port.
|
|
94
|
+
|
|
95
|
+
If `server/dist` is missing, codetraxis runs `npm run build` automatically before starting.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Debug Agent
|
|
100
|
+
|
|
101
|
+
Click **Install Agent** in the UI โ codetraxis automatically injects a lightweight agent into your project's entry file.
|
|
102
|
+
|
|
103
|
+
The agent intercepts:
|
|
104
|
+
- `console.log / info / warn / error`
|
|
105
|
+
- `fetch` (web & React Native)
|
|
106
|
+
- `XMLHttpRequest` (axios / RN networking)
|
|
107
|
+
|
|
108
|
+
All events are sent over WebSocket and shown in real time.
|
|
109
|
+
|
|
110
|
+
**Manual axios attachment** (for `axios.create()` instances):
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { attachAxios } from "./codetraxisAgent";
|
|
114
|
+
|
|
115
|
+
attachAxios(myAxiosInstance);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Debug event types
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
ConsoleEvent { type: "console", level: "log"|"info"|"warn"|"error", args[] }
|
|
124
|
+
NetworkEvent { type: "network", transport: "fetch"|"xhr"|"axios",
|
|
125
|
+
method, url, status, requestBody, responseBody, headers,
|
|
126
|
+
duration, state: "pending"|"success"|"error" }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## WebSocket endpoints
|
|
132
|
+
|
|
133
|
+
| Path | Purpose |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `/agent` | Target app agent sends events here |
|
|
136
|
+
| `/debug` | Browser viewer receives relayed events |
|
|
137
|
+
| `/ws` | File watcher โ `tree_changed` / `file_changed` |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Security
|
|
142
|
+
|
|
143
|
+
codetraxis runs **fully locally** โ no data ever leaves your machine.
|
|
144
|
+
|
|
145
|
+
| What | Detail |
|
|
146
|
+
|---|---|
|
|
147
|
+
| Server bind | `127.0.0.1` only โ not reachable from other machines |
|
|
148
|
+
| CORS | Localhost origins only โ external origins are blocked |
|
|
149
|
+
| File access | Only within the directory you pass as argument |
|
|
150
|
+
| On install | Nothing runs โ no `postinstall` script |
|
|
151
|
+
| Telemetry | None. Zero. |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Common issues
|
|
156
|
+
|
|
157
|
+
| Issue | Fix |
|
|
158
|
+
|---|---|
|
|
159
|
+
| White screen in browser | Run `npm run build` โ `client/dist` is missing |
|
|
160
|
+
| `Cannot find module server/dist/index.js` | Run `npm run build` first |
|
|
161
|
+
| Port already in use | codetraxis auto-picks the next free port |
|
|
162
|
+
| Permission denied on CLI | `chmod +x bin/cli.js` |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Build & develop
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Build everything (server TS โ JS + Vite โ static)
|
|
170
|
+
npm run build
|
|
171
|
+
|
|
172
|
+
# Test locally as a real user would
|
|
173
|
+
npm link
|
|
174
|
+
codetraxis /path/to/some-project
|
|
175
|
+
|
|
176
|
+
# Check what gets published
|
|
177
|
+
npm pack --dry-run
|
|
178
|
+
|
|
179
|
+
# Publish
|
|
180
|
+
npm publish
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### What gets published
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
bin/ โ CLI entry point
|
|
187
|
+
server/dist/ โ Compiled server JS
|
|
188
|
+
client/dist/ โ Built React app (static)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Source files (`src/`, `tsconfig`, `.env`, `node_modules`) are **never** included.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Project structure
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
bin/
|
|
199
|
+
cli.js โ CLI entry point
|
|
200
|
+
|
|
201
|
+
server/src/
|
|
202
|
+
index.ts โ HTTP server, routes, serves client/dist, starts watcher
|
|
203
|
+
routes/
|
|
204
|
+
tree.route.ts โ GET /api/tree
|
|
205
|
+
file.route.ts โ GET /api/file
|
|
206
|
+
agent.route.ts โ POST/DELETE /api/agent
|
|
207
|
+
utils/
|
|
208
|
+
agent/
|
|
209
|
+
agentInstaller.ts โ Detects project type, injects codetraxisAgent
|
|
210
|
+
debugHub.ts โ WS relay: /agent (target) โ /debug (viewer)
|
|
211
|
+
watcher/
|
|
212
|
+
watcherService.ts โ chokidar โ broadcasts tree_changed / file_changed
|
|
213
|
+
gitignoreWatcher.ts โ Reloads .gitignore rules on change
|
|
214
|
+
file/
|
|
215
|
+
buildTree.ts โ File tree JSON, respects .gitignore
|
|
216
|
+
gitignoreLoader.ts โ Parses .gitignore patterns
|
|
217
|
+
git/
|
|
218
|
+
getGitStatus.ts โ Git status decorations
|
|
219
|
+
|
|
220
|
+
client/src/
|
|
221
|
+
pages/home/Home.tsx โ Root layout
|
|
222
|
+
components/home/
|
|
223
|
+
leftMenu/ โ Icon sidebar
|
|
224
|
+
leftContentTree/ โ File tree panel
|
|
225
|
+
fileViewer/ โ Monaco code viewer + preview
|
|
226
|
+
debugPanel/ โ Network & console timeline
|
|
227
|
+
components/
|
|
228
|
+
TypesPanel/ โ Generate TS interfaces from JSON responses
|
|
229
|
+
NetworkExpanded/ โ Expanded network event view
|
|
230
|
+
ConsoleExpanded/ โ Expanded console event view
|
|
231
|
+
topMenu/ โ Project path + agent controls
|
|
232
|
+
addAgentModal/ โ Agent install modal
|
|
233
|
+
removeAgentModal/ โ Agent uninstall modal
|
|
234
|
+
redux/
|
|
235
|
+
treeSlice/ โ File tree state
|
|
236
|
+
fileSlice/ โ Open file state
|
|
237
|
+
debugSlice/ โ Debug events (max 500, upsert by id)
|
|
238
|
+
hooks/
|
|
239
|
+
useDebugSocket.ts โ ws://host/debug โ Redux
|
|
240
|
+
useProjectWatcher.ts โ ws://host/ws โ reload tree
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
*Built because `console.log` debugging gets old fast.*
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn, execSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
// โโ ANSI helpers โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
8
|
+
const c = {
|
|
9
|
+
reset: '\x1b[0m',
|
|
10
|
+
dim: '\x1b[2m',
|
|
11
|
+
bold: '\x1b[1m',
|
|
12
|
+
cyan: '\x1b[36m',
|
|
13
|
+
green: '\x1b[32m',
|
|
14
|
+
yellow: '\x1b[33m',
|
|
15
|
+
red: '\x1b[31m',
|
|
16
|
+
white: '\x1b[97m',
|
|
17
|
+
gray: '\x1b[90m',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// โโ Args โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const devMode = args.includes('--dev');
|
|
23
|
+
const showHelp = args.includes('--help') || args.includes('-h');
|
|
24
|
+
const targetArg = args.find(a => !a.startsWith('-'));
|
|
25
|
+
const ROOT = targetArg ? path.resolve(targetArg) : process.cwd();
|
|
26
|
+
const PORT = parseInt(process.env.PORT || '3333', 10);
|
|
27
|
+
|
|
28
|
+
// โโ Validate target dir โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
29
|
+
if (showHelp) {
|
|
30
|
+
process.stdout.write([
|
|
31
|
+
'',
|
|
32
|
+
` ${c.cyan}${c.bold}codetraxis${c.reset} โ live file tree, code viewer & debug panel`,
|
|
33
|
+
'',
|
|
34
|
+
` ${c.bold}Usage${c.reset}`,
|
|
35
|
+
` codetraxis [path] start for the given project directory`,
|
|
36
|
+
` codetraxis . start for the current directory`,
|
|
37
|
+
` codetraxis --dev start in development mode`,
|
|
38
|
+
` codetraxis --help show this help`,
|
|
39
|
+
'',
|
|
40
|
+
` ${c.bold}Env vars${c.reset}`,
|
|
41
|
+
` PORT=4444 codetraxis . override default port (3333)`,
|
|
42
|
+
'',
|
|
43
|
+
` ${c.bold}Examples${c.reset}`,
|
|
44
|
+
` npx codetraxis .`,
|
|
45
|
+
` npx codetraxis ~/projects/my-app`,
|
|
46
|
+
` PORT=4000 codetraxis .`,
|
|
47
|
+
'',
|
|
48
|
+
].join('\n') + '\n');
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!fs.existsSync(ROOT)) {
|
|
53
|
+
process.stderr.write(`\n ${c.red}โ${c.reset} Directory not found: ${ROOT}\n\n`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// โโ Print header โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
58
|
+
function printHeader(port) {
|
|
59
|
+
const url = `http://localhost:${port}`;
|
|
60
|
+
const project = ROOT;
|
|
61
|
+
const mode = devMode ? 'development' : 'production';
|
|
62
|
+
const W = 52;
|
|
63
|
+
const line = 'โ'.repeat(W);
|
|
64
|
+
|
|
65
|
+
process.stdout.write('\n');
|
|
66
|
+
process.stdout.write(` ${c.cyan}${c.bold}codetraxis${c.reset} ${c.dim}v${getVersion()}${c.reset}\n`);
|
|
67
|
+
process.stdout.write(` ${c.gray}${line}${c.reset}\n`);
|
|
68
|
+
process.stdout.write(` ${c.dim}project ${c.reset}${c.white}${project}${c.reset}\n`);
|
|
69
|
+
process.stdout.write(` ${c.dim}url ${c.reset}${c.cyan}${url}${c.reset}\n`);
|
|
70
|
+
process.stdout.write(` ${c.dim}mode ${c.reset}${devMode ? c.yellow + mode : c.green + mode}${c.reset}\n`);
|
|
71
|
+
process.stdout.write(` ${c.gray}${line}${c.reset}\n`);
|
|
72
|
+
process.stdout.write('\n');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getVersion() {
|
|
76
|
+
try {
|
|
77
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8'));
|
|
78
|
+
return pkg.version || '1.0.0';
|
|
79
|
+
} catch { return '1.0.0'; }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// โโ Find free port โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
83
|
+
async function getFreePort(preferred) {
|
|
84
|
+
const { default: getPort } = await import('get-port');
|
|
85
|
+
const free = await getPort({ port: preferred });
|
|
86
|
+
if (free !== preferred) {
|
|
87
|
+
process.stdout.write(
|
|
88
|
+
` ${c.yellow}โ ${c.reset} port ${preferred} busy โ using ${c.cyan}${free}${c.reset}\n\n`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return free;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// โโ Production โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
95
|
+
async function startProd() {
|
|
96
|
+
const distEntry = path.join(__dirname, '../server/dist/index.js');
|
|
97
|
+
|
|
98
|
+
if (!fs.existsSync(distEntry)) {
|
|
99
|
+
process.stdout.write(` ${c.yellow}โณ${c.reset} first run โ building codetraxis...\n`);
|
|
100
|
+
process.stdout.write(` ${c.dim} (this only happens once)${c.reset}\n\n`);
|
|
101
|
+
try {
|
|
102
|
+
execSync('npm run build', { cwd: path.join(__dirname, '..'), stdio: 'inherit' });
|
|
103
|
+
process.stdout.write('\n');
|
|
104
|
+
} catch {
|
|
105
|
+
process.stderr.write(`\n ${c.red}โ${c.reset} build failed\n\n`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const port = await getFreePort(PORT);
|
|
111
|
+
printHeader(port);
|
|
112
|
+
|
|
113
|
+
const server = spawn('node', [distEntry], {
|
|
114
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
115
|
+
env: { ...process.env, WORKING_DIR: ROOT, PORT: String(port) },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Forward server stdout โ filter noise, format nicely
|
|
119
|
+
let serverReady = false;
|
|
120
|
+
let watchingShown = false;
|
|
121
|
+
server.stdout.on('data', (data) => {
|
|
122
|
+
const lines = data.toString().split('\n').filter(l => l.trim());
|
|
123
|
+
for (const line of lines) {
|
|
124
|
+
if (line.includes('[dotenv') || line.includes('tip:')) continue;
|
|
125
|
+
if (line.includes('running on') || line.includes('ready on')) {
|
|
126
|
+
if (!serverReady) {
|
|
127
|
+
serverReady = true;
|
|
128
|
+
process.stdout.write(` ${c.green}โ${c.reset} ${c.white}server ready${c.reset} ${c.dim}โ opening browser${c.reset}\n`);
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (line.includes('Watching:')) {
|
|
133
|
+
if (!watchingShown) {
|
|
134
|
+
watchingShown = true;
|
|
135
|
+
const dir = line.split('Watching:')[1]?.trim();
|
|
136
|
+
process.stdout.write(` ${c.green}โ${c.reset} ${c.dim}watching${c.reset} ${c.gray}${dir}${c.reset}\n`);
|
|
137
|
+
}
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (line.includes('WebSocket') || line.includes('Debug hub')) continue;
|
|
141
|
+
process.stdout.write(` ${c.dim}${line}${c.reset}\n`);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
server.stderr.on('data', (data) => {
|
|
146
|
+
const lines = data.toString().split('\n').filter(l => l.trim());
|
|
147
|
+
for (const line of lines) {
|
|
148
|
+
if (line.includes('[dotenv')) continue;
|
|
149
|
+
process.stderr.write(` ${c.red}!${c.reset} ${line}\n`);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
server.on('error', (err) => {
|
|
154
|
+
process.stderr.write(`\n ${c.red}โ${c.reset} ${err.message}\n\n`);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
server.on('exit', (code) => {
|
|
159
|
+
if (code !== 0) process.exit(code ?? 1);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
setTimeout(async () => {
|
|
163
|
+
const { default: open } = await import('open');
|
|
164
|
+
open(`http://localhost:${port}`);
|
|
165
|
+
}, 1200);
|
|
166
|
+
|
|
167
|
+
process.on('SIGINT', () => {
|
|
168
|
+
process.stdout.write(`\n ${c.dim}shutting down...${c.reset}\n\n`);
|
|
169
|
+
server.kill();
|
|
170
|
+
process.exit(0);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// โโ Dev โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
175
|
+
async function startDev() {
|
|
176
|
+
const port = await getFreePort(PORT);
|
|
177
|
+
printHeader(port);
|
|
178
|
+
|
|
179
|
+
const serverPath = path.join(__dirname, '../server');
|
|
180
|
+
const clientPath = path.join(__dirname, '../client');
|
|
181
|
+
|
|
182
|
+
const server = spawn('npm', ['run', 'dev'], {
|
|
183
|
+
cwd: serverPath, shell: true,
|
|
184
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
185
|
+
env: { ...process.env, WORKING_DIR: ROOT, PORT: String(port) },
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const client = spawn('npm', ['run', 'dev'], {
|
|
189
|
+
cwd: clientPath, shell: true,
|
|
190
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const prefix = (tag, col) => (data) => {
|
|
194
|
+
data.toString().split('\n').filter(l => l.trim()).forEach(line => {
|
|
195
|
+
if (line.includes('[dotenv')) return;
|
|
196
|
+
process.stdout.write(` ${col}${tag}${c.reset} ${c.dim}${line}${c.reset}\n`);
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
server.stdout.on('data', prefix('srv', c.green));
|
|
201
|
+
server.stderr.on('data', prefix('srv', c.red));
|
|
202
|
+
client.stdout.on('data', prefix('ui ', c.cyan));
|
|
203
|
+
client.stderr.on('data', prefix('ui ', c.red));
|
|
204
|
+
|
|
205
|
+
server.on('error', (err) => { process.stderr.write(`\n ${c.red}โ server: ${err.message}${c.reset}\n`); process.exit(1); });
|
|
206
|
+
client.on('error', (err) => { process.stderr.write(`\n ${c.red}โ client: ${err.message}${c.reset}\n`); process.exit(1); });
|
|
207
|
+
|
|
208
|
+
setTimeout(async () => {
|
|
209
|
+
const { default: open } = await import('open');
|
|
210
|
+
open('http://localhost:5173');
|
|
211
|
+
}, 3500);
|
|
212
|
+
|
|
213
|
+
process.on('SIGINT', () => {
|
|
214
|
+
process.stdout.write(`\n ${c.dim}shutting down...${c.reset}\n\n`);
|
|
215
|
+
server.kill(); client.kill();
|
|
216
|
+
process.exit(0);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// โโ Run โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
221
|
+
if (devMode) {
|
|
222
|
+
startDev().catch(err => { console.error(err); process.exit(1); });
|
|
223
|
+
} else {
|
|
224
|
+
startProd().catch(err => { console.error(err); process.exit(1); });
|
|
225
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function Ke(e,t){return function(){return e.apply(t,arguments)}}const{toString:bt}=Object.prototype,{getPrototypeOf:Re}=Object,{iterator:se,toStringTag:ve}=Symbol,oe=(e=>t=>{const n=bt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),F=e=>(e=e.toLowerCase(),t=>oe(t)===e),ie=e=>t=>typeof t===e,{isArray:$}=Array,M=ie("undefined");function V(e){return e!==null&&!M(e)&&e.constructor!==null&&!M(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xe=F("ArrayBuffer");function wt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Xe(e.buffer),t}const Rt=ie("string"),A=ie("function"),Ge=ie("number"),W=e=>e!==null&&typeof e=="object",Et=e=>e===!0||e===!1,ee=e=>{if(oe(e)!=="object")return!1;const t=Re(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(ve in e)&&!(se in e)},gt=e=>{if(!W(e)||V(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},St=F("Date"),Ot=F("File"),Tt=e=>!!(e&&typeof e.uri<"u"),At=e=>e&&typeof e.getParts<"u",Ct=F("Blob"),xt=F("FileList"),Nt=e=>W(e)&&A(e.pipe);function _t(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Pe=_t(),Fe=typeof Pe.FormData<"u"?Pe.FormData:void 0,Pt=e=>{let t;return e&&(Fe&&e instanceof Fe||A(e.append)&&((t=oe(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},Ft=F("URLSearchParams"),[Ut,Lt,Dt,Bt]=["ReadableStream","Request","Response","Headers"].map(F),kt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function K(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),$(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(V(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function Ze(e,t){if(V(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const k=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Qe=e=>!M(e)&&e!==k;function me(){const{caseless:e,skipUndefined:t}=Qe(this)&&this||{},n={},r=(s,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const i=e&&Ze(n,o)||o;ee(n[i])&&ee(s)?n[i]=me(n[i],s):ee(s)?n[i]=me({},s):$(s)?n[i]=s.slice():(!t||!M(s))&&(n[i]=s)};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&K(arguments[s],r);return n}const jt=(e,t,n,{allOwnKeys:r}={})=>(K(t,(s,o)=>{n&&A(s)?Object.defineProperty(e,o,{value:Ke(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),It=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),qt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Ht=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&Re(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Mt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},$t=e=>{if(!e)return null;if($(e))return e;let t=e.length;if(!Ge(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},zt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Re(Uint8Array)),Jt=(e,t)=>{const r=(e&&e[se]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Vt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Wt=F("HTMLFormElement"),Kt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ue=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),vt=F("RegExp"),Ye=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};K(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},Xt=e=>{Ye(e,(t,n)=>{if(A(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(A(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Gt=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return $(e)?r(e):r(String(e).split(t)),n},Zt=()=>{},Qt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Yt(e){return!!(e&&A(e.append)&&e[ve]==="FormData"&&e[se])}const en=e=>{const t=new Array(10),n=(r,s)=>{if(W(r)){if(t.indexOf(r)>=0)return;if(V(r))return r;if(!("toJSON"in r)){t[s]=r;const o=$(r)?[]:{};return K(r,(i,c)=>{const p=n(i,s+1);!M(p)&&(o[c]=p)}),t[s]=void 0,o}}return r};return n(e,0)},tn=F("AsyncFunction"),nn=e=>e&&(W(e)||A(e))&&A(e.then)&&A(e.catch),et=((e,t)=>e?setImmediate:t?((n,r)=>(k.addEventListener("message",({source:s,data:o})=>{s===k&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),k.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",A(k.postMessage)),rn=typeof queueMicrotask<"u"?queueMicrotask.bind(k):typeof process<"u"&&process.nextTick||et,sn=e=>e!=null&&A(e[se]),a={isArray:$,isArrayBuffer:Xe,isBuffer:V,isFormData:Pt,isArrayBufferView:wt,isString:Rt,isNumber:Ge,isBoolean:Et,isObject:W,isPlainObject:ee,isEmptyObject:gt,isReadableStream:Ut,isRequest:Lt,isResponse:Dt,isHeaders:Bt,isUndefined:M,isDate:St,isFile:Ot,isReactNativeBlob:Tt,isReactNative:At,isBlob:Ct,isRegExp:vt,isFunction:A,isStream:Nt,isURLSearchParams:Ft,isTypedArray:zt,isFileList:xt,forEach:K,merge:me,extend:jt,trim:kt,stripBOM:It,inherits:qt,toFlatObject:Ht,kindOf:oe,kindOfTest:F,endsWith:Mt,toArray:$t,forEachEntry:Jt,matchAll:Vt,isHTMLForm:Wt,hasOwnProperty:Ue,hasOwnProp:Ue,reduceDescriptors:Ye,freezeMethods:Xt,toObjectSet:Gt,toCamelCase:Kt,noop:Zt,toFiniteNumber:Qt,findKey:Ze,global:k,isContextDefined:Qe,isSpecCompliantForm:Yt,toJSONObject:en,isAsyncFn:tn,isThenable:nn,setImmediate:et,asap:rn,isIterable:sn};let y=class tt extends Error{static from(t,n,r,s,o,i){const c=new tt(t.message,n||t.code,r,s,o);return c.cause=t,c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),i&&Object.assign(c,i),c}constructor(t,n,r,s,o){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";y.ERR_BAD_OPTION="ERR_BAD_OPTION";y.ECONNABORTED="ECONNABORTED";y.ETIMEDOUT="ETIMEDOUT";y.ERR_NETWORK="ERR_NETWORK";y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";y.ERR_DEPRECATED="ERR_DEPRECATED";y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";y.ERR_CANCELED="ERR_CANCELED";y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";y.ERR_INVALID_URL="ERR_INVALID_URL";const on=null;function ye(e){return a.isPlainObject(e)||a.isArray(e)}function nt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function fe(e,t,n){return e?e.concat(t).map(function(s,o){return s=nt(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function an(e){return a.isArray(e)&&!e.some(ye)}const cn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function ae(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,d){return!a.isUndefined(d[m])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function f(u){if(u===null)return"";if(a.isDate(u))return u.toISOString();if(a.isBoolean(u))return u.toString();if(!p&&a.isBlob(u))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(u)||a.isTypedArray(u)?p&&typeof Blob=="function"?new Blob([u]):Buffer.from(u):u}function l(u,m,d){let R=u;if(a.isReactNative(t)&&a.isReactNativeBlob(u))return t.append(fe(d,m,o),f(u)),!1;if(u&&!d&&typeof u=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),u=JSON.stringify(u);else if(a.isArray(u)&&an(u)||(a.isFileList(u)||a.endsWith(m,"[]"))&&(R=a.toArray(u)))return m=nt(m),R.forEach(function(E,O){!(a.isUndefined(E)||E===null)&&t.append(i===!0?fe([m],O,o):i===null?m:m+"[]",f(E))}),!1}return ye(u)?!0:(t.append(fe(d,m,o),f(u)),!1)}const h=[],b=Object.assign(cn,{defaultVisitor:l,convertValue:f,isVisitable:ye});function g(u,m){if(!a.isUndefined(u)){if(h.indexOf(u)!==-1)throw Error("Circular reference detected in "+m.join("."));h.push(u),a.forEach(u,function(R,x){(!(a.isUndefined(R)||R===null)&&s.call(t,R,a.isString(x)?x.trim():x,m,b))===!0&&g(R,m?m.concat(x):[x])}),h.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return g(e),t}function Le(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ee(e,t){this._pairs=[],e&&ae(e,this,t)}const rt=Ee.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Le)}:Le;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function ln(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function st(e,t,n){if(!t)return e;const r=n&&n.encode||ln,s=a.isFunction(n)?{serialize:n}:n,o=s&&s.serialize;let i;if(o?i=o(t,s):i=a.isURLSearchParams(t)?t.toString():new Ee(t,s).toString(r),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class De{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ge={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},un=typeof URLSearchParams<"u"?URLSearchParams:Ee,fn=typeof FormData<"u"?FormData:null,dn=typeof Blob<"u"?Blob:null,pn={isBrowser:!0,classes:{URLSearchParams:un,FormData:fn,Blob:dn},protocols:["http","https","file","blob","url","data"]},Se=typeof window<"u"&&typeof document<"u",be=typeof navigator=="object"&&navigator||void 0,hn=Se&&(!be||["ReactNative","NativeScript","NS"].indexOf(be.product)<0),mn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yn=Se&&window.location.href||"http://localhost",bn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Se,hasStandardBrowserEnv:hn,hasStandardBrowserWebWorkerEnv:mn,navigator:be,origin:yn},Symbol.toStringTag,{value:"Module"})),S={...bn,...pn};function wn(e,t){return ae(e,new S.classes.URLSearchParams,{visitor:function(n,r,s,o){return S.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function Rn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function En(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function ot(e){function t(n,r,s,o){let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),p=o>=n.length;return i=!i&&a.isArray(s)?s.length:i,p?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=En(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Rn(r),s,n,0)}),n}return null}function gn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const v={transitional:ge,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(ot(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wn(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return ae(c?{"files[]":t}:t,p&&new p,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),gn(t)):t}],transformResponse:[function(t){const n=this.transitional||v.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(i)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:S.classes.FormData,Blob:S.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{v.headers[e]={}});const Sn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),On=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Sn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Be=Symbol("internals");function J(e){return e&&String(e).trim().toLowerCase()}function te(e){return e===!1||e==null?e:a.isArray(e)?e.map(te):String(e)}function Tn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const An=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function de(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function Cn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function xn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let C=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,p,f){const l=J(p);if(!l)throw new Error("header name must be a non-empty string");const h=a.findKey(s,l);(!h||s[h]===void 0||f===!0||f===void 0&&s[h]!==!1)&&(s[h||p]=te(c))}const i=(c,p)=>a.forEach(c,(f,l)=>o(f,l,p));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!An(t))i(On(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},p,f;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[f=l[0]]=(p=c[f])?a.isArray(p)?[...p,l[1]]:[p,l[1]]:l[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=J(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Tn(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=J(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||de(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=J(i),i){const c=a.findKey(r,i);c&&(!n||de(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||de(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=te(s),delete n[o];return}const c=t?Cn(o):String(o).trim();c!==o&&delete n[o],n[c]=te(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Be]=this[Be]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=J(i);r[c]||(xn(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}};C.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(C.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(C);function pe(e,t){const n=this||v,r=t||n,s=C.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function it(e){return!!(e&&e.__CANCEL__)}let X=class extends y{constructor(t,n,r){super(t??"canceled",y.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function at(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Nn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function _n(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(p){const f=Date.now(),l=r[o];i||(i=f),n[s]=p,r[s]=f;let h=o,b=0;for(;h!==s;)b+=n[h++],h=h%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),f-i<t)return;const g=l&&f-l;return g?Math.round(b*1e3/g):void 0}}function Pn(e,t){let n=0,r=1e3/t,s,o;const i=(f,l=Date.now())=>{n=l,s=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const l=Date.now(),h=l-n;h>=r?i(f,l):(s=f,o||(o=setTimeout(()=>{o=null,i(s)},r-h)))},()=>s&&i(s)]}const re=(e,t,n=3)=>{let r=0;const s=_n(50,250);return Pn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,p=i-r,f=s(p),l=i<=c;r=i;const h={loaded:i,total:c,progress:c?i/c:void 0,bytes:p,rate:f||void 0,estimated:f&&c&&l?(c-i)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(h)},n)},ke=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},je=e=>(...t)=>a.asap(()=>e(...t)),Fn=S.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,S.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(S.origin),S.navigator&&/(msie|trident)/i.test(S.navigator.userAgent)):()=>!0,Un=S.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),a.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ln(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Dn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!Ln(t);return e&&(r||n==!1)?Dn(e,t):t}const Ie=e=>e instanceof C?{...e}:e;function q(e,t){t=t||{};const n={};function r(f,l,h,b){return a.isPlainObject(f)&&a.isPlainObject(l)?a.merge.call({caseless:b},f,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(f,l,h,b){if(a.isUndefined(l)){if(!a.isUndefined(f))return r(void 0,f,h,b)}else return r(f,l,h,b)}function o(f,l){if(!a.isUndefined(l))return r(void 0,l)}function i(f,l){if(a.isUndefined(l)){if(!a.isUndefined(f))return r(void 0,f)}else return r(void 0,l)}function c(f,l,h){if(h in t)return r(f,l);if(h in e)return r(void 0,f)}const p={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(f,l,h)=>s(Ie(f),Ie(l),h,!0)};return a.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const h=a.hasOwnProp(p,l)?p[l]:s,b=h(e[l],t[l],l);a.isUndefined(b)&&h!==c||(n[l]=b)}),n}const lt=e=>{const t=q({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;if(t.headers=i=C.from(i),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(S.hasStandardBrowserEnv||S.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),f=["content-type","content-length"];Object.entries(p).forEach(([l,h])=>{f.includes(l.toLowerCase())&&i.set(l,h)})}}if(S.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&Fn(t.url))){const p=s&&o&&Un.read(o);p&&i.set(s,p)}return t},Bn=typeof XMLHttpRequest<"u",kn=Bn&&function(e){return new Promise(function(n,r){const s=lt(e);let o=s.data;const i=C.from(s.headers).normalize();let{responseType:c,onUploadProgress:p,onDownloadProgress:f}=s,l,h,b,g,u;function m(){g&&g(),u&&u(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let d=new XMLHttpRequest;d.open(s.method.toUpperCase(),s.url,!0),d.timeout=s.timeout;function R(){if(!d)return;const E=C.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),P={data:!c||c==="text"||c==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:E,config:e,request:d};at(function(N){n(N),m()},function(N){r(N),m()},P),d=null}"onloadend"in d?d.onloadend=R:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(R)},d.onabort=function(){d&&(r(new y("Request aborted",y.ECONNABORTED,e,d)),d=null)},d.onerror=function(O){const P=O&&O.message?O.message:"Network Error",D=new y(P,y.ERR_NETWORK,e,d);D.event=O||null,r(D),d=null},d.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const P=s.transitional||ge;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),r(new y(O,P.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,d)),d=null},o===void 0&&i.setContentType(null),"setRequestHeader"in d&&a.forEach(i.toJSON(),function(O,P){d.setRequestHeader(P,O)}),a.isUndefined(s.withCredentials)||(d.withCredentials=!!s.withCredentials),c&&c!=="json"&&(d.responseType=s.responseType),f&&([b,u]=re(f,!0),d.addEventListener("progress",b)),p&&d.upload&&([h,g]=re(p),d.upload.addEventListener("progress",h),d.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(l=E=>{d&&(r(!E||E.type?new X(null,e,d):E),d.abort(),d=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const x=Nn(s.url);if(x&&S.protocols.indexOf(x)===-1){r(new y("Unsupported protocol "+x+":",y.ERR_BAD_REQUEST,e));return}d.send(o||null)})},jn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(f){if(!s){s=!0,c();const l=f instanceof Error?f:this.reason;r.abort(l instanceof y?l:new X(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new y(`timeout of ${t}ms exceeded`,y.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:p}=r;return p.unsubscribe=()=>a.asap(c),p}},In=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},qn=async function*(e,t){for await(const n of Hn(e))yield*In(n,t)},Hn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},qe=(e,t,n,r)=>{const s=qn(e,t);let o=0,i,c=p=>{i||(i=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:f,value:l}=await s.next();if(f){c(),p.close();return}let h=l.byteLength;if(n){let b=o+=h;n(b)}p.enqueue(new Uint8Array(l))}catch(f){throw c(f),f}},cancel(p){return c(p),s.return()}},{highWaterMark:2})},He=64*1024,{isFunction:Y}=a,Mn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:$e}=a.global,ze=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$n=e=>{e=a.merge.call({skipUndefined:!0},Mn,e);const{fetch:t,Request:n,Response:r}=e,s=t?Y(t):typeof fetch=="function",o=Y(n),i=Y(r);if(!s)return!1;const c=s&&Y(Me),p=s&&(typeof $e=="function"?(u=>m=>u.encode(m))(new $e):async u=>new Uint8Array(await new n(u).arrayBuffer())),f=o&&c&&ze(()=>{let u=!1;const m=new n(S.origin,{body:new Me,method:"POST",get duplex(){return u=!0,"half"}}).headers.has("Content-Type");return u&&!m}),l=i&&c&&ze(()=>a.isReadableStream(new r("").body)),h={stream:l&&(u=>u.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(u=>{!h[u]&&(h[u]=(m,d)=>{let R=m&&m[u];if(R)return R.call(m);throw new y(`Response type '${u}' is not supported`,y.ERR_NOT_SUPPORT,d)})});const b=async u=>{if(u==null)return 0;if(a.isBlob(u))return u.size;if(a.isSpecCompliantForm(u))return(await new n(S.origin,{method:"POST",body:u}).arrayBuffer()).byteLength;if(a.isArrayBufferView(u)||a.isArrayBuffer(u))return u.byteLength;if(a.isURLSearchParams(u)&&(u=u+""),a.isString(u))return(await p(u)).byteLength},g=async(u,m)=>{const d=a.toFiniteNumber(u.getContentLength());return d??b(m)};return async u=>{let{url:m,method:d,data:R,signal:x,cancelToken:E,timeout:O,onDownloadProgress:P,onUploadProgress:D,responseType:N,headers:le,withCredentials:G="same-origin",fetchOptions:Te}=lt(u),Ae=t||fetch;N=N?(N+"").toLowerCase():"text";let Z=jn([x,E&&E.toAbortSignal()],O),z=null;const B=Z&&Z.unsubscribe&&(()=>{Z.unsubscribe()});let Ce;try{if(D&&f&&d!=="get"&&d!=="head"&&(Ce=await g(le,R))!==0){let L=new n(m,{method:"POST",body:R,duplex:"half"}),H;if(a.isFormData(R)&&(H=L.headers.get("content-type"))&&le.setContentType(H),L.body){const[ue,Q]=ke(Ce,re(je(D)));R=qe(L.body,He,ue,Q)}}a.isString(G)||(G=G?"include":"omit");const T=o&&"credentials"in n.prototype,xe={...Te,signal:Z,method:d.toUpperCase(),headers:le.normalize().toJSON(),body:R,duplex:"half",credentials:T?G:void 0};z=o&&new n(m,xe);let U=await(o?Ae(z,Te):Ae(m,xe));const Ne=l&&(N==="stream"||N==="response");if(l&&(P||Ne&&B)){const L={};["status","statusText","headers"].forEach(_e=>{L[_e]=U[_e]});const H=a.toFiniteNumber(U.headers.get("content-length")),[ue,Q]=P&&ke(H,re(je(P),!0))||[];U=new r(qe(U.body,He,ue,()=>{Q&&Q(),B&&B()}),L)}N=N||"text";let yt=await h[a.findKey(h,N)||"text"](U,u);return!Ne&&B&&B(),await new Promise((L,H)=>{at(L,H,{data:yt,headers:C.from(U.headers),status:U.status,statusText:U.statusText,config:u,request:z})})}catch(T){throw B&&B(),T&&T.name==="TypeError"&&/Load failed|fetch/i.test(T.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,u,z,T&&T.response),{cause:T.cause||T}):y.from(T,T&&T.code,u,z,T&&T.response)}}},zn=new Map,ut=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,p,f,l=zn;for(;c--;)p=o[c],f=l.get(p),f===void 0&&l.set(p,f=c?new Map:$n(t)),l=f;return f};ut();const Oe={http:on,xhr:kn,fetch:{get:ut}};a.forEach(Oe,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Je=e=>`- ${e}`,Jn=e=>a.isFunction(e)||e===null||e===!1;function Vn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!Jn(r)&&(s=Oe[(c=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([p,f])=>`adapter ${p} `+(f===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
|
|
4
|
+
`+i.map(Je).join(`
|
|
5
|
+
`):" "+Je(i[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const ft={getAdapter:Vn,adapters:Oe};function he(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new X(null,e)}function Ve(e){return he(e),e.headers=C.from(e.headers),e.data=pe.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||v.adapter,e)(e).then(function(r){return he(e),r.data=pe.call(e,e.transformResponse,r),r.headers=C.from(r.headers),r},function(r){return it(r)||(he(e),r&&r.response&&(r.response.data=pe.call(e,e.transformResponse,r.response),r.response.headers=C.from(r.response.headers))),Promise.reject(r)})}const dt="1.13.6",ce={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ce[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};ce.transitional=function(t,n,r){function s(o,i){return"[Axios v"+dt+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new y(s(i," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!We[i]&&(We[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};ce.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Wn(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],p=c===void 0||i(c,o,e);if(p!==!0)throw new y("option "+o+" must be "+p,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+o,y.ERR_BAD_OPTION)}}const ne={assertOptions:Wn,validators:ce},_=ne.validators;let j=class{constructor(t){this.defaults=t||{},this.interceptors={request:new De,response:new De}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=q(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ne.assertOptions(r,{silentJSONParsing:_.transitional(_.boolean),forcedJSONParsing:_.transitional(_.boolean),clarifyTimeoutError:_.transitional(_.boolean),legacyInterceptorReqResOrdering:_.transitional(_.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ne.assertOptions(s,{encode:_.function,serialize:_.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ne.assertOptions(n,{baseUrl:_.spelling("baseURL"),withXsrfToken:_.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],u=>{delete o[u]}),n.headers=C.concat(i,o);const c=[];let p=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;p=p&&m.synchronous;const d=n.transitional||ge;d&&d.legacyInterceptorReqResOrdering?c.unshift(m.fulfilled,m.rejected):c.push(m.fulfilled,m.rejected)});const f=[];this.interceptors.response.forEach(function(m){f.push(m.fulfilled,m.rejected)});let l,h=0,b;if(!p){const u=[Ve.bind(this),void 0];for(u.unshift(...c),u.push(...f),b=u.length,l=Promise.resolve(n);h<b;)l=l.then(u[h++],u[h++]);return l}b=c.length;let g=n;for(;h<b;){const u=c[h++],m=c[h++];try{g=u(g)}catch(d){m.call(this,d);break}}try{l=Ve.call(this,g)}catch(u){return Promise.reject(u)}for(h=0,b=f.length;h<b;)l=l.then(f[h++],f[h++]);return l}getUri(t){t=q(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){j.prototype[t]=function(n,r){return this.request(q(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(o,i,c){return this.request(q(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}j.prototype[t]=n(),j.prototype[t+"Form"]=n(!0)});let Kn=class pt{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new X(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new pt(function(s){t=s}),cancel:t}}};function vn(e){return function(n){return e.apply(null,n)}}function Xn(e){return a.isObject(e)&&e.isAxiosError===!0}const we={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(we).forEach(([e,t])=>{we[t]=e});function ht(e){const t=new j(e),n=Ke(j.prototype.request,t);return a.extend(n,j.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ht(q(e,s))},n}const w=ht(v);w.Axios=j;w.CanceledError=X;w.CancelToken=Kn;w.isCancel=it;w.VERSION=dt;w.toFormData=ae;w.AxiosError=y;w.Cancel=w.CanceledError;w.all=function(t){return Promise.all(t)};w.spread=vn;w.isAxiosError=Xn;w.mergeConfig=q;w.AxiosHeaders=C;w.formToJSON=e=>ot(a.isHTMLForm(e)?new FormData(e):e);w.getAdapter=ft.getAdapter;w.HttpStatusCode=we;w.default=w;const{Axios:Yn,AxiosError:er,CanceledError:tr,isCancel:nr,CancelToken:rr,VERSION:sr,all:or,Cancel:ir,isAxiosError:ar,spread:cr,toFormData:lr,AxiosHeaders:ur,HttpStatusCode:fr,formToJSON:dr,getAdapter:pr,mergeConfig:hr}=w,I=w.create();I.interceptors.request.use(e=>{e.baseURL||(e.baseURL="/");const t=Intl.DateTimeFormat().resolvedOptions().timeZone;return e.headers["User-Timezone"]=t,e},e=>Promise.reject(e));I.interceptors.response.use(e=>e,e=>Promise.reject(e));const mt={getAppTree:"/api/tree",getFile:"/api/file"},mr=()=>I.get(mt.getAppTree),yr=e=>I.get(mt.getFile,{params:{path:e}}),br={install:()=>I.post("/api/agent/install").then(e=>e.data),uninstall:()=>I.delete("/api/agent/uninstall").then(e=>e.data),status:()=>I.get("/api/agent/status").then(e=>e.data)};export{yr as a,br as b,mr as g};
|