readingroom 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/bin/readingroom.js +3 -2
- package/dist/assets/index-BFXOIu5r.css +2 -0
- package/dist/assets/index-BWX1yNrT.js +190 -0
- package/dist/index.html +15 -2
- package/package.json +1 -1
- package/src/git.js +216 -0
- package/src/openBrowser.js +29 -18
- package/src/scanner.js +3 -6
- package/src/server.js +179 -9
- package/dist/assets/index-BUv67KbK.css +0 -2
- package/dist/assets/index-BpmvxNpC.js +0 -190
package/dist/index.html
CHANGED
|
@@ -9,8 +9,21 @@
|
|
|
9
9
|
rel="icon"
|
|
10
10
|
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%97%82%EF%B8%8F%3C/text%3E%3C/svg%3E"
|
|
11
11
|
/>
|
|
12
|
-
<script
|
|
13
|
-
|
|
12
|
+
<script>
|
|
13
|
+
// Apply the saved theme before first paint to avoid a flash.
|
|
14
|
+
(function () {
|
|
15
|
+
try {
|
|
16
|
+
var t = localStorage.getItem('readingroom-theme');
|
|
17
|
+
var dark =
|
|
18
|
+
t === 'dark' ||
|
|
19
|
+
((t === null || t === 'system') && matchMedia('(prefers-color-scheme: dark)').matches);
|
|
20
|
+
document.documentElement.classList.toggle('dark', dark);
|
|
21
|
+
document.documentElement.style.colorScheme = dark ? 'dark' : 'light';
|
|
22
|
+
} catch (e) {}
|
|
23
|
+
})();
|
|
24
|
+
</script>
|
|
25
|
+
<script type="module" crossorigin src="/assets/index-BWX1yNrT.js"></script>
|
|
26
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BFXOIu5r.css">
|
|
14
27
|
</head>
|
|
15
28
|
<body>
|
|
16
29
|
<div id="root"></div>
|
package/package.json
CHANGED
package/src/git.js
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { realpathSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Git integration for the inspector (file info + history).
|
|
7
|
+
*
|
|
8
|
+
* Everything shells out to the `git` CLI via execFile — argv only, never a
|
|
9
|
+
* shell — so paths and refs are never interpreted as options or commands.
|
|
10
|
+
* Callers degrade gracefully when git is missing or the served folder is not
|
|
11
|
+
* a repository: repo detection returns null and endpoints report git:false.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const GIT_TIMEOUT_MS = 5000;
|
|
15
|
+
const MAX_BUFFER = 10 * 1024 * 1024; // biggest blob we will hand out
|
|
16
|
+
const HISTORY_LIMIT = 500;
|
|
17
|
+
const FIELD = '\x1f';
|
|
18
|
+
const RECORD = '\x1e';
|
|
19
|
+
const PRETTY = `%H${FIELD}%h${FIELD}%an${FIELD}%ae${FIELD}%aI${FIELD}%s${RECORD}`;
|
|
20
|
+
|
|
21
|
+
export class VersionNotFound extends Error {
|
|
22
|
+
constructor() {
|
|
23
|
+
super('version not found');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function runGit(cwd, args, opts = {}) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
execFile(
|
|
30
|
+
'git',
|
|
31
|
+
args,
|
|
32
|
+
{ cwd, timeout: GIT_TIMEOUT_MS, maxBuffer: MAX_BUFFER, windowsHide: true, ...opts },
|
|
33
|
+
(err, stdout, stderr) => {
|
|
34
|
+
if (err) {
|
|
35
|
+
err.gitStderr = String(stderr ?? '');
|
|
36
|
+
reject(err);
|
|
37
|
+
} else {
|
|
38
|
+
resolve(stdout);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Positive detections are cached for the life of the process; misses re-probe
|
|
46
|
+
// (one cheap exec) so `git init` mid-session starts working without a restart.
|
|
47
|
+
const repoCache = new Map();
|
|
48
|
+
|
|
49
|
+
/** Detect the repository containing rootAbs: { repoRoot, subDir } | null. */
|
|
50
|
+
export async function findRepo(rootAbs) {
|
|
51
|
+
if (repoCache.has(rootAbs)) return repoCache.get(rootAbs);
|
|
52
|
+
let repo = null;
|
|
53
|
+
try {
|
|
54
|
+
// --show-toplevel reports the real path, so compare against the real
|
|
55
|
+
// served root or symlinked roots (macOS /var -> /private/var) never match.
|
|
56
|
+
const realRoot = realpathSync(rootAbs);
|
|
57
|
+
const top = path.resolve(String(await runGit(realRoot, ['rev-parse', '--show-toplevel'])).trim());
|
|
58
|
+
if (top === realRoot || realRoot.startsWith(top + path.sep)) {
|
|
59
|
+
repo = { repoRoot: top, subDir: path.relative(top, realRoot).split(path.sep).join('/') };
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
/* git missing, not a repository, or blocked (e.g. dubious ownership) */
|
|
63
|
+
}
|
|
64
|
+
if (repo) repoCache.set(rootAbs, repo);
|
|
65
|
+
return repo;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The served root may sit below the repo root; git wants repo-relative paths. */
|
|
69
|
+
function repoRelative(repo, rel) {
|
|
70
|
+
const p = String(rel).replace(/\\/g, '/');
|
|
71
|
+
return repo.subDir ? `${repo.subDir}/${p}` : p;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** `git log --name-status` quotes exotic paths C-style; undo the common cases. */
|
|
75
|
+
function unquotePath(p) {
|
|
76
|
+
if (p.length >= 2 && p.startsWith('"') && p.endsWith('"')) {
|
|
77
|
+
try {
|
|
78
|
+
return JSON.parse(p);
|
|
79
|
+
} catch {
|
|
80
|
+
return p.slice(1, -1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return p;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function parseCommits(out) {
|
|
87
|
+
const commits = [];
|
|
88
|
+
let current = null;
|
|
89
|
+
for (const line of String(out).split(/\r?\n/)) {
|
|
90
|
+
if (line.includes(RECORD)) {
|
|
91
|
+
const fields = line.slice(0, line.indexOf(RECORD)).split(FIELD);
|
|
92
|
+
current = {
|
|
93
|
+
sha: fields[0] || '',
|
|
94
|
+
abbrev: fields[1] || '',
|
|
95
|
+
author: fields[2] || '',
|
|
96
|
+
email: fields[3] || '',
|
|
97
|
+
date: fields[4] || '',
|
|
98
|
+
subject: fields.slice(5).join(FIELD),
|
|
99
|
+
status: null,
|
|
100
|
+
moves: [],
|
|
101
|
+
};
|
|
102
|
+
if (current.sha) commits.push(current);
|
|
103
|
+
} else if (current && line.includes('\t')) {
|
|
104
|
+
const cols = line.split('\t');
|
|
105
|
+
current.status = current.status || cols[0].replace(/\d+$/, ''); // R100 -> R
|
|
106
|
+
current.moves.push(cols.slice(1).map(unquotePath));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return commits;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* `--follow` reports every commit against the file's current name. Annotate
|
|
114
|
+
* each commit with the path the file had at that point (newest -> oldest walk
|
|
115
|
+
* flips the path at each rename) so snapshots resolve across renames.
|
|
116
|
+
*/
|
|
117
|
+
function withPathAtCommit(commits, startPath) {
|
|
118
|
+
let pathNow = startPath;
|
|
119
|
+
return commits.map((commit) => {
|
|
120
|
+
const entry = {
|
|
121
|
+
sha: commit.sha,
|
|
122
|
+
abbrev: commit.abbrev,
|
|
123
|
+
author: commit.author,
|
|
124
|
+
email: commit.email,
|
|
125
|
+
date: commit.date,
|
|
126
|
+
subject: commit.subject,
|
|
127
|
+
status: commit.status || 'M',
|
|
128
|
+
path: pathNow,
|
|
129
|
+
};
|
|
130
|
+
const move = commit.moves.find((m) => m.length === 2 && m[1] === pathNow);
|
|
131
|
+
if (move) pathNow = move[0];
|
|
132
|
+
return entry;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function isUnborn(err) {
|
|
137
|
+
return /does not have any commits yet/i.test(err.gitStderr || '');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** { git, branch } for the repo containing rootAbs (branch null if unknown). */
|
|
141
|
+
export async function repoStatus(rootAbs) {
|
|
142
|
+
const repo = await findRepo(rootAbs);
|
|
143
|
+
if (!repo) return { git: false, branch: null };
|
|
144
|
+
try {
|
|
145
|
+
const branch = String(await runGit(repo.repoRoot, ['rev-parse', '--abbrev-ref', 'HEAD'])).trim();
|
|
146
|
+
return { git: true, branch: branch && branch !== 'HEAD' ? branch : null };
|
|
147
|
+
} catch {
|
|
148
|
+
return { git: true, branch: null }; // unborn branch or detached HEAD
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Latest commit that touched rel (served-root relative), or null. */
|
|
153
|
+
export async function lastCommitFor(rootAbs, rel) {
|
|
154
|
+
const repo = await findRepo(rootAbs);
|
|
155
|
+
if (!repo) return null;
|
|
156
|
+
try {
|
|
157
|
+
const out = await runGit(repo.repoRoot, ['log', '-n', '1', `--format=${PRETTY}`, '--', repoRelative(repo, rel)]);
|
|
158
|
+
const commit = parseCommits(out)[0];
|
|
159
|
+
return commit ? { sha: commit.sha, abbrev: commit.abbrev, author: commit.author, email: commit.email, date: commit.date, subject: commit.subject } : null;
|
|
160
|
+
} catch {
|
|
161
|
+
return null; // untracked, unborn repo, or a git hiccup — info degrades quietly
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Commit timeline for rel: { repo, commits, truncated } | null when not a repo. */
|
|
166
|
+
export async function fileHistory(rootAbs, rel) {
|
|
167
|
+
const repo = await findRepo(rootAbs);
|
|
168
|
+
if (!repo) return null;
|
|
169
|
+
let out;
|
|
170
|
+
try {
|
|
171
|
+
out = await runGit(repo.repoRoot, [
|
|
172
|
+
'log', '--follow', '--name-status', `--format=${PRETTY}`,
|
|
173
|
+
'-n', String(HISTORY_LIMIT), '--', repoRelative(repo, rel),
|
|
174
|
+
]);
|
|
175
|
+
} catch (err) {
|
|
176
|
+
if (isUnborn(err)) return { repo, commits: [], truncated: false };
|
|
177
|
+
throw err;
|
|
178
|
+
}
|
|
179
|
+
const commits = withPathAtCommit(parseCommits(out), repoRelative(repo, rel));
|
|
180
|
+
return { repo, commits, truncated: commits.length >= HISTORY_LIMIT };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Blob for rel at ref (a commit sha). Rename-aware via the history walk;
|
|
185
|
+
* commits that deleted the file resolve to the parent (last live version).
|
|
186
|
+
* Returns { repo, buffer, entry } | null (not a repo); throws VersionNotFound.
|
|
187
|
+
*/
|
|
188
|
+
export async function fileVersion(rootAbs, rel, ref) {
|
|
189
|
+
const repo = await findRepo(rootAbs);
|
|
190
|
+
if (!repo) return null;
|
|
191
|
+
const repoRel = repoRelative(repo, rel);
|
|
192
|
+
|
|
193
|
+
let entry = null;
|
|
194
|
+
try {
|
|
195
|
+
const history = await fileHistory(rootAbs, rel);
|
|
196
|
+
entry = history?.commits.find((c) => c.sha === ref || c.sha.startsWith(ref)) || null;
|
|
197
|
+
} catch {
|
|
198
|
+
/* fall through to the direct lookup below */
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const attempts = [];
|
|
202
|
+
if (entry) {
|
|
203
|
+
attempts.push([entry.status === 'D' ? `${entry.sha}^` : entry.sha, entry.path]);
|
|
204
|
+
}
|
|
205
|
+
attempts.push([ref, repoRel]); // refs outside the walked history, or walk failures
|
|
206
|
+
|
|
207
|
+
for (const [showRef, showPath] of attempts) {
|
|
208
|
+
try {
|
|
209
|
+
const out = await runGit(repo.repoRoot, ['show', `${showRef}:${showPath}`], { encoding: 'buffer' });
|
|
210
|
+
return { repo, buffer: out == null ? Buffer.alloc(0) : Buffer.from(out), entry };
|
|
211
|
+
} catch {
|
|
212
|
+
/* try the next candidate */
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
throw new VersionNotFound();
|
|
216
|
+
}
|
package/src/openBrowser.js
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
|
|
3
|
+
function commandFor(target) {
|
|
4
|
+
if (process.platform === 'darwin') return { cmd: 'open', args: [target] };
|
|
5
|
+
if (process.platform === 'win32') return { cmd: 'cmd', args: ['/c', 'start', '', target] };
|
|
6
|
+
return { cmd: 'xdg-open', args: [target] };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Open a URL or file with the system default handler.
|
|
11
|
+
* Resolves false when the platform opener is missing (e.g. headless Linux
|
|
12
|
+
* without xdg-open) or cannot be spawned.
|
|
13
|
+
*/
|
|
14
|
+
export function openExternal(target) {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
const { cmd, args } = commandFor(target);
|
|
17
|
+
try {
|
|
18
|
+
const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
|
|
19
|
+
// 'spawn' fires once the process launches; a missing binary surfaces
|
|
20
|
+
// as an 'error' event instead. Exactly one of the two settles this.
|
|
21
|
+
child.on('spawn', () => resolve(true));
|
|
22
|
+
child.on('error', () => resolve(false));
|
|
23
|
+
child.unref();
|
|
24
|
+
} catch {
|
|
25
|
+
resolve(false);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
3
30
|
export function openBrowser(url) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (process.platform === 'darwin') {
|
|
7
|
-
cmd = 'open';
|
|
8
|
-
args = [url];
|
|
9
|
-
} else if (process.platform === 'win32') {
|
|
10
|
-
cmd = 'cmd';
|
|
11
|
-
args = ['/c', 'start', '', url];
|
|
12
|
-
} else {
|
|
13
|
-
cmd = 'xdg-open';
|
|
14
|
-
args = [url];
|
|
15
|
-
}
|
|
16
|
-
try {
|
|
17
|
-
const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
|
|
18
|
-
child.unref();
|
|
19
|
-
} catch {
|
|
20
|
-
/* opening the browser is best-effort; the URL is printed regardless */
|
|
21
|
-
}
|
|
31
|
+
// Opening the browser is best-effort; the URL is printed regardless.
|
|
32
|
+
openExternal(url);
|
|
22
33
|
}
|
package/src/scanner.js
CHANGED
|
@@ -3,12 +3,12 @@ import path from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
export const TEXT_EXTENSIONS = ['.md', '.txt'];
|
|
5
5
|
export const IMAGE_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.webp', '.gif', '.avif', '.svg'];
|
|
6
|
-
export const
|
|
7
|
-
export const MAX_IMAGE_SIZE = 50 * 1024 * 1024;
|
|
6
|
+
export const PDF_EXTENSIONS = ['.pdf'];
|
|
8
7
|
|
|
9
8
|
const KIND_BY_EXT = new Map([
|
|
10
9
|
...TEXT_EXTENSIONS.map((ext) => [ext, ext === '.txt' ? 'txt' : 'md']),
|
|
11
10
|
...IMAGE_EXTENSIONS.map((ext) => [ext, 'img']),
|
|
11
|
+
...PDF_EXTENSIONS.map((ext) => [ext, 'pdf']),
|
|
12
12
|
]);
|
|
13
13
|
|
|
14
14
|
// Always ignored regardless of .gitignore. Dependency/build/cache directories
|
|
@@ -129,9 +129,7 @@ function countFiles(nodes) {
|
|
|
129
129
|
* { type, name, path, count?, size?, mtime?, children? }
|
|
130
130
|
* `path` is a repo-relative POSIX path ('' for the root).
|
|
131
131
|
*/
|
|
132
|
-
export function scanTree(rootDir
|
|
133
|
-
const maxTextSize = opts.maxTextSize ?? MAX_TEXT_SIZE;
|
|
134
|
-
const maxImageSize = opts.maxImageSize ?? MAX_IMAGE_SIZE;
|
|
132
|
+
export function scanTree(rootDir) {
|
|
135
133
|
const rootAbs = path.resolve(rootDir);
|
|
136
134
|
const rootName = path.basename(rootAbs) || rootAbs;
|
|
137
135
|
const stack = [];
|
|
@@ -179,7 +177,6 @@ export function scanTree(rootDir, opts = {}) {
|
|
|
179
177
|
} catch {
|
|
180
178
|
continue;
|
|
181
179
|
}
|
|
182
|
-
if (st.size > (kind === 'img' ? maxImageSize : maxTextSize)) continue;
|
|
183
180
|
fileNodes.push({ type: 'file', name: entry.name, path: rel, kind, size: st.size, mtime: st.mtimeMs });
|
|
184
181
|
}
|
|
185
182
|
}
|
package/src/server.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import { createReadStream, existsSync, readFileSync, statSync, watch } from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { scanTree, fileKind,
|
|
4
|
+
import { scanTree, fileKind, DEFAULT_IGNORED_DIRS } from './scanner.js';
|
|
5
|
+
import { openExternal } from './openBrowser.js';
|
|
6
|
+
import { repoStatus, lastCommitFor, fileHistory, fileVersion, VersionNotFound } from './git.js';
|
|
5
7
|
|
|
6
8
|
const MIME = {
|
|
7
9
|
'.md': 'text/markdown; charset=utf-8',
|
|
@@ -81,7 +83,7 @@ const NOT_BUILT_PAGE = `<!doctype html>
|
|
|
81
83
|
*
|
|
82
84
|
* Returns { server, port, url, root, tree(), close() }.
|
|
83
85
|
*/
|
|
84
|
-
export async function startServer({ root, port = 9345, distDir, autoIncrementLimit = 100 }) {
|
|
86
|
+
export async function startServer({ root, port = 9345, distDir, autoIncrementLimit = 100, openFile = openExternal }) {
|
|
85
87
|
const rootAbs = path.resolve(root);
|
|
86
88
|
let cachedTree = scanTree(rootAbs);
|
|
87
89
|
let lastTreeJson = JSON.stringify(cachedTree);
|
|
@@ -206,10 +208,6 @@ export async function startServer({ root, port = 9345, distDir, autoIncrementLim
|
|
|
206
208
|
sendJson(res, 400, { error: 'not a file' });
|
|
207
209
|
return;
|
|
208
210
|
}
|
|
209
|
-
if (st.size > MAX_TEXT_SIZE) {
|
|
210
|
-
sendJson(res, 413, { error: 'file is larger than 2MB and is not shown' });
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
211
|
const content = readFileSync(abs, 'utf8');
|
|
214
212
|
sendJson(res, 200, {
|
|
215
213
|
path: rel.replace(/\\/g, '/'),
|
|
@@ -223,6 +221,140 @@ export async function startServer({ root, port = 9345, distDir, autoIncrementLim
|
|
|
223
221
|
return;
|
|
224
222
|
}
|
|
225
223
|
|
|
224
|
+
if (pathname === '/api/repo') {
|
|
225
|
+
sendJson(res, 200, await repoStatus(rootAbs));
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (pathname === '/api/meta') {
|
|
230
|
+
const rel = url.searchParams.get('p');
|
|
231
|
+
const abs = safeResolve(rel);
|
|
232
|
+
if (!abs) {
|
|
233
|
+
sendJson(res, 403, { error: 'path outside root' });
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
let st;
|
|
237
|
+
try {
|
|
238
|
+
st = statSync(abs);
|
|
239
|
+
} catch {
|
|
240
|
+
sendJson(res, 404, { error: 'not found' });
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (!st.isFile()) {
|
|
244
|
+
sendJson(res, 400, { error: 'not a file' });
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const cleanRel = rel.replace(/\\/g, '/');
|
|
248
|
+
const name = path.basename(abs);
|
|
249
|
+
const kind = fileKind(name);
|
|
250
|
+
let words = null;
|
|
251
|
+
let chars = null;
|
|
252
|
+
if (kind === 'md' || kind === 'txt') {
|
|
253
|
+
try {
|
|
254
|
+
const content = readFileSync(abs, 'utf8');
|
|
255
|
+
words = (content.match(/\S+/g) || []).length;
|
|
256
|
+
chars = content.length;
|
|
257
|
+
} catch {
|
|
258
|
+
/* unreadable right now — reading stats stay null */
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const lastCommit = await lastCommitFor(rootAbs, cleanRel);
|
|
262
|
+
sendJson(res, 200, {
|
|
263
|
+
path: cleanRel,
|
|
264
|
+
name,
|
|
265
|
+
ext: path.extname(abs).toLowerCase(),
|
|
266
|
+
kind,
|
|
267
|
+
size: st.size,
|
|
268
|
+
mtime: st.mtimeMs,
|
|
269
|
+
words,
|
|
270
|
+
chars,
|
|
271
|
+
lastCommit,
|
|
272
|
+
});
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (pathname === '/api/history') {
|
|
277
|
+
const rel = url.searchParams.get('p');
|
|
278
|
+
const abs = safeResolve(rel);
|
|
279
|
+
if (!abs) {
|
|
280
|
+
sendJson(res, 403, { error: 'path outside root' });
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
let history;
|
|
284
|
+
try {
|
|
285
|
+
history = await fileHistory(rootAbs, rel.replace(/\\/g, '/'));
|
|
286
|
+
} catch {
|
|
287
|
+
sendJson(res, 500, { error: 'git failed' });
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (!history) {
|
|
291
|
+
sendJson(res, 200, { git: false, commits: [], truncated: false });
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
sendJson(res, 200, { git: true, commits: history.commits, truncated: history.truncated });
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (pathname === '/api/version') {
|
|
299
|
+
const rel = url.searchParams.get('p');
|
|
300
|
+
const abs = safeResolve(rel);
|
|
301
|
+
if (!abs) {
|
|
302
|
+
sendJson(res, 403, { error: 'path outside root' });
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const ref = url.searchParams.get('ref');
|
|
306
|
+
if (!ref || !/^[0-9a-f]{7,40}$/i.test(ref)) {
|
|
307
|
+
sendJson(res, 400, { error: 'bad ref' });
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
let version;
|
|
311
|
+
try {
|
|
312
|
+
version = await fileVersion(rootAbs, rel.replace(/\\/g, '/'), ref);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
if (err instanceof VersionNotFound) {
|
|
315
|
+
sendJson(res, 404, { error: 'version not found' });
|
|
316
|
+
} else {
|
|
317
|
+
sendJson(res, 500, { error: 'git failed' });
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (!version) {
|
|
322
|
+
sendJson(res, 404, { error: 'not a git repository' });
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const name = path.basename(abs);
|
|
326
|
+
const kind = fileKind(name);
|
|
327
|
+
if (url.searchParams.get('raw') === '1') {
|
|
328
|
+
const type = mimeType(abs);
|
|
329
|
+
res.writeHead(200, {
|
|
330
|
+
'Content-Type': type,
|
|
331
|
+
'Content-Length': version.buffer.length,
|
|
332
|
+
'Cache-Control': 'no-store',
|
|
333
|
+
'X-Content-Type-Options': 'nosniff',
|
|
334
|
+
...(type === 'application/pdf' ? {} : { 'Content-Security-Policy': 'sandbox' }),
|
|
335
|
+
});
|
|
336
|
+
res.end(version.buffer);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const isText = kind === 'md' || kind === 'txt';
|
|
340
|
+
const entry = version.entry;
|
|
341
|
+
sendJson(res, 200, {
|
|
342
|
+
path: rel.replace(/\\/g, '/'),
|
|
343
|
+
name,
|
|
344
|
+
ext: path.extname(abs).toLowerCase(),
|
|
345
|
+
kind,
|
|
346
|
+
size: version.buffer.length,
|
|
347
|
+
binary: !isText,
|
|
348
|
+
content: isText ? version.buffer.toString('utf8') : null,
|
|
349
|
+
ref: entry ? entry.sha : ref,
|
|
350
|
+
author: entry ? entry.author : null,
|
|
351
|
+
date: entry ? entry.date : null,
|
|
352
|
+
subject: entry ? entry.subject : null,
|
|
353
|
+
deleted: entry ? entry.status === 'D' : false,
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
226
358
|
if (pathname === '/api/raw') {
|
|
227
359
|
const abs = safeResolve(url.searchParams.get('p'));
|
|
228
360
|
if (!abs) {
|
|
@@ -240,18 +372,56 @@ export async function startServer({ root, port = 9345, distDir, autoIncrementLim
|
|
|
240
372
|
sendJson(res, 404, { error: 'not found' });
|
|
241
373
|
return;
|
|
242
374
|
}
|
|
375
|
+
const type = mimeType(abs);
|
|
243
376
|
res.writeHead(200, {
|
|
244
|
-
'Content-Type':
|
|
377
|
+
'Content-Type': type,
|
|
245
378
|
'Content-Length': st.size,
|
|
246
379
|
'Cache-Control': 'no-store',
|
|
247
380
|
'X-Content-Type-Options': 'nosniff',
|
|
248
|
-
// Repo files are data, not trusted same-origin documents.
|
|
249
|
-
|
|
381
|
+
// Repo files are data, not trusted same-origin documents. PDFs are
|
|
382
|
+
// exempt: some browsers refuse to run their built-in PDF viewer on
|
|
383
|
+
// a response delivered under CSP sandbox.
|
|
384
|
+
...(type === 'application/pdf' ? {} : { 'Content-Security-Policy': 'sandbox' }),
|
|
250
385
|
});
|
|
251
386
|
createReadStream(abs).pipe(res);
|
|
252
387
|
return;
|
|
253
388
|
}
|
|
254
389
|
|
|
390
|
+
if (pathname === '/api/open') {
|
|
391
|
+
if (req.method !== 'POST') {
|
|
392
|
+
sendJson(res, 405, { error: 'method not allowed' });
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const rel = url.searchParams.get('p');
|
|
396
|
+
const abs = safeResolve(rel);
|
|
397
|
+
if (!abs) {
|
|
398
|
+
sendJson(res, 403, { error: 'path outside root' });
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const kind = fileKind(path.basename(abs));
|
|
402
|
+
if (kind !== 'pdf') {
|
|
403
|
+
sendJson(res, 400, { error: 'only PDF files can be opened in a system app' });
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
let st;
|
|
407
|
+
try {
|
|
408
|
+
st = statSync(abs);
|
|
409
|
+
} catch {
|
|
410
|
+
sendJson(res, 404, { error: 'not found' });
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
if (!st.isFile()) {
|
|
414
|
+
sendJson(res, 404, { error: 'not found' });
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
if (!(await openFile(abs))) {
|
|
418
|
+
sendJson(res, 500, { error: 'could not open the file with the system default app' });
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
sendJson(res, 200, { ok: true });
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
|
|
255
425
|
if (pathname === '/api/events') {
|
|
256
426
|
res.writeHead(200, {
|
|
257
427
|
'Content-Type': 'text/event-stream',
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-content:""}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-sky-300:oklch(82.8% .111 230.318);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-sky-700:oklch(50% .134 242.749);--color-neutral-50:oklch(98.5% 0 none);--color-neutral-100:oklch(97% 0 none);--color-neutral-200:oklch(92.2% 0 none);--color-neutral-300:oklch(87% 0 none);--color-neutral-400:oklch(70.8% 0 none);--color-neutral-500:oklch(55.6% 0 none);--color-neutral-600:oklch(43.9% 0 none);--color-neutral-700:oklch(37.1% 0 none);--color-neutral-800:oklch(26.9% 0 none);--color-neutral-900:oklch(20.5% 0 none);--color-neutral-950:oklch(14.5% 0 none);--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-3xl:48rem;--container-4xl:56rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--tracking-tight:-.025em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.relative{position:relative}.mx-auto{margin-inline:auto}.my-5{margin-block:calc(var(--spacing) * 5)}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);margin-top:1.2em;margin-bottom:1.2em;font-size:1.25em;line-height:1.6}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);font-weight:500;text-decoration:underline}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:decimal}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em;list-style-type:disc}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-counters);font-weight:400}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.25em;font-weight:600}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em;font-style:italic;font-weight:500}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:0;margin-bottom:.888889em;font-size:2.25em;font-weight:800;line-height:1.11111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:900}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:2em;margin-bottom:1em;font-size:1.5em;font-weight:700;line-height:1.33333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:800}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.6em;margin-bottom:.6em;font-size:1.25em;font-weight:600;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);margin-top:1.5em;margin-bottom:.5em;font-weight:600;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-weight:700}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em;display:block}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-kbd);box-shadow:0 0 0 1px var(--tw-prose-kbd-shadows), 0 3px 0 var(--tw-prose-kbd-shadows);padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;border-radius:.3125rem;padding-inline-start:.375em;font-family:inherit;font-size:.875em;font-weight:500}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-size:.875em;font-weight:600}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);padding-top:.857143em;padding-inline-end:1.14286em;padding-bottom:.857143em;border-radius:.375rem;margin-top:1.71429em;margin-bottom:1.71429em;padding-inline-start:1.14286em;font-size:.875em;font-weight:400;line-height:1.71429;overflow-x:auto}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit;background-color:#0000;border-width:0;border-radius:0;padding:0}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){table-layout:auto;width:100%;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.71429}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);vertical-align:bottom;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em;font-weight:600}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);margin-top:.857143em;font-size:.875em;line-height:1.42857}.prose{--tw-prose-body:oklch(37.3% .034 259.733);--tw-prose-headings:oklch(21% .034 264.665);--tw-prose-lead:oklch(44.6% .03 256.802);--tw-prose-links:oklch(21% .034 264.665);--tw-prose-bold:oklch(21% .034 264.665);--tw-prose-counters:oklch(55.1% .027 264.364);--tw-prose-bullets:oklch(87.2% .01 258.338);--tw-prose-hr:oklch(92.8% .006 264.531);--tw-prose-quotes:oklch(21% .034 264.665);--tw-prose-quote-borders:oklch(92.8% .006 264.531);--tw-prose-captions:oklch(55.1% .027 264.364);--tw-prose-kbd:oklch(21% .034 264.665);--tw-prose-kbd-shadows:oklab(21% -.00316127 -.0338527/.1);--tw-prose-code:oklch(21% .034 264.665);--tw-prose-pre-code:oklch(92.8% .006 264.531);--tw-prose-pre-bg:oklch(27.8% .033 256.848);--tw-prose-th-borders:oklch(87.2% .01 258.338);--tw-prose-td-borders:oklch(92.8% .006 264.531);--tw-prose-invert-body:oklch(87.2% .01 258.338);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.7% .022 261.325);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.7% .022 261.325);--tw-prose-invert-bullets:oklch(44.6% .03 256.802);--tw-prose-invert-hr:oklch(37.3% .034 259.733);--tw-prose-invert-quotes:oklch(96.7% .003 264.542);--tw-prose-invert-quote-borders:oklch(37.3% .034 259.733);--tw-prose-invert-captions:oklch(70.7% .022 261.325);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:#ffffff1a;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87.2% .01 258.338);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(44.6% .03 256.802);--tw-prose-invert-td-borders:oklch(37.3% .034 259.733);font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)),.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.571429em;padding-inline-end:.571429em;padding-bottom:.571429em;padding-inline-start:.571429em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.mt-1{margin-top:var(--spacing)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.inline-block{display:inline-block}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-full{height:100%}.h-screen{height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-40{width:calc(var(--spacing) * 40)}.w-72{width:calc(var(--spacing) * 72)}.w-full{width:100%}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.min-w-0{min-width:0}.flex-1{flex:1}.shrink-0{flex-shrink:0}.rotate-90{rotate:90deg}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-neutral-200{border-color:var(--color-neutral-200)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-sky-500\/60{border-color:#00a5ef99}@supports (color:color-mix(in lab, red, red)){.border-sky-500\/60{border-color:color-mix(in oklab, var(--color-sky-500) 60%, transparent)}}.border-t-sky-500{border-top-color:var(--color-sky-500)}.bg-neutral-50\/60{background-color:#fafafa99}@supports (color:color-mix(in lab, red, red)){.bg-neutral-50\/60{background-color:color-mix(in oklab, var(--color-neutral-50) 60%, transparent)}}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-200\/80{background-color:#e5e5e5cc}@supports (color:color-mix(in lab, red, red)){.bg-neutral-200\/80{background-color:color-mix(in oklab, var(--color-neutral-200) 80%, transparent)}}.bg-sky-500\/15{background-color:#00a5ef26}@supports (color:color-mix(in lab, red, red)){.bg-sky-500\/15{background-color:color-mix(in oklab, var(--color-sky-500) 15%, transparent)}}.bg-white{background-color:var(--color-white)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pr-2{padding-right:calc(var(--spacing) * 2)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[13px\]{font-size:13px}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.break-words{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-neutral-400{color:var(--color-neutral-400)}.text-neutral-500{color:var(--color-neutral-500)}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-neutral-900{color:var(--color-neutral-900)}.text-sky-500{color:var(--color-sky-500)}.text-sky-500\/80{color:#00a5efcc}@supports (color:color-mix(in lab, red, red)){.text-sky-500\/80{color:color-mix(in oklab, var(--color-sky-500) 80%, transparent)}}.text-sky-700{color:var(--color-sky-700)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-70{opacity:.7}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.prose-neutral{--tw-prose-body:oklch(37.1% 0 none);--tw-prose-headings:oklch(20.5% 0 none);--tw-prose-lead:oklch(43.9% 0 none);--tw-prose-links:oklch(20.5% 0 none);--tw-prose-bold:oklch(20.5% 0 none);--tw-prose-counters:oklch(55.6% 0 none);--tw-prose-bullets:oklch(87% 0 none);--tw-prose-hr:oklch(92.2% 0 none);--tw-prose-quotes:oklch(20.5% 0 none);--tw-prose-quote-borders:oklch(92.2% 0 none);--tw-prose-captions:oklch(55.6% 0 none);--tw-prose-kbd:oklch(20.5% 0 none);--tw-prose-kbd-shadows:oklab(20.5% 0 0/.1);--tw-prose-code:oklch(20.5% 0 none);--tw-prose-pre-code:oklch(92.2% 0 none);--tw-prose-pre-bg:oklch(26.9% 0 none);--tw-prose-th-borders:oklch(87% 0 none);--tw-prose-td-borders:oklch(92.2% 0 none);--tw-prose-invert-body:oklch(87% 0 none);--tw-prose-invert-headings:#fff;--tw-prose-invert-lead:oklch(70.8% 0 none);--tw-prose-invert-links:#fff;--tw-prose-invert-bold:#fff;--tw-prose-invert-counters:oklch(70.8% 0 none);--tw-prose-invert-bullets:oklch(43.9% 0 none);--tw-prose-invert-hr:oklch(37.1% 0 none);--tw-prose-invert-quotes:oklch(97% 0 none);--tw-prose-invert-quote-borders:oklch(37.1% 0 none);--tw-prose-invert-captions:oklch(70.8% 0 none);--tw-prose-invert-kbd:#fff;--tw-prose-invert-kbd-shadows:#ffffff1a;--tw-prose-invert-code:#fff;--tw-prose-invert-pre-code:oklch(87% 0 none);--tw-prose-invert-pre-bg:#00000080;--tw-prose-invert-th-borders:oklch(43.9% 0 none);--tw-prose-invert-td-borders:oklch(37.1% 0 none)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\:text-neutral-400::placeholder{color:var(--color-neutral-400)}@media (hover:hover){.hover\:border-neutral-300:hover{border-color:var(--color-neutral-300)}.hover\:bg-neutral-200\/60:hover{background-color:#e5e5e599}@supports (color:color-mix(in lab, red, red)){.hover\:bg-neutral-200\/60:hover{background-color:color-mix(in oklab, var(--color-neutral-200) 60%, transparent)}}.hover\:text-neutral-700:hover{color:var(--color-neutral-700)}}.focus\:border-sky-400:focus{border-color:var(--color-sky-400)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-sky-500\/30:focus{--tw-ring-color:#00a5ef4d}@supports (color:color-mix(in lab, red, red)){.focus\:ring-sky-500\/30:focus{--tw-ring-color:color-mix(in oklab, var(--color-sky-500) 30%, transparent)}}@media (width>=40rem){.sm\:w-80{width:calc(var(--spacing) * 80)}.sm\:px-10{padding-inline:calc(var(--spacing) * 10)}}@media (prefers-color-scheme:dark){.dark\:border-neutral-700{border-color:var(--color-neutral-700)}.dark\:border-neutral-800{border-color:var(--color-neutral-800)}.dark\:bg-neutral-800{background-color:var(--color-neutral-800)}.dark\:bg-neutral-900{background-color:var(--color-neutral-900)}.dark\:bg-neutral-900\/30{background-color:#1717174d}@supports (color:color-mix(in lab, red, red)){.dark\:bg-neutral-900\/30{background-color:color-mix(in oklab, var(--color-neutral-900) 30%, transparent)}}.dark\:bg-neutral-950{background-color:var(--color-neutral-950)}.dark\:bg-sky-400\/20{background-color:#00bcfe33}@supports (color:color-mix(in lab, red, red)){.dark\:bg-sky-400\/20{background-color:color-mix(in oklab, var(--color-sky-400) 20%, transparent)}}.dark\:text-neutral-100{color:var(--color-neutral-100)}.dark\:text-neutral-300{color:var(--color-neutral-300)}.dark\:text-neutral-400{color:var(--color-neutral-400)}.dark\:text-sky-300{color:var(--color-sky-300)}.dark\:text-sky-400\/60{color:#00bcfe99}@supports (color:color-mix(in lab, red, red)){.dark\:text-sky-400\/60{color:color-mix(in oklab, var(--color-sky-400) 60%, transparent)}}.dark\:prose-invert{--tw-prose-body:var(--tw-prose-invert-body);--tw-prose-headings:var(--tw-prose-invert-headings);--tw-prose-lead:var(--tw-prose-invert-lead);--tw-prose-links:var(--tw-prose-invert-links);--tw-prose-bold:var(--tw-prose-invert-bold);--tw-prose-counters:var(--tw-prose-invert-counters);--tw-prose-bullets:var(--tw-prose-invert-bullets);--tw-prose-hr:var(--tw-prose-invert-hr);--tw-prose-quotes:var(--tw-prose-invert-quotes);--tw-prose-quote-borders:var(--tw-prose-invert-quote-borders);--tw-prose-captions:var(--tw-prose-invert-captions);--tw-prose-kbd:var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows:var(--tw-prose-invert-kbd-shadows);--tw-prose-code:var(--tw-prose-invert-code);--tw-prose-pre-code:var(--tw-prose-invert-pre-code);--tw-prose-pre-bg:var(--tw-prose-invert-pre-bg);--tw-prose-th-borders:var(--tw-prose-invert-th-borders);--tw-prose-td-borders:var(--tw-prose-invert-td-borders)}@media (hover:hover){.dark\:hover\:border-neutral-600:hover{border-color:var(--color-neutral-600)}.dark\:hover\:bg-neutral-800\/60:hover{background-color:#26262699}@supports (color:color-mix(in lab, red, red)){.dark\:hover\:bg-neutral-800\/60:hover{background-color:color-mix(in oklab, var(--color-neutral-800) 60%, transparent)}}.dark\:hover\:text-neutral-200:hover{color:var(--color-neutral-200)}}}.prose-headings\:tracking-tight :where(h1,h2,h3,h4,h5,h6,th):not(:where([class~=not-prose],[class~=not-prose] *)){--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.prose-code\:before\:content-none :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before,.prose-code\:after\:content-none :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:var(--tw-content);--tw-content:none;content:none}.prose-pre\:m-0 :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){margin:0}.prose-pre\:bg-transparent :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:#0000}.prose-pre\:p-0 :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){padding:0}}*{scrollbar-width:thin;scrollbar-color:#00000040 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-thumb{background:#0003;border-radius:9999px}@media (prefers-color-scheme:dark){*{scrollbar-color:#ffffff26 transparent}::-webkit-scrollbar-thumb{background:#ffffff26}}pre.shiki{border-radius:.5rem;margin:0;padding:.85rem 1rem;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.8125rem;line-height:1.65;overflow-x:auto}pre.shiki code{width:fit-content;display:block}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}
|