<?php
/**
 * EventON Various admin settings view designer
 * @version 5.0.4
 */

class EVO_Settings_Designer{

	private const TEXTDOMAIN = 'eventon';
	private const NO_HR_TYPES = [
        'begin_afterstatement', 'end_afterstatement',
        'hiddensection_open', 'hiddensection_close',
        'sub_section_open', 'sub_section_close'
    ];

    private const FONT_SIZES = [
        '10px','11px','12px','13px','14px','16px','18px','20px',
        '22px','24px','28px','30px','36px','42px','48px','54px','60px'
    ];
    private const OPACITY_VALUES = ['0.0','0.1','0.2','0.3','0.4','0.5','0.6','0.7','0.8','0.9','1'];
    private const FONT_STYLES = ['normal','bold','italic','bold-italic'];

	// Print Main Settings Form Content
	public function print_ajde_customization_form($cutomization_pg_array, $data, $extra_tabs=''){
		$this->print_main_settings($cutomization_pg_array, $data, $extra_tabs );
	}

	public function print_main_settings(array $customization_pg_array, $data= '' , string $extra_tabs = ''): void
    {   
        $data = !empty($data) && is_array($data) ? $data : [];
        $leftside = $rightside = '';
        $is_first = true;

        $rightside .= EVO()->elements->get_icon_html();

        foreach ($customization_pg_array as $tab) {
            // Left-side navigation
            $level_class = $tab['level'] ?? '';
            $is_focused = $is_first ? 'focused' : '';

            $icon = $tab['icon'] ?? 'edit';
            $icon_html = "<i class='fa fa-$icon'></i>";
            $tab_icon = "<i class='fa fa-{$icon} evofz24 evomarr10'></i>";

            // svg icon html
            if( isset( $tab['svg_html'])){
                $icon_html = $tab['svg_html'];
                $tab_icon = "<span class='evodfx evomarr10'>{$tab['svg_html']}</span>";
            }

            $tab_name = __($tab['tab_name'], self::TEXTDOMAIN);
            $leftside .= "<li class='evomarb5 evopad0i $level_class'>
                <a class='evosetting_nav_a $is_focused' data-c_id='{$tab['id']}' data-d='{$tab['tab_name']}' title='{$tab['tab_name']}'>{$icon_html}{$tab_name}</a></li>";

            if (($tab['tab_type'] ?? '') === 'empty') {
                $is_first = false;
                continue;
            }

            // Right-side content
            $display = ($tab['display'] ?? '') === 'show' ? '' : 'display:none';
            

            $rightside .= "<div id='setting_{$tab['id']}' data-setting='{$tab['id']}' style='$display' class='nfer'>
                <h3 class='evodfx evofxdrr evofxaic'>$tab_icon" . __($tab['name'], self::TEXTDOMAIN) . "</h3>";

            if (!empty($tab['description'])) {
                $rightside .= "<p class='tab_description'>{$tab['description']}</p>";
            }

            $rightside .= "<em class='hr_line'></em>";

            foreach ($tab['fields'] as $field) {
                if (empty($field['type'])) continue;

                $rightside .= $this->render_field($field, $data);
            }

            $rightside .= "</div>";
            $is_first = false;
        }

        $this->render_table($leftside, $rightside . $extra_tabs);
    }

