import Alpine from '@alpinejs/csp';
import focus from '@alpinejs/focus';
import morph from '@alpinejs/morph';
import '@cpcreation/viti-core/js/livePatch-alpine';
import alpineManager from '@cpcreation/viti-core/js/alpineManager.js';
import stimulusManager from '@cpcreation/viti-core/js/stimulusManager.js';
import menu from './menu';
import registerAuthTurboFrame from './authTurboFrame';
import registerCuveeFrameScroll from './cuveeFrameScroll';
import ShopProductGalleryController from './controllers/shopProductGalleryController';
import ShopProductNavigationController from './controllers/shopProductNavigationController';
import './styles/theme.scss';

Alpine.plugin(morph);
Alpine.plugin(focus);

window.Alpine = Alpine;
alpineManager.registerAll();
Alpine.data('menu', menu);
stimulusManager.register('shop-product-gallery', ShopProductGalleryController);
stimulusManager.register('shop-product-navigation', ShopProductNavigationController);

if (!window.__vitiThemeLegacyTheme3AlpineStarted) {
    window.__vitiThemeLegacyTheme3AlpineStarted = true;
    Alpine.start();
}

registerCuveeFrameScroll();
registerAuthTurboFrame();
