clearotron 0.7.0 → 0.8.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/THIRD-PARTY-NOTICES.md +71 -2
  2. package/build-info.json +2 -2
  3. package/demo/multi-country-focus-search/run/common-law-grid.json +1 -1
  4. package/docs/CLIENT-MCP.md +17 -0
  5. package/docs/assets/README.md +19 -3
  6. package/docs/assets/portal-clearance-report.jpg +0 -0
  7. package/docs/assets/portal-conflict-landscape.jpg +0 -0
  8. package/docs/assets/portal-new-clearance.png +0 -0
  9. package/driver/CHANGELOG.md +48 -0
  10. package/driver/config-inventory.mjs +15 -2
  11. package/driver/dev-portal.mjs +2 -0
  12. package/driver/effort-model.mjs +34 -4
  13. package/driver/engine/CONTRACT.md +8 -0
  14. package/driver/engine/anthropic-agent.mjs +74 -16
  15. package/driver/engine/jx-turn.mjs +11 -3
  16. package/driver/engine/openai-agent.mjs +33 -7
  17. package/driver/engine/run-choices.mjs +28 -7
  18. package/driver/engine/speed.mjs +107 -0
  19. package/driver/enqueue-schema.mjs +8 -0
  20. package/driver/enqueue.mjs +14 -2
  21. package/driver/jx-units.mjs +2 -2
  22. package/driver/jx.mjs +1 -1
  23. package/driver/knockout-plain-language.mjs +96 -0
  24. package/driver/ladder/attempt-record.mjs +14 -2
  25. package/driver/ladder/dispatch.mjs +2 -2
  26. package/driver/ladder/form-repair.mjs +1 -1
  27. package/driver/ladder/stage.mjs +7 -1
  28. package/driver/mark-logos.mjs +6 -1
  29. package/driver/order-receipt.mjs +184 -0
  30. package/driver/package.json +4 -1
  31. package/driver/picture-shrink-worker.mjs +21 -0
  32. package/driver/picture-thumbnail.mjs +132 -0
  33. package/driver/pipeline-knockout.mjs +14 -0
  34. package/driver/portal-confirmation.mjs +3 -0
  35. package/driver/portal-report.mjs +44 -1
  36. package/driver/portal-routes/run.mjs +19 -9
  37. package/driver/portal-runs.mjs +118 -63
  38. package/driver/portal-service.mjs +17 -2
  39. package/driver/predelivery-lint.mjs +3 -3
  40. package/driver/progress.mjs +33 -5
  41. package/driver/publish/column-queries.mjs +86 -0
  42. package/driver/publish/index.mjs +4 -4
  43. package/driver/publish/knockout.mjs +35 -8
  44. package/driver/publish/page-shell.mjs +5 -1
  45. package/driver/publish/read-document.mjs +3 -0
  46. package/driver/publish/render-knockout.mjs +61 -16
  47. package/driver/publish/render.mjs +171 -30
  48. package/driver/publish/search-depth.mjs +45 -1
  49. package/driver/publish/strings.mjs +23 -0
  50. package/driver/publish/templates/report.css +73 -0
  51. package/driver/research-answers.mjs +17 -6
  52. package/driver/research-checks.mjs +22 -4
  53. package/driver/research-records.mjs +81 -0
  54. package/driver/run-quote.mjs +3 -0
  55. package/driver/run-speed.mjs +89 -0
  56. package/driver/runner.mjs +50 -21
  57. package/driver/saved-register-pages.mjs +23 -22
  58. package/driver/stage-freshness.mjs +5 -0
  59. package/driver/stages.mjs +2 -2
  60. package/driver/steps/open-run.mjs +12 -1
  61. package/driver/suite-census.json +199 -37
  62. package/driver/tokens.mjs +3 -0
  63. package/driver/urgent-count.mjs +54 -0
  64. package/driver/usage-ledger.mjs +8 -2
  65. package/driver/web-pictures.mjs +532 -0
  66. package/mcp-server/CHANGELOG.md +16 -0
  67. package/mcp-server/lib/document-reads.mjs +28 -0
  68. package/mcp-server/lib/events.mjs +21 -12
  69. package/mcp-server/lib/findings.mjs +2 -1
  70. package/mcp-server/lib/knockout.mjs +3 -2
  71. package/mcp-server/lib/ops.mjs +103 -6
  72. package/mcp-server/lib/options.mjs +4 -0
  73. package/mcp-server/lib/plan.mjs +38 -4
  74. package/mcp-server/lib/result-shapes.mjs +66 -0
  75. package/mcp-server/lib/runs.mjs +46 -44
  76. package/mcp-server/lib/urgent.mjs +29 -0
  77. package/mcp-server/package.json +1 -1
  78. package/mcp-server/result-shapes.json +2978 -0
  79. package/mcp-server/server.mjs +67 -14
  80. package/package.json +4 -1
  81. package/portal-ui/dist/assets/{index-qNDhqCw9.js → index-DEkVU2FD.js} +1909 -766
  82. package/portal-ui/dist/assets/{index-CxAkJXIT.css → index-W6SAoDkS.css} +238 -1
  83. package/portal-ui/dist/index.html +2 -2
  84. package/portal-ui/package.json +1 -1
  85. package/providers/jx/src/turn-envelope.mjs +3 -1
  86. package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
  87. package/providers/oauth-mcp-bridge/package.json +1 -1
  88. package/providers/signa/src/core.js +54 -12
  89. package/scripts/README.md +3 -0
  90. package/scripts/e2e-first-time.mjs +2 -2
  91. package/scripts/mint-result-shapes.mjs +199 -0
  92. package/scripts/readme-pictures.mjs +227 -0
  93. package/scripts/render-check.mjs +4 -1
  94. package/scripts/report-sections-render-check.mjs +191 -0
  95. package/scripts/settings-render-check.mjs +68 -11
  96. package/shared/brand.mjs +8 -0
  97. package/skills/clearotron-account/SKILL.md +24 -0
  98. package/skills/clearotron-ops/SKILL.md +23 -9
@@ -11444,6 +11444,8 @@ function runKey(run) {
11444
11444
  return isGenericKey(run.account) && run.organisation ? genericFor(run.organisation) : run.account;
11445
11445
  }
11446
11446
  // src/contract/api.ts
11447
+ var lastRunStates = null;
11448
+ var lastSeenRunStates = () => lastRunStates;
11447
11449
  var isOk = (r) => r.kind === "ok";
11448
11450
  var companyRead = (needsOwner, read) => needsOwner ? Promise.resolve({ kind: "pickAccount" }) : read();
11449
11451
  function mustPickCompany(me, owner) {
@@ -11568,6 +11570,7 @@ var decodeRun = (raw) => {
11568
11570
  stoppable: r["stoppable"] !== false,
11569
11571
  stepN: asNumber(r["stepN"]),
11570
11572
  stepTotal: asNumber(r["stepTotal"]),
11573
+ steps: Array.isArray(r["steps"]) && r["steps"].length ? asStrings(r["steps"]) : null,
11571
11574
  reason: asString(r["reason"]),
11572
11575
  failedStage: asString(r["failedStage"]),
11573
11576
  reasonDetail: asString(r["reasonDetail"]),
@@ -11881,7 +11884,11 @@ var api = {
11881
11884
  })()
11882
11885
  })),
11883
11886
  runs: (account) => call(`/portal/api/runs${accountQuery(account)}`, (b) => asArray(b["runs"]).map(decodeRun).filter((r) => r !== null)),
11884
- runsMine: () => call("/portal/api/runs?scope=mine", (b) => asArray(b["runs"]).map(decodeRun).filter((r) => r !== null)),
11887
+ runsMine: () => call("/portal/api/runs?scope=mine", (b) => {
11888
+ const runs = asArray(b["runs"]).map(decodeRun).filter((r) => r !== null);
11889
+ lastRunStates = new Map(runs.map((r) => [r.runId, r.state]));
11890
+ return runs;
11891
+ }),
11885
11892
  runSummary: (runId) => call(`/portal/api/run/${encodeURIComponent(runId)}/summary`, (b) => asArray(b["summary"]).filter((p) => typeof p === "string" && p.trim() !== "")),
11886
11893
  acknowledge: (input) => call("/portal/api/ack", (b) => b, {
11887
11894
  method: "POST",
@@ -11939,6 +11946,7 @@ var api = {
11939
11946
  nativeLanguage: r["nativeLanguage"] === true
11940
11947
  };
11941
11948
  }),
11949
+ urgent: { available: typeof b["urgent"] === "object" && b["urgent"] !== null && b["urgent"]["available"] === true },
11942
11950
  read: decodeReadCapability(b["read"])
11943
11951
  })),
11944
11952
  composeRead: (brief) => call("/portal/api/compose/read", (b) => decodeRead(b["read"]), {
@@ -12246,7 +12254,8 @@ var api = {
12246
12254
  credential: (() => {
12247
12255
  const s = asRecord(r["credential"])["state"];
12248
12256
  return s === "absent" || s === "usable" || s === "unusable" || s === "unreadable" ? s : null;
12249
- })()
12257
+ })(),
12258
+ needed: typeof r["needed"] === "boolean" ? r["needed"] : null
12250
12259
  };
12251
12260
  }) : null,
12252
12261
  auth: b["auth"] != null && typeof b["auth"] === "object" && !Array.isArray(b["auth"]) ? (() => {
@@ -12630,6 +12639,8 @@ var PATHS = {
12630
12639
  "eye-off": "M17.9 17.9A10.4 10.4 0 0 1 12 19c-6 0-10-7-10-7a18 18 0 0 1 5.1-5.9m3.6-1a10.4 10.4 0 0 1 1.3-.1c6 0 10 7 10 7a18 18 0 0 1-2.2 3.2M1 1l22 22M9.9 9.9a3 3 0 0 0 4.2 4.2",
12631
12640
  theme: "M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18ZM12 3v18",
12632
12641
  check: "m20 6-11 11-5-5",
12642
+ doc: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8ZM14 2v6h6M16 13H8M16 17H8M10 9H8",
12643
+ copy: "M20 9h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2ZM5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1",
12633
12644
  alert: "M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z",
12634
12645
  "panel-left": "M21 3H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2ZM9 3v18"
12635
12646
  };
@@ -12752,6 +12763,27 @@ function Logo({ markOnly = false, brandName = PRODUCT_NAME }) {
12752
12763
  })]
12753
12764
  });
12754
12765
  }
12766
+ // src/contract/tabTitle.ts
12767
+ var ENDED = new Set([
12768
+ "delivered",
12769
+ "failed",
12770
+ "cancelled"
12771
+ ]);
12772
+ var HIDDEN_POLL_MS = 6e4;
12773
+ function endedSince(before, now) {
12774
+ let n = 0;
12775
+ for (const r of now) {
12776
+ const was = before.get(r.runId);
12777
+ if (was !== void 0 && !ENDED.has(was) && ENDED.has(r.state)) n++;
12778
+ }
12779
+ return n;
12780
+ }
12781
+ var statesOf = (runs) => new Map(runs.map((r) => [r.runId, r.state]));
12782
+ var anyInFlight = (states) => [...states.values()].some((s) => !ENDED.has(s));
12783
+ function tabTitle(name, count) {
12784
+ const base = `${name} · Trademark clearance`;
12785
+ return count > 0 ? `(${count}) ${base}` : base;
12786
+ }
12755
12787
  // src/state/useApi.ts
12756
12788
  var ACTIVE_MS = 5e3;
12757
12789
  var IDLE_MS = 3e4;
@@ -12827,6 +12859,51 @@ function usePoll(reload, { active, rateLimited }) {
12827
12859
  if (visible) reloadRef.current();
12828
12860
  }, [visible]);
12829
12861
  }
12862
+ function useEndedWhileHidden(enabled) {
12863
+ const [count, setCount] = (0, import_react.useState)(0);
12864
+ (0, import_react.useEffect)(() => {
12865
+ if (!enabled) return;
12866
+ let seen = null;
12867
+ let timer;
12868
+ let live = true;
12869
+ const read = async () => {
12870
+ const r = await api.runsMine();
12871
+ if (!live || document.visibilityState !== "hidden") return;
12872
+ if (r.kind === "ok") {
12873
+ if (seen) {
12874
+ const ended = endedSince(seen, r.value);
12875
+ if (ended) setCount((c) => c + ended);
12876
+ }
12877
+ seen = statesOf(r.value);
12878
+ }
12879
+ if (r.kind === "rateLimited") timer = window.setTimeout(() => {
12880
+ read();
12881
+ }, BACKOFF_MS);
12882
+ else if (seen && anyInFlight(seen)) timer = window.setTimeout(() => {
12883
+ read();
12884
+ }, HIDDEN_POLL_MS);
12885
+ };
12886
+ const onVisibility = () => {
12887
+ window.clearTimeout(timer);
12888
+ seen = null;
12889
+ if (document.visibilityState !== "hidden") {
12890
+ setCount(0);
12891
+ return;
12892
+ }
12893
+ seen = lastSeenRunStates();
12894
+ if (!seen || anyInFlight(seen)) timer = window.setTimeout(() => {
12895
+ read();
12896
+ }, HIDDEN_POLL_MS);
12897
+ };
12898
+ document.addEventListener("visibilitychange", onVisibility);
12899
+ return () => {
12900
+ live = false;
12901
+ window.clearTimeout(timer);
12902
+ document.removeEventListener("visibilitychange", onVisibility);
12903
+ };
12904
+ }, [enabled]);
12905
+ return count;
12906
+ }
12830
12907
  // src/state/guard.ts
12831
12908
  var sources = new Set();
12832
12909
  function registerGuard(isDirty) {
@@ -13306,9 +13383,10 @@ function AppShell({ render }) {
13306
13383
  setAvatarOpen(false);
13307
13384
  }, [path]);
13308
13385
  const brandName = meResult?.kind === "ok" ? meResult.value.brandName : PRODUCT_NAME;
