/**
 * Start Super Flow widget script
 */

( function( $, elementor ) {

	'use strict';

	var widgetSuperFlow = function( $scope, $ ) {

		var $SuperFlow = $scope.find( '.asa-super-flow' );
				
        if ( ! $SuperFlow.length ) {
            return;
        }

		var $SuperFlowContainer = $SuperFlow.find('.swiper-carousel'),
			$settings 		 = $SuperFlow.data('settings');

			$settings.modules = [EffectSuperFlow ];

		// Access swiper class
        const Swiper = elementorFrontend.utils.swiper;
        initSwiper();
        
        async function initSwiper() {

			var swiper = await new Swiper($SuperFlowContainer, $settings);

			if ($settings.pauseOnHover) {
				 $($SuperFlowContainer).hover(function() {
					(this).swiper.autoplay.stop();
				}, function() {
					(this).swiper.autoplay.start();
				});
			}
		};

	};


	jQuery(window).on('elementor/frontend/init', function() {
		elementorFrontend.hooks.addAction( 'frontend/element_ready/asa-super-flow.default', widgetSuperFlow );
	});

}( jQuery, window.elementorFrontend ) );

/**
 * End Image Carousel widget script
 */
