"""Order of the sealed Septuagint → Revelation rows (rev_lxx_sealed.py), by prophet, by arrow3's statistic.
Added after arrow3's run, because its automatic rows failed their relation control (rows per verse no higher
than 1 Maccabees'); the sealed rows are the reader's, named before any feature was computed."""
import json, re
import arrow3 as P
from rev_lxx_sealed import ROWS
out = {}
by = {}
for rv, b, c, v, _ in ROWS:
    m = re.match(r"(\d+):(\d+)", rv); rk = ("Rev", int(m[1]), int(m[2]))
    if rk not in P.B.IDX["Rev"]: continue
    pos = (c, v)
    by.setdefault(b, []).append((pos, P.B.IDX["Rev"][rk]))
for b, pairs in by.items():
    if len(pairs) >= 8:
        xs = sorted(set(p for p, _ in pairs)); rank = {p: i for i, p in enumerate(xs)}
        out[f"{b}→Rev (sealed)"] = P.order_test([(rank[p], r) for p, r in pairs])
print(json.dumps(out, indent=1)); json.dump(out, open("arrow3_sealed_order.json", "w"), indent=1)