    private function render_field(array $field, array $data): string
    {
        $type = $field['type'];
        $id = $field['id'] ?? '';
        $value = $data[$id] ?? ($field['default'] ?? '');
        $name = __($field['name'] ?? '', self::TEXTDOMAIN);
        $legend = $this->get_legend($field);

        // Early return for HR-skipped types
        $skip_hr = in_array($type, self::NO_HR_TYPES, true) || !empty($field['afterstatement']);

        switch ($type) {
            case 'notice':
                return EVO()->elements->get_element([
                    'type' => 'notice',
                    'name' => $name . $legend,
                    'row_class' => 'ajdes_notice'
                ]) . ($skip_hr ? '' : "<em class='hr_line'></em>");

            case 'image':
                return $this->render_image_field($field, $data) . "<em class='hr_line'></em>";

            case 'icon_selection':
                return $this->render_icon_selection($field, $data) . "<em class='hr_line'></em>";

            case 'icon':
                return $this->render_icon_field($field, $data) . "<em class='hr_line'></em>";

            case 'subheader':
                return "<h4 class='acus_subheader'>$name</h4>" . ($skip_hr ? '' : "<em class='hr_line'></em>");

            case 'note':
                return "<p class='ajde_note'><span class='evodb evoop7'>$name</span></p>" . ($skip_hr ? '' : "<em class='hr_line'></em>");

            case 'hr':
            case 'line':
                return "<em class='hr_line'></em>";

            case 'checkbox':
                $checked = ($data[$id] ?? '') === 'yes' ? 'checked' : '';
                return "<p><input type='checkbox' name='$id' value='yes' $checked/> $name</p><em class='hr_line'></em>";

            case 'text':
            case 'password':
               
                $val = htmlspecialchars($data[$id] ?? '', ENT_QUOTES);
                
                return EVO()->elements->get_element([
                    'type' => 'text',
                    'id' => $id,
                    'name' => $name . $legend,
                    'value' => $val,
                    'default' => $field['default'] ?? '',
                    'tooltip' => $field['tooltip'] ?? '',
                    'tooltip_position' => 'L',
                    'hideable'=> ( !empty($field['hideable']) && !empty($data[$id]) ),
                    'placeholder'=> ( $field['default'] ?? '' ),
                ]) . ($skip_hr ? '' : "<em class='hr_line'></em>");

                return "<p>$name$legend$hideable_btn</p>
                        <p class='field_container'><span class='nfe_f_width'>
                        <input type='$input_type' name='$id' value='$val' placeholder='$placeholder'/>
                        </span></p><em class='hr_line'></em>";

            case 'textarea':
            case 'wysiwyg':
                return EVO()->elements->get_element([
                    'type' => $type,
                    'id' => $id,
                    'name' => $name,
                    'value' => stripslashes($data[$id] ?? ''),
                    'default' => $field['default'] ?? '',
                    'tooltip' => $field['tooltip'] ?? '',
                    'tooltip_position' => 'L'
                ]) . ($skip_hr ? '' : "<em class='hr_line'></em>");

            case 'font_size':
            case 'opacity_value':
            case 'font_style':
            case 'border_radius':
                return $this->render_select($field, $data, $this->get_select_options($type)) . "<em class='hr_line'></em>";

            case 'color':
                return $this->render_color_field($field, $data) . "<em class='hr_line'></em>";

            case 'fontation':
            case 'multicolor':
                return $this->render_multi_variation($field, $data) . "<em class='hr_line'></em>";

            case 'radio':
                return $this->render_radio($field, $data) . "<em class='hr_line'></em>";

            case 'dropdown':
                return $this->render_dropdown($field, $data) . "<em class='hr_line'></em>";

            case 'checkboxes':
                return EVO()->elements->get_element([
                    'type' => 'checkbox',
                    'id' => $id,
                    'name' => $name,
                    'options' => $field['options'],
                    'value' => $data[$id] ?? [],
                    'tooltip' => $field['tooltip'] ?? ''
                ]) . "<em class='hr_line'></em>";

            case 'yesno':
            case 'yesnoALT':
                $default = $field['default'] ?? 'no';
                $current = $data[$id] ?? $default;
                $after = $field['afterstatement'] ?? '';
                $desc = $field['desc'] ?? '';
                $btn = EVO()->elements->yesno_btn(['var' => $current, 'attr' => ['afterstatement' => $after]]);
                $desc_html = $desc ? "<i style='opacity:0.6; padding-top:8px; display:block'>$desc</i>" : '';
                return "<p class='yesno_row evofxaic'>$btn
                        <input type='hidden' name='$id' value='" . ($current === 'yes' ? 'yes' : 'no') . "'/>
                        <span class='field_name'>$name$legend</span>$desc_html</p>" . ( empty($after) ? "<em class='hr_line'></em>":'');

            case 'begin_afterstatement':
                $show = ($data[$id] ?? 'no') === 'yes' ? 'block' : 'none';
                return "<div class='backender_yn_sec' id='$id' style='display:$show'><div class='evosettings_field_child'>";

            case 'end_afterstatement':
                return "</div></div><em class='hr_line evosettings_end_field w1'></em>";

            case 'hiddensection_open':
                $display = ($field['display'] ?? '') === 'none' ? 'style="display:none"' : '';
                $open_class = ($field['display'] ?? '') === 'none' ? '' : 'open';
                return "<div class='ajdeSET_hidden_open $open_class'><h4>{$field['name']}$legend</h4></div>
                        <div class='ajdeSET_hidden_body' $display><div class='evo_in'>";

            case 'hiddensection_close':
                return "</div></div>";

            case 'sub_section_open':
                $icon = $field['icon_class'] ?? '';
                $icon_html = $icon ? "<i class='fa $icon evomarr10'></i>" : '';
                return "<div class='evo_settings_subsection'>
                        <h4 class='acus_subheader'>$icon_html" . __($field['name'], self::TEXTDOMAIN) . "</h4>
                        <div class='evo_in'>";

            case 'sub_section_close':
                $hr = !empty($field['em']) ? "<em class='hr_line'></em>" : '';
                return "</div></div>$hr";

            case 'customcode':
                return $field['code'] ?? '';

            case 'rearrange':
                return $this->render_rearrange($field, $data);

            default:
                $field['value'] = $value;
                return EVO()->elements->get_element($field) . ($skip_hr ? '' : "<em class='hr_line'></em>");
        }
    }

