@bytespell/shella 0.1.4 → 0.1.5
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 +48 -0
- package/bin/cli.js +33 -7
- package/dev/cli.tsx +12 -0
- package/dist/server/index.js +2 -1
- package/dist/server/routes/directory.d.ts +8 -0
- package/dist/server/routes/directory.js +84 -0
- package/dist/web/assets/{_baseUniq-6T01QAux.js → _baseUniq-BxVG561Z.js} +1 -1
- package/dist/web/assets/{arc-BkH3TPJb.js → arc-B9TFF79T.js} +1 -1
- package/dist/web/assets/{architectureDiagram-VXUJARFQ-BSi6BLCC.js → architectureDiagram-VXUJARFQ-BMRLMpf8.js} +1 -1
- package/dist/web/assets/{blockDiagram-VD42YOAC-QSPUbinO.js → blockDiagram-VD42YOAC-DBQKFxeQ.js} +1 -1
- package/dist/web/assets/{c4Diagram-YG6GDRKO-Cya_BihR.js → c4Diagram-YG6GDRKO-TiYEZrdu.js} +1 -1
- package/dist/web/assets/channel-aOIIaiSs.js +1 -0
- package/dist/web/assets/{chunk-4BX2VUAB-DIL6eizv.js → chunk-4BX2VUAB-CWCp0N17.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-CgwejoZz.js → chunk-55IACEB6-CeVCFKqv.js} +1 -1
- package/dist/web/assets/{chunk-B4BG7PRW-9mIPqoGe.js → chunk-B4BG7PRW-B-AoaHJt.js} +1 -1
- package/dist/web/assets/{chunk-DI55MBZ5-BRbyRfgT.js → chunk-DI55MBZ5-CCGkXnX-.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-CVBT25Fj.js → chunk-FMBD7UC4-Bcupjeb_.js} +1 -1
- package/dist/web/assets/{chunk-QN33PNHL-rTj-WT2G.js → chunk-QN33PNHL-DlyUQaTO.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-BaUBiHya.js → chunk-QZHKN3VN-THN-at_3.js} +1 -1
- package/dist/web/assets/{chunk-TZMSLE5B-C4_O5TI-.js → chunk-TZMSLE5B-CtErOFJM.js} +1 -1
- package/dist/web/assets/classDiagram-2ON5EDUG-BFLMv18M.js +1 -0
- package/dist/web/assets/classDiagram-v2-WZHVMYZB-BFLMv18M.js +1 -0
- package/dist/web/assets/clone-BR_FHSwu.js +1 -0
- package/dist/web/assets/{code-block-QI2IAROF-Bj_2OIYt.js → code-block-QI2IAROF-CPI-88R6.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-T7a1luWi.js → cose-bilkent-S5V4N54A-YrHmsLe4.js} +1 -1
- package/dist/web/assets/{dagre-6UL2VRFP-CeH5ZsdW.js → dagre-6UL2VRFP-Dcvw3qhj.js} +1 -1
- package/dist/web/assets/{diagram-PSM6KHXK-Cdod2Lna.js → diagram-PSM6KHXK-B135EOe6.js} +1 -1
- package/dist/web/assets/{diagram-QEK2KX5R-CYks2r54.js → diagram-QEK2KX5R-w3KdB_-u.js} +1 -1
- package/dist/web/assets/{diagram-S2PKOQOG-DCmy0g7p.js → diagram-S2PKOQOG-DYssvOTP.js} +1 -1
- package/dist/web/assets/{erDiagram-Q2GNP2WA-Dlz1bNvI.js → erDiagram-Q2GNP2WA-DpnuE7B_.js} +1 -1
- package/dist/web/assets/{flowDiagram-NV44I4VS-Di5Iit1B.js → flowDiagram-NV44I4VS-BhcJ-8Yu.js} +1 -1
- package/dist/web/assets/{ganttDiagram-JELNMOA3-9i1dugg-.js → ganttDiagram-JELNMOA3-ButVkRCz.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-NY62KEGX-BORbMVri.js → gitGraphDiagram-NY62KEGX-ZLz8eoSo.js} +1 -1
- package/dist/web/assets/{graph-C0SCKxbQ.js → graph-CKmCFGqF.js} +1 -1
- package/dist/web/assets/{index-CcDdxbB-.js → index-BHJDUcNL.js} +84 -84
- package/dist/web/assets/{index-CYVJT8rN.js → index-DEiKajXR.js} +1 -1
- package/dist/web/assets/{infoDiagram-WHAUD3N6-7ohMQFLY.js → infoDiagram-WHAUD3N6-C_h94brE.js} +1 -1
- package/dist/web/assets/{journeyDiagram-XKPGCS4Q-DZp7Z7wE.js → journeyDiagram-XKPGCS4Q-u0bPRxxb.js} +1 -1
- package/dist/web/assets/{kanban-definition-3W4ZIXB7-BCNLCm54.js → kanban-definition-3W4ZIXB7-DkM-KD6Y.js} +1 -1
- package/dist/web/assets/{layout-AUnZuY21.js → layout-DGSU3MQw.js} +1 -1
- package/dist/web/assets/{linear-B0bfAqGt.js → linear-Dck9QCb9.js} +1 -1
- package/dist/web/assets/{mermaid.core-D5fXNCxA.js → mermaid.core-DfB-jqaz.js} +5 -5
- package/dist/web/assets/{min-BZUFOEEw.js → min-CqEcl9J0.js} +1 -1
- package/dist/web/assets/{mindmap-definition-VGOIOE7T-hEGJLJ8N.js → mindmap-definition-VGOIOE7T-D1KrSALz.js} +1 -1
- package/dist/web/assets/{pieDiagram-ADFJNKIX-BRpCTJIO.js → pieDiagram-ADFJNKIX-CZ-507Bd.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-AYHSOK5B-m7jaiHQb.js → quadrantDiagram-AYHSOK5B-Jw0og6Ix.js} +1 -1
- package/dist/web/assets/{requirementDiagram-UZGBJVZJ-Coh9g9Sp.js → requirementDiagram-UZGBJVZJ-5JWD7TEH.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-TZEHDZUN-CrD_kUGR.js → sankeyDiagram-TZEHDZUN-DzlxPj37.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-WL72ISMW-C04yD1EI.js → sequenceDiagram-WL72ISMW-Cui1ykiA.js} +1 -1
- package/dist/web/assets/{stateDiagram-FKZM4ZOC-DhP-DMZW.js → stateDiagram-FKZM4ZOC-CCdGE_zt.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-4FDKWEC3-CsLg9bzy.js +1 -0
- package/dist/web/assets/{timeline-definition-IT6M3QCI-40iW2p_5.js → timeline-definition-IT6M3QCI-CP2T8mHI.js} +1 -1
- package/dist/web/assets/{treemap-KMMF4GRG-BnxWQbzt.js → treemap-KMMF4GRG-DGBVlHVf.js} +1 -1
- package/dist/web/assets/welcome-screen-test-DnIwI3hf.js +1 -0
- package/dist/web/assets/{xychartDiagram-PRI3JC2R-D6lcJDCc.js → xychartDiagram-PRI3JC2R-DDlMipkA.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/channel-DGAtS-pa.js +0 -1
- package/dist/web/assets/classDiagram-2ON5EDUG-DLvlUUJq.js +0 -1
- package/dist/web/assets/classDiagram-v2-WZHVMYZB-DLvlUUJq.js +0 -1
- package/dist/web/assets/clone-BZW2JABw.js +0 -1
- package/dist/web/assets/stateDiagram-v2-4FDKWEC3-DWi5vrD6.js +0 -1
- package/dist/web/assets/welcome-screen-test-CLeWuIqq.js +0 -1
package/README.md
CHANGED
|
@@ -56,6 +56,54 @@ docker compose up -d
|
|
|
56
56
|
# Access at http://<server-ip>:3067
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
## GitHub Authentication
|
|
60
|
+
|
|
61
|
+
AI agents may need to push code changes to GitHub. Shella uses the GitHub CLI (`gh`) for authentication.
|
|
62
|
+
|
|
63
|
+
### Docker Setup
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 1. Start shella
|
|
67
|
+
docker compose up -d
|
|
68
|
+
|
|
69
|
+
# 2. Authenticate with GitHub (one-time setup)
|
|
70
|
+
docker exec -it shella gh auth login
|
|
71
|
+
|
|
72
|
+
# 3. Follow the device flow prompts
|
|
73
|
+
# - Choose "GitHub.com"
|
|
74
|
+
# - Choose "HTTPS"
|
|
75
|
+
# - Authenticate via browser
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Your authentication is stored in `/projects/.shella/gh/` and persists across container restarts and rebuilds.
|
|
79
|
+
|
|
80
|
+
### npx Usage
|
|
81
|
+
|
|
82
|
+
If running via `npx @bytespell/shella`, you need `gh` installed on your system:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Install gh CLI (macOS)
|
|
86
|
+
brew install gh
|
|
87
|
+
|
|
88
|
+
# Install gh CLI (Linux)
|
|
89
|
+
# See: https://github.com/cli/cli/blob/trunk/docs/install_linux.md
|
|
90
|
+
|
|
91
|
+
# Authenticate
|
|
92
|
+
gh auth login
|
|
93
|
+
|
|
94
|
+
# Run shella
|
|
95
|
+
npx @bytespell/shella
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Verify Authentication
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Check auth status
|
|
102
|
+
docker exec shella gh auth status
|
|
103
|
+
|
|
104
|
+
# Should show: "Logged in to github.com as <username>"
|
|
105
|
+
```
|
|
106
|
+
|
|
59
107
|
## Features
|
|
60
108
|
|
|
61
109
|
- **Parallel agents** - Run multiple agents on different tasks simultaneously
|
package/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from 'commander';
|
|
3
3
|
import { createOpencodeServer } from '@opencode-ai/sdk';
|
|
4
|
-
import { networkInterfaces } from 'os';
|
|
4
|
+
import { networkInterfaces, homedir } from 'os';
|
|
5
5
|
import { spawn } from 'child_process';
|
|
6
6
|
import { createConnection } from 'net';
|
|
7
7
|
import { existsSync, readdirSync, readFileSync } from 'fs';
|
|
@@ -50,6 +50,17 @@ async function isPortAvailable(port) {
|
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Find the next available port starting from a given port
|
|
55
|
+
*/
|
|
56
|
+
async function findAvailablePort(start, maxAttempts = 100) {
|
|
57
|
+
for (let port = start; port < start + maxAttempts; port++) {
|
|
58
|
+
if (await isPortAvailable(port)) {
|
|
59
|
+
return port;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
53
64
|
/**
|
|
54
65
|
* Get the LAN IP address for mobile access
|
|
55
66
|
*/
|
|
@@ -147,16 +158,23 @@ async function startCommand(options) {
|
|
|
147
158
|
const projectsDir = options.projectsDir ? path.resolve(options.projectsDir) : cwd;
|
|
148
159
|
// Check if ports are available
|
|
149
160
|
const webPortAvailable = await isPortAvailable(port);
|
|
150
|
-
const ocPortAvailable = await isPortAvailable(opencodePort);
|
|
151
161
|
if (!webPortAvailable) {
|
|
152
162
|
p.log.error(`port ${port} is already in use`);
|
|
153
163
|
p.log.message('try: shella --port 3070');
|
|
154
164
|
process.exit(1);
|
|
155
165
|
}
|
|
166
|
+
// Check OpenCode port - use fallback if in use (likely another OpenCode instance)
|
|
167
|
+
let actualOpencodePort = opencodePort;
|
|
168
|
+
const ocPortAvailable = await isPortAvailable(opencodePort);
|
|
156
169
|
if (!ocPortAvailable) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
170
|
+
const fallbackPort = await findAvailablePort(opencodePort + 1);
|
|
171
|
+
if (!fallbackPort) {
|
|
172
|
+
p.log.error(`port ${opencodePort} is in use and no fallback ports available`);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
actualOpencodePort = fallbackPort;
|
|
176
|
+
p.log.warn(`port ${opencodePort} is in use (possibly another OpenCode instance)`);
|
|
177
|
+
p.log.message(`using port ${actualOpencodePort} instead`);
|
|
160
178
|
}
|
|
161
179
|
// Ensure opencode binary from node_modules/.bin is in PATH
|
|
162
180
|
// Required for: npm install -g @bytespell/shella
|
|
@@ -184,10 +202,17 @@ async function startCommand(options) {
|
|
|
184
202
|
s.start('Starting OpenCode...');
|
|
185
203
|
else
|
|
186
204
|
log('starting opencode...');
|
|
205
|
+
// Set XDG env vars to isolate OpenCode data to shella directories
|
|
206
|
+
// This prevents shella from polluting user's existing OpenCode installation
|
|
207
|
+
const home = homedir();
|
|
208
|
+
process.env.XDG_DATA_HOME = path.join(home, '.local', 'share', 'shella');
|
|
209
|
+
process.env.XDG_CACHE_HOME = path.join(home, '.cache', 'shella');
|
|
210
|
+
process.env.XDG_CONFIG_HOME = path.join(home, '.config', 'shella');
|
|
211
|
+
process.env.XDG_STATE_HOME = path.join(home, '.local', 'state', 'shella');
|
|
187
212
|
try {
|
|
188
213
|
const config = getOpencodeConfig();
|
|
189
214
|
opencodeServer = await createOpencodeServer({
|
|
190
|
-
port:
|
|
215
|
+
port: actualOpencodePort,
|
|
191
216
|
timeout: 30000,
|
|
192
217
|
config,
|
|
193
218
|
});
|
|
@@ -204,7 +229,7 @@ async function startCommand(options) {
|
|
|
204
229
|
s.message('Registering directories...');
|
|
205
230
|
else
|
|
206
231
|
log('registering directories...');
|
|
207
|
-
const { names } = await registerProjects(
|
|
232
|
+
const { names } = await registerProjects(actualOpencodePort, options.projectsDir);
|
|
208
233
|
const projectName = names.length === 1 ? names[0] : names.length > 1 ? `${names.length} projects` : undefined;
|
|
209
234
|
// Start Express server in production mode, passing mode and directory
|
|
210
235
|
if (s)
|
|
@@ -224,6 +249,7 @@ async function startCommand(options) {
|
|
|
224
249
|
...process.env,
|
|
225
250
|
NODE_ENV: 'production',
|
|
226
251
|
PORT: String(port),
|
|
252
|
+
OPENCODE_URL: `http://localhost:${actualOpencodePort}`,
|
|
227
253
|
},
|
|
228
254
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
229
255
|
});
|
package/dev/cli.tsx
CHANGED
|
@@ -13,6 +13,18 @@
|
|
|
13
13
|
|
|
14
14
|
export {}; // Make this a module for top-level await
|
|
15
15
|
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
|
|
18
|
+
// Check if running inside a container - this tool won't work there
|
|
19
|
+
if (fs.existsSync('/.dockerenv') || fs.existsSync('/run/.containerenv')) {
|
|
20
|
+
console.error('\x1b[31m✗ Error: Running inside a container\x1b[0m');
|
|
21
|
+
console.error(
|
|
22
|
+
'\x1b[33m The dev tool manages host-based servers and cannot be used from containers.\x1b[0m',
|
|
23
|
+
);
|
|
24
|
+
console.error('\x1b[33m Please run this command from your host machine instead.\x1b[0m');
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
const args = process.argv.slice(2);
|
|
17
29
|
|
|
18
30
|
if (args.length === 0) {
|
package/dist/server/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import usageRoutes from './routes/usage.js';
|
|
|
16
16
|
import configRoutes from './routes/config.js';
|
|
17
17
|
import promptRoutes from './routes/prompt.js';
|
|
18
18
|
import localLlmRoutes from './routes/local-llm.js';
|
|
19
|
+
import directoryRoutes from './routes/directory.js';
|
|
19
20
|
import { getDatabase } from './services/database.js';
|
|
20
21
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
21
22
|
// Runtime mode detection
|
|
@@ -116,9 +117,9 @@ app.use('/__shella', usageRoutes);
|
|
|
116
117
|
app.use('/__shella/config', configRoutes);
|
|
117
118
|
app.use('/__shella', promptRoutes);
|
|
118
119
|
app.use('/__shella/local-llm', localLlmRoutes);
|
|
120
|
+
app.use('/__shella', directoryRoutes);
|
|
119
121
|
app.use('/__model-state', modelStateRoutes);
|
|
120
122
|
app.use('/__logs', logsRoutes);
|
|
121
|
-
// Session routes with chunking - BEFORE proxy catch-all
|
|
122
123
|
app.use('/api/session', sessionRoutes);
|
|
123
124
|
app.use('/api', proxyRoutes);
|
|
124
125
|
// Production: serve static files from dist/web/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory API Routes
|
|
3
|
+
*
|
|
4
|
+
* Provides aggregated directory metadata by calling OpenCode SDK server-side.
|
|
5
|
+
* Returns directory information including VCS branch, diffs, file counts, etc.
|
|
6
|
+
*/
|
|
7
|
+
declare const router: import("express-serve-static-core").Router;
|
|
8
|
+
export default router;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory API Routes
|
|
3
|
+
*
|
|
4
|
+
* Provides aggregated directory metadata by calling OpenCode SDK server-side.
|
|
5
|
+
* Returns directory information including VCS branch, diffs, file counts, etc.
|
|
6
|
+
*/
|
|
7
|
+
import { Router } from 'express';
|
|
8
|
+
import { opencodeClient } from '../lib/opencode-client.js';
|
|
9
|
+
const router = Router();
|
|
10
|
+
/**
|
|
11
|
+
* GET /directory/:directoryId
|
|
12
|
+
*
|
|
13
|
+
* Returns aggregated directory information:
|
|
14
|
+
* - path (from window directoryMap lookup)
|
|
15
|
+
* - branch (from OpenCode VCS API)
|
|
16
|
+
* - diff (STUB - null for now)
|
|
17
|
+
* - fileCount (STUB - null for now)
|
|
18
|
+
* - lastModified (STUB - null for now)
|
|
19
|
+
*/
|
|
20
|
+
router.get('/directory/:directoryId', async (req, res) => {
|
|
21
|
+
try {
|
|
22
|
+
const { directoryId } = req.params;
|
|
23
|
+
if (!directoryId) {
|
|
24
|
+
res.status(400).json({ error: 'directoryId is required' });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
// Get directory path from windows table
|
|
28
|
+
// Find any window with this directoryId and extract the directory from it
|
|
29
|
+
// Note: We need to query project.current or project.list from OpenCode SDK
|
|
30
|
+
// For now, we'll use a simpler approach: query OpenCode SDK for project list
|
|
31
|
+
// Get all projects from OpenCode
|
|
32
|
+
const projectsResponse = await opencodeClient.project.list();
|
|
33
|
+
const projects = projectsResponse.data || [];
|
|
34
|
+
let directoryPath = null;
|
|
35
|
+
// Match project by directoryId (which is the worktree path)
|
|
36
|
+
if (projects.length > 0) {
|
|
37
|
+
const matchingProject = projects.find((p) => p.worktree === directoryId);
|
|
38
|
+
if (matchingProject) {
|
|
39
|
+
directoryPath = matchingProject.worktree;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Fallback: use directoryId as path (works in simple cases)
|
|
43
|
+
if (!directoryPath) {
|
|
44
|
+
directoryPath = directoryId;
|
|
45
|
+
}
|
|
46
|
+
// Fetch VCS info from OpenCode SDK
|
|
47
|
+
let branch = null;
|
|
48
|
+
try {
|
|
49
|
+
const vcsResponse = await opencodeClient.vcs.get({
|
|
50
|
+
directory: directoryPath,
|
|
51
|
+
});
|
|
52
|
+
branch = vcsResponse.data?.branch || null;
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
// VCS call failed - might not be a git repo, or path doesn't exist
|
|
56
|
+
console.warn(`[directory] VCS fetch failed for ${directoryPath}:`, err);
|
|
57
|
+
branch = null;
|
|
58
|
+
}
|
|
59
|
+
// TODO: Fetch diff stats (git status)
|
|
60
|
+
// const diffResponse = await opencodeClient.file.status({ directory: directoryPath });
|
|
61
|
+
const diff = null; // STUB
|
|
62
|
+
// TODO: Fetch file count
|
|
63
|
+
// const filesResponse = await opencodeClient.file.list({ directory: directoryPath });
|
|
64
|
+
const fileCount = null; // STUB
|
|
65
|
+
// TODO: Fetch last modified time
|
|
66
|
+
// Could use fs.stat on the directory or git log
|
|
67
|
+
const lastModified = null; // STUB
|
|
68
|
+
// Return aggregated data
|
|
69
|
+
res.json({
|
|
70
|
+
path: directoryPath,
|
|
71
|
+
branch,
|
|
72
|
+
diff,
|
|
73
|
+
fileCount,
|
|
74
|
+
lastModified,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error('[directory] API error:', error);
|
|
79
|
+
res.status(500).json({
|
|
80
|
+
error: error instanceof Error ? error.message : 'Internal server error',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export default router;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aU as L,bi as ln,aE as A,aS as v,bj as gn,bk as dn,aD as W,bl as hn,bm as z,bn as pn,bo as An,bp as m,aV as N,a_ as U,b1 as T,bq as _n,aY as on,br as wn,bs as On,aF as V,bt as Pn,bu as I}from"./mermaid.core-
|
|
1
|
+
import{aU as L,bi as ln,aE as A,aS as v,bj as gn,bk as dn,aD as W,bl as hn,bm as z,bn as pn,bo as An,bp as m,aV as N,a_ as U,b1 as T,bq as _n,aY as on,br as wn,bs as On,aF as V,bt as Pn,bu as I}from"./mermaid.core-DfB-jqaz.js";var vn="[object Symbol]";function x(n){return typeof n=="symbol"||L(n)&&ln(n)==vn}function yn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var B=v?v.prototype:void 0,K=B?B.toString:void 0;function k(n){if(typeof n=="string")return n;if(A(n))return yn(n,k)+"";if(x(n))return K?K.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function En(){}function bn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function Rn(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function In(n,r,e){return r===r?Rn(n,r,e):cn(n,Tn,e)}function Sn(n,r){var e=n==null?0:n.length;return!!e&&In(n,r,0)>-1}function M(n){return W(n)?gn(n):dn(n)}var Ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Ln.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dn=/\\(\\)?/g,Fn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Dn,"$1"):i||e)}),r});function Gn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:$(n,r)?[n]:Fn(Gn(n))}function R(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[R(r[e++])];return e&&e==i?n:void 0}function mn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var H=v?v.isConcatSpreadable:void 0;function Nn(n){return A(n)||z(n)||!!(H&&n&&n[H])}function Hr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=Nn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Un(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Bn(){return[]}var Kn=Object.prototype,Hn=Kn.propertyIsEnumerable,q=Object.getOwnPropertySymbols,qn=q?function(n){return n==null?[]:(n=Object(n),en(q(n),function(r){return Hn.call(n,r)}))}:Bn;function Yn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function Y(n){return Yn(n,M,qn)}var Zn="__lodash_hash_undefined__";function Xn(n){return this.__data__.set(n,Zn),this}function Jn(n){return this.__data__.has(n)}function y(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}y.prototype.add=y.prototype.push=Xn;y.prototype.has=Jn;function Qn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var Wn=1,zn=2;function fn(n,r,e,i,f,t){var s=e&Wn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&zn?new y:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Qn(r,function(O,P){if(!tn(o,P)&&(p===O||f(p,O,e,i,t)))return o.push(P)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function C(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var kn=1,jn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",Z=v?v.prototype:void 0,S=Z?Z.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new m(n),new m(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&kn;if(u||(u=C),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=jn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(S)return S.call(n)==S.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=Y(n),a=u.length,h=Y(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var O=n[d],P=r[d];if(i)var G=s?i(P,O,d,r,n,t):i(O,P,d,n,r,t);if(!(G===void 0?O===P||f(O,P,e,i,t):G)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var E=n.constructor,b=r.constructor;E!=b&&"constructor"in n&&"constructor"in r&&!(typeof E=="function"&&E instanceof E&&typeof b=="function"&&b instanceof b)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,X="[object Arguments]",J="[object Array]",c="[object Object]",wr=Object.prototype,Q=wr.hasOwnProperty;function Or(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?J:N(n),h=u?J:N(r);a=a==X?c:a,h=h==X?c:h;var g=a==c,l=h==c,d=a==h;if(d&&U(n)){if(!U(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&Q.call(n,"__wrapped__"),p=l&&Q.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function D(n,r,e,i,f){return n===r?!0:n==null||r==null||!L(n)&&!L(r)?n!==n&&r!==r:Or(n,r,e,i,D,f)}var Pr=1,vr=2;function yr(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?D(h,a,Pr|vr,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function Er(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function br(n){var r=Er(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||yr(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=j(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=R(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&On(s,f)&&(A(n)||z(n)))}function Rr(n,r){return n!=null&&Tr(n,r,cr)}var Ir=1,Sr=2;function Lr(n,r){return $(n)&&sn(r)?un(R(n),r):function(e){var i=mn(e,n);return i===void 0&&i===r?Rr(e,n):D(r,i,Ir|Sr)}}function xr(n){return function(r){return r?.[n]}}function Mr(n){return function(r){return nn(r,n)}}function $r(n){return $(n)?xr(R(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Lr(n[0],n[1]):br(n):$r(n)}function Cr(n,r){return n&&Pn(n,r,M)}function Dr(n,r){return function(e,i){if(e==null)return e;if(!W(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var F=Dr(Cr);function Fr(n){return typeof n=="function"?n:V}function qr(n,r){var e=A(n)?bn:F;return e(n,Fr(r))}function Gr(n,r){var e=[];return F(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function Yr(n,r){var e=A(n)?en:Gr;return e(n,an(r))}function mr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Zr(n,r,e){var i=A(n)?Un:mr,f=arguments.length<3;return i(n,an(r),e,f,F)}var Nr=1/0,Ur=I&&1/C(new I([,-0]))[1]==Nr?function(n){return new I(n)}:En,Br=200;function Xr(n,r,e){var i=-1,f=Sn,t=n.length,s=!0,u=[],a=u;if(t>=Br){var h=r?null:Ur(n);if(h)return C(h);s=!1,f=tn,a=new y}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{F as a,Hr as b,yn as c,an as d,rn as e,Yn as f,qn as g,Y as h,x as i,bn as j,M as k,Xr as l,Yr as m,qr as n,cn as o,Fr as p,Cr as q,Zr as r,Bn as s,Tr as t,j as u,R as v,nn as w,Rr as x,Gn as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as ln,N as an,O as Y,P as O,Q,R as un,S as y,T as tn,V as j,W as _,X as rn,Y as o,Z as sn,$ as on,a0 as fn}from"./mermaid.core-
|
|
1
|
+
import{M as ln,N as an,O as Y,P as O,Q,R as un,S as y,T as tn,V as j,W as _,X as rn,Y as o,Z as sn,$ as on,a0 as fn}from"./mermaid.core-DfB-jqaz.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,D,S,v,R,V,a){var E=D-l,i=S-h,n=V-v,d=a-R,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-R)-d*(l-v))/u,[l+u*E,h+u*i]}function H(l,h,D,S,v,R,V){var a=l-D,E=h-S,i=(V?R:-R)/j(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,W=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,A=m*m+g*g,T=v-R,P=u*c-f*s,I=(g<0?-1:1)*j(on(0,T*T*A-P*P)),M=(P*g-m*I)/A,N=(-P*m-g*I)/A,w=(P*g+m*I)/A,p=(-P*m+g*I)/A,x=M-W,e=N-t,r=w-W,X=p-t;return x*x+e*e>r*r+X*X&&(M=w,N=p),{cx:M,cy:N,x01:-n,y01:-d,x11:M*(v/T-1),y11:N*(v/T-1)}}function hn(){var l=cn,h=yn,D=Q(0),S=null,v=gn,R=dn,V=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=R.apply(this,arguments)-un,W=rn(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(W>tn-y)a.moveTo(s*Y(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*Y(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,A=f,T=c,P=W,I=W,M=V.apply(this,arguments)/2,N=M>y&&(S?+S.apply(this,arguments):j(u*u+s*s)),w=_(rn(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(N>y){var X=sn(N/u*O(M)),z=sn(N/s*O(M));(P-=X*2)>y?(X*=t?1:-1,A+=X,T-=X):(P=0,A=T=(f+c)/2),(I-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(I=0,m=g=(f+c)/2)}var Z=s*Y(m),$=s*O(m),B=u*Y(T),C=u*O(T);if(w>y){var F=s*Y(g),G=s*O(g),J=u*Y(A),K=u*O(A),q;if(W<an)if(q=pn(Z,$,J,K,F,G,B,C)){var L=Z-q[0],U=$-q[1],k=F-q[0],b=G-q[1],nn=1/O(fn((L*k+U*b)/(j(L*L+U*U)*j(k*k+b*b)))/2),en=j(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=H(J,K,Z,$,s,x,t),r=H(F,G,B,C,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(Z,$),a.arc(0,0,s,m,g,!t)):a.moveTo(Z,$),!(u>y)||!(P>y)?a.lineTo(B,C):p>y?(e=H(B,C,F,G,u,-p,t),r=H(Z,$,J,K,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,A,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-an/2;return[Y(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Q(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Q(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:Q(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:Q(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Q(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:Q(+n),i):R},i.padAngle=function(n){return arguments.length?(V=typeof n=="function"?n:Q(+n),i):V},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|