jQuery(function($){
    const $instructionsField = $('textarea[name="woocommerce_advanced_emt_instructions"]');
    if ($instructionsField.length) {
        const $button = $('<button type="button" class="button" style="margin-top: 6px;" id="emt-reset-instructions">Restore Default</button>');
        $instructionsField.after($button);

        $('#emt-reset-instructions').on('click', function(e){
            e.preventDefault();
            const defaultInstructions = emtDefaults.instructions;
            if (defaultInstructions) {
                $instructionsField.val(defaultInstructions);
            }
        });
    }
});