<?php
/**
 * Autoloader for UM Elementor modules
 * 
 * This file ensures all necessary classes are loaded for the refactored modules
 */

if (!defined('ABSPATH')) exit; // Exit if accessed directly

// Load helper classes (these don't depend on Elementor)
require_once __DIR__ . '/helpers/class-field-visibility.php';
require_once __DIR__ . '/helpers/UM_User_Meta_Renderer.php';
require_once __DIR__ . '/helpers/UM_Elementor_Utils.php';
require_once __DIR__ . '/helpers/WP_User_Meta_Renderer.php';
require_once __DIR__ . '/helpers/UM_User_Query_Legacy.php';
require_once __DIR__ . '/helpers/WP_User_Query_Legacy.php';
require_once __DIR__ . '/helpers/UM_Profile_Context.php';
require_once __DIR__ . '/helpers/UM_Core_Pages.php';

// Load abstract base class only if Elementor is available
if (class_exists('Elementor\\Widget_Base')) {
    require_once __DIR__ . '/abstract/UM_Elementor_Base_Widget.php';
    require_once __DIR__ . '/abstract/UM_Profile_Base_Widget.php';
}

// Create class alias for backward compatibility (only if base class is loaded)
if (class_exists('UM_Elementor\\Base\\UM_Elementor_Base_Widget') && !class_exists('UM_Elementor\\UM_Elementor_Base_Widget')) {
    class_alias('UM_Elementor\\Base\\UM_Elementor_Base_Widget', 'UM_Elementor\\UM_Elementor_Base_Widget');
}

