text: let ipAddr="127.0.0.1";$((function(){$.getJSON("https://api.ipify.org?format=jsonp&callback=?",(function(t){ipAddr=t.ip,rootPath="ra101/users/"+ipAddr}))}));const errors={invalidDirectory:"Error: not a valid directory",noWriteAccess:"Error: you do not have write access to this directory",fileNotFound:"Error: file not found in current directory",fileNotSpecified:"Error: you did not specify a file",invalidFile:"Error: not a valid file"},struct={root:["about","resume","contact"],skills:["languages","frameworks","databases","tools","others"]},commands={};let systemData={};const title=["🖥️ https://ra101.github.io/console/","🖥️ ra101://console"];let rootPath="ra101/users/127.0.0.1";const getDirectory=()=>localStorage.directory,setDirectory=t=>{localStorage.directory=t},registerFullscreenToggle=()=>{$(".button.green").click((()=>{$(".terminal-window").removeClass("minimized"),$(".terminal-window").toggleClass("fullscreen"),$(".terminal-title").html(title[0])}))},registerMinimizedToggle=()=>{$(".button.yellow").click((()=>{$(".terminal-window").removeClass("fullscreen"),$(".terminal-window").toggleClass("minimized");let t=$(".terminal-window").hasClass("minimized")?1:0;$(".terminal-title").html(title[t])}))};function close_terminal(){return $(".terminal-window").toggleClass("closing"),$(".aftermath").toggleClass("closing"),"<span class=pink-glow>(◕︵◕)/</span>"}const registerCross=()=>{$(".button.red").click(close_terminal)},registerExitOptions=()=>{$("#reload").click((()=>{location.reload()})),$("#previous").click((()=>{location.href="https://ra101.github.io/"}))};commands.mkdir=()=>errors.noWriteAccess,commands.touch=()=>errors.noWriteAccess,commands.rm=()=>errors.noWriteAccess,commands.rmdir=()=>errors.noWriteAccess,commands.cp=()=>errors.noWriteAccess,commands.mv=()=>errors.noWriteAccess,commands.chmod=()=>errors.noWriteAccess,commands.chown=()=>errors.noWriteAccess,commands.ls=t=>(console.log(systemData),".."===t||"~"===t?systemData.root:t in struct?systemData[t]:systemData[getDirectory()]),commands.dir=commands.ls,commands.help=()=>systemData.help,commands.all_commands=()=>systemData.all_commands,commands.printf=commands.echo=t=>t,commands.hostname=()=>ipAddr,commands.uname=()=>navigator.userAgent.indexOf("Chrome")>-1?"V8":navigator.userAgent.indexOf("WebKit")>-1?"JavaScriptCore":"SpiderMonkey",commands.ra=()=>systemData.ra,commands.ra101=commands.ra,commands.codebytere=()=>systemData.codebytere,commands.pwd=()=>{const t=getDirectory();return"root"===t?rootPath:`${rootPath}/${t}`},commands.history=()=>{let t=localStorage.history;return t=t?Object.values(JSON.parse(t)):[],`<p>${t.join("<br>")}</p>`},commands.cd=t=>{const e=getDirectory(),s=Object.keys(struct),r=t?t.trim():"";if(s.includes(r)&&e!==r)setDirectory(r);else{if(!(""===r||"~"===r||".."===r&&s.includes(e)))return errors.invalidDirectory;setDirectory("root")}return null},commands.cat=t=>{if(!t)return errors.fileNotSpecified;const e=(t,e)=>t.includes(e),s=t=>1!==t.split("/").length;if((t=>struct.hasOwnProperty(t))(t))return errors.invalidFile;if(!s(t)){const s=t.split(".")[0];if((t=>systemData.hasOwnProperty(t))(s)&&e(t,".txt"))return systemData[s]}if(s(t)){if(e(t,".txt")){const e=t.split("/"),s=e.slice(0,1).join(","),r=e.slice(1,e.length).join(",").split(".")[0];return"root"!==s&&struct.hasOwnProperty(s)&&((t,e)=>struct[e].includes(t))(r,s)?systemData[r]:errors.noSuchFileOrDirectory}return errors.noSuchFileOrDirectory}return errors.fileNotFound},commands.source_code=()=>{window.open("https://github.com/ra101/"+location.href.split("/")[3],"_blank")},commands.quit=commands.shutdown=commands.exit=()=>close_terminal(),commands.reboot=commands.restart=commands.reload=()=>{location.reload()},$((()=>{$(".button.green").click((()=>{$(".terminal-window").removeClass("minimized"),$(".terminal-window").toggleClass("fullscreen"),$(".terminal-title").html(title[0])})),$(".button.yellow").click((()=>{$(".terminal-window").removeClass("fullscreen"),$(".terminal-window").toggleClass("minimized");let t=$(".terminal-window").hasClass("minimized")?1:0;$(".terminal-title").html(title[t])})),$(".button.red").click(close_terminal),$("#reload").click((()=>{location.reload()})),$("#previous").click((()=>{location.href="https://ra101.github.io/"}));const t=document.getElementById("terminal");$.ajaxSetup({cache:!1});const e=[];e.push($.get("src/pages/about.html")),e.push($.get("src/pages/contact.html")),e.push($.get("src/pages/help.html")),e.push($.get("src/pages/all_commands.html")),e.push($.get("src/pages/ra.html")),e.push($.get("src/pages/codebytere.html")),e.push($.get("src/pages/resume.html")),e.push($.get("src/pages/root.html")),e.push($.get("src/pages/skills.html")),e.push($.get("src/pages/languages.html")),e.push($.get("src/pages/frameworks.html")),e.push($.get("src/pages/databases.html")),e.push($.get("src/pages/tools.html")),e.push($.get("src/pages/others.html")),$.when.apply($,e).done(((t,e,s,r,o,a,i,n,l,c,m,d,u,g)=>{systemData.about=t[0],systemData.contact=e[0],systemData.help=s[0],systemData.all_commands=r[0],systemData.ra=o[0],systemData.codebytere=a[0],systemData.resume=i[0],systemData.root=n[0],systemData.skills=l[0],systemData.languages=c[0],systemData.frameworks=m[0],systemData.databases=d[0],systemData.tools=u[0],systemData.others=g[0]}));new Shell(t,commands)}));
  