From 2cff2636f032e12610593d3e423d5622ecdf5e21 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 12:52:12 +0100 Subject: [PATCH 01/14] fix: classify how each recall record is attributed to the clearance FDA lists --- forebear/lineage.py | 24 +++++++++++++++++++++- tests/test_evidence_integrity.py | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/test_evidence_integrity.py diff --git a/forebear/lineage.py b/forebear/lineage.py index dcc9e9c..bcec021 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -22,7 +22,29 @@ def _recall_ev(x: dict) -> dict: "root_cause": x.get("root_cause"), "design_related": x.get("design_related"), "initiated": x.get("initiated"), "firm": x.get("firm"), "reason": x.get("reason"), "url": x.get("url"), "status": x.get("status"), - "link_name_check": x.get("link_name_check"), "linked_before_clearance": x.get("linked_before_clearance")} + "link_name_check": x.get("link_name_check"), "linked_before_clearance": x.get("linked_before_clearance"), + "attribution": recall_attribution(x)} + + +def recall_attribution(x: dict) -> str: + """How a recall record is tied to the 510(k) it is linked to. The link itself is always FDA's: openFDA lists the + clearance's K-number on the recall record. That is an association, not proof that this cleared model was recalled. + + product_family the recall began before this clearance was decided, so the clearance cannot be the recalled + product as cleared; FDA lists later clearances of the same product family on older recalls + model_named the recall's product/reason text names this device + listed_only FDA lists the K-number, but the recall text does not name this device (the recalled model may + be another one in the family) + unchecked FDA lists the K-number; the device's FDA name has no distinctive token to check + """ + if x.get("linked_before_clearance"): + return "product_family" + nc = x.get("link_name_check") + if nc == "match": + return "model_named" + if nc == "mismatch": + return "listed_only" + return "unchecked" def _count(recs: list[dict]) -> str: diff --git a/tests/test_evidence_integrity.py b/tests/test_evidence_integrity.py new file mode 100644 index 0000000..944a218 --- /dev/null +++ b/tests/test_evidence_integrity.py @@ -0,0 +1,34 @@ +"""Regression tests for the evidence-integrity fixes: compare keeps coverage, recall reach classifies timing per +supported / conditional route with date boundaries, the watchlist compares clearance dates and tracks the supported +generation, and recall links say whether they are FDA-listed associations or name the recalled model.""" +import pytest +from conftest import build_tiny, recall + +from forebear.lineage import assess, recall_attribution + + +# ---------------------------------------------------------------- recall attribution +@pytest.mark.parametrize("link,want", [ + ({"linked_before_clearance": True, "link_name_check": "match"}, "product_family"), + ({"linked_before_clearance": False, "link_name_check": "match"}, "model_named"), + ({"linked_before_clearance": False, "link_name_check": "mismatch"}, "listed_only"), + ({"link_name_check": "n/a"}, "unchecked"), + ({}, "unchecked"), +]) +def test_recall_attribution(link, want): + assert recall_attribution(link) == want + + +def test_assessment_recall_evidence_carries_attribution(tmp_path): + g = build_tiny(tmp_path / "a.rl") + try: + # FDA lists K000003 on a recall that began before K000003 was cleared: a product-family association + r = recall("Z-0002-2009", ["K000003"], "2009-01-01", event="2") + r["links"] = [{"k": "K000003", "name_check": "mismatch", "before_clearance": True}] + g.upsert_recalls([r]) + a = assess(g, "K000004") + ev = {e["id"]: e for s in a["signals"] for e in s["evidence"] if e.get("type") == "recall"} + assert ev["Z-0002-2009"]["attribution"] == "product_family" + assert ev["Z-0001-2008"]["attribution"] == "unchecked" + finally: + g.close() From 838d0cd7207f505b8e21de3ae1a3387386654de4 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 12:52:27 +0100 Subject: [PATCH 02/14] fix: keep evidence coverage, provisional status and verdict reason in compare rows --- forebear/lineage.py | 29 ++++++++++++++++++-- tests/test_evidence_integrity.py | 46 ++++++++++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/forebear/lineage.py b/forebear/lineage.py index bcec021..afbe70a 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -206,6 +206,17 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: # `evidence` describes the verdict window only (the candidate and two predicate generations, the reach of # every severity rule that can change a verdict); gaps beyond it are counted in coverage.deeper_gaps. shallow = depth < EVIDENCE_WINDOW # grand-predicates were not traversed at all + window_doubtful = [d for d in doubtful if d["gen"] <= EVIDENCE_WINDOW] + # Why the verdict window is not complete, one code per gap, so every view can say so without re-deriving it. + evidence_reasons = [code for code, hit in ( + ("direct_predicate_links_all_uncertain", bool(gen1 and not trusted_gen1)), + ("unresolved_predicate_citations", bool(missing)), + ("direct_predicate_summaries_unread", bool(gen1_unread)), + ("doubtful_links_in_window", bool(window_doubtful)), + ("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)), + ) 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 \ @@ -262,7 +273,8 @@ def assess(g: Graph, k: str, depth: int = 4) -> dict | None: "ancestors": ancestors, "descendants": descendants, "coverage": {"ancestors": len(ancestors), "ancestors_lineage_unknown": len(unknown), "candidate_lineage_known": bool(dev.get("lineage_known")), - "evidence": evidence, "doubtful_links": len(doubtful), + "evidence": evidence, "evidence_reasons": evidence_reasons, + "doubtful_links": len(doubtful), "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)", @@ -326,9 +338,16 @@ def _missing_predicates(g: Graph, d: dict) -> list[dict]: return out +def provisional(a: dict) -> bool: + """A "no signal" verdict that rests on an incomplete verdict window: it says nothing about the missing part.""" + return a["verdict"] == "NO_DESIGN_RECALL_SIGNAL" and a["coverage"]["evidence"] != "complete" + + def compare(g: Graph, ks: list[str], depth: int = 4) -> list[dict]: """One row per candidate predicate - the comparison table FDA's draft guidance suggests - submitters include when explaining predicate selection.""" + submitters include when explaining predicate selection. Each row keeps the verdict's evidence coverage, + the reasons it is incomplete and the verdict reason, so two equal verdicts on unequal evidence never + look the same.""" rows = [] for k in ks: a = assess(g, k, depth) @@ -339,6 +358,12 @@ def compare(g: Graph, ks: list[str], depth: int = 4) -> list[dict]: rows.append({ "k": k, "found": True, "name": d.get("name"), "applicant": d.get("applicant"), "decision_date": d.get("decision_date"), "verdict": a["verdict"], + "verdict_reason": a["verdict_reason"], "provisional": provisional(a), + "evidence": a["coverage"]["evidence"], "evidence_reasons": a["coverage"]["evidence_reasons"], + "deeper_gaps": a["coverage"]["deeper_gaps"], + # medium signals that all hang on an unresolved citation: the REVIEW verdict is conditional + "conditional": a["verdict"] == "REVIEW_LINEAGE" and not any( + s["severity"] == "medium" and not s.get("conditional") for s in a["signals"]), "own_recalls": len(d["recalls"]), "own_design_recalls": sum(1 for x in d["recalls"] if x.get("design_related")), "flagged_ancestors_gen12": sum(1 for s in a["signals"] diff --git a/tests/test_evidence_integrity.py b/tests/test_evidence_integrity.py index 944a218..a39958b 100644 --- a/tests/test_evidence_integrity.py +++ b/tests/test_evidence_integrity.py @@ -2,9 +2,51 @@ supported / conditional route with date boundaries, the watchlist compares clearance dates and tracks the supported generation, and recall links say whether they are FDA-listed associations or name the recalled model.""" import pytest -from conftest import build_tiny, recall +from conftest import build_tiny, cite, dev, recall -from forebear.lineage import assess, recall_attribution +from forebear.lineage import assess, compare, recall_attribution + + +def _unresolve(g, src, dst): + g.q("MATCH (:Device {k:$s})-[r:CITES]->(:Device {k:$d}) SET r.audit = 'unresolved'", {"s": src, "d": dst}) + + +# ---------------------------------------------------------------- compare keeps coverage +def test_compare_rows_carry_coverage_and_provisional(tiny): + tiny.upsert_devices([dev("K000015", "2019-01-01")]) + tiny.upsert_citations([cite("K000015", "K000008")]) # direct predicate whose summary was not read + rows = {r["k"]: r for r in compare(tiny, ["K000009", "K000015", "K000002"])} + clean, partial = rows["K000009"], rows["K000015"] + assert clean["verdict"] == partial["verdict"] == "NO_DESIGN_RECALL_SIGNAL" + assert clean["evidence"] == "complete" and clean["provisional"] is False and clean["evidence_reasons"] == [] + assert partial["evidence"] == "partial" and partial["provisional"] is True + assert "direct_predicate_summaries_unread" in partial["evidence_reasons"] + assert partial["verdict_reason"].startswith("Provisional:") + a = assess(tiny, "K000015") + assert a["coverage"]["evidence_reasons"] == partial["evidence_reasons"] + + +def test_compare_marks_review_resting_only_on_unresolved_citation(tiny): + _unresolve(tiny, "K000003", "K000002") + row = compare(tiny, ["K000003"])[0] + assert row["verdict"] == "REVIEW_LINEAGE" and row["conditional"] is True + row = compare(tiny, ["K000005"])[0] # gen 3 from the recall: no medium signal at all + assert row["conditional"] is False + + +def test_compare_regression_K012323_vs_K014074(real_copy): + from forebear.graph import open_graph + g = open_graph(real_copy, read_only=True) + try: + rows = {r["k"]: r for r in compare(g, ["K012323", "K014074"])} + finally: + g.close() + a, b = rows["K012323"], rows["K014074"] + assert a["verdict"] == b["verdict"] == "NO_DESIGN_RECALL_SIGNAL" + assert a["evidence"] == "partial" and a["provisional"] is True and a["evidence_reasons"] + assert a["verdict_reason"].startswith("Provisional:") + assert b["evidence"] == "complete" and b["provisional"] is False and b["evidence_reasons"] == [] + assert not b["verdict_reason"].startswith("Provisional:") # ---------------------------------------------------------------- recall attribution From df01d78c80f3a134b90bb530b14bfcfcdac9b129 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 12:53:29 +0100 Subject: [PATCH 03/14] fix: classify recall reach timing per supported route with same-day and unknown dates --- forebear/api.py | 4 +- forebear/graph.py | 39 +++++++--------- forebear/investigation/tools.py | 7 +-- forebear/lineage.py | 73 ++++++++++++++++++++++++++++++ tests/test_evidence_integrity.py | 76 +++++++++++++++++++++++++++++++- tests/test_graph.py | 10 ++--- 6 files changed, 174 insertions(+), 35 deletions(-) diff --git a/forebear/api.py b/forebear/api.py index 0dc65c0..4e58704 100644 --- a/forebear/api.py +++ b/forebear/api.py @@ -23,7 +23,7 @@ from .ingest import IngestError from .investigation import runner as inv_runner from .investigation import store as inv_store -from .lineage import assess, compare +from .lineage import assess, compare, recall_reach agent.load_env() use_live_cache() # live ingests never touch the committed data/raw cache @@ -155,7 +155,7 @@ async def compare_ep(body: CompareIn): async def recall_event(event: str, depth: int = 3): if not all(e.strip().isdigit() for e in event.split(",")) or event.count(",") > 9: raise HTTPException(400, "Recall event numbers are numeric, e.g. 88058 or 88058,88071") - return await run(lambda g: g.recall_event_reach(event, depth)) + return await run(lambda g: recall_reach(g, event, depth)) @app.get("/api/watchlist") diff --git a/forebear/graph.py b/forebear/graph.py index a564c19..4dcb877 100644 --- a/forebear/graph.py +++ b/forebear/graph.py @@ -341,39 +341,30 @@ def cited_after_recall(self, design_only: bool = True, limit: int = 200) -> list return rows def recall_event_reach(self, event: str, depth: int = 3) -> dict: - """For one recall event (or several, comma-separated): the recalled devices and every - later clearance that descends from them. `after_recall` compares each descendant's - clearance date with the earliest recall start among the recalled devices it actually - descends from. `conditional_via` lists holders reached exclusively through unresolved - audit links.""" + """For one recall event (or several, comma-separated): the clearances FDA lists on it and every + later clearance that descends from them. See lineage.recall_reach for the timing classification.""" events = [e.strip() for e in str(event).split(",") if e.strip()] - devs = self.q("""MATCH (d:Device)-[:SUBJECT_OF]->(x:Recall) WHERE x.event IN $es - RETURN d.k AS k, d.name AS name, min(x.initiated) AS initiated""", {"es": events}) + devs = self.q("""MATCH (d:Device)-[s:SUBJECT_OF]->(x:Recall) WHERE x.event IN $es + RETURN d.k AS k, d.name AS name, toString(d.decision_date) AS decision_date, + toString(min(x.initiated)) AS initiated, count(x) AS records, + collect(DISTINCT s.name_check) AS name_checks, + any(b IN collect(s.before_clearance) WHERE b) AS before_clearance + ORDER BY k""", {"es": events}) if not devs: return {"event": event, "recalled": [], "descendants": []} - start = {d["k"]: d["initiated"] for d in devs} desc = self.q( f"""MATCH p = (s:Device)<-[:CITES*1..{max(1, min(depth, 6))}]-(d:Device) WHERE s.k IN $ks AND NOT d.k IN $ks AND all(r IN relationships(p) WHERE {LINEAGE_EDGE}) - WITH d, min(length(p)) AS gen, collect(DISTINCT s.k) AS via, + WITH d, min(length(p)) AS gen, + min(CASE WHEN all(r IN relationships(p) WHERE NOT ({DISPUTED_EDGE})) THEN length(p) ELSE null END) + AS supported_gen, + collect(DISTINCT s.k) AS via, collect(DISTINCT CASE WHEN all(r IN relationships(p) WHERE NOT ({DISPUTED_EDGE})) THEN s.k ELSE null END) AS supported_via RETURN d.k AS k, d.name AS name, d.applicant AS applicant, - d.decision_date AS decided, gen, via, supported_via - ORDER BY d.decision_date DESC""", {"ks": list(start)}) - out = [] - for r in desc: - first = min((start[v] for v in r["via"] if start.get(v)), default=None) - conditional_via = sorted(set(r["via"]) - set(r["supported_via"])) - out.append({"k": r["k"], "name": r["name"], "applicant": r["applicant"], - "decision_date": str(r["decided"]) if r["decided"] else None, "gen": r["gen"], - "via": r["via"], "conditional_via": conditional_via, - "recall_started": str(first) if first else None, - "after_recall": bool(first and r["decided"] and r["decided"] > first)}) - initiated = min((v for v in start.values() if v), default=None) - return {"event": event, "initiated": str(initiated) if initiated else None, - "recalled": [{"k": d["k"], "name": d["name"], "initiated": str(d["initiated"])} for d in devs], - "descendants": out} + toString(d.decision_date) AS decision_date, gen, supported_gen, via, supported_via + ORDER BY d.decision_date DESC, d.k""", {"ks": [d["k"] for d in devs]}) + return {"event": event, "recalled": devs, "descendants": desc} def assessments(self, k: str | None = None, limit: int = 20) -> list[dict]: """Saved assessments, each with a `stale` flag: after it was saved, a citation somewhere in diff --git a/forebear/investigation/tools.py b/forebear/investigation/tools.py index 82fa8d3..cd11c66 100644 --- a/forebear/investigation/tools.py +++ b/forebear/investigation/tools.py @@ -19,7 +19,7 @@ from .. import summaries from ..graph import LINEAGE_EDGE, Graph -from ..lineage import EVIDENCE_WINDOW, assess, compare, doubt +from ..lineage import EVIDENCE_WINDOW, assess, compare, doubt, recall_reach K_RE = re.compile(r"^K\d{6}$") RECALL_RE = re.compile(r"^Z-\d{4}-\d{4}$") @@ -308,14 +308,15 @@ def t_recall_reach(g: Graph, args: dict, ctx: RunContext) -> dict: ev = str(args.get("event") or "").strip() if not EVENT_RE.match(ev): raise ToolError("event must be a numeric FDA recall event number, e.g. 88071") - r = g.recall_event_reach(ev, 3) + r = recall_reach(g, ev, 3) if not r["recalled"]: raise ToolError(f"no recalled device for event {ev} in the graph") desc = r["descendants"] return {"event": ev, "initiated": r.get("initiated"), "recalled": r["recalled"][:20], "descendants_total": len(desc), "descendants_cleared_after_recall": sum(d["after_recall"] for d in desc), + "timing_counts": r["counts"], "descendants": [{k: d[k] for k in ("k", "name", "decision_date", "gen", "via", "conditional_via", - "after_recall")} + "evidence", "timing", "after_recall")} for d in desc][:25]} diff --git a/forebear/lineage.py b/forebear/lineage.py index afbe70a..af52fa9 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -383,3 +383,76 @@ def evidence_ids(a: dict) -> set[str]: if e.get("type") == "recall": ids.add(e["id"]) return ids + + +def date_relation(clearance: str | None, recall_start: str | None) -> str: + """'after' | 'before' | 'same_day' | 'unknown': when a clearance was decided relative to a recall start. + Compared by calendar day (ISO YYYY-MM-DD strings sort chronologically). A missing date is 'unknown', never + 'before'; a same-day pair cannot be ordered and is never counted as 'after'.""" + c, r = (str(clearance)[:10] if clearance else ""), (str(recall_start)[:10] if recall_start else "") + if not c or not r or c in ("None", "null") or r in ("None", "null"): + return "unknown" + return "after" if c > r else "before" if c < r else "same_day" + + +def _earliest(dates) -> str | None: + ds = [str(d)[:10] for d in dates if d] + return min(ds) if ds else None + + +def classify_reach(recalled: list[dict], desc: list[dict]) -> dict: + """Recall reach from raw query rows (Graph.recall_event_reach). + + Each descendant reaches one or more recalled holders. A holder is supported if at least one path to it has no + unresolved audit link, conditional if every path does. Timing is taken from the supported holders only (the + earliest recall start among them); conditional holders get their own timing, reported separately, so a date + reached only through an unresolved citation can never decide the supported classification. `evidence` is + 'supported' when any holder is supported, else 'conditional'.""" + start = {d["k"]: (str(d["initiated"])[:10] if d.get("initiated") else None) for d in recalled} + out = [] + for r in desc: + via = sorted(r["via"]) + supported_via = sorted(v for v in r.get("supported_via") or [] if v) + conditional_via = sorted(set(via) - set(supported_via)) + sup_start = _earliest(start.get(v) for v in supported_via) + cond_start = _earliest(start.get(v) for v in conditional_via) + evidence = "supported" if supported_via else "conditional" + basis = sup_start if supported_via else cond_start + timing = date_relation(r.get("decision_date"), basis) + out.append({ + "k": r["k"], "name": r["name"], "applicant": r.get("applicant"), + "decision_date": str(r["decision_date"])[:10] if r.get("decision_date") else None, + "gen": r["gen"], "supported_gen": r.get("supported_gen"), + "via": via, "supported_via": supported_via, "conditional_via": conditional_via, "evidence": evidence, + "recall_started": basis, "timing": timing, "after_recall": timing == "after", + # mixed-confidence routes: what the conditional holders alone would say (None if there are none) + "conditional_recall_started": cond_start if supported_via and conditional_via else None, + "conditional_timing": (date_relation(r.get("decision_date"), cond_start) + if supported_via and conditional_via else None), + }) + counts = {"after_supported": 0, "after_conditional": 0, "before": 0, "same_day": 0, "unknown": 0} + for d in out: + if d["timing"] == "after": + counts["after_supported" if d["evidence"] == "supported" else "after_conditional"] += 1 + else: + counts[d["timing"]] += 1 + counts["conditional"] = sum(1 for d in out if d["evidence"] == "conditional") + counts["mixed"] = sum(1 for d in out if d["conditional_via"] and d["supported_via"]) + recalled_out = [] + for d in recalled: + x = {"link_name_check": "match" if "match" in (d.get("name_checks") or []) else + "mismatch" if "mismatch" in (d.get("name_checks") or []) else None, + "linked_before_clearance": bool(d.get("before_clearance"))} + recalled_out.append({"k": d["k"], "name": d["name"], "decision_date": d.get("decision_date"), + "initiated": start[d["k"]], "records": d.get("records"), + "attribution": recall_attribution(x)}) + return {"initiated": _earliest(start.values()), "recalled": recalled_out, "descendants": out, "counts": counts} + + +def recall_reach(g: Graph, event: str, depth: int = 3) -> dict: + raw = g.recall_event_reach(event, depth) + if not raw["recalled"]: + return {"event": event, "initiated": None, "recalled": [], "descendants": [], + "counts": {"after_supported": 0, "after_conditional": 0, "before": 0, "same_day": 0, "unknown": 0, + "conditional": 0, "mixed": 0}} + return {"event": event, **classify_reach(raw["recalled"], raw["descendants"])} diff --git a/tests/test_evidence_integrity.py b/tests/test_evidence_integrity.py index a39958b..8986c63 100644 --- a/tests/test_evidence_integrity.py +++ b/tests/test_evidence_integrity.py @@ -4,13 +4,87 @@ import pytest from conftest import build_tiny, cite, dev, recall -from forebear.lineage import assess, compare, recall_attribution +from forebear.lineage import assess, classify_reach, compare, date_relation, recall_attribution, recall_reach def _unresolve(g, src, dst): g.q("MATCH (:Device {k:$s})-[r:CITES]->(:Device {k:$d}) SET r.audit = 'unresolved'", {"s": src, "d": dst}) +# ---------------------------------------------------------------- date boundaries +@pytest.mark.parametrize("clearance,start,want", [ + ("2021-06-15", "2021-06-14", "after"), + ("2021-06-13", "2021-06-14", "before"), + ("2021-06-14", "2021-06-14", "same_day"), + ("2021-06-14T00:00:00", "2021-06-14", "same_day"), + (None, "2021-06-14", "unknown"), + ("2021-06-14", None, "unknown"), + ("", "", "unknown"), + ("None", "2021-06-14", "unknown"), + ("2021-12-31", "2022-01-01", "before"), +]) +def test_date_relation_boundaries(clearance, start, want): + assert date_relation(clearance, start) == want + + +# ---------------------------------------------------------------- recall reach classification +REC = [{"k": "KA", "name": "A", "initiated": "2020-01-01"}, {"k": "KB", "name": "B", "initiated": "2010-01-01"}, + {"k": "KN", "name": "N", "initiated": None}] + + +def _row(k, decided, via, supported): + return {"k": k, "name": k, "applicant": "x", "decision_date": decided, "gen": 1, "supported_gen": 1 if supported + else None, "via": via, "supported_via": supported} + + +def test_reach_mixed_confidence_timing_comes_from_supported_route_only(): + # supported route to KA (recall 2020), conditional route to KB (recall 2010); cleared 2015 + r = classify_reach(REC, [_row("KD", "2015-05-05", ["KA", "KB"], ["KA"])]) + d = r["descendants"][0] + assert d["evidence"] == "supported" and d["supported_via"] == ["KA"] and d["conditional_via"] == ["KB"] + assert d["timing"] == "before" and d["after_recall"] is False and d["recall_started"] == "2020-01-01" + assert d["conditional_timing"] == "after" and d["conditional_recall_started"] == "2010-01-01" + assert r["counts"] == {"after_supported": 0, "after_conditional": 0, "before": 1, "same_day": 0, "unknown": 0, + "conditional": 0, "mixed": 1} + + +def test_reach_conditional_only_after_is_counted_apart_from_supported(): + r = classify_reach(REC, [_row("KD", "2015-05-05", ["KB"], [])]) + d = r["descendants"][0] + assert d["evidence"] == "conditional" and d["timing"] == "after" and d["conditional_timing"] is None + assert r["counts"]["after_conditional"] == 1 and r["counts"]["after_supported"] == 0 + + +def test_reach_same_day_and_missing_dates_are_not_before(): + r = classify_reach(REC, [_row("K1", "2020-01-01", ["KA"], ["KA"]), _row("K2", None, ["KA"], ["KA"]), + _row("K3", "2022-01-01", ["KN"], ["KN"])]) + t = {d["k"]: d["timing"] for d in r["descendants"]} + assert t == {"K1": "same_day", "K2": "unknown", "K3": "unknown"} + assert not any(d["after_recall"] for d in r["descendants"]) + assert r["counts"]["before"] == 0 and r["counts"]["same_day"] == 1 and r["counts"]["unknown"] == 2 + assert r["initiated"] == "2010-01-01" # the undated holder never becomes the string "None" + assert {x["k"]: x["initiated"] for x in r["recalled"]}["KN"] is None + + +def test_reach_graph_conditional_route_does_not_decide_supported_timing(tiny): + # K000011 (2009) cites K000002 (recall 2008-04-01) only through an unresolved citation, and K000001 (no recall). + tiny.upsert_devices([dev("K000011", "2009-01-01"), dev("K000012", "2008-04-01")]) + tiny.upsert_citations([cite("K000011", "K000002"), cite("K000012", "K000002")]) + _unresolve(tiny, "K000011", "K000002") + r = {d["k"]: d for d in recall_reach(tiny, "1", depth=3)["descendants"]} + assert r["K000011"]["evidence"] == "conditional" and r["K000011"]["conditional_via"] == ["K000002"] + assert r["K000011"]["timing"] == "after" + assert r["K000012"]["timing"] == "same_day" and r["K000012"]["after_recall"] is False # cleared the same day + assert r["K000003"]["evidence"] == "supported" and r["K000003"]["timing"] == "after" + out = recall_reach(tiny, "1", depth=3) + assert out["counts"]["after_conditional"] == 1 and out["counts"]["same_day"] == 1 + + +def test_reach_unknown_event_is_empty(tiny): + r = recall_reach(tiny, "424242", depth=3) + assert r["recalled"] == [] and r["descendants"] == [] and r["counts"]["after_supported"] == 0 + + # ---------------------------------------------------------------- compare keeps coverage def test_compare_rows_carry_coverage_and_provisional(tiny): tiny.upsert_devices([dev("K000015", "2019-01-01")]) diff --git a/tests/test_graph.py b/tests/test_graph.py index a90f0e8..d794d4e 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -2,7 +2,7 @@ from conftest import build_tiny, cite, dev, recall from forebear.graph import open_graph -from forebear.lineage import assess +from forebear.lineage import assess, recall_reach def test_persists_and_reopens_read_only(tmp_path): @@ -69,7 +69,7 @@ def test_cited_after_recall_is_temporal(tiny): def test_recall_event_reach_splits_before_after(tiny): - r = tiny.recall_event_reach("1", depth=3) + r = recall_reach(tiny, "1", depth=3) assert [x["k"] for x in r["recalled"]] == ["K000002"] after = {d["k"] for d in r["descendants"] if d["after_recall"]} assert after == {"K000003", "K000004", "K000005", "K000006"} # K000007 cites only as 'mention' @@ -100,10 +100,10 @@ def test_search_by_k_prefix_and_text(tiny): def test_multi_event_reach_uses_each_lineages_own_recall_date(tiny): # event 9 starts in 2019 on K000004; event 1 started 2008 on K000002. tiny.upsert_recalls([recall("Z-0009-2019", ["K000004"], "2019-06-01", event="9")]) - r = {d["k"]: d for d in tiny.recall_event_reach("1,9", depth=3)["descendants"]} + r = {d["k"]: d for d in recall_reach(tiny, "1,9", depth=3)["descendants"]} # K000005 (2020) and K000006 (2021) descend from both; earliest relevant start is 2008 -> after assert r["K000005"]["after_recall"] and r["K000006"]["after_recall"] - only9 = {d["k"]: d for d in tiny.recall_event_reach("9", depth=3)["descendants"]} + only9 = {d["k"]: d for d in recall_reach(tiny, "9", depth=3)["descendants"]} assert only9["K000005"]["after_recall"] and only9["K000005"]["recall_started"] == "2019-06-01" @@ -113,6 +113,6 @@ def test_multi_event_reach_does_not_borrow_another_events_start(tiny): tiny.upsert_devices([dev("K000010", "2017-03-01")]) tiny.upsert_citations([cite("K000010", "K000004")]) tiny.upsert_recalls([recall("Z-0009-2019", ["K000004"], "2019-06-01", event="9")]) - r = {d["k"]: d for d in tiny.recall_event_reach("1,9", depth=1)["descendants"]} + r = {d["k"]: d for d in recall_reach(tiny, "1,9", depth=1)["descendants"]} assert r["K000010"]["via"] == ["K000004"] assert r["K000010"]["after_recall"] is False From 866c808489aaa895609a5428b8d2d3da7cd1cec8 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 12:55:20 +0100 Subject: [PATCH 04/14] fix: compare watchlist clearance dates with recall starts and track the supported generation --- forebear/api.py | 40 ++++++++++++++++++++----- forebear/graph.py | 24 +++++++++------ tests/test_evidence_integrity.py | 50 ++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 17 deletions(-) diff --git a/forebear/api.py b/forebear/api.py index 4e58704..1026e3f 100644 --- a/forebear/api.py +++ b/forebear/api.py @@ -23,7 +23,7 @@ from .ingest import IngestError from .investigation import runner as inv_runner from .investigation import store as inv_store -from .lineage import assess, compare, recall_reach +from .lineage import assess, compare, date_relation, recall_attribution, recall_reach agent.load_env() use_live_cache() # live ingests never touch the committed data/raw cache @@ -160,32 +160,56 @@ async def recall_event(event: str, depth: int = 3): @app.get("/api/watchlist") async def watchlist(design_only: bool = True): + """Clearances decided strictly after a recall began on a direct or 2nd-generation predicate. Dates compared are + the clearance (decision) date and the recall start; the receipt date is returned for reference only, because + it does not establish when a citation was made.""" rows = await run(lambda g: g.cited_after_recall(design_only, limit=5000)) by: dict[str, dict] = {} for r in rows: d = by.setdefault(r["k"], {"k": r["k"], "name": r["name"], "applicant": r["applicant"], "decision_date": r["decision_date"], "received_date": r["received_date"], "min_gen": r["gen"], "supported_min_gen": None, "recall_count": 0, - "ancestors": set(), "events": set(), "recalls": []}) + "ancestors": set(), "supported_ancestors": set(), "events": set(), "recalls": [], + "earliest_recall": None, "earliest_supported_recall": None}) d["min_gen"] = min(d["min_gen"], r["gen"]) d["recall_count"] += 1 - if not r["conditional"]: # a route that does not rest on an unresolved citation + d["earliest_recall"] = min(filter(None, (d["earliest_recall"], r["initiated"]))) + if r["supported_gen"] is not None: # at least one route that does not rest on an unresolved citation sg = d["supported_min_gen"] - d["supported_min_gen"] = r["gen"] if sg is None else min(sg, r["gen"]) + d["supported_min_gen"] = r["supported_gen"] if sg is None else min(sg, r["supported_gen"]) + d["supported_ancestors"].add(r["ancestor"]) + d["earliest_supported_recall"] = min(filter(None, (d["earliest_supported_recall"], r["initiated"]))) d["ancestors"].add(r["ancestor"]) d["events"].add(r["event"]) if len(d["recalls"]) < 6: - d["recalls"].append({k: r[k] for k in ("recall_id", "ancestor", "gen", "conditional", "classification", - "root_cause", "initiated", "firm", "url")}) - out = sorted(by.values(), key=lambda d: d["decision_date"] or "", reverse=True) + d["recalls"].append({k: r[k] for k in ("recall_id", "ancestor", "gen", "supported_gen", "conditional", + "classification", "root_cause", "initiated", "firm", "url", + "link_name_check", "linked_before_clearance")} + | {"attribution": recall_attribution(r)}) + out = sorted(by.values(), key=lambda d: (d["decision_date"] or "", d["k"]), reverse=True) for d in out: d["ancestors"] = sorted(d["ancestors"]) + d["supported_ancestors"] = sorted(d["supported_ancestors"]) d["events"] = sorted(e for e in d["events"] if e) # computed over every recall route, not the first six listed: conditional only if none is supported d["conditional"] = d["supported_min_gen"] is None + basis = d["earliest_recall"] if d["conditional"] else d["earliest_supported_recall"] + d["recall_basis"] = basis # the recall start the clearance date is compared with + d["timing"] = date_relation(d["decision_date"], basis) # always 'after' by the query's strict filter + d["days_after_recall"] = _days(basis, d["decision_date"]) return {"count": len(out), "direct": sum(1 for d in out if d["min_gen"] == 1), "direct_supported": sum(1 for d in out if d["supported_min_gen"] == 1), - "conditional": sum(1 for d in out if d["conditional"]), "rows": out} + "conditional": sum(1 for d in out if d["conditional"]), + "compared": "clearance (decision) date vs recall start; receipt date is not a citation date", + "rows": out} + + +def _days(a: str | None, b: str | None) -> int | None: + from datetime import date + try: + return (date.fromisoformat(str(b)[:10]) - date.fromisoformat(str(a)[:10])).days + except (TypeError, ValueError): + return None @app.get("/api/assessments") diff --git a/forebear/graph.py b/forebear/graph.py index 4dcb877..f4c0341 100644 --- a/forebear/graph.py +++ b/forebear/graph.py @@ -318,22 +318,28 @@ def out_of_lineage_predicates(self, k: str) -> list[dict]: return [r for r in rows if r["kind"] == "predicate" and not r["in_lineage"] and r["dst"] not in corrected] def cited_after_recall(self, design_only: bool = True, limit: int = 200) -> list[dict]: - """Clearances whose (direct or 2nd-generation) predicate was already under a recall - when the new device was cleared. A row is conditional if every shortest path - to that recall holder contains an unresolved audit link.""" + """Recall routes where a clearance was decided strictly after a recall had begun on its direct or + 2nd-generation predicate. The comparison uses the clearance (decision) date only: the application's + receipt date is when the submission arrived, which does not establish when, or whether, a citation + was made with knowledge of the recall. Same-day and undated pairs are not "after" and are excluded. + + `gen` is the shortest route over any lineage path; `supported_gen` the shortest over paths with no + unresolved audit link (null if every path to the recall holder rests on one). A row is conditional + when supported_gen is null. `attribution` says how FDA's recall record is tied to the holder.""" flt = "AND x.design_related" if design_only else "" rows = self.q( - f"""MATCH p = (d:Device)-[:CITES*1..2]->(a:Device)-[:SUBJECT_OF]->(x:Recall) + f"""MATCH p = (d:Device)-[:CITES*1..2]->(a:Device)-[s:SUBJECT_OF]->(x:Recall) WHERE all(r IN relationships(p) WHERE type(r) = 'SUBJECT_OF' OR ({LINEAGE_EDGE})) AND d.decision_date IS NOT NULL AND x.initiated IS NOT NULL AND x.initiated < d.decision_date {flt} - WITH d, a, x, min(length(p)) - 1 AS gen, - min(CASE WHEN all(r IN relationships(p) WHERE NOT ({DISPUTED_EDGE})) - THEN length(p) ELSE null END) AS supported_length + WITH d, a, x, s, min(length(p)) - 1 AS gen, + min(CASE WHEN all(r IN relationships(p) WHERE type(r) = 'SUBJECT_OF' OR NOT ({DISPUTED_EDGE})) + THEN length(p) - 1 ELSE null END) AS supported_gen RETURN d.k AS k, d.name AS name, d.applicant AS applicant, toString(d.decision_date) AS decision_date, toString(d.received_date) AS received_date, - a.k AS ancestor, a.name AS ancestor_name, gen, - (supported_length IS NULL OR supported_length > gen + 1) AS conditional, + a.k AS ancestor, a.name AS ancestor_name, gen, supported_gen, + supported_gen IS NULL AS conditional, + s.name_check AS link_name_check, s.before_clearance AS linked_before_clearance, x.id AS recall_id, x.event AS event, x.classification AS classification, x.root_cause AS root_cause, toString(x.initiated) AS initiated, x.firm AS firm, x.reason AS reason, x.url AS url diff --git a/tests/test_evidence_integrity.py b/tests/test_evidence_integrity.py index 8986c63..f21a694 100644 --- a/tests/test_evidence_integrity.py +++ b/tests/test_evidence_integrity.py @@ -1,8 +1,11 @@ """Regression tests for the evidence-integrity fixes: compare keeps coverage, recall reach classifies timing per supported / conditional route with date boundaries, the watchlist compares clearance dates and tracks the supported generation, and recall links say whether they are FDA-listed associations or name the recalled model.""" +import importlib + import pytest from conftest import build_tiny, cite, dev, recall +from fastapi.testclient import TestClient from forebear.lineage import assess, classify_reach, compare, date_relation, recall_attribution, recall_reach @@ -85,6 +88,53 @@ def test_reach_unknown_event_is_empty(tiny): assert r["recalled"] == [] and r["descendants"] == [] and r["counts"]["after_supported"] == 0 +# ---------------------------------------------------------------- watchlist +@pytest.fixture +def tiny_client(tmp_path, monkeypatch): + p = tmp_path / "w.rl" + g = build_tiny(p) + # K000013 (2011) cites K000002 directly through an unresolved citation, and K000003 through a supported one: + # the shortest route (gen 1) is conditional, but a supported gen-2 route exists. + # K000014 is cleared on the day K000002's recall began: not "after". + g.upsert_devices([dev("K000013", "2011-01-01"), dev("K000014", "2008-04-01")]) + g.upsert_citations([cite("K000013", "K000002"), cite("K000013", "K000003"), cite("K000014", "K000002")]) + _unresolve(g, "K000013", "K000002") + g.close() + monkeypatch.setenv("FOREBEAR_DB", str(p)) + from forebear import api + importlib.reload(api) + with TestClient(api.app) as c: + yield c + + +def test_watchlist_supported_generation_survives_a_shorter_conditional_route(tiny_client): + w = tiny_client.get("/api/watchlist").json() + rows = {r["k"]: r for r in w["rows"]} + r = rows["K000013"] + assert r["min_gen"] == 1 and r["supported_min_gen"] == 2 and r["conditional"] is False + assert r["supported_ancestors"] == ["K000002"] + assert r["recalls"][0]["gen"] == 1 and r["recalls"][0]["supported_gen"] == 2 + + +def test_watchlist_compares_clearance_dates_not_receipt(tiny_client): + w = tiny_client.get("/api/watchlist").json() + rows = {r["k"]: r for r in w["rows"]} + assert "K000014" not in rows # same-day clearance is not "after" + r = rows["K000003"] # cleared 2010-06-01, recall began 2008-04-01 + assert r["timing"] == "after" and r["recall_basis"] == "2008-04-01" and r["days_after_recall"] == 791 + assert "receipt date is not a citation date" in w["compared"] + assert all(x["attribution"] in ("product_family", "model_named", "listed_only", "unchecked") + for row in w["rows"] for x in row["recalls"]) + + +def test_reach_api_reports_timing_counts(tiny_client): + r = tiny_client.get("/api/recall-event/1").json() + assert set(r["counts"]) >= {"after_supported", "after_conditional", "before", "same_day", "unknown"} + d = {x["k"]: x for x in r["descendants"]} + assert d["K000014"]["timing"] == "same_day" + assert d["K000013"]["evidence"] == "supported" and d["K000013"]["conditional_via"] == [] + + # ---------------------------------------------------------------- compare keeps coverage def test_compare_rows_carry_coverage_and_provisional(tiny): tiny.upsert_devices([dev("K000015", "2019-01-01")]) From 69e5787b73ac22b7e5967a184d995d7f458a748b Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:00:41 +0100 Subject: [PATCH 05/14] fix: show evidence coverage and provisional verdicts in compare and the investigation header --- web/src/evidence.js | 53 +++++++++++++++++++++++++++++ web/src/workspace/Investigation.jsx | 5 +-- web/src/workspace/Views.jsx | 25 +++++++++----- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/web/src/evidence.js b/web/src/evidence.js index 4090ed8..f179183 100644 --- a/web/src/evidence.js +++ b/web/src/evidence.js @@ -153,3 +153,56 @@ export function shortName(n, max = 30) { const s = (n || '').replace(/\s+/g, ' ').trim() return s.length > max ? s.slice(0, max - 1) + '…' : s } + +/** Mirror of lineage.provisional(): a "no signal" verdict on an incomplete verdict window. */ +export function isProvisional(verdict, evidence) { + return verdict === 'NO_DESIGN_RECALL_SIGNAL' && evidence !== 'complete' +} + +/** Verdict chip for a verdict plus its evidence coverage. A provisional "no signal" never shows the calm tone. */ +export function verdictView(verdict, evidence) { + const v = VERDICTS[verdict] + if (!v) return { tone: 'muted', label: verdict || 'Unknown', provisional: false } + return isProvisional(verdict, evidence) + ? { tone: 'muted', label: `${v.label} · provisional`, provisional: true } + : { tone: v.tone, label: v.label, provisional: false } +} + +export const EVIDENCE_TONE = { complete: 'calm', partial: 'amber', uncertain: 'alert', none: 'muted' } + +/** Mirror of the coverage.evidence_reasons codes in lineage.assess(). */ +export const EVIDENCE_REASON_TEXT = { + 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', +} + +/** Mirror of lineage.recall_attribution(): how FDA's recall record is tied to the clearance it lists. */ +export const ATTRIBUTION = { + product_family: { short: 'FDA-listed · product family', tone: 'muted', + text: 'The recall began before this clearance was decided, so it is not a recall of this cleared model: FDA lists the clearance as part of the recalled product family.' }, + listed_only: { short: 'FDA-listed · model not named', tone: 'muted', + text: 'FDA lists this 510(k) on the recall, but the recall text does not name this device: the recalled model may be another one in the family.' }, + model_named: { short: 'FDA-listed · model named', tone: 'other', + text: 'FDA lists this 510(k) on the recall and the recall text names this device.' }, + unchecked: { short: 'FDA-listed', tone: 'other', + text: 'FDA lists this 510(k) on the recall; whether the recall text names this model could not be checked.' }, +} + +/** Recall reach timing (lineage.date_relation) as display text. */ +export const TIMING_TEXT = { + 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)', +} + +export function recallAttribution(r) { + if (r?.attribution) return r.attribution + if (r?.linked_before_clearance) return 'product_family' + return r?.link_name_check === 'match' ? 'model_named' : r?.link_name_check === 'mismatch' ? 'listed_only' : 'unchecked' +} diff --git a/web/src/workspace/Investigation.jsx b/web/src/workspace/Investigation.jsx index ea25fac..0a37a60 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, VERDICTS, countEvents, edgeStatus, fmtDate, nodeTone, recallTiming, recallTimingText, shortName, year, + EDGE_STATUS, EVIDENCE_REASON_TEXT, VERDICTS, countEvents, verdictView, edgeStatus, fmtDate, nodeTone, recallTiming, recallTimingText, shortName, year, } from '../evidence.js' import EvidenceGraph from './EvidenceGraph.jsx' import Timeline from './Timeline.jsx' @@ -157,8 +157,8 @@ export default function Investigation({ k, go, onChanged }) { ) const d = a.device - const v = VERDICTS[a.verdict] const cov = a.coverage + const v = { ...VERDICTS[a.verdict], ...verdictView(a.verdict, cov.evidence) } const nReview = reviewItems(a).length const conditional = a.signals.filter((s) => s.conditional).length return ( @@ -194,6 +194,7 @@ export default function Investigation({ k, go, onChanged }) {
Evidence {cov.evidence} + {(cov.evidence_reasons || []).map((c) => {EVIDENCE_REASON_TEXT[c] || c})} {cov.ancestors} ancestors · {cov.generations_traversed} generations {cov.ancestors_lineage_unknown > 0 && {cov.ancestors_lineage_unknown} with unread summaries} {cov.doubtful_links > 0 && {cov.doubtful_links} doubtful link(s)} diff --git a/web/src/workspace/Views.jsx b/web/src/workspace/Views.jsx index 4f36d8c..89e8a8a 100644 --- a/web/src/workspace/Views.jsx +++ b/web/src/workspace/Views.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useState } from 'react' import { api } from '../api.js' -import { VERDICTS, fmtDate } from '../evidence.js' +import { ATTRIBUTION, EVIDENCE_REASON_TEXT, EVIDENCE_TONE, TIMING_TEXT, fmtDate, verdictView } from '../evidence.js' const Head = ({ eyebrow, title, children }) => (

{eyebrow}

{title}

{children &&

{children}

}
@@ -37,23 +37,32 @@ export function CompareView({ initial, go }) {
- + - {rows.map((r) => r.found ? ( - go('check', r.k)} onKeyDown={rowKey(() => go('check', r.k))}> + {rows.map((r) => { + if (!r.found) return ( + ) + const vv = verdictView(r.verdict, r.evidence) + return ( + go('check', r.k)} onKeyDown={rowKey(() => go('check', r.k))}> - + + - ) : ( - ))} + ) + })}
CandidateClearedVerdictOwn recalls
(design)
CandidateClearedVerdictEvidence
(verdict window)
Own recalls
(design)
Flagged ancestors
gen 1–2
Ancestors
(unread)
Top signal
{r.k}Not in the graph. Read it from FDA →
{r.k}
{r.name}
{r.applicant}
{fmtDate(r.decision_date)}{VERDICTS[r.verdict].label}{vv.label} + {r.conditional &&
conditional
} +
{r.verdict_reason}
{r.evidence} + {(r.evidence_reasons || []).map((c) =>
{EVIDENCE_REASON_TEXT[c] || c}
)}
{r.own_recalls} ({r.own_design_recalls}) {r.flagged_ancestors_gen12} {r.ancestors} ({r.lineage_unknown}) {r.top_signal || '—'}
{r.k}Not in the graph. Read it from FDA →
-

