#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""C-2a-4a 补丁 2:gates.vue 首跑漏写 3 处 #5B9BD5(L195/L243/L256,全部主行动/当前态 -> 橙)
+ fix_lang。reward-energy 已由补丁 1 处理。
"""
import io
import re
import sys
ORANGE = '$brand-primary'
PAGE = 'pages/profile-extra/gates.vue'
SUBS = [
(' border: 2rpx solid #5B9BD5;\n', ' border: 2rpx solid %s;\n' % ORANGE, 1),
(' background: #5B9BD5;\n', ' background: %s;\n' % ORANGE, 1),
(' color: #5B9BD5;\n', ' color: %s;\n' % ORANGE, 1),
]
STYLE_RE = re.compile(r'^[ \t]*', re.M)
def main():
src = io.open(PAGE, encoding='utf-8').read()
for old, new, expect in SUBS:
n = src.count(old)
if n != expect:
raise RuntimeError('%s: hit=%d(要求 %d):: %r' % (PAGE, n, expect, old))
src = src.replace(old, new)
print(' %-46s -> %s x%d' % (old.strip(), new.strip(), n))
m = STYLE_RE.search(src)
block = m.group(0)
first, rest = block.split('\n', 1)
if '