co-maintainer 0.7.2-beta.1 → 0.7.2
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/dist/package.json +2 -1
- package/dist/src/ai/anthropic.d.ts +1 -1
- package/dist/src/ai/anthropic.js +1 -1
- package/dist/src/ai/batch.d.ts +1 -1
- package/dist/src/ai/batch.js +3 -3
- package/dist/src/ai/copy_rule.d.ts +7 -0
- package/dist/src/ai/copy_rule.js +23 -0
- package/dist/src/ai/estimate.js +3 -3
- package/dist/src/ai/fake.js +2 -1
- package/dist/src/ai/mermaid.js +1 -0
- package/dist/src/ai/oauth/registry.d.ts +1 -1
- package/dist/src/ai/oauth/sign-in-with-chatgpt.d.ts +4 -4
- package/dist/src/ai/oauth/sign-in-with-chatgpt.js +6 -6
- package/dist/src/ai/openai.d.ts +3 -3
- package/dist/src/ai/openai.js +4 -4
- package/dist/src/ai/openrouter.d.ts +1 -1
- package/dist/src/ai/openrouter.js +1 -1
- package/dist/src/ai/pricing.js +1 -1
- package/dist/src/ai/provider.d.ts +2 -0
- package/dist/src/ai/provider.js +8 -2
- package/dist/src/ai/verify.d.ts +1 -1
- package/dist/src/ai/verify.js +1 -1
- package/dist/src/cli/args.js +1 -1
- package/dist/src/cli/command_json.d.ts +1 -1
- package/dist/src/cli/commands/config.d.ts +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/oauth.js +1 -1
- package/dist/src/cli/commands/probe.js +1 -1
- package/dist/src/cli/commands/serve.d.ts +1 -1
- package/dist/src/cli/commands/serve.js +1 -1
- package/dist/src/cli/commands/set.d.ts +1 -1
- package/dist/src/cli/commands/set.js +4 -4
- package/dist/src/cli/commands/view.js +2 -2
- package/dist/src/cli/error.d.ts +1 -1
- package/dist/src/cli/error.js +1 -1
- package/dist/src/cli/prompt.d.ts +2 -2
- package/dist/src/cli/prompt.js +3 -3
- package/dist/src/cli/review_args.js +2 -2
- package/dist/src/cli/review_result.d.ts +3 -4
- package/dist/src/cli/review_result.js +5 -8
- package/dist/src/config.d.ts +11 -11
- package/dist/src/config.js +3 -3
- package/dist/src/github/app.d.ts +1 -1
- package/dist/src/github/app.js +1 -1
- package/dist/src/github/app_manifest.d.ts +1 -1
- package/dist/src/github/app_manifest.js +1 -1
- package/dist/src/github/client.d.ts +1 -1
- package/dist/src/github/client.js +1 -1
- package/dist/src/github/gh.js +2 -2
- package/dist/src/github/jwt.d.ts +1 -1
- package/dist/src/github/jwt.js +1 -1
- package/dist/src/github/oauth.js +2 -2
- package/dist/src/knowledge/facts.js +3 -3
- package/dist/src/knowledge/guide.js +7 -7
- package/dist/src/knowledge/probe.js +1 -1
- package/dist/src/knowledge/skill.js +1 -1
- package/dist/src/knowledge/synthesis.js +7 -7
- package/dist/src/local/carry_over_store.d.ts +1 -1
- package/dist/src/local/carry_over_store.js +1 -1
- package/dist/src/local/codegraph_prepare.js +1 -1
- package/dist/src/local/git_ops.js +1 -1
- package/dist/src/local/review_local.js +3 -3
- package/dist/src/local/review_lock.d.ts +1 -1
- package/dist/src/pr/checkout.d.ts +3 -3
- package/dist/src/pr/checkout.js +7 -7
- package/dist/src/pr/codegraph_tool_args.d.ts +1 -1
- package/dist/src/pr/codegraph_tool_args.js +1 -1
- package/dist/src/pr/findings.js +8 -9
- package/dist/src/pr/findings_json.d.ts +2 -2
- package/dist/src/pr/findings_json.js +1 -1
- package/dist/src/pr/github_revision.js +1 -1
- package/dist/src/pr/review_copy.d.ts +2 -3
- package/dist/src/pr/review_copy.js +2 -3
- package/dist/src/pr/reviewer.d.ts +3 -3
- package/dist/src/pr/reviewer.js +24 -26
- package/dist/src/pr/scope.d.ts +8 -8
- package/dist/src/pr/scope.js +4 -4
- package/dist/src/pr/snapshot.d.ts +2 -2
- package/dist/src/remote/client.js +3 -3
- package/dist/src/remote/schema.d.ts +1 -1
- package/dist/src/remote/schema.js +1 -1
- package/dist/src/remote/server/body.d.ts +1 -1
- package/dist/src/remote/server/body.js +1 -1
- package/dist/src/remote/server/guides.js +1 -1
- package/dist/src/remote/validate.js +1 -1
- package/dist/src/review/blocking.d.ts +3 -3
- package/dist/src/review/blocking.js +2 -2
- package/dist/src/review/carry_over.d.ts +1 -1
- package/dist/src/review/carry_over.js +2 -2
- package/dist/src/review/diagram.js +7 -6
- package/dist/src/review/engine.d.ts +1 -1
- package/dist/src/review/guides.js +1 -1
- package/dist/src/review/system_prompt.d.ts +1 -1
- package/dist/src/review/system_prompt.js +1 -1
- package/dist/src/server/api/jobs.js +2 -2
- package/dist/src/server/api/repos.js +1 -1
- package/dist/src/server/app.js +1 -1
- package/dist/src/server/auth.d.ts +3 -3
- package/dist/src/server/auth.js +9 -4
- package/dist/src/server/http.js +5 -5
- package/dist/src/server/pages/activity.js +1 -1
- package/dist/src/server/pages/add_repo.js +1 -0
- package/dist/src/server/pages/client.d.ts +2 -2
- package/dist/src/server/pages/client.js +2 -2
- package/dist/src/server/pages/home.d.ts +1 -1
- package/dist/src/server/pages/home.js +1 -1
- package/dist/src/server/pages/icons.d.ts +1 -1
- package/dist/src/server/pages/icons.js +1 -1
- package/dist/src/server/pages/layout.d.ts +2 -2
- package/dist/src/server/pages/layout.js +3 -3
- package/dist/src/server/pages/pr.js +2 -0
- package/dist/src/server/pages/rate_limit_waits.js +2 -2
- package/dist/src/server/pages/repo_settings.js +1 -0
- package/dist/src/server/pages/router.js +3 -2
- package/dist/src/server/pages/styles.d.ts +2 -2
- package/dist/src/server/pages/styles.js +2 -2
- package/dist/src/server/pages/ui.d.ts +1 -1
- package/dist/src/server/pages/ui.js +2 -2
- package/dist/src/server/webhook/index.js +1 -1
- package/dist/src/services/clear.d.ts +2 -2
- package/dist/src/services/clear.js +2 -2
- package/dist/src/services/probe.js +1 -1
- package/dist/src/services/remote_review_abort.d.ts +1 -1
- package/dist/src/services/remote_review_abort.js +1 -1
- package/dist/src/services/remote_tokens.js +1 -1
- package/dist/src/services/replies.js +0 -2
- package/dist/src/services/review.d.ts +3 -5
- package/dist/src/services/review.js +8 -10
- package/dist/src/services/setup.d.ts +2 -2
- package/dist/src/services/setup.js +9 -9
- package/dist/src/services/watch_comments.js +1 -2
- package/dist/src/services/watch_notes.js +1 -3
- package/dist/src/store/app_db.d.ts +1 -1
- package/dist/src/store/app_db.js +2 -2
- package/dist/src/store/jobs.d.ts +2 -2
- package/dist/src/store/jobs.js +3 -3
- package/dist/src/store/migrations.d.ts +2 -2
- package/dist/src/store/migrations.js +18 -18
- package/dist/src/store/rows.d.ts +2 -2
- package/dist/src/store/rows.js +1 -1
- package/dist/src/store/sessions.d.ts +1 -1
- package/dist/src/store/sessions.js +2 -2
- package/dist/src/store/sqlite.js +2 -2
- package/dist/src/tools/codegraph.d.ts +1 -1
- package/dist/src/tools/codegraph.js +3 -3
- package/dist/src/tools/codegraph_exec.d.ts +1 -1
- package/dist/src/tools/codegraph_exec.js +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/src/util/keyed_lock.d.ts +1 -1
- package/dist/src/util/keyed_lock.js +1 -1
- package/dist/src/util/log.js +1 -1
- package/dist/src/util/redact.js +2 -1
- package/dist/src/util/run_summary.d.ts +3 -3
- package/dist/src/util/run_summary.js +3 -3
- package/dist/src/util/runtime.d.ts +4 -4
- package/dist/src/util/runtime.js +5 -5
- package/dist/src/util/time.d.ts +1 -1
- package/dist/src/util/time.js +1 -1
- package/package.json +2 -1
package/dist/src/server/auth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Only a token's hash ever reaches `store/sessions.ts
|
|
1
|
+
/** Only a token's hash ever reaches `store/sessions.ts`. The raw token is
|
|
2
2
|
* handed back once, at login, and never stored. */
|
|
3
3
|
import { readConfig, writeUserConfig } from "../config.js";
|
|
4
4
|
import { hashPassword, verifyPasswordHash } from "../util/password.js";
|
|
@@ -37,7 +37,7 @@ export function randomToken() {
|
|
|
37
37
|
return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
38
38
|
}
|
|
39
39
|
// ponytail: an in-memory Map, one entry per distinct IP that has ever failed
|
|
40
|
-
// a login. Fine for a single self-hosted admin
|
|
40
|
+
// a login. Fine for a single self-hosted admin. Add eviction if this ever
|
|
41
41
|
// needs to survive a hostile flood of spoofed source IPs.
|
|
42
42
|
const attempts = new Map();
|
|
43
43
|
export function recordAuthFailure(ip) {
|
|
@@ -116,7 +116,7 @@ export async function revokeOtherSessions(keepToken) {
|
|
|
116
116
|
deleteOtherSessions(await sha256Hex(keepToken));
|
|
117
117
|
}
|
|
118
118
|
/** Issues a session for the one dashboard identity, bypassing the password
|
|
119
|
-
* check
|
|
119
|
+
* check, used after GitHub OAuth has already verified the caller. */
|
|
120
120
|
export async function createSession() {
|
|
121
121
|
const token = randomToken();
|
|
122
122
|
const expiresAt = new Date(Date.now() + SESSION_TTL_MS).toISOString();
|
|
@@ -139,6 +139,7 @@ export async function logout(token) {
|
|
|
139
139
|
}
|
|
140
140
|
function readCookie(request, name) {
|
|
141
141
|
const cookie = request.headers.get("cookie") ?? "";
|
|
142
|
+
// punctuation: code, a Cookie header value is split at its semicolons
|
|
142
143
|
for (const part of cookie.split(";")) {
|
|
143
144
|
const trimmed = part.trim();
|
|
144
145
|
const eq = trimmed.indexOf("=");
|
|
@@ -171,6 +172,7 @@ export function sessionCookieHeader(token, secure) {
|
|
|
171
172
|
];
|
|
172
173
|
if (secure)
|
|
173
174
|
flags.push("Secure");
|
|
175
|
+
// punctuation: code, the Cookie header joins its attributes with a semicolon
|
|
174
176
|
return flags.join("; ");
|
|
175
177
|
}
|
|
176
178
|
export function clearSessionCookieHeader(secure) {
|
|
@@ -183,10 +185,11 @@ export function clearSessionCookieHeader(secure) {
|
|
|
183
185
|
];
|
|
184
186
|
if (secure)
|
|
185
187
|
flags.push("Secure");
|
|
188
|
+
// punctuation: code, the Cookie header joins its attributes with a semicolon
|
|
186
189
|
return flags.join("; ");
|
|
187
190
|
}
|
|
188
191
|
/** The GitHub OAuth `state` param, plus the post-login `next` path,
|
|
189
|
-
* round-tripped through an HttpOnly cookie instead of server memory
|
|
192
|
+
* round-tripped through an HttpOnly cookie instead of server memory, one
|
|
190
193
|
* admin, one in-flight login at a time, so a cookie is all this needs. */
|
|
191
194
|
export function readOauthState(request) {
|
|
192
195
|
const value = readCookie(request, OAUTH_STATE_COOKIE);
|
|
@@ -215,6 +218,7 @@ export function oauthStateCookieHeader(state, next, secure) {
|
|
|
215
218
|
];
|
|
216
219
|
if (secure)
|
|
217
220
|
flags.push("Secure");
|
|
221
|
+
// punctuation: code, the Cookie header joins its attributes with a semicolon
|
|
218
222
|
return flags.join("; ");
|
|
219
223
|
}
|
|
220
224
|
export function clearOauthStateCookieHeader(secure) {
|
|
@@ -227,5 +231,6 @@ export function clearOauthStateCookieHeader(secure) {
|
|
|
227
231
|
];
|
|
228
232
|
if (secure)
|
|
229
233
|
flags.push("Secure");
|
|
234
|
+
// punctuation: code, the Cookie header joins its attributes with a semicolon
|
|
230
235
|
return flags.join("; ");
|
|
231
236
|
}
|
package/dist/src/server/http.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
*
|
|
3
3
|
* The app is written against the Web `Request`/`Response` types, which Deno
|
|
4
4
|
* served natively. Node has both types but no server that speaks them
|
|
5
|
-
* directly, so this translates per request and streams responses
|
|
6
|
-
* the SSE job feed
|
|
5
|
+
* directly, so this translates per request and streams responses, including
|
|
6
|
+
* the SSE job feed, instead of buffering them. */
|
|
7
7
|
import { createServer, } from "node:http";
|
|
8
8
|
import { Readable } from "node:stream";
|
|
9
9
|
function requestHeaders(req) {
|
|
@@ -19,8 +19,8 @@ function requestHeaders(req) {
|
|
|
19
19
|
}
|
|
20
20
|
return headers;
|
|
21
21
|
}
|
|
22
|
-
/** Node's `IncomingMessage` is a Node stream
|
|
23
|
-
* GET/HEAD has none, and passing `undefined` is required there
|
|
22
|
+
/** Node's `IncomingMessage` is a Node stream, `fetch` wants a Web body. A
|
|
23
|
+
* GET/HEAD has none, and passing `undefined` is required there, a body on a
|
|
24
24
|
* GET makes undici throw. */
|
|
25
25
|
function requestBody(req, method) {
|
|
26
26
|
if (method === "GET" || method === "HEAD")
|
|
@@ -104,7 +104,7 @@ export function serveHttp(app, port) {
|
|
|
104
104
|
server.once("error", reject);
|
|
105
105
|
});
|
|
106
106
|
// Slow-loris defence: cap how long a client may take to send headers and
|
|
107
|
-
// the full request. Responses (SSE) are unaffected
|
|
107
|
+
// the full request. Responses (SSE) are unaffected, those are measured on
|
|
108
108
|
// the response side, not here.
|
|
109
109
|
server.headersTimeout = 20_000;
|
|
110
110
|
server.requestTimeout = 120_000;
|
|
@@ -391,7 +391,7 @@ function failureExplanation(error) {
|
|
|
391
391
|
return "";
|
|
392
392
|
}
|
|
393
393
|
/** The model a failed job ran with. A manual or webhook review does not put
|
|
394
|
-
* the model in its job args
|
|
394
|
+
* the model in its job args. The review row records the one it resolved.
|
|
395
395
|
* "unknown" is what a review stores when no model was set. */
|
|
396
396
|
function failedModel(args, review) {
|
|
397
397
|
const fromReview = review?.model && review.model !== "unknown" ? review.model : undefined;
|
|
@@ -46,6 +46,7 @@ export function renderAddRepo(username, picker) {
|
|
|
46
46
|
title: "Add repository · co-maintainer",
|
|
47
47
|
username,
|
|
48
48
|
active: "/",
|
|
49
|
+
// punctuation: code, a script the page runs in the browser
|
|
49
50
|
body: `<div class="wrap narrow">
|
|
50
51
|
<div class="crumbs"><a href="/">Repositories</a> / Add</div>
|
|
51
52
|
<div class="pagehead">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** Generated from src/server/pages/client.js by scripts/embed_assets.mjs
|
|
2
|
-
export declare const client = "function toast(message) {\n const host = document.getElementById(\"toasts\");\n if (!host) return;\n const el = document.createElement(\"div\");\n el.className = \"toast\";\n el.setAttribute(\"role\", \"status\");\n el.textContent = message;\n host.appendChild(el);\n setTimeout(function () {\n el.remove();\n }, 5000);\n}\n\nfunction fail(card, message, retry) {\n toast(message);\n if (!card) return;\n let box = card.querySelector(\"[data-fail]\");\n if (!box) {\n box = document.createElement(\"div\");\n box.setAttribute(\"data-fail\", \"1\");\n box.className = \"fail\";\n card.appendChild(box);\n }\n box.replaceChildren();\n const p = document.createElement(\"p\");\n p.textContent = message;\n const btn = document.createElement(\"button\");\n btn.className = \"btn sm\";\n btn.type = \"button\";\n btn.textContent = \"Retry\";\n btn.addEventListener(\"click\", retry);\n box.appendChild(p);\n box.appendChild(btn);\n}\n\nfunction clearFail(card) {\n const box = card && card.querySelector(\"[data-fail]\");\n if (box) box.remove();\n}\n\n/** Copy text for the `codeBlock` copy button. `navigator.clipboard` needs a\n * secure context, so the hidden-textarea path keeps Copy working on plain\n * http://localhost too. `done` runs only when one of the two paths worked. */\nfunction copyText(value, done, failed) {\n function fallback() {\n if (legacyCopy(value)) done();\n else if (failed) failed();\n }\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(value).then(done, fallback);\n return;\n }\n fallback();\n}\n\nfunction legacyCopy(value) {\n const area = document.createElement(\"textarea\");\n area.value = value;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\") === true;\n } catch {\n copied = false;\n }\n area.remove();\n return copied;\n}\n\nfunction skeleton(card, on) {\n if (!card) return;\n card.classList.toggle(\"busy\", on);\n}\n\nasync function api(method, url, body) {\n const res = await fetch(url, {\n method: method,\n headers: {\n \"content-type\": \"application/json\",\n \"x-requested-with\": \"co-maintainer\",\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!res.ok) {\n let message = \"Request failed\";\n let code = \"\";\n let detail;\n try {\n const data = await res.json();\n if (data.error && data.error.message) message = data.error.message;\n if (data.error && data.error.code) code = data.error.code;\n if (data.error) detail = data.error.detail;\n } catch {\n // body was not JSON; keep the generic message\n }\n const error = new Error(message);\n if (code) error.code = code;\n error.detail = detail;\n throw error;\n }\n if (res.status === 204) return null;\n return await res.json();\n}\n\nasync function run(btn, card, fn) {\n if (btn) btn.disabled = true;\n skeleton(card, true);\n clearFail(card);\n try {\n await fn();\n } catch (err) {\n fail(card, err.message, function () {\n run(btn, card, fn);\n });\n } finally {\n if (btn) btn.disabled = false;\n skeleton(card, false);\n }\n}\n\nfunction saved(btn, card) {\n if (card) {\n let state = card.querySelector(\".save-state\");\n if (!state) {\n state = document.createElement(\"span\");\n state.className = \"save-state\";\n state.setAttribute(\"role\", \"status\");\n if (btn && btn.parentNode) {\n btn.parentNode.insertBefore(state, btn.nextSibling);\n }\n }\n state.textContent = \"Saved\";\n }\n toast(\"Saved\");\n}\nglobalThis.saved = saved;\n\n/** Polls one job until it reaches a terminal status. A running `init`/`remake`\n * ignores the abort signal, so \"wait for the sync\" is the only honest option\n * the clear pages can offer for it. */\nfunction waitForJob(id) {\n return new Promise(function (resolve, reject) {\n let attempts = 0;\n async function tick() {\n attempts++;\n try {\n const res = await fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n });\n if (!res.ok) throw new Error(\"Could not check the running job.\");\n const job = await res.json();\n if (job.status !== \"running\" && job.status !== \"queued\") {\n resolve();\n return;\n }\n if (attempts > 1200) {\n reject(new Error(\"The sync did not finish.\"));\n return;\n }\n setTimeout(tick, 3000);\n } catch (err) {\n reject(err);\n }\n }\n tick();\n });\n}\n\n/** Clears knowledge, asking about pending jobs when the server refuses.\n * Returns false when the user backed out, so the caller does not reload.\n * A running review is abortable and a running setup is not, which is the\n * difference between the two questions. Called from the inline scripts on the\n * knowledge pages, so it looks unused from inside this file. */\n// oxlint-disable-next-line no-unused-vars\nasync function clearKnowledge(url, includeCache) {\n const target = includeCache ? url + \"?includeCache=1\" : url;\n const retry = target.indexOf(\"?\") >= 0 ? \"&\" : \"?\";\n try {\n await api(\"DELETE\", target);\n } catch (err) {\n if (err.code !== \"jobs_running\") throw err;\n const detail = err.detail || { queued: 0, running: [] };\n const running = detail.running || [];\n const setup = running.find(function (job) {\n return job.abortable === false;\n });\n if (setup) {\n if (\n !confirm(\n \"A sync is running and cannot be stopped. Wait for it to finish and then clear?\",\n )\n ) {\n return false;\n }\n await waitForJob(setup.id);\n await api(\"DELETE\", target);\n return;\n }\n const parts = [];\n if (running.length) parts.push(running.length + \" running review(s)\");\n if (detail.queued) parts.push(detail.queued + \" queued job(s)\");\n if (!confirm(\"Stop \" + parts.join(\" and \") + \" and clear?\")) return false;\n try {\n await api(\"DELETE\", target + retry + \"onRunning=abort\");\n } catch (retryError) {\n // A setup job was claimed between the first 409 and this retry. It\n // cannot be aborted, so wait it out like the branch above.\n if (retryError.code !== \"job_not_abortable\") throw retryError;\n const jobId = retryError.detail && retryError.detail.id;\n if (jobId) await waitForJob(jobId);\n await api(\"DELETE\", target);\n }\n }\n}\n\nasync function postAndGo(url, body, next, btn) {\n const card = btn && btn.closest(\"[data-async]\");\n await run(btn, card, async function () {\n await api(\"POST\", url, body);\n location.href = next;\n });\n}\n\n// Called from the inline scripts on the repo list and repo pages, which deno lint\n// cannot see, so it looks unused from inside this file.\n// deno-lint-ignore no-unused-vars\n// oxlint-disable-next-line no-unused-vars\nfunction bindToggle(btn, url, field) {\n btn.addEventListener(\"click\", async function () {\n if (btn.disabled) return;\n const on = !btn.classList.contains(\"on\");\n btn.classList.toggle(\"on\", on);\n btn.setAttribute(\"data-on\", on ? \"1\" : \"0\");\n btn.disabled = true;\n const card = btn.closest(\"[data-async]\");\n try {\n const payload = {};\n payload[field] = on;\n await api(\"PATCH\", url, payload);\n } catch (err) {\n btn.classList.toggle(\"on\", !on);\n btn.setAttribute(\"data-on\", on ? \"0\" : \"1\");\n fail(card, err.message, function () {\n btn.click();\n });\n } finally {\n btn.disabled = false;\n }\n });\n}\n\nfunction logLevelClass(level) {\n return [\"info\", \"dim\", \"ok\", \"warn\", \"error\"].indexOf(level) >= 0\n ? level\n : \"info\";\n}\n\nfunction logClock(at) {\n const date = new Date(at);\n if (isNaN(date.getTime())) return \"--:--:--\";\n return date.toTimeString().slice(0, 8);\n}\n\n/** One append-only log panel. The rendered lines are the starting point, the\n * SSE stream resumes after their last seq, and a slow poll catches lines\n * written by another process (the CLI or a direct database write). */\nfunction startLogPanel(panel) {\n if (panel.getAttribute(\"data-started\") === \"1\") return;\n panel.setAttribute(\"data-started\", \"1\");\n const log = panel.querySelector(\".log\");\n if (!log) return;\n const jump = panel.querySelector(\"[data-log-jump]\");\n const jumpN = jump && jump.querySelector(\"span\");\n const count = panel.querySelector(\".cnt\");\n const pause = panel.querySelector(\"[data-log-pause]\");\n const clear = panel.querySelector(\"[data-log-clear]\");\n const status = panel.querySelector(\".st\");\n const errorBox = panel.querySelector(\"[data-log-error]\");\n const id = panel.getAttribute(\"data-job\") || panel.getAttribute(\"data-log\");\n let live = panel.getAttribute(\"data-live\") === \"1\";\n let baseStatus = live\n ? \"Running\"\n : panel.getAttribute(\"data-status\") || \"Done\";\n let baseClass = live\n ? \"run\"\n : baseStatus === \"Failed\"\n ? \"failed\"\n : baseStatus === \"Not posted\" || baseStatus === \"Canceled\"\n ? \"warn\"\n : \"done\";\n let lines = log.querySelectorAll(\".line\").length;\n let empty = log.querySelector(\".log-empty\");\n let pending = 0;\n let paused = false;\n let buffered = [];\n let lastSeq = Number(panel.getAttribute(\"data-seq\") || 0);\n if (!isFinite(lastSeq)) lastSeq = 0;\n const timers = [];\n let stream = null;\n\n function showEmpty() {\n if (empty) return;\n empty = document.createElement(\"p\");\n empty.className = \"log-empty\";\n empty.textContent =\n \"No log lines yet. New lines appear here as the job runs.\";\n log.appendChild(empty);\n }\n\n function hideEmpty() {\n if (!empty) return;\n empty.remove();\n empty = null;\n }\n\n function setError(message) {\n if (!errorBox) return;\n errorBox.textContent = message;\n errorBox.hidden = false;\n }\n\n function clearError() {\n if (!errorBox) return;\n errorBox.textContent = \"\";\n errorBox.hidden = true;\n }\n\n function atBottom() {\n return log.scrollTop + log.clientHeight >= log.scrollHeight - 4;\n }\n\n function setCount() {\n if (!count) return;\n count.textContent = lines + (lines === 1 ? \" line\" : \" lines\");\n }\n\n function setJump() {\n if (!jump) return;\n if (pending > 0) {\n if (jumpN) jumpN.textContent = \"(\" + pending + \")\";\n jump.hidden = false;\n } else {\n if (jumpN) jumpN.textContent = \"\";\n jump.hidden = true;\n }\n }\n\n function add(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n const wasAtBottom = atBottom();\n const el = document.createElement(\"div\");\n el.className = \"line lv-\" + logLevelClass(line.level);\n el.setAttribute(\"data-seq\", String(line.seq));\n const t = document.createElement(\"span\");\n t.className = \"t\";\n t.textContent = logClock(line.at);\n const m = document.createElement(\"span\");\n m.className = \"msg\";\n m.textContent = String(line.message || \"\");\n el.appendChild(t);\n el.appendChild(m);\n log.appendChild(el);\n lines += 1;\n lastSeq = line.seq;\n hideEmpty();\n clearError();\n setCount();\n if (wasAtBottom) {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n } else {\n pending += 1;\n setJump();\n }\n }\n\n function receive(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n if (paused) {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq === line.seq) return;\n }\n buffered.push(line);\n return;\n }\n add(line);\n }\n\n function flush() {\n buffered.sort(function (a, b) {\n return a.seq - b.seq;\n });\n for (let index = 0; index < buffered.length; index++) add(buffered[index]);\n buffered = [];\n }\n\n function stopLive() {\n if (stream) {\n const current = stream;\n stream = null;\n try {\n current.abort();\n } catch {\n // the stream was already closed\n }\n }\n for (let index = 0; index < timers.length; index++) {\n clearInterval(timers[index]);\n }\n timers.length = 0;\n }\n\n function setLiveStatus(next) {\n live = false;\n panel.setAttribute(\"data-live\", \"0\");\n baseStatus =\n next === \"failed\" ? \"Failed\" : next === \"canceled\" ? \"Canceled\" : \"Done\";\n baseClass =\n next === \"failed\" ? \"failed\" : next === \"canceled\" ? \"warn\" : \"done\";\n panel.setAttribute(\"data-status\", baseStatus);\n if (!paused && status) {\n status.className = \"st \" + baseClass;\n status.textContent = baseStatus;\n }\n clearError();\n stopLive();\n }\n\n function poll() {\n if (!id) return;\n fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n })\n .then(function (res) {\n if (!res.ok) throw new Error(\"could not poll the job log\");\n return res.json();\n })\n .then(function (job) {\n if (!job) return;\n clearError();\n (job.logs || []).forEach(receive);\n if (job.status !== \"running\" && job.status !== \"queued\") {\n setLiveStatus(job.status);\n }\n })\n .catch(function () {\n if (live) setError(\"Log connection lost. Reconnecting...\");\n });\n }\n\n function connect() {\n if (!id || typeof fetch !== \"function\") return;\n const controller =\n typeof AbortController === \"function\" ? new AbortController() : null;\n stream = controller;\n fetch(\n \"/api/jobs/\" +\n encodeURIComponent(id) +\n \"/logs/stream?from=\" +\n encodeURIComponent(String(lastSeq)),\n {\n headers: {\n accept: \"text/event-stream\",\n \"x-requested-with\": \"co-maintainer\",\n },\n signal: controller ? controller.signal : undefined,\n },\n )\n .then(function (res) {\n if (!res.ok || !res.body || typeof res.body.getReader !== \"function\") {\n setError(\"Log connection lost. Reconnecting...\");\n return;\n }\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n function pump() {\n return reader.read().then(function (chunk) {\n if (chunk.done) return;\n buffer += decoder.decode(chunk.value, { stream: true });\n const frames = buffer.split(\"\\n\\n\");\n buffer = frames.pop() || \"\";\n frames.forEach(function (frame) {\n const data = [];\n frame.split(\"\\n\").forEach(function (line) {\n if (line.indexOf(\"data:\") === 0) {\n data.push(line.slice(5).replace(/^ /, \"\"));\n }\n });\n if (!data.length) return;\n try {\n receive(JSON.parse(data.join(\"\\n\")));\n } catch {\n // a malformed frame is skipped, not fatal\n }\n });\n return pump();\n });\n }\n return pump();\n })\n .catch(function () {\n if (stream === controller) {\n setError(\"Log connection lost. Reconnecting...\");\n }\n });\n }\n\n if (jump) {\n jump.addEventListener(\"click\", function () {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n });\n }\n log.addEventListener(\"scroll\", function () {\n if (atBottom()) {\n pending = 0;\n setJump();\n }\n });\n if (pause) {\n pause.addEventListener(\"click\", function () {\n paused = !paused;\n pause.textContent = paused ? \"Resume\" : \"Pause\";\n if (status) {\n status.className = \"st \" + (paused ? \"paused\" : baseClass);\n status.textContent = paused ? \"Paused\" : baseStatus;\n }\n if (!paused) flush();\n });\n }\n if (clear) {\n clear.addEventListener(\"click\", function () {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq > lastSeq) lastSeq = buffered[index].seq;\n }\n log.replaceChildren();\n lines = 0;\n pending = 0;\n buffered = [];\n showEmpty();\n setCount();\n setJump();\n });\n }\n setCount();\n setJump();\n if (live) {\n connect();\n timers.push(setInterval(poll, 1000));\n }\n}\n\n/** The Ctrl K palette. Every query gets a sequence number and only the\n * newest answer is drawn, so a slow reply to an older query never replaces\n * the results of the newer one. The highlighted row is the one Enter opens. */\nfunction startPalette() {\n const pal = document.getElementById(\"pal\");\n const overlay = document.getElementById(\"pal-ov\");\n const input = document.getElementById(\"pal-q\");\n const list = document.getElementById(\"pal-list\");\n if (!pal || !overlay || !input || !list) return;\n let returnFocus = null;\n let seq = 0;\n let timer = 0;\n let index = 0;\n\n function items() {\n return list.querySelectorAll(\"[data-href]\");\n }\n function highlight(next) {\n const rows = items();\n if (rows.length === 0) return;\n index = (next + rows.length) % rows.length;\n rows.forEach(function (row, i) {\n row.classList.toggle(\"on\", i === index);\n row.setAttribute(\"aria-selected\", i === index ? \"true\" : \"false\");\n });\n input.setAttribute(\"aria-activedescendant\", rows[index].id);\n rows[index].scrollIntoView({ block: \"nearest\" });\n }\n function draw(result) {\n list.textContent = \"\";\n if (result.groups.length === 0) {\n const empty = document.createElement(\"div\");\n empty.className = \"none\";\n empty.textContent = \"No results\";\n list.appendChild(empty);\n input.removeAttribute(\"aria-activedescendant\");\n return;\n }\n let n = 0;\n result.groups.forEach(function (group) {\n const label = document.createElement(\"div\");\n label.className = \"gl\";\n label.textContent = group.label;\n list.appendChild(label);\n group.items.forEach(function (item) {\n const row = document.createElement(\"a\");\n row.className = \"it\";\n row.id = \"pal-it-\" + n++;\n row.href = item.href;\n row.setAttribute(\"data-href\", item.href);\n row.setAttribute(\"role\", \"option\");\n row.setAttribute(\"aria-selected\", \"false\");\n const name = document.createElement(\"span\");\n name.className = \"lbl\";\n name.textContent = item.label;\n row.innerHTML =\n '<svg class=\"ic\" aria-hidden=\"true\"><use href=\"#i-' +\n String(item.icon).replace(/[^a-z0-9-]/g, \"\") +\n '\"></use></svg>';\n row.appendChild(name);\n list.appendChild(row);\n });\n });\n highlight(0);\n }\n async function search() {\n const mine = ++seq;\n pal.setAttribute(\"data-loading\", \"\");\n try {\n const res = await fetch(\n \"/api/search?q=\" + encodeURIComponent(input.value),\n { headers: { \"x-requested-with\": \"co-maintainer\" } },\n );\n const result = await res.json();\n if (mine !== seq) return;\n draw(res.ok ? result : { groups: [] });\n } catch {\n if (mine === seq) draw({ groups: [] });\n } finally {\n if (mine === seq) pal.removeAttribute(\"data-loading\");\n }\n }\n function open() {\n if (!pal.hidden) return;\n returnFocus = document.activeElement;\n pal.hidden = false;\n overlay.hidden = false;\n input.value = \"\";\n input.focus();\n search();\n }\n function close() {\n if (pal.hidden) return;\n pal.hidden = true;\n overlay.hidden = true;\n seq++;\n pal.removeAttribute(\"data-loading\");\n if (returnFocus && returnFocus.focus) returnFocus.focus();\n }\n\n document.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"[data-palette]\")) {\n ev.preventDefault();\n open();\n }\n });\n overlay.addEventListener(\"click\", close);\n document.addEventListener(\"keydown\", function (ev) {\n if ((ev.ctrlKey || ev.metaKey) && ev.key.toLowerCase() === \"k\") {\n ev.preventDefault();\n if (pal.hidden) open();\n else close();\n return;\n }\n if (pal.hidden) return;\n if (ev.key === \"Escape\") {\n ev.preventDefault();\n close();\n } else if (ev.key === \"ArrowDown\") {\n ev.preventDefault();\n highlight(index + 1);\n } else if (ev.key === \"ArrowUp\") {\n ev.preventDefault();\n highlight(index - 1);\n } else if (ev.key === \"Enter\" && ev.target === input) {\n const row = items()[index];\n if (row && !pal.hasAttribute(\"data-loading\")) {\n ev.preventDefault();\n location.href = row.getAttribute(\"data-href\");\n }\n }\n });\n input.addEventListener(\"input\", function () {\n clearTimeout(timer);\n pal.setAttribute(\"data-loading\", \"\");\n timer = setTimeout(search, 120);\n });\n}\n\nfunction startLogPanels() {\n const panels = document.querySelectorAll(\"[data-log]\");\n for (let index = 0; index < panels.length; index++) {\n startLogPanel(panels[index]);\n }\n}\n\n// The helper is inlined into `<head>` by `layout.ts`, before any page script\n// runs, so this is the one place that can close over both `toast()` and\n// `bindToggle` without depending on point-in-time globals.\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n // Client errors bubble to `window` from `document`.\n addEventListener(\"error\", function (ev) {\n toast((ev.error && ev.error.message) || \"Something broke\");\n });\n addEventListener(\"unhandledrejection\", function (ev) {\n toast((ev.reason && ev.reason.message) || \"Something broke\");\n });\n\n // Theme: the head bootstrap already applied the remembered choice; this only\n // flips it and stores the new one.\n const themeButton = document.getElementById(\"theme\");\n if (themeButton) {\n themeButton.addEventListener(\"click\", function () {\n const dark = document.documentElement.classList.toggle(\"dark\");\n try {\n localStorage.setItem(\"theme\", dark ? \"dark\" : \"light\");\n } catch {\n // storage may be unavailable; the class still applies for this page\n }\n });\n }\n\n // Mobile drawer. `open` on the aside slides it in; the overlay closes it and\n // choosing a link closes it before navigating.\n const drawer = document.querySelector(\"aside.side\");\n const overlay = document.getElementById(\"overlay\");\n const menuButton = document.getElementById(\"menu\");\n function setDrawer(open) {\n if (drawer) drawer.classList.toggle(\"open\", open);\n if (overlay) overlay.classList.toggle(\"on\", open);\n }\n if (menuButton) {\n menuButton.addEventListener(\"click\", function () {\n setDrawer(!(drawer && drawer.classList.contains(\"open\")));\n });\n }\n if (overlay) {\n overlay.addEventListener(\"click\", function () {\n setDrawer(false);\n });\n }\n if (drawer) {\n drawer.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"a\")) {\n setDrawer(false);\n }\n });\n }\n\n startPalette();\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest ? ev.target.closest(\"[data-copy]\") : null;\n if (!btn) return;\n const box = btn.closest(\".code\");\n const span = box && box.querySelector(\"span:not(.lbl)\");\n if (!span) return;\n ev.preventDefault();\n copyText(\n span.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-copy-doc]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n const id = btn.getAttribute(\"data-copy-doc\");\n const sources = document.querySelectorAll(\"[data-doc-source]\");\n let source = null;\n for (let index = 0; index < sources.length; index++) {\n if (sources[index].getAttribute(\"data-doc-source\") === id) {\n source = sources[index];\n break;\n }\n }\n if (!source) return;\n copyText(\n source.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-cancel], [data-post]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n if (btn.hasAttribute(\"data-cancel\")) {\n postAndGo(\n \"/api/jobs/\" + btn.getAttribute(\"data-cancel\") + \"/cancel\",\n {},\n \"/activity\",\n btn,\n );\n return;\n }\n const body = btn.getAttribute(\"data-body\");\n postAndGo(\n btn.getAttribute(\"data-post\"),\n body ? JSON.parse(body) : {},\n \"/activity\",\n btn,\n );\n });\n\n // Reads `activity-root` at call time, so it has to wait for the body even\n // though this file itself is already parsed.\n startLogPanels();\n if (!document.getElementById(\"activity-root\")) return;\n const jobPanel = document.querySelector(\"[data-log]\");\n if (jobPanel) {\n if (jobPanel.getAttribute(\"data-live\") !== \"1\") return;\n const progress = document.querySelector(\"[data-job-progress]\");\n if (!progress) return;\n const refreshError = document.querySelector(\"[data-job-refresh-error]\");\n let refreshing = false;\n const refreshJob = async function () {\n if (document.hidden || refreshing) return;\n refreshing = true;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n cache: \"no-store\",\n });\n if (!res.ok) throw new Error(\"refresh failed\");\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.querySelector(\"[data-job-progress]\");\n // A finished job renders its result page, which has no progress\n // block: load it rather than keep the running stages and Stop.\n if (!next) {\n location.reload();\n return;\n }\n progress.innerHTML = next.innerHTML;\n if (refreshError) {\n refreshError.textContent = \"\";\n refreshError.hidden = true;\n }\n } catch {\n if (refreshError) {\n refreshError.textContent =\n \"Connection lost. Could not refresh this job. Reconnecting...\";\n refreshError.hidden = false;\n }\n } finally {\n refreshing = false;\n }\n };\n setInterval(refreshJob, 2000);\n return;\n }\n setInterval(async function () {\n if (document.hidden) return;\n if (document.querySelector(\"[data-async].busy\")) return;\n const root = document.getElementById(\"activity-root\");\n if (!root) return;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n });\n if (!res.ok) return;\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.getElementById(\"activity-root\");\n if (!next || next.innerHTML === root.innerHTML) return;\n root.replaceWith(next);\n } catch {\n // a failed poll just waits for the next tick\n }\n }, 5000);\n});\n";
|
|
1
|
+
/** Generated from src/server/pages/client.js by scripts/embed_assets.mjs, do not edit. */
|
|
2
|
+
export declare const client = "function toast(message) {\n const host = document.getElementById(\"toasts\");\n if (!host) return;\n const el = document.createElement(\"div\");\n el.className = \"toast\";\n el.setAttribute(\"role\", \"status\");\n el.textContent = message;\n host.appendChild(el);\n setTimeout(function () {\n el.remove();\n }, 5000);\n}\n\nfunction fail(card, message, retry) {\n toast(message);\n if (!card) return;\n let box = card.querySelector(\"[data-fail]\");\n if (!box) {\n box = document.createElement(\"div\");\n box.setAttribute(\"data-fail\", \"1\");\n box.className = \"fail\";\n card.appendChild(box);\n }\n box.replaceChildren();\n const p = document.createElement(\"p\");\n p.textContent = message;\n const btn = document.createElement(\"button\");\n btn.className = \"btn sm\";\n btn.type = \"button\";\n btn.textContent = \"Retry\";\n btn.addEventListener(\"click\", retry);\n box.appendChild(p);\n box.appendChild(btn);\n}\n\nfunction clearFail(card) {\n const box = card && card.querySelector(\"[data-fail]\");\n if (box) box.remove();\n}\n\n/** Copy text for the `codeBlock` copy button. `navigator.clipboard` needs a\n * secure context, so the hidden-textarea path keeps Copy working on plain\n * http://localhost too. `done` runs only when one of the two paths worked. */\nfunction copyText(value, done, failed) {\n function fallback() {\n if (legacyCopy(value)) done();\n else if (failed) failed();\n }\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(value).then(done, fallback);\n return;\n }\n fallback();\n}\n\nfunction legacyCopy(value) {\n const area = document.createElement(\"textarea\");\n area.value = value;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\") === true;\n } catch {\n copied = false;\n }\n area.remove();\n return copied;\n}\n\nfunction skeleton(card, on) {\n if (!card) return;\n card.classList.toggle(\"busy\", on);\n}\n\nasync function api(method, url, body) {\n const res = await fetch(url, {\n method: method,\n headers: {\n \"content-type\": \"application/json\",\n \"x-requested-with\": \"co-maintainer\",\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!res.ok) {\n let message = \"Request failed\";\n let code = \"\";\n let detail;\n try {\n const data = await res.json();\n if (data.error && data.error.message) message = data.error.message;\n if (data.error && data.error.code) code = data.error.code;\n if (data.error) detail = data.error.detail;\n } catch {\n // body was not JSON. Keep the generic message\n }\n const error = new Error(message);\n if (code) error.code = code;\n error.detail = detail;\n throw error;\n }\n if (res.status === 204) return null;\n return await res.json();\n}\n\nasync function run(btn, card, fn) {\n if (btn) btn.disabled = true;\n skeleton(card, true);\n clearFail(card);\n try {\n await fn();\n } catch (err) {\n fail(card, err.message, function () {\n run(btn, card, fn);\n });\n } finally {\n if (btn) btn.disabled = false;\n skeleton(card, false);\n }\n}\n\nfunction saved(btn, card) {\n if (card) {\n let state = card.querySelector(\".save-state\");\n if (!state) {\n state = document.createElement(\"span\");\n state.className = \"save-state\";\n state.setAttribute(\"role\", \"status\");\n if (btn && btn.parentNode) {\n btn.parentNode.insertBefore(state, btn.nextSibling);\n }\n }\n state.textContent = \"Saved\";\n }\n toast(\"Saved\");\n}\nglobalThis.saved = saved;\n\n/** Polls one job until it reaches a terminal status. A running `init`/`remake`\n * ignores the abort signal, so \"wait for the sync\" is the only honest option\n * the clear pages can offer for it. */\nfunction waitForJob(id) {\n return new Promise(function (resolve, reject) {\n let attempts = 0;\n async function tick() {\n attempts++;\n try {\n const res = await fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n });\n if (!res.ok) throw new Error(\"Could not check the running job.\");\n const job = await res.json();\n if (job.status !== \"running\" && job.status !== \"queued\") {\n resolve();\n return;\n }\n if (attempts > 1200) {\n reject(new Error(\"The sync did not finish.\"));\n return;\n }\n setTimeout(tick, 3000);\n } catch (err) {\n reject(err);\n }\n }\n tick();\n });\n}\n\n/** Clears knowledge, asking about pending jobs when the server refuses.\n * Returns false when the user backed out, so the caller does not reload.\n * A running review is abortable and a running setup is not, which is the\n * difference between the two questions. Called from the inline scripts on the\n * knowledge pages, so it looks unused from inside this file. */\n// oxlint-disable-next-line no-unused-vars\nasync function clearKnowledge(url, includeCache) {\n const target = includeCache ? url + \"?includeCache=1\" : url;\n const retry = target.indexOf(\"?\") >= 0 ? \"&\" : \"?\";\n try {\n await api(\"DELETE\", target);\n } catch (err) {\n if (err.code !== \"jobs_running\") throw err;\n const detail = err.detail || { queued: 0, running: [] };\n const running = detail.running || [];\n const setup = running.find(function (job) {\n return job.abortable === false;\n });\n if (setup) {\n if (\n !confirm(\n \"A sync is running and cannot be stopped. Wait for it to finish and then clear?\",\n )\n ) {\n return false;\n }\n await waitForJob(setup.id);\n await api(\"DELETE\", target);\n return;\n }\n const parts = [];\n if (running.length) parts.push(running.length + \" running review(s)\");\n if (detail.queued) parts.push(detail.queued + \" queued job(s)\");\n if (!confirm(\"Stop \" + parts.join(\" and \") + \" and clear?\")) return false;\n try {\n await api(\"DELETE\", target + retry + \"onRunning=abort\");\n } catch (retryError) {\n // A setup job was claimed between the first 409 and this retry. It\n // cannot be aborted, so wait it out like the branch above.\n if (retryError.code !== \"job_not_abortable\") throw retryError;\n const jobId = retryError.detail && retryError.detail.id;\n if (jobId) await waitForJob(jobId);\n await api(\"DELETE\", target);\n }\n }\n}\n\nasync function postAndGo(url, body, next, btn) {\n const card = btn && btn.closest(\"[data-async]\");\n await run(btn, card, async function () {\n await api(\"POST\", url, body);\n location.href = next;\n });\n}\n\n// Called from the inline scripts on the repo list and repo pages, which deno lint\n// cannot see, so it looks unused from inside this file.\n// deno-lint-ignore no-unused-vars\n// oxlint-disable-next-line no-unused-vars\nfunction bindToggle(btn, url, field) {\n btn.addEventListener(\"click\", async function () {\n if (btn.disabled) return;\n const on = !btn.classList.contains(\"on\");\n btn.classList.toggle(\"on\", on);\n btn.setAttribute(\"data-on\", on ? \"1\" : \"0\");\n btn.disabled = true;\n const card = btn.closest(\"[data-async]\");\n try {\n const payload = {};\n payload[field] = on;\n await api(\"PATCH\", url, payload);\n } catch (err) {\n btn.classList.toggle(\"on\", !on);\n btn.setAttribute(\"data-on\", on ? \"0\" : \"1\");\n fail(card, err.message, function () {\n btn.click();\n });\n } finally {\n btn.disabled = false;\n }\n });\n}\n\nfunction logLevelClass(level) {\n return [\"info\", \"dim\", \"ok\", \"warn\", \"error\"].indexOf(level) >= 0\n ? level\n : \"info\";\n}\n\nfunction logClock(at) {\n const date = new Date(at);\n if (isNaN(date.getTime())) return \"--:--:--\";\n return date.toTimeString().slice(0, 8);\n}\n\n/** One append-only log panel. The rendered lines are the starting point, the\n * SSE stream resumes after their last seq, and a slow poll catches lines\n * written by another process (the CLI or a direct database write). */\nfunction startLogPanel(panel) {\n if (panel.getAttribute(\"data-started\") === \"1\") return;\n panel.setAttribute(\"data-started\", \"1\");\n const log = panel.querySelector(\".log\");\n if (!log) return;\n const jump = panel.querySelector(\"[data-log-jump]\");\n const jumpN = jump && jump.querySelector(\"span\");\n const count = panel.querySelector(\".cnt\");\n const pause = panel.querySelector(\"[data-log-pause]\");\n const clear = panel.querySelector(\"[data-log-clear]\");\n const status = panel.querySelector(\".st\");\n const errorBox = panel.querySelector(\"[data-log-error]\");\n const id = panel.getAttribute(\"data-job\") || panel.getAttribute(\"data-log\");\n let live = panel.getAttribute(\"data-live\") === \"1\";\n let baseStatus = live\n ? \"Running\"\n : panel.getAttribute(\"data-status\") || \"Done\";\n let baseClass = live\n ? \"run\"\n : baseStatus === \"Failed\"\n ? \"failed\"\n : baseStatus === \"Not posted\" || baseStatus === \"Canceled\"\n ? \"warn\"\n : \"done\";\n let lines = log.querySelectorAll(\".line\").length;\n let empty = log.querySelector(\".log-empty\");\n let pending = 0;\n let paused = false;\n let buffered = [];\n let lastSeq = Number(panel.getAttribute(\"data-seq\") || 0);\n if (!isFinite(lastSeq)) lastSeq = 0;\n const timers = [];\n let stream = null;\n\n function showEmpty() {\n if (empty) return;\n empty = document.createElement(\"p\");\n empty.className = \"log-empty\";\n empty.textContent =\n \"No log lines yet. New lines appear here as the job runs.\";\n log.appendChild(empty);\n }\n\n function hideEmpty() {\n if (!empty) return;\n empty.remove();\n empty = null;\n }\n\n function setError(message) {\n if (!errorBox) return;\n errorBox.textContent = message;\n errorBox.hidden = false;\n }\n\n function clearError() {\n if (!errorBox) return;\n errorBox.textContent = \"\";\n errorBox.hidden = true;\n }\n\n function atBottom() {\n return log.scrollTop + log.clientHeight >= log.scrollHeight - 4;\n }\n\n function setCount() {\n if (!count) return;\n count.textContent = lines + (lines === 1 ? \" line\" : \" lines\");\n }\n\n function setJump() {\n if (!jump) return;\n if (pending > 0) {\n if (jumpN) jumpN.textContent = \"(\" + pending + \")\";\n jump.hidden = false;\n } else {\n if (jumpN) jumpN.textContent = \"\";\n jump.hidden = true;\n }\n }\n\n function add(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n const wasAtBottom = atBottom();\n const el = document.createElement(\"div\");\n el.className = \"line lv-\" + logLevelClass(line.level);\n el.setAttribute(\"data-seq\", String(line.seq));\n const t = document.createElement(\"span\");\n t.className = \"t\";\n t.textContent = logClock(line.at);\n const m = document.createElement(\"span\");\n m.className = \"msg\";\n m.textContent = String(line.message || \"\");\n el.appendChild(t);\n el.appendChild(m);\n log.appendChild(el);\n lines += 1;\n lastSeq = line.seq;\n hideEmpty();\n clearError();\n setCount();\n if (wasAtBottom) {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n } else {\n pending += 1;\n setJump();\n }\n }\n\n function receive(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n if (paused) {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq === line.seq) return;\n }\n buffered.push(line);\n return;\n }\n add(line);\n }\n\n function flush() {\n buffered.sort(function (a, b) {\n return a.seq - b.seq;\n });\n for (let index = 0; index < buffered.length; index++) add(buffered[index]);\n buffered = [];\n }\n\n function stopLive() {\n if (stream) {\n const current = stream;\n stream = null;\n try {\n current.abort();\n } catch {\n // the stream was already closed\n }\n }\n for (let index = 0; index < timers.length; index++) {\n clearInterval(timers[index]);\n }\n timers.length = 0;\n }\n\n function setLiveStatus(next) {\n live = false;\n panel.setAttribute(\"data-live\", \"0\");\n baseStatus =\n next === \"failed\" ? \"Failed\" : next === \"canceled\" ? \"Canceled\" : \"Done\";\n baseClass =\n next === \"failed\" ? \"failed\" : next === \"canceled\" ? \"warn\" : \"done\";\n panel.setAttribute(\"data-status\", baseStatus);\n if (!paused && status) {\n status.className = \"st \" + baseClass;\n status.textContent = baseStatus;\n }\n clearError();\n stopLive();\n }\n\n function poll() {\n if (!id) return;\n fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n })\n .then(function (res) {\n if (!res.ok) throw new Error(\"could not poll the job log\");\n return res.json();\n })\n .then(function (job) {\n if (!job) return;\n clearError();\n (job.logs || []).forEach(receive);\n if (job.status !== \"running\" && job.status !== \"queued\") {\n setLiveStatus(job.status);\n }\n })\n .catch(function () {\n if (live) setError(\"Log connection lost. Reconnecting...\");\n });\n }\n\n function connect() {\n if (!id || typeof fetch !== \"function\") return;\n const controller =\n typeof AbortController === \"function\" ? new AbortController() : null;\n stream = controller;\n fetch(\n \"/api/jobs/\" +\n encodeURIComponent(id) +\n \"/logs/stream?from=\" +\n encodeURIComponent(String(lastSeq)),\n {\n headers: {\n accept: \"text/event-stream\",\n \"x-requested-with\": \"co-maintainer\",\n },\n signal: controller ? controller.signal : undefined,\n },\n )\n .then(function (res) {\n if (!res.ok || !res.body || typeof res.body.getReader !== \"function\") {\n setError(\"Log connection lost. Reconnecting...\");\n return;\n }\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n function pump() {\n return reader.read().then(function (chunk) {\n if (chunk.done) return;\n buffer += decoder.decode(chunk.value, { stream: true });\n const frames = buffer.split(\"\\n\\n\");\n buffer = frames.pop() || \"\";\n frames.forEach(function (frame) {\n const data = [];\n frame.split(\"\\n\").forEach(function (line) {\n if (line.indexOf(\"data:\") === 0) {\n data.push(line.slice(5).replace(/^ /, \"\"));\n }\n });\n if (!data.length) return;\n try {\n receive(JSON.parse(data.join(\"\\n\")));\n } catch {\n // a malformed frame is skipped, not fatal\n }\n });\n return pump();\n });\n }\n return pump();\n })\n .catch(function () {\n if (stream === controller) {\n setError(\"Log connection lost. Reconnecting...\");\n }\n });\n }\n\n if (jump) {\n jump.addEventListener(\"click\", function () {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n });\n }\n log.addEventListener(\"scroll\", function () {\n if (atBottom()) {\n pending = 0;\n setJump();\n }\n });\n if (pause) {\n pause.addEventListener(\"click\", function () {\n paused = !paused;\n pause.textContent = paused ? \"Resume\" : \"Pause\";\n if (status) {\n status.className = \"st \" + (paused ? \"paused\" : baseClass);\n status.textContent = paused ? \"Paused\" : baseStatus;\n }\n if (!paused) flush();\n });\n }\n if (clear) {\n clear.addEventListener(\"click\", function () {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq > lastSeq) lastSeq = buffered[index].seq;\n }\n log.replaceChildren();\n lines = 0;\n pending = 0;\n buffered = [];\n showEmpty();\n setCount();\n setJump();\n });\n }\n setCount();\n setJump();\n if (live) {\n connect();\n timers.push(setInterval(poll, 1000));\n }\n}\n\n/** The Ctrl K palette. Every query gets a sequence number and only the\n * newest answer is drawn, so a slow reply to an older query never replaces\n * the results of the newer one. The highlighted row is the one Enter opens. */\nfunction startPalette() {\n const pal = document.getElementById(\"pal\");\n const overlay = document.getElementById(\"pal-ov\");\n const input = document.getElementById(\"pal-q\");\n const list = document.getElementById(\"pal-list\");\n if (!pal || !overlay || !input || !list) return;\n let returnFocus = null;\n let seq = 0;\n let timer = 0;\n let index = 0;\n\n function items() {\n return list.querySelectorAll(\"[data-href]\");\n }\n function highlight(next) {\n const rows = items();\n if (rows.length === 0) return;\n index = (next + rows.length) % rows.length;\n rows.forEach(function (row, i) {\n row.classList.toggle(\"on\", i === index);\n row.setAttribute(\"aria-selected\", i === index ? \"true\" : \"false\");\n });\n input.setAttribute(\"aria-activedescendant\", rows[index].id);\n rows[index].scrollIntoView({ block: \"nearest\" });\n }\n function draw(result) {\n list.textContent = \"\";\n if (result.groups.length === 0) {\n const empty = document.createElement(\"div\");\n empty.className = \"none\";\n empty.textContent = \"No results\";\n list.appendChild(empty);\n input.removeAttribute(\"aria-activedescendant\");\n return;\n }\n let n = 0;\n result.groups.forEach(function (group) {\n const label = document.createElement(\"div\");\n label.className = \"gl\";\n label.textContent = group.label;\n list.appendChild(label);\n group.items.forEach(function (item) {\n const row = document.createElement(\"a\");\n row.className = \"it\";\n row.id = \"pal-it-\" + n++;\n row.href = item.href;\n row.setAttribute(\"data-href\", item.href);\n row.setAttribute(\"role\", \"option\");\n row.setAttribute(\"aria-selected\", \"false\");\n const name = document.createElement(\"span\");\n name.className = \"lbl\";\n name.textContent = item.label;\n row.innerHTML =\n '<svg class=\"ic\" aria-hidden=\"true\"><use href=\"#i-' +\n String(item.icon).replace(/[^a-z0-9-]/g, \"\") +\n '\"></use></svg>';\n row.appendChild(name);\n list.appendChild(row);\n });\n });\n highlight(0);\n }\n async function search() {\n const mine = ++seq;\n pal.setAttribute(\"data-loading\", \"\");\n try {\n const res = await fetch(\n \"/api/search?q=\" + encodeURIComponent(input.value),\n { headers: { \"x-requested-with\": \"co-maintainer\" } },\n );\n const result = await res.json();\n if (mine !== seq) return;\n draw(res.ok ? result : { groups: [] });\n } catch {\n if (mine === seq) draw({ groups: [] });\n } finally {\n if (mine === seq) pal.removeAttribute(\"data-loading\");\n }\n }\n function open() {\n if (!pal.hidden) return;\n returnFocus = document.activeElement;\n pal.hidden = false;\n overlay.hidden = false;\n input.value = \"\";\n input.focus();\n search();\n }\n function close() {\n if (pal.hidden) return;\n pal.hidden = true;\n overlay.hidden = true;\n seq++;\n pal.removeAttribute(\"data-loading\");\n if (returnFocus && returnFocus.focus) returnFocus.focus();\n }\n\n document.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"[data-palette]\")) {\n ev.preventDefault();\n open();\n }\n });\n overlay.addEventListener(\"click\", close);\n document.addEventListener(\"keydown\", function (ev) {\n if ((ev.ctrlKey || ev.metaKey) && ev.key.toLowerCase() === \"k\") {\n ev.preventDefault();\n if (pal.hidden) open();\n else close();\n return;\n }\n if (pal.hidden) return;\n if (ev.key === \"Escape\") {\n ev.preventDefault();\n close();\n } else if (ev.key === \"ArrowDown\") {\n ev.preventDefault();\n highlight(index + 1);\n } else if (ev.key === \"ArrowUp\") {\n ev.preventDefault();\n highlight(index - 1);\n } else if (ev.key === \"Enter\" && ev.target === input) {\n const row = items()[index];\n if (row && !pal.hasAttribute(\"data-loading\")) {\n ev.preventDefault();\n location.href = row.getAttribute(\"data-href\");\n }\n }\n });\n input.addEventListener(\"input\", function () {\n clearTimeout(timer);\n pal.setAttribute(\"data-loading\", \"\");\n timer = setTimeout(search, 120);\n });\n}\n\nfunction startLogPanels() {\n const panels = document.querySelectorAll(\"[data-log]\");\n for (let index = 0; index < panels.length; index++) {\n startLogPanel(panels[index]);\n }\n}\n\n// The helper is inlined into `<head>` by `layout.ts`, before any page script\n// runs, so this is the one place that can close over both `toast()` and\n// `bindToggle` without depending on point-in-time globals.\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n // Client errors bubble to `window` from `document`.\n addEventListener(\"error\", function (ev) {\n toast((ev.error && ev.error.message) || \"Something broke\");\n });\n addEventListener(\"unhandledrejection\", function (ev) {\n toast((ev.reason && ev.reason.message) || \"Something broke\");\n });\n\n // Theme: the head bootstrap already applied the remembered choice. This only\n // flips it and stores the new one.\n const themeButton = document.getElementById(\"theme\");\n if (themeButton) {\n themeButton.addEventListener(\"click\", function () {\n const dark = document.documentElement.classList.toggle(\"dark\");\n try {\n localStorage.setItem(\"theme\", dark ? \"dark\" : \"light\");\n } catch {\n // storage may be unavailable. The class still applies for this page\n }\n });\n }\n\n // Mobile drawer. `open` on the aside slides it in. The overlay closes it and\n // choosing a link closes it before navigating.\n const drawer = document.querySelector(\"aside.side\");\n const overlay = document.getElementById(\"overlay\");\n const menuButton = document.getElementById(\"menu\");\n function setDrawer(open) {\n if (drawer) drawer.classList.toggle(\"open\", open);\n if (overlay) overlay.classList.toggle(\"on\", open);\n }\n if (menuButton) {\n menuButton.addEventListener(\"click\", function () {\n setDrawer(!(drawer && drawer.classList.contains(\"open\")));\n });\n }\n if (overlay) {\n overlay.addEventListener(\"click\", function () {\n setDrawer(false);\n });\n }\n if (drawer) {\n drawer.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"a\")) {\n setDrawer(false);\n }\n });\n }\n\n startPalette();\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest ? ev.target.closest(\"[data-copy]\") : null;\n if (!btn) return;\n const box = btn.closest(\".code\");\n const span = box && box.querySelector(\"span:not(.lbl)\");\n if (!span) return;\n ev.preventDefault();\n copyText(\n span.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-copy-doc]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n const id = btn.getAttribute(\"data-copy-doc\");\n const sources = document.querySelectorAll(\"[data-doc-source]\");\n let source = null;\n for (let index = 0; index < sources.length; index++) {\n if (sources[index].getAttribute(\"data-doc-source\") === id) {\n source = sources[index];\n break;\n }\n }\n if (!source) return;\n copyText(\n source.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-cancel], [data-post]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n if (btn.hasAttribute(\"data-cancel\")) {\n postAndGo(\n \"/api/jobs/\" + btn.getAttribute(\"data-cancel\") + \"/cancel\",\n {},\n \"/activity\",\n btn,\n );\n return;\n }\n const body = btn.getAttribute(\"data-body\");\n postAndGo(\n btn.getAttribute(\"data-post\"),\n body ? JSON.parse(body) : {},\n \"/activity\",\n btn,\n );\n });\n\n // Reads `activity-root` at call time, so it has to wait for the body even\n // though this file itself is already parsed.\n startLogPanels();\n if (!document.getElementById(\"activity-root\")) return;\n const jobPanel = document.querySelector(\"[data-log]\");\n if (jobPanel) {\n if (jobPanel.getAttribute(\"data-live\") !== \"1\") return;\n const progress = document.querySelector(\"[data-job-progress]\");\n if (!progress) return;\n const refreshError = document.querySelector(\"[data-job-refresh-error]\");\n let refreshing = false;\n const refreshJob = async function () {\n if (document.hidden || refreshing) return;\n refreshing = true;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n cache: \"no-store\",\n });\n if (!res.ok) throw new Error(\"refresh failed\");\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.querySelector(\"[data-job-progress]\");\n // A finished job renders its result page, which has no progress\n // block: load it rather than keep the running stages and Stop.\n if (!next) {\n location.reload();\n return;\n }\n progress.innerHTML = next.innerHTML;\n if (refreshError) {\n refreshError.textContent = \"\";\n refreshError.hidden = true;\n }\n } catch {\n if (refreshError) {\n refreshError.textContent =\n \"Connection lost. Could not refresh this job. Reconnecting...\";\n refreshError.hidden = false;\n }\n } finally {\n refreshing = false;\n }\n };\n setInterval(refreshJob, 2000);\n return;\n }\n setInterval(async function () {\n if (document.hidden) return;\n if (document.querySelector(\"[data-async].busy\")) return;\n const root = document.getElementById(\"activity-root\");\n if (!root) return;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n });\n if (!res.ok) return;\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.getElementById(\"activity-root\");\n if (!next || next.innerHTML === root.innerHTML) return;\n root.replaceWith(next);\n } catch {\n // a failed poll just waits for the next tick\n }\n }, 5000);\n});\n";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/** Generated from src/server/pages/client.js by scripts/embed_assets.mjs
|
|
2
|
-
export const client = "function toast(message) {\n const host = document.getElementById(\"toasts\");\n if (!host) return;\n const el = document.createElement(\"div\");\n el.className = \"toast\";\n el.setAttribute(\"role\", \"status\");\n el.textContent = message;\n host.appendChild(el);\n setTimeout(function () {\n el.remove();\n }, 5000);\n}\n\nfunction fail(card, message, retry) {\n toast(message);\n if (!card) return;\n let box = card.querySelector(\"[data-fail]\");\n if (!box) {\n box = document.createElement(\"div\");\n box.setAttribute(\"data-fail\", \"1\");\n box.className = \"fail\";\n card.appendChild(box);\n }\n box.replaceChildren();\n const p = document.createElement(\"p\");\n p.textContent = message;\n const btn = document.createElement(\"button\");\n btn.className = \"btn sm\";\n btn.type = \"button\";\n btn.textContent = \"Retry\";\n btn.addEventListener(\"click\", retry);\n box.appendChild(p);\n box.appendChild(btn);\n}\n\nfunction clearFail(card) {\n const box = card && card.querySelector(\"[data-fail]\");\n if (box) box.remove();\n}\n\n/** Copy text for the `codeBlock` copy button. `navigator.clipboard` needs a\n * secure context, so the hidden-textarea path keeps Copy working on plain\n * http://localhost too. `done` runs only when one of the two paths worked. */\nfunction copyText(value, done, failed) {\n function fallback() {\n if (legacyCopy(value)) done();\n else if (failed) failed();\n }\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(value).then(done, fallback);\n return;\n }\n fallback();\n}\n\nfunction legacyCopy(value) {\n const area = document.createElement(\"textarea\");\n area.value = value;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\") === true;\n } catch {\n copied = false;\n }\n area.remove();\n return copied;\n}\n\nfunction skeleton(card, on) {\n if (!card) return;\n card.classList.toggle(\"busy\", on);\n}\n\nasync function api(method, url, body) {\n const res = await fetch(url, {\n method: method,\n headers: {\n \"content-type\": \"application/json\",\n \"x-requested-with\": \"co-maintainer\",\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!res.ok) {\n let message = \"Request failed\";\n let code = \"\";\n let detail;\n try {\n const data = await res.json();\n if (data.error && data.error.message) message = data.error.message;\n if (data.error && data.error.code) code = data.error.code;\n if (data.error) detail = data.error.detail;\n } catch {\n // body was not JSON; keep the generic message\n }\n const error = new Error(message);\n if (code) error.code = code;\n error.detail = detail;\n throw error;\n }\n if (res.status === 204) return null;\n return await res.json();\n}\n\nasync function run(btn, card, fn) {\n if (btn) btn.disabled = true;\n skeleton(card, true);\n clearFail(card);\n try {\n await fn();\n } catch (err) {\n fail(card, err.message, function () {\n run(btn, card, fn);\n });\n } finally {\n if (btn) btn.disabled = false;\n skeleton(card, false);\n }\n}\n\nfunction saved(btn, card) {\n if (card) {\n let state = card.querySelector(\".save-state\");\n if (!state) {\n state = document.createElement(\"span\");\n state.className = \"save-state\";\n state.setAttribute(\"role\", \"status\");\n if (btn && btn.parentNode) {\n btn.parentNode.insertBefore(state, btn.nextSibling);\n }\n }\n state.textContent = \"Saved\";\n }\n toast(\"Saved\");\n}\nglobalThis.saved = saved;\n\n/** Polls one job until it reaches a terminal status. A running `init`/`remake`\n * ignores the abort signal, so \"wait for the sync\" is the only honest option\n * the clear pages can offer for it. */\nfunction waitForJob(id) {\n return new Promise(function (resolve, reject) {\n let attempts = 0;\n async function tick() {\n attempts++;\n try {\n const res = await fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n });\n if (!res.ok) throw new Error(\"Could not check the running job.\");\n const job = await res.json();\n if (job.status !== \"running\" && job.status !== \"queued\") {\n resolve();\n return;\n }\n if (attempts > 1200) {\n reject(new Error(\"The sync did not finish.\"));\n return;\n }\n setTimeout(tick, 3000);\n } catch (err) {\n reject(err);\n }\n }\n tick();\n });\n}\n\n/** Clears knowledge, asking about pending jobs when the server refuses.\n * Returns false when the user backed out, so the caller does not reload.\n * A running review is abortable and a running setup is not, which is the\n * difference between the two questions. Called from the inline scripts on the\n * knowledge pages, so it looks unused from inside this file. */\n// oxlint-disable-next-line no-unused-vars\nasync function clearKnowledge(url, includeCache) {\n const target = includeCache ? url + \"?includeCache=1\" : url;\n const retry = target.indexOf(\"?\") >= 0 ? \"&\" : \"?\";\n try {\n await api(\"DELETE\", target);\n } catch (err) {\n if (err.code !== \"jobs_running\") throw err;\n const detail = err.detail || { queued: 0, running: [] };\n const running = detail.running || [];\n const setup = running.find(function (job) {\n return job.abortable === false;\n });\n if (setup) {\n if (\n !confirm(\n \"A sync is running and cannot be stopped. Wait for it to finish and then clear?\",\n )\n ) {\n return false;\n }\n await waitForJob(setup.id);\n await api(\"DELETE\", target);\n return;\n }\n const parts = [];\n if (running.length) parts.push(running.length + \" running review(s)\");\n if (detail.queued) parts.push(detail.queued + \" queued job(s)\");\n if (!confirm(\"Stop \" + parts.join(\" and \") + \" and clear?\")) return false;\n try {\n await api(\"DELETE\", target + retry + \"onRunning=abort\");\n } catch (retryError) {\n // A setup job was claimed between the first 409 and this retry. It\n // cannot be aborted, so wait it out like the branch above.\n if (retryError.code !== \"job_not_abortable\") throw retryError;\n const jobId = retryError.detail && retryError.detail.id;\n if (jobId) await waitForJob(jobId);\n await api(\"DELETE\", target);\n }\n }\n}\n\nasync function postAndGo(url, body, next, btn) {\n const card = btn && btn.closest(\"[data-async]\");\n await run(btn, card, async function () {\n await api(\"POST\", url, body);\n location.href = next;\n });\n}\n\n// Called from the inline scripts on the repo list and repo pages, which deno lint\n// cannot see, so it looks unused from inside this file.\n// deno-lint-ignore no-unused-vars\n// oxlint-disable-next-line no-unused-vars\nfunction bindToggle(btn, url, field) {\n btn.addEventListener(\"click\", async function () {\n if (btn.disabled) return;\n const on = !btn.classList.contains(\"on\");\n btn.classList.toggle(\"on\", on);\n btn.setAttribute(\"data-on\", on ? \"1\" : \"0\");\n btn.disabled = true;\n const card = btn.closest(\"[data-async]\");\n try {\n const payload = {};\n payload[field] = on;\n await api(\"PATCH\", url, payload);\n } catch (err) {\n btn.classList.toggle(\"on\", !on);\n btn.setAttribute(\"data-on\", on ? \"0\" : \"1\");\n fail(card, err.message, function () {\n btn.click();\n });\n } finally {\n btn.disabled = false;\n }\n });\n}\n\nfunction logLevelClass(level) {\n return [\"info\", \"dim\", \"ok\", \"warn\", \"error\"].indexOf(level) >= 0\n ? level\n : \"info\";\n}\n\nfunction logClock(at) {\n const date = new Date(at);\n if (isNaN(date.getTime())) return \"--:--:--\";\n return date.toTimeString().slice(0, 8);\n}\n\n/** One append-only log panel. The rendered lines are the starting point, the\n * SSE stream resumes after their last seq, and a slow poll catches lines\n * written by another process (the CLI or a direct database write). */\nfunction startLogPanel(panel) {\n if (panel.getAttribute(\"data-started\") === \"1\") return;\n panel.setAttribute(\"data-started\", \"1\");\n const log = panel.querySelector(\".log\");\n if (!log) return;\n const jump = panel.querySelector(\"[data-log-jump]\");\n const jumpN = jump && jump.querySelector(\"span\");\n const count = panel.querySelector(\".cnt\");\n const pause = panel.querySelector(\"[data-log-pause]\");\n const clear = panel.querySelector(\"[data-log-clear]\");\n const status = panel.querySelector(\".st\");\n const errorBox = panel.querySelector(\"[data-log-error]\");\n const id = panel.getAttribute(\"data-job\") || panel.getAttribute(\"data-log\");\n let live = panel.getAttribute(\"data-live\") === \"1\";\n let baseStatus = live\n ? \"Running\"\n : panel.getAttribute(\"data-status\") || \"Done\";\n let baseClass = live\n ? \"run\"\n : baseStatus === \"Failed\"\n ? \"failed\"\n : baseStatus === \"Not posted\" || baseStatus === \"Canceled\"\n ? \"warn\"\n : \"done\";\n let lines = log.querySelectorAll(\".line\").length;\n let empty = log.querySelector(\".log-empty\");\n let pending = 0;\n let paused = false;\n let buffered = [];\n let lastSeq = Number(panel.getAttribute(\"data-seq\") || 0);\n if (!isFinite(lastSeq)) lastSeq = 0;\n const timers = [];\n let stream = null;\n\n function showEmpty() {\n if (empty) return;\n empty = document.createElement(\"p\");\n empty.className = \"log-empty\";\n empty.textContent =\n \"No log lines yet. New lines appear here as the job runs.\";\n log.appendChild(empty);\n }\n\n function hideEmpty() {\n if (!empty) return;\n empty.remove();\n empty = null;\n }\n\n function setError(message) {\n if (!errorBox) return;\n errorBox.textContent = message;\n errorBox.hidden = false;\n }\n\n function clearError() {\n if (!errorBox) return;\n errorBox.textContent = \"\";\n errorBox.hidden = true;\n }\n\n function atBottom() {\n return log.scrollTop + log.clientHeight >= log.scrollHeight - 4;\n }\n\n function setCount() {\n if (!count) return;\n count.textContent = lines + (lines === 1 ? \" line\" : \" lines\");\n }\n\n function setJump() {\n if (!jump) return;\n if (pending > 0) {\n if (jumpN) jumpN.textContent = \"(\" + pending + \")\";\n jump.hidden = false;\n } else {\n if (jumpN) jumpN.textContent = \"\";\n jump.hidden = true;\n }\n }\n\n function add(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n const wasAtBottom = atBottom();\n const el = document.createElement(\"div\");\n el.className = \"line lv-\" + logLevelClass(line.level);\n el.setAttribute(\"data-seq\", String(line.seq));\n const t = document.createElement(\"span\");\n t.className = \"t\";\n t.textContent = logClock(line.at);\n const m = document.createElement(\"span\");\n m.className = \"msg\";\n m.textContent = String(line.message || \"\");\n el.appendChild(t);\n el.appendChild(m);\n log.appendChild(el);\n lines += 1;\n lastSeq = line.seq;\n hideEmpty();\n clearError();\n setCount();\n if (wasAtBottom) {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n } else {\n pending += 1;\n setJump();\n }\n }\n\n function receive(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n if (paused) {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq === line.seq) return;\n }\n buffered.push(line);\n return;\n }\n add(line);\n }\n\n function flush() {\n buffered.sort(function (a, b) {\n return a.seq - b.seq;\n });\n for (let index = 0; index < buffered.length; index++) add(buffered[index]);\n buffered = [];\n }\n\n function stopLive() {\n if (stream) {\n const current = stream;\n stream = null;\n try {\n current.abort();\n } catch {\n // the stream was already closed\n }\n }\n for (let index = 0; index < timers.length; index++) {\n clearInterval(timers[index]);\n }\n timers.length = 0;\n }\n\n function setLiveStatus(next) {\n live = false;\n panel.setAttribute(\"data-live\", \"0\");\n baseStatus =\n next === \"failed\" ? \"Failed\" : next === \"canceled\" ? \"Canceled\" : \"Done\";\n baseClass =\n next === \"failed\" ? \"failed\" : next === \"canceled\" ? \"warn\" : \"done\";\n panel.setAttribute(\"data-status\", baseStatus);\n if (!paused && status) {\n status.className = \"st \" + baseClass;\n status.textContent = baseStatus;\n }\n clearError();\n stopLive();\n }\n\n function poll() {\n if (!id) return;\n fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n })\n .then(function (res) {\n if (!res.ok) throw new Error(\"could not poll the job log\");\n return res.json();\n })\n .then(function (job) {\n if (!job) return;\n clearError();\n (job.logs || []).forEach(receive);\n if (job.status !== \"running\" && job.status !== \"queued\") {\n setLiveStatus(job.status);\n }\n })\n .catch(function () {\n if (live) setError(\"Log connection lost. Reconnecting...\");\n });\n }\n\n function connect() {\n if (!id || typeof fetch !== \"function\") return;\n const controller =\n typeof AbortController === \"function\" ? new AbortController() : null;\n stream = controller;\n fetch(\n \"/api/jobs/\" +\n encodeURIComponent(id) +\n \"/logs/stream?from=\" +\n encodeURIComponent(String(lastSeq)),\n {\n headers: {\n accept: \"text/event-stream\",\n \"x-requested-with\": \"co-maintainer\",\n },\n signal: controller ? controller.signal : undefined,\n },\n )\n .then(function (res) {\n if (!res.ok || !res.body || typeof res.body.getReader !== \"function\") {\n setError(\"Log connection lost. Reconnecting...\");\n return;\n }\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n function pump() {\n return reader.read().then(function (chunk) {\n if (chunk.done) return;\n buffer += decoder.decode(chunk.value, { stream: true });\n const frames = buffer.split(\"\\n\\n\");\n buffer = frames.pop() || \"\";\n frames.forEach(function (frame) {\n const data = [];\n frame.split(\"\\n\").forEach(function (line) {\n if (line.indexOf(\"data:\") === 0) {\n data.push(line.slice(5).replace(/^ /, \"\"));\n }\n });\n if (!data.length) return;\n try {\n receive(JSON.parse(data.join(\"\\n\")));\n } catch {\n // a malformed frame is skipped, not fatal\n }\n });\n return pump();\n });\n }\n return pump();\n })\n .catch(function () {\n if (stream === controller) {\n setError(\"Log connection lost. Reconnecting...\");\n }\n });\n }\n\n if (jump) {\n jump.addEventListener(\"click\", function () {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n });\n }\n log.addEventListener(\"scroll\", function () {\n if (atBottom()) {\n pending = 0;\n setJump();\n }\n });\n if (pause) {\n pause.addEventListener(\"click\", function () {\n paused = !paused;\n pause.textContent = paused ? \"Resume\" : \"Pause\";\n if (status) {\n status.className = \"st \" + (paused ? \"paused\" : baseClass);\n status.textContent = paused ? \"Paused\" : baseStatus;\n }\n if (!paused) flush();\n });\n }\n if (clear) {\n clear.addEventListener(\"click\", function () {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq > lastSeq) lastSeq = buffered[index].seq;\n }\n log.replaceChildren();\n lines = 0;\n pending = 0;\n buffered = [];\n showEmpty();\n setCount();\n setJump();\n });\n }\n setCount();\n setJump();\n if (live) {\n connect();\n timers.push(setInterval(poll, 1000));\n }\n}\n\n/** The Ctrl K palette. Every query gets a sequence number and only the\n * newest answer is drawn, so a slow reply to an older query never replaces\n * the results of the newer one. The highlighted row is the one Enter opens. */\nfunction startPalette() {\n const pal = document.getElementById(\"pal\");\n const overlay = document.getElementById(\"pal-ov\");\n const input = document.getElementById(\"pal-q\");\n const list = document.getElementById(\"pal-list\");\n if (!pal || !overlay || !input || !list) return;\n let returnFocus = null;\n let seq = 0;\n let timer = 0;\n let index = 0;\n\n function items() {\n return list.querySelectorAll(\"[data-href]\");\n }\n function highlight(next) {\n const rows = items();\n if (rows.length === 0) return;\n index = (next + rows.length) % rows.length;\n rows.forEach(function (row, i) {\n row.classList.toggle(\"on\", i === index);\n row.setAttribute(\"aria-selected\", i === index ? \"true\" : \"false\");\n });\n input.setAttribute(\"aria-activedescendant\", rows[index].id);\n rows[index].scrollIntoView({ block: \"nearest\" });\n }\n function draw(result) {\n list.textContent = \"\";\n if (result.groups.length === 0) {\n const empty = document.createElement(\"div\");\n empty.className = \"none\";\n empty.textContent = \"No results\";\n list.appendChild(empty);\n input.removeAttribute(\"aria-activedescendant\");\n return;\n }\n let n = 0;\n result.groups.forEach(function (group) {\n const label = document.createElement(\"div\");\n label.className = \"gl\";\n label.textContent = group.label;\n list.appendChild(label);\n group.items.forEach(function (item) {\n const row = document.createElement(\"a\");\n row.className = \"it\";\n row.id = \"pal-it-\" + n++;\n row.href = item.href;\n row.setAttribute(\"data-href\", item.href);\n row.setAttribute(\"role\", \"option\");\n row.setAttribute(\"aria-selected\", \"false\");\n const name = document.createElement(\"span\");\n name.className = \"lbl\";\n name.textContent = item.label;\n row.innerHTML =\n '<svg class=\"ic\" aria-hidden=\"true\"><use href=\"#i-' +\n String(item.icon).replace(/[^a-z0-9-]/g, \"\") +\n '\"></use></svg>';\n row.appendChild(name);\n list.appendChild(row);\n });\n });\n highlight(0);\n }\n async function search() {\n const mine = ++seq;\n pal.setAttribute(\"data-loading\", \"\");\n try {\n const res = await fetch(\n \"/api/search?q=\" + encodeURIComponent(input.value),\n { headers: { \"x-requested-with\": \"co-maintainer\" } },\n );\n const result = await res.json();\n if (mine !== seq) return;\n draw(res.ok ? result : { groups: [] });\n } catch {\n if (mine === seq) draw({ groups: [] });\n } finally {\n if (mine === seq) pal.removeAttribute(\"data-loading\");\n }\n }\n function open() {\n if (!pal.hidden) return;\n returnFocus = document.activeElement;\n pal.hidden = false;\n overlay.hidden = false;\n input.value = \"\";\n input.focus();\n search();\n }\n function close() {\n if (pal.hidden) return;\n pal.hidden = true;\n overlay.hidden = true;\n seq++;\n pal.removeAttribute(\"data-loading\");\n if (returnFocus && returnFocus.focus) returnFocus.focus();\n }\n\n document.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"[data-palette]\")) {\n ev.preventDefault();\n open();\n }\n });\n overlay.addEventListener(\"click\", close);\n document.addEventListener(\"keydown\", function (ev) {\n if ((ev.ctrlKey || ev.metaKey) && ev.key.toLowerCase() === \"k\") {\n ev.preventDefault();\n if (pal.hidden) open();\n else close();\n return;\n }\n if (pal.hidden) return;\n if (ev.key === \"Escape\") {\n ev.preventDefault();\n close();\n } else if (ev.key === \"ArrowDown\") {\n ev.preventDefault();\n highlight(index + 1);\n } else if (ev.key === \"ArrowUp\") {\n ev.preventDefault();\n highlight(index - 1);\n } else if (ev.key === \"Enter\" && ev.target === input) {\n const row = items()[index];\n if (row && !pal.hasAttribute(\"data-loading\")) {\n ev.preventDefault();\n location.href = row.getAttribute(\"data-href\");\n }\n }\n });\n input.addEventListener(\"input\", function () {\n clearTimeout(timer);\n pal.setAttribute(\"data-loading\", \"\");\n timer = setTimeout(search, 120);\n });\n}\n\nfunction startLogPanels() {\n const panels = document.querySelectorAll(\"[data-log]\");\n for (let index = 0; index < panels.length; index++) {\n startLogPanel(panels[index]);\n }\n}\n\n// The helper is inlined into `<head>` by `layout.ts`, before any page script\n// runs, so this is the one place that can close over both `toast()` and\n// `bindToggle` without depending on point-in-time globals.\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n // Client errors bubble to `window` from `document`.\n addEventListener(\"error\", function (ev) {\n toast((ev.error && ev.error.message) || \"Something broke\");\n });\n addEventListener(\"unhandledrejection\", function (ev) {\n toast((ev.reason && ev.reason.message) || \"Something broke\");\n });\n\n // Theme: the head bootstrap already applied the remembered choice; this only\n // flips it and stores the new one.\n const themeButton = document.getElementById(\"theme\");\n if (themeButton) {\n themeButton.addEventListener(\"click\", function () {\n const dark = document.documentElement.classList.toggle(\"dark\");\n try {\n localStorage.setItem(\"theme\", dark ? \"dark\" : \"light\");\n } catch {\n // storage may be unavailable; the class still applies for this page\n }\n });\n }\n\n // Mobile drawer. `open` on the aside slides it in; the overlay closes it and\n // choosing a link closes it before navigating.\n const drawer = document.querySelector(\"aside.side\");\n const overlay = document.getElementById(\"overlay\");\n const menuButton = document.getElementById(\"menu\");\n function setDrawer(open) {\n if (drawer) drawer.classList.toggle(\"open\", open);\n if (overlay) overlay.classList.toggle(\"on\", open);\n }\n if (menuButton) {\n menuButton.addEventListener(\"click\", function () {\n setDrawer(!(drawer && drawer.classList.contains(\"open\")));\n });\n }\n if (overlay) {\n overlay.addEventListener(\"click\", function () {\n setDrawer(false);\n });\n }\n if (drawer) {\n drawer.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"a\")) {\n setDrawer(false);\n }\n });\n }\n\n startPalette();\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest ? ev.target.closest(\"[data-copy]\") : null;\n if (!btn) return;\n const box = btn.closest(\".code\");\n const span = box && box.querySelector(\"span:not(.lbl)\");\n if (!span) return;\n ev.preventDefault();\n copyText(\n span.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-copy-doc]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n const id = btn.getAttribute(\"data-copy-doc\");\n const sources = document.querySelectorAll(\"[data-doc-source]\");\n let source = null;\n for (let index = 0; index < sources.length; index++) {\n if (sources[index].getAttribute(\"data-doc-source\") === id) {\n source = sources[index];\n break;\n }\n }\n if (!source) return;\n copyText(\n source.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-cancel], [data-post]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n if (btn.hasAttribute(\"data-cancel\")) {\n postAndGo(\n \"/api/jobs/\" + btn.getAttribute(\"data-cancel\") + \"/cancel\",\n {},\n \"/activity\",\n btn,\n );\n return;\n }\n const body = btn.getAttribute(\"data-body\");\n postAndGo(\n btn.getAttribute(\"data-post\"),\n body ? JSON.parse(body) : {},\n \"/activity\",\n btn,\n );\n });\n\n // Reads `activity-root` at call time, so it has to wait for the body even\n // though this file itself is already parsed.\n startLogPanels();\n if (!document.getElementById(\"activity-root\")) return;\n const jobPanel = document.querySelector(\"[data-log]\");\n if (jobPanel) {\n if (jobPanel.getAttribute(\"data-live\") !== \"1\") return;\n const progress = document.querySelector(\"[data-job-progress]\");\n if (!progress) return;\n const refreshError = document.querySelector(\"[data-job-refresh-error]\");\n let refreshing = false;\n const refreshJob = async function () {\n if (document.hidden || refreshing) return;\n refreshing = true;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n cache: \"no-store\",\n });\n if (!res.ok) throw new Error(\"refresh failed\");\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.querySelector(\"[data-job-progress]\");\n // A finished job renders its result page, which has no progress\n // block: load it rather than keep the running stages and Stop.\n if (!next) {\n location.reload();\n return;\n }\n progress.innerHTML = next.innerHTML;\n if (refreshError) {\n refreshError.textContent = \"\";\n refreshError.hidden = true;\n }\n } catch {\n if (refreshError) {\n refreshError.textContent =\n \"Connection lost. Could not refresh this job. Reconnecting...\";\n refreshError.hidden = false;\n }\n } finally {\n refreshing = false;\n }\n };\n setInterval(refreshJob, 2000);\n return;\n }\n setInterval(async function () {\n if (document.hidden) return;\n if (document.querySelector(\"[data-async].busy\")) return;\n const root = document.getElementById(\"activity-root\");\n if (!root) return;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n });\n if (!res.ok) return;\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.getElementById(\"activity-root\");\n if (!next || next.innerHTML === root.innerHTML) return;\n root.replaceWith(next);\n } catch {\n // a failed poll just waits for the next tick\n }\n }, 5000);\n});\n";
|
|
1
|
+
/** Generated from src/server/pages/client.js by scripts/embed_assets.mjs, do not edit. */
|
|
2
|
+
export const client = "function toast(message) {\n const host = document.getElementById(\"toasts\");\n if (!host) return;\n const el = document.createElement(\"div\");\n el.className = \"toast\";\n el.setAttribute(\"role\", \"status\");\n el.textContent = message;\n host.appendChild(el);\n setTimeout(function () {\n el.remove();\n }, 5000);\n}\n\nfunction fail(card, message, retry) {\n toast(message);\n if (!card) return;\n let box = card.querySelector(\"[data-fail]\");\n if (!box) {\n box = document.createElement(\"div\");\n box.setAttribute(\"data-fail\", \"1\");\n box.className = \"fail\";\n card.appendChild(box);\n }\n box.replaceChildren();\n const p = document.createElement(\"p\");\n p.textContent = message;\n const btn = document.createElement(\"button\");\n btn.className = \"btn sm\";\n btn.type = \"button\";\n btn.textContent = \"Retry\";\n btn.addEventListener(\"click\", retry);\n box.appendChild(p);\n box.appendChild(btn);\n}\n\nfunction clearFail(card) {\n const box = card && card.querySelector(\"[data-fail]\");\n if (box) box.remove();\n}\n\n/** Copy text for the `codeBlock` copy button. `navigator.clipboard` needs a\n * secure context, so the hidden-textarea path keeps Copy working on plain\n * http://localhost too. `done` runs only when one of the two paths worked. */\nfunction copyText(value, done, failed) {\n function fallback() {\n if (legacyCopy(value)) done();\n else if (failed) failed();\n }\n if (navigator.clipboard && navigator.clipboard.writeText) {\n navigator.clipboard.writeText(value).then(done, fallback);\n return;\n }\n fallback();\n}\n\nfunction legacyCopy(value) {\n const area = document.createElement(\"textarea\");\n area.value = value;\n area.setAttribute(\"readonly\", \"\");\n area.style.position = \"fixed\";\n area.style.opacity = \"0\";\n document.body.appendChild(area);\n area.select();\n let copied = false;\n try {\n copied = document.execCommand(\"copy\") === true;\n } catch {\n copied = false;\n }\n area.remove();\n return copied;\n}\n\nfunction skeleton(card, on) {\n if (!card) return;\n card.classList.toggle(\"busy\", on);\n}\n\nasync function api(method, url, body) {\n const res = await fetch(url, {\n method: method,\n headers: {\n \"content-type\": \"application/json\",\n \"x-requested-with\": \"co-maintainer\",\n },\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n if (!res.ok) {\n let message = \"Request failed\";\n let code = \"\";\n let detail;\n try {\n const data = await res.json();\n if (data.error && data.error.message) message = data.error.message;\n if (data.error && data.error.code) code = data.error.code;\n if (data.error) detail = data.error.detail;\n } catch {\n // body was not JSON. Keep the generic message\n }\n const error = new Error(message);\n if (code) error.code = code;\n error.detail = detail;\n throw error;\n }\n if (res.status === 204) return null;\n return await res.json();\n}\n\nasync function run(btn, card, fn) {\n if (btn) btn.disabled = true;\n skeleton(card, true);\n clearFail(card);\n try {\n await fn();\n } catch (err) {\n fail(card, err.message, function () {\n run(btn, card, fn);\n });\n } finally {\n if (btn) btn.disabled = false;\n skeleton(card, false);\n }\n}\n\nfunction saved(btn, card) {\n if (card) {\n let state = card.querySelector(\".save-state\");\n if (!state) {\n state = document.createElement(\"span\");\n state.className = \"save-state\";\n state.setAttribute(\"role\", \"status\");\n if (btn && btn.parentNode) {\n btn.parentNode.insertBefore(state, btn.nextSibling);\n }\n }\n state.textContent = \"Saved\";\n }\n toast(\"Saved\");\n}\nglobalThis.saved = saved;\n\n/** Polls one job until it reaches a terminal status. A running `init`/`remake`\n * ignores the abort signal, so \"wait for the sync\" is the only honest option\n * the clear pages can offer for it. */\nfunction waitForJob(id) {\n return new Promise(function (resolve, reject) {\n let attempts = 0;\n async function tick() {\n attempts++;\n try {\n const res = await fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n });\n if (!res.ok) throw new Error(\"Could not check the running job.\");\n const job = await res.json();\n if (job.status !== \"running\" && job.status !== \"queued\") {\n resolve();\n return;\n }\n if (attempts > 1200) {\n reject(new Error(\"The sync did not finish.\"));\n return;\n }\n setTimeout(tick, 3000);\n } catch (err) {\n reject(err);\n }\n }\n tick();\n });\n}\n\n/** Clears knowledge, asking about pending jobs when the server refuses.\n * Returns false when the user backed out, so the caller does not reload.\n * A running review is abortable and a running setup is not, which is the\n * difference between the two questions. Called from the inline scripts on the\n * knowledge pages, so it looks unused from inside this file. */\n// oxlint-disable-next-line no-unused-vars\nasync function clearKnowledge(url, includeCache) {\n const target = includeCache ? url + \"?includeCache=1\" : url;\n const retry = target.indexOf(\"?\") >= 0 ? \"&\" : \"?\";\n try {\n await api(\"DELETE\", target);\n } catch (err) {\n if (err.code !== \"jobs_running\") throw err;\n const detail = err.detail || { queued: 0, running: [] };\n const running = detail.running || [];\n const setup = running.find(function (job) {\n return job.abortable === false;\n });\n if (setup) {\n if (\n !confirm(\n \"A sync is running and cannot be stopped. Wait for it to finish and then clear?\",\n )\n ) {\n return false;\n }\n await waitForJob(setup.id);\n await api(\"DELETE\", target);\n return;\n }\n const parts = [];\n if (running.length) parts.push(running.length + \" running review(s)\");\n if (detail.queued) parts.push(detail.queued + \" queued job(s)\");\n if (!confirm(\"Stop \" + parts.join(\" and \") + \" and clear?\")) return false;\n try {\n await api(\"DELETE\", target + retry + \"onRunning=abort\");\n } catch (retryError) {\n // A setup job was claimed between the first 409 and this retry. It\n // cannot be aborted, so wait it out like the branch above.\n if (retryError.code !== \"job_not_abortable\") throw retryError;\n const jobId = retryError.detail && retryError.detail.id;\n if (jobId) await waitForJob(jobId);\n await api(\"DELETE\", target);\n }\n }\n}\n\nasync function postAndGo(url, body, next, btn) {\n const card = btn && btn.closest(\"[data-async]\");\n await run(btn, card, async function () {\n await api(\"POST\", url, body);\n location.href = next;\n });\n}\n\n// Called from the inline scripts on the repo list and repo pages, which deno lint\n// cannot see, so it looks unused from inside this file.\n// deno-lint-ignore no-unused-vars\n// oxlint-disable-next-line no-unused-vars\nfunction bindToggle(btn, url, field) {\n btn.addEventListener(\"click\", async function () {\n if (btn.disabled) return;\n const on = !btn.classList.contains(\"on\");\n btn.classList.toggle(\"on\", on);\n btn.setAttribute(\"data-on\", on ? \"1\" : \"0\");\n btn.disabled = true;\n const card = btn.closest(\"[data-async]\");\n try {\n const payload = {};\n payload[field] = on;\n await api(\"PATCH\", url, payload);\n } catch (err) {\n btn.classList.toggle(\"on\", !on);\n btn.setAttribute(\"data-on\", on ? \"0\" : \"1\");\n fail(card, err.message, function () {\n btn.click();\n });\n } finally {\n btn.disabled = false;\n }\n });\n}\n\nfunction logLevelClass(level) {\n return [\"info\", \"dim\", \"ok\", \"warn\", \"error\"].indexOf(level) >= 0\n ? level\n : \"info\";\n}\n\nfunction logClock(at) {\n const date = new Date(at);\n if (isNaN(date.getTime())) return \"--:--:--\";\n return date.toTimeString().slice(0, 8);\n}\n\n/** One append-only log panel. The rendered lines are the starting point, the\n * SSE stream resumes after their last seq, and a slow poll catches lines\n * written by another process (the CLI or a direct database write). */\nfunction startLogPanel(panel) {\n if (panel.getAttribute(\"data-started\") === \"1\") return;\n panel.setAttribute(\"data-started\", \"1\");\n const log = panel.querySelector(\".log\");\n if (!log) return;\n const jump = panel.querySelector(\"[data-log-jump]\");\n const jumpN = jump && jump.querySelector(\"span\");\n const count = panel.querySelector(\".cnt\");\n const pause = panel.querySelector(\"[data-log-pause]\");\n const clear = panel.querySelector(\"[data-log-clear]\");\n const status = panel.querySelector(\".st\");\n const errorBox = panel.querySelector(\"[data-log-error]\");\n const id = panel.getAttribute(\"data-job\") || panel.getAttribute(\"data-log\");\n let live = panel.getAttribute(\"data-live\") === \"1\";\n let baseStatus = live\n ? \"Running\"\n : panel.getAttribute(\"data-status\") || \"Done\";\n let baseClass = live\n ? \"run\"\n : baseStatus === \"Failed\"\n ? \"failed\"\n : baseStatus === \"Not posted\" || baseStatus === \"Canceled\"\n ? \"warn\"\n : \"done\";\n let lines = log.querySelectorAll(\".line\").length;\n let empty = log.querySelector(\".log-empty\");\n let pending = 0;\n let paused = false;\n let buffered = [];\n let lastSeq = Number(panel.getAttribute(\"data-seq\") || 0);\n if (!isFinite(lastSeq)) lastSeq = 0;\n const timers = [];\n let stream = null;\n\n function showEmpty() {\n if (empty) return;\n empty = document.createElement(\"p\");\n empty.className = \"log-empty\";\n empty.textContent =\n \"No log lines yet. New lines appear here as the job runs.\";\n log.appendChild(empty);\n }\n\n function hideEmpty() {\n if (!empty) return;\n empty.remove();\n empty = null;\n }\n\n function setError(message) {\n if (!errorBox) return;\n errorBox.textContent = message;\n errorBox.hidden = false;\n }\n\n function clearError() {\n if (!errorBox) return;\n errorBox.textContent = \"\";\n errorBox.hidden = true;\n }\n\n function atBottom() {\n return log.scrollTop + log.clientHeight >= log.scrollHeight - 4;\n }\n\n function setCount() {\n if (!count) return;\n count.textContent = lines + (lines === 1 ? \" line\" : \" lines\");\n }\n\n function setJump() {\n if (!jump) return;\n if (pending > 0) {\n if (jumpN) jumpN.textContent = \"(\" + pending + \")\";\n jump.hidden = false;\n } else {\n if (jumpN) jumpN.textContent = \"\";\n jump.hidden = true;\n }\n }\n\n function add(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n const wasAtBottom = atBottom();\n const el = document.createElement(\"div\");\n el.className = \"line lv-\" + logLevelClass(line.level);\n el.setAttribute(\"data-seq\", String(line.seq));\n const t = document.createElement(\"span\");\n t.className = \"t\";\n t.textContent = logClock(line.at);\n const m = document.createElement(\"span\");\n m.className = \"msg\";\n m.textContent = String(line.message || \"\");\n el.appendChild(t);\n el.appendChild(m);\n log.appendChild(el);\n lines += 1;\n lastSeq = line.seq;\n hideEmpty();\n clearError();\n setCount();\n if (wasAtBottom) {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n } else {\n pending += 1;\n setJump();\n }\n }\n\n function receive(line) {\n if (!line || typeof line.seq !== \"number\" || line.seq <= lastSeq) return;\n if (paused) {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq === line.seq) return;\n }\n buffered.push(line);\n return;\n }\n add(line);\n }\n\n function flush() {\n buffered.sort(function (a, b) {\n return a.seq - b.seq;\n });\n for (let index = 0; index < buffered.length; index++) add(buffered[index]);\n buffered = [];\n }\n\n function stopLive() {\n if (stream) {\n const current = stream;\n stream = null;\n try {\n current.abort();\n } catch {\n // the stream was already closed\n }\n }\n for (let index = 0; index < timers.length; index++) {\n clearInterval(timers[index]);\n }\n timers.length = 0;\n }\n\n function setLiveStatus(next) {\n live = false;\n panel.setAttribute(\"data-live\", \"0\");\n baseStatus =\n next === \"failed\" ? \"Failed\" : next === \"canceled\" ? \"Canceled\" : \"Done\";\n baseClass =\n next === \"failed\" ? \"failed\" : next === \"canceled\" ? \"warn\" : \"done\";\n panel.setAttribute(\"data-status\", baseStatus);\n if (!paused && status) {\n status.className = \"st \" + baseClass;\n status.textContent = baseStatus;\n }\n clearError();\n stopLive();\n }\n\n function poll() {\n if (!id) return;\n fetch(\"/api/jobs/\" + encodeURIComponent(id), {\n headers: { \"x-requested-with\": \"co-maintainer\" },\n })\n .then(function (res) {\n if (!res.ok) throw new Error(\"could not poll the job log\");\n return res.json();\n })\n .then(function (job) {\n if (!job) return;\n clearError();\n (job.logs || []).forEach(receive);\n if (job.status !== \"running\" && job.status !== \"queued\") {\n setLiveStatus(job.status);\n }\n })\n .catch(function () {\n if (live) setError(\"Log connection lost. Reconnecting...\");\n });\n }\n\n function connect() {\n if (!id || typeof fetch !== \"function\") return;\n const controller =\n typeof AbortController === \"function\" ? new AbortController() : null;\n stream = controller;\n fetch(\n \"/api/jobs/\" +\n encodeURIComponent(id) +\n \"/logs/stream?from=\" +\n encodeURIComponent(String(lastSeq)),\n {\n headers: {\n accept: \"text/event-stream\",\n \"x-requested-with\": \"co-maintainer\",\n },\n signal: controller ? controller.signal : undefined,\n },\n )\n .then(function (res) {\n if (!res.ok || !res.body || typeof res.body.getReader !== \"function\") {\n setError(\"Log connection lost. Reconnecting...\");\n return;\n }\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n function pump() {\n return reader.read().then(function (chunk) {\n if (chunk.done) return;\n buffer += decoder.decode(chunk.value, { stream: true });\n const frames = buffer.split(\"\\n\\n\");\n buffer = frames.pop() || \"\";\n frames.forEach(function (frame) {\n const data = [];\n frame.split(\"\\n\").forEach(function (line) {\n if (line.indexOf(\"data:\") === 0) {\n data.push(line.slice(5).replace(/^ /, \"\"));\n }\n });\n if (!data.length) return;\n try {\n receive(JSON.parse(data.join(\"\\n\")));\n } catch {\n // a malformed frame is skipped, not fatal\n }\n });\n return pump();\n });\n }\n return pump();\n })\n .catch(function () {\n if (stream === controller) {\n setError(\"Log connection lost. Reconnecting...\");\n }\n });\n }\n\n if (jump) {\n jump.addEventListener(\"click\", function () {\n log.scrollTop = log.scrollHeight;\n pending = 0;\n setJump();\n });\n }\n log.addEventListener(\"scroll\", function () {\n if (atBottom()) {\n pending = 0;\n setJump();\n }\n });\n if (pause) {\n pause.addEventListener(\"click\", function () {\n paused = !paused;\n pause.textContent = paused ? \"Resume\" : \"Pause\";\n if (status) {\n status.className = \"st \" + (paused ? \"paused\" : baseClass);\n status.textContent = paused ? \"Paused\" : baseStatus;\n }\n if (!paused) flush();\n });\n }\n if (clear) {\n clear.addEventListener(\"click\", function () {\n for (let index = 0; index < buffered.length; index++) {\n if (buffered[index].seq > lastSeq) lastSeq = buffered[index].seq;\n }\n log.replaceChildren();\n lines = 0;\n pending = 0;\n buffered = [];\n showEmpty();\n setCount();\n setJump();\n });\n }\n setCount();\n setJump();\n if (live) {\n connect();\n timers.push(setInterval(poll, 1000));\n }\n}\n\n/** The Ctrl K palette. Every query gets a sequence number and only the\n * newest answer is drawn, so a slow reply to an older query never replaces\n * the results of the newer one. The highlighted row is the one Enter opens. */\nfunction startPalette() {\n const pal = document.getElementById(\"pal\");\n const overlay = document.getElementById(\"pal-ov\");\n const input = document.getElementById(\"pal-q\");\n const list = document.getElementById(\"pal-list\");\n if (!pal || !overlay || !input || !list) return;\n let returnFocus = null;\n let seq = 0;\n let timer = 0;\n let index = 0;\n\n function items() {\n return list.querySelectorAll(\"[data-href]\");\n }\n function highlight(next) {\n const rows = items();\n if (rows.length === 0) return;\n index = (next + rows.length) % rows.length;\n rows.forEach(function (row, i) {\n row.classList.toggle(\"on\", i === index);\n row.setAttribute(\"aria-selected\", i === index ? \"true\" : \"false\");\n });\n input.setAttribute(\"aria-activedescendant\", rows[index].id);\n rows[index].scrollIntoView({ block: \"nearest\" });\n }\n function draw(result) {\n list.textContent = \"\";\n if (result.groups.length === 0) {\n const empty = document.createElement(\"div\");\n empty.className = \"none\";\n empty.textContent = \"No results\";\n list.appendChild(empty);\n input.removeAttribute(\"aria-activedescendant\");\n return;\n }\n let n = 0;\n result.groups.forEach(function (group) {\n const label = document.createElement(\"div\");\n label.className = \"gl\";\n label.textContent = group.label;\n list.appendChild(label);\n group.items.forEach(function (item) {\n const row = document.createElement(\"a\");\n row.className = \"it\";\n row.id = \"pal-it-\" + n++;\n row.href = item.href;\n row.setAttribute(\"data-href\", item.href);\n row.setAttribute(\"role\", \"option\");\n row.setAttribute(\"aria-selected\", \"false\");\n const name = document.createElement(\"span\");\n name.className = \"lbl\";\n name.textContent = item.label;\n row.innerHTML =\n '<svg class=\"ic\" aria-hidden=\"true\"><use href=\"#i-' +\n String(item.icon).replace(/[^a-z0-9-]/g, \"\") +\n '\"></use></svg>';\n row.appendChild(name);\n list.appendChild(row);\n });\n });\n highlight(0);\n }\n async function search() {\n const mine = ++seq;\n pal.setAttribute(\"data-loading\", \"\");\n try {\n const res = await fetch(\n \"/api/search?q=\" + encodeURIComponent(input.value),\n { headers: { \"x-requested-with\": \"co-maintainer\" } },\n );\n const result = await res.json();\n if (mine !== seq) return;\n draw(res.ok ? result : { groups: [] });\n } catch {\n if (mine === seq) draw({ groups: [] });\n } finally {\n if (mine === seq) pal.removeAttribute(\"data-loading\");\n }\n }\n function open() {\n if (!pal.hidden) return;\n returnFocus = document.activeElement;\n pal.hidden = false;\n overlay.hidden = false;\n input.value = \"\";\n input.focus();\n search();\n }\n function close() {\n if (pal.hidden) return;\n pal.hidden = true;\n overlay.hidden = true;\n seq++;\n pal.removeAttribute(\"data-loading\");\n if (returnFocus && returnFocus.focus) returnFocus.focus();\n }\n\n document.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"[data-palette]\")) {\n ev.preventDefault();\n open();\n }\n });\n overlay.addEventListener(\"click\", close);\n document.addEventListener(\"keydown\", function (ev) {\n if ((ev.ctrlKey || ev.metaKey) && ev.key.toLowerCase() === \"k\") {\n ev.preventDefault();\n if (pal.hidden) open();\n else close();\n return;\n }\n if (pal.hidden) return;\n if (ev.key === \"Escape\") {\n ev.preventDefault();\n close();\n } else if (ev.key === \"ArrowDown\") {\n ev.preventDefault();\n highlight(index + 1);\n } else if (ev.key === \"ArrowUp\") {\n ev.preventDefault();\n highlight(index - 1);\n } else if (ev.key === \"Enter\" && ev.target === input) {\n const row = items()[index];\n if (row && !pal.hasAttribute(\"data-loading\")) {\n ev.preventDefault();\n location.href = row.getAttribute(\"data-href\");\n }\n }\n });\n input.addEventListener(\"input\", function () {\n clearTimeout(timer);\n pal.setAttribute(\"data-loading\", \"\");\n timer = setTimeout(search, 120);\n });\n}\n\nfunction startLogPanels() {\n const panels = document.querySelectorAll(\"[data-log]\");\n for (let index = 0; index < panels.length; index++) {\n startLogPanel(panels[index]);\n }\n}\n\n// The helper is inlined into `<head>` by `layout.ts`, before any page script\n// runs, so this is the one place that can close over both `toast()` and\n// `bindToggle` without depending on point-in-time globals.\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n // Client errors bubble to `window` from `document`.\n addEventListener(\"error\", function (ev) {\n toast((ev.error && ev.error.message) || \"Something broke\");\n });\n addEventListener(\"unhandledrejection\", function (ev) {\n toast((ev.reason && ev.reason.message) || \"Something broke\");\n });\n\n // Theme: the head bootstrap already applied the remembered choice. This only\n // flips it and stores the new one.\n const themeButton = document.getElementById(\"theme\");\n if (themeButton) {\n themeButton.addEventListener(\"click\", function () {\n const dark = document.documentElement.classList.toggle(\"dark\");\n try {\n localStorage.setItem(\"theme\", dark ? \"dark\" : \"light\");\n } catch {\n // storage may be unavailable. The class still applies for this page\n }\n });\n }\n\n // Mobile drawer. `open` on the aside slides it in. The overlay closes it and\n // choosing a link closes it before navigating.\n const drawer = document.querySelector(\"aside.side\");\n const overlay = document.getElementById(\"overlay\");\n const menuButton = document.getElementById(\"menu\");\n function setDrawer(open) {\n if (drawer) drawer.classList.toggle(\"open\", open);\n if (overlay) overlay.classList.toggle(\"on\", open);\n }\n if (menuButton) {\n menuButton.addEventListener(\"click\", function () {\n setDrawer(!(drawer && drawer.classList.contains(\"open\")));\n });\n }\n if (overlay) {\n overlay.addEventListener(\"click\", function () {\n setDrawer(false);\n });\n }\n if (drawer) {\n drawer.addEventListener(\"click\", function (ev) {\n if (ev.target && ev.target.closest && ev.target.closest(\"a\")) {\n setDrawer(false);\n }\n });\n }\n\n startPalette();\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest ? ev.target.closest(\"[data-copy]\") : null;\n if (!btn) return;\n const box = btn.closest(\".code\");\n const span = box && box.querySelector(\"span:not(.lbl)\");\n if (!span) return;\n ev.preventDefault();\n copyText(\n span.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-copy-doc]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n const id = btn.getAttribute(\"data-copy-doc\");\n const sources = document.querySelectorAll(\"[data-doc-source]\");\n let source = null;\n for (let index = 0; index < sources.length; index++) {\n if (sources[index].getAttribute(\"data-doc-source\") === id) {\n source = sources[index];\n break;\n }\n }\n if (!source) return;\n copyText(\n source.textContent || \"\",\n function () {\n toast(\"Copied\");\n },\n function () {\n toast(\"Copy failed. Select the text and copy it by hand.\");\n },\n );\n });\n\n document.addEventListener(\"click\", function (ev) {\n const btn =\n ev.target && ev.target.closest\n ? ev.target.closest(\"[data-cancel], [data-post]\")\n : null;\n if (!btn) return;\n ev.preventDefault();\n if (btn.hasAttribute(\"data-cancel\")) {\n postAndGo(\n \"/api/jobs/\" + btn.getAttribute(\"data-cancel\") + \"/cancel\",\n {},\n \"/activity\",\n btn,\n );\n return;\n }\n const body = btn.getAttribute(\"data-body\");\n postAndGo(\n btn.getAttribute(\"data-post\"),\n body ? JSON.parse(body) : {},\n \"/activity\",\n btn,\n );\n });\n\n // Reads `activity-root` at call time, so it has to wait for the body even\n // though this file itself is already parsed.\n startLogPanels();\n if (!document.getElementById(\"activity-root\")) return;\n const jobPanel = document.querySelector(\"[data-log]\");\n if (jobPanel) {\n if (jobPanel.getAttribute(\"data-live\") !== \"1\") return;\n const progress = document.querySelector(\"[data-job-progress]\");\n if (!progress) return;\n const refreshError = document.querySelector(\"[data-job-refresh-error]\");\n let refreshing = false;\n const refreshJob = async function () {\n if (document.hidden || refreshing) return;\n refreshing = true;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n cache: \"no-store\",\n });\n if (!res.ok) throw new Error(\"refresh failed\");\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.querySelector(\"[data-job-progress]\");\n // A finished job renders its result page, which has no progress\n // block: load it rather than keep the running stages and Stop.\n if (!next) {\n location.reload();\n return;\n }\n progress.innerHTML = next.innerHTML;\n if (refreshError) {\n refreshError.textContent = \"\";\n refreshError.hidden = true;\n }\n } catch {\n if (refreshError) {\n refreshError.textContent =\n \"Connection lost. Could not refresh this job. Reconnecting...\";\n refreshError.hidden = false;\n }\n } finally {\n refreshing = false;\n }\n };\n setInterval(refreshJob, 2000);\n return;\n }\n setInterval(async function () {\n if (document.hidden) return;\n if (document.querySelector(\"[data-async].busy\")) return;\n const root = document.getElementById(\"activity-root\");\n if (!root) return;\n try {\n const res = await fetch(location.pathname + location.search, {\n headers: { accept: \"text/html\" },\n });\n if (!res.ok) return;\n const doc = new DOMParser().parseFromString(\n await res.text(),\n \"text/html\",\n );\n const next = doc.getElementById(\"activity-root\");\n if (!next || next.innerHTML === root.innerHTML) return;\n root.replaceWith(next);\n } catch {\n // a failed poll just waits for the next tick\n }\n }, 5000);\n});\n";
|
|
@@ -21,7 +21,7 @@ export declare function renderHome(username: string, rows: {
|
|
|
21
21
|
failed: number;
|
|
22
22
|
cost: string;
|
|
23
23
|
}[], checklist: SetupItem[],
|
|
24
|
-
/** `rows` is already filtered
|
|
24
|
+
/** `rows` is already filtered, `total` and `reviewing` count every
|
|
25
25
|
* repository so the lead and the tabs do not shrink with the filter. */
|
|
26
26
|
filter: {
|
|
27
27
|
q: string;
|
|
@@ -40,7 +40,7 @@ export function renderLogin(opts) {
|
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
export function renderHome(username, rows, checklist,
|
|
43
|
-
/** `rows` is already filtered
|
|
43
|
+
/** `rows` is already filtered, `total` and `reviewing` count every
|
|
44
44
|
* repository so the lead and the tabs do not shrink with the filter. */
|
|
45
45
|
filter) {
|
|
46
46
|
const lead = filter.total === 0
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Generated from src/server/pages/icons/*.svg by scripts/embed_assets.mjs
|
|
1
|
+
/** Generated from src/server/pages/icons/*.svg by scripts/embed_assets.mjs, do not edit. */
|
|
2
2
|
export declare const iconNames: readonly string[];
|
|
3
3
|
export declare const sprite = "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"position:absolute;width:0;height:0;overflow:hidden\" aria-hidden=\"true\"><symbol id=\"i-activity\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\" /></symbol><symbol id=\"i-arrow-right\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" /></symbol><symbol id=\"i-book-open\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 5v16\" />\n <path d=\"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z\" /></symbol><symbol id=\"i-calendar-clock\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 14v2.2l1.6 1\" />\n <path d=\"M16 2v3\" />\n <path d=\"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338\" />\n <path d=\"M3 9h5.859\" />\n <path d=\"M8 2v3\" />\n <circle cx=\"16\" cy=\"16\" r=\"6\" /></symbol><symbol id=\"i-chart-no-axes-column\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 21v-6\" />\n <path d=\"M12 21V3\" />\n <path d=\"M19 21V9\" /></symbol><symbol id=\"i-check\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\" /></symbol><symbol id=\"i-chevron-right\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m9 18 6-6-6-6\" /></symbol><symbol id=\"i-circle\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" /></symbol><symbol id=\"i-circle-alert\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" /></symbol><symbol id=\"i-circle-check\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m16 9-5.5 5.5L8 12\" /></symbol><symbol id=\"i-circle-pause\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"10\" x2=\"10\" y1=\"15\" y2=\"9\" />\n <line x1=\"14\" x2=\"14\" y1=\"15\" y2=\"9\" /></symbol><symbol id=\"i-circle-x\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m15 9-6 6\" />\n <path d=\"m9 9 6 6\" /></symbol><symbol id=\"i-coins\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13.744 17.736a6 6 0 1 1-7.48-7.48\" />\n <path d=\"M15 6h1v4\" />\n <path d=\"m6.134 14.768.866-.5 2 3.464\" />\n <circle cx=\"16\" cy=\"8\" r=\"6\" /></symbol><symbol id=\"i-copy\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" /></symbol><symbol id=\"i-cpu\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 20v2\" />\n <path d=\"M12 2v2\" />\n <path d=\"M17 20v2\" />\n <path d=\"M17 2v2\" />\n <path d=\"M2 12h2\" />\n <path d=\"M2 17h2\" />\n <path d=\"M2 7h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"M20 17h2\" />\n <path d=\"M20 7h2\" />\n <path d=\"M7 20v2\" />\n <path d=\"M7 2v2\" />\n <rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\" />\n <rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1\" /></symbol><symbol id=\"i-download\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 15V3\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" /></symbol><symbol id=\"i-external-link\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" /></symbol><symbol id=\"i-file-pen\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z\" /></symbol><symbol id=\"i-flag\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528\" /></symbol><symbol id=\"i-flask-conical\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2\" />\n <path d=\"M6.453 15h11.094\" />\n <path d=\"M8.5 2h7\" /></symbol><symbol id=\"i-git-branch\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 6a9 9 0 0 0-9 9V3\" />\n <circle cx=\"18\" cy=\"6\" r=\"3\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" /></symbol><symbol id=\"i-git-pull-request\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"18\" cy=\"18\" r=\"3\" />\n <circle cx=\"6\" cy=\"6\" r=\"3\" />\n <path d=\"M13 6h3a2 2 0 0 1 2 2v7\" />\n <line x1=\"6\" x2=\"6\" y1=\"9\" y2=\"21\" /></symbol><symbol id=\"i-git-pull-request-arrow\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"5\" cy=\"6\" r=\"3\" />\n <path d=\"M5 9v12\" />\n <circle cx=\"19\" cy=\"18\" r=\"3\" />\n <path d=\"m15 9-3-3 3-3\" />\n <path d=\"M12 6h5a2 2 0 0 1 2 2v7\" /></symbol><symbol id=\"i-github\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\" />\n <path d=\"M9 18c-4.51 2-5-2-7-2\" /></symbol><symbol id=\"i-history\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n <path d=\"M12 7v5l4 2\" /></symbol><symbol id=\"i-inbox\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\" />\n <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\" /></symbol><symbol id=\"i-info\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" /></symbol><symbol id=\"i-key-round\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z\" />\n <circle cx=\"16.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\" /></symbol><symbol id=\"i-laptop\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z\" />\n <path d=\"M20.054 15.987H3.946\" /></symbol><symbol id=\"i-layers\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\" />\n <path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\" />\n <path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\" /></symbol><symbol id=\"i-layout-grid\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"7\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\" /></symbol><symbol id=\"i-list\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 5h.01\" />\n <path d=\"M3 12h.01\" />\n <path d=\"M3 19h.01\" />\n <path d=\"M8 5h13\" />\n <path d=\"M8 12h13\" />\n <path d=\"M8 19h13\" /></symbol><symbol id=\"i-list-checks\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 5h8\" />\n <path d=\"M13 12h8\" />\n <path d=\"M13 19h8\" />\n <path d=\"m3 17 2 2 4-4\" />\n <path d=\"m3 7 2 2 4-4\" /></symbol><symbol id=\"i-list-ordered\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 5h10\" />\n <path d=\"M11 12h10\" />\n <path d=\"M11 19h10\" />\n <path d=\"M4 4h1v5\" />\n <path d=\"M4 9h2\" />\n <path d=\"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02\" /></symbol><symbol id=\"i-loader\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2v4\" />\n <path d=\"m16.2 7.8 2.9-2.9\" />\n <path d=\"M18 12h4\" />\n <path d=\"m16.2 16.2 2.9 2.9\" />\n <path d=\"M12 18v4\" />\n <path d=\"m4.9 19.1 2.9-2.9\" />\n <path d=\"M2 12h4\" />\n <path d=\"m4.9 4.9 2.9 2.9\" /></symbol><symbol id=\"i-lock\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" /></symbol><symbol id=\"i-log-out\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m16 17 5-5-5-5\" />\n <path d=\"M21 12H9\" />\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" /></symbol><symbol id=\"i-menu\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 5h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 19h16\" /></symbol><symbol id=\"i-message-square-text\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\" />\n <path d=\"M7 11h10\" />\n <path d=\"M7 15h6\" />\n <path d=\"M7 7h8\" /></symbol><symbol id=\"i-moon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\" /></symbol><symbol id=\"i-octagon-alert\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 16h.01\" />\n <path d=\"M12 8v4\" />\n <path d=\"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\" /></symbol><symbol id=\"i-plus\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" /></symbol><symbol id=\"i-refresh-cw\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M8 16H3v5\" /></symbol><symbol id=\"i-rotate-cw\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" /></symbol><symbol id=\"i-search\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21 21-4.34-4.34\" />\n <circle cx=\"11\" cy=\"11\" r=\"8\" /></symbol><symbol id=\"i-search-x\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m13.5 8.5-5 5\" />\n <path d=\"m8.5 8.5 5 5\" />\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" /></symbol><symbol id=\"i-server\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" /></symbol><symbol id=\"i-settings-2\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 17H5\" />\n <path d=\"M19 7h-9\" />\n <circle cx=\"17\" cy=\"17\" r=\"3\" />\n <circle cx=\"7\" cy=\"7\" r=\"3\" /></symbol><symbol id=\"i-shield-check\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n <path d=\"m9 12 2 2 4-4\" /></symbol><symbol id=\"i-sliders-horizontal\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5H3\" />\n <path d=\"M12 19H3\" />\n <path d=\"M14 3v4\" />\n <path d=\"M16 17v4\" />\n <path d=\"M21 12h-9\" />\n <path d=\"M21 19h-5\" />\n <path d=\"M21 5h-7\" />\n <path d=\"M8 10v4\" />\n <path d=\"M8 12H3\" /></symbol><symbol id=\"i-sparkles\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\" />\n <path d=\"M20 2v4\" />\n <path d=\"M22 4h-4\" />\n <circle cx=\"4\" cy=\"20\" r=\"2\" /></symbol><symbol id=\"i-square\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" /></symbol><symbol id=\"i-terminal\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 19h8\" />\n <path d=\"m4 17 6-6-6-6\" /></symbol><symbol id=\"i-timer\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"10\" x2=\"14\" y1=\"2\" y2=\"2\" />\n <line x1=\"12\" x2=\"15\" y1=\"14\" y2=\"11\" />\n <circle cx=\"12\" cy=\"14\" r=\"8\" /></symbol><symbol id=\"i-triangle-alert\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" /></symbol><symbol id=\"i-users\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <path d=\"M16 3.128a4 4 0 0 1 0 7.744\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" /></symbol><symbol id=\"i-wallet\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" /></symbol><symbol id=\"i-wand-sparkles\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72\" />\n <path d=\"m14 7 3 3\" />\n <path d=\"M5 6v4\" />\n <path d=\"M19 14v4\" />\n <path d=\"M10 2v2\" />\n <path d=\"M7 8H3\" />\n <path d=\"M21 16h-4\" />\n <path d=\"M11 3H9\" /></symbol><symbol id=\"i-webhook\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" /></symbol></svg>";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Generated from src/server/pages/icons/*.svg by scripts/embed_assets.mjs
|
|
1
|
+
/** Generated from src/server/pages/icons/*.svg by scripts/embed_assets.mjs, do not edit. */
|
|
2
2
|
export const iconNames = JSON.parse("[\"activity\",\"arrow-right\",\"book-open\",\"calendar-clock\",\"chart-no-axes-column\",\"check\",\"chevron-right\",\"circle\",\"circle-alert\",\"circle-check\",\"circle-pause\",\"circle-x\",\"coins\",\"copy\",\"cpu\",\"download\",\"external-link\",\"file-pen\",\"flag\",\"flask-conical\",\"git-branch\",\"git-pull-request\",\"git-pull-request-arrow\",\"github\",\"history\",\"inbox\",\"info\",\"key-round\",\"laptop\",\"layers\",\"layout-grid\",\"list\",\"list-checks\",\"list-ordered\",\"loader\",\"lock\",\"log-out\",\"menu\",\"message-square-text\",\"moon\",\"octagon-alert\",\"plus\",\"refresh-cw\",\"rotate-cw\",\"search\",\"search-x\",\"server\",\"settings-2\",\"shield-check\",\"sliders-horizontal\",\"sparkles\",\"square\",\"terminal\",\"timer\",\"triangle-alert\",\"users\",\"wallet\",\"wand-sparkles\",\"webhook\"]");
|
|
3
3
|
export const sprite = "<svg xmlns=\"http://www.w3.org/2000/svg\" style=\"position:absolute;width:0;height:0;overflow:hidden\" aria-hidden=\"true\"><symbol id=\"i-activity\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2\" /></symbol><symbol id=\"i-arrow-right\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\" />\n <path d=\"m12 5 7 7-7 7\" /></symbol><symbol id=\"i-book-open\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 5v16\" />\n <path d=\"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z\" /></symbol><symbol id=\"i-calendar-clock\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 14v2.2l1.6 1\" />\n <path d=\"M16 2v3\" />\n <path d=\"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338\" />\n <path d=\"M3 9h5.859\" />\n <path d=\"M8 2v3\" />\n <circle cx=\"16\" cy=\"16\" r=\"6\" /></symbol><symbol id=\"i-chart-no-axes-column\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 21v-6\" />\n <path d=\"M12 21V3\" />\n <path d=\"M19 21V9\" /></symbol><symbol id=\"i-check\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\" /></symbol><symbol id=\"i-chevron-right\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m9 18 6-6-6-6\" /></symbol><symbol id=\"i-circle\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" /></symbol><symbol id=\"i-circle-alert\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"12\" x2=\"12\" y1=\"8\" y2=\"12\" />\n <line x1=\"12\" x2=\"12.01\" y1=\"16\" y2=\"16\" /></symbol><symbol id=\"i-circle-check\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m16 9-5.5 5.5L8 12\" /></symbol><symbol id=\"i-circle-pause\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <line x1=\"10\" x2=\"10\" y1=\"15\" y2=\"9\" />\n <line x1=\"14\" x2=\"14\" y1=\"15\" y2=\"9\" /></symbol><symbol id=\"i-circle-x\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"m15 9-6 6\" />\n <path d=\"m9 9 6 6\" /></symbol><symbol id=\"i-coins\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13.744 17.736a6 6 0 1 1-7.48-7.48\" />\n <path d=\"M15 6h1v4\" />\n <path d=\"m6.134 14.768.866-.5 2 3.464\" />\n <circle cx=\"16\" cy=\"8\" r=\"6\" /></symbol><symbol id=\"i-copy\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" /></symbol><symbol id=\"i-cpu\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 20v2\" />\n <path d=\"M12 2v2\" />\n <path d=\"M17 20v2\" />\n <path d=\"M17 2v2\" />\n <path d=\"M2 12h2\" />\n <path d=\"M2 17h2\" />\n <path d=\"M2 7h2\" />\n <path d=\"M20 12h2\" />\n <path d=\"M20 17h2\" />\n <path d=\"M20 7h2\" />\n <path d=\"M7 20v2\" />\n <path d=\"M7 2v2\" />\n <rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\" />\n <rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1\" /></symbol><symbol id=\"i-download\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 15V3\" />\n <path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\" />\n <path d=\"m7 10 5 5 5-5\" /></symbol><symbol id=\"i-external-link\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 3h6v6\" />\n <path d=\"M10 14 21 3\" />\n <path d=\"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6\" /></symbol><symbol id=\"i-file-pen\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34\" />\n <path d=\"M14 2v5a1 1 0 0 0 1 1h5\" />\n <path d=\"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z\" /></symbol><symbol id=\"i-flag\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528\" /></symbol><symbol id=\"i-flask-conical\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2\" />\n <path d=\"M6.453 15h11.094\" />\n <path d=\"M8.5 2h7\" /></symbol><symbol id=\"i-git-branch\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 6a9 9 0 0 0-9 9V3\" />\n <circle cx=\"18\" cy=\"6\" r=\"3\" />\n <circle cx=\"6\" cy=\"18\" r=\"3\" /></symbol><symbol id=\"i-git-pull-request\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"18\" cy=\"18\" r=\"3\" />\n <circle cx=\"6\" cy=\"6\" r=\"3\" />\n <path d=\"M13 6h3a2 2 0 0 1 2 2v7\" />\n <line x1=\"6\" x2=\"6\" y1=\"9\" y2=\"21\" /></symbol><symbol id=\"i-git-pull-request-arrow\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"5\" cy=\"6\" r=\"3\" />\n <path d=\"M5 9v12\" />\n <circle cx=\"19\" cy=\"18\" r=\"3\" />\n <path d=\"m15 9-3-3 3-3\" />\n <path d=\"M12 6h5a2 2 0 0 1 2 2v7\" /></symbol><symbol id=\"i-github\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4\" />\n <path d=\"M9 18c-4.51 2-5-2-7-2\" /></symbol><symbol id=\"i-history\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\" />\n <path d=\"M3 3v5h5\" />\n <path d=\"M12 7v5l4 2\" /></symbol><symbol id=\"i-inbox\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"22 12 16 12 14 15 10 15 8 12 2 12\" />\n <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\" /></symbol><symbol id=\"i-info\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" /></symbol><symbol id=\"i-key-round\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z\" />\n <circle cx=\"16.5\" cy=\"7.5\" r=\".5\" fill=\"currentColor\" /></symbol><symbol id=\"i-laptop\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z\" />\n <path d=\"M20.054 15.987H3.946\" /></symbol><symbol id=\"i-layers\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\" />\n <path d=\"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\" />\n <path d=\"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\" /></symbol><symbol id=\"i-layout-grid\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"7\" height=\"7\" x=\"3\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"3\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"14\" y=\"14\" rx=\"1\" />\n <rect width=\"7\" height=\"7\" x=\"3\" y=\"14\" rx=\"1\" /></symbol><symbol id=\"i-list\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 5h.01\" />\n <path d=\"M3 12h.01\" />\n <path d=\"M3 19h.01\" />\n <path d=\"M8 5h13\" />\n <path d=\"M8 12h13\" />\n <path d=\"M8 19h13\" /></symbol><symbol id=\"i-list-checks\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 5h8\" />\n <path d=\"M13 12h8\" />\n <path d=\"M13 19h8\" />\n <path d=\"m3 17 2 2 4-4\" />\n <path d=\"m3 7 2 2 4-4\" /></symbol><symbol id=\"i-list-ordered\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 5h10\" />\n <path d=\"M11 12h10\" />\n <path d=\"M11 19h10\" />\n <path d=\"M4 4h1v5\" />\n <path d=\"M4 9h2\" />\n <path d=\"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02\" /></symbol><symbol id=\"i-loader\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 2v4\" />\n <path d=\"m16.2 7.8 2.9-2.9\" />\n <path d=\"M18 12h4\" />\n <path d=\"m16.2 16.2 2.9 2.9\" />\n <path d=\"M12 18v4\" />\n <path d=\"m4.9 19.1 2.9-2.9\" />\n <path d=\"M2 12h4\" />\n <path d=\"m4.9 4.9 2.9 2.9\" /></symbol><symbol id=\"i-lock\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"18\" height=\"11\" x=\"3\" y=\"11\" rx=\"2\" ry=\"2\" />\n <path d=\"M7 11V7a5 5 0 0 1 10 0v4\" /></symbol><symbol id=\"i-log-out\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m16 17 5-5-5-5\" />\n <path d=\"M21 12H9\" />\n <path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\" /></symbol><symbol id=\"i-menu\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 5h16\" />\n <path d=\"M4 12h16\" />\n <path d=\"M4 19h16\" /></symbol><symbol id=\"i-message-square-text\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z\" />\n <path d=\"M7 11h10\" />\n <path d=\"M7 15h6\" />\n <path d=\"M7 7h8\" /></symbol><symbol id=\"i-moon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\" /></symbol><symbol id=\"i-octagon-alert\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 16h.01\" />\n <path d=\"M12 8v4\" />\n <path d=\"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z\" /></symbol><symbol id=\"i-plus\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M5 12h14\" />\n <path d=\"M12 5v14\" /></symbol><symbol id=\"i-refresh-cw\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M8 16H3v5\" /></symbol><symbol id=\"i-rotate-cw\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" /></symbol><symbol id=\"i-search\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21 21-4.34-4.34\" />\n <circle cx=\"11\" cy=\"11\" r=\"8\" /></symbol><symbol id=\"i-search-x\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m13.5 8.5-5 5\" />\n <path d=\"m8.5 8.5 5 5\" />\n <circle cx=\"11\" cy=\"11\" r=\"8\" />\n <path d=\"m21 21-4.3-4.3\" /></symbol><symbol id=\"i-server\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"20\" height=\"8\" x=\"2\" y=\"2\" rx=\"2\" ry=\"2\" />\n <rect width=\"20\" height=\"8\" x=\"2\" y=\"14\" rx=\"2\" ry=\"2\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"6\" y2=\"6\" />\n <line x1=\"6\" x2=\"6.01\" y1=\"18\" y2=\"18\" /></symbol><symbol id=\"i-settings-2\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 17H5\" />\n <path d=\"M19 7h-9\" />\n <circle cx=\"17\" cy=\"17\" r=\"3\" />\n <circle cx=\"7\" cy=\"7\" r=\"3\" /></symbol><symbol id=\"i-shield-check\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z\" />\n <path d=\"m9 12 2 2 4-4\" /></symbol><symbol id=\"i-sliders-horizontal\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 5H3\" />\n <path d=\"M12 19H3\" />\n <path d=\"M14 3v4\" />\n <path d=\"M16 17v4\" />\n <path d=\"M21 12h-9\" />\n <path d=\"M21 19h-5\" />\n <path d=\"M21 5h-7\" />\n <path d=\"M8 10v4\" />\n <path d=\"M8 12H3\" /></symbol><symbol id=\"i-sparkles\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z\" />\n <path d=\"M20 2v4\" />\n <path d=\"M22 4h-4\" />\n <circle cx=\"4\" cy=\"20\" r=\"2\" /></symbol><symbol id=\"i-square\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" /></symbol><symbol id=\"i-terminal\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 19h8\" />\n <path d=\"m4 17 6-6-6-6\" /></symbol><symbol id=\"i-timer\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"10\" x2=\"14\" y1=\"2\" y2=\"2\" />\n <line x1=\"12\" x2=\"15\" y1=\"14\" y2=\"11\" />\n <circle cx=\"12\" cy=\"14\" r=\"8\" /></symbol><symbol id=\"i-triangle-alert\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" /></symbol><symbol id=\"i-users\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2\" />\n <path d=\"M16 3.128a4 4 0 0 1 0 7.744\" />\n <path d=\"M22 21v-2a4 4 0 0 0-3-3.87\" />\n <circle cx=\"9\" cy=\"7\" r=\"4\" /></symbol><symbol id=\"i-wallet\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1\" />\n <path d=\"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4\" /></symbol><symbol id=\"i-wand-sparkles\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72\" />\n <path d=\"m14 7 3 3\" />\n <path d=\"M5 6v4\" />\n <path d=\"M19 14v4\" />\n <path d=\"M10 2v2\" />\n <path d=\"M7 8H3\" />\n <path d=\"M21 16h-4\" />\n <path d=\"M11 3H9\" /></symbol><symbol id=\"i-webhook\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\" />\n <path d=\"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\" />\n <path d=\"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\" /></symbol></svg>";
|