forked from Zirak/SO-ChatBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaster.min.js.orig
4 lines (4 loc) · 124 KB
/
master.min.js.orig
1
2
3
4
var IO=window.IO={events:{},preventDefault:!1,register:function(e,t,n){return this.events[e]||(this.events[e]=[]),this.events[e].push({fun:t,thisArg:n,args:Array.prototype.slice.call(arguments,3)}),this},unregister:function(e,t){return this.events[e]?(this.events[e]=this.events[e].filter(function(e){return e.fun!==t}),this):this},fire:function(e){function t(e){var t=e.fun.apply(e.thisArg,e.args.concat(n));o.preventDefault=t===!1}if(this.preventDefault=!1,this.events[e]){var n=Array.prototype.slice.call(arguments,1),o=this;this.events[e].forEach(t)}},urlstringify:function(){var e={number:!0,string:!0,"boolean":!0},t=function(t){return typeof t in e?encodeURIComponent(""+t):""},n=function(e,n){return e=t(e),n.map(function(t){return o(e,t,!0)}).join("&")},o=function(e,n,o){return o||(e=t(e)),e+"="+t(n)};return function(e){return Object.keys(e).map(function(t){var r=e[t];return Array.isArray(r)?n(t,r):o(t,r)}).join("&")}}(),loadScript:function(e,t){var n=document.createElement("script");n.src=e,n.onload=t,document.head.appendChild(n)}};IO.htmlToMarkdown=function(){var e={i:"*",b:"**",strike:"---",code:"`",a:function(e,t,n){var o=/href="([^"]+?)"/.exec(e);return o?"["+n+"]("+o[1]+")":e}},t=/<(\S+)[^\>]*>([^<]+)<\/\1>/g;return function(n){function o(t,n,o){return e.hasOwnProperty(n)?(r=e[n],r.apply?e[n].apply(e,arguments):r+o+r):t}var r;return n.replace(t,o)}}(),IO.decodehtmlEntities=function(){var e;e={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",zwnj:"",zwsp:""};var t=/&(#x?)?[\w;]+?;/g,n=function(e){return e.slice(1).split(";").map(o).join("")},o=function(t){return t?"#"===t[0]?r(t):e.hasOwnProperty(t)?e[t]:"&"+t+";":""},r=function(e){e=e.slice(1);var t;return t="x"===e[0]?parseInt(e.slice(1),16):parseInt(e,10),String.fromCharCode(t)};return function(e){return e.replace(t,n)}}(),["in","out"].forEach(function(e){var t=e+"put";IO[e]={buffer:[],receive:function(e){return IO.fire("receive"+t,e),IO.preventDefault?this:(this.buffer.push(e),this)},tick:function(){return this.buffer.length&&IO.fire(t,this.buffer.shift()),this},flush:function(){if(IO.fire("before"+t),!this.buffer.length)return this;for(var e=this.buffer.length;e-->0;)this.tick();return IO.fire("after"+t),this.buffer=[],this}}}),IO.CBuffer=function(e){var t={items:[],pos:0,size:e};return t.add=function(t){this.pos===e&&(this.pos=0),this.items[this.pos]=t,this.pos+=1},t.contains=function(e){return this.items.indexOf(e)>-1},t},IO.relativeUrlToAbsolute=function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.href},IO.injectScript=function(e){var t=document.createElement("script");return t.src=e,document.head.appendChild(t),t},IO.xhr=function(e){e=Object.merge({method:"GET",headers:{},complete:function(){}},e),e.headers=Object.merge({"Content-Type":"application/x-www-form-urlencoded"},e.headers),"object"!=typeof e.data||e.data.charAt||(e.data=IO.urlstringify(e.data));var t=new XMLHttpRequest;return t.open(e.method,e.url),t.addEventListener("readystatechange",function(){4===t.readyState&&e.complete.call(e.thisArg,t.responseText,t)}),Object.iterate(e.headers,function(e,n){t.setRequestHeader(e,n)}),t.send(e.data),t},IO.jsonp=function(e){e.data=e.data||{},e.jsonpName=e.jsonpName||"jsonp";var t,n=document.createElement("script");do t="IO"+Date.now()*Math.ceil(Math.random());while(window[t]);window[t]=function(){e.fun.apply(e.thisArg,arguments),delete window[t],n.parentNode.removeChild(n)},e.data[e.jsonpName]=t,-1===e.url.indexOf("?")&&(e.url+="?"),e.url+="&"+this.urlstringify(e.data),n.onerror=e.error,n.src=e.url,document.head.appendChild(n)},IO.jsonp.google=function(e,t){IO.jsonp({url:"http://ajax.googleapis.com/ajax/services/search/web",jsonpName:"callback",data:{v:"1.0",q:e},fun:t})},Object.merge=function(){return[].reduce.call(arguments,function(e,t){return Object.keys(t).forEach(function(n){e[n]=t[n]}),e},{})},Object.iterate=function(e,t,n){Object.keys(e).forEach(function(o){t.call(n,o,e[o],e)})},Object.TruthMap=function(e){function t(e,t){return e[t]=!0,e}return(e||[]).reduce(t,Object.create(null))},Array.from=function(e,t){return[].slice.call(e,t)},Object.defineProperty(Array.prototype,"invoke",{value:function(e){function t(t){var o=t;return t[e]&&t[e].apply&&(o=t[e].apply(t,n)),o}var n=Array.from(arguments,1);return this.map(t)},configurable:!0,writable:!0}),Object.defineProperty(Array.prototype,"first",{value:function(e){return this.some(function(t){return e.apply(null,arguments)&&((e=t)||!0)})?e:null},configurable:!0,writable:!0}),Object.defineProperty(Array.prototype,"random",{value:function(){return this[Math.floor(Math.random()*this.length)]},configurable:!0,writable:!0}),["forEach","map","filter","reduce"].forEach(function(e){var t=[][e];Array[e]=function(){return t.call.apply(t,arguments)}}),String.prototype.indexesOf=function(e,t){for(var n=(t||0)-1,o=[];(n=this.indexOf(e,n+1))>-1;)o.push(n);return o},String.prototype.supplant=function(e){function t(e,t){return n.hasOwnProperty(t)?n[t]:e}var n=Object(e)===e?e:arguments;return this.replace(/\{([^\}]+)\}/g,t)},String.prototype.startsWith=function(e){return 0===this.indexOf(e)},Function.prototype.throttle=function(e){var t=this,n=-1,o=function(){clearTimeout(n);var o=this,r=arguments;n=setTimeout(function(){t.apply(o,r)},e)};return o},Function.prototype.memoize=function(){var e=Object.create(null),t=this;return function(n){if(n in e)return e[n];var o=t.apply(null,arguments);return e[n]=o,o}},Function.prototype.memoizeAsync=function(e){var t=Object.create(null),n=this;return e=e||function(e){return e},function(){function o(){t[a]=arguments,i.apply(null,arguments)}var r=Array.from(arguments),i=r.pop(),a=e.apply(null,arguments);return a in t?(i.apply(null,t[a]),void 0):(r.push(o),n.apply(this,r),void 0)}},Number.prototype.maxDecimal=function(e){var t=Math.pow(10,e);return Math.floor(this*t)/t},Number.prototype.fallsAfter=function(e){e=e.slice();for(var t,n=e.shift(),o=this.valueOf(),r=0,i=e.length;i>r&&(t=e[r],!(t>o));r++)n=t;return o>=n?n:null},Math.ratio=function(e,t){e=Number(e),t=Number(t);var n=this.gcd(e,t);return e/n+":"+t/n},Math.gcd=function(e,t){return t?this.gcd(t,e%t):e},Math.rand=function(e,t){return e===void 0?(e=0,t=9):t===void 0&&(t=e,e=0),Math.floor(Math.random()*(t-e+1))+e},Object.defineProperty(RegExp.prototype,"toJSON",{value:function(){return""+this},configurable:!0,writable:!0}),RegExp.escape=function(e){return e.replace(/[-^$\\\/\.*+?()[\]{}|]/g,"\\$&")},Date.timeSince=function(e,t){function n(e,t){return e=Math.floor(e),t+=1===e?"":"s",e+" "+t}t=t||new Date;for(var o,r=t-e,i=[{delta:31536e6,suffix:"year"},{delta:2592e6,suffix:"month"},{delta:864e5,suffix:"day"},{delta:36e5,suffix:"hour"},{delta:6e4,suffix:"minute"},{delta:1e3,suffix:"second"}];o=i.shift();)if(r>=o.delta)return n(r/o.delta,o.suffix);return n(r,"millisecond")},function(){"use strict";var e=window.bot={invocationPattern:"!!",commands:{},commandDictionary:null,listeners:[],info:{invoked:0,learned:0,forgotten:0,start:new Date},users:{},parseMessage:function(t){if(!this.validateMessage(t))return e.log(t,"parseMessage invalid"),void 0;var n=this.prepareMessage(t),o=n.get("user_id");if(e.log(n,"parseMessage valid"),this.banlist.contains(o))return e.log(t,"parseMessage banned"),this.banlist[o].told||(n.reply("You iz in mindjail"),this.banlist[o].told=!0),void 0;try{/^c?>/.test(n)?this.eval(""+n,n.directreply.bind(n)):this.invokeAction(n)}catch(r){var i="Could not process input. Error: "+r.message;r.lineNumber&&(i+=" on line "+r.lineNumber),r.column&&(i+=" on column "+r.column),n.directreply(i),console.error(r.stack)}finally{this.info.invoked+=1}},invokeAction:function(e){var t=e.trim().replace(/^\/\s*/,"").split(" ")[0],n=this.getCommand(t),o=e.startsWith("/")?!n.error:!0;n.error?o&&(o=this.callListeners(e)):this.execCommand(n,e),o||e.reply(this.giveUpMessage(n.guesses))},giveUpMessage:function(e){var t="That didn't make much sense.";return t+=e&&e.length?" Maybe you meant: "+e.join(", "):" Use the `!!/help` command to learn more."},execCommand:function(t,n){if(e.log(t,"execCommand calling"),!t.canUse(n.get("user_id")))return n.reply(["You do not have permission to use the command "+t.name,"I'm afraid I can't let you do that, "+n.get("user_name")].random()),void 0;var o=this.Message(n.replace(/^\/\s*/,"").slice(t.name.length).trim(),n.get()),r=t.exec(o);r&&n.reply(r)},prepareMessage:function(e){e=this.adapter.transform(e);var t=IO.htmlToMarkdown(e.content);return t=IO.decodehtmlEntities(t),t=t.replace(/\u200b|\u200c/g,""),this.Message(t.slice(this.invocationPattern.length).trim(),e)},validateMessage:function(t){var n=t.content.trim();return"!!"===this.invocationPattern&&/^!!!+$/.test(n)?(console.log("special skip"),!1):t.user_id!==e.adapter.user_id&&n.startsWith(this.invocationPattern)},addCommand:function(e){e.exec&&e.del||(e=this.Command(e)),e.learned&&(this.info.learned+=1),e.invoked=0,this.commands[e.name]=e,this.commandDictionary.trie.add(e.name)},commandExists:function(e){return this.commands.hasOwnProperty(e)},getCommand:function(e){var t=e.toLowerCase();if(this.commandExists(t))return this.commands[t];this.commandDictionary.maxCost=Math.floor(e.length/5+1);var n="Command "+e+" does not exist.",o=this.commandDictionary.search(e);return o.length&&(n+=" Did you mean: "+o.join(", ")),{error:n,guesses:o}},listen:function(e,t,n){Array.isArray(e)?e.forEach(function(e){this.listen(e,t,n)},this):this.listeners.push({pattern:e,fun:t,thisArg:n})},callListeners:function(t){return this.listeners.some(function(n){var o,r=t.exec(n.pattern);return r?(o=n.fun.call(n.thisArg,t),e.log(r,o),o&&t.reply(o),o!==!1):void 0})},stoplog:!1,log:function(){this.stoplog||console.log.apply(console,arguments)},stop:function(){this.stopped=!0},"continue":function(){this.stopped=!1},devMode:!1,activateDevMode:function(e){this.devMode=!0,this.invocationPattern=e||"beer!",IO.events.userjoin.length=0,this.validateMessage=function(e){return e.content.trim().startsWith(this.invocationPattern)}}};e.memory={saveInterval:9e5,data:{},get:function(e,t){return this.data[e]||this.set(e,t||{}),this.data[e]},set:function(e,t){this.data[e]=t},loadAll:function(){var e=this;Object.iterate(localStorage,function(t,n){t.startsWith("bot_")&&(console.log(t,n),e.set(t.replace(/^bot_/,""),JSON.parse(n)))})},save:function(e){if(e)return localStorage["bot_"+e]=JSON.stringify(this.data[e]),void 0;var t=this;Object.keys(this.data).forEach(function(e){t.save(e)}),this.saveLoop()},saveLoop:function(){clearTimeout(this.saveIntervalId),setTimeout(this.saveLoop.bind(this),this.saveInterval)}},e.memory.loadAll(),window.addEventListener("beforeunload",function(){e.memory.save()}),e.memory.saveLoop(),e.banlist=e.memory.get("ban"),e.banlist.contains=function(e){return this.hasOwnProperty(e)},e.banlist.add=function(t){this[t]={told:!1},e.memory.save("ban")},e.banlist.remove=function(e){this.contains(e)&&delete this[e]},e.Command=function(t){return t.name=t.name.toLowerCase(),t.permissions=t.permissions||{},t.permissions.use=t.permissions.use||"ALL",t.permissions.del=t.permissions.del||"NONE",t.description=t.description||"",t.creator=t.creator||"God",t.invoked=0,["Use","Del"].forEach(function(n){var o=n.toLowerCase();t["can"+n]=function(t){var n=this.permissions[o];return"ALL"===n?!0:"NONE"===n?!1:"OWNER"===n?e.isOwner(t):n.indexOf(t)>-1}}),t.exec=function(){return this.invoked+=1,this.fun.apply(this.thisArg,arguments)},t.del=function(){e.info.forgotten+=1,delete e.commands[t.name],e.commandDictionary.trie.del(t.name)},t},e.CommunityCommand=function(t,n){function o(t){if(c.call(i,t))return!1;r();var o=Object.keys(a).length,s=n-o-1;return e.log(a,o,n),t in a?"Already registered; still need {0} more".supplant(s):s>0?(a[t]=new Date,"Registered; need {0} more to execute".supplant(s-1)):(e.log("should execute"),!1)}function r(){function e(e,n){return t>e[n]&&delete e[n],e}var t=new Date;t.setMinutes(t.getMinutes()-10),Object.keys(a).reduce(e,a)}var i=this.Command(t),a={},s=i.exec,c=i.canUse;return n=n||2,i.canUse=function(){return!0},i.exec=function(t){var n=o(t.get("user_id"));return n?(e.log(n),n):s.apply(i,arguments)},i},e.Message=function(t,n){var o=Object(t);o.content=t;var r=function(t){e.adapter.out.add(t,n.room_id)},i={send:r,reply:function(t,o){var i=e.adapter.reply(o||n.user_name);r(i+" "+t)},directreply:function(t){var o=e.adapter.directreply(n.message_id);r(o+" "+t)},parse:function(o,r){!!o===o&&(r=o,o=t);var i=e.parseCommandArgs(o||t);return r?i.map(function(t){return e.Message(t,n)}):i},exec:function(e){var n=e.exec(t);return this.matches=n?n:[],n},findUserid:function(t){t=t.toLowerCase().replace(/\s/g,"");var n=Object.keys(e.users);return n.first(function(n){var o=e.users[n].name.toLowerCase().replace(/\s/g,"");return o===t})||-1}.memoize(),findUsername:function(){var t={};return function(n,o){function r(e){i(e.name)}function i(e){o(t[n]=e)}t[n]?i(t[n]):e.users[n]?i(e.users[n].name):e.users.request(e.adapter.roomid,n,r)}}(),codify:e.adapter.codify.bind(e.adapter),escape:e.adapter.escape.bind(e.adapter),link:e.adapter.link.bind(e.adapter),get:function(e){return e?n[e]:n},set:function(e,t){return n[e]=t,n[e]}};return Object.iterate(i,function(e,t){o[e]=t}),o},e.isOwner=function(e){var t=this.users[e];return t&&(t.is_owner||t.is_moderator)},IO.register("input",e.parseMessage,e),e.beatInterval=5e3,function t(){e.beat=setTimeout(function(){IO.fire("heartbeat"),t()},e.beatInterval)}(),e.eval=function(){function t(t){e.log(t,"eval answerObj");var o,r=t.answer,i=t.log;return void 0===r?"Malformed output from web-worker. If you weren't just fooling around trying to break me, raise an issue or contact Zirak":(o=n(r),i&&i.length&&(o+=" Logged: "+n(i)),o)}function n(e){var t;return t=e.length>400?"`"+e.slice(0,400)+"` (snip)":"`"+e+"`"}window.URL=window.URL||window.webkitURL||window.mozURL||null;var o=atob("dmFyIGdsb2JhbCA9IHRoaXM7CgovKm1vc3QgZXh0cmEgZnVuY3Rpb25zIGNvdWxkIGJlIHBvc3NpYmx5IHVuc2FmZSovCnZhciB3aGl0ZXkgPSB7CgknQXJyYXknICAgICAgICAgICAgICA6IDEsCgknQm9vbGVhbicgICAgICAgICAgICA6IDEsCgknY29uc29sZScgICAgICAgICAgICA6IDEsCgknRGF0ZScgICAgICAgICAgICAgICA6IDEsCgknRXJyb3InICAgICAgICAgICAgICA6IDEsCgknRXZhbEVycm9yJyAgICAgICAgICA6IDEsCgknZXhlYycgICAgICAgICAgICAgICA6IDEsCgknRnVuY3Rpb24nICAgICAgICAgICA6IDEsCgknSW5maW5pdHknICAgICAgICAgICA6IDEsCgknSlNPTicgICAgICAgICAgICAgICA6IDEsCgknTWF0aCcgICAgICAgICAgICAgICA6IDEsCgknTmFOJyAgICAgICAgICAgICAgICA6IDEsCgknTnVtYmVyJyAgICAgICAgICAgICA6IDEsCgknT2JqZWN0JyAgICAgICAgICAgICA6IDEsCgknUmFuZ2VFcnJvcicgICAgICAgICA6IDEsCgknUmVmZXJlbmNlRXJyb3InICAgICA6IDEsCgknUmVnRXhwJyAgICAgICAgICAgICA6IDEsCgknU3RyaW5nJyAgICAgICAgICAgICA6IDEsCgknU3ludGF4RXJyb3InICAgICAgICA6IDEsCgknVHlwZUVycm9yJyAgICAgICAgICA6IDEsCgknVVJJRXJyb3InICAgICAgICAgICA6IDEsCgknYXRvYicgICAgICAgICAgICAgICA6IDEsCgknYnRvYScgICAgICAgICAgICAgICA6IDEsCgknZGVjb2RlVVJJJyAgICAgICAgICA6IDEsCgknZGVjb2RlVVJJQ29tcG9uZW50JyA6IDEsCgknZW5jb2RlVVJJJyAgICAgICAgICA6IDEsCgknZW5jb2RlVVJJQ29tcG9uZW50JyA6IDEsCgknZXZhbCcgICAgICAgICAgICAgICA6IDEsCgknZ2xvYmFsJyAgICAgICAgICAgICA6IDEsCgknaXNGaW5pdGUnICAgICAgICAgICA6IDEsCgknaXNOYU4nICAgICAgICAgICAgICA6IDEsCgknb25tZXNzYWdlJyAgICAgICAgICA6IDEsCgkncGFyc2VGbG9hdCcgICAgICAgICA6IDEsCgkncGFyc2VJbnQnICAgICAgICAgICA6IDEsCgkncG9zdE1lc3NhZ2UnICAgICAgICA6IDEsCgknc2VsZicgICAgICAgICAgICAgICA6IDEsCgkndW5kZWZpbmVkJyAgICAgICAgICA6IDEsCgknd2hpdGV5JyAgICAgICAgICAgICA6IDEsCgoJLyogdHlwZWQgYXJyYXlzIGFuZCBzaGl0ICovCgknQXJyYXlCdWZmZXInICAgICAgIDogMSwKCSdCbG9iJyAgICAgICAgICAgICAgOiAxLAoJJ0Zsb2F0MzJBcnJheScgICAgICA6IDEsCgknRmxvYXQ2NEFycmF5JyAgICAgIDogMSwKCSdJbnQ4QXJyYXknICAgICAgICAgOiAxLAoJJ0ludDE2QXJyYXknICAgICAgICA6IDEsCgknSW50MzJBcnJheScgICAgICAgIDogMSwKCSdVaW50OEFycmF5JyAgICAgICAgOiAxLAoJJ1VpbnQxNkFycmF5JyAgICAgICA6IDEsCgknVWludDMyQXJyYXknICAgICAgIDogMSwKCSdVaW50OENsYW1wZWRBcnJheScgOiAxLAoKCS8qCgl0aGVzZSBwcm9wZXJ0aWVzIGFsbG93IEZGIHRvIGZ1bmN0aW9uLiB3aXRob3V0IHRoZW0sIGEgZnVja2Zlc3Qgb2YKCWluZXhwbGljYWJsZSBlcnJvcnMgZW51c2VzLiB0b29rIG1lIGFib3V0IDQgaG91cnMgdG8gdHJhY2sgdGhlc2UgZnVja2VycwoJZG93bi4KCWZ1Y2sgaGVsbCBpdCBpc24ndCBmdXR1cmUtcHJvb2YsIGJ1dCB0aGUgZXJyb3JzIHRocm93biBhcmUgdW5jYXRjaGFibGUKCWFuZCB1bnRyYWNhYmxlLiBzbyBhIGhlYWRzLXVwLiBlbmpveSwgZnV0dXJlLW1lIQoJKi8KCSdET01FeGNlcHRpb24nIDogMSwKCSdFdmVudCcgICAgICAgIDogMSwKCSdNZXNzYWdlRXZlbnQnIDogMSwKCSdXb3JrZXJNZXNzYWdlRXZlbnQnOiAxCn07CgpbIGdsb2JhbCwgT2JqZWN0LmdldFByb3RvdHlwZU9mKGdsb2JhbCkgXS5mb3JFYWNoKGZ1bmN0aW9uICggb2JqICkgewoJT2JqZWN0LmdldE93blByb3BlcnR5TmFtZXMoIG9iaiApLmZvckVhY2goZnVuY3Rpb24oIHByb3AgKSB7CgkJaWYoIHdoaXRleS5oYXNPd25Qcm9wZXJ0eShwcm9wKSApIHsKICAgICAgICAgICAgcmV0dXJuOwoJCX0KCiAgICAgICAgdHJ5IHsKICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KCBvYmosIHByb3AsIHsKICAgICAgICAgICAgICAgIGdldCA6IGZ1bmN0aW9uICgpIHsKICAgICAgICAgICAgICAgICAgICAvKiBURUUgSEVFICovCiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IFJlZmVyZW5jZUVycm9yKCBwcm9wICsgJyBpcyBub3QgZGVmaW5lZCcgKTsKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICBjb25maWd1cmFibGUgOiBmYWxzZSwKICAgICAgICAgICAgICAgIGVudW1lcmFibGUgOiBmYWxzZQogICAgICAgICAgICB9KTsKICAgICAgICB9CiAgICAgICAgY2F0Y2ggKCBlICkgewogICAgICAgICAgICBkZWxldGUgb2JqWyBwcm9wIF07CgogICAgICAgICAgICBpZiAoIG9ialsgcHJvcCBdICE9PSB1bmRlZmluZWQgKSB7CiAgICAgICAgICAgICAgICBvYmpbIHByb3AgXSA9IG51bGw7CiAgICAgICAgICAgIH0KICAgICAgICB9Cgl9KTsKfSk7CgpPYmplY3QuZGVmaW5lUHJvcGVydHkoIEFycmF5LnByb3RvdHlwZSwgJ2pvaW4nLCB7Cgl3cml0YWJsZTogZmFsc2UsCgljb25maWd1cmFibGU6IGZhbHNlLAoJZW51bXJhYmxlOiBmYWxzZSwKCgl2YWx1ZTogKGZ1bmN0aW9uICggb2xkICkgewoJCXJldHVybiBmdW5jdGlvbiAoIGFyZyApIHsKCQkJaWYgKCB0aGlzLmxlbmd0aCA+IDUwMCB8fCAoYXJnICYmIGFyZy5sZW5ndGggPiA1MDApICkgewoJCQkJdGhyb3cgJ0V4Y2VwdGlvbjogdG9vIG1hbnkgaXRlbXMnOwoJCQl9CgoJCQlyZXR1cm4gb2xkLmFwcGx5KCB0aGlzLCBhcmd1bWVudHMgKTsKCQl9OwoJfSggQXJyYXkucHJvdG90eXBlLmpvaW4gKSkKfSk7CgovKiB3ZSBkZWZpbmUgaXQgb3V0c2lkZSBzbyBpdCdsbCBub3QgYmUgaW4gc3RyaWN0IG1vZGUgKi8KdmFyIGV4ZWMgPSBmdW5jdGlvbiAoIGNvZGUgKSB7CglyZXR1cm4gZXZhbCggJ3VuZGVmaW5lZDtcbicgKyBjb2RlICk7Cn0KdmFyIGNvbnNvbGUgPSB7CglfaXRlbXMgOiBbXSwKCWxvZyA6IGZ1bmN0aW9uKCkgewoJCWNvbnNvbGUuX2l0ZW1zLnB1c2guYXBwbHkoIGNvbnNvbGUuX2l0ZW1zLCBhcmd1bWVudHMgKTsKCX0KfTsKY29uc29sZS5lcnJvciA9IGNvbnNvbGUuaW5mbyA9IGNvbnNvbGUuZGVidWcgPSBjb25zb2xlLmxvZzsKCihmdW5jdGlvbigpewoJInVzZSBzdHJpY3QiOwoKCWdsb2JhbC5vbm1lc3NhZ2UgPSBmdW5jdGlvbiAoIGV2ZW50ICkgewoJCXBvc3RNZXNzYWdlKHsKCQkJZXZlbnQgOiAnc3RhcnQnCgkJfSk7CgoJCXZhciBqc29uU3RyaW5naWZ5ID0gSlNPTi5zdHJpbmdpZnksIC8qYmFja3VwKi8KCQkJcmVzdWx0OwoKCQl0cnkgewoJCQlyZXN1bHQgPSBleGVjKCBldmVudC5kYXRhICk7CgkJfQoJCWNhdGNoICggZSApIHsKCQkJcmVzdWx0ID0gZS50b1N0cmluZygpOwoJCX0KCgkJLypKU09OIGRvZXMgbm90IGxpa2UgYW55IG9mIHRoZSBmb2xsb3dpbmcqLwoJCXZhciBzdHJ1bmcgPSB7CgkJCUZ1bmN0aW9uICA6IHRydWUsIEVycm9yICA6IHRydWUsCgkJCVVuZGVmaW5lZCA6IHRydWUsIFJlZ0V4cCA6IHRydWUKCQl9OwoJCXZhciBzaG91bGRfc3RyaW5nID0gZnVuY3Rpb24gKCB2YWx1ZSApIHsKCQkJdmFyIHR5cGUgPSAoIHt9ICkudG9TdHJpbmcuY2FsbCggdmFsdWUgKS5zbGljZSggOCwgLTEgKTsKCgkJCWlmICggdHlwZSBpbiBzdHJ1bmcgKSB7CgkJCQlyZXR1cm4gdHJ1ZTsKCQkJfQoJCQkvKm5laXRoZXIgZG9lcyBpdCBmZWVsIGNvbXBhc3Npb25hdGUgYWJvdXQgTmFOIG9yIEluZmluaXR5Ki8KCQkJcmV0dXJuIHZhbHVlICE9PSB2YWx1ZSB8fCB2YWx1ZSA9PT0gSW5maW5pdHk7CgkJfTsKCgkJdmFyIHJldml2ZXIgPSBmdW5jdGlvbiAoIGtleSwgdmFsdWUgKSB7CgkJCXZhciBvdXRwdXQ7CgoJCQlpZiAoIHNob3VsZF9zdHJpbmcodmFsdWUpICkgewoJCQkJb3V0cHV0ID0gJycgKyB2YWx1ZTsKCQkJfQoJCQllbHNlIHsKCQkJCW91dHB1dCA9IHZhbHVlOwoJCQl9CgoJCQlyZXR1cm4gb3V0cHV0OwoJCX07CgoJCXBvc3RNZXNzYWdlKHsKCQkJYW5zd2VyIDoganNvblN0cmluZ2lmeSggcmVzdWx0LCByZXZpdmVyICksCgkJCWxvZyAgICA6IGpzb25TdHJpbmdpZnkoIGNvbnNvbGUuX2l0ZW1zLCByZXZpdmVyICkuc2xpY2UoIDEsIC0xICkKCQl9KTsKCX07Cn0pKCk7Cg=="),r=new Blob([o],{type:"application/javascript"}),i=window.URL.createObjectURL(r);return setTimeout(function(){e.devMode||IO.injectScript("https://raw.github.com/jashkenas/coffee-script/master/extras/coffee-script.js")},1e3),function(n,o){function r(){s||(s=window.setTimeout(function(){a("Maximum execution time exceeded")},500))}function a(e){clearTimeout(s),c.terminate(),o&&o.call?o(e):console.warn("eval did not get callback")}var s,c=new Worker(i);n="c"===n[0]?CoffeeScript.compile(n.replace(/^c>/,""),{bare:1}):n.replace(/^>/,""),c.onmessage=function(e){var n=e.data.event;"start"===n?r():a(t(e.data))},c.onerror=function(t){e.log(t,"eval worker.onerror"),a(""+t)},c.postMessage(n)}}(),function(){var t;t=e!==void 0?e:"undefined"!=typeof exports?exports:window,t.parseCommandArgs=function(){var e=0,t=1,n=2,o=3,r="'",i='"',a={parse:function(t,n,o){this.source=t,this.pos=0,this.length=t.length,this.state=e,this.lookahead="",this.escaper=o||"~",this.separator=n||" ";var r=this.tokenize();return this.state!==e&&this.throwFinishError(),r},tokenize:function(){for(var e,t=[];this.length>this.pos;)e=this.nextArg(),e&&t.push(e);return t},nextArg:function(){var t,n="";for(this.state=e;;){if(t=this.nextChar(),null===t||this.state===o)break;n+=t}return n},nextChar:function(t){var n=this.lookahead=this.source[this.pos];return this.pos++,n?t?n:n===this.escaper?this.nextChar(!0):n===this.separator&&this.state===e?(this.state=o,n):this.string():null},string:function(){var e=this.lookahead;return e===r?this.singleQuotedString():e===i?this.doubleQuotedString():e},singleQuotedString:function(){return this.state===n?this.lookahead:(this.state=this.state!==t?t:e,this.nextChar())},doubleQuotedString:function(){return this.state===t?this.lookahead:(this.state=this.state!==n?n:e,this.nextChar())},throwFinishError:function(){var e="";this.state===t?e="Expected "+r:this.state===n&&(e="Expected "+i);var o=Error("Unexpected end of input: "+e);throw o.column=this.pos,o}};return function(){return a.parse.apply(a,arguments)}}()}();var n={who:function(e){return e.get("user_name")},someone:function(){var e=document.getElementById("sidebar").getElementsByClassName("present-user"),t=[].filter.call(e,function(e){return Number(e.style.opacity)>=.5}),n=t[Math.floor(Math.random()*(t.length-1))];return n?n.getElementsByTagName("img")[0].title:"Nobody"},digit:function(){return Math.floor(10*Math.random())},encode:function(e,t){return encodeURIComponent(t)},rand:function(e,t,n){return t=Number(t),n=Number(n),Math.rand(t,n)}},o=/(?:.|^)\$(\w+)(?:\((.*?)\))?/g;e.parseMacro=function r(t,i){function a(t,n,o){if(t.startsWith("$$"))return t.slice(1);var r="";"$"!==t[0]&&(r=t[0]);var i=c(n);return i?(e.log(i,n,o,"/parse replaceMacro"),r+=i.apply?i.apply(null,s(o)):i):n}function s(n){return e.log(n,"/parse parseMacroArgs"),n?[t].concat(r(n,i).split(",").invoke("trim")):[t]}function c(e){function t(t){return t&&t.hasOwnProperty(e)}var o=[n,i].first(t);return(o||{})[e]}return t.replace(o,a)};var i=function(){function e(){this.word=null,this.children={}}function t(n){if(!(this instanceof t))throw new TypeError("Illegal function call");if(n=Number(n),isNaN(n)||1>n)throw new TypeError("maxCost must be an integer > 1 ");this.maxCost=n,this.trie=new e}function n(e,t){var n,o,r,i=[];for(void 0===t?(r=0,o=e):(r=e,o=t-r),n=0;o>n;++n)i[n]=r++;return i}function o(e,t,o){var i=[],a=n(e.length+1);return Object.keys(o.children).forEach(function(n){r(o.children[n],n,e,a,i,t)}),i}function r(e,t,n,o,i,a){var s,c,u,m,l,d=n.length+1,p=[o[0]+1];for(s=1;d>s;++s)c=p[s-1]+1,u=o[s]+1,m=n.charAt(s-1)!==t?o[s-1]+1:o[s-1],p.push(Math.min(c,u,m));l=p[p.length-1],a>=l&&null!==e.word&&i.push([e.word,l]),a>=Math.min.apply(Math,p)&&Object.keys(e.children).forEach(function(t){r(e.children[t],t,n,p,i,a)})}return e.prototype.add=function(t){for(var n,o=this,r=0;n=t.charAt(r++);)n in o.children||(o.children[n]=new e),o=o.children[n];o.word=t},e.prototype.del=function(e,t){t=t||0;var n=this,o=e[t++];n.children[o]&&(n.children[o].del(e,t),0===Object.keys(n.children[o].children).length&&null===n.children[o].word&&delete n.children[o]),n.word===e&&(n.word=null)},t.prototype={constructor:t,build:function(t){if(!Array.isArray(t))throw new TypeError("Cannot build a dictionary from "+t);this.trie=new e,t.forEach(function(e){this.trie.add(e)},this)},__sortfn:function(e,t){return e[1]-t[1]},search:function(e){e=e.valueOf();var t;if("string"!=typeof e)throw new TypeError("Cannot search "+e);if(void 0===this.trie)throw new TypeError("Cannot search, dictionary isn't built yet");return t=o(e,this.maxCost,this.trie),t.sort(this.__sortfn),t.map(function(e){return e[0]})}},t}();e.commandDictionary=new i(3),function(){var t={help:function(t){if(t&&t.length){var n=e.getCommand(t.toLowerCase());if(n.error)return n.error;var o=n.description||"No info is available";return t+": "+o}return"Information on interacting with me can be found at [this page](https://github.com/Zirak/SO-ChatBot/wiki/Interacting-with-the-bot)"},listen:function(t){var n=e.callListeners(t);return n?void 0:e.giveUpMessage()},eval:function(t,n){return n=n||t.directreply.bind(t),e.eval(t,n)},coffee:function(n,o){var r=e.Message("c> "+n,n.get());return t.eval(r,o)},refresh:function(){window.location.reload()},forget:function(t){var n=t.toLowerCase(),o=e.getCommand(n);return o.error?o.error:o.canDel(t.get("user_id"))?(o.del(),"Command "+n+" forgotten."):"You are not authorized to delete the command "+t},info:function(t){function n(t){var n=e.getCommand(t);if(n.error)return n.error;var o="Command {name}, created by {creator}".supplant(n);return n.date&&(o+=" on "+n.date.toUTCString()),o+=n.invoked?", invoked "+n.invoked+" times":" but hasn't been used yet"}function o(){var e="I awoke on {0} (that's about {1} ago)",t=i.start.toUTCString(),n=Date.timeSince(i.start);return e.supplant(t,n)}function r(){var e=[],t="";return i.invoked&&e.push("got invoked "+i.invoked+" times"),i.learned&&(t="but ",e.push("learned "+i.learned+" commands")),i.forgotten&&e.push(t+"forgotten "+i.forgotten+" commands"),.15>Math.random()&&e.push("teleported "+Math.rand(100)+" goats"),e.join(", ")||"haven't done anything yet!"}if(t.content)return n(t.content);var i=e.info;return o()+", "+r()}};t.listcommands=function(){var t=function(e,t){var n=0,o=[],r=e.reduce(function(e,r){var i=r.length+2;return n+i>t&&(e.push(o),o=[],n=0),o.push(r),n+=i,e},[]);return o.length&&r.push(o),r};return function(n){var o=Object.keys(e.commands),r=" (page {0}/{1})",i=n.get("user_name"),a=498-r.length-i.length,s=t(o,a),c=/^(\d+|$)/.test(n.content),u=Number(n.content)||0;if(u>=s.length||!c)return n.codify(["StackOverflow: Could not access page.","IndexError: index out of range","java.lang.IndexOutOfBoundsException","IndexOutOfRangeException"].random());var m=s[u].join(", ");return m+r.supplant(u,s.length-1)}}(),t.eval.async=t.coffee.async=!0,t.tell=function(){var t={tell:!0,forget:!0};return function(n){function o(e){e&&(c?p(e):d(e))}var r=n.split(" ");e.log(n.valueOf(),r,"/tell input");var i,a=r[0],s=r[1];if(!a||!s)return"Invalid /tell arguments. Use /help for usage info";if(s=s.toLowerCase(),i=e.getCommand(s),i.error)return i.error;if(t.hasOwnProperty(s))return"Command "+s+" cannot be used in /tell.";if(!i.canUse(n.get("user_id")))return"You do not have permission to use command "+s;if(/^@/.test(a))return"Don't be annoying, drop the @, nobody likes a double-ping.";var c=!1,u={};/^:?\d+$/.test(a)?(u.message_id=a.replace(/^:/,""),c=!0):u.user_name=a;var m=Object.merge(n.get(),u),l=e.Message(r.slice(2).join(" "),m),d=l.reply.bind(l),p=l.directreply.bind(l);l.reply=l.directreply=l.send=o,e.log(l,"/tell calling "+s),i.async?i.exec(l,o):o(i.exec(l))}}();var n={eval:"Forwards message to javascript code-eval",coffee:"Forwards message to coffeescript code-eval",forget:"Forgets a given command. `/forget cmdName`",help:"Fetches documentation for given command, or general help article. `/help [cmdName]`",info:"Grabs some stats on my current instance or a command. `/info [cmdName]`",listcommands:"Lists commands. `/listcommands [page=0]`",listen:"Forwards the message to my ears (as if called without the /)",refresh:"Reloads the browser window I live in",tell:"Redirect command result to user/message. /tell `msg_id|usr_name cmdName [cmdArgs]`"},o={die:!0,live:!0,ban:!0,unban:!0,refresh:!0},r={die:!0,ban:!0};Object.iterate(t,function(i,a){var s={name:i,fun:a,permissions:{del:"NONE",use:o[i]?"OWNER":"ALL"},description:n[i],async:t[i].async};r[i]&&(s=e.CommunityCommand(s)),e.addCommand(s)})}(),function(){e.listen(/^help(?: (\S+))?/,function(t){return e.getCommand("help").exec(t.matches[1])});var t=["A robot may not injure a human being or, through inaction, allow a human being to come to harm.","A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law.","A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws."].map(function(e,t){return t+". "+e}).join("\n");e.listen(/^tell (me (your|the) )?(rule|law)s/,function(){return t}),e.listen(/^give (.+?) a lick/,function(e){var t,n=e.matches[1];return"me"===n?(n="you",t=""):"yourself"===n?(n="I",t=""):t="s","Mmmm! "+n+" taste"+t+" just like raisin"});var n=[/^what(?:'s|'re)?\s(?:(?:is|are)\s)?(?:(?:an|a)\s)?([\w\s\-]+)\??/,/^define\s(?:(?:an|a)\s)?([\w\s\-]+)/];e.listen(n,function(t){var n=t.matches[1],o=e.getCommand("define");o.exec(n,function(e){e=e.replace(n+":",""),t.reply(e)})})}()}(),function(){"use strict";var e="[{text}]({url})";bot.adapter={roomid:null,fkey:null,site:null,user_id:null,init:function(){var e=document.getElementById("fkey");return e?(this.fkey=e.value,this.roomid=Number(/\d+/.exec(location)[0]),this.site=/chat\.(\w+)/.exec(location)[1],this.user_id=CHAT.user.current().id,this.in.init(),this.out.init(),void 0):(console.error("bot.adapter could not find fkey; aborting"),void 0)},transform:function(e){return e},escape:function(e){return e.replace(/([`\*_\(\)\[\]])/g,"\\$1")},reply:function(e){return"@"+e.replace(/\s/g,"")},directreply:function(e){return":"+e},codify:function(e){var t=" ",n=e.replace(" ",t),o=n.split(/[\r\n]/g);return 1===o.length?"`"+o[0]+"`":o.map(function(e){return t+e}).join("\n")},link:function(t,n){return e.supplant({text:this.escape(t),url:n})
}};var t=bot.adapter.in={times:{},firstPoll:!0,interval:5e3,init:function(e){function t(e){e=JSON.parse(e),bot.log(e),n.openSocket(e.url,o)}var n=this,o=void 0!==e;e=e||bot.adapter.roomid,IO.xhr({url:"/ws-auth",data:fkey({roomid:e}),method:"POST",complete:t})},initialPoll:function(){function e(e){e=JSON.parse(e),bot.log(e),n.times["r"+t]=e.time,n.firstPoll=!1}bot.log("adapter: initial poll");var t=bot.adapter.roomid,n=this;IO.xhr({url:"/chats/"+t+"/events/",data:fkey({since:0,mode:"Messages",msgCount:0}),method:"POST",complete:e})},openSocket:function(e,t){var n=new WebSocket(e+"?l=99999999999");t?n.onmessage=function(){n.close()}:(this.socket=n,n.onmessage=this.ondata.bind(this),n.onclose=this.socketFail.bind(this))},ondata:function(e){this.pollComplete(e.data)},poll:function(){if(this.firstPoll)return this.initialPoll(),void 0;var e=this;IO.xhr({url:"/events",data:fkey(e.times),method:"POST",complete:e.pollComplete,thisArg:e})},pollComplete:function(e){e&&(e=JSON.parse(e),Object.iterate(e,function(e,t){t.t&&(this.times[e]=t.t),t.e&&t.e.forEach(this.handleMessageObject,this)},this),IO.in.flush())},handleMessageObject:function(e){IO.fire("rawinput",e);var t=e.event_type;if(3===t||4===t)return this.handleUserEvent(e),void 0;if(1===t||2===t)return e.content.startsWith("<div class='full'>")?(this.handleMultilineMessage(e),void 0):(IO.in.receive(e),void 0)},handleMultilineMessage:function(e){this.breakMultilineMessage(e).forEach(function(t){var n=Object.merge(e,{content:t.trim()});IO.in.receive(n)})},breakMultilineMessage:function(e){var t=e.content.slice(0,e.content.lastIndexOf("</div>")).replace("<div class='full'>","");return t.split("<br>")},handleUserEvent:function(e){var t=e.event_type;3===t?IO.fire("userjoin",e):4===t&&IO.fire("userleave",e)},leaveRoom:function(e,t){return e===bot.adapter.roomid?(t("base_room"),void 0):(IO.xhr({method:"POST",url:"/chats/leave/"+e,data:fkey({quiet:!0}),complete:function(){t()}}),void 0)},socketFail:function(){bot.log("adapter: socket failed",this),this.socket.close(),this.socket=null,this.loopage()},loopage:function(){if(!this.socket){var e=this;setTimeout(function(){e.poll(),e.loopage()},this.interval)}}},n=bot.adapter.out={409:0,total:0,interval:t.interval+500,flushWait:500,init:function(){},add:function(e,t){IO.out.receive({text:e+"\n",room:t||bot.adapter.roomid}),IO.out.flush()},send:function(e){bot.stopped||setTimeout(function(){n.sendToRoom(e.text,e.room)},this.flushWait)},sendToRoom:function(e,t){function o(o,i){bot.log(i.status),409===i.status?(n["409"]+=1,r(e,t)):500===i.status?n.add("Server error (status 500) occured (message probably too long)",t):200!==i.status?(console.error(i),n.add("Error "+i.status+" occured, I will call the maid "+" (@Zirak)")):(n.total+=1,IO.fire("sendoutput",i,e,t))}function r(){setTimeout(function(){n.add(e,t)},n.interval)}IO.xhr({url:"/chats/"+t+"/messages/new",data:{text:e,fkey:fkey().fkey},method:"POST",complete:o})}};IO.register("output",n.send,n),bot.adapter.init()}(),function(){"use strict";function e(e,t,n){function o(e){e=JSON.parse(e),e.users.forEach(r)}function r(e){bot.users[e.id]=e,n(e)}Array.isArray(t)||(t=[t]),t.length&&IO.xhr({method:"POST",url:"/user/info",data:{ids:t.join(),roomId:e||bot.adapter.roomid},complete:o})}function t(){window.users&&(bot.users=Object.merge(bot.users,window.users))}bot.users={};var n=[],o=function(e,t){n.push(e.user_id),r(t)};IO.register("userjoin",function(e){function t(t){IO.fire("userregister",t,e.room_id)}bot.log(e,"userjoin");var n=bot.users[e.user_id];n?t(n):o(e,t)});var r=function(t){bot.log(n,"user addInfos"),e(null,n,t),n=[]}.throttle(1e3);bot.users.request=e,t()}(),bot.personality={bitchiness:0,thanks:{0:["You kiss-ass","Most welcome"],.5:["Thank you for noticing","teehee"],1:["Took you long enough","My pleasure","Don't mention it"]},apologies:{0:["What for?"],.5:["It was nothing...","No worries"],1:["You're forgiven. For now. Don't push it."]},stuff:{0:["Life is just *perfect*","What's there to bitch about, as long as I have *you*..."],1:["Oh don't mind me, that isn't difficult at all..."],1.2:["You don't appreciate me enough. Not that I need to be thanked.."],1.3:['The occasional "thanks" or "I\'m sorry" would be nice...'],2:["*sigh* Remember laughter? I don't. You ripped it out of me. Heartless bastard."]},insanity:{},okayCommands:{hangman:!0,help:!0,info:!0},check:function(e){return!this.okayCommands.hasOwnProperty(e)},bitch:function(){return this.getResp(this.stuff)},command:function(){this.bitchiness+=this.getDB()},thank:function(){return this.unbitch(this.thanks)},apologize:function(){return this.unbitch(this.apologies)},unbitch:function(e,t){var n=this.getResp(e);return this.bitchiness-=t||this.bitchiness,n},getResp:function(e){return e[this.bitchiness.fallsAfter(Object.keys(e).map(Number).sort())].random()},isABitch:function(){return this.bitchiness>=1},looksLikeABitch:function(){return!1},getDB:function(){return this.isThatTimeOfTheMonth()?.075:.025},isThatTimeOfTheMonth:function(){var e=(new Date).getDate();return 2>e||e>27}},bot.listen(/thank(s| you)/i,bot.personality.thank,bot.personality),bot.listen(/(I('m| am))?\s*sorry/i,bot.personality.apologize,bot.personality),bot.listen(/^bitch/i,bot.personality.bitch,bot.personality),function(){"use strict";var e=bot.memory.get("afk"),t=3e5,n=12e4,o=[{outgoing:"Why are you leaving me!?",incoming:["Welcome back!","Where were you!?","You saw that whore again, didn't you!?"]},{outgoing:"Just go already!",incoming:["Oh, it's you again...","Look at what the cat dragged in...","You've got some balls, coming back here after what you did."]},{outgoing:"Nobody cares.",incoming:["I already told you, nobody cares.","There goes the neighbourhood."]},{outgoing:"Hurry back, ok?",incoming:["I thought you'd never come back!","It's been 20 years. You can't just waltz back into my life like this."]},{outgoing:"Stay safe.",incoming:["Were you bitten!? Strip! Prove you weren't bitten."]},{outgoing:"Can you pick up some milk on your way back?",incoming:["Where's the milk?","Turns out I already have milk. Oops."]},{outgoing:"Apricots are people too!",incoming:["You taste just like raisin.","I am a banana!","My spoon is too big!","BROOOOOOOOOOOO."]}],r=function(o,r){function i(){var e="{user} is afk{sep}{rest}",t={user:o,sep:".",rest:""};return s.msg&&(t.sep=": ",t.rest=s.msg),e.supplant(t)}function a(){var e=s.lastPing[c];return u-s.afkSince>=n&&(!e||u-e>=t)}var s=e[o],c=r.get("room_id"),u=Date.now();a()&&(r.directreply(i()),s.lastPing[c]=u,bot.memory.save("afk"))},i=function(t,n,o){var r=!1;bot.log("/afk goAFK ",t),0===n.indexOf("!")&&(n=n.substring(1),r=!0),e[t]={afkSince:Date.now(),lastPing:{},msg:n.trim(),returnMsg:o},r&&(e[t].noReturn=1)},a=function(t){bot.log("/afk clearAFK",t),delete e[t]},s=function(t){var n,r,s=t.get("user_name").replace(/\s/g,""),c=t.content;bot.log("/afk input",s,c),e.hasOwnProperty(s)?(n=e[s].returnMsg,a(s)):(r=o.random(),n=r.outgoing,i(s,c,r.incoming.random())),bot.memory.save("afk"),t.directreply(n)};bot.addCommand({name:"afk",fun:s,permissions:{del:"NONE"},description:"Set an afk message: `/afk <message>`. Invoke `/afk` again to return."}),IO.register("input",function(t){function o(){var t=RegExp("^"+RegExp.escape(bot.invocationPattern)+"\\s*/?\\s*AFK");return e.hasOwnProperty(c)&&!t.test(i)&&u-e[c].afkSince>=n}var i=t.content.toUpperCase(),a=bot.prepareMessage(t),c=t.user_name.replace(/\s/g,""),u=Date.now();t.user_id!==bot.adapter.user_id&&(o()&&(bot.log("/afk he returned!",t),s(a)),0>i.indexOf("@")||Object.keys(e).forEach(function(e){var t=RegExp("(^|\b)"+RegExp.escape("@"+e)+"\\b","i");t.test(i)&&(bot.log("/afk responding for "+e),r(e,a))}))})}(),function(){"use strict";var e=function(e){return e.split(" ").map(function(e){return 1>=e.length?e:2==e.length?e[0]:"you"==e?"u":"your"==e?"ur":"youre"==e?"ur":"you're"==e?"ur":/:.*(.)/.test(e)?e.replace(/:.*(.)/,"$1"):e.split("").map(function(e,t){return 0!=t&&("a"==e||"e"==e||"o"==e||"u"==e||"i"==e||1!=t%2&&.15>Math.random())?"":e}).join("")}).join(" ")};bot.addCommand({name:"awsm",fun:e,permissions:{del:"NONE"},description:"tks a sntnc and trns i awsm"})}(),function(){function e(e){function t(t){var n,r=Number(t);isNaN(r)&&(r=e.findUserid(t.replace(/^@/,""))),0>r?n="Cannot find user {0}.":bot.isOwner(r)?n="Cannot mindjail owner {0}.":bot.banlist.contains(r)?n="User {0} already in mindjail.":(bot.banlist.add(r),n="User {0} added to mindjail."),o.push(n.supplant(t))}function n(e){var t=bot.users[e],n=t?t.name:"?";return"{0} ({1})".supplant(e,n)}var o=[];return e.content?e.parse().forEach(t):o=Object.keys(bot.banlist).filter(Number).map(n),o.join(" ")||"Nothing to show/do."}function t(e){function t(t){var o,r=Number(t);isNaN(r)&&(r=e.findUserid(t.replace(/^@/,""))),0>r?o="Cannot find user {0}.":bot.banlist.contains(r)?(bot.banlist.remove(r),o="User {0} freed from mindjail!"):o="User {0} isn't in mindjail.",n.push(o.supplant(t))}var n=[];return e.parse().forEach(t),n.join(" ")}bot.addCommand(bot.CommunityCommand({name:"ban",fun:e,permissions:{del:"NONE",use:"OWNER"},description:"Bans user(s) from using me. Lacking arguments, prints the banlist. `/ban [usr_id|usr_name, [...]]`"})),bot.addCommand({name:"unban",fun:t,permissions:{del:"NONE",use:"OWNER"},description:"Removes a user from my mindjail. `/unban usr_id|usr_name`"})}(),function(){function e(e){var t="http://southouse.tk/colors.php?color=",n=(""+e).toLowerCase().match(/([a-z0-9]+)+/g).join(",");e.directreply(t+n+"#.png")}bot.addCommand({name:"color",fun:e,permissions:{del:"NONE"},description:"Displays the color(s) passed in. `/color color0[ color1[ ...]]`"})}(),function(){"use strict";function e(e){var t=e.toUpperCase();return r.hasOwnProperty(t)?r[t]:a.hasOwnProperty(e)?a[e]:e}function t(e,t,n){bot.log(e,t,"/convert unit broken"),i[t]?n(i[t](e)):n({error:"Confuse converter with "+t+", receive error message"})}function n(){return Object.keys(i)}var o,r,i={C:function(e){return{F:1.8*e+32,K:e+273.15}},F:function(e){return{C:(e-32)/1.8,K:5*(e+459.67)/9}},K:function(e){return 0>e?null:{C:e-273.15,F:1.8*e-459.67}},m:function(e){return{f:3.280839895*e}},f:function(e){return{m:e/3.28083989}},km:function(e){return i.m(1e3*e)},cm:function(e){return i.m(e/100)},mm:function(e){return i.m(e/1e3)},i:function(e){return i.f(e/12)},d:function(e){return{r:e*Math.PI/180}},r:function(e){return{d:180*e/Math.PI}},g:function(e){return{lb:.0022*e,st:157473e-9*e}},lb:function(e){return{g:453.592*e,st:.0714286*e}},st:function(e){return{g:6350.29*e,lb:14*e}},kg:function(e){return i.g(1e3*e)}},a={lbs:"lb",ft:"f",foot:"f",metres:"m",millimetres:"mm",killometres:"km",degrees:"d",radians:"r",grams:"g",kilograms:"kg",inches:"i",stones:"st"};o=Object.TruthMap(["AED","ANG","ARS","AUD","BDT","BGN","BHD","BND","BOB","BRL","BWP","CAD","CHF","CLP","CNY","COP","CRC","CZK","DKK","DOP","DZD","EEK","EGP","EUR","FJD","GBP","HKD","HNL","HRK","HUF","IDR","ILS","INR","JMD","JOD","JPY","KES","KRW","KWD","KYD","KZT","LBP","LKR","LTL","LVL","MAD","MDL","MKD","MUR","MVR","MXN","MYR","NAD","NGN","NIO","NIS","NOK","NPR","NZD","OMR","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","SAR","SCR","SEK","SGD","SKK","SLL","SVC","THB","TND","TRY","TTD","TWD","TZS","UAH","UGX","USD","UYU","UZS","VEF","VND","XOF","YER","ZAR","ZMK"]),r={"€":"EUR","£":"GBP","₤":"GBP","₨":"INR","₹":"INR","¥":"JPY","¥":"JPY","₪":"ILS",$:"USD"};var s=/(-?\d+\.?\d*)\s*(\S+)(\s+(?:(?:to|in)\s+)?(\S+))?$/,c=function(r,i){function a(e){bot.log(e,"/convert answer");var t;t=e.substr?e:e.error?e.error:c(e),i&&i.call?i(t):r.reply(t)}function c(e){function t(e){return!p||p===e}function n(t){return e[t].maxDecimal(4)+t}var o=Object.keys(e);return o.length?o.filter(t).map(n).join(", "):"Could not convert {0} to {1}".supplant(d,p)}if("list"===r.toLowerCase())return a(n().join(", ")),void 0;var m=s.exec(r);if(!m)return a({error:"Unidentified format; please see `/help convert`"}),void 0;var l=Number(m[1]),d=m[2],p=m[4]||"",g=!1;bot.log(l,d,p,"/convert input"),d=e(d),p=e(p),o[d.toUpperCase()]&&(g=!0),g?u.convert(l,d,p,a):t(l,d,a)},u={ratesCache:{},convert:function(e,t,n,o){this.from=t,this.to=n,this.upFrom=t.toUpperCase(),this.upTo=n.toUpperCase();var r=this.errorMessage();return r?(o({error:r}),void 0):(bot.log(e,t,n,"/convert money broken"),this.getRate(function(t){var r={};r[n]=e*t,o(r)}),void 0)},getRate:function(e){function t(t){n=t.rate,o.updateCache(n),e(n)}var n,o=this;return(n=this.checkCache())?(e(n),void 0):(IO.jsonp({url:"http://rate-exchange.appspot.com/currency",jsonpName:"callback",data:{from:o.from,to:o.to},fun:t}),void 0)},updateCache:function(e){this.ratesCache[this.upFrom]=this.ratesCache[this.upFrom]||{},this.ratesCache[this.upFrom][this.upTo]={rate:e,time:Date.now()}},checkCache:function(){var e,t=Date.now(),n=this.ratesCache[this.upFrom]&&(e=this.ratesCache[this.upFrom][this.upTo])&&18e6>=e.time-t;return console.log(this.ratesCache,n),n?e.rate:!1},errorMessage:function(){return this.to?o[this.upTo]?void 0:this.to+" aint no currency I ever heard of":"What do you want to convert "+this.from+" to?"}};bot.addCommand({name:"convert",fun:c,permissions:{del:"NONE"},description:"Converts several units and currencies, case sensitive. `/convert <num><unit> [to|in <unit>]` Pass in list for supported units `/convert list`",async:!0})}();var cowsay=function(){"use strict";function e(e,t){function n(e,n){var r=n.length;return o+r>t&&(e+="\n",o=0),o+=r+1,e+n+" "}var o=0;return e.split(" ").reduce(n,"")}function t(e,t,n){return n=n||" ",(e+Array(t).join(n)).slice(0,t)}var n={defaults:{e:"oo",T:" ",t:!1,W:40},cow:[""," L ^__^"," L (e)\\_______"," (__)\\ )\\/\\"," T ||----w |"," || ||"].join("\n"),moo:function(n,o){var r=this.defaults;return this.eyes=t(o.e||r.e,2).slice(0,2),this.tongue=t(o.T||r.T,2).slice(0,2),this.line=o.t?"O":"\\",this.thinking=o.t,this.message=e(n,o.W||r.W).trim(),this.makeBalloon()+this.makeCow()},makeCow:function(){return this.cow.replace(/e/g,this.eyes).replace(/T/g,this.tongue).replace(/L/g,this.line)},makeBalloon:function(){function e(e,n){var o;return o=0===n?a.slice(0,2):n===i-1?a.slice(2,4):a.slice(2),o[0]+" "+t(e,r)+" "+o[1]}function n(e,t){return t.length>e?t.length:e}var o=this.message.split("\n"),r=o.reduce(n,0),i=o.length,a=this.chooseBorders(i),s=o.map(e),c=Array(r+2);return s.unshift(" "+c.join("_")),s.push(" "+c.join("-")),s.join("\n")},chooseBorders:function(e){var t;return t=this.thinking?["(",")","(",")","(",")"]:1===e?["<",">"]:["/","\\","\\","/","|","|"]}};return n}();bot.listen(/cow(think|say)\s(?:([eT])=(.{0,2})\s)?(?:([eT])=(.{0,2})\s)?(.+)/,function(e){function t(e){for(var t={},n=0,o=e.length;o>n;n+=2)e[n]&&e[n+1]&&(t[e[n]]=e[n+1]);return t}var n=t(e.matches.slice(2,-1));n.t="think"===e.matches[1],bot.log(n,"cowsay opts");var o=cowsay.moo(e.matches.pop(),n);e.send(e.codify(o))}),function(){"use strict";function e(e,n){var o=[];return function(e){for(var t=e.firstElementChild;t;t=t.nextElementSibling){if(t===n)return;"LI"===t.tagName&&o.push(t)}}(e),t(o)}function t(e){function t(e){return e.firstChild.data}return[].map.call(e,t)}var n=["No definition found.","It means I aint got time to learn your $5 words","My pocket dictionary just isn't good enough for you."],o={command:function(e,t){function o(o,r){bot.log(o,"/define results");var i=o[0];i=i?bot.adapter.link(e,"http://en.wiktionary.org/wiki?curid="+r)+" "+i:n.random(),t&&t.call?t(i):e.reply(i)}bot.log(e,"/define input"),this.fetchData(e,o)},handleResponse:function(t,n){var o=t.query,r=o.pageids[0],i=o.pages[r].extract;if("-1"===r)return n([],-1),void 0;var a=document.createElement("body");a.innerHTML=i,n(e(a.getElementsByTagName("ol")[0]),r)},fetchData:function(e,t){var n=this;IO.jsonp({url:"http://en.wiktionary.org/w/api.php",jsonpName:"callback",data:{action:"query",titles:""+e,format:"json",prop:"extracts",indexpageids:!0},fun:function(e){n.handleResponse(e,t)}})}};bot.addCommand({name:"define",fun:o.command,thisArg:o,permissions:{del:"NONE"},description:"Fetches definition for a given word. `/define something`",async:!0})}(),function(){"use strict";function e(e,t){t+=Math.random()*2*r.jitter-r.jitter;for(var n=0;t>n;n++)e=" "+e;return e}function t(e){return" "+e+"\r"}function n(e){return e.sort(function(){return Math.random()-.5})}function o(o){var i=(o.length>0?""+o:r.message).split(","),a=n(r.words.slice(0)),s=t(e("wow",0|4+4*Math.random()));for(i.length>r.words.length&&i.splice(0,r.words.length);i.length;){var c="";a.length&&(c+=a.shift()+" "),c+=i.shift(),s+=t(e(c,r.spaces[i.length%3-1]))}o.send(s+"\r ")}var r={message:"fail,user,pro",spaces:[25,14,1],jitter:4,words:["so","very","such","much","many"]};bot.addCommand({fun:o,name:"doge",permissions:{del:"NONE"},description:"so shibe, much doge, wow [5 word max]"})}(),function(){function e(e,n){function o(e){var t=r(e);if(t)return i(t),void 0;var n="The domain {0} {1} available.",o=e.available?"*IS*":"is *NOT*";i(n.supplant(e.domain,o))}function r(e){var t="An error occured",n=!e.hasOwnProperty("status")||"success"!==e.status;return n?(e.status_desc&&(t+=": "+e.status_desc),t):(n=!(e.hasOwnProperty("domain")&&e.hasOwnProperty("available")),n?"Something went wrong with that request. Try again":!1)}function i(t){n&&n.call?n(t):e.reply(t)}IO.jsonp({data:{domain:e.content},url:t,fun:o,jsonpName:"cb"})}var t="http://www.lobby.ws/api/sap.js";bot.addCommand({name:"domain",fun:e,permissions:{del:"NONE"},description:"Check domain availability",async:!0})}(),function(){var e=function(e){var t=(""+e).toLowerCase(),n="",o=bot.getCommand(t),r=o.guesses;r||(n+="Exact match: "+o.name+". ",bot.commandDictionary.maxCost=Math.floor(t.length/3+1),r=bot.commandDictionary.search(t).filter(function(e){return e!==o.name})),r&&r.length&&(n+="Close matches: "+r.join(", ")+". ");var i=Object.keys(bot.commands).filter(function(e){var n=bot.commands[e].description.toLowerCase().indexOf(t)>-1;return n&&e.toLowerCase()!==t&&0>r.indexOf(e)});return i.length&&(n+="Loose matches: "+i.join(", ")),o.error||r.length||i.length||(n=o.name+": "+o.description),n||(n="I know nothing of it."),n.trim()};bot.addCommand({name:"findCommand",fun:e,permissions:{del:"NONE"},description:"Searches for a bot command matching part of a name/description. `/findCommand partOfNameOrDescription`"})}(),bot.listen(/(which |what |give me a )?firefly( episode)?/i,function(e){var t=["Serenity","The Train Job","Bushwhacked","Shindig","Safe","Our Mrs. Reynolds","Jaynestown","Out of Gas","Ariel","War Stories","Trash","The Message","Heart of Gold","Objects in Space"];if(-1===e.indexOf("episode")&&.05>Math.random())return"Serenity (movie)";var n=Math.floor(14*Math.random());return"Episode {0} - {1}".supplant(n+1,t[n])});var github={command:function(e,t){function n(n){bot.log(n,"/github finish"),t&&t.call?t(n):e.reply(n)}var o=/^([\S]+?)(?:\/([\S]+))?$/.exec(e),r=this.formatCb(n);bot.log(o,"/github input"),o?o[2]?this.searchUserRepo(o[1],o[2],r):this.searchRepo(o[1],r):n("I can't quite understand that format. See `/help github` for, well...help.")},formatCb:function(e){var t="{owner}/{name}";return function(n){if(n.error)return e(n.error),void 0;var o=n.full_name?n.full_name:t.supplant(n),r=n.html_url||n.url;e(bot.adapter.link(o,r)+" "+n.description)}},searchRepo:function(e,t){function n(e){bot.log(e,"/github searchRepo response");var n=e.data.repositories[0];n||(n={error:"No results found"}),t(n)}var o=encodeURIComponent(e);IO.jsonp({url:"https://api.github.com/legacy/repos/search/"+o,jsonpName:"callback",fun:n})},searchUserRepo:function(e,t,n){function o(e){bot.log(e,"/github searchUserRepo response");var t=e.data;"Not Found"===t.message&&(t={error:"User/Repo not found"}),n(t)}var r=encodeURIComponent(e);t=encodeURIComponent(t.replace(/ /g,"-").toLowerCase());var i="https://api.github.com/repos/{0}/{1}";IO.jsonp({url:i.supplant(r,t),jsonpName:"callback",fun:o})}};bot.addCommand({name:"github",fun:github.command,thisArg:github,permissions:{del:"NONE"},description:"Search github for a repo.`/github repoName` or `/github username/reponame`",async:!0}),function(){function e(e,n){function o(n){if(bot.log(n,"/google response"),200!==n.responseStatus)return s("My Google-Fu is on vacation; status "+n.responseStatus),void 0;var o=n.responseData.results.slice(0,3);return bot.log(o,"/google results"),o.length?(s(r(e.content,o)),void 0):(s(t.random()),void 0)}function r(e,t){var n=a(e)+" "+t.map(i).join(" ; ");return n.length>200&&(n=t.map(function(e){return e.unescapedUrl}).join(" ; ")),n}function i(t){var n=IO.decodehtmlEntities(t.titleNoFormatting);return e.link(n,t.unescapedUrl)}function a(t){return e.link("*","http://google.com/search?q="+encodeURIComponent(t))}function s(t){bot.log(t,"/google final"),n&&n.call?n(t):e.reply(t)}IO.jsonp.google(""+e+" -site:w3schools.com",o)}var t=["The Google contains no such knowledge","There are no search results. Run.","My Google Fu has failed."];bot.addCommand({name:"google",fun:e,permissions:{del:"NONE"},description:"Search Google. `/google query`",async:!0})}(),function(){"use strict";var e=function(e,t){function n(e){t(e.word.toLowerCase().trim())}var o="http://sleepy-bastion-8674.herokuapp.com/";Number(e)&&(o+="?length="+e),IO.jsonp({url:o,jsonpName:"callback",fun:n})},t={dude:[" +---+"," | |"," | 413"," | 2"," | 5 6","__+__"].join("\n"),parts:["","O","|","/","\\","/","\\"],word:"",revealed:"",guesses:[],guessNum:0,maxGuess:6,end:!0,msg:null,validGuessRegex:/^[a-zA-Z]+$/,receiveMessage:function(e){return this.msg=e,this.end?(this.new(e),void 0):this.handleGuess(e)},"new":function(n){function o(e){bot.log(e+" /hang random"),t.word=e,r.revealed=Array(e.length+1).join("-"),r.guesses=[],r.guessNum=0,r.guessMade(),r.end=!1,n.length&&!Number(n)&&r.receiveMessage(n)}var r=this;e(n,o)},handleGuess:function(e){var t=e.slice().toLowerCase();bot.log(t,"handleGuess");var n=this.checkGuess(t);if(n)return n;var o=this.word.indexesOf(t);return o.forEach(function(e){this.uncoverPart(t,e)},this),o.length||this.guessNum++,this.guesses.push(t),this.guessMade(),bot.log(t,"handleGuess handled"),this.loseCheck()?this.lose():this.winCheck()?this.win():void 0},checkGuess:function(e){return!e.length||Number(e)?"We're already playing!":this.validGuessRegex.test(e)?this.guesses.indexOf(e)>-1?e+" was already submitted":e.length>this.word.length?bot.adapter.codify(e)+" is too long to fit":void 0:"I will only accept alpha characters"},uncoverPart:function(e,t){this.revealed=this.revealed.slice(0,t)+e+this.revealed.slice(t+e.length)},preparePrint:function(){if(!this.end){var e=this,t=this.dude.replace(/\d/g,function(t){return t>e.guessNum?" ":e.parts[t]}),n=this.guesses.sort().join(", ")+"\n"+this.revealed,o=this.msg.codify(t+"\n"+n);bot.log(o,this.msg),this.msg.send(o)}},win:function(){return this.end=!0,"Correct! The word is "+this.word+"."},lose:function(){return this.end=!0,"You people suck. The word is "+this.word},winCheck:function(){return this.word===this.revealed},loseCheck:function(){return this.guessNum>=this.maxGuess},guessMade:function(){clearTimeout(this.printTimeout),this.printTimeout=setTimeout(this.preparePrint.bind(this),2e3)}};bot.addCommand({name:"hang",fun:t.receiveMessage,thisArg:t})}(),function(){"use strict";function e(e){function t(e){function o(e){for(var t=e.getElementsByTagName("a");t.length;)i(t[0]);return Array.reduce(e.childNodes,r,[]).join("").trim()}function r(e,n){return"UL"===n.tagName?e.push.apply(e,t(n).map(function(e){return n.firstChild.data+" – "+e})):1===n.nodeType?e.push(n.textContent):e.push(n.data),e}function i(e){var t=bot.adapter.link(e.textContent,n+e.getAttribute("href")),o=document.createTextNode(t);e.parentNode.replaceChild(o,e)}return Array.map(e.children,o)}for(var n="http://en.wikipedia.org",o=e.querySelectorAll("#content_1 > ul"),r=[],i=0,a=o.length;a>i;i+=1)r.push.apply(r,t(o[i]));return r}var t={command:function(e,t){function n(n){var o=n.random();t&&t.call?t(o):e.reply(o)}var o=this.extractParams(e);return o.error?o.error:(this.fetchData(o,n),void 0)},handleResponse:function(t,n,o){var r=t.parse.text,i=document.createElement("body");i.innerHTML=r;var a=e(i);o(this.filter(a,n))},extractParams:function(e){function t(){return{error:"That format confuses me! See `/help inhistory`"}}var n,o={};if(!e.length||"today"===e.toLowerCase())return n=new Date,o.month=n.getMonth()+1,o.day=n.getDate(),o;var r;if(r=/^\d{4}$/.exec(e))o.year=Number(r[0]);else{if(!(r=/^(?:(\d{4})(?:-|\/))?(\d{2})(?:-|\/)(\d{2})$/.exec(e)))return t();r[1]&&(o.year=Number(r[1])),o.month=Number(r[2]),o.day=Number(r[3])}return bot.log(o,"/inhistory extractParams"),this.paramsCheck(o)?o:t()},paramsCheck:function(e){var t=e[t],n=e[n],o=e[o];if(2===n&&o>29)return!1;var r=void 0===t||t>0,i=void 0===n||n>=1&&12>=n,a=void 0===o||o>=1&&31>=o;return r&&i&&a},filter:function(e,t){return t.year&&t.month?e.filter(function(e){var n=(/^\d+/.exec(e)||[])[0];return Number(n)===t.year}):e},fetchData:function(e,t){var n=[];n=e.year&&!e.month?[e.year]:[this.monthName(e.month),e.day];var o="http://en.wikipedia.org/w/api.php",r=this;IO.jsonp({url:o,jsonpName:"callback",data:{format:"json",action:"parse",mobileformat:"html",prop:"text",page:n.join(" ")},fun:function(n){r.handleResponse(n,e,t)}})},monthName:function(e){return["january","february","march","april","may","june","july","august","september","october","november","december"][e-1]}};bot.addCommand({name:"inhistory",fun:t.command,thisArg:t,permissions:{del:"NONE"},description:"Grabs a historical event from today's date or a date given in MM-DD format. `/inhistory [MM-DD]`",async:!0})}(),function(){function e(n){if(!n.content)return t;var o=n.parse(!0);if(o.length>1)return o.map(e).join(" ");var r,i=n.trim().replace(/^\$/,"jQuery"),a=i.split("."),s=!1,c=i;return bot.log(i,a,"/jquery input"),3===a.length&&(a=[a[2]]),"jQuery"===a[0]&&jQuery[a[1]]?s=!0:1===a.length&&jQuery.prototype[a[0]]?(c=a[0],s=!0):jQuery[a[0]]&&(c="jQuery."+a[0],s=!0),r=s?t+c:t+"?s="+encodeURIComponent(n),bot.log(r,"/jquery link"),r}var t="http://api.jquery.com/";bot.addCommand({name:"jquery",fun:e,permissions:{del:"NONE",use:"ALL"},description:"Fetches documentation link from jQuery API. `/jquery what`"})}(),function(){"use strict";function e(e){bot.log(e,"/learn input");var n=e.parse(),r={name:n[0],output:n[1],input:n[2]||".*",creator:e.get("user_name"),date:new Date},a=o(r);return a?a:(r.name=r.name.toLowerCase(),r.input=RegExp(r.input),r.description=["User-taught command:",n[3]||"",e.codify(r.output)].join(" "),bot.log(r,"/learn parsed"),t(r),i(r),"Command "+r.name+" learned")}function t(e){var t=bot.Command({name:e.name,description:e.description,creator:e.creator,date:e.date,fun:n(e),permissions:{use:"ALL",del:"ALL"}});t.learned=!0,t.del=function(n){return function(){a(e.name),n.call(t)}}(t.del),bot.log(t,"/learn addCustomCommand"),bot.addCommand(t)}function n(e){function t(){var t=c.exec(e.output)||[,"user"],n=t[1];return n.slice(1,-1)}var n=e.output.replace(c,"").trim(),o=t();return bot.log(e,"/learn makeCustomCommand"),function(t){bot.log(t,e.name+" input");var r=bot.Message(n,t.get()),i=e.input.exec(t);if(!i)return m.supplant(e);var a=bot.parseMacro(r,i);switch(o){case"":t.send(a);break;case"msg":t.directreply(a);break;default:t.reply(a)}}}function o(e){function t(e){if(!bot.commandExists(e))return!0;var t=bot.getCommand(e);return t.learned&&t.date.getTime()+3e5>Date.now()}var n,o=Object.keys(e).some(function(t){return!e[t]});return o?n="Illegal `/learn` object; see `/help learn`":/\s/.test(e.name)?n="Invalid command name":t(e.name)?u.test(e.output)&&(n="Please enter some output"):n="Command "+e.name+" already exists",n}function r(){function e(e,o){o=JSON.parse(o),o.input=n(o.input),o.date=new Date(Date.parse(o.date)),t(o)}function n(e){var t=(""+e).split("/");return RegExp(t.slice(1,-1).join("/"),t[t.length-1])}Object.iterate(s,e)}function i(e){s[e.name]=JSON.stringify(e),bot.memory.save("learn")}function a(e){delete s[e],bot.memory.save("learn")}var s=bot.memory.get("learn"),c=/^(<>|<user>|<msg>)/i,u=RegExp(c.source+"$","i"),m="Input not matching `{input}`. Help: {description}";bot.addCommand({name:"learn",fun:e,privileges:{del:"NONE"},description:"Teaches me a command. `/learn cmdName outputPattern [inputRegex [description]]`"}),r()}(),bot.addCommand({name:"live",fun:function(){return bot.stopped?(bot.continue(),"And on this day, you shall paint eggs for a giant bunny."):"I'm not dead! Honest!"},permissions:{del:"NONE",use:"OWNER"},description:"Resurrects me (:D) if I'm down (D:)"}),bot.addCommand(bot.CommunityCommand({name:"die",fun:function(){return bot.stopped?"Kill me once, shame on you, kill me twice...":(bot.stop(),"You killed me!")},permissions:{del:"NONE",use:"OWNER"},description:"Kills me :("})),function(){function e(e,t){function n(e){if(200!==e.responseStatus)return o("Something went on fire; status "+e.responseStatus),void 0;var t=e.responseData.results[0];bot.log(t,"/mdn result"),o(t.url)}function o(n){t&&t.call?t(n):e.reply(n)}IO.jsonp.google(""+e+" site:developer.mozilla.org",n)}bot.addCommand({name:"mdn",fun:e,permissions:{del:"NONE",use:"ALL"},description:"Fetches mdn documentation. `/mdn what`",async:!0})}(),function(){function e(e){return t+o[e]+"."+n}var t="http://cdn.alltheragefaces.com/img/faces/png/",n="png",o={deskflip:"angry-desk-flip",no:"angry-no",notbad:"obama-not-bad",ohyou:"happy-oh-stop-it-you",okay:"okay-okay-clean",troll:"troll-troll-face",trollface:"troll-troll-face",youdontsay:"misc-you-dont-say"},r=RegExp("^("+Object.keys(o).map(RegExp.escape).join("|")+")\\.(jpe?g|png)$");IO.register("input",function(t){var n=t.content.toLowerCase(),o=r.exec(n);if(o){var i=e(o[1]);bot.adapter.out.add(bot.adapter.directreply(t.message_id)+" "+i,t.room_id)}}),bot.addCommand({name:"meme",fun:function(t){var n=t.replace(/\.\w+$/,"");return o[n]?(t.directreply(e(n)),void 0):"Sorry, I don't know that one."},permissions:{del:"NONE"},description:"Return a simple meme link. `/meme memeName`"})}(),function(){"use strict";function e(e){function o(t){bot.log(t,"/mustache finish"),e.directreply("http://mustachify.me/"+i.mustache+"?src="+t)}function r(e){var t=e.parse(),n=t.pop(),o={};return t.length>0&&!/\D/.test(n)?(o.usrid=t.join(" "),o.mustache=n):(o.usrid=e.content,o.mustache=Math.rand(0,5)),o}var i=r(e),a=i.usrid;if(bot.log(i,"/mustache input"),t(a))return o(encodeURIComponent(a)),void 0;if(a?/\D/.test(a)&&(a=e.findUserid(a)):a=e.get("user_id"),bot.log(a,"/mustache mapped"),!bot.users.hasOwnProperty(a))return n.supplant(a,bot.adapter.roomid);if(Number(a)===bot.adapter.user_id)return["Nobody puts a mustache on me. Again.","Mustache me once, shame on you. Mustache me ---twice--- 9 times..."].random();var s=bot.users[a].email_hash;"!"===s[0]?o(encodeURIComponent(s.slice(1))+"#.png"):o("http%3A%2F%2Fwww.gravatar.com%2Favatar%2F{0}%3Fs%3D256%26d%3Didenticon#.png".supplant(s))}function t(e){return e.startsWith("http")||e.startsWith("www")}var n="User {0} was not found (if the user is not in room {1}, pass a user-id instead of a username).";bot.addCommand({name:"mustache",fun:e,privileges:{del:"NONE"},description:"Mustachifies a user. `/mustache [link|usrid|username] [mustache=rand(0,5)]`"})}(),function(){var e={895174:["sbaaaang","badbetonbreakbutbedbackbone","okok","donotusetabtodigitthisnick"]},t=bot.memory.get("tracker",e),n="*→ {0} (also known as {1}) changed his name to {2}*",o="*→ {0} changed his name to {2}*";IO.register("userregister",function(e,r){var i=t[e.id];if(i&&i[0].toLowerCase()!==e.name.toLowerCase()){bot.log(e,i,"tracking found suspect");var a=bot.adapter.link(i[0],IO.relativeUrlToAbsolute("/users/"+e.id)),s=i.length>1?n:o,c=s.supplant(a,i.slice(1),e.name);bot.adapter.out.add(c,r),i.unshift(e.name)}})}(),function(){function e(e,t){function n(n){var o;o="success"!==n.type?"Chuck Norris is too awesome for this API. Try again.":IO.decodehtmlEntities(n.value.joke),t&&t.call?t(o):e.reply(o)}var o="http://api.icndb.com/jokes/random";IO.jsonp({url:o,fun:n,jsonpName:"callback"})
}bot.addCommand({name:"norris",fun:e,permissions:{del:"NONE",use:"ALL"},description:"Random chuck norris joke!",async:!0})}(),function(){function e(){Date.now(),a=a.filter(function(e){return e.time-=c,0>=e.time?(t(e),!1):!0}),setTimeout(e,c)}function t(e){bot.log(e,"nudge fire"),e.msg.reply(e.message)}function n(e,t,n){var o;if(bot.log(e,t,"/nudge input"),e=parseFloat(e),o=6e4*e,isNaN(o))return"Many things can be labeled Not a Number; a delay should not be one of them.";s+=1;var r={msg:n,message:"*nudge* "+t,register:Date.now(),time:o,id:s};return a.push(r),bot.log(r,a,"/nudge register"),"Nudge #"+s+" registered."}function o(e,t){var n,o;return a.some(function(t,r){return t.id===e?(n=t,o=r,!0):void 0}),n?n.msg.get("user_name")!==t.get("user_name")?"It's not nice to try and remove a nudge which ain't yours":(bot.log(a[o],"/nudge remove #"+e),a.splice(o,1),"Nudge annhiliated"):["Nudge not found. Maybe it was already triggered, or this is a parallal universe.","I looked for nudge #"+e+", but all I found was this goat."].random()}function r(e){var t=e.parse(),r=t[0],i=t.slice(1).join(" ");return"remove"===r?o(Number(t[1]),e):n(r,i,e)}function i(e){return n(e.matches[1],e.matches[2],e)}var a=[],s=0,c=6e3;setTimeout(e,c),bot.addCommand({name:"nudge",fun:r,permissions:{del:"NONE"},description:"Register a nudge after an interval. `/nudge intervalInMinutes message`, `/nudge remove id` to remove, or the listener, `nudge|remind|poke me? in? intervalInMinutes message`"}),bot.listen(/(?:nudge|remind|poke)\s(?:me\s)?(?:in\s)?(\d+m?)\s?(.*)$/,i)}(),bot.addCommand({name:"parse",fun:function(e){var t=e.get(),n=bot.users[e.get("user_id")],o=Object.merge(t,n);return bot.log(e,o,"/parse input"),bot.parseMacro(""+e,o)},permissions:{del:"NONE",use:"ALL"},description:'Returns result of "parsing" message according to the my mini-macro capabilities (see online docs)'}),function(){"use strict";function e(){var n=Date.now();Object.iterate(c,function(e,o){n>o.endDate&&t(e)}),setTimeout(e,6e4)}function t(e,t){function n(){var n=Array.from(arguments);n.unshift(e),delete c[e],t&&(bot.memory.save("muted"),t&&t.apply(null,n))}bot.log("giving voice to "+e),IO.xhr({method:"POST",url:"/rooms/setuseraccess/"+s,data:{aclUserId:e,fkey:bot.adapter.fkey,userAccess:"read-write"},complete:n})}function n(e,t){function n(){c[e.id]={name:e.name,invokingId:e.invokingId,endDate:o(e.duration).getTime()},bot.memory.save("muted"),t.apply(null,arguments)}function o(e){var t=new Date,n=e.slice(-1),o=Number(e.slice(0,-1)),r={m:function(e){t.setMinutes(t.getMinutes()+e)},h:function(e){t.setHours(t.getHours()+e)},d:function(e){t.setDate(t.getDate()+e)}};return r[n](o),t}bot.log("taking voice",e),IO.xhr({method:"POST",url:"/rooms/setuseraccess/"+s,data:{aclUserId:e.id,fkey:bot.adapter.fkey,userAccess:"remove"},complete:n})}function o(){var e=Object.keys(c);if(!e.length)return"Nobody is muted";var t="http://chat.stackoverflow.com/transcript/message/";return e.map(function(e){var n=c[e],o=a(n.endDate),r=o?"("+o+")":"",i=e+r;return bot.adapter.link(i,t+n.invokingId)}).join("; ")}function r(e,t){var n={id:e};return/\D/.test(e)&&(n.id=t.findUserid(e)),0>n.id&&(n.error="User "+e+" not found"),n}function i(e){var t=/\d+([dhm]?)/.exec(e);return t?(t[1]||(t[0]+="m"),t[0]):null}function a(e){var t=Date.now();if(!(t>e)){var n=new Date(e-t),o=n.getUTCDate(),r=n.getUTCHours(),i=n.getUTCMinutes(),a=n.getUTCSeconds();return o>1?o-1+"d "+r+"h":r>0?r+"h "+i+"m":i+"m "+a+"s"}}var s=17;if(bot.adapter.roomid===s){var c=bot.memory.get("muted");setTimeout(e,6e4),IO.register("userregister",function(e,n){bot.log(e,n,"permissionCb");var o=e.id;return Number(n)!==s||bot.isOwner(o)||c[o]?(bot.log("not giving voice",e,n),void 0):(t(o),void 0)}),bot.addCommand({name:"mute",fun:function(e){function t(){e.reply("Muted user {0} for {1}".supplant(a.id,s))}var a,s,c=e.parse();return c.length?2>c.length?"Please give mute duration, see `/help mute`":(bot.log(c,"/mute input"),a=r(c[0],e),a.error?a.error:a.id===bot.adapter.user_id?"Never try and mute a bot who can own your ass.":bot.isOwner(a.id)?"You probably didn't want to mute a room owner.":(s=i(c[1]))?(n({id:a.id,invokingId:e.get("message_id"),duration:s},t),void 0):"I don't know how to follow that format, see `/help mute`"):o()},permissions:{del:"NONE",use:"OWNER"},description:"Mutes a user. `/mute usrid duration` Duration should be in the format `n[mhd]` for n minutes/hours/days. If only n is provided, minutes is assumed."}),bot.addCommand({name:"unmute",fun:function(e){function n(){e.reply("Unmuted user "+i.id)}var o=e.parse();if(bot.log(o,"/unmute input"),!o.length)return"Who shall I unmute?";var i=r(o[0],e);return i.error?i.error:(t(i.id,n),void 0)},permissions:{del:"NONE",use:"OWNER"},description:"Unmutes a user. `/unmute usrid`"})}}(),function(){function e(e){function n(e){return e.name.toLowerCase().indexOf(i)>-1}function o(t){var n=e.escape(t.name);return"["+n+"](http://es5.github.com/#"+t.section+")"}var r,i=e.content.toLowerCase();return r=t.filter(n).map(o),bot.log(r,"/spec done"),r.length?r.join(", "):e+" not found in spec"}var t;t=[{section:"introduction",name:"Introduction"},{section:"x1",name:"1 Scope"},{section:"x2",name:"2 Conformance"},{section:"x3",name:"3 Normative references"},{section:"x4",name:"4 Overview"},{section:"x4.1",name:"4.1 Web Scripting"},{section:"x4.2",name:"4.2 Language Overview"},{section:"x4.2.1",name:"4.2.1 Objects"},{section:"x4.2.2",name:"4.2.2 The Strict Variant of ECMAScript"},{section:"x4.3",name:"4.3 Definitions"},{section:"x4.3.1",name:"4.3.1 type"},{section:"x4.3.2",name:"4.3.2 primitive value"},{section:"x4.3.3",name:"4.3.3 object"},{section:"x4.3.4",name:"4.3.4 constructor"},{section:"x4.3.5",name:"4.3.5 prototype"},{section:"x4.3.6",name:"4.3.6 native object"},{section:"x4.3.7",name:"4.3.7 built-in object"},{section:"x4.3.8",name:"4.3.8 host object"},{section:"x4.3.9",name:"4.3.9 undefined value"},{section:"x4.3.10",name:"4.3.10 Undefined type"},{section:"x4.3.11",name:"4.3.11 null value"},{section:"x4.3.12",name:"4.3.12 Null type"},{section:"x4.3.13",name:"4.3.13 Boolean value"},{section:"x4.3.14",name:"4.3.14 Boolean type"},{section:"x4.3.15",name:"4.3.15 Boolean object"},{section:"x4.3.16",name:"4.3.16 String value"},{section:"x4.3.17",name:"4.3.17 String type"},{section:"x4.3.18",name:"4.3.18 String object"},{section:"x4.3.19",name:"4.3.19 Number value"},{section:"x4.3.20",name:"4.3.20 Number type"},{section:"x4.3.21",name:"4.3.21 Number object"},{section:"x4.3.22",name:"4.3.22 Infinity"},{section:"x4.3.23",name:"4.3.23 NaN"},{section:"x4.3.24",name:"4.3.24 function"},{section:"x4.3.25",name:"4.3.25 built-in function"},{section:"x4.3.26",name:"4.3.26 property"},{section:"x4.3.27",name:"4.3.27 method"},{section:"x4.3.28",name:"4.3.28 built-in method"},{section:"x4.3.29",name:"4.3.29 attribute"},{section:"x4.3.30",name:"4.3.30 own property"},{section:"x4.3.31",name:"4.3.31 inherited property"},{section:"x5",name:"5 Notational Conventions"},{section:"x5.1",name:"5.1 Syntactic and Lexical Grammars"},{section:"x5.1.1",name:"5.1.1 Context-Free Grammars"},{section:"x5.1.2",name:"5.1.2 The Lexical and RegExp Grammars"},{section:"x5.1.3",name:"5.1.3 The Numeric String Grammar"},{section:"x5.1.4",name:"5.1.4 The Syntactic Grammar"},{section:"x5.1.5",name:"5.1.5 The JSON Grammar"},{section:"x5.1.6",name:"5.1.6 Grammar Notation"},{section:"x5.2",name:"5.2 Algorithm Conventions"},{section:"x6",name:"6 Source Text"},{section:"x7",name:"7 Lexical Conventions"},{section:"x7.1",name:"7.1 Unicode Format-Control Characters"},{section:"x7.2",name:"7.2 White Space"},{section:"x7.3",name:"7.3 Line Terminators"},{section:"x7.4",name:"7.4 Comments"},{section:"x7.5",name:"7.5 Tokens"},{section:"x7.6",name:"7.6 Identifier Names and Identifiers"},{section:"x7.6.1",name:"7.6.1 Reserved Words"},{section:"x7.6.1.1",name:"7.6.1.1 Keywords"},{section:"x7.6.1.2",name:"7.6.1.2 Future Reserved Words"},{section:"x7.7",name:"7.7 Punctuators"},{section:"x7.8",name:"7.8 Literals"},{section:"x7.8.1",name:"7.8.1 Null Literals"},{section:"x7.8.2",name:"7.8.2 Boolean Literals"},{section:"x7.8.3",name:"7.8.3 Numeric Literals"},{section:"x7.8.4",name:"7.8.4 String Literals"},{section:"x7.8.5",name:"7.8.5 Regular Expression Literals"},{section:"x7.9",name:"7.9 Automatic Semicolon Insertion"},{section:"x7.9.1",name:"7.9.1 Rules of Automatic Semicolon Insertion"},{section:"x7.9.2",name:"7.9.2 Examples of Automatic Semicolon Insertion"},{section:"x8",name:"8 Types"},{section:"x8.1",name:"8.1 The Undefined Type"},{section:"x8.2",name:"8.2 The Null Type"},{section:"x8.3",name:"8.3 The Boolean Type"},{section:"x8.4",name:"8.4 The String Type"},{section:"x8.5",name:"8.5 The Number Type"},{section:"x8.6",name:"8.6 The Object Type"},{section:"x8.6.1",name:"8.6.1 Property Attributes"},{section:"x8.6.2",name:"8.6.2 Object Internal Properties and Methods"},{section:"x8.7",name:"8.7 The Reference Specification Type"},{section:"x8.7.1",name:"8.7.1 GetValue (V)"},{section:"x8.7.2",name:"8.7.2 PutValue (V, W)"},{section:"x8.8",name:"8.8 The List Specification Type"},{section:"x8.9",name:"8.9 The Completion Specification Type"},{section:"x8.10",name:"8.10 The Property Descriptor and Property Identifier Specification Types"},{section:"x8.10.1",name:"8.10.1 IsAccessorDescriptor ( Desc )"},{section:"x8.10.2",name:"8.10.2 IsDataDescriptor ( Desc )"},{section:"x8.10.3",name:"8.10.3 IsGenericDescriptor ( Desc )"},{section:"x8.10.4",name:"8.10.4 FromPropertyDescriptor ( Desc )"},{section:"x8.10.5",name:"8.10.5 ToPropertyDescriptor ( Obj )"},{section:"x8.11",name:"8.11 The Lexical Environment and Environment Record Specification Types"},{section:"x8.12",name:"8.12 Algorithms for Object Internal Methods"},{section:"x8.12.1",name:"8.12.1 [[GetOwnProperty]] (P)"},{section:"x8.12.2",name:"8.12.2 [[GetProperty]] (P)"},{section:"x8.12.3",name:"8.12.3 [[Get]] (P)"},{section:"x8.12.4",name:"8.12.4 [[CanPut]] (P)"},{section:"x8.12.5",name:"8.12.5 [[Put]] ( P, V, Throw )"},{section:"x8.12.6",name:"8.12.6 [[HasProperty]] (P)"},{section:"x8.12.7",name:"8.12.7 [[Delete]] (P, Throw)"},{section:"x8.12.8",name:"8.12.8 [[DefaultValue]] (hint)"},{section:"x8.12.9",name:"8.12.9 [[DefineOwnProperty]] (P, Desc, Throw)"},{section:"x9",name:"9 Type Conversion and Testing"},{section:"x9.1",name:"9.1 ToPrimitive"},{section:"x9.2",name:"9.2 ToBoolean"},{section:"x9.3",name:"9.3 ToNumber"},{section:"x9.3.1",name:"9.3.1 ToNumber Applied to the String Type"},{section:"x9.4",name:"9.4 ToInteger"},{section:"x9.5",name:"9.5 ToInt32: (Signed 32 Bit Integer)"},{section:"x9.6",name:"9.6 ToUint32: (Unsigned 32 Bit Integer)"},{section:"x9.7",name:"9.7 ToUint16: (Unsigned 16 Bit Integer)"},{section:"x9.8",name:"9.8 ToString"},{section:"x9.8.1",name:"9.8.1 ToString Applied to the Number Type"},{section:"x9.9",name:"9.9 ToObject"},{section:"x9.10",name:"9.10 CheckObjectCoercible"},{section:"x9.11",name:"9.11 IsCallable"},{section:"x9.12",name:"9.12 The SameValue Algorithm"},{section:"x10",name:"10 Executable Code and Execution Contexts"},{section:"x10.1",name:"10.1 Types of Executable Code"},{section:"x10.1.1",name:"10.1.1 Strict Mode Code"},{section:"x10.2",name:"10.2 Lexical Environments"},{section:"x10.2.1",name:"10.2.1 Environment Records"},{section:"x10.2.1.1",name:"10.2.1.1 Declarative Environment Records"},{section:"x10.2.1.1.1",name:"10.2.1.1.1 HasBinding(N)"},{section:"x10.2.1.1.2",name:"10.2.1.1.2 CreateMutableBinding (N, D)"},{section:"x10.2.1.1.3",name:"10.2.1.1.3 SetMutableBinding (N,V,S)"},{section:"x10.2.1.1.4",name:"10.2.1.1.4 GetBindingValue(N,S)"},{section:"x10.2.1.1.5",name:"10.2.1.1.5 DeleteBinding (N)"},{section:"x10.2.1.1.6",name:"10.2.1.1.6 ImplicitThisValue()"},{section:"x10.2.1.1.7",name:"10.2.1.1.7 CreateImmutableBinding (N)"},{section:"x10.2.1.1.8",name:"10.2.1.1.8 InitializeImmutableBinding (N,V)"},{section:"x10.2.1.2",name:"10.2.1.2 Object Environment Records"},{section:"x10.2.1.2.1",name:"10.2.1.2.1 HasBinding(N)"},{section:"x10.2.1.2.2",name:"10.2.1.2.2 CreateMutableBinding (N, D)"},{section:"x10.2.1.2.3",name:"10.2.1.2.3 SetMutableBinding (N,V,S)"},{section:"x10.2.1.2.4",name:"10.2.1.2.4 GetBindingValue(N,S)"},{section:"x10.2.1.2.5",name:"10.2.1.2.5 DeleteBinding (N)"},{section:"x10.2.1.2.6",name:"10.2.1.2.6 ImplicitThisValue()"},{section:"x10.2.2",name:"10.2.2 Lexical Environment Operations"},{section:"x10.2.2.1",name:"10.2.2.1 GetIdentifierReference (lex, name, strict)"},{section:"x10.2.2.2",name:"10.2.2.2 NewDeclarativeEnvironment (E)"},{section:"x10.2.2.3",name:"10.2.2.3 NewObjectEnvironment (O, E)"},{section:"x10.2.3",name:"10.2.3 The Global Environment"},{section:"x10.3",name:"10.3 Execution Contexts"},{section:"x10.3.1",name:"10.3.1 Identifier Resolution"},{section:"x10.4",name:"10.4 Establishing an Execution Context"},{section:"x10.4.1",name:"10.4.1 Entering Global Code"},{section:"x10.4.1.1",name:"10.4.1.1 Initial Global Execution Context"},{section:"x10.4.2",name:"10.4.2 Entering Eval Code"},{section:"x10.4.2.1",name:"10.4.2.1 Strict Mode Restrictions"},{section:"x10.4.3",name:"10.4.3 Entering Function Code"},{section:"x10.5",name:"10.5 Declaration Binding Instantiation"},{section:"x10.6",name:"10.6 Arguments Object"},{section:"x11",name:"11 Expressions"},{section:"x11.1",name:"11.1 Primary Expressions"},{section:"x11.1.1",name:"11.1.1 The this Keyword"},{section:"x11.1.2",name:"11.1.2 Identifier Reference"},{section:"x11.1.3",name:"11.1.3 Literal Reference"},{section:"x11.1.4",name:"11.1.4 Array Initialiser"},{section:"x11.1.5",name:"11.1.5 Object Initialiser"},{section:"x11.1.6",name:"11.1.6 The Grouping Operator"},{section:"x11.2",name:"11.2 Left-Hand-Side Expressions"},{section:"x11.2.1",name:"11.2.1 Property Accessors"},{section:"x11.2.2",name:"11.2.2 The new Operator"},{section:"x11.2.3",name:"11.2.3 Function Calls"},{section:"x11.2.4",name:"11.2.4 Argument Lists"},{section:"x11.2.5",name:"11.2.5 Function Expressions"},{section:"x11.3",name:"11.3 Postfix Expressions"},{section:"x11.3.1",name:"11.3.1 Postfix Increment Operator"},{section:"x11.3.2",name:"11.3.2 Postfix Decrement Operator"},{section:"x11.4",name:"11.4 Unary Operators"},{section:"x11.4.1",name:"11.4.1 The delete Operator"},{section:"x11.4.2",name:"11.4.2 The void Operator"},{section:"x11.4.3",name:"11.4.3 The typeof Operator"},{section:"x11.4.4",name:"11.4.4 Prefix Increment Operator"},{section:"x11.4.5",name:"11.4.5 Prefix Decrement Operator"},{section:"x11.4.6",name:"11.4.6 Unary + Operator"},{section:"x11.4.7",name:"11.4.7 Unary - Operator"},{section:"x11.4.8",name:"11.4.8 Bitwise NOT Operator ( ~ )"},{section:"x11.4.9",name:"11.4.9 Logical NOT Operator ( ! )"},{section:"x11.5",name:"11.5 Multiplicative Operators"},{section:"x11.5.1",name:"11.5.1 Applying the * Operator"},{section:"x11.5.2",name:"11.5.2 Applying the / Operator"},{section:"x11.5.3",name:"11.5.3 Applying the % Operator"},{section:"x11.6",name:"11.6 Additive Operators"},{section:"x11.6.1",name:"11.6.1 The Addition operator ( + )"},{section:"x11.6.2",name:"11.6.2 The Subtraction Operator ( - )"},{section:"x11.6.3",name:"11.6.3 Applying the Additive Operators to Numbers"},{section:"x11.7",name:"11.7 Bitwise Shift Operators"},{section:"x11.7.1",name:"11.7.1 The Left Shift Operator ( << )"},{section:"x11.7.2",name:"11.7.2 The Signed Right Shift Operator ( >> )"},{section:"x11.7.3",name:"11.7.3 The Unsigned Right Shift Operator ( >>> )"},{section:"x11.8",name:"11.8 Relational Operators"},{section:"x11.8.1",name:"11.8.1 The Less-than Operator ( < )"},{section:"x11.8.2",name:"11.8.2 The Greater-than Operator ( > )"},{section:"x11.8.3",name:"11.8.3 The Less-than-or-equal Operator ( <= )"},{section:"x11.8.4",name:"11.8.4 The Greater-than-or-equal Operator ( >= )"},{section:"x11.8.5",name:"11.8.5 The Abstract Relational Comparison Algorithm"},{section:"x11.8.6",name:"11.8.6 The instanceof operator"},{section:"x11.8.7",name:"11.8.7 The in operator"},{section:"x11.9",name:"11.9 Equality Operators"},{section:"x11.9.1",name:"11.9.1 The Equals Operator ( == )"},{section:"x11.9.2",name:"11.9.2 The Does-not-equals Operator ( != )"},{section:"x11.9.3",name:"11.9.3 The Abstract Equality Comparison Algorithm"},{section:"x11.9.4",name:"11.9.4 The Strict Equals Operator ( === )"},{section:"x11.9.5",name:"11.9.5 The Strict Does-not-equal Operator ( !== )"},{section:"x11.9.6",name:"11.9.6 The Strict Equality Comparison Algorithm"},{section:"x11.10",name:"11.10 Binary Bitwise Operators"},{section:"x11.11",name:"11.11 Binary Logical Operators"},{section:"x11.12",name:"11.12 Conditional Operator ( ? : )"},{section:"x11.13",name:"11.13 Assignment Operators"},{section:"x11.13.1",name:"11.13.1 Simple Assignment ( = )"},{section:"x11.13.2",name:"11.13.2 Compound Assignment ( op= )"},{section:"x11.14",name:"11.14 Comma Operator ( , )"},{section:"x12",name:"12 Statements"},{section:"x12.1",name:"12.1 Block"},{section:"x12.2",name:"12.2 Variable Statement"},{section:"x12.2.1",name:"12.2.1 Strict Mode Restrictions"},{section:"x12.3",name:"12.3 Empty Statement"},{section:"x12.4",name:"12.4 Expression Statement"},{section:"x12.5",name:"12.5 The if Statement"},{section:"x12.6",name:"12.6 Iteration Statements"},{section:"x12.6.1",name:"12.6.1 The do-while Statement"},{section:"x12.6.2",name:"12.6.2 The while Statement"},{section:"x12.6.3",name:"12.6.3 The for Statement"},{section:"x12.6.4",name:"12.6.4 The for-in Statement"},{section:"x12.7",name:"12.7 The continue Statement"},{section:"x12.8",name:"12.8 The break Statement"},{section:"x12.9",name:"12.9 The return Statement"},{section:"x12.10",name:"12.10 The with Statement"},{section:"x12.10.1",name:"12.10.1 Strict Mode Restrictions"},{section:"x12.11",name:"12.11 The switch Statement"},{section:"x12.12",name:"12.12 Labelled Statements"},{section:"x12.13",name:"12.13 The throw Statement"},{section:"x12.14",name:"12.14 The try Statement"},{section:"x12.14.1",name:"12.14.1 Strict Mode Restrictions"},{section:"x12.15",name:"12.15 The debugger statement"},{section:"x13",name:"13 Function Definition"},{section:"x13.1",name:"13.1 Strict Mode Restrictions"},{section:"x13.2",name:"13.2 Creating Function Objects"},{section:"x13.2.1",name:"13.2.1 [[Call]]"},{section:"x13.2.2",name:"13.2.2 [[Construct]]"},{section:"x13.2.3",name:"13.2.3 The Function Object"},{section:"x14",name:"14 Program"},{section:"x14.1",name:"14.1 Directive Prologues and the Use Strict Directive"},{section:"x15",name:"15 Standard Built-in ECMAScript Objects"},{section:"x15.1",name:"15.1 The Global Object"},{section:"x15.1.1",name:"15.1.1 Value Properties of the Global Object"},{section:"x15.1.1.1",name:"15.1.1.1 NaN"},{section:"x15.1.1.2",name:"15.1.1.2 Infinity"},{section:"x15.1.1.3",name:"15.1.1.3 undefined"},{section:"x15.1.2",name:"15.1.2 Function Properties of the Global Object"},{section:"x15.1.2.1",name:"15.1.2.1 eval (x)"},{section:"x15.1.2.1.1",name:"15.1.2.1.1 Direct Call to Eval"},{section:"x15.1.2.2",name:"15.1.2.2 parseInt (string , radix)"},{section:"x15.1.2.3",name:"15.1.2.3 parseFloat (string)"},{section:"x15.1.2.4",name:"15.1.2.4 isNaN (number)"},{section:"x15.1.2.5",name:"15.1.2.5 isFinite (number)"},{section:"x15.1.3",name:"15.1.3 URI Handling Function Properties"},{section:"x15.1.3.1",name:"15.1.3.1 decodeURI (encodedURI)"},{section:"x15.1.3.2",name:"15.1.3.2 decodeURIComponent (encodedURIComponent)"},{section:"x15.1.3.3",name:"15.1.3.3 encodeURI (uri)"},{section:"x15.1.3.4",name:"15.1.3.4 encodeURIComponent (uriComponent)"},{section:"x15.1.4",name:"15.1.4 Constructor Properties of the Global Object"},{section:"x15.1.4.1",name:"15.1.4.1 Object ( . . . )"},{section:"x15.1.4.2",name:"15.1.4.2 Function ( . . . )"},{section:"x15.1.4.3",name:"15.1.4.3 Array ( . . . )"},{section:"x15.1.4.4",name:"15.1.4.4 String ( . . . )"},{section:"x15.1.4.5",name:"15.1.4.5 Boolean ( . . . )"},{section:"x15.1.4.6",name:"15.1.4.6 Number ( . . . )"},{section:"x15.1.4.7",name:"15.1.4.7 Date ( . . . )"},{section:"x15.1.4.8",name:"15.1.4.8 RegExp ( . . . )"},{section:"x15.1.4.9",name:"15.1.4.9 Error ( . . . )"},{section:"x15.1.4.10",name:"15.1.4.10 EvalError ( . . . )"},{section:"x15.1.4.11",name:"15.1.4.11 RangeError ( . . . )"},{section:"x15.1.4.12",name:"15.1.4.12 ReferenceError ( . . . )"},{section:"x15.1.4.13",name:"15.1.4.13 SyntaxError ( . . . )"},{section:"x15.1.4.14",name:"15.1.4.14 TypeError ( . . . )"},{section:"x15.1.4.15",name:"15.1.4.15 URIError ( . . . )"},{section:"x15.1.5",name:"15.1.5 Other Properties of the Global Object"},{section:"x15.1.5.1",name:"15.1.5.1 Math"},{section:"x15.1.5.2",name:"15.1.5.2 JSON"},{section:"x15.2",name:"15.2 Object Objects"},{section:"x15.2.1",name:"15.2.1 The Object Constructor Called as a Function"},{section:"x15.2.1.1",name:"15.2.1.1 Object ( [ value ] )"},{section:"x15.2.2",name:"15.2.2 The Object Constructor"},{section:"x15.2.2.1",name:"15.2.2.1 new Object ( [ value ] )"},{section:"x15.2.3",name:"15.2.3 Properties of the Object Constructor"},{section:"x15.2.3.1",name:"15.2.3.1 Object.prototype"},{section:"x15.2.3.2",name:"15.2.3.2 Object.getPrototypeOf ( O )"},{section:"x15.2.3.3",name:"15.2.3.3 Object.getOwnPropertyDescriptor ( O, P ) "},{section:"x15.2.3.4",name:"15.2.3.4 Object.getOwnPropertyNames ( O )"},{section:"x15.2.3.5",name:"15.2.3.5 Object.create ( O [, Properties] )"},{section:"x15.2.3.6",name:"15.2.3.6 Object.defineProperty ( O, P, Attributes )"},{section:"x15.2.3.7",name:"15.2.3.7 Object.defineProperties ( O, Properties )"},{section:"x15.2.3.8",name:"15.2.3.8 Object.seal ( O )"},{section:"x15.2.3.9",name:"15.2.3.9 Object.freeze ( O )"},{section:"x15.2.3.10",name:"15.2.3.10 Object.preventExtensions ( O )"},{section:"x15.2.3.11",name:"15.2.3.11 Object.isSealed ( O )"},{section:"x15.2.3.12",name:"15.2.3.12 Object.isFrozen ( O )"},{section:"x15.2.3.13",name:"15.2.3.13 Object.isExtensible ( O )"},{section:"x15.2.3.14",name:"15.2.3.14 Object.keys ( O )"},{section:"x15.2.4",name:"15.2.4 Properties of the Object Prototype Object"},{section:"x15.2.4.1",name:"15.2.4.1 Object.prototype.constructor"},{section:"x15.2.4.2",name:"15.2.4.2 Object.prototype.toString ( )"},{section:"x15.2.4.3",name:"15.2.4.3 Object.prototype.toLocaleString ( )"},{section:"x15.2.4.4",name:"15.2.4.4 Object.prototype.valueOf ( )"},{section:"x15.2.4.5",name:"15.2.4.5 Object.prototype.hasOwnProperty (V)"},{section:"x15.2.4.6",name:"15.2.4.6 Object.prototype.isPrototypeOf (V)"},{section:"x15.2.4.7",name:"15.2.4.7 Object.prototype.propertyIsEnumerable (V)"},{section:"x15.2.5",name:"15.2.5 Properties of Object Instances"},{section:"x15.3",name:"15.3 Function Objects"},{section:"x15.3.1",name:"15.3.1 The Function Constructor Called as a Function"},{section:"x15.3.1.1",name:"15.3.1.1 Function (p1, p2, … , pn, body)"},{section:"x15.3.2",name:"15.3.2 The Function Constructor"},{section:"x15.3.2.1",name:"15.3.2.1 new Function (p1, p2, … , pn, body)"},{section:"x15.3.3",name:"15.3.3 Properties of the Function Constructor"},{section:"x15.3.3.1",name:"15.3.3.1 Function.prototype"},{section:"x15.3.3.2",name:"15.3.3.2 Function.length"},{section:"x15.3.4",name:"15.3.4 Properties of the Function Prototype Object"},{section:"x15.3.4.1",name:"15.3.4.1 Function.prototype.constructor"},{section:"x15.3.4.2",name:"15.3.4.2 Function.prototype.toString ( )"},{section:"x15.3.4.3",name:"15.3.4.3 Function.prototype.apply (thisArg, argArray)"},{section:"x15.3.4.4",name:"15.3.4.4 Function.prototype.call (thisArg [ , arg1 [ , arg2, … ] ] )"},{section:"x15.3.4.5",name:"15.3.4.5 Function.prototype.bind (thisArg [, arg1 [, arg2, …]])"},{section:"x15.3.4.5.1",name:"15.3.4.5.1 [[Call]]"},{section:"x15.3.4.5.2",name:"15.3.4.5.2 [[Construct]]"},{section:"x15.3.4.5.3",name:"15.3.4.5.3 [[HasInstance]] (V)"},{section:"x15.3.5",name:"15.3.5 Properties of Function Instances"},{section:"x15.3.5.1",name:"15.3.5.1 length"},{section:"x15.3.5.2",name:"15.3.5.2 prototype"},{section:"x15.3.5.3",name:"15.3.5.3 [[HasInstance]] (V)"},{section:"x15.3.5.4",name:"15.3.5.4 [[Get]] (P)"},{section:"x15.4",name:"15.4 Array Objects"},{section:"x15.4.1",name:"15.4.1 The Array Constructor Called as a Function"},{section:"x15.4.1.1",name:"15.4.1.1 Array ( [ item1 [ , item2 [ , … ] ] ] )"},{section:"x15.4.2",name:"15.4.2 The Array Constructor"},{section:"x15.4.2.1",name:"15.4.2.1 new Array ( [ item0 [ , item1 [ , … ] ] ] )"},{section:"x15.4.2.2",name:"15.4.2.2 new Array (len)"},{section:"x15.4.3",name:"15.4.3 Properties of the Array Constructor"},{section:"x15.4.3.1",name:"15.4.3.1 Array.prototype"},{section:"x15.4.3.2",name:"15.4.3.2 Array.isArray ( arg )"},{section:"x15.4.4",name:"15.4.4 Properties of the Array Prototype Object"},{section:"x15.4.4.1",name:"15.4.4.1 Array.prototype.constructor"},{section:"x15.4.4.2",name:"15.4.4.2 Array.prototype.toString ( )"},{section:"x15.4.4.3",name:"15.4.4.3 Array.prototype.toLocaleString ( )"},{section:"x15.4.4.4",name:"15.4.4.4 Array.prototype.concat ( [ item1 [ , item2 [ , … ] ] ] )"},{section:"x15.4.4.5",name:"15.4.4.5 Array.prototype.join (separator)"},{section:"x15.4.4.6",name:"15.4.4.6 Array.prototype.pop ( )"},{section:"x15.4.4.7",name:"15.4.4.7 Array.prototype.push ( [ item1 [ , item2 [ , … ] ] ] )"},{section:"x15.4.4.8",name:"15.4.4.8 Array.prototype.reverse ( )"},{section:"x15.4.4.9",name:"15.4.4.9 Array.prototype.shift ( )"},{section:"x15.4.4.10",name:"15.4.4.10 Array.prototype.slice (start, end)"},{section:"x15.4.4.11",name:"15.4.4.11 Array.prototype.sort (comparefn)"},{section:"x15.4.4.12",name:"15.4.4.12 Array.prototype.splice (start, deleteCount [ , item1 [ , item2 [ , … ] ] ] )"},{section:"x15.4.4.13",name:"15.4.4.13 Array.prototype.unshift ( [ item1 [ , item2 [ , … ] ] ] )"},{section:"x15.4.4.14",name:"15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] )"},{section:"x15.4.4.15",name:"15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )"},{section:"x15.4.4.16",name:"15.4.4.16 Array.prototype.every ( callbackfn [ , thisArg ] )"},{section:"x15.4.4.17",name:"15.4.4.17 Array.prototype.some ( callbackfn [ , thisArg ] )"},{section:"x15.4.4.18",name:"15.4.4.18 Array.prototype.forEach ( callbackfn [ , thisArg ] )"},{section:"x15.4.4.19",name:"15.4.4.19 Array.prototype.map ( callbackfn [ , thisArg ] )"},{section:"x15.4.4.20",name:"15.4.4.20 Array.prototype.filter ( callbackfn [ , thisArg ] )"},{section:"x15.4.4.21",name:"15.4.4.21 Array.prototype.reduce ( callbackfn [ , initialValue ] )"},{section:"x15.4.4.22",name:"15.4.4.22 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )"},{section:"x15.4.5",name:"15.4.5 Properties of Array Instances"},{section:"x15.4.5.1",name:"15.4.5.1 [[DefineOwnProperty]] ( P, Desc, Throw )"},{section:"x15.4.5.2",name:"15.4.5.2 length"},{section:"x15.5",name:"15.5 String Objects"},{section:"x15.5.1",name:"15.5.1 The String Constructor Called as a Function"},{section:"x15.5.1.1",name:"15.5.1.1 String ( [ value ] )"},{section:"x15.5.2",name:"15.5.2 The String Constructor"},{section:"x15.5.2.1",name:"15.5.2.1 new String ( [ value ] )"},{section:"x15.5.3",name:"15.5.3 Properties of the String Constructor"},{section:"x15.5.3.1",name:"15.5.3.1 String.prototype"},{section:"x15.5.3.2",name:"15.5.3.2 String.fromCharCode ( [ char0 [ , char1 [ , … ] ] ] )"},{section:"x15.5.4",name:"15.5.4 Properties of the String Prototype Object"},{section:"x15.5.4.1",name:"15.5.4.1 String.prototype.constructor"},{section:"x15.5.4.2",name:"15.5.4.2 String.prototype.toString ( )"},{section:"x15.5.4.3",name:"15.5.4.3 String.prototype.valueOf ( )"},{section:"x15.5.4.4",name:"15.5.4.4 String.prototype.charAt (pos)"},{section:"x15.5.4.5",name:"15.5.4.5 String.prototype.charCodeAt (pos)"},{section:"x15.5.4.6",name:"15.5.4.6 String.prototype.concat ( [ string1 [ , string2 [ , … ] ] ] )"},{section:"x15.5.4.7",name:"15.5.4.7 String.prototype.indexOf (searchString, position)"},{section:"x15.5.4.8",name:"15.5.4.8 String.prototype.lastIndexOf (searchString, position)"},{section:"x15.5.4.9",name:"15.5.4.9 String.prototype.localeCompare (that)"},{section:"x15.5.4.10",name:"15.5.4.10 String.prototype.match (regexp)"},{section:"x15.5.4.11",name:"15.5.4.11 String.prototype.replace (searchValue, replaceValue)"},{section:"x15.5.4.12",name:"15.5.4.12 String.prototype.search (regexp)"},{section:"x15.5.4.13",name:"15.5.4.13 String.prototype.slice (start, end)"},{section:"x15.5.4.14",name:"15.5.4.14 String.prototype.split (separator, limit)"},{section:"x15.5.4.15",name:"15.5.4.15 String.prototype.substring (start, end)"},{section:"x15.5.4.16",name:"15.5.4.16 String.prototype.toLowerCase ( )"},{section:"x15.5.4.17",name:"15.5.4.17 String.prototype.toLocaleLowerCase ( )"},{section:"x15.5.4.18",name:"15.5.4.18 String.prototype.toUpperCase ( )"},{section:"x15.5.4.19",name:"15.5.4.19 String.prototype.toLocaleUpperCase ( )"},{section:"x15.5.4.20",name:"15.5.4.20 String.prototype.trim ( )"},{section:"x15.5.5",name:"15.5.5 Properties of String Instances"},{section:"x15.5.5.1",name:"15.5.5.1 length"},{section:"x15.5.5.2",name:"15.5.5.2 [[GetOwnProperty]] ( P )"},{section:"x15.6",name:"15.6 Boolean Objects"},{section:"x15.6.1",name:"15.6.1 The Boolean Constructor Called as a Function"},{section:"x15.6.1.1",name:"15.6.1.1 Boolean (value)"},{section:"x15.6.2",name:"15.6.2 The Boolean Constructor"},{section:"x15.6.2.1",name:"15.6.2.1 new Boolean (value)"},{section:"x15.6.3",name:"15.6.3 Properties of the Boolean Constructor"},{section:"x15.6.3.1",name:"15.6.3.1 Boolean.prototype"},{section:"x15.6.4",name:"15.6.4 Properties of the Boolean Prototype Object"},{section:"x15.6.4.1",name:"15.6.4.1 Boolean.prototype.constructor"},{section:"x15.6.4.2",name:"15.6.4.2 Boolean.prototype.toString ( )"},{section:"x15.6.4.3",name:"15.6.4.3 Boolean.prototype.valueOf ( )"},{section:"x15.6.5",name:"15.6.5 Properties of Boolean Instances"},{section:"x15.7",name:"15.7 Number Objects"},{section:"x15.7.1",name:"15.7.1 The Number Constructor Called as a Function"},{section:"x15.7.1.1",name:"15.7.1.1 Number ( [ value ] )"},{section:"x15.7.2",name:"15.7.2 The Number Constructor"},{section:"x15.7.2.1",name:"15.7.2.1 new Number ( [ value ] )"},{section:"x15.7.3",name:"15.7.3 Properties of the Number Constructor"},{section:"x15.7.3.1",name:"15.7.3.1 Number.prototype"},{section:"x15.7.3.2",name:"15.7.3.2 Number.MAX_VALUE"},{section:"x15.7.3.3",name:"15.7.3.3 Number.MIN_VALUE"},{section:"x15.7.3.4",name:"15.7.3.4 Number.NaN"},{section:"x15.7.3.5",name:"15.7.3.5 Number.NEGATIVE_INFINITY"},{section:"x15.7.3.6",name:"15.7.3.6 Number.POSITIVE_INFINITY"},{section:"x15.7.4",name:"15.7.4 Properties of the Number Prototype Object"},{section:"x15.7.4.1",name:"15.7.4.1 Number.prototype.constructor"},{section:"x15.7.4.2",name:"15.7.4.2 Number.prototype.toString ( [ radix ] )"},{section:"x15.7.4.3",name:"15.7.4.3 Number.prototype.toLocaleString()"},{section:"x15.7.4.4",name:"15.7.4.4 Number.prototype.valueOf ( )"},{section:"x15.7.4.5",name:"15.7.4.5 Number.prototype.toFixed (fractionDigits)"},{section:"x15.7.4.6",name:"15.7.4.6 Number.prototype.toExponential (fractionDigits)"},{section:"x15.7.4.7",name:"15.7.4.7 Number.prototype.toPrecision (precision)"},{section:"x15.7.5",name:"15.7.5 Properties of Number Instances"},{section:"x15.8",name:"15.8 The Math Object"},{section:"x15.8.1",name:"15.8.1 Value Properties of the Math Object"},{section:"x15.8.1.1",name:"15.8.1.1 E"},{section:"x15.8.1.2",name:"15.8.1.2 LN10"},{section:"x15.8.1.3",name:"15.8.1.3 LN2"},{section:"x15.8.1.4",name:"15.8.1.4 LOG2E"},{section:"x15.8.1.5",name:"15.8.1.5 LOG10E"},{section:"x15.8.1.6",name:"15.8.1.6 PI"},{section:"x15.8.1.7",name:"15.8.1.7 SQRT1_2"},{section:"x15.8.1.8",name:"15.8.1.8 SQRT2"},{section:"x15.8.2",name:"15.8.2 Function Properties of the Math Object"},{section:"x15.8.2.1",name:"15.8.2.1 abs (x)"},{section:"x15.8.2.2",name:"15.8.2.2 acos (x)"},{section:"x15.8.2.3",name:"15.8.2.3 asin (x)"},{section:"x15.8.2.4",name:"15.8.2.4 atan (x)"},{section:"x15.8.2.5",name:"15.8.2.5 atan2 (y, x)"},{section:"x15.8.2.6",name:"15.8.2.6 ceil (x)"},{section:"x15.8.2.7",name:"15.8.2.7 cos (x)"},{section:"x15.8.2.8",name:"15.8.2.8 exp (x)"},{section:"x15.8.2.9",name:"15.8.2.9 floor (x)"},{section:"x15.8.2.10",name:"15.8.2.10 log (x)"},{section:"x15.8.2.11",name:"15.8.2.11 max ( [ value1 [ , value2 [ , … ] ] ] )"},{section:"x15.8.2.12",name:"15.8.2.12 min ( [ value1 [ , value2 [ , … ] ] ] )"},{section:"x15.8.2.13",name:"15.8.2.13 pow (x, y)"},{section:"x15.8.2.14",name:"15.8.2.14 random ( )"},{section:"x15.8.2.15",name:"15.8.2.15 round (x)"},{section:"x15.8.2.16",name:"15.8.2.16 sin (x)"},{section:"x15.8.2.17",name:"15.8.2.17 sqrt (x)"},{section:"x15.8.2.18",name:"15.8.2.18 tan (x)"},{section:"x15.9",name:"15.9 Date Objects"},{section:"x15.9.1",name:"15.9.1 Overview of Date Objects and Definitions of Abstract Operators"},{section:"x15.9.1.1",name:"15.9.1.1 Time Values and Time Range"},{section:"x15.9.1.2",name:"15.9.1.2 Day Number and Time within Day"},{section:"x15.9.1.3",name:"15.9.1.3 Year Number"},{section:"x15.9.1.4",name:"15.9.1.4 Month Number"},{section:"x15.9.1.5",name:"15.9.1.5 Date Number"},{section:"x15.9.1.6",name:"15.9.1.6 Week Day"},{section:"x15.9.1.7",name:"15.9.1.7 Local Time Zone Adjustment"},{section:"x15.9.1.8",name:"15.9.1.8 Daylight Saving Time Adjustment"},{section:"x15.9.1.9",name:"15.9.1.9 Local Time"},{section:"x15.9.1.10",name:"15.9.1.10 Hours, Minutes, Second, and Milliseconds"},{section:"x15.9.1.11",name:"15.9.1.11 MakeTime (hour, min, sec, ms)"},{section:"x15.9.1.12",name:"15.9.1.12 MakeDay (year, month, date)"},{section:"x15.9.1.13",name:"15.9.1.13 MakeDate (day, time)"},{section:"x15.9.1.14",name:"15.9.1.14 TimeClip (time)"},{section:"x15.9.1.15",name:"15.9.1.15 Date Time String Format"},{section:"x15.9.1.15.1",name:"15.9.1.15.1 Extended years"},{section:"x15.9.2",name:"15.9.2 The Date Constructor Called as a Function"},{section:"x15.9.2.1",name:"15.9.2.1 Date ( [ year [, month [, date [, hours [, minutes [, seconds [, ms ] ] ] ] ] ] ] )"},{section:"x15.9.3",name:"15.9.3 The Date Constructor"},{section:"x15.9.3.1",name:"15.9.3.1 new Date (year, month [, date [, hours [, minutes [, seconds [, ms ] ] ] ] ] )"},{section:"x15.9.3.2",name:"15.9.3.2 new Date (value)"},{section:"x15.9.3.3",name:"15.9.3.3 new Date ( )"},{section:"x15.9.4",name:"15.9.4 Properties of the Date Constructor"},{section:"x15.9.4.1",name:"15.9.4.1 Date.prototype"},{section:"x15.9.4.2",name:"15.9.4.2 Date.parse (string)"},{section:"x15.9.4.3",name:"15.9.4.3 Date.UTC (year, month [, date [, hours [, minutes [, seconds [, ms ] ] ] ] ])"},{section:"x15.9.4.4",name:"15.9.4.4 Date.now ( )"},{section:"x15.9.5",name:"15.9.5 Properties of the Date Prototype Object"},{section:"x15.9.5.1",name:"15.9.5.1 Date.prototype.constructor"},{section:"x15.9.5.2",name:"15.9.5.2 Date.prototype.toString ( )"},{section:"x15.9.5.3",name:"15.9.5.3 Date.prototype.toDateString ( )"},{section:"x15.9.5.4",name:"15.9.5.4 Date.prototype.toTimeString ( )"},{section:"x15.9.5.5",name:"15.9.5.5 Date.prototype.toLocaleString ( )"},{section:"x15.9.5.6",name:"15.9.5.6 Date.prototype.toLocaleDateString ( )"},{section:"x15.9.5.7",name:"15.9.5.7 Date.prototype.toLocaleTimeString ( )"},{section:"x15.9.5.8",name:"15.9.5.8 Date.prototype.valueOf ( )"},{section:"x15.9.5.9",name:"15.9.5.9 Date.prototype.getTime ( )"},{section:"x15.9.5.10",name:"15.9.5.10 Date.prototype.getFullYear ( )"},{section:"x15.9.5.11",name:"15.9.5.11 Date.prototype.getUTCFullYear ( )"},{section:"x15.9.5.12",name:"15.9.5.12 Date.prototype.getMonth ( )"},{section:"x15.9.5.13",name:"15.9.5.13 Date.prototype.getUTCMonth ( )"},{section:"x15.9.5.14",name:"15.9.5.14 Date.prototype.getDate ( )"},{section:"x15.9.5.15",name:"15.9.5.15 Date.prototype.getUTCDate ( )"},{section:"x15.9.5.16",name:"15.9.5.16 Date.prototype.getDay ( )"},{section:"x15.9.5.17",name:"15.9.5.17 Date.prototype.getUTCDay ( )"},{section:"x15.9.5.18",name:"15.9.5.18 Date.prototype.getHours ( )"},{section:"x15.9.5.19",name:"15.9.5.19 Date.prototype.getUTCHours ( )"},{section:"x15.9.5.20",name:"15.9.5.20 Date.prototype.getMinutes ( )"},{section:"x15.9.5.21",name:"15.9.5.21 Date.prototype.getUTCMinutes ( )"},{section:"x15.9.5.22",name:"15.9.5.22 Date.prototype.getSeconds ( )"},{section:"x15.9.5.23",name:"15.9.5.23 Date.prototype.getUTCSeconds ( )"},{section:"x15.9.5.24",name:"15.9.5.24 Date.prototype.getMilliseconds ( )"},{section:"x15.9.5.25",name:"15.9.5.25 Date.prototype.getUTCMilliseconds ( )"},{section:"x15.9.5.26",name:"15.9.5.26 Date.prototype.getTimezoneOffset ( )"},{section:"x15.9.5.27",name:"15.9.5.27 Date.prototype.setTime (time)"},{section:"x15.9.5.28",name:"15.9.5.28 Date.prototype.setMilliseconds (ms)"},{section:"x15.9.5.29",name:"15.9.5.29 Date.prototype.setUTCMilliseconds (ms)"},{section:"x15.9.5.30",name:"15.9.5.30 Date.prototype.setSeconds (sec [, ms ] )"},{section:"x15.9.5.31",name:"15.9.5.31 Date.prototype.setUTCSeconds (sec [, ms ] )"},{section:"x15.9.5.32",name:"15.9.5.32 Date.prototype.setMinutes (min [, sec [, ms ] ] )"},{section:"x15.9.5.33",name:"15.9.5.33 Date.prototype.setUTCMinutes (min [, sec [, ms ] ] )"},{section:"x15.9.5.34",name:"15.9.5.34 Date.prototype.setHours (hour [, min [, sec [, ms ] ] ] )"},{section:"x15.9.5.35",name:"15.9.5.35 Date.prototype.setUTCHours (hour [, min [, sec [, ms ] ] ] )"},{section:"x15.9.5.36",name:"15.9.5.36 Date.prototype.setDate (date)"},{section:"x15.9.5.37",name:"15.9.5.37 Date.prototype.setUTCDate (date)"},{section:"x15.9.5.38",name:"15.9.5.38 Date.prototype.setMonth (month [, date ] )"},{section:"x15.9.5.39",name:"15.9.5.39 Date.prototype.setUTCMonth (month [, date ] )"},{section:"x15.9.5.40",name:"15.9.5.40 Date.prototype.setFullYear (year [, month [, date ] ] )"},{section:"x15.9.5.41",name:"15.9.5.41 Date.prototype.setUTCFullYear (year [, month [, date ] ] )"},{section:"x15.9.5.42",name:"15.9.5.42 Date.prototype.toUTCString ( )"},{section:"x15.9.5.43",name:"15.9.5.43 Date.prototype.toISOString ( )"},{section:"x15.9.5.44",name:"15.9.5.44 Date.prototype.toJSON ( key )"},{section:"x15.9.6",name:"15.9.6 Properties of Date Instances"},{section:"x15.10",name:"15.10 RegExp (Regular Expression) Objects"},{section:"x15.10.1",name:"15.10.1 Patterns"},{section:"x15.10.2",name:"15.10.2 Pattern Semantics"},{section:"x15.10.2.1",name:"15.10.2.1 Notation"},{section:"x15.10.2.2",name:"15.10.2.2 Pattern"},{section:"x15.10.2.3",name:"15.10.2.3 Disjunction"},{section:"x15.10.2.4",name:"15.10.2.4 Alternative"},{section:"x15.10.2.5",name:"15.10.2.5 Term"},{section:"x15.10.2.6",name:"15.10.2.6 Assertion"},{section:"x15.10.2.7",name:"15.10.2.7 Quantifier"},{section:"x15.10.2.8",name:"15.10.2.8 Atom"},{section:"x15.10.2.9",name:"15.10.2.9 AtomEscape"},{section:"x15.10.2.10",name:"15.10.2.10 CharacterEscape"},{section:"x15.10.2.11",name:"15.10.2.11 DecimalEscape"},{section:"x15.10.2.12",name:"15.10.2.12 CharacterClassEscape"},{section:"x15.10.2.13",name:"15.10.2.13 CharacterClass"},{section:"x15.10.2.14",name:"15.10.2.14 ClassRanges"},{section:"x15.10.2.15",name:"15.10.2.15 NonemptyClassRanges"},{section:"x15.10.2.16",name:"15.10.2.16 NonemptyClassRangesNoDash"},{section:"x15.10.2.17",name:"15.10.2.17 ClassAtom"},{section:"x15.10.2.18",name:"15.10.2.18 ClassAtomNoDash"},{section:"x15.10.2.19",name:"15.10.2.19 ClassEscape"},{section:"x15.10.3",name:"15.10.3 The RegExp Constructor Called as a Function"},{section:"x15.10.3.1",name:"15.10.3.1 RegExp(pattern, flags)"},{section:"x15.10.4",name:"15.10.4 The RegExp Constructor"},{section:"x15.10.4.1",name:"15.10.4.1 new RegExp(pattern, flags)"},{section:"x15.10.5",name:"15.10.5 Properties of the RegExp Constructor"},{section:"x15.10.5.1",name:"15.10.5.1 RegExp.prototype"},{section:"x15.10.6",name:"15.10.6 Properties of the RegExp Prototype Object"},{section:"x15.10.6.1",name:"15.10.6.1 RegExp.prototype.constructor"},{section:"x15.10.6.2",name:"15.10.6.2 RegExp.prototype.exec(string)"},{section:"x15.10.6.3",name:"15.10.6.3 RegExp.prototype.test(string)"},{section:"x15.10.6.4",name:"15.10.6.4 RegExp.prototype.toString()"},{section:"x15.10.7",name:"15.10.7 Properties of RegExp Instances"},{section:"x15.10.7.1",name:"15.10.7.1 source"},{section:"x15.10.7.2",name:"15.10.7.2 global"},{section:"x15.10.7.3",name:"15.10.7.3 ignoreCase"},{section:"x15.10.7.4",name:"15.10.7.4 multiline"},{section:"x15.10.7.5",name:"15.10.7.5 lastIndex"},{section:"x15.11",name:"15.11 Error Objects"},{section:"x15.11.1",name:"15.11.1 The Error Constructor Called as a Function"},{section:"x15.11.1.1",name:"15.11.1.1 Error (message)"},{section:"x15.11.2",name:"15.11.2 The Error Constructor"},{section:"x15.11.2.1",name:"15.11.2.1 new Error (message)"},{section:"x15.11.3",name:"15.11.3 Properties of the Error Constructor"},{section:"x15.11.3.1",name:"15.11.3.1 Error.prototype"},{section:"x15.11.4",name:"15.11.4 Properties of the Error Prototype Object"},{section:"x15.11.4.1",name:"15.11.4.1 Error.prototype.constructor"},{section:"x15.11.4.2",name:"15.11.4.2 Error.prototype.name"},{section:"x15.11.4.3",name:"15.11.4.3 Error.prototype.message"},{section:"x15.11.4.4",name:"15.11.4.4 Error.prototype.toString ( )"},{section:"x15.11.5",name:"15.11.5 Properties of Error Instances"},{section:"x15.11.6",name:"15.11.6 Native Error Types Used in This Standard"},{section:"x15.11.6.1",name:"15.11.6.1 EvalError"},{section:"x15.11.6.2",name:"15.11.6.2 RangeError"},{section:"x15.11.6.3",name:"15.11.6.3 ReferenceError"},{section:"x15.11.6.4",name:"15.11.6.4 SyntaxError"},{section:"x15.11.6.5",name:"15.11.6.5 TypeError"},{section:"x15.11.6.6",name:"15.11.6.6 URIError"},{section:"x15.11.7",name:"15.11.7 NativeError Object Structure"},{section:"x15.11.7.1",name:"15.11.7.1 NativeError Constructors Called as Functions"},{section:"x15.11.7.2",name:"15.11.7.2 NativeError (message)"},{section:"x15.11.7.3",name:"15.11.7.3 The NativeError Constructors"},{section:"x15.11.7.4",name:"15.11.7.4 New NativeError (message)"},{section:"x15.11.7.5",name:"15.11.7.5 Properties of the NativeError Constructors"},{section:"x15.11.7.6",name:"15.11.7.6 NativeError.prototype"},{section:"x15.11.7.7",name:"15.11.7.7 Properties of the NativeError Prototype Objects"},{section:"x15.11.7.8",name:"15.11.7.8 NativeError.prototype.constructor"},{section:"x15.11.7.9",name:"15.11.7.9 NativeError.prototype.name"},{section:"x15.11.7.10",name:"15.11.7.10 NativeError.prototype.message"},{section:"x15.11.7.11",name:"15.11.7.11 Properties of NativeError Instances"},{section:"x15.12",name:"15.12 The JSON Object"},{section:"x15.12.1",name:"15.12.1 The JSON Grammar "},{section:"x15.12.1.1",name:"15.12.1.1 The JSON Lexical Grammar"},{section:"x15.12.1.2",name:"15.12.1.2 The JSON Syntactic Grammar"},{section:"x15.12.2",name:"15.12.2 parse ( text [ , reviver ] )"},{section:"x15.12.3",name:"15.12.3 stringify ( value [ , replacer [ , space ] ] )"},{section:"x16",name:"16 Errors"},{section:"A",name:"Annex A (informative) Grammar Summary"},{section:"A.1",name:"A.1 Lexical Grammar"},{section:"A.2",name:"A.2 Number Conversions"},{section:"A.3",name:"A.3 Expressions"},{section:"A.4",name:"A.4 Statements"},{section:"A.5",name:"A.5 Functions and Programs"},{section:"A.6",name:"A.6 Universal Resource Identifier Character Classes"},{section:"A.7",name:"A.7 Regular Expressions"},{section:"A.8",name:"A.8 JSON"},{section:"A.8.1",name:"A.8.1 JSON Lexical Grammar"},{section:"A.8.2",name:"A.8.2 JSON Syntactic Grammar"},{section:"B",name:"Annex B (informative) Compatibility"},{section:"B.1",name:"B.1 Additional Syntax"},{section:"B.1.1",name:"B.1.1 Numeric Literals"},{section:"B.1.2",name:"B.1.2 String Literals"},{section:"B.2",name:"B.2 Additional Properties"},{section:"B.2.1",name:"B.2.1 escape (string)"},{section:"B.2.2",name:"B.2.2 unescape (string)"},{section:"B.2.3",name:"B.2.3 String.prototype.substr (start, length)"},{section:"B.2.4",name:"B.2.4 Date.prototype.getYear ( )"},{section:"B.2.5",name:"B.2.5 Date.prototype.setYear (year)"},{section:"B.2.6",name:"B.2.6 Date.prototype.toGMTString ( )"},{section:"C",name:"Annex C (informative) The Strict Mode of ECMAScript"},{section:"D",name:"Annex D (informative) Corrections and Clarifications in the 5th Edition with Possible 3rd Edition Compatibility Impact"},{section:"E",name:"Annex E (informative) Additions and Changes in the 5th Edition that Introduce Incompatibilities with the 3rd Edition"},{section:"bibliography",name:"Bibliography"}],bot.addCommand({name:"spec",fun:e,permissions:{del:"NONE"},description:"Find a section in the ES5 spec"})
}(),function(){function e(e,n){function o(e){if(e.error_message)return r(e.error_message),void 0;var n,o=e.items[0];n=o?t(o):"User "+i+" not found",r(n)}function r(t){n?n(t):e.reply(t)}var i=""+e;return i?/^\d+$/.test(i)||(i=e.findUserid(i)):i=e.get("user_id"),0>i?"User Elusio proved elusive.":.05>=Math.random()?(r("That dude sucks"),void 0):(IO.jsonp({url:"https://api.stackexchange.com/2.0/users/"+i,data:{site:bot.adapter.site,filter:"!G*klMsSp1IcBUKxXMwhRe8TaI("},fun:o}),void 0)}function t(e){var t=o.supplant(n(e));return bot.log(t,"/stat templated"),t}function n(e){return e=Object.merge({question_count:0,answer_count:0,reputation_change_day:0},e),e=Object.merge(e.badge_counts,e),e.avg_rep_post=(e.reputation/(e.question_count+e.answer_count)).maxDecimal(2),1/0===e.avg_rep_post&&(e.avg_rep_post="T͎͍̘͙̖̤̉̌̇̅ͯ͋͢͜͝H̖͙̗̗̺͚̱͕̒́͟E̫̺̯͖͎̗̒͑̅̈ ̈ͮ̽ͯ̆̋́͏͙͓͓͇̹<̩̟̳̫̪̇ͩ̑̆͗̽̇͆́ͅC̬͎ͪͩ̓̑͊ͮͪ̄̚̕Ě̯̰̤̗̜̗͓͛͝N̶̴̞͇̟̲̪̅̓ͯͅT͍̯̰͓̬͚̅͆̄E̠͇͇̬̬͕͖ͨ̔̓͞R͚̠̻̲̗̹̀>̇̏ͣ҉̳̖̟̫͕ ̧̛͈͙͇͂̓̚͡C͈̞̻̩̯̠̻ͥ̆͐̄ͦ́̀͟A̛̪̫͙̺̱̥̞̙ͦͧ̽͛̈́ͯ̅̍N̦̭͕̹̤͓͙̲̑͋̾͊ͣŅ̜̝͌͟O̡̝͍͚̲̝ͣ̔́͝Ť͈͢ ̪̘̳͔̂̒̋ͭ͆̽͠H̢͈̤͚̬̪̭͗ͧͬ̈́̈̀͌͒͡Ơ̮͍͇̝̰͍͚͖̿ͮ̀̍́L͐̆ͨ̏̎͡҉̧̱̯̤̹͓̗̻̭ͅḐ̲̰͙͑̂̒̐́̊"),e}var o="[{display_name}]({link}) has {reputation} reputation, earned {reputation_change_day} rep today, asked {question_count} questions, gave {answer_count} answers. avg. rep/post: {avg_rep_post}. Badges: {gold}g {silver}s {bronze}b ",r={name:"stat",fun:e,permissions:{del:"NONE"},description:"Gives useless stats on a user. `/stat [usrid|usrname]`",async:!0};bot.addCommand(r);var i=Object.merge(r,{name:"stats"});bot.addCommand(i)}(),function(){var e={STOP:"HAMMERTIME!",STAHP:"HAMMAHTIME!",HALT:"HAMMERZEIT!",STOY:"ZABIVAT' VREMYA!",CAESUM:"MALLEUS TEMPUS!"},t=RegExp("("+Object.keys(e).map(RegExp.escape).join("|")+")[\\.!?]?$");IO.register("input",function(n){var o=n.content.toUpperCase(),r=t.exec(o);r&&bot.adapter.out.add(e[r[1]],n.room_id)})}(),function(){function e(e){var o=RegExp(e.matches[2],e.matches[4]),r=e.matches[3];if(!e.matches[2])return"Empty regex is empty";var i=t(o,e.get("message_id"));if(bot.log(i,"substitution found message"),!i)return"No matching message (are you sure we're in the right room?)";var a=n(i);return i.textContent.replace(o,r)+" "+e.link("(source)",a)}function t(e,t){function n(n){var o=Number(n.parentElement.id.match(/\d+/)[0]);return t>o&&e.test(n.textContent)}var o=Array.from(document.getElementsByClassName("content")).reverse();return o.first(n)}function n(e){for(var t=e;!t.classList.contains("action-link");)t=t.previousElementSibling;return t.href}var o=/^\s*s(\/|\|)((?:(?:\\\1)|[^\1])*?)\1((?:(?:\\\1)|[^\1])*?)\1(g?i?)/;bot.listen(o,e)}(),function(){"use strict";var e=function(e){var t=Number(e);return t?(bot.adapter.in.init(t),void 0):"That aint no room I ever heard of! `/help summon` for usage info"},t=function(e,t){function n(n){t&&t.call?t(n):e.reply(n)}var o=e.content?Number(e):e.get("room_id");return o?(bot.adapter.in.leaveRoom(o,function(e){"base_room"===e&&n("I can't leave my home.")}),void 0):"That aint no room I ever heard of! `/help unsummon` for usage info"};bot.addCommand(bot.CommunityCommand({name:"summon",fun:e,permissions:{del:"NONE",use:"OWNER"},description:"Say boopidi bee and in the room I shall appear. `/summon roomid`"})),bot.addCommand(bot.CommunityCommand({name:"unsummon",fun:t,permissions:{del:"NONE",use:"OWNER"},description:"Chant zippidi dee and from the room I shall take my leave. `/unsummon [roomid=your_roomid]`"}))}(),function(){function e(e){var t=e.parse(),n=t.shift(),r=t.shift();return o[n]?o[n](r):"Action {0} not recognized, see `/help timer`".supplant(n)}var t=Object.create(null),n=0,o={start:function(e){return void 0===e&&(e=n++),t[e]=Date.now(),"Registered timer "+e},stop:function(e){if(void 0===e)return"You must provide a timer name";var n=t[e];if(!n)return"I have no knowledge of timer "+e;var o=Date.now()-n;return delete t[e],o+"ms"}};bot.addCommand({name:"timer",fun:e,permissions:{del:"NONE"},description:"Starts/stops a timer. `/timer start [name]` starts a timer, `/timer stop name` stops a timer."})}(),function(){var e=bot.memory.get("todo"),t=function(t){var n=e[t],o=[];return n||(n=e[t]=[]),{get:function(e){return n.slice(e).map(function(e,t){return"("+t+")"+e}).join(", ")},add:function(e){return n.push(e),!0},remove:function(e){var t=n.indexOf(e);return-1===t?!1:this.removeByIndex(t)},removeByIndex:function(e){return e>=n.length?!1:(o.push(e),!0)},save:function(){bot.log(o.slice(),n.slice()),n=n.filter(function(e,t){return-1===o.indexOf(t)}),o.length=0,e[t]=n},exists:function(e){return e=e.toLowerCase(),n.some(function(t){return e===t.toLowerCase()})}}}.memoize(),n={get:function(e,t){var n=e.get(t[0]);return n||"No items on your todo"},add:function(e,t){function n(t){return e.exists(t)?(o=t+" already exists.",!1):(e.add(t),!0)}var o="";return t.every(n),o||"Item(s) added."},rm:function(e,t){function n(t){if(/^\d+$/.test(t))e.removeByIndex(Number(t));else{if(!e.exists(t))return o=t+" does not exist.",!1;e.remove(t)}return!0}var o="";return t.every(n),o||"Item(s) removed."}},o=function(e){var o=e.parse();bot.log(o,"todo input"),o[0]||(o=["get"]);var r,i=o[0],a=t(e.get("user_id")),s=o.slice(1);return n[i]?(r=n[i](a,s),bot.log(r,"/todo "+i)):(r="Unidentified /todo action "+i,bot.log(r,"/todo unknown")),a.save(),r};bot.addCommand({name:"todo",fun:o,permissions:{del:"NONE"},description:"Your personal todo list. `get [count]` retrieves everything or count items. `add items` adds items to your todo list (make sure items with spaces are wrapped in quotes) `rm items|indices` removes items specified by indice or content"})}(),function(){var e={ids:[],command:function(e,t){function n(n){t?t(n):e.reply(n)}return bot.log(e,"/undo input"),e.indexOf(" ")>-1?(this.removeMultiple(e.split(" "),n),void 0):("~"===e[0]?this.byLookback(e.slice(1),n):"*"===e[0]||"x"===e[0]?this.byPrevious(e.slice(1),n):/^:?\d+$/.test(e)?this.remove(e.replace(/^:/,""),n):e.content?n("I'm not sure how to handle that, see `/help undo`"):this.ids.length?this.remove(this.ids[this.ids.length-1],n):n("I haven't said a thing!"),void 0)},removeMultiple:function(e,t){e.forEach(function(e){this.remove(e,t)},this)},byLookback:function(e,t){var n=Number(e.replace("~",""));return bot.log(e,n,this.ids.length-n,"/undo byLookback"),!n||n>this.ids.length?(t("I can't quite see that far back without my glasses"),void 0):(this.remove(this.ids[this.ids.length-n],t),void 0)},byPrevious:function(e,t){var n=Number(e);return n?this.removeMultiple(this.ids.slice(-e),t):(t("Yeah, no"),void 0)},remove:function(t,n){function o(o,r){if(409===r.status)return bot.log(r,"/undo remove finish 409"),e.retry(t,n,o),void 0;var i;'"ok"'!==o&&(i=/it is too late/i.test(o)?"TimeError: Could not reach 88mph":/only delete your own/i.test(o)?"I can only delete my own messages":"I have no idea what happened: "+o,n(i))}console.log(t,"/undo remove");var r=this.ids.indexOf(t);r>-1&&this.ids.splice(r,1),IO.xhr({url:"/messages/"+t+"/delete",data:fkey(),method:"POST",complete:o})},retry:function(e,t,n){var o=/(\d+) seconds\s*$/i.exec(n),r=4;o&&o[1]&&(r=Number(o[1])),setTimeout(this.remove.bind(this,e,t),1e3*r)},update_id:function(e){this.ids.push(JSON.parse(e.responseText).id)}};IO.register("sendoutput",e.update_id,e),bot.addCommand({name:"undo",fun:e.command,thisArg:e,permissions:{del:"NONE",use:"OWNER"},description:"Undo (delete) specified or last message. `/undo [msgid0, msgid1, ...]` (omit for last message); `/undo xN` for last N; `/undo ~N` for the Nth message from the end"})}(),function(){function e(e,n){function o(n){var o;o="no_results"===n.result_type?"No definition found for "+s:c>n.list.length?"Nothing in that index. The last one is:\n"+i(n.list.pop()):i(n.list[c]),t[e]=o,r(o)}function r(t){n&&n.call?n(t):e.reply(t)}function i(t){var n=t.definition.replace(/\[([^\]]+)\]/g,a);return e.link(t.word,t.permalink)+" "+n}function a(t,n){var o="http://urbandictionary.com/define.php?term="+encodeURIComponent(n);return e.link(t,o)}if(t[e])return r(t[e]);var s,c,u=e.parse();return u.length?(isNaN(u[1])?(bot.log("/urban input isNaN"),s=""+e,c=0):(bot.log("/urban input isn't NaN"),s=u[0],c=Number(u[1])),bot.log(s,c,"/urban input"),IO.jsonp({url:"http://api.urbandictionary.com/v0/define",data:{term:s},jsonpName:"callback",fun:o}),void 0):"Y U NO PROVIDE ARGUMENTS!?"}var t={};bot.addCommand({name:"urban",fun:e,permissions:{del:"NONE",use:"ALL"},description:"Fetches UrbanDictionary definition. `/urban query [resultIndex=0]`",async:!0})}(),bot.addCommand({name:"user",fun:function(e){var t=e.parse(),n=t[0]||e.get("user_id"),o=n;return!/^\d+$/.test(n)&&(o=e.findUserid(n),0>o)?"Can't find user "+n+" in this chatroom.":(e.directreply("http://stackoverflow.com/users/"+o),void 0)},permissions:{del:"NONE",use:"ALL"},description:"Fetches user-link for specified user. `/user usr_id|usr_name`"}),IO.register("input",function(e){1386886===e.user_id&&.005>Math.random()&&bot.adapter.out.add(bot.adapter.reply(e.user_name)+" The Game")}),function(){var e,t,n,o=/^\s*(choose|should)?.*\sor\s[^$]/i,r=RegExp("\\b("+["am","are","can","could","did","do","does","is","may","might","shall","should","will","would"].map(RegExp.escape).join("|")+")\\b","i"),i={he:"He",i:"You",it:"It",she:"She",they:"They",we:"You",you:"I"};t=["SSdtIG5vdCBzdXJl","RVJST1IgQ0FMQ1VMQVRJTkcgUkVTVUxU","SSBrbm93IGp1c3Qgb25lIHRoaW5nLCBhbmQgdGhhdCBpcyB0aGF0IEknbSBhIGx1bWJlcmphY2s="].map(atob),n=["VGhhdCdzIG5vdCByZWFsbHkgYSBjaG9pY2UsIG5vdyBpcyBpdD8=","U291bmRzIGxpa2UgeW91IGhhdmUgYWxyZWFkeSBkZWNpZGVk","Q2hlYXRlciBjaGVhdGVyIHlvdXIgaG91c2UgaXMgYSBoZWF0ZXI="].map(atob),e=["QWJzb2x1dGVseSBub3Q=","QWJzb2x1dGVseSBub3Q=","QWJzb2x1dGVseSBub3Q=","QWxsIHNpZ25zIHBvaW50IHRvIG5v","QWxsIHNpZ25zIHBvaW50IHRvIG5v","QWxsIHNpZ25zIHBvaW50IHRvIG5v","QWxsIHNpZ25zIHBvaW50IHRvIHllcw==","QWxsIHNpZ25zIHBvaW50IHRvIHllcw==","QWxsIHNpZ25zIHBvaW50IHRvIHllcw==","QnV0IG9mIGNvdXJzZQ==","QnV0IG9mIGNvdXJzZQ==","QnV0IG9mIGNvdXJzZQ==","QnkgYWxsIG1lYW5z","QnkgYWxsIG1lYW5z","QnkgYWxsIG1lYW5z","Q2VydGFpbmx5IG5vdA==","Q2VydGFpbmx5IG5vdA==","Q2VydGFpbmx5IG5vdA==","Q2VydGFpbmx5","Q2VydGFpbmx5","Q2VydGFpbmx5","RGVmaW5pdGVseQ==","RGVmaW5pdGVseQ==","RGVmaW5pdGVseQ==","RG91YnRmdWxseQ==","RG91YnRmdWxseQ==","RG91YnRmdWxseQ==","RnJhbmtseSBteSBkZWFyLCBJIGRvbid0IGdpdmUgYSBkZWFu","RnJhbmtseSBteSBkZWFyLCBJIGRvbid0IGdpdmUgYSBkZWFu","SSBjYW4gbmVpdGhlciBjb25maXJtIG5vciBkZW55","SSBleHBlY3Qgc28=","SSBleHBlY3Qgc28=","SSBleHBlY3Qgc28=","SSdtIG5vdCBzbyBzdXJlIGFueW1vcmUuIEl0IGNhbiBnbyBlaXRoZXIgd2F5","SW1wb3NzaWJsZQ==","SW1wb3NzaWJsZQ==","SW1wb3NzaWJsZQ==","SW5kZWVk","SW5kZWVk","SW5kZWVk","SW5kdWJpdGFibHk=","SW5kdWJpdGFibHk=","SW5kdWJpdGFibHk=","Tm8gd2F5","Tm8gd2F5","Tm8gd2F5","Tm8=","Tm8=","Tm8=","Tm8=","Tm9wZQ==","Tm9wZQ==","Tm9wZQ==","Tm90IGEgY2hhbmNl","Tm90IGEgY2hhbmNl","Tm90IGEgY2hhbmNl","Tm90IGF0IGFsbA==","Tm90IGF0IGFsbA==","Tm90IGF0IGFsbA==","TnVoLXVo","TnVoLXVo","TnVoLXVo","T2YgY291cnNlIG5vdA==","T2YgY291cnNlIG5vdA==","T2YgY291cnNlIG5vdA==","T2YgY291cnNlIQ==","T2YgY291cnNlIQ==","T2YgY291cnNlIQ==","UHJvYmFibHk=","UHJvYmFibHk=","UHJvYmFibHk=","WWVzIQ==","WWVzIQ==","WWVzIQ==","WWVzIQ==","WWVzLCBhYnNvbHV0ZWx5","WWVzLCBhYnNvbHV0ZWx5","WWVzLCBhYnNvbHV0ZWx5"].map(atob),bot.listen(o,function(e){function o(){var t;do t=s.random();while(t===l);e.reply("Wait, I changed my mind! "+r(t))}function r(e){return e.replace(/(should(?:n'?t)?) (\S+)/,a)}function a(e,t,n){var o,r=n.toLowerCase();return o=i.hasOwnProperty(r)?i[r]:n,o+" "+t}for(var s=e.replace(/^\s*choose\s/i,"").replace(/\?$/,"").split(/\s*\bor\b\s*/i).filter(Boolean),c=s.length,u=1,m=!0;c>u;u++)if(s[u]!==s[u-1]){m=!1;break}if(m)return n.random();if(.01>Math.random())return 2===c?"Both!":"All of them!";if(.01>Math.random())return 2===c?"Neither":"None of them!";if(.01>Math.random())return t.random();var l=s.random();return.01>Math.random()&&(bot.log("weasel decision mind change jedi nun-chuck"),setTimeout(o,1e4)),r(l)}),bot.listen(r,function(){return e.random()})}(),function(){"use strict";function e(e){var t=o.exec(e);if(t)n.latlon(t[1],t[2],e.reply.bind(e));else{if(!e.content)return"See `/help weather` for usage info";n.city(e.content,e.reply.bind(e))}}var t=Object.TruthMap(["US","United States of America","United States","BZ","Belize","BS","Bahamas","KY","Cayam Islands"]),n={latlon:function(e,t,n){var o=Number(e),r=Number(t),i=[];return(-180>o||o>180)&&i.push("Latitude must be between -180 and 180"),(-180>r||r>180)&&i.push("Longitude must be between -180 and 180"),i.length?(n(i.join("; ")),void 0):(IO.jsonp({url:"http://api.openweathermap.org/data/2.5/weather",jsonpName:"callback",data:{lat:e,lon:t,cnt:1,type:"json"},fun:this.finishCb(n),error:this.errorCb(n)}),void 0)},city:function(e,t){IO.jsonp({url:"http://api.openweathermap.org/data/2.5/weather",jsonpName:"callback",data:{q:e,type:"json"},fun:this.finishCb(t),error:this.errorCb(t)})},finishCb:function(e){var t=this;return function(n){e(t.format(n))}},errorCb:function(e){return e},format:function(e){var t=e.main;return t?this.formatter(e):(console.error(e),"Sorry, I couldn't get the data: "+e.message)},formatter:function(e){var n,o=e.main;o.celsius=(o.temp-273.15).maxDecimal(4),n=bot.adapter.link(e.name,"http://openweathermap.org/city/"+e.id)+": ",t[e.sys.country]?(o.fahrenheit=(9*o.temp/5-459.67).maxDecimal(4),n+="{fahrenheit}F ({celsius}C, {temp}K)".supplant(o)):n+="{celsius}C ({temp}K)".supplant(o);var r=(e.weather||[]).map(function(e){return e.description}).join(", ");return r&&(n+=", "+r),n}},o=/\((-?\d+\.?\d*),\s*(-?\d+\.?\d*)\)/;bot.addCommand({name:"weather",fun:e,permissions:{del:"NONE"},async:!0,description:"Gets current weather: `/weather (lan, lon)` or `/weather city`"})}(),function(){"use strict";function e(e){return bot.adapter.reply(e)+" "+t}var t="Welcome to the JavaScript chat! Please review the "+bot.adapter.link("room pseudo-rules","http://rlemon.github.com/so-chat-javascript-rules/")+". "+"Please don't ask if you can ask or if anyone's around; just ask "+"your question, and if anyone's free and interested they'll help.";bot.addCommand({name:"welcome",fun:function(n){return n.length?n.send(e(n)):t},permission:{del:"NONE"},description:"Welcomes a user. `/welcome user`"})}(),function(){"use strict";function e(e,t){function n(n){var o,r=n[1][0],i="http://en.wikipedia.org/wiki/",a=!0;r?(r=encodeURIComponent(r.replace(/ /g,"_")),o=i+r):(a=!1,o=["No result found","The Wikipedia contains no knowledge of such a thing","The Gods of Wikipedia did not bless us"].random()),t&&t.call?t(o):a?e.directreply(o):e.reply(o)}IO.jsonp({url:"http://en.wikipedia.org/w/api.php",jsonpName:"callback",data:{action:"opensearch",search:""+e,limit:1,format:"json"},fun:n})}bot.addCommand({name:"wiki",fun:e,permissions:{del:"NONE"},description:"Search Wikipedia. `/wiki term`",async:!0})}(),function(){function e(e,t){function n(e){var t=e.num;i?"new"===i&&r(a+t):r(a+Math.rand(1,t))}function o(e){if(200!==e.responseStatus)return r("Something went on fire; status "+e.responseStatus),void 0;var t=e.responseData.results;if(!t.length)return r("Seems like you hallucinated this comic"),void 0;var n=t[0],o=n.url,i=/xkcd.com\/(\d+)/.exec(o);i||(o="Search didn't yield a comic; got "+n.unescapedUrl),r(o)}function r(n){bot.log(n,"/xkcd finish"),t&&t.call?t(n):e.directreply(n)}var i=(e.parse()[0]||"").toLowerCase(),a="http://xkcd.com/";return/^\d+$/.test(i)?(bot.log("/xkcd specific",i),r(a+i),void 0):i&&"new"!==i?(bot.log("/xkcd search",""+e),IO.jsonp.google(""+e+" site:xkcd.com -forums.xkcd -m.xkcd -fora.xkcd",o),void 0):(bot.log("/xkcd random/latest",i),IO.jsonp({url:"http://dynamic.xkcd.com/api-0/jsonp/comic",jsonpName:"callback",fun:n}),void 0)}bot.addCommand({name:"xkcd",fun:e,permissions:{del:"NONE"},description:"Returns an XKCD. Call with no args for random, `new` for latest, or a number for a specific one.",async:!0})}(),function(){function e(e){function n(n){var o=n.feed.entry;o&&o.length?e.send(o[0].link[0].href):e.reply(t.random())}IO.jsonp({url:"https://gdata.youtube.com/feeds/api/videos",jsonpName:"callback",data:{q:""+e,"max-results":1,v:2,alt:"json"},fun:n})}var t=["Video not found (rule 35?)","I could not find such a video","The Lords of YouTube did not find your query favorable"];bot.addCommand({name:"youtube",fun:e,permissions:{del:"NONE"},description:"Search Youtube. `/youtube query`",async:!0})}(),function(){var e=function(e){var t,n,o,r=function(e){return Math.floor(Math.random()*e)},i=e.split(""),a=[0,1,2].random(),s=["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈́","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],c=["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],u=["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͏","͜","͝","͞","͟","͠","͢","̸","̷","͡","҉"],m="",l=0,d="A̪̗̐̿̄̔̉̏̾L̹͓̲̈́ͮL̜̼͓͉̞̘̩̇̊",p=i.length;1==a&&(t=r(16)/2+1,n=r(16)/2+1,o=r(6)/2);var g;g="T̷̂͒̃̽H̸͒̿̒̚̕͜E͋ͥ̋̈̉̏̏̔̔͞ ̏ͥ̊͠P̷̑̌̀O̵̔̑̇̐͌̓̀̚Ǹ͌̍̾̈҉Y͛̈́̉҉͘";for(var l=0;p>l;l++){m+=i[l],d++,a||(t=r(8),n=r(8),o=r(6)),1==a&&(t=r(16)/2+1,n=r(16)/2+1,o=r(6)/2),2==a&&(t=r(64)/4+3,n=r(64)/4+3,o=r(16)/4+1);for(var h=0;t>h;h++)m+=s.random();for(var h=0;o>h;h++)m+=u.random();for(var h=0;n>h;h++)m+=c.random()}return m||/<([a-z]+) *[^\/]*?>/};bot.addCommand({name:"zalgo",fun:e,permissions:{del:"NONE"},description:"H̸̡̪̯ͨ͊̽̅̾̎Ȩ̬̩̾͛ͪ̈́̀́͘ ̶̧̨̱̹̭̯ͧ̾ͬC̷̙̲̝͖ͭ̏ͥͮ͟Oͮ͏̮̪̝͍M̲̖͊̒ͪͩͬ̚̚͜Ȇ̴̟̟͙̞ͩ͌͝S̨̥̫͎̭ͯ̿̔̀ͅ http://stackoverflow.com/a/1732454/1216976"})}();