texlite 0.7.3 → 0.7.6
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 +20 -9
- package/README.zh-CN.md +9 -9
- package/dist/client/assets/{GitDialog-BmRzMv-C.js → GitDialog-W3hLOWrF.js} +2 -2
- package/dist/client/assets/HistoryDialog-7ADYJcGi.js +5 -0
- package/dist/client/assets/LatexEditor-ChHQwJXZ.js +59 -0
- package/dist/client/assets/PdfPreview-CuvWphzY.js +1 -0
- package/dist/client/assets/{ProjectNavigationDialogs-BVQb4qdD.js → ProjectNavigationDialogs-CzFhIw6B.js} +1 -1
- package/dist/client/assets/SystemMetricsDialog-C0m9JUDy.js +1 -0
- package/dist/client/assets/index-DRShM2ob.js +64 -0
- package/dist/client/assets/index-DzcH7hBu.css +1 -0
- package/dist/client/assets/latexFormatterWorker-DYkYtcFy.js +6 -0
- package/dist/client/assets/minus-BfqMIeUg.js +1 -0
- package/dist/client/assets/pdf-BB1XvBIF.js +55 -0
- package/dist/client/assets/{react-CsO_xvbl.js → react-BoEjKzFZ.js} +1 -1
- package/dist/client/assets/spellCheck-BBnCnxmQ.js +4 -0
- package/dist/client/assets/tex_fmt_bg-VEAUIuFz.wasm +0 -0
- package/dist/client/index.html +3 -3
- package/dist/server/anchors.js +22 -1
- package/dist/server/app.js +103 -2375
- package/dist/server/auth.js +3 -2
- package/dist/server/cli.js +8 -2
- package/dist/server/collaboration.js +250 -2
- package/dist/server/compileArtifacts.js +10 -7
- package/dist/server/compiler.js +9 -4
- package/dist/server/config.js +25 -1
- package/dist/server/environment.js +5 -1
- package/dist/server/files.js +7 -6
- package/dist/server/git.js +28 -39
- package/dist/server/harper.js +144 -0
- package/dist/server/harperRuntime.js +38 -0
- package/dist/server/harperWorker.js +15 -0
- package/dist/server/history.js +11 -9
- package/dist/server/http.js +33 -13
- package/dist/server/i18n.js +276 -0
- package/dist/server/latexRoot.js +78 -0
- package/dist/server/limits.js +9 -0
- package/dist/server/projectSearch.js +3 -4
- package/dist/server/routes/auth.js +77 -0
- package/dist/server/routes/citations.js +331 -0
- package/dist/server/routes/collaboration.js +17 -0
- package/dist/server/routes/comments.js +176 -0
- package/dist/server/routes/compile.js +71 -50
- package/dist/server/routes/projectFiles.js +572 -0
- package/dist/server/routes/projectGit.js +145 -0
- package/dist/server/routes/projectHistory.js +150 -0
- package/dist/server/routes/projectMembers.js +112 -0
- package/dist/server/routes/projectShared.js +238 -0
- package/dist/server/routes/projects.js +473 -0
- package/dist/server/routes/system.js +37 -0
- package/dist/server/routes/users.js +163 -0
- package/dist/server/security.js +2 -4
- package/dist/server/synctex.js +7 -4
- package/dist/server/zip.js +29 -13
- package/package.json +4 -2
- package/texlite.config.example.json +5 -1
- package/dist/client/assets/BinaryModule-Aj1vLnwf-_qIOaefD.js +0 -4
- package/dist/client/assets/HistoryDialog-V0IkSDtJ.js +0 -1
- package/dist/client/assets/LatexEditor-CokkLLxi.js +0 -59
- package/dist/client/assets/PdfPreview-Cs1WYPsC.js +0 -1
- package/dist/client/assets/SystemMetricsDialog-DBrendnp.js +0 -1
- package/dist/client/assets/__vite-browser-external-BIHI7g3E.js +0 -1
- package/dist/client/assets/binary-BQKEW09b.js +0 -1
- package/dist/client/assets/harper_wasm_bg-LWXDb7Ll.wasm +0 -0
- package/dist/client/assets/index-BS1IMOaB.js +0 -62
- package/dist/client/assets/index-Lw53KTaT.css +0 -1
- package/dist/client/assets/index-QyVe7I1s.js +0 -3456
- package/dist/client/assets/index-rBWMBTI-.js +0 -5
- package/dist/client/assets/minus-yEV4SLvG.js +0 -1
- package/dist/client/assets/pdf-DPnwNQHb.js +0 -55
- package/dist/client/assets/spellCheck-OZGa6ljx.js +0 -5
- package/dist/server/latexFormatter.js +0 -118
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { publicUser, requireAdmin, requireUser } from "../auth.js";
|
|
3
|
+
import { activeAdminCount } from "../db.js";
|
|
4
|
+
import { removeProjectDirectory } from "../files.js";
|
|
5
|
+
import { apiError, httpError, ValidationError } from "../http.js";
|
|
6
|
+
import { hashPassword } from "../security.js";
|
|
7
|
+
const now = () => new Date().toISOString();
|
|
8
|
+
function text(value, max = 200) {
|
|
9
|
+
if (typeof value !== "string" || !value.trim() || value.length > max) {
|
|
10
|
+
throw new ValidationError();
|
|
11
|
+
}
|
|
12
|
+
return value.trim();
|
|
13
|
+
}
|
|
14
|
+
/** Register administrator-facing user management and the active-user directory. */
|
|
15
|
+
export function registerUserManagementRoutes(app, context) {
|
|
16
|
+
const { config, db, collaboration, projectMutations, latexCompletions, projectOutlines } = context;
|
|
17
|
+
app.get("/api/admin/users", async (request, reply) => {
|
|
18
|
+
if (!requireAdmin(request, reply, db))
|
|
19
|
+
return;
|
|
20
|
+
const users = db.prepare(`
|
|
21
|
+
SELECT u.*,
|
|
22
|
+
(SELECT COUNT(*) FROM projects p WHERE p.owner_id = u.id) AS owned_projects
|
|
23
|
+
FROM users u ORDER BY u.created_at
|
|
24
|
+
`).all();
|
|
25
|
+
return { users: users.map((user) => ({ ...publicUser(user), ownedProjects: user.owned_projects })) };
|
|
26
|
+
});
|
|
27
|
+
app.post("/api/admin/users", async (request, reply) => {
|
|
28
|
+
if (!requireAdmin(request, reply, db))
|
|
29
|
+
return;
|
|
30
|
+
const body = request.body;
|
|
31
|
+
const username = text(body?.username, 64);
|
|
32
|
+
if (!/^[\p{L}\p{N}_.-]+$/u.test(username))
|
|
33
|
+
return apiError(reply, 400, "USERNAME_INVALID");
|
|
34
|
+
const displayName = text(body?.displayName ?? username, 100);
|
|
35
|
+
const password = typeof body?.password === "string" ? body.password : "";
|
|
36
|
+
const role = body?.role === "admin" ? "admin" : "user";
|
|
37
|
+
const user = {
|
|
38
|
+
id: randomUUID(), username, display_name: displayName,
|
|
39
|
+
password_hash: await hashPassword(password), role, disabled: 0,
|
|
40
|
+
must_change_password: 0, can_create_projects: body?.canCreateProjects === true ? 1 : 0, created_at: now()
|
|
41
|
+
};
|
|
42
|
+
db.prepare(`INSERT INTO users
|
|
43
|
+
(id, username, display_name, password_hash, role, disabled, must_change_password, can_create_projects, created_at)
|
|
44
|
+
VALUES (?, ?, ?, ?, ?, 0, 0, ?, ?)`)
|
|
45
|
+
.run(user.id, user.username, user.display_name, user.password_hash, user.role, user.can_create_projects, user.created_at);
|
|
46
|
+
return reply.code(201).send({ user: publicUser(user) });
|
|
47
|
+
});
|
|
48
|
+
app.patch("/api/admin/users/:id", async (request, reply) => {
|
|
49
|
+
const admin = requireAdmin(request, reply, db);
|
|
50
|
+
if (!admin)
|
|
51
|
+
return;
|
|
52
|
+
const { id } = request.params;
|
|
53
|
+
const target = db.prepare("SELECT * FROM users WHERE id = ?").get(id);
|
|
54
|
+
if (!target)
|
|
55
|
+
return apiError(reply, 404, "USER_NOT_FOUND");
|
|
56
|
+
const body = request.body;
|
|
57
|
+
const role = body.role === "admin" ? "admin" : body.role === "user" ? "user" : target.role;
|
|
58
|
+
const disabled = typeof body.disabled === "boolean" ? Number(body.disabled) : target.disabled;
|
|
59
|
+
const canCreateProjects = typeof body.canCreateProjects === "boolean"
|
|
60
|
+
? Number(body.canCreateProjects) : target.can_create_projects;
|
|
61
|
+
if (target.role === "admin" && (!role || role !== "admin" || disabled) && activeAdminCount(db) <= 1) {
|
|
62
|
+
return apiError(reply, 400, "LAST_ADMIN");
|
|
63
|
+
}
|
|
64
|
+
const displayName = typeof body.displayName === "string" ? text(body.displayName, 100) : target.display_name;
|
|
65
|
+
let passwordHash = target.password_hash;
|
|
66
|
+
let mustChange = target.must_change_password;
|
|
67
|
+
if (typeof body.password === "string" && body.password) {
|
|
68
|
+
passwordHash = await hashPassword(body.password);
|
|
69
|
+
mustChange = 1;
|
|
70
|
+
db.prepare("DELETE FROM sessions WHERE user_id = ?").run(id);
|
|
71
|
+
}
|
|
72
|
+
db.prepare(`UPDATE users SET display_name = ?, role = ?, disabled = ?, password_hash = ?, must_change_password = ?, can_create_projects = ? WHERE id = ?`)
|
|
73
|
+
.run(displayName, role, disabled, passwordHash, mustChange, canCreateProjects, id);
|
|
74
|
+
// A disabled account must not regain access by being re-enabled while an
|
|
75
|
+
// old cookie is still within its normal lifetime. Password resets already
|
|
76
|
+
// revoke sessions above; disabling does the same for every active token.
|
|
77
|
+
if (disabled === 1)
|
|
78
|
+
db.prepare("DELETE FROM sessions WHERE user_id = ?").run(id);
|
|
79
|
+
if (disabled === 1 || (typeof body.password === "string" && body.password)) {
|
|
80
|
+
collaboration.disconnectUser(id, "user-disabled-or-reset");
|
|
81
|
+
}
|
|
82
|
+
const updated = db.prepare("SELECT * FROM users WHERE id = ?").get(id);
|
|
83
|
+
return { user: publicUser(updated) };
|
|
84
|
+
});
|
|
85
|
+
app.delete("/api/admin/users/:id", async (request, reply) => {
|
|
86
|
+
const admin = requireAdmin(request, reply, db);
|
|
87
|
+
if (!admin)
|
|
88
|
+
return;
|
|
89
|
+
const { id } = request.params;
|
|
90
|
+
const body = (request.body ?? {});
|
|
91
|
+
const target = db.prepare("SELECT * FROM users WHERE id = ?").get(id);
|
|
92
|
+
if (!target)
|
|
93
|
+
return apiError(reply, 404, "USER_NOT_FOUND");
|
|
94
|
+
if (target.id === admin.id)
|
|
95
|
+
return apiError(reply, 400, "SELF_DELETE_FORBIDDEN");
|
|
96
|
+
if (target.role === "admin" && activeAdminCount(db) <= 1) {
|
|
97
|
+
return apiError(reply, 400, "LAST_ADMIN");
|
|
98
|
+
}
|
|
99
|
+
let owned = [];
|
|
100
|
+
// Capture and mutate the complete owned-project set in the same synchronous
|
|
101
|
+
// transaction. There is deliberately no await before COMMIT: another
|
|
102
|
+
// request cannot transfer or create a project for this user between the
|
|
103
|
+
// snapshot and the owner/delete statements.
|
|
104
|
+
db.exec("BEGIN IMMEDIATE");
|
|
105
|
+
try {
|
|
106
|
+
const currentTarget = db.prepare("SELECT * FROM users WHERE id = ?").get(id);
|
|
107
|
+
if (!currentTarget)
|
|
108
|
+
throw httpError(404, "USER_NOT_FOUND");
|
|
109
|
+
if (currentTarget.role === "admin" && activeAdminCount(db) <= 1) {
|
|
110
|
+
throw httpError(400, "LAST_ADMIN");
|
|
111
|
+
}
|
|
112
|
+
owned = db.prepare("SELECT id FROM projects WHERE owner_id = ?").all(id);
|
|
113
|
+
if (!body.deleteProjects) {
|
|
114
|
+
// Persist any active drafts while the old owner row still exists. This
|
|
115
|
+
// is synchronous, so no edit can arrive between this flush and the
|
|
116
|
+
// ownership update below, and last_modified_by remains FK-safe.
|
|
117
|
+
for (const project of owned)
|
|
118
|
+
projectMutations.flushProject(project.id);
|
|
119
|
+
}
|
|
120
|
+
if (body.deleteProjects) {
|
|
121
|
+
db.prepare("DELETE FROM projects WHERE owner_id = ?").run(id);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
db.prepare("UPDATE project_git_settings SET token_ciphertext = NULL, github_login = NULL, updated_at = ? WHERE project_id IN (SELECT id FROM projects WHERE owner_id = ?)")
|
|
125
|
+
.run(now(), id);
|
|
126
|
+
db.prepare("DELETE FROM project_members WHERE user_id = ? AND project_id IN (SELECT id FROM projects WHERE owner_id = ?)")
|
|
127
|
+
.run(admin.id, id);
|
|
128
|
+
db.prepare("UPDATE projects SET owner_id = ?, last_modified_by = ?, updated_at = ? WHERE owner_id = ?")
|
|
129
|
+
.run(admin.id, admin.id, now(), id);
|
|
130
|
+
}
|
|
131
|
+
db.prepare("DELETE FROM users WHERE id = ?").run(id);
|
|
132
|
+
db.exec("COMMIT");
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
db.exec("ROLLBACK");
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
// Requests already queued for the removed user fail their lock-time
|
|
139
|
+
// preflight. Cleanup is then serialized after them and invalidates any
|
|
140
|
+
// room initialization that started before the transaction committed.
|
|
141
|
+
for (const project of owned) {
|
|
142
|
+
await projectMutations.runExclusive(project.id, "admin user deletion cleanup", () => {
|
|
143
|
+
if (body.deleteProjects) {
|
|
144
|
+
collaboration.resetProject(project.id);
|
|
145
|
+
removeProjectDirectory(config, project.id);
|
|
146
|
+
latexCompletions.invalidate(project.id);
|
|
147
|
+
projectOutlines.invalidate(project.id);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
collaboration.resetProject(project.id);
|
|
151
|
+
}
|
|
152
|
+
}, { flush: false });
|
|
153
|
+
}
|
|
154
|
+
collaboration.disconnectUser(id, "user-deleted");
|
|
155
|
+
return { ok: true, deletedProjects: body.deleteProjects ? owned.length : 0 };
|
|
156
|
+
});
|
|
157
|
+
app.get("/api/users", async (request, reply) => {
|
|
158
|
+
if (!requireUser(request, reply, db))
|
|
159
|
+
return;
|
|
160
|
+
const rows = db.prepare("SELECT id, username, display_name AS displayName FROM users WHERE disabled = 0 ORDER BY username").all();
|
|
161
|
+
return { users: rows };
|
|
162
|
+
});
|
|
163
|
+
}
|
package/dist/server/security.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { createHash, randomBytes, scrypt as scryptCallback, timingSafeEqual } from "node:crypto";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
|
+
import { httpError } from "./http.js";
|
|
3
4
|
const scrypt = promisify(scryptCallback);
|
|
4
5
|
const KEY_LENGTH = 64;
|
|
5
6
|
export const MIN_PASSWORD_LENGTH = 8;
|
|
6
7
|
export async function hashPassword(password) {
|
|
7
8
|
if (password.length < MIN_PASSWORD_LENGTH) {
|
|
8
|
-
throw
|
|
9
|
-
statusCode: 400,
|
|
10
|
-
code: "PASSWORD_TOO_SHORT"
|
|
11
|
-
});
|
|
9
|
+
throw httpError(400, "PASSWORD_TOO_SHORT", { minLength: MIN_PASSWORD_LENGTH });
|
|
12
10
|
}
|
|
13
11
|
const salt = randomBytes(16);
|
|
14
12
|
const key = (await scrypt(password, salt, KEY_LENGTH));
|
package/dist/server/synctex.js
CHANGED
|
@@ -6,8 +6,8 @@ const runFile = promisify(execFile);
|
|
|
6
6
|
export class SyncTeXError extends Error {
|
|
7
7
|
statusCode = 422;
|
|
8
8
|
code = "SYNCTEX_FAILED";
|
|
9
|
-
constructor(
|
|
10
|
-
super(
|
|
9
|
+
constructor() {
|
|
10
|
+
super("SYNCTEX_FAILED");
|
|
11
11
|
this.name = "SyncTeXError";
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -21,7 +21,10 @@ async function runSynctex(args, cwd) {
|
|
|
21
21
|
catch (error) {
|
|
22
22
|
const stderr = typeof error === "object" && error !== null && "stderr" in error
|
|
23
23
|
? String(error.stderr) : "";
|
|
24
|
-
|
|
24
|
+
// The raw SyncTeX stderr is retained in neither API responses nor logs:
|
|
25
|
+
// it can contain absolute project paths and is not actionable to writers.
|
|
26
|
+
void stderr;
|
|
27
|
+
throw new SyncTeXError();
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
export async function sourceToPdf(sourceDirectory, pdfPath, sourcePath, line, column) {
|
|
@@ -53,7 +56,7 @@ export async function pdfToSource(sourceDirectory, pdfPath, page, x, y) {
|
|
|
53
56
|
const line = numericField(output, "Line");
|
|
54
57
|
const column = numericField(output, "Column");
|
|
55
58
|
if (!input || !line)
|
|
56
|
-
throw new SyncTeXError(
|
|
59
|
+
throw new SyncTeXError();
|
|
57
60
|
const absoluteInput = path.isAbsolute(input) ? input : path.resolve(sourceDirectory, input);
|
|
58
61
|
return { input: absoluteInput, line, column: column && column > 0 ? column : 1 };
|
|
59
62
|
}
|
package/dist/server/zip.js
CHANGED
|
@@ -6,6 +6,17 @@ import yauzl from "yauzl";
|
|
|
6
6
|
import { assertNoSymbolicLinks, safeRelativePath } from "./files.js";
|
|
7
7
|
const MAX_ENTRIES = 1_000;
|
|
8
8
|
const MAX_TOTAL_BYTES = 200 * 1024 * 1024;
|
|
9
|
+
/** A ZIP validation error whose stable code is safe to return from the API. */
|
|
10
|
+
export class ZipValidationError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
details;
|
|
13
|
+
constructor(code, details = {}) {
|
|
14
|
+
super(code);
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.details = details;
|
|
17
|
+
this.name = "ZipValidationError";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
9
20
|
export async function extractProjectZip(buffer, destination, maxFileBytes) {
|
|
10
21
|
const maxTotalBytes = Math.max(MAX_TOTAL_BYTES, maxFileBytes);
|
|
11
22
|
const entries = await inspectZip(buffer, maxFileBytes, maxTotalBytes);
|
|
@@ -15,7 +26,7 @@ export async function extractProjectZip(buffer, destination, maxFileBytes) {
|
|
|
15
26
|
const files = await extractZip(buffer, destination, prefix, maxFileBytes, maxTotalBytes);
|
|
16
27
|
const mainFile = discoverMainFile(destination, files);
|
|
17
28
|
if (!mainFile)
|
|
18
|
-
throw new
|
|
29
|
+
throw new ZipValidationError("ZIP_MAIN_DOCUMENT_NOT_FOUND");
|
|
19
30
|
return { files, mainFile };
|
|
20
31
|
}
|
|
21
32
|
async function inspectZip(buffer, maxFileBytes, maxTotalBytes) {
|
|
@@ -30,19 +41,19 @@ async function inspectZip(buffer, maxFileBytes, maxTotalBytes) {
|
|
|
30
41
|
try {
|
|
31
42
|
validateEntry(entry);
|
|
32
43
|
if (entries.length >= MAX_ENTRIES)
|
|
33
|
-
throw new
|
|
44
|
+
throw new ZipValidationError("ZIP_TOO_MANY_ENTRIES", { limit: MAX_ENTRIES });
|
|
34
45
|
totalBytes += entry.uncompressedSize;
|
|
35
46
|
if (entry.uncompressedSize > maxFileBytes)
|
|
36
|
-
throw new
|
|
47
|
+
throw new ZipValidationError("ZIP_ENTRY_TOO_LARGE", { size: formatMB(maxFileBytes) });
|
|
37
48
|
if (totalBytes > maxTotalBytes)
|
|
38
|
-
throw new
|
|
49
|
+
throw new ZipValidationError("ZIP_TOTAL_TOO_LARGE", { size: formatMB(maxTotalBytes) });
|
|
39
50
|
const normalized = normalizedEntryName(entry.fileName);
|
|
40
51
|
// ZIP archives can contain duplicate entries. Extraction of the
|
|
41
52
|
// second entry would otherwise silently replace the first one (and a
|
|
42
53
|
// `name`/`name/` pair would collide on disk as well).
|
|
43
54
|
const collisionKey = safeRelativePath(normalized.replace(/\/+$/, ""));
|
|
44
55
|
if (seenPaths.has(collisionKey))
|
|
45
|
-
throw new
|
|
56
|
+
throw new ZipValidationError("ZIP_DUPLICATE_ENTRY", { path: collisionKey });
|
|
46
57
|
seenPaths.add(collisionKey);
|
|
47
58
|
entries.push({ fileName: normalized, uncompressedSize: entry.uncompressedSize, directory: /\/$/.test(entry.fileName) });
|
|
48
59
|
zip.readEntry();
|
|
@@ -93,9 +104,9 @@ async function extractZip(buffer, destination, prefix, maxFileBytes, maxTotalByt
|
|
|
93
104
|
actualBytes += chunk.length;
|
|
94
105
|
entryBytes += chunk.length;
|
|
95
106
|
if (entryBytes > maxFileBytes)
|
|
96
|
-
callback(new
|
|
107
|
+
callback(new ZipValidationError("ZIP_ENTRY_TOO_LARGE", { size: formatMB(maxFileBytes) }));
|
|
97
108
|
else if (actualBytes > maxTotalBytes)
|
|
98
|
-
callback(new
|
|
109
|
+
callback(new ZipValidationError("ZIP_TOTAL_TOO_LARGE", { size: formatMB(maxTotalBytes) }));
|
|
99
110
|
else
|
|
100
111
|
callback(null, chunk);
|
|
101
112
|
}
|
|
@@ -118,7 +129,7 @@ function openZip(buffer) {
|
|
|
118
129
|
return new Promise((resolve, reject) => {
|
|
119
130
|
yauzl.fromBuffer(buffer, { lazyEntries: true, autoClose: true, strictFileNames: true, validateEntrySizes: true }, (error, zip) => {
|
|
120
131
|
if (error || !zip)
|
|
121
|
-
reject(
|
|
132
|
+
reject(new ZipValidationError("ZIP_READ_FAILED"));
|
|
122
133
|
else
|
|
123
134
|
resolve(zip);
|
|
124
135
|
});
|
|
@@ -128,7 +139,7 @@ function openEntryStream(zip, entry) {
|
|
|
128
139
|
return new Promise((resolve, reject) => {
|
|
129
140
|
zip.openReadStream(entry, (error, stream) => {
|
|
130
141
|
if (error || !stream)
|
|
131
|
-
reject(
|
|
142
|
+
reject(new ZipValidationError("ZIP_ENTRY_READ_FAILED"));
|
|
132
143
|
else
|
|
133
144
|
resolve(stream);
|
|
134
145
|
});
|
|
@@ -137,11 +148,16 @@ function openEntryStream(zip, entry) {
|
|
|
137
148
|
function validateEntry(entry) {
|
|
138
149
|
const name = entry.fileName;
|
|
139
150
|
if (!name || name.includes("\0") || name.startsWith("/") || name.startsWith("\\"))
|
|
140
|
-
throw new
|
|
141
|
-
|
|
151
|
+
throw new ZipValidationError("ZIP_INVALID_PATH");
|
|
152
|
+
try {
|
|
153
|
+
safeRelativePath(name.replace(/\/$/, "") || "invalid");
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
throw new ZipValidationError("ZIP_INVALID_PATH");
|
|
157
|
+
}
|
|
142
158
|
const unixType = (entry.externalFileAttributes >>> 16) & 0o170000;
|
|
143
159
|
if (unixType === 0o120000)
|
|
144
|
-
throw new
|
|
160
|
+
throw new ZipValidationError("ZIP_SYMLINK_FORBIDDEN");
|
|
145
161
|
}
|
|
146
162
|
function normalizedEntryName(name) {
|
|
147
163
|
return name.replaceAll("\\", "/");
|
|
@@ -178,7 +194,7 @@ export function hasDocumentClass(source) {
|
|
|
178
194
|
}).join("");
|
|
179
195
|
const withoutVerbatim = withoutComments
|
|
180
196
|
.replace(/\\verb\*?([^\s]).*?\1/g, "")
|
|
181
|
-
.replace(/\\begin\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}[\s\S]*?\\end\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}/g, "");
|
|
197
|
+
.replace(/\\begin\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}(?:\[[^\]]*\])?[\s\S]*?\\end\{(?:verbatim\*?|Verbatim|lstlisting|minted)\}/g, "");
|
|
182
198
|
return /\\documentclass\s*(?:\[[^\]]*\]\s*)?\{/.test(withoutVerbatim);
|
|
183
199
|
}
|
|
184
200
|
function formatMB(bytes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "texlite",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "A lightweight local-first collaborative LaTeX workspace",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -78,11 +78,12 @@
|
|
|
78
78
|
"lib0": "^0.2.117",
|
|
79
79
|
"lucide-react": "^0.468.0",
|
|
80
80
|
"pdfjs-dist": "^6.2.108",
|
|
81
|
-
"pm2": "^
|
|
81
|
+
"pm2": "^7.0.3",
|
|
82
82
|
"react": "^19.1.1",
|
|
83
83
|
"react-dom": "^19.1.1",
|
|
84
84
|
"react-i18next": "^15.6.1",
|
|
85
85
|
"react-resizable-panels": "^2.1.9",
|
|
86
|
+
"tex-fmt": "0.5.7-npm.1",
|
|
86
87
|
"ws": "^8.21.1",
|
|
87
88
|
"y-codemirror.next": "^0.3.5",
|
|
88
89
|
"y-indexeddb": "^9.0.12",
|
|
@@ -105,6 +106,7 @@
|
|
|
105
106
|
"tsx": "^4.20.3",
|
|
106
107
|
"typescript": "^5.8.3",
|
|
107
108
|
"vite": "^7.0.6",
|
|
109
|
+
"vite-plugin-wasm": "^3.6.0",
|
|
108
110
|
"vitest": "^3.2.4"
|
|
109
111
|
}
|
|
110
112
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{_ as Ke}from"./index-BS1IMOaB.js";var Xe=Object.defineProperty,Me=r=>{throw TypeError(r)},Ye=(r,e,t)=>e in r?Xe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ie=(r,e,t)=>Ye(r,typeof e!="symbol"?e+"":e,t),We=(r,e,t)=>e.has(r)||Me("Cannot "+t),$=(r,e,t)=>(We(r,e,"read from private field"),e.get(r)),he=(r,e,t)=>e.has(r)?Me("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),H=(r,e,t,n)=>(We(r,e,"write to private field"),e.set(r,t),t),E,S;const ke=Object.freeze({American:0,0:"American",British:1,1:"British",Australian:2,2:"Australian",Canadian:3,3:"Canadian",Indian:4,4:"Indian"}),He=Object.freeze({Plain:0,0:"Plain",Markdown:1,1:"Markdown",Typst:2,2:"Typst"});let W=class Q{static __wrap(e){const t=Object.create(Q.prototype);return t.__wbg_ptr=e,me.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof Q?e.__destroy_into_raw():0}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,me.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_lint_free(e,0)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.lint_from_json(t,n);if(_[2])throw A(_[1]);return Q.__wrap(_[0])}get_problem_text(){let e,t;try{const n=i.lint_get_problem_text(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}lint_kind(){let e,t;try{const n=i.lint_lint_kind(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}lint_kind_pretty(){let e,t;try{const n=i.lint_lint_kind_pretty(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}message(){let e,t;try{const n=i.lint_message(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}message_html(){let e,t;try{const n=i.lint_message_html(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}span(){const e=i.lint_span(this.__wbg_ptr);return _e.__wrap(e)}suggestion_count(){return i.lint_suggestion_count(this.__wbg_ptr)>>>0}suggestions(){const e=i.lint_suggestions(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}to_json(){let e,t;try{const n=i.lint_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(W.prototype[Symbol.dispose]=W.prototype.free);let fe=class ue{static __wrap(e){const t=Object.create(ue.prototype);return t.__wbg_ptr=e,je.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,je.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_linter_free(e,0)}apply_suggestion(e,t,n){let _,s;try{const a=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),y=u;oe(t,W),oe(n,Y);const b=i.linter_apply_suggestion(this.__wbg_ptr,a,y,t.__wbg_ptr,n.__wbg_ptr);var c=b[0],l=b[1];if(b[3])throw c=0,l=0,A(b[2]);return _=c,s=l,g(c,l)}finally{i.__wbindgen_free(_,s,1)}}clear_ignored_lints(){i.linter_clear_ignored_lints(this.__wbg_ptr)}clear_words(){i.linter_clear_words(this.__wbg_ptr)}context_hash(e,t){const n=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u;oe(t,W);const s=i.linter_context_hash(this.__wbg_ptr,n,_,t.__wbg_ptr);return BigInt.asUintN(64,s)}export_ignored_lints(){let e,t;try{const n=i.linter_export_ignored_lints(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}export_words(){const e=i.linter_export_words(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}generate_stats_file(){let e,t;try{const n=i.linter_generate_stats_file(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_dialect(){return i.linter_get_dialect(this.__wbg_ptr)}get_lint_config_as_json(){let e,t;try{const n=i.linter_get_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_config_as_object(){return i.linter_get_lint_config_as_object(this.__wbg_ptr)}get_lint_descriptions_as_json(){let e,t;try{const n=i.linter_get_lint_descriptions_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_descriptions_as_object(){return i.linter_get_lint_descriptions_as_object(this.__wbg_ptr)}get_lint_descriptions_html_as_json(){let e,t;try{const n=i.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_lint_descriptions_html_as_object(){return i.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr)}get_structured_lint_config_as_json(){let e,t;try{const n=i.linter_get_structured_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get_structured_lint_config_as_object(){return i.linter_get_structured_lint_config_as_object(this.__wbg_ptr)}ignore_hashes(e){const t=_t(e,i.__wbindgen_malloc),n=u;i.linter_ignore_hashes(this.__wbg_ptr,t,n)}ignore_lints(e,t){const n=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u,s=we(t,i.__wbindgen_malloc),c=u;i.linter_ignore_lints(this.__wbg_ptr,n,_,s,c)}import_ignored_lints(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_import_ignored_lints(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}import_stats_file(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_import_stats_file(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}import_weirpack(e){const t=it(e,i.__wbindgen_malloc),n=u,_=i.linter_import_weirpack(this.__wbg_ptr,t,n);if(_[2])throw A(_[1]);return A(_[0])}import_words(e){const t=we(e,i.__wbindgen_malloc),n=u;i.linter_import_words(this.__wbg_ptr,t,n)}is_likely_english(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u;return i.linter_is_likely_english(this.__wbg_ptr,t,n)!==0}isolate_english(e){let t,n;try{const _=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u,c=i.linter_isolate_english(this.__wbg_ptr,_,s);return t=c[0],n=c[1],g(c[0],c[1])}finally{i.__wbindgen_free(t,n,1)}}lint(e,t,n,_,s,c){const l=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),a=u;var y=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),b=u;const h=i.linter_lint(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=J(h[0],h[1]).slice();return i.__wbindgen_free(h[0],h[1]*4,4),T}static new(e){const t=i.linter_new(e);return ue.__wrap(t)}organized_lints(e,t,n,_,s,c){const l=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),a=u;var y=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),b=u;const h=i.linter_organized_lints(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=J(h[0],h[1]).slice();return i.__wbindgen_free(h[0],h[1]*4,4),T}set_lint_config_from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.linter_set_lint_config_from_json(this.__wbg_ptr,t,n);if(_[1])throw A(_[0])}set_lint_config_from_object(e){const t=i.linter_set_lint_config_from_object(this.__wbg_ptr,e);if(t[1])throw A(t[0])}summarize_stats(e,t){return i.linter_summarize_stats(this.__wbg_ptr,!O(e),O(e)?BigInt(0):e,!O(t),O(t)?BigInt(0):t)}};Symbol.dispose&&(fe.prototype[Symbol.dispose]=fe.prototype.free);let re=class Be{static __wrap(e){const t=Object.create(Be.prototype);return t.__wbg_ptr=e,Se.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Se.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_organizedgroup_free(e,0)}get group(){let e,t;try{const n=i.__wbg_get_organizedgroup_group(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}get lints(){const e=i.__wbg_get_organizedgroup_lints(this.__wbg_ptr);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*4,4),t}set group(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u;i.__wbg_set_organizedgroup_group(this.__wbg_ptr,t,n)}set lints(e){const t=we(e,i.__wbindgen_malloc),n=u;i.__wbg_set_organizedgroup_lints(this.__wbg_ptr,t,n)}};Symbol.dispose&&(re.prototype[Symbol.dispose]=re.prototype.free);let _e=class Z{static __wrap(e){const t=Object.create(Z.prototype);return t.__wbg_ptr=e,ve.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ve.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_span_free(e,0)}get end(){return i.__wbg_get_span_end(this.__wbg_ptr)>>>0}get start(){return i.__wbg_get_span_start(this.__wbg_ptr)>>>0}set end(e){i.__wbg_set_span_end(this.__wbg_ptr,e)}set start(e){i.__wbg_set_span_start(this.__wbg_ptr,e)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.span_from_json(t,n);if(_[2])throw A(_[1]);return Z.__wrap(_[0])}is_empty(){return i.span_is_empty(this.__wbg_ptr)!==0}len(){return i.span_len(this.__wbg_ptr)>>>0}static new(e,t){const n=i.span_new(e,t);return Z.__wrap(n)}to_json(){let e,t;try{const n=i.span_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(_e.prototype[Symbol.dispose]=_e.prototype.free);let Y=class de{static __wrap(e){const t=Object.create(de.prototype);return t.__wbg_ptr=e,Ae.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Ae.unregister(this),e}free(){const e=this.__destroy_into_raw();i.__wbg_suggestion_free(e,0)}static from_json(e){const t=w(e,i.__wbindgen_malloc,i.__wbindgen_realloc),n=u,_=i.suggestion_from_json(t,n);if(_[2])throw A(_[1]);return de.__wrap(_[0])}get_replacement_text(){let e,t;try{const n=i.suggestion_get_replacement_text(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}kind(){return i.suggestion_kind(this.__wbg_ptr)}to_json(){let e,t;try{const n=i.suggestion_to_json(this.__wbg_ptr);return e=n[0],t=n[1],g(n[0],n[1])}finally{i.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(Y.prototype[Symbol.dispose]=Y.prototype.free);const Qe=Object.freeze({Replace:0,0:"Replace",Remove:1,1:"Remove",InsertAfter:2,2:"InsertAfter"});function Ze(){return i.get_default_lint_config()}function et(){let r,e;try{const t=i.get_default_lint_config_as_json();return r=t[0],e=t[1],g(t[0],t[1])}finally{i.__wbindgen_free(r,e,1)}}function tt(){i.setup()}function nt(r){let e,t;try{const n=w(r,i.__wbindgen_malloc,i.__wbindgen_realloc),_=u,s=i.to_title_case(n,_);return e=s[0],t=s[1],g(s[0],s[1])}finally{i.__wbindgen_free(e,t,1)}}function Ee(){return{__proto__:null,"./harper_wasm_slim_bg.js":{__proto__:null,__wbg_Error_bce6d499ff0a4aff:function(e,t){return Error(g(e,t))},__wbg_String_8564e559799eccda:function(e,t){const n=String(t),_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_boolean_get_2304fb8c853028c8:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return O(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_edece8177ad01481:function(e,t){const n=be(t),_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_is_function_5cd60d5cf78b4eef:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_b4593df85baada48:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_dde0fd9020db4434:function(e){return typeof e=="string"},__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c:function(e,t){return e==t},__wbg___wbindgen_number_get_f73a1244370fcc2c:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,O(_)?0:_,!0),m().setInt32(e+0,!O(_),!0)},__wbg___wbindgen_string_get_d109740c0d18f4d7:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var s=O(_)?0:w(_,i.__wbindgen_malloc,i.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_9c31b086c2b26051:function(e,t){throw new Error(g(e,t))},__wbg_call_13665d9f14390edc:function(){return k(function(e,t){return e.call(t)},arguments)},__wbg_done_54b8da57023b7ed2:function(e){return e.done},__wbg_entries_564a7e8b1e54ede5:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(g(e,t))}finally{i.__wbindgen_free(n,_,1)}},__wbg_getRandomValues_3f44b700395062e5:function(){return k(function(e,t){globalThis.crypto.getRandomValues(se(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return k(function(e,t){globalThis.crypto.getRandomValues(se(e,t))},arguments)},__wbg_getTime_09f1dd40a44edb30:function(e){return e.getTime()},__wbg_get_3e9a707ab7d352eb:function(){return k(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_98fdf51d029a75eb:function(e,t){return e[t>>>0]},__wbg_get_unchecked_1dfe6d05ad91d9b7:function(e,t){return e[t>>>0]},__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Uint8Array_abd07d4bd221d50b:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_iterator_1441b47f341dc34f:function(){return Symbol.iterator},__wbg_length_2591a0f4f659a55c:function(e){return e.length},__wbg_length_56fcd3e2b7e0299d:function(e){return e.length},__wbg_lint_new:function(e){return W.__wrap(e)},__wbg_lint_unwrap:function(e){return W.__unwrap(e)},__wbg_log_0c201ade58bb55e1:function(e,t,n,_,s,c,l,a){let y,b;try{y=e,b=t,console.log(g(e,t),g(n,_),g(s,c),g(l,a))}finally{i.__wbindgen_free(y,b,1)}},__wbg_log_ce2c4456b290c5e7:function(e,t){let n,_;try{n=e,_=t,console.log(g(e,t))}finally{i.__wbindgen_free(n,_,1)}},__wbg_mark_b4d943f3bc2d2404:function(e,t){performance.mark(g(e,t))},__wbg_measure_84362959e621a2c1:function(){return k(function(e,t,n,_){let s,c,l,a;try{s=e,c=t,l=n,a=_,performance.measure(g(e,t),g(n,_))}finally{i.__wbindgen_free(s,c,1),i.__wbindgen_free(l,a,1)}},arguments)},__wbg_new_02d162bc6cf02f60:function(){return new Object},__wbg_new_070df68d66325372:function(){return new Map},__wbg_new_0_2722fcdb71a888a6:function(){return new Date},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_310879b66b6e95e1:function(){return new Array},__wbg_new_7ddec6de44ff8f5d:function(e){return new Uint8Array(e)},__wbg_next_2a4e19f4f5083b0f:function(e){return e.next},__wbg_next_6429a146bf756f93:function(){return k(function(e){return e.next()},arguments)},__wbg_organizedgroup_new:function(e){return re.__wrap(e)},__wbg_prototypesetcall_5f9bdc8d75e07276:function(e,t,n){Uint8Array.prototype.set.call(se(e,t),n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_78ea6a19f4818587:function(e,t,n){e[t>>>0]=n},__wbg_set_facb7a5914e0fa39:function(e,t,n){return e.set(t,n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=w(n,i.__wbindgen_malloc,i.__wbindgen_realloc),s=u;m().setInt32(e+4,s,!0),m().setInt32(e+0,_,!0)},__wbg_suggestion_new:function(e){return Y.__wrap(e)},__wbg_value_9cc0518af87a489c:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e,t){return g(e,t)},__wbindgen_init_externref_table:function(){const e=i.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const me=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_lint_free(r,1)),je=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_linter_free(r,1)),Se=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_organizedgroup_free(r,1)),ve=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_span_free(r,1)),Ae=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>i.__wbg_suggestion_free(r,1));function Pe(r){const e=i.__externref_table_alloc();return i.__wbindgen_externrefs.set(e,r),e}function oe(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`)}function be(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let s="[";_>0&&(s+=be(r[0]));for(let c=1;c<_;c++)s+=", "+be(r[c]);return s+="]",s}const t=/\[object ([^\]]+)\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
|
|
2
|
-
${r.stack}`:n}function J(r,e){r=r>>>0;const t=m(),n=[];for(let _=r;_<r+4*e;_+=4)n.push(i.__wbindgen_externrefs.get(t.getUint32(_,!0)));return i.__externref_drop_slice(r,e),n}function se(r,e){return r=r>>>0,P().subarray(r/1,r/1+e)}let C=null;function rt(){return(C===null||C.byteLength===0)&&(C=new BigUint64Array(i.memory.buffer)),C}let I=null;function m(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==i.memory.buffer)&&(I=new DataView(i.memory.buffer)),I}function g(r,e){return st(r>>>0,e)}let V=null;function P(){return(V===null||V.byteLength===0)&&(V=new Uint8Array(i.memory.buffer)),V}function k(r,e){try{return r.apply(this,e)}catch(t){const n=Pe(t);i.__wbindgen_exn_store(n)}}function O(r){return r==null}function _t(r,e){const t=e(r.length*8,8)>>>0;return rt().set(r,t/8),u=r.length,t}function it(r,e){const t=e(r.length*1,1)>>>0;return P().set(r,t/1),u=r.length,t}function we(r,e){const t=e(r.length*4,4)>>>0;for(let n=0;n<r.length;n++){const _=Pe(r[n]);m().setUint32(t+4*n,_,!0)}return u=r.length,t}function w(r,e,t){if(t===void 0){const l=q.encode(r),a=e(l.length,1)>>>0;return P().subarray(a,a+l.length).set(l),u=l.length,a}let n=r.length,_=e(n,1)>>>0;const s=P();let c=0;for(;c<n;c++){const l=r.charCodeAt(c);if(l>127)break;s[_+c]=l}if(c!==n){c!==0&&(r=r.slice(c)),_=t(_,n,n=c+r.length*3,1)>>>0;const l=P().subarray(_+c,_+n),a=q.encodeInto(r,l);c+=a.written,_=t(_,n,c,1)>>>0}return u=c,_}function A(r){const e=i.__wbindgen_externrefs.get(r);return i.__externref_table_dealloc(r),e}let ee=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});ee.decode();const ot=2146435072;let ce=0;function st(r,e){return ce+=e,ce>=ot&&(ee=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),ee.decode(),ce=e),ee.decode(P().subarray(r,r+e))}const q=new TextEncoder;"encodeInto"in q||(q.encodeInto=function(r,e){const t=q.encode(r);return e.set(t),{read:r.length,written:t.length}});let u=0,i;function Ue(r,e){return i=r.exports,C=null,I=null,V=null,i.__wbindgen_start(),i}async function ct(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(_){if(r.ok&&t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",_);else throw _}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function lt(r){if(i!==void 0)return i;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=Ee();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Ue(t)}async function Le(r){if(i!==void 0)return i;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0&&(r=new URL);const e=Ee();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t}=await ct(await r,e);return Ue(t)}const at=Object.freeze(Object.defineProperty({__proto__:null,Dialect:ke,Language:He,Lint:W,Linter:fe,OrganizedGroup:re,Span:_e,Suggestion:Y,SuggestionKind:Qe,default:Le,get_default_lint_config:Ze,get_default_lint_config_as_json:et,initSync:lt,setup:tt,to_title_case:nt},Symbol.toStringTag,{value:"Module"})),gt=Object.freeze({American:0,0:"American",British:1,1:"British",Australian:2,2:"Australian",Canadian:3,3:"Canadian",Indian:4,4:"Indian"}),ft=Object.freeze({Plain:0,0:"Plain",Markdown:1,1:"Markdown",Typst:2,2:"Typst"});class v{static __wrap(e){const t=Object.create(v.prototype);return t.__wbg_ptr=e,xe.register(t,t.__wbg_ptr,t),t}static __unwrap(e){return e instanceof v?e.__destroy_into_raw():0}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,xe.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_lint_free(e,0)}static from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.lint_from_json(t,n);if(_[2])throw x(_[1]);return v.__wrap(_[0])}get_problem_text(){let e,t;try{const n=o.lint_get_problem_text(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}lint_kind(){let e,t;try{const n=o.lint_lint_kind(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}lint_kind_pretty(){let e,t;try{const n=o.lint_lint_kind_pretty(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}message(){let e,t;try{const n=o.lint_message(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}message_html(){let e,t;try{const n=o.lint_message_html(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}span(){const e=o.lint_span(this.__wbg_ptr);return R.__wrap(e)}suggestion_count(){return o.lint_suggestion_count(this.__wbg_ptr)>>>0}suggestions(){const e=o.lint_suggestions(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}to_json(){let e,t;try{const n=o.lint_to_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);class L{static __wrap(e){const t=Object.create(L.prototype);return t.__wbg_ptr=e,Oe.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Oe.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_linter_free(e,0)}apply_suggestion(e,t,n){let _,s;try{const a=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),y=d;le(t,v),le(n,F);const b=o.linter_apply_suggestion(this.__wbg_ptr,a,y,t.__wbg_ptr,n.__wbg_ptr);var c=b[0],l=b[1];if(b[3])throw c=0,l=0,x(b[2]);return _=c,s=l,f(c,l)}finally{o.__wbindgen_free(_,s,1)}}clear_ignored_lints(){o.linter_clear_ignored_lints(this.__wbg_ptr)}clear_words(){o.linter_clear_words(this.__wbg_ptr)}context_hash(e,t){const n=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=d;le(t,v);const s=o.linter_context_hash(this.__wbg_ptr,n,_,t.__wbg_ptr);return BigInt.asUintN(64,s)}export_ignored_lints(){let e,t;try{const n=o.linter_export_ignored_lints(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}export_words(){const e=o.linter_export_words(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}generate_stats_file(){let e,t;try{const n=o.linter_generate_stats_file(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_dialect(){return o.linter_get_dialect(this.__wbg_ptr)}get_lint_config_as_json(){let e,t;try{const n=o.linter_get_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_lint_config_as_object(){return o.linter_get_lint_config_as_object(this.__wbg_ptr)}get_lint_descriptions_as_json(){let e,t;try{const n=o.linter_get_lint_descriptions_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_lint_descriptions_as_object(){return o.linter_get_lint_descriptions_as_object(this.__wbg_ptr)}get_lint_descriptions_html_as_json(){let e,t;try{const n=o.linter_get_lint_descriptions_html_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_lint_descriptions_html_as_object(){return o.linter_get_lint_descriptions_html_as_object(this.__wbg_ptr)}get_structured_lint_config_as_json(){let e,t;try{const n=o.linter_get_structured_lint_config_as_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get_structured_lint_config_as_object(){return o.linter_get_structured_lint_config_as_object(this.__wbg_ptr)}ignore_hashes(e){const t=ht(e,o.__wbindgen_malloc),n=d;o.linter_ignore_hashes(this.__wbg_ptr,t,n)}ignore_lints(e,t){const n=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=d,s=ye(t,o.__wbindgen_malloc),c=d;o.linter_ignore_lints(this.__wbg_ptr,n,_,s,c)}import_ignored_lints(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.linter_import_ignored_lints(this.__wbg_ptr,t,n);if(_[1])throw x(_[0])}import_stats_file(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.linter_import_stats_file(this.__wbg_ptr,t,n);if(_[1])throw x(_[0])}import_weirpack(e){const t=mt(e,o.__wbindgen_malloc),n=d,_=o.linter_import_weirpack(this.__wbg_ptr,t,n);if(_[2])throw x(_[1]);return x(_[0])}import_words(e){const t=ye(e,o.__wbindgen_malloc),n=d;o.linter_import_words(this.__wbg_ptr,t,n)}is_likely_english(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d;return o.linter_is_likely_english(this.__wbg_ptr,t,n)!==0}isolate_english(e){let t,n;try{const _=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d,c=o.linter_isolate_english(this.__wbg_ptr,_,s);return t=c[0],n=c[1],f(c[0],c[1])}finally{o.__wbindgen_free(t,n,1)}}lint(e,t,n,_,s,c){const l=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d;var y=z(_)?0:p(_,o.__wbindgen_malloc,o.__wbindgen_realloc),b=d;const h=o.linter_lint(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=K(h[0],h[1]).slice();return o.__wbindgen_free(h[0],h[1]*4,4),T}static new(e){const t=o.linter_new(e);return L.__wrap(t)}organized_lints(e,t,n,_,s,c){const l=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=d;var y=z(_)?0:p(_,o.__wbindgen_malloc,o.__wbindgen_realloc),b=d;const h=o.linter_organized_lints(this.__wbg_ptr,l,a,t,n,y,b,s,c);var T=K(h[0],h[1]).slice();return o.__wbindgen_free(h[0],h[1]*4,4),T}set_lint_config_from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.linter_set_lint_config_from_json(this.__wbg_ptr,t,n);if(_[1])throw x(_[0])}set_lint_config_from_object(e){const t=o.linter_set_lint_config_from_object(this.__wbg_ptr,e);if(t[1])throw x(t[0])}summarize_stats(e,t){return o.linter_summarize_stats(this.__wbg_ptr,!z(e),z(e)?BigInt(0):e,!z(t),z(t)?BigInt(0):t)}}Symbol.dispose&&(L.prototype[Symbol.dispose]=L.prototype.free);class D{static __wrap(e){const t=Object.create(D.prototype);return t.__wbg_ptr=e,ze.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,ze.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_organizedgroup_free(e,0)}get group(){let e,t;try{const n=o.__wbg_get_organizedgroup_group(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}get lints(){const e=o.__wbg_get_organizedgroup_lints(this.__wbg_ptr);var t=K(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),t}set group(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d;o.__wbg_set_organizedgroup_group(this.__wbg_ptr,t,n)}set lints(e){const t=ye(e,o.__wbindgen_malloc),n=d;o.__wbg_set_organizedgroup_lints(this.__wbg_ptr,t,n)}}Symbol.dispose&&(D.prototype[Symbol.dispose]=D.prototype.free);class R{static __wrap(e){const t=Object.create(R.prototype);return t.__wbg_ptr=e,$e.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,$e.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_span_free(e,0)}get end(){return o.__wbg_get_span_end(this.__wbg_ptr)>>>0}get start(){return o.__wbg_get_span_start(this.__wbg_ptr)>>>0}set end(e){o.__wbg_set_span_end(this.__wbg_ptr,e)}set start(e){o.__wbg_set_span_start(this.__wbg_ptr,e)}static from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.span_from_json(t,n);if(_[2])throw x(_[1]);return R.__wrap(_[0])}is_empty(){return o.span_is_empty(this.__wbg_ptr)!==0}len(){return o.span_len(this.__wbg_ptr)>>>0}static new(e,t){const n=o.span_new(e,t);return R.__wrap(n)}to_json(){let e,t;try{const n=o.span_to_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);class F{static __wrap(e){const t=Object.create(F.prototype);return t.__wbg_ptr=e,Re.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,Re.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_suggestion_free(e,0)}static from_json(e){const t=p(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=d,_=o.suggestion_from_json(t,n);if(_[2])throw x(_[1]);return F.__wrap(_[0])}get_replacement_text(){let e,t;try{const n=o.suggestion_get_replacement_text(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}kind(){return o.suggestion_kind(this.__wbg_ptr)}to_json(){let e,t;try{const n=o.suggestion_to_json(this.__wbg_ptr);return e=n[0],t=n[1],f(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}}Symbol.dispose&&(F.prototype[Symbol.dispose]=F.prototype.free);const ut=Object.freeze({Replace:0,0:"Replace",Remove:1,1:"Remove",InsertAfter:2,2:"InsertAfter"});function dt(){return o.get_default_lint_config()}function bt(){let r,e;try{const t=o.get_default_lint_config_as_json();return r=t[0],e=t[1],f(t[0],t[1])}finally{o.__wbindgen_free(r,e,1)}}function wt(){o.setup()}function pt(r){let e,t;try{const n=p(r,o.__wbindgen_malloc,o.__wbindgen_realloc),_=d,s=o.to_title_case(n,_);return e=s[0],t=s[1],f(s[0],s[1])}finally{o.__wbindgen_free(e,t,1)}}function De(){return{__proto__:null,"./harper_wasm_bg.js":{__proto__:null,__wbg_Error_bce6d499ff0a4aff:function(e,t){return Error(f(e,t))},__wbg_String_8564e559799eccda:function(e,t){const n=String(t),_=p(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d;j().setInt32(e+4,s,!0),j().setInt32(e+0,_,!0)},__wbg___wbindgen_boolean_get_2304fb8c853028c8:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return z(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_edece8177ad01481:function(e,t){const n=pe(t),_=p(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d;j().setInt32(e+4,s,!0),j().setInt32(e+0,_,!0)},__wbg___wbindgen_is_function_5cd60d5cf78b4eef:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_b4593df85baada48:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_dde0fd9020db4434:function(e){return typeof e=="string"},__wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c:function(e,t){return e==t},__wbg___wbindgen_number_get_f73a1244370fcc2c:function(e,t){const n=t,_=typeof n=="number"?n:void 0;j().setFloat64(e+8,z(_)?0:_,!0),j().setInt32(e+0,!z(_),!0)},__wbg___wbindgen_string_get_d109740c0d18f4d7:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var s=z(_)?0:p(_,o.__wbindgen_malloc,o.__wbindgen_realloc),c=d;j().setInt32(e+4,c,!0),j().setInt32(e+0,s,!0)},__wbg___wbindgen_throw_9c31b086c2b26051:function(e,t){throw new Error(f(e,t))},__wbg_call_13665d9f14390edc:function(){return B(function(e,t){return e.call(t)},arguments)},__wbg_done_54b8da57023b7ed2:function(e){return e.done},__wbg_entries_564a7e8b1e54ede5:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(f(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_getRandomValues_3f44b700395062e5:function(){return B(function(e,t){globalThis.crypto.getRandomValues(ae(e,t))},arguments)},__wbg_getRandomValues_d49329ff89a07af1:function(){return B(function(e,t){globalThis.crypto.getRandomValues(ae(e,t))},arguments)},__wbg_getTime_09f1dd40a44edb30:function(e){return e.getTime()},__wbg_get_3e9a707ab7d352eb:function(){return B(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_98fdf51d029a75eb:function(e,t){return e[t>>>0]},__wbg_get_unchecked_1dfe6d05ad91d9b7:function(e,t){return e[t>>>0]},__wbg_instanceof_ArrayBuffer_53db37b06f6b9afe:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Uint8Array_abd07d4bd221d50b:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_iterator_1441b47f341dc34f:function(){return Symbol.iterator},__wbg_length_2591a0f4f659a55c:function(e){return e.length},__wbg_length_56fcd3e2b7e0299d:function(e){return e.length},__wbg_lint_new:function(e){return v.__wrap(e)},__wbg_lint_unwrap:function(e){return v.__unwrap(e)},__wbg_log_0c201ade58bb55e1:function(e,t,n,_,s,c,l,a){let y,b;try{y=e,b=t,console.log(f(e,t),f(n,_),f(s,c),f(l,a))}finally{o.__wbindgen_free(y,b,1)}},__wbg_log_ce2c4456b290c5e7:function(e,t){let n,_;try{n=e,_=t,console.log(f(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_mark_b4d943f3bc2d2404:function(e,t){performance.mark(f(e,t))},__wbg_measure_84362959e621a2c1:function(){return B(function(e,t,n,_){let s,c,l,a;try{s=e,c=t,l=n,a=_,performance.measure(f(e,t),f(n,_))}finally{o.__wbindgen_free(s,c,1),o.__wbindgen_free(l,a,1)}},arguments)},__wbg_new_02d162bc6cf02f60:function(){return new Object},__wbg_new_070df68d66325372:function(){return new Map},__wbg_new_0_2722fcdb71a888a6:function(){return new Date},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_310879b66b6e95e1:function(){return new Array},__wbg_new_7ddec6de44ff8f5d:function(e){return new Uint8Array(e)},__wbg_next_2a4e19f4f5083b0f:function(e){return e.next},__wbg_next_6429a146bf756f93:function(){return B(function(e){return e.next()},arguments)},__wbg_organizedgroup_new:function(e){return D.__wrap(e)},__wbg_prototypesetcall_5f9bdc8d75e07276:function(e,t,n){Uint8Array.prototype.set.call(ae(e,t),n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_78ea6a19f4818587:function(e,t,n){e[t>>>0]=n},__wbg_set_facb7a5914e0fa39:function(e,t,n){return e.set(t,n)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=p(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=d;j().setInt32(e+4,s,!0),j().setInt32(e+0,_,!0)},__wbg_suggestion_new:function(e){return F.__wrap(e)},__wbg_value_9cc0518af87a489c:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e,t){return f(e,t)},__wbindgen_init_externref_table:function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const xe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_lint_free(r,1)),Oe=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_linter_free(r,1)),ze=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_organizedgroup_free(r,1)),$e=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_span_free(r,1)),Re=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_suggestion_free(r,1));function Ce(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}function le(r,e){if(!(r instanceof e))throw new Error(`expected instance of ${e.name}`)}function pe(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let s="[";_>0&&(s+=pe(r[0]));for(let c=1;c<_;c++)s+=", "+pe(r[c]);return s+="]",s}const t=/\[object ([^\]]+)\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}
|
|
3
|
-
${r.stack}`:n}function K(r,e){r=r>>>0;const t=j(),n=[];for(let _=r;_<r+4*e;_+=4)n.push(o.__wbindgen_externrefs.get(t.getUint32(_,!0)));return o.__externref_drop_slice(r,e),n}function ae(r,e){return r=r>>>0,U().subarray(r/1,r/1+e)}let N=null;function yt(){return(N===null||N.byteLength===0)&&(N=new BigUint64Array(o.memory.buffer)),N}let M=null;function j(){return(M===null||M.buffer.detached===!0||M.buffer.detached===void 0&&M.buffer!==o.memory.buffer)&&(M=new DataView(o.memory.buffer)),M}function f(r,e){return St(r>>>0,e)}let G=null;function U(){return(G===null||G.byteLength===0)&&(G=new Uint8Array(o.memory.buffer)),G}function B(r,e){try{return r.apply(this,e)}catch(t){const n=Ce(t);o.__wbindgen_exn_store(n)}}function z(r){return r==null}function ht(r,e){const t=e(r.length*8,8)>>>0;return yt().set(r,t/8),d=r.length,t}function mt(r,e){const t=e(r.length*1,1)>>>0;return U().set(r,t/1),d=r.length,t}function ye(r,e){const t=e(r.length*4,4)>>>0;for(let n=0;n<r.length;n++){const _=Ce(r[n]);j().setUint32(t+4*n,_,!0)}return d=r.length,t}function p(r,e,t){if(t===void 0){const l=X.encode(r),a=e(l.length,1)>>>0;return U().subarray(a,a+l.length).set(l),d=l.length,a}let n=r.length,_=e(n,1)>>>0;const s=U();let c=0;for(;c<n;c++){const l=r.charCodeAt(c);if(l>127)break;s[_+c]=l}if(c!==n){c!==0&&(r=r.slice(c)),_=t(_,n,n=c+r.length*3,1)>>>0;const l=U().subarray(_+c,_+n),a=X.encodeInto(r,l);c+=a.written,_=t(_,n,c,1)>>>0}return d=c,_}function x(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let te=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});te.decode();const jt=2146435072;let ge=0;function St(r,e){return ge+=e,ge>=jt&&(te=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),te.decode(),ge=e),te.decode(U().subarray(r,r+e))}const X=new TextEncoder;"encodeInto"in X||(X.encodeInto=function(r,e){const t=X.encode(r);return e.set(t),{read:r.length,written:t.length}});let d=0,o;function Ve(r,e){return o=r.exports,N=null,M=null,G=null,o.__wbindgen_start(),o}async function vt(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(_){if(r.ok&&t(r.type)&&r.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",_);else throw _}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}function t(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}function At(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=De();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Ve(t)}async function xt(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),r===void 0&&(r=new URL);const e=De();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:t}=await vt(await r,e);return Ve(t)}const Ot=Object.freeze(Object.defineProperty({__proto__:null,Dialect:gt,Language:ft,Lint:v,Linter:L,OrganizedGroup:D,Span:R,Suggestion:F,SuggestionKind:ut,default:xt,get_default_lint_config:dt,get_default_lint_config_as_json:bt,initSync:At,setup:wt,to_title_case:pt},Symbol.toStringTag,{value:"Module"})),zt=class ne extends Promise{constructor(e){super(t=>{t()}),he(this,E),he(this,S),H(this,E,e)}static from(e){return new ne(t=>{t(e())})}static resolve(e){return new ne(t=>{t(e)})}static reject(e){return new ne((t,n)=>{n(e)})}then(e,t){return $(this,S)??H(this,S,new Promise($(this,E))),$(this,S).then(e,t)}catch(e){return $(this,S)??H(this,S,new Promise($(this,E))),$(this,S).catch(e)}finally(e){return $(this,S)??H(this,S,new Promise($(this,E))),$(this,S).finally(e)}};E=new WeakMap;S=new WeakMap;let Ne=zt;const $t=(r,e,t,n)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const _=Object.getOwnPropertyDescriptor(r,t),s=Object.getOwnPropertyDescriptor(e,t);!Rt(_,s)&&n||Object.defineProperty(r,t,s)},Rt=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},Ft=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},Tt=(r,e)=>`/* Wrapped ${r}*/
|
|
4
|
-
${e}`,It=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Wt=(r,e,t)=>{const n=t===""?"":`with ${t.trim()}() `,_=Tt.bind(null,n,e.toString());Object.defineProperty(_,"name",Mt),Object.defineProperty(r,"toString",{...It,value:_})};function kt(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:n}=r;for(const _ of Reflect.ownKeys(e))$t(r,e,_,t);return Ft(r,e),Wt(r,e,n),r}const Bt=new WeakMap;function Fe(r,{cacheKey:e=([n])=>n,cache:t=new Map}={}){const n=new Map,_=function(...s){const c=e(s);if(n.has(c))return n.get(c);const l=(async()=>{try{if(t&&await t.has(c))return await t.get(c);const y=await r.apply(this,s);try{return y}finally{t&&await t.set(c,y)}}finally{n.delete(c)}})();return n.set(c,l),l};return kt(_,r,{ignoreNonConfigurable:!0}),Bt.set(_,t),_}function Ge(r){return r.includes("harper_wasm_slim")?"slim":"full"}function Ct(r){return r.glueFlavor??Ge(typeof r.url=="string"?r.url:r.url.href)}function Et(r){return r==="slim"?at:Ot}function Pt(r,e){return e==="slim"?r:r.includes("harper_wasm_bg.wasm")?r.replace("harper_wasm_bg.wasm","harper_wasm_slim_bg.wasm"):null}function Te(r){return typeof process<"u"&&r.startsWith("file://")?Ke(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).then(e=>new Promise((t,n)=>{e.readFile(new URL(r).pathname,(_,s)=>{_&&n(_),t(s)})})):r}async function Ie(r,e){const t=Et(e),n=Pt(r,e);if(n!=null)try{await Le({module_or_path:Te(n)})}catch(_){if(e==="slim")throw _}return await t.default({module_or_path:Te(r)}),t}const Ut={full:Fe(r=>Ie(r,"full")),slim:Fe(r=>Ie(r,"slim"))};function Je(r,e){return Ut[e](r)}function Vt(r,e){return qe.create(r,e)}class qe{constructor(){ie(this,"url",""),ie(this,"glueFlavor","full"),ie(this,"inner",null)}static create(e,t){const n=new Lt;return n.url=e,n.glueFlavor=t??Ge(typeof e=="string"?e:e.href),n.inner=Ne.from(()=>Je(typeof n.url=="string"?n.url:n.url.href,n.glueFlavor)),n}async getDefaultLintConfigAsJSON(){return(await this.inner).get_default_lint_config_as_json()}async getDefaultLintConfig(){return(await this.inner).get_default_lint_config()}async toTitleCase(e){return(await this.inner).to_title_case(e)}async setup(){(await this.inner).setup()}}class Lt extends qe{async createLinter(e){return(await this.getBinaryModule()).Linter.new(e??ke.American)}async getBinaryModule(){return await Ne.from(()=>Je(typeof this.url=="string"?this.url:this.url.href,this.glueFlavor))}}export{qe as B,ke as D,He as L,Ne as P,Qe as S,Vt as c,Ct as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as Z,r as a,j as e}from"./react-CsO_xvbl.js";import{d as ee}from"./index-rBWMBTI-.js";import{i as T,k as j,M as se,L as D,T as _,R as I,S as te,F as ie,l as q}from"./index-BS1IMOaB.js";const re=T("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);const F=T("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);const ae=T("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);const oe=T("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function de({open:r,project:c,onOpenChange:M,onBeforeMutation:V}){const{t,i18n:L}=Z(),[v,N]=a.useState([]),[l,z]=a.useState(null),[x,S]=a.useState(""),[o,b]=a.useState(null),[C,P]=a.useState(""),[u,p]=a.useState(null),[B,H]=a.useState(""),[k,w]=a.useState(null),[m,$]=a.useState(null),[y,n]=a.useState(""),[R,d]=a.useState(""),E=c.permission!=="read",U=c.permission==="owner";a.useEffect(()=>{if(!r)return;const s=new AbortController;return n("load"),d(""),p(null),j(`/api/projects/${c.id}/history`,{signal:s.signal}).then(i=>{N(i.versions),z(i.stats),S(h=>i.versions.some(g=>g.id===h)?h:i.versions[0]?.id??"")}).catch(i=>{J(i)||d(f(i))}).finally(()=>{s.signal.aborted||n("")}),()=>s.abort()},[r,c.id]),a.useEffect(()=>{if(!r||!x){b(null);return}const s=new AbortController;return n("detail"),p(null),j(`/api/projects/${c.id}/history/${x}`,{signal:s.signal}).then(i=>{b(i),H(i.version.label??"");const h=i.version.changedPaths.find(g=>i.files.some(A=>A.path===g))??i.files[0]?.path??"";P(h)}).catch(i=>{J(i)||d(f(i))}).finally(()=>{s.signal.aborted||n("")}),()=>s.abort()},[r,c.id,x]);const G=async(s=C)=>{if(s){n("compare"),d("");try{p(await j(`/api/projects/${c.id}/history/${x}/file?path=${encodeURIComponent(s)}`))}catch(i){d(f(i))}finally{n("")}}},K=async()=>{if(o){n("label"),d("");try{const s=await j(`/api/projects/${c.id}/history/${o.version.id}`,{method:"PATCH",body:JSON.stringify({label:B.trim()||null})});b(i=>i&&{...i,version:s.version}),N(i=>i.map(h=>h.id===s.version.id?s.version:h)),z(s.stats)}catch(s){d(f(s))}finally{n("")}}},W=async()=>{const s=m;if(s){$(null),n("delete"),d("");try{if(!await V())throw new Error(t("errors.collaborationUnavailable"));const i=s==="all"?`/api/projects/${c.id}/history`:`/api/projects/${c.id}/history/${s.id}`,h=await j(i,{method:"DELETE"});if(z(h.stats),s==="all")N([]),S(""),b(null),p(null);else{const g=v.filter(A=>A.id!==s.id);N(g),x===s.id&&(S(g[0]?.id??""),b(null),p(null))}}catch(i){d(f(i))}finally{n("")}}},Q=async()=>{const s=k;if(!(!s||!o)){w(null),n("restore"),d("");try{if(!await V())throw new Error(t("errors.collaborationUnavailable"));await j(`/api/projects/${c.id}/history/${o.version.id}/restore`,{method:"POST",body:JSON.stringify(s==="project"?{}:{path:s})}),window.location.reload()}catch(i){d(f(i)),n("")}}},X=a.useMemo(()=>{if(!u)return[];const s=new ee;s.Diff_Timeout=1;const i=s.diff_main(u.historical,u.comparison,!0);return s.diff_cleanupSemantic(i),i},[u]),Y=m&&m!=="all"?m.label||new Date(m.createdAt).toLocaleString(L.resolvedLanguage):"";return e.jsxs(e.Fragment,{children:[e.jsx(se,{open:r,extraWide:!0,className:"history-dialog-modal",title:t("history.title"),description:t("history.description"),onOpenChange:M,footer:e.jsx("button",{onClick:()=>M(!1),children:t("common.close")}),children:e.jsxs("div",{className:"history-dialog",children:[R&&e.jsx("p",{className:"error history-message",children:R}),y==="load"&&v.length===0?e.jsxs("div",{className:"history-loading",children:[e.jsx(D,{className:"spin",size:22}),t("common.loading")]}):e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:"history-timeline",children:[U&&l&&e.jsxs("div",{className:`history-stats${l.storageLimitExceeded?" exceeded":""}`,children:[e.jsxs("header",{children:[e.jsxs("span",{children:[e.jsx(ae,{size:14}),t("history.storage")]}),e.jsx("button",{type:"button",disabled:!!y||v.length===0,title:t("history.clearAll"),"aria-label":t("history.clearAll"),onClick:()=>$("all"),children:e.jsx(_,{size:13})})]}),e.jsx("strong",{children:t("history.storageUsage",{used:O(l.objectBytes),limit:O(l.maxStorageBytes)})}),e.jsx("progress",{max:l.maxStorageBytes,value:Math.min(l.objectBytes,l.maxStorageBytes)}),e.jsxs("small",{children:[t("history.versionUsage",{count:l.ordinaryVersionCount,limit:l.maxVersions}),l.labeledVersionCount>0?` · ${t("history.protectedVersions",{count:l.labeledVersionCount})}`:""]}),l.storageLimitExceeded&&e.jsx("small",{className:"history-storage-warning",children:t("history.storageExceeded")})]}),v.map(s=>e.jsxs("button",{className:s.id===x?"active":"",onClick:()=>S(s.id),children:[e.jsx(F,{size:15}),e.jsxs("span",{children:[e.jsx("strong",{children:s.label||t(`history.reasons.${s.reason}`)}),e.jsx("small",{children:new Date(s.createdAt).toLocaleString(L.resolvedLanguage)}),e.jsxs("small",{children:[s.author?.name??t("editor.deletedUser")," · ",t("history.changedCount",{count:s.changedPaths.length})]})]})]},s.id)),v.length===0&&e.jsx("p",{className:"muted padded",children:t("history.empty")})]}),e.jsx("section",{className:"history-detail",children:o&&e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"history-detail-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.version.label||t(`history.reasons.${o.version.reason}`)}),e.jsxs("small",{children:[e.jsx(re,{size:12}),new Date(o.version.createdAt).toLocaleString(L.resolvedLanguage)," · ",t("history.fileCount",{count:o.version.fileCount})]})]}),e.jsxs("span",{className:"history-detail-actions",children:[U&&e.jsxs("button",{className:"danger-text",disabled:!!y,onClick:()=>$(o.version),children:[e.jsx(_,{size:14}),t("history.deleteVersion")]}),E&&e.jsxs("button",{className:"danger-text",disabled:!!y,onClick:()=>w("project"),children:[e.jsx(I,{size:14}),t("history.restoreProject")]})]})]}),E&&e.jsxs("div",{className:"history-label",children:[e.jsxs("label",{children:[e.jsx(oe,{size:14}),e.jsx("input",{value:B,maxLength:80,placeholder:t("history.labelPlaceholder"),onChange:s=>H(s.target.value)})]}),e.jsxs("button",{disabled:y==="label"||B.trim()===(o.version.label??""),onClick:()=>{K()},children:[y==="label"?e.jsx(D,{className:"spin",size:13}):e.jsx(te,{size:13}),t("history.saveLabel")]})]}),e.jsxs("div",{className:"history-files",children:[e.jsx("div",{className:"history-file-list",children:o.files.map(s=>{const i=o.version.changedPaths.includes(s.path);return e.jsxs("button",{className:s.path===C?"active":"",title:s.path,onClick:()=>{P(s.path),p(null)},children:[e.jsx(ie,{size:13}),e.jsx("span",{children:s.path}),i&&e.jsx("small",{children:t("history.changed")})]},s.path)})}),e.jsxs("div",{className:"history-file-actions",children:[e.jsxs("button",{disabled:!C||!!y,onClick:()=>{G()},children:[y==="compare"?e.jsx(D,{className:"spin",size:13}):e.jsx(F,{size:13}),t("history.compareCurrent")]}),E&&e.jsxs("button",{disabled:!C||!!y,onClick:()=>w(C),children:[e.jsx(I,{size:13}),t("history.restoreFile")]})]})]}),e.jsx("div",{className:"history-comparison",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("header",{children:[e.jsx("strong",{children:u.path}),e.jsx("small",{children:t("history.comparingCurrent")})]}),e.jsx("pre",{children:X.map(([s,i],h)=>e.jsx("span",{className:s<0?"history-removed":s>0?"history-added":"",children:i},h))})]}):e.jsxs("div",{className:"history-comparison-empty",children:[e.jsx(F,{size:25}),e.jsx("span",{children:t("history.chooseFile")})]})})]})})]})]})}),e.jsx(q,{open:!!k,title:t(k==="project"?"history.restoreProjectTitle":"history.restoreFileTitle"),description:k==="project"?t("history.restoreProjectDescription"):t("history.restoreFileDescription",{path:k??""}),confirmLabel:t("history.restore"),danger:!0,onCancel:()=>w(null),onConfirm:()=>{Q()}}),e.jsx(q,{open:!!m,title:t(m==="all"?"history.clearAllTitle":"history.deleteVersionTitle"),description:m==="all"?t("history.clearAllDescription"):t("history.deleteVersionDescription",{name:Y}),confirmLabel:t(m==="all"?"history.clearAll":"history.deleteVersion"),danger:!0,onCancel:()=>$(null),onConfirm:()=>{W()}})]})}function O(r){return r<1024?`${r} B`:r<1024*1024?`${Math.round(r/102.4)/10} KB`:r<1024*1024*1024?`${Math.round(r/(1024*1024)*10)/10} MB`:`${Math.round(r/(1024*1024*1024)*10)/10} GB`}function f(r){return r instanceof Error?r.message:String(r)}function J(r){return r instanceof Error&&r.name==="AbortError"}export{de as HistoryDialog};
|