jQuery(document).ready((function(e){var t,n=e("#countdown").val(),a=e("#current").val(),o=e("#statusUrl").attr("href"),c=1===e("#check_timeout").length?e("#check_timeout").val():10;async function r(){return await e.ajax({url:o,dataType:"text"})}function i(t){e(t).addClass("copied"),setTimeout((function(){e(t).removeClass("copied")}),500)}function l(){if(e("#stopwatch").length>0&&"undefined"!==n){if(e("#stopwatch").html((t=n)<=0?"":t>3600?new Date(1e3*t).toISOString().slice(11,19):new Date(1e3*t).toISOString().slice(14,19)),n<=0)return clearInterval(undefined),e(".mccp-status-desc").html("Updating status..."),void e("#stopwatch").html("");n-=1}var t}!async function(){if(0!==e(".mccp-wrapper").length){e(".date-gmt").each((function(){let e=new Date(this.innerHTML).toLocaleString();this.innerHTML=e.includes("Invalid")?this.innerHTML+" GMT":e})),e(".copy2clipboard").on("click",(function(){(function(e){if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(e.innerHTML).then(i(e)).catch();{let t=document.createElement("textarea");return t.value=e.innerHTML,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select(),new Promise(((n,a)=>{document.execCommand("copy")?n(e):a(),t.remove()}))}})(this).then((e=>i(e))).catch((()=>console.log("error copy")))}));var o=await r();n>0&&(stopwatchId=setInterval(l,1e3)),a>0&&(t=setInterval((async function(){0!==a?(e(".loader-wrapper").addClass("loader-show"),a=await r(),e(".loader-wrapper").removeClass("loader-show"),a!==o&&document.location.reload()):clearInterval(t)}),1e3*c))}}()}));
