with open('/Users/tsdmacbook/Desktop/tsd-milktea/resources/views/livewire/menu/menu-items.blade.php', 'r', encoding='utf-8') as f:
    content = f.read()

lines = content.split('\n')

stack = []

for idx, line in enumerate(lines):
    line_num = idx + 1
    # Very simple tokenization of divs
    import re
    tokens = re.findall(r'(<div[^>]*>|</div>)', line)
    for t in tokens:
        if t == '</div>':
            if not stack:
                print(f"Error: unmatched </div> on line {line_num}")
            else:
                stack.pop()
        else:
            stack.append(line_num)

print("Unclosed <div> tags (by line number where they started):")
for item in stack:
    print(f"Line {item}")