Verdicts are deterministic documentation signals; a lower count is not a statement that a device is safer.

+

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.

)}
From 3c9ad41070a353676d12c8f06e31365eae0c7315 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:00:42 +0100 Subject: [PATCH 06/14] fix: split recall reach by supported, conditional, same-day and unknown timing in the UI --- web/src/workspace/Views.jsx | 70 ++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/web/src/workspace/Views.jsx b/web/src/workspace/Views.jsx index 89e8a8a..e5c5f7c 100644 --- a/web/src/workspace/Views.jsx +++ b/web/src/workspace/Views.jsx @@ -76,15 +76,24 @@ export function ReachView({ initial, go }) { const [err, setErr] = useState(null) const run = (e = ev) => { setErr(null); setData(null); api.recallEvent(e.replace(/\s/g, '')).then(setData).catch((x) => setErr(x.message)) } useEffect(() => { setEv(initial || '88058,88071'); run(initial || '88058,88071') }, [initial]) - const isCond = (d) => d.conditional_via?.length > 0 && d.conditional_via.length === d.via.length - const after = data?.descendants.filter((d) => d.after_recall) || [] - const before = data?.descendants.filter((d) => !d.after_recall) || [] - const nCond = data?.descendants.filter(isCond).length || 0 + const desc = data?.descendants || [] + const c = data?.counts || {} + // [id, title, rows, hint, always shown] + const groups = [ + ['after-supported', 'Cleared after the recall began · supported route', desc.filter((d) => d.timing === 'after' && d.evidence === 'supported'), + '"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.', true], + ['after-conditional', 'Cleared after the recall began · conditional route only', desc.filter((d) => d.timing === 'after' && d.evidence === 'conditional'), + 'Every route to the recalled clearance runs through a citation the audit could not resolve.', false], + ['same-day', 'Cleared the day the recall began', desc.filter((d) => d.timing === 'same_day'), + 'Same calendar day: the dates cannot order them, so these count as neither before nor after.', false], + ['unknown', 'Timing unknown', desc.filter((d) => d.timing === 'unknown'), 'A clearance date or recall start is missing.', false], + ['before', 'Cleared before the recall began', desc.filter((d) => d.timing === 'before'), null, true], + ] return (
- Start from an FDA recall event. Forebear finds every clearance it names, then every later clearance that cites one of them, - up to three generations, and splits them by whether they were cleared after the recall began. + 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.preventDefault(); run() }}> @@ -101,20 +110,26 @@ export function ReachView({ initial, go }) { <>
-
{data.recalled.length}clearances named in recall event(s) {data.event}
-
{data.descendants.length}later clearances descend from them
-
{after.length}cleared after the recall on their lineage began{data.initiated ? ` (earliest ${fmtDate(data.initiated)})` : ''}
-
{nCond}reached only through an unresolved citation (conditional)
+
{data.recalled.length}clearances FDA lists on recall event(s) {data.event}
+
{desc.length}later clearances descend from them
+
{c.after_supported ?? 0}cleared after the recall on a supported route began{data.initiated ? ` (earliest ${fmtDate(data.initiated)})` : ''}
+
{c.conditional ?? 0}reached only through an unresolved citation (conditional){c.after_conditional ? `, ${c.after_conditional} of them cleared after` : ''}
+ {(c.same_day > 0 || c.unknown > 0) && ( +
{(c.same_day || 0) + (c.unknown || 0)}timing not determinable ({c.same_day || 0} same day, {c.unknown || 0} missing a date)
)}
{data.recalled.map((r) => ( - ))}
+ ))}
+

