jQuery(document).ready(function ($) {
    // Register the filter
    elementor.hooks.addFilter('cool_formkit/forms/content_template/item', function (field, item, form) {
        // Check the field type and custom control setting

        if (field.field_type == "select" && field['select-field-control'] === 'yes') {
            // Initialize variables
            let selectFieldControl = '';
            let multiSelect = '';
            let multiSelectLimit = '';
            let customId = '';
            let uniqueId = '';   
            let fieldType = '';
            let placeholder = '';
            let borderColor = '';
            let borderWidth = '';
            let borderUnit = '';

            borderColor = form['field_border_color'] ? form['field_border_color'] : '#646060';
            borderWidth = form['field_border_width']['top'] ? form['field_border_width']['top']: '1';
            borderUnit = form['field_border_width']['unit'] ? form['field_border_width']['unit']: 'px';

            if (field.hasOwnProperty('allow_multiple') && field['allow_multiple'] === true) {
                multiSelect = field['allow_multiple'];
                multiSelectLimit = field['select-field-multi-select-limit']? field['select-field-multi-select-limit'] : '';
            }

            selectFieldControl = field['select-field-control'] ? field['select-field-control'] : '';
            placeholder = field['select-field-placeholder'] ? field['select-field-placeholder'] : '';
            customId = field['custom_id'] ? field['custom_id'] : '';
            uniqueId = field['_id'] ? field['_id'] : '';
            fieldType = field['field_type'] ? field['field_type'] : '';
            fieldType = field['field_type'] ? field['field_type'] : '';
            field.css_classes += 'select_data_js';
            field.css_classes += ' ';
            field.css_classes += `cfefuniqueId_${uniqueId} cfefselectFieldControl_${selectFieldControl} cfefmultiSelect_${multiSelect} cfefmultiSelectLimit_${multiSelectLimit} cfefcustomId_${customId} cfeffieldType_${fieldType} cfefplaceholder_${placeholder} cfefborderColor_${borderColor} cfefborderWidth_${borderWidth} cfefborderUnit_${borderUnit}`;

        }
        return field;
    }, 10, 4);
  });
  