import React from 'react'
import ReactDOM from 'react-dom/client'
import { Buffer } from 'buffer'
import { EventEmitter } from 'events'
import App from './App.tsx'
import './index.css'
import './styles/mobile.css'

// Polyfill Buffer / EventEmitter for browser (ethers, wallet libs)
type GlobalPolyfills = typeof globalThis & {
  Buffer: typeof Buffer
  EventEmitter: typeof EventEmitter
}

const globalWithPolyfills = globalThis as GlobalPolyfills
globalWithPolyfills.Buffer = Buffer
globalWithPolyfills.EventEmitter = EventEmitter
window.Buffer = Buffer
window.EventEmitter = EventEmitter

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
)

