<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://cl.waychampofficial.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://cl.waychampofficial.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://cl.waychampofficial.com/wp-sitemap-posts-product-1.xml</loc></sitemap><sitemap><loc>https://cl.waychampofficial.com/wp-sitemap-posts-mailpoet_page-1.xml</loc></sitemap><sitemap><loc>https://cl.waychampofficial.com/wp-sitemap-taxonomies-product_cat-1.xml</loc></sitemap><sitemap><loc>https://cl.waychampofficial.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>

            <script>
            (function(){
                var pending = ["https:\/\/cl.waychampofficial.com\/wp-sitemap-posts-page-1.xml","https:\/\/cl.waychampofficial.com\/wp-sitemap-posts-product-1.xml","https:\/\/cl.waychampofficial.com\/wp-sitemap-posts-mailpoet_page-1.xml","https:\/\/cl.waychampofficial.com\/wp-sitemap-taxonomies-product_cat-1.xml","https:\/\/cl.waychampofficial.com\/wp-sitemap-users-1.xml"];
                var lang = 'es';
                if(pending.length > 0) {
                    var newTranslations = {};
                    var newTranslationsCount = 0;
                    
                    var translateNext = function(index) {
                        if(index >= pending.length) {
                            if(newTranslationsCount > 0) saveBatch();
                            return;
                        }
                        var text = pending[index];
                        
                        var url = 'https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=' + lang + '&dt=t&q=' + encodeURIComponent(text);
                        
                        fetch(url)
                        .then(function(response) { return response.json(); })
                        .then(function(data) {
                            var trans = '';
                            if(data && data[0]) {
                                for(var i=0; i<data[0].length; i++) {
                                    if(data[0][i][0]) trans += data[0][i][0];
                                }
                            }
                            if(trans && trans !== text) {
                                // 1. Reemplazar en texto visible
                                var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false);
                                var node;
                                while(node = walker.nextNode()) {
                                    if(node.nodeValue.includes(text)) {
                                        node.nodeValue = node.nodeValue.replace(text, trans);
                                    }
                                }
                                
                                // 2. Reemplazar en atributos
                                var elements = document.querySelectorAll('[placeholder], [value], [title], [alt]');
                                elements.forEach(function(el) {
                                    ['placeholder', 'value', 'title', 'alt'].forEach(function(attr) {
                                        if (el.hasAttribute(attr) && el.getAttribute(attr).includes(text)) {
                                            el.setAttribute(attr, el.getAttribute(attr).replace(text, trans));
                                        }
                                    });
                                });
                                
                                newTranslations[text] = trans;
                                newTranslationsCount++;
                                
                                if (newTranslationsCount >= 10 || index === pending.length - 1) {
                                    saveBatch();
                                }
                            }
                            
                            setTimeout(function(){ translateNext(index + 1); }, 300);
                        })
                        .catch(function(e) {
                            setTimeout(function(){ translateNext(index + 1); }, 1000);
                        });
                    };
                    
                    var saveBatch = function() {
                        var xhr = new XMLHttpRequest();
                        xhr.open('POST', 'https://cl.waychampofficial.com/wp-admin/admin-ajax.php', true);
                        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;');
                        xhr.send('action=st_save_translations_batch&lang=' + lang + '&data=' + encodeURIComponent(JSON.stringify(newTranslations)));
                        newTranslations = {};
                        newTranslationsCount = 0;
                    };
                    
                    setTimeout(function(){ translateNext(0); }, 1000);
                }
            })();
            </script>
            