screw-bugs 0.1.1 → 0.1.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.
Files changed (54) hide show
  1. package/README.md +69 -19
  2. package/dist/browser-playwright/launch.js +3 -1
  3. package/dist/browser-playwright/page.d.ts +3 -11
  4. package/dist/browser-playwright/page.js +17 -1
  5. package/dist/browser-playwright/sign-in.d.ts +77 -0
  6. package/dist/browser-playwright/sign-in.js +217 -0
  7. package/dist/build-info.json +3 -3
  8. package/dist/cli/app.js +4 -1
  9. package/dist/cli/commands.js +68 -3
  10. package/dist/cli/exit-codes.d.ts +6 -0
  11. package/dist/cli/exit-codes.js +6 -0
  12. package/dist/cli/mcp.js +17 -3
  13. package/dist/cli/operations.d.ts +31 -3
  14. package/dist/cli/operations.js +95 -3
  15. package/dist/cli/sign-in.d.ts +79 -0
  16. package/dist/cli/sign-in.js +305 -0
  17. package/dist/core/accounts.d.ts +40 -0
  18. package/dist/core/accounts.js +95 -0
  19. package/dist/core/engine.d.ts +4 -3
  20. package/dist/core/engine.js +30 -8
  21. package/dist/core/errors.d.ts +19 -0
  22. package/dist/core/errors.js +6 -0
  23. package/dist/core/index.d.ts +1 -0
  24. package/dist/core/index.js +1 -0
  25. package/dist/core/services.d.ts +77 -8
  26. package/dist/core/services.js +4 -1
  27. package/dist/report/bug.d.ts +2 -2
  28. package/dist/report/bug.js +5 -4
  29. package/dist/report/html.d.ts +1 -1
  30. package/dist/report/icons.d.ts +1 -0
  31. package/dist/report/icons.js +1 -0
  32. package/dist/report/index.d.ts +1 -0
  33. package/dist/report/index.js +1 -0
  34. package/dist/report/markup.d.ts +2 -0
  35. package/dist/report/markup.js +5 -4
  36. package/dist/report/player.d.ts +7 -2
  37. package/dist/report/player.js +16 -5
  38. package/dist/report/sign-in.d.ts +41 -0
  39. package/dist/report/sign-in.js +591 -0
  40. package/dist/report/styles.js +1 -1
  41. package/dist/report/walkthrough.d.ts +3 -2
  42. package/dist/report/walkthrough.js +47 -38
  43. package/dist/schema/accounts.d.ts +137 -0
  44. package/dist/schema/accounts.js +112 -0
  45. package/dist/schema/index.d.ts +1 -0
  46. package/dist/schema/index.js +1 -0
  47. package/dist/schema/job.d.ts +27 -6
  48. package/dist/schema/job.js +12 -2
  49. package/dist/schema/ledger.d.ts +5 -1
  50. package/dist/store-local/accounts.d.ts +8 -4
  51. package/dist/store-local/accounts.js +82 -7
  52. package/dist/store-local/paths.d.ts +4 -1
  53. package/dist/store-local/paths.js +4 -1
  54. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import type { SavedAccount } from './services.js';
2
+ import { type JobAccount, type SavedSession, type SignInWhy } from '../schema/index.js';
3
+ /** How recent a session counts as just signed in, so `renew` does not ask for it again. */
4
+ export declare const RENEW_GRACE_MS: number;
5
+ /**
6
+ * Whether the browser sends a cookie of `domain` (as Playwright gives it) to `origin`'s host. A
7
+ * host-only cookie (no leading dot) goes to its own host alone; a domain cookie (`.acme.dev`) to
8
+ * that host and every name under it (RFC 6265 domain matching). Browsers never keep a cookie for
9
+ * a public suffix (`co.uk`, `github.io`), so this never takes in another site that shares one;
10
+ * a sibling's cookie (`api.acme.dev` for `app.acme.dev`), or the parent's own host-only one, is
11
+ * not kept either.
12
+ */
13
+ export declare const sentTo: (origin: string, domain: string) => boolean;
14
+ /** The origin of a job URL, such as `http://localhost:3000`; undefined for one that is not a URL. */
15
+ export declare const originOf: (url: string) => string | undefined;
16
+ /**
17
+ * Whether every cookie of the session has an expiry and it has passed: then the browser would
18
+ * start with none of them, and the session cannot work. A session with no cookies at all may
19
+ * live in storage, so it counts as working.
20
+ */
21
+ export declare const sessionExpired: (session: Pick<SavedSession, 'cookies'>, nowMs: number) => boolean;
22
+ /**
23
+ * Why a run of a job with `account` at `url` cannot start from its saved session yet (a person has
24
+ * to sign in to it first), or undefined when it can.
25
+ */
26
+ export declare const needsSignIn: (account: JobAccount, url: string, saved: SavedAccount | undefined, nowMs: number) => SignInWhy | undefined;
27
+ /** What kind of user the account is: what the job says, else what was saved. */
28
+ export declare const aboutOf: (account: JobAccount, saved: SavedAccount | undefined) => string | undefined;
29
+ /** Why the account needs signing in, as the end of a sentence about it. */
30
+ export declare const describeSignInWhy: (why: SignInWhy) => string;
31
+ /** At most this long, the app's title as the live view shows it. */
32
+ export declare const SITE_TITLE_MAX = 120;
33
+ /** A page title on one line, cut to `SITE_TITLE_MAX`; undefined when blank. */
34
+ export declare const siteTitle: (raw: string) => string | undefined;
35
+ /** At most this many icon addresses are tried, best first. */
36
+ export declare const SITE_ICONS_MAX = 4;
37
+ /** The largest icon the live view shows, in bytes. */
38
+ export declare const SITE_ICON_BYTES_MAX: number;
39
+ /** The image type of an icon from its `Content-Type`, or undefined when it is not one shown. */
40
+ export declare const siteIconType: (contentType: string | undefined) => string | undefined;
@@ -0,0 +1,95 @@
1
+ import { DateTime, Option } from 'effect';
2
+ import { accountAboutOf, } from '../schema/index.js';
3
+ /** How recent a session counts as just signed in, so `renew` does not ask for it again. */
4
+ export const RENEW_GRACE_MS = 10 * 60_000;
5
+ /**
6
+ * Whether the browser sends a cookie of `domain` (as Playwright gives it) to `origin`'s host. A
7
+ * host-only cookie (no leading dot) goes to its own host alone; a domain cookie (`.acme.dev`) to
8
+ * that host and every name under it (RFC 6265 domain matching). Browsers never keep a cookie for
9
+ * a public suffix (`co.uk`, `github.io`), so this never takes in another site that shares one;
10
+ * a sibling's cookie (`api.acme.dev` for `app.acme.dev`), or the parent's own host-only one, is
11
+ * not kept either.
12
+ */
13
+ export const sentTo = (origin, domain) => {
14
+ const host = URL.parse(origin)
15
+ ?.hostname.toLowerCase()
16
+ .replace(/^\[|\]$/g, '');
17
+ const lower = domain.toLowerCase().replace(/\.$/, '');
18
+ const bare = lower.replace(/^\./, '');
19
+ if (host === undefined || bare === '')
20
+ return false;
21
+ return host === bare || (lower.startsWith('.') && host.endsWith(`.${bare}`));
22
+ };
23
+ /** The origin of a job URL, such as `http://localhost:3000`; undefined for one that is not a URL. */
24
+ export const originOf = (url) => {
25
+ const parsed = URL.parse(url);
26
+ return parsed === null ? undefined : parsed.origin;
27
+ };
28
+ /**
29
+ * Whether every cookie of the session has an expiry and it has passed: then the browser would
30
+ * start with none of them, and the session cannot work. A session with no cookies at all may
31
+ * live in storage, so it counts as working.
32
+ */
33
+ export const sessionExpired = (session, nowMs) => session.cookies.length > 0 &&
34
+ session.cookies.every((c) => c.expires > 0 && c.expires * 1000 <= nowMs);
35
+ /**
36
+ * Why a run of a job with `account` at `url` cannot start from its saved session yet (a person has
37
+ * to sign in to it first), or undefined when it can.
38
+ */
39
+ export const needsSignIn = (account, url, saved, nowMs) => {
40
+ if (saved === undefined || saved.session === undefined)
41
+ return { _tag: 'none' };
42
+ if (saved.entry.origin !== originOf(url))
43
+ return { _tag: 'origin', saved: saved.entry.origin };
44
+ if (sessionExpired(saved.session, nowMs))
45
+ return { _tag: 'expired' };
46
+ const savedAt = Option.map(DateTime.make(saved.entry.savedAt), DateTime.toEpochMillis);
47
+ const renew = typeof account !== 'string' && account.renew === true;
48
+ const justSaved = Option.exists(savedAt, (at) => nowMs - at < RENEW_GRACE_MS);
49
+ if (renew && !justSaved)
50
+ return { _tag: 'renew' };
51
+ return undefined;
52
+ };
53
+ /** What kind of user the account is: what the job says, else what was saved. */
54
+ export const aboutOf = (account, saved) => accountAboutOf(account) ?? saved?.entry.about;
55
+ /** Why the account needs signing in, as the end of a sentence about it. */
56
+ export const describeSignInWhy = (why) => {
57
+ switch (why._tag) {
58
+ case 'none':
59
+ return 'has no saved sign-in yet';
60
+ case 'origin':
61
+ return `is signed in on ${why.saved}, not here`;
62
+ case 'expired':
63
+ return 'has a saved sign-in whose cookies have all expired';
64
+ case 'renew':
65
+ return 'was asked to sign in again';
66
+ }
67
+ };
68
+ /** At most this long, the app's title as the live view shows it. */
69
+ export const SITE_TITLE_MAX = 120;
70
+ /** A page title on one line, cut to `SITE_TITLE_MAX`; undefined when blank. */
71
+ export const siteTitle = (raw) => {
72
+ const line = raw.replace(/\s+/g, ' ').trim();
73
+ if (line === '')
74
+ return undefined;
75
+ return line.length > SITE_TITLE_MAX ? `${line.slice(0, SITE_TITLE_MAX - 1)}…` : line;
76
+ };
77
+ /** At most this many icon addresses are tried, best first. */
78
+ export const SITE_ICONS_MAX = 4;
79
+ /** The largest icon the live view shows, in bytes. */
80
+ export const SITE_ICON_BYTES_MAX = 64 * 1024;
81
+ /** Image types an icon is shown as. It goes in an `<img>`, where even an SVG runs no script. */
82
+ const SITE_ICON_TYPES = new Set([
83
+ 'image/png',
84
+ 'image/x-icon',
85
+ 'image/vnd.microsoft.icon',
86
+ 'image/svg+xml',
87
+ 'image/gif',
88
+ 'image/jpeg',
89
+ 'image/webp',
90
+ ]);
91
+ /** The image type of an icon from its `Content-Type`, or undefined when it is not one shown. */
92
+ export const siteIconType = (contentType) => {
93
+ const type = contentType?.split(';')[0]?.trim().toLowerCase();
94
+ return type !== undefined && SITE_ICON_TYPES.has(type) ? type : undefined;
95
+ };
@@ -1,6 +1,6 @@
1
1
  import { Context, Effect, Layer } from 'effect';