13386
+ const endedWhileHidden = useEndedWhileHidden(meResult?.kind === "ok");
13309
13387
  (0, import_react.useEffect)(() => {
13310
- if (brandName !== "Clearotron") document.title = `${brandName} · Trademark clearance`;
13311
- }, [brandName]);
13388
+ document.title = tabTitle(brandName, endedWhileHidden);
13389
+ }, [brandName, endedWhileHidden]);
13312
13390
  if (!meResult) return (0, import_jsx_runtime.jsx)("div", {
13313
13391
  className: "screen",
13314
13392
  children: (0, import_jsx_runtime.jsx)("p", { children: "Loading…" })
@@ -13716,13 +13794,6 @@ function displayName(run) {
13716
13794
  if (named.length > 1) return `${named[0]} +${named.length - 1} more`;
13717
13795
  return run.title;
13718
13796
  }
13719
- function inSentence(name, max = 60) {
13720
- const one = String(name ?? "").replace(/\s+/g, " ").trim();
13721
- if (one.length <= max) return one;
13722
- const cut = one.slice(0, max);
13723
- const space = cut.lastIndexOf(" ");
13724
- return `${(space > max / 2 ? cut.slice(0, space) : cut).trimEnd()}…`;
13725
- }
13726
13797
  var newestFirst = (a, b) => String(b.issuedAt ?? "").localeCompare(String(a.issuedAt ?? "")) || String(b.date ?? "").localeCompare(String(a.date ?? ""));
13727
13798
  function openDocument(run, markSlug) {
13728
13799
  if (markSlug === null) return {
@@ -13764,6 +13835,30 @@ function readLabelParts(run) {
13764
13835
  date: run.date || null
13765
13836
  };
13766
13837
  }
13838
+ function latestIssued(reads) {
13839
+ return reads.find((r) => r.state === "delivered") ?? null;
13840
+ }
13841
+ function sameDateAsAnother(reads, run) {
13842
+ return reads.some((o) => o.runId !== run.runId && o.date === run.date);
13843
+ }
13844
+ function inFlightWord(state) {
13845
+ return state === "queued" ? "Queued" : state === "paused" ? "Paused" : state === "running" ? "Running" : null;
13846
+ }
13847
+ function searchHistory(reads, currentRunId) {
13848
+ const latest = latestIssued(reads);
13849
+ return reads.map((run) => {
13850
+ const live = inFlightWord(run.state);
13851
+ const t = readTime(run);
13852
+ return {
13853
+ run,
13854
+ label: readLabel(run),
13855
+ time: !live && t && sameDateAsAnother(reads, run) ? `${t} UTC` : null,
13856
+ current: run.runId === currentRunId,
13857
+ latest: run === latest,
13858
+ live
13859
+ };
13860
+ });
13861
+ }
13767
13862
  // src/contract/grouping.ts
13768
13863
  function namesIn(row) {
13769
13864
  return row.kind === "family" ? row.marks.length : 1;
@@ -13792,7 +13887,7 @@ function marksOf(runs, families = NO_FAMILIES) {
13792
13887
  for (const [id, bucket] of byKey) {
13793
13888
  const reads = [...bucket].sort(newestFirst);
13794
13889
  const current = reads[0];
13795
- const latestReport = reads.find((r) => r.state === "delivered") ?? null;
13890
+ const latestReport = latestIssued(reads);
13796
13891
  const rowBands = bandsPresent(current.bands, current.marks.length ? current.marks.map((m) => m.band) : [current.band]);
13797
13892
  const reference = latestReport ?? current;
13798
13893
  const worstEarlier = reads.slice(reads.indexOf(reference) + 1).reduce((w, r) => r.band && (w === null || bandRank(current.bands, r.band) < bandRank(current.bands, w)) ? r.band : w, null);
@@ -15201,6 +15296,7 @@ function machineryFor(d, product) {
15201
15296
  var checksPerName = (platforms) => Math.max(1, platforms + 1);
15202
15297
  var countsActive = (m) => m.pipeline === "knockout" && m.registerCounts;
15203
15298
  var runCount = (i) => i.levers.pipeline === "knockout" ? 1 : Math.max(1, i.names);
15299
+ var searchesCounted = (i) => runCount(i) * (i.levers.urgent === true ? 2 : 1);
15204
15300
  var TURNAROUND_QUOTE = {
15205
15301
  clearance: {
15206
15302
  lowHours: 1.5,
@@ -15209,9 +15305,17 @@ var TURNAROUND_QUOTE = {
15209
15305
  knockout: {
15210
15306
  lowHours: 5 / 60,
15211
15307
  highHours: 10 / 60
15308
+ },
15309
+ clearanceUrgent: {
15310
+ lowHours: .5,
15311
+ highHours: 1
15312
+ },
15313
+ knockoutUrgent: {
15314
+ lowHours: 3 / 60,
15315
+ highHours: 6 / 60
15212
15316
  }
15213
15317
  };
15214
- var quoteBoundsFor = (m) => m.pipeline === "knockout" ? TURNAROUND_QUOTE.knockout : TURNAROUND_QUOTE.clearance;
15318
+ var quoteBoundsFor = (m) => m.pipeline === "knockout" ? m.urgent === true ? TURNAROUND_QUOTE.knockoutUrgent : TURNAROUND_QUOTE.knockout : m.urgent === true ? TURNAROUND_QUOTE.clearanceUrgent : TURNAROUND_QUOTE.clearance;
15215
15319
  var turnaroundBounds = (i) => ({ ...quoteBoundsFor(i.levers) });
15216
15320
  var fmtHours = (h) => h % 1 ? h.toFixed(1) : String(h);
15217
15321
  function turnaround(i) {
@@ -15220,10 +15324,18 @@ function turnaround(i) {
15220
15324
  const lo = Math.round(lowHours * 60), hi = Math.round(highHours * 60);
15221
15325
  return lo === hi ? `~${hi} min` : `${lo}–${hi} min`;
15222
15326
  }
15327
+ if (lowHours < 1) return `${Math.round(lowHours * 60)} min–${fmtHours(highHours)} ${highHours === 1 ? "hour" : "hours"}`;
15223
15328
  if (lowHours === highHours) return `~${fmtHours(highHours)} ${highHours === 1 ? "hour" : "hours"}`;
15224
15329
  return `${fmtHours(lowHours)}–${fmtHours(highHours)} hours`;
15225
15330
  }
15226
15331
  var turnaroundInWords = (quote) => quote.replace(/(\d)\s*[–-]\s*(\d)/g, "$1 to $2");
15332
+ function rangeInWords({ lowHours, highHours }) {
15333
+ const minutes = (h) => Math.round(h * 60);
15334
+ const hours = (h) => `${fmtHours(h)} ${h === 1 ? "hour" : "hours"}`;
15335
+ if (highHours < 1) return `${minutes(lowHours)} to ${minutes(highHours)} minutes`;
15336
+ if (lowHours < 1) return `${minutes(lowHours)} minutes to ${hours(highHours)}`;
15337
+ return `${fmtHours(lowHours)} to ${hours(highHours)}`;
15338
+ }
15227
15339
  function checksSummary(i) {
15228
15340
  if (i.levers.pipeline === "knockout") return countsActive(i.levers) ? "1 broad sweep per name · web + marketplaces · register filing counts" : "1 broad sweep per name · web + marketplaces";
15229
15341
  return `${checksPerName(i.platforms)} checks per name`;
@@ -15418,6 +15530,16 @@ function pips(stepN, stepTotal) {
15418
15530
  filled: Math.max(0, Math.min(total, Math.floor(stepN ?? 0)))
15419
15531
  };
15420
15532
  }
15533
+ function stepList(steps, stepN, stepTotal) {
15534
+ if (!steps || steps.length === 0) return null;
15535
+ if (stepN == null || !Number.isFinite(stepN) || stepN < 1) return null;
15536
+ if (stepTotal != null && stepTotal !== steps.length) return null;
15537
+ const current = Math.min(steps.length, Math.floor(stepN));
15538
+ return steps.map((name, i) => ({
15539
+ name,
15540
+ mark: i + 1 < current ? "done" : i + 1 === current ? "current" : "todo"
15541
+ }));
15542
+ }
15421
15543
  function inFlightBreakdown(rows) {
15422
15544
  let running = 0;
15423
15545
  let paused = 0;
@@ -15692,6 +15814,7 @@ function Card({ run, ctx, onChanged, stamp, compact = false }) {
15692
15814
  const [asking, setAsking] = (0, import_react.useState)(false);
15693
15815
  const [took, setTook] = (0, import_react.useState)(null);
15694
15816
  const p = pips(run.stepN, run.stepTotal);
15817
+ const list = run.state === "running" || run.state === "paused" ? stepList(run.steps, run.stepN, run.stepTotal) : null;
15695
15818
  const label = runProductLabel(run.productName, run.marks.length);
15696
15819
  const reason = cardReason(run);
15697
15820
  const canStop = run.state === "running" || run.state === "paused";
@@ -15807,14 +15930,37 @@ function Card({ run, ctx, onChanged, stamp, compact = false }) {
15807
15930
  className: "home2-card-when",
15808
15931
  children: stamp
15809
15932
  }) : null,
15810
- run.step ? (0, import_jsx_runtime.jsx)("div", {
15933
+ list ? (0, import_jsx_runtime.jsx)("ol", {
15934
+ className: `home2-steps ${run.state}`,
15935
+ children: list.map((s, i) => (0, import_jsx_runtime.jsxs)("li", {
15936
+ className: `home2-stepitem ${s.mark}`,
15937
+ "aria-current": s.mark === "current" ? "step" : void 0,
15938
+ children: [(0, import_jsx_runtime.jsx)("span", {
15939
+ className: "home2-stepmark",
15940
+ "aria-hidden": "true",
15941
+ children: s.mark === "done" ? (0, import_jsx_runtime.jsx)("svg", {
15942
+ width: "14",
15943
+ height: "14",
15944
+ viewBox: "0 0 14 14",
15945
+ fill: "none",
15946
+ stroke: "currentColor",
15947
+ strokeWidth: "1.8",
15948
+ strokeLinecap: "round",
15949
+ strokeLinejoin: "round",
15950
+ children: (0, import_jsx_runtime.jsx)("path", { d: "M2.5 7.5l3 3 6-7" })
15951
+ }) : (0, import_jsx_runtime.jsx)("span", { className: "home2-stepdot" })
15952
+ }), (0, import_jsx_runtime.jsx)("span", {
15953
+ className: "home2-stepname",
15954
+ children: s.name
15955
+ })]
15956
+ }, i))
15957
+ }) : (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [run.step ? (0, import_jsx_runtime.jsx)("div", {
15811
15958
  className: "home2-step",
15812
15959
  children: run.step
15813
- }) : null,
15814
- p ? (0, import_jsx_runtime.jsx)("div", {
15960
+ }) : null, p ? (0, import_jsx_runtime.jsx)("div", {
15815
15961
  className: "home2-pips",
15816
15962
  children: Array.from({ length: p.total }, (_, i) => (0, import_jsx_runtime.jsx)("span", { className: `home2-pip${i < p.filled ? ` on ${run.state}` : ""}` }, i))
15817
- }) : null,
15963
+ }) : null] }),
15818
15964
  (0, import_jsx_runtime.jsxs)("div", {
15819
15965
  className: "home2-card-foot",
15820
15966
  children: [
@@ -16207,10 +16353,12 @@ function clearancesColumns(mode, width = { wide: false }) {
16207
16353
  }, {
16208
16354
  key: "risk",
16209
16355
  share: 12
16210
- }, {
16356
+ });
16357
+ if (mode.updated !== false) wide.push({
16211
16358
  key: "updated",
16212
16359
  share: 10
16213
- }, {
16360
+ });
16361
+ wide.push({
16214
16362
  key: "actions",
16215
16363
  share: 25
16216
16364
  });
@@ -16242,10 +16390,10 @@ function clearancesColumns(mode, width = { wide: false }) {
16242
16390
  }, {
16243
16391
  key: "risk",
16244
16392
  share: mode.owner ? 14 : 15
16245
- }, {
16393
+ }, ...mode.updated !== false ? [{
16246
16394
  key: "updated",
16247
16395
  share: 14
16248
- }, {
16396
+ }] : [], {
16249
16397
  key: "actions",
16250
16398
  share: mode.pick ? 21 : 20
16251
16399
  });
@@ -16259,7 +16407,7 @@ function clearancesColumns(mode, width = { wide: false }) {
16259
16407
  function hasReport(read) {
16260
16408
  return Boolean(read.report) || read.reports.length > 0;
16261
16409
  }
16262
- function searchesLabel(n) {
16410
+ function searchesLabel$1(n) {
16263
16411
  return `${n} ${n === 1 ? "search" : "searches"}`;
16264
16412
  }
16265
16413
  function namesLabel(n) {
@@ -16280,36 +16428,27 @@ function reportLineParts(mark) {
16280
16428
  const report = shownReport(mark);
16281
16429
  if (!report || inProgress(mark) === 0) return null;
16282
16430
  return {
16283
- label: "latest report",
16431
+ label: "Latest report",
16284
16432
  date: report.date
16285
16433
  };
16286
16434
  }
16287
16435
  function statusCount(mark) {
16288
- return reportLine(mark) ? searchesLabel(inProgress(mark)) : null;
16289
- }
16290
- function groupStatus(family) {
16291
- const { queued, running } = family;
16292
- if (!queued && !running) return null;
16293
- if (!running) return {
16294
- text: `${searchesLabel(queued)} queued`,
16295
- state: "queued"
16296
- };
16297
- if (!queued) return {
16298
- text: `${searchesLabel(running)} running`,
16299
- state: "running"
16300
- };
16301
- return {
16302
- text: `${searchesLabel(running)} running · ${queued} queued`,
16303
- state: "running"
16304
- };
16436
+ return reportLine(mark) ? searchesLabel$1(inProgress(mark)) : null;
16437
+ }
16438
+ function familyLine(family) {
16439
+ const live = family.queued + family.running;
16440
+ return [
16441
+ "Highest risk across latest reports",
16442
+ family.band,
16443
+ live ? `${searchesLabel$1(live)} in progress` : null
16444
+ ].filter((x) => Boolean(x)).join(" · ");
16305
16445
  }
16306
- var GROUP_RISK_LINE = "Highest risk across the latest report for each name.";
16307
16446
  var STOPPED_LINE = "No report will be produced. Completed work stays readable through Ask AI.";
16308
16447
  function nameActions(mark) {
16309
16448
  const report = shownReport(mark);
16310
16449
  if (report) return {
16311
16450
  open: hasReport(report) ? {
16312
- label: mark.reads.length > 1 ? "Open latest report" : "Open",
16451
+ label: mark.reads.length > 1 ? "Open latest report" : "Open report",
16313
16452
  read: report
16314
16453
  } : null,
16315
16454
  askAbout: report
@@ -16420,7 +16559,7 @@ function StatusCell({ state, step, reason, failedStage, pausedKind = null, reset
16420
16559
  }) : null
16421
16560
  ] });
16422
16561
  }
16423
- const label = state === "queued" ? "Queued" : state === "paused" ? "Paused" : "Running";
16562
+ const label = inFlightWord(state) ?? "Running";
16424
16563
  const detail = state === "paused" ? pausedKind === "recovering" ? "Held after a problem — retrying on its own" : pausedKind === "operator" ? "Paused by a system restart — resumes on its own" : resetsAt ? `Paused by a provider limit — resumes ${resumeWording(resetsAt)}` : "Paused by a provider limit — resumes on its own" : step;
16425
16564
  return (0, import_jsx_runtime.jsxs)("span", { children: [(0, import_jsx_runtime.jsxs)("span", {
16426
16565
  className: "status",
@@ -16519,6 +16658,8 @@ function PinnedScrollbar({ target }) {
16519
16658
  })
16520
16659
  });
16521
16660
  }
16661
+ var ONE_SEARCH_LEFT = "1 search left today.";
16662
+ var overOneLeft = (left, searches) => left === 1 && searches > 1;
16522
16663
  function searchesLeft(usage) {
16523
16664
  if (!usage || !usage.capped || usage.dailyRuns == null) return null;
16524
16665
  return Math.max(0, usage.dailyRuns - usage.today);
@@ -16931,17 +17072,7 @@ new Map(SEARCH_LEVELS.map((l) => [l.product, l]));
16931
17072
  function atLevel(run, filter) {
16932
17073
  return filter === "all" || run.product === filter;
16933
17074
  }
16934
- function levelsOf(runs) {
16935
- const held = new Set(runs.map((r) => r.product));
16936
- return SEARCH_LEVELS.filter((l) => held.has(l.product));
16937
- }
16938
17075
  // src/screens/Clearances.tsx
16939
- var FIRST_CLICK_DESC = {
16940
- date: true,
16941
- risk: false,
16942
- title: false,
16943
- state: false
16944
- };
16945
17076
  var TERMINAL = new Set([
16946
17077
  "delivered",
16947
17078
  "failed",
@@ -16976,10 +17107,20 @@ function Clearances({ ctx }) {
16976
17107
  }, []);
16977
17108
  const [filter, setFilter] = (0, import_react.useState)("all");
16978
17109
  const [level, setLevel] = (0, import_react.useState)("all");
16979
- const [sort, setSort] = (0, import_react.useState)({
16980
- key: "date",
16981
- desc: true
17110
+ const [sortBy, setSortBy] = (0, import_react.useState)("activity");
17111
+ const [filtersOpen, setFiltersOpen] = (0, import_react.useState)(false);
17112
+ const [grouping, setGrouping] = (0, import_react.useState)(null);
17113
+ const openGrouping = (family, seed = []) => setGrouping({
17114
+ family,
17115
+ seed
16982
17116
  });
17117
+ const [ask, setAsk] = (0, import_react.useState)(null);
17118
+ const [note, setNote] = (0, import_react.useState)(null);
17119
+ (0, import_react.useEffect)(() => {
17120
+ if (!note) return;
17121
+ const t = window.setTimeout(() => setNote(null), 8e3);
17122
+ return () => window.clearTimeout(t);
17123
+ }, [note]);
16983
17124
  const [query, setQuery] = (0, import_react.useState)("");
16984
17125
  const [open, setOpen] = (0, import_react.useState)(new Set());
16985
17126
  const [page, setPage] = (0, import_react.useState)(0);
@@ -17004,14 +17145,9 @@ function Clearances({ ctx }) {
17004
17145
  const { result: aiResult } = useLoad(() => api.mcpAccess(), []);
17005
17146
  const aiAccess = aiResult?.kind === "ok" ? aiResult.value : null;
17006
17147
  const [askFor, setAskFor] = (0, import_react.useState)(null);
17007
- const [picked, setPicked] = (0, import_react.useState)(new Set());
17008
17148
  const canGroup = canManage(ctx.me) && seesAll;
17009
- const [showRetired, setShowRetired] = (0, import_react.useState)(false);
17010
17149
  const { result: retiredResult, reload: reloadRetired } = useLoad(() => canGroup ? api.retiredRuns(account) : Promise.resolve({ kind: "notFound" }), [account, canGroup]);
17011
17150
  const retired = retiredResult?.kind === "ok" ? retiredResult.value : [];
17012
- (0, import_react.useEffect)(() => {
17013
- setPicked(new Set());
17014
- }, [ownerFilter]);
17015
17151
  usePoll(reload, {
17016
17152
  active: runs.some((r) => !TERMINAL.has(r.state)),
17017
17153
  rateLimited: result?.kind === "rateLimited"
@@ -17024,21 +17160,18 @@ function Clearances({ ctx }) {
17024
17160
  const failedCount = (0, import_react.useMemo)(() => marksOf(runs, families).filter((m) => m.current.state === "failed").length, [runs, families]);
17025
17161
  const rows = (0, import_react.useMemo)(() => {
17026
17162
  const q = query.trim().toLowerCase();
17027
- const marks = marksOf(runs.filter((r) => {
17163
+ return [...rowsOf(marksOf(runs.filter((r) => {
17028
17164
  if (filter === "finished" && !TERMINAL.has(r.state)) return false;
17029
17165
  if (filter === "progress" && TERMINAL.has(r.state)) return false;
17030
17166
  if (!atLevel(r, level)) return false;
17031
17167
  if (q && !displayName(r).toLowerCase().includes(q) && !r.marks.some((m) => m.name.toLowerCase().includes(q))) return false;
17032
17168
  return true;
17033
- }), families).filter((m) => filter === "failed" === (m.current.state === "failed"));
17034
- const dir = sort.desc ? -1 : 1;
17035
- return [...rowsOf(marks, families)].sort((a, b) => {
17169
+ }), families).filter((m) => filter === "failed" === (m.current.state === "failed")), families)].sort((a, b) => {
17036
17170
  if (grouped && runKey(a) !== runKey(b)) return runKey(a).localeCompare(runKey(b));
17037
- switch (sort.key) {
17038
- case "title": return dir * a.name.localeCompare(b.name);
17039
- case "state": return dir * a.state.localeCompare(b.state);
17040
- case "risk": return dir * (bandRank(a.bands, shownBand(a)) - bandRank(b.bands, shownBand(b)));
17041
- default: return -dir * newestFirst(a, b);
17171
+ switch (sortBy) {
17172
+ case "name": return a.name.localeCompare(b.name);
17173
+ case "risk": return bandRank(a.bands, shownBand(a)) - bandRank(b.bands, shownBand(b));
17174
+ default: return newestFirst(a, b);
17042
17175
  }
17043
17176
  });
17044
17177
  }, [
@@ -17046,7 +17179,7 @@ function Clearances({ ctx }) {
17046
17179
  filter,
17047
17180
  level,
17048
17181
  query,
17049
- sort,
17182
+ sortBy,
17050
17183
  grouped,
17051
17184
  families
17052
17185
  ]);
@@ -17080,53 +17213,86 @@ function Clearances({ ctx }) {
17080
17213
  });
17081
17214
  if (!result) return (0, import_jsx_runtime.jsx)(Loading, {});
17082
17215
  if (!allRuns.length) return (0, import_jsx_runtime.jsx)(FirstRun, { onNew: canRun(ctx.me) ? () => ctx.go("/portal/new") : null });
17083
- const allMarks = rows.flatMap((r) => r.kind === "family" ? r.marks : [r]);
17084
- const pickedRunIds = () => allMarks.filter((m) => picked.has(m.id)).flatMap((m) => m.reads.map((r) => r.runId));
17085
- const ungroupFamily = async (family) => {
17216
+ const allNames = marksOf(runs, families);
17217
+ const familyIndex = new Map(allNames.flatMap((m) => m.familyId ? [[m.familyId, {
17218
+ name: families.names[m.familyId] ?? m.familyId,
17219
+ company: runKey(m)
17220
+ }]] : []));
17221
+ const searchOf = (run) => readLabelParts(run).head ?? readLabel(run);
17222
+ const companyOf = (key) => ctx.ownerName(key);
17223
+ const ungroupFamily = (family) => {
17086
17224
  const runIds = family.marks.flatMap((m) => m.reads.map((r) => r.runId));
17087
17225
  if (!runIds.length) return;
17088
- const n = family.marks.length;
17089
- if (!window.confirm(`Ungroup "${inSentence(family.name)}"? The ${n} ${n === 1 ? "name" : "names"} stay exactly as they are — only the family goes.`)) return;
17090
- const r = await api.setFamily({
17091
- action: "ungroup",
17092
- runIds
17226
+ setAsk({
17227
+ title: `Ungroup ${family.name}?`,
17228
+ body: `Its ${namesLabel(family.marks.length)} and their searches will appear directly under ${companyOf(runKey(family))}.`,
17229
+ confirm: "Ungroup family",
17230
+ returnTo: `More actions for ${family.name}`,
17231
+ act: () => api.setFamily({
17232
+ action: "ungroup",
17233
+ runIds
17234
+ }),
17235
+ done: "Family ungrouped.",
17236
+ after: () => reloadFamilies()
17093
17237
  });
17094
- if (r.kind !== "ok") {
17095
- window.alert(saveFailureText(r));
17096
- return;
17097
- }
17098
- setPicked(new Set());
17099
- reloadFamilies();
17100
17238
  };
17101
- const retireMark = async (mark) => {
17239
+ const removeFromFamily = (mark, familyName) => {
17102
17240
  const runIds = mark.reads.map((r) => r.runId);
17103
17241
  if (!runIds.length) return;
17104
- const n = runIds.length;
17105
- const what = n === 1 ? "The read stays" : `All ${n} reads stay`;
17106
- if (!window.confirm(`Retire ${inSentence(mark.name)}? ${what} in the pool and the report links keep working — it comes off this list, and "Show retired" brings it back.`)) return;
17107
- const r = await api.setRetired({
17108
- action: "retire",
17109
- runIds
17242
+ setAsk({
17243
+ title: `Remove ${mark.name} from ${familyName}?`,
17244
+ body: `The name and its searches will appear directly under ${companyOf(runKey(mark))}.`,
17245
+ confirm: "Remove from family",
17246
+ returnTo: `More actions for ${mark.name}`,
17247
+ act: () => api.setFamily({
17248
+ action: "ungroup",
17249
+ runIds
17250
+ }),
17251
+ done: `${mark.name} removed from ${familyName}.`,
17252
+ after: () => reloadFamilies()
17110
17253
  });
17111
- if (r.kind !== "ok") {
17112
- window.alert(saveFailureText(r));
17113
- return;
17114
- }
17115
- reload();
17116
- reloadRetired();
17117
17254
  };
17118
- const retireRun = async (run) => {
17119
- if (!window.confirm(`Retire this read — ${inSentence(readLabel(run), 80)}? Only this one read comes off the list. Its report link keeps working, the other reads of this name stay where they are, and "Show retired" brings it back.`)) return;
17120
- const r = await api.setRetired({
17121
- action: "retire",
17122
- runIds: [run.runId]
17255
+ const retireRun = (run, name = displayName(run)) => {
17256
+ setAsk({
17257
+ title: "Retire this search?",
17258
+ body: `${searchOf(run)} for ${name}${run.date ? ` · ${run.date}` : ""} will move to Retired for everyone. Existing report links keep working. You can restore each search there.`,
17259
+ confirm: "Retire search",
17260
+ returnTo: `More actions for ${readLabel(run)}`,
17261
+ act: () => api.setRetired({
17262
+ action: "retire",
17263
+ runIds: [run.runId]
17264
+ }),
17265
+ done: "Moved 1 search to Retired.",
17266
+ after: () => {
17267
+ reload();
17268
+ reloadRetired();
17269
+ }
17123
17270
  });
17124
- if (r.kind !== "ok") {
17125
- window.alert(saveFailureText(r));
17271
+ };
17272
+ const retireMark = (mark) => {
17273
+ const runIds = mark.reads.map((r) => r.runId);
17274
+ if (!runIds.length) return;
17275
+ if (runIds.length === 1) {
17276
+ retireRun(mark.reads[0], mark.name);
17126
17277
  return;
17127
17278
  }
17128
- reload();
17129
- reloadRetired();
17279
+ const n = runIds.length;
17280
+ const live = mark.reads.some((r) => !TERMINAL.has(r.state));
17281
+ setAsk({
17282
+ title: `Retire all ${n} searches?`,
17283
+ body: `${n} searches under ${mark.name} will move to Retired for everyone. Existing report links keep working. You can restore each search there.${live ? " A search in progress will continue." : ""}`,
17284
+ confirm: `Retire ${n} searches`,
17285
+ returnTo: `More actions for ${mark.name}`,
17286
+ act: () => api.setRetired({
17287
+ action: "retire",
17288
+ runIds
17289
+ }),
17290
+ done: `Moved ${n} searches to Retired.`,
17291
+ after: () => {
17292
+ reload();
17293
+ reloadRetired();
17294
+ }
17295
+ });
17130
17296
  };
17131
17297
  const restoreRun = async (run) => {
17132
17298
  const r = await api.setRetired({
@@ -17134,18 +17300,13 @@ function Clearances({ ctx }) {
17134
17300
  runIds: [run.runId]
17135
17301
  });
17136
17302
  if (r.kind !== "ok") {
17137
- window.alert(saveFailureText(r));
17303
+ setNote(saveFailureText(r));
17138
17304
  return;
17139
17305
  }
17306
+ setNote(run.state === "failed" ? `Restored ${searchOf(run)} for ${displayName(run)} to Failed.` : `Restored ${searchOf(run)} for ${displayName(run)}.`);
17140
17307
  reload();
17141
17308
  reloadRetired();
17142
17309
  };
17143
- const pick = (id) => setPicked((prev) => {
17144
- const next = new Set(prev);
17145
- if (next.has(id)) next.delete(id);
17146
- else next.add(id);
17147
- return next;
17148
- });
17149
17310
  const toggle = (id) => setOpen((prev) => {
17150
17311
  const next = new Set(prev);
17151
17312
  if (next.has(id)) next.delete(id);
@@ -17173,100 +17334,208 @@ function Clearances({ ctx }) {
17173
17334
  }, aiAccess).drawn,
17174
17335
  open: () => setAskFor(read.runId)
17175
17336
  });
17176
- const sortBtn = (key, label) => (0, import_jsx_runtime.jsxs)("button", {
17177
- type: "button",
17178
- onClick: () => {
17179
- setSort((s) => ({
17180
- key,
17181
- desc: s.key === key ? !s.desc : FIRST_CLICK_DESC[key]
17182
- }));
17183
- resetPage();
17337
+ const companyKeys = [...new Set(allRuns.map(runKey))].sort((x, y) => ctx.ownerName(x).localeCompare(ctx.ownerName(y)));
17338
+ const levelName = SEARCH_LEVELS.find((l) => l.product === level)?.name ?? null;
17339
+ const activeFilters = [
17340
+ ...ownerFilter ? [{
17341
+ key: "company",
17342
+ label: ctx.ownerName(ownerFilter),
17343
+ clear: () => {
17344
+ ctx.setOwner(null);
17345
+ resetPage();
17346
+ }
17347
+ }] : [],
17348
+ ...level !== "all" && levelName ? [{
17349
+ key: "level",
17350
+ label: levelName,
17351
+ clear: () => {
17352
+ setLevel("all");
17353
+ resetPage();
17354
+ }
17355
+ }] : [],
17356
+ ...groupable && !groupByOwner ? [{
17357
+ key: "combined",
17358
+ label: "Companies combined",
17359
+ clear: () => {
17360
+ setGroupByOwner(true);
17361
+ writeGroupPref(true);
17362
+ resetPage();
17363
+ }
17364
+ }] : []
17365
+ ];
17366
+ const showAllNames = () => {
17367
+ ctx.setOwner(null);
17368
+ setLevel("all");
17369
+ setQuery("");
17370
+ setFilter("all");
17371
+ resetPage();
17372
+ };
17373
+ const retiredShown = retired.filter((r) => (!ownerFilter || runKey(r) === ownerFilter) && atLevel(r, level) && (!query.trim() || displayName(r).toLowerCase().includes(query.trim().toLowerCase())));
17374
+ const tabs = [
17375
+ {
17376
+ key: "all",
17377
+ label: "All",
17378
+ count: 0
17184
17379
  },
17185
- children: [
17186
- label,
17187
- sort.key === key ? (0, import_jsx_runtime.jsx)("span", {
17188
- "aria-hidden": "true",
17189
- children: sort.desc ? "↓" : "↑"
17190
- }) : null,
17191
- (0, import_jsx_runtime.jsx)("span", {
17192
- style: {
17193
- position: "absolute",
17194
- width: 1,
17195
- height: 1,
17196
- overflow: "hidden",
17197
- clip: "rect(0 0 0 0)"
17198
- },
17199
- children: sort.key === key ? sort.desc ? ", sorted descending" : ", sorted ascending" : ", not sorted"
17200
- })
17201
- ]
17202
- });
17380
+ {
17381
+ key: "progress",
17382
+ label: "In progress",
17383
+ count: 0
17384
+ },
17385
+ {
17386
+ key: "finished",
17387
+ label: "Finished",
17388
+ count: 0
17389
+ },
17390
+ {
17391
+ key: "failed",
17392
+ label: "Failed",
17393
+ count: failedCount
17394
+ },
17395
+ ...canGroup ? [{
17396
+ key: "retired",
17397
+ label: "Retired",
17398
+ count: retired.length
17399
+ }] : []
17400
+ ];
17203
17401
  return (0, import_jsx_runtime.jsxs)("div", {
17204
17402
  className: "screen",
17205
17403
  children: [
17206
17404
  (0, import_jsx_runtime.jsx)(PageHeader, {
17207
- title: "Clearances",
17405
+ title: (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["Clearances ", (0, import_jsx_runtime.jsx)("span", {
17406
+ className: "clr-title-count",
17407
+ children: namesLabel(nameCount(rows))
17408
+ })] }),
17208
17409
  lede: (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ownerFilter ? (0, import_jsx_runtime.jsx)("span", {
17209
17410
  "data-anon": "mark",
17210
17411
  children: ctx.ownerName(ownerFilter)
17211
17412
  }) : null, (0, import_jsx_runtime.jsx)(AllowanceLine, {
17212
17413
  account,
17213
17414
  brand: ctx.me.brand
17214
- })] })
17215
- }),
17216
- (0, import_jsx_runtime.jsx)("div", {
17217
- className: "controls",
17218
- children: (0, import_jsx_runtime.jsx)(CompanyChips, {
17219
- ctx,
17220
- label: "Filter by company"
17221
- })
17415
+ })] }),
17416
+ actions: canGroup ? (0, import_jsx_runtime.jsxs)("button", {
17417
+ type: "button",
17418
+ className: "btn-ghost clr-group-btn",
17419
+ onClick: () => openGrouping(null),
17420
+ children: [(0, import_jsx_runtime.jsx)(Icon, {
17421
+ name: "layers",
17422
+ size: 15
17423
+ }), "Group names"]
17424
+ }) : null
17222
17425
  }),
17223
17426
  (0, import_jsx_runtime.jsxs)("div", {
17224
- className: "controls",
17427
+ className: "clr-toolbar",
17428
+ children: [(0, import_jsx_runtime.jsxs)("label", {
17429
+ className: "clr-find",
17430
+ children: [(0, import_jsx_runtime.jsx)(Icon, {
17431
+ name: "search",
17432
+ size: 15
17433
+ }), (0, import_jsx_runtime.jsx)("input", {
17434
+ type: "search",
17435
+ placeholder: "Find a name",
17436
+ "aria-label": "Find a name",
17437
+ value: query,
17438
+ onChange: (e) => {
17439
+ setQuery(e.target.value);
17440
+ resetPage();
17441
+ }
17442
+ })]
17443
+ }), (0, import_jsx_runtime.jsxs)("button", {
17444
+ type: "button",
17445
+ className: "btn-ghost clr-filters-btn",
17446
+ "aria-expanded": filtersOpen,
17447
+ "aria-controls": "clr-filters",
17448
+ onClick: () => setFiltersOpen((v) => !v),
17449
+ children: [
17450
+ (0, import_jsx_runtime.jsx)(Icon, {
17451
+ name: "sliders",
17452
+ size: 15
17453
+ }),
17454
+ "Filters",
17455
+ activeFilters.length ? (0, import_jsx_runtime.jsx)("span", {
17456
+ className: "clr-filters-count",
17457
+ children: activeFilters.length
17458
+ }) : null
17459
+ ]
17460
+ })]
17461
+ }),
17462
+ filtersOpen ? (0, import_jsx_runtime.jsxs)("div", {
17463
+ className: "clr-filters",
17464
+ id: "clr-filters",
17225
17465
  children: [
17226
- (0, import_jsx_runtime.jsx)("div", {
17227
- className: "segmented",
17228
- role: "group",
17229
- "aria-label": "Filter by status",
17230
- children: [
17231
- ["all", "All"],
17232
- ["progress", "In progress"],
17233
- ["finished", "Finished"],
17234
- ["failed", failedCount ? `Failed (${failedCount})` : "Failed"]
17235
- ].map(([k, label]) => (0, import_jsx_runtime.jsx)("button", {
17236
- type: "button",
17237
- "aria-pressed": filter === k,
17238
- onClick: () => {
17239
- setFilter(k);
17466
+ ctx.me.accounts.length > 1 || seesAll ? (0, import_jsx_runtime.jsxs)("label", {
17467
+ className: "clr-filter",
17468
+ children: [(0, import_jsx_runtime.jsx)("span", {
17469
+ className: "field-label",
17470
+ children: "Company"
17471
+ }), (0, import_jsx_runtime.jsxs)("select", {
17472
+ className: "ctx-select",
17473
+ value: ownerFilter ?? "",
17474
+ "data-anon": "mark",
17475
+ onChange: (e) => {
17476
+ ctx.setOwner(e.target.value || null);
17240
17477
  resetPage();
17241
17478
  },
17242
- children: label
17243
- }, k))
17244
- }),
17245
- (0, import_jsx_runtime.jsxs)("div", {
17246
- className: "segmented",
17247
- role: "group",
17248
- "aria-label": "Filter by search",
17249
- children: [(0, import_jsx_runtime.jsx)("button", {
17250
- type: "button",
17251
- "aria-pressed": level === "all",
17252
- onClick: () => {
17253
- setLevel("all");
17479
+ children: [(0, import_jsx_runtime.jsx)("option", {
17480
+ value: "",
17481
+ children: "All companies"
17482
+ }), companyKeys.map((k) => (0, import_jsx_runtime.jsx)("option", {
17483
+ value: k,
17484
+ children: ctx.ownerName(k)
17485
+ }, k))]
17486
+ })]
17487
+ }) : null,
17488
+ (0, import_jsx_runtime.jsxs)("label", {
17489
+ className: "clr-filter",
17490
+ children: [(0, import_jsx_runtime.jsx)("span", {
17491
+ className: "field-label",
17492
+ children: "Search type"
17493
+ }), (0, import_jsx_runtime.jsxs)("select", {
17494
+ className: "ctx-select",
17495
+ value: level,
17496
+ onChange: (e) => {
17497
+ setLevel(e.target.value);
17254
17498
  resetPage();
17255
17499
  },
17256
- children: "All"
17257
- }), SEARCH_LEVELS.map((l) => (0, import_jsx_runtime.jsx)("button", {
17258
- type: "button",
17259
- "aria-pressed": level === l.product,
17260
- title: l.name,
17261
- onClick: () => {
17262
- setLevel(l.product);
17500
+ children: [(0, import_jsx_runtime.jsx)("option", {
17501
+ value: "all",
17502
+ children: "All search types"
17503
+ }), SEARCH_LEVELS.map((l) => (0, import_jsx_runtime.jsx)("option", {
17504
+ value: l.product,
17505
+ children: l.name
17506
+ }, l.product))]
17507
+ })]
17508
+ }),
17509
+ (0, import_jsx_runtime.jsxs)("label", {
17510
+ className: "clr-filter",
17511
+ children: [(0, import_jsx_runtime.jsx)("span", {
17512
+ className: "field-label",
17513
+ children: "Sort by"
17514
+ }), (0, import_jsx_runtime.jsxs)("select", {
17515
+ className: "ctx-select",
17516
+ value: sortBy,
17517
+ onChange: (e) => {
17518
+ setSortBy(e.target.value);
17263
17519
  resetPage();
17264
17520
  },
17265
- children: l.tag
17266
- }, l.product))]
17521
+ children: [
17522
+ (0, import_jsx_runtime.jsx)("option", {
17523
+ value: "activity",
17524
+ children: "Latest activity"
17525
+ }),
17526
+ (0, import_jsx_runtime.jsx)("option", {
17527
+ value: "name",
17528
+ children: "Name A to Z"
17529
+ }),
17530
+ (0, import_jsx_runtime.jsx)("option", {
17531
+ value: "risk",
17532
+ children: "Highest risk"
17533
+ })
17534
+ ]
17535
+ })]
17267
17536
  }),
17268
17537
  groupable ? (0, import_jsx_runtime.jsxs)("label", {
17269
- className: "group-toggle",
17538
+ className: "group-toggle clr-filter-check",
17270
17539
  children: [(0, import_jsx_runtime.jsx)("input", {
17271
17540
  type: "checkbox",
17272
17541
  className: "pickbox",
@@ -17277,133 +17546,115 @@ function Clearances({ ctx }) {
17277
17546
  resetPage();
17278
17547
  }
17279
17548
  }), "Group by company"]
17280
- }) : null,
17281
- (0, import_jsx_runtime.jsx)("span", {
17282
- className: "mono",
17283
- style: {
17284
- marginLeft: "auto",
17285
- color: "var(--text-muted)",
17286
- fontSize: 13
17287
- },
17288
- children: namesLabel(nameCount(rows))
17289
- }),
17290
- (0, import_jsx_runtime.jsx)("input", {
17291
- className: "filter",
17292
- type: "search",
17293
- placeholder: "Filter by name",
17294
- "aria-label": "Filter by name",
17295
- value: query,
17296
- onChange: (e) => {
17297
- setQuery(e.target.value);
17298
- resetPage();
17299
- }
17300
- })
17549
+ }) : null
17301
17550
  ]
17302
- }),
17303
- canGroup && picked.size > 0 ? (0, import_jsx_runtime.jsxs)("div", {
17304
- className: "selection-bar",
17305
- role: "region",
17306
- "aria-label": "Selected names",
17307
- children: [
17308
- (0, import_jsx_runtime.jsxs)("b", { children: [
17309
- picked.size,
17551
+ }) : null,
17552
+ activeFilters.length ? (0, import_jsx_runtime.jsx)("div", {
17553
+ className: "clr-chips",
17554
+ children: activeFilters.map((f) => (0, import_jsx_runtime.jsxs)("button", {
17555
+ type: "button",
17556
+ className: "chip clr-chip",
17557
+ "aria-label": `Remove ${f.label} filter`,
17558
+ onClick: f.clear,
17559
+ children: [
17560
+ (0, import_jsx_runtime.jsx)("span", {
17561
+ "data-anon": f.key === "company" ? "mark" : void 0,
17562
+ children: f.label
17563
+ }),
17310
17564
  " ",
17311
- picked.size === 1 ? "name" : "names",
17312
- " selected"
17313
- ] }),
17314
- (0, import_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
17315
- (0, import_jsx_runtime.jsx)("button", {
17316
- type: "button",
17317
- className: "nav-item",
17318
- style: {
17319
- width: "auto",
17320
- margin: 0,
17321
- padding: "6px 11px",
17322
- border: "1px solid var(--border-hairline)"
17323
- },
17324
- onClick: async () => {
17325
- const name = window.prompt("Group these names under which family?");
17326
- if (!name?.trim()) return;
17327
- const runIds = pickedRunIds();
17328
- const r = await api.setFamily({
17329
- action: "group",
17330
- name: name.trim(),
17331
- runIds
17332
- });
17333
- if (r.kind !== "ok") {
17334
- window.alert(saveFailureText(r, "That grouping could not be saved."));
17335
- return;
17336
- }
17337
- setPicked(new Set());
17338
- reloadFamilies();
17339
- },
17340
- children: "Group as a family"
17341
- }),
17342
- [...picked].some((id) => rows.flatMap((r) => r.kind === "family" ? r.marks : [r]).find((m) => m.id === id)?.familyId) ? (0, import_jsx_runtime.jsx)("button", {
17343
- type: "button",
17344
- className: "nav-item",
17345
- style: {
17346
- width: "auto",
17347
- margin: 0,
17348
- padding: "6px 11px",
17349
- border: "1px solid var(--border-hairline)"
17350
- },
17351
- onClick: async () => {
17352
- const r = await api.setFamily({
17353
- action: "ungroup",
17354
- runIds: pickedRunIds()
17355
- });
17356
- if (r.kind !== "ok") {
17357
- window.alert(saveFailureText(r));
17358
- return;
17359
- }
17360
- setPicked(new Set());
17361
- reloadFamilies();
17362
- },
17363
- children: "Remove from family"
17364
- }) : null,
17365
- (0, import_jsx_runtime.jsx)("button", {
17366
- type: "button",
17367
- className: "nav-item",
17368
- style: {
17369
- width: "auto",
17370
- margin: 0,
17371
- padding: "6px 11px"
17372
- },
17373
- onClick: () => setPicked(new Set()),
17374
- children: "Clear"
17375
- })
17376
- ]
17565
+ (0, import_jsx_runtime.jsx)("span", {
17566
+ "aria-hidden": "true",
17567
+ children: "×"
17568
+ })
17569
+ ]
17570
+ }, f.key))
17571
+ }) : null,
17572
+ note ? (0, import_jsx_runtime.jsx)("p", {
17573
+ className: "clr-note",
17574
+ role: "status",
17575
+ "data-anon": "mark",
17576
+ children: note
17577
+ }) : null,
17578
+ ask ? (0, import_jsx_runtime.jsx)(AskDialog, {
17579
+ ask,
17580
+ onDone: (n) => {
17581
+ setAsk(null);
17582
+ setNote(n);
17583
+ },
17584
+ onClose: () => setAsk(null)
17585
+ }) : null,
17586
+ grouping ? (0, import_jsx_runtime.jsx)(GroupingDialog, {
17587
+ marks: allNames,
17588
+ families: familyIndex,
17589
+ initialCompany: grouping.family ? familyIndex.get(grouping.family)?.company ?? companyKeys[0] : grouping.seed.length ? runKey(allNames.find((m) => m.id === grouping.seed[0]) ?? allNames[0]) : ownerFilter ?? companyKeys[0],
17590
+ initialFamily: grouping.family,
17591
+ seed: grouping.seed,
17592
+ companyName: ctx.ownerName,
17593
+ onSaved: (n) => {
17594
+ setGrouping(null);
17595
+ setNote(n);
17596
+ reloadFamilies();
17597
+ },
17598
+ onClose: () => setGrouping(null)
17377
17599
  }) : null,
17378
17600
  (0, import_jsx_runtime.jsx)("div", {
17379
- className: "table-wrap names-wrap",
17380
- ref: namesWrap,
17381
- children: (0, import_jsx_runtime.jsxs)("table", {
17382
- className: "data fixed",
17601
+ className: "clr-tabs",
17602
+ role: "group",
17603
+ "aria-label": "Show searches by status",
17604
+ children: tabs.map((t) => (0, import_jsx_runtime.jsxs)("button", {
17605
+ type: "button",
17606
+ className: "clr-tab",
17607
+ "aria-pressed": filter === t.key,
17608
+ onClick: () => {
17609
+ setFilter(t.key);
17610
+ resetPage();
17611
+ },
17612
+ children: [t.label, t.count ? (0, import_jsx_runtime.jsx)("span", {
17613
+ className: "clr-tab-count",
17614
+ children: t.count
17615
+ }) : null]
17616
+ }, t.key))
17617
+ }),
17618
+ filter !== "retired" ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [(0, import_jsx_runtime.jsx)("div", {
17619
+ className: "table-wrap names-wrap",
17620
+ ref: namesWrap,
17621
+ children: (0, import_jsx_runtime.jsxs)("table", {
17622
+ className: "data fixed",
17383
17623
  children: [
17384
17624
  (0, import_jsx_runtime.jsx)("colgroup", { children: clearancesColumns({
17385
- pick: canGroup,
17386
- owner: showOwnerColumn
17625
+ pick: false,
17626
+ owner: showOwnerColumn,
17627
+ updated: false
17387
17628
  }, { wide: tableWidth >= 960 }).map((c) => (0, import_jsx_runtime.jsx)("col", { style: { width: `${c.share}%` } }, c.key)) }),
17388
17629
  (0, import_jsx_runtime.jsx)("thead", { children: (0, import_jsx_runtime.jsxs)("tr", { children: [
17389
17630
  (0, import_jsx_runtime.jsx)("th", {}),
17390
- canGroup ? (0, import_jsx_runtime.jsx)("th", { "aria-label": "Select for grouping" }) : null,
17391
- (0, import_jsx_runtime.jsx)("th", { children: sortBtn("title", "Name") }),
17631
+ (0, import_jsx_runtime.jsx)("th", { children: "Name and searches" }),
17392
17632
  showOwnerColumn ? (0, import_jsx_runtime.jsx)("th", { children: "Company" }) : null,
17393
- (0, import_jsx_runtime.jsx)("th", { children: sortBtn("state", "Status") }),
17394
- (0, import_jsx_runtime.jsx)("th", { children: sortBtn("risk", "Risk") }),
17395
- (0, import_jsx_runtime.jsx)("th", { children: sortBtn("date", "Updated") }),
17396
- (0, import_jsx_runtime.jsx)("th", { "aria-label": "Actions" })
17633
+ (0, import_jsx_runtime.jsx)("th", { children: "Status" }),
17634
+ (0, import_jsx_runtime.jsx)("th", { children: "Risk" }),
17635
+ (0, import_jsx_runtime.jsx)("th", {
17636
+ className: "col-actions-head",
17637
+ children: "Report and actions"
17638
+ })
17397
17639
  ] }) }),
17398
17640
  (0, import_jsx_runtime.jsxs)("tbody", { children: [!visible.length ? (0, import_jsx_runtime.jsx)("tr", { children: (0, import_jsx_runtime.jsx)("td", {
17399
- colSpan: (canGroup ? 7 : 6) + (showOwnerColumn ? 1 : 0),
17641
+ colSpan: 5 + (showOwnerColumn ? 1 : 0),
17400
17642
  style: {
17401
17643
  padding: "22px 12px",
17402
17644
  color: "var(--text-muted)"
17403
17645
  },
17404
- children: (0, import_jsx_runtime.jsx)("span", {
17646
+ children: (0, import_jsx_runtime.jsxs)("span", {
17405
17647
  className: "list-empty",
17406
- children: "No clearances match this view. Pick another company above, or widen the filters."
17648
+ children: [
17649
+ "No names match this view.",
17650
+ " ",
17651
+ (0, import_jsx_runtime.jsx)("button", {
17652
+ type: "button",
17653
+ className: "linkish clr-show-all",
17654
+ onClick: showAllNames,
17655
+ children: "Show all names"
17656
+ })
17657
+ ]
17407
17658
  })
17408
17659
  }) }) : null, visible.map((r, i) => {
17409
17660
  const before = visible[i - 1];
@@ -17411,7 +17662,7 @@ function Clearances({ ctx }) {
17411
17662
  return (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [newGroup ? (0, import_jsx_runtime.jsx)("tr", {
17412
17663
  className: "group-head",
17413
17664
  children: (0, import_jsx_runtime.jsxs)("td", {
17414
- colSpan: (canGroup ? 7 : 6) + (showOwnerColumn ? 1 : 0),
17665
+ colSpan: 5 + (showOwnerColumn ? 1 : 0),
17415
17666
  children: [(0, import_jsx_runtime.jsx)("span", {
17416
17667
  className: "owner-name",
17417
17668
  "data-anon": "mark",
@@ -17426,12 +17677,12 @@ function Clearances({ ctx }) {
17426
17677
  isOpen: (id) => open.has(id),
17427
17678
  onToggle: toggle,
17428
17679
  go: ctx.go,
17429
- picking: canGroup,
17430
17680
  showOwner: showOwnerColumn,
17431
17681
  ownerLabel: ctx.ownerName(runKey(r)),
17432
- isPicked: (id) => picked.has(id),
17433
- onPick: pick,
17434
17682
  onUngroup: canGroup ? ungroupFamily : void 0,
17683
+ onAddNames: canGroup ? (f) => openGrouping(f.id) : void 0,
17684
+ onGroupWith: canGroup ? (m) => openGrouping(null, [m.id]) : void 0,
17685
+ onRemoveFromFamily: canGroup ? removeFromFamily : void 0,
17435
17686
  onRetire: canGroup ? retireMark : void 0,
17436
17687
  onRetireRun: canGroup ? retireRun : void 0,
17437
17688
  askAi,
@@ -17441,11 +17692,9 @@ function Clearances({ ctx }) {
17441
17692
  open: open.has(r.id),
17442
17693
  onToggle: () => toggle(r.id),
17443
17694
  go: ctx.go,
17444
- picking: canGroup,
17445
17695
  showOwner: showOwnerColumn,
17446
17696
  ownerLabel: ctx.ownerName(runKey(r)),
17447
- picked: picked.has(r.id),
17448
- onPick: () => pick(r.id),
17697
+ onGroupWith: canGroup ? (m) => openGrouping(null, [m.id]) : void 0,
17449
17698
  onRetire: canGroup ? retireMark : void 0,
17450
17699
  onRetireRun: canGroup ? retireRun : void 0,
17451
17700
  askAi,
@@ -17454,77 +17703,72 @@ function Clearances({ ctx }) {
17454
17703
  })] })
17455
17704
  ]
17456
17705
  })
17457
- }),
17458
- (0, import_jsx_runtime.jsx)(PinnedScrollbar, { target: namesWrapEl }),
17459
- canGroup && retired.length ? (0, import_jsx_runtime.jsxs)("div", {
17460
- style: { marginTop: 18 },
17461
- children: [(0, import_jsx_runtime.jsx)("button", {
17462
- type: "button",
17463
- className: "linkish",
17464
- style: {
17465
- font: "inherit",
17466
- fontSize: 13,
17467
- background: "none",
17468
- border: "none",
17469
- padding: 0,
17470
- color: "var(--text-muted)",
17471
- cursor: "pointer",
17472
- textDecoration: "underline"
17473
- },
17474
- "aria-expanded": showRetired,
17475
- onClick: () => setShowRetired((v) => !v),
17476
- children: showRetired ? "Hide retired" : `Show retired (${retired.length})`
17477
- }), showRetired ? (0, import_jsx_runtime.jsx)("div", {
17478
- className: "table-wrap",
17479
- style: { marginTop: 10 },
17480
- children: (0, import_jsx_runtime.jsxs)("table", {
17481
- className: "data",
17482
- children: [(0, import_jsx_runtime.jsx)("thead", { children: (0, import_jsx_runtime.jsxs)("tr", { children: [
17483
- (0, import_jsx_runtime.jsx)("th", { children: "Name" }),
17484
- (0, import_jsx_runtime.jsx)("th", { children: "Company" }),
17485
- (0, import_jsx_runtime.jsx)("th", { children: "Updated" }),
17486
- (0, import_jsx_runtime.jsx)("th", { "aria-label": "Restore" })
17487
- ] }) }), (0, import_jsx_runtime.jsx)("tbody", { children: retired.map((run) => (0, import_jsx_runtime.jsxs)("tr", {
17488
- className: "row",
17489
- children: [
17490
- (0, import_jsx_runtime.jsx)("td", { children: (0, import_jsx_runtime.jsx)("b", {
17706
+ }), (0, import_jsx_runtime.jsx)(PinnedScrollbar, { target: namesWrapEl })] }) : null,
17707
+ filter === "retired" ? (0, import_jsx_runtime.jsx)("div", {
17708
+ className: "table-wrap",
17709
+ style: { marginTop: 6 },
17710
+ children: (0, import_jsx_runtime.jsxs)("table", {
17711
+ className: "data clr-retired-table",
17712
+ children: [(0, import_jsx_runtime.jsx)("thead", { children: (0, import_jsx_runtime.jsxs)("tr", { children: [
17713
+ (0, import_jsx_runtime.jsx)("th", { children: "Name and searches" }),
17714
+ (0, import_jsx_runtime.jsx)("th", { children: "Status" }),
17715
+ (0, import_jsx_runtime.jsx)("th", {
17716
+ "aria-label": "Report and actions",
17717
+ children: "Report and actions"
17718
+ })
17719
+ ] }) }), (0, import_jsx_runtime.jsxs)("tbody", { children: [!retiredShown.length ? (0, import_jsx_runtime.jsx)("tr", { children: (0, import_jsx_runtime.jsx)("td", {
17720
+ colSpan: 3,
17721
+ style: {
17722
+ padding: "22px 12px",
17723
+ color: "var(--text-muted)"
17724
+ },
17725
+ children: (0, import_jsx_runtime.jsx)("span", {
17726
+ className: "list-empty",
17727
+ children: "No retired searches in this view."
17728
+ })
17729
+ }) }) : null, retiredShown.map((run) => (0, import_jsx_runtime.jsxs)("tr", {
17730
+ className: "row",
17731
+ children: [
17732
+ (0, import_jsx_runtime.jsxs)("td", {
17733
+ className: "clr-td-name",
17734
+ children: [(0, import_jsx_runtime.jsx)("b", {
17491
17735
  "data-anon": "mark",
17492
17736
  style: { color: "var(--text-strong)" },
17493
17737
  children: displayName(run)
17494
- }) }),
17495
- (0, import_jsx_runtime.jsx)("td", {
17496
- "data-anon": "mark",
17497
- style: { color: "var(--text-muted)" },
17498
- children: ctx.ownerName(runKey(run))
17499
- }),
17500
- (0, import_jsx_runtime.jsx)("td", {
17501
- className: "mono",
17738
+ }), (0, import_jsx_runtime.jsxs)("div", {
17739
+ className: "sub",
17502
17740
  style: {
17503
17741
  color: "var(--text-muted)",
17504
- fontSize: 13
17742
+ fontSize: 12.5
17505
17743
  },
17506
- children: run.date ?? ""
17507
- }),
17508
- (0, import_jsx_runtime.jsx)("td", { children: (0, import_jsx_runtime.jsx)("button", {
17744
+ children: [readLabel(run), groupable && !grouped ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · ", (0, import_jsx_runtime.jsx)("span", {
17745
+ "data-anon": "mark",
17746
+ children: ctx.ownerName(runKey(run))
17747
+ })] }) : null]
17748
+ })]
17749
+ }),
17750
+ (0, import_jsx_runtime.jsx)("td", {
17751
+ className: "clr-td-status",
17752
+ children: (0, import_jsx_runtime.jsx)(StatusCell, {
17753
+ state: run.state,
17754
+ step: null,
17755
+ reason: run.state === "failed" ? run.reason : null,
17756
+ failedStage: run.state === "failed" ? run.failedStage : null
17757
+ })
17758
+ }),
17759
+ (0, import_jsx_runtime.jsx)("td", {
17760
+ className: "col-actions",
17761
+ style: { textAlign: "right" },
17762
+ children: (0, import_jsx_runtime.jsx)("button", {
17509
17763
  type: "button",
17510
- className: "linkish",
17511
- style: {
17512
- font: "inherit",
17513
- fontSize: 12,
17514
- background: "none",
17515
- border: "none",
17516
- padding: 0,
17517
- color: "var(--text-muted)",
17518
- cursor: "pointer",
17519
- textDecoration: "underline"
17520
- },
17764
+ className: "btn-ghost clr-open",
17521
17765
  onClick: () => void restoreRun(run),
17522
17766
  children: "Restore"
17523
- }) })
17524
- ]
17525
- }, run.runId)) })]
17526
- })
17527
- }) : null]
17767
+ })
17768
+ })
17769
+ ]
17770
+ }, run.runId))] })]
17771
+ })
17528
17772
  }) : null,
17529
17773
  pageCount > 1 ? (0, import_jsx_runtime.jsxs)("nav", {
17530
17774
  className: "pager",
@@ -17678,14 +17922,18 @@ function RowActions({ open, ask, menu }) {
17678
17922
  children: [
17679
17923
  (0, import_jsx_runtime.jsx)("span", {
17680
17924
  className: "row-actions-open",
17681
- children: open ? (0, import_jsx_runtime.jsx)("button", {
17925
+ children: open ? (0, import_jsx_runtime.jsxs)("button", {
17682
17926
  type: "button",
17683
17927
  className: "row-open",
17928
+ "aria-label": open.name,
17684
17929
  onClick: (e) => {
17685
17930
  e.stopPropagation();
17686
17931
  open.go();
17687
17932
  },
17688
- children: open.label
17933
+ children: [(0, import_jsx_runtime.jsx)(Icon, {
17934
+ name: "doc",
17935
+ size: 14
17936
+ }), open.label]
17689
17937
  }) : null
17690
17938
  }),
17691
17939
  (0, import_jsx_runtime.jsx)("span", {
@@ -17701,80 +17949,67 @@ function RowActions({ open, ask, menu }) {
17701
17949
  })
17702
17950
  });
17703
17951
  }
17704
- function FamilyRows({ family, isOpen, onToggle, go, picking, showOwner = false, ownerLabel = "", isPicked, onPick, onUngroup, onRetire, onRetireRun, askAi, askMenu }) {
17952
+ function FamilyRows({ family, isOpen, onToggle, go, showOwner = false, ownerLabel = "", onUngroup, onAddNames, onGroupWith, onRemoveFromFamily, onRetire, onRetireRun, askAi, askMenu }) {
17705
17953
  const open = isOpen(family.id);
17706
- const busy = groupStatus(family);
17707
17954
  return (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [(0, import_jsx_runtime.jsxs)("tr", {
17708
17955
  className: "row",
17709
17956
  onClick: () => onToggle(family.id),
17710
17957
  children: [
17711
- (0, import_jsx_runtime.jsx)("td", { children: (0, import_jsx_runtime.jsx)(Twisty, {
17712
- open,
17713
- onToggle: () => onToggle(family.id),
17714
- label: `${open ? "Collapse" : "Expand"} ${family.name}`
17715
- }) }),
17716
- picking ? (0, import_jsx_runtime.jsx)("td", {}) : null,
17717
- (0, import_jsx_runtime.jsxs)("td", { children: [
17718
- (0, import_jsx_runtime.jsx)("span", {
17719
- className: "row-kind",
17720
- children: "Group ·"
17721
- }),
17722
- (0, import_jsx_runtime.jsx)("b", {
17723
- "data-anon": "mark",
17724
- style: { color: "var(--text-strong)" },
17725
- children: family.name
17726
- }),
17727
- (0, import_jsx_runtime.jsx)("span", {
17728
- className: "pill",
17729
- style: { marginLeft: 8 },
17730
- children: namesLabel(family.marks.length)
17731
- }),
17732
- (0, import_jsx_runtime.jsx)("span", {
17733
- className: "sub",
17734
- children: GROUP_RISK_LINE
17958
+ (0, import_jsx_runtime.jsx)("td", {
17959
+ className: "clr-td-twisty",
17960
+ children: (0, import_jsx_runtime.jsx)(Twisty, {
17961
+ open,
17962
+ onToggle: () => onToggle(family.id),
17963
+ label: `${open ? "Collapse" : "Expand"} ${family.name}`
17735
17964
  })
17736
- ] }),
17965
+ }),
17966
+ (0, import_jsx_runtime.jsxs)("td", {
17967
+ className: "clr-td-name",
17968
+ children: [
17969
+ (0, import_jsx_runtime.jsx)("span", {
17970
+ className: "clr-family-icon",
17971
+ "aria-hidden": "true",
17972
+ children: (0, import_jsx_runtime.jsx)(Icon, {
17973
+ name: "layers",
17974
+ size: 14
17975
+ })
17976
+ }),
17977
+ (0, import_jsx_runtime.jsx)("b", {
17978
+ "data-anon": "mark",
17979
+ style: { color: "var(--text-strong)" },
17980
+ children: family.name
17981
+ }),
17982
+ (0, import_jsx_runtime.jsxs)("span", {
17983
+ className: "clr-meta",
17984
+ children: [" · ", namesLabel(family.marks.length)]
17985
+ }),
17986
+ (0, import_jsx_runtime.jsx)("span", {
17987
+ className: "sub",
17988
+ children: familyLine(family)
17989
+ })
17990
+ ]
17991
+ }),
17737
17992
  showOwner ? (0, import_jsx_runtime.jsx)("td", {
17738
17993
  "data-anon": "mark",
17739
17994
  style: { color: "var(--text-muted)" },
17740
17995
  children: ownerLabel
17741
17996
  }) : null,
17742
- (0, import_jsx_runtime.jsx)("td", { children: busy ? (0, import_jsx_runtime.jsxs)("span", {
17743
- className: "status",
17744
- children: [(0, import_jsx_runtime.jsx)("span", { className: `dot ${busy.state}` }), (0, import_jsx_runtime.jsx)("span", { children: busy.text.replace(/^(\d+) /, "$1\xA0") })]
17745
- }) : (0, import_jsx_runtime.jsx)(StatusCell, {
17746
- state: family.state,
17747
- step: null,
17748
- reason: null,
17749
- failedStage: null
17750
- }) }),
17751
- (0, import_jsx_runtime.jsx)("td", { children: family.band ? (0, import_jsx_runtime.jsx)(RiskDot, {
17752
- tone: family.tone,
17753
- label: family.band
17754
- }) : (0, import_jsx_runtime.jsx)("span", {
17755
- style: { color: "var(--text-faint)" },
17756
- children: "—"
17757
- }) }),
17758
- (0, import_jsx_runtime.jsx)("td", {
17759
- className: "mono col-date",
17760
- style: {
17761
- color: "var(--text-muted)",
17762
- fontSize: 13
17763
- },
17764
- children: family.date ?? ""
17765
- }),
17997
+ (0, import_jsx_runtime.jsx)("td", { className: "clr-td-status" }),
17998
+ (0, import_jsx_runtime.jsx)("td", { className: "clr-td-risk" }),
17766
17999
  (0, import_jsx_runtime.jsx)("td", {
17767
18000
  className: "col-actions",
17768
18001
  children: (0, import_jsx_runtime.jsx)(RowActions, {
17769
18002
  open: null,
17770
18003
  ask: null,
17771
- menu: onUngroup ? (0, import_jsx_runtime.jsx)(RowMenu$1, {
18004
+ menu: onUngroup ? (0, import_jsx_runtime.jsxs)(RowMenu$1, {
17772
18005
  label: `More actions for ${family.name}`,
17773
- children: (0, import_jsx_runtime.jsx)(MenuItem, {
17774
- title: `Ungroup ${family.name} — the ${namesLabel(family.marks.length)} stay, the family goes`,
18006
+ children: [onAddNames ? (0, import_jsx_runtime.jsx)(MenuItem, {
18007
+ onSelect: () => onAddNames(family),
18008
+ children: "Add names to this family…"
18009
+ }) : null, (0, import_jsx_runtime.jsx)(MenuItem, {
17775
18010
  onSelect: () => onUngroup(family),
17776
- children: "Ungroup"
17777
- })
18011
+ children: "Ungroup family…"
18012
+ })]
17778
18013
  }) : null
17779
18014
  })
17780
18015
  })
@@ -17785,29 +18020,18 @@ function FamilyRows({ family, isOpen, onToggle, go, picking, showOwner = false,
17785
18020
  onToggle: () => onToggle(m.id),
17786
18021
  go,
17787
18022
  indent: true,
17788
- picking,
17789
18023
  showOwner,
17790
18024
  ownerLabel,
17791
- picked: isPicked(m.id),
17792
- onPick: () => onPick(m.id),
18025
+ familyName: family.name,
17793
18026
  onRetire,
17794
18027
  onRetireRun,
18028
+ onGroupWith,
18029
+ onRemoveFromFamily,
17795
18030
  askAi,
17796
18031
  askMenu
17797
18032
  }, m.id)) : null] });
17798
18033
  }
17799
- function LevelTags({ levels }) {
17800
- if (!levels.length) return null;
17801
- return (0, import_jsx_runtime.jsx)("div", {
17802
- className: "level-tags",
17803
- children: levels.map((l) => (0, import_jsx_runtime.jsx)("span", {
17804
- className: "pill",
17805
- title: l.name,
17806
- children: l.tag
17807
- }, l.product))
17808
- });
17809
- }
17810
- function MarkRow({ mark, open, onToggle, go, indent = false, picking = false, showOwner = false, ownerLabel = "", picked = false, onPick, onRetire, onRetireRun, askAi, askMenu }) {
18034
+ function MarkRow({ mark, open, onToggle, go, indent = false, showOwner = false, ownerLabel = "", onRetire, onRetireRun, onGroupWith, onRemoveFromFamily, familyName = null, askAi, askMenu }) {
17811
18035
  const run = mark.current;
17812
18036
  const threaded = mark.reads.length > 1;
17813
18037
  const report = shownReport(mark);
@@ -17822,103 +18046,118 @@ function MarkRow({ mark, open, onToggle, go, indent = false, picking = false, sh
17822
18046
  onClick: onRow ?? void 0,
17823
18047
  children: [
17824
18048
  (0, import_jsx_runtime.jsx)("td", {
17825
- className: indent ? "nest-1" : void 0,
18049
+ className: `clr-td-twisty${indent ? " nest-1" : ""}`,
17826
18050
  children: threaded ? (0, import_jsx_runtime.jsx)(Twisty, {
17827
18051
  open,
17828
18052
  onToggle,
17829
- label: `${open ? "Collapse" : "Expand"} ${mark.name}`
18053
+ label: `${open ? "Collapse" : "Expand"} searches for ${mark.name}`
17830
18054
  }) : null
17831
18055
  }),
17832
- picking ? (0, import_jsx_runtime.jsx)("td", {
17833
- onClick: (e) => e.stopPropagation(),
17834
- children: (0, import_jsx_runtime.jsx)("input", {
17835
- type: "checkbox",
17836
- className: "pickbox",
17837
- checked: Boolean(picked),
17838
- onChange: () => onPick?.(),
17839
- "aria-label": `Select ${mark.name} for grouping`
17840
- })
17841
- }) : null,
17842
- (0, import_jsx_runtime.jsxs)("td", { children: [
17843
- (0, import_jsx_runtime.jsx)("b", {
17844
- "data-anon": "mark",
17845
- style: { color: "var(--text-strong)" },
17846
- children: mark.name
17847
- }),
17848
- threaded ? (0, import_jsx_runtime.jsx)("span", {
17849
- className: "pill",
17850
- style: { marginLeft: 8 },
17851
- children: searchesLabel(mark.reads.length)
17852
- }) : null,
17853
- mark.improvedFrom && report ? (0, import_jsx_runtime.jsxs)("span", {
17854
- className: "pill",
17855
- style: { marginLeft: 8 },
17856
- title: `An earlier search of this name came back ${mark.improvedFrom}. The row shows where it stands now.`,
17857
- children: ["was ", mark.improvedFrom]
17858
- }) : null,
17859
- (0, import_jsx_runtime.jsx)(LevelTags, { levels: levelsOf(mark.reads) })
17860
- ] }),
18056
+ (0, import_jsx_runtime.jsxs)("td", {
18057
+ className: "clr-td-name",
18058
+ children: [
18059
+ (0, import_jsx_runtime.jsx)("b", {
18060
+ "data-anon": "mark",
18061
+ style: { color: "var(--text-strong)" },
18062
+ children: mark.name
18063
+ }),
18064
+ threaded ? (0, import_jsx_runtime.jsxs)("span", {
18065
+ className: "clr-meta",
18066
+ children: [" ", searchesLabel$1(mark.reads.length)]
18067
+ }) : null,
18068
+ mark.improvedFrom && report ? (0, import_jsx_runtime.jsxs)("span", {
18069
+ className: "pill",
18070
+ style: { marginLeft: 8 },
18071
+ title: `An earlier search of this name came back ${mark.improvedFrom}. The row shows where it stands now.`,
18072
+ children: ["was ", mark.improvedFrom]
18073
+ }) : null,
18074
+ (0, import_jsx_runtime.jsx)("span", {
18075
+ className: "sub",
18076
+ children: readLabelParts(run).head ?? ""
18077
+ })
18078
+ ]
18079
+ }),
17861
18080
  showOwner ? (0, import_jsx_runtime.jsx)("td", {
17862
18081
  "data-anon": "mark",
17863
18082
  style: { color: "var(--text-muted)" },
17864
18083
  children: ownerLabel
17865
18084
  }) : null,
17866
- (0, import_jsx_runtime.jsx)("td", { children: (0, import_jsx_runtime.jsx)(StatusCell, {
17867
- state: run.state,
17868
- step: run.step,
17869
- reason: run.reason,
17870
- failedStage: run.failedStage,
17871
- pausedKind: run.pausedKind,
17872
- resetsAt: run.resetsAt,
17873
- stopRequestedAt: run.stopRequestedAt,
17874
- count: statusCount(mark)
17875
- }) }),
17876
- (0, import_jsx_runtime.jsxs)("td", { children: [report && mark.reportBands.length ? (0, import_jsx_runtime.jsx)("span", {
17877
- style: {
17878
- display: "inline-flex",
17879
- gap: 8,
17880
- flexWrap: "wrap"
17881
- },
17882
- children: mark.reportBands.map((label) => (0, import_jsx_runtime.jsx)(RiskDot, {
17883
- tone: report.bands.find((b) => b.label === label)?.tone ?? null,
17884
- label
17885
- }, label))
17886
- }) : (0, import_jsx_runtime.jsx)("span", {
17887
- style: { color: "var(--text-faint)" },
17888
- children: "—"
17889
- }), secondLine ? (0, import_jsx_runtime.jsxs)("span", {
17890
- className: "sub report-line",
17891
- children: [secondLine.label, secondLine.date ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · ", (0, import_jsx_runtime.jsx)("span", {
17892
- className: "nowrap-date",
17893
- children: secondLine.date
17894
- })] }) : null]
17895
- }) : null] }),
17896
- (0, import_jsx_runtime.jsx)("td", {
17897
- className: "mono col-date",
17898
- style: {
17899
- color: "var(--text-muted)",
17900
- fontSize: 13
17901
- },
17902
- children: mark.date ?? ""
18085
+ (0, import_jsx_runtime.jsxs)("td", {
18086
+ className: "clr-td-status",
18087
+ children: [(0, import_jsx_runtime.jsx)(StatusCell, {
18088
+ state: run.state,
18089
+ step: run.step,
18090
+ reason: run.reason,
18091
+ failedStage: run.failedStage,
18092
+ pausedKind: run.pausedKind,
18093
+ resetsAt: run.resetsAt,
18094
+ stopRequestedAt: run.stopRequestedAt,
18095
+ count: statusCount(mark)
18096
+ }), TERMINAL.has(run.state) && mark.date ? (0, import_jsx_runtime.jsx)("span", {
18097
+ className: "sub mono nowrap-date",
18098
+ children: mark.date
18099
+ }) : null]
18100
+ }),
18101
+ (0, import_jsx_runtime.jsxs)("td", {
18102
+ className: "clr-td-risk",
18103
+ children: [report && mark.reportBands.length ? (0, import_jsx_runtime.jsxs)("span", {
18104
+ style: {
18105
+ display: "inline-flex",
18106
+ gap: 8,
18107
+ flexWrap: "wrap",
18108
+ alignItems: "center"
18109
+ },
18110
+ children: [(0, import_jsx_runtime.jsx)("span", {
18111
+ className: "clr-phone-only",
18112
+ children: "Risk"
18113
+ }), mark.reportBands.map((label) => (0, import_jsx_runtime.jsx)(RiskDot, {
18114
+ tone: report.bands.find((b) => b.label === label)?.tone ?? null,
18115
+ label
18116
+ }, label))]
18117
+ }) : (0, import_jsx_runtime.jsx)("span", {
18118
+ style: { color: "var(--text-faint)" },
18119
+ children: "—"
18120
+ }), secondLine ? (0, import_jsx_runtime.jsxs)("span", {
18121
+ className: "sub report-line",
18122
+ children: [secondLine.label, secondLine.date ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · ", (0, import_jsx_runtime.jsx)("span", {
18123
+ className: "nowrap-date",
18124
+ children: secondLine.date
18125
+ })] }) : null]
18126
+ }) : null]
17903
18127
  }),
17904
18128
  (0, import_jsx_runtime.jsx)("td", {
17905
18129
  className: "col-actions",
17906
18130
  children: (0, import_jsx_runtime.jsx)(RowActions, {
17907
18131
  open: target && openReport ? {
17908
18132
  label: target.label,
17909
- go: openReport
18133
+ go: openReport,
18134
+ name: `${target.label} for ${mark.name}, ${readLabel(target.read).replace(" · ", ", ")}`
17910
18135
  } : null,
17911
18136
  ask: actions.askAbout ? askAi(mark.name, actions.askAbout) : null,
17912
18137
  menu: onRetire || actions.askAbout && askMenu(actions.askAbout).show ? (0, import_jsx_runtime.jsxs)(RowMenu$1, {
17913
18138
  label: `More actions for ${mark.name}`,
17914
- children: [onRetire ? (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: (0, import_jsx_runtime.jsx)(MenuItem, {
17915
- title: threaded ? `Retire all ${mark.reads.length} searches of ${mark.name} — the whole name comes off this list for everyone; the reports and their links stay, and "Show retired" brings it back. To retire ONE search, open the row and use that search's menu.` : `Retire ${mark.name} — it comes off this list for everyone; the reports and their links stay, and "Show retired" brings it back`,
17916
- onSelect: () => onRetire(mark),
17917
- children: threaded ? `Retire all ${mark.reads.length}` : "Retire"
17918
- }) }) : null, actions.askAbout && askMenu(actions.askAbout).show ? (0, import_jsx_runtime.jsx)(MenuItem, {
17919
- onSelect: () => askMenu(actions.askAbout).open(),
17920
- children: "Ask AI"
17921
- }) : null]
18139
+ children: [
18140
+ onGroupWith && !familyName ? (0, import_jsx_runtime.jsx)(MenuItem, {
18141
+ onSelect: () => onGroupWith(mark),
18142
+ children: "Group with other names…"
18143
+ }) : null,
18144
+ onRemoveFromFamily && familyName ? (0, import_jsx_runtime.jsx)(MenuItem, {
18145
+ onSelect: () => onRemoveFromFamily(mark, familyName),
18146
+ children: "Remove from family…"
18147
+ }) : null,
18148
+ onRetire ? (0, import_jsx_runtime.jsx)(MenuItem, {
18149
+ onSelect: () => onRetire(mark),
18150
+ children: threaded ? `Retire all ${mark.reads.length} searches…` : "Retire this search…"
18151
+ }) : null,
18152
+ threaded && !open ? (0, import_jsx_runtime.jsx)(MenuItem, {
18153
+ onSelect: onToggle,
18154
+ children: `Show all ${mark.reads.length} searches`
18155
+ }) : null,
18156
+ actions.askAbout && askMenu(actions.askAbout).show ? (0, import_jsx_runtime.jsx)(MenuItem, {
18157
+ onSelect: () => askMenu(actions.askAbout).open(),
18158
+ children: "Ask AI"
18159
+ }) : null
18160
+ ]
17922
18161
  }) : null
17923
18162
  })
17924
18163
  })
@@ -17927,15 +18166,14 @@ function MarkRow({ mark, open, onToggle, go, indent = false, picking = false, sh
17927
18166
  open ? mark.reads.map((r) => (0, import_jsx_runtime.jsx)(ReadRow, {
17928
18167
  read: r,
17929
18168
  go,
17930
- picking,
17931
18169
  indent,
17932
18170
  showOwner,
17933
18171
  latest: r.runId === mark.latestReport?.runId,
17934
- sameDayAsAnother: mark.reads.some((o) => o.runId !== r.runId && o.date === r.date),
18172
+ sameDayAsAnother: sameDateAsAnother(mark.reads, r),
17935
18173
  ...threaded ? { onRetire: onRetireRun } : {}
17936
18174
  }, r.runId)) : null,
17937
18175
  open && run.marks.length > 1 ? (0, import_jsx_runtime.jsx)("tr", { children: (0, import_jsx_runtime.jsx)("td", {
17938
- colSpan: (picking ? 7 : 6) + (showOwner ? 1 : 0),
18176
+ colSpan: 5 + (showOwner ? 1 : 0),
17939
18177
  style: { background: "var(--surface-sunken)" },
17940
18178
  children: (0, import_jsx_runtime.jsx)("div", {
17941
18179
  style: {
@@ -17962,7 +18200,7 @@ function MarkRow({ mark, open, onToggle, go, indent = false, picking = false, sh
17962
18200
  }) }) : null
17963
18201
  ] });
17964
18202
  }
17965
- function ReadRow({ read, go, picking, indent, showOwner = false, latest = false, sameDayAsAnother = false, onRetire }) {
18203
+ function ReadRow({ read, go, indent, showOwner = false, latest = false, sameDayAsAnother = false, onRetire }) {
17966
18204
  const openable = hasReport(read);
17967
18205
  const open = () => go(`/portal/result/${encodeURIComponent(read.runId)}`);
17968
18206
  const label = readLabelParts(read);
@@ -17970,68 +18208,82 @@ function ReadRow({ read, go, picking, indent, showOwner = false, latest = false,
17970
18208
  className: openable ? "read-row openable" : "read-row",
17971
18209
  ...openable ? { onClick: open } : {},
17972
18210
  children: [
17973
- (0, import_jsx_runtime.jsx)("td", { className: indent ? "nest-2" : "nest-1" }),
17974
- picking ? (0, import_jsx_runtime.jsx)("td", {}) : null,
17975
- (0, import_jsx_runtime.jsxs)("td", { children: [
17976
- (0, import_jsx_runtime.jsxs)("span", {
17977
- className: "mono",
17978
- style: {
17979
- fontSize: 12.5,
17980
- color: "var(--text-muted)"
17981
- },
17982
- children: [label.head && label.date ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
17983
- label.head,
17984
- " · ",
17985
- (0, import_jsx_runtime.jsx)("span", {
18211
+ (0, import_jsx_runtime.jsx)("td", { className: `clr-td-twisty ${indent ? "nest-2" : "nest-1"}` }),
18212
+ (0, import_jsx_runtime.jsxs)("td", {
18213
+ className: "clr-td-name",
18214
+ children: [
18215
+ (0, import_jsx_runtime.jsx)("b", {
18216
+ className: "clr-search-name",
18217
+ children: label.head ?? readLabel(read)
18218
+ }),
18219
+ (0, import_jsx_runtime.jsxs)("span", {
18220
+ className: "sub mono",
18221
+ style: { fontSize: 12.5 },
18222
+ children: [label.head && label.date ? (0, import_jsx_runtime.jsx)("span", {
17986
18223
  className: "nowrap-date",
17987
18224
  children: label.date
17988
- })
17989
- ] }) : readLabel(read), sameDayAsAnother && readTime(read) ? (0, import_jsx_runtime.jsxs)("span", {
17990
- style: { marginLeft: 6 },
17991
- children: [readTime(read), " UTC"]
17992
- }) : null]
17993
- }),
17994
- latest ? (0, import_jsx_runtime.jsx)("span", {
17995
- className: "pill",
17996
- style: { marginLeft: 8 },
17997
- children: "Latest report"
17998
- }) : null,
17999
- !openable && read.state === "delivered" ? (0, import_jsx_runtime.jsx)("span", {
18000
- className: "sub",
18001
- children: "Delivered — no report file found for this run."
18002
- }) : null
18003
- ] }),
18225
+ }) : null, sameDayAsAnother && readTime(read) ? (0, import_jsx_runtime.jsxs)("span", {
18226
+ style: { marginLeft: 6 },
18227
+ children: [readTime(read), " UTC"]
18228
+ }) : null]
18229
+ }),
18230
+ latest ? (0, import_jsx_runtime.jsx)("span", {
18231
+ className: "pill",
18232
+ style: { marginLeft: 8 },
18233
+ children: "Latest report"
18234
+ }) : null,
18235
+ !openable && read.state === "delivered" ? (0, import_jsx_runtime.jsx)("span", {
18236
+ className: "sub",
18237
+ children: "Delivered — no report file found for this run."
18238
+ }) : null
18239
+ ]
18240
+ }),
18004
18241
  showOwner ? (0, import_jsx_runtime.jsx)("td", {}) : null,
18005
- (0, import_jsx_runtime.jsx)("td", { children: (0, import_jsx_runtime.jsx)(StatusCell, {
18006
- state: read.state,
18007
- step: read.step,
18008
- reason: read.reason,
18009
- failedStage: read.failedStage,
18010
- stopRequestedAt: read.stopRequestedAt,
18011
- detailed: true
18012
- }) }),
18013
- (0, import_jsx_runtime.jsx)("td", { children: read.state === "delivered" && read.band ? (0, import_jsx_runtime.jsx)(RiskDot, {
18014
- tone: read.tone,
18015
- label: read.band
18016
- }) : (0, import_jsx_runtime.jsx)("span", {
18017
- style: { color: "var(--text-faint)" },
18018
- children: "—"
18019
- }) }),
18020
- (0, import_jsx_runtime.jsx)("td", { className: "col-date" }),
18242
+ (0, import_jsx_runtime.jsx)("td", {
18243
+ className: "clr-td-status",
18244
+ children: (0, import_jsx_runtime.jsx)(StatusCell, {
18245
+ state: read.state,
18246
+ step: read.step,
18247
+ reason: read.reason,
18248
+ failedStage: read.failedStage,
18249
+ stopRequestedAt: read.stopRequestedAt,
18250
+ detailed: true
18251
+ })
18252
+ }),
18253
+ (0, import_jsx_runtime.jsx)("td", {
18254
+ className: "clr-td-risk",
18255
+ children: read.state === "delivered" && read.band ? (0, import_jsx_runtime.jsxs)("span", {
18256
+ style: {
18257
+ display: "inline-flex",
18258
+ gap: 8,
18259
+ alignItems: "center"
18260
+ },
18261
+ children: [(0, import_jsx_runtime.jsx)("span", {
18262
+ className: "clr-phone-only",
18263
+ children: "Risk"
18264
+ }), (0, import_jsx_runtime.jsx)(RiskDot, {
18265
+ tone: read.tone,
18266
+ label: read.band
18267
+ })]
18268
+ }) : (0, import_jsx_runtime.jsx)("span", {
18269
+ style: { color: "var(--text-faint)" },
18270
+ children: "—"
18271
+ })
18272
+ }),
18021
18273
  (0, import_jsx_runtime.jsx)("td", {
18022
18274
  className: "col-actions",
18023
18275
  children: (0, import_jsx_runtime.jsx)(RowActions, {
18024
18276
  open: openable ? {
18025
- label: "Open",
18026
- go: open
18277
+ label: "Open report",
18278
+ go: open,
18279
+ name: `Open report for ${displayName(read)}, ${readLabel(read).replace(" · ", ", ")}`
18027
18280
  } : null,
18028
18281
  ask: null,
18029
18282
  menu: onRetire ? (0, import_jsx_runtime.jsx)(RowMenu$1, {
18030
18283
  label: `More actions for ${readLabel(read)}`,
18031
18284
  children: (0, import_jsx_runtime.jsx)(MenuItem, {
18032
- title: `Retire this search — ${readLabel(read)}. Only this search comes off the list; the other searches of this name stay, the report link keeps working, and "Show retired" brings it back`,
18033
18285
  onSelect: () => onRetire(read),
18034
- children: "Retire"
18286
+ children: "Retire this search…"
18035
18287
  })
18036
18288
  }) : null
18037
18289
  })
@@ -18105,6 +18357,282 @@ function AllowanceLine({ account, brand }) {
18105
18357
  children: line
18106
18358
  });
18107
18359
  }
18360
+ function AskDialog({ ask, onDone, onClose }) {
18361
+ const [busy, setBusy] = (0, import_react.useState)(false);
18362
+ const [failed, setFailed] = (0, import_react.useState)(null);
18363
+ const card = (0, import_react.useRef)(null);
18364
+ (0, import_react.useEffect)(() => {
18365
+ card.current?.querySelector(".clr-dialog-confirm")?.focus();
18366
+ const onKey = (e) => {
18367
+ if (e.key === "Escape") onClose();
18368
+ };
18369
+ document.addEventListener("keydown", onKey);
18370
+ return () => {
18371
+ document.removeEventListener("keydown", onKey);
18372
+ document.querySelector(`button[aria-label="${CSS.escape(ask.returnTo)}"]`)?.focus();
18373
+ };
18374
+ }, []);
18375
+ const go = async () => {
18376
+ setBusy(true);
18377
+ setFailed(null);
18378
+ const r = await ask.act();
18379
+ setBusy(false);
18380
+ if (r.kind !== "ok") {
18381
+ setFailed(saveFailureText(r));
18382
+ return;
18383
+ }
18384
+ ask.after();
18385
+ onDone(ask.done);
18386
+ };
18387
+ return (0, import_jsx_runtime.jsx)("div", {
18388
+ className: "modal-scrim",
18389
+ onClick: onClose,
18390
+ role: "dialog",
18391
+ "aria-modal": "true",
18392
+ "aria-labelledby": "clr-ask-title",
18393
+ children: (0, import_jsx_runtime.jsxs)("div", {
18394
+ className: "modal-card clr-dialog",
18395
+ ref: card,
18396
+ onClick: (e) => e.stopPropagation(),
18397
+ children: [
18398
+ (0, import_jsx_runtime.jsx)("div", {
18399
+ className: "modal-head",
18400
+ children: (0, import_jsx_runtime.jsx)("h2", {
18401
+ id: "clr-ask-title",
18402
+ className: "clr-dialog-title",
18403
+ "data-anon": "mark",
18404
+ children: ask.title
18405
+ })
18406
+ }),
18407
+ (0, import_jsx_runtime.jsxs)("div", {
18408
+ className: "clr-dialog-body",
18409
+ children: [(0, import_jsx_runtime.jsx)("p", {
18410
+ "data-anon": "mark",
18411
+ children: ask.body
18412
+ }), failed ? (0, import_jsx_runtime.jsx)("p", {
18413
+ className: "callout-accent",
18414
+ role: "alert",
18415
+ children: failed
18416
+ }) : null]
18417
+ }),
18418
+ (0, import_jsx_runtime.jsxs)("div", {
18419
+ className: "modal-foot",
18420
+ children: [(0, import_jsx_runtime.jsx)("button", {
18421
+ type: "button",
18422
+ className: "btn-primary clr-dialog-confirm",
18423
+ disabled: busy,
18424
+ onClick: () => void go(),
18425
+ children: ask.confirm
18426
+ }), (0, import_jsx_runtime.jsx)("button", {
18427
+ type: "button",
18428
+ className: "btn-ghost",
18429
+ onClick: onClose,
18430
+ children: "Cancel"
18431
+ })]
18432
+ })
18433
+ ]
18434
+ })
18435
+ });
18436
+ }
18437
+ function GroupingDialog({ marks, families, initialCompany, initialFamily, seed, companyName, onSaved, onClose }) {
18438
+ const companies = [...new Set(marks.map((m) => runKey(m)))];
18439
+ const [company, setCompany] = (0, import_react.useState)(initialCompany);
18440
+ const [target, setTarget] = (0, import_react.useState)(initialFamily ?? "");
18441
+ const [name, setName] = (0, import_react.useState)("");
18442
+ const [chosen, setChosen] = (0, import_react.useState)(new Set(seed));
18443
+ const [problem, setProblem] = (0, import_react.useState)(null);
18444
+ const [busy, setBusy] = (0, import_react.useState)(false);
18445
+ const card = (0, import_react.useRef)(null);
18446
+ const opener = (0, import_react.useRef)(document.activeElement);
18447
+ const locked = initialFamily !== null || seed.length > 0;
18448
+ (0, import_react.useEffect)(() => {
18449
+ card.current?.querySelector("select:not(:disabled), input:not(:disabled)")?.focus();
18450
+ const onKey = (e) => {
18451
+ if (e.key === "Escape") onClose();
18452
+ };
18453
+ document.addEventListener("keydown", onKey);
18454
+ return () => {
18455
+ document.removeEventListener("keydown", onKey);
18456
+ opener.current?.focus?.();
18457
+ };
18458
+ }, []);
18459
+ const here = marks.filter((m) => runKey(m) === company);
18460
+ const familiesHere = [...families.entries()].filter(([, f]) => f.company === company);
18461
+ const title = initialFamily ? `Add names to ${families.get(initialFamily)?.name ?? ""}` : "Group names as a family";
18462
+ const save = async () => {
18463
+ const picked = here.filter((m) => chosen.has(m.id) && (!target || m.familyId !== target));
18464
+ const familyName = target ? families.get(target)?.name ?? "" : name.trim();
18465
+ const reason = !familyName ? "Enter a family name." : !target && familiesHere.some(([, f]) => f.name.toLowerCase() === familyName.toLowerCase()) ? "Choose that existing family from the Family list." : !picked.length || !target && picked.length < 2 ? target ? "Select a name to add." : "Select two or more names for a new family." : null;
18466
+ if (reason) {
18467
+ setProblem(reason);
18468
+ return;
18469
+ }
18470
+ setBusy(true);
18471
+ const r = await api.setFamily({
18472
+ action: "group",
18473
+ name: familyName,
18474
+ runIds: picked.flatMap((m) => m.reads.map((x) => x.runId))
18475
+ });
18476
+ setBusy(false);
18477
+ if (r.kind !== "ok") {
18478
+ setProblem(saveFailureText(r));
18479
+ return;
18480
+ }
18481
+ onSaved(picked.length === 1 ? `1 name grouped under ${familyName}.` : `${picked.length} names grouped under ${familyName}.`);
18482
+ };
18483
+ return (0, import_jsx_runtime.jsx)("div", {
18484
+ className: "modal-scrim",
18485
+ onClick: onClose,
18486
+ role: "dialog",
18487
+ "aria-modal": "true",
18488
+ "aria-labelledby": "clr-group-title",
18489
+ children: (0, import_jsx_runtime.jsxs)("div", {
18490
+ className: "modal-card clr-dialog",
18491
+ ref: card,
18492
+ onClick: (e) => e.stopPropagation(),
18493
+ children: [
18494
+ (0, import_jsx_runtime.jsx)("div", {
18495
+ className: "modal-head",
18496
+ children: (0, import_jsx_runtime.jsx)("h2", {
18497
+ id: "clr-group-title",
18498
+ className: "clr-dialog-title",
18499
+ "data-anon": "mark",
18500
+ children: title
18501
+ })
18502
+ }),
18503
+ (0, import_jsx_runtime.jsxs)("div", {
18504
+ className: "clr-dialog-body",
18505
+ children: [
18506
+ (0, import_jsx_runtime.jsxs)("label", {
18507
+ className: "clr-field",
18508
+ children: [(0, import_jsx_runtime.jsx)("span", {
18509
+ className: "field-label",
18510
+ children: "Company"
18511
+ }), (0, import_jsx_runtime.jsx)("select", {
18512
+ className: "ctx-select",
18513
+ value: company,
18514
+ disabled: locked,
18515
+ "data-anon": "mark",
18516
+ onChange: (e) => {
18517
+ setCompany(e.target.value);
18518
+ setTarget("");
18519
+ setChosen(new Set());
18520
+ setProblem(null);
18521
+ },
18522
+ children: companies.map((k) => (0, import_jsx_runtime.jsx)("option", {
18523
+ value: k,
18524
+ children: companyName(k)
18525
+ }, k))
18526
+ })]
18527
+ }),
18528
+ (0, import_jsx_runtime.jsxs)("label", {
18529
+ className: "clr-field",
18530
+ children: [(0, import_jsx_runtime.jsx)("span", {
18531
+ className: "field-label",
18532
+ children: "Family"
18533
+ }), (0, import_jsx_runtime.jsxs)("select", {
18534
+ className: "ctx-select",
18535
+ value: target,
18536
+ "data-anon": "mark",
18537
+ onChange: (e) => {
18538
+ setTarget(e.target.value);
18539
+ setProblem(null);
18540
+ },
18541
+ children: [(0, import_jsx_runtime.jsx)("option", {
18542
+ value: "",
18543
+ children: "Create a new family"
18544
+ }), familiesHere.map(([id, f]) => (0, import_jsx_runtime.jsx)("option", {
18545
+ value: id,
18546
+ children: f.name
18547
+ }, id))]
18548
+ })]
18549
+ }),
18550
+ !target ? (0, import_jsx_runtime.jsxs)("label", {
18551
+ className: "clr-field",
18552
+ children: [(0, import_jsx_runtime.jsx)("span", {
18553
+ className: "field-label",
18554
+ children: "Family name"
18555
+ }), (0, import_jsx_runtime.jsx)("input", {
18556
+ className: "ctx-input",
18557
+ type: "text",
18558
+ maxLength: 60,
18559
+ value: name,
18560
+ "data-anon": "mark",
18561
+ onChange: (e) => {
18562
+ setName(e.target.value);
18563
+ setProblem(null);
18564
+ }
18565
+ })]
18566
+ }) : null,
18567
+ (0, import_jsx_runtime.jsxs)("fieldset", {
18568
+ className: "clr-names",
18569
+ children: [(0, import_jsx_runtime.jsx)("legend", {
18570
+ className: "field-label",
18571
+ children: "Names to group"
18572
+ }), here.map((m) => {
18573
+ const already = Boolean(target) && m.familyId === target;
18574
+ const inFamily = m.familyId ? families.get(m.familyId)?.name ?? null : null;
18575
+ return (0, import_jsx_runtime.jsxs)("label", {
18576
+ className: "clr-name-choice",
18577
+ children: [
18578
+ (0, import_jsx_runtime.jsx)("input", {
18579
+ type: "checkbox",
18580
+ className: "pickbox",
18581
+ checked: already || chosen.has(m.id),
18582
+ disabled: already,
18583
+ onChange: () => {
18584
+ setChosen((prev) => {
18585
+ const next = new Set(prev);
18586
+ if (next.has(m.id)) next.delete(m.id);
18587
+ else next.add(m.id);
18588
+ return next;
18589
+ });
18590
+ setProblem(null);
18591
+ }
18592
+ }),
18593
+ (0, import_jsx_runtime.jsx)("span", {
18594
+ "data-anon": "mark",
18595
+ children: m.name
18596
+ }),
18597
+ inFamily ? (0, import_jsx_runtime.jsxs)("span", {
18598
+ className: "clr-quiet",
18599
+ "data-anon": "mark",
18600
+ children: [" · ", inFamily]
18601
+ }) : null
18602
+ ]
18603
+ }, m.id);
18604
+ })]
18605
+ }),
18606
+ (0, import_jsx_runtime.jsx)("p", {
18607
+ className: "clr-quiet",
18608
+ children: "Each selected name brings its search history."
18609
+ }),
18610
+ problem ? (0, import_jsx_runtime.jsx)("p", {
18611
+ className: "callout-accent",
18612
+ role: "alert",
18613
+ children: problem
18614
+ }) : null
18615
+ ]
18616
+ }),
18617
+ (0, import_jsx_runtime.jsxs)("div", {
18618
+ className: "modal-foot",
18619
+ children: [(0, import_jsx_runtime.jsx)("button", {
18620
+ type: "button",
18621
+ className: "btn-primary",
18622
+ disabled: busy,
18623
+ onClick: () => void save(),
18624
+ children: "Save family"
18625
+ }), (0, import_jsx_runtime.jsx)("button", {
18626
+ type: "button",
18627
+ className: "btn-ghost",
18628
+ onClick: onClose,
18629
+ children: "Cancel"
18630
+ })]
18631
+ })
18632
+ ]
18633
+ })
18634
+ });
18635
+ }
18108
18636
  // src/contract/inlineMd.ts
18109
18637
  var INLINE = /\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|\*([^*]+)\*|`([^`]+)`/g;
18110
18638
  var isLinkTarget = (href) => /^https?:\/\//i.test(href) || /^mailto:/i.test(href);
@@ -18293,6 +18821,33 @@ function readFrameScroll(data, sameSource) {
18293
18821
  if (typeof msg.top !== "number" || !Number.isFinite(msg.top)) return null;
18294
18822
  return Math.min(Math.max(msg.top, 0), MAX_FRAME);
18295
18823
  }
18824
+ function readFrameScrollBy(data, sameSource) {
18825
+ if (!sameSource) return null;
18826
+ if (typeof data !== "object" || data === null) return null;
18827
+ const msg = data;
18828
+ if (msg.source !== "cordillera-report" || msg.type !== "scrollBy") return null;
18829
+ if (typeof msg.dy !== "number" || !Number.isFinite(msg.dy)) return null;
18830
+ return Math.min(Math.max(msg.dy, -2e5), MAX_FRAME);
18831
+ }
18832
+ var CARD_ID = /^(c\d{1,4}|k\d{1,3}-\d{1,4})$/;
18833
+ function readCopyLink(data, sameSource) {
18834
+ if (!sameSource) return null;
18835
+ if (typeof data !== "object" || data === null) return null;
18836
+ const m = data;
18837
+ if (m.source !== "cordillera-report" || m.type !== "copyLink") return null;
18838
+ return typeof m.card === "string" && CARD_ID.test(m.card) ? { card: m.card } : null;
18839
+ }
18840
+ function cardAddress(href, card) {
18841
+ const url = new URL(href);
18842
+ url.search = "";
18843
+ url.hash = "";
18844
+ url.searchParams.set("card", card);
18845
+ return url.toString();
18846
+ }
18847
+ function cardFromSearch(search) {
18848
+ const card = new URLSearchParams(search).get("card");
18849
+ return card !== null && CARD_ID.test(card) ? card : null;
18850
+ }
18296
18851
  function readCommandFailure(data, sameSource) {
18297
18852
  if (!sameSource) return null;
18298
18853
  if (typeof data !== "object" || data === null) return null;
@@ -18365,6 +18920,24 @@ function frameCommand(command, value) {
18365
18920
  value
18366
18921
  };
18367
18922
  }
18923
+ // src/components/pinnedRowFits.ts
18924
+ function compactRowFits(head) {
18925
+ const row = head.querySelector(".report-head-row");
18926
+ if (!(row instanceof HTMLElement) || row.scrollWidth > row.clientWidth + 1) return false;
18927
+ const sections = head.querySelector(".report-sections");
18928
+ if (sections instanceof HTMLElement && sections.scrollWidth > sections.clientWidth + 1) return false;
18929
+ const ask = head.querySelector(".ask-ai-btn");
18930
+ if (ask instanceof HTMLElement && ask.getClientRects().length > 0) {
18931
+ const line = parseFloat(getComputedStyle(ask).lineHeight) || 20;
18932
+ if (ask.scrollHeight > line * 1.8 + 12) return false;
18933
+ }
18934
+ const name = head.querySelector(".report-head-name");
18935
+ if (name instanceof HTMLElement && name.scrollWidth > name.clientWidth + 1) {
18936
+ const longest = parseFloat(getComputedStyle(name).maxWidth);
18937
+ if (!Number.isFinite(longest) || name.scrollWidth <= longest + 1) return false;
18938
+ }
18939
+ return true;
18940
+ }
18368
18941
  // src/screens/Result.tsx
18369
18942
  function usePortalTheme() {
18370
18943
  const read = () => document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
@@ -18379,8 +18952,193 @@ function usePortalTheme() {
18379
18952
  }, []);
18380
18953
  return theme;
18381
18954
  }
18382
- var TOPBAR_PX = 56;
18383
- var LANDING_PX = 10;
18955
+ var TOPBAR_PX = 56;
18956
+ var LANDING_PX = 10;
18957
+ var LANDING_SETTLE_MS = 4e3;
18958
+ var DESKTOP = "(min-width: 900px)";
18959
+ var PINNED_ROW_PX = 57;
18960
+ function pinnedHeight() {
18961
+ const head = document.querySelector(".report-head");
18962
+ if (!(head instanceof HTMLElement)) return 48;
18963
+ if (window.matchMedia(DESKTOP).matches) return head.classList.contains("compact") || head.classList.contains("pinned-full") ? head.offsetHeight : PINNED_ROW_PX;
18964
+ return head.offsetHeight;
18965
+ }
18966
+ function usePinnedHeader(ready) {
18967
+ const slotRef = (0, import_react.useRef)(null);
18968
+ const sentinelRef = (0, import_react.useRef)(null);
18969
+ const [desktop, setDesktop] = (0, import_react.useState)(() => window.matchMedia(DESKTOP).matches);
18970
+ const [compact, setCompact] = (0, import_react.useState)(false);
18971
+ const [held, setHeld] = (0, import_react.useState)(null);
18972
+ const [box, setBox] = (0, import_react.useState)(null);
18973
+ (0, import_react.useEffect)(() => {
18974
+ const mq = window.matchMedia(DESKTOP);
18975
+ const on = () => setDesktop(mq.matches);
18976
+ mq.addEventListener("change", on);
18977
+ return () => mq.removeEventListener("change", on);
18978
+ }, []);
18979
+ (0, import_react.useEffect)(() => {
18980
+ const sentinel = sentinelRef.current;
18981
+ const slot = slotRef.current;
18982
+ if (!desktop || !ready || !sentinel || !slot) {
18983
+ setCompact(false);
18984
+ setHeld(null);
18985
+ return;
18986
+ }
18987
+ const io = new IntersectionObserver(([e]) => {
18988
+ if (!e) return;
18989
+ if (!e.isIntersecting && e.boundingClientRect.top < TOPBAR_PX) {
18990
+ setHeld((h) => h ?? slot.offsetHeight);
18991
+ setCompact(true);
18992
+ } else {
18993
+ setCompact(false);
18994
+ setHeld(null);
18995
+ }
18996
+ }, {
18997
+ rootMargin: `-${TOPBAR_PX}px 0px 0px 0px`,
18998
+ threshold: 0
18999
+ });
19000
+ io.observe(sentinel);
19001
+ const place = () => {
19002
+ const r = slot.getBoundingClientRect();
19003
+ setBox({
19004
+ left: r.left,
19005
+ width: r.width
19006
+ });
19007
+ };
19008
+ place();
19009
+ const ro = new ResizeObserver(place);
19010
+ ro.observe(slot);
19011
+ window.addEventListener("resize", place);
19012
+ return () => {
19013
+ io.disconnect();
19014
+ ro.disconnect();
19015
+ window.removeEventListener("resize", place);
19016
+ };
19017
+ }, [desktop, ready]);
19018
+ const [tooNarrow, setTooNarrow] = (0, import_react.useState)(null);
19019
+ const width = box?.width ?? null;
19020
+ const shown = compact && !(tooNarrow !== null && width !== null && width <= tooNarrow);
19021
+ (0, import_react.useLayoutEffect)(() => {
19022
+ if (!shown || width === null) return;
19023
+ const head = slotRef.current?.querySelector(".report-head.compact");
19024
+ if (!(head instanceof HTMLElement)) return;
19025
+ if (!compactRowFits(head)) setTooNarrow(width);
19026
+ }, [shown, width]);
19027
+ return {
19028
+ slotRef,
19029
+ sentinelRef,
19030
+ compact: shown,
19031
+ pinnedFull: compact && !shown,
19032
+ held,
19033
+ box
19034
+ };
19035
+ }
19036
+ function SearchHistory({ rows, go }) {
19037
+ const [open, setOpen] = (0, import_react.useState)(false);
19038
+ const box = (0, import_react.useRef)(null);
19039
+ const button = (0, import_react.useRef)(null);
19040
+ (0, import_react.useEffect)(() => {
19041
+ if (!open) return;
19042
+ const onDown = (e) => {
19043
+ if (box.current && !box.current.contains(e.target)) setOpen(false);
19044
+ };
19045
+ const onKey = (e) => {
19046
+ if (e.key === "Escape") {
19047
+ setOpen(false);
19048
+ button.current?.focus();
19049
+ }
19050
+ };
19051
+ document.addEventListener("mousedown", onDown);
19052
+ document.addEventListener("keydown", onKey);
19053
+ return () => {
19054
+ document.removeEventListener("mousedown", onDown);
19055
+ document.removeEventListener("keydown", onKey);
19056
+ };
19057
+ }, [open]);
19058
+ return (0, import_jsx_runtime.jsxs)("div", {
19059
+ className: "report-history",
19060
+ ref: box,
19061
+ children: [(0, import_jsx_runtime.jsxs)("button", {
19062
+ ref: button,
19063
+ type: "button",
19064
+ className: "report-history-btn",
19065
+ "aria-expanded": open,
19066
+ "aria-haspopup": "true",
19067
+ onClick: () => setOpen((o) => !o),
19068
+ children: [
19069
+ "Search history · ",
19070
+ rows.length,
19071
+ (0, import_jsx_runtime.jsx)("svg", {
19072
+ width: "10",
19073
+ height: "10",
19074
+ viewBox: "0 0 10 10",
19075
+ fill: "none",
19076
+ stroke: "currentColor",
19077
+ strokeWidth: "1.8",
19078
+ strokeLinecap: "round",
19079
+ strokeLinejoin: "round",
19080
+ "aria-hidden": "true",
19081
+ children: (0, import_jsx_runtime.jsx)("path", { d: "M2 3.5l3 3 3-3" })
19082
+ })
19083
+ ]
19084
+ }), open ? (0, import_jsx_runtime.jsx)("ul", {
19085
+ className: "report-history-list",
19086
+ "aria-label": "Search history",
19087
+ children: rows.map((r) => {
19088
+ const { head, date } = readLabelParts(r.run);
19089
+ return (0, import_jsx_runtime.jsx)("li", { children: (0, import_jsx_runtime.jsxs)("button", {
19090
+ type: "button",
19091
+ className: `report-history-row${r.current ? " current" : ""}`,
19092
+ "aria-current": r.current ? "true" : void 0,
19093
+ onClick: () => {
19094
+ setOpen(false);
19095
+ if (!r.current) go(resultPath(r.run.runId));
19096
+ },
19097
+ children: [
19098
+ r.run.tone ? (0, import_jsx_runtime.jsx)("span", {
19099
+ className: "dot",
19100
+ style: {
19101
+ background: `var(--tone-${r.run.tone})`,
19102
+ width: 7,
19103
+ height: 7
19104
+ },
19105
+ "aria-hidden": "true"
19106
+ }) : (0, import_jsx_runtime.jsx)("span", {
19107
+ className: "report-history-nodot",
19108
+ "aria-hidden": "true"
19109
+ }),
19110
+ (0, import_jsx_runtime.jsxs)("span", {
19111
+ className: "report-history-text",
19112
+ children: [(0, import_jsx_runtime.jsx)("span", {
19113
+ className: "report-history-search",
19114
+ children: head ?? r.label
19115
+ }), date ? (0, import_jsx_runtime.jsxs)("span", {
19116
+ className: "report-history-date",
19117
+ children: [date, r.time ? ` · ${r.time}` : ""]
19118
+ }) : null]
19119
+ }),
19120
+ r.latest ? (0, import_jsx_runtime.jsx)("span", {
19121
+ className: "pill report-history-tag",
19122
+ children: "Latest report"
19123
+ }) : null,
19124
+ r.live ? (0, import_jsx_runtime.jsx)("span", {
19125
+ className: "report-history-live",
19126
+ children: r.live
19127
+ }) : null,
19128
+ r.current ? (0, import_jsx_runtime.jsx)("span", {
19129
+ className: "report-history-tick",
19130
+ "aria-hidden": "true",
19131
+ children: (0, import_jsx_runtime.jsx)(Icon, {
19132
+ name: "check",
19133
+ size: 14
19134
+ })
19135
+ }) : null
19136
+ ]
19137
+ }) }, r.run.runId);
19138
+ })
19139
+ }) : null]
19140
+ });
19141
+ }
18384
19142
  function useReportFrame() {
18385
19143
  const ref = (0, import_react.useRef)(null);
18386
19144
  const [height, setHeight] = (0, import_react.useState)(FIRST_PAINT);
@@ -18413,8 +19171,7 @@ function useReportFrame() {
18413
19171
  const jump = readFrameScroll(e.data, mine);
18414
19172
  if (jump !== null) {
18415
19173
  if (frame) {
18416
- const head = document.querySelector(".report-head");
18417
- const chrome = TOPBAR_PX + (head instanceof HTMLElement ? head.offsetHeight : 48) + LANDING_PX;
19174
+ const chrome = TOPBAR_PX + pinnedHeight() + LANDING_PX;
18418
19175
  const y = frame.getBoundingClientRect().top + window.scrollY + jump - chrome;
18419
19176
  window.scrollTo({
18420
19177
  top: Math.max(0, y),
@@ -18423,6 +19180,21 @@ function useReportFrame() {
18423
19180
  }
18424
19181
  return;
18425
19182
  }
19183
+ const by = readFrameScrollBy(e.data, mine);
19184
+ if (by !== null) {
19185
+ window.scrollBy({ top: by });
19186
+ return;
19187
+ }
19188
+ const copy = readCopyLink(e.data, mine);
19189
+ if (copy) {
19190
+ const answer = (ok) => frame?.contentWindow?.postMessage(frameCommand("copied", ok), "*");
19191
+ try {
19192
+ navigator.clipboard.writeText(cardAddress(window.location.href, copy.card)).then(() => answer(true), () => answer(false));
19193
+ } catch {
19194
+ answer(false);
19195
+ }
19196
+ return;
19197
+ }
18426
19198
  const bad = readCommandFailure(e.data, mine);
18427
19199
  if (bad) {
18428
19200
  setFailed(`That did not work — the report could not ${bad.command}. (${bad.message})`);
@@ -18444,6 +19216,41 @@ function useReportFrame() {
18444
19216
  setFailed(null);
18445
19217
  ref.current?.contentWindow?.postMessage(frameCommand(command, value), "*");
18446
19218
  }, []);
19219
+ const landedOn = (0, import_react.useRef)(null);
19220
+ const settling = (0, import_react.useRef)(null);
19221
+ (0, import_react.useEffect)(() => {
19222
+ if (sections === null) return;
19223
+ const card = cardFromSearch(window.location.search);
19224
+ if (card !== null && landedOn.current !== card) {
19225
+ landedOn.current = card;
19226
+ settling.current = {
19227
+ card,
19228
+ until: Date.now() + LANDING_SETTLE_MS
19229
+ };
19230
+ send("section", card);
19231
+ }
19232
+ }, [sections, send]);
19233
+ const reland = (0, import_react.useCallback)(() => {
19234
+ const land = settling.current;
19235
+ if (land && Date.now() < land.until) send("section", land.card);
19236
+ }, [send]);
19237
+ (0, import_react.useEffect)(() => {
19238
+ reland();
19239
+ }, [height, reland]);
19240
+ (0, import_react.useEffect)(() => {
19241
+ const stop = () => {
19242
+ settling.current = null;
19243
+ };
19244
+ const opts = { passive: true };
19245
+ window.addEventListener("wheel", stop, opts);
19246
+ window.addEventListener("touchstart", stop, opts);
19247
+ window.addEventListener("keydown", stop);
19248
+ return () => {
19249
+ window.removeEventListener("wheel", stop);
19250
+ window.removeEventListener("touchstart", stop);
19251
+ window.removeEventListener("keydown", stop);
19252
+ };
19253
+ }, []);
18447
19254
  const theme = usePortalTheme();
18448
19255
  (0, import_react.useEffect)(() => {
18449
19256
  if (hello) send("theme", theme);
@@ -18456,6 +19263,7 @@ function useReportFrame() {
18456
19263
  ref,
18457
19264
  height,
18458
19265
  send,
19266
+ reland,
18459
19267
  failed,
18460
19268
  controls,
18461
19269
  sections,
@@ -18624,6 +19432,16 @@ function Result({ ctx, runId, markSlug }) {
18624
19432
  const run = (0, import_react.useMemo)(() => runs.find((r) => r.runId === runId) ?? null, [runs, runId]);
18625
19433
  const reads = (0, import_react.useMemo)(() => run ? readsFor(runs, run) : [], [runs, run]);
18626
19434
  const frame = useReportFrame();
19435
+ const pin = usePinnedHeader(Boolean(run));
19436
+ const { reland } = frame;
19437
+ (0, import_react.useEffect)(() => {
19438
+ reland();
19439
+ }, [
19440
+ pin.compact,
19441
+ pin.pinnedFull,
19442
+ reland
19443
+ ]);
19444
+ const history = (0, import_react.useMemo)(() => run ? searchHistory(reads, run.runId) : [], [reads, run]);
18627
19445
  const [reached, setReached] = (0, import_react.useState)(0);
18628
19446
  const sectionList = frame.sections;
18629
19447
  const frameRef = frame.ref;
@@ -18687,6 +19505,23 @@ function Result({ ctx, runId, markSlug }) {
18687
19505
  label: "All names",
18688
19506
  href: family
18689
19507
  };
19508
+ const sectionStrip = (0, import_jsx_runtime.jsx)("nav", {
19509
+ className: "report-sections",
19510
+ "aria-label": "Sections of this report",
19511
+ children: (frame.sections ?? []).map((sec, i) => {
19512
+ return (0, import_jsx_runtime.jsxs)("button", {
19513
+ type: "button",
19514
+ className: "report-section",
19515
+ "data-reached": i < reached ? "true" : void 0,
19516
+ "aria-current": i === reached - 1 ? "true" : void 0,
19517
+ onClick: () => frame.send("section", sec.id),
19518
+ children: [(0, import_jsx_runtime.jsx)("span", {
19519
+ className: "report-section-dot",
19520
+ "aria-hidden": "true"
19521
+ }), sec.label]
19522
+ }, sec.id);
19523
+ })
19524
+ });
18690
19525
  return (0, import_jsx_runtime.jsxs)("div", {
18691
19526
  className: "screen report",
18692
19527
  children: [
@@ -18722,132 +19557,135 @@ function Result({ ctx, runId, markSlug }) {
18722
19557
  ]
18723
19558
  }),
18724
19559
  (0, import_jsx_runtime.jsxs)("div", {
18725
- className: "report-head",
19560
+ className: "report-head-slot",
19561
+ ref: pin.slotRef,
19562
+ style: (pin.compact || pin.pinnedFull) && pin.held ? { height: pin.held } : void 0,
18726
19563
  children: [(0, import_jsx_runtime.jsxs)("div", {
18727
- style: {
18728
- display: "flex",
18729
- alignItems: "center",
18730
- gap: 12,
18731
- flexWrap: "wrap",
18732
- marginBottom: 2
18733
- },
18734
- children: [
18735
- (0, import_jsx_runtime.jsx)("h1", {
18736
- style: {
18737
- fontSize: 19,
18738
- fontWeight: 700,
18739
- margin: 0,
18740
- color: "var(--text-strong)"
18741
- },
18742
- "data-anon": "mark",
18743
- children: heading
18744
- }),
18745
- (0, import_jsx_runtime.jsxs)("div", {
18746
- style: {
18747
- color: "var(--text-muted)",
18748
- fontSize: 13
18749
- },
18750
- children: [
18751
- (0, import_jsx_runtime.jsx)("span", {
18752
- "data-anon": "mark",
18753
- children: ctx.ownerName(runKey(run))
18754
- }),
18755
- product ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · ", product] }) : null,
18756
- !product && run.kind === "knockout-batch" ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
18757
- " · ",
18758
- run.marks.length,
18759
- " names"
18760
- ] }) : null,
18761
- run.date ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · searched ", (0, import_jsx_runtime.jsx)("span", {
18762
- className: "mono",
18763
- children: run.date
18764
- })] }) : null,
18765
- issued ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · issued ", (0, import_jsx_runtime.jsx)("span", {
18766
- className: "mono",
18767
- children: issued
18768
- })] }) : null
18769
- ]
18770
- }),
18771
- (0, import_jsx_runtime.jsx)(RiskDot, {
18772
- tone: run.tone,
18773
- label: run.band
18774
- }),
18775
- (0, import_jsx_runtime.jsx)("span", { style: { flex: 1 } }),
18776
- (0, import_jsx_runtime.jsx)(AskAi, {
18777
- runId: run.runId,
18778
- markSlug,
18779
- markName: run.markName,
18780
- date: run.date,
18781
- kind: run.kind,
18782
- productName: product,
18783
- access,
18784
- go: ctx.go,
18785
- openOnArrival: askOnArrival,
18786
- fromFinding: findingAsked(frame.askedFrom, run.kind, pickedMark)
18787
- }),
18788
- doc ? (0, import_jsx_runtime.jsx)(ExportMenu, {
18789
- send: frame.send,
18790
- runId: run.runId,
18791
- offered: frame.controls ?? []
18792
- }) : null
18793
- ]
18794
- }), hasThread(reads) || (frame.sections?.length ?? 0) > 1 ? (0, import_jsx_runtime.jsxs)("div", {
18795
- className: "report-nav",
18796
- children: [hasThread(reads) ? (0, import_jsx_runtime.jsxs)("div", {
18797
- style: {
18798
- display: "flex",
18799
- gap: 8,
18800
- flexWrap: "wrap",
18801
- alignItems: "center"
18802
- },
18803
- children: [(0, import_jsx_runtime.jsx)("span", {
18804
- className: "eyebrow",
18805
- style: { alignSelf: "center" },
18806
- children: "Reads"
18807
- }), reads.map((r) => {
18808
- const active = r.runId === run.runId;
18809
- return (0, import_jsx_runtime.jsxs)("button", {
19564
+ className: `report-head${pin.compact ? " compact" : ""}${pin.pinnedFull ? " pinned-full" : ""}`,
19565
+ style: (pin.compact || pin.pinnedFull) && pin.box ? {
19566
+ left: pin.box.left,
19567
+ width: pin.box.width
19568
+ } : void 0,
19569
+ children: [(0, import_jsx_runtime.jsxs)("div", {
19570
+ className: "report-head-row",
19571
+ children: [
19572
+ pin.compact ? (0, import_jsx_runtime.jsx)("button", {
18810
19573
  type: "button",
18811
- className: "pill",
18812
- "aria-current": active ? "true" : void 0,
18813
- onClick: () => ctx.go(resultPath(r.runId)),
19574
+ className: "btn-ghost report-back-icon",
19575
+ "aria-label": back.label,
19576
+ title: back.label,
19577
+ onClick: () => ctx.go(back.href),
19578
+ children: (0, import_jsx_runtime.jsx)(Icon, {
19579
+ name: "chevron-left",
19580
+ size: 14
19581
+ })
19582
+ }) : null,
19583
+ (0, import_jsx_runtime.jsx)("h1", {
19584
+ className: "report-head-name",
19585
+ title: pin.compact ? heading : void 0,
19586
+ "data-anon": "mark",
19587
+ children: heading
19588
+ }),
19589
+ pin.compact ? null : (0, import_jsx_runtime.jsxs)("div", {
18814
19590
  style: {
18815
- cursor: "pointer",
18816
- display: "inline-flex",
18817
- alignItems: "center",
18818
- gap: 7,
18819
- background: active ? "var(--accent-wash)" : "var(--surface-sunken)",
18820
- borderColor: active ? "var(--accent)" : "var(--border-hairline)",
18821
- color: active ? "var(--text-accent)" : "var(--text-muted)"
19591
+ color: "var(--text-muted)",
19592
+ fontSize: 13
18822
19593
  },
18823
- children: [r.tone ? (0, import_jsx_runtime.jsx)("span", {
18824
- className: "dot",
19594
+ children: [
19595
+ (0, import_jsx_runtime.jsx)("span", {
19596
+ "data-anon": "mark",
19597
+ children: ctx.ownerName(runKey(run))
19598
+ }),
19599
+ product ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · ", product] }) : null,
19600
+ !product && run.kind === "knockout-batch" ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
19601
+ " · ",
19602
+ run.marks.length,
19603
+ " names"
19604
+ ] }) : null,
19605
+ run.date ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · searched ", (0, import_jsx_runtime.jsx)("span", {
19606
+ className: "mono",
19607
+ children: run.date
19608
+ })] }) : null,
19609
+ issued ? (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" · issued ", (0, import_jsx_runtime.jsx)("span", {
19610
+ className: "mono",
19611
+ children: issued
19612
+ })] }) : null
19613
+ ]
19614
+ }),
19615
+ (0, import_jsx_runtime.jsx)(RiskDot, {
19616
+ tone: run.tone,
19617
+ label: run.band
19618
+ }),
19619
+ pin.compact && hasThread(reads) ? (0, import_jsx_runtime.jsx)(SearchHistory, {
19620
+ rows: history,
19621
+ go: ctx.go
19622
+ }) : null,
19623
+ pin.compact && (frame.sections?.length ?? 0) > 1 ? sectionStrip : null,
19624
+ (0, import_jsx_runtime.jsx)("span", { className: "report-head-gap" }),
19625
+ (0, import_jsx_runtime.jsx)(AskAi, {
19626
+ runId: run.runId,
19627
+ markSlug,
19628
+ markName: run.markName,
19629
+ date: run.date,
19630
+ kind: run.kind,
19631
+ productName: product,
19632
+ access,
19633
+ go: ctx.go,
19634
+ openOnArrival: askOnArrival,
19635
+ fromFinding: findingAsked(frame.askedFrom, run.kind, pickedMark)
19636
+ }),
19637
+ doc ? (0, import_jsx_runtime.jsx)(ExportMenu, {
19638
+ send: frame.send,
19639
+ runId: run.runId,
19640
+ offered: frame.controls ?? []
19641
+ }) : null
19642
+ ]
19643
+ }), !pin.compact && (hasThread(reads) || (frame.sections?.length ?? 0) > 1) ? (0, import_jsx_runtime.jsxs)("div", {
19644
+ className: "report-nav",
19645
+ children: [hasThread(reads) ? (0, import_jsx_runtime.jsxs)("div", {
19646
+ style: {
19647
+ display: "flex",
19648
+ gap: 8,
19649
+ flexWrap: "wrap",
19650
+ alignItems: "center"
19651
+ },
19652
+ children: [(0, import_jsx_runtime.jsx)("span", {
19653
+ className: "eyebrow",
19654
+ style: { alignSelf: "center" },
19655
+ children: "Search history"
19656
+ }), reads.map((r) => {
19657
+ const active = r.runId === run.runId;
19658
+ return (0, import_jsx_runtime.jsxs)("button", {
19659
+ type: "button",
19660
+ className: "pill",
19661
+ "aria-current": active ? "true" : void 0,
19662
+ onClick: () => ctx.go(resultPath(r.runId)),
18825
19663
  style: {
18826
- background: `var(--tone-${r.tone})`,
18827
- width: 7,
18828
- height: 7
18829
- }
18830
- }) : null, readLabel(r)]
18831
- }, r.runId);
18832
- })]
18833
- }) : null, (frame.sections?.length ?? 0) > 1 ? (0, import_jsx_runtime.jsx)("nav", {
18834
- className: "report-sections",
18835
- "aria-label": "Sections of this report",
18836
- children: (frame.sections ?? []).map((sec, i) => {
18837
- return (0, import_jsx_runtime.jsxs)("button", {
18838
- type: "button",
18839
- className: "report-section",
18840
- "data-reached": i < reached ? "true" : void 0,
18841
- "aria-current": i === reached - 1 ? "true" : void 0,
18842
- onClick: () => frame.send("section", sec.id),
18843
- children: [(0, import_jsx_runtime.jsx)("span", {
18844
- className: "report-section-dot",
18845
- "aria-hidden": "true"
18846
- }), sec.label]
18847
- }, sec.id);
18848
- })
19664
+ cursor: "pointer",
19665
+ display: "inline-flex",
19666
+ alignItems: "center",
19667
+ gap: 7,
19668
+ background: active ? "var(--accent-wash)" : "var(--surface-sunken)",
19669
+ borderColor: active ? "var(--accent)" : "var(--border-hairline)",
19670
+ color: active ? "var(--text-accent)" : "var(--text-muted)"
19671
+ },
19672
+ children: [r.tone ? (0, import_jsx_runtime.jsx)("span", {
19673
+ className: "dot",
19674
+ style: {
19675
+ background: `var(--tone-${r.tone})`,
19676
+ width: 7,
19677
+ height: 7
19678
+ }
19679
+ }) : null, readLabel(r)]
19680
+ }, r.runId);
19681
+ })]
19682
+ }) : null, (frame.sections?.length ?? 0) > 1 ? sectionStrip : null]
18849
19683
  }) : null]
18850
- }) : null]
19684
+ }), (0, import_jsx_runtime.jsx)("span", {
19685
+ className: "report-head-sentinel",
19686
+ ref: pin.sentinelRef,
19687
+ "aria-hidden": "true"
19688
+ })]
18851
19689
  }),
18852
19690
  frame.failed ? (0, import_jsx_runtime.jsxs)("div", {
18853
19691
  className: "notice",
@@ -19088,7 +19926,8 @@ function engineRow(engine, { programDisputed = false, channel = null, name = PRO
19088
19926
  name: "Not set",
19089
19927
  mono: "",
19090
19928
  state: "Missing",
19091
- faults
19929
+ faults,
19930
+ command: `npx ${setupPackage(channel)} install`
19092
19931
  };
19093
19932
  return {
19094
19933
  ok: faults.length === 0,
@@ -19551,7 +20390,8 @@ var EMPTY = {
19551
20390
  ref: "",
19552
20391
  deadline: "",
19553
20392
  instructions: "",
19554
- brief: ""
20393
+ brief: "",
20394
+ urgent: false
19555
20395
  };
19556
20396
  function NewClearance({ ctx }) {
19557
20397
  const account = ctx.owner;
@@ -19654,18 +20494,58 @@ function NewClearance({ ctx }) {
19654
20494
  projectLabel
19655
20495
  ]);
19656
20496
  const classes = draft.classes ?? own.classes;
20497
+ const [companyOpened, setCompanyOpened] = (0, import_react.useState)(false);
20498
+ const companyNeedsAttention = profile != null && classes.length === 0;
20499
+ (0, import_react.useEffect)(() => {
20500
+ if (companyNeedsAttention) setCompanyOpened(true);
20501
+ }, [companyNeedsAttention]);
20502
+ const companyOpen = companyOpened || companyNeedsAttention;
20503
+ const companyCardRef = (0, import_react.useRef)(null);
20504
+ const focusCompanyCard = (0, import_react.useRef)(false);
20505
+ (0, import_react.useEffect)(() => {
20506
+ if (!companyOpen || !focusCompanyCard.current) return;
20507
+ focusCompanyCard.current = false;
20508
+ companyCardRef.current?.querySelector("select, input, button, textarea")?.focus();
20509
+ }, [companyOpen]);
20510
+ const [allSearchesOpened, setAllSearchesOpened] = (0, import_react.useState)(false);
20511
+ const searchListRef = (0, import_react.useRef)(null);
20512
+ const focusSearchList = (0, import_react.useRef)(false);
19657
20513
  const savedRow = draft.savedSearch ? savedSearches.find((r) => r.slug === draft.savedSearch) ?? null : null;
19658
20514
  const activeBase = draft.savedSearch ? savedRow?.base ?? draft.pick.product : draft.pick.product;
19659
20515
  const activeLevel = (0, import_react.useMemo)(() => levels.find((l) => l.key === activeBase) ?? null, [levels, activeBase]);
19660
20516
  const activePipeline = activeLevel?.pipeline ?? null;
19661
20517
  const marketplacesApply = activePipeline !== "knockout";
20518
+ const allSearchesOpen = allSearchesOpened || !levels.some((l) => l.key === activeBase);
20519
+ const shownLevels = allSearchesOpen ? levels : levels.filter((l) => l.key === activeBase);
20520
+ (0, import_react.useEffect)(() => {
20521
+ if (!allSearchesOpen || !focusSearchList.current) return;
20522
+ focusSearchList.current = false;
20523
+ searchListRef.current?.querySelector(".pick-row-hit:not(:disabled)")?.focus();
20524
+ }, [allSearchesOpen]);
20525
+ const marketplaceCount = own.platforms.length + (marketplacesApply ? parseList(draft.platforms).length : 0);
20526
+ const companyLine = `${projectLabel ?? "No project"} · Classes ${classes.length ? classes.join(", ") : "—"} · ${marketplaceCount} marketplace${marketplaceCount === 1 ? "" : "s"}`;
19662
20527
  const whereLevel = pickedByHand || draft.savedSearch || editingSlug ? activeLevel : null;
19663
20528
  const whereWorldwide = whereLevel?.geography === "worldwide, and nothing else";
19664
20529
  const nativeControl = nativeLanguageControl(activeLevel);
19665
20530
  const machinery = machineryFor(draft.pick, activeLevel);
19666
20531
  const knockout = (0, import_react.useMemo)(() => levels.filter((l) => l.available && l.maxNames > 1).sort((a, b) => b.maxNames - a.maxNames)[0] ?? null, [levels]);
20532
+ const urgentAvailable = searches?.kind === "ok" ? searches.value.urgent.available : false;
20533
+ const urgentOverAllowance = overOneLeft(searchesLeft(usage ?? null), searchesCounted({
20534
+ levers: {
20535
+ ...machineryFor(draft.pick, activeLevel),
20536
+ urgent: true
20537
+ },
20538
+ names: 1,
20539
+ classes: 0,
20540
+ platforms: 0,
20541
+ density: null
20542
+ }));
20543
+ const urgentOn = draft.urgent && urgentAvailable && !urgentOverAllowance;
19667
20544
  const effort = {
19668
- levers: machinery,
20545
+ levers: {
20546
+ ...machinery,
20547
+ urgent: urgentOn
20548
+ },
19669
20549
  names: names.length,
19670
20550
  classes: classes.length,
19671
20551
  platforms: marketplacesApply ? own.platforms.length + parseList(draft.platforms).length : 0,
@@ -19771,6 +20651,7 @@ function NewClearance({ ctx }) {
19771
20651
  geography: { mode: geographyFor(draft.pick, activeLevel, own.territories).mode },
19772
20652
  ...marketplacesApply && parseList(draft.platforms).length ? { platforms: parseList(draft.platforms) } : {},
19773
20653
  ...!draft.savedSearch && nativeControl === "toggle" && draft.pick.nativeLanguage ? { nativeLanguage: true } : {},
20654
+ ...urgentOn ? { urgent: true } : {},
19774
20655
  ...draft.ref.trim() ? { ref: draft.ref.trim() } : {},
19775
20656
  ...draft.deadline.trim() ? { deadline: draft.deadline.trim() } : {},
19776
20657
  ...draft.instructions.trim() ? { upfrontInstructions: draft.instructions.trim() } : {}
@@ -20211,7 +21092,38 @@ function NewClearance({ ctx }) {
20211
21092
  }
20212
21093
  })] }),
20213
21094
  (0, import_jsx_runtime.jsxs)("div", {
21095
+ className: "nc-company-line",
21096
+ children: [(0, import_jsx_runtime.jsxs)("div", {
21097
+ className: "nc-company-line-text",
21098
+ children: [(0, import_jsx_runtime.jsxs)("div", {
21099
+ className: "field-label",
21100
+ style: { marginBottom: 0 },
21101
+ "data-anon": "mark",
21102
+ children: ["From ", ownerLabel]
21103
+ }), (0, import_jsx_runtime.jsx)("div", {
21104
+ className: "nc-company-line-value",
21105
+ "data-anon": "mark",
21106
+ children: companyLine
21107
+ })]
21108
+ }), (0, import_jsx_runtime.jsx)("button", {
21109
+ type: "button",
21110
+ className: "nc-disclose",
21111
+ "aria-expanded": companyOpen,
21112
+ "aria-controls": "nc-company-card",
21113
+ onClick: () => {
21114
+ if (companyOpen) companyCardRef.current?.querySelector("select, input, button, textarea")?.focus();
21115
+ else {
21116
+ focusCompanyCard.current = true;
21117
+ setCompanyOpened(true);
21118
+ }
21119
+ },
21120
+ children: "Change"
21121
+ })]
21122
+ }),
21123
+ companyOpen ? (0, import_jsx_runtime.jsxs)("div", {
20214
21124
  className: "ctx-card",
21125
+ id: "nc-company-card",
21126
+ ref: companyCardRef,
20215
21127
  children: [
20216
21128
  (0, import_jsx_runtime.jsx)("div", {
20217
21129
  className: "field-label",
@@ -20448,7 +21360,7 @@ function NewClearance({ ctx }) {
20448
21360
  })]
20449
21361
  })
20450
21362
  ]
20451
- }),
21363
+ }) : null,
20452
21364
  (0, import_jsx_runtime.jsxs)("div", { children: [
20453
21365
  (0, import_jsx_runtime.jsxs)("div", {
20454
21366
  className: "nc-which-head",
@@ -20504,7 +21416,9 @@ function NewClearance({ ctx }) {
20504
21416
  flexDirection: "column",
20505
21417
  gap: 8
20506
21418
  },
20507
- children: levels.map((t) => (0, import_jsx_runtime.jsx)(PickRow, {
21419
+ id: "nc-all-searches",
21420
+ ref: searchListRef,
21421
+ children: shownLevels.map((t) => (0, import_jsx_runtime.jsx)(PickRow, {
20508
21422
  selected: activeBase === t.key,
20509
21423
  unavailableNote: t.available ? null : t.unavailableNote ?? "Not available just now.",
20510
21424
  coverageNote: t.available ? t.coverageNote : null,
@@ -20545,8 +21459,54 @@ function NewClearance({ ctx }) {
20545
21459
  children: "The native language of that country is searched automatically — it is part of this search, not something to switch on."
20546
21460
  }) : null : null
20547
21461
  }, t.key))
20548
- })
21462
+ }),
21463
+ levels.some((l) => l.key === activeBase) ? (0, import_jsx_runtime.jsx)("button", {
21464
+ type: "button",
21465
+ className: "nc-disclose nc-all-searches",
21466
+ "aria-expanded": allSearchesOpen,
21467
+ "aria-controls": "nc-all-searches",
21468
+ onClick: () => {
21469
+ if (allSearchesOpen) searchListRef.current?.querySelector(".pick-row-hit:not(:disabled)")?.focus();
21470
+ else {
21471
+ focusSearchList.current = true;
21472
+ setAllSearchesOpened(true);
21473
+ }
21474
+ },
21475
+ children: "All four searches"
21476
+ }) : null
20549
21477
  ] }),
21478
+ activeLevel ? (0, import_jsx_runtime.jsx)(HowSoon, {
21479
+ standardLine: `${turnaroundInWords(turnaround({
21480
+ ...effort,
21481
+ levers: {
21482
+ ...machinery,
21483
+ urgent: false
21484
+ }
21485
+ }))} · uses ${searchesLabel(searchesCounted({
21486
+ ...effort,
21487
+ levers: {
21488
+ ...machinery,
21489
+ urgent: false
21490
+ }
21491
+ }))}`,
21492
+ urgentLine: urgentAvailable ? `${rangeInWords(turnaroundBounds({
21493
+ ...effort,
21494
+ levers: {
21495
+ ...machinery,
21496
+ urgent: true
21497
+ }
21498
+ }))} · uses ${searchesLabel(searchesCounted({
21499
+ ...effort,
21500
+ levers: {
21501
+ ...machinery,
21502
+ urgent: true
21503
+ }
21504
+ }))}` : "Not available with this installation's AI service. Searches run at Standard.",
21505
+ urgentAvailable,
21506
+ urgentOverAllowance,
21507
+ urgent: urgentOn,
21508
+ onChoose: (urgent) => edit({ urgent })
21509
+ }) : null,
20550
21510
  levels.length ? (0, import_jsx_runtime.jsx)("div", {
20551
21511
  className: "composer-wide",
20552
21512
  children: (0, import_jsx_runtime.jsx)(Details, {
@@ -20640,7 +21600,7 @@ function NewClearance({ ctx }) {
20640
21600
  }),
20641
21601
  (0, import_jsx_runtime.jsx)(Footer, {
20642
21602
  startedFrom,
20643
- tier: activeLevel?.name || activeLevel?.stageLabel || (draft.savedSearch ? "Search template" : "No search picked"),
21603
+ tier: `${activeLevel?.name || activeLevel?.stageLabel || (draft.savedSearch ? "Search template" : "No search picked")}${activeLevel && urgentOn ? " · Urgent" : ""}`,
20644
21604
  detail: [
20645
21605
  names.length ? `${names.length} name${names.length === 1 ? "" : "s"}` : "no names yet",
20646
21606
  barWhere(draft.pick, own.territories, {
@@ -20650,8 +21610,9 @@ function NewClearance({ ctx }) {
20650
21610
  }),
20651
21611
  names.length && activeLevel ? checksSummary(effort) : ""
20652
21612
  ].filter(Boolean).join(" · "),
20653
- uses: runCount(effort),
20654
- duration: activeLevel ? turnaroundInWords(plan?.effort?.turnaround || turnaround(effort)) : "Not set",
21613
+ uses: searchesCounted(effort),
21614
+ left: searchesLeft(usage ?? null),
21615
+ duration: activeLevel ? urgentOn ? rangeInWords(turnaroundBounds(effort)) : turnaroundInWords(plan?.effort?.turnaround || turnaround(effort)) : "Not set",
20655
21616
  runs: runsNote(effort),
20656
21617
  ready,
20657
21618
  busy,
@@ -20688,7 +21649,8 @@ function NewClearance({ ctx }) {
20688
21649
  onSeeSaved: () => ctx.go("/portal/brand/searches")
20689
21650
  }),
20690
21651
  plan ? (0, import_jsx_runtime.jsx)(ReviewDialog, {
20691
- uses: runCount(effort),
21652
+ uses: plan.effort?.searches ?? searchesCounted(effort),
21653
+ urgentTurnaround: urgentOn ? rangeInWords(turnaroundBounds(effort)) : null,
20692
21654
  left: searchesLeft(usage),
20693
21655
  registerLabel,
20694
21656
  plan,
@@ -20715,6 +21677,30 @@ function NewClearance({ ctx }) {
20715
21677
  }
20716
21678
  function DescribeIt({ value, onChange, can, reading, error, receipt, onRead }) {
20717
21679
  const tooLong = value.length > can.maxBrief;
21680
+ if (!can.available) return (0, import_jsx_runtime.jsxs)("div", {
21681
+ style: {
21682
+ paddingBottom: 22,
21683
+ borderBottom: "1px solid var(--border-hairline)"
21684
+ },
21685
+ children: [(0, import_jsx_runtime.jsxs)("div", {
21686
+ className: "nc-describe-head",
21687
+ children: [(0, import_jsx_runtime.jsx)("span", {
21688
+ className: "section-title",
21689
+ style: { marginBottom: 0 },
21690
+ children: "Describe it"
21691
+ }), (0, import_jsx_runtime.jsx)("span", {
21692
+ className: "nc-optional",
21693
+ children: "optional"
21694
+ })]
21695
+ }), (0, import_jsx_runtime.jsx)("p", {
21696
+ style: {
21697
+ margin: 0,
21698
+ fontSize: 12.5,
21699
+ color: "var(--text-muted)"
21700
+ },
21701
+ children: can.note ?? "Reading a brief is not switched on here yet — set the search up below."
21702
+ })]
21703
+ });
20718
21704
  return (0, import_jsx_runtime.jsxs)("div", {
20719
21705
  style: {
20720
21706
  paddingBottom: 22,
@@ -20839,7 +21825,93 @@ function NameWall({ count, allowed, first, canScreen, screenName, onScreenAll })
20839
21825
  }) : null]
20840
21826
  });
20841
21827
  }
20842
- function Footer({ startedFrom, tier, detail, uses, duration, runs, ready, busy, demoMode, setupRoute, channel, programDisputed, onSettings, searchRefusal, saveOpen, saveName, saveText, saveNote, saveDone, editing, canSave, blockedBy, onSaveOpen, onSaveName, onSaveText, onSaveCancel, onSave, onReview, onSeeSaved }) {
21828
+ var searchesLabel = (n) => `${n} search${n === 1 ? "" : "es"}`;
21829
+ function HowSoon({ standardLine, urgentLine, urgentAvailable, urgentOverAllowance, urgent, onChoose }) {
21830
+ const refs = (0, import_react.useRef)([]);
21831
+ const options = [{
21832
+ label: "Standard",
21833
+ line: standardLine,
21834
+ note: null,
21835
+ chosen: !urgent,
21836
+ disabled: false,
21837
+ value: false
21838
+ }, {
21839
+ label: "Urgent",
21840
+ line: urgentLine,
21841
+ note: !urgentAvailable ? null : urgentOverAllowance ? ONE_SEARCH_LEFT : "Uses AI fast mode setting at increased cost.",
21842
+ chosen: urgent,
21843
+ disabled: !urgentAvailable || urgentOverAllowance,
21844
+ value: true
21845
+ }];
21846
+ const onKey = (e) => {
21847
+ if (![
21848
+ "ArrowLeft",
21849
+ "ArrowRight",
21850
+ "ArrowUp",
21851
+ "ArrowDown"
21852
+ ].includes(e.key) || !urgentAvailable || urgentOverAllowance) return;
21853
+ e.preventDefault();
21854
+ const next = !urgent;
21855
+ onChoose(next);
21856
+ refs.current[next ? 1 : 0]?.focus();
21857
+ };
21858
+ return (0, import_jsx_runtime.jsxs)("div", {
21859
+ className: "nc-how-soon",
21860
+ children: [(0, import_jsx_runtime.jsxs)("div", {
21861
+ className: "nc-which-head",
21862
+ children: [(0, import_jsx_runtime.jsx)("span", {
21863
+ className: "section-title",
21864
+ id: "nc-how-soon-title",
21865
+ style: { marginBottom: 0 },
21866
+ children: "How soon"
21867
+ }), (0, import_jsx_runtime.jsx)("span", {
21868
+ className: "section-hint nc-how-soon-note",
21869
+ children: "Same search, same checks, same report"
21870
+ })]
21871
+ }), (0, import_jsx_runtime.jsx)("div", {
21872
+ className: "nc-speed-pair",
21873
+ role: "radiogroup",
21874
+ "aria-labelledby": "nc-how-soon-title",
21875
+ onKeyDown: onKey,
21876
+ children: options.map((o, i) => (0, import_jsx_runtime.jsxs)("button", {
21877
+ ref: (el) => {
21878
+ refs.current[i] = el;
21879
+ },
21880
+ type: "button",
21881
+ role: "radio",
21882
+ "aria-checked": o.chosen,
21883
+ "aria-disabled": o.disabled || void 0,
21884
+ tabIndex: o.chosen ? 0 : -1,
21885
+ className: `nc-speed${o.chosen ? " nc-speed-on" : ""}${o.disabled ? " nc-speed-off" : ""}`,
21886
+ onClick: () => {
21887
+ if (!o.disabled) onChoose(o.value);
21888
+ },
21889
+ children: [(0, import_jsx_runtime.jsx)("span", {
21890
+ className: o.chosen ? "radio radio-on" : "radio",
21891
+ style: { marginTop: 2 },
21892
+ "aria-hidden": true
21893
+ }), (0, import_jsx_runtime.jsxs)("span", {
21894
+ className: "nc-speed-text",
21895
+ children: [
21896
+ (0, import_jsx_runtime.jsx)("b", {
21897
+ className: "nc-speed-label",
21898
+ children: o.label
21899
+ }),
21900
+ (0, import_jsx_runtime.jsx)("span", {
21901
+ className: "nc-speed-line",
21902
+ children: o.line
21903
+ }),
21904
+ o.note ? (0, import_jsx_runtime.jsx)("span", {
21905
+ className: "nc-speed-note",
21906
+ children: o.note
21907
+ }) : null
21908
+ ]
21909
+ })]
21910
+ }, o.label))
21911
+ })]
21912
+ });
21913
+ }
21914
+ function Footer({ startedFrom, tier, detail, uses, left, duration, runs, ready, busy, demoMode, setupRoute, channel, programDisputed, onSettings, searchRefusal, saveOpen, saveName, saveText, saveNote, saveDone, editing, canSave, blockedBy, onSaveOpen, onSaveName, onSaveText, onSaveCancel, onSave, onReview, onSeeSaved }) {
20843
21915
  return (0, import_jsx_runtime.jsxs)("div", {
20844
21916
  className: "composer-footer",
20845
21917
  children: [
@@ -20915,7 +21987,7 @@ function Footer({ startedFrom, tier, detail, uses, duration, runs, ready, busy,
20915
21987
  ]
20916
21988
  }), (0, import_jsx_runtime.jsx)("div", {
20917
21989
  className: "footer-eyebrow",
20918
- children: "uses"
21990
+ children: left == null ? "uses" : `uses · ${left} left today`
20919
21991
  })] }), (0, import_jsx_runtime.jsxs)("div", { children: [(0, import_jsx_runtime.jsx)("div", {
20920
21992
  style: {
20921
21993
  fontSize: 13.5,
@@ -21242,7 +22314,7 @@ function PickRow({ selected, onPick, title, tagline, description, chips, recomme
21242
22314
  }) : null]
21243
22315
  });
21244
22316
  }
21245
- function ReviewDialog({ plan, busy, owner, project, names, goods, nativeOn, onStart, onBack, failure, onReview, uses, left, registerLabel }) {
22317
+ function ReviewDialog({ plan, busy, owner, project, names, goods, nativeOn, onStart, onBack, failure, onReview, uses, left, registerLabel, urgentTurnaround }) {
21246
22318
  (0, import_react.useEffect)(() => {
21247
22319
  const on = (e) => {
21248
22320
  if (e.key === "Escape") onBack();
@@ -21368,7 +22440,10 @@ function ReviewDialog({ plan, busy, owner, project, names, goods, nativeOn, onSt
21368
22440
  label: "Native language",
21369
22441
  children: nativeLanguageLine(nativeOn, places)
21370
22442
  }),
21371
- plan.effort?.turnaround || plan.turnaround ? (0, import_jsx_runtime.jsx)(Row$3, {
22443
+ urgentTurnaround ? (0, import_jsx_runtime.jsx)(Row$3, {
22444
+ label: "Turnaround",
22445
+ children: urgentTurnaround
22446
+ }) : plan.effort?.turnaround || plan.turnaround ? (0, import_jsx_runtime.jsx)(Row$3, {
21372
22447
  label: "Turnaround",
21373
22448
  children: turnaroundInWords(plan.effort?.turnaround || plan.turnaround || "")
21374
22449
  }) : null,
@@ -25174,14 +26249,18 @@ var SETUP_GUIDES = {
25174
26249
  }
25175
26250
  };
25176
26251
  var setupGuideUrl = (sourceRepo, guide) => `${sourceRepo}/blob/main/${SETUP_GUIDES[guide].path}#${SETUP_GUIDES[guide].anchor}`;
26252
+ var setupCommand = (channel) => `npx ${setupPackage(channel)} install`;
26253
+ var KNOCKOUT_STILL_RUNS = "A Knockout search can still run.";
25177
26254
  var row = (r) => ({
25178
26255
  ok: true,
25179
26256
  off: false,
26257
+ open: false,
25180
26258
  mono: null,
25181
26259
  faults: [],
25182
26260
  note: null,
25183
26261
  detail: null,
25184
26262
  guide: null,
26263
+ command: null,
25185
26264
  ...r
25186
26265
  });
25187
26266
  var KEY_NEEDED = "A key is needed";
@@ -25221,9 +26300,11 @@ function engineCapabilityRows(providers) {
25221
26300
  state: p.configured ? "Available" : "Not available"
25222
26301
  }));
25223
26302
  }
25224
- function providerRow(p) {
26303
+ function providerRow(p, { channel = null } = {}) {
25225
26304
  const { name, covers } = splitSourceLabel(p.providerLabel ?? p.provider ?? "");
25226
26305
  const guide = p.key === "register" ? "register" : p.enrolment === "oauth" ? "case-law" : "research";
26306
+ const optional = p.needed === false;
26307
+ const command = setupCommand(channel);
25227
26308
  if (p.configured) return row({
25228
26309
  name,
25229
26310
  mono: covers,
@@ -25243,7 +26324,8 @@ function providerRow(p) {
25243
26324
  name: "No register selected",
25244
26325
  state: "Missing",
25245
26326
  faults: ["A register is needed"],
25246
- guide
26327
+ guide,
26328
+ command
25247
26329
  });
25248
26330
  if (!p.known) return row({
25249
26331
  ok: false,
@@ -25253,16 +26335,32 @@ function providerRow(p) {
25253
26335
  faults: [`This build does not ship a provider called ${name}.`],
25254
26336
  guide
25255
26337
  });
25256
- if (p.missing.length) return row({
25257
- ok: false,
25258
- name,
25259
- mono: covers,
25260
- state: "Missing",
25261
- faults: [KEY_NEEDED],
25262
- guide
25263
- });
26338
+ if (p.missing.length) {
26339
+ if (optional) return row({
26340
+ ok: false,
26341
+ off: true,
26342
+ open: true,
26343
+ name,
26344
+ mono: covers,
26345
+ state: "Not set up",
26346
+ faults: [KEY_NEEDED],
26347
+ guide,
26348
+ command
26349
+ });
26350
+ return row({
26351
+ ok: false,
26352
+ name,
26353
+ mono: covers,
26354
+ state: "Missing",
26355
+ faults: p.key === "research" ? [`${KEY_NEEDED}. ${KNOCKOUT_STILL_RUNS}`] : [KEY_NEEDED],
26356
+ guide,
26357
+ command
26358
+ });
26359
+ }
25264
26360
  if (p.credential === "unreadable") return row({
25265
26361
  ok: false,
26362
+ off: optional,
26363
+ open: optional,
25266
26364
  name,
25267
26365
  mono: covers,
25268
26366
  state: "Unknown",
@@ -25271,6 +26369,8 @@ function providerRow(p) {
25271
26369
  });
25272
26370
  return row({
25273
26371
  ok: false,
26372
+ off: optional,
26373
+ open: optional,
25274
26374
  name,
25275
26375
  mono: covers,
25276
26376
  state: "Not set up",
@@ -25278,7 +26378,7 @@ function providerRow(p) {
25278
26378
  guide
25279
26379
  });
25280
26380
  }
25281
- function providerCategories(providers) {
26381
+ function providerCategories(providers, { channel = null } = {}) {
25282
26382
  const order = [];
25283
26383
  const byKey = new Map();
25284
26384
  for (const p of providers) {
@@ -25296,7 +26396,8 @@ function providerCategories(providers) {
25296
26396
  key,
25297
26397
  label: rows[0]?.label || key,
25298
26398
  note: key === "caselaw" && unset ? CASE_LAW_GAP : null,
25299
- rows: rows.map(providerRow)
26399
+ needed: rows.some((p) => p.needed !== false),
26400
+ rows: rows.map((p) => providerRow(p, { channel }))
25300
26401
  };
25301
26402
  });
25302
26403
  }
@@ -25355,27 +26456,30 @@ function GlobalConfig({ ctx }) {
25355
26456
  }) : (0, import_jsx_runtime.jsx)(NotServed, {})
25356
26457
  })
25357
26458
  }),
25358
- (0, import_jsx_runtime.jsx)(Group, {
25359
- title: "Engine",
25360
- children: (0, import_jsx_runtime.jsxs)("div", {
25361
- className: "cfg-rows",
25362
- children: [v.engine ? (0, import_jsx_runtime.jsx)(Engine, {
25363
- engine: v.engine,
25364
- programDisputed: (v.lastRun?.disagrees ?? []).some((d) => d.what === "engine program"),
25365
- channel: ctx.me.channel ?? null,
25366
- name: ctx.me.brandName
25367
- }) : (0, import_jsx_runtime.jsx)(NotRecorded, {
25368
- what: "which engine is running",
25369
- source: v.source
25370
- }), engineCapabilityRows(v.providers ?? []).map((r) => (0, import_jsx_runtime.jsx)(Row$1, {
25371
- ...r,
25372
- repo
25373
- }, r.name))]
25374
- })
25375
- }),
25376
- (0, import_jsx_runtime.jsx)(Group, {
25377
- title: "Providers",
25378
- children: v.providers === null ? (0, import_jsx_runtime.jsx)(NotRecorded, {
26459
+ (0, import_jsx_runtime.jsxs)(Group, {
26460
+ title: "Needed",
26461
+ heading: true,
26462
+ children: [(0, import_jsx_runtime.jsxs)("div", {
26463
+ className: "cfg-cat",
26464
+ children: [(0, import_jsx_runtime.jsx)("div", {
26465
+ className: "cfg-sub",
26466
+ children: "Engine"
26467
+ }), (0, import_jsx_runtime.jsxs)("div", {
26468
+ className: "cfg-rows",
26469
+ children: [v.engine ? (0, import_jsx_runtime.jsx)(Engine, {
26470
+ engine: v.engine,
26471
+ programDisputed: (v.lastRun?.disagrees ?? []).some((d) => d.what === "engine program"),
26472
+ channel: ctx.me.channel ?? null,
26473
+ name: ctx.me.brandName
26474
+ }) : (0, import_jsx_runtime.jsx)(NotRecorded, {
26475
+ what: "which engine is running",
26476
+ source: v.source
26477
+ }), engineCapabilityRows(v.providers ?? []).map((r) => (0, import_jsx_runtime.jsx)(Row$1, {
26478
+ ...r,
26479
+ repo
26480
+ }, r.name))]
26481
+ })]
26482
+ }), v.providers === null ? (0, import_jsx_runtime.jsx)(NotRecorded, {
25379
26483
  what: "which providers are configured",
25380
26484
  source: v.source
25381
26485
  }) : v.providers.length === 0 ? (0, import_jsx_runtime.jsx)("div", {
@@ -25385,27 +26489,19 @@ function GlobalConfig({ ctx }) {
25385
26489
  padding: "10px 13px"
25386
26490
  },
25387
26491
  children: "This snapshot lists no provider at all, which should not be possible. Treat the rest of this page as suspect and check the engine’s last drain."
25388
- }) : providerCategories(v.providers).map((c) => (0, import_jsx_runtime.jsxs)("div", {
25389
- className: "cfg-cat",
25390
- children: [
25391
- (0, import_jsx_runtime.jsx)("div", {
25392
- className: "cfg-sub",
25393
- children: c.label
25394
- }),
25395
- c.note ? (0, import_jsx_runtime.jsx)("p", {
25396
- className: "cfg-cat-note",
25397
- children: c.note
25398
- }) : null,
25399
- (0, import_jsx_runtime.jsx)("div", {
25400
- className: "cfg-rows",
25401
- children: c.rows.map((r, i) => (0, import_jsx_runtime.jsx)(Row$1, {
25402
- ...r,
25403
- repo
25404
- }, `${r.name}:${i}`))
25405
- })
25406
- ]
25407
- }, c.key))
26492
+ }) : (0, import_jsx_runtime.jsx)(Categories, {
26493
+ categories: providerCategories(v.providers, { channel: ctx.me.channel ?? null }).filter((c) => c.needed),
26494
+ repo
26495
+ })]
25408
26496
  }),
26497
+ v.providers && v.providers.length ? (0, import_jsx_runtime.jsx)(Group, {
26498
+ title: "Optional",
26499
+ heading: true,
26500
+ children: (0, import_jsx_runtime.jsx)(Categories, {
26501
+ categories: providerCategories(v.providers, { channel: ctx.me.channel ?? null }).filter((c) => !c.needed),
26502
+ repo
26503
+ })
26504
+ }) : null,
25409
26505
  v.source === "capture" ? (0, import_jsx_runtime.jsx)("div", {
25410
26506
  style: {
25411
26507
  marginTop: 20,
@@ -25504,6 +26600,28 @@ var NotServed = () => (0, import_jsx_runtime.jsx)("div", {
25504
26600
  },
25505
26601
  children: "This version of the portal does not report how people sign in. It will say after this service is upgraded — a search engine drain will not add it."
25506
26602
  });
26603
+ function Categories({ categories, repo }) {
26604
+ return (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: categories.map((c) => (0, import_jsx_runtime.jsxs)("div", {
26605
+ className: "cfg-cat",
26606
+ children: [
26607
+ (0, import_jsx_runtime.jsx)("div", {
26608
+ className: "cfg-sub",
26609
+ children: c.label
26610
+ }),
26611
+ c.note ? (0, import_jsx_runtime.jsx)("p", {
26612
+ className: "cfg-cat-note",
26613
+ children: c.note
26614
+ }) : null,
26615
+ (0, import_jsx_runtime.jsx)("div", {
26616
+ className: "cfg-rows",
26617
+ children: c.rows.map((r, i) => (0, import_jsx_runtime.jsx)(Row$1, {
26618
+ ...r,
26619
+ repo
26620
+ }, `${r.name}:${i}`))
26621
+ })
26622
+ ]
26623
+ }, c.key)) });
26624
+ }
25507
26625
  function Engine({ engine, programDisputed = false, channel = null, name }) {
25508
26626
  return (0, import_jsx_runtime.jsx)(Row$1, { ...engineRow(engine, {
25509
26627
  programDisputed,
@@ -25511,15 +26629,16 @@ function Engine({ engine, programDisputed = false, channel = null, name }) {
25511
26629
  name
25512
26630
  }) });
25513
26631
  }
25514
- function Row$1({ ok, off = false, name, mono, state, faults, note = null, detail = null, guide = null, repo = null }) {
26632
+ function Row$1({ ok, off = false, open = false, name, mono, state, faults, note = null, detail = null, guide = null, command = null, repo = null }) {
25515
26633
  const tone = ok ? "" : off ? " off" : " bad";
26634
+ const faultTone = off ? "cfg-note" : "cfg-note bad";
25516
26635
  return (0, import_jsx_runtime.jsxs)("div", {
25517
26636
  className: "cfg-row",
25518
26637
  children: [
25519
26638
  (0, import_jsx_runtime.jsxs)("div", {
25520
26639
  className: "cfg-line",
25521
26640
  children: [
25522
- (0, import_jsx_runtime.jsx)("span", { className: `cfg-dot${tone}` }),
26641
+ (0, import_jsx_runtime.jsx)("span", { className: `cfg-dot${tone}${open ? " open" : ""}` }),
25523
26642
  (0, import_jsx_runtime.jsx)("span", {
25524
26643
  className: "cfg-name",
25525
26644
  children: name
@@ -25545,19 +26664,40 @@ function Row$1({ ok, off = false, name, mono, state, faults, note = null, detail
25545
26664
  faults.map((f, i) => guide && i === faults.length - 1 ? (0, import_jsx_runtime.jsxs)("div", {
25546
26665
  className: "cfg-act",
25547
26666
  children: [(0, import_jsx_runtime.jsx)("p", {
25548
- className: "cfg-note bad",
26667
+ className: faultTone,
25549
26668
  children: (0, import_jsx_runtime.jsx)(Ticked, { text: f })
25550
26669
  }), (0, import_jsx_runtime.jsx)(GuideButton, {
25551
26670
  guide,
25552
26671
  repo
25553
26672
  })]
25554
26673
  }, f) : (0, import_jsx_runtime.jsx)("p", {
25555
- className: "cfg-note bad",
26674
+ className: faultTone,
25556
26675
  children: (0, import_jsx_runtime.jsx)(Ticked, { text: f })
25557
- }, f))
26676
+ }, f)),
26677
+ command ? (0, import_jsx_runtime.jsx)(CommandLine, { command }) : null
25558
26678
  ]
25559
26679
  });
25560
26680
  }
26681
+ function CommandLine({ command }) {
26682
+ const [copied, setCopied] = (0, import_react.useState)(false);
26683
+ return (0, import_jsx_runtime.jsxs)("div", {
26684
+ className: "cfg-cmd",
26685
+ children: [(0, import_jsx_runtime.jsx)("code", { children: command }), (0, import_jsx_runtime.jsxs)("button", {
26686
+ type: "button",
26687
+ className: `cfg-copy${copied ? " is-copied" : ""}`,
26688
+ onClick: () => {
26689
+ navigator.clipboard.writeText(command).then(() => {
26690
+ setCopied(true);
26691
+ window.setTimeout(() => setCopied(false), 2600);
26692
+ }, () => setCopied(false));
26693
+ },
26694
+ children: [(0, import_jsx_runtime.jsx)(Icon, {
26695
+ name: copied ? "check" : "copy",
26696
+ size: 13
26697
+ }), "Copy"]
26698
+ })]
26699
+ });
26700
+ }
25561
26701
  function GuideButton({ guide, repo }) {
25562
26702
  return repo ? (0, import_jsx_runtime.jsx)("a", {
25563
26703
  className: "pill",
@@ -25572,10 +26712,13 @@ function GuideButton({ guide, repo }) {
25572
26712
  children: "Setup guide"
25573
26713
  });
25574
26714
  }
25575
- function Group({ title, children }) {
26715
+ function Group({ title, heading = false, children }) {
25576
26716
  return (0, import_jsx_runtime.jsxs)("div", {
25577
26717
  className: "cfg-group",
25578
- children: [(0, import_jsx_runtime.jsx)("div", {
26718
+ children: [heading ? (0, import_jsx_runtime.jsx)("h2", {
26719
+ className: "eyebrow cfg-group-head",
26720
+ children: title
26721
+ }) : (0, import_jsx_runtime.jsx)("div", {
25579
26722
  className: "eyebrow",
25580
26723
  children: title
25581
26724
  }), children]