@makuja/peek 1.11.0 → 1.12.1
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 -1
- package/dist/index.mjs +549 -177
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
2
|
import { execFile } from "node:child_process";
|
|
4
3
|
import { access, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
4
|
+
import { createRequire } from "node:module";
|
|
5
5
|
import { homedir, platform } from "node:os";
|
|
6
6
|
import { basename, dirname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
|
|
7
7
|
import { cancel, intro, log, outro, spinner } from "@clack/prompts";
|
|
@@ -17,11 +17,13 @@ import ignore from "ignore";
|
|
|
17
17
|
import { constants, watch } from "node:fs";
|
|
18
18
|
import renderToString from "preact-render-to-string";
|
|
19
19
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
20
|
+
import { Fragment as Fragment$1 } from "preact";
|
|
21
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
20
22
|
import { createHash } from "node:crypto";
|
|
21
23
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
22
24
|
import { streamSSE } from "hono/streaming";
|
|
23
|
-
|
|
24
|
-
const EXTENSION_MAP = new Map([
|
|
25
|
+
// src/core/content-type.ts
|
|
26
|
+
const EXTENSION_MAP = /* @__PURE__ */ new Map([
|
|
25
27
|
[".md", "markdown"],
|
|
26
28
|
[".html", "html"],
|
|
27
29
|
[".htm", "html"]
|
|
@@ -39,16 +41,14 @@ function getContentType(filePath) {
|
|
|
39
41
|
function isSupportedFile(filePath) {
|
|
40
42
|
return getContentType(filePath) !== null;
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
//#region src/lib/logger.ts
|
|
44
|
+
// src/lib/logger.ts
|
|
44
45
|
const PREFIX = "[peek]";
|
|
45
46
|
const logger = {
|
|
46
47
|
info: (...args) => console.log(PREFIX, ...args),
|
|
47
48
|
warn: (...args) => console.warn(PREFIX, ...args),
|
|
48
49
|
error: (...args) => console.error(PREFIX, ...args)
|
|
49
50
|
};
|
|
50
|
-
|
|
51
|
-
//#region src/core/url.ts
|
|
51
|
+
// src/core/url.ts
|
|
52
52
|
/**
|
|
53
53
|
* Prefix of the route that serves files under the base directory as-is.
|
|
54
54
|
* `__peek` keeps it from colliding with the user's own paths, which
|
|
@@ -80,8 +80,20 @@ function resolveMarkdownImageSrc(src, markdownPath) {
|
|
|
80
80
|
const url = new URL(src, base);
|
|
81
81
|
return `${url.pathname}${url.search}${url.hash}`;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
/** Route of the page that holds only the content to print as a PDF. */
|
|
84
|
+
const PRINT_PAGE_PATH = "/__peek/print";
|
|
85
|
+
/** Print page of one Markdown file (relative to the base directory). */
|
|
86
|
+
function printFileUrl(relativePath) {
|
|
87
|
+
return `${PRINT_PAGE_PATH}?file=${encodeURIComponent(relativePath)}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Print page of the Markdown files under a directory (relative to the base
|
|
91
|
+
* directory); `null` is the base directory itself.
|
|
92
|
+
*/
|
|
93
|
+
function printDirectoryUrl(relativePath) {
|
|
94
|
+
return `${PRINT_PAGE_PATH}?dir=${encodeURIComponent(relativePath ?? "")}`;
|
|
95
|
+
}
|
|
96
|
+
// src/lib/markdown.ts
|
|
85
97
|
let md = null;
|
|
86
98
|
let initPromise = null;
|
|
87
99
|
function withResolvedImageSrc(defaultRule) {
|
|
@@ -124,12 +136,11 @@ async function renderMarkdown(content, markdownPath) {
|
|
|
124
136
|
const env = { markdownPath };
|
|
125
137
|
return md.renderAsync(content, env);
|
|
126
138
|
}
|
|
127
|
-
|
|
128
|
-
//#region src/lib/node-error.ts
|
|
139
|
+
// src/lib/node-error.ts
|
|
129
140
|
function isNodeError(e) {
|
|
130
141
|
return e instanceof Error && "code" in e && typeof e.code === "string" && typeof e.message === "string";
|
|
131
142
|
}
|
|
132
|
-
const NOT_FOUND_CODES = new Set([
|
|
143
|
+
const NOT_FOUND_CODES = /* @__PURE__ */ new Set([
|
|
133
144
|
"ENOENT",
|
|
134
145
|
"ENOTDIR",
|
|
135
146
|
"EISDIR"
|
|
@@ -141,8 +152,7 @@ const NOT_FOUND_CODES = new Set([
|
|
|
141
152
|
function isNotFoundError(e) {
|
|
142
153
|
return isNodeError(e) && e.code !== void 0 && NOT_FOUND_CODES.has(e.code);
|
|
143
154
|
}
|
|
144
|
-
|
|
145
|
-
//#region src/core/result.ts
|
|
155
|
+
// src/core/result.ts
|
|
146
156
|
function ok(value) {
|
|
147
157
|
return {
|
|
148
158
|
ok: true,
|
|
@@ -165,11 +175,9 @@ async function safe(fn, onError) {
|
|
|
165
175
|
return err(onError(e));
|
|
166
176
|
}
|
|
167
177
|
}
|
|
168
|
-
|
|
169
|
-
//#region src/styles/content.css?inline
|
|
178
|
+
// src/styles/content.css?inline
|
|
170
179
|
var content_default = ".markdown-body {\n color: var(--foreground);\n word-wrap: break-word;\n font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica, Arial, sans-serif;\n font-size: 16px;\n line-height: 1.75;\n\n & h1, & h2, & h3, & h4, & h5, & h6 {\n margin-top: 24px;\n margin-bottom: 16px;\n font-weight: 600;\n line-height: 1.5;\n }\n\n & h1 {\n font-size: 2em;\n }\n\n & h2 {\n border-bottom: 1px solid var(--border);\n padding-bottom: .3em;\n font-size: 1.5em;\n }\n\n & h3 {\n font-size: 1.25em;\n }\n\n & h4 {\n font-size: 1em;\n }\n\n & h5 {\n font-size: .875em;\n }\n\n & h6 {\n color: var(--muted-foreground);\n font-size: .85em;\n }\n\n & p {\n margin-top: 0;\n margin-bottom: 16px;\n }\n\n & a {\n color: var(--primary);\n text-decoration: none;\n\n &:hover {\n text-decoration: underline;\n }\n }\n\n & strong {\n font-weight: 600;\n }\n\n & ul, & ol {\n list-style: revert;\n margin-top: 0;\n margin-bottom: 16px;\n padding-left: 1.5em;\n }\n\n & li + li {\n margin-top: .25em;\n }\n\n & .task-list-container {\n list-style: none;\n }\n\n & blockquote {\n color: var(--muted-foreground);\n border-left: .25em solid var(--border);\n margin: 0 0 16px;\n padding: 0 1em;\n }\n\n & code {\n white-space: break-spaces;\n background-color: var(--muted);\n border-radius: 6px;\n margin: 0;\n padding: .2em .4em;\n font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;\n font-size: 85%;\n }\n\n & pre {\n color: var(--shiki-light);\n background-color: var(--muted);\n border-radius: 6px;\n margin-top: 0;\n margin-bottom: 16px;\n padding: 16px;\n font-size: 85%;\n line-height: 1.45;\n overflow: auto;\n\n & code {\n white-space: pre;\n background: none;\n border: 0;\n margin: 0;\n padding: 0;\n font-size: 100%;\n }\n }\n\n & pre.shiki {\n font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;\n }\n\n & .shiki, & .shiki span {\n color: var(--shiki-light);\n background-color: var(--muted);\n }\n\n & table {\n border-spacing: 0;\n border-collapse: collapse;\n width: max-content;\n max-width: 100%;\n margin-top: 0;\n margin-bottom: 16px;\n display: block;\n overflow: auto;\n\n & th {\n font-weight: 600;\n }\n\n & th, & td {\n border: 1px solid var(--border);\n padding: 6px 13px;\n }\n\n & tr {\n background-color: var(--card);\n border-top: 1px solid var(--border);\n }\n }\n\n & hr {\n background-color: var(--border);\n border: 0;\n height: .25em;\n margin: 24px 0;\n padding: 0;\n }\n\n & img {\n box-sizing: border-box;\n max-width: 100%;\n }\n\n & input[type=\"checkbox\"] {\n vertical-align: middle;\n margin: 0 .2em .25em -1.4em;\n }\n\n & del {\n text-decoration: line-through;\n }\n\n & > :first-child {\n margin-top: 0;\n }\n\n & > :last-child {\n margin-bottom: 0;\n }\n}\n\n.dark .markdown-body {\n & .shiki, & .shiki span {\n color: var(--shiki-dark);\n background-color: var(--muted);\n }\n}\n";
|
|
171
|
-
|
|
172
|
-
//#region src/core/error.ts
|
|
180
|
+
// src/core/error.ts
|
|
173
181
|
function toError(value) {
|
|
174
182
|
if (value instanceof Error) return value;
|
|
175
183
|
if (typeof value === "string") return new Error(value);
|
|
@@ -182,13 +190,11 @@ function typedError(type, cause, props) {
|
|
|
182
190
|
cause: toError(cause)
|
|
183
191
|
};
|
|
184
192
|
}
|
|
185
|
-
|
|
186
|
-
//#region src/lib/read-text-file.ts
|
|
193
|
+
// src/lib/read-text-file.ts
|
|
187
194
|
function readTextFile(path) {
|
|
188
195
|
return safe(() => readFile(path, "utf-8"), (e) => isNodeError(e) && e.code === "ENOENT" ? typedError("file-not-found", e, { path }) : typedError("read-error", e, { path }));
|
|
189
196
|
}
|
|
190
|
-
|
|
191
|
-
//#region src/lib/styles.ts
|
|
197
|
+
// src/lib/styles.ts
|
|
192
198
|
function getXdgConfigPath() {
|
|
193
199
|
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
|
194
200
|
if (xdgConfigHome) return resolve(xdgConfigHome, "peek", "style.css");
|
|
@@ -201,8 +207,7 @@ async function resolveStyles(cssOption) {
|
|
|
201
207
|
if (xdgResult.error.type === "read-error") return xdgResult;
|
|
202
208
|
return ok({ contentCss: content_default });
|
|
203
209
|
}
|
|
204
|
-
|
|
205
|
-
//#region src/core/path.ts
|
|
210
|
+
// src/core/path.ts
|
|
206
211
|
function isWithinBase(base, target) {
|
|
207
212
|
const resolvedBase = resolve(base);
|
|
208
213
|
const resolvedTarget = resolve(target);
|
|
@@ -224,8 +229,7 @@ function isRelativePathWithinBase(base, relativePath) {
|
|
|
224
229
|
function toSlashPath(osPath) {
|
|
225
230
|
return osPath.split(sep).join("/");
|
|
226
231
|
}
|
|
227
|
-
|
|
228
|
-
//#region src/lib/file-tree.ts
|
|
232
|
+
// src/lib/file-tree.ts
|
|
229
233
|
const DEFAULT_IGNORE_PATTERNS = [".git/"];
|
|
230
234
|
async function readGitignore(path) {
|
|
231
235
|
const result = await readTextFile(path);
|
|
@@ -281,7 +285,7 @@ async function buildFileTree(rootDir) {
|
|
|
281
285
|
} catch (e) {
|
|
282
286
|
return err(typedError("root-not-accessible", e));
|
|
283
287
|
}
|
|
284
|
-
const visited = new Set([rootReal]);
|
|
288
|
+
const visited = /* @__PURE__ */ new Set([rootReal]);
|
|
285
289
|
try {
|
|
286
290
|
return ok(await processEntries(rootEntries, rootDir, rootDir, rules, visited));
|
|
287
291
|
} catch (e) {
|
|
@@ -342,8 +346,7 @@ async function processEntries(entries, dir, rootDir, rules, visited) {
|
|
|
342
346
|
});
|
|
343
347
|
return nodes;
|
|
344
348
|
}
|
|
345
|
-
|
|
346
|
-
//#region src/lib/file-tree-cache.ts
|
|
349
|
+
// src/lib/file-tree-cache.ts
|
|
347
350
|
/**
|
|
348
351
|
* Callers that already hold a reference to the pending promise will still
|
|
349
352
|
* receive its (now-stale) result after `invalidate()` is called. The next
|
|
@@ -372,8 +375,7 @@ function createFileTreeCache(rootDir) {
|
|
|
372
375
|
}
|
|
373
376
|
};
|
|
374
377
|
}
|
|
375
|
-
|
|
376
|
-
//#region src/lib/watcher.ts
|
|
378
|
+
// src/lib/watcher.ts
|
|
377
379
|
function createFileWatcher(debounceMs = 100) {
|
|
378
380
|
const watchers = [];
|
|
379
381
|
const debounceTimers = /* @__PURE__ */ new Map();
|
|
@@ -422,8 +424,7 @@ function createFileWatcher(debounceMs = 100) {
|
|
|
422
424
|
}
|
|
423
425
|
};
|
|
424
426
|
}
|
|
425
|
-
|
|
426
|
-
//#region src/lib/with-timeout.ts
|
|
427
|
+
// src/lib/with-timeout.ts
|
|
427
428
|
/**
|
|
428
429
|
* Waits for `promise` for at most `timeoutMs`.
|
|
429
430
|
*
|
|
@@ -462,11 +463,9 @@ function withTimeout(promise, timeoutMs) {
|
|
|
462
463
|
});
|
|
463
464
|
});
|
|
464
465
|
}
|
|
465
|
-
|
|
466
|
-
//#region src/server/renderer/favicon.js
|
|
466
|
+
// src/server/renderer/favicon.js
|
|
467
467
|
const faviconBase64 = "AAABAAMAMDAAAAEAIACoJQAANgAAACAgAAABACAAqBAAAN4lAAAQEAAAAQAgAGgEAACGNgAAKAAAADAAAABgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////Kv///3H///+r////1/////P/////////////////////////////////////////////////////////////////////////////////////////8////9f///+r////cf///yoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///1n////B///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////B////WQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8+////xP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8T///8+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///3r/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////egAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////mf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////5kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///+Z//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+ZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///3r/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////egAAAAAAAAAAAAAAAAAAAAAAAAAA////Pv///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////z4AAAAAAAAAAAAAAAAAAAAA////xP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8QAAAAAAAAAAAAAAAD///9Z////////////////////////////////////////////////////////////////////////////////+/v7//X19f/9/f3/////////////////////////////////9PT0//r6+v/+/v7///////////////////////////////////////////////////////////////////////////////////////////////9ZAAAAAAAAAAD////B///////////////////////////////////////////////////////////////////////////29vb/nJ+e/19kY/+6vLz////////////////////////////U1dX/YWZl/3yAf//19fX////////////////////////////////////////////////////////////////////////////////////////////////BAAAAAP///yr////////////////////////////////////////////////////////////////////////////////s7e3/U1hY/zY8O/9dYmH///////////////////////////+lp6f/Oj8+/z9EQ//u7u7/////////////////////////////////////////////////////////////////////////////////////////////////////Kv///3H////////////////////////////////////////////////////////////////////////////////w8PD/Wl9f/zQ6Of9HTUz/+vr6//////////////////////+xs7P/Oj8//zU7Ov/g4eD//v7+////////////////////////////////////////////////////////////////////////////////////////////////cf///6v////////////////////////////////////////////////////////////////////////////////z8/P/dnp5/zQ6Of9FSkn/7+/v///////////////////////DxMT/O0FA/zQ6Of/DxcT//Pz8////////////////////////////////////////////////////////////////////////////////////////////////q////9f////////////////////////////////////////////////////////////////////////////////39/f/kZSU/zQ6Of9CSEf/4+Pj///////////////////////U1dX/PEJB/zQ6Of+lp6f/+fn5////////////////////////////////////////////////////////////////////////////////////////////////1/////P////////////////////////////////////////////////////////////////////////////////6+vr/ra+v/zQ6Of9ARkX/19jY///////////////////////l5ub/PUNC/zQ6Of+Hi4r/9/f3////////////////////////////////////////////////////////////////////////////////////////////////8//////////////////////////////////////////////////////////////////////////////////////9/f3/yMrK/zU7Ov8+REP/yszM///////////////////////29vb/P0VE/zQ6Of9pbm7/9PT0/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////v7+//v7+//4+Pj/+Pj4//j4+P/4+Pj/09XU/zc9PP88QkH/srSz//j4+P/4+Pj/+Pj4//j4+P/4+Pj/S1BP/zU7Ov9XXFz/7Ozs//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+/v7//7+/v//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8vLy/7W3tv+doKD/naCg/52goP+doKD/i46O/zg+Pf84Pj3/a29v/52goP+doKD/naCg/52goP+doKD/S1BP/zU7Ov9FSkr/lZiX/52goP+doKD/naCg/52goP+doKD/tLe2//Ly8v//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////nJ+f/z1DQv80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/PUNC/5ygn///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////vsC//0lOTf8/RUT/P0VE/z9FRP8/RUT/PkNC/zg+Pf80Ojn/Njw7/z9FRP8/RUT/P0VE/z9FRP8/RUT/OkA//zU7Ov80Ojn/PEJB/z9FRP8/RUT/P0VE/z9FRP8/RUT/SU5N/77Av////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////f39/+jo6P/d3t3/3d7e/93e3v/d3t7/0dPS/05TUv80Ojn/QUdG/9vc3P/d3t7/3d7e/93e3v/d3t7/oqSk/zpAP/81Ozr/xsfH/9zd3f/d3t7/3d7e/93e3v/d3t3/6Ojo//39/f//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9PT0/21ycf80Ojn/QkdG//Ly8v//////////////////////xsfH/z1DQv80Ojn/ycrK//z9/P//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9vf3/4yPjv80Ojn/QEZF/+Pk4///////////////////////1NXV/z5EQ/80Ojn/qq2s//n5+f//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+fn5/6qtrP80Ojn/PkRD/9TV1f//////////////////////4+Tj/0BGRf80Ojn/jI+O//b39////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////P39/8nKyv80Ojn/PUNC/8bHx///////////////////////8vLy/0JHRv80Ojn/bXJx//T09P///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////f39/+jo6P/d3t3/3d7e/93e3v/d3t7/3N3d/8bHx/81Ozr/OkA//6KkpP/d3t7/3d7e/93e3v/d3t7/29zc/0FHRv80Ojn/TlNS/9HT0v/d3t7/3d7e/93e3v/d3t3/6Ojo//39/f//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////vsC//0lOTf8/RUT/P0VE/z9FRP8/RUT/P0VE/zxCQf80Ojn/NTs6/zpAP/8/RUT/P0VE/z9FRP8/RUT/P0VE/zY8O/80Ojn/OD49/z5DQv8/RUT/P0VE/z9FRP8/RUT/SU5N/77Av///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////nKCf/z1DQv80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/NDo5/zQ6Of80Ojn/PUNC/5yfn///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8vLy/7S3tv+doKD/naCg/52goP+doKD/naCg/5WYl/9FSkr/NTs6/0tQT/+doKD/naCg/52goP+doKD/naCg/2tvb/84Pj3/OD49/4uOjv+doKD/naCg/52goP+doKD/tbe2//Ly8v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////v7+//v7+//4+Pj/+Pj4//j4+P/4+Pj/+Pj4/+zs7P9XXFz/NTs6/0tQT//4+Pj/+Pj4//j4+P/4+Pj/+Pj4/7K0tP88QkH/Nz08/9PV1P/4+Pj/+Pj4//j4+P/4+Pj/+/v7//7+/v////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////T09P9pbm7/NDo5/z9FRP/29vb//////////////////////8rMzP8+REP/NTs6/8jKyf/9/f3///////////////////////////////////////////////////////////////////////////////////////////P///////////////////////////////////////////////////////////////////////////////////////////f39/+Hi4r/NDo5/z1DQv/l5ub//////////////////////9fY2P9ARkX/NDo5/62vr//6+vr/////////////////////////////////////////////////////////////////////////////////////8////9f///////////////////////////////////////////////////////////////////////////////////////////n5+f+lp6f/NDo5/zxCQf/U1dX//////////////////////+Pj4/9CSEf/NDo5/5GUlP/39/f/////////////////////////////////////////////////////////////////////////////////////1////6v///////////////////////////////////////////////////////////////////////////////////////////z8/P/DxcT/NDo5/ztBQP/DxMT//////////////////////+/v7/9FSkn/NDo5/3Z6ef/z8/P/////////////////////////////////////////////////////////////////////////////////////q////3H///////////////////////////////////////////////////////////////////////////////////////////7+/v/g4eH/NTs6/zo/P/+xs7P///////////////////////r6+v9HTUz/NDo5/1pfX//w8PD/////////////////////////////////////////////////////////////////////////////////////cf///yr////////////////////////////////////////////////////////////////////////////////////////////////u7u7/P0RD/zo/Pv+lp6f///////////////////////////9dYmH/Njw7/1NYWP/s7e3/////////////////////////////////////////////////////////////////////////////////////KgAAAAD////B///////////////////////////////////////////////////////////////////////////////////////////19fX/fIB//2FmZf/U1dX///////////////////////////+6vLz/X2Rj/5yfnv/29vb////////////////////////////////////////////////////////////////////////////////BAAAAAAAAAAD///9Z///////////////////////////////////////////////////////////////////////////////////////////+/v7/+vr6//T09P/////////////////////////////////9/f3/9fX1//v7+/////////////////////////////////////////////////////////////////////////////////////9ZAAAAAAAAAAAAAAAA////xP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8QAAAAAAAAAAAAAAAAAAAAA////Pv///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////z4AAAAAAAAAAAAAAAAAAAAAAAAAAP///3r/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////egAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///+Z//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+ZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////mf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////5kAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///3r/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////egAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8+////xP///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8T///8+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///1n////B///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////B////WQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////Kv///3H///+r////1/////P/////////////////////////////////////////////////////////////////////////////////////////8////9f///+r////cf///yoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/gAAAH/wAA/4AAAAH/AAD+AAAAAH8AAPwAAAAAPwAA+AAAAAAfAADwAAAAAA8AAOAAAAAABwAAwAAAAAADAADAAAAAAAMAAIAAAAAAAQAAgAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAABAACAAAAAAAEAAMAAAAAAAwAAwAAAAAADAADgAAAAAAcAAPAAAAAADwAA+AAAAAAfAAD8AAAAAD8AAP4AAAAAfwAA/4AAAAH/AAD/4AAAB/8AACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8G////Yf///6r////e/////P/////////////////////////////////////////////////////////8////3v///6r///9h////BgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////cv///+3////////////////////////////////////////////////////////////////////////////////////////////////////t////cgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////FP///7j/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////uP///xQAAAAAAAAAAAAAAAAAAAAAAAAAAP///xT////Q////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////0P///xQAAAAAAAAAAAAAAAAAAAAA////uP//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////uAAAAAAAAAAAAAAAAP///3L/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////cgAAAAD///8G////7f////////////////////////////////////////////////v8/P/m5ub//v7+/////////////////+Xm5v/19fX////////////////////////////////////////////////////////////////t////Bv///2H////////////////////////////////////////////////+/v7/mZyb/0VLSv/y8vL////////////q6+v/XGFg/2JmZv////////////////////////////////////////////////////////////////////9h////qv////////////////////////////////////////////////7+/v+coKD/NTs6/+Lk4////////////+vs7P9dYmH/Q0lI//j4+P///////////////////////////////////////////////////////////////6r////e/////////////////////////////////////////////////////7q8vP80Ojn/xsfH////////////8vLy/2hsbP9ARkX/6Onp////////////////////////////////////////////////////////////////3v////z/////////////////////////////////////////////////////2NnZ/zQ6Of+pq6v//v7+///////5+fn/c3h3/z5EQ//Y2dn////////////////////////////////////////////////////////////////8//////////////////////////////////////7+/v/7+/v/+/v7//r7+//r7Oz/Nz08/4mMjP/6+vr/+/v7//r6+v9+goH/O0FA/8XGxv/6+vr/+/v7//v7+//7+/v//v7+////////////////////////////////////////////////////////////////////////////4eLi/4qOjf+BhIT/gISD/3t/fv85Pj3/TlNT/4CEg/+AhIP/gISD/1VaWf82PDv/aG1s/4CEg/+AhIP/gYSE/4qOjf/h4uL////////////////////////////////////////////////////////////////////////////Iysn/QEZF/zY8O/82PDv/Njw7/zQ6Of81Ozr/Njw7/zY8O/82PDv/NTs6/zU7Ov81Ozr/Njw7/zY8O/82PDv/QEZF/8jKyf////////////////////////////////////////////////////////////////////////////z8/P/j5OT/3t7e/97e3v/X2Nj/YGVk/zc9PP/Y2dn/3t7e/97e3v+pq6v/NTs6/4aJif/d3d3/3t7e/97e3v/j5OT//Pz8//////////////////////////////////////////////////////////////////////////////////////////////////n5+f94e3v/Njw7/+fn5////////////9LT0/82PDv/h4uK//z8/P///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Pz8/4eLiv82PDv/0tPT////////////5+fn/zY8O/94e3v/+fn5//////////////////////////////////////////////////////////////////////////////////////////////////z8/P/j5OT/3t7e/97e3v/d3d3/homJ/zU7Ov+pq6v/3t7e/97e3v/Y2dn/Nz08/2BlZP/X2Nj/3t7e/97e3v/j5OT//Pz8////////////////////////////////////////////////////////////////////////////yMrJ/0BGRf82PDv/Njw7/zY8O/81Ozr/NTs6/zU7Ov82PDv/Njw7/zY8O/81Ozr/NDo5/zY8O/82PDv/Njw7/0BGRf/Iysn////////////////////////////////////////////////////////////////////////////h4uL/io6N/4GEhP+AhIP/gISD/2htbP82PDv/VVpZ/4CEg/+AhIP/gISD/05TU/85Pj3/e39+/4CEg/+BhIT/io6N/+Hi4v////////////////////////////////////////////////////////////////////////////7+/v/7+/v/+/v7//v7+//6+vr/xcbG/ztBQP9+goH/+vr6//v7+//6+vr/iYyM/zc9PP/r7Oz/+vv7//v7+//7+/v//v7+///////////////////////////////////////////8///////////////////////////////////////////////////////////Y2dn/PkRD/3N4d//5+fn///////7+/v+pq6v/NDo5/9jZ2P///////////////////////////////////////////////////////////P///97//////////////////////////////////////////////////////////+jp6f9ARkX/aGxs//Ly8v///////////8bHx/80Ojn/ury8///////////////////////////////////////////////////////////e////qv//////////////////////////////////////////////////////////+Pj4/0NJSP9dYmH/6+zs////////////4uTk/zU7Ov+coKD//v7+/////////////////////////////////////////////////////6r///9h////////////////////////////////////////////////////////////////YmZm/1xhYP/q6+v////////////y8vL/RUtK/5mcm//+/v7/////////////////////////////////////////////////////Yf///wb////t///////////////////////////////////////////////////////////19fX/5ebm//////////////////7+/v/m5ub/+/z8/////////////////////////////////////////////////////+3///8GAAAAAP///3L/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////cgAAAAAAAAAAAAAAAP///7j//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////7gAAAAAAAAAAAAAAAAAAAAA////FP///9D////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////Q////FAAAAAAAAAAAAAAAAAAAAAAAAAAA////FP///7j/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////uP///xQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///3L////t////////////////////////////////////////////////////////////////////////////////////////////////////7f///3IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wb///9h////qv///97////8//////////////////////////////////////////////////////////z////e////qv///2H///8GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/AAAP/gAAB/gAAAHwAAAA8AAAAOAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAABwAAAA8AAAAPgAAAH+AAAH/wAAD8oAAAAEAAAACAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8h////lf///+X////////////////////////////////////l////lf///yEAAAAAAAAAAAAAAAD///9N////+v/////////////////////////////////////////////////////////6////TQAAAAD///8h////+v////////////////////////////////////////////////////////////////////r///8h////lf/////////////////////o6en/ubu7///////U1tb/2NnZ////////////////////////////////lf///+X/////////////////////29zc/3l9ff/7+/v/tri4/62wr////////////////////////////////+X//////////////////////v7+//j4+P9ucnL/9PT0/87Pz/+ZnJv//v7+//7+/v//////////////////////////////////////9/f3/4yQj/+AhIP/TFFR/3t/fv9ydnX/V1xb/4GFhP+MkI//9/f3//////////////////////////////////39/f/l5ub/4uPj/3N3dv/Nz87/yMrJ/3l9fP/i4+P/5ebm//39/f/////////////////////////////////9/f3/5ebm/+Lj4/95fXz/yMrJ/83Pzv9zd3b/4uPj/+Xm5v/9/f3/////////////////////////////////9/f3/4yQj/+BhYT/V1xb/3J2df97f37/TFFR/4CEg/+MkI//9/f3///////////////////////////////////////+/v7//v7+/5mcm//Oz8//9PT0/25ycv/4+Pj//v7+///////////////////////////l//////////////////////////+tsK//tri4//v7+/95fX3/29zc///////////////////////////l////lf//////////////////////////2NnZ/9TW1v//////ubu7/+jp6f//////////////////////////lf///yH////6////////////////////////////////////////////////////////////////////+v///yEAAAAA////Tf////r/////////////////////////////////////////////////////////+v///00AAAAAAAAAAAAAAAD///8h////lf///+X////////////////////////////////////l////lf///yEAAAAAAAAAAMADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAEAAMADAAA=";
|
|
468
|
-
|
|
469
|
-
//#region src/core/iframe-style.ts
|
|
468
|
+
// src/core/iframe-style.ts
|
|
470
469
|
const FULLSCREEN_IFRAME_STYLE = {
|
|
471
470
|
border: "none",
|
|
472
471
|
width: "100%",
|
|
@@ -475,8 +474,7 @@ const FULLSCREEN_IFRAME_STYLE = {
|
|
|
475
474
|
top: "0",
|
|
476
475
|
left: "0"
|
|
477
476
|
};
|
|
478
|
-
|
|
479
|
-
//#region src/lib/real-path.ts
|
|
477
|
+
// src/lib/real-path.ts
|
|
480
478
|
/**
|
|
481
479
|
* Resolves `relativePath` against `base`, following symlinks, and checks that
|
|
482
480
|
* the real path is still inside the real `base`, so that neither `..` nor a
|
|
@@ -493,8 +491,7 @@ async function realPathWithinBase(base, relativePath) {
|
|
|
493
491
|
});
|
|
494
492
|
}
|
|
495
493
|
}
|
|
496
|
-
|
|
497
|
-
//#region src/server/routes/real-path-error.ts
|
|
494
|
+
// src/server/routes/real-path-error.ts
|
|
498
495
|
/** Maps a failed path lookup to the HTTP response every route returns for it. */
|
|
499
496
|
function realPathErrorResponse(error) {
|
|
500
497
|
switch (error.type) {
|
|
@@ -514,8 +511,7 @@ function realPathErrorResponse(error) {
|
|
|
514
511
|
};
|
|
515
512
|
}
|
|
516
513
|
}
|
|
517
|
-
|
|
518
|
-
//#region src/server/routes/api.tsx
|
|
514
|
+
// src/server/routes/api.tsx
|
|
519
515
|
function renderRawHtmlIframe(rawUrl, title) {
|
|
520
516
|
return renderToString(/* @__PURE__ */ jsx("iframe", {
|
|
521
517
|
src: rawUrl,
|
|
@@ -590,8 +586,7 @@ function createApiRoutes(config) {
|
|
|
590
586
|
});
|
|
591
587
|
return app;
|
|
592
588
|
}
|
|
593
|
-
|
|
594
|
-
//#region src/components/layout/main-content.tsx
|
|
589
|
+
// src/components/layout/main-content.tsx
|
|
595
590
|
function MainContent({ class: className, children }) {
|
|
596
591
|
return /* @__PURE__ */ jsx("main", {
|
|
597
592
|
id: "main-content",
|
|
@@ -599,8 +594,7 @@ function MainContent({ class: className, children }) {
|
|
|
599
594
|
children
|
|
600
595
|
});
|
|
601
596
|
}
|
|
602
|
-
|
|
603
|
-
//#region src/components/layout/markdown-content.tsx
|
|
597
|
+
// src/components/layout/markdown-content.tsx
|
|
604
598
|
function MarkdownContent({ htmlContent }) {
|
|
605
599
|
return /* @__PURE__ */ jsx("div", {
|
|
606
600
|
id: "markdown-content",
|
|
@@ -608,8 +602,7 @@ function MarkdownContent({ htmlContent }) {
|
|
|
608
602
|
dangerouslySetInnerHTML: { __html: htmlContent }
|
|
609
603
|
});
|
|
610
604
|
}
|
|
611
|
-
|
|
612
|
-
//#region src/components/content-view.tsx
|
|
605
|
+
// src/components/content-view.tsx
|
|
613
606
|
function ContentView({ contentType, fileTitle, filePath, htmlContent, htmlReloadKey, markdownClass = "px-5 sm:px-10 py-5 sm:py-10" }) {
|
|
614
607
|
if (contentType === "html") return /* @__PURE__ */ jsx(MainContent, {
|
|
615
608
|
class: "relative flex-1 overflow-hidden",
|
|
@@ -627,8 +620,7 @@ function ContentView({ contentType, fileTitle, filePath, htmlContent, htmlReload
|
|
|
627
620
|
})
|
|
628
621
|
});
|
|
629
622
|
}
|
|
630
|
-
|
|
631
|
-
//#region src/components/icons/svg-base.tsx
|
|
623
|
+
// src/components/icons/svg-base.tsx
|
|
632
624
|
function SvgBase({ class: className, children, width = "24", height = "24", viewBox = "0 0 24 24", ...rest }) {
|
|
633
625
|
return /* @__PURE__ */ jsx("svg", {
|
|
634
626
|
...rest,
|
|
@@ -646,16 +638,14 @@ function SvgBase({ class: className, children, width = "24", height = "24", view
|
|
|
646
638
|
children
|
|
647
639
|
});
|
|
648
640
|
}
|
|
649
|
-
|
|
650
|
-
//#region src/components/icons/chevron-down-icon.tsx
|
|
641
|
+
// src/components/icons/chevron-down-icon.tsx
|
|
651
642
|
function ChevronDownIcon(props) {
|
|
652
643
|
return /* @__PURE__ */ jsx(SvgBase, {
|
|
653
644
|
...props,
|
|
654
645
|
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
655
646
|
});
|
|
656
647
|
}
|
|
657
|
-
|
|
658
|
-
//#region src/components/icons/external-link-icon.tsx
|
|
648
|
+
// src/components/icons/external-link-icon.tsx
|
|
659
649
|
function ExternalLinkIcon({ class: className }) {
|
|
660
650
|
return /* @__PURE__ */ jsxs(SvgBase, {
|
|
661
651
|
class: className,
|
|
@@ -666,24 +656,33 @@ function ExternalLinkIcon({ class: className }) {
|
|
|
666
656
|
]
|
|
667
657
|
});
|
|
668
658
|
}
|
|
669
|
-
|
|
670
|
-
|
|
659
|
+
// src/components/icons/file-down-icon.tsx
|
|
660
|
+
function FileDownIcon(props) {
|
|
661
|
+
return /* @__PURE__ */ jsxs(SvgBase, {
|
|
662
|
+
...props,
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ jsx("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
665
|
+
/* @__PURE__ */ jsx("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
666
|
+
/* @__PURE__ */ jsx("path", { d: "M12 18v-6" }),
|
|
667
|
+
/* @__PURE__ */ jsx("path", { d: "m9 15 3 3 3-3" })
|
|
668
|
+
]
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
// src/components/icons/file-icon.tsx
|
|
671
672
|
function FileIcon(props) {
|
|
672
673
|
return /* @__PURE__ */ jsxs(SvgBase, {
|
|
673
674
|
...props,
|
|
674
675
|
children: [/* @__PURE__ */ jsx("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ jsx("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })]
|
|
675
676
|
});
|
|
676
677
|
}
|
|
677
|
-
|
|
678
|
-
//#region src/components/icons/folder-icon.tsx
|
|
678
|
+
// src/components/icons/folder-icon.tsx
|
|
679
679
|
function FolderIcon(props) {
|
|
680
680
|
return /* @__PURE__ */ jsx(SvgBase, {
|
|
681
681
|
...props,
|
|
682
682
|
children: /* @__PURE__ */ jsx("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 0-1.69.9L9.6 8H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2Z" })
|
|
683
683
|
});
|
|
684
684
|
}
|
|
685
|
-
|
|
686
|
-
//#region src/components/icons/moon-icon.tsx
|
|
685
|
+
// src/components/icons/moon-icon.tsx
|
|
687
686
|
function MoonIcon({ class: className, ...rest }) {
|
|
688
687
|
return /* @__PURE__ */ jsx(SvgBase, {
|
|
689
688
|
class: className,
|
|
@@ -691,8 +690,7 @@ function MoonIcon({ class: className, ...rest }) {
|
|
|
691
690
|
children: /* @__PURE__ */ jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" })
|
|
692
691
|
});
|
|
693
692
|
}
|
|
694
|
-
|
|
695
|
-
//#region src/components/icons/sidebar-close-icon.tsx
|
|
693
|
+
// src/components/icons/sidebar-close-icon.tsx
|
|
696
694
|
function SidebarCloseIcon({ class: className, ...rest }) {
|
|
697
695
|
return /* @__PURE__ */ jsxs(SvgBase, {
|
|
698
696
|
class: className,
|
|
@@ -720,8 +718,7 @@ function SidebarCloseIcon({ class: className, ...rest }) {
|
|
|
720
718
|
]
|
|
721
719
|
});
|
|
722
720
|
}
|
|
723
|
-
|
|
724
|
-
//#region src/components/icons/sidebar-open-icon.tsx
|
|
721
|
+
// src/components/icons/sidebar-open-icon.tsx
|
|
725
722
|
function SidebarOpenIcon({ class: className, ...rest }) {
|
|
726
723
|
return /* @__PURE__ */ jsx(SvgBase, {
|
|
727
724
|
class: className,
|
|
@@ -729,8 +726,7 @@ function SidebarOpenIcon({ class: className, ...rest }) {
|
|
|
729
726
|
children: /* @__PURE__ */ jsx("path", { d: "M17 8L21 12L17 16M3 12H13M3 6H13M3 18H13" })
|
|
730
727
|
});
|
|
731
728
|
}
|
|
732
|
-
|
|
733
|
-
//#region src/components/icons/slash-icon.tsx
|
|
729
|
+
// src/components/icons/slash-icon.tsx
|
|
734
730
|
function SlashIcon(props) {
|
|
735
731
|
return /* @__PURE__ */ jsx(SvgBase, {
|
|
736
732
|
...props,
|
|
@@ -743,8 +739,7 @@ function SlashIcon(props) {
|
|
|
743
739
|
})
|
|
744
740
|
});
|
|
745
741
|
}
|
|
746
|
-
|
|
747
|
-
//#region src/components/icons/sun-icon.tsx
|
|
742
|
+
// src/components/icons/sun-icon.tsx
|
|
748
743
|
function SunIcon({ class: className, ...rest }) {
|
|
749
744
|
return /* @__PURE__ */ jsxs(SvgBase, {
|
|
750
745
|
class: className,
|
|
@@ -766,8 +761,7 @@ function SunIcon({ class: className, ...rest }) {
|
|
|
766
761
|
]
|
|
767
762
|
});
|
|
768
763
|
}
|
|
769
|
-
|
|
770
|
-
//#region src/components/icons/sun-moon-icon.tsx
|
|
764
|
+
// src/components/icons/sun-moon-icon.tsx
|
|
771
765
|
function SunMoonIcon({ class: className, ...rest }) {
|
|
772
766
|
return /* @__PURE__ */ jsxs(SvgBase, {
|
|
773
767
|
class: className,
|
|
@@ -781,8 +775,7 @@ function SunMoonIcon({ class: className, ...rest }) {
|
|
|
781
775
|
]
|
|
782
776
|
});
|
|
783
777
|
}
|
|
784
|
-
|
|
785
|
-
//#region src/components/layout/breadcrumb.tsx
|
|
778
|
+
// src/components/layout/breadcrumb.tsx
|
|
786
779
|
const BREADCRUMB_CLASSES = {
|
|
787
780
|
dirItem: "inline-flex items-center shrink-0",
|
|
788
781
|
dirLink: "text-sm text-muted-foreground hover:text-foreground",
|
|
@@ -809,8 +802,7 @@ function Breadcrumb({ items }) {
|
|
|
809
802
|
})
|
|
810
803
|
});
|
|
811
804
|
}
|
|
812
|
-
|
|
813
|
-
//#region src/components/layout/external-link.tsx
|
|
805
|
+
// src/components/layout/external-link.tsx
|
|
814
806
|
function ExternalLink({ href }) {
|
|
815
807
|
return /* @__PURE__ */ jsx("a", {
|
|
816
808
|
href,
|
|
@@ -821,8 +813,7 @@ function ExternalLink({ href }) {
|
|
|
821
813
|
children: /* @__PURE__ */ jsx(ExternalLinkIcon, { class: "size-4" })
|
|
822
814
|
});
|
|
823
815
|
}
|
|
824
|
-
|
|
825
|
-
//#region src/components/layout/theme-toggle.tsx
|
|
816
|
+
// src/components/layout/theme-toggle.tsx
|
|
826
817
|
function ThemeToggle() {
|
|
827
818
|
return /* @__PURE__ */ jsxs("button", {
|
|
828
819
|
type: "button",
|
|
@@ -845,9 +836,8 @@ function ThemeToggle() {
|
|
|
845
836
|
]
|
|
846
837
|
});
|
|
847
838
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
function PageHeader({ id, breadcrumbs, showSidebarToggle, onToggleSidebar, externalLinkHref }) {
|
|
839
|
+
// src/components/layout/page-header.tsx
|
|
840
|
+
function PageHeader({ id, breadcrumbs, showSidebarToggle, onToggleSidebar, externalLinkHref, actions }) {
|
|
851
841
|
return /* @__PURE__ */ jsx("header", {
|
|
852
842
|
id,
|
|
853
843
|
class: "sticky top-0 z-50 bg-background border-b border-border",
|
|
@@ -870,13 +860,283 @@ function PageHeader({ id, breadcrumbs, showSidebarToggle, onToggleSidebar, exter
|
|
|
870
860
|
}), /* @__PURE__ */ jsx(Breadcrumb, { items: breadcrumbs })]
|
|
871
861
|
}), /* @__PURE__ */ jsxs("div", {
|
|
872
862
|
class: "flex items-center gap-1",
|
|
873
|
-
children: [
|
|
863
|
+
children: [
|
|
864
|
+
actions,
|
|
865
|
+
/* @__PURE__ */ jsx(ThemeToggle, {}),
|
|
866
|
+
externalLinkHref !== void 0 && /* @__PURE__ */ jsx(ExternalLink, { href: externalLinkHref })
|
|
867
|
+
]
|
|
874
868
|
})]
|
|
875
869
|
})
|
|
876
870
|
});
|
|
877
871
|
}
|
|
878
|
-
|
|
879
|
-
|
|
872
|
+
// src/core/file-tree.ts
|
|
873
|
+
/**
|
|
874
|
+
* Paths of the directories in the tree that contain `targetPath`, outermost
|
|
875
|
+
* first. `targetPath` itself need not be in the tree: a file excluded by
|
|
876
|
+
* `.gitignore` can still be displayed, and its directories are found.
|
|
877
|
+
*/
|
|
878
|
+
function findAncestorPaths(nodes, targetPath) {
|
|
879
|
+
for (const node of nodes) {
|
|
880
|
+
if (node.type !== "directory") continue;
|
|
881
|
+
if (targetPath.startsWith(`${node.path}/`)) return [node.path, ...findAncestorPaths(node.children ?? [], targetPath)];
|
|
882
|
+
}
|
|
883
|
+
return [];
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Title of the document printed for a single file. Browsers name a PDF saved
|
|
887
|
+
* from the print dialog after the document title, so `README.md` gives
|
|
888
|
+
* `README.pdf`.
|
|
889
|
+
*/
|
|
890
|
+
function filePdfTitle(path) {
|
|
891
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
892
|
+
const extension = getExtension(name);
|
|
893
|
+
return extension === "" ? name : name.slice(0, -extension.length);
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Name of a directory, which also titles its PDF. The browsed directory goes
|
|
897
|
+
* by `rootName`.
|
|
898
|
+
*/
|
|
899
|
+
function directoryName(path, rootName) {
|
|
900
|
+
return path === null ? rootName : path.slice(path.lastIndexOf("/") + 1);
|
|
901
|
+
}
|
|
902
|
+
function directoryPdfStatus(fileCount) {
|
|
903
|
+
if (fileCount === 0) return "empty";
|
|
904
|
+
if (fileCount > 200) return "too-many";
|
|
905
|
+
return "ok";
|
|
906
|
+
}
|
|
907
|
+
function collectMarkdownFiles(nodes) {
|
|
908
|
+
return nodes.flatMap((node) => {
|
|
909
|
+
if (node.type === "directory") return collectMarkdownFiles(node.children ?? []);
|
|
910
|
+
return getContentType(node.path) === "markdown" ? [node.path] : [];
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
function findDirectoryChildren(nodes, path) {
|
|
914
|
+
for (const node of nodes) {
|
|
915
|
+
if (node.type !== "directory") continue;
|
|
916
|
+
if (node.path === path) return node.children ?? [];
|
|
917
|
+
if (path.startsWith(`${node.path}/`)) return findDirectoryChildren(node.children ?? [], path);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* The Markdown files under `directory`, in the order the file tree lists them,
|
|
922
|
+
* or `undefined` when the tree has no such directory. The tree already leaves
|
|
923
|
+
* out what `.gitignore` excludes.
|
|
924
|
+
*/
|
|
925
|
+
function directoryMarkdownFiles(tree, directory) {
|
|
926
|
+
const children = directory === null ? tree : findDirectoryChildren(tree, directory);
|
|
927
|
+
return children && collectMarkdownFiles(children);
|
|
928
|
+
}
|
|
929
|
+
function directoryEntry(tree, path, rootName) {
|
|
930
|
+
return {
|
|
931
|
+
path,
|
|
932
|
+
name: directoryName(path, rootName),
|
|
933
|
+
markdownFileCount: directoryMarkdownFiles(tree, path)?.length ?? 0
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* The directories that can be saved as one PDF while `currentPath` is shown:
|
|
938
|
+
* the browsed directory, then each directory containing `currentPath`,
|
|
939
|
+
* outermost first.
|
|
940
|
+
*/
|
|
941
|
+
function directoryPdfEntries(tree, currentPath, rootName) {
|
|
942
|
+
return [directoryEntry(tree, null, rootName), ...findAncestorPaths(tree, currentPath).map((path) => directoryEntry(tree, path, rootName))];
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* An HTML file is printed from its own page, so that it comes out whole and
|
|
946
|
+
* as it styles itself; a Markdown file from the print page.
|
|
947
|
+
*/
|
|
948
|
+
function filePrintRequest(path, contentType) {
|
|
949
|
+
return {
|
|
950
|
+
url: contentType === "html" ? rawFileUrl(path) : printFileUrl(path),
|
|
951
|
+
title: filePdfTitle(path)
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
function directoryPrintRequest(entry) {
|
|
955
|
+
return {
|
|
956
|
+
url: printDirectoryUrl(entry.path),
|
|
957
|
+
title: entry.name
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
// src/components/layout/menu-keys.ts
|
|
961
|
+
/**
|
|
962
|
+
* What a key pressed inside a menu does, given the focused item's index among
|
|
963
|
+
* the `count` enabled items (-1 when none has focus). Arrow keys wrap around;
|
|
964
|
+
* Escape closes the menu and returns focus to its button, Tab closes it and
|
|
965
|
+
* lets focus move on. Other keys do nothing (`undefined`).
|
|
966
|
+
*/
|
|
967
|
+
function menuKeyAction(key, index, count) {
|
|
968
|
+
switch (key) {
|
|
969
|
+
case "Escape": return {
|
|
970
|
+
type: "close",
|
|
971
|
+
returnFocus: true
|
|
972
|
+
};
|
|
973
|
+
case "Tab": return {
|
|
974
|
+
type: "close",
|
|
975
|
+
returnFocus: false
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
if (count === 0) return void 0;
|
|
979
|
+
switch (key) {
|
|
980
|
+
case "ArrowDown": return {
|
|
981
|
+
type: "focus",
|
|
982
|
+
index: index < 0 ? 0 : (index + 1) % count
|
|
983
|
+
};
|
|
984
|
+
case "ArrowUp": return {
|
|
985
|
+
type: "focus",
|
|
986
|
+
index: index < 0 ? count - 1 : (index - 1 + count) % count
|
|
987
|
+
};
|
|
988
|
+
case "Home": return {
|
|
989
|
+
type: "focus",
|
|
990
|
+
index: 0
|
|
991
|
+
};
|
|
992
|
+
case "End": return {
|
|
993
|
+
type: "focus",
|
|
994
|
+
index: count - 1
|
|
995
|
+
};
|
|
996
|
+
default: return;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
// src/components/layout/pdf-menu.tsx
|
|
1000
|
+
const ITEM_CLASS = "flex items-center gap-x-3 w-full py-2 px-3 text-left text-sm text-foreground rounded-md enabled:cursor-pointer enabled:hover:bg-sidebar-accent focus-visible:bg-sidebar-accent disabled:opacity-50";
|
|
1001
|
+
/** How the menu shows a directory with `count` Markdown files. */
|
|
1002
|
+
function directoryItemState(count) {
|
|
1003
|
+
switch (directoryPdfStatus(count)) {
|
|
1004
|
+
case "empty": return {
|
|
1005
|
+
description: "No Markdown files",
|
|
1006
|
+
disabled: true
|
|
1007
|
+
};
|
|
1008
|
+
case "too-many": return {
|
|
1009
|
+
description: `More than 200 Markdown files`,
|
|
1010
|
+
disabled: true
|
|
1011
|
+
};
|
|
1012
|
+
case "ok": return {
|
|
1013
|
+
description: `${count} Markdown file${count === 1 ? "" : "s"}`,
|
|
1014
|
+
disabled: false
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
function MenuItem({ icon, label, description, disabled, onSelect }) {
|
|
1019
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
1020
|
+
type: "button",
|
|
1021
|
+
role: "menuitem",
|
|
1022
|
+
disabled,
|
|
1023
|
+
onClick: onSelect,
|
|
1024
|
+
class: ITEM_CLASS,
|
|
1025
|
+
children: [icon, /* @__PURE__ */ jsxs("span", {
|
|
1026
|
+
class: "min-w-0 flex-1",
|
|
1027
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1028
|
+
class: "block truncate",
|
|
1029
|
+
children: label
|
|
1030
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1031
|
+
class: "block text-xs text-muted-foreground",
|
|
1032
|
+
children: description
|
|
1033
|
+
})]
|
|
1034
|
+
})]
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/** The menu's items: the shown file, then each directory. */
|
|
1038
|
+
function pdfMenuItems({ currentPath, currentName, contentType, directories }) {
|
|
1039
|
+
return [{
|
|
1040
|
+
kind: "file",
|
|
1041
|
+
key: `file:${currentPath}`,
|
|
1042
|
+
label: currentName,
|
|
1043
|
+
description: "This file",
|
|
1044
|
+
disabled: false,
|
|
1045
|
+
request: filePrintRequest(currentPath, contentType)
|
|
1046
|
+
}, ...directories.map((directory) => ({
|
|
1047
|
+
kind: "directory",
|
|
1048
|
+
key: `dir:${directory.path ?? ""}`,
|
|
1049
|
+
label: directory.name,
|
|
1050
|
+
...directoryItemState(directory.markdownFileCount),
|
|
1051
|
+
request: directoryPrintRequest(directory)
|
|
1052
|
+
}))];
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Header button whose menu saves the shown file, or the Markdown files under
|
|
1056
|
+
* one of its directories, as a PDF.
|
|
1057
|
+
*/
|
|
1058
|
+
function PdfMenu({ onPrint, ...source }) {
|
|
1059
|
+
const [open, setOpen] = useState(false);
|
|
1060
|
+
const rootRef = useRef(null);
|
|
1061
|
+
const buttonRef = useRef(null);
|
|
1062
|
+
const menuRef = useRef(null);
|
|
1063
|
+
const items = () => Array.from(menuRef.current?.querySelectorAll("[role=menuitem]:not(:disabled)") ?? []);
|
|
1064
|
+
useEffect(() => {
|
|
1065
|
+
if (!open) return;
|
|
1066
|
+
items()[0]?.focus();
|
|
1067
|
+
const onPointerDown = (e) => {
|
|
1068
|
+
if (!rootRef.current?.contains(e.target)) setOpen(false);
|
|
1069
|
+
};
|
|
1070
|
+
const onWindowBlur = () => setOpen(false);
|
|
1071
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
1072
|
+
window.addEventListener("blur", onWindowBlur);
|
|
1073
|
+
return () => {
|
|
1074
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
1075
|
+
window.removeEventListener("blur", onWindowBlur);
|
|
1076
|
+
};
|
|
1077
|
+
}, [open]);
|
|
1078
|
+
const close = () => {
|
|
1079
|
+
setOpen(false);
|
|
1080
|
+
buttonRef.current?.focus();
|
|
1081
|
+
};
|
|
1082
|
+
const select = (request) => {
|
|
1083
|
+
close();
|
|
1084
|
+
onPrint(request);
|
|
1085
|
+
};
|
|
1086
|
+
const onMenuKeyDown = (e) => {
|
|
1087
|
+
const enabled = items();
|
|
1088
|
+
const action = menuKeyAction(e.key, enabled.indexOf(document.activeElement), enabled.length);
|
|
1089
|
+
if (!action) return;
|
|
1090
|
+
if (action.type === "focus") enabled[action.index]?.focus();
|
|
1091
|
+
else if (action.returnFocus) close();
|
|
1092
|
+
else {
|
|
1093
|
+
setOpen(false);
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
e.preventDefault();
|
|
1097
|
+
};
|
|
1098
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1099
|
+
ref: rootRef,
|
|
1100
|
+
class: "relative",
|
|
1101
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
1102
|
+
ref: buttonRef,
|
|
1103
|
+
type: "button",
|
|
1104
|
+
id: "pdf-menu-button",
|
|
1105
|
+
"aria-label": "Save as PDF",
|
|
1106
|
+
"aria-haspopup": "menu",
|
|
1107
|
+
"aria-expanded": open,
|
|
1108
|
+
"aria-controls": open ? "pdf-menu" : void 0,
|
|
1109
|
+
onClick: () => setOpen((o) => !o),
|
|
1110
|
+
onKeyDown: (e) => {
|
|
1111
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1112
|
+
e.preventDefault();
|
|
1113
|
+
setOpen(true);
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
class: "shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:text-foreground cursor-pointer",
|
|
1117
|
+
children: /* @__PURE__ */ jsx(FileDownIcon, { class: "size-4" })
|
|
1118
|
+
}), open && /* @__PURE__ */ jsxs("div", {
|
|
1119
|
+
ref: menuRef,
|
|
1120
|
+
id: "pdf-menu",
|
|
1121
|
+
role: "menu",
|
|
1122
|
+
"aria-labelledby": "pdf-menu-button",
|
|
1123
|
+
onKeyDown: onMenuKeyDown,
|
|
1124
|
+
class: "absolute end-0 top-full mt-1 z-60 w-64 max-w-[calc(100vw-1rem)] p-1 bg-background border border-muted-foreground/25 rounded-lg shadow-lg",
|
|
1125
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1126
|
+
"aria-hidden": "true",
|
|
1127
|
+
class: "px-3 pt-1.5 pb-1 text-xs font-medium text-muted-foreground",
|
|
1128
|
+
children: "Save as PDF"
|
|
1129
|
+
}), pdfMenuItems(source).map((item) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
1130
|
+
icon: item.kind === "file" ? /* @__PURE__ */ jsx(FileIcon, { class: "shrink-0 size-4" }) : /* @__PURE__ */ jsx(FolderIcon, { class: "shrink-0 size-4" }),
|
|
1131
|
+
label: item.label,
|
|
1132
|
+
description: item.description,
|
|
1133
|
+
disabled: item.disabled,
|
|
1134
|
+
onSelect: () => select(item.request)
|
|
1135
|
+
}), item.kind === "file" && /* @__PURE__ */ jsx("hr", { class: "my-1 border-border" })] }, item.key))]
|
|
1136
|
+
})]
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
// src/components/navigation/file-tree-items.tsx
|
|
880
1140
|
const MAX_DEPTH = 20;
|
|
881
1141
|
function DirectoryItem({ node, currentPath, depth, isOpen, onToggle }) {
|
|
882
1142
|
const open = isOpen(node.path);
|
|
@@ -930,8 +1190,7 @@ function FileTreeItems({ nodes, currentPath, depth = 0, isOpen, onToggle }) {
|
|
|
930
1190
|
}, node.path);
|
|
931
1191
|
}) });
|
|
932
1192
|
}
|
|
933
|
-
|
|
934
|
-
//#region src/components/navigation/file-tree.tsx
|
|
1193
|
+
// src/components/navigation/file-tree.tsx
|
|
935
1194
|
function FileTree({ nodes, currentPath, isOpen, onToggle }) {
|
|
936
1195
|
return /* @__PURE__ */ jsx("ul", {
|
|
937
1196
|
id: "file-tree",
|
|
@@ -944,8 +1203,7 @@ function FileTree({ nodes, currentPath, isOpen, onToggle }) {
|
|
|
944
1203
|
})
|
|
945
1204
|
});
|
|
946
1205
|
}
|
|
947
|
-
|
|
948
|
-
//#region src/components/navigation/sidebar.tsx
|
|
1206
|
+
// src/components/navigation/sidebar.tsx
|
|
949
1207
|
function Sidebar({ title, tree, currentPath, onClose, isOpen, onToggle, searchQuery, onSearchChange, isSearching }) {
|
|
950
1208
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
951
1209
|
role: "none",
|
|
@@ -1007,22 +1265,7 @@ function Sidebar({ title, tree, currentPath, onClose, isOpen, onToggle, searchQu
|
|
|
1007
1265
|
})]
|
|
1008
1266
|
})] });
|
|
1009
1267
|
}
|
|
1010
|
-
|
|
1011
|
-
//#region src/core/file-tree.ts
|
|
1012
|
-
/**
|
|
1013
|
-
* Paths of the directories in the tree that contain `targetPath`, outermost
|
|
1014
|
-
* first. `targetPath` itself need not be in the tree: a file excluded by
|
|
1015
|
-
* `.gitignore` can still be displayed, and its directories are found.
|
|
1016
|
-
*/
|
|
1017
|
-
function findAncestorPaths(nodes, targetPath) {
|
|
1018
|
-
for (const node of nodes) {
|
|
1019
|
-
if (node.type !== "directory") continue;
|
|
1020
|
-
if (targetPath.startsWith(`${node.path}/`)) return [node.path, ...findAncestorPaths(node.children ?? [], targetPath)];
|
|
1021
|
-
}
|
|
1022
|
-
return [];
|
|
1023
|
-
}
|
|
1024
|
-
//#endregion
|
|
1025
|
-
//#region src/core/file-tree-open-state.ts
|
|
1268
|
+
// src/core/file-tree-open-state.ts
|
|
1026
1269
|
/**
|
|
1027
1270
|
* State before any persisted state is known: only the ancestors of the
|
|
1028
1271
|
* displayed file are open. Shared by SSR and the first client render so that
|
|
@@ -1037,8 +1280,7 @@ function initialOpenState(tree, currentPath) {
|
|
|
1037
1280
|
function isDirectoryOpen(state, path) {
|
|
1038
1281
|
return state.expanded.has(path) || state.revealed.has(path);
|
|
1039
1282
|
}
|
|
1040
|
-
|
|
1041
|
-
//#region src/lib/project-id.ts
|
|
1283
|
+
// src/lib/project-id.ts
|
|
1042
1284
|
/**
|
|
1043
1285
|
* Create a stable, short project identifier from an absolute path.
|
|
1044
1286
|
*
|
|
@@ -1052,14 +1294,16 @@ function createProjectId(absolutePath) {
|
|
|
1052
1294
|
const normalized = resolve(absolutePath);
|
|
1053
1295
|
return createHash("sha256").update(normalized).digest("hex").slice(0, 16);
|
|
1054
1296
|
}
|
|
1055
|
-
|
|
1056
|
-
//#region src/server/renderer/client-bundle.js
|
|
1057
|
-
const clientBundle = "\"use strict\";(()=>{var G,y,Ze,Jt,N,Ye,Ge,et,pe,X,$,tt,he,_e,fe,Zt,Q={},J=[],Gt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ee=Array.isArray;function R(e,t){for(var n in t)e[n]=t[n];return e}function me(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function en(e,t,n){var r,a,o,s={};for(o in t)o==\"key\"?r=t[o]:o==\"ref\"?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?G.call(arguments,2):n),typeof e==\"function\"&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return Y(e,s,r,a,null)}function Y(e,t,n,r,a){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++Ze,__i:-1,__u:0};return a==null&&y.vnode!=null&&y.vnode(o),o}function P(e){return e.children}function q(e,t){this.props=e,this.context=t}function O(e,t){if(t==null)return e.__?O(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==\"function\"?O(e):null}function tn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],o=R({},t);o.__v=t.__v+1,y.vnode&&y.vnode(o),ye(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??O(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,at(r,o,a),t.__e=t.__=null,o.__e!=n&&nt(o)}}function nt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),nt(e)}function qe(e){(!e.__d&&(e.__d=!0)&&N.push(e)&&!Z.__r++||Ye!=y.debounceRendering)&&((Ye=y.debounceRendering)||Ge)(Z)}function Z(){try{for(var e,t=1;N.length;)N.length>t&&N.sort(et),e=N.shift(),t=N.length,tn(e)}finally{N.length=Z.__r=0}}function rt(e,t,n,r,a,o,s,c,u,d,p){var h,l,_,f,x,g,S=r&&r.__k||J,m=t.length;for(u=nn(n,t,S,u,m),h=0;h<m;h++)(_=n.__k[h])!=null&&(l=_.__i!=-1&&S[_.__i]||Q,_.__i=h,g=ye(e,_,l,a,o,s,c,u,d,p),f=_.__e,_.ref&&l.ref!=_.ref&&(l.ref&&ge(l.ref,null,_),p.push(_.ref,_.__c||f,_)),x==null&&f!=null&&(x=f),4&_.__u?(u=ot(_,u,e),l.__e&&(l.__e=null)):typeof _.type==\"function\"&&g!==void 0?u=g:f&&(u=f.nextSibling),_.__u&=-7);return n.__e=x,u}function nn(e,t,n,r,a){var o,s,c,u,d,p=n.length,h=p,l=0;for(e.__k=new Array(a),o=0;o<a;o++)(s=t[o])!=null&&typeof s!=\"boolean\"&&typeof s!=\"function\"?(typeof s==\"string\"||typeof s==\"number\"||typeof s==\"bigint\"||s.constructor==String?s=e.__k[o]=Y(null,s,null,null,null):ee(s)?s=e.__k[o]=Y(P,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[o]=Y(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,u=o+l,s.__=e,s.__b=e.__b+1,c=null,(d=s.__i=rn(s,n,u,h))!=-1&&(h--,(c=n[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(a>p?l--:a<p&&l++),typeof s.type!=\"function\"&&(s.__u|=4)):d!=u&&(d==u-1?l--:d==u+1?l++:(d>u?l--:l++,s.__u|=4))):e.__k[o]=null;if(h)for(o=0;o<p;o++)(c=n[o])!=null&&(2&c.__u)==0&&(c.__e==r&&(r=O(c)),lt(c,c));return r}function ot(e,t,n){var r,a;if(typeof e.type==\"function\"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=ot(r[a],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=O(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function rn(e,t,n,r){var a,o,s,c=e.key,u=e.type,d=t[n],p=d!=null&&(2&d.__u)==0;if(d===null&&c==null||p&&c==d.key&&u==d.type)return n;if(r>(p?1:0)){for(a=n-1,o=n+1;a>=0||o<t.length;)if((d=t[s=a>=0?a--:o++])!=null&&(2&d.__u)==0&&c==d.key&&u==d.type)return s}return-1}function Qe(e,t,n){t[0]==\"-\"?e.setProperty(t,n??\"\"):e[t]=n==null?\"\":typeof n!=\"number\"||Gt.test(t)?n:n+\"px\"}function V(e,t,n,r,a){var o,s;e:if(t==\"style\")if(typeof n==\"string\")e.style.cssText=n;else{if(typeof r==\"string\"&&(e.style.cssText=r=\"\"),r)for(t in r)n&&t in n||Qe(e.style,t,\"\");if(n)for(t in n)r&&n[t]==r[t]||Qe(e.style,t,n[t])}else if(t[0]==\"o\"&&t[1]==\"n\")o=t!=(t=t.replace(tt,\"$1\")),s=t.toLowerCase(),t=s in e||t==\"onFocusOut\"||t==\"onFocusIn\"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[$]=r[$]:(n[$]=he,e.addEventListener(t,o?fe:_e,o)):e.removeEventListener(t,o?fe:_e,o);else{if(a==\"http://www.w3.org/2000/svg\")t=t.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(t!=\"width\"&&t!=\"height\"&&t!=\"href\"&&t!=\"list\"&&t!=\"form\"&&t!=\"tabIndex\"&&t!=\"download\"&&t!=\"rowSpan\"&&t!=\"colSpan\"&&t!=\"role\"&&t!=\"popover\"&&t in e)try{e[t]=n??\"\";break e}catch{}typeof n==\"function\"||(n==null||n===!1&&t[4]!=\"-\"?e.removeAttribute(t):e.setAttribute(t,t==\"popover\"&&n==1?\"\":n))}}function Je(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[X]==null)t[X]=he++;else if(t[X]<n[$])return;return n(y.event?y.event(t):t)}}}function ye(e,t,n,r,a,o,s,c,u,d){var p,h,l,_,f,x,g,S,m,w,M,I,H,j,B,F,E=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),o=[c=t.__e=n.__e]),(p=y.__b)&&p(t);e:if(typeof E==\"function\"){h=s.length;try{if(m=t.props,w=E.prototype&&E.prototype.render,M=(p=E.contextType)&&r[p.__c],I=p?M?M.props.value:p.__:r,n.__c?S=(l=t.__c=n.__c).__=l.__E:(w?t.__c=l=new E(m,I):(t.__c=l=new q(m,I),l.constructor=E,l.render=an),M&&M.sub(l),l.state||(l.state={}),l.__n=r,_=l.__d=!0,l.__h=[],l._sb=[]),w&&l.__s==null&&(l.__s=l.state),w&&E.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=R({},l.__s)),R(l.__s,E.getDerivedStateFromProps(m,l.__s))),f=l.props,x=l.state,l.__v=t,_)w&&E.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),w&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(w&&E.getDerivedStateFromProps==null&&m!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(m,I),t.__v==n.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(m,l.__s,I)===!1){t.__v!=n.__v&&(l.props=m,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),J.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&s.push(l),c=O(n);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(m,l.__s,I),w&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,x,g)})}if(l.context=I,l.props=m,l.__P=e,l.__e=!1,H=y.__r,j=0,w)l.state=l.__s,l.__d=!1,H&&H(t),p=l.render(l.props,l.state,l.context),J.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,H&&H(t),p=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++j<25);l.state=l.__s,l.getChildContext!=null&&(r=R(R({},r),l.getChildContext())),w&&!_&&l.getSnapshotBeforeUpdate!=null&&(g=l.getSnapshotBeforeUpdate(f,x)),B=p!=null&&p.type===P&&p.key==null?st(p.props.children):p,c=rt(e,ee(B)?B:[B],t,n,r,a,o,s,c,u,d),l.base=t.__e,t.__u&=-161,l.__h.length&&s.push(l),S&&(l.__E=l.__=null)}catch(L){if(s.length=h,t.__v=null,u||o!=null){if(L.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),t.__e=c}else if(o!=null)for(F=o.length;F--;)me(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||it(t),y.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=on(n.__e,t,n,r,a,o,s,u,d);return(p=y.diffed)&&p(t),128&t.__u?void 0:c}function it(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(it))}function at(e,t,n){for(var r=0;r<n.length;r++)ge(n[r],n[++r],n[++r]);y.__c&&y.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(o){o.call(a)})}catch(o){y.__e(o,a.__v)}})}function st(e){return typeof e!=\"object\"||e==null||e.__b>0?e:ee(e)?e.map(st):e.constructor!==void 0?null:R({},e)}function on(e,t,n,r,a,o,s,c,u){var d,p,h,l,_,f,x,g=n.props||Q,S=t.props,m=t.type;if(m==\"svg\"?a=\"http://www.w3.org/2000/svg\":m==\"math\"?a=\"http://www.w3.org/1998/Math/MathML\":a||(a=\"http://www.w3.org/1999/xhtml\"),o!=null){for(d=0;d<o.length;d++)if((_=o[d])&&\"setAttribute\"in _==!!m&&(m?_.localName==m:_.nodeType==3)){e=_,o[d]=null;break}}if(e==null){if(m==null)return document.createTextNode(S);e=document.createElementNS(a,m,S.is&&S),c&&(y.__m&&y.__m(t,o),c=!1),o=null}if(m==null)g===S||c&&e.data==S||(e.data=S);else{if(o=m==\"textarea\"&&S.defaultValue!=null?null:o&&G.call(e.childNodes),!c&&o!=null)for(g={},d=0;d<e.attributes.length;d++)g[(_=e.attributes[d]).name]=_.value;for(d in g)_=g[d],d==\"dangerouslySetInnerHTML\"?h=_:d==\"children\"||d in S||d==\"value\"&&\"defaultValue\"in S||d==\"checked\"&&\"defaultChecked\"in S||V(e,d,null,_,a);for(d in S)_=S[d],d==\"children\"?l=_:d==\"dangerouslySetInnerHTML\"?p=_:d==\"value\"?f=_:d==\"checked\"?x=_:c&&typeof _!=\"function\"||g[d]===_||V(e,d,_,g[d],a);if(p)c||h&&(p.__html==h.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(h&&(e.innerHTML=\"\"),rt(t.type==\"template\"?e.content:e,ee(l)?l:[l],t,n,r,m==\"foreignObject\"?\"http://www.w3.org/1999/xhtml\":a,o,s,o?o[0]:n.__k&&O(n,0),c,u),o!=null)for(d=o.length;d--;)me(o[d]);c&&m!=\"textarea\"||(d=\"value\",m==\"progress\"&&f==null?e.removeAttribute(\"value\"):f!=null&&(f!==e[d]||m==\"progress\"&&!f||m==\"option\"&&f!=g[d])&&V(e,d,f,g[d],a),d=\"checked\",x!=null&&x!=e[d]&&V(e,d,x,g[d],a))}return e}function ge(e,t,n){try{if(typeof e==\"function\"){var r=typeof e.__u==\"function\";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){y.__e(a,n)}}function lt(e,t,n){var r,a;if(y.unmount&&y.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ge(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){y.__e(o,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&<(r[a],t,n||typeof e.type!=\"function\");n||me(e.__e),e.__c=e.__=e.__e=void 0}function an(e,t,n){return this.constructor(e,n)}function sn(e,t,n){var r,a,o,s;t==document&&(t=document.documentElement),y.__&&y.__(e,t),a=(r=typeof n==\"function\")?null:n&&n.__k||t.__k,o=[],s=[],ye(t,e=(!r&&n||t).__k=en(P,null,[e]),a||Q,Q,t.namespaceURI,!r&&n?[n]:a?null:t.firstChild?G.call(t.childNodes):null,o,!r&&n?n:a?a.__e:t.firstChild,r,s),at(o,e,s),e.props.children=null}function te(e,t){sn(e,t,te)}G=J.slice,y={__e:function(e,t,n,r){for(var a,o,s;t=t.__;)if((a=t.__c)&&!a.__)try{if((o=a.constructor)&&o.getDerivedStateFromError!=null&&(a.setState(o.getDerivedStateFromError(e)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),s=a.__d),s)return a.__E=a}catch(c){e=c}throw e}},Ze=0,Jt=function(e){return e!=null&&e.constructor===void 0},q.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=R({},this.state),typeof e==\"function\"&&(e=e(R({},n),this.props)),e&&R(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),qe(this))},q.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),qe(this))},q.prototype.render=P,N=[],Ge=typeof Promise==\"function\"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,et=function(e,t){return e.__v.__b-t.__v.__b},Z.__r=0,pe=Math.random().toString(8),X=\"__d\"+pe,$=\"__a\"+pe,tt=/(PointerCapture)$|Capture$/i,he=0,_e=Je(!1),fe=Je(!0),Zt=0;var U,v,ve,ct,W=0,yt=[],b=y,dt=b.__b,ut=b.__r,pt=b.diffed,_t=b.__c,ft=b.unmount,ht=b.__;function re(e,t){b.__h&&b.__h(v,e,W||t),W=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return W=1,ln(gt,e)}function ln(e,t,n){var r=re(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):gt(void 0,t),function(c){var u=r.__N?r.__N[0]:r.__[0],d=r.t(u,c);u!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.__f)){var a=function(c,u,d){if(!r.__c.__H)return!0;var p=!1,h=r.__c.props!==c;if(r.__c.__H.__.some(function(_){if(_.__N){p=!0;var f=_.__[0];_.__=_.__N,_.__N=void 0,f!==_.__[0]&&(h=!0)}}),o){var l=o.call(this,c,u,d);return p?l||h:l}return!p||h};v.__f=!0;var o=v.shouldComponentUpdate,s=v.componentWillUpdate;v.componentWillUpdate=function(c,u,d){if(this.__e){var p=o;o=void 0,a(c,u,d),o=p}s&&s.call(this,c,u,d)},v.shouldComponentUpdate=a}return r.__N||r.__}function D(e,t){var n=re(U++,3);!b.__s&&be(n.__H,t)&&(n.__=e,n.u=t,v.__H.__h.push(n))}function oe(e,t){var n=re(U++,4);!b.__s&&be(n.__H,t)&&(n.__=e,n.u=t,v.__h.push(n))}function C(e){return W=5,ie(function(){return{current:e}},[])}function ie(e,t){var n=re(U++,7);return be(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function A(e,t){return W=8,ie(function(){return e},t)}function cn(){for(var e;e=yt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ne),t.__h.some(Se),t.__h=[]}catch(n){t.__h=[],b.__e(n,e.__v)}}}b.__b=function(e){v=null,dt&&dt(e)},b.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ht&&ht(e,t)},b.__r=function(e){ut&&ut(e),U=0;var t=(v=e.__c).__H;t&&(ve===v?(t.__h=[],v.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ne),t.__h.some(Se),t.__h=[],U=0)),ve=v},b.diffed=function(e){pt&&pt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(yt.push(t)!==1&&ct===b.requestAnimationFrame||((ct=b.requestAnimationFrame)||dn)(cn)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),ve=v=null},b.__c=function(e,t){t.some(function(n){try{n.__h.some(ne),n.__h=n.__h.filter(function(r){return!r.__||Se(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],b.__e(r,n.__v)}}),_t&&_t(e,t)},b.unmount=function(e){ft&&ft(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ne(r)}catch(a){t=a}}),n.__H=void 0,t&&b.__e(t,n.__v))};var mt=typeof requestAnimationFrame==\"function\";function dn(e){var t,n=function(){clearTimeout(r),mt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);mt&&(t=requestAnimationFrame(n))}function ne(e){var t=v,n=e.__c;typeof n==\"function\"&&(e.__c=void 0,n()),v=t}function Se(e){var t=v;e.__c=e.__(),v=t}function be(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function gt(e,t){return typeof t==\"function\"?t(e):t}var vt={border:\"none\",width:\"100%\",height:\"100%\",position:\"absolute\",top:\"0\",left:\"0\"};var un=\"/__peek/raw/\";function xe(e){return e.split(\"/\").map(encodeURIComponent).join(\"/\")}function St(e){return`${un}${xe(e)}`}var pn=0;function i(e,t,n,r,a,o){t||(t={});var s,c,u=t;if(\"ref\"in u)for(c in u={},t)c==\"ref\"?s=t[c]:u[c]=t[c];var d={type:e,props:u,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--pn,__i:-1,__u:0,__source:a,__self:o};if(typeof e==\"function\"&&(s=e.defaultProps))for(c in s)u[c]===void 0&&(u[c]=s[c]);return y.vnode&&y.vnode(d),d}function Te({class:e,children:t}){return i(\"main\",{id:\"main-content\",class:e??\"\",children:t})}function ae({htmlContent:e}){return i(\"div\",{id:\"markdown-content\",class:\"markdown-body\",dangerouslySetInnerHTML:{__html:e}})}function bt({contentType:e,fileTitle:t,filePath:n,htmlContent:r,htmlReloadKey:a,markdownClass:o=\"px-5 sm:px-10 py-5 sm:py-10\"}){return e===\"html\"?i(Te,{class:\"relative flex-1 overflow-hidden\",children:i(\"iframe\",{title:t,src:St(n),style:vt},a)}):i(Te,{class:o,children:i(\"div\",{class:\"max-w-4xl mx-auto\",children:i(ae,{htmlContent:r})})})}function T({class:e,children:t,width:n=\"24\",height:r=\"24\",viewBox:a=\"0 0 24 24\",...o}){return i(\"svg\",{...o,class:e,\"aria-hidden\":\"true\",xmlns:\"http://www.w3.org/2000/svg\",width:n,height:r,viewBox:a,fill:\"none\",stroke:\"currentColor\",\"stroke-width\":\"2\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\",children:t})}function we(e){return i(T,{...e,children:i(\"path\",{d:\"m6 9 6 6 6-6\"})})}function Pe({class:e}){return i(T,{class:e,children:[i(\"path\",{d:\"M15 3h6v6\"}),i(\"path\",{d:\"M10 14 21 3\"}),i(\"path\",{d:\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"})]})}function ke(e){return i(T,{...e,children:[i(\"path\",{d:\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\"}),i(\"path\",{d:\"M14 2v4a2 2 0 0 0 2 2h4\"})]})}function Ee(e){return i(T,{...e,children:i(\"path\",{d:\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 0-1.69.9L9.6 8H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2Z\"})})}function Ce({class:e,...t}){return i(T,{class:e,...t,children:i(\"path\",{d:\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"})})}function Ie({class:e,...t}){return i(T,{class:e,...t,children:[i(\"polyline\",{points:\"7 8 3 12 7 16\"}),i(\"line\",{x1:\"21\",x2:\"11\",y1:\"12\",y2:\"12\"}),i(\"line\",{x1:\"21\",x2:\"11\",y1:\"6\",y2:\"6\"}),i(\"line\",{x1:\"21\",x2:\"11\",y1:\"18\",y2:\"18\"})]})}function Fe({class:e,...t}){return i(T,{class:e,...t,children:i(\"path\",{d:\"M17 8L21 12L17 16M3 12H13M3 6H13M3 18H13\"})})}function Ae(e){return i(T,{...e,width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",children:i(\"path\",{d:\"M6 13L10 3\",\"stroke-linecap\":\"round\"})})}function Me({class:e,...t}){return i(T,{class:e,...t,children:[i(\"circle\",{cx:\"12\",cy:\"12\",r:\"4\"}),i(\"path\",{d:\"M12 2v2\"}),i(\"path\",{d:\"M12 20v2\"}),i(\"path\",{d:\"m4.93 4.93 1.41 1.41\"}),i(\"path\",{d:\"m17.66 17.66 1.41 1.41\"}),i(\"path\",{d:\"M2 12h2\"}),i(\"path\",{d:\"M20 12h2\"}),i(\"path\",{d:\"m6.34 17.66-1.41 1.41\"}),i(\"path\",{d:\"m19.07 4.93-1.41 1.41\"})]})}function Le({class:e,...t}){return i(T,{class:e,...t,children:[i(\"path\",{d:\"M12 2v2\"}),i(\"path\",{d:\"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715\"}),i(\"path\",{d:\"M16 12a4 4 0 0 0-4-4\"}),i(\"path\",{d:\"m19 5-1.256 1.256\"}),i(\"path\",{d:\"M20 12h2\"})]})}var Re={dirItem:\"inline-flex items-center shrink-0\",dirLink:\"text-sm text-muted-foreground hover:text-foreground\",fileItem:\"inline-flex items-center text-sm font-semibold text-foreground truncate\"},_n=\"shrink-0 mx-1 size-4 text-muted-foreground\";function xt({items:e}){return i(\"nav\",{\"aria-label\":\"Breadcrumb\",children:i(\"ol\",{class:\"flex items-center min-w-0\",children:e.map((t,n)=>{let r=n===e.length-1;return i(\"li\",{class:r?Re.fileItem:Re.dirItem,\"aria-current\":r?\"page\":void 0,children:r?t.label:i(P,{children:[i(\"a\",{class:Re.dirLink,href:t.href??\"#\",children:t.label}),i(Ae,{class:_n})]})},n)})})})}function Tt({href:e}){return i(\"a\",{href:e,target:\"_blank\",rel:\"noopener noreferrer\",class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:text-foreground cursor-pointer\",\"aria-label\":\"Open in new tab\",children:i(Pe,{class:\"size-4\"})})}function wt(){return i(\"button\",{type:\"button\",id:\"theme-toggle\",class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:text-foreground cursor-pointer\",\"aria-label\":\"Toggle theme\",children:[i(Me,{class:\"hidden size-4\",id:\"icon-theme-light\"}),i(Ce,{class:\"hidden size-4\",id:\"icon-theme-dark\"}),i(Le,{class:\"hidden size-4\",id:\"icon-theme-system\"})]})}function Pt({id:e,breadcrumbs:t,showSidebarToggle:n,onToggleSidebar:r,externalLinkHref:a}){return i(\"header\",{id:e,class:\"sticky top-0 z-50 bg-background border-b border-border\",children:i(\"div\",{class:\"flex items-center justify-between w-full py-2 px-2 sm:px-5\",children:[i(\"div\",{class:\"flex items-center gap-1 min-w-0\",children:[n&&i(\"button\",{type:\"button\",id:\"sidebar-toggle\",onClick:r,class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:bg-sidebar-accent cursor-pointer\",children:[i(Fe,{class:\"shrink-0 size-4\",id:\"icon-sidebar-open\"}),i(Ie,{class:\"shrink-0 size-4 hidden\",id:\"icon-sidebar-close\"})]}),i(xt,{items:t})]}),i(\"div\",{class:\"flex items-center gap-1\",children:[i(wt,{}),a!==void 0&&i(Tt,{href:a})]})]})})}var fn=20;function hn({node:e,currentPath:t,depth:n,isOpen:r,onToggle:a}){let o=r(e.path);return i(\"li\",{class:n===0?\"px-2 lg:px-5\":\"\",children:[i(\"button\",{type:\"button\",\"aria-expanded\":o,onClick:()=>a?.(e.path),class:\"flex items-center gap-x-3 w-full py-2 px-3 text-left text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-lg overflow-hidden\",children:[i(Ee,{class:\"shrink-0 size-4\"}),i(\"span\",{class:\"min-w-0 truncate\",children:e.name}),i(we,{class:`${o?\"\":\"-rotate-90 \"}shrink-0 size-3.5 ms-auto transition-transform`})]}),o&&i(\"ul\",{class:\"ps-7 mt-1 flex flex-col gap-y-1 relative before:absolute before:top-0 before:start-[1.125rem] before:w-px before:h-full before:bg-sidebar-border\",children:e.children&&n<fn?i(Ne,{nodes:e.children,currentPath:t,depth:n+1,isOpen:r,onToggle:a}):null})]})}function Ne({nodes:e,currentPath:t,depth:n=0,isOpen:r,onToggle:a}){return i(P,{children:e.map(o=>{if(o.type===\"directory\")return i(hn,{node:o,currentPath:t,depth:n,isOpen:r,onToggle:a},o.path);let s=t===o.path;return i(\"li\",{class:n===0?\"px-2 lg:px-5\":\"\",children:i(\"a\",{href:`/view?path=${encodeURIComponent(o.path)}`,class:`flex items-center gap-x-3 py-2 px-3 text-sm rounded-lg overflow-hidden ${s?\"bg-sidebar-accent text-sidebar-primary font-medium\":\"hover:bg-sidebar-accent text-sidebar-foreground\"}`,children:[i(ke,{class:\"shrink-0 size-4\"}),i(\"span\",{class:\"min-w-0 truncate\",children:o.name})]})},o.path)})})}function kt({nodes:e,currentPath:t,isOpen:n,onToggle:r}){return i(\"ul\",{id:\"file-tree\",class:\"flex flex-col gap-y-1\",children:i(Ne,{nodes:e,currentPath:t,isOpen:n,onToggle:r})})}function Et({title:e,tree:t,currentPath:n,onClose:r,isOpen:a,onToggle:o,searchQuery:s,onSearchChange:c,isSearching:u}){return i(P,{children:[i(\"div\",{role:\"none\",id:\"sidebar-overlay\",class:\"fixed inset-0 z-50 bg-black/50 hidden\",onClick:r}),i(\"aside\",{id:\"sidebar\",\"aria-label\":\"File navigation\",class:\"fixed inset-y-0 start-0 z-60 w-72 lg:w-auto overflow-hidden bg-sidebar border-e border-sidebar-border -translate-x-full\",children:[i(\"div\",{class:\"relative flex flex-col h-full max-h-full pt-3\",children:[i(\"header\",{class:\"flex-none h-11.5 ps-5 pe-2 lg:ps-8 flex items-center\",children:i(\"a\",{href:\"/\",class:\"flex-none text-sm font-semibold text-sidebar-foreground hover:text-sidebar-primary\",children:e})}),i(\"div\",{class:\"flex-none px-2 lg:px-5 mt-1.5 mb-1\",children:i(\"input\",{id:\"sidebar-search\",type:\"search\",\"aria-label\":\"Search files\",placeholder:\"Search files\\u2026\",value:s??\"\",onInput:d=>c?.(d.target.value),onKeyDown:d=>{d.key===\"Escape\"&&!d.isComposing&&(c?.(\"\"),d.currentTarget.blur())},class:\"w-full py-1.5 px-3 text-sm text-sidebar-foreground bg-sidebar-accent border border-sidebar-border rounded-lg outline-none focus:border-sidebar-primary placeholder:text-sidebar-foreground/50\"})}),i(\"div\",{class:\"flex-1 min-h-0 overflow-x-hidden overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-none [&::-webkit-scrollbar-track]:bg-scrollbar-track [&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb\",children:i(\"nav\",{class:\"pb-3 w-full flex flex-col\",children:u&&t.length===0?i(\"p\",{class:\"px-5 py-3 text-sm text-sidebar-foreground/60\",children:\"No matches found\"}):i(kt,{nodes:t,currentPath:n,isOpen:a,onToggle:o})})})]}),i(\"div\",{id:\"sidebar-resize\",class:\"absolute inset-y-0 end-0 w-1 cursor-col-resize hover:bg-sidebar-border hidden lg:block pointer-events-auto\"})]})]})}var mn=new Map([[\".md\",\"markdown\"],[\".html\",\"html\"],[\".htm\",\"html\"]]);function yn(e){let t=Math.max(e.lastIndexOf(\"/\"),e.lastIndexOf(\"\\\\\")),n=t===-1?e:e.slice(t+1),r=n.lastIndexOf(\".\");return r===-1||r===n.length-1?\"\":n.slice(r).toLowerCase()}function Ct(e){return mn.get(yn(e))??null}function It(e,t){return e.name.toLowerCase().includes(t)}function z(e,t){for(let n of e)if(n.type===\"directory\"&&t.startsWith(`${n.path}/`))return[n.path,...z(n.children??[],t)];return[]}function Ft(e,t){let n=t.trim().toLowerCase();return n===\"\"?e:At(e,n)}function At(e,t){let n=[];for(let r of e){if(r.type===\"directory\"){if(It(r,t)){n.push(r);continue}let a=r.children?At(r.children,t):[];a.length>0&&n.push({...r,children:a});continue}It(r,t)&&n.push(r)}return n}function Lt(e,t){return{expanded:new Set,revealed:new Set(z(e,t))}}function De(e,t){return e.expanded.has(t)||e.revealed.has(t)}function Rt(e,t,n){return De(e,n)?{expanded:Mt(e.expanded,n),revealed:Mt(e.revealed,n)}:{expanded:new Set([...e.expanded,...z(t,n),n]),revealed:e.revealed}}function Nt(e,t,n){return{expanded:e.expanded,revealed:new Set([...e.revealed,...z(t,n)])}}function Mt(e,t){let n=new Set(e);return n.delete(t),n}var He=\"file-tree-state\";function Dt(e){if(!e)return{};try{let t=JSON.parse(e);if(!t||typeof t!=\"object\"||Array.isArray(t))return{};let n={};for(let[r,a]of Object.entries(t)){if(!a||typeof a!=\"object\"||Array.isArray(a))continue;let{expanded:o,lastAccess:s}=a;typeof s!=\"number\"||!Array.isArray(o)||(n[r]={expanded:o.filter(c=>typeof c==\"string\"),lastAccess:s})}return n}catch{return{}}}function Ht(e,t,n){let r={};for(let[a,o]of Object.entries(e))t-o.lastAccess<=n&&(r[a]=o);return r}function Bt(e,t){return new Set(e[t]?.expanded??[])}function Be(e,t,n,r){return{...e,[t]:{expanded:Array.from(n),lastAccess:r}}}function Ot(e){return JSON.stringify(e)}function Ut(e,t,n){let[r,a]=k(()=>Lt(t,n)),o=C(!0),s=C(t);s.current=t;let c=C(r);c.current=r;function u(f){c.current=f,a(f)}function d(){try{return Dt(localStorage.getItem(He))}catch{return{}}}function p(f){try{localStorage.setItem(He,Ot(f))}catch{}}oe(()=>{if(!o.current)return;o.current=!1;let f=Date.now(),x=Ht(d(),f,2592e6),g=Bt(x,e);p(Be(x,e,g,f)),u({...c.current,expanded:g})},[e]);let h=A(f=>{let x=Rt(c.current,s.current,f);u(x),p(Be(d(),e,x.expanded,Date.now()))},[e]),l=A(f=>{u(Nt(c.current,s.current,f))},[]);return{isOpen:A(f=>De(r,f),[r]),toggle:h,reveal:l}}async function K(e,t){try{let n=e?`/api/content?path=${encodeURIComponent(e)}`:\"/api/content\",r=await fetch(n,t?.signal?{signal:t.signal}:void 0);return r.ok?await r.text():(console.error(`[peek] Failed to fetch content: HTTP ${r.status}`),null)}catch(n){if(n instanceof DOMException&&n.name===\"AbortError\")throw n;return console.error(\"[peek] Failed to fetch content:\",n),null}}async function jt(e){try{let t=await fetch(\"/api/tree\",e?.signal?{signal:e.signal}:void 0);if(!t.ok)return console.error(`[peek] Failed to fetch tree: HTTP ${t.status}`),null;let n=await t.json();return Array.isArray(n)?n:(console.error(\"[peek] Unexpected tree response format\"),null)}catch(t){if(t instanceof DOMException&&t.name===\"AbortError\")throw t;return console.error(\"[peek] Failed to fetch tree:\",t),null}}function se(e){let n=e.replace(/\\/+$/,\"\").split(\"/\");return n[n.length-1]||e}function $t(e){let t=C(null),n=C(e);n.current=e;let r=A(async(a,o)=>{t.current&&t.current.abort();let s=new AbortController;t.current=s;try{let c=await K(a,{signal:s.signal});if(c===null)return;n.current(a,c),document.title=`${se(a)} - peek`;let u=`/view?path=${encodeURIComponent(a)}`;o&&history.pushState({path:a},\"\",u)}catch(c){if(c instanceof DOMException&&c.name===\"AbortError\")return;console.error(\"[peek] Failed to navigate:\",c)}},[]);return D(()=>{let a=new URLSearchParams(window.location.search).get(\"path\");a&&history.replaceState({path:a},\"\");function o(c){if(c.ctrlKey||c.metaKey||c.shiftKey||c.altKey)return;let u=c.target.closest(\"a[href]\");if(!u)return;let d;try{d=new URL(u.href,window.location.origin)}catch{return}if(d.origin!==window.location.origin||d.pathname!==\"/view\")return;let p=d.searchParams.get(\"path\");p&&(c.preventDefault(),r(p,!0))}function s(c){let d=c.state?.path??new URLSearchParams(window.location.search).get(\"path\");d?r(d,!1):window.location.reload()}return document.addEventListener(\"click\",o),window.addEventListener(\"popstate\",s),()=>{document.removeEventListener(\"click\",o),window.removeEventListener(\"popstate\",s)}},[r]),r}var vn=\"sidebar-search\";function Sn(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===\"INPUT\"||t===\"TEXTAREA\"||t===\"SELECT\"||e.isContentEditable}function Wt(e){D(()=>{function t(n){n.key===\"/\"&&(n.isComposing||Sn(n.target)||(n.preventDefault(),e?.(),document.getElementById(vn)?.focus()))}return window.addEventListener(\"keydown\",t),()=>window.removeEventListener(\"keydown\",t)},[e])}var le=\"sidebar-open\",zt=\"sidebar-width\",Oe=200,Ue=480,bn=1024;function ce(){return window.innerWidth>=bn}function Kt(){let[e,t]=k(!1),n=C(!0);oe(()=>{if(n.current){n.current=!1;let s=localStorage.getItem(zt);if(s){let c=Number(s);c>=Oe&&c<=Ue&&document.documentElement.style.setProperty(\"--sidebar-width\",`${c}px`)}if(ce()&&localStorage.getItem(le)!==\"false\"){let c=[document.getElementById(\"sidebar\"),document.getElementById(\"header-bar\"),document.getElementById(\"main-content\")];for(let u of c)u&&(u.style.transition=\"none\");document.body.setAttribute(\"data-sidebar-open\",\"\"),document.body.offsetHeight,requestAnimationFrame(()=>{for(let u of c)u&&u.style.removeProperty(\"transition\")}),t(!0)}return}e?document.body.setAttribute(\"data-sidebar-open\",\"\"):document.body.removeAttribute(\"data-sidebar-open\")},[e]),D(()=>{let s=document.getElementById(\"sidebar-resize\");if(!s)return;let c=u=>{u.preventDefault(),s.setPointerCapture(u.pointerId);let d=document.getElementById(\"sidebar\");document.body.style.setProperty(\"user-select\",\"none\"),d?.style.setProperty(\"transition\",\"none\");function p(l){let _=Math.min(Math.max(l.clientX,Oe),Ue);document.documentElement.style.setProperty(\"--sidebar-width\",`${_}px`)}let h=l=>{if(s.releasePointerCapture(l.pointerId),s.removeEventListener(\"pointermove\",p),s.removeEventListener(\"pointerup\",h),s.removeEventListener(\"pointercancel\",h),document.body.style.removeProperty(\"user-select\"),d?.style.removeProperty(\"transition\"),l.type===\"pointerup\"){let _=Math.min(Math.max(l.clientX,Oe),Ue);localStorage.setItem(zt,String(_))}};s.addEventListener(\"pointermove\",p),s.addEventListener(\"pointerup\",h),s.addEventListener(\"pointercancel\",h)};return s.addEventListener(\"pointerdown\",c),()=>s.removeEventListener(\"pointerdown\",c)},[]);let r=A(()=>{t(s=>{let c=!s;return ce()&&localStorage.setItem(le,String(c)),c})},[]),a=A(()=>{t(!1),ce()&&localStorage.setItem(le,\"false\")},[]),o=A(()=>{t(!0),ce()&&localStorage.setItem(le,\"true\")},[]);return{toggle:r,close:a,open:o}}var je=\"[peek]\",$e={info:(...e)=>console.log(je,...e),warn:(...e)=>console.warn(je,...e),error:(...e)=>console.error(je,...e)};function Pn(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=\"object\")return null;let n=t;return typeof n.path!=\"string\"?null:{path:n.path}}function Vt(e){let t=0,n=null,r=null,a=null;function o(){r&&(clearTimeout(r),r=null);let s=new EventSource(\"/sse\");if(a=s,s.addEventListener(\"file-changed\",c=>{let u=Pn(c.data);e.onFileChanged(u?u.path:null)}),e.onTreeChanged){let c=e.onTreeChanged;s.addEventListener(\"tree-changed\",()=>{c()})}s.onerror=()=>{if(s.close(),a=null,r&&(clearTimeout(r),r=null),t++,t>10){$e.warn(`SSE connection lost after ${10} retries, giving up.`);return}let c=Math.min(1e3*2**(t-1),3e4);$e.info(`SSE reconnecting in ${c}ms (${t}/${10})...`),n=setTimeout(o,c)},r=setTimeout(()=>{t=0,r=null},5e3)}return o(),()=>{n&&clearTimeout(n),r&&clearTimeout(r),a&&a.close()}}function de(e){let{onContentUpdate:t,getCurrentPath:n,getCurrentContentType:r,onHtmlReload:a,onTreeUpdate:o}=e;D(()=>{let s=null,c=null,u=Vt({onFileChanged:d=>{if(n){if(d===null)return;let p=n();if(d!==p)return;if(r?.()===\"html\"){a?.();return}s?.abort(),s=new AbortController,K(p,{signal:s.signal}).then(h=>{h!==null&&t(h)}).catch(h=>{h instanceof DOMException&&h.name===\"AbortError\"||console.error(\"[peek] Failed to refresh content:\",h)})}else s?.abort(),s=new AbortController,K(void 0,{signal:s.signal}).then(p=>{p!==null&&t(p)}).catch(p=>{p instanceof DOMException&&p.name===\"AbortError\"||console.error(\"[peek] Failed to refresh content:\",p)})},onTreeChanged:o?()=>{c?.abort(),c=new AbortController,jt({signal:c.signal}).then(d=>{d&&o(d)}).catch(d=>{d instanceof DOMException&&d.name===\"AbortError\"||console.error(\"[peek] Failed to refresh tree:\",d)})}:void 0});return()=>{s?.abort(),c?.abort(),u()}},[])}function Xt({projectId:e,dirTitle:t,currentPath:n,contentType:r,content:a,tree:o}){let[s,c]=k(n),[u,d]=k(r),[p,h]=k(a),[l,_]=k(o),[f,x]=k(\"\"),[g,S]=k(0),m=C(s);m.current=s;let w=Kt(),M=Ut(e,l,n),I=f.trim()!==\"\",H=ie(()=>Ft(l,f),[l,f]);Wt(w.open),$t((F,E)=>{let L=Ct(F);if(!L){console.error(`Unexpected unsupported file type: ${F}`);return}m.current=F,c(F),d(L),h(E),S(0),M.reveal(F)});let j=C(u);j.current=u,de({getCurrentPath:()=>m.current,getCurrentContentType:()=>j.current,onContentUpdate:h,onHtmlReload:()=>S(F=>F+1),onTreeUpdate:_});let B=se(s);return i(P,{children:[i(Et,{title:t,tree:H,currentPath:s,onClose:w.close,isOpen:I?()=>!0:M.isOpen,onToggle:I?void 0:M.toggle,searchQuery:f,onSearchChange:x,isSearching:I}),i(Pt,{id:\"header-bar\",breadcrumbs:[{label:t,href:\"/\"},{label:B}],showSidebarToggle:!0,onToggleSidebar:w.toggle,externalLinkHref:`/${xe(s)}`}),i(bt,{contentType:u,fileTitle:B,filePath:s,htmlContent:p,htmlReloadKey:g})]})}function Yt({content:e}){let[t,n]=k(e);return de({onContentUpdate:n}),i(\"main\",{class:\"px-2 sm:px-5 py-5 sm:py-15\",children:i(\"div\",{class:\"max-w-4xl mx-auto\",children:i(ae,{htmlContent:t})})})}var Ve=\"theme\";function ze(){let e=localStorage.getItem(Ve);return e===\"light\"||e===\"dark\"?e:\"system\"}function Ke(e){let t=document.documentElement;e===\"dark\"?t.classList.add(\"dark\"):e===\"light\"?t.classList.remove(\"dark\"):window.matchMedia(\"(prefers-color-scheme: dark)\").matches?t.classList.add(\"dark\"):t.classList.remove(\"dark\")}function qt(e){let t=document.getElementById(\"icon-theme-light\"),n=document.getElementById(\"icon-theme-dark\"),r=document.getElementById(\"icon-theme-system\");!t||!n||!r||(t.classList.add(\"hidden\"),n.classList.add(\"hidden\"),r.classList.add(\"hidden\"),e===\"light\"?t.classList.remove(\"hidden\"):e===\"dark\"?n.classList.remove(\"hidden\"):r.classList.remove(\"hidden\"))}function kn(e){return e===\"light\"?\"dark\":e===\"dark\"?\"system\":\"light\"}function Qt(){let e=ze();Ke(e),qt(e);let t=document.getElementById(\"theme-toggle\");t&&t.addEventListener(\"click\",()=>{let n=kn(ze());n===\"system\"?localStorage.removeItem(Ve):localStorage.setItem(Ve,n),Ke(n),qt(n)}),window.matchMedia(\"(prefers-color-scheme: dark)\").addEventListener(\"change\",()=>{ze()===\"system\"&&Ke(\"system\")})}var ue=window.__INITIAL_STATE__,Xe=document.getElementById(\"app\");Xe&&ue?ue.mode===\"directory\"?te(i(Xt,{...ue}),Xe):te(i(Yt,{...ue}),Xe):console.error(\"[peek] hydration failed: missing #app or initial state\");Qt();})();\n";
|
|
1058
|
-
//#endregion
|
|
1059
|
-
|
|
1060
|
-
var global_default = "/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n@layer properties {\n @supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {\n *, :before, :after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-border-style: solid;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ease: initial;\n --tw-content: \"\";\n }\n }\n}\n\n@layer theme {\n :root, :host {\n --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\";\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n --color-black: #000;\n --spacing: .25rem;\n --container-4xl: 56rem;\n --text-sm: .875rem;\n --text-sm--line-height: calc(1.25 / .875);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --radius-lg: .5rem;\n --radius-xl: .75rem;\n --ease-in-out: cubic-bezier(.4, 0, .2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;\n --default-transition-duration: .15s;\n --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-muted-foreground: var(--muted-foreground);\n --color-border: var(--border);\n --color-sidebar: var(--sidebar);\n --color-sidebar-foreground: var(--sidebar-foreground);\n --color-sidebar-primary: var(--sidebar-primary);\n --color-sidebar-accent: var(--sidebar-accent);\n --color-sidebar-border: var(--sidebar-border);\n --color-scrollbar-track: var(--scrollbar-track);\n --color-scrollbar-thumb: var(--scrollbar-thumb);\n }\n}\n\n@layer base {\n *, :after, :before, ::backdrop {\n box-sizing: border-box;\n border: 0 solid;\n margin: 0;\n padding: 0;\n }\n\n ::file-selector-button {\n box-sizing: border-box;\n border: 0 solid;\n margin: 0;\n padding: 0;\n }\n\n html, :host {\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n line-height: 1.5;\n 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\");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n\n abbr:where([title]) {\n text-decoration: underline dotted;\n }\n\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n -webkit-text-decoration: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n\n b, strong {\n font-weight: bolder;\n }\n\n code, kbd, samp, pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n\n small {\n font-size: 80%;\n }\n\n sub, sup {\n vertical-align: baseline;\n font-size: 75%;\n line-height: 0;\n position: relative;\n }\n\n sub {\n bottom: -.25em;\n }\n\n sup {\n top: -.5em;\n }\n\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n\n :-moz-focusring:where(:not(iframe)) {\n outline: auto;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n summary {\n display: list-item;\n }\n\n ol, ul, menu {\n list-style: none;\n }\n\n img, svg, video, canvas, audio, iframe, embed, object {\n vertical-align: middle;\n display: block;\n }\n\n img, video {\n max-width: 100%;\n height: auto;\n }\n\n button, input, select, optgroup, textarea {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n opacity: 1;\n background-color: #0000;\n border-radius: 0;\n }\n\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n opacity: 1;\n background-color: #0000;\n border-radius: 0;\n }\n\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n\n ::placeholder {\n opacity: 1;\n }\n\n @supports (not ((-webkit-appearance: -apple-pay-button))) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: currentColor;\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n\n textarea {\n resize: vertical;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n\n ::-webkit-datetime-edit {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-year-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-month-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-day-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-hour-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-minute-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-second-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-millisecond-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n button, input:where([type=\"button\"], [type=\"reset\"], [type=\"submit\"]) {\n appearance: button;\n }\n\n ::file-selector-button {\n appearance: button;\n }\n\n ::-webkit-inner-spin-button {\n height: auto;\n }\n\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n [hidden]:where(:not([hidden=\"until-found\"])) {\n display: none !important;\n }\n}\n\n@layer components;\n\n@layer utilities {\n .pointer-events-auto {\n pointer-events: auto;\n }\n\n .collapse {\n visibility: collapse;\n }\n\n .visible {\n visibility: visible;\n }\n\n .absolute {\n position: absolute;\n }\n\n .fixed {\n position: fixed;\n }\n\n .relative {\n position: relative;\n }\n\n .sticky {\n position: sticky;\n }\n\n .inset-0 {\n inset: 0;\n }\n\n .inset-y-0 {\n inset-block: 0;\n }\n\n .start-0 {\n inset-inline-start: calc(var(--spacing) * 0);\n }\n\n .end-0 {\n inset-inline-end: calc(var(--spacing) * 0);\n }\n\n .top-0 {\n top: 0;\n }\n\n .z-50 {\n z-index: 50;\n }\n\n .z-60 {\n z-index: 60;\n }\n\n .container {\n width: 100%;\n }\n\n @media (width >= 40rem) {\n .container {\n max-width: 40rem;\n }\n }\n\n @media (width >= 48rem) {\n .container {\n max-width: 48rem;\n }\n }\n\n @media (width >= 64rem) {\n .container {\n max-width: 64rem;\n }\n }\n\n @media (width >= 80rem) {\n .container {\n max-width: 80rem;\n }\n }\n\n @media (width >= 96rem) {\n .container {\n max-width: 96rem;\n }\n }\n\n .mx-1 {\n margin-inline: var(--spacing);\n }\n\n .mx-auto {\n margin-inline: auto;\n }\n\n .ms-auto {\n margin-inline-start: auto;\n }\n\n .mt-1 {\n margin-top: var(--spacing);\n }\n\n .mt-1\\.5 {\n margin-top: calc(var(--spacing) * 1.5);\n }\n\n .mb-1 {\n margin-bottom: var(--spacing);\n }\n\n .block {\n display: block;\n }\n\n .contents {\n display: contents;\n }\n\n .flex {\n display: flex;\n }\n\n .hidden {\n display: none;\n }\n\n .inline {\n display: inline;\n }\n\n .inline-flex {\n display: inline-flex;\n }\n\n .table {\n display: table;\n }\n\n .size-3\\.5 {\n width: calc(var(--spacing) * 3.5);\n height: calc(var(--spacing) * 3.5);\n }\n\n .size-4 {\n width: calc(var(--spacing) * 4);\n height: calc(var(--spacing) * 4);\n }\n\n .h-7 {\n height: calc(var(--spacing) * 7);\n }\n\n .h-11\\.5 {\n height: calc(var(--spacing) * 11.5);\n }\n\n .h-full {\n height: 100%;\n }\n\n .max-h-full {\n max-height: 100%;\n }\n\n .min-h-0 {\n min-height: 0;\n }\n\n .min-h-dvh {\n min-height: 100dvh;\n }\n\n .min-h-screen {\n min-height: 100vh;\n }\n\n .w-1 {\n width: var(--spacing);\n }\n\n .w-7 {\n width: calc(var(--spacing) * 7);\n }\n\n .w-72 {\n width: calc(var(--spacing) * 72);\n }\n\n .w-full {\n width: 100%;\n }\n\n .max-w-4xl {\n max-width: var(--container-4xl);\n }\n\n .min-w-0 {\n min-width: 0;\n }\n\n .flex-1 {\n flex: 1;\n }\n\n .flex-none {\n flex: none;\n }\n\n .shrink-0 {\n flex-shrink: 0;\n }\n\n .border-collapse {\n border-collapse: collapse;\n }\n\n .-translate-x-full {\n --tw-translate-x: -100%;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n\n .-rotate-90 {\n rotate: -90deg;\n }\n\n .transform {\n transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );\n }\n\n .animate-pulse {\n animation: var(--animate-pulse);\n }\n\n .animate-spin {\n animation: var(--animate-spin);\n }\n\n .cursor-col-resize {\n cursor: col-resize;\n }\n\n .cursor-pointer {\n cursor: pointer;\n }\n\n .resize {\n resize: both;\n }\n\n .flex-col {\n flex-direction: column;\n }\n\n .flex-wrap {\n flex-wrap: wrap;\n }\n\n .items-center {\n align-items: center;\n }\n\n .justify-between {\n justify-content: space-between;\n }\n\n .justify-center {\n justify-content: center;\n }\n\n .gap-1 {\n gap: var(--spacing);\n }\n\n .gap-x-3 {\n column-gap: calc(var(--spacing) * 3);\n }\n\n .gap-y-1 {\n row-gap: var(--spacing);\n }\n\n .truncate {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n\n .overflow-hidden {\n overflow: hidden;\n }\n\n .overflow-x-hidden {\n overflow-x: hidden;\n }\n\n .overflow-y-auto {\n overflow-y: auto;\n }\n\n .rounded-lg {\n border-radius: var(--radius-lg);\n }\n\n .rounded-xl {\n border-radius: var(--radius-xl);\n }\n\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n\n .border-e {\n border-inline-end-style: var(--tw-border-style);\n border-inline-end-width: 1px;\n }\n\n .border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n }\n\n .border-border {\n border-color: var(--color-border);\n }\n\n .border-sidebar-border {\n border-color: var(--color-sidebar-border);\n }\n\n .bg-background {\n background-color: var(--color-background);\n }\n\n .bg-black\\/50 {\n background-color: #00000080;\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .bg-black\\/50 {\n background-color: color-mix(in oklab, var(--color-black) 50%, transparent);\n }\n }\n\n .bg-card {\n background-color: var(--color-card);\n }\n\n .bg-sidebar {\n background-color: var(--color-sidebar);\n }\n\n .bg-sidebar-accent {\n background-color: var(--color-sidebar-accent);\n }\n\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n\n .px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n\n .px-6 {\n padding-inline: calc(var(--spacing) * 6);\n }\n\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n\n .py-3 {\n padding-block: calc(var(--spacing) * 3);\n }\n\n .py-5 {\n padding-block: calc(var(--spacing) * 5);\n }\n\n .py-8 {\n padding-block: calc(var(--spacing) * 8);\n }\n\n .ps-5 {\n padding-inline-start: calc(var(--spacing) * 5);\n }\n\n .ps-7 {\n padding-inline-start: calc(var(--spacing) * 7);\n }\n\n .pe-2 {\n padding-inline-end: calc(var(--spacing) * 2);\n }\n\n .pt-3 {\n padding-top: calc(var(--spacing) * 3);\n }\n\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n\n .text-left {\n text-align: left;\n }\n\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n\n .text-foreground {\n color: var(--color-foreground);\n }\n\n .text-muted-foreground {\n color: var(--color-muted-foreground);\n }\n\n .text-sidebar-foreground, .text-sidebar-foreground\\/60 {\n color: var(--color-sidebar-foreground);\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .text-sidebar-foreground\\/60 {\n color: color-mix(in oklab, var(--color-sidebar-foreground) 60%, transparent);\n }\n }\n\n .text-sidebar-primary {\n color: var(--color-sidebar-primary);\n }\n\n .italic {\n font-style: italic;\n }\n\n .shadow-2xs {\n --tw-shadow: 0 1px var(--tw-shadow-color, #0000000d);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n\n .transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n\n .transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n\n .ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n }\n\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n\n .placeholder\\:text-sidebar-foreground\\/50::placeholder {\n color: var(--color-sidebar-foreground);\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .placeholder\\:text-sidebar-foreground\\/50::placeholder {\n color: color-mix(in oklab, var(--color-sidebar-foreground) 50%, transparent);\n }\n }\n\n .before\\:absolute:before {\n content: var(--tw-content);\n position: absolute;\n }\n\n .before\\:start-\\[1\\.125rem\\]:before {\n content: var(--tw-content);\n inset-inline-start: 1.125rem;\n }\n\n .before\\:top-0:before {\n content: var(--tw-content);\n top: 0;\n }\n\n .before\\:h-full:before {\n content: var(--tw-content);\n height: 100%;\n }\n\n .before\\:w-px:before {\n content: var(--tw-content);\n width: 1px;\n }\n\n .before\\:bg-sidebar-border:before {\n content: var(--tw-content);\n background-color: var(--color-sidebar-border);\n }\n\n @media (hover: hover) {\n .hover\\:bg-sidebar-accent:hover {\n background-color: var(--color-sidebar-accent);\n }\n\n .hover\\:bg-sidebar-border:hover {\n background-color: var(--color-sidebar-border);\n }\n\n .hover\\:text-foreground:hover {\n color: var(--color-foreground);\n }\n\n .hover\\:text-sidebar-primary:hover {\n color: var(--color-sidebar-primary);\n }\n }\n\n .focus\\:border-sidebar-primary:focus {\n border-color: var(--color-sidebar-primary);\n }\n\n @media (width >= 40rem) {\n .sm\\:px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n\n .sm\\:px-10 {\n padding-inline: calc(var(--spacing) * 10);\n }\n\n .sm\\:py-10 {\n padding-block: calc(var(--spacing) * 10);\n }\n\n .sm\\:py-15 {\n padding-block: calc(var(--spacing) * 15);\n }\n }\n\n @media (width >= 64rem) {\n .lg\\:block {\n display: block;\n }\n\n .lg\\:w-auto {\n width: auto;\n }\n\n .lg\\:px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n\n .lg\\:ps-8 {\n padding-inline-start: calc(var(--spacing) * 8);\n }\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar\\]\\:w-2::-webkit-scrollbar {\n width: calc(var(--spacing) * 2);\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar-thumb\\]\\:rounded-none::-webkit-scrollbar-thumb {\n border-radius: 0;\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar-thumb\\]\\:bg-scrollbar-thumb::-webkit-scrollbar-thumb {\n background-color: var(--color-scrollbar-thumb);\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar-track\\]\\:bg-scrollbar-track::-webkit-scrollbar-track {\n background-color: var(--color-scrollbar-track);\n }\n}\n\n:root {\n --background: #fff;\n --foreground: #393a34;\n --card: #fff;\n --card-foreground: #393a34;\n --primary: #1c6b48;\n --primary-foreground: #fff;\n --muted: #f7f7f7;\n --muted-foreground: #6a737d;\n --border: #f0f0f0;\n --sidebar: #fff;\n --sidebar-foreground: #4e4f47;\n --sidebar-primary: #1c6b48;\n --sidebar-accent: #f7f7f7;\n --sidebar-accent-foreground: #393a34;\n --sidebar-border: #f0f0f0;\n --font-sans: ui-sans-serif, system-ui, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n --scrollbar-track: #f7f7f7;\n --scrollbar-thumb: #393a3450;\n --radius: .5rem;\n}\n\n.dark {\n --background: #121212;\n --foreground: #dbd7caee;\n --card: #181818;\n --card-foreground: #dbd7caee;\n --primary: #4d9375;\n --primary-foreground: #121212;\n --muted: #181818;\n --muted-foreground: #959da5;\n --border: #191919;\n --sidebar: #121212;\n --sidebar-foreground: #bfbaaa;\n --sidebar-primary: #4d9375;\n --sidebar-accent: #181818;\n --sidebar-accent-foreground: #dbd7caee;\n --sidebar-border: #191919;\n --scrollbar-track: #181818;\n --scrollbar-thumb: #dedcd550;\n}\n\n#sidebar {\n transition: translate .3s;\n}\n\nbody[data-sidebar-open] #sidebar {\n translate: 0;\n}\n\nbody[data-sidebar-open] #sidebar-overlay {\n display: block;\n}\n\nbody[data-sidebar-open] #icon-sidebar-open {\n display: none;\n}\n\nbody[data-sidebar-open] #icon-sidebar-close {\n display: inline;\n}\n\n@media (width >= 1024px) {\n #sidebar {\n width: var(--sidebar-width, 18rem);\n }\n\n #header-bar, #main-content {\n transition: margin .3s;\n }\n\n body[data-sidebar-open] #sidebar-overlay {\n display: none;\n }\n\n body[data-sidebar-open] #header-bar, body[data-sidebar-open] #main-content {\n margin-inline-start: var(--sidebar-width, 18rem);\n }\n}\n\n@property --tw-translate-x {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-translate-y {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-translate-z {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-rotate-x {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-rotate-y {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-rotate-z {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-skew-x {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-skew-y {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-border-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n\n@property --tw-font-weight {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-shadow-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-shadow-alpha {\n syntax: \"<percentage>\";\n inherits: false;\n initial-value: 100%;\n}\n\n@property --tw-inset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-inset-shadow-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-inset-shadow-alpha {\n syntax: \"<percentage>\";\n inherits: false;\n initial-value: 100%;\n}\n\n@property --tw-ring-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-inset-ring-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-inset-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-ring-inset {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-ring-offset-width {\n syntax: \"<length>\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-ring-offset-color {\n syntax: \"*\";\n inherits: false;\n initial-value: #fff;\n}\n\n@property --tw-ring-offset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-ease {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-content {\n syntax: \"*\";\n inherits: false;\n initial-value: \"\";\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes pulse {\n 50% {\n opacity: .5;\n }\n}\n";
|
|
1061
|
-
|
|
1062
|
-
|
|
1297
|
+
// src/server/renderer/client-bundle.js
|
|
1298
|
+
const clientBundle = "\"use strict\";(()=>{var ne,y,ot,mn,D,et,it,at,he,Q,W,st,ve,ye,ge,hn,G={},ee=[],yn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,re=Array.isArray;function L(e,t){for(var n in t)e[n]=t[n];return e}function be(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function gn(e,t,n){var r,a,i,s={};for(i in t)i==\"key\"?r=t[i]:i==\"ref\"?a=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?ne.call(arguments,2):n),typeof e==\"function\"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return Z(e,s,r,a,null)}function Z(e,t,n,r,a){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:a??++ot,__i:-1,__u:0};return a==null&&y.vnode!=null&&y.vnode(i),i}function w(e){return e.children}function J(e,t){this.props=e,this.context=t}function B(e,t){if(t==null)return e.__?B(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==\"function\"?B(e):null}function vn(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],i=L({},t);i.__v=t.__v+1,y.vnode&&y.vnode(i),Se(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??B(t),!!(32&t.__u),a),i.__v=t.__v,i.__.__k[i.__i]=i,pt(r,i,a),t.__e=t.__=null,i.__e!=n&<(i)}}function lt(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),lt(e)}function tt(e){(!e.__d&&(e.__d=!0)&&D.push(e)&&!te.__r++||et!=y.debounceRendering)&&((et=y.debounceRendering)||it)(te)}function te(){try{for(var e,t=1;D.length;)D.length>t&&D.sort(at),e=D.shift(),t=D.length,vn(e)}finally{D.length=te.__r=0}}function ct(e,t,n,r,a,i,s,c,u,d,p){var f,l,_,m,P,g,S=r&&r.__k||ee,h=t.length;for(u=bn(n,t,S,u,h),f=0;f<h;f++)(_=n.__k[f])!=null&&(l=_.__i!=-1&&S[_.__i]||G,_.__i=f,g=Se(e,_,l,a,i,s,c,u,d,p),m=_.__e,_.ref&&l.ref!=_.ref&&(l.ref&&xe(l.ref,null,_),p.push(_.ref,_.__c||m,_)),P==null&&m!=null&&(P=m),4&_.__u?(u=dt(_,u,e),l.__e&&(l.__e=null)):typeof _.type==\"function\"&&g!==void 0?u=g:m&&(u=m.nextSibling),_.__u&=-7);return n.__e=P,u}function bn(e,t,n,r,a){var i,s,c,u,d,p=n.length,f=p,l=0;for(e.__k=new Array(a),i=0;i<a;i++)(s=t[i])!=null&&typeof s!=\"boolean\"&&typeof s!=\"function\"?(typeof s==\"string\"||typeof s==\"number\"||typeof s==\"bigint\"||s.constructor==String?s=e.__k[i]=Z(null,s,null,null,null):re(s)?s=e.__k[i]=Z(w,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[i]=Z(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,u=i+l,s.__=e,s.__b=e.__b+1,c=null,(d=s.__i=Sn(s,n,u,f))!=-1&&(f--,(c=n[d])&&(c.__u|=2)),c==null||c.__v==null?(d==-1&&(a>p?l--:a<p&&l++),typeof s.type!=\"function\"&&(s.__u|=4)):d!=u&&(d==u-1?l--:d==u+1?l++:(d>u?l--:l++,s.__u|=4))):e.__k[i]=null;if(f)for(i=0;i<p;i++)(c=n[i])!=null&&(2&c.__u)==0&&(c.__e==r&&(r=B(c)),_t(c,c));return r}function dt(e,t,n){var r,a;if(typeof e.type==\"function\"){for(r=e.__k,a=0;r&&a<r.length;a++)r[a]&&(r[a].__=e,t=dt(r[a],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=B(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Sn(e,t,n,r){var a,i,s,c=e.key,u=e.type,d=t[n],p=d!=null&&(2&d.__u)==0;if(d===null&&c==null||p&&c==d.key&&u==d.type)return n;if(r>(p?1:0)){for(a=n-1,i=n+1;a>=0||i<t.length;)if((d=t[s=a>=0?a--:i++])!=null&&(2&d.__u)==0&&c==d.key&&u==d.type)return s}return-1}function nt(e,t,n){t[0]==\"-\"?e.setProperty(t,n??\"\"):e[t]=n==null?\"\":typeof n!=\"number\"||yn.test(t)?n:n+\"px\"}function Y(e,t,n,r,a){var i,s;e:if(t==\"style\")if(typeof n==\"string\")e.style.cssText=n;else{if(typeof r==\"string\"&&(e.style.cssText=r=\"\"),r)for(t in r)n&&t in n||nt(e.style,t,\"\");if(n)for(t in n)r&&n[t]==r[t]||nt(e.style,t,n[t])}else if(t[0]==\"o\"&&t[1]==\"n\")i=t!=(t=t.replace(st,\"$1\")),s=t.toLowerCase(),t=s in e||t==\"onFocusOut\"||t==\"onFocusIn\"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[W]=r[W]:(n[W]=ve,e.addEventListener(t,i?ge:ye,i)):e.removeEventListener(t,i?ge:ye,i);else{if(a==\"http://www.w3.org/2000/svg\")t=t.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(t!=\"width\"&&t!=\"height\"&&t!=\"href\"&&t!=\"list\"&&t!=\"form\"&&t!=\"tabIndex\"&&t!=\"download\"&&t!=\"rowSpan\"&&t!=\"colSpan\"&&t!=\"role\"&&t!=\"popover\"&&t in e)try{e[t]=n??\"\";break e}catch{}typeof n==\"function\"||(n==null||n===!1&&t[4]!=\"-\"?e.removeAttribute(t):e.setAttribute(t,t==\"popover\"&&n==1?\"\":n))}}function rt(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Q]==null)t[Q]=ve++;else if(t[Q]<n[W])return;return n(y.event?y.event(t):t)}}}function Se(e,t,n,r,a,i,s,c,u,d){var p,f,l,_,m,P,g,S,h,C,A,I,N,j,U,H,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),i=[c=t.__e=n.__e]),(p=y.__b)&&p(t);e:if(typeof T==\"function\"){f=s.length;try{if(h=t.props,C=T.prototype&&T.prototype.render,A=(p=T.contextType)&&r[p.__c],I=p?A?A.props.value:p.__:r,n.__c?S=(l=t.__c=n.__c).__=l.__E:(C?t.__c=l=new T(h,I):(t.__c=l=new J(h,I),l.constructor=T,l.render=Pn),A&&A.sub(l),l.state||(l.state={}),l.__n=r,_=l.__d=!0,l.__h=[],l._sb=[]),C&&l.__s==null&&(l.__s=l.state),C&&T.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=L({},l.__s)),L(l.__s,T.getDerivedStateFromProps(h,l.__s))),m=l.props,P=l.state,l.__v=t,_)C&&T.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),C&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(C&&T.getDerivedStateFromProps==null&&h!==m&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(h,I),t.__v==n.__v||!l.__e&&l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(h,l.__s,I)===!1){t.__v!=n.__v&&(l.props=h,l.state=l.__s,l.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(R){R&&(R.__=t)}),ee.push.apply(l.__h,l._sb),l._sb=[],l.__h.length&&s.push(l),c=B(n);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(h,l.__s,I),C&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(m,P,g)})}if(l.context=I,l.props=h,l.__P=e,l.__e=!1,N=y.__r,j=0,C)l.state=l.__s,l.__d=!1,N&&N(t),p=l.render(l.props,l.state,l.context),ee.push.apply(l.__h,l._sb),l._sb=[];else do l.__d=!1,N&&N(t),p=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++j<25);l.state=l.__s,l.getChildContext!=null&&(r=L(L({},r),l.getChildContext())),C&&!_&&l.getSnapshotBeforeUpdate!=null&&(g=l.getSnapshotBeforeUpdate(m,P)),U=p!=null&&p.type===w&&p.key==null?ft(p.props.children):p,c=ct(e,re(U)?U:[U],t,n,r,a,i,s,c,u,d),l.base=t.__e,t.__u&=-161,l.__h.length&&s.push(l),S&&(l.__E=l.__=null)}catch(R){if(s.length=f,t.__v=null,u||i!=null){if(R.then){for(t.__u|=u?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;i!=null&&(i[i.indexOf(c)]=null),t.__e=c}else if(i!=null)for(H=i.length;H--;)be(i[H])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),R.then||ut(t),y.__e(R,t,n)}}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=xn(n.__e,t,n,r,a,i,s,u,d);return(p=y.diffed)&&p(t),128&t.__u?void 0:c}function ut(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ut))}function pt(e,t,n){for(var r=0;r<n.length;r++)xe(n[r],n[++r],n[++r]);y.__c&&y.__c(t,e),e.some(function(a){try{e=a.__h,a.__h=[],e.some(function(i){i.call(a)})}catch(i){y.__e(i,a.__v)}})}function ft(e){return typeof e!=\"object\"||e==null||e.__b>0?e:re(e)?e.map(ft):e.constructor!==void 0?null:L({},e)}function xn(e,t,n,r,a,i,s,c,u){var d,p,f,l,_,m,P,g=n.props||G,S=t.props,h=t.type;if(h==\"svg\"?a=\"http://www.w3.org/2000/svg\":h==\"math\"?a=\"http://www.w3.org/1998/Math/MathML\":a||(a=\"http://www.w3.org/1999/xhtml\"),i!=null){for(d=0;d<i.length;d++)if((_=i[d])&&\"setAttribute\"in _==!!h&&(h?_.localName==h:_.nodeType==3)){e=_,i[d]=null;break}}if(e==null){if(h==null)return document.createTextNode(S);e=document.createElementNS(a,h,S.is&&S),c&&(y.__m&&y.__m(t,i),c=!1),i=null}if(h==null)g===S||c&&e.data==S||(e.data=S);else{if(i=h==\"textarea\"&&S.defaultValue!=null?null:i&&ne.call(e.childNodes),!c&&i!=null)for(g={},d=0;d<e.attributes.length;d++)g[(_=e.attributes[d]).name]=_.value;for(d in g)_=g[d],d==\"dangerouslySetInnerHTML\"?f=_:d==\"children\"||d in S||d==\"value\"&&\"defaultValue\"in S||d==\"checked\"&&\"defaultChecked\"in S||Y(e,d,null,_,a);for(d in S)_=S[d],d==\"children\"?l=_:d==\"dangerouslySetInnerHTML\"?p=_:d==\"value\"?m=_:d==\"checked\"?P=_:c&&typeof _!=\"function\"||g[d]===_||Y(e,d,_,g[d],a);if(p)c||f&&(p.__html==f.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(f&&(e.innerHTML=\"\"),ct(t.type==\"template\"?e.content:e,re(l)?l:[l],t,n,r,h==\"foreignObject\"?\"http://www.w3.org/1999/xhtml\":a,i,s,i?i[0]:n.__k&&B(n,0),c,u),i!=null)for(d=i.length;d--;)be(i[d]);c&&h!=\"textarea\"||(d=\"value\",h==\"progress\"&&m==null?e.removeAttribute(\"value\"):m!=null&&(m!==e[d]||h==\"progress\"&&!m||h==\"option\"&&m!=g[d])&&Y(e,d,m,g[d],a),d=\"checked\",P!=null&&P!=e[d]&&Y(e,d,P,g[d],a))}return e}function xe(e,t,n){try{if(typeof e==\"function\"){var r=typeof e.__u==\"function\";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(a){y.__e(a,n)}}function _t(e,t,n){var r,a;if(y.unmount&&y.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||xe(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){y.__e(i,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&_t(r[a],t,n||typeof e.type!=\"function\");n||be(e.__e),e.__c=e.__=e.__e=void 0}function Pn(e,t,n){return this.constructor(e,n)}function Tn(e,t,n){var r,a,i,s;t==document&&(t=document.documentElement),y.__&&y.__(e,t),a=(r=typeof n==\"function\")?null:n&&n.__k||t.__k,i=[],s=[],Se(t,e=(!r&&n||t).__k=gn(w,null,[e]),a||G,G,t.namespaceURI,!r&&n?[n]:a?null:t.firstChild?ne.call(t.childNodes):null,i,!r&&n?n:a?a.__e:t.firstChild,r,s),pt(i,e,s),e.props.children=null}function oe(e,t){Tn(e,t,oe)}ne=ee.slice,y={__e:function(e,t,n,r){for(var a,i,s;t=t.__;)if((a=t.__c)&&!a.__)try{if((i=a.constructor)&&i.getDerivedStateFromError!=null&&(a.setState(i.getDerivedStateFromError(e)),s=a.__d),a.componentDidCatch!=null&&(a.componentDidCatch(e,r||{}),s=a.__d),s)return a.__E=a}catch(c){e=c}throw e}},ot=0,mn=function(e){return e!=null&&e.constructor===void 0},J.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=L({},this.state),typeof e==\"function\"&&(e=e(L({},n),this.props)),e&&L(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),tt(this))},J.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),tt(this))},J.prototype.render=w,D=[],it=typeof Promise==\"function\"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,at=function(e,t){return e.__v.__b-t.__v.__b},te.__r=0,he=Math.random().toString(8),Q=\"__d\"+he,W=\"__a\"+he,st=/(PointerCapture)$|Capture$/i,ve=0,ye=rt(!1),ge=rt(!0),hn=0;var $,v,Pe,mt,K=0,Pt=[],x=y,ht=x.__b,yt=x.__r,gt=x.diffed,vt=x.__c,bt=x.unmount,St=x.__;function ae(e,t){x.__h&&x.__h(v,e,K||t),K=0;var n=v.__H||(v.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function E(e){return K=1,wn(Tt,e)}function wn(e,t,n){var r=ae($++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Tt(void 0,t),function(c){var u=r.__N?r.__N[0]:r.__[0],d=r.t(u,c);u!==d&&(r.__N=[d,r.__[1]],r.__c.setState({}))}],r.__c=v,!v.__f)){var a=function(c,u,d){if(!r.__c.__H)return!0;var p=!1,f=r.__c.props!==c;if(r.__c.__H.__.some(function(_){if(_.__N){p=!0;var m=_.__[0];_.__=_.__N,_.__N=void 0,m!==_.__[0]&&(f=!0)}}),i){var l=i.call(this,c,u,d);return p?l||f:l}return!p||f};v.__f=!0;var i=v.shouldComponentUpdate,s=v.componentWillUpdate;v.componentWillUpdate=function(c,u,d){if(this.__e){var p=i;i=void 0,a(c,u,d),i=p}s&&s.call(this,c,u,d)},v.shouldComponentUpdate=a}return r.__N||r.__}function F(e,t){var n=ae($++,3);!x.__s&&we(n.__H,t)&&(n.__=e,n.u=t,v.__H.__h.push(n))}function se(e,t){var n=ae($++,4);!x.__s&&we(n.__H,t)&&(n.__=e,n.u=t,v.__h.push(n))}function k(e){return K=5,q(function(){return{current:e}},[])}function q(e,t){var n=ae($++,7);return we(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function M(e,t){return K=8,q(function(){return e},t)}function kn(){for(var e;e=Pt.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ie),t.__h.some(Te),t.__h=[]}catch(n){t.__h=[],x.__e(n,e.__v)}}}x.__b=function(e){v=null,ht&&ht(e)},x.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),St&&St(e,t)},x.__r=function(e){yt&&yt(e),$=0;var t=(v=e.__c).__H;t&&(Pe===v?(t.__h=[],v.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ie),t.__h.some(Te),t.__h=[],$=0)),Pe=v},x.diffed=function(e){gt&>(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pt.push(t)!==1&&mt===x.requestAnimationFrame||((mt=x.requestAnimationFrame)||En)(kn)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Pe=v=null},x.__c=function(e,t){t.some(function(n){try{n.__h.some(ie),n.__h=n.__h.filter(function(r){return!r.__||Te(r)})}catch(r){t.some(function(a){a.__h&&(a.__h=[])}),t=[],x.__e(r,n.__v)}}),vt&&vt(e,t)},x.unmount=function(e){bt&&bt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(r){try{ie(r)}catch(a){t=a}}),n.__H=void 0,t&&x.__e(t,n.__v))};var xt=typeof requestAnimationFrame==\"function\";function En(e){var t,n=function(){clearTimeout(r),xt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);xt&&(t=requestAnimationFrame(n))}function ie(e){var t=v,n=e.__c;typeof n==\"function\"&&(e.__c=void 0,n()),v=t}function Te(e){var t=v;e.__c=e.__(),v=t}function we(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Tt(e,t){return typeof t==\"function\"?t(e):t}var wt={border:\"none\",width:\"100%\",height:\"100%\",position:\"absolute\",top:\"0\",left:\"0\"};var Cn=\"/__peek/raw/\";function ke(e){return e.split(\"/\").map(encodeURIComponent).join(\"/\")}function le(e){return`${Cn}${ke(e)}`}var kt=\"/__peek/print\";function Et(e){return`${kt}?file=${encodeURIComponent(e)}`}function Ct(e){return`${kt}?dir=${encodeURIComponent(e??\"\")}`}var In=0;function o(e,t,n,r,a,i){t||(t={});var s,c,u=t;if(\"ref\"in u)for(c in u={},t)c==\"ref\"?s=t[c]:u[c]=t[c];var d={type:e,props:u,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--In,__i:-1,__u:0,__source:a,__self:i};if(typeof e==\"function\"&&(s=e.defaultProps))for(c in s)u[c]===void 0&&(u[c]=s[c]);return y.vnode&&y.vnode(d),d}function Ee({class:e,children:t}){return o(\"main\",{id:\"main-content\",class:e??\"\",children:t})}function ce({htmlContent:e}){return o(\"div\",{id:\"markdown-content\",class:\"markdown-body\",dangerouslySetInnerHTML:{__html:e}})}function It({contentType:e,fileTitle:t,filePath:n,htmlContent:r,htmlReloadKey:a,markdownClass:i=\"px-5 sm:px-10 py-5 sm:py-10\"}){return e===\"html\"?o(Ee,{class:\"relative flex-1 overflow-hidden\",children:o(\"iframe\",{title:t,src:le(n),style:wt},a)}):o(Ee,{class:i,children:o(\"div\",{class:\"max-w-4xl mx-auto\",children:o(ce,{htmlContent:r})})})}function b({class:e,children:t,width:n=\"24\",height:r=\"24\",viewBox:a=\"0 0 24 24\",...i}){return o(\"svg\",{...i,class:e,\"aria-hidden\":\"true\",xmlns:\"http://www.w3.org/2000/svg\",width:n,height:r,viewBox:a,fill:\"none\",stroke:\"currentColor\",\"stroke-width\":\"2\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\",children:t})}function Ce(e){return o(b,{...e,children:o(\"path\",{d:\"m6 9 6 6 6-6\"})})}function Ie({class:e}){return o(b,{class:e,children:[o(\"path\",{d:\"M15 3h6v6\"}),o(\"path\",{d:\"M10 14 21 3\"}),o(\"path\",{d:\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\"})]})}function Fe(e){return o(b,{...e,children:[o(\"path\",{d:\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\"}),o(\"path\",{d:\"M14 2v4a2 2 0 0 0 2 2h4\"}),o(\"path\",{d:\"M12 18v-6\"}),o(\"path\",{d:\"m9 15 3 3 3-3\"})]})}function z(e){return o(b,{...e,children:[o(\"path\",{d:\"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\"}),o(\"path\",{d:\"M14 2v4a2 2 0 0 0 2 2h4\"})]})}function V(e){return o(b,{...e,children:o(\"path\",{d:\"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 0-1.69.9L9.6 8H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2Z\"})})}function Me({class:e,...t}){return o(b,{class:e,...t,children:o(\"path\",{d:\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"})})}function Ae({class:e,...t}){return o(b,{class:e,...t,children:[o(\"polyline\",{points:\"7 8 3 12 7 16\"}),o(\"line\",{x1:\"21\",x2:\"11\",y1:\"12\",y2:\"12\"}),o(\"line\",{x1:\"21\",x2:\"11\",y1:\"6\",y2:\"6\"}),o(\"line\",{x1:\"21\",x2:\"11\",y1:\"18\",y2:\"18\"})]})}function Le({class:e,...t}){return o(b,{class:e,...t,children:o(\"path\",{d:\"M17 8L21 12L17 16M3 12H13M3 6H13M3 18H13\"})})}function Re(e){return o(b,{...e,width:\"16\",height:\"16\",viewBox:\"0 0 16 16\",children:o(\"path\",{d:\"M6 13L10 3\",\"stroke-linecap\":\"round\"})})}function De({class:e,...t}){return o(b,{class:e,...t,children:[o(\"circle\",{cx:\"12\",cy:\"12\",r:\"4\"}),o(\"path\",{d:\"M12 2v2\"}),o(\"path\",{d:\"M12 20v2\"}),o(\"path\",{d:\"m4.93 4.93 1.41 1.41\"}),o(\"path\",{d:\"m17.66 17.66 1.41 1.41\"}),o(\"path\",{d:\"M2 12h2\"}),o(\"path\",{d:\"M20 12h2\"}),o(\"path\",{d:\"m6.34 17.66-1.41 1.41\"}),o(\"path\",{d:\"m19.07 4.93-1.41 1.41\"})]})}function Ne({class:e,...t}){return o(b,{class:e,...t,children:[o(\"path\",{d:\"M12 2v2\"}),o(\"path\",{d:\"M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715\"}),o(\"path\",{d:\"M16 12a4 4 0 0 0-4-4\"}),o(\"path\",{d:\"m19 5-1.256 1.256\"}),o(\"path\",{d:\"M20 12h2\"})]})}var He={dirItem:\"inline-flex items-center shrink-0\",dirLink:\"text-sm text-muted-foreground hover:text-foreground\",fileItem:\"inline-flex items-center text-sm font-semibold text-foreground truncate\"},Fn=\"shrink-0 mx-1 size-4 text-muted-foreground\";function Ft({items:e}){return o(\"nav\",{\"aria-label\":\"Breadcrumb\",children:o(\"ol\",{class:\"flex items-center min-w-0\",children:e.map((t,n)=>{let r=n===e.length-1;return o(\"li\",{class:r?He.fileItem:He.dirItem,\"aria-current\":r?\"page\":void 0,children:r?t.label:o(w,{children:[o(\"a\",{class:He.dirLink,href:t.href??\"#\",children:t.label}),o(Re,{class:Fn})]})},n)})})})}function Mt({href:e}){return o(\"a\",{href:e,target:\"_blank\",rel:\"noopener noreferrer\",class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:text-foreground cursor-pointer\",\"aria-label\":\"Open in new tab\",children:o(Ie,{class:\"size-4\"})})}function At(){return o(\"button\",{type:\"button\",id:\"theme-toggle\",class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:text-foreground cursor-pointer\",\"aria-label\":\"Toggle theme\",children:[o(De,{class:\"hidden size-4\",id:\"icon-theme-light\"}),o(Me,{class:\"hidden size-4\",id:\"icon-theme-dark\"}),o(Ne,{class:\"hidden size-4\",id:\"icon-theme-system\"})]})}function Lt({id:e,breadcrumbs:t,showSidebarToggle:n,onToggleSidebar:r,externalLinkHref:a,actions:i}){return o(\"header\",{id:e,class:\"sticky top-0 z-50 bg-background border-b border-border\",children:o(\"div\",{class:\"flex items-center justify-between w-full py-2 px-2 sm:px-5\",children:[o(\"div\",{class:\"flex items-center gap-1 min-w-0\",children:[n&&o(\"button\",{type:\"button\",id:\"sidebar-toggle\",onClick:r,class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:bg-sidebar-accent cursor-pointer\",children:[o(Le,{class:\"shrink-0 size-4\",id:\"icon-sidebar-open\"}),o(Ae,{class:\"shrink-0 size-4 hidden\",id:\"icon-sidebar-close\"})]}),o(Ft,{items:t})]}),o(\"div\",{class:\"flex items-center gap-1\",children:[i,o(At,{}),a!==void 0&&o(Mt,{href:a})]})]})})}var Mn=new Map([[\".md\",\"markdown\"],[\".html\",\"html\"],[\".htm\",\"html\"]]);function Be(e){let t=Math.max(e.lastIndexOf(\"/\"),e.lastIndexOf(\"\\\\\")),n=t===-1?e:e.slice(t+1),r=n.lastIndexOf(\".\");return r===-1||r===n.length-1?\"\":n.slice(r).toLowerCase()}function de(e){return Mn.get(Be(e))??null}function Rt(e,t){return e.name.toLowerCase().includes(t)}function O(e,t){for(let n of e)if(n.type===\"directory\"&&t.startsWith(`${n.path}/`))return[n.path,...O(n.children??[],t)];return[]}function Dt(e,t){let n=t.trim().toLowerCase();return n===\"\"?e:Nt(e,n)}function Nt(e,t){let n=[];for(let r of e){if(r.type===\"directory\"){if(Rt(r,t)){n.push(r);continue}let a=r.children?Nt(r.children,t):[];a.length>0&&n.push({...r,children:a});continue}Rt(r,t)&&n.push(r)}return n}var Oe=200;function An(e){let t=e.slice(e.lastIndexOf(\"/\")+1),n=Be(t);return n===\"\"?t:t.slice(0,-n.length)}function Ln(e,t){return e===null?t:e.slice(e.lastIndexOf(\"/\")+1)}function Bt(e){return e===0?\"empty\":e>Oe?\"too-many\":\"ok\"}function Ot(e){return e.flatMap(t=>t.type===\"directory\"?Ot(t.children??[]):de(t.path)===\"markdown\"?[t.path]:[])}function Ut(e,t){for(let n of e)if(n.type===\"directory\"){if(n.path===t)return n.children??[];if(t.startsWith(`${n.path}/`))return Ut(n.children??[],t)}}function Rn(e,t){let n=t===null?e:Ut(e,t);return n&&Ot(n)}function Ht(e,t,n){return{path:t,name:Ln(t,n),markdownFileCount:Rn(e,t)?.length??0}}function $t(e,t,n){return[Ht(e,null,n),...O(e,t).map(r=>Ht(e,r,n))]}function jt(e,t){return{url:t===\"html\"?le(e):Et(e),title:An(e)}}function Wt(e){return{url:Ct(e.path),title:e.name}}function Kt(e,t,n){switch(e){case\"Escape\":return{type:\"close\",returnFocus:!0};case\"Tab\":return{type:\"close\",returnFocus:!1}}if(n!==0)switch(e){case\"ArrowDown\":return{type:\"focus\",index:t<0?0:(t+1)%n};case\"ArrowUp\":return{type:\"focus\",index:t<0?n-1:(t-1+n)%n};case\"Home\":return{type:\"focus\",index:0};case\"End\":return{type:\"focus\",index:n-1};default:return}}var Dn=\"flex items-center gap-x-3 w-full py-2 px-3 text-left text-sm text-foreground rounded-md enabled:cursor-pointer enabled:hover:bg-sidebar-accent focus-visible:bg-sidebar-accent disabled:opacity-50\";function Nn(e){switch(Bt(e)){case\"empty\":return{description:\"No Markdown files\",disabled:!0};case\"too-many\":return{description:`More than ${Oe} Markdown files`,disabled:!0};case\"ok\":return{description:`${e} Markdown file${e===1?\"\":\"s\"}`,disabled:!1}}}function Hn({icon:e,label:t,description:n,disabled:r,onSelect:a}){return o(\"button\",{type:\"button\",role:\"menuitem\",disabled:r,onClick:a,class:Dn,children:[e,o(\"span\",{class:\"min-w-0 flex-1\",children:[o(\"span\",{class:\"block truncate\",children:t}),o(\"span\",{class:\"block text-xs text-muted-foreground\",children:n})]})]})}function Bn({currentPath:e,currentName:t,contentType:n,directories:r}){return[{kind:\"file\",key:`file:${e}`,label:t,description:\"This file\",disabled:!1,request:jt(e,n)},...r.map(a=>({kind:\"directory\",key:`dir:${a.path??\"\"}`,label:a.name,...Nn(a.markdownFileCount),request:Wt(a)}))]}function qt({onPrint:e,...t}){let[n,r]=E(!1),a=k(null),i=k(null),s=k(null),c=()=>Array.from(s.current?.querySelectorAll(\"[role=menuitem]:not(:disabled)\")??[]);F(()=>{if(!n)return;c()[0]?.focus();let f=_=>{a.current?.contains(_.target)||r(!1)},l=()=>r(!1);return document.addEventListener(\"pointerdown\",f),window.addEventListener(\"blur\",l),()=>{document.removeEventListener(\"pointerdown\",f),window.removeEventListener(\"blur\",l)}},[n]);let u=()=>{r(!1),i.current?.focus()},d=f=>{u(),e(f)};return o(\"div\",{ref:a,class:\"relative\",children:[o(\"button\",{ref:i,type:\"button\",id:\"pdf-menu-button\",\"aria-label\":\"Save as PDF\",\"aria-haspopup\":\"menu\",\"aria-expanded\":n,\"aria-controls\":n?\"pdf-menu\":void 0,onClick:()=>r(f=>!f),onKeyDown:f=>{(f.key===\"ArrowDown\"||f.key===\"ArrowUp\")&&(f.preventDefault(),r(!0))},class:\"shrink-0 w-7 h-7 inline-flex justify-center items-center rounded-lg text-muted-foreground hover:text-foreground cursor-pointer\",children:o(Fe,{class:\"size-4\"})}),n&&o(\"div\",{ref:s,id:\"pdf-menu\",role:\"menu\",\"aria-labelledby\":\"pdf-menu-button\",onKeyDown:f=>{let l=c(),_=Kt(f.key,l.indexOf(document.activeElement),l.length);if(_){if(_.type===\"focus\")l[_.index]?.focus();else if(_.returnFocus)u();else{r(!1);return}f.preventDefault()}},class:\"absolute end-0 top-full mt-1 z-60 w-64 max-w-[calc(100vw-1rem)] p-1 bg-background border border-muted-foreground/25 rounded-lg shadow-lg\",children:[o(\"p\",{\"aria-hidden\":\"true\",class:\"px-3 pt-1.5 pb-1 text-xs font-medium text-muted-foreground\",children:\"Save as PDF\"}),Bn(t).map(f=>o(w,{children:[o(Hn,{icon:f.kind===\"file\"?o(z,{class:\"shrink-0 size-4\"}):o(V,{class:\"shrink-0 size-4\"}),label:f.label,description:f.description,disabled:f.disabled,onSelect:()=>d(f.request)}),f.kind===\"file\"&&o(\"hr\",{class:\"my-1 border-border\"})]},f.key))]})]})}var On=20;function Un({node:e,currentPath:t,depth:n,isOpen:r,onToggle:a}){let i=r(e.path);return o(\"li\",{class:n===0?\"px-2 lg:px-5\":\"\",children:[o(\"button\",{type:\"button\",\"aria-expanded\":i,onClick:()=>a?.(e.path),class:\"flex items-center gap-x-3 w-full py-2 px-3 text-left text-sm text-sidebar-foreground hover:bg-sidebar-accent rounded-lg overflow-hidden\",children:[o(V,{class:\"shrink-0 size-4\"}),o(\"span\",{class:\"min-w-0 truncate\",children:e.name}),o(Ce,{class:`${i?\"\":\"-rotate-90 \"}shrink-0 size-3.5 ms-auto transition-transform`})]}),i&&o(\"ul\",{class:\"ps-7 mt-1 flex flex-col gap-y-1 relative before:absolute before:top-0 before:start-[1.125rem] before:w-px before:h-full before:bg-sidebar-border\",children:e.children&&n<On?o(Ue,{nodes:e.children,currentPath:t,depth:n+1,isOpen:r,onToggle:a}):null})]})}function Ue({nodes:e,currentPath:t,depth:n=0,isOpen:r,onToggle:a}){return o(w,{children:e.map(i=>{if(i.type===\"directory\")return o(Un,{node:i,currentPath:t,depth:n,isOpen:r,onToggle:a},i.path);let s=t===i.path;return o(\"li\",{class:n===0?\"px-2 lg:px-5\":\"\",children:o(\"a\",{href:`/view?path=${encodeURIComponent(i.path)}`,class:`flex items-center gap-x-3 py-2 px-3 text-sm rounded-lg overflow-hidden ${s?\"bg-sidebar-accent text-sidebar-primary font-medium\":\"hover:bg-sidebar-accent text-sidebar-foreground\"}`,children:[o(z,{class:\"shrink-0 size-4\"}),o(\"span\",{class:\"min-w-0 truncate\",children:i.name})]})},i.path)})})}function zt({nodes:e,currentPath:t,isOpen:n,onToggle:r}){return o(\"ul\",{id:\"file-tree\",class:\"flex flex-col gap-y-1\",children:o(Ue,{nodes:e,currentPath:t,isOpen:n,onToggle:r})})}function Vt({title:e,tree:t,currentPath:n,onClose:r,isOpen:a,onToggle:i,searchQuery:s,onSearchChange:c,isSearching:u}){return o(w,{children:[o(\"div\",{role:\"none\",id:\"sidebar-overlay\",class:\"fixed inset-0 z-50 bg-black/50 hidden\",onClick:r}),o(\"aside\",{id:\"sidebar\",\"aria-label\":\"File navigation\",class:\"fixed inset-y-0 start-0 z-60 w-72 lg:w-auto overflow-hidden bg-sidebar border-e border-sidebar-border -translate-x-full\",children:[o(\"div\",{class:\"relative flex flex-col h-full max-h-full pt-3\",children:[o(\"header\",{class:\"flex-none h-11.5 ps-5 pe-2 lg:ps-8 flex items-center\",children:o(\"a\",{href:\"/\",class:\"flex-none text-sm font-semibold text-sidebar-foreground hover:text-sidebar-primary\",children:e})}),o(\"div\",{class:\"flex-none px-2 lg:px-5 mt-1.5 mb-1\",children:o(\"input\",{id:\"sidebar-search\",type:\"search\",\"aria-label\":\"Search files\",placeholder:\"Search files\\u2026\",value:s??\"\",onInput:d=>c?.(d.target.value),onKeyDown:d=>{d.key===\"Escape\"&&!d.isComposing&&(c?.(\"\"),d.currentTarget.blur())},class:\"w-full py-1.5 px-3 text-sm text-sidebar-foreground bg-sidebar-accent border border-sidebar-border rounded-lg outline-none focus:border-sidebar-primary placeholder:text-sidebar-foreground/50\"})}),o(\"div\",{class:\"flex-1 min-h-0 overflow-x-hidden overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-none [&::-webkit-scrollbar-track]:bg-scrollbar-track [&::-webkit-scrollbar-thumb]:bg-scrollbar-thumb\",children:o(\"nav\",{class:\"pb-3 w-full flex flex-col\",children:u&&t.length===0?o(\"p\",{class:\"px-5 py-3 text-sm text-sidebar-foreground/60\",children:\"No matches found\"}):o(zt,{nodes:t,currentPath:n,isOpen:a,onToggle:i})})})]}),o(\"div\",{id:\"sidebar-resize\",class:\"absolute inset-y-0 end-0 w-1 cursor-col-resize hover:bg-sidebar-border hidden lg:block pointer-events-auto\"})]})]})}function Yt(e,t){return{expanded:new Set,revealed:new Set(O(e,t))}}function $e(e,t){return e.expanded.has(t)||e.revealed.has(t)}function Qt(e,t,n){return $e(e,n)?{expanded:Xt(e.expanded,n),revealed:Xt(e.revealed,n)}:{expanded:new Set([...e.expanded,...O(t,n),n]),revealed:e.revealed}}function Zt(e,t,n){return{expanded:e.expanded,revealed:new Set([...e.revealed,...O(t,n)])}}function Xt(e,t){let n=new Set(e);return n.delete(t),n}var je=\"file-tree-state\";function Jt(e){if(!e)return{};try{let t=JSON.parse(e);if(!t||typeof t!=\"object\"||Array.isArray(t))return{};let n={};for(let[r,a]of Object.entries(t)){if(!a||typeof a!=\"object\"||Array.isArray(a))continue;let{expanded:i,lastAccess:s}=a;typeof s!=\"number\"||!Array.isArray(i)||(n[r]={expanded:i.filter(c=>typeof c==\"string\"),lastAccess:s})}return n}catch{return{}}}function Gt(e,t,n){let r={};for(let[a,i]of Object.entries(e))t-i.lastAccess<=n&&(r[a]=i);return r}function en(e,t){return new Set(e[t]?.expanded??[])}function We(e,t,n,r){return{...e,[t]:{expanded:Array.from(n),lastAccess:r}}}function tn(e){return JSON.stringify(e)}function nn(e,t,n){let[r,a]=E(()=>Yt(t,n)),i=k(!0),s=k(t);s.current=t;let c=k(r);c.current=r;function u(m){c.current=m,a(m)}function d(){try{return Jt(localStorage.getItem(je))}catch{return{}}}function p(m){try{localStorage.setItem(je,tn(m))}catch{}}se(()=>{if(!i.current)return;i.current=!1;let m=Date.now(),P=Gt(d(),m,2592e6),g=en(P,e);p(We(P,e,g,m)),u({...c.current,expanded:g})},[e]);let f=M(m=>{let P=Qt(c.current,s.current,m);u(P),p(We(d(),e,P.expanded,Date.now()))},[e]),l=M(m=>{u(Zt(c.current,s.current,m))},[]);return{isOpen:M(m=>$e(r,m),[r]),toggle:f,reveal:l}}async function X(e,t){try{let n=e?`/api/content?path=${encodeURIComponent(e)}`:\"/api/content\",r=await fetch(n,t?.signal?{signal:t.signal}:void 0);return r.ok?await r.text():(console.error(`[peek] Failed to fetch content: HTTP ${r.status}`),null)}catch(n){if(n instanceof DOMException&&n.name===\"AbortError\")throw n;return console.error(\"[peek] Failed to fetch content:\",n),null}}async function rn(e){try{let t=await fetch(\"/api/tree\",e?.signal?{signal:e.signal}:void 0);if(!t.ok)return console.error(`[peek] Failed to fetch tree: HTTP ${t.status}`),null;let n=await t.json();return Array.isArray(n)?n:(console.error(\"[peek] Unexpected tree response format\"),null)}catch(t){if(t instanceof DOMException&&t.name===\"AbortError\")throw t;return console.error(\"[peek] Failed to fetch tree:\",t),null}}function ue(e){let n=e.replace(/\\/+$/,\"\").split(\"/\");return n[n.length-1]||e}function on(e){let t=k(null),n=k(e);n.current=e;let r=M(async(a,i)=>{t.current&&t.current.abort();let s=new AbortController;t.current=s;try{let c=await X(a,{signal:s.signal});if(c===null)return;n.current(a,c),document.title=`${ue(a)} - peek`;let u=`/view?path=${encodeURIComponent(a)}`;i&&history.pushState({path:a},\"\",u)}catch(c){if(c instanceof DOMException&&c.name===\"AbortError\")return;console.error(\"[peek] Failed to navigate:\",c)}},[]);return F(()=>{let a=new URLSearchParams(window.location.search).get(\"path\");a&&history.replaceState({path:a},\"\");function i(c){if(c.ctrlKey||c.metaKey||c.shiftKey||c.altKey)return;let u=c.target.closest(\"a[href]\");if(!u)return;let d;try{d=new URL(u.href,window.location.origin)}catch{return}if(d.origin!==window.location.origin||d.pathname!==\"/view\")return;let p=d.searchParams.get(\"path\");p&&(c.preventDefault(),r(p,!0))}function s(c){let d=c.state?.path??new URLSearchParams(window.location.search).get(\"path\");d?r(d,!1):window.location.reload()}return document.addEventListener(\"click\",i),window.addEventListener(\"popstate\",s),()=>{document.removeEventListener(\"click\",i),window.removeEventListener(\"popstate\",s)}},[r]),r}var jn=\"sidebar-search\";function Wn(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===\"INPUT\"||t===\"TEXTAREA\"||t===\"SELECT\"||e.isContentEditable}function an(e){F(()=>{function t(n){n.key===\"/\"&&(n.isComposing||Wn(n.target)||(n.preventDefault(),e?.(),document.getElementById(jn)?.focus()))}return window.addEventListener(\"keydown\",t),()=>window.removeEventListener(\"keydown\",t)},[e])}var pe=\"sidebar-open\",sn=\"sidebar-width\",Ke=200,qe=480,Kn=1024;function fe(){return window.innerWidth>=Kn}function ln(){let[e,t]=E(!1),n=k(!0);se(()=>{if(n.current){n.current=!1;let s=localStorage.getItem(sn);if(s){let c=Number(s);c>=Ke&&c<=qe&&document.documentElement.style.setProperty(\"--sidebar-width\",`${c}px`)}if(fe()&&localStorage.getItem(pe)!==\"false\"){let c=[document.getElementById(\"sidebar\"),document.getElementById(\"header-bar\"),document.getElementById(\"main-content\")];for(let u of c)u&&(u.style.transition=\"none\");document.body.setAttribute(\"data-sidebar-open\",\"\"),document.body.offsetHeight,requestAnimationFrame(()=>{for(let u of c)u&&u.style.removeProperty(\"transition\")}),t(!0)}return}e?document.body.setAttribute(\"data-sidebar-open\",\"\"):document.body.removeAttribute(\"data-sidebar-open\")},[e]),F(()=>{let s=document.getElementById(\"sidebar-resize\");if(!s)return;let c=u=>{u.preventDefault(),s.setPointerCapture(u.pointerId);let d=document.getElementById(\"sidebar\");document.body.style.setProperty(\"user-select\",\"none\"),d?.style.setProperty(\"transition\",\"none\");function p(l){let _=Math.min(Math.max(l.clientX,Ke),qe);document.documentElement.style.setProperty(\"--sidebar-width\",`${_}px`)}let f=l=>{if(s.releasePointerCapture(l.pointerId),s.removeEventListener(\"pointermove\",p),s.removeEventListener(\"pointerup\",f),s.removeEventListener(\"pointercancel\",f),document.body.style.removeProperty(\"user-select\"),d?.style.removeProperty(\"transition\"),l.type===\"pointerup\"){let _=Math.min(Math.max(l.clientX,Ke),qe);localStorage.setItem(sn,String(_))}};s.addEventListener(\"pointermove\",p),s.addEventListener(\"pointerup\",f),s.addEventListener(\"pointercancel\",f)};return s.addEventListener(\"pointerdown\",c),()=>s.removeEventListener(\"pointerdown\",c)},[]);let r=M(()=>{t(s=>{let c=!s;return fe()&&localStorage.setItem(pe,String(c)),c})},[]),a=M(()=>{t(!1),fe()&&localStorage.setItem(pe,\"false\")},[]),i=M(()=>{t(!0),fe()&&localStorage.setItem(pe,\"true\")},[]);return{toggle:r,close:a,open:i}}var ze=\"[peek]\",Ve={info:(...e)=>console.log(ze,...e),warn:(...e)=>console.warn(ze,...e),error:(...e)=>console.error(ze,...e)};function Xn(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=\"object\")return null;let n=t;return typeof n.path!=\"string\"?null:{path:n.path}}function cn(e){let t=0,n=null,r=null,a=null;function i(){r&&(clearTimeout(r),r=null);let s=new EventSource(\"/sse\");if(a=s,s.addEventListener(\"file-changed\",c=>{let u=Xn(c.data);e.onFileChanged(u?u.path:null)}),e.onTreeChanged){let c=e.onTreeChanged;s.addEventListener(\"tree-changed\",()=>{c()})}s.onerror=()=>{if(s.close(),a=null,r&&(clearTimeout(r),r=null),t++,t>10){Ve.warn(`SSE connection lost after ${10} retries, giving up.`);return}let c=Math.min(1e3*2**(t-1),3e4);Ve.info(`SSE reconnecting in ${c}ms (${t}/${10})...`),n=setTimeout(i,c)},r=setTimeout(()=>{t=0,r=null},5e3)}return i(),()=>{n&&clearTimeout(n),r&&clearTimeout(r),a&&a.close()}}function _e(e){let{onContentUpdate:t,getCurrentPath:n,getCurrentContentType:r,onHtmlReload:a,onTreeUpdate:i}=e;F(()=>{let s=null,c=null,u=cn({onFileChanged:d=>{if(n){if(d===null)return;let p=n();if(d!==p)return;if(r?.()===\"html\"){a?.();return}s?.abort(),s=new AbortController,X(p,{signal:s.signal}).then(f=>{f!==null&&t(f)}).catch(f=>{f instanceof DOMException&&f.name===\"AbortError\"||console.error(\"[peek] Failed to refresh content:\",f)})}else s?.abort(),s=new AbortController,X(void 0,{signal:s.signal}).then(p=>{p!==null&&t(p)}).catch(p=>{p instanceof DOMException&&p.name===\"AbortError\"||console.error(\"[peek] Failed to refresh content:\",p)})},onTreeChanged:i?()=>{c?.abort(),c=new AbortController,rn({signal:c.signal}).then(d=>{d&&i(d)}).catch(d=>{d instanceof DOMException&&d.name===\"AbortError\"||console.error(\"[peek] Failed to refresh tree:\",d)})}:void 0});return()=>{s?.abort(),c?.abort(),u()}},[])}function Yn(e,t,n){let r=n(e);return r?(r.addEventListener(\"load\",()=>{r.document.contentType===\"text/html\"&&(r.document.title=t,r.addEventListener(\"afterprint\",()=>r.close(),{once:!0}),r.print())},{once:!0}),!0):!1}var Qn=\"Pop-ups are blocked. Allow pop-ups for this site to save as PDF.\";function dn({url:e,title:t},n){Yn(e,t,r=>n.open(r,\"_blank\"))||n.alert(Qn)}function un({projectId:e,dirTitle:t,currentPath:n,contentType:r,content:a,tree:i}){let[s,c]=E(n),[u,d]=E(r),[p,f]=E(a),[l,_]=E(i),[m,P]=E(\"\"),[g,S]=E(0),h=k(s);h.current=s;let C=ln(),A=nn(e,l,n),I=m.trim()!==\"\",N=q(()=>Dt(l,m),[l,m]);an(C.open),on((T,R)=>{let Ge=de(T);if(!Ge){console.error(`Unexpected unsupported file type: ${T}`);return}h.current=T,c(T),d(Ge),f(R),S(0),A.reveal(T)});let j=k(u);j.current=u,_e({getCurrentPath:()=>h.current,getCurrentContentType:()=>j.current,onContentUpdate:f,onHtmlReload:()=>S(T=>T+1),onTreeUpdate:_});let U=q(()=>$t(l,s,t),[l,s,t]),H=ue(s);return o(w,{children:[o(Vt,{title:t,tree:N,currentPath:s,onClose:C.close,isOpen:I?()=>!0:A.isOpen,onToggle:I?void 0:A.toggle,searchQuery:m,onSearchChange:P,isSearching:I}),o(Lt,{id:\"header-bar\",breadcrumbs:[{label:t,href:\"/\"},{label:H}],showSidebarToggle:!0,onToggleSidebar:C.toggle,externalLinkHref:`/${ke(s)}`,actions:o(qt,{currentPath:s,currentName:H,contentType:u,directories:U,onPrint:T=>dn(T,window)})}),o(It,{contentType:u,fileTitle:H,filePath:s,htmlContent:p,htmlReloadKey:g})]})}function pn({content:e}){let[t,n]=E(e);return _e({onContentUpdate:n}),o(\"main\",{class:\"px-2 sm:px-5 py-5 sm:py-15\",children:o(\"div\",{class:\"max-w-4xl mx-auto\",children:o(ce,{htmlContent:t})})})}var Ze=\"theme\";function Ye(){let e=localStorage.getItem(Ze);return e===\"light\"||e===\"dark\"?e:\"system\"}function Qe(e){let t=document.documentElement;e===\"dark\"?t.classList.add(\"dark\"):e===\"light\"?t.classList.remove(\"dark\"):window.matchMedia(\"(prefers-color-scheme: dark)\").matches?t.classList.add(\"dark\"):t.classList.remove(\"dark\")}function fn(e){let t=document.getElementById(\"icon-theme-light\"),n=document.getElementById(\"icon-theme-dark\"),r=document.getElementById(\"icon-theme-system\");!t||!n||!r||(t.classList.add(\"hidden\"),n.classList.add(\"hidden\"),r.classList.add(\"hidden\"),e===\"light\"?t.classList.remove(\"hidden\"):e===\"dark\"?n.classList.remove(\"hidden\"):r.classList.remove(\"hidden\"))}function Zn(e){return e===\"light\"?\"dark\":e===\"dark\"?\"system\":\"light\"}function _n(){let e=Ye();Qe(e),fn(e);let t=document.getElementById(\"theme-toggle\");t&&t.addEventListener(\"click\",()=>{let n=Zn(Ye());n===\"system\"?localStorage.removeItem(Ze):localStorage.setItem(Ze,n),Qe(n),fn(n)}),window.matchMedia(\"(prefers-color-scheme: dark)\").addEventListener(\"change\",()=>{Ye()===\"system\"&&Qe(\"system\")})}var me=window.__INITIAL_STATE__,Je=document.getElementById(\"app\");Je&&me?me.mode===\"directory\"?oe(o(un,{...me}),Je):oe(o(pn,{...me}),Je):console.error(\"[peek] hydration failed: missing #app or initial state\");_n();})();\n";
|
|
1299
|
+
// src/server/renderer/global.css?inline
|
|
1300
|
+
var global_default = "/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */\n@layer properties {\n @supports (((-webkit-hyphens: none)) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {\n *, :before, :after, ::backdrop {\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-translate-z: 0;\n --tw-rotate-x: initial;\n --tw-rotate-y: initial;\n --tw-rotate-z: initial;\n --tw-skew-x: initial;\n --tw-skew-y: initial;\n --tw-border-style: solid;\n --tw-font-weight: initial;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-color: initial;\n --tw-shadow-alpha: 100%;\n --tw-inset-shadow: 0 0 #0000;\n --tw-inset-shadow-color: initial;\n --tw-inset-shadow-alpha: 100%;\n --tw-ring-color: initial;\n --tw-ring-shadow: 0 0 #0000;\n --tw-inset-ring-color: initial;\n --tw-inset-ring-shadow: 0 0 #0000;\n --tw-ring-inset: initial;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-blur: initial;\n --tw-brightness: initial;\n --tw-contrast: initial;\n --tw-grayscale: initial;\n --tw-hue-rotate: initial;\n --tw-invert: initial;\n --tw-opacity: initial;\n --tw-saturate: initial;\n --tw-sepia: initial;\n --tw-drop-shadow: initial;\n --tw-drop-shadow-color: initial;\n --tw-drop-shadow-alpha: 100%;\n --tw-drop-shadow-size: initial;\n --tw-ease: initial;\n --tw-content: \"\";\n }\n }\n}\n\n@layer theme {\n :root, :host {\n --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\";\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;\n --color-black: #000;\n --spacing: .25rem;\n --container-4xl: 56rem;\n --text-xs: .75rem;\n --text-xs--line-height: calc(1 / .75);\n --text-sm: .875rem;\n --text-sm--line-height: calc(1.25 / .875);\n --font-weight-medium: 500;\n --font-weight-semibold: 600;\n --radius-md: .375rem;\n --radius-lg: .5rem;\n --radius-xl: .75rem;\n --ease-in-out: cubic-bezier(.4, 0, .2, 1);\n --animate-spin: spin 1s linear infinite;\n --animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;\n --default-transition-duration: .15s;\n --default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);\n --default-font-family: var(--font-sans);\n --default-mono-font-family: var(--font-mono);\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-muted-foreground: var(--muted-foreground);\n --color-border: var(--border);\n --color-sidebar: var(--sidebar);\n --color-sidebar-foreground: var(--sidebar-foreground);\n --color-sidebar-primary: var(--sidebar-primary);\n --color-sidebar-accent: var(--sidebar-accent);\n --color-sidebar-border: var(--sidebar-border);\n --color-scrollbar-track: var(--scrollbar-track);\n --color-scrollbar-thumb: var(--scrollbar-thumb);\n }\n}\n\n@layer base {\n *, :after, :before, ::backdrop {\n box-sizing: border-box;\n border: 0 solid;\n margin: 0;\n padding: 0;\n }\n\n ::file-selector-button {\n box-sizing: border-box;\n border: 0 solid;\n margin: 0;\n padding: 0;\n }\n\n html, :host {\n -webkit-text-size-adjust: 100%;\n tab-size: 4;\n line-height: 1.5;\n 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\");\n font-feature-settings: var(--default-font-feature-settings, normal);\n font-variation-settings: var(--default-font-variation-settings, normal);\n -webkit-tap-highlight-color: transparent;\n }\n\n hr {\n height: 0;\n color: inherit;\n border-top-width: 1px;\n }\n\n abbr:where([title]) {\n text-decoration: underline dotted;\n }\n\n h1, h2, h3, h4, h5, h6 {\n font-size: inherit;\n font-weight: inherit;\n }\n\n a {\n color: inherit;\n -webkit-text-decoration: inherit;\n -webkit-text-decoration: inherit;\n -webkit-text-decoration: inherit;\n text-decoration: inherit;\n }\n\n b, strong {\n font-weight: bolder;\n }\n\n code, kbd, samp, pre {\n font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace);\n font-feature-settings: var(--default-mono-font-feature-settings, normal);\n font-variation-settings: var(--default-mono-font-variation-settings, normal);\n font-size: 1em;\n }\n\n small {\n font-size: 80%;\n }\n\n sub, sup {\n vertical-align: baseline;\n font-size: 75%;\n line-height: 0;\n position: relative;\n }\n\n sub {\n bottom: -.25em;\n }\n\n sup {\n top: -.5em;\n }\n\n table {\n text-indent: 0;\n border-color: inherit;\n border-collapse: collapse;\n }\n\n :-moz-focusring:where(:not(iframe)) {\n outline: auto;\n }\n\n progress {\n vertical-align: baseline;\n }\n\n summary {\n display: list-item;\n }\n\n ol, ul, menu {\n list-style: none;\n }\n\n img, svg, video, canvas, audio, iframe, embed, object {\n vertical-align: middle;\n display: block;\n }\n\n img, video {\n max-width: 100%;\n height: auto;\n }\n\n button, input, select, optgroup, textarea {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n opacity: 1;\n background-color: #0000;\n border-radius: 0;\n }\n\n ::file-selector-button {\n font: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n letter-spacing: inherit;\n color: inherit;\n opacity: 1;\n background-color: #0000;\n border-radius: 0;\n }\n\n :where(select:is([multiple], [size])) optgroup {\n font-weight: bolder;\n }\n\n :where(select:is([multiple], [size])) optgroup option {\n padding-inline-start: 20px;\n }\n\n ::file-selector-button {\n margin-inline-end: 4px;\n }\n\n ::placeholder {\n opacity: 1;\n }\n\n @supports (not ((-webkit-appearance: -apple-pay-button))) or (contain-intrinsic-size: 1px) {\n ::placeholder {\n color: currentColor;\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n ::placeholder {\n color: color-mix(in oklab, currentcolor 50%, transparent);\n }\n }\n }\n\n textarea {\n resize: vertical;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n ::-webkit-date-and-time-value {\n min-height: 1lh;\n text-align: inherit;\n }\n\n ::-webkit-datetime-edit {\n display: inline-flex;\n }\n\n ::-webkit-datetime-edit-fields-wrapper {\n padding: 0;\n }\n\n ::-webkit-datetime-edit {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-year-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-month-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-day-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-hour-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-minute-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-second-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-millisecond-field {\n padding-block: 0;\n }\n\n ::-webkit-datetime-edit-meridiem-field {\n padding-block: 0;\n }\n\n ::-webkit-calendar-picker-indicator {\n line-height: 1;\n }\n\n :-moz-ui-invalid {\n box-shadow: none;\n }\n\n button, input:where([type=\"button\"], [type=\"reset\"], [type=\"submit\"]) {\n appearance: button;\n }\n\n ::file-selector-button {\n appearance: button;\n }\n\n ::-webkit-inner-spin-button {\n height: auto;\n }\n\n ::-webkit-outer-spin-button {\n height: auto;\n }\n\n [hidden]:where(:not([hidden=\"until-found\"])) {\n display: none !important;\n }\n}\n\n@layer components;\n\n@layer utilities {\n .pointer-events-auto {\n pointer-events: auto;\n }\n\n .collapse {\n visibility: collapse;\n }\n\n .visible {\n visibility: visible;\n }\n\n .absolute {\n position: absolute;\n }\n\n .fixed {\n position: fixed;\n }\n\n .relative {\n position: relative;\n }\n\n .sticky {\n position: sticky;\n }\n\n .inset-0 {\n inset: 0;\n }\n\n .inset-y-0 {\n inset-block: 0;\n }\n\n .start-0 {\n inset-inline-start: calc(var(--spacing) * 0);\n }\n\n .end-0 {\n inset-inline-end: calc(var(--spacing) * 0);\n }\n\n .top-0 {\n top: 0;\n }\n\n .top-full {\n top: 100%;\n }\n\n .z-50 {\n z-index: 50;\n }\n\n .z-60 {\n z-index: 60;\n }\n\n .container {\n width: 100%;\n }\n\n @media (width >= 40rem) {\n .container {\n max-width: 40rem;\n }\n }\n\n @media (width >= 48rem) {\n .container {\n max-width: 48rem;\n }\n }\n\n @media (width >= 64rem) {\n .container {\n max-width: 64rem;\n }\n }\n\n @media (width >= 80rem) {\n .container {\n max-width: 80rem;\n }\n }\n\n @media (width >= 96rem) {\n .container {\n max-width: 96rem;\n }\n }\n\n .mx-1 {\n margin-inline: var(--spacing);\n }\n\n .mx-auto {\n margin-inline: auto;\n }\n\n .my-1 {\n margin-block: var(--spacing);\n }\n\n .ms-auto {\n margin-inline-start: auto;\n }\n\n .mt-1 {\n margin-top: var(--spacing);\n }\n\n .mt-1\\.5 {\n margin-top: calc(var(--spacing) * 1.5);\n }\n\n .mb-1 {\n margin-bottom: var(--spacing);\n }\n\n .block {\n display: block;\n }\n\n .contents {\n display: contents;\n }\n\n .flex {\n display: flex;\n }\n\n .hidden {\n display: none;\n }\n\n .inline {\n display: inline;\n }\n\n .inline-flex {\n display: inline-flex;\n }\n\n .table {\n display: table;\n }\n\n .size-3\\.5 {\n width: calc(var(--spacing) * 3.5);\n height: calc(var(--spacing) * 3.5);\n }\n\n .size-4 {\n width: calc(var(--spacing) * 4);\n height: calc(var(--spacing) * 4);\n }\n\n .h-7 {\n height: calc(var(--spacing) * 7);\n }\n\n .h-11\\.5 {\n height: calc(var(--spacing) * 11.5);\n }\n\n .h-full {\n height: 100%;\n }\n\n .max-h-full {\n max-height: 100%;\n }\n\n .min-h-0 {\n min-height: 0;\n }\n\n .min-h-dvh {\n min-height: 100dvh;\n }\n\n .min-h-screen {\n min-height: 100vh;\n }\n\n .w-1 {\n width: var(--spacing);\n }\n\n .w-7 {\n width: calc(var(--spacing) * 7);\n }\n\n .w-64 {\n width: calc(var(--spacing) * 64);\n }\n\n .w-72 {\n width: calc(var(--spacing) * 72);\n }\n\n .w-full {\n width: 100%;\n }\n\n .max-w-4xl {\n max-width: var(--container-4xl);\n }\n\n .max-w-\\[calc\\(100vw-1rem\\)\\] {\n max-width: calc(100vw - 1rem);\n }\n\n .min-w-0 {\n min-width: 0;\n }\n\n .flex-1 {\n flex: 1;\n }\n\n .flex-none {\n flex: none;\n }\n\n .shrink-0 {\n flex-shrink: 0;\n }\n\n .border-collapse {\n border-collapse: collapse;\n }\n\n .-translate-x-full {\n --tw-translate-x: -100%;\n translate: var(--tw-translate-x) var(--tw-translate-y);\n }\n\n .-rotate-90 {\n rotate: -90deg;\n }\n\n .transform {\n transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );\n }\n\n .animate-pulse {\n animation: var(--animate-pulse);\n }\n\n .animate-spin {\n animation: var(--animate-spin);\n }\n\n .cursor-col-resize {\n cursor: col-resize;\n }\n\n .cursor-pointer {\n cursor: pointer;\n }\n\n .resize {\n resize: both;\n }\n\n .break-before-page {\n break-before: page;\n }\n\n .flex-col {\n flex-direction: column;\n }\n\n .flex-wrap {\n flex-wrap: wrap;\n }\n\n .items-center {\n align-items: center;\n }\n\n .justify-between {\n justify-content: space-between;\n }\n\n .justify-center {\n justify-content: center;\n }\n\n .gap-1 {\n gap: var(--spacing);\n }\n\n .gap-x-3 {\n column-gap: calc(var(--spacing) * 3);\n }\n\n .gap-y-1 {\n row-gap: var(--spacing);\n }\n\n .truncate {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n\n .overflow-hidden {\n overflow: hidden;\n }\n\n .overflow-x-hidden {\n overflow-x: hidden;\n }\n\n .overflow-y-auto {\n overflow-y: auto;\n }\n\n .rounded-lg {\n border-radius: var(--radius-lg);\n }\n\n .rounded-md {\n border-radius: var(--radius-md);\n }\n\n .rounded-xl {\n border-radius: var(--radius-xl);\n }\n\n .border {\n border-style: var(--tw-border-style);\n border-width: 1px;\n }\n\n .border-e {\n border-inline-end-style: var(--tw-border-style);\n border-inline-end-width: 1px;\n }\n\n .border-b {\n border-bottom-style: var(--tw-border-style);\n border-bottom-width: 1px;\n }\n\n .border-border {\n border-color: var(--color-border);\n }\n\n .border-muted-foreground\\/25 {\n border-color: var(--color-muted-foreground);\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .border-muted-foreground\\/25 {\n border-color: color-mix(in oklab, var(--color-muted-foreground) 25%, transparent);\n }\n }\n\n .border-sidebar-border {\n border-color: var(--color-sidebar-border);\n }\n\n .bg-background {\n background-color: var(--color-background);\n }\n\n .bg-black\\/50 {\n background-color: #00000080;\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .bg-black\\/50 {\n background-color: color-mix(in oklab, var(--color-black) 50%, transparent);\n }\n }\n\n .bg-card {\n background-color: var(--color-card);\n }\n\n .bg-sidebar {\n background-color: var(--color-sidebar);\n }\n\n .bg-sidebar-accent {\n background-color: var(--color-sidebar-accent);\n }\n\n .p-1 {\n padding: var(--spacing);\n }\n\n .px-2 {\n padding-inline: calc(var(--spacing) * 2);\n }\n\n .px-3 {\n padding-inline: calc(var(--spacing) * 3);\n }\n\n .px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n\n .px-6 {\n padding-inline: calc(var(--spacing) * 6);\n }\n\n .py-1\\.5 {\n padding-block: calc(var(--spacing) * 1.5);\n }\n\n .py-2 {\n padding-block: calc(var(--spacing) * 2);\n }\n\n .py-3 {\n padding-block: calc(var(--spacing) * 3);\n }\n\n .py-5 {\n padding-block: calc(var(--spacing) * 5);\n }\n\n .py-8 {\n padding-block: calc(var(--spacing) * 8);\n }\n\n .ps-5 {\n padding-inline-start: calc(var(--spacing) * 5);\n }\n\n .ps-7 {\n padding-inline-start: calc(var(--spacing) * 7);\n }\n\n .pe-2 {\n padding-inline-end: calc(var(--spacing) * 2);\n }\n\n .pt-1\\.5 {\n padding-top: calc(var(--spacing) * 1.5);\n }\n\n .pt-3 {\n padding-top: calc(var(--spacing) * 3);\n }\n\n .pb-1 {\n padding-bottom: var(--spacing);\n }\n\n .pb-3 {\n padding-bottom: calc(var(--spacing) * 3);\n }\n\n .text-left {\n text-align: left;\n }\n\n .text-sm {\n font-size: var(--text-sm);\n line-height: var(--tw-leading, var(--text-sm--line-height));\n }\n\n .text-xs {\n font-size: var(--text-xs);\n line-height: var(--tw-leading, var(--text-xs--line-height));\n }\n\n .font-medium {\n --tw-font-weight: var(--font-weight-medium);\n font-weight: var(--font-weight-medium);\n }\n\n .font-semibold {\n --tw-font-weight: var(--font-weight-semibold);\n font-weight: var(--font-weight-semibold);\n }\n\n .text-foreground {\n color: var(--color-foreground);\n }\n\n .text-muted-foreground {\n color: var(--color-muted-foreground);\n }\n\n .text-sidebar-foreground, .text-sidebar-foreground\\/60 {\n color: var(--color-sidebar-foreground);\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .text-sidebar-foreground\\/60 {\n color: color-mix(in oklab, var(--color-sidebar-foreground) 60%, transparent);\n }\n }\n\n .text-sidebar-primary {\n color: var(--color-sidebar-primary);\n }\n\n .italic {\n font-style: italic;\n }\n\n .shadow-2xs {\n --tw-shadow: 0 1px var(--tw-shadow-color, #0000000d);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n\n .shadow-lg {\n --tw-shadow: 0 10px 15px -3px var(--tw-shadow-color, #0000001a), 0 4px 6px -4px var(--tw-shadow-color, #0000001a);\n box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);\n }\n\n .blur {\n --tw-blur: blur(8px);\n 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, );\n }\n\n .transition {\n transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n\n .transition-transform {\n transition-property: transform, translate, scale, rotate;\n transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));\n transition-duration: var(--tw-duration, var(--default-transition-duration));\n }\n\n .ease-in-out {\n --tw-ease: var(--ease-in-out);\n transition-timing-function: var(--ease-in-out);\n }\n\n .outline-none {\n --tw-outline-style: none;\n outline-style: none;\n }\n\n .\\[print-color-adjust\\:exact\\] {\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n\n .placeholder\\:text-sidebar-foreground\\/50::placeholder {\n color: var(--color-sidebar-foreground);\n }\n\n @supports (color: color-mix(in lab, red, red)) {\n .placeholder\\:text-sidebar-foreground\\/50::placeholder {\n color: color-mix(in oklab, var(--color-sidebar-foreground) 50%, transparent);\n }\n }\n\n .before\\:absolute:before {\n content: var(--tw-content);\n position: absolute;\n }\n\n .before\\:start-\\[1\\.125rem\\]:before {\n content: var(--tw-content);\n inset-inline-start: 1.125rem;\n }\n\n .before\\:top-0:before {\n content: var(--tw-content);\n top: 0;\n }\n\n .before\\:h-full:before {\n content: var(--tw-content);\n height: 100%;\n }\n\n .before\\:w-px:before {\n content: var(--tw-content);\n width: 1px;\n }\n\n .before\\:bg-sidebar-border:before {\n content: var(--tw-content);\n background-color: var(--color-sidebar-border);\n }\n\n @media (hover: hover) {\n .hover\\:bg-sidebar-accent:hover {\n background-color: var(--color-sidebar-accent);\n }\n\n .hover\\:bg-sidebar-border:hover {\n background-color: var(--color-sidebar-border);\n }\n\n .hover\\:text-foreground:hover {\n color: var(--color-foreground);\n }\n\n .hover\\:text-sidebar-primary:hover {\n color: var(--color-sidebar-primary);\n }\n }\n\n .focus\\:border-sidebar-primary:focus {\n border-color: var(--color-sidebar-primary);\n }\n\n .focus-visible\\:bg-sidebar-accent:focus-visible {\n background-color: var(--color-sidebar-accent);\n }\n\n .enabled\\:cursor-pointer:enabled {\n cursor: pointer;\n }\n\n @media (hover: hover) {\n .enabled\\:hover\\:bg-sidebar-accent:enabled:hover {\n background-color: var(--color-sidebar-accent);\n }\n }\n\n .disabled\\:opacity-50:disabled {\n opacity: .5;\n }\n\n @media (width >= 40rem) {\n .sm\\:px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n\n .sm\\:px-10 {\n padding-inline: calc(var(--spacing) * 10);\n }\n\n .sm\\:py-10 {\n padding-block: calc(var(--spacing) * 10);\n }\n\n .sm\\:py-15 {\n padding-block: calc(var(--spacing) * 15);\n }\n }\n\n @media (width >= 64rem) {\n .lg\\:block {\n display: block;\n }\n\n .lg\\:w-auto {\n width: auto;\n }\n\n .lg\\:px-5 {\n padding-inline: calc(var(--spacing) * 5);\n }\n\n .lg\\:ps-8 {\n padding-inline-start: calc(var(--spacing) * 8);\n }\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar\\]\\:w-2::-webkit-scrollbar {\n width: calc(var(--spacing) * 2);\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar-thumb\\]\\:rounded-none::-webkit-scrollbar-thumb {\n border-radius: 0;\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar-thumb\\]\\:bg-scrollbar-thumb::-webkit-scrollbar-thumb {\n background-color: var(--color-scrollbar-thumb);\n }\n\n .\\[\\&\\:\\:-webkit-scrollbar-track\\]\\:bg-scrollbar-track::-webkit-scrollbar-track {\n background-color: var(--color-scrollbar-track);\n }\n}\n\n:root {\n --background: #fff;\n --foreground: #393a34;\n --card: #fff;\n --card-foreground: #393a34;\n --primary: #1c6b48;\n --primary-foreground: #fff;\n --muted: #f7f7f7;\n --muted-foreground: #6a737d;\n --border: #f0f0f0;\n --sidebar: #fff;\n --sidebar-foreground: #4e4f47;\n --sidebar-primary: #1c6b48;\n --sidebar-accent: #f7f7f7;\n --sidebar-accent-foreground: #393a34;\n --sidebar-border: #f0f0f0;\n --font-sans: ui-sans-serif, system-ui, sans-serif;\n --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n --scrollbar-track: #f7f7f7;\n --scrollbar-thumb: #393a3450;\n --radius: .5rem;\n}\n\n.dark {\n --background: #121212;\n --foreground: #dbd7caee;\n --card: #181818;\n --card-foreground: #dbd7caee;\n --primary: #4d9375;\n --primary-foreground: #121212;\n --muted: #181818;\n --muted-foreground: #959da5;\n --border: #191919;\n --sidebar: #121212;\n --sidebar-foreground: #bfbaaa;\n --sidebar-primary: #4d9375;\n --sidebar-accent: #181818;\n --sidebar-accent-foreground: #dbd7caee;\n --sidebar-border: #191919;\n --scrollbar-track: #181818;\n --scrollbar-thumb: #dedcd550;\n}\n\n#sidebar {\n transition: translate .3s;\n}\n\nbody[data-sidebar-open] #sidebar {\n translate: 0;\n}\n\nbody[data-sidebar-open] #sidebar-overlay {\n display: block;\n}\n\nbody[data-sidebar-open] #icon-sidebar-open {\n display: none;\n}\n\nbody[data-sidebar-open] #icon-sidebar-close {\n display: inline;\n}\n\n@media (width >= 1024px) {\n #sidebar {\n width: var(--sidebar-width, 18rem);\n }\n\n #header-bar, #main-content {\n transition: margin .3s;\n }\n\n body[data-sidebar-open] #sidebar-overlay {\n display: none;\n }\n\n body[data-sidebar-open] #header-bar, body[data-sidebar-open] #main-content {\n margin-inline-start: var(--sidebar-width, 18rem);\n }\n}\n\n@property --tw-translate-x {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-translate-y {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-translate-z {\n syntax: \"*\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-rotate-x {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-rotate-y {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-rotate-z {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-skew-x {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-skew-y {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-border-style {\n syntax: \"*\";\n inherits: false;\n initial-value: solid;\n}\n\n@property --tw-font-weight {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-shadow-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-shadow-alpha {\n syntax: \"<percentage>\";\n inherits: false;\n initial-value: 100%;\n}\n\n@property --tw-inset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-inset-shadow-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-inset-shadow-alpha {\n syntax: \"<percentage>\";\n inherits: false;\n initial-value: 100%;\n}\n\n@property --tw-ring-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-inset-ring-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-inset-ring-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-ring-inset {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-ring-offset-width {\n syntax: \"<length>\";\n inherits: false;\n initial-value: 0;\n}\n\n@property --tw-ring-offset-color {\n syntax: \"*\";\n inherits: false;\n initial-value: #fff;\n}\n\n@property --tw-ring-offset-shadow {\n syntax: \"*\";\n inherits: false;\n initial-value: 0 0 #0000;\n}\n\n@property --tw-blur {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-brightness {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-contrast {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-grayscale {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-hue-rotate {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-invert {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-opacity {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-saturate {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-sepia {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-drop-shadow {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-drop-shadow-color {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-drop-shadow-alpha {\n syntax: \"<percentage>\";\n inherits: false;\n initial-value: 100%;\n}\n\n@property --tw-drop-shadow-size {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-ease {\n syntax: \"*\";\n inherits: false\n}\n\n@property --tw-content {\n syntax: \"*\";\n inherits: false;\n initial-value: \"\";\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes pulse {\n 50% {\n opacity: .5;\n }\n}\n";
|
|
1301
|
+
// src/server/renderer/page-styles.tsx
|
|
1302
|
+
/** The layout stylesheet, then the Markdown content stylesheet. */
|
|
1303
|
+
function PageStyles({ styles }) {
|
|
1304
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: global_default } }), /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: styles.contentCss.replaceAll("</style", "<\\/style") } })] });
|
|
1305
|
+
}
|
|
1306
|
+
// src/server/renderer/document.tsx
|
|
1063
1307
|
const themeInitScript = `(function(){var t=localStorage.getItem("theme");if(t==="dark"||(t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches))document.documentElement.classList.add("dark")})()`;
|
|
1064
1308
|
function Document({ title, styles, initialState, children }) {
|
|
1065
1309
|
const initialStateScript = initialState ? `window.__INITIAL_STATE__=${JSON.stringify(initialState).replaceAll("<", "\\u003c").replaceAll(">", "\\u003e").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029")}` : "";
|
|
@@ -1078,8 +1322,7 @@ function Document({ title, styles, initialState, children }) {
|
|
|
1078
1322
|
type: "image/x-icon"
|
|
1079
1323
|
}),
|
|
1080
1324
|
/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: themeInitScript } }),
|
|
1081
|
-
/* @__PURE__ */ jsx(
|
|
1082
|
-
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: styles.contentCss.replaceAll("</style", "<\\/style") } })
|
|
1325
|
+
/* @__PURE__ */ jsx(PageStyles, { styles })
|
|
1083
1326
|
] }), /* @__PURE__ */ jsxs("body", {
|
|
1084
1327
|
class: "bg-background text-foreground min-h-screen",
|
|
1085
1328
|
children: [
|
|
@@ -1097,14 +1340,26 @@ function Document({ title, styles, initialState, children }) {
|
|
|
1097
1340
|
function renderDocument(vnode) {
|
|
1098
1341
|
return `<!DOCTYPE html>${renderToString(vnode)}`;
|
|
1099
1342
|
}
|
|
1100
|
-
|
|
1101
|
-
//#region src/core/sse-constants.ts
|
|
1343
|
+
// src/core/sse-constants.ts
|
|
1102
1344
|
const SSE_INITIAL_RETRY_MS = 1e3;
|
|
1103
1345
|
const SSE_MAX_RETRY_MS = 3e4;
|
|
1104
|
-
|
|
1105
|
-
//#region src/server/renderer/html-document.tsx
|
|
1346
|
+
// src/server/renderer/html-document.tsx
|
|
1106
1347
|
function HtmlDocument({ title, rawContentUrl }) {
|
|
1107
|
-
|
|
1348
|
+
return /* @__PURE__ */ jsxs("html", {
|
|
1349
|
+
lang: "en",
|
|
1350
|
+
children: [/* @__PURE__ */ jsxs("head", { children: [
|
|
1351
|
+
/* @__PURE__ */ jsx("meta", { charSet: "UTF-8" }),
|
|
1352
|
+
/* @__PURE__ */ jsx("meta", {
|
|
1353
|
+
name: "viewport",
|
|
1354
|
+
content: "width=device-width, initial-scale=1.0"
|
|
1355
|
+
}),
|
|
1356
|
+
/* @__PURE__ */ jsxs("title", { children: [title, " - peek"] }),
|
|
1357
|
+
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: "html,body{margin:0;padding:0;height:100%;overflow:hidden}iframe{border:none;width:100%;height:100%}" } })
|
|
1358
|
+
] }), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsx("iframe", {
|
|
1359
|
+
id: "content-frame",
|
|
1360
|
+
title,
|
|
1361
|
+
src: rawContentUrl
|
|
1362
|
+
}), /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `(function () {
|
|
1108
1363
|
var maxRetries = 10;
|
|
1109
1364
|
var retryCount = 0;
|
|
1110
1365
|
var initialDelay = ${SSE_INITIAL_RETRY_MS};
|
|
@@ -1137,22 +1392,7 @@ function HtmlDocument({ title, rawContentUrl }) {
|
|
|
1137
1392
|
}
|
|
1138
1393
|
|
|
1139
1394
|
connect();
|
|
1140
|
-
})()
|
|
1141
|
-
return /* @__PURE__ */ jsxs("html", {
|
|
1142
|
-
lang: "en",
|
|
1143
|
-
children: [/* @__PURE__ */ jsxs("head", { children: [
|
|
1144
|
-
/* @__PURE__ */ jsx("meta", { charSet: "UTF-8" }),
|
|
1145
|
-
/* @__PURE__ */ jsx("meta", {
|
|
1146
|
-
name: "viewport",
|
|
1147
|
-
content: "width=device-width, initial-scale=1.0"
|
|
1148
|
-
}),
|
|
1149
|
-
/* @__PURE__ */ jsxs("title", { children: [title, " - peek"] }),
|
|
1150
|
-
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: "html,body{margin:0;padding:0;height:100%;overflow:hidden}iframe{border:none;width:100%;height:100%}" } })
|
|
1151
|
-
] }), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsx("iframe", {
|
|
1152
|
-
id: "content-frame",
|
|
1153
|
-
title,
|
|
1154
|
-
src: rawContentUrl
|
|
1155
|
-
}), /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: sseReloadScript } })] })]
|
|
1395
|
+
})()` } })] })]
|
|
1156
1396
|
});
|
|
1157
1397
|
}
|
|
1158
1398
|
function renderHtmlDocument(title, rawContentUrl) {
|
|
@@ -1162,8 +1402,37 @@ function renderHtmlDocument(title, rawContentUrl) {
|
|
|
1162
1402
|
rawContentUrl
|
|
1163
1403
|
}))}`;
|
|
1164
1404
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1405
|
+
// src/server/routes/markdown-file.ts
|
|
1406
|
+
/**
|
|
1407
|
+
* Reads the Markdown file at `realPath` (already checked to be inside the base
|
|
1408
|
+
* directory) and renders it, resolving its relative images against
|
|
1409
|
+
* `relativePath`.
|
|
1410
|
+
*/
|
|
1411
|
+
async function renderMarkdownAt(realPath, relativePath) {
|
|
1412
|
+
const result = await readTextFile(realPath);
|
|
1413
|
+
if (!result.ok) {
|
|
1414
|
+
if (result.error.type === "file-not-found") return {
|
|
1415
|
+
ok: false,
|
|
1416
|
+
status: 404,
|
|
1417
|
+
message: "File not found"
|
|
1418
|
+
};
|
|
1419
|
+
logger.error("Failed to read file:", result.error);
|
|
1420
|
+
return {
|
|
1421
|
+
ok: false,
|
|
1422
|
+
status: 500,
|
|
1423
|
+
message: "Internal server error"
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
return {
|
|
1427
|
+
ok: true,
|
|
1428
|
+
html: await renderMarkdown(result.value, relativePath)
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
// src/server/routes/directory.tsx
|
|
1432
|
+
/** Name the UI shows for the browsed directory. */
|
|
1433
|
+
function directoryTitle(dirPath) {
|
|
1434
|
+
return basename(dirPath) || dirPath;
|
|
1435
|
+
}
|
|
1167
1436
|
function findFirstFile(nodes) {
|
|
1168
1437
|
for (const node of nodes) {
|
|
1169
1438
|
if (node.type === "file") return node;
|
|
@@ -1202,7 +1471,14 @@ function renderDirectoryView(params) {
|
|
|
1202
1471
|
href: "/"
|
|
1203
1472
|
}, { label: fileTitle }],
|
|
1204
1473
|
showSidebarToggle: true,
|
|
1205
|
-
externalLinkHref: `/${encodeUrlPath(currentPath)}
|
|
1474
|
+
externalLinkHref: `/${encodeUrlPath(currentPath)}`,
|
|
1475
|
+
actions: /* @__PURE__ */ jsx(PdfMenu, {
|
|
1476
|
+
currentPath,
|
|
1477
|
+
currentName: fileTitle,
|
|
1478
|
+
contentType,
|
|
1479
|
+
directories: directoryPdfEntries(tree, currentPath, dirTitle),
|
|
1480
|
+
onPrint: () => {}
|
|
1481
|
+
})
|
|
1206
1482
|
}),
|
|
1207
1483
|
/* @__PURE__ */ jsx(ContentView, {
|
|
1208
1484
|
contentType,
|
|
@@ -1240,24 +1516,7 @@ async function renderFileContent(dirPath, relativePath, contentType) {
|
|
|
1240
1516
|
html: ""
|
|
1241
1517
|
};
|
|
1242
1518
|
}
|
|
1243
|
-
|
|
1244
|
-
if (!result.ok) {
|
|
1245
|
-
if (result.error.type === "file-not-found") return {
|
|
1246
|
-
ok: false,
|
|
1247
|
-
status: 404,
|
|
1248
|
-
message: "File not found"
|
|
1249
|
-
};
|
|
1250
|
-
logger.error("Failed to read file:", result.error);
|
|
1251
|
-
return {
|
|
1252
|
-
ok: false,
|
|
1253
|
-
status: 500,
|
|
1254
|
-
message: "Internal server error"
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
return {
|
|
1258
|
-
ok: true,
|
|
1259
|
-
html: await renderMarkdown(result.value, relativePath)
|
|
1260
|
-
};
|
|
1519
|
+
return renderMarkdownAt(realPath.value, relativePath);
|
|
1261
1520
|
}
|
|
1262
1521
|
function createDirectoryRoutes(dirPath, styles, treeCache) {
|
|
1263
1522
|
const app = new Hono();
|
|
@@ -1277,7 +1536,7 @@ function createDirectoryRoutes(dirPath, styles, treeCache) {
|
|
|
1277
1536
|
}
|
|
1278
1537
|
const rendered = await renderFileContent(dirPath, firstFile.path, contentType);
|
|
1279
1538
|
if (!rendered.ok) return c.text(rendered.message, rendered.status);
|
|
1280
|
-
const dirTitle =
|
|
1539
|
+
const dirTitle = directoryTitle(dirPath);
|
|
1281
1540
|
return c.html(renderDirectoryView({
|
|
1282
1541
|
projectId,
|
|
1283
1542
|
dirTitle,
|
|
@@ -1304,7 +1563,7 @@ function createDirectoryRoutes(dirPath, styles, treeCache) {
|
|
|
1304
1563
|
logger.error("Failed to build file tree:", treeResult.error);
|
|
1305
1564
|
return c.text("Internal server error", 500);
|
|
1306
1565
|
}
|
|
1307
|
-
const dirTitle =
|
|
1566
|
+
const dirTitle = directoryTitle(dirPath);
|
|
1308
1567
|
return c.html(renderDirectoryView({
|
|
1309
1568
|
projectId,
|
|
1310
1569
|
dirTitle,
|
|
@@ -1343,8 +1602,7 @@ function createDirectoryRoutes(dirPath, styles, treeCache) {
|
|
|
1343
1602
|
});
|
|
1344
1603
|
return app;
|
|
1345
1604
|
}
|
|
1346
|
-
|
|
1347
|
-
//#region src/server/routes/file.tsx
|
|
1605
|
+
// src/server/routes/file.tsx
|
|
1348
1606
|
function createFileRoutes(filePath, styles) {
|
|
1349
1607
|
const app = new Hono();
|
|
1350
1608
|
app.get("/", async (c) => {
|
|
@@ -1373,8 +1631,7 @@ function createFileRoutes(filePath, styles) {
|
|
|
1373
1631
|
});
|
|
1374
1632
|
return app;
|
|
1375
1633
|
}
|
|
1376
|
-
|
|
1377
|
-
//#region src/server/routes/html-file.tsx
|
|
1634
|
+
// src/server/routes/html-file.tsx
|
|
1378
1635
|
function createHtmlFileRoutes(filePath) {
|
|
1379
1636
|
const app = new Hono();
|
|
1380
1637
|
app.get("/", (c) => {
|
|
@@ -1383,12 +1640,129 @@ function createHtmlFileRoutes(filePath) {
|
|
|
1383
1640
|
});
|
|
1384
1641
|
return app;
|
|
1385
1642
|
}
|
|
1643
|
+
// src/server/renderer/print-document.tsx
|
|
1644
|
+
/**
|
|
1645
|
+
* A page that holds only Markdown content, for the browser to print as a PDF.
|
|
1646
|
+
* It has no theme script, so it always renders in the light theme, and no
|
|
1647
|
+
* client bundle, since nothing on it is interactive.
|
|
1648
|
+
*/
|
|
1649
|
+
function PrintDocument({ title, styles, contents }) {
|
|
1650
|
+
return /* @__PURE__ */ jsxs("html", {
|
|
1651
|
+
lang: "en",
|
|
1652
|
+
children: [/* @__PURE__ */ jsxs("head", { children: [
|
|
1653
|
+
/* @__PURE__ */ jsx("meta", { charSet: "UTF-8" }),
|
|
1654
|
+
/* @__PURE__ */ jsx("meta", {
|
|
1655
|
+
name: "viewport",
|
|
1656
|
+
content: "width=device-width, initial-scale=1.0"
|
|
1657
|
+
}),
|
|
1658
|
+
/* @__PURE__ */ jsx("title", { children: title }),
|
|
1659
|
+
/* @__PURE__ */ jsx(PageStyles, { styles })
|
|
1660
|
+
] }), /* @__PURE__ */ jsx("body", {
|
|
1661
|
+
class: "bg-background text-foreground [print-color-adjust:exact]",
|
|
1662
|
+
children: /* @__PURE__ */ jsx("main", { children: contents.map((html, index) => /* @__PURE__ */ jsx("article", {
|
|
1663
|
+
class: `markdown-body${index > 0 ? " break-before-page" : ""}`,
|
|
1664
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
1665
|
+
}, index)) })
|
|
1666
|
+
})]
|
|
1667
|
+
});
|
|
1668
|
+
}
|
|
1669
|
+
function renderPrintDocument(props) {
|
|
1670
|
+
return `<!DOCTYPE html>${renderToString(/* @__PURE__ */ jsx(PrintDocument, { ...props }))}`;
|
|
1671
|
+
}
|
|
1672
|
+
// src/server/routes/print.tsx
|
|
1673
|
+
async function renderMarkdownFile(dirPath, relativePath) {
|
|
1674
|
+
const realPath = await realPathWithinBase(dirPath, relativePath);
|
|
1675
|
+
if (!realPath.ok) return {
|
|
1676
|
+
ok: false,
|
|
1677
|
+
...realPathErrorResponse(realPath.error)
|
|
1678
|
+
};
|
|
1679
|
+
return renderMarkdownAt(realPath.value, relativePath);
|
|
1680
|
+
}
|
|
1681
|
+
async function filePrintPage(dirPath, relativePath) {
|
|
1682
|
+
if (!isRelativePathWithinBase(dirPath, relativePath)) return {
|
|
1683
|
+
ok: false,
|
|
1684
|
+
status: 403,
|
|
1685
|
+
message: "Forbidden"
|
|
1686
|
+
};
|
|
1687
|
+
if (getContentType(relativePath) !== "markdown") return {
|
|
1688
|
+
ok: false,
|
|
1689
|
+
status: 415,
|
|
1690
|
+
message: "Unsupported file type"
|
|
1691
|
+
};
|
|
1692
|
+
const rendered = await renderMarkdownFile(dirPath, relativePath);
|
|
1693
|
+
if (!rendered.ok) return rendered;
|
|
1694
|
+
return {
|
|
1695
|
+
ok: true,
|
|
1696
|
+
title: filePdfTitle(relativePath),
|
|
1697
|
+
contents: [rendered.html]
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
async function directoryPrintPage(dirPath, treeCache, directory) {
|
|
1701
|
+
const tree = await treeCache.get();
|
|
1702
|
+
if (!tree.ok) {
|
|
1703
|
+
logger.error("Failed to build file tree:", tree.error);
|
|
1704
|
+
return {
|
|
1705
|
+
ok: false,
|
|
1706
|
+
status: 500,
|
|
1707
|
+
message: "Internal server error"
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
const files = directoryMarkdownFiles(tree.value, directory);
|
|
1711
|
+
if (!files) return {
|
|
1712
|
+
ok: false,
|
|
1713
|
+
status: 404,
|
|
1714
|
+
message: "Directory not found"
|
|
1715
|
+
};
|
|
1716
|
+
switch (directoryPdfStatus(files.length)) {
|
|
1717
|
+
case "empty": return {
|
|
1718
|
+
ok: false,
|
|
1719
|
+
status: 404,
|
|
1720
|
+
message: "No Markdown files in this directory"
|
|
1721
|
+
};
|
|
1722
|
+
case "too-many": return {
|
|
1723
|
+
ok: false,
|
|
1724
|
+
status: 422,
|
|
1725
|
+
message: `Too many Markdown files: ${files.length} (limit 200)`
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
const contents = [];
|
|
1729
|
+
for (const rendered of await Promise.all(files.map((file) => renderMarkdownFile(dirPath, file)))) {
|
|
1730
|
+
if (!rendered.ok) return rendered;
|
|
1731
|
+
contents.push(rendered.html);
|
|
1732
|
+
}
|
|
1733
|
+
return {
|
|
1734
|
+
ok: true,
|
|
1735
|
+
title: directoryName(directory, directoryTitle(dirPath)),
|
|
1736
|
+
contents
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Serves the page that the browser prints as a PDF: one Markdown file
|
|
1741
|
+
* (`?file=<path>`), or every Markdown file under a directory in file tree
|
|
1742
|
+
* order (`?dir=<path>`, empty for the browsed directory itself).
|
|
1743
|
+
*/
|
|
1744
|
+
function createPrintRoutes(dirPath, styles, treeCache) {
|
|
1745
|
+
const app = new Hono();
|
|
1746
|
+
app.get(PRINT_PAGE_PATH, async (c) => {
|
|
1747
|
+
const file = c.req.query("file");
|
|
1748
|
+
const dir = c.req.query("dir");
|
|
1749
|
+
if (file === void 0 === (dir === void 0)) return c.text("Specify either file or dir", 400);
|
|
1750
|
+
const page = file !== void 0 ? await filePrintPage(dirPath, file) : await directoryPrintPage(dirPath, treeCache, dir ? toSlashPath(dir) : null);
|
|
1751
|
+
if (!page.ok) return c.text(page.message, page.status);
|
|
1752
|
+
return c.html(renderPrintDocument({
|
|
1753
|
+
title: page.title,
|
|
1754
|
+
styles,
|
|
1755
|
+
contents: page.contents
|
|
1756
|
+
}));
|
|
1757
|
+
});
|
|
1758
|
+
return app;
|
|
1759
|
+
}
|
|
1386
1760
|
/**
|
|
1387
1761
|
* Extensions that `/__peek/raw/` may serve, mapped to their `Content-Type`.
|
|
1388
1762
|
* Anything absent is refused, which keeps `--host 0.0.0.0` from exposing
|
|
1389
1763
|
* arbitrary files under the base directory.
|
|
1390
1764
|
*/
|
|
1391
|
-
const MIME_TYPE_MAP = new Map([
|
|
1765
|
+
const MIME_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
1392
1766
|
[".png", "image/png"],
|
|
1393
1767
|
[".jpg", "image/jpeg"],
|
|
1394
1768
|
[".jpeg", "image/jpeg"],
|
|
@@ -1411,8 +1785,7 @@ const MIME_TYPE_MAP = new Map([
|
|
|
1411
1785
|
function getMimeType(filePath) {
|
|
1412
1786
|
return MIME_TYPE_MAP.get(getExtension(filePath)) ?? null;
|
|
1413
1787
|
}
|
|
1414
|
-
|
|
1415
|
-
//#region src/server/routes/raw.ts
|
|
1788
|
+
// src/server/routes/raw.ts
|
|
1416
1789
|
async function lookupRawFile(baseDir, relativePath) {
|
|
1417
1790
|
if (!isRelativePathWithinBase(baseDir, relativePath)) return {
|
|
1418
1791
|
type: "path-error",
|
|
@@ -1457,7 +1830,6 @@ function createRawRoutes(baseDir) {
|
|
|
1457
1830
|
case "unreadable":
|
|
1458
1831
|
logger.error("Failed to read file:", file.cause);
|
|
1459
1832
|
return c.text("Failed to read file", 500);
|
|
1460
|
-
case "found": break;
|
|
1461
1833
|
}
|
|
1462
1834
|
c.header("Content-Type", file.mimeType);
|
|
1463
1835
|
c.header("X-Content-Type-Options", "nosniff");
|
|
@@ -1467,8 +1839,7 @@ function createRawRoutes(baseDir) {
|
|
|
1467
1839
|
});
|
|
1468
1840
|
return app;
|
|
1469
1841
|
}
|
|
1470
|
-
|
|
1471
|
-
//#region src/server/routes/sse.ts
|
|
1842
|
+
// src/server/routes/sse.ts
|
|
1472
1843
|
const KEEP_ALIVE_INTERVAL_MS = 3e4;
|
|
1473
1844
|
function createSseManager() {
|
|
1474
1845
|
const clients = /* @__PURE__ */ new Set();
|
|
@@ -1533,8 +1904,7 @@ function createSseManager() {
|
|
|
1533
1904
|
}
|
|
1534
1905
|
};
|
|
1535
1906
|
}
|
|
1536
|
-
|
|
1537
|
-
//#region src/server/index.ts
|
|
1907
|
+
// src/server/index.ts
|
|
1538
1908
|
/**
|
|
1539
1909
|
* `server.close()` normally resolves a tick after `closeAllConnections()`, so
|
|
1540
1910
|
* this is mostly margin for slow environments: long enough not to warn on
|
|
@@ -1567,6 +1937,7 @@ function createApp(ctx, sse) {
|
|
|
1567
1937
|
treeCache: ctx.treeCache
|
|
1568
1938
|
};
|
|
1569
1939
|
app.route("/", createApiRoutes(apiConfig));
|
|
1940
|
+
app.route("/", createPrintRoutes(ctx.targetPath, ctx.styles, ctx.treeCache));
|
|
1570
1941
|
app.route("/", createDirectoryRoutes(ctx.targetPath, ctx.styles, ctx.treeCache));
|
|
1571
1942
|
}
|
|
1572
1943
|
return app;
|
|
@@ -1607,7 +1978,8 @@ async function startServer(config, options) {
|
|
|
1607
1978
|
const server = serve({
|
|
1608
1979
|
fetch: app.fetch,
|
|
1609
1980
|
hostname: config.hostname,
|
|
1610
|
-
port: config.port
|
|
1981
|
+
port: config.port,
|
|
1982
|
+
overrideGlobalObjects: false
|
|
1611
1983
|
});
|
|
1612
1984
|
await new Promise((resolve, reject) => {
|
|
1613
1985
|
const onListening = () => {
|
|
@@ -1646,8 +2018,7 @@ async function startServer(config, options) {
|
|
|
1646
2018
|
return promise;
|
|
1647
2019
|
} };
|
|
1648
2020
|
}
|
|
1649
|
-
|
|
1650
|
-
//#region src/index.ts
|
|
2021
|
+
// src/index.ts
|
|
1651
2022
|
const pkg = createRequire(import.meta.url)("../package.json");
|
|
1652
2023
|
const command = define({
|
|
1653
2024
|
name: "peek",
|
|
@@ -1726,7 +2097,8 @@ $ peek README.md --css ./custom.css --no-open`,
|
|
|
1726
2097
|
const styles = await resolveStyles(css).then((result) => {
|
|
1727
2098
|
if (result.ok) return result.value;
|
|
1728
2099
|
s.stop("Failed to resolve styles");
|
|
1729
|
-
|
|
2100
|
+
const message = result.error.type === "file-not-found" ? `CSS file not found: ${result.error.path}` : `Failed to read CSS file: ${result.error.path}`;
|
|
2101
|
+
cancel(message);
|
|
1730
2102
|
return process.exit(1);
|
|
1731
2103
|
});
|
|
1732
2104
|
serverConfig = mode === "file" && contentType && contentType !== "html" ? {
|
|
@@ -1746,7 +2118,8 @@ $ peek README.md --css ./custom.css --no-open`,
|
|
|
1746
2118
|
}
|
|
1747
2119
|
const server = await startServer(serverConfig).catch((e) => {
|
|
1748
2120
|
s.stop("Failed to start server");
|
|
1749
|
-
|
|
2121
|
+
const message = isNodeError(e) && e.code === "EADDRINUSE" ? `Port ${port} is already in use` : "Failed to start server";
|
|
2122
|
+
cancel(message);
|
|
1750
2123
|
return process.exit(1);
|
|
1751
2124
|
});
|
|
1752
2125
|
s.stop("Server started");
|
|
@@ -1805,5 +2178,4 @@ await cli(process.argv.slice(2), command, {
|
|
|
1805
2178
|
version: pkg.version,
|
|
1806
2179
|
description: "Preview Markdown and HTML files in the browser"
|
|
1807
2180
|
});
|
|
1808
|
-
//#endregion
|
|
1809
2181
|
export {};
|