const REQ_TIMEOUT_SHORT=1500,REQ_TIMEOUT_MEDIUM=5e3,REQ_TIMEOUT_LONG=9e3,STATUS_REFRESH_INTERVAL=isWebInterface?1e3:5e3,SPINNER_HTML='<div class="txSpinner">Loading...</div>',anyUndefined=(...e)=>[...e].some((e=>void 0===e)),xss=e=>{let t=document.createElement("div");return t.innerText=e,t.innerHTML},convertMarkdown=(e,t=!1)=>{const n=xss(e).replaceAll(/\n/g,"  \n").replaceAll(/\t/g,"&emsp;");return(t?marked.parseInline:marked.parse)(n,{breaks:!0})};document.addEventListener("DOMContentLoaded",(function(e){void 0!==$.notifyDefaults&&$.notifyDefaults({z_index:2e3,mouse_over:"pause",placement:{align:"center"},offset:{y:64}}),"undefined"!=typeof jconfirm&&(jconfirm.defaults={title:"Confirm:",draggable:!1,escapeKey:!0,closeIcon:!0,backgroundDismiss:!0,typeAnimated:!1,animation:"scale",type:"red",columnClass:"medium",theme:document.body.classList.contains("theme--dark")?"dark":"light"})}));const pfpList=document.getElementsByClassName("profile-pic");for(let e of pfpList)e.addEventListener("error",(()=>{"img/default_avatar.png"!=e.src&&(e.src="img/default_avatar.png")}));const checkApiLogoutRefresh=e=>!0===e.logout?(window.location="/auth?logout",!0):!0===e.refresh&&(window.location.reload(!0),!0),updateMarkdownNotification=(e,t)=>{if(!0===e.markdown){let n=convertMarkdown(e.message,!0);"danger"===e.type&&(n+='<div class="text-right">\n                <small>\n                    For support, visit <strong><a href="http://discord.gg/txAdmin" target="_blank" class="text-dark">discord.gg/txAdmin</a></strong>.\n                </small>\n            </div>'),t.update("progress",0),t.update("type",e.type),t.update("message",n),setTimeout((()=>{t.update("progress",0)}),5e3)}else t.update("progress",0),t.update("type",e.type),t.update("message",e.message);return!1},txAdminAPI=({type:e,url:t,data:n,dataType:o,timeout:i,success:s,error:a})=>!anyUndefined(e,t)&&(t=TX_BASE_PATH+t,i=i||5e3,s=s||(()=>{}),a=a||(()=>{}),$.ajax({type:e,url:t,timeout:i,data:n,dataType:o,success:s,error:a})),txAdminConfirm=({content:e,confirmBtnClass:t,modalColor:n,title:o})=>new Promise(((i,s)=>{$.confirm({title:o,content:e,type:n||"red",buttons:{cancel:()=>{i(!1)},confirm:{btnClass:t||"btn-red",keys:["enter"],action:()=>{i(!0)}}},onClose:()=>{i(!1)}})})),txAdminPrompt=({confirmBtnClass:e="btn-blue",modalColor:t="blue",title:n="",description:o="",placeholder:i="",required:s=!0})=>new Promise(((a,d)=>{$.confirm({title:n,type:t,content:`\n                <form action="">\n                    <div class="form-group">\n                        <label>${o}</label>\n                        <input type="text" placeholder="${i}" class="inputField form-control" ${s&&"required"} />\n                    </div>\n                </form>`,buttons:{cancel:()=>{a(!1)},formSubmit:{text:"Submit",btnClass:e,action:function(){a(this.$content.find(".inputField").val())}}},onClose:()=>{a(!1)},onContentReady:function(){const e=this;this.$content.find("form").on("submit",(function(t){t.preventDefault(),e.$$formSubmit.trigger("click")})),this.$content.find("input").focus()}})}));!function(){if(!isWebInterface)return;if(null===document.cookie.match(/(^| )txAdmin-darkMode=([^;]+)/))if(console.log("no theme cookie found"),window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)console.log("OS dark mode detected"),document.body.classList.toggle("theme--dark"),document.cookie="txAdmin-darkMode=true;path=/";else if("/"==window.location.pathname){const e=864e5;if(null===document.cookie.match(/(^| )txAdmin-darkModeSuggestion=([^;]+)/)){const t=new Date;t.setTime(t.getTime()+e);const n=document.getElementById("darkToggleArea"),o=new coreui.Tooltip(n,{container:"body",boundary:"window",offset:function(e){return[0,e.popper.height/3]}});setTimeout((()=>{o.show(),document.cookie=`txAdmin-darkModeSuggestion=true;expires=${t.toUTCString()};path=/`}),2e3)}}const e="d-none";let t=document.body.classList.contains("theme--dark");const n=document.getElementById("darkToggleDark"),o=document.getElementById("darkToggleLight");n.classList.toggle(e,t),o.classList.toggle(e,!t);const i=function(){document.body.classList.toggle("theme--dark"),n.classList.toggle(e),o.classList.toggle(e),t=!t,document.cookie=`txAdmin-darkMode=${t};path=/`};n.addEventListener("click",i),o.addEventListener("click",i)}();