@henryavila/mdprobe 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +404 -0
- package/bin/cli.js +335 -0
- package/dist/assets/index-DPysqH1p.js +2 -0
- package/dist/assets/index-nl9v2RuJ.css +1 -0
- package/dist/index.html +19 -0
- package/package.json +75 -0
- package/schema.json +104 -0
- package/skills/mdprobe/SKILL.md +358 -0
- package/src/anchoring.js +262 -0
- package/src/annotations.js +504 -0
- package/src/cli-utils.js +58 -0
- package/src/config.js +76 -0
- package/src/export.js +211 -0
- package/src/handler.js +229 -0
- package/src/hash.js +51 -0
- package/src/renderer.js +247 -0
- package/src/server.js +849 -0
- package/src/ui/app.jsx +152 -0
- package/src/ui/components/AnnotationForm.jsx +72 -0
- package/src/ui/components/Content.jsx +334 -0
- package/src/ui/components/ExportMenu.jsx +62 -0
- package/src/ui/components/LeftPanel.jsx +99 -0
- package/src/ui/components/Popover.jsx +94 -0
- package/src/ui/components/ReplyThread.jsx +28 -0
- package/src/ui/components/RightPanel.jsx +171 -0
- package/src/ui/components/SectionApproval.jsx +31 -0
- package/src/ui/components/ThemePicker.jsx +18 -0
- package/src/ui/hooks/useAnnotations.js +160 -0
- package/src/ui/hooks/useClientLibs.js +97 -0
- package/src/ui/hooks/useKeyboard.js +128 -0
- package/src/ui/hooks/useTheme.js +57 -0
- package/src/ui/hooks/useWebSocket.js +126 -0
- package/src/ui/index.html +19 -0
- package/src/ui/state/store.js +76 -0
- package/src/ui/styles/themes.css +1243 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, existsSync, statSync } from 'node:fs'
|
|
4
|
+
import { readFile, writeFile, access } from 'node:fs/promises'
|
|
5
|
+
import { join, resolve, extname, basename } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
|
+
import { getConfig, setConfig, getAuthor } from '../src/config.js'
|
|
8
|
+
import { AnnotationFile } from '../src/annotations.js'
|
|
9
|
+
import { exportReport, exportInline, exportJSON, exportSARIF } from '../src/export.js'
|
|
10
|
+
import { createServer as createMdprobeServer } from '../src/server.js'
|
|
11
|
+
import { findMarkdownFiles, extractFlag, hasFlag } from '../src/cli-utils.js'
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Resolve paths
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
17
|
+
const PROJECT_ROOT = resolve(__filename, '..', '..')
|
|
18
|
+
const PKG_PATH = join(PROJECT_ROOT, 'package.json')
|
|
19
|
+
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Parse argv
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const rawArgs = process.argv.slice(2)
|
|
24
|
+
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Helpers
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
function printUsage() {
|
|
30
|
+
console.log(`Usage: mdprobe [files...] [options]
|
|
31
|
+
|
|
32
|
+
Markdown viewer + reviewer with live reload and persistent annotations.
|
|
33
|
+
|
|
34
|
+
Options:
|
|
35
|
+
--port <n> Port number (default: 3000)
|
|
36
|
+
--once Review mode (single pass, then exit)
|
|
37
|
+
--help, -h Show help
|
|
38
|
+
--version, -v Show version
|
|
39
|
+
|
|
40
|
+
Subcommands:
|
|
41
|
+
config [key] [value] Manage configuration
|
|
42
|
+
export <path> [flags] Export annotations (--report, --inline, --json, --sarif)
|
|
43
|
+
install --plugin Install Claude Code skill/plugin
|
|
44
|
+
`)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function fatal(msg) {
|
|
48
|
+
process.stderr.write(msg + '\n')
|
|
49
|
+
process.exit(1)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Main
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
async function main() {
|
|
57
|
+
const args = [...rawArgs]
|
|
58
|
+
|
|
59
|
+
// --help
|
|
60
|
+
if (hasFlag(args, '--help', '-h')) {
|
|
61
|
+
printUsage()
|
|
62
|
+
process.exit(0)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// --version
|
|
66
|
+
if (hasFlag(args, '--version', '-v')) {
|
|
67
|
+
try {
|
|
68
|
+
const pkg = JSON.parse(readFileSync(PKG_PATH, 'utf-8'))
|
|
69
|
+
console.log(pkg.version)
|
|
70
|
+
} catch {
|
|
71
|
+
console.log('unknown')
|
|
72
|
+
}
|
|
73
|
+
process.exit(0)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ---- Subcommands ----
|
|
77
|
+
const subcommand = args[0]
|
|
78
|
+
|
|
79
|
+
// ---- config subcommand ----
|
|
80
|
+
if (subcommand === 'config') {
|
|
81
|
+
const key = args[1]
|
|
82
|
+
const value = args[2]
|
|
83
|
+
|
|
84
|
+
if (!key) {
|
|
85
|
+
// Print all config
|
|
86
|
+
const config = await getConfig()
|
|
87
|
+
const entries = Object.entries(config)
|
|
88
|
+
if (entries.length === 0) {
|
|
89
|
+
console.log('{}')
|
|
90
|
+
} else {
|
|
91
|
+
for (const [k, v] of entries) {
|
|
92
|
+
console.log(`${k}: ${v}`)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
process.exit(0)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (value !== undefined) {
|
|
99
|
+
// Set config
|
|
100
|
+
await setConfig(key, value)
|
|
101
|
+
console.log(`Set ${key} = ${value}`)
|
|
102
|
+
process.exit(0)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Get single key
|
|
106
|
+
const config = await getConfig()
|
|
107
|
+
if (config[key] !== undefined) {
|
|
108
|
+
console.log(config[key])
|
|
109
|
+
} else {
|
|
110
|
+
console.log(`(not set)`)
|
|
111
|
+
}
|
|
112
|
+
process.exit(0)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ---- install subcommand ----
|
|
116
|
+
if (subcommand === 'install') {
|
|
117
|
+
const target = args[1]
|
|
118
|
+
if (target === '--plugin') {
|
|
119
|
+
const os = await import('node:os')
|
|
120
|
+
const fs = await import('node:fs/promises')
|
|
121
|
+
const destDir = join(os.homedir(), '.claude', 'skills', 'mdprobe')
|
|
122
|
+
const srcFile = join(PROJECT_ROOT, 'skills', 'mdprobe', 'SKILL.md')
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
await fs.mkdir(destDir, { recursive: true })
|
|
126
|
+
const content = await fs.readFile(srcFile, 'utf-8')
|
|
127
|
+
await fs.writeFile(join(destDir, 'SKILL.md'), content, 'utf-8')
|
|
128
|
+
console.log(`Plugin installed to ${destDir}/SKILL.md`)
|
|
129
|
+
console.log('Claude Code will now suggest mdprobe for rich markdown output.')
|
|
130
|
+
} catch (err) {
|
|
131
|
+
fatal(`Error installing plugin: ${err.message}`)
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
fatal('Usage: mdprobe install --plugin')
|
|
135
|
+
}
|
|
136
|
+
process.exit(0)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ---- export subcommand ----
|
|
140
|
+
if (subcommand === 'export') {
|
|
141
|
+
const mdPath = args[1]
|
|
142
|
+
|
|
143
|
+
if (!mdPath) {
|
|
144
|
+
fatal('Error: export requires a file path. Usage: mdprobe export <path> [--report|--inline|--json|--sarif]')
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const resolvedPath = resolve(mdPath)
|
|
148
|
+
|
|
149
|
+
// Determine which export format
|
|
150
|
+
const wantReport = args.includes('--report')
|
|
151
|
+
const wantInline = args.includes('--inline')
|
|
152
|
+
const wantJson = args.includes('--json')
|
|
153
|
+
const wantSarif = args.includes('--sarif')
|
|
154
|
+
|
|
155
|
+
// Look for sidecar annotation file
|
|
156
|
+
const sidecarPath = resolvedPath.replace(/\.md$/, '.annotations.yaml')
|
|
157
|
+
let af
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
await access(sidecarPath)
|
|
161
|
+
af = await AnnotationFile.load(sidecarPath)
|
|
162
|
+
} catch {
|
|
163
|
+
fatal(`Error: No annotations found for ${basename(resolvedPath)}. No annotations sidecar file exists.`)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Read source content for inline export
|
|
167
|
+
let sourceContent = ''
|
|
168
|
+
try {
|
|
169
|
+
sourceContent = await readFile(resolvedPath, 'utf-8')
|
|
170
|
+
} catch {
|
|
171
|
+
fatal(`Error: Cannot read source file ${resolvedPath}`)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (wantReport) {
|
|
175
|
+
const report = exportReport(af, sourceContent)
|
|
176
|
+
const outPath = resolvedPath.replace(/\.md$/, '.review-report.md')
|
|
177
|
+
await writeFile(outPath, report, 'utf-8')
|
|
178
|
+
console.log(`Report generated: ${outPath}`)
|
|
179
|
+
} else if (wantInline) {
|
|
180
|
+
const inline = exportInline(af, sourceContent)
|
|
181
|
+
const outPath = resolvedPath.replace(/\.md$/, '.reviewed.md')
|
|
182
|
+
await writeFile(outPath, inline, 'utf-8')
|
|
183
|
+
console.log(`Inline export generated: ${outPath}`)
|
|
184
|
+
} else if (wantJson) {
|
|
185
|
+
const json = exportJSON(af)
|
|
186
|
+
const outPath = resolvedPath.replace(/\.md$/, '.annotations.json')
|
|
187
|
+
await writeFile(outPath, JSON.stringify(json, null, 2), 'utf-8')
|
|
188
|
+
console.log(`JSON export generated: ${outPath}`)
|
|
189
|
+
} else if (wantSarif) {
|
|
190
|
+
const sarif = exportSARIF(af, resolvedPath)
|
|
191
|
+
const outPath = resolvedPath.replace(/\.md$/, '.annotations.sarif')
|
|
192
|
+
await writeFile(outPath, JSON.stringify(sarif, null, 2), 'utf-8')
|
|
193
|
+
console.log(`SARIF export generated: ${outPath}`)
|
|
194
|
+
} else {
|
|
195
|
+
fatal('Error: export requires a format flag: --report, --inline, --json, or --sarif')
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
process.exit(0)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ---- Serve mode (default) ----
|
|
202
|
+
|
|
203
|
+
// Check if author is configured; prompt if missing
|
|
204
|
+
let currentAuthor = await getAuthor()
|
|
205
|
+
if (currentAuthor === 'anonymous') {
|
|
206
|
+
const { createInterface } = await import('node:readline')
|
|
207
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout })
|
|
208
|
+
const name = await new Promise(resolve => {
|
|
209
|
+
rl.question('Qual seu nome para anotacoes? ', answer => {
|
|
210
|
+
rl.close()
|
|
211
|
+
resolve(answer.trim())
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
if (name) {
|
|
215
|
+
await setConfig('author', name)
|
|
216
|
+
currentAuthor = name
|
|
217
|
+
console.log(`Author set to: ${name}`)
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Extract flags
|
|
222
|
+
const portFlag = extractFlag(args, '--port')
|
|
223
|
+
const onceFlag = hasFlag(args, '--once')
|
|
224
|
+
const noOpenFlag = hasFlag(args, '--no-open')
|
|
225
|
+
|
|
226
|
+
// Validate port
|
|
227
|
+
let port = 3000
|
|
228
|
+
if (portFlag !== undefined) {
|
|
229
|
+
if (portFlag === true) {
|
|
230
|
+
// --port was provided without a value
|
|
231
|
+
fatal('Error: --port requires a numeric value')
|
|
232
|
+
}
|
|
233
|
+
port = parseInt(portFlag, 10)
|
|
234
|
+
if (isNaN(port) || port < 0 || port > 65535) {
|
|
235
|
+
fatal('Error: --port requires a valid numeric value (0-65535)')
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Collect file/directory arguments (anything remaining that isn't a flag)
|
|
240
|
+
const targets = args.filter((a) => !a.startsWith('-'))
|
|
241
|
+
|
|
242
|
+
// Resolve targets to .md files
|
|
243
|
+
let mdFiles = []
|
|
244
|
+
|
|
245
|
+
if (targets.length === 0) {
|
|
246
|
+
// No arguments: use cwd
|
|
247
|
+
const cwd = process.cwd()
|
|
248
|
+
mdFiles = findMarkdownFiles(cwd)
|
|
249
|
+
if (mdFiles.length === 0) {
|
|
250
|
+
fatal('Error: No markdown files found in current directory')
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
for (const target of targets) {
|
|
254
|
+
const resolved = resolve(target)
|
|
255
|
+
|
|
256
|
+
if (!existsSync(resolved)) {
|
|
257
|
+
fatal(`Error: ${target} does not exist`)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const stat = statSync(resolved)
|
|
261
|
+
|
|
262
|
+
if (stat.isDirectory()) {
|
|
263
|
+
const found = findMarkdownFiles(resolved)
|
|
264
|
+
if (found.length === 0) {
|
|
265
|
+
fatal(`Error: No markdown files found in ${target}`)
|
|
266
|
+
}
|
|
267
|
+
mdFiles.push(...found)
|
|
268
|
+
} else if (stat.isFile()) {
|
|
269
|
+
if (extname(resolved).toLowerCase() !== '.md') {
|
|
270
|
+
fatal(`Error: Not a markdown file: ${target}. Only .md files are supported.`)
|
|
271
|
+
}
|
|
272
|
+
mdFiles.push(resolved)
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Start the mdprobe server (HTTP + WebSocket + file watcher + Preact UI)
|
|
278
|
+
try {
|
|
279
|
+
const server = await createMdprobeServer({
|
|
280
|
+
files: mdFiles,
|
|
281
|
+
port,
|
|
282
|
+
open: false,
|
|
283
|
+
once: onceFlag,
|
|
284
|
+
author: currentAuthor,
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
console.log(`Server listening at ${server.url}`)
|
|
288
|
+
|
|
289
|
+
if (onceFlag) {
|
|
290
|
+
console.log(`Review mode: ${mdFiles.length} file(s)`)
|
|
291
|
+
mdFiles.forEach(f => console.log(` - ${basename(f)}`))
|
|
292
|
+
|
|
293
|
+
// Block until user clicks "Finish Review" in the UI
|
|
294
|
+
const result = await server.finishPromise
|
|
295
|
+
console.log('\nReview complete.')
|
|
296
|
+
if (result.yamlPaths?.length > 0) {
|
|
297
|
+
result.yamlPaths.forEach(p => console.log(p))
|
|
298
|
+
} else {
|
|
299
|
+
console.log('No annotations created.')
|
|
300
|
+
}
|
|
301
|
+
await server.close()
|
|
302
|
+
process.exit(0)
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Try to open browser (skip with --no-open)
|
|
306
|
+
if (noOpenFlag) { /* skip */ } else try {
|
|
307
|
+
const { execFile: execFileFn } = await import('node:child_process')
|
|
308
|
+
const isWSL = await readFile('/proc/version', 'utf-8').then(v => /microsoft/i.test(v)).catch(() => false)
|
|
309
|
+
|
|
310
|
+
let cmd, args
|
|
311
|
+
if (process.platform === 'darwin') {
|
|
312
|
+
cmd = 'open'
|
|
313
|
+
args = [server.url]
|
|
314
|
+
} else if (process.platform === 'win32') {
|
|
315
|
+
cmd = 'cmd'
|
|
316
|
+
args = ['/c', 'start', server.url]
|
|
317
|
+
} else if (isWSL) {
|
|
318
|
+
cmd = '/mnt/c/Windows/System32/cmd.exe'
|
|
319
|
+
args = ['/c', 'start', server.url]
|
|
320
|
+
} else {
|
|
321
|
+
cmd = 'xdg-open'
|
|
322
|
+
args = [server.url]
|
|
323
|
+
}
|
|
324
|
+
execFileFn(cmd, args, { stdio: 'ignore' })
|
|
325
|
+
} catch {
|
|
326
|
+
// Browser open failed — user can navigate manually
|
|
327
|
+
}
|
|
328
|
+
} catch (err) {
|
|
329
|
+
fatal(`Error: ${err.message}`)
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
main().catch((err) => {
|
|
334
|
+
fatal(`Error: ${err.message}`)
|
|
335
|
+
})
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var Ie,k,vt,mt,F,Qe,gt,yt,Me,ge,ce,bt,Ke,qe,He,xe={},we=[],Wt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pe=Array.isArray;function U(t,e){for(var n in e)t[n]=e[n];return t}function Xe(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function zt(t,e,n){var i,r,o,l={};for(o in e)o=="key"?i=e[o]:o=="ref"?r=e[o]:l[o]=e[o];if(arguments.length>2&&(l.children=arguments.length>3?Ie.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)l[o]===void 0&&(l[o]=t.defaultProps[o]);return ye(t,l,i,r,null)}function ye(t,e,n,i,r){var o={type:t,props:e,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++vt,__i:-1,__u:0};return r==null&&k.vnode!=null&&k.vnode(o),o}function J(t){return t.children}function ue(t,e){this.props=t,this.context=e}function ie(t,e){if(e==null)return t.__?ie(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?ie(t):null}function Bt(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,i=[],r=[],o=U({},e);o.__v=e.__v+1,k.vnode&&k.vnode(o),Je(t.__P,o,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,i,n??ie(e),!!(32&e.__u),r),o.__v=e.__v,o.__.__k[o.__i]=o,St(i,o,r),e.__e=e.__=null,o.__e!=n&&xt(o)}}function xt(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),xt(t)}function et(t){(!t.__d&&(t.__d=!0)&&F.push(t)&&!ke.__r++||Qe!=k.debounceRendering)&&((Qe=k.debounceRendering)||gt)(ke)}function ke(){try{for(var t,e=1;F.length;)F.length>e&&F.sort(yt),t=F.shift(),e=F.length,Bt(t)}finally{F.length=ke.__r=0}}function wt(t,e,n,i,r,o,l,a,d,u,y){var c,f,_,p,h,v,m,g=i&&i.__k||we,$=e.length;for(d=Kt(n,e,g,d,$),c=0;c<$;c++)(_=n.__k[c])!=null&&(f=_.__i!=-1&&g[_.__i]||xe,_.__i=c,v=Je(t,_,f,r,o,l,a,d,u,y),p=_.__e,_.ref&&f.ref!=_.ref&&(f.ref&&Ve(f.ref,null,_),y.push(_.ref,_.__c||p,_)),h==null&&p!=null&&(h=p),(m=!!(4&_.__u))||f.__k===_.__k?(d=kt(_,d,t,m),m&&f.__e&&(f.__e=null)):typeof _.type=="function"&&v!==void 0?d=v:p&&(d=p.nextSibling),_.__u&=-7);return n.__e=h,d}function Kt(t,e,n,i,r){var o,l,a,d,u,y=n.length,c=y,f=0;for(t.__k=new Array(r),o=0;o<r;o++)(l=e[o])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=t.__k[o]=ye(null,l,null,null,null):Pe(l)?l=t.__k[o]=ye(J,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=t.__k[o]=ye(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):t.__k[o]=l,d=o+f,l.__=t,l.__b=t.__b+1,a=null,(u=l.__i=Xt(l,n,d,c))!=-1&&(c--,(a=n[u])&&(a.__u|=2)),a==null||a.__v==null?(u==-1&&(r>y?f--:r<y&&f++),typeof l.type!="function"&&(l.__u|=4)):u!=d&&(u==d-1?f--:u==d+1?f++:(u>d?f--:f++,l.__u|=4))):t.__k[o]=null;if(c)for(o=0;o<y;o++)(a=n[o])!=null&&(2&a.__u)==0&&(a.__e==i&&(i=ie(a)),Ct(a,a));return i}function kt(t,e,n,i){var r,o;if(typeof t.type=="function"){for(r=t.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=t,e=kt(r[o],e,n,i));return e}t.__e!=e&&(i&&(e&&t.type&&!e.parentNode&&(e=ie(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Xt(t,e,n,i){var r,o,l,a=t.key,d=t.type,u=e[n],y=u!=null&&(2&u.__u)==0;if(u===null&&a==null||y&&a==u.key&&d==u.type)return n;if(i>(y?1:0)){for(r=n-1,o=n+1;r>=0||o<e.length;)if((u=e[l=r>=0?r--:o++])!=null&&(2&u.__u)==0&&a==u.key&&d==u.type)return l}return-1}function tt(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||Wt.test(e)?n:n+"px"}function ve(t,e,n,i,r){var o,l;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof i=="string"&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||tt(t.style,e,"");if(n)for(e in n)i&&n[e]==i[e]||tt(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(bt,"$1")),l=e.toLowerCase(),e=l in t||e=="onFocusOut"||e=="onFocusIn"?l.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i?n[ce]=i[ce]:(n[ce]=Ke,t.addEventListener(e,o?He:qe,o)):t.removeEventListener(e,o?He:qe,o);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function nt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[ge]==null)e[ge]=Ke++;else if(e[ge]<n[ce])return;return n(k.event?k.event(e):e)}}}function Je(t,e,n,i,r,o,l,a,d,u){var y,c,f,_,p,h,v,m,g,$,b,x,S,R,j,P=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),o=[a=e.__e=n.__e]),(y=k.__b)&&y(e);e:if(typeof P=="function")try{if(m=e.props,g=P.prototype&&P.prototype.render,$=(y=P.contextType)&&i[y.__c],b=y?$?$.props.value:y.__:i,n.__c?v=(c=e.__c=n.__c).__=c.__E:(g?e.__c=c=new P(m,b):(e.__c=c=new ue(m,b),c.constructor=P,c.render=Vt),$&&$.sub(c),c.state||(c.state={}),c.__n=i,f=c.__d=!0,c.__h=[],c._sb=[]),g&&c.__s==null&&(c.__s=c.state),g&&P.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=U({},c.__s)),U(c.__s,P.getDerivedStateFromProps(m,c.__s))),_=c.props,p=c.state,c.__v=e,f)g&&P.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),g&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(g&&P.getDerivedStateFromProps==null&&m!==_&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(m,b),e.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(m,c.__s,b)===!1){e.__v!=n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(D){D&&(D.__=e)}),we.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&l.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(m,c.__s,b),g&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(_,p,h)})}if(c.context=b,c.props=m,c.__P=t,c.__e=!1,x=k.__r,S=0,g)c.state=c.__s,c.__d=!1,x&&x(e),y=c.render(c.props,c.state,c.context),we.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,x&&x(e),y=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++S<25);c.state=c.__s,c.getChildContext!=null&&(i=U(U({},i),c.getChildContext())),g&&!f&&c.getSnapshotBeforeUpdate!=null&&(h=c.getSnapshotBeforeUpdate(_,p)),R=y!=null&&y.type===J&&y.key==null?$t(y.props.children):y,a=wt(t,Pe(R)?R:[R],e,n,i,r,o,l,a,d,u),c.base=e.__e,e.__u&=-161,c.__h.length&&l.push(c),v&&(c.__E=c.__=null)}catch(D){if(e.__v=null,d||o!=null)if(D.then){for(e.__u|=d?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,e.__e=a}else{for(j=o.length;j--;)Xe(o[j]);Fe(e)}else e.__e=n.__e,e.__k=n.__k,D.then||Fe(e);k.__e(D,e,n)}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=Jt(n.__e,e,n,i,r,o,l,d,u);return(y=k.diffed)&&y(e),128&e.__u?void 0:a}function Fe(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Fe))}function St(t,e,n){for(var i=0;i<n.length;i++)Ve(n[i],n[++i],n[++i]);k.__c&&k.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(o){o.call(r)})}catch(o){k.__e(o,r.__v)}})}function $t(t){return typeof t!="object"||t==null||t.__b>0?t:Pe(t)?t.map($t):U({},t)}function Jt(t,e,n,i,r,o,l,a,d){var u,y,c,f,_,p,h,v=n.props||xe,m=e.props,g=e.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((_=o[u])&&"setAttribute"in _==!!g&&(g?_.localName==g:_.nodeType==3)){t=_,o[u]=null;break}}if(t==null){if(g==null)return document.createTextNode(m);t=document.createElementNS(r,g,m.is&&m),a&&(k.__m&&k.__m(e,o),a=!1),o=null}if(g==null)v===m||a&&t.data==m||(t.data=m);else{if(o=o&&Ie.call(t.childNodes),!a&&o!=null)for(v={},u=0;u<t.attributes.length;u++)v[(_=t.attributes[u]).name]=_.value;for(u in v)_=v[u],u=="dangerouslySetInnerHTML"?c=_:u=="children"||u in m||u=="value"&&"defaultValue"in m||u=="checked"&&"defaultChecked"in m||ve(t,u,null,_,r);for(u in m)_=m[u],u=="children"?f=_:u=="dangerouslySetInnerHTML"?y=_:u=="value"?p=_:u=="checked"?h=_:a&&typeof _!="function"||v[u]===_||ve(t,u,_,v[u],r);if(y)a||c&&(y.__html==c.__html||y.__html==t.innerHTML)||(t.innerHTML=y.__html),e.__k=[];else if(c&&(t.innerHTML=""),wt(e.type=="template"?t.content:t,Pe(f)?f:[f],e,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,l,o?o[0]:n.__k&&ie(n,0),a,d),o!=null)for(u=o.length;u--;)Xe(o[u]);a||(u="value",g=="progress"&&p==null?t.removeAttribute("value"):p!=null&&(p!==t[u]||g=="progress"&&!p||g=="option"&&p!=v[u])&&ve(t,u,p,v[u],r),u="checked",h!=null&&h!=t[u]&&ve(t,u,h,v[u],r))}return t}function Ve(t,e,n){try{if(typeof t=="function"){var i=typeof t.__u=="function";i&&t.__u(),i&&e==null||(t.__u=t(e))}else t.current=e}catch(r){k.__e(r,n)}}function Ct(t,e,n){var i,r;if(k.unmount&&k.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||Ve(i,null,e)),(i=t.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){k.__e(o,e)}i.base=i.__P=null}if(i=t.__k)for(r=0;r<i.length;r++)i[r]&&Ct(i[r],e,n||typeof t.type!="function");n||Xe(t.__e),t.__c=t.__=t.__e=void 0}function Vt(t,e,n){return this.constructor(t,n)}function Yt(t,e,n){var i,r,o,l;e==document&&(e=document.documentElement),k.__&&k.__(t,e),r=(i=!1)?null:e.__k,o=[],l=[],Je(e,t=e.__k=zt(J,null,[t]),r||xe,xe,e.namespaceURI,r?null:e.firstChild?Ie.call(e.childNodes):null,o,r?r.__e:e.firstChild,i,l),St(o,t,l)}Ie=we.slice,k={__e:function(t,e,n,i){for(var r,o,l;e=e.__;)if((r=e.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(t)),l=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(t,i||{}),l=r.__d),l)return r.__E=r}catch(a){t=a}throw t}},vt=0,mt=function(t){return t!=null&&t.constructor===void 0},ue.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=U({},this.state),typeof t=="function"&&(t=t(U({},n),this.props)),t&&U(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),et(this))},ue.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),et(this))},ue.prototype.render=J,F=[],gt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,yt=function(t,e){return t.__v.__b-e.__v.__b},ke.__r=0,Me=Math.random().toString(8),ge="__d"+Me,ce="__a"+Me,bt=/(PointerCapture)$|Capture$/i,Ke=0,qe=nt(!1),He=nt(!0);var Gt=0;function s(t,e,n,i,r,o){e||(e={});var l,a,d=e;if("ref"in d)for(a in d={},e)a=="ref"?l=e[a]:d[a]=e[a];var u={type:t,props:d,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Gt,__i:-1,__u:0,__source:r,__self:o};if(typeof t=="function"&&(l=t.defaultProps))for(a in l)d[a]===void 0&&(d[a]=l[a]);return k.vnode&&k.vnode(u),u}var fe,E,De,ot,_e=0,Et=[],A=k,it=A.__b,rt=A.__r,lt=A.diffed,at=A.__c,st=A.unmount,ct=A.__;function Ye(t,e){A.__h&&A.__h(E,t,_e||e),_e=0;var n=E.__H||(E.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function V(t){return _e=1,Zt(Tt,t)}function Zt(t,e,n){var i=Ye(fe++,2);if(i.t=t,!i.__c&&(i.__=[Tt(void 0,e),function(a){var d=i.__N?i.__N[0]:i.__[0],u=i.t(d,a);d!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=E,!E.__f)){var r=function(a,d,u){if(!i.__c.__H)return!0;var y=i.__c.__H.__.filter(function(f){return f.__c});if(y.every(function(f){return!f.__N}))return!o||o.call(this,a,d,u);var c=i.__c.props!==a;return y.some(function(f){if(f.__N){var _=f.__[0];f.__=f.__N,f.__N=void 0,_!==f.__[0]&&(c=!0)}}),o&&o.call(this,a,d,u)||c};E.__f=!0;var o=E.shouldComponentUpdate,l=E.componentWillUpdate;E.componentWillUpdate=function(a,d,u){if(this.__e){var y=o;o=void 0,r(a,d,u),o=y}l&&l.call(this,a,d,u)},E.shouldComponentUpdate=r}return i.__N||i.__}function M(t,e){var n=Ye(fe++,3);!A.__s&&At(n.__H,e)&&(n.__=t,n.u=e,E.__H.__h.push(n))}function z(t){return _e=5,Re(function(){return{current:t}},[])}function Re(t,e){var n=Ye(fe++,7);return At(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Qt(t,e){return _e=8,Re(function(){return t},e)}function en(){for(var t;t=Et.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(be),e.__h.some(We),e.__h=[]}catch(n){e.__h=[],A.__e(n,t.__v)}}}A.__b=function(t){E=null,it&&it(t)},A.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ct&&ct(t,e)},A.__r=function(t){rt&&rt(t),fe=0;var e=(E=t.__c).__H;e&&(De===E?(e.__h=[],E.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(be),e.__h.some(We),e.__h=[],fe=0)),De=E},A.diffed=function(t){lt&<(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Et.push(e)!==1&&ot===A.requestAnimationFrame||((ot=A.requestAnimationFrame)||tn)(en)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),De=E=null},A.__c=function(t,e){e.some(function(n){try{n.__h.some(be),n.__h=n.__h.filter(function(i){return!i.__||We(i)})}catch(i){e.some(function(r){r.__h&&(r.__h=[])}),e=[],A.__e(i,n.__v)}}),at&&at(t,e)},A.unmount=function(t){st&&st(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(i){try{be(i)}catch(r){e=r}}),n.__H=void 0,e&&A.__e(e,n.__v))};var ut=typeof requestAnimationFrame=="function";function tn(t){var e,n=function(){clearTimeout(i),ut&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,35);ut&&(e=requestAnimationFrame(n))}function be(t){var e=E,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),E=e}function We(t){var e=E;t.__c=t.__(),E=e}function At(t,e){return!t||t.length!==e.length||e.some(function(n,i){return n!==t[i]})}function Tt(t,e){return typeof e=="function"?e(t):e}var nn=Symbol.for("preact-signals");function je(){if(q>1)q--;else{var t,e=!1;for((function(){var r=$e;for($e=void 0;r!==void 0;)r.S.v===r.v&&(r.S.i=r.i),r=r.o})();de!==void 0;){var n=de;for(de=void 0,Se++;n!==void 0;){var i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&It(n))try{n.c()}catch(r){e||(t=r,e=!0)}n=i}}if(Se=0,q--,e)throw t}}function on(t){if(q>0)return t();ze=++rn,q++;try{return t()}finally{je()}}var w=void 0;function Nt(t){var e=w;w=void 0;try{return t()}finally{w=e}}var de=void 0,q=0,Se=0,rn=0,ze=0,$e=void 0,Ce=0;function Lt(t){if(w!==void 0){var e=t.n;if(e===void 0||e.t!==w)return e={i:0,S:t,p:w.s,n:void 0,t:w,e:void 0,x:void 0,r:e},w.s!==void 0&&(w.s.n=e),w.s=e,t.n=e,32&w.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=w.s,e.n=void 0,w.s.n=e,w.s=e),e}}function I(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}I.prototype.brand=nn;I.prototype.h=function(){return!0};I.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:Nt(function(){var i;(i=e.W)==null||i.call(e)}))};I.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,i=t.x;n!==void 0&&(n.x=i,t.e=void 0),i!==void 0&&(i.e=n,t.x=void 0),t===this.t&&(this.t=i,i===void 0&&Nt(function(){var r;(r=e.Z)==null||r.call(e)}))}};I.prototype.subscribe=function(t){var e=this;return he(function(){var n=e.value,i=w;w=void 0;try{t(n)}finally{w=i}},{name:"sub"})};I.prototype.valueOf=function(){return this.value};I.prototype.toString=function(){return this.value+""};I.prototype.toJSON=function(){return this.value};I.prototype.peek=function(){var t=w;w=void 0;try{return this.value}finally{w=t}};Object.defineProperty(I.prototype,"value",{get:function(){var t=Lt(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Se>100)throw new Error("Cycle detected");(function(n){q!==0&&Se===0&&n.l!==ze&&(n.l=ze,$e={S:n,v:n.v,i:n.i,o:$e})})(this),this.v=t,this.i++,Ce++,q++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{je()}}}});function T(t,e){return new I(t,e)}function It(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Pt(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Rt(t){for(var e=t.s,n=void 0;e!==void 0;){var i=e.p;e.i===-1?(e.S.U(e),i!==void 0&&(i.n=e.n),e.n!==void 0&&(e.n.p=i)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=i}t.s=n}function ee(t,e){I.call(this,void 0),this.x=t,this.s=void 0,this.g=Ce-1,this.f=4,this.W=e==null?void 0:e.watched,this.Z=e==null?void 0:e.unwatched,this.name=e==null?void 0:e.name}ee.prototype=new I;ee.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ce))return!0;if(this.g=Ce,this.f|=1,this.i>0&&!It(this))return this.f&=-2,!0;var t=w;try{Pt(this),w=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return w=t,Rt(this),this.f&=-2,!0};ee.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}I.prototype.S.call(this,t)};ee.prototype.U=function(t){if(this.t!==void 0&&(I.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}};ee.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}};Object.defineProperty(ee.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Lt(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Y(t,e){return new ee(t,e)}function jt(t){var e=t.m;if(t.m=void 0,typeof e=="function"){q++;var n=w;w=void 0;try{e()}catch(i){throw t.f&=-2,t.f|=8,Ge(t),i}finally{w=n,je()}}}function Ge(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,jt(t)}function ln(t){if(w!==this)throw new Error("Out-of-order effect");Rt(this),w=t,this.f&=-2,8&this.f&&Ge(this),je()}function re(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e==null?void 0:e.name}re.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}};re.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,jt(this),Pt(this),q++;var t=w;return w=this,ln.bind(this,t)};re.prototype.N=function(){2&this.f||(this.f|=2,this.u=de,de=this)};re.prototype.d=function(){this.f|=8,1&this.f||Ge(this)};re.prototype.dispose=function(){this.d()};function he(t,e){var n=new re(t,e);try{n.c()}catch(r){throw n.d(),r}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}var Mt,me,an=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Dt=[];he(function(){Mt=this.N})();function le(t,e){k[t]=e.bind(null,k[t]||function(){})}function Ee(t){if(me){var e=me;me=void 0,e()}me=t&&t.S()}function Ut(t){var e=this,n=t.data,i=cn(n);i.value=n;var r=Re(function(){for(var a=e,d=e.__v;d=d.__;)if(d.__c){d.__c.__$f|=4;break}var u=Y(function(){var _=i.value.value;return _===0?0:_===!0?"":_||""}),y=Y(function(){return!Array.isArray(u.value)&&!mt(u.value)}),c=he(function(){if(this.N=Ot,y.value){var _=u.value;a.__v&&a.__v.__e&&a.__v.__e.nodeType===3&&(a.__v.__e.data=_)}}),f=e.__$u.d;return e.__$u.d=function(){c(),f.call(this)},[y,u]},[]),o=r[0],l=r[1];return o.value?l.peek():l.value}Ut.displayName="ReactiveTextNode";Object.defineProperties(I.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Ut},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}});le("__b",function(t,e){if(typeof e.type=="string"){var n,i=e.props;for(var r in i)if(r!=="children"){var o=i[r];o instanceof I&&(n||(e.__np=n={}),n[r]=o,i[r]=o.peek())}}t(e)});le("__r",function(t,e){if(t(e),e.type!==J){Ee();var n,i=e.__c;i&&(i.__$f&=-2,(n=i.__$u)===void 0&&(i.__$u=n=(function(r,o){var l;return he(function(){l=this},{name:o}),l.c=r,l})(function(){var r;an&&((r=n.y)==null||r.call(n)),i.__$f|=1,i.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),Ee(n)}});le("__e",function(t,e,n,i){Ee(),t(e,n,i)});le("diffed",function(t,e){Ee();var n;if(typeof e.type=="string"&&(n=e.__e)){var i=e.__np,r=e.props;if(i){var o=n.U;if(o)for(var l in o){var a=o[l];a!==void 0&&!(l in i)&&(a.d(),o[l]=void 0)}else o={},n.U=o;for(var d in i){var u=o[d],y=i[d];u===void 0?(u=sn(n,d,y),o[d]=u):u.o(y,r)}for(var c in i)r[c]=i[c]}}t(e)});function sn(t,e,n,i){var r=e in t&&t.ownerSVGElement===void 0,o=T(n),l=n.peek();return{o:function(a,d){o.value=a,l=a.peek()},d:he(function(){this.N=Ot;var a=o.value.value;l!==a?(l=void 0,r?t[e]=a:a!=null&&(a!==!1||e[4]==="-")?t.setAttribute(e,a):t.removeAttribute(e)):l=void 0})}}le("unmount",function(t,e){if(typeof e.type=="string"){var n=e.__e;if(n){var i=n.U;if(i){n.U=void 0;for(var r in i){var o=i[r];o&&o.d()}}}e.__np=void 0}else{var l=e.__c;if(l){var a=l.__$u;a&&(l.__$u=void 0,a.d())}}t(e)});le("__h",function(t,e,n,i){(i<3||i===9)&&(e.__$f|=2),t(e,n,i)});ue.prototype.shouldComponentUpdate=function(t,e){if(this.__R)return!0;var n=this.__$u,i=n&&n.s!==void 0;for(var r in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(i||o||4&this.__$f)||1&this.__$f)return!0}else if(!(i||4&this.__$f)||3&this.__$f)return!0;for(var l in t)if(l!=="__source"&&t[l]!==this.props[l])return!0;for(var a in this.props)if(!(a in t))return!0;return!1};function cn(t,e){return Re(function(){return T(t,e)},[])}var un=function(t){queueMicrotask(function(){queueMicrotask(t)})};function dn(){on(function(){for(var t;t=Dt.shift();)Mt.call(t)})}function Ot(){Dt.push(this)===1&&(k.requestAnimationFrame||un)(dn)}const W=T([]),X=T(null),H=T(""),oe=T([]);T(null);const C=T([]),L=T([]),O=T(null),pe=T(!1),Ae=T(null),Te=T(null),B=T(localStorage.getItem("mdprobe-left-panel")!=="false"),K=T(localStorage.getItem("mdprobe-right-panel")!=="false"),Z=T(localStorage.getItem("mdprobe-theme")||"mocha"),Ne=T(!1);B.subscribe(t=>localStorage.setItem("mdprobe-left-panel",t));K.subscribe(t=>localStorage.setItem("mdprobe-right-panel",t));const Le=T("anonymous"),Ue=T(!1),Q=Y(()=>C.value.filter(t=>t.status==="open"));Y(()=>C.value.filter(t=>t.status==="resolved"));const Be=Y(()=>{let t=pe.value?C.value:C.value.filter(e=>e.status==="open");return Ae.value&&(t=t.filter(e=>e.tag===Ae.value)),Te.value&&(t=t.filter(e=>e.author===Te.value)),t}),fn=Y(()=>[...new Set(C.value.map(t=>t.tag))]),_n=Y(()=>[...new Set(C.value.map(t=>t.author))]),se=T(2),ne=Y(()=>{const t=se.value,e=L.value.filter(r=>r.level===t),n=e.length,i=e.filter(r=>r.status!=="pending").length;return{total:n,reviewed:i}}),dt=2e3,pn=3e4;function hn(){const t=z(null),e=z(dt),n=z(null),i=z(!1),r=Qt(()=>{if(i.current)return;const o=location.protocol==="https:"?"wss:":"ws:",l=new WebSocket(`${o}//${location.host}/ws`);t.current=l,l.onopen=()=>{e.current=dt},l.onmessage=a=>{let d;try{d=JSON.parse(a.data)}catch{console.warn("mdprobe: received non-JSON WebSocket message");return}switch(d.type){case"update":{const u=document.querySelector(".content-area"),y=u?u.scrollTop:0;H.value=d.html,oe.value=d.toc||[],u&&requestAnimationFrame(()=>{u.scrollTop=y});break}case"file-added":W.value.some(u=>u.path===d.file)||(W.value=[...W.value,{path:d.file,label:d.file.replace(/\.md$/,"")}]);break;case"file-removed":W.value=W.value.filter(u=>u.path!==d.file);break;case"annotations":(!d.file||d.file===X.value)&&(C.value=d.annotations||[],L.value=d.sections||[]);break;case"drift":Ne.value=d.warning||!0;break;case"error":console.warn("mdprobe:",d.message);break}},l.onerror=a=>{console.warn("mdprobe: WebSocket error",a)},l.onclose=()=>{if(t.current=null,i.current)return;const a=e.current;e.current=Math.min(a*2,pn);const d=Math.random()*a*.3;n.current=setTimeout(r,a+d)}},[]);return M(()=>(i.current=!1,r(),()=>{var o;i.current=!0,clearTimeout(n.current),(o=t.current)==null||o.close(),t.current=null}),[r]),t}function vn({onShowHelp:t}={}){M(()=>{function e(n){var r,o;const i=(r=document.activeElement)==null?void 0:r.tagName;if(!(i==="TEXTAREA"||i==="INPUT"||i==="SELECT")&&!((o=document.activeElement)!=null&&o.isContentEditable))switch(n.key){case"[":n.preventDefault(),B.value=!B.value;break;case"]":n.preventDefault(),K.value=!K.value;break;case"\\":{n.preventDefault();const l=B.value&&K.value;B.value=!l,K.value=!l;break}case"j":n.preventDefault(),ft(1);break;case"k":n.preventDefault(),ft(-1);break;case"r":break;case"e":break;case"?":n.preventDefault(),t==null||t();break}}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t])}function ft(t){const e=Be.value;if(e.length===0)return;const n=O.value,i=e.findIndex(d=>d.id===n);let r;i===-1?r=t>0?0:e.length-1:(r=i+t,r<0&&(r=e.length-1),r>=e.length&&(r=0));const o=e[r];O.value=o.id;const l=document.querySelector(`[data-annotation-id="${o.id}"]`);l==null||l.scrollIntoView({behavior:"smooth",block:"nearest"});const a=document.querySelector(`[data-highlight-id="${o.id}"]`);a==null||a.scrollIntoView({behavior:"smooth",block:"center"})}const mn=[{id:"mocha",label:"Mocha",color:"#1e1e2e"},{id:"macchiato",label:"Macchiato",color:"#24273a"},{id:"frappe",label:"Frappé",color:"#303446"},{id:"latte",label:"Latte",color:"#eff1f5"},{id:"light",label:"Light",color:"#ffffff"}],gn="mdprobe-theme";function yn(){M(()=>(_t(Z.value),Z.subscribe(n=>{_t(n)})),[]);function t(e){Z.value=e}return{theme:Z,setTheme:t,themes:mn}}function _t(t){document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem(gn,t)}catch{}}const Oe="";function bn(){async function t(p){const h=await fetch(`${Oe}/api/annotations?path=${encodeURIComponent(p)}`);if(!h.ok)throw new Error(`Failed to fetch annotations: ${h.status}`);const v=await h.json();return C.value=v.annotations||[],L.value=v.sections||[],v.sectionLevel!=null&&(se.value=v.sectionLevel),Ne.value=v.drift||!1,v}async function e({selectors:p,comment:h,tag:v}){const m=await f("add",{selectors:p,comment:h,tag:v,author:Le.value});return C.value=m.annotations||C.value,m}async function n(p){const h=await f("resolve",{id:p});C.value=h.annotations||C.value}async function i(p){const h=await f("reopen",{id:p});C.value=h.annotations||C.value}async function r(p,{comment:h,tag:v}){const m=await f("update",{id:p,comment:h,tag:v});C.value=m.annotations||C.value}async function o(p){const h=await f("delete",{id:p});C.value=h.annotations||C.value}async function l(p,h){const v=await f("reply",{id:p,author:Le.value,comment:h});C.value=v.annotations||C.value}async function a(p){const h=await _("approve",{heading:p});L.value=h.sections||L.value,h.sectionLevel!=null&&(se.value=h.sectionLevel)}async function d(p){const h=await _("reject",{heading:p});L.value=h.sections||L.value,h.sectionLevel!=null&&(se.value=h.sectionLevel)}async function u(){const p=await _("approveAll");L.value=p.sections||L.value}async function y(p){const h=await _("reset",{heading:p});L.value=h.sections||L.value,h.sectionLevel!=null&&(se.value=h.sectionLevel)}async function c(){const p=await _("clearAll");L.value=p.sections||L.value}async function f(p,h){const v=await fetch(`${Oe}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:X.value,action:p,data:h})});if(!v.ok)throw new Error(`Annotation ${p} failed: ${v.status}`);return v.json()}async function _(p,h={}){const v=await fetch(`${Oe}/api/sections`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:X.value,action:p,...h})});if(!v.ok)throw new Error(`Section ${p} failed: ${v.status}`);return v.json()}return{fetchAnnotations:t,createAnnotation:e,resolveAnnotation:n,reopenAnnotation:i,updateAnnotation:r,deleteAnnotation:o,addReply:l,approveSection:a,rejectSection:d,resetSection:y,approveAllSections:u,clearAllSections:c}}const xn="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js",wn="https://cdn.jsdelivr.net/npm/katex@0.16/dist/katex.min.css",kn="https://cdn.jsdelivr.net/npm/katex@0.16/dist/katex.min.js";let pt=!1,ht=!1;function qt(t){return new Promise((e,n)=>{if(document.querySelector(`script[src="${t}"]`))return e();const i=document.createElement("script");i.src=t,i.onload=e,i.onerror=n,document.head.appendChild(i)})}function Sn(t){if(document.querySelector(`link[href="${t}"]`))return;const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}function $n(){const t=z("");M(()=>{if(H.value===t.current)return;t.current=H.value;const e=document.querySelectorAll("pre.mermaid:not([data-processed])");e.length>0&&Cn(e);const n=document.querySelectorAll("[data-math], .math-inline, .math-display");n.length>0&&En(n)},[H.value,Z.value])}async function Cn(t){try{pt||(await qt(xn),pt=!0);const e=!["latte","light"].includes(Z.value);window.mermaid.initialize({startOnLoad:!1,theme:e?"dark":"default"});for(const n of t)n.setAttribute("data-processed","true");await window.mermaid.run({nodes:[...t]})}catch(e){console.warn("mdprobe: Mermaid rendering failed",e)}}async function En(t){try{ht||(Sn(wn),await qt(kn),ht=!0);for(const e of t){if(e.getAttribute("data-katex-rendered"))continue;const n=e.textContent,i=e.classList.contains("math-display");try{window.katex.render(n,e,{displayMode:i,throwOnError:!1}),e.setAttribute("data-katex-rendered","true")}catch{}}}catch(e){console.warn("mdprobe: KaTeX rendering failed",e)}}function An({onFileSelect:t}){const e=!B.value;function n(i){const r=oe.value,o=r[i];if(!o)return 0;const l=o.line;let a=1/0;for(let d=i+1;d<r.length;d++)if(r[d].level<=o.level){a=r[d].line;break}return Q.value.filter(d=>{var y,c;const u=(c=(y=d.selectors)==null?void 0:y.position)==null?void 0:c.startLine;return u!=null&&u>=l&&u<a}).length}return s("aside",{class:`left-panel ${e?"collapsed":""}`,children:e?s("div",{class:"panel-collapsed-indicator",onClick:()=>B.value=!0,children:[s("span",{children:"☰"}),s("span",{class:"shortcut-key",children:"["}),Q.value.length>0&&s("span",{class:"badge",children:Q.value.length})]}):s("div",{class:"panel-content",children:[s("div",{class:"panel-header",style:"padding: 12px; display: flex; justify-content: space-between; align-items: center",children:[s("span",{style:"font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted)",children:"Files & TOC"}),s("button",{class:"btn btn-sm btn-ghost",onClick:()=>B.value=!1,children:"×"})]}),W.value.length>1&&s("div",{style:"padding: 0 8px 8px",children:[s("div",{style:"font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 4px 4px 6px; font-weight: 600",children:"Files"}),W.value.map(i=>{const r=i.path||i,o=i.label||r.replace(".md",""),l=r===X.value;return s("div",{class:`file-item ${l?"active":""}`,onClick:()=>t(r),children:[s("span",{class:"icon",children:"📄"}),s("span",{children:o})]},r)})]}),s("div",{style:"padding: 0 8px",children:[s("div",{style:"font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 4px 4px 6px; font-weight: 600",children:"Sections"}),oe.value.length===0?s("div",{style:"padding: 8px; color: var(--text-muted); font-size: 13px",children:"No sections"}):oe.value.map((i,r)=>{const o=n(r),l=L.value.find(d=>d.heading===i.heading&&d.level===i.level),a=(l==null?void 0:l.status)==="approved"?"dot-approved":(l==null?void 0:l.status)==="rejected"?"dot-rejected":"";return s("div",{class:`toc-item level-${i.level}`,onClick:()=>{const d=document.querySelector(`[data-source-line="${i.line}"]`);d==null||d.scrollIntoView({behavior:"smooth",block:"start"})},children:[a&&s("span",{class:`toc-dot ${a}`}),i.heading,o>0&&s("span",{class:"badge",style:"margin-left: 6px",children:o})]},r)})]})]})})}const Tn=[{value:"question",label:"Question"},{value:"bug",label:"Bug"},{value:"suggestion",label:"Suggestion"},{value:"nitpick",label:"Nitpick"}];function Ht({annotation:t,selectors:e,exact:n,onSave:i,onCancel:r}){const o=!!t,[l,a]=V((t==null?void 0:t.comment)||""),[d,u]=V((t==null?void 0:t.tag)||"question");function y(f){f.preventDefault(),l.trim()&&i(o?{comment:l.trim(),tag:d}:{selectors:e,comment:l.trim(),tag:d})}function c(f){(f.metaKey||f.ctrlKey)&&f.key==="Enter"&&y(f),f.key==="Escape"&&r()}return s("form",{class:"annotation-form",onSubmit:y,onKeyDown:c,onClick:f=>f.stopPropagation(),children:[n&&s("div",{class:"annotation-form__quote",children:n}),s("div",{class:"annotation-form__tags",children:Tn.map(f=>s("button",{type:"button",class:`tag-pill tag-pill--${f.value}${d===f.value?" tag-pill--active":""}`,onClick:()=>u(f.value),children:f.label},f.value))}),s("textarea",{value:l,onInput:f=>a(f.target.value),placeholder:"Add your comment... (Ctrl+Enter to save)",autoFocus:!0}),s("div",{class:"annotation-form__actions",children:[s("span",{class:"annotation-form__hint",children:"Ctrl+Enter to save · Esc to close"}),s("button",{type:"button",class:"btn btn--ghost",onClick:r,children:"Cancel"}),s("button",{type:"submit",class:"btn btn--primary",disabled:!l.trim(),children:o?"Save":"Annotate"})]})]})}function Nn({replies:t}){return!t||t.length===0?null:s("div",{style:"margin-top: 8px",children:t.map((e,n)=>s("div",{class:"reply",children:[s("div",{class:"author",children:e.author}),s("div",{class:"text",children:e.comment}),s("div",{style:"font-size: 10px; color: var(--text-muted); margin-top: 2px",children:Ln(e.created_at)})]},n))})}function Ln(t){if(!t)return"";try{const e=new Date(t);return e.toLocaleDateString(void 0,{month:"short",day:"numeric"})+" "+e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}catch{return t}}function In({annotationOps:t}){const e=!K.value,[n,i]=V(null);function r(o){O.value=o.id;const l=document.querySelector(`[data-highlight-id="${o.id}"]`);l==null||l.scrollIntoView({behavior:"smooth",block:"center"})}return s("aside",{class:`right-panel ${e?"collapsed":""}`,children:e?s("div",{class:"panel-collapsed-indicator",onClick:()=>K.value=!0,children:[s("span",{children:"💬"}),s("span",{class:"shortcut-key",children:"]"}),Q.value.length>0&&s("span",{class:"badge",children:Q.value.length})]}):s("div",{class:"panel-content",children:[s("div",{class:"panel-header",style:"padding: 12px; display: flex; justify-content: space-between; align-items: center",children:[s("span",{style:"font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted)",children:["Annotations (",Q.value.length," open)"]}),s("button",{class:"btn btn-sm btn-ghost",onClick:()=>K.value=!1,children:"×"})]}),s("div",{style:"padding: 0 12px 8px; display: flex; gap: 6px; flex-wrap: wrap",children:[s("select",{class:"filter-select",value:Ae.value||"",onChange:o=>Ae.value=o.target.value||null,style:"padding: 3px 6px; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-primary); color: var(--text-primary)",children:[s("option",{value:"",children:"All tags"}),fn.value.map(o=>s("option",{value:o,children:o},o))]}),s("select",{value:Te.value||"",onChange:o=>Te.value=o.target.value||null,style:"padding: 3px 6px; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-primary); color: var(--text-primary)",children:[s("option",{value:"",children:"All authors"}),_n.value.map(o=>s("option",{value:o,children:o},o))]}),s("label",{style:"display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); cursor: pointer",children:[s("input",{type:"checkbox",checked:pe.value,onChange:o=>pe.value=o.target.checked}),"Show resolved"]})]}),s("div",{style:"overflow-y: auto; padding: 0 8px; flex: 1",children:Be.value.length===0?s("div",{style:"padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px",children:"No annotations"}):Be.value.map(o=>{var l,a,d;return s("div",{"data-annotation-id":o.id,class:`annotation-card ${O.value===o.id?"selected":""} ${o.status==="resolved"?"resolved":""}`,onClick:()=>r(o),children:[s("div",{style:"display: flex; align-items: center; gap: 6px; margin-bottom: 6px",children:[s("span",{class:`tag tag-${o.tag}`,children:o.tag}),s("span",{style:"font-size: 11px; color: var(--text-muted)",children:o.author}),o.status==="resolved"&&s("span",{style:"font-size: 10px; color: var(--status-approved)",children:"✓ resolved"})]}),((a=(l=o.selectors)==null?void 0:l.quote)==null?void 0:a.exact)&&s("div",{class:"quote",children:o.selectors.quote.exact}),s("div",{style:"font-size: 13px; margin-top: 4px",children:o.comment}),O.value===o.id&&s("div",{style:"margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap",children:[o.status==="open"?s("button",{class:"btn btn-sm",onClick:u=>{u.stopPropagation(),t.resolveAnnotation(o.id)},children:"Resolve"}):s("button",{class:"btn btn-sm",onClick:u=>{u.stopPropagation(),t.reopenAnnotation(o.id)},children:"Reopen"}),s("button",{class:"btn btn-sm",onClick:u=>{u.stopPropagation(),i(o.id)},children:"Edit"}),s("button",{class:"btn btn-sm btn-danger",onClick:u=>{u.stopPropagation(),confirm("Delete this annotation?")&&t.deleteAnnotation(o.id)},children:"Delete"})]}),n===o.id&&s(Ht,{annotation:o,onSave:u=>{t.updateAnnotation(o.id,u),i(null)},onCancel:()=>i(null)}),((d=o.replies)==null?void 0:d.length)>0&&s(Nn,{replies:o.replies}),O.value===o.id&&s(Pn,{annotationId:o.id,onReply:t.addReply})]},o.id)})})]})})}function Pn({annotationId:t,onReply:e}){const[n,i]=V("");function r(o){o.preventDefault(),n.trim()&&(e(t,n.trim()),i(""))}return s("form",{class:"reply-input",onSubmit:r,onClick:o=>o.stopPropagation(),children:[s("input",{type:"text",value:n,onInput:o=>i(o.target.value),placeholder:"Reply..."}),s("button",{type:"submit",class:"btn btn-sm btn-primary",disabled:!n.trim(),children:"Reply"})]})}function Rn({x:t,y:e,exact:n,selectors:i,onSave:r,onCancel:o}){const l=z(null),a=z({active:!1,startX:0,startY:0}),d=520,u=440,y=typeof window<"u"?window.innerWidth:800,_=(typeof window<"u"?window.innerHeight:800)-e<u,p=Math.max(16,Math.min(t-d/2,y-d-16)),h=_?Math.max(8,e-u-8):e,[v,m]=V({left:p,top:h});M(()=>{function b(x){x.key==="Escape"&&o()}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]),M(()=>{function b(S){a.current.active&&m({left:S.clientX-a.current.startX,top:S.clientY-a.current.startY})}function x(){a.current.active=!1}return document.addEventListener("mousemove",b),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",x)}},[]);function g(b){b.button===0&&(a.current={active:!0,startX:b.clientX-v.left,startY:b.clientY-v.top},b.preventDefault())}const $={position:"fixed",left:`${v.left}px`,top:`${v.top}px`,width:`${d}px`,zIndex:101};return s("div",{class:"popover popover--enter",ref:l,style:$,children:[s("div",{class:"popover__header",onMouseDown:g,children:[s("span",{class:"popover__title",children:"New Annotation"}),s("button",{type:"button",class:"popover__close",onClick:o,"aria-label":"Close",children:"×"})]}),s(Ht,{exact:n,selectors:i,onSave:r,onCancel:o})]})}function jn({annotationOps:t}){const e=z(null),[n,i]=V(null);M(()=>{var p,h,v,m,g,$;const f=e.current;if(!f)return;f.querySelectorAll("mark[data-highlight-id]").forEach(b=>{const x=b.parentNode;for(;b.firstChild;)x.insertBefore(b.firstChild,b);x.removeChild(b)});const _=pe.value?C.value:C.value.filter(b=>b.status==="open");for(const b of _){const x=(h=(p=b.selectors)==null?void 0:p.position)==null?void 0:h.startLine;if(!x)continue;const S=f.querySelector(`[data-source-line="${x}"]`);if(!S)continue;const R=(m=(v=b.selectors)==null?void 0:v.quote)==null?void 0:m.exact;if(!R)continue;const j=`annotation-highlight tag-${b.tag}${b.status==="resolved"?" resolved":""}${O.value===b.id?" selected":""}`;if(r(S,R,b.id,j))continue;const P=(($=(g=b.selectors)==null?void 0:g.position)==null?void 0:$.endLine)||x;o(f,S,P,R,b.id,j)||x!==P&&l(f,x,P,b.id,j)}},[H.value,C.value,pe.value,O.value]),M(()=>{const f=e.current;!f||L.value.length===0||(f.querySelectorAll(".section-approval-injected").forEach(_=>_.remove()),f.querySelectorAll(":is(h1,h2,h3,h4,h5,h6)[data-source-line]").forEach(_=>{const p=_.textContent.trim(),h=L.value.find(S=>S.heading===p);if(!h)return;const v=h.computed||h.status,m=document.createElement("span");m.className="section-approval-injected";const g=document.createElement("button"),$=v==="approved"?" section-status approved":v==="indeterminate"?" section-status indeterminate":"";g.className=`btn btn-sm${$}`,g.textContent=v==="indeterminate"?"─":"✓",g.title=v==="indeterminate"?"Partially approved — click to approve all":"Approve section",g.onclick=S=>{S.stopPropagation(),h.status==="approved"?t.resetSection(p):t.approveSection(p)};const b=document.createElement("button");b.className=`btn btn-sm${v==="rejected"?" section-status rejected":""}`,b.textContent="✗",b.title="Reject section",b.onclick=S=>{S.stopPropagation(),h.status==="rejected"?t.resetSection(p):t.rejectSection(p)};const x=v!=="pending"?v:"";if(x){const S=document.createElement("span");S.className=`section-status-label ${v}`,S.style.cssText="font-size: 10px; margin-left: 4px",S.textContent=x,m.appendChild(S)}m.style.cssText="display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle",m.insertBefore(b,m.firstChild),m.insertBefore(g,m.firstChild),_.appendChild(m)}))},[H.value,L.value]);function r(f,_,p,h){const v=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);let m;for(;m=v.nextNode();){const g=m.textContent.indexOf(_);if(g===-1)continue;const $=document.createRange();$.setStart(m,g),$.setEnd(m,g+_.length);const b=document.createElement("mark");b.setAttribute("data-highlight-id",p),b.className=h;try{$.surroundContents(b)}catch{return!1}return!0}return!1}function o(f,_,p,h,v,m){var D,Ze;const g=[],$=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);let b,x=!1;for(;b=$.nextNode();){if(!x&&_.contains(b)&&(x=!0),!x)continue;g.push(b);const N=d(b,f);if(N&&parseInt(N.getAttribute("data-source-line"))>p)break}if(g.length===0)return!1;let S="";const R=[];for(let N=0;N<g.length;N++){if(N>0){const ae=(D=g[N-1].parentElement)==null?void 0:D.closest("[data-source-line]"),te=(Ze=g[N].parentElement)==null?void 0:Ze.closest("[data-source-line]");ae!==te&&(S+=`
|
|
2
|
+
`)}const G=S.length;S+=g[N].textContent,R.push({node:g[N],startInConcat:G,endInConcat:S.length})}let j=S.indexOf(h);if(j===-1){const N=S.replace(/\s+/g," "),G=h.replace(/\s+/g," ");if(N.indexOf(G)===-1)return!1;for(const te of R)a(te.node,0,te.node.textContent.length,v,m);return!0}const P=j+h.length;for(const N of R){const G=Math.max(j,N.startInConcat),ae=Math.min(P,N.endInConcat);if(G>=ae)continue;const te=G-N.startInConcat,Ft=ae-N.startInConcat;a(N.node,te,Ft,v,m)}return!0}function l(f,_,p,h,v){const m=f.querySelectorAll("[data-source-line]");for(const g of m){const $=parseInt(g.getAttribute("data-source-line"));if($<_||$>p)continue;const b=document.createTreeWalker(g,NodeFilter.SHOW_TEXT);let x;for(;x=b.nextNode();)x.textContent.trim()!==""&&a(x,0,x.textContent.length,h,v)}}function a(f,_,p,h,v){if(!(_>=p||_>=f.textContent.length))try{const m=document.createRange();m.setStart(f,_),m.setEnd(f,Math.min(p,f.textContent.length));const g=document.createElement("mark");g.setAttribute("data-highlight-id",h),g.className=v,m.surroundContents(g)}catch{}}function d(f,_){var h;let p=f.nodeType===3?f.parentElement:f;for(;p&&p!==_;){if((h=p.hasAttribute)!=null&&h.call(p,"data-source-line"))return p;p=p.parentElement}return null}function u(f){const _=window.getSelection();if(!_||_.isCollapsed||_.toString().trim()==="")return;const p=_.toString(),h=_.getRangeAt(0),v=h.getBoundingClientRect(),m=y(h.startContainer),g=y(h.endContainer);if(m){const $=parseInt(m.getAttribute("data-source-line")),b=parseInt(m.getAttribute("data-source-col")||"1"),x=g?parseInt(g.getAttribute("data-source-line")):$,S=g?parseInt(g.getAttribute("data-source-col")||"1"):b+p.length;i({x:v.left+v.width/2,y:v.bottom+8,exact:p,selectors:{position:{startLine:$,startColumn:b,endLine:x,endColumn:S},quote:{exact:p,prefix:"",suffix:""}}})}}function y(f){var p;let _=f.nodeType===3?f.parentElement:f;for(;_&&_!==e.current;){if((p=_.hasAttribute)!=null&&p.call(_,"data-source-line"))return _;_=_.parentElement}return null}function c(f){const _=f.target.closest("[data-highlight-id]");_&&(O.value=_.getAttribute("data-highlight-id"))}return s("main",{class:"content-area-wrapper",children:[s("div",{class:"content-area",ref:e,onClick:c,onMouseUp:u,dangerouslySetInnerHTML:{__html:H.value||""}}),n&&s(Rn,{x:n.x,y:n.y,exact:n.exact,selectors:n.selectors,onSave:f=>{var _;t.createAnnotation(f),i(null),(_=window.getSelection())==null||_.removeAllRanges()},onCancel:()=>{var f;i(null),(f=window.getSelection())==null||f.removeAllRanges()}})]})}function Mn({themes:t,onSelect:e}){return s("div",{class:"theme-picker",title:"Switch theme",children:t.map(n=>s("button",{class:`theme-swatch ${Z.value===n.id?"active":""}`,style:`background: ${n.color}`,onClick:()=>e(n.id),title:n.label,"aria-label":`Switch to ${n.label} theme`},n.id))})}function Dn(){const[t,e]=V(!1);async function n(i){e(!1);const r=X.value;if(r)try{const o=await fetch(`/api/export?path=${encodeURIComponent(r)}&format=${i}`);if(!o.ok)throw new Error(await o.text());if(i==="report"){const l=await o.text(),a=new Blob([l],{type:"text/markdown"});window.open(URL.createObjectURL(a))}else{const l=await o.blob(),a={inline:".reviewed.md",json:".annotations.json",sarif:".annotations.sarif"}[i],d=document.createElement("a");d.href=URL.createObjectURL(l),d.download=r.replace(".md",a),d.click()}}catch(o){console.error("Export failed:",o),alert(`Export failed: ${o.message}`)}}return s("div",{style:"position: relative",children:[s("button",{class:"btn btn-sm",onClick:()=>e(!t),children:"Export"}),t&&s(J,{children:[s("div",{style:"position: fixed; inset: 0; z-index: 90",onClick:()=>e(!1)}),s("div",{style:"position: absolute; right: 0; top: 100%; margin-top: 4px; z-index: 100; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); min-width: 180px; overflow: hidden",children:[s("button",{class:"export-option",onClick:()=>n("report"),children:"Review Report (.md)"}),s("button",{class:"export-option",onClick:()=>n("inline"),children:"Inline Comments (.md)"}),s("button",{class:"export-option",onClick:()=>n("json"),children:"JSON (.json)"}),s("button",{class:"export-option",onClick:()=>n("sarif"),children:"SARIF (.sarif)"})]})]})]})}function Un(){const[t,e]=V(!1);hn();const{setTheme:n,themes:i}=yn(),r=bn();$n(),vn({onShowHelp:()=>e(l=>!l)}),M(()=>{if(!t)return;function l(a){a.key==="Escape"&&(a.preventDefault(),e(!1))}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t]),M(()=>{fetch("/api/files").then(l=>l.json()).then(l=>{if(W.value=l,l.length>0){const a=l[0].path||l[0];X.value=a,fetch(`/api/file?path=${encodeURIComponent(a)}`).then(d=>d.json()).then(d=>{H.value=d.html,oe.value=d.toc||[]}),r.fetchAnnotations(a)}}),fetch("/api/config").then(l=>l.json()).then(l=>{Le.value=l.author||"anonymous"}),fetch("/api/review/status").then(l=>l.json()).then(l=>{l.mode==="once"&&(Ue.value=!0)}).catch(()=>{})},[]);function o(l){X.value=l,fetch(`/api/file?path=${encodeURIComponent(l)}`).then(a=>a.json()).then(a=>{H.value=a.html,oe.value=a.toc||[]}),r.fetchAnnotations(l)}return s(J,{children:[s("header",{class:"header",children:[s("h1",{children:"mdprobe"}),s("span",{class:"header-file",children:X.value||"No file selected"}),s("div",{style:"flex: 1"}),ne.value.total>0&&(Ue.value||ne.value.reviewed>0)&&s("div",{class:"progress-info",children:[s("span",{children:[ne.value.reviewed,"/",ne.value.total," sections reviewed"]}),s("div",{class:"progress-bar",style:"width: 100px",children:s("div",{class:"fill",style:`width: ${ne.value.reviewed/ne.value.total*100}%`})})]}),s(Dn,{}),s(Mn,{themes:i,onSelect:n}),Ue.value&&s("button",{class:"btn btn-primary btn-sm",onClick:async()=>{try{await fetch("/api/review/finish",{method:"POST"})}catch{}},children:"Finish Review"})]}),Ne.value&&s("div",{class:"drift-banner",children:["Arquivo modificado desde a ultima revisao. Algumas anotacoes podem estar desalinhadas.",s("button",{class:"btn btn-sm",style:"margin-left: 8px",onClick:()=>Ne.value=!1,children:"Dismiss"})]}),s(An,{onFileSelect:o}),s(jn,{annotationOps:r}),s(In,{annotationOps:r}),s("footer",{class:"status-bar",children:[s("span",{children:[Q.value.length," open"]}),s("span",{children:["Author: ",Le.value]}),s("span",{children:"Press ? for shortcuts"})]}),t&&s(J,{children:[s("div",{class:"shortcut-modal overlay",onClick:()=>e(!1)}),s("div",{class:"shortcut-modal",children:[s("h3",{style:"margin-bottom: 12px",children:"Keyboard Shortcuts"}),[["[","Toggle left panel (Files/TOC)"],["]","Toggle right panel (Annotations)"],["\\","Toggle both panels (focus mode)"],["j","Next annotation"],["k","Previous annotation"],["r","Resolve selected annotation"],["e","Edit selected annotation"],["?","Show/hide this help"]].map(([l,a])=>s("div",{class:"shortcut-row",children:[s("span",{children:a}),s("span",{class:"shortcut-key",children:l})]},l)),s("button",{class:"btn btn-sm",style:"margin-top: 12px",onClick:()=>e(!1),children:"Close"})]})]})]})}Yt(s(Un,{}),document.getElementById("app"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[data-theme=mocha]{--bg-primary: #1e1e2e;--bg-secondary: #181825;--bg-tertiary: #313244;--text-primary: #cdd6f4;--text-secondary: #a6adc8;--text-muted: #6c7086;--border: #45475a;--border-subtle: #313244;--accent: #89b4fa;--accent-hover: #74c7ec;--tag-bug: #f38ba8;--tag-question: #89b4fa;--tag-suggestion: #a6e3a1;--tag-nitpick: #f9e2af;--highlight-open: rgba(137, 180, 250, .2);--highlight-resolved: rgba(166, 227, 161, .15);--status-approved: #a6e3a1;--status-rejected: #f38ba8;--status-pending: #45475a;--scrollbar-thumb: #45475a;--scrollbar-track: #1e1e2e}[data-theme=macchiato]{--bg-primary: #24273a;--bg-secondary: #1e2030;--bg-tertiary: #363a4f;--text-primary: #cad3f5;--text-secondary: #a5adcb;--text-muted: #6e738d;--border: #494d64;--border-subtle: #363a4f;--accent: #8aadf4;--accent-hover: #7dc4e4;--tag-bug: #ed8796;--tag-question: #8aadf4;--tag-suggestion: #a6da95;--tag-nitpick: #eed49f;--highlight-open: rgba(138, 173, 244, .2);--highlight-resolved: rgba(166, 218, 149, .15);--status-approved: #a6da95;--status-rejected: #ed8796;--status-pending: #494d64;--scrollbar-thumb: #494d64;--scrollbar-track: #24273a}[data-theme=frappe]{--bg-primary: #303446;--bg-secondary: #292c3c;--bg-tertiary: #414559;--text-primary: #c6d0f5;--text-secondary: #a5adce;--text-muted: #737994;--border: #51576d;--border-subtle: #414559;--accent: #8caaee;--accent-hover: #85c1dc;--tag-bug: #e78284;--tag-question: #8caaee;--tag-suggestion: #a6d189;--tag-nitpick: #e5c890;--highlight-open: rgba(140, 170, 238, .2);--highlight-resolved: rgba(166, 209, 137, .15);--status-approved: #a6d189;--status-rejected: #e78284;--status-pending: #51576d;--scrollbar-thumb: #51576d;--scrollbar-track: #303446}[data-theme=latte]{--bg-primary: #eff1f5;--bg-secondary: #e6e9ef;--bg-tertiary: #ccd0da;--text-primary: #4c4f69;--text-secondary: #5c5f77;--text-muted: #9ca0b0;--border: #bcc0cc;--border-subtle: #ccd0da;--accent: #1e66f5;--accent-hover: #209fb5;--tag-bug: #d20f39;--tag-question: #1e66f5;--tag-suggestion: #40a02b;--tag-nitpick: #df8e1d;--highlight-open: rgba(30, 102, 245, .15);--highlight-resolved: rgba(64, 160, 43, .1);--status-approved: #40a02b;--status-rejected: #d20f39;--status-pending: #ccd0da;--scrollbar-thumb: #bcc0cc;--scrollbar-track: #eff1f5}[data-theme=light]{--bg-primary: #ffffff;--bg-secondary: #f8f9fa;--bg-tertiary: #e9ecef;--text-primary: #212529;--text-secondary: #495057;--text-muted: #adb5bd;--border: #dee2e6;--border-subtle: #e9ecef;--accent: #0d6efd;--accent-hover: #0b5ed7;--tag-bug: #dc3545;--tag-question: #0d6efd;--tag-suggestion: #198754;--tag-nitpick: #fd7e14;--highlight-open: rgba(13, 110, 253, .12);--highlight-resolved: rgba(25, 135, 84, .08);--status-approved: #198754;--status-rejected: #dc3545;--status-pending: #e9ecef;--scrollbar-thumb: #dee2e6;--scrollbar-track: #ffffff}:root{--panel-collapsed-width: 48px;--panel-width: clamp(240px, 18vw, 380px)}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body{height:100%}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}#app{display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:48px 1fr 32px;height:100vh;background:var(--bg-primary);color:var(--text-primary)}.header{grid-column:1 / -1;display:flex;align-items:center;padding:0 16px;background:var(--bg-secondary);border-bottom:1px solid var(--border);gap:12px;z-index:10}.header h1{font-size:14px;font-weight:600;white-space:nowrap}.left-panel{width:var(--panel-width);transition:width .2s ease;overflow:hidden;background:var(--bg-secondary);border-right:1px solid var(--border);display:flex;flex-direction:column}.left-panel.collapsed{width:var(--panel-collapsed-width)}.left-panel .panel-collapsed-indicator{display:none;width:var(--panel-collapsed-width);align-items:center;justify-content:center;height:100%;cursor:pointer}.left-panel.collapsed .panel-collapsed-indicator{display:flex;flex-direction:column;gap:8px;font-size:12px;color:var(--text-muted)}.left-panel.collapsed .panel-content{display:none}.right-panel{width:var(--panel-width);transition:width .2s ease;overflow:hidden;background:var(--bg-secondary);border-left:1px solid var(--border);display:flex;flex-direction:column}.right-panel.collapsed{width:var(--panel-collapsed-width)}.right-panel .panel-collapsed-indicator{display:none;width:var(--panel-collapsed-width);align-items:center;justify-content:center;height:100%;cursor:pointer}.right-panel.collapsed .panel-collapsed-indicator{display:flex;flex-direction:column;gap:8px;font-size:12px;color:var(--text-muted)}.right-panel.collapsed .panel-content{display:none}.panel-header{display:flex;align-items:center;justify-content:space-between;padding:12px 12px 8px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted)}.panel-content{flex:1;overflow-y:auto;padding:4px 8px}.content-area-wrapper{overflow-y:auto;min-width:0}.content-area{padding:32px clamp(24px,3vw,56px);width:100%;line-height:1.7}.annotation-highlight{background:var(--highlight-open);cursor:pointer;border-radius:2px;padding:0 2px;transition:outline-color .15s}.annotation-highlight.resolved{background:var(--highlight-resolved);opacity:.3}.annotation-highlight.selected{outline:2px solid var(--accent);outline-offset:1px}.tag{display:inline-block;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;line-height:1.4}.tag-bug{background:var(--tag-bug);color:#fff}.tag-question{background:var(--tag-question);color:#fff}.tag-suggestion{background:var(--tag-suggestion);color:#fff}.tag-nitpick{background:var(--tag-nitpick);color:#fff}.annotation-card{padding:12px;border-radius:8px;background:var(--bg-tertiary);border:1px solid var(--border-subtle);margin-bottom:8px;cursor:pointer;transition:border-color .15s,box-shadow .15s}.annotation-card:hover{border-color:var(--accent)}.annotation-card.selected{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}.annotation-card .meta{display:flex;align-items:center;gap:8px;margin-bottom:6px;font-size:12px;color:var(--text-muted)}.annotation-card .quote{font-style:italic;color:var(--text-secondary);border-left:3px solid var(--accent);padding-left:8px;margin:8px 0;font-size:13px}.annotation-card .body{font-size:13px;color:var(--text-primary);line-height:1.5}.section-status{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:500}.section-status.approved{background:var(--status-approved);color:#fff}.section-status.rejected{background:var(--status-rejected);color:#fff}.section-status.pending{background:var(--status-pending);color:var(--text-secondary)}.section-status.indeterminate{background:var(--tag-nitpick);color:var(--bg-primary);opacity:.85}.popover{position:fixed;z-index:101;background:var(--bg-secondary);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 32px #00000059,0 2px 8px #0003;min-width:320px;display:flex;flex-direction:column}.popover--enter{animation:popover-in .15s ease-out}@keyframes popover-in{0%{opacity:0;transform:translateY(4px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}.popover__header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid var(--border);cursor:grab;-webkit-user-select:none;user-select:none;border-radius:10px 10px 0 0}.popover__header:active{cursor:grabbing}.popover__title{font-size:13px;font-weight:600;color:var(--text-primary);letter-spacing:.01em}.popover__close{background:none;border:none;color:var(--text-muted);font-size:18px;line-height:1;cursor:pointer;padding:2px 6px;border-radius:4px;transition:all .15s}.popover__close:hover{background:var(--bg-tertiary);color:var(--text-primary)}.annotation-form{padding:14px}.annotation-form__quote{font-style:italic;color:var(--text-secondary);border-left:3px solid var(--accent);padding:6px 10px;margin-bottom:12px;font-size:13px;line-height:1.5;max-height:80px;overflow-y:auto;background:#89b4fa0d;border-radius:0 4px 4px 0}.annotation-form__tags{display:flex;gap:6px;margin-bottom:12px;flex-wrap:wrap}.tag-pill{padding:4px 12px;border-radius:20px;border:1px solid transparent;font-size:12px;font-weight:500;cursor:pointer;transition:all .15s;background:var(--bg-tertiary);color:var(--text-secondary);line-height:1.4}.tag-pill:hover{border-color:var(--border)}.tag-pill--active{border-color:currentColor}.tag-pill--question{color:var(--tag-question)}.tag-pill--question.tag-pill--active{background:#89b4fa26}.tag-pill--bug{color:var(--tag-bug)}.tag-pill--bug.tag-pill--active{background:#f38ba826}.tag-pill--suggestion{color:var(--tag-suggestion)}.tag-pill--suggestion.tag-pill--active{background:#a6e3a126}.tag-pill--nitpick{color:var(--tag-nitpick)}.tag-pill--nitpick.tag-pill--active{background:#f9e2af26}.annotation-form textarea{width:100%;min-height:180px;padding:10px;border:1px solid var(--border);border-radius:6px;background:var(--bg-primary);color:var(--text-primary);font-family:inherit;font-size:13px;resize:vertical;line-height:1.5}.annotation-form textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 2px #89b4fa40}.annotation-form__actions{display:flex;align-items:center;gap:8px;margin-top:10px;justify-content:flex-end}.annotation-form__hint{font-size:11px;color:var(--text-muted);margin-right:auto}.btn{padding:6px 14px;border-radius:6px;border:1px solid var(--border);background:var(--bg-tertiary);color:var(--text-primary);cursor:pointer;font-family:inherit;font-size:13px;font-weight:500;transition:all .15s;line-height:1.4;white-space:nowrap}.btn:hover{background:var(--accent);color:#fff;border-color:var(--accent)}.btn:active{transform:scale(.97)}.btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.btn-primary,.btn--primary{background:var(--accent);color:#fff;border-color:var(--accent)}.btn-primary:hover,.btn--primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}.btn-danger{background:var(--tag-bug);color:#fff;border-color:var(--tag-bug)}.btn-danger:hover{opacity:.9}.btn-sm{padding:3px 8px;font-size:11px}.btn-ghost,.btn--ghost{background:transparent;border-color:transparent;color:var(--text-secondary)}.btn-ghost:hover,.btn--ghost:hover{background:var(--bg-tertiary);color:var(--text-primary);border-color:transparent}.status-bar{grid-column:1 / -1;display:flex;align-items:center;padding:0 16px;gap:16px;font-size:11px;color:var(--text-muted);background:var(--bg-secondary);border-top:1px solid var(--border);z-index:10}.status-bar .separator{width:1px;height:14px;background:var(--border)}.progress-bar{height:4px;background:var(--bg-tertiary);border-radius:2px;overflow:hidden}.progress-bar .fill{height:100%;background:var(--accent);transition:width .3s ease;border-radius:2px}.toc-item{padding:4px 12px;cursor:pointer;font-size:13px;color:var(--text-secondary);border-radius:4px;transition:background .1s,color .1s;display:flex;align-items:center;gap:4px;line-height:1.4}.toc-item:hover{background:var(--bg-tertiary);color:var(--text-primary)}.toc-item.active{color:var(--accent);background:var(--bg-tertiary)}.toc-item .badge{font-size:10px;background:var(--tag-question);color:#fff;border-radius:8px;padding:1px 5px;margin-left:4px;line-height:1.4}.toc-item.level-2{padding-left:24px}.toc-item.level-3{padding-left:36px}.toc-item.level-4{padding-left:48px}.toc-item.level-5{padding-left:60px}.toc-item.level-6{padding-left:72px}.toc-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}.toc-dot.dot-approved{background:var(--status-approved)}.toc-dot.dot-rejected{background:var(--status-rejected)}.section-status-label.approved{color:var(--status-approved)}.section-status-label.rejected{color:var(--status-rejected)}.file-item{padding:6px 12px;cursor:pointer;font-size:13px;color:var(--text-secondary);border-radius:4px;display:flex;align-items:center;gap:8px;transition:background .1s,color .1s}.file-item:hover{background:var(--bg-tertiary);color:var(--text-primary)}.file-item.active{background:var(--bg-tertiary);color:var(--accent);font-weight:500}.file-item .icon{font-size:14px;flex-shrink:0}.file-item .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.reply{padding:8px 12px;border-left:2px solid var(--border);margin-left:12px;margin-top:8px}.reply .author{font-weight:600;font-size:12px;color:var(--text-secondary)}.reply .text{font-size:13px;margin-top:2px;color:var(--text-primary);line-height:1.5}.reply .timestamp{font-size:11px;color:var(--text-muted);margin-left:8px;font-weight:400}.reply-input{display:flex;gap:8px;margin-top:8px;margin-left:12px}.reply-input input{flex:1;padding:6px 8px;border:1px solid var(--border);border-radius:6px;background:var(--bg-primary);color:var(--text-primary);font-family:inherit;font-size:13px}.reply-input input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 2px #89b4fa40}.content-area h1{font-size:2em;margin:24px 0 16px;border-bottom:1px solid var(--border);padding-bottom:8px;font-weight:700}.content-area h2{font-size:1.5em;margin:20px 0 12px;font-weight:600}.content-area h3{font-size:1.2em;margin:16px 0 8px;font-weight:600}.content-area h4{font-size:1.05em;margin:14px 0 6px;font-weight:600}.content-area p{margin:0 0 12px}.content-area ul,.content-area ol{margin:0 0 12px;padding-left:24px}.content-area li{margin-bottom:4px}.content-area li>ul,.content-area li>ol{margin-bottom:0}.content-area code{background:var(--bg-tertiary);padding:2px 6px;border-radius:3px;font-size:.9em;font-family:SF Mono,Cascadia Code,Fira Code,Consolas,monospace}.content-area pre{background:var(--bg-tertiary);padding:16px;border-radius:8px;overflow-x:auto;margin:0 0 16px;line-height:1.5}.content-area pre code{background:none;padding:0;border-radius:0;font-size:13px}.content-area blockquote{border-left:4px solid var(--accent);padding:8px 16px;margin:0 0 12px;color:var(--text-secondary);background:var(--bg-tertiary);border-radius:0 8px 8px 0}.content-area blockquote p:last-child{margin-bottom:0}.content-area table{border-collapse:collapse;width:100%;margin:0 0 16px}.content-area th,.content-area td{border:1px solid var(--border);padding:8px 12px;text-align:left}.content-area th{background:var(--bg-secondary);font-weight:600}.content-area img{max-width:100%;border-radius:8px}.content-area a{color:var(--accent);text-decoration:none}.content-area a:hover{text-decoration:underline}.content-area hr{border:none;height:1px;background:var(--border);margin:24px 0}.shortcut-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;z-index:199}.shortcut-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:200;background:var(--bg-secondary);border:1px solid var(--border);border-radius:12px;padding:24px;box-shadow:0 8px 32px #0000004d;min-width:400px;max-width:520px;max-height:80vh;overflow-y:auto}.shortcut-modal h2{font-size:16px;font-weight:600;margin-bottom:16px}.shortcut-group{margin-bottom:16px}.shortcut-group-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted);margin-bottom:8px}.shortcut-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px solid var(--border-subtle);font-size:13px}.shortcut-row:last-child{border-bottom:none}.shortcut-label{color:var(--text-secondary)}.shortcut-key{display:inline-block;padding:2px 8px;background:var(--bg-tertiary);border:1px solid var(--border);border-radius:4px;font-family:SF Mono,Cascadia Code,Consolas,monospace;font-size:12px;min-width:24px;text-align:center;line-height:1.5}.theme-picker{display:flex;gap:6px;align-items:center}.theme-swatch{width:24px;height:24px;border-radius:50%;cursor:pointer;border:2px solid transparent;transition:border-color .15s,transform .15s;flex-shrink:0}.theme-swatch:hover,.theme-swatch.active{border-color:var(--accent);transform:scale(1.1)}.export-option{display:block;width:100%;padding:8px 12px;text-align:left;border:none;background:none;color:var(--text-primary);cursor:pointer;font-size:13px;font-family:inherit}.export-option:hover{background:var(--bg-tertiary)}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:var(--scrollbar-track)}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}*{scrollbar-width:thin;scrollbar-color:var(--scrollbar-thumb) var(--scrollbar-track)}.drift-banner{padding:8px 16px;background:var(--tag-question);color:#fff;font-size:13px;display:flex;align-items:center;gap:8px;grid-column:1 / -1}.drift-banner .dismiss{margin-left:auto;cursor:pointer;opacity:.8;transition:opacity .15s}.drift-banner .dismiss:hover{opacity:1}.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-4{gap:4px}.gap-8{gap:8px}.gap-12{gap:12px}.ml-auto{margin-left:auto}.text-muted{color:var(--text-muted)}.text-sm{font-size:12px}.text-xs{font-size:11px}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.content-area .hljs-keyword,.content-area .hljs-selector-tag,.content-area .hljs-built_in,.content-area .hljs-type{color:var(--tag-bug)}.content-area .hljs-string,.content-area .hljs-attr,.content-area .hljs-symbol,.content-area .hljs-template-tag,.content-area .hljs-template-variable{color:var(--tag-suggestion)}.content-area .hljs-number,.content-area .hljs-literal,.content-area .hljs-regexp{color:var(--tag-nitpick)}.content-area .hljs-title,.content-area .hljs-title.function_,.content-area .hljs-title.class_{color:var(--accent)}.content-area .hljs-comment,.content-area .hljs-doctag{color:var(--text-muted);font-style:italic}.content-area .hljs-variable,.content-area .hljs-variable.language_,.content-area .hljs-params{color:var(--text-primary)}.content-area .hljs-meta,.content-area .hljs-meta .hljs-keyword{color:var(--tag-question)}.content-area .hljs-subst{color:var(--text-secondary)}.content-area .hljs-addition{color:var(--tag-suggestion);background:#a6e3a11a}.content-area .hljs-deletion{color:var(--tag-bug);background:#f38ba81a}.content-area .mermaid{background:var(--bg-tertiary);border:1px dashed var(--border);border-radius:8px;padding:16px;text-align:center;font-family:inherit;white-space:pre-wrap;min-height:60px}.content-area .mermaid svg{max-width:100%}.content-area .math-display{display:block;text-align:center;padding:12px 16px;margin:12px 0;background:var(--bg-tertiary);border-radius:6px;font-family:KaTeX_Main,Times New Roman,serif;font-size:1.1em;overflow-x:auto}.content-area .math-inline{font-family:KaTeX_Main,Times New Roman,serif;padding:1px 4px;background:var(--bg-tertiary);border-radius:3px}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
|
package/dist/index.html
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>mdprobe</title>
|
|
7
|
+
<script>
|
|
8
|
+
(function() {
|
|
9
|
+
var theme = localStorage.getItem('mdprobe-theme') || 'mocha';
|
|
10
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
11
|
+
})();
|
|
12
|
+
</script>
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-DPysqH1p.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-nl9v2RuJ.css">
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<div id="app"></div>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@henryavila/mdprobe",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Markdown viewer + reviewer for terminal/WSL with live reload, persistent annotations, and AI agent integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mdprobe": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./src/handler.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/handler.js",
|
|
12
|
+
"./annotations": "./src/annotations.js",
|
|
13
|
+
"./schema.json": "./schema.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"bin/",
|
|
17
|
+
"src/",
|
|
18
|
+
"dist/",
|
|
19
|
+
"schema.json",
|
|
20
|
+
"skills/",
|
|
21
|
+
"templates/"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"test:watch": "vitest",
|
|
26
|
+
"test:unit": "vitest run tests/unit",
|
|
27
|
+
"test:integration": "vitest run tests/integration",
|
|
28
|
+
"test:coverage": "vitest run --coverage",
|
|
29
|
+
"build:ui": "vite build",
|
|
30
|
+
"dev:ui": "vite dev"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"chokidar": "^4.0.0",
|
|
34
|
+
"diff-match-patch": "^1.0.5",
|
|
35
|
+
"highlight.js": "^11.10.0",
|
|
36
|
+
"js-yaml": "^4.1.0",
|
|
37
|
+
"rehype-raw": "^7.0.0",
|
|
38
|
+
"rehype-stringify": "^10.0.0",
|
|
39
|
+
"remark-frontmatter": "^5.0.0",
|
|
40
|
+
"remark-gfm": "^4.0.0",
|
|
41
|
+
"remark-math": "^6.0.0",
|
|
42
|
+
"remark-parse": "^11.0.0",
|
|
43
|
+
"remark-rehype": "^11.0.0",
|
|
44
|
+
"unified": "^11.0.0",
|
|
45
|
+
"ws": "^8.18.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@preact/preset-vite": "^2.9.0",
|
|
49
|
+
"@preact/signals": "^2.0.0",
|
|
50
|
+
"@testing-library/preact": "^3.1.0",
|
|
51
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
52
|
+
"ajv": "^8.17.0",
|
|
53
|
+
"happy-dom": "^15.0.0",
|
|
54
|
+
"htm": "^3.1.0",
|
|
55
|
+
"preact": "^10.24.0",
|
|
56
|
+
"supertest": "^7.0.0",
|
|
57
|
+
"vite": "^6.0.0",
|
|
58
|
+
"vite-plugin-singlefile": "^2.0.0",
|
|
59
|
+
"vitest": "^3.0.0"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"markdown",
|
|
63
|
+
"viewer",
|
|
64
|
+
"reviewer",
|
|
65
|
+
"annotations",
|
|
66
|
+
"live-reload",
|
|
67
|
+
"cli"
|
|
68
|
+
],
|
|
69
|
+
"author": "Henry Avila",
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"repository": {
|
|
72
|
+
"type": "git",
|
|
73
|
+
"url": "https://github.com/henryavila/mdprobe"
|
|
74
|
+
}
|
|
75
|
+
}
|