// src/main.tsx (arriba del todo, antes de render)
import { Buffer } from "buffer";
if (typeof window !== "undefined" && !(window as any).Buffer) {
  (window as any).Buffer = Buffer;
}

import { createRoot } from 'react-dom/client'
import App from './App.tsx'
import './index.css'
import '@n8n/chat/style.css'; // Mantenemos el estilo del chat aquí

// --- MIS MODIFICACIONES ---
import { BrowserRouter } from 'react-router-dom'
import { AuthProvider } from './context/AuthContext' // 1. Importa el AuthProvider

createRoot(document.getElementById("root")!).render(
  // 2. Envuelve tu App con BrowserRouter y AuthProvider
  <BrowserRouter>
    <AuthProvider>
      <App />
    </AuthProvider>
  </BrowserRouter>
);