2
2
  import { type Answer, type CaseLedger, Findings, type JobId, type JobSpec, type PlacedMark, type ReportBundle } from '../schema/index.js';
3
- import { FindingsRejected, NotImplemented, RunNotEnded, type RunNotFound, StorageFailed } from './errors.js';
3
+ import { FindingsRejected, NotImplemented, RunNotEnded, type RunNotFound, SignInNeeded, StorageFailed } from './errors.js';
4
4
  import { AccountBook, Browser, Notifier, ReportRenderer, Storage, type UploadSource } from './services.js';
5
5
  /**
6
6
  * The longest one write of `report.html` or `ledger.json` may take. A run's
@@ -18,11 +18,12 @@ declare const Engine_base: Context.ServiceClass<Engine, "screw-bugs/Engine", {
18
18
  /**
19
19
  * Returns as soon as the job is recorded; the run continues in the background. `uploads` are
20
20
  * the files its upload steps send, checked by the caller beforehand; an upload step whose
21
- * file is not among them is blocked.
21
+ * file is not among them is blocked. A job with an account starts only from a session that
22
+ * may still work (see `needsSignIn`); otherwise nothing is recorded or started.
22
23
  */
23
24
  readonly startRun: (spec: JobSpec, options?: {
24
25
  readonly uploads?: ReadonlyArray<UploadSource> | undefined;
25
- }) => Effect.Effect<JobId, NotImplemented | StorageFailed>;
26
+ }) => Effect.Effect<JobId, SignInNeeded | StorageFailed>;
26
27
  /** Waits for a run this process started, then returns its final ledger. */
27
28
  readonly awaitRun: (jobId: JobId) => Effect.Effect<CaseLedger, RunNotFound | StorageFailed>;
28
29
  /**
@@ -1,6 +1,7 @@
1
1
  import { Cause, Clock, Context, DateTime, Effect, Fiber, Layer, Schema, Semaphore } from 'effect';
2
- import { annotatedFile, casesOf, Findings, findingsRevision, reportBundleOf, runFiles, ShotPage, videoFile, } from '../schema/index.js';
3
- import { FindingsRejected, NotImplemented, RunNotEnded, StorageFailed, } from './errors.js';
2
+ import { accountLabel, annotatedFile, casesOf, Findings, findingsRevision, reportBundleOf, runFiles, ShotPage, videoFile, } from '../schema/index.js';
3
+ import { FindingsRejected, NotImplemented, RunNotEnded, SignInNeeded, StorageFailed, } from './errors.js';
4
+ import { aboutOf, needsSignIn, originOf } from './accounts.js';
4
5
  import { checkFindings, evidencePackOf } from './evidence.js';
5
6
  import { AppVersion, HEARTBEAT_INTERVAL_MS, markUnreached, ProcessId, RUN_INTERRUPTED, } from './liveness.js';
6
7
  import { elementBoxes } from './labels.js';
@@ -34,7 +35,7 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
34
35
  static layer = Layer.effect(Engine, Effect.gen(function* () {
35
36
  const browser = yield* Browser;
36
37
  const storage = yield* Storage;
37
- yield* AccountBook;
38
+ const accounts = yield* AccountBook;
38
39
  const notifier = yield* Notifier;
39
40
  const renderer = yield* ReportRenderer;
40
41
  const pid = yield* ProcessId;
@@ -222,7 +223,7 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
222
223
  evidence: [],
223
224
  }));
224
225
  /** Every case starts not verified; each is replaced by its result as soon as it ends. */
