(function(){ var L="69985f23129bb2553a09f2a1",A="https://forms.bytebio.com/api/apps/694a8e12d9e7efcc258055d3/functions/redirectWhatsApp",PH="5516996104220"; var CA=["a[href=\"#whatsapp\"]","a[href=\"#solicitar-agora\"]"]; function g(){var p=new URLSearchParams(window.location.search),u={};["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid"].forEach(function(k){var v=p.get(k);if(v)u[k]=v});return u} function r(){try{return JSON.parse(localStorage.getItem("bt_"+L))||{}}catch(e){return{}}} function s(d){try{localStorage.setItem("bt_"+L,JSON.stringify(d))}catch(e){}} var st=r(),cu=g(); if(Object.keys(cu).length>0){Object.assign(st,cu);st.lp=window.location.href;s(st)} if(!st.fv){st.fv=new Date().toISOString();if(!st.lp)st.lp=window.location.href;s(st)} function bfb(el){ var h=el?el.href||el.getAttribute("href")||"":""; var ot=""; try{var u=new URL(h,window.location.href);ot=u.searchParams.get("text")||""}catch(x){} var fb="https://api.whatsapp.com/send?phone="+PH; if(ot)fb+="&text="+encodeURIComponent(ot); return fb; } function hc(e){ e.preventDefault(); var el=e.currentTarget; var fb=bfb(el); var d=r(),t={}; ["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid"].forEach(function(k){if(d[k])t[k]=d[k]}); t.parent_url=d.lp||window.location.href; t.page_title=document.title||""; t.parent_referrer=document.referrer||""; t.screen_resolution=window.screen.width+"x"+window.screen.height; t.browser_language=navigator.language||""; t.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone||""; t.local_datetime=new Date().toLocaleString("pt-BR"); var tx=(el.innerText||el.textContent||"").trim(); if(!tx&&el.parentElement)tx=(el.parentElement.innerText||el.parentElement.textContent||"").trim(); t.click_element_text=tx.substring(0,255); t.click_element_id=el.id||(el.parentElement&&el.parentElement.id)||""; var cl=(typeof el.className==="string"?el.className:el.getAttribute&&el.getAttribute("class")||"").trim(); if(!cl&&el.parentElement)cl=(typeof el.parentElement.className==="string"?el.parentElement.className:"").trim(); t.click_element_classes=cl; t.click_element_href=el.href||""; var an=window.location.hash||""; if(!an){try{an=new URL(el.href).hash||""}catch(x){}} if(!an){var hr=el.getAttribute("href")||"";if(hr.charAt(0)==="#")an=hr;} if(an)t.click_anchor=an; try{var lu=new URL(el.href);var ot=lu.searchParams.get("text")||"";if(ot)t.original_text=ot}catch(x){} var done=false; var tm=setTimeout(function(){if(!done){done=true;window.location.href=fb}},2500); fetch(A,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:L,tracking:t}),keepalive:true}).then(function(r){return r.json()}).then(function(rs){if(!done){done=true;clearTimeout(tm);window.location.href=rs.whatsappUrl||fb}}).catch(function(){if(!done){done=true;clearTimeout(tm);window.location.href=fb}}); } function il(){ var sel='a[href*="wa.me"],a[href*="api.whatsapp.com"],a[href*="whatsapp.com"]'; if(CA.length>0)sel+=","+CA.join(","); var lks=document.querySelectorAll(sel); lks.forEach(function(el){ if(el.dataset.bti)return;el.dataset.bti="1"; el.addEventListener("click",hc); })}; if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",il)}else{il()} var ob=new MutationObserver(function(){il()}); ob.observe(document.body||document.documentElement,{childList:true,subtree:true}); })();