"""Narrow, versioned keyboard change without touching sealed shared UI sources."""
from .mask_model_training_data import require

REPLACEMENTS=(
    ("key==='s'&&!event.shiftKey?'draft'", "key==='s'&&!event.shiftKey?'correct'"),
    ('Ctrl / ⌘ + S 仅存草稿', 'Ctrl / ⌘ + S 保存并标记已复核（不切图）'),
    ("['draft','Control+s Meta+s'],['correct','Control+Enter Meta+Enter']",
     "['correct','Control+s Meta+s Control+Enter Meta+Enter']"),
)


def complete_shortcuts(source):
    for old,new in REPLACEMENTS:
        require(source.count(old)==1,'Sealed keyboard anchor changed: '+old)
        source=source.replace(old,new)
    return source