225
- const execute = (jobId, spec, uploads) => Effect.gen(function* () {
226
+ const execute = (jobId, spec, uploads, savedSession) => Effect.gen(function* () {
226
227
  const cases = casesOf(spec);
227
228
  const sources = new Map(uploads.map((source) => [source.path, source]));
228
229
  let ledger = {
@@ -313,6 +314,7 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
313
314
  const video = videoFile(1);
314
315
  const session = yield* browserSession.newSession({
315
316
  device: spec.device ?? 'desktop',
317
+ session: savedSession,
316
318
  video: {
317
319
  dir: storage.filePath(jobId, runFiles.videoDir),
318
320
  path: storage.filePath(jobId, video),
@@ -328,7 +330,7 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
328
330
  {
329
331
  number: 1,
330
332
  startedAt,
331
- ...(spec.account !== undefined ? { account: spec.account } : {}),
333
+ ...(spec.account !== undefined ? { account: accountLabel(spec.account) } : {}),
332
334
  },
333
335
  ],
334
336
  }));
@@ -420,13 +422,33 @@ export class Engine extends Context.Service()('screw-bugs/Engine') {
420
422
  // Copies are a convenience for pull requests; without a browser there are none.
421
423
  return yield* browser.annotate(jobs).pipe(Effect.orElseSucceed(() => []));
422
424
  });
425
+ /**
426
+ * The session (storage state as JSON text) a job's run starts from: none without an account, else its saved
427
+ * session, if that may still work (see `needsSignIn`).
428
+ */
429
+ const sessionFor = (spec) => Effect.gen(function* () {
430
+ if (spec.account === undefined)
431
+ return undefined;
432
+ const label = accountLabel(spec.account);
433
+ const saved = yield* accounts.find(label);
434
+ const why = needsSignIn(spec.account, spec.url, saved, yield* Clock.currentTimeMillis);
435
+ // The text as it was checked: the file may be replaced or removed before the run opens it.
436
+ if (why === undefined && saved?.sessionText !== undefined)
437
+ return saved.sessionText;
438
+ return yield* new SignInNeeded({
439
+ label,
440
+ about: aboutOf(spec.account, saved),
441
+ origin: originOf(spec.url) ?? spec.url,
442
+ url: spec.url,
443
+ why: why ?? { _tag: 'none' },
444
+ });
445
+ });
423
446
  return Engine.of({
424
447
  startRun: (spec, options) => Effect.gen(function* () {
425
- if (spec.account !== undefined)
426
- return yield* new NotImplemented({ feature: 'Logging in with a saved account' });
448
+ const session = yield* sessionFor(spec);
427
449
  const jobId = yield* storage.createRun(spec);
428
450
  yield* storage.writeLedger(yield* stamped({ jobId, state: 'queued', cases: notVerified(spec), ...device(spec) }));
429
- const fiber = yield* execute(jobId, spec, options?.uploads ?? []).pipe(Effect.ensuring(Effect.sync(() => running.delete(jobId))), Effect.forkIn(scope));
451
+ const fiber = yield* execute(jobId, spec, options?.uploads ?? [], session).pipe(Effect.ensuring(Effect.sync(() => running.delete(jobId))), Effect.forkIn(scope));
430
452
  running.set(jobId, fiber);
431
453
  return jobId;
432
454
  }),
@@ -1,3 +1,4 @@
1
+ import type { SignInWhy } from '../schema/index.js';
1
2
  declare const NotImplemented_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
2
3
  readonly _tag: "NotImplemented";
3
4
  } & Readonly<A>;
@@ -63,4 +64,22 @@ export declare class FindingsRejected extends FindingsRejected_base<{
63
64
  }> {
64
65
  get message(): string;
65
66
  }
67
+ declare const SignInNeeded_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
68
+ readonly _tag: "SignInNeeded";
69
+ } & Readonly<A>;
70
+ /**
71
+ * A job's account has no session a run can start from (see `needsSignIn`): nothing was started,
72
+ * and a person has to sign in to it first.
73
+ */
74
+ export declare class SignInNeeded extends SignInNeeded_base<{
75
+ readonly label: string;
76
+ /** What kind of user it is: the job's `about`, else the saved one. */
77
+ readonly about: string | undefined;
78
+ /** The origin of the job URL, where the person signs in. */
79
+ readonly origin: string;
80
+ /** The job URL, where the live view opens. */
81
+ readonly url: string;
82
+ readonly why: SignInWhy;
83
+ }> {
84
+ }
66
85
  export {};
@@ -28,3 +28,9 @@ export class FindingsRejected extends Data.TaggedError('FindingsRejected') {
28
28
  return this.problems.join('\n');
29
29
  }
30
30
  }
31
+ /**
32
+ * A job's account has no session a run can start from (see `needsSignIn`): nothing was started,
33
+ * and a person has to sign in to it first.
34
+ */
35
+ export class SignInNeeded extends Data.TaggedError('SignInNeeded') {
36
+ }
@@ -1,3 +1,4 @@
1
+ export * from './accounts.js';
1
2
  export * from './engine.js';
2
3
  export * from './errors.js';
3
4
  export * from './evidence.js';
@@ -1,3 +1,4 @@
1
+ export * from './accounts.js';
1
2
  export * from './engine.js';
2
3
  export * from './errors.js';
3
4
  export * from './evidence.js';
@@ -1,6 +1,6 @@
1
1
  import { Context, type Effect, type Scope } from 'effect';
2
- import type { Box, Candidate, CaseLedger, Device, ElementTarget, JobId, JobRecord, JobSpec, JobState, OnScreen, PageFacts, PageNode, Point, ReportBundle, ShotFrame, Target, Truncated, VisualViewport, WaitState } from '../schema/index.js';
3
- import type { BrowserNotFound, NotImplemented, PageActionFailed, RunNotFound, StorageFailed } from './errors.js';
2
+ import type { AccountEntry, Box, Candidate, CaseLedger, Device, ElementTarget, JobId, JobRecord, JobSpec, JobState, OnScreen, PageFacts, PageNode, Point, ReportBundle, SavedSession, ShotFrame, SignInInput, Target, Truncated, VisualViewport, WaitState } from '../schema/index.js';
3
+ import type { BrowserNotFound, PageActionFailed, RunNotFound, StorageFailed } from './errors.js';
4
4
  export type BrowserKind = 'chrome' | 'msedge' | 'playwright-chromium';
5
5
  export interface BrowserInfo {
6
6
  readonly kind: BrowserKind;
@@ -340,6 +340,8 @@ export interface BrowserSession {
340
340
  readonly dir: string;
341
341
  readonly path: string;
342
342
  } | undefined;
343
+ /** A saved session (an account's storage state, as JSON text) the context starts from. */
344
+ readonly session?: string | undefined;
343
345
  }) => Effect.Effect<BrowserSessionPage, PageActionFailed, Scope.Scope>;
344
346
  }
345
347
  /** A screenshot to draw boxes on, for copies people can paste where no overlay is possible. */
@@ -384,10 +386,59 @@ declare const Browser_base: Context.ServiceClass<Browser, "screw-bugs/Browser",
384
386
  * them. Resolves with the copies it wrote; one that fails is left out.
385
387
  */
386
388
  readonly annotate: (jobs: ReadonlyArray<AnnotateJob>) => Effect.Effect<ReadonlyArray<string>, BrowserNotFound>;
389
+ /**
390
+ * A browser for a person to sign in with from the live view (see `SignInBrowser`), open at
391
+ * `url` in a fresh context. Closed with the scope.
392
+ */
393
+ readonly signIn: (url: string) => Effect.Effect<SignInBrowser, BrowserNotFound | PageActionFailed, Scope.Scope>;
387
394
  }>;
388
395
  /** Finds and launches a browser. Headless unless `headed` is set (used for logins). */
389
396
  export declare class Browser extends Browser_base {
390
397
  }
398
+ /** A frame of the live view: what the active tab shows, as a JPEG. */
399
+ export interface SignInFrame {
400
+ /** Counts up with every frame, so a viewer can ask for the next one. */
401
+ readonly seq: number;
402
+ /** The JPEG, base64-encoded, as the browser sent it. */
403
+ readonly jpeg: string;
404
+ /** The viewport the frame shows, in CSS pixels. */
405
+ readonly width: number;
406
+ readonly height: number;
407
+ /** The address of the tab it shows. */
408
+ readonly url: string;
409
+ }
410
+ /** How the app names itself where the sign-in opened, for the live view to show the person. */
411
+ export interface SignInSite {
412
+ /** Its page's title, on one line; undefined when it had none or the page was another site's. */
413
+ readonly title: string | undefined;
414
+ /** Addresses of its icons on the app's own origin, best first, for the live view to fetch. */
415
+ readonly icons: ReadonlyArray<string>;
416
+ }
417
+ /**
418
+ * A headless browser a person drives from a web page (the live view) to sign in to an account:
419
+ * frames of the active tab out; their mouse, wheel, keys and text in. Popups are followed: the
420
+ * newest open tab is the active one. Nothing typed is recorded or kept.
421
+ */
422
+ export interface SignInBrowser {
423
+ /** The app's title and icon, read once when the first page loaded. */
424
+ readonly site: SignInSite;
425
+ /**
426
+ * The newest frame if it is newer than `after`, else the next one, waiting up to `waitMs`;
427
+ * undefined when none came (the page sends a frame only when something changed).
428
+ */
429
+ readonly frame: (after: number, waitMs: number) => Effect.Effect<SignInFrame | undefined>;
430
+ /**
431
+ * Plays one input into the active tab; false when it could not be played (Playwright failed or
432
+ * it took too long), so the person is told before saving.
433
+ */
434
+ readonly input: (input: SignInInput) => Effect.Effect<boolean>;
435
+ /**
436
+ * The session as Playwright's storage state (JSON text), with only the cookies the browser sends
437
+ * to `origin` (see `sentTo`) and that origin's storage, so another site's sign-in (such as
438
+ * GitHub's) is not kept.
439
+ */
440
+ readonly save: (origin: string) => Effect.Effect<string, PageActionFailed>;
441
+ }
391
442
  /** A run as listed by `screw-bugs runs`. */
