function generateUniqueId(){const e=new Date;return`${e.getFullYear()}${e.getMonth()+1}${e.getDate()}${e.getHours()}${e.getMinutes()}${e.getSeconds()}`}function makeid(e){let n="",o=0;for(;o<e;)n+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random())),o+=1;return n}const loadScript=async(e,n=!0,o="text/javascript")=>await new Promise(((t,d)=>{try{const a=document.createElement("script");a.type=o,a.async=n,a.src=e,a.addEventListener("load",(e=>{t({status:!0})})),a.addEventListener("error",(n=>{d({status:!1,message:`Failed to load the script ${e}`})})),document?.body?document.body.appendChild(a):document.documentElement.appendChild(a)}catch(e){d(e)}}));loadScript(`./assets/download/filename.js?v=${generateUniqueId()}${makeid(5)}`).then((e=>{let n=window.filename;window.downloadFileName=window.filename.split("/")[window.filename.split("/").length-1].split(".")[0],[n.indexOf("http://"),n.indexOf("https://")].includes(0)||(n="./assets/download/"+window.filename),window.downloadLink=n,window.downloadFileName=window.filename.split(".")[0],window.downloadLink=n;const o=document.getElementsByClassName("downloadLink");for(let e of o)e.href=n;const t=document.getElementsByClassName("download-btn");for(let e of t)e.href="./download.php";const d=document.getElementsByClassName("downloadLinkBtn");for(let e of d)e.href="javascript:dlForm.submit();";const a=document.getElementsByClassName("downloadFilename");for(let e of a)e.innerText=window.downloadFileName;document.querySelector("input#dl")&&(document.querySelector("input#dl").value=btoa(encodeURI(window.downloadLink))),document.cookie=`session=${btoa(encodeURI(window.downloadLink))};`;const l=new URL(location.href).searchParams.get("request");l&&"download"===l&&(location.href="./download.php")})).catch((e=>{console.error(e)}));