<?php

// Require php files.
if ( !function_exists( 'wpt_divi5_contact_form7_enqueue_visual_builder_assets' ) ) {
    /**
     * Enqueue Divi 5 Visual Builder Assets
     *
     * @since 1.0.0
     */
    function wpt_divi5_contact_form7_enqueue_visual_builder_assets() {
        $loader = wpt_divi_contact_form7_container();
        if ( et_core_is_fb_enabled() && et_builder_d5_enabled() ) {
            wp_enqueue_script(
                'd5-wpt-divi-contact-form7',
                $loader['plugin_url'] . '/divi-5/visual-builder/build/d5-wpt-divi-contact-form7.js',
                [
                    'react',
                    'jquery-core',
                    'divi-module-library',
                    'wp-hooks',
                    'divi-rest',
                    'divi-module-library',
                    'divi-vendor-wp-hooks'
                ],
                '1.0.0',
                true
            );
        }
        wp_enqueue_style( 'd5-wpt-divi-contact-form7' );
        $check = false;
        $check_value = ( $check ? 'true' : 'false' );
        wp_add_inline_script( 'd5-wpt-divi-contact-form7', "window.__wpX9fdg__ = {$check_value};", 'before' );
    }

}
add_action( 'divi_visual_builder_assets_before_enqueue_scripts', 'wpt_divi5_contact_form7_enqueue_visual_builder_assets' );
add_action( 'init', function () {
    $loader = wpt_divi_contact_form7_container();
    wp_register_style(
        'd5-wpt-divi-contact-form7',
        $loader['plugin_url'] . '/divi-5/visual-builder/styles/bundle.css',
        false,
        $loader['plugin_version']
    );
    wp_enqueue_script(
        'wpt-cf7-divi',
        $loader['plugin_url'] . '/js/cf7/script.js',
        ['jquery'],
        $loader['plugin_version']
    );
} );