import re

with open('lib/theme/app_theme.dart', 'r') as f:
    content = f.read()

content = content.replace(
    'background: background,',
    'surface: surface,'
).replace(
    'onBackground: textPrimary,',
    'onSurface: textPrimary,'
)

# Remove duplicate surface if present
lines = content.split('\n')
seen_surface = False
out = []
for line in lines:
    if 'surface: surface,' in line:
        if seen_surface:
            continue
        seen_surface = True
    out.append(line)
content = '\n'.join(out)

with open('lib/theme/app_theme.dart', 'w') as f:
    f.write(content)
print("theme fixed")
