(()=>{"use strict";tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})})(),(()=>{const e=document.getElementById("yasr-user-log-page-navigation-buttons"),t=document.getElementById("yasr-admin-log-page-navigation-buttons");function n(e="yasr-user"){let t=!1;"yasr-admin"===e&&(t=!0);const n=document.getElementById(`${e}-log-total-pages`).dataset.yasrLogTotalPages,a=`${e}_change_log_page`,r=document.getElementById(`${e}-log-nonce-page`).value;let s=[],l=[],c=[],u=[],i=!1,d=!1,g=[];!0===t&&(i=[],d=[]);for(let n=0;n<8;n++)s[n]=document.getElementById(`${e}-log-div-child-${n}`),l[n]=document.getElementById(`${e}-log-vote-${n}`),c[n]=document.getElementById(`${e}-log-post-${n}`),u[n]=document.getElementById(`${e}-log-date-${n}`),!0===t&&(i[n]=document.getElementById(`${e}-log-user-${n}`),d[n]=document.getElementById(`${e}-log-avatar-${n}`),g[n]=document.getElementById(`${e}-log-ip-${n}`)||!1);o(s,l,c,u,n,i,d,e,g,a,r)}function o(n,a,r,s,l,c,u,i,d,g,y){document.querySelectorAll(`.${i}-log-page-num`).forEach((function(p){p.addEventListener("click",(function(){const p=parseInt(this.value);!function(n,o,a){n=parseInt(n);let r="";n>=3&&o>3&&(r+=`<button class="${a}-log-page-num" value="1">\n            &laquo; First </button>&nbsp;&nbsp;...&nbsp;&nbsp;`);let s=n-1;s<=0&&(s=1);let l=n+1;l>=o&&(l=o);for(let e=s;e<=l;e++)r+=e===n?`<button class="button-primary" value="${e}">${e}</button>&nbsp;&nbsp;`:`<button class="${a}-log-page-num" value="${e}">${e}</button>&nbsp;&nbsp;`;if(o>3&&n<o&&(r+=`...&nbsp;&nbsp;\n            <button class="${a}-log-page-num" value="${o}"> Last &raquo;</button>&nbsp;&nbsp;`),"yasr-admin"===a)return t.innerHTML=r;e.innerHTML=r}(p,l,i),function(e,t,n,a,r,s,l,c,u,i,d,g){const y=document.getElementById(`${i}-log-loader-metabox`);y.style.display="inline";const p={action:d,pagenum:e,totalpages:l,yasr_user_log_nonce:g};fetch(yasrWindowVar.ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(p).toString()}).then((e=>{if(!0===e.ok)return e.json();throw new Error("Ajax Call Failed.")})).then((e=>{if("object"!=typeof e||Array.isArray(e)||null===e)throw new Error(`The response is not an object, response is: ${e}`);if(Object.hasOwn(e,"status")){if("success"!==e.status)throw new Error(e.message);m(e),o(t,n,a,r,l,c,u,i,s,d,g)}})).catch((e=>{console.error("Fetch network error",e)})).catch((e=>{console.error("Error with the Query",e)})).finally((()=>{y.style.display="none"}));const m=e=>{let o;for(let l=0;l<8;l++)e.data[l]?(t[l].style.display="block",n[l].innerText=parseInt(e.data[l].vote),Array.isArray(c)&&(c[l].innerText=e.data[l].user_nicename),Array.isArray(u)&&(u[l].src=e.data[l].avatar_url),l in s&&(s[l].innerText=e.data[l].ip),o=`<a href="${e.data[l].permalink}">${e.data[l].post_title}</a>`,a[l].innerHTML=o,r[l].innerText=e.data[l].date):t[l].style.display="none"}}(p,n,a,r,s,d,l,c,u,i,g,y)}))}))}e&&n(),t&&n("yasr-admin")})();