import re

# Better circular UK flag - using square viewBox so circle crop looks right
uk = '<svg width="18" height="18" viewBox="0 0 30 30" style="border-radius: 50%; overflow: hidden; vertical-align: middle; flex-shrink: 0; margin-right: 8px;"><rect width="30" height="30" fill="#012169"/><path d="M0 0l30 30M30 0L0 30" stroke="#fff" stroke-width="5"/><path d="M0 0l30 30M30 0L0 30" stroke="#C8102E" stroke-width="3"/><path d="M15 0v30M0 15h30" stroke="#fff" stroke-width="9"/><path d="M15 0v30M0 15h30" stroke="#C8102E" stroke-width="5"/></svg>'

# Better circular France flag - using square viewBox
fr = '<svg width="18" height="18" viewBox="0 0 3 3" style="border-radius: 50%; overflow: hidden; vertical-align: middle; flex-shrink: 0; margin-right: 8px;"><rect width="1" height="3" fill="#002395"/><rect x="1" width="1" height="3" fill="#fff"/><rect x="2" width="1" height="3" fill="#ED2939"/></svg>'

with open(r'd:\DN\NIKITA_RAjput\vps.html', 'r', encoding='utf-8') as f:
    content = f.read()

# Replace old UK flag SVG (viewBox 0 0 60 30)
old_uk = '<svg width="18" height="18" viewBox="0 0 60 30" style="border-radius: 50%; overflow: hidden; vertical-align: middle; flex-shrink: 0; margin-right: 8px;"><rect width="60" height="30" fill="#012169"/><path d="M0 0l60 30M60 0L0 30" stroke="#fff" stroke-width="6"/><path d="M0 0l60 30M60 0L0 30" stroke="#C8102E" stroke-width="4"/><path d="M30 0v30M0 15h60" stroke="#fff" stroke-width="10"/><path d="M30 0v30M0 15h60" stroke="#C8102E" stroke-width="6"/></svg>'

# Replace old France flag SVG (viewBox 0 0 3 2)
old_fr = '<svg width="18" height="18" viewBox="0 0 3 2" style="border-radius: 50%; overflow: hidden; vertical-align: middle; flex-shrink: 0; margin-right: 8px;"><rect width="1" height="2" fill="#002395"/><rect x="1" width="1" height="2" fill="#fff"/><rect x="2" width="1" height="2" fill="#ED2939"/></svg>'

content = content.replace(old_uk, uk)
content = content.replace(old_fr, fr)

with open(r'd:\DN\NIKITA_RAjput\vps.html', 'w', encoding='utf-8') as f:
    f.write(content)

print("Fixed! UK and France circular flags now use square viewBox.")
