From 2313b2e7b7fdb48c4a5771d2b69549c68d1ebb6d Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:53:09 +0100 Subject: [PATCH 01/10] fix: keep LLM triage labels and MCP-client reviews out of trusted lineage until a person decides --- forebear/api.py | 3 +- forebear/graph.py | 117 +++++++++++++++++---------- forebear/investigation/tools.py | 17 +++- forebear/lineage.py | 69 ++++++++++++++-- forebear/mcp_server.py | 14 ++-- tests/test_audit_uncertainty.py | 3 +- tests/test_completeness_window.py | 25 ++++-- tests/test_graph.py | 9 ++- tests/test_trusted_lineage.py | 127 ++++++++++++++++++++++++++++++ 9 files changed, 320 insertions(+), 64 deletions(-) create mode 100644 tests/test_trusted_lineage.py diff --git a/forebear/api.py b/forebear/api.py index 1026e3f..89c37a5 100644 --- a/forebear/api.py +++ b/forebear/api.py @@ -254,7 +254,8 @@ class ReviewIn(BaseModel): dst: str status: str = Field(pattern="^(confirmed|rejected|)$") note: str | None = None - # Who recorded it: "user" (the app) or "mcp-client" (the MCP tool, possibly an AI agent). Optional. + # Who recorded it: "user" (the app, a person) or "mcp-client" (the MCP tool, possibly an AI agent). An mcp-client + # review is advisory: it never changes trusted lineage and never overwrites a person's review. Optional. via: str = Field("user", pattern="^(user|mcp-client)$") diff --git a/forebear/graph.py b/forebear/graph.py index f4c0341..1d71a71 100644 --- a/forebear/graph.py +++ b/forebear/graph.py @@ -14,8 +14,9 @@ (Device)-[:CITES {kind: predicate|reference|mention, confidence, page, snippet, quote, method, text_source, source_url, source_sha256, name_check, panel_check, audit, audit_note, audit_by, corrected_from, <- extraction audit (not human) - review, review_note, reviewer, reviewed_at, <- human review in the app - ai_label, ai_quote, ai_model, ai_at}]->(Device) <- optional LLM triage + review, review_note, reviewer, reviewed_at, <- review (person, or advisory + reviewed_source_sha256, 'mcp-client' automated client) + ai_label, ai_quote, ai_model, ai_at}]->(Device) <- optional LLM triage (advisory) (Device)-[:SUBJECT_OF]->(Recall) (Device)-[:IN_CODE]->(ProductCode) (Device)-[:FILED_BY]->(Company) @@ -42,16 +43,28 @@ ] FULLTEXT = "CREATE FULLTEXT INDEX device_text IF NOT EXISTS FOR (d:Device) ON EACH [d.name, d.applicant]" -# Rule: a human confirmed it, OR (the extractor says predicate, or the LLM triage labelled an ambiguous -# mention as predicate, quote-checked) and the extraction audit did not find it wrong - unless a human -# rejected it. Humans always win; the audit outranks the extractor and the LLM. -SOURCE_ROLE_MCP_REVIEW = "(coalesce(r.audit, '') = 'role_corrected' AND coalesce(r.reviewer, '') = 'mcp-client')" -LINEAGE_EDGE = (f"(coalesce(r.review, '') <> 'rejected' OR {SOURCE_ROLE_MCP_REVIEW}) AND " - f"((r.review = 'confirmed' AND NOT {SOURCE_ROLE_MCP_REVIEW}) OR " - "(NOT coalesce(r.audit, '') IN ['error', 'not_predicate'] AND " - "(r.kind = 'predicate' OR (r.ai_label = 'predicate' AND coalesce(r.audit, '') <> 'role_corrected'))))") +# Trusted lineage rule (the only edges deterministic verdicts traverse): either a PERSON confirmed it, or the extractor +# read it as a predicate and the extraction audit did not find it wrong - unless a person rejected it. +# Automated sources never change trusted lineage on their own: an LLM triage label, or a confirmation/rejection +# recorded through the MCP client (reviewer 'mcp-client', possibly an AI agent), is advisory until a person decides. +MACHINE_REVIEWER = "mcp-client" +HUMAN_REVIEW = f"(r.review IS NOT NULL AND coalesce(r.reviewer, '') <> '{MACHINE_REVIEWER}')" +LINEAGE_EDGE = (f"NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " + f"((r.review = 'confirmed' AND {HUMAN_REVIEW}) OR " + "(r.kind = 'predicate' AND NOT coalesce(r.audit, '') IN ['error', 'not_predicate']))") +# Advisory (uncertain, untrusted) lineage: an automated source says predicate, no person has decided, and the +# extraction audit did not rule it out from the source. Shown with its provenance; never a verdict input. +ADVISORY_EDGE = (f"NOT ({LINEAGE_EDGE}) AND NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " + "NOT coalesce(r.audit, '') IN ['error', 'not_predicate', 'role_corrected'] AND " + f"(r.ai_label = 'predicate' OR (r.review = 'confirmed' AND r.reviewer = '{MACHINE_REVIEWER}'))") DISPUTED_EDGE = ("coalesce(r.audit, '') = 'unresolved' AND " - "(coalesce(r.review, '') <> 'confirmed' OR coalesce(r.reviewer, '') = 'mcp-client')") + f"(coalesce(r.review, '') <> 'confirmed' OR coalesce(r.reviewer, '') = '{MACHINE_REVIEWER}')") +_HOP_FIELDS = ("src: startNode(r).k, dst: endNode(r).k, page: r.page, snippet: r.snippet, confidence: r.confidence, " + "review: r.review, reviewer: r.reviewer, review_note: r.review_note, " + "reviewed_at: toString(r.reviewed_at), name_check: r.name_check, source_url: r.source_url, " + "source_sha256: r.source_sha256, kind: r.kind, audit: r.audit, audit_note: r.audit_note, " + "ai_label: r.ai_label, ai_quote: r.ai_quote, ai_model: r.ai_model, ai_at: toString(r.ai_at), " + "text_source: r.text_source, panel_check: r.panel_check, quote: r.quote, method: r.method") class Graph: @@ -163,18 +176,29 @@ def review_citation(self, src: str, dst: str, status: str, note: str | None, reviewer: str = "user") -> dict | None: if status not in ("confirmed", "rejected", ""): raise ValueError("status must be confirmed, rejected or empty") + if reviewer == MACHINE_REVIEWER: + # an automated client's review is advisory: it never overwrites or clears a person's decision + held = self.q(f"""MATCH (a:Device {{k:$src}})-[r:CITES]->(b:Device {{k:$dst}}) WHERE {HUMAN_REVIEW} + RETURN a.k AS src, b.k AS dst, r.kind AS kind, r.review AS review, r.reviewer AS reviewer""", + {"src": src, "dst": dst}) + if held: + return held[0] | {"kept_human_review": True} rows = self.q( - """MATCH (a:Device {k:$src})-[c:CITES]->(b:Device {k:$dst}) - SET c.review = $status, c.review_note = $note, c.reviewed_at = datetime(), c.reviewer = $reviewer - RETURN a.k AS src, b.k AS dst, c.kind AS kind, c.review AS review""", + f"""MATCH (a:Device {{k:$src}})-[r:CITES]->(b:Device {{k:$dst}}) + SET r.review = $status, r.review_note = $note, r.reviewed_at = datetime(), r.reviewer = $reviewer, + r.reviewed_source_sha256 = r.source_sha256 + RETURN a.k AS src, b.k AS dst, r.kind AS kind, r.review AS review, r.reviewer AS reviewer, + ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory""", {"src": src, "dst": dst, "status": status or None, "note": note, "reviewer": reviewer}) return rows[0] if rows else None def set_triage(self, src: str, dst: str, label: str, quote: str, model: str) -> dict | None: rows = self.q( - """MATCH (a:Device {k:$src})-[c:CITES]->(b:Device {k:$dst}) + f"""MATCH (a:Device {{k:$src}})-[c:CITES]->(b:Device {{k:$dst}}) SET c.ai_label = $label, c.ai_quote = $quote, c.ai_model = $model, c.ai_at = datetime() - RETURN a.k AS src, b.k AS dst, c.kind AS kind, c.ai_label AS ai_label, c.review AS review""", + WITH a, b, c AS r + RETURN a.k AS src, b.k AS dst, r.kind AS kind, r.ai_label AS ai_label, r.review AS review, + ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory""", {"src": src, "dst": dst, "label": label, "quote": quote, "model": model}) return rows[0] if rows else None @@ -260,12 +284,7 @@ def _lineage(self, k: str, depth: int, direction: str) -> list[dict]: linked_before_clearance: s.before_clearance}}) AS recalls RETURN a {{.*}} AS device, length(p) AS gen, routes, [n IN nodes(p) | n.k] AS chain, - [r IN relationships(p) | {{src: startNode(r).k, dst: endNode(r).k, page: r.page, - snippet: r.snippet, confidence: r.confidence, review: r.review, reviewer: r.reviewer, - name_check: r.name_check, source_url: r.source_url, kind: r.kind, - audit: r.audit, audit_note: r.audit_note, ai_label: r.ai_label, - text_source: r.text_source, panel_check: r.panel_check, - quote: r.quote, method: r.method}}] AS hops, + [r IN relationships(p) | {{{_HOP_FIELDS}}}] AS hops, recalls ORDER BY gen, device.decision_date""", {"k": k}) out = [] @@ -276,34 +295,52 @@ def _lineage(self, k: str, depth: int, direction: str) -> list[dict]: return out def direct_citations(self, k: str) -> list[dict]: - """All extracted citations from k (any kind, incl. rejected) for the review panel.""" + """All extracted citations from k (any kind, incl. rejected) for the review panel, each with its trust + standing: `in_lineage` (trusted, a verdict input), `advisory` (an automated source says predicate, pending a + person) or neither.""" return [{**r, "dst_decision_date": str(r["dst_decision_date"]) if r["dst_decision_date"] else None} for r in self.q( - """MATCH (d:Device {k:$k})-[c:CITES]->(b:Device) + f"""MATCH (d:Device {{k:$k}})-[r:CITES]->(b:Device) RETURN b.k AS dst, b.name AS name, b.applicant AS applicant, b.decision_date AS dst_decision_date, - c.kind AS kind, c.confidence AS confidence, c.page AS page, c.snippet AS snippet, - c.review AS review, c.review_note AS review_note, c.source_url AS source_url, - c.ai_label AS ai_label, c.ai_quote AS ai_quote, c.ai_model AS ai_model, - c.name_check AS name_check, c.reviewer AS reviewer, - c.panel_check AS panel_check, c.quote AS quote, c.method AS method, - c.text_source AS text_source, c.audit AS audit, c.audit_note AS audit_note, - c.audit_by AS audit_by, c.corrected_from AS corrected_from - ORDER BY CASE c.kind WHEN 'predicate' THEN 0 WHEN 'reference' THEN 1 ELSE 2 END, b.k""", + r.kind AS kind, r.confidence AS confidence, r.page AS page, r.snippet AS snippet, + r.review AS review, r.review_note AS review_note, r.source_url AS source_url, + r.ai_label AS ai_label, r.ai_quote AS ai_quote, r.ai_model AS ai_model, toString(r.ai_at) AS ai_at, + r.name_check AS name_check, r.reviewer AS reviewer, toString(r.reviewed_at) AS reviewed_at, + r.reviewed_source_sha256 AS reviewed_source_sha256, r.source_sha256 AS source_sha256, + r.panel_check AS panel_check, r.quote AS quote, r.method AS method, + r.text_source AS text_source, r.audit AS audit, r.audit_note AS audit_note, + r.audit_by AS audit_by, r.corrected_from AS corrected_from, + ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory + ORDER BY CASE r.kind WHEN 'predicate' THEN 0 WHEN 'reference' THEN 1 ELSE 2 END, b.k""", {"k": k})] def lineage_edges_from(self, ks: list[str]) -> list[dict]: """Every lineage edge leaving the given devices, on any route (the ancestor query keeps only one shortest path per ancestor, so a doubtful edge on another route would otherwise go unseen).""" + return self._edges_from(ks, LINEAGE_EDGE) + + def advisory_edges_from(self, ks: list[str]) -> list[dict]: + """Advisory (untrusted) predicate links leaving the given devices: an LLM label or an automated-client + confirmation with no person's decision. Each carries its provenance and the cited device's recalls, so the + evidence is visible, but nothing here is traversed by the verdict rules.""" + if not ks: + return [] + rows = self.q( + f"""MATCH (a:Device)-[r:CITES]->(b:Device) WHERE a.k IN $ks AND {ADVISORY_EDGE} + OPTIONAL MATCH (b)-[s:SUBJECT_OF]->(x:Recall) + WITH a, r, b, collect(DISTINCT x {{.*, link_name_check: s.name_check, + linked_before_clearance: s.before_clearance}}) AS recalls + RETURN {{{_HOP_FIELDS}}} AS hop, b.name AS dst_name, recalls + ORDER BY hop.src, hop.dst""", {"ks": list(ks)}) + return [r["hop"] | {"dst_name": r["dst_name"], "recalls": [_clean(x) for x in r["recalls"] if x]} + for r in rows] + + def _edges_from(self, ks: list[str], rule: str) -> list[dict]: if not ks: return [] - return self.q( - f"""MATCH (a:Device)-[r:CITES]->(b:Device) WHERE a.k IN $ks AND {LINEAGE_EDGE} - RETURN a.k AS src, b.k AS dst, r.page AS page, r.snippet AS snippet, r.confidence AS confidence, - r.review AS review, r.reviewer AS reviewer, r.name_check AS name_check, - r.source_url AS source_url, r.kind AS kind, r.audit AS audit, r.audit_note AS audit_note, - r.ai_label AS ai_label, r.text_source AS text_source, r.panel_check AS panel_check, - r.quote AS quote, r.method AS method - ORDER BY src, dst""", {"ks": list(ks)}) + return [r["hop"] for r in self.q( + f"""MATCH (a:Device)-[r:CITES]->(b:Device) WHERE a.k IN $ks AND {rule} + RETURN {{{_HOP_FIELDS}}} AS hop ORDER BY hop.src, hop.dst""", {"ks": list(ks)})] def out_of_lineage_predicates(self, k: str) -> list[dict]: """Citations the extractor read as predicates that do not count in lineage queries (removed by diff --git a/forebear/investigation/tools.py b/forebear/investigation/tools.py index 2f24246..20ed581 100644 --- a/forebear/investigation/tools.py +++ b/forebear/investigation/tools.py @@ -18,7 +18,7 @@ from typing import Any, Callable from .. import summaries -from ..graph import LINEAGE_EDGE, Graph +from ..graph import ADVISORY_EDGE, LINEAGE_EDGE, Graph from ..lineage import EVIDENCE_WINDOW, assess, compare, doubt, recall_reach K_RE = re.compile(r"^K\d{6}$") @@ -147,9 +147,13 @@ def _gens(args: dict, default: int = 4) -> int: def _provenance(h: dict) -> str: - """Who stands behind a lineage hop: a person, an automated client, the extraction audit, or the extractor.""" + """Who stands behind a lineage hop: a person, an automated client, the extraction audit, or the extractor. + 'client_confirmed_not_human' and 'llm_label_machine' on a non-predicate are advisory: they never count in the + lineage until a person confirms the citation.""" if h.get("review") == "confirmed": return "human_confirmed" if h.get("reviewer") not in ("mcp-client",) else "client_confirmed_not_human" + if h.get("review") == "rejected" and h.get("reviewer") in ("mcp-client",): + return "client_rejection_pending_not_human" if h.get("audit") == "corrected": return "audit_correction_machine" if h.get("audit") in ("variant", "unresolved", "role_corrected"): @@ -165,6 +169,7 @@ def compact_assessment(a: dict) -> dict: recs = [e for e in s["evidence"] if e.get("type") == "recall"] cit = [e for e in s["evidence"] if e.get("type") == "citation"] unres = [e for e in s["evidence"] if e.get("type") == "unresolved_citation"] + adv = [e for e in s["evidence"] if e.get("type") == "advisory_citation"] dev = [e for e in s["evidence"] if e.get("type") == "device"] sig = {"code": s.get("code"), "severity": s["severity"], "title": s["title"], "chain": s.get("chain") or None} if s.get("conditional"): @@ -179,6 +184,10 @@ def compact_assessment(a: dict) -> dict: if unres: sig["unresolved"] = [{"src": e["src"], "cited": e["cited"], "reason": e.get("reason"), "page": e.get("page")} for e in unres][:10] + if adv: # untrusted: never a verdict input, listed so the agent cannot mistake it for lineage + sig["advisory_links"] = [{"src": e["src"], "dst": e["dst"], "page": e.get("page"), "trust": "advisory", + "basis": e.get("basis"), "ai_model": e.get("ai_model"), + "recall_ids": [x["id"] for x in e.get("recalls") or []][:10]} for e in adv][:10] if dev: sig["devices"] = [{"k": e["k"], "summary_status": e.get("summary_status")} for e in dev][:12] out_signals.append({k: v for k, v in sig.items() if v is not None}) @@ -229,7 +238,7 @@ def t_list_citations(g: Graph, args: dict, ctx: RunContext) -> dict: r.page AS page, r.quote AS quote, r.snippet AS snippet, r.audit AS audit, r.audit_note AS audit_note, r.review AS review, r.reviewer AS reviewer, r.name_check AS name_check, r.panel_check AS panel_check, r.ai_label AS ai_label, r.corrected_from AS corrected_from, r.source_url AS source_url, - ({LINEAGE_EDGE}) AS in_lineage + ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory ORDER BY CASE r.kind WHEN 'predicate' THEN 0 WHEN 'reference' THEN 1 ELSE 2 END, dst""", {"k": k}) if not rows and g.device(k) is None: raise ToolError(f"{k} is not in the graph") @@ -240,6 +249,8 @@ def t_list_citations(g: Graph, args: dict, ctx: RunContext) -> dict: _flag_injection(ctx, f"citation {k}->{r['dst']}", r["quote"], r["snippet"], r["audit_note"]) out.append({"dst": r["dst"], "dst_name": r["dst_name"], "dst_decision_date": r["dst_decision_date"], "kind": r["kind"], "counts_in_lineage": r["in_lineage"], "page": r["page"], + "trust": ("uncertain" if why else "trusted") if r["in_lineage"] else + "advisory" if r["advisory"] else "excluded", "doubt": why or None, "audit": r["audit"], "audit_note": untrusted(r["audit_note"], 200), "review": r["review"], "reviewer": r["reviewer"], "provenance": _provenance(r), "name_check": r["name_check"], "panel_check": r["panel_check"], diff --git a/forebear/lineage.py b/forebear/lineage.py index f8043a4..29f9961 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -68,6 +68,10 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: pc = dev.get("product") or {} + for a in ancestors: + for h in a["hops"]: + h["trust"] = trust(h) + # D: the candidate's own recalls (one signal, all recalls as evidence) own = sorted(dev["recalls"], key=lambda x: x.get("initiated") or "", reverse=True) if own: @@ -130,10 +134,11 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: # route: its generation is its source's generation + 1 (the candidate is generation 0). gen_of = {k: 0} | {a["k"]: a["gen"] for a in ancestors} flagged, doubtful = [], [] - for h in g.lineage_edges_from([x for x, n in gen_of.items() if n < depth]): + sources = [x for x, n in gen_of.items() if n < depth] + for h in g.lineage_edges_from(sources): why = doubt(h) if why: - doubtful.append({"type": "citation", "doubt": why, "gen": gen_of[h["src"]] + 1, **h}) + doubtful.append({"type": "citation", "doubt": why, "gen": gen_of[h["src"]] + 1, "trust": "uncertain", **h}) if "name_mismatch" in why: flagged.append({"type": "citation", **h}) if flagged: @@ -150,6 +155,26 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: signals.append({"code": "UNCERTAIN_LINK_IN_LINEAGE", "severity": "info", "title": title, "evidence": other, "chain": []}) + # V: advisory links. An LLM triage label or an automated-client confirmation says a citation is a predicate, + # but no person has decided. The cited device and its recalls are shown with full provenance, never traversed: + # they cannot raise or lower the verdict. Inside the verdict window they make the evidence partial, because a + # predicate (and its recalls) may be missing from the trusted lineage until someone decides. + advisory = [{"type": "advisory_citation", "trust": "advisory", "basis": advisory_basis(h), + "gen": gen_of[h["src"]] + 1, **h} for h in g.advisory_edges_from(sources)] + window_advisory = [x for x in advisory if x["gen"] <= EVIDENCE_WINDOW] + if advisory: + rec_note = "; ".join(f"{x['dst']} has {_count(x['recalls'])}" + + (f", {sum(1 for r in x['recalls'] if r.get('design_related'))} design-related" + if any(r.get("design_related") for r in x["recalls"]) else "") + for x in advisory if x["recalls"]) + signals.append({"code": "ADVISORY_LINK_PENDING_REVIEW", "severity": "info", + "title": f"{len(advisory)} predicate link(s) suggested only by an automated source (LLM triage or " + f"the MCP client) await a person's decision and are not used for the verdict" + + (f". Recalls on the suggested devices: {rec_note}" if rec_note else ""), + "evidence": advisory + [_recall_ev(r) | {"via_advisory": f"{x['src']}->{x['dst']}"} + for x in advisory for r in x["recalls"]], + "chain": []}) + # C: predicate citations in the own summary of the candidate or of any ancestor whose predicates fall inside # the requested depth, that did not become lineage edges: K-number not in openFDA, cleared later, or removed # by the audit or a reviewer. `gen` is the generation the missing predicate would have had. @@ -220,11 +245,12 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: ("recall_cause_or_class_unknown", bool(unknown_recalls)), ("unattributed_recalls_in_product_code", bool(pc.get("unattributed_design_recalls_n"))), ("shallow_traversal", bool(shallow and ancestors)), + ("advisory_links_pending_review", bool(window_advisory)), ) if hit] if gen1 and not trusted_gen1: evidence = "uncertain" elif missing or gen1_unread or any(d["gen"] <= EVIDENCE_WINDOW for d in doubtful) or unknown_recalls or \ - pc.get("unattributed_design_recalls_n") or (shallow and ancestors): + pc.get("unattributed_design_recalls_n") or (shallow and ancestors) or window_advisory: evidence = "partial" else: evidence = "complete" if ancestors else "none" @@ -246,6 +272,9 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: elif ancestors and evidence == "uncertain": insufficient = ("Every direct predicate link of the candidate rests on uncertain evidence (see the " "uncertain-link signals), so its ancestry was not treated as checked.") + elif not ancestors and any(x["gen"] == 1 for x in advisory): + insufficient = ("The candidate's only predicate links were suggested by an automated source (LLM triage or the " + "MCP client) and await a person's decision, so its ancestry was not treated as checked.") else: insufficient = "No predicate citations were found for the candidate, so its ancestry was not checked." clear = ("No design-related recall on the candidate or its direct/grand-predicates in the readable ancestry " @@ -257,6 +286,9 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: elif evidence == "partial": clear = ("Provisional: " + clear + " Part of the ancestry within two generations is missing or rests on " "uncertain links (see the coverage signals), so a recall there would not show.") + if window_advisory: + clear += (" Predicate links suggested only by an automated source are not counted until a person " + "confirms them (see ADVISORY_LINK_PENDING_REVIEW).") if any(deeper.values()): clear += (" Beyond two generations the ancestry has gaps (see DEEPER_ANCESTRY_GAPS), so the lower-severity " "list may be incomplete.") @@ -279,6 +311,7 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: "candidate_lineage_known": bool(dev.get("lineage_known")), "evidence": evidence, "evidence_reasons": evidence_reasons, "doubtful_links": len(doubtful), + "advisory_links": len(advisory), "advisory_links_in_window": len(window_advisory), "unresolved_predicate_citations": len(missing), "direct_predicates": len(gen1), "direct_predicates_trusted": len(trusted_gen1), "evidence_scope": "candidate, direct predicates and grand-predicates (verdict window)", @@ -287,14 +320,15 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: } -RULES_VERSION = "forebear-rules-v4" -EVIDENCE_WINDOW = 2 -MACHINE_REVIEWERS = ("mcp-client",) # reviews recorded through an automated client, not a person # generations within which a recall can raise a verdict above "no signal" +RULES_VERSION = "forebear-rules-v5" +EVIDENCE_WINDOW = 2 # generations within which a recall can raise a verdict above "no signal" +MACHINE_REVIEWERS = ("mcp-client",) # reviews recorded through an automated client, not a person def doubt(h: dict) -> list[str]: """Why a lineage hop's evidence is doubtful ([] if it is not). A person's confirmation clears it; a - confirmation sent through the MCP tool (reviewer "mcp-client", possibly an AI agent) does not.""" + confirmation sent through the MCP tool (reviewer "mcp-client", possibly an AI agent) does not, and a rejection + sent through it leaves the edge in the lineage, flagged, until a person decides.""" if h.get("review") == "confirmed" and h.get("reviewer") not in MACHINE_REVIEWERS: return [] why = [] @@ -311,9 +345,30 @@ def doubt(h: dict) -> list[str]: if h.get("kind") not in (None, "predicate") and h.get("review") == "confirmed" \ and h.get("reviewer") in MACHINE_REVIEWERS: why.append("client_confirmation_only") + if h.get("review") == "rejected" and h.get("reviewer") in MACHINE_REVIEWERS: + why.append("client_rejection_pending") # an automated client disputes it; a person has not decided return why +def trust(h: dict) -> str: + """How far a trusted lineage hop can be relied on: 'human_verified' (a person confirmed it), 'extracted' (read + from the FDA summary, nothing doubtful) or 'uncertain' (doubt(h) is not empty). Advisory edges are labelled + where they are listed; they are never lineage hops.""" + if h.get("review") == "confirmed" and h.get("reviewer") not in MACHINE_REVIEWERS: + return "human_verified" + return "uncertain" if doubt(h) else "extracted" + + +def advisory_basis(h: dict) -> list[str]: + """Which automated sources call an untrusted citation a predicate.""" + out = [] + if h.get("ai_label") == "predicate": + out.append("llm_label") + if h.get("review") == "confirmed" and h.get("reviewer") in MACHINE_REVIEWERS: + out.append("client_confirmation") + return out + + UNKNOWN_CAUSES = ("", "other", "under investigation by firm", "unknown/undetermined by firm") diff --git a/forebear/mcp_server.py b/forebear/mcp_server.py index 139336f..0024089 100644 --- a/forebear/mcp_server.py +++ b/forebear/mcp_server.py @@ -41,10 +41,11 @@ {"name": "ingest_clearance", "description": "Fetch a 510(k) from FDA (openFDA + summary PDF), extract its predicates and recalls, " "and MERGE it into the graph. Also extends lineage for a device whose summary was unread.", "inputSchema": {"type": "object", "properties": {"k_number": K}, "required": ["k_number"]}}, - {"name": "review_citation", "description": "Record a human-verified judgement on an extracted citation edge: confirmed, rejected, " - "or '' to clear. Rejected edges stop counting in every lineage query. Recorded with reviewer " - "'mcp-client': a confirmation made here does not clear uncertain-evidence flags, " - "which only a person's review in the app does.", + {"name": "review_citation", "description": "Record an ADVISORY judgement on an extracted citation edge: confirmed, rejected, " + "or '' to clear. Recorded with reviewer 'mcp-client' (possibly an AI agent), it never " + "changes the deterministic lineage or verdict: a confirmation here lists the link as " + "advisory, a rejection flags the link as disputed but keeps it, and neither overwrites " + "a person's review. Only a person's review in the app makes a link trusted or removes it.", "inputSchema": {"type": "object", "properties": {"src": K, "dst": K, "status": {"type": "string", "enum": ["confirmed", "rejected", ""]}, "note": {"type": "string"}}, "required": ["src", "dst", "status"]}}, {"name": "save_assessment", "description": "Persist the current check as an (:Assessment) node linked to the device and its flagged recalls.", @@ -105,8 +106,11 @@ def _compact_assessment(a: dict) -> dict: "recalls": [{k: e.get(k) for k in ("id", "classification", "root_cause", "initiated", "url")} for e in s["evidence"] if e.get("type") == "recall"][:5], "citation_evidence": [{k: e.get(k) for k in ("src", "dst", "page", "snippet", "source_url", - "name_check", "audit", "audit_note", "doubt")} + "name_check", "audit", "audit_note", "doubt", "trust")} for e in s["evidence"] if e.get("type") == "citation"], + # untrusted links an automated source suggested: never verdict inputs until a person confirms + "advisory_links": [{k: e.get(k) for k in ("src", "dst", "page", "basis", "ai_model", "trust")} + for e in s["evidence"] if e.get("type") == "advisory_citation"], "unresolved_citations": [{k: e.get(k) for k in ("src", "cited", "reason", "page", "quote")} for e in s["evidence"] if e.get("type") == "unresolved_citation"]} for s in a["signals"]], diff --git a/tests/test_audit_uncertainty.py b/tests/test_audit_uncertainty.py index fb99595..f579b25 100644 --- a/tests/test_audit_uncertainty.py +++ b/tests/test_audit_uncertainty.py @@ -70,7 +70,8 @@ def test_source_audit_requires_matching_pdf_and_literal_page(monkeypatch, source def test_source_role_corrections_outrank_machine_labels_and_reviews(tiny): src, dst = "K000007", "K000004" tiny.review_citation(src, dst, "confirmed", "automated", reviewer="mcp-client") - assert [a["k"] for a in tiny.ancestors(src, 1)] == [dst] # unchanged behavior for an ordinary mention + assert tiny.ancestors(src, 1) == [] # a client confirmation alone is advisory + assert [h["dst"] for h in tiny.advisory_edges_from([src])] == [dst] tiny.upsert_citations([{**cite(src, dst, "reference"), "audit": "role_corrected"}]) tiny.set_triage(src, dst, "predicate", "machine triage", "test") tiny.review_citation(src, dst, "confirmed", "automated", reviewer="mcp-client") diff --git a/tests/test_completeness_window.py b/tests/test_completeness_window.py index 18346c0..f29fa04 100644 --- a/tests/test_completeness_window.py +++ b/tests/test_completeness_window.py @@ -143,8 +143,7 @@ def _routes(path): @pytest.mark.parametrize("doubt_props", [ - "r.name_check = 'mismatch'", "r.audit = 'unresolved'", "r.audit = 'corrected'", "r.panel_check = 'different'", - "r.kind = 'mention', r.ai_label = 'predicate'"]) + "r.name_check = 'mismatch'", "r.audit = 'unresolved'", "r.audit = 'corrected'", "r.panel_check = 'different'"]) def test_doubtful_link_off_the_shortest_route_is_seen(tmp_path, doubt_props): g = _routes(tmp_path / "r.rl") try: @@ -185,9 +184,25 @@ def test_confirmation_through_the_mcp_client_is_not_a_human_confirmation(g): assert assess(g, "K000001", 4)["coverage"]["evidence"] == "complete" -def test_mention_promoted_only_by_the_mcp_client_is_doubtful(g): +def test_ai_labelled_link_off_the_shortest_route_is_advisory_not_lineage(tmp_path): + g = _routes(tmp_path / "a.rl") + try: + g.conn.execute("MATCH (:Device {k:'K000011'})-[r:CITES]->(:Device {k:'K000012'}) " + "SET r.kind = 'mention', r.ai_label = 'predicate'") + a = assess(g, "K000010", 2) + assert a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" and a["verdict_reason"].startswith("Provisional") + assert a["coverage"]["doubtful_links"] == 0 and a["coverage"]["advisory_links_in_window"] == 1 + assert a["coverage"]["evidence"] == "partial" + assert "advisory_links_pending_review" in a["coverage"]["evidence_reasons"] + finally: + g.close() + + +def test_mention_promoted_only_by_the_mcp_client_is_advisory(g): g.conn.execute("MATCH (:Device {k:'K000001'})-[r:CITES]->(:Device {k:'K000002'}) SET r.kind = 'mention'") g.review_citation("K000001", "K000002", "confirmed", None, reviewer="mcp-client") a = assess(g, "K000001", 4) - assert "K000002" in {x["k"] for x in a["ancestors"]} - assert a["coverage"]["evidence"] == "uncertain" and a["verdict"] == "INSUFFICIENT_LINEAGE" + assert "K000002" not in {x["k"] for x in a["ancestors"]} + assert a["verdict"] == "INSUFFICIENT_LINEAGE" and "automated source" in a["verdict_reason"] + adv = next(s for s in a["signals"] if s["code"] == "ADVISORY_LINK_PENDING_REVIEW") + assert adv["evidence"][0]["basis"] == ["client_confirmation"] and adv["evidence"][0]["trust"] == "advisory" diff --git a/tests/test_graph.py b/tests/test_graph.py index d794d4e..05ef175 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -51,12 +51,17 @@ def test_reject_removes_edge_from_lineage(tiny): assert "K000002" in {a["k"] for a in tiny.ancestors("K000004")} -def test_confirm_or_ai_label_promotes_mention(tiny): +def test_ai_label_is_advisory_and_only_a_person_promotes_a_mention(tiny): assert tiny.ancestors("K000007") == [] tiny.set_triage("K000007", "K000004", "predicate", "Predicate device", "test-model") + assert tiny.ancestors("K000007") == [] # an LLM label alone never makes lineage + adv = tiny.advisory_edges_from(["K000007"]) + assert [(h["dst"], h["ai_label"], h["ai_model"], h["ai_quote"]) for h in adv] == [("K000004", "predicate", "test-model", "Predicate device")] + tiny.review_citation("K000007", "K000004", "confirmed", "read p.1", reviewer="user") assert "K000004" in {a["k"] for a in tiny.ancestors("K000007")} + assert tiny.advisory_edges_from(["K000007"]) == [] tiny.review_citation("K000007", "K000004", "rejected", None) # humans override AI - assert tiny.ancestors("K000007") == [] + assert tiny.ancestors("K000007") == [] and tiny.advisory_edges_from(["K000007"]) == [] def test_cited_after_recall_is_temporal(tiny): diff --git a/tests/test_trusted_lineage.py b/tests/test_trusted_lineage.py new file mode 100644 index 0000000..67d0596 --- /dev/null +++ b/tests/test_trusted_lineage.py @@ -0,0 +1,127 @@ +"""Trusted lineage and ingestion integrity. + +AI-only lineage: an LLM triage label or an automated-client (MCP) review is advisory. It never changes a +deterministic verdict; only a person's review does. Its evidence and provenance stay visible. +""" +from forebear.lineage import assess, compare, recall_reach + + +def _flag_k9_mention_to_recalled_k2(tiny): + """K000009 -> K000001 is a clean, complete, green lineage. Add a *mention* of K000002 (design-related Class I + recall) to K000009's summary: as a mention it is not lineage.""" + tiny.upsert_citations([{"src": "K000009", "dst": "K000002", "kind": "mention", "confidence": 0.4, "page": 3, + "snippet": "compared with K000002", "quote": "compared with K000002", "method": "test", + "source_url": "https://example.invalid/K000009.pdf", "source_sha256": "s9"}]) + + +# ---------------------------------------------------------------- 1. AI-only lineage is advisory +def test_ai_label_alone_does_not_change_the_verdict(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + before = assess(tiny, "K000009") + assert before["verdict"] == "NO_DESIGN_RECALL_SIGNAL" and before["coverage"]["evidence"] == "complete" + + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + a = assess(tiny, "K000009") + assert a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" # was REVIEW_LINEAGE before the fix + assert "K000002" not in {x["k"] for x in a["ancestors"]} + assert not [s for s in a["signals"] if s["severity"] in ("high", "medium")] + # ... but it is not presented as fully supported either + assert a["coverage"]["evidence"] == "partial" and a["verdict_reason"].startswith("Provisional") + assert "advisory_links_pending_review" in a["coverage"]["evidence_reasons"] + assert compare(tiny, ["K000009"])[0]["provisional"] is True + + +def test_advisory_link_keeps_its_evidence_and_provenance(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + s = next(s for s in assess(tiny, "K000009")["signals"] if s["code"] == "ADVISORY_LINK_PENDING_REVIEW") + assert s["severity"] == "info" and "not used for the verdict" in s["title"] and "design-related" in s["title"] + link = next(e for e in s["evidence"] if e["type"] == "advisory_citation") + assert link["trust"] == "advisory" and link["basis"] == ["llm_label"] and link["gen"] == 1 + assert (link["ai_label"], link["ai_model"], link["ai_quote"]) == ("predicate", "test-model", "compared with K000002") + assert link["ai_at"] and link["page"] == 3 and link["source_sha256"] == "s9" + rec = next(e for e in s["evidence"] if e["type"] == "recall") + assert rec["id"] == "Z-0001-2008" and rec["via_advisory"] == "K000009->K000002" + + +def test_ai_label_never_reaches_recall_reach_or_watchlist(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + assert "K000009" not in {d["k"] for d in recall_reach(tiny, "1")["descendants"]} + assert not any(r["k"] == "K000009" for r in tiny.cited_after_recall(design_only=True)) + + +def test_human_approval_makes_an_advisory_link_trusted(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + tiny.review_citation("K000009", "K000002", "confirmed", "PDF p.3 names it as a predicate", reviewer="user") + a = assess(tiny, "K000009") + assert a["verdict"] == "REVIEW_LINEAGE" + sig = next(s for s in a["signals"] if s["code"] == "ANCESTOR_RECALL" and s["chain"] == ["K000009", "K000002"]) + hop = next(e for e in sig["evidence"] if e["type"] == "citation") + assert hop["trust"] == "human_verified" and hop["reviewer"] == "user" and hop["ai_label"] == "predicate" + assert not any(s["code"] == "ADVISORY_LINK_PENDING_REVIEW" for s in a["signals"]) + assert "K000009" in {d["k"] for d in recall_reach(tiny, "1")["descendants"]} + + +def test_human_rejection_removes_the_advisory_link(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + tiny.review_citation("K000009", "K000002", "rejected", "only a comparison", reviewer="user") + a = assess(tiny, "K000009") + assert a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" and a["coverage"]["evidence"] == "complete" + assert not any(s["code"] == "ADVISORY_LINK_PENDING_REVIEW" for s in a["signals"]) + + +def test_mcp_client_confirmation_is_advisory_too(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + tiny.review_citation("K000009", "K000002", "confirmed", "agent says predicate", reviewer="mcp-client") + a = assess(tiny, "K000009") + assert a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" and a["coverage"]["advisory_links"] == 1 + link = next(e for s in a["signals"] if s["code"] == "ADVISORY_LINK_PENDING_REVIEW" + for e in s["evidence"] if e["type"] == "advisory_citation") + assert link["basis"] == ["client_confirmation"] + + +def test_mcp_client_rejection_does_not_drop_a_recall_from_the_verdict(tiny): + assert assess(tiny, "K000004")["verdict"] == "REVIEW_LINEAGE" # K000004 -> K000003 -> K000002 (recalled) + tiny.review_citation("K000004", "K000003", "rejected", "agent disagrees", reviewer="mcp-client") + a = assess(tiny, "K000004") + assert a["verdict"] == "REVIEW_LINEAGE" + assert "K000003" in {x["k"] for x in a["ancestors"]} + unc = next(s for s in a["signals"] if s["code"] == "UNCERTAIN_LINK_IN_LINEAGE") + assert any(e["dst"] == "K000003" and "client_rejection_pending" in e["doubt"] for e in unc["evidence"]) + + +def test_mcp_client_review_never_overwrites_a_person(tiny): + tiny.review_citation("K000004", "K000003", "confirmed", "checked p.2", reviewer="user") + r = tiny.review_citation("K000004", "K000003", "rejected", "agent disagrees", reviewer="mcp-client") + assert r["kept_human_review"] is True and r["review"] == "confirmed" and r["reviewer"] == "user" + c = next(c for c in tiny.direct_citations("K000004") if c["dst"] == "K000003") + assert (c["review"], c["reviewer"], c["review_note"], c["in_lineage"]) == ("confirmed", "user", "checked p.2", True) + + +def test_direct_citations_report_trust_standing(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + by = {c["dst"]: c for c in tiny.direct_citations("K000009")} + assert (by["K000001"]["in_lineage"], by["K000001"]["advisory"]) == (True, False) + assert (by["K000002"]["in_lineage"], by["K000002"]["advisory"]) == (False, True) + + +# ---------------------------------------------------------------- staleness +def _saved(g, k): + a = assess(g, k) + g.save_assessment(k, a["verdict"], {"verdict": a["verdict"]}, "memo", "template", []) + return a + + +def test_saved_assessment_is_flagged_after_ai_triage_and_human_review(tiny): + _flag_k9_mention_to_recalled_k2(tiny) + _saved(tiny, "K000009") + tiny.set_triage("K000009", "K000002", "predicate", "compared with K000002", "test-model") + h = tiny.assessments("K000009")[0] + assert h["stale"] is True and "K000009->K000002" in h["changed_edges"] + assert h["verdict"] == assess(tiny, "K000009")["verdict"] # flagged for re-check, verdict unchanged + tiny.review_citation("K000009", "K000002", "confirmed", "p.3", reviewer="user") + assert assess(tiny, "K000009")["verdict"] != h["verdict"] From fd0ea176a8d404d62bba2938a15ae897bbc5b326 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:54:00 +0100 Subject: [PATCH 02/10] fix: retire citations a refreshed FDA summary no longer supports when re-ingesting a clearance --- forebear/api.py | 3 +- forebear/graph.py | 56 +++++++++++--- forebear/ingest.py | 23 +++++- forebear/investigation/tools.py | 9 ++- forebear/lineage.py | 25 ++++++- forebear/mcp_server.py | 8 +- tests/test_trusted_lineage.py | 127 +++++++++++++++++++++++++++++++- 7 files changed, 229 insertions(+), 22 deletions(-) diff --git a/forebear/api.py b/forebear/api.py index 89c37a5..051802b 100644 --- a/forebear/api.py +++ b/forebear/api.py @@ -504,7 +504,8 @@ async def decide_proposal(pid: str, body: DecisionIn): except Exception as e: # IngestError or anything else: never leave the proposal 'deciding' error = f"{type(e).__name__}: {str(e)[:300]}" return await run(lambda g: inv_store.decide_proposal(g, pid, "failed", who, body.note, {"error": error})) - res = {k2: r[k2] for k2 in ("k", "summary_status", "summary_url", "new_devices", "recalls_linked")} | { + res = {k2: r[k2] for k2 in ("k", "summary_status", "summary_url", "new_devices", "recalls_linked", + "reconciliation")} | { "citations_added": [{k2: c[k2] for k2 in ("dst", "kind", "page")} for c in r["citations_added"]]} return await run(lambda g: inv_store.decide_proposal(g, pid, "executed", who, body.note, res)) diff --git a/forebear/graph.py b/forebear/graph.py index 1d71a71..3676669 100644 --- a/forebear/graph.py +++ b/forebear/graph.py @@ -16,7 +16,8 @@ audit, audit_note, audit_by, corrected_from, <- extraction audit (not human) review, review_note, reviewer, reviewed_at, <- review (person, or advisory reviewed_source_sha256, 'mcp-client' automated client) - ai_label, ai_quote, ai_model, ai_at}]->(Device) <- optional LLM triage (advisory) + ai_label, ai_quote, ai_model, ai_at, <- optional LLM triage (advisory) + retired_at, retired_reason, retired_by_sha256}]->(Device) <- re-ingest reconciliation (Device)-[:SUBJECT_OF]->(Recall) (Device)-[:IN_CODE]->(ProductCode) (Device)-[:FILED_BY]->(Company) @@ -24,7 +25,9 @@ (Assessment)-[:FLAGGED]->(Recall) All writes are MERGE-based so ingesting the same clearance twice is a no-op, and -incremental ingestion of a single new clearance uses the same code path as the bulk build. +incremental ingestion of a single new clearance uses the same code path as the bulk build. Re-ingesting a +clearance reconciles its citations: edges the refreshed summary no longer supports are retired (kept with +their reviews, labels, audit and provenance, but out of lineage), never deleted. """ from __future__ import annotations @@ -43,18 +46,20 @@ ] FULLTEXT = "CREATE FULLTEXT INDEX device_text IF NOT EXISTS FOR (d:Device) ON EACH [d.name, d.applicant]" -# Trusted lineage rule (the only edges deterministic verdicts traverse): either a PERSON confirmed it, or the extractor +# Trusted lineage rule (the only edges deterministic verdicts traverse): the edge is still cited by the citing +# device's current FDA summary (not retired by a re-ingest), and either a PERSON confirmed it, or the extractor # read it as a predicate and the extraction audit did not find it wrong - unless a person rejected it. # Automated sources never change trusted lineage on their own: an LLM triage label, or a confirmation/rejection # recorded through the MCP client (reviewer 'mcp-client', possibly an AI agent), is advisory until a person decides. MACHINE_REVIEWER = "mcp-client" HUMAN_REVIEW = f"(r.review IS NOT NULL AND coalesce(r.reviewer, '') <> '{MACHINE_REVIEWER}')" -LINEAGE_EDGE = (f"NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " +LIVE_EDGE = "r.retired_at IS NULL" +LINEAGE_EDGE = (f"{LIVE_EDGE} AND NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " f"((r.review = 'confirmed' AND {HUMAN_REVIEW}) OR " "(r.kind = 'predicate' AND NOT coalesce(r.audit, '') IN ['error', 'not_predicate']))") # Advisory (uncertain, untrusted) lineage: an automated source says predicate, no person has decided, and the # extraction audit did not rule it out from the source. Shown with its provenance; never a verdict input. -ADVISORY_EDGE = (f"NOT ({LINEAGE_EDGE}) AND NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " +ADVISORY_EDGE = (f"{LIVE_EDGE} AND NOT ({LINEAGE_EDGE}) AND NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " "NOT coalesce(r.audit, '') IN ['error', 'not_predicate', 'role_corrected'] AND " f"(r.ai_label = 'predicate' OR (r.review = 'confirmed' AND r.reviewer = '{MACHINE_REVIEWER}'))") DISPUTED_EDGE = ("coalesce(r.audit, '') = 'unresolved' AND " @@ -144,9 +149,26 @@ def upsert_citations(self, rows: list[dict]) -> None: c.name_check_method = r.name_check_method, c.panel_check = r.panel_check, c.explicit_label = r.explicit_label, c.audit = r.audit, c.audit_note = r.audit_note, c.audit_by = r.audit_by, - c.audit_date = r.audit_date, c.corrected_from = r.corrected_from""", + c.audit_date = r.audit_date, c.corrected_from = r.corrected_from, + c.retired_at = NULL, c.retired_reason = NULL, c.retired_by_sha256 = NULL""", {"rows": rows[i:i + 500]}) + def retire_citations(self, src: str, keep: list[str], source_sha256: str | None) -> list[dict]: + """Reconcile src's citations with a refreshed summary: every live CITES edge from src whose target is not + in `keep` (the targets the refreshed summary still supports) is retired, never deleted. Retired edges keep + every property - human review, LLM label, audit decision and source provenance - drop out of trusted and + advisory lineage, and come back (un-retired) if a later summary cites the device again. Call it inside the + ingest transaction so the reconciliation is atomic with the upserts.""" + return self.q( + """MATCH (a:Device {k:$k})-[c:CITES]->(b:Device) + WHERE c.retired_at IS NULL AND NOT b.k IN $keep + SET c.retired_at = datetime(), c.retired_reason = 'not_in_refreshed_summary', + c.retired_by_sha256 = $sha + RETURN a.k AS src, b.k AS dst, c.kind AS kind, c.page AS page, c.quote AS quote, + c.source_sha256 AS source_sha256, c.review AS review, c.reviewer AS reviewer, + c.ai_label AS ai_label, c.audit AS audit ORDER BY dst""", + {"k": src, "keep": list(keep), "sha": source_sha256}) + def upsert_recalls(self, rows: list[dict]) -> None: """rows: recall dicts incl. k_numbers list; links each to the devices it names. Optional `links` carry per-device evidence (dataset.link_recalls); existing evidence is kept otherwise.""" @@ -295,9 +317,9 @@ def _lineage(self, k: str, depth: int, direction: str) -> list[dict]: return out def direct_citations(self, k: str) -> list[dict]: - """All extracted citations from k (any kind, incl. rejected) for the review panel, each with its trust - standing: `in_lineage` (trusted, a verdict input), `advisory` (an automated source says predicate, pending a - person) or neither.""" + """All extracted citations from k (any kind, incl. rejected and retired) for the review panel, each with + its trust standing: `in_lineage` (trusted, a verdict input), `advisory` (an automated source says predicate, + pending a person) or neither; `retired_at` when a refreshed summary no longer supports it.""" return [{**r, "dst_decision_date": str(r["dst_decision_date"]) if r["dst_decision_date"] else None} for r in self.q( f"""MATCH (d:Device {{k:$k}})-[r:CITES]->(b:Device) @@ -310,6 +332,7 @@ def direct_citations(self, k: str) -> list[dict]: r.panel_check AS panel_check, r.quote AS quote, r.method AS method, r.text_source AS text_source, r.audit AS audit, r.audit_note AS audit_note, r.audit_by AS audit_by, r.corrected_from AS corrected_from, + toString(r.retired_at) AS retired_at, r.retired_reason AS retired_reason, ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory ORDER BY CASE r.kind WHEN 'predicate' THEN 0 WHEN 'reference' THEN 1 ELSE 2 END, b.k""", {"k": k})] @@ -335,6 +358,16 @@ def advisory_edges_from(self, ks: list[str]) -> list[dict]: return [r["hop"] | {"dst_name": r["dst_name"], "recalls": [_clean(x) for x in r["recalls"] if x]} for r in rows] + def retired_citations_from(self, ks: list[str]) -> list[dict]: + """Citation edges a re-ingest retired because the refreshed summary no longer supports them.""" + if not ks: + return [] + return self.q( + f"""MATCH (a:Device)-[r:CITES]->(b:Device) WHERE a.k IN $ks AND r.retired_at IS NOT NULL + RETURN {{{_HOP_FIELDS}}} AS hop, toString(r.retired_at) AS retired_at, r.retired_reason AS retired_reason, + r.retired_by_sha256 AS retired_by_sha256 + ORDER BY hop.src, hop.dst""", {"ks": list(ks)}) + def _edges_from(self, ks: list[str], rule: str) -> list[dict]: if not ks: return [] @@ -344,9 +377,10 @@ def _edges_from(self, ks: list[str], rule: str) -> list[dict]: def out_of_lineage_predicates(self, k: str) -> list[dict]: """Citations the extractor read as predicates that do not count in lineage queries (removed by - the audit or rejected by a person), minus K-number typos the audit corrected to another edge.""" + the audit or rejected by a person), minus K-number typos the audit corrected to another edge. Edges retired + by a re-ingest are reported separately (retired_citations_from): the current summary no longer cites them.""" rows = self.q( - f"""MATCH (d:Device {{k:$k}})-[r:CITES]->(b:Device) + f"""MATCH (d:Device {{k:$k}})-[r:CITES]->(b:Device) WHERE {LIVE_EDGE} RETURN b.k AS dst, r.kind AS kind, r.page AS page, r.quote AS quote, r.snippet AS snippet, r.review AS review, r.review_note AS review_note, r.audit AS audit, r.audit_note AS audit_note, r.corrected_from AS corrected_from, diff --git a/forebear/ingest.py b/forebear/ingest.py index 9f1ee8c..8429238 100644 --- a/forebear/ingest.py +++ b/forebear/ingest.py @@ -13,6 +13,12 @@ present_devices(g, ks) graph -> which cited K-numbers already exist fetch_related(fetched, present) network -> metadata for new predicates + recall rows write(g, fetched, related) graph -> one transaction, rollback on error + +Re-ingesting a clearance reconciles its citations inside that same transaction: citation edges the refreshed +summary no longer supports are retired (graph.retire_citations), not deleted, so human reviews, LLM labels, audit +decisions and source provenance survive and an edge comes back if a later summary cites the device again. +Reconciliation only runs when the refreshed summary text was actually read: an unreadable download never wipes +existing lineage. """ from __future__ import annotations @@ -21,7 +27,7 @@ from . import audit, openfda, summaries from .dataset import (citation_rows, device_row, fetch_recalls_for, link_recalls, mark_no_predicate, mark_unresolved) -from .graph import Graph +from .graph import MACHINE_REVIEWER, Graph from .predicates import extract_from_summary @@ -108,10 +114,17 @@ def write(g: Graph, f: Fetched, rel: Related, existing: dict | None) -> dict: mark_no_predicate(devices[:1], cits) mark_unresolved(devices[:1], unresolved) link_recalls(rel.recalls, {**rel.known, **{d["k"]: d for d in devices}}) + text = summaries.load_text(f.k) + reconcile = bool(text and text.get("pages")) + keep = sorted({c["dst"] for c in cits}) + prior = {r["dst"]: r["retired"] for r in g.q( + "MATCH (:Device {k:$k})-[c:CITES]->(b:Device) RETURN b.k AS dst, c.retired_at IS NOT NULL AS retired", + {"k": f.k})} g.conn.autocommit = False try: g.upsert_devices(devices) g.upsert_citations(cits) + retired = g.retire_citations(f.k, keep, (text or {}).get("sha256")) if reconcile else [] g.upsert_recalls(rel.recalls) g.conn.execute("MATCH (d:Device {k:$k}) SET d.ingested_live_at = datetime()", {"k": f.k}) g.conn.commit() @@ -126,6 +139,14 @@ def write(g: Graph, f: Fetched, rel: Related, existing: dict | None) -> dict: "lineage_was_known": bool(existing and existing.get("lineage_known")), "summary_status": devices[0]["summary_status"], "summary_url": f.summ.get("url"), "citations_added": cits, "citations_unresolved": unresolved, "new_devices": list(rel.cited_meta), + "reconciliation": { + "ran": reconcile, + "skipped_reason": None if reconcile else "refreshed summary text not readable; existing citations kept", + "new": [d for d in keep if d not in prior], + "restored": [d for d in keep if prior.get(d)], + "retired": retired, + "retired_with_human_review": [r["dst"] for r in retired + if r.get("review") and r.get("reviewer") != MACHINE_REVIEWER]}, "recalls_linked": [r["id"] for r in rel.recalls], "extraction": report, "graph_before": before["nodes"], "graph_after": after["nodes"], "rels_before": before["relationships"], "rels_after": after["relationships"], diff --git a/forebear/investigation/tools.py b/forebear/investigation/tools.py index 20ed581..e21ee1e 100644 --- a/forebear/investigation/tools.py +++ b/forebear/investigation/tools.py @@ -170,6 +170,7 @@ def compact_assessment(a: dict) -> dict: cit = [e for e in s["evidence"] if e.get("type") == "citation"] unres = [e for e in s["evidence"] if e.get("type") == "unresolved_citation"] adv = [e for e in s["evidence"] if e.get("type") == "advisory_citation"] + ret = [e for e in s["evidence"] if e.get("type") == "retired_citation"] dev = [e for e in s["evidence"] if e.get("type") == "device"] sig = {"code": s.get("code"), "severity": s["severity"], "title": s["title"], "chain": s.get("chain") or None} if s.get("conditional"): @@ -188,6 +189,10 @@ def compact_assessment(a: dict) -> dict: sig["advisory_links"] = [{"src": e["src"], "dst": e["dst"], "page": e.get("page"), "trust": "advisory", "basis": e.get("basis"), "ai_model": e.get("ai_model"), "recall_ids": [x["id"] for x in e.get("recalls") or []][:10]} for e in adv][:10] + if ret: + sig["retired_links"] = [{"src": e["src"], "dst": e["dst"], "trust": "retired", + "retired_at": e.get("retired_at"), "review": e.get("review"), + "reviewer": e.get("reviewer")} for e in ret][:10] if dev: sig["devices"] = [{"k": e["k"], "summary_status": e.get("summary_status")} for e in dev][:12] out_signals.append({k: v for k, v in sig.items() if v is not None}) @@ -238,7 +243,7 @@ def t_list_citations(g: Graph, args: dict, ctx: RunContext) -> dict: r.page AS page, r.quote AS quote, r.snippet AS snippet, r.audit AS audit, r.audit_note AS audit_note, r.review AS review, r.reviewer AS reviewer, r.name_check AS name_check, r.panel_check AS panel_check, r.ai_label AS ai_label, r.corrected_from AS corrected_from, r.source_url AS source_url, - ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory + r.retired_at IS NOT NULL AS retired, ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory ORDER BY CASE r.kind WHEN 'predicate' THEN 0 WHEN 'reference' THEN 1 ELSE 2 END, dst""", {"k": k}) if not rows and g.device(k) is None: raise ToolError(f"{k} is not in the graph") @@ -250,7 +255,7 @@ def t_list_citations(g: Graph, args: dict, ctx: RunContext) -> dict: out.append({"dst": r["dst"], "dst_name": r["dst_name"], "dst_decision_date": r["dst_decision_date"], "kind": r["kind"], "counts_in_lineage": r["in_lineage"], "page": r["page"], "trust": ("uncertain" if why else "trusted") if r["in_lineage"] else - "advisory" if r["advisory"] else "excluded", + "advisory" if r["advisory"] else "retired" if r["retired"] else "excluded", "doubt": why or None, "audit": r["audit"], "audit_note": untrusted(r["audit_note"], 200), "review": r["review"], "reviewer": r["reviewer"], "provenance": _provenance(r), "name_check": r["name_check"], "panel_check": r["panel_check"], diff --git a/forebear/lineage.py b/forebear/lineage.py index 29f9961..a897fb9 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -175,6 +175,23 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: for x in advisory for r in x["recalls"]], "chain": []}) + # X: citations a re-ingest retired because the refreshed FDA summary no longer supports them. Kept with their + # reviews and provenance for the record; out of lineage. A retired edge a person had confirmed is a gap: the + # person's decision was made on text the current summary no longer contains. + retired = [r["hop"] | {"type": "retired_citation", "trust": "retired", "retired_at": r["retired_at"], + "retired_reason": r["retired_reason"], "retired_by_sha256": r["retired_by_sha256"], + "gen": gen_of[r["hop"]["src"]] + 1} + for r in g.retired_citations_from(sources)] + retired_confirmed = [x for x in retired if x["gen"] <= EVIDENCE_WINDOW and x.get("review") == "confirmed" + and x.get("reviewer") not in MACHINE_REVIEWERS] + if retired: + signals.append({"code": "CITATION_RETIRED_BY_REINGEST", "severity": "info", + "title": f"{len(retired)} citation(s) are no longer supported by the refreshed FDA summary of the " + f"citing device and were retired from the lineage" + + (f"; {len(retired_confirmed)} had been confirmed by a person and need re-review" + if retired_confirmed else ""), + "evidence": retired, "chain": []}) + # C: predicate citations in the own summary of the candidate or of any ancestor whose predicates fall inside # the requested depth, that did not become lineage edges: K-number not in openFDA, cleared later, or removed # by the audit or a reviewer. `gen` is the generation the missing predicate would have had. @@ -246,11 +263,12 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: ("unattributed_recalls_in_product_code", bool(pc.get("unattributed_design_recalls_n"))), ("shallow_traversal", bool(shallow and ancestors)), ("advisory_links_pending_review", bool(window_advisory)), + ("human_confirmed_citation_retired", bool(retired_confirmed)), ) if hit] if gen1 and not trusted_gen1: evidence = "uncertain" elif missing or gen1_unread or any(d["gen"] <= EVIDENCE_WINDOW for d in doubtful) or unknown_recalls or \ - pc.get("unattributed_design_recalls_n") or (shallow and ancestors) or window_advisory: + pc.get("unattributed_design_recalls_n") or (shallow and ancestors) or window_advisory or retired_confirmed: evidence = "partial" else: evidence = "complete" if ancestors else "none" @@ -312,6 +330,7 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: "evidence": evidence, "evidence_reasons": evidence_reasons, "doubtful_links": len(doubtful), "advisory_links": len(advisory), "advisory_links_in_window": len(window_advisory), + "retired_citations": len(retired), "unresolved_predicate_citations": len(missing), "direct_predicates": len(gen1), "direct_predicates_trusted": len(trusted_gen1), "evidence_scope": "candidate, direct predicates and grand-predicates (verdict window)", @@ -352,8 +371,8 @@ def doubt(h: dict) -> list[str]: def trust(h: dict) -> str: """How far a trusted lineage hop can be relied on: 'human_verified' (a person confirmed it), 'extracted' (read - from the FDA summary, nothing doubtful) or 'uncertain' (doubt(h) is not empty). Advisory edges are labelled - where they are listed; they are never lineage hops.""" + from the FDA summary, nothing doubtful) or 'uncertain' (doubt(h) is not empty). Advisory and retired edges are + labelled where they are listed; they are never lineage hops.""" if h.get("review") == "confirmed" and h.get("reviewer") not in MACHINE_REVIEWERS: return "human_verified" return "uncertain" if doubt(h) else "extracted" diff --git a/forebear/mcp_server.py b/forebear/mcp_server.py index 0024089..7844a58 100644 --- a/forebear/mcp_server.py +++ b/forebear/mcp_server.py @@ -39,7 +39,9 @@ {"name": "list_citations", "description": "What a device's 510(k) summary cites (predicate / reference / mention), with page and snippet.", "inputSchema": {"type": "object", "properties": {"k_number": K}, "required": ["k_number"]}}, {"name": "ingest_clearance", "description": "Fetch a 510(k) from FDA (openFDA + summary PDF), extract its predicates and recalls, " - "and MERGE it into the graph. Also extends lineage for a device whose summary was unread.", + "and MERGE it into the graph. Also extends lineage for a device whose summary was unread. " + "Re-ingesting reconciles citations: ones the refreshed summary no longer supports are " + "retired (kept with their reviews and provenance, out of lineage).", "inputSchema": {"type": "object", "properties": {"k_number": K}, "required": ["k_number"]}}, {"name": "review_citation", "description": "Record an ADVISORY judgement on an extracted citation edge: confirmed, rejected, " "or '' to clear. Recorded with reviewer 'mcp-client' (possibly an AI agent), it never " @@ -111,6 +113,8 @@ def _compact_assessment(a: dict) -> dict: # untrusted links an automated source suggested: never verdict inputs until a person confirms "advisory_links": [{k: e.get(k) for k in ("src", "dst", "page", "basis", "ai_model", "trust")} for e in s["evidence"] if e.get("type") == "advisory_citation"], + "retired_links": [{k: e.get(k) for k in ("src", "dst", "retired_at", "review", "reviewer")} + for e in s["evidence"] if e.get("type") == "retired_citation"], "unresolved_citations": [{k: e.get(k) for k in ("src", "cited", "reason", "page", "quote")} for e in s["evidence"] if e.get("type") == "unresolved_citation"]} for s in a["signals"]], @@ -134,7 +138,7 @@ def call_tool(name: str, args: dict): if name == "ingest_clearance": r = _http("POST", "/api/ingest", json={"k": up(args["k_number"])}) return {k: r[k] for k in ("k", "was_present", "summary_status", "summary_url", "new_devices", - "recalls_linked", "extraction")} | { + "recalls_linked", "extraction", "reconciliation")} | { "citations_added": [{k: c[k] for k in ("dst", "kind", "page", "snippet")} for c in r["citations_added"]]} if name == "review_citation": return _http("POST", "/api/citation/review", json={"src": up(args["src"]), "dst": up(args["dst"]), diff --git a/tests/test_trusted_lineage.py b/tests/test_trusted_lineage.py index 67d0596..474ff52 100644 --- a/tests/test_trusted_lineage.py +++ b/tests/test_trusted_lineage.py @@ -1,8 +1,13 @@ """Trusted lineage and ingestion integrity. -AI-only lineage: an LLM triage label or an automated-client (MCP) review is advisory. It never changes a -deterministic verdict; only a person's review does. Its evidence and provenance stay visible. +1. AI-only lineage: an LLM triage label or an automated-client (MCP) review is advisory. It never changes a + deterministic verdict; only a person's review does. Its evidence and provenance stay visible. +2. Live re-ingest reconciliation: citations a refreshed FDA summary no longer supports are retired atomically, + never deleted, keeping human reviews, labels, audit fields and provenance. """ +import pytest + +from forebear import dataset, ingest from forebear.lineage import assess, compare, recall_reach @@ -109,6 +114,111 @@ def test_direct_citations_report_trust_standing(tiny): assert (by["K000002"]["in_lineage"], by["K000002"]["advisory"]) == (False, True) +# ---------------------------------------------------------------- 2. live re-ingest reconciliation +META = [{"k_number": "K261000", "device_name": "New CPAP", "applicant": "NewCo", "decision_date": "2026-05-01", + "date_received": "2026-01-01", "product_code": "BZD", "statement_or_summary": "Summary"}] + + +def _network(monkeypatch, pages, sha, status="ok"): + summary = {"k": "K261000", "status": status, "url": "https://example.invalid/K261000.pdf", "sha256": sha, + "pages": pages} + monkeypatch.setattr(ingest.openfda, "clearances_by_k", + lambda ks, use_cache=True: [m for m in META if m["k_number"] in ks]) + monkeypatch.setattr(ingest.summaries, "fetch", lambda k: summary) + monkeypatch.setattr(dataset.summaries, "load", lambda k: summary if k == "K261000" else None) + monkeypatch.setattr(ingest, "fetch_recalls_for", lambda ks, use_cache=True: []) + + +V1 = ["Primary Predicate Device: Device K000003 (K000003). Secondary predicate device: Device K000009 (K000009)."] +V2 = ["Primary Predicate Device: Device K000009 (K000009)."] + + +def _edges(g, k="K261000"): + return {c["dst"]: c for c in g.direct_citations(k)} + + +def test_repeated_ingest_of_the_same_summary_is_a_no_op(tiny, monkeypatch): + _network(monkeypatch, V1, "v1") + ingest.add_clearance(tiny, "K261000") + stats, edges = tiny.stats(), _edges(tiny) + res = ingest.add_clearance(tiny, "K261000") + assert tiny.stats() == stats and res["reconciliation"]["retired"] == [] and res["reconciliation"]["new"] == [] + assert {k: (e["in_lineage"], e["retired_at"]) for k, e in _edges(tiny).items()} == \ + {k: (e["in_lineage"], e["retired_at"]) for k, e in edges.items()} + + +def test_removed_citation_is_retired_with_reviews_and_provenance_kept(tiny, monkeypatch): + _network(monkeypatch, V1, "v1") + ingest.add_clearance(tiny, "K261000") + assert assess(tiny, "K261000")["verdict"] == "REVIEW_LINEAGE" # via K000003 -> K000002 (design recall) + tiny.review_citation("K261000", "K000003", "confirmed", "checked v1 p.1", reviewer="user") + tiny.set_triage("K261000", "K000003", "predicate", "Primary Predicate Device", "test-model") + + _network(monkeypatch, V2, "v2") # FDA's refreshed summary drops K000003 + res = ingest.add_clearance(tiny, "K261000") + rec = res["reconciliation"] + assert rec["ran"] is True and [r["dst"] for r in rec["retired"]] == ["K000003"] + assert rec["retired_with_human_review"] == ["K000003"] + + e = _edges(tiny)["K000003"] # the edge still exists, nothing destroyed + assert e["retired_at"] and e["retired_reason"] == "not_in_refreshed_summary" and e["in_lineage"] is False + assert (e["review"], e["reviewer"], e["review_note"]) == ("confirmed", "user", "checked v1 p.1") + assert (e["ai_label"], e["ai_model"]) == ("predicate", "test-model") + assert e["source_sha256"] == "v1" and e["reviewed_source_sha256"] == "v1" and e["page"] == 1 + assert e["advisory"] is False + + a = assess(tiny, "K261000") + assert "K000003" not in {x["k"] for x in a["ancestors"]} + assert a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" + assert a["coverage"]["evidence"] == "partial" # a person's decision rested on the old text + assert "human_confirmed_citation_retired" in a["coverage"]["evidence_reasons"] + sig = next(s for s in a["signals"] if s["code"] == "CITATION_RETIRED_BY_REINGEST") + assert sig["evidence"][0]["retired_by_sha256"] == "v2" and "re-review" in sig["title"] + assert not any(s["code"] == "PREDICATE_CITATION_UNRESOLVED" for s in a["signals"]) + + +def test_retired_citation_is_restored_when_a_later_summary_cites_it_again(tiny, monkeypatch): + _network(monkeypatch, V1, "v1") + ingest.add_clearance(tiny, "K261000") + _network(monkeypatch, V2, "v2") + ingest.add_clearance(tiny, "K261000") + _network(monkeypatch, V1, "v3") + res = ingest.add_clearance(tiny, "K261000") + assert res["reconciliation"]["restored"] == ["K000003"] and res["reconciliation"]["retired"] == [] + e = _edges(tiny)["K000003"] + assert e["retired_at"] is None and e["in_lineage"] is True and e["source_sha256"] == "v3" + assert assess(tiny, "K261000")["verdict"] == "REVIEW_LINEAGE" + + +def test_unreadable_refresh_never_wipes_existing_lineage(tiny, monkeypatch): + _network(monkeypatch, V1, "v1") + ingest.add_clearance(tiny, "K261000") + _network(monkeypatch, [""], "v2", status="no_text") + res = ingest.add_clearance(tiny, "K261000") + assert res["reconciliation"]["ran"] is False and res["reconciliation"]["retired"] == [] + assert all(e["retired_at"] is None for e in _edges(tiny).values()) + + +def test_reconciliation_rolls_back_with_the_rest_of_the_write(tiny, monkeypatch): + _network(monkeypatch, V1, "v1") + ingest.add_clearance(tiny, "K261000") + tiny.review_citation("K261000", "K000003", "confirmed", "checked", reviewer="user") + stats, before = tiny.stats(), _edges(tiny) + + _network(monkeypatch, V2, "v2") + + def boom(rows): + raise RuntimeError("disk full") + monkeypatch.setattr(tiny, "upsert_recalls", boom) # fails after the retire in the same tx + with pytest.raises(RuntimeError): + ingest.add_clearance(tiny, "K261000") + after = _edges(tiny) + assert tiny.stats() == stats + assert after["K000003"]["retired_at"] is None and after["K000003"]["in_lineage"] is True + assert after["K000003"]["review"] == "confirmed" + assert {k: e["source_sha256"] for k, e in after.items()} == {k: e["source_sha256"] for k, e in before.items()} + + # ---------------------------------------------------------------- staleness def _saved(g, k): a = assess(g, k) @@ -116,6 +226,19 @@ def _saved(g, k): return a +def test_saved_assessment_goes_stale_when_reingest_retires_a_citation(tiny, monkeypatch): + _network(monkeypatch, V1, "v1") + ingest.add_clearance(tiny, "K261000") + _saved(tiny, "K261000") + _saved(tiny, "K000005") # unrelated lineage + assert not any(h["stale"] for h in tiny.assessments()) + _network(monkeypatch, V2, "v2") + ingest.add_clearance(tiny, "K261000") + by = {h["k"]: h for h in tiny.assessments()} + assert by["K261000"]["stale"] is True and by["K261000"]["reingested"] == ["K261000"] + assert by["K000005"]["stale"] is False + + def test_saved_assessment_is_flagged_after_ai_triage_and_human_review(tiny): _flag_k9_mention_to_recalled_k2(tiny) _saved(tiny, "K000009") From f62f4eacd2feb8c84c301881f2ab75836836aa4d Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:54:18 +0100 Subject: [PATCH 03/10] fix: label advisory and retired citations in the UI and stop client reviews posing as a person's --- web/e2e/trusted-lineage.spec.js | 50 +++++++++++++++++++++++++++++ web/src/evidence.js | 20 +++++++++--- web/src/styles.css | 4 +++ web/src/workspace/Investigation.jsx | 26 ++++++++------- web/src/workspace/Provenance.jsx | 16 +++++---- web/src/workspace/Review.jsx | 14 ++++++++ web/src/workspace/Views.jsx | 5 +++ 7 files changed, 113 insertions(+), 22 deletions(-) create mode 100644 web/e2e/trusted-lineage.spec.js diff --git a/web/e2e/trusted-lineage.spec.js b/web/e2e/trusted-lineage.spec.js new file mode 100644 index 0000000..0a35428 --- /dev/null +++ b/web/e2e/trusted-lineage.spec.js @@ -0,0 +1,50 @@ +import { test, expect } from '@playwright/test' + +// Trusted lineage: a link suggested only by an automated source (LLM triage, or the MCP client) is advisory and +// never changes the verdict; a person's confirmation does. Runs on the throwaway copy of the shipped store. +// K203126 -> K133801 is a *reference* to a device with a design-related recall; K203126 is otherwise clean. + +const SRC = 'K203126' +const DST = 'K133801' + +test.describe('AI-only lineage is advisory', () => { + test.afterEach(async ({ request }) => { + await request.post('/api/citation/review', { data: { src: SRC, dst: DST, status: '', via: 'user' } }) + }) + + test('an automated-client confirmation shows as advisory and leaves the verdict alone', async ({ page, request }) => { + const r = await request.post('/api/citation/review', { data: { src: SRC, dst: DST, status: 'confirmed', note: 'agent', via: 'mcp-client' } }) + expect((await r.json()).advisory).toBe(true) + await page.goto(`/#/check/${SRC}`) + await expect(page.getByTestId('verdict')).toContainText('No design-recall signal · provisional') + await expect(page.getByTestId(`cit-status-${DST}`)).toHaveText('Advisory') + await expect(page.getByTestId('evidence-reason').first()).toBeVisible() + await expect(page.getByTestId('review-queue')).toContainText('not used for the verdict') + }) + + test("a person's confirmation makes the link trusted and the verdict changes", async ({ page, request }) => { + await request.post('/api/citation/review', { data: { src: SRC, dst: DST, status: 'confirmed', note: 'agent', via: 'mcp-client' } }) + await page.goto(`/#/check/${SRC}`) + const cit = page.locator('.cit', { has: page.getByTestId(`cit-status-${DST}`) }) + await cit.getByRole('button', { name: 'Confirm', exact: true }).click() + await expect(page.getByTestId(`cit-status-${DST}`)).toHaveText('Confirmed') + await expect(page.getByTestId('verdict')).toContainText('Review lineage') + }) +}) + +test('re-ingest lists citations retired by the refreshed summary', async ({ page }) => { + await page.route('**/api/ingest', (route) => route.fulfill({ + json: { + k: 'K261000', was_present: true, lineage_was_known: true, summary_status: 'ok', summary_url: null, + citations_added: [], citations_unresolved: [], new_devices: [], recalls_linked: [], extraction: {}, + graph_before: {}, graph_after: {}, rels_before: {}, rels_after: {}, + reconciliation: { ran: true, skipped_reason: null, new: [], restored: [], + retired: [{ src: 'K261000', dst: 'K000003', review: 'confirmed', reviewer: 'user' }], + retired_with_human_review: ['K000003'] }, + }, + })) + await page.goto('/#/ingest/K261000') + await page.getByRole('button', { name: 'Read and add' }).click() + await expect(page.getByTestId('ingest-retired')).toContainText('K000003 (confirmed by user)') + await expect(page.getByTestId('ingest-retired')).toContainText('kept with their reviews and provenance') +}) diff --git a/web/src/evidence.js b/web/src/evidence.js index c472b35..50f046a 100644 --- a/web/src/evidence.js +++ b/web/src/evidence.js @@ -32,6 +32,7 @@ export const DOUBT_TEXT = { different_fda_panel: 'Cited device sits in a different FDA review panel', llm_label_only: 'A predicate only because an LLM labelled the mention', client_confirmation_only: 'Confirmed only through the automated MCP client, not a person', + client_rejection_pending: 'Rejected through the automated MCP client; kept until a person decides', } /** Mirror of lineage.doubt(): why a lineage hop's evidence is doubtful ([] if not). */ @@ -46,24 +47,33 @@ export function doubt(h) { if (h.kind != null && h.kind !== 'predicate' && h.ai_label === 'predicate') why.push('llm_label_only') if (h.kind != null && h.kind !== 'predicate' && h.review === 'confirmed' && MACHINE_REVIEWERS.includes(h.reviewer)) why.push('client_confirmation_only') + if (h.review === 'rejected' && MACHINE_REVIEWERS.includes(h.reviewer)) why.push('client_rejection_pending') return why } +/** A review recorded by a person (not the automated MCP client). Only these change trusted lineage. */ +export const humanReview = (h) => !!h?.review && !MACHINE_REVIEWERS.includes(h.reviewer) + export const EDGE_STATUS = { confirmed: { label: 'Confirmed by a person', short: 'Confirmed' }, extracted: { label: 'Machine-extracted', short: 'Extracted' }, disputed: { label: 'Disputed evidence', short: 'Disputed' }, conditional: { label: 'Conditional route', short: 'Conditional' }, - rejected: { label: 'Rejected by a reviewer', short: 'Rejected' }, + rejected: { label: 'Rejected by a person', short: 'Rejected' }, + advisory: { label: 'Advisory: suggested by an LLM or the MCP client, awaiting a person; not a verdict input', short: 'Advisory' }, + retired: { label: 'Retired: the refreshed FDA summary no longer cites it; kept for the record', short: 'Retired' }, } -/** One of confirmed | extracted | disputed | conditional | rejected, with the reasons behind it. */ +/** One of confirmed | extracted | disputed | conditional | rejected | advisory | retired, with the reasons behind it. + Mirrors graph.LINEAGE_EDGE / ADVISORY_EDGE: the backend's advisory / trust / retired_at fields win when present. */ export function edgeStatus(h) { - if (h?.review === 'rejected') return { key: 'rejected', reasons: [] } + if (h?.retired_at || h?.trust === 'retired') return { key: 'retired', reasons: [] } + if (h?.review === 'rejected' && humanReview(h)) return { key: 'rejected', reasons: [] } + if (h?.advisory || h?.trust === 'advisory') return { key: 'advisory', reasons: [] } const reasons = doubt(h) if (reasons.includes('audit_unresolved')) return { key: 'conditional', reasons } if (reasons.length) return { key: 'disputed', reasons } - if (h?.review === 'confirmed') return { key: 'confirmed', reasons } + if (h?.review === 'confirmed' && humanReview(h)) return { key: 'confirmed', reasons } return { key: 'extracted', reasons } } @@ -179,6 +189,8 @@ export const EVIDENCE_REASON_TEXT = { recall_cause_or_class_unknown: 'a recall has no stated cause or FDA class', unattributed_recalls_in_product_code: 'design-related recalls in the product code name no 510(k)', shallow_traversal: 'grand-predicates were not traversed', + advisory_links_pending_review: 'predicate links suggested only by an LLM or the MCP client await a person', + human_confirmed_citation_retired: 'a citation a person confirmed is no longer in the refreshed FDA summary', } /** Mirror of lineage.recall_attribution(). Every link is FDA's own listing of the K-number on the recall record: an diff --git a/web/src/styles.css b/web/src/styles.css index 7805350..d1bd7c1 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -134,6 +134,10 @@ select.field { padding: 6px 10px; width: auto; } .status-conditional .line { border-top-style: dotted; border-top-width: 3px; } .status-rejected { color: var(--ink-4); } .status-rejected .line { border-top-style: dashed; opacity: .6; } +.status-advisory { color: var(--violet); } +.status-advisory .line { border-top-style: dotted; opacity: .7; } +.status-retired { color: var(--ink-4); } +.status-retired .line { border-top-style: dotted; opacity: .4; } /* ================================================================== INTRO (≈3 s, once per session) */ .intro { diff --git a/web/src/workspace/Investigation.jsx b/web/src/workspace/Investigation.jsx index a50e7b7..f33a85a 100644 --- a/web/src/workspace/Investigation.jsx +++ b/web/src/workspace/Investigation.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useMemo, useState } from 'react' import { api, pmnUrl, reportUrl } from '../api.js' import { - EDGE_STATUS, EVIDENCE_REASON_TEXT, VERDICTS, countEvents, verdictView, edgeStatus, fmtDate, nodeTone, recallTiming, recallTimingText, shortName, year, + EDGE_STATUS, EVIDENCE_REASON_TEXT, VERDICTS, humanReview, countEvents, verdictView, edgeStatus, fmtDate, nodeTone, recallTiming, recallTimingText, shortName, year, } from '../evidence.js' import EvidenceGraph from './EvidenceGraph.jsx' import Timeline from './Timeline.jsx' @@ -292,6 +292,9 @@ function Signal({ s, onSelect }) { ) } +// a person's own review (an automated client's review is advisory and never shows as one) +const mine = (c, status) => c.review === status && humanReview(c) + function Citations({ a, reload, go, onSelect }) { const [busy, setBusy] = useState(null) const [msg, setMsg] = useState(null) @@ -299,7 +302,7 @@ function Citations({ a, reload, go, onSelect }) { setBusy(c.dst + label); setMsg(null) try { const r = await fn() - setMsg(label === 'ai' ? { ok: true, text: `LLM labelled ${c.dst} "${r.ai_label}" (${r.model.split('/')[1]}, ${r.seconds}s). Optional triage; a person's review overrides it.` } : null) + setMsg(label === 'ai' ? { ok: true, text: `LLM labelled ${c.dst} "${r.ai_label}" (${r.model.split('/')[1]}, ${r.seconds}s). Advisory only: it is not used for the verdict until a person confirms the citation.` } : null) reload() } catch (e) { setMsg({ ok: false, text: e.message }) } finally { setBusy(null) } } @@ -314,24 +317,25 @@ function Citations({ a, reload, go, onSelect }) { {msg &&

{msg.text}

} {a.citations.map((c) => { const hop = { ...c, src: a.k } - const inLineage = c.kind === 'predicate' || c.ai_label === 'predicate' + const inLineage = c.in_lineage ?? (c.kind === 'predicate') + const st = edgeStatus(hop) return ( -
+
{c.kind} - {inLineage - ? {EDGE_STATUS[edgeStatus(hop).key].short} - : Not a lineage link} + {inLineage || st.key === 'advisory' || st.key === 'retired' + ? {EDGE_STATUS[st.key].short} + : Not a lineage link} {c.ai_label && LLM: {c.ai_label}} {shortName(c.name, 34)} · {year(c.dst_decision_date)}
- - + + {c.kind !== 'predicate' && } diff --git a/web/src/workspace/Provenance.jsx b/web/src/workspace/Provenance.jsx index 5803286..6080a2e 100644 --- a/web/src/workspace/Provenance.jsx +++ b/web/src/workspace/Provenance.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef, useState } from 'react' import { api, pmnUrl } from '../api.js' import { - ATTRIBUTION, DOUBT_TEXT, PREDATES_CLEARANCE, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, pdfAt, recallAttribution, recallTone, shortName, + ATTRIBUTION, DOUBT_TEXT, MACHINE_REVIEWERS, PREDATES_CLEARANCE, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, humanReview, pdfAt, recallAttribution, recallTone, shortName, } from '../evidence.js' /* Highlight the cited K-number inside the verbatim quote. */ @@ -150,18 +150,20 @@ function EdgeBody({ sel, a, closeBtn, onClose, go, reload, onSelect }) {
Name check
{h.name_check || '—'}
FDA panel
{h.panel_check || '—'}
{h.audit && <>
Audit
{h.audit}{h.audit_note ? ` — ${h.audit_note}` : ''}
} - {h.ai_label && <>
LLM label
{h.ai_label} (optional triage; never a verdict input on its own)
} -
Review
{h.review ? `${h.review} by ${h.reviewer || 'unknown'}` : 'not reviewed by a person'}
+ {h.ai_label && <>
LLM label
{h.ai_label}{h.ai_model ? ` · ${h.ai_model}` : ''} (advisory; never a verdict input until a person confirms)
} +
Review
{h.review ? `${h.review} by ${h.reviewer || 'unknown'}${MACHINE_REVIEWERS.includes(h.reviewer) ? ' (automated client; advisory)' : ''}` : 'not reviewed by a person'}
+
Trust
{EDGE_STATUS[edgeStatus(h).key].label}
+ {h.retired_at && <>
Retired
{fmtDate(h.retired_at)} · no longer cited by the refreshed summary
} {src.summary_sha256 && <>
PDF SHA-256
{src.summary_sha256}
}

Your review

- - + +

A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately.

diff --git a/web/src/workspace/Review.jsx b/web/src/workspace/Review.jsx index 9a04cf4..c3b9c73 100644 --- a/web/src/workspace/Review.jsx +++ b/web/src/workspace/Review.jsx @@ -51,6 +51,20 @@ export function reviewItems(a) { todo: 'Open each thread, compare the quote with the cited device, then confirm or reject it.', hops: s.evidence.filter((e) => e.type === 'citation') }) break + case 'ADVISORY_LINK_PENDING_REVIEW': + items.push({ id: s.code, tone: 'violet', sev: 'info', title: s.title, + what: 'An LLM label or the automated MCP client calls these citations predicates; no person has decided.', + why: 'They are not used for the verdict. If one is a real predicate, its recalls belong in the lineage and the verdict could change.', + todo: 'Open each link, read the PDF page, and confirm or reject it yourself.', + hops: s.evidence.filter((e) => e.type === 'advisory_citation') }) + break + case 'CITATION_RETIRED_BY_REINGEST': + items.push({ id: s.code, tone: 'muted', sev: 'info', title: s.title, + what: "Re-reading the citing device's FDA summary no longer found these citations, so they were retired from the lineage.", + why: 'Earlier reviews, labels and provenance are kept for the record; a review made on the old text may no longer apply.', + todo: 'Compare the refreshed summary with the earlier one and record a new review if the citation still matters.', + hops: s.evidence }) + break case 'PREDICATE_CITATION_UNRESOLVED': items.push({ id: s.code, tone: 'muted', sev: 'info', title: s.title, what: 'Predicate citations printed in a summary did not become lineage threads.', diff --git a/web/src/workspace/Views.jsx b/web/src/workspace/Views.jsx index f7684ba..d9d9c1d 100644 --- a/web/src/workspace/Views.jsx +++ b/web/src/workspace/Views.jsx @@ -272,6 +272,11 @@ export function IngestView({ initial, go, onChanged }) { res.citations_added.map((c) => (
{c.dst} {c.kind} p.{c.page}
“{c.snippet}”
))} + {res.reconciliation?.retired?.length > 0 && <> +

Citations no longer in the refreshed summary

+

Retired from the lineage, kept with their reviews and provenance:{' '} + {res.reconciliation.retired.map((c) => `${c.dst}${c.review ? ` (${c.review} by ${c.reviewer || 'unknown'})` : ''}`).join(', ')}.

} + {res.reconciliation && !res.reconciliation.ran &&

{res.reconciliation.skipped_reason}.

}

{res.recalls_linked.length} recall record(s) linked.

From f96cdf4b9a19130552d391f50b1f49d1bff12d64 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:54:19 +0100 Subject: [PATCH 04/10] build: rebuild web/dist for advisory and retired citation status --- ...istory-o7tife4Q.js => History-DLMWLVIE.js} | 2 +- ...anding-Do6WwSBM.js => Landing-DUH1bgY7.js} | 2 +- web/dist/assets/Views-BGuMRYVR.js | 1 - web/dist/assets/Views-CntGI8oq.js | 1 + web/dist/assets/index-58YBiS_r.js | 44 ------------------- web/dist/assets/index-BEiDIW2F.js | 44 +++++++++++++++++++ web/dist/assets/index-CVW0ffI2.css | 1 + web/dist/assets/index-uNtQWBQX.css | 1 - web/dist/index.html | 4 +- 9 files changed, 50 insertions(+), 50 deletions(-) rename web/dist/assets/{History-o7tife4Q.js => History-DLMWLVIE.js} (98%) rename web/dist/assets/{Landing-Do6WwSBM.js => Landing-DUH1bgY7.js} (99%) delete mode 100644 web/dist/assets/Views-BGuMRYVR.js create mode 100644 web/dist/assets/Views-CntGI8oq.js delete mode 100644 web/dist/assets/index-58YBiS_r.js create mode 100644 web/dist/assets/index-BEiDIW2F.js create mode 100644 web/dist/assets/index-CVW0ffI2.css delete mode 100644 web/dist/assets/index-uNtQWBQX.css diff --git a/web/dist/assets/History-o7tife4Q.js b/web/dist/assets/History-DLMWLVIE.js similarity index 98% rename from web/dist/assets/History-o7tife4Q.js rename to web/dist/assets/History-DLMWLVIE.js index 2ff8d88..33dc68a 100644 --- a/web/dist/assets/History-o7tife4Q.js +++ b/web/dist/assets/History-DLMWLVIE.js @@ -1 +1 @@ -import{r as i,j as e,V as p,d as b,c as j}from"./index-58YBiS_r.js";function y({go:a}){const[n,d]=i.useState(null),[t,r]=i.useState(null),[l,h]=i.useState(null),[o,x]=i.useState(null),c=()=>{j.assessments().then(d).catch(s=>x(s.message)),j.investigations(null,50).then(r).catch(()=>r([])),j.proposals("pending_human_decision").then(h).catch(()=>h([]))};return i.useEffect(c,[]),e.jsxs("div",{children:[e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:"Graph"}),e.jsx("h1",{children:"Investigation history"}),e.jsx("p",{children:"Saved assessments and their staleness against today's graph, then optional agent runs and the proposals they left for a person."})]}),o&&e.jsx("p",{className:"err",children:o}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Saved assessments ",e.jsx("span",{className:"count",children:(n==null?void 0:n.length)??"…"})]}),e.jsx("p",{className:"hint",children:"Stale means a citation in the ancestry was reviewed or re-ingested after saving."})]}),n&&n.length===0&&e.jsx("p",{className:"muted",children:"None yet. Save one from any investigation."}),n&&n.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Assessment"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Saved verdict"}),e.jsx("th",{children:"Now"}),e.jsx("th",{children:"Saved"})]})}),e.jsx("tbody",{children:n.map(s=>{var m,u,N,g;return e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>a("check",s.k),onKeyDown:v=>v.key==="Enter"&&a("check",s.k),children:[e.jsx("td",{className:"mono",children:s.id}),e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name})]}),e.jsx("td",{children:e.jsx("span",{className:`chip tone-${((m=p[s.verdict])==null?void 0:m.tone)||"muted"}`,children:((u=p[s.verdict])==null?void 0:u.label)||s.verdict})}),e.jsx("td",{children:s.stale?e.jsxs("span",{className:"stale",children:["Stale",s.verdict_now!==s.verdict?` · now ${((N=p[s.verdict_now])==null?void 0:N.label)||s.verdict_now}`:""]}):e.jsx("span",{className:"ok",children:"Current"})}),e.jsx("td",{className:"sub num",children:(g=s.created_at)==null?void 0:g.slice(0,16).replace("T"," ")})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Agent runs (optional) ",e.jsx("span",{className:"count",children:(t==null?void 0:t.length)??"…"})]})}),e.jsx("p",{className:"lede",children:"Machine findings, verified against tool results but never human-approved. Deterministic assessments remain the authoritative record."}),t&&t.length===0&&e.jsx("p",{className:"muted",children:"No agent runs in this store. They can be started from the command line or the API (see README)."}),t&&t.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Run"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Mode"}),e.jsx("th",{children:"Pending proposals"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.map(s=>{var m;return e.jsxs("tr",{children:[e.jsxs("td",{className:"mono",children:[s.id,e.jsx("div",{className:"sub",children:(m=s.created_at)==null?void 0:m.slice(0,16).replace("T"," ")})]}),e.jsx("td",{children:e.jsx("a",{href:`#/check/${s.target_k}`,className:"k mono",children:s.target_k})}),e.jsxs("td",{children:[e.jsx("span",{className:"chip",children:s.status}),s.stale&&e.jsx("span",{className:"stale",children:" · stale"})]}),e.jsxs("td",{className:"sub",children:[s.mode,s.model_used?` · ${s.model_used}`:""]}),e.jsx("td",{className:"num",children:s.pending_proposals}),e.jsx("td",{children:e.jsx("a",{href:b(s.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Proposals awaiting a person ",e.jsx("span",{className:"count",children:(l==null?void 0:l.length)??"…"})]})}),l&&l.length===0&&e.jsx("p",{className:"muted",children:"None pending."}),l&&l.map(s=>e.jsx(k,{p:s,onDone:c},s.id))]})]})}function k({p:a,onDone:n}){const[d,t]=i.useState(""),[r,l]=i.useState(!1),[h,o]=i.useState(null),x=async c=>{try{await j.decide(a.id,c,d.trim()),o({ok:!0,text:`Recorded: ${c}.`}),n()}catch(s){o({ok:!1,text:s.message})}};return e.jsxs("div",{className:"review-item tone-muted",children:[e.jsxs("h3",{children:[e.jsx("span",{className:"sev sev-info",children:a.kind}),e.jsx("span",{className:"mono",children:a.id}),e.jsx("span",{children:a.k||`${a.src} → ${a.dst}`})]}),a.reason&&e.jsx("p",{className:"muted small",style:{margin:"0 0 8px"},children:a.reason}),e.jsxs("div",{className:"cit-a",children:[e.jsx("input",{className:"field",style:{maxWidth:220},placeholder:"Your name",value:d,onChange:c=>t(c.target.value),"aria-label":"Your name"}),e.jsxs("label",{className:"small",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:c=>l(c.target.checked)})," I am a person deciding this"]}),e.jsx("button",{className:"btn btn-line btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("approve"),children:"Approve"}),e.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("dismiss"),children:"Dismiss"})]}),h&&e.jsx("p",{className:h.ok?"ok":"err",children:h.text})]})}export{y as default}; +import{r as i,j as e,V as p,d as b,c as j}from"./index-BEiDIW2F.js";function y({go:a}){const[n,d]=i.useState(null),[t,r]=i.useState(null),[l,h]=i.useState(null),[o,x]=i.useState(null),c=()=>{j.assessments().then(d).catch(s=>x(s.message)),j.investigations(null,50).then(r).catch(()=>r([])),j.proposals("pending_human_decision").then(h).catch(()=>h([]))};return i.useEffect(c,[]),e.jsxs("div",{children:[e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:"Graph"}),e.jsx("h1",{children:"Investigation history"}),e.jsx("p",{children:"Saved assessments and their staleness against today's graph, then optional agent runs and the proposals they left for a person."})]}),o&&e.jsx("p",{className:"err",children:o}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Saved assessments ",e.jsx("span",{className:"count",children:(n==null?void 0:n.length)??"…"})]}),e.jsx("p",{className:"hint",children:"Stale means a citation in the ancestry was reviewed or re-ingested after saving."})]}),n&&n.length===0&&e.jsx("p",{className:"muted",children:"None yet. Save one from any investigation."}),n&&n.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Assessment"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Saved verdict"}),e.jsx("th",{children:"Now"}),e.jsx("th",{children:"Saved"})]})}),e.jsx("tbody",{children:n.map(s=>{var m,u,N,g;return e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>a("check",s.k),onKeyDown:v=>v.key==="Enter"&&a("check",s.k),children:[e.jsx("td",{className:"mono",children:s.id}),e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name})]}),e.jsx("td",{children:e.jsx("span",{className:`chip tone-${((m=p[s.verdict])==null?void 0:m.tone)||"muted"}`,children:((u=p[s.verdict])==null?void 0:u.label)||s.verdict})}),e.jsx("td",{children:s.stale?e.jsxs("span",{className:"stale",children:["Stale",s.verdict_now!==s.verdict?` · now ${((N=p[s.verdict_now])==null?void 0:N.label)||s.verdict_now}`:""]}):e.jsx("span",{className:"ok",children:"Current"})}),e.jsx("td",{className:"sub num",children:(g=s.created_at)==null?void 0:g.slice(0,16).replace("T"," ")})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Agent runs (optional) ",e.jsx("span",{className:"count",children:(t==null?void 0:t.length)??"…"})]})}),e.jsx("p",{className:"lede",children:"Machine findings, verified against tool results but never human-approved. Deterministic assessments remain the authoritative record."}),t&&t.length===0&&e.jsx("p",{className:"muted",children:"No agent runs in this store. They can be started from the command line or the API (see README)."}),t&&t.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Run"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Mode"}),e.jsx("th",{children:"Pending proposals"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.map(s=>{var m;return e.jsxs("tr",{children:[e.jsxs("td",{className:"mono",children:[s.id,e.jsx("div",{className:"sub",children:(m=s.created_at)==null?void 0:m.slice(0,16).replace("T"," ")})]}),e.jsx("td",{children:e.jsx("a",{href:`#/check/${s.target_k}`,className:"k mono",children:s.target_k})}),e.jsxs("td",{children:[e.jsx("span",{className:"chip",children:s.status}),s.stale&&e.jsx("span",{className:"stale",children:" · stale"})]}),e.jsxs("td",{className:"sub",children:[s.mode,s.model_used?` · ${s.model_used}`:""]}),e.jsx("td",{className:"num",children:s.pending_proposals}),e.jsx("td",{children:e.jsx("a",{href:b(s.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Proposals awaiting a person ",e.jsx("span",{className:"count",children:(l==null?void 0:l.length)??"…"})]})}),l&&l.length===0&&e.jsx("p",{className:"muted",children:"None pending."}),l&&l.map(s=>e.jsx(k,{p:s,onDone:c},s.id))]})]})}function k({p:a,onDone:n}){const[d,t]=i.useState(""),[r,l]=i.useState(!1),[h,o]=i.useState(null),x=async c=>{try{await j.decide(a.id,c,d.trim()),o({ok:!0,text:`Recorded: ${c}.`}),n()}catch(s){o({ok:!1,text:s.message})}};return e.jsxs("div",{className:"review-item tone-muted",children:[e.jsxs("h3",{children:[e.jsx("span",{className:"sev sev-info",children:a.kind}),e.jsx("span",{className:"mono",children:a.id}),e.jsx("span",{children:a.k||`${a.src} → ${a.dst}`})]}),a.reason&&e.jsx("p",{className:"muted small",style:{margin:"0 0 8px"},children:a.reason}),e.jsxs("div",{className:"cit-a",children:[e.jsx("input",{className:"field",style:{maxWidth:220},placeholder:"Your name",value:d,onChange:c=>t(c.target.value),"aria-label":"Your name"}),e.jsxs("label",{className:"small",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:c=>l(c.target.checked)})," I am a person deciding this"]}),e.jsx("button",{className:"btn btn-line btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("approve"),children:"Approve"}),e.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("dismiss"),children:"Dismiss"})]}),h&&e.jsx("p",{className:h.ok?"ok":"err",children:h.text})]})}export{y as default}; diff --git a/web/dist/assets/Landing-Do6WwSBM.js b/web/dist/assets/Landing-DUH1bgY7.js similarity index 99% rename from web/dist/assets/Landing-Do6WwSBM.js rename to web/dist/assets/Landing-DUH1bgY7.js index 1b1b8f1..8168477 100644 --- a/web/dist/assets/Landing-Do6WwSBM.js +++ b/web/dist/assets/Landing-DUH1bgY7.js @@ -1 +1 @@ -import{r as h,m as $,j as e,W as M,f as k,p as q,R as L,M as B,_ as K}from"./index-58YBiS_r.js";import{u as se}from"./index-58YBiS_r.js";const T="Every claim the opening film makes. tests/test_story_facts.py checks each value against the shipped Relate store.",O={k:"K252078",name:"BreathePal Bilevel",applicant:"Compal Electronics, Inc.",decision_date:"2026-03-17",summary_url:"https://www.accessdata.fda.gov/cdrh_docs/pdf25/K252078.pdf",verdict:"REVIEW_LINEAGE"},W={src:"K252078",dst:"K113053",page:6,quote:"substantially equivalent to the legally marketed predicate device, BiPAP A30 Ventilatory support system (K113053)."},V={k:"K113053",name:"BiPAP A30 Ventilatory Support System",applicant:"Respironics, Inc.",decision_date:"2012-02-01"},z={holder:"K113053",event:"88071",ids:["Z-1957-2021","Z-1958-2021"],classification:"Class I",root_cause:"Device Design",initiated:"2021-06-14",reason:"The polyester-based polyurethane (PE-PUR) foam may degrade into particles"},Z=[{k:"K092818",name:"BiPAP AVAPS",decision_date:"2010-01-22"},{k:"K082660",name:"V60 Ventilator",decision_date:"2009-01-09"},{k:"K103167",name:"Stellar 150",decision_date:"2011-03-01"}],g={_note:T,candidate:O,citation:W,predicate:V,recall:z,grand_predicates:Z},E=(()=>{let s=0;const a=new Set;return{set(t){t!==s&&(s=t,a.forEach(n=>n()))},get:()=>s,subscribe(t){return a.add(t),()=>a.delete(t)}}})(),D=()=>h.useSyncExternalStore(E.subscribe,E.get);function P(){const s=h.useRef(null);return h.useEffect(()=>{const a=s.current;if(!a||typeof IntersectionObserver>"u"){a==null||a.classList.add("in-frame");return}const t=new IntersectionObserver(([n])=>a.classList.toggle("in-frame",n.isIntersecting),{rootMargin:"-12% 0px -12% 0px"});return t.observe(a),()=>t.disconnect()},[]),s}function F(){const s=innerHeight;return[...document.querySelectorAll("[data-scene]")].map(a=>{const t=a.getBoundingClientRect(),n=t.top+scrollY,c=innerWidth<=860,l=a.dataset.align==="top"?0:c&&a.classList.contains("chapter-copy")?n-s*.55:n+t.height/2-s*.5;return[Math.max(0,l),Number(a.dataset.scene)]}).sort((a,t)=>a[1]-t[1]).map((a,t,n)=>t&&a[0]<=n[t-1][0]?[n[t-1][0]+1,a[1]]:a)}function H(){try{return!!document.createElement("canvas").getContext("2d")}catch{return!1}}function I(){const s=innerWidth,a=innerHeight,t=48,n=Math.max(24,s*.03),c={},l=document.querySelector(".hero-copy");if(l){const r=l.getBoundingClientRect();c[0]=[Math.min(s*.62,r.right+t),a*.18,s-n-40,a*.82]}document.querySelectorAll(".chapter-copy[data-scene]").forEach(r=>{const m=r.getBoundingClientRect(),i=Number(r.dataset.scene),d=m.left+m.width/2{if(s||!H()){document.documentElement.dataset.film="off";return}let d=!1;const x=matchMedia("(max-width: 860px), (pointer: coarse)").matches,f=/[?&]gl=1\b/.test(location.search);return K(async()=>{const{createFilm:j}=await import("./renderer-DE7JEwcd.js");return{createFilm:j}},[]).then(({createFilm:j})=>{var y;if(!(d||!l.current))try{r.current=j(l.current,{glCanvas:o.current,facts:g,deviceCount:((y=t==null?void 0:t.nodes)==null?void 0:y.Device)||1187,compact:x,forceGL:f,onScene:n,onRenderer:p=>{i(p),c&&c(p)}}),r.current.setAnchors(F()),r.current.setZones(I()),r.current.snap(),delete document.documentElement.dataset.film,i(r.current.kind),c&&c(r.current.kind)}catch{document.documentElement.dataset.film="off"}}).catch(()=>{document.documentElement.dataset.film="off"}),()=>{var j;d=!0,(j=r.current)==null||j.dispose(),r.current=null}},[s]),h.useEffect(()=>{var y;if(!m)return;const d=()=>{var p,v;(p=r.current)==null||p.setAnchors(F()),(v=r.current)==null||v.setZones(I())},x=new ResizeObserver(()=>{var p;(p=r.current)==null||p.resize(),d()});x.observe(document.body),(y=document.fonts)==null||y.ready.then(d);const f=p=>{var v;return(v=r.current)==null?void 0:v.setPointer(p.clientX,p.clientY,!0)},j=()=>{var p;return(p=r.current)==null?void 0:p.setPointer(-9999,-9999,!1)};return addEventListener("pointermove",f,{passive:!0}),document.addEventListener("pointerleave",j),()=>{x.disconnect(),removeEventListener("pointermove",f),document.removeEventListener("pointerleave",j)}},[!!m]),h.useEffect(()=>{var d;m&&a==="bloom"&&((d=r.current)==null||d.bloom())},[!!m,a]),e.jsxs("div",{className:"film-stage","aria-hidden":"true",children:[e.jsx("div",{className:"film-fallback",children:e.jsxs("svg",{viewBox:"0 0 560 320",children:[e.jsx("path",{d:"M520 60 C 380 60, 380 160, 240 160",stroke:"#7fa2ff",strokeWidth:"1.6",fill:"none"}),e.jsx("path",{d:"M240 160 C 160 160, 160 80, 80 80 M240 160 C 160 160, 160 250, 70 250",stroke:"#7fa2ff",strokeOpacity:".4",fill:"none"}),e.jsx("path",{d:"M240 160 L 420 160",stroke:"#e7a948",strokeDasharray:"2 4"}),e.jsx("path",{d:"M420 152 l8 8 -8 8 -8 -8z",fill:"#e7a948"}),e.jsx("circle",{cx:"520",cy:"60",r:"9",fill:"#f1ebdd",stroke:"#7fa2ff",strokeWidth:"3"}),e.jsx("circle",{cx:"240",cy:"160",r:"7",fill:"#e7a948"}),e.jsx("circle",{cx:"80",cy:"80",r:"6",fill:"#e7a948"}),e.jsx("circle",{cx:"70",cy:"250",r:"6",fill:"#9aa7c2"})]})}),e.jsx("canvas",{ref:o,className:"film-gl"+(m==="webgl"?" is-live":"")}),e.jsx("div",{className:"film-grid"}),e.jsx("canvas",{ref:l,className:"film-story"+(m?" is-live":""),"data-testid":"film-canvas","data-renderer":m||"fallback"}),e.jsx("div",{className:"film-vignette"})]})}const C=[{n:"00",name:"The field",read:s=>`${s.k} · one point among the store's clearances`},{n:"01",name:"The filing",read:(s,a)=>`${s.k} · 510(k) summary · page ${a.page}`},{n:"02",name:"The connection",read:(s,a,t)=>`${s.k} → ${t.k} · ${s.decision_date.slice(0,4)} → ${t.decision_date.slice(0,4)}`},{n:"03",name:"The discovery",read:(s,a,t,n)=>`${t.k} · ${n.classification} · ${n.root_cause} · ${n.initiated}`},{n:"04",name:"The handoff",read:()=>"generation columns · same layout as the workspace"}];function G(){const s=D(),[a,t]=h.useState(!1);h.useEffect(()=>{const c=document.querySelector(".paths");if(!c||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([o])=>t(o.isIntersecting||o.boundingClientRect.top<0));return l.observe(c),()=>l.disconnect()},[]);const n=C[s]||C[0];return e.jsxs("div",{className:"film-hud"+(a?" is-away":""),"aria-hidden":"true",children:[e.jsxs("span",{className:"hud-n",children:["[",n.n," / 04]"]}),e.jsx("span",{className:"hud-name",children:n.name}),e.jsx("span",{className:"hud-read",children:n.read(g.candidate,g.citation,g.predicate,g.recall)})]})}function N({v:s}){const[a,t]=h.useState(0);return h.useEffect(()=>{if(s==null)return;if(matchMedia("(prefers-reduced-motion: reduce)").matches){t(s);return}let n,c;const l=o=>{c??(c=o);const r=Math.min(1,(o-c)/1100);t(Math.round(s*(1-Math.pow(1-r,3)))),r<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]),s==null?null:e.jsx("b",{children:a.toLocaleString("en-US")})}function U({reduced:s}){const a=D();return e.jsx("nav",{className:"film-index","aria-label":"Film chapters",children:X.map(([t,n],c)=>e.jsxs("a",{href:`#${t}`,className:a===c?"on":"","aria-current":a===c?"step":void 0,onClick:l=>{var o;l.preventDefault(),(o=document.getElementById(t==="top"?"top":`${t}-copy`))==null||o.scrollIntoView({block:"center",behavior:s?"auto":"smooth"})},children:[e.jsx("span",{children:n}),e.jsx("i",{})]},t))})}const _=({children:s})=>e.jsx("span",{className:"ln",children:e.jsx("span",{children:s})});function w({id:s,scene:a,mark:t,label:n,place:c,statement:l,children:o,foot:r}){const m=P();return e.jsx("article",{id:s,className:`chapter place-${c}`,"aria-labelledby":`${s}-title`,children:e.jsxs("div",{ref:m,className:"chapter-copy reveal","data-scene":a,id:`${s}-copy`,children:[e.jsxs("p",{className:"chapter-label",children:[e.jsxs("span",{children:[t," / 03"]}),n]}),e.jsx("h2",{className:"chapter-statement",id:`${s}-title`,children:l.map((i,d)=>e.jsxs(_,{children:[i," "]},d))}),o,r&&e.jsx("p",{className:"chapter-foot",children:r})]})})}const X=[["top","Opening"],["the-filing","The filing"],["the-connection","The connection"],["the-discovery","The discovery"],["handoff","Investigate"]];function Q({go:s,stats:a,introDone:t,reduced:n}){var A,S,R;const[c,l]=h.useState(!1),[o,r]=h.useState(null),m=P();h.useEffect(()=>{const u=()=>l(scrollY>40);return u(),addEventListener("scroll",u,{passive:!0}),()=>removeEventListener("scroll",u)},[]);const i=g.candidate,d=g.predicate,x=g.recall,f=g.citation,j=$(x.initiated,i.decision_date),y=Math.floor(j/12),p=j%12,v=f.quote.split(f.dst);return e.jsxs("div",{className:"film",id:"top",children:[e.jsx(Y,{reduced:n,introDone:t,stats:a,onScene:E.set,onKind:r}),o&&e.jsx(G,{}),e.jsxs("header",{className:"film-top"+(c?" is-solid":""),children:[e.jsx("a",{href:"#/","aria-label":"Forebear, start of film",onClick:u=>{u.preventDefault(),scrollTo({top:0})},children:e.jsx(M,{size:26})}),e.jsx("span",{className:"spacer"}),e.jsxs("nav",{"aria-label":"Product",children:[e.jsx("a",{href:"#/check",children:"Investigate"}),e.jsx("a",{href:"#/reach/88058,88071",children:"Recall reach"}),e.jsx("a",{href:"#/watch",children:"Watchlist"}),e.jsx("a",{href:"#/method",children:"Method"})]}),e.jsxs("a",{className:"btn btn-primary btn-sm",href:"#/check","data-testid":"open-workspace",children:["Open workspace ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]})]}),e.jsx(U,{reduced:n}),e.jsxs("main",{id:"main",children:[e.jsx("section",{className:"hero","data-scene":"0","data-align":"top","aria-labelledby":"hero-title",children:e.jsxs("div",{className:"hero-copy",children:[e.jsx("p",{className:"eyebrow",children:"510(k) predicate due diligence"}),e.jsxs("h1",{id:"hero-title",tabIndex:-1,style:{outline:"none"},children:["Every clearance has ",e.jsx("em",{children:"a past."})]}),e.jsxs("p",{className:"hero-lede",children:["Forebear reads the predicates out of FDA 510(k) summaries, stores the family tree in a ",e.jsx("b",{children:"Relate graph"})," joined to FDA recall records, and shows in one query whether a predicate, or any of its ancestors, was recalled for a design problem, as far back as their summaries can be read: ",e.jsx("b",{children:"with the page and quote behind every link."})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"hero-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Investigate ",i.k," ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsxs("a",{className:"btn btn-line",href:"#the-filing-copy",onClick:u=>{var b;u.preventDefault(),(b=document.getElementById("the-filing-copy"))==null||b.scrollIntoView({block:"center",behavior:n?"auto":"smooth"})},children:["Follow one thread ",e.jsx("span",{"aria-hidden":"true",children:"↓"})]})]}),a&&e.jsxs("div",{className:"hero-proof","aria-label":"What is in the shipped graph",children:[e.jsxs("div",{children:[e.jsx(N,{v:(A=a.nodes)==null?void 0:A.Device}),e.jsx("span",{children:"clearances in the graph"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(S=a.citations_by_kind)==null?void 0:S.predicate}),e.jsx("span",{children:"predicate links, each with a page"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(R=a.nodes)==null?void 0:R.Recall}),e.jsx("span",{children:"FDA recall records joined"})]})]})]})}),e.jsxs(w,{id:"the-filing",scene:1,mark:"01",label:"The filing",place:"left",statement:["One document","tells one step."],foot:"A 510(k) summary names its predicate. It does not tell you what became of it.",children:[e.jsxs("p",{className:"chapter-body",children:[i.name," (",e.jsx("span",{className:"k",children:i.k}),") was cleared on ",k(i.decision_date),". Its 510(k) summary names a single predicate, on page ",f.page,":"]}),e.jsxs("figure",{className:"doc","aria-label":`Quote from page ${f.page} of the ${i.k} summary`,children:[e.jsxs("div",{className:"doc-meta",children:[e.jsxs("span",{children:[i.k," · 510(k) summary"]}),e.jsxs("span",{children:["page ",f.page]})]}),e.jsxs("blockquote",{style:{margin:0},children:["“…",v[0],e.jsx("mark",{children:f.dst}),v[1],"”"]}),e.jsx("div",{style:{marginTop:10},children:e.jsxs("a",{href:q(i.summary_url,f.page),target:"_blank",rel:"noreferrer",children:["Open the FDA PDF at page ",f.page," ↗"]})})]})]}),e.jsx(w,{id:"the-connection",scene:2,mark:"02",label:"The connection",place:"right",statement:["Follow the thread","back in time."],foot:"Each thread is an edge in the graph, stored with its page, quote and source PDF.",children:e.jsxs("p",{className:"chapter-body",children:[e.jsx("span",{className:"k",children:i.k})," → ",e.jsx("span",{className:"k",children:d.k}),": the ",e.jsx("b",{children:d.name}),", cleared to ",d.applicant," on ",k(d.decision_date),". And ",d.k," cites predicates of its own: ",g.grand_predicates.map((u,b)=>e.jsxs(L.Fragment,{children:[b?b===g.grand_predicates.length-1?" and ":", ":"",e.jsx("span",{className:"k",children:u.k})]},u.k)),". FDA's databases answer one hop at a time. Relate walks them all in one variable-length query."]})}),e.jsxs(w,{id:"the-discovery",scene:3,mark:"03",label:"The discovery",place:"left",statement:["FDA recalls name",e.jsx("em",{children:"the predicate."},"e")],foot:"A recall on a predicate is not a finding about the new device. It is a question the predicate rationale should answer.",children:[e.jsxs("p",{className:"chapter-body",children:["On ",k(x.initiated)," a ",e.jsx("b",{children:x.classification})," recall of the BiPAP A30 began, root cause ",e.jsx("b",{children:x.root_cause}),": “",x.reason,"…” (event ",x.event,", records ",x.ids.join(" and "),")."]}),e.jsxs("div",{className:"fact-row",children:[e.jsxs("div",{className:"fact amber",children:[e.jsxs("b",{children:[y," yr ",p," mo"]}),e.jsxs("span",{children:["between recall start and ",i.k,"'s clearance"]})]}),e.jsxs("div",{className:"fact",children:[e.jsx("b",{children:"Review lineage"}),e.jsxs("span",{children:["deterministic verdict for ",i.k]})]})]}),e.jsx("p",{className:"chapter-body",style:{fontSize:14},children:"FDA's 2023 draft guidance recommends predicates not subject to design-related recalls."})]}),e.jsx("section",{id:"handoff",className:"handoff","aria-labelledby":"handoff-title",children:e.jsxs("div",{ref:m,className:"reveal","data-scene":"4",id:"handoff-copy",children:[e.jsxs("p",{className:"lead",id:"handoff-title",children:[e.jsx(_,{children:"Every fact above is real evidence."}),e.jsx(_,{children:e.jsx("em",{children:"Now work with it."})})]}),e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"handoff-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Open the investigation ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsx("p",{className:"sub",children:"Every node, date and quote above is read from the shipped Relate store; the background field is illustrative."})]})}),e.jsxs("section",{className:"paths","aria-labelledby":"paths-title",children:[e.jsx("h2",{id:"paths-title",children:"Or start somewhere else"}),e.jsxs("div",{className:"path-grid",children:[e.jsxs("a",{className:"path-card",href:"#/reach/88058,88071",children:[e.jsx("span",{className:"k",children:"Recall 88058 + 88071"}),e.jsx("h3",{children:"Recall reach"}),e.jsx("p",{children:"From the June 2021 Philips foam recall: which later clearances descend from it?"})]}),e.jsxs("a",{className:"path-card",href:"#/watch",children:[e.jsx("span",{className:"k",children:"Watchlist"}),e.jsx("h3",{children:"Cited after a recall"}),e.jsx("p",{children:"Clearances whose predicate was already under a design-related recall."})]}),e.jsxs("a",{className:"path-card",href:"#/compare/K200480 K113053 K233643 K143677",children:[e.jsx("span",{className:"k",children:"Compare"}),e.jsx("h3",{children:"Choose a predicate"}),e.jsx("p",{children:"Candidate predicates side by side, with their own and inherited recalls."})]}),e.jsxs("a",{className:"path-card",href:"#/check/K251770",children:[e.jsx("span",{className:"k",children:"K251770"}),e.jsx("h3",{children:"SleepRes PAP System"}),e.jsx("p",{children:"Another 2025 clearance, another lineage."})]})]})]})]}),e.jsxs("footer",{className:"film-foot",children:[e.jsx("p",{children:"Public FDA data: openFDA 510(k), recall and enforcement records and 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."}),e.jsx(B,{size:18})]})]})}export{Q as default,se as useMedia}; +import{r as h,m as $,j as e,W as M,f as k,p as q,R as L,M as B,_ as K}from"./index-BEiDIW2F.js";import{u as se}from"./index-BEiDIW2F.js";const T="Every claim the opening film makes. tests/test_story_facts.py checks each value against the shipped Relate store.",O={k:"K252078",name:"BreathePal Bilevel",applicant:"Compal Electronics, Inc.",decision_date:"2026-03-17",summary_url:"https://www.accessdata.fda.gov/cdrh_docs/pdf25/K252078.pdf",verdict:"REVIEW_LINEAGE"},W={src:"K252078",dst:"K113053",page:6,quote:"substantially equivalent to the legally marketed predicate device, BiPAP A30 Ventilatory support system (K113053)."},V={k:"K113053",name:"BiPAP A30 Ventilatory Support System",applicant:"Respironics, Inc.",decision_date:"2012-02-01"},z={holder:"K113053",event:"88071",ids:["Z-1957-2021","Z-1958-2021"],classification:"Class I",root_cause:"Device Design",initiated:"2021-06-14",reason:"The polyester-based polyurethane (PE-PUR) foam may degrade into particles"},Z=[{k:"K092818",name:"BiPAP AVAPS",decision_date:"2010-01-22"},{k:"K082660",name:"V60 Ventilator",decision_date:"2009-01-09"},{k:"K103167",name:"Stellar 150",decision_date:"2011-03-01"}],g={_note:T,candidate:O,citation:W,predicate:V,recall:z,grand_predicates:Z},E=(()=>{let s=0;const a=new Set;return{set(t){t!==s&&(s=t,a.forEach(n=>n()))},get:()=>s,subscribe(t){return a.add(t),()=>a.delete(t)}}})(),D=()=>h.useSyncExternalStore(E.subscribe,E.get);function P(){const s=h.useRef(null);return h.useEffect(()=>{const a=s.current;if(!a||typeof IntersectionObserver>"u"){a==null||a.classList.add("in-frame");return}const t=new IntersectionObserver(([n])=>a.classList.toggle("in-frame",n.isIntersecting),{rootMargin:"-12% 0px -12% 0px"});return t.observe(a),()=>t.disconnect()},[]),s}function F(){const s=innerHeight;return[...document.querySelectorAll("[data-scene]")].map(a=>{const t=a.getBoundingClientRect(),n=t.top+scrollY,c=innerWidth<=860,l=a.dataset.align==="top"?0:c&&a.classList.contains("chapter-copy")?n-s*.55:n+t.height/2-s*.5;return[Math.max(0,l),Number(a.dataset.scene)]}).sort((a,t)=>a[1]-t[1]).map((a,t,n)=>t&&a[0]<=n[t-1][0]?[n[t-1][0]+1,a[1]]:a)}function H(){try{return!!document.createElement("canvas").getContext("2d")}catch{return!1}}function I(){const s=innerWidth,a=innerHeight,t=48,n=Math.max(24,s*.03),c={},l=document.querySelector(".hero-copy");if(l){const r=l.getBoundingClientRect();c[0]=[Math.min(s*.62,r.right+t),a*.18,s-n-40,a*.82]}document.querySelectorAll(".chapter-copy[data-scene]").forEach(r=>{const m=r.getBoundingClientRect(),i=Number(r.dataset.scene),d=m.left+m.width/2{if(s||!H()){document.documentElement.dataset.film="off";return}let d=!1;const x=matchMedia("(max-width: 860px), (pointer: coarse)").matches,f=/[?&]gl=1\b/.test(location.search);return K(async()=>{const{createFilm:j}=await import("./renderer-DE7JEwcd.js");return{createFilm:j}},[]).then(({createFilm:j})=>{var y;if(!(d||!l.current))try{r.current=j(l.current,{glCanvas:o.current,facts:g,deviceCount:((y=t==null?void 0:t.nodes)==null?void 0:y.Device)||1187,compact:x,forceGL:f,onScene:n,onRenderer:p=>{i(p),c&&c(p)}}),r.current.setAnchors(F()),r.current.setZones(I()),r.current.snap(),delete document.documentElement.dataset.film,i(r.current.kind),c&&c(r.current.kind)}catch{document.documentElement.dataset.film="off"}}).catch(()=>{document.documentElement.dataset.film="off"}),()=>{var j;d=!0,(j=r.current)==null||j.dispose(),r.current=null}},[s]),h.useEffect(()=>{var y;if(!m)return;const d=()=>{var p,v;(p=r.current)==null||p.setAnchors(F()),(v=r.current)==null||v.setZones(I())},x=new ResizeObserver(()=>{var p;(p=r.current)==null||p.resize(),d()});x.observe(document.body),(y=document.fonts)==null||y.ready.then(d);const f=p=>{var v;return(v=r.current)==null?void 0:v.setPointer(p.clientX,p.clientY,!0)},j=()=>{var p;return(p=r.current)==null?void 0:p.setPointer(-9999,-9999,!1)};return addEventListener("pointermove",f,{passive:!0}),document.addEventListener("pointerleave",j),()=>{x.disconnect(),removeEventListener("pointermove",f),document.removeEventListener("pointerleave",j)}},[!!m]),h.useEffect(()=>{var d;m&&a==="bloom"&&((d=r.current)==null||d.bloom())},[!!m,a]),e.jsxs("div",{className:"film-stage","aria-hidden":"true",children:[e.jsx("div",{className:"film-fallback",children:e.jsxs("svg",{viewBox:"0 0 560 320",children:[e.jsx("path",{d:"M520 60 C 380 60, 380 160, 240 160",stroke:"#7fa2ff",strokeWidth:"1.6",fill:"none"}),e.jsx("path",{d:"M240 160 C 160 160, 160 80, 80 80 M240 160 C 160 160, 160 250, 70 250",stroke:"#7fa2ff",strokeOpacity:".4",fill:"none"}),e.jsx("path",{d:"M240 160 L 420 160",stroke:"#e7a948",strokeDasharray:"2 4"}),e.jsx("path",{d:"M420 152 l8 8 -8 8 -8 -8z",fill:"#e7a948"}),e.jsx("circle",{cx:"520",cy:"60",r:"9",fill:"#f1ebdd",stroke:"#7fa2ff",strokeWidth:"3"}),e.jsx("circle",{cx:"240",cy:"160",r:"7",fill:"#e7a948"}),e.jsx("circle",{cx:"80",cy:"80",r:"6",fill:"#e7a948"}),e.jsx("circle",{cx:"70",cy:"250",r:"6",fill:"#9aa7c2"})]})}),e.jsx("canvas",{ref:o,className:"film-gl"+(m==="webgl"?" is-live":"")}),e.jsx("div",{className:"film-grid"}),e.jsx("canvas",{ref:l,className:"film-story"+(m?" is-live":""),"data-testid":"film-canvas","data-renderer":m||"fallback"}),e.jsx("div",{className:"film-vignette"})]})}const C=[{n:"00",name:"The field",read:s=>`${s.k} · one point among the store's clearances`},{n:"01",name:"The filing",read:(s,a)=>`${s.k} · 510(k) summary · page ${a.page}`},{n:"02",name:"The connection",read:(s,a,t)=>`${s.k} → ${t.k} · ${s.decision_date.slice(0,4)} → ${t.decision_date.slice(0,4)}`},{n:"03",name:"The discovery",read:(s,a,t,n)=>`${t.k} · ${n.classification} · ${n.root_cause} · ${n.initiated}`},{n:"04",name:"The handoff",read:()=>"generation columns · same layout as the workspace"}];function G(){const s=D(),[a,t]=h.useState(!1);h.useEffect(()=>{const c=document.querySelector(".paths");if(!c||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([o])=>t(o.isIntersecting||o.boundingClientRect.top<0));return l.observe(c),()=>l.disconnect()},[]);const n=C[s]||C[0];return e.jsxs("div",{className:"film-hud"+(a?" is-away":""),"aria-hidden":"true",children:[e.jsxs("span",{className:"hud-n",children:["[",n.n," / 04]"]}),e.jsx("span",{className:"hud-name",children:n.name}),e.jsx("span",{className:"hud-read",children:n.read(g.candidate,g.citation,g.predicate,g.recall)})]})}function N({v:s}){const[a,t]=h.useState(0);return h.useEffect(()=>{if(s==null)return;if(matchMedia("(prefers-reduced-motion: reduce)").matches){t(s);return}let n,c;const l=o=>{c??(c=o);const r=Math.min(1,(o-c)/1100);t(Math.round(s*(1-Math.pow(1-r,3)))),r<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]),s==null?null:e.jsx("b",{children:a.toLocaleString("en-US")})}function U({reduced:s}){const a=D();return e.jsx("nav",{className:"film-index","aria-label":"Film chapters",children:X.map(([t,n],c)=>e.jsxs("a",{href:`#${t}`,className:a===c?"on":"","aria-current":a===c?"step":void 0,onClick:l=>{var o;l.preventDefault(),(o=document.getElementById(t==="top"?"top":`${t}-copy`))==null||o.scrollIntoView({block:"center",behavior:s?"auto":"smooth"})},children:[e.jsx("span",{children:n}),e.jsx("i",{})]},t))})}const _=({children:s})=>e.jsx("span",{className:"ln",children:e.jsx("span",{children:s})});function w({id:s,scene:a,mark:t,label:n,place:c,statement:l,children:o,foot:r}){const m=P();return e.jsx("article",{id:s,className:`chapter place-${c}`,"aria-labelledby":`${s}-title`,children:e.jsxs("div",{ref:m,className:"chapter-copy reveal","data-scene":a,id:`${s}-copy`,children:[e.jsxs("p",{className:"chapter-label",children:[e.jsxs("span",{children:[t," / 03"]}),n]}),e.jsx("h2",{className:"chapter-statement",id:`${s}-title`,children:l.map((i,d)=>e.jsxs(_,{children:[i," "]},d))}),o,r&&e.jsx("p",{className:"chapter-foot",children:r})]})})}const X=[["top","Opening"],["the-filing","The filing"],["the-connection","The connection"],["the-discovery","The discovery"],["handoff","Investigate"]];function Q({go:s,stats:a,introDone:t,reduced:n}){var A,S,R;const[c,l]=h.useState(!1),[o,r]=h.useState(null),m=P();h.useEffect(()=>{const u=()=>l(scrollY>40);return u(),addEventListener("scroll",u,{passive:!0}),()=>removeEventListener("scroll",u)},[]);const i=g.candidate,d=g.predicate,x=g.recall,f=g.citation,j=$(x.initiated,i.decision_date),y=Math.floor(j/12),p=j%12,v=f.quote.split(f.dst);return e.jsxs("div",{className:"film",id:"top",children:[e.jsx(Y,{reduced:n,introDone:t,stats:a,onScene:E.set,onKind:r}),o&&e.jsx(G,{}),e.jsxs("header",{className:"film-top"+(c?" is-solid":""),children:[e.jsx("a",{href:"#/","aria-label":"Forebear, start of film",onClick:u=>{u.preventDefault(),scrollTo({top:0})},children:e.jsx(M,{size:26})}),e.jsx("span",{className:"spacer"}),e.jsxs("nav",{"aria-label":"Product",children:[e.jsx("a",{href:"#/check",children:"Investigate"}),e.jsx("a",{href:"#/reach/88058,88071",children:"Recall reach"}),e.jsx("a",{href:"#/watch",children:"Watchlist"}),e.jsx("a",{href:"#/method",children:"Method"})]}),e.jsxs("a",{className:"btn btn-primary btn-sm",href:"#/check","data-testid":"open-workspace",children:["Open workspace ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]})]}),e.jsx(U,{reduced:n}),e.jsxs("main",{id:"main",children:[e.jsx("section",{className:"hero","data-scene":"0","data-align":"top","aria-labelledby":"hero-title",children:e.jsxs("div",{className:"hero-copy",children:[e.jsx("p",{className:"eyebrow",children:"510(k) predicate due diligence"}),e.jsxs("h1",{id:"hero-title",tabIndex:-1,style:{outline:"none"},children:["Every clearance has ",e.jsx("em",{children:"a past."})]}),e.jsxs("p",{className:"hero-lede",children:["Forebear reads the predicates out of FDA 510(k) summaries, stores the family tree in a ",e.jsx("b",{children:"Relate graph"})," joined to FDA recall records, and shows in one query whether a predicate, or any of its ancestors, was recalled for a design problem, as far back as their summaries can be read: ",e.jsx("b",{children:"with the page and quote behind every link."})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"hero-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Investigate ",i.k," ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsxs("a",{className:"btn btn-line",href:"#the-filing-copy",onClick:u=>{var b;u.preventDefault(),(b=document.getElementById("the-filing-copy"))==null||b.scrollIntoView({block:"center",behavior:n?"auto":"smooth"})},children:["Follow one thread ",e.jsx("span",{"aria-hidden":"true",children:"↓"})]})]}),a&&e.jsxs("div",{className:"hero-proof","aria-label":"What is in the shipped graph",children:[e.jsxs("div",{children:[e.jsx(N,{v:(A=a.nodes)==null?void 0:A.Device}),e.jsx("span",{children:"clearances in the graph"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(S=a.citations_by_kind)==null?void 0:S.predicate}),e.jsx("span",{children:"predicate links, each with a page"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(R=a.nodes)==null?void 0:R.Recall}),e.jsx("span",{children:"FDA recall records joined"})]})]})]})}),e.jsxs(w,{id:"the-filing",scene:1,mark:"01",label:"The filing",place:"left",statement:["One document","tells one step."],foot:"A 510(k) summary names its predicate. It does not tell you what became of it.",children:[e.jsxs("p",{className:"chapter-body",children:[i.name," (",e.jsx("span",{className:"k",children:i.k}),") was cleared on ",k(i.decision_date),". Its 510(k) summary names a single predicate, on page ",f.page,":"]}),e.jsxs("figure",{className:"doc","aria-label":`Quote from page ${f.page} of the ${i.k} summary`,children:[e.jsxs("div",{className:"doc-meta",children:[e.jsxs("span",{children:[i.k," · 510(k) summary"]}),e.jsxs("span",{children:["page ",f.page]})]}),e.jsxs("blockquote",{style:{margin:0},children:["“…",v[0],e.jsx("mark",{children:f.dst}),v[1],"”"]}),e.jsx("div",{style:{marginTop:10},children:e.jsxs("a",{href:q(i.summary_url,f.page),target:"_blank",rel:"noreferrer",children:["Open the FDA PDF at page ",f.page," ↗"]})})]})]}),e.jsx(w,{id:"the-connection",scene:2,mark:"02",label:"The connection",place:"right",statement:["Follow the thread","back in time."],foot:"Each thread is an edge in the graph, stored with its page, quote and source PDF.",children:e.jsxs("p",{className:"chapter-body",children:[e.jsx("span",{className:"k",children:i.k})," → ",e.jsx("span",{className:"k",children:d.k}),": the ",e.jsx("b",{children:d.name}),", cleared to ",d.applicant," on ",k(d.decision_date),". And ",d.k," cites predicates of its own: ",g.grand_predicates.map((u,b)=>e.jsxs(L.Fragment,{children:[b?b===g.grand_predicates.length-1?" and ":", ":"",e.jsx("span",{className:"k",children:u.k})]},u.k)),". FDA's databases answer one hop at a time. Relate walks them all in one variable-length query."]})}),e.jsxs(w,{id:"the-discovery",scene:3,mark:"03",label:"The discovery",place:"left",statement:["FDA recalls name",e.jsx("em",{children:"the predicate."},"e")],foot:"A recall on a predicate is not a finding about the new device. It is a question the predicate rationale should answer.",children:[e.jsxs("p",{className:"chapter-body",children:["On ",k(x.initiated)," a ",e.jsx("b",{children:x.classification})," recall of the BiPAP A30 began, root cause ",e.jsx("b",{children:x.root_cause}),": “",x.reason,"…” (event ",x.event,", records ",x.ids.join(" and "),")."]}),e.jsxs("div",{className:"fact-row",children:[e.jsxs("div",{className:"fact amber",children:[e.jsxs("b",{children:[y," yr ",p," mo"]}),e.jsxs("span",{children:["between recall start and ",i.k,"'s clearance"]})]}),e.jsxs("div",{className:"fact",children:[e.jsx("b",{children:"Review lineage"}),e.jsxs("span",{children:["deterministic verdict for ",i.k]})]})]}),e.jsx("p",{className:"chapter-body",style:{fontSize:14},children:"FDA's 2023 draft guidance recommends predicates not subject to design-related recalls."})]}),e.jsx("section",{id:"handoff",className:"handoff","aria-labelledby":"handoff-title",children:e.jsxs("div",{ref:m,className:"reveal","data-scene":"4",id:"handoff-copy",children:[e.jsxs("p",{className:"lead",id:"handoff-title",children:[e.jsx(_,{children:"Every fact above is real evidence."}),e.jsx(_,{children:e.jsx("em",{children:"Now work with it."})})]}),e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"handoff-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Open the investigation ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsx("p",{className:"sub",children:"Every node, date and quote above is read from the shipped Relate store; the background field is illustrative."})]})}),e.jsxs("section",{className:"paths","aria-labelledby":"paths-title",children:[e.jsx("h2",{id:"paths-title",children:"Or start somewhere else"}),e.jsxs("div",{className:"path-grid",children:[e.jsxs("a",{className:"path-card",href:"#/reach/88058,88071",children:[e.jsx("span",{className:"k",children:"Recall 88058 + 88071"}),e.jsx("h3",{children:"Recall reach"}),e.jsx("p",{children:"From the June 2021 Philips foam recall: which later clearances descend from it?"})]}),e.jsxs("a",{className:"path-card",href:"#/watch",children:[e.jsx("span",{className:"k",children:"Watchlist"}),e.jsx("h3",{children:"Cited after a recall"}),e.jsx("p",{children:"Clearances whose predicate was already under a design-related recall."})]}),e.jsxs("a",{className:"path-card",href:"#/compare/K200480 K113053 K233643 K143677",children:[e.jsx("span",{className:"k",children:"Compare"}),e.jsx("h3",{children:"Choose a predicate"}),e.jsx("p",{children:"Candidate predicates side by side, with their own and inherited recalls."})]}),e.jsxs("a",{className:"path-card",href:"#/check/K251770",children:[e.jsx("span",{className:"k",children:"K251770"}),e.jsx("h3",{children:"SleepRes PAP System"}),e.jsx("p",{children:"Another 2025 clearance, another lineage."})]})]})]})]}),e.jsxs("footer",{className:"film-foot",children:[e.jsx("p",{children:"Public FDA data: openFDA 510(k), recall and enforcement records and 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."}),e.jsx(B,{size:18})]})]})}export{Q as default,se as useMedia}; diff --git a/web/dist/assets/Views-BGuMRYVR.js b/web/dist/assets/Views-BGuMRYVR.js deleted file mode 100644 index 2d18b50..0000000 --- a/web/dist/assets/Views-BGuMRYVR.js +++ /dev/null @@ -1 +0,0 @@ -import{r as h,j as e,v as D,f as v,E,a as A,A as f,b as N,P as y,c as w,T as _}from"./index-58YBiS_r.js";const b=({eyebrow:c,title:r,children:t})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:c}),e.jsx("h1",{children:r}),t&&e.jsx("p",{children:t})]}),k=c=>r=>{r.key==="Enter"&&c()};function F({initial:c,go:r}){const[t,o]=h.useState(c||"K200480 K113053 K233643 K143677"),[d,m]=h.useState(null),[p,l]=h.useState(null),[x,u]=h.useState(!1),s=(a=t)=>{const n=[...new Set(a.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!n.length){l("Enter one or more K-numbers");return}l(null),u(!0),w.compare(n).then(m).catch(i=>l(i.message)).finally(()=>u(!1))};return h.useEffect(()=>{s(c||t)},[c]),e.jsxs("div",{children:[e.jsx(b,{eyebrow:"Investigate",title:"Compare candidate predicates",children:"FDA's draft guidance suggests documenting how each candidate predicate meets the selection best practices. This table covers the recall practice: each candidate's own recalls and those in its ancestry, computed live from the graph."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:a=>{a.preventDefault(),s()},children:[e.jsx("input",{className:"field",value:t,onChange:a=>o(a.target.value),"aria-label":"K-numbers to compare (up to 8)"}),e.jsx("button",{className:"btn btn-primary",disabled:x,children:x?"Comparing…":"Compare"})]}),p&&e.jsx("p",{className:"err",children:p})]}),d&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidate"}),e.jsx("th",{children:"Cleared"}),e.jsx("th",{children:"Verdict"}),e.jsxs("th",{children:["Evidence",e.jsx("br",{}),"(verdict window)"]}),e.jsxs("th",{children:["Own recalls",e.jsx("br",{}),"(design)"]}),e.jsxs("th",{children:["Flagged ancestors",e.jsx("br",{}),"gen 1–2"]}),e.jsxs("th",{children:["Ancestors",e.jsx("br",{}),"(unread)"]}),e.jsx("th",{children:"Top signal"})]})}),e.jsx("tbody",{children:d.map(a=>{if(!a.found)return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:a.k})}),e.jsxs("td",{colSpan:7,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${a.k}`,children:"Read it from FDA →"})]})]},a.k);const n=D(a.verdict,a.evidence);return e.jsxs("tr",{className:"click",tabIndex:0,"data-k":a.k,"data-evidence":a.evidence,onClick:()=>r("check",a.k),onKeyDown:k(()=>r("check",a.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:a.k}),e.jsx("div",{className:"sub",children:a.name}),e.jsx("div",{className:"sub",children:a.applicant})]}),e.jsx("td",{className:"num",children:v(a.decision_date)}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${n.tone}`,"data-testid":"compare-verdict",children:n.label}),a.conditional&&e.jsx("div",{children:e.jsx("span",{className:"chip tone-violet",children:"conditional"})}),e.jsx("div",{className:"sub",style:{maxWidth:320},"data-testid":"compare-reason",children:a.verdict_reason})]}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${E[a.evidence]||"muted"}`,"data-testid":"compare-evidence",children:a.evidence}),(a.evidence_reasons||[]).map(i=>e.jsx("div",{className:"sub",children:A[i]||i},i))]}),e.jsxs("td",{className:"num",children:[a.own_recalls," ",e.jsxs("span",{className:"sub",children:["(",a.own_design_recalls,")"]})]}),e.jsx("td",{className:"num",children:a.flagged_ancestors_gen12}),e.jsxs("td",{className:"num",children:[a.ancestors," ",e.jsxs("span",{className:"sub",children:["(",a.lineage_unknown,")"]})]}),e.jsx("td",{className:"sub",style:{maxWidth:360},children:a.top_signal||"—"})]},a.k)})})]})}),e.jsx("p",{className:"graph-hint",children:"Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer. A verdict on partial or uncertain evidence is provisional: equal verdicts on unequal evidence are not equivalent."})]})]})}function T({initial:c,go:r}){const[t,o]=h.useState(c||"88058,88071"),[d,m]=h.useState(null),[p,l]=h.useState(null),x=(n=t)=>{l(null),m(null),w.recallEvent(n.replace(/\s/g,"")).then(m).catch(i=>l(i.message))};h.useEffect(()=>{o(c||"88058,88071"),x(c||"88058,88071")},[c]);const u=(d==null?void 0:d.descendants)||[],s=(d==null?void 0:d.counts)||{},a=[["after-supported","Cleared after the recall began · supported route",u.filter(n=>n.timing==="after"&&n.evidence==="supported"),'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.',!0],["after-conditional","Cleared after the recall began · conditional route only",u.filter(n=>n.timing==="after"&&n.evidence==="conditional"),"Every route to the recalled clearance runs through a citation the audit could not resolve.",!1],["same-day","Cleared the day the recall began",u.filter(n=>n.timing==="same_day"),"Same calendar day: the dates cannot order them, so these count as neither before nor after.",!1],["unknown","Timing unknown",u.filter(n=>n.timing==="unknown"),"A clearance date or recall start is missing.",!1],["before","Cleared before the recall began",u.filter(n=>n.timing==="before"),null,!0]];return e.jsxs("div",{children:[e.jsx(b,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance FDA lists on it, then every later clearance that cites one of them, up to three generations, and compares each clearance date with the recall start on its own supported route."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:n=>{n.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:t,onChange:n=>o(n.target.value),"aria-label":"Recall event numbers, comma-separated"}),e.jsx("button",{className:"btn btn-primary",children:"Trace"})]}),e.jsxs("p",{className:"muted small",style:{marginBottom:0},children:["Examples: ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("88058,88071"),x("88058,88071")},children:"88058,88071"})," Philips PE-PUR foam recall, June 2021 (openFDA files it as two events) ·"," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("84406"),x("84406")},children:"84406"})]}),p&&e.jsx("p",{className:"err",children:p})]}),!d&&!p&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"panel","data-testid":"reach-stats",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:d.recalled.length}),e.jsxs("span",{children:["clearances FDA lists on recall event(s) ",d.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:u.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber","data-testid":"reach-count-after",children:[e.jsx("b",{children:s.after_supported??0}),e.jsxs("span",{children:["cleared after the recall on a supported route began",d.initiated?` (earliest ${v(d.initiated)})`:""]})]}),e.jsxs("div",{className:"violet","data-testid":"reach-count-conditional",children:[e.jsx("b",{children:s.conditional??0}),e.jsxs("span",{children:["reached only through an unresolved citation (conditional)",s.after_conditional?`, ${s.after_conditional} of them cleared after`:""]})]}),(s.same_day>0||s.unknown>0)&&e.jsxs("div",{"data-testid":"reach-count-undetermined",children:[e.jsx("b",{children:(s.same_day||0)+(s.unknown||0)}),e.jsxs("span",{children:["timing not determinable (",s.same_day||0," same day, ",s.unknown||0," missing a date)"]})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:d.recalled.map(n=>e.jsxs("button",{className:"tag-btn",onClick:()=>r("check",n.k),"data-testid":"reach-holder",title:f[N(n)].text+(n.linked_before_clearance?" "+y.text:""),children:[e.jsx("span",{className:"k",children:n.k})," ",n.name," ",e.jsxs("span",{className:"muted",children:["· ",f[N(n)].short,n.linked_before_clearance?` · ${y.short.toLowerCase()}`:""]})]},n.k))}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association, not verified model identity: a name match is a fuzzy heuristic on the recall text, and a recall that began before a clearance does not by itself show whether that model was affected."})]}),e.jsx("section",{className:"panel",children:a.filter(([,,n,,i])=>i||n.length).map(([n,i,j,g],C)=>e.jsxs("div",{"data-testid":`reach-${n}`,children:[e.jsxs("div",{className:"panel-head",style:C?{marginTop:22}:void 0,children:[e.jsxs("h2",{children:[i," ",e.jsx("span",{className:"count",children:j.length})]}),g&&e.jsx("p",{className:"hint",children:g})]}),e.jsx(S,{rows:j,go:r})]},n))})]})]})}function S({rows:c,go:r}){return c.length?e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Applicant"}),e.jsx("th",{children:"Cleared"}),e.jsxs("th",{children:["Recall began",e.jsx("br",{}),"on its route"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:c.map(t=>{var p;const o=t.evidence==="conditional",d=!o&&((p=t.conditional_via)==null?void 0:p.length)>0,m=t.supported_gen??t.gen;return e.jsxs("tr",{className:"click"+(o?" is-conditional":""),tabIndex:0,"data-k":t.k,"data-timing":t.timing,"data-evidence":t.evidence,onClick:()=>r("check",t.k),onKeyDown:k(()=>r("check",t.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:t.k})," ",o&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),d&&e.jsx("span",{className:"chip tone-muted",title:"Some routes are supported, others rest on an unresolved citation",children:"mixed routes"}),e.jsx("div",{className:"sub",children:t.name})]}),e.jsx("td",{className:"sub",children:t.applicant}),e.jsx("td",{className:"num",children:v(t.decision_date)}),e.jsxs("td",{className:"num",children:[v(t.recall_started),e.jsx("div",{className:"sub",children:_[t.timing]}),d&&t.conditional_timing&&t.conditional_timing!==t.timing&&e.jsxs("div",{className:"sub",style:{color:"var(--violet)"},children:["Conditional route only: recall began ",v(t.conditional_recall_started),", ",_[t.conditional_timing]]})]}),e.jsx("td",{children:m===1?"direct predicate":`${m} generations`}),e.jsx("td",{className:"sub",children:t.via.map(l=>{var x,u;return e.jsxs("span",{style:(x=t.conditional_via)!=null&&x.includes(l)?{color:"var(--violet)"}:void 0,title:(u=t.conditional_via)!=null&&u.includes(l)?"Reached only through an unresolved citation":"Reached through a supported citation",children:[l," "]},l)})})]},t.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function I({go:c}){const[r,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{w.watchlist().then(t).catch(s=>d(s.message))},[]);const l=(r==null?void 0:r.rows)||[],x=l.filter(s=>m==="all"||m==="direct"&&s.supported_min_gen===1||m==="supported"&&!s.conditional||m==="conditional"&&s.conditional),u=(r==null?void 0:r.conditional)??l.filter(s=>s.conditional).length;return e.jsxs("div",{children:[e.jsx(b,{eyebrow:"Recall evidence",title:"Watchlist: cleared after a predicate recall began",children:"Clearances whose FDA decision date falls after a design-related recall had started on their predicate or grand-predicate. Only the clearance date is compared: it does not show when the predicate was chosen or cited, and the application's receipt date does not establish that either. Same-day dates are not counted as after. Close to, but not the same as, the JAMA study's measure (Class I predicate recalls, any cause). A question to ask, not a finding: the recall may have been fixed, or limited to lots or software versions."}),o&&e.jsx("p",{className:"err",children:o}),!r&&!o&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Querying the graph…"]}),r&&e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:r.count}),e.jsx("span",{children:"clearances decided after a recall began on their lineage"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:r.direct_supported??r.direct}),e.jsx("span",{children:"cite a directly recalled predicate through a supported citation"})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:u}),e.jsx("span",{children:"conditional: every route runs through an unresolved citation"})]})]}),e.jsx("div",{className:"seg",role:"group","aria-label":"Filter",style:{marginTop:14},children:[["all","All"],["direct","Direct predicate"],["supported","Supported routes"],["conditional","Conditional only"]].map(([s,a])=>e.jsx("button",{"aria-pressed":m===s,onClick:()=>p(s),children:a},s))})]}),r&&e.jsx("section",{className:"panel",children:e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Cleared device"}),e.jsx("th",{children:"Cleared · recall began"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(s=>e.jsxs("tr",{className:"click"+(s.conditional?" is-conditional":""),tabIndex:0,"data-k":s.k,onClick:()=>c("check",s.k),onKeyDown:k(()=>c("check",s.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k})," ",s.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:s.name}),e.jsx("div",{className:"sub",children:s.applicant})]}),e.jsxs("td",{className:"num","data-testid":"watch-dates",children:["Cleared ",v(s.decision_date),e.jsxs("div",{className:"sub",children:["recall began ",v(s.recall_basis),s.days_after_recall!=null?`, ${s.days_after_recall} days earlier`:""]})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:(s.conditional?s.ancestors:s.supported_ancestors||s.ancestors).join(", ")}),e.jsx("div",{className:"sub",children:s.conditional?"cited device · citation unresolved":s.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[s.recall_count>2&&e.jsxs("div",{className:"muted",children:[s.recall_count," recall routes; first two:"]}),s.recalls.slice(0,2).map(a=>e.jsxs("div",{children:[a.recall_id," · ",a.classification||"unclassified"," · ",a.root_cause," · ",v(a.initiated),a.conditional&&e.jsx("span",{style:{color:"var(--violet)"},children:" · conditional"}),e.jsxs("div",{className:"muted",title:f[N(a)].text+(a.linked_before_clearance?" "+y.text:""),"data-testid":"watch-attribution",children:[a.ancestor,": ",f[N(a)].short,a.linked_before_clearance?` · ${y.short.toLowerCase()}`:""]})]},a.recall_id+a.ancestor))]})]},s.k))})]})})})]})}function K({initial:c,go:r,onChanged:t}){const[o,d]=h.useState(c||""),[m,p]=h.useState(!1),[l,x]=h.useState(null),[u,s]=h.useState(null);h.useEffect(()=>{c&&d(c)},[c]);const a=async()=>{p(!0),s(null),x(null);try{const i=await w.ingest(o);x(i),t&&t()}catch(i){s(i.message)}finally{p(!1)}},n=(i,j)=>Object.keys({...i,...j}).map(g=>[g,(j[g]||0)-(i[g]||0)]).filter(([,g])=>g);return e.jsxs("div",{children:[e.jsx(b,{eyebrow:"Graph",title:"Add a clearance",children:"Enter any 510(k) number. Forebear fetches its openFDA record and summary PDF live, extracts the predicates it cites, validates them against openFDA, links recalls, and MERGEs everything into the Relate store. Use it on an ancestor whose summary was not read to extend a lineage by one generation. Needs internet."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:i=>{i.preventDefault(),a()},children:[e.jsx("input",{className:"field",value:o,placeholder:"K-number, e.g. K241135",onChange:i=>d(i.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:m||!o,children:m?"Reading from FDA…":"Read and add"})]}),m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),u&&e.jsx("p",{className:"err",role:"alert",children:u})]}),l&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[l.k,": ",l.was_present?l.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:l.summary_status}),l.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:l.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),e.jsxs("p",{className:"muted",children:["Graph change: ",n(l.graph_before,l.graph_after).concat(n(l.rels_before,l.rels_after)).map(([i,j])=>`${j>0?"+":""}${j} ${i}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),l.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",l.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):l.citations_added.map(i=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:i.dst})," ",e.jsx("span",{className:"chip",children:i.kind})," ",e.jsxs("span",{className:"muted",children:["p.",i.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",i.snippet,"”"]})]},i.dst)),e.jsxs("p",{className:"muted small",children:[l.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>r("check",l.k),children:["Investigate ",l.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function V({stats:c}){return e.jsxs("div",{className:"method",children:[e.jsx(b,{eyebrow:"Method",title:"How Forebear decides, and what it does not",children:"Verdicts come from a small set of deterministic rules over Relate queries. They are documentation signals inside a stated scope, never safety findings."}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"What the verdict means"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-alert",children:"Design-related recall on file"})," the candidate has a design-related recall of its own."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-amber",children:"Review lineage"})," a direct or grand-predicate has a design-related recall (Class I/II or not yet classified), the direct predicate has a Class I recall, or the candidate has a Class I recall."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-muted",children:"Lineage not checkable"})," the candidate's own predicates could not be read, or every direct predicate link rests on uncertain evidence, so nothing was checked."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-calm",children:"No design-recall signal"})," none of the above in the readable ancestry. Lower-severity signals are still listed. Not a safety finding."]})]}),e.jsx("p",{className:"muted small",children:'"Design-related" means an openFDA root cause containing "design" but not "process". This is coarse. Lineage is limited to summaries that are online and machine-readable; gaps are reported, never filled in.'})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How a thread is classified"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsxs("span",{className:"status status-confirmed",children:[e.jsx("span",{className:"line"}),"Confirmed"]})," a person confirmed the citation. Confirmations sent through the MCP client do not count."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-extracted",children:[e.jsx("span",{className:"line"}),"Machine-extracted"]})," read from the summary text, validated against openFDA, not yet reviewed."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-disputed",children:[e.jsx("span",{className:"line"}),"Disputed"]})," the cited device's FDA name is absent near the citation, it is in a different FDA panel, its K-number was corrected by the audit, or only an LLM labelled it a predicate."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-conditional",children:[e.jsx("span",{className:"line"}),"Conditional"]})," the extraction audit could not resolve the citation. Recalls reached only through it are marked conditional in assessments, the watchlist and recall reach."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-rejected",children:[e.jsx("span",{className:"line"}),"Rejected"]})," a reviewer removed it; it no longer counts in any lineage query."]})]})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"The optional agent"})}),e.jsx("p",{className:"lede",style:{margin:0},children:"An NVIDIA-hosted model can investigate a device by calling the same graph tools. Phase 3 evaluation found it unsuitable as the primary due-diligence workflow, so its findings appear only as history: never human-approved, never a verdict input, and unable to change lineage."})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How it uses Relate"})}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"Ingest."})," openFDA 510(k), recall and enforcement records, and the text of each 510(k) summary PDF, with page-level evidence."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Store."})," One single-file store, ",e.jsx("code",{children:"data/forebear.rl"}),": ",e.jsx("code",{children:"(:Device)-[:CITES]->(:Device)"}),", ",e.jsx("code",{children:"(:Device)-[:SUBJECT_OF]->(:Recall)"}),", saved ",e.jsx("code",{children:"(:Assessment)"})," nodes."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Query."})," Variable-length Cypher walks the family tree both ways, joins recalls on every ancestor, compares dates."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Update."})," Ingest, review a citation, save an assessment: each is a graph write the next query reads."]})]}),c&&e.jsxs("p",{className:"muted small",children:["Live: ",c.nodes.Device.toLocaleString("en-US")," devices, ",c.relationships.CITES.toLocaleString("en-US")," citation edges, ",c.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{F as CompareView,K as IngestView,V as MethodView,T as ReachView,I as WatchlistView}; diff --git a/web/dist/assets/Views-CntGI8oq.js b/web/dist/assets/Views-CntGI8oq.js new file mode 100644 index 0000000..be75585 --- /dev/null +++ b/web/dist/assets/Views-CntGI8oq.js @@ -0,0 +1 @@ +import{r as h,j as e,v as E,f as g,E as S,a as A,A as y,b as w,P as k,c as _,T as D}from"./index-BEiDIW2F.js";const N=({eyebrow:l,title:c,children:t})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:l}),e.jsx("h1",{children:c}),t&&e.jsx("p",{children:t})]}),C=l=>c=>{c.key==="Enter"&&l()};function T({initial:l,go:c}){const[t,o]=h.useState(l||"K200480 K113053 K233643 K143677"),[d,m]=h.useState(null),[p,i]=h.useState(null),[x,u]=h.useState(!1),s=(a=t)=>{const n=[...new Set(a.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!n.length){i("Enter one or more K-numbers");return}i(null),u(!0),_.compare(n).then(m).catch(j=>i(j.message)).finally(()=>u(!1))};return h.useEffect(()=>{s(l||t)},[l]),e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Investigate",title:"Compare candidate predicates",children:"FDA's draft guidance suggests documenting how each candidate predicate meets the selection best practices. This table covers the recall practice: each candidate's own recalls and those in its ancestry, computed live from the graph."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:a=>{a.preventDefault(),s()},children:[e.jsx("input",{className:"field",value:t,onChange:a=>o(a.target.value),"aria-label":"K-numbers to compare (up to 8)"}),e.jsx("button",{className:"btn btn-primary",disabled:x,children:x?"Comparing…":"Compare"})]}),p&&e.jsx("p",{className:"err",children:p})]}),d&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidate"}),e.jsx("th",{children:"Cleared"}),e.jsx("th",{children:"Verdict"}),e.jsxs("th",{children:["Evidence",e.jsx("br",{}),"(verdict window)"]}),e.jsxs("th",{children:["Own recalls",e.jsx("br",{}),"(design)"]}),e.jsxs("th",{children:["Flagged ancestors",e.jsx("br",{}),"gen 1–2"]}),e.jsxs("th",{children:["Ancestors",e.jsx("br",{}),"(unread)"]}),e.jsx("th",{children:"Top signal"})]})}),e.jsx("tbody",{children:d.map(a=>{if(!a.found)return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:a.k})}),e.jsxs("td",{colSpan:7,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${a.k}`,children:"Read it from FDA →"})]})]},a.k);const n=E(a.verdict,a.evidence);return e.jsxs("tr",{className:"click",tabIndex:0,"data-k":a.k,"data-evidence":a.evidence,onClick:()=>c("check",a.k),onKeyDown:C(()=>c("check",a.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:a.k}),e.jsx("div",{className:"sub",children:a.name}),e.jsx("div",{className:"sub",children:a.applicant})]}),e.jsx("td",{className:"num",children:g(a.decision_date)}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${n.tone}`,"data-testid":"compare-verdict",children:n.label}),a.conditional&&e.jsx("div",{children:e.jsx("span",{className:"chip tone-violet",children:"conditional"})}),e.jsx("div",{className:"sub",style:{maxWidth:320},"data-testid":"compare-reason",children:a.verdict_reason})]}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${S[a.evidence]||"muted"}`,"data-testid":"compare-evidence",children:a.evidence}),(a.evidence_reasons||[]).map(j=>e.jsx("div",{className:"sub",children:A[j]||j},j))]}),e.jsxs("td",{className:"num",children:[a.own_recalls," ",e.jsxs("span",{className:"sub",children:["(",a.own_design_recalls,")"]})]}),e.jsx("td",{className:"num",children:a.flagged_ancestors_gen12}),e.jsxs("td",{className:"num",children:[a.ancestors," ",e.jsxs("span",{className:"sub",children:["(",a.lineage_unknown,")"]})]}),e.jsx("td",{className:"sub",style:{maxWidth:360},children:a.top_signal||"—"})]},a.k)})})]})}),e.jsx("p",{className:"graph-hint",children:"Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer. A verdict on partial or uncertain evidence is provisional: equal verdicts on unequal evidence are not equivalent."})]})]})}function I({initial:l,go:c}){const[t,o]=h.useState(l||"88058,88071"),[d,m]=h.useState(null),[p,i]=h.useState(null),x=(n=t)=>{i(null),m(null),_.recallEvent(n.replace(/\s/g,"")).then(m).catch(j=>i(j.message))};h.useEffect(()=>{o(l||"88058,88071"),x(l||"88058,88071")},[l]);const u=(d==null?void 0:d.descendants)||[],s=(d==null?void 0:d.counts)||{},a=[["after-supported","Cleared after the recall began · supported route",u.filter(n=>n.timing==="after"&&n.evidence==="supported"),'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.',!0],["after-conditional","Cleared after the recall began · conditional route only",u.filter(n=>n.timing==="after"&&n.evidence==="conditional"),"Every route to the recalled clearance runs through a citation the audit could not resolve.",!1],["same-day","Cleared the day the recall began",u.filter(n=>n.timing==="same_day"),"Same calendar day: the dates cannot order them, so these count as neither before nor after.",!1],["unknown","Timing unknown",u.filter(n=>n.timing==="unknown"),"A clearance date or recall start is missing.",!1],["before","Cleared before the recall began",u.filter(n=>n.timing==="before"),null,!0]];return e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance FDA lists on it, then every later clearance that cites one of them, up to three generations, and compares each clearance date with the recall start on its own supported route."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:n=>{n.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:t,onChange:n=>o(n.target.value),"aria-label":"Recall event numbers, comma-separated"}),e.jsx("button",{className:"btn btn-primary",children:"Trace"})]}),e.jsxs("p",{className:"muted small",style:{marginBottom:0},children:["Examples: ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("88058,88071"),x("88058,88071")},children:"88058,88071"})," Philips PE-PUR foam recall, June 2021 (openFDA files it as two events) ·"," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("84406"),x("84406")},children:"84406"})]}),p&&e.jsx("p",{className:"err",children:p})]}),!d&&!p&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"panel","data-testid":"reach-stats",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:d.recalled.length}),e.jsxs("span",{children:["clearances FDA lists on recall event(s) ",d.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:u.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber","data-testid":"reach-count-after",children:[e.jsx("b",{children:s.after_supported??0}),e.jsxs("span",{children:["cleared after the recall on a supported route began",d.initiated?` (earliest ${g(d.initiated)})`:""]})]}),e.jsxs("div",{className:"violet","data-testid":"reach-count-conditional",children:[e.jsx("b",{children:s.conditional??0}),e.jsxs("span",{children:["reached only through an unresolved citation (conditional)",s.after_conditional?`, ${s.after_conditional} of them cleared after`:""]})]}),(s.same_day>0||s.unknown>0)&&e.jsxs("div",{"data-testid":"reach-count-undetermined",children:[e.jsx("b",{children:(s.same_day||0)+(s.unknown||0)}),e.jsxs("span",{children:["timing not determinable (",s.same_day||0," same day, ",s.unknown||0," missing a date)"]})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:d.recalled.map(n=>e.jsxs("button",{className:"tag-btn",onClick:()=>c("check",n.k),"data-testid":"reach-holder",title:y[w(n)].text+(n.linked_before_clearance?" "+k.text:""),children:[e.jsx("span",{className:"k",children:n.k})," ",n.name," ",e.jsxs("span",{className:"muted",children:["· ",y[w(n)].short,n.linked_before_clearance?` · ${k.short.toLowerCase()}`:""]})]},n.k))}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association, not verified model identity: a name match is a fuzzy heuristic on the recall text, and a recall that began before a clearance does not by itself show whether that model was affected."})]}),e.jsx("section",{className:"panel",children:a.filter(([,,n,,j])=>j||n.length).map(([n,j,b,r],v)=>e.jsxs("div",{"data-testid":`reach-${n}`,children:[e.jsxs("div",{className:"panel-head",style:v?{marginTop:22}:void 0,children:[e.jsxs("h2",{children:[j," ",e.jsx("span",{className:"count",children:b.length})]}),r&&e.jsx("p",{className:"hint",children:r})]}),e.jsx(R,{rows:b,go:c})]},n))})]})]})}function R({rows:l,go:c}){return l.length?e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Applicant"}),e.jsx("th",{children:"Cleared"}),e.jsxs("th",{children:["Recall began",e.jsx("br",{}),"on its route"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:l.map(t=>{var p;const o=t.evidence==="conditional",d=!o&&((p=t.conditional_via)==null?void 0:p.length)>0,m=t.supported_gen??t.gen;return e.jsxs("tr",{className:"click"+(o?" is-conditional":""),tabIndex:0,"data-k":t.k,"data-timing":t.timing,"data-evidence":t.evidence,onClick:()=>c("check",t.k),onKeyDown:C(()=>c("check",t.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:t.k})," ",o&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),d&&e.jsx("span",{className:"chip tone-muted",title:"Some routes are supported, others rest on an unresolved citation",children:"mixed routes"}),e.jsx("div",{className:"sub",children:t.name})]}),e.jsx("td",{className:"sub",children:t.applicant}),e.jsx("td",{className:"num",children:g(t.decision_date)}),e.jsxs("td",{className:"num",children:[g(t.recall_started),e.jsx("div",{className:"sub",children:D[t.timing]}),d&&t.conditional_timing&&t.conditional_timing!==t.timing&&e.jsxs("div",{className:"sub",style:{color:"var(--violet)"},children:["Conditional route only: recall began ",g(t.conditional_recall_started),", ",D[t.conditional_timing]]})]}),e.jsx("td",{children:m===1?"direct predicate":`${m} generations`}),e.jsx("td",{className:"sub",children:t.via.map(i=>{var x,u;return e.jsxs("span",{style:(x=t.conditional_via)!=null&&x.includes(i)?{color:"var(--violet)"}:void 0,title:(u=t.conditional_via)!=null&&u.includes(i)?"Reached only through an unresolved citation":"Reached through a supported citation",children:[i," "]},i)})})]},t.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function $({go:l}){const[c,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{_.watchlist().then(t).catch(s=>d(s.message))},[]);const i=(c==null?void 0:c.rows)||[],x=i.filter(s=>m==="all"||m==="direct"&&s.supported_min_gen===1||m==="supported"&&!s.conditional||m==="conditional"&&s.conditional),u=(c==null?void 0:c.conditional)??i.filter(s=>s.conditional).length;return e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Recall evidence",title:"Watchlist: cleared after a predicate recall began",children:"Clearances whose FDA decision date falls after a design-related recall had started on their predicate or grand-predicate. Only the clearance date is compared: it does not show when the predicate was chosen or cited, and the application's receipt date does not establish that either. Same-day dates are not counted as after. Close to, but not the same as, the JAMA study's measure (Class I predicate recalls, any cause). A question to ask, not a finding: the recall may have been fixed, or limited to lots or software versions."}),o&&e.jsx("p",{className:"err",children:o}),!c&&!o&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Querying the graph…"]}),c&&e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:c.count}),e.jsx("span",{children:"clearances decided after a recall began on their lineage"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:c.direct_supported??c.direct}),e.jsx("span",{children:"cite a directly recalled predicate through a supported citation"})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:u}),e.jsx("span",{children:"conditional: every route runs through an unresolved citation"})]})]}),e.jsx("div",{className:"seg",role:"group","aria-label":"Filter",style:{marginTop:14},children:[["all","All"],["direct","Direct predicate"],["supported","Supported routes"],["conditional","Conditional only"]].map(([s,a])=>e.jsx("button",{"aria-pressed":m===s,onClick:()=>p(s),children:a},s))})]}),c&&e.jsx("section",{className:"panel",children:e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Cleared device"}),e.jsx("th",{children:"Cleared · recall began"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(s=>e.jsxs("tr",{className:"click"+(s.conditional?" is-conditional":""),tabIndex:0,"data-k":s.k,onClick:()=>l("check",s.k),onKeyDown:C(()=>l("check",s.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k})," ",s.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:s.name}),e.jsx("div",{className:"sub",children:s.applicant})]}),e.jsxs("td",{className:"num","data-testid":"watch-dates",children:["Cleared ",g(s.decision_date),e.jsxs("div",{className:"sub",children:["recall began ",g(s.recall_basis),s.days_after_recall!=null?`, ${s.days_after_recall} days earlier`:""]})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:(s.conditional?s.ancestors:s.supported_ancestors||s.ancestors).join(", ")}),e.jsx("div",{className:"sub",children:s.conditional?"cited device · citation unresolved":s.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[s.recall_count>2&&e.jsxs("div",{className:"muted",children:[s.recall_count," recall routes; first two:"]}),s.recalls.slice(0,2).map(a=>e.jsxs("div",{children:[a.recall_id," · ",a.classification||"unclassified"," · ",a.root_cause," · ",g(a.initiated),a.conditional&&e.jsx("span",{style:{color:"var(--violet)"},children:" · conditional"}),e.jsxs("div",{className:"muted",title:y[w(a)].text+(a.linked_before_clearance?" "+k.text:""),"data-testid":"watch-attribution",children:[a.ancestor,": ",y[w(a)].short,a.linked_before_clearance?` · ${k.short.toLowerCase()}`:""]})]},a.recall_id+a.ancestor))]})]},s.k))})]})})})]})}function K({initial:l,go:c,onChanged:t}){var j,b;const[o,d]=h.useState(l||""),[m,p]=h.useState(!1),[i,x]=h.useState(null),[u,s]=h.useState(null);h.useEffect(()=>{l&&d(l)},[l]);const a=async()=>{p(!0),s(null),x(null);try{const r=await _.ingest(o);x(r),t&&t()}catch(r){s(r.message)}finally{p(!1)}},n=(r,v)=>Object.keys({...r,...v}).map(f=>[f,(v[f]||0)-(r[f]||0)]).filter(([,f])=>f);return e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Graph",title:"Add a clearance",children:"Enter any 510(k) number. Forebear fetches its openFDA record and summary PDF live, extracts the predicates it cites, validates them against openFDA, links recalls, and MERGEs everything into the Relate store. Use it on an ancestor whose summary was not read to extend a lineage by one generation. Needs internet."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:r=>{r.preventDefault(),a()},children:[e.jsx("input",{className:"field",value:o,placeholder:"K-number, e.g. K241135",onChange:r=>d(r.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:m||!o,children:m?"Reading from FDA…":"Read and add"})]}),m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),u&&e.jsx("p",{className:"err",role:"alert",children:u})]}),i&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[i.k,": ",i.was_present?i.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:i.summary_status}),i.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:i.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),e.jsxs("p",{className:"muted",children:["Graph change: ",n(i.graph_before,i.graph_after).concat(n(i.rels_before,i.rels_after)).map(([r,v])=>`${v>0?"+":""}${v} ${r}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),i.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",i.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):i.citations_added.map(r=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:r.dst})," ",e.jsx("span",{className:"chip",children:r.kind})," ",e.jsxs("span",{className:"muted",children:["p.",r.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",r.snippet,"”"]})]},r.dst)),((b=(j=i.reconciliation)==null?void 0:j.retired)==null?void 0:b.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:13},children:"Citations no longer in the refreshed summary"}),e.jsxs("p",{className:"muted small","data-testid":"ingest-retired",children:["Retired from the lineage, kept with their reviews and provenance:"," ",i.reconciliation.retired.map(r=>`${r.dst}${r.review?` (${r.review} by ${r.reviewer||"unknown"})`:""}`).join(", "),"."]})]}),i.reconciliation&&!i.reconciliation.ran&&e.jsxs("p",{className:"muted small",children:[i.reconciliation.skipped_reason,"."]}),e.jsxs("p",{className:"muted small",children:[i.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>c("check",i.k),children:["Investigate ",i.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function V({stats:l}){return e.jsxs("div",{className:"method",children:[e.jsx(N,{eyebrow:"Method",title:"How Forebear decides, and what it does not",children:"Verdicts come from a small set of deterministic rules over Relate queries. They are documentation signals inside a stated scope, never safety findings."}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"What the verdict means"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-alert",children:"Design-related recall on file"})," the candidate has a design-related recall of its own."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-amber",children:"Review lineage"})," a direct or grand-predicate has a design-related recall (Class I/II or not yet classified), the direct predicate has a Class I recall, or the candidate has a Class I recall."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-muted",children:"Lineage not checkable"})," the candidate's own predicates could not be read, or every direct predicate link rests on uncertain evidence, so nothing was checked."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-calm",children:"No design-recall signal"})," none of the above in the readable ancestry. Lower-severity signals are still listed. Not a safety finding."]})]}),e.jsx("p",{className:"muted small",children:'"Design-related" means an openFDA root cause containing "design" but not "process". This is coarse. Lineage is limited to summaries that are online and machine-readable; gaps are reported, never filled in.'})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How a thread is classified"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsxs("span",{className:"status status-confirmed",children:[e.jsx("span",{className:"line"}),"Confirmed"]})," a person confirmed the citation. Confirmations sent through the MCP client do not count."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-extracted",children:[e.jsx("span",{className:"line"}),"Machine-extracted"]})," read from the summary text, validated against openFDA, not yet reviewed."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-disputed",children:[e.jsx("span",{className:"line"}),"Disputed"]})," the cited device's FDA name is absent near the citation, it is in a different FDA panel, its K-number was corrected by the audit, or only an LLM labelled it a predicate."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-conditional",children:[e.jsx("span",{className:"line"}),"Conditional"]})," the extraction audit could not resolve the citation. Recalls reached only through it are marked conditional in assessments, the watchlist and recall reach."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-rejected",children:[e.jsx("span",{className:"line"}),"Rejected"]})," a reviewer removed it; it no longer counts in any lineage query."]})]})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"The optional agent"})}),e.jsx("p",{className:"lede",style:{margin:0},children:"An NVIDIA-hosted model can investigate a device by calling the same graph tools. Phase 3 evaluation found it unsuitable as the primary due-diligence workflow, so its findings appear only as history: never human-approved, never a verdict input, and unable to change lineage."})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How it uses Relate"})}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"Ingest."})," openFDA 510(k), recall and enforcement records, and the text of each 510(k) summary PDF, with page-level evidence."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Store."})," One single-file store, ",e.jsx("code",{children:"data/forebear.rl"}),": ",e.jsx("code",{children:"(:Device)-[:CITES]->(:Device)"}),", ",e.jsx("code",{children:"(:Device)-[:SUBJECT_OF]->(:Recall)"}),", saved ",e.jsx("code",{children:"(:Assessment)"})," nodes."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Query."})," Variable-length Cypher walks the family tree both ways, joins recalls on every ancestor, compares dates."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Update."})," Ingest, review a citation, save an assessment: each is a graph write the next query reads."]})]}),l&&e.jsxs("p",{className:"muted small",children:["Live: ",l.nodes.Device.toLocaleString("en-US")," devices, ",l.relationships.CITES.toLocaleString("en-US")," citation edges, ",l.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{T as CompareView,K as IngestView,V as MethodView,I as ReachView,$ as WatchlistView}; diff --git a/web/dist/assets/index-58YBiS_r.js b/web/dist/assets/index-58YBiS_r.js deleted file mode 100644 index b4dba1a..0000000 --- a/web/dist/assets/index-58YBiS_r.js +++ /dev/null @@ -1,44 +0,0 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function Kc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ja={exports:{}},xl={},Na={exports:{}},z={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ur=Symbol.for("react.element"),Gc=Symbol.for("react.portal"),Yc=Symbol.for("react.fragment"),Xc=Symbol.for("react.strict_mode"),Zc=Symbol.for("react.profiler"),Jc=Symbol.for("react.provider"),qc=Symbol.for("react.context"),bc=Symbol.for("react.forward_ref"),ed=Symbol.for("react.suspense"),td=Symbol.for("react.memo"),nd=Symbol.for("react.lazy"),io=Symbol.iterator;function rd(e){return e===null||typeof e!="object"?null:(e=io&&e[io]||e["@@iterator"],typeof e=="function"?e:null)}var Sa={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_a=Object.assign,Ea={};function kn(e,t,n){this.props=e,this.context=t,this.refs=Ea,this.updater=n||Sa}kn.prototype.isReactComponent={};kn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ca(){}Ca.prototype=kn.prototype;function os(e,t,n){this.props=e,this.context=t,this.refs=Ea,this.updater=n||Sa}var as=os.prototype=new Ca;as.constructor=os;_a(as,kn.prototype);as.isPureReactComponent=!0;var so=Array.isArray,Ta=Object.prototype.hasOwnProperty,us={current:null},Pa={key:!0,ref:!0,__self:!0,__source:!0};function La(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Ta.call(t,r)&&!Pa.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,ee=C[X];if(0>>1;Xl(Fl,$))Ltl(mr,Fl)?(C[X]=mr,C[Lt]=$,X=Lt):(C[X]=Fl,C[Pt]=$,X=Pt);else if(Ltl(mr,$))C[X]=mr,C[Lt]=$,X=Lt;else break e}}return D}function l(C,D){var $=C.sortIndex-D.sortIndex;return $!==0?$:C.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],d=[],f=1,p=null,m=3,g=!1,y=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(C){for(var D=n(d);D!==null;){if(D.callback===null)r(d);else if(D.startTime<=C)r(d),D.sortIndex=D.expirationTime,t(u,D);else break;D=n(d)}}function w(C){if(k=!1,h(C),!y)if(n(u)!==null)y=!0,Xe(S);else{var D=n(d);D!==null&&M(w,D.startTime-C)}}function S(C,D){y=!1,k&&(k=!1,v(x),x=-1),g=!0;var $=m;try{for(h(D),p=n(u);p!==null&&(!(p.expirationTime>D)||C&&!I());){var X=p.callback;if(typeof X=="function"){p.callback=null,m=p.priorityLevel;var ee=X(p.expirationTime<=D);D=e.unstable_now(),typeof ee=="function"?p.callback=ee:p===n(u)&&r(u),h(D)}else r(u);p=n(u)}if(p!==null)var hr=!0;else{var Pt=n(d);Pt!==null&&M(w,Pt.startTime-D),hr=!1}return hr}finally{p=null,m=$,g=!1}}var E=!1,j=null,x=-1,R=5,T=-1;function I(){return!(e.unstable_now()-TC||125X?(C.sortIndex=$,t(d,C),n(u)===null&&C===n(d)&&(k?(v(x),x=-1):k=!0,M(w,$-X))):(C.sortIndex=ee,t(u,C),y||g||(y=!0,Xe(S))),C},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(C){var D=m;return function(){var $=m;m=D;try{return C.apply(this,arguments)}finally{m=$}}}})(Ma);za.exports=Ma;var hd=za.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var md=_,Se=hd;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fi=Object.prototype.hasOwnProperty,vd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ao={},uo={};function gd(e){return fi.call(uo,e)?!0:fi.call(ao,e)?!1:vd.test(e)?uo[e]=!0:(ao[e]=!0,!1)}function yd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xd(e,t,n,r){if(t===null||typeof t>"u"||yd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ie[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ie[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ie[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var ds=/[\-:]([a-z])/g;function fs(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ds,fs);ie[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ds,fs);ie[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ds,fs);ie[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});ie.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function ps(e,t,n,r){var l=ie.hasOwnProperty(t)?ie[t]:null;(l!==null?l.type!==0:r||!(2a||l[s]!==i[a]){var u=` -`+l[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=a);break}}}finally{Al=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Dn(e):""}function wd(e){switch(e.tag){case 5:return Dn(e.type);case 16:return Dn("Lazy");case 13:return Dn("Suspense");case 19:return Dn("SuspenseList");case 0:case 2:case 15:return e=Ul(e.type,!1),e;case 11:return e=Ul(e.type.render,!1),e;case 1:return e=Ul(e.type,!0),e;default:return""}}function vi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Xt:return"Fragment";case Yt:return"Portal";case pi:return"Profiler";case hs:return"StrictMode";case hi:return"Suspense";case mi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Oa:return(e.displayName||"Context")+".Consumer";case Ia:return(e._context.displayName||"Context")+".Provider";case ms:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vs:return t=e.displayName||null,t!==null?t:vi(e.type)||"Memo";case ut:t=e._payload,e=e._init;try{return vi(e(t))}catch{}}return null}function kd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vi(t);case 8:return t===hs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Nt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ua(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function jd(e){var t=Ua(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yr(e){e._valueTracker||(e._valueTracker=jd(e))}function Va(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ua(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Xr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function gi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function fo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Nt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Wa(e,t){t=t.checked,t!=null&&ps(e,"checked",t,!1)}function yi(e,t){Wa(e,t);var n=Nt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?xi(e,t.type,n):t.hasOwnProperty("defaultValue")&&xi(e,t.type,Nt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function po(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function xi(e,t,n){(t!=="number"||Xr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var $n=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=xr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Gn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Fn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Nd=["Webkit","ms","Moz","O"];Object.keys(Fn).forEach(function(e){Nd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fn[t]=Fn[e]})});function Ka(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Fn.hasOwnProperty(e)&&Fn[e]?(""+t).trim():t+"px"}function Ga(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ka(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Sd=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ji(e,t){if(t){if(Sd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Ni(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Si=null;function gs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _i=null,an=null,un=null;function vo(e){if(e=fr(e)){if(typeof _i!="function")throw Error(N(280));var t=e.stateNode;t&&(t=_l(t),_i(e.stateNode,e.type,t))}}function Ya(e){an?un?un.push(e):un=[e]:an=e}function Xa(){if(an){var e=an,t=un;if(un=an=null,vo(e),t)for(e=0;e>>=0,e===0?32:31-(Md(e)/Fd|0)|0}var wr=64,kr=4194304;function zn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function br(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~l;a!==0?r=zn(a):(i&=s,i!==0&&(r=zn(i)))}else s=n&~l,s!==0?r=zn(s):i!==0&&(r=zn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function cr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Oe(t),e[t]=n}function Ud(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=On),_o=" ",Eo=!1;function mu(e,t){switch(e){case"keyup":return mf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function gf(e,t){switch(e){case"compositionend":return vu(t);case"keypress":return t.which!==32?null:(Eo=!0,_o);case"textInput":return e=t.data,e===_o&&Eo?null:e;default:return null}}function yf(e,t){if(Zt)return e==="compositionend"||!_s&&mu(e,t)?(e=pu(),Ur=js=pt=null,Zt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Lo(n)}}function wu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ku(){for(var e=window,t=Xr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Xr(e.document)}return t}function Es(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Cf(e){var t=ku(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&wu(n.ownerDocument.documentElement,n)){if(r!==null&&Es(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Ro(n,i);var s=Ro(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Jt=null,Ri=null,Un=null,Di=!1;function Do(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Di||Jt==null||Jt!==Xr(r)||(r=Jt,"selectionStart"in r&&Es(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Un&&bn(Un,r)||(Un=r,r=nl(Ri,"onSelect"),0en||(e.current=Oi[en],Oi[en]=null,en--)}function A(e,t){en++,Oi[en]=e.current,e.current=t}var St={},ce=Ct(St),ye=Ct(!1),Ut=St;function hn(e,t){var n=e.type.contextTypes;if(!n)return St;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function ll(){V(ye),V(ce)}function Ao(e,t,n){if(ce.current!==St)throw Error(N(168));A(ce,t),A(ye,n)}function Lu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,kd(e)||"Unknown",l));return Q({},n,r)}function il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||St,Ut=ce.current,A(ce,e),A(ye,ye.current),!0}function Uo(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Lu(e,t,Ut),r.__reactInternalMemoizedMergedChildContext=e,V(ye),V(ce),A(ce,e)):V(ye),A(ye,n)}var Je=null,El=!1,ei=!1;function Ru(e){Je===null?Je=[e]:Je.push(e)}function Af(e){El=!0,Ru(e)}function Tt(){if(!ei&&Je!==null){ei=!0;var e=0,t=O;try{var n=Je;for(O=1;e>=s,l-=s,qe=1<<32-Oe(t)+l|n<x?(R=j,j=null):R=j.sibling;var T=m(v,j,h[x],w);if(T===null){j===null&&(j=R);break}e&&j&&T.alternate===null&&t(v,j),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T,j=R}if(x===h.length)return n(v,j),W&&Dt(v,x),S;if(j===null){for(;xx?(R=j,j=null):R=j.sibling;var I=m(v,j,T.value,w);if(I===null){j===null&&(j=R);break}e&&j&&I.alternate===null&&t(v,j),c=i(I,c,x),E===null?S=I:E.sibling=I,E=I,j=R}if(T.done)return n(v,j),W&&Dt(v,x),S;if(j===null){for(;!T.done;x++,T=h.next())T=p(v,T.value,w),T!==null&&(c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return W&&Dt(v,x),S}for(j=r(v,j);!T.done;x++,T=h.next())T=g(j,v,x,T.value,w),T!==null&&(e&&T.alternate!==null&&j.delete(T.key===null?x:T.key),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return e&&j.forEach(function(K){return t(v,K)}),W&&Dt(v,x),S}function L(v,c,h,w){if(typeof h=="object"&&h!==null&&h.type===Xt&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case gr:e:{for(var S=h.key,E=c;E!==null;){if(E.key===S){if(S=h.type,S===Xt){if(E.tag===7){n(v,E.sibling),c=l(E,h.props.children),c.return=v,v=c;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ut&&Bo(S)===E.type){n(v,E.sibling),c=l(E,h.props),c.ref=Pn(v,E,h),c.return=v,v=c;break e}n(v,E);break}else t(v,E);E=E.sibling}h.type===Xt?(c=At(h.props.children,v.mode,w,h.key),c.return=v,v=c):(w=Yr(h.type,h.key,h.props,null,v.mode,w),w.ref=Pn(v,c,h),w.return=v,v=w)}return s(v);case Yt:e:{for(E=h.key;c!==null;){if(c.key===E)if(c.tag===4&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){n(v,c.sibling),c=l(c,h.children||[]),c.return=v,v=c;break e}else{n(v,c);break}else t(v,c);c=c.sibling}c=ai(h,v.mode,w),c.return=v,v=c}return s(v);case ut:return E=h._init,L(v,c,E(h._payload),w)}if($n(h))return y(v,c,h,w);if(Sn(h))return k(v,c,h,w);Tr(v,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,c!==null&&c.tag===6?(n(v,c.sibling),c=l(c,h),c.return=v,v=c):(n(v,c),c=oi(h,v.mode,w),c.return=v,v=c),s(v)):n(v,c)}return L}var vn=Mu(!0),Fu=Mu(!1),al=Ct(null),ul=null,rn=null,Ls=null;function Rs(){Ls=rn=ul=null}function Ds(e){var t=al.current;V(al),e._currentValue=t}function Vi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function dn(e,t){ul=e,Ls=rn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ge=!0),e.firstContext=null)}function Re(e){var t=e._currentValue;if(Ls!==e)if(e={context:e,memoizedValue:t,next:null},rn===null){if(ul===null)throw Error(N(308));rn=e,ul.dependencies={lanes:0,firstContext:e}}else rn=rn.next=e;return t}var Ft=null;function $s(e){Ft===null?Ft=[e]:Ft.push(e)}function Iu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,$s(t)):(n.next=l.next,l.next=n),t.interleaved=n,rt(e,r)}function rt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ct=!1;function zs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ou(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function et(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function xt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,rt(e,n)}return l=r.interleaved,l===null?(t.next=t,$s(r)):(t.next=l.next,l.next=t),r.interleaved=t,rt(e,n)}function Wr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xs(e,n)}}function Ho(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function cl(e,t,n,r){var l=e.updateQueue;ct=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,d=u.next;u.next=null,s===null?i=d:s.next=d,s=u;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=d:a.next=d,f.lastBaseUpdate=u))}if(i!==null){var p=l.baseState;s=0,f=d=u=null,a=i;do{var m=a.lane,g=a.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,k=a;switch(m=t,g=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){p=y.call(g,p,m);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,m=typeof y=="function"?y.call(g,p,m):y,m==null)break e;p=Q({},p,m);break e;case 2:ct=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=l.effects,m===null?l.effects=[a]:m.push(a))}else g={eventTime:g,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(d=f=g,u=p):f=f.next=g,s|=m;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;m=a,a=m.next,m.next=null,l.lastBaseUpdate=m,l.shared.pending=null}}while(!0);if(f===null&&(u=p),l.baseState=u,l.firstBaseUpdate=d,l.lastBaseUpdate=f,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Bt|=s,e.lanes=s,e.memoizedState=p}}function Qo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ni.transition;ni.transition={};try{e(!1),t()}finally{O=n,ni.transition=r}}function tc(){return De().memoizedState}function Bf(e,t,n){var r=kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},nc(e))rc(t,n);else if(n=Iu(e,t,n,r),n!==null){var l=fe();Ae(n,e,r,l),lc(n,t,r)}}function Hf(e,t,n){var r=kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(nc(e))rc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(l.hasEagerState=!0,l.eagerState=a,Ve(a,s)){var u=t.interleaved;u===null?(l.next=l,$s(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Iu(e,t,l,r),n!==null&&(l=fe(),Ae(n,e,r,l),lc(n,t,r))}}function nc(e){var t=e.alternate;return e===H||t!==null&&t===H}function rc(e,t){Vn=fl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function lc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xs(e,n)}}var pl={readContext:Re,useCallback:se,useContext:se,useEffect:se,useImperativeHandle:se,useInsertionEffect:se,useLayoutEffect:se,useMemo:se,useReducer:se,useRef:se,useState:se,useDebugValue:se,useDeferredValue:se,useTransition:se,useMutableSource:se,useSyncExternalStore:se,useId:se,unstable_isNewReconciler:!1},Qf={readContext:Re,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Re,useEffect:Go,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,Zu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hr(4,2,e,t)},useMemo:function(e,t){var n=He();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=He();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Bf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Ko,useDebugValue:Ws,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Ko(!1),t=e[0];return e=Wf.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=He();if(W){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Wt&30||Wu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Go(Hu.bind(null,r,i,e),[e]),r.flags|=2048,or(9,Bu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=He(),t=ne.identifierPrefix;if(W){var n=be,r=qe;n=(r&~(1<<32-Oe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Qe]=t,e[nr]=r,hc(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ni(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lxn&&(t.flags|=128,r=!0,Ln(i,!1),t.lanes=4194304)}else{if(!r)if(e=dl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ln(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!W)return oe(t),null}else 2*Z()-i.renderingStartTime>xn&&n!==1073741824&&(t.flags|=128,r=!0,Ln(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Z(),t.sibling=null,n=B.current,A(B,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Ys(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ke&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function bf(e,t){switch(Ts(t),t.tag){case 1:return xe(t.type)&&ll(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gn(),V(ye),V(ce),Is(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Fs(t),null;case 13:if(V(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(B),null;case 4:return gn(),null;case 10:return Ds(t.type._context),null;case 22:case 23:return Ys(),null;case 24:return null;default:return null}}var Lr=!1,ue=!1,ep=typeof WeakSet=="function"?WeakSet:Set,P=null;function ln(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function Zi(e,t,n){try{n()}catch(r){G(e,t,r)}}var la=!1;function tp(e,t){if($i=el,e=ku(),Es(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,d=0,f=0,p=e,m=null;t:for(;;){for(var g;p!==n||l!==0&&p.nodeType!==3||(a=s+l),p!==i||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)!==null;)m=p,p=g;for(;;){if(p===e)break t;if(m===n&&++d===l&&(a=s),m===i&&++f===r&&(u=s),(g=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(zi={focusedElem:e,selectionRange:n},el=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,L=y.memoizedState,v=t.stateNode,c=v.getSnapshotBeforeUpdate(t.elementType===t.type?k:ze(t.type,k),L);v.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return y=la,la=!1,y}function Wn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Zi(t,n,i)}l=l.next}while(l!==r)}}function Pl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ji(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function gc(e){var t=e.alternate;t!==null&&(e.alternate=null,gc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qe],delete t[nr],delete t[Ii],delete t[If],delete t[Of])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function yc(e){return e.tag===5||e.tag===3||e.tag===4}function ia(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=rl));else if(r!==4&&(e=e.child,e!==null))for(qi(e,t,n),e=e.sibling;e!==null;)qi(e,t,n),e=e.sibling}function bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(bi(e,t,n),e=e.sibling;e!==null;)bi(e,t,n),e=e.sibling}var re=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)xc(e,t,n),n=n.sibling}function xc(e,t,n){if(Ke&&typeof Ke.onCommitFiberUnmount=="function")try{Ke.onCommitFiberUnmount(kl,n)}catch{}switch(n.tag){case 5:ue||ln(n,t);case 6:var r=re,l=Me;re=null,ot(e,t,n),re=r,Me=l,re!==null&&(Me?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Me?(e=re,n=n.stateNode,e.nodeType===8?bl(e.parentNode,n):e.nodeType===1&&bl(e,n),Jn(e)):bl(re,n.stateNode));break;case 4:r=re,l=Me,re=n.stateNode.containerInfo,Me=!0,ot(e,t,n),re=r,Me=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Zi(n,t,s),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!ue&&(ln(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){G(n,t,a)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,ot(e,t,n),ue=r):ot(e,t,n);break;default:ot(e,t,n)}}function sa(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ep),t.forEach(function(r){var l=cp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function $e(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rp(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,vl=0,F&6)throw Error(N(331));var l=F;for(F|=4,P=e.current;P!==null;){var i=P,s=i.child;if(P.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uZ()-Ks?Ot(e,0):Qs|=n),we(e,t)}function Cc(e,t){t===0&&(e.mode&1?(t=kr,kr<<=1,!(kr&130023424)&&(kr=4194304)):t=1);var n=fe();e=rt(e,t),e!==null&&(cr(e,t,n),we(e,n))}function up(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Cc(e,n)}function cp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Cc(e,n)}var Tc;Tc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ge=!1,Jf(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&Du(t,ol,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Qr(e,t),e=t.pendingProps;var l=hn(t,ce.current);dn(t,n),l=As(null,t,r,e,l,n);var i=Us();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(i=!0,il(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,zs(t),l.updater=Tl,t.stateNode=l,l._reactInternals=t,Bi(t,r,e,n),t=Ki(null,t,r,!0,i,n)):(t.tag=0,W&&i&&Cs(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Qr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=fp(r),e=ze(r,e),l){case 0:t=Qi(null,t,r,e,n);break e;case 1:t=ta(null,t,r,e,n);break e;case 11:t=bo(null,t,r,e,n);break e;case 14:t=ea(null,t,r,ze(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Qi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ta(e,t,r,l,n);case 3:e:{if(dc(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Ou(e,t),cl(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=yn(Error(N(423)),t),t=na(e,t,r,n,l);break e}else if(r!==l){l=yn(Error(N(424)),t),t=na(e,t,r,n,l);break e}else for(je=yt(t.stateNode.containerInfo.firstChild),Ne=t,W=!0,Fe=null,n=Fu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mn(),r===l){t=lt(e,t,n);break e}de(e,t,r,n)}t=t.child}return t;case 5:return Au(t),e===null&&Ui(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Mi(r,l)?s=null:i!==null&&Mi(r,i)&&(t.flags|=32),cc(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Ui(t),null;case 13:return fc(e,t,n);case 4:return Ms(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vn(t,null,r,n):de(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),bo(e,t,r,l,n);case 7:return de(e,t,t.pendingProps,n),t.child;case 8:return de(e,t,t.pendingProps.children,n),t.child;case 12:return de(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,A(al,r._currentValue),r._currentValue=s,i!==null)if(Ve(i.value,s)){if(i.children===l.children&&!ye.current){t=lt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=et(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?u.next=u:(u.next=f.next,f.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Vi(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Vi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}de(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,dn(t,n),l=Re(l),r=r(l),t.flags|=1,de(e,t,r,n),t.child;case 14:return r=t.type,l=ze(r,t.pendingProps),l=ze(r.type,l),ea(e,t,r,l,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Qr(e,t),t.tag=1,xe(r)?(e=!0,il(t)):e=!1,dn(t,n),ic(t,r,l),Bi(t,r,l,n),Ki(null,t,r,!0,e,n);case 19:return pc(e,t,n);case 22:return uc(e,t,n)}throw Error(N(156,t.tag))};function Pc(e,t){return nu(e,t)}function dp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new dp(e,t,n,r)}function Zs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fp(e){if(typeof e=="function")return Zs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ms)return 11;if(e===vs)return 14}return 2}function jt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Zs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xt:return At(n.children,l,i,t);case hs:s=8,l|=8;break;case pi:return e=Pe(12,n,t,l|2),e.elementType=pi,e.lanes=i,e;case hi:return e=Pe(13,n,t,l),e.elementType=hi,e.lanes=i,e;case mi:return e=Pe(19,n,t,l),e.elementType=mi,e.lanes=i,e;case Aa:return Rl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ia:s=10;break e;case Oa:s=9;break e;case ms:s=11;break e;case vs:s=14;break e;case ut:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Pe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function At(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function Rl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Aa,e.lanes=n,e.stateNode={isHidden:!1},e}function oi(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function ai(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function pp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wl(0),this.expirationTimes=Wl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Js(e,t,n,r,l,i,s,a,u){return e=new pp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zs(i),e}function hp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($c)}catch(e){console.error(e)}}$c(),$a.exports=_e;var zc=$a.exports,Mc,ha=zc;Mc=ha.createRoot,ha.hydrateRoot;const xp="modulepreload",wp=function(e){return"/"+e},ma={},zt=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));l=Promise.allSettled(n.map(u=>{if(u=wp(u),u in ma)return;ma[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":xp,d||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((m,g)=>{p.addEventListener("load",m),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return l.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};async function ae(e,t={}){const n=await fetch(e,{headers:{"content-type":"application/json"},...t,body:t.body?JSON.stringify(t.body):void 0});let r=null;try{r=await n.json()}catch{}if(!n.ok){const l=r!=null&&r.detail?typeof r.detail=="string"?r.detail:JSON.stringify(r.detail):`HTTP ${n.status}`;throw new Error(l)}return r}const Ie={stats:()=>ae("/api/stats"),search:e=>ae(`/api/search?q=${encodeURIComponent(e)}`),assess:(e,t=4)=>ae(`/api/assess/${e}?depth=${t}`),compare:e=>ae("/api/compare",{method:"POST",body:{ks:e}}),recallEvent:e=>ae(`/api/recall-event/${e}`),watchlist:()=>ae("/api/watchlist"),ingest:e=>ae("/api/ingest",{method:"POST",body:{k:e}}),review:(e,t,n,r)=>ae("/api/citation/review",{method:"POST",body:{src:e,dst:t,status:n,note:r}}),triage:(e,t)=>ae("/api/citation/triage",{method:"POST",body:{src:e,dst:t}}),save:(e,t)=>ae("/api/assessments",{method:"POST",body:{k:e,note:t}}),assessments:e=>ae(`/api/assessments${e?`?k=${e}`:""}`),investigations:(e,t=30)=>ae(`/api/investigations?limit=${t}${e?`&k=${e}`:""}`),investigation:e=>ae(`/api/investigations/${e}`),startInvestigation:(e,t,n="auto")=>ae("/api/investigations",{method:"POST",body:{k:e,request:t,mode:n}}),proposals:e=>ae(`/api/proposals${e?`?status=${e}`:""}`),decide:(e,t,n,r)=>ae(`/api/proposals/${e}/decision`,{method:"POST",body:{decision:t,reviewer:n,human:!0,note:r}})},Fc=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,kp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,ls={nodes:[{id:"a",x:11,y:7,r:3.6},{id:"b",x:27,y:7,r:2.8},{id:"c",x:11,y:19,r:3},{id:"d",x:23,y:19,r:2.6},{id:"e",x:11,y:31,r:3.4,past:!0}],threads:[["a","b"],["a","c"],["c","d"],["c","e"]]},$r=Object.fromEntries(ls.nodes.map(e=>[e.id,e]));function Ic({size:e=28,className:t="",title:n}){return o.jsxs("svg",{className:"mark "+t,width:e,height:e,viewBox:"0 0 38 38",role:n?"img":void 0,"aria-hidden":n?void 0:!0,"aria-label":n,children:[ls.threads.map(([r,l],i)=>o.jsx("line",{className:`mark-thread t${i}`,x1:$r[r].x,y1:$r[r].y,x2:$r[l].x,y2:$r[l].y,pathLength:"1"},i)),ls.nodes.map((r,l)=>o.jsx("circle",{className:`mark-node n${l}${r.past?" past":""}`,cx:r.x,cy:r.y,r:r.r},r.id))]})}function jp({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Ic,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const to="forebear:intro",Np=3e3,va=2450;function Sp(){try{return!!sessionStorage.getItem(to)}catch{return!0}}function _p(){try{sessionStorage.setItem(to,"seen")}catch{}}function Ep(){try{sessionStorage.removeItem(to)}catch{}}function Cp({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,_p(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,va),f=m=>{(m.key==="Escape"||m.key==="Enter"||m.key===" ")&&(m.preventDefault(),i())};return addEventListener("keydown",f),(p=l.current)==null||p.focus({preventScroll:!0}),()=>{clearTimeout(d),removeEventListener("keydown",f)}},[]);const[s,a]=_.useState(!1);if(_.useEffect(()=>{if(!t)return;const d=setTimeout(()=>a(!0),Np-va+100);return()=>clearTimeout(d)},[t]),s)return null;const u="Forebear".split("");return o.jsxs("div",{className:"intro"+(t?" is-leaving":""),"data-testid":"intro",onClick:i,role:"dialog","aria-modal":"true","aria-label":"Forebear opening",children:[o.jsxs("div",{className:"intro-lockup","aria-hidden":"true",children:[o.jsx(Ic,{className:"intro-mark",size:116}),o.jsx("div",{className:"intro-word",children:u.map((d,f)=>o.jsx("span",{style:{animationDelay:`${.95+f*.045}s`},children:d},f))}),o.jsx("p",{className:"intro-tag",children:o.jsxs("span",{children:["Every clearance has ",o.jsx("em",{children:"a past."})]})})]}),o.jsx("span",{className:"sr-only",role:"status",children:"Forebear. Every clearance has a past."}),o.jsxs("button",{ref:l,className:"btn btn-line btn-sm intro-skip",onClick:d=>{d.stopPropagation(),i()},children:["Skip intro ",o.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}function Tp(e){const[t,n]=_.useState(()=>typeof matchMedia<"u"&&matchMedia(e).matches);return _.useEffect(()=>{const r=matchMedia(e),l=()=>n(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),t}const ga=["mcp-client"],Qn={DESIGN_RECALL_ON_FILE:{tone:"alert",label:"Design-related recall on file",plain:"The candidate itself has a design-related recall on file."},REVIEW_LINEAGE:{tone:"amber",label:"Review lineage",plain:"A recall in the predicate lineage warrants documented review."},INSUFFICIENT_LINEAGE:{tone:"muted",label:"Lineage not checkable",plain:"The ancestry could not be checked from readable evidence."},NO_DESIGN_RECALL_SIGNAL:{tone:"calm",label:"No design-recall signal",plain:"No design-related recall in the readable verdict window. Not a safety finding."}},Oc={audit_unresolved:"The extraction audit could not resolve whether this is the predicate",audit_correction:"K-number supplied by the audit, not as printed in the PDF",name_mismatch:"The cited device's FDA name does not appear near the citation",different_fda_panel:"Cited device sits in a different FDA review panel",llm_label_only:"A predicate only because an LLM labelled the mention",client_confirmation_only:"Confirmed only through the automated MCP client, not a person"};function Pp(e){if(!e)return[];if(e.review==="confirmed"&&!ga.includes(e.reviewer))return[];const t=[];return e.audit==="unresolved"&&t.push("audit_unresolved"),e.audit==="corrected"&&t.push("audit_correction"),e.name_check==="mismatch"&&!["variant","corrected"].includes(e.audit)&&t.push("name_mismatch"),e.panel_check==="different"&&!["variant","corrected"].includes(e.audit)&&t.push("different_fda_panel"),e.kind!=null&&e.kind!=="predicate"&&e.ai_label==="predicate"&&t.push("llm_label_only"),e.kind!=null&&e.kind!=="predicate"&&e.review==="confirmed"&&ga.includes(e.reviewer)&&t.push("client_confirmation_only"),t}const Ye={confirmed:{label:"Confirmed by a person",short:"Confirmed"},extracted:{label:"Machine-extracted",short:"Extracted"},disputed:{label:"Disputed evidence",short:"Disputed"},conditional:{label:"Conditional route",short:"Conditional"},rejected:{label:"Rejected by a reviewer",short:"Rejected"}};function _t(e){if((e==null?void 0:e.review)==="rejected")return{key:"rejected",reasons:[]};const t=Pp(e);return t.includes("audit_unresolved")?{key:"conditional",reasons:t}:t.length?{key:"disputed",reasons:t}:(e==null?void 0:e.review)==="confirmed"?{key:"confirmed",reasons:t}:{key:"extracted",reasons:t}}function Lp(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function no(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function ro(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const Rp=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(e){if(!e)return"—";const[t,n,r]=String(e).slice(0,10).split("-").map(Number);return t?`${r} ${Rp[(n||1)-1]} ${t}`:String(e)}const Ac=e=>e?String(e).slice(0,4):"";function ya(e,t){if(!e||!t)return null;const[n,r,l]=e.slice(0,10).split("-").map(Number),[i,s,a]=t.slice(0,10).split("-").map(Number);return(i-n)*12+(s-r)-(ar?1:0}function Uc(e,t){const n=Dp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?ya(e,t):ya(t,e);return{relation:n<0?"before":"after",months:r,duration:$p(r)}}function Vc(e,t,n="clause"){if(!e)return"";const{relation:r,duration:l}=e;return n==="chip"?r==="same-day"?`Recall began on the day of ${t}'s clearance`:`Recall began ${l} ${r} ${t}'s clearance`:r==="same-day"?`on the day ${t} was cleared`:`${l} ${r} ${t} was cleared`}function $p(e){if(e==null)return"";const t=e<0,n=Math.abs(e),r=Math.floor(n/12),l=n%12,i=[r?`${r} yr`:"",l?`${l} mo`:""].filter(Boolean).join(" ")||"<1 mo";return t?`-${i}`:i}const zp=(e,t)=>e?t?`${e}#page=${t}`:e:null,Mp={pdf_text_layer:"PDF text layer",ocr:"Local OCR of the scanned PDF",embedded_pdf_attachment:"Summary embedded in a PDF Portfolio"};function it(e,t=30){const n=(e||"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Fp(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function Ip(e,t){const n=Qn[e];return n?Fp(e,t)?{tone:"muted",label:`${n.label} · provisional`,provisional:!0}:{tone:n.tone,label:n.label,provisional:!1}:{tone:"muted",label:e||"Unknown",provisional:!1}}const yh={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Op={direct_predicate_links_all_uncertain:"every direct predicate link rests on uncertain evidence",unresolved_predicate_citations:"predicate citations within two generations could not be resolved",direct_predicate_summaries_unread:"a direct predicate's own summary was not read",doubtful_links_in_window:"links within two generations rest on doubtful evidence",recall_cause_or_class_unknown:"a recall has no stated cause or FDA class",unattributed_recalls_in_product_code:"design-related recalls in the product code name no 510(k)",shallow_traversal:"grand-predicates were not traversed"},Wc={name_token_match:{short:"FDA-listed · name match (heuristic)",tone:"other",text:"FDA lists this 510(k) on the recall. A distinctive word of its FDA device name appears in the recall text, possibly as a fuzzy match. This heuristic does not verify that the recall names this exact model."},name_token_absent:{short:"FDA-listed · name not found (heuristic)",tone:"muted",text:"FDA lists this 510(k) on the recall, but no distinctive word of its FDA device name was found in the recall text. The recalled model may differ, or the text may name it differently."},name_not_checkable:{short:"FDA-listed · name not checked",tone:"muted",text:"FDA lists this 510(k) on the recall. No name check is available: its FDA device name has no distinctive word to look for, or no check was recorded for this link. Which model was recalled is not established here."}},ui={short:"Recall began before this clearance",text:"This recall began before this 510(k) was cleared, yet FDA lists it on the record. The dates alone do not establish whether this cleared model was affected: read the FDA record."},xh={after:"cleared after the recall began",before:"cleared before the recall began",same_day:"cleared the day the recall began (order unknown)",unknown:"timing unknown (a date is missing)"};function xa(e){return e!=null&&e.attribution&&Wc[e.attribution]?e.attribution:(e==null?void 0:e.link_name_check)==="match"?"name_token_match":(e==null?void 0:e.link_name_check)==="mismatch"?"name_token_absent":"name_not_checkable"}const ci=70,zr=110,wa=46,Ap=62,Up=190,ka=300;function Vp(e){return e.signals.filter(t=>{var n;return(t.severity==="high"||t.severity==="medium")&&((n=t.chain)==null?void 0:n.length)>1}).map(t=>t.chain)}function Wp(e,{depth:t,descendants:n}){const r=new Map,l=Vp(e),i=new Set(l.flat()),s=new Set;l.forEach(p=>p.slice(1).forEach((m,g)=>s.add(p[g]+">"+m))),r.set(e.k,{...e.device,k:e.k,gen:0,side:"self",recalls:e.device.recalls||[]});let a=0,u=new Set;for(const p of e.ancestors)p.gen<=t||i.has(p.k)?r.set(p.k,{...p,side:"up"}):(a++,u.add(p.gen));if(n)for(const p of e.descendants)r.set(p.k,{...p,side:"down"});const d=new Map,f=p=>{for(const m of p||[]){if(!r.has(m.src)||!r.has(m.dst))continue;const g=m.src+">"+m.dst;d.has(g)||d.set(g,{id:g,hop:m,status:_t(m),critical:s.has(g)})}};for(const p of e.ancestors)r.has(p.k)&&f(p.hops);if(n)for(const p of e.descendants)f(p.hops);return{nodes:r,edges:d,hidden:a,hiddenGens:[...u].sort(),critK:i,critE:s}}function Bp(e,t){var E;const{nodes:n,edges:r}=e,l=new Map;for(const j of n.values())((E=j.chain)==null?void 0:E.length)>1&&l.set(j.k,j.chain[j.chain.length-2]);const i=[...n.values()].filter(j=>j.side==="up").map(j=>j.gen),s=[...n.values()].filter(j=>j.side==="down").map(j=>j.gen),a=i.length?Math.max(...i):0,u=s.length?Math.max(...s):0,d=j=>j.side==="self"?a:j.side==="up"?a-j.gen:a+j.gen,f=new Map;for(const j of n.values()){const x=d(j);f.has(x)||f.set(x,[]),f.get(x).push(j)}const p=new Map([[[...n.values()].find(j=>j.side==="self").k,0]]),m=[...f.keys()].sort((j,x)=>Math.abs(j-a)-Math.abs(x-a)),g=Math.max(...[...f.values()].map(j=>j.length));for(const j of m){const x=f.get(j);x.sort((R,T)=>{const I=p.get(l.get(R.k))??0,K=p.get(l.get(T.k))??0;return I-K||(T.decision_date||"").localeCompare(R.decision_date||"")}),x.forEach((R,T)=>{R.side!=="self"&&p.set(R.k,(T-(x.length-1)/2)*ci)})}const y=a+u,k=y?Math.max(Up,Math.min(ka,(t-zr*2)/y)):ka,L=Math.max(t,zr*2+y*k),v=zr+(L-(zr*2+y*k))/2,c=wa+Ap+Math.max(1,g)*ci,h=wa+Math.max(1,g)*ci/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:h+p.get(j.k)}])),S=[...f.keys()].map(j=>{const x=j-a;return{x:v+j*k,label:x===0?"Candidate":x<0?x===-1?"Predicates":x===-2?"Grand-predicates":`Generation ${-x}`:`Cites it · +${x}`}});return{pos:w,width:L,height:c,colLabels:S,edges:r}}function Hp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Wp(e,{depth:t,descendants:r}),[e,t,r]),u=_.useRef(null),[d,f]=_.useState(900);_.useEffect(()=>{const c=()=>u.current&&f(u.current.clientWidth);c();const h=new ResizeObserver(c);return h.observe(u.current),()=>h.disconnect()},[]);const p=_.useMemo(()=>Bp(a,d),[a,d]),[m,g]=_.useState(null);_.useEffect(()=>{const c=u.current;c&&(c.scrollLeft=c.scrollWidth)},[e.k,p.width]);const y=_.useMemo(()=>{const c=m||null;if(!c)return s?new Set(s):null;const h=a.nodes.get(c);return new Set((h==null?void 0:h.chain)||[c])},[m,a,s]),k=c=>{if(!y)return!0;const[h,w]=c.split(">");return y.has(h)&&y.has(w)},L=c=>{const h=c.recalls||[],w=h.filter(S=>S.design_related).length;return`${c.k}, ${c.name||"unnamed"}, cleared ${c.decision_date||"date unknown"}. `+(c.side==="self"?"Candidate. ":c.side==="up"?`Generation ${c.gen} predicate. `:`Cites the candidate, ${c.gen} generation(s) later. `)+(h.length?`${h.length} recall record(s), ${w} design-related. `:"No recall records. ")+(c.lineage_known===!1?"Its own predicates were not read.":"")},v=c=>h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),c())};return o.jsxs("div",{children:[o.jsx("div",{className:"graph-wrap",ref:u,"data-testid":"evidence-graph",children:o.jsxs("svg",{width:p.width,height:p.height,role:"group","aria-label":`Predicate lineage graph for ${e.k}: ${a.nodes.size} devices, ${a.edges.size} citations`,children:[p.colLabels.map(c=>o.jsxs("g",{children:[o.jsx("line",{className:"g-col-rule",x1:c.x,x2:c.x,y1:30,y2:p.height-10}),o.jsx("text",{className:"g-col-label",x:c.x,y:20,textAnchor:"middle",children:c.label})]},c.x)),[...a.edges.values()].map(c=>{const h=p.pos.get(c.hop.src),w=p.pos.get(c.hop.dst),S=(h.x+w.x)/2,E=`M${h.x-12},${h.y} C${S},${h.y} ${S},${w.y} ${w.x+12},${w.y}`,j=c.status.key,x=!k(c.id),R=(l==null?void 0:l.type)==="edge"&&l.id===c.id;return o.jsxs("g",{className:"g-edge-g",tabIndex:0,role:"button","aria-label":`Citation: ${c.hop.src} cites ${c.hop.dst}${c.hop.page?`, page ${c.hop.page}`:""}. ${Ye[j].label}. Open provenance.`,"aria-pressed":R,onClick:()=>i({type:"edge",id:c.id,hop:c.hop}),onKeyDown:v(()=>i({type:"edge",id:c.id,hop:c.hop})),children:[o.jsx("path",{d:E,className:`g-edge st-${j}${c.critical?" is-critical":""}${x?" is-dim":""}`,style:R?{opacity:1,strokeWidth:3.2}:void 0}),c.critical&&!x&&o.jsx("path",{d:E,className:"g-flow"}),o.jsx("path",{d:E,className:"g-edge-hit"}),o.jsx("rect",{x:S-22,y:(h.y+w.y)/2-9,width:44,height:18,rx:9,fill:"transparent",style:{cursor:"pointer"}}),o.jsx("title",{children:`${c.hop.src} → ${c.hop.dst} · p.${c.hop.page??"?"} · ${Ye[j].label}`})]},c.id)}),[...a.nodes.values()].map(c=>{const h=p.pos.get(c.k),w=no(c),S=c.side==="self",E=S?11:8,j=y&&!y.has(c.k),x=(l==null?void 0:l.type)==="node"&&l.k===c.k;return o.jsxs("g",{transform:`translate(${h.x},${h.y})`,tabIndex:0,role:"button","aria-label":L(c),"aria-pressed":x,className:`g-node${S?" is-self":""}${j?" is-dim":""}${x?" is-selected":""}`,"data-k":c.k,onMouseEnter:()=>g(c.k),onMouseLeave:()=>g(null),onFocus:()=>g(c.k),onBlur:()=>g(null),onClick:()=>i({type:"node",k:c.k}),onKeyDown:v(()=>i({type:"node",k:c.k})),children:[w==="design"&&!S&&o.jsx("circle",{className:"glow",r:E*2.2}),o.jsx("circle",{className:"halo",r:E+5}),o.jsx("circle",{className:`dot tone-${w}${c.lineage_known===!1?" unread":""}`,r:E}),o.jsx("text",{className:"lk",y:-E-9,textAnchor:"middle",children:c.k}),o.jsxs("text",{className:"ln",y:E+16,textAnchor:"middle",children:[it(c.name,26)," · ",Ac(c.decision_date)]})]},c.k)}),a.hidden>0&&o.jsxs("g",{className:"g-more",tabIndex:0,role:"button",transform:`translate(14, ${p.height-40})`,"aria-label":`Show ${a.hidden} more ancestors in generations ${a.hiddenGens.join(", ")}`,onClick:()=>n(Math.max(...a.hiddenGens)),onKeyDown:v(()=>n(Math.max(...a.hiddenGens))),children:[o.jsx("rect",{width:"212",height:"28",rx:"14"}),o.jsxs("text",{x:"106",y:"18.5",textAnchor:"middle",children:["+ ",a.hidden," more in generation",a.hiddenGens.length>1?`s ${a.hiddenGens[0]}–${a.hiddenGens[a.hiddenGens.length-1]}`:` ${a.hiddenGens[0]}`]})]})]})}),o.jsxs("div",{className:"g-legend","aria-label":"Legend",children:[o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-design"}),"design-related recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-recall"}),"other recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-clean"}),"no recall record"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-unread"}),"own predicates unread"]}),o.jsx("span",{className:"sep","aria-hidden":"true"}),["confirmed","extracted","disputed","conditional"].map(c=>o.jsxs("span",{className:`status status-${c}`,children:[o.jsx("span",{className:"line"}),Ye[c].short]},c)),o.jsxs("span",{className:"status",style:{color:"var(--amber)"},children:[o.jsx("span",{className:"line"}),"critical chain"]})]}),o.jsx("div",{className:"graph-hint",children:"Select any device or thread for its record, quote, page and source PDF. Tab moves between them; Enter opens."})]})}const Rt=28,Mr=34,di=260,at=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Qp(e,t){const n=new Map,r=(u,d,f,p)=>{n.has(u.k)||n.set(u.k,{...u,side:d,gen:f,parent:p,children:[]})};r({...e.device,k:e.k},"self",0,null);for(const u of e.ancestors)u.gen<=t&&r(u,"up",u.gen,u.chain[u.chain.length-2]);for(const u of e.descendants)r(u,"down",u.gen,u.chain[u.chain.length-2]);for(const u of n.values())u.parent&&n.has(u.parent)&&n.get(u.parent).children.push(u.k);const l=(u,d)=>(n.get(u).decision_date||"").localeCompare(n.get(d).decision_date||""),i=[],s=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="down").sort(l).reverse())s(d),i.push(d)},a=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="up").sort(l).reverse())i.push(d),a(d)};return s(e.k),i.push(e.k),a(e.k),{nodes:n,order:i}}function Kp({a:e,depth:t,highlight:n,onSelect:r}){const l=_.useRef(null),[i,s]=_.useState(1e3);_.useEffect(()=>{const x=()=>l.current&&s(Math.max(760,l.current.clientWidth));x();const R=new ResizeObserver(x);return R.observe(l.current),()=>R.disconnect()},[]);const{nodes:a,order:u}=_.useMemo(()=>Qp(e,t),[e,t]),d=new Map(u.map((x,R)=>[x,R])),f=[];for(const x of a.values()){x.decision_date&&f.push(at(x.decision_date));for(const R of x.recalls||[])R.initiated&&f.push(at(R.initiated))}const p=new Date(Math.min(...f)).getUTCFullYear(),m=new Date(Math.max(...f)).getUTCFullYear()+1,g=Date.UTC(p,0,1),y=Date.UTC(m,0,1),k=i-di-40,L=x=>16+(x-g)/(y-g)*k,v=x=>Mr+x*Rt+Rt/2,c=Mr+u.length*Rt+16,h=new Set(n||[]),w=new Set;if(n)for(let x=0;x+1"+n[x+1]);const S=m-p>24?4:m-p>12?2:1,E=[];for(let x=p;x<=m;x+=S)E.push(x);const j=L(at(e.device.decision_date));return o.jsx("div",{className:"graph-wrap",ref:l,"data-testid":"timeline",children:o.jsxs("svg",{width:i,height:c,role:"group","aria-label":`Lineage timeline for ${e.k}`,children:[E.map(x=>o.jsxs("g",{children:[o.jsx("line",{className:"tl-grid",x1:L(Date.UTC(x,0,1)),x2:L(Date.UTC(x,0,1)),y1:Mr-8,y2:c-8}),o.jsx("text",{className:"tl-axis",x:L(Date.UTC(x,0,1)),y:18,textAnchor:"middle",children:x})]},x)),o.jsx("rect",{x:0,y:v(d.get(e.k))-Rt/2,width:i,height:Rt,className:"tl-band"}),o.jsx("line",{className:"tl-clear",x1:j,x2:j,y1:Mr-8,y2:c-8}),[...a.values()].filter(x=>x.parent&&a.has(x.parent)).map(x=>{const[R,T]=x.side==="up"?[x.parent,x.k]:[x.k,x.parent],I=a.get(R),K=a.get(T);if(!I.decision_date||!K.decision_date)return null;const me=L(at(I.decision_date)),We=v(d.get(R)),Y=L(at(K.decision_date)),Xe=v(d.get(T)),M=(me+Y)/2;return o.jsx("path",{d:`M${me-6},${We} C${M},${We} ${M},${Xe} ${Y+7},${Xe}`,className:"tl-edge"+(w.has(R+">"+T)?" on":"")},R+T)}),u.map((x,R)=>{const T=a.get(x);if(!T.decision_date)return null;const I=L(at(T.decision_date)),K=v(R),me=no(T),We=h.size&&!h.has(x);return o.jsxs("g",{className:"tl-row g-node",style:{opacity:We?.3:1},tabIndex:0,role:"button","aria-label":`${x} ${T.name}, cleared ${T.decision_date}, ${(T.recalls||[]).length} recall records`,onClick:()=>r({type:"node",k:x}),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),r({type:"node",k:x}))},children:[o.jsx("rect",{className:"tl-rowhit",x:0,y:K-Rt/2,width:i,height:Rt}),(T.recalls||[]).map(Y=>Y.initiated&&o.jsxs("g",{children:[o.jsx("line",{className:"tl-rlink",x1:I,x2:L(at(Y.initiated)),y1:K,y2:K}),o.jsx("path",{d:`M${L(at(Y.initiated))},${K-5} l5,5 l-5,5 l-5,-5 z`,className:"tl-dia "+(Y.design_related?"design":"other"),children:o.jsx("title",{children:`${Y.id} · ${Y.classification||"unclassified"} · ${Y.root_cause} · began ${Y.initiated}`})})]},Y.id)),o.jsx("circle",{cx:I,cy:K,r:x===e.k?7:5.5,className:`dot tone-${me}${T.lineage_known===!1?" unread":""}`,style:x===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),o.jsxs("text",{x:i-di+8,y:K+4,className:"tl-label",children:[o.jsx("tspan",{className:"lk",children:x}),o.jsx("tspan",{dx:"7",children:it(T.name,24)})]}),o.jsx("text",{x:i-di-6,y:K+4,textAnchor:"end",className:"tl-gen",children:T.side==="self"?"candidate":T.side==="up"?`G-${T.gen}`:`D+${T.gen}`})]},x)})]})})}function Bc({text:e,k:t,ocr:n}){if(!e)return o.jsx("p",{className:"quote muted",children:"No quote stored for this citation."});const r=t?e.split(new RegExp(`(${t.replace(/^K/,"K\\s?")})`)):[e];return o.jsxs("blockquote",{className:"quote"+(n?" is-ocr":""),children:["“",/^[a-z]/.test(e)?"…":"",r.map((l,i)=>i%2?o.jsx("mark",{children:l},i):o.jsx(wl.Fragment,{children:l},i)),"”"]})}function Gp({hop:e}){const t=_t(e);return o.jsxs("span",{className:`status status-${t.key}`,children:[o.jsx("span",{className:"line"}),Ye[t.key].label]})}function Hc({r:e}){const t=Lp(e),n=Wc[xa(e)];return o.jsxs("div",{className:"recall","data-attribution":xa(e),children:[o.jsxs("div",{className:"recall-h",children:[o.jsx("span",{className:`chip tone-${t}`,children:t==="design"?"Design-related":t==="class1"?"Class I, other cause":"Other cause"}),o.jsx("span",{className:"k mono",children:e.id}),o.jsxs("span",{className:"muted",children:[e.classification||"Unclassified"," · ",e.root_cause||"cause not stated"," · began ",Ue(e.initiated)]}),e.url&&o.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:"FDA record ↗"})]}),o.jsxs("div",{className:"recall-r",children:[o.jsx("span",{className:`chip tone-${n.tone}`,title:n.text,children:n.short})," ",o.jsx("span",{className:"muted small",children:n.text})]}),e.linked_before_clearance&&o.jsxs("div",{className:"recall-r","data-testid":"recall-predates",children:[o.jsx("span",{className:"chip tone-muted",title:ui.text,children:ui.short})," ",o.jsx("span",{className:"muted small",children:ui.text})]}),e.reason&&o.jsx("div",{className:"recall-r",children:e.reason}),e.status&&o.jsxs("div",{className:"recall-r",children:["Status: ",e.status,e.event?` · event ${e.event}`:"",e.firm?` · ${e.firm}`:""]})]})}function wn(e,t){return t===e.k?{...e.device,k:e.k,gen:0,side:"self"}:e.ancestors.find(n=>n.k===t)&&{...e.ancestors.find(n=>n.k===t),side:"up"}||e.descendants.find(n=>n.k===t)&&{...e.descendants.find(n=>n.k===t),side:"down"}||null}function Yp({sel:e,a:t,onClose:n,go:r,reload:l,onSelect:i}){const s=_.useRef(null),a=_.useRef(null);return _.useEffect(()=>{var f;const u=document.activeElement;(f=a.current)==null||f.focus();const d=p=>{if(p.key==="Escape"&&n(),p.key==="Tab"&&s.current){const m=s.current.querySelectorAll('a[href], button:not([disabled]), input, textarea, [tabindex="0"]');if(!m.length)return;const g=m[0],y=m[m.length-1];p.shiftKey&&document.activeElement===g?(p.preventDefault(),y.focus()):!p.shiftKey&&document.activeElement===y&&(p.preventDefault(),g.focus())}};return addEventListener("keydown",d),()=>{var p;removeEventListener("keydown",d),(p=u==null?void 0:u.focus)==null||p.call(u)}},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:n}),o.jsx("aside",{className:"drawer",ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"drawer-title","data-testid":"provenance",children:e.type==="edge"?o.jsx(Xp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(Zp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function is({eyebrow:e,children:t,closeBtn:n,onClose:r}){return o.jsxs("div",{className:"drawer-head",children:[o.jsxs("div",{className:"t",children:[o.jsx("p",{className:"eyebrow",children:e}),o.jsx("h2",{id:"drawer-title",children:t})]}),o.jsx("button",{ref:n,className:"btn btn-quiet",onClick:r,"aria-label":"Close provenance (Escape)",children:"✕"})]})}function Xp({sel:e,a:t,closeBtn:n,onClose:r,go:l,reload:i,onSelect:s}){const a=e.hop,u=wn(t,a.src)||{},d=wn(t,a.dst)||{},f=_t(a),[p,m]=_.useState(!1),[g,y]=_.useState(null),k=a.source_url||u.summary_url,L=(a.text_source||u.text_source)&&(a.text_source||u.text_source)!=="pdf_text_layer",v=async c=>{m(!0),y(null);try{const h=await Ie.review(a.src,a.dst,c);y({ok:!0,text:c?`Recorded: ${c}. The assessment has been recomputed from the graph.`:"Review cleared. The assessment has been recomputed."}),s({...e,hop:{...a,review:(h==null?void 0:h.review)??(c||null),reviewer:(h==null?void 0:h.reviewer)??(c?"user":null)}}),i()}catch(h){y({ok:!1,text:h.message})}finally{m(!1)}};return o.jsxs(o.Fragment,{children:[o.jsxs(is,{eyebrow:"Citation provenance",closeBtn:n,onClose:r,children:[o.jsx("span",{className:"k",children:a.src})," cites ",o.jsx("span",{className:"k",children:a.dst})]}),o.jsxs("div",{className:"drawer-body",children:[o.jsxs("div",{className:"drawer-sec",children:[o.jsx(Gp,{hop:a}),f.reasons.length>0&&o.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:"var(--ink-2)",fontSize:12.5},children:f.reasons.map(c=>o.jsx("li",{children:Oc[c]||c},c))}),f.key==="conditional"&&o.jsxs("p",{className:"note-box violet",style:{marginTop:10},children:["Recall signals reached through this thread are ",o.jsx("b",{children:"conditional"}),": they hold only if this citation is a predicate. Read the page, then confirm or reject it: your review rewrites the verdict."]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"What the summary says"}),o.jsx(Bc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:zp(k,a.page),target:"_blank",rel:"noreferrer","data-testid":"pdf-page-link",children:[o.jsx("span",{className:"sheet",children:o.jsxs("b",{children:["p.",a.page??"?"]})}),o.jsxs("span",{className:"tx",children:[o.jsxs("b",{children:["Open the original FDA PDF",a.page?` at page ${a.page}`:""," ↗"]}),o.jsxs("span",{children:[a.src," 510(k) summary · accessdata.fda.gov"]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Source and extraction"}),o.jsxs("dl",{className:"prov-grid",children:[o.jsx("dt",{children:"Citing device"}),o.jsxs("dd",{children:[a.src," · ",it(u.name,40),u.decision_date?` · ${Ue(u.decision_date)}`:""]}),o.jsx("dt",{children:"Cited device"}),o.jsxs("dd",{children:[a.dst," · ",it(d.name,40),d.decision_date?` · ${Ue(d.decision_date)}`:""]}),o.jsx("dt",{children:"Role"}),o.jsx("dd",{children:a.kind||"predicate"}),o.jsx("dt",{children:"Page"}),o.jsx("dd",{children:a.page??"not recorded"}),o.jsx("dt",{children:"Text source"}),o.jsx("dd",{children:Mp[a.text_source||u.text_source]||a.text_source||u.text_source||"not recorded"}),o.jsx("dt",{children:"Extraction"}),o.jsxs("dd",{children:[a.method||"—",a.confidence!=null?` · confidence ${a.confidence}`:""]}),o.jsx("dt",{children:"Name check"}),o.jsx("dd",{children:a.name_check||"—"}),o.jsx("dt",{children:"FDA panel"}),o.jsx("dd",{children:a.panel_check||"—"}),a.audit&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Audit"}),o.jsxs("dd",{children:[a.audit,a.audit_note?` — ${a.audit_note}`:""]})]}),a.ai_label&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"LLM label"}),o.jsxs("dd",{children:[a.ai_label," (optional triage; never a verdict input on its own)"]})]}),o.jsx("dt",{children:"Review"}),o.jsx("dd",{children:a.review?`${a.review} by ${a.reviewer||"unknown"}`:"not reviewed by a person"}),u.summary_sha256&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"PDF SHA-256"}),o.jsx("dd",{children:o.jsx("span",{className:"mono",children:u.summary_sha256})})]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Your review"}),o.jsxs("div",{className:"drawer-acts",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="confirmed"?"":"confirmed"),children:a.review==="confirmed"?"Clear confirmation":"Confirm citation"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="rejected"?"":"rejected"),children:a.review==="rejected"?"Restore citation":"Reject citation"})]}),o.jsx("p",{className:"note",style:{marginTop:8},children:"A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately."}),g&&o.jsx("p",{className:g.ok?"ok":"err",role:"status",children:g.text})]}),o.jsxs("div",{className:"drawer-acts",children:[o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.dst}),children:[a.dst," record →"]}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.src}),children:[a.src," record →"]})]})]})]})}function Zp({sel:e,a:t,closeBtn:n,onClose:r,go:l,onSelect:i}){var p,m;const s=wn(t,e.k);if(!s)return o.jsxs(o.Fragment,{children:[o.jsx(is,{eyebrow:"Device",closeBtn:n,onClose:r,children:e.k}),o.jsx("div",{className:"drawer-body",children:"Not in this view."})]});const a=[...s.recalls||[]].sort((g,y)=>y.design_related-g.design_related||(g.initiated||"").localeCompare(y.initiated||"")),u=ro(a),d=s.side==="self"?"Candidate":s.side==="up"?{1:"Direct predicate",2:"Grand-predicate"}[s.gen]||`Generation ${s.gen} ancestor`:`Later device citing this lineage (+${s.gen})`,f=a.filter(g=>g.initiated&&t.device.decision_date&&g.initiated1&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Route"}),o.jsx("dd",{className:"mono",style:{fontSize:12},children:s.chain.join(" → ")})]})]}),o.jsxs("div",{className:"drawer-acts",children:[s.k!==t.k&&o.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>l("check",s.k),children:["Investigate ",s.k," ",o.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),o.jsx("a",{className:"btn btn-line btn-sm",href:Fc(s.k),target:"_blank",rel:"noreferrer",children:"FDA 510(k) record ↗"}),s.summary_url&&o.jsx("a",{className:"btn btn-line btn-sm",href:s.summary_url,target:"_blank",rel:"noreferrer",children:"Summary PDF ↗"}),s.lineage_known===!1&&o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>l("ingest",s.k),children:"Try to read its summary"})]}),((m=s.hops)==null?void 0:m.length)>0&&o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"How it is reached"}),o.jsx("div",{className:"tags",children:s.hops.map(g=>o.jsxs("button",{className:"tag-btn",onClick:()=>i({type:"edge",id:g.src+">"+g.dst,hop:g}),children:[o.jsx("span",{className:"k",children:g.src})," → ",o.jsx("span",{className:"k",children:g.dst})," · p.",g.page??"?"," · ",Ye[_t(g).key].short]},g.src+g.dst))})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsxs("h3",{children:["Recall records on which FDA lists this 510(k) · ",u.events," event(s), ",u.records," product record(s)"]}),s.side!=="self"&&f.length>0&&o.jsxs("p",{className:"note-box amber",style:{marginBottom:10},children:[f.length," of these record(s) began before ",t.k," was cleared on ",Ue(t.device.decision_date),"."]}),a.length===0?o.jsx("p",{className:"muted",children:"openFDA lists this 510(k) on no recall record."}):o.jsx("div",{style:{display:"grid",gap:8},children:a.slice(0,20).map(g=>o.jsx(Hc,{r:g},g.id))}),a.length>20&&o.jsxs("p",{className:"muted small",children:["+ ",a.length-20," more record(s): open the device to see all."]})]})]})]})}const Jp={rejected_by_reviewer:"rejected by a reviewer",audit_not_predicate:"the audit found it is not a predicate citation",audit_error:"the audit found a K-number error",audit_unresolved:"the audit could not resolve it",not_in_openfda:"K-number not found in openFDA",cleared_after_citing_device:"K-number cleared after the citing device",audit_variant:"audit marked it a naming variant",audit_corrected:"K-number corrected by the audit"};function Qc(e){const t=[];for(const n of e.signals)switch(n.code){case"DIRECT_RECALL":if(n.severity==="info")break;t.push({id:n.code,tone:n.severity==="high"?"alert":"amber",sev:n.severity,title:n.title,what:"The candidate itself appears in FDA recall records.",why:n.severity==="high"?"A design-related recall on the device you would cite is what FDA's 2023 draft guidance asks you to avoid or explain.":"A Class I recall on the candidate is a documented question for any submission that cites it.",todo:"Open each recall record and document how it is addressed (scope, lots, corrective action).",node:e.k});break;case"ANCESTOR_RECALL":if(n.severity!=="medium")break;t.push({id:n.code+n.chain.join(),tone:n.conditional?"violet":"amber",sev:n.severity,title:n.title,conditional:n.conditional,what:n.conditional?"The recall holder is reached only through a citation the audit could not resolve.":`A ${n.gen===1?"direct predicate":"grand-predicate"} carries recall records the verdict rules treat as review-worthy.`,why:n.conditional?"If that citation is not a predicate, this recall does not belong to the lineage; if it is, it does.":"Reviewers expect the predicate rationale to address design-related recalls in the lineage (FDA 2023 draft guidance; Kadakia et al., JAMA 2023, an association).",todo:n.conditional?"Open the uncertain thread, read the PDF page, and confirm or reject it.":"Verify the citation on its PDF page, read the recall records, and record how the rationale addresses them.",chain:n.chain,hops:n.evidence.filter(r=>r.type==="citation")});break;case"UNCERTAIN_LINK_IN_LINEAGE":case"NAME_MISMATCH_IN_LINEAGE":t.push({id:n.code,tone:"alert",sev:"info",title:n.title,what:"Threads in this ancestry rest on evidence that conflicts with FDA records or needed correction.",why:"A doubtful thread may route the lineage to the wrong device, and the right one may be missing; these links never count as checked.",todo:"Open each thread, compare the quote with the cited device, then confirm or reject it.",hops:n.evidence.filter(r=>r.type==="citation")});break;case"PREDICATE_CITATION_UNRESOLVED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Predicate citations printed in a summary did not become lineage threads.",why:"A missing thread means part of the ancestry is invisible: a recall there would not show.",todo:"Check each quote. If the citation is real and the K-number valid, add that clearance to extend the graph.",missing:n.evidence});break;case"LINEAGE_UNKNOWN":case"LINEAGE_TRUNCATED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Some summaries are not machine-readable, so the ancestry stops there.",why:"Recalls further up those branches cannot be seen. The verdict reports this gap; it never fills it in.",todo:"Try reading each summary live (needs internet), which extends the lineage by one generation.",ingest:n.code==="LINEAGE_UNKNOWN"?[{k:e.k}]:n.evidence});break;case"UNATTRIBUTED_RECALLS_IN_PRODUCT_CODE":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"FDA filed these recalls under the product code without naming a 510(k) number.",why:"No lineage query can attribute them; one may still concern a device in this lineage.",todo:"Read the product descriptions and check whether any names a device in this ancestry.",recalls:n.evidence});break;case"RECALL_CAUSE_OR_CLASS_UNKNOWN":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Recall records without a stated root cause or FDA classification.",why:"They cannot be ruled out as design-related or Class I, so they could change the verdict once classified.",todo:"Re-check the FDA records for an updated classification or root cause.",recalls:n.evidence});break;case"DEEPER_ANCESTRY_GAPS":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Gaps beyond the two-generation verdict window.",why:"They cannot change the verdict, but the lower-severity list may be incomplete.",todo:"Expand the graph to deeper generations if the deeper ancestry matters to your rationale."});break}return t}function qp({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Qc(e);return l.length?o.jsx("div",{"data-testid":"review-queue",children:l.map(i=>{var s,a,u,d;return o.jsxs("section",{className:`review-item tone-${i.tone}`,onMouseEnter:()=>i.chain&&r(i.chain),onMouseLeave:()=>r(null),children:[o.jsxs("h3",{children:[o.jsx("span",{className:`sev sev-${i.sev}`,children:i.conditional?"conditional":i.sev==="info"?"gap":i.sev}),o.jsx("span",{children:i.title})]}),o.jsxs("dl",{children:[o.jsx("dt",{children:"Conflict"}),o.jsx("dd",{children:i.what}),o.jsx("dt",{children:"Why it matters"}),o.jsx("dd",{children:i.why}),o.jsx("dt",{children:"Next step"}),o.jsx("dd",{children:i.todo})]}),((s=i.hops)==null?void 0:s.length)>0&&o.jsx("div",{className:"links",children:i.hops.slice(0,8).map(f=>{const p=_t(f);return o.jsxs("button",{className:"tag-btn",onClick:()=>t({type:"edge",id:f.src+">"+f.dst,hop:f}),title:p.reasons.map(m=>Oc[m]).join("; ")||Ye[p.key].label,children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.dst})," · p.",f.page??"?"," · ",o.jsx("span",{className:`status-${p.key}`,children:Ye[p.key].short})]},f.src+f.dst)})}),((a=i.missing)==null?void 0:a.length)>0&&o.jsx("div",{className:"links",children:i.missing.slice(0,8).map(f=>o.jsxs("button",{className:"tag-btn",title:f.quote||"",onClick:()=>n("ingest",f.cited),children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.cited})," · ",Jp[f.reason]||f.reason]},f.src+f.cited))}),((u=i.ingest)==null?void 0:u.length)>0&&o.jsx("div",{className:"links",children:i.ingest.slice(0,10).map(f=>o.jsxs("button",{className:"tag-btn",onClick:()=>n("ingest",f.k),children:[o.jsx("span",{className:"k",children:f.k}),f.summary_status?` · ${f.summary_status}`:""," · read now"]},f.k))}),((d=i.recalls)==null?void 0:d.length)>0&&o.jsx("div",{className:"links",children:i.recalls.slice(0,8).map(f=>f.url?o.jsxs("a",{className:"tag-btn",href:f.url,target:"_blank",rel:"noreferrer",children:[f.id," ↗"]},f.id):o.jsx("span",{className:"tag-btn",children:f.id},f.id))}),i.node&&o.jsx("div",{className:"acts",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.node}),children:"Open recall records"})}),i.chain&&o.jsx("div",{className:"acts",children:o.jsxs("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.chain[i.chain.length-1]}),children:["Open ",i.chain[i.chain.length-1]," records"]})})]},i.id)})}):o.jsx("p",{className:"muted",children:"Nothing in this lineage needs a person's attention under the current rules."})}function lo(e){const t=e.signals.filter(n=>{var r;return(n.severity==="high"||n.severity==="medium")&&((r=n.chain)==null?void 0:r.length)>1});return t.find(n=>!n.conditional)||t[0]||null}function ss(e,t){const n=e.filter(i=>i.design_related),r=n.length?n:e.filter(i=>i.classification==="Class I");return r.filter(i=>i.initiated&&t&&i.initiatedi.initiated.localeCompare(s.initiated))[0]||[...r].sort((i,s)=>(s.initiated||"").localeCompare(i.initiated||""))[0]||null}function bp({a:e}){const t=e.device,n=lo(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=ss(r.evidence.filter(i=>i.type==="recall"),null);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[o.jsx("span",{className:"k",children:e.k})," itself appears in FDA recall records",l&&o.jsxs(o.Fragment,{children:[": a ",o.jsxs("span",{className:"amber",children:[l.classification||"unclassified"," ",l.root_cause]})," recall began ",Ue(l.initiated)]}),"."," ","Citing it as a predicate would need that addressed."]})}if(n){const l=wn(e,n.chain[n.chain.length-1]),i=n.evidence.filter(f=>f.type==="recall"),s=ss(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Uc(s.initiated,t.decision_date):null,d=ro(i);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[it(t.name,48)," cites ",o.jsx("span",{className:"k",children:n.chain[1]}),a!=null&&a.page?o.jsxs(o.Fragment,{children:[" on page ",a.page," of its summary"]}):null,"."," ",n.conditional?o.jsxs(o.Fragment,{children:["The cited device ",o.jsx("span",{className:"k",children:l==null?void 0:l.k}),", reached through a citation the audit could not resolve,"]}):n.chain.length>2?o.jsxs(o.Fragment,{children:["Through it, ",n.gen===2?"grand-predicate":`generation-${n.gen} ancestor`," ",o.jsx("span",{className:"k",children:l==null?void 0:l.k})]}):o.jsx(o.Fragment,{children:"That predicate"})," ","(",it(l==null?void 0:l.name,52),") is listed by FDA on ",d.events," recall event",d.events===1?"":"s"," in this signal",s&&o.jsxs(o.Fragment,{children:[", including a ",o.jsxs("span",{className:"amber",children:[s.classification||"unclassified"," ",s.root_cause]})," recall that began ",Ue(s.initiated),u&&o.jsxs(o.Fragment,{children:[", ",u.relation==="before"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",e.k," was cleared"]}):Vc(u,e.k)]})]}),".",n.conditional&&o.jsxs(o.Fragment,{children:[" This route is ",o.jsx("b",{style:{color:"var(--violet)"},children:"conditional"}),": it holds only if that citation is a predicate."]})]})}return o.jsx("p",{className:"finding-sentence","data-testid":"finding-sentence",children:e.verdict_reason})}function eh({a:e,onSelect:t}){const n=lo(e);if(!n)return null;const r=n.evidence.filter(d=>d.type==="citation"),l=(d,f)=>{var p,m;return r.find(g=>g.src===d&&g.dst===f)||((m=(p=wn(e,f))==null?void 0:p.hops)==null?void 0:m.find(g=>g.src===d&&g.dst===f))},i=n.chain[n.chain.length-1],s=n.evidence.filter(d=>d.type==="recall"),a=ss(s,e.device.decision_date),u=a?Uc(a.initiated,e.device.decision_date):null;return o.jsxs("section",{className:"panel corner-marks","aria-labelledby":"chain-title","data-testid":"critical-chain",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"chain-title",children:["Critical chain ",o.jsx("span",{className:"count",children:"predicate → recall, the route that raised the verdict"})]}),o.jsx("p",{className:"hint",children:"Select a thread for its page and quote."})]}),o.jsx("div",{className:"chain",children:n.chain.map((d,f)=>{const p=wn(e,d)||{},m=f===0?"Candidate":n.conditional?"Cited device · citation unresolved":f===1?"Direct predicate":f===2?"Grand-predicate":`Generation ${f}`,g=d===i,y=g?no({recalls:s}):"none",k=f>0?l(n.chain[f-1],d):null,L=k?_t(k):null;return o.jsxs(wl.Fragment,{children:[f>0&&o.jsxs("button",{className:`chain-link st-${(L==null?void 0:L.key)||"extracted"}`,onClick:()=>k&&t({type:"edge",id:k.src+">"+k.dst,hop:k}),"aria-label":`${n.chain[f-1]} cites ${d}${k!=null&&k.page?` on page ${k.page}`:""}, ${Ye[(L==null?void 0:L.key)||"extracted"].label}. Open provenance.`,children:[o.jsxs("span",{className:"lbl",children:["cites",k!=null&&k.page?` · p.${k.page}`:""]}),o.jsx("span",{className:"sub",children:Ye[(L==null?void 0:L.key)||"extracted"].short})]}),o.jsxs("button",{className:`chain-node${f===0?" is-self":""}${y==="design"?" tone-design":""}`,onClick:()=>t({type:"node",k:d}),children:[o.jsx("span",{className:"role",children:m}),o.jsx("span",{className:"k",children:d}),o.jsx("span",{className:"nm",children:it(p.name,44)}),o.jsxs("span",{className:"dt",children:["Cleared ",Ue(p.decision_date)]}),g&&a&&o.jsxs("span",{className:"rc",children:[o.jsxs("span",{className:`chip tone-${a.design_related?"design":"class1"}`,children:[a.classification||"Unclassified"," · ",a.root_cause]}),o.jsxs("span",{className:"dt",children:["Recall began ",Ue(a.initiated)," · ",o.jsx("span",{className:"mono",children:a.id})]})]})]})]},d)})}),a&&u&&o.jsxs("div",{className:"chain-timing",children:[o.jsxs("span",{className:"chip tone-amber",children:[o.jsx("span",{className:"glyph"}),Vc(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[ro(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function th({k:e,go:t,onChanged:n}){var Y,Xe;const[r,l]=_.useState(null),[i,s]=_.useState(null),[a,u]=_.useState(!1),[d,f]=_.useState(4),[p,m]=_.useState(2),[g,y]=_.useState("graph"),[k,L]=_.useState(!1),[v,c]=_.useState(null),[h,w]=_.useState(null),[S,E]=_.useState([]),[j,x]=_.useState([]),R=()=>{u(!0),s(null),Ie.assess(e,d).then(M=>{l(M)}).catch(M=>{l(null),s(M.message)}).finally(()=>u(!1)),Ie.assessments(e).then(E).catch(()=>E([])),Ie.investigations(e,10).then(x).catch(()=>x([]))};if(_.useEffect(()=>{c(null),m(2),R()},[e,d]),i)return o.jsxs("div",{className:"panel",role:"alert",children:[o.jsx("p",{className:"err",style:{fontSize:15},children:i}),i.includes("not in the graph")&&o.jsxs("button",{className:"btn btn-primary",onClick:()=>t("ingest",e),children:["Read ",e," from FDA now ",o.jsx("span",{className:"arr",children:"→"})]})]});if(!r)return o.jsxs("div",{"aria-busy":"true",children:[o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Walking ",e,"'s lineage in the Relate graph…"]}),o.jsx("div",{className:"skeleton",style:{height:210,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:160,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:380}})]});const T=r.device,I=r.coverage,K={...Qn[r.verdict],...Ip(r.verdict,I.evidence)},me=Qc(r).length,We=r.signals.filter(M=>M.conditional).length;return o.jsxs("div",{className:"investigation","aria-busy":a,children:[o.jsxs("section",{className:`finding tone-${K.tone}`,"aria-labelledby":"finding-title","data-testid":"finding",children:[o.jsxs("div",{className:"finding-top",children:[o.jsxs("div",{className:"finding-id",children:[o.jsxs("div",{className:"kline",children:[o.jsx("span",{className:"k",children:r.k}),o.jsxs("span",{children:[T.product_code,(Y=T.product)!=null&&Y.name?` · ${T.product.name}`:""]})]}),o.jsx("h1",{id:"finding-title",children:T.name}),o.jsxs("div",{className:"meta",children:[o.jsx("span",{children:T.applicant}),o.jsxs("span",{children:["Cleared ",Ue(T.decision_date)]}),o.jsx("span",{children:T.clearance_type||"510(k)"}),o.jsx("a",{href:Fc(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),T.summary_url&&o.jsx("a",{href:T.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),o.jsxs("div",{className:`verdict tone-${K.tone}`,"data-testid":"verdict",children:[o.jsxs("div",{className:"verdict-label",children:[o.jsx("i",{"aria-hidden":"true"}),K.label]}),o.jsx("p",{className:"verdict-reason",children:r.verdict_reason}),o.jsx("div",{className:"verdict-actions",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t("compare",r.k),children:"Compare with other candidates"})}),o.jsxs("div",{className:"authority",children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M8 1.5l5.5 2v4.2c0 3.3-2.3 5.8-5.5 6.8-3.2-1-5.5-3.5-5.5-6.8V3.5z M5.5 8l1.8 1.8L10.8 6.3"})}),o.jsxs("span",{children:[o.jsx("b",{children:"Deterministic assessment"})," · ",r.rules_version,". Authoritative within its documented scope: ",I.evidence_scope,", from machine-readable FDA records. A documentation signal, not a safety determination."]})]})]})]}),o.jsx(bp,{a:r}),o.jsxs("div",{className:"coverage-row","aria-label":"Evidence coverage",children:[o.jsxs("span",{className:`chip tone-${I.evidence==="complete"?"calm":I.evidence==="uncertain"?"alert":"muted"}`,title:"Completeness of evidence inside the verdict window",children:["Evidence ",I.evidence]}),(I.evidence_reasons||[]).map(M=>o.jsx("span",{className:"chip tone-muted","data-testid":"evidence-reason",children:Op[M]||M},M)),o.jsxs("span",{className:"chip",children:[I.ancestors," ancestors · ",I.generations_traversed," generations"]}),I.ancestors_lineage_unknown>0&&o.jsxs("span",{className:"chip tone-muted",children:[I.ancestors_lineage_unknown," with unread summaries"]}),I.doubtful_links>0&&o.jsxs("span",{className:"chip tone-alert",children:[I.doubtful_links," doubtful link(s)"]}),We>0&&o.jsxs("span",{className:"chip tone-violet",children:[We," conditional signal(s)"]}),me>0&&o.jsxs("a",{className:"chip tone-blue",href:"#review",onClick:M=>{var C;M.preventDefault(),(C=document.getElementById("review"))==null||C.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),o.jsx(eh,{a:r,onSelect:c}),o.jsxs("section",{className:"panel","aria-labelledby":"graph-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"graph-title",children:["Evidence graph ",o.jsxs("span",{className:"count",children:[r.ancestors.length," ancestors · ",r.descendants.length," later devices"]})]}),o.jsxs("div",{className:"graph-tools",children:[o.jsxs("div",{className:"seg",role:"group","aria-label":"View",children:[o.jsx("button",{"aria-pressed":g==="graph",onClick:()=>y("graph"),children:"Graph"}),o.jsx("button",{"aria-pressed":g==="timeline",onClick:()=>y("timeline"),children:"Timeline"})]}),o.jsxs("label",{className:"small muted",children:["Show ",o.jsx("select",{className:"field",value:p,onChange:M=>m(+M.target.value),"aria-label":"Generations shown",children:Array.from({length:d},(M,C)=>C+1).map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),o.jsxs("label",{className:"small muted",children:["Query ",o.jsx("select",{className:"field",value:d,onChange:M=>f(+M.target.value),"aria-label":"Generations traversed by the query",children:[2,3,4,5,6].map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),g==="graph"&&r.descendants.length>0&&o.jsxs("button",{className:"btn btn-line btn-sm","aria-pressed":k,onClick:()=>L(!k),children:[k?"Hide":"Show"," later devices"]})]})]}),g==="graph"?o.jsx(Hp,{a:r,depth:p,onDepth:m,descendants:k,selected:v,onSelect:c,focusChain:h}):o.jsx(Kp,{a:r,depth:p,highlight:h||((Xe=lo(r))==null?void 0:Xe.chain),onSelect:c}),o.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(M=>M.lineage_known).length," summary PDFs opened one generation at a time and ",1+r.ancestors.length," separate recall searches. Here it is one Relate query."]})]}),o.jsxs("div",{className:"grid-main",children:[o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("section",{className:"panel",id:"review","aria-labelledby":"review-title",style:{scrollMarginTop:120},children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"review-title",children:["What needs human review ",o.jsx("span",{className:"count",children:me})]}),o.jsx("p",{className:"hint",children:"What conflicts, why it matters, and what to do next."})]}),o.jsx(qp,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(nh,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(lh,{a:r,reload:R,go:t,onSelect:c}),o.jsx(ih,{a:r,onSaved:()=>{Ie.assessments(e).then(E),n&&n()}}),o.jsx(sh,{a:r,assessments:S,runs:j,go:t})]})]}),v&&o.jsx(Yp,{sel:v,a:r,onClose:()=>c(null),go:(M,C)=>{c(null),t(M,C)},reload:R,onSelect:c})]})}function nh({a:e,onSelect:t}){const n=e.signals.filter(r=>r.severity==="high"||r.severity==="medium"||r.severity==="low");return o.jsxs("section",{className:"panel","aria-labelledby":"signals-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"signals-title",children:["Recall signals ",o.jsxs("span",{className:"count",children:[n.length," in the readable ancestry"]})]}),o.jsx("p",{className:"hint",children:"Every recall record behind the verdict, by generation."})]}),n.length===0&&o.jsx("p",{className:"muted",children:"No recall records anywhere in the readable ancestry."}),n.map((r,l)=>o.jsx(rh,{s:r,onSelect:t},l))]})}function rh({s:e,onSelect:t}){var i;const[n,r]=_.useState(e.severity==="high"),l=e.evidence.filter(s=>s.type==="recall");return o.jsxs("div",{className:"signal",children:[o.jsxs("button",{className:"signal-head","aria-expanded":n,onClick:()=>r(!n),children:[o.jsx("span",{className:`sev sev-${e.severity}`,children:e.conditional?"cond.":e.severity}),o.jsx("span",{className:"t",children:e.title}),o.jsx("svg",{className:"chev",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M4 2l4 4-4 4",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})})]}),n&&o.jsxs("div",{className:"signal-body",children:[((i=e.chain)==null?void 0:i.length)>1&&o.jsx("div",{className:"tags",children:e.chain.map((s,a)=>o.jsxs(wl.Fragment,{children:[a>0&&o.jsx("span",{className:"muted small","aria-hidden":"true",children:"→"}),o.jsx("button",{className:"tag-btn",onClick:()=>t({type:"node",k:s}),children:o.jsx("span",{className:"k",children:s})})]},s))}),l.slice(0,6).map(s=>o.jsx(Hc,{r:s},s.id)),l.length>6&&o.jsxs("p",{className:"muted small",children:["+ ",l.length-6," more record(s): open ",e.chain[e.chain.length-1]," for all."]})]})]})}function lh({a:e,reload:t,go:n,onSelect:r}){const[l,i]=_.useState(null),[s,a]=_.useState(null),u=async(d,f,p)=>{i(d.dst+p),a(null);try{const m=await f();a(p==="ai"?{ok:!0,text:`LLM labelled ${d.dst} "${m.ai_label}" (${m.model.split("/")[1]}, ${m.seconds}s). Optional triage; a person's review overrides it.`}:null),t()}catch(m){a({ok:!1,text:m.message})}finally{i(null)}};return o.jsxs("section",{className:"panel","aria-labelledby":"cites-title",children:[o.jsx("div",{className:"panel-head",children:o.jsxs("h2",{id:"cites-title",children:["What ",e.k," cites ",o.jsx("span",{className:"count",children:e.citations.length})]})}),o.jsx("p",{className:"lede",children:"Read from its 510(k) summary. Your review is written to the graph and changes every lineage query."}),e.device.lineage_known===!1&&o.jsxs("p",{className:"note-box",children:["Summary not machine-readable (",e.device.summary_status,")."," ",o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>n("ingest",e.k),children:"Try reading it now →"})]}),s&&o.jsx("p",{className:s.ok?"ok":"err",role:"status",children:s.text}),e.citations.map(d=>{const f={...d,src:e.k},p=d.kind==="predicate"||d.ai_label==="predicate";return o.jsxs("div",{className:"cit"+(d.review==="rejected"?" is-rejected":""),children:[o.jsxs("div",{className:"cit-h",children:[o.jsx("button",{className:"k mono",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:d.dst}),o.jsx("span",{className:`chip ${d.kind==="predicate"?"tone-blue":"tone-muted"}`,children:d.kind}),p?o.jsxs("span",{className:`status status-${_t(f).key}`,children:[o.jsx("span",{className:"line"}),Ye[_t(f).key].short]}):o.jsx("span",{className:"status status-rejected",title:"Reference devices and mentions are not lineage links",children:"Not a lineage link"}),d.ai_label&&o.jsxs("span",{className:"chip tone-violet",title:d.ai_quote,children:["LLM: ",d.ai_label]}),o.jsxs("span",{className:"muted small",children:[it(d.name,34)," · ",Ac(d.dst_decision_date)]})]}),o.jsx(Bc,{text:d.quote||d.snippet,k:d.dst,ocr:d.text_source&&d.text_source!=="pdf_text_layer"}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Ie.review(e.k,d.dst,d.review==="confirmed"?"":"confirmed"),"ok"),children:d.review==="confirmed"?"Unconfirm":"Confirm"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Ie.review(e.k,d.dst,d.review==="rejected"?"":"rejected"),"no"),children:d.review==="rejected"?"Restore":"Reject"}),d.kind!=="predicate"&&o.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!!l,onClick:()=>u(d,()=>Ie.triage(e.k,d.dst),"ai"),children:l===d.dst+"ai"?"Asking…":"Ask LLM to label"}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:["Provenance · p.",d.page]})]})]},d.dst)})]})}function ih({a:e,onSaved:t}){const[n,r]=_.useState(!1),[l,i]=_.useState(""),[s,a]=_.useState(null),[u,d]=_.useState(!1);_.useEffect(()=>{a(null),r(!1),i("")},[e.k]);const f=async()=>{d(!0);try{const m=await Ie.save(e.k,l);a(m),r(!1),i(""),t()}catch(m){a({error:m.message})}finally{d(!1)}},p=e.memo.headline+` - -`+e.memo.paragraphs.map(m=>m.text).join(` - -`);return o.jsxs("section",{className:"panel memo","aria-labelledby":"memo-title",children:[o.jsx("div",{className:"panel-head",children:o.jsx("h2",{id:"memo-title",children:"Due-diligence note"})}),o.jsx("div",{className:"src",children:e.memo.source}),o.jsx("p",{children:o.jsx("b",{children:e.memo.headline})}),e.memo.paragraphs.slice(0,2).map((m,g)=>o.jsx("p",{children:m.text},g)),e.memo.paragraphs.length>2&&o.jsxs("p",{className:"muted small",children:["+ ",e.memo.paragraphs.length-2," more paragraph(s) in the copied note."]}),o.jsxs("div",{className:"cit-a",style:{marginTop:8},children:[o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>r(!n),"aria-expanded":n,children:"Save assessment to graph"}),o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>{var m;return(m=navigator.clipboard)==null?void 0:m.writeText(p)},children:"Copy note"})]}),n&&o.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[o.jsx("label",{className:"small muted",htmlFor:"analyst-note",children:"Optional analyst note, stored with the assessment"}),o.jsx("textarea",{id:"analyst-note",className:"field",rows:3,value:l,onChange:m=>i(m.target.value),maxLength:1e3}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-primary btn-sm",disabled:u,onClick:f,children:u?"Saving…":"Save to Relate"}),o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>r(!1),children:"Cancel"})]})]}),s&&(s.error?o.jsx("p",{className:"err",children:s.error}):o.jsxs("p",{className:"ok",role:"status",children:["Saved ",s.id,": linked to ",s.flagged_recalls.length," flagged recall record(s)."]}))]})}function sh({a:e,assessments:t,runs:n,go:r}){return o.jsxs("section",{className:"panel","aria-labelledby":"hist-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{id:"hist-title",children:"Investigation history"}),o.jsx("a",{className:"small",href:"#/history",children:"All history →"})]}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"0 0 8px"},children:"Saved assessments"}),t.length===0?o.jsxs("p",{className:"muted small",children:["None saved for ",e.k," yet."]}):t.map(l=>{var i,s,a,u,d,f;return o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"muted",children:(i=l.created_at)==null?void 0:i.slice(0,16).replace("T"," ")}),o.jsx("span",{className:`chip tone-${((s=Qn[l.verdict])==null?void 0:s.tone)||"muted"}`,children:((a=Qn[l.verdict])==null?void 0:a.label)||l.verdict})]}),l.stale&&o.jsxs("div",{className:"stale",children:["Stale: the graph changed after this was saved",l.verdict_now!==l.verdict&&o.jsxs(o.Fragment,{children:[" (verdict now ",((u=Qn[l.verdict_now])==null?void 0:u.label)||l.verdict_now,")"]}),((d=l.changed_edges)==null?void 0:d.length)>0&&o.jsxs(o.Fragment,{children:[" · reviewed links: ",l.changed_edges.join(", ")]}),((f=l.reingested)==null?void 0:f.length)>0&&o.jsxs(o.Fragment,{children:[" · re-ingested: ",l.reingested.join(", ")]})]})]},l.id)}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"16px 0 8px"},children:"Agent runs (optional)"}),o.jsx("p",{className:"muted small",style:{margin:"0 0 6px"},children:"Machine findings, never human-approved. The verdict above does not depend on them."}),n.length===0?o.jsxs("p",{className:"muted small",children:["No agent runs examined ",e.k," in this store."]}):n.map(l=>o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"chip",children:l.status}),l.stale&&o.jsx("span",{className:"stale",children:"stale"}),o.jsx("a",{href:kp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function oh({go:e,stats:t}){const n=[["K252078","BreathePal Bilevel","Cleared 2026 · direct predicate under a Class I design recall"],["K251770","SleepRes PAP System","Cleared 2025 · a second real lineage"],["K200480","DreamStation 2","Cleared 2020, before the June 2021 recall began"]];return o.jsxs("div",{className:"home-hero",children:[o.jsxs("div",{className:"page-head",children:[o.jsx("p",{className:"eyebrow",children:"Investigate"}),o.jsx("h1",{children:"Check a predicate's ancestry before you cite it."}),o.jsxs("p",{children:["Search any clearance above (press ",o.jsx("code",{children:"/"}),"), or open one of the real cases in the shipped dataset of CPAP, BiPAP and ventilator clearances."]})]}),o.jsxs("div",{className:"home-cases",children:[n.map(([r,l,i])=>o.jsxs("button",{className:"case",onClick:()=>e("check",r),children:[o.jsx("span",{className:"k mono",children:r}),o.jsx("h3",{children:l}),o.jsx("p",{children:i})]},r)),o.jsxs("button",{className:"case",onClick:()=>e("reach","88058,88071"),children:[o.jsx("span",{className:"k mono",children:"Recall 88058 + 88071"}),o.jsx("h3",{children:"Philips foam recall reach"}),o.jsx("p",{children:"Who descends from the June 2021 recall?"})]})]}),t&&o.jsxs("p",{className:"muted small",style:{marginTop:18},children:[t.nodes.Device.toLocaleString("en-US")," clearances · ",t.citations_by_kind.predicate.toLocaleString("en-US")," predicate links · ",t.nodes.Recall.toLocaleString("en-US")," recall records in the Relate store."]})]})}const ah={compare:_.lazy(()=>zt(()=>import("./Views-BGuMRYVR.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>zt(()=>import("./Views-BGuMRYVR.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>zt(()=>import("./Views-BGuMRYVR.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>zt(()=>import("./Views-BGuMRYVR.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>zt(()=>import("./History-o7tife4Q.js"),[])),method:_.lazy(()=>zt(()=>import("./Views-BGuMRYVR.js"),[]).then(e=>({default:e.MethodView})))},uh={check:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"}),compare:o.jsx("path",{d:"M2 3h5v10H2zM9 3h5v10H9z"}),reach:o.jsx("path",{d:"M3 8a5 5 0 1010 0A5 5 0 003 8zm3 0a2 2 0 104 0 2 2 0 00-4 0z"}),watch:o.jsx("path",{d:"M1.5 8S4 3 8 3s6.5 5 6.5 5S12 13 8 13 1.5 8 1.5 8zM8 10a2 2 0 100-4 2 2 0 000 4z"}),ingest:o.jsx("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M2 12v2h12v-2"}),history:o.jsx("path",{d:"M8 4v4l2.5 2M2.5 8a5.5 5.5 0 105.5-5.5A5.6 5.6 0 003 6M3 2.5V6h3.5"}),method:o.jsx("path",{d:"M3 2h7l3 3v9H3zM10 2v3h3M5.5 8h5M5.5 11h5"})},ch=({name:e})=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:uh[e]}),dh=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function fh({route:e,go:t,stats:n,statsErr:r,refreshStats:l,onReplay:i}){var u,d;const s=_.useRef(null);_.useEffect(()=>{var f;(f=s.current)==null||f.focus({preventScroll:!0})},[e.tab]);const a=ah[e.tab];return o.jsxs("div",{className:"ws",children:[o.jsxs("header",{className:"ws-top",children:[o.jsx("a",{className:"brand",href:"#/","aria-label":"Forebear home: the film",children:o.jsx(jp,{size:24})}),o.jsx(ph,{go:t}),o.jsx("span",{className:"spacer"}),o.jsxs("div",{className:"store-chip",title:"Live counts from the Relate single-file store",children:[o.jsx("i",{className:"dot"+(r?" off":""),"aria-hidden":"true"}),n?o.jsxs("span",{className:"counts",children:[o.jsx("b",{children:(u=n.nodes.Device)==null?void 0:u.toLocaleString("en-US")})," devices · ",o.jsx("b",{children:(d=n.nodes.Recall)==null?void 0:d.toLocaleString("en-US")})," recalls · Relate"]}):o.jsx("span",{children:r?"API unavailable":"Connecting…"})]})]}),o.jsxs("nav",{className:"ws-rail","aria-label":"Workspace",children:[dh.map(([f,p])=>o.jsxs(wl.Fragment,{children:[o.jsx("div",{className:"group",children:f}),p.map(([m,g])=>o.jsxs("a",{href:`#/${m}`,"aria-current":e.tab===m?"page":void 0,children:[o.jsx(ch,{name:m}),g]},m))]},f)),o.jsxs("div",{className:"rail-foot",children:["Verdicts are deterministic documentation signals from FDA records, not safety findings.",!matchMedia("(prefers-reduced-motion: reduce)").matches&&o.jsx("div",{style:{marginTop:10},children:o.jsx("button",{onClick:i,children:"Replay the film"})})]})]}),o.jsxs("main",{className:"ws-main",id:"main",ref:s,tabIndex:-1,style:{outline:"none"},children:[e.tab==="check"&&(e.arg?o.jsx(th,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(oh,{go:t,stats:n})),a&&o.jsx(_.Suspense,{fallback:o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Loading…"]}),children:o.jsx(a,{initial:e.arg,go:t,onChanged:l,stats:n})}),!a&&e.tab!=="check"&&o.jsx("div",{className:"panel",children:o.jsxs("p",{children:["Unknown page. ",o.jsx("a",{href:"#/check",children:"Go to the workspace →"})]})}),o.jsx("footer",{className:"ws-foot",children:"Public FDA data: openFDA 510(k), recall and enforcement records; 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."})]})]})}function ph({go:e}){const[t,n]=_.useState(""),[r,l]=_.useState([]),[i,s]=_.useState(!1),[a,u]=_.useState(0),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(clearTimeout(f.current),t.trim().length<2){l([]);return}let g=!0;return f.current=setTimeout(()=>Ie.search(t).then(y=>{g&&(l(y),u(0))}).catch(()=>g&&l([])),160),()=>{g=!1}},[t]),_.useEffect(()=>{const g=y=>{var k,L;y.key==="/"&&!/INPUT|TEXTAREA|SELECT/.test((k=document.activeElement)==null?void 0:k.tagName)&&(y.preventDefault(),(L=d.current)==null||L.focus())};return addEventListener("keydown",g),()=>removeEventListener("keydown",g)},[]);const p=g=>{var y;s(!1),n(""),(y=d.current)==null||y.blur(),e("check",g)},m=i&&r.length>0;return o.jsxs("div",{className:"search",role:"search",children:[o.jsx("svg",{className:"icon",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"})}),o.jsx("input",{ref:d,className:"field",value:t,placeholder:"Search a device or K-number","aria-label":"Search devices by name or K-number",role:"combobox","aria-expanded":m,"aria-controls":"search-results","aria-activedescendant":m?`sr-${a}`:void 0,"aria-autocomplete":"list",onChange:g=>{n(g.target.value),s(!0)},onFocus:()=>s(!0),onBlur:()=>setTimeout(()=>s(!1),150),onKeyDown:g=>{if(g.key==="ArrowDown")g.preventDefault(),u(y=>Math.min(y+1,r.length-1));else if(g.key==="ArrowUp")g.preventDefault(),u(y=>Math.max(y-1,0));else if(g.key==="Escape")s(!1),g.currentTarget.blur();else if(g.key==="Enter"){const y=t.trim().toUpperCase();/^K\d{6}$/.test(y)?p(y):r[a]&&p(r[a].k)}}}),!t&&o.jsx("kbd",{"aria-hidden":"true",children:"/"}),m&&o.jsx("ul",{className:"search-results",id:"search-results",role:"listbox",children:r.map((g,y)=>o.jsxs("li",{id:`sr-${y}`,role:"option","aria-selected":y===a,onMouseDown:()=>p(g.k),onMouseEnter:()=>u(y),children:[o.jsxs("span",{children:[o.jsx("span",{className:"k",children:g.k})," ",g.name]}),o.jsxs("small",{children:[g.applicant," · ",g.decision_date," · ",g.product_code]})]},g.k))})]})}const hh=_.lazy(()=>zt(()=>import("./Landing-Do6WwSBM.js"),[])),mh={about:"method"};function Fr(e=window.location.hash){if(!e.startsWith("#/"))return{tab:"film",arg:""};const t=e.replace(/^#\/?/,"");if(!t)return{tab:"film",arg:""};const[n,...r]=t.split("/");return{tab:mh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const vh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function gh(){const[e,t]=_.useState(Fr),[n,r]=_.useState(null),[l,i]=_.useState(null),s=Tp("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!Sp()&&!matchMedia("(prefers-reduced-motion: reduce)").matches),[d,f]=_.useState(a?"pending":"none");_.useEffect(()=>{document.documentElement.dataset.motion=s?"reduced":"full"},[s]),_.useEffect(()=>{const y=()=>t(Fr());return addEventListener("hashchange",y),()=>removeEventListener("hashchange",y)},[]);const p=_.useCallback((y=0)=>Ie.stats().then(k=>{r(k),i(null)}).catch(k=>{y<5?setTimeout(()=>p(y+1),800*(y+1)):i(k.message)}),[]);_.useEffect(()=>{p()},[p]),_.useEffect(()=>{const y={film:"Forebear · Every clearance has a past",check:e.arg?`${e.arg} · Forebear`:"Investigate · Forebear",compare:"Compare predicates · Forebear",reach:"Recall reach · Forebear",watch:"Watchlist · Forebear",ingest:"Add a clearance · Forebear",history:"History · Forebear",method:"Method · Forebear"};document.title=y[e.tab]||"Forebear"},[e]);const m=_.useCallback((y,k="",L={})=>{const v=vh(y,k),c=()=>{history.pushState(null,"",v),t(Fr(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>zc.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Fr());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Ep(),e.tab!=="film"&&m("film"),window.scrollTo(0,0),s||(f("pending"),u(!0))};return o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"skip-link",href:"#main",onClick:y=>{var k;y.preventDefault(),(k=document.getElementById("main"))==null||k.focus()},children:"Skip to content"}),a&&o.jsx(Cp,{onDone:()=>{f("bloom"),setTimeout(()=>u(!1),700),requestAnimationFrame(()=>{var y;return(y=document.getElementById("hero-title"))==null?void 0:y.focus({preventScroll:!0})})}}),o.jsx("div",{inert:a&&d==="pending"?"":void 0,style:{display:"contents"},children:e.tab==="film"?o.jsx(_.Suspense,{fallback:o.jsx("div",{style:{minHeight:"100vh"}}),children:o.jsx(hh,{go:m,stats:n,introDone:d,reduced:s})}):o.jsx(fh,{route:e,go:m,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}Mc(document.getElementById("root")).render(o.jsx(gh,{}));export{Wc as A,yh as E,Ic as M,ui as P,wl as R,xh as T,Qn as V,jp as W,zt as _,Op as a,xa as b,Ie as c,kp as d,Ue as f,o as j,ya as m,zp as p,_ as r,Tp as u,Ip as v}; diff --git a/web/dist/assets/index-BEiDIW2F.js b/web/dist/assets/index-BEiDIW2F.js new file mode 100644 index 0000000..124245d --- /dev/null +++ b/web/dist/assets/index-BEiDIW2F.js @@ -0,0 +1,44 @@ +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function Yc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sa={exports:{}},jl={},_a={exports:{}},z={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dr=Symbol.for("react.element"),Xc=Symbol.for("react.portal"),Zc=Symbol.for("react.fragment"),Jc=Symbol.for("react.strict_mode"),qc=Symbol.for("react.profiler"),bc=Symbol.for("react.provider"),ed=Symbol.for("react.context"),td=Symbol.for("react.forward_ref"),nd=Symbol.for("react.suspense"),rd=Symbol.for("react.memo"),ld=Symbol.for("react.lazy"),ao=Symbol.iterator;function id(e){return e===null||typeof e!="object"?null:(e=ao&&e[ao]||e["@@iterator"],typeof e=="function"?e:null)}var Ea={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ca=Object.assign,Ta={};function jn(e,t,n){this.props=e,this.context=t,this.refs=Ta,this.updater=n||Ea}jn.prototype.isReactComponent={};jn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};jn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Pa(){}Pa.prototype=jn.prototype;function cs(e,t,n){this.props=e,this.context=t,this.refs=Ta,this.updater=n||Ea}var ds=cs.prototype=new Pa;ds.constructor=cs;Ca(ds,jn.prototype);ds.isPureReactComponent=!0;var uo=Array.isArray,La=Object.prototype.hasOwnProperty,fs={current:null},Ra={key:!0,ref:!0,__self:!0,__source:!0};function Da(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)La.call(t,r)&&!Ra.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,ee=C[X];if(0>>1;Xl(Ol,$))Rtl(gr,Ol)?(C[X]=gr,C[Rt]=$,X=Rt):(C[X]=Ol,C[Lt]=$,X=Lt);else if(Rtl(gr,$))C[X]=gr,C[Rt]=$,X=Rt;else break e}}return D}function l(C,D){var $=C.sortIndex-D.sortIndex;return $!==0?$:C.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],d=[],f=1,p=null,h=3,g=!1,y=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(C){for(var D=n(d);D!==null;){if(D.callback===null)r(d);else if(D.startTime<=C)r(d),D.sortIndex=D.expirationTime,t(u,D);else break;D=n(d)}}function w(C){if(k=!1,m(C),!y)if(n(u)!==null)y=!0,Xe(S);else{var D=n(d);D!==null&&M(w,D.startTime-C)}}function S(C,D){y=!1,k&&(k=!1,v(x),x=-1),g=!0;var $=h;try{for(m(D),p=n(u);p!==null&&(!(p.expirationTime>D)||C&&!I());){var X=p.callback;if(typeof X=="function"){p.callback=null,h=p.priorityLevel;var ee=X(p.expirationTime<=D);D=e.unstable_now(),typeof ee=="function"?p.callback=ee:p===n(u)&&r(u),m(D)}else r(u);p=n(u)}if(p!==null)var vr=!0;else{var Lt=n(d);Lt!==null&&M(w,Lt.startTime-D),vr=!1}return vr}finally{p=null,h=$,g=!1}}var E=!1,j=null,x=-1,R=5,T=-1;function I(){return!(e.unstable_now()-TC||125X?(C.sortIndex=$,t(d,C),n(u)===null&&C===n(d)&&(k?(v(x),x=-1):k=!0,M(w,$-X))):(C.sortIndex=ee,t(u,C),y||g||(y=!0,Xe(S))),C},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(C){var D=h;return function(){var $=h;h=D;try{return C.apply(this,arguments)}finally{h=$}}}})(Ia);Fa.exports=Ia;var vd=Fa.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var gd=_,Se=vd;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mi=Object.prototype.hasOwnProperty,yd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fo={},po={};function xd(e){return mi.call(po,e)?!0:mi.call(fo,e)?!1:yd.test(e)?po[e]=!0:(fo[e]=!0,!1)}function wd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function kd(e,t,n,r){if(t===null||typeof t>"u"||wd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ie[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ie[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ie[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var hs=/[\-:]([a-z])/g;function ms(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});ie.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function vs(e,t,n,r){var l=ie.hasOwnProperty(t)?ie[t]:null;(l!==null?l.type!==0:r||!(2a||l[s]!==i[a]){var u=` +`+l[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=a);break}}}finally{Wl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$n(e):""}function jd(e){switch(e.tag){case 5:return $n(e.type);case 16:return $n("Lazy");case 13:return $n("Suspense");case 19:return $n("SuspenseList");case 0:case 2:case 15:return e=Bl(e.type,!1),e;case 11:return e=Bl(e.type.render,!1),e;case 1:return e=Bl(e.type,!0),e;default:return""}}function xi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Zt:return"Fragment";case Xt:return"Portal";case vi:return"Profiler";case gs:return"StrictMode";case gi:return"Suspense";case yi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ua:return(e.displayName||"Context")+".Consumer";case Oa:return(e._context.displayName||"Context")+".Provider";case ys:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xs:return t=e.displayName||null,t!==null?t:xi(e.type)||"Memo";case ut:t=e._payload,e=e._init;try{return xi(e(t))}catch{}}return null}function Nd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xi(t);case 8:return t===gs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function St(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sd(e){var t=Wa(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){e._valueTracker||(e._valueTracker=Sd(e))}function Ba(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Wa(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=St(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ha(e,t){t=t.checked,t!=null&&vs(e,"checked",t,!1)}function ki(e,t){Ha(e,t);var n=St(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ji(e,t.type,n):t.hasOwnProperty("defaultValue")&&ji(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ji(e,t,n){(t!=="number"||qr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=kr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_d=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){_d.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function Ya(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function Xa(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ya(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ed=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _i(e,t){if(t){if(Ed[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Ei(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ci=null;function ws(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ti=null,un=null,cn=null;function xo(e){if(e=hr(e)){if(typeof Ti!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Tl(t),Ti(e.stateNode,e.type,t))}}function Za(e){un?cn?cn.push(e):cn=[e]:un=e}function Ja(){if(un){var e=un,t=cn;if(cn=un=null,xo(e),t)for(e=0;e>>=0,e===0?32:31-(Id(e)/Ad|0)|0}var jr=64,Nr=4194304;function Mn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~l;a!==0?r=Mn(a):(i&=s,i!==0&&(r=Mn(i)))}else s=n&~l,s!==0?r=Mn(s):i!==0&&(r=Mn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ue(t),e[t]=n}function Wd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=On),To=" ",Po=!1;function gu(e,t){switch(e){case"keyup":return gf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jt=!1;function xf(e,t){switch(e){case"compositionend":return yu(t);case"keypress":return t.which!==32?null:(Po=!0,To);case"textInput":return e=t.data,e===To&&Po?null:e;default:return null}}function wf(e,t){if(Jt)return e==="compositionend"||!Ts&&gu(e,t)?(e=mu(),Br=_s=pt=null,Jt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$o(n)}}function ju(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ju(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nu(){for(var e=window,t=qr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qr(e.document)}return t}function Ps(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Pf(e){var t=Nu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ju(n.ownerDocument.documentElement,n)){if(r!==null&&Ps(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=zo(n,i);var s=zo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,qt=null,zi=null,Vn=null,Mi=!1;function Mo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mi||qt==null||qt!==qr(r)||(r=qt,"selectionStart"in r&&Ps(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vn&&tr(Vn,r)||(Vn=r,r=il(zi,"onSelect"),0tn||(e.current=Vi[tn],Vi[tn]=null,tn--)}function O(e,t){tn++,Vi[tn]=e.current,e.current=t}var _t={},ce=Tt(_t),ye=Tt(!1),Vt=_t;function mn(e,t){var n=e.type.contextTypes;if(!n)return _t;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function ol(){V(ye),V(ce)}function Wo(e,t,n){if(ce.current!==_t)throw Error(N(168));O(ce,t),O(ye,n)}function Du(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,Nd(e)||"Unknown",l));return Q({},n,r)}function al(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_t,Vt=ce.current,O(ce,e),O(ye,ye.current),!0}function Bo(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Du(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,V(ye),V(ce),O(ce,e)):V(ye),O(ye,n)}var Je=null,Pl=!1,ri=!1;function $u(e){Je===null?Je=[e]:Je.push(e)}function Vf(e){Pl=!0,$u(e)}function Pt(){if(!ri&&Je!==null){ri=!0;var e=0,t=A;try{var n=Je;for(A=1;e>=s,l-=s,qe=1<<32-Ue(t)+l|n<x?(R=j,j=null):R=j.sibling;var T=h(v,j,m[x],w);if(T===null){j===null&&(j=R);break}e&&j&&T.alternate===null&&t(v,j),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T,j=R}if(x===m.length)return n(v,j),W&&$t(v,x),S;if(j===null){for(;xx?(R=j,j=null):R=j.sibling;var I=h(v,j,T.value,w);if(I===null){j===null&&(j=R);break}e&&j&&I.alternate===null&&t(v,j),c=i(I,c,x),E===null?S=I:E.sibling=I,E=I,j=R}if(T.done)return n(v,j),W&&$t(v,x),S;if(j===null){for(;!T.done;x++,T=m.next())T=p(v,T.value,w),T!==null&&(c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return W&&$t(v,x),S}for(j=r(v,j);!T.done;x++,T=m.next())T=g(j,v,x,T.value,w),T!==null&&(e&&T.alternate!==null&&j.delete(T.key===null?x:T.key),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return e&&j.forEach(function(K){return t(v,K)}),W&&$t(v,x),S}function L(v,c,m,w){if(typeof m=="object"&&m!==null&&m.type===Zt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:e:{for(var S=m.key,E=c;E!==null;){if(E.key===S){if(S=m.type,S===Zt){if(E.tag===7){n(v,E.sibling),c=l(E,m.props.children),c.return=v,v=c;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ut&&Ko(S)===E.type){n(v,E.sibling),c=l(E,m.props),c.ref=Ln(v,E,m),c.return=v,v=c;break e}n(v,E);break}else t(v,E);E=E.sibling}m.type===Zt?(c=Ut(m.props.children,v.mode,w,m.key),c.return=v,v=c):(w=Jr(m.type,m.key,m.props,null,v.mode,w),w.ref=Ln(v,c,m),w.return=v,v=w)}return s(v);case Xt:e:{for(E=m.key;c!==null;){if(c.key===E)if(c.tag===4&&c.stateNode.containerInfo===m.containerInfo&&c.stateNode.implementation===m.implementation){n(v,c.sibling),c=l(c,m.children||[]),c.return=v,v=c;break e}else{n(v,c);break}else t(v,c);c=c.sibling}c=di(m,v.mode,w),c.return=v,v=c}return s(v);case ut:return E=m._init,L(v,c,E(m._payload),w)}if(zn(m))return y(v,c,m,w);if(_n(m))return k(v,c,m,w);Lr(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,c!==null&&c.tag===6?(n(v,c.sibling),c=l(c,m),c.return=v,v=c):(n(v,c),c=ci(m,v.mode,w),c.return=v,v=c),s(v)):n(v,c)}return L}var gn=Iu(!0),Au=Iu(!1),dl=Tt(null),fl=null,ln=null,$s=null;function zs(){$s=ln=fl=null}function Ms(e){var t=dl.current;V(dl),e._currentValue=t}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fn(e,t){fl=e,$s=ln=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ge=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if($s!==e)if(e={context:e,memoizedValue:t,next:null},ln===null){if(fl===null)throw Error(N(308));ln=e,fl.dependencies={lanes:0,firstContext:e}}else ln=ln.next=e;return t}var It=null;function Fs(e){It===null?It=[e]:It.push(e)}function Ou(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Fs(t)):(n.next=l.next,l.next=n),t.interleaved=n,rt(e,r)}function rt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ct=!1;function Is(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Uu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function et(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,rt(e,n)}return l=r.interleaved,l===null?(t.next=t,Fs(r)):(t.next=l.next,l.next=t),r.interleaved=t,rt(e,n)}function Qr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,js(e,n)}}function Go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pl(e,t,n,r){var l=e.updateQueue;ct=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,d=u.next;u.next=null,s===null?i=d:s.next=d,s=u;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=d:a.next=d,f.lastBaseUpdate=u))}if(i!==null){var p=l.baseState;s=0,f=d=u=null,a=i;do{var h=a.lane,g=a.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,k=a;switch(h=t,g=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){p=y.call(g,p,h);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,h=typeof y=="function"?y.call(g,p,h):y,h==null)break e;p=Q({},p,h);break e;case 2:ct=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(d=f=g,u=p):f=f.next=g,s|=h;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;h=a,a=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(f===null&&(u=p),l.baseState=u,l.firstBaseUpdate=d,l.lastBaseUpdate=f,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Ht|=s,e.lanes=s,e.memoizedState=p}}function Yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ii.transition;ii.transition={};try{e(!1),t()}finally{A=n,ii.transition=r}}function rc(){return ze().memoizedState}function Qf(e,t,n){var r=jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lc(e))ic(t,n);else if(n=Ou(e,t,n,r),n!==null){var l=fe();Ve(n,e,r,l),sc(n,t,r)}}function Kf(e,t,n){var r=jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lc(e))ic(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(l.hasEagerState=!0,l.eagerState=a,We(a,s)){var u=t.interleaved;u===null?(l.next=l,Fs(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Ou(e,t,l,r),n!==null&&(l=fe(),Ve(n,e,r,l),sc(n,t,r))}}function lc(e){var t=e.alternate;return e===H||t!==null&&t===H}function ic(e,t){Wn=ml=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,js(e,n)}}var vl={readContext:$e,useCallback:se,useContext:se,useEffect:se,useImperativeHandle:se,useInsertionEffect:se,useLayoutEffect:se,useMemo:se,useReducer:se,useRef:se,useState:se,useDebugValue:se,useDeferredValue:se,useTransition:se,useMutableSource:se,useSyncExternalStore:se,useId:se,unstable_isNewReconciler:!1},Gf={readContext:$e,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Zo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gr(4194308,4,qu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gr(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Qf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Xo,useDebugValue:Qs,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Xo(!1),t=e[0];return e=Hf.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(W){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Bt&30||Hu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Zo(Ku.bind(null,r,i,e),[e]),r.flags|=2048,ur(9,Qu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Qe(),t=ne.identifierPrefix;if(W){var n=be,r=qe;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=or++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Ke]=t,e[lr]=r,vc(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ei(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lwn&&(t.flags|=128,r=!0,Rn(i,!1),t.lanes=4194304)}else{if(!r)if(e=hl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!W)return oe(t),null}else 2*Z()-i.renderingStartTime>wn&&n!==1073741824&&(t.flags|=128,r=!0,Rn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Z(),t.sibling=null,n=B.current,O(B,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Js(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ke&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function tp(e,t){switch(Rs(t),t.tag){case 1:return xe(t.type)&&ol(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),V(ye),V(ce),Us(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Os(t),null;case 13:if(V(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(B),null;case 4:return yn(),null;case 10:return Ms(t.type._context),null;case 22:case 23:return Js(),null;case 24:return null;default:return null}}var Dr=!1,ue=!1,np=typeof WeakSet=="function"?WeakSet:Set,P=null;function sn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function bi(e,t,n){try{n()}catch(r){G(e,t,r)}}var oa=!1;function rp(e,t){if(Fi=rl,e=Nu(),Ps(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,d=0,f=0,p=e,h=null;t:for(;;){for(var g;p!==n||l!==0&&p.nodeType!==3||(a=s+l),p!==i||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)!==null;)h=p,p=g;for(;;){if(p===e)break t;if(h===n&&++d===l&&(a=s),h===i&&++f===r&&(u=s),(g=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ii={focusedElem:e,selectionRange:n},rl=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,L=y.memoizedState,v=t.stateNode,c=v.getSnapshotBeforeUpdate(t.elementType===t.type?k:Fe(t.type,k),L);v.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return y=oa,oa=!1,y}function Bn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&bi(t,n,i)}l=l.next}while(l!==r)}}function Dl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function es(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function xc(e){var t=e.alternate;t!==null&&(e.alternate=null,xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[lr],delete t[Ui],delete t[Of],delete t[Uf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function wc(e){return e.tag===5||e.tag===3||e.tag===4}function aa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ts(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sl));else if(r!==4&&(e=e.child,e!==null))for(ts(e,t,n),e=e.sibling;e!==null;)ts(e,t,n),e=e.sibling}function ns(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ns(e,t,n),e=e.sibling;e!==null;)ns(e,t,n),e=e.sibling}var re=null,Ie=!1;function ot(e,t,n){for(n=n.child;n!==null;)kc(e,t,n),n=n.sibling}function kc(e,t,n){if(Ge&&typeof Ge.onCommitFiberUnmount=="function")try{Ge.onCommitFiberUnmount(Sl,n)}catch{}switch(n.tag){case 5:ue||sn(n,t);case 6:var r=re,l=Ie;re=null,ot(e,t,n),re=r,Ie=l,re!==null&&(Ie?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Ie?(e=re,n=n.stateNode,e.nodeType===8?ni(e.parentNode,n):e.nodeType===1&&ni(e,n),bn(e)):ni(re,n.stateNode));break;case 4:r=re,l=Ie,re=n.stateNode.containerInfo,Ie=!0,ot(e,t,n),re=r,Ie=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&bi(n,t,s),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!ue&&(sn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){G(n,t,a)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,ot(e,t,n),ue=r):ot(e,t,n);break;default:ot(e,t,n)}}function ua(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new np),t.forEach(function(r){var l=fp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Me(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ip(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,xl=0,F&6)throw Error(N(331));var l=F;for(F|=4,P=e.current;P!==null;){var i=P,s=i.child;if(P.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uZ()-Xs?Ot(e,0):Ys|=n),we(e,t)}function Pc(e,t){t===0&&(e.mode&1?(t=Nr,Nr<<=1,!(Nr&130023424)&&(Nr=4194304)):t=1);var n=fe();e=rt(e,t),e!==null&&(fr(e,t,n),we(e,n))}function dp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pc(e,n)}function fp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Pc(e,n)}var Lc;Lc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ge=!1,bf(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&zu(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yr(e,t),e=t.pendingProps;var l=mn(t,ce.current);fn(t,n),l=Ws(null,t,r,e,l,n);var i=Bs();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(i=!0,al(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Is(t),l.updater=Rl,t.stateNode=l,l._reactInternals=t,Ki(t,r,e,n),t=Xi(null,t,r,!0,i,n)):(t.tag=0,W&&i&&Ls(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=hp(r),e=Fe(r,e),l){case 0:t=Yi(null,t,r,e,n);break e;case 1:t=la(null,t,r,e,n);break e;case 11:t=na(null,t,r,e,n);break e;case 14:t=ra(null,t,r,Fe(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Yi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),la(e,t,r,l,n);case 3:e:{if(pc(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Uu(e,t),pl(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=xn(Error(N(423)),t),t=ia(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=ia(e,t,r,n,l);break e}else for(je=xt(t.stateNode.containerInfo.firstChild),Ne=t,W=!0,Ae=null,n=Au(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=lt(e,t,n);break e}de(e,t,r,n)}t=t.child}return t;case 5:return Vu(t),e===null&&Bi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ai(r,l)?s=null:i!==null&&Ai(r,i)&&(t.flags|=32),fc(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Bi(t),null;case 13:return hc(e,t,n);case 4:return As(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):de(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),na(e,t,r,l,n);case 7:return de(e,t,t.pendingProps,n),t.child;case 8:return de(e,t,t.pendingProps.children,n),t.child;case 12:return de(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,O(dl,r._currentValue),r._currentValue=s,i!==null)if(We(i.value,s)){if(i.children===l.children&&!ye.current){t=lt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=et(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?u.next=u:(u.next=f.next,f.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Hi(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Hi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}de(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,fn(t,n),l=$e(l),r=r(l),t.flags|=1,de(e,t,r,n),t.child;case 14:return r=t.type,l=Fe(r,t.pendingProps),l=Fe(r.type,l),ra(e,t,r,l,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Yr(e,t),t.tag=1,xe(r)?(e=!0,al(t)):e=!1,fn(t,n),oc(t,r,l),Ki(t,r,l,n),Xi(null,t,r,!0,e,n);case 19:return mc(e,t,n);case 22:return dc(e,t,n)}throw Error(N(156,t.tag))};function Rc(e,t){return lu(e,t)}function pp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new pp(e,t,n,r)}function bs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hp(e){if(typeof e=="function")return bs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ys)return 11;if(e===xs)return 14}return 2}function Nt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Jr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")bs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Zt:return Ut(n.children,l,i,t);case gs:s=8,l|=8;break;case vi:return e=Pe(12,n,t,l|2),e.elementType=vi,e.lanes=i,e;case gi:return e=Pe(13,n,t,l),e.elementType=gi,e.lanes=i,e;case yi:return e=Pe(19,n,t,l),e.elementType=yi,e.lanes=i,e;case Va:return zl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Oa:s=10;break e;case Ua:s=9;break e;case ys:s=11;break e;case xs:s=14;break e;case ut:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Pe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Ut(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Va,e.lanes=n,e.stateNode={isHidden:!1},e}function ci(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function di(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function mp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ql(0),this.expirationTimes=Ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ql(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function eo(e,t,n,r,l,i,s,a,u){return e=new mp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Is(i),e}function vp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mc)}catch(e){console.error(e)}}Mc(),Ma.exports=_e;var Fc=Ma.exports,Ic,ga=Fc;Ic=ga.createRoot,ga.hydrateRoot;const kp="modulepreload",jp=function(e){return"/"+e},ya={},Mt=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));l=Promise.allSettled(n.map(u=>{if(u=jp(u),u in ya)return;ya[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":kp,d||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return l.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};async function ae(e,t={}){const n=await fetch(e,{headers:{"content-type":"application/json"},...t,body:t.body?JSON.stringify(t.body):void 0});let r=null;try{r=await n.json()}catch{}if(!n.ok){const l=r!=null&&r.detail?typeof r.detail=="string"?r.detail:JSON.stringify(r.detail):`HTTP ${n.status}`;throw new Error(l)}return r}const Oe={stats:()=>ae("/api/stats"),search:e=>ae(`/api/search?q=${encodeURIComponent(e)}`),assess:(e,t=4)=>ae(`/api/assess/${e}?depth=${t}`),compare:e=>ae("/api/compare",{method:"POST",body:{ks:e}}),recallEvent:e=>ae(`/api/recall-event/${e}`),watchlist:()=>ae("/api/watchlist"),ingest:e=>ae("/api/ingest",{method:"POST",body:{k:e}}),review:(e,t,n,r)=>ae("/api/citation/review",{method:"POST",body:{src:e,dst:t,status:n,note:r}}),triage:(e,t)=>ae("/api/citation/triage",{method:"POST",body:{src:e,dst:t}}),save:(e,t)=>ae("/api/assessments",{method:"POST",body:{k:e,note:t}}),assessments:e=>ae(`/api/assessments${e?`?k=${e}`:""}`),investigations:(e,t=30)=>ae(`/api/investigations?limit=${t}${e?`&k=${e}`:""}`),investigation:e=>ae(`/api/investigations/${e}`),startInvestigation:(e,t,n="auto")=>ae("/api/investigations",{method:"POST",body:{k:e,request:t,mode:n}}),proposals:e=>ae(`/api/proposals${e?`?status=${e}`:""}`),decide:(e,t,n,r)=>ae(`/api/proposals/${e}/decision`,{method:"POST",body:{decision:t,reviewer:n,human:!0,note:r}})},Ac=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,Np=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,os={nodes:[{id:"a",x:11,y:7,r:3.6},{id:"b",x:27,y:7,r:2.8},{id:"c",x:11,y:19,r:3},{id:"d",x:23,y:19,r:2.6},{id:"e",x:11,y:31,r:3.4,past:!0}],threads:[["a","b"],["a","c"],["c","d"],["c","e"]]},Mr=Object.fromEntries(os.nodes.map(e=>[e.id,e]));function Oc({size:e=28,className:t="",title:n}){return o.jsxs("svg",{className:"mark "+t,width:e,height:e,viewBox:"0 0 38 38",role:n?"img":void 0,"aria-hidden":n?void 0:!0,"aria-label":n,children:[os.threads.map(([r,l],i)=>o.jsx("line",{className:`mark-thread t${i}`,x1:Mr[r].x,y1:Mr[r].y,x2:Mr[l].x,y2:Mr[l].y,pathLength:"1"},i)),os.nodes.map((r,l)=>o.jsx("circle",{className:`mark-node n${l}${r.past?" past":""}`,cx:r.x,cy:r.y,r:r.r},r.id))]})}function Sp({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Oc,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const lo="forebear:intro",_p=3e3,xa=2450;function Ep(){try{return!!sessionStorage.getItem(lo)}catch{return!0}}function Cp(){try{sessionStorage.setItem(lo,"seen")}catch{}}function Tp(){try{sessionStorage.removeItem(lo)}catch{}}function Pp({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,Cp(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,xa),f=h=>{(h.key==="Escape"||h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i())};return addEventListener("keydown",f),(p=l.current)==null||p.focus({preventScroll:!0}),()=>{clearTimeout(d),removeEventListener("keydown",f)}},[]);const[s,a]=_.useState(!1);if(_.useEffect(()=>{if(!t)return;const d=setTimeout(()=>a(!0),_p-xa+100);return()=>clearTimeout(d)},[t]),s)return null;const u="Forebear".split("");return o.jsxs("div",{className:"intro"+(t?" is-leaving":""),"data-testid":"intro",onClick:i,role:"dialog","aria-modal":"true","aria-label":"Forebear opening",children:[o.jsxs("div",{className:"intro-lockup","aria-hidden":"true",children:[o.jsx(Oc,{className:"intro-mark",size:116}),o.jsx("div",{className:"intro-word",children:u.map((d,f)=>o.jsx("span",{style:{animationDelay:`${.95+f*.045}s`},children:d},f))}),o.jsx("p",{className:"intro-tag",children:o.jsxs("span",{children:["Every clearance has ",o.jsx("em",{children:"a past."})]})})]}),o.jsx("span",{className:"sr-only",role:"status",children:"Forebear. Every clearance has a past."}),o.jsxs("button",{ref:l,className:"btn btn-line btn-sm intro-skip",onClick:d=>{d.stopPropagation(),i()},children:["Skip intro ",o.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}function Lp(e){const[t,n]=_.useState(()=>typeof matchMedia<"u"&&matchMedia(e).matches);return _.useEffect(()=>{const r=matchMedia(e),l=()=>n(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),t}const Kn=["mcp-client"],Gn={DESIGN_RECALL_ON_FILE:{tone:"alert",label:"Design-related recall on file",plain:"The candidate itself has a design-related recall on file."},REVIEW_LINEAGE:{tone:"amber",label:"Review lineage",plain:"A recall in the predicate lineage warrants documented review."},INSUFFICIENT_LINEAGE:{tone:"muted",label:"Lineage not checkable",plain:"The ancestry could not be checked from readable evidence."},NO_DESIGN_RECALL_SIGNAL:{tone:"calm",label:"No design-recall signal",plain:"No design-related recall in the readable verdict window. Not a safety finding."}},Uc={audit_unresolved:"The extraction audit could not resolve whether this is the predicate",audit_correction:"K-number supplied by the audit, not as printed in the PDF",name_mismatch:"The cited device's FDA name does not appear near the citation",different_fda_panel:"Cited device sits in a different FDA review panel",llm_label_only:"A predicate only because an LLM labelled the mention",client_confirmation_only:"Confirmed only through the automated MCP client, not a person",client_rejection_pending:"Rejected through the automated MCP client; kept until a person decides"};function Rp(e){if(!e)return[];if(e.review==="confirmed"&&!Kn.includes(e.reviewer))return[];const t=[];return e.audit==="unresolved"&&t.push("audit_unresolved"),e.audit==="corrected"&&t.push("audit_correction"),e.name_check==="mismatch"&&!["variant","corrected"].includes(e.audit)&&t.push("name_mismatch"),e.panel_check==="different"&&!["variant","corrected"].includes(e.audit)&&t.push("different_fda_panel"),e.kind!=null&&e.kind!=="predicate"&&e.ai_label==="predicate"&&t.push("llm_label_only"),e.kind!=null&&e.kind!=="predicate"&&e.review==="confirmed"&&Kn.includes(e.reviewer)&&t.push("client_confirmation_only"),e.review==="rejected"&&Kn.includes(e.reviewer)&&t.push("client_rejection_pending"),t}const mt=e=>!!(e!=null&&e.review)&&!Kn.includes(e.reviewer),Re={confirmed:{label:"Confirmed by a person",short:"Confirmed"},extracted:{label:"Machine-extracted",short:"Extracted"},disputed:{label:"Disputed evidence",short:"Disputed"},conditional:{label:"Conditional route",short:"Conditional"},rejected:{label:"Rejected by a person",short:"Rejected"},advisory:{label:"Advisory: suggested by an LLM or the MCP client, awaiting a person; not a verdict input",short:"Advisory"},retired:{label:"Retired: the refreshed FDA summary no longer cites it; kept for the record",short:"Retired"}};function Et(e){if(e!=null&&e.retired_at||(e==null?void 0:e.trust)==="retired")return{key:"retired",reasons:[]};if((e==null?void 0:e.review)==="rejected"&&mt(e))return{key:"rejected",reasons:[]};if(e!=null&&e.advisory||(e==null?void 0:e.trust)==="advisory")return{key:"advisory",reasons:[]};const t=Rp(e);return t.includes("audit_unresolved")?{key:"conditional",reasons:t}:t.length?{key:"disputed",reasons:t}:(e==null?void 0:e.review)==="confirmed"&&mt(e)?{key:"confirmed",reasons:t}:{key:"extracted",reasons:t}}function Dp(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function io(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function so(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const $p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function De(e){if(!e)return"—";const[t,n,r]=String(e).slice(0,10).split("-").map(Number);return t?`${r} ${$p[(n||1)-1]} ${t}`:String(e)}const Vc=e=>e?String(e).slice(0,4):"";function wa(e,t){if(!e||!t)return null;const[n,r,l]=e.slice(0,10).split("-").map(Number),[i,s,a]=t.slice(0,10).split("-").map(Number);return(i-n)*12+(s-r)-(ar?1:0}function Wc(e,t){const n=zp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?wa(e,t):wa(t,e);return{relation:n<0?"before":"after",months:r,duration:Mp(r)}}function Bc(e,t,n="clause"){if(!e)return"";const{relation:r,duration:l}=e;return n==="chip"?r==="same-day"?`Recall began on the day of ${t}'s clearance`:`Recall began ${l} ${r} ${t}'s clearance`:r==="same-day"?`on the day ${t} was cleared`:`${l} ${r} ${t} was cleared`}function Mp(e){if(e==null)return"";const t=e<0,n=Math.abs(e),r=Math.floor(n/12),l=n%12,i=[r?`${r} yr`:"",l?`${l} mo`:""].filter(Boolean).join(" ")||"<1 mo";return t?`-${i}`:i}const Fp=(e,t)=>e?t?`${e}#page=${t}`:e:null,Ip={pdf_text_layer:"PDF text layer",ocr:"Local OCR of the scanned PDF",embedded_pdf_attachment:"Summary embedded in a PDF Portfolio"};function it(e,t=30){const n=(e||"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Ap(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function Op(e,t){const n=Gn[e];return n?Ap(e,t)?{tone:"muted",label:`${n.label} · provisional`,provisional:!0}:{tone:n.tone,label:n.label,provisional:!1}:{tone:"muted",label:e||"Unknown",provisional:!1}}const wh={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Up={direct_predicate_links_all_uncertain:"every direct predicate link rests on uncertain evidence",unresolved_predicate_citations:"predicate citations within two generations could not be resolved",direct_predicate_summaries_unread:"a direct predicate's own summary was not read",doubtful_links_in_window:"links within two generations rest on doubtful evidence",recall_cause_or_class_unknown:"a recall has no stated cause or FDA class",unattributed_recalls_in_product_code:"design-related recalls in the product code name no 510(k)",shallow_traversal:"grand-predicates were not traversed",advisory_links_pending_review:"predicate links suggested only by an LLM or the MCP client await a person",human_confirmed_citation_retired:"a citation a person confirmed is no longer in the refreshed FDA summary"},Hc={name_token_match:{short:"FDA-listed · name match (heuristic)",tone:"other",text:"FDA lists this 510(k) on the recall. A distinctive word of its FDA device name appears in the recall text, possibly as a fuzzy match. This heuristic does not verify that the recall names this exact model."},name_token_absent:{short:"FDA-listed · name not found (heuristic)",tone:"muted",text:"FDA lists this 510(k) on the recall, but no distinctive word of its FDA device name was found in the recall text. The recalled model may differ, or the text may name it differently."},name_not_checkable:{short:"FDA-listed · name not checked",tone:"muted",text:"FDA lists this 510(k) on the recall. No name check is available: its FDA device name has no distinctive word to look for, or no check was recorded for this link. Which model was recalled is not established here."}},fi={short:"Recall began before this clearance",text:"This recall began before this 510(k) was cleared, yet FDA lists it on the record. The dates alone do not establish whether this cleared model was affected: read the FDA record."},kh={after:"cleared after the recall began",before:"cleared before the recall began",same_day:"cleared the day the recall began (order unknown)",unknown:"timing unknown (a date is missing)"};function ka(e){return e!=null&&e.attribution&&Hc[e.attribution]?e.attribution:(e==null?void 0:e.link_name_check)==="match"?"name_token_match":(e==null?void 0:e.link_name_check)==="mismatch"?"name_token_absent":"name_not_checkable"}const pi=70,Fr=110,ja=46,Vp=62,Wp=190,Na=300;function Bp(e){return e.signals.filter(t=>{var n;return(t.severity==="high"||t.severity==="medium")&&((n=t.chain)==null?void 0:n.length)>1}).map(t=>t.chain)}function Hp(e,{depth:t,descendants:n}){const r=new Map,l=Bp(e),i=new Set(l.flat()),s=new Set;l.forEach(p=>p.slice(1).forEach((h,g)=>s.add(p[g]+">"+h))),r.set(e.k,{...e.device,k:e.k,gen:0,side:"self",recalls:e.device.recalls||[]});let a=0,u=new Set;for(const p of e.ancestors)p.gen<=t||i.has(p.k)?r.set(p.k,{...p,side:"up"}):(a++,u.add(p.gen));if(n)for(const p of e.descendants)r.set(p.k,{...p,side:"down"});const d=new Map,f=p=>{for(const h of p||[]){if(!r.has(h.src)||!r.has(h.dst))continue;const g=h.src+">"+h.dst;d.has(g)||d.set(g,{id:g,hop:h,status:Et(h),critical:s.has(g)})}};for(const p of e.ancestors)r.has(p.k)&&f(p.hops);if(n)for(const p of e.descendants)f(p.hops);return{nodes:r,edges:d,hidden:a,hiddenGens:[...u].sort(),critK:i,critE:s}}function Qp(e,t){var E;const{nodes:n,edges:r}=e,l=new Map;for(const j of n.values())((E=j.chain)==null?void 0:E.length)>1&&l.set(j.k,j.chain[j.chain.length-2]);const i=[...n.values()].filter(j=>j.side==="up").map(j=>j.gen),s=[...n.values()].filter(j=>j.side==="down").map(j=>j.gen),a=i.length?Math.max(...i):0,u=s.length?Math.max(...s):0,d=j=>j.side==="self"?a:j.side==="up"?a-j.gen:a+j.gen,f=new Map;for(const j of n.values()){const x=d(j);f.has(x)||f.set(x,[]),f.get(x).push(j)}const p=new Map([[[...n.values()].find(j=>j.side==="self").k,0]]),h=[...f.keys()].sort((j,x)=>Math.abs(j-a)-Math.abs(x-a)),g=Math.max(...[...f.values()].map(j=>j.length));for(const j of h){const x=f.get(j);x.sort((R,T)=>{const I=p.get(l.get(R.k))??0,K=p.get(l.get(T.k))??0;return I-K||(T.decision_date||"").localeCompare(R.decision_date||"")}),x.forEach((R,T)=>{R.side!=="self"&&p.set(R.k,(T-(x.length-1)/2)*pi)})}const y=a+u,k=y?Math.max(Wp,Math.min(Na,(t-Fr*2)/y)):Na,L=Math.max(t,Fr*2+y*k),v=Fr+(L-(Fr*2+y*k))/2,c=ja+Vp+Math.max(1,g)*pi,m=ja+Math.max(1,g)*pi/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:m+p.get(j.k)}])),S=[...f.keys()].map(j=>{const x=j-a;return{x:v+j*k,label:x===0?"Candidate":x<0?x===-1?"Predicates":x===-2?"Grand-predicates":`Generation ${-x}`:`Cites it · +${x}`}});return{pos:w,width:L,height:c,colLabels:S,edges:r}}function Kp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Hp(e,{depth:t,descendants:r}),[e,t,r]),u=_.useRef(null),[d,f]=_.useState(900);_.useEffect(()=>{const c=()=>u.current&&f(u.current.clientWidth);c();const m=new ResizeObserver(c);return m.observe(u.current),()=>m.disconnect()},[]);const p=_.useMemo(()=>Qp(a,d),[a,d]),[h,g]=_.useState(null);_.useEffect(()=>{const c=u.current;c&&(c.scrollLeft=c.scrollWidth)},[e.k,p.width]);const y=_.useMemo(()=>{const c=h||null;if(!c)return s?new Set(s):null;const m=a.nodes.get(c);return new Set((m==null?void 0:m.chain)||[c])},[h,a,s]),k=c=>{if(!y)return!0;const[m,w]=c.split(">");return y.has(m)&&y.has(w)},L=c=>{const m=c.recalls||[],w=m.filter(S=>S.design_related).length;return`${c.k}, ${c.name||"unnamed"}, cleared ${c.decision_date||"date unknown"}. `+(c.side==="self"?"Candidate. ":c.side==="up"?`Generation ${c.gen} predicate. `:`Cites the candidate, ${c.gen} generation(s) later. `)+(m.length?`${m.length} recall record(s), ${w} design-related. `:"No recall records. ")+(c.lineage_known===!1?"Its own predicates were not read.":"")},v=c=>m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())};return o.jsxs("div",{children:[o.jsx("div",{className:"graph-wrap",ref:u,"data-testid":"evidence-graph",children:o.jsxs("svg",{width:p.width,height:p.height,role:"group","aria-label":`Predicate lineage graph for ${e.k}: ${a.nodes.size} devices, ${a.edges.size} citations`,children:[p.colLabels.map(c=>o.jsxs("g",{children:[o.jsx("line",{className:"g-col-rule",x1:c.x,x2:c.x,y1:30,y2:p.height-10}),o.jsx("text",{className:"g-col-label",x:c.x,y:20,textAnchor:"middle",children:c.label})]},c.x)),[...a.edges.values()].map(c=>{const m=p.pos.get(c.hop.src),w=p.pos.get(c.hop.dst),S=(m.x+w.x)/2,E=`M${m.x-12},${m.y} C${S},${m.y} ${S},${w.y} ${w.x+12},${w.y}`,j=c.status.key,x=!k(c.id),R=(l==null?void 0:l.type)==="edge"&&l.id===c.id;return o.jsxs("g",{className:"g-edge-g",tabIndex:0,role:"button","aria-label":`Citation: ${c.hop.src} cites ${c.hop.dst}${c.hop.page?`, page ${c.hop.page}`:""}. ${Re[j].label}. Open provenance.`,"aria-pressed":R,onClick:()=>i({type:"edge",id:c.id,hop:c.hop}),onKeyDown:v(()=>i({type:"edge",id:c.id,hop:c.hop})),children:[o.jsx("path",{d:E,className:`g-edge st-${j}${c.critical?" is-critical":""}${x?" is-dim":""}`,style:R?{opacity:1,strokeWidth:3.2}:void 0}),c.critical&&!x&&o.jsx("path",{d:E,className:"g-flow"}),o.jsx("path",{d:E,className:"g-edge-hit"}),o.jsx("rect",{x:S-22,y:(m.y+w.y)/2-9,width:44,height:18,rx:9,fill:"transparent",style:{cursor:"pointer"}}),o.jsx("title",{children:`${c.hop.src} → ${c.hop.dst} · p.${c.hop.page??"?"} · ${Re[j].label}`})]},c.id)}),[...a.nodes.values()].map(c=>{const m=p.pos.get(c.k),w=io(c),S=c.side==="self",E=S?11:8,j=y&&!y.has(c.k),x=(l==null?void 0:l.type)==="node"&&l.k===c.k;return o.jsxs("g",{transform:`translate(${m.x},${m.y})`,tabIndex:0,role:"button","aria-label":L(c),"aria-pressed":x,className:`g-node${S?" is-self":""}${j?" is-dim":""}${x?" is-selected":""}`,"data-k":c.k,onMouseEnter:()=>g(c.k),onMouseLeave:()=>g(null),onFocus:()=>g(c.k),onBlur:()=>g(null),onClick:()=>i({type:"node",k:c.k}),onKeyDown:v(()=>i({type:"node",k:c.k})),children:[w==="design"&&!S&&o.jsx("circle",{className:"glow",r:E*2.2}),o.jsx("circle",{className:"halo",r:E+5}),o.jsx("circle",{className:`dot tone-${w}${c.lineage_known===!1?" unread":""}`,r:E}),o.jsx("text",{className:"lk",y:-E-9,textAnchor:"middle",children:c.k}),o.jsxs("text",{className:"ln",y:E+16,textAnchor:"middle",children:[it(c.name,26)," · ",Vc(c.decision_date)]})]},c.k)}),a.hidden>0&&o.jsxs("g",{className:"g-more",tabIndex:0,role:"button",transform:`translate(14, ${p.height-40})`,"aria-label":`Show ${a.hidden} more ancestors in generations ${a.hiddenGens.join(", ")}`,onClick:()=>n(Math.max(...a.hiddenGens)),onKeyDown:v(()=>n(Math.max(...a.hiddenGens))),children:[o.jsx("rect",{width:"212",height:"28",rx:"14"}),o.jsxs("text",{x:"106",y:"18.5",textAnchor:"middle",children:["+ ",a.hidden," more in generation",a.hiddenGens.length>1?`s ${a.hiddenGens[0]}–${a.hiddenGens[a.hiddenGens.length-1]}`:` ${a.hiddenGens[0]}`]})]})]})}),o.jsxs("div",{className:"g-legend","aria-label":"Legend",children:[o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-design"}),"design-related recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-recall"}),"other recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-clean"}),"no recall record"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-unread"}),"own predicates unread"]}),o.jsx("span",{className:"sep","aria-hidden":"true"}),["confirmed","extracted","disputed","conditional"].map(c=>o.jsxs("span",{className:`status status-${c}`,children:[o.jsx("span",{className:"line"}),Re[c].short]},c)),o.jsxs("span",{className:"status",style:{color:"var(--amber)"},children:[o.jsx("span",{className:"line"}),"critical chain"]})]}),o.jsx("div",{className:"graph-hint",children:"Select any device or thread for its record, quote, page and source PDF. Tab moves between them; Enter opens."})]})}const Dt=28,Ir=34,hi=260,at=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Gp(e,t){const n=new Map,r=(u,d,f,p)=>{n.has(u.k)||n.set(u.k,{...u,side:d,gen:f,parent:p,children:[]})};r({...e.device,k:e.k},"self",0,null);for(const u of e.ancestors)u.gen<=t&&r(u,"up",u.gen,u.chain[u.chain.length-2]);for(const u of e.descendants)r(u,"down",u.gen,u.chain[u.chain.length-2]);for(const u of n.values())u.parent&&n.has(u.parent)&&n.get(u.parent).children.push(u.k);const l=(u,d)=>(n.get(u).decision_date||"").localeCompare(n.get(d).decision_date||""),i=[],s=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="down").sort(l).reverse())s(d),i.push(d)},a=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="up").sort(l).reverse())i.push(d),a(d)};return s(e.k),i.push(e.k),a(e.k),{nodes:n,order:i}}function Yp({a:e,depth:t,highlight:n,onSelect:r}){const l=_.useRef(null),[i,s]=_.useState(1e3);_.useEffect(()=>{const x=()=>l.current&&s(Math.max(760,l.current.clientWidth));x();const R=new ResizeObserver(x);return R.observe(l.current),()=>R.disconnect()},[]);const{nodes:a,order:u}=_.useMemo(()=>Gp(e,t),[e,t]),d=new Map(u.map((x,R)=>[x,R])),f=[];for(const x of a.values()){x.decision_date&&f.push(at(x.decision_date));for(const R of x.recalls||[])R.initiated&&f.push(at(R.initiated))}const p=new Date(Math.min(...f)).getUTCFullYear(),h=new Date(Math.max(...f)).getUTCFullYear()+1,g=Date.UTC(p,0,1),y=Date.UTC(h,0,1),k=i-hi-40,L=x=>16+(x-g)/(y-g)*k,v=x=>Ir+x*Dt+Dt/2,c=Ir+u.length*Dt+16,m=new Set(n||[]),w=new Set;if(n)for(let x=0;x+1"+n[x+1]);const S=h-p>24?4:h-p>12?2:1,E=[];for(let x=p;x<=h;x+=S)E.push(x);const j=L(at(e.device.decision_date));return o.jsx("div",{className:"graph-wrap",ref:l,"data-testid":"timeline",children:o.jsxs("svg",{width:i,height:c,role:"group","aria-label":`Lineage timeline for ${e.k}`,children:[E.map(x=>o.jsxs("g",{children:[o.jsx("line",{className:"tl-grid",x1:L(Date.UTC(x,0,1)),x2:L(Date.UTC(x,0,1)),y1:Ir-8,y2:c-8}),o.jsx("text",{className:"tl-axis",x:L(Date.UTC(x,0,1)),y:18,textAnchor:"middle",children:x})]},x)),o.jsx("rect",{x:0,y:v(d.get(e.k))-Dt/2,width:i,height:Dt,className:"tl-band"}),o.jsx("line",{className:"tl-clear",x1:j,x2:j,y1:Ir-8,y2:c-8}),[...a.values()].filter(x=>x.parent&&a.has(x.parent)).map(x=>{const[R,T]=x.side==="up"?[x.parent,x.k]:[x.k,x.parent],I=a.get(R),K=a.get(T);if(!I.decision_date||!K.decision_date)return null;const me=L(at(I.decision_date)),Be=v(d.get(R)),Y=L(at(K.decision_date)),Xe=v(d.get(T)),M=(me+Y)/2;return o.jsx("path",{d:`M${me-6},${Be} C${M},${Be} ${M},${Xe} ${Y+7},${Xe}`,className:"tl-edge"+(w.has(R+">"+T)?" on":"")},R+T)}),u.map((x,R)=>{const T=a.get(x);if(!T.decision_date)return null;const I=L(at(T.decision_date)),K=v(R),me=io(T),Be=m.size&&!m.has(x);return o.jsxs("g",{className:"tl-row g-node",style:{opacity:Be?.3:1},tabIndex:0,role:"button","aria-label":`${x} ${T.name}, cleared ${T.decision_date}, ${(T.recalls||[]).length} recall records`,onClick:()=>r({type:"node",k:x}),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),r({type:"node",k:x}))},children:[o.jsx("rect",{className:"tl-rowhit",x:0,y:K-Dt/2,width:i,height:Dt}),(T.recalls||[]).map(Y=>Y.initiated&&o.jsxs("g",{children:[o.jsx("line",{className:"tl-rlink",x1:I,x2:L(at(Y.initiated)),y1:K,y2:K}),o.jsx("path",{d:`M${L(at(Y.initiated))},${K-5} l5,5 l-5,5 l-5,-5 z`,className:"tl-dia "+(Y.design_related?"design":"other"),children:o.jsx("title",{children:`${Y.id} · ${Y.classification||"unclassified"} · ${Y.root_cause} · began ${Y.initiated}`})})]},Y.id)),o.jsx("circle",{cx:I,cy:K,r:x===e.k?7:5.5,className:`dot tone-${me}${T.lineage_known===!1?" unread":""}`,style:x===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),o.jsxs("text",{x:i-hi+8,y:K+4,className:"tl-label",children:[o.jsx("tspan",{className:"lk",children:x}),o.jsx("tspan",{dx:"7",children:it(T.name,24)})]}),o.jsx("text",{x:i-hi-6,y:K+4,textAnchor:"end",className:"tl-gen",children:T.side==="self"?"candidate":T.side==="up"?`G-${T.gen}`:`D+${T.gen}`})]},x)})]})})}function Qc({text:e,k:t,ocr:n}){if(!e)return o.jsx("p",{className:"quote muted",children:"No quote stored for this citation."});const r=t?e.split(new RegExp(`(${t.replace(/^K/,"K\\s?")})`)):[e];return o.jsxs("blockquote",{className:"quote"+(n?" is-ocr":""),children:["“",/^[a-z]/.test(e)?"…":"",r.map((l,i)=>i%2?o.jsx("mark",{children:l},i):o.jsx(Nl.Fragment,{children:l},i)),"”"]})}function Xp({hop:e}){const t=Et(e);return o.jsxs("span",{className:`status status-${t.key}`,children:[o.jsx("span",{className:"line"}),Re[t.key].label]})}function Kc({r:e}){const t=Dp(e),n=Hc[ka(e)];return o.jsxs("div",{className:"recall","data-attribution":ka(e),children:[o.jsxs("div",{className:"recall-h",children:[o.jsx("span",{className:`chip tone-${t}`,children:t==="design"?"Design-related":t==="class1"?"Class I, other cause":"Other cause"}),o.jsx("span",{className:"k mono",children:e.id}),o.jsxs("span",{className:"muted",children:[e.classification||"Unclassified"," · ",e.root_cause||"cause not stated"," · began ",De(e.initiated)]}),e.url&&o.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:"FDA record ↗"})]}),o.jsxs("div",{className:"recall-r",children:[o.jsx("span",{className:`chip tone-${n.tone}`,title:n.text,children:n.short})," ",o.jsx("span",{className:"muted small",children:n.text})]}),e.linked_before_clearance&&o.jsxs("div",{className:"recall-r","data-testid":"recall-predates",children:[o.jsx("span",{className:"chip tone-muted",title:fi.text,children:fi.short})," ",o.jsx("span",{className:"muted small",children:fi.text})]}),e.reason&&o.jsx("div",{className:"recall-r",children:e.reason}),e.status&&o.jsxs("div",{className:"recall-r",children:["Status: ",e.status,e.event?` · event ${e.event}`:"",e.firm?` · ${e.firm}`:""]})]})}function kn(e,t){return t===e.k?{...e.device,k:e.k,gen:0,side:"self"}:e.ancestors.find(n=>n.k===t)&&{...e.ancestors.find(n=>n.k===t),side:"up"}||e.descendants.find(n=>n.k===t)&&{...e.descendants.find(n=>n.k===t),side:"down"}||null}function Zp({sel:e,a:t,onClose:n,go:r,reload:l,onSelect:i}){const s=_.useRef(null),a=_.useRef(null);return _.useEffect(()=>{var f;const u=document.activeElement;(f=a.current)==null||f.focus();const d=p=>{if(p.key==="Escape"&&n(),p.key==="Tab"&&s.current){const h=s.current.querySelectorAll('a[href], button:not([disabled]), input, textarea, [tabindex="0"]');if(!h.length)return;const g=h[0],y=h[h.length-1];p.shiftKey&&document.activeElement===g?(p.preventDefault(),y.focus()):!p.shiftKey&&document.activeElement===y&&(p.preventDefault(),g.focus())}};return addEventListener("keydown",d),()=>{var p;removeEventListener("keydown",d),(p=u==null?void 0:u.focus)==null||p.call(u)}},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:n}),o.jsx("aside",{className:"drawer",ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"drawer-title","data-testid":"provenance",children:e.type==="edge"?o.jsx(Jp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(qp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function as({eyebrow:e,children:t,closeBtn:n,onClose:r}){return o.jsxs("div",{className:"drawer-head",children:[o.jsxs("div",{className:"t",children:[o.jsx("p",{className:"eyebrow",children:e}),o.jsx("h2",{id:"drawer-title",children:t})]}),o.jsx("button",{ref:n,className:"btn btn-quiet",onClick:r,"aria-label":"Close provenance (Escape)",children:"✕"})]})}function Jp({sel:e,a:t,closeBtn:n,onClose:r,go:l,reload:i,onSelect:s}){const a=e.hop,u=kn(t,a.src)||{},d=kn(t,a.dst)||{},f=Et(a),[p,h]=_.useState(!1),[g,y]=_.useState(null),k=a.source_url||u.summary_url,L=(a.text_source||u.text_source)&&(a.text_source||u.text_source)!=="pdf_text_layer",v=async c=>{h(!0),y(null);try{const m=await Oe.review(a.src,a.dst,c);y({ok:!0,text:c?`Recorded: ${c}. The assessment has been recomputed from the graph.`:"Review cleared. The assessment has been recomputed."}),s({...e,hop:{...a,review:(m==null?void 0:m.review)??(c||null),reviewer:(m==null?void 0:m.reviewer)??(c?"user":null)}}),i()}catch(m){y({ok:!1,text:m.message})}finally{h(!1)}};return o.jsxs(o.Fragment,{children:[o.jsxs(as,{eyebrow:"Citation provenance",closeBtn:n,onClose:r,children:[o.jsx("span",{className:"k",children:a.src})," cites ",o.jsx("span",{className:"k",children:a.dst})]}),o.jsxs("div",{className:"drawer-body",children:[o.jsxs("div",{className:"drawer-sec",children:[o.jsx(Xp,{hop:a}),f.reasons.length>0&&o.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:"var(--ink-2)",fontSize:12.5},children:f.reasons.map(c=>o.jsx("li",{children:Uc[c]||c},c))}),f.key==="conditional"&&o.jsxs("p",{className:"note-box violet",style:{marginTop:10},children:["Recall signals reached through this thread are ",o.jsx("b",{children:"conditional"}),": they hold only if this citation is a predicate. Read the page, then confirm or reject it: your review rewrites the verdict."]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"What the summary says"}),o.jsx(Qc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:Fp(k,a.page),target:"_blank",rel:"noreferrer","data-testid":"pdf-page-link",children:[o.jsx("span",{className:"sheet",children:o.jsxs("b",{children:["p.",a.page??"?"]})}),o.jsxs("span",{className:"tx",children:[o.jsxs("b",{children:["Open the original FDA PDF",a.page?` at page ${a.page}`:""," ↗"]}),o.jsxs("span",{children:[a.src," 510(k) summary · accessdata.fda.gov"]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Source and extraction"}),o.jsxs("dl",{className:"prov-grid",children:[o.jsx("dt",{children:"Citing device"}),o.jsxs("dd",{children:[a.src," · ",it(u.name,40),u.decision_date?` · ${De(u.decision_date)}`:""]}),o.jsx("dt",{children:"Cited device"}),o.jsxs("dd",{children:[a.dst," · ",it(d.name,40),d.decision_date?` · ${De(d.decision_date)}`:""]}),o.jsx("dt",{children:"Role"}),o.jsx("dd",{children:a.kind||"predicate"}),o.jsx("dt",{children:"Page"}),o.jsx("dd",{children:a.page??"not recorded"}),o.jsx("dt",{children:"Text source"}),o.jsx("dd",{children:Ip[a.text_source||u.text_source]||a.text_source||u.text_source||"not recorded"}),o.jsx("dt",{children:"Extraction"}),o.jsxs("dd",{children:[a.method||"—",a.confidence!=null?` · confidence ${a.confidence}`:""]}),o.jsx("dt",{children:"Name check"}),o.jsx("dd",{children:a.name_check||"—"}),o.jsx("dt",{children:"FDA panel"}),o.jsx("dd",{children:a.panel_check||"—"}),a.audit&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Audit"}),o.jsxs("dd",{children:[a.audit,a.audit_note?` — ${a.audit_note}`:""]})]}),a.ai_label&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"LLM label"}),o.jsxs("dd",{children:[a.ai_label,a.ai_model?` · ${a.ai_model}`:""," (advisory; never a verdict input until a person confirms)"]})]}),o.jsx("dt",{children:"Review"}),o.jsx("dd",{children:a.review?`${a.review} by ${a.reviewer||"unknown"}${Kn.includes(a.reviewer)?" (automated client; advisory)":""}`:"not reviewed by a person"}),o.jsx("dt",{children:"Trust"}),o.jsx("dd",{"data-testid":"edge-trust",children:Re[Et(a).key].label}),a.retired_at&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Retired"}),o.jsxs("dd",{children:[De(a.retired_at)," · no longer cited by the refreshed summary"]})]}),u.summary_sha256&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"PDF SHA-256"}),o.jsx("dd",{children:o.jsx("span",{className:"mono",children:u.summary_sha256})})]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Your review"}),o.jsxs("div",{className:"drawer-acts",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="confirmed"&&mt(a)?"":"confirmed"),children:a.review==="confirmed"&&mt(a)?"Clear confirmation":"Confirm citation"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="rejected"&&mt(a)?"":"rejected"),children:a.review==="rejected"&&mt(a)?"Restore citation":"Reject citation"})]}),o.jsx("p",{className:"note",style:{marginTop:8},children:"A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately."}),g&&o.jsx("p",{className:g.ok?"ok":"err",role:"status",children:g.text})]}),o.jsxs("div",{className:"drawer-acts",children:[o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.dst}),children:[a.dst," record →"]}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.src}),children:[a.src," record →"]})]})]})]})}function qp({sel:e,a:t,closeBtn:n,onClose:r,go:l,onSelect:i}){var p,h;const s=kn(t,e.k);if(!s)return o.jsxs(o.Fragment,{children:[o.jsx(as,{eyebrow:"Device",closeBtn:n,onClose:r,children:e.k}),o.jsx("div",{className:"drawer-body",children:"Not in this view."})]});const a=[...s.recalls||[]].sort((g,y)=>y.design_related-g.design_related||(g.initiated||"").localeCompare(y.initiated||"")),u=so(a),d=s.side==="self"?"Candidate":s.side==="up"?{1:"Direct predicate",2:"Grand-predicate"}[s.gen]||`Generation ${s.gen} ancestor`:`Later device citing this lineage (+${s.gen})`,f=a.filter(g=>g.initiated&&t.device.decision_date&&g.initiated1&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Route"}),o.jsx("dd",{className:"mono",style:{fontSize:12},children:s.chain.join(" → ")})]})]}),o.jsxs("div",{className:"drawer-acts",children:[s.k!==t.k&&o.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>l("check",s.k),children:["Investigate ",s.k," ",o.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),o.jsx("a",{className:"btn btn-line btn-sm",href:Ac(s.k),target:"_blank",rel:"noreferrer",children:"FDA 510(k) record ↗"}),s.summary_url&&o.jsx("a",{className:"btn btn-line btn-sm",href:s.summary_url,target:"_blank",rel:"noreferrer",children:"Summary PDF ↗"}),s.lineage_known===!1&&o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>l("ingest",s.k),children:"Try to read its summary"})]}),((h=s.hops)==null?void 0:h.length)>0&&o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"How it is reached"}),o.jsx("div",{className:"tags",children:s.hops.map(g=>o.jsxs("button",{className:"tag-btn",onClick:()=>i({type:"edge",id:g.src+">"+g.dst,hop:g}),children:[o.jsx("span",{className:"k",children:g.src})," → ",o.jsx("span",{className:"k",children:g.dst})," · p.",g.page??"?"," · ",Re[Et(g).key].short]},g.src+g.dst))})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsxs("h3",{children:["Recall records on which FDA lists this 510(k) · ",u.events," event(s), ",u.records," product record(s)"]}),s.side!=="self"&&f.length>0&&o.jsxs("p",{className:"note-box amber",style:{marginBottom:10},children:[f.length," of these record(s) began before ",t.k," was cleared on ",De(t.device.decision_date),"."]}),a.length===0?o.jsx("p",{className:"muted",children:"openFDA lists this 510(k) on no recall record."}):o.jsx("div",{style:{display:"grid",gap:8},children:a.slice(0,20).map(g=>o.jsx(Kc,{r:g},g.id))}),a.length>20&&o.jsxs("p",{className:"muted small",children:["+ ",a.length-20," more record(s): open the device to see all."]})]})]})]})}const bp={rejected_by_reviewer:"rejected by a reviewer",audit_not_predicate:"the audit found it is not a predicate citation",audit_error:"the audit found a K-number error",audit_unresolved:"the audit could not resolve it",not_in_openfda:"K-number not found in openFDA",cleared_after_citing_device:"K-number cleared after the citing device",audit_variant:"audit marked it a naming variant",audit_corrected:"K-number corrected by the audit"};function Gc(e){const t=[];for(const n of e.signals)switch(n.code){case"DIRECT_RECALL":if(n.severity==="info")break;t.push({id:n.code,tone:n.severity==="high"?"alert":"amber",sev:n.severity,title:n.title,what:"The candidate itself appears in FDA recall records.",why:n.severity==="high"?"A design-related recall on the device you would cite is what FDA's 2023 draft guidance asks you to avoid or explain.":"A Class I recall on the candidate is a documented question for any submission that cites it.",todo:"Open each recall record and document how it is addressed (scope, lots, corrective action).",node:e.k});break;case"ANCESTOR_RECALL":if(n.severity!=="medium")break;t.push({id:n.code+n.chain.join(),tone:n.conditional?"violet":"amber",sev:n.severity,title:n.title,conditional:n.conditional,what:n.conditional?"The recall holder is reached only through a citation the audit could not resolve.":`A ${n.gen===1?"direct predicate":"grand-predicate"} carries recall records the verdict rules treat as review-worthy.`,why:n.conditional?"If that citation is not a predicate, this recall does not belong to the lineage; if it is, it does.":"Reviewers expect the predicate rationale to address design-related recalls in the lineage (FDA 2023 draft guidance; Kadakia et al., JAMA 2023, an association).",todo:n.conditional?"Open the uncertain thread, read the PDF page, and confirm or reject it.":"Verify the citation on its PDF page, read the recall records, and record how the rationale addresses them.",chain:n.chain,hops:n.evidence.filter(r=>r.type==="citation")});break;case"UNCERTAIN_LINK_IN_LINEAGE":case"NAME_MISMATCH_IN_LINEAGE":t.push({id:n.code,tone:"alert",sev:"info",title:n.title,what:"Threads in this ancestry rest on evidence that conflicts with FDA records or needed correction.",why:"A doubtful thread may route the lineage to the wrong device, and the right one may be missing; these links never count as checked.",todo:"Open each thread, compare the quote with the cited device, then confirm or reject it.",hops:n.evidence.filter(r=>r.type==="citation")});break;case"ADVISORY_LINK_PENDING_REVIEW":t.push({id:n.code,tone:"violet",sev:"info",title:n.title,what:"An LLM label or the automated MCP client calls these citations predicates; no person has decided.",why:"They are not used for the verdict. If one is a real predicate, its recalls belong in the lineage and the verdict could change.",todo:"Open each link, read the PDF page, and confirm or reject it yourself.",hops:n.evidence.filter(r=>r.type==="advisory_citation")});break;case"CITATION_RETIRED_BY_REINGEST":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Re-reading the citing device's FDA summary no longer found these citations, so they were retired from the lineage.",why:"Earlier reviews, labels and provenance are kept for the record; a review made on the old text may no longer apply.",todo:"Compare the refreshed summary with the earlier one and record a new review if the citation still matters.",hops:n.evidence});break;case"PREDICATE_CITATION_UNRESOLVED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Predicate citations printed in a summary did not become lineage threads.",why:"A missing thread means part of the ancestry is invisible: a recall there would not show.",todo:"Check each quote. If the citation is real and the K-number valid, add that clearance to extend the graph.",missing:n.evidence});break;case"LINEAGE_UNKNOWN":case"LINEAGE_TRUNCATED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Some summaries are not machine-readable, so the ancestry stops there.",why:"Recalls further up those branches cannot be seen. The verdict reports this gap; it never fills it in.",todo:"Try reading each summary live (needs internet), which extends the lineage by one generation.",ingest:n.code==="LINEAGE_UNKNOWN"?[{k:e.k}]:n.evidence});break;case"UNATTRIBUTED_RECALLS_IN_PRODUCT_CODE":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"FDA filed these recalls under the product code without naming a 510(k) number.",why:"No lineage query can attribute them; one may still concern a device in this lineage.",todo:"Read the product descriptions and check whether any names a device in this ancestry.",recalls:n.evidence});break;case"RECALL_CAUSE_OR_CLASS_UNKNOWN":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Recall records without a stated root cause or FDA classification.",why:"They cannot be ruled out as design-related or Class I, so they could change the verdict once classified.",todo:"Re-check the FDA records for an updated classification or root cause.",recalls:n.evidence});break;case"DEEPER_ANCESTRY_GAPS":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Gaps beyond the two-generation verdict window.",why:"They cannot change the verdict, but the lower-severity list may be incomplete.",todo:"Expand the graph to deeper generations if the deeper ancestry matters to your rationale."});break}return t}function eh({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Gc(e);return l.length?o.jsx("div",{"data-testid":"review-queue",children:l.map(i=>{var s,a,u,d;return o.jsxs("section",{className:`review-item tone-${i.tone}`,onMouseEnter:()=>i.chain&&r(i.chain),onMouseLeave:()=>r(null),children:[o.jsxs("h3",{children:[o.jsx("span",{className:`sev sev-${i.sev}`,children:i.conditional?"conditional":i.sev==="info"?"gap":i.sev}),o.jsx("span",{children:i.title})]}),o.jsxs("dl",{children:[o.jsx("dt",{children:"Conflict"}),o.jsx("dd",{children:i.what}),o.jsx("dt",{children:"Why it matters"}),o.jsx("dd",{children:i.why}),o.jsx("dt",{children:"Next step"}),o.jsx("dd",{children:i.todo})]}),((s=i.hops)==null?void 0:s.length)>0&&o.jsx("div",{className:"links",children:i.hops.slice(0,8).map(f=>{const p=Et(f);return o.jsxs("button",{className:"tag-btn",onClick:()=>t({type:"edge",id:f.src+">"+f.dst,hop:f}),title:p.reasons.map(h=>Uc[h]).join("; ")||Re[p.key].label,children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.dst})," · p.",f.page??"?"," · ",o.jsx("span",{className:`status-${p.key}`,children:Re[p.key].short})]},f.src+f.dst)})}),((a=i.missing)==null?void 0:a.length)>0&&o.jsx("div",{className:"links",children:i.missing.slice(0,8).map(f=>o.jsxs("button",{className:"tag-btn",title:f.quote||"",onClick:()=>n("ingest",f.cited),children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.cited})," · ",bp[f.reason]||f.reason]},f.src+f.cited))}),((u=i.ingest)==null?void 0:u.length)>0&&o.jsx("div",{className:"links",children:i.ingest.slice(0,10).map(f=>o.jsxs("button",{className:"tag-btn",onClick:()=>n("ingest",f.k),children:[o.jsx("span",{className:"k",children:f.k}),f.summary_status?` · ${f.summary_status}`:""," · read now"]},f.k))}),((d=i.recalls)==null?void 0:d.length)>0&&o.jsx("div",{className:"links",children:i.recalls.slice(0,8).map(f=>f.url?o.jsxs("a",{className:"tag-btn",href:f.url,target:"_blank",rel:"noreferrer",children:[f.id," ↗"]},f.id):o.jsx("span",{className:"tag-btn",children:f.id},f.id))}),i.node&&o.jsx("div",{className:"acts",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.node}),children:"Open recall records"})}),i.chain&&o.jsx("div",{className:"acts",children:o.jsxs("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.chain[i.chain.length-1]}),children:["Open ",i.chain[i.chain.length-1]," records"]})})]},i.id)})}):o.jsx("p",{className:"muted",children:"Nothing in this lineage needs a person's attention under the current rules."})}function oo(e){const t=e.signals.filter(n=>{var r;return(n.severity==="high"||n.severity==="medium")&&((r=n.chain)==null?void 0:r.length)>1});return t.find(n=>!n.conditional)||t[0]||null}function us(e,t){const n=e.filter(i=>i.design_related),r=n.length?n:e.filter(i=>i.classification==="Class I");return r.filter(i=>i.initiated&&t&&i.initiatedi.initiated.localeCompare(s.initiated))[0]||[...r].sort((i,s)=>(s.initiated||"").localeCompare(i.initiated||""))[0]||null}function th({a:e}){const t=e.device,n=oo(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=us(r.evidence.filter(i=>i.type==="recall"),null);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[o.jsx("span",{className:"k",children:e.k})," itself appears in FDA recall records",l&&o.jsxs(o.Fragment,{children:[": a ",o.jsxs("span",{className:"amber",children:[l.classification||"unclassified"," ",l.root_cause]})," recall began ",De(l.initiated)]}),"."," ","Citing it as a predicate would need that addressed."]})}if(n){const l=kn(e,n.chain[n.chain.length-1]),i=n.evidence.filter(f=>f.type==="recall"),s=us(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Wc(s.initiated,t.decision_date):null,d=so(i);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[it(t.name,48)," cites ",o.jsx("span",{className:"k",children:n.chain[1]}),a!=null&&a.page?o.jsxs(o.Fragment,{children:[" on page ",a.page," of its summary"]}):null,"."," ",n.conditional?o.jsxs(o.Fragment,{children:["The cited device ",o.jsx("span",{className:"k",children:l==null?void 0:l.k}),", reached through a citation the audit could not resolve,"]}):n.chain.length>2?o.jsxs(o.Fragment,{children:["Through it, ",n.gen===2?"grand-predicate":`generation-${n.gen} ancestor`," ",o.jsx("span",{className:"k",children:l==null?void 0:l.k})]}):o.jsx(o.Fragment,{children:"That predicate"})," ","(",it(l==null?void 0:l.name,52),") is listed by FDA on ",d.events," recall event",d.events===1?"":"s"," in this signal",s&&o.jsxs(o.Fragment,{children:[", including a ",o.jsxs("span",{className:"amber",children:[s.classification||"unclassified"," ",s.root_cause]})," recall that began ",De(s.initiated),u&&o.jsxs(o.Fragment,{children:[", ",u.relation==="before"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",e.k," was cleared"]}):Bc(u,e.k)]})]}),".",n.conditional&&o.jsxs(o.Fragment,{children:[" This route is ",o.jsx("b",{style:{color:"var(--violet)"},children:"conditional"}),": it holds only if that citation is a predicate."]})]})}return o.jsx("p",{className:"finding-sentence","data-testid":"finding-sentence",children:e.verdict_reason})}function nh({a:e,onSelect:t}){const n=oo(e);if(!n)return null;const r=n.evidence.filter(d=>d.type==="citation"),l=(d,f)=>{var p,h;return r.find(g=>g.src===d&&g.dst===f)||((h=(p=kn(e,f))==null?void 0:p.hops)==null?void 0:h.find(g=>g.src===d&&g.dst===f))},i=n.chain[n.chain.length-1],s=n.evidence.filter(d=>d.type==="recall"),a=us(s,e.device.decision_date),u=a?Wc(a.initiated,e.device.decision_date):null;return o.jsxs("section",{className:"panel corner-marks","aria-labelledby":"chain-title","data-testid":"critical-chain",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"chain-title",children:["Critical chain ",o.jsx("span",{className:"count",children:"predicate → recall, the route that raised the verdict"})]}),o.jsx("p",{className:"hint",children:"Select a thread for its page and quote."})]}),o.jsx("div",{className:"chain",children:n.chain.map((d,f)=>{const p=kn(e,d)||{},h=f===0?"Candidate":n.conditional?"Cited device · citation unresolved":f===1?"Direct predicate":f===2?"Grand-predicate":`Generation ${f}`,g=d===i,y=g?io({recalls:s}):"none",k=f>0?l(n.chain[f-1],d):null,L=k?Et(k):null;return o.jsxs(Nl.Fragment,{children:[f>0&&o.jsxs("button",{className:`chain-link st-${(L==null?void 0:L.key)||"extracted"}`,onClick:()=>k&&t({type:"edge",id:k.src+">"+k.dst,hop:k}),"aria-label":`${n.chain[f-1]} cites ${d}${k!=null&&k.page?` on page ${k.page}`:""}, ${Re[(L==null?void 0:L.key)||"extracted"].label}. Open provenance.`,children:[o.jsxs("span",{className:"lbl",children:["cites",k!=null&&k.page?` · p.${k.page}`:""]}),o.jsx("span",{className:"sub",children:Re[(L==null?void 0:L.key)||"extracted"].short})]}),o.jsxs("button",{className:`chain-node${f===0?" is-self":""}${y==="design"?" tone-design":""}`,onClick:()=>t({type:"node",k:d}),children:[o.jsx("span",{className:"role",children:h}),o.jsx("span",{className:"k",children:d}),o.jsx("span",{className:"nm",children:it(p.name,44)}),o.jsxs("span",{className:"dt",children:["Cleared ",De(p.decision_date)]}),g&&a&&o.jsxs("span",{className:"rc",children:[o.jsxs("span",{className:`chip tone-${a.design_related?"design":"class1"}`,children:[a.classification||"Unclassified"," · ",a.root_cause]}),o.jsxs("span",{className:"dt",children:["Recall began ",De(a.initiated)," · ",o.jsx("span",{className:"mono",children:a.id})]})]})]})]},d)})}),a&&u&&o.jsxs("div",{className:"chain-timing",children:[o.jsxs("span",{className:"chip tone-amber",children:[o.jsx("span",{className:"glyph"}),Bc(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[so(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function rh({k:e,go:t,onChanged:n}){var Y,Xe;const[r,l]=_.useState(null),[i,s]=_.useState(null),[a,u]=_.useState(!1),[d,f]=_.useState(4),[p,h]=_.useState(2),[g,y]=_.useState("graph"),[k,L]=_.useState(!1),[v,c]=_.useState(null),[m,w]=_.useState(null),[S,E]=_.useState([]),[j,x]=_.useState([]),R=()=>{u(!0),s(null),Oe.assess(e,d).then(M=>{l(M)}).catch(M=>{l(null),s(M.message)}).finally(()=>u(!1)),Oe.assessments(e).then(E).catch(()=>E([])),Oe.investigations(e,10).then(x).catch(()=>x([]))};if(_.useEffect(()=>{c(null),h(2),R()},[e,d]),i)return o.jsxs("div",{className:"panel",role:"alert",children:[o.jsx("p",{className:"err",style:{fontSize:15},children:i}),i.includes("not in the graph")&&o.jsxs("button",{className:"btn btn-primary",onClick:()=>t("ingest",e),children:["Read ",e," from FDA now ",o.jsx("span",{className:"arr",children:"→"})]})]});if(!r)return o.jsxs("div",{"aria-busy":"true",children:[o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Walking ",e,"'s lineage in the Relate graph…"]}),o.jsx("div",{className:"skeleton",style:{height:210,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:160,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:380}})]});const T=r.device,I=r.coverage,K={...Gn[r.verdict],...Op(r.verdict,I.evidence)},me=Gc(r).length,Be=r.signals.filter(M=>M.conditional).length;return o.jsxs("div",{className:"investigation","aria-busy":a,children:[o.jsxs("section",{className:`finding tone-${K.tone}`,"aria-labelledby":"finding-title","data-testid":"finding",children:[o.jsxs("div",{className:"finding-top",children:[o.jsxs("div",{className:"finding-id",children:[o.jsxs("div",{className:"kline",children:[o.jsx("span",{className:"k",children:r.k}),o.jsxs("span",{children:[T.product_code,(Y=T.product)!=null&&Y.name?` · ${T.product.name}`:""]})]}),o.jsx("h1",{id:"finding-title",children:T.name}),o.jsxs("div",{className:"meta",children:[o.jsx("span",{children:T.applicant}),o.jsxs("span",{children:["Cleared ",De(T.decision_date)]}),o.jsx("span",{children:T.clearance_type||"510(k)"}),o.jsx("a",{href:Ac(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),T.summary_url&&o.jsx("a",{href:T.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),o.jsxs("div",{className:`verdict tone-${K.tone}`,"data-testid":"verdict",children:[o.jsxs("div",{className:"verdict-label",children:[o.jsx("i",{"aria-hidden":"true"}),K.label]}),o.jsx("p",{className:"verdict-reason",children:r.verdict_reason}),o.jsx("div",{className:"verdict-actions",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t("compare",r.k),children:"Compare with other candidates"})}),o.jsxs("div",{className:"authority",children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M8 1.5l5.5 2v4.2c0 3.3-2.3 5.8-5.5 6.8-3.2-1-5.5-3.5-5.5-6.8V3.5z M5.5 8l1.8 1.8L10.8 6.3"})}),o.jsxs("span",{children:[o.jsx("b",{children:"Deterministic assessment"})," · ",r.rules_version,". Authoritative within its documented scope: ",I.evidence_scope,", from machine-readable FDA records. A documentation signal, not a safety determination."]})]})]})]}),o.jsx(th,{a:r}),o.jsxs("div",{className:"coverage-row","aria-label":"Evidence coverage",children:[o.jsxs("span",{className:`chip tone-${I.evidence==="complete"?"calm":I.evidence==="uncertain"?"alert":"muted"}`,title:"Completeness of evidence inside the verdict window",children:["Evidence ",I.evidence]}),(I.evidence_reasons||[]).map(M=>o.jsx("span",{className:"chip tone-muted","data-testid":"evidence-reason",children:Up[M]||M},M)),o.jsxs("span",{className:"chip",children:[I.ancestors," ancestors · ",I.generations_traversed," generations"]}),I.ancestors_lineage_unknown>0&&o.jsxs("span",{className:"chip tone-muted",children:[I.ancestors_lineage_unknown," with unread summaries"]}),I.doubtful_links>0&&o.jsxs("span",{className:"chip tone-alert",children:[I.doubtful_links," doubtful link(s)"]}),Be>0&&o.jsxs("span",{className:"chip tone-violet",children:[Be," conditional signal(s)"]}),me>0&&o.jsxs("a",{className:"chip tone-blue",href:"#review",onClick:M=>{var C;M.preventDefault(),(C=document.getElementById("review"))==null||C.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),o.jsx(nh,{a:r,onSelect:c}),o.jsxs("section",{className:"panel","aria-labelledby":"graph-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"graph-title",children:["Evidence graph ",o.jsxs("span",{className:"count",children:[r.ancestors.length," ancestors · ",r.descendants.length," later devices"]})]}),o.jsxs("div",{className:"graph-tools",children:[o.jsxs("div",{className:"seg",role:"group","aria-label":"View",children:[o.jsx("button",{"aria-pressed":g==="graph",onClick:()=>y("graph"),children:"Graph"}),o.jsx("button",{"aria-pressed":g==="timeline",onClick:()=>y("timeline"),children:"Timeline"})]}),o.jsxs("label",{className:"small muted",children:["Show ",o.jsx("select",{className:"field",value:p,onChange:M=>h(+M.target.value),"aria-label":"Generations shown",children:Array.from({length:d},(M,C)=>C+1).map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),o.jsxs("label",{className:"small muted",children:["Query ",o.jsx("select",{className:"field",value:d,onChange:M=>f(+M.target.value),"aria-label":"Generations traversed by the query",children:[2,3,4,5,6].map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),g==="graph"&&r.descendants.length>0&&o.jsxs("button",{className:"btn btn-line btn-sm","aria-pressed":k,onClick:()=>L(!k),children:[k?"Hide":"Show"," later devices"]})]})]}),g==="graph"?o.jsx(Kp,{a:r,depth:p,onDepth:h,descendants:k,selected:v,onSelect:c,focusChain:m}):o.jsx(Yp,{a:r,depth:p,highlight:m||((Xe=oo(r))==null?void 0:Xe.chain),onSelect:c}),o.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(M=>M.lineage_known).length," summary PDFs opened one generation at a time and ",1+r.ancestors.length," separate recall searches. Here it is one Relate query."]})]}),o.jsxs("div",{className:"grid-main",children:[o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("section",{className:"panel",id:"review","aria-labelledby":"review-title",style:{scrollMarginTop:120},children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"review-title",children:["What needs human review ",o.jsx("span",{className:"count",children:me})]}),o.jsx("p",{className:"hint",children:"What conflicts, why it matters, and what to do next."})]}),o.jsx(eh,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(lh,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(sh,{a:r,reload:R,go:t,onSelect:c}),o.jsx(oh,{a:r,onSaved:()=>{Oe.assessments(e).then(E),n&&n()}}),o.jsx(ah,{a:r,assessments:S,runs:j,go:t})]})]}),v&&o.jsx(Zp,{sel:v,a:r,onClose:()=>c(null),go:(M,C)=>{c(null),t(M,C)},reload:R,onSelect:c})]})}function lh({a:e,onSelect:t}){const n=e.signals.filter(r=>r.severity==="high"||r.severity==="medium"||r.severity==="low");return o.jsxs("section",{className:"panel","aria-labelledby":"signals-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"signals-title",children:["Recall signals ",o.jsxs("span",{className:"count",children:[n.length," in the readable ancestry"]})]}),o.jsx("p",{className:"hint",children:"Every recall record behind the verdict, by generation."})]}),n.length===0&&o.jsx("p",{className:"muted",children:"No recall records anywhere in the readable ancestry."}),n.map((r,l)=>o.jsx(ih,{s:r,onSelect:t},l))]})}function ih({s:e,onSelect:t}){var i;const[n,r]=_.useState(e.severity==="high"),l=e.evidence.filter(s=>s.type==="recall");return o.jsxs("div",{className:"signal",children:[o.jsxs("button",{className:"signal-head","aria-expanded":n,onClick:()=>r(!n),children:[o.jsx("span",{className:`sev sev-${e.severity}`,children:e.conditional?"cond.":e.severity}),o.jsx("span",{className:"t",children:e.title}),o.jsx("svg",{className:"chev",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M4 2l4 4-4 4",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})})]}),n&&o.jsxs("div",{className:"signal-body",children:[((i=e.chain)==null?void 0:i.length)>1&&o.jsx("div",{className:"tags",children:e.chain.map((s,a)=>o.jsxs(Nl.Fragment,{children:[a>0&&o.jsx("span",{className:"muted small","aria-hidden":"true",children:"→"}),o.jsx("button",{className:"tag-btn",onClick:()=>t({type:"node",k:s}),children:o.jsx("span",{className:"k",children:s})})]},s))}),l.slice(0,6).map(s=>o.jsx(Kc,{r:s},s.id)),l.length>6&&o.jsxs("p",{className:"muted small",children:["+ ",l.length-6," more record(s): open ",e.chain[e.chain.length-1]," for all."]})]})]})}const Ar=(e,t)=>e.review===t&&mt(e);function sh({a:e,reload:t,go:n,onSelect:r}){const[l,i]=_.useState(null),[s,a]=_.useState(null),u=async(d,f,p)=>{i(d.dst+p),a(null);try{const h=await f();a(p==="ai"?{ok:!0,text:`LLM labelled ${d.dst} "${h.ai_label}" (${h.model.split("/")[1]}, ${h.seconds}s). Advisory only: it is not used for the verdict until a person confirms the citation.`}:null),t()}catch(h){a({ok:!1,text:h.message})}finally{i(null)}};return o.jsxs("section",{className:"panel","aria-labelledby":"cites-title",children:[o.jsx("div",{className:"panel-head",children:o.jsxs("h2",{id:"cites-title",children:["What ",e.k," cites ",o.jsx("span",{className:"count",children:e.citations.length})]})}),o.jsx("p",{className:"lede",children:"Read from its 510(k) summary. Your review is written to the graph and changes every lineage query."}),e.device.lineage_known===!1&&o.jsxs("p",{className:"note-box",children:["Summary not machine-readable (",e.device.summary_status,")."," ",o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>n("ingest",e.k),children:"Try reading it now →"})]}),s&&o.jsx("p",{className:s.ok?"ok":"err",role:"status",children:s.text}),e.citations.map(d=>{const f={...d,src:e.k},p=d.in_lineage??d.kind==="predicate",h=Et(f);return o.jsxs("div",{className:"cit"+(d.review==="rejected"&&mt(d)?" is-rejected":""),children:[o.jsxs("div",{className:"cit-h",children:[o.jsx("button",{className:"k mono",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:d.dst}),o.jsx("span",{className:`chip ${d.kind==="predicate"?"tone-blue":"tone-muted"}`,children:d.kind}),p||h.key==="advisory"||h.key==="retired"?o.jsxs("span",{className:`status status-${h.key}`,title:Re[h.key].label,"data-testid":`cit-status-${d.dst}`,children:[o.jsx("span",{className:"line"}),Re[h.key].short]}):o.jsx("span",{className:"status status-rejected",title:"Reference devices and mentions are not lineage links","data-testid":`cit-status-${d.dst}`,children:"Not a lineage link"}),d.ai_label&&o.jsxs("span",{className:"chip tone-violet",title:d.ai_quote,children:["LLM: ",d.ai_label]}),o.jsxs("span",{className:"muted small",children:[it(d.name,34)," · ",Vc(d.dst_decision_date)]})]}),o.jsx(Qc,{text:d.quote||d.snippet,k:d.dst,ocr:d.text_source&&d.text_source!=="pdf_text_layer"}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.review(e.k,d.dst,Ar(d,"confirmed")?"":"confirmed"),"ok"),children:Ar(d,"confirmed")?"Unconfirm":"Confirm"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.review(e.k,d.dst,Ar(d,"rejected")?"":"rejected"),"no"),children:Ar(d,"rejected")?"Restore":"Reject"}),d.kind!=="predicate"&&o.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.triage(e.k,d.dst),"ai"),children:l===d.dst+"ai"?"Asking…":"Ask LLM to label"}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:["Provenance · p.",d.page]})]})]},d.dst)})]})}function oh({a:e,onSaved:t}){const[n,r]=_.useState(!1),[l,i]=_.useState(""),[s,a]=_.useState(null),[u,d]=_.useState(!1);_.useEffect(()=>{a(null),r(!1),i("")},[e.k]);const f=async()=>{d(!0);try{const h=await Oe.save(e.k,l);a(h),r(!1),i(""),t()}catch(h){a({error:h.message})}finally{d(!1)}},p=e.memo.headline+` + +`+e.memo.paragraphs.map(h=>h.text).join(` + +`);return o.jsxs("section",{className:"panel memo","aria-labelledby":"memo-title",children:[o.jsx("div",{className:"panel-head",children:o.jsx("h2",{id:"memo-title",children:"Due-diligence note"})}),o.jsx("div",{className:"src",children:e.memo.source}),o.jsx("p",{children:o.jsx("b",{children:e.memo.headline})}),e.memo.paragraphs.slice(0,2).map((h,g)=>o.jsx("p",{children:h.text},g)),e.memo.paragraphs.length>2&&o.jsxs("p",{className:"muted small",children:["+ ",e.memo.paragraphs.length-2," more paragraph(s) in the copied note."]}),o.jsxs("div",{className:"cit-a",style:{marginTop:8},children:[o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>r(!n),"aria-expanded":n,children:"Save assessment to graph"}),o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>{var h;return(h=navigator.clipboard)==null?void 0:h.writeText(p)},children:"Copy note"})]}),n&&o.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[o.jsx("label",{className:"small muted",htmlFor:"analyst-note",children:"Optional analyst note, stored with the assessment"}),o.jsx("textarea",{id:"analyst-note",className:"field",rows:3,value:l,onChange:h=>i(h.target.value),maxLength:1e3}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-primary btn-sm",disabled:u,onClick:f,children:u?"Saving…":"Save to Relate"}),o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>r(!1),children:"Cancel"})]})]}),s&&(s.error?o.jsx("p",{className:"err",children:s.error}):o.jsxs("p",{className:"ok",role:"status",children:["Saved ",s.id,": linked to ",s.flagged_recalls.length," flagged recall record(s)."]}))]})}function ah({a:e,assessments:t,runs:n,go:r}){return o.jsxs("section",{className:"panel","aria-labelledby":"hist-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{id:"hist-title",children:"Investigation history"}),o.jsx("a",{className:"small",href:"#/history",children:"All history →"})]}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"0 0 8px"},children:"Saved assessments"}),t.length===0?o.jsxs("p",{className:"muted small",children:["None saved for ",e.k," yet."]}):t.map(l=>{var i,s,a,u,d,f;return o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"muted",children:(i=l.created_at)==null?void 0:i.slice(0,16).replace("T"," ")}),o.jsx("span",{className:`chip tone-${((s=Gn[l.verdict])==null?void 0:s.tone)||"muted"}`,children:((a=Gn[l.verdict])==null?void 0:a.label)||l.verdict})]}),l.stale&&o.jsxs("div",{className:"stale",children:["Stale: the graph changed after this was saved",l.verdict_now!==l.verdict&&o.jsxs(o.Fragment,{children:[" (verdict now ",((u=Gn[l.verdict_now])==null?void 0:u.label)||l.verdict_now,")"]}),((d=l.changed_edges)==null?void 0:d.length)>0&&o.jsxs(o.Fragment,{children:[" · reviewed links: ",l.changed_edges.join(", ")]}),((f=l.reingested)==null?void 0:f.length)>0&&o.jsxs(o.Fragment,{children:[" · re-ingested: ",l.reingested.join(", ")]})]})]},l.id)}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"16px 0 8px"},children:"Agent runs (optional)"}),o.jsx("p",{className:"muted small",style:{margin:"0 0 6px"},children:"Machine findings, never human-approved. The verdict above does not depend on them."}),n.length===0?o.jsxs("p",{className:"muted small",children:["No agent runs examined ",e.k," in this store."]}):n.map(l=>o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"chip",children:l.status}),l.stale&&o.jsx("span",{className:"stale",children:"stale"}),o.jsx("a",{href:Np(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function uh({go:e,stats:t}){const n=[["K252078","BreathePal Bilevel","Cleared 2026 · direct predicate under a Class I design recall"],["K251770","SleepRes PAP System","Cleared 2025 · a second real lineage"],["K200480","DreamStation 2","Cleared 2020, before the June 2021 recall began"]];return o.jsxs("div",{className:"home-hero",children:[o.jsxs("div",{className:"page-head",children:[o.jsx("p",{className:"eyebrow",children:"Investigate"}),o.jsx("h1",{children:"Check a predicate's ancestry before you cite it."}),o.jsxs("p",{children:["Search any clearance above (press ",o.jsx("code",{children:"/"}),"), or open one of the real cases in the shipped dataset of CPAP, BiPAP and ventilator clearances."]})]}),o.jsxs("div",{className:"home-cases",children:[n.map(([r,l,i])=>o.jsxs("button",{className:"case",onClick:()=>e("check",r),children:[o.jsx("span",{className:"k mono",children:r}),o.jsx("h3",{children:l}),o.jsx("p",{children:i})]},r)),o.jsxs("button",{className:"case",onClick:()=>e("reach","88058,88071"),children:[o.jsx("span",{className:"k mono",children:"Recall 88058 + 88071"}),o.jsx("h3",{children:"Philips foam recall reach"}),o.jsx("p",{children:"Who descends from the June 2021 recall?"})]})]}),t&&o.jsxs("p",{className:"muted small",style:{marginTop:18},children:[t.nodes.Device.toLocaleString("en-US")," clearances · ",t.citations_by_kind.predicate.toLocaleString("en-US")," predicate links · ",t.nodes.Recall.toLocaleString("en-US")," recall records in the Relate store."]})]})}const ch={compare:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>Mt(()=>import("./History-DLMWLVIE.js"),[])),method:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.MethodView})))},dh={check:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"}),compare:o.jsx("path",{d:"M2 3h5v10H2zM9 3h5v10H9z"}),reach:o.jsx("path",{d:"M3 8a5 5 0 1010 0A5 5 0 003 8zm3 0a2 2 0 104 0 2 2 0 00-4 0z"}),watch:o.jsx("path",{d:"M1.5 8S4 3 8 3s6.5 5 6.5 5S12 13 8 13 1.5 8 1.5 8zM8 10a2 2 0 100-4 2 2 0 000 4z"}),ingest:o.jsx("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M2 12v2h12v-2"}),history:o.jsx("path",{d:"M8 4v4l2.5 2M2.5 8a5.5 5.5 0 105.5-5.5A5.6 5.6 0 003 6M3 2.5V6h3.5"}),method:o.jsx("path",{d:"M3 2h7l3 3v9H3zM10 2v3h3M5.5 8h5M5.5 11h5"})},fh=({name:e})=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:dh[e]}),ph=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function hh({route:e,go:t,stats:n,statsErr:r,refreshStats:l,onReplay:i}){var u,d;const s=_.useRef(null);_.useEffect(()=>{var f;(f=s.current)==null||f.focus({preventScroll:!0})},[e.tab]);const a=ch[e.tab];return o.jsxs("div",{className:"ws",children:[o.jsxs("header",{className:"ws-top",children:[o.jsx("a",{className:"brand",href:"#/","aria-label":"Forebear home: the film",children:o.jsx(Sp,{size:24})}),o.jsx(mh,{go:t}),o.jsx("span",{className:"spacer"}),o.jsxs("div",{className:"store-chip",title:"Live counts from the Relate single-file store",children:[o.jsx("i",{className:"dot"+(r?" off":""),"aria-hidden":"true"}),n?o.jsxs("span",{className:"counts",children:[o.jsx("b",{children:(u=n.nodes.Device)==null?void 0:u.toLocaleString("en-US")})," devices · ",o.jsx("b",{children:(d=n.nodes.Recall)==null?void 0:d.toLocaleString("en-US")})," recalls · Relate"]}):o.jsx("span",{children:r?"API unavailable":"Connecting…"})]})]}),o.jsxs("nav",{className:"ws-rail","aria-label":"Workspace",children:[ph.map(([f,p])=>o.jsxs(Nl.Fragment,{children:[o.jsx("div",{className:"group",children:f}),p.map(([h,g])=>o.jsxs("a",{href:`#/${h}`,"aria-current":e.tab===h?"page":void 0,children:[o.jsx(fh,{name:h}),g]},h))]},f)),o.jsxs("div",{className:"rail-foot",children:["Verdicts are deterministic documentation signals from FDA records, not safety findings.",!matchMedia("(prefers-reduced-motion: reduce)").matches&&o.jsx("div",{style:{marginTop:10},children:o.jsx("button",{onClick:i,children:"Replay the film"})})]})]}),o.jsxs("main",{className:"ws-main",id:"main",ref:s,tabIndex:-1,style:{outline:"none"},children:[e.tab==="check"&&(e.arg?o.jsx(rh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(uh,{go:t,stats:n})),a&&o.jsx(_.Suspense,{fallback:o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Loading…"]}),children:o.jsx(a,{initial:e.arg,go:t,onChanged:l,stats:n})}),!a&&e.tab!=="check"&&o.jsx("div",{className:"panel",children:o.jsxs("p",{children:["Unknown page. ",o.jsx("a",{href:"#/check",children:"Go to the workspace →"})]})}),o.jsx("footer",{className:"ws-foot",children:"Public FDA data: openFDA 510(k), recall and enforcement records; 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."})]})]})}function mh({go:e}){const[t,n]=_.useState(""),[r,l]=_.useState([]),[i,s]=_.useState(!1),[a,u]=_.useState(0),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(clearTimeout(f.current),t.trim().length<2){l([]);return}let g=!0;return f.current=setTimeout(()=>Oe.search(t).then(y=>{g&&(l(y),u(0))}).catch(()=>g&&l([])),160),()=>{g=!1}},[t]),_.useEffect(()=>{const g=y=>{var k,L;y.key==="/"&&!/INPUT|TEXTAREA|SELECT/.test((k=document.activeElement)==null?void 0:k.tagName)&&(y.preventDefault(),(L=d.current)==null||L.focus())};return addEventListener("keydown",g),()=>removeEventListener("keydown",g)},[]);const p=g=>{var y;s(!1),n(""),(y=d.current)==null||y.blur(),e("check",g)},h=i&&r.length>0;return o.jsxs("div",{className:"search",role:"search",children:[o.jsx("svg",{className:"icon",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"})}),o.jsx("input",{ref:d,className:"field",value:t,placeholder:"Search a device or K-number","aria-label":"Search devices by name or K-number",role:"combobox","aria-expanded":h,"aria-controls":"search-results","aria-activedescendant":h?`sr-${a}`:void 0,"aria-autocomplete":"list",onChange:g=>{n(g.target.value),s(!0)},onFocus:()=>s(!0),onBlur:()=>setTimeout(()=>s(!1),150),onKeyDown:g=>{if(g.key==="ArrowDown")g.preventDefault(),u(y=>Math.min(y+1,r.length-1));else if(g.key==="ArrowUp")g.preventDefault(),u(y=>Math.max(y-1,0));else if(g.key==="Escape")s(!1),g.currentTarget.blur();else if(g.key==="Enter"){const y=t.trim().toUpperCase();/^K\d{6}$/.test(y)?p(y):r[a]&&p(r[a].k)}}}),!t&&o.jsx("kbd",{"aria-hidden":"true",children:"/"}),h&&o.jsx("ul",{className:"search-results",id:"search-results",role:"listbox",children:r.map((g,y)=>o.jsxs("li",{id:`sr-${y}`,role:"option","aria-selected":y===a,onMouseDown:()=>p(g.k),onMouseEnter:()=>u(y),children:[o.jsxs("span",{children:[o.jsx("span",{className:"k",children:g.k})," ",g.name]}),o.jsxs("small",{children:[g.applicant," · ",g.decision_date," · ",g.product_code]})]},g.k))})]})}const vh=_.lazy(()=>Mt(()=>import("./Landing-DUH1bgY7.js"),[])),gh={about:"method"};function Or(e=window.location.hash){if(!e.startsWith("#/"))return{tab:"film",arg:""};const t=e.replace(/^#\/?/,"");if(!t)return{tab:"film",arg:""};const[n,...r]=t.split("/");return{tab:gh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const yh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function xh(){const[e,t]=_.useState(Or),[n,r]=_.useState(null),[l,i]=_.useState(null),s=Lp("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!Ep()&&!matchMedia("(prefers-reduced-motion: reduce)").matches),[d,f]=_.useState(a?"pending":"none");_.useEffect(()=>{document.documentElement.dataset.motion=s?"reduced":"full"},[s]),_.useEffect(()=>{const y=()=>t(Or());return addEventListener("hashchange",y),()=>removeEventListener("hashchange",y)},[]);const p=_.useCallback((y=0)=>Oe.stats().then(k=>{r(k),i(null)}).catch(k=>{y<5?setTimeout(()=>p(y+1),800*(y+1)):i(k.message)}),[]);_.useEffect(()=>{p()},[p]),_.useEffect(()=>{const y={film:"Forebear · Every clearance has a past",check:e.arg?`${e.arg} · Forebear`:"Investigate · Forebear",compare:"Compare predicates · Forebear",reach:"Recall reach · Forebear",watch:"Watchlist · Forebear",ingest:"Add a clearance · Forebear",history:"History · Forebear",method:"Method · Forebear"};document.title=y[e.tab]||"Forebear"},[e]);const h=_.useCallback((y,k="",L={})=>{const v=yh(y,k),c=()=>{history.pushState(null,"",v),t(Or(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>Fc.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Or());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Tp(),e.tab!=="film"&&h("film"),window.scrollTo(0,0),s||(f("pending"),u(!0))};return o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"skip-link",href:"#main",onClick:y=>{var k;y.preventDefault(),(k=document.getElementById("main"))==null||k.focus()},children:"Skip to content"}),a&&o.jsx(Pp,{onDone:()=>{f("bloom"),setTimeout(()=>u(!1),700),requestAnimationFrame(()=>{var y;return(y=document.getElementById("hero-title"))==null?void 0:y.focus({preventScroll:!0})})}}),o.jsx("div",{inert:a&&d==="pending"?"":void 0,style:{display:"contents"},children:e.tab==="film"?o.jsx(_.Suspense,{fallback:o.jsx("div",{style:{minHeight:"100vh"}}),children:o.jsx(vh,{go:h,stats:n,introDone:d,reduced:s})}):o.jsx(hh,{route:e,go:h,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}Ic(document.getElementById("root")).render(o.jsx(xh,{}));export{Hc as A,wh as E,Oc as M,fi as P,Nl as R,kh as T,Gn as V,Sp as W,Mt as _,Up as a,ka as b,Oe as c,Np as d,De as f,o as j,wa as m,Fp as p,_ as r,Lp as u,Op as v}; diff --git a/web/dist/assets/index-CVW0ffI2.css b/web/dist/assets/index-CVW0ffI2.css new file mode 100644 index 0000000..5bdc04a --- /dev/null +++ b/web/dist/assets/index-CVW0ffI2.css @@ -0,0 +1 @@ +@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2) format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2) format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2) format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-greek-wght-normal-CkhJZR-_.woff2) format("woff2-variations");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2) format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-latin-wght-normal-Dx4kXJAl.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Newsreader Variable;font-style:normal;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-vietnamese-wght-normal-Czsa-EzN.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Newsreader Variable;font-style:normal;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-ext-wght-normal-C-3rgBeH.woff2) format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Newsreader Variable;font-style:normal;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-wght-normal-CCVVNp6i.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Newsreader Variable;font-style:italic;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-vietnamese-wght-italic-xAqemagA.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Newsreader Variable;font-style:italic;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-ext-wght-italic-DFS986qL.woff2) format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Newsreader Variable;font-style:italic;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-wght-italic-Bxi8ein9.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}:root{--night-0: #070c17;--night-1: #0b1322;--night-2: #101a2e;--night-3: #16233b;--night-4: #1e2e4b;--rule: rgba(236, 228, 210, .09);--rule-2: rgba(236, 228, 210, .16);--ivory: #f1ebdd;--ivory-2: #e6dcc7;--paper: #f6f1e5;--paper-ink: #22252b;--paper-mute: #6c6656;--ink: #ece6d8;--ink-2: rgba(236, 230, 216, .74);--ink-3: rgba(236, 230, 216, .64);--ink-4: rgba(236, 230, 216, .55);--blue: #7fa2ff;--blue-2: #5b82f0;--blue-soft: rgba(127, 162, 255, .14);--amber: #e7a948;--amber-2: #c98a2c;--amber-soft: rgba(231, 169, 72, .14);--alert: #e98a6f;--alert-soft: rgba(233, 138, 111, .14);--sage: #8fc1a3;--sage-soft: rgba(143, 193, 163, .14);--violet: #b7a4f5;--serif: "Newsreader Variable", "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;--sans: "Inter Variable", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;--mono: "Cascadia Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;--r-s: 6px;--r-m: 10px;--r-l: 16px;--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-io: cubic-bezier(.65, 0, .35, 1);--shadow: 0 18px 50px -20px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .25);color-scheme:dark;font-family:var(--sans);font-feature-settings:"cv11","ss01"}*{box-sizing:border-box}html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}@media (prefers-reduced-motion: reduce){html{scroll-behavior:auto}}body{margin:0;background:var(--night-1);color:var(--ink);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::selection{background:#7fa2ff59;color:#fff}a{color:var(--blue);text-decoration:none;text-underline-offset:3px}a:hover{text-decoration:underline}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:4px}q{quotes:"“" "”"}code{font-family:var(--mono);font-size:.92em;background:var(--night-3);padding:1px 5px;border-radius:4px}.k,.mono{font-family:var(--mono);font-variant-numeric:tabular-nums slashed-zero;letter-spacing:-.01em}.num{font-variant-numeric:tabular-nums}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.skip-link{position:fixed;left:12px;top:-60px;z-index:200;background:var(--ivory);color:var(--night-1);padding:8px 14px;border-radius:var(--r-s);font-weight:600;transition:top .2s}.skip-link:focus{top:12px}.muted{color:var(--ink-3)}.small{font-size:12px}.mark{display:block;overflow:visible}.mark-thread{stroke:var(--blue);stroke-width:1.6;stroke-linecap:round}.mark-node{fill:var(--ivory)}.mark-node.past{fill:var(--amber)}.wordmark{display:inline-flex;align-items:center;gap:10px}.wordmark-name{font-family:var(--serif);font-size:21px;font-weight:500;letter-spacing:-.01em;color:var(--ivory)}.btn{display:inline-flex;align-items:center;gap:8px;border:1px solid transparent;border-radius:999px;padding:8px 16px;font-weight:560;font-size:13.5px;cursor:pointer;white-space:nowrap;transition:background .2s var(--ease-out),border-color .2s,color .2s,transform .2s var(--ease-out);text-decoration:none!important}.btn:active{transform:translateY(1px)}.btn-primary{background:var(--ivory);color:var(--night-1)}.btn-primary:hover{background:#fff}.btn-line{border-color:var(--rule-2);color:var(--ink);background:transparent}.btn-line:hover{border-color:var(--ink-3);background:#ffffff08}.btn-quiet{background:transparent;color:var(--ink-2);padding:6px 10px;border-radius:var(--r-s)}.btn-quiet:hover{color:var(--ink);background:var(--night-3)}.btn-sm{padding:5px 11px;font-size:12.5px}.btn:disabled{opacity:.45;cursor:default}.btn .arr{transition:transform .25s var(--ease-out)}.btn:hover .arr{transform:translate(3px)}.field{width:100%;background:var(--night-2);border:1px solid var(--rule-2);border-radius:var(--r-m);padding:10px 14px;color:var(--ink);transition:border-color .2s,background .2s}.field::placeholder{color:var(--ink-4)}.field:focus{outline:none;border-color:var(--blue);background:var(--night-3)}select.field{padding:6px 10px;width:auto}.chip{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:560;line-height:1;padding:5px 9px;border-radius:999px;background:var(--night-3);color:var(--ink-2);white-space:nowrap}.chip .glyph{width:8px;height:8px;border-radius:50%;background:currentColor;flex:none}.chip.tone-design,.chip.tone-amber,.chip.tone-class1{background:var(--amber-soft);color:var(--amber)}.chip.tone-other{background:var(--night-3);color:var(--ink-2)}.chip.tone-alert{background:var(--alert-soft);color:var(--alert)}.chip.tone-calm{background:var(--sage-soft);color:var(--sage)}.chip.tone-blue{background:var(--blue-soft);color:var(--blue)}.chip.tone-muted{background:var(--night-3);color:var(--ink-3)}.chip.tone-violet{background:#b7a4f524;color:var(--violet)}.status{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;font-weight:560;white-space:nowrap}.status .line{width:22px;height:0;border-top:2px solid currentColor;flex:none}.status-confirmed{color:var(--sage)}.status-extracted{color:var(--blue)}.status-disputed{color:var(--alert)}.status-disputed .line{border-top-style:dashed}.status-conditional{color:var(--violet)}.status-conditional .line{border-top-style:dotted;border-top-width:3px}.status-rejected{color:var(--ink-4)}.status-rejected .line{border-top-style:dashed;opacity:.6}.status-advisory{color:var(--violet)}.status-advisory .line{border-top-style:dotted;opacity:.7}.status-retired{color:var(--ink-4)}.status-retired .line{border-top-style:dotted;opacity:.4}.intro{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 46%,#101b31 0%,var(--night-0) 70%);transition:opacity .55s var(--ease-io),visibility .55s}.intro.is-leaving{opacity:0;visibility:hidden;pointer-events:none}.intro-lockup{display:grid;justify-items:center;gap:22px;transform:translateY(-2vh)}.intro-mark{width:116px;height:116px}.intro-mark .mark-thread{stroke-dasharray:1;stroke-dashoffset:1;animation:draw .62s var(--ease-out) forwards;stroke-width:1.1}.intro-mark .mark-node{transform-box:fill-box;transform-origin:center;transform:scale(0);opacity:0;animation:pop .55s var(--ease-out) forwards}.intro-mark .n0{animation-delay:.05s}.intro-mark .n2{animation-delay:.22s}.intro-mark .n4{animation-delay:.39s}.intro-mark .n1{animation-delay:.62s}.intro-mark .n3{animation-delay:.74s}.intro-mark .t1{animation-delay:.4s}.intro-mark .t3{animation-delay:.58s}.intro-mark .t0{animation-delay:.8s}.intro-mark .t2{animation-delay:.92s}.intro-mark .mark-node.past{animation:pop .55s var(--ease-out) .39s forwards,ember 1.6s ease-in-out 1.15s 1}.intro-word{font-family:var(--serif);font-size:clamp(34px,6vw,52px);font-weight:420;letter-spacing:-.02em;color:var(--ivory);display:flex;overflow:hidden}.intro-word span{display:inline-block;transform:translateY(105%);animation:rise .8s var(--ease-out) forwards}.intro-tag{font-family:var(--serif);font-style:italic;font-size:clamp(17px,2.4vw,22px);color:var(--ink-2);margin:0;overflow:hidden}.intro-tag span{display:inline-block;opacity:0;transform:translateY(40%);animation:fadeRise .9s var(--ease-out) 1.55s forwards}.intro-tag em{color:var(--amber);font-style:italic}.intro-skip{position:absolute;right:22px;bottom:22px}@keyframes draw{to{stroke-dashoffset:0}}@keyframes pop{to{transform:scale(1);opacity:1}}@keyframes rise{to{transform:translateY(0)}}@keyframes fadeRise{to{opacity:1;transform:none}}@keyframes ember{0%,to{filter:none}45%{filter:drop-shadow(0 0 6px rgba(231,169,72,.9))}}.film{position:relative}.film-stage{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0;pointer-events:none}.film-stage canvas{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;opacity:0;transition:opacity 1.2s var(--ease-io)}.film-stage canvas.is-live{opacity:1}.film-fallback{position:absolute;top:0;right:0;bottom:0;left:0;background:radial-gradient(1200px 700px at 72% 30%,rgba(91,130,240,.1),transparent 60%),radial-gradient(900px 600px at 15% 85%,rgba(231,169,72,.05),transparent 60%),var(--night-1)}.film-fallback svg{position:absolute;right:6vw;top:18vh;width:min(46vw,560px);opacity:.5}.film-vignette{position:absolute;top:0;right:0;bottom:0;left:0;background:radial-gradient(ellipse at 50% 50%,transparent 55%,rgba(4,7,14,.55) 100%)}.film>main,.film>footer{position:relative;z-index:1}.film-top{position:fixed;top:0;left:0;right:0;z-index:30!important;display:flex;align-items:center;gap:16px;padding:16px clamp(16px,4vw,44px);transition:background .4s,backdrop-filter .4s,border-color .4s;border-bottom:1px solid transparent}.film-top.is-solid{background:#090f1bb8;-webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2);border-color:var(--rule)}.film-top .spacer{flex:1}.film-top nav{display:flex;gap:4px}.film-top nav a{color:var(--ink-2);font-size:13px;padding:6px 10px;border-radius:var(--r-s)}.film-top nav a:hover{color:var(--ink);text-decoration:none;background:#ffffff0a}.hero{position:relative;min-height:100svh;display:grid;align-content:center;padding:96px clamp(16px,6vw,88px) 72px;max-width:1240px}.eyebrow{font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-3);font-weight:600;margin:0 0 22px;display:flex;gap:12px;align-items:center}.eyebrow:before{content:"";width:28px;height:1px;background:var(--blue)}.hero h1{font-family:var(--serif);font-weight:380;font-size:clamp(42px,6.4vw,86px);line-height:.98;letter-spacing:-.035em;margin:0;max-width:11.5ch;color:var(--ivory)}.hero h1 em{font-style:italic;color:var(--amber);font-weight:360}.hero-lede{font-size:clamp(16px,1.6vw,19px);line-height:1.55;color:var(--ink-2);max-width:40em;margin:28px 0 0}.hero-lede b{color:var(--ink);font-weight:600}.hero-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:34px;align-items:center}.hero-proof{animation:fadeIn .6s var(--ease-out);display:flex;gap:clamp(20px,4vw,48px);flex-wrap:wrap;margin-top:40px;padding-top:24px;border-top:1px solid var(--rule);max-width:760px}.hero-proof div{display:grid;gap:2px}.hero-proof b{font-family:var(--serif);font-size:30px;font-weight:400;color:var(--ivory);font-variant-numeric:tabular-nums}.hero-proof span{font-size:12px;color:var(--ink-3)}.chapter{min-height:150svh;display:flex;align-items:center;padding:0 clamp(16px,6vw,88px)}.chapter.place-left{justify-content:flex-start}.chapter.place-right{justify-content:flex-end}.chapter-copy{max-width:460px;padding:30px 0}.chapter-label{display:flex;gap:14px;align-items:baseline;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-3);font-weight:600;margin:0 0 18px}.chapter-label span{font-family:var(--mono);color:var(--blue);letter-spacing:0}.chapter-statement{font-family:var(--serif);font-weight:380;font-size:clamp(34px,4.6vw,58px);line-height:1.02;letter-spacing:-.03em;margin:0 0 22px;color:var(--ivory)}.chapter-statement em{font-style:italic;color:var(--amber)}.chapter-body{font-size:16px;line-height:1.65;color:var(--ink-2);margin:0 0 18px}.chapter-body b{color:var(--ink);font-weight:600}.chapter-foot{font-size:12.5px;color:var(--ink-3);margin:0;padding-left:14px;border-left:1px solid var(--rule-2)}.ln{display:block;overflow:hidden;padding-bottom:.06em}.ln>span{display:inline-block;transform:translateY(110%);transition:transform 1s var(--ease-out)}.reveal .chapter-body,.reveal .chapter-foot,.reveal .doc,.reveal .fact-row{opacity:0;transform:translateY(14px);transition:opacity .9s var(--ease-out) .18s,transform .9s var(--ease-out) .18s}.reveal.in-frame .ln>span{transform:none}.reveal.in-frame .ln:nth-child(2)>span{transition-delay:.08s}.reveal.in-frame .chapter-body,.reveal.in-frame .chapter-foot,.reveal.in-frame .doc,.reveal.in-frame .fact-row{opacity:1;transform:none}html[data-film=off] .ln>span,html[data-motion=reduced] .ln>span{transform:none;transition:none}html[data-film=off] .reveal *,html[data-motion=reduced] .reveal *{opacity:1!important;transform:none!important;transition:none!important}.doc{background:var(--paper);color:var(--paper-ink);border-radius:4px;padding:18px 20px 16px;box-shadow:var(--shadow);font-family:var(--serif);font-size:15.5px;line-height:1.5;margin:22px 0 18px;position:relative}.doc:before{content:"";position:absolute;inset:0 auto 0 0;width:3px;background:var(--blue-2);border-radius:4px 0 0 4px}.doc-meta{font-family:var(--sans);font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--paper-mute);display:flex;justify-content:space-between;gap:12px;margin-bottom:8px}.doc mark{background:#5b82f029;color:#1d3f9e;padding:0 2px;border-radius:2px;font-family:var(--mono);font-size:.9em}.doc a{color:#2d56c4;font-family:var(--sans);font-size:12px}.fact-row{display:flex;gap:18px;flex-wrap:wrap;margin:14px 0 18px}.fact{display:grid;gap:2px}.fact b{font-family:var(--serif);font-size:24px;font-weight:400;color:var(--ivory);font-variant-numeric:tabular-nums}.fact span{font-size:11.5px;color:var(--ink-3)}.fact.amber b{color:var(--amber)}.handoff{min-height:120svh;display:grid;align-content:end;padding-bottom:16svh!important;justify-items:center;text-align:center;padding:0 20px}.handoff p.lead{font-family:var(--serif);font-weight:380;font-size:clamp(30px,4.4vw,54px);line-height:1.06;letter-spacing:-.03em;margin:0 0 30px;color:var(--ivory)}.handoff p.lead em{color:var(--blue);font-style:italic}.handoff .sub{color:var(--ink-3);font-size:13px;margin-top:18px;max-width:520px}.paths{padding:40px clamp(16px,6vw,88px) 60px;max-width:1240px;margin:0 auto}.paths h2{font-family:var(--serif);font-weight:400;font-size:28px;letter-spacing:-.02em;margin:0 0 20px}.path-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}.path-card{background:#101a2ec7;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border:1px solid var(--rule);border-radius:var(--r-l);padding:20px;color:var(--ink);text-decoration:none!important;display:grid;gap:8px;transition:border-color .25s,transform .3s var(--ease-out),background .25s}.path-card:hover{border-color:var(--rule-2);transform:translateY(-2px);background:#16233bd9}.path-card .k{color:var(--blue);font-size:12px}.path-card h3{margin:0;font-family:var(--serif);font-weight:450;font-size:20px;letter-spacing:-.01em}.path-card p{margin:0;color:var(--ink-3);font-size:13px}.film-index{position:fixed;right:clamp(10px,2vw,24px);top:50%;transform:translateY(-50%);z-index:20!important;display:grid;gap:10px}.film-index a{display:flex;align-items:center;justify-content:flex-end;gap:10px;color:var(--ink-4);font-size:11px;letter-spacing:.08em;text-transform:uppercase;text-decoration:none!important}.film-index a i{width:6px;height:6px;border-radius:50%;border:1px solid currentColor;transition:background .3s,transform .3s}.film-index a span{opacity:0;transform:translate(6px);transition:opacity .3s,transform .3s}.film-index a:hover span,.film-index a:focus-visible span,.film-index a.on span{opacity:1;transform:none}.film-index a.on{color:var(--ink)}.film-index a.on i{background:var(--blue);border-color:var(--blue);transform:scale(1.3)}@media (max-width: 860px){.film-index{display:none}}.film-foot{padding:30px clamp(16px,6vw,88px) 40px;border-top:1px solid var(--rule);display:flex;gap:20px;flex-wrap:wrap;justify-content:space-between;color:var(--ink-3);font-size:12px;background:linear-gradient(transparent,#070c17cc)}.film-foot p{margin:0;max-width:640px}html[data-film=off] .chapter{min-height:auto;padding-top:60px;padding-bottom:60px}html[data-film=off] .handoff{min-height:60svh}@media (max-width: 860px){.chapter{min-height:130svh;justify-content:flex-start!important;align-items:flex-end;padding-bottom:12svh}.chapter-copy{background:#090f1bd1;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--rule);border-radius:var(--r-l);padding:22px;max-width:none}.film-top nav{display:none}.hero{padding-top:100px}}.ws{min-height:100vh;display:grid;grid-template-columns:232px minmax(0,1fr);grid-template-rows:auto 1fr;background:radial-gradient(1400px 600px at 80% -10%,rgba(91,130,240,.07),transparent 60%),var(--night-1)}.ws-top{grid-column:1 / -1;position:sticky;top:0;z-index:40;display:flex;align-items:center;gap:16px;padding:10px 20px;background:#090f1bd1;-webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2);border-bottom:1px solid var(--rule)}.ws-top .brand{display:flex;align-items:center;gap:10px;color:var(--ivory);text-decoration:none!important}.ws-top .brand .wordmark-name{font-size:19px}.ws-top .spacer{flex:1}.store-chip{display:flex;gap:12px;align-items:center;font-size:12px;color:var(--ink-3)}.store-chip b{color:var(--ink-2);font-weight:600;font-variant-numeric:tabular-nums}.store-chip .dot{width:7px;height:7px;border-radius:50%;background:var(--sage);box-shadow:0 0 0 3px var(--sage-soft)}.store-chip .dot.off{background:var(--alert);box-shadow:0 0 0 3px var(--alert-soft)}.search{position:relative;flex:0 1 460px;min-width:200px}.search .field{padding:8px 12px 8px 34px;border-radius:999px;font-size:13px}.search .icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--ink-4);pointer-events:none}.search kbd{position:absolute;right:10px;top:50%;transform:translateY(-50%);font-family:var(--mono);font-size:11px;color:var(--ink-4);border:1px solid var(--rule-2);border-radius:4px;padding:0 5px}.search-results{position:absolute;z-index:50;top:calc(100% + 6px);left:0;right:0;background:var(--night-2);border:1px solid var(--rule-2);border-radius:var(--r-m);list-style:none;margin:0;padding:6px;box-shadow:var(--shadow);max-height:60vh;overflow:auto}.search-results li{padding:8px 10px;border-radius:var(--r-s);cursor:pointer;display:grid;gap:1px}.search-results li[aria-selected=true],.search-results li:hover{background:var(--night-3)}.search-results li .k{color:var(--blue);font-size:12px}.search-results li span{font-size:13px}.search-results li small{color:var(--ink-3);font-size:11.5px}.ws-rail{position:sticky;top:57px;align-self:start;height:calc(100vh - 57px);padding:18px 12px;border-right:1px solid var(--rule);display:flex;flex-direction:column;gap:2px;overflow-y:auto}.ws-rail .group{font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-4);font-weight:600;padding:14px 10px 6px}.ws-rail a{display:flex;align-items:center;gap:10px;color:var(--ink-2);padding:8px 10px;border-radius:var(--r-s);font-size:13.5px;text-decoration:none!important;transition:background .15s,color .15s}.ws-rail a svg{flex:none;opacity:.7}.ws-rail a:hover{background:var(--night-2);color:var(--ink)}.ws-rail a[aria-current=page]{background:var(--night-3);color:var(--ivory)}.ws-rail a[aria-current=page] svg{opacity:1;color:var(--blue)}.ws-rail .rail-foot{margin-top:auto;padding:14px 10px 4px;font-size:11.5px;color:var(--ink-4);line-height:1.5;border-top:1px solid var(--rule)}.ws-rail .rail-foot button{background:none;border:0;color:var(--ink-3);padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.ws-main{min-width:0;padding:26px clamp(16px,3vw,36px) 60px}.ws-main>*{max-width:1320px}.ws-foot{margin-top:48px;padding-top:18px;border-top:1px solid var(--rule);color:var(--ink-4);font-size:12px;max-width:900px}@media (max-width: 980px){.ws{grid-template-columns:1fr}.ws-rail{position:sticky;top:53px;z-index:35;height:auto;flex-direction:row;overflow-x:auto;padding:6px 10px;border-right:0;border-bottom:1px solid var(--rule);background:#090f1beb;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);scrollbar-width:none}.ws-rail::-webkit-scrollbar{display:none}.ws-rail .group,.ws-rail .rail-foot{display:none}.ws-rail a{white-space:nowrap;padding:7px 11px;font-size:13px}.store-chip .counts{display:none}}@media (max-width: 640px){.ws-top{flex-wrap:wrap;gap:10px;padding:10px 14px}.ws-top .search{order:3;flex:1 1 100%}.ws-top .brand .wordmark-name{display:none}.ws-rail{top:99px}.ws-main{padding:18px 14px 50px}}.page-head{margin:0 0 22px;display:grid;gap:6px}.page-head .eyebrow{margin:0}.page-head h1{font-family:var(--serif);font-weight:400;font-size:clamp(28px,3.2vw,38px);letter-spacing:-.025em;line-height:1.08;margin:0;color:var(--ivory)}.page-head p{margin:4px 0 0;color:var(--ink-2);max-width:760px;font-size:14.5px}.panel{background:#101a2eb8;border:1px solid var(--rule);border-radius:var(--r-l);padding:20px;margin-bottom:16px}.panel-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px}.panel-head h2{margin:0;font-size:15px;font-weight:620;letter-spacing:-.005em;display:flex;gap:10px;align-items:baseline}.panel-head h2 .count{font-weight:450;color:var(--ink-3);font-size:12.5px}.panel-head .hint{color:var(--ink-3);font-size:12.5px;margin:0}.panel .lede{color:var(--ink-2);margin:-6px 0 14px;font-size:13.5px;max-width:820px}.grid-main{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(320px,1fr);gap:16px;align-items:start}@media (max-width: 1180px){.grid-main{grid-template-columns:1fr}}.finding{position:relative;border-radius:var(--r-l);padding:26px 26px 22px;margin-bottom:16px;overflow:hidden;border:1px solid var(--rule);background:linear-gradient(135deg,#16233be6,#0d1525e6)}.finding:after{content:"";position:absolute;right:-120px;top:-140px;width:420px;height:420px;border-radius:50%;background:radial-gradient(closest-side,var(--glow, rgba(127, 162, 255, .12)),transparent);pointer-events:none}.finding.tone-amber{--glow: rgba(231, 169, 72, .16)}.finding.tone-alert{--glow: rgba(233, 138, 111, .18)}.finding.tone-calm{--glow: rgba(143, 193, 163, .12)}.finding-top{display:flex;gap:24px;justify-content:space-between;flex-wrap:wrap;position:relative;z-index:1}.finding-id{min-width:0;flex:1 1 380px}.finding-id .kline{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:8px;color:var(--ink-3);font-size:12.5px}.finding-id .kline .k{color:var(--blue);font-size:14px;font-weight:600}.finding-id h1{font-family:var(--serif);font-weight:400;font-size:clamp(28px,3.4vw,42px);letter-spacing:-.025em;line-height:1.05;margin:0 0 8px;color:var(--ivory)}.finding-id .meta{color:var(--ink-3);font-size:13px;display:flex;gap:6px 14px;flex-wrap:wrap}.finding-id .meta a{font-size:13px}.verdict{flex:0 1 400px;min-width:280px;border-left:1px solid var(--rule-2);padding-left:24px;display:grid;gap:8px;align-content:start}.verdict-label{font-family:var(--serif);font-size:30px;font-weight:450;letter-spacing:-.02em;line-height:1.05;display:flex;gap:10px;align-items:center}.verdict-label i{width:12px;height:12px;border-radius:50%;background:currentColor;box-shadow:0 0 0 5px color-mix(in srgb,currentColor 18%,transparent);flex:none}.verdict.tone-amber .verdict-label{color:var(--amber)}.verdict.tone-alert .verdict-label{color:var(--alert)}.verdict.tone-calm .verdict-label{color:var(--sage)}.verdict.tone-muted .verdict-label{color:var(--ink-2)}.verdict-reason{color:var(--ink-2);font-size:13px;margin:0}.authority{display:flex;gap:8px;align-items:flex-start;font-size:11.5px;color:var(--ink-3);background:#ffffff08;border:1px solid var(--rule);border-radius:var(--r-m);padding:8px 10px}.authority svg{flex:none;color:var(--sage);margin-top:1px}.authority b{color:var(--ink-2);font-weight:600}.verdict-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}.finding-sentence{position:relative;z-index:1;margin:22px 0 0;padding-top:18px;border-top:1px solid var(--rule);font-family:var(--serif);font-size:clamp(17px,1.6vw,20px);line-height:1.45;color:var(--ink);max-width:980px}.finding-sentence .k{font-size:.86em;color:var(--blue)}.finding-sentence .amber{color:var(--amber)}.coverage-row{position:relative;z-index:1;display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}.chain{display:flex;align-items:stretch;gap:0;overflow-x:auto;padding:4px 2px 10px;scrollbar-width:thin}.chain-node{flex:1 1 240px;min-width:220px;max-width:380px;background:var(--night-2);border:1px solid var(--rule);border-radius:var(--r-m);padding:14px;display:grid;gap:6px;align-content:start;cursor:pointer;text-align:left;color:inherit;transition:border-color .2s,background .2s}.chain-node:hover,.chain-node:focus-visible{border-color:var(--rule-2);background:var(--night-3)}.chain-node.is-self{border-color:#7fa2ff59}.chain-node.tone-design{border-color:#e7a94873;box-shadow:inset 0 0 0 1px #e7a9481a,0 0 40px -18px #e7a94880}.chain-node .role{font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3);font-weight:600}.chain-node .k{font-size:15px;color:var(--ivory);font-weight:600}.chain-node .nm{font-size:12.5px;color:var(--ink-2);line-height:1.35}.chain-node .dt{font-size:12px;color:var(--ink-3)}.chain-node .rc{margin-top:4px;display:grid;gap:4px}.chain-link{flex:0 0 auto;width:150px;display:grid;align-content:center;justify-items:center;gap:4px;padding:0 6px;position:relative;background:none;border:0;cursor:pointer;color:inherit}.chain-link:before{content:"";position:absolute;left:0;right:0;top:50%;border-top:2px solid var(--blue);opacity:.8}.chain-link.st-disputed:before{border-top-style:dashed;border-color:var(--alert)}.chain-link.st-conditional:before{border-top-style:dotted;border-top-width:3px;border-color:var(--violet)}.chain-link.st-confirmed:before{border-color:var(--sage)}.chain-link .lbl{position:relative;background:var(--night-1);padding:3px 8px;border-radius:999px;border:1px solid var(--rule-2);font-size:11.5px;color:var(--ink-2);transition:border-color .2s,color .2s}.chain-link:hover .lbl,.chain-link:focus-visible .lbl{border-color:var(--blue);color:var(--ink)}.chain-link .sub{position:relative;font-size:10.5px;color:var(--ink-3);background:var(--night-1);padding:0 6px;margin-top:22px}.chain-timing{margin-top:10px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;font-size:13px;color:var(--ink-2)}.chain-timing .amber{color:var(--amber);font-weight:600}.graph-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.seg{display:inline-flex;background:var(--night-2);border:1px solid var(--rule);border-radius:999px;padding:3px}.seg button{background:none;border:0;color:var(--ink-3);padding:5px 12px;border-radius:999px;font-size:12.5px;font-weight:560;cursor:pointer}.seg button[aria-pressed=true]{background:var(--night-4);color:var(--ivory)}.graph-wrap{position:relative;overflow:auto;border-radius:var(--r-m);background:radial-gradient(900px 400px at 85% 50%,rgba(127,162,255,.06),transparent 70%),var(--night-0);border:1px solid var(--rule);scrollbar-width:thin}.graph-wrap svg{display:block}.g-col-label{fill:var(--ink-4);font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;font-weight:600}.g-col-rule{stroke:var(--rule);stroke-dasharray:2 5}.g-edge{fill:none;stroke-linecap:round;transition:opacity .25s,stroke-width .2s}.g-edge.st-extracted{stroke:var(--blue);stroke-width:1.4;opacity:.55}.g-edge.st-confirmed{stroke:var(--sage);stroke-width:1.8;opacity:.8}.g-edge.st-disputed{stroke:var(--alert);stroke-width:1.6;stroke-dasharray:6 5;opacity:.85}.g-edge.st-conditional{stroke:var(--violet);stroke-width:2;stroke-dasharray:1 5;opacity:.9}.g-edge.is-critical{stroke:var(--amber);opacity:1;stroke-width:2.4;filter:drop-shadow(0 0 6px rgba(231,169,72,.45))}.g-edge.is-dim{opacity:.1}.g-edge-hit{fill:none;stroke:transparent;stroke-width:14;cursor:pointer}.g-edge-g:hover .g-edge,.g-edge-g:focus-visible .g-edge{opacity:1;stroke-width:3}.g-edge-g:focus-visible{outline:none}.g-edge-g:focus-visible .g-edge{filter:drop-shadow(0 0 4px var(--blue))}.g-node{cursor:pointer}.g-node:focus-visible{outline:none}.g-node .halo{fill:transparent;stroke:transparent;stroke-width:2;transition:stroke .2s}.g-node:hover .halo,.g-node:focus-visible .halo,.g-node.is-selected .halo{stroke:var(--blue)}.g-node .dot{stroke:var(--night-0);stroke-width:2;transition:r .2s}.g-node .dot.tone-clean{fill:#9aa7c2}.g-node .dot.tone-recall{fill:var(--night-0);stroke:var(--amber);stroke-width:2}.g-node .dot.tone-design{fill:var(--amber)}.g-node .dot.unread{stroke-dasharray:2.5 2.5;stroke:var(--ink-3);stroke-width:1.6}.g-node.is-self .dot{fill:var(--ivory);stroke:var(--blue);stroke-width:3}.g-node .glow{fill:var(--amber);opacity:.22;filter:blur(6px)}.g-node .lk{fill:var(--ink);font-family:var(--mono);font-size:11.5px;font-weight:600}.g-node .ln{fill:var(--ink-3);font-size:10.5px}.g-node.is-dim{opacity:.2}.g-node.is-self .lk{fill:var(--ivory);font-size:12.5px}.g-more{cursor:pointer}.g-more rect{fill:var(--night-2);stroke:var(--rule-2)}.g-more text{fill:var(--ink-2);font-size:11.5px}.g-more:hover rect,.g-more:focus-visible rect{stroke:var(--blue)}.g-legend{display:flex;gap:8px 16px;flex-wrap:wrap;margin-top:12px;font-size:11.5px;color:var(--ink-3);align-items:center}.g-legend .sw{display:inline-flex;align-items:center;gap:6px}.g-legend .sw i{width:10px;height:10px;border-radius:50%;display:inline-block}.g-legend .sw i.lg-design{background:var(--amber)}.g-legend .sw i.lg-recall{border:2px solid var(--amber)}.g-legend .sw i.lg-clean{background:#9aa7c2}.g-legend .sw i.lg-unread{border:1.5px dashed var(--ink-3)}.g-legend .sep{width:1px;height:14px;background:var(--rule-2)}.graph-hint{font-size:12px;color:var(--ink-4);margin-top:8px}.tl-grid{stroke:var(--rule)}.tl-axis{fill:var(--ink-4);font-size:10.5px;font-variant-numeric:tabular-nums}.tl-band{fill:#7fa2ff0f}.tl-rowhit{fill:transparent}.tl-row:hover .tl-rowhit,.tl-row:focus-visible .tl-rowhit{fill:#ffffff08}.tl-row:focus-visible{outline:none}.tl-edge{fill:none;stroke:var(--ink-4);stroke-width:1.1}.tl-edge.on{stroke:var(--amber);stroke-width:2}.tl-dia.design{fill:var(--amber)}.tl-dia.other{fill:none;stroke:var(--amber);stroke-width:1.3}.tl-rlink{stroke:var(--amber);stroke-width:1;stroke-dasharray:2 3;opacity:.7}.tl-label{fill:var(--ink-2);font-size:11.5px}.tl-label .lk{font-family:var(--mono);fill:var(--ink);font-weight:600}.tl-gen{fill:var(--ink-4);font-size:10px}.tl-clear{stroke:var(--blue);stroke-dasharray:3 3;opacity:.7}.review-item{border:1px solid var(--rule);border-radius:var(--r-m);padding:14px 16px;margin-bottom:10px;background:var(--night-2)}.review-item.tone-amber{border-left:3px solid var(--amber)}.review-item.tone-violet{border-left:3px solid var(--violet)}.review-item.tone-alert{border-left:3px solid var(--alert)}.review-item.tone-muted{border-left:3px solid var(--ink-4)}.review-item h3{margin:0 0 8px;font-size:13.5px;font-weight:620;line-height:1.4;display:flex;gap:8px;align-items:baseline}.review-item dl{margin:0;display:grid;grid-template-columns:92px 1fr;gap:4px 12px;font-size:12.5px}.review-item dt{color:var(--ink-4);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;font-weight:600;padding-top:2px}.review-item dd{margin:0;color:var(--ink-2)}.review-item .acts{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.review-item .links{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}@media (max-width: 520px){.review-item dl{grid-template-columns:1fr}}.signal{border-top:1px solid var(--rule);padding:12px 0}.signal:first-of-type{border-top:0}.signal-head{display:flex;gap:10px;align-items:flex-start;width:100%;background:none;border:0;padding:0;color:inherit;text-align:left;cursor:pointer}.signal-head .t{flex:1;font-size:13.5px;line-height:1.45}.signal-head .chev{color:var(--ink-4);transition:transform .25s var(--ease-out);flex:none;margin-top:2px}.signal-head[aria-expanded=true] .chev{transform:rotate(90deg)}.sev{font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;padding:3px 6px;border-radius:4px;flex:none;margin-top:1px}.sev-high{background:var(--alert-soft);color:var(--alert)}.sev-medium{background:var(--amber-soft);color:var(--amber)}.sev-low{background:var(--night-3);color:var(--amber-2)}.sev-info{background:var(--night-3);color:var(--ink-3)}.signal-body{padding:10px 0 2px;display:grid;gap:8px}.recall{display:grid;gap:4px;padding:10px 12px;border-radius:var(--r-s);background:var(--night-1);border:1px solid var(--rule)}.recall-h{display:flex;gap:8px;flex-wrap:wrap;align-items:center;font-size:12.5px}.recall-h .k{color:var(--ink);font-weight:600}.recall-r{font-size:12.5px;color:var(--ink-3);line-height:1.45}.cit{border-top:1px solid var(--rule);padding:12px 0;display:grid;gap:8px}.cit:first-of-type{border-top:0;padding-top:0}.cit.is-rejected{opacity:.55}.cit-h{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:13px}.cit-h .k{color:var(--blue);font-weight:600;cursor:pointer;background:none;border:0;padding:0}.cit-a{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.quote{font-family:var(--serif);font-size:14.5px;line-height:1.5;color:var(--paper-ink);background:var(--paper);border-radius:4px;padding:10px 12px 10px 14px;position:relative;margin:0}.quote:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--blue-2);border-radius:4px 0 0 4px}.quote mark{background:#5b82f02e;color:#1d3f9e;font-family:var(--mono);font-size:.88em;padding:0 2px;border-radius:2px}.quote.is-ocr:before{background:var(--amber-2)}.memo p{margin:0 0 10px;font-family:var(--serif);font-size:15px;line-height:1.55;color:var(--ink)}.memo .src{font-size:11.5px;color:var(--ink-3);margin-bottom:10px}.hist{border-top:1px solid var(--rule);padding:10px 0;display:grid;gap:4px;font-size:12.5px}.hist:first-of-type{border-top:0;padding-top:0}.hist-h{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.hist-h .k{color:var(--ink);font-weight:600}.stale{color:var(--amber);font-size:12px}.drawer-scrim{position:fixed;top:0;right:0;bottom:0;left:0;z-index:60;background:#03060c80;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);animation:fadeIn .25s ease}.drawer{position:fixed;z-index:61;top:0;right:0;bottom:0;width:min(520px,100vw);background:var(--night-2);border-left:1px solid var(--rule-2);box-shadow:-30px 0 80px -30px #000000b3;display:flex;flex-direction:column;animation:slideIn .4s var(--ease-out)}.drawer-head{display:flex;align-items:flex-start;gap:12px;padding:18px 20px 14px;border-bottom:1px solid var(--rule)}.drawer-head .t{flex:1;min-width:0}.drawer-head .eyebrow{margin:0 0 6px}.drawer-head h2{margin:0;font-family:var(--serif);font-weight:420;font-size:24px;letter-spacing:-.02em;line-height:1.15;color:var(--ivory)}.drawer-head h2 .k{font-size:.82em;color:var(--blue)}.drawer-body{padding:18px 20px 30px;overflow-y:auto;display:grid;gap:18px;align-content:start}.drawer-sec h3{font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-4);margin:0 0 8px;font-weight:650}.prov-grid{display:grid;grid-template-columns:120px 1fr;gap:6px 14px;font-size:12.5px;margin:0}.prov-grid dt{color:var(--ink-3)}.prov-grid dd{margin:0;color:var(--ink);word-break:break-word}.prov-grid dd .mono{font-size:11.5px;color:var(--ink-2)}.page-card{display:flex;gap:14px;align-items:center;background:var(--paper);color:var(--paper-ink);border-radius:var(--r-m);padding:12px 14px;text-decoration:none!important;transition:transform .25s var(--ease-out),box-shadow .25s;box-shadow:var(--shadow)}.page-card:hover{transform:translateY(-1px)}.page-card .sheet{width:42px;height:54px;flex:none;background:#fff;border:1px solid #d9d1bf;border-radius:2px;position:relative;box-shadow:2px 2px #e6dcc7;display:grid;place-items:center;font-family:var(--mono);font-size:11px;color:#2d56c4;font-weight:600}.page-card .sheet:before{content:"";position:absolute;left:7px;right:7px;top:9px;height:18px;background:repeating-linear-gradient(#e7e0d0 0 2px,transparent 2px 5px)}.page-card .sheet b{position:relative;margin-top:22px}.page-card .tx{display:grid;gap:2px;font-size:13px}.page-card .tx b{font-weight:650}.page-card .tx span{font-size:11.5px;color:var(--paper-mute)}.drawer-acts{display:flex;gap:8px;flex-wrap:wrap}.drawer .note{font-size:12px;color:var(--ink-3)}@keyframes slideIn{0%{transform:translate(40px);opacity:0}to{transform:none;opacity:1}}@keyframes fadeIn{0%{opacity:0}}@media (prefers-reduced-motion: reduce){.drawer,.drawer-scrim{animation:none}}.tbl-wrap{overflow-x:auto;margin:0 -4px}.tbl{width:100%;border-collapse:collapse;font-size:13px}.tbl th{text-align:left;font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-4);font-weight:650;border-bottom:1px solid var(--rule-2);padding:8px 10px;vertical-align:bottom;white-space:nowrap}.tbl td{border-bottom:1px solid var(--rule);padding:11px 10px;vertical-align:top}.tbl tr.click{cursor:pointer;transition:background .15s}.tbl tr.click:hover,.tbl tr.click:focus-visible{background:#7fa2ff0d;outline:none}.tbl td .k{color:var(--blue);font-weight:600}.tbl td .sub{color:var(--ink-3);font-size:12px}.tbl tr.is-conditional td:first-child{box-shadow:inset 3px 0 0 var(--violet)}.bigstats{display:flex;gap:clamp(20px,4vw,52px);flex-wrap:wrap;margin:4px 0 6px}.bigstats div{display:grid;gap:2px}.bigstats b{font-family:var(--serif);font-size:40px;font-weight:400;line-height:1;color:var(--ivory);font-variant-numeric:tabular-nums}.bigstats .amber b{color:var(--amber)}.bigstats .violet b{color:var(--violet)}.bigstats span{font-size:12px;color:var(--ink-3);max-width:220px}.row-in{display:flex;gap:8px;flex-wrap:wrap}.row-in .field{flex:1 1 260px}.tags{display:flex;flex-wrap:wrap;gap:6px}.tag-btn{background:var(--night-3);border:1px solid var(--rule);color:var(--ink-2);font-size:12px;padding:5px 10px;border-radius:999px;cursor:pointer}.tag-btn:hover{border-color:var(--rule-2);color:var(--ink)}.tag-btn .k{color:var(--blue)}.note-box{font-size:12.5px;color:var(--ink-2);background:var(--night-1);border:1px solid var(--rule);border-radius:var(--r-m);padding:10px 12px}.note-box.amber{border-color:#e7a9484d}.note-box.violet{border-color:#b7a4f54d}.err{color:var(--alert);font-size:13px}.ok{color:var(--sage);font-size:12.5px}.skeleton{background:linear-gradient(90deg,var(--night-2),var(--night-3),var(--night-2));background-size:200% 100%;animation:shimmer 1.4s linear infinite;border-radius:var(--r-m)}@keyframes shimmer{to{background-position:-200% 0}}@media (prefers-reduced-motion: reduce){.skeleton{animation:none}}.loading-thread{display:flex;gap:10px;align-items:center;color:var(--ink-3);font-size:13px;padding:30px 0}.loading-thread i{width:60px;height:2px;background:linear-gradient(90deg,transparent,var(--blue),transparent);background-size:200% 100%;animation:shimmer 1.2s linear infinite}.home-hero{padding:10px 0 6px}.home-cases{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin-top:6px}.case{background:var(--night-2);border:1px solid var(--rule);border-radius:var(--r-l);padding:16px;display:grid;gap:6px;text-align:left;color:inherit;cursor:pointer;transition:border-color .2s,transform .3s var(--ease-out)}.case:hover,.case:focus-visible{border-color:var(--rule-2);transform:translateY(-2px)}.case .k{color:var(--blue);font-size:12.5px}.case h3{margin:0;font-family:var(--serif);font-weight:450;font-size:19px}.case p{margin:0;font-size:12.5px;color:var(--ink-3)}.method ol,.method ul{padding-left:20px;color:var(--ink-2)}.method li{margin-bottom:8px}.method li b{color:var(--ink)}.method h3{font-size:14px;margin:18px 0 8px}::view-transition-old(root),::view-transition-new(root){animation-duration:.6s;animation-timing-function:var(--ease-io)}@media (prefers-reduced-motion: reduce){::view-transition-old(root),::view-transition-new(root){animation:none}}@media (max-width: 640px){.finding{padding:20px 18px 18px}.verdict{border-left:0;padding-left:0;border-top:1px solid var(--rule-2);padding-top:16px;flex-basis:100%}.verdict-label{font-size:26px}.panel{padding:16px}}@media (pointer: coarse){.search kbd{display:none}}@media (max-width: 980px){.ws-rail{-webkit-mask-image:linear-gradient(90deg,#000 85%,transparent);mask-image:linear-gradient(90deg,#000 85%,transparent);padding-right:40px}}.film-stage .film-gl,.film-stage .film-story{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}.film-grid{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background-image:linear-gradient(rgba(236,228,210,.032) 1px,transparent 1px),linear-gradient(90deg,rgba(236,228,210,.032) 1px,transparent 1px);background-size:96px 96px;background-position:center;-webkit-mask-image:radial-gradient(ellipse at 55% 45%,#000 20%,transparent 75%);mask-image:radial-gradient(ellipse at 55% 45%,#000 20%,transparent 75%)}.film-hud{position:fixed;left:clamp(16px,4vw,44px);bottom:18px;z-index:20;display:flex;gap:12px;align-items:center;font-family:var(--mono);font-size:11px;letter-spacing:.02em;color:var(--ink-3);padding:7px 12px;border-radius:999px;background:#070c178c;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--rule);max-width:calc(100vw - 32px);overflow:hidden;white-space:nowrap}.film-hud .hud-n{color:var(--blue)}.film-hud .hud-name{color:var(--ivory);font-family:var(--sans);font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-size:10.5px}.film-hud .hud-read{color:var(--ink-2);overflow:hidden;text-overflow:ellipsis}@media (max-width: 860px){.film-hud .hud-read{display:none}.film-hud{bottom:12px}}.chapter-label span{font-size:12px}.chapter-copy{position:relative}.chapter-copy:before{content:"";position:absolute;left:-18px;top:34px;width:1px;height:64px;background:linear-gradient(var(--blue),transparent)}.doc{position:relative}.doc:after{content:"";position:absolute;top:-6px;right:-6px;bottom:-6px;left:-6px;border:1px solid rgba(127,162,255,.25);border-radius:8px;pointer-events:none;-webkit-mask:linear-gradient(#000 0 0) top left / 14px 14px no-repeat,linear-gradient(#000 0 0) bottom right / 14px 14px no-repeat;mask:linear-gradient(#000 0 0) top left / 14px 14px no-repeat,linear-gradient(#000 0 0) bottom right / 14px 14px no-repeat}@media (max-width: 860px){.chapter-copy:before{display:none}}.chapter.place-right{padding-right:clamp(16px,9vw,150px)}.handoff{min-height:135svh}@media (max-width: 860px){.chapter{min-height:190svh;align-items:flex-start;padding-top:105svh;padding-bottom:20svh}.handoff{padding-top:40svh}}.g-flow{fill:none;stroke:#ffd79a;stroke-width:2.6;stroke-linecap:round;stroke-dasharray:2 26;opacity:.9;animation:g-flow 2.4s linear infinite;pointer-events:none;filter:drop-shadow(0 0 4px rgba(231,169,72,.9))}@keyframes g-flow{to{stroke-dashoffset:28}}.chain-link.st-extracted:after,.chain-link.st-confirmed:after{content:"";position:absolute;left:0;right:0;top:calc(50% - 1px);height:2px;background:linear-gradient(90deg,transparent,rgba(255,215,154,.95),transparent);background-size:40% 100%;background-repeat:no-repeat;animation:chain-signal 2.6s var(--ease-io) infinite;animation-direction:reverse;pointer-events:none}@keyframes chain-signal{0%{background-position:-40% 0}to{background-position:140% 0}}.finding{isolation:isolate}.finding:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;pointer-events:none;background-image:linear-gradient(rgba(236,228,210,.03) 1px,transparent 1px),linear-gradient(90deg,rgba(236,228,210,.03) 1px,transparent 1px);background-size:48px 48px;-webkit-mask-image:linear-gradient(110deg,transparent 30%,#000 75%);mask-image:linear-gradient(110deg,transparent 30%,#000 75%)}.finding:after{animation:glow-drift 18s ease-in-out infinite alternate}@keyframes glow-drift{0%{transform:translate(0)}to{transform:translate(-90px,40px) scale(1.15)}}.finding .kline:before{content:"[ dossier ]";font-family:var(--mono);color:var(--ink-4);font-size:11px;margin-right:2px}.panel{position:relative}.finding,.panel#review{background-clip:padding-box}.corner-marks:after{content:"";position:absolute;top:8px;right:8px;bottom:8px;left:8px;pointer-events:none;border:1px solid rgba(127,162,255,.35);border-radius:10px;-webkit-mask:linear-gradient(#000 0 0) top left / 12px 12px no-repeat,linear-gradient(#000 0 0) top right / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom left / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom right / 12px 12px no-repeat;mask:linear-gradient(#000 0 0) top left / 12px 12px no-repeat,linear-gradient(#000 0 0) top right / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom left / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom right / 12px 12px no-repeat}@media (prefers-reduced-motion: reduce){.g-flow{animation:none;stroke-dasharray:none;opacity:.35}.chain-link:after{animation:none!important;display:none}.finding:after{animation:none}}.film-top.is-solid{-webkit-backdrop-filter:none;backdrop-filter:none;background:#080d18eb}.film-hud{transition:opacity .4s var(--ease-out),transform .4s var(--ease-out)}.film-hud.is-away{opacity:0;transform:translateY(10px);pointer-events:none} diff --git a/web/dist/assets/index-uNtQWBQX.css b/web/dist/assets/index-uNtQWBQX.css deleted file mode 100644 index 8e4851a..0000000 --- a/web/dist/assets/index-uNtQWBQX.css +++ /dev/null @@ -1 +0,0 @@ -@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2) format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2) format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2) format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-greek-wght-normal-CkhJZR-_.woff2) format("woff2-variations");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2) format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url(/assets/inter-latin-wght-normal-Dx4kXJAl.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Newsreader Variable;font-style:normal;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-vietnamese-wght-normal-Czsa-EzN.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Newsreader Variable;font-style:normal;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-ext-wght-normal-C-3rgBeH.woff2) format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Newsreader Variable;font-style:normal;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-wght-normal-CCVVNp6i.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}@font-face{font-family:Newsreader Variable;font-style:italic;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-vietnamese-wght-italic-xAqemagA.woff2) format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Newsreader Variable;font-style:italic;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-ext-wght-italic-DFS986qL.woff2) format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Newsreader Variable;font-style:italic;font-display:swap;font-weight:200 800;src:url(/assets/newsreader-latin-wght-italic-Bxi8ein9.woff2) format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}:root{--night-0: #070c17;--night-1: #0b1322;--night-2: #101a2e;--night-3: #16233b;--night-4: #1e2e4b;--rule: rgba(236, 228, 210, .09);--rule-2: rgba(236, 228, 210, .16);--ivory: #f1ebdd;--ivory-2: #e6dcc7;--paper: #f6f1e5;--paper-ink: #22252b;--paper-mute: #6c6656;--ink: #ece6d8;--ink-2: rgba(236, 230, 216, .74);--ink-3: rgba(236, 230, 216, .64);--ink-4: rgba(236, 230, 216, .55);--blue: #7fa2ff;--blue-2: #5b82f0;--blue-soft: rgba(127, 162, 255, .14);--amber: #e7a948;--amber-2: #c98a2c;--amber-soft: rgba(231, 169, 72, .14);--alert: #e98a6f;--alert-soft: rgba(233, 138, 111, .14);--sage: #8fc1a3;--sage-soft: rgba(143, 193, 163, .14);--violet: #b7a4f5;--serif: "Newsreader Variable", "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;--sans: "Inter Variable", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;--mono: "Cascadia Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;--r-s: 6px;--r-m: 10px;--r-l: 16px;--ease-out: cubic-bezier(.16, 1, .3, 1);--ease-io: cubic-bezier(.65, 0, .35, 1);--shadow: 0 18px 50px -20px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .25);color-scheme:dark;font-family:var(--sans);font-feature-settings:"cv11","ss01"}*{box-sizing:border-box}html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}@media (prefers-reduced-motion: reduce){html{scroll-behavior:auto}}body{margin:0;background:var(--night-1);color:var(--ink);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}::selection{background:#7fa2ff59;color:#fff}a{color:var(--blue);text-decoration:none;text-underline-offset:3px}a:hover{text-decoration:underline}button,input,select,textarea{font:inherit;color:inherit}:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:4px}q{quotes:"“" "”"}code{font-family:var(--mono);font-size:.92em;background:var(--night-3);padding:1px 5px;border-radius:4px}.k,.mono{font-family:var(--mono);font-variant-numeric:tabular-nums slashed-zero;letter-spacing:-.01em}.num{font-variant-numeric:tabular-nums}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.skip-link{position:fixed;left:12px;top:-60px;z-index:200;background:var(--ivory);color:var(--night-1);padding:8px 14px;border-radius:var(--r-s);font-weight:600;transition:top .2s}.skip-link:focus{top:12px}.muted{color:var(--ink-3)}.small{font-size:12px}.mark{display:block;overflow:visible}.mark-thread{stroke:var(--blue);stroke-width:1.6;stroke-linecap:round}.mark-node{fill:var(--ivory)}.mark-node.past{fill:var(--amber)}.wordmark{display:inline-flex;align-items:center;gap:10px}.wordmark-name{font-family:var(--serif);font-size:21px;font-weight:500;letter-spacing:-.01em;color:var(--ivory)}.btn{display:inline-flex;align-items:center;gap:8px;border:1px solid transparent;border-radius:999px;padding:8px 16px;font-weight:560;font-size:13.5px;cursor:pointer;white-space:nowrap;transition:background .2s var(--ease-out),border-color .2s,color .2s,transform .2s var(--ease-out);text-decoration:none!important}.btn:active{transform:translateY(1px)}.btn-primary{background:var(--ivory);color:var(--night-1)}.btn-primary:hover{background:#fff}.btn-line{border-color:var(--rule-2);color:var(--ink);background:transparent}.btn-line:hover{border-color:var(--ink-3);background:#ffffff08}.btn-quiet{background:transparent;color:var(--ink-2);padding:6px 10px;border-radius:var(--r-s)}.btn-quiet:hover{color:var(--ink);background:var(--night-3)}.btn-sm{padding:5px 11px;font-size:12.5px}.btn:disabled{opacity:.45;cursor:default}.btn .arr{transition:transform .25s var(--ease-out)}.btn:hover .arr{transform:translate(3px)}.field{width:100%;background:var(--night-2);border:1px solid var(--rule-2);border-radius:var(--r-m);padding:10px 14px;color:var(--ink);transition:border-color .2s,background .2s}.field::placeholder{color:var(--ink-4)}.field:focus{outline:none;border-color:var(--blue);background:var(--night-3)}select.field{padding:6px 10px;width:auto}.chip{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:560;line-height:1;padding:5px 9px;border-radius:999px;background:var(--night-3);color:var(--ink-2);white-space:nowrap}.chip .glyph{width:8px;height:8px;border-radius:50%;background:currentColor;flex:none}.chip.tone-design,.chip.tone-amber,.chip.tone-class1{background:var(--amber-soft);color:var(--amber)}.chip.tone-other{background:var(--night-3);color:var(--ink-2)}.chip.tone-alert{background:var(--alert-soft);color:var(--alert)}.chip.tone-calm{background:var(--sage-soft);color:var(--sage)}.chip.tone-blue{background:var(--blue-soft);color:var(--blue)}.chip.tone-muted{background:var(--night-3);color:var(--ink-3)}.chip.tone-violet{background:#b7a4f524;color:var(--violet)}.status{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;font-weight:560;white-space:nowrap}.status .line{width:22px;height:0;border-top:2px solid currentColor;flex:none}.status-confirmed{color:var(--sage)}.status-extracted{color:var(--blue)}.status-disputed{color:var(--alert)}.status-disputed .line{border-top-style:dashed}.status-conditional{color:var(--violet)}.status-conditional .line{border-top-style:dotted;border-top-width:3px}.status-rejected{color:var(--ink-4)}.status-rejected .line{border-top-style:dashed;opacity:.6}.intro{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;display:grid;place-items:center;background:radial-gradient(ellipse at 50% 46%,#101b31 0%,var(--night-0) 70%);transition:opacity .55s var(--ease-io),visibility .55s}.intro.is-leaving{opacity:0;visibility:hidden;pointer-events:none}.intro-lockup{display:grid;justify-items:center;gap:22px;transform:translateY(-2vh)}.intro-mark{width:116px;height:116px}.intro-mark .mark-thread{stroke-dasharray:1;stroke-dashoffset:1;animation:draw .62s var(--ease-out) forwards;stroke-width:1.1}.intro-mark .mark-node{transform-box:fill-box;transform-origin:center;transform:scale(0);opacity:0;animation:pop .55s var(--ease-out) forwards}.intro-mark .n0{animation-delay:.05s}.intro-mark .n2{animation-delay:.22s}.intro-mark .n4{animation-delay:.39s}.intro-mark .n1{animation-delay:.62s}.intro-mark .n3{animation-delay:.74s}.intro-mark .t1{animation-delay:.4s}.intro-mark .t3{animation-delay:.58s}.intro-mark .t0{animation-delay:.8s}.intro-mark .t2{animation-delay:.92s}.intro-mark .mark-node.past{animation:pop .55s var(--ease-out) .39s forwards,ember 1.6s ease-in-out 1.15s 1}.intro-word{font-family:var(--serif);font-size:clamp(34px,6vw,52px);font-weight:420;letter-spacing:-.02em;color:var(--ivory);display:flex;overflow:hidden}.intro-word span{display:inline-block;transform:translateY(105%);animation:rise .8s var(--ease-out) forwards}.intro-tag{font-family:var(--serif);font-style:italic;font-size:clamp(17px,2.4vw,22px);color:var(--ink-2);margin:0;overflow:hidden}.intro-tag span{display:inline-block;opacity:0;transform:translateY(40%);animation:fadeRise .9s var(--ease-out) 1.55s forwards}.intro-tag em{color:var(--amber);font-style:italic}.intro-skip{position:absolute;right:22px;bottom:22px}@keyframes draw{to{stroke-dashoffset:0}}@keyframes pop{to{transform:scale(1);opacity:1}}@keyframes rise{to{transform:translateY(0)}}@keyframes fadeRise{to{opacity:1;transform:none}}@keyframes ember{0%,to{filter:none}45%{filter:drop-shadow(0 0 6px rgba(231,169,72,.9))}}.film{position:relative}.film-stage{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0;pointer-events:none}.film-stage canvas{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;opacity:0;transition:opacity 1.2s var(--ease-io)}.film-stage canvas.is-live{opacity:1}.film-fallback{position:absolute;top:0;right:0;bottom:0;left:0;background:radial-gradient(1200px 700px at 72% 30%,rgba(91,130,240,.1),transparent 60%),radial-gradient(900px 600px at 15% 85%,rgba(231,169,72,.05),transparent 60%),var(--night-1)}.film-fallback svg{position:absolute;right:6vw;top:18vh;width:min(46vw,560px);opacity:.5}.film-vignette{position:absolute;top:0;right:0;bottom:0;left:0;background:radial-gradient(ellipse at 50% 50%,transparent 55%,rgba(4,7,14,.55) 100%)}.film>main,.film>footer{position:relative;z-index:1}.film-top{position:fixed;top:0;left:0;right:0;z-index:30!important;display:flex;align-items:center;gap:16px;padding:16px clamp(16px,4vw,44px);transition:background .4s,backdrop-filter .4s,border-color .4s;border-bottom:1px solid transparent}.film-top.is-solid{background:#090f1bb8;-webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2);border-color:var(--rule)}.film-top .spacer{flex:1}.film-top nav{display:flex;gap:4px}.film-top nav a{color:var(--ink-2);font-size:13px;padding:6px 10px;border-radius:var(--r-s)}.film-top nav a:hover{color:var(--ink);text-decoration:none;background:#ffffff0a}.hero{position:relative;min-height:100svh;display:grid;align-content:center;padding:96px clamp(16px,6vw,88px) 72px;max-width:1240px}.eyebrow{font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-3);font-weight:600;margin:0 0 22px;display:flex;gap:12px;align-items:center}.eyebrow:before{content:"";width:28px;height:1px;background:var(--blue)}.hero h1{font-family:var(--serif);font-weight:380;font-size:clamp(42px,6.4vw,86px);line-height:.98;letter-spacing:-.035em;margin:0;max-width:11.5ch;color:var(--ivory)}.hero h1 em{font-style:italic;color:var(--amber);font-weight:360}.hero-lede{font-size:clamp(16px,1.6vw,19px);line-height:1.55;color:var(--ink-2);max-width:40em;margin:28px 0 0}.hero-lede b{color:var(--ink);font-weight:600}.hero-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:34px;align-items:center}.hero-proof{animation:fadeIn .6s var(--ease-out);display:flex;gap:clamp(20px,4vw,48px);flex-wrap:wrap;margin-top:40px;padding-top:24px;border-top:1px solid var(--rule);max-width:760px}.hero-proof div{display:grid;gap:2px}.hero-proof b{font-family:var(--serif);font-size:30px;font-weight:400;color:var(--ivory);font-variant-numeric:tabular-nums}.hero-proof span{font-size:12px;color:var(--ink-3)}.chapter{min-height:150svh;display:flex;align-items:center;padding:0 clamp(16px,6vw,88px)}.chapter.place-left{justify-content:flex-start}.chapter.place-right{justify-content:flex-end}.chapter-copy{max-width:460px;padding:30px 0}.chapter-label{display:flex;gap:14px;align-items:baseline;font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-3);font-weight:600;margin:0 0 18px}.chapter-label span{font-family:var(--mono);color:var(--blue);letter-spacing:0}.chapter-statement{font-family:var(--serif);font-weight:380;font-size:clamp(34px,4.6vw,58px);line-height:1.02;letter-spacing:-.03em;margin:0 0 22px;color:var(--ivory)}.chapter-statement em{font-style:italic;color:var(--amber)}.chapter-body{font-size:16px;line-height:1.65;color:var(--ink-2);margin:0 0 18px}.chapter-body b{color:var(--ink);font-weight:600}.chapter-foot{font-size:12.5px;color:var(--ink-3);margin:0;padding-left:14px;border-left:1px solid var(--rule-2)}.ln{display:block;overflow:hidden;padding-bottom:.06em}.ln>span{display:inline-block;transform:translateY(110%);transition:transform 1s var(--ease-out)}.reveal .chapter-body,.reveal .chapter-foot,.reveal .doc,.reveal .fact-row{opacity:0;transform:translateY(14px);transition:opacity .9s var(--ease-out) .18s,transform .9s var(--ease-out) .18s}.reveal.in-frame .ln>span{transform:none}.reveal.in-frame .ln:nth-child(2)>span{transition-delay:.08s}.reveal.in-frame .chapter-body,.reveal.in-frame .chapter-foot,.reveal.in-frame .doc,.reveal.in-frame .fact-row{opacity:1;transform:none}html[data-film=off] .ln>span,html[data-motion=reduced] .ln>span{transform:none;transition:none}html[data-film=off] .reveal *,html[data-motion=reduced] .reveal *{opacity:1!important;transform:none!important;transition:none!important}.doc{background:var(--paper);color:var(--paper-ink);border-radius:4px;padding:18px 20px 16px;box-shadow:var(--shadow);font-family:var(--serif);font-size:15.5px;line-height:1.5;margin:22px 0 18px;position:relative}.doc:before{content:"";position:absolute;inset:0 auto 0 0;width:3px;background:var(--blue-2);border-radius:4px 0 0 4px}.doc-meta{font-family:var(--sans);font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--paper-mute);display:flex;justify-content:space-between;gap:12px;margin-bottom:8px}.doc mark{background:#5b82f029;color:#1d3f9e;padding:0 2px;border-radius:2px;font-family:var(--mono);font-size:.9em}.doc a{color:#2d56c4;font-family:var(--sans);font-size:12px}.fact-row{display:flex;gap:18px;flex-wrap:wrap;margin:14px 0 18px}.fact{display:grid;gap:2px}.fact b{font-family:var(--serif);font-size:24px;font-weight:400;color:var(--ivory);font-variant-numeric:tabular-nums}.fact span{font-size:11.5px;color:var(--ink-3)}.fact.amber b{color:var(--amber)}.handoff{min-height:120svh;display:grid;align-content:end;padding-bottom:16svh!important;justify-items:center;text-align:center;padding:0 20px}.handoff p.lead{font-family:var(--serif);font-weight:380;font-size:clamp(30px,4.4vw,54px);line-height:1.06;letter-spacing:-.03em;margin:0 0 30px;color:var(--ivory)}.handoff p.lead em{color:var(--blue);font-style:italic}.handoff .sub{color:var(--ink-3);font-size:13px;margin-top:18px;max-width:520px}.paths{padding:40px clamp(16px,6vw,88px) 60px;max-width:1240px;margin:0 auto}.paths h2{font-family:var(--serif);font-weight:400;font-size:28px;letter-spacing:-.02em;margin:0 0 20px}.path-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}.path-card{background:#101a2ec7;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border:1px solid var(--rule);border-radius:var(--r-l);padding:20px;color:var(--ink);text-decoration:none!important;display:grid;gap:8px;transition:border-color .25s,transform .3s var(--ease-out),background .25s}.path-card:hover{border-color:var(--rule-2);transform:translateY(-2px);background:#16233bd9}.path-card .k{color:var(--blue);font-size:12px}.path-card h3{margin:0;font-family:var(--serif);font-weight:450;font-size:20px;letter-spacing:-.01em}.path-card p{margin:0;color:var(--ink-3);font-size:13px}.film-index{position:fixed;right:clamp(10px,2vw,24px);top:50%;transform:translateY(-50%);z-index:20!important;display:grid;gap:10px}.film-index a{display:flex;align-items:center;justify-content:flex-end;gap:10px;color:var(--ink-4);font-size:11px;letter-spacing:.08em;text-transform:uppercase;text-decoration:none!important}.film-index a i{width:6px;height:6px;border-radius:50%;border:1px solid currentColor;transition:background .3s,transform .3s}.film-index a span{opacity:0;transform:translate(6px);transition:opacity .3s,transform .3s}.film-index a:hover span,.film-index a:focus-visible span,.film-index a.on span{opacity:1;transform:none}.film-index a.on{color:var(--ink)}.film-index a.on i{background:var(--blue);border-color:var(--blue);transform:scale(1.3)}@media (max-width: 860px){.film-index{display:none}}.film-foot{padding:30px clamp(16px,6vw,88px) 40px;border-top:1px solid var(--rule);display:flex;gap:20px;flex-wrap:wrap;justify-content:space-between;color:var(--ink-3);font-size:12px;background:linear-gradient(transparent,#070c17cc)}.film-foot p{margin:0;max-width:640px}html[data-film=off] .chapter{min-height:auto;padding-top:60px;padding-bottom:60px}html[data-film=off] .handoff{min-height:60svh}@media (max-width: 860px){.chapter{min-height:130svh;justify-content:flex-start!important;align-items:flex-end;padding-bottom:12svh}.chapter-copy{background:#090f1bd1;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--rule);border-radius:var(--r-l);padding:22px;max-width:none}.film-top nav{display:none}.hero{padding-top:100px}}.ws{min-height:100vh;display:grid;grid-template-columns:232px minmax(0,1fr);grid-template-rows:auto 1fr;background:radial-gradient(1400px 600px at 80% -10%,rgba(91,130,240,.07),transparent 60%),var(--night-1)}.ws-top{grid-column:1 / -1;position:sticky;top:0;z-index:40;display:flex;align-items:center;gap:16px;padding:10px 20px;background:#090f1bd1;-webkit-backdrop-filter:blur(14px) saturate(1.2);backdrop-filter:blur(14px) saturate(1.2);border-bottom:1px solid var(--rule)}.ws-top .brand{display:flex;align-items:center;gap:10px;color:var(--ivory);text-decoration:none!important}.ws-top .brand .wordmark-name{font-size:19px}.ws-top .spacer{flex:1}.store-chip{display:flex;gap:12px;align-items:center;font-size:12px;color:var(--ink-3)}.store-chip b{color:var(--ink-2);font-weight:600;font-variant-numeric:tabular-nums}.store-chip .dot{width:7px;height:7px;border-radius:50%;background:var(--sage);box-shadow:0 0 0 3px var(--sage-soft)}.store-chip .dot.off{background:var(--alert);box-shadow:0 0 0 3px var(--alert-soft)}.search{position:relative;flex:0 1 460px;min-width:200px}.search .field{padding:8px 12px 8px 34px;border-radius:999px;font-size:13px}.search .icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--ink-4);pointer-events:none}.search kbd{position:absolute;right:10px;top:50%;transform:translateY(-50%);font-family:var(--mono);font-size:11px;color:var(--ink-4);border:1px solid var(--rule-2);border-radius:4px;padding:0 5px}.search-results{position:absolute;z-index:50;top:calc(100% + 6px);left:0;right:0;background:var(--night-2);border:1px solid var(--rule-2);border-radius:var(--r-m);list-style:none;margin:0;padding:6px;box-shadow:var(--shadow);max-height:60vh;overflow:auto}.search-results li{padding:8px 10px;border-radius:var(--r-s);cursor:pointer;display:grid;gap:1px}.search-results li[aria-selected=true],.search-results li:hover{background:var(--night-3)}.search-results li .k{color:var(--blue);font-size:12px}.search-results li span{font-size:13px}.search-results li small{color:var(--ink-3);font-size:11.5px}.ws-rail{position:sticky;top:57px;align-self:start;height:calc(100vh - 57px);padding:18px 12px;border-right:1px solid var(--rule);display:flex;flex-direction:column;gap:2px;overflow-y:auto}.ws-rail .group{font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-4);font-weight:600;padding:14px 10px 6px}.ws-rail a{display:flex;align-items:center;gap:10px;color:var(--ink-2);padding:8px 10px;border-radius:var(--r-s);font-size:13.5px;text-decoration:none!important;transition:background .15s,color .15s}.ws-rail a svg{flex:none;opacity:.7}.ws-rail a:hover{background:var(--night-2);color:var(--ink)}.ws-rail a[aria-current=page]{background:var(--night-3);color:var(--ivory)}.ws-rail a[aria-current=page] svg{opacity:1;color:var(--blue)}.ws-rail .rail-foot{margin-top:auto;padding:14px 10px 4px;font-size:11.5px;color:var(--ink-4);line-height:1.5;border-top:1px solid var(--rule)}.ws-rail .rail-foot button{background:none;border:0;color:var(--ink-3);padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}.ws-main{min-width:0;padding:26px clamp(16px,3vw,36px) 60px}.ws-main>*{max-width:1320px}.ws-foot{margin-top:48px;padding-top:18px;border-top:1px solid var(--rule);color:var(--ink-4);font-size:12px;max-width:900px}@media (max-width: 980px){.ws{grid-template-columns:1fr}.ws-rail{position:sticky;top:53px;z-index:35;height:auto;flex-direction:row;overflow-x:auto;padding:6px 10px;border-right:0;border-bottom:1px solid var(--rule);background:#090f1beb;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);scrollbar-width:none}.ws-rail::-webkit-scrollbar{display:none}.ws-rail .group,.ws-rail .rail-foot{display:none}.ws-rail a{white-space:nowrap;padding:7px 11px;font-size:13px}.store-chip .counts{display:none}}@media (max-width: 640px){.ws-top{flex-wrap:wrap;gap:10px;padding:10px 14px}.ws-top .search{order:3;flex:1 1 100%}.ws-top .brand .wordmark-name{display:none}.ws-rail{top:99px}.ws-main{padding:18px 14px 50px}}.page-head{margin:0 0 22px;display:grid;gap:6px}.page-head .eyebrow{margin:0}.page-head h1{font-family:var(--serif);font-weight:400;font-size:clamp(28px,3.2vw,38px);letter-spacing:-.025em;line-height:1.08;margin:0;color:var(--ivory)}.page-head p{margin:4px 0 0;color:var(--ink-2);max-width:760px;font-size:14.5px}.panel{background:#101a2eb8;border:1px solid var(--rule);border-radius:var(--r-l);padding:20px;margin-bottom:16px}.panel-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:14px}.panel-head h2{margin:0;font-size:15px;font-weight:620;letter-spacing:-.005em;display:flex;gap:10px;align-items:baseline}.panel-head h2 .count{font-weight:450;color:var(--ink-3);font-size:12.5px}.panel-head .hint{color:var(--ink-3);font-size:12.5px;margin:0}.panel .lede{color:var(--ink-2);margin:-6px 0 14px;font-size:13.5px;max-width:820px}.grid-main{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(320px,1fr);gap:16px;align-items:start}@media (max-width: 1180px){.grid-main{grid-template-columns:1fr}}.finding{position:relative;border-radius:var(--r-l);padding:26px 26px 22px;margin-bottom:16px;overflow:hidden;border:1px solid var(--rule);background:linear-gradient(135deg,#16233be6,#0d1525e6)}.finding:after{content:"";position:absolute;right:-120px;top:-140px;width:420px;height:420px;border-radius:50%;background:radial-gradient(closest-side,var(--glow, rgba(127, 162, 255, .12)),transparent);pointer-events:none}.finding.tone-amber{--glow: rgba(231, 169, 72, .16)}.finding.tone-alert{--glow: rgba(233, 138, 111, .18)}.finding.tone-calm{--glow: rgba(143, 193, 163, .12)}.finding-top{display:flex;gap:24px;justify-content:space-between;flex-wrap:wrap;position:relative;z-index:1}.finding-id{min-width:0;flex:1 1 380px}.finding-id .kline{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:8px;color:var(--ink-3);font-size:12.5px}.finding-id .kline .k{color:var(--blue);font-size:14px;font-weight:600}.finding-id h1{font-family:var(--serif);font-weight:400;font-size:clamp(28px,3.4vw,42px);letter-spacing:-.025em;line-height:1.05;margin:0 0 8px;color:var(--ivory)}.finding-id .meta{color:var(--ink-3);font-size:13px;display:flex;gap:6px 14px;flex-wrap:wrap}.finding-id .meta a{font-size:13px}.verdict{flex:0 1 400px;min-width:280px;border-left:1px solid var(--rule-2);padding-left:24px;display:grid;gap:8px;align-content:start}.verdict-label{font-family:var(--serif);font-size:30px;font-weight:450;letter-spacing:-.02em;line-height:1.05;display:flex;gap:10px;align-items:center}.verdict-label i{width:12px;height:12px;border-radius:50%;background:currentColor;box-shadow:0 0 0 5px color-mix(in srgb,currentColor 18%,transparent);flex:none}.verdict.tone-amber .verdict-label{color:var(--amber)}.verdict.tone-alert .verdict-label{color:var(--alert)}.verdict.tone-calm .verdict-label{color:var(--sage)}.verdict.tone-muted .verdict-label{color:var(--ink-2)}.verdict-reason{color:var(--ink-2);font-size:13px;margin:0}.authority{display:flex;gap:8px;align-items:flex-start;font-size:11.5px;color:var(--ink-3);background:#ffffff08;border:1px solid var(--rule);border-radius:var(--r-m);padding:8px 10px}.authority svg{flex:none;color:var(--sage);margin-top:1px}.authority b{color:var(--ink-2);font-weight:600}.verdict-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}.finding-sentence{position:relative;z-index:1;margin:22px 0 0;padding-top:18px;border-top:1px solid var(--rule);font-family:var(--serif);font-size:clamp(17px,1.6vw,20px);line-height:1.45;color:var(--ink);max-width:980px}.finding-sentence .k{font-size:.86em;color:var(--blue)}.finding-sentence .amber{color:var(--amber)}.coverage-row{position:relative;z-index:1;display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}.chain{display:flex;align-items:stretch;gap:0;overflow-x:auto;padding:4px 2px 10px;scrollbar-width:thin}.chain-node{flex:1 1 240px;min-width:220px;max-width:380px;background:var(--night-2);border:1px solid var(--rule);border-radius:var(--r-m);padding:14px;display:grid;gap:6px;align-content:start;cursor:pointer;text-align:left;color:inherit;transition:border-color .2s,background .2s}.chain-node:hover,.chain-node:focus-visible{border-color:var(--rule-2);background:var(--night-3)}.chain-node.is-self{border-color:#7fa2ff59}.chain-node.tone-design{border-color:#e7a94873;box-shadow:inset 0 0 0 1px #e7a9481a,0 0 40px -18px #e7a94880}.chain-node .role{font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-3);font-weight:600}.chain-node .k{font-size:15px;color:var(--ivory);font-weight:600}.chain-node .nm{font-size:12.5px;color:var(--ink-2);line-height:1.35}.chain-node .dt{font-size:12px;color:var(--ink-3)}.chain-node .rc{margin-top:4px;display:grid;gap:4px}.chain-link{flex:0 0 auto;width:150px;display:grid;align-content:center;justify-items:center;gap:4px;padding:0 6px;position:relative;background:none;border:0;cursor:pointer;color:inherit}.chain-link:before{content:"";position:absolute;left:0;right:0;top:50%;border-top:2px solid var(--blue);opacity:.8}.chain-link.st-disputed:before{border-top-style:dashed;border-color:var(--alert)}.chain-link.st-conditional:before{border-top-style:dotted;border-top-width:3px;border-color:var(--violet)}.chain-link.st-confirmed:before{border-color:var(--sage)}.chain-link .lbl{position:relative;background:var(--night-1);padding:3px 8px;border-radius:999px;border:1px solid var(--rule-2);font-size:11.5px;color:var(--ink-2);transition:border-color .2s,color .2s}.chain-link:hover .lbl,.chain-link:focus-visible .lbl{border-color:var(--blue);color:var(--ink)}.chain-link .sub{position:relative;font-size:10.5px;color:var(--ink-3);background:var(--night-1);padding:0 6px;margin-top:22px}.chain-timing{margin-top:10px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;font-size:13px;color:var(--ink-2)}.chain-timing .amber{color:var(--amber);font-weight:600}.graph-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.seg{display:inline-flex;background:var(--night-2);border:1px solid var(--rule);border-radius:999px;padding:3px}.seg button{background:none;border:0;color:var(--ink-3);padding:5px 12px;border-radius:999px;font-size:12.5px;font-weight:560;cursor:pointer}.seg button[aria-pressed=true]{background:var(--night-4);color:var(--ivory)}.graph-wrap{position:relative;overflow:auto;border-radius:var(--r-m);background:radial-gradient(900px 400px at 85% 50%,rgba(127,162,255,.06),transparent 70%),var(--night-0);border:1px solid var(--rule);scrollbar-width:thin}.graph-wrap svg{display:block}.g-col-label{fill:var(--ink-4);font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;font-weight:600}.g-col-rule{stroke:var(--rule);stroke-dasharray:2 5}.g-edge{fill:none;stroke-linecap:round;transition:opacity .25s,stroke-width .2s}.g-edge.st-extracted{stroke:var(--blue);stroke-width:1.4;opacity:.55}.g-edge.st-confirmed{stroke:var(--sage);stroke-width:1.8;opacity:.8}.g-edge.st-disputed{stroke:var(--alert);stroke-width:1.6;stroke-dasharray:6 5;opacity:.85}.g-edge.st-conditional{stroke:var(--violet);stroke-width:2;stroke-dasharray:1 5;opacity:.9}.g-edge.is-critical{stroke:var(--amber);opacity:1;stroke-width:2.4;filter:drop-shadow(0 0 6px rgba(231,169,72,.45))}.g-edge.is-dim{opacity:.1}.g-edge-hit{fill:none;stroke:transparent;stroke-width:14;cursor:pointer}.g-edge-g:hover .g-edge,.g-edge-g:focus-visible .g-edge{opacity:1;stroke-width:3}.g-edge-g:focus-visible{outline:none}.g-edge-g:focus-visible .g-edge{filter:drop-shadow(0 0 4px var(--blue))}.g-node{cursor:pointer}.g-node:focus-visible{outline:none}.g-node .halo{fill:transparent;stroke:transparent;stroke-width:2;transition:stroke .2s}.g-node:hover .halo,.g-node:focus-visible .halo,.g-node.is-selected .halo{stroke:var(--blue)}.g-node .dot{stroke:var(--night-0);stroke-width:2;transition:r .2s}.g-node .dot.tone-clean{fill:#9aa7c2}.g-node .dot.tone-recall{fill:var(--night-0);stroke:var(--amber);stroke-width:2}.g-node .dot.tone-design{fill:var(--amber)}.g-node .dot.unread{stroke-dasharray:2.5 2.5;stroke:var(--ink-3);stroke-width:1.6}.g-node.is-self .dot{fill:var(--ivory);stroke:var(--blue);stroke-width:3}.g-node .glow{fill:var(--amber);opacity:.22;filter:blur(6px)}.g-node .lk{fill:var(--ink);font-family:var(--mono);font-size:11.5px;font-weight:600}.g-node .ln{fill:var(--ink-3);font-size:10.5px}.g-node.is-dim{opacity:.2}.g-node.is-self .lk{fill:var(--ivory);font-size:12.5px}.g-more{cursor:pointer}.g-more rect{fill:var(--night-2);stroke:var(--rule-2)}.g-more text{fill:var(--ink-2);font-size:11.5px}.g-more:hover rect,.g-more:focus-visible rect{stroke:var(--blue)}.g-legend{display:flex;gap:8px 16px;flex-wrap:wrap;margin-top:12px;font-size:11.5px;color:var(--ink-3);align-items:center}.g-legend .sw{display:inline-flex;align-items:center;gap:6px}.g-legend .sw i{width:10px;height:10px;border-radius:50%;display:inline-block}.g-legend .sw i.lg-design{background:var(--amber)}.g-legend .sw i.lg-recall{border:2px solid var(--amber)}.g-legend .sw i.lg-clean{background:#9aa7c2}.g-legend .sw i.lg-unread{border:1.5px dashed var(--ink-3)}.g-legend .sep{width:1px;height:14px;background:var(--rule-2)}.graph-hint{font-size:12px;color:var(--ink-4);margin-top:8px}.tl-grid{stroke:var(--rule)}.tl-axis{fill:var(--ink-4);font-size:10.5px;font-variant-numeric:tabular-nums}.tl-band{fill:#7fa2ff0f}.tl-rowhit{fill:transparent}.tl-row:hover .tl-rowhit,.tl-row:focus-visible .tl-rowhit{fill:#ffffff08}.tl-row:focus-visible{outline:none}.tl-edge{fill:none;stroke:var(--ink-4);stroke-width:1.1}.tl-edge.on{stroke:var(--amber);stroke-width:2}.tl-dia.design{fill:var(--amber)}.tl-dia.other{fill:none;stroke:var(--amber);stroke-width:1.3}.tl-rlink{stroke:var(--amber);stroke-width:1;stroke-dasharray:2 3;opacity:.7}.tl-label{fill:var(--ink-2);font-size:11.5px}.tl-label .lk{font-family:var(--mono);fill:var(--ink);font-weight:600}.tl-gen{fill:var(--ink-4);font-size:10px}.tl-clear{stroke:var(--blue);stroke-dasharray:3 3;opacity:.7}.review-item{border:1px solid var(--rule);border-radius:var(--r-m);padding:14px 16px;margin-bottom:10px;background:var(--night-2)}.review-item.tone-amber{border-left:3px solid var(--amber)}.review-item.tone-violet{border-left:3px solid var(--violet)}.review-item.tone-alert{border-left:3px solid var(--alert)}.review-item.tone-muted{border-left:3px solid var(--ink-4)}.review-item h3{margin:0 0 8px;font-size:13.5px;font-weight:620;line-height:1.4;display:flex;gap:8px;align-items:baseline}.review-item dl{margin:0;display:grid;grid-template-columns:92px 1fr;gap:4px 12px;font-size:12.5px}.review-item dt{color:var(--ink-4);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;font-weight:600;padding-top:2px}.review-item dd{margin:0;color:var(--ink-2)}.review-item .acts{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.review-item .links{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}@media (max-width: 520px){.review-item dl{grid-template-columns:1fr}}.signal{border-top:1px solid var(--rule);padding:12px 0}.signal:first-of-type{border-top:0}.signal-head{display:flex;gap:10px;align-items:flex-start;width:100%;background:none;border:0;padding:0;color:inherit;text-align:left;cursor:pointer}.signal-head .t{flex:1;font-size:13.5px;line-height:1.45}.signal-head .chev{color:var(--ink-4);transition:transform .25s var(--ease-out);flex:none;margin-top:2px}.signal-head[aria-expanded=true] .chev{transform:rotate(90deg)}.sev{font-size:10px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;padding:3px 6px;border-radius:4px;flex:none;margin-top:1px}.sev-high{background:var(--alert-soft);color:var(--alert)}.sev-medium{background:var(--amber-soft);color:var(--amber)}.sev-low{background:var(--night-3);color:var(--amber-2)}.sev-info{background:var(--night-3);color:var(--ink-3)}.signal-body{padding:10px 0 2px;display:grid;gap:8px}.recall{display:grid;gap:4px;padding:10px 12px;border-radius:var(--r-s);background:var(--night-1);border:1px solid var(--rule)}.recall-h{display:flex;gap:8px;flex-wrap:wrap;align-items:center;font-size:12.5px}.recall-h .k{color:var(--ink);font-weight:600}.recall-r{font-size:12.5px;color:var(--ink-3);line-height:1.45}.cit{border-top:1px solid var(--rule);padding:12px 0;display:grid;gap:8px}.cit:first-of-type{border-top:0;padding-top:0}.cit.is-rejected{opacity:.55}.cit-h{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:13px}.cit-h .k{color:var(--blue);font-weight:600;cursor:pointer;background:none;border:0;padding:0}.cit-a{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.quote{font-family:var(--serif);font-size:14.5px;line-height:1.5;color:var(--paper-ink);background:var(--paper);border-radius:4px;padding:10px 12px 10px 14px;position:relative;margin:0}.quote:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--blue-2);border-radius:4px 0 0 4px}.quote mark{background:#5b82f02e;color:#1d3f9e;font-family:var(--mono);font-size:.88em;padding:0 2px;border-radius:2px}.quote.is-ocr:before{background:var(--amber-2)}.memo p{margin:0 0 10px;font-family:var(--serif);font-size:15px;line-height:1.55;color:var(--ink)}.memo .src{font-size:11.5px;color:var(--ink-3);margin-bottom:10px}.hist{border-top:1px solid var(--rule);padding:10px 0;display:grid;gap:4px;font-size:12.5px}.hist:first-of-type{border-top:0;padding-top:0}.hist-h{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.hist-h .k{color:var(--ink);font-weight:600}.stale{color:var(--amber);font-size:12px}.drawer-scrim{position:fixed;top:0;right:0;bottom:0;left:0;z-index:60;background:#03060c80;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);animation:fadeIn .25s ease}.drawer{position:fixed;z-index:61;top:0;right:0;bottom:0;width:min(520px,100vw);background:var(--night-2);border-left:1px solid var(--rule-2);box-shadow:-30px 0 80px -30px #000000b3;display:flex;flex-direction:column;animation:slideIn .4s var(--ease-out)}.drawer-head{display:flex;align-items:flex-start;gap:12px;padding:18px 20px 14px;border-bottom:1px solid var(--rule)}.drawer-head .t{flex:1;min-width:0}.drawer-head .eyebrow{margin:0 0 6px}.drawer-head h2{margin:0;font-family:var(--serif);font-weight:420;font-size:24px;letter-spacing:-.02em;line-height:1.15;color:var(--ivory)}.drawer-head h2 .k{font-size:.82em;color:var(--blue)}.drawer-body{padding:18px 20px 30px;overflow-y:auto;display:grid;gap:18px;align-content:start}.drawer-sec h3{font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-4);margin:0 0 8px;font-weight:650}.prov-grid{display:grid;grid-template-columns:120px 1fr;gap:6px 14px;font-size:12.5px;margin:0}.prov-grid dt{color:var(--ink-3)}.prov-grid dd{margin:0;color:var(--ink);word-break:break-word}.prov-grid dd .mono{font-size:11.5px;color:var(--ink-2)}.page-card{display:flex;gap:14px;align-items:center;background:var(--paper);color:var(--paper-ink);border-radius:var(--r-m);padding:12px 14px;text-decoration:none!important;transition:transform .25s var(--ease-out),box-shadow .25s;box-shadow:var(--shadow)}.page-card:hover{transform:translateY(-1px)}.page-card .sheet{width:42px;height:54px;flex:none;background:#fff;border:1px solid #d9d1bf;border-radius:2px;position:relative;box-shadow:2px 2px #e6dcc7;display:grid;place-items:center;font-family:var(--mono);font-size:11px;color:#2d56c4;font-weight:600}.page-card .sheet:before{content:"";position:absolute;left:7px;right:7px;top:9px;height:18px;background:repeating-linear-gradient(#e7e0d0 0 2px,transparent 2px 5px)}.page-card .sheet b{position:relative;margin-top:22px}.page-card .tx{display:grid;gap:2px;font-size:13px}.page-card .tx b{font-weight:650}.page-card .tx span{font-size:11.5px;color:var(--paper-mute)}.drawer-acts{display:flex;gap:8px;flex-wrap:wrap}.drawer .note{font-size:12px;color:var(--ink-3)}@keyframes slideIn{0%{transform:translate(40px);opacity:0}to{transform:none;opacity:1}}@keyframes fadeIn{0%{opacity:0}}@media (prefers-reduced-motion: reduce){.drawer,.drawer-scrim{animation:none}}.tbl-wrap{overflow-x:auto;margin:0 -4px}.tbl{width:100%;border-collapse:collapse;font-size:13px}.tbl th{text-align:left;font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-4);font-weight:650;border-bottom:1px solid var(--rule-2);padding:8px 10px;vertical-align:bottom;white-space:nowrap}.tbl td{border-bottom:1px solid var(--rule);padding:11px 10px;vertical-align:top}.tbl tr.click{cursor:pointer;transition:background .15s}.tbl tr.click:hover,.tbl tr.click:focus-visible{background:#7fa2ff0d;outline:none}.tbl td .k{color:var(--blue);font-weight:600}.tbl td .sub{color:var(--ink-3);font-size:12px}.tbl tr.is-conditional td:first-child{box-shadow:inset 3px 0 0 var(--violet)}.bigstats{display:flex;gap:clamp(20px,4vw,52px);flex-wrap:wrap;margin:4px 0 6px}.bigstats div{display:grid;gap:2px}.bigstats b{font-family:var(--serif);font-size:40px;font-weight:400;line-height:1;color:var(--ivory);font-variant-numeric:tabular-nums}.bigstats .amber b{color:var(--amber)}.bigstats .violet b{color:var(--violet)}.bigstats span{font-size:12px;color:var(--ink-3);max-width:220px}.row-in{display:flex;gap:8px;flex-wrap:wrap}.row-in .field{flex:1 1 260px}.tags{display:flex;flex-wrap:wrap;gap:6px}.tag-btn{background:var(--night-3);border:1px solid var(--rule);color:var(--ink-2);font-size:12px;padding:5px 10px;border-radius:999px;cursor:pointer}.tag-btn:hover{border-color:var(--rule-2);color:var(--ink)}.tag-btn .k{color:var(--blue)}.note-box{font-size:12.5px;color:var(--ink-2);background:var(--night-1);border:1px solid var(--rule);border-radius:var(--r-m);padding:10px 12px}.note-box.amber{border-color:#e7a9484d}.note-box.violet{border-color:#b7a4f54d}.err{color:var(--alert);font-size:13px}.ok{color:var(--sage);font-size:12.5px}.skeleton{background:linear-gradient(90deg,var(--night-2),var(--night-3),var(--night-2));background-size:200% 100%;animation:shimmer 1.4s linear infinite;border-radius:var(--r-m)}@keyframes shimmer{to{background-position:-200% 0}}@media (prefers-reduced-motion: reduce){.skeleton{animation:none}}.loading-thread{display:flex;gap:10px;align-items:center;color:var(--ink-3);font-size:13px;padding:30px 0}.loading-thread i{width:60px;height:2px;background:linear-gradient(90deg,transparent,var(--blue),transparent);background-size:200% 100%;animation:shimmer 1.2s linear infinite}.home-hero{padding:10px 0 6px}.home-cases{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin-top:6px}.case{background:var(--night-2);border:1px solid var(--rule);border-radius:var(--r-l);padding:16px;display:grid;gap:6px;text-align:left;color:inherit;cursor:pointer;transition:border-color .2s,transform .3s var(--ease-out)}.case:hover,.case:focus-visible{border-color:var(--rule-2);transform:translateY(-2px)}.case .k{color:var(--blue);font-size:12.5px}.case h3{margin:0;font-family:var(--serif);font-weight:450;font-size:19px}.case p{margin:0;font-size:12.5px;color:var(--ink-3)}.method ol,.method ul{padding-left:20px;color:var(--ink-2)}.method li{margin-bottom:8px}.method li b{color:var(--ink)}.method h3{font-size:14px;margin:18px 0 8px}::view-transition-old(root),::view-transition-new(root){animation-duration:.6s;animation-timing-function:var(--ease-io)}@media (prefers-reduced-motion: reduce){::view-transition-old(root),::view-transition-new(root){animation:none}}@media (max-width: 640px){.finding{padding:20px 18px 18px}.verdict{border-left:0;padding-left:0;border-top:1px solid var(--rule-2);padding-top:16px;flex-basis:100%}.verdict-label{font-size:26px}.panel{padding:16px}}@media (pointer: coarse){.search kbd{display:none}}@media (max-width: 980px){.ws-rail{-webkit-mask-image:linear-gradient(90deg,#000 85%,transparent);mask-image:linear-gradient(90deg,#000 85%,transparent);padding-right:40px}}.film-stage .film-gl,.film-stage .film-story{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}.film-grid{position:absolute;top:0;right:0;bottom:0;left:0;pointer-events:none;background-image:linear-gradient(rgba(236,228,210,.032) 1px,transparent 1px),linear-gradient(90deg,rgba(236,228,210,.032) 1px,transparent 1px);background-size:96px 96px;background-position:center;-webkit-mask-image:radial-gradient(ellipse at 55% 45%,#000 20%,transparent 75%);mask-image:radial-gradient(ellipse at 55% 45%,#000 20%,transparent 75%)}.film-hud{position:fixed;left:clamp(16px,4vw,44px);bottom:18px;z-index:20;display:flex;gap:12px;align-items:center;font-family:var(--mono);font-size:11px;letter-spacing:.02em;color:var(--ink-3);padding:7px 12px;border-radius:999px;background:#070c178c;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid var(--rule);max-width:calc(100vw - 32px);overflow:hidden;white-space:nowrap}.film-hud .hud-n{color:var(--blue)}.film-hud .hud-name{color:var(--ivory);font-family:var(--sans);font-weight:600;letter-spacing:.08em;text-transform:uppercase;font-size:10.5px}.film-hud .hud-read{color:var(--ink-2);overflow:hidden;text-overflow:ellipsis}@media (max-width: 860px){.film-hud .hud-read{display:none}.film-hud{bottom:12px}}.chapter-label span{font-size:12px}.chapter-copy{position:relative}.chapter-copy:before{content:"";position:absolute;left:-18px;top:34px;width:1px;height:64px;background:linear-gradient(var(--blue),transparent)}.doc{position:relative}.doc:after{content:"";position:absolute;top:-6px;right:-6px;bottom:-6px;left:-6px;border:1px solid rgba(127,162,255,.25);border-radius:8px;pointer-events:none;-webkit-mask:linear-gradient(#000 0 0) top left / 14px 14px no-repeat,linear-gradient(#000 0 0) bottom right / 14px 14px no-repeat;mask:linear-gradient(#000 0 0) top left / 14px 14px no-repeat,linear-gradient(#000 0 0) bottom right / 14px 14px no-repeat}@media (max-width: 860px){.chapter-copy:before{display:none}}.chapter.place-right{padding-right:clamp(16px,9vw,150px)}.handoff{min-height:135svh}@media (max-width: 860px){.chapter{min-height:190svh;align-items:flex-start;padding-top:105svh;padding-bottom:20svh}.handoff{padding-top:40svh}}.g-flow{fill:none;stroke:#ffd79a;stroke-width:2.6;stroke-linecap:round;stroke-dasharray:2 26;opacity:.9;animation:g-flow 2.4s linear infinite;pointer-events:none;filter:drop-shadow(0 0 4px rgba(231,169,72,.9))}@keyframes g-flow{to{stroke-dashoffset:28}}.chain-link.st-extracted:after,.chain-link.st-confirmed:after{content:"";position:absolute;left:0;right:0;top:calc(50% - 1px);height:2px;background:linear-gradient(90deg,transparent,rgba(255,215,154,.95),transparent);background-size:40% 100%;background-repeat:no-repeat;animation:chain-signal 2.6s var(--ease-io) infinite;animation-direction:reverse;pointer-events:none}@keyframes chain-signal{0%{background-position:-40% 0}to{background-position:140% 0}}.finding{isolation:isolate}.finding:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;pointer-events:none;background-image:linear-gradient(rgba(236,228,210,.03) 1px,transparent 1px),linear-gradient(90deg,rgba(236,228,210,.03) 1px,transparent 1px);background-size:48px 48px;-webkit-mask-image:linear-gradient(110deg,transparent 30%,#000 75%);mask-image:linear-gradient(110deg,transparent 30%,#000 75%)}.finding:after{animation:glow-drift 18s ease-in-out infinite alternate}@keyframes glow-drift{0%{transform:translate(0)}to{transform:translate(-90px,40px) scale(1.15)}}.finding .kline:before{content:"[ dossier ]";font-family:var(--mono);color:var(--ink-4);font-size:11px;margin-right:2px}.panel{position:relative}.finding,.panel#review{background-clip:padding-box}.corner-marks:after{content:"";position:absolute;top:8px;right:8px;bottom:8px;left:8px;pointer-events:none;border:1px solid rgba(127,162,255,.35);border-radius:10px;-webkit-mask:linear-gradient(#000 0 0) top left / 12px 12px no-repeat,linear-gradient(#000 0 0) top right / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom left / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom right / 12px 12px no-repeat;mask:linear-gradient(#000 0 0) top left / 12px 12px no-repeat,linear-gradient(#000 0 0) top right / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom left / 12px 12px no-repeat,linear-gradient(#000 0 0) bottom right / 12px 12px no-repeat}@media (prefers-reduced-motion: reduce){.g-flow{animation:none;stroke-dasharray:none;opacity:.35}.chain-link:after{animation:none!important;display:none}.finding:after{animation:none}}.film-top.is-solid{-webkit-backdrop-filter:none;backdrop-filter:none;background:#080d18eb}.film-hud{transition:opacity .4s var(--ease-out),transform .4s var(--ease-out)}.film-hud.is-away{opacity:0;transform:translateY(10px);pointer-events:none} diff --git a/web/dist/index.html b/web/dist/index.html index e93bfd0..757015a 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -7,8 +7,8 @@ - - + +
From 4502317cd02402df428fc6c0e8dbc46bc9283242 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:54:23 +0100 Subject: [PATCH 05/10] docs: describe advisory AI lineage and re-ingest citation reconciliation --- README.md | 2 +- docs/EVIDENCE_QUALITY.md | 27 ++++++++++++++++++++++----- docs/UX_EXPERIENCE.md | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c269ae5..b6a968b 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ Continuous integration runs ruff and `pytest` (Ubuntu and Windows), a stale-`web
AI and third-party tools (disclosure) -- **Optional LLM triage.** NVIDIA-hosted `nvidia/nemotron-3.5-lightning-30b-a3b` (fallback `mistralai/mistral-large-4-1t-a52b`) labels *ambiguous* citation mentions on request. Its output must quote the snippet verbatim or it is discarded, people can override it, and an LLM-only link counts as uncertain evidence. +- **Optional LLM triage.** NVIDIA-hosted `nvidia/nemotron-3.5-lightning-30b-a3b` (fallback `mistralai/mistral-large-4-1t-a52b`) labels *ambiguous* citation mentions on request. Its output must quote the snippet verbatim or it is discarded. An LLM label is advisory: it is shown with its provenance but never changes the lineage or a verdict until a person confirms the citation. - **Optional investigation agent.** NVIDIA-hosted `nvidia/nemotron-3-ultra-550b-a55b` (same fallback). It chooses tool calls and writes findings, but produces no verdicts or counts and cannot change lineage. - Both need `NVIDIA_API_KEY` and `NVIDIA_BASE_URL` in `.env` (see [`.env.example`](.env.example)). Everything else works without them. - **Libraries.** Relate (`relate-db`), FastAPI, Uvicorn, pypdf, httpx, React 18, Vite. Optional OCR refresh: RapidOCR and pypdfium2 ([`requirements-ocr.txt`](requirements-ocr.txt)). diff --git a/docs/EVIDENCE_QUALITY.md b/docs/EVIDENCE_QUALITY.md index f0dd425..8195370 100644 --- a/docs/EVIDENCE_QUALITY.md +++ b/docs/EVIDENCE_QUALITY.md @@ -95,8 +95,25 @@ AI agent but labelled "curated human review", are kept with their notes under `a applied: K092835 → K991646 stays out of the lineage through the audit (`error`), and the three K093416 links are audit-`unresolved`, so they count, flagged as doubtful, until a person decides them. -Lineage rule (`graph.LINEAGE_EDGE`): a person confirmed it, OR (the extractor said predicate, or the LLM labelled a -mention predicate) and the audit did not mark it `error`/`not_predicate`, unless a person rejected it. +Lineage rule (`graph.LINEAGE_EDGE`, trusted lineage): the edge is still cited by the citing device's current summary +(not retired by a re-ingest), and a person confirmed it, OR the extractor said predicate and the audit did not mark it +`error`/`not_predicate`, unless a person rejected it. Automated sources never change trusted lineage on their own: an +LLM triage label, or a confirmation or rejection sent through the MCP client (reviewer `mcp-client`), is **advisory** +(`graph.ADVISORY_EDGE`) until a person decides. Advisory links are listed with their provenance (model, quote, time, +page, source hash) and the suggested device's recalls in the `ADVISORY_LINK_PENDING_REVIEW` signal; they are never +traversed, so they cannot raise or lower a verdict, recall reach or the watchlist. Inside the verdict window they make +the evidence `partial` (reason `advisory_links_pending_review`), so a clean result is shown as provisional rather than +fully supported. An MCP-client review never overwrites a person's review. + +Re-ingest reconciliation (`ingest.write`, `graph.retire_citations`): re-ingesting a clearance compares its stored +citations with the refreshed summary inside the same write transaction. Edges the refreshed summary no longer supports +are **retired** (`retired_at`, `retired_reason`, `retired_by_sha256`), not deleted: reviews, LLM labels, audit fields +and the original quote, page and source hash stay on the edge, it leaves trusted and advisory lineage, and it is +restored if a later summary cites the device again. Reconciliation runs only when the refreshed summary text was read, +so an unreadable download never wipes lineage, and any write error rolls the whole ingest back. Retired edges appear in +the `CITATION_RETIRED_BY_REINGEST` signal; one that a person had confirmed makes the evidence `partial` (reason +`human_confirmed_citation_retired`). Reviews record the summary hash they were made against +(`reviewed_source_sha256`). ### 5. Uncertainty in assessments (`forebear/lineage.py`, rules `forebear-rules-v3`) A lineage hop is **doubtful** when it is audit-unresolved, its K-number was supplied by an audit correction rather than @@ -266,9 +283,9 @@ Two issues found in review, investigated, fixed and re-reviewed by an independen The three disputed K093416 links are audit-`unresolved`: they count in the lineage, flagged as doubtful, so the Trilogy 200's recalls show instead of being dropped by a supposed human rejection. The re-review found one more path to the same problem: the MCP `review_citation` tool wrote the same field as the app. Its writes are now recorded with - reviewer `mcp-client`; they still apply (a rejection removes the edge and is disclosed as an unresolved predicate - citation), but a client confirmation never clears an uncertain-evidence flag, and a mention promoted only by a client - confirmation counts as doubtful. Only a review made in the app (reviewer `user`) or a named human review does. + reviewer `mcp-client`; a client confirmation never clears an uncertain-evidence flag. (Superseded by rules + `forebear-rules-v5`: MCP-client reviews and LLM labels are now advisory and never change trusted lineage; see the + lineage rule above.) Only a review made in the app (reviewer `user`) or a named human review does. 2. **Completeness beyond the direct predicates.** Investigation on all 1,040 in-family devices: 7 clean results requested at `depth=1` were reported `complete` although the full ancestry is REVIEW_LINEAGE (e.g. K251770), and among the 101 `complete` clean results, 4 had removed or unresolved predicate citations and 23 had doubtful links at diff --git a/docs/UX_EXPERIENCE.md b/docs/UX_EXPERIENCE.md index 6b057fa..8830713 100644 --- a/docs/UX_EXPERIENCE.md +++ b/docs/UX_EXPERIENCE.md @@ -57,7 +57,7 @@ the favicon. ### The investigation page, top to bottom -- **Finding.** The device, the verdict, and an authority note: *Deterministic assessment · forebear-rules-v4. +- **Finding.** The device, the verdict, and an authority note: *Deterministic assessment · forebear-rules-v5. Authoritative within its documented scope … A documentation signal, not a safety determination.* Below it, one plain-language finding sentence, built only from the assessment payload. It names the page, the recall class, the root cause, the start date, and how long before the clearance the recall began. Coverage chips show evidence completeness, From 03bf422e71cba504fe456d4d923ac016c0d64f4d Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 14:10:05 +0100 Subject: [PATCH 06/10] fix: count a person's citation review only for the summary SHA-256 it was made on --- forebear/graph.py | 19 +++++++++++++------ forebear/investigation/tools.py | 9 +++++++-- forebear/lineage.py | 18 ++++++++++++++++-- tests/test_trusted_lineage.py | 17 +++++++++++++++++ 4 files changed, 53 insertions(+), 10 deletions(-) diff --git a/forebear/graph.py b/forebear/graph.py index 3676669..db8ee39 100644 --- a/forebear/graph.py +++ b/forebear/graph.py @@ -51,23 +51,30 @@ # read it as a predicate and the extraction audit did not find it wrong - unless a person rejected it. # Automated sources never change trusted lineage on their own: an LLM triage label, or a confirmation/rejection # recorded through the MCP client (reviewer 'mcp-client', possibly an AI agent), is advisory until a person decides. +# A person's review is bound to the evidence it was made on: it counts only while the edge's source SHA-256 is the one +# recorded at review time (reviewed_source_sha256). When a refreshed summary changes the evidence, or a retired edge is +# restored from a different PDF, the review is kept as history but the edge falls back to the extraction rules and is +# flagged 'review_outdated' until a person reviews it again. MACHINE_REVIEWER = "mcp-client" HUMAN_REVIEW = f"(r.review IS NOT NULL AND coalesce(r.reviewer, '') <> '{MACHINE_REVIEWER}')" +CURRENT_HUMAN_REVIEW = f"({HUMAN_REVIEW} AND coalesce(r.reviewed_source_sha256, '') = coalesce(r.source_sha256, ''))" LIVE_EDGE = "r.retired_at IS NULL" -LINEAGE_EDGE = (f"{LIVE_EDGE} AND NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " - f"((r.review = 'confirmed' AND {HUMAN_REVIEW}) OR " +LINEAGE_EDGE = (f"{LIVE_EDGE} AND NOT (r.review = 'rejected' AND {CURRENT_HUMAN_REVIEW}) AND " + f"((r.review = 'confirmed' AND {CURRENT_HUMAN_REVIEW}) OR " "(r.kind = 'predicate' AND NOT coalesce(r.audit, '') IN ['error', 'not_predicate']))") # Advisory (uncertain, untrusted) lineage: an automated source says predicate, no person has decided, and the # extraction audit did not rule it out from the source. Shown with its provenance; never a verdict input. -ADVISORY_EDGE = (f"{LIVE_EDGE} AND NOT ({LINEAGE_EDGE}) AND NOT (r.review = 'rejected' AND {HUMAN_REVIEW}) AND " +# A person's confirmation made on an earlier version of the evidence is advisory too, until it is renewed. +ADVISORY_EDGE = (f"{LIVE_EDGE} AND NOT ({LINEAGE_EDGE}) AND NOT (r.review = 'rejected' AND {CURRENT_HUMAN_REVIEW}) AND " "NOT coalesce(r.audit, '') IN ['error', 'not_predicate', 'role_corrected'] AND " - f"(r.ai_label = 'predicate' OR (r.review = 'confirmed' AND r.reviewer = '{MACHINE_REVIEWER}'))") + f"(r.ai_label = 'predicate' OR (r.review = 'confirmed' AND r.reviewer = '{MACHINE_REVIEWER}') OR " + f"(r.review = 'confirmed' AND {HUMAN_REVIEW} AND NOT {CURRENT_HUMAN_REVIEW}))") DISPUTED_EDGE = ("coalesce(r.audit, '') = 'unresolved' AND " - f"(coalesce(r.review, '') <> 'confirmed' OR coalesce(r.reviewer, '') = '{MACHINE_REVIEWER}')") + f"NOT (r.review = 'confirmed' AND {CURRENT_HUMAN_REVIEW})") _HOP_FIELDS = ("src: startNode(r).k, dst: endNode(r).k, page: r.page, snippet: r.snippet, confidence: r.confidence, " "review: r.review, reviewer: r.reviewer, review_note: r.review_note, " "reviewed_at: toString(r.reviewed_at), name_check: r.name_check, source_url: r.source_url, " - "source_sha256: r.source_sha256, kind: r.kind, audit: r.audit, audit_note: r.audit_note, " + "source_sha256: r.source_sha256, reviewed_source_sha256: r.reviewed_source_sha256, kind: r.kind, audit: r.audit, audit_note: r.audit_note, " "ai_label: r.ai_label, ai_quote: r.ai_quote, ai_model: r.ai_model, ai_at: toString(r.ai_at), " "text_source: r.text_source, panel_check: r.panel_check, quote: r.quote, method: r.method") diff --git a/forebear/investigation/tools.py b/forebear/investigation/tools.py index e21ee1e..e449c5d 100644 --- a/forebear/investigation/tools.py +++ b/forebear/investigation/tools.py @@ -19,7 +19,7 @@ from .. import summaries from ..graph import ADVISORY_EDGE, LINEAGE_EDGE, Graph -from ..lineage import EVIDENCE_WINDOW, assess, compare, doubt, recall_reach +from ..lineage import EVIDENCE_WINDOW, assess, compare, current_human_review, doubt, recall_reach K_RE = re.compile(r"^K\d{6}$") RECALL_RE = re.compile(r"^Z-\d{4}-\d{4}$") @@ -151,7 +151,10 @@ def _provenance(h: dict) -> str: 'client_confirmed_not_human' and 'llm_label_machine' on a non-predicate are advisory: they never count in the lineage until a person confirms the citation.""" if h.get("review") == "confirmed": - return "human_confirmed" if h.get("reviewer") not in ("mcp-client",) else "client_confirmed_not_human" + if h.get("reviewer") in ("mcp-client",): + return "client_confirmed_not_human" + # a person's confirmation of an earlier version of the evidence needs re-review before it counts + return "human_confirmed" if current_human_review(h) else "human_review_outdated" if h.get("review") == "rejected" and h.get("reviewer") in ("mcp-client",): return "client_rejection_pending_not_human" if h.get("audit") == "corrected": @@ -242,6 +245,7 @@ def t_list_citations(g: Graph, args: dict, ctx: RunContext) -> dict: RETURN b.k AS dst, b.name AS dst_name, toString(b.decision_date) AS dst_decision_date, r.kind AS kind, r.page AS page, r.quote AS quote, r.snippet AS snippet, r.audit AS audit, r.audit_note AS audit_note, r.review AS review, r.reviewer AS reviewer, r.name_check AS name_check, r.panel_check AS panel_check, + r.source_sha256 AS source_sha256, r.reviewed_source_sha256 AS reviewed_source_sha256, r.ai_label AS ai_label, r.corrected_from AS corrected_from, r.source_url AS source_url, r.retired_at IS NOT NULL AS retired, ({LINEAGE_EDGE}) AS in_lineage, ({ADVISORY_EDGE}) AS advisory ORDER BY CASE r.kind WHEN 'predicate' THEN 0 WHEN 'reference' THEN 1 ELSE 2 END, dst""", {"k": k}) @@ -345,6 +349,7 @@ def verify_citation_facts(g: Graph, src: str, dst: str) -> dict: RETURN r.page AS page, r.quote AS quote, r.snippet AS snippet, r.source_url AS source_url, r.source_sha256 AS sha, r.kind AS kind, r.corrected_from AS corrected_from, r.audit AS audit, r.audit_note AS audit_note, r.text_source AS text_source, r.review AS review, + r.source_sha256 AS source_sha256, r.reviewed_source_sha256 AS reviewed_source_sha256, r.reviewer AS reviewer, r.ai_label AS ai_label, ({LINEAGE_EDGE}) AS in_lineage""", {"s": src, "d": dst}) if not rows: diff --git a/forebear/lineage.py b/forebear/lineage.py index a897fb9..37970b6 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -348,9 +348,11 @@ def doubt(h: dict) -> list[str]: """Why a lineage hop's evidence is doubtful ([] if it is not). A person's confirmation clears it; a confirmation sent through the MCP tool (reviewer "mcp-client", possibly an AI agent) does not, and a rejection sent through it leaves the edge in the lineage, flagged, until a person decides.""" - if h.get("review") == "confirmed" and h.get("reviewer") not in MACHINE_REVIEWERS: + if current_human_review(h) and h.get("review") == "confirmed": return [] why = [] + if human_review(h) and not current_human_review(h): + why.append("review_outdated") # a person reviewed an earlier version of the evidence if h.get("audit") == "unresolved": why.append("audit_unresolved") if h.get("audit") == "corrected": # the K-number was supplied by the audit, not printed in the PDF @@ -369,11 +371,21 @@ def doubt(h: dict) -> list[str]: return why +def human_review(h: dict) -> bool: + """A review recorded by a person (any version of the evidence).""" + return bool(h.get("review")) and h.get("reviewer") not in MACHINE_REVIEWERS + + +def current_human_review(h: dict) -> bool: + """Mirror of graph.CURRENT_HUMAN_REVIEW: a person's review made on the evidence the edge carries now.""" + return human_review(h) and (h.get("reviewed_source_sha256") or "") == (h.get("source_sha256") or "") + + def trust(h: dict) -> str: """How far a trusted lineage hop can be relied on: 'human_verified' (a person confirmed it), 'extracted' (read from the FDA summary, nothing doubtful) or 'uncertain' (doubt(h) is not empty). Advisory and retired edges are labelled where they are listed; they are never lineage hops.""" - if h.get("review") == "confirmed" and h.get("reviewer") not in MACHINE_REVIEWERS: + if h.get("review") == "confirmed" and current_human_review(h): return "human_verified" return "uncertain" if doubt(h) else "extracted" @@ -385,6 +397,8 @@ def advisory_basis(h: dict) -> list[str]: out.append("llm_label") if h.get("review") == "confirmed" and h.get("reviewer") in MACHINE_REVIEWERS: out.append("client_confirmation") + if h.get("review") == "confirmed" and human_review(h) and not current_human_review(h): + out.append("outdated_human_confirmation") return out diff --git a/tests/test_trusted_lineage.py b/tests/test_trusted_lineage.py index 474ff52..b4d257a 100644 --- a/tests/test_trusted_lineage.py +++ b/tests/test_trusted_lineage.py @@ -248,3 +248,20 @@ def test_saved_assessment_is_flagged_after_ai_triage_and_human_review(tiny): assert h["verdict"] == assess(tiny, "K000009")["verdict"] # flagged for re-check, verdict unchanged tiny.review_citation("K000009", "K000002", "confirmed", "p.3", reviewer="user") assert assess(tiny, "K000009")["verdict"] != h["verdict"] + + +# ---------------------------------------------------------------- reviews are bound to the evidence version +def test_an_outdated_confirmation_of_a_mention_is_advisory_not_lineage(tiny): + tiny.upsert_citations([{"src": "K000009", "dst": "K000002", "kind": "mention", "confidence": 0.4, "page": 3, + "snippet": "see K000002", "quote": "see K000002", "method": "test", + "source_url": "u", "source_sha256": "s1"}]) + tiny.review_citation("K000009", "K000002", "confirmed", "a predicate on p.3", reviewer="user") + assert assess(tiny, "K000009")["verdict"] == "REVIEW_LINEAGE" + tiny.upsert_citations([{"src": "K000009", "dst": "K000002", "kind": "mention", "confidence": 0.4, "page": 3, + "snippet": "see K000002", "quote": "see K000002", "method": "test", + "source_url": "u", "source_sha256": "s2"}]) + a = assess(tiny, "K000009") + assert a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" and a["coverage"]["evidence"] == "partial" + link = next(e for s in a["signals"] if s["code"] == "ADVISORY_LINK_PENDING_REVIEW" + for e in s["evidence"] if e["type"] == "advisory_citation") + assert link["basis"] == ["outdated_human_confirmation"] and link["review_note"] == "a predicate on p.3" From 50efe68b672f7369568e16c1477e3461e0b6f470 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 14:11:12 +0100 Subject: [PATCH 07/10] fix: add an explicit FDA summary refresh that keeps data/raw and reconciles only readable PDFs --- forebear/api.py | 5 +- forebear/ingest.py | 13 +- forebear/mcp_server.py | 11 +- forebear/openfda.py | 4 +- forebear/summaries.py | 68 ++++++++++- tests/test_summary_refresh.py | 222 ++++++++++++++++++++++++++++++++++ 6 files changed, 307 insertions(+), 16 deletions(-) create mode 100644 tests/test_summary_refresh.py diff --git a/forebear/api.py b/forebear/api.py index 051802b..666928d 100644 --- a/forebear/api.py +++ b/forebear/api.py @@ -232,6 +232,9 @@ def do(g: Graph): # ---------------------------------------------------------------- writes class IngestIn(BaseModel): k: str + # Re-download the summary PDF instead of reusing the cached text, to detect a changed FDA document. A failed or + # unreadable download changes nothing (422). + refresh: bool = False @app.post("/api/ingest") @@ -241,7 +244,7 @@ async def ingest(body: IngestIn): try: # network phases run off the Relate thread, so the UI stays responsive during a PDF download existing = await run(lambda g: g.device(k)) - fetched = await loop.run_in_executor(None, ingest_mod.fetch_clearance, k) + fetched = await loop.run_in_executor(None, ingest_mod.fetch_clearance, k, True, body.refresh) present = await run(lambda g: ingest_mod.present_devices(g, fetched.cited)) related = await loop.run_in_executor(None, ingest_mod.fetch_related, fetched, present) return await run(lambda g: ingest_mod.write(g, fetched, related, existing)) diff --git a/forebear/ingest.py b/forebear/ingest.py index 8429238..7b564f1 100644 --- a/forebear/ingest.py +++ b/forebear/ingest.py @@ -57,7 +57,9 @@ def normalise_k(k: str) -> str: return k -def fetch_clearance(k: str, use_cache: bool = True) -> Fetched: +def fetch_clearance(k: str, use_cache: bool = True, refresh: bool = False) -> Fetched: + """refresh=True re-downloads the summary PDF (summaries.refresh) instead of reusing the cached text, so a changed + FDA document is detected; it raises IngestError, writing nothing, unless the new PDF is readable.""" k = normalise_k(k) try: meta = openfda.clearances_by_k([k], use_cache=use_cache) @@ -67,7 +69,9 @@ def fetch_clearance(k: str, use_cache: bool = True) -> Fetched: if not meta: raise IngestError(f"{k} is not a 510(k) clearance in openFDA") try: - summ = summaries.fetch(k) + summ = summaries.refresh(k) if refresh else summaries.fetch(k) + except summaries.RefreshError as e: + raise IngestError(f"Summary refresh for {k} did not change the graph: {e}") from e except Exception as e: raise IngestError(f"Could not download the 510(k) summary: {e}") from e if summ["status"] == "error": @@ -138,6 +142,7 @@ def write(g: Graph, f: Fetched, rel: Related, existing: dict | None) -> dict: "k": f.k, "was_present": existing is not None, "lineage_was_known": bool(existing and existing.get("lineage_known")), "summary_status": devices[0]["summary_status"], "summary_url": f.summ.get("url"), + "summary_sha256": f.summ.get("sha256"), "refresh": f.summ.get("refresh"), "citations_added": cits, "citations_unresolved": unresolved, "new_devices": list(rel.cited_meta), "reconciliation": { "ran": reconcile, @@ -153,10 +158,10 @@ def write(g: Graph, f: Fetched, rel: Related, existing: dict | None) -> dict: } -def add_clearance(g: Graph, k: str, use_cache: bool = True) -> dict: +def add_clearance(g: Graph, k: str, use_cache: bool = True, refresh: bool = False) -> dict: """Synchronous composition of the phases (scripts, tests, MCP-less use).""" k = normalise_k(k) existing = g.device(k) - f = fetch_clearance(k, use_cache) + f = fetch_clearance(k, use_cache, refresh) rel = fetch_related(f, present_devices(g, f.cited), use_cache) return write(g, f, rel, existing) diff --git a/forebear/mcp_server.py b/forebear/mcp_server.py index 7844a58..ec907b1 100644 --- a/forebear/mcp_server.py +++ b/forebear/mcp_server.py @@ -41,8 +41,11 @@ {"name": "ingest_clearance", "description": "Fetch a 510(k) from FDA (openFDA + summary PDF), extract its predicates and recalls, " "and MERGE it into the graph. Also extends lineage for a device whose summary was unread. " "Re-ingesting reconciles citations: ones the refreshed summary no longer supports are " - "retired (kept with their reviews and provenance, out of lineage).", - "inputSchema": {"type": "object", "properties": {"k_number": K}, "required": ["k_number"]}}, + "retired (kept with their reviews and provenance, out of lineage). Set refresh=true " + "to re-download the summary PDF and detect a changed FDA document; a failed or " + "unreadable download changes nothing.", + "inputSchema": {"type": "object", "properties": {"k_number": K, "refresh": {"type": "boolean"}}, + "required": ["k_number"]}}, {"name": "review_citation", "description": "Record an ADVISORY judgement on an extracted citation edge: confirmed, rejected, " "or '' to clear. Recorded with reviewer 'mcp-client' (possibly an AI agent), it never " "changes the deterministic lineage or verdict: a confirmation here lists the link as " @@ -136,9 +139,9 @@ def call_tool(name: str, args: dict): if name == "list_citations": return _http("GET", f"/api/device/{up(args['k_number'])}")["citations"] if name == "ingest_clearance": - r = _http("POST", "/api/ingest", json={"k": up(args["k_number"])}) + r = _http("POST", "/api/ingest", json={"k": up(args["k_number"]), "refresh": bool(args.get("refresh"))}) return {k: r[k] for k in ("k", "was_present", "summary_status", "summary_url", "new_devices", - "recalls_linked", "extraction", "reconciliation")} | { + "recalls_linked", "extraction", "reconciliation", "refresh")} | { "citations_added": [{k: c[k] for k in ("dst", "kind", "page", "snippet")} for c in r["citations_added"]]} if name == "review_citation": return _http("POST", "/api/citation/review", json={"src": up(args["src"]), "dst": up(args["dst"]), diff --git a/forebear/openfda.py b/forebear/openfda.py index e93abe9..64e243e 100644 --- a/forebear/openfda.py +++ b/forebear/openfda.py @@ -31,7 +31,7 @@ def _slim(row: dict) -> dict: def _cache_path(endpoint: str, search: str, skip: int) -> Path: key = hashlib.sha1(f"{endpoint}|{search}|{skip}".encode()).hexdigest()[:16] name = f"{endpoint}_{key}.json" - if CACHE_MODE["mode"] == "live" and not (OPENFDA_CACHE / name).exists(): + if CACHE_MODE["mode"] == "live" and ((LIVE_OPENFDA_CACHE / name).exists() or not (OPENFDA_CACHE / name).exists()): return LIVE_OPENFDA_CACHE / name return OPENFDA_CACHE / name @@ -66,6 +66,8 @@ def _get(endpoint: str, search: str, limit: int = 1000, skip: int = 0, use_cache data["results"] = [_slim(row) for row in data.get("results", [])] data["_fetched"] = {"endpoint": endpoint, "search": search, "skip": skip, "at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())} + if CACHE_MODE["mode"] == "live": # the app never rewrites the committed data/raw cache + path = LIVE_OPENFDA_CACHE / path.name path.parent.mkdir(parents=True, exist_ok=True) path.write_text(json.dumps(data), encoding="utf-8") return data diff --git a/forebear/summaries.py b/forebear/summaries.py index fa1f338..e5c8072 100644 --- a/forebear/summaries.py +++ b/forebear/summaries.py @@ -27,13 +27,30 @@ def candidate_urls(k: str) -> list[str]: def cache_file(k: str) -> Path: - """Committed cache first; in live mode, anything not in it lives in data/live (gitignored).""" + """Where k's summary is read from. In live mode a record in data/live (gitignored) wins: it is either a summary + the committed cache never had, or an explicit refresh() of one it has. Otherwise the committed data/raw cache.""" raw = SUMMARY_CACHE / f"{k}.json" - if CACHE_MODE["mode"] == "live" and not raw.exists(): - return LIVE_SUMMARY_CACHE / f"{k}.json" + live = LIVE_SUMMARY_CACHE / f"{k}.json" + if CACHE_MODE["mode"] == "live" and (live.exists() or not raw.exists()): + return live return raw +def write_file(k: str) -> Path: + """Where a fetched summary is written: data/live in live mode, so the app never rewrites the committed + data/raw cache (only scripts/fetch_data.py, in raw mode, does).""" + return (LIVE_SUMMARY_CACHE if CACHE_MODE["mode"] == "live" else SUMMARY_CACHE) / f"{k}.json" + + +def _store(k: str, rec: dict) -> None: + """Write atomically: a crash mid-write never leaves a truncated record that would shadow the committed one.""" + p = write_file(k) + p.parent.mkdir(parents=True, exist_ok=True) + tmp = p.with_suffix(".json.tmp") + tmp.write_text(json.dumps(rec), encoding="utf-8") + tmp.replace(p) + + def load(k: str) -> dict | None: p = cache_file(k) return json.loads(p.read_text(encoding="utf-8")) if p.exists() else None @@ -69,6 +86,44 @@ def fetch(k: str, client: httpx.Client | None = None, force: bool = False) -> di cached = load(k) if cached is not None: return cached + rec = download(k, client) + if rec["status"] != "error": # transient errors are not cached + _store(k, rec) + return rec + + +class RefreshError(Exception): + pass + + +def refresh(k: str, client: httpx.Client | None = None) -> dict: + """Explicitly re-download k's summary PDF from FDA to detect a changed document. Live mode only: the refreshed + record goes to data/live and supersedes the committed data/raw record for the app, which is never modified. + + The cached record is replaced only by genuinely readable evidence: a PDF with a text layer whose SHA-256 differs + from the cached one. A download error, a missing PDF or an image-only PDF (whose OCR, if any, was made from other + bytes) raises RefreshError and leaves the cache untouched, so existing lineage is never reconciled against + unreadable evidence. Returns the current record with `refresh` metadata: {changed, previous_sha256}.""" + if CACHE_MODE["mode"] != "live": + raise RefreshError("refresh writes the live cache only; call config.use_live_cache() first") + prev = load(k) + rec = download(k, client) + prev_sha = (prev or {}).get("sha256") + if rec["status"] == "error": + raise RefreshError(f"download failed: {rec.get('error')}; the cached summary is kept") + if rec["status"] == "missing": + raise RefreshError("FDA returned no summary PDF for this clearance; the cached summary is kept") + if prev_sha and rec["sha256"] == prev_sha: + return prev | {"refresh": {"changed": False, "previous_sha256": prev_sha, "checked_at": rec["fetched_at"]}} + if rec["status"] != "ok": + raise RefreshError(f"the refreshed PDF (sha256 {str(rec['sha256'])[:12]}) has no readable text layer; " + "the cached summary is kept and nothing was reconciled") + _store(k, rec) + return rec | {"refresh": {"changed": True, "previous_sha256": prev_sha, "checked_at": rec["fetched_at"]}} + + +def download(k: str, client: httpx.Client | None = None) -> dict: + """One download attempt over the candidate URLs; never touches the cache.""" own = client is None client = client or httpx.Client(timeout=60, headers={"User-Agent": USER_AGENT}, follow_redirects=True) rec = {"k": k, "status": "missing", "url": None, "sha256": None, "pages": [], @@ -76,6 +131,10 @@ def fetch(k: str, client: httpx.Client | None = None, force: bool = False) -> di try: for url in candidate_urls(k): r = client.get(url) + if r.status_code == 429 or r.status_code >= 500: # transient: never cached, never read as "missing" + rec["status"] = "error" + rec["error"] = f"HTTP {r.status_code} from {url}" + break if r.status_code == 200 and r.content[:4] == b"%PDF": rec["url"] = url rec["sha256"] = hashlib.sha256(r.content).hexdigest() @@ -95,7 +154,4 @@ def fetch(k: str, client: httpx.Client | None = None, force: bool = False) -> di finally: if own: client.close() - if rec["status"] != "error": # transient errors are not cached - cache_file(k).parent.mkdir(parents=True, exist_ok=True) - cache_file(k).write_text(json.dumps(rec), encoding="utf-8") return rec diff --git a/tests/test_summary_refresh.py b/tests/test_summary_refresh.py new file mode 100644 index 0000000..05221c9 --- /dev/null +++ b/tests/test_summary_refresh.py @@ -0,0 +1,222 @@ +"""Explicit summary refresh and evidence-bound human reviews, end to end through the real cache. + +Only the FDA web server is simulated (an httpx transport serving real PDF bytes) and openFDA metadata is stubbed. The +summary download, PDF parsing, SHA-256, the committed (data/raw) and live (data/live) caches, predicate extraction, +the ingest transaction and the trust rules all run for real, on temporary cache directories. +""" +import httpx +import pytest + +from forebear import ingest, summaries +from forebear.lineage import assess, doubt + +K = "K261000" +URL_PATH = f"/cdrh_docs/pdf26/{K}.pdf" +BOILER = ("This summary of 510(k) safety and effectiveness information is submitted in accordance with the " + "requirements of 21 CFR 807.92. The device is a continuous positive airway pressure system for home use.") +V1 = ["Primary Predicate Device: Device K000003 (K000003).", + "Secondary predicate device: Device K000009 (K000009).", BOILER] +V2 = ["Primary Predicate Device: Device K000009 (K000009).", BOILER] +META = [{"k_number": K, "device_name": "New CPAP", "applicant": "NewCo", "decision_date": "2026-05-01", + "date_received": "2026-01-01", "product_code": "BZD", "statement_or_summary": "Summary"}] + + +def make_pdf(lines: list[str], salt: str = "") -> bytes: + """A real one-page PDF with a text layer (Helvetica). `salt` changes the bytes, not the text.""" + esc = lambda s: s.replace("\\", "\\\\").replace("(", "\\(").replace(")", "\\)") # noqa: E731 + content = "BT /F1 9 Tf 40 800 Td 12 TL " + " ".join(f"({esc(t)}) Tj T*" for t in lines) + " ET" + objs = ["<< /Type /Catalog /Pages 2 0 R >>", "<< /Type /Pages /Kids [3 0 R] /Count 1 >>", + "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 842] /Resources << /Font << /F1 5 0 R >> >> " + "/Contents 4 0 R >>", + f"<< /Length {len(content)} >>\nstream\n{content}\nendstream", + "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>"] + out, offsets = b"%PDF-1.4\n%" + salt.encode() + b"\n", [] + for i, o in enumerate(objs, 1): + offsets.append(len(out)) + out += f"{i} 0 obj\n{o}\nendobj\n".encode() + xref = len(out) + out += f"xref\n0 {len(objs) + 1}\n0000000000 65535 f \n".encode() + out += b"".join(f"{o:010d} 00000 n \n".encode() for o in offsets) + out += f"trailer\n<< /Size {len(objs) + 1} /Root 1 0 R >>\nstartxref\n{xref}\n%%EOF\n".encode() + return out + + +class FDA: + """The simulated accessdata.fda.gov: serves `pdf`, or `status`, or raises a connection error.""" + + def __init__(self): + self.pdf, self.status, self.down, self.requests = make_pdf(V1), 200, False, 0 + + def handler(self, request: httpx.Request) -> httpx.Response: + self.requests += 1 + if self.down: + raise httpx.ConnectError("connection refused", request=request) + if request.url.path != URL_PATH or self.status == 404: + return httpx.Response(404) + if self.status != 200: + return httpx.Response(self.status) + return httpx.Response(200, content=self.pdf) + + +@pytest.fixture +def fda(tmp_path, monkeypatch): + raw, live = tmp_path / "raw" / "summaries", tmp_path / "live" / "summaries" + monkeypatch.setattr(summaries, "SUMMARY_CACHE", raw) + monkeypatch.setattr(summaries, "LIVE_SUMMARY_CACHE", live) + monkeypatch.setitem(summaries.CACHE_MODE, "mode", "raw") + server = FDA() + real_client = httpx.Client + monkeypatch.setattr(summaries.httpx, "Client", + lambda **kw: real_client(transport=httpx.MockTransport(server.handler), **kw)) + monkeypatch.setattr(ingest.openfda, "clearances_by_k", + lambda ks, use_cache=True: [m for m in META if m["k_number"] in ks]) + monkeypatch.setattr(ingest, "fetch_recalls_for", lambda ks, use_cache=True: []) + # the committed cache: written once in raw mode (as scripts/fetch_data.py does), then the app runs in live mode + assert summaries.fetch(K)["status"] == "ok" + monkeypatch.setitem(summaries.CACHE_MODE, "mode", "live") + server.raw_file, server.live_file = raw / f"{K}.json", live / f"{K}.json" + server.raw_bytes = server.raw_file.read_bytes() + return server + + +def _edges(g): + return {c["dst"]: c for c in g.direct_citations(K)} + + +def _hop(g, dst): + return next(h for h in g.lineage_edges_from([K]) if h["dst"] == dst) + + +# ---------------------------------------------------------------- refresh path +def test_plain_reingest_reuses_the_cache_and_cannot_see_a_changed_pdf(tiny, fda): + ingest.add_clearance(tiny, K) + n = fda.requests + fda.pdf = make_pdf(V2) # FDA replaced the document + res = ingest.add_clearance(tiny, K) + assert fda.requests == n and res["refresh"] is None # no download: the cached text was reused + assert _edges(tiny)["K000003"]["retired_at"] is None + + +def test_refresh_detects_a_changed_pdf_and_never_touches_the_committed_cache(tiny, fda): + ingest.add_clearance(tiny, K) + old_sha = _edges(tiny)["K000009"]["source_sha256"] + fda.pdf = make_pdf(V2) + res = ingest.add_clearance(tiny, K, refresh=True) + assert res["refresh"]["changed"] is True and res["refresh"]["previous_sha256"] == old_sha + assert res["summary_sha256"] != old_sha + assert [r["dst"] for r in res["reconciliation"]["retired"]] == ["K000003"] + assert fda.raw_file.read_bytes() == fda.raw_bytes # data/raw is never rewritten by the app + assert summaries.load(K)["sha256"] == res["summary_sha256"] # the live record now supersedes it + assert _edges(tiny)["K000009"]["source_sha256"] == res["summary_sha256"] + n = fda.requests + ingest.add_clearance(tiny, K) # a later plain ingest reads the refreshed text + assert fda.requests == n and _edges(tiny)["K000003"]["retired_at"] is not None + + +def test_refresh_of_an_unchanged_pdf_changes_nothing(tiny, fda): + ingest.add_clearance(tiny, K) + stats = tiny.stats() + res = ingest.add_clearance(tiny, K, refresh=True) + assert res["refresh"]["changed"] is False and res["reconciliation"]["retired"] == [] + assert tiny.stats() == stats and not fda.live_file.exists() + + +@pytest.mark.parametrize("failure", ["down", 503, 404, "image_only"]) +def test_failed_or_unreadable_refresh_changes_neither_cache_nor_graph(tiny, fda, failure): + ingest.add_clearance(tiny, K) + tiny.review_citation(K, "K000003", "confirmed", "checked p.1", reviewer="user") + before_edges, stats = _edges(tiny), tiny.stats() + if failure == "down": + fda.down = True + elif failure == "image_only": + fda.pdf = make_pdf([]) # a scan: no text layer, new SHA-256 + else: + fda.status = failure + with pytest.raises(ingest.IngestError, match="did not change the graph"): + ingest.add_clearance(tiny, K, refresh=True) + assert tiny.stats() == stats and _edges(tiny) == before_edges + assert not fda.live_file.exists() and fda.raw_file.read_bytes() == fda.raw_bytes + + +def test_refresh_is_refused_outside_live_mode(tiny, fda, monkeypatch): + monkeypatch.setitem(summaries.CACHE_MODE, "mode", "raw") + with pytest.raises(ingest.IngestError, match="live cache only"): + ingest.add_clearance(tiny, K, refresh=True) + assert fda.raw_file.read_bytes() == fda.raw_bytes + + +def test_failed_graph_write_after_a_refresh_rolls_back(tiny, fda, monkeypatch): + ingest.add_clearance(tiny, K) + stats, before = tiny.stats(), _edges(tiny) + fda.pdf = make_pdf(V2) + + def boom(rows): + raise RuntimeError("disk full") + real_upsert = tiny.upsert_recalls + monkeypatch.setattr(tiny, "upsert_recalls", boom) + with pytest.raises(RuntimeError): + ingest.add_clearance(tiny, K, refresh=True) + assert tiny.stats() == stats and _edges(tiny) == before + # the refreshed (readable) text stays cached; retrying the refresh applies it + monkeypatch.setattr(tiny, "upsert_recalls", real_upsert) + res = ingest.add_clearance(tiny, K, refresh=True) + assert res["refresh"]["changed"] is False and [r["dst"] for r in res["reconciliation"]["retired"]] == ["K000003"] + + +# ---------------------------------------------------------------- reviews are bound to the evidence version +def test_a_changed_summary_makes_a_persons_review_outdated(tiny, fda): + ingest.add_clearance(tiny, K) + tiny.review_citation(K, "K000009", "confirmed", "read v1 p.1", reviewer="user") + assert _hop(tiny, "K000009")["reviewed_source_sha256"] == _hop(tiny, "K000009")["source_sha256"] + assert assess(tiny, K)["coverage"]["evidence"] != "uncertain" + + fda.pdf = make_pdf(V2) + ingest.add_clearance(tiny, K, refresh=True) + h = _hop(tiny, "K000009") # still a predicate in v2, so still in lineage ... + assert (h["review"], h["reviewer"], h["review_note"]) == ("confirmed", "user", "read v1 p.1") # history kept + assert h["reviewed_source_sha256"] != h["source_sha256"] + assert "review_outdated" in doubt(h) # ... but no longer person-verified + a = assess(tiny, K) + assert a["coverage"]["evidence"] == "uncertain" # its only direct predicate needs re-review + hop = next(x for x in a["ancestors"] if x["k"] == "K000009")["hops"][0] + assert hop["trust"] == "uncertain" + + tiny.review_citation(K, "K000009", "confirmed", "read v2 p.1", reviewer="user") + assert assess(tiny, K)["coverage"]["evidence"] != "uncertain" + assert next(x for x in assess(tiny, K)["ancestors"] if x["k"] == "K000009")["hops"][0]["trust"] == "human_verified" + + +def test_an_outdated_rejection_does_not_keep_hiding_a_predicate(tiny, fda): + ingest.add_clearance(tiny, K) + tiny.review_citation(K, "K000009", "rejected", "not a predicate in v1", reviewer="user") + assert "K000009" not in {x["k"] for x in tiny.ancestors(K, 1)} + fda.pdf = make_pdf(V2) + ingest.add_clearance(tiny, K, refresh=True) + assert "K000009" in {x["k"] for x in tiny.ancestors(K, 1)} # the new evidence is read again, flagged + assert "review_outdated" in doubt(_hop(tiny, "K000009")) + + +def test_a_restored_citation_does_not_inherit_approval_from_a_different_pdf(tiny, fda): + ingest.add_clearance(tiny, K) + v1_sha = _edges(tiny)["K000003"]["source_sha256"] + tiny.review_citation(K, "K000003", "confirmed", "checked v1", reviewer="user") + fda.pdf = make_pdf(V2) + ingest.add_clearance(tiny, K, refresh=True) # K000003 retired + fda.pdf = make_pdf(V1, salt="reissued") # same words, different document + res = ingest.add_clearance(tiny, K, refresh=True) + assert res["reconciliation"]["restored"] == ["K000003"] + e = _edges(tiny)["K000003"] + assert e["retired_at"] is None and e["source_sha256"] not in (v1_sha, None) + assert (e["review"], e["reviewed_source_sha256"]) == ("confirmed", v1_sha) + assert "review_outdated" in doubt(_hop(tiny, "K000003")) + + +def test_a_citation_restored_from_the_reviewed_pdf_keeps_its_review(tiny, fda): + ingest.add_clearance(tiny, K) + tiny.review_citation(K, "K000003", "confirmed", "checked v1", reviewer="user") + fda.pdf = make_pdf(V2) + ingest.add_clearance(tiny, K, refresh=True) + fda.pdf = make_pdf(V1) # FDA reverted to the exact reviewed bytes + ingest.add_clearance(tiny, K, refresh=True) + h = _hop(tiny, "K000003") + assert h["reviewed_source_sha256"] == h["source_sha256"] and doubt(h) == [] From 66161728a135a1db195d8b5bb80f19b16f1a9807 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 14:11:13 +0100 Subject: [PATCH 08/10] feat: offer a summary refresh on re-ingest and flag reviews made on an earlier PDF --- web/e2e/trusted-lineage.spec.js | 21 +++++++++++++++++++++ web/src/api.js | 2 +- web/src/evidence.js | 11 +++++++++-- web/src/workspace/Provenance.jsx | 4 ++-- web/src/workspace/Views.jsx | 11 ++++++++++- 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/web/e2e/trusted-lineage.spec.js b/web/e2e/trusted-lineage.spec.js index 0a35428..7bc389c 100644 --- a/web/e2e/trusted-lineage.spec.js +++ b/web/e2e/trusted-lineage.spec.js @@ -48,3 +48,24 @@ test('re-ingest lists citations retired by the refreshed summary', async ({ page await expect(page.getByTestId('ingest-retired')).toContainText('K000003 (confirmed by user)') await expect(page.getByTestId('ingest-retired')).toContainText('kept with their reviews and provenance') }) + +test('re-ingest can explicitly refresh the FDA summary and reports a changed PDF', async ({ page }) => { + let body = null + await page.route('**/api/ingest', (route) => { + body = route.request().postDataJSON() + return route.fulfill({ + json: { + k: 'K261000', was_present: true, lineage_was_known: true, summary_status: 'ok', summary_url: null, + summary_sha256: 'bbbbbbbbbbbbbbbb', refresh: { changed: true, previous_sha256: 'aaaaaaaaaaaaaaaa' }, + citations_added: [], citations_unresolved: [], new_devices: [], recalls_linked: [], extraction: {}, + graph_before: {}, graph_after: {}, rels_before: {}, rels_after: {}, + reconciliation: { ran: true, skipped_reason: null, new: [], restored: [], retired: [], retired_with_human_review: [] }, + }, + }) + }) + await page.goto('/#/ingest/K261000') + await page.getByTestId('ingest-refresh').check() + await page.getByRole('button', { name: 'Read and add' }).click() + await expect(page.getByTestId('ingest-refresh-result')).toContainText('aaaaaaaaaaaa → bbbbbbbbbbbb') + expect(body).toEqual({ k: 'K261000', refresh: true }) +}) diff --git a/web/src/api.js b/web/src/api.js index 6cb8f93..d5b18fb 100644 --- a/web/src/api.js +++ b/web/src/api.js @@ -20,7 +20,7 @@ export const api = { compare: (ks) => req('/api/compare', { method: 'POST', body: { ks } }), recallEvent: (e) => req(`/api/recall-event/${e}`), watchlist: () => req('/api/watchlist'), - ingest: (k) => req('/api/ingest', { method: 'POST', body: { k } }), + ingest: (k, refresh = false) => req('/api/ingest', { method: 'POST', body: { k, refresh } }), review: (src, dst, status, note) => req('/api/citation/review', { method: 'POST', body: { src, dst, status, note } }), triage: (src, dst) => req('/api/citation/triage', { method: 'POST', body: { src, dst } }), save: (k, note) => req('/api/assessments', { method: 'POST', body: { k, note } }), diff --git a/web/src/evidence.js b/web/src/evidence.js index 50f046a..72d136d 100644 --- a/web/src/evidence.js +++ b/web/src/evidence.js @@ -33,13 +33,15 @@ export const DOUBT_TEXT = { llm_label_only: 'A predicate only because an LLM labelled the mention', client_confirmation_only: 'Confirmed only through the automated MCP client, not a person', client_rejection_pending: 'Rejected through the automated MCP client; kept until a person decides', + review_outdated: "A person reviewed an earlier version of the FDA summary; it needs re-review", } /** Mirror of lineage.doubt(): why a lineage hop's evidence is doubtful ([] if not). */ export function doubt(h) { if (!h) return [] - if (h.review === 'confirmed' && !MACHINE_REVIEWERS.includes(h.reviewer)) return [] + if (h.review === 'confirmed' && humanReview(h)) return [] const why = [] + if (outdatedReview(h)) why.push('review_outdated') if (h.audit === 'unresolved') why.push('audit_unresolved') if (h.audit === 'corrected') why.push('audit_correction') if (h.name_check === 'mismatch' && !['variant', 'corrected'].includes(h.audit)) why.push('name_mismatch') @@ -51,8 +53,13 @@ export function doubt(h) { return why } -/** A review recorded by a person (not the automated MCP client). Only these change trusted lineage. */ +/** Mirror of graph.CURRENT_HUMAN_REVIEW: a review recorded by a person (not the automated MCP client) on the + evidence version the edge carries now. Only these change trusted lineage. */ export const humanReview = (h) => !!h?.review && !MACHINE_REVIEWERS.includes(h.reviewer) + && (h.reviewed_source_sha256 || '') === (h.source_sha256 || '') + +/** A person's review made on an earlier version of the summary: kept as history, no longer counted. */ +export const outdatedReview = (h) => !!h?.review && !MACHINE_REVIEWERS.includes(h.reviewer) && !humanReview(h) export const EDGE_STATUS = { confirmed: { label: 'Confirmed by a person', short: 'Confirmed' }, diff --git a/web/src/workspace/Provenance.jsx b/web/src/workspace/Provenance.jsx index 6080a2e..d5d692c 100644 --- a/web/src/workspace/Provenance.jsx +++ b/web/src/workspace/Provenance.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef, useState } from 'react' import { api, pmnUrl } from '../api.js' import { - ATTRIBUTION, DOUBT_TEXT, MACHINE_REVIEWERS, PREDATES_CLEARANCE, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, humanReview, pdfAt, recallAttribution, recallTone, shortName, + ATTRIBUTION, DOUBT_TEXT, MACHINE_REVIEWERS, PREDATES_CLEARANCE, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, humanReview, outdatedReview, pdfAt, recallAttribution, recallTone, shortName, } from '../evidence.js' /* Highlight the cited K-number inside the verbatim quote. */ @@ -151,7 +151,7 @@ function EdgeBody({ sel, a, closeBtn, onClose, go, reload, onSelect }) {
FDA panel
{h.panel_check || '—'}
{h.audit && <>
Audit
{h.audit}{h.audit_note ? ` — ${h.audit_note}` : ''}
} {h.ai_label && <>
LLM label
{h.ai_label}{h.ai_model ? ` · ${h.ai_model}` : ''} (advisory; never a verdict input until a person confirms)
} -
Review
{h.review ? `${h.review} by ${h.reviewer || 'unknown'}${MACHINE_REVIEWERS.includes(h.reviewer) ? ' (automated client; advisory)' : ''}` : 'not reviewed by a person'}
+
Review
{h.review ? `${h.review} by ${h.reviewer || 'unknown'}${MACHINE_REVIEWERS.includes(h.reviewer) ? ' (automated client; advisory)' : outdatedReview(h) ? ' on an earlier version of the summary; needs re-review' : ''}` : 'not reviewed by a person'}
Trust
{EDGE_STATUS[edgeStatus(h).key].label}
{h.retired_at && <>
Retired
{fmtDate(h.retired_at)} · no longer cited by the refreshed summary
} {src.summary_sha256 && <>
PDF SHA-256
{src.summary_sha256}
} diff --git a/web/src/workspace/Views.jsx b/web/src/workspace/Views.jsx index d9d9c1d..fec7464 100644 --- a/web/src/workspace/Views.jsx +++ b/web/src/workspace/Views.jsx @@ -240,10 +240,11 @@ export function IngestView({ initial, go, onChanged }) { const [busy, setBusy] = useState(false) const [res, setRes] = useState(null) const [err, setErr] = useState(null) + const [refresh, setRefresh] = useState(false) useEffect(() => { if (initial) setK(initial) }, [initial]) const run = async () => { setBusy(true); setErr(null); setRes(null) - try { const r = await api.ingest(k); setRes(r); onChanged && onChanged() } catch (e) { setErr(e.message) } finally { setBusy(false) } + try { const r = await api.ingest(k, refresh); setRes(r); onChanged && onChanged() } catch (e) { setErr(e.message) } finally { setBusy(false) } } const delta = (a, b) => Object.keys({ ...a, ...b }).map((key) => [key, (b[key] || 0) - (a[key] || 0)]).filter(([, d]) => d) return ( @@ -258,6 +259,11 @@ export function IngestView({ initial, go, onChanged }) { setK(e.target.value)} aria-label="K-number to read from FDA" /> + {busy &&
Downloading the summary PDF and extracting citations…
} {err &&

{err}

} @@ -265,6 +271,9 @@ export function IngestView({ initial, go, onChanged }) {

{res.k}: {res.was_present ? (res.lineage_was_known ? 're-read' : 'lineage extended') : 'added to the graph'}

Summary: {res.summary_status}{res.summary_url && <> · PDF ↗}

+ {res.refresh &&

{res.refresh.changed + ? `FDA's PDF changed (sha256 ${String(res.refresh.previous_sha256 || 'none').slice(0, 12)} → ${String(res.summary_sha256).slice(0, 12)}); citations were reconciled against the new text.` + : 'FDA\'s PDF is unchanged since it was cached.'}

}

Graph change: {delta(res.graph_before, res.graph_after).concat(delta(res.rels_before, res.rels_after)) .map(([key, d]) => `${d > 0 ? '+' : ''}${d} ${key}`).join(' · ') || 'no new nodes or relationships (already up to date)'}

Citations read from the summary

From b082d060d07f1f5bbabf8b715410d233ff47a000 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 14:11:13 +0100 Subject: [PATCH 09/10] build: rebuild web/dist for summary refresh and outdated reviews --- ...History-DLMWLVIE.js => History-DPVVy-wq.js} | 2 +- ...Landing-DUH1bgY7.js => Landing-mM6lZWLo.js} | 2 +- web/dist/assets/Views-CntGI8oq.js | 1 - web/dist/assets/Views-Dyqeayth.js | 1 + .../{index-BEiDIW2F.js => index-DD2rN9W6.js} | 18 +++++++++--------- web/dist/index.html | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) rename web/dist/assets/{History-DLMWLVIE.js => History-DPVVy-wq.js} (98%) rename web/dist/assets/{Landing-DUH1bgY7.js => Landing-mM6lZWLo.js} (99%) delete mode 100644 web/dist/assets/Views-CntGI8oq.js create mode 100644 web/dist/assets/Views-Dyqeayth.js rename web/dist/assets/{index-BEiDIW2F.js => index-DD2rN9W6.js} (59%) diff --git a/web/dist/assets/History-DLMWLVIE.js b/web/dist/assets/History-DPVVy-wq.js similarity index 98% rename from web/dist/assets/History-DLMWLVIE.js rename to web/dist/assets/History-DPVVy-wq.js index 33dc68a..50eaad3 100644 --- a/web/dist/assets/History-DLMWLVIE.js +++ b/web/dist/assets/History-DPVVy-wq.js @@ -1 +1 @@ -import{r as i,j as e,V as p,d as b,c as j}from"./index-BEiDIW2F.js";function y({go:a}){const[n,d]=i.useState(null),[t,r]=i.useState(null),[l,h]=i.useState(null),[o,x]=i.useState(null),c=()=>{j.assessments().then(d).catch(s=>x(s.message)),j.investigations(null,50).then(r).catch(()=>r([])),j.proposals("pending_human_decision").then(h).catch(()=>h([]))};return i.useEffect(c,[]),e.jsxs("div",{children:[e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:"Graph"}),e.jsx("h1",{children:"Investigation history"}),e.jsx("p",{children:"Saved assessments and their staleness against today's graph, then optional agent runs and the proposals they left for a person."})]}),o&&e.jsx("p",{className:"err",children:o}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Saved assessments ",e.jsx("span",{className:"count",children:(n==null?void 0:n.length)??"…"})]}),e.jsx("p",{className:"hint",children:"Stale means a citation in the ancestry was reviewed or re-ingested after saving."})]}),n&&n.length===0&&e.jsx("p",{className:"muted",children:"None yet. Save one from any investigation."}),n&&n.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Assessment"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Saved verdict"}),e.jsx("th",{children:"Now"}),e.jsx("th",{children:"Saved"})]})}),e.jsx("tbody",{children:n.map(s=>{var m,u,N,g;return e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>a("check",s.k),onKeyDown:v=>v.key==="Enter"&&a("check",s.k),children:[e.jsx("td",{className:"mono",children:s.id}),e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name})]}),e.jsx("td",{children:e.jsx("span",{className:`chip tone-${((m=p[s.verdict])==null?void 0:m.tone)||"muted"}`,children:((u=p[s.verdict])==null?void 0:u.label)||s.verdict})}),e.jsx("td",{children:s.stale?e.jsxs("span",{className:"stale",children:["Stale",s.verdict_now!==s.verdict?` · now ${((N=p[s.verdict_now])==null?void 0:N.label)||s.verdict_now}`:""]}):e.jsx("span",{className:"ok",children:"Current"})}),e.jsx("td",{className:"sub num",children:(g=s.created_at)==null?void 0:g.slice(0,16).replace("T"," ")})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Agent runs (optional) ",e.jsx("span",{className:"count",children:(t==null?void 0:t.length)??"…"})]})}),e.jsx("p",{className:"lede",children:"Machine findings, verified against tool results but never human-approved. Deterministic assessments remain the authoritative record."}),t&&t.length===0&&e.jsx("p",{className:"muted",children:"No agent runs in this store. They can be started from the command line or the API (see README)."}),t&&t.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Run"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Mode"}),e.jsx("th",{children:"Pending proposals"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.map(s=>{var m;return e.jsxs("tr",{children:[e.jsxs("td",{className:"mono",children:[s.id,e.jsx("div",{className:"sub",children:(m=s.created_at)==null?void 0:m.slice(0,16).replace("T"," ")})]}),e.jsx("td",{children:e.jsx("a",{href:`#/check/${s.target_k}`,className:"k mono",children:s.target_k})}),e.jsxs("td",{children:[e.jsx("span",{className:"chip",children:s.status}),s.stale&&e.jsx("span",{className:"stale",children:" · stale"})]}),e.jsxs("td",{className:"sub",children:[s.mode,s.model_used?` · ${s.model_used}`:""]}),e.jsx("td",{className:"num",children:s.pending_proposals}),e.jsx("td",{children:e.jsx("a",{href:b(s.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Proposals awaiting a person ",e.jsx("span",{className:"count",children:(l==null?void 0:l.length)??"…"})]})}),l&&l.length===0&&e.jsx("p",{className:"muted",children:"None pending."}),l&&l.map(s=>e.jsx(k,{p:s,onDone:c},s.id))]})]})}function k({p:a,onDone:n}){const[d,t]=i.useState(""),[r,l]=i.useState(!1),[h,o]=i.useState(null),x=async c=>{try{await j.decide(a.id,c,d.trim()),o({ok:!0,text:`Recorded: ${c}.`}),n()}catch(s){o({ok:!1,text:s.message})}};return e.jsxs("div",{className:"review-item tone-muted",children:[e.jsxs("h3",{children:[e.jsx("span",{className:"sev sev-info",children:a.kind}),e.jsx("span",{className:"mono",children:a.id}),e.jsx("span",{children:a.k||`${a.src} → ${a.dst}`})]}),a.reason&&e.jsx("p",{className:"muted small",style:{margin:"0 0 8px"},children:a.reason}),e.jsxs("div",{className:"cit-a",children:[e.jsx("input",{className:"field",style:{maxWidth:220},placeholder:"Your name",value:d,onChange:c=>t(c.target.value),"aria-label":"Your name"}),e.jsxs("label",{className:"small",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:c=>l(c.target.checked)})," I am a person deciding this"]}),e.jsx("button",{className:"btn btn-line btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("approve"),children:"Approve"}),e.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("dismiss"),children:"Dismiss"})]}),h&&e.jsx("p",{className:h.ok?"ok":"err",children:h.text})]})}export{y as default}; +import{r as i,j as e,V as p,d as b,c as j}from"./index-DD2rN9W6.js";function y({go:a}){const[n,d]=i.useState(null),[t,r]=i.useState(null),[l,h]=i.useState(null),[o,x]=i.useState(null),c=()=>{j.assessments().then(d).catch(s=>x(s.message)),j.investigations(null,50).then(r).catch(()=>r([])),j.proposals("pending_human_decision").then(h).catch(()=>h([]))};return i.useEffect(c,[]),e.jsxs("div",{children:[e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:"Graph"}),e.jsx("h1",{children:"Investigation history"}),e.jsx("p",{children:"Saved assessments and their staleness against today's graph, then optional agent runs and the proposals they left for a person."})]}),o&&e.jsx("p",{className:"err",children:o}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Saved assessments ",e.jsx("span",{className:"count",children:(n==null?void 0:n.length)??"…"})]}),e.jsx("p",{className:"hint",children:"Stale means a citation in the ancestry was reviewed or re-ingested after saving."})]}),n&&n.length===0&&e.jsx("p",{className:"muted",children:"None yet. Save one from any investigation."}),n&&n.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Assessment"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Saved verdict"}),e.jsx("th",{children:"Now"}),e.jsx("th",{children:"Saved"})]})}),e.jsx("tbody",{children:n.map(s=>{var m,u,N,g;return e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>a("check",s.k),onKeyDown:v=>v.key==="Enter"&&a("check",s.k),children:[e.jsx("td",{className:"mono",children:s.id}),e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name})]}),e.jsx("td",{children:e.jsx("span",{className:`chip tone-${((m=p[s.verdict])==null?void 0:m.tone)||"muted"}`,children:((u=p[s.verdict])==null?void 0:u.label)||s.verdict})}),e.jsx("td",{children:s.stale?e.jsxs("span",{className:"stale",children:["Stale",s.verdict_now!==s.verdict?` · now ${((N=p[s.verdict_now])==null?void 0:N.label)||s.verdict_now}`:""]}):e.jsx("span",{className:"ok",children:"Current"})}),e.jsx("td",{className:"sub num",children:(g=s.created_at)==null?void 0:g.slice(0,16).replace("T"," ")})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Agent runs (optional) ",e.jsx("span",{className:"count",children:(t==null?void 0:t.length)??"…"})]})}),e.jsx("p",{className:"lede",children:"Machine findings, verified against tool results but never human-approved. Deterministic assessments remain the authoritative record."}),t&&t.length===0&&e.jsx("p",{className:"muted",children:"No agent runs in this store. They can be started from the command line or the API (see README)."}),t&&t.length>0&&e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Run"}),e.jsx("th",{children:"Target"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Mode"}),e.jsx("th",{children:"Pending proposals"}),e.jsx("th",{})]})}),e.jsx("tbody",{children:t.map(s=>{var m;return e.jsxs("tr",{children:[e.jsxs("td",{className:"mono",children:[s.id,e.jsx("div",{className:"sub",children:(m=s.created_at)==null?void 0:m.slice(0,16).replace("T"," ")})]}),e.jsx("td",{children:e.jsx("a",{href:`#/check/${s.target_k}`,className:"k mono",children:s.target_k})}),e.jsxs("td",{children:[e.jsx("span",{className:"chip",children:s.status}),s.stale&&e.jsx("span",{className:"stale",children:" · stale"})]}),e.jsxs("td",{className:"sub",children:[s.mode,s.model_used?` · ${s.model_used}`:""]}),e.jsx("td",{className:"num",children:s.pending_proposals}),e.jsx("td",{children:e.jsx("a",{href:b(s.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})})]},s.id)})})]})})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:["Proposals awaiting a person ",e.jsx("span",{className:"count",children:(l==null?void 0:l.length)??"…"})]})}),l&&l.length===0&&e.jsx("p",{className:"muted",children:"None pending."}),l&&l.map(s=>e.jsx(k,{p:s,onDone:c},s.id))]})]})}function k({p:a,onDone:n}){const[d,t]=i.useState(""),[r,l]=i.useState(!1),[h,o]=i.useState(null),x=async c=>{try{await j.decide(a.id,c,d.trim()),o({ok:!0,text:`Recorded: ${c}.`}),n()}catch(s){o({ok:!1,text:s.message})}};return e.jsxs("div",{className:"review-item tone-muted",children:[e.jsxs("h3",{children:[e.jsx("span",{className:"sev sev-info",children:a.kind}),e.jsx("span",{className:"mono",children:a.id}),e.jsx("span",{children:a.k||`${a.src} → ${a.dst}`})]}),a.reason&&e.jsx("p",{className:"muted small",style:{margin:"0 0 8px"},children:a.reason}),e.jsxs("div",{className:"cit-a",children:[e.jsx("input",{className:"field",style:{maxWidth:220},placeholder:"Your name",value:d,onChange:c=>t(c.target.value),"aria-label":"Your name"}),e.jsxs("label",{className:"small",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:c=>l(c.target.checked)})," I am a person deciding this"]}),e.jsx("button",{className:"btn btn-line btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("approve"),children:"Approve"}),e.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!r||d.trim().length<2,onClick:()=>x("dismiss"),children:"Dismiss"})]}),h&&e.jsx("p",{className:h.ok?"ok":"err",children:h.text})]})}export{y as default}; diff --git a/web/dist/assets/Landing-DUH1bgY7.js b/web/dist/assets/Landing-mM6lZWLo.js similarity index 99% rename from web/dist/assets/Landing-DUH1bgY7.js rename to web/dist/assets/Landing-mM6lZWLo.js index 8168477..da7f4a5 100644 --- a/web/dist/assets/Landing-DUH1bgY7.js +++ b/web/dist/assets/Landing-mM6lZWLo.js @@ -1 +1 @@ -import{r as h,m as $,j as e,W as M,f as k,p as q,R as L,M as B,_ as K}from"./index-BEiDIW2F.js";import{u as se}from"./index-BEiDIW2F.js";const T="Every claim the opening film makes. tests/test_story_facts.py checks each value against the shipped Relate store.",O={k:"K252078",name:"BreathePal Bilevel",applicant:"Compal Electronics, Inc.",decision_date:"2026-03-17",summary_url:"https://www.accessdata.fda.gov/cdrh_docs/pdf25/K252078.pdf",verdict:"REVIEW_LINEAGE"},W={src:"K252078",dst:"K113053",page:6,quote:"substantially equivalent to the legally marketed predicate device, BiPAP A30 Ventilatory support system (K113053)."},V={k:"K113053",name:"BiPAP A30 Ventilatory Support System",applicant:"Respironics, Inc.",decision_date:"2012-02-01"},z={holder:"K113053",event:"88071",ids:["Z-1957-2021","Z-1958-2021"],classification:"Class I",root_cause:"Device Design",initiated:"2021-06-14",reason:"The polyester-based polyurethane (PE-PUR) foam may degrade into particles"},Z=[{k:"K092818",name:"BiPAP AVAPS",decision_date:"2010-01-22"},{k:"K082660",name:"V60 Ventilator",decision_date:"2009-01-09"},{k:"K103167",name:"Stellar 150",decision_date:"2011-03-01"}],g={_note:T,candidate:O,citation:W,predicate:V,recall:z,grand_predicates:Z},E=(()=>{let s=0;const a=new Set;return{set(t){t!==s&&(s=t,a.forEach(n=>n()))},get:()=>s,subscribe(t){return a.add(t),()=>a.delete(t)}}})(),D=()=>h.useSyncExternalStore(E.subscribe,E.get);function P(){const s=h.useRef(null);return h.useEffect(()=>{const a=s.current;if(!a||typeof IntersectionObserver>"u"){a==null||a.classList.add("in-frame");return}const t=new IntersectionObserver(([n])=>a.classList.toggle("in-frame",n.isIntersecting),{rootMargin:"-12% 0px -12% 0px"});return t.observe(a),()=>t.disconnect()},[]),s}function F(){const s=innerHeight;return[...document.querySelectorAll("[data-scene]")].map(a=>{const t=a.getBoundingClientRect(),n=t.top+scrollY,c=innerWidth<=860,l=a.dataset.align==="top"?0:c&&a.classList.contains("chapter-copy")?n-s*.55:n+t.height/2-s*.5;return[Math.max(0,l),Number(a.dataset.scene)]}).sort((a,t)=>a[1]-t[1]).map((a,t,n)=>t&&a[0]<=n[t-1][0]?[n[t-1][0]+1,a[1]]:a)}function H(){try{return!!document.createElement("canvas").getContext("2d")}catch{return!1}}function I(){const s=innerWidth,a=innerHeight,t=48,n=Math.max(24,s*.03),c={},l=document.querySelector(".hero-copy");if(l){const r=l.getBoundingClientRect();c[0]=[Math.min(s*.62,r.right+t),a*.18,s-n-40,a*.82]}document.querySelectorAll(".chapter-copy[data-scene]").forEach(r=>{const m=r.getBoundingClientRect(),i=Number(r.dataset.scene),d=m.left+m.width/2{if(s||!H()){document.documentElement.dataset.film="off";return}let d=!1;const x=matchMedia("(max-width: 860px), (pointer: coarse)").matches,f=/[?&]gl=1\b/.test(location.search);return K(async()=>{const{createFilm:j}=await import("./renderer-DE7JEwcd.js");return{createFilm:j}},[]).then(({createFilm:j})=>{var y;if(!(d||!l.current))try{r.current=j(l.current,{glCanvas:o.current,facts:g,deviceCount:((y=t==null?void 0:t.nodes)==null?void 0:y.Device)||1187,compact:x,forceGL:f,onScene:n,onRenderer:p=>{i(p),c&&c(p)}}),r.current.setAnchors(F()),r.current.setZones(I()),r.current.snap(),delete document.documentElement.dataset.film,i(r.current.kind),c&&c(r.current.kind)}catch{document.documentElement.dataset.film="off"}}).catch(()=>{document.documentElement.dataset.film="off"}),()=>{var j;d=!0,(j=r.current)==null||j.dispose(),r.current=null}},[s]),h.useEffect(()=>{var y;if(!m)return;const d=()=>{var p,v;(p=r.current)==null||p.setAnchors(F()),(v=r.current)==null||v.setZones(I())},x=new ResizeObserver(()=>{var p;(p=r.current)==null||p.resize(),d()});x.observe(document.body),(y=document.fonts)==null||y.ready.then(d);const f=p=>{var v;return(v=r.current)==null?void 0:v.setPointer(p.clientX,p.clientY,!0)},j=()=>{var p;return(p=r.current)==null?void 0:p.setPointer(-9999,-9999,!1)};return addEventListener("pointermove",f,{passive:!0}),document.addEventListener("pointerleave",j),()=>{x.disconnect(),removeEventListener("pointermove",f),document.removeEventListener("pointerleave",j)}},[!!m]),h.useEffect(()=>{var d;m&&a==="bloom"&&((d=r.current)==null||d.bloom())},[!!m,a]),e.jsxs("div",{className:"film-stage","aria-hidden":"true",children:[e.jsx("div",{className:"film-fallback",children:e.jsxs("svg",{viewBox:"0 0 560 320",children:[e.jsx("path",{d:"M520 60 C 380 60, 380 160, 240 160",stroke:"#7fa2ff",strokeWidth:"1.6",fill:"none"}),e.jsx("path",{d:"M240 160 C 160 160, 160 80, 80 80 M240 160 C 160 160, 160 250, 70 250",stroke:"#7fa2ff",strokeOpacity:".4",fill:"none"}),e.jsx("path",{d:"M240 160 L 420 160",stroke:"#e7a948",strokeDasharray:"2 4"}),e.jsx("path",{d:"M420 152 l8 8 -8 8 -8 -8z",fill:"#e7a948"}),e.jsx("circle",{cx:"520",cy:"60",r:"9",fill:"#f1ebdd",stroke:"#7fa2ff",strokeWidth:"3"}),e.jsx("circle",{cx:"240",cy:"160",r:"7",fill:"#e7a948"}),e.jsx("circle",{cx:"80",cy:"80",r:"6",fill:"#e7a948"}),e.jsx("circle",{cx:"70",cy:"250",r:"6",fill:"#9aa7c2"})]})}),e.jsx("canvas",{ref:o,className:"film-gl"+(m==="webgl"?" is-live":"")}),e.jsx("div",{className:"film-grid"}),e.jsx("canvas",{ref:l,className:"film-story"+(m?" is-live":""),"data-testid":"film-canvas","data-renderer":m||"fallback"}),e.jsx("div",{className:"film-vignette"})]})}const C=[{n:"00",name:"The field",read:s=>`${s.k} · one point among the store's clearances`},{n:"01",name:"The filing",read:(s,a)=>`${s.k} · 510(k) summary · page ${a.page}`},{n:"02",name:"The connection",read:(s,a,t)=>`${s.k} → ${t.k} · ${s.decision_date.slice(0,4)} → ${t.decision_date.slice(0,4)}`},{n:"03",name:"The discovery",read:(s,a,t,n)=>`${t.k} · ${n.classification} · ${n.root_cause} · ${n.initiated}`},{n:"04",name:"The handoff",read:()=>"generation columns · same layout as the workspace"}];function G(){const s=D(),[a,t]=h.useState(!1);h.useEffect(()=>{const c=document.querySelector(".paths");if(!c||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([o])=>t(o.isIntersecting||o.boundingClientRect.top<0));return l.observe(c),()=>l.disconnect()},[]);const n=C[s]||C[0];return e.jsxs("div",{className:"film-hud"+(a?" is-away":""),"aria-hidden":"true",children:[e.jsxs("span",{className:"hud-n",children:["[",n.n," / 04]"]}),e.jsx("span",{className:"hud-name",children:n.name}),e.jsx("span",{className:"hud-read",children:n.read(g.candidate,g.citation,g.predicate,g.recall)})]})}function N({v:s}){const[a,t]=h.useState(0);return h.useEffect(()=>{if(s==null)return;if(matchMedia("(prefers-reduced-motion: reduce)").matches){t(s);return}let n,c;const l=o=>{c??(c=o);const r=Math.min(1,(o-c)/1100);t(Math.round(s*(1-Math.pow(1-r,3)))),r<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]),s==null?null:e.jsx("b",{children:a.toLocaleString("en-US")})}function U({reduced:s}){const a=D();return e.jsx("nav",{className:"film-index","aria-label":"Film chapters",children:X.map(([t,n],c)=>e.jsxs("a",{href:`#${t}`,className:a===c?"on":"","aria-current":a===c?"step":void 0,onClick:l=>{var o;l.preventDefault(),(o=document.getElementById(t==="top"?"top":`${t}-copy`))==null||o.scrollIntoView({block:"center",behavior:s?"auto":"smooth"})},children:[e.jsx("span",{children:n}),e.jsx("i",{})]},t))})}const _=({children:s})=>e.jsx("span",{className:"ln",children:e.jsx("span",{children:s})});function w({id:s,scene:a,mark:t,label:n,place:c,statement:l,children:o,foot:r}){const m=P();return e.jsx("article",{id:s,className:`chapter place-${c}`,"aria-labelledby":`${s}-title`,children:e.jsxs("div",{ref:m,className:"chapter-copy reveal","data-scene":a,id:`${s}-copy`,children:[e.jsxs("p",{className:"chapter-label",children:[e.jsxs("span",{children:[t," / 03"]}),n]}),e.jsx("h2",{className:"chapter-statement",id:`${s}-title`,children:l.map((i,d)=>e.jsxs(_,{children:[i," "]},d))}),o,r&&e.jsx("p",{className:"chapter-foot",children:r})]})})}const X=[["top","Opening"],["the-filing","The filing"],["the-connection","The connection"],["the-discovery","The discovery"],["handoff","Investigate"]];function Q({go:s,stats:a,introDone:t,reduced:n}){var A,S,R;const[c,l]=h.useState(!1),[o,r]=h.useState(null),m=P();h.useEffect(()=>{const u=()=>l(scrollY>40);return u(),addEventListener("scroll",u,{passive:!0}),()=>removeEventListener("scroll",u)},[]);const i=g.candidate,d=g.predicate,x=g.recall,f=g.citation,j=$(x.initiated,i.decision_date),y=Math.floor(j/12),p=j%12,v=f.quote.split(f.dst);return e.jsxs("div",{className:"film",id:"top",children:[e.jsx(Y,{reduced:n,introDone:t,stats:a,onScene:E.set,onKind:r}),o&&e.jsx(G,{}),e.jsxs("header",{className:"film-top"+(c?" is-solid":""),children:[e.jsx("a",{href:"#/","aria-label":"Forebear, start of film",onClick:u=>{u.preventDefault(),scrollTo({top:0})},children:e.jsx(M,{size:26})}),e.jsx("span",{className:"spacer"}),e.jsxs("nav",{"aria-label":"Product",children:[e.jsx("a",{href:"#/check",children:"Investigate"}),e.jsx("a",{href:"#/reach/88058,88071",children:"Recall reach"}),e.jsx("a",{href:"#/watch",children:"Watchlist"}),e.jsx("a",{href:"#/method",children:"Method"})]}),e.jsxs("a",{className:"btn btn-primary btn-sm",href:"#/check","data-testid":"open-workspace",children:["Open workspace ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]})]}),e.jsx(U,{reduced:n}),e.jsxs("main",{id:"main",children:[e.jsx("section",{className:"hero","data-scene":"0","data-align":"top","aria-labelledby":"hero-title",children:e.jsxs("div",{className:"hero-copy",children:[e.jsx("p",{className:"eyebrow",children:"510(k) predicate due diligence"}),e.jsxs("h1",{id:"hero-title",tabIndex:-1,style:{outline:"none"},children:["Every clearance has ",e.jsx("em",{children:"a past."})]}),e.jsxs("p",{className:"hero-lede",children:["Forebear reads the predicates out of FDA 510(k) summaries, stores the family tree in a ",e.jsx("b",{children:"Relate graph"})," joined to FDA recall records, and shows in one query whether a predicate, or any of its ancestors, was recalled for a design problem, as far back as their summaries can be read: ",e.jsx("b",{children:"with the page and quote behind every link."})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"hero-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Investigate ",i.k," ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsxs("a",{className:"btn btn-line",href:"#the-filing-copy",onClick:u=>{var b;u.preventDefault(),(b=document.getElementById("the-filing-copy"))==null||b.scrollIntoView({block:"center",behavior:n?"auto":"smooth"})},children:["Follow one thread ",e.jsx("span",{"aria-hidden":"true",children:"↓"})]})]}),a&&e.jsxs("div",{className:"hero-proof","aria-label":"What is in the shipped graph",children:[e.jsxs("div",{children:[e.jsx(N,{v:(A=a.nodes)==null?void 0:A.Device}),e.jsx("span",{children:"clearances in the graph"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(S=a.citations_by_kind)==null?void 0:S.predicate}),e.jsx("span",{children:"predicate links, each with a page"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(R=a.nodes)==null?void 0:R.Recall}),e.jsx("span",{children:"FDA recall records joined"})]})]})]})}),e.jsxs(w,{id:"the-filing",scene:1,mark:"01",label:"The filing",place:"left",statement:["One document","tells one step."],foot:"A 510(k) summary names its predicate. It does not tell you what became of it.",children:[e.jsxs("p",{className:"chapter-body",children:[i.name," (",e.jsx("span",{className:"k",children:i.k}),") was cleared on ",k(i.decision_date),". Its 510(k) summary names a single predicate, on page ",f.page,":"]}),e.jsxs("figure",{className:"doc","aria-label":`Quote from page ${f.page} of the ${i.k} summary`,children:[e.jsxs("div",{className:"doc-meta",children:[e.jsxs("span",{children:[i.k," · 510(k) summary"]}),e.jsxs("span",{children:["page ",f.page]})]}),e.jsxs("blockquote",{style:{margin:0},children:["“…",v[0],e.jsx("mark",{children:f.dst}),v[1],"”"]}),e.jsx("div",{style:{marginTop:10},children:e.jsxs("a",{href:q(i.summary_url,f.page),target:"_blank",rel:"noreferrer",children:["Open the FDA PDF at page ",f.page," ↗"]})})]})]}),e.jsx(w,{id:"the-connection",scene:2,mark:"02",label:"The connection",place:"right",statement:["Follow the thread","back in time."],foot:"Each thread is an edge in the graph, stored with its page, quote and source PDF.",children:e.jsxs("p",{className:"chapter-body",children:[e.jsx("span",{className:"k",children:i.k})," → ",e.jsx("span",{className:"k",children:d.k}),": the ",e.jsx("b",{children:d.name}),", cleared to ",d.applicant," on ",k(d.decision_date),". And ",d.k," cites predicates of its own: ",g.grand_predicates.map((u,b)=>e.jsxs(L.Fragment,{children:[b?b===g.grand_predicates.length-1?" and ":", ":"",e.jsx("span",{className:"k",children:u.k})]},u.k)),". FDA's databases answer one hop at a time. Relate walks them all in one variable-length query."]})}),e.jsxs(w,{id:"the-discovery",scene:3,mark:"03",label:"The discovery",place:"left",statement:["FDA recalls name",e.jsx("em",{children:"the predicate."},"e")],foot:"A recall on a predicate is not a finding about the new device. It is a question the predicate rationale should answer.",children:[e.jsxs("p",{className:"chapter-body",children:["On ",k(x.initiated)," a ",e.jsx("b",{children:x.classification})," recall of the BiPAP A30 began, root cause ",e.jsx("b",{children:x.root_cause}),": “",x.reason,"…” (event ",x.event,", records ",x.ids.join(" and "),")."]}),e.jsxs("div",{className:"fact-row",children:[e.jsxs("div",{className:"fact amber",children:[e.jsxs("b",{children:[y," yr ",p," mo"]}),e.jsxs("span",{children:["between recall start and ",i.k,"'s clearance"]})]}),e.jsxs("div",{className:"fact",children:[e.jsx("b",{children:"Review lineage"}),e.jsxs("span",{children:["deterministic verdict for ",i.k]})]})]}),e.jsx("p",{className:"chapter-body",style:{fontSize:14},children:"FDA's 2023 draft guidance recommends predicates not subject to design-related recalls."})]}),e.jsx("section",{id:"handoff",className:"handoff","aria-labelledby":"handoff-title",children:e.jsxs("div",{ref:m,className:"reveal","data-scene":"4",id:"handoff-copy",children:[e.jsxs("p",{className:"lead",id:"handoff-title",children:[e.jsx(_,{children:"Every fact above is real evidence."}),e.jsx(_,{children:e.jsx("em",{children:"Now work with it."})})]}),e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"handoff-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Open the investigation ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsx("p",{className:"sub",children:"Every node, date and quote above is read from the shipped Relate store; the background field is illustrative."})]})}),e.jsxs("section",{className:"paths","aria-labelledby":"paths-title",children:[e.jsx("h2",{id:"paths-title",children:"Or start somewhere else"}),e.jsxs("div",{className:"path-grid",children:[e.jsxs("a",{className:"path-card",href:"#/reach/88058,88071",children:[e.jsx("span",{className:"k",children:"Recall 88058 + 88071"}),e.jsx("h3",{children:"Recall reach"}),e.jsx("p",{children:"From the June 2021 Philips foam recall: which later clearances descend from it?"})]}),e.jsxs("a",{className:"path-card",href:"#/watch",children:[e.jsx("span",{className:"k",children:"Watchlist"}),e.jsx("h3",{children:"Cited after a recall"}),e.jsx("p",{children:"Clearances whose predicate was already under a design-related recall."})]}),e.jsxs("a",{className:"path-card",href:"#/compare/K200480 K113053 K233643 K143677",children:[e.jsx("span",{className:"k",children:"Compare"}),e.jsx("h3",{children:"Choose a predicate"}),e.jsx("p",{children:"Candidate predicates side by side, with their own and inherited recalls."})]}),e.jsxs("a",{className:"path-card",href:"#/check/K251770",children:[e.jsx("span",{className:"k",children:"K251770"}),e.jsx("h3",{children:"SleepRes PAP System"}),e.jsx("p",{children:"Another 2025 clearance, another lineage."})]})]})]})]}),e.jsxs("footer",{className:"film-foot",children:[e.jsx("p",{children:"Public FDA data: openFDA 510(k), recall and enforcement records and 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."}),e.jsx(B,{size:18})]})]})}export{Q as default,se as useMedia}; +import{r as h,m as $,j as e,W as M,f as k,p as q,R as L,M as B,_ as K}from"./index-DD2rN9W6.js";import{u as se}from"./index-DD2rN9W6.js";const T="Every claim the opening film makes. tests/test_story_facts.py checks each value against the shipped Relate store.",O={k:"K252078",name:"BreathePal Bilevel",applicant:"Compal Electronics, Inc.",decision_date:"2026-03-17",summary_url:"https://www.accessdata.fda.gov/cdrh_docs/pdf25/K252078.pdf",verdict:"REVIEW_LINEAGE"},W={src:"K252078",dst:"K113053",page:6,quote:"substantially equivalent to the legally marketed predicate device, BiPAP A30 Ventilatory support system (K113053)."},V={k:"K113053",name:"BiPAP A30 Ventilatory Support System",applicant:"Respironics, Inc.",decision_date:"2012-02-01"},z={holder:"K113053",event:"88071",ids:["Z-1957-2021","Z-1958-2021"],classification:"Class I",root_cause:"Device Design",initiated:"2021-06-14",reason:"The polyester-based polyurethane (PE-PUR) foam may degrade into particles"},Z=[{k:"K092818",name:"BiPAP AVAPS",decision_date:"2010-01-22"},{k:"K082660",name:"V60 Ventilator",decision_date:"2009-01-09"},{k:"K103167",name:"Stellar 150",decision_date:"2011-03-01"}],g={_note:T,candidate:O,citation:W,predicate:V,recall:z,grand_predicates:Z},E=(()=>{let s=0;const a=new Set;return{set(t){t!==s&&(s=t,a.forEach(n=>n()))},get:()=>s,subscribe(t){return a.add(t),()=>a.delete(t)}}})(),D=()=>h.useSyncExternalStore(E.subscribe,E.get);function P(){const s=h.useRef(null);return h.useEffect(()=>{const a=s.current;if(!a||typeof IntersectionObserver>"u"){a==null||a.classList.add("in-frame");return}const t=new IntersectionObserver(([n])=>a.classList.toggle("in-frame",n.isIntersecting),{rootMargin:"-12% 0px -12% 0px"});return t.observe(a),()=>t.disconnect()},[]),s}function F(){const s=innerHeight;return[...document.querySelectorAll("[data-scene]")].map(a=>{const t=a.getBoundingClientRect(),n=t.top+scrollY,c=innerWidth<=860,l=a.dataset.align==="top"?0:c&&a.classList.contains("chapter-copy")?n-s*.55:n+t.height/2-s*.5;return[Math.max(0,l),Number(a.dataset.scene)]}).sort((a,t)=>a[1]-t[1]).map((a,t,n)=>t&&a[0]<=n[t-1][0]?[n[t-1][0]+1,a[1]]:a)}function H(){try{return!!document.createElement("canvas").getContext("2d")}catch{return!1}}function I(){const s=innerWidth,a=innerHeight,t=48,n=Math.max(24,s*.03),c={},l=document.querySelector(".hero-copy");if(l){const r=l.getBoundingClientRect();c[0]=[Math.min(s*.62,r.right+t),a*.18,s-n-40,a*.82]}document.querySelectorAll(".chapter-copy[data-scene]").forEach(r=>{const m=r.getBoundingClientRect(),i=Number(r.dataset.scene),d=m.left+m.width/2{if(s||!H()){document.documentElement.dataset.film="off";return}let d=!1;const x=matchMedia("(max-width: 860px), (pointer: coarse)").matches,f=/[?&]gl=1\b/.test(location.search);return K(async()=>{const{createFilm:j}=await import("./renderer-DE7JEwcd.js");return{createFilm:j}},[]).then(({createFilm:j})=>{var y;if(!(d||!l.current))try{r.current=j(l.current,{glCanvas:o.current,facts:g,deviceCount:((y=t==null?void 0:t.nodes)==null?void 0:y.Device)||1187,compact:x,forceGL:f,onScene:n,onRenderer:p=>{i(p),c&&c(p)}}),r.current.setAnchors(F()),r.current.setZones(I()),r.current.snap(),delete document.documentElement.dataset.film,i(r.current.kind),c&&c(r.current.kind)}catch{document.documentElement.dataset.film="off"}}).catch(()=>{document.documentElement.dataset.film="off"}),()=>{var j;d=!0,(j=r.current)==null||j.dispose(),r.current=null}},[s]),h.useEffect(()=>{var y;if(!m)return;const d=()=>{var p,v;(p=r.current)==null||p.setAnchors(F()),(v=r.current)==null||v.setZones(I())},x=new ResizeObserver(()=>{var p;(p=r.current)==null||p.resize(),d()});x.observe(document.body),(y=document.fonts)==null||y.ready.then(d);const f=p=>{var v;return(v=r.current)==null?void 0:v.setPointer(p.clientX,p.clientY,!0)},j=()=>{var p;return(p=r.current)==null?void 0:p.setPointer(-9999,-9999,!1)};return addEventListener("pointermove",f,{passive:!0}),document.addEventListener("pointerleave",j),()=>{x.disconnect(),removeEventListener("pointermove",f),document.removeEventListener("pointerleave",j)}},[!!m]),h.useEffect(()=>{var d;m&&a==="bloom"&&((d=r.current)==null||d.bloom())},[!!m,a]),e.jsxs("div",{className:"film-stage","aria-hidden":"true",children:[e.jsx("div",{className:"film-fallback",children:e.jsxs("svg",{viewBox:"0 0 560 320",children:[e.jsx("path",{d:"M520 60 C 380 60, 380 160, 240 160",stroke:"#7fa2ff",strokeWidth:"1.6",fill:"none"}),e.jsx("path",{d:"M240 160 C 160 160, 160 80, 80 80 M240 160 C 160 160, 160 250, 70 250",stroke:"#7fa2ff",strokeOpacity:".4",fill:"none"}),e.jsx("path",{d:"M240 160 L 420 160",stroke:"#e7a948",strokeDasharray:"2 4"}),e.jsx("path",{d:"M420 152 l8 8 -8 8 -8 -8z",fill:"#e7a948"}),e.jsx("circle",{cx:"520",cy:"60",r:"9",fill:"#f1ebdd",stroke:"#7fa2ff",strokeWidth:"3"}),e.jsx("circle",{cx:"240",cy:"160",r:"7",fill:"#e7a948"}),e.jsx("circle",{cx:"80",cy:"80",r:"6",fill:"#e7a948"}),e.jsx("circle",{cx:"70",cy:"250",r:"6",fill:"#9aa7c2"})]})}),e.jsx("canvas",{ref:o,className:"film-gl"+(m==="webgl"?" is-live":"")}),e.jsx("div",{className:"film-grid"}),e.jsx("canvas",{ref:l,className:"film-story"+(m?" is-live":""),"data-testid":"film-canvas","data-renderer":m||"fallback"}),e.jsx("div",{className:"film-vignette"})]})}const C=[{n:"00",name:"The field",read:s=>`${s.k} · one point among the store's clearances`},{n:"01",name:"The filing",read:(s,a)=>`${s.k} · 510(k) summary · page ${a.page}`},{n:"02",name:"The connection",read:(s,a,t)=>`${s.k} → ${t.k} · ${s.decision_date.slice(0,4)} → ${t.decision_date.slice(0,4)}`},{n:"03",name:"The discovery",read:(s,a,t,n)=>`${t.k} · ${n.classification} · ${n.root_cause} · ${n.initiated}`},{n:"04",name:"The handoff",read:()=>"generation columns · same layout as the workspace"}];function G(){const s=D(),[a,t]=h.useState(!1);h.useEffect(()=>{const c=document.querySelector(".paths");if(!c||typeof IntersectionObserver>"u")return;const l=new IntersectionObserver(([o])=>t(o.isIntersecting||o.boundingClientRect.top<0));return l.observe(c),()=>l.disconnect()},[]);const n=C[s]||C[0];return e.jsxs("div",{className:"film-hud"+(a?" is-away":""),"aria-hidden":"true",children:[e.jsxs("span",{className:"hud-n",children:["[",n.n," / 04]"]}),e.jsx("span",{className:"hud-name",children:n.name}),e.jsx("span",{className:"hud-read",children:n.read(g.candidate,g.citation,g.predicate,g.recall)})]})}function N({v:s}){const[a,t]=h.useState(0);return h.useEffect(()=>{if(s==null)return;if(matchMedia("(prefers-reduced-motion: reduce)").matches){t(s);return}let n,c;const l=o=>{c??(c=o);const r=Math.min(1,(o-c)/1100);t(Math.round(s*(1-Math.pow(1-r,3)))),r<1&&(n=requestAnimationFrame(l))};return n=requestAnimationFrame(l),()=>cancelAnimationFrame(n)},[s]),s==null?null:e.jsx("b",{children:a.toLocaleString("en-US")})}function U({reduced:s}){const a=D();return e.jsx("nav",{className:"film-index","aria-label":"Film chapters",children:X.map(([t,n],c)=>e.jsxs("a",{href:`#${t}`,className:a===c?"on":"","aria-current":a===c?"step":void 0,onClick:l=>{var o;l.preventDefault(),(o=document.getElementById(t==="top"?"top":`${t}-copy`))==null||o.scrollIntoView({block:"center",behavior:s?"auto":"smooth"})},children:[e.jsx("span",{children:n}),e.jsx("i",{})]},t))})}const _=({children:s})=>e.jsx("span",{className:"ln",children:e.jsx("span",{children:s})});function w({id:s,scene:a,mark:t,label:n,place:c,statement:l,children:o,foot:r}){const m=P();return e.jsx("article",{id:s,className:`chapter place-${c}`,"aria-labelledby":`${s}-title`,children:e.jsxs("div",{ref:m,className:"chapter-copy reveal","data-scene":a,id:`${s}-copy`,children:[e.jsxs("p",{className:"chapter-label",children:[e.jsxs("span",{children:[t," / 03"]}),n]}),e.jsx("h2",{className:"chapter-statement",id:`${s}-title`,children:l.map((i,d)=>e.jsxs(_,{children:[i," "]},d))}),o,r&&e.jsx("p",{className:"chapter-foot",children:r})]})})}const X=[["top","Opening"],["the-filing","The filing"],["the-connection","The connection"],["the-discovery","The discovery"],["handoff","Investigate"]];function Q({go:s,stats:a,introDone:t,reduced:n}){var A,S,R;const[c,l]=h.useState(!1),[o,r]=h.useState(null),m=P();h.useEffect(()=>{const u=()=>l(scrollY>40);return u(),addEventListener("scroll",u,{passive:!0}),()=>removeEventListener("scroll",u)},[]);const i=g.candidate,d=g.predicate,x=g.recall,f=g.citation,j=$(x.initiated,i.decision_date),y=Math.floor(j/12),p=j%12,v=f.quote.split(f.dst);return e.jsxs("div",{className:"film",id:"top",children:[e.jsx(Y,{reduced:n,introDone:t,stats:a,onScene:E.set,onKind:r}),o&&e.jsx(G,{}),e.jsxs("header",{className:"film-top"+(c?" is-solid":""),children:[e.jsx("a",{href:"#/","aria-label":"Forebear, start of film",onClick:u=>{u.preventDefault(),scrollTo({top:0})},children:e.jsx(M,{size:26})}),e.jsx("span",{className:"spacer"}),e.jsxs("nav",{"aria-label":"Product",children:[e.jsx("a",{href:"#/check",children:"Investigate"}),e.jsx("a",{href:"#/reach/88058,88071",children:"Recall reach"}),e.jsx("a",{href:"#/watch",children:"Watchlist"}),e.jsx("a",{href:"#/method",children:"Method"})]}),e.jsxs("a",{className:"btn btn-primary btn-sm",href:"#/check","data-testid":"open-workspace",children:["Open workspace ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]})]}),e.jsx(U,{reduced:n}),e.jsxs("main",{id:"main",children:[e.jsx("section",{className:"hero","data-scene":"0","data-align":"top","aria-labelledby":"hero-title",children:e.jsxs("div",{className:"hero-copy",children:[e.jsx("p",{className:"eyebrow",children:"510(k) predicate due diligence"}),e.jsxs("h1",{id:"hero-title",tabIndex:-1,style:{outline:"none"},children:["Every clearance has ",e.jsx("em",{children:"a past."})]}),e.jsxs("p",{className:"hero-lede",children:["Forebear reads the predicates out of FDA 510(k) summaries, stores the family tree in a ",e.jsx("b",{children:"Relate graph"})," joined to FDA recall records, and shows in one query whether a predicate, or any of its ancestors, was recalled for a design problem, as far back as their summaries can be read: ",e.jsx("b",{children:"with the page and quote behind every link."})]}),e.jsxs("div",{className:"hero-actions",children:[e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"hero-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Investigate ",i.k," ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsxs("a",{className:"btn btn-line",href:"#the-filing-copy",onClick:u=>{var b;u.preventDefault(),(b=document.getElementById("the-filing-copy"))==null||b.scrollIntoView({block:"center",behavior:n?"auto":"smooth"})},children:["Follow one thread ",e.jsx("span",{"aria-hidden":"true",children:"↓"})]})]}),a&&e.jsxs("div",{className:"hero-proof","aria-label":"What is in the shipped graph",children:[e.jsxs("div",{children:[e.jsx(N,{v:(A=a.nodes)==null?void 0:A.Device}),e.jsx("span",{children:"clearances in the graph"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(S=a.citations_by_kind)==null?void 0:S.predicate}),e.jsx("span",{children:"predicate links, each with a page"})]}),e.jsxs("div",{children:[e.jsx(N,{v:(R=a.nodes)==null?void 0:R.Recall}),e.jsx("span",{children:"FDA recall records joined"})]})]})]})}),e.jsxs(w,{id:"the-filing",scene:1,mark:"01",label:"The filing",place:"left",statement:["One document","tells one step."],foot:"A 510(k) summary names its predicate. It does not tell you what became of it.",children:[e.jsxs("p",{className:"chapter-body",children:[i.name," (",e.jsx("span",{className:"k",children:i.k}),") was cleared on ",k(i.decision_date),". Its 510(k) summary names a single predicate, on page ",f.page,":"]}),e.jsxs("figure",{className:"doc","aria-label":`Quote from page ${f.page} of the ${i.k} summary`,children:[e.jsxs("div",{className:"doc-meta",children:[e.jsxs("span",{children:[i.k," · 510(k) summary"]}),e.jsxs("span",{children:["page ",f.page]})]}),e.jsxs("blockquote",{style:{margin:0},children:["“…",v[0],e.jsx("mark",{children:f.dst}),v[1],"”"]}),e.jsx("div",{style:{marginTop:10},children:e.jsxs("a",{href:q(i.summary_url,f.page),target:"_blank",rel:"noreferrer",children:["Open the FDA PDF at page ",f.page," ↗"]})})]})]}),e.jsx(w,{id:"the-connection",scene:2,mark:"02",label:"The connection",place:"right",statement:["Follow the thread","back in time."],foot:"Each thread is an edge in the graph, stored with its page, quote and source PDF.",children:e.jsxs("p",{className:"chapter-body",children:[e.jsx("span",{className:"k",children:i.k})," → ",e.jsx("span",{className:"k",children:d.k}),": the ",e.jsx("b",{children:d.name}),", cleared to ",d.applicant," on ",k(d.decision_date),". And ",d.k," cites predicates of its own: ",g.grand_predicates.map((u,b)=>e.jsxs(L.Fragment,{children:[b?b===g.grand_predicates.length-1?" and ":", ":"",e.jsx("span",{className:"k",children:u.k})]},u.k)),". FDA's databases answer one hop at a time. Relate walks them all in one variable-length query."]})}),e.jsxs(w,{id:"the-discovery",scene:3,mark:"03",label:"The discovery",place:"left",statement:["FDA recalls name",e.jsx("em",{children:"the predicate."},"e")],foot:"A recall on a predicate is not a finding about the new device. It is a question the predicate rationale should answer.",children:[e.jsxs("p",{className:"chapter-body",children:["On ",k(x.initiated)," a ",e.jsx("b",{children:x.classification})," recall of the BiPAP A30 began, root cause ",e.jsx("b",{children:x.root_cause}),": “",x.reason,"…” (event ",x.event,", records ",x.ids.join(" and "),")."]}),e.jsxs("div",{className:"fact-row",children:[e.jsxs("div",{className:"fact amber",children:[e.jsxs("b",{children:[y," yr ",p," mo"]}),e.jsxs("span",{children:["between recall start and ",i.k,"'s clearance"]})]}),e.jsxs("div",{className:"fact",children:[e.jsx("b",{children:"Review lineage"}),e.jsxs("span",{children:["deterministic verdict for ",i.k]})]})]}),e.jsx("p",{className:"chapter-body",style:{fontSize:14},children:"FDA's 2023 draft guidance recommends predicates not subject to design-related recalls."})]}),e.jsx("section",{id:"handoff",className:"handoff","aria-labelledby":"handoff-title",children:e.jsxs("div",{ref:m,className:"reveal","data-scene":"4",id:"handoff-copy",children:[e.jsxs("p",{className:"lead",id:"handoff-title",children:[e.jsx(_,{children:"Every fact above is real evidence."}),e.jsx(_,{children:e.jsx("em",{children:"Now work with it."})})]}),e.jsxs("a",{className:"btn btn-primary",href:`#/check/${i.k}`,"data-testid":"handoff-investigate",onClick:u=>{u.preventDefault(),s("check",i.k,{transition:!0})},children:["Open the investigation ",e.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),e.jsx("p",{className:"sub",children:"Every node, date and quote above is read from the shipped Relate store; the background field is illustrative."})]})}),e.jsxs("section",{className:"paths","aria-labelledby":"paths-title",children:[e.jsx("h2",{id:"paths-title",children:"Or start somewhere else"}),e.jsxs("div",{className:"path-grid",children:[e.jsxs("a",{className:"path-card",href:"#/reach/88058,88071",children:[e.jsx("span",{className:"k",children:"Recall 88058 + 88071"}),e.jsx("h3",{children:"Recall reach"}),e.jsx("p",{children:"From the June 2021 Philips foam recall: which later clearances descend from it?"})]}),e.jsxs("a",{className:"path-card",href:"#/watch",children:[e.jsx("span",{className:"k",children:"Watchlist"}),e.jsx("h3",{children:"Cited after a recall"}),e.jsx("p",{children:"Clearances whose predicate was already under a design-related recall."})]}),e.jsxs("a",{className:"path-card",href:"#/compare/K200480 K113053 K233643 K143677",children:[e.jsx("span",{className:"k",children:"Compare"}),e.jsx("h3",{children:"Choose a predicate"}),e.jsx("p",{children:"Candidate predicates side by side, with their own and inherited recalls."})]}),e.jsxs("a",{className:"path-card",href:"#/check/K251770",children:[e.jsx("span",{className:"k",children:"K251770"}),e.jsx("h3",{children:"SleepRes PAP System"}),e.jsx("p",{children:"Another 2025 clearance, another lineage."})]})]})]})]}),e.jsxs("footer",{className:"film-foot",children:[e.jsx("p",{children:"Public FDA data: openFDA 510(k), recall and enforcement records and 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."}),e.jsx(B,{size:18})]})]})}export{Q as default,se as useMedia}; diff --git a/web/dist/assets/Views-CntGI8oq.js b/web/dist/assets/Views-CntGI8oq.js deleted file mode 100644 index be75585..0000000 --- a/web/dist/assets/Views-CntGI8oq.js +++ /dev/null @@ -1 +0,0 @@ -import{r as h,j as e,v as E,f as g,E as S,a as A,A as y,b as w,P as k,c as _,T as D}from"./index-BEiDIW2F.js";const N=({eyebrow:l,title:c,children:t})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:l}),e.jsx("h1",{children:c}),t&&e.jsx("p",{children:t})]}),C=l=>c=>{c.key==="Enter"&&l()};function T({initial:l,go:c}){const[t,o]=h.useState(l||"K200480 K113053 K233643 K143677"),[d,m]=h.useState(null),[p,i]=h.useState(null),[x,u]=h.useState(!1),s=(a=t)=>{const n=[...new Set(a.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!n.length){i("Enter one or more K-numbers");return}i(null),u(!0),_.compare(n).then(m).catch(j=>i(j.message)).finally(()=>u(!1))};return h.useEffect(()=>{s(l||t)},[l]),e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Investigate",title:"Compare candidate predicates",children:"FDA's draft guidance suggests documenting how each candidate predicate meets the selection best practices. This table covers the recall practice: each candidate's own recalls and those in its ancestry, computed live from the graph."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:a=>{a.preventDefault(),s()},children:[e.jsx("input",{className:"field",value:t,onChange:a=>o(a.target.value),"aria-label":"K-numbers to compare (up to 8)"}),e.jsx("button",{className:"btn btn-primary",disabled:x,children:x?"Comparing…":"Compare"})]}),p&&e.jsx("p",{className:"err",children:p})]}),d&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidate"}),e.jsx("th",{children:"Cleared"}),e.jsx("th",{children:"Verdict"}),e.jsxs("th",{children:["Evidence",e.jsx("br",{}),"(verdict window)"]}),e.jsxs("th",{children:["Own recalls",e.jsx("br",{}),"(design)"]}),e.jsxs("th",{children:["Flagged ancestors",e.jsx("br",{}),"gen 1–2"]}),e.jsxs("th",{children:["Ancestors",e.jsx("br",{}),"(unread)"]}),e.jsx("th",{children:"Top signal"})]})}),e.jsx("tbody",{children:d.map(a=>{if(!a.found)return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:a.k})}),e.jsxs("td",{colSpan:7,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${a.k}`,children:"Read it from FDA →"})]})]},a.k);const n=E(a.verdict,a.evidence);return e.jsxs("tr",{className:"click",tabIndex:0,"data-k":a.k,"data-evidence":a.evidence,onClick:()=>c("check",a.k),onKeyDown:C(()=>c("check",a.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:a.k}),e.jsx("div",{className:"sub",children:a.name}),e.jsx("div",{className:"sub",children:a.applicant})]}),e.jsx("td",{className:"num",children:g(a.decision_date)}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${n.tone}`,"data-testid":"compare-verdict",children:n.label}),a.conditional&&e.jsx("div",{children:e.jsx("span",{className:"chip tone-violet",children:"conditional"})}),e.jsx("div",{className:"sub",style:{maxWidth:320},"data-testid":"compare-reason",children:a.verdict_reason})]}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${S[a.evidence]||"muted"}`,"data-testid":"compare-evidence",children:a.evidence}),(a.evidence_reasons||[]).map(j=>e.jsx("div",{className:"sub",children:A[j]||j},j))]}),e.jsxs("td",{className:"num",children:[a.own_recalls," ",e.jsxs("span",{className:"sub",children:["(",a.own_design_recalls,")"]})]}),e.jsx("td",{className:"num",children:a.flagged_ancestors_gen12}),e.jsxs("td",{className:"num",children:[a.ancestors," ",e.jsxs("span",{className:"sub",children:["(",a.lineage_unknown,")"]})]}),e.jsx("td",{className:"sub",style:{maxWidth:360},children:a.top_signal||"—"})]},a.k)})})]})}),e.jsx("p",{className:"graph-hint",children:"Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer. A verdict on partial or uncertain evidence is provisional: equal verdicts on unequal evidence are not equivalent."})]})]})}function I({initial:l,go:c}){const[t,o]=h.useState(l||"88058,88071"),[d,m]=h.useState(null),[p,i]=h.useState(null),x=(n=t)=>{i(null),m(null),_.recallEvent(n.replace(/\s/g,"")).then(m).catch(j=>i(j.message))};h.useEffect(()=>{o(l||"88058,88071"),x(l||"88058,88071")},[l]);const u=(d==null?void 0:d.descendants)||[],s=(d==null?void 0:d.counts)||{},a=[["after-supported","Cleared after the recall began · supported route",u.filter(n=>n.timing==="after"&&n.evidence==="supported"),'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.',!0],["after-conditional","Cleared after the recall began · conditional route only",u.filter(n=>n.timing==="after"&&n.evidence==="conditional"),"Every route to the recalled clearance runs through a citation the audit could not resolve.",!1],["same-day","Cleared the day the recall began",u.filter(n=>n.timing==="same_day"),"Same calendar day: the dates cannot order them, so these count as neither before nor after.",!1],["unknown","Timing unknown",u.filter(n=>n.timing==="unknown"),"A clearance date or recall start is missing.",!1],["before","Cleared before the recall began",u.filter(n=>n.timing==="before"),null,!0]];return e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance FDA lists on it, then every later clearance that cites one of them, up to three generations, and compares each clearance date with the recall start on its own supported route."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:n=>{n.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:t,onChange:n=>o(n.target.value),"aria-label":"Recall event numbers, comma-separated"}),e.jsx("button",{className:"btn btn-primary",children:"Trace"})]}),e.jsxs("p",{className:"muted small",style:{marginBottom:0},children:["Examples: ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("88058,88071"),x("88058,88071")},children:"88058,88071"})," Philips PE-PUR foam recall, June 2021 (openFDA files it as two events) ·"," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("84406"),x("84406")},children:"84406"})]}),p&&e.jsx("p",{className:"err",children:p})]}),!d&&!p&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"panel","data-testid":"reach-stats",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:d.recalled.length}),e.jsxs("span",{children:["clearances FDA lists on recall event(s) ",d.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:u.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber","data-testid":"reach-count-after",children:[e.jsx("b",{children:s.after_supported??0}),e.jsxs("span",{children:["cleared after the recall on a supported route began",d.initiated?` (earliest ${g(d.initiated)})`:""]})]}),e.jsxs("div",{className:"violet","data-testid":"reach-count-conditional",children:[e.jsx("b",{children:s.conditional??0}),e.jsxs("span",{children:["reached only through an unresolved citation (conditional)",s.after_conditional?`, ${s.after_conditional} of them cleared after`:""]})]}),(s.same_day>0||s.unknown>0)&&e.jsxs("div",{"data-testid":"reach-count-undetermined",children:[e.jsx("b",{children:(s.same_day||0)+(s.unknown||0)}),e.jsxs("span",{children:["timing not determinable (",s.same_day||0," same day, ",s.unknown||0," missing a date)"]})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:d.recalled.map(n=>e.jsxs("button",{className:"tag-btn",onClick:()=>c("check",n.k),"data-testid":"reach-holder",title:y[w(n)].text+(n.linked_before_clearance?" "+k.text:""),children:[e.jsx("span",{className:"k",children:n.k})," ",n.name," ",e.jsxs("span",{className:"muted",children:["· ",y[w(n)].short,n.linked_before_clearance?` · ${k.short.toLowerCase()}`:""]})]},n.k))}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association, not verified model identity: a name match is a fuzzy heuristic on the recall text, and a recall that began before a clearance does not by itself show whether that model was affected."})]}),e.jsx("section",{className:"panel",children:a.filter(([,,n,,j])=>j||n.length).map(([n,j,b,r],v)=>e.jsxs("div",{"data-testid":`reach-${n}`,children:[e.jsxs("div",{className:"panel-head",style:v?{marginTop:22}:void 0,children:[e.jsxs("h2",{children:[j," ",e.jsx("span",{className:"count",children:b.length})]}),r&&e.jsx("p",{className:"hint",children:r})]}),e.jsx(R,{rows:b,go:c})]},n))})]})]})}function R({rows:l,go:c}){return l.length?e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Applicant"}),e.jsx("th",{children:"Cleared"}),e.jsxs("th",{children:["Recall began",e.jsx("br",{}),"on its route"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:l.map(t=>{var p;const o=t.evidence==="conditional",d=!o&&((p=t.conditional_via)==null?void 0:p.length)>0,m=t.supported_gen??t.gen;return e.jsxs("tr",{className:"click"+(o?" is-conditional":""),tabIndex:0,"data-k":t.k,"data-timing":t.timing,"data-evidence":t.evidence,onClick:()=>c("check",t.k),onKeyDown:C(()=>c("check",t.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:t.k})," ",o&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),d&&e.jsx("span",{className:"chip tone-muted",title:"Some routes are supported, others rest on an unresolved citation",children:"mixed routes"}),e.jsx("div",{className:"sub",children:t.name})]}),e.jsx("td",{className:"sub",children:t.applicant}),e.jsx("td",{className:"num",children:g(t.decision_date)}),e.jsxs("td",{className:"num",children:[g(t.recall_started),e.jsx("div",{className:"sub",children:D[t.timing]}),d&&t.conditional_timing&&t.conditional_timing!==t.timing&&e.jsxs("div",{className:"sub",style:{color:"var(--violet)"},children:["Conditional route only: recall began ",g(t.conditional_recall_started),", ",D[t.conditional_timing]]})]}),e.jsx("td",{children:m===1?"direct predicate":`${m} generations`}),e.jsx("td",{className:"sub",children:t.via.map(i=>{var x,u;return e.jsxs("span",{style:(x=t.conditional_via)!=null&&x.includes(i)?{color:"var(--violet)"}:void 0,title:(u=t.conditional_via)!=null&&u.includes(i)?"Reached only through an unresolved citation":"Reached through a supported citation",children:[i," "]},i)})})]},t.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function $({go:l}){const[c,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{_.watchlist().then(t).catch(s=>d(s.message))},[]);const i=(c==null?void 0:c.rows)||[],x=i.filter(s=>m==="all"||m==="direct"&&s.supported_min_gen===1||m==="supported"&&!s.conditional||m==="conditional"&&s.conditional),u=(c==null?void 0:c.conditional)??i.filter(s=>s.conditional).length;return e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Recall evidence",title:"Watchlist: cleared after a predicate recall began",children:"Clearances whose FDA decision date falls after a design-related recall had started on their predicate or grand-predicate. Only the clearance date is compared: it does not show when the predicate was chosen or cited, and the application's receipt date does not establish that either. Same-day dates are not counted as after. Close to, but not the same as, the JAMA study's measure (Class I predicate recalls, any cause). A question to ask, not a finding: the recall may have been fixed, or limited to lots or software versions."}),o&&e.jsx("p",{className:"err",children:o}),!c&&!o&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Querying the graph…"]}),c&&e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:c.count}),e.jsx("span",{children:"clearances decided after a recall began on their lineage"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:c.direct_supported??c.direct}),e.jsx("span",{children:"cite a directly recalled predicate through a supported citation"})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:u}),e.jsx("span",{children:"conditional: every route runs through an unresolved citation"})]})]}),e.jsx("div",{className:"seg",role:"group","aria-label":"Filter",style:{marginTop:14},children:[["all","All"],["direct","Direct predicate"],["supported","Supported routes"],["conditional","Conditional only"]].map(([s,a])=>e.jsx("button",{"aria-pressed":m===s,onClick:()=>p(s),children:a},s))})]}),c&&e.jsx("section",{className:"panel",children:e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Cleared device"}),e.jsx("th",{children:"Cleared · recall began"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(s=>e.jsxs("tr",{className:"click"+(s.conditional?" is-conditional":""),tabIndex:0,"data-k":s.k,onClick:()=>l("check",s.k),onKeyDown:C(()=>l("check",s.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k})," ",s.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:s.name}),e.jsx("div",{className:"sub",children:s.applicant})]}),e.jsxs("td",{className:"num","data-testid":"watch-dates",children:["Cleared ",g(s.decision_date),e.jsxs("div",{className:"sub",children:["recall began ",g(s.recall_basis),s.days_after_recall!=null?`, ${s.days_after_recall} days earlier`:""]})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:(s.conditional?s.ancestors:s.supported_ancestors||s.ancestors).join(", ")}),e.jsx("div",{className:"sub",children:s.conditional?"cited device · citation unresolved":s.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[s.recall_count>2&&e.jsxs("div",{className:"muted",children:[s.recall_count," recall routes; first two:"]}),s.recalls.slice(0,2).map(a=>e.jsxs("div",{children:[a.recall_id," · ",a.classification||"unclassified"," · ",a.root_cause," · ",g(a.initiated),a.conditional&&e.jsx("span",{style:{color:"var(--violet)"},children:" · conditional"}),e.jsxs("div",{className:"muted",title:y[w(a)].text+(a.linked_before_clearance?" "+k.text:""),"data-testid":"watch-attribution",children:[a.ancestor,": ",y[w(a)].short,a.linked_before_clearance?` · ${k.short.toLowerCase()}`:""]})]},a.recall_id+a.ancestor))]})]},s.k))})]})})})]})}function K({initial:l,go:c,onChanged:t}){var j,b;const[o,d]=h.useState(l||""),[m,p]=h.useState(!1),[i,x]=h.useState(null),[u,s]=h.useState(null);h.useEffect(()=>{l&&d(l)},[l]);const a=async()=>{p(!0),s(null),x(null);try{const r=await _.ingest(o);x(r),t&&t()}catch(r){s(r.message)}finally{p(!1)}},n=(r,v)=>Object.keys({...r,...v}).map(f=>[f,(v[f]||0)-(r[f]||0)]).filter(([,f])=>f);return e.jsxs("div",{children:[e.jsx(N,{eyebrow:"Graph",title:"Add a clearance",children:"Enter any 510(k) number. Forebear fetches its openFDA record and summary PDF live, extracts the predicates it cites, validates them against openFDA, links recalls, and MERGEs everything into the Relate store. Use it on an ancestor whose summary was not read to extend a lineage by one generation. Needs internet."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:r=>{r.preventDefault(),a()},children:[e.jsx("input",{className:"field",value:o,placeholder:"K-number, e.g. K241135",onChange:r=>d(r.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:m||!o,children:m?"Reading from FDA…":"Read and add"})]}),m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),u&&e.jsx("p",{className:"err",role:"alert",children:u})]}),i&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[i.k,": ",i.was_present?i.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:i.summary_status}),i.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:i.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),e.jsxs("p",{className:"muted",children:["Graph change: ",n(i.graph_before,i.graph_after).concat(n(i.rels_before,i.rels_after)).map(([r,v])=>`${v>0?"+":""}${v} ${r}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),i.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",i.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):i.citations_added.map(r=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:r.dst})," ",e.jsx("span",{className:"chip",children:r.kind})," ",e.jsxs("span",{className:"muted",children:["p.",r.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",r.snippet,"”"]})]},r.dst)),((b=(j=i.reconciliation)==null?void 0:j.retired)==null?void 0:b.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:13},children:"Citations no longer in the refreshed summary"}),e.jsxs("p",{className:"muted small","data-testid":"ingest-retired",children:["Retired from the lineage, kept with their reviews and provenance:"," ",i.reconciliation.retired.map(r=>`${r.dst}${r.review?` (${r.review} by ${r.reviewer||"unknown"})`:""}`).join(", "),"."]})]}),i.reconciliation&&!i.reconciliation.ran&&e.jsxs("p",{className:"muted small",children:[i.reconciliation.skipped_reason,"."]}),e.jsxs("p",{className:"muted small",children:[i.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>c("check",i.k),children:["Investigate ",i.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function V({stats:l}){return e.jsxs("div",{className:"method",children:[e.jsx(N,{eyebrow:"Method",title:"How Forebear decides, and what it does not",children:"Verdicts come from a small set of deterministic rules over Relate queries. They are documentation signals inside a stated scope, never safety findings."}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"What the verdict means"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-alert",children:"Design-related recall on file"})," the candidate has a design-related recall of its own."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-amber",children:"Review lineage"})," a direct or grand-predicate has a design-related recall (Class I/II or not yet classified), the direct predicate has a Class I recall, or the candidate has a Class I recall."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-muted",children:"Lineage not checkable"})," the candidate's own predicates could not be read, or every direct predicate link rests on uncertain evidence, so nothing was checked."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-calm",children:"No design-recall signal"})," none of the above in the readable ancestry. Lower-severity signals are still listed. Not a safety finding."]})]}),e.jsx("p",{className:"muted small",children:'"Design-related" means an openFDA root cause containing "design" but not "process". This is coarse. Lineage is limited to summaries that are online and machine-readable; gaps are reported, never filled in.'})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How a thread is classified"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsxs("span",{className:"status status-confirmed",children:[e.jsx("span",{className:"line"}),"Confirmed"]})," a person confirmed the citation. Confirmations sent through the MCP client do not count."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-extracted",children:[e.jsx("span",{className:"line"}),"Machine-extracted"]})," read from the summary text, validated against openFDA, not yet reviewed."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-disputed",children:[e.jsx("span",{className:"line"}),"Disputed"]})," the cited device's FDA name is absent near the citation, it is in a different FDA panel, its K-number was corrected by the audit, or only an LLM labelled it a predicate."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-conditional",children:[e.jsx("span",{className:"line"}),"Conditional"]})," the extraction audit could not resolve the citation. Recalls reached only through it are marked conditional in assessments, the watchlist and recall reach."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-rejected",children:[e.jsx("span",{className:"line"}),"Rejected"]})," a reviewer removed it; it no longer counts in any lineage query."]})]})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"The optional agent"})}),e.jsx("p",{className:"lede",style:{margin:0},children:"An NVIDIA-hosted model can investigate a device by calling the same graph tools. Phase 3 evaluation found it unsuitable as the primary due-diligence workflow, so its findings appear only as history: never human-approved, never a verdict input, and unable to change lineage."})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How it uses Relate"})}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"Ingest."})," openFDA 510(k), recall and enforcement records, and the text of each 510(k) summary PDF, with page-level evidence."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Store."})," One single-file store, ",e.jsx("code",{children:"data/forebear.rl"}),": ",e.jsx("code",{children:"(:Device)-[:CITES]->(:Device)"}),", ",e.jsx("code",{children:"(:Device)-[:SUBJECT_OF]->(:Recall)"}),", saved ",e.jsx("code",{children:"(:Assessment)"})," nodes."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Query."})," Variable-length Cypher walks the family tree both ways, joins recalls on every ancestor, compares dates."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Update."})," Ingest, review a citation, save an assessment: each is a graph write the next query reads."]})]}),l&&e.jsxs("p",{className:"muted small",children:["Live: ",l.nodes.Device.toLocaleString("en-US")," devices, ",l.relationships.CITES.toLocaleString("en-US")," citation edges, ",l.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{T as CompareView,K as IngestView,V as MethodView,I as ReachView,$ as WatchlistView}; diff --git a/web/dist/assets/Views-Dyqeayth.js b/web/dist/assets/Views-Dyqeayth.js new file mode 100644 index 0000000..d9cffa6 --- /dev/null +++ b/web/dist/assets/Views-Dyqeayth.js @@ -0,0 +1 @@ +import{r as h,j as e,v as E,f as g,E as F,a as R,A as k,b as _,P as D,c as C,T as A}from"./index-DD2rN9W6.js";const y=({eyebrow:l,title:c,children:t})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:l}),e.jsx("h1",{children:c}),t&&e.jsx("p",{children:t})]}),S=l=>c=>{c.key==="Enter"&&l()};function $({initial:l,go:c}){const[t,o]=h.useState(l||"K200480 K113053 K233643 K143677"),[d,m]=h.useState(null),[p,n]=h.useState(null),[x,u]=h.useState(!1),a=(s=t)=>{const i=[...new Set(s.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!i.length){n("Enter one or more K-numbers");return}n(null),u(!0),C.compare(i).then(m).catch(j=>n(j.message)).finally(()=>u(!1))};return h.useEffect(()=>{a(l||t)},[l]),e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Investigate",title:"Compare candidate predicates",children:"FDA's draft guidance suggests documenting how each candidate predicate meets the selection best practices. This table covers the recall practice: each candidate's own recalls and those in its ancestry, computed live from the graph."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:s=>{s.preventDefault(),a()},children:[e.jsx("input",{className:"field",value:t,onChange:s=>o(s.target.value),"aria-label":"K-numbers to compare (up to 8)"}),e.jsx("button",{className:"btn btn-primary",disabled:x,children:x?"Comparing…":"Compare"})]}),p&&e.jsx("p",{className:"err",children:p})]}),d&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidate"}),e.jsx("th",{children:"Cleared"}),e.jsx("th",{children:"Verdict"}),e.jsxs("th",{children:["Evidence",e.jsx("br",{}),"(verdict window)"]}),e.jsxs("th",{children:["Own recalls",e.jsx("br",{}),"(design)"]}),e.jsxs("th",{children:["Flagged ancestors",e.jsx("br",{}),"gen 1–2"]}),e.jsxs("th",{children:["Ancestors",e.jsx("br",{}),"(unread)"]}),e.jsx("th",{children:"Top signal"})]})}),e.jsx("tbody",{children:d.map(s=>{if(!s.found)return e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:s.k})}),e.jsxs("td",{colSpan:7,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${s.k}`,children:"Read it from FDA →"})]})]},s.k);const i=E(s.verdict,s.evidence);return e.jsxs("tr",{className:"click",tabIndex:0,"data-k":s.k,"data-evidence":s.evidence,onClick:()=>c("check",s.k),onKeyDown:S(()=>c("check",s.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:s.k}),e.jsx("div",{className:"sub",children:s.name}),e.jsx("div",{className:"sub",children:s.applicant})]}),e.jsx("td",{className:"num",children:g(s.decision_date)}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${i.tone}`,"data-testid":"compare-verdict",children:i.label}),s.conditional&&e.jsx("div",{children:e.jsx("span",{className:"chip tone-violet",children:"conditional"})}),e.jsx("div",{className:"sub",style:{maxWidth:320},"data-testid":"compare-reason",children:s.verdict_reason})]}),e.jsxs("td",{children:[e.jsx("span",{className:`chip tone-${F[s.evidence]||"muted"}`,"data-testid":"compare-evidence",children:s.evidence}),(s.evidence_reasons||[]).map(j=>e.jsx("div",{className:"sub",children:R[j]||j},j))]}),e.jsxs("td",{className:"num",children:[s.own_recalls," ",e.jsxs("span",{className:"sub",children:["(",s.own_design_recalls,")"]})]}),e.jsx("td",{className:"num",children:s.flagged_ancestors_gen12}),e.jsxs("td",{className:"num",children:[s.ancestors," ",e.jsxs("span",{className:"sub",children:["(",s.lineage_unknown,")"]})]}),e.jsx("td",{className:"sub",style:{maxWidth:360},children:s.top_signal||"—"})]},s.k)})})]})}),e.jsx("p",{className:"graph-hint",children:"Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer. A verdict on partial or uncertain evidence is provisional: equal verdicts on unequal evidence are not equivalent."})]})]})}function K({initial:l,go:c}){const[t,o]=h.useState(l||"88058,88071"),[d,m]=h.useState(null),[p,n]=h.useState(null),x=(i=t)=>{n(null),m(null),C.recallEvent(i.replace(/\s/g,"")).then(m).catch(j=>n(j.message))};h.useEffect(()=>{o(l||"88058,88071"),x(l||"88058,88071")},[l]);const u=(d==null?void 0:d.descendants)||[],a=(d==null?void 0:d.counts)||{},s=[["after-supported","Cleared after the recall began · supported route",u.filter(i=>i.timing==="after"&&i.evidence==="supported"),'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.',!0],["after-conditional","Cleared after the recall began · conditional route only",u.filter(i=>i.timing==="after"&&i.evidence==="conditional"),"Every route to the recalled clearance runs through a citation the audit could not resolve.",!1],["same-day","Cleared the day the recall began",u.filter(i=>i.timing==="same_day"),"Same calendar day: the dates cannot order them, so these count as neither before nor after.",!1],["unknown","Timing unknown",u.filter(i=>i.timing==="unknown"),"A clearance date or recall start is missing.",!1],["before","Cleared before the recall began",u.filter(i=>i.timing==="before"),null,!0]];return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance FDA lists on it, then every later clearance that cites one of them, up to three generations, and compares each clearance date with the recall start on its own supported route."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:i=>{i.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:t,onChange:i=>o(i.target.value),"aria-label":"Recall event numbers, comma-separated"}),e.jsx("button",{className:"btn btn-primary",children:"Trace"})]}),e.jsxs("p",{className:"muted small",style:{marginBottom:0},children:["Examples: ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("88058,88071"),x("88058,88071")},children:"88058,88071"})," Philips PE-PUR foam recall, June 2021 (openFDA files it as two events) ·"," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{o("84406"),x("84406")},children:"84406"})]}),p&&e.jsx("p",{className:"err",children:p})]}),!d&&!p&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),d&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"panel","data-testid":"reach-stats",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:d.recalled.length}),e.jsxs("span",{children:["clearances FDA lists on recall event(s) ",d.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:u.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber","data-testid":"reach-count-after",children:[e.jsx("b",{children:a.after_supported??0}),e.jsxs("span",{children:["cleared after the recall on a supported route began",d.initiated?` (earliest ${g(d.initiated)})`:""]})]}),e.jsxs("div",{className:"violet","data-testid":"reach-count-conditional",children:[e.jsx("b",{children:a.conditional??0}),e.jsxs("span",{children:["reached only through an unresolved citation (conditional)",a.after_conditional?`, ${a.after_conditional} of them cleared after`:""]})]}),(a.same_day>0||a.unknown>0)&&e.jsxs("div",{"data-testid":"reach-count-undetermined",children:[e.jsx("b",{children:(a.same_day||0)+(a.unknown||0)}),e.jsxs("span",{children:["timing not determinable (",a.same_day||0," same day, ",a.unknown||0," missing a date)"]})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:d.recalled.map(i=>e.jsxs("button",{className:"tag-btn",onClick:()=>c("check",i.k),"data-testid":"reach-holder",title:k[_(i)].text+(i.linked_before_clearance?" "+D.text:""),children:[e.jsx("span",{className:"k",children:i.k})," ",i.name," ",e.jsxs("span",{className:"muted",children:["· ",k[_(i)].short,i.linked_before_clearance?` · ${D.short.toLowerCase()}`:""]})]},i.k))}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association, not verified model identity: a name match is a fuzzy heuristic on the recall text, and a recall that began before a clearance does not by itself show whether that model was affected."})]}),e.jsx("section",{className:"panel",children:s.filter(([,,i,,j])=>j||i.length).map(([i,j,v,b],w)=>e.jsxs("div",{"data-testid":`reach-${i}`,children:[e.jsxs("div",{className:"panel-head",style:w?{marginTop:22}:void 0,children:[e.jsxs("h2",{children:[j," ",e.jsx("span",{className:"count",children:v.length})]}),b&&e.jsx("p",{className:"hint",children:b})]}),e.jsx(T,{rows:v,go:c})]},i))})]})]})}function T({rows:l,go:c}){return l.length?e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Applicant"}),e.jsx("th",{children:"Cleared"}),e.jsxs("th",{children:["Recall began",e.jsx("br",{}),"on its route"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:l.map(t=>{var p;const o=t.evidence==="conditional",d=!o&&((p=t.conditional_via)==null?void 0:p.length)>0,m=t.supported_gen??t.gen;return e.jsxs("tr",{className:"click"+(o?" is-conditional":""),tabIndex:0,"data-k":t.k,"data-timing":t.timing,"data-evidence":t.evidence,onClick:()=>c("check",t.k),onKeyDown:S(()=>c("check",t.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:t.k})," ",o&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),d&&e.jsx("span",{className:"chip tone-muted",title:"Some routes are supported, others rest on an unresolved citation",children:"mixed routes"}),e.jsx("div",{className:"sub",children:t.name})]}),e.jsx("td",{className:"sub",children:t.applicant}),e.jsx("td",{className:"num",children:g(t.decision_date)}),e.jsxs("td",{className:"num",children:[g(t.recall_started),e.jsx("div",{className:"sub",children:A[t.timing]}),d&&t.conditional_timing&&t.conditional_timing!==t.timing&&e.jsxs("div",{className:"sub",style:{color:"var(--violet)"},children:["Conditional route only: recall began ",g(t.conditional_recall_started),", ",A[t.conditional_timing]]})]}),e.jsx("td",{children:m===1?"direct predicate":`${m} generations`}),e.jsx("td",{className:"sub",children:t.via.map(n=>{var x,u;return e.jsxs("span",{style:(x=t.conditional_via)!=null&&x.includes(n)?{color:"var(--violet)"}:void 0,title:(u=t.conditional_via)!=null&&u.includes(n)?"Reached only through an unresolved citation":"Reached through a supported citation",children:[n," "]},n)})})]},t.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function P({go:l}){const[c,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{C.watchlist().then(t).catch(a=>d(a.message))},[]);const n=(c==null?void 0:c.rows)||[],x=n.filter(a=>m==="all"||m==="direct"&&a.supported_min_gen===1||m==="supported"&&!a.conditional||m==="conditional"&&a.conditional),u=(c==null?void 0:c.conditional)??n.filter(a=>a.conditional).length;return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Recall evidence",title:"Watchlist: cleared after a predicate recall began",children:"Clearances whose FDA decision date falls after a design-related recall had started on their predicate or grand-predicate. Only the clearance date is compared: it does not show when the predicate was chosen or cited, and the application's receipt date does not establish that either. Same-day dates are not counted as after. Close to, but not the same as, the JAMA study's measure (Class I predicate recalls, any cause). A question to ask, not a finding: the recall may have been fixed, or limited to lots or software versions."}),o&&e.jsx("p",{className:"err",children:o}),!c&&!o&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Querying the graph…"]}),c&&e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"bigstats",children:[e.jsxs("div",{children:[e.jsx("b",{children:c.count}),e.jsx("span",{children:"clearances decided after a recall began on their lineage"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:c.direct_supported??c.direct}),e.jsx("span",{children:"cite a directly recalled predicate through a supported citation"})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:u}),e.jsx("span",{children:"conditional: every route runs through an unresolved citation"})]})]}),e.jsx("div",{className:"seg",role:"group","aria-label":"Filter",style:{marginTop:14},children:[["all","All"],["direct","Direct predicate"],["supported","Supported routes"],["conditional","Conditional only"]].map(([a,s])=>e.jsx("button",{"aria-pressed":m===a,onClick:()=>p(a),children:s},a))})]}),c&&e.jsx("section",{className:"panel",children:e.jsx("div",{className:"tbl-wrap",children:e.jsxs("table",{className:"tbl",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Cleared device"}),e.jsx("th",{children:"Cleared · recall began"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(a=>e.jsxs("tr",{className:"click"+(a.conditional?" is-conditional":""),tabIndex:0,"data-k":a.k,onClick:()=>l("check",a.k),onKeyDown:S(()=>l("check",a.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:a.k})," ",a.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:a.name}),e.jsx("div",{className:"sub",children:a.applicant})]}),e.jsxs("td",{className:"num","data-testid":"watch-dates",children:["Cleared ",g(a.decision_date),e.jsxs("div",{className:"sub",children:["recall began ",g(a.recall_basis),a.days_after_recall!=null?`, ${a.days_after_recall} days earlier`:""]})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:(a.conditional?a.ancestors:a.supported_ancestors||a.ancestors).join(", ")}),e.jsx("div",{className:"sub",children:a.conditional?"cited device · citation unresolved":a.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[a.recall_count>2&&e.jsxs("div",{className:"muted",children:[a.recall_count," recall routes; first two:"]}),a.recalls.slice(0,2).map(s=>e.jsxs("div",{children:[s.recall_id," · ",s.classification||"unclassified"," · ",s.root_cause," · ",g(s.initiated),s.conditional&&e.jsx("span",{style:{color:"var(--violet)"},children:" · conditional"}),e.jsxs("div",{className:"muted",title:k[_(s)].text+(s.linked_before_clearance?" "+D.text:""),"data-testid":"watch-attribution",children:[s.ancestor,": ",k[_(s)].short,s.linked_before_clearance?` · ${D.short.toLowerCase()}`:""]})]},s.recall_id+s.ancestor))]})]},a.k))})]})})})]})}function V({initial:l,go:c,onChanged:t}){var b,w;const[o,d]=h.useState(l||""),[m,p]=h.useState(!1),[n,x]=h.useState(null),[u,a]=h.useState(null),[s,i]=h.useState(!1);h.useEffect(()=>{l&&d(l)},[l]);const j=async()=>{p(!0),a(null),x(null);try{const r=await C.ingest(o,s);x(r),t&&t()}catch(r){a(r.message)}finally{p(!1)}},v=(r,f)=>Object.keys({...r,...f}).map(N=>[N,(f[N]||0)-(r[N]||0)]).filter(([,N])=>N);return e.jsxs("div",{children:[e.jsx(y,{eyebrow:"Graph",title:"Add a clearance",children:"Enter any 510(k) number. Forebear fetches its openFDA record and summary PDF live, extracts the predicates it cites, validates them against openFDA, links recalls, and MERGEs everything into the Relate store. Use it on an ancestor whose summary was not read to extend a lineage by one generation. Needs internet."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:r=>{r.preventDefault(),j()},children:[e.jsx("input",{className:"field",value:o,placeholder:"K-number, e.g. K241135",onChange:r=>d(r.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:m||!o,children:m?"Reading from FDA…":"Read and add"})]}),e.jsxs("label",{className:"muted small",style:{display:"block",marginTop:8},children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r=>i(r.target.checked),"data-testid":"ingest-refresh"})," ","Re-download the summary PDF from FDA to detect a changed document (otherwise the cached text is reused). Reviews made on an earlier version then need re-review."]}),m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),u&&e.jsx("p",{className:"err",role:"alert",children:u})]}),n&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[n.k,": ",n.was_present?n.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:n.summary_status}),n.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:n.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),n.refresh&&e.jsx("p",{className:"muted small","data-testid":"ingest-refresh-result",children:n.refresh.changed?`FDA's PDF changed (sha256 ${String(n.refresh.previous_sha256||"none").slice(0,12)} → ${String(n.summary_sha256).slice(0,12)}); citations were reconciled against the new text.`:"FDA's PDF is unchanged since it was cached."}),e.jsxs("p",{className:"muted",children:["Graph change: ",v(n.graph_before,n.graph_after).concat(v(n.rels_before,n.rels_after)).map(([r,f])=>`${f>0?"+":""}${f} ${r}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),n.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",n.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):n.citations_added.map(r=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:r.dst})," ",e.jsx("span",{className:"chip",children:r.kind})," ",e.jsxs("span",{className:"muted",children:["p.",r.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",r.snippet,"”"]})]},r.dst)),((w=(b=n.reconciliation)==null?void 0:b.retired)==null?void 0:w.length)>0&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{style:{fontSize:13},children:"Citations no longer in the refreshed summary"}),e.jsxs("p",{className:"muted small","data-testid":"ingest-retired",children:["Retired from the lineage, kept with their reviews and provenance:"," ",n.reconciliation.retired.map(r=>`${r.dst}${r.review?` (${r.review} by ${r.reviewer||"unknown"})`:""}`).join(", "),"."]})]}),n.reconciliation&&!n.reconciliation.ran&&e.jsxs("p",{className:"muted small",children:[n.reconciliation.skipped_reason,"."]}),e.jsxs("p",{className:"muted small",children:[n.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>c("check",n.k),children:["Investigate ",n.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function L({stats:l}){return e.jsxs("div",{className:"method",children:[e.jsx(y,{eyebrow:"Method",title:"How Forebear decides, and what it does not",children:"Verdicts come from a small set of deterministic rules over Relate queries. They are documentation signals inside a stated scope, never safety findings."}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"What the verdict means"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-alert",children:"Design-related recall on file"})," the candidate has a design-related recall of its own."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-amber",children:"Review lineage"})," a direct or grand-predicate has a design-related recall (Class I/II or not yet classified), the direct predicate has a Class I recall, or the candidate has a Class I recall."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-muted",children:"Lineage not checkable"})," the candidate's own predicates could not be read, or every direct predicate link rests on uncertain evidence, so nothing was checked."]}),e.jsxs("li",{children:[e.jsx("span",{className:"chip tone-calm",children:"No design-recall signal"})," none of the above in the readable ancestry. Lower-severity signals are still listed. Not a safety finding."]})]}),e.jsx("p",{className:"muted small",children:'"Design-related" means an openFDA root cause containing "design" but not "process". This is coarse. Lineage is limited to summaries that are online and machine-readable; gaps are reported, never filled in.'})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How a thread is classified"})}),e.jsxs("ul",{children:[e.jsxs("li",{children:[e.jsxs("span",{className:"status status-confirmed",children:[e.jsx("span",{className:"line"}),"Confirmed"]})," a person confirmed the citation. Confirmations sent through the MCP client do not count."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-extracted",children:[e.jsx("span",{className:"line"}),"Machine-extracted"]})," read from the summary text, validated against openFDA, not yet reviewed."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-disputed",children:[e.jsx("span",{className:"line"}),"Disputed"]})," the cited device's FDA name is absent near the citation, it is in a different FDA panel, its K-number was corrected by the audit, or only an LLM labelled it a predicate."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-conditional",children:[e.jsx("span",{className:"line"}),"Conditional"]})," the extraction audit could not resolve the citation. Recalls reached only through it are marked conditional in assessments, the watchlist and recall reach."]}),e.jsxs("li",{children:[e.jsxs("span",{className:"status status-rejected",children:[e.jsx("span",{className:"line"}),"Rejected"]})," a reviewer removed it; it no longer counts in any lineage query."]})]})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"The optional agent"})}),e.jsx("p",{className:"lede",style:{margin:0},children:"An NVIDIA-hosted model can investigate a device by calling the same graph tools. Phase 3 evaluation found it unsuitable as the primary due-diligence workflow, so its findings appear only as history: never human-approved, never a verdict input, and unable to change lineage."})]}),e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsx("h2",{children:"How it uses Relate"})}),e.jsxs("ol",{children:[e.jsxs("li",{children:[e.jsx("b",{children:"Ingest."})," openFDA 510(k), recall and enforcement records, and the text of each 510(k) summary PDF, with page-level evidence."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Store."})," One single-file store, ",e.jsx("code",{children:"data/forebear.rl"}),": ",e.jsx("code",{children:"(:Device)-[:CITES]->(:Device)"}),", ",e.jsx("code",{children:"(:Device)-[:SUBJECT_OF]->(:Recall)"}),", saved ",e.jsx("code",{children:"(:Assessment)"})," nodes."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Query."})," Variable-length Cypher walks the family tree both ways, joins recalls on every ancestor, compares dates."]}),e.jsxs("li",{children:[e.jsx("b",{children:"Update."})," Ingest, review a citation, save an assessment: each is a graph write the next query reads."]})]}),l&&e.jsxs("p",{className:"muted small",children:["Live: ",l.nodes.Device.toLocaleString("en-US")," devices, ",l.relationships.CITES.toLocaleString("en-US")," citation edges, ",l.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{$ as CompareView,V as IngestView,L as MethodView,K as ReachView,P as WatchlistView}; diff --git a/web/dist/assets/index-BEiDIW2F.js b/web/dist/assets/index-DD2rN9W6.js similarity index 59% rename from web/dist/assets/index-BEiDIW2F.js rename to web/dist/assets/index-DD2rN9W6.js index 124245d..eccb401 100644 --- a/web/dist/assets/index-BEiDIW2F.js +++ b/web/dist/assets/index-DD2rN9W6.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function Yc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sa={exports:{}},jl={},_a={exports:{}},z={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function Xc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sa={exports:{}},jl={},_a={exports:{}},z={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dr=Symbol.for("react.element"),Xc=Symbol.for("react.portal"),Zc=Symbol.for("react.fragment"),Jc=Symbol.for("react.strict_mode"),qc=Symbol.for("react.profiler"),bc=Symbol.for("react.provider"),ed=Symbol.for("react.context"),td=Symbol.for("react.forward_ref"),nd=Symbol.for("react.suspense"),rd=Symbol.for("react.memo"),ld=Symbol.for("react.lazy"),ao=Symbol.iterator;function id(e){return e===null||typeof e!="object"?null:(e=ao&&e[ao]||e["@@iterator"],typeof e=="function"?e:null)}var Ea={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ca=Object.assign,Ta={};function jn(e,t,n){this.props=e,this.context=t,this.refs=Ta,this.updater=n||Ea}jn.prototype.isReactComponent={};jn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};jn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Pa(){}Pa.prototype=jn.prototype;function cs(e,t,n){this.props=e,this.context=t,this.refs=Ta,this.updater=n||Ea}var ds=cs.prototype=new Pa;ds.constructor=cs;Ca(ds,jn.prototype);ds.isPureReactComponent=!0;var uo=Array.isArray,La=Object.prototype.hasOwnProperty,fs={current:null},Ra={key:!0,ref:!0,__self:!0,__source:!0};function Da(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)La.call(t,r)&&!Ra.hasOwnProperty(r)&&(l[r]=t[r]);var a=arguments.length-2;if(a===1)l.children=n;else if(1>>1,ee=C[X];if(0>>1;Xl(Ol,$))Rtl(gr,Ol)?(C[X]=gr,C[Rt]=$,X=Rt):(C[X]=Ol,C[Lt]=$,X=Lt);else if(Rtl(gr,$))C[X]=gr,C[Rt]=$,X=Rt;else break e}}return D}function l(C,D){var $=C.sortIndex-D.sortIndex;return $!==0?$:C.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],d=[],f=1,p=null,h=3,g=!1,y=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(C){for(var D=n(d);D!==null;){if(D.callback===null)r(d);else if(D.startTime<=C)r(d),D.sortIndex=D.expirationTime,t(u,D);else break;D=n(d)}}function w(C){if(k=!1,m(C),!y)if(n(u)!==null)y=!0,Xe(S);else{var D=n(d);D!==null&&M(w,D.startTime-C)}}function S(C,D){y=!1,k&&(k=!1,v(x),x=-1),g=!0;var $=h;try{for(m(D),p=n(u);p!==null&&(!(p.expirationTime>D)||C&&!I());){var X=p.callback;if(typeof X=="function"){p.callback=null,h=p.priorityLevel;var ee=X(p.expirationTime<=D);D=e.unstable_now(),typeof ee=="function"?p.callback=ee:p===n(u)&&r(u),m(D)}else r(u);p=n(u)}if(p!==null)var vr=!0;else{var Lt=n(d);Lt!==null&&M(w,Lt.startTime-D),vr=!1}return vr}finally{p=null,h=$,g=!1}}var E=!1,j=null,x=-1,R=5,T=-1;function I(){return!(e.unstable_now()-TC||125X?(C.sortIndex=$,t(d,C),n(u)===null&&C===n(d)&&(k?(v(x),x=-1):k=!0,M(w,$-X))):(C.sortIndex=ee,t(u,C),y||g||(y=!0,Xe(S))),C},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(C){var D=h;return function(){var $=h;h=D;try{return C.apply(this,arguments)}finally{h=$}}}})(Ia);Fa.exports=Ia;var vd=Fa.exports;/** + */(function(e){function t(C,D){var $=C.length;C.push(D);e:for(;0<$;){var X=$-1>>>1,ee=C[X];if(0>>1;Xl(Ol,$))Rtl(gr,Ol)?(C[X]=gr,C[Rt]=$,X=Rt):(C[X]=Ol,C[Lt]=$,X=Lt);else if(Rtl(gr,$))C[X]=gr,C[Rt]=$,X=Rt;else break e}}return D}function l(C,D){var $=C.sortIndex-D.sortIndex;return $!==0?$:C.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],d=[],f=1,p=null,h=3,g=!1,y=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(C){for(var D=n(d);D!==null;){if(D.callback===null)r(d);else if(D.startTime<=C)r(d),D.sortIndex=D.expirationTime,t(u,D);else break;D=n(d)}}function w(C){if(k=!1,m(C),!y)if(n(u)!==null)y=!0,Ze(S);else{var D=n(d);D!==null&&M(w,D.startTime-C)}}function S(C,D){y=!1,k&&(k=!1,v(x),x=-1),g=!0;var $=h;try{for(m(D),p=n(u);p!==null&&(!(p.expirationTime>D)||C&&!I());){var X=p.callback;if(typeof X=="function"){p.callback=null,h=p.priorityLevel;var ee=X(p.expirationTime<=D);D=e.unstable_now(),typeof ee=="function"?p.callback=ee:p===n(u)&&r(u),m(D)}else r(u);p=n(u)}if(p!==null)var vr=!0;else{var Lt=n(d);Lt!==null&&M(w,Lt.startTime-D),vr=!1}return vr}finally{p=null,h=$,g=!1}}var E=!1,j=null,x=-1,R=5,T=-1;function I(){return!(e.unstable_now()-TC||125X?(C.sortIndex=$,t(d,C),n(u)===null&&C===n(d)&&(k?(v(x),x=-1):k=!0,M(w,$-X))):(C.sortIndex=ee,t(u,C),y||g||(y=!0,Ze(S))),C},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(C){var D=h;return function(){var $=h;h=D;try{return C.apply(this,arguments)}finally{h=$}}}})(Ia);Fa.exports=Ia;var gd=Fa.exports;/** * @license React * react-dom.production.min.js * @@ -30,15 +30,15 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var gd=_,Se=vd;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mi=Object.prototype.hasOwnProperty,yd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fo={},po={};function xd(e){return mi.call(po,e)?!0:mi.call(fo,e)?!1:yd.test(e)?po[e]=!0:(fo[e]=!0,!1)}function wd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function kd(e,t,n,r){if(t===null||typeof t>"u"||wd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ie[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ie[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ie[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var hs=/[\-:]([a-z])/g;function ms(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});ie.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function vs(e,t,n,r){var l=ie.hasOwnProperty(t)?ie[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mi=Object.prototype.hasOwnProperty,xd=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fo={},po={};function wd(e){return mi.call(po,e)?!0:mi.call(fo,e)?!1:xd.test(e)?po[e]=!0:(fo[e]=!0,!1)}function kd(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function jd(e,t,n,r){if(t===null||typeof t>"u"||kd(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function he(e,t,n,r,l,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new he(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new he(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new he(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new he(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new he(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new he(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ie[e]=new he(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ie[e]=new he(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ie[e]=new he(e,5,!1,e.toLowerCase(),null,!1,!1)});var hs=/[\-:]([a-z])/g;function ms(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(hs,ms);ie[t]=new he(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!1,!1)});ie.xlinkHref=new he("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ie[e]=new he(e,1,!1,e.toLowerCase(),null,!0,!0)});function vs(e,t,n,r){var l=ie.hasOwnProperty(t)?ie[t]:null;(l!==null?l.type!==0:r||!(2a||l[s]!==i[a]){var u=` -`+l[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=a);break}}}finally{Wl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$n(e):""}function jd(e){switch(e.tag){case 5:return $n(e.type);case 16:return $n("Lazy");case 13:return $n("Suspense");case 19:return $n("SuspenseList");case 0:case 2:case 15:return e=Bl(e.type,!1),e;case 11:return e=Bl(e.type.render,!1),e;case 1:return e=Bl(e.type,!0),e;default:return""}}function xi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Zt:return"Fragment";case Xt:return"Portal";case vi:return"Profiler";case gs:return"StrictMode";case gi:return"Suspense";case yi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ua:return(e.displayName||"Context")+".Consumer";case Oa:return(e._context.displayName||"Context")+".Provider";case ys:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xs:return t=e.displayName||null,t!==null?t:xi(e.type)||"Memo";case ut:t=e._payload,e=e._init;try{return xi(e(t))}catch{}}return null}function Nd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xi(t);case 8:return t===gs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function St(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sd(e){var t=Wa(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){e._valueTracker||(e._valueTracker=Sd(e))}function Ba(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Wa(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=St(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ha(e,t){t=t.checked,t!=null&&vs(e,"checked",t,!1)}function ki(e,t){Ha(e,t);var n=St(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ji(e,t.type,n):t.hasOwnProperty("defaultValue")&&ji(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ji(e,t,n){(t!=="number"||qr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=kr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_d=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){_d.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function Ya(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function Xa(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ya(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Ed=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _i(e,t){if(t){if(Ed[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Ei(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ci=null;function ws(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ti=null,un=null,cn=null;function xo(e){if(e=hr(e)){if(typeof Ti!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Tl(t),Ti(e.stateNode,e.type,t))}}function Za(e){un?cn?cn.push(e):cn=[e]:un=e}function Ja(){if(un){var e=un,t=cn;if(cn=un=null,xo(e),t)for(e=0;e>>=0,e===0?32:31-(Id(e)/Ad|0)|0}var jr=64,Nr=4194304;function Mn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~l;a!==0?r=Mn(a):(i&=s,i!==0&&(r=Mn(i)))}else s=n&~l,s!==0?r=Mn(s):i!==0&&(r=Mn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ue(t),e[t]=n}function Wd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=On),To=" ",Po=!1;function gu(e,t){switch(e){case"keyup":return gf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jt=!1;function xf(e,t){switch(e){case"compositionend":return yu(t);case"keypress":return t.which!==32?null:(Po=!0,To);case"textInput":return e=t.data,e===To&&Po?null:e;default:return null}}function wf(e,t){if(Jt)return e==="compositionend"||!Ts&&gu(e,t)?(e=mu(),Br=_s=pt=null,Jt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$o(n)}}function ju(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ju(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nu(){for(var e=window,t=qr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qr(e.document)}return t}function Ps(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Pf(e){var t=Nu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ju(n.ownerDocument.documentElement,n)){if(r!==null&&Ps(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=zo(n,i);var s=zo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,qt=null,zi=null,Vn=null,Mi=!1;function Mo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mi||qt==null||qt!==qr(r)||(r=qt,"selectionStart"in r&&Ps(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vn&&tr(Vn,r)||(Vn=r,r=il(zi,"onSelect"),0tn||(e.current=Vi[tn],Vi[tn]=null,tn--)}function O(e,t){tn++,Vi[tn]=e.current,e.current=t}var _t={},ce=Tt(_t),ye=Tt(!1),Vt=_t;function mn(e,t){var n=e.type.contextTypes;if(!n)return _t;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function ol(){V(ye),V(ce)}function Wo(e,t,n){if(ce.current!==_t)throw Error(N(168));O(ce,t),O(ye,n)}function Du(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,Nd(e)||"Unknown",l));return Q({},n,r)}function al(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_t,Vt=ce.current,O(ce,e),O(ye,ye.current),!0}function Bo(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Du(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,V(ye),V(ce),O(ce,e)):V(ye),O(ye,n)}var Je=null,Pl=!1,ri=!1;function $u(e){Je===null?Je=[e]:Je.push(e)}function Vf(e){Pl=!0,$u(e)}function Pt(){if(!ri&&Je!==null){ri=!0;var e=0,t=A;try{var n=Je;for(A=1;e>=s,l-=s,qe=1<<32-Ue(t)+l|n<x?(R=j,j=null):R=j.sibling;var T=h(v,j,m[x],w);if(T===null){j===null&&(j=R);break}e&&j&&T.alternate===null&&t(v,j),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T,j=R}if(x===m.length)return n(v,j),W&&$t(v,x),S;if(j===null){for(;xx?(R=j,j=null):R=j.sibling;var I=h(v,j,T.value,w);if(I===null){j===null&&(j=R);break}e&&j&&I.alternate===null&&t(v,j),c=i(I,c,x),E===null?S=I:E.sibling=I,E=I,j=R}if(T.done)return n(v,j),W&&$t(v,x),S;if(j===null){for(;!T.done;x++,T=m.next())T=p(v,T.value,w),T!==null&&(c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return W&&$t(v,x),S}for(j=r(v,j);!T.done;x++,T=m.next())T=g(j,v,x,T.value,w),T!==null&&(e&&T.alternate!==null&&j.delete(T.key===null?x:T.key),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return e&&j.forEach(function(K){return t(v,K)}),W&&$t(v,x),S}function L(v,c,m,w){if(typeof m=="object"&&m!==null&&m.type===Zt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:e:{for(var S=m.key,E=c;E!==null;){if(E.key===S){if(S=m.type,S===Zt){if(E.tag===7){n(v,E.sibling),c=l(E,m.props.children),c.return=v,v=c;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ut&&Ko(S)===E.type){n(v,E.sibling),c=l(E,m.props),c.ref=Ln(v,E,m),c.return=v,v=c;break e}n(v,E);break}else t(v,E);E=E.sibling}m.type===Zt?(c=Ut(m.props.children,v.mode,w,m.key),c.return=v,v=c):(w=Jr(m.type,m.key,m.props,null,v.mode,w),w.ref=Ln(v,c,m),w.return=v,v=w)}return s(v);case Xt:e:{for(E=m.key;c!==null;){if(c.key===E)if(c.tag===4&&c.stateNode.containerInfo===m.containerInfo&&c.stateNode.implementation===m.implementation){n(v,c.sibling),c=l(c,m.children||[]),c.return=v,v=c;break e}else{n(v,c);break}else t(v,c);c=c.sibling}c=di(m,v.mode,w),c.return=v,v=c}return s(v);case ut:return E=m._init,L(v,c,E(m._payload),w)}if(zn(m))return y(v,c,m,w);if(_n(m))return k(v,c,m,w);Lr(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,c!==null&&c.tag===6?(n(v,c.sibling),c=l(c,m),c.return=v,v=c):(n(v,c),c=ci(m,v.mode,w),c.return=v,v=c),s(v)):n(v,c)}return L}var gn=Iu(!0),Au=Iu(!1),dl=Tt(null),fl=null,ln=null,$s=null;function zs(){$s=ln=fl=null}function Ms(e){var t=dl.current;V(dl),e._currentValue=t}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fn(e,t){fl=e,$s=ln=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ge=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if($s!==e)if(e={context:e,memoizedValue:t,next:null},ln===null){if(fl===null)throw Error(N(308));ln=e,fl.dependencies={lanes:0,firstContext:e}}else ln=ln.next=e;return t}var It=null;function Fs(e){It===null?It=[e]:It.push(e)}function Ou(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Fs(t)):(n.next=l.next,l.next=n),t.interleaved=n,rt(e,r)}function rt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ct=!1;function Is(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Uu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function et(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,rt(e,n)}return l=r.interleaved,l===null?(t.next=t,Fs(r)):(t.next=l.next,l.next=t),r.interleaved=t,rt(e,n)}function Qr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,js(e,n)}}function Go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pl(e,t,n,r){var l=e.updateQueue;ct=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,d=u.next;u.next=null,s===null?i=d:s.next=d,s=u;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=d:a.next=d,f.lastBaseUpdate=u))}if(i!==null){var p=l.baseState;s=0,f=d=u=null,a=i;do{var h=a.lane,g=a.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,k=a;switch(h=t,g=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){p=y.call(g,p,h);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,h=typeof y=="function"?y.call(g,p,h):y,h==null)break e;p=Q({},p,h);break e;case 2:ct=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(d=f=g,u=p):f=f.next=g,s|=h;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;h=a,a=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(f===null&&(u=p),l.baseState=u,l.firstBaseUpdate=d,l.lastBaseUpdate=f,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Ht|=s,e.lanes=s,e.memoizedState=p}}function Yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ii.transition;ii.transition={};try{e(!1),t()}finally{A=n,ii.transition=r}}function rc(){return ze().memoizedState}function Qf(e,t,n){var r=jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lc(e))ic(t,n);else if(n=Ou(e,t,n,r),n!==null){var l=fe();Ve(n,e,r,l),sc(n,t,r)}}function Kf(e,t,n){var r=jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lc(e))ic(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(l.hasEagerState=!0,l.eagerState=a,We(a,s)){var u=t.interleaved;u===null?(l.next=l,Fs(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Ou(e,t,l,r),n!==null&&(l=fe(),Ve(n,e,r,l),sc(n,t,r))}}function lc(e){var t=e.alternate;return e===H||t!==null&&t===H}function ic(e,t){Wn=ml=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,js(e,n)}}var vl={readContext:$e,useCallback:se,useContext:se,useEffect:se,useImperativeHandle:se,useInsertionEffect:se,useLayoutEffect:se,useMemo:se,useReducer:se,useRef:se,useState:se,useDebugValue:se,useDeferredValue:se,useTransition:se,useMutableSource:se,useSyncExternalStore:se,useId:se,unstable_isNewReconciler:!1},Gf={readContext:$e,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Zo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gr(4194308,4,qu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gr(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Qf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Xo,useDebugValue:Qs,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Xo(!1),t=e[0];return e=Hf.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(W){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Bt&30||Hu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Zo(Ku.bind(null,r,i,e),[e]),r.flags|=2048,ur(9,Qu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Qe(),t=ne.identifierPrefix;if(W){var n=be,r=qe;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=or++,0")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=a);break}}}finally{Wl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$n(e):""}function Nd(e){switch(e.tag){case 5:return $n(e.type);case 16:return $n("Lazy");case 13:return $n("Suspense");case 19:return $n("SuspenseList");case 0:case 2:case 15:return e=Bl(e.type,!1),e;case 11:return e=Bl(e.type.render,!1),e;case 1:return e=Bl(e.type,!0),e;default:return""}}function xi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Zt:return"Fragment";case Xt:return"Portal";case vi:return"Profiler";case gs:return"StrictMode";case gi:return"Suspense";case yi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ua:return(e.displayName||"Context")+".Consumer";case Oa:return(e._context.displayName||"Context")+".Provider";case ys:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case xs:return t=e.displayName||null,t!==null?t:xi(e.type)||"Memo";case ct:t=e._payload,e=e._init;try{return xi(e(t))}catch{}}return null}function Sd(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xi(t);case 8:return t===gs?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function St(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _d(e){var t=Wa(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wr(e){e._valueTracker||(e._valueTracker=_d(e))}function Ba(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Wa(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function qr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mo(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=St(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ha(e,t){t=t.checked,t!=null&&vs(e,"checked",t,!1)}function ki(e,t){Ha(e,t);var n=St(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ji(e,t.type,n):t.hasOwnProperty("defaultValue")&&ji(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vo(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ji(e,t,n){(t!=="number"||qr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=kr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ed=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){Ed.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function Ya(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function Xa(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ya(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Cd=Q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _i(e,t){if(t){if(Cd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Ei(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ci=null;function ws(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ti=null,un=null,cn=null;function xo(e){if(e=hr(e)){if(typeof Ti!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Tl(t),Ti(e.stateNode,e.type,t))}}function Za(e){un?cn?cn.push(e):cn=[e]:un=e}function Ja(){if(un){var e=un,t=cn;if(cn=un=null,xo(e),t)for(e=0;e>>=0,e===0?32:31-(Ad(e)/Od|0)|0}var jr=64,Nr=4194304;function Mn(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~l;a!==0?r=Mn(a):(i&=s,i!==0&&(r=Mn(i)))}else s=n&~l,s!==0?r=Mn(s):i!==0&&(r=Mn(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function fr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ue(t),e[t]=n}function Bd(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=On),To=" ",Po=!1;function gu(e,t){switch(e){case"keyup":return yf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jt=!1;function wf(e,t){switch(e){case"compositionend":return yu(t);case"keypress":return t.which!==32?null:(Po=!0,To);case"textInput":return e=t.data,e===To&&Po?null:e;default:return null}}function kf(e,t){if(Jt)return e==="compositionend"||!Ts&&gu(e,t)?(e=mu(),Br=_s=ht=null,Jt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$o(n)}}function ju(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ju(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nu(){for(var e=window,t=qr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=qr(e.document)}return t}function Ps(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Lf(e){var t=Nu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ju(n.ownerDocument.documentElement,n)){if(r!==null&&Ps(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=zo(n,i);var s=zo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,qt=null,zi=null,Vn=null,Mi=!1;function Mo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mi||qt==null||qt!==qr(r)||(r=qt,"selectionStart"in r&&Ps(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vn&&er(Vn,r)||(Vn=r,r=il(zi,"onSelect"),0tn||(e.current=Vi[tn],Vi[tn]=null,tn--)}function O(e,t){tn++,Vi[tn]=e.current,e.current=t}var _t={},ce=Tt(_t),ye=Tt(!1),Vt=_t;function mn(e,t){var n=e.type.contextTypes;if(!n)return _t;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function xe(e){return e=e.childContextTypes,e!=null}function ol(){V(ye),V(ce)}function Wo(e,t,n){if(ce.current!==_t)throw Error(N(168));O(ce,t),O(ye,n)}function Du(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,Sd(e)||"Unknown",l));return Q({},n,r)}function al(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_t,Vt=ce.current,O(ce,e),O(ye,ye.current),!0}function Bo(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Du(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,V(ye),V(ce),O(ce,e)):V(ye),O(ye,n)}var qe=null,Pl=!1,ri=!1;function $u(e){qe===null?qe=[e]:qe.push(e)}function Wf(e){Pl=!0,$u(e)}function Pt(){if(!ri&&qe!==null){ri=!0;var e=0,t=A;try{var n=qe;for(A=1;e>=s,l-=s,be=1<<32-Ue(t)+l|n<x?(R=j,j=null):R=j.sibling;var T=h(v,j,m[x],w);if(T===null){j===null&&(j=R);break}e&&j&&T.alternate===null&&t(v,j),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T,j=R}if(x===m.length)return n(v,j),W&&$t(v,x),S;if(j===null){for(;xx?(R=j,j=null):R=j.sibling;var I=h(v,j,T.value,w);if(I===null){j===null&&(j=R);break}e&&j&&I.alternate===null&&t(v,j),c=i(I,c,x),E===null?S=I:E.sibling=I,E=I,j=R}if(T.done)return n(v,j),W&&$t(v,x),S;if(j===null){for(;!T.done;x++,T=m.next())T=p(v,T.value,w),T!==null&&(c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return W&&$t(v,x),S}for(j=r(v,j);!T.done;x++,T=m.next())T=g(j,v,x,T.value,w),T!==null&&(e&&T.alternate!==null&&j.delete(T.key===null?x:T.key),c=i(T,c,x),E===null?S=T:E.sibling=T,E=T);return e&&j.forEach(function(K){return t(v,K)}),W&&$t(v,x),S}function L(v,c,m,w){if(typeof m=="object"&&m!==null&&m.type===Zt&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case xr:e:{for(var S=m.key,E=c;E!==null;){if(E.key===S){if(S=m.type,S===Zt){if(E.tag===7){n(v,E.sibling),c=l(E,m.props.children),c.return=v,v=c;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ct&&Ko(S)===E.type){n(v,E.sibling),c=l(E,m.props),c.ref=Ln(v,E,m),c.return=v,v=c;break e}n(v,E);break}else t(v,E);E=E.sibling}m.type===Zt?(c=Ut(m.props.children,v.mode,w,m.key),c.return=v,v=c):(w=Jr(m.type,m.key,m.props,null,v.mode,w),w.ref=Ln(v,c,m),w.return=v,v=w)}return s(v);case Xt:e:{for(E=m.key;c!==null;){if(c.key===E)if(c.tag===4&&c.stateNode.containerInfo===m.containerInfo&&c.stateNode.implementation===m.implementation){n(v,c.sibling),c=l(c,m.children||[]),c.return=v,v=c;break e}else{n(v,c);break}else t(v,c);c=c.sibling}c=di(m,v.mode,w),c.return=v,v=c}return s(v);case ct:return E=m._init,L(v,c,E(m._payload),w)}if(zn(m))return y(v,c,m,w);if(_n(m))return k(v,c,m,w);Lr(v,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,c!==null&&c.tag===6?(n(v,c.sibling),c=l(c,m),c.return=v,v=c):(n(v,c),c=ci(m,v.mode,w),c.return=v,v=c),s(v)):n(v,c)}return L}var gn=Iu(!0),Au=Iu(!1),dl=Tt(null),fl=null,ln=null,$s=null;function zs(){$s=ln=fl=null}function Ms(e){var t=dl.current;V(dl),e._currentValue=t}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fn(e,t){fl=e,$s=ln=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ge=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if($s!==e)if(e={context:e,memoizedValue:t,next:null},ln===null){if(fl===null)throw Error(N(308));ln=e,fl.dependencies={lanes:0,firstContext:e}}else ln=ln.next=e;return t}var It=null;function Fs(e){It===null?It=[e]:It.push(e)}function Ou(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Fs(t)):(n.next=l.next,l.next=n),t.interleaved=n,lt(e,r)}function lt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var dt=!1;function Is(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Uu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function tt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,F&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,lt(e,n)}return l=r.interleaved,l===null?(t.next=t,Fs(r)):(t.next=l.next,l.next=t),r.interleaved=t,lt(e,n)}function Qr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,js(e,n)}}function Go(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function pl(e,t,n,r){var l=e.updateQueue;dt=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var u=a,d=u.next;u.next=null,s===null?i=d:s.next=d,s=u;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=d:a.next=d,f.lastBaseUpdate=u))}if(i!==null){var p=l.baseState;s=0,f=d=u=null,a=i;do{var h=a.lane,g=a.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var y=e,k=a;switch(h=t,g=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){p=y.call(g,p,h);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,h=typeof y=="function"?y.call(g,p,h):y,h==null)break e;p=Q({},p,h);break e;case 2:dt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[a]:h.push(a))}else g={eventTime:g,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(d=f=g,u=p):f=f.next=g,s|=h;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;h=a,a=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(f===null&&(u=p),l.baseState=u,l.firstBaseUpdate=d,l.lastBaseUpdate=f,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Ht|=s,e.lanes=s,e.memoizedState=p}}function Yo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ii.transition;ii.transition={};try{e(!1),t()}finally{A=n,ii.transition=r}}function rc(){return ze().memoizedState}function Kf(e,t,n){var r=jt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},lc(e))ic(t,n);else if(n=Ou(e,t,n,r),n!==null){var l=fe();Ve(n,e,r,l),sc(n,t,r)}}function Gf(e,t,n){var r=jt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(lc(e))ic(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(l.hasEagerState=!0,l.eagerState=a,We(a,s)){var u=t.interleaved;u===null?(l.next=l,Fs(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Ou(e,t,l,r),n!==null&&(l=fe(),Ve(n,e,r,l),sc(n,t,r))}}function lc(e){var t=e.alternate;return e===H||t!==null&&t===H}function ic(e,t){Wn=ml=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,js(e,n)}}var vl={readContext:$e,useCallback:se,useContext:se,useEffect:se,useImperativeHandle:se,useInsertionEffect:se,useLayoutEffect:se,useMemo:se,useReducer:se,useRef:se,useState:se,useDebugValue:se,useDeferredValue:se,useTransition:se,useMutableSource:se,useSyncExternalStore:se,useId:se,unstable_isNewReconciler:!1},Yf={readContext:$e,useCallback:function(e,t){return Qe().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Zo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gr(4194308,4,qu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gr(4,2,e,t)},useMemo:function(e,t){var n=Qe();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qe();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Kf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Qe();return e={current:e},t.memoizedState=e},useState:Xo,useDebugValue:Qs,useDeferredValue:function(e){return Qe().memoizedState=e},useTransition:function(){var e=Xo(!1),t=e[0];return e=Qf.bind(null,e[1]),Qe().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=Qe();if(W){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Bt&30||Hu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Zo(Ku.bind(null,r,i,e),[e]),r.flags|=2048,ar(9,Qu.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Qe(),t=ne.identifierPrefix;if(W){var n=et,r=be;n=(r&~(1<<32-Ue(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=sr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Ke]=t,e[lr]=r,vc(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ei(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lwn&&(t.flags|=128,r=!0,Rn(i,!1),t.lanes=4194304)}else{if(!r)if(e=hl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!W)return oe(t),null}else 2*Z()-i.renderingStartTime>wn&&n!==1073741824&&(t.flags|=128,r=!0,Rn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Z(),t.sibling=null,n=B.current,O(B,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Js(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ke&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function tp(e,t){switch(Rs(t),t.tag){case 1:return xe(t.type)&&ol(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),V(ye),V(ce),Us(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Os(t),null;case 13:if(V(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(B),null;case 4:return yn(),null;case 10:return Ms(t.type._context),null;case 22:case 23:return Js(),null;case 24:return null;default:return null}}var Dr=!1,ue=!1,np=typeof WeakSet=="function"?WeakSet:Set,P=null;function sn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function bi(e,t,n){try{n()}catch(r){G(e,t,r)}}var oa=!1;function rp(e,t){if(Fi=rl,e=Nu(),Ps(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,d=0,f=0,p=e,h=null;t:for(;;){for(var g;p!==n||l!==0&&p.nodeType!==3||(a=s+l),p!==i||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)!==null;)h=p,p=g;for(;;){if(p===e)break t;if(h===n&&++d===l&&(a=s),h===i&&++f===r&&(u=s),(g=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ii={focusedElem:e,selectionRange:n},rl=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,L=y.memoizedState,v=t.stateNode,c=v.getSnapshotBeforeUpdate(t.elementType===t.type?k:Fe(t.type,k),L);v.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return y=oa,oa=!1,y}function Bn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&bi(t,n,i)}l=l.next}while(l!==r)}}function Dl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function es(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function xc(e){var t=e.alternate;t!==null&&(e.alternate=null,xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[lr],delete t[Ui],delete t[Of],delete t[Uf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function wc(e){return e.tag===5||e.tag===3||e.tag===4}function aa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ts(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sl));else if(r!==4&&(e=e.child,e!==null))for(ts(e,t,n),e=e.sibling;e!==null;)ts(e,t,n),e=e.sibling}function ns(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ns(e,t,n),e=e.sibling;e!==null;)ns(e,t,n),e=e.sibling}var re=null,Ie=!1;function ot(e,t,n){for(n=n.child;n!==null;)kc(e,t,n),n=n.sibling}function kc(e,t,n){if(Ge&&typeof Ge.onCommitFiberUnmount=="function")try{Ge.onCommitFiberUnmount(Sl,n)}catch{}switch(n.tag){case 5:ue||sn(n,t);case 6:var r=re,l=Ie;re=null,ot(e,t,n),re=r,Ie=l,re!==null&&(Ie?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Ie?(e=re,n=n.stateNode,e.nodeType===8?ni(e.parentNode,n):e.nodeType===1&&ni(e,n),bn(e)):ni(re,n.stateNode));break;case 4:r=re,l=Ie,re=n.stateNode.containerInfo,Ie=!0,ot(e,t,n),re=r,Ie=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&bi(n,t,s),l=l.next}while(l!==r)}ot(e,t,n);break;case 1:if(!ue&&(sn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){G(n,t,a)}ot(e,t,n);break;case 21:ot(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,ot(e,t,n),ue=r):ot(e,t,n);break;default:ot(e,t,n)}}function ua(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new np),t.forEach(function(r){var l=fp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Me(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ip(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,xl=0,F&6)throw Error(N(331));var l=F;for(F|=4,P=e.current;P!==null;){var i=P,s=i.child;if(P.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uZ()-Xs?Ot(e,0):Ys|=n),we(e,t)}function Pc(e,t){t===0&&(e.mode&1?(t=Nr,Nr<<=1,!(Nr&130023424)&&(Nr=4194304)):t=1);var n=fe();e=rt(e,t),e!==null&&(fr(e,t,n),we(e,n))}function dp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pc(e,n)}function fp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Pc(e,n)}var Lc;Lc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ge=!1,bf(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&zu(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yr(e,t),e=t.pendingProps;var l=mn(t,ce.current);fn(t,n),l=Ws(null,t,r,e,l,n);var i=Bs();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(i=!0,al(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Is(t),l.updater=Rl,t.stateNode=l,l._reactInternals=t,Ki(t,r,e,n),t=Xi(null,t,r,!0,i,n)):(t.tag=0,W&&i&&Ls(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=hp(r),e=Fe(r,e),l){case 0:t=Yi(null,t,r,e,n);break e;case 1:t=la(null,t,r,e,n);break e;case 11:t=na(null,t,r,e,n);break e;case 14:t=ra(null,t,r,Fe(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Yi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),la(e,t,r,l,n);case 3:e:{if(pc(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Uu(e,t),pl(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=xn(Error(N(423)),t),t=ia(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=ia(e,t,r,n,l);break e}else for(je=xt(t.stateNode.containerInfo.firstChild),Ne=t,W=!0,Ae=null,n=Au(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=lt(e,t,n);break e}de(e,t,r,n)}t=t.child}return t;case 5:return Vu(t),e===null&&Bi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ai(r,l)?s=null:i!==null&&Ai(r,i)&&(t.flags|=32),fc(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Bi(t),null;case 13:return hc(e,t,n);case 4:return As(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):de(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),na(e,t,r,l,n);case 7:return de(e,t,t.pendingProps,n),t.child;case 8:return de(e,t,t.pendingProps.children,n),t.child;case 12:return de(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,O(dl,r._currentValue),r._currentValue=s,i!==null)if(We(i.value,s)){if(i.children===l.children&&!ye.current){t=lt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=et(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?u.next=u:(u.next=f.next,f.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Hi(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Hi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}de(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,fn(t,n),l=$e(l),r=r(l),t.flags|=1,de(e,t,r,n),t.child;case 14:return r=t.type,l=Fe(r,t.pendingProps),l=Fe(r.type,l),ra(e,t,r,l,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Yr(e,t),t.tag=1,xe(r)?(e=!0,al(t)):e=!1,fn(t,n),oc(t,r,l),Ki(t,r,l,n),Xi(null,t,r,!0,e,n);case 19:return mc(e,t,n);case 22:return dc(e,t,n)}throw Error(N(156,t.tag))};function Rc(e,t){return lu(e,t)}function pp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new pp(e,t,n,r)}function bs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hp(e){if(typeof e=="function")return bs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ys)return 11;if(e===xs)return 14}return 2}function Nt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Jr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")bs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Zt:return Ut(n.children,l,i,t);case gs:s=8,l|=8;break;case vi:return e=Pe(12,n,t,l|2),e.elementType=vi,e.lanes=i,e;case gi:return e=Pe(13,n,t,l),e.elementType=gi,e.lanes=i,e;case yi:return e=Pe(19,n,t,l),e.elementType=yi,e.lanes=i,e;case Va:return zl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Oa:s=10;break e;case Ua:s=9;break e;case ys:s=11;break e;case xs:s=14;break e;case ut:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Pe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Ut(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Va,e.lanes=n,e.stateNode={isHidden:!1},e}function ci(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function di(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function mp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ql(0),this.expirationTimes=Ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ql(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function eo(e,t,n,r,l,i,s,a,u){return e=new mp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Is(i),e}function vp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mc)}catch(e){console.error(e)}}Mc(),Ma.exports=_e;var Fc=Ma.exports,Ic,ga=Fc;Ic=ga.createRoot,ga.hydrateRoot;const kp="modulepreload",jp=function(e){return"/"+e},ya={},Mt=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));l=Promise.allSettled(n.map(u=>{if(u=jp(u),u in ya)return;ya[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":kp,d||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return l.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};async function ae(e,t={}){const n=await fetch(e,{headers:{"content-type":"application/json"},...t,body:t.body?JSON.stringify(t.body):void 0});let r=null;try{r=await n.json()}catch{}if(!n.ok){const l=r!=null&&r.detail?typeof r.detail=="string"?r.detail:JSON.stringify(r.detail):`HTTP ${n.status}`;throw new Error(l)}return r}const Oe={stats:()=>ae("/api/stats"),search:e=>ae(`/api/search?q=${encodeURIComponent(e)}`),assess:(e,t=4)=>ae(`/api/assess/${e}?depth=${t}`),compare:e=>ae("/api/compare",{method:"POST",body:{ks:e}}),recallEvent:e=>ae(`/api/recall-event/${e}`),watchlist:()=>ae("/api/watchlist"),ingest:e=>ae("/api/ingest",{method:"POST",body:{k:e}}),review:(e,t,n,r)=>ae("/api/citation/review",{method:"POST",body:{src:e,dst:t,status:n,note:r}}),triage:(e,t)=>ae("/api/citation/triage",{method:"POST",body:{src:e,dst:t}}),save:(e,t)=>ae("/api/assessments",{method:"POST",body:{k:e,note:t}}),assessments:e=>ae(`/api/assessments${e?`?k=${e}`:""}`),investigations:(e,t=30)=>ae(`/api/investigations?limit=${t}${e?`&k=${e}`:""}`),investigation:e=>ae(`/api/investigations/${e}`),startInvestigation:(e,t,n="auto")=>ae("/api/investigations",{method:"POST",body:{k:e,request:t,mode:n}}),proposals:e=>ae(`/api/proposals${e?`?status=${e}`:""}`),decide:(e,t,n,r)=>ae(`/api/proposals/${e}/decision`,{method:"POST",body:{decision:t,reviewer:n,human:!0,note:r}})},Ac=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,Np=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,os={nodes:[{id:"a",x:11,y:7,r:3.6},{id:"b",x:27,y:7,r:2.8},{id:"c",x:11,y:19,r:3},{id:"d",x:23,y:19,r:2.6},{id:"e",x:11,y:31,r:3.4,past:!0}],threads:[["a","b"],["a","c"],["c","d"],["c","e"]]},Mr=Object.fromEntries(os.nodes.map(e=>[e.id,e]));function Oc({size:e=28,className:t="",title:n}){return o.jsxs("svg",{className:"mark "+t,width:e,height:e,viewBox:"0 0 38 38",role:n?"img":void 0,"aria-hidden":n?void 0:!0,"aria-label":n,children:[os.threads.map(([r,l],i)=>o.jsx("line",{className:`mark-thread t${i}`,x1:Mr[r].x,y1:Mr[r].y,x2:Mr[l].x,y2:Mr[l].y,pathLength:"1"},i)),os.nodes.map((r,l)=>o.jsx("circle",{className:`mark-node n${l}${r.past?" past":""}`,cx:r.x,cy:r.y,r:r.r},r.id))]})}function Sp({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Oc,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const lo="forebear:intro",_p=3e3,xa=2450;function Ep(){try{return!!sessionStorage.getItem(lo)}catch{return!0}}function Cp(){try{sessionStorage.setItem(lo,"seen")}catch{}}function Tp(){try{sessionStorage.removeItem(lo)}catch{}}function Pp({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,Cp(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,xa),f=h=>{(h.key==="Escape"||h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i())};return addEventListener("keydown",f),(p=l.current)==null||p.focus({preventScroll:!0}),()=>{clearTimeout(d),removeEventListener("keydown",f)}},[]);const[s,a]=_.useState(!1);if(_.useEffect(()=>{if(!t)return;const d=setTimeout(()=>a(!0),_p-xa+100);return()=>clearTimeout(d)},[t]),s)return null;const u="Forebear".split("");return o.jsxs("div",{className:"intro"+(t?" is-leaving":""),"data-testid":"intro",onClick:i,role:"dialog","aria-modal":"true","aria-label":"Forebear opening",children:[o.jsxs("div",{className:"intro-lockup","aria-hidden":"true",children:[o.jsx(Oc,{className:"intro-mark",size:116}),o.jsx("div",{className:"intro-word",children:u.map((d,f)=>o.jsx("span",{style:{animationDelay:`${.95+f*.045}s`},children:d},f))}),o.jsx("p",{className:"intro-tag",children:o.jsxs("span",{children:["Every clearance has ",o.jsx("em",{children:"a past."})]})})]}),o.jsx("span",{className:"sr-only",role:"status",children:"Forebear. Every clearance has a past."}),o.jsxs("button",{ref:l,className:"btn btn-line btn-sm intro-skip",onClick:d=>{d.stopPropagation(),i()},children:["Skip intro ",o.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}function Lp(e){const[t,n]=_.useState(()=>typeof matchMedia<"u"&&matchMedia(e).matches);return _.useEffect(()=>{const r=matchMedia(e),l=()=>n(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),t}const Kn=["mcp-client"],Gn={DESIGN_RECALL_ON_FILE:{tone:"alert",label:"Design-related recall on file",plain:"The candidate itself has a design-related recall on file."},REVIEW_LINEAGE:{tone:"amber",label:"Review lineage",plain:"A recall in the predicate lineage warrants documented review."},INSUFFICIENT_LINEAGE:{tone:"muted",label:"Lineage not checkable",plain:"The ancestry could not be checked from readable evidence."},NO_DESIGN_RECALL_SIGNAL:{tone:"calm",label:"No design-recall signal",plain:"No design-related recall in the readable verdict window. Not a safety finding."}},Uc={audit_unresolved:"The extraction audit could not resolve whether this is the predicate",audit_correction:"K-number supplied by the audit, not as printed in the PDF",name_mismatch:"The cited device's FDA name does not appear near the citation",different_fda_panel:"Cited device sits in a different FDA review panel",llm_label_only:"A predicate only because an LLM labelled the mention",client_confirmation_only:"Confirmed only through the automated MCP client, not a person",client_rejection_pending:"Rejected through the automated MCP client; kept until a person decides"};function Rp(e){if(!e)return[];if(e.review==="confirmed"&&!Kn.includes(e.reviewer))return[];const t=[];return e.audit==="unresolved"&&t.push("audit_unresolved"),e.audit==="corrected"&&t.push("audit_correction"),e.name_check==="mismatch"&&!["variant","corrected"].includes(e.audit)&&t.push("name_mismatch"),e.panel_check==="different"&&!["variant","corrected"].includes(e.audit)&&t.push("different_fda_panel"),e.kind!=null&&e.kind!=="predicate"&&e.ai_label==="predicate"&&t.push("llm_label_only"),e.kind!=null&&e.kind!=="predicate"&&e.review==="confirmed"&&Kn.includes(e.reviewer)&&t.push("client_confirmation_only"),e.review==="rejected"&&Kn.includes(e.reviewer)&&t.push("client_rejection_pending"),t}const mt=e=>!!(e!=null&&e.review)&&!Kn.includes(e.reviewer),Re={confirmed:{label:"Confirmed by a person",short:"Confirmed"},extracted:{label:"Machine-extracted",short:"Extracted"},disputed:{label:"Disputed evidence",short:"Disputed"},conditional:{label:"Conditional route",short:"Conditional"},rejected:{label:"Rejected by a person",short:"Rejected"},advisory:{label:"Advisory: suggested by an LLM or the MCP client, awaiting a person; not a verdict input",short:"Advisory"},retired:{label:"Retired: the refreshed FDA summary no longer cites it; kept for the record",short:"Retired"}};function Et(e){if(e!=null&&e.retired_at||(e==null?void 0:e.trust)==="retired")return{key:"retired",reasons:[]};if((e==null?void 0:e.review)==="rejected"&&mt(e))return{key:"rejected",reasons:[]};if(e!=null&&e.advisory||(e==null?void 0:e.trust)==="advisory")return{key:"advisory",reasons:[]};const t=Rp(e);return t.includes("audit_unresolved")?{key:"conditional",reasons:t}:t.length?{key:"disputed",reasons:t}:(e==null?void 0:e.review)==="confirmed"&&mt(e)?{key:"confirmed",reasons:t}:{key:"extracted",reasons:t}}function Dp(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function io(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function so(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const $p=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function De(e){if(!e)return"—";const[t,n,r]=String(e).slice(0,10).split("-").map(Number);return t?`${r} ${$p[(n||1)-1]} ${t}`:String(e)}const Vc=e=>e?String(e).slice(0,4):"";function wa(e,t){if(!e||!t)return null;const[n,r,l]=e.slice(0,10).split("-").map(Number),[i,s,a]=t.slice(0,10).split("-").map(Number);return(i-n)*12+(s-r)-(ar?1:0}function Wc(e,t){const n=zp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?wa(e,t):wa(t,e);return{relation:n<0?"before":"after",months:r,duration:Mp(r)}}function Bc(e,t,n="clause"){if(!e)return"";const{relation:r,duration:l}=e;return n==="chip"?r==="same-day"?`Recall began on the day of ${t}'s clearance`:`Recall began ${l} ${r} ${t}'s clearance`:r==="same-day"?`on the day ${t} was cleared`:`${l} ${r} ${t} was cleared`}function Mp(e){if(e==null)return"";const t=e<0,n=Math.abs(e),r=Math.floor(n/12),l=n%12,i=[r?`${r} yr`:"",l?`${l} mo`:""].filter(Boolean).join(" ")||"<1 mo";return t?`-${i}`:i}const Fp=(e,t)=>e?t?`${e}#page=${t}`:e:null,Ip={pdf_text_layer:"PDF text layer",ocr:"Local OCR of the scanned PDF",embedded_pdf_attachment:"Summary embedded in a PDF Portfolio"};function it(e,t=30){const n=(e||"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Ap(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function Op(e,t){const n=Gn[e];return n?Ap(e,t)?{tone:"muted",label:`${n.label} · provisional`,provisional:!0}:{tone:n.tone,label:n.label,provisional:!1}:{tone:"muted",label:e||"Unknown",provisional:!1}}const wh={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Up={direct_predicate_links_all_uncertain:"every direct predicate link rests on uncertain evidence",unresolved_predicate_citations:"predicate citations within two generations could not be resolved",direct_predicate_summaries_unread:"a direct predicate's own summary was not read",doubtful_links_in_window:"links within two generations rest on doubtful evidence",recall_cause_or_class_unknown:"a recall has no stated cause or FDA class",unattributed_recalls_in_product_code:"design-related recalls in the product code name no 510(k)",shallow_traversal:"grand-predicates were not traversed",advisory_links_pending_review:"predicate links suggested only by an LLM or the MCP client await a person",human_confirmed_citation_retired:"a citation a person confirmed is no longer in the refreshed FDA summary"},Hc={name_token_match:{short:"FDA-listed · name match (heuristic)",tone:"other",text:"FDA lists this 510(k) on the recall. A distinctive word of its FDA device name appears in the recall text, possibly as a fuzzy match. This heuristic does not verify that the recall names this exact model."},name_token_absent:{short:"FDA-listed · name not found (heuristic)",tone:"muted",text:"FDA lists this 510(k) on the recall, but no distinctive word of its FDA device name was found in the recall text. The recalled model may differ, or the text may name it differently."},name_not_checkable:{short:"FDA-listed · name not checked",tone:"muted",text:"FDA lists this 510(k) on the recall. No name check is available: its FDA device name has no distinctive word to look for, or no check was recorded for this link. Which model was recalled is not established here."}},fi={short:"Recall began before this clearance",text:"This recall began before this 510(k) was cleared, yet FDA lists it on the record. The dates alone do not establish whether this cleared model was affected: read the FDA record."},kh={after:"cleared after the recall began",before:"cleared before the recall began",same_day:"cleared the day the recall began (order unknown)",unknown:"timing unknown (a date is missing)"};function ka(e){return e!=null&&e.attribution&&Hc[e.attribution]?e.attribution:(e==null?void 0:e.link_name_check)==="match"?"name_token_match":(e==null?void 0:e.link_name_check)==="mismatch"?"name_token_absent":"name_not_checkable"}const pi=70,Fr=110,ja=46,Vp=62,Wp=190,Na=300;function Bp(e){return e.signals.filter(t=>{var n;return(t.severity==="high"||t.severity==="medium")&&((n=t.chain)==null?void 0:n.length)>1}).map(t=>t.chain)}function Hp(e,{depth:t,descendants:n}){const r=new Map,l=Bp(e),i=new Set(l.flat()),s=new Set;l.forEach(p=>p.slice(1).forEach((h,g)=>s.add(p[g]+">"+h))),r.set(e.k,{...e.device,k:e.k,gen:0,side:"self",recalls:e.device.recalls||[]});let a=0,u=new Set;for(const p of e.ancestors)p.gen<=t||i.has(p.k)?r.set(p.k,{...p,side:"up"}):(a++,u.add(p.gen));if(n)for(const p of e.descendants)r.set(p.k,{...p,side:"down"});const d=new Map,f=p=>{for(const h of p||[]){if(!r.has(h.src)||!r.has(h.dst))continue;const g=h.src+">"+h.dst;d.has(g)||d.set(g,{id:g,hop:h,status:Et(h),critical:s.has(g)})}};for(const p of e.ancestors)r.has(p.k)&&f(p.hops);if(n)for(const p of e.descendants)f(p.hops);return{nodes:r,edges:d,hidden:a,hiddenGens:[...u].sort(),critK:i,critE:s}}function Qp(e,t){var E;const{nodes:n,edges:r}=e,l=new Map;for(const j of n.values())((E=j.chain)==null?void 0:E.length)>1&&l.set(j.k,j.chain[j.chain.length-2]);const i=[...n.values()].filter(j=>j.side==="up").map(j=>j.gen),s=[...n.values()].filter(j=>j.side==="down").map(j=>j.gen),a=i.length?Math.max(...i):0,u=s.length?Math.max(...s):0,d=j=>j.side==="self"?a:j.side==="up"?a-j.gen:a+j.gen,f=new Map;for(const j of n.values()){const x=d(j);f.has(x)||f.set(x,[]),f.get(x).push(j)}const p=new Map([[[...n.values()].find(j=>j.side==="self").k,0]]),h=[...f.keys()].sort((j,x)=>Math.abs(j-a)-Math.abs(x-a)),g=Math.max(...[...f.values()].map(j=>j.length));for(const j of h){const x=f.get(j);x.sort((R,T)=>{const I=p.get(l.get(R.k))??0,K=p.get(l.get(T.k))??0;return I-K||(T.decision_date||"").localeCompare(R.decision_date||"")}),x.forEach((R,T)=>{R.side!=="self"&&p.set(R.k,(T-(x.length-1)/2)*pi)})}const y=a+u,k=y?Math.max(Wp,Math.min(Na,(t-Fr*2)/y)):Na,L=Math.max(t,Fr*2+y*k),v=Fr+(L-(Fr*2+y*k))/2,c=ja+Vp+Math.max(1,g)*pi,m=ja+Math.max(1,g)*pi/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:m+p.get(j.k)}])),S=[...f.keys()].map(j=>{const x=j-a;return{x:v+j*k,label:x===0?"Candidate":x<0?x===-1?"Predicates":x===-2?"Grand-predicates":`Generation ${-x}`:`Cites it · +${x}`}});return{pos:w,width:L,height:c,colLabels:S,edges:r}}function Kp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Hp(e,{depth:t,descendants:r}),[e,t,r]),u=_.useRef(null),[d,f]=_.useState(900);_.useEffect(()=>{const c=()=>u.current&&f(u.current.clientWidth);c();const m=new ResizeObserver(c);return m.observe(u.current),()=>m.disconnect()},[]);const p=_.useMemo(()=>Qp(a,d),[a,d]),[h,g]=_.useState(null);_.useEffect(()=>{const c=u.current;c&&(c.scrollLeft=c.scrollWidth)},[e.k,p.width]);const y=_.useMemo(()=>{const c=h||null;if(!c)return s?new Set(s):null;const m=a.nodes.get(c);return new Set((m==null?void 0:m.chain)||[c])},[h,a,s]),k=c=>{if(!y)return!0;const[m,w]=c.split(">");return y.has(m)&&y.has(w)},L=c=>{const m=c.recalls||[],w=m.filter(S=>S.design_related).length;return`${c.k}, ${c.name||"unnamed"}, cleared ${c.decision_date||"date unknown"}. `+(c.side==="self"?"Candidate. ":c.side==="up"?`Generation ${c.gen} predicate. `:`Cites the candidate, ${c.gen} generation(s) later. `)+(m.length?`${m.length} recall record(s), ${w} design-related. `:"No recall records. ")+(c.lineage_known===!1?"Its own predicates were not read.":"")},v=c=>m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())};return o.jsxs("div",{children:[o.jsx("div",{className:"graph-wrap",ref:u,"data-testid":"evidence-graph",children:o.jsxs("svg",{width:p.width,height:p.height,role:"group","aria-label":`Predicate lineage graph for ${e.k}: ${a.nodes.size} devices, ${a.edges.size} citations`,children:[p.colLabels.map(c=>o.jsxs("g",{children:[o.jsx("line",{className:"g-col-rule",x1:c.x,x2:c.x,y1:30,y2:p.height-10}),o.jsx("text",{className:"g-col-label",x:c.x,y:20,textAnchor:"middle",children:c.label})]},c.x)),[...a.edges.values()].map(c=>{const m=p.pos.get(c.hop.src),w=p.pos.get(c.hop.dst),S=(m.x+w.x)/2,E=`M${m.x-12},${m.y} C${S},${m.y} ${S},${w.y} ${w.x+12},${w.y}`,j=c.status.key,x=!k(c.id),R=(l==null?void 0:l.type)==="edge"&&l.id===c.id;return o.jsxs("g",{className:"g-edge-g",tabIndex:0,role:"button","aria-label":`Citation: ${c.hop.src} cites ${c.hop.dst}${c.hop.page?`, page ${c.hop.page}`:""}. ${Re[j].label}. Open provenance.`,"aria-pressed":R,onClick:()=>i({type:"edge",id:c.id,hop:c.hop}),onKeyDown:v(()=>i({type:"edge",id:c.id,hop:c.hop})),children:[o.jsx("path",{d:E,className:`g-edge st-${j}${c.critical?" is-critical":""}${x?" is-dim":""}`,style:R?{opacity:1,strokeWidth:3.2}:void 0}),c.critical&&!x&&o.jsx("path",{d:E,className:"g-flow"}),o.jsx("path",{d:E,className:"g-edge-hit"}),o.jsx("rect",{x:S-22,y:(m.y+w.y)/2-9,width:44,height:18,rx:9,fill:"transparent",style:{cursor:"pointer"}}),o.jsx("title",{children:`${c.hop.src} → ${c.hop.dst} · p.${c.hop.page??"?"} · ${Re[j].label}`})]},c.id)}),[...a.nodes.values()].map(c=>{const m=p.pos.get(c.k),w=io(c),S=c.side==="self",E=S?11:8,j=y&&!y.has(c.k),x=(l==null?void 0:l.type)==="node"&&l.k===c.k;return o.jsxs("g",{transform:`translate(${m.x},${m.y})`,tabIndex:0,role:"button","aria-label":L(c),"aria-pressed":x,className:`g-node${S?" is-self":""}${j?" is-dim":""}${x?" is-selected":""}`,"data-k":c.k,onMouseEnter:()=>g(c.k),onMouseLeave:()=>g(null),onFocus:()=>g(c.k),onBlur:()=>g(null),onClick:()=>i({type:"node",k:c.k}),onKeyDown:v(()=>i({type:"node",k:c.k})),children:[w==="design"&&!S&&o.jsx("circle",{className:"glow",r:E*2.2}),o.jsx("circle",{className:"halo",r:E+5}),o.jsx("circle",{className:`dot tone-${w}${c.lineage_known===!1?" unread":""}`,r:E}),o.jsx("text",{className:"lk",y:-E-9,textAnchor:"middle",children:c.k}),o.jsxs("text",{className:"ln",y:E+16,textAnchor:"middle",children:[it(c.name,26)," · ",Vc(c.decision_date)]})]},c.k)}),a.hidden>0&&o.jsxs("g",{className:"g-more",tabIndex:0,role:"button",transform:`translate(14, ${p.height-40})`,"aria-label":`Show ${a.hidden} more ancestors in generations ${a.hiddenGens.join(", ")}`,onClick:()=>n(Math.max(...a.hiddenGens)),onKeyDown:v(()=>n(Math.max(...a.hiddenGens))),children:[o.jsx("rect",{width:"212",height:"28",rx:"14"}),o.jsxs("text",{x:"106",y:"18.5",textAnchor:"middle",children:["+ ",a.hidden," more in generation",a.hiddenGens.length>1?`s ${a.hiddenGens[0]}–${a.hiddenGens[a.hiddenGens.length-1]}`:` ${a.hiddenGens[0]}`]})]})]})}),o.jsxs("div",{className:"g-legend","aria-label":"Legend",children:[o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-design"}),"design-related recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-recall"}),"other recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-clean"}),"no recall record"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-unread"}),"own predicates unread"]}),o.jsx("span",{className:"sep","aria-hidden":"true"}),["confirmed","extracted","disputed","conditional"].map(c=>o.jsxs("span",{className:`status status-${c}`,children:[o.jsx("span",{className:"line"}),Re[c].short]},c)),o.jsxs("span",{className:"status",style:{color:"var(--amber)"},children:[o.jsx("span",{className:"line"}),"critical chain"]})]}),o.jsx("div",{className:"graph-hint",children:"Select any device or thread for its record, quote, page and source PDF. Tab moves between them; Enter opens."})]})}const Dt=28,Ir=34,hi=260,at=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Gp(e,t){const n=new Map,r=(u,d,f,p)=>{n.has(u.k)||n.set(u.k,{...u,side:d,gen:f,parent:p,children:[]})};r({...e.device,k:e.k},"self",0,null);for(const u of e.ancestors)u.gen<=t&&r(u,"up",u.gen,u.chain[u.chain.length-2]);for(const u of e.descendants)r(u,"down",u.gen,u.chain[u.chain.length-2]);for(const u of n.values())u.parent&&n.has(u.parent)&&n.get(u.parent).children.push(u.k);const l=(u,d)=>(n.get(u).decision_date||"").localeCompare(n.get(d).decision_date||""),i=[],s=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="down").sort(l).reverse())s(d),i.push(d)},a=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="up").sort(l).reverse())i.push(d),a(d)};return s(e.k),i.push(e.k),a(e.k),{nodes:n,order:i}}function Yp({a:e,depth:t,highlight:n,onSelect:r}){const l=_.useRef(null),[i,s]=_.useState(1e3);_.useEffect(()=>{const x=()=>l.current&&s(Math.max(760,l.current.clientWidth));x();const R=new ResizeObserver(x);return R.observe(l.current),()=>R.disconnect()},[]);const{nodes:a,order:u}=_.useMemo(()=>Gp(e,t),[e,t]),d=new Map(u.map((x,R)=>[x,R])),f=[];for(const x of a.values()){x.decision_date&&f.push(at(x.decision_date));for(const R of x.recalls||[])R.initiated&&f.push(at(R.initiated))}const p=new Date(Math.min(...f)).getUTCFullYear(),h=new Date(Math.max(...f)).getUTCFullYear()+1,g=Date.UTC(p,0,1),y=Date.UTC(h,0,1),k=i-hi-40,L=x=>16+(x-g)/(y-g)*k,v=x=>Ir+x*Dt+Dt/2,c=Ir+u.length*Dt+16,m=new Set(n||[]),w=new Set;if(n)for(let x=0;x+1"+n[x+1]);const S=h-p>24?4:h-p>12?2:1,E=[];for(let x=p;x<=h;x+=S)E.push(x);const j=L(at(e.device.decision_date));return o.jsx("div",{className:"graph-wrap",ref:l,"data-testid":"timeline",children:o.jsxs("svg",{width:i,height:c,role:"group","aria-label":`Lineage timeline for ${e.k}`,children:[E.map(x=>o.jsxs("g",{children:[o.jsx("line",{className:"tl-grid",x1:L(Date.UTC(x,0,1)),x2:L(Date.UTC(x,0,1)),y1:Ir-8,y2:c-8}),o.jsx("text",{className:"tl-axis",x:L(Date.UTC(x,0,1)),y:18,textAnchor:"middle",children:x})]},x)),o.jsx("rect",{x:0,y:v(d.get(e.k))-Dt/2,width:i,height:Dt,className:"tl-band"}),o.jsx("line",{className:"tl-clear",x1:j,x2:j,y1:Ir-8,y2:c-8}),[...a.values()].filter(x=>x.parent&&a.has(x.parent)).map(x=>{const[R,T]=x.side==="up"?[x.parent,x.k]:[x.k,x.parent],I=a.get(R),K=a.get(T);if(!I.decision_date||!K.decision_date)return null;const me=L(at(I.decision_date)),Be=v(d.get(R)),Y=L(at(K.decision_date)),Xe=v(d.get(T)),M=(me+Y)/2;return o.jsx("path",{d:`M${me-6},${Be} C${M},${Be} ${M},${Xe} ${Y+7},${Xe}`,className:"tl-edge"+(w.has(R+">"+T)?" on":"")},R+T)}),u.map((x,R)=>{const T=a.get(x);if(!T.decision_date)return null;const I=L(at(T.decision_date)),K=v(R),me=io(T),Be=m.size&&!m.has(x);return o.jsxs("g",{className:"tl-row g-node",style:{opacity:Be?.3:1},tabIndex:0,role:"button","aria-label":`${x} ${T.name}, cleared ${T.decision_date}, ${(T.recalls||[]).length} recall records`,onClick:()=>r({type:"node",k:x}),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),r({type:"node",k:x}))},children:[o.jsx("rect",{className:"tl-rowhit",x:0,y:K-Dt/2,width:i,height:Dt}),(T.recalls||[]).map(Y=>Y.initiated&&o.jsxs("g",{children:[o.jsx("line",{className:"tl-rlink",x1:I,x2:L(at(Y.initiated)),y1:K,y2:K}),o.jsx("path",{d:`M${L(at(Y.initiated))},${K-5} l5,5 l-5,5 l-5,-5 z`,className:"tl-dia "+(Y.design_related?"design":"other"),children:o.jsx("title",{children:`${Y.id} · ${Y.classification||"unclassified"} · ${Y.root_cause} · began ${Y.initiated}`})})]},Y.id)),o.jsx("circle",{cx:I,cy:K,r:x===e.k?7:5.5,className:`dot tone-${me}${T.lineage_known===!1?" unread":""}`,style:x===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),o.jsxs("text",{x:i-hi+8,y:K+4,className:"tl-label",children:[o.jsx("tspan",{className:"lk",children:x}),o.jsx("tspan",{dx:"7",children:it(T.name,24)})]}),o.jsx("text",{x:i-hi-6,y:K+4,textAnchor:"end",className:"tl-gen",children:T.side==="self"?"candidate":T.side==="up"?`G-${T.gen}`:`D+${T.gen}`})]},x)})]})})}function Qc({text:e,k:t,ocr:n}){if(!e)return o.jsx("p",{className:"quote muted",children:"No quote stored for this citation."});const r=t?e.split(new RegExp(`(${t.replace(/^K/,"K\\s?")})`)):[e];return o.jsxs("blockquote",{className:"quote"+(n?" is-ocr":""),children:["“",/^[a-z]/.test(e)?"…":"",r.map((l,i)=>i%2?o.jsx("mark",{children:l},i):o.jsx(Nl.Fragment,{children:l},i)),"”"]})}function Xp({hop:e}){const t=Et(e);return o.jsxs("span",{className:`status status-${t.key}`,children:[o.jsx("span",{className:"line"}),Re[t.key].label]})}function Kc({r:e}){const t=Dp(e),n=Hc[ka(e)];return o.jsxs("div",{className:"recall","data-attribution":ka(e),children:[o.jsxs("div",{className:"recall-h",children:[o.jsx("span",{className:`chip tone-${t}`,children:t==="design"?"Design-related":t==="class1"?"Class I, other cause":"Other cause"}),o.jsx("span",{className:"k mono",children:e.id}),o.jsxs("span",{className:"muted",children:[e.classification||"Unclassified"," · ",e.root_cause||"cause not stated"," · began ",De(e.initiated)]}),e.url&&o.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:"FDA record ↗"})]}),o.jsxs("div",{className:"recall-r",children:[o.jsx("span",{className:`chip tone-${n.tone}`,title:n.text,children:n.short})," ",o.jsx("span",{className:"muted small",children:n.text})]}),e.linked_before_clearance&&o.jsxs("div",{className:"recall-r","data-testid":"recall-predates",children:[o.jsx("span",{className:"chip tone-muted",title:fi.text,children:fi.short})," ",o.jsx("span",{className:"muted small",children:fi.text})]}),e.reason&&o.jsx("div",{className:"recall-r",children:e.reason}),e.status&&o.jsxs("div",{className:"recall-r",children:["Status: ",e.status,e.event?` · event ${e.event}`:"",e.firm?` · ${e.firm}`:""]})]})}function kn(e,t){return t===e.k?{...e.device,k:e.k,gen:0,side:"self"}:e.ancestors.find(n=>n.k===t)&&{...e.ancestors.find(n=>n.k===t),side:"up"}||e.descendants.find(n=>n.k===t)&&{...e.descendants.find(n=>n.k===t),side:"down"}||null}function Zp({sel:e,a:t,onClose:n,go:r,reload:l,onSelect:i}){const s=_.useRef(null),a=_.useRef(null);return _.useEffect(()=>{var f;const u=document.activeElement;(f=a.current)==null||f.focus();const d=p=>{if(p.key==="Escape"&&n(),p.key==="Tab"&&s.current){const h=s.current.querySelectorAll('a[href], button:not([disabled]), input, textarea, [tabindex="0"]');if(!h.length)return;const g=h[0],y=h[h.length-1];p.shiftKey&&document.activeElement===g?(p.preventDefault(),y.focus()):!p.shiftKey&&document.activeElement===y&&(p.preventDefault(),g.focus())}};return addEventListener("keydown",d),()=>{var p;removeEventListener("keydown",d),(p=u==null?void 0:u.focus)==null||p.call(u)}},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:n}),o.jsx("aside",{className:"drawer",ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"drawer-title","data-testid":"provenance",children:e.type==="edge"?o.jsx(Jp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(qp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function as({eyebrow:e,children:t,closeBtn:n,onClose:r}){return o.jsxs("div",{className:"drawer-head",children:[o.jsxs("div",{className:"t",children:[o.jsx("p",{className:"eyebrow",children:e}),o.jsx("h2",{id:"drawer-title",children:t})]}),o.jsx("button",{ref:n,className:"btn btn-quiet",onClick:r,"aria-label":"Close provenance (Escape)",children:"✕"})]})}function Jp({sel:e,a:t,closeBtn:n,onClose:r,go:l,reload:i,onSelect:s}){const a=e.hop,u=kn(t,a.src)||{},d=kn(t,a.dst)||{},f=Et(a),[p,h]=_.useState(!1),[g,y]=_.useState(null),k=a.source_url||u.summary_url,L=(a.text_source||u.text_source)&&(a.text_source||u.text_source)!=="pdf_text_layer",v=async c=>{h(!0),y(null);try{const m=await Oe.review(a.src,a.dst,c);y({ok:!0,text:c?`Recorded: ${c}. The assessment has been recomputed from the graph.`:"Review cleared. The assessment has been recomputed."}),s({...e,hop:{...a,review:(m==null?void 0:m.review)??(c||null),reviewer:(m==null?void 0:m.reviewer)??(c?"user":null)}}),i()}catch(m){y({ok:!1,text:m.message})}finally{h(!1)}};return o.jsxs(o.Fragment,{children:[o.jsxs(as,{eyebrow:"Citation provenance",closeBtn:n,onClose:r,children:[o.jsx("span",{className:"k",children:a.src})," cites ",o.jsx("span",{className:"k",children:a.dst})]}),o.jsxs("div",{className:"drawer-body",children:[o.jsxs("div",{className:"drawer-sec",children:[o.jsx(Xp,{hop:a}),f.reasons.length>0&&o.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:"var(--ink-2)",fontSize:12.5},children:f.reasons.map(c=>o.jsx("li",{children:Uc[c]||c},c))}),f.key==="conditional"&&o.jsxs("p",{className:"note-box violet",style:{marginTop:10},children:["Recall signals reached through this thread are ",o.jsx("b",{children:"conditional"}),": they hold only if this citation is a predicate. Read the page, then confirm or reject it: your review rewrites the verdict."]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"What the summary says"}),o.jsx(Qc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:Fp(k,a.page),target:"_blank",rel:"noreferrer","data-testid":"pdf-page-link",children:[o.jsx("span",{className:"sheet",children:o.jsxs("b",{children:["p.",a.page??"?"]})}),o.jsxs("span",{className:"tx",children:[o.jsxs("b",{children:["Open the original FDA PDF",a.page?` at page ${a.page}`:""," ↗"]}),o.jsxs("span",{children:[a.src," 510(k) summary · accessdata.fda.gov"]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Source and extraction"}),o.jsxs("dl",{className:"prov-grid",children:[o.jsx("dt",{children:"Citing device"}),o.jsxs("dd",{children:[a.src," · ",it(u.name,40),u.decision_date?` · ${De(u.decision_date)}`:""]}),o.jsx("dt",{children:"Cited device"}),o.jsxs("dd",{children:[a.dst," · ",it(d.name,40),d.decision_date?` · ${De(d.decision_date)}`:""]}),o.jsx("dt",{children:"Role"}),o.jsx("dd",{children:a.kind||"predicate"}),o.jsx("dt",{children:"Page"}),o.jsx("dd",{children:a.page??"not recorded"}),o.jsx("dt",{children:"Text source"}),o.jsx("dd",{children:Ip[a.text_source||u.text_source]||a.text_source||u.text_source||"not recorded"}),o.jsx("dt",{children:"Extraction"}),o.jsxs("dd",{children:[a.method||"—",a.confidence!=null?` · confidence ${a.confidence}`:""]}),o.jsx("dt",{children:"Name check"}),o.jsx("dd",{children:a.name_check||"—"}),o.jsx("dt",{children:"FDA panel"}),o.jsx("dd",{children:a.panel_check||"—"}),a.audit&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Audit"}),o.jsxs("dd",{children:[a.audit,a.audit_note?` — ${a.audit_note}`:""]})]}),a.ai_label&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"LLM label"}),o.jsxs("dd",{children:[a.ai_label,a.ai_model?` · ${a.ai_model}`:""," (advisory; never a verdict input until a person confirms)"]})]}),o.jsx("dt",{children:"Review"}),o.jsx("dd",{children:a.review?`${a.review} by ${a.reviewer||"unknown"}${Kn.includes(a.reviewer)?" (automated client; advisory)":""}`:"not reviewed by a person"}),o.jsx("dt",{children:"Trust"}),o.jsx("dd",{"data-testid":"edge-trust",children:Re[Et(a).key].label}),a.retired_at&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Retired"}),o.jsxs("dd",{children:[De(a.retired_at)," · no longer cited by the refreshed summary"]})]}),u.summary_sha256&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"PDF SHA-256"}),o.jsx("dd",{children:o.jsx("span",{className:"mono",children:u.summary_sha256})})]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Your review"}),o.jsxs("div",{className:"drawer-acts",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="confirmed"&&mt(a)?"":"confirmed"),children:a.review==="confirmed"&&mt(a)?"Clear confirmation":"Confirm citation"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="rejected"&&mt(a)?"":"rejected"),children:a.review==="rejected"&&mt(a)?"Restore citation":"Reject citation"})]}),o.jsx("p",{className:"note",style:{marginTop:8},children:"A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately."}),g&&o.jsx("p",{className:g.ok?"ok":"err",role:"status",children:g.text})]}),o.jsxs("div",{className:"drawer-acts",children:[o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.dst}),children:[a.dst," record →"]}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.src}),children:[a.src," record →"]})]})]})]})}function qp({sel:e,a:t,closeBtn:n,onClose:r,go:l,onSelect:i}){var p,h;const s=kn(t,e.k);if(!s)return o.jsxs(o.Fragment,{children:[o.jsx(as,{eyebrow:"Device",closeBtn:n,onClose:r,children:e.k}),o.jsx("div",{className:"drawer-body",children:"Not in this view."})]});const a=[...s.recalls||[]].sort((g,y)=>y.design_related-g.design_related||(g.initiated||"").localeCompare(y.initiated||"")),u=so(a),d=s.side==="self"?"Candidate":s.side==="up"?{1:"Direct predicate",2:"Grand-predicate"}[s.gen]||`Generation ${s.gen} ancestor`:`Later device citing this lineage (+${s.gen})`,f=a.filter(g=>g.initiated&&t.device.decision_date&&g.initiated1&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Route"}),o.jsx("dd",{className:"mono",style:{fontSize:12},children:s.chain.join(" → ")})]})]}),o.jsxs("div",{className:"drawer-acts",children:[s.k!==t.k&&o.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>l("check",s.k),children:["Investigate ",s.k," ",o.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),o.jsx("a",{className:"btn btn-line btn-sm",href:Ac(s.k),target:"_blank",rel:"noreferrer",children:"FDA 510(k) record ↗"}),s.summary_url&&o.jsx("a",{className:"btn btn-line btn-sm",href:s.summary_url,target:"_blank",rel:"noreferrer",children:"Summary PDF ↗"}),s.lineage_known===!1&&o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>l("ingest",s.k),children:"Try to read its summary"})]}),((h=s.hops)==null?void 0:h.length)>0&&o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"How it is reached"}),o.jsx("div",{className:"tags",children:s.hops.map(g=>o.jsxs("button",{className:"tag-btn",onClick:()=>i({type:"edge",id:g.src+">"+g.dst,hop:g}),children:[o.jsx("span",{className:"k",children:g.src})," → ",o.jsx("span",{className:"k",children:g.dst})," · p.",g.page??"?"," · ",Re[Et(g).key].short]},g.src+g.dst))})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsxs("h3",{children:["Recall records on which FDA lists this 510(k) · ",u.events," event(s), ",u.records," product record(s)"]}),s.side!=="self"&&f.length>0&&o.jsxs("p",{className:"note-box amber",style:{marginBottom:10},children:[f.length," of these record(s) began before ",t.k," was cleared on ",De(t.device.decision_date),"."]}),a.length===0?o.jsx("p",{className:"muted",children:"openFDA lists this 510(k) on no recall record."}):o.jsx("div",{style:{display:"grid",gap:8},children:a.slice(0,20).map(g=>o.jsx(Kc,{r:g},g.id))}),a.length>20&&o.jsxs("p",{className:"muted small",children:["+ ",a.length-20," more record(s): open the device to see all."]})]})]})]})}const bp={rejected_by_reviewer:"rejected by a reviewer",audit_not_predicate:"the audit found it is not a predicate citation",audit_error:"the audit found a K-number error",audit_unresolved:"the audit could not resolve it",not_in_openfda:"K-number not found in openFDA",cleared_after_citing_device:"K-number cleared after the citing device",audit_variant:"audit marked it a naming variant",audit_corrected:"K-number corrected by the audit"};function Gc(e){const t=[];for(const n of e.signals)switch(n.code){case"DIRECT_RECALL":if(n.severity==="info")break;t.push({id:n.code,tone:n.severity==="high"?"alert":"amber",sev:n.severity,title:n.title,what:"The candidate itself appears in FDA recall records.",why:n.severity==="high"?"A design-related recall on the device you would cite is what FDA's 2023 draft guidance asks you to avoid or explain.":"A Class I recall on the candidate is a documented question for any submission that cites it.",todo:"Open each recall record and document how it is addressed (scope, lots, corrective action).",node:e.k});break;case"ANCESTOR_RECALL":if(n.severity!=="medium")break;t.push({id:n.code+n.chain.join(),tone:n.conditional?"violet":"amber",sev:n.severity,title:n.title,conditional:n.conditional,what:n.conditional?"The recall holder is reached only through a citation the audit could not resolve.":`A ${n.gen===1?"direct predicate":"grand-predicate"} carries recall records the verdict rules treat as review-worthy.`,why:n.conditional?"If that citation is not a predicate, this recall does not belong to the lineage; if it is, it does.":"Reviewers expect the predicate rationale to address design-related recalls in the lineage (FDA 2023 draft guidance; Kadakia et al., JAMA 2023, an association).",todo:n.conditional?"Open the uncertain thread, read the PDF page, and confirm or reject it.":"Verify the citation on its PDF page, read the recall records, and record how the rationale addresses them.",chain:n.chain,hops:n.evidence.filter(r=>r.type==="citation")});break;case"UNCERTAIN_LINK_IN_LINEAGE":case"NAME_MISMATCH_IN_LINEAGE":t.push({id:n.code,tone:"alert",sev:"info",title:n.title,what:"Threads in this ancestry rest on evidence that conflicts with FDA records or needed correction.",why:"A doubtful thread may route the lineage to the wrong device, and the right one may be missing; these links never count as checked.",todo:"Open each thread, compare the quote with the cited device, then confirm or reject it.",hops:n.evidence.filter(r=>r.type==="citation")});break;case"ADVISORY_LINK_PENDING_REVIEW":t.push({id:n.code,tone:"violet",sev:"info",title:n.title,what:"An LLM label or the automated MCP client calls these citations predicates; no person has decided.",why:"They are not used for the verdict. If one is a real predicate, its recalls belong in the lineage and the verdict could change.",todo:"Open each link, read the PDF page, and confirm or reject it yourself.",hops:n.evidence.filter(r=>r.type==="advisory_citation")});break;case"CITATION_RETIRED_BY_REINGEST":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Re-reading the citing device's FDA summary no longer found these citations, so they were retired from the lineage.",why:"Earlier reviews, labels and provenance are kept for the record; a review made on the old text may no longer apply.",todo:"Compare the refreshed summary with the earlier one and record a new review if the citation still matters.",hops:n.evidence});break;case"PREDICATE_CITATION_UNRESOLVED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Predicate citations printed in a summary did not become lineage threads.",why:"A missing thread means part of the ancestry is invisible: a recall there would not show.",todo:"Check each quote. If the citation is real and the K-number valid, add that clearance to extend the graph.",missing:n.evidence});break;case"LINEAGE_UNKNOWN":case"LINEAGE_TRUNCATED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Some summaries are not machine-readable, so the ancestry stops there.",why:"Recalls further up those branches cannot be seen. The verdict reports this gap; it never fills it in.",todo:"Try reading each summary live (needs internet), which extends the lineage by one generation.",ingest:n.code==="LINEAGE_UNKNOWN"?[{k:e.k}]:n.evidence});break;case"UNATTRIBUTED_RECALLS_IN_PRODUCT_CODE":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"FDA filed these recalls under the product code without naming a 510(k) number.",why:"No lineage query can attribute them; one may still concern a device in this lineage.",todo:"Read the product descriptions and check whether any names a device in this ancestry.",recalls:n.evidence});break;case"RECALL_CAUSE_OR_CLASS_UNKNOWN":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Recall records without a stated root cause or FDA classification.",why:"They cannot be ruled out as design-related or Class I, so they could change the verdict once classified.",todo:"Re-check the FDA records for an updated classification or root cause.",recalls:n.evidence});break;case"DEEPER_ANCESTRY_GAPS":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Gaps beyond the two-generation verdict window.",why:"They cannot change the verdict, but the lower-severity list may be incomplete.",todo:"Expand the graph to deeper generations if the deeper ancestry matters to your rationale."});break}return t}function eh({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Gc(e);return l.length?o.jsx("div",{"data-testid":"review-queue",children:l.map(i=>{var s,a,u,d;return o.jsxs("section",{className:`review-item tone-${i.tone}`,onMouseEnter:()=>i.chain&&r(i.chain),onMouseLeave:()=>r(null),children:[o.jsxs("h3",{children:[o.jsx("span",{className:`sev sev-${i.sev}`,children:i.conditional?"conditional":i.sev==="info"?"gap":i.sev}),o.jsx("span",{children:i.title})]}),o.jsxs("dl",{children:[o.jsx("dt",{children:"Conflict"}),o.jsx("dd",{children:i.what}),o.jsx("dt",{children:"Why it matters"}),o.jsx("dd",{children:i.why}),o.jsx("dt",{children:"Next step"}),o.jsx("dd",{children:i.todo})]}),((s=i.hops)==null?void 0:s.length)>0&&o.jsx("div",{className:"links",children:i.hops.slice(0,8).map(f=>{const p=Et(f);return o.jsxs("button",{className:"tag-btn",onClick:()=>t({type:"edge",id:f.src+">"+f.dst,hop:f}),title:p.reasons.map(h=>Uc[h]).join("; ")||Re[p.key].label,children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.dst})," · p.",f.page??"?"," · ",o.jsx("span",{className:`status-${p.key}`,children:Re[p.key].short})]},f.src+f.dst)})}),((a=i.missing)==null?void 0:a.length)>0&&o.jsx("div",{className:"links",children:i.missing.slice(0,8).map(f=>o.jsxs("button",{className:"tag-btn",title:f.quote||"",onClick:()=>n("ingest",f.cited),children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.cited})," · ",bp[f.reason]||f.reason]},f.src+f.cited))}),((u=i.ingest)==null?void 0:u.length)>0&&o.jsx("div",{className:"links",children:i.ingest.slice(0,10).map(f=>o.jsxs("button",{className:"tag-btn",onClick:()=>n("ingest",f.k),children:[o.jsx("span",{className:"k",children:f.k}),f.summary_status?` · ${f.summary_status}`:""," · read now"]},f.k))}),((d=i.recalls)==null?void 0:d.length)>0&&o.jsx("div",{className:"links",children:i.recalls.slice(0,8).map(f=>f.url?o.jsxs("a",{className:"tag-btn",href:f.url,target:"_blank",rel:"noreferrer",children:[f.id," ↗"]},f.id):o.jsx("span",{className:"tag-btn",children:f.id},f.id))}),i.node&&o.jsx("div",{className:"acts",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.node}),children:"Open recall records"})}),i.chain&&o.jsx("div",{className:"acts",children:o.jsxs("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.chain[i.chain.length-1]}),children:["Open ",i.chain[i.chain.length-1]," records"]})})]},i.id)})}):o.jsx("p",{className:"muted",children:"Nothing in this lineage needs a person's attention under the current rules."})}function oo(e){const t=e.signals.filter(n=>{var r;return(n.severity==="high"||n.severity==="medium")&&((r=n.chain)==null?void 0:r.length)>1});return t.find(n=>!n.conditional)||t[0]||null}function us(e,t){const n=e.filter(i=>i.design_related),r=n.length?n:e.filter(i=>i.classification==="Class I");return r.filter(i=>i.initiated&&t&&i.initiatedi.initiated.localeCompare(s.initiated))[0]||[...r].sort((i,s)=>(s.initiated||"").localeCompare(i.initiated||""))[0]||null}function th({a:e}){const t=e.device,n=oo(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=us(r.evidence.filter(i=>i.type==="recall"),null);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[o.jsx("span",{className:"k",children:e.k})," itself appears in FDA recall records",l&&o.jsxs(o.Fragment,{children:[": a ",o.jsxs("span",{className:"amber",children:[l.classification||"unclassified"," ",l.root_cause]})," recall began ",De(l.initiated)]}),"."," ","Citing it as a predicate would need that addressed."]})}if(n){const l=kn(e,n.chain[n.chain.length-1]),i=n.evidence.filter(f=>f.type==="recall"),s=us(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Wc(s.initiated,t.decision_date):null,d=so(i);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[it(t.name,48)," cites ",o.jsx("span",{className:"k",children:n.chain[1]}),a!=null&&a.page?o.jsxs(o.Fragment,{children:[" on page ",a.page," of its summary"]}):null,"."," ",n.conditional?o.jsxs(o.Fragment,{children:["The cited device ",o.jsx("span",{className:"k",children:l==null?void 0:l.k}),", reached through a citation the audit could not resolve,"]}):n.chain.length>2?o.jsxs(o.Fragment,{children:["Through it, ",n.gen===2?"grand-predicate":`generation-${n.gen} ancestor`," ",o.jsx("span",{className:"k",children:l==null?void 0:l.k})]}):o.jsx(o.Fragment,{children:"That predicate"})," ","(",it(l==null?void 0:l.name,52),") is listed by FDA on ",d.events," recall event",d.events===1?"":"s"," in this signal",s&&o.jsxs(o.Fragment,{children:[", including a ",o.jsxs("span",{className:"amber",children:[s.classification||"unclassified"," ",s.root_cause]})," recall that began ",De(s.initiated),u&&o.jsxs(o.Fragment,{children:[", ",u.relation==="before"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",e.k," was cleared"]}):Bc(u,e.k)]})]}),".",n.conditional&&o.jsxs(o.Fragment,{children:[" This route is ",o.jsx("b",{style:{color:"var(--violet)"},children:"conditional"}),": it holds only if that citation is a predicate."]})]})}return o.jsx("p",{className:"finding-sentence","data-testid":"finding-sentence",children:e.verdict_reason})}function nh({a:e,onSelect:t}){const n=oo(e);if(!n)return null;const r=n.evidence.filter(d=>d.type==="citation"),l=(d,f)=>{var p,h;return r.find(g=>g.src===d&&g.dst===f)||((h=(p=kn(e,f))==null?void 0:p.hops)==null?void 0:h.find(g=>g.src===d&&g.dst===f))},i=n.chain[n.chain.length-1],s=n.evidence.filter(d=>d.type==="recall"),a=us(s,e.device.decision_date),u=a?Wc(a.initiated,e.device.decision_date):null;return o.jsxs("section",{className:"panel corner-marks","aria-labelledby":"chain-title","data-testid":"critical-chain",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"chain-title",children:["Critical chain ",o.jsx("span",{className:"count",children:"predicate → recall, the route that raised the verdict"})]}),o.jsx("p",{className:"hint",children:"Select a thread for its page and quote."})]}),o.jsx("div",{className:"chain",children:n.chain.map((d,f)=>{const p=kn(e,d)||{},h=f===0?"Candidate":n.conditional?"Cited device · citation unresolved":f===1?"Direct predicate":f===2?"Grand-predicate":`Generation ${f}`,g=d===i,y=g?io({recalls:s}):"none",k=f>0?l(n.chain[f-1],d):null,L=k?Et(k):null;return o.jsxs(Nl.Fragment,{children:[f>0&&o.jsxs("button",{className:`chain-link st-${(L==null?void 0:L.key)||"extracted"}`,onClick:()=>k&&t({type:"edge",id:k.src+">"+k.dst,hop:k}),"aria-label":`${n.chain[f-1]} cites ${d}${k!=null&&k.page?` on page ${k.page}`:""}, ${Re[(L==null?void 0:L.key)||"extracted"].label}. Open provenance.`,children:[o.jsxs("span",{className:"lbl",children:["cites",k!=null&&k.page?` · p.${k.page}`:""]}),o.jsx("span",{className:"sub",children:Re[(L==null?void 0:L.key)||"extracted"].short})]}),o.jsxs("button",{className:`chain-node${f===0?" is-self":""}${y==="design"?" tone-design":""}`,onClick:()=>t({type:"node",k:d}),children:[o.jsx("span",{className:"role",children:h}),o.jsx("span",{className:"k",children:d}),o.jsx("span",{className:"nm",children:it(p.name,44)}),o.jsxs("span",{className:"dt",children:["Cleared ",De(p.decision_date)]}),g&&a&&o.jsxs("span",{className:"rc",children:[o.jsxs("span",{className:`chip tone-${a.design_related?"design":"class1"}`,children:[a.classification||"Unclassified"," · ",a.root_cause]}),o.jsxs("span",{className:"dt",children:["Recall began ",De(a.initiated)," · ",o.jsx("span",{className:"mono",children:a.id})]})]})]})]},d)})}),a&&u&&o.jsxs("div",{className:"chain-timing",children:[o.jsxs("span",{className:"chip tone-amber",children:[o.jsx("span",{className:"glyph"}),Bc(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[so(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function rh({k:e,go:t,onChanged:n}){var Y,Xe;const[r,l]=_.useState(null),[i,s]=_.useState(null),[a,u]=_.useState(!1),[d,f]=_.useState(4),[p,h]=_.useState(2),[g,y]=_.useState("graph"),[k,L]=_.useState(!1),[v,c]=_.useState(null),[m,w]=_.useState(null),[S,E]=_.useState([]),[j,x]=_.useState([]),R=()=>{u(!0),s(null),Oe.assess(e,d).then(M=>{l(M)}).catch(M=>{l(null),s(M.message)}).finally(()=>u(!1)),Oe.assessments(e).then(E).catch(()=>E([])),Oe.investigations(e,10).then(x).catch(()=>x([]))};if(_.useEffect(()=>{c(null),h(2),R()},[e,d]),i)return o.jsxs("div",{className:"panel",role:"alert",children:[o.jsx("p",{className:"err",style:{fontSize:15},children:i}),i.includes("not in the graph")&&o.jsxs("button",{className:"btn btn-primary",onClick:()=>t("ingest",e),children:["Read ",e," from FDA now ",o.jsx("span",{className:"arr",children:"→"})]})]});if(!r)return o.jsxs("div",{"aria-busy":"true",children:[o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Walking ",e,"'s lineage in the Relate graph…"]}),o.jsx("div",{className:"skeleton",style:{height:210,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:160,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:380}})]});const T=r.device,I=r.coverage,K={...Gn[r.verdict],...Op(r.verdict,I.evidence)},me=Gc(r).length,Be=r.signals.filter(M=>M.conditional).length;return o.jsxs("div",{className:"investigation","aria-busy":a,children:[o.jsxs("section",{className:`finding tone-${K.tone}`,"aria-labelledby":"finding-title","data-testid":"finding",children:[o.jsxs("div",{className:"finding-top",children:[o.jsxs("div",{className:"finding-id",children:[o.jsxs("div",{className:"kline",children:[o.jsx("span",{className:"k",children:r.k}),o.jsxs("span",{children:[T.product_code,(Y=T.product)!=null&&Y.name?` · ${T.product.name}`:""]})]}),o.jsx("h1",{id:"finding-title",children:T.name}),o.jsxs("div",{className:"meta",children:[o.jsx("span",{children:T.applicant}),o.jsxs("span",{children:["Cleared ",De(T.decision_date)]}),o.jsx("span",{children:T.clearance_type||"510(k)"}),o.jsx("a",{href:Ac(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),T.summary_url&&o.jsx("a",{href:T.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),o.jsxs("div",{className:`verdict tone-${K.tone}`,"data-testid":"verdict",children:[o.jsxs("div",{className:"verdict-label",children:[o.jsx("i",{"aria-hidden":"true"}),K.label]}),o.jsx("p",{className:"verdict-reason",children:r.verdict_reason}),o.jsx("div",{className:"verdict-actions",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t("compare",r.k),children:"Compare with other candidates"})}),o.jsxs("div",{className:"authority",children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M8 1.5l5.5 2v4.2c0 3.3-2.3 5.8-5.5 6.8-3.2-1-5.5-3.5-5.5-6.8V3.5z M5.5 8l1.8 1.8L10.8 6.3"})}),o.jsxs("span",{children:[o.jsx("b",{children:"Deterministic assessment"})," · ",r.rules_version,". Authoritative within its documented scope: ",I.evidence_scope,", from machine-readable FDA records. A documentation signal, not a safety determination."]})]})]})]}),o.jsx(th,{a:r}),o.jsxs("div",{className:"coverage-row","aria-label":"Evidence coverage",children:[o.jsxs("span",{className:`chip tone-${I.evidence==="complete"?"calm":I.evidence==="uncertain"?"alert":"muted"}`,title:"Completeness of evidence inside the verdict window",children:["Evidence ",I.evidence]}),(I.evidence_reasons||[]).map(M=>o.jsx("span",{className:"chip tone-muted","data-testid":"evidence-reason",children:Up[M]||M},M)),o.jsxs("span",{className:"chip",children:[I.ancestors," ancestors · ",I.generations_traversed," generations"]}),I.ancestors_lineage_unknown>0&&o.jsxs("span",{className:"chip tone-muted",children:[I.ancestors_lineage_unknown," with unread summaries"]}),I.doubtful_links>0&&o.jsxs("span",{className:"chip tone-alert",children:[I.doubtful_links," doubtful link(s)"]}),Be>0&&o.jsxs("span",{className:"chip tone-violet",children:[Be," conditional signal(s)"]}),me>0&&o.jsxs("a",{className:"chip tone-blue",href:"#review",onClick:M=>{var C;M.preventDefault(),(C=document.getElementById("review"))==null||C.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),o.jsx(nh,{a:r,onSelect:c}),o.jsxs("section",{className:"panel","aria-labelledby":"graph-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"graph-title",children:["Evidence graph ",o.jsxs("span",{className:"count",children:[r.ancestors.length," ancestors · ",r.descendants.length," later devices"]})]}),o.jsxs("div",{className:"graph-tools",children:[o.jsxs("div",{className:"seg",role:"group","aria-label":"View",children:[o.jsx("button",{"aria-pressed":g==="graph",onClick:()=>y("graph"),children:"Graph"}),o.jsx("button",{"aria-pressed":g==="timeline",onClick:()=>y("timeline"),children:"Timeline"})]}),o.jsxs("label",{className:"small muted",children:["Show ",o.jsx("select",{className:"field",value:p,onChange:M=>h(+M.target.value),"aria-label":"Generations shown",children:Array.from({length:d},(M,C)=>C+1).map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),o.jsxs("label",{className:"small muted",children:["Query ",o.jsx("select",{className:"field",value:d,onChange:M=>f(+M.target.value),"aria-label":"Generations traversed by the query",children:[2,3,4,5,6].map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),g==="graph"&&r.descendants.length>0&&o.jsxs("button",{className:"btn btn-line btn-sm","aria-pressed":k,onClick:()=>L(!k),children:[k?"Hide":"Show"," later devices"]})]})]}),g==="graph"?o.jsx(Kp,{a:r,depth:p,onDepth:h,descendants:k,selected:v,onSelect:c,focusChain:m}):o.jsx(Yp,{a:r,depth:p,highlight:m||((Xe=oo(r))==null?void 0:Xe.chain),onSelect:c}),o.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(M=>M.lineage_known).length," summary PDFs opened one generation at a time and ",1+r.ancestors.length," separate recall searches. Here it is one Relate query."]})]}),o.jsxs("div",{className:"grid-main",children:[o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("section",{className:"panel",id:"review","aria-labelledby":"review-title",style:{scrollMarginTop:120},children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"review-title",children:["What needs human review ",o.jsx("span",{className:"count",children:me})]}),o.jsx("p",{className:"hint",children:"What conflicts, why it matters, and what to do next."})]}),o.jsx(eh,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(lh,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(sh,{a:r,reload:R,go:t,onSelect:c}),o.jsx(oh,{a:r,onSaved:()=>{Oe.assessments(e).then(E),n&&n()}}),o.jsx(ah,{a:r,assessments:S,runs:j,go:t})]})]}),v&&o.jsx(Zp,{sel:v,a:r,onClose:()=>c(null),go:(M,C)=>{c(null),t(M,C)},reload:R,onSelect:c})]})}function lh({a:e,onSelect:t}){const n=e.signals.filter(r=>r.severity==="high"||r.severity==="medium"||r.severity==="low");return o.jsxs("section",{className:"panel","aria-labelledby":"signals-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"signals-title",children:["Recall signals ",o.jsxs("span",{className:"count",children:[n.length," in the readable ancestry"]})]}),o.jsx("p",{className:"hint",children:"Every recall record behind the verdict, by generation."})]}),n.length===0&&o.jsx("p",{className:"muted",children:"No recall records anywhere in the readable ancestry."}),n.map((r,l)=>o.jsx(ih,{s:r,onSelect:t},l))]})}function ih({s:e,onSelect:t}){var i;const[n,r]=_.useState(e.severity==="high"),l=e.evidence.filter(s=>s.type==="recall");return o.jsxs("div",{className:"signal",children:[o.jsxs("button",{className:"signal-head","aria-expanded":n,onClick:()=>r(!n),children:[o.jsx("span",{className:`sev sev-${e.severity}`,children:e.conditional?"cond.":e.severity}),o.jsx("span",{className:"t",children:e.title}),o.jsx("svg",{className:"chev",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M4 2l4 4-4 4",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})})]}),n&&o.jsxs("div",{className:"signal-body",children:[((i=e.chain)==null?void 0:i.length)>1&&o.jsx("div",{className:"tags",children:e.chain.map((s,a)=>o.jsxs(Nl.Fragment,{children:[a>0&&o.jsx("span",{className:"muted small","aria-hidden":"true",children:"→"}),o.jsx("button",{className:"tag-btn",onClick:()=>t({type:"node",k:s}),children:o.jsx("span",{className:"k",children:s})})]},s))}),l.slice(0,6).map(s=>o.jsx(Kc,{r:s},s.id)),l.length>6&&o.jsxs("p",{className:"muted small",children:["+ ",l.length-6," more record(s): open ",e.chain[e.chain.length-1]," for all."]})]})]})}const Ar=(e,t)=>e.review===t&&mt(e);function sh({a:e,reload:t,go:n,onSelect:r}){const[l,i]=_.useState(null),[s,a]=_.useState(null),u=async(d,f,p)=>{i(d.dst+p),a(null);try{const h=await f();a(p==="ai"?{ok:!0,text:`LLM labelled ${d.dst} "${h.ai_label}" (${h.model.split("/")[1]}, ${h.seconds}s). Advisory only: it is not used for the verdict until a person confirms the citation.`}:null),t()}catch(h){a({ok:!1,text:h.message})}finally{i(null)}};return o.jsxs("section",{className:"panel","aria-labelledby":"cites-title",children:[o.jsx("div",{className:"panel-head",children:o.jsxs("h2",{id:"cites-title",children:["What ",e.k," cites ",o.jsx("span",{className:"count",children:e.citations.length})]})}),o.jsx("p",{className:"lede",children:"Read from its 510(k) summary. Your review is written to the graph and changes every lineage query."}),e.device.lineage_known===!1&&o.jsxs("p",{className:"note-box",children:["Summary not machine-readable (",e.device.summary_status,")."," ",o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>n("ingest",e.k),children:"Try reading it now →"})]}),s&&o.jsx("p",{className:s.ok?"ok":"err",role:"status",children:s.text}),e.citations.map(d=>{const f={...d,src:e.k},p=d.in_lineage??d.kind==="predicate",h=Et(f);return o.jsxs("div",{className:"cit"+(d.review==="rejected"&&mt(d)?" is-rejected":""),children:[o.jsxs("div",{className:"cit-h",children:[o.jsx("button",{className:"k mono",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:d.dst}),o.jsx("span",{className:`chip ${d.kind==="predicate"?"tone-blue":"tone-muted"}`,children:d.kind}),p||h.key==="advisory"||h.key==="retired"?o.jsxs("span",{className:`status status-${h.key}`,title:Re[h.key].label,"data-testid":`cit-status-${d.dst}`,children:[o.jsx("span",{className:"line"}),Re[h.key].short]}):o.jsx("span",{className:"status status-rejected",title:"Reference devices and mentions are not lineage links","data-testid":`cit-status-${d.dst}`,children:"Not a lineage link"}),d.ai_label&&o.jsxs("span",{className:"chip tone-violet",title:d.ai_quote,children:["LLM: ",d.ai_label]}),o.jsxs("span",{className:"muted small",children:[it(d.name,34)," · ",Vc(d.dst_decision_date)]})]}),o.jsx(Qc,{text:d.quote||d.snippet,k:d.dst,ocr:d.text_source&&d.text_source!=="pdf_text_layer"}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.review(e.k,d.dst,Ar(d,"confirmed")?"":"confirmed"),"ok"),children:Ar(d,"confirmed")?"Unconfirm":"Confirm"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.review(e.k,d.dst,Ar(d,"rejected")?"":"rejected"),"no"),children:Ar(d,"rejected")?"Restore":"Reject"}),d.kind!=="predicate"&&o.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.triage(e.k,d.dst),"ai"),children:l===d.dst+"ai"?"Asking…":"Ask LLM to label"}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:["Provenance · p.",d.page]})]})]},d.dst)})]})}function oh({a:e,onSaved:t}){const[n,r]=_.useState(!1),[l,i]=_.useState(""),[s,a]=_.useState(null),[u,d]=_.useState(!1);_.useEffect(()=>{a(null),r(!1),i("")},[e.k]);const f=async()=>{d(!0);try{const h=await Oe.save(e.k,l);a(h),r(!1),i(""),t()}catch(h){a({error:h.message})}finally{d(!1)}},p=e.memo.headline+` +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function ai(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Gi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Jf=typeof WeakMap=="function"?WeakMap:Map;function ac(e,t,n){n=tt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){yl||(yl=!0,rs=r),Gi(e,t)},n}function uc(e,t,n){n=tt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Gi(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Gi(e,t),typeof r!="function"&&(kt===null?kt=new Set([this]):kt.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function bo(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Jf;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=dp.bind(null,e,t,n),t.then(e,e))}function ea(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ta(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=tt(-1,1),t.tag=2,wt(n,t,1))),n.lanes|=1),e)}var qf=ot.ReactCurrentOwner,ge=!1;function de(e,t,n,r){t.child=e===null?Au(t,null,n,r):gn(t,e.child,n,r)}function na(e,t,n,r,l){n=n.render;var i=t.ref;return fn(t,l),r=Ws(e,t,n,r,i,l),n=Bs(),e!==null&&!ge?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,it(e,t,l)):(W&&n&&Ls(t),t.flags|=1,de(e,t,r,l),t.child)}function ra(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!bs(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,cc(e,t,i,r,l)):(e=Jr(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:er,n(s,r)&&e.ref===t.ref)return it(e,t,l)}return t.flags|=1,e=Nt(i,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(er(i,r)&&e.ref===t.ref)if(ge=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(ge=!0);else return t.lanes=e.lanes,it(e,t,l)}return Yi(e,t,n,r,l)}function dc(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},O(on,ke),ke|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,O(on,ke),ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,O(on,ke),ke|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,O(on,ke),ke|=r;return de(e,t,l,n),t.child}function fc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Yi(e,t,n,r,l){var i=xe(n)?Vt:ce.current;return i=mn(t,i),fn(t,l),n=Ws(e,t,n,r,i,l),r=Bs(),e!==null&&!ge?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,it(e,t,l)):(W&&r&&Ls(t),t.flags|=1,de(e,t,n,l),t.child)}function la(e,t,n,r,l){if(xe(n)){var i=!0;al(t)}else i=!1;if(fn(t,l),t.stateNode===null)Yr(e,t),oc(t,n,r),Ki(t,n,r,l),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var u=s.context,d=n.contextType;typeof d=="object"&&d!==null?d=$e(d):(d=xe(n)?Vt:ce.current,d=mn(t,d));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||u!==d)&&qo(t,s,r,d),dt=!1;var h=t.memoizedState;s.state=h,pl(t,r,s,l),u=t.memoizedState,a!==r||h!==u||ye.current||dt?(typeof f=="function"&&(Qi(t,n,f,r),u=t.memoizedState),(a=dt||Jo(t,n,a,r,h,u,d))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),s.props=r,s.state=u,s.context=d,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Uu(e,t),a=t.memoizedProps,d=t.type===t.elementType?a:Fe(t.type,a),s.props=d,p=t.pendingProps,h=s.context,u=n.contextType,typeof u=="object"&&u!==null?u=$e(u):(u=xe(n)?Vt:ce.current,u=mn(t,u));var g=n.getDerivedStateFromProps;(f=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||h!==u)&&qo(t,s,r,u),dt=!1,h=t.memoizedState,s.state=h,pl(t,r,s,l);var y=t.memoizedState;a!==p||h!==y||ye.current||dt?(typeof g=="function"&&(Qi(t,n,g,r),y=t.memoizedState),(d=dt||Jo(t,n,d,r,h,y,u)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,y,u),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,y,u)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),s.props=r,s.state=y,s.context=u,r=d):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Xi(e,t,n,r,i,l)}function Xi(e,t,n,r,l,i){fc(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return l&&Bo(t,n,!1),it(e,t,i);r=t.stateNode,qf.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=gn(t,e.child,null,i),t.child=gn(t,null,a,i)):de(e,t,a,i),t.memoizedState=r.state,l&&Bo(t,n,!0),t.child}function pc(e){var t=e.stateNode;t.pendingContext?Wo(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Wo(e,t.context,!1),As(e,t.containerInfo)}function ia(e,t,n,r,l){return vn(),Ds(l),t.flags|=256,de(e,t,n,r),t.child}var Zi={dehydrated:null,treeContext:null,retryLane:0};function Ji(e){return{baseLanes:e,cachePool:null,transitions:null}}function hc(e,t,n){var r=t.pendingProps,l=B.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(l&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),O(B,l&1),e===null)return Bi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=zl(s,r,0,null),e=Ut(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ji(n),t.memoizedState=Zi,e):Ks(t,s));if(l=e.memoizedState,l!==null&&(a=l.dehydrated,a!==null))return bf(e,t,s,r,a,l,n);if(i){i=r.fallback,s=t.mode,l=e.child,a=l.sibling;var u={mode:"hidden",children:r.children};return!(s&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=Nt(l,u),r.subtreeFlags=l.subtreeFlags&14680064),a!==null?i=Nt(a,i):(i=Ut(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Ji(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Zi,r}return i=e.child,e=i.sibling,r=Nt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ks(e,t){return t=zl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Rr(e,t,n,r){return r!==null&&Ds(r),gn(t,e.child,null,n),e=Ks(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bf(e,t,n,r,l,i,s){if(n)return t.flags&256?(t.flags&=-257,r=ai(Error(N(422))),Rr(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=zl({mode:"visible",children:r.children},l,0,null),i=Ut(i,l,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&gn(t,e.child,null,s),t.child.memoizedState=Ji(s),t.memoizedState=Zi,i);if(!(t.mode&1))return Rr(e,t,s,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(N(419)),r=ai(i,r,void 0),Rr(e,t,s,r)}if(a=(s&e.childLanes)!==0,ge||a){if(r=ne,r!==null){switch(s&-s){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|s)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,lt(e,l),Ve(r,e,l,-1))}return qs(),r=ai(Error(N(421))),Rr(e,t,s,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=fp.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,je=xt(l.nextSibling),Ne=t,W=!0,Ae=null,e!==null&&(Ce[Te++]=be,Ce[Te++]=et,Ce[Te++]=Wt,be=e.id,et=e.overflow,Wt=t),t=Ks(t,r.children),t.flags|=4096,t)}function sa(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function ui(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function mc(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(de(e,t,r.children,n),r=B.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sa(e,n,t);else if(e.tag===19)sa(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(O(B,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&hl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ui(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&hl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ui(t,!0,n,null,i);break;case"together":ui(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Yr(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function it(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ht|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(N(153));if(t.child!==null){for(e=t.child,n=Nt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Nt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ep(e,t,n){switch(t.tag){case 3:pc(t),vn();break;case 5:Vu(t);break;case 1:xe(t.type)&&al(t);break;case 4:As(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;O(dl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(O(B,B.current&1),t.flags|=128,null):n&t.child.childLanes?hc(e,t,n):(O(B,B.current&1),e=it(e,t,n),e!==null?e.sibling:null);O(B,B.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return mc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),O(B,B.current),r)break;return null;case 22:case 23:return t.lanes=0,dc(e,t,n)}return it(e,t,n)}var vc,qi,gc,yc;vc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};qi=function(){};gc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,At(Xe.current);var i=null;switch(n){case"input":l=wi(e,l),r=wi(e,r),i=[];break;case"select":l=Q({},l,{value:void 0}),r=Q({},r,{value:void 0}),i=[];break;case"textarea":l=Ni(e,l),r=Ni(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=sl)}_i(n,r);var s;n=null;for(d in l)if(!r.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var a=l[d];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Gn.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var u=r[d];if(a=l!=null?l[d]:void 0,r.hasOwnProperty(d)&&u!==a&&(u!=null||a!=null))if(d==="style")if(a){for(s in a)!a.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in u)u.hasOwnProperty(s)&&a[s]!==u[s]&&(n||(n={}),n[s]=u[s])}else n||(i||(i=[]),i.push(d,n)),n=u;else d==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,a=a?a.__html:void 0,u!=null&&a!==u&&(i=i||[]).push(d,u)):d==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(d,""+u):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Gn.hasOwnProperty(d)?(u!=null&&d==="onScroll"&&U("scroll",e),i||a===u||(i=[])):(i=i||[]).push(d,u))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};yc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Rn(e,t){if(!W)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function oe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function tp(e,t,n){var r=t.pendingProps;switch(Rs(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return oe(t),null;case 1:return xe(t.type)&&ol(),oe(t),null;case 3:return r=t.stateNode,yn(),V(ye),V(ce),Us(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Pr(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ae!==null&&(ss(Ae),Ae=null))),qi(e,t),oe(t),null;case 5:Os(t);var l=At(ir.current);if(n=t.type,e!==null&&t.stateNode!=null)gc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(N(166));return oe(t),null}if(e=At(Xe.current),Pr(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Ke]=t,r[rr]=i,e=(t.mode&1)!==0,n){case"dialog":U("cancel",r),U("close",r);break;case"iframe":case"object":case"embed":U("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Ke]=t,e[rr]=r,vc(e,t,!1,!1),t.stateNode=e;e:{switch(s=Ei(n,r),n){case"dialog":U("cancel",e),U("close",e),l=r;break;case"iframe":case"object":case"embed":U("load",e),l=r;break;case"video":case"audio":for(l=0;lwn&&(t.flags|=128,r=!0,Rn(i,!1),t.lanes=4194304)}else{if(!r)if(e=hl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!W)return oe(t),null}else 2*Z()-i.renderingStartTime>wn&&n!==1073741824&&(t.flags|=128,r=!0,Rn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Z(),t.sibling=null,n=B.current,O(B,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Js(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ke&1073741824&&(oe(t),t.subtreeFlags&6&&(t.flags|=8192)):oe(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function np(e,t){switch(Rs(t),t.tag){case 1:return xe(t.type)&&ol(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return yn(),V(ye),V(ce),Us(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Os(t),null;case 13:if(V(B),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(B),null;case 4:return yn(),null;case 10:return Ms(t.type._context),null;case 22:case 23:return Js(),null;case 24:return null;default:return null}}var Dr=!1,ue=!1,rp=typeof WeakSet=="function"?WeakSet:Set,P=null;function sn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function bi(e,t,n){try{n()}catch(r){G(e,t,r)}}var oa=!1;function lp(e,t){if(Fi=rl,e=Nu(),Ps(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,d=0,f=0,p=e,h=null;t:for(;;){for(var g;p!==n||l!==0&&p.nodeType!==3||(a=s+l),p!==i||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)!==null;)h=p,p=g;for(;;){if(p===e)break t;if(h===n&&++d===l&&(a=s),h===i&&++f===r&&(u=s),(g=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ii={focusedElem:e,selectionRange:n},rl=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,L=y.memoizedState,v=t.stateNode,c=v.getSnapshotBeforeUpdate(t.elementType===t.type?k:Fe(t.type,k),L);v.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return y=oa,oa=!1,y}function Bn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&bi(t,n,i)}l=l.next}while(l!==r)}}function Dl(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function es(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function xc(e){var t=e.alternate;t!==null&&(e.alternate=null,xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ke],delete t[rr],delete t[Ui],delete t[Uf],delete t[Vf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function wc(e){return e.tag===5||e.tag===3||e.tag===4}function aa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ts(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=sl));else if(r!==4&&(e=e.child,e!==null))for(ts(e,t,n),e=e.sibling;e!==null;)ts(e,t,n),e=e.sibling}function ns(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ns(e,t,n),e=e.sibling;e!==null;)ns(e,t,n),e=e.sibling}var re=null,Ie=!1;function at(e,t,n){for(n=n.child;n!==null;)kc(e,t,n),n=n.sibling}function kc(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount=="function")try{Ye.onCommitFiberUnmount(Sl,n)}catch{}switch(n.tag){case 5:ue||sn(n,t);case 6:var r=re,l=Ie;re=null,at(e,t,n),re=r,Ie=l,re!==null&&(Ie?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Ie?(e=re,n=n.stateNode,e.nodeType===8?ni(e.parentNode,n):e.nodeType===1&&ni(e,n),qn(e)):ni(re,n.stateNode));break;case 4:r=re,l=Ie,re=n.stateNode.containerInfo,Ie=!0,at(e,t,n),re=r,Ie=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&bi(n,t,s),l=l.next}while(l!==r)}at(e,t,n);break;case 1:if(!ue&&(sn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){G(n,t,a)}at(e,t,n);break;case 21:at(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,at(e,t,n),ue=r):at(e,t,n);break;default:at(e,t,n)}}function ua(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rp),t.forEach(function(r){var l=pp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Me(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=Z()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sp(r/1960))-r,10e?16:e,mt===null)var r=!1;else{if(e=mt,mt=null,xl=0,F&6)throw Error(N(331));var l=F;for(F|=4,P=e.current;P!==null;){var i=P,s=i.child;if(P.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uZ()-Xs?Ot(e,0):Ys|=n),we(e,t)}function Pc(e,t){t===0&&(e.mode&1?(t=Nr,Nr<<=1,!(Nr&130023424)&&(Nr=4194304)):t=1);var n=fe();e=lt(e,t),e!==null&&(fr(e,t,n),we(e,n))}function fp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pc(e,n)}function pp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Pc(e,n)}var Lc;Lc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ye.current)ge=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ge=!1,ep(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&zu(t,cl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yr(e,t),e=t.pendingProps;var l=mn(t,ce.current);fn(t,n),l=Ws(null,t,r,e,l,n);var i=Bs();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,xe(r)?(i=!0,al(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Is(t),l.updater=Rl,t.stateNode=l,l._reactInternals=t,Ki(t,r,e,n),t=Xi(null,t,r,!0,i,n)):(t.tag=0,W&&i&&Ls(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=mp(r),e=Fe(r,e),l){case 0:t=Yi(null,t,r,e,n);break e;case 1:t=la(null,t,r,e,n);break e;case 11:t=na(null,t,r,e,n);break e;case 14:t=ra(null,t,r,Fe(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Yi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),la(e,t,r,l,n);case 3:e:{if(pc(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Uu(e,t),pl(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=xn(Error(N(423)),t),t=ia(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=ia(e,t,r,n,l);break e}else for(je=xt(t.stateNode.containerInfo.firstChild),Ne=t,W=!0,Ae=null,n=Au(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vn(),r===l){t=it(e,t,n);break e}de(e,t,r,n)}t=t.child}return t;case 5:return Vu(t),e===null&&Bi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ai(r,l)?s=null:i!==null&&Ai(r,i)&&(t.flags|=32),fc(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Bi(t),null;case 13:return hc(e,t,n);case 4:return As(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gn(t,null,r,n):de(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),na(e,t,r,l,n);case 7:return de(e,t,t.pendingProps,n),t.child;case 8:return de(e,t,t.pendingProps.children,n),t.child;case 12:return de(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,O(dl,r._currentValue),r._currentValue=s,i!==null)if(We(i.value,s)){if(i.children===l.children&&!ye.current){t=it(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=tt(-1,n&-n),u.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?u.next=u:(u.next=f.next,f.next=u),d.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Hi(i.return,n,t),a.lanes|=n;break}u=u.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Hi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}de(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,fn(t,n),l=$e(l),r=r(l),t.flags|=1,de(e,t,r,n),t.child;case 14:return r=t.type,l=Fe(r,t.pendingProps),l=Fe(r.type,l),ra(e,t,r,l,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Fe(r,l),Yr(e,t),t.tag=1,xe(r)?(e=!0,al(t)):e=!1,fn(t,n),oc(t,r,l),Ki(t,r,l,n),Xi(null,t,r,!0,e,n);case 19:return mc(e,t,n);case 22:return dc(e,t,n)}throw Error(N(156,t.tag))};function Rc(e,t){return lu(e,t)}function hp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new hp(e,t,n,r)}function bs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mp(e){if(typeof e=="function")return bs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ys)return 11;if(e===xs)return 14}return 2}function Nt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Jr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")bs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Zt:return Ut(n.children,l,i,t);case gs:s=8,l|=8;break;case vi:return e=Pe(12,n,t,l|2),e.elementType=vi,e.lanes=i,e;case gi:return e=Pe(13,n,t,l),e.elementType=gi,e.lanes=i,e;case yi:return e=Pe(19,n,t,l),e.elementType=yi,e.lanes=i,e;case Va:return zl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Oa:s=10;break e;case Ua:s=9;break e;case ys:s=11;break e;case xs:s=14;break e;case ct:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Pe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Ut(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function zl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Va,e.lanes=n,e.stateNode={isHidden:!1},e}function ci(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function di(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function vp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ql(0),this.expirationTimes=Ql(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ql(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function eo(e,t,n,r,l,i,s,a,u){return e=new vp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Is(i),e}function gp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Mc)}catch(e){console.error(e)}}Mc(),Ma.exports=_e;var Fc=Ma.exports,Ic,ga=Fc;Ic=ga.createRoot,ga.hydrateRoot;const jp="modulepreload",Np=function(e){return"/"+e},ya={},Mt=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));l=Promise.allSettled(n.map(u=>{if(u=Np(u),u in ya)return;ya[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":jp,d||(p.as="script"),p.crossOrigin="",p.href=u,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((h,g)=>{p.addEventListener("load",h),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(s){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s}return l.then(s=>{for(const a of s||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};async function ae(e,t={}){const n=await fetch(e,{headers:{"content-type":"application/json"},...t,body:t.body?JSON.stringify(t.body):void 0});let r=null;try{r=await n.json()}catch{}if(!n.ok){const l=r!=null&&r.detail?typeof r.detail=="string"?r.detail:JSON.stringify(r.detail):`HTTP ${n.status}`;throw new Error(l)}return r}const Oe={stats:()=>ae("/api/stats"),search:e=>ae(`/api/search?q=${encodeURIComponent(e)}`),assess:(e,t=4)=>ae(`/api/assess/${e}?depth=${t}`),compare:e=>ae("/api/compare",{method:"POST",body:{ks:e}}),recallEvent:e=>ae(`/api/recall-event/${e}`),watchlist:()=>ae("/api/watchlist"),ingest:(e,t=!1)=>ae("/api/ingest",{method:"POST",body:{k:e,refresh:t}}),review:(e,t,n,r)=>ae("/api/citation/review",{method:"POST",body:{src:e,dst:t,status:n,note:r}}),triage:(e,t)=>ae("/api/citation/triage",{method:"POST",body:{src:e,dst:t}}),save:(e,t)=>ae("/api/assessments",{method:"POST",body:{k:e,note:t}}),assessments:e=>ae(`/api/assessments${e?`?k=${e}`:""}`),investigations:(e,t=30)=>ae(`/api/investigations?limit=${t}${e?`&k=${e}`:""}`),investigation:e=>ae(`/api/investigations/${e}`),startInvestigation:(e,t,n="auto")=>ae("/api/investigations",{method:"POST",body:{k:e,request:t,mode:n}}),proposals:e=>ae(`/api/proposals${e?`?status=${e}`:""}`),decide:(e,t,n,r)=>ae(`/api/proposals/${e}/decision`,{method:"POST",body:{decision:t,reviewer:n,human:!0,note:r}})},Ac=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,Sp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,os={nodes:[{id:"a",x:11,y:7,r:3.6},{id:"b",x:27,y:7,r:2.8},{id:"c",x:11,y:19,r:3},{id:"d",x:23,y:19,r:2.6},{id:"e",x:11,y:31,r:3.4,past:!0}],threads:[["a","b"],["a","c"],["c","d"],["c","e"]]},Mr=Object.fromEntries(os.nodes.map(e=>[e.id,e]));function Oc({size:e=28,className:t="",title:n}){return o.jsxs("svg",{className:"mark "+t,width:e,height:e,viewBox:"0 0 38 38",role:n?"img":void 0,"aria-hidden":n?void 0:!0,"aria-label":n,children:[os.threads.map(([r,l],i)=>o.jsx("line",{className:`mark-thread t${i}`,x1:Mr[r].x,y1:Mr[r].y,x2:Mr[l].x,y2:Mr[l].y,pathLength:"1"},i)),os.nodes.map((r,l)=>o.jsx("circle",{className:`mark-node n${l}${r.past?" past":""}`,cx:r.x,cy:r.y,r:r.r},r.id))]})}function _p({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Oc,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const lo="forebear:intro",Ep=3e3,xa=2450;function Cp(){try{return!!sessionStorage.getItem(lo)}catch{return!0}}function Tp(){try{sessionStorage.setItem(lo,"seen")}catch{}}function Pp(){try{sessionStorage.removeItem(lo)}catch{}}function Lp({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,Tp(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,xa),f=h=>{(h.key==="Escape"||h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i())};return addEventListener("keydown",f),(p=l.current)==null||p.focus({preventScroll:!0}),()=>{clearTimeout(d),removeEventListener("keydown",f)}},[]);const[s,a]=_.useState(!1);if(_.useEffect(()=>{if(!t)return;const d=setTimeout(()=>a(!0),Ep-xa+100);return()=>clearTimeout(d)},[t]),s)return null;const u="Forebear".split("");return o.jsxs("div",{className:"intro"+(t?" is-leaving":""),"data-testid":"intro",onClick:i,role:"dialog","aria-modal":"true","aria-label":"Forebear opening",children:[o.jsxs("div",{className:"intro-lockup","aria-hidden":"true",children:[o.jsx(Oc,{className:"intro-mark",size:116}),o.jsx("div",{className:"intro-word",children:u.map((d,f)=>o.jsx("span",{style:{animationDelay:`${.95+f*.045}s`},children:d},f))}),o.jsx("p",{className:"intro-tag",children:o.jsxs("span",{children:["Every clearance has ",o.jsx("em",{children:"a past."})]})})]}),o.jsx("span",{className:"sr-only",role:"status",children:"Forebear. Every clearance has a past."}),o.jsxs("button",{ref:l,className:"btn btn-line btn-sm intro-skip",onClick:d=>{d.stopPropagation(),i()},children:["Skip intro ",o.jsx("span",{"aria-hidden":"true",children:"→"})]})]})}function Rp(e){const[t,n]=_.useState(()=>typeof matchMedia<"u"&&matchMedia(e).matches);return _.useEffect(()=>{const r=matchMedia(e),l=()=>n(r.matches);return l(),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),t}const cr=["mcp-client"],Kn={DESIGN_RECALL_ON_FILE:{tone:"alert",label:"Design-related recall on file",plain:"The candidate itself has a design-related recall on file."},REVIEW_LINEAGE:{tone:"amber",label:"Review lineage",plain:"A recall in the predicate lineage warrants documented review."},INSUFFICIENT_LINEAGE:{tone:"muted",label:"Lineage not checkable",plain:"The ancestry could not be checked from readable evidence."},NO_DESIGN_RECALL_SIGNAL:{tone:"calm",label:"No design-recall signal",plain:"No design-related recall in the readable verdict window. Not a safety finding."}},Uc={audit_unresolved:"The extraction audit could not resolve whether this is the predicate",audit_correction:"K-number supplied by the audit, not as printed in the PDF",name_mismatch:"The cited device's FDA name does not appear near the citation",different_fda_panel:"Cited device sits in a different FDA review panel",llm_label_only:"A predicate only because an LLM labelled the mention",client_confirmation_only:"Confirmed only through the automated MCP client, not a person",client_rejection_pending:"Rejected through the automated MCP client; kept until a person decides",review_outdated:"A person reviewed an earlier version of the FDA summary; it needs re-review"};function Dp(e){if(!e)return[];if(e.review==="confirmed"&&Ge(e))return[];const t=[];return Vc(e)&&t.push("review_outdated"),e.audit==="unresolved"&&t.push("audit_unresolved"),e.audit==="corrected"&&t.push("audit_correction"),e.name_check==="mismatch"&&!["variant","corrected"].includes(e.audit)&&t.push("name_mismatch"),e.panel_check==="different"&&!["variant","corrected"].includes(e.audit)&&t.push("different_fda_panel"),e.kind!=null&&e.kind!=="predicate"&&e.ai_label==="predicate"&&t.push("llm_label_only"),e.kind!=null&&e.kind!=="predicate"&&e.review==="confirmed"&&cr.includes(e.reviewer)&&t.push("client_confirmation_only"),e.review==="rejected"&&cr.includes(e.reviewer)&&t.push("client_rejection_pending"),t}const Ge=e=>!!(e!=null&&e.review)&&!cr.includes(e.reviewer)&&(e.reviewed_source_sha256||"")===(e.source_sha256||""),Vc=e=>!!(e!=null&&e.review)&&!cr.includes(e.reviewer)&&!Ge(e),Re={confirmed:{label:"Confirmed by a person",short:"Confirmed"},extracted:{label:"Machine-extracted",short:"Extracted"},disputed:{label:"Disputed evidence",short:"Disputed"},conditional:{label:"Conditional route",short:"Conditional"},rejected:{label:"Rejected by a person",short:"Rejected"},advisory:{label:"Advisory: suggested by an LLM or the MCP client, awaiting a person; not a verdict input",short:"Advisory"},retired:{label:"Retired: the refreshed FDA summary no longer cites it; kept for the record",short:"Retired"}};function Et(e){if(e!=null&&e.retired_at||(e==null?void 0:e.trust)==="retired")return{key:"retired",reasons:[]};if((e==null?void 0:e.review)==="rejected"&&Ge(e))return{key:"rejected",reasons:[]};if(e!=null&&e.advisory||(e==null?void 0:e.trust)==="advisory")return{key:"advisory",reasons:[]};const t=Dp(e);return t.includes("audit_unresolved")?{key:"conditional",reasons:t}:t.length?{key:"disputed",reasons:t}:(e==null?void 0:e.review)==="confirmed"&&Ge(e)?{key:"confirmed",reasons:t}:{key:"extracted",reasons:t}}function $p(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function io(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function so(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const zp=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function De(e){if(!e)return"—";const[t,n,r]=String(e).slice(0,10).split("-").map(Number);return t?`${r} ${zp[(n||1)-1]} ${t}`:String(e)}const Wc=e=>e?String(e).slice(0,4):"";function wa(e,t){if(!e||!t)return null;const[n,r,l]=e.slice(0,10).split("-").map(Number),[i,s,a]=t.slice(0,10).split("-").map(Number);return(i-n)*12+(s-r)-(ar?1:0}function Bc(e,t){const n=Mp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?wa(e,t):wa(t,e);return{relation:n<0?"before":"after",months:r,duration:Fp(r)}}function Hc(e,t,n="clause"){if(!e)return"";const{relation:r,duration:l}=e;return n==="chip"?r==="same-day"?`Recall began on the day of ${t}'s clearance`:`Recall began ${l} ${r} ${t}'s clearance`:r==="same-day"?`on the day ${t} was cleared`:`${l} ${r} ${t} was cleared`}function Fp(e){if(e==null)return"";const t=e<0,n=Math.abs(e),r=Math.floor(n/12),l=n%12,i=[r?`${r} yr`:"",l?`${l} mo`:""].filter(Boolean).join(" ")||"<1 mo";return t?`-${i}`:i}const Ip=(e,t)=>e?t?`${e}#page=${t}`:e:null,Ap={pdf_text_layer:"PDF text layer",ocr:"Local OCR of the scanned PDF",embedded_pdf_attachment:"Summary embedded in a PDF Portfolio"};function st(e,t=30){const n=(e||"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t-1)+"…":n}function Op(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function Up(e,t){const n=Kn[e];return n?Op(e,t)?{tone:"muted",label:`${n.label} · provisional`,provisional:!0}:{tone:n.tone,label:n.label,provisional:!1}:{tone:"muted",label:e||"Unknown",provisional:!1}}const kh={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Vp={direct_predicate_links_all_uncertain:"every direct predicate link rests on uncertain evidence",unresolved_predicate_citations:"predicate citations within two generations could not be resolved",direct_predicate_summaries_unread:"a direct predicate's own summary was not read",doubtful_links_in_window:"links within two generations rest on doubtful evidence",recall_cause_or_class_unknown:"a recall has no stated cause or FDA class",unattributed_recalls_in_product_code:"design-related recalls in the product code name no 510(k)",shallow_traversal:"grand-predicates were not traversed",advisory_links_pending_review:"predicate links suggested only by an LLM or the MCP client await a person",human_confirmed_citation_retired:"a citation a person confirmed is no longer in the refreshed FDA summary"},Qc={name_token_match:{short:"FDA-listed · name match (heuristic)",tone:"other",text:"FDA lists this 510(k) on the recall. A distinctive word of its FDA device name appears in the recall text, possibly as a fuzzy match. This heuristic does not verify that the recall names this exact model."},name_token_absent:{short:"FDA-listed · name not found (heuristic)",tone:"muted",text:"FDA lists this 510(k) on the recall, but no distinctive word of its FDA device name was found in the recall text. The recalled model may differ, or the text may name it differently."},name_not_checkable:{short:"FDA-listed · name not checked",tone:"muted",text:"FDA lists this 510(k) on the recall. No name check is available: its FDA device name has no distinctive word to look for, or no check was recorded for this link. Which model was recalled is not established here."}},fi={short:"Recall began before this clearance",text:"This recall began before this 510(k) was cleared, yet FDA lists it on the record. The dates alone do not establish whether this cleared model was affected: read the FDA record."},jh={after:"cleared after the recall began",before:"cleared before the recall began",same_day:"cleared the day the recall began (order unknown)",unknown:"timing unknown (a date is missing)"};function ka(e){return e!=null&&e.attribution&&Qc[e.attribution]?e.attribution:(e==null?void 0:e.link_name_check)==="match"?"name_token_match":(e==null?void 0:e.link_name_check)==="mismatch"?"name_token_absent":"name_not_checkable"}const pi=70,Fr=110,ja=46,Wp=62,Bp=190,Na=300;function Hp(e){return e.signals.filter(t=>{var n;return(t.severity==="high"||t.severity==="medium")&&((n=t.chain)==null?void 0:n.length)>1}).map(t=>t.chain)}function Qp(e,{depth:t,descendants:n}){const r=new Map,l=Hp(e),i=new Set(l.flat()),s=new Set;l.forEach(p=>p.slice(1).forEach((h,g)=>s.add(p[g]+">"+h))),r.set(e.k,{...e.device,k:e.k,gen:0,side:"self",recalls:e.device.recalls||[]});let a=0,u=new Set;for(const p of e.ancestors)p.gen<=t||i.has(p.k)?r.set(p.k,{...p,side:"up"}):(a++,u.add(p.gen));if(n)for(const p of e.descendants)r.set(p.k,{...p,side:"down"});const d=new Map,f=p=>{for(const h of p||[]){if(!r.has(h.src)||!r.has(h.dst))continue;const g=h.src+">"+h.dst;d.has(g)||d.set(g,{id:g,hop:h,status:Et(h),critical:s.has(g)})}};for(const p of e.ancestors)r.has(p.k)&&f(p.hops);if(n)for(const p of e.descendants)f(p.hops);return{nodes:r,edges:d,hidden:a,hiddenGens:[...u].sort(),critK:i,critE:s}}function Kp(e,t){var E;const{nodes:n,edges:r}=e,l=new Map;for(const j of n.values())((E=j.chain)==null?void 0:E.length)>1&&l.set(j.k,j.chain[j.chain.length-2]);const i=[...n.values()].filter(j=>j.side==="up").map(j=>j.gen),s=[...n.values()].filter(j=>j.side==="down").map(j=>j.gen),a=i.length?Math.max(...i):0,u=s.length?Math.max(...s):0,d=j=>j.side==="self"?a:j.side==="up"?a-j.gen:a+j.gen,f=new Map;for(const j of n.values()){const x=d(j);f.has(x)||f.set(x,[]),f.get(x).push(j)}const p=new Map([[[...n.values()].find(j=>j.side==="self").k,0]]),h=[...f.keys()].sort((j,x)=>Math.abs(j-a)-Math.abs(x-a)),g=Math.max(...[...f.values()].map(j=>j.length));for(const j of h){const x=f.get(j);x.sort((R,T)=>{const I=p.get(l.get(R.k))??0,K=p.get(l.get(T.k))??0;return I-K||(T.decision_date||"").localeCompare(R.decision_date||"")}),x.forEach((R,T)=>{R.side!=="self"&&p.set(R.k,(T-(x.length-1)/2)*pi)})}const y=a+u,k=y?Math.max(Bp,Math.min(Na,(t-Fr*2)/y)):Na,L=Math.max(t,Fr*2+y*k),v=Fr+(L-(Fr*2+y*k))/2,c=ja+Wp+Math.max(1,g)*pi,m=ja+Math.max(1,g)*pi/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:m+p.get(j.k)}])),S=[...f.keys()].map(j=>{const x=j-a;return{x:v+j*k,label:x===0?"Candidate":x<0?x===-1?"Predicates":x===-2?"Grand-predicates":`Generation ${-x}`:`Cites it · +${x}`}});return{pos:w,width:L,height:c,colLabels:S,edges:r}}function Gp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Qp(e,{depth:t,descendants:r}),[e,t,r]),u=_.useRef(null),[d,f]=_.useState(900);_.useEffect(()=>{const c=()=>u.current&&f(u.current.clientWidth);c();const m=new ResizeObserver(c);return m.observe(u.current),()=>m.disconnect()},[]);const p=_.useMemo(()=>Kp(a,d),[a,d]),[h,g]=_.useState(null);_.useEffect(()=>{const c=u.current;c&&(c.scrollLeft=c.scrollWidth)},[e.k,p.width]);const y=_.useMemo(()=>{const c=h||null;if(!c)return s?new Set(s):null;const m=a.nodes.get(c);return new Set((m==null?void 0:m.chain)||[c])},[h,a,s]),k=c=>{if(!y)return!0;const[m,w]=c.split(">");return y.has(m)&&y.has(w)},L=c=>{const m=c.recalls||[],w=m.filter(S=>S.design_related).length;return`${c.k}, ${c.name||"unnamed"}, cleared ${c.decision_date||"date unknown"}. `+(c.side==="self"?"Candidate. ":c.side==="up"?`Generation ${c.gen} predicate. `:`Cites the candidate, ${c.gen} generation(s) later. `)+(m.length?`${m.length} recall record(s), ${w} design-related. `:"No recall records. ")+(c.lineage_known===!1?"Its own predicates were not read.":"")},v=c=>m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),c())};return o.jsxs("div",{children:[o.jsx("div",{className:"graph-wrap",ref:u,"data-testid":"evidence-graph",children:o.jsxs("svg",{width:p.width,height:p.height,role:"group","aria-label":`Predicate lineage graph for ${e.k}: ${a.nodes.size} devices, ${a.edges.size} citations`,children:[p.colLabels.map(c=>o.jsxs("g",{children:[o.jsx("line",{className:"g-col-rule",x1:c.x,x2:c.x,y1:30,y2:p.height-10}),o.jsx("text",{className:"g-col-label",x:c.x,y:20,textAnchor:"middle",children:c.label})]},c.x)),[...a.edges.values()].map(c=>{const m=p.pos.get(c.hop.src),w=p.pos.get(c.hop.dst),S=(m.x+w.x)/2,E=`M${m.x-12},${m.y} C${S},${m.y} ${S},${w.y} ${w.x+12},${w.y}`,j=c.status.key,x=!k(c.id),R=(l==null?void 0:l.type)==="edge"&&l.id===c.id;return o.jsxs("g",{className:"g-edge-g",tabIndex:0,role:"button","aria-label":`Citation: ${c.hop.src} cites ${c.hop.dst}${c.hop.page?`, page ${c.hop.page}`:""}. ${Re[j].label}. Open provenance.`,"aria-pressed":R,onClick:()=>i({type:"edge",id:c.id,hop:c.hop}),onKeyDown:v(()=>i({type:"edge",id:c.id,hop:c.hop})),children:[o.jsx("path",{d:E,className:`g-edge st-${j}${c.critical?" is-critical":""}${x?" is-dim":""}`,style:R?{opacity:1,strokeWidth:3.2}:void 0}),c.critical&&!x&&o.jsx("path",{d:E,className:"g-flow"}),o.jsx("path",{d:E,className:"g-edge-hit"}),o.jsx("rect",{x:S-22,y:(m.y+w.y)/2-9,width:44,height:18,rx:9,fill:"transparent",style:{cursor:"pointer"}}),o.jsx("title",{children:`${c.hop.src} → ${c.hop.dst} · p.${c.hop.page??"?"} · ${Re[j].label}`})]},c.id)}),[...a.nodes.values()].map(c=>{const m=p.pos.get(c.k),w=io(c),S=c.side==="self",E=S?11:8,j=y&&!y.has(c.k),x=(l==null?void 0:l.type)==="node"&&l.k===c.k;return o.jsxs("g",{transform:`translate(${m.x},${m.y})`,tabIndex:0,role:"button","aria-label":L(c),"aria-pressed":x,className:`g-node${S?" is-self":""}${j?" is-dim":""}${x?" is-selected":""}`,"data-k":c.k,onMouseEnter:()=>g(c.k),onMouseLeave:()=>g(null),onFocus:()=>g(c.k),onBlur:()=>g(null),onClick:()=>i({type:"node",k:c.k}),onKeyDown:v(()=>i({type:"node",k:c.k})),children:[w==="design"&&!S&&o.jsx("circle",{className:"glow",r:E*2.2}),o.jsx("circle",{className:"halo",r:E+5}),o.jsx("circle",{className:`dot tone-${w}${c.lineage_known===!1?" unread":""}`,r:E}),o.jsx("text",{className:"lk",y:-E-9,textAnchor:"middle",children:c.k}),o.jsxs("text",{className:"ln",y:E+16,textAnchor:"middle",children:[st(c.name,26)," · ",Wc(c.decision_date)]})]},c.k)}),a.hidden>0&&o.jsxs("g",{className:"g-more",tabIndex:0,role:"button",transform:`translate(14, ${p.height-40})`,"aria-label":`Show ${a.hidden} more ancestors in generations ${a.hiddenGens.join(", ")}`,onClick:()=>n(Math.max(...a.hiddenGens)),onKeyDown:v(()=>n(Math.max(...a.hiddenGens))),children:[o.jsx("rect",{width:"212",height:"28",rx:"14"}),o.jsxs("text",{x:"106",y:"18.5",textAnchor:"middle",children:["+ ",a.hidden," more in generation",a.hiddenGens.length>1?`s ${a.hiddenGens[0]}–${a.hiddenGens[a.hiddenGens.length-1]}`:` ${a.hiddenGens[0]}`]})]})]})}),o.jsxs("div",{className:"g-legend","aria-label":"Legend",children:[o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-design"}),"design-related recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-recall"}),"other recall"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-clean"}),"no recall record"]}),o.jsxs("span",{className:"sw",children:[o.jsx("i",{className:"lg-unread"}),"own predicates unread"]}),o.jsx("span",{className:"sep","aria-hidden":"true"}),["confirmed","extracted","disputed","conditional"].map(c=>o.jsxs("span",{className:`status status-${c}`,children:[o.jsx("span",{className:"line"}),Re[c].short]},c)),o.jsxs("span",{className:"status",style:{color:"var(--amber)"},children:[o.jsx("span",{className:"line"}),"critical chain"]})]}),o.jsx("div",{className:"graph-hint",children:"Select any device or thread for its record, quote, page and source PDF. Tab moves between them; Enter opens."})]})}const Dt=28,Ir=34,hi=260,ut=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Yp(e,t){const n=new Map,r=(u,d,f,p)=>{n.has(u.k)||n.set(u.k,{...u,side:d,gen:f,parent:p,children:[]})};r({...e.device,k:e.k},"self",0,null);for(const u of e.ancestors)u.gen<=t&&r(u,"up",u.gen,u.chain[u.chain.length-2]);for(const u of e.descendants)r(u,"down",u.gen,u.chain[u.chain.length-2]);for(const u of n.values())u.parent&&n.has(u.parent)&&n.get(u.parent).children.push(u.k);const l=(u,d)=>(n.get(u).decision_date||"").localeCompare(n.get(d).decision_date||""),i=[],s=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="down").sort(l).reverse())s(d),i.push(d)},a=u=>{for(const d of n.get(u).children.filter(f=>n.get(f).side==="up").sort(l).reverse())i.push(d),a(d)};return s(e.k),i.push(e.k),a(e.k),{nodes:n,order:i}}function Xp({a:e,depth:t,highlight:n,onSelect:r}){const l=_.useRef(null),[i,s]=_.useState(1e3);_.useEffect(()=>{const x=()=>l.current&&s(Math.max(760,l.current.clientWidth));x();const R=new ResizeObserver(x);return R.observe(l.current),()=>R.disconnect()},[]);const{nodes:a,order:u}=_.useMemo(()=>Yp(e,t),[e,t]),d=new Map(u.map((x,R)=>[x,R])),f=[];for(const x of a.values()){x.decision_date&&f.push(ut(x.decision_date));for(const R of x.recalls||[])R.initiated&&f.push(ut(R.initiated))}const p=new Date(Math.min(...f)).getUTCFullYear(),h=new Date(Math.max(...f)).getUTCFullYear()+1,g=Date.UTC(p,0,1),y=Date.UTC(h,0,1),k=i-hi-40,L=x=>16+(x-g)/(y-g)*k,v=x=>Ir+x*Dt+Dt/2,c=Ir+u.length*Dt+16,m=new Set(n||[]),w=new Set;if(n)for(let x=0;x+1"+n[x+1]);const S=h-p>24?4:h-p>12?2:1,E=[];for(let x=p;x<=h;x+=S)E.push(x);const j=L(ut(e.device.decision_date));return o.jsx("div",{className:"graph-wrap",ref:l,"data-testid":"timeline",children:o.jsxs("svg",{width:i,height:c,role:"group","aria-label":`Lineage timeline for ${e.k}`,children:[E.map(x=>o.jsxs("g",{children:[o.jsx("line",{className:"tl-grid",x1:L(Date.UTC(x,0,1)),x2:L(Date.UTC(x,0,1)),y1:Ir-8,y2:c-8}),o.jsx("text",{className:"tl-axis",x:L(Date.UTC(x,0,1)),y:18,textAnchor:"middle",children:x})]},x)),o.jsx("rect",{x:0,y:v(d.get(e.k))-Dt/2,width:i,height:Dt,className:"tl-band"}),o.jsx("line",{className:"tl-clear",x1:j,x2:j,y1:Ir-8,y2:c-8}),[...a.values()].filter(x=>x.parent&&a.has(x.parent)).map(x=>{const[R,T]=x.side==="up"?[x.parent,x.k]:[x.k,x.parent],I=a.get(R),K=a.get(T);if(!I.decision_date||!K.decision_date)return null;const me=L(ut(I.decision_date)),Be=v(d.get(R)),Y=L(ut(K.decision_date)),Ze=v(d.get(T)),M=(me+Y)/2;return o.jsx("path",{d:`M${me-6},${Be} C${M},${Be} ${M},${Ze} ${Y+7},${Ze}`,className:"tl-edge"+(w.has(R+">"+T)?" on":"")},R+T)}),u.map((x,R)=>{const T=a.get(x);if(!T.decision_date)return null;const I=L(ut(T.decision_date)),K=v(R),me=io(T),Be=m.size&&!m.has(x);return o.jsxs("g",{className:"tl-row g-node",style:{opacity:Be?.3:1},tabIndex:0,role:"button","aria-label":`${x} ${T.name}, cleared ${T.decision_date}, ${(T.recalls||[]).length} recall records`,onClick:()=>r({type:"node",k:x}),onKeyDown:Y=>{(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),r({type:"node",k:x}))},children:[o.jsx("rect",{className:"tl-rowhit",x:0,y:K-Dt/2,width:i,height:Dt}),(T.recalls||[]).map(Y=>Y.initiated&&o.jsxs("g",{children:[o.jsx("line",{className:"tl-rlink",x1:I,x2:L(ut(Y.initiated)),y1:K,y2:K}),o.jsx("path",{d:`M${L(ut(Y.initiated))},${K-5} l5,5 l-5,5 l-5,-5 z`,className:"tl-dia "+(Y.design_related?"design":"other"),children:o.jsx("title",{children:`${Y.id} · ${Y.classification||"unclassified"} · ${Y.root_cause} · began ${Y.initiated}`})})]},Y.id)),o.jsx("circle",{cx:I,cy:K,r:x===e.k?7:5.5,className:`dot tone-${me}${T.lineage_known===!1?" unread":""}`,style:x===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),o.jsxs("text",{x:i-hi+8,y:K+4,className:"tl-label",children:[o.jsx("tspan",{className:"lk",children:x}),o.jsx("tspan",{dx:"7",children:st(T.name,24)})]}),o.jsx("text",{x:i-hi-6,y:K+4,textAnchor:"end",className:"tl-gen",children:T.side==="self"?"candidate":T.side==="up"?`G-${T.gen}`:`D+${T.gen}`})]},x)})]})})}function Kc({text:e,k:t,ocr:n}){if(!e)return o.jsx("p",{className:"quote muted",children:"No quote stored for this citation."});const r=t?e.split(new RegExp(`(${t.replace(/^K/,"K\\s?")})`)):[e];return o.jsxs("blockquote",{className:"quote"+(n?" is-ocr":""),children:["“",/^[a-z]/.test(e)?"…":"",r.map((l,i)=>i%2?o.jsx("mark",{children:l},i):o.jsx(Nl.Fragment,{children:l},i)),"”"]})}function Zp({hop:e}){const t=Et(e);return o.jsxs("span",{className:`status status-${t.key}`,children:[o.jsx("span",{className:"line"}),Re[t.key].label]})}function Gc({r:e}){const t=$p(e),n=Qc[ka(e)];return o.jsxs("div",{className:"recall","data-attribution":ka(e),children:[o.jsxs("div",{className:"recall-h",children:[o.jsx("span",{className:`chip tone-${t}`,children:t==="design"?"Design-related":t==="class1"?"Class I, other cause":"Other cause"}),o.jsx("span",{className:"k mono",children:e.id}),o.jsxs("span",{className:"muted",children:[e.classification||"Unclassified"," · ",e.root_cause||"cause not stated"," · began ",De(e.initiated)]}),e.url&&o.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:"FDA record ↗"})]}),o.jsxs("div",{className:"recall-r",children:[o.jsx("span",{className:`chip tone-${n.tone}`,title:n.text,children:n.short})," ",o.jsx("span",{className:"muted small",children:n.text})]}),e.linked_before_clearance&&o.jsxs("div",{className:"recall-r","data-testid":"recall-predates",children:[o.jsx("span",{className:"chip tone-muted",title:fi.text,children:fi.short})," ",o.jsx("span",{className:"muted small",children:fi.text})]}),e.reason&&o.jsx("div",{className:"recall-r",children:e.reason}),e.status&&o.jsxs("div",{className:"recall-r",children:["Status: ",e.status,e.event?` · event ${e.event}`:"",e.firm?` · ${e.firm}`:""]})]})}function kn(e,t){return t===e.k?{...e.device,k:e.k,gen:0,side:"self"}:e.ancestors.find(n=>n.k===t)&&{...e.ancestors.find(n=>n.k===t),side:"up"}||e.descendants.find(n=>n.k===t)&&{...e.descendants.find(n=>n.k===t),side:"down"}||null}function Jp({sel:e,a:t,onClose:n,go:r,reload:l,onSelect:i}){const s=_.useRef(null),a=_.useRef(null);return _.useEffect(()=>{var f;const u=document.activeElement;(f=a.current)==null||f.focus();const d=p=>{if(p.key==="Escape"&&n(),p.key==="Tab"&&s.current){const h=s.current.querySelectorAll('a[href], button:not([disabled]), input, textarea, [tabindex="0"]');if(!h.length)return;const g=h[0],y=h[h.length-1];p.shiftKey&&document.activeElement===g?(p.preventDefault(),y.focus()):!p.shiftKey&&document.activeElement===y&&(p.preventDefault(),g.focus())}};return addEventListener("keydown",d),()=>{var p;removeEventListener("keydown",d),(p=u==null?void 0:u.focus)==null||p.call(u)}},[]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"drawer-scrim",onClick:n}),o.jsx("aside",{className:"drawer",ref:s,role:"dialog","aria-modal":"true","aria-labelledby":"drawer-title","data-testid":"provenance",children:e.type==="edge"?o.jsx(qp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(bp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function as({eyebrow:e,children:t,closeBtn:n,onClose:r}){return o.jsxs("div",{className:"drawer-head",children:[o.jsxs("div",{className:"t",children:[o.jsx("p",{className:"eyebrow",children:e}),o.jsx("h2",{id:"drawer-title",children:t})]}),o.jsx("button",{ref:n,className:"btn btn-quiet",onClick:r,"aria-label":"Close provenance (Escape)",children:"✕"})]})}function qp({sel:e,a:t,closeBtn:n,onClose:r,go:l,reload:i,onSelect:s}){const a=e.hop,u=kn(t,a.src)||{},d=kn(t,a.dst)||{},f=Et(a),[p,h]=_.useState(!1),[g,y]=_.useState(null),k=a.source_url||u.summary_url,L=(a.text_source||u.text_source)&&(a.text_source||u.text_source)!=="pdf_text_layer",v=async c=>{h(!0),y(null);try{const m=await Oe.review(a.src,a.dst,c);y({ok:!0,text:c?`Recorded: ${c}. The assessment has been recomputed from the graph.`:"Review cleared. The assessment has been recomputed."}),s({...e,hop:{...a,review:(m==null?void 0:m.review)??(c||null),reviewer:(m==null?void 0:m.reviewer)??(c?"user":null)}}),i()}catch(m){y({ok:!1,text:m.message})}finally{h(!1)}};return o.jsxs(o.Fragment,{children:[o.jsxs(as,{eyebrow:"Citation provenance",closeBtn:n,onClose:r,children:[o.jsx("span",{className:"k",children:a.src})," cites ",o.jsx("span",{className:"k",children:a.dst})]}),o.jsxs("div",{className:"drawer-body",children:[o.jsxs("div",{className:"drawer-sec",children:[o.jsx(Zp,{hop:a}),f.reasons.length>0&&o.jsx("ul",{style:{margin:"8px 0 0",paddingLeft:18,color:"var(--ink-2)",fontSize:12.5},children:f.reasons.map(c=>o.jsx("li",{children:Uc[c]||c},c))}),f.key==="conditional"&&o.jsxs("p",{className:"note-box violet",style:{marginTop:10},children:["Recall signals reached through this thread are ",o.jsx("b",{children:"conditional"}),": they hold only if this citation is a predicate. Read the page, then confirm or reject it: your review rewrites the verdict."]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"What the summary says"}),o.jsx(Kc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:Ip(k,a.page),target:"_blank",rel:"noreferrer","data-testid":"pdf-page-link",children:[o.jsx("span",{className:"sheet",children:o.jsxs("b",{children:["p.",a.page??"?"]})}),o.jsxs("span",{className:"tx",children:[o.jsxs("b",{children:["Open the original FDA PDF",a.page?` at page ${a.page}`:""," ↗"]}),o.jsxs("span",{children:[a.src," 510(k) summary · accessdata.fda.gov"]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Source and extraction"}),o.jsxs("dl",{className:"prov-grid",children:[o.jsx("dt",{children:"Citing device"}),o.jsxs("dd",{children:[a.src," · ",st(u.name,40),u.decision_date?` · ${De(u.decision_date)}`:""]}),o.jsx("dt",{children:"Cited device"}),o.jsxs("dd",{children:[a.dst," · ",st(d.name,40),d.decision_date?` · ${De(d.decision_date)}`:""]}),o.jsx("dt",{children:"Role"}),o.jsx("dd",{children:a.kind||"predicate"}),o.jsx("dt",{children:"Page"}),o.jsx("dd",{children:a.page??"not recorded"}),o.jsx("dt",{children:"Text source"}),o.jsx("dd",{children:Ap[a.text_source||u.text_source]||a.text_source||u.text_source||"not recorded"}),o.jsx("dt",{children:"Extraction"}),o.jsxs("dd",{children:[a.method||"—",a.confidence!=null?` · confidence ${a.confidence}`:""]}),o.jsx("dt",{children:"Name check"}),o.jsx("dd",{children:a.name_check||"—"}),o.jsx("dt",{children:"FDA panel"}),o.jsx("dd",{children:a.panel_check||"—"}),a.audit&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Audit"}),o.jsxs("dd",{children:[a.audit,a.audit_note?` — ${a.audit_note}`:""]})]}),a.ai_label&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"LLM label"}),o.jsxs("dd",{children:[a.ai_label,a.ai_model?` · ${a.ai_model}`:""," (advisory; never a verdict input until a person confirms)"]})]}),o.jsx("dt",{children:"Review"}),o.jsx("dd",{children:a.review?`${a.review} by ${a.reviewer||"unknown"}${cr.includes(a.reviewer)?" (automated client; advisory)":Vc(a)?" on an earlier version of the summary; needs re-review":""}`:"not reviewed by a person"}),o.jsx("dt",{children:"Trust"}),o.jsx("dd",{"data-testid":"edge-trust",children:Re[Et(a).key].label}),a.retired_at&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Retired"}),o.jsxs("dd",{children:[De(a.retired_at)," · no longer cited by the refreshed summary"]})]}),u.summary_sha256&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"PDF SHA-256"}),o.jsx("dd",{children:o.jsx("span",{className:"mono",children:u.summary_sha256})})]})]})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"Your review"}),o.jsxs("div",{className:"drawer-acts",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="confirmed"&&Ge(a)?"":"confirmed"),children:a.review==="confirmed"&&Ge(a)?"Clear confirmation":"Confirm citation"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:p,onClick:()=>v(a.review==="rejected"&&Ge(a)?"":"rejected"),children:a.review==="rejected"&&Ge(a)?"Restore citation":"Reject citation"})]}),o.jsx("p",{className:"note",style:{marginTop:8},children:"A review is a write to the Relate graph. Every lineage query, verdict and saved-assessment staleness check reads it immediately."}),g&&o.jsx("p",{className:g.ok?"ok":"err",role:"status",children:g.text})]}),o.jsxs("div",{className:"drawer-acts",children:[o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.dst}),children:[a.dst," record →"]}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>s({type:"node",k:a.src}),children:[a.src," record →"]})]})]})]})}function bp({sel:e,a:t,closeBtn:n,onClose:r,go:l,onSelect:i}){var p,h;const s=kn(t,e.k);if(!s)return o.jsxs(o.Fragment,{children:[o.jsx(as,{eyebrow:"Device",closeBtn:n,onClose:r,children:e.k}),o.jsx("div",{className:"drawer-body",children:"Not in this view."})]});const a=[...s.recalls||[]].sort((g,y)=>y.design_related-g.design_related||(g.initiated||"").localeCompare(y.initiated||"")),u=so(a),d=s.side==="self"?"Candidate":s.side==="up"?{1:"Direct predicate",2:"Grand-predicate"}[s.gen]||`Generation ${s.gen} ancestor`:`Later device citing this lineage (+${s.gen})`,f=a.filter(g=>g.initiated&&t.device.decision_date&&g.initiated1&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Route"}),o.jsx("dd",{className:"mono",style:{fontSize:12},children:s.chain.join(" → ")})]})]}),o.jsxs("div",{className:"drawer-acts",children:[s.k!==t.k&&o.jsxs("button",{className:"btn btn-primary btn-sm",onClick:()=>l("check",s.k),children:["Investigate ",s.k," ",o.jsx("span",{className:"arr","aria-hidden":"true",children:"→"})]}),o.jsx("a",{className:"btn btn-line btn-sm",href:Ac(s.k),target:"_blank",rel:"noreferrer",children:"FDA 510(k) record ↗"}),s.summary_url&&o.jsx("a",{className:"btn btn-line btn-sm",href:s.summary_url,target:"_blank",rel:"noreferrer",children:"Summary PDF ↗"}),s.lineage_known===!1&&o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>l("ingest",s.k),children:"Try to read its summary"})]}),((h=s.hops)==null?void 0:h.length)>0&&o.jsxs("div",{className:"drawer-sec",children:[o.jsx("h3",{children:"How it is reached"}),o.jsx("div",{className:"tags",children:s.hops.map(g=>o.jsxs("button",{className:"tag-btn",onClick:()=>i({type:"edge",id:g.src+">"+g.dst,hop:g}),children:[o.jsx("span",{className:"k",children:g.src})," → ",o.jsx("span",{className:"k",children:g.dst})," · p.",g.page??"?"," · ",Re[Et(g).key].short]},g.src+g.dst))})]}),o.jsxs("div",{className:"drawer-sec",children:[o.jsxs("h3",{children:["Recall records on which FDA lists this 510(k) · ",u.events," event(s), ",u.records," product record(s)"]}),s.side!=="self"&&f.length>0&&o.jsxs("p",{className:"note-box amber",style:{marginBottom:10},children:[f.length," of these record(s) began before ",t.k," was cleared on ",De(t.device.decision_date),"."]}),a.length===0?o.jsx("p",{className:"muted",children:"openFDA lists this 510(k) on no recall record."}):o.jsx("div",{style:{display:"grid",gap:8},children:a.slice(0,20).map(g=>o.jsx(Gc,{r:g},g.id))}),a.length>20&&o.jsxs("p",{className:"muted small",children:["+ ",a.length-20," more record(s): open the device to see all."]})]})]})]})}const eh={rejected_by_reviewer:"rejected by a reviewer",audit_not_predicate:"the audit found it is not a predicate citation",audit_error:"the audit found a K-number error",audit_unresolved:"the audit could not resolve it",not_in_openfda:"K-number not found in openFDA",cleared_after_citing_device:"K-number cleared after the citing device",audit_variant:"audit marked it a naming variant",audit_corrected:"K-number corrected by the audit"};function Yc(e){const t=[];for(const n of e.signals)switch(n.code){case"DIRECT_RECALL":if(n.severity==="info")break;t.push({id:n.code,tone:n.severity==="high"?"alert":"amber",sev:n.severity,title:n.title,what:"The candidate itself appears in FDA recall records.",why:n.severity==="high"?"A design-related recall on the device you would cite is what FDA's 2023 draft guidance asks you to avoid or explain.":"A Class I recall on the candidate is a documented question for any submission that cites it.",todo:"Open each recall record and document how it is addressed (scope, lots, corrective action).",node:e.k});break;case"ANCESTOR_RECALL":if(n.severity!=="medium")break;t.push({id:n.code+n.chain.join(),tone:n.conditional?"violet":"amber",sev:n.severity,title:n.title,conditional:n.conditional,what:n.conditional?"The recall holder is reached only through a citation the audit could not resolve.":`A ${n.gen===1?"direct predicate":"grand-predicate"} carries recall records the verdict rules treat as review-worthy.`,why:n.conditional?"If that citation is not a predicate, this recall does not belong to the lineage; if it is, it does.":"Reviewers expect the predicate rationale to address design-related recalls in the lineage (FDA 2023 draft guidance; Kadakia et al., JAMA 2023, an association).",todo:n.conditional?"Open the uncertain thread, read the PDF page, and confirm or reject it.":"Verify the citation on its PDF page, read the recall records, and record how the rationale addresses them.",chain:n.chain,hops:n.evidence.filter(r=>r.type==="citation")});break;case"UNCERTAIN_LINK_IN_LINEAGE":case"NAME_MISMATCH_IN_LINEAGE":t.push({id:n.code,tone:"alert",sev:"info",title:n.title,what:"Threads in this ancestry rest on evidence that conflicts with FDA records or needed correction.",why:"A doubtful thread may route the lineage to the wrong device, and the right one may be missing; these links never count as checked.",todo:"Open each thread, compare the quote with the cited device, then confirm or reject it.",hops:n.evidence.filter(r=>r.type==="citation")});break;case"ADVISORY_LINK_PENDING_REVIEW":t.push({id:n.code,tone:"violet",sev:"info",title:n.title,what:"An LLM label or the automated MCP client calls these citations predicates; no person has decided.",why:"They are not used for the verdict. If one is a real predicate, its recalls belong in the lineage and the verdict could change.",todo:"Open each link, read the PDF page, and confirm or reject it yourself.",hops:n.evidence.filter(r=>r.type==="advisory_citation")});break;case"CITATION_RETIRED_BY_REINGEST":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Re-reading the citing device's FDA summary no longer found these citations, so they were retired from the lineage.",why:"Earlier reviews, labels and provenance are kept for the record; a review made on the old text may no longer apply.",todo:"Compare the refreshed summary with the earlier one and record a new review if the citation still matters.",hops:n.evidence});break;case"PREDICATE_CITATION_UNRESOLVED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Predicate citations printed in a summary did not become lineage threads.",why:"A missing thread means part of the ancestry is invisible: a recall there would not show.",todo:"Check each quote. If the citation is real and the K-number valid, add that clearance to extend the graph.",missing:n.evidence});break;case"LINEAGE_UNKNOWN":case"LINEAGE_TRUNCATED":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Some summaries are not machine-readable, so the ancestry stops there.",why:"Recalls further up those branches cannot be seen. The verdict reports this gap; it never fills it in.",todo:"Try reading each summary live (needs internet), which extends the lineage by one generation.",ingest:n.code==="LINEAGE_UNKNOWN"?[{k:e.k}]:n.evidence});break;case"UNATTRIBUTED_RECALLS_IN_PRODUCT_CODE":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"FDA filed these recalls under the product code without naming a 510(k) number.",why:"No lineage query can attribute them; one may still concern a device in this lineage.",todo:"Read the product descriptions and check whether any names a device in this ancestry.",recalls:n.evidence});break;case"RECALL_CAUSE_OR_CLASS_UNKNOWN":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Recall records without a stated root cause or FDA classification.",why:"They cannot be ruled out as design-related or Class I, so they could change the verdict once classified.",todo:"Re-check the FDA records for an updated classification or root cause.",recalls:n.evidence});break;case"DEEPER_ANCESTRY_GAPS":t.push({id:n.code,tone:"muted",sev:"info",title:n.title,what:"Gaps beyond the two-generation verdict window.",why:"They cannot change the verdict, but the lower-severity list may be incomplete.",todo:"Expand the graph to deeper generations if the deeper ancestry matters to your rationale."});break}return t}function th({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Yc(e);return l.length?o.jsx("div",{"data-testid":"review-queue",children:l.map(i=>{var s,a,u,d;return o.jsxs("section",{className:`review-item tone-${i.tone}`,onMouseEnter:()=>i.chain&&r(i.chain),onMouseLeave:()=>r(null),children:[o.jsxs("h3",{children:[o.jsx("span",{className:`sev sev-${i.sev}`,children:i.conditional?"conditional":i.sev==="info"?"gap":i.sev}),o.jsx("span",{children:i.title})]}),o.jsxs("dl",{children:[o.jsx("dt",{children:"Conflict"}),o.jsx("dd",{children:i.what}),o.jsx("dt",{children:"Why it matters"}),o.jsx("dd",{children:i.why}),o.jsx("dt",{children:"Next step"}),o.jsx("dd",{children:i.todo})]}),((s=i.hops)==null?void 0:s.length)>0&&o.jsx("div",{className:"links",children:i.hops.slice(0,8).map(f=>{const p=Et(f);return o.jsxs("button",{className:"tag-btn",onClick:()=>t({type:"edge",id:f.src+">"+f.dst,hop:f}),title:p.reasons.map(h=>Uc[h]).join("; ")||Re[p.key].label,children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.dst})," · p.",f.page??"?"," · ",o.jsx("span",{className:`status-${p.key}`,children:Re[p.key].short})]},f.src+f.dst)})}),((a=i.missing)==null?void 0:a.length)>0&&o.jsx("div",{className:"links",children:i.missing.slice(0,8).map(f=>o.jsxs("button",{className:"tag-btn",title:f.quote||"",onClick:()=>n("ingest",f.cited),children:[o.jsx("span",{className:"k",children:f.src})," → ",o.jsx("span",{className:"k",children:f.cited})," · ",eh[f.reason]||f.reason]},f.src+f.cited))}),((u=i.ingest)==null?void 0:u.length)>0&&o.jsx("div",{className:"links",children:i.ingest.slice(0,10).map(f=>o.jsxs("button",{className:"tag-btn",onClick:()=>n("ingest",f.k),children:[o.jsx("span",{className:"k",children:f.k}),f.summary_status?` · ${f.summary_status}`:""," · read now"]},f.k))}),((d=i.recalls)==null?void 0:d.length)>0&&o.jsx("div",{className:"links",children:i.recalls.slice(0,8).map(f=>f.url?o.jsxs("a",{className:"tag-btn",href:f.url,target:"_blank",rel:"noreferrer",children:[f.id," ↗"]},f.id):o.jsx("span",{className:"tag-btn",children:f.id},f.id))}),i.node&&o.jsx("div",{className:"acts",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.node}),children:"Open recall records"})}),i.chain&&o.jsx("div",{className:"acts",children:o.jsxs("button",{className:"btn btn-line btn-sm",onClick:()=>t({type:"node",k:i.chain[i.chain.length-1]}),children:["Open ",i.chain[i.chain.length-1]," records"]})})]},i.id)})}):o.jsx("p",{className:"muted",children:"Nothing in this lineage needs a person's attention under the current rules."})}function oo(e){const t=e.signals.filter(n=>{var r;return(n.severity==="high"||n.severity==="medium")&&((r=n.chain)==null?void 0:r.length)>1});return t.find(n=>!n.conditional)||t[0]||null}function us(e,t){const n=e.filter(i=>i.design_related),r=n.length?n:e.filter(i=>i.classification==="Class I");return r.filter(i=>i.initiated&&t&&i.initiatedi.initiated.localeCompare(s.initiated))[0]||[...r].sort((i,s)=>(s.initiated||"").localeCompare(i.initiated||""))[0]||null}function nh({a:e}){const t=e.device,n=oo(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=us(r.evidence.filter(i=>i.type==="recall"),null);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[o.jsx("span",{className:"k",children:e.k})," itself appears in FDA recall records",l&&o.jsxs(o.Fragment,{children:[": a ",o.jsxs("span",{className:"amber",children:[l.classification||"unclassified"," ",l.root_cause]})," recall began ",De(l.initiated)]}),"."," ","Citing it as a predicate would need that addressed."]})}if(n){const l=kn(e,n.chain[n.chain.length-1]),i=n.evidence.filter(f=>f.type==="recall"),s=us(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Bc(s.initiated,t.decision_date):null,d=so(i);return o.jsxs("p",{className:"finding-sentence","data-testid":"finding-sentence",children:[st(t.name,48)," cites ",o.jsx("span",{className:"k",children:n.chain[1]}),a!=null&&a.page?o.jsxs(o.Fragment,{children:[" on page ",a.page," of its summary"]}):null,"."," ",n.conditional?o.jsxs(o.Fragment,{children:["The cited device ",o.jsx("span",{className:"k",children:l==null?void 0:l.k}),", reached through a citation the audit could not resolve,"]}):n.chain.length>2?o.jsxs(o.Fragment,{children:["Through it, ",n.gen===2?"grand-predicate":`generation-${n.gen} ancestor`," ",o.jsx("span",{className:"k",children:l==null?void 0:l.k})]}):o.jsx(o.Fragment,{children:"That predicate"})," ","(",st(l==null?void 0:l.name,52),") is listed by FDA on ",d.events," recall event",d.events===1?"":"s"," in this signal",s&&o.jsxs(o.Fragment,{children:[", including a ",o.jsxs("span",{className:"amber",children:[s.classification||"unclassified"," ",s.root_cause]})," recall that began ",De(s.initiated),u&&o.jsxs(o.Fragment,{children:[", ",u.relation==="before"?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"amber",children:[u.duration," before"]})," ",e.k," was cleared"]}):Hc(u,e.k)]})]}),".",n.conditional&&o.jsxs(o.Fragment,{children:[" This route is ",o.jsx("b",{style:{color:"var(--violet)"},children:"conditional"}),": it holds only if that citation is a predicate."]})]})}return o.jsx("p",{className:"finding-sentence","data-testid":"finding-sentence",children:e.verdict_reason})}function rh({a:e,onSelect:t}){const n=oo(e);if(!n)return null;const r=n.evidence.filter(d=>d.type==="citation"),l=(d,f)=>{var p,h;return r.find(g=>g.src===d&&g.dst===f)||((h=(p=kn(e,f))==null?void 0:p.hops)==null?void 0:h.find(g=>g.src===d&&g.dst===f))},i=n.chain[n.chain.length-1],s=n.evidence.filter(d=>d.type==="recall"),a=us(s,e.device.decision_date),u=a?Bc(a.initiated,e.device.decision_date):null;return o.jsxs("section",{className:"panel corner-marks","aria-labelledby":"chain-title","data-testid":"critical-chain",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"chain-title",children:["Critical chain ",o.jsx("span",{className:"count",children:"predicate → recall, the route that raised the verdict"})]}),o.jsx("p",{className:"hint",children:"Select a thread for its page and quote."})]}),o.jsx("div",{className:"chain",children:n.chain.map((d,f)=>{const p=kn(e,d)||{},h=f===0?"Candidate":n.conditional?"Cited device · citation unresolved":f===1?"Direct predicate":f===2?"Grand-predicate":`Generation ${f}`,g=d===i,y=g?io({recalls:s}):"none",k=f>0?l(n.chain[f-1],d):null,L=k?Et(k):null;return o.jsxs(Nl.Fragment,{children:[f>0&&o.jsxs("button",{className:`chain-link st-${(L==null?void 0:L.key)||"extracted"}`,onClick:()=>k&&t({type:"edge",id:k.src+">"+k.dst,hop:k}),"aria-label":`${n.chain[f-1]} cites ${d}${k!=null&&k.page?` on page ${k.page}`:""}, ${Re[(L==null?void 0:L.key)||"extracted"].label}. Open provenance.`,children:[o.jsxs("span",{className:"lbl",children:["cites",k!=null&&k.page?` · p.${k.page}`:""]}),o.jsx("span",{className:"sub",children:Re[(L==null?void 0:L.key)||"extracted"].short})]}),o.jsxs("button",{className:`chain-node${f===0?" is-self":""}${y==="design"?" tone-design":""}`,onClick:()=>t({type:"node",k:d}),children:[o.jsx("span",{className:"role",children:h}),o.jsx("span",{className:"k",children:d}),o.jsx("span",{className:"nm",children:st(p.name,44)}),o.jsxs("span",{className:"dt",children:["Cleared ",De(p.decision_date)]}),g&&a&&o.jsxs("span",{className:"rc",children:[o.jsxs("span",{className:`chip tone-${a.design_related?"design":"class1"}`,children:[a.classification||"Unclassified"," · ",a.root_cause]}),o.jsxs("span",{className:"dt",children:["Recall began ",De(a.initiated)," · ",o.jsx("span",{className:"mono",children:a.id})]})]})]})]},d)})}),a&&u&&o.jsxs("div",{className:"chain-timing",children:[o.jsxs("span",{className:"chip tone-amber",children:[o.jsx("span",{className:"glyph"}),Hc(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[so(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function lh({k:e,go:t,onChanged:n}){var Y,Ze;const[r,l]=_.useState(null),[i,s]=_.useState(null),[a,u]=_.useState(!1),[d,f]=_.useState(4),[p,h]=_.useState(2),[g,y]=_.useState("graph"),[k,L]=_.useState(!1),[v,c]=_.useState(null),[m,w]=_.useState(null),[S,E]=_.useState([]),[j,x]=_.useState([]),R=()=>{u(!0),s(null),Oe.assess(e,d).then(M=>{l(M)}).catch(M=>{l(null),s(M.message)}).finally(()=>u(!1)),Oe.assessments(e).then(E).catch(()=>E([])),Oe.investigations(e,10).then(x).catch(()=>x([]))};if(_.useEffect(()=>{c(null),h(2),R()},[e,d]),i)return o.jsxs("div",{className:"panel",role:"alert",children:[o.jsx("p",{className:"err",style:{fontSize:15},children:i}),i.includes("not in the graph")&&o.jsxs("button",{className:"btn btn-primary",onClick:()=>t("ingest",e),children:["Read ",e," from FDA now ",o.jsx("span",{className:"arr",children:"→"})]})]});if(!r)return o.jsxs("div",{"aria-busy":"true",children:[o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Walking ",e,"'s lineage in the Relate graph…"]}),o.jsx("div",{className:"skeleton",style:{height:210,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:160,marginBottom:16}}),o.jsx("div",{className:"skeleton",style:{height:380}})]});const T=r.device,I=r.coverage,K={...Kn[r.verdict],...Up(r.verdict,I.evidence)},me=Yc(r).length,Be=r.signals.filter(M=>M.conditional).length;return o.jsxs("div",{className:"investigation","aria-busy":a,children:[o.jsxs("section",{className:`finding tone-${K.tone}`,"aria-labelledby":"finding-title","data-testid":"finding",children:[o.jsxs("div",{className:"finding-top",children:[o.jsxs("div",{className:"finding-id",children:[o.jsxs("div",{className:"kline",children:[o.jsx("span",{className:"k",children:r.k}),o.jsxs("span",{children:[T.product_code,(Y=T.product)!=null&&Y.name?` · ${T.product.name}`:""]})]}),o.jsx("h1",{id:"finding-title",children:T.name}),o.jsxs("div",{className:"meta",children:[o.jsx("span",{children:T.applicant}),o.jsxs("span",{children:["Cleared ",De(T.decision_date)]}),o.jsx("span",{children:T.clearance_type||"510(k)"}),o.jsx("a",{href:Ac(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),T.summary_url&&o.jsx("a",{href:T.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),o.jsxs("div",{className:`verdict tone-${K.tone}`,"data-testid":"verdict",children:[o.jsxs("div",{className:"verdict-label",children:[o.jsx("i",{"aria-hidden":"true"}),K.label]}),o.jsx("p",{className:"verdict-reason",children:r.verdict_reason}),o.jsx("div",{className:"verdict-actions",children:o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>t("compare",r.k),children:"Compare with other candidates"})}),o.jsxs("div",{className:"authority",children:[o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M8 1.5l5.5 2v4.2c0 3.3-2.3 5.8-5.5 6.8-3.2-1-5.5-3.5-5.5-6.8V3.5z M5.5 8l1.8 1.8L10.8 6.3"})}),o.jsxs("span",{children:[o.jsx("b",{children:"Deterministic assessment"})," · ",r.rules_version,". Authoritative within its documented scope: ",I.evidence_scope,", from machine-readable FDA records. A documentation signal, not a safety determination."]})]})]})]}),o.jsx(nh,{a:r}),o.jsxs("div",{className:"coverage-row","aria-label":"Evidence coverage",children:[o.jsxs("span",{className:`chip tone-${I.evidence==="complete"?"calm":I.evidence==="uncertain"?"alert":"muted"}`,title:"Completeness of evidence inside the verdict window",children:["Evidence ",I.evidence]}),(I.evidence_reasons||[]).map(M=>o.jsx("span",{className:"chip tone-muted","data-testid":"evidence-reason",children:Vp[M]||M},M)),o.jsxs("span",{className:"chip",children:[I.ancestors," ancestors · ",I.generations_traversed," generations"]}),I.ancestors_lineage_unknown>0&&o.jsxs("span",{className:"chip tone-muted",children:[I.ancestors_lineage_unknown," with unread summaries"]}),I.doubtful_links>0&&o.jsxs("span",{className:"chip tone-alert",children:[I.doubtful_links," doubtful link(s)"]}),Be>0&&o.jsxs("span",{className:"chip tone-violet",children:[Be," conditional signal(s)"]}),me>0&&o.jsxs("a",{className:"chip tone-blue",href:"#review",onClick:M=>{var C;M.preventDefault(),(C=document.getElementById("review"))==null||C.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),o.jsx(rh,{a:r,onSelect:c}),o.jsxs("section",{className:"panel","aria-labelledby":"graph-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"graph-title",children:["Evidence graph ",o.jsxs("span",{className:"count",children:[r.ancestors.length," ancestors · ",r.descendants.length," later devices"]})]}),o.jsxs("div",{className:"graph-tools",children:[o.jsxs("div",{className:"seg",role:"group","aria-label":"View",children:[o.jsx("button",{"aria-pressed":g==="graph",onClick:()=>y("graph"),children:"Graph"}),o.jsx("button",{"aria-pressed":g==="timeline",onClick:()=>y("timeline"),children:"Timeline"})]}),o.jsxs("label",{className:"small muted",children:["Show ",o.jsx("select",{className:"field",value:p,onChange:M=>h(+M.target.value),"aria-label":"Generations shown",children:Array.from({length:d},(M,C)=>C+1).map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),o.jsxs("label",{className:"small muted",children:["Query ",o.jsx("select",{className:"field",value:d,onChange:M=>f(+M.target.value),"aria-label":"Generations traversed by the query",children:[2,3,4,5,6].map(M=>o.jsxs("option",{value:M,children:[M," gen"]},M))})]}),g==="graph"&&r.descendants.length>0&&o.jsxs("button",{className:"btn btn-line btn-sm","aria-pressed":k,onClick:()=>L(!k),children:[k?"Hide":"Show"," later devices"]})]})]}),g==="graph"?o.jsx(Gp,{a:r,depth:p,onDepth:h,descendants:k,selected:v,onSelect:c,focusChain:m}):o.jsx(Xp,{a:r,depth:p,highlight:m||((Ze=oo(r))==null?void 0:Ze.chain),onSelect:c}),o.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(M=>M.lineage_known).length," summary PDFs opened one generation at a time and ",1+r.ancestors.length," separate recall searches. Here it is one Relate query."]})]}),o.jsxs("div",{className:"grid-main",children:[o.jsxs("div",{style:{minWidth:0},children:[o.jsxs("section",{className:"panel",id:"review","aria-labelledby":"review-title",style:{scrollMarginTop:120},children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"review-title",children:["What needs human review ",o.jsx("span",{className:"count",children:me})]}),o.jsx("p",{className:"hint",children:"What conflicts, why it matters, and what to do next."})]}),o.jsx(th,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(ih,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(oh,{a:r,reload:R,go:t,onSelect:c}),o.jsx(ah,{a:r,onSaved:()=>{Oe.assessments(e).then(E),n&&n()}}),o.jsx(uh,{a:r,assessments:S,runs:j,go:t})]})]}),v&&o.jsx(Jp,{sel:v,a:r,onClose:()=>c(null),go:(M,C)=>{c(null),t(M,C)},reload:R,onSelect:c})]})}function ih({a:e,onSelect:t}){const n=e.signals.filter(r=>r.severity==="high"||r.severity==="medium"||r.severity==="low");return o.jsxs("section",{className:"panel","aria-labelledby":"signals-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsxs("h2",{id:"signals-title",children:["Recall signals ",o.jsxs("span",{className:"count",children:[n.length," in the readable ancestry"]})]}),o.jsx("p",{className:"hint",children:"Every recall record behind the verdict, by generation."})]}),n.length===0&&o.jsx("p",{className:"muted",children:"No recall records anywhere in the readable ancestry."}),n.map((r,l)=>o.jsx(sh,{s:r,onSelect:t},l))]})}function sh({s:e,onSelect:t}){var i;const[n,r]=_.useState(e.severity==="high"),l=e.evidence.filter(s=>s.type==="recall");return o.jsxs("div",{className:"signal",children:[o.jsxs("button",{className:"signal-head","aria-expanded":n,onClick:()=>r(!n),children:[o.jsx("span",{className:`sev sev-${e.severity}`,children:e.conditional?"cond.":e.severity}),o.jsx("span",{className:"t",children:e.title}),o.jsx("svg",{className:"chev",width:"12",height:"12",viewBox:"0 0 12 12","aria-hidden":"true",children:o.jsx("path",{d:"M4 2l4 4-4 4",stroke:"currentColor",fill:"none",strokeWidth:"1.5"})})]}),n&&o.jsxs("div",{className:"signal-body",children:[((i=e.chain)==null?void 0:i.length)>1&&o.jsx("div",{className:"tags",children:e.chain.map((s,a)=>o.jsxs(Nl.Fragment,{children:[a>0&&o.jsx("span",{className:"muted small","aria-hidden":"true",children:"→"}),o.jsx("button",{className:"tag-btn",onClick:()=>t({type:"node",k:s}),children:o.jsx("span",{className:"k",children:s})})]},s))}),l.slice(0,6).map(s=>o.jsx(Gc,{r:s},s.id)),l.length>6&&o.jsxs("p",{className:"muted small",children:["+ ",l.length-6," more record(s): open ",e.chain[e.chain.length-1]," for all."]})]})]})}const Ar=(e,t)=>e.review===t&&Ge(e);function oh({a:e,reload:t,go:n,onSelect:r}){const[l,i]=_.useState(null),[s,a]=_.useState(null),u=async(d,f,p)=>{i(d.dst+p),a(null);try{const h=await f();a(p==="ai"?{ok:!0,text:`LLM labelled ${d.dst} "${h.ai_label}" (${h.model.split("/")[1]}, ${h.seconds}s). Advisory only: it is not used for the verdict until a person confirms the citation.`}:null),t()}catch(h){a({ok:!1,text:h.message})}finally{i(null)}};return o.jsxs("section",{className:"panel","aria-labelledby":"cites-title",children:[o.jsx("div",{className:"panel-head",children:o.jsxs("h2",{id:"cites-title",children:["What ",e.k," cites ",o.jsx("span",{className:"count",children:e.citations.length})]})}),o.jsx("p",{className:"lede",children:"Read from its 510(k) summary. Your review is written to the graph and changes every lineage query."}),e.device.lineage_known===!1&&o.jsxs("p",{className:"note-box",children:["Summary not machine-readable (",e.device.summary_status,")."," ",o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>n("ingest",e.k),children:"Try reading it now →"})]}),s&&o.jsx("p",{className:s.ok?"ok":"err",role:"status",children:s.text}),e.citations.map(d=>{const f={...d,src:e.k},p=d.in_lineage??d.kind==="predicate",h=Et(f);return o.jsxs("div",{className:"cit"+(d.review==="rejected"&&Ge(d)?" is-rejected":""),children:[o.jsxs("div",{className:"cit-h",children:[o.jsx("button",{className:"k mono",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:d.dst}),o.jsx("span",{className:`chip ${d.kind==="predicate"?"tone-blue":"tone-muted"}`,children:d.kind}),p||h.key==="advisory"||h.key==="retired"?o.jsxs("span",{className:`status status-${h.key}`,title:Re[h.key].label,"data-testid":`cit-status-${d.dst}`,children:[o.jsx("span",{className:"line"}),Re[h.key].short]}):o.jsx("span",{className:"status status-rejected",title:"Reference devices and mentions are not lineage links","data-testid":`cit-status-${d.dst}`,children:"Not a lineage link"}),d.ai_label&&o.jsxs("span",{className:"chip tone-violet",title:d.ai_quote,children:["LLM: ",d.ai_label]}),o.jsxs("span",{className:"muted small",children:[st(d.name,34)," · ",Wc(d.dst_decision_date)]})]}),o.jsx(Kc,{text:d.quote||d.snippet,k:d.dst,ocr:d.text_source&&d.text_source!=="pdf_text_layer"}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.review(e.k,d.dst,Ar(d,"confirmed")?"":"confirmed"),"ok"),children:Ar(d,"confirmed")?"Unconfirm":"Confirm"}),o.jsx("button",{className:"btn btn-line btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.review(e.k,d.dst,Ar(d,"rejected")?"":"rejected"),"no"),children:Ar(d,"rejected")?"Restore":"Reject"}),d.kind!=="predicate"&&o.jsx("button",{className:"btn btn-quiet btn-sm",disabled:!!l,onClick:()=>u(d,()=>Oe.triage(e.k,d.dst),"ai"),children:l===d.dst+"ai"?"Asking…":"Ask LLM to label"}),o.jsxs("button",{className:"btn btn-quiet btn-sm",onClick:()=>r({type:"edge",id:e.k+">"+d.dst,hop:f}),children:["Provenance · p.",d.page]})]})]},d.dst)})]})}function ah({a:e,onSaved:t}){const[n,r]=_.useState(!1),[l,i]=_.useState(""),[s,a]=_.useState(null),[u,d]=_.useState(!1);_.useEffect(()=>{a(null),r(!1),i("")},[e.k]);const f=async()=>{d(!0);try{const h=await Oe.save(e.k,l);a(h),r(!1),i(""),t()}catch(h){a({error:h.message})}finally{d(!1)}},p=e.memo.headline+` `+e.memo.paragraphs.map(h=>h.text).join(` -`);return o.jsxs("section",{className:"panel memo","aria-labelledby":"memo-title",children:[o.jsx("div",{className:"panel-head",children:o.jsx("h2",{id:"memo-title",children:"Due-diligence note"})}),o.jsx("div",{className:"src",children:e.memo.source}),o.jsx("p",{children:o.jsx("b",{children:e.memo.headline})}),e.memo.paragraphs.slice(0,2).map((h,g)=>o.jsx("p",{children:h.text},g)),e.memo.paragraphs.length>2&&o.jsxs("p",{className:"muted small",children:["+ ",e.memo.paragraphs.length-2," more paragraph(s) in the copied note."]}),o.jsxs("div",{className:"cit-a",style:{marginTop:8},children:[o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>r(!n),"aria-expanded":n,children:"Save assessment to graph"}),o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>{var h;return(h=navigator.clipboard)==null?void 0:h.writeText(p)},children:"Copy note"})]}),n&&o.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[o.jsx("label",{className:"small muted",htmlFor:"analyst-note",children:"Optional analyst note, stored with the assessment"}),o.jsx("textarea",{id:"analyst-note",className:"field",rows:3,value:l,onChange:h=>i(h.target.value),maxLength:1e3}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-primary btn-sm",disabled:u,onClick:f,children:u?"Saving…":"Save to Relate"}),o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>r(!1),children:"Cancel"})]})]}),s&&(s.error?o.jsx("p",{className:"err",children:s.error}):o.jsxs("p",{className:"ok",role:"status",children:["Saved ",s.id,": linked to ",s.flagged_recalls.length," flagged recall record(s)."]}))]})}function ah({a:e,assessments:t,runs:n,go:r}){return o.jsxs("section",{className:"panel","aria-labelledby":"hist-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{id:"hist-title",children:"Investigation history"}),o.jsx("a",{className:"small",href:"#/history",children:"All history →"})]}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"0 0 8px"},children:"Saved assessments"}),t.length===0?o.jsxs("p",{className:"muted small",children:["None saved for ",e.k," yet."]}):t.map(l=>{var i,s,a,u,d,f;return o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"muted",children:(i=l.created_at)==null?void 0:i.slice(0,16).replace("T"," ")}),o.jsx("span",{className:`chip tone-${((s=Gn[l.verdict])==null?void 0:s.tone)||"muted"}`,children:((a=Gn[l.verdict])==null?void 0:a.label)||l.verdict})]}),l.stale&&o.jsxs("div",{className:"stale",children:["Stale: the graph changed after this was saved",l.verdict_now!==l.verdict&&o.jsxs(o.Fragment,{children:[" (verdict now ",((u=Gn[l.verdict_now])==null?void 0:u.label)||l.verdict_now,")"]}),((d=l.changed_edges)==null?void 0:d.length)>0&&o.jsxs(o.Fragment,{children:[" · reviewed links: ",l.changed_edges.join(", ")]}),((f=l.reingested)==null?void 0:f.length)>0&&o.jsxs(o.Fragment,{children:[" · re-ingested: ",l.reingested.join(", ")]})]})]},l.id)}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"16px 0 8px"},children:"Agent runs (optional)"}),o.jsx("p",{className:"muted small",style:{margin:"0 0 6px"},children:"Machine findings, never human-approved. The verdict above does not depend on them."}),n.length===0?o.jsxs("p",{className:"muted small",children:["No agent runs examined ",e.k," in this store."]}):n.map(l=>o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"chip",children:l.status}),l.stale&&o.jsx("span",{className:"stale",children:"stale"}),o.jsx("a",{href:Np(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function uh({go:e,stats:t}){const n=[["K252078","BreathePal Bilevel","Cleared 2026 · direct predicate under a Class I design recall"],["K251770","SleepRes PAP System","Cleared 2025 · a second real lineage"],["K200480","DreamStation 2","Cleared 2020, before the June 2021 recall began"]];return o.jsxs("div",{className:"home-hero",children:[o.jsxs("div",{className:"page-head",children:[o.jsx("p",{className:"eyebrow",children:"Investigate"}),o.jsx("h1",{children:"Check a predicate's ancestry before you cite it."}),o.jsxs("p",{children:["Search any clearance above (press ",o.jsx("code",{children:"/"}),"), or open one of the real cases in the shipped dataset of CPAP, BiPAP and ventilator clearances."]})]}),o.jsxs("div",{className:"home-cases",children:[n.map(([r,l,i])=>o.jsxs("button",{className:"case",onClick:()=>e("check",r),children:[o.jsx("span",{className:"k mono",children:r}),o.jsx("h3",{children:l}),o.jsx("p",{children:i})]},r)),o.jsxs("button",{className:"case",onClick:()=>e("reach","88058,88071"),children:[o.jsx("span",{className:"k mono",children:"Recall 88058 + 88071"}),o.jsx("h3",{children:"Philips foam recall reach"}),o.jsx("p",{children:"Who descends from the June 2021 recall?"})]})]}),t&&o.jsxs("p",{className:"muted small",style:{marginTop:18},children:[t.nodes.Device.toLocaleString("en-US")," clearances · ",t.citations_by_kind.predicate.toLocaleString("en-US")," predicate links · ",t.nodes.Recall.toLocaleString("en-US")," recall records in the Relate store."]})]})}const ch={compare:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>Mt(()=>import("./History-DLMWLVIE.js"),[])),method:_.lazy(()=>Mt(()=>import("./Views-CntGI8oq.js"),[]).then(e=>({default:e.MethodView})))},dh={check:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"}),compare:o.jsx("path",{d:"M2 3h5v10H2zM9 3h5v10H9z"}),reach:o.jsx("path",{d:"M3 8a5 5 0 1010 0A5 5 0 003 8zm3 0a2 2 0 104 0 2 2 0 00-4 0z"}),watch:o.jsx("path",{d:"M1.5 8S4 3 8 3s6.5 5 6.5 5S12 13 8 13 1.5 8 1.5 8zM8 10a2 2 0 100-4 2 2 0 000 4z"}),ingest:o.jsx("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M2 12v2h12v-2"}),history:o.jsx("path",{d:"M8 4v4l2.5 2M2.5 8a5.5 5.5 0 105.5-5.5A5.6 5.6 0 003 6M3 2.5V6h3.5"}),method:o.jsx("path",{d:"M3 2h7l3 3v9H3zM10 2v3h3M5.5 8h5M5.5 11h5"})},fh=({name:e})=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:dh[e]}),ph=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function hh({route:e,go:t,stats:n,statsErr:r,refreshStats:l,onReplay:i}){var u,d;const s=_.useRef(null);_.useEffect(()=>{var f;(f=s.current)==null||f.focus({preventScroll:!0})},[e.tab]);const a=ch[e.tab];return o.jsxs("div",{className:"ws",children:[o.jsxs("header",{className:"ws-top",children:[o.jsx("a",{className:"brand",href:"#/","aria-label":"Forebear home: the film",children:o.jsx(Sp,{size:24})}),o.jsx(mh,{go:t}),o.jsx("span",{className:"spacer"}),o.jsxs("div",{className:"store-chip",title:"Live counts from the Relate single-file store",children:[o.jsx("i",{className:"dot"+(r?" off":""),"aria-hidden":"true"}),n?o.jsxs("span",{className:"counts",children:[o.jsx("b",{children:(u=n.nodes.Device)==null?void 0:u.toLocaleString("en-US")})," devices · ",o.jsx("b",{children:(d=n.nodes.Recall)==null?void 0:d.toLocaleString("en-US")})," recalls · Relate"]}):o.jsx("span",{children:r?"API unavailable":"Connecting…"})]})]}),o.jsxs("nav",{className:"ws-rail","aria-label":"Workspace",children:[ph.map(([f,p])=>o.jsxs(Nl.Fragment,{children:[o.jsx("div",{className:"group",children:f}),p.map(([h,g])=>o.jsxs("a",{href:`#/${h}`,"aria-current":e.tab===h?"page":void 0,children:[o.jsx(fh,{name:h}),g]},h))]},f)),o.jsxs("div",{className:"rail-foot",children:["Verdicts are deterministic documentation signals from FDA records, not safety findings.",!matchMedia("(prefers-reduced-motion: reduce)").matches&&o.jsx("div",{style:{marginTop:10},children:o.jsx("button",{onClick:i,children:"Replay the film"})})]})]}),o.jsxs("main",{className:"ws-main",id:"main",ref:s,tabIndex:-1,style:{outline:"none"},children:[e.tab==="check"&&(e.arg?o.jsx(rh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(uh,{go:t,stats:n})),a&&o.jsx(_.Suspense,{fallback:o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Loading…"]}),children:o.jsx(a,{initial:e.arg,go:t,onChanged:l,stats:n})}),!a&&e.tab!=="check"&&o.jsx("div",{className:"panel",children:o.jsxs("p",{children:["Unknown page. ",o.jsx("a",{href:"#/check",children:"Go to the workspace →"})]})}),o.jsx("footer",{className:"ws-foot",children:"Public FDA data: openFDA 510(k), recall and enforcement records; 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."})]})]})}function mh({go:e}){const[t,n]=_.useState(""),[r,l]=_.useState([]),[i,s]=_.useState(!1),[a,u]=_.useState(0),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(clearTimeout(f.current),t.trim().length<2){l([]);return}let g=!0;return f.current=setTimeout(()=>Oe.search(t).then(y=>{g&&(l(y),u(0))}).catch(()=>g&&l([])),160),()=>{g=!1}},[t]),_.useEffect(()=>{const g=y=>{var k,L;y.key==="/"&&!/INPUT|TEXTAREA|SELECT/.test((k=document.activeElement)==null?void 0:k.tagName)&&(y.preventDefault(),(L=d.current)==null||L.focus())};return addEventListener("keydown",g),()=>removeEventListener("keydown",g)},[]);const p=g=>{var y;s(!1),n(""),(y=d.current)==null||y.blur(),e("check",g)},h=i&&r.length>0;return o.jsxs("div",{className:"search",role:"search",children:[o.jsx("svg",{className:"icon",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"})}),o.jsx("input",{ref:d,className:"field",value:t,placeholder:"Search a device or K-number","aria-label":"Search devices by name or K-number",role:"combobox","aria-expanded":h,"aria-controls":"search-results","aria-activedescendant":h?`sr-${a}`:void 0,"aria-autocomplete":"list",onChange:g=>{n(g.target.value),s(!0)},onFocus:()=>s(!0),onBlur:()=>setTimeout(()=>s(!1),150),onKeyDown:g=>{if(g.key==="ArrowDown")g.preventDefault(),u(y=>Math.min(y+1,r.length-1));else if(g.key==="ArrowUp")g.preventDefault(),u(y=>Math.max(y-1,0));else if(g.key==="Escape")s(!1),g.currentTarget.blur();else if(g.key==="Enter"){const y=t.trim().toUpperCase();/^K\d{6}$/.test(y)?p(y):r[a]&&p(r[a].k)}}}),!t&&o.jsx("kbd",{"aria-hidden":"true",children:"/"}),h&&o.jsx("ul",{className:"search-results",id:"search-results",role:"listbox",children:r.map((g,y)=>o.jsxs("li",{id:`sr-${y}`,role:"option","aria-selected":y===a,onMouseDown:()=>p(g.k),onMouseEnter:()=>u(y),children:[o.jsxs("span",{children:[o.jsx("span",{className:"k",children:g.k})," ",g.name]}),o.jsxs("small",{children:[g.applicant," · ",g.decision_date," · ",g.product_code]})]},g.k))})]})}const vh=_.lazy(()=>Mt(()=>import("./Landing-DUH1bgY7.js"),[])),gh={about:"method"};function Or(e=window.location.hash){if(!e.startsWith("#/"))return{tab:"film",arg:""};const t=e.replace(/^#\/?/,"");if(!t)return{tab:"film",arg:""};const[n,...r]=t.split("/");return{tab:gh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const yh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function xh(){const[e,t]=_.useState(Or),[n,r]=_.useState(null),[l,i]=_.useState(null),s=Lp("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!Ep()&&!matchMedia("(prefers-reduced-motion: reduce)").matches),[d,f]=_.useState(a?"pending":"none");_.useEffect(()=>{document.documentElement.dataset.motion=s?"reduced":"full"},[s]),_.useEffect(()=>{const y=()=>t(Or());return addEventListener("hashchange",y),()=>removeEventListener("hashchange",y)},[]);const p=_.useCallback((y=0)=>Oe.stats().then(k=>{r(k),i(null)}).catch(k=>{y<5?setTimeout(()=>p(y+1),800*(y+1)):i(k.message)}),[]);_.useEffect(()=>{p()},[p]),_.useEffect(()=>{const y={film:"Forebear · Every clearance has a past",check:e.arg?`${e.arg} · Forebear`:"Investigate · Forebear",compare:"Compare predicates · Forebear",reach:"Recall reach · Forebear",watch:"Watchlist · Forebear",ingest:"Add a clearance · Forebear",history:"History · Forebear",method:"Method · Forebear"};document.title=y[e.tab]||"Forebear"},[e]);const h=_.useCallback((y,k="",L={})=>{const v=yh(y,k),c=()=>{history.pushState(null,"",v),t(Or(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>Fc.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Or());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Tp(),e.tab!=="film"&&h("film"),window.scrollTo(0,0),s||(f("pending"),u(!0))};return o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"skip-link",href:"#main",onClick:y=>{var k;y.preventDefault(),(k=document.getElementById("main"))==null||k.focus()},children:"Skip to content"}),a&&o.jsx(Pp,{onDone:()=>{f("bloom"),setTimeout(()=>u(!1),700),requestAnimationFrame(()=>{var y;return(y=document.getElementById("hero-title"))==null?void 0:y.focus({preventScroll:!0})})}}),o.jsx("div",{inert:a&&d==="pending"?"":void 0,style:{display:"contents"},children:e.tab==="film"?o.jsx(_.Suspense,{fallback:o.jsx("div",{style:{minHeight:"100vh"}}),children:o.jsx(vh,{go:h,stats:n,introDone:d,reduced:s})}):o.jsx(hh,{route:e,go:h,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}Ic(document.getElementById("root")).render(o.jsx(xh,{}));export{Hc as A,wh as E,Oc as M,fi as P,Nl as R,kh as T,Gn as V,Sp as W,Mt as _,Up as a,ka as b,Oe as c,Np as d,De as f,o as j,wa as m,Fp as p,_ as r,Lp as u,Op as v}; +`);return o.jsxs("section",{className:"panel memo","aria-labelledby":"memo-title",children:[o.jsx("div",{className:"panel-head",children:o.jsx("h2",{id:"memo-title",children:"Due-diligence note"})}),o.jsx("div",{className:"src",children:e.memo.source}),o.jsx("p",{children:o.jsx("b",{children:e.memo.headline})}),e.memo.paragraphs.slice(0,2).map((h,g)=>o.jsx("p",{children:h.text},g)),e.memo.paragraphs.length>2&&o.jsxs("p",{className:"muted small",children:["+ ",e.memo.paragraphs.length-2," more paragraph(s) in the copied note."]}),o.jsxs("div",{className:"cit-a",style:{marginTop:8},children:[o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>r(!n),"aria-expanded":n,children:"Save assessment to graph"}),o.jsx("button",{className:"btn btn-line btn-sm",onClick:()=>{var h;return(h=navigator.clipboard)==null?void 0:h.writeText(p)},children:"Copy note"})]}),n&&o.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[o.jsx("label",{className:"small muted",htmlFor:"analyst-note",children:"Optional analyst note, stored with the assessment"}),o.jsx("textarea",{id:"analyst-note",className:"field",rows:3,value:l,onChange:h=>i(h.target.value),maxLength:1e3}),o.jsxs("div",{className:"cit-a",children:[o.jsx("button",{className:"btn btn-primary btn-sm",disabled:u,onClick:f,children:u?"Saving…":"Save to Relate"}),o.jsx("button",{className:"btn btn-quiet btn-sm",onClick:()=>r(!1),children:"Cancel"})]})]}),s&&(s.error?o.jsx("p",{className:"err",children:s.error}):o.jsxs("p",{className:"ok",role:"status",children:["Saved ",s.id,": linked to ",s.flagged_recalls.length," flagged recall record(s)."]}))]})}function uh({a:e,assessments:t,runs:n,go:r}){return o.jsxs("section",{className:"panel","aria-labelledby":"hist-title",children:[o.jsxs("div",{className:"panel-head",children:[o.jsx("h2",{id:"hist-title",children:"Investigation history"}),o.jsx("a",{className:"small",href:"#/history",children:"All history →"})]}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"0 0 8px"},children:"Saved assessments"}),t.length===0?o.jsxs("p",{className:"muted small",children:["None saved for ",e.k," yet."]}):t.map(l=>{var i,s,a,u,d,f;return o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"muted",children:(i=l.created_at)==null?void 0:i.slice(0,16).replace("T"," ")}),o.jsx("span",{className:`chip tone-${((s=Kn[l.verdict])==null?void 0:s.tone)||"muted"}`,children:((a=Kn[l.verdict])==null?void 0:a.label)||l.verdict})]}),l.stale&&o.jsxs("div",{className:"stale",children:["Stale: the graph changed after this was saved",l.verdict_now!==l.verdict&&o.jsxs(o.Fragment,{children:[" (verdict now ",((u=Kn[l.verdict_now])==null?void 0:u.label)||l.verdict_now,")"]}),((d=l.changed_edges)==null?void 0:d.length)>0&&o.jsxs(o.Fragment,{children:[" · reviewed links: ",l.changed_edges.join(", ")]}),((f=l.reingested)==null?void 0:f.length)>0&&o.jsxs(o.Fragment,{children:[" · re-ingested: ",l.reingested.join(", ")]})]})]},l.id)}),o.jsx("h3",{className:"eyebrow",style:{fontSize:10.5,margin:"16px 0 8px"},children:"Agent runs (optional)"}),o.jsx("p",{className:"muted small",style:{margin:"0 0 6px"},children:"Machine findings, never human-approved. The verdict above does not depend on them."}),n.length===0?o.jsxs("p",{className:"muted small",children:["No agent runs examined ",e.k," in this store."]}):n.map(l=>o.jsxs("div",{className:"hist",children:[o.jsxs("div",{className:"hist-h",children:[o.jsx("span",{className:"k mono",children:l.id}),o.jsx("span",{className:"chip",children:l.status}),l.stale&&o.jsx("span",{className:"stale",children:"stale"}),o.jsx("a",{href:Sp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function ch({go:e,stats:t}){const n=[["K252078","BreathePal Bilevel","Cleared 2026 · direct predicate under a Class I design recall"],["K251770","SleepRes PAP System","Cleared 2025 · a second real lineage"],["K200480","DreamStation 2","Cleared 2020, before the June 2021 recall began"]];return o.jsxs("div",{className:"home-hero",children:[o.jsxs("div",{className:"page-head",children:[o.jsx("p",{className:"eyebrow",children:"Investigate"}),o.jsx("h1",{children:"Check a predicate's ancestry before you cite it."}),o.jsxs("p",{children:["Search any clearance above (press ",o.jsx("code",{children:"/"}),"), or open one of the real cases in the shipped dataset of CPAP, BiPAP and ventilator clearances."]})]}),o.jsxs("div",{className:"home-cases",children:[n.map(([r,l,i])=>o.jsxs("button",{className:"case",onClick:()=>e("check",r),children:[o.jsx("span",{className:"k mono",children:r}),o.jsx("h3",{children:l}),o.jsx("p",{children:i})]},r)),o.jsxs("button",{className:"case",onClick:()=>e("reach","88058,88071"),children:[o.jsx("span",{className:"k mono",children:"Recall 88058 + 88071"}),o.jsx("h3",{children:"Philips foam recall reach"}),o.jsx("p",{children:"Who descends from the June 2021 recall?"})]})]}),t&&o.jsxs("p",{className:"muted small",style:{marginTop:18},children:[t.nodes.Device.toLocaleString("en-US")," clearances · ",t.citations_by_kind.predicate.toLocaleString("en-US")," predicate links · ",t.nodes.Recall.toLocaleString("en-US")," recall records in the Relate store."]})]})}const dh={compare:_.lazy(()=>Mt(()=>import("./Views-Dyqeayth.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>Mt(()=>import("./Views-Dyqeayth.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>Mt(()=>import("./Views-Dyqeayth.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>Mt(()=>import("./Views-Dyqeayth.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>Mt(()=>import("./History-DPVVy-wq.js"),[])),method:_.lazy(()=>Mt(()=>import("./Views-Dyqeayth.js"),[]).then(e=>({default:e.MethodView})))},fh={check:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"}),compare:o.jsx("path",{d:"M2 3h5v10H2zM9 3h5v10H9z"}),reach:o.jsx("path",{d:"M3 8a5 5 0 1010 0A5 5 0 003 8zm3 0a2 2 0 104 0 2 2 0 00-4 0z"}),watch:o.jsx("path",{d:"M1.5 8S4 3 8 3s6.5 5 6.5 5S12 13 8 13 1.5 8 1.5 8zM8 10a2 2 0 100-4 2 2 0 000 4z"}),ingest:o.jsx("path",{d:"M8 2v8m0 0l-3-3m3 3l3-3M2 12v2h12v-2"}),history:o.jsx("path",{d:"M8 4v4l2.5 2M2.5 8a5.5 5.5 0 105.5-5.5A5.6 5.6 0 003 6M3 2.5V6h3.5"}),method:o.jsx("path",{d:"M3 2h7l3 3v9H3zM10 2v3h3M5.5 8h5M5.5 11h5"})},ph=({name:e})=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:fh[e]}),hh=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function mh({route:e,go:t,stats:n,statsErr:r,refreshStats:l,onReplay:i}){var u,d;const s=_.useRef(null);_.useEffect(()=>{var f;(f=s.current)==null||f.focus({preventScroll:!0})},[e.tab]);const a=dh[e.tab];return o.jsxs("div",{className:"ws",children:[o.jsxs("header",{className:"ws-top",children:[o.jsx("a",{className:"brand",href:"#/","aria-label":"Forebear home: the film",children:o.jsx(_p,{size:24})}),o.jsx(vh,{go:t}),o.jsx("span",{className:"spacer"}),o.jsxs("div",{className:"store-chip",title:"Live counts from the Relate single-file store",children:[o.jsx("i",{className:"dot"+(r?" off":""),"aria-hidden":"true"}),n?o.jsxs("span",{className:"counts",children:[o.jsx("b",{children:(u=n.nodes.Device)==null?void 0:u.toLocaleString("en-US")})," devices · ",o.jsx("b",{children:(d=n.nodes.Recall)==null?void 0:d.toLocaleString("en-US")})," recalls · Relate"]}):o.jsx("span",{children:r?"API unavailable":"Connecting…"})]})]}),o.jsxs("nav",{className:"ws-rail","aria-label":"Workspace",children:[hh.map(([f,p])=>o.jsxs(Nl.Fragment,{children:[o.jsx("div",{className:"group",children:f}),p.map(([h,g])=>o.jsxs("a",{href:`#/${h}`,"aria-current":e.tab===h?"page":void 0,children:[o.jsx(ph,{name:h}),g]},h))]},f)),o.jsxs("div",{className:"rail-foot",children:["Verdicts are deterministic documentation signals from FDA records, not safety findings.",!matchMedia("(prefers-reduced-motion: reduce)").matches&&o.jsx("div",{style:{marginTop:10},children:o.jsx("button",{onClick:i,children:"Replay the film"})})]})]}),o.jsxs("main",{className:"ws-main",id:"main",ref:s,tabIndex:-1,style:{outline:"none"},children:[e.tab==="check"&&(e.arg?o.jsx(lh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(ch,{go:t,stats:n})),a&&o.jsx(_.Suspense,{fallback:o.jsxs("div",{className:"loading-thread",children:[o.jsx("i",{}),"Loading…"]}),children:o.jsx(a,{initial:e.arg,go:t,onChanged:l,stats:n})}),!a&&e.tab!=="check"&&o.jsx("div",{className:"panel",children:o.jsxs("p",{children:["Unknown page. ",o.jsx("a",{href:"#/check",children:"Go to the workspace →"})]})}),o.jsx("footer",{className:"ws-foot",children:"Public FDA data: openFDA 510(k), recall and enforcement records; 510(k) summary PDFs. Forebear reports documented lineage and recall history; it does not judge device safety. Not regulatory advice."})]})]})}function vh({go:e}){const[t,n]=_.useState(""),[r,l]=_.useState([]),[i,s]=_.useState(!1),[a,u]=_.useState(0),d=_.useRef(null),f=_.useRef(null);_.useEffect(()=>{if(clearTimeout(f.current),t.trim().length<2){l([]);return}let g=!0;return f.current=setTimeout(()=>Oe.search(t).then(y=>{g&&(l(y),u(0))}).catch(()=>g&&l([])),160),()=>{g=!1}},[t]),_.useEffect(()=>{const g=y=>{var k,L;y.key==="/"&&!/INPUT|TEXTAREA|SELECT/.test((k=document.activeElement)==null?void 0:k.tagName)&&(y.preventDefault(),(L=d.current)==null||L.focus())};return addEventListener("keydown",g),()=>removeEventListener("keydown",g)},[]);const p=g=>{var y;s(!1),n(""),(y=d.current)==null||y.blur(),e("check",g)},h=i&&r.length>0;return o.jsxs("div",{className:"search",role:"search",children:[o.jsx("svg",{className:"icon",width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:o.jsx("path",{d:"M11 11l4 4M7 12.5A5.5 5.5 0 107 1.5a5.5 5.5 0 000 11z"})}),o.jsx("input",{ref:d,className:"field",value:t,placeholder:"Search a device or K-number","aria-label":"Search devices by name or K-number",role:"combobox","aria-expanded":h,"aria-controls":"search-results","aria-activedescendant":h?`sr-${a}`:void 0,"aria-autocomplete":"list",onChange:g=>{n(g.target.value),s(!0)},onFocus:()=>s(!0),onBlur:()=>setTimeout(()=>s(!1),150),onKeyDown:g=>{if(g.key==="ArrowDown")g.preventDefault(),u(y=>Math.min(y+1,r.length-1));else if(g.key==="ArrowUp")g.preventDefault(),u(y=>Math.max(y-1,0));else if(g.key==="Escape")s(!1),g.currentTarget.blur();else if(g.key==="Enter"){const y=t.trim().toUpperCase();/^K\d{6}$/.test(y)?p(y):r[a]&&p(r[a].k)}}}),!t&&o.jsx("kbd",{"aria-hidden":"true",children:"/"}),h&&o.jsx("ul",{className:"search-results",id:"search-results",role:"listbox",children:r.map((g,y)=>o.jsxs("li",{id:`sr-${y}`,role:"option","aria-selected":y===a,onMouseDown:()=>p(g.k),onMouseEnter:()=>u(y),children:[o.jsxs("span",{children:[o.jsx("span",{className:"k",children:g.k})," ",g.name]}),o.jsxs("small",{children:[g.applicant," · ",g.decision_date," · ",g.product_code]})]},g.k))})]})}const gh=_.lazy(()=>Mt(()=>import("./Landing-mM6lZWLo.js"),[])),yh={about:"method"};function Or(e=window.location.hash){if(!e.startsWith("#/"))return{tab:"film",arg:""};const t=e.replace(/^#\/?/,"");if(!t)return{tab:"film",arg:""};const[n,...r]=t.split("/");return{tab:yh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const xh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function wh(){const[e,t]=_.useState(Or),[n,r]=_.useState(null),[l,i]=_.useState(null),s=Rp("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!Cp()&&!matchMedia("(prefers-reduced-motion: reduce)").matches),[d,f]=_.useState(a?"pending":"none");_.useEffect(()=>{document.documentElement.dataset.motion=s?"reduced":"full"},[s]),_.useEffect(()=>{const y=()=>t(Or());return addEventListener("hashchange",y),()=>removeEventListener("hashchange",y)},[]);const p=_.useCallback((y=0)=>Oe.stats().then(k=>{r(k),i(null)}).catch(k=>{y<5?setTimeout(()=>p(y+1),800*(y+1)):i(k.message)}),[]);_.useEffect(()=>{p()},[p]),_.useEffect(()=>{const y={film:"Forebear · Every clearance has a past",check:e.arg?`${e.arg} · Forebear`:"Investigate · Forebear",compare:"Compare predicates · Forebear",reach:"Recall reach · Forebear",watch:"Watchlist · Forebear",ingest:"Add a clearance · Forebear",history:"History · Forebear",method:"Method · Forebear"};document.title=y[e.tab]||"Forebear"},[e]);const h=_.useCallback((y,k="",L={})=>{const v=xh(y,k),c=()=>{history.pushState(null,"",v),t(Or(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>Fc.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Or());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Pp(),e.tab!=="film"&&h("film"),window.scrollTo(0,0),s||(f("pending"),u(!0))};return o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"skip-link",href:"#main",onClick:y=>{var k;y.preventDefault(),(k=document.getElementById("main"))==null||k.focus()},children:"Skip to content"}),a&&o.jsx(Lp,{onDone:()=>{f("bloom"),setTimeout(()=>u(!1),700),requestAnimationFrame(()=>{var y;return(y=document.getElementById("hero-title"))==null?void 0:y.focus({preventScroll:!0})})}}),o.jsx("div",{inert:a&&d==="pending"?"":void 0,style:{display:"contents"},children:e.tab==="film"?o.jsx(_.Suspense,{fallback:o.jsx("div",{style:{minHeight:"100vh"}}),children:o.jsx(gh,{go:h,stats:n,introDone:d,reduced:s})}):o.jsx(mh,{route:e,go:h,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}Ic(document.getElementById("root")).render(o.jsx(wh,{}));export{Qc as A,kh as E,Oc as M,fi as P,Nl as R,jh as T,Kn as V,_p as W,Mt as _,Vp as a,ka as b,Oe as c,Sp as d,De as f,o as j,wa as m,Ip as p,_ as r,Rp as u,Up as v}; diff --git a/web/dist/index.html b/web/dist/index.html index 757015a..e2b7847 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -7,7 +7,7 @@ - + From 234157360fc1bf276cd5926475d57dffedfe65e4 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 14:11:14 +0100 Subject: [PATCH 10/10] docs: describe explicit summary refresh and evidence-bound reviews --- docs/EVIDENCE_QUALITY.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/EVIDENCE_QUALITY.md b/docs/EVIDENCE_QUALITY.md index 8195370..a9e10f4 100644 --- a/docs/EVIDENCE_QUALITY.md +++ b/docs/EVIDENCE_QUALITY.md @@ -112,8 +112,22 @@ and the original quote, page and source hash stay on the edge, it leaves trusted restored if a later summary cites the device again. Reconciliation runs only when the refreshed summary text was read, so an unreadable download never wipes lineage, and any write error rolls the whole ingest back. Retired edges appear in the `CITATION_RETIRED_BY_REINGEST` signal; one that a person had confirmed makes the evidence `partial` (reason -`human_confirmed_citation_retired`). Reviews record the summary hash they were made against -(`reviewed_source_sha256`). +`human_confirmed_citation_retired`). + +Summary refresh (`summaries.refresh`, `POST /api/ingest {"refresh": true}`, MCP `ingest_clearance refresh=true`, the +"Re-download" option on *Add a clearance*): a plain re-ingest reuses the cached summary text, so only an explicit +refresh can see a changed FDA PDF. The refresh re-downloads the PDF and writes the new record to the gitignored +`data/live` cache, which then supersedes the committed `data/raw` record for the app; `data/raw` is never written by the +app (openFDA responses follow the same rule). The cached record is replaced only by readable evidence: a download +error, an HTTP 429/5xx, a missing PDF or an image-only PDF raises an error that changes neither the cache nor the graph. +An unchanged PDF (same SHA-256) is reported as unchanged. + +Reviews are bound to the evidence version: a review records the summary SHA-256 it was made against +(`reviewed_source_sha256`) and counts only while the edge carries that SHA-256 (`graph.CURRENT_HUMAN_REVIEW`). When a +refresh changes the PDF, or a retired citation is restored from a different PDF, the review stays on the edge as history +but stops counting: the edge falls back to the extraction rules and is flagged `review_outdated`; an outdated +confirmation of a non-predicate becomes an advisory link (`outdated_human_confirmation`). A person's new review on the +current evidence makes it trusted again. A legacy review without a recorded hash counts only on an edge that has none. ### 5. Uncertainty in assessments (`forebear/lineage.py`, rules `forebear-rules-v3`) A lineage hop is **doubtful** when it is audit-unresolved, its K-number was supplied by an audit correction rather than