(function($) {
    function resetColorsToDefault() {
        // Define default values for your color settings
        const defaultColors = {
            'background_color': '#ffffff',
            'chiropractor_therapy_primary_color': '#03a5c1',
            'chiropractor_therapy_second_color': '#ff9245',
            'chiropractor_therapy_heading_color': '#222222',
            'chiropractor_therapy_text_color': '#707070',
            'chiropractor_therapy_primary_fade' :'#c8ebf1',
            'chiropractor_therapy_footer_bg': '#222222',
            'chiropractor_therapy_post_bg': '#ffffff',
        };

        // Iterate over each setting and set it to its default value
        for (let settingId in defaultColors) {
            wp.customize(settingId).set(defaultColors[settingId]);
        }

        // Optionally refresh the preview
        wp.customize.previewer.refresh();
    }

    // Attach reset function to global scope
    window.resetColorsToDefault = resetColorsToDefault;

    $(document).ready(function() {
        $('.color-reset-btn').val('RESET'); // This adds the 'RESET' text inside the button
    });
})(jQuery);