import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import { runAdminBootHooks } from './pro-ui-registry';
import './styles.css';

import SettingsApp from './components/SettingsApp.vue';

document.addEventListener('DOMContentLoaded', () => {
    const builderEl = document.getElementById('formatrica-builder');
    const settingsEl = document.getElementById('formatrica-settings');

    if (builderEl) {
        const app = createApp(App);
        app.use(createPinia());
        app.mount(builderEl);
        return;
    }

    if (settingsEl) {
        const app = createApp(SettingsApp);
        app.mount(settingsEl);
        return;
    }

    // Extra mount targets registered by the edition entrypoint (Phase 7.2):
    // Pro registers the License-page mount here, so its element id and
    // component never enter the Free bundle.
    runAdminBootHooks();
});
