Guest User

Untitled

a guest
Nov 16th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 186.54 KB | None | 0 0
  1. ! function(t, e, n, o, r) {
  2. function s(t, e, n, o) {
  3. var r = e[0] % W,
  4. s = e[1] % H,
  5. i = e[2] % F,
  6. a = function(t, e, n, r) {
  7. var s = r * o,
  8. i = r * o,
  9. a = -e % n * s,
  10. c = -Math.floor(e / n) * i,
  11. u = s * n,
  12. h = i * n;
  13. t.css("background-size", u + "px " + h + "px"), t.css("background-position", a + "px " + c + "px")
  14. };
  15. a(t.find(".color"), r, 10, 48), a(t.find(".eyes"), s, 10, 48), a(t.find(".mouth"), i, 10, 48), e[3] >= 0 ? (t.find(".special").show(), a(t.find(".special"), e[3], 10, 80)) : t.find(".special").hide(), n ? t.find(".owner").show() : t.find(".owner").hide()
  16. }
  17.  
  18. function i(t, e, n) {
  19. return t < e ? e : t > n ? n : t
  20. }
  21.  
  22. function a(t) {
  23. var e = t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
  24. return {
  25. r: parseInt(e[1]),
  26. g: parseInt(e[2]),
  27. b: parseInt(e[3])
  28. }
  29. }
  30.  
  31. function c() {
  32. o.setItem("avatar", JSON.stringify(loginAvatarData))
  33. }
  34.  
  35. function u(t, e) {
  36. t < 0 || t >= 3 || (e < 0 && (e = z[t] - 1), e >= z[t] && (e = 0), loginAvatarData[t] = e, s(n("#loginAvatar"), loginAvatarData, !1, 2), c())
  37. }
  38.  
  39. function h() {
  40. n("#modalIdle").modal()
  41. }
  42.  
  43. function l() {
  44. if (st)
  45. if (rt && rt.drawingID == rt.myID) {
  46. if (ct.drawCommands.length > 0) {
  47. if (ct.drawCommands.length > 8) {
  48. var t = ct.drawCommands.splice(7);
  49. st.emit("drawCommands", ct.drawCommands), ct.drawCommands = t
  50. } else st.emit("drawCommands", ct.drawCommands), ct.drawCommands = []
  51. }
  52. } else ct.drawCommands.length > 0 && (ct.drawCommands = [])
  53. }
  54.  
  55. function p() {
  56. setTimeout(function() {
  57. n("#rateDrawing").show()
  58. }, 5e3)
  59. }
  60.  
  61. function f() {
  62. n("#rateDrawing").hide()
  63. }
  64.  
  65. function d() {
  66. n("#votekickCurrentplayer").prop("disabled", !1)
  67. }
  68.  
  69. function y() {
  70. n("#votekickCurrentplayer").prop("disabled", !0)
  71. }
  72.  
  73. function m() {
  74. st && st.emit("votekickCurrent"), y()
  75. }
  76.  
  77. function g() {
  78. at.goto("load");
  79. var t = null === o.getItem("firstLogin");
  80. t && o.setItem("firstLogin", "");
  81. var e = !1;
  82. if (!t) {
  83. var n = o.getItem("lastAd"),
  84. s = new Date;
  85. if (null === n || n === r || "undefined" === n) e = !0;
  86. else {
  87. var i = new Date(Date.parse(n));
  88. Math.abs(i - s) / 1e3 / 60 >= 5 && (e = !0)
  89. }
  90. e && o.setItem("lastAd", s.toString())
  91. }
  92. e && aiptag && adplayer && adplayer !== r && null !== adplayer && "undefined" !== adplayer ? aiptag.cmd.player.push(function() {
  93. adplayer.startPreRoll()
  94. }) : w()
  95. }
  96.  
  97. function v() {
  98. "undefined" != typeof aipPlayer && (aiptag = aiptag || {}, aiptag.consented = !0, aiptag.cmd = aiptag.cmd || [], aiptag.cmd.display = aiptag.cmd.display || [], aiptag.cmd.player = aiptag.cmd.player || [], aiptag.cmd.player.push(function() {
  99. adplayer = new aipPlayer({
  100. AD_WIDTH: 960,
  101. AD_HEIGHT: 540,
  102. AD_FULLSCREEN: !0,
  103. AD_CENTERPLAYER: !1,
  104. LOADING_TEXT: "loading advertisement",
  105. PREROLL_ELEM: function() {
  106. return e.getElementById("preroll")
  107. },
  108. AIP_COMPLETE: function(t) {
  109. w()
  110. },
  111. AIP_REMOVE: function() {}
  112. })
  113. }))
  114. }
  115.  
  116. function b(t) {
  117. return t
  118. }
  119.  
  120. function w() {
  121. it.context && it.context.resume();
  122. var t = k(),
  123. e = io();
  124. e.emit("login", t), e.on("result", function(o) {
  125. o.code ? (n("#error-login").hide(), x(o.host, t)) : (n("#error-login").text(o.msg).show(), at.goto("login")), e.close()
  126. })
  127. }
  128.  
  129. function k() {
  130. var e = n("#inputName")[0].value.split("#", 2);
  131. 0 == e.length && (e = ["", ""]), 1 == e.length && e.push("");
  132. var o = "",
  133. r = t.location.href.split("?");
  134. r.length > 1 && (o = r[1]);
  135. var s = n("#loginLanguage").val();
  136. return {
  137. name: e[0],
  138. code: e[1],
  139. avatar: loginAvatarData,
  140. join: o,
  141. language: s,
  142. createPrivate: lt
  143. }
  144. }
  145.  
  146. function x(t, e) {
  147. it.playSound("playerJoin"), st = io(t), st.on("connect", function() {
  148. st.on("disconnect", function() {
  149. st.close(), st = null, rt = null, at.goto("login"), n("#modalDisconnect").modal()
  150. }), st.emit("userData", e), st.on("kicked", function() {
  151. n("#modalKicked").modal()
  152. }), st.on("drawCommands", function(t) {
  153. for (var e = 0; e < t.length; e++) B(t[e])
  154. }), st.on("canvasClear", function() {
  155. ct.clear()
  156. }), st.on("lobbyKicked", function(t) {
  157. var e = rt.players.get(t);
  158. null != e && (rt.chatAddMsg(null, e.name + " was kicked!", j), e.kicked = !0)
  159. }), st.on("chat", function(t) {
  160. var e = rt.players.get(t.id),
  161. n = rt.players.get(rt.myID),
  162. o = e.id == rt.drawingID || e.guessedWord;
  163. n.id != rt.drawingID && !n.guessedWord && o || rt.chatAddMsg(e, b(t.message), o ? "#7dad3f" : "#000")
  164. }), st.on("lobbySpam", function() {
  165. rt.chatAddMsg(null, "Spam detected! You're sending too many messages.", j)
  166. }), st.on("restartNotification", function(t) {
  167. rt && rt.chatAddMsg(null, "Server will restart in about " + t + " seconds...", N)
  168. }), st.on("lobbyVotekickCurrent", function(t) {
  169. if (rt) {
  170. var e = rt.players.get(t[0]),
  171. n = rt.players.get(t[1]);
  172. rt.chatAddMsg(null, "'" + e.name + "' is voting to kick '" + n.name + "' (" + t[2] + "/" + t[3] + ")", N)
  173. }
  174. }), st.on("lobbyConnected", function(t) {
  175. if (ct.clear(), E(""), rt = new Q(t), rt.inGame) {
  176. for (var e = 0; e < t.drawCommands.length; e++) B(t.drawCommands[e]);
  177. at.goto("game"), rt.drawingID >= 0 && A(rt.time)
  178. } else at.goto("lobby")
  179. }), st.on("lobbyLobby", function() {
  180. at.goto("lobby")
  181. }), st.on("lobbyState", function(t) {
  182. switch (parseInt(t[0])) {
  183. case Y:
  184. d(), A(rt.time);
  185. break;
  186. case X:
  187. E("Game will start soon...")
  188. }
  189. }), st.on("lobbyDisconnected", function() {
  190. st.emit("lobbyLeave"), rt = null, at.goto("login")
  191. }), st.on("lobbyGameStart", function(t) {
  192. rt.reset(), E(""), at.goto("game")
  193. }), st.on("lobbyGameEnd", function() {
  194. var t = [];
  195. rt.players.forEach(function(e, n, o) {
  196. t.push(e)
  197. }), I({
  198. mode: "endgame",
  199. text: "Result",
  200. players: t
  201. })
  202. }), st.on("lobbyLanguage", function(t) {
  203. rt.setLanguage(t)
  204. }), st.on("lobbyRounds", function(t) {
  205. rt.setRounds(t)
  206. }), st.on("lobbyDrawTime", function(t) {
  207. rt.setDrawTime(t)
  208. }), st.on("lobbyCustomWordsExclusive", function(t) {
  209. rt.setCustomWordsExclusive(t)
  210. }), st.on("lobbyPlayerConnected", function(t) {
  211. rt.addPlayer(t), rt.chatAddMsg(null, t.name + " joined.", O), it.playSound("playerJoin")
  212. }), st.on("lobbyPlayerDisconnected", function(t) {
  213. var e = rt.players.get(t);
  214. rt.removePlayer(e), e.kicked || rt.chatAddMsg(null, e.name + " left.", j), it.playSound("playerLeave")
  215. }), st.on("lobbyPlayerGuessedWord", function(t) {
  216. var e = rt.players.get(t);
  217. rt.setPlayerGuessed(e), rt.chatAddMsg(null, e.name + " guessed the word!", U), t == rt.myID && rt.chatDisable(), it.playSound("playerGuessed")
  218. }), st.on("lobbyGuessClose", function(t) {
  219. rt.chatAddMsg(null, "'" + t + "' is close!", N)
  220. }), st.on("lobbyPlayerDrawing", function(t) {
  221. var e = rt.players.get(t);
  222. rt.setPlayerDrawing(e.id), rt.chatAddMsg(null, e.name + " is drawing now!", _);
  223. var n = rt.drawingID == rt.myID;
  224. ct.setDrawing(n), n ? (f(), y()) : (p(), d()), it.playSound("roundStart"), A(rt.timeMax), R()
  225. }), st.on("lobbyOwnerChanged", function(t) {
  226. var e = rt.players.get(t);
  227. rt.setPlayerOwner(e), rt.chatAddMsg(null, e.name + " is the owner now!", U)
  228. }), st.on("lobbyRound", function(t) {
  229. rt.round = t, rt.updateRound(), I({
  230. mode: "text",
  231. text: "Round " + (rt.round + 1)
  232. })
  233. }), st.on("lobbyChooseWord", function(t) {
  234. if (t.id == rt.myID) I({
  235. mode: "choosewords",
  236. text: "Choose a word",
  237. words: t.words
  238. });
  239. else {
  240. I({
  241. mode: "text",
  242. text: rt.players.get(t.id).name + " is choosing a word!"
  243. })
  244. }
  245. }), st.on("lobbyReveal", function(t) {
  246. C(), rt.chatEnable(), rt.chatAddMsg(null, "The word was '" + t.word + "'", U);
  247. for (var e = [], n = !0, o = 0; o < t.scores.length / 2; o++) {
  248. var r = t.scores[2 * o],
  249. s = t.scores[2 * o + 1],
  250. i = rt.players.get(r);
  251. if (i) {
  252. i.guessedWord && (n = !1);
  253. var a = s - i.score;
  254. rt.setPlayerScore(i, s, a), e.push(i)
  255. }
  256. }
  257. rt.updateRanks(), I({
  258. mode: "reveal",
  259. text: "The word was: " + t.word,
  260. revealReason: J[t.reason],
  261. players: e,
  262. onshow: function() {
  263. n ? it.playSound("roundEndFailure") : it.playSound("roundEndSuccess")
  264. }
  265. }), rt.setPlayerDrawing(-1), ct.setDrawing(!1), rt.playersResetGuessedWord()
  266. }), st.on("lobbyPlayerRateDrawing", function(t) {
  267. var e = rt.players.get(t[0]),
  268. n = rt.players.get(t[1]),
  269. o = t[2];
  270. e && rt.playerRate(e, o), n && (o > 0 ? n.thumbsUp++ : n.thumbsDown++)
  271. }), st.on("lobbyCurrentWord", function(t) {
  272. rt.players.get(rt.myID).guessedWord || E(t)
  273. }), st.on("lobbyTime", function(t) {
  274. D(t)
  275. })
  276. })
  277. }
  278.  
  279. function C() {
  280. null != ft && (clearInterval(ft), ft = null)
  281. }
  282.  
  283. function A(t) {
  284. D(t), C(), ft = setInterval(function() {
  285. dt > 0 && D(dt - 1)
  286. }, 1e3)
  287. }
  288.  
  289. function D(t) {
  290. dt = t, dt <= 8 && it.playSound("tick"), n("#timer").text(dt)
  291. }
  292.  
  293. function S() {
  294. at.goto("load"), st.emit("lobbyLeave")
  295. }
  296.  
  297. function P(t) {
  298. return t.charAt(0).toUpperCase() + t.slice(1)
  299. }
  300.  
  301. function E(t) {
  302. n("#currentWord").text(t)
  303. }
  304.  
  305. function M(t, e, n) {
  306. if (rt.checkDrawing() && (ct.updateMousePosition(t, e, n), ct.brush.down)) {
  307. var o = null;
  308. switch (ct.brush.tool) {
  309. case "pen":
  310. o = ct.createDrawCommandLine(ct.brush.colorIndex, ct.brush.thickness, ct.mouseposPrev.x, ct.mouseposPrev.y, ct.mousepos.x, ct.mousepos.y);
  311. break;
  312. case "erase":
  313. o = ct.createDrawCommandErase(ct.brush.thickness, ct.mouseposPrev.x, ct.mouseposPrev.y, ct.mousepos.x, ct.mousepos.y);
  314. break;
  315. case "fill":
  316. ct.brush.toolUsed || (o = ct.createDrawCommandFill(ct.brush.colorIndex, ct.mouseposPrev.x, ct.mouseposPrev.y, ct.mousepos.x, ct.mousepos.y))
  317. }
  318. null != o && (ct.brush.toolUsed = !0, B(o))
  319. }
  320. }
  321.  
  322. function T(t) {
  323. var e = t.clone();
  324. return e.removeAttr("id"), e.show(), e
  325. }
  326.  
  327. function B(t) {
  328. rt.drawingID == rt.myID ? (ct.drawCommands.push(t), ct.performDrawCommand(t)) : ct.addDrawCommandReceived(t)
  329. }
  330.  
  331. function I(t) {
  332. if (ht) return ut.unshift(t), void R();
  333. ht = !0;
  334. var e = n("#overlay");
  335. e.show(), e.animate({
  336. opacity: "1"
  337. }, G), L(t)
  338. }
  339.  
  340. function L(t) {
  341. var e = n("#overlay"),
  342. o = e.find(".content");
  343. o.find(".text").text(t.text);
  344. var r = o.find(".wordContainer");
  345. if ("choosewords" == t.mode) {
  346. r.empty(), r.show();
  347. for (var i = 0; i < t.words.length; i++) {
  348. var a = n("<div class='word'></div>");
  349. a.data("id", i), a.text(t.words[i]), r.append(a), a.on("click", function() {
  350. var t = n(this).data("id");
  351. st && st.emit("lobbyChooseWord", t), R()
  352. })
  353. }
  354. } else r.hide();
  355. var c = e.find(".revealReason"),
  356. u = o.find(".revealContainer");
  357. if ("reveal" == t.mode) {
  358. c.text(t.revealReason), c.show(), u.empty(), u.show(), t.players.sort(function(t, e) {
  359. return e.scoreGuessed - t.scoreGuessed
  360. });
  361. for (var i = 0; i < t.players.length; i++) {
  362. var h = t.players[i],
  363. l = n("<div class='player'></div>"),
  364. p = n("<div class='name'></div>");
  365. p.text(h.name);
  366. var f = n("<div class='score'></div>");
  367. h.scoreGuessed > 0 ? (f.text("+" + h.scoreGuessed), f.css("color", "#07EA30")) : (f.text(h.scoreGuessed), f.css("color", "#E81300")), l.append(p), l.append(f), u.append(l)
  368. }
  369. } else c.hide(), u.hide();
  370. var d = o.find(".gameEndContainer");
  371. if ("endgame" == t.mode) {
  372. d.show(), t.players.sort(function(t, e) {
  373. return t.rank - e.rank
  374. });
  375. var y = n(".gameEndContainerPlayersBest"),
  376. m = n(".gameEndContainerPlayers");
  377. y.empty(), m.empty();
  378. for (var i = 0; i < t.players.length; i++) {
  379. var h = t.players[i],
  380. l = T(n("#gameEndPlayerDummy"));
  381. l.find(".name").text(h.name);
  382. var g = l.find(".rank");
  383. g.text("#" + h.rank), h.rank <= 3 && g.addClass("rank-" + h.rank), h.rank <= 3 ? y.append(l) : m.append(l), s(l, h.avatar, h.id == rt.ownerID, h.rank <= 3 ? 2 : 1)
  384. }
  385. } else d.hide();
  386. o.show(), o.animate({
  387. bottom: "0%"
  388. }, G, "easeInOutBack", function() {
  389. t.onshow && t.onshow()
  390. })
  391. }
  392.  
  393. function R() {
  394. if (ht) {
  395. var t = n("#overlay"),
  396. e = t.find(".content"),
  397. o = ut.pop();
  398. o ? e.animate({
  399. bottom: "100%"
  400. }, q, "easeInOutBack", function() {
  401. L(o)
  402. }) : (ht = !1, t.animate({
  403. opacity: "0"
  404. }, q, function() {
  405. t.hide()
  406. }), e.animate({
  407. bottom: "100%"
  408. }, q, "easeInOutBack", function() {
  409. e.hide()
  410. }))
  411. }
  412. }! function(t, e) {
  413. "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.io = e() : t.io = e()
  414. }(this, function() {
  415. return function(t) {
  416. function e(o) {
  417. if (n[o]) return n[o].exports;
  418. var r = n[o] = {
  419. exports: {},
  420. id: o,
  421. loaded: !1
  422. };
  423. return t[o].call(r.exports, r, r.exports, e), r.loaded = !0, r.exports
  424. }
  425. var n = {};
  426. return e.m = t, e.c = n, e.p = "", e(0)
  427. }([function(t, e, n) {
  428. "use strict";
  429.  
  430. function o(t, e) {
  431. "object" === (void 0 === t ? "undefined" : s(t)) && (e = t, t = void 0), e = e || {};
  432. var n, o = i(t),
  433. a = o.source,
  434. l = o.id,
  435. p = o.path,
  436. f = h[l] && p in h[l].nsps;
  437. return e.forceNew || e["force new connection"] || !1 === e.multiplex || f ? (u("ignoring socket cache for %s", a), n = c(a, e)) : (h[l] || (u("new io instance for %s", a), h[l] = c(a, e)), n = h[l]), o.query && !e.query ? e.query = o.query : e && "object" === s(e.query) && (e.query = r(e.query)), n.socket(o.path, e)
  438. }
  439.  
  440. function r(t) {
  441. var e = [];
  442. for (var n in t) t.hasOwnProperty(n) && e.push(encodeURIComponent(n) + "=" + encodeURIComponent(t[n]));
  443. return e.join("&")
  444. }
  445. var s = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
  446. return typeof t
  447. } : function(t) {
  448. return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
  449. },
  450. i = n(1),
  451. a = n(7),
  452. c = n(17),
  453. u = n(3)("socket.io-client");
  454. t.exports = e = o;
  455. var h = e.managers = {};
  456. e.protocol = a.protocol, e.connect = o, e.Manager = n(17), e.Socket = n(44)
  457. }, function(t, e, n) {
  458. (function(e) {
  459. "use strict";
  460.  
  461. function o(t, n) {
  462. var o = t;
  463. n = n || e.location, null == t && (t = n.protocol + "//" + n.host), "string" == typeof t && ("/" === t.charAt(0) && (t = "/" === t.charAt(1) ? n.protocol + t : n.host + t), /^(https?|wss?):\/\//.test(t) || (s("protocol-less url %s", t), t = void 0 !== n ? n.protocol + "//" + t : "https://" + t), s("parse %s", t), o = r(t)), o.port || (/^(http|ws)$/.test(o.protocol) ? o.port = "80" : /^(http|ws)s$/.test(o.protocol) && (o.port = "443")), o.path = o.path || "/";
  464. var i = -1 !== o.host.indexOf(":"),
  465. a = i ? "[" + o.host + "]" : o.host;
  466. return o.id = o.protocol + "://" + a + ":" + o.port, o.href = o.protocol + "://" + a + (n && n.port === o.port ? "" : ":" + o.port), o
  467. }
  468. var r = n(2),
  469. s = n(3)("socket.io-client:url");
  470. t.exports = o
  471. }).call(e, function() {
  472. return this
  473. }())
  474. }, function(t, e) {
  475. var n = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
  476. o = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
  477. t.exports = function(t) {
  478. var e = t,
  479. r = t.indexOf("["),
  480. s = t.indexOf("]"); - 1 != r && -1 != s && (t = t.substring(0, r) + t.substring(r, s).replace(/:/g, ";") + t.substring(s, t.length));
  481. for (var i = n.exec(t || ""), a = {}, c = 14; c--;) a[o[c]] = i[c] || "";
  482. return -1 != r && -1 != s && (a.source = e, a.host = a.host.substring(1, a.host.length - 1).replace(/;/g, ":"), a.authority = a.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), a.ipv6uri = !0), a
  483. }
  484. }, function(n, o, r) {
  485. (function(s) {
  486. function i() {
  487. return void 0 !== e && "WebkitAppearance" in e.documentElement.style || t.console && (console.firebug || console.exception && console.table) || navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31
  488. }
  489.  
  490. function a() {
  491. var t = arguments,
  492. e = this.useColors;
  493. if (t[0] = (e ? "%c" : "") + this.namespace + (e ? " %c" : " ") + t[0] + (e ? "%c " : " ") + "+" + o.humanize(this.diff), !e) return t;
  494. var n = "color: " + this.color;
  495. t = [t[0], n, "color: inherit"].concat(Array.prototype.slice.call(t, 1));
  496. var r = 0,
  497. s = 0;
  498. return t[0].replace(/%[a-z%]/g, function(t) {
  499. "%%" !== t && (r++, "%c" === t && (s = r))
  500. }), t.splice(s, 0, n), t
  501. }
  502.  
  503. function c() {
  504. return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments)
  505. }
  506.  
  507. function u(t) {
  508. try {
  509. null == t ? o.storage.removeItem("debug") : o.storage.debug = t
  510. } catch (t) {}
  511. }
  512.  
  513. function h() {
  514. try {
  515. return o.storage.debug
  516. } catch (t) {}
  517. if (void 0 !== s && "env" in s) return s.env.DEBUG
  518. }
  519. o = n.exports = r(5), o.log = c, o.formatArgs = a, o.save = u, o.load = h, o.useColors = i, o.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() {
  520. try {
  521. return t.localStorage
  522. } catch (t) {}
  523. }(), o.colors = ["lightseagreen", "forestgreen", "goldenrod", "dodgerblue", "darkorchid", "crimson"], o.formatters.j = function(t) {
  524. try {
  525. return JSON.stringify(t)
  526. } catch (t) {
  527. return "[UnexpectedJSONParseError]: " + t.message
  528. }
  529. }, o.enable(h())
  530. }).call(o, r(4))
  531. }, function(t, e) {
  532. function n() {
  533. throw new Error("setTimeout has not been defined")
  534. }
  535.  
  536. function o() {
  537. throw new Error("clearTimeout has not been defined")
  538. }
  539.  
  540. function r(t) {
  541. if (h === setTimeout) return setTimeout(t, 0);
  542. if ((h === n || !h) && setTimeout) return h = setTimeout, setTimeout(t, 0);
  543. try {
  544. return h(t, 0)
  545. } catch (e) {
  546. try {
  547. return h.call(null, t, 0)
  548. } catch (e) {
  549. return h.call(this, t, 0)
  550. }
  551. }
  552. }
  553.  
  554. function s(t) {
  555. if (l === clearTimeout) return clearTimeout(t);
  556. if ((l === o || !l) && clearTimeout) return l = clearTimeout, clearTimeout(t);
  557. try {
  558. return l(t)
  559. } catch (e) {
  560. try {
  561. return l.call(null, t)
  562. } catch (e) {
  563. return l.call(this, t)
  564. }
  565. }
  566. }
  567.  
  568. function i() {
  569. y && f && (y = !1, f.length ? d = f.concat(d) : m = -1, d.length && a())
  570. }
  571.  
  572. function a() {
  573. if (!y) {
  574. var t = r(i);
  575. y = !0;
  576. for (var e = d.length; e;) {
  577. for (f = d, d = []; ++m < e;) f && f[m].run();
  578. m = -1, e = d.length
  579. }
  580. f = null, y = !1, s(t)
  581. }
  582. }
  583.  
  584. function c(t, e) {
  585. this.fun = t, this.array = e
  586. }
  587.  
  588. function u() {}
  589. var h, l, p = t.exports = {};
  590. ! function() {
  591. try {
  592. h = "function" == typeof setTimeout ? setTimeout : n
  593. } catch (t) {
  594. h = n
  595. }
  596. try {
  597. l = "function" == typeof clearTimeout ? clearTimeout : o
  598. } catch (t) {
  599. l = o
  600. }
  601. }();
  602. var f, d = [],
  603. y = !1,
  604. m = -1;
  605. p.nextTick = function(t) {
  606. var e = new Array(arguments.length - 1);
  607. if (arguments.length > 1)
  608. for (var n = 1; n < arguments.length; n++) e[n - 1] = arguments[n];
  609. d.push(new c(t, e)), 1 !== d.length || y || r(a)
  610. }, c.prototype.run = function() {
  611. this.fun.apply(null, this.array)
  612. }, p.title = "browser", p.browser = !0, p.env = {}, p.argv = [], p.version = "", p.versions = {}, p.on = u, p.addListener = u, p.once = u, p.off = u, p.removeListener = u, p.removeAllListeners = u, p.emit = u, p.binding = function(t) {
  613. throw new Error("process.binding is not supported")
  614. }, p.cwd = function() {
  615. return "/"
  616. }, p.chdir = function(t) {
  617. throw new Error("process.chdir is not supported")
  618. }, p.umask = function() {
  619. return 0
  620. }
  621. }, function(t, e, n) {
  622. function o() {
  623. return e.colors[h++ % e.colors.length]
  624. }
  625.  
  626. function r(t) {
  627. function n() {}
  628.  
  629. function r() {
  630. var t = r,
  631. n = +new Date,
  632. s = n - (u || n);
  633. t.diff = s, t.prev = u, t.curr = n, u = n, null == t.useColors && (t.useColors = e.useColors()), null == t.color && t.useColors && (t.color = o());
  634. for (var i = new Array(arguments.length), a = 0; a < i.length; a++) i[a] = arguments[a];
  635. i[0] = e.coerce(i[0]), "string" != typeof i[0] && (i = ["%o"].concat(i));
  636. var c = 0;
  637. i[0] = i[0].replace(/%([a-z%])/g, function(n, o) {
  638. if ("%%" === n) return n;
  639. c++;
  640. var r = e.formatters[o];
  641. if ("function" == typeof r) {
  642. var s = i[c];
  643. n = r.call(t, s), i.splice(c, 1), c--
  644. }
  645. return n
  646. }), i = e.formatArgs.apply(t, i), (r.log || e.log || console.log.bind(console)).apply(t, i)
  647. }
  648. n.enabled = !1, r.enabled = !0;
  649. var s = e.enabled(t) ? r : n;
  650. return s.namespace = t, s
  651. }
  652.  
  653. function s(t) {
  654. e.save(t);
  655. for (var n = (t || "").split(/[\s,]+/), o = n.length, r = 0; r < o; r++) n[r] && (t = n[r].replace(/[\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*?"), "-" === t[0] ? e.skips.push(new RegExp("^" + t.substr(1) + "$")) : e.names.push(new RegExp("^" + t + "$")))
  656. }
  657.  
  658. function i() {
  659. e.enable("")
  660. }
  661.  
  662. function a(t) {
  663. var n, o;
  664. for (n = 0, o = e.skips.length; n < o; n++)
  665. if (e.skips[n].test(t)) return !1;
  666. for (n = 0, o = e.names.length; n < o; n++)
  667. if (e.names[n].test(t)) return !0;
  668. return !1
  669. }
  670.  
  671. function c(t) {
  672. return t instanceof Error ? t.stack || t.message : t
  673. }
  674. e = t.exports = r.debug = r, e.coerce = c, e.disable = i, e.enable = s, e.enabled = a, e.humanize = n(6), e.names = [], e.skips = [], e.formatters = {};
  675. var u, h = 0
  676. }, function(t, e) {
  677. function n(t) {
  678. if (t = String(t), !(t.length > 1e4)) {
  679. var e = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);
  680. if (e) {
  681. var n = parseFloat(e[1]);
  682. switch ((e[2] || "ms").toLowerCase()) {
  683. case "years":
  684. case "year":
  685. case "yrs":
  686. case "yr":
  687. case "y":
  688. return n * h;
  689. case "days":
  690. case "day":
  691. case "d":
  692. return n * u;
  693. case "hours":
  694. case "hour":
  695. case "hrs":
  696. case "hr":
  697. case "h":
  698. return n * c;
  699. case "minutes":
  700. case "minute":
  701. case "mins":
  702. case "min":
  703. case "m":
  704. return n * a;
  705. case "seconds":
  706. case "second":
  707. case "secs":
  708. case "sec":
  709. case "s":
  710. return n * i;
  711. case "milliseconds":
  712. case "millisecond":
  713. case "msecs":
  714. case "msec":
  715. case "ms":
  716. return n;
  717. default:
  718. return
  719. }
  720. }
  721. }
  722. }
  723.  
  724. function o(t) {
  725. return t >= u ? Math.round(t / u) + "d" : t >= c ? Math.round(t / c) + "h" : t >= a ? Math.round(t / a) + "m" : t >= i ? Math.round(t / i) + "s" : t + "ms"
  726. }
  727.  
  728. function r(t) {
  729. return s(t, u, "day") || s(t, c, "hour") || s(t, a, "minute") || s(t, i, "second") || t + " ms"
  730. }
  731.  
  732. function s(t, e, n) {
  733. if (!(t < e)) return t < 1.5 * e ? Math.floor(t / e) + " " + n : Math.ceil(t / e) + " " + n + "s"
  734. }
  735. var i = 1e3,
  736. a = 60 * i,
  737. c = 60 * a,
  738. u = 24 * c,
  739. h = 365.25 * u;
  740. t.exports = function(t, e) {
  741. e = e || {};
  742. var s = typeof t;
  743. if ("string" === s && t.length > 0) return n(t);
  744. if ("number" === s && !1 === isNaN(t)) return e.long ? r(t) : o(t);
  745. throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(t))
  746. }
  747. }, function(t, e, n) {
  748. function o() {}
  749.  
  750. function r(t) {
  751. var n = "",
  752. o = !1;
  753. return n += t.type, e.BINARY_EVENT != t.type && e.BINARY_ACK != t.type || (n += t.attachments, n += "-"), t.nsp && "/" != t.nsp && (o = !0, n += t.nsp), null != t.id && (o && (n += ",", o = !1), n += t.id), null != t.data && (o && (n += ","), n += p.stringify(t.data)), l("encoded %j as %s", t, n), n
  754. }
  755.  
  756. function s(t, e) {
  757. function n(t) {
  758. var n = d.deconstructPacket(t),
  759. o = r(n.packet),
  760. s = n.buffers;
  761. s.unshift(o), e(s)
  762. }
  763. d.removeBlobs(t, n)
  764. }
  765.  
  766. function i() {
  767. this.reconstructor = null
  768. }
  769.  
  770. function a(t) {
  771. var n = {},
  772. o = 0;
  773. if (n.type = Number(t.charAt(0)), null == e.types[n.type]) return h();
  774. if (e.BINARY_EVENT == n.type || e.BINARY_ACK == n.type) {
  775. for (var r = "";
  776. "-" != t.charAt(++o) && (r += t.charAt(o), o != t.length););
  777. if (r != Number(r) || "-" != t.charAt(o)) throw new Error("Illegal attachments");
  778. n.attachments = Number(r)
  779. }
  780. if ("/" == t.charAt(o + 1))
  781. for (n.nsp = ""; ++o;) {
  782. var s = t.charAt(o);
  783. if ("," == s) break;
  784. if (n.nsp += s, o == t.length) break
  785. } else n.nsp = "/";
  786. var i = t.charAt(o + 1);
  787. if ("" !== i && Number(i) == i) {
  788. for (n.id = ""; ++o;) {
  789. var s = t.charAt(o);
  790. if (null == s || Number(s) != s) {
  791. --o;
  792. break
  793. }
  794. if (n.id += t.charAt(o), o == t.length) break
  795. }
  796. n.id = Number(n.id)
  797. }
  798. return t.charAt(++o) && (n = c(n, t.substr(o))), l("decoded %s as %j", t, n), n
  799. }
  800.  
  801. function c(t, e) {
  802. try {
  803. t.data = p.parse(e)
  804. } catch (t) {
  805. return h()
  806. }
  807. return t
  808. }
  809.  
  810. function u(t) {
  811. this.reconPack = t, this.buffers = []
  812. }
  813.  
  814. function h(t) {
  815. return {
  816. type: e.ERROR,
  817. data: "parser error"
  818. }
  819. }
  820. var l = n(8)("socket.io-parser"),
  821. p = n(11),
  822. f = n(13),
  823. d = n(14),
  824. y = n(16);
  825. e.protocol = 4, e.types = ["CONNECT", "DISCONNECT", "EVENT", "ACK", "ERROR", "BINARY_EVENT", "BINARY_ACK"], e.CONNECT = 0, e.DISCONNECT = 1, e.EVENT = 2, e.ACK = 3, e.ERROR = 4, e.BINARY_EVENT = 5, e.BINARY_ACK = 6, e.Encoder = o, e.Decoder = i, o.prototype.encode = function(t, n) {
  826. if (l("encoding packet %j", t), e.BINARY_EVENT == t.type || e.BINARY_ACK == t.type) s(t, n);
  827. else {
  828. n([r(t)])
  829. }
  830. }, f(i.prototype), i.prototype.add = function(t) {
  831. var n;
  832. if ("string" == typeof t) n = a(t), e.BINARY_EVENT == n.type || e.BINARY_ACK == n.type ? (this.reconstructor = new u(n), 0 === this.reconstructor.reconPack.attachments && this.emit("decoded", n)) : this.emit("decoded", n);
  833. else {
  834. if (!y(t) && !t.base64) throw new Error("Unknown type: " + t);
  835. if (!this.reconstructor) throw new Error("got binary data when not reconstructing a packet");
  836. (n = this.reconstructor.takeBinaryData(t)) && (this.reconstructor = null, this.emit("decoded", n))
  837. }
  838. }, i.prototype.destroy = function() {
  839. this.reconstructor && this.reconstructor.finishedReconstruction()
  840. }, u.prototype.takeBinaryData = function(t) {
  841. if (this.buffers.push(t), this.buffers.length == this.reconPack.attachments) {
  842. var e = d.reconstructPacket(this.reconPack, this.buffers);
  843. return this.finishedReconstruction(), e
  844. }
  845. return null
  846. }, u.prototype.finishedReconstruction = function() {
  847. this.reconPack = null, this.buffers = []
  848. }
  849. }, function(n, o, r) {
  850. function s() {
  851. return "WebkitAppearance" in e.documentElement.style || t.console && (console.firebug || console.exception && console.table) || navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31
  852. }
  853.  
  854. function i() {
  855. var t = arguments,
  856. e = this.useColors;
  857. if (t[0] = (e ? "%c" : "") + this.namespace + (e ? " %c" : " ") + t[0] + (e ? "%c " : " ") + "+" + o.humanize(this.diff), !e) return t;
  858. var n = "color: " + this.color;
  859. t = [t[0], n, "color: inherit"].concat(Array.prototype.slice.call(t, 1));
  860. var r = 0,
  861. s = 0;
  862. return t[0].replace(/%[a-z%]/g, function(t) {
  863. "%%" !== t && (r++, "%c" === t && (s = r))
  864. }), t.splice(s, 0, n), t
  865. }
  866.  
  867. function a() {
  868. return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments)
  869. }
  870.  
  871. function c(t) {
  872. try {
  873. null == t ? o.storage.removeItem("debug") : o.storage.debug = t
  874. } catch (t) {}
  875. }
  876.  
  877. function u() {
  878. var t;
  879. try {
  880. t = o.storage.debug
  881. } catch (t) {}
  882. return t
  883. }
  884. o = n.exports = r(9), o.log = a, o.formatArgs = i, o.save = c, o.load = u, o.useColors = s, o.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : function() {
  885. try {
  886. return t.localStorage
  887. } catch (t) {}
  888. }(), o.colors = ["lightseagreen", "forestgreen", "goldenrod", "dodgerblue", "darkorchid", "crimson"], o.formatters.j = function(t) {
  889. return JSON.stringify(t)
  890. }, o.enable(u())
  891. }, function(t, e, n) {
  892. function o() {
  893. return e.colors[h++ % e.colors.length]
  894. }
  895.  
  896. function r(t) {
  897. function n() {}
  898.  
  899. function r() {
  900. var t = r,
  901. n = +new Date,
  902. s = n - (u || n);
  903. t.diff = s, t.prev = u, t.curr = n, u = n, null == t.useColors && (t.useColors = e.useColors()), null == t.color && t.useColors && (t.color = o());
  904. var i = Array.prototype.slice.call(arguments);
  905. i[0] = e.coerce(i[0]), "string" != typeof i[0] && (i = ["%o"].concat(i));
  906. var a = 0;
  907. i[0] = i[0].replace(/%([a-z%])/g, function(n, o) {
  908. if ("%%" === n) return n;
  909. a++;
  910. var r = e.formatters[o];
  911. if ("function" == typeof r) {
  912. var s = i[a];
  913. n = r.call(t, s), i.splice(a, 1), a--
  914. }
  915. return n
  916. }), "function" == typeof e.formatArgs && (i = e.formatArgs.apply(t, i)), (r.log || e.log || console.log.bind(console)).apply(t, i)
  917. }
  918. n.enabled = !1, r.enabled = !0;
  919. var s = e.enabled(t) ? r : n;
  920. return s.namespace = t, s
  921. }
  922.  
  923. function s(t) {
  924. e.save(t);
  925. for (var n = (t || "").split(/[\s,]+/), o = n.length, r = 0; r < o; r++) n[r] && (t = n[r].replace(/\*/g, ".*?"), "-" === t[0] ? e.skips.push(new RegExp("^" + t.substr(1) + "$")) : e.names.push(new RegExp("^" + t + "$")))
  926. }
  927.  
  928. function i() {
  929. e.enable("")
  930. }
  931.  
  932. function a(t) {
  933. var n, o;
  934. for (n = 0, o = e.skips.length; n < o; n++)
  935. if (e.skips[n].test(t)) return !1;
  936. for (n = 0, o = e.names.length; n < o; n++)
  937. if (e.names[n].test(t)) return !0;
  938. return !1
  939. }
  940.  
  941. function c(t) {
  942. return t instanceof Error ? t.stack || t.message : t
  943. }
  944. e = t.exports = r, e.coerce = c, e.disable = i, e.enable = s, e.enabled = a, e.humanize = n(10), e.names = [], e.skips = [], e.formatters = {};
  945. var u, h = 0
  946. }, function(t, e) {
  947. function n(t) {
  948. if (t = "" + t, !(t.length > 1e4)) {
  949. var e = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);
  950. if (e) {
  951. var n = parseFloat(e[1]);
  952. switch ((e[2] || "ms").toLowerCase()) {
  953. case "years":
  954. case "year":
  955. case "yrs":
  956. case "yr":
  957. case "y":
  958. return n * h;
  959. case "days":
  960. case "day":
  961. case "d":
  962. return n * u;
  963. case "hours":
  964. case "hour":
  965. case "hrs":
  966. case "hr":
  967. case "h":
  968. return n * c;
  969. case "minutes":
  970. case "minute":
  971. case "mins":
  972. case "min":
  973. case "m":
  974. return n * a;
  975. case "seconds":
  976. case "second":
  977. case "secs":
  978. case "sec":
  979. case "s":
  980. return n * i;
  981. case "milliseconds":
  982. case "millisecond":
  983. case "msecs":
  984. case "msec":
  985. case "ms":
  986. return n
  987. }
  988. }
  989. }
  990. }
  991.  
  992. function o(t) {
  993. return t >= u ? Math.round(t / u) + "d" : t >= c ? Math.round(t / c) + "h" : t >= a ? Math.round(t / a) + "m" : t >= i ? Math.round(t / i) + "s" : t + "ms"
  994. }
  995.  
  996. function r(t) {
  997. return s(t, u, "day") || s(t, c, "hour") || s(t, a, "minute") || s(t, i, "second") || t + " ms"
  998. }
  999.  
  1000. function s(t, e, n) {
  1001. if (!(t < e)) return t < 1.5 * e ? Math.floor(t / e) + " " + n : Math.ceil(t / e) + " " + n + "s"
  1002. }
  1003. var i = 1e3,
  1004. a = 60 * i,
  1005. c = 60 * a,
  1006. u = 24 * c,
  1007. h = 365.25 * u;
  1008. t.exports = function(t, e) {
  1009. return e = e || {}, "string" == typeof t ? n(t) : e.long ? r(t) : o(t)
  1010. }
  1011. }, function(e, n, o) {
  1012. (function(e, o) {
  1013. var r = !1;
  1014. (function() {
  1015. function s(t, e) {
  1016. function n(t) {
  1017. if (n[t] !== m) return n[t];
  1018. var s;
  1019. if ("bug-string-char-index" == t) s = "a" != "a" [0];
  1020. else if ("json" == t) s = n("json-stringify") && n("json-parse");
  1021. else {
  1022. var i, a = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';
  1023. if ("json-stringify" == t) {
  1024. var u = e.stringify,
  1025. h = "function" == typeof u && b;
  1026. if (h) {
  1027. (i = function() {
  1028. return 1
  1029. }).toJSON = i;
  1030. try {
  1031. h = "0" === u(0) && "0" === u(new o) && '""' == u(new r) && u(v) === m && u(m) === m && u() === m && "1" === u(i) && "[1]" == u([i]) && "[null]" == u([m]) && "null" == u(null) && "[null,null,null]" == u([m, v, null]) && u({
  1032. a: [i, !0, !1, null, "\0\b\n\f\r\t"]
  1033. }) == a && "1" === u(null, i) && "[\n 1,\n 2\n]" == u([1, 2], null, 1) && '"-271821-04-20T00:00:00.000Z"' == u(new c(-864e13)) && '"+275760-09-13T00:00:00.000Z"' == u(new c(864e13)) && '"-000001-01-01T00:00:00.000Z"' == u(new c(-621987552e5)) && '"1969-12-31T23:59:59.999Z"' == u(new c(-1))
  1034. } catch (t) {
  1035. h = !1
  1036. }
  1037. }
  1038. s = h
  1039. }
  1040. if ("json-parse" == t) {
  1041. var l = e.parse;
  1042. if ("function" == typeof l) try {
  1043. if (0 === l("0") && !l(!1)) {
  1044. i = l(a);
  1045. var p = 5 == i.a.length && 1 === i.a[0];
  1046. if (p) {
  1047. try {
  1048. p = !l('"\t"')
  1049. } catch (t) {}
  1050. if (p) try {
  1051. p = 1 !== l("01")
  1052. } catch (t) {}
  1053. if (p) try {
  1054. p = 1 !== l("1.")
  1055. } catch (t) {}
  1056. }
  1057. }
  1058. } catch (t) {
  1059. p = !1
  1060. }
  1061. s = p
  1062. }
  1063. }
  1064. return n[t] = !!s
  1065. }
  1066. t || (t = u.Object()), e || (e = u.Object());
  1067. var o = t.Number || u.Number,
  1068. r = t.String || u.String,
  1069. i = t.Object || u.Object,
  1070. c = t.Date || u.Date,
  1071. h = t.SyntaxError || u.SyntaxError,
  1072. l = t.TypeError || u.TypeError,
  1073. p = t.Math || u.Math,
  1074. f = t.JSON || u.JSON;
  1075. "object" == typeof f && f && (e.stringify = f.stringify, e.parse = f.parse);
  1076. var d, y, m, g = i.prototype,
  1077. v = g.toString,
  1078. b = new c(-0xc782b5b800cec);
  1079. try {
  1080. b = -109252 == b.getUTCFullYear() && 0 === b.getUTCMonth() && 1 === b.getUTCDate() && 10 == b.getUTCHours() && 37 == b.getUTCMinutes() && 6 == b.getUTCSeconds() && 708 == b.getUTCMilliseconds()
  1081. } catch (t) {}
  1082. if (!n("json")) {
  1083. var w = "[object Function]",
  1084. k = "[object Number]",
  1085. x = "[object String]",
  1086. C = "[object Array]",
  1087. A = n("bug-string-char-index");
  1088. if (!b) var D = p.floor,
  1089. S = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
  1090. P = function(t, e) {
  1091. return S[e] + 365 * (t - 1970) + D((t - 1969 + (e = +(e > 1))) / 4) - D((t - 1901 + e) / 100) + D((t - 1601 + e) / 400)
  1092. };
  1093. if ((d = g.hasOwnProperty) || (d = function(t) {
  1094. var e, n = {};
  1095. return (n.__proto__ = null, n.__proto__ = {
  1096. toString: 1
  1097. }, n).toString != v ? d = function(t) {
  1098. var e = this.__proto__,
  1099. n = t in (this.__proto__ = null, this);
  1100. return this.__proto__ = e, n
  1101. } : (e = n.constructor, d = function(t) {
  1102. var n = (this.constructor || e).prototype;
  1103. return t in this && !(t in n && this[t] === n[t])
  1104. }), n = null, d.call(this, t)
  1105. }), y = function(t, e) {
  1106. var n, o, r, s = 0;
  1107. (n = function() {
  1108. this.valueOf = 0
  1109. }).prototype.valueOf = 0, o = new n;
  1110. for (r in o) d.call(o, r) && s++;
  1111. return n = o = null, s ? y = 2 == s ? function(t, e) {
  1112. var n, o = {},
  1113. r = v.call(t) == w;
  1114. for (n in t) r && "prototype" == n || d.call(o, n) || !(o[n] = 1) || !d.call(t, n) || e(n)
  1115. } : function(t, e) {
  1116. var n, o, r = v.call(t) == w;
  1117. for (n in t) r && "prototype" == n || !d.call(t, n) || (o = "constructor" === n) || e(n);
  1118. (o || d.call(t, n = "constructor")) && e(n)
  1119. } : (o = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"], y = function(t, e) {
  1120. var n, r, s = v.call(t) == w,
  1121. i = !s && "function" != typeof t.constructor && a[typeof t.hasOwnProperty] && t.hasOwnProperty || d;
  1122. for (n in t) s && "prototype" == n || !i.call(t, n) || e(n);
  1123. for (r = o.length; n = o[--r]; i.call(t, n) && e(n));
  1124. }), y(t, e)
  1125. }, !n("json-stringify")) {
  1126. var E = {
  1127. 92: "\\\\",
  1128. 34: '\\"',
  1129. 8: "\\b",
  1130. 12: "\\f",
  1131. 10: "\\n",
  1132. 13: "\\r",
  1133. 9: "\\t"
  1134. },
  1135. M = function(t, e) {
  1136. return ("000000" + (e || 0)).slice(-t)
  1137. },
  1138. T = function(t) {
  1139. for (var e = '"', n = 0, o = t.length, r = !A || o > 10, s = r && (A ? t.split("") : t); n < o; n++) {
  1140. var i = t.charCodeAt(n);
  1141. switch (i) {
  1142. case 8:
  1143. case 9:
  1144. case 10:
  1145. case 12:
  1146. case 13:
  1147. case 34:
  1148. case 92:
  1149. e += E[i];
  1150. break;
  1151. default:
  1152. if (i < 32) {
  1153. e += "\\u00" + M(2, i.toString(16));
  1154. break
  1155. }
  1156. e += r ? s[n] : t.charAt(n)
  1157. }
  1158. }
  1159. return e + '"'
  1160. },
  1161. B = function(t, e, n, o, r, s, i) {
  1162. var a, c, u, h, p, f, g, b, w, A, S, E, I, L, R, U;
  1163. try {
  1164. a = e[t]
  1165. } catch (t) {}
  1166. if ("object" == typeof a && a)
  1167. if ("[object Date]" != (c = v.call(a)) || d.call(a, "toJSON")) "function" == typeof a.toJSON && (c != k && c != x && c != C || d.call(a, "toJSON")) && (a = a.toJSON(t));
  1168. else if (a > -1 / 0 && a < 1 / 0) {
  1169. if (P) {
  1170. for (p = D(a / 864e5), u = D(p / 365.2425) + 1970 - 1; P(u + 1, 0) <= p; u++);
  1171. for (h = D((p - P(u, 0)) / 30.42); P(u, h + 1) <= p; h++);
  1172. p = 1 + p - P(u, h), f = (a % 864e5 + 864e5) % 864e5, g = D(f / 36e5) % 24, b = D(f / 6e4) % 60, w = D(f / 1e3) % 60, A = f % 1e3
  1173. } else u = a.getUTCFullYear(), h = a.getUTCMonth(), p = a.getUTCDate(), g = a.getUTCHours(), b = a.getUTCMinutes(), w = a.getUTCSeconds(), A = a.getUTCMilliseconds();
  1174. a = (u <= 0 || u >= 1e4 ? (u < 0 ? "-" : "+") + M(6, u < 0 ? -u : u) : M(4, u)) + "-" + M(2, h + 1) + "-" + M(2, p) + "T" + M(2, g) + ":" + M(2, b) + ":" + M(2, w) + "." + M(3, A) + "Z"
  1175. } else a = null;
  1176. if (n && (a = n.call(e, t, a)), null === a) return "null";
  1177. if ("[object Boolean]" == (c = v.call(a))) return "" + a;
  1178. if (c == k) return a > -1 / 0 && a < 1 / 0 ? "" + a : "null";
  1179. if (c == x) return T("" + a);
  1180. if ("object" == typeof a) {
  1181. for (L = i.length; L--;)
  1182. if (i[L] === a) throw l();
  1183. if (i.push(a), S = [], R = s, s += r, c == C) {
  1184. for (I = 0, L = a.length; I < L; I++) E = B(I, a, n, o, r, s, i), S.push(E === m ? "null" : E);
  1185. U = S.length ? r ? "[\n" + s + S.join(",\n" + s) + "\n" + R + "]" : "[" + S.join(",") + "]" : "[]"
  1186. } else y(o || a, function(t) {
  1187. var e = B(t, a, n, o, r, s, i);
  1188. e !== m && S.push(T(t) + ":" + (r ? " " : "") + e)
  1189. }), U = S.length ? r ? "{\n" + s + S.join(",\n" + s) + "\n" + R + "}" : "{" + S.join(",") + "}" : "{}";
  1190. return i.pop(), U
  1191. }
  1192. };
  1193. e.stringify = function(t, e, n) {
  1194. var o, r, s, i;
  1195. if (a[typeof e] && e)
  1196. if ((i = v.call(e)) == w) r = e;
  1197. else if (i == C) {
  1198. s = {};
  1199. for (var c, u = 0, h = e.length; u < h; c = e[u++], ((i = v.call(c)) == x || i == k) && (s[c] = 1));
  1200. }
  1201. if (n)
  1202. if ((i = v.call(n)) == k) {
  1203. if ((n -= n % 1) > 0)
  1204. for (o = "", n > 10 && (n = 10); o.length < n; o += " ");
  1205. } else i == x && (o = n.length <= 10 ? n : n.slice(0, 10));
  1206. return B("", (c = {}, c[""] = t, c), r, s, o, "", [])
  1207. }
  1208. }
  1209. if (!n("json-parse")) {
  1210. var I, L, R = r.fromCharCode,
  1211. U = {
  1212. 92: "\\",
  1213. 34: '"',
  1214. 47: "/",
  1215. 98: "\b",
  1216. 116: "\t",
  1217. 110: "\n",
  1218. 102: "\f",
  1219. 114: "\r"
  1220. },
  1221. N = function() {
  1222. throw I = L = null, h()
  1223. },
  1224. _ = function() {
  1225. for (var t, e, n, o, r, s = L, i = s.length; I < i;) switch (r = s.charCodeAt(I)) {
  1226. case 9:
  1227. case 10:
  1228. case 13:
  1229. case 32:
  1230. I++;
  1231. break;
  1232. case 123:
  1233. case 125:
  1234. case 91:
  1235. case 93:
  1236. case 58:
  1237. case 44:
  1238. return t = A ? s.charAt(I) : s[I], I++, t;
  1239. case 34:
  1240. for (t = "@", I++; I < i;)
  1241. if ((r = s.charCodeAt(I)) < 32) N();
  1242. else if (92 == r) switch (r = s.charCodeAt(++I)) {
  1243. case 92:
  1244. case 34:
  1245. case 47:
  1246. case 98:
  1247. case 116:
  1248. case 110:
  1249. case 102:
  1250. case 114:
  1251. t += U[r], I++;
  1252. break;
  1253. case 117:
  1254. for (e = ++I, n = I + 4; I < n; I++)(r = s.charCodeAt(I)) >= 48 && r <= 57 || r >= 97 && r <= 102 || r >= 65 && r <= 70 || N();
  1255. t += R("0x" + s.slice(e, I));
  1256. break;
  1257. default:
  1258. N()
  1259. } else {
  1260. if (34 == r) break;
  1261. for (r = s.charCodeAt(I), e = I; r >= 32 && 92 != r && 34 != r;) r = s.charCodeAt(++I);
  1262. t += s.slice(e, I)
  1263. }
  1264. if (34 == s.charCodeAt(I)) return I++, t;
  1265. N();
  1266. default:
  1267. if (e = I, 45 == r && (o = !0, r = s.charCodeAt(++I)), r >= 48 && r <= 57) {
  1268. for (48 == r && (r = s.charCodeAt(I + 1)) >= 48 && r <= 57 && N(), o = !1; I < i && (r = s.charCodeAt(I)) >= 48 && r <= 57; I++);
  1269. if (46 == s.charCodeAt(I)) {
  1270. for (n = ++I; n < i && (r = s.charCodeAt(n)) >= 48 && r <= 57; n++);
  1271. n == I && N(), I = n
  1272. }
  1273. if (101 == (r = s.charCodeAt(I)) || 69 == r) {
  1274. for (r = s.charCodeAt(++I), 43 != r && 45 != r || I++, n = I; n < i && (r = s.charCodeAt(n)) >= 48 && r <= 57; n++);
  1275. n == I && N(), I = n
  1276. }
  1277. return +s.slice(e, I)
  1278. }
  1279. if (o && N(), "true" == s.slice(I, I + 4)) return I += 4, !0;
  1280. if ("false" == s.slice(I, I + 5)) return I += 5, !1;
  1281. if ("null" == s.slice(I, I + 4)) return I += 4, null;
  1282. N()
  1283. }
  1284. return "$"
  1285. },
  1286. O = function(t) {
  1287. var e, n;
  1288. if ("$" == t && N(), "string" == typeof t) {
  1289. if ("@" == (A ? t.charAt(0) : t[0])) return t.slice(1);
  1290. if ("[" == t) {
  1291. for (e = [];
  1292. "]" != (t = _()); n || (n = !0)) n && ("," == t ? "]" == (t = _()) && N() : N()), "," == t && N(), e.push(O(t));
  1293. return e
  1294. }
  1295. if ("{" == t) {
  1296. for (e = {};
  1297. "}" != (t = _()); n || (n = !0)) n && ("," == t ? "}" == (t = _()) && N() : N()), "," != t && "string" == typeof t && "@" == (A ? t.charAt(0) : t[0]) && ":" == _() || N(), e[t.slice(1)] = O(_());
  1298. return e
  1299. }
  1300. N()
  1301. }
  1302. return t
  1303. },
  1304. j = function(t, e, n) {
  1305. var o = G(t, e, n);
  1306. o === m ? delete t[e] : t[e] = o
  1307. },
  1308. G = function(t, e, n) {
  1309. var o, r = t[e];
  1310. if ("object" == typeof r && r)
  1311. if (v.call(r) == C)
  1312. for (o = r.length; o--;) j(r, o, n);
  1313. else y(r, function(t) {
  1314. j(r, t, n)
  1315. });
  1316. return n.call(t, e, r)
  1317. };
  1318. e.parse = function(t, e) {
  1319. var n, o;
  1320. return I = 0, L = "" + t, n = O(_()), "$" != _() && N(), I = L = null, e && v.call(e) == w ? G((o = {}, o[""] = n, o), "", e) : n
  1321. }
  1322. }
  1323. }
  1324. return e.runInContext = s, e
  1325. }
  1326. var i = "function" == typeof r && r.amd,
  1327. a = {
  1328. function: !0,
  1329. object: !0
  1330. },
  1331. c = a[typeof n] && n && !n.nodeType && n,
  1332. u = a[typeof t] && t || this,
  1333. h = c && a[typeof e] && e && !e.nodeType && "object" == typeof o && o;
  1334. if (!h || h.global !== h && h.window !== h && h.self !== h || (u = h), c && !i) s(u, c);
  1335. else {
  1336. var l = u.JSON,
  1337. p = u.JSON3,
  1338. f = !1,
  1339. d = s(u, u.JSON3 = {
  1340. noConflict: function() {
  1341. return f || (f = !0, u.JSON = l, u.JSON3 = p, l = p = null), d
  1342. }
  1343. });
  1344. u.JSON = {
  1345. parse: d.parse,
  1346. stringify: d.stringify
  1347. }
  1348. }
  1349. i && r(function() {
  1350. return d
  1351. })
  1352. }).call(this)
  1353. }).call(n, o(12)(e), function() {
  1354. return this
  1355. }())
  1356. }, function(t, e) {
  1357. t.exports = function(t) {
  1358. return t.webpackPolyfill || (t.deprecate = function() {}, t.paths = [], t.children = [], t.webpackPolyfill = 1), t
  1359. }
  1360. }, function(t, e) {
  1361. function n(t) {
  1362. if (t) return o(t)
  1363. }
  1364.  
  1365. function o(t) {
  1366. for (var e in n.prototype) t[e] = n.prototype[e];
  1367. return t
  1368. }
  1369. t.exports = n, n.prototype.on = n.prototype.addEventListener = function(t, e) {
  1370. return this._callbacks = this._callbacks || {}, (this._callbacks[t] = this._callbacks[t] || []).push(e), this
  1371. }, n.prototype.once = function(t, e) {
  1372. function n() {
  1373. o.off(t, n), e.apply(this, arguments)
  1374. }
  1375. var o = this;
  1376. return this._callbacks = this._callbacks || {}, n.fn = e, this.on(t, n), this
  1377. }, n.prototype.off = n.prototype.removeListener = n.prototype.removeAllListeners = n.prototype.removeEventListener = function(t, e) {
  1378. if (this._callbacks = this._callbacks || {}, 0 == arguments.length) return this._callbacks = {}, this;
  1379. var n = this._callbacks[t];
  1380. if (!n) return this;
  1381. if (1 == arguments.length) return delete this._callbacks[t], this;
  1382. for (var o, r = 0; r < n.length; r++)
  1383. if ((o = n[r]) === e || o.fn === e) {
  1384. n.splice(r, 1);
  1385. break
  1386. }
  1387. return this
  1388. }, n.prototype.emit = function(t) {
  1389. this._callbacks = this._callbacks || {};
  1390. var e = [].slice.call(arguments, 1),
  1391. n = this._callbacks[t];
  1392. if (n) {
  1393. n = n.slice(0);
  1394. for (var o = 0, r = n.length; o < r; ++o) n[o].apply(this, e)
  1395. }
  1396. return this
  1397. }, n.prototype.listeners = function(t) {
  1398. return this._callbacks = this._callbacks || {}, this._callbacks[t] || []
  1399. }, n.prototype.hasListeners = function(t) {
  1400. return !!this.listeners(t).length
  1401. }
  1402. }, function(t, e, n) {
  1403. (function(t) {
  1404. var o = n(15),
  1405. r = n(16);
  1406. e.deconstructPacket = function(t) {
  1407. function e(t) {
  1408. if (!t) return t;
  1409. if (r(t)) {
  1410. var s = {
  1411. _placeholder: !0,
  1412. num: n.length
  1413. };
  1414. return n.push(t), s
  1415. }
  1416. if (o(t)) {
  1417. for (var i = new Array(t.length), a = 0; a < t.length; a++) i[a] = e(t[a]);
  1418. return i
  1419. }
  1420. if ("object" == typeof t && !(t instanceof Date)) {
  1421. var i = {};
  1422. for (var c in t) i[c] = e(t[c]);
  1423. return i
  1424. }
  1425. return t
  1426. }
  1427. var n = [],
  1428. s = t.data,
  1429. i = t;
  1430. return i.data = e(s), i.attachments = n.length, {
  1431. packet: i,
  1432. buffers: n
  1433. }
  1434. }, e.reconstructPacket = function(t, e) {
  1435. function n(t) {
  1436. if (t && t._placeholder) {
  1437. return e[t.num]
  1438. }
  1439. if (o(t)) {
  1440. for (var r = 0; r < t.length; r++) t[r] = n(t[r]);
  1441. return t
  1442. }
  1443. if (t && "object" == typeof t) {
  1444. for (var s in t) t[s] = n(t[s]);
  1445. return t
  1446. }
  1447. return t
  1448. }
  1449. return t.data = n(t.data), t.attachments = void 0, t
  1450. }, e.removeBlobs = function(e, n) {
  1451. function s(e, c, u) {
  1452. if (!e) return e;
  1453. if (t.Blob && e instanceof Blob || t.File && e instanceof File) {
  1454. i++;
  1455. var h = new FileReader;
  1456. h.onload = function() {
  1457. u ? u[c] = this.result : a = this.result, --i || n(a)
  1458. }, h.readAsArrayBuffer(e)
  1459. } else if (o(e))
  1460. for (var l = 0; l < e.length; l++) s(e[l], l, e);
  1461. else if (e && "object" == typeof e && !r(e))
  1462. for (var p in e) s(e[p], p, e)
  1463. }
  1464. var i = 0,
  1465. a = e;
  1466. s(a), i || n(a)
  1467. }
  1468. }).call(e, function() {
  1469. return this
  1470. }())
  1471. }, function(t, e) {
  1472. t.exports = Array.isArray || function(t) {
  1473. return "[object Array]" == Object.prototype.toString.call(t)
  1474. }
  1475. }, function(t, e) {
  1476. (function(e) {
  1477. function n(t) {
  1478. return e.Buffer && e.Buffer.isBuffer(t) || e.ArrayBuffer && t instanceof ArrayBuffer
  1479. }
  1480. t.exports = n
  1481. }).call(e, function() {
  1482. return this
  1483. }())
  1484. }, function(t, e, n) {
  1485. "use strict";
  1486.  
  1487. function o(t, e) {
  1488. return this instanceof o ? (t && "object" === (void 0 === t ? "undefined" : r(t)) && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.nsps = {}, this.subs = [], this.opts = e, this.reconnection(!1 !== e.reconnection), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor(e.randomizationFactor || .5), this.backoff = new f({
  1489. min: this.reconnectionDelay(),
  1490. max: this.reconnectionDelayMax(),
  1491. jitter: this.randomizationFactor()
  1492. }), this.timeout(null == e.timeout ? 2e4 : e.timeout), this.readyState = "closed", this.uri = t, this.connecting = [], this.lastPing = null, this.encoding = !1, this.packetBuffer = [], this.encoder = new c.Encoder, this.decoder = new c.Decoder, this.autoConnect = !1 !== e.autoConnect, void(this.autoConnect && this.open())) : new o(t, e)
  1493. }
  1494. var r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
  1495. return typeof t
  1496. } : function(t) {
  1497. return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
  1498. },
  1499. s = n(18),
  1500. i = n(44),
  1501. a = n(35),
  1502. c = n(7),
  1503. u = n(46),
  1504. h = n(47),
  1505. l = n(3)("socket.io-client:manager"),
  1506. p = n(42),
  1507. f = n(48),
  1508. d = Object.prototype.hasOwnProperty;
  1509. t.exports = o, o.prototype.emitAll = function() {
  1510. this.emit.apply(this, arguments);
  1511. for (var t in this.nsps) d.call(this.nsps, t) && this.nsps[t].emit.apply(this.nsps[t], arguments)
  1512. }, o.prototype.updateSocketIds = function() {
  1513. for (var t in this.nsps) d.call(this.nsps, t) && (this.nsps[t].id = this.engine.id)
  1514. }, a(o.prototype), o.prototype.reconnection = function(t) {
  1515. return arguments.length ? (this._reconnection = !!t, this) : this._reconnection
  1516. }, o.prototype.reconnectionAttempts = function(t) {
  1517. return arguments.length ? (this._reconnectionAttempts = t, this) : this._reconnectionAttempts
  1518. }, o.prototype.reconnectionDelay = function(t) {
  1519. return arguments.length ? (this._reconnectionDelay = t, this.backoff && this.backoff.setMin(t), this) : this._reconnectionDelay
  1520. }, o.prototype.randomizationFactor = function(t) {
  1521. return arguments.length ? (this._randomizationFactor = t, this.backoff && this.backoff.setJitter(t), this) : this._randomizationFactor
  1522. }, o.prototype.reconnectionDelayMax = function(t) {
  1523. return arguments.length ? (this._reconnectionDelayMax = t, this.backoff && this.backoff.setMax(t), this) : this._reconnectionDelayMax
  1524. }, o.prototype.timeout = function(t) {
  1525. return arguments.length ? (this._timeout = t, this) : this._timeout
  1526. }, o.prototype.maybeReconnectOnOpen = function() {
  1527. !this.reconnecting && this._reconnection && 0 === this.backoff.attempts && this.reconnect()
  1528. }, o.prototype.open = o.prototype.connect = function(t, e) {
  1529. if (l("readyState %s", this.readyState), ~this.readyState.indexOf("open")) return this;
  1530. l("opening %s", this.uri), this.engine = s(this.uri, this.opts);
  1531. var n = this.engine,
  1532. o = this;
  1533. this.readyState = "opening", this.skipReconnect = !1;
  1534. var r = u(n, "open", function() {
  1535. o.onopen(), t && t()
  1536. }),
  1537. i = u(n, "error", function(e) {
  1538. if (l("connect_error"), o.cleanup(), o.readyState = "closed", o.emitAll("connect_error", e), t) {
  1539. var n = new Error("Connection error");
  1540. n.data = e, t(n)
  1541. } else o.maybeReconnectOnOpen()
  1542. });
  1543. if (!1 !== this._timeout) {
  1544. var a = this._timeout;
  1545. l("connect attempt will timeout after %d", a);
  1546. var c = setTimeout(function() {
  1547. l("connect attempt timed out after %d", a), r.destroy(), n.close(), n.emit("error", "timeout"), o.emitAll("connect_timeout", a)
  1548. }, a);
  1549. this.subs.push({
  1550. destroy: function() {
  1551. clearTimeout(c)
  1552. }
  1553. })
  1554. }
  1555. return this.subs.push(r), this.subs.push(i), this
  1556. }, o.prototype.onopen = function() {
  1557. l("open"), this.cleanup(), this.readyState = "open", this.emit("open");
  1558. var t = this.engine;
  1559. this.subs.push(u(t, "data", h(this, "ondata"))), this.subs.push(u(t, "ping", h(this, "onping"))), this.subs.push(u(t, "pong", h(this, "onpong"))), this.subs.push(u(t, "error", h(this, "onerror"))), this.subs.push(u(t, "close", h(this, "onclose"))), this.subs.push(u(this.decoder, "decoded", h(this, "ondecoded")))
  1560. }, o.prototype.onping = function() {
  1561. this.lastPing = new Date, this.emitAll("ping")
  1562. }, o.prototype.onpong = function() {
  1563. this.emitAll("pong", new Date - this.lastPing)
  1564. }, o.prototype.ondata = function(t) {
  1565. this.decoder.add(t)
  1566. }, o.prototype.ondecoded = function(t) {
  1567. this.emit("packet", t)
  1568. }, o.prototype.onerror = function(t) {
  1569. l("error", t), this.emitAll("error", t)
  1570. }, o.prototype.socket = function(t, e) {
  1571. function n() {
  1572. ~p(r.connecting, o) || r.connecting.push(o)
  1573. }
  1574. var o = this.nsps[t];
  1575. if (!o) {
  1576. o = new i(this, t, e), this.nsps[t] = o;
  1577. var r = this;
  1578. o.on("connecting", n), o.on("connect", function() {
  1579. o.id = r.engine.id
  1580. }), this.autoConnect && n()
  1581. }
  1582. return o
  1583. }, o.prototype.destroy = function(t) {
  1584. var e = p(this.connecting, t);
  1585. ~e && this.connecting.splice(e, 1), this.connecting.length || this.close()
  1586. }, o.prototype.packet = function(t) {
  1587. l("writing packet %j", t);
  1588. var e = this;
  1589. t.query && 0 === t.type && (t.nsp += "?" + t.query), e.encoding ? e.packetBuffer.push(t) : (e.encoding = !0, this.encoder.encode(t, function(n) {
  1590. for (var o = 0; o < n.length; o++) e.engine.write(n[o], t.options);
  1591. e.encoding = !1, e.processPacketQueue()
  1592. }))
  1593. }, o.prototype.processPacketQueue = function() {
  1594. if (this.packetBuffer.length > 0 && !this.encoding) {
  1595. var t = this.packetBuffer.shift();
  1596. this.packet(t)
  1597. }
  1598. }, o.prototype.cleanup = function() {
  1599. l("cleanup");
  1600. for (var t = this.subs.length, e = 0; e < t; e++) {
  1601. this.subs.shift().destroy()
  1602. }
  1603. this.packetBuffer = [], this.encoding = !1, this.lastPing = null, this.decoder.destroy()
  1604. }, o.prototype.close = o.prototype.disconnect = function() {
  1605. l("disconnect"), this.skipReconnect = !0, this.reconnecting = !1, "opening" === this.readyState && this.cleanup(), this.backoff.reset(), this.readyState = "closed", this.engine && this.engine.close()
  1606. }, o.prototype.onclose = function(t) {
  1607. l("onclose"), this.cleanup(), this.backoff.reset(), this.readyState = "closed", this.emit("close", t), this._reconnection && !this.skipReconnect && this.reconnect()
  1608. }, o.prototype.reconnect = function() {
  1609. if (this.reconnecting || this.skipReconnect) return this;
  1610. var t = this;
  1611. if (this.backoff.attempts >= this._reconnectionAttempts) l("reconnect failed"), this.backoff.reset(), this.emitAll("reconnect_failed"), this.reconnecting = !1;
  1612. else {
  1613. var e = this.backoff.duration();
  1614. l("will wait %dms before reconnect attempt", e), this.reconnecting = !0;
  1615. var n = setTimeout(function() {
  1616. t.skipReconnect || (l("attempting reconnect"), t.emitAll("reconnect_attempt", t.backoff.attempts), t.emitAll("reconnecting", t.backoff.attempts), t.skipReconnect || t.open(function(e) {
  1617. e ? (l("reconnect attempt error"), t.reconnecting = !1, t.reconnect(), t.emitAll("reconnect_error", e.data)) : (l("reconnect success"), t.onreconnect())
  1618. }))
  1619. }, e);
  1620. this.subs.push({
  1621. destroy: function() {
  1622. clearTimeout(n)
  1623. }
  1624. })
  1625. }
  1626. }, o.prototype.onreconnect = function() {
  1627. var t = this.backoff.attempts;
  1628. this.reconnecting = !1, this.backoff.reset(), this.updateSocketIds(), this.emitAll("reconnect", t)
  1629. }
  1630. }, function(t, e, n) {
  1631. t.exports = n(19)
  1632. }, function(t, e, n) {
  1633. t.exports = n(20), t.exports.parser = n(27)
  1634. }, function(t, e, n) {
  1635. (function(e) {
  1636. function o(t, n) {
  1637. if (!(this instanceof o)) return new o(t, n);
  1638. n = n || {}, t && "object" == typeof t && (n = t, t = null), t ? (t = h(t), n.hostname = t.host, n.secure = "https" === t.protocol || "wss" === t.protocol, n.port = t.port, t.query && (n.query = t.query)) : n.host && (n.hostname = h(n.host).host), this.secure = null != n.secure ? n.secure : e.location && "https:" === location.protocol, n.hostname && !n.port && (n.port = this.secure ? "443" : "80"), this.agent = n.agent || !1, this.hostname = n.hostname || (e.location ? location.hostname : "localhost"), this.port = n.port || (e.location && location.port ? location.port : this.secure ? 443 : 80), this.query = n.query || {}, "string" == typeof this.query && (this.query = p.decode(this.query)), this.upgrade = !1 !== n.upgrade, this.path = (n.path || "/engine.io").replace(/\/$/, "") + "/", this.forceJSONP = !!n.forceJSONP, this.jsonp = !1 !== n.jsonp, this.forceBase64 = !!n.forceBase64, this.enablesXDR = !!n.enablesXDR, this.timestampParam = n.timestampParam || "t", this.timestampRequests = n.timestampRequests, this.transports = n.transports || ["polling", "websocket"], this.readyState = "", this.writeBuffer = [], this.prevBufferLen = 0, this.policyPort = n.policyPort || 843, this.rememberUpgrade = n.rememberUpgrade || !1, this.binaryType = null, this.onlyBinaryUpgrades = n.onlyBinaryUpgrades, this.perMessageDeflate = !1 !== n.perMessageDeflate && (n.perMessageDeflate || {}), !0 === this.perMessageDeflate && (this.perMessageDeflate = {}), this.perMessageDeflate && null == this.perMessageDeflate.threshold && (this.perMessageDeflate.threshold = 1024), this.pfx = n.pfx || null, this.key = n.key || null, this.passphrase = n.passphrase || null, this.cert = n.cert || null, this.ca = n.ca || null, this.ciphers = n.ciphers || null, this.rejectUnauthorized = void 0 === n.rejectUnauthorized ? null : n.rejectUnauthorized, this.forceNode = !!n.forceNode;
  1639. var r = "object" == typeof e && e;
  1640. r.global === r && (n.extraHeaders && Object.keys(n.extraHeaders).length > 0 && (this.extraHeaders = n.extraHeaders), n.localAddress && (this.localAddress = n.localAddress)), this.id = null, this.upgrades = null, this.pingInterval = null, this.pingTimeout = null, this.pingIntervalTimer = null, this.pingTimeoutTimer = null, this.open()
  1641. }
  1642.  
  1643. function r(t) {
  1644. var e = {};
  1645. for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
  1646. return e
  1647. }
  1648. var s = n(21),
  1649. i = n(35),
  1650. a = n(3)("engine.io-client:socket"),
  1651. c = n(42),
  1652. u = n(27),
  1653. h = n(2),
  1654. l = n(43),
  1655. p = n(36);
  1656. t.exports = o, o.priorWebsocketSuccess = !1, i(o.prototype), o.protocol = u.protocol, o.Socket = o, o.Transport = n(26), o.transports = n(21), o.parser = n(27), o.prototype.createTransport = function(t) {
  1657. a('creating transport "%s"', t);
  1658. var e = r(this.query);
  1659. return e.EIO = u.protocol, e.transport = t, this.id && (e.sid = this.id), new s[t]({
  1660. agent: this.agent,
  1661. hostname: this.hostname,
  1662. port: this.port,
  1663. secure: this.secure,
  1664. path: this.path,
  1665. query: e,
  1666. forceJSONP: this.forceJSONP,
  1667. jsonp: this.jsonp,
  1668. forceBase64: this.forceBase64,
  1669. enablesXDR: this.enablesXDR,
  1670. timestampRequests: this.timestampRequests,
  1671. timestampParam: this.timestampParam,
  1672. policyPort: this.policyPort,
  1673. socket: this,
  1674. pfx: this.pfx,
  1675. key: this.key,
  1676. passphrase: this.passphrase,
  1677. cert: this.cert,
  1678. ca: this.ca,
  1679. ciphers: this.ciphers,
  1680. rejectUnauthorized: this.rejectUnauthorized,
  1681. perMessageDeflate: this.perMessageDeflate,
  1682. extraHeaders: this.extraHeaders,
  1683. forceNode: this.forceNode,
  1684. localAddress: this.localAddress
  1685. })
  1686. }, o.prototype.open = function() {
  1687. var t;
  1688. if (this.rememberUpgrade && o.priorWebsocketSuccess && -1 !== this.transports.indexOf("websocket")) t = "websocket";
  1689. else {
  1690. if (0 === this.transports.length) {
  1691. var e = this;
  1692. return void setTimeout(function() {
  1693. e.emit("error", "No transports available")
  1694. }, 0)
  1695. }
  1696. t = this.transports[0]
  1697. }
  1698. this.readyState = "opening";
  1699. try {
  1700. t = this.createTransport(t)
  1701. } catch (t) {
  1702. return this.transports.shift(), void this.open()
  1703. }
  1704. t.open(), this.setTransport(t)
  1705. }, o.prototype.setTransport = function(t) {
  1706. a("setting transport %s", t.name);
  1707. var e = this;
  1708. this.transport && (a("clearing existing transport %s", this.transport.name), this.transport.removeAllListeners()), this.transport = t, t.on("drain", function() {
  1709. e.onDrain()
  1710. }).on("packet", function(t) {
  1711. e.onPacket(t)
  1712. }).on("error", function(t) {
  1713. e.onError(t)
  1714. }).on("close", function() {
  1715. e.onClose("transport close")
  1716. })
  1717. }, o.prototype.probe = function(t) {
  1718. function e() {
  1719. if (p.onlyBinaryUpgrades) {
  1720. var e = !this.supportsBinary && p.transport.supportsBinary;
  1721. l = l || e
  1722. }
  1723. l || (a('probe transport "%s" opened', t), h.send([{
  1724. type: "ping",
  1725. data: "probe"
  1726. }]), h.once("packet", function(e) {
  1727. if (!l)
  1728. if ("pong" === e.type && "probe" === e.data) {
  1729. if (a('probe transport "%s" pong', t), p.upgrading = !0, p.emit("upgrading", h), !h) return;
  1730. o.priorWebsocketSuccess = "websocket" === h.name, a('pausing current transport "%s"', p.transport.name), p.transport.pause(function() {
  1731. l || "closed" !== p.readyState && (a("changing transport and sending upgrade packet"), u(), p.setTransport(h), h.send([{
  1732. type: "upgrade"
  1733. }]), p.emit("upgrade", h), h = null, p.upgrading = !1, p.flush())
  1734. })
  1735. } else {
  1736. a('probe transport "%s" failed', t);
  1737. var n = new Error("probe error");
  1738. n.transport = h.name, p.emit("upgradeError", n)
  1739. }
  1740. }))
  1741. }
  1742.  
  1743. function n() {
  1744. l || (l = !0, u(), h.close(), h = null)
  1745. }
  1746.  
  1747. function r(e) {
  1748. var o = new Error("probe error: " + e);
  1749. o.transport = h.name, n(), a('probe transport "%s" failed because of error: %s', t, e), p.emit("upgradeError", o)
  1750. }
  1751.  
  1752. function s() {
  1753. r("transport closed")
  1754. }
  1755.  
  1756. function i() {
  1757. r("socket closed")
  1758. }
  1759.  
  1760. function c(t) {
  1761. h && t.name !== h.name && (a('"%s" works - aborting "%s"', t.name, h.name), n())
  1762. }
  1763.  
  1764. function u() {
  1765. h.removeListener("open", e), h.removeListener("error", r), h.removeListener("close", s), p.removeListener("close", i), p.removeListener("upgrading", c)
  1766. }
  1767. a('probing transport "%s"', t);
  1768. var h = this.createTransport(t, {
  1769. probe: 1
  1770. }),
  1771. l = !1,
  1772. p = this;
  1773. o.priorWebsocketSuccess = !1, h.once("open", e), h.once("error", r), h.once("close", s), this.once("close", i), this.once("upgrading", c), h.open()
  1774. }, o.prototype.onOpen = function() {
  1775. if (a("socket open"), this.readyState = "open", o.priorWebsocketSuccess = "websocket" === this.transport.name, this.emit("open"), this.flush(), "open" === this.readyState && this.upgrade && this.transport.pause) {
  1776. a("starting upgrade probes");
  1777. for (var t = 0, e = this.upgrades.length; t < e; t++) this.probe(this.upgrades[t])
  1778. }
  1779. }, o.prototype.onPacket = function(t) {
  1780. if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) switch (a('socket receive: type "%s", data "%s"', t.type, t.data), this.emit("packet", t), this.emit("heartbeat"), t.type) {
  1781. case "open":
  1782. this.onHandshake(l(t.data));
  1783. break;
  1784. case "pong":
  1785. this.setPing(), this.emit("pong");
  1786. break;
  1787. case "error":
  1788. var e = new Error("server error");
  1789. e.code = t.data, this.onError(e);
  1790. break;
  1791. case "message":
  1792. this.emit("data", t.data), this.emit("message", t.data)
  1793. } else a('packet received with socket readyState "%s"', this.readyState)
  1794. }, o.prototype.onHandshake = function(t) {
  1795. this.emit("handshake", t), this.id = t.sid, this.transport.query.sid = t.sid, this.upgrades = this.filterUpgrades(t.upgrades), this.pingInterval = t.pingInterval, this.pingTimeout = t.pingTimeout, this.onOpen(), "closed" !== this.readyState && (this.setPing(), this.removeListener("heartbeat", this.onHeartbeat), this.on("heartbeat", this.onHeartbeat))
  1796. }, o.prototype.onHeartbeat = function(t) {
  1797. clearTimeout(this.pingTimeoutTimer);
  1798. var e = this;
  1799. e.pingTimeoutTimer = setTimeout(function() {
  1800. "closed" !== e.readyState && e.onClose("ping timeout")
  1801. }, t || e.pingInterval + e.pingTimeout)
  1802. }, o.prototype.setPing = function() {
  1803. var t = this;
  1804. clearTimeout(t.pingIntervalTimer), t.pingIntervalTimer = setTimeout(function() {
  1805. a("writing ping packet - expecting pong within %sms", t.pingTimeout), t.ping(), t.onHeartbeat(t.pingTimeout)
  1806. }, t.pingInterval)
  1807. }, o.prototype.ping = function() {
  1808. var t = this;
  1809. this.sendPacket("ping", function() {
  1810. t.emit("ping")
  1811. })
  1812. }, o.prototype.onDrain = function() {
  1813. this.writeBuffer.splice(0, this.prevBufferLen), this.prevBufferLen = 0, 0 === this.writeBuffer.length ? this.emit("drain") : this.flush()
  1814. }, o.prototype.flush = function() {
  1815. "closed" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length && (a("flushing %d packets in socket", this.writeBuffer.length), this.transport.send(this.writeBuffer), this.prevBufferLen = this.writeBuffer.length, this.emit("flush"))
  1816. }, o.prototype.write = o.prototype.send = function(t, e, n) {
  1817. return this.sendPacket("message", t, e, n), this
  1818. }, o.prototype.sendPacket = function(t, e, n, o) {
  1819. if ("function" == typeof e && (o = e, e = void 0), "function" == typeof n && (o = n, n = null), "closing" !== this.readyState && "closed" !== this.readyState) {
  1820. n = n || {}, n.compress = !1 !== n.compress;
  1821. var r = {
  1822. type: t,
  1823. data: e,
  1824. options: n
  1825. };
  1826. this.emit("packetCreate", r), this.writeBuffer.push(r), o && this.once("flush", o), this.flush()
  1827. }
  1828. }, o.prototype.close = function() {
  1829. function t() {
  1830. o.onClose("forced close"), a("socket closing - telling transport to close"), o.transport.close()
  1831. }
  1832.  
  1833. function e() {
  1834. o.removeListener("upgrade", e), o.removeListener("upgradeError", e), t()
  1835. }
  1836.  
  1837. function n() {
  1838. o.once("upgrade", e), o.once("upgradeError", e)
  1839. }
  1840. if ("opening" === this.readyState || "open" === this.readyState) {
  1841. this.readyState = "closing";
  1842. var o = this;
  1843. this.writeBuffer.length ? this.once("drain", function() {
  1844. this.upgrading ? n() : t()
  1845. }) : this.upgrading ? n() : t()
  1846. }
  1847. return this
  1848. }, o.prototype.onError = function(t) {
  1849. a("socket error %j", t), o.priorWebsocketSuccess = !1, this.emit("error", t), this.onClose("transport error", t)
  1850. }, o.prototype.onClose = function(t, e) {
  1851. if ("opening" === this.readyState || "open" === this.readyState || "closing" === this.readyState) {
  1852. a('socket close with reason: "%s"', t);
  1853. var n = this;
  1854. clearTimeout(this.pingIntervalTimer), clearTimeout(this.pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), this.readyState = "closed", this.id = null, this.emit("close", t, e), n.writeBuffer = [], n.prevBufferLen = 0
  1855. }
  1856. }, o.prototype.filterUpgrades = function(t) {
  1857. for (var e = [], n = 0, o = t.length; n < o; n++) ~c(this.transports, t[n]) && e.push(t[n]);
  1858. return e
  1859. }
  1860. }).call(e, function() {
  1861. return this
  1862. }())
  1863. }, function(t, e, n) {
  1864. (function(t) {
  1865. function o(e) {
  1866. var n = !1,
  1867. o = !1,
  1868. a = !1 !== e.jsonp;
  1869. if (t.location) {
  1870. var c = "https:" === location.protocol,
  1871. u = location.port;
  1872. u || (u = c ? 443 : 80), n = e.hostname !== location.hostname || u !== e.port, o = e.secure !== c
  1873. }
  1874. if (e.xdomain = n, e.xscheme = o, "open" in new r(e) && !e.forceJSONP) return new s(e);
  1875. if (!a) throw new Error("JSONP disabled");
  1876. return new i(e)
  1877. }
  1878. var r = n(22),
  1879. s = n(24),
  1880. i = n(39),
  1881. a = n(40);
  1882. e.polling = o, e.websocket = a
  1883. }).call(e, function() {
  1884. return this
  1885. }())
  1886. }, function(t, e, n) {
  1887. (function(e) {
  1888. var o = n(23);
  1889. t.exports = function(t) {
  1890. var n = t.xdomain,
  1891. r = t.xscheme,
  1892. s = t.enablesXDR;
  1893. try {
  1894. if ("undefined" != typeof XMLHttpRequest && (!n || o)) return new XMLHttpRequest
  1895. } catch (t) {}
  1896. try {
  1897. if ("undefined" != typeof XDomainRequest && !r && s) return new XDomainRequest
  1898. } catch (t) {}
  1899. if (!n) try {
  1900. return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")
  1901. } catch (t) {}
  1902. }
  1903. }).call(e, function() {
  1904. return this
  1905. }())
  1906. }, function(t, e) {
  1907. try {
  1908. t.exports = "undefined" != typeof XMLHttpRequest && "withCredentials" in new XMLHttpRequest
  1909. } catch (e) {
  1910. t.exports = !1
  1911. }
  1912. }, function(t, e, n) {
  1913. (function(e) {
  1914. function o() {}
  1915.  
  1916. function r(t) {
  1917. if (c.call(this, t), this.requestTimeout = t.requestTimeout, e.location) {
  1918. var n = "https:" === location.protocol,
  1919. o = location.port;
  1920. o || (o = n ? 443 : 80), this.xd = t.hostname !== e.location.hostname || o !== t.port, this.xs = t.secure !== n
  1921. } else this.extraHeaders = t.extraHeaders
  1922. }
  1923.  
  1924. function s(t) {
  1925. this.method = t.method || "GET", this.uri = t.uri, this.xd = !!t.xd, this.xs = !!t.xs, this.async = !1 !== t.async, this.data = void 0 !== t.data ? t.data : null, this.agent = t.agent, this.isBinary = t.isBinary, this.supportsBinary = t.supportsBinary, this.enablesXDR = t.enablesXDR, this.requestTimeout = t.requestTimeout, this.pfx = t.pfx, this.key = t.key, this.passphrase = t.passphrase, this.cert = t.cert, this.ca = t.ca, this.ciphers = t.ciphers, this.rejectUnauthorized = t.rejectUnauthorized, this.extraHeaders = t.extraHeaders, this.create()
  1926. }
  1927.  
  1928. function i() {
  1929. for (var t in s.requests) s.requests.hasOwnProperty(t) && s.requests[t].abort()
  1930. }
  1931. var a = n(22),
  1932. c = n(25),
  1933. u = n(35),
  1934. h = n(37),
  1935. l = n(3)("engine.io-client:polling-xhr");
  1936. t.exports = r, t.exports.Request = s, h(r, c), r.prototype.supportsBinary = !0, r.prototype.request = function(t) {
  1937. return t = t || {}, t.uri = this.uri(), t.xd = this.xd, t.xs = this.xs, t.agent = this.agent || !1, t.supportsBinary = this.supportsBinary, t.enablesXDR = this.enablesXDR, t.pfx = this.pfx, t.key = this.key, t.passphrase = this.passphrase, t.cert = this.cert, t.ca = this.ca, t.ciphers = this.ciphers, t.rejectUnauthorized = this.rejectUnauthorized, t.requestTimeout = this.requestTimeout, t.extraHeaders = this.extraHeaders, new s(t)
  1938. }, r.prototype.doWrite = function(t, e) {
  1939. var n = "string" != typeof t && void 0 !== t,
  1940. o = this.request({
  1941. method: "POST",
  1942. data: t,
  1943. isBinary: n
  1944. }),
  1945. r = this;
  1946. o.on("success", e), o.on("error", function(t) {
  1947. r.onError("xhr post error", t)
  1948. }), this.sendXhr = o
  1949. }, r.prototype.doPoll = function() {
  1950. l("xhr poll");
  1951. var t = this.request(),
  1952. e = this;
  1953. t.on("data", function(t) {
  1954. e.onData(t)
  1955. }), t.on("error", function(t) {
  1956. e.onError("xhr poll error", t)
  1957. }), this.pollXhr = t
  1958. }, u(s.prototype), s.prototype.create = function() {
  1959. var t = {
  1960. agent: this.agent,
  1961. xdomain: this.xd,
  1962. xscheme: this.xs,
  1963. enablesXDR: this.enablesXDR
  1964. };
  1965. t.pfx = this.pfx, t.key = this.key, t.passphrase = this.passphrase, t.cert = this.cert, t.ca = this.ca, t.ciphers = this.ciphers, t.rejectUnauthorized = this.rejectUnauthorized;
  1966. var n = this.xhr = new a(t),
  1967. o = this;
  1968. try {
  1969. l("xhr open %s: %s", this.method, this.uri), n.open(this.method, this.uri, this.async);
  1970. try {
  1971. if (this.extraHeaders) {
  1972. n.setDisableHeaderCheck(!0);
  1973. for (var r in this.extraHeaders) this.extraHeaders.hasOwnProperty(r) && n.setRequestHeader(r, this.extraHeaders[r])
  1974. }
  1975. } catch (t) {}
  1976. if (this.supportsBinary && (n.responseType = "arraybuffer"), "POST" === this.method) try {
  1977. this.isBinary ? n.setRequestHeader("Content-type", "application/octet-stream") : n.setRequestHeader("Content-type", "text/plain;charset=UTF-8")
  1978. } catch (t) {}
  1979. try {
  1980. n.setRequestHeader("Accept", "*/*")
  1981. } catch (t) {}
  1982. "withCredentials" in n && (n.withCredentials = !0), this.requestTimeout && (n.timeout = this.requestTimeout), this.hasXDR() ? (n.onload = function() {
  1983. o.onLoad()
  1984. }, n.onerror = function() {
  1985. o.onError(n.responseText)
  1986. }) : n.onreadystatechange = function() {
  1987. 4 === n.readyState && (200 === n.status || 1223 === n.status ? o.onLoad() : setTimeout(function() {
  1988. o.onError(n.status)
  1989. }, 0))
  1990. }, l("xhr data %s", this.data), n.send(this.data)
  1991. } catch (t) {
  1992. return void setTimeout(function() {
  1993. o.onError(t)
  1994. }, 0)
  1995. }
  1996. e.document && (this.index = s.requestsCount++, s.requests[this.index] = this)
  1997. }, s.prototype.onSuccess = function() {
  1998. this.emit("success"), this.cleanup()
  1999. }, s.prototype.onData = function(t) {
  2000. this.emit("data", t), this.onSuccess()
  2001. }, s.prototype.onError = function(t) {
  2002. this.emit("error", t), this.cleanup(!0)
  2003. }, s.prototype.cleanup = function(t) {
  2004. if (void 0 !== this.xhr && null !== this.xhr) {
  2005. if (this.hasXDR() ? this.xhr.onload = this.xhr.onerror = o : this.xhr.onreadystatechange = o, t) try {
  2006. this.xhr.abort()
  2007. } catch (t) {}
  2008. e.document && delete s.requests[this.index], this.xhr = null
  2009. }
  2010. }, s.prototype.onLoad = function() {
  2011. var t;
  2012. try {
  2013. var e;
  2014. try {
  2015. e = this.xhr.getResponseHeader("Content-Type").split(";")[0]
  2016. } catch (t) {}
  2017. if ("application/octet-stream" === e) t = this.xhr.response || this.xhr.responseText;
  2018. else if (this.supportsBinary) try {
  2019. t = String.fromCharCode.apply(null, new Uint8Array(this.xhr.response))
  2020. } catch (e) {
  2021. for (var n = new Uint8Array(this.xhr.response), o = [], r = 0, s = n.length; r < s; r++) o.push(n[r]);
  2022. t = String.fromCharCode.apply(null, o)
  2023. } else t = this.xhr.responseText
  2024. } catch (t) {
  2025. this.onError(t)
  2026. }
  2027. null != t && this.onData(t)
  2028. }, s.prototype.hasXDR = function() {
  2029. return void 0 !== e.XDomainRequest && !this.xs && this.enablesXDR
  2030. }, s.prototype.abort = function() {
  2031. this.cleanup()
  2032. }, s.requestsCount = 0, s.requests = {}, e.document && (e.attachEvent ? e.attachEvent("onunload", i) : e.addEventListener && e.addEventListener("beforeunload", i, !1))
  2033. }).call(e, function() {
  2034. return this
  2035. }())
  2036. }, function(t, e, n) {
  2037. function o(t) {
  2038. var e = t && t.forceBase64;
  2039. h && !e || (this.supportsBinary = !1), r.call(this, t)
  2040. }
  2041. var r = n(26),
  2042. s = n(36),
  2043. i = n(27),
  2044. a = n(37),
  2045. c = n(38),
  2046. u = n(3)("engine.io-client:polling");
  2047. t.exports = o;
  2048. var h = function() {
  2049. return null != new(n(22))({
  2050. xdomain: !1
  2051. }).responseType
  2052. }();
  2053. a(o, r), o.prototype.name = "polling", o.prototype.doOpen = function() {
  2054. this.poll()
  2055. }, o.prototype.pause = function(t) {
  2056. function e() {
  2057. u("paused"), n.readyState = "paused", t()
  2058. }
  2059. var n = this;
  2060. if (this.readyState = "pausing", this.polling || !this.writable) {
  2061. var o = 0;
  2062. this.polling && (u("we are currently polling - waiting to pause"), o++, this.once("pollComplete", function() {
  2063. u("pre-pause polling complete"), --o || e()
  2064. })), this.writable || (u("we are currently writing - waiting to pause"), o++, this.once("drain", function() {
  2065. u("pre-pause writing complete"), --o || e()
  2066. }))
  2067. } else e()
  2068. }, o.prototype.poll = function() {
  2069. u("polling"), this.polling = !0, this.doPoll(), this.emit("poll")
  2070. }, o.prototype.onData = function(t) {
  2071. var e = this;
  2072. u("polling got data %s", t);
  2073. var n = function(t, n, o) {
  2074. return "opening" === e.readyState && e.onOpen(), "close" === t.type ? (e.onClose(), !1) : void e.onPacket(t)
  2075. };
  2076. i.decodePayload(t, this.socket.binaryType, n), "closed" !== this.readyState && (this.polling = !1, this.emit("pollComplete"), "open" === this.readyState ? this.poll() : u('ignoring poll - transport state "%s"', this.readyState))
  2077. }, o.prototype.doClose = function() {
  2078. function t() {
  2079. u("writing close packet"), e.write([{
  2080. type: "close"
  2081. }])
  2082. }
  2083. var e = this;
  2084. "open" === this.readyState ? (u("transport open - closing"), t()) : (u("transport not open - deferring close"), this.once("open", t))
  2085. }, o.prototype.write = function(t) {
  2086. var e = this;
  2087. this.writable = !1;
  2088. var n = function() {
  2089. e.writable = !0, e.emit("drain")
  2090. };
  2091. i.encodePayload(t, this.supportsBinary, function(t) {
  2092. e.doWrite(t, n)
  2093. })
  2094. }, o.prototype.uri = function() {
  2095. var t = this.query || {},
  2096. e = this.secure ? "https" : "http",
  2097. n = "";
  2098. return !1 !== this.timestampRequests && (t[this.timestampParam] = c()), this.supportsBinary || t.sid || (t.b64 = 1), t = s.encode(t), this.port && ("https" === e && 443 !== Number(this.port) || "http" === e && 80 !== Number(this.port)) && (n = ":" + this.port), t.length && (t = "?" + t), e + "://" + (-1 !== this.hostname.indexOf(":") ? "[" + this.hostname + "]" : this.hostname) + n + this.path + t
  2099. }
  2100. }, function(t, e, n) {
  2101. function o(t) {
  2102. this.path = t.path, this.hostname = t.hostname, this.port = t.port, this.secure = t.secure, this.query = t.query, this.timestampParam = t.timestampParam, this.timestampRequests = t.timestampRequests, this.readyState = "", this.agent = t.agent || !1, this.socket = t.socket, this.enablesXDR = t.enablesXDR, this.pfx = t.pfx, this.key = t.key, this.passphrase = t.passphrase, this.cert = t.cert, this.ca = t.ca, this.ciphers = t.ciphers, this.rejectUnauthorized = t.rejectUnauthorized, this.forceNode = t.forceNode, this.extraHeaders = t.extraHeaders, this.localAddress = t.localAddress
  2103. }
  2104. var r = n(27),
  2105. s = n(35);
  2106. t.exports = o, s(o.prototype), o.prototype.onError = function(t, e) {
  2107. var n = new Error(t);
  2108. return n.type = "TransportError", n.description = e, this.emit("error", n), this
  2109. }, o.prototype.open = function() {
  2110. return "closed" !== this.readyState && "" !== this.readyState || (this.readyState = "opening", this.doOpen()), this
  2111. }, o.prototype.close = function() {
  2112. return "opening" !== this.readyState && "open" !== this.readyState || (this.doClose(), this.onClose()), this
  2113. }, o.prototype.send = function(t) {
  2114. if ("open" !== this.readyState) throw new Error("Transport not open");
  2115. this.write(t)
  2116. }, o.prototype.onOpen = function() {
  2117. this.readyState = "open", this.writable = !0, this.emit("open")
  2118. }, o.prototype.onData = function(t) {
  2119. var e = r.decodePacket(t, this.socket.binaryType);
  2120. this.onPacket(e)
  2121. }, o.prototype.onPacket = function(t) {
  2122. this.emit("packet", t)
  2123. }, o.prototype.onClose = function() {
  2124. this.readyState = "closed", this.emit("close")
  2125. }
  2126. }, function(t, e, n) {
  2127. (function(t) {
  2128. function o(t, n) {
  2129. return n("b" + e.packets[t.type] + t.data.data)
  2130. }
  2131.  
  2132. function r(t, n, o) {
  2133. if (!n) return e.encodeBase64Packet(t, o);
  2134. var r = t.data,
  2135. s = new Uint8Array(r),
  2136. i = new Uint8Array(1 + r.byteLength);
  2137. i[0] = v[t.type];
  2138. for (var a = 0; a < s.length; a++) i[a + 1] = s[a];
  2139. return o(i.buffer)
  2140. }
  2141.  
  2142. function s(t, n, o) {
  2143. if (!n) return e.encodeBase64Packet(t, o);
  2144. var r = new FileReader;
  2145. return r.onload = function() {
  2146. t.data = r.result, e.encodePacket(t, n, !0, o)
  2147. }, r.readAsArrayBuffer(t.data)
  2148. }
  2149.  
  2150. function i(t, n, o) {
  2151. if (!n) return e.encodeBase64Packet(t, o);
  2152. if (g) return s(t, n, o);
  2153. var r = new Uint8Array(1);
  2154. return r[0] = v[t.type], o(new k([r.buffer, t.data]))
  2155. }
  2156.  
  2157. function a(t) {
  2158. try {
  2159. t = d.decode(t)
  2160. } catch (t) {
  2161. return !1
  2162. }
  2163. return t
  2164. }
  2165.  
  2166. function c(t, e, n) {
  2167. for (var o = new Array(t.length), r = f(t.length, n), s = 0; s < t.length; s++) ! function(t, n, r) {
  2168. e(n, function(e, n) {
  2169. o[t] = n, r(e, o)
  2170. })
  2171. }(s, t[s], r)
  2172. }
  2173. var u, h = n(28),
  2174. l = n(29),
  2175. p = n(30),
  2176. f = n(31),
  2177. d = n(32);
  2178. t && t.ArrayBuffer && (u = n(33));
  2179. var y = "undefined" != typeof navigator && /Android/i.test(navigator.userAgent),
  2180. m = "undefined" != typeof navigator && /PhantomJS/i.test(navigator.userAgent),
  2181. g = y || m;
  2182. e.protocol = 3;
  2183. var v = e.packets = {
  2184. open: 0,
  2185. close: 1,
  2186. ping: 2,
  2187. pong: 3,
  2188. message: 4,
  2189. upgrade: 5,
  2190. noop: 6
  2191. },
  2192. b = h(v),
  2193. w = {
  2194. type: "error",
  2195. data: "parser error"
  2196. },
  2197. k = n(34);
  2198. e.encodePacket = function(e, n, s, a) {
  2199. "function" == typeof n && (a = n, n = !1), "function" == typeof s && (a = s, s = null);
  2200. var c = void 0 === e.data ? void 0 : e.data.buffer || e.data;
  2201. if (t.ArrayBuffer && c instanceof ArrayBuffer) return r(e, n, a);
  2202. if (k && c instanceof t.Blob) return i(e, n, a);
  2203. if (c && c.base64) return o(e, a);
  2204. var u = v[e.type];
  2205. return void 0 !== e.data && (u += s ? d.encode(String(e.data)) : String(e.data)), a("" + u)
  2206. }, e.encodeBase64Packet = function(n, o) {
  2207. var r = "b" + e.packets[n.type];
  2208. if (k && n.data instanceof t.Blob) {
  2209. var s = new FileReader;
  2210. return s.onload = function() {
  2211. var t = s.result.split(",")[1];
  2212. o(r + t)
  2213. }, s.readAsDataURL(n.data)
  2214. }
  2215. var i;
  2216. try {
  2217. i = String.fromCharCode.apply(null, new Uint8Array(n.data))
  2218. } catch (t) {
  2219. for (var a = new Uint8Array(n.data), c = new Array(a.length), u = 0; u < a.length; u++) c[u] = a[u];
  2220. i = String.fromCharCode.apply(null, c)
  2221. }
  2222. return r += t.btoa(i), o(r)
  2223. }, e.decodePacket = function(t, n, o) {
  2224. if (void 0 === t) return w;
  2225. if ("string" == typeof t) {
  2226. if ("b" == t.charAt(0)) return e.decodeBase64Packet(t.substr(1), n);
  2227. if (o && !1 === (t = a(t))) return w;
  2228. var r = t.charAt(0);
  2229. return Number(r) == r && b[r] ? t.length > 1 ? {
  2230. type: b[r],
  2231. data: t.substring(1)
  2232. } : {
  2233. type: b[r]
  2234. } : w
  2235. }
  2236. var s = new Uint8Array(t),
  2237. r = s[0],
  2238. i = p(t, 1);
  2239. return k && "blob" === n && (i = new k([i])), {
  2240. type: b[r],
  2241. data: i
  2242. }
  2243. }, e.decodeBase64Packet = function(t, e) {
  2244. var n = b[t.charAt(0)];
  2245. if (!u) return {
  2246. type: n,
  2247. data: {
  2248. base64: !0,
  2249. data: t.substr(1)
  2250. }
  2251. };
  2252. var o = u.decode(t.substr(1));
  2253. return "blob" === e && k && (o = new k([o])), {
  2254. type: n,
  2255. data: o
  2256. }
  2257. }, e.encodePayload = function(t, n, o) {
  2258. function r(t) {
  2259. return t.length + ":" + t
  2260. }
  2261.  
  2262. function s(t, o) {
  2263. e.encodePacket(t, !!i && n, !0, function(t) {
  2264. o(null, r(t))
  2265. })
  2266. }
  2267. "function" == typeof n && (o = n, n = null);
  2268. var i = l(t);
  2269. return n && i ? k && !g ? e.encodePayloadAsBlob(t, o) : e.encodePayloadAsArrayBuffer(t, o) : t.length ? void c(t, s, function(t, e) {
  2270. return o(e.join(""))
  2271. }) : o("0:")
  2272. }, e.decodePayload = function(t, n, o) {
  2273. if ("string" != typeof t) return e.decodePayloadAsBinary(t, n, o);
  2274. "function" == typeof n && (o = n, n = null);
  2275. var r;
  2276. if ("" == t) return o(w, 0, 1);
  2277. for (var s, i, a = "", c = 0, u = t.length; c < u; c++) {
  2278. var h = t.charAt(c);
  2279. if (":" != h) a += h;
  2280. else {
  2281. if ("" == a || a != (s = Number(a))) return o(w, 0, 1);
  2282. if (i = t.substr(c + 1, s), a != i.length) return o(w, 0, 1);
  2283. if (i.length) {
  2284. if (r = e.decodePacket(i, n, !0), w.type == r.type && w.data == r.data) return o(w, 0, 1);
  2285. if (!1 === o(r, c + s, u)) return
  2286. }
  2287. c += s, a = ""
  2288. }
  2289. }
  2290. return "" != a ? o(w, 0, 1) : void 0
  2291. }, e.encodePayloadAsArrayBuffer = function(t, n) {
  2292. function o(t, n) {
  2293. e.encodePacket(t, !0, !0, function(t) {
  2294. return n(null, t)
  2295. })
  2296. }
  2297. return t.length ? void c(t, o, function(t, e) {
  2298. var o = e.reduce(function(t, e) {
  2299. var n;
  2300. return n = "string" == typeof e ? e.length : e.byteLength, t + n.toString().length + n + 2
  2301. }, 0),
  2302. r = new Uint8Array(o),
  2303. s = 0;
  2304. return e.forEach(function(t) {
  2305. var e = "string" == typeof t,
  2306. n = t;
  2307. if (e) {
  2308. for (var o = new Uint8Array(t.length), i = 0; i < t.length; i++) o[i] = t.charCodeAt(i);
  2309. n = o.buffer
  2310. }
  2311. r[s++] = e ? 0 : 1;
  2312. for (var a = n.byteLength.toString(), i = 0; i < a.length; i++) r[s++] = parseInt(a[i]);
  2313. r[s++] = 255;
  2314. for (var o = new Uint8Array(n), i = 0; i < o.length; i++) r[s++] = o[i]
  2315. }), n(r.buffer)
  2316. }) : n(new ArrayBuffer(0))
  2317. }, e.encodePayloadAsBlob = function(t, n) {
  2318. function o(t, n) {
  2319. e.encodePacket(t, !0, !0, function(t) {
  2320. var e = new Uint8Array(1);
  2321. if (e[0] = 1, "string" == typeof t) {
  2322. for (var o = new Uint8Array(t.length), r = 0; r < t.length; r++) o[r] = t.charCodeAt(r);
  2323. t = o.buffer, e[0] = 0
  2324. }
  2325. for (var s = t instanceof ArrayBuffer ? t.byteLength : t.size, i = s.toString(), a = new Uint8Array(i.length + 1), r = 0; r < i.length; r++) a[r] = parseInt(i[r]);
  2326. if (a[i.length] = 255, k) {
  2327. var c = new k([e.buffer, a.buffer, t]);
  2328. n(null, c)
  2329. }
  2330. })
  2331. }
  2332. c(t, o, function(t, e) {
  2333. return n(new k(e))
  2334. })
  2335. }, e.decodePayloadAsBinary = function(t, n, o) {
  2336. "function" == typeof n && (o = n, n = null);
  2337. for (var r = t, s = [], i = !1; r.byteLength > 0;) {
  2338. for (var a = new Uint8Array(r), c = 0 === a[0], u = "", h = 1; 255 != a[h]; h++) {
  2339. if (u.length > 310) {
  2340. i = !0;
  2341. break
  2342. }
  2343. u += a[h]
  2344. }
  2345. if (i) return o(w, 0, 1);
  2346. r = p(r, 2 + u.length), u = parseInt(u);
  2347. var l = p(r, 0, u);
  2348. if (c) try {
  2349. l = String.fromCharCode.apply(null, new Uint8Array(l))
  2350. } catch (t) {
  2351. var f = new Uint8Array(l);
  2352. l = "";
  2353. for (var h = 0; h < f.length; h++) l += String.fromCharCode(f[h])
  2354. }
  2355. s.push(l), r = p(r, u)
  2356. }
  2357. var d = s.length;
  2358. s.forEach(function(t, r) {
  2359. o(e.decodePacket(t, n, !0), r, d)
  2360. })
  2361. }
  2362. }).call(e, function() {
  2363. return this
  2364. }())
  2365. }, function(t, e) {
  2366. t.exports = Object.keys || function(t) {
  2367. var e = [],
  2368. n = Object.prototype.hasOwnProperty;
  2369. for (var o in t) n.call(t, o) && e.push(o);
  2370. return e
  2371. }
  2372. }, function(t, e, n) {
  2373. (function(e) {
  2374. function o(t) {
  2375. function n(t) {
  2376. if (!t) return !1;
  2377. if (e.Buffer && e.Buffer.isBuffer && e.Buffer.isBuffer(t) || e.ArrayBuffer && t instanceof ArrayBuffer || e.Blob && t instanceof Blob || e.File && t instanceof File) return !0;
  2378. if (r(t)) {
  2379. for (var o = 0; o < t.length; o++)
  2380. if (n(t[o])) return !0
  2381. } else if (t && "object" == typeof t) {
  2382. t.toJSON && "function" == typeof t.toJSON && (t = t.toJSON());
  2383. for (var s in t)
  2384. if (Object.prototype.hasOwnProperty.call(t, s) && n(t[s])) return !0
  2385. }
  2386. return !1
  2387. }
  2388. return n(t)
  2389. }
  2390. var r = n(15);
  2391. t.exports = o
  2392. }).call(e, function() {
  2393. return this
  2394. }())
  2395. }, function(t, e) {
  2396. t.exports = function(t, e, n) {
  2397. var o = t.byteLength;
  2398. if (e = e || 0, n = n || o, t.slice) return t.slice(e, n);
  2399. if (e < 0 && (e += o), n < 0 && (n += o), n > o && (n = o), e >= o || e >= n || 0 === o) return new ArrayBuffer(0);
  2400. for (var r = new Uint8Array(t), s = new Uint8Array(n - e), i = e, a = 0; i < n; i++, a++) s[a] = r[i];
  2401. return s.buffer
  2402. }
  2403. }, function(t, e) {
  2404. function n(t, e, n) {
  2405. function r(t, o) {
  2406. if (r.count <= 0) throw new Error("after called too many times");
  2407. --r.count, t ? (s = !0, e(t), e = n) : 0 !== r.count || s || e(null, o)
  2408. }
  2409. var s = !1;
  2410. return n = n || o, r.count = t, 0 === t ? e() : r
  2411. }
  2412.  
  2413. function o() {}
  2414. t.exports = n
  2415. }, function(t, e, n) {
  2416. var o;
  2417. (function(t, r) {
  2418. ! function(s) {
  2419. function i(t) {
  2420. for (var e, n, o = [], r = 0, s = t.length; r < s;) e = t.charCodeAt(r++), e >= 55296 && e <= 56319 && r < s ? (n = t.charCodeAt(r++), 56320 == (64512 & n) ? o.push(((1023 & e) << 10) + (1023 & n) + 65536) : (o.push(e), r--)) : o.push(e);
  2421. return o
  2422. }
  2423.  
  2424. function a(t) {
  2425. for (var e, n = t.length, o = -1, r = ""; ++o < n;) e = t[o], e > 65535 && (e -= 65536, r += v(e >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), r += v(e);
  2426. return r
  2427. }
  2428.  
  2429. function c(t, e) {
  2430. return v(t >> e & 63 | 128)
  2431. }
  2432.  
  2433. function u(t) {
  2434. if (0 == (4294967168 & t)) return v(t);
  2435. var e = "";
  2436. return 0 == (4294965248 & t) ? e = v(t >> 6 & 31 | 192) : 0 == (4294901760 & t) ? (e = v(t >> 12 & 15 | 224), e += c(t, 6)) : 0 == (4292870144 & t) && (e = v(t >> 18 & 7 | 240), e += c(t, 12), e += c(t, 6)), e += v(63 & t | 128)
  2437. }
  2438.  
  2439. function h(t) {
  2440. for (var e, n = i(t), o = n.length, r = -1, s = ""; ++r < o;) e = n[r], s += u(e);
  2441. return s
  2442. }
  2443.  
  2444. function l() {
  2445. if (g >= m) throw Error("Invalid byte index");
  2446. var t = 255 & y[g];
  2447. if (g++, 128 == (192 & t)) return 63 & t;
  2448. throw Error("Invalid continuation byte")
  2449. }
  2450.  
  2451. function p() {
  2452. var t, e, n, o, r;
  2453. if (g > m) throw Error("Invalid byte index");
  2454. if (g == m) return !1;
  2455. if (t = 255 & y[g], g++, 0 == (128 & t)) return t;
  2456. if (192 == (224 & t)) {
  2457. var e = l();
  2458. if ((r = (31 & t) << 6 | e) >= 128) return r;
  2459. throw Error("Invalid continuation byte")
  2460. }
  2461. if (224 == (240 & t)) {
  2462. if (e = l(), n = l(), (r = (15 & t) << 12 | e << 6 | n) >= 2048) return r;
  2463. throw Error("Invalid continuation byte")
  2464. }
  2465. if (240 == (248 & t) && (e = l(), n = l(), o = l(), (r = (15 & t) << 18 | e << 12 | n << 6 | o) >= 65536 && r <= 1114111)) return r;
  2466. throw Error("Invalid WTF-8 detected")
  2467. }
  2468.  
  2469. function f(t) {
  2470. y = i(t), m = y.length, g = 0;
  2471. for (var e, n = []; !1 !== (e = p());) n.push(e);
  2472. return a(n)
  2473. }
  2474. var d = ("object" == typeof t && t && t.exports, "object" == typeof r && r);
  2475. var y, m, g, v = String.fromCharCode,
  2476. b = {
  2477. version: "1.0.0",
  2478. encode: h,
  2479. decode: f
  2480. };
  2481. void 0 !== (o = function() {
  2482. return b
  2483. }.call(e, n, e, t)) && (t.exports = o)
  2484. }()
  2485. }).call(e, n(12)(t), function() {
  2486. return this
  2487. }())
  2488. }, function(t, e) {
  2489. ! function() {
  2490. "use strict";
  2491. for (var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = new Uint8Array(256), o = 0; o < t.length; o++) n[t.charCodeAt(o)] = o;
  2492. e.encode = function(e) {
  2493. var n, o = new Uint8Array(e),
  2494. r = o.length,
  2495. s = "";
  2496. for (n = 0; n < r; n += 3) s += t[o[n] >> 2], s += t[(3 & o[n]) << 4 | o[n + 1] >> 4], s += t[(15 & o[n + 1]) << 2 | o[n + 2] >> 6], s += t[63 & o[n + 2]];
  2497. return r % 3 == 2 ? s = s.substring(0, s.length - 1) + "=" : r % 3 == 1 && (s = s.substring(0, s.length - 2) + "=="), s
  2498. }, e.decode = function(t) {
  2499. var e, o, r, s, i, a = .75 * t.length,
  2500. c = t.length,
  2501. u = 0;
  2502. "=" === t[t.length - 1] && (a--, "=" === t[t.length - 2] && a--);
  2503. var h = new ArrayBuffer(a),
  2504. l = new Uint8Array(h);
  2505. for (e = 0; e < c; e += 4) o = n[t.charCodeAt(e)], r = n[t.charCodeAt(e + 1)], s = n[t.charCodeAt(e + 2)], i = n[t.charCodeAt(e + 3)], l[u++] = o << 2 | r >> 4, l[u++] = (15 & r) << 4 | s >> 2, l[u++] = (3 & s) << 6 | 63 & i;
  2506. return h
  2507. }
  2508. }()
  2509. }, function(t, e) {
  2510. (function(e) {
  2511. function n(t) {
  2512. for (var e = 0; e < t.length; e++) {
  2513. var n = t[e];
  2514. if (n.buffer instanceof ArrayBuffer) {
  2515. var o = n.buffer;
  2516. if (n.byteLength !== o.byteLength) {
  2517. var r = new Uint8Array(n.byteLength);
  2518. r.set(new Uint8Array(o, n.byteOffset, n.byteLength)), o = r.buffer
  2519. }
  2520. t[e] = o
  2521. }
  2522. }
  2523. }
  2524.  
  2525. function o(t, e) {
  2526. e = e || {};
  2527. var o = new s;
  2528. n(t);
  2529. for (var r = 0; r < t.length; r++) o.append(t[r]);
  2530. return e.type ? o.getBlob(e.type) : o.getBlob()
  2531. }
  2532.  
  2533. function r(t, e) {
  2534. return n(t), new Blob(t, e || {})
  2535. }
  2536. var s = e.BlobBuilder || e.WebKitBlobBuilder || e.MSBlobBuilder || e.MozBlobBuilder,
  2537. i = function() {
  2538. try {
  2539. return 2 === new Blob(["hi"]).size
  2540. } catch (t) {
  2541. return !1
  2542. }
  2543. }(),
  2544. a = i && function() {
  2545. try {
  2546. return 2 === new Blob([new Uint8Array([1, 2])]).size
  2547. } catch (t) {
  2548. return !1
  2549. }
  2550. }(),
  2551. c = s && s.prototype.append && s.prototype.getBlob;
  2552. t.exports = function() {
  2553. return i ? a ? e.Blob : r : c ? o : void 0
  2554. }()
  2555. }).call(e, function() {
  2556. return this
  2557. }())
  2558. }, function(t, e, n) {
  2559. function o(t) {
  2560. if (t) return r(t)
  2561. }
  2562.  
  2563. function r(t) {
  2564. for (var e in o.prototype) t[e] = o.prototype[e];
  2565. return t
  2566. }
  2567. t.exports = o, o.prototype.on = o.prototype.addEventListener = function(t, e) {
  2568. return this._callbacks = this._callbacks || {}, (this._callbacks["$" + t] = this._callbacks["$" + t] || []).push(e), this
  2569. }, o.prototype.once = function(t, e) {
  2570. function n() {
  2571. this.off(t, n), e.apply(this, arguments)
  2572. }
  2573. return n.fn = e, this.on(t, n), this
  2574. }, o.prototype.off = o.prototype.removeListener = o.prototype.removeAllListeners = o.prototype.removeEventListener = function(t, e) {
  2575. if (this._callbacks = this._callbacks || {}, 0 == arguments.length) return this._callbacks = {}, this;
  2576. var n = this._callbacks["$" + t];
  2577. if (!n) return this;
  2578. if (1 == arguments.length) return delete this._callbacks["$" + t], this;
  2579. for (var o, r = 0; r < n.length; r++)
  2580. if ((o = n[r]) === e || o.fn === e) {
  2581. n.splice(r, 1);
  2582. break
  2583. }
  2584. return this
  2585. }, o.prototype.emit = function(t) {
  2586. this._callbacks = this._callbacks || {};
  2587. var e = [].slice.call(arguments, 1),
  2588. n = this._callbacks["$" + t];
  2589. if (n) {
  2590. n = n.slice(0);
  2591. for (var o = 0, r = n.length; o < r; ++o) n[o].apply(this, e)
  2592. }
  2593. return this
  2594. }, o.prototype.listeners = function(t) {
  2595. return this._callbacks = this._callbacks || {}, this._callbacks["$" + t] || []
  2596. }, o.prototype.hasListeners = function(t) {
  2597. return !!this.listeners(t).length
  2598. }
  2599. }, function(t, e) {
  2600. e.encode = function(t) {
  2601. var e = "";
  2602. for (var n in t) t.hasOwnProperty(n) && (e.length && (e += "&"), e += encodeURIComponent(n) + "=" + encodeURIComponent(t[n]));
  2603. return e
  2604. }, e.decode = function(t) {
  2605. for (var e = {}, n = t.split("&"), o = 0, r = n.length; o < r; o++) {
  2606. var s = n[o].split("=");
  2607. e[decodeURIComponent(s[0])] = decodeURIComponent(s[1])
  2608. }
  2609. return e
  2610. }
  2611. }, function(t, e) {
  2612. t.exports = function(t, e) {
  2613. var n = function() {};
  2614. n.prototype = e.prototype, t.prototype = new n, t.prototype.constructor = t
  2615. }
  2616. }, function(t, e) {
  2617. "use strict";
  2618.  
  2619. function n(t) {
  2620. var e = "";
  2621. do {
  2622. e = i[t % a] + e, t = Math.floor(t / a)
  2623. } while (t > 0);
  2624. return e
  2625. }
  2626.  
  2627. function o(t) {
  2628. var e = 0;
  2629. for (h = 0; h < t.length; h++) e = e * a + c[t.charAt(h)];
  2630. return e
  2631. }
  2632.  
  2633. function r() {
  2634. var t = n(+new Date);
  2635. return t !== s ? (u = 0, s = t) : t + "." + n(u++)
  2636. }
  2637. for (var s, i = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""), a = 64, c = {}, u = 0, h = 0; h < a; h++) c[i[h]] = h;
  2638. r.encode = n, r.decode = o, t.exports = r
  2639. }, function(t, n, o) {
  2640. (function(n) {
  2641. function r() {}
  2642.  
  2643. function s(t) {
  2644. i.call(this, t), this.query = this.query || {}, c || (n.___eio || (n.___eio = []), c = n.___eio), this.index = c.length;
  2645. var e = this;
  2646. c.push(function(t) {
  2647. e.onData(t)
  2648. }), this.query.j = this.index, n.document && n.addEventListener && n.addEventListener("beforeunload", function() {
  2649. e.script && (e.script.onerror = r)
  2650. }, !1)
  2651. }
  2652. var i = o(25),
  2653. a = o(37);
  2654. t.exports = s;
  2655. var c, u = /\n/g,
  2656. h = /\\n/g;
  2657. a(s, i), s.prototype.supportsBinary = !1, s.prototype.doClose = function() {
  2658. this.script && (this.script.parentNode.removeChild(this.script), this.script = null), this.form && (this.form.parentNode.removeChild(this.form), this.form = null, this.iframe = null), i.prototype.doClose.call(this)
  2659. }, s.prototype.doPoll = function() {
  2660. var t = this,
  2661. n = e.createElement("script");
  2662. this.script && (this.script.parentNode.removeChild(this.script), this.script = null), n.async = !0, n.src = this.uri(), n.onerror = function(e) {
  2663. t.onError("jsonp poll error", e)
  2664. };
  2665. var o = e.getElementsByTagName("script")[0];
  2666. o ? o.parentNode.insertBefore(n, o) : (e.head || e.body).appendChild(n), this.script = n, "undefined" != typeof navigator && /gecko/i.test(navigator.userAgent) && setTimeout(function() {
  2667. var t = e.createElement("iframe");
  2668. e.body.appendChild(t), e.body.removeChild(t)
  2669. }, 100)
  2670. }, s.prototype.doWrite = function(t, n) {
  2671. function o() {
  2672. r(), n()
  2673. }
  2674.  
  2675. function r() {
  2676. if (s.iframe) try {
  2677. s.form.removeChild(s.iframe)
  2678. } catch (t) {
  2679. s.onError("jsonp polling iframe removal error", t)
  2680. }
  2681. try {
  2682. var t = '<iframe src="javascript:0" name="' + s.iframeId + '">';
  2683. i = e.createElement(t)
  2684. } catch (t) {
  2685. i = e.createElement("iframe"), i.name = s.iframeId, i.src = "javascript:0"
  2686. }
  2687. i.id = s.iframeId, s.form.appendChild(i), s.iframe = i
  2688. }
  2689. var s = this;
  2690. if (!this.form) {
  2691. var i, a = e.createElement("form"),
  2692. c = e.createElement("textarea"),
  2693. l = this.iframeId = "eio_iframe_" + this.index;
  2694. a.className = "socketio", a.style.position = "absolute", a.style.top = "-1000px", a.style.left = "-1000px", a.target = l, a.method = "POST", a.setAttribute("accept-charset", "utf-8"), c.name = "d", a.appendChild(c), e.body.appendChild(a), this.form = a, this.area = c
  2695. }
  2696. this.form.action = this.uri(), r(), t = t.replace(h, "\\\n"), this.area.value = t.replace(u, "\\n");
  2697. try {
  2698. this.form.submit()
  2699. } catch (t) {}
  2700. this.iframe.attachEvent ? this.iframe.onreadystatechange = function() {
  2701. "complete" === s.iframe.readyState && o()
  2702. } : this.iframe.onload = o
  2703. }
  2704. }).call(n, function() {
  2705. return this
  2706. }())
  2707. }, function(e, n, o) {
  2708. (function(n) {
  2709. function r(t) {
  2710. t && t.forceBase64 && (this.supportsBinary = !1), this.perMessageDeflate = t.perMessageDeflate, this.usingBrowserWebSocket = p && !t.forceNode, this.usingBrowserWebSocket || (f = s), i.call(this, t)
  2711. }
  2712. var s, i = o(26),
  2713. a = o(27),
  2714. c = o(36),
  2715. u = o(37),
  2716. h = o(38),
  2717. l = o(3)("engine.io-client:websocket"),
  2718. p = n.WebSocket || n.MozWebSocket;
  2719. if (void 0 === t) try {
  2720. s = o(41)
  2721. } catch (t) {}
  2722. var f = p;
  2723. f || void 0 !== t || (f = s), e.exports = r, u(r, i), r.prototype.name = "websocket", r.prototype.supportsBinary = !0, r.prototype.doOpen = function() {
  2724. if (this.check()) {
  2725. var t = this.uri(),
  2726. e = {
  2727. agent: this.agent,
  2728. perMessageDeflate: this.perMessageDeflate
  2729. };
  2730. e.pfx = this.pfx, e.key = this.key, e.passphrase = this.passphrase, e.cert = this.cert, e.ca = this.ca, e.ciphers = this.ciphers, e.rejectUnauthorized = this.rejectUnauthorized, this.extraHeaders && (e.headers = this.extraHeaders), this.localAddress && (e.localAddress = this.localAddress);
  2731. try {
  2732. this.ws = this.usingBrowserWebSocket ? new f(t) : new f(t, void 0, e)
  2733. } catch (t) {
  2734. return this.emit("error", t)
  2735. }
  2736. void 0 === this.ws.binaryType && (this.supportsBinary = !1), this.ws.supports && this.ws.supports.binary ? (this.supportsBinary = !0, this.ws.binaryType = "nodebuffer") : this.ws.binaryType = "arraybuffer", this.addEventListeners()
  2737. }
  2738. }, r.prototype.addEventListeners = function() {
  2739. var t = this;
  2740. this.ws.onopen = function() {
  2741. t.onOpen()
  2742. }, this.ws.onclose = function() {
  2743. t.onClose()
  2744. }, this.ws.onmessage = function(e) {
  2745. t.onData(e.data)
  2746. }, this.ws.onerror = function(e) {
  2747. t.onError("websocket error", e)
  2748. }
  2749. }, r.prototype.write = function(t) {
  2750. function e() {
  2751. o.emit("flush"), setTimeout(function() {
  2752. o.writable = !0, o.emit("drain")
  2753. }, 0)
  2754. }
  2755. var o = this;
  2756. this.writable = !1;
  2757. for (var r = t.length, s = 0, i = r; s < i; s++) ! function(t) {
  2758. a.encodePacket(t, o.supportsBinary, function(s) {
  2759. if (!o.usingBrowserWebSocket) {
  2760. var i = {};
  2761. if (t.options && (i.compress = t.options.compress), o.perMessageDeflate) {
  2762. ("string" == typeof s ? n.Buffer.byteLength(s) : s.length) < o.perMessageDeflate.threshold && (i.compress = !1)
  2763. }
  2764. }
  2765. try {
  2766. o.usingBrowserWebSocket ? o.ws.send(s) : o.ws.send(s, i)
  2767. } catch (t) {
  2768. l("websocket closed before onclose event")
  2769. }--r || e()
  2770. })
  2771. }(t[s])
  2772. }, r.prototype.onClose = function() {
  2773. i.prototype.onClose.call(this)
  2774. }, r.prototype.doClose = function() {
  2775. void 0 !== this.ws && this.ws.close()
  2776. }, r.prototype.uri = function() {
  2777. var t = this.query || {},
  2778. e = this.secure ? "wss" : "ws",
  2779. n = "";
  2780. return this.port && ("wss" === e && 443 !== Number(this.port) || "ws" === e && 80 !== Number(this.port)) && (n = ":" + this.port), this.timestampRequests && (t[this.timestampParam] = h()), this.supportsBinary || (t.b64 = 1), t = c.encode(t), t.length && (t = "?" + t), e + "://" + (-1 !== this.hostname.indexOf(":") ? "[" + this.hostname + "]" : this.hostname) + n + this.path + t
  2781. }, r.prototype.check = function() {
  2782. return !(!f || "__initialize" in f && this.name === r.prototype.name)
  2783. }
  2784. }).call(n, function() {
  2785. return this
  2786. }())
  2787. }, function(t, e) {}, function(t, e) {
  2788. var n = [].indexOf;
  2789. t.exports = function(t, e) {
  2790. if (n) return t.indexOf(e);
  2791. for (var o = 0; o < t.length; ++o)
  2792. if (t[o] === e) return o;
  2793. return -1
  2794. }
  2795. }, function(t, e) {
  2796. (function(e) {
  2797. var n = /^[\],:{}\s]*$/,
  2798. o = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  2799. r = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  2800. s = /(?:^|:|,)(?:\s*\[)+/g,
  2801. i = /^\s+/,
  2802. a = /\s+$/;
  2803. t.exports = function(t) {
  2804. return "string" == typeof t && t ? (t = t.replace(i, "").replace(a, ""), e.JSON && JSON.parse ? JSON.parse(t) : n.test(t.replace(o, "@").replace(r, "]").replace(s, "")) ? new Function("return " + t)() : void 0) : null
  2805. }
  2806. }).call(e, function() {
  2807. return this
  2808. }())
  2809. }, function(t, e, n) {
  2810. "use strict";
  2811.  
  2812. function o(t, e, n) {
  2813. this.io = t, this.nsp = e, this.json = this, this.ids = 0, this.acks = {}, this.receiveBuffer = [], this.sendBuffer = [], this.connected = !1, this.disconnected = !0, n && n.query && (this.query = n.query), this.io.autoConnect && this.open()
  2814. }
  2815. var r = n(7),
  2816. s = n(35),
  2817. i = n(45),
  2818. a = n(46),
  2819. c = n(47),
  2820. u = n(3)("socket.io-client:socket"),
  2821. h = n(29);
  2822. t.exports = o;
  2823. var l = {
  2824. connect: 1,
  2825. connect_error: 1,
  2826. connect_timeout: 1,
  2827. connecting: 1,
  2828. disconnect: 1,
  2829. error: 1,
  2830. reconnect: 1,
  2831. reconnect_attempt: 1,
  2832. reconnect_failed: 1,
  2833. reconnect_error: 1,
  2834. reconnecting: 1,
  2835. ping: 1,
  2836. pong: 1
  2837. },
  2838. p = s.prototype.emit;
  2839. s(o.prototype), o.prototype.subEvents = function() {
  2840. if (!this.subs) {
  2841. var t = this.io;
  2842. this.subs = [a(t, "open", c(this, "onopen")), a(t, "packet", c(this, "onpacket")), a(t, "close", c(this, "onclose"))]
  2843. }
  2844. }, o.prototype.open = o.prototype.connect = function() {
  2845. return this.connected ? this : (this.subEvents(), this.io.open(), "open" === this.io.readyState && this.onopen(), this.emit("connecting"), this)
  2846. }, o.prototype.send = function() {
  2847. var t = i(arguments);
  2848. return t.unshift("message"), this.emit.apply(this, t), this
  2849. }, o.prototype.emit = function(t) {
  2850. if (l.hasOwnProperty(t)) return p.apply(this, arguments), this;
  2851. var e = i(arguments),
  2852. n = r.EVENT;
  2853. h(e) && (n = r.BINARY_EVENT);
  2854. var o = {
  2855. type: n,
  2856. data: e
  2857. };
  2858. return o.options = {}, o.options.compress = !this.flags || !1 !== this.flags.compress, "function" == typeof e[e.length - 1] && (u("emitting packet with ack id %d", this.ids), this.acks[this.ids] = e.pop(), o.id = this.ids++), this.connected ? this.packet(o) : this.sendBuffer.push(o), delete this.flags, this
  2859. }, o.prototype.packet = function(t) {
  2860. t.nsp = this.nsp, this.io.packet(t)
  2861. }, o.prototype.onopen = function() {
  2862. u("transport is open - connecting"), "/" !== this.nsp && (this.query ? this.packet({
  2863. type: r.CONNECT,
  2864. query: this.query
  2865. }) : this.packet({
  2866. type: r.CONNECT
  2867. }))
  2868. }, o.prototype.onclose = function(t) {
  2869. u("close (%s)", t), this.connected = !1, this.disconnected = !0, delete this.id, this.emit("disconnect", t)
  2870. }, o.prototype.onpacket = function(t) {
  2871. if (t.nsp === this.nsp) switch (t.type) {
  2872. case r.CONNECT:
  2873. this.onconnect();
  2874. break;
  2875. case r.EVENT:
  2876. case r.BINARY_EVENT:
  2877. this.onevent(t);
  2878. break;
  2879. case r.ACK:
  2880. case r.BINARY_ACK:
  2881. this.onack(t);
  2882. break;
  2883. case r.DISCONNECT:
  2884. this.ondisconnect();
  2885. break;
  2886. case r.ERROR:
  2887. this.emit("error", t.data)
  2888. }
  2889. }, o.prototype.onevent = function(t) {
  2890. var e = t.data || [];
  2891. u("emitting event %j", e), null != t.id && (u("attaching ack callback to event"), e.push(this.ack(t.id))), this.connected ? p.apply(this, e) : this.receiveBuffer.push(e)
  2892. }, o.prototype.ack = function(t) {
  2893. var e = this,
  2894. n = !1;
  2895. return function() {
  2896. if (!n) {
  2897. n = !0;
  2898. var o = i(arguments);
  2899. u("sending ack %j", o);
  2900. var s = h(o) ? r.BINARY_ACK : r.ACK;
  2901. e.packet({
  2902. type: s,
  2903. id: t,
  2904. data: o
  2905. })
  2906. }
  2907. }
  2908. }, o.prototype.onack = function(t) {
  2909. var e = this.acks[t.id];
  2910. "function" == typeof e ? (u("calling ack %s with %j", t.id, t.data), e.apply(this, t.data), delete this.acks[t.id]) : u("bad ack %s", t.id)
  2911. }, o.prototype.onconnect = function() {
  2912. this.connected = !0, this.disconnected = !1, this.emit("connect"), this.emitBuffered()
  2913. }, o.prototype.emitBuffered = function() {
  2914. var t;
  2915. for (t = 0; t < this.receiveBuffer.length; t++) p.apply(this, this.receiveBuffer[t]);
  2916. for (this.receiveBuffer = [], t = 0; t < this.sendBuffer.length; t++) this.packet(this.sendBuffer[t]);
  2917. this.sendBuffer = []
  2918. }, o.prototype.ondisconnect = function() {
  2919. u("server disconnect (%s)", this.nsp), this.destroy(), this.onclose("io server disconnect")
  2920. }, o.prototype.destroy = function() {
  2921. if (this.subs) {
  2922. for (var t = 0; t < this.subs.length; t++) this.subs[t].destroy();
  2923. this.subs = null
  2924. }
  2925. this.io.destroy(this)
  2926. }, o.prototype.close = o.prototype.disconnect = function() {
  2927. return this.connected && (u("performing disconnect (%s)", this.nsp), this.packet({
  2928. type: r.DISCONNECT
  2929. })), this.destroy(), this.connected && this.onclose("io client disconnect"), this
  2930. }, o.prototype.compress = function(t) {
  2931. return this.flags = this.flags || {}, this.flags.compress = t, this
  2932. }
  2933. }, function(t, e) {
  2934. function n(t, e) {
  2935. var n = [];
  2936. e = e || 0;
  2937. for (var o = e || 0; o < t.length; o++) n[o - e] = t[o];
  2938. return n
  2939. }
  2940. t.exports = n
  2941. }, function(t, e) {
  2942. "use strict";
  2943.  
  2944. function n(t, e, n) {
  2945. return t.on(e, n), {
  2946. destroy: function() {
  2947. t.removeListener(e, n)
  2948. }
  2949. }
  2950. }
  2951. t.exports = n
  2952. }, function(t, e) {
  2953. var n = [].slice;
  2954. t.exports = function(t, e) {
  2955. if ("string" == typeof e && (e = t[e]), "function" != typeof e) throw new Error("bind() requires a function");
  2956. var o = n.call(arguments, 2);
  2957. return function() {
  2958. return e.apply(t, o.concat(n.call(arguments)))
  2959. }
  2960. }
  2961. }, function(t, e) {
  2962. function n(t) {
  2963. t = t || {}, this.ms = t.min || 100, this.max = t.max || 1e4, this.factor = t.factor || 2, this.jitter = t.jitter > 0 && t.jitter <= 1 ? t.jitter : 0, this.attempts = 0
  2964. }
  2965. t.exports = n, n.prototype.duration = function() {
  2966. var t = this.ms * Math.pow(this.factor, this.attempts++);
  2967. if (this.jitter) {
  2968. var e = Math.random(),
  2969. n = Math.floor(e * this.jitter * t);
  2970. t = 0 == (1 & Math.floor(10 * e)) ? t - n : t + n
  2971. }
  2972. return 0 | Math.min(t, this.max)
  2973. }, n.prototype.reset = function() {
  2974. this.attempts = 0
  2975. }, n.prototype.setMin = function(t) {
  2976. this.ms = t
  2977. }, n.prototype.setMax = function(t) {
  2978. this.max = t
  2979. }, n.prototype.setJitter = function(t) {
  2980. this.jitter = t
  2981. }
  2982. }])
  2983. });
  2984. const U = "#56CE27",
  2985. N = "#CCCC00",
  2986. _ = "#3975CE",
  2987. O = "#56CE27",
  2988. j = "#CE4F0A",
  2989. G = 500,
  2990. q = 500,
  2991. W = 18,
  2992. H = 31,
  2993. F = 24,
  2994. z = [W, H, F],
  2995. J = {
  2996. AG: "Everybody guessed the word!",
  2997. DL: "The drawer left the game!",
  2998. TP: "Time is up!",
  2999. TD: "The drawer received too many thumbs down!",
  3000. VK: "The drawer has been kicked!"
  3001. },
  3002. X = 1,
  3003. Y = 4;
  3004. var $ = function(t, e) {
  3005. this.url = e, this.buffer = null, this.loaded = !1;
  3006. var n = this,
  3007. o = new XMLHttpRequest;
  3008. o.open("GET", e, !0), o.responseType = "arraybuffer", o.onload = function() {
  3009. t.context.decodeAudioData(o.response, function(t) {
  3010. n.buffer = t, n.loaded = !0
  3011. }, function(t) {
  3012. console.log("Failed loading audio from url '" + e + "'")
  3013. })
  3014. }, o.send()
  3015. },
  3016. K = function() {
  3017. this.context = null, this.sounds = new Map, this.mute = !1, "true" === o.getItem("audioMute") && this.setMute(!0), t.addEventListener("load", this.load.bind(this), !1)
  3018. };
  3019. K.prototype.setMute = function(t) {
  3020. this.mute = t, this.mute ? n("#audio").css("background-image", "url(res/audio_off.gif") : n("#audio").css("background-image", "url(res/audio.gif"), o.setItem("audioMute", this.mute.toString())
  3021. }, K.prototype.addSound = function(t, e) {
  3022. this.sounds.set(e, new $(this, t))
  3023. }, K.prototype.loadSounds = function() {
  3024. this.addSound("res/sounds/roundStart.ogg", "roundStart"), this.addSound("res/sounds/roundEndSuccess.ogg", "roundEndSuccess"), this.addSound("res/sounds/roundEndFailure.ogg", "roundEndFailure"), this.addSound("res/sounds/join.ogg", "playerJoin"), this.addSound("res/sounds/leave.ogg", "playerLeave"), this.addSound("res/sounds/playerGuessed.ogg", "playerGuessed"), this.addSound("res/sounds/tick.ogg", "tick")
  3025. }, K.prototype.playSound = function(t) {
  3026. if (!this.mute && this.sounds.has(t)) {
  3027. var e = this.sounds.get(t);
  3028. if (e.loaded) {
  3029. var n = this.context.createBufferSource();
  3030. n.buffer = e.buffer, n.connect(this.context.destination), n.start(0)
  3031. }
  3032. }
  3033. }, K.prototype.load = function() {
  3034. try {
  3035. t.AudioContext = t.AudioContext || t.webkitAudioContext, this.context = new AudioContext
  3036. } catch (t) {
  3037. return void console.log("Error creating AudioContext.")
  3038. }
  3039. this.loadSounds()
  3040. };
  3041. var V = function(t) {
  3042. this.canvas = t, this.canvasCtx = this.canvas[0].getContext("2d"), this.canvasCtx.mozImageSmoothingEnabled = !1, this.canvasCtx.webkitImageSmoothingEnabled = !1, this.canvasCtx.msImageSmoothingEnabled = !1, this.canvasCtx.imageSmoothingEnabled = !1, this.mouseposPrev = {
  3043. x: 0,
  3044. y: 0
  3045. }, this.mousepos = {
  3046. x: 0,
  3047. y: 0
  3048. }, this.drawCommands = [], this.drawCommandsReceived = [], this.brush = new Z;
  3049. var e = this;
  3050. setInterval(function() {
  3051. e.drawCommandsReceived.length > 0 && e.performDrawCommand(e.drawCommandsReceived.shift())
  3052. }, 3), this.clear()
  3053. };
  3054. V.prototype.updateMousePosition = function(t, e, n) {
  3055. var o = this.canvas[0].getBoundingClientRect(),
  3056. r = this.canvas[0].width,
  3057. s = this.canvas[0].height,
  3058. i = o.width,
  3059. a = o.height,
  3060. c = (t - o.left) / i,
  3061. u = (e - o.top) / a;
  3062. n ? (this.mouseposPrev.x = this.mousepos.x = Math.floor(c * r), this.mouseposPrev.y = this.mousepos.y = Math.floor(u * s)) : (this.mouseposPrev.x = this.mousepos.x, this.mouseposPrev.y = this.mousepos.y, this.mousepos.x = Math.floor(c * r), this.mousepos.y = Math.floor(u * s))
  3063. }, V.prototype.addDrawCommandReceived = function(t) {
  3064. this.drawCommandsReceived.push(t)
  3065. }, V.prototype.addDrawCommand = function(t) {
  3066. this.drawCommands.push(t)
  3067. }, V.prototype.createDrawCommandLine = function(t, e, n, o, r, s) {
  3068. return [0, t, e, n, o, r, s]
  3069. }, V.prototype.createDrawCommandErase = function(t, e, n, o, r) {
  3070. return [1, t, e, n, o, r]
  3071. }, V.prototype.createDrawCommandFill = function(t, e, n) {
  3072. return [2, t, e, n]
  3073. }, V.prototype.performDrawCommand = function(t) {
  3074. switch (t[0]) {
  3075. case 0:
  3076. var e = Math.floor(t[2]);
  3077. e < this.brush.thicknessMin && (e = this.brush.thicknessMin), e > this.brush.thicknessMax && (e = this.brush.thicknessMax);
  3078. var n = Math.floor(Math.ceil(e / 2)),
  3079. o = i(Math.floor(t[3]), -n, this.canvas[0].width + n),
  3080. r = i(Math.floor(t[4]), -n, this.canvas[0].height + n),
  3081. s = i(Math.floor(t[5]), -n, this.canvas[0].width + n),
  3082. c = i(Math.floor(t[6]), -n, this.canvas[0].height + n),
  3083. u = a(this.brush.getColor(t[1]));
  3084. this.plotLine(o, r, s, c, e, u.r, u.g, u.b);
  3085. break;
  3086. case 1:
  3087. var e = Math.floor(t[1]);
  3088. e < this.brush.thicknessMin && (e = this.brush.thicknessMin), e > this.brush.thicknessMax && (e = this.brush.thicknessMax);
  3089. var n = Math.floor(Math.ceil(e / 2)),
  3090. o = i(Math.floor(t[2]), -n, this.canvas[0].width + n),
  3091. r = i(Math.floor(t[3]), -n, this.canvas[0].height + n),
  3092. s = i(Math.floor(t[4]), -n, this.canvas[0].width + n),
  3093. c = i(Math.floor(t[5]), -n, this.canvas[0].height + n);
  3094. this.plotLine(o, r, s, c, e, 255, 255, 255);
  3095. break;
  3096. case 2:
  3097. var u = a(this.brush.getColor(t[1])),
  3098. h = i(Math.floor(t[2]), 0, this.canvas[0].width),
  3099. l = i(Math.floor(t[3]), 0, this.canvas[0].height);
  3100. this.floodFill(h, l, u.r, u.g, u.b)
  3101. }
  3102. }, V.prototype.getImageData = function(t, e, n, o) {
  3103. var r = Math.min(t, n),
  3104. s = Math.min(e, o),
  3105. i = Math.abs(t - n),
  3106. a = Math.abs(e - o);
  3107. return this.canvasCtx.getImageData(r, s, i, a)
  3108. }, V.prototype.setPixel = function(t, e, n, o, r) {
  3109. e >= 0 && e < t.data.length && (t.data[e] = n, t.data[e + 1] = o, t.data[e + 2] = r, t.data[e + 3] = 255)
  3110. }, V.prototype.getPixel = function(t, e, n) {
  3111. var o = 4 * (n * t.width + e);
  3112. return o >= 0 && o < t.data.length ? [t.data[o], t.data[o + 1], t.data[o + 2]] : [0, 0, 0]
  3113. }, V.prototype.floodFill = function(t, e, n, o, r) {
  3114. var s = this.canvasCtx.getImageData(0, 0, this.canvas[0].width, this.canvas[0].height),
  3115. i = [
  3116. [t, e]
  3117. ],
  3118. a = this.getPixel(s, t, e);
  3119. if (n != a[0] || o != a[1] || r != a[2]) {
  3120. for (var c = function(t) {
  3121. var e = s.data[t],
  3122. i = s.data[t + 1],
  3123. c = s.data[t + 2];
  3124. if (e == n && i == o && c == r) return !1;
  3125. var u = Math.abs(e - a[0]),
  3126. h = Math.abs(i - a[1]),
  3127. l = Math.abs(c - a[2]);
  3128. return u < 1 && h < 1 && l < 1
  3129. }, u = s.height, h = s.width; i.length;) {
  3130. var l, p, f, d, y, m;
  3131. for (l = i.pop(), p = l[0], f = l[1], d = 4 * (f * h + p); f-- >= 0 && c(d);) d -= 4 * h;
  3132. for (d += 4 * h, ++f, y = !1, m = !1; f++ < u - 1 && c(d);) this.setPixel(s, d, n, o, r), p > 0 && (c(d - 4) ? y || (i.push([p - 1, f]), y = !0) : y && (y = !1)), p < h - 1 && (c(d + 4) ? m || (i.push([p + 1, f]), m = !0) : m && (m = !1)), d += 4 * h
  3133. }
  3134. this.canvasCtx.putImageData(s, 0, 0)
  3135. }
  3136. }, V.prototype.plotLineOld = function(t, e, n, o, r, s) {
  3137. this.canvasCtx.fillStyle = this.canvasCtx.strokeStyle = this.brush.getColor(s), this.canvasCtx.lineWidth = r, this.canvasCtx.lineJoin = this.canvasCtx.lineCap = "round", this.canvasCtx.beginPath(), this.canvasCtx.moveTo(t, e), this.canvasCtx.lineTo(n, o), this.canvasCtx.closePath(), this.canvasCtx.stroke()
  3138. }, V.prototype.plotLine = function(t, e, n, o, r, s, i, a) {
  3139. var c = Math.floor(r / 2),
  3140. u = c * c,
  3141. h = Math.min(t, n) - c,
  3142. l = Math.min(e, o) - c,
  3143. p = Math.max(t, n) + c,
  3144. f = Math.max(e, o) + c;
  3145. t -= h, e -= l, n -= h, o -= l;
  3146. var d = this.canvasCtx.getImageData(h, l, p - h, f - l),
  3147. y = function(t, e) {
  3148. for (var n = -c; n <= c; n++)
  3149. for (var o = -c; o <= c; o++)
  3150. if (n * n + o * o < u) {
  3151. var r = 4 * ((e + o) * d.width + t + n);
  3152. r >= 0 && r < d.data.length && (d.data[r] = s, d.data[r + 1] = i, d.data[r + 2] = a, d.data[r + 3] = 255)
  3153. }
  3154. };
  3155. if (t == n && e == o) y(t, e);
  3156. else {
  3157. y(t, e), y(n, o);
  3158. var m = Math.abs(n - t),
  3159. g = Math.abs(o - e),
  3160. v = t < n ? 1 : -1,
  3161. b = e < o ? 1 : -1,
  3162. w = m - g;
  3163. for (Math.floor(Math.max(0, c - 10) / 5); t != n || e != o;) {
  3164. var k = w << 1;
  3165. k > -g && (w -= g, t += v), k < m && (w += m, e += b), y(t, e)
  3166. }
  3167. }
  3168. this.canvasCtx.putImageData(d, h, l)
  3169. }, V.prototype.clear = function() {
  3170. this.drawCommands = [], this.drawCommandsReceived = [], this.canvasCtx.fillStyle = "#FFF", this.canvasCtx.fillRect(0, 0, this.canvas[0].width, this.canvas[0].height)
  3171. }, V.prototype.setDrawing = function(t) {
  3172. t ? (this.brush.show(), n(".containerToolbar").show()) : (this.brush.hide(), n(".containerToolbar").hide())
  3173. };
  3174. var Z = function() {
  3175. this.down = !1, this.tool = "pen", this.toolUsed = !1, this.colorIndex = 0, this.thickness = 0, this.thicknessMin = 4, this.thicknessMax = 40, this.brushCanvas = e.createElement("canvas"), this.brushCanvas.width = this.thicknessMax, this.brushCanvas.height = this.thicknessMax, this.brushCanvasCtx = this.brushCanvas.getContext("2d"), this.setTool("pen"), this.setThickness(12), this.setColor(1)
  3176. };
  3177. Z.prototype.hide = function() {
  3178. n("#cursor").hide()
  3179. }, Z.prototype.show = function() {
  3180. n("#cursor").show()
  3181. }, Z.prototype.setDown = function(t) {
  3182. this.down = t, this.down || (this.toolUsed = !1), n("#cursor .tool").css("top", this.down ? 0 : -8)
  3183. }, Z.prototype.setTool = function(t) {
  3184. this.tool = t, n(".containerTools .tool").removeClass("toolActive"), n(".containerTools .tool[data-tool='" + t + "']").addClass("toolActive"), this.updateBrushCursor()
  3185. }, Z.prototype.setColor = function(t) {
  3186. this.colorIndex = t, n(".colorPreview").css("background-color", this.getColor(t)), this.updateBrushCursor()
  3187. }, Z.prototype.getColor = function(t) {
  3188. return n(".colorItem[data-color='" + t + "']").css("background-color")
  3189. }, Z.prototype.setThickness = function(t) {
  3190. this.thickness = t, this.thickness < this.thicknessMin && (this.thickness = this.thicknessMin), this.thickness > this.thicknessMax && (this.thickness = this.thicknessMax), this.updateBrushCursor()
  3191. }, Z.prototype.updateBrushCursor = function() {
  3192. switch (this.tool) {
  3193. case "pen":
  3194. case "erase":
  3195. if (this.thickness <= 0) return;
  3196. this.brushCanvasCtx.clearRect(0, 0, this.thicknessMax, this.thicknessMax), this.brushCanvasCtx.fillStyle = "erase" == this.tool ? "#FFF" : this.getColor(this.colorIndex), this.brushCanvasCtx.beginPath(), this.brushCanvasCtx.arc(this.thicknessMax / 2, this.thicknessMax / 2, this.thickness / 2 - 1, 0, 2 * Math.PI), this.brushCanvasCtx.fill(), this.brushCanvasCtx.strokeStyle = "#FFF", this.brushCanvasCtx.beginPath(), this.brushCanvasCtx.arc(this.thicknessMax / 2, this.thicknessMax / 2, this.thickness / 2 - 1, 0, 2 * Math.PI), this.brushCanvasCtx.stroke(), this.brushCanvasCtx.strokeStyle = "#000", this.brushCanvasCtx.beginPath(), this.brushCanvasCtx.arc(this.thicknessMax / 2, this.thicknessMax / 2, this.thickness / 2, 0, 2 * Math.PI), this.brushCanvasCtx.stroke();
  3197. var t = this.brushCanvas.toDataURL(),
  3198. e = this.thicknessMax / 2;
  3199. n("#canvasGame").css("cursor", "url(" + t + ")" + e + " " + e + ", default");
  3200. break;
  3201. case "fill":
  3202. n("#canvasGame").css("cursor", "url(res/fill_graphic.png) 7 38, default")
  3203. }
  3204. };
  3205. var Q = function(t) {
  3206. this.name = t.name, this.key = t.key, this.language = t.language, this.slots = t.slots, this.drawingID = t.drawingID, this.myID = t.myID, this.ownerID = t.ownerID, this.round = t.round, this.roundMax = t.roundMax, this.time = t.time, this.timeMax = t.timeMax, this.useCustomWordsExclusive = t.useCustomWordsExclusive, this.inGame = t.inGame, this.players = new Map, this.containerGame = n("#containerGamePlayers"), this.containerLobby = n("#containerLobbyPlayers"), this.chatClear(), this.containerGamePlayerClear(), this.containerLobbyPlayerClear();
  3207. for (var e = 0; e < t.players.length; e++) this.addPlayer(t.players[e]);
  3208. n("#invite").val("https://skribbl.io/?" + this.key), n("#screenLobby .lobbySettings .lobbyName").text(this.name), this.containerLobbyUpdateRounds(), this.containerLobbyUpdateDrawTime(), this.containerLobbyUpdateUseCustomWordsExclusive(), this.containerLobbyUpdateLanguage(), this.containerLobbyPlayersUpdateOwner(), this.containerGamePlayersUpdateDrawing(), this.containerGamePlayersUpdateGuessed(), this.containerGamePlayersUpdateOwner(), this.updateRanks(), this.updateRound(), this.chatEnable()
  3209. };
  3210. Q.prototype.updatePlayerAvatars = function() {
  3211. var t = this;
  3212. this.players.forEach(function(e, n, o) {
  3213. s(t.containerGamePlayerGet(player), player.avatar, player.id == t.ownerID)
  3214. })
  3215. }, Q.prototype.reset = function() {
  3216. this.round = 0, this.drawingID = -1;
  3217. var t = this;
  3218. this.players.forEach(function(e, n, o) {
  3219. e.guessedWord = !1, e.score = 0, e.thumbsUp = 0, e.thumbsDown = 0, t.containerGamePlayerUpdateScore(e)
  3220. }), this.containerGamePlayersUpdateDrawing(), this.containerGamePlayersUpdateGuessed(), this.containerGamePlayersUpdateOwner(), this.updateRanks(), this.updateRound(), this.containerLobbyPlayersUpdateOwner(), this.chatEnable()
  3221. }, Q.prototype.checkDrawing = function() {
  3222. return this.drawingID == this.myID
  3223. }, Q.prototype.addPlayer = function(t) {
  3224. this.players.set(t.id, t), this.containerGamePlayerAdd(t), this.containerLobbyPlayerAdd(t), this.updateRanks()
  3225. }, Q.prototype.removePlayer = function(t) {
  3226. this.containerGamePlayerRemove(t), this.containerLobbyPlayerRemove(t), this.players.delete(t.id), this.updateRanks()
  3227. }, Q.prototype.playersResetGuessedWord = function() {
  3228. this.players.forEach(function(t, e, n) {
  3229. t.guessedWord = !1
  3230. }), this.containerGamePlayersUpdateGuessed()
  3231. }, Q.prototype.setPlayerOwner = function(t) {
  3232. this.ownerID = t.id, this.containerGamePlayersUpdateOwner(), this.containerLobbyPlayersUpdateOwner()
  3233. }, Q.prototype.setPlayerDrawing = function(t) {
  3234. this.drawingID = t, this.containerGamePlayersUpdateDrawing()
  3235. }, Q.prototype.setPlayerGuessed = function(t) {
  3236. t.guessedWord = !0, this.containerGamePlayersUpdateGuessed()
  3237. }, Q.prototype.setPlayerScore = function(t, e, n) {
  3238. t.score = e, t.scoreGuessed = n, this.containerGamePlayerUpdateScore(t)
  3239. }, Q.prototype.setLanguage = function(t) {
  3240. this.language = t, this.containerLobbyUpdateLanguage()
  3241. }, Q.prototype.setRounds = function(t) {
  3242. this.roundMax = t, this.updateRound(), this.containerLobbyUpdateRounds()
  3243. }, Q.prototype.setCustomWordsExclusive = function(t) {
  3244. this.useCustomWordsExclusive = !!t, this.containerLobbyUpdateUseCustomWordsExclusive()
  3245. }, Q.prototype.setDrawTime = function(t) {
  3246. this.timeMax = t, this.containerLobbyUpdateDrawTime()
  3247. }, Q.prototype.updateRound = function() {
  3248. n("#round").text("Round " + (this.round + 1) + " of " + this.roundMax)
  3249. }, Q.prototype.updateRanks = function() {
  3250. var t = [];
  3251. this.players.forEach(function(e, n, o) {
  3252. t.push(e)
  3253. }), t.sort(function(t, e) {
  3254. return e.score - t.score
  3255. });
  3256. for (var e = 1, n = 0; n < t.length; n++) t[n].rank = e, this.containerGamePlayerUpdateRank(t[n], e), n < t.length - 1 && t[n].score > t[n + 1].score && e++
  3257. }, Q.prototype.containerGamePlayerClear = function() {
  3258. this.containerGame.empty()
  3259. }, Q.prototype.containerGamePlayerGet = function(t) {
  3260. return this.containerGame.find("#player" + t.id)
  3261. }, Q.prototype.containerGamePlayerAdd = function(t) {
  3262. var e = n("#gamePlayerDummy").clone();
  3263. e.attr("id", "player" + t.id), e.find(".name").text(t.name + (t.id == this.myID ? " (You)" : "")), t.id == this.myID && e.find(".name").css("color", "blue"), e.find(".drawing").hide(), this.containerGame.append(e), this.containerGamePlayerUpdateScore(t), e.show(), s(e, t.avatar, t.id == this.ownerID, 1)
  3264. }, Q.prototype.containerGamePlayerRemove = function(t) {
  3265. this.containerGamePlayerGet(t).remove()
  3266. }, Q.prototype.containerGamePlayersUpdateGuessed = function() {
  3267. var t = this;
  3268. this.players.forEach(function(e, n, o) {
  3269. var r = t.containerGamePlayerGet(e);
  3270. e.guessedWord ? r.addClass("guessedWord") : r.removeClass("guessedWord")
  3271. })
  3272. }, Q.prototype.containerGamePlayersUpdateDrawing = function() {
  3273. var t = this;
  3274. this.players.forEach(function(e, n, o) {
  3275. var r = t.containerGamePlayerGet(e).find(".drawing");
  3276. e.id === t.drawingID ? r.show() : r.hide()
  3277. })
  3278. }, Q.prototype.containerGamePlayersUpdateOwner = function() {
  3279. var t = this;
  3280. this.players.forEach(function(e, n, o) {
  3281. var r = t.containerGamePlayerGet(e).find(".owner");
  3282. e.id === t.ownerID ? r.show() : r.hide()
  3283. })
  3284. }, Q.prototype.containerGamePlayerUpdateScore = function(t) {
  3285. this.containerGamePlayerGet(t).find(".score").text("Points: " + t.score)
  3286. }, Q.prototype.containerGamePlayerUpdateRank = function(t, e) {
  3287. this.containerGamePlayerGet(t).find(".rank").text("#" + e)
  3288. }, Q.prototype.containerLobbyPlayerGet = function(t) {
  3289. return this.containerLobby.find("#player" + t.id)
  3290. }, Q.prototype.containerLobbyPlayerAdd = function(t) {
  3291. var e = n("#lobbyPlayerDummy").clone();
  3292. e.attr("id", "player" + t.id), e.find(".name").text(t.name), e.find(".owner").hide(), t.id == this.myID && e.find(".you").show(), e.show(), this.containerLobby.append(e), s(e, t.avatar, t.id == this.ownerID, 2)
  3293. }, Q.prototype.containerLobbyPlayerRemove = function(t) {
  3294. this.containerLobbyPlayerGet(t).remove()
  3295. }, Q.prototype.containerLobbyPlayersUpdateOwner = function() {
  3296. var t = this;
  3297. this.players.forEach(function(e, n, o) {
  3298. var r = t.containerLobbyPlayerGet(e).find(".owner");
  3299. e.id === t.ownerID ? r.show() : r.hide()
  3300. });
  3301. var e = this.ownerID != this.myID;
  3302. n("#lobbySetRounds").prop("disabled", e), n("#lobbySetDrawTime").prop("disabled", e), n("#lobbySetCustomWords").prop("disabled", e), n("#lobbyCustomWordsExclusive").prop("disabled", e), n("#lobbySetLanguage").prop("disabled", e), n("#buttonLobbyPlay").prop("disabled", e)
  3303. }, Q.prototype.containerLobbyPlayerClear = function() {
  3304. this.containerLobby.empty()
  3305. }, Q.prototype.containerLobbyUpdateRounds = function() {
  3306. n("#lobbySetRounds").val(this.roundMax)
  3307. }, Q.prototype.containerLobbyUpdateDrawTime = function() {
  3308. n("#lobbySetDrawTime").val(this.timeMax)
  3309. }, Q.prototype.containerLobbyUpdateUseCustomWordsExclusive = function() {
  3310. n("#lobbyCustomWordsExclusive").attr("checked", !!this.useCustomWordsExclusive)
  3311. }, Q.prototype.containerLobbyUpdateLanguage = function() {
  3312. var t = P(this.language);
  3313. n("#lobbySetLanguage").val(t)
  3314. }, Q.prototype.playerMessage = function(t, e) {
  3315. this.playerMessageHandle(t);
  3316. var n = this.containerGamePlayerGet(t).find(".message");
  3317. n.find(".text").show(), n.find(".text").text(e)
  3318. }, Q.prototype.playerRate = function(t, e) {
  3319. this.playerMessageHandle(t);
  3320. var n = this.containerGamePlayerGet(t).find(".message");
  3321. e > 0 ? n.find(".iconThumbsUp").show() : n.find(".iconThumbsDown").show()
  3322. }, Q.prototype.playerMessageHandle = function(t) {
  3323. var e = this.containerGamePlayerGet(t).find(".message");
  3324. e.find(".content").children().hide(), e.stop(), e.css("opacity", "1.0"), e.show(), t._previousHandle && clearTimeout(t._previousHandle), t._previousHandle = setTimeout(function() {
  3325. e.animate({
  3326. opacity: "0"
  3327. }, 500, function() {
  3328. e.hide()
  3329. })
  3330. }, 1500)
  3331. }, Q.prototype.chatClear = function() {
  3332. n("#boxMessages").empty()
  3333. }, Q.prototype.chatAddMsg = function(t, e, o) {
  3334. var r = n("#boxMessages"),
  3335. s = Math.abs(r[0].scrollTop - (r[0].scrollHeight - r.height())),
  3336. i = s < 10,
  3337. a = n("<p></p>");
  3338. if (a.css("color", o), a.appendTo(r), t) {
  3339. n("<b/>", {
  3340. text: t.name + ": "
  3341. }).appendTo(a), this.playerMessage(t, e)
  3342. } else a.css("font-weight", "bold");
  3343. n("<span/>", {
  3344. text: e
  3345. }).appendTo(a), i && r.scrollTop(r[0].scrollHeight)
  3346. }, Q.prototype.chatDisable = function() {}, Q.prototype.chatEnable = function() {};
  3347. var tt = function(t, e) {
  3348. this.element = t, this.logo = e, this.onshow = null, this.onhide = null
  3349. };
  3350. tt.prototype.show = function() {
  3351. this.element.show(), this.onshow && this.onshow()
  3352. }, tt.prototype.hide = function() {
  3353. this.element.hide(), this.onhide && this.onhide()
  3354. };
  3355. var et = function() {
  3356. this.screens = {
  3357. load: new tt(n("#screenLoading"), 0),
  3358. login: new tt(n("#screenLogin"), 2),
  3359. lobby: new tt(n("#screenLobby"), 1),
  3360. game: new tt(n("#screenGame"), 1)
  3361. }, this.screenCurrent = null
  3362. };
  3363. et.prototype.goto = function(t) {
  3364. this.screenCurrent && this.screens[this.screenCurrent].hide(), this.screenCurrent = t, this.screens[this.screenCurrent].show(), this.screens[this.screenCurrent].logo > 0 ? this.showLogo(this.screens[this.screenCurrent].logo) : this.hideLogo()
  3365. }, et.prototype.hideLogo = function() {
  3366. n("#containerLogoBig").hide(), n("#containerLogoSmall").hide()
  3367. }, et.prototype.showLogo = function(t) {
  3368. switch (this.hideLogo(), t) {
  3369. case 1:
  3370. n("#containerLogoSmall").show();
  3371. break;
  3372. case 2:
  3373. n("#containerLogoBig").show()
  3374. }
  3375. };
  3376. var nt = t.location != t.parent.location ? e.referrer : e.location.href,
  3377. ot = function(t, e) {
  3378. return -1 !== t.indexOf(e)
  3379. };
  3380. (ot(nt, "skribbl-io.com") || ot(nt, "skribblio.com") || ot(nt, "skribbl-io.org")) && (t.top.location.href = "https://www.skribbl.io"), t.onresize = function(o) {
  3381. var r = Math.max(e.documentElement.clientWidth, t.innerWidth || 0),
  3382. s = Math.max(e.documentElement.clientHeight, t.innerHeight || 0);
  3383. n("html").css({
  3384. width: r,
  3385. height: s
  3386. }), n("body").css({
  3387. width: r,
  3388. height: s
  3389. })
  3390. }, n(function() {
  3391. n('[data-toggle="tooltip"]').tooltip()
  3392. });
  3393. var rt = null,
  3394. st = null,
  3395. it = new K,
  3396. at = new et,
  3397. ct = new V(n("#canvasGame")),
  3398. ut = new Array,
  3399. ht = !1,
  3400. lt = !1;
  3401. ct.setDrawing(!1), at.goto("login");
  3402. var pt = !1;
  3403. at.screens.game.onshow = function() {
  3404. pt || (pt = !0, (adsbygoogle = t.adsbygoogle || []).push({}))
  3405. }, n("#audio").on("click", function() {
  3406. it.setMute(!it.mute)
  3407. }),
  3408. function() {
  3409. for (var t = n("#logoAvatarDummy"), e = n("#logoAvatarContainer"), o = Math.round(8 * Math.random()), r = 0; r < 8; r++) {
  3410. var i = T(t);
  3411. e.append(i);
  3412. var a = [0, 0, 0, 0];
  3413. a[0] = r, a[1] = Math.round(100 * Math.random()) % H, a[2] = Math.round(100 * Math.random()) % F, a[3] = 1e3 * Math.random() < 70 ? Math.round(1 * Math.random()) : -1, s(i, a, r == o, 1)
  3414. }
  3415. }(), n("#inputName").change(function() {
  3416. o.setItem("name", n("#inputName").val())
  3417. }), null != o.getItem("name") && n("#inputName").val(o.getItem("name")), n("#loginLanguage").change(function() {
  3418. o.setItem("lang", n("#loginLanguage").val())
  3419. }), null != o.getItem("lang") && n("#loginLanguage").val(o.getItem("lang")), loginAvatarData = function() {
  3420. var t = o.getItem("avatar");
  3421. return t ? t = JSON.parse(t) : (t = [Math.round(Math.random() * z[0]), Math.round(Math.random() * z[1]), Math.round(Math.random() * z[2]), -1], o.setItem("avatar", JSON.stringify(t))), t
  3422. }(), n("#buttonAvatarCustomizerRandomize").on("click", function() {
  3423. return loginAvatarData[0] = Math.floor(Math.random() * z[0]), loginAvatarData[1] = Math.floor(Math.random() * z[1]), loginAvatarData[2] = Math.floor(Math.random() * z[2]), c(), s(n("#loginAvatar"), loginAvatarData, !1, 2), !1
  3424. }), s(n("#loginAvatar"), loginAvatarData, !1, 2), n("#loginAvatarArrowsLeft .avatarArrowLeft").on("click", function() {
  3425. var t = parseInt(n(this).data("avatarindex"));
  3426. u(t, loginAvatarData[t] - 1)
  3427. }), n("#loginAvatarArrowsLeft .avatarArrowRight").on("click", function() {
  3428. var t = parseInt(n(this).data("avatarindex"));
  3429. u(t, loginAvatarData[t] + 1)
  3430. }), n(e).ready(function() {
  3431. function e() {
  3432. r = 0
  3433. }
  3434.  
  3435. function o() {
  3436. if (rt) {
  3437. r++, 300 == r && h(), r >= 307 && t.location.reload(!0)
  3438. }
  3439. }
  3440. var r = 0;
  3441. setInterval(o, 1e3);
  3442. n(this).mousemove(e), n(this).keypress(e), n(this).on("mousedown", e), n(this).on("touchmove", e)
  3443. }), setInterval(l, 50), n("#rateDrawing .thumbsUp").on("click", function() {
  3444. st && st.emit("rateDrawing", 1), f()
  3445. }), n("#rateDrawing .thumbsDown").on("click", function() {
  3446. st && st.emit("rateDrawing", 0), f()
  3447. }), f(), y(), n("#votekickCurrentplayer").on("click", m), n("#formLogin").submit(function(t) {
  3448. t.preventDefault(), lt = !1, g()
  3449. }), n("#buttonLoginCreatePrivate").on("click", function() {
  3450. lt = !0, g()
  3451. }),
  3452. function(t, n) {
  3453. var o = e.head || e.getElementsByTagName("head")[0],
  3454. r = e.createElement("script"),
  3455. s = !0;
  3456. r.async = "async", r.type = "text/javascript", r.charset = "UTF-8", r.src = t, r.onload = r.onreadystatechange = function() {
  3457. !s || r.readyState && !/loaded|complete/.test(r.readyState) || (s = !1, n(), r.onload = r.onreadystatechange = null)
  3458. }, o.appendChild(r)
  3459. }("//api.adinplay.com/libs/aiptag/pub/SKR/skribbl.io/tag.min.js", v);
  3460. var ft = null,
  3461. dt = 0;
  3462. D(80), n("#lobbySetLanguage").on("change", function() {
  3463. st && rt.myID == rt.ownerID && st.emit("lobbySetLanguage", n(this).val())
  3464. }), n("#lobbySetRounds").on("change", function() {
  3465. st && rt.myID == rt.ownerID && st.emit("lobbySetRounds", n(this).val())
  3466. }), n("#lobbySetDrawTime").on("change", function() {
  3467. st && rt.myID == rt.ownerID && st.emit("lobbySetDrawTime", n(this).val())
  3468. }), n("#lobbyCustomWordsExclusive:checkbox").change(function() {
  3469. if (st && rt.myID == rt.ownerID) {
  3470. var t = this.checked;
  3471. st.emit("lobbySetCustomWordsExclusive", t)
  3472. }
  3473. }), n("#inviteCopyButton").on("click", function() {
  3474. e.querySelector("#invite").select();
  3475. try {
  3476. e.execCommand("copy")
  3477. } catch (t) {}
  3478. }), n("#buttonJoinRandomLobby").on("click", function() {
  3479. at.goto("load"), st.emit("joinRandom")
  3480. }), n("#buttonLobbyLeave").on("click", S), n("#buttonGameLeave").on("click", S), n("#buttonLobbyPlay").on("click", function() {
  3481. st && rt.myID == rt.ownerID && st.emit("lobbyGameStart", n("#lobbySetCustomWords").val())
  3482. }), n("#formChat").submit(function(t) {
  3483. var e = n("#inputChat"),
  3484. o = e.val();
  3485. return o && (st ? st.emit("chat", o) : rt.chatAddMsg(rt.players.get(rt.myID), o, "#000"), e.val("")), !1
  3486. }), n("#buttonOpenLobbyCreation").on("click", function() {
  3487. n("#modalCreateLobby").modal("show")
  3488. }), n("#buttonLobbyCreate").on("click", function() {
  3489. var t = {
  3490. name: n("#lobbyCreateName").val(),
  3491. private: n("#lobbyCreatePrivate").prop("checked")
  3492. };
  3493. st.emit("lobbyCreate", t), n("#modalCreateLobby").modal("hide")
  3494. }), n("#buttonRefreshLobbies").on("click", function() {
  3495. st.emit("requestLobbies")
  3496. }), ct.canvas.on("mousewheel DOMMouseScroll", function(t) {
  3497. t.preventDefault();
  3498. var e = t.originalEvent.wheelDelta > 0 || t.originalEvent.detail < 0 ? 1 : -1;
  3499. ct.brush.setThickness(ct.brush.thickness + 6 * e)
  3500. }), n(e).on("mousemove", function(t) {
  3501. rt && rt.checkDrawing() && M(t.clientX, t.clientY, !1)
  3502. }), n(e).keypress(function(t) {
  3503. if (rt && rt.checkDrawing() && t !== r && t.key !== r) switch (t.key.toUpperCase()) {
  3504. case "B":
  3505. ct.brush.setTool("pen");
  3506. break;
  3507. case "E":
  3508. ct.brush.setTool("erase");
  3509. break;
  3510. case "F":
  3511. ct.brush.setTool("fill")
  3512. }
  3513. }), ct.canvas.on("mousedown", function(t) {
  3514. switch (t.preventDefault(), t.button) {
  3515. case 0:
  3516. ct.brush.down || (ct.brush.setDown(!0), M(t.clientX, t.clientY, !0))
  3517. }
  3518. });
  3519. var yt = null;
  3520. ct.canvas.on("touchstart", function(t) {
  3521. t.preventDefault();
  3522. var e = t.changedTouches;
  3523. e.length > 0 && null == yt && (yt = e[0].identitfier, ct.brush.setDown(!0), M(e[0].clientX, e[0].clientY, !0))
  3524. }), ct.canvas.on("touchend", function(t) {
  3525. t.preventDefault(), yt = null, ct.brush.setDown(!1)
  3526. }), ct.canvas.on("touchcancel", function(t) {
  3527. t.preventDefault(), yt = null, ct.brush.setDown(!1)
  3528. }), ct.canvas.on("touchmove", function(t) {
  3529. t.preventDefault();
  3530. for (var e = t.changedTouches, n = 0; n < e.length; n++)
  3531. if (e[n].identitfier == yt) {
  3532. M(e[n].clientX, e[n].clientY, !1);
  3533. break
  3534. }
  3535. }), n(this).on("mouseup", function(t) {
  3536. switch (t.preventDefault(), t.button) {
  3537. case 0:
  3538. ct.brush.setDown(!1)
  3539. }
  3540. }), n("#buttonClearCanvas").on("click", function() {
  3541. st ? st.emit("canvasClear") : ct.clear()
  3542. }), n(".containerTools .tool").on("click", function() {
  3543. ct.brush.setTool(n(this).data("tool"))
  3544. }), n(".colorItem").on("click", function() {
  3545. var t = n(this).data("color");
  3546. ct.brush.setColor(Number(t))
  3547. }), n(".brushSize").on("click", function() {
  3548. var t = ct.brush.thicknessMin,
  3549. e = ct.brush.thicknessMax,
  3550. o = Number(n(this).data("size")) * (e - t) + t;
  3551. ct.brush.setThickness(o)
  3552. })
  3553. }(window, document, jQuery, localStorage);
Add Comment
Please, Sign In to add comment