const fs = require('fs');
const path = require('path');

const dir = 'app/(onboarding)/onboarding';

// Replace Arrow in onboarding-primitives.tsx
let primCode = fs.readFileSync(path.join(dir, 'onboarding-primitives.tsx'), 'utf8');
primCode = primCode.replace(
  /<Arrow size=\{13\} \/>/g,
  '<svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round"><path d="M3 8h10M9 4l4 4-4 4"/></svg>'
);
fs.writeFileSync(path.join(dir, 'onboarding-primitives.tsx'), primCode);

// Add Field to imports
const filesToFix = ['onboarding-consultant.tsx', 'onboarding-entrepreneur.tsx', 'onboarding-owner.tsx'];
for (const f of filesToFix) {
  let code = fs.readFileSync(path.join(dir, f), 'utf8');
  if (!code.includes('Field,') && !code.includes(', Field')) {
    code = code.replace(/import \{ ([^}]+) \} from "\.\/onboarding-primitives";/, 'import { $1, Field } from "./onboarding-primitives";');
  }
  fs.writeFileSync(path.join(dir, f), code);
}