    private function get_legend(array $field): string
    {
        $tooltip = $field['legend'] ?? $field['tooltip'] ?? '';
        $html = $tooltip ? EVO()->elements->tooltips($tooltip, 'L', false) : '';

        if (!empty($field['beta'])) {
            $html .= "<span class='evonewtag beta evotooltipfree L' data-d='" . __('This feature is still in beta stage','eventon') . "'>" . __('Beta','eventon') . "</span>";
        }

        if (!empty($field['ver'])) {
            $ver = $field['ver'] === ($field['compare_ver'] ?? EVO()->version) ? $field['ver'] : EVO()->version;
            if ($field['ver'] === $ver) {
                $html .= "<span class='new evonewtag evotooltipfree L' data-d='" . __('New in version', 'eventon') . " $ver'>new</span>";
            }
        }

        return $html;
    }

    private function get_select_options(string $type): array
    {
        return match ($type) {
            'font_size' => self::FONT_SIZES,
            'opacity_value' => self::OPACITY_VALUES,
            'font_style' => self::FONT_STYLES,
            'border_radius' => ['0px','2px','3px','4px','5px','6px','8px','10px'],
            default => []
        };
    }

    private function render_select(array $field, array $data, array $options): string
    {
        $id = $field['id'];
        $value = $data[$id] ?? '';
        $name = __($field['name'], self::TEXTDOMAIN);
        $legend = $this->get_legend($field);

        $opts = '';
        foreach ($options as $opt) {
            $selected = $value === $opt ? 'selected' : '';
            $opts .= "<option value='$opt' $selected>$opt</option>";
        }

        return "<p>$name <select name='$id'>$opts</select>$legend</p>";
    }

    private function render_color_field(array $field, array $data): string
    {
        $id = $field['id'];
        $hex = $data[$id] ?? $field['default'];
        $rgb_id = $field['rgbid'] ?? '';
        $rgb = $rgb_id && !empty($data[$rgb_id]) ? $data[$rgb_id] : '';
        $name = __($field['name'], self::TEXTDOMAIN);
        $rgb_class = $rgb_id ? ' rgb' : '';

        $rgb_input = $rgb_id ? "<input name='$rgb_id' class='rgb' type='hidden' value='$rgb'/>" : '';

        return "<p class='acus_line color'>
            <em><span class='colorselector$rgb_class evotooltipfree' style='background-color:#$hex' hex='$hex' title='$hex'></span>
            <input name='$id' class='backender_colorpicker evocolorp_val' type='hidden' value='$hex' default='{$field['default']}'/>
            $rgb_input</em>$name
        </p>";
    }

