// source --> https://www.enda.org.br/wp-content/plugins/email-encoder-bundle/assets/js/custom.js?ver=2c542c9989f589cd5318f5cef6a9ecd7 
/* Email Encoder */
/*global jQuery, window*/
jQuery(function ($) {

    'use strict';

    // encoding method
    function rot13(s) {
        // source: http://jsfromhell.com/string/rot13
        return s.replace(/[a-zA-Z]/g, function (c) {
            return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
        });
    }

    /**
     * EMAIL RELATED LOGIC
     */

    // fetch email from data attribute
    function fetchEmail(el) {
        var email = el.getAttribute('data-enc-email');

        if (!email) {
            return null;
        }

        // replace [at] sign
        email = email.replace(/\[at\]/g, '@');

        // encode
        email = rot13(email);

        return email;
    }

    // replace email in title attribute
    function parseTitle(el) {
        var title = el.getAttribute('title');
        var email = fetchEmail(el);

        if (title && email) {
            title = title.replace('{{email}}', email);
            el.setAttribute('title', title);
        }
    }

    // set input value attribute
    function setInputValue(el) {
        var email = fetchEmail(el);

        if (email) {
            el.setAttribute('value', email);
        }
    }

    // open mailto link
    function mailto(el) {
        var email = fetchEmail(el);

        if (email) {
            window.location.href = 'mailto:' + email;
        }
    }
    
    // revert
    function revert(el, rtl) {
        var email = fetchEmail(el);

        if (email) {
           rtl.text(email);
           rtl.removeClass('eeb-rtl');
        }
    }

    // prepare for copying email
    document.addEventListener('copy', function(e){
        $('a[data-enc-email]').each(function () {
            var rtl = $(this).find('.eeb-rtl');

            if (rtl.text()) {
                revert(this, rtl);
            }
        });
        console.log('copy');
    });

    // set mailto click
    $('body').on('click', 'a[data-enc-email]', function () {
        mailto(this);
    });

    // parse title attirbute
    $('a[data-enc-email]').each(function () {
        parseTitle(this);
    });

    // parse input fields
    $('input[data-enc-email]').each(function () {
        setInputValue(this);
    });

});
// source --> https://www.enda.org.br/wp-content/plugins/woo-boleto-paghiper/assets/js/frontend.min.js?ver=1.0 
"use strict";function copyPaghiperEmv(){var e=document.querySelector(".paghiper-pix-code"),t=e.querySelector("textarea"),e=e.querySelector("button");t.select(),t.setSelectionRange(0,99999),navigator.clipboard.writeText(t.value),e.dataset.originalText=e.innerHTML,e.innerHTML="Copiado!",setTimeout(function(e){var t=e.dataset.originalText;e.innerHTML=t,document.getSelection().removeAllRanges()},2e3,e)}function checkForTaxIdFields(){var r=document.querySelectorAll('[name="billing_cpf"], [name="billing_cnpj"]'),c=document.querySelectorAll('[name="billing_first_name"], [name="billing_company"]'),e=document.querySelectorAll(".wc-paghiper-form");[].forEach.call(e,function(e){var t=e.querySelector(".paghiper-taxid-fieldset"),a=e.querySelector(".paghiper-payername-fieldset"),i=!1,n=!1;t&&(0<r.length?t.classList.add("paghiper-hidden"):(t.classList.remove("paghiper-hidden"),i=!0)),a&&(0<c.length?a.classList.add("paghiper-hidden"):(a.classList.remove("paghiper-hidden"),n=!0)),i||n?e.classList.remove("paghiper-hidden"):e.classList.add("paghiper-hidden")})}jQuery(document).ready(function(e){var t;"function"==typeof e(".paghiper_tax_id").mask&&(t=function(){function n(e){return 11<e.replace(/\D/g,"").length?"00.000.000/0000-00":"000.000.000-009"}e(".paghiper_tax_id").mask(n,{clearIfNotMatch:!0,placeholder:"___.___.___-__",onKeyPress:function(e,t,a,i){a.mask(n.apply({},arguments),i)}})},e(document.body).on("updated_checkout",function(e){t()}),t()),e(document.body).on("updated_checkout",function(e){checkForTaxIdFields()}),checkForTaxIdFields()});