const fs = require('fs');
const content = fs.readFileSync('dist/assets/index-BZZTcu4K-v5.js', 'utf8');
const lines = content.split('\n');
// Let's get the specific lines around the error
const snippet = lines.slice(26260, 26800).join('\n');

let stack = [];
for (let i = 0; i < snippet.length; i++) {
  let char = snippet[i];
  if (char === '(' || char === '[' || char === '{') {
    stack.push({ char, line: lines.slice(26260).join('\n').substring(0, i).split('\n').length + 26260 });
  } else if (char === ')' || char === ']' || char === '}') {
    if (stack.length === 0) {
      console.log(`Extra closing ${char} at line ${lines.slice(26260).join('\n').substring(0, i).split('\n').length + 26260}`);
    } else {
      let last = stack.pop();
      if ((char === ')' && last.char !== '(') ||
          (char === ']' && last.char !== '[') ||
          (char === '}' && last.char !== '{')) {
        console.log(`Mismatch: opened ${last.char} at line ${last.line} but closed ${char} at line ${lines.slice(26260).join('\n').substring(0, i).split('\n').length + 26260}`);
      }
    }
  }
}
if (stack.length > 0) {
  console.log('Unclosed brackets remaining:', stack);
} else {
  console.log('All brackets balanced in snippet!');
}
