// import './bootstrap';
import '../css/app.css';

import { createRoot, hydrateRoot } from 'react-dom/client';
import { createInertiaApp } from '@inertiajs/react';
import { resolveReactPage } from './page-resolver';
import theme from "@/lib/theme/theme";
import { ThemeProvider } from "@mui/material/styles";


const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: name => resolveReactPage(name),
    setup({ el, App, props }) {
        if (import.meta.env.DEV) {
            createRoot(el).render(<ThemeProvider theme={theme}><App {...props} /></ThemeProvider>);
            return
        }

        hydrateRoot(el, <ThemeProvider theme={theme}><App {...props} /></ThemeProvider>);
    },
    progress: {
        color: '#4B5563',
    },
});