    private function render_multi_variation(array $field, array $data): string
    {
        $html = "<div class='row_" . ($field['type'] === 'fontation' ? 'fontation' : 'multicolor') . "'>";
        $html .= $field['type'] === 'fontation' ? "<p class='fieldname'>" . __($field['name'], self::TEXTDOMAIN) . "</p>" : '';

        foreach ($field['variations'] as $v) {
        	// Skip if variation is invalid
	        if (!is_array($v) || empty($v['id']) || empty($v['type'])) {
	            continue;
	        }

            $vid = $v['id'];
            $vhex = $data[$vid] ?? $v['default'];
            $vname = __($v['name'] ?? '', self::TEXTDOMAIN);

            switch ($v['type']) {
                case 'color':
                    $title = $v['name'] ?? $vhex;
                    $has_title = !empty($v['name']);
                    $html .= "<p class='acus_line color'>
                        <em><span id='$vid' class='colorselector evotooltipfree " . ($has_title ? 'hastitle' : '') . "' style='background-color:#$vhex' hex='$vhex' title='$title'></span>
                        <input name='$vid' class='backender_colorpicker evocolorp_val' type='hidden' value='$vhex' default='{$v['default']}'/></em>
                    </p>";
                    break;
                case 'font_style':
                case 'font_size':
                case 'opacity_value':
                    $opts = $this->get_select_options($v['type']);
                    $val = $data[$vid] ?? $v['default'];
                    $select = "<select name='$vid'>";
                    foreach ($opts as $opt) {
                        $select .= "<option value='$opt'" . ($val === $opt ? ' selected' : '') . ">$opt</option>";
                    }
                    $select .= "</select>";
                    $html .= "<p style='margin:0'>$select</p>";
                    break;
            }
        }

        $html .= $field['type'] === 'fontation' ? '<div class="clear"></div>' : '<p class="multicolor_alt"></p>';
        $html .= "</div>";
        return $html;
    }

    private function render_radio(array $field, array $data): string
    {
        $id = $field['id'];
        $value = $data[$id] ?? '';
        $name = __($field['name'], self::TEXTDOMAIN);
        $legend = $this->get_legend($field);
        $html = "<p class='acus_line acus_radio'>$name<br/>";

        foreach ($field['options'] as $opt => $label) {
            $opt_id = "{$id}_" . str_replace(' ', '_', $label);
            $checked = ($value === $opt || (empty($value) && $opt === array_key_first($field['options']))) ? 'checked' : '';
            $html .= "<em><input id='$opt_id' type='radio' name='$id' value='$opt' $checked/>
                      <label class='ajdebe_radio_btn' for='$opt_id'><span class='fa'></span>" . __($label, self::TEXTDOMAIN) . "</label></em>";
        }

        return $html . "$legend</p>";
    }

    private function render_dropdown(array $field, array $data): string
    {
        $id = $field['id'];
        $value = $data[$id] ?? ($field['default'] ?? '');
        $name = __($field['name'], self::TEXTDOMAIN);
        $legend = $this->get_legend($field);
        $desc = $field['desc'] ?? '';
        $desc_html = $desc ? "<br/><i style='opacity:0.6'>$desc</i>" : '';

        return EVO()->elements->get_element([
            'type' => 'select',
            'id' => $id,
            'name' => $name,
            'options' => $field['options'],
            'value' => $data[$id] ?? ($field['default'] ?? ''),
            'tooltip' => ( $field['tooltip'] ?? '' ),
            'legend'=> ( $field['desc'] ?? '' ),
            'field_after_content'=> $legend,
        ]); 

        /*
        $opts = '';
        foreach ($field['options'] as $opt => $label) {
            $selected = $value === $opt ? 'selected' : '';
            $opts .= "<option value='$opt' $selected>$label</option>";
        }

        return "<p class='acus_line $id'>$name <select class='ajdebe_dropdown' name='$id'>$opts</select>$desc_html$legend</p>";
        */
    }

    private function render_image_field(array $field, array $data): string
    {
        $id = $field['id'];
        $meta = $data[$id] ?? false;
        $size = $field['preview_img_size'] ?? 'medium';
        $name = __($field['name'], self::TEXTDOMAIN);
        $legend = $this->get_legend($field);

        $image = $meta ? ( wp_get_attachment_image_src( $meta, $size )[0] ?? '' ) : '';
        $display = $image ? 'block' : 'none';
        $button_display = $image ? 'none' : 'block';

        return "<div id='pa_$id'>
            <p>$name$legend</p>
            <p class='ajde_image_selector'>
                <span class='ajt_image_holder' style='display:$display'><b class='ajde_remove_image'>X</b><img src='$image'/></span>
                <input type='hidden' class='ajt_image_id' name='$id' value='$meta'/>
                <input type='button' class='ajt_choose_image button' style='display:$button_display' value='" . __('Choose an Image','ajde') . "'/>
            </p>
        </div>";
    }

