{"version":3,"sources":["loader.js"],"names":["isBot","botStrings","i","length","navigator","userAgent","indexOf","config","mature","localStorage","getItem","confirmText","confirm","location","href","setItem","window","WebAssembly","ns","document","getElementsByTagName","el","cont","createElement","innerHTML","parentNode","replaceChild","bc","getElementById","classList","add","checkFunction","crypto","subtle","webkitSubtle","head","func","eval","e","loadScript","path","script","type","src","appendChild","loadClient","NodeList","prototype","Symbol","iterator","Array","onload","require","protocol","hostname","serviceWorker","register","scope","catch","err"],"mappings":"CAEA,WAOC,IALA,IAAIA,MACHC,WAAa,CACZ,MAAO,YAAa,UAAW,SAAU,QAAS,YAG3CC,EAAI,EAAGA,EAAID,WAAWE,OAAQD,IACtC,IAAoD,IAAhDE,UAAUC,UAAUC,QAAQL,WAAWC,IAAY,CACtDF,OAAQ,EACR,MAKF,IAAKA,OAASO,OAAOC,SAAWC,aAAaC,QAAQ,iBAAkB,CACtE,IAAIC,YACH,+kBAID,IAAKC,QAAQD,aAEZ,OADAE,SAASC,KAAO,6BAIjBL,aAAaM,QAAQ,gBAAiB,QAIvC,IAAKC,OAAOC,YAAa,CAGxB,IAFA,IAAIC,GAAKC,SAASC,qBAAqB,YAEhCF,GAAGf,QAAQ,CACjB,IAAIkB,GAAKH,GAAG,GACXI,KAAOH,SAASI,cAAc,OAC/BD,KAAKE,UAAYH,GAAGG,UACpBH,GAAGI,WAAWC,aAAaJ,KAAMD,IAGlC,IAAIM,GAAKR,SAASS,eAAe,iBAGjC,OAFAD,GAAGE,UAAUC,IAAI,SACjBH,GAAGH,UAAY,8BAKXO,cAAc,iCAClBf,OAAOgB,OAAOC,OAASjB,OAAOgB,OAAOE,cAMtC,IAAIC,KAAOhB,SAASC,qBAAqB,QAAQ,GAIjD,SAASW,cAAcK,MACtB,IAEC,MAA6B,mBAAfC,KAAKD,MAClB,MAAOE,GACR,OAAO,GAIT,SAASC,WAAWC,GACnB,IAAIC,EAAStB,SAASI,cAAc,UAIpC,OAHAkB,EAAOC,KAAO,kBACdD,EAAOE,IAAM,WAAaH,EAAO,MACjCL,KAAKS,YAAYH,GACVA,EAGR,SAASI,aAEHd,cAAc,yCAClBe,SAASC,UAAUC,OAAOC,UACzBC,MAAMH,UAAUC,OAAOC,WAgBzBV,WAAW,WAAWY,OAAS,WAC9BC,QAAQ,SAIL,kBAAmBhD,YACA,WAAtBS,SAASwC,UACa,cAAtBxC,SAASyC,WAETlD,UAAUmD,cACRC,SAAS,+BAAgC,CAAEC,MAAO,MAClDC,MAAM,SAAUC,GAChB,MAAMA,IApDVd,aAvDD","file":"../loader.js","sourcesContent":["// Selects and loads the client files and polyfills, if any. Use only ES5.\n\n(function () {\n\t// Check if the client is an automated crawler\n\tvar isBot,\n\t\tbotStrings = [\n\t\t\t\"bot\", \"googlebot\", \"crawler\", \"spider\", \"robot\", \"crawling\"\n\t\t];\n\n\tfor (var i = 0; i < botStrings.length; i++) {\n\t\tif (navigator.userAgent.indexOf(botStrings[i]) !== -1) {\n\t\t\tisBot = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Display mature content warning\n\tif (!isBot && config.mature && !localStorage.getItem(\"termsAccepted\")) {\n\t\tvar confirmText =\n\t\t\t\"To access this website you understand and agree to the following:\\n\\n\" +\n\t\t\t\"1. The content of this website is for mature audiences only and may not be suitable for minors. If you are a minor or it is illegal for you to access mature images and language, do not proceed.\\n\\n\" +\n\t\t\t\"2. This website is presented to you AS IS, with no warranty, express or implied. By proceeding you agree not to hold the owner(s) of the website responsible for any damages from your use of the website, and you understand that the content posted is not owned or generated by the website, but rather by the website's users.\";\n\n\t\tif (!confirm(confirmText)) {\n\t\t\tlocation.href = \"http://www.gaiaonline.com/\";\n\t\t\treturn;\n\t\t}\n\n\t\tlocalStorage.setItem(\"termsAccepted\", \"true\");\n\t}\n\n\t// Really old browser. Run in noscript mode.\n\tif (!window.WebAssembly) {\n\t\tvar ns = document.getElementsByTagName(\"noscript\");\n\n\t\twhile (ns.length) { // Collection is live and changes with DOM updates\n\t\t\tvar el = ns[0],\n\t\t\t\tcont = document.createElement(\"div\");\n\t\t\tcont.innerHTML = el.innerHTML;\n\t\t\tel.parentNode.replaceChild(cont, el);\n\t\t}\n\n\t\tvar bc = document.getElementById(\"banner-center\");\n\t\tbc.classList.add(\"admin\");\n\t\tbc.innerHTML = \"UPDATE YOUR FUCKING BROWSER\";\n\t\treturn;\n\t}\n\n\t// Remove prefixes on Web Crypto API for Safari\n\tif (!checkFunction(\"window.crypto.subtle.digest\")) {\n\t\twindow.crypto.subtle = window.crypto.webkitSubtle;\n\t}\n\n\t// TODO: Uncomment for WASM client rewrite\n\t// var wasm = /[\\?&]wasm=true/.test(location.search);\n\n\tvar head = document.getElementsByTagName('head')[0];\n\tloadClient();\n\n\t// Check if a browser API function is defined\n\tfunction checkFunction(func) {\n\t\ttry {\n\t\t\t// See comment on line 134\n\t\t\treturn typeof eval(func) === 'function';\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction loadScript(path) {\n\t\tvar script = document.createElement('script');\n\t\tscript.type = 'text/javascript';\n\t\tscript.src = '/assets/' + path + '.js';\n\t\thead.appendChild(script);\n\t\treturn script;\n\t}\n\n\tfunction loadClient() {\n\t\t// Iterable NodeList\n\t\tif (!checkFunction('NodeList.prototype[Symbol.iterator]')) {\n\t\t\tNodeList.prototype[Symbol.iterator] =\n\t\t\t\tArray.prototype[Symbol.iterator];\n\t\t}\n\n\t\t// TODO: Uncomment for WASM client rewrite\n\t\t// if (wasm) {\n\t\t// \twindow.Module = {};\n\t\t// \tfetch(\"/assets/wasm/main.wasm\").then(function (res) {\n\t\t// \t\treturn res.arrayBuffer();\n\t\t// \t}).then(function (bytes) {\n\t\t// \t\t// TODO: Parallel downloads of main.js and main.wasm\n\t\t// \t\tvar script = document.createElement('script');\n\t\t// \t\tscript.src = \"/assets/wasm/main.js\";\n\t\t// \t\tModule.wasmBinary = bytes;\n\t\t// \t\tdocument.head.appendChild(script);\n\t\t// \t});\n\t\t// } else {\n\t\tloadScript(\"js/main\").onload = function () {\n\t\t\trequire(\"main\");\n\t\t};\n\t\t// }\n\n\t\tif ('serviceWorker' in navigator && (\n\t\t\tlocation.protocol === \"https:\" ||\n\t\t\tlocation.hostname === \"localhost\"\n\t\t)) {\n\t\t\tnavigator.serviceWorker\n\t\t\t\t.register(\"/assets/js/scripts/worker.js\", { scope: \"/\" })\n\t\t\t\t.catch(function (err) {\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\t\t}\n\t}\n})();\n"]}