"""Interactive All-22 field: a self-contained HTML/SVG/JS document served in an iframe.
Python decides *what* (rule profile, formation, ball spot); the field renders and edits it.
Edits (dragged players, drawn lines) persist in localStorage keyed by formation pair, so
switching NFL <-> NCAA keeps the coach's work and only the geometry changes.
"""
from __future__ import annotations
import html
import json
from formations import DEFENSE, OFFENSE
from rules import PROFILES, RuleProfile, other
TEMPLATE = r"""
Drag any player. Pick Route / Motion / Block, then drag from a player to draw his line.