    private function render_icon_field(array $field, array $data): string
    {
        $id = $field['id'];
        $value = $data[$id] ?? $field['default'];
        $name = __($field['name'], self::TEXTDOMAIN);

        return "<div class='row_faicons'>
            <p class='fieldname'>$name</p>" .
            EVO()->elements->get_element([
                'type' => 'icon_select',
                'id' => $id,
                'value' => $value,
                'close' => false
            ]) . "<div class='clear'></div></div>";
    }

    private function render_icon_selection(array $field, array $data): string
    {
        $html = "<div class='row_faicons_collection evodfx evogap15 evofx_ww'>";
        foreach ($field['icons'] as $icon) {
            $value = $data[$icon['id']] ?? $icon['default'];
            $html .= "<div class='evo_settings_icon_box evodfx evobr15 evofx_dr_c evopad20 evocurp evo_transit_all'>
                " . EVO()->elements->get_element([
                    'type' => 'icon_select',
                    'id' => $icon['id'],
                    'value' => $value,
                    'close' => false
                ]) . "<p class='fieldname'>" . __($icon['name'], self::TEXTDOMAIN) . "</p>
            </div>";
        }
        return $html . "</div>";
    }

    private function render_rearrange(array $field, array $data): string	{
	    // Extract required fields
	    $order_var      = $field['order_var'] ?? '';
	    $selected_var   = $field['selected_var'] ?? '';
	    $fields_array   = $field['fields_array'] ?? [];
	    $title          = $field['title'] ?? '';
	    $notes          = $field['notes'] ?? '';

	    if (empty($order_var) || empty($selected_var) || empty($fields_array)) {
	        return '';
	    }

	    // === Saved Order ===
	    $saved_order = [];
	    if (!empty($data[$order_var])) {
	        $raw = explode(',', $data[$order_var]);
	        $unique = [];
	        foreach ($raw as $slug) {
	            if ($slug && !in_array($slug, $unique, true)) {
	                $unique[] = $slug;
	            }
	        }
	        $saved_order = array_filter($unique);
	    }

	    // Re-order fields_array according to saved order
	    $ordered = [];
	    $remaining = [];

	    foreach ($fields_array as $slug => $name) {
	        if (in_array($slug, $saved_order, true)) {
	            $ordered[$slug] = $name;
	        } else {
	            $remaining[$slug] = $name;
	        }
	    }

	    // Preserve saved order, append unsaved
	    $final_fields = array_replace(array_flip($saved_order), $ordered, $remaining);

	    // === Selected Items ===
	    $selected = [];
	    if (!empty($data[$selected_var])) {
	        $val = $data[$selected_var];
	        $selected = is_array($val) ? $val : array_filter(explode(',', $val));
	    }

	    // === Unselectable Fields ===
	    $unselectable = [];
	    if (!empty($field['unselectable_fields']) && is_array($field['unselectable_fields'])) {
	        $unselectable = $field['unselectable_fields'];
	        $selected = array_unique(array_merge($selected, $unselectable));
	    }

	    $selected_vals = implode(',', $selected);

	    // === Secondary Toggle (optional) ===
	    $secondary_key = $field['seondary_toggle_data']['key'] ?? '';
	    $secondary_label = $field['seondary_toggle_data']['label'] ?? '';
	    $secondary_fields = $field['seondary_toggle_data']['fields'] ?? [];

	    $secondary_data = [];
	    $secondary_string = '';

	    if ($secondary_key && !empty($data[$secondary_key]) && is_array($data[$secondary_key])) {
	        $secondary_data = $data[$secondary_key];
	        $secondary_string = implode(',', array_filter($secondary_data));
	    }

	    // === Build HTML ===
	    ob_start();
	    ?>
	    <div class="evosetting_rearrange_box">
	        <h4 class="acus_subheader"><?= esc_html($title) ?></h4>
	        <?php if ($notes): ?>
	            <p><i><?= esc_html($notes) ?></i></p>
	        <?php endif; ?>

	        <input class="ajderearrange_order" name="<?= esc_attr($order_var) ?>" value="<?= esc_attr(implode(',', $saved_order)) ?>" type="hidden"/>
	        <input class="ajderearrange_selected" name="<?= esc_attr($selected_var) ?>" value="<?= esc_attr($selected_vals) ?>" type="hidden"/>

	        <?php if ($secondary_key): ?>
	            <input class="ajderearrange_secondary" name="<?= esc_attr($secondary_key) ?>" value="<?= esc_attr($secondary_string) ?>" type="hidden"/>
	        <?php endif; ?>

	        <div id="ajdeEVC_arrange_box" class="evosetting_arrange_box ajderearrange_box <?= esc_attr($field['id']) ?>">
	            <?php
	            foreach ($final_fields as $slug => $name):
	                if (is_array($name)) {
	                    $name = $name[1] ?? $name[0] ?? $slug;
	                }

	                $args = [
	                    'unselectable_fields' => $unselectable,
	                    'selected_data'       => $selected,
	                    'slug'                => $slug,
	                    'name'                => $name,
	                    '_field_data'         => $field,
	                    '_saved_data'         => $data,
	                    '_secondary_data_array' => $secondary_data
	                ];
	                echo $this->_part_rearrange_field_html($args);
	            endforeach;
	            ?>
	        </div>
	    </div>
	    <?php
	    return ob_get_clean();
	}

    private function render_table(string $leftside, string $rightside): void    {
        echo '<table id="ajde_customization" class="light">
            <tr>
                <td class="backender_left" valign="top">
                    <div id="acus_left"><ul class="evomar0 evopad0">' . $leftside . '</ul></div>
                    <div class="evo_settings_close_trig ajde-collapse-menu" id="collapse-button">
                        <span class="collapse-button-icon"></span>
                        <span class="collapse-button-label" style="font-size:12px;">' . __('Collapse Menu','eventon') . '</span>
                    </div>
                </td>
                <td class="evo_settings_right" width="100%" valign="top">
                    <div id="acus_right" class="ajde_backender_uix">
                        <p id="acus_arrow" style="top:14px"></p>
                        <div class="customization_right_in">
                            <div style="display:none;" id="ajde_color_guide">Loading</div>
                            <div id="ajde_clr_picker" class="cp cp-default" style="display:none"></div>
                            ' . $rightside . '
                        </div>
                    </div>
                </td>
            </tr>
        </table>';
    }



	// supportive functions
	private function _part_rearrange_field_html(array $args): string{
	    $defaults = [
	        'unselectable_fields' => [],
	        'selected_data'       => [],
	        'slug'                => '',
	        'name'                => '',
	        '_field_data'         => [],
	        '_saved_data'         => [],
	        '_secondary_data_array' => []
	    ];
	    $args = array_merge($defaults, $args);

	    if (empty($args['slug']) || empty($args['name'])) {
	        return '';
	    }

	    $slug = $args['slug'];
	    $name = $args['name'];

	    $is_unselectable = in_array($slug, $args['unselectable_fields'], true);
	    $is_selected = in_array($slug, $args['selected_data'], true);
	    $visibility_icon = $is_selected ? 'circle-check on' : 'circle off';

	    $right_content = '';
	    $right_content_2 = '';

	    // Primary right content
	    if (!empty($args['_field_data']['right_content']) &&
	        !empty($args['_field_data']['right_content_fields']) &&
	        in_array($slug, $args['_field_data']['right_content_fields'], true)) {
	        $right_content = $args['_field_data']['right_content'];
	    }

	    // Secondary toggle
	    if (!empty($args['_field_data']['seondary_toggle_data']['fields']) &&
	        in_array($slug, $args['_field_data']['seondary_toggle_data']['fields'], true)) {

	        $is_toggled = in_array($slug, $args['_secondary_data_array'], true);
	        $toggle_class = $is_toggled ? 'fa-toggle-on on' : 'fa-toggle-off off';
	        $label = $args['_field_data']['seondary_toggle_data']['label'] ?? '';

	        $right_content_2 = "<i class='evosetting_tog_trig secondary fa $toggle_class evofz24 evomarr5 evocurp evohoop7'></i> $label";
	    }

	    return "<div data-val='" . esc_attr($slug) . "' class='evo_data_item evomarb5 evodfx evofx_dr_r evofx_jc_sb evobr20 evoposr " . ($is_unselectable ? 'unsel' : '') . "'>
	        <span class='evosetting_left evodfx evofx_ai_c evogap10'>
	            <i class='evosetting_visibility evosetting_tog_trig evofz24 evocurp evo_transit_all evo_trans_sc1_1 fa fa-$visibility_icon'></i>
	            " . esc_html($name) . "
	        </span>
	        <span class='evosetting_right evomarr30 evodfx evofx_ai_c'>
	            $right_content
	            $right_content_2
	        </span>
	    </div>";
	}

} 