392
443
  export interface RunSummary {
393
444
  readonly job: JobRecord;
@@ -455,15 +506,33 @@ declare const ReportRenderer_base: Context.ServiceClass<ReportRenderer, "screw-b
455
506
  */
456
507
  export declare class ReportRenderer extends ReportRenderer_base {
457
508
  }
458
- /** A saved login. Listings never include secrets. */
459
- export interface AccountSummary {
460
- readonly label: string;
461
- readonly origin: string;
509
+ /** A saved account and where its session is. */
510
+ export interface SavedAccount {
511
+ readonly entry: AccountEntry;
512
+ /** Absolute path of its session (Playwright's storage state), which runs start from. */
513
+ readonly sessionPath: string;
514
+ /** What the session file says about itself; undefined when it is missing or unreadable. */
515
+ readonly session: SavedSession | undefined;
516
+ /**
517
+ * The session file's whole text as it was read with `session`, which a run starts from: the
518
+ * file itself may be replaced (another sign-in) or removed meanwhile.
519
+ */
520
+ readonly sessionText: string | undefined;
462
521
  }
463
522
  declare const AccountBook_base: Context.ServiceClass<AccountBook, "screw-bugs/AccountBook", {
464
- readonly list: Effect.Effect<ReadonlyArray<AccountSummary>, NotImplemented>;
523
+ /** Absolute path of `accounts.json`, which agents read to pick an account. */
524
+ readonly file: string;
525
+ readonly list: Effect.Effect<ReadonlyArray<AccountEntry>, StorageFailed>;
526
+ readonly find: (label: string) => Effect.Effect<SavedAccount | undefined, StorageFailed>;
527
+ /** Saves a session (storage state as JSON text) for `entry`, replacing any for its label. */
528
+ readonly save: (entry: AccountEntry, session: string) => Effect.Effect<void, StorageFailed>;
529
+ /** Removes an account and its session; false when there was none. */
530
+ readonly remove: (label: string) => Effect.Effect<boolean, StorageFailed>;
465
531
  }>;
466
- /** Test accounts the engine can log in with. */
532
+ /**
533
+ * The project's test accounts: `accounts.json` (labels, what each user is, where and when it was
534
+ * signed in; never a secret) and one session file each, readable by the user alone.
535
+ */
467
536
  export declare class AccountBook extends AccountBook_base {
468
537
  }
469
538
  export interface JobEvent {
@@ -14,7 +14,10 @@ export class Storage extends Context.Service()('screw-bugs/Storage') {
14
14
  */
15
15
  export class ReportRenderer extends Context.Service()('screw-bugs/ReportRenderer') {
16
16
  }
17
- /** Test accounts the engine can log in with. */
17
+ /**
18
+ * The project's test accounts: `accounts.json` (labels, what each user is, where and when it was
19
+ * signed in; never a secret) and one session file each, readable by the user alone.
20
+ */
18
21
  export class AccountBook extends Context.Service()('screw-bugs/AccountBook') {
19
22
  }
20
23
  /** Tells the outside world about job progress (terminal, MCP client, later screw-bugs Cloud). */
@@ -2,9 +2,9 @@
2
2
  export declare const BUG_LIME = "#96F011";
3
3
  export declare const BUG_DARK = "#1D1D1D";
4
4
  /** idle-dark: the lime bug, for the dark theme. */
5
- export declare const BUG_GIF_ON_DARK = "data:image/gif;base64,R0lGODlhPAA8AIEAAAAAAJbwEQAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJLQAAACwAAAAAPAA8AAAI3AABCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjwQDiBxJsmRJkAhNqlSJ8uDKlyNbGoQJU2ZBmi9thsTJUqdAnj19AjVpcyhPkEZxIk1a8yPTph5X+nQodSrDqlYVYs2aMihXl16/3gwrduDWsmafnt2odq3GtmTfwj15cW5biHbV4s3LdC9fo37/Ag0sWOnDwkMJI85Z9+9Svo/zRrY7eW5luJfvOnW8GepYop0Zz4yb0fBo0FFpdkXd0fRnuqk972TN0fVs2K1Vg6WNtrfv38AXBgQAIfkECQ8AAAAsCAAMACwALACBAAAAlvARAAAAAAAACKAAAQgcSFBggIMIEypUWLChw4YLI0Z8SNGhxIsIK2ociBHjxo0dL37UGFLiyIolJ558mHLhSoItS66MGXImTY8nb+IcafKlz54+bboMKpQh0Zwqj34Eq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AAAsCAAMACwALACBAAAAlvARAAAAAAAACKAAAQgcSFBggIMIEypUWLChw4YLI0Z8SNGhxIsIK2ociBHjxo0dL37UGFLiyIolJ558mHLhSoItS66MGXImTY8nb+IcafKlz54+bboMKpQh0Zwqj34EqpRk0qYon0JlqZMpyKpSnWI1ynMr14Jew4odS7as2bNo06pduxMs2aJh4XqVu5UuVrtV8erUe5NvAKpDu7aFmTXqYI6FKda0mDggACH5BAktAAAALAgACAAsADAAgQAAAJbwEQAAAAAAAAixAAEIHEhQYICDCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHGnypc+ePm26DCqUIdGcKo9+BKqUZNKmKJ9CZamTKciqUp1iNcpzK9eCXsOKHUu2rNmzaNOqXbsTLNmiYeF6lbuVLla7VfHq1HuTbwCqQ7u2hZk16mCOhSnWtJgYsEjGgZd2dJzQL+WMSA8bTBwQACH5BAkPAAAALAgACAAsADAAgQAAAJbwEQAAAAAAAAiwAAEIHEhQYICDCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHKlTZM6eKnkCdflzaEKbRF++NKl0adCmQpNC/WiUYdGqAZBi1VqVJdavYMOKHUu2rNmzaIF6/crVaNuhb9Ve7TrXbV24d+VG9QnxKciOa63uZdpX6t+dBQlTBWzRL0nGhQUvRgzTMUrIiS0DCAgAOw==";
6
6
  /** idle-light: the dark bug, for the light theme. */
7
- export declare const BUG_GIF_ON_LIGHT = "data:image/gif;base64,R0lGODlhPAA8AIEAAAAAAB0dHQAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJLQAAACwAAAAAPAA8AAAI3AABCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjwQDiBxJsmRJkAhNqlSJ8uDKlyNbGoQJU2ZBmi9thsTJUqdAnj19AjVpcyhPkEZxIk1a8yPTph5X+nQodSrDqlYVYs2aMihXl16/3gwrduDWsmafnt2odq3GtmTfwj15cW5biHbV4s3LdC9fo37/Ag0sWOnDwkMJI85Z9+9Svo/zRrY7eW5luJfvOnW8GepYop0Zz4yb0fBo0FFpdkXd0fRnuqk972TN0fVs2K1Vg6WNtrfv38AXBgQAIfkECQ8AAAAsCAAMACwALACBAAAAHR0dAAAAAAAACKAAAQgcSFBggIMIEypUWLChw4YLI0Z8SNGhxIsIK2ociBHjxo0dL37UGFLiyIolJ558mHLhSoItS66MGXImTY8nb+IcafKlz54+bboMKpQh0Zwqj34EqpRk0qYon0JlqZMpyKpSnWI1ynMr14Jew4odS7as2bNo06pduxMs2aJh4XqVu5UuVrtV8erUe5NvAKpDu7aFmTXqYI6FKda0mDggACH5BAktAAAALAgACAAsADAAgQAAAB0dHQAAAAAAAAixAAEIHEhQYICDCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHGnypc+ePm26DCqUIdGcKo9+BKqUZNKmKJ9CZamTKciqUp1iNcpzK9eCXsOKHUu2rNmzaNOqXbsTLNmiYeF6lbuVLla7VfHq1HuTbwCqQ7u2hZk16mCOhSnWtJgYsEjGgZd2dJzQL+WMSA8bTBwQACH5BAkPAAAALAgACAAsADAAgQAAAB0dHQAAAAAAAAiwAAEIHEhQYICDCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHKlTZM6eKnkCdflzaEKbRF++NKl0adCmQpNC/WiUYdGqAZBi1VqVJdavYMOKHUu2rNmzaIF6/crVaNuhb9Ve7TrXbV24d+VG9QnxKciOa63uZdpX6t+dBQlTBWzRL0nGhQUvRgzTMUrIiS0DCAgAOw==";
7
+ export declare const BUG_GIF_ON_LIGHT = "data:image/gif;base64,R0lGODlhPAA8AIEAAAAAAB0dHQAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJkAEAACwAAAAAPA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hQUvRgzTMUrIiS0DCAgAOw==";
8
8
  /** The GIFs' first frame, the bug at rest, on the same 15 × 15 grid. */
9
9
  export declare const BUG_REST_PATH = "M5 2h5v2H5zM4 4h7v1H4zM4 5h2v2H4zM4 7h7v5H4zM2 8h11v2H2zM4 12h3v2H4zM9 12h2v2H9z";
10
10
  /** That still frame in one color, as an SVG `data:` URL, for readers who prefer less motion. */
@@ -1,17 +1,18 @@
1
1
  /*
2
2
  * screw-bugs' animated idle bug, the brand mark in both pages' top bar. Two 60 × 60 GIFs from the
3
3
  * design handover (idle-dark: a lime bug for the dark theme; idle-light: a dark bug for the light
4
- * theme), 4 frames (450 / 150 / 450 / 150 ms) of a bug on a 15 × 15 cell grid, 4 px per cell, on a
5
- * transparent background. Embedded as base64 (generated once with `base64 -w0 idle-*.gif`), so
4
+ * theme; the "long" idle), 4 frames (4000 / 150 / 450 / 150 ms: the bug rests, then moves) of a
5
+ * bug on a 15 × 15 cell grid, 4 px per cell, on a transparent background. Embedded as base64
6
+ * (generated once with `base64 -w0 idle-*-long.gif`), so
6
7
  * each page stays one file that loads no image; the CSP allows `data:` images.
7
8
  */
8
9
  /** The bug's color in each GIF, sampled from its palette. */
9
10
  export const BUG_LIME = '#96F011';
10
11
  export const BUG_DARK = '#1D1D1D';
11
12
  /** idle-dark: the lime bug, for the dark theme. */
12
- export const BUG_GIF_ON_DARK = 'data:image/gif;base64,R0lGODlhPAA8AIEAAAAAAJbwEQAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJLQAAACwAAAAAPAA8AAAI3AABCBxIsKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjwQDiBxJsmRJkAhNqlSJ8uDKlyNbGoQJU2ZBmi9thsTJUqdAnj19AjVpcyhPkEZxIk1a8yPTph5X+nQodSrDqlYVYs2aMihXl16/3gwrduDWsmafnt2odq3GtmTfwj15cW5biHbV4s3LdC9fo37/Ag0sWOnDwkMJI85Z9+9Svo/zRrY7eW5luJfvOnW8G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Anj19AjVpcyhPkEZxIk1a8yPTph5X+nQodSrDqlYVYs2aMihXl16/3gwrduDWsmafnt2odq3GtmTfwj15cW5biHbV4s3LdC9fo37/Ag0sWOnDwkMJI85Z9+9Svo/zRrY7eW5luJfvOnW8GepYop0Zz4yb0fBo0FFpdkXd0fRnuqk972TN0fVs2K1Vg6WNtrfv38AXBgQAIfkECQ8AAAAsCAAMACwALACBAAAAlvARAAAAAAAACKAAAQgcSFBggIMIEypUWLChw4YLI0Z8SNGhxIsIK2ociBHjxo0dL37UGFLiyIolJ558mHLhSoItS66MGXImTY8nb+IcafKlz54+bboMKpQh0Zwqj34EqpRk0qYon0JlqZMpyKpSnWI1ynMr14Jew4odS7as2bNo06pduxMs2aJh4XqVu5UuVrtV8erUe5NvAKpDu7aFmTXqYI6FKda0mDggACH5BAktAAAALAgACAAsADAAgQAAAJbwEQAAAAAAAAixAAEIHEhQYICDCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHGnypc+ePm26DCqUIdGcKo9+BKqUZNKmKJ9CZamTKciqUp1iNcpzK9eCXsOKHUu2rNmzaNOqXbsTLNmiYeF6lbuVLla7VfHq1HuTbwCqQ7u2hZk16mCOhSnWtJgYsEjGgZd2dJzQL+WMSA8bTBwQACH5BAkPAAAALAgACAAsADAAgQAAAJbwEQAAAAAAAAiwAAEIHEhQYICDCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHKlTZM6eKnkCdflzaEKbRF++NKl0adCmQpNC/WiUYdGqAZBi1VqVJdavYMOKHUu2rNmzaIF6/crVaNuhb9Ve7TrXbV24d+VG9QnxKciOa63uZdpX6t+dBQlTBWzRL0nGhQUvRgzTMUrIiS0DCAgAOw==';
13
14
  /** idle-light: the dark bug, for the light theme. */
14
- export const BUG_GIF_ON_LIGHT = 'data:image/gif;base64,R0lGODlhPAA8AIEA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DCBMqVFiwocOGCyNGfEjRocSLCCtqHIgR48aNHS9+1BhS4siKJSeefJhy4UqCLUuujBlyJk2PJ2/iHKlTZM6eKnkCdflzaEKbRF++NKl0adCmQpNC/WiUYdGqAZBi1VqVJdavYMOKHUu2rNmzaIF6/crVaNuhb9Ve7TrXbV24d+VG9QnxKciOa63uZdpX6t+dBQlTBWzRL0nGhQUvRgzTMUrIiS0DCAgAOw==';
15
16
  /** The GIFs' first frame, the bug at rest, on the same 15 × 15 grid. */
16
17
  export const BUG_REST_PATH = 'M5 2h5v2H5zM4 4h7v1H4zM4 5h2v2H4zM4 7h7v5H4zM2 8h11v2H2zM4 12h3v2H4zM9 12h2v2H9z';
17
18
  /** That still frame in one color, as an SVG `data:` URL, for readers who prefer less motion. */
@@ -19,7 +19,7 @@ import { type RenderOptions } from './assets.js';
19
19
  * failed. Without script: the video has its own controls, timecodes open the video at their time
20
20
  * and screenshots open the image.
21
21
  */
22
- export declare const REPORT_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.top');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nconst setTheme=m=>{r.dataset.theme=m;d.querySelectorAll('[data-theme-set]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.themeSet===m)))};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst chrome=()=>{\n setTheme(r.dataset.theme);\n d.querySelectorAll('.theme').forEach(t=>{t.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n e.textContent=p.month+' '+p.day+', '+p.year+' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute;\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.addEventListener('click',e=>{const b=e.target.closest('[data-theme-set]');if(!b)return;setTheme(b.dataset.themeSet);try{localStorage.setItem(K,b.dataset.themeSet)}catch(x){}});\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),empty=d.getElementById(p+'-none');let cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>v.play().catch(()=>{}));v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{if(!v.error)return;dead.add(cur);if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n if(!d.fullscreenEnabled||!screen.requestFullscreen)full.hidden=true;\n else{full.addEventListener('click',()=>{if(d.fullscreenElement)d.exitFullscreen().catch(()=>{});else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',()=>{const f=d.fullscreenElement===screen;full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nconst badImg=i=>{const f=i.closest('figure');if(!f||f.classList.contains('broken'))return;f.classList.add('broken');f.querySelectorAll('.unloaded').forEach(u=>u.removeAttribute('aria-hidden'))};\nconst scan=()=>d.querySelectorAll('figure img').forEach(i=>{if(i.complete&&i.naturalWidth===0)badImg(i)});\nd.addEventListener('error',e=>{const t=e.target;if(t instanceof Element&&t.matches('figure img'))badImg(t)},true);\naddEventListener('load',scan);\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();scan();\n const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];\n const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');\n const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;\n const timed=c=>!!c&&c.dataset.t0!==undefined;\n const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];\n const shown=()=>cards.filter(c=>!c.hidden);\n const line=()=>{const b=topEdge();if(matchMedia('(max-width: 900px)').matches){const s=d.querySelector('.rp-left');return s?s.getBoundingClientRect().bottom+24:b+120}return Math.round(b+(innerHeight-b)*0.3)};\n const playable=c=>timed(c)&&!!P&&P.has(c.dataset.s);\n const chip=c=>{if(!playable(c)||P.down()!==null)return '';const s=span(c);return (loop?'Looping ':'Playing ')+clock(s[0])+dash+clock(s[1])};\n const paintNow=()=>{\n if(!np||!cur)return;\n np.querySelector('.np-st').replaceChildren(cur.querySelector('.case-head .st').cloneNode(true));\n np.querySelector('.np-n').textContent=cur.dataset.i+' / '+N;\n np.querySelector('.np-title').textContent=cur.querySelector('.case-go').textContent;\n np.querySelector('.np-status').textContent=cur.dataset.label+': ';\n const ch=np.querySelector('.np-chip'),t=chip(cur);ch.querySelector('span').textContent=t||'No video';ch.classList.toggle('none',!t);\n };\n const toCard=c=>{lock=Date.now()+700;const y=c.getBoundingClientRect().top+scrollY-line()+2;scrollTo({top:Math.max(0,y),behavior:still()?'auto':'smooth'})};\n const setCurrent=(c,seek,scroll)=>{\n if(!c)return;\n if(c!==cur){if(cur){cur.classList.remove('on');cur.removeAttribute('aria-current')}cur=c;c.classList.add('on');c.setAttribute('aria-current','true');segs.forEach(x=>x.classList.toggle('on',x.dataset.case===c.dataset.id));paintNow()}\n if(seek&&P){if(playable(c)){const a=span(c)[0];lastT=a;P.load(c.dataset.s,a,P.playing())}else P.none()}\n if(scroll)toCard(c);\n };\n const caseAt=(s,t)=>{let f=null;for(const c of shown()){if(timed(c)&&c.dataset.s===s){const x=span(c);if(t>=x[0]&&t<x[1])f=c}}return f};\n const onScroll=()=>{\n if(Date.now()<lock)return;const vis=shown();if(!vis.length)return;\n const L=line();let pick=vis[0];for(const c of vis){if(c.getBoundingClientRect().top<=L)pick=c}\n const last=vis[vis.length-1];if(innerHeight+scrollY>=r.scrollHeight-2&&last.getBoundingClientRect().bottom<=innerHeight)pick=last;\n if(pick!==cur)setCurrent(pick,true,false);\n };\n const stk=d.querySelector('.rp-sticky'),head=d.querySelector('.rp-head');\n const fit=()=>{if(stk)stk.style.setProperty('--rp-top',Math.round(stk.getBoundingClientRect().top)+'px')};\n fit();addEventListener('resize',fit);addEventListener('load',fit);\n if(head&&window.ResizeObserver)new ResizeObserver(fit).observe(head);\n addEventListener('scroll',()=>{if(!sr)sr=requestAnimationFrame(()=>{sr=0;fit();onScroll()})},{passive:true});\n if(d.getElementById('rp-video'))P=player('rp',{\n broken:paintNow,fine:paintNow,\n tick:t=>{\n if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();\n if(loop){if(timed(cur)&&cur.dataset.s===s){const x=span(cur);if(!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}}}\n else{const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}\n lastT=t;\n },\n seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},\n ended:()=>{\n if(!cur)return false;\n if(loop&&timed(cur)&&cur.dataset.s===P.cur()){P.load(P.cur(),span(cur)[0],true);return true}\n if(!loop){const later=shown().find(c=>timed(c)&&Number(c.dataset.s)>Number(P.cur())&&P.has(c.dataset.s));if(later){setCurrent(later,false,true);P.load(later.dataset.s,span(later)[0],true);return true}}\n return false;\n },\n });\n if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});\n const filter=f=>{\n d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));\n cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});\n segs.forEach(x=>{const c=cards.find(k=>k.dataset.id===x.dataset.case);x.classList.toggle('off',!!c&&c.hidden)});\n if(cur&&cur.hidden)setCurrent(shown()[0],true,false);\n };\n d.querySelectorAll('[data-filter]').forEach(b=>b.addEventListener('click',()=>filter(b.dataset.filter)));\n d.querySelectorAll('.filters').forEach(f=>f.classList.add('live'));\n let vCase=null,vIdx=0,opener=null;\n const q=s=>dlg.querySelector(s);\n const list=c=>{const t=c&&c.querySelector('template.shots');return t?[...t.content.children]:[]};\n const showShot=()=>{\n const l=list(vCase),f=l[vIdx];if(!f)return;\n q('.v-body').replaceChildren(f.cloneNode(true));\n q('.v-st').replaceChildren(vCase.querySelector('.case-head .st').cloneNode(true));\n q('.v-title').textContent=vCase.querySelector('.case-go').textContent;\n q('.v-what').textContent=f.dataset.cap+(l.length>1?' ('+(vIdx+1)+' of '+l.length+')':'');\n q('.v-prev').disabled=vIdx===0;q('.v-next').disabled=vIdx>=l.length-1;scan();\n };\n if(dlg){\n q('.v-prev').addEventListener('click',()=>{if(vIdx>0){vIdx--;showShot()}});\n q('.v-next').addEventListener('click',()=>{if(vIdx<list(vCase).length-1){vIdx++;showShot()}});\n q('.v-close').addEventListener('click',()=>dlg.close());\n dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});\n dlg.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();q('.v-prev').click()}else if(e.key==='ArrowRight'){e.preventDefault();q('.v-next').click()}});\n dlg.addEventListener('close',()=>{q('.v-body').replaceChildren();if(opener&&opener.isConnected)opener.focus()});\n }\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const tc=t.closest('a.tc[data-t]');\n if(tc){if(!P||!P.has(tc.dataset.s))return;e.preventDefault();const s=tc.dataset.s,at=Number(tc.dataset.t),c=caseAt(s,at)||tc.closest('.case')||(dlg&&dlg.open?vCase:null);if(dlg&&dlg.open)dlg.close();if(c)setCurrent(c,false,!tc.closest('.case'));lastT=at;P.load(s,at,P.playing());return}\n const go=t.closest('a[href^=\"#case-\"]');\n if(go){const c=d.getElementById(go.getAttribute('href').slice(1));if(!c||!c.matches('.case[data-i]'))return;e.preventDefault();if(c.hidden)filter('all');toCard(c);setCurrent(c,true,false);return}\n const shot=t.closest('[data-shot]');\n if(shot&&dlg&&dlg.showModal){e.preventDefault();opener=shot;vCase=shot.closest('.case');vIdx=Number(shot.dataset.shot)||0;showShot();dlg.showModal();q('.v-close').focus();return}\n const c=t.closest('.case[data-i]');\n if(!c||t.closest('a,summary,details,input,label')||(t.closest('button')&&!t.closest('.case-go')))return;\n toCard(c);setCurrent(c,true,false);\n });\n const first=cards.find(c=>timed(c)&&(!P||P.has(c.dataset.s)))||cards[0];\n if(first){setCurrent(first,false,false);if(timed(first))lastT=span(first)[0]}\n});\n})();";
22
+ export declare const REPORT_SCRIPT = "(()=>{const d=document,r=d.documentElement,K='screw-bugs-theme';\nconst still=()=>matchMedia('(prefers-reduced-motion: reduce)').matches;\nconst topEdge=()=>{const b=d.querySelector('.top');return b?Math.max(0,b.getBoundingClientRect().bottom):0};\nconst pad=n=>String(n).padStart(2,'0');\nconst clock=s=>{s=Math.max(0,Math.floor(s||0));const h=Math.floor(s/3600),m=Math.floor(s%3600/60);return(h?h+':'+pad(m):String(m))+':'+pad(s%60)};\nconst setTheme=m=>{r.dataset.theme=m;d.querySelectorAll('[data-theme-set]').forEach(b=>b.setAttribute('aria-pressed',String(b.dataset.themeSet===m)))};\nlet theme='system';try{theme=localStorage.getItem(K)||theme}catch(e){}r.dataset.theme=theme;\nconst chrome=()=>{\n setTheme(r.dataset.theme);\n d.querySelectorAll('.theme').forEach(t=>{t.hidden=false});\n if(location.protocol==='http:'&&(location.hostname==='127.0.0.1'||location.hostname==='localhost'))d.querySelectorAll('a.share-btn').forEach(a=>{a.hidden=false});\n d.querySelectorAll('time.when[datetime]').forEach(e=>{\n const t=new Date(e.getAttribute('datetime'));if(isNaN(t.getTime()))return;const p={};\n try{new Intl.DateTimeFormat('en-US',{month:'short',day:'numeric',year:'numeric',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(t).forEach(x=>{p[x.type]=x.value});\n e.textContent=p.month+' '+p.day+', '+p.year+' '+String.fromCharCode(183)+' '+p.hour+':'+p.minute;\n e.title=new Intl.DateTimeFormat('en-US',{dateStyle:'full',timeStyle:'long'}).format(t)}catch(x){}\n });\n d.addEventListener('click',e=>{const b=e.target.closest('[data-theme-set]');if(!b)return;setTheme(b.dataset.themeSet);try{localStorage.setItem(K,b.dataset.themeSet)}catch(x){}});\n d.querySelectorAll('.prompt').forEach(p=>{\n const t=p.querySelector('.prompt-text'),b=p.querySelector('.prompt-more');if(!t||!b)return;\n const fits=()=>{if(!p.classList.contains('open'))b.hidden=t.scrollHeight<=t.clientHeight+1};\n fits();if(window.ResizeObserver)new ResizeObserver(fits).observe(t);if(d.fonts&&d.fonts.ready)d.fonts.ready.then(fits);\n b.addEventListener('click',()=>{const o=p.classList.toggle('open');b.textContent=o?'Show less':'Show full prompt';b.setAttribute('aria-expanded',String(o));fits()});\n });\n};\nconst bare=u=>{const i=u.indexOf('://');return i<0?u:u.slice(i+3)};\nconst player=(p,o)=>{\n const v=d.getElementById(p+'-video'),fig=v.closest('.player'),note=d.getElementById(p+'-unloaded'),c=d.getElementById(p+'-controls'),url=d.getElementById(p+'-url');\n const srcs=new Map([...fig.querySelectorAll('[data-session-src]')].map(e=>[e.dataset.session,e.dataset.sessionSrc]));\n const order=[...srcs.keys()];\n const urls=[...fig.querySelectorAll('[data-url]')].map(e=>({s:e.dataset.s,t:Number(e.dataset.at),u:e.dataset.url}));\n const dead=new Set(),empty=d.getElementById(p+'-none');let cur=v.dataset.session,down=null,held=false,ask=0,auto=false,rate=1,raf=0,drag=false;\n const play=c.querySelector('.play'),now=c.querySelector('.now'),total=c.querySelector('.total'),bar=c.querySelector('.scrub'),head=c.querySelector('.head'),tracks=[...c.querySelectorAll('.track')];\n v.removeAttribute('controls');c.hidden=false;\n const big=d.getElementById(p+'-start');\n if(big){big.hidden=false;big.addEventListener('click',()=>{grow();v.play().catch(()=>{})});v.addEventListener('play',()=>big.remove(),{once:true})}\n const track=()=>tracks.find(t=>t.dataset.s===cur);\n const len=()=>{const t=track(),n=t?Number(t.dataset.total):0;return n>0?n:(isFinite(v.duration)?v.duration:0)};\n const paint=()=>{\n const L=len(),t=v.currentTime,f=L?Math.min(1,t/L):0,k=track();\n tracks.forEach(x=>{x.hidden=x!==k});head.style.left=(f*100)+'%';\n const done=k&&k.querySelector('.done');if(done)done.style.width=(f*100)+'%';\n now.textContent=clock(t);total.textContent=clock(L);\n bar.setAttribute('aria-valuemax',String(Math.round(L)));bar.setAttribute('aria-valuenow',String(Math.round(t)));bar.setAttribute('aria-valuetext',clock(t)+' of '+clock(L));\n play.classList.toggle('playing',!v.paused);play.setAttribute('aria-label',v.paused?'Play':'Pause');\n if(url){let u='';if(down!=='')for(const x of urls){if(x.s===cur&&x.t<=t+0.02)u=x.u}url.textContent=bare(u);url.parentElement.title=u}\n };\n const update=()=>{paint();if(o.tick)o.tick(v.currentTime)};\n const frame=()=>{update();raf=v.paused?0:requestAnimationFrame(frame)};\n const show=s=>{if(down===null)held=!v.paused;down=s;v.pause();fig.classList.add('broken');c.hidden=true;if(empty)empty.hidden=true;if(note){note.hidden=false;const a=note.querySelector('a');if(a){a.href=srcs.get(s);a.textContent=srcs.get(s)}}if(o.broken)o.broken()};\n const fine=()=>{if(down===null)return;down=null;fig.classList.remove('broken');c.hidden=false;if(note)note.hidden=true;if(empty)empty.hidden=true;if(o.fine)o.fine()};\n const none=()=>{if(down===null)held=!v.paused;++ask;auto=false;down='';v.pause();fig.classList.add('broken');c.hidden=true;if(note)note.hidden=true;if(empty)empty.hidden=false;paint();if(o.broken)o.broken()};\n const playing=()=>down===null?!v.paused:held;\n const next=s=>order.slice(order.indexOf(s)+1).find(n=>!dead.has(n));\n const load=(s,t,go,a)=>{\n const my=++ask;auto=!!a;if(dead.has(s))return show(s);\n if(s!==cur||!v.currentSrc||v.error){cur=s;v.dataset.session=s;v.src=srcs.get(s);v.load()}\n const done=()=>{if(my!==ask)return;auto=false;fine();v.playbackRate=rate;v.currentTime=t;update();if(go)v.play().catch(()=>{})};\n if(v.readyState>0)done();else v.addEventListener('loadedmetadata',done,{once:true});\n };\n const bad=()=>{if(!v.error)return;dead.add(cur);if(down==='')return;const n=auto?next(cur):undefined;if(n!==undefined)return load(n,0,true,true);auto=false;show(cur)};\n ['timeupdate','seeked','loadedmetadata','pause','play','durationchange'].forEach(n=>v.addEventListener(n,update));\n v.addEventListener('play',()=>{if(!raf)raf=requestAnimationFrame(frame)});\n addEventListener('resize',update);\n v.addEventListener('error',bad);if(v.error)queueMicrotask(bad);\n v.addEventListener('ended',()=>{if(o.ended&&o.ended())return;const n=next(cur);if(n!==undefined)load(n,0,true,true)});\n play.addEventListener('click',()=>{if(v.paused)v.play().catch(()=>{});else v.pause()});\n v.addEventListener('click',()=>{if(down!==null)return;if(grow())v.play().catch(()=>{});else play.click()});\n c.querySelectorAll('[data-rate]').forEach(b=>b.addEventListener('click',()=>{rate=Number(b.dataset.rate);v.playbackRate=rate;v.defaultPlaybackRate=rate;c.querySelectorAll('[data-rate]').forEach(x=>x.setAttribute('aria-pressed',String(x===b)))}));\n const seek=t=>{const L=len();t=Math.max(0,L?Math.min(L,t):t);v.currentTime=t;if(o.seek)o.seek(t);update()};\n const at=e=>{const b=bar.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-b.left)/b.width))*len()};\n bar.addEventListener('pointerdown',e=>{if(e.button>0||down!==null)return;drag=true;bar.setPointerCapture(e.pointerId);seek(at(e))});\n bar.addEventListener('pointermove',e=>{if(drag)seek(at(e))});\n ['pointerup','pointercancel'].forEach(n=>bar.addEventListener(n,()=>{drag=false}));\n bar.addEventListener('keydown',e=>{\n const k=e.key,t=v.currentTime,by={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-10,PageUp:10}[k];\n const to=by!==undefined?t+by:k==='Home'?0:k==='End'?len():null;if(to===null)return;e.preventDefault();seek(to);\n });\n const full=c.querySelector('.full'),screen=o.full||fig.querySelector('.screen');\n const api=!!(d.fullscreenEnabled&&screen.requestFullscreen),inPage=()=>!!o.inPage&&(o.inPage()||!api);\n const mark=()=>{const f=d.fullscreenElement===screen||screen.classList.contains('focus');full.classList.toggle('out',f);full.setAttribute('aria-label',f?'Exit fullscreen':'Fullscreen');update()};\n let back=0;const focus=on=>{if(on)back=scrollY;screen.classList.toggle('focus',on);scrollTo({top:on?0:back,behavior:'auto'});mark()};\n const grow=()=>{if(!o.expand||!o.inPage||!o.inPage()||d.fullscreenElement||screen.classList.contains('focus'))return false;focus(true);return true};\n if(!api&&!o.inPage)full.hidden=true;\n else{full.addEventListener('click',()=>{const f=screen.classList.contains('focus');if(d.fullscreenElement){d.exitFullscreen().catch(()=>{});if(f)focus(false)}else if(f)focus(false);else if(inPage())focus(true);else screen.requestFullscreen().catch(()=>{})});\n d.addEventListener('fullscreenchange',mark);\n d.addEventListener('keydown',e=>{if(e.key==='Escape'&&!e.defaultPrevented&&screen.classList.contains('focus')&&!d.querySelector('dialog[open]')){e.preventDefault();focus(false)}})}\n d.addEventListener('keydown',e=>{if(e.key!==' '||down!==null||e.defaultPrevented||d.querySelector('dialog[open]')||e.target.closest('button,a,input,textarea,select,summary,[role=slider]'))return;e.preventDefault();play.click()});\n return {v,load,none,playing,update,len,cur:()=>cur,down:()=>down,has:s=>srcs.has(s)};\n};\n\nconst badImg=i=>{const f=i.closest('figure');if(!f||f.classList.contains('broken'))return;f.classList.add('broken');f.querySelectorAll('.unloaded').forEach(u=>u.removeAttribute('aria-hidden'))};\nconst scan=()=>d.querySelectorAll('figure img').forEach(i=>{if(i.complete&&i.naturalWidth===0)badImg(i)});\nd.addEventListener('error',e=>{const t=e.target;if(t instanceof Element&&t.matches('figure img'))badImg(t)},true);\naddEventListener('load',scan);\nd.addEventListener('DOMContentLoaded',()=>{\n chrome();scan();\n const cards=[...d.querySelectorAll('.case[data-i]')],segs=[...d.querySelectorAll('.seg[data-case]')];\n const np=d.getElementById('rp-now'),loopB=d.getElementById('rp-loop'),dlg=d.getElementById('viewer');\n const N=cards.length,dash=String.fromCharCode(8211);let cur=null,loop=true,lock=0,lastT=0,P=null,sr=0;\n const timed=c=>!!c&&c.dataset.t0!==undefined;\n const span=c=>[Number(c.dataset.t0),Number(c.dataset.t1)];\n const shown=()=>cards.filter(c=>!c.hidden);\n const line=()=>{const b=topEdge();if(matchMedia('(max-width: 900px)').matches){const s=d.querySelector('.rp-left');return s?s.getBoundingClientRect().bottom+24:b+120}return Math.round(b+(innerHeight-b)*0.3)};\n const playable=c=>timed(c)&&!!P&&P.has(c.dataset.s);\n const chip=c=>{if(!playable(c)||P.down()!==null)return '';const s=span(c);return (loop?'Looping ':'Playing ')+clock(s[0])+dash+clock(s[1])};\n const paintNow=()=>{\n if(!np||!cur)return;\n np.querySelector('.np-st').replaceChildren(cur.querySelector('.case-head .st').cloneNode(true));\n np.querySelector('.np-n').textContent=cur.dataset.i+' / '+N;\n np.querySelector('.np-title').textContent=cur.querySelector('.case-go').textContent;\n np.querySelector('.np-status').textContent=cur.dataset.label+': ';\n const ch=np.querySelector('.np-chip'),t=chip(cur);ch.querySelector('span').textContent=t||'No video';ch.classList.toggle('none',!t);\n };\n const toCard=c=>{lock=Date.now()+700;const y=c.getBoundingClientRect().top+scrollY-line()+2;scrollTo({top:Math.max(0,y),behavior:still()?'auto':'smooth'})};\n const setCurrent=(c,seek,scroll)=>{\n if(!c)return;\n if(c!==cur){if(cur){cur.classList.remove('on');cur.removeAttribute('aria-current')}cur=c;c.classList.add('on');c.setAttribute('aria-current','true');segs.forEach(x=>x.classList.toggle('on',x.dataset.case===c.dataset.id));paintNow()}\n if(seek&&P){if(playable(c)){const a=span(c)[0];lastT=a;P.load(c.dataset.s,a,P.playing())}else P.none()}\n if(scroll)toCard(c);\n };\n const caseAt=(s,t)=>{let f=null;for(const c of shown()){if(timed(c)&&c.dataset.s===s){const x=span(c);if(t>=x[0]&&t<x[1])f=c}}return f};\n const onScroll=()=>{\n if(Date.now()<lock)return;const vis=shown();if(!vis.length)return;\n const L=line();let pick=vis[0];for(const c of vis){if(c.getBoundingClientRect().top<=L)pick=c}\n const last=vis[vis.length-1];if(innerHeight+scrollY>=r.scrollHeight-2&&last.getBoundingClientRect().bottom<=innerHeight)pick=last;\n if(pick!==cur)setCurrent(pick,true,false);\n };\n const stk=d.querySelector('.rp-sticky'),head=d.querySelector('.rp-head');\n const fit=()=>{if(stk)stk.style.setProperty('--rp-top',Math.round(stk.getBoundingClientRect().top)+'px')};\n fit();addEventListener('resize',fit);addEventListener('load',fit);\n if(head&&window.ResizeObserver)new ResizeObserver(fit).observe(head);\n addEventListener('scroll',()=>{if(!sr)sr=requestAnimationFrame(()=>{sr=0;fit();onScroll()})},{passive:true});\n if(d.getElementById('rp-video'))P=player('rp',{\n broken:paintNow,fine:paintNow,\n tick:t=>{\n if(!cur||P.down()!==null||P.v.seeking)return;const s=P.cur();\n if(loop){if(timed(cur)&&cur.dataset.s===s){const x=span(cur);if(!P.v.paused&&t>=x[1]-0.03&&lastT<x[1]){lastT=x[0];P.v.currentTime=x[0];return}}}\n else{const c=caseAt(s,t);if(c&&c!==cur)setCurrent(c,false,true)}\n lastT=t;\n },\n seek:t=>{lastT=t;const c=caseAt(P.cur(),t);if(c&&c!==cur)setCurrent(c,false,true)},\n ended:()=>{\n if(!cur)return false;\n if(loop&&timed(cur)&&cur.dataset.s===P.cur()){P.load(P.cur(),span(cur)[0],true);return true}\n if(!loop){const later=shown().find(c=>timed(c)&&Number(c.dataset.s)>Number(P.cur())&&P.has(c.dataset.s));if(later){setCurrent(later,false,true);P.load(later.dataset.s,span(later)[0],true);return true}}\n return false;\n },\n });\n if(loopB)loopB.addEventListener('click',()=>{loop=!loop;loopB.setAttribute('aria-pressed',String(loop));paintNow()});\n const filter=f=>{\n d.querySelectorAll('[data-filter]').forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.filter===f)));\n cards.forEach(c=>{c.hidden=!(f==='all'||c.dataset.status===f)});\n segs.forEach(x=>{const c=cards.find(k=>k.dataset.id===x.dataset.case);x.classList.toggle('off',!!c&&c.hidden)});\n if(cur&&cur.hidden)setCurrent(shown()[0],true,false);\n };\n d.querySelectorAll('[data-filter]').forEach(b=>b.addEventListener('click',()=>filter(b.dataset.filter)));\n d.querySelectorAll('.filters').forEach(f=>f.classList.add('live'));\n let vCase=null,vIdx=0,opener=null;\n const q=s=>dlg.querySelector(s);\n const list=c=>{const t=c&&c.querySelector('template.shots');return t?[...t.content.children]:[]};\n const showShot=()=>{\n const l=list(vCase),f=l[vIdx];if(!f)return;\n q('.v-body').replaceChildren(f.cloneNode(true));\n q('.v-st').replaceChildren(vCase.querySelector('.case-head .st').cloneNode(true));\n q('.v-title').textContent=vCase.querySelector('.case-go').textContent;\n q('.v-what').textContent=f.dataset.cap+(l.length>1?' ('+(vIdx+1)+' of '+l.length+')':'');\n q('.v-prev').disabled=vIdx===0;q('.v-next').disabled=vIdx>=l.length-1;scan();\n };\n if(dlg){\n q('.v-prev').addEventListener('click',()=>{if(vIdx>0){vIdx--;showShot()}});\n q('.v-next').addEventListener('click',()=>{if(vIdx<list(vCase).length-1){vIdx++;showShot()}});\n q('.v-close').addEventListener('click',()=>dlg.close());\n dlg.addEventListener('click',e=>{if(e.target===dlg)dlg.close()});\n dlg.addEventListener('keydown',e=>{if(e.key==='ArrowLeft'){e.preventDefault();q('.v-prev').click()}else if(e.key==='ArrowRight'){e.preventDefault();q('.v-next').click()}});\n dlg.addEventListener('close',()=>{q('.v-body').replaceChildren();if(opener&&opener.isConnected)opener.focus()});\n }\n d.addEventListener('click',e=>{\n const t=e.target;if(!(t instanceof Element))return;\n const tc=t.closest('a.tc[data-t]');\n if(tc){if(!P||!P.has(tc.dataset.s))return;e.preventDefault();const s=tc.dataset.s,at=Number(tc.dataset.t),c=caseAt(s,at)||tc.closest('.case')||(dlg&&dlg.open?vCase:null);if(dlg&&dlg.open)dlg.close();if(c)setCurrent(c,false,!tc.closest('.case'));lastT=at;P.load(s,at,P.playing());return}\n const go=t.closest('a[href^=\"#case-\"]');\n if(go){const c=d.getElementById(go.getAttribute('href').slice(1));if(!c||!c.matches('.case[data-i]'))return;e.preventDefault();if(c.hidden)filter('all');toCard(c);setCurrent(c,true,false);return}\n const shot=t.closest('[data-shot]');\n if(shot&&dlg&&dlg.showModal){e.preventDefault();opener=shot;vCase=shot.closest('.case');vIdx=Number(shot.dataset.shot)||0;showShot();dlg.showModal();q('.v-close').focus();return}\n const c=t.closest('.case[data-i]');\n if(!c||t.closest('a,summary,details,input,label')||(t.closest('button')&&!t.closest('.case-go')))return;\n toCard(c);setCurrent(c,true,false);\n });\n const first=cards.find(c=>timed(c)&&(!P||P.has(c.dataset.s)))||cards[0];\n if(first){setCurrent(first,false,false);if(timed(first))lastT=span(first)[0]}\n});\n})();";
23
23
  /**
24
24
  * Images and video load from the run folder by relative path (`'self'`, and `file:` for a report
25
25
  * opened from disk); styles are inline, but for Google Fonts' stylesheet, whose fonts come from
@@ -2,6 +2,7 @@
2
2
  export declare const LUCIDE_SOURCE = "lucide-static@1.70.0";
3
3
  /** Each icon's inner elements, on Lucide's 24 × 24 grid, exactly as Lucide ships them. */
4
4
  export declare const ICONS: {
5
+ readonly 'arrow-right': '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>';
5
6
  readonly check: '<path d="M20 6 9 17l-5-5"/>';
6
7
  readonly 'chevron-left': '<path d="m15 18-6-6 6-6"/>';
7
8
  readonly 'chevron-right': '<path d="m9 18 6-6-6-6"/>';
@@ -49,6 +49,7 @@
49
49
  export const LUCIDE_SOURCE = 'lucide-static@1.70.0';
50
50
  /** Each icon's inner elements, on Lucide's 24 × 24 grid, exactly as Lucide ships them. */
51
51
  export const ICONS = {
52
+ 'arrow-right': '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',
52
53
  check: '<path d="M20 6 9 17l-5-5"/>',
53
54
  'chevron-left': '<path d="m15 18-6-6 6-6"/>',
54
55
  'chevron-right': '<path d="m9 18 6-6-6-6"/>',
@@ -5,3 +5,4 @@ export { stepText } from './view.js';
5
5
  export { hex, hmacSha256, sha256 } from './sha256.js';
6
6
  export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
7
7
  export { AssetBaseUrl, type RenderOptions } from './assets.js';
8
+ export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
@@ -5,3 +5,4 @@ export { stepText } from './view.js';
5
5
  export { hex, hmacSha256, sha256 } from './sha256.js';
6
6
  export { renderWalkthrough, WALKTHROUGH_CSP, WALKTHROUGH_SCRIPT, walkthroughCsp, } from './walkthrough.js';
7
7
  export { AssetBaseUrl } from './assets.js';
8
+ export { renderSignInPage, SIGN_IN_CSP, SIGN_IN_SCRIPT } from './sign-in.js';
@@ -39,6 +39,8 @@ export declare const REPO_URL = "https://github.com/uxstudioteam/screw-bugs";
39
39
  export declare const statusIcon: (status: CaseStatus) => Markup;
40
40
  /** A status as an icon and its words, such as ✕ Failed. */
41
41
  export declare const statusTag: (status: CaseStatus) => Markup;
42
+ /** The bug of each theme (`bugMark`), for the top bars. */
43
+ export declare const brandMark: Markup;
42
44
  /**
43
45
  * Where a page's Share button starts sharing its run on screw-bugs Cloud: a route of the local
44
46
  * report server (`src/cli/share.ts`), by absolute path, so it is the server the page came from.