FDA lists these clearances on the recall record. That is an association: it does not by itself + mean the listed model, as cleared, is the recalled product.

-

Cleared after the recall began {after.length}

-

"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.

- -

Cleared before {before.length}

- + {groups.filter(([, , rows, , always]) => always || rows.length).map(([id, title, rows, hint], i) => ( +
+

{title} {rows.length}

+ {hint &&

{hint}

}
+ +
))}
)} @@ -122,24 +137,31 @@ export function ReachView({ initial, go }) { ) } -function DescTable({ rows, go, isCond }) { +function DescTable({ rows, go }) { if (!rows.length) return

None.

return (
- + {rows.map((d) => { - const cond = isCond(d) + const cond = d.evidence === 'conditional' + const mixed = !cond && d.conditional_via?.length > 0 + const gen = d.supported_gen ?? d.gen return ( - go('check', d.k)} onKeyDown={rowKey(() => go('check', d.k))}> - + go('check', d.k)} onKeyDown={rowKey(() => go('check', d.k))}> + - - + + + title={d.conditional_via?.includes(v) ? 'Reached only through an unresolved citation' : 'Reached through a supported citation'}>{v} ))} ) })} From 865e6460259089e46acccaba5f4a7c2641b54f56 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:00:42 +0100 Subject: [PATCH 07/14] fix: reword watchlist around clearance dates instead of citation timing --- web/src/workspace/Views.jsx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/web/src/workspace/Views.jsx b/web/src/workspace/Views.jsx index e5c5f7c..3b37aa7 100644 --- a/web/src/workspace/Views.jsx +++ b/web/src/workspace/Views.jsx @@ -182,17 +182,19 @@ export function WatchlistView({ go }) { const nCond = data?.conditional ?? rows.filter((r) => r.conditional).length return (
- - Clearances cleared after a design-related recall had already started on their predicate or grand-predicate. 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. + + 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. {err &&

{err}

} {!data && !err &&
Querying the graph…
} {data && (
-
{data.count}clearances in the dataset match
+
{data.count}clearances decided after a recall began on their lineage
{data.direct_supported ?? data.direct}cite a directly recalled predicate through a supported citation
{nCond}conditional: every route runs through an unresolved citation
@@ -206,15 +208,16 @@ export function WatchlistView({ go }) {
DeviceApplicantClearedRecall began
on its lineage
DistanceDescends from
DeviceApplicantClearedRecall began
on its route
DistanceDescends from
{d.k} {cond && conditional}
{d.name}
{d.k} {cond && conditional} + {mixed && mixed routes} +
{d.name}
{d.applicant} {fmtDate(d.decision_date)}{fmtDate(d.recall_started)}{d.gen === 1 ? 'direct predicate' : `${d.gen} generations`}{fmtDate(d.recall_started)}
{TIMING_TEXT[d.timing]}
+ {mixed && d.conditional_timing && d.conditional_timing !== d.timing && ( +
Conditional route only: recall began {fmtDate(d.conditional_recall_started)}, {TIMING_TEXT[d.conditional_timing]}
)}
{gen === 1 ? 'direct predicate' : `${gen} generations`} {d.via.map((v) => ( {v} ))}
- + {shown.map((r) => ( - go('check', r.k)} onKeyDown={rowKey(() => go('check', r.k))}> + go('check', r.k)} onKeyDown={rowKey(() => go('check', r.k))}> - - + + + {x.conditional && · conditional} +
{x.ancestor}: {ATTRIBUTION[x.attribution]?.short}
))}
))}
Cleared deviceReceived / clearedRecalled ancestorRecall records
Cleared deviceCleared · recall beganRecalled ancestorRecall records
{r.k} {r.conditional && conditional}
{r.name}
{r.applicant}
{fmtDate(r.received_date)}
{fmtDate(r.decision_date)}
{r.ancestors.join(', ')}
{r.conditional ? 'cited device · citation unresolved' : r.supported_min_gen === 1 ? 'direct predicate' : 'grand-predicate'}
Cleared {fmtDate(r.decision_date)}
recall began {fmtDate(r.recall_basis)}{r.days_after_recall != null ? `, ${r.days_after_recall} days earlier` : ''}
{(r.conditional ? r.ancestors : r.supported_ancestors || r.ancestors).join(', ')}
{r.conditional ? 'cited device · citation unresolved' : r.supported_min_gen === 1 ? 'direct predicate' : 'grand-predicate'}
{r.recall_count > 2 &&
{r.recall_count} recall routes; first two:
}{r.recalls.slice(0, 2).map((x) => (
{x.recall_id} · {x.classification || 'unclassified'} · {x.root_cause} · {fmtDate(x.initiated)} - {x.conditional && · conditional}
))}
From 0dc66f56c24121879698139efd9d2a04b6f4c289 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:00:43 +0100 Subject: [PATCH 08/14] fix: label recall records as FDA-listed associations or named-model recalls --- web/src/workspace/Investigation.jsx | 2 +- web/src/workspace/Provenance.jsx | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/src/workspace/Investigation.jsx b/web/src/workspace/Investigation.jsx index 0a37a60..a50e7b7 100644 --- a/web/src/workspace/Investigation.jsx +++ b/web/src/workspace/Investigation.jsx @@ -49,7 +49,7 @@ function FindingSentence({ a }) { {shortName(d.name, 48)} cites {sig.chain[1]}{first?.page ? <> on page {first.page} of its summary : null}. {' '}{sig.conditional ? <>The cited device {holder?.k}, reached through a citation the audit could not resolve, : sig.chain.length > 2 ? <>Through it, {sig.gen === 2 ? 'grand-predicate' : `generation-${sig.gen} ancestor`} {holder?.k} : <>That predicate} - {' '}({shortName(holder?.name, 52)}) has {ev.events} recall event{ev.events === 1 ? '' : 's'} in this signal + {' '}({shortName(holder?.name, 52)}) is listed by FDA on {ev.events} recall event{ev.events === 1 ? '' : 's'} in this signal {r && <>, including a {r.classification || 'unclassified'} {r.root_cause} recall that began {fmtDate(r.initiated)} {timing && <>, {timing.relation === 'before' ? <>{timing.duration} before {a.k} was cleared diff --git a/web/src/workspace/Provenance.jsx b/web/src/workspace/Provenance.jsx index 2eaf24d..1ff68f1 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 { - DOUBT_TEXT, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, pdfAt, recallTone, shortName, + ATTRIBUTION, DOUBT_TEXT, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, pdfAt, recallAttribution, recallTone, shortName, } from '../evidence.js' /* Highlight the cited K-number inside the verbatim quote. */ @@ -22,14 +22,16 @@ export function StatusTag({ hop }) { export function RecallCard({ r }) { const tone = recallTone(r) + const att = ATTRIBUTION[recallAttribution(r)] return ( -
+
{tone === 'design' ? 'Design-related' : tone === 'class1' ? 'Class I, other cause' : 'Other cause'} {r.id} {r.classification || 'Unclassified'} · {r.root_cause || 'cause not stated'} · began {fmtDate(r.initiated)} {r.url && FDA record ↗}
+
{att.short} {att.text}
{r.reason &&
{r.reason}
} {r.status &&
Status: {r.status}{r.event ? ` · event ${r.event}` : ''}{r.firm ? ` · ${r.firm}` : ''}
}
@@ -210,11 +212,11 @@ function NodeBody({ sel, a, closeBtn, onClose, go, onSelect }) {
)}
-

FDA recall records · {ev.events} event(s), {ev.records} product record(s)

+

Recall records on which FDA lists this 510(k) · {ev.events} event(s), {ev.records} product record(s)

{n.side !== 'self' && before.length > 0 && (

{before.length} of these record(s) began before {a.k} was cleared on {fmtDate(a.device.decision_date)}.

)} - {recalls.length === 0 ?

No recall record names this 510(k) in openFDA.

+ {recalls.length === 0 ?

openFDA lists this 510(k) on no recall record.

:
{recalls.slice(0, 20).map((r) => )}
} {recalls.length > 20 &&

+ {recalls.length - 20} more record(s): open the device to see all.

}
From 69334cf4f101cd27e336e0e0628ce657936b1fd9 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:00:43 +0100 Subject: [PATCH 09/14] test: add Playwright regressions for evidence coverage, recall timing and attribution --- web/e2e/evidence-integrity.spec.js | 105 +++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 web/e2e/evidence-integrity.spec.js diff --git a/web/e2e/evidence-integrity.spec.js b/web/e2e/evidence-integrity.spec.js new file mode 100644 index 0000000..74392c4 --- /dev/null +++ b/web/e2e/evidence-integrity.spec.js @@ -0,0 +1,105 @@ +import { test, expect } from '@playwright/test' + +// Regression tests for the evidence-integrity fixes. The real store covers compare coverage, supported/conditional +// reach and the watchlist; synthetic API responses cover the mixed-confidence and date-boundary cases the shipped +// data does not contain. + +test.describe('compare keeps evidence coverage', () => { + test('K012323 (partial) and K014074 (complete) no longer look the same', async ({ page }) => { + await page.goto('/#/compare/K012323 K014074') + const partial = page.locator('tr[data-k="K012323"]') + const complete = page.locator('tr[data-k="K014074"]') + await expect(partial).toHaveAttribute('data-evidence', 'partial') + await expect(complete).toHaveAttribute('data-evidence', 'complete') + await expect(partial.getByTestId('compare-verdict')).toHaveText('No design-recall signal · provisional') + await expect(partial.getByTestId('compare-verdict')).not.toHaveClass(/tone-calm/) + await expect(partial.getByTestId('compare-reason')).toContainText('Provisional:') + await expect(partial).toContainText('design-related recalls in the product code name no 510(k)') + await expect(complete.getByTestId('compare-verdict')).toHaveText('No design-recall signal') + await expect(complete.getByTestId('compare-verdict')).toHaveClass(/tone-calm/) + await expect(complete.getByTestId('compare-reason')).not.toContainText('Provisional') + }) + + test('the investigation header shows the provisional state and its reason', async ({ page }) => { + await page.goto('/#/check/K012323') + await expect(page.getByTestId('verdict')).toContainText('provisional') + await expect(page.getByTestId('evidence-reason').first()).toBeVisible() + }) +}) + +test.describe('recall reach timing', () => { + test('supported after-recall rows are separate from conditional and before rows', async ({ page }) => { + await page.goto('/#/reach/88058,88071') + await expect(page.getByTestId('reach-count-after')).toContainText('8') + await expect(page.getByTestId('reach-count-conditional')).toContainText('4') + const after = page.getByTestId('reach-after-supported').locator('tbody tr') + await expect(after).toHaveCount(8) + for (const row of await after.all()) { + await expect(row).toHaveAttribute('data-timing', 'after') + await expect(row).toHaveAttribute('data-evidence', 'supported') + } + const before = page.getByTestId('reach-before').locator('tbody tr') + for (const row of await before.all()) await expect(row).toHaveAttribute('data-timing', 'before') + await expect(page.getByTestId('reach-before').locator('tr[data-k="K183226"]')).toHaveClass(/is-conditional/) + await expect(page.getByTestId('reach-stats')).toContainText('FDA lists') + }) + + test('mixed-confidence routes and date boundaries are never misfiled', async ({ page }) => { + const d = (k, decided, timing, evidence, extra = {}) => ({ + k, name: `Device ${k}`, applicant: 'Acme', decision_date: decided, gen: 1, supported_gen: evidence === 'supported' ? 1 : null, + via: ['K100001'], supported_via: evidence === 'supported' ? ['K100001'] : [], conditional_via: evidence === 'supported' ? [] : ['K100001'], + evidence, recall_started: '2020-01-01', timing, after_recall: timing === 'after', conditional_recall_started: null, conditional_timing: null, ...extra, + }) + const body = { + event: '1', initiated: '2010-01-01', + recalled: [{ k: 'K100001', name: 'A', decision_date: '2005-01-01', initiated: '2020-01-01', records: 1, attribution: 'listed_only' }], + counts: { after_supported: 1, after_conditional: 1, before: 1, same_day: 1, unknown: 1, conditional: 1, mixed: 1 }, + descendants: [ + d('K200001', '2021-01-01', 'after', 'supported'), + d('K200002', '2021-01-01', 'after', 'conditional'), + d('K200003', '2020-01-01', 'same_day', 'supported'), + d('K200004', null, 'unknown', 'supported'), + d('K200005', '2015-01-01', 'before', 'supported', { + via: ['K100001', 'K100002'], conditional_via: ['K100002'], conditional_recall_started: '2010-01-01', conditional_timing: 'after' }), + ], + } + await page.route('**/api/recall-event/**', (r) => r.fulfill({ json: body })) + await page.goto('/#/reach/1') + const section = (id) => page.getByTestId(`reach-${id}`) + await expect(section('after-supported').locator('tbody tr')).toHaveCount(1) + await expect(section('after-conditional').locator('tr[data-k="K200002"]')).toHaveClass(/is-conditional/) + await expect(section('same-day').locator('tr[data-k="K200003"]')).toContainText('order unknown') + await expect(section('unknown').locator('tr[data-k="K200004"]')).toContainText('a date is missing') + const mixed = section('before').locator('tr[data-k="K200005"]') + await expect(section('before').locator('tbody tr')).toHaveCount(1) + await expect(mixed).toContainText('mixed routes') + await expect(mixed).toContainText('Conditional route only') + await expect(page.getByTestId('reach-count-undetermined')).toContainText('1 same day, 1 missing a date') + await expect(page.getByTestId('reach-stats')).toContainText('model not named') + }) +}) + +test.describe('watchlist wording', () => { + test('compares clearance dates, not citation timing', async ({ page }) => { + await page.goto('/#/watch') + const head = page.locator('.page-head') + await expect(head).toContainText('cleared after a predicate recall began') + await expect(head).toContainText('receipt') + await expect(page.locator('body')).not.toContainText(/cited after/i) + await expect(page.locator('thead')).not.toContainText('Received') + const first = page.getByTestId('watch-dates').first() + await expect(first).toContainText('Cleared') + await expect(first).toContainText('recall began') + await expect(page.getByTestId('watch-attribution').first()).toContainText('FDA-listed') + }) +}) + +test.describe('recall attribution', () => { + test('a recall record says how FDA ties it to the clearance', async ({ page }) => { + await page.goto('/#/check/K252078') + await page.locator('.g-node[data-k="K113053"]').click() + const drawer = page.getByTestId('provenance') + await expect(drawer).toContainText('Recall records on which FDA lists this 510(k)') + await expect(drawer.locator('.recall[data-attribution]').first()).toContainText('FDA-listed') + }) +}) From 1ad2fe9e01b2822a0aac94a32c701f1086e82fe0 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:00:44 +0100 Subject: [PATCH 10/14] build: rebuild web/dist for evidence integrity fixes --- web/dist/assets/History-BBJg5IuM.js | 1 - web/dist/assets/History-CPQprqBL.js | 1 + ...anding-CAfNa1AE.js => Landing-D8mpPU0X.js} | 2 +- web/dist/assets/Views-DadbQpl8.js | 1 + web/dist/assets/Views-v6kKlFl0.js | 1 - web/dist/assets/index-VwQV0veO.js | 44 ------------------- web/dist/assets/index-a5px9_EI.js | 44 +++++++++++++++++++ web/dist/index.html | 2 +- 8 files changed, 48 insertions(+), 48 deletions(-) delete mode 100644 web/dist/assets/History-BBJg5IuM.js create mode 100644 web/dist/assets/History-CPQprqBL.js rename web/dist/assets/{Landing-CAfNa1AE.js => Landing-D8mpPU0X.js} (99%) create mode 100644 web/dist/assets/Views-DadbQpl8.js delete mode 100644 web/dist/assets/Views-v6kKlFl0.js delete mode 100644 web/dist/assets/index-VwQV0veO.js create mode 100644 web/dist/assets/index-a5px9_EI.js diff --git a/web/dist/assets/History-BBJg5IuM.js b/web/dist/assets/History-BBJg5IuM.js deleted file mode 100644 index 5471b8b..0000000 --- a/web/dist/assets/History-BBJg5IuM.js +++ /dev/null @@ -1 +0,0 @@ -import{r as i,j as e,V as p,b,a as j}from"./index-VwQV0veO.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/History-CPQprqBL.js b/web/dist/assets/History-CPQprqBL.js new file mode 100644 index 0000000..1f49b8c --- /dev/null +++ b/web/dist/assets/History-CPQprqBL.js @@ -0,0 +1 @@ +import{r as i,j as e,V as p,c as b,b as j}from"./index-a5px9_EI.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-CAfNa1AE.js b/web/dist/assets/Landing-D8mpPU0X.js similarity index 99% rename from web/dist/assets/Landing-CAfNa1AE.js rename to web/dist/assets/Landing-D8mpPU0X.js index 41d4ae6..eb9a3e1 100644 --- a/web/dist/assets/Landing-CAfNa1AE.js +++ b/web/dist/assets/Landing-D8mpPU0X.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-VwQV0veO.js";import{u as se}from"./index-VwQV0veO.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-a5px9_EI.js";import{u as se}from"./index-a5px9_EI.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-DadbQpl8.js b/web/dist/assets/Views-DadbQpl8.js new file mode 100644 index 0000000..f1c7162 --- /dev/null +++ b/web/dist/assets/Views-DadbQpl8.js @@ -0,0 +1 @@ +import{r as h,j as e,v as _,f as v,E as C,a as D,A as N,b as f,T as w}from"./index-a5px9_EI.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})]}),y=c=>r=>{r.key==="Enter"&&c()};function A({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),f.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=_(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:y(()=>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-${C[a.evidence]||"muted"}`,"data-testid":"compare-evidence",children:a.evidence}),(a.evidence_reasons||[]).map(i=>e.jsx("div",{className:"sub",children:D[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 F({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),f.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=>{var i,j;return e.jsxs("button",{className:"tag-btn",onClick:()=>r("check",n.k),title:(i=N[n.attribution])==null?void 0:i.text,children:[e.jsx("span",{className:"k",children:n.k})," ",n.name," ",e.jsxs("span",{className:"muted",children:["· ",(j=N[n.attribution])==null?void 0:j.short]})]},n.k)})}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association: it does not by itself mean the listed model, as cleared, is the recalled product."})]}),e.jsx("section",{className:"panel",children:a.filter(([,,n,,i])=>i||n.length).map(([n,i,j,g],k)=>e.jsxs("div",{"data-testid":`reach-${n}`,children:[e.jsxs("div",{className:"panel-head",style:k?{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:y(()=>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:w[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),", ",w[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 R({go:c}){const[r,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{f.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:y(()=>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=>{var n,i;return 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:(n=N[a.attribution])==null?void 0:n.text,"data-testid":"watch-attribution",children:[a.ancestor,": ",(i=N[a.attribution])==null?void 0:i.short]})]},a.recall_id+a.ancestor)})]})]},s.k))})]})})})]})}function T({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 f.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 I({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{A as CompareView,T as IngestView,I as MethodView,F as ReachView,R as WatchlistView}; diff --git a/web/dist/assets/Views-v6kKlFl0.js b/web/dist/assets/Views-v6kKlFl0.js deleted file mode 100644 index 5f2fa65..0000000 --- a/web/dist/assets/Views-v6kKlFl0.js +++ /dev/null @@ -1 +0,0 @@ -import{r as o,j as e,f as g,V as y,a as N}from"./index-VwQV0veO.js";const v=({eyebrow:i,title:c,children:h})=>e.jsxs("div",{className:"page-head",children:[e.jsx("p",{className:"eyebrow",children:i}),e.jsx("h1",{children:c}),h&&e.jsx("p",{children:h})]}),f=i=>c=>{c.key==="Enter"&&i()};function _({initial:i,go:c}){const[h,l]=o.useState(i||"K200480 K113053 K233643 K143677"),[r,d]=o.useState(null),[m,t]=o.useState(null),[x,j]=o.useState(!1),n=(s=h)=>{const p=[...new Set(s.toUpperCase().match(/K\d{6}/g)||[])].slice(0,8);if(!p.length){t("Enter one or more K-numbers");return}t(null),j(!0),N.compare(p).then(d).catch(a=>t(a.message)).finally(()=>j(!1))};return o.useEffect(()=>{n(i||h)},[i]),e.jsxs("div",{children:[e.jsx(v,{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(),n()},children:[e.jsx("input",{className:"field",value:h,onChange:s=>l(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"})]}),m&&e.jsx("p",{className:"err",children:m})]}),r&&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:["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:r.map(s=>s.found?e.jsxs("tr",{className:"click",tabIndex:0,onClick:()=>c("check",s.k),onKeyDown:f(()=>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.jsx("td",{children:e.jsx("span",{className:`chip tone-${y[s.verdict].tone}`,children:y[s.verdict].label})}),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.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:"k mono",children:s.k})}),e.jsxs("td",{colSpan:6,className:"sub",children:["Not in the graph. ",e.jsx("a",{href:`#/ingest/${s.k}`,children:"Read it from FDA →"})]})]},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."})]})]})}function C({initial:i,go:c}){const[h,l]=o.useState(i||"88058,88071"),[r,d]=o.useState(null),[m,t]=o.useState(null),x=(a=h)=>{t(null),d(null),N.recallEvent(a.replace(/\s/g,"")).then(d).catch(u=>t(u.message))};o.useEffect(()=>{l(i||"88058,88071"),x(i||"88058,88071")},[i]);const j=a=>{var u;return((u=a.conditional_via)==null?void 0:u.length)>0&&a.conditional_via.length===a.via.length},n=(r==null?void 0:r.descendants.filter(a=>a.after_recall))||[],s=(r==null?void 0:r.descendants.filter(a=>!a.after_recall))||[],p=(r==null?void 0:r.descendants.filter(j).length)||0;return e.jsxs("div",{children:[e.jsx(v,{eyebrow:"Recall evidence",title:"Recall reach",children:"Start from an FDA recall event. Forebear finds every clearance it names, then every later clearance that cites one of them, up to three generations, and splits them by whether they were cleared after the recall began."}),e.jsxs("section",{className:"panel",children:[e.jsxs("form",{className:"row-in",onSubmit:a=>{a.preventDefault(),x()},children:[e.jsx("input",{className:"field",value:h,onChange:a=>l(a.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:()=>{l("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:()=>{l("86646"),x("86646")},children:"86646"})," ",e.jsx("button",{className:"tag-btn",onClick:()=>{l("84406"),x("84406")},children:"84406"})]}),m&&e.jsx("p",{className:"err",children:m})]}),!r&&!m&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Tracing descendants in Relate…"]}),r&&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:r.recalled.length}),e.jsxs("span",{children:["clearances named in recall event(s) ",r.event]})]}),e.jsxs("div",{children:[e.jsx("b",{children:r.descendants.length}),e.jsx("span",{children:"later clearances descend from them"})]}),e.jsxs("div",{className:"amber",children:[e.jsx("b",{children:n.length}),e.jsxs("span",{children:["cleared after the recall on their lineage began",r.initiated?` (earliest ${g(r.initiated)})`:""]})]}),e.jsxs("div",{className:"violet",children:[e.jsx("b",{children:p}),e.jsx("span",{children:"reached only through an unresolved citation (conditional)"})]})]}),e.jsx("div",{className:"tags",style:{marginTop:14},children:r.recalled.map(a=>e.jsxs("button",{className:"tag-btn",onClick:()=>c("check",a.k),children:[e.jsx("span",{className:"k",children:a.k})," ",a.name]},a.k))})]}),e.jsxs("section",{className:"panel",children:[e.jsxs("div",{className:"panel-head",children:[e.jsxs("h2",{children:["Cleared after the recall began ",e.jsx("span",{className:"count",children:n.length})]}),e.jsx("p",{className:"hint",children:'"After it began", not after it was resolved. A descendant is not recalled because of its ancestor.'})]}),e.jsx(w,{rows:n,go:c,isCond:j}),e.jsx("div",{className:"panel-head",style:{marginTop:22},children:e.jsxs("h2",{children:["Cleared before ",e.jsx("span",{className:"count",children:s.length})]})}),e.jsx(w,{rows:s,go:c,isCond:j})]})]})]})}function w({rows:i,go:c,isCond:h}){return i.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 lineage"]}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Descends from"})]})}),e.jsx("tbody",{children:i.map(l=>{const r=h(l);return e.jsxs("tr",{className:"click"+(r?" is-conditional":""),tabIndex:0,onClick:()=>c("check",l.k),onKeyDown:f(()=>c("check",l.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:l.k})," ",r&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:l.name})]}),e.jsx("td",{className:"sub",children:l.applicant}),e.jsx("td",{className:"num",children:g(l.decision_date)}),e.jsx("td",{className:"num",children:g(l.recall_started)}),e.jsx("td",{children:l.gen===1?"direct predicate":`${l.gen} generations`}),e.jsx("td",{className:"sub",children:l.via.map(d=>{var m,t;return e.jsxs("span",{style:(m=l.conditional_via)!=null&&m.includes(d)?{color:"var(--violet)"}:void 0,title:(t=l.conditional_via)!=null&&t.includes(d)?"Reached only through an unresolved citation":void 0,children:[d," "]},d)})})]},l.k)})})]})}):e.jsx("p",{className:"muted",children:"None."})}function D({go:i}){const[c,h]=o.useState(null),[l,r]=o.useState(null),[d,m]=o.useState("all");o.useEffect(()=>{N.watchlist().then(h).catch(n=>r(n.message))},[]);const t=(c==null?void 0:c.rows)||[],x=t.filter(n=>d==="all"||d==="direct"&&n.supported_min_gen===1||d==="supported"&&!n.conditional||d==="conditional"&&n.conditional),j=(c==null?void 0:c.conditional)??t.filter(n=>n.conditional).length;return e.jsxs("div",{children:[e.jsx(v,{eyebrow:"Recall evidence",title:"Watchlist: cited after a recall began",children:"Clearances cleared after a design-related recall had already started on their predicate or grand-predicate. 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."}),l&&e.jsx("p",{className:"err",children:l}),!c&&!l&&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 in the dataset match"})]}),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:j}),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(([n,s])=>e.jsx("button",{"aria-pressed":d===n,onClick:()=>m(n),children:s},n))})]}),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:"Received / cleared"}),e.jsx("th",{children:"Recalled ancestor"}),e.jsx("th",{children:"Recall records"})]})}),e.jsx("tbody",{children:x.map(n=>e.jsxs("tr",{className:"click"+(n.conditional?" is-conditional":""),tabIndex:0,onClick:()=>i("check",n.k),onKeyDown:f(()=>i("check",n.k)),children:[e.jsxs("td",{children:[e.jsx("span",{className:"k mono",children:n.k})," ",n.conditional&&e.jsx("span",{className:"chip tone-violet",children:"conditional"}),e.jsx("div",{className:"sub",children:n.name}),e.jsx("div",{className:"sub",children:n.applicant})]}),e.jsxs("td",{className:"num",children:[g(n.received_date),e.jsx("div",{className:"sub",children:g(n.decision_date)})]}),e.jsxs("td",{children:[e.jsx("span",{className:"mono",children:n.ancestors.join(", ")}),e.jsx("div",{className:"sub",children:n.conditional?"cited device · citation unresolved":n.supported_min_gen===1?"direct predicate":"grand-predicate"})]}),e.jsxs("td",{className:"sub",children:[n.recall_count>2&&e.jsxs("div",{className:"muted",children:[n.recall_count," recall routes; first two:"]}),n.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"})]},s.recall_id+s.ancestor))]})]},n.k))})]})})})]})}function S({initial:i,go:c,onChanged:h}){const[l,r]=o.useState(i||""),[d,m]=o.useState(!1),[t,x]=o.useState(null),[j,n]=o.useState(null);o.useEffect(()=>{i&&r(i)},[i]);const s=async()=>{m(!0),n(null),x(null);try{const a=await N.ingest(l);x(a),h&&h()}catch(a){n(a.message)}finally{m(!1)}},p=(a,u)=>Object.keys({...a,...u}).map(b=>[b,(u[b]||0)-(a[b]||0)]).filter(([,b])=>b);return e.jsxs("div",{children:[e.jsx(v,{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:a=>{a.preventDefault(),s()},children:[e.jsx("input",{className:"field",value:l,placeholder:"K-number, e.g. K241135",onChange:a=>r(a.target.value),"aria-label":"K-number to read from FDA"}),e.jsx("button",{className:"btn btn-primary",disabled:d||!l,children:d?"Reading from FDA…":"Read and add"})]}),d&&e.jsxs("div",{className:"loading-thread",children:[e.jsx("i",{}),"Downloading the summary PDF and extracting citations…"]}),j&&e.jsx("p",{className:"err",role:"alert",children:j})]}),t&&e.jsxs("section",{className:"panel",children:[e.jsx("div",{className:"panel-head",children:e.jsxs("h2",{children:[t.k,": ",t.was_present?t.lineage_was_known?"re-read":"lineage extended":"added to the graph"]})}),e.jsxs("p",{children:["Summary: ",e.jsx("b",{children:t.summary_status}),t.summary_url&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("a",{href:t.summary_url,target:"_blank",rel:"noreferrer",children:"PDF ↗"})]})]}),e.jsxs("p",{className:"muted",children:["Graph change: ",p(t.graph_before,t.graph_after).concat(p(t.rels_before,t.rels_after)).map(([a,u])=>`${u>0?"+":""}${u} ${a}`).join(" · ")||"no new nodes or relationships (already up to date)"]}),e.jsx("h3",{style:{fontSize:13},children:"Citations read from the summary"}),t.citations_added.length===0?e.jsxs("p",{className:"muted",children:["None found",t.summary_status!=="ok"?" (summary not machine-readable)":"","."]}):t.citations_added.map(a=>e.jsxs("div",{className:"cit",children:[e.jsxs("div",{className:"cit-h",children:[e.jsx("span",{className:"k mono",children:a.dst})," ",e.jsx("span",{className:"chip",children:a.kind})," ",e.jsxs("span",{className:"muted",children:["p.",a.page]})]}),e.jsxs("blockquote",{className:"quote",children:["“",a.snippet,"”"]})]},a.dst)),e.jsxs("p",{className:"muted small",children:[t.recalls_linked.length," recall record(s) linked."]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>c("check",t.k),children:["Investigate ",t.k," ",e.jsx("span",{className:"arr",children:"→"})]})]})]})}function R({stats:i}){return e.jsxs("div",{className:"method",children:[e.jsx(v,{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."]})]}),i&&e.jsxs("p",{className:"muted small",children:["Live: ",i.nodes.Device.toLocaleString("en-US")," devices, ",i.relationships.CITES.toLocaleString("en-US")," citation edges, ",i.nodes.Recall.toLocaleString("en-US")," recall records."]})]})]})}export{_ as CompareView,S as IngestView,R as MethodView,C as ReachView,D as WatchlistView}; diff --git a/web/dist/assets/index-VwQV0veO.js b/web/dist/assets/index-VwQV0veO.js deleted file mode 100644 index e3b99fb..0000000 --- a/web/dist/assets/index-VwQV0veO.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 Bc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wa={exports:{}},xl={},ka={exports:{}},D={};/** - * @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 ar=Symbol.for("react.element"),Hc=Symbol.for("react.portal"),Qc=Symbol.for("react.fragment"),Kc=Symbol.for("react.strict_mode"),Gc=Symbol.for("react.profiler"),Yc=Symbol.for("react.provider"),Xc=Symbol.for("react.context"),Zc=Symbol.for("react.forward_ref"),Jc=Symbol.for("react.suspense"),qc=Symbol.for("react.memo"),bc=Symbol.for("react.lazy"),lo=Symbol.iterator;function ed(e){return e===null||typeof e!="object"?null:(e=lo&&e[lo]||e["@@iterator"],typeof e=="function"?e:null)}var ja={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Sa=Object.assign,Na={};function kn(e,t,n){this.props=e,this.context=t,this.refs=Na,this.updater=n||ja}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 _a(){}_a.prototype=kn.prototype;function ss(e,t,n){this.props=e,this.context=t,this.refs=Na,this.updater=n||ja}var os=ss.prototype=new _a;os.constructor=ss;Sa(os,kn.prototype);os.isPureReactComponent=!0;var io=Array.isArray,Ea=Object.prototype.hasOwnProperty,as={current:null},Ca={key:!0,ref:!0,__self:!0,__source:!0};function Pa(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)Ea.call(t,r)&&!Ca.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,z))Ltl(hr,Fl)?(C[X]=hr,C[Lt]=z,X=Lt):(C[X]=Fl,C[Tt]=z,X=Tt);else if(Ltl(hr,z))C[X]=hr,C[Lt]=z,X=Lt;else break e}}return $}function l(C,$){var z=C.sortIndex-$.sortIndex;return z!==0?z:C.id-$.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 $=n(d);$!==null;){if($.callback===null)r(d);else if($.startTime<=C)r(d),$.sortIndex=$.expirationTime,t(u,$);else break;$=n(d)}}function w(C){if(k=!1,h(C),!y)if(n(u)!==null)y=!0,Xe(N);else{var $=n(d);$!==null&&F(w,$.startTime-C)}}function N(C,$){y=!1,k&&(k=!1,v(x),x=-1),g=!0;var z=m;try{for(h($),p=n(u);p!==null&&(!(p.expirationTime>$)||C&&!B());){var X=p.callback;if(typeof X=="function"){p.callback=null,m=p.priorityLevel;var ee=X(p.expirationTime<=$);$=e.unstable_now(),typeof ee=="function"?p.callback=ee:p===n(u)&&r(u),h($)}else r(u);p=n(u)}if(p!==null)var pr=!0;else{var Tt=n(d);Tt!==null&&F(w,Tt.startTime-$),pr=!1}return pr}finally{p=null,m=z,g=!1}}var E=!1,j=null,x=-1,R=5,P=-1;function B(){return!(e.unstable_now()-PC||125X?(C.sortIndex=z,t(d,C),n(u)===null&&C===n(d)&&(k?(v(x),x=-1):k=!0,F(w,z-X))):(C.sortIndex=ee,t(u,C),y||g||(y=!0,Xe(N))),C},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(C){var $=m;return function(){var z=m;m=$;try{return C.apply(this,arguments)}finally{m=z}}}})(za);$a.exports=za;var dd=$a.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 fd=_,Ne=dd;function S(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"),di=Object.prototype.hasOwnProperty,pd=/^[: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]*$/,oo={},ao={};function hd(e){return di.call(ao,e)?!0:di.call(oo,e)?!1:pd.test(e)?ao[e]=!0:(oo[e]=!0,!1)}function md(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 vd(e,t,n,r){if(t===null||typeof t>"u"||md(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 cs=/[\-:]([a-z])/g;function ds(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(cs,ds);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(cs,ds);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(cs,ds);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 fs(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:"")?$n(e):""}function gd(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=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 mi(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 fi:return"Profiler";case ps:return"StrictMode";case pi:return"Suspense";case hi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Fa:return(e.displayName||"Context")+".Consumer";case Ma:return(e._context.displayName||"Context")+".Provider";case hs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ms:return t=e.displayName||null,t!==null?t:mi(e.type)||"Memo";case ut:t=e._payload,e=e._init;try{return mi(e(t))}catch{}}return null}function yd(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 mi(t);case 8:return t===ps?"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 Oa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xd(e){var t=Oa(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 gr(e){e._valueTracker||(e._valueTracker=xd(e))}function Aa(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Oa(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 vi(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function co(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 Ua(e,t){t=t.checked,t!=null&&fs(e,"checked",t,!1)}function gi(e,t){Ua(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")?yi(e,t.type,n):t.hasOwnProperty("defaultValue")&&yi(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fo(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 yi(e,t,n){(t!=="number"||Xr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Kn(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},wd=["Webkit","ms","Moz","O"];Object.keys(Fn).forEach(function(e){wd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fn[t]=Fn[e]})});function Ha(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 Qa(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Ha(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var kd=K({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 ki(e,t){if(t){if(kd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function ji(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 vs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ni=null,an=null,un=null;function mo(e){if(e=dr(e)){if(typeof Ni!="function")throw Error(S(280));var t=e.stateNode;t&&(t=_l(t),Ni(e.stateNode,e.type,t))}}function Ka(e){an?un?un.push(e):un=[e]:an=e}function Ga(){if(an){var e=an,t=un;if(un=an=null,mo(e),t)for(e=0;e>>=0,e===0?32:31-($d(e)/zd|0)|0}var xr=64,wr=4194304;function Dn(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=Dn(a):(i&=s,i!==0&&(r=Dn(i)))}else s=n&~l,s!==0?r=Dn(s):i!==0&&(r=Dn(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 ur(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 Id(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),No=" ",_o=!1;function pu(e,t){switch(e){case"keyup":return ff.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function hf(e,t){switch(e){case"compositionend":return hu(t);case"keypress":return t.which!==32?null:(_o=!0,No);case"textInput":return e=t.data,e===No&&_o?null:e;default:return null}}function mf(e,t){if(Zt)return e==="compositionend"||!Ns&&pu(e,t)?(e=du(),Ar=ks=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=To(n)}}function yu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xu(){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 _s(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 Nf(e){var t=xu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&yu(n.ownerDocument.documentElement,n)){if(r!==null&&_s(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=Lo(n,i);var s=Lo(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,Li=null,Un=null,Ri=!1;function Ro(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ri||Jt==null||Jt!==Xr(r)||(r=Jt,"selectionStart"in r&&_s(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&&qn(Un,r)||(Un=r,r=nl(Li,"onSelect"),0en||(e.current=Ii[en],Ii[en]=null,en--)}function A(e,t){en++,Ii[en]=e.current,e.current=t}var Nt={},ce=Ct(Nt),ye=Ct(!1),Ut=Nt;function hn(e,t){var n=e.type.contextTypes;if(!n)return Nt;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 Oo(e,t,n){if(ce.current!==Nt)throw Error(S(168));A(ce,t),A(ye,n)}function Pu(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(S(108,yd(e)||"Unknown",l));return K({},n,r)}function il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Nt,Ut=ce.current,A(ce,e),A(ye,ye.current),!0}function Ao(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=Pu(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 Tu(e){Je===null?Je=[e]:Je.push(e)}function Ff(e){El=!0,Tu(e)}function Pt(){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 P=m(v,j,h[x],w);if(P===null){j===null&&(j=R);break}e&&j&&P.alternate===null&&t(v,j),c=i(P,c,x),E===null?N=P:E.sibling=P,E=P,j=R}if(x===h.length)return n(v,j),W&&$t(v,x),N;if(j===null){for(;xx?(R=j,j=null):R=j.sibling;var B=m(v,j,P.value,w);if(B===null){j===null&&(j=R);break}e&&j&&B.alternate===null&&t(v,j),c=i(B,c,x),E===null?N=B:E.sibling=B,E=B,j=R}if(P.done)return n(v,j),W&&$t(v,x),N;if(j===null){for(;!P.done;x++,P=h.next())P=p(v,P.value,w),P!==null&&(c=i(P,c,x),E===null?N=P:E.sibling=P,E=P);return W&&$t(v,x),N}for(j=r(v,j);!P.done;x++,P=h.next())P=g(j,v,x,P.value,w),P!==null&&(e&&P.alternate!==null&&j.delete(P.key===null?x:P.key),c=i(P,c,x),E===null?N=P:E.sibling=P,E=P);return e&&j.forEach(function(I){return t(v,I)}),W&&$t(v,x),N}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 vr:e:{for(var N=h.key,E=c;E!==null;){if(E.key===N){if(N=h.type,N===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===N||typeof N=="object"&&N!==null&&N.$$typeof===ut&&Wo(N)===E.type){n(v,E.sibling),c=l(E,h.props),c.ref=Tn(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=Gr(h.type,h.key,h.props,null,v.mode,w),w.ref=Tn(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(zn(h))return y(v,c,h,w);if(Nn(h))return k(v,c,h,w);Cr(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=zu(!0),Du=zu(!1),al=Ct(null),ul=null,rn=null,Ts=null;function Ls(){Ts=rn=ul=null}function Rs(e){var t=al.current;V(al),e._currentValue=t}function Ui(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,Ts=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(Ts!==e)if(e={context:e,memoizedValue:t,next:null},rn===null){if(ul===null)throw Error(S(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 Mu(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 Fu(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,M&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 Vr(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,ys(e,n)}}function Bo(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=K({},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 Ho(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 bu(){return $e().memoizedState}function Uf(e,t,n){var r=kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ec(e))tc(t,n);else if(n=Mu(e,t,n,r),n!==null){var l=fe();Ae(n,e,r,l),nc(n,t,r)}}function Vf(e,t,n){var r=kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ec(e))tc(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=Mu(e,t,l,r),n!==null&&(l=fe(),Ae(n,e,r,l),nc(n,t,r))}}function ec(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function tc(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 nc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ys(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},Wf={readContext:Re,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Re,useEffect:Ko,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Br(4194308,4,Yu.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Br(4194308,4,e,t)},useInsertionEffect:function(e,t){return Br(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=Uf.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Qo,useDebugValue:Vs,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Qo(!1),t=e[0];return e=Af.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Q,l=He();if(W){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ne===null)throw Error(S(349));Wt&30||Uu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ko(Wu.bind(null,r,i,e),[e]),r.flags|=2048,sr(9,Vu.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=lr++,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[tr]=r,fc(e,t,!1,!1),t.stateNode=e;e:{switch(s=ji(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=H.current,A(H,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Gs(),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(S(156,t.tag))}function Zf(e,t){switch(Cs(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),Fs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ms(t),null;case 13:if(V(H),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(H),null;case 4:return gn(),null;case 10:return Rs(t.type._context),null;case 22:case 23:return Gs(),null;case 24:return null;default:return null}}var Tr=!1,ue=!1,Jf=typeof WeakSet=="function"?WeakSet:Set,T=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 Xi(e,t,n){try{n()}catch(r){G(e,t,r)}}var ra=!1;function qf(e,t){if($i=el,e=xu(),_s(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,T=t;T!==null;)if(t=T,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,T=e;else for(;T!==null;){t=T;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:De(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(S(163))}}catch(w){G(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,T=e;break}T=t.return}return y=ra,ra=!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&&Xi(t,n,i)}l=l.next}while(l!==r)}}function Tl(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 Zi(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 mc(e){var t=e.alternate;t!==null&&(e.alternate=null,mc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qe],delete t[tr],delete t[Fi],delete t[Df],delete t[Mf])),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 vc(e){return e.tag===5||e.tag===3||e.tag===4}function la(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vc(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 Ji(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(Ji(e,t,n),e=e.sibling;e!==null;)Ji(e,t,n),e=e.sibling}function qi(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(qi(e,t,n),e=e.sibling;e!==null;)qi(e,t,n),e=e.sibling}var re=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)gc(e,t,n),n=n.sibling}function gc(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),Zn(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)&&Xi(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 ia(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Jf),t.forEach(function(r){var l=op.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ze(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*ep(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,vl=0,M&6)throw Error(S(331));var l=M;for(M|=4,T=e.current;T!==null;){var i=T,s=i.child;if(T.flags&16){var a=i.deletions;if(a!==null){for(var u=0;uZ()-Qs?Ot(e,0):Hs|=n),we(e,t)}function _c(e,t){t===0&&(e.mode&1?(t=wr,wr<<=1,!(wr&130023424)&&(wr=4194304)):t=1);var n=fe();e=rt(e,t),e!==null&&(ur(e,t,n),we(e,n))}function sp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),_c(e,n)}function op(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(S(314))}r!==null&&r.delete(t),_c(e,n)}var Ec;Ec=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,Yf(e,t,n);ge=!!(e.flags&131072)}else ge=!1,W&&t.flags&1048576&&Lu(t,ol,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hr(e,t),e=t.pendingProps;var l=hn(t,ce.current);dn(t,n),l=Os(null,t,r,e,l,n);var i=As();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=Pl,t.stateNode=l,l._reactInternals=t,Wi(t,r,e,n),t=Qi(null,t,r,!0,i,n)):(t.tag=0,W&&i&&Es(t),de(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hr(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=up(r),e=De(r,e),l){case 0:t=Hi(null,t,r,e,n);break e;case 1:t=ea(null,t,r,e,n);break e;case 11:t=qo(null,t,r,e,n);break e;case 14:t=bo(null,t,r,De(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),Hi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),ea(e,t,r,l,n);case 3:e:{if(uc(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Fu(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(S(423)),t),t=ta(e,t,r,n,l);break e}else if(r!==l){l=yn(Error(S(424)),t),t=ta(e,t,r,n,l);break e}else for(je=yt(t.stateNode.containerInfo.firstChild),Se=t,W=!0,Fe=null,n=Du(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 Iu(t),e===null&&Ai(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Di(r,l)?s=null:i!==null&&Di(r,i)&&(t.flags|=32),ac(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Ai(t),null;case 13:return cc(e,t,n);case 4:return Ds(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:De(r,l),qo(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),Ui(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(S(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ui(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=De(r,t.pendingProps),l=De(r.type,l),bo(e,t,r,l,n);case 15:return sc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:De(r,l),Hr(e,t),t.tag=1,xe(r)?(e=!0,il(t)):e=!1,dn(t,n),rc(t,r,l),Wi(t,r,l,n),Qi(null,t,r,!0,e,n);case 19:return dc(e,t,n);case 22:return oc(e,t,n)}throw Error(S(156,t.tag))};function Cc(e,t){return eu(e,t)}function ap(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 Te(e,t,n,r){return new ap(e,t,n,r)}function Xs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function up(e){if(typeof e=="function")return Xs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===hs)return 11;if(e===ms)return 14}return 2}function jt(e,t){var n=e.alternate;return n===null?(n=Te(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 Gr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Xs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xt:return At(n.children,l,i,t);case ps:s=8,l|=8;break;case fi:return e=Te(12,n,t,l|2),e.elementType=fi,e.lanes=i,e;case pi:return e=Te(13,n,t,l),e.elementType=pi,e.lanes=i,e;case hi:return e=Te(19,n,t,l),e.elementType=hi,e.lanes=i,e;case Ia:return Rl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ma:s=10;break e;case Fa:s=9;break e;case hs:s=11;break e;case ms:s=14;break e;case ut:s=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=Te(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function At(e,t,n,r){return e=Te(7,e,r,t),e.lanes=n,e}function Rl(e,t,n,r){return e=Te(22,e,r,t),e.elementType=Ia,e.lanes=n,e.stateNode={isHidden:!1},e}function oi(e,t,n){return e=Te(6,e,null,t),e.lanes=n,e}function ai(e,t,n){return t=Te(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cp(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 Zs(e,t,n,r,l,i,s,a,u){return e=new cp(e,t,n,a,u),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Te(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 dp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Rc)}catch(e){console.error(e)}}Rc(),Ra.exports=_e;var $c=Ra.exports,zc,pa=$c;zc=pa.createRoot,pa.hydrateRoot;const vp="modulepreload",gp=function(e){return"/"+e},ha={},Dt=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=gp(u),u in ha)return;ha[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":vp,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}})},Dc=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,yp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,rs={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(rs.nodes.map(e=>[e.id,e]));function Mc({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:[rs.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)),rs.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 xp({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Mc,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const eo="forebear:intro",wp=3e3,ma=2450;function kp(){try{return!!sessionStorage.getItem(eo)}catch{return!0}}function jp(){try{sessionStorage.setItem(eo,"seen")}catch{}}function Sp(){try{sessionStorage.removeItem(eo)}catch{}}function Np({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,jp(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,ma),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),wp-ma+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(Mc,{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 _p(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 va=["mcp-client"],Yr={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."}},Fc={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 Ep(e){if(!e)return[];if(e.review==="confirmed"&&!va.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"&&va.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=Ep(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 Cp(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function to(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function no(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const Pp=["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} ${Pp[(n||1)-1]} ${t}`:String(e)}const Ic=e=>e?String(e).slice(0,4):"";function ga(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 Oc(e,t){const n=Tp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?ga(e,t):ga(t,e);return{relation:n<0?"before":"after",months:r,duration:Lp(r)}}function Ac(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 Lp(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 Rp=(e,t)=>e?t?`${e}#page=${t}`:e:null,$p={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}const ui=70,zr=110,ya=46,zp=62,Dp=190,xa=300;function Mp(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 Fp(e,{depth:t,descendants:n}){const r=new Map,l=Mp(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 Ip(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,P)=>{const B=p.get(l.get(R.k))??0,I=p.get(l.get(P.k))??0;return B-I||(P.decision_date||"").localeCompare(R.decision_date||"")}),x.forEach((R,P)=>{R.side!=="self"&&p.set(R.k,(P-(x.length-1)/2)*ui)})}const y=a+u,k=y?Math.max(Dp,Math.min(xa,(t-zr*2)/y)):xa,L=Math.max(t,zr*2+y*k),v=zr+(L-(zr*2+y*k))/2,c=ya+zp+Math.max(1,g)*ui,h=ya+Math.max(1,g)*ui/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:h+p.get(j.k)}])),N=[...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:N,edges:r}}function Op({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Fp(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(()=>Ip(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(N=>N.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),N=(h.x+w.x)/2,E=`M${h.x-12},${h.y} C${N},${h.y} ${N},${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:N-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=to(c),N=c.side==="self",E=N?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${N?" 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"&&!N&&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)," · ",Ic(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,Dr=34,ci=260,at=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Ap(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 Up({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(()=>Ap(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-ci-40,L=x=>16+(x-g)/(y-g)*k,v=x=>Dr+x*Rt+Rt/2,c=Dr+u.length*Rt+16,h=new Set(n||[]),w=new Set;if(n)for(let x=0;x+1"+n[x+1]);const N=m-p>24?4:m-p>12?2:1,E=[];for(let x=p;x<=m;x+=N)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:Dr-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:Dr-8,y2:c-8}),[...a.values()].filter(x=>x.parent&&a.has(x.parent)).map(x=>{const[R,P]=x.side==="up"?[x.parent,x.k]:[x.k,x.parent],B=a.get(R),I=a.get(P);if(!B.decision_date||!I.decision_date)return null;const me=L(at(B.decision_date)),We=v(d.get(R)),Y=L(at(I.decision_date)),Xe=v(d.get(P)),F=(me+Y)/2;return o.jsx("path",{d:`M${me-6},${We} C${F},${We} ${F},${Xe} ${Y+7},${Xe}`,className:"tl-edge"+(w.has(R+">"+P)?" on":"")},R+P)}),u.map((x,R)=>{const P=a.get(x);if(!P.decision_date)return null;const B=L(at(P.decision_date)),I=v(R),me=to(P),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} ${P.name}, cleared ${P.decision_date}, ${(P.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:I-Rt/2,width:i,height:Rt}),(P.recalls||[]).map(Y=>Y.initiated&&o.jsxs("g",{children:[o.jsx("line",{className:"tl-rlink",x1:B,x2:L(at(Y.initiated)),y1:I,y2:I}),o.jsx("path",{d:`M${L(at(Y.initiated))},${I-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:B,cy:I,r:x===e.k?7:5.5,className:`dot tone-${me}${P.lineage_known===!1?" unread":""}`,style:x===e.k?{fill:"var(--ivory)",stroke:"var(--blue)",strokeWidth:3}:void 0}),o.jsxs("text",{x:i-ci+8,y:I+4,className:"tl-label",children:[o.jsx("tspan",{className:"lk",children:x}),o.jsx("tspan",{dx:"7",children:it(P.name,24)})]}),o.jsx("text",{x:i-ci-6,y:I+4,textAnchor:"end",className:"tl-gen",children:P.side==="self"?"candidate":P.side==="up"?`G-${P.gen}`:`D+${P.gen}`})]},x)})]})})}function Uc({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 Vp({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 Vc({r:e}){const t=Cp(e);return o.jsxs("div",{className:"recall",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 ↗"})]}),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 Wp({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(Bp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(Hp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function ls({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 Bp({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(ls,{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(Vp,{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:Fc[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(Uc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:Rp(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:$p[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 Hp({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(ls,{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=no(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:Dc(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:["FDA recall records · ",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:"No recall record names this 510(k) in openFDA."}):o.jsx("div",{style:{display:"grid",gap:8},children:a.slice(0,20).map(g=>o.jsx(Vc,{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 Qp={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 Wc(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 Kp({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Wc(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=>Fc[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})," · ",Qp[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 ro(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 is(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 Gp({a:e}){const t=e.device,n=ro(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=is(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=is(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Oc(s.initiated,t.decision_date):null,d=no(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),") has ",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"]}):Ac(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 Yp({a:e,onSelect:t}){const n=ro(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=is(s,e.device.decision_date),u=a?Oc(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?to({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"}),Ac(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[no(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function Xp({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),[N,E]=_.useState([]),[j,x]=_.useState([]),R=()=>{u(!0),s(null),Ie.assess(e,d).then(F=>{l(F)}).catch(F=>{l(null),s(F.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 P=r.device,B=Yr[r.verdict],I=r.coverage,me=Wc(r).length,We=r.signals.filter(F=>F.conditional).length;return o.jsxs("div",{className:"investigation","aria-busy":a,children:[o.jsxs("section",{className:`finding tone-${B.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:[P.product_code,(Y=P.product)!=null&&Y.name?` · ${P.product.name}`:""]})]}),o.jsx("h1",{id:"finding-title",children:P.name}),o.jsxs("div",{className:"meta",children:[o.jsx("span",{children:P.applicant}),o.jsxs("span",{children:["Cleared ",Ue(P.decision_date)]}),o.jsx("span",{children:P.clearance_type||"510(k)"}),o.jsx("a",{href:Dc(r.k),target:"_blank",rel:"noreferrer",children:"FDA record ↗"}),P.summary_url&&o.jsx("a",{href:P.summary_url,target:"_blank",rel:"noreferrer",children:"510(k) summary PDF ↗"})]})]}),o.jsxs("div",{className:`verdict tone-${B.tone}`,"data-testid":"verdict",children:[o.jsxs("div",{className:"verdict-label",children:[o.jsx("i",{"aria-hidden":"true"}),B.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(Gp,{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]}),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:F=>{var C;F.preventDefault(),(C=document.getElementById("review"))==null||C.scrollIntoView({block:"start"})},children:[me," item(s) need human review ↓"]})]})]}),o.jsx(Yp,{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:F=>m(+F.target.value),"aria-label":"Generations shown",children:Array.from({length:d},(F,C)=>C+1).map(F=>o.jsxs("option",{value:F,children:[F," gen"]},F))})]}),o.jsxs("label",{className:"small muted",children:["Query ",o.jsx("select",{className:"field",value:d,onChange:F=>f(+F.target.value),"aria-label":"Generations traversed by the query",children:[2,3,4,5,6].map(F=>o.jsxs("option",{value:F,children:[F," gen"]},F))})]}),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(Op,{a:r,depth:p,onDepth:m,descendants:k,selected:v,onSelect:c,focusChain:h}):o.jsx(Up,{a:r,depth:p,highlight:h||((Xe=ro(r))==null?void 0:Xe.chain),onSelect:c}),o.jsxs("p",{className:"graph-hint",children:["By hand, this is ",1+r.ancestors.filter(F=>F.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(Kp,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(Zp,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(qp,{a:r,reload:R,go:t,onSelect:c}),o.jsx(bp,{a:r,onSaved:()=>{Ie.assessments(e).then(E),n&&n()}}),o.jsx(eh,{a:r,assessments:N,runs:j,go:t})]})]}),v&&o.jsx(Wp,{sel:v,a:r,onClose:()=>c(null),go:(F,C)=>{c(null),t(F,C)},reload:R,onSelect:c})]})}function Zp({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(Jp,{s:r,onSelect:t},l))]})}function Jp({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(Vc,{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 qp({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)," · ",Ic(d.dst_decision_date)]})]}),o.jsx(Uc,{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 bp({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 eh({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=Yr[l.verdict])==null?void 0:s.tone)||"muted"}`,children:((a=Yr[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=Yr[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:yp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function th({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 nh={compare:_.lazy(()=>Dt(()=>import("./Views-v6kKlFl0.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>Dt(()=>import("./Views-v6kKlFl0.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>Dt(()=>import("./Views-v6kKlFl0.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>Dt(()=>import("./Views-v6kKlFl0.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>Dt(()=>import("./History-BBJg5IuM.js"),[])),method:_.lazy(()=>Dt(()=>import("./Views-v6kKlFl0.js"),[]).then(e=>({default:e.MethodView})))},rh={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"})},lh=({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:rh[e]}),ih=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function sh({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=nh[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(xp,{size:24})}),o.jsx(oh,{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:[ih.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(lh,{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(Xp,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(th,{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 oh({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 ah=_.lazy(()=>Dt(()=>import("./Landing-CAfNa1AE.js"),[])),uh={about:"method"};function Mr(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:uh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const ch=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function dh(){const[e,t]=_.useState(Mr),[n,r]=_.useState(null),[l,i]=_.useState(null),s=_p("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!kp()&&!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(Mr());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=ch(y,k),c=()=>{history.pushState(null,"",v),t(Mr(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>$c.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Mr());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Sp(),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(Np,{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(ah,{go:m,stats:n,introDone:d,reduced:s})}):o.jsx(sh,{route:e,go:m,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}zc(document.getElementById("root")).render(o.jsx(dh,{}));export{Mc as M,wl as R,Yr as V,xp as W,Dt as _,Ie as a,yp as b,Ue as f,o as j,ga as m,Rp as p,_ as r,_p as u}; diff --git a/web/dist/assets/index-a5px9_EI.js b/web/dist/assets/index-a5px9_EI.js new file mode 100644 index 0000000..d1796e7 --- /dev/null +++ b/web/dist/assets/index-a5px9_EI.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 Hc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ka={exports:{}},xl={},ja={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"),Qc=Symbol.for("react.portal"),Kc=Symbol.for("react.fragment"),Gc=Symbol.for("react.strict_mode"),Yc=Symbol.for("react.profiler"),Xc=Symbol.for("react.provider"),Zc=Symbol.for("react.context"),Jc=Symbol.for("react.forward_ref"),qc=Symbol.for("react.suspense"),bc=Symbol.for("react.memo"),ed=Symbol.for("react.lazy"),lo=Symbol.iterator;function td(e){return e===null||typeof e!="object"?null:(e=lo&&e[lo]||e["@@iterator"],typeof e=="function"?e:null)}var Sa={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Na=Object.assign,_a={};function kn(e,t,n){this.props=e,this.context=t,this.refs=_a,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 Ea(){}Ea.prototype=kn.prototype;function ss(e,t,n){this.props=e,this.context=t,this.refs=_a,this.updater=n||Sa}var os=ss.prototype=new Ea;os.constructor=ss;Na(os,kn.prototype);os.isPureReactComponent=!0;var io=Array.isArray,Ca=Object.prototype.hasOwnProperty,as={current:null},Ta={key:!0,ref:!0,__self:!0,__source:!0};function Pa(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)Ca.call(t,r)&&!Ta.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(N);else{var D=n(d);D!==null&&M(w,D.startTime-C)}}function N(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(N))),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=$}}}})(za);$a.exports=za;var fd=$a.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 pd=_,Ne=fd;function S(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"),di=Object.prototype.hasOwnProperty,hd=/^[: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]*$/,oo={},ao={};function md(e){return di.call(ao,e)?!0:di.call(oo,e)?!1:hd.test(e)?ao[e]=!0:(oo[e]=!0,!1)}function vd(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 gd(e,t,n,r){if(t===null||typeof t>"u"||vd(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 cs=/[\-:]([a-z])/g;function ds(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(cs,ds);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(cs,ds);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(cs,ds);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 fs(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 yd(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 mi(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 fi:return"Profiler";case ps:return"StrictMode";case pi:return"Suspense";case hi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ia:return(e.displayName||"Context")+".Consumer";case Fa:return(e._context.displayName||"Context")+".Provider";case hs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ms:return t=e.displayName||null,t!==null?t:mi(e.type)||"Memo";case ut:t=e._payload,e=e._init;try{return mi(e(t))}catch{}}return null}function xd(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 mi(t);case 8:return t===ps?"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 Aa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wd(e){var t=Aa(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=wd(e))}function Ua(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Aa(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 vi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function co(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 Va(e,t){t=t.checked,t!=null&&fs(e,"checked",t,!1)}function gi(e,t){Va(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")?yi(e,t.type,n):t.hasOwnProperty("defaultValue")&&yi(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fo(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 yi(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},kd=["Webkit","ms","Moz","O"];Object.keys(Fn).forEach(function(e){kd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fn[t]=Fn[e]})});function Qa(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 Ka(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Qa(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var jd=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 ki(e,t){if(t){if(jd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function ji(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 vs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ni=null,an=null,un=null;function mo(e){if(e=fr(e)){if(typeof Ni!="function")throw Error(S(280));var t=e.stateNode;t&&(t=_l(t),Ni(e.stateNode,e.type,t))}}function Ga(e){an?un?un.push(e):un=[e]:an=e}function Ya(){if(an){var e=an,t=un;if(un=an=null,mo(e),t)for(e=0;e>>=0,e===0?32:31-($d(e)/zd|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 Od(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),No=" ",_o=!1;function hu(e,t){switch(e){case"keyup":return pf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function mf(e,t){switch(e){case"compositionend":return mu(t);case"keypress":return t.which!==32?null:(_o=!0,No);case"textInput":return e=t.data,e===No&&_o?null:e;default:return null}}function vf(e,t){if(Zt)return e==="compositionend"||!Ns&&hu(e,t)?(e=fu(),Ur=ks=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=Po(n)}}function xu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wu(){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 _s(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 _f(e){var t=wu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xu(n.ownerDocument.documentElement,n)){if(r!==null&&_s(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=Lo(n,i);var s=Lo(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,Li=null,Un=null,Ri=!1;function Ro(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ri||Jt==null||Jt!==Xr(r)||(r=Jt,"selectionStart"in r&&_s(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(Li,"onSelect"),0en||(e.current=Ii[en],Ii[en]=null,en--)}function A(e,t){en++,Ii[en]=e.current,e.current=t}var Nt={},ce=Ct(Nt),ye=Ct(!1),Ut=Nt;function hn(e,t){var n=e.type.contextTypes;if(!n)return Nt;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 Oo(e,t,n){if(ce.current!==Nt)throw Error(S(168));A(ce,t),A(ye,n)}function Pu(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(S(108,xd(e)||"Unknown",l));return Q({},n,r)}function il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Nt,Ut=ce.current,A(ce,e),A(ye,ye.current),!0}function Ao(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=Pu(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 Lu(e){Je===null?Je=[e]:Je.push(e)}function If(e){El=!0,Lu(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?N=T:E.sibling=T,E=T,j=R}if(x===h.length)return n(v,j),B&&Dt(v,x),N;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?N=I:E.sibling=I,E=I,j=R}if(T.done)return n(v,j),B&&Dt(v,x),N;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?N=T:E.sibling=T,E=T);return B&&Dt(v,x),N}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?N=T:E.sibling=T,E=T);return e&&j.forEach(function(K){return t(v,K)}),B&&Dt(v,x),N}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 N=h.key,E=c;E!==null;){if(E.key===N){if(N=h.type,N===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===N||typeof N=="object"&&N!==null&&N.$$typeof===ut&&Bo(N)===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(Nn(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=zu(!0),Mu=zu(!1),al=Ct(null),ul=null,rn=null,Ps=null;function Ls(){Ps=rn=ul=null}function Rs(e){var t=al.current;V(al),e._currentValue=t}function Ui(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,Ps=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(Ps!==e)if(e={context:e,memoizedValue:t,next:null},rn===null){if(ul===null)throw Error(S(308));rn=e,ul.dependencies={lanes:0,firstContext:e}}else rn=rn.next=e;return t}var Ft=null;function Ds(e){Ft===null?Ft=[e]:Ft.push(e)}function Fu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ds(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 $s(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Iu(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,Ds(r)):(t.next=l.next,l.next=t),r.interleaved=t,rt(e,n)}function Br(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,ys(e,n)}}function Wo(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);Wt|=s,e.lanes=s,e.memoizedState=p}}function Ho(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 ec(){return De().memoizedState}function Vf(e,t,n){var r=kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},tc(e))nc(t,n);else if(n=Fu(e,t,n,r),n!==null){var l=fe();Ae(n,e,r,l),rc(n,t,r)}}function Bf(e,t,n){var r=kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(tc(e))nc(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,Ds(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Fu(e,t,l,r),n!==null&&(l=fe(),Ae(n,e,r,l),rc(n,t,r))}}function tc(e){var t=e.alternate;return e===H||t!==null&&t===H}function nc(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 rc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ys(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},Wf={readContext:Re,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Re,useEffect:Ko,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,Xu.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=Vf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Qo,useDebugValue:Vs,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Qo(!1),t=e[0];return e=Uf.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=He();if(B){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ne===null)throw Error(S(349));Bt&30||Vu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ko(Wu.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(B){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,pc(e,t,!1,!1),t.stateNode=e;e:{switch(s=ji(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&&!B)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=W.current,A(W,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Gs(),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(S(156,t.tag))}function Jf(e,t){switch(Cs(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),Fs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ms(t),null;case 13:if(V(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(W),null;case 4:return gn(),null;case 10:return Rs(t.type._context),null;case 22:case 23:return Gs(),null;case 24:return null;default:return null}}var Lr=!1,ue=!1,qf=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 Xi(e,t,n){try{n()}catch(r){G(e,t,r)}}var ra=!1;function bf(e,t){if(Di=el,e=wu(),_s(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($i={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(S(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=ra,ra=!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&&Xi(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 Zi(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 vc(e){var t=e.alternate;t!==null&&(e.alternate=null,vc(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[Fi],delete t[Mf],delete t[Ff])),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 gc(e){return e.tag===5||e.tag===3||e.tag===4}function la(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gc(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 Ji(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(Ji(e,t,n),e=e.sibling;e!==null;)Ji(e,t,n),e=e.sibling}function qi(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(qi(e,t,n),e=e.sibling;e!==null;)qi(e,t,n),e=e.sibling}var re=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)yc(e,t,n),n=n.sibling}function yc(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)&&Xi(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 ia(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qf),t.forEach(function(r){var l=ap.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*tp(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,vl=0,F&6)throw Error(S(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()-Qs?Ot(e,0):Hs|=n),we(e,t)}function Ec(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 op(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ec(e,n)}function ap(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(S(314))}r!==null&&r.delete(t),Ec(e,n)}var Cc;Cc=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,Xf(e,t,n);ge=!!(e.flags&131072)}else ge=!1,B&&t.flags&1048576&&Ru(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=Os(null,t,r,e,l,n);var i=As();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,$s(t),l.updater=Tl,t.stateNode=l,l._reactInternals=t,Bi(t,r,e,n),t=Qi(null,t,r,!0,i,n)):(t.tag=0,B&&i&&Es(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=cp(r),e=ze(r,e),l){case 0:t=Hi(null,t,r,e,n);break e;case 1:t=ea(null,t,r,e,n);break e;case 11:t=qo(null,t,r,e,n);break e;case 14:t=bo(null,t,r,ze(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Hi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ea(e,t,r,l,n);case 3:e:{if(cc(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Iu(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(S(423)),t),t=ta(e,t,r,n,l);break e}else if(r!==l){l=yn(Error(S(424)),t),t=ta(e,t,r,n,l);break e}else for(je=yt(t.stateNode.containerInfo.firstChild),Se=t,B=!0,Fe=null,n=Mu(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 Ou(t),e===null&&Ai(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,zi(r,l)?s=null:i!==null&&zi(r,i)&&(t.flags|=32),uc(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Ai(t),null;case 13:return dc(e,t,n);case 4:return zs(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),qo(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),Ui(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(S(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ui(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),bo(e,t,r,l,n);case 15:return oc(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),lc(t,r,l),Bi(t,r,l,n),Qi(null,t,r,!0,e,n);case 19:return fc(e,t,n);case 22:return ac(e,t,n)}throw Error(S(156,t.tag))};function Tc(e,t){return tu(e,t)}function up(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 up(e,t,n,r)}function Xs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cp(e){if(typeof e=="function")return Xs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===hs)return 11;if(e===ms)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")Xs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xt:return At(n.children,l,i,t);case ps:s=8,l|=8;break;case fi:return e=Pe(12,n,t,l|2),e.elementType=fi,e.lanes=i,e;case pi:return e=Pe(13,n,t,l),e.elementType=pi,e.lanes=i,e;case hi:return e=Pe(19,n,t,l),e.elementType=hi,e.lanes=i,e;case Oa:return Rl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fa:s=10;break e;case Ia:s=9;break e;case hs:s=11;break e;case ms:s=14;break e;case ut:s=16,r=null;break e}throw Error(S(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=Oa,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 dp(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=Bl(0),this.expirationTimes=Bl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Zs(e,t,n,r,l,i,s,a,u){return e=new dp(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},$s(i),e}function fp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dc)}catch(e){console.error(e)}}Dc(),Da.exports=_e;var $c=Da.exports,zc,pa=$c;zc=pa.createRoot,pa.hydrateRoot;const gp="modulepreload",yp=function(e){return"/"+e},ha={},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=yp(u),u in ha)return;ha[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":gp,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}})},Mc=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,xp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,rs={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(rs.nodes.map(e=>[e.id,e]));function Fc({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:[rs.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)),rs.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 wp({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Fc,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const eo="forebear:intro",kp=3e3,ma=2450;function jp(){try{return!!sessionStorage.getItem(eo)}catch{return!0}}function Sp(){try{sessionStorage.setItem(eo,"seen")}catch{}}function Np(){try{sessionStorage.removeItem(eo)}catch{}}function _p({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,Sp(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,ma),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),kp-ma+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(Fc,{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 Ep(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 va=["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."}},Ic={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 Cp(e){if(!e)return[];if(e.review==="confirmed"&&!va.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"&&va.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=Cp(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 Tp(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function to(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function no(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const Pp=["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} ${Pp[(n||1)-1]} ${t}`:String(e)}const Oc=e=>e?String(e).slice(0,4):"";function ga(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 Ac(e,t){const n=Lp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?ga(e,t):ga(t,e);return{relation:n<0?"before":"after",months:r,duration:Rp(r)}}function Uc(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 Rp(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 Dp=(e,t)=>e?t?`${e}#page=${t}`:e:null,$p={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 zp(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function Mp(e,t){const n=Qn[e];return n?zp(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 gh={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Fp={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"},Ip={product_family:{short:"FDA-listed · product family",tone:"muted",text:"The recall began before this clearance was decided, so it is not a recall of this cleared model: FDA lists the clearance as part of the recalled product family."},listed_only:{short:"FDA-listed · model not named",tone:"muted",text:"FDA lists this 510(k) on the recall, but the recall text does not name this device: the recalled model may be another one in the family."},model_named:{short:"FDA-listed · model named",tone:"other",text:"FDA lists this 510(k) on the recall and the recall text names this device."},unchecked:{short:"FDA-listed",tone:"other",text:"FDA lists this 510(k) on the recall; whether the recall text names this model could not be checked."}},yh={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 ya(e){return e!=null&&e.attribution?e.attribution:e!=null&&e.linked_before_clearance?"product_family":(e==null?void 0:e.link_name_check)==="match"?"model_named":(e==null?void 0:e.link_name_check)==="mismatch"?"listed_only":"unchecked"}const ui=70,zr=110,xa=46,Op=62,Ap=190,wa=300;function Up(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 Vp(e,{depth:t,descendants:n}){const r=new Map,l=Up(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)*ui)})}const y=a+u,k=y?Math.max(Ap,Math.min(wa,(t-zr*2)/y)):wa,L=Math.max(t,zr*2+y*k),v=zr+(L-(zr*2+y*k))/2,c=xa+Op+Math.max(1,g)*ui,h=xa+Math.max(1,g)*ui/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:h+p.get(j.k)}])),N=[...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:N,edges:r}}function Wp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Vp(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(N=>N.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),N=(h.x+w.x)/2,E=`M${h.x-12},${h.y} C${N},${h.y} ${N},${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:N-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=to(c),N=c.side==="self",E=N?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${N?" 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"&&!N&&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)," · ",Oc(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,ci=260,at=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Hp(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 Qp({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(()=>Hp(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-ci-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 N=m-p>24?4:m-p>12?2:1,E=[];for(let x=p;x<=m;x+=N)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)),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=to(T),Be=h.size&&!h.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-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-ci+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-ci-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 Vc({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 Kp({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 Bc({r:e}){const t=Tp(e),n=Ip[ya(e)];return o.jsxs("div",{className:"recall","data-attribution":ya(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.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 Gp({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(Yp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(Xp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function ls({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 Yp({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(ls,{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(Kp,{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:Ic[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(Vc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:Dp(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:$p[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 Xp({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(ls,{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=no(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:Mc(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(Bc,{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 Zp={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 Wc(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 Jp({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Wc(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=>Ic[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})," · ",Zp[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 ro(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 is(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 qp({a:e}){const t=e.device,n=ro(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=is(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=is(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Ac(s.initiated,t.decision_date):null,d=no(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"]}):Uc(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 bp({a:e,onSelect:t}){const n=ro(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=is(s,e.device.decision_date),u=a?Ac(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?to({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"}),Uc(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[no(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function eh({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),[N,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],...Mp(r.verdict,I.evidence)},me=Wc(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 ",Ue(T.decision_date)]}),o.jsx("span",{children:T.clearance_type||"510(k)"}),o.jsx("a",{href:Mc(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(qp,{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:Fp[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(bp,{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(Wp,{a:r,depth:p,onDepth:m,descendants:k,selected:v,onSelect:c,focusChain:h}):o.jsx(Qp,{a:r,depth:p,highlight:h||((Xe=ro(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(Jp,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(th,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(rh,{a:r,reload:R,go:t,onSelect:c}),o.jsx(lh,{a:r,onSaved:()=>{Ie.assessments(e).then(E),n&&n()}}),o.jsx(ih,{a:r,assessments:N,runs:j,go:t})]})]}),v&&o.jsx(Gp,{sel:v,a:r,onClose:()=>c(null),go:(M,C)=>{c(null),t(M,C)},reload:R,onSelect:c})]})}function th({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(nh,{s:r,onSelect:t},l))]})}function nh({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(Bc,{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 rh({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)," · ",Oc(d.dst_decision_date)]})]}),o.jsx(Vc,{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 lh({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 ih({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:xp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function sh({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 oh={compare:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>zt(()=>import("./History-CPQprqBL.js"),[])),method:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.MethodView})))},ah={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"})},uh=({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:ah[e]}),ch=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function dh({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=oh[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(wp,{size:24})}),o.jsx(fh,{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:[ch.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(uh,{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(eh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(sh,{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 fh({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 ph=_.lazy(()=>zt(()=>import("./Landing-D8mpPU0X.js"),[])),hh={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:hh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const mh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function vh(){const[e,t]=_.useState(Fr),[n,r]=_.useState(null),[l,i]=_.useState(null),s=Ep("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!jp()&&!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=mh(y,k),c=()=>{history.pushState(null,"",v),t(Fr(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>$c.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Fr());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Np(),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(_p,{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(ph,{go:m,stats:n,introDone:d,reduced:s})}):o.jsx(dh,{route:e,go:m,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}zc(document.getElementById("root")).render(o.jsx(vh,{}));export{Ip as A,gh as E,Fc as M,wl as R,yh as T,Qn as V,wp as W,zt as _,Fp as a,Ie as b,xp as c,Ue as f,o as j,ga as m,Dp as p,_ as r,Ep as u,Mp as v}; diff --git a/web/dist/index.html b/web/dist/index.html index b7bbfa5..be5336d 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -7,7 +7,7 @@ - + From 9f856524e45425bf4225d76aad32929f403e19d4 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:12:05 +0100 Subject: [PATCH 11/14] fix: report recall name checks as heuristic matches kept apart from recall timing --- forebear/investigation/tools.py | 5 ++-- forebear/lineage.py | 38 ++++++++++++++++----------- tests/test_evidence_integrity.py | 44 ++++++++++++++++++++++---------- 3 files changed, 57 insertions(+), 30 deletions(-) diff --git a/forebear/investigation/tools.py b/forebear/investigation/tools.py index cd11c66..2f24246 100644 --- a/forebear/investigation/tools.py +++ b/forebear/investigation/tools.py @@ -300,8 +300,9 @@ def t_get_recall(g: Graph, args: dict, ctx: RunContext) -> dict: "initiated": x.get("initiated"), "status": x.get("status"), "firm": x.get("firm"), "url": x.get("url"), "untrusted_reason": untrusted(x.get("reason"), 400), "untrusted_product": untrusted(x.get("product"), 300), "linked_devices": devs[:20], "linked_devices_total": len(devs), - "note": "Device links are FDA's own k_numbers on the recall record; link_name_check says whether the " - "product text names the device."} + "note": "Device links are FDA's own k_numbers on the recall record: an association, not verified model " + "identity. link_name_check is a fuzzy heuristic (one distinctive word of the FDA device name found " + "in the recall text), not proof the recall names that exact model."} def t_recall_reach(g: Graph, args: dict, ctx: RunContext) -> dict: diff --git a/forebear/lineage.py b/forebear/lineage.py index af52fa9..f8043a4 100644 --- a/forebear/lineage.py +++ b/forebear/lineage.py @@ -26,25 +26,29 @@ def _recall_ev(x: dict) -> dict: "attribution": recall_attribution(x)} +ATTRIBUTION_CODES = ("name_token_match", "name_token_absent", "name_not_checkable") + + def recall_attribution(x: dict) -> str: - """How a recall record is tied to the 510(k) it is linked to. The link itself is always FDA's: openFDA lists the - clearance's K-number on the recall record. That is an association, not proof that this cleared model was recalled. - - product_family the recall began before this clearance was decided, so the clearance cannot be the recalled - product as cleared; FDA lists later clearances of the same product family on older recalls - model_named the recall's product/reason text names this device - listed_only FDA lists the K-number, but the recall text does not name this device (the recalled model may - be another one in the family) - unchecked FDA lists the K-number; the device's FDA name has no distinctive token to check - """ - if x.get("linked_before_clearance"): - return "product_family" + """What the recall-text name heuristic says about a recall record linked to a 510(k). The link itself is always + FDA's: openFDA lists the clearance's K-number on the recall record. That is an association; nothing here verifies + which model was recalled. + + name_token_match a distinctive word of the device's FDA name appears in the recall's product/reason text + (evidence.name_check: exact, spacing- or OCR-normalised, or within a small edit distance). + One fuzzy token is a heuristic signal, not proof that the recall names this exact model. + name_token_absent no distinctive word of the FDA name was found; the recalled model may differ, or the text + may name it differently + name_not_checkable the FDA name has no distinctive word to look for, or no check was recorded + + Timing is deliberately not part of this code: `linked_before_clearance` (the recall began before this clearance + was decided) is reported on its own and does not by itself establish whether this model was affected.""" nc = x.get("link_name_check") if nc == "match": - return "model_named" + return "name_token_match" if nc == "mismatch": - return "listed_only" - return "unchecked" + return "name_token_absent" + return "name_not_checkable" def _count(recs: list[dict]) -> str: @@ -443,8 +447,12 @@ def classify_reach(recalled: list[dict], desc: list[dict]) -> dict: x = {"link_name_check": "match" if "match" in (d.get("name_checks") or []) else "mismatch" if "mismatch" in (d.get("name_checks") or []) else None, "linked_before_clearance": bool(d.get("before_clearance"))} + # the device can be on several records of the event: 'name_token_match' if the heuristic matched on any of + # them, and every record's own result is kept in name_checks recalled_out.append({"k": d["k"], "name": d["name"], "decision_date": d.get("decision_date"), "initiated": start[d["k"]], "records": d.get("records"), + "name_checks": sorted(c for c in d.get("name_checks") or [] if c), + "linked_before_clearance": x["linked_before_clearance"], "attribution": recall_attribution(x)}) return {"initiated": _earliest(start.values()), "recalled": recalled_out, "descendants": out, "counts": counts} diff --git a/tests/test_evidence_integrity.py b/tests/test_evidence_integrity.py index f21a694..0150d27 100644 --- a/tests/test_evidence_integrity.py +++ b/tests/test_evidence_integrity.py @@ -1,13 +1,14 @@ """Regression tests for the evidence-integrity fixes: compare keeps coverage, recall reach classifies timing per supported / conditional route with date boundaries, the watchlist compares clearance dates and tracks the supported -generation, and recall links say whether they are FDA-listed associations or name the recalled model.""" +generation, and recall links are FDA-listed associations whose name check is a heuristic, never verified model +identity.""" import importlib import pytest from conftest import build_tiny, cite, dev, recall from fastapi.testclient import TestClient -from forebear.lineage import assess, classify_reach, compare, date_relation, recall_attribution, recall_reach +from forebear.lineage import ATTRIBUTION_CODES, assess, classify_reach, compare, date_relation, recall_attribution, recall_reach def _unresolve(g, src, dst): @@ -123,7 +124,7 @@ def test_watchlist_compares_clearance_dates_not_receipt(tiny_client): r = rows["K000003"] # cleared 2010-06-01, recall began 2008-04-01 assert r["timing"] == "after" and r["recall_basis"] == "2008-04-01" and r["days_after_recall"] == 791 assert "receipt date is not a citation date" in w["compared"] - assert all(x["attribution"] in ("product_family", "model_named", "listed_only", "unchecked") + assert all(x["attribution"] in ATTRIBUTION_CODES for row in w["rows"] for x in row["recalls"]) @@ -175,26 +176,43 @@ def test_compare_regression_K012323_vs_K014074(real_copy): # ---------------------------------------------------------------- recall attribution @pytest.mark.parametrize("link,want", [ - ({"linked_before_clearance": True, "link_name_check": "match"}, "product_family"), - ({"linked_before_clearance": False, "link_name_check": "match"}, "model_named"), - ({"linked_before_clearance": False, "link_name_check": "mismatch"}, "listed_only"), - ({"link_name_check": "n/a"}, "unchecked"), - ({}, "unchecked"), + ({"linked_before_clearance": False, "link_name_check": "match"}, "name_token_match"), + ({"linked_before_clearance": False, "link_name_check": "mismatch"}, "name_token_absent"), + ({"link_name_check": "n/a"}, "name_not_checkable"), + ({}, "name_not_checkable"), + # an earlier recall start is reported on its own; it never decides the attribution code + ({"linked_before_clearance": True, "link_name_check": "match"}, "name_token_match"), + ({"linked_before_clearance": True, "link_name_check": "mismatch"}, "name_token_absent"), + ({"linked_before_clearance": True}, "name_not_checkable"), ]) -def test_recall_attribution(link, want): +def test_recall_attribution_is_a_name_heuristic_only(link, want): assert recall_attribution(link) == want -def test_assessment_recall_evidence_carries_attribution(tmp_path): +def test_no_attribution_code_claims_model_identity(): + for code in ATTRIBUTION_CODES: + assert "model" not in code and "family" not in code and "named" not in code + + +def test_assessment_recall_evidence_keeps_timing_apart_from_attribution(tmp_path): g = build_tiny(tmp_path / "a.rl") try: - # FDA lists K000003 on a recall that began before K000003 was cleared: a product-family association + # FDA lists K000003 on a recall that began before K000003 was cleared, and the name heuristic found no token r = recall("Z-0002-2009", ["K000003"], "2009-01-01", event="2") r["links"] = [{"k": "K000003", "name_check": "mismatch", "before_clearance": True}] g.upsert_recalls([r]) a = assess(g, "K000004") ev = {e["id"]: e for s in a["signals"] for e in s["evidence"] if e.get("type") == "recall"} - assert ev["Z-0002-2009"]["attribution"] == "product_family" - assert ev["Z-0001-2008"]["attribution"] == "unchecked" + assert ev["Z-0002-2009"]["attribution"] == "name_token_absent" + assert ev["Z-0002-2009"]["linked_before_clearance"] is True + assert ev["Z-0001-2008"]["attribution"] == "name_not_checkable" finally: g.close() + + +def test_reach_recalled_holders_keep_per_record_name_checks(): + r = classify_reach([{"k": "KA", "name": "A", "initiated": "2020-01-01", "records": 2, + "name_checks": ["match", "mismatch"], "before_clearance": True}], []) + x = r["recalled"][0] + assert x["attribution"] == "name_token_match" and x["name_checks"] == ["match", "mismatch"] + assert x["linked_before_clearance"] is True From 50ed9ee64a7f7b013ede3bf68b5f3d43c0b2d7f2 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:14:42 +0100 Subject: [PATCH 12/14] fix: label recall name checks as heuristic and earlier recall dates as inconclusive in the UI --- web/src/evidence.js | 28 ++++++++++++++++------------ web/src/workspace/Provenance.jsx | 5 ++++- web/src/workspace/Views.jsx | 19 +++++++++++++------ 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/web/src/evidence.js b/web/src/evidence.js index f179183..c472b35 100644 --- a/web/src/evidence.js +++ b/web/src/evidence.js @@ -181,16 +181,21 @@ export const EVIDENCE_REASON_TEXT = { shallow_traversal: 'grand-predicates were not traversed', } -/** Mirror of lineage.recall_attribution(): how FDA's recall record is tied to the clearance it lists. */ +/** Mirror of lineage.recall_attribution(). Every link is FDA's own listing of the K-number on the recall record: an + association, never verified model identity. The code only reports the fuzzy name heuristic (evidence.name_check). */ export const ATTRIBUTION = { - product_family: { short: 'FDA-listed · product family', tone: 'muted', - text: 'The recall began before this clearance was decided, so it is not a recall of this cleared model: FDA lists the clearance as part of the recalled product family.' }, - listed_only: { short: 'FDA-listed · model not named', tone: 'muted', - text: 'FDA lists this 510(k) on the recall, but the recall text does not name this device: the recalled model may be another one in the family.' }, - model_named: { short: 'FDA-listed · model named', tone: 'other', - text: 'FDA lists this 510(k) on the recall and the recall text names this device.' }, - unchecked: { short: 'FDA-listed', tone: 'other', - text: 'FDA lists this 510(k) on the recall; whether the recall text names this model could not be checked.' }, + 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.' }, +} + +/** Caveat for a recall that began before the clearance it is listed on. Dates alone do not settle whether the model was affected. */ +export const PREDATES_CLEARANCE = { + 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.', } /** Recall reach timing (lineage.date_relation) as display text. */ @@ -202,7 +207,6 @@ export const TIMING_TEXT = { } export function recallAttribution(r) { - if (r?.attribution) return r.attribution - if (r?.linked_before_clearance) return 'product_family' - return r?.link_name_check === 'match' ? 'model_named' : r?.link_name_check === 'mismatch' ? 'listed_only' : 'unchecked' + if (r?.attribution && ATTRIBUTION[r.attribution]) return r.attribution + return r?.link_name_check === 'match' ? 'name_token_match' : r?.link_name_check === 'mismatch' ? 'name_token_absent' : 'name_not_checkable' } diff --git a/web/src/workspace/Provenance.jsx b/web/src/workspace/Provenance.jsx index 1ff68f1..5803286 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, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, pdfAt, recallAttribution, recallTone, shortName, + ATTRIBUTION, DOUBT_TEXT, PREDATES_CLEARANCE, EDGE_STATUS, TEXT_SOURCE, countEvents, edgeStatus, fmtDate, pdfAt, recallAttribution, recallTone, shortName, } from '../evidence.js' /* Highlight the cited K-number inside the verbatim quote. */ @@ -32,6 +32,9 @@ export function RecallCard({ r }) { {r.url && FDA record ↗}
{att.short} {att.text}
+ {r.linked_before_clearance && ( +
{PREDATES_CLEARANCE.short}{' '} + {PREDATES_CLEARANCE.text}
)} {r.reason &&
{r.reason}
} {r.status &&
Status: {r.status}{r.event ? ` · event ${r.event}` : ''}{r.firm ? ` · ${r.firm}` : ''}
} diff --git a/web/src/workspace/Views.jsx b/web/src/workspace/Views.jsx index 3b37aa7..f7684ba 100644 --- a/web/src/workspace/Views.jsx +++ b/web/src/workspace/Views.jsx @@ -1,6 +1,8 @@ import React, { useEffect, useMemo, useState } from 'react' import { api } from '../api.js' -import { ATTRIBUTION, EVIDENCE_REASON_TEXT, EVIDENCE_TONE, TIMING_TEXT, fmtDate, verdictView } from '../evidence.js' +import { + ATTRIBUTION, EVIDENCE_REASON_TEXT, EVIDENCE_TONE, PREDATES_CLEARANCE, TIMING_TEXT, fmtDate, recallAttribution, verdictView, +} from '../evidence.js' const Head = ({ eyebrow, title, children }) => (

{eyebrow}

{title}

{children &&

{children}

}
@@ -118,10 +120,13 @@ export function ReachView({ initial, go }) {
{(c.same_day || 0) + (c.unknown || 0)}timing not determinable ({c.same_day || 0} same day, {c.unknown || 0} missing a date)
)}
{data.recalled.map((r) => ( - ))}
-

FDA lists these clearances on the recall record. That is an association: it does not by itself - mean the listed model, as cleared, is the recalled product.

+ ))} +

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.

{groups.filter(([, , rows, , always]) => always || rows.length).map(([id, title, rows, hint], i) => ( @@ -217,7 +222,9 @@ export function WatchlistView({ go }) { {r.recall_count > 2 &&
{r.recall_count} recall routes; first two:
}{r.recalls.slice(0, 2).map((x) => (
{x.recall_id} · {x.classification || 'unclassified'} · {x.root_cause} · {fmtDate(x.initiated)} {x.conditional && · conditional} -
{x.ancestor}: {ATTRIBUTION[x.attribution]?.short}
))} +
{x.ancestor}: {ATTRIBUTION[recallAttribution(x)].short} + {x.linked_before_clearance ? ` · ${PREDATES_CLEARANCE.short.toLowerCase()}` : ''}
))} ))} From cb0869f3994915834a73713dd0fd2e8ae19b0c08 Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:14:42 +0100 Subject: [PATCH 13/14] test: cover heuristic name-match and predating-recall wording in Playwright --- web/e2e/evidence-integrity.spec.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/web/e2e/evidence-integrity.spec.js b/web/e2e/evidence-integrity.spec.js index 74392c4..d88b6f8 100644 --- a/web/e2e/evidence-integrity.spec.js +++ b/web/e2e/evidence-integrity.spec.js @@ -52,7 +52,8 @@ test.describe('recall reach timing', () => { }) const body = { event: '1', initiated: '2010-01-01', - recalled: [{ k: 'K100001', name: 'A', decision_date: '2005-01-01', initiated: '2020-01-01', records: 1, attribution: 'listed_only' }], + recalled: [{ k: 'K100001', name: 'A', decision_date: '2005-01-01', initiated: '2020-01-01', records: 1, attribution: 'name_token_absent', linked_before_clearance: false }, + { k: 'K100002', name: 'B', decision_date: '2012-01-01', initiated: '2010-01-01', records: 1, attribution: 'name_token_match', linked_before_clearance: true }], counts: { after_supported: 1, after_conditional: 1, before: 1, same_day: 1, unknown: 1, conditional: 1, mixed: 1 }, descendants: [ d('K200001', '2021-01-01', 'after', 'supported'), @@ -75,7 +76,13 @@ test.describe('recall reach timing', () => { await expect(mixed).toContainText('mixed routes') await expect(mixed).toContainText('Conditional route only') await expect(page.getByTestId('reach-count-undetermined')).toContainText('1 same day, 1 missing a date') - await expect(page.getByTestId('reach-stats')).toContainText('model not named') + const holders = page.getByTestId('reach-holder') + await expect(holders.nth(0)).toContainText('name not found (heuristic)') + await expect(holders.nth(1)).toContainText('name match (heuristic)') + await expect(holders.nth(1)).toContainText('recall began before this clearance') + await expect(holders.nth(1)).toHaveAttribute('title', /does not verify that the recall names this exact model/) + await expect(holders.nth(1)).toHaveAttribute('title', /dates alone do not establish whether this cleared model was affected/) + await expect(page.getByTestId('reach-stats')).toContainText('not verified model identity') }) }) @@ -100,6 +107,23 @@ test.describe('recall attribution', () => { await page.locator('.g-node[data-k="K113053"]').click() const drawer = page.getByTestId('provenance') await expect(drawer).toContainText('Recall records on which FDA lists this 510(k)') - await expect(drawer.locator('.recall[data-attribution]').first()).toContainText('FDA-listed') + const card = drawer.locator('.recall[data-attribution]').first() + await expect(card).toContainText('FDA-listed') + await expect(card).toContainText(/name (match|not found) \(heuristic\)|name not checked/) + await expect(drawer).not.toContainText(/model named|product family/i) + }) + + test('a recall that predates the clearance is a caveat, not a conclusion', async ({ page }) => { + await page.route('**/api/assess/K252078*', async (route) => { + const a = await (await route.fetch()).json() + const holder = a.ancestors.find((x) => x.k === 'K113053') + holder.recalls = holder.recalls.map((r, i) => (i === 0 ? { ...r, linked_before_clearance: true, link_name_check: 'match' } : r)) + await route.fulfill({ json: a }) + }) + await page.goto('/#/check/K252078') + await page.locator('.g-node[data-k="K113053"]').click() + const caveat = page.getByTestId('provenance').getByTestId('recall-predates').first() + await expect(caveat).toContainText('Recall began before this clearance') + await expect(caveat).toContainText('do not establish whether this cleared model was affected') }) }) From c4cfbde4ff8356d6f03f76de81f6570ed92d9c2d Mon Sep 17 00:00:00 2001 From: Asembris Date: Mon, 23 Nov 2026 13:14:43 +0100 Subject: [PATCH 14/14] build: rebuild web/dist for heuristic recall attribution labels --- ...istory-CPQprqBL.js => History-o7tife4Q.js} | 2 +- ...anding-D8mpPU0X.js => Landing-Do6WwSBM.js} | 2 +- web/dist/assets/Views-BGuMRYVR.js | 1 + web/dist/assets/Views-DadbQpl8.js | 1 - web/dist/assets/index-58YBiS_r.js | 44 +++++++++++++++++++ web/dist/assets/index-a5px9_EI.js | 44 ------------------- web/dist/index.html | 2 +- 7 files changed, 48 insertions(+), 48 deletions(-) rename web/dist/assets/{History-CPQprqBL.js => History-o7tife4Q.js} (98%) rename web/dist/assets/{Landing-D8mpPU0X.js => Landing-Do6WwSBM.js} (99%) create mode 100644 web/dist/assets/Views-BGuMRYVR.js delete mode 100644 web/dist/assets/Views-DadbQpl8.js create mode 100644 web/dist/assets/index-58YBiS_r.js delete mode 100644 web/dist/assets/index-a5px9_EI.js diff --git a/web/dist/assets/History-CPQprqBL.js b/web/dist/assets/History-o7tife4Q.js similarity index 98% rename from web/dist/assets/History-CPQprqBL.js rename to web/dist/assets/History-o7tife4Q.js index 1f49b8c..2ff8d88 100644 --- a/web/dist/assets/History-CPQprqBL.js +++ b/web/dist/assets/History-o7tife4Q.js @@ -1 +1 @@ -import{r as i,j as e,V as p,c as b,b as j}from"./index-a5px9_EI.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-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}; diff --git a/web/dist/assets/Landing-D8mpPU0X.js b/web/dist/assets/Landing-Do6WwSBM.js similarity index 99% rename from web/dist/assets/Landing-D8mpPU0X.js rename to web/dist/assets/Landing-Do6WwSBM.js index eb9a3e1..1b1b8f1 100644 --- a/web/dist/assets/Landing-D8mpPU0X.js +++ b/web/dist/assets/Landing-Do6WwSBM.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-a5px9_EI.js";import{u as se}from"./index-a5px9_EI.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-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}; diff --git a/web/dist/assets/Views-BGuMRYVR.js b/web/dist/assets/Views-BGuMRYVR.js new file mode 100644 index 0000000..2d18b50 --- /dev/null +++ b/web/dist/assets/Views-BGuMRYVR.js @@ -0,0 +1 @@ +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-DadbQpl8.js b/web/dist/assets/Views-DadbQpl8.js deleted file mode 100644 index f1c7162..0000000 --- a/web/dist/assets/Views-DadbQpl8.js +++ /dev/null @@ -1 +0,0 @@ -import{r as h,j as e,v as _,f as v,E as C,a as D,A as N,b as f,T as w}from"./index-a5px9_EI.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})]}),y=c=>r=>{r.key==="Enter"&&c()};function A({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),f.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=_(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:y(()=>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-${C[a.evidence]||"muted"}`,"data-testid":"compare-evidence",children:a.evidence}),(a.evidence_reasons||[]).map(i=>e.jsx("div",{className:"sub",children:D[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 F({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),f.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=>{var i,j;return e.jsxs("button",{className:"tag-btn",onClick:()=>r("check",n.k),title:(i=N[n.attribution])==null?void 0:i.text,children:[e.jsx("span",{className:"k",children:n.k})," ",n.name," ",e.jsxs("span",{className:"muted",children:["· ",(j=N[n.attribution])==null?void 0:j.short]})]},n.k)})}),e.jsx("p",{className:"muted small",style:{marginBottom:0},children:"FDA lists these clearances on the recall record. That is an association: it does not by itself mean the listed model, as cleared, is the recalled product."})]}),e.jsx("section",{className:"panel",children:a.filter(([,,n,,i])=>i||n.length).map(([n,i,j,g],k)=>e.jsxs("div",{"data-testid":`reach-${n}`,children:[e.jsxs("div",{className:"panel-head",style:k?{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:y(()=>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:w[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),", ",w[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 R({go:c}){const[r,t]=h.useState(null),[o,d]=h.useState(null),[m,p]=h.useState("all");h.useEffect(()=>{f.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:y(()=>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=>{var n,i;return 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:(n=N[a.attribution])==null?void 0:n.text,"data-testid":"watch-attribution",children:[a.ancestor,": ",(i=N[a.attribution])==null?void 0:i.short]})]},a.recall_id+a.ancestor)})]})]},s.k))})]})})})]})}function T({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 f.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 I({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{A as CompareView,T as IngestView,I as MethodView,F as ReachView,R as WatchlistView}; diff --git a/web/dist/assets/index-58YBiS_r.js b/web/dist/assets/index-58YBiS_r.js new file mode 100644 index 0000000..b4dba1a --- /dev/null +++ b/web/dist/assets/index-58YBiS_r.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 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-a5px9_EI.js b/web/dist/assets/index-a5px9_EI.js deleted file mode 100644 index d1796e7..0000000 --- a/web/dist/assets/index-a5px9_EI.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 Hc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ka={exports:{}},xl={},ja={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"),Qc=Symbol.for("react.portal"),Kc=Symbol.for("react.fragment"),Gc=Symbol.for("react.strict_mode"),Yc=Symbol.for("react.profiler"),Xc=Symbol.for("react.provider"),Zc=Symbol.for("react.context"),Jc=Symbol.for("react.forward_ref"),qc=Symbol.for("react.suspense"),bc=Symbol.for("react.memo"),ed=Symbol.for("react.lazy"),lo=Symbol.iterator;function td(e){return e===null||typeof e!="object"?null:(e=lo&&e[lo]||e["@@iterator"],typeof e=="function"?e:null)}var Sa={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Na=Object.assign,_a={};function kn(e,t,n){this.props=e,this.context=t,this.refs=_a,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 Ea(){}Ea.prototype=kn.prototype;function ss(e,t,n){this.props=e,this.context=t,this.refs=_a,this.updater=n||Sa}var os=ss.prototype=new Ea;os.constructor=ss;Na(os,kn.prototype);os.isPureReactComponent=!0;var io=Array.isArray,Ca=Object.prototype.hasOwnProperty,as={current:null},Ta={key:!0,ref:!0,__self:!0,__source:!0};function Pa(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)Ca.call(t,r)&&!Ta.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(N);else{var D=n(d);D!==null&&M(w,D.startTime-C)}}function N(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(N))),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=$}}}})(za);$a.exports=za;var fd=$a.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 pd=_,Ne=fd;function S(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"),di=Object.prototype.hasOwnProperty,hd=/^[: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]*$/,oo={},ao={};function md(e){return di.call(ao,e)?!0:di.call(oo,e)?!1:hd.test(e)?ao[e]=!0:(oo[e]=!0,!1)}function vd(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 gd(e,t,n,r){if(t===null||typeof t>"u"||vd(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 cs=/[\-:]([a-z])/g;function ds(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(cs,ds);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(cs,ds);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(cs,ds);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 fs(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 yd(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 mi(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 fi:return"Profiler";case ps:return"StrictMode";case pi:return"Suspense";case hi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ia:return(e.displayName||"Context")+".Consumer";case Fa:return(e._context.displayName||"Context")+".Provider";case hs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ms:return t=e.displayName||null,t!==null?t:mi(e.type)||"Memo";case ut:t=e._payload,e=e._init;try{return mi(e(t))}catch{}}return null}function xd(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 mi(t);case 8:return t===ps?"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 Aa(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wd(e){var t=Aa(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=wd(e))}function Ua(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Aa(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 vi(e,t){var n=t.checked;return Q({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function co(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 Va(e,t){t=t.checked,t!=null&&fs(e,"checked",t,!1)}function gi(e,t){Va(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")?yi(e,t.type,n):t.hasOwnProperty("defaultValue")&&yi(e,t.type,St(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fo(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 yi(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},kd=["Webkit","ms","Moz","O"];Object.keys(Fn).forEach(function(e){kd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fn[t]=Fn[e]})});function Qa(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 Ka(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Qa(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var jd=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 ki(e,t){if(t){if(jd[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function ji(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 vs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ni=null,an=null,un=null;function mo(e){if(e=fr(e)){if(typeof Ni!="function")throw Error(S(280));var t=e.stateNode;t&&(t=_l(t),Ni(e.stateNode,e.type,t))}}function Ga(e){an?un?un.push(e):un=[e]:an=e}function Ya(){if(an){var e=an,t=un;if(un=an=null,mo(e),t)for(e=0;e>>=0,e===0?32:31-($d(e)/zd|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 Od(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),No=" ",_o=!1;function hu(e,t){switch(e){case"keyup":return pf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Zt=!1;function mf(e,t){switch(e){case"compositionend":return mu(t);case"keypress":return t.which!==32?null:(_o=!0,No);case"textInput":return e=t.data,e===No&&_o?null:e;default:return null}}function vf(e,t){if(Zt)return e==="compositionend"||!Ns&&hu(e,t)?(e=fu(),Ur=ks=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=Po(n)}}function xu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wu(){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 _s(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 _f(e){var t=wu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xu(n.ownerDocument.documentElement,n)){if(r!==null&&_s(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=Lo(n,i);var s=Lo(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,Li=null,Un=null,Ri=!1;function Ro(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ri||Jt==null||Jt!==Xr(r)||(r=Jt,"selectionStart"in r&&_s(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(Li,"onSelect"),0en||(e.current=Ii[en],Ii[en]=null,en--)}function A(e,t){en++,Ii[en]=e.current,e.current=t}var Nt={},ce=Ct(Nt),ye=Ct(!1),Ut=Nt;function hn(e,t){var n=e.type.contextTypes;if(!n)return Nt;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 Oo(e,t,n){if(ce.current!==Nt)throw Error(S(168));A(ce,t),A(ye,n)}function Pu(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(S(108,xd(e)||"Unknown",l));return Q({},n,r)}function il(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Nt,Ut=ce.current,A(ce,e),A(ye,ye.current),!0}function Ao(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=Pu(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 Lu(e){Je===null?Je=[e]:Je.push(e)}function If(e){El=!0,Lu(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?N=T:E.sibling=T,E=T,j=R}if(x===h.length)return n(v,j),B&&Dt(v,x),N;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?N=I:E.sibling=I,E=I,j=R}if(T.done)return n(v,j),B&&Dt(v,x),N;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?N=T:E.sibling=T,E=T);return B&&Dt(v,x),N}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?N=T:E.sibling=T,E=T);return e&&j.forEach(function(K){return t(v,K)}),B&&Dt(v,x),N}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 N=h.key,E=c;E!==null;){if(E.key===N){if(N=h.type,N===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===N||typeof N=="object"&&N!==null&&N.$$typeof===ut&&Bo(N)===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(Nn(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=zu(!0),Mu=zu(!1),al=Ct(null),ul=null,rn=null,Ps=null;function Ls(){Ps=rn=ul=null}function Rs(e){var t=al.current;V(al),e._currentValue=t}function Ui(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,Ps=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(Ps!==e)if(e={context:e,memoizedValue:t,next:null},rn===null){if(ul===null)throw Error(S(308));rn=e,ul.dependencies={lanes:0,firstContext:e}}else rn=rn.next=e;return t}var Ft=null;function Ds(e){Ft===null?Ft=[e]:Ft.push(e)}function Fu(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ds(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 $s(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Iu(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,Ds(r)):(t.next=l.next,l.next=t),r.interleaved=t,rt(e,n)}function Br(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,ys(e,n)}}function Wo(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);Wt|=s,e.lanes=s,e.memoizedState=p}}function Ho(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 ec(){return De().memoizedState}function Vf(e,t,n){var r=kt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},tc(e))nc(t,n);else if(n=Fu(e,t,n,r),n!==null){var l=fe();Ae(n,e,r,l),rc(n,t,r)}}function Bf(e,t,n){var r=kt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(tc(e))nc(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,Ds(t)):(l.next=u.next,u.next=l),t.interleaved=l;return}}catch{}finally{}n=Fu(e,t,l,r),n!==null&&(l=fe(),Ae(n,e,r,l),rc(n,t,r))}}function tc(e){var t=e.alternate;return e===H||t!==null&&t===H}function nc(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 rc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ys(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},Wf={readContext:Re,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Re,useEffect:Ko,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,Xu.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=Vf.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Qo,useDebugValue:Vs,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Qo(!1),t=e[0];return e=Uf.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=H,l=He();if(B){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ne===null)throw Error(S(349));Bt&30||Vu(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ko(Wu.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(B){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,pc(e,t,!1,!1),t.stateNode=e;e:{switch(s=ji(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&&!B)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=W.current,A(W,r?n&1|2:n&1),t):(oe(t),null);case 22:case 23:return Gs(),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(S(156,t.tag))}function Jf(e,t){switch(Cs(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),Fs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ms(t),null;case 13:if(V(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));mn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(W),null;case 4:return gn(),null;case 10:return Rs(t.type._context),null;case 22:case 23:return Gs(),null;case 24:return null;default:return null}}var Lr=!1,ue=!1,qf=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 Xi(e,t,n){try{n()}catch(r){G(e,t,r)}}var ra=!1;function bf(e,t){if(Di=el,e=wu(),_s(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($i={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(S(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=ra,ra=!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&&Xi(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 Zi(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 vc(e){var t=e.alternate;t!==null&&(e.alternate=null,vc(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[Fi],delete t[Mf],delete t[Ff])),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 gc(e){return e.tag===5||e.tag===3||e.tag===4}function la(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gc(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 Ji(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(Ji(e,t,n),e=e.sibling;e!==null;)Ji(e,t,n),e=e.sibling}function qi(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(qi(e,t,n),e=e.sibling;e!==null;)qi(e,t,n),e=e.sibling}var re=null,Me=!1;function ot(e,t,n){for(n=n.child;n!==null;)yc(e,t,n),n=n.sibling}function yc(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)&&Xi(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 ia(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qf),t.forEach(function(r){var l=ap.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*tp(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,vl=0,F&6)throw Error(S(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()-Qs?Ot(e,0):Hs|=n),we(e,t)}function Ec(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 op(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ec(e,n)}function ap(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(S(314))}r!==null&&r.delete(t),Ec(e,n)}var Cc;Cc=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,Xf(e,t,n);ge=!!(e.flags&131072)}else ge=!1,B&&t.flags&1048576&&Ru(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=Os(null,t,r,e,l,n);var i=As();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,$s(t),l.updater=Tl,t.stateNode=l,l._reactInternals=t,Bi(t,r,e,n),t=Qi(null,t,r,!0,i,n)):(t.tag=0,B&&i&&Es(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=cp(r),e=ze(r,e),l){case 0:t=Hi(null,t,r,e,n);break e;case 1:t=ea(null,t,r,e,n);break e;case 11:t=qo(null,t,r,e,n);break e;case 14:t=bo(null,t,r,ze(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),Hi(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:ze(r,l),ea(e,t,r,l,n);case 3:e:{if(cc(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Iu(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(S(423)),t),t=ta(e,t,r,n,l);break e}else if(r!==l){l=yn(Error(S(424)),t),t=ta(e,t,r,n,l);break e}else for(je=yt(t.stateNode.containerInfo.firstChild),Se=t,B=!0,Fe=null,n=Mu(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 Ou(t),e===null&&Ai(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,zi(r,l)?s=null:i!==null&&zi(r,i)&&(t.flags|=32),uc(e,t),de(e,t,s,n),t.child;case 6:return e===null&&Ai(t),null;case 13:return dc(e,t,n);case 4:return zs(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),qo(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),Ui(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(S(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ui(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),bo(e,t,r,l,n);case 15:return oc(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),lc(t,r,l),Bi(t,r,l,n),Qi(null,t,r,!0,e,n);case 19:return fc(e,t,n);case 22:return ac(e,t,n)}throw Error(S(156,t.tag))};function Tc(e,t){return tu(e,t)}function up(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 up(e,t,n,r)}function Xs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function cp(e){if(typeof e=="function")return Xs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===hs)return 11;if(e===ms)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")Xs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xt:return At(n.children,l,i,t);case ps:s=8,l|=8;break;case fi:return e=Pe(12,n,t,l|2),e.elementType=fi,e.lanes=i,e;case pi:return e=Pe(13,n,t,l),e.elementType=pi,e.lanes=i,e;case hi:return e=Pe(19,n,t,l),e.elementType=hi,e.lanes=i,e;case Oa:return Rl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Fa:s=10;break e;case Ia:s=9;break e;case hs:s=11;break e;case ms:s=14;break e;case ut:s=16,r=null;break e}throw Error(S(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=Oa,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 dp(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=Bl(0),this.expirationTimes=Bl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Zs(e,t,n,r,l,i,s,a,u){return e=new dp(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},$s(i),e}function fp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Dc)}catch(e){console.error(e)}}Dc(),Da.exports=_e;var $c=Da.exports,zc,pa=$c;zc=pa.createRoot,pa.hydrateRoot;const gp="modulepreload",yp=function(e){return"/"+e},ha={},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=yp(u),u in ha)return;ha[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":gp,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}})},Mc=e=>`https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpmn/pmn.cfm?ID=${e}`,xp=(e,t=!0)=>`/api/investigations/${e}/report${t?"?format=markdown":""}`,rs={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(rs.nodes.map(e=>[e.id,e]));function Fc({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:[rs.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)),rs.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 wp({size:e=28,className:t=""}){return o.jsxs("span",{className:"wordmark "+t,children:[o.jsx(Fc,{size:e}),o.jsx("span",{className:"wordmark-name",children:"Forebear"})]})}const eo="forebear:intro",kp=3e3,ma=2450;function jp(){try{return!!sessionStorage.getItem(eo)}catch{return!0}}function Sp(){try{sessionStorage.setItem(eo,"seen")}catch{}}function Np(){try{sessionStorage.removeItem(eo)}catch{}}function _p({onDone:e}){const[t,n]=_.useState(!1),r=_.useRef(!1),l=_.useRef(null),i=()=>{r.current||(r.current=!0,Sp(),n(!0),e())};_.useEffect(()=>{var p;const d=setTimeout(i,ma),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),kp-ma+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(Fc,{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 Ep(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 va=["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."}},Ic={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 Cp(e){if(!e)return[];if(e.review==="confirmed"&&!va.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"&&va.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=Cp(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 Tp(e){return e.design_related?"design":e.classification==="Class I"?"class1":"other"}function to(e){const t=e.recalls||[];return t.some(n=>n.design_related)?"design":t.length?"recall":"clean"}function no(e){return{events:new Set(e.map(n=>n.event||n.id)).size,records:e.length}}const Pp=["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} ${Pp[(n||1)-1]} ${t}`:String(e)}const Oc=e=>e?String(e).slice(0,4):"";function ga(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 Ac(e,t){const n=Lp(e,t);if(n==null)return null;if(n===0)return{relation:"same-day",months:0,duration:""};const r=n<0?ga(e,t):ga(t,e);return{relation:n<0?"before":"after",months:r,duration:Rp(r)}}function Uc(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 Rp(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 Dp=(e,t)=>e?t?`${e}#page=${t}`:e:null,$p={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 zp(e,t){return e==="NO_DESIGN_RECALL_SIGNAL"&&t!=="complete"}function Mp(e,t){const n=Qn[e];return n?zp(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 gh={complete:"calm",partial:"amber",uncertain:"alert",none:"muted"},Fp={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"},Ip={product_family:{short:"FDA-listed · product family",tone:"muted",text:"The recall began before this clearance was decided, so it is not a recall of this cleared model: FDA lists the clearance as part of the recalled product family."},listed_only:{short:"FDA-listed · model not named",tone:"muted",text:"FDA lists this 510(k) on the recall, but the recall text does not name this device: the recalled model may be another one in the family."},model_named:{short:"FDA-listed · model named",tone:"other",text:"FDA lists this 510(k) on the recall and the recall text names this device."},unchecked:{short:"FDA-listed",tone:"other",text:"FDA lists this 510(k) on the recall; whether the recall text names this model could not be checked."}},yh={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 ya(e){return e!=null&&e.attribution?e.attribution:e!=null&&e.linked_before_clearance?"product_family":(e==null?void 0:e.link_name_check)==="match"?"model_named":(e==null?void 0:e.link_name_check)==="mismatch"?"listed_only":"unchecked"}const ui=70,zr=110,xa=46,Op=62,Ap=190,wa=300;function Up(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 Vp(e,{depth:t,descendants:n}){const r=new Map,l=Up(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)*ui)})}const y=a+u,k=y?Math.max(Ap,Math.min(wa,(t-zr*2)/y)):wa,L=Math.max(t,zr*2+y*k),v=zr+(L-(zr*2+y*k))/2,c=xa+Op+Math.max(1,g)*ui,h=xa+Math.max(1,g)*ui/2,w=new Map([...n.values()].map(j=>[j.k,{x:v+d(j)*k,y:h+p.get(j.k)}])),N=[...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:N,edges:r}}function Wp({a:e,depth:t,onDepth:n,descendants:r,selected:l,onSelect:i,focusChain:s}){const a=_.useMemo(()=>Vp(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(N=>N.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),N=(h.x+w.x)/2,E=`M${h.x-12},${h.y} C${N},${h.y} ${N},${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:N-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=to(c),N=c.side==="self",E=N?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${N?" 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"&&!N&&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)," · ",Oc(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,ci=260,at=e=>e?Date.parse(e.slice(0,10)+"T00:00:00Z"):null;function Hp(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 Qp({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(()=>Hp(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-ci-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 N=m-p>24?4:m-p>12?2:1,E=[];for(let x=p;x<=m;x+=N)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)),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=to(T),Be=h.size&&!h.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-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-ci+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-ci-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 Vc({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 Kp({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 Bc({r:e}){const t=Tp(e),n=Ip[ya(e)];return o.jsxs("div",{className:"recall","data-attribution":ya(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.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 Gp({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(Yp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,reload:l,onSelect:i}):o.jsx(Xp,{sel:e,a:t,closeBtn:a,onClose:n,go:r,onSelect:i})})]})}function ls({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 Yp({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(ls,{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(Kp,{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:Ic[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(Vc,{text:a.quote||a.snippet,k:a.dst,ocr:L})]}),k&&o.jsxs("a",{className:"page-card",href:Dp(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:$p[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 Xp({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(ls,{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=no(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:Mc(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(Bc,{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 Zp={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 Wc(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 Jp({a:e,onSelect:t,go:n,onFocusChain:r}){const l=Wc(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=>Ic[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})," · ",Zp[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 ro(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 is(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 qp({a:e}){const t=e.device,n=ro(e),r=e.signals.find(l=>l.code==="DIRECT_RECALL"&&l.severity!=="info"&&l.severity!=="low");if(r&&(!n||r.severity==="high")){const l=is(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=is(i,t.decision_date),a=n.evidence.find(f=>f.type==="citation"&&f.src===e.k),u=s?Ac(s.initiated,t.decision_date):null,d=no(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"]}):Uc(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 bp({a:e,onSelect:t}){const n=ro(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=is(s,e.device.decision_date),u=a?Ac(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?to({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"}),Uc(u,e.k,"chip")]}),o.jsxs("span",{className:"muted",children:[no(s).events," recall event(s) · ",s.length," product record(s) in this signal. Documentation signal, not a safety finding."]})]})]})}function eh({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),[N,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],...Mp(r.verdict,I.evidence)},me=Wc(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 ",Ue(T.decision_date)]}),o.jsx("span",{children:T.clearance_type||"510(k)"}),o.jsx("a",{href:Mc(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(qp,{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:Fp[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(bp,{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(Wp,{a:r,depth:p,onDepth:m,descendants:k,selected:v,onSelect:c,focusChain:h}):o.jsx(Qp,{a:r,depth:p,highlight:h||((Xe=ro(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(Jp,{a:r,onSelect:c,go:t,onFocusChain:w})]}),o.jsx(th,{a:r,onSelect:c})]}),o.jsxs("aside",{style:{minWidth:0},children:[o.jsx(rh,{a:r,reload:R,go:t,onSelect:c}),o.jsx(lh,{a:r,onSaved:()=>{Ie.assessments(e).then(E),n&&n()}}),o.jsx(ih,{a:r,assessments:N,runs:j,go:t})]})]}),v&&o.jsx(Gp,{sel:v,a:r,onClose:()=>c(null),go:(M,C)=>{c(null),t(M,C)},reload:R,onSelect:c})]})}function th({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(nh,{s:r,onSelect:t},l))]})}function nh({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(Bc,{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 rh({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)," · ",Oc(d.dst_decision_date)]})]}),o.jsx(Vc,{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 lh({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 ih({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:xp(l.id),target:"_blank",rel:"noreferrer",children:"Report ↗"})]}),o.jsx("div",{className:"muted",children:(l.request||"").slice(0,110)})]},l.id))]})}function sh({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 oh={compare:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.CompareView}))),reach:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.ReachView}))),watch:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.WatchlistView}))),ingest:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.IngestView}))),history:_.lazy(()=>zt(()=>import("./History-CPQprqBL.js"),[])),method:_.lazy(()=>zt(()=>import("./Views-DadbQpl8.js"),[]).then(e=>({default:e.MethodView})))},ah={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"})},uh=({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:ah[e]}),ch=[["Investigate",[["check","Predicate check"],["compare","Compare predicates"]]],["Recall evidence",[["reach","Recall reach"],["watch","Watchlist"]]],["Graph",[["ingest","Add a clearance"],["history","History"],["method","Method"]]]];function dh({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=oh[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(wp,{size:24})}),o.jsx(fh,{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:[ch.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(uh,{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(eh,{k:e.arg.toUpperCase(),go:t,onChanged:l}):o.jsx(sh,{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 fh({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 ph=_.lazy(()=>zt(()=>import("./Landing-D8mpPU0X.js"),[])),hh={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:hh[n]||n||"film",arg:decodeURIComponent(r.join("/")||"")}}const mh=(e,t)=>e==="film"?"#/":`#/${e}${t?"/"+t:""}`;function vh(){const[e,t]=_.useState(Fr),[n,r]=_.useState(null),[l,i]=_.useState(null),s=Ep("(prefers-reduced-motion: reduce)"),[a,u]=_.useState(()=>e.tab==="film"&&!jp()&&!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=mh(y,k),c=()=>{history.pushState(null,"",v),t(Fr(v)),window.scrollTo(0,0)};L.transition&&!s&&document.startViewTransition?document.startViewTransition(()=>$c.flushSync(c)):c()},[s]);_.useEffect(()=>{const y=()=>t(Fr());return addEventListener("popstate",y),()=>removeEventListener("popstate",y)},[]);const g=()=>{Np(),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(_p,{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(ph,{go:m,stats:n,introDone:d,reduced:s})}):o.jsx(dh,{route:e,go:m,stats:n,statsErr:l,refreshStats:p,onReplay:g})})]})}zc(document.getElementById("root")).render(o.jsx(vh,{}));export{Ip as A,gh as E,Fc as M,wl as R,yh as T,Qn as V,wp as W,zt as _,Fp as a,Ie as b,xp as c,Ue as f,o as j,ga as m,Dp as p,_ as r,Ep as u,Mp as v}; diff --git a/web/dist/index.html b/web/dist/index.html index be5336d..e93bfd0 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -7,7 +7,7 @@ - +