!(function (funcsArray) { var allFuncs = {}; function getterFunc(index) { if (allFuncs[index]) return allFuncs[index].exports; var newFunc = (allFuncs[index] = { i: index, l: false, exports: {}, }); funcsArray[index].call( newFunc.exports, newFunc, newFunc.exports, getterFunc ); newFunc.l = true; return newFunc.exports; } getterFunc.m = funcsArray; getterFunc.c = allFuncs; getterFunc.d = function (e, t, n) { getterFunc.o(e, t) || Object.defineProperty(e, t, { enumerable: true, get: n, }); }; getterFunc.r = function (e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module", }), Object.defineProperty(e, "__esModule", { value: true, }); }; getterFunc.t = function (e, t) { if ((1 & t && (e = getterFunc(e)), 8 & t)) return e; if (4 & t && "object" == typeof e && e && e.__esModule) return e; var n = Object.create(null); if ( (getterFunc.r(n), Object.defineProperty(n, "default", { enumerable: true, value: e, }), 2 & t && "string" != typeof e) ) for (var r in e) getterFunc.d( n, r, function (t) { return e[t]; }.bind(null, r) ); return n; }; getterFunc.n = function (e) { var t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return getterFunc.d(t, "a", t), t; }; getterFunc.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }; getterFunc.p = "/"; getterFunc((getterFunc.s = 228)); })([ function (exp, t, getterFunc) { var windowObject = getterFunc(5); var r = getterFunc(14); var o = getterFunc(23); var a = getterFunc(19); var s = getterFunc(34); var c = function e(t, i, c) { var u; var l; var h; var f; var d = t & e.F; var p = t & e.G; var m = t & e.P; var g = t & e.B; var _ = p ? windowObject : t & e.S ? windowObject[i] || (windowObject[i] = {}) : (windowObject[i] || {}).prototype; var v = p ? r : r[i] || (r[i] = {}); var y = v.prototype || (v.prototype = {}); for (u in (p && (c = i), c)) { h = ((l = !d && _ && void 0 !== _[u]) ? _ : c)[u]; f = g && l ? s(h, windowObject) : m && "function" == typeof h ? s(Function.call, h) : h; _ && a(_, u, h, t & e.U); v[u] != h && o(v, u, f); m && y[u] != h && (y[u] = h); } }; windowObject.core = r; c.F = 1; c.G = 2; c.S = 4; c.P = 8; c.B = 16; c.W = 32; c.U = 64; c.R = 128; exp.exports = c; }, function (e, t) { "function" == typeof Object.create ? (e.exports = function (e, t) { (e.super_ = t), (e.prototype = Object.create(t.prototype, { constructor: { value: e, enumerable: false, writable: true, configurable: true, }, })); }) : (e.exports = function (e, t) { e.super_ = t; var i = function () {}; (i.prototype = t.prototype), (e.prototype = new i()), (e.prototype.constructor = e); }); }, function (e, t, i) { var n = i(9), r = n.Buffer; function o(e, t) { for (var i in e) t[i] = e[i]; } function a(e, t, i) { return r(e, t, i); } r.from && r.alloc && r.allocUnsafe && r.allocUnsafeSlow ? (e.exports = n) : (o(n, t), (t.Buffer = a)), o(r, a), (a.from = function (e, t, i) { if ("number" == typeof e) throw new TypeError("Argument must not be a number"); return r(e, t, i); }), (a.alloc = function (e, t, i) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); var n = r(e); return ( void 0 !== t ? "string" == typeof i ? n.fill(t, i) : n.fill(t) : n.fill(0), n ); }), (a.allocUnsafe = function (e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return r(e); }), (a.allocUnsafeSlow = function (e) { if ("number" != typeof e) throw new TypeError("Argument must be a number"); return n.SlowBuffer(e); }); }, function (exp, t) { exp.exports = function (e) { try { return !!e(); } catch (error) { return true; } }; }, function (exp, t, i) { var n = i(6); exp.exports = function (e) { if (!n(e)) throw TypeError(e + " is not an object!"); return e; }; }, function (exp, t) { // getWindow i = 5 var _window = (exp.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")()); if (typeof __g == "number") __g = _window; }, function (exp, t) { function i(e) { return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } exp.exports = function (e) { return "object" === i(e) ? null !== e : "function" == typeof e; }; }, function (e, t, i) { "use strict"; function n(e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; (n.enumerable = n.enumerable || false), (n.configurable = true), "value" in n && (n.writable = true), Object.defineProperty(e, n.key, n); } } i.r(t); var r = (function () { function e() { return ( (function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); })(this, e), e.instance || (e.instance = this), (this.changedBlocks = {}), (this.worldSeed = null), (this.worldSize = 128), (this.timeout = null), (this.version = 0), this.loadDataIfExists(), e.instance ); } var t, i, r; return ( (t = e), (r = [ { key: "getInstance", value: function () { return ( void 0 === e.instance && (e.instance = new e()), e.instance ); }, }, ]), (i = [ { key: "loadDataIfExists", value: function () { var e = localStorage.getItem("savedGame"); if (e) { var t = JSON.parse(e); (this.worldSeed = t.worldSeed), (this.changedBlocks = t.changedBlocks), (this.worldSize = t.worldSize), (this.version = void 0 !== t.version ? t.version : 0); } 0 === this.version && this.clearData(); }, }, { key: "gameSaved", value: function () { return !!this.worldSeed; }, }, { key: "updateData", value: function () { var e = JSON.stringify({ worldSeed: this.worldSeed, changedBlocks: this.changedBlocks, worldSize: this.worldSize, version: 1, }); localStorage.setItem("savedGame", e); }, }, { key: "clearData", value: function () { (this.worldSeed = null), (this.changedBlocks = {}), this.updateData(); }, }, { key: "setWorldSeed", value: function (e) { (this.worldSeed = e), this.updateData(); }, }, { key: "getWorldSeed", value: function () { return this.worldSeed; }, }, { key: "setWorldSize", value: function (e) { (this.worldSize = e), this.updateData(); }, }, { key: "getWorldSize", value: function () { return this.worldSize; }, }, { key: "addBlockChange", value: function (e) { var t = this; (this.changedBlocks["p" + e.p[0] + "_" + e.p[1] + "_" + e.p[2]] = { a: e.add ? 1 : 0, bt: e.bt, }), null === this.timeout && (this.timeout = setTimeout(function () { Date.now(); t.updateData(), (t.timeout = null); }, 3e3)); }, }, { key: "getChangedBlocks", value: function () { var e = []; for (var t in this.changedBlocks) { var i = t .substr(1) .split("_") .map(function (e) { return parseInt(e); }); e.push({ p: i, add: !!this.changedBlocks[t].a, bt: this.changedBlocks[t].bt, }); } return e; }, }, ]) && n(t.prototype, i), r && n(t, r), e ); })(); t.default = r; }, function (e, t, i) { var n = i(96)("wks"), r = i(46), o = i(5).Symbol, a = "function" == typeof o; (e.exports = function (e) { return n[e] || (n[e] = (a && o[e]) || (a ? o : r)("Symbol." + e)); }).store = n; }, function (e, t, i) { "use strict"; (function (e) { /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var n = i(398), r = i(399), o = i(168); function a() { return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; } function s(e, t) { if (a() < t) throw new RangeError("Invalid typed array length"); return ( c.TYPED_ARRAY_SUPPORT ? ((e = new Uint8Array(t)).__proto__ = c.prototype) : (null === e && (e = new c(t)), (e.length = t)), e ); } function c(e, t, i) { if (!(c.TYPED_ARRAY_SUPPORT || this instanceof c)) return new c(e, t, i); if ("number" == typeof e) { if ("string" == typeof t) throw new Error( "If encoding is specified then the first argument must be a string" ); return h(this, e); } return u(this, e, t, i); } function u(e, t, i, n) { if ("number" == typeof t) throw new TypeError('"value" argument must not be a number'); return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? (function (e, t, i, n) { if ((t.byteLength, i < 0 || t.byteLength < i)) throw new RangeError("'offset' is out of bounds"); if (t.byteLength < i + (n || 0)) throw new RangeError("'length' is out of bounds"); t = void 0 === i && void 0 === n ? new Uint8Array(t) : void 0 === n ? new Uint8Array(t, i) : new Uint8Array(t, i, n); c.TYPED_ARRAY_SUPPORT ? ((e = t).__proto__ = c.prototype) : (e = f(e, t)); return e; })(e, t, i, n) : "string" == typeof t ? (function (e, t, i) { ("string" == typeof i && "" !== i) || (i = "utf8"); if (!c.isEncoding(i)) throw new TypeError( '"encoding" must be a valid string encoding' ); var n = 0 | p(t, i), r = (e = s(e, n)).write(t, i); r !== n && (e = e.slice(0, r)); return e; })(e, t, i) : (function (e, t) { if (c.isBuffer(t)) { var i = 0 | d(t.length); return 0 === (e = s(e, i)).length ? e : (t.copy(e, 0, 0, i), e); } if (t) { if ( ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer) || "length" in t ) return "number" != typeof t.length || (n = t.length) != n ? s(e, 0) : f(e, t); if ("Buffer" === t.type && o(t.data)) return f(e, t.data); } var n; throw new TypeError( "First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object." ); })(e, t); } function l(e) { if ("number" != typeof e) throw new TypeError('"size" argument must be a number'); if (e < 0) throw new RangeError('"size" argument must not be negative'); } function h(e, t) { if ((l(t), (e = s(e, t < 0 ? 0 : 0 | d(t))), !c.TYPED_ARRAY_SUPPORT)) for (var i = 0; i < t; ++i) e[i] = 0; return e; } function f(e, t) { var i = t.length < 0 ? 0 : 0 | d(t.length); e = s(e, i); for (var n = 0; n < i; n += 1) e[n] = 255 & t[n]; return e; } function d(e) { if (e >= a()) throw new RangeError( "Attempt to allocate Buffer larger than maximum size: 0x" + a().toString(16) + " bytes" ); return 0 | e; } function p(e, t) { if (c.isBuffer(e)) return e.length; if ( "undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) ) return e.byteLength; "string" != typeof e && (e = "" + e); var i = e.length; if (0 === i) return 0; for (var n = false; ; ) switch (t) { case "ascii": case "latin1": case "binary": return i; case "utf8": case "utf-8": case void 0: return V(e).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return 2 * i; case "hex": return i >>> 1; case "base64": return G(e).length; default: if (n) return V(e).length; (t = ("" + t).toLowerCase()), (n = true); } } function m(e, t, i) { var n = e[t]; (e[t] = e[i]), (e[i] = n); } function g(e, t, i, n, r) { if (0 === e.length) return -1; if ( ("string" == typeof i ? ((n = i), (i = 0)) : i > 2147483647 ? (i = 2147483647) : i < -2147483648 && (i = -2147483648), (i = +i), isNaN(i) && (i = r ? 0 : e.length - 1), i < 0 && (i = e.length + i), i >= e.length) ) { if (r) return -1; i = e.length - 1; } else if (i < 0) { if (!r) return -1; i = 0; } if (("string" == typeof t && (t = c.from(t, n)), c.isBuffer(t))) return 0 === t.length ? -1 : _(e, t, i, n, r); if ("number" == typeof t) return ( (t &= 255), c.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? r ? Uint8Array.prototype.indexOf.call(e, t, i) : Uint8Array.prototype.lastIndexOf.call(e, t, i) : _(e, [t], i, n, r) ); throw new TypeError("val must be string, number or Buffer"); } function _(e, t, i, n, r) { var o, a = 1, s = e.length, c = t.length; if ( void 0 !== n && ("ucs2" === (n = String(n).toLowerCase()) || "ucs-2" === n || "utf16le" === n || "utf-16le" === n) ) { if (e.length < 2 || t.length < 2) return -1; (a = 2), (s /= 2), (c /= 2), (i /= 2); } function u(e, t) { return 1 === a ? e[t] : e.readUInt16BE(t * a); } if (r) { var l = -1; for (o = i; o < s; o++) if (u(e, o) === u(t, -1 === l ? 0 : o - l)) { if ((-1 === l && (l = o), o - l + 1 === c)) return l * a; } else -1 !== l && (o -= o - l), (l = -1); } else for (i + c > s && (i = s - c), o = i; o >= 0; o--) { for (var h = true, f = 0; f < c; f++) if (u(e, o + f) !== u(t, f)) { h = false; break; } if (h) return o; } return -1; } function v(e, t, i, n) { i = Number(i) || 0; var r = e.length - i; n ? (n = Number(n)) > r && (n = r) : (n = r); var o = t.length; if (o % 2 != 0) throw new TypeError("Invalid hex string"); n > o / 2 && (n = o / 2); for (var a = 0; a < n; ++a) { var s = parseInt(t.substr(2 * a, 2), 16); if (isNaN(s)) return a; e[i + a] = s; } return a; } function y(e, t, i, n) { return z(V(t, e.length - i), e, i, n); } function b(e, t, i, n) { return z( (function (e) { for (var t = [], i = 0; i < e.length; ++i) t.push(255 & e.charCodeAt(i)); return t; })(t), e, i, n ); } function E(e, t, i, n) { return b(e, t, i, n); } function T(e, t, i, n) { return z(G(t), e, i, n); } function A(e, t, i, n) { return z( (function (e, t) { for ( var i, n, r, o = [], a = 0; a < e.length && !((t -= 2) < 0); ++a ) (i = e.charCodeAt(a)), (n = i >> 8), (r = i % 256), o.push(r), o.push(n); return o; })(t, e.length - i), e, i, n ); } function x(e, t, i) { return 0 === t && i === e.length ? n.fromByteArray(e) : n.fromByteArray(e.slice(t, i)); } function S(e, t, i) { i = Math.min(e.length, i); for (var n = [], r = t; r < i; ) { var o, a, s, c, u = e[r], l = null, h = u > 239 ? 4 : u > 223 ? 3 : u > 191 ? 2 : 1; if (r + h <= i) switch (h) { case 1: u < 128 && (l = u); break; case 2: 128 == (192 & (o = e[r + 1])) && (c = ((31 & u) << 6) | (63 & o)) > 127 && (l = c); break; case 3: (o = e[r + 1]), (a = e[r + 2]), 128 == (192 & o) && 128 == (192 & a) && (c = ((15 & u) << 12) | ((63 & o) << 6) | (63 & a)) > 2047 && (c < 55296 || c > 57343) && (l = c); break; case 4: (o = e[r + 1]), (a = e[r + 2]), (s = e[r + 3]), 128 == (192 & o) && 128 == (192 & a) && 128 == (192 & s) && (c = ((15 & u) << 18) | ((63 & o) << 12) | ((63 & a) << 6) | (63 & s)) > 65535 && c < 1114112 && (l = c); } null === l ? ((l = 65533), (h = 1)) : l > 65535 && ((l -= 65536), n.push(((l >>> 10) & 1023) | 55296), (l = 56320 | (1023 & l))), n.push(l), (r += h); } return (function (e) { var t = e.length; if (t <= C) return String.fromCharCode.apply(String, e); var i = "", n = 0; for (; n < t; ) i += String.fromCharCode.apply(String, e.slice(n, (n += C))); return i; })(n); } (t.Buffer = c), (t.SlowBuffer = function (e) { +e != e && (e = 0); return c.alloc(+e); }), (t.INSPECT_MAX_BYTES = 50), (c.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e.TYPED_ARRAY_SUPPORT : (function () { try { var e = new Uint8Array(1); return ( (e.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42; }, }), 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength ); } catch (e) { return false; } })()), (t.kMaxLength = a()), (c.poolSize = 8192), (c._augment = function (e) { return (e.__proto__ = c.prototype), e; }), (c.from = function (e, t, i) { return u(null, e, t, i); }), c.TYPED_ARRAY_SUPPORT && ((c.prototype.__proto__ = Uint8Array.prototype), (c.__proto__ = Uint8Array), "undefined" != typeof Symbol && Symbol.species && c[Symbol.species] === c && Object.defineProperty(c, Symbol.species, { value: null, configurable: true, })), (c.alloc = function (e, t, i) { return (function (e, t, i, n) { return ( l(t), t <= 0 ? s(e, t) : void 0 !== i ? "string" == typeof n ? s(e, t).fill(i, n) : s(e, t).fill(i) : s(e, t) ); })(null, e, t, i); }), (c.allocUnsafe = function (e) { return h(null, e); }), (c.allocUnsafeSlow = function (e) { return h(null, e); }), (c.isBuffer = function (e) { return !(null == e || !e._isBuffer); }), (c.compare = function (e, t) { if (!c.isBuffer(e) || !c.isBuffer(t)) throw new TypeError("Arguments must be Buffers"); if (e === t) return 0; for ( var i = e.length, n = t.length, r = 0, o = Math.min(i, n); r < o; ++r ) if (e[r] !== t[r]) { (i = e[r]), (n = t[r]); break; } return i < n ? -1 : n < i ? 1 : 0; }), (c.isEncoding = function (e) { switch (String(e).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "latin1": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return true; default: return false; } }), (c.concat = function (e, t) { if (!o(e)) throw new TypeError('"list" argument must be an Array of Buffers'); if (0 === e.length) return c.alloc(0); var i; if (void 0 === t) for (t = 0, i = 0; i < e.length; ++i) t += e[i].length; var n = c.allocUnsafe(t), r = 0; for (i = 0; i < e.length; ++i) { var a = e[i]; if (!c.isBuffer(a)) throw new TypeError( '"list" argument must be an Array of Buffers' ); a.copy(n, r), (r += a.length); } return n; }), (c.byteLength = p), (c.prototype._isBuffer = true), (c.prototype.swap16 = function () { var e = this.length; if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var t = 0; t < e; t += 2) m(this, t, t + 1); return this; }), (c.prototype.swap32 = function () { var e = this.length; if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var t = 0; t < e; t += 4) m(this, t, t + 3), m(this, t + 1, t + 2); return this; }), (c.prototype.swap64 = function () { var e = this.length; if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var t = 0; t < e; t += 8) m(this, t, t + 7), m(this, t + 1, t + 6), m(this, t + 2, t + 5), m(this, t + 3, t + 4); return this; }), (c.prototype.toString = function () { var e = 0 | this.length; return 0 === e ? "" : 0 === arguments.length ? S(this, 0, e) : function (e, t, i) { var n = false; if (((void 0 === t || t < 0) && (t = 0), t > this.length)) return ""; if ( ((void 0 === i || i > this.length) && (i = this.length), i <= 0) ) return ""; if ((i >>>= 0) <= (t >>>= 0)) return ""; for (e || (e = "utf8"); ; ) switch (e) { case "hex": return M(this, t, i); case "utf8": case "utf-8": return S(this, t, i); case "ascii": return P(this, t, i); case "latin1": case "binary": return R(this, t, i); case "base64": return x(this, t, i); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return O(this, t, i); default: if (n) throw new TypeError("Unknown encoding: " + e); (e = (e + "").toLowerCase()), (n = true); } }.apply(this, arguments); }), (c.prototype.equals = function (e) { if (!c.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); return this === e || 0 === c.compare(this, e); }), (c.prototype.inspect = function () { var e = "", i = t.INSPECT_MAX_BYTES; return ( this.length > 0 && ((e = this.toString("hex", 0, i).match(/.{2}/g).join(" ")), this.length > i && (e += " ... ")), "" ); }), (c.prototype.compare = function (e, t, i, n, r) { if (!c.isBuffer(e)) throw new TypeError("Argument must be a Buffer"); if ( (void 0 === t && (t = 0), void 0 === i && (i = e ? e.length : 0), void 0 === n && (n = 0), void 0 === r && (r = this.length), t < 0 || i > e.length || n < 0 || r > this.length) ) throw new RangeError("out of range index"); if (n >= r && t >= i) return 0; if (n >= r) return -1; if (t >= i) return 1; if (this === e) return 0; for ( var o = (r >>>= 0) - (n >>>= 0), a = (i >>>= 0) - (t >>>= 0), s = Math.min(o, a), u = this.slice(n, r), l = e.slice(t, i), h = 0; h < s; ++h ) if (u[h] !== l[h]) { (o = u[h]), (a = l[h]); break; } return o < a ? -1 : a < o ? 1 : 0; }), (c.prototype.includes = function (e, t, i) { return -1 !== this.indexOf(e, t, i); }), (c.prototype.indexOf = function (e, t, i) { return g(this, e, t, i, true); }), (c.prototype.lastIndexOf = function (e, t, i) { return g(this, e, t, i, false); }), (c.prototype.write = function (e, t, i, n) { if (void 0 === t) (n = "utf8"), (i = this.length), (t = 0); else if (void 0 === i && "string" == typeof t) (n = t), (i = this.length), (t = 0); else { if (!isFinite(t)) throw new Error( "Buffer.write(string, encoding, offset[, length]) is no longer supported" ); (t |= 0), isFinite(i) ? ((i |= 0), void 0 === n && (n = "utf8")) : ((n = i), (i = void 0)); } var r = this.length - t; if ( ((void 0 === i || i > r) && (i = r), (e.length > 0 && (i < 0 || t < 0)) || t > this.length) ) throw new RangeError("Attempt to write outside buffer bounds"); n || (n = "utf8"); for (var o = false; ; ) switch (n) { case "hex": return v(this, e, t, i); case "utf8": case "utf-8": return y(this, e, t, i); case "ascii": return b(this, e, t, i); case "latin1": case "binary": return E(this, e, t, i); case "base64": return T(this, e, t, i); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return A(this, e, t, i); default: if (o) throw new TypeError("Unknown encoding: " + n); (n = ("" + n).toLowerCase()), (o = true); } }), (c.prototype.toJSON = function () { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0), }; }); var C = 4096; function P(e, t, i) { var n = ""; i = Math.min(e.length, i); for (var r = t; r < i; ++r) n += String.fromCharCode(127 & e[r]); return n; } function R(e, t, i) { var n = ""; i = Math.min(e.length, i); for (var r = t; r < i; ++r) n += String.fromCharCode(e[r]); return n; } function M(e, t, i) { var n = e.length; (!t || t < 0) && (t = 0), (!i || i < 0 || i > n) && (i = n); for (var r = "", o = t; o < i; ++o) r += U(e[o]); return r; } function O(e, t, i) { for (var n = e.slice(t, i), r = "", o = 0; o < n.length; o += 2) r += String.fromCharCode(n[o] + 256 * n[o + 1]); return r; } function w(e, t, i) { if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint"); if (e + t > i) throw new RangeError("Trying to access beyond buffer length"); } function I(e, t, i, n, r, o) { if (!c.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance'); if (t > r || t < o) throw new RangeError('"value" argument is out of bounds'); if (i + n > e.length) throw new RangeError("Index out of range"); } function D(e, t, i, n) { t < 0 && (t = 65535 + t + 1); for (var r = 0, o = Math.min(e.length - i, 2); r < o; ++r) e[i + r] = (t & (255 << (8 * (n ? r : 1 - r)))) >>> (8 * (n ? r : 1 - r)); } function L(e, t, i, n) { t < 0 && (t = 4294967295 + t + 1); for (var r = 0, o = Math.min(e.length - i, 4); r < o; ++r) e[i + r] = (t >>> (8 * (n ? r : 3 - r))) & 255; } function F(e, t, i, n, r, o) { if (i + n > e.length) throw new RangeError("Index out of range"); if (i < 0) throw new RangeError("Index out of range"); } function B(e, t, i, n, o) { return o || F(e, 0, i, 4), r.write(e, t, i, n, 23, 4), i + 4; } function N(e, t, i, n, o) { return o || F(e, 0, i, 8), r.write(e, t, i, n, 52, 8), i + 8; } (c.prototype.slice = function (e, t) { var i, n = this.length; if ( ((e = ~~e) < 0 ? (e += n) < 0 && (e = 0) : e > n && (e = n), (t = void 0 === t ? n : ~~t) < 0 ? (t += n) < 0 && (t = 0) : t > n && (t = n), t < e && (t = e), c.TYPED_ARRAY_SUPPORT) ) (i = this.subarray(e, t)).__proto__ = c.prototype; else { var r = t - e; i = new c(r, void 0); for (var o = 0; o < r; ++o) i[o] = this[o + e]; } return i; }), (c.prototype.readUIntLE = function (e, t, i) { (e |= 0), (t |= 0), i || w(e, t, this.length); for (var n = this[e], r = 1, o = 0; ++o < t && (r *= 256); ) n += this[e + o] * r; return n; }), (c.prototype.readUIntBE = function (e, t, i) { (e |= 0), (t |= 0), i || w(e, t, this.length); for (var n = this[e + --t], r = 1; t > 0 && (r *= 256); ) n += this[e + --t] * r; return n; }), (c.prototype.readUInt8 = function (e, t) { return t || w(e, 1, this.length), this[e]; }), (c.prototype.readUInt16LE = function (e, t) { return t || w(e, 2, this.length), this[e] | (this[e + 1] << 8); }), (c.prototype.readUInt16BE = function (e, t) { return t || w(e, 2, this.length), (this[e] << 8) | this[e + 1]; }), (c.prototype.readUInt32LE = function (e, t) { return ( t || w(e, 4, this.length), (this[e] | (this[e + 1] << 8) | (this[e + 2] << 16)) + 16777216 * this[e + 3] ); }), (c.prototype.readUInt32BE = function (e, t) { return ( t || w(e, 4, this.length), 16777216 * this[e] + ((this[e + 1] << 16) | (this[e + 2] << 8) | this[e + 3]) ); }), (c.prototype.readIntLE = function (e, t, i) { (e |= 0), (t |= 0), i || w(e, t, this.length); for (var n = this[e], r = 1, o = 0; ++o < t && (r *= 256); ) n += this[e + o] * r; return n >= (r *= 128) && (n -= Math.pow(2, 8 * t)), n; }), (c.prototype.readIntBE = function (e, t, i) { (e |= 0), (t |= 0), i || w(e, t, this.length); for (var n = t, r = 1, o = this[e + --n]; n > 0 && (r *= 256); ) o += this[e + --n] * r; return o >= (r *= 128) && (o -= Math.pow(2, 8 * t)), o; }), (c.prototype.readInt8 = function (e, t) { return ( t || w(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e] ); }), (c.prototype.readInt16LE = function (e, t) { t || w(e, 2, this.length); var i = this[e] | (this[e + 1] << 8); return 32768 & i ? 4294901760 | i : i; }), (c.prototype.readInt16BE = function (e, t) { t || w(e, 2, this.length); var i = this[e + 1] | (this[e] << 8); return 32768 & i ? 4294901760 | i : i; }), (c.prototype.readInt32LE = function (e, t) { return ( t || w(e, 4, this.length), this[e] | (this[e + 1] << 8) | (this[e + 2] << 16) | (this[e + 3] << 24) ); }), (c.prototype.readInt32BE = function (e, t) { return ( t || w(e, 4, this.length), (this[e] << 24) | (this[e + 1] << 16) | (this[e + 2] << 8) | this[e + 3] ); }), (c.prototype.readFloatLE = function (e, t) { return t || w(e, 4, this.length), r.read(this, e, true, 23, 4); }), (c.prototype.readFloatBE = function (e, t) { return t || w(e, 4, this.length), r.read(this, e, false, 23, 4); }), (c.prototype.readDoubleLE = function (e, t) { return t || w(e, 8, this.length), r.read(this, e, true, 52, 8); }), (c.prototype.readDoubleBE = function (e, t) { return t || w(e, 8, this.length), r.read(this, e, false, 52, 8); }), (c.prototype.writeUIntLE = function (e, t, i, n) { ((e = +e), (t |= 0), (i |= 0), n) || I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); var r = 1, o = 0; for (this[t] = 255 & e; ++o < i && (r *= 256); ) this[t + o] = (e / r) & 255; return t + i; }), (c.prototype.writeUIntBE = function (e, t, i, n) { ((e = +e), (t |= 0), (i |= 0), n) || I(this, e, t, i, Math.pow(2, 8 * i) - 1, 0); var r = i - 1, o = 1; for (this[t + r] = 255 & e; --r >= 0 && (o *= 256); ) this[t + r] = (e / o) & 255; return t + i; }), (c.prototype.writeUInt8 = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 1, 255, 0), c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), (this[t] = 255 & e), t + 1 ); }), (c.prototype.writeUInt16LE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 2, 65535, 0), c.TYPED_ARRAY_SUPPORT ? ((this[t] = 255 & e), (this[t + 1] = e >>> 8)) : D(this, e, t, true), t + 2 ); }), (c.prototype.writeUInt16BE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 2, 65535, 0), c.TYPED_ARRAY_SUPPORT ? ((this[t] = e >>> 8), (this[t + 1] = 255 & e)) : D(this, e, t, false), t + 2 ); }), (c.prototype.writeUInt32LE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 4, 4294967295, 0), c.TYPED_ARRAY_SUPPORT ? ((this[t + 3] = e >>> 24), (this[t + 2] = e >>> 16), (this[t + 1] = e >>> 8), (this[t] = 255 & e)) : L(this, e, t, true), t + 4 ); }), (c.prototype.writeUInt32BE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 4, 4294967295, 0), c.TYPED_ARRAY_SUPPORT ? ((this[t] = e >>> 24), (this[t + 1] = e >>> 16), (this[t + 2] = e >>> 8), (this[t + 3] = 255 & e)) : L(this, e, t, false), t + 4 ); }), (c.prototype.writeIntLE = function (e, t, i, n) { if (((e = +e), (t |= 0), !n)) { var r = Math.pow(2, 8 * i - 1); I(this, e, t, i, r - 1, -r); } var o = 0, a = 1, s = 0; for (this[t] = 255 & e; ++o < i && (a *= 256); ) e < 0 && 0 === s && 0 !== this[t + o - 1] && (s = 1), (this[t + o] = (((e / a) >> 0) - s) & 255); return t + i; }), (c.prototype.writeIntBE = function (e, t, i, n) { if (((e = +e), (t |= 0), !n)) { var r = Math.pow(2, 8 * i - 1); I(this, e, t, i, r - 1, -r); } var o = i - 1, a = 1, s = 0; for (this[t + o] = 255 & e; --o >= 0 && (a *= 256); ) e < 0 && 0 === s && 0 !== this[t + o + 1] && (s = 1), (this[t + o] = (((e / a) >> 0) - s) & 255); return t + i; }), (c.prototype.writeInt8 = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 1, 127, -128), c.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)), e < 0 && (e = 255 + e + 1), (this[t] = 255 & e), t + 1 ); }), (c.prototype.writeInt16LE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 2, 32767, -32768), c.TYPED_ARRAY_SUPPORT ? ((this[t] = 255 & e), (this[t + 1] = e >>> 8)) : D(this, e, t, true), t + 2 ); }), (c.prototype.writeInt16BE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 2, 32767, -32768), c.TYPED_ARRAY_SUPPORT ? ((this[t] = e >>> 8), (this[t + 1] = 255 & e)) : D(this, e, t, false), t + 2 ); }), (c.prototype.writeInt32LE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 4, 2147483647, -2147483648), c.TYPED_ARRAY_SUPPORT ? ((this[t] = 255 & e), (this[t + 1] = e >>> 8), (this[t + 2] = e >>> 16), (this[t + 3] = e >>> 24)) : L(this, e, t, true), t + 4 ); }), (c.prototype.writeInt32BE = function (e, t, i) { return ( (e = +e), (t |= 0), i || I(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), c.TYPED_ARRAY_SUPPORT ? ((this[t] = e >>> 24), (this[t + 1] = e >>> 16), (this[t + 2] = e >>> 8), (this[t + 3] = 255 & e)) : L(this, e, t, false), t + 4 ); }), (c.prototype.writeFloatLE = function (e, t, i) { return B(this, e, t, true, i); }), (c.prototype.writeFloatBE = function (e, t, i) { return B(this, e, t, false, i); }), (c.prototype.writeDoubleLE = function (e, t, i) { return N(this, e, t, true, i); }), (c.prototype.writeDoubleBE = function (e, t, i) { return N(this, e, t, false, i); }), (c.prototype.copy = function (e, t, i, n) { if ( (i || (i = 0), n || 0 === n || (n = this.length), t >= e.length && (t = e.length), t || (t = 0), n > 0 && n < i && (n = i), n === i) ) return 0; if (0 === e.length || 0 === this.length) return 0; if (t < 0) throw new RangeError("targetStart out of bounds"); if (i < 0 || i >= this.length) throw new RangeError("sourceStart out of bounds"); if (n < 0) throw new RangeError("sourceEnd out of bounds"); n > this.length && (n = this.length), e.length - t < n - i && (n = e.length - t + i); var r, o = n - i; if (this === e && i < t && t < n) for (r = o - 1; r >= 0; --r) e[r + t] = this[r + i]; else if (o < 1e3 || !c.TYPED_ARRAY_SUPPORT) for (r = 0; r < o; ++r) e[r + t] = this[r + i]; else Uint8Array.prototype.set.call(e, this.subarray(i, i + o), t); return o; }), (c.prototype.fill = function (e, t, i, n) { if ("string" == typeof e) { if ( ("string" == typeof t ? ((n = t), (t = 0), (i = this.length)) : "string" == typeof i && ((n = i), (i = this.length)), 1 === e.length) ) { var r = e.charCodeAt(0); r < 256 && (e = r); } if (void 0 !== n && "string" != typeof n) throw new TypeError("encoding must be a string"); if ("string" == typeof n && !c.isEncoding(n)) throw new TypeError("Unknown encoding: " + n); } else "number" == typeof e && (e &= 255); if (t < 0 || this.length < t || this.length < i) throw new RangeError("Out of range index"); if (i <= t) return this; var o; if ( ((t >>>= 0), (i = void 0 === i ? this.length : i >>> 0), e || (e = 0), "number" == typeof e) ) for (o = t; o < i; ++o) this[o] = e; else { var a = c.isBuffer(e) ? e : V(new c(e, n).toString()), s = a.length; for (o = 0; o < i - t; ++o) this[o + t] = a[o % s]; } return this; }); var k = /[^+\/0-9A-Za-z-_]/g; function U(e) { return e < 16 ? "0" + e.toString(16) : e.toString(16); } function V(e, t) { var i; t = t || 1 / 0; for (var n = e.length, r = null, o = [], a = 0; a < n; ++a) { if ((i = e.charCodeAt(a)) > 55295 && i < 57344) { if (!r) { if (i > 56319) { (t -= 3) > -1 && o.push(239, 191, 189); continue; } if (a + 1 === n) { (t -= 3) > -1 && o.push(239, 191, 189); continue; } r = i; continue; } if (i < 56320) { (t -= 3) > -1 && o.push(239, 191, 189), (r = i); continue; } i = 65536 + (((r - 55296) << 10) | (i - 56320)); } else r && (t -= 3) > -1 && o.push(239, 191, 189); if (((r = null), i < 128)) { if ((t -= 1) < 0) break; o.push(i); } else if (i < 2048) { if ((t -= 2) < 0) break; o.push((i >> 6) | 192, (63 & i) | 128); } else if (i < 65536) { if ((t -= 3) < 0) break; o.push((i >> 12) | 224, ((i >> 6) & 63) | 128, (63 & i) | 128); } else { if (!(i < 1114112)) throw new Error("Invalid code point"); if ((t -= 4) < 0) break; o.push( (i >> 18) | 240, ((i >> 12) & 63) | 128, ((i >> 6) & 63) | 128, (63 & i) | 128 ); } } return o; } function G(e) { return n.toByteArray( (function (e) { if ( (e = (function (e) { return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, ""); })(e).replace(k, "")).length < 2 ) return ""; for (; e.length % 4 != 0; ) e += "="; return e; })(e) ); } function z(e, t, i, n) { for (var r = 0; r < n && !(r + i >= t.length || r >= e.length); ++r) t[r + i] = e[r]; return r; } }.call(this, i(15))); }, function (exp, t, i) { var n = i(28); var r = Math.min; exp.exports = function (e) { return e > 0 ? r(n(e), 9007199254740991) : 0; }; }, function (e, t, i) { (function (e) { function t(e) { return (t = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } !(function (e, n) { "use strict"; function r(e, t) { if (!e) throw new Error(t || "Assertion failed"); } function o(e, t) { e.super_ = t; var i = function () {}; (i.prototype = t.prototype), (e.prototype = new i()), (e.prototype.constructor = e); } function a(e, t, i) { if (a.isBN(e)) return e; (this.negative = 0), (this.words = null), (this.length = 0), (this.red = null), null !== e && (("le" !== t && "be" !== t) || ((i = t), (t = 10)), this._init(e || 0, t || 10, i || "be")); } var s; "object" === t(e) ? (e.exports = a) : (n.BN = a), (a.BN = a), (a.wordSize = 26); try { s = i(543).Buffer; } catch (e) {} function c(e, t, i) { for (var n = 0, r = Math.min(e.length, i), o = t; o < r; o++) { var a = e.charCodeAt(o) - 48; (n <<= 4), (n |= a >= 49 && a <= 54 ? a - 49 + 10 : a >= 17 && a <= 22 ? a - 17 + 10 : 15 & a); } return n; } function u(e, t, i, n) { for (var r = 0, o = Math.min(e.length, i), a = t; a < o; a++) { var s = e.charCodeAt(a) - 48; (r *= n), (r += s >= 49 ? s - 49 + 10 : s >= 17 ? s - 17 + 10 : s); } return r; } (a.isBN = function (e) { return ( e instanceof a || (null !== e && "object" === t(e) && e.constructor.wordSize === a.wordSize && Array.isArray(e.words)) ); }), (a.max = function (e, t) { return e.cmp(t) > 0 ? e : t; }), (a.min = function (e, t) { return e.cmp(t) < 0 ? e : t; }), (a.prototype._init = function (e, i, n) { if ("number" == typeof e) return this._initNumber(e, i, n); if ("object" === t(e)) return this._initArray(e, i, n); "hex" === i && (i = 16), r(i === (0 | i) && i >= 2 && i <= 36); var o = 0; "-" === (e = e.toString().replace(/\s+/g, ""))[0] && o++, 16 === i ? this._parseHex(e, o) : this._parseBase(e, i, o), "-" === e[0] && (this.negative = 1), this.strip(), "le" === n && this._initArray(this.toArray(), i, n); }), (a.prototype._initNumber = function (e, t, i) { e < 0 && ((this.negative = 1), (e = -e)), e < 67108864 ? ((this.words = [67108863 & e]), (this.length = 1)) : e < 4503599627370496 ? ((this.words = [67108863 & e, (e / 67108864) & 67108863]), (this.length = 2)) : (r(e < 9007199254740992), (this.words = [67108863 & e, (e / 67108864) & 67108863, 1]), (this.length = 3)), "le" === i && this._initArray(this.toArray(), t, i); }), (a.prototype._initArray = function (e, t, i) { if ((r("number" == typeof e.length), e.length <= 0)) return (this.words = [0]), (this.length = 1), this; (this.length = Math.ceil(e.length / 3)), (this.words = new Array(this.length)); for (var n = 0; n < this.length; n++) this.words[n] = 0; var o, a, s = 0; if ("be" === i) for (n = e.length - 1, o = 0; n >= 0; n -= 3) (a = e[n] | (e[n - 1] << 8) | (e[n - 2] << 16)), (this.words[o] |= (a << s) & 67108863), (this.words[o + 1] = (a >>> (26 - s)) & 67108863), (s += 24) >= 26 && ((s -= 26), o++); else if ("le" === i) for (n = 0, o = 0; n < e.length; n += 3) (a = e[n] | (e[n + 1] << 8) | (e[n + 2] << 16)), (this.words[o] |= (a << s) & 67108863), (this.words[o + 1] = (a >>> (26 - s)) & 67108863), (s += 24) >= 26 && ((s -= 26), o++); return this.strip(); }), (a.prototype._parseHex = function (e, t) { (this.length = Math.ceil((e.length - t) / 6)), (this.words = new Array(this.length)); for (var i = 0; i < this.length; i++) this.words[i] = 0; var n, r, o = 0; for (i = e.length - 6, n = 0; i >= t; i -= 6) (r = c(e, i, i + 6)), (this.words[n] |= (r << o) & 67108863), (this.words[n + 1] |= (r >>> (26 - o)) & 4194303), (o += 24) >= 26 && ((o -= 26), n++); i + 6 !== t && ((r = c(e, t, i + 6)), (this.words[n] |= (r << o) & 67108863), (this.words[n + 1] |= (r >>> (26 - o)) & 4194303)), this.strip(); }), (a.prototype._parseBase = function (e, t, i) { (this.words = [0]), (this.length = 1); for (var n = 0, r = 1; r <= 67108863; r *= t) n++; n--, (r = (r / t) | 0); for ( var o = e.length - i, a = o % n, s = Math.min(o, o - a) + i, c = 0, l = i; l < s; l += n ) (c = u(e, l, l + n, t)), this.imuln(r), this.words[0] + c < 67108864 ? (this.words[0] += c) : this._iaddn(c); if (0 !== a) { var h = 1; for (c = u(e, l, e.length, t), l = 0; l < a; l++) h *= t; this.imuln(h), this.words[0] + c < 67108864 ? (this.words[0] += c) : this._iaddn(c); } }), (a.prototype.copy = function (e) { e.words = new Array(this.length); for (var t = 0; t < this.length; t++) e.words[t] = this.words[t]; (e.length = this.length), (e.negative = this.negative), (e.red = this.red); }), (a.prototype.clone = function () { var e = new a(null); return this.copy(e), e; }), (a.prototype._expand = function (e) { for (; this.length < e; ) this.words[this.length++] = 0; return this; }), (a.prototype.strip = function () { for (; this.length > 1 && 0 === this.words[this.length - 1]; ) this.length--; return this._normSign(); }), (a.prototype._normSign = function () { return ( 1 === this.length && 0 === this.words[0] && (this.negative = 0), this ); }), (a.prototype.inspect = function () { return (this.red ? ""; }); var l = [ "", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000", ], h = [ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, ], f = [ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176, ]; function d(e, t, i) { i.negative = t.negative ^ e.negative; var n = (e.length + t.length) | 0; (i.length = n), (n = (n - 1) | 0); var r = 0 | e.words[0], o = 0 | t.words[0], a = r * o, s = 67108863 & a, c = (a / 67108864) | 0; i.words[0] = s; for (var u = 1; u < n; u++) { for ( var l = c >>> 26, h = 67108863 & c, f = Math.min(u, t.length - 1), d = Math.max(0, u - e.length + 1); d <= f; d++ ) { var p = (u - d) | 0; (l += ((a = (r = 0 | e.words[p]) * (o = 0 | t.words[d]) + h) / 67108864) | 0), (h = 67108863 & a); } (i.words[u] = 0 | h), (c = 0 | l); } return 0 !== c ? (i.words[u] = 0 | c) : i.length--, i.strip(); } (a.prototype.toString = function (e, t) { var i; if (((t = 0 | t || 1), 16 === (e = e || 10) || "hex" === e)) { i = ""; for (var n = 0, o = 0, a = 0; a < this.length; a++) { var s = this.words[a], c = (16777215 & ((s << n) | o)).toString(16); (i = 0 !== (o = (s >>> (24 - n)) & 16777215) || a !== this.length - 1 ? l[6 - c.length] + c + i : c + i), (n += 2) >= 26 && ((n -= 26), a--); } for (0 !== o && (i = o.toString(16) + i); i.length % t != 0; ) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i; } if (e === (0 | e) && e >= 2 && e <= 36) { var u = h[e], d = f[e]; i = ""; var p = this.clone(); for (p.negative = 0; !p.isZero(); ) { var m = p.modn(d).toString(e); i = (p = p.idivn(d)).isZero() ? m + i : l[u - m.length] + m + i; } for (this.isZero() && (i = "0" + i); i.length % t != 0; ) i = "0" + i; return 0 !== this.negative && (i = "-" + i), i; } r(false, "Base should be between 2 and 36"); }), (a.prototype.toNumber = function () { var e = this.words[0]; return ( 2 === this.length ? (e += 67108864 * this.words[1]) : 3 === this.length && 1 === this.words[2] ? (e += 4503599627370496 + 67108864 * this.words[1]) : this.length > 2 && r(false, "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e ); }), (a.prototype.toJSON = function () { return this.toString(16); }), (a.prototype.toBuffer = function (e, t) { return r(void 0 !== s), this.toArrayLike(s, e, t); }), (a.prototype.toArray = function (e, t) { return this.toArrayLike(Array, e, t); }), (a.prototype.toArrayLike = function (e, t, i) { var n = this.byteLength(), o = i || Math.max(1, n); r(n <= o, "byte array longer than desired length"), r(o > 0, "Requested array length <= 0"), this.strip(); var a, s, c = "le" === t, u = new e(o), l = this.clone(); if (c) { for (s = 0; !l.isZero(); s++) (a = l.andln(255)), l.iushrn(8), (u[s] = a); for (; s < o; s++) u[s] = 0; } else { for (s = 0; s < o - n; s++) u[s] = 0; for (s = 0; !l.isZero(); s++) (a = l.andln(255)), l.iushrn(8), (u[o - s - 1] = a); } return u; }), Math.clz32 ? (a.prototype._countBits = function (e) { return 32 - Math.clz32(e); }) : (a.prototype._countBits = function (e) { var t = e, i = 0; return ( t >= 4096 && ((i += 13), (t >>>= 13)), t >= 64 && ((i += 7), (t >>>= 7)), t >= 8 && ((i += 4), (t >>>= 4)), t >= 2 && ((i += 2), (t >>>= 2)), i + t ); }), (a.prototype._zeroBits = function (e) { if (0 === e) return 26; var t = e, i = 0; return ( 0 == (8191 & t) && ((i += 13), (t >>>= 13)), 0 == (127 & t) && ((i += 7), (t >>>= 7)), 0 == (15 & t) && ((i += 4), (t >>>= 4)), 0 == (3 & t) && ((i += 2), (t >>>= 2)), 0 == (1 & t) && i++, i ); }), (a.prototype.bitLength = function () { var e = this.words[this.length - 1], t = this._countBits(e); return 26 * (this.length - 1) + t; }), (a.prototype.zeroBits = function () { if (this.isZero()) return 0; for (var e = 0, t = 0; t < this.length; t++) { var i = this._zeroBits(this.words[t]); if (((e += i), 26 !== i)) break; } return e; }), (a.prototype.byteLength = function () { return Math.ceil(this.bitLength() / 8); }), (a.prototype.toTwos = function (e) { return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone(); }), (a.prototype.fromTwos = function (e) { return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone(); }), (a.prototype.isNeg = function () { return 0 !== this.negative; }), (a.prototype.neg = function () { return this.clone().ineg(); }), (a.prototype.ineg = function () { return this.isZero() || (this.negative ^= 1), this; }), (a.prototype.iuor = function (e) { for (; this.length < e.length; ) this.words[this.length++] = 0; for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t]; return this.strip(); }), (a.prototype.ior = function (e) { return r(0 == (this.negative | e.negative)), this.iuor(e); }), (a.prototype.or = function (e) { return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this); }), (a.prototype.uor = function (e) { return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this); }), (a.prototype.iuand = function (e) { var t; t = this.length > e.length ? e : this; for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i]; return (this.length = t.length), this.strip(); }), (a.prototype.iand = function (e) { return r(0 == (this.negative | e.negative)), this.iuand(e); }), (a.prototype.and = function (e) { return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this); }), (a.prototype.uand = function (e) { return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this); }), (a.prototype.iuxor = function (e) { var t, i; this.length > e.length ? ((t = this), (i = e)) : ((t = e), (i = this)); for (var n = 0; n < i.length; n++) this.words[n] = t.words[n] ^ i.words[n]; if (this !== t) for (; n < t.length; n++) this.words[n] = t.words[n]; return (this.length = t.length), this.strip(); }), (a.prototype.ixor = function (e) { return r(0 == (this.negative | e.negative)), this.iuxor(e); }), (a.prototype.xor = function (e) { return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this); }), (a.prototype.uxor = function (e) { return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this); }), (a.prototype.inotn = function (e) { r("number" == typeof e && e >= 0); var t = 0 | Math.ceil(e / 26), i = e % 26; this._expand(t), i > 0 && t--; for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n]; return ( i > 0 && (this.words[n] = ~this.words[n] & (67108863 >> (26 - i))), this.strip() ); }), (a.prototype.notn = function (e) { return this.clone().inotn(e); }), (a.prototype.setn = function (e, t) { r("number" == typeof e && e >= 0); var i = (e / 26) | 0, n = e % 26; return ( this._expand(i + 1), (this.words[i] = t ? this.words[i] | (1 << n) : this.words[i] & ~(1 << n)), this.strip() ); }), (a.prototype.iadd = function (e) { var t, i, n; if (0 !== this.negative && 0 === e.negative) return ( (this.negative = 0), (t = this.isub(e)), (this.negative ^= 1), this._normSign() ); if (0 === this.negative && 0 !== e.negative) return ( (e.negative = 0), (t = this.isub(e)), (e.negative = 1), t._normSign() ); this.length > e.length ? ((i = this), (n = e)) : ((i = e), (n = this)); for (var r = 0, o = 0; o < n.length; o++) (t = (0 | i.words[o]) + (0 | n.words[o]) + r), (this.words[o] = 67108863 & t), (r = t >>> 26); for (; 0 !== r && o < i.length; o++) (t = (0 | i.words[o]) + r), (this.words[o] = 67108863 & t), (r = t >>> 26); if (((this.length = i.length), 0 !== r)) (this.words[this.length] = r), this.length++; else if (i !== this) for (; o < i.length; o++) this.words[o] = i.words[o]; return this; }), (a.prototype.add = function (e) { var t; return 0 !== e.negative && 0 === this.negative ? ((e.negative = 0), (t = this.sub(e)), (e.negative ^= 1), t) : 0 === e.negative && 0 !== this.negative ? ((this.negative = 0), (t = e.sub(this)), (this.negative = 1), t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this); }), (a.prototype.isub = function (e) { if (0 !== e.negative) { e.negative = 0; var t = this.iadd(e); return (e.negative = 1), t._normSign(); } if (0 !== this.negative) return ( (this.negative = 0), this.iadd(e), (this.negative = 1), this._normSign() ); var i, n, r = this.cmp(e); if (0 === r) return ( (this.negative = 0), (this.length = 1), (this.words[0] = 0), this ); r > 0 ? ((i = this), (n = e)) : ((i = e), (n = this)); for (var o = 0, a = 0; a < n.length; a++) (o = (t = (0 | i.words[a]) - (0 | n.words[a]) + o) >> 26), (this.words[a] = 67108863 & t); for (; 0 !== o && a < i.length; a++) (o = (t = (0 | i.words[a]) + o) >> 26), (this.words[a] = 67108863 & t); if (0 === o && a < i.length && i !== this) for (; a < i.length; a++) this.words[a] = i.words[a]; return ( (this.length = Math.max(this.length, a)), i !== this && (this.negative = 1), this.strip() ); }), (a.prototype.sub = function (e) { return this.clone().isub(e); }); var p = function (e, t, i) { var n, r, o, a = e.words, s = t.words, c = i.words, u = 0, l = 0 | a[0], h = 8191 & l, f = l >>> 13, d = 0 | a[1], p = 8191 & d, m = d >>> 13, g = 0 | a[2], _ = 8191 & g, v = g >>> 13, y = 0 | a[3], b = 8191 & y, E = y >>> 13, T = 0 | a[4], A = 8191 & T, x = T >>> 13, S = 0 | a[5], C = 8191 & S, P = S >>> 13, R = 0 | a[6], M = 8191 & R, O = R >>> 13, w = 0 | a[7], I = 8191 & w, D = w >>> 13, L = 0 | a[8], F = 8191 & L, B = L >>> 13, N = 0 | a[9], k = 8191 & N, U = N >>> 13, V = 0 | s[0], G = 8191 & V, z = V >>> 13, j = 0 | s[1], H = 8191 & j, W = j >>> 13, X = 0 | s[2], Y = 8191 & X, K = X >>> 13, Q = 0 | s[3], q = 8191 & Q, Z = Q >>> 13, J = 0 | s[4], $ = 8191 & J, ee = J >>> 13, te = 0 | s[5], ie = 8191 & te, ne = te >>> 13, re = 0 | s[6], oe = 8191 & re, ae = re >>> 13, se = 0 | s[7], ce = 8191 & se, ue = se >>> 13, le = 0 | s[8], he = 8191 & le, fe = le >>> 13, de = 0 | s[9], pe = 8191 & de, me = de >>> 13; (i.negative = e.negative ^ t.negative), (i.length = 19); var ge = (((u + (n = Math.imul(h, G))) | 0) + ((8191 & (r = ((r = Math.imul(h, z)) + Math.imul(f, G)) | 0)) << 13)) | 0; (u = ((((o = Math.imul(f, z)) + (r >>> 13)) | 0) + (ge >>> 26)) | 0), (ge &= 67108863), (n = Math.imul(p, G)), (r = ((r = Math.imul(p, z)) + Math.imul(m, G)) | 0), (o = Math.imul(m, z)); var _e = (((u + (n = (n + Math.imul(h, H)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, W)) | 0) + Math.imul(f, H)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, W)) | 0) + (r >>> 13)) | 0) + (_e >>> 26)) | 0), (_e &= 67108863), (n = Math.imul(_, G)), (r = ((r = Math.imul(_, z)) + Math.imul(v, G)) | 0), (o = Math.imul(v, z)), (n = (n + Math.imul(p, H)) | 0), (r = ((r = (r + Math.imul(p, W)) | 0) + Math.imul(m, H)) | 0), (o = (o + Math.imul(m, W)) | 0); var ve = (((u + (n = (n + Math.imul(h, Y)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, K)) | 0) + Math.imul(f, Y)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, K)) | 0) + (r >>> 13)) | 0) + (ve >>> 26)) | 0), (ve &= 67108863), (n = Math.imul(b, G)), (r = ((r = Math.imul(b, z)) + Math.imul(E, G)) | 0), (o = Math.imul(E, z)), (n = (n + Math.imul(_, H)) | 0), (r = ((r = (r + Math.imul(_, W)) | 0) + Math.imul(v, H)) | 0), (o = (o + Math.imul(v, W)) | 0), (n = (n + Math.imul(p, Y)) | 0), (r = ((r = (r + Math.imul(p, K)) | 0) + Math.imul(m, Y)) | 0), (o = (o + Math.imul(m, K)) | 0); var ye = (((u + (n = (n + Math.imul(h, q)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, Z)) | 0) + Math.imul(f, q)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, Z)) | 0) + (r >>> 13)) | 0) + (ye >>> 26)) | 0), (ye &= 67108863), (n = Math.imul(A, G)), (r = ((r = Math.imul(A, z)) + Math.imul(x, G)) | 0), (o = Math.imul(x, z)), (n = (n + Math.imul(b, H)) | 0), (r = ((r = (r + Math.imul(b, W)) | 0) + Math.imul(E, H)) | 0), (o = (o + Math.imul(E, W)) | 0), (n = (n + Math.imul(_, Y)) | 0), (r = ((r = (r + Math.imul(_, K)) | 0) + Math.imul(v, Y)) | 0), (o = (o + Math.imul(v, K)) | 0), (n = (n + Math.imul(p, q)) | 0), (r = ((r = (r + Math.imul(p, Z)) | 0) + Math.imul(m, q)) | 0), (o = (o + Math.imul(m, Z)) | 0); var be = (((u + (n = (n + Math.imul(h, $)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, ee)) | 0) + Math.imul(f, $)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, ee)) | 0) + (r >>> 13)) | 0) + (be >>> 26)) | 0), (be &= 67108863), (n = Math.imul(C, G)), (r = ((r = Math.imul(C, z)) + Math.imul(P, G)) | 0), (o = Math.imul(P, z)), (n = (n + Math.imul(A, H)) | 0), (r = ((r = (r + Math.imul(A, W)) | 0) + Math.imul(x, H)) | 0), (o = (o + Math.imul(x, W)) | 0), (n = (n + Math.imul(b, Y)) | 0), (r = ((r = (r + Math.imul(b, K)) | 0) + Math.imul(E, Y)) | 0), (o = (o + Math.imul(E, K)) | 0), (n = (n + Math.imul(_, q)) | 0), (r = ((r = (r + Math.imul(_, Z)) | 0) + Math.imul(v, q)) | 0), (o = (o + Math.imul(v, Z)) | 0), (n = (n + Math.imul(p, $)) | 0), (r = ((r = (r + Math.imul(p, ee)) | 0) + Math.imul(m, $)) | 0), (o = (o + Math.imul(m, ee)) | 0); var Ee = (((u + (n = (n + Math.imul(h, ie)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, ne)) | 0) + Math.imul(f, ie)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, ne)) | 0) + (r >>> 13)) | 0) + (Ee >>> 26)) | 0), (Ee &= 67108863), (n = Math.imul(M, G)), (r = ((r = Math.imul(M, z)) + Math.imul(O, G)) | 0), (o = Math.imul(O, z)), (n = (n + Math.imul(C, H)) | 0), (r = ((r = (r + Math.imul(C, W)) | 0) + Math.imul(P, H)) | 0), (o = (o + Math.imul(P, W)) | 0), (n = (n + Math.imul(A, Y)) | 0), (r = ((r = (r + Math.imul(A, K)) | 0) + Math.imul(x, Y)) | 0), (o = (o + Math.imul(x, K)) | 0), (n = (n + Math.imul(b, q)) | 0), (r = ((r = (r + Math.imul(b, Z)) | 0) + Math.imul(E, q)) | 0), (o = (o + Math.imul(E, Z)) | 0), (n = (n + Math.imul(_, $)) | 0), (r = ((r = (r + Math.imul(_, ee)) | 0) + Math.imul(v, $)) | 0), (o = (o + Math.imul(v, ee)) | 0), (n = (n + Math.imul(p, ie)) | 0), (r = ((r = (r + Math.imul(p, ne)) | 0) + Math.imul(m, ie)) | 0), (o = (o + Math.imul(m, ne)) | 0); var Te = (((u + (n = (n + Math.imul(h, oe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, ae)) | 0) + Math.imul(f, oe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, ae)) | 0) + (r >>> 13)) | 0) + (Te >>> 26)) | 0), (Te &= 67108863), (n = Math.imul(I, G)), (r = ((r = Math.imul(I, z)) + Math.imul(D, G)) | 0), (o = Math.imul(D, z)), (n = (n + Math.imul(M, H)) | 0), (r = ((r = (r + Math.imul(M, W)) | 0) + Math.imul(O, H)) | 0), (o = (o + Math.imul(O, W)) | 0), (n = (n + Math.imul(C, Y)) | 0), (r = ((r = (r + Math.imul(C, K)) | 0) + Math.imul(P, Y)) | 0), (o = (o + Math.imul(P, K)) | 0), (n = (n + Math.imul(A, q)) | 0), (r = ((r = (r + Math.imul(A, Z)) | 0) + Math.imul(x, q)) | 0), (o = (o + Math.imul(x, Z)) | 0), (n = (n + Math.imul(b, $)) | 0), (r = ((r = (r + Math.imul(b, ee)) | 0) + Math.imul(E, $)) | 0), (o = (o + Math.imul(E, ee)) | 0), (n = (n + Math.imul(_, ie)) | 0), (r = ((r = (r + Math.imul(_, ne)) | 0) + Math.imul(v, ie)) | 0), (o = (o + Math.imul(v, ne)) | 0), (n = (n + Math.imul(p, oe)) | 0), (r = ((r = (r + Math.imul(p, ae)) | 0) + Math.imul(m, oe)) | 0), (o = (o + Math.imul(m, ae)) | 0); var Ae = (((u + (n = (n + Math.imul(h, ce)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, ue)) | 0) + Math.imul(f, ce)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, ue)) | 0) + (r >>> 13)) | 0) + (Ae >>> 26)) | 0), (Ae &= 67108863), (n = Math.imul(F, G)), (r = ((r = Math.imul(F, z)) + Math.imul(B, G)) | 0), (o = Math.imul(B, z)), (n = (n + Math.imul(I, H)) | 0), (r = ((r = (r + Math.imul(I, W)) | 0) + Math.imul(D, H)) | 0), (o = (o + Math.imul(D, W)) | 0), (n = (n + Math.imul(M, Y)) | 0), (r = ((r = (r + Math.imul(M, K)) | 0) + Math.imul(O, Y)) | 0), (o = (o + Math.imul(O, K)) | 0), (n = (n + Math.imul(C, q)) | 0), (r = ((r = (r + Math.imul(C, Z)) | 0) + Math.imul(P, q)) | 0), (o = (o + Math.imul(P, Z)) | 0), (n = (n + Math.imul(A, $)) | 0), (r = ((r = (r + Math.imul(A, ee)) | 0) + Math.imul(x, $)) | 0), (o = (o + Math.imul(x, ee)) | 0), (n = (n + Math.imul(b, ie)) | 0), (r = ((r = (r + Math.imul(b, ne)) | 0) + Math.imul(E, ie)) | 0), (o = (o + Math.imul(E, ne)) | 0), (n = (n + Math.imul(_, oe)) | 0), (r = ((r = (r + Math.imul(_, ae)) | 0) + Math.imul(v, oe)) | 0), (o = (o + Math.imul(v, ae)) | 0), (n = (n + Math.imul(p, ce)) | 0), (r = ((r = (r + Math.imul(p, ue)) | 0) + Math.imul(m, ce)) | 0), (o = (o + Math.imul(m, ue)) | 0); var xe = (((u + (n = (n + Math.imul(h, he)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, fe)) | 0) + Math.imul(f, he)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, fe)) | 0) + (r >>> 13)) | 0) + (xe >>> 26)) | 0), (xe &= 67108863), (n = Math.imul(k, G)), (r = ((r = Math.imul(k, z)) + Math.imul(U, G)) | 0), (o = Math.imul(U, z)), (n = (n + Math.imul(F, H)) | 0), (r = ((r = (r + Math.imul(F, W)) | 0) + Math.imul(B, H)) | 0), (o = (o + Math.imul(B, W)) | 0), (n = (n + Math.imul(I, Y)) | 0), (r = ((r = (r + Math.imul(I, K)) | 0) + Math.imul(D, Y)) | 0), (o = (o + Math.imul(D, K)) | 0), (n = (n + Math.imul(M, q)) | 0), (r = ((r = (r + Math.imul(M, Z)) | 0) + Math.imul(O, q)) | 0), (o = (o + Math.imul(O, Z)) | 0), (n = (n + Math.imul(C, $)) | 0), (r = ((r = (r + Math.imul(C, ee)) | 0) + Math.imul(P, $)) | 0), (o = (o + Math.imul(P, ee)) | 0), (n = (n + Math.imul(A, ie)) | 0), (r = ((r = (r + Math.imul(A, ne)) | 0) + Math.imul(x, ie)) | 0), (o = (o + Math.imul(x, ne)) | 0), (n = (n + Math.imul(b, oe)) | 0), (r = ((r = (r + Math.imul(b, ae)) | 0) + Math.imul(E, oe)) | 0), (o = (o + Math.imul(E, ae)) | 0), (n = (n + Math.imul(_, ce)) | 0), (r = ((r = (r + Math.imul(_, ue)) | 0) + Math.imul(v, ce)) | 0), (o = (o + Math.imul(v, ue)) | 0), (n = (n + Math.imul(p, he)) | 0), (r = ((r = (r + Math.imul(p, fe)) | 0) + Math.imul(m, he)) | 0), (o = (o + Math.imul(m, fe)) | 0); var Se = (((u + (n = (n + Math.imul(h, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(h, me)) | 0) + Math.imul(f, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(f, me)) | 0) + (r >>> 13)) | 0) + (Se >>> 26)) | 0), (Se &= 67108863), (n = Math.imul(k, H)), (r = ((r = Math.imul(k, W)) + Math.imul(U, H)) | 0), (o = Math.imul(U, W)), (n = (n + Math.imul(F, Y)) | 0), (r = ((r = (r + Math.imul(F, K)) | 0) + Math.imul(B, Y)) | 0), (o = (o + Math.imul(B, K)) | 0), (n = (n + Math.imul(I, q)) | 0), (r = ((r = (r + Math.imul(I, Z)) | 0) + Math.imul(D, q)) | 0), (o = (o + Math.imul(D, Z)) | 0), (n = (n + Math.imul(M, $)) | 0), (r = ((r = (r + Math.imul(M, ee)) | 0) + Math.imul(O, $)) | 0), (o = (o + Math.imul(O, ee)) | 0), (n = (n + Math.imul(C, ie)) | 0), (r = ((r = (r + Math.imul(C, ne)) | 0) + Math.imul(P, ie)) | 0), (o = (o + Math.imul(P, ne)) | 0), (n = (n + Math.imul(A, oe)) | 0), (r = ((r = (r + Math.imul(A, ae)) | 0) + Math.imul(x, oe)) | 0), (o = (o + Math.imul(x, ae)) | 0), (n = (n + Math.imul(b, ce)) | 0), (r = ((r = (r + Math.imul(b, ue)) | 0) + Math.imul(E, ce)) | 0), (o = (o + Math.imul(E, ue)) | 0), (n = (n + Math.imul(_, he)) | 0), (r = ((r = (r + Math.imul(_, fe)) | 0) + Math.imul(v, he)) | 0), (o = (o + Math.imul(v, fe)) | 0); var Ce = (((u + (n = (n + Math.imul(p, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(p, me)) | 0) + Math.imul(m, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(m, me)) | 0) + (r >>> 13)) | 0) + (Ce >>> 26)) | 0), (Ce &= 67108863), (n = Math.imul(k, Y)), (r = ((r = Math.imul(k, K)) + Math.imul(U, Y)) | 0), (o = Math.imul(U, K)), (n = (n + Math.imul(F, q)) | 0), (r = ((r = (r + Math.imul(F, Z)) | 0) + Math.imul(B, q)) | 0), (o = (o + Math.imul(B, Z)) | 0), (n = (n + Math.imul(I, $)) | 0), (r = ((r = (r + Math.imul(I, ee)) | 0) + Math.imul(D, $)) | 0), (o = (o + Math.imul(D, ee)) | 0), (n = (n + Math.imul(M, ie)) | 0), (r = ((r = (r + Math.imul(M, ne)) | 0) + Math.imul(O, ie)) | 0), (o = (o + Math.imul(O, ne)) | 0), (n = (n + Math.imul(C, oe)) | 0), (r = ((r = (r + Math.imul(C, ae)) | 0) + Math.imul(P, oe)) | 0), (o = (o + Math.imul(P, ae)) | 0), (n = (n + Math.imul(A, ce)) | 0), (r = ((r = (r + Math.imul(A, ue)) | 0) + Math.imul(x, ce)) | 0), (o = (o + Math.imul(x, ue)) | 0), (n = (n + Math.imul(b, he)) | 0), (r = ((r = (r + Math.imul(b, fe)) | 0) + Math.imul(E, he)) | 0), (o = (o + Math.imul(E, fe)) | 0); var Pe = (((u + (n = (n + Math.imul(_, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(_, me)) | 0) + Math.imul(v, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(v, me)) | 0) + (r >>> 13)) | 0) + (Pe >>> 26)) | 0), (Pe &= 67108863), (n = Math.imul(k, q)), (r = ((r = Math.imul(k, Z)) + Math.imul(U, q)) | 0), (o = Math.imul(U, Z)), (n = (n + Math.imul(F, $)) | 0), (r = ((r = (r + Math.imul(F, ee)) | 0) + Math.imul(B, $)) | 0), (o = (o + Math.imul(B, ee)) | 0), (n = (n + Math.imul(I, ie)) | 0), (r = ((r = (r + Math.imul(I, ne)) | 0) + Math.imul(D, ie)) | 0), (o = (o + Math.imul(D, ne)) | 0), (n = (n + Math.imul(M, oe)) | 0), (r = ((r = (r + Math.imul(M, ae)) | 0) + Math.imul(O, oe)) | 0), (o = (o + Math.imul(O, ae)) | 0), (n = (n + Math.imul(C, ce)) | 0), (r = ((r = (r + Math.imul(C, ue)) | 0) + Math.imul(P, ce)) | 0), (o = (o + Math.imul(P, ue)) | 0), (n = (n + Math.imul(A, he)) | 0), (r = ((r = (r + Math.imul(A, fe)) | 0) + Math.imul(x, he)) | 0), (o = (o + Math.imul(x, fe)) | 0); var Re = (((u + (n = (n + Math.imul(b, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(b, me)) | 0) + Math.imul(E, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(E, me)) | 0) + (r >>> 13)) | 0) + (Re >>> 26)) | 0), (Re &= 67108863), (n = Math.imul(k, $)), (r = ((r = Math.imul(k, ee)) + Math.imul(U, $)) | 0), (o = Math.imul(U, ee)), (n = (n + Math.imul(F, ie)) | 0), (r = ((r = (r + Math.imul(F, ne)) | 0) + Math.imul(B, ie)) | 0), (o = (o + Math.imul(B, ne)) | 0), (n = (n + Math.imul(I, oe)) | 0), (r = ((r = (r + Math.imul(I, ae)) | 0) + Math.imul(D, oe)) | 0), (o = (o + Math.imul(D, ae)) | 0), (n = (n + Math.imul(M, ce)) | 0), (r = ((r = (r + Math.imul(M, ue)) | 0) + Math.imul(O, ce)) | 0), (o = (o + Math.imul(O, ue)) | 0), (n = (n + Math.imul(C, he)) | 0), (r = ((r = (r + Math.imul(C, fe)) | 0) + Math.imul(P, he)) | 0), (o = (o + Math.imul(P, fe)) | 0); var Me = (((u + (n = (n + Math.imul(A, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(A, me)) | 0) + Math.imul(x, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(x, me)) | 0) + (r >>> 13)) | 0) + (Me >>> 26)) | 0), (Me &= 67108863), (n = Math.imul(k, ie)), (r = ((r = Math.imul(k, ne)) + Math.imul(U, ie)) | 0), (o = Math.imul(U, ne)), (n = (n + Math.imul(F, oe)) | 0), (r = ((r = (r + Math.imul(F, ae)) | 0) + Math.imul(B, oe)) | 0), (o = (o + Math.imul(B, ae)) | 0), (n = (n + Math.imul(I, ce)) | 0), (r = ((r = (r + Math.imul(I, ue)) | 0) + Math.imul(D, ce)) | 0), (o = (o + Math.imul(D, ue)) | 0), (n = (n + Math.imul(M, he)) | 0), (r = ((r = (r + Math.imul(M, fe)) | 0) + Math.imul(O, he)) | 0), (o = (o + Math.imul(O, fe)) | 0); var Oe = (((u + (n = (n + Math.imul(C, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(C, me)) | 0) + Math.imul(P, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(P, me)) | 0) + (r >>> 13)) | 0) + (Oe >>> 26)) | 0), (Oe &= 67108863), (n = Math.imul(k, oe)), (r = ((r = Math.imul(k, ae)) + Math.imul(U, oe)) | 0), (o = Math.imul(U, ae)), (n = (n + Math.imul(F, ce)) | 0), (r = ((r = (r + Math.imul(F, ue)) | 0) + Math.imul(B, ce)) | 0), (o = (o + Math.imul(B, ue)) | 0), (n = (n + Math.imul(I, he)) | 0), (r = ((r = (r + Math.imul(I, fe)) | 0) + Math.imul(D, he)) | 0), (o = (o + Math.imul(D, fe)) | 0); var we = (((u + (n = (n + Math.imul(M, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(M, me)) | 0) + Math.imul(O, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(O, me)) | 0) + (r >>> 13)) | 0) + (we >>> 26)) | 0), (we &= 67108863), (n = Math.imul(k, ce)), (r = ((r = Math.imul(k, ue)) + Math.imul(U, ce)) | 0), (o = Math.imul(U, ue)), (n = (n + Math.imul(F, he)) | 0), (r = ((r = (r + Math.imul(F, fe)) | 0) + Math.imul(B, he)) | 0), (o = (o + Math.imul(B, fe)) | 0); var Ie = (((u + (n = (n + Math.imul(I, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(I, me)) | 0) + Math.imul(D, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(D, me)) | 0) + (r >>> 13)) | 0) + (Ie >>> 26)) | 0), (Ie &= 67108863), (n = Math.imul(k, he)), (r = ((r = Math.imul(k, fe)) + Math.imul(U, he)) | 0), (o = Math.imul(U, fe)); var De = (((u + (n = (n + Math.imul(F, pe)) | 0)) | 0) + ((8191 & (r = ((r = (r + Math.imul(F, me)) | 0) + Math.imul(B, pe)) | 0)) << 13)) | 0; (u = ((((o = (o + Math.imul(B, me)) | 0) + (r >>> 13)) | 0) + (De >>> 26)) | 0), (De &= 67108863); var Le = (((u + (n = Math.imul(k, pe))) | 0) + ((8191 & (r = ((r = Math.imul(k, me)) + Math.imul(U, pe)) | 0)) << 13)) | 0; return ( (u = ((((o = Math.imul(U, me)) + (r >>> 13)) | 0) + (Le >>> 26)) | 0), (Le &= 67108863), (c[0] = ge), (c[1] = _e), (c[2] = ve), (c[3] = ye), (c[4] = be), (c[5] = Ee), (c[6] = Te), (c[7] = Ae), (c[8] = xe), (c[9] = Se), (c[10] = Ce), (c[11] = Pe), (c[12] = Re), (c[13] = Me), (c[14] = Oe), (c[15] = we), (c[16] = Ie), (c[17] = De), (c[18] = Le), 0 !== u && ((c[19] = u), i.length++), i ); }; function m(e, t, i) { return new g().mulp(e, t, i); } function g(e, t) { (this.x = e), (this.y = t); } Math.imul || (p = d), (a.prototype.mulTo = function (e, t) { var i = this.length + e.length; return 10 === this.length && 10 === e.length ? p(this, e, t) : i < 63 ? d(this, e, t) : i < 1024 ? (function (e, t, i) { (i.negative = t.negative ^ e.negative), (i.length = e.length + t.length); for (var n = 0, r = 0, o = 0; o < i.length - 1; o++) { var a = r; r = 0; for ( var s = 67108863 & n, c = Math.min(o, t.length - 1), u = Math.max(0, o - e.length + 1); u <= c; u++ ) { var l = o - u, h = (0 | e.words[l]) * (0 | t.words[u]), f = 67108863 & h; (s = 67108863 & (f = (f + s) | 0)), (r += (a = ((a = (a + ((h / 67108864) | 0)) | 0) + (f >>> 26)) | 0) >>> 26), (a &= 67108863); } (i.words[o] = s), (n = a), (a = r); } return 0 !== n ? (i.words[o] = n) : i.length--, i.strip(); })(this, e, t) : m(this, e, t); }), (g.prototype.makeRBT = function (e) { for ( var t = new Array(e), i = a.prototype._countBits(e) - 1, n = 0; n < e; n++ ) t[n] = this.revBin(n, i, e); return t; }), (g.prototype.revBin = function (e, t, i) { if (0 === e || e === i - 1) return e; for (var n = 0, r = 0; r < t; r++) (n |= (1 & e) << (t - r - 1)), (e >>= 1); return n; }), (g.prototype.permute = function (e, t, i, n, r, o) { for (var a = 0; a < o; a++) (n[a] = t[e[a]]), (r[a] = i[e[a]]); }), (g.prototype.transform = function (e, t, i, n, r, o) { this.permute(o, e, t, i, n, r); for (var a = 1; a < r; a <<= 1) for ( var s = a << 1, c = Math.cos((2 * Math.PI) / s), u = Math.sin((2 * Math.PI) / s), l = 0; l < r; l += s ) for (var h = c, f = u, d = 0; d < a; d++) { var p = i[l + d], m = n[l + d], g = i[l + d + a], _ = n[l + d + a], v = h * g - f * _; (_ = h * _ + f * g), (g = v), (i[l + d] = p + g), (n[l + d] = m + _), (i[l + d + a] = p - g), (n[l + d + a] = m - _), d !== s && ((v = c * h - u * f), (f = c * f + u * h), (h = v)); } }), (g.prototype.guessLen13b = function (e, t) { var i = 1 | Math.max(t, e), n = 1 & i, r = 0; for (i = (i / 2) | 0; i; i >>>= 1) r++; return 1 << (r + 1 + n); }), (g.prototype.conjugate = function (e, t, i) { if (!(i <= 1)) for (var n = 0; n < i / 2; n++) { var r = e[n]; (e[n] = e[i - n - 1]), (e[i - n - 1] = r), (r = t[n]), (t[n] = -t[i - n - 1]), (t[i - n - 1] = -r); } }), (g.prototype.normalize13b = function (e, t) { for (var i = 0, n = 0; n < t / 2; n++) { var r = 8192 * Math.round(e[2 * n + 1] / t) + Math.round(e[2 * n] / t) + i; (e[n] = 67108863 & r), (i = r < 67108864 ? 0 : (r / 67108864) | 0); } return e; }), (g.prototype.convert13b = function (e, t, i, n) { for (var o = 0, a = 0; a < t; a++) (o += 0 | e[a]), (i[2 * a] = 8191 & o), (o >>>= 13), (i[2 * a + 1] = 8191 & o), (o >>>= 13); for (a = 2 * t; a < n; ++a) i[a] = 0; r(0 === o), r(0 == (-8192 & o)); }), (g.prototype.stub = function (e) { for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0; return t; }), (g.prototype.mulp = function (e, t, i) { var n = 2 * this.guessLen13b(e.length, t.length), r = this.makeRBT(n), o = this.stub(n), a = new Array(n), s = new Array(n), c = new Array(n), u = new Array(n), l = new Array(n), h = new Array(n), f = i.words; (f.length = n), this.convert13b(e.words, e.length, a, n), this.convert13b(t.words, t.length, u, n), this.transform(a, o, s, c, n, r), this.transform(u, o, l, h, n, r); for (var d = 0; d < n; d++) { var p = s[d] * l[d] - c[d] * h[d]; (c[d] = s[d] * h[d] + c[d] * l[d]), (s[d] = p); } return ( this.conjugate(s, c, n), this.transform(s, c, f, o, n, r), this.conjugate(f, o, n), this.normalize13b(f, n), (i.negative = e.negative ^ t.negative), (i.length = e.length + t.length), i.strip() ); }), (a.prototype.mul = function (e) { var t = new a(null); return ( (t.words = new Array(this.length + e.length)), this.mulTo(e, t) ); }), (a.prototype.mulf = function (e) { var t = new a(null); return (t.words = new Array(this.length + e.length)), m(this, e, t); }), (a.prototype.imul = function (e) { return this.clone().mulTo(e, this); }), (a.prototype.imuln = function (e) { r("number" == typeof e), r(e < 67108864); for (var t = 0, i = 0; i < this.length; i++) { var n = (0 | this.words[i]) * e, o = (67108863 & n) + (67108863 & t); (t >>= 26), (t += (n / 67108864) | 0), (t += o >>> 26), (this.words[i] = 67108863 & o); } return 0 !== t && ((this.words[i] = t), this.length++), this; }), (a.prototype.muln = function (e) { return this.clone().imuln(e); }), (a.prototype.sqr = function () { return this.mul(this); }), (a.prototype.isqr = function () { return this.imul(this.clone()); }), (a.prototype.pow = function (e) { var t = (function (e) { for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) { var n = (i / 26) | 0, r = i % 26; t[i] = (e.words[n] & (1 << r)) >>> r; } return t; })(e); if (0 === t.length) return new a(1); for ( var i = this, n = 0; n < t.length && 0 === t[n]; n++, i = i.sqr() ); if (++n < t.length) for (var r = i.sqr(); n < t.length; n++, r = r.sqr()) 0 !== t[n] && (i = i.mul(r)); return i; }), (a.prototype.iushln = function (e) { r("number" == typeof e && e >= 0); var t, i = e % 26, n = (e - i) / 26, o = (67108863 >>> (26 - i)) << (26 - i); if (0 !== i) { var a = 0; for (t = 0; t < this.length; t++) { var s = this.words[t] & o, c = ((0 | this.words[t]) - s) << i; (this.words[t] = c | a), (a = s >>> (26 - i)); } a && ((this.words[t] = a), this.length++); } if (0 !== n) { for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t]; for (t = 0; t < n; t++) this.words[t] = 0; this.length += n; } return this.strip(); }), (a.prototype.ishln = function (e) { return r(0 === this.negative), this.iushln(e); }), (a.prototype.iushrn = function (e, t, i) { var n; r("number" == typeof e && e >= 0), (n = t ? (t - (t % 26)) / 26 : 0); var o = e % 26, a = Math.min((e - o) / 26, this.length), s = 67108863 ^ ((67108863 >>> o) << o), c = i; if (((n -= a), (n = Math.max(0, n)), c)) { for (var u = 0; u < a; u++) c.words[u] = this.words[u]; c.length = a; } if (0 === a); else if (this.length > a) for (this.length -= a, u = 0; u < this.length; u++) this.words[u] = this.words[u + a]; else (this.words[0] = 0), (this.length = 1); var l = 0; for (u = this.length - 1; u >= 0 && (0 !== l || u >= n); u--) { var h = 0 | this.words[u]; (this.words[u] = (l << (26 - o)) | (h >>> o)), (l = h & s); } return ( c && 0 !== l && (c.words[c.length++] = l), 0 === this.length && ((this.words[0] = 0), (this.length = 1)), this.strip() ); }), (a.prototype.ishrn = function (e, t, i) { return r(0 === this.negative), this.iushrn(e, t, i); }), (a.prototype.shln = function (e) { return this.clone().ishln(e); }), (a.prototype.ushln = function (e) { return this.clone().iushln(e); }), (a.prototype.shrn = function (e) { return this.clone().ishrn(e); }), (a.prototype.ushrn = function (e) { return this.clone().iushrn(e); }), (a.prototype.testn = function (e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26, n = 1 << t; return !(this.length <= i) && !!(this.words[i] & n); }), (a.prototype.imaskn = function (e) { r("number" == typeof e && e >= 0); var t = e % 26, i = (e - t) / 26; if ( (r( 0 === this.negative, "imaskn works only with positive numbers" ), this.length <= i) ) return this; if ( (0 !== t && i++, (this.length = Math.min(i, this.length)), 0 !== t) ) { var n = 67108863 ^ ((67108863 >>> t) << t); this.words[this.length - 1] &= n; } return this.strip(); }), (a.prototype.maskn = function (e) { return this.clone().imaskn(e); }), (a.prototype.iaddn = function (e) { return ( r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ? 1 === this.length && (0 | this.words[0]) < e ? ((this.words[0] = e - (0 | this.words[0])), (this.negative = 0), this) : ((this.negative = 0), this.isubn(e), (this.negative = 1), this) : this._iaddn(e) ); }), (a.prototype._iaddn = function (e) { this.words[0] += e; for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) (this.words[t] -= 67108864), t === this.length - 1 ? (this.words[t + 1] = 1) : this.words[t + 1]++; return (this.length = Math.max(this.length, t + 1)), this; }), (a.prototype.isubn = function (e) { if ((r("number" == typeof e), r(e < 67108864), e < 0)) return this.iaddn(-e); if (0 !== this.negative) return ( (this.negative = 0), this.iaddn(e), (this.negative = 1), this ); if (((this.words[0] -= e), 1 === this.length && this.words[0] < 0)) (this.words[0] = -this.words[0]), (this.negative = 1); else for (var t = 0; t < this.length && this.words[t] < 0; t++) (this.words[t] += 67108864), (this.words[t + 1] -= 1); return this.strip(); }), (a.prototype.addn = function (e) { return this.clone().iaddn(e); }), (a.prototype.subn = function (e) { return this.clone().isubn(e); }), (a.prototype.iabs = function () { return (this.negative = 0), this; }), (a.prototype.abs = function () { return this.clone().iabs(); }), (a.prototype._ishlnsubmul = function (e, t, i) { var n, o, a = e.length + i; this._expand(a); var s = 0; for (n = 0; n < e.length; n++) { o = (0 | this.words[n + i]) + s; var c = (0 | e.words[n]) * t; (s = ((o -= 67108863 & c) >> 26) - ((c / 67108864) | 0)), (this.words[n + i] = 67108863 & o); } for (; n < this.length - i; n++) (s = (o = (0 | this.words[n + i]) + s) >> 26), (this.words[n + i] = 67108863 & o); if (0 === s) return this.strip(); for (r(-1 === s), s = 0, n = 0; n < this.length; n++) (s = (o = -(0 | this.words[n]) + s) >> 26), (this.words[n] = 67108863 & o); return (this.negative = 1), this.strip(); }), (a.prototype._wordDiv = function (e, t) { var i = (this.length, e.length), n = this.clone(), r = e, o = 0 | r.words[r.length - 1]; 0 !== (i = 26 - this._countBits(o)) && ((r = r.ushln(i)), n.iushln(i), (o = 0 | r.words[r.length - 1])); var s, c = n.length - r.length; if ("mod" !== t) { ((s = new a(null)).length = c + 1), (s.words = new Array(s.length)); for (var u = 0; u < s.length; u++) s.words[u] = 0; } var l = n.clone()._ishlnsubmul(r, 1, c); 0 === l.negative && ((n = l), s && (s.words[c] = 1)); for (var h = c - 1; h >= 0; h--) { var f = 67108864 * (0 | n.words[r.length + h]) + (0 | n.words[r.length + h - 1]); for ( f = Math.min((f / o) | 0, 67108863), n._ishlnsubmul(r, f, h); 0 !== n.negative; ) f--, (n.negative = 0), n._ishlnsubmul(r, 1, h), n.isZero() || (n.negative ^= 1); s && (s.words[h] = f); } return ( s && s.strip(), n.strip(), "div" !== t && 0 !== i && n.iushrn(i), { div: s || null, mod: n, } ); }), (a.prototype.divmod = function (e, t, i) { return ( r(!e.isZero()), this.isZero() ? { div: new a(0), mod: new a(0), } : 0 !== this.negative && 0 === e.negative ? ((s = this.neg().divmod(e, t)), "mod" !== t && (n = s.div.neg()), "div" !== t && ((o = s.mod.neg()), i && 0 !== o.negative && o.iadd(e)), { div: n, mod: o, }) : 0 === this.negative && 0 !== e.negative ? ((s = this.divmod(e.neg(), t)), "mod" !== t && (n = s.div.neg()), { div: n, mod: s.mod, }) : 0 != (this.negative & e.negative) ? ((s = this.neg().divmod(e.neg(), t)), "div" !== t && ((o = s.mod.neg()), i && 0 !== o.negative && o.isub(e)), { div: s.div, mod: o, }) : e.length > this.length || this.cmp(e) < 0 ? { div: new a(0), mod: this, } : 1 === e.length ? "div" === t ? { div: this.divn(e.words[0]), mod: null, } : "mod" === t ? { div: null, mod: new a(this.modn(e.words[0])), } : { div: this.divn(e.words[0]), mod: new a(this.modn(e.words[0])), } : this._wordDiv(e, t) ); var n, o, s; }), (a.prototype.div = function (e) { return this.divmod(e, "div", false).div; }), (a.prototype.mod = function (e) { return this.divmod(e, "mod", false).mod; }), (a.prototype.umod = function (e) { return this.divmod(e, "mod", true).mod; }), (a.prototype.divRound = function (e) { var t = this.divmod(e); if (t.mod.isZero()) return t.div; var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod, n = e.ushrn(1), r = e.andln(1), o = i.cmp(n); return o < 0 || (1 === r && 0 === o) ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn(1); }), (a.prototype.modn = function (e) { r(e <= 67108863); for (var t = (1 << 26) % e, i = 0, n = this.length - 1; n >= 0; n--) i = (t * i + (0 | this.words[n])) % e; return i; }), (a.prototype.idivn = function (e) { r(e <= 67108863); for (var t = 0, i = this.length - 1; i >= 0; i--) { var n = (0 | this.words[i]) + 67108864 * t; (this.words[i] = (n / e) | 0), (t = n % e); } return this.strip(); }), (a.prototype.divn = function (e) { return this.clone().idivn(e); }), (a.prototype.egcd = function (e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for ( var n = new a(1), o = new a(0), s = new a(0), c = new a(1), u = 0; t.isEven() && i.isEven(); ) t.iushrn(1), i.iushrn(1), ++u; for (var l = i.clone(), h = t.clone(); !t.isZero(); ) { for ( var f = 0, d = 1; 0 == (t.words[0] & d) && f < 26; ++f, d <<= 1 ); if (f > 0) for (t.iushrn(f); f-- > 0; ) (n.isOdd() || o.isOdd()) && (n.iadd(l), o.isub(h)), n.iushrn(1), o.iushrn(1); for ( var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1 ); if (p > 0) for (i.iushrn(p); p-- > 0; ) (s.isOdd() || c.isOdd()) && (s.iadd(l), c.isub(h)), s.iushrn(1), c.iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), n.isub(s), o.isub(c)) : (i.isub(t), s.isub(n), c.isub(o)); } return { a: s, b: c, gcd: i.iushln(u), }; }), (a.prototype._invmp = function (e) { r(0 === e.negative), r(!e.isZero()); var t = this, i = e.clone(); t = 0 !== t.negative ? t.umod(e) : t.clone(); for ( var n, o = new a(1), s = new a(0), c = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0; ) { for ( var u = 0, l = 1; 0 == (t.words[0] & l) && u < 26; ++u, l <<= 1 ); if (u > 0) for (t.iushrn(u); u-- > 0; ) o.isOdd() && o.iadd(c), o.iushrn(1); for ( var h = 0, f = 1; 0 == (i.words[0] & f) && h < 26; ++h, f <<= 1 ); if (h > 0) for (i.iushrn(h); h-- > 0; ) s.isOdd() && s.iadd(c), s.iushrn(1); t.cmp(i) >= 0 ? (t.isub(i), o.isub(s)) : (i.isub(t), s.isub(o)); } return (n = 0 === t.cmpn(1) ? o : s).cmpn(0) < 0 && n.iadd(e), n; }), (a.prototype.gcd = function (e) { if (this.isZero()) return e.abs(); if (e.isZero()) return this.abs(); var t = this.clone(), i = e.clone(); (t.negative = 0), (i.negative = 0); for (var n = 0; t.isEven() && i.isEven(); n++) t.iushrn(1), i.iushrn(1); for (;;) { for (; t.isEven(); ) t.iushrn(1); for (; i.isEven(); ) i.iushrn(1); var r = t.cmp(i); if (r < 0) { var o = t; (t = i), (i = o); } else if (0 === r || 0 === i.cmpn(1)) break; t.isub(i); } return i.iushln(n); }), (a.prototype.invm = function (e) { return this.egcd(e).a.umod(e); }), (a.prototype.isEven = function () { return 0 == (1 & this.words[0]); }), (a.prototype.isOdd = function () { return 1 == (1 & this.words[0]); }), (a.prototype.andln = function (e) { return this.words[0] & e; }), (a.prototype.bincn = function (e) { r("number" == typeof e); var t = e % 26, i = (e - t) / 26, n = 1 << t; if (this.length <= i) return this._expand(i + 1), (this.words[i] |= n), this; for (var o = n, a = i; 0 !== o && a < this.length; a++) { var s = 0 | this.words[a]; (o = (s += o) >>> 26), (s &= 67108863), (this.words[a] = s); } return 0 !== o && ((this.words[a] = o), this.length++), this; }), (a.prototype.isZero = function () { return 1 === this.length && 0 === this.words[0]; }), (a.prototype.cmpn = function (e) { var t, i = e < 0; if (0 !== this.negative && !i) return -1; if (0 === this.negative && i) return 1; if ((this.strip(), this.length > 1)) t = 1; else { i && (e = -e), r(e <= 67108863, "Number is too big"); var n = 0 | this.words[0]; t = n === e ? 0 : n < e ? -1 : 1; } return 0 !== this.negative ? 0 | -t : t; }), (a.prototype.cmp = function (e) { if (0 !== this.negative && 0 === e.negative) return -1; if (0 === this.negative && 0 !== e.negative) return 1; var t = this.ucmp(e); return 0 !== this.negative ? 0 | -t : t; }), (a.prototype.ucmp = function (e) { if (this.length > e.length) return 1; if (this.length < e.length) return -1; for (var t = 0, i = this.length - 1; i >= 0; i--) { var n = 0 | this.words[i], r = 0 | e.words[i]; if (n !== r) { n < r ? (t = -1) : n > r && (t = 1); break; } } return t; }), (a.prototype.gtn = function (e) { return 1 === this.cmpn(e); }), (a.prototype.gt = function (e) { return 1 === this.cmp(e); }), (a.prototype.gten = function (e) { return this.cmpn(e) >= 0; }), (a.prototype.gte = function (e) { return this.cmp(e) >= 0; }), (a.prototype.ltn = function (e) { return -1 === this.cmpn(e); }), (a.prototype.lt = function (e) { return -1 === this.cmp(e); }), (a.prototype.lten = function (e) { return this.cmpn(e) <= 0; }), (a.prototype.lte = function (e) { return this.cmp(e) <= 0; }), (a.prototype.eqn = function (e) { return 0 === this.cmpn(e); }), (a.prototype.eq = function (e) { return 0 === this.cmp(e); }), (a.red = function (e) { return new A(e); }), (a.prototype.toRed = function (e) { return ( r(!this.red, "Already a number in reduction context"), r(0 === this.negative, "red works only with positives"), e.convertTo(this)._forceRed(e) ); }), (a.prototype.fromRed = function () { return ( r( this.red, "fromRed works only with numbers in reduction context" ), this.red.convertFrom(this) ); }), (a.prototype._forceRed = function (e) { return (this.red = e), this; }), (a.prototype.forceRed = function (e) { return ( r(!this.red, "Already a number in reduction context"), this._forceRed(e) ); }), (a.prototype.redAdd = function (e) { return ( r(this.red, "redAdd works only with red numbers"), this.red.add(this, e) ); }), (a.prototype.redIAdd = function (e) { return ( r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e) ); }), (a.prototype.redSub = function (e) { return ( r(this.red, "redSub works only with red numbers"), this.red.sub(this, e) ); }), (a.prototype.redISub = function (e) { return ( r(this.red, "redISub works only with red numbers"), this.red.isub(this, e) ); }), (a.prototype.redShl = function (e) { return ( r(this.red, "redShl works only with red numbers"), this.red.shl(this, e) ); }), (a.prototype.redMul = function (e) { return ( r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red.mul(this, e) ); }), (a.prototype.redIMul = function (e) { return ( r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red.imul(this, e) ); }), (a.prototype.redSqr = function () { return ( r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this) ); }), (a.prototype.redISqr = function () { return ( r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this) ); }), (a.prototype.redSqrt = function () { return ( r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this) ); }), (a.prototype.redInvm = function () { return ( r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this) ); }), (a.prototype.redNeg = function () { return ( r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this) ); }), (a.prototype.redPow = function (e) { return ( r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e) ); }); var _ = { k256: null, p224: null, p192: null, p25519: null, }; function v(e, t) { (this.name = e), (this.p = new a(t, 16)), (this.n = this.p.bitLength()), (this.k = new a(1).iushln(this.n).isub(this.p)), (this.tmp = this._tmp()); } function y() { v.call( this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f" ); } function b() { v.call( this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001" ); } function E() { v.call( this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff" ); } function T() { v.call( this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" ); } function A(e) { if ("string" == typeof e) { var t = a._prime(e); (this.m = t.p), (this.prime = t); } else r(e.gtn(1), "modulus must be greater than 1"), (this.m = e), (this.prime = null); } function x(e) { A.call(this, e), (this.shift = this.m.bitLength()), this.shift % 26 != 0 && (this.shift += 26 - (this.shift % 26)), (this.r = new a(1).iushln(this.shift)), (this.r2 = this.imod(this.r.sqr())), (this.rinv = this.r._invmp(this.m)), (this.minv = this.rinv.mul(this.r).isubn(1).div(this.m)), (this.minv = this.minv.umod(this.r)), (this.minv = this.r.sub(this.minv)); } (v.prototype._tmp = function () { var e = new a(null); return (e.words = new Array(Math.ceil(this.n / 13))), e; }), (v.prototype.ireduce = function (e) { var t, i = e; do { this.split(i, this.tmp), (t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength()); } while (t > this.n); var n = t < this.n ? -1 : i.ucmp(this.p); return ( 0 === n ? ((i.words[0] = 0), (i.length = 1)) : n > 0 ? i.isub(this.p) : i.strip(), i ); }), (v.prototype.split = function (e, t) { e.iushrn(this.n, 0, t); }), (v.prototype.imulK = function (e) { return e.imul(this.k); }), o(y, v), (y.prototype.split = function (e, t) { for (var i = Math.min(e.length, 9), n = 0; n < i; n++) t.words[n] = e.words[n]; if (((t.length = i), e.length <= 9)) return (e.words[0] = 0), void (e.length = 1); var r = e.words[9]; for (t.words[t.length++] = 4194303 & r, n = 10; n < e.length; n++) { var o = 0 | e.words[n]; (e.words[n - 10] = ((4194303 & o) << 4) | (r >>> 22)), (r = o); } (r >>>= 22), (e.words[n - 10] = r), 0 === r && e.length > 10 ? (e.length -= 10) : (e.length -= 9); }), (y.prototype.imulK = function (e) { (e.words[e.length] = 0), (e.words[e.length + 1] = 0), (e.length += 2); for (var t = 0, i = 0; i < e.length; i++) { var n = 0 | e.words[i]; (t += 977 * n), (e.words[i] = 67108863 & t), (t = 64 * n + ((t / 67108864) | 0)); } return ( 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e ); }), o(b, v), o(E, v), o(T, v), (T.prototype.imulK = function (e) { for (var t = 0, i = 0; i < e.length; i++) { var n = 19 * (0 | e.words[i]) + t, r = 67108863 & n; (n >>>= 26), (e.words[i] = r), (t = n); } return 0 !== t && (e.words[e.length++] = t), e; }), (a._prime = function (e) { if (_[e]) return _[e]; var t; if ("k256" === e) t = new y(); else if ("p224" === e) t = new b(); else if ("p192" === e) t = new E(); else { if ("p25519" !== e) throw new Error("Unknown prime " + e); t = new T(); } return (_[e] = t), t; }), (A.prototype._verify1 = function (e) { r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers"); }), (A.prototype._verify2 = function (e, t) { r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red, "red works only with red numbers"); }), (A.prototype.imod = function (e) { return this.prime ? this.prime.ireduce(e)._forceRed(this) : e.umod(this.m)._forceRed(this); }), (A.prototype.neg = function (e) { return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this); }), (A.prototype.add = function (e, t) { this._verify2(e, t); var i = e.add(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this); }), (A.prototype.iadd = function (e, t) { this._verify2(e, t); var i = e.iadd(t); return i.cmp(this.m) >= 0 && i.isub(this.m), i; }), (A.prototype.sub = function (e, t) { this._verify2(e, t); var i = e.sub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this); }), (A.prototype.isub = function (e, t) { this._verify2(e, t); var i = e.isub(t); return i.cmpn(0) < 0 && i.iadd(this.m), i; }), (A.prototype.shl = function (e, t) { return this._verify1(e), this.imod(e.ushln(t)); }), (A.prototype.imul = function (e, t) { return this._verify2(e, t), this.imod(e.imul(t)); }), (A.prototype.mul = function (e, t) { return this._verify2(e, t), this.imod(e.mul(t)); }), (A.prototype.isqr = function (e) { return this.imul(e, e.clone()); }), (A.prototype.sqr = function (e) { return this.mul(e, e); }), (A.prototype.sqrt = function (e) { if (e.isZero()) return e.clone(); var t = this.m.andln(3); if ((r(t % 2 == 1), 3 === t)) { var i = this.m.add(new a(1)).iushrn(2); return this.pow(e, i); } for ( var n = this.m.subn(1), o = 0; !n.isZero() && 0 === n.andln(1); ) o++, n.iushrn(1); r(!n.isZero()); var s = new a(1).toRed(this), c = s.redNeg(), u = this.m.subn(1).iushrn(1), l = this.m.bitLength(); for ( l = new a(2 * l * l).toRed(this); 0 !== this.pow(l, u).cmp(c); ) l.redIAdd(c); for ( var h = this.pow(l, n), f = this.pow(e, n.addn(1).iushrn(1)), d = this.pow(e, n), p = o; 0 !== d.cmp(s); ) { for (var m = d, g = 0; 0 !== m.cmp(s); g++) m = m.redSqr(); r(g < p); var _ = this.pow(h, new a(1).iushln(p - g - 1)); (f = f.redMul(_)), (h = _.redSqr()), (d = d.redMul(h)), (p = g); } return f; }), (A.prototype.invm = function (e) { var t = e._invmp(this.m); return 0 !== t.negative ? ((t.negative = 0), this.imod(t).redNeg()) : this.imod(t); }), (A.prototype.pow = function (e, t) { if (t.isZero()) return new a(1).toRed(this); if (0 === t.cmpn(1)) return e.clone(); var i = new Array(16); (i[0] = new a(1).toRed(this)), (i[1] = e); for (var n = 2; n < i.length; n++) i[n] = this.mul(i[n - 1], e); var r = i[0], o = 0, s = 0, c = t.bitLength() % 26; for (0 === c && (c = 26), n = t.length - 1; n >= 0; n--) { for (var u = t.words[n], l = c - 1; l >= 0; l--) { var h = (u >> l) & 1; r !== i[0] && (r = this.sqr(r)), 0 !== h || 0 !== o ? ((o <<= 1), (o |= h), (4 === ++s || (0 === n && 0 === l)) && ((r = this.mul(r, i[o])), (s = 0), (o = 0))) : (s = 0); } c = 26; } return r; }), (A.prototype.convertTo = function (e) { var t = e.umod(this.m); return t === e ? t.clone() : t; }), (A.prototype.convertFrom = function (e) { var t = e.clone(); return (t.red = null), t; }), (a.mont = function (e) { return new x(e); }), o(x, A), (x.prototype.convertTo = function (e) { return this.imod(e.ushln(this.shift)); }), (x.prototype.convertFrom = function (e) { var t = this.imod(e.mul(this.rinv)); return (t.red = null), t; }), (x.prototype.imul = function (e, t) { if (e.isZero() || t.isZero()) return (e.words[0] = 0), (e.length = 1), e; var i = e.imul(t), n = i .maskn(this.shift) .mul(this.minv) .imaskn(this.shift) .mul(this.m), r = i.isub(n).iushrn(this.shift), o = r; return ( r.cmp(this.m) >= 0 ? (o = r.isub(this.m)) : r.cmpn(0) < 0 && (o = r.iadd(this.m)), o._forceRed(this) ); }), (x.prototype.mul = function (e, t) { if (e.isZero() || t.isZero()) return new a(0)._forceRed(this); var i = e.mul(t), n = i .maskn(this.shift) .mul(this.minv) .imaskn(this.shift) .mul(this.m), r = i.isub(n).iushrn(this.shift), o = r; return ( r.cmp(this.m) >= 0 ? (o = r.isub(this.m)) : r.cmpn(0) < 0 && (o = r.iadd(this.m)), o._forceRed(this) ); }), (x.prototype.invm = function (e) { return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this); }); })(e, this); }.call(this, i(122)(e))); }, function (e, t, i) { var n = i(4), r = i(138), o = i(39), a = Object.defineProperty; t.f = i(13) ? Object.defineProperty : function (e, t, i) { if ((n(e), (t = o(t, true)), n(i), r)) try { return a(e, t, i); } catch (e) {} if ("get" in i || "set" in i) throw TypeError("Accessors not supported!"); return "value" in i && (e[t] = i.value), e; }; }, function (e, t, i) { e.exports = !i(3)(function () { return ( 7 != Object.defineProperty({}, "a", { get: function () { return 7; }, }).a ); }); }, function (exp, t) { var i = (exp.exports = { version: "2.6.0", }); "number" == typeof __e && (__e = i); }, function (e, t) { function i(e) { return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var n; n = (function () { return this; })(); try { n = n || new Function("return this")(); } catch (e) { "object" === ("undefined" == typeof window ? "undefined" : i(window)) && (n = window); } e.exports = n; }, function (exp, unused_arg, getterFunc) { // vec3Math i = 16 exp.exports = { EPSILON: getterFunc(173), create: getterFunc(174), clone: getterFunc(413), angle: getterFunc(414), fromValues: getterFunc(175), copy: getterFunc(415), set: getterFunc(416), equals: getterFunc(417), exactEquals: getterFunc(418), add: getterFunc(419), subtract: getterFunc(178), sub: getterFunc(420), multiply: getterFunc(179), mul: getterFunc(421), divide: getterFunc(180), div: getterFunc(422), min: getterFunc(423), max: getterFunc(424), floor: getterFunc(425), ceil: getterFunc(426), round: getterFunc(427), scale: getterFunc(428), scaleAndAdd: getterFunc(429), distance: getterFunc(181), dist: getterFunc(430), squaredDistance: getterFunc(182), sqrDist: getterFunc(431), length: getterFunc(183), len: getterFunc(432), squaredLength: getterFunc(184), sqrLen: getterFunc(433), negate: getterFunc(434), inverse: getterFunc(435), normalize: getterFunc(176), dot: getterFunc(177), cross: getterFunc(436), lerp: getterFunc(437), random: getterFunc(438), transformMat4: getterFunc(439), transformMat3: getterFunc(440), transformQuat: getterFunc(441), rotateX: getterFunc(442), rotateY: getterFunc(443), rotateZ: getterFunc(444), forEach: getterFunc(445), }; }, function (e, t, getterFunc) { "use strict"; var n = t; (n.version = getterFunc(549).version), (n.utils = getterFunc(550)), (n.rand = getterFunc(213)), (n.curve = getterFunc(91)), (n.curves = getterFunc(555)), (n.ec = getterFunc(563)), (n.eddsa = getterFunc(567)); }, function (e, t, i) { "use strict"; (function (e) { function n(t, i, n, r, o, a, s) { try { var c = t[a](s), u = c.value; } catch (e) { return void n(e); } c.done ? i(u) : e.resolve(u).then(r, o); } function r(t) { return function () { var i = this, r = arguments; return new e(function (e, o) { var a = t.apply(i, r); function s(t) { n(a, e, o, s, c, "next", t); } function c(t) { n(a, e, o, s, c, "throw", t); } s(void 0); }); }; } function o(e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; (n.enumerable = n.enumerable || false), (n.configurable = true), "value" in n && (n.writable = true), Object.defineProperty(e, n.key, n); } } var a = i(397), s = (function () { function t() { !(function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); })(this, t); } var i, n, s; return ( (i = t), (n = null), (s = [ { key: "init", value: function () { (self.baseUrl = a.backendBaseUrl), (self.socket = null); }, }, { key: "getICECandidates", value: function (i) { return new e(function (e, n) { t.executeXhr("/get-ice-candidates/" + i, "get").then( function (t) { e([JSON.parse(t).v.iceServers]); } ); }); }, }, { key: "getNewGame", value: function () { return new e(function (e, i) { t.executeXhr("/game", "get").then(function (i) { var n = JSON.parse(i); e(n), setInterval(function () { t.executeXhr( "/game/" + n.code + "/heartbeat", "put" ).then(function (e) {}); }, 3e4); }); }); }, }, { key: "getGame", value: function (i) { return null == i ? t.getNewGame() : new e(function (e, n) { t.executeXhr("/game/" + i, "get").then( function (t) { e(JSON.parse(t)); }, function (t) { e(null); } ); }); }, }, { key: "listenForData", value: (function () { var e = r( regeneratorRuntime.mark(function e(t, i) { return regeneratorRuntime.wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if (null !== self.socket) { e.next = 3; break; } return ( console.log("no socket!"), e.abrupt("return") ); case 3: socket.addEventListener( "message", function (e) { var t = JSON.parse(e.data), n = { payload: t.p, meta: t.m, msgEvent: t.o, to: t.m.t, from: t.m.f, }; i(n); } ); case 4: case "end": return e.stop(); } }, e, this ); }) ); return function (t, i) { return e.apply(this, arguments); }; })(), }, { key: "createSignalingChannel", value: (function () { var i = r( regeneratorRuntime.mark(function i(n, o) { return regeneratorRuntime.wrap( function (i) { for (;;) switch ((i.prev = i.next)) { case 0: return i.abrupt( "return", new e( (function () { var e = r( regeneratorRuntime.mark(function e( i, r ) { var a; return regeneratorRuntime.wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: return ( (e.next = 2), t.executeXhr( "/create-channel/" + n, "get" ) ); case 2: return ( (e.next = 4), t.getWebSocket(n, o) ); case 4: (a = e.sent), (self.socket = a), a.addEventListener( "open", function () { i(), setInterval( function () { a.send("ping"); }, 800 ); } ); case 7: case "end": return e.stop(); } }, e, this ); }) ); return function (t, i) { return e.apply(this, arguments); }; })() ) ); case 1: case "end": return i.stop(); } }, i, this ); }) ); return function (e, t) { return i.apply(this, arguments); }; })(), }, { key: "joinSignalingChannel", value: (function () { var i = r( regeneratorRuntime.mark(function i(n, o) { return regeneratorRuntime.wrap( function (i) { for (;;) switch ((i.prev = i.next)) { case 0: return i.abrupt( "return", new e( (function () { var e = r( regeneratorRuntime.mark(function e( i, r ) { var a; return regeneratorRuntime.wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: return ( (e.next = 2), t.getWebSocket(n, o) ); case 2: (a = e.sent), (self.socket = a), a.addEventListener( "open", function () { i(), setInterval( function () { a.send("ping"); }, 800 ); } ); case 5: case "end": return e.stop(); } }, e, this ); }) ); return function (t, i) { return e.apply(this, arguments); }; })() ) ); case 1: case "end": return i.stop(); } }, i, this ); }) ); return function (e, t) { return i.apply(this, arguments); }; })(), }, { key: "sendSignalingTo", value: (function () { var e = r( regeneratorRuntime.mark(function e(t, i, n, r) { var o; return regeneratorRuntime.wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if (null !== self.socket) { e.next = 3; break; } return ( console.log("no socket!"), e.abrupt("return") ); case 3: (o = { t: "u", m: { f: t + "/" + n, t: i, o: "message", }, p: { signal: JSON.stringify(r), }, }), self.socket.send(JSON.stringify(o)); case 5: case "end": return e.stop(); } }, e, this ); }) ); return function (t, i, n, r) { return e.apply(this, arguments); }; })(), }, { key: "getWebSocket", value: (function () { var e = r( regeneratorRuntime.mark(function e(i, n) { var r, o, a; return regeneratorRuntime.wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: return ( (e.t0 = JSON), (e.next = 3), t.executeXhr( "/get-signaling-token/" + i + "/" + n, "get" ) ); case 3: return ( (e.t1 = e.sent), (r = e.t0.parse.call(e.t0, e.t1).v), (e.t2 = JSON), (e.next = 8), t.executeXhr( "/get-signaling-host/" + i + "/" + n, "get" ) ); case 8: return ( (e.t3 = e.sent), (o = e.t2.parse.call(e.t2, e.t3).v), (a = o + "/v2/" + r), e.abrupt("return", new WebSocket(a)) ); case 12: case "end": return e.stop(); } }, e, this ); }) ); return function (t, i) { return e.apply(this, arguments); }; })(), }, { key: "addPlayerToGame", value: function (i, n) { return new e(function (e, n) { t.executeXhr("/game/" + i, "put").then(function (t) { e(JSON.parse(t)); }); }); }, }, { key: "pathUrl", value: function (e) { return self.baseUrl + e; }, }, { key: "executeXhr", value: function (i, n) { return new e(function (e, r) { var o = new XMLHttpRequest(), a = t.pathUrl(i); o.open(n, a), (o.onreadystatechange = function () { 4 !== o.readyState || 404 !== o.status || r(); }), o.send(), (o.onload = function () { e(o.responseText); }), (o.onerror = function (e) { console.log(e), r(e); }); }); }, }, ]), n && o(i.prototype, n), s && o(i, s), t ); })(); t.a = s; }.call(this, i(41))); }, function (e, t, i) { var n = i(5), r = i(23), o = i(22), a = i(46)("src"), s = Function.toString, c = ("" + s).split("toString"); (i(14).inspectSource = function (e) { return s.call(e); }), (e.exports = function (e, t, i, s) { var u = "function" == typeof i; u && (o(i, "name") || r(i, "name", t)), e[t] !== i && (u && (o(i, a) || r(i, a, e[t] ? "" + e[t] : c.join(String(t)))), e === n ? (e[t] = i) : s ? e[t] ? (e[t] = i) : r(e, t, i) : (delete e[t], r(e, t, i))); })(Function.prototype, "toString", function () { return ("function" == typeof this && this[a]) || s.call(this); }); }, function (e, t, i) { var n = i(37); e.exports = function (e) { return Object(n(e)); }; }, function (e, t, i) { var n = i(0), r = i(3), o = i(37), a = /"/g, s = function (e, t, i, n) { var r = String(o(e)), s = "<" + t; return ( "" !== i && (s += " " + i + '="' + String(n).replace(a, """) + '"'), s + ">" + r + "" ); }; e.exports = function (e, t) { var i = {}; (i[e] = t(s)), n( n.P + n.F * r(function () { var t = ""[e]('"'); return t !== t.toLowerCase() || t.split('"').length > 3; }), "String", i ); }; }, function (e, t) { var i = {}.hasOwnProperty; e.exports = function (e, t) { return i.call(e, t); }; }, function (e, t, i) { var n = i(12), r = i(45); e.exports = i(13) ? function (e, t, i) { return n.f(e, t, r(1, i)); } : function (e, t, i) { return (e[t] = i), e; }; }, function (e, t, i) { var n = i(64), r = i(37); e.exports = function (e) { return n(r(e)); }; }, function (e, t) { function i(e, t) { if (!e) throw new Error(t || "Assertion failed"); } (e.exports = i), (i.equal = function (e, t, i) { if (e != t) throw new Error(i || "Assertion failed: " + e + " != " + t); }); }, function (e, t, i) { "use strict"; var n = i(3); e.exports = function (e, t) { return ( !!e && n(function () { t ? e.call(null, function () {}, 1) : e.call(null); }) ); }; }, function (e, t) { var i, n, r = (e.exports = {}); function o() { throw new Error("setTimeout has not been defined"); } function a() { throw new Error("clearTimeout has not been defined"); } function s(e) { if (i === setTimeout) return setTimeout(e, 0); if ((i === o || !i) && setTimeout) return (i = setTimeout), setTimeout(e, 0); try { return i(e, 0); } catch (t) { try { return i.call(null, e, 0); } catch (t) { return i.call(this, e, 0); } } } !(function () { try { i = "function" == typeof setTimeout ? setTimeout : o; } catch (e) { i = o; } try { n = "function" == typeof clearTimeout ? clearTimeout : a; } catch (e) { n = a; } })(); var c, u = [], l = false, h = -1; function f() { l && c && ((l = false), c.length ? (u = c.concat(u)) : (h = -1), u.length && d()); } function d() { if (!l) { var e = s(f); l = true; for (var t = u.length; t; ) { for (c = u, u = []; ++h < t; ) c && c[h].run(); (h = -1), (t = u.length); } (c = null), (l = false), (function (e) { if (n === clearTimeout) return clearTimeout(e); if ((n === a || !n) && clearTimeout) return (n = clearTimeout), clearTimeout(e); try { n(e); } catch (t) { try { return n.call(null, e); } catch (t) { return n.call(this, e); } } })(e); } } function p(e, t) { (this.fun = e), (this.array = t); } function m() {} (r.nextTick = function (e) { var t = new Array(arguments.length - 1); if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) t[i - 1] = arguments[i]; u.push(new p(e, t)), 1 !== u.length || l || s(d); }), (p.prototype.run = function () { this.fun.apply(null, this.array); }), (r.title = "browser"), (r.browser = true), (r.env = {}), (r.argv = []), (r.version = ""), (r.versions = {}), (r.on = m), (r.addListener = m), (r.once = m), (r.off = m), (r.removeListener = m), (r.removeAllListeners = m), (r.emit = m), (r.prependListener = m), (r.prependOnceListener = m), (r.listeners = function (e) { return []; }), (r.binding = function (e) { throw new Error("process.binding is not supported"); }), (r.cwd = function () { return "/"; }), (r.chdir = function (e) { throw new Error("process.chdir is not supported"); }), (r.umask = function () { return 0; }); }, function (e, t) { var i = Math.ceil, n = Math.floor; e.exports = function (e) { return isNaN((e = +e)) ? 0 : (e > 0 ? n : i)(e); }; }, function (e, t, i) { var n = i(65), r = i(45), o = i(24), a = i(39), s = i(22), c = i(138), u = Object.getOwnPropertyDescriptor; t.f = i(13) ? u : function (e, t) { if (((e = o(e)), (t = a(t, true)), c)) try { return u(e, t); } catch (e) {} if (s(e, t)) return r(!n.f.call(e, t), e[t]); }; }, function (e, t, i) { var n = i(0), r = i(14), o = i(3); e.exports = function (e, t) { var i = (r.Object || {})[e] || Object[e], a = {}; (a[e] = t(i)), n( n.S + n.F * o(function () { i(1); }), "Object", a ); }; }, function (e, t, i) { var n = i(34), r = i(64), o = i(20), a = i(10), s = i(321); e.exports = function (e, t) { var i = 1 == e, c = 2 == e, u = 3 == e, l = 4 == e, h = 6 == e, f = 5 == e || h, d = t || s; return function (t, s, p) { for ( var m, g, _ = o(t), v = r(_), y = n(s, p, 3), b = a(v.length), E = 0, T = i ? d(t, b) : c ? d(t, 0) : void 0; b > E; E++ ) if ((f || E in v) && ((g = y((m = v[E]), E, _)), e)) if (i) T[E] = g; else if (g) switch (e) { case 3: return true; case 5: return m; case 6: return E; case 2: T.push(m); } else if (l) return false; return h ? -1 : u || l ? l : T; }; }; }, function (e, t, i) { "use strict"; function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = Object.prototype.hasOwnProperty, o = Object.prototype.toString, a = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = function (e) { return "function" == typeof Array.isArray ? Array.isArray(e) : "[object Array]" === o.call(e); }, u = function (e) { if (!e || "[object Object]" !== o.call(e)) return false; var t, i = r.call(e, "constructor"), n = e.constructor && e.constructor.prototype && r.call(e.constructor.prototype, "isPrototypeOf"); if (e.constructor && !i && !n) return false; for (t in e); return void 0 === t || r.call(e, t); }, l = function (e, t) { a && "__proto__" === t.name ? a(e, t.name, { enumerable: true, configurable: true, value: t.newValue, writable: true, }) : (e[t.name] = t.newValue); }, h = function (e, t) { if ("__proto__" === t) { if (!r.call(e, t)) return; if (s) return s(e, t).value; } return e[t]; }; e.exports = function e() { var t, i, r, o, a, s, f = arguments[0], d = 1, p = arguments.length, m = false; for ( "boolean" == typeof f && ((m = f), (f = arguments[1] || {}), (d = 2)), (null == f || ("object" !== n(f) && "function" != typeof f)) && (f = {}); d < p; ++d ) if (null != (t = arguments[d])) for (i in t) (r = h(f, i)), f !== (o = h(t, i)) && (m && o && (u(o) || (a = c(o))) ? (a ? ((a = false), (s = r && c(r) ? r : [])) : (s = r && u(r) ? r : {}), l(f, { name: i, newValue: e(m, s, o), })) : void 0 !== o && l(f, { name: i, newValue: o, })); return f; }; }, function (e, t, i) { "use strict"; var n = i(25), r = i(1); function o(e, t) { return ( 55296 == (64512 & e.charCodeAt(t)) && !(t < 0 || t + 1 >= e.length) && 56320 == (64512 & e.charCodeAt(t + 1)) ); } function a(e) { return ( ((e >>> 24) | ((e >>> 8) & 65280) | ((e << 8) & 16711680) | ((255 & e) << 24)) >>> 0 ); } function s(e) { return 1 === e.length ? "0" + e : e; } function c(e) { return 7 === e.length ? "0" + e : 6 === e.length ? "00" + e : 5 === e.length ? "000" + e : 4 === e.length ? "0000" + e : 3 === e.length ? "00000" + e : 2 === e.length ? "000000" + e : 1 === e.length ? "0000000" + e : e; } (t.inherits = r), (t.toArray = function (e, t) { if (Array.isArray(e)) return e.slice(); if (!e) return []; var i = []; if ("string" == typeof e) if (t) { if ("hex" === t) for ( (e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), r = 0; r < e.length; r += 2 ) i.push(parseInt(e[r] + e[r + 1], 16)); } else for (var n = 0, r = 0; r < e.length; r++) { var a = e.charCodeAt(r); a < 128 ? (i[n++] = a) : a < 2048 ? ((i[n++] = (a >> 6) | 192), (i[n++] = (63 & a) | 128)) : o(e, r) ? ((a = 65536 + ((1023 & a) << 10) + (1023 & e.charCodeAt(++r))), (i[n++] = (a >> 18) | 240), (i[n++] = ((a >> 12) & 63) | 128), (i[n++] = ((a >> 6) & 63) | 128), (i[n++] = (63 & a) | 128)) : ((i[n++] = (a >> 12) | 224), (i[n++] = ((a >> 6) & 63) | 128), (i[n++] = (63 & a) | 128)); } else for (r = 0; r < e.length; r++) i[r] = 0 | e[r]; return i; }), (t.toHex = function (e) { for (var t = "", i = 0; i < e.length; i++) t += s(e[i].toString(16)); return t; }), (t.htonl = a), (t.toHex32 = function (e, t) { for (var i = "", n = 0; n < e.length; n++) { var r = e[n]; "little" === t && (r = a(r)), (i += c(r.toString(16))); } return i; }), (t.zero2 = s), (t.zero8 = c), (t.join32 = function (e, t, i, r) { var o = i - t; n(o % 4 == 0); for ( var a = new Array(o / 4), s = 0, c = t; s < a.length; s++, c += 4 ) { var u; (u = "big" === r ? (e[c] << 24) | (e[c + 1] << 16) | (e[c + 2] << 8) | e[c + 3] : (e[c + 3] << 24) | (e[c + 2] << 16) | (e[c + 1] << 8) | e[c]), (a[s] = u >>> 0); } return a; }), (t.split32 = function (e, t) { for ( var i = new Array(4 * e.length), n = 0, r = 0; n < e.length; n++, r += 4 ) { var o = e[n]; "big" === t ? ((i[r] = o >>> 24), (i[r + 1] = (o >>> 16) & 255), (i[r + 2] = (o >>> 8) & 255), (i[r + 3] = 255 & o)) : ((i[r + 3] = o >>> 24), (i[r + 2] = (o >>> 16) & 255), (i[r + 1] = (o >>> 8) & 255), (i[r] = 255 & o)); } return i; }), (t.rotr32 = function (e, t) { return (e >>> t) | (e << (32 - t)); }), (t.rotl32 = function (e, t) { return (e << t) | (e >>> (32 - t)); }), (t.sum32 = function (e, t) { return (e + t) >>> 0; }), (t.sum32_3 = function (e, t, i) { return (e + t + i) >>> 0; }), (t.sum32_4 = function (e, t, i, n) { return (e + t + i + n) >>> 0; }), (t.sum32_5 = function (e, t, i, n, r) { return (e + t + i + n + r) >>> 0; }), (t.sum64 = function (e, t, i, n) { var r = e[t], o = (n + e[t + 1]) >>> 0, a = (o < n ? 1 : 0) + i + r; (e[t] = a >>> 0), (e[t + 1] = o); }), (t.sum64_hi = function (e, t, i, n) { return (((t + n) >>> 0 < t ? 1 : 0) + e + i) >>> 0; }), (t.sum64_lo = function (e, t, i, n) { return (t + n) >>> 0; }), (t.sum64_4_hi = function (e, t, i, n, r, o, a, s) { var c = 0, u = t; return ( (c += (u = (u + n) >>> 0) < t ? 1 : 0), (c += (u = (u + o) >>> 0) < o ? 1 : 0), (e + i + r + a + (c += (u = (u + s) >>> 0) < s ? 1 : 0)) >>> 0 ); }), (t.sum64_4_lo = function (e, t, i, n, r, o, a, s) { return (t + n + o + s) >>> 0; }), (t.sum64_5_hi = function (e, t, i, n, r, o, a, s, c, u) { var l = 0, h = t; return ( (l += (h = (h + n) >>> 0) < t ? 1 : 0), (l += (h = (h + o) >>> 0) < o ? 1 : 0), (l += (h = (h + s) >>> 0) < s ? 1 : 0), (e + i + r + a + c + (l += (h = (h + u) >>> 0) < u ? 1 : 0)) >>> 0 ); }), (t.sum64_5_lo = function (e, t, i, n, r, o, a, s, c, u) { return (t + n + o + s + u) >>> 0; }), (t.rotr64_hi = function (e, t, i) { return ((t << (32 - i)) | (e >>> i)) >>> 0; }), (t.rotr64_lo = function (e, t, i) { return ((e << (32 - i)) | (t >>> i)) >>> 0; }), (t.shr64_hi = function (e, t, i) { return e >>> i; }), (t.shr64_lo = function (e, t, i) { return ((e << (32 - i)) | (t >>> i)) >>> 0; }); }, function (e, t, i) { var n = i(35); e.exports = function (e, t, i) { if ((n(e), void 0 === t)) return e; switch (i) { case 1: return function (i) { return e.call(t, i); }; case 2: return function (i, n) { return e.call(t, i, n); }; case 3: return function (i, n, r) { return e.call(t, i, n, r); }; } return function () { return e.apply(t, arguments); }; }; }, function (e, t) { e.exports = function (e) { if ("function" != typeof e) throw TypeError(e + " is not a function!"); return e; }; }, function (e, t) { var i = {}.toString; e.exports = function (e) { return i.call(e).slice(8, -1); }; }, function (e, t) { e.exports = function (e) { if (null == e) throw TypeError("Can't call method on " + e); return e; }; }, function (e, t, i) { "use strict"; function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } if (i(13)) { var r = i(47), o = i(5), a = i(3), s = i(0), c = i(84), u = i(121), l = i(34), h = i(60), f = i(45), d = i(23), p = i(61), m = i(28), g = i(10), _ = i(164), v = i(49), y = i(39), b = i(22), E = i(66), T = i(6), A = i(20), x = i(113), S = i(50), C = i(52), P = i(51).f, R = i(115), M = i(46), O = i(8), w = i(31), I = i(74), D = i(67), L = i(117), F = i(57), B = i(77), N = i(59), k = i(116), U = i(155), V = i(12), G = i(29), z = V.f, j = G.f, H = o.RangeError, W = o.TypeError, X = o.Uint8Array, Y = Array.prototype, K = u.ArrayBuffer, Q = u.DataView, q = w(0), Z = w(2), J = w(3), $ = w(4), ee = w(5), te = w(6), ie = I(true), ne = I(false), re = L.values, oe = L.keys, ae = L.entries, se = Y.lastIndexOf, ce = Y.reduce, ue = Y.reduceRight, le = Y.join, he = Y.sort, fe = Y.slice, de = Y.toString, pe = Y.toLocaleString, me = O("iterator"), ge = O("toStringTag"), _e = M("typed_constructor"), ve = M("def_constructor"), ye = c.CONSTR, be = c.TYPED, Ee = c.VIEW, Te = w(1, function (e, t) { return Pe(D(e, e[ve]), t); }), Ae = a(function () { return 1 === new X(new Uint16Array([1]).buffer)[0]; }), xe = !!X && !!X.prototype.set && a(function () { new X(1).set({}); }), Se = function (e, t) { var i = m(e); if (i < 0 || i % t) throw H("Wrong offset!"); return i; }, Ce = function (e) { if (T(e) && be in e) return e; throw W(e + " is not a typed array!"); }, Pe = function (e, t) { if (!(T(e) && _e in e)) throw W("It is not a typed array constructor!"); return new e(t); }, Re = function (e, t) { return Me(D(e, e[ve]), t); }, Me = function (e, t) { for (var i = 0, n = t.length, r = Pe(e, n); n > i; ) r[i] = t[i++]; return r; }, Oe = function (e, t, i) { z(e, t, { get: function () { return this._d[i]; }, }); }, we = function (e) { var t, i, n, r, o, a, s = A(e), c = arguments.length, u = c > 1 ? arguments[1] : void 0, h = void 0 !== u, f = R(s); if (null != f && !x(f)) { for (a = f.call(s), n = [], t = 0; !(o = a.next()).done; t++) n.push(o.value); s = n; } for ( h && c > 2 && (u = l(u, arguments[2], 2)), t = 0, i = g(s.length), r = Pe(this, i); i > t; t++ ) r[t] = h ? u(s[t], t) : s[t]; return r; }, Ie = function () { for (var e = 0, t = arguments.length, i = Pe(this, t); t > e; ) i[e] = arguments[e++]; return i; }, De = !!X && a(function () { pe.call(new X(1)); }), Le = function () { return pe.apply(De ? fe.call(Ce(this)) : Ce(this), arguments); }, Fe = { copyWithin: function (e, t) { return U.call( Ce(this), e, t, arguments.length > 2 ? arguments[2] : void 0 ); }, every: function (e) { return $(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0); }, fill: function (e) { return k.apply(Ce(this), arguments); }, filter: function (e) { return Re( this, Z(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0) ); }, find: function (e) { return ee( Ce(this), e, arguments.length > 1 ? arguments[1] : void 0 ); }, findIndex: function (e) { return te( Ce(this), e, arguments.length > 1 ? arguments[1] : void 0 ); }, forEach: function (e) { q(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0); }, indexOf: function (e) { return ne( Ce(this), e, arguments.length > 1 ? arguments[1] : void 0 ); }, includes: function (e) { return ie( Ce(this), e, arguments.length > 1 ? arguments[1] : void 0 ); }, join: function (e) { return le.apply(Ce(this), arguments); }, lastIndexOf: function (e) { return se.apply(Ce(this), arguments); }, map: function (e) { return Te( Ce(this), e, arguments.length > 1 ? arguments[1] : void 0 ); }, reduce: function (e) { return ce.apply(Ce(this), arguments); }, reduceRight: function (e) { return ue.apply(Ce(this), arguments); }, reverse: function () { for ( var e, t = Ce(this).length, i = Math.floor(t / 2), n = 0; n < i; ) (e = this[n]), (this[n++] = this[--t]), (this[t] = e); return this; }, some: function (e) { return J(Ce(this), e, arguments.length > 1 ? arguments[1] : void 0); }, sort: function (e) { return he.call(Ce(this), e); }, subarray: function (e, t) { var i = Ce(this), n = i.length, r = v(e, n); return new (D(i, i[ve]))( i.buffer, i.byteOffset + r * i.BYTES_PER_ELEMENT, g((void 0 === t ? n : v(t, n)) - r) ); }, }, Be = function (e, t) { return Re(this, fe.call(Ce(this), e, t)); }, Ne = function (e) { Ce(this); var t = Se(arguments[1], 1), i = this.length, n = A(e), r = g(n.length), o = 0; if (r + t > i) throw H("Wrong length!"); for (; o < r; ) this[t + o] = n[o++]; }, ke = { entries: function () { return ae.call(Ce(this)); }, keys: function () { return oe.call(Ce(this)); }, values: function () { return re.call(Ce(this)); }, }, Ue = function (e, t) { return ( T(e) && e[be] && "symbol" != n(t) && t in e && String(+t) == String(t) ); }, Ve = function (e, t) { return Ue(e, (t = y(t, true))) ? f(2, e[t]) : j(e, t); }, Ge = function (e, t, i) { return !(Ue(e, (t = y(t, true))) && T(i) && b(i, "value")) || b(i, "get") || b(i, "set") || i.configurable || (b(i, "writable") && !i.writable) || (b(i, "enumerable") && !i.enumerable) ? z(e, t, i) : ((e[t] = i.value), e); }; ye || ((G.f = Ve), (V.f = Ge)), s(s.S + s.F * !ye, "Object", { getOwnPropertyDescriptor: Ve, defineProperty: Ge, }), a(function () { de.call({}); }) && (de = pe = function () { return le.call(this); }); var ze = p({}, Fe); p(ze, ke), d(ze, me, ke.values), p(ze, { slice: Be, set: Ne, constructor: function () {}, toString: de, toLocaleString: Le, }), Oe(ze, "buffer", "b"), Oe(ze, "byteOffset", "o"), Oe(ze, "byteLength", "l"), Oe(ze, "length", "e"), z(ze, ge, { get: function () { return this[be]; }, }), (e.exports = function (e, t, i, n) { var u = e + ((n = !!n) ? "Clamped" : "") + "Array", l = "get" + e, f = "set" + e, p = o[u], m = p || {}, v = p && C(p), y = !p || !c.ABV, b = {}, A = p && p.prototype, x = function (e, i) { z(e, i, { get: function () { return (function (e, i) { var n = e._d; return n.v[l](i * t + n.o, Ae); })(this, i); }, set: function (e) { return (function (e, i, r) { var o = e._d; n && (r = (r = Math.round(r)) < 0 ? 0 : r > 255 ? 255 : 255 & r), o.v[f](i * t + o.o, r, Ae); })(this, i, e); }, enumerable: true, }); }; y ? ((p = i(function (e, i, n, r) { h(e, p, u, "_d"); var o, a, s, c, l = 0, f = 0; if (T(i)) { if ( !( i instanceof K || "ArrayBuffer" == (c = E(i)) || "SharedArrayBuffer" == c ) ) return be in i ? Me(p, i) : we.call(p, i); (o = i), (f = Se(n, t)); var m = i.byteLength; if (void 0 === r) { if (m % t) throw H("Wrong length!"); if ((a = m - f) < 0) throw H("Wrong length!"); } else if ((a = g(r) * t) + f > m) throw H("Wrong length!"); s = a / t; } else (s = _(i)), (o = new K((a = s * t))); for ( d(e, "_d", { b: o, o: f, l: a, e: s, v: new Q(o), }); l < s; ) x(e, l++); })), (A = p.prototype = S(ze)), d(A, "constructor", p)) : (a(function () { p(1); }) && a(function () { new p(-1); }) && B(function (e) { new p(), new p(null), new p(1.5), new p(e); }, true)) || ((p = i(function (e, i, n, r) { var o; return ( h(e, p, u), T(i) ? i instanceof K || "ArrayBuffer" == (o = E(i)) || "SharedArrayBuffer" == o ? void 0 !== r ? new m(i, Se(n, t), r) : void 0 !== n ? new m(i, Se(n, t)) : new m(i) : be in i ? Me(p, i) : we.call(p, i) : new m(_(i)) ); })), q( v !== Function.prototype ? P(m).concat(P(v)) : P(m), function (e) { e in p || d(p, e, m[e]); } ), (p.prototype = A), r || (A.constructor = p)); var R = A[me], M = !!R && ("values" == R.name || null == R.name), O = ke.values; d(p, _e, true), d(A, be, u), d(A, Ee, true), d(A, ve, p), (n ? new p(1)[ge] == u : ge in A) || z(A, ge, { get: function () { return u; }, }), (b[u] = p), s(s.G + s.W + s.F * (p != m), b), s(s.S, u, { BYTES_PER_ELEMENT: t, }), s( s.S + s.F * a(function () { m.of.call(p, 1); }), u, { from: we, of: Ie, } ), "BYTES_PER_ELEMENT" in A || d(A, "BYTES_PER_ELEMENT", t), s(s.P, u, Fe), N(u), s(s.P + s.F * xe, u, { set: Ne, }), s(s.P + s.F * !M, u, ke), r || A.toString == de || (A.toString = de), s( s.P + s.F * a(function () { new p(1).slice(); }), u, { slice: Be, } ), s( s.P + s.F * (a(function () { return ( [1, 2].toLocaleString() != new p([1, 2]).toLocaleString() ); }) || !a(function () { A.toLocaleString.call([1, 2]); })), u, { toLocaleString: Le, } ), (F[u] = M ? R : O), r || M || d(A, me, O); }); } else e.exports = function () {}; }, function (e, t, i) { var n = i(6); e.exports = function (e, t) { if (!n(e)) return e; var i, r; if (t && "function" == typeof (i = e.toString) && !n((r = i.call(e)))) return r; if ("function" == typeof (i = e.valueOf) && !n((r = i.call(e)))) return r; if (!t && "function" == typeof (i = e.toString) && !n((r = i.call(e)))) return r; throw TypeError("Can't convert object to primitive value"); }; }, function (e, t, i) { function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(46)("meta"), o = i(6), a = i(22), s = i(12).f, c = 0, u = Object.isExtensible || function () { return true; }, l = !i(3)(function () { return u(Object.preventExtensions({})); }), h = function (e) { s(e, r, { value: { i: "O" + ++c, w: {}, }, }); }, f = (e.exports = { KEY: r, NEED: false, fastKey: function (e, t) { if (!o(e)) return "symbol" == n(e) ? e : ("string" == typeof e ? "S" : "P") + e; if (!a(e, r)) { if (!u(e)) return "F"; if (!t) return "E"; h(e); } return e[r].i; }, getWeak: function (e, t) { if (!a(e, r)) { if (!u(e)) return true; if (!t) return false; h(e); } return e[r].w; }, onFreeze: function (e) { return l && f.NEED && u(e) && !a(e, r) && h(e), e; }, }); }, function (e, t, i) { e.exports = i(394).Promise; }, function (e, t) { function i(e) { return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } function n() { (this._events = this._events || {}), (this._maxListeners = this._maxListeners || void 0); } function r(e) { return "function" == typeof e; } function o(e) { return "object" === i(e) && null !== e; } function a(e) { return void 0 === e; } (e.exports = n), (n.EventEmitter = n), (n.prototype._events = void 0), (n.prototype._maxListeners = void 0), (n.defaultMaxListeners = 10), (n.prototype.setMaxListeners = function (e) { if ("number" != typeof e || e < 0 || isNaN(e)) throw TypeError("n must be a positive number"); return (this._maxListeners = e), this; }), (n.prototype.emit = function (e) { var t, i, n, s, c, u; if ( (this._events || (this._events = {}), "error" === e && (!this._events.error || (o(this._events.error) && !this._events.error.length))) ) { if ((t = arguments[1]) instanceof Error) throw t; var l = new Error('Uncaught, unspecified "error" event. (' + t + ")"); throw ((l.context = t), l); } if (a((i = this._events[e]))) return false; if (r(i)) switch (arguments.length) { case 1: i.call(this); break; case 2: i.call(this, arguments[1]); break; case 3: i.call(this, arguments[1], arguments[2]); break; default: (s = Array.prototype.slice.call(arguments, 1)), i.apply(this, s); } else if (o(i)) for ( s = Array.prototype.slice.call(arguments, 1), n = (u = i.slice()).length, c = 0; c < n; c++ ) u[c].apply(this, s); return true; }), (n.prototype.addListener = function (e, t) { var i; if (!r(t)) throw TypeError("listener must be a function"); return ( this._events || (this._events = {}), this._events.newListener && this.emit("newListener", e, r(t.listener) ? t.listener : t), this._events[e] ? o(this._events[e]) ? this._events[e].push(t) : (this._events[e] = [this._events[e], t]) : (this._events[e] = t), o(this._events[e]) && !this._events[e].warned && (i = a(this._maxListeners) ? n.defaultMaxListeners : this._maxListeners) && i > 0 && this._events[e].length > i && ((this._events[e].warned = true), console.error( "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", this._events[e].length ), "function" == typeof console.trace && console.trace()), this ); }), (n.prototype.on = n.prototype.addListener), (n.prototype.once = function (e, t) { if (!r(t)) throw TypeError("listener must be a function"); var i = false; function n() { this.removeListener(e, n), i || ((i = true), t.apply(this, arguments)); } return (n.listener = t), this.on(e, n), this; }), (n.prototype.removeListener = function (e, t) { var i, n, a, s; if (!r(t)) throw TypeError("listener must be a function"); if (!this._events || !this._events[e]) return this; if ( ((a = (i = this._events[e]).length), (n = -1), i === t || (r(i.listener) && i.listener === t)) ) delete this._events[e], this._events.removeListener && this.emit("removeListener", e, t); else if (o(i)) { for (s = a; s-- > 0; ) if (i[s] === t || (i[s].listener && i[s].listener === t)) { n = s; break; } if (n < 0) return this; 1 === i.length ? ((i.length = 0), delete this._events[e]) : i.splice(n, 1), this._events.removeListener && this.emit("removeListener", e, t); } return this; }), (n.prototype.removeAllListeners = function (e) { var t, i; if (!this._events) return this; if (!this._events.removeListener) return ( 0 === arguments.length ? (this._events = {}) : this._events[e] && delete this._events[e], this ); if (0 === arguments.length) { for (t in this._events) "removeListener" !== t && this.removeAllListeners(t); return ( this.removeAllListeners("removeListener"), (this._events = {}), this ); } if (r((i = this._events[e]))) this.removeListener(e, i); else if (i) for (; i.length; ) this.removeListener(e, i[i.length - 1]); return delete this._events[e], this; }), (n.prototype.listeners = function (e) { return this._events && this._events[e] ? r(this._events[e]) ? [this._events[e]] : this._events[e].slice() : []; }), (n.prototype.listenerCount = function (e) { if (this._events) { var t = this._events[e]; if (r(t)) return 1; if (t) return t.length; } return 0; }), (n.listenerCount = function (e, t) { return e.listenerCount(t); }); }, function (e, t, i) { "use strict"; e.exports = { Timer: function (e, t) { var i = t || "", n = e || 1, r = [], o = [], a = 0, s = 0, c = 0, u = 0, l = true; (this.start = function () { l && ((r.length = o.length = 0), (l = false)), (a = s = performance.now()), c++; }), (this.add = function (e) { var t = performance.now(); o.indexOf(e) < 0 && o.push(e); var i = o.indexOf(e); r[i] || (r[i] = 0), (r[i] += t - s), (s = t); }), (this.report = function () { if (((u += performance.now() - a), c === n)) { var e = " total: " + (u / n).toFixed(2) + "ms (avg, " + n + " runs)"; console.log( i + ":", o .map(function (e, t) { return e + ": " + (r[t] / n).toFixed(2) + "ms "; }) .join(""), n > 1 ? e : "" ), (l = true), (c = 0), (u = 0); } }); }, removeUnorderedListItem: function (e, t) { var i = e.indexOf(t); if (i < 0) return; i === e.length - 1 ? e.pop() : (e[i] = e.pop()); }, }; }, function (e, t, i) { var n = i(2).Buffer, r = i(128).Transform, o = i(124).StringDecoder; function a(e) { r.call(this), (this.hashMode = "string" == typeof e), this.hashMode ? (this[e] = this._finalOrDigest) : (this.final = this._finalOrDigest), this._final && ((this.__final = this._final), (this._final = null)), (this._decoder = null), (this._encoding = null); } i(1)(a, r), (a.prototype.update = function (e, t, i) { "string" == typeof e && (e = n.from(e, t)); var r = this._update(e); return this.hashMode ? this : (i && (r = this._toString(r, i)), r); }), (a.prototype.setAutoPadding = function () {}), (a.prototype.getAuthTag = function () { throw new Error("trying to get auth tag in unsupported state"); }), (a.prototype.setAuthTag = function () { throw new Error("trying to set auth tag in unsupported state"); }), (a.prototype.setAAD = function () { throw new Error("trying to set aad in unsupported state"); }), (a.prototype._transform = function (e, t, i) { var n; try { this.hashMode ? this._update(e) : this.push(this._update(e)); } catch (e) { n = e; } finally { i(n); } }), (a.prototype._flush = function (e) { var t; try { this.push(this.__final()); } catch (e) { t = e; } e(t); }), (a.prototype._finalOrDigest = function (e) { var t = this.__final() || n.alloc(0); return e && (t = this._toString(t, e, true)), t; }), (a.prototype._toString = function (e, t, i) { if ( (this._decoder || ((this._decoder = new o(t)), (this._encoding = t)), this._encoding !== t) ) throw new Error("can't switch encodings"); var n = this._decoder.write(e); return i && (n += this._decoder.end()), n; }), (e.exports = a); }, function (e, t) { e.exports = function (e, t) { return { enumerable: !(1 & e), configurable: !(2 & e), writable: !(4 & e), value: t, }; }; }, function (e, t) { var i = 0, n = Math.random(); e.exports = function (e) { return "Symbol(".concat( void 0 === e ? "" : e, ")_", (++i + n).toString(36) ); }; }, function (e, t) { e.exports = false; }, function (e, t, i) { var n = i(140), r = i(99); e.exports = Object.keys || function (e) { return n(e, r); }; }, function (e, t, i) { var n = i(28), r = Math.max, o = Math.min; e.exports = function (e, t) { return (e = n(e)) < 0 ? r(e + t, 0) : o(e, t); }; }, function (e, t, i) { var n = i(4), r = i(141), o = i(99), a = i(98)("IE_PROTO"), s = function () {}, c = function () { var e, t = i(95)("iframe"), n = o.length; for ( t.style.display = "none", i(101).appendChild(t), t.src = "javascript:", (e = t.contentWindow.document).open(), e.write(""), e.close(), c = e.F; n--; ) delete c.prototype[o[n]]; return c(); }; e.exports = Object.create || function (e, t) { var i; return ( null !== e ? ((s.prototype = n(e)), (i = new s()), (s.prototype = null), (i[a] = e)) : (i = c()), void 0 === t ? i : r(i, t) ); }; }, function (e, t, i) { var n = i(140), r = i(99).concat("length", "prototype"); t.f = Object.getOwnPropertyNames || function (e) { return n(e, r); }; }, function (e, t, i) { var n = i(22), r = i(20), o = i(98)("IE_PROTO"), a = Object.prototype; e.exports = Object.getPrototypeOf || function (e) { return ( (e = r(e)), n(e, o) ? e[o] : "function" == typeof e.constructor && e instanceof e.constructor ? e.constructor.prototype : e instanceof Object ? a : null ); }; }, function (e, t, i) { "use strict"; (function (t, n) { var r = i(2).Buffer, o = t.crypto || t.msCrypto; o && o.getRandomValues ? (e.exports = function (e, i) { if (e > 65536) throw new Error("requested too many random bytes"); var a = new t.Uint8Array(e); e > 0 && o.getRandomValues(a); var s = r.from(a.buffer); if ("function" == typeof i) return n.nextTick(function () { i(null, s); }); return s; }) : (e.exports = function () { throw new Error( "Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11" ); }); }.call(this, i(15), i(27))); }, function (e, t, i) { "use strict"; var n = i(86), r = Object.keys || function (e) { var t = []; for (var i in e) t.push(i); return t; }; e.exports = h; var o = i(68); o.inherits = i(1); var a = i(169), s = i(123); o.inherits(h, a); for (var c = r(s.prototype), u = 0; u < c.length; u++) { var l = c[u]; h.prototype[l] || (h.prototype[l] = s.prototype[l]); } function h(e) { if (!(this instanceof h)) return new h(e); a.call(this, e), s.call(this, e), e && false === e.readable && (this.readable = false), e && false === e.writable && (this.writable = false), (this.allowHalfOpen = true), e && false === e.allowHalfOpen && (this.allowHalfOpen = false), this.once("end", f); } function f() { this.allowHalfOpen || this._writableState.ended || n.nextTick(d, this); } function d(e) { e.end(); } Object.defineProperty(h.prototype, "writableHighWaterMark", { enumerable: false, get: function () { return this._writableState.highWaterMark; }, }), Object.defineProperty(h.prototype, "destroyed", { get: function () { return ( void 0 !== this._readableState && void 0 !== this._writableState && this._readableState.destroyed && this._writableState.destroyed ); }, set: function (e) { void 0 !== this._readableState && void 0 !== this._writableState && ((this._readableState.destroyed = e), (this._writableState.destroyed = e)); }, }), (h.prototype._destroy = function (e, t) { this.push(null), this.end(), n.nextTick(t, e); }); }, function (e, t, i) { "use strict"; var n = i(94); function r(e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; (n.enumerable = n.enumerable || false), (n.configurable = true), "value" in n && (n.writable = true), Object.defineProperty(e, n.key, n); } } var o = (function () { function e(t, i) { !(function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); })(this, e), void 0 === e.id && (e.id = 1e4), (this.isClient = t.isClient), (this.isSelf = void 0 !== t.isSelf && t.isSelf), (this.network = void 0 !== t.network ? t.network : null), this.initializeState(t), (this.positionCallback = "function" == typeof i ? i : null), (this.id = e.id += 1), true === this.isClient && this.sendJoined(); } var t, i, o; return ( (t = e), (i = [ { key: "initializeState", value: function (e) { (this.state = { name: e.name, position: { x: 0, y: 0, z: 0, }, rotation: { x: 0, y: 0, z: 0, }, walking: false, spawned: false, }), (this.peer = e.peer); }, }, { key: "setPosition", value: function (e, t, i) { (this.state.walking = e.x !== this.state.position.x || e.z !== this.state.position.z), (this.state.position = e), (this.state.rotation = t), (this.state.spawned = i), this.positionCallback && this.positionCallback(this.state); }, }, { key: "setState", value: function (e) { var t = this.state.name !== e.name; (this.state.position = e.position), (this.state.rotation = e.rotation), (this.state.walking = e.walking), (this.state.spawned = e.spawned), (this.state.name = e.name), (void 0 === this.noaPlayer || t) && this.state.spawned && (void 0 !== this.noaPlayer && this.noaPlayer.remove(), (this.noaPlayer = n.a .getInstance() .addPlayer(0, 0, 0, this.state.name, this.id))), void 0 !== this.noaPlayer && (this.noaPlayer.setPosition( e.position.x, e.position.y, e.position.z ), this.noaPlayer.setRotation(0, e.rotation.y, 0), (this.noaPlayer.walking = e.walking)); }, }, { key: "sendJoined", value: function () { null != this.network && this.network.sendJoined(this.state.name); }, }, { key: "sendMessage", value: function (e) { null != this.network && this.network.sendMessage(e); }, }, { key: "emitFireEvent", value: function (e) { null != this.network && this.network.emitFireEvent(e); }, }, ]) && r(t.prototype, i), o && r(t, o), e ); })(); t.a = o; }, function (e, t, i) { var n = i(12).f, r = i(22), o = i(8)("toStringTag"); e.exports = function (e, t, i) { e && !r((e = i ? e : e.prototype), o) && n(e, o, { configurable: true, value: t, }); }; }, function (e, t) { e.exports = {}; }, function (e, t, i) { var n = i(8)("unscopables"), r = Array.prototype; null == r[n] && i(23)(r, n, {}), (e.exports = function (e) { r[n][e] = true; }); }, function (e, t, i) { "use strict"; var n = i(5), r = i(12), o = i(13), a = i(8)("species"); e.exports = function (e) { var t = n[e]; o && t && !t[a] && r.f(t, a, { configurable: true, get: function () { return this; }, }); }; }, function (e, t) { e.exports = function (e, t, i, n) { if (!(e instanceof t) || (void 0 !== n && n in e)) throw TypeError(i + ": incorrect invocation!"); return e; }; }, function (e, t, i) { var n = i(19); e.exports = function (e, t, i) { for (var r in t) n(e, r, t[r], i); return e; }; }, function (e, t, i) { var n = i(6); e.exports = function (e, t) { if (!n(e) || e._t !== t) throw TypeError("Incompatible receiver, " + t + " required!"); return e; }; }, function (e, t, i) { var n = i(2).Buffer; function r(e, t) { (this._block = n.alloc(e)), (this._finalSize = t), (this._blockSize = e), (this._len = 0); } (r.prototype.update = function (e, t) { "string" == typeof e && ((t = t || "utf8"), (e = n.from(e, t))); for ( var i = this._block, r = this._blockSize, o = e.length, a = this._len, s = 0; s < o; ) { for (var c = a % r, u = Math.min(o - s, r - c), l = 0; l < u; l++) i[c + l] = e[s + l]; (s += u), (a += u) % r == 0 && this._update(i); } return (this._len += o), this; }), (r.prototype.digest = function (e) { var t = this._len % this._blockSize; (this._block[t] = 128), this._block.fill(0, t + 1), t >= this._finalSize && (this._update(this._block), this._block.fill(0)); var i = 8 * this._len; if (i <= 4294967295) this._block.writeUInt32BE(i, this._blockSize - 4); else { var n = (4294967295 & i) >>> 0, r = (i - n) / 4294967296; this._block.writeUInt32BE(r, this._blockSize - 8), this._block.writeUInt32BE(n, this._blockSize - 4); } this._update(this._block); var o = this._hash(); return e ? o.toString(e) : o; }), (r.prototype._update = function () { throw new Error("_update must be implemented by subclass"); }), (e.exports = r); }, function (e, t, i) { var n = i(36); e.exports = Object("z").propertyIsEnumerable(0) ? Object : function (e) { return "String" == n(e) ? e.split("") : Object(e); }; }, function (e, t) { t.f = {}.propertyIsEnumerable; }, function (e, t, i) { var n = i(36), r = i(8)("toStringTag"), o = "Arguments" == n( (function () { return arguments; })() ); e.exports = function (e) { var t, i, a; return void 0 === e ? "Undefined" : null === e ? "Null" : "string" == typeof (i = (function (e, t) { try { return e[t]; } catch (e) {} })((t = Object(e)), r)) ? i : o ? n(t) : "Object" == (a = n(t)) && "function" == typeof t.callee ? "Arguments" : a; }; }, function (e, t, i) { var n = i(4), r = i(35), o = i(8)("species"); e.exports = function (e, t) { var i, a = n(e).constructor; return void 0 === a || null == (i = n(a)[o]) ? t : r(i); }; }, function (e, t, i) { (function (e) { function i(e) { return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } function n(e) { return Object.prototype.toString.call(e); } (t.isArray = function (e) { return Array.isArray ? Array.isArray(e) : "[object Array]" === n(e); }), (t.isBoolean = function (e) { return "boolean" == typeof e; }), (t.isNull = function (e) { return null === e; }), (t.isNullOrUndefined = function (e) { return null == e; }), (t.isNumber = function (e) { return "number" == typeof e; }), (t.isString = function (e) { return "string" == typeof e; }), (t.isSymbol = function (e) { return "symbol" === i(e); }), (t.isUndefined = function (e) { return void 0 === e; }), (t.isRegExp = function (e) { return "[object RegExp]" === n(e); }), (t.isObject = function (e) { return "object" === i(e) && null !== e; }), (t.isDate = function (e) { return "[object Date]" === n(e); }), (t.isError = function (e) { return "[object Error]" === n(e) || e instanceof Error; }), (t.isFunction = function (e) { return "function" == typeof e; }), (t.isPrimitive = function (e) { return ( null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" === i(e) || void 0 === e ); }), (t.isBuffer = e.isBuffer); }.call(this, i(9).Buffer)); }, function (e, t, i) { "use strict"; var n = i(1), r = i(127), o = i(129), a = i(130), s = i(44); function c(e) { s.call(this, "digest"), (this._hash = e); } n(c, s), (c.prototype._update = function (e) { this._hash.update(e); }), (c.prototype._final = function () { return this._hash.digest(); }), (e.exports = function (e) { return "md5" === (e = e.toLowerCase()) ? new r() : "rmd160" === e || "ripemd160" === e ? new o() : new c(a(e)); }); }, function (e, t, i) { (function (t) { e.exports = function (e, i) { for ( var n = Math.min(e.length, i.length), r = new t(n), o = 0; o < n; ++o ) r[o] = e[o] ^ i[o]; return r; }; }.call(this, i(9).Buffer)); }, function (e, t, i) { "use strict"; var n = i(33), r = i(25); function o() { (this.pending = null), (this.pendingTotal = 0), (this.blockSize = this.constructor.blockSize), (this.outSize = this.constructor.outSize), (this.hmacStrength = this.constructor.hmacStrength), (this.padLength = this.constructor.padLength / 8), (this.endian = "big"), (this._delta8 = this.blockSize / 8), (this._delta32 = this.blockSize / 32); } (t.BlockHash = o), (o.prototype.update = function (e, t) { if ( ((e = n.toArray(e, t)), this.pending ? (this.pending = this.pending.concat(e)) : (this.pending = e), (this.pendingTotal += e.length), this.pending.length >= this._delta8) ) { var i = (e = this.pending).length % this._delta8; (this.pending = e.slice(e.length - i, e.length)), 0 === this.pending.length && (this.pending = null), (e = n.join32(e, 0, e.length - i, this.endian)); for (var r = 0; r < e.length; r += this._delta32) this._update(e, r, r + this._delta32); } return this; }), (o.prototype.digest = function (e) { return ( this.update(this._pad()), r(null === this.pending), this._digest(e) ); }), (o.prototype._pad = function () { var e = this.pendingTotal, t = this._delta8, i = t - ((e + this.padLength) % t), n = new Array(i + this.padLength); n[0] = 128; for (var r = 1; r < i; r++) n[r] = 0; if (((e <<= 3), "big" === this.endian)) { for (var o = 8; o < this.padLength; o++) n[r++] = 0; (n[r++] = 0), (n[r++] = 0), (n[r++] = 0), (n[r++] = 0), (n[r++] = (e >>> 24) & 255), (n[r++] = (e >>> 16) & 255), (n[r++] = (e >>> 8) & 255), (n[r++] = 255 & e); } else for ( n[r++] = 255 & e, n[r++] = (e >>> 8) & 255, n[r++] = (e >>> 16) & 255, n[r++] = (e >>> 24) & 255, n[r++] = 0, n[r++] = 0, n[r++] = 0, n[r++] = 0, o = 8; o < this.padLength; o++ ) n[r++] = 0; return n; }); }, function (e, t, i) { var n = t; (n.bignum = i(11)), (n.define = i(571).define), (n.base = i(73)), (n.constants = i(219)), (n.decoders = i(577)), (n.encoders = i(579)); }, function (e, t, i) { var n = t; (n.Reporter = i(574).Reporter), (n.DecoderBuffer = i(218).DecoderBuffer), (n.EncoderBuffer = i(218).EncoderBuffer), (n.Node = i(575)); }, function (e, t, i) { var n = i(24), r = i(10), o = i(49); e.exports = function (e) { return function (t, i, a) { var s, c = n(t), u = r(c.length), l = o(a, u); if (e && i != i) { for (; u > l; ) if ((s = c[l++]) != s) return true; } else for (; u > l; l++) if ((e || l in c) && c[l] === i) return e || l || 0; return !e && -1; }; }; }, function (e, t) { t.f = Object.getOwnPropertySymbols; }, function (e, t, i) { var n = i(0), r = i(37), o = i(3), a = i(103), s = "[" + a + "]", c = RegExp("^" + s + s + "*"), u = RegExp(s + s + "*$"), l = function (e, t, i) { var r = {}, s = o(function () { return !!a[e]() || "​…" != "​…"[e](); }), c = (r[e] = s ? t(h) : a[e]); i && (r[i] = c), n(n.P + n.F * s, "String", r); }, h = (l.trim = function (e, t) { return ( (e = String(r(e))), 1 & t && (e = e.replace(c, "")), 2 & t && (e = e.replace(u, "")), e ); }); e.exports = l; }, function (e, t, i) { var n = i(8)("iterator"), r = false; try { var o = [7][n](); (o.return = function () { r = true; }), Array.from(o, function () { throw 2; }); } catch (e) {} e.exports = function (e, t) { if (!t && !r) return false; var i = false; try { var o = [7], a = o[n](); (a.next = function () { return { done: (i = true), }; }), (o[n] = function () { return a; }), e(o); } catch (e) {} return i; }; }, function (e, t, i) { "use strict"; var n = i(4); e.exports = function () { var e = n(this), t = ""; return ( e.global && (t += "g"), e.ignoreCase && (t += "i"), e.multiline && (t += "m"), e.unicode && (t += "u"), e.sticky && (t += "y"), t ); }; }, function (e, t, i) { "use strict"; function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(66), o = RegExp.prototype.exec; e.exports = function (e, t) { var i = e.exec; if ("function" == typeof i) { var a = i.call(e, t); if ("object" !== n(a)) throw new TypeError( "RegExp exec method returned something other than an Object or null" ); return a; } if ("RegExp" !== r(e)) throw new TypeError("RegExp#exec called on incompatible receiver"); return o.call(e, t); }; }, function (e, t, i) { "use strict"; i(157); var n = i(19), r = i(23), o = i(3), a = i(37), s = i(8), c = i(118), u = s("species"), l = !o(function () { var e = /./; return ( (e.exec = function () { var e = []; return ( (e.groups = { a: "7", }), e ); }), "7" !== "".replace(e, "$") ); }), h = (function () { var e = /(?:)/, t = e.exec; e.exec = function () { return t.apply(this, arguments); }; var i = "ab".split(e); return 2 === i.length && "a" === i[0] && "b" === i[1]; })(); e.exports = function (e, t, i) { var f = s(e), d = !o(function () { var t = {}; return ( (t[f] = function () { return 7; }), 7 != ""[e](t) ); }), p = d ? !o(function () { var t = false, i = /a/; return ( (i.exec = function () { return (t = true), null; }), "split" === e && ((i.constructor = {}), (i.constructor[u] = function () { return i; })), i[f](""), !t ); }) : void 0; if (!d || !p || ("replace" === e && !l) || ("split" === e && !h)) { var m = /./[f], g = i(a, f, ""[e], function (e, t, i, n, r) { return t.exec === c ? d && !r ? { done: true, value: m.call(t, i, n), } : { done: true, value: e.call(i, t, n), } : { done: false, }; }), _ = g[0], v = g[1]; n(String.prototype, e, _), r( RegExp.prototype, f, 2 == t ? function (e, t) { return v.call(e, this, t); } : function (e) { return v.call(e, this); } ); } }; }, function (e, t, i) { var n = i(34), r = i(153), o = i(113), a = i(4), s = i(10), c = i(115), u = {}, l = {}; ((t = e.exports = function (e, t, i, h, f) { var d, p, m, g, _ = f ? function () { return e; } : c(e), v = n(i, h, t ? 2 : 1), y = 0; if ("function" != typeof _) throw TypeError(e + " is not iterable!"); if (o(_)) { for (d = s(e.length); d > y; y++) if ((g = t ? v(a((p = e[y]))[0], p[1]) : v(e[y])) === u || g === l) return g; } else for (m = _.call(e); !(p = m.next()).done; ) if ((g = r(m, v, p.value, t)) === u || g === l) return g; }).BREAK = u), (t.RETURN = l); }, function (e, t, i) { var n = i(5).navigator; e.exports = (n && n.userAgent) || ""; }, function (e, t, i) { "use strict"; var n = i(5), r = i(0), o = i(19), a = i(61), s = i(40), c = i(81), u = i(60), l = i(6), h = i(3), f = i(77), d = i(56), p = i(104); e.exports = function (e, t, i, m, g, _) { var v = n[e], y = v, b = g ? "set" : "add", E = y && y.prototype, T = {}, A = function (e) { var t = E[e]; o( E, e, "delete" == e ? function (e) { return !(_ && !l(e)) && t.call(this, 0 === e ? 0 : e); } : "has" == e ? function (e) { return !(_ && !l(e)) && t.call(this, 0 === e ? 0 : e); } : "get" == e ? function (e) { return _ && !l(e) ? void 0 : t.call(this, 0 === e ? 0 : e); } : "add" == e ? function (e) { return t.call(this, 0 === e ? 0 : e), this; } : function (e, i) { return t.call(this, 0 === e ? 0 : e, i), this; } ); }; if ( "function" == typeof y && (_ || (E.forEach && !h(function () { new y().entries().next(); }))) ) { var x = new y(), S = x[b](_ ? {} : -0, 1) != x, C = h(function () { x.has(1); }), P = f(function (e) { new y(e); }), R = !_ && h(function () { for (var e = new y(), t = 5; t--; ) e[b](t, t); return !e.has(-0); }); P || (((y = t(function (t, i) { u(t, y, e); var n = p(new v(), t, y); return null != i && c(i, g, n[b], n), n; })).prototype = E), (E.constructor = y)), (C || R) && (A("delete"), A("has"), g && A("get")), (R || S) && A(b), _ && E.clear && delete E.clear; } else (y = m.getConstructor(t, e, g, b)), a(y.prototype, i), (s.NEED = true); return ( d(y, e), (T[e] = y), r(r.G + r.W + r.F * (y != v), T), _ || m.setStrong(y, e, g), y ); }; }, function (e, t, i) { for ( var n, r = i(5), o = i(23), a = i(46), s = a("typed_array"), c = a("view"), u = !(!r.ArrayBuffer || !r.DataView), l = u, h = 0, f = "Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split( "," ); h < 9; ) (n = r[f[h++]]) ? (o(n.prototype, s, true), o(n.prototype, c, true)) : (l = false); e.exports = { ABV: u, CONSTR: l, TYPED: s, VIEW: c, }; }, function (e, t, i) { ((t = e.exports = i(169)).Stream = t), (t.Readable = t), (t.Writable = i(123)), (t.Duplex = i(54)), (t.Transform = i(172)), (t.PassThrough = i(410)); }, function (e, t, i) { "use strict"; (function (t) { !t.version || 0 === t.version.indexOf("v0.") || (0 === t.version.indexOf("v1.") && 0 !== t.version.indexOf("v1.8.")) ? (e.exports = { nextTick: function (e, i, n, r) { if ("function" != typeof e) throw new TypeError('"callback" argument must be a function'); var o, a, s = arguments.length; switch (s) { case 0: case 1: return t.nextTick(e); case 2: return t.nextTick(function () { e.call(null, i); }); case 3: return t.nextTick(function () { e.call(null, i, n); }); case 4: return t.nextTick(function () { e.call(null, i, n, r); }); default: for (o = new Array(s - 1), a = 0; a < o.length; ) o[a++] = arguments[a]; return t.nextTick(function () { e.apply(null, o); }); } }, }) : (e.exports = t); }.call(this, i(27))); }, function (exp, t, getterFunc) { exp.exports = r; var vec3Math = getterFunc(16); function r(e, t) { if (!(this instanceof r)) return new r(e, t); var i = vec3Math.create(); vec3Math.add(i, e, t), (this.base = vec3Math.min(vec3Math.create(), e, i)), (this.vec = vec3Math.clone(t)), (this.max = vec3Math.max(vec3Math.create(), e, i)), (this.mag = vec3Math.length(this.vec)); } var o = r.prototype; (o.width = function () { return this.vec[0]; }), (o.height = function () { return this.vec[1]; }), (o.depth = function () { return this.vec[2]; }), (o.x0 = function () { return this.base[0]; }), (o.y0 = function () { return this.base[1]; }), (o.z0 = function () { return this.base[2]; }), (o.x1 = function () { return this.max[0]; }), (o.y1 = function () { return this.max[1]; }), (o.z1 = function () { return this.max[2]; }), (o.translate = function (e) { return ( vec3Math.add(this.max, this.max, e), vec3Math.add(this.base, this.base, e), this ); }), (o.setPosition = function (e) { return ( vec3Math.add(this.max, e, this.vec), vec3Math.copy(this.base, e), this ); }), (o.expand = function (e) { var t = vec3Math.create(), i = vec3Math.create(); return ( vec3Math.max(t, e.max, this.max), vec3Math.min(i, e.base, this.base), vec3Math.subtract(t, t, i), new r(i, t) ); }), (o.intersects = function (e) { return ( !(e.base[0] > this.max[0]) && !(e.base[1] > this.max[1]) && !(e.base[2] > this.max[2]) && !(e.max[0] < this.base[0]) && !(e.max[1] < this.base[1]) && !(e.max[2] < this.base[2]) ); }), (o.touches = function (e) { var t = this.union(e); return ( null !== t && (0 == t.width() || 0 == t.height() || 0 == t.depth()) ); }), (o.union = function (e) { if (!this.intersects(e)) return null; var t = Math.max(e.base[0], this.base[0]), i = Math.max(e.base[1], this.base[1]), n = Math.max(e.base[2], this.base[2]); return new r( [t, i, n], [ Math.min(e.max[0], this.max[0]) - t, Math.min(e.max[1], this.max[1]) - i, Math.min(e.max[2], this.max[2]) - n, ] ); }); }, function (e, t, i) { var n = i(185), r = i(446), o = "undefined" != typeof Float64Array; function a(e, t) { return e[0] - t[0]; } function s() { var e, t = this.stride, i = new Array(t.length); for (e = 0; e < i.length; ++e) i[e] = [Math.abs(t[e]), e]; i.sort(a); var n = new Array(i.length); for (e = 0; e < n.length; ++e) n[e] = i[e][1]; return n; } function c(e, t) { var i = ["View", t, "d", e].join(""); t < 0 && (i = "View_Nil" + e); var r = "generic" === e; if (-1 === t) { var o = "function " + i + "(a){this.data=a;};var proto=" + i + ".prototype;proto.dtype='" + e + "';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new " + i + "(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_" + i + "(a){return new " + i + "(a);}"; return new Function(o)(); } if (0 === t) { o = "function " + i + "(a,d) {this.data = a;this.offset = d};var proto=" + i + ".prototype;proto.dtype='" + e + "';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function " + i + "_copy() {return new " + i + "(this.data,this.offset)};proto.pick=function " + i + "_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function " + i + "_get(){return " + (r ? "this.data.get(this.offset)" : "this.data[this.offset]") + "};proto.set=function " + i + "_set(v){return " + (r ? "this.data.set(this.offset,v)" : "this.data[this.offset]=v") + "};return function construct_" + i + "(a,b,c,d){return new " + i + "(a,d)}"; return new Function("TrivialArray", o)(u[e][0]); } o = ["'use strict'"]; var a = n(t), c = a.map(function (e) { return "i" + e; }), l = "this.offset+" + a .map(function (e) { return "this.stride[" + e + "]*i" + e; }) .join("+"), h = a .map(function (e) { return "b" + e; }) .join(","), f = a .map(function (e) { return "c" + e; }) .join(","); o.push( "function " + i + "(a," + h + "," + f + ",d){this.data=a", "this.shape=[" + h + "]", "this.stride=[" + f + "]", "this.offset=d|0}", "var proto=" + i + ".prototype", "proto.dtype='" + e + "'", "proto.dimension=" + t ), o.push( "Object.defineProperty(proto,'size',{get:function " + i + "_size(){return " + a .map(function (e) { return "this.shape[" + e + "]"; }) .join("*"), "}})" ), 1 === t ? o.push("proto.order=[0]") : (o.push("Object.defineProperty(proto,'order',{get:"), t < 4 ? (o.push("function " + i + "_order(){"), 2 === t ? o.push( "return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})" ) : 3 === t && o.push( "var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})" )) : o.push("ORDER})")), o.push("proto.set=function " + i + "_set(" + c.join(",") + ",v){"), r ? o.push("return this.data.set(" + l + ",v)}") : o.push("return this.data[" + l + "]=v}"), o.push("proto.get=function " + i + "_get(" + c.join(",") + "){"), r ? o.push("return this.data.get(" + l + ")}") : o.push("return this.data[" + l + "]}"), o.push( "proto.index=function " + i + "_index(", c.join(), "){return " + l + "}" ), o.push( "proto.hi=function " + i + "_hi(" + c.join(",") + "){return new " + i + "(this.data," + a .map(function (e) { return [ "(typeof i", e, "!=='number'||i", e, "<0)?this.shape[", e, "]:i", e, "|0", ].join(""); }) .join(",") + "," + a .map(function (e) { return "this.stride[" + e + "]"; }) .join(",") + ",this.offset)}" ); var d = a.map(function (e) { return "a" + e + "=this.shape[" + e + "]"; }), p = a.map(function (e) { return "c" + e + "=this.stride[" + e + "]"; }); o.push( "proto.lo=function " + i + "_lo(" + c.join(",") + "){var b=this.offset,d=0," + d.join(",") + "," + p.join(",") ); for (var m = 0; m < t; ++m) o.push( "if(typeof i" + m + "==='number'&&i" + m + ">=0){d=i" + m + "|0;b+=c" + m + "*d;a" + m + "-=d}" ); o.push( "return new " + i + "(this.data," + a .map(function (e) { return "a" + e; }) .join(",") + "," + a .map(function (e) { return "c" + e; }) .join(",") + ",b)}" ), o.push( "proto.step=function " + i + "_step(" + c.join(",") + "){var " + a .map(function (e) { return "a" + e + "=this.shape[" + e + "]"; }) .join(",") + "," + a .map(function (e) { return "b" + e + "=this.stride[" + e + "]"; }) .join(",") + ",c=this.offset,d=0,ceil=Math.ceil" ); for (m = 0; m < t; ++m) o.push( "if(typeof i" + m + "==='number'){d=i" + m + "|0;if(d<0){c+=b" + m + "*(a" + m + "-1);a" + m + "=ceil(-a" + m + "/d)}else{a" + m + "=ceil(a" + m + "/d)}b" + m + "*=d}" ); o.push( "return new " + i + "(this.data," + a .map(function (e) { return "a" + e; }) .join(",") + "," + a .map(function (e) { return "b" + e; }) .join(",") + ",c)}" ); var g = new Array(t), _ = new Array(t); for (m = 0; m < t; ++m) (g[m] = "a[i" + m + "]"), (_[m] = "b[i" + m + "]"); o.push( "proto.transpose=function " + i + "_transpose(" + c + "){" + c .map(function (e, t) { return e + "=(" + e + "===undefined?" + t + ":" + e + "|0)"; }) .join(";"), "var a=this.shape,b=this.stride;return new " + i + "(this.data," + g.join(",") + "," + _.join(",") + ",this.offset)}" ), o.push( "proto.pick=function " + i + "_pick(" + c + "){var a=[],b=[],c=this.offset" ); for (m = 0; m < t; ++m) o.push( "if(typeof i" + m + "==='number'&&i" + m + ">=0){c=(c+this.stride[" + m + "]*i" + m + ")|0}else{a.push(this.shape[" + m + "]);b.push(this.stride[" + m + "])}" ); return ( o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"), o.push( "return function construct_" + i + "(data,shape,stride,offset){return new " + i + "(data," + a .map(function (e) { return "shape[" + e + "]"; }) .join(",") + "," + a .map(function (e) { return "stride[" + e + "]"; }) .join(",") + ",offset)}" ), new Function("CTOR_LIST", "ORDER", o.join("\n"))(u[e], s) ); } var u = { float32: [], float64: [], int8: [], int16: [], int32: [], uint8: [], uint16: [], uint32: [], array: [], uint8_clamped: [], buffer: [], generic: [], }; e.exports = function (e, t, i, n) { if (void 0 === e) return (0, u.array[0])([]); "number" == typeof e && (e = [e]), void 0 === t && (t = [e.length]); var a = t.length; if (void 0 === i) { i = new Array(a); for (var s = a - 1, l = 1; s >= 0; --s) (i[s] = l), (l *= t[s]); } if (void 0 === n) for (n = 0, s = 0; s < a; ++s) i[s] < 0 && (n -= (t[s] - 1) * i[s]); for ( var h = (function (e) { if (r(e)) return "buffer"; if (o) switch (Object.prototype.toString.call(e)) { case "[object Float64Array]": return "float64"; case "[object Float32Array]": return "float32"; case "[object Int8Array]": return "int8"; case "[object Int16Array]": return "int16"; case "[object Int32Array]": return "int32"; case "[object Uint8Array]": return "uint8"; case "[object Uint16Array]": return "uint16"; case "[object Uint32Array]": return "uint32"; case "[object Uint8ClampedArray]": return "uint8_clamped"; } return Array.isArray(e) ? "array" : "generic"; })(e), f = u[h]; f.length <= a + 1; ) f.push(c(h, f.length - 1)); return (0, f[a + 1])(e, t, i, n); }; }, function (e, t, i) { var n = i(2).Buffer; function r(e) { n.isBuffer(e) || (e = n.from(e)); for (var t = (e.length / 4) | 0, i = new Array(t), r = 0; r < t; r++) i[r] = e.readUInt32BE(4 * r); return i; } function o(e) { for (; 0 < e.length; e++) e[0] = 0; } function a(e, t, i, n, r) { for ( var o, a, s, c, u = i[0], l = i[1], h = i[2], f = i[3], d = e[0] ^ t[0], p = e[1] ^ t[1], m = e[2] ^ t[2], g = e[3] ^ t[3], _ = 4, v = 1; v < r; v++ ) (o = u[d >>> 24] ^ l[(p >>> 16) & 255] ^ h[(m >>> 8) & 255] ^ f[255 & g] ^ t[_++]), (a = u[p >>> 24] ^ l[(m >>> 16) & 255] ^ h[(g >>> 8) & 255] ^ f[255 & d] ^ t[_++]), (s = u[m >>> 24] ^ l[(g >>> 16) & 255] ^ h[(d >>> 8) & 255] ^ f[255 & p] ^ t[_++]), (c = u[g >>> 24] ^ l[(d >>> 16) & 255] ^ h[(p >>> 8) & 255] ^ f[255 & m] ^ t[_++]), (d = o), (p = a), (m = s), (g = c); return ( (o = ((n[d >>> 24] << 24) | (n[(p >>> 16) & 255] << 16) | (n[(m >>> 8) & 255] << 8) | n[255 & g]) ^ t[_++]), (a = ((n[p >>> 24] << 24) | (n[(m >>> 16) & 255] << 16) | (n[(g >>> 8) & 255] << 8) | n[255 & d]) ^ t[_++]), (s = ((n[m >>> 24] << 24) | (n[(g >>> 16) & 255] << 16) | (n[(d >>> 8) & 255] << 8) | n[255 & p]) ^ t[_++]), (c = ((n[g >>> 24] << 24) | (n[(d >>> 16) & 255] << 16) | (n[(p >>> 8) & 255] << 8) | n[255 & m]) ^ t[_++]), [(o >>>= 0), (a >>>= 0), (s >>>= 0), (c >>>= 0)] ); } var s = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], c = (function () { for (var e = new Array(256), t = 0; t < 256; t++) e[t] = t < 128 ? t << 1 : (t << 1) ^ 283; for ( var i = [], n = [], r = [[], [], [], []], o = [[], [], [], []], a = 0, s = 0, c = 0; c < 256; ++c ) { var u = s ^ (s << 1) ^ (s << 2) ^ (s << 3) ^ (s << 4); (u = (u >>> 8) ^ (255 & u) ^ 99), (i[a] = u), (n[u] = a); var l = e[a], h = e[l], f = e[h], d = (257 * e[u]) ^ (16843008 * u); (r[0][a] = (d << 24) | (d >>> 8)), (r[1][a] = (d << 16) | (d >>> 16)), (r[2][a] = (d << 8) | (d >>> 24)), (r[3][a] = d), (d = (16843009 * f) ^ (65537 * h) ^ (257 * l) ^ (16843008 * a)), (o[0][u] = (d << 24) | (d >>> 8)), (o[1][u] = (d << 16) | (d >>> 16)), (o[2][u] = (d << 8) | (d >>> 24)), (o[3][u] = d), 0 === a ? (a = s = 1) : ((a = l ^ e[e[e[f ^ l]]]), (s ^= e[e[s]])); } return { SBOX: i, INV_SBOX: n, SUB_MIX: r, INV_SUB_MIX: o, }; })(); function u(e) { (this._key = r(e)), this._reset(); } (u.blockSize = 16), (u.keySize = 32), (u.prototype.blockSize = u.blockSize), (u.prototype.keySize = u.keySize), (u.prototype._reset = function () { for ( var e = this._key, t = e.length, i = t + 6, n = 4 * (i + 1), r = [], o = 0; o < t; o++ ) r[o] = e[o]; for (o = t; o < n; o++) { var a = r[o - 1]; o % t == 0 ? ((a = (a << 8) | (a >>> 24)), (a = (c.SBOX[a >>> 24] << 24) | (c.SBOX[(a >>> 16) & 255] << 16) | (c.SBOX[(a >>> 8) & 255] << 8) | c.SBOX[255 & a]), (a ^= s[(o / t) | 0] << 24)) : t > 6 && o % t == 4 && (a = (c.SBOX[a >>> 24] << 24) | (c.SBOX[(a >>> 16) & 255] << 16) | (c.SBOX[(a >>> 8) & 255] << 8) | c.SBOX[255 & a]), (r[o] = r[o - t] ^ a); } for (var u = [], l = 0; l < n; l++) { var h = n - l, f = r[h - (l % 4 ? 0 : 4)]; u[l] = l < 4 || h <= 4 ? f : c.INV_SUB_MIX[0][c.SBOX[f >>> 24]] ^ c.INV_SUB_MIX[1][c.SBOX[(f >>> 16) & 255]] ^ c.INV_SUB_MIX[2][c.SBOX[(f >>> 8) & 255]] ^ c.INV_SUB_MIX[3][c.SBOX[255 & f]]; } (this._nRounds = i), (this._keySchedule = r), (this._invKeySchedule = u); }), (u.prototype.encryptBlockRaw = function (e) { return a( (e = r(e)), this._keySchedule, c.SUB_MIX, c.SBOX, this._nRounds ); }), (u.prototype.encryptBlock = function (e) { var t = this.encryptBlockRaw(e), i = n.allocUnsafe(16); return ( i.writeUInt32BE(t[0], 0), i.writeUInt32BE(t[1], 4), i.writeUInt32BE(t[2], 8), i.writeUInt32BE(t[3], 12), i ); }), (u.prototype.decryptBlock = function (e) { var t = (e = r(e))[1]; (e[1] = e[3]), (e[3] = t); var i = a( e, this._invKeySchedule, c.INV_SUB_MIX, c.INV_SBOX, this._nRounds ), o = n.allocUnsafe(16); return ( o.writeUInt32BE(i[0], 0), o.writeUInt32BE(i[3], 4), o.writeUInt32BE(i[2], 8), o.writeUInt32BE(i[1], 12), o ); }), (u.prototype.scrub = function () { o(this._keySchedule), o(this._invKeySchedule), o(this._key); }), (e.exports.AES = u); }, function (e, t, i) { var n = i(2).Buffer, r = i(127); e.exports = function (e, t, i, o) { if ( (n.isBuffer(e) || (e = n.from(e, "binary")), t && (n.isBuffer(t) || (t = n.from(t, "binary")), 8 !== t.length)) ) throw new RangeError("salt should be Buffer with 8 byte length"); for ( var a = i / 8, s = n.alloc(a), c = n.alloc(o || 0), u = n.alloc(0); a > 0 || o > 0; ) { var l = new r(); l.update(u), l.update(e), t && l.update(t), (u = l.digest()); var h = 0; if (a > 0) { var f = s.length - a; (h = Math.min(a, u.length)), u.copy(s, f, 0, h), (a -= h); } if (h < u.length && o > 0) { var d = c.length - o, p = Math.min(o, u.length - h); u.copy(c, d, h, h + p), (o -= p); } } return ( u.fill(0), { key: s, iv: c, } ); }; }, function (e, t, i) { "use strict"; var n = t; (n.base = i(551)), (n.short = i(552)), (n.mont = i(553)), (n.edwards = i(554)); }, function (e, t, i) { (function (t) { function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(570), o = i(582), a = i(583), s = i(132), c = i(202); function u(e) { var i; "object" !== n(e) || t.isBuffer(e) || ((i = e.passphrase), (e = e.key)), "string" == typeof e && (e = new t(e)); var u, l, h = a(e, i), f = h.tag, d = h.data; switch (f) { case "CERTIFICATE": l = r.certificate.decode(d, "der").tbsCertificate .subjectPublicKeyInfo; case "PUBLIC KEY": switch ( (l || (l = r.PublicKey.decode(d, "der")), (u = l.algorithm.algorithm.join("."))) ) { case "1.2.840.113549.1.1.1": return r.RSAPublicKey.decode(l.subjectPublicKey.data, "der"); case "1.2.840.10045.2.1": return ( (l.subjectPrivateKey = l.subjectPublicKey), { type: "ec", data: l, } ); case "1.2.840.10040.4.1": return ( (l.algorithm.params.pub_key = r.DSAparam.decode( l.subjectPublicKey.data, "der" )), { type: "dsa", data: l.algorithm.params, } ); default: throw new Error("unknown key id " + u); } throw new Error("unknown key type " + f); case "ENCRYPTED PRIVATE KEY": d = (function (e, i) { var n = e.algorithm.decrypt.kde.kdeparams.salt, r = parseInt( e.algorithm.decrypt.kde.kdeparams.iters.toString(), 10 ), a = o[e.algorithm.decrypt.cipher.algo.join(".")], u = e.algorithm.decrypt.cipher.iv, l = e.subjectPrivateKey, h = parseInt(a.split("-")[1], 10) / 8, f = c.pbkdf2Sync(i, n, r, h), d = s.createDecipheriv(a, f, u), p = []; return p.push(d.update(l)), p.push(d.final()), t.concat(p); })((d = r.EncryptedPrivateKey.decode(d, "der")), i); case "PRIVATE KEY": switch ( (u = (l = r.PrivateKey.decode(d, "der")).algorithm.algorithm.join( "." )) ) { case "1.2.840.113549.1.1.1": return r.RSAPrivateKey.decode(l.subjectPrivateKey, "der"); case "1.2.840.10045.2.1": return { curve: l.algorithm.curve, privateKey: r.ECPrivateKey.decode(l.subjectPrivateKey, "der") .privateKey, }; case "1.2.840.10040.4.1": return ( (l.algorithm.params.priv_key = r.DSAparam.decode( l.subjectPrivateKey, "der" )), { type: "dsa", params: l.algorithm.params, } ); default: throw new Error("unknown key id " + u); } throw new Error("unknown key type " + f); case "RSA PUBLIC KEY": return r.RSAPublicKey.decode(d, "der"); case "RSA PRIVATE KEY": return r.RSAPrivateKey.decode(d, "der"); case "DSA PRIVATE KEY": return { type: "dsa", params: r.DSAPrivateKey.decode(d, "der"), }; case "EC PRIVATE KEY": return { curve: (d = r.ECPrivateKey.decode(d, "der")).parameters.value, privateKey: d.privateKey, }; default: throw new Error("unknown key type " + f); } } (e.exports = u), (u.signature = r.signature); }.call(this, i(9).Buffer)); }, function (e, t, i) { (function (t, n) { function r(e, i, n, r, o, a, s) { try { var c = e[a](s), u = c.value; } catch (e) { return void n(e); } c.done ? i(u) : t.resolve(u).then(r, o); } function o(e) { return (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } e.exports = f; var a = i(400)("simple-peer"), s = i(403), c = i(1), u = i(53), l = i(85), h = 5e3; function f(e) { var i, n, r = this; if (!(r instanceof f)) return new f(e); if ( ((r._id = u(4).toString("hex").slice(0, 7)), r._debug("new peer %o", e), (e = Object.assign( { allowHalfOpen: false, }, e )), l.Duplex.call(r, e), (r.channelName = e.initiator ? e.channelName || u(20).toString("hex") : null), (r._isChromium = "undefined" != typeof window && !!window.webkitRTCPeerConnection), (r.initiator = e.initiator || false), (r.channelConfig = e.channelConfig || f.channelConfig), (r.config = Object.assign({}, f.config, e.config)), (r.constraints = r._transformConstraints( e.constraints || f.constraints )), (r.offerConstraints = r._transformConstraints( e.offerConstraints || {} )), (r.answerConstraints = r._transformConstraints( e.answerConstraints || {} )), (r.sdpTransform = e.sdpTransform || function (e) { return e; }), (r.streams = e.streams || (e.stream ? [e.stream] : [])), (r.trickle = void 0 === e.trickle || e.trickle), (r.allowHalfTrickle = void 0 !== e.allowHalfTrickle && e.allowHalfTrickle), (r.iceCompleteTimeout = e.iceCompleteTimeout || h), (r.destroyed = false), (r.connected = false), (r.remoteAddress = void 0), (r.remoteFamily = void 0), (r.remotePort = void 0), (r.localAddress = void 0), (r.localPort = void 0), (r._wrtc = e.wrtc && "object" === o(e.wrtc) ? e.wrtc : s()), !r._wrtc) ) throw "undefined" == typeof window ? p( "No WebRTC support: Specify `opts.wrtc` option in this environment", "ERR_WEBRTC_SUPPORT" ) : p( "No WebRTC support: Not a supported browser", "ERR_WEBRTC_SUPPORT" ); (r._pcReady = false), (r._channelReady = false), (r._iceComplete = false), (r._iceCompleteTimer = null), (r._channel = null), (r._pendingCandidates = []), (r._isNegotiating = !r.initiator), (r._batchedNegotiation = false), (r._queuedNegotiation = false), (r._sendersAwaitingStable = []), (r._senderMap = new Map()), (r._firstStable = true), (r._closingInterval = null), (r._remoteTracks = []), (r._remoteStreams = []), (r._chunk = null), (r._cb = null), (r._interval = null), (r._pc = new r._wrtc.RTCPeerConnection(r.config, r.constraints)), (r._isChromium || (r._wrtc && r._wrtc.electronDaemon)) && ((i = r._wrtc.RTCPeerConnection), ((n = r._pc).createOffer = function (e) { var n = this; return new t(function (t, r) { i.prototype.createOffer.call(n, t, r, e); }); }), (n.createAnswer = function (e) { var n = this; return new t(function (t, r) { i.prototype.createAnswer.call(n, t, r, e); }); }), (n.setLocalDescription = function (e) { var n = this; return new t(function (t, r) { i.prototype.setLocalDescription.call(n, e, t, r); }); }), (n.setRemoteDescription = function (e) { var n = this; return new t(function (t, r) { i.prototype.setRemoteDescription.call(n, e, t, r); }); })), (r._isReactNativeWebrtc = "number" == typeof r._pc._peerConnectionId), (r._pc.oniceconnectionstatechange = function () { r._onIceStateChange(); }), (r._pc.onicegatheringstatechange = function () { r._onIceStateChange(); }), (r._pc.onsignalingstatechange = function () { r._onSignalingStateChange(); }), (r._pc.onicecandidate = function (e) { r._onIceCandidate(e); }), r.initiator ? r._setupData({ channel: r._pc.createDataChannel( r.channelName, r.channelConfig ), }) : (r._pc.ondatachannel = function (e) { r._setupData(e); }), "addTrack" in r._pc && (r.streams && r.streams.forEach(function (e) { r.addStream(e); }), (r._pc.ontrack = function (e) { r._onTrack(e); })), r.initiator && r._needsNegotiation(), (r._onFinishBound = function () { r._onFinish(); }), r.once("finish", r._onFinishBound); } function d(e) { return e.replace(/a=ice-options:trickle\s\n/g, ""); } function p(e, t) { var i = new Error(e); return (i.code = t), i; } function m() {} c(f, l.Duplex), (f.WEBRTC_SUPPORT = !!s()), (f.config = { iceServers: [ { urls: "stun:stun.l.google.com:19302", }, { urls: "stun:global.stun.twilio.com:3478?transport=udp", }, ], }), (f.constraints = {}), (f.channelConfig = {}), Object.defineProperty(f.prototype, "bufferSize", { get: function () { return (this._channel && this._channel.bufferedAmount) || 0; }, }), (f.prototype.address = function () { return { port: this.localPort, family: "IPv4", address: this.localAddress, }; }), (f.prototype.signal = function (e) { var t = this; if (t.destroyed) throw p("cannot signal after peer is destroyed", "ERR_SIGNALING"); if ("string" == typeof e) try { e = JSON.parse(e); } catch (t) { e = {}; } t._debug("signal()"), e.renegotiate && t.initiator && (t._debug("got request to renegotiate"), t._needsNegotiation()), e.candidate && (t._pc.remoteDescription && t._pc.remoteDescription.type ? t._addIceCandidate(e.candidate) : t._pendingCandidates.push(e.candidate)), e.sdp && t._pc .setRemoteDescription(new t._wrtc.RTCSessionDescription(e)) .then(function () { t.destroyed || (t._pendingCandidates.forEach(function (e) { t._addIceCandidate(e); }), (t._pendingCandidates = []), "offer" === t._pc.remoteDescription.type && t._createAnswer()); }) .catch(function (e) { t.destroy(p(e, "ERR_SET_REMOTE_DESCRIPTION")); }), e.sdp || e.candidate || e.renegotiate || t.destroy( p("signal() called with invalid signal data", "ERR_SIGNALING") ); }), (f.prototype._addIceCandidate = function (e) { var t = this; try { t._pc.addIceCandidate( new t._wrtc.RTCIceCandidate(e), m, function (e) { t.destroy(p(e, "ERR_ADD_ICE_CANDIDATE")); } ); } catch (e) { t.destroy( p("error adding candidate: " + e.message, "ERR_ADD_ICE_CANDIDATE") ); } }), (f.prototype.send = function (e) { this._channel.send(e); }), (f.prototype.addStream = function (e) { var t = this; t._debug("addStream()"), e.getTracks().forEach(function (i) { t.addTrack(i, e); }); }), (f.prototype.addTrack = function (e, t) { this._debug("addTrack()"); var i = this._pc.addTrack(e, t), n = this._senderMap.get(e) || new Map(); n.set(t, i), this._senderMap.set(e, n), this._needsNegotiation(); }), (f.prototype.replaceTrack = (function () { var e, i = ((e = regeneratorRuntime.mark(function e(t, i, n) { var r, o, a; return regeneratorRuntime.wrap( function (e) { for (;;) switch ((e.prev = e.next)) { case 0: if ( ((r = this)._debug("replaceTrack()"), (o = r._senderMap.get(t)), (a = o ? o.get(n) : null) || r.destroy( new Error( "Cannot replace track that was never added." ) ), i && r._senderMap.set(i, o), null == a.replaceTrack) ) { e.next = 11; break; } return (e.next = 9), a.replaceTrack(i); case 9: e.next = 12; break; case 11: r.destroy( p( "replaceTrack is not supported in this browser", "ERR_UNSUPPORTED_REPLACETRACK" ) ); case 12: case "end": return e.stop(); } }, e, this ); })), function () { var i = this, n = arguments; return new t(function (t, o) { var a = e.apply(i, n); function s(e) { r(a, t, o, s, c, "next", e); } function c(e) { r(a, t, o, s, c, "throw", e); } s(void 0); }); }); return function (e, t, n) { return i.apply(this, arguments); }; })()), (f.prototype.removeTrack = function (e, t) { this._debug("removeSender()"); var i = this._senderMap.get(e), n = i ? i.get(t) : null; n || this.destroy( new Error("Cannot remove track that was never added.") ); try { this._pc.removeTrack(n); } catch (e) { "NS_ERROR_UNEXPECTED" === e.name ? this._sendersAwaitingStable.push(n) : this.destroy(e); } }), (f.prototype.removeStream = function (e) { var t = this; t._debug("removeSenders()"), e.getTracks().forEach(function (i) { t.removeTrack(i, e); }); }), (f.prototype._needsNegotiation = function () { var e = this; e._debug("_needsNegotiation"), e._batchedNegotiation || ((e._batchedNegotiation = true), setTimeout(function () { (e._batchedNegotiation = false), e._debug("starting batched negotiation"), e.negotiate(); }, 0)); }), (f.prototype.negotiate = function () { this.initiator ? this._isNegotiating ? ((this._queuedNegotiation = true), this._debug("already negotiating, queueing")) : (this._debug("start negotiation"), this._createOffer()) : this._isNegotiating || (this._debug("requesting negotiation from initiator"), this.emit("signal", { renegotiate: true, })), (this._isNegotiating = true); }), (f.prototype.destroy = function (e) { this._destroy(e, function () {}); }), (f.prototype._destroy = function (e, t) { if (!this.destroyed) { if ( (this._debug("destroy (error: %s)", e && (e.message || e)), (this.readable = this.writable = false), this._readableState.ended || this.push(null), this._writableState.finished || this.end(), (this.destroyed = true), (this.connected = false), (this._pcReady = false), (this._channelReady = false), (this._remoteTracks = null), (this._remoteStreams = null), (this._senderMap = null), clearInterval(this._closingInterval), (this._closingInterval = null), clearInterval(this._interval), (this._interval = null), (this._chunk = null), (this._cb = null), this._onFinishBound && this.removeListener("finish", this._onFinishBound), (this._onFinishBound = null), this._channel) ) { try { this._channel.close(); } catch (e) {} (this._channel.onmessage = null), (this._channel.onopen = null), (this._channel.onclose = null), (this._channel.onerror = null); } if (this._pc) { try { this._pc.close(); } catch (e) {} (this._pc.oniceconnectionstatechange = null), (this._pc.onicegatheringstatechange = null), (this._pc.onsignalingstatechange = null), (this._pc.onicecandidate = null), "addTrack" in this._pc && (this._pc.ontrack = null), (this._pc.ondatachannel = null); } (this._pc = null), (this._channel = null), e && this.emit("error", e), this.emit("close"), t(); } }), (f.prototype._setupData = function (e) { var t = this; if (!e.channel) return t.destroy( p( "Data channel event is missing `channel` property", "ERR_DATA_CHANNEL" ) ); (t._channel = e.channel), (t._channel.binaryType = "arraybuffer"), "number" == typeof t._channel.bufferedAmountLowThreshold && (t._channel.bufferedAmountLowThreshold = 65536), (t.channelName = t._channel.label), (t._channel.onmessage = function (e) { t._onChannelMessage(e); }), (t._channel.onbufferedamountlow = function () { t._onChannelBufferedAmountLow(); }), (t._channel.onopen = function () { t._onChannelOpen(); }), (t._channel.onclose = function () { t._onChannelClose(); }), (t._channel.onerror = function (e) { t.destroy(p(e, "ERR_DATA_CHANNEL")); }); var i = false; t._closingInterval = setInterval(function () { t._channel && "closing" === t._channel.readyState ? (i && t._onChannelClose(), (i = true)) : (i = false); }, 5e3); }), (f.prototype._read = function () {}), (f.prototype._write = function (e, t, i) { if (this.destroyed) return i( p("cannot write after peer is destroyed", "ERR_DATA_CHANNEL") ); if (this.connected) { try { this.send(e); } catch (e) { return this.destroy(p(e, "ERR_DATA_CHANNEL")); } this._channel.bufferedAmount > 65536 ? (this._debug( "start backpressure: bufferedAmount %d", this._channel.bufferedAmount ), (this._cb = i)) : i(null); } else this._debug("write before connect"), (this._chunk = e), (this._cb = i); }), (f.prototype._onFinish = function () { var e = this; function t() { setTimeout(function () { e.destroy(); }, 1e3); } e.destroyed || (e.connected ? t() : e.once("connect", t)); }), (f.prototype._startIceCompleteTimeout = function () { a("started iceComplete timeout"); var e = this; e.destroyed || e._iceCompleteTimer || (e._iceCompleteTimer = setTimeout(function () { e._iceComplete || ((e._iceComplete = true), e.emit("iceTimeout"), e.emit("_iceComplete")); }, this.iceCompleteTimeout)); }), (f.prototype._createOffer = function () { var e = this; e.destroyed || e._pc .createOffer(e.offerConstraints) .then(function (t) { function i() { if (!e.destroyed) { var i = e._pc.localDescription || t; e._debug("signal"), e.emit("signal", { type: i.type, sdp: i.sdp, }); } } e.destroyed || (e.trickle || e.allowHalfTrickle || (t.sdp = d(t.sdp)), (t.sdp = e.sdpTransform(t.sdp)), e._pc .setLocalDescription(t) .then(function () { if ((e._debug("createOffer success"), e.destroyed)) return; e.trickle || e._iceComplete ? i() : e.once("_iceComplete", i); }) .catch(function (t) { e.destroy(p(t, "ERR_SET_LOCAL_DESCRIPTION")); })); }) .catch(function (t) { e.destroy(p(t, "ERR_CREATE_OFFER")); }); }), (f.prototype._createAnswer = function () { var e = this; e.destroyed || e._pc .createAnswer(e.answerConstraints) .then(function (t) { function i() { if (!e.destroyed) { var i = e._pc.localDescription || t; e._debug("signal"), e.emit("signal", { type: i.type, sdp: i.sdp, }); } } e.destroyed || (e.trickle || e.allowHalfTrickle || (t.sdp = d(t.sdp)), (t.sdp = e.sdpTransform(t.sdp)), e._pc .setLocalDescription(t) .then(function () { if (e.destroyed) return; e.trickle || e._iceComplete ? i() : e.once("_iceComplete", i); }) .catch(function (t) { e.destroy(p(t, "ERR_SET_LOCAL_DESCRIPTION")); })); }) .catch(function (t) { e.destroy(p(t, "ERR_CREATE_ANSWER")); }); }), (f.prototype._onIceStateChange = function () { if (!this.destroyed) { var e = this._pc.iceConnectionState, t = this._pc.iceGatheringState; this._debug( "iceStateChange (connection: %s) (gathering: %s)", e, t ), this.emit("iceStateChange", e, t), ("connected" !== e && "completed" !== e) || ((this._pcReady = true), this._maybeReady()), "failed" === e && this.destroy( p("Ice connection failed.", "ERR_ICE_CONNECTION_FAILURE") ), "closed" === e && this.destroy(new Error("Ice connection closed.")); } }), (f.prototype.getStats = function (e) { var t = this; 0 === t._pc.getStats.length ? t._pc.getStats().then( function (t) { var i = []; t.forEach(function (e) { i.push(e); }), e(null, i); }, function (t) { e(t); } ) : t._isReactNativeWebrtc ? t._pc.getStats( null, function (t) { var i = []; t.forEach(function (e) { i.push(e); }), e(null, i); }, function (t) { e(t); } ) : t._pc.getStats.length > 0 ? t._pc.getStats( function (i) { if (!t.destroyed) { var n = []; i.result().forEach(function (e) { var t = {}; e.names().forEach(function (i) { t[i] = e.stat(i); }), (t.id = e.id), (t.type = e.type), (t.timestamp = e.timestamp), n.push(t); }), e(null, n); } }, function (t) { e(t); } ) : e(null, []); }), (f.prototype._maybeReady = function () { var e = this; e._debug("maybeReady pc %s channel %s", e._pcReady, e._channelReady), !e.connected && !e._connecting && e._pcReady && e._channelReady && ((e._connecting = true), (function t() { e.destroyed || e.getStats(function (i, n) { if (!e.destroyed) { i && (n = []); var r = {}, o = {}, a = {}, s = false; if ( (n.forEach(function (e) { ("remotecandidate" !== e.type && "remote-candidate" !== e.type) || (r[e.id] = e), ("localcandidate" !== e.type && "local-candidate" !== e.type) || (o[e.id] = e), ("candidatepair" !== e.type && "candidate-pair" !== e.type) || (a[e.id] = e); }), n.forEach(function (e) { "transport" === e.type && e.selectedCandidatePairId && u(a[e.selectedCandidatePairId]), (("googCandidatePair" === e.type && "true" === e.googActiveConnection) || (("candidatepair" === e.type || "candidate-pair" === e.type) && e.selected)) && u(e); }), s || (Object.keys(a).length && !Object.keys(o).length)) ) { if ( ((e._connecting = false), (e.connected = true), e._chunk) ) { try { e.send(e._chunk); } catch (i) { return e.destroy(p(i, "ERR_DATA_CHANNEL")); } (e._chunk = null), e._debug('sent chunk from "write before connect"'); var c = e._cb; (e._cb = null), c(null); } "number" != typeof e._channel.bufferedAmountLowThreshold && ((e._interval = setInterval(function () { e._onInterval(); }, 150)), e._interval.unref && e._interval.unref()), e._debug("connect"), e.emit("connect"); } else setTimeout(t, 100); } function u(t) { s = true; var i = o[t.localCandidateId]; i && i.ip ? ((e.localAddress = i.ip), (e.localPort = Number(i.port))) : i && i.ipAddress ? ((e.localAddress = i.ipAddress), (e.localPort = Number(i.portNumber))) : "string" == typeof t.googLocalAddress && ((i = t.googLocalAddress.split(":")), (e.localAddress = i[0]), (e.localPort = Number(i[1]))); var n = r[t.remoteCandidateId]; n && n.ip ? ((e.remoteAddress = n.ip), (e.remotePort = Number(n.port))) : n && n.ipAddress ? ((e.remoteAddress = n.ipAddress), (e.remotePort = Number(n.portNumber))) : "string" == typeof t.googRemoteAddress && ((n = t.googRemoteAddress.split(":")), (e.remoteAddress = n[0]), (e.remotePort = Number(n[1]))), (e.remoteFamily = "IPv4"), e._debug( "connect local: %s:%s remote: %s:%s", e.localAddress, e.localPort, e.remoteAddress, e.remotePort ); } }); })()); }), (f.prototype._onInterval = function () { !this._cb || !this._channel || this._channel.bufferedAmount > 65536 || this._onChannelBufferedAmountLow(); }), (f.prototype._onSignalingStateChange = function () { var e = this; e.destroyed || ("stable" !== e._pc.signalingState || e._firstStable || ((e._isNegotiating = false), e._debug("flushing sender queue", e._sendersAwaitingStable), e._sendersAwaitingStable.forEach(function (t) { e._pc.removeTrack(t), (e._queuedNegotiation = true); }), (e._sendersAwaitingStable = []), e._queuedNegotiation && (e._debug("flushing negotiation queue"), (e._queuedNegotiation = false), e._needsNegotiation()), e._debug("negotiate"), e.emit("negotiate")), (e._firstStable = false), e._debug("signalingStateChange %s", e._pc.signalingState), e.emit("signalingStateChange", e._pc.signalingState)); }), (f.prototype._onIceCandidate = function (e) { this.destroyed || (e.candidate && this.trickle ? this.emit("signal", { candidate: { candidate: e.candidate.candidate, sdpMLineIndex: e.candidate.sdpMLineIndex, sdpMid: e.candidate.sdpMid, }, }) : e.candidate || this._iceComplete || ((this._iceComplete = true), this.emit("_iceComplete")), e.candidate && this._startIceCompleteTimeout()); }), (f.prototype._onChannelMessage = function (e) { if (!this.destroyed) { var t = e.data; t instanceof ArrayBuffer && (t = n.from(t)), this.push(t); } }), (f.prototype._onChannelBufferedAmountLow = function () { if (!this.destroyed && this._cb) { this._debug( "ending backpressure: bufferedAmount %d", this._channel.bufferedAmount ); var e = this._cb; (this._cb = null), e(null); } }), (f.prototype._onChannelOpen = function () { this.connected || this.destroyed || (this._debug("on channel open"), (this._channelReady = true), this._maybeReady()); }), (f.prototype._onChannelClose = function () { this.destroyed || (this._debug("on channel close"), this.destroy()); }), (f.prototype._onTrack = function (e) { var t = this; t.destroyed || e.streams.forEach(function (i) { t._debug("on track"), t.emit("track", e.track, i), t._remoteTracks.push({ track: e.track, stream: i, }), t._remoteStreams.some(function (e) { return e.id === i.id; }) || (t._remoteStreams.push(i), setTimeout(function () { t.emit("stream", i); }, 0)); }); }), (f.prototype.setConstraints = function (e) { this.initiator ? (this.offerConstraints = this._transformConstraints(e)) : (this.answerConstraints = this._transformConstraints(e)); }), (f.prototype._debug = function () { var e = [].slice.call(arguments); (e[0] = "[" + this._id + "] " + e[0]), a.apply(null, e); }), (f.prototype._transformConstraints = function (e) { if (0 === Object.keys(e).length) return e; if ((e.mandatory || e.optional) && !this._isChromium) { var t = Object.assign({}, e.optional, e.mandatory); return ( void 0 !== t.OfferToReceiveVideo && ((t.offerToReceiveVideo = t.OfferToReceiveVideo), delete t.OfferToReceiveVideo), void 0 !== t.OfferToReceiveAudio && ((t.offerToReceiveAudio = t.OfferToReceiveAudio), delete t.OfferToReceiveAudio), t ); } return e.mandatory || e.optional || !this._isChromium ? e : (void 0 !== e.offerToReceiveVideo && ((e.OfferToReceiveVideo = e.offerToReceiveVideo), delete e.offerToReceiveVideo), void 0 !== e.offerToReceiveAudio && ((e.OfferToReceiveAudio = e.offerToReceiveAudio), delete e.offerToReceiveAudio), { mandatory: e, }); }); }.call(this, i(41), i(9).Buffer)); }, function (e, t, i) { "use strict"; var targetBlockAdjacentPos = i(7); function r(e) { var t = 2, i = 256, n = 10, r = document.createElement("canvas"); (r.width = window.innerWidth - 16), (r.height = i * t); var o = r.getContext("2d"); o.imageSmoothingEnabled = false; var a = document.getElementById("chat"); a.appendChild(r), (a.style.width = r.width + "px"), (a.style.height = i * t + "px"); var s = "", c = 0, l = [], h = 0, f = { player: null, isOpen: false, open: function () { (n = 20), (c = performance.now()), (f.isOpen = true), (i = 512), f.resize(), document.addEventListener("keypress", f.keypress, false), document.addEventListener("keydown", f.keydown, false), document.exitPointerLock(), (e.inputs.state.active = false); }, close: function () { document.removeEventListener("keypress", f.keypress), document.removeEventListener("keydown", f.keydown); var t = document.getElementById("noa-container"); setTimeout(function () { null != t && t.requestPointerLock(); }, 200), (n = 10), (f.isOpen = false), (i = 256), f.resize(), (e.inputs.state.active = true); }, sendMessage: function (msgStr) { if (msgStr.indexOf("/") == 0 || msgStr.indexOf("#") == 0) { var retMessage = 'Unknown command. Type "/help" for help.'; if ( (0 == msgStr.indexOf("/ban") && (retMessage = "Command disabled."), 0 == msgStr.indexOf("/banip") && (retMessage = "Command disabled."), 0 == msgStr.indexOf("/say") && (retMessage = "Command disabled."), 0 == msgStr.indexOf("/deop") && (retMessage = "Command disabled."), 0 == msgStr.indexOf("/kick")) ) { var i = msgStr.substr(msgStr.indexOf("kick") + 5).trim(); retMessage = u.getInstance().kickPlayer(i); } if (msgStr.indexOf("/op") == 0) { retMessage = "Command disabled."; } if (0 == msgStr.indexOf("/tp")) { var playerToStr = msgStr .substr(msgStr.indexOf("tp") + 3) .trim(); // message w/o "/tp " retMessage = u.getInstance().teleportToPlayer(playerToStr); } return ( 0 == msgStr.indexOf("/unban") && (retMessage = "Command disabled."), 0 == msgStr.indexOf("/setspawn") && (retMessage = u.getInstance().setSpawn()), 0 == msgStr.indexOf("/solid") && (retMessage = "Command disabled."), 0 == msgStr.indexOf("/list") && (retMessage = JSON.stringify( u.getInstance().getPlayerNames() ).slice(1, -1)), 0 == msgStr.indexOf("/help") && (retMessage = "Available Commands: /list /kick /tp /setspawn /help"), l.push({ type: "local", message: retMessage, from: "", timestamp: new Date().getTime(), }), void (l.length > 20 && l.shift()) ); } null != f.player && f.player.sendMessage(msgStr); }, keydown: function (e) { if ( (e.shiftKey && 55 == e.keyCode && (e.preventDefault(), f.keypress(e)), 13 == e.keyCode) ) { var t = s.trim(); return ( t.length > 0 && f.sendMessage(t), (s = ""), void f.redraw() ); } 8 == e.keyCode && s.length > 0 && (s = s.substring(0, s.length - 1)), f.redraw(); }, keypress: function (e) { if (!(performance.now() < c + 100)) { var t = e.key, i = 10; null != f.player && (i = f.player.state.name.length), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\\\"#%/()=+?[]{}<>@|$;".indexOf( t ) >= 0 && s.length < 64 - (i + 2) && (s += t), f.redraw(); } }, update: function (e) { for ( l = (function (e) { for (var t = e.concat(), i = 0; i < t.length; ++i) for (var n = i + 1; n < t.length; ++n) JSON.stringify(t[i]) === JSON.stringify(t[n]) && t.splice(n--, 1); return t; })(l.concat(e)); l.length > 20; ) l.shift(); f.redraw(); }, tick: function () { var e = new Date().getTime(); if (!(e < h + 1e3)) { for (var t = false, i = 0; i < l.length; i++) { l[i].timestamp + 1e4 < e && ((l[i].isOld = true), (t = true)); } t && f.redraw(), (h = e); } }, redraw: function () { o.clearRect(0, 0, r.width, i * t), (o.font = 14 * t + "px Minecraft, sans-serif"), (o.textBaseline = "alphabetic"), (o.textAlign = "left"); var e = 4 * t, a = 2 * t; if (f.isOpen) { (o.fillStyle = "rgba(0,0,0,0.6)"), o.fillRect(0, i * t - 25 * t, r.width, i * t); var c = i * t - 7 * t; (o.fillStyle = "rgb(63,63,63)"), o.fillText("> " + s, e + a, c + a), (o.fillStyle = "rgb(255,255,255)"), o.fillText("> " + s, e, c); } e = 0; for (var u = 1, h = l.length - 1; h >= 0; h--) if (!l[h].isOld || f.isOpen) { if (u > n) break; var d = "", p = "rgb(255,255,255)"; switch (l[h].type) { case "message": d = l[h].from + ": " + l[h].message; break; case "left": (d = l[h].from + " left the game"), (p = "rgb(255,255,64)"); break; case "joined": (d = l[h].from + " joined the game"), (p = "rgb(255,255,64)"); break; case "local": (d = l[h].message), (p = "rgb(255,255,64)"); } var m = i * t - 25 * t - 15 * u++ * t; (o.fillStyle = "rgb(63,63,63)"), o.fillText(d, e + a, m + a), (o.fillStyle = p), o.fillText(d, e, m); } }, resize: function () { (t = 2), window.innerHeight < 600 && (t = 1), (r.width = window.innerWidth - 16), (r.height = i * t), (a.style.width = r.width + "px"), (a.style.height = i * t + "px"), (o.imageSmoothingEnabled = false), f.redraw(); }, }; return f.resize(), f; } var blockInHand = function (e) { return r(e); }; function isLocalPlayer(e) { return ( (function (e) { if (Array.isArray(e)) { for (var t = 0, i = new Array(e.length); t < e.length; t++) i[t] = e[t]; return i; } })(e) || (function (e) { if ( Symbol.iterator in Object(e) || "[object Arguments]" === Object.prototype.toString.call(e) ) return Array.from(e); })(e) || (function () { throw new TypeError( "Invalid attempt to spread non-iterable instance" ); })() ); } function s(e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; (n.enumerable = n.enumerable || false), (n.configurable = true), "value" in n && (n.writable = true), Object.defineProperty(e, n.key, n); } } window.BABYLON = i(411); var c = (function () { function e() { return ( (function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); })(this, e), e.instance || (e.instance = this), e.instance ); } var t, r, c; return ( (t = e), (c = [ { key: "getInstance", value: function () { return ( void 0 === e.instance && (e.instance = new e()), e.instance ); }, }, ]), (r = [ { key: "initialize", value: function (e) { var t = this; (this.playerSpawned = false), (this.worldGenerated = false), (this.worldInitialized = false), (this.client = null), (this.network = e.network); var r = i(412), s = i(495); this.soundPlayer = i(497)(); var c, u = i(499), l = i(500), h = i(501), f = i(502), d = i(503), p = i(194), m = u(), g = 32, _ = 128, v = 30, y = null, b = false, E = false, T = this; if (Math.round(e.seed) == e.seed) { this.player = void 0 !== e.player ? e.player : null; var A = new URLSearchParams(window.location.search), x = A.get("size"); if ( ("small" == x && (_ = 128), "normal" == x && (_ = 256), "huge" == x && (_ = 512), targetBlockAdjacentPos.default.getInstance().gameSaved() ? (_ = targetBlockAdjacentPos.default .getInstance() .getWorldSize()) : targetBlockAdjacentPos.default .getInstance() .setWorldSize(_), "undefined" != typeof Worker) ) { if (void 0 === S) { var S = new Worker("assets/js/RandomLevelWorker.js"); S.postMessage({ worldSize: _, seed: e.seed, }), m.show(); } S.onmessage = function (e) { var t = e.data; (m.task = t.string), (m.percent = t.percent), m.tick(), null != t.tiles && ((y = t.tiles), (T.worldGenerated = true), null == T.client ? targetBlockAdjacentPos.default .getInstance() .gameSaved() ? (T.syncSavedWorld(), Ee()) : Ee() : T.client && (T.hostInfo ? T.hostInfo.numberOfChangedBlocks <= 0 ? Ee() : T.client.broadcast({ type: "requestChanges", from: T.client.state.changedBlocks.length, }) : Ee())); }; } else console.log("No worker support."); var C = 0.5 * _, P = 8e3, R = 24e3, M = 8e3, O = 24e3, w = 3e3, I = 12e3, D = { chunkSize: g, chunkAddDistance: 7, chunkRemoveDistance: 8, blockTestDistance: 6, playerStart: [C + 0.5, 48, C + 0.5], playerHeight: 1.8, texturePath: "assets/textures/", useAO: false, stickyPointerLock: true, }; this.lightDepths = new Array(_); for (var L = 0; L < _; L++) this.lightDepths[L] = new Array(_); var F = { music: false, sound: true, invert: false, fps: false, drawDistance: 0, forward: "W", left: "A", backward: "S", right: "D", jump: "", build: "B", chat: "T", fog: "F", saveLoc: "", loadLoc: "R", username: "", }, B = JSON.parse(localStorage.getItem("settings")); null == B || B.back || (F = B); var N = { forward: F.forward, left: F.left, backward: F.backward, right: F.right, fire: "", "mid-fire": "", "alt-fire": "", jump: F.jump, build: F.build, chat: F.chat, fog: F.fog, saveLoc: F.saveLoc, loadLoc: F.loadLoc, spawnSteve: "G", }; (D.bindings = N), (D.settings = F), (this.soundPlayer.musicOn = F.music), (this.soundPlayer.soundOn = F.sound); var k = r(D); k.setPaused(true), (k.worldSize = _), (k.worldHeight = 64), (k.waterLevel = v), (k.time = 0), (k.rendering._camera.minZ = 0.1), (k.rendering._camera.fov = (70 * Math.PI) / 180), (k.rendering._scene.fogColor = new BABYLON.Color3( 0.9, 0.95, 1 )), (k.rendering._scene.fogMode = BABYLON.Scene.FOGMODE_EXP2), (k.rendering._scene.fogDensity = 0.002), (k.rendering._scene.clearColor = k.rendering._scene.fogColor), this.hostInfo ? (k.hostInfo = this.hostInfo) : (k.hostInfo = { maxPlayers: this.player.network.maxPlayers, }); var U = l(k), V = h(U), G = f(k, e.singlePlayer), z = p(k); this.addParticles = s(k); var j = U.currentId - 1; k.on("tick", function (e) { if ( ((k.time += e), null != T.player && null == c.player && (c.player = T.player), c && c.tick(), z && z.isOpen && z.tick(), W && (W.material.diffuseTexture.uOffset = 2e-7 * k.time), T.steveArray) ) for (var t = 0; t < T.steveArray.length; t++) { var i = T.steveArray[t]; if ((i.tick(e), i.state.shouldRemove)) i.remove(), (T.steveArray.splice(t, 1)[0] = null); } !(function () { if (k.time > he + le) { var e = fe.slice(); fe.length = 0; for (var t = 0; t < e.length; t++) { var i, n = e[t]; (i = n).func.apply(i, isLocalPlayer(n.args)); } he = k.time; } if (k.time > me + pe) { var e = ge.slice(); ge.length = 0; for (var t = 0; t < e.length; t++) { var r, n = e[t]; (r = n).func.apply(r, isLocalPlayer(n.args)); } me = k.time; } })(); }), (this.getBrightness = function (e, t, i) { return e < 0 || t < 0 || i < 0 || e >= _ - 1 || i >= _ - 1 ? t >= v ? 1 : 0.6 : t >= T.lightDepths[e][i] + 1 ? 1 : 0.6; }), (k.getBrightness = this.getBrightness), (this.addBlockCheckLit = function (e, t, i) { var n = this.lightDepths[e][i]; if (t >= n) { if (Math.floor(t / g) != Math.floor(n / g)) { var r = k.world.getBlockID(e, n, i); k.world.setBlockID(0, e, n, i), k.world.setBlockID(r, e, n, i); } this.lightDepths[e][i] = t; } }), (this.removeBlockCheckLit = function (x, y, z) { // returns light value at position of removed block // lowest block exposed to sunlight at pos var lightDepth = this.lightDepths[x][z]; if (y >= lightDepth) { // loop thru blocks under y, check if transparent for ( var blockID = 0, lowestLit = y; (0 == blockID || blockID == this.redflowerID || blockID == this.yellowflowerID || blockID == this.bushID || blockID == this.redmushroomID || blockID == this.brownmushroomID || blockID == this.glassID || blockID == this.leafID || blockID == this.emptySpongeID) && lowestLit >= 0; ) { lowestLit -= 1; blockID = k.world.getBlockID(x, lowestLit, z); } if ( Math.floor(lowestLit / g) != Math.floor(lightDepth / g) ) { k.world.setBlockID(0, x, lowestLit, z); k.world.setBlockID(blockID, x, lowestLit, z); } // update lightDepths to lowest Y position lit this.lightDepths[x][z] = lowestLit; return 1; } return 0.6; }); var H = function e() { var t = false; if ( (T.hostInfo && null != T.hostInfo.spawnPoint && null != T.hostInfo.spawnPoint && (t = true), t) ) k.entities.setPosition( k.playerEntity, T.hostInfo.spawnPoint.x, T.hostInfo.spawnPoint.y, T.hostInfo.spawnPoint.z ); else { for (var i = 0, n = 0; i < v && n < 50; ) { var r = Math.floor(C - _ / 4 + Math.random() * (_ / 2)) + 0.5, o = Math.floor(C - _ / 4 + Math.random() * (_ / 2)) + 0.5, a = k.pick([r, 100, o], [0, -1, 0], 1e3, true); null != a && (i = a.position[1]), ++n; } if (n >= 50) return void setTimeout(e, 100); k.entities.setPosition( k.playerEntity, a.position[0], a.position[1] + 1, a.position[2] ); } m.hide(), T.updateResetPosition(), (T.playerSpawned = true), setTimeout(function () { k.entities.setPhysicsInterpolation( k.playerEntity, true ); }, 100); }, W = i(504)(k), X = (i(505)(k), i(506)(k, g), i(507)), Y = i(508), K = [ "grass", "dirt", "grass_dirt", "stone", "wood", "rock", "bedrock", "sand", "gravel", "tree_top", "tree_side", "lava", "rock_gold", "rock_bronze", "rock_coal", "gold", "sponge", "color0", "color1", "color2", "color3", "color4", "color5", "color6", "color7", "color8", "color9", "color10", "color11", "color12", "color13", "color14", "color15", ], Q = [ "leaves_opaque", "glass", "water", "bush", "red_flower", "yellow_flower", "red_mushroom", "brown_mushroom", ]; for (L = 0; L < K.length; L++) { var q = null; "lava" == (Z = K[L]) && (q = [0.4, 0, 0, 0.95]), k.registry.registerMaterial(Z, q, Z + ".png"); } for (L = 0; L < Q.length; L++) { var Z; q = null; "water" == (Z = Q[L]) && (q = [0, 0, 0.4, 0.85]); k.registry.registerMaterial(Z, q, Z + ".png", true); } k.registry.registerMaterial( "empty_sponge", [0, 0, 0, 0], null, true ); var J = [], $ = [null, null, null, 8, 5, 6, 15, 16]; for (L = 3; L < 8; L++) { var ee = Q[L], te = X(k); ((oe = k.rendering.makeStandardMaterial( ee + "Mat" )).diffuseTexture = new BABYLON.Texture( "assets/textures/" + ee + ".png", scene, true, true, 1 )), (oe.diffuseTexture.hasAlpha = true), (oe.diffuseTexture.getAlphaFromRGB = true), (te.material = oe); var ie = $[L], ne = k.registry.registerBlock(ie, { material: [null, ee, null, null, null, null], opaque: false, blockMesh: te, }); J.push(ne); } (this.grassID = k.registry.registerBlock(1, { material: ["grass", "dirt", "grass_dirt"], })), (this.stoneID = k.registry.registerBlock(2, { material: "stone", })), (this.dirtID = k.registry.registerBlock(3, { material: "dirt", })), (this.woodID = k.registry.registerBlock(4, { material: "wood", })), (this.redflowerID = J[1]), (this.yellowflowerID = J[2]), (this.waterID = k.registry.registerBlock(7, { material: "water", opaque: false, solid: false, fluid: true, fluidDensity: 1, viscosity: 0.5, })), (this.bushID = J[0]), (this.rockID = k.registry.registerBlock(9, { material: "rock", })), (this.bedrockID = k.registry.registerBlock(10, { material: "bedrock", })), (this.sandID = k.registry.registerBlock(11, { material: "sand", })), (this.gravelID = k.registry.registerBlock(12, { material: "gravel", })), (this.treeID = k.registry.registerBlock(13, { material: ["tree_top", "tree_top", "tree_side"], })), (this.leafID = k.registry.registerBlock(14, { material: "leaves_opaque", opaque: false, })), (this.redmushroomID = J[3]), (this.brownmushroomID = J[4]), (this.lavaID = k.registry.registerBlock(17, { material: "lava", solid: false, fluid: true, fluidDensity: 1, viscosity: 0.5, })), (this.rockGoldID = k.registry.registerBlock(18, { material: "rock_gold", })), (this.rockbronzeID = k.registry.registerBlock(19, { material: "rock_bronze", })), (this.rockcoalID = k.registry.registerBlock(20, { material: "rock_coal", })), (this.goldID = k.registry.registerBlock(21, { material: "gold", })), (this.spongeID = k.registry.registerBlock(22, { material: "sponge", })), (this.glassID = k.registry.registerBlock(23, { material: "glass", opaque: false, })), (this.colorBlockArray = []); for (L = 0; L < 16; L++) { var re = k.registry.registerBlock(24 + L, { material: "color" + L, }); this.colorBlockArray.push(re); } this.emptySpongeID = k.registry.registerBlock(40, { material: "empty_sponge", opaque: false, solid: false, }); var oe; te = Y(k); ((oe = k.rendering.makeStandardMaterial( ee + "Mat" )).diffuseTexture = k.waterTexture), (oe.alpha = 0.85), (oe.useAlphaFromDiffuseTexture = true), (oe.backFaceCulling = false), (oe.disableLighting = true), (oe.emissiveColor = new BABYLON.Color3(0.6, 0.6, 0.6)), (te.material = oe), (this.waterHackID = k.registry.registerBlock(41, { material: [null, "water", null, null, null, null], opaque: false, solid: false, fluid: true, fluidDensity: 1, viscosity: 0.5, blockMesh: te, })), (this.soundArray = [ null, { id: "grass", volume: 0.9, pitch: 1, }, { id: "stone", volume: 1, pitch: 1, }, { id: "grass", volume: 0.8, pitch: 1, }, { id: "wood", volume: 1, pitch: 1, }, null, null, null, null, { id: "stone", volume: 1, pitch: 1, }, null, { id: "gravel", volume: 0.8, pitch: 1, }, { id: "gravel", volume: 0.8, pitch: 1, }, { id: "wood", volume: 1, pitch: 1, }, { id: "grass", volume: 1, pitch: 0.4, }, null, null, null, { id: "stone", volume: 1, pitch: 1, }, { id: "stone", volume: 1, pitch: 1, }, { id: "stone", volume: 1, pitch: 1, }, { id: "metal", volume: 0.7, pitch: 1, }, { id: "cloth", volume: 1, pitch: 0.9, }, { id: "metal", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, { id: "cloth", volume: 1, pitch: 1, }, ]), (this.blockArray = [ this.grassID, this.stoneID, this.dirtID, this.woodID, this.redflowerID, this.yellowflowerID, this.waterID, this.bushID, this.rockID, this.bedrockID, this.sandID, this.gravelID, this.treeID, this.leafID, this.redmushroomID, this.brownmushroomID, this.lavaID, this.rockGoldID, this.rockbronzeID, this.rockcoalID, this.goldID, this.spongeID, this.glassID, ]); for (L = 0; L < this.colorBlockArray.length; L++) this.blockArray.push(this.colorBlockArray[L]); var ae = i(509)(k, this.blockArray); ae.setBlock(j), window.addEventListener("beforeunload", function (e) { !T.playerSpawned || b || E || (e.preventDefault(), (e.returnValue = "")); }), document.addEventListener("mousewheel", Ae, false), document.addEventListener("DOMMouseScroll", Ae, false), k.inputs.down.on("fire", function () { if (k.targetedBlock) { var e = { targetedBlockBlockID: k.targetedBlock.blockID, targetedBlockPosition: k.targetedBlock.position, targetedBlockAdjacentPosition: k.targetedBlock.adjacent, chosenBlock: j, addMode: k.addMode, }; k.addMode && (e.localPlayer = true); var t = T.handleFireEvent(e); delete e.localPlayer, null != T.player && t && T.player.emitFireEvent(e); } }), k.inputs.down.on("mid-fire", function () { if (k.targetedBlock) { var e = k.targetedBlock.blockID; if ( e == T.rockcoalID || e == T.rockbronzeID || e == T.rockGoldID ) return; 1 == e && (e = 3), U.pick(e), (j = e - 1), ae.setBlock(j); } }), k.inputs.down.on("alt-fire", function () { k.addMode ? (k.addMode = false) : ((k.addMode = true), ae.setBlock(j)), k.resetTargetBlock(), k.emit("targetBlockChanged", k.targetedBlock); }), document.addEventListener( "keydown", function (e) { var t = e.keyCode; if ( (8 == t && e.preventDefault(), e.ctrlKey && e.preventDefault(), !z.isOpen && se) ) if (((se = false), 27 == t && c.isOpen)) c.close(); else if ( (27 == t && (G.isOpen ? G.close() : (G.open(), V.isOpen && V.close())), !G.isOpen && (!c || !c.isOpen) && t >= 49 && t <= 57) ) { var i = t - 49; U.setIndex(i), (j = U.currentId - 1), ae.setBlock(j); } }, false ), document.addEventListener( "keyup", function (e) { se = true; }, false ); var se = true; k.inputs.down.on("build", function (e, t) { G.isOpen || c.isOpen || V.open(); }), k.inputs.down.on("chat", function (e, t) { G.isOpen || c.isOpen || (V.isOpen && V.close(), c.open()); }), k.inputs.down.on("fog", function (e, t) { G.isOpen || c.isOpen || ye(); }), k.inputs.down.on("saveLoc", function (e, t) { G.isOpen || c.isOpen || T.updateResetPosition(); }), k.inputs.down.on("loadLoc", function (e, t) { G.isOpen || c.isOpen || T.applyResetPosition(); }), k.inputs.down.on("spawnSteve", function (e, t) { G.isOpen || c.isOpen || T.spawnSteve(); }); var ce = false; document.addEventListener( "pointerlockchange", function (e) { var t = false; c && (t = c.isOpen), null != document.pointerLockElement || !ce || V.isOpen || t || z.isOpen ? ((ce = true), (k.inputs.state.forward = false), (k.inputs.state.backward = false), (k.inputs.state.left = false), (k.inputs.state.right = false), t && se && c.close()) : G.open(); }, false ), window.addEventListener("resize", function (e) { G.resize(), m.resize(), z.resize(), U.resize(), c && c.resize(), k.version && k.version.resize(), V.resize(); }), k.on("setPreviewBlock", function (e) { (j = e - 1), ae.setBlock(j); }); var ue = { position: [ D.playerStart[0], D.playerStart[1], D.playerStart[2], ], rotation: [0, 0, 0], }; (this.setPlayerPosition = function (e) { var t = k.playerEntity; k.entities.setPhysicsInterpolation(t, false), k.entities.setPosition(t, e[0], e[1] + 0.5, e[2]), setTimeout(function () { k.entities.setPhysicsInterpolation(t, true); }, 100); }), (this.updateResetPosition = function () { var e = k.playerEntity, t = k.entities.getPosition(e); (ue.position[0] = t[0]), (ue.position[1] = t[1]), (ue.position[2] = t[2]), (ue.rotation[0] = 0), (ue.rotation[1] = k.rendering._rotationHolder.rotation.y), (ue.rotation[2] = 0), T.applyResetPosition(); }), (this.applyResetPosition = function () { k.entities.setPhysicsInterpolation(k.playerEntity, false); var e = k.playerEntity; k.entities.setPosition( e, ue.position[0], ue.position[1] + 0.5, ue.position[2] ), (k.rendering._rotationHolder.rotation.x = ue.rotation[0]), (k.rendering._rotationHolder.rotation.y = ue.rotation[1]), (k.rendering._rotationHolder.rotation.z = ue.rotation[2]), setTimeout(function () { k.entities.setPhysicsInterpolation( k.playerEntity, true ); }, 100); }), (this.steveArray = []), (this.spawnSteve = function () { var e = k.entities.getPositionData(k.playerEntity), t = i(510), n = e.position[0], r = e.position[1] + 0.5, o = e.position[2], a = t(k, n, r, o); T.steveArray.push(a); }); var le = 250, he = 0, fe = [], de = function (e, t) { fe.push({ func: e, args: t, }); }, pe = 1500, me = 0, ge = [], _e = function (e, t) { ge.push({ func: e, args: t, }); }; (this.checkWaterBelowAdd = function (e, t, i) { var n = this.waterID; this.shouldWaterHaveSurface(e, t, i) && (n = this.waterHackID), this.setBlock(n, e, t, i); var r = k.world.getBlockID(e - 1, t, i), o = k.world.getBlockID(e + 1, t, i), a = k.world.getBlockID(e, t, i + 1), s = k.world.getBlockID(e, t, i - 1); if (r == this.waterID || r == this.waterHackID) { n = this.waterID; var c = k.world.getBlockID(e - 1, t + 1, i); this.shouldWaterHaveSurface(e - 1, t, i) && 0 != c && (n = this.waterHackID), this.setBlock(n, e - 1, t, i); } if (o == this.waterID || o == this.waterHackID) { n = this.waterID; var u = k.world.getBlockID(e + 1, t + 1, i); this.shouldWaterHaveSurface(e + 1, t, i) && 0 != u && (n = this.waterHackID), this.setBlock(n, e + 1, t, i); } if (a == this.waterID || a == this.waterHackID) { n = this.waterID; var l = k.world.getBlockID(e, t + 1, i + 1); this.shouldWaterHaveSurface(e, t, i + 1) && 0 != l && (n = this.waterHackID), this.setBlock(n, e, t, i + 1); } if (s == this.waterID || s == this.waterHackID) { n = this.waterID; var h = k.world.getBlockID(e, t + 1, i - 1); this.shouldWaterHaveSurface(e, t, i - 1) && 0 != h && (n = this.waterHackID), this.setBlock(n, e, t, i - 1); } }), (this.checkWaterHackBelowDestroy = function (e, t, i) { k.world.getBlockID(e, t, i) == this.waterHackID && this.addBlock(this.waterID, e, t, i); var n, r = k.world.getBlockID(e - 1, t, i), o = k.world.getBlockID(e + 1, t, i), a = k.world.getBlockID(e, t, i + 1), s = k.world.getBlockID(e, t, i - 1); if (r == this.waterID || r == this.waterHackID) { n = this.waterID; var c = k.world.getBlockID(e - 1, t + 1, i); this.shouldWaterHaveSurface(e - 1, t, i) && 0 != c && (n = this.waterHackID), this.setBlock(n, e - 1, t, i); } if (o == this.waterID || o == this.waterHackID) { n = this.waterID; var u = k.world.getBlockID(e + 1, t + 1, i); this.shouldWaterHaveSurface(e + 1, t, i) && 0 != u && (n = this.waterHackID), this.setBlock(n, e + 1, t, i); } if (a == this.waterID || a == this.waterHackID) { n = this.waterID; var l = k.world.getBlockID(e, t + 1, i + 1); this.shouldWaterHaveSurface(e, t, i + 1) && 0 != l && (n = this.waterHackID), this.setBlock(n, e, t, i + 1); } if (s == this.waterID || s == this.waterHackID) { n = this.waterID; var h = k.world.getBlockID(e, t + 1, i - 1); this.shouldWaterHaveSurface(e, t, i - 1) && 0 != h && (n = this.waterHackID), this.setBlock(n, e, t, i - 1); } }), (this.shouldWaterHaveSurface = function (e, t, i) { var n = k.world.getBlockID(e, t + 1, i), r = k.world.getBlockID(e - 1, t + 1, i), o = k.world.getBlockID(e + 1, t + 1, i), a = k.world.getBlockID(e, t + 1, i + 1), s = k.world.getBlockID(e, t + 1, i - 1); return ( (0 == n || 0 == r || 0 == o || 0 == a || 0 == s) && n != this.waterID && r != this.waterID && o != this.waterID && a != this.waterID && s != this.waterID && n != this.waterHackID && r != this.waterHackID && o != this.waterHackID && a != this.waterHackID && s != this.waterHackID ); }), (this.addWater = function (e, t, i) { if ( e < 0 || e >= k.worldSize - 1 || i < 0 || i >= k.worldSize - 1 ) return false; var n = this.waterID, r = k.world.getBlockID(e, t + 1, i); if ( (this.shouldWaterHaveSurface(e, t, i) && 0 != r && r != this.emptySpongeID && (n = this.waterHackID), this.addBlock(this.waterID, e, t, i), n != this.waterID) ) { this.addBlock(n, e, t, i); var o = k.world.getBlockID(e - 1, t, i), a = k.world.getBlockID(e + 1, t, i), s = k.world.getBlockID(e, t, i + 1), c = k.world.getBlockID(e, t, i - 1), u = k.world.getBlockID(e - 1, t + 1, i), l = k.world.getBlockID(e + 1, t + 1, i), h = k.world.getBlockID(e, t + 1, i + 1), f = k.world.getBlockID(e, t + 1, i - 1); o == this.waterID && 0 != u && (k.setBlock(n, e - 1, t, i), this.setBlockTilesArray(n, e - 1, t, i)), a == this.waterID && 0 != l && (k.setBlock(n, e + 1, t, i), this.setBlockTilesArray(n, e - 1, t, i)), s == this.waterID && 0 != h && (k.setBlock(n, e, t, i + 1), this.setBlockTilesArray(n, e - 1, t, i)), c == this.waterID && 0 != f && (k.setBlock(n, e, t, i - 1), this.setBlockTilesArray(n, e - 1, t, i)); } var d = k.world.getBlockID(e, t - 1, i); return ( d == this.grassID && this.flagToRemoveGrass(e, t - 1, i), d == this.lavaID && this.setBlock(this.stoneID, e, t - 1, i), d == this.waterHackID && this.setBlock(this.waterID, e, t - 1, i), true ); }), (this.addLava = function (e, t, i) { this.addBlock(this.lavaID, e, t, i); var n = k.world.getBlockID(e, t - 1, i); n == this.grassID && this.flagToRemoveGrass(e, t - 1, i), n == this.waterID && this.setBlock(this.stoneID, e, t - 1, i); }), (this.checkNeighbours = function (e, t, i, n) { if ( !( e < 0 || e >= k.worldSize - 1 || i < 0 || i >= k.worldSize - 1 ) && 0 == k.world.getBlockID(e, t, i) ) { var r = k.world.getBlockID(e, t + 1, i), o = k.world.getBlockID(e - 1, t, i), a = k.world.getBlockID(e + 1, t, i), s = k.world.getBlockID(e, t, i + 1), c = k.world.getBlockID(e, t, i - 1); (r != T.lavaID && o != T.lavaID && a != T.lavaID && s != T.lavaID && c != T.lavaID) || setTimeout(function () { T.addLava(e, t, i), _e(T.checkNeighboursAsLava, [e, t, i]); }, 1500), (r != T.waterID && o != T.waterID && a != T.waterID && s != T.waterID && c != T.waterID && r != T.waterHackID && o != T.waterHackID && a != T.waterHackID && s != T.waterHackID && c != T.waterHackID) || setTimeout(function () { T.addWater(e, t, i) && de(T.checkNeighboursAsWater, [e, t, i]); }, 150), n && setTimeout(function () { T.checkWaterHackBelowDestroy(e, t - 1, i); }, 160); } }), (this.checkNeighboursAsWater = function (e, t, i) { if ( !( e <= 0 || e >= k.worldSize - 1 || i <= 0 || i >= k.worldSize - 1 ) ) { var n = k.world.getBlockID(e, t - 1, i), r = k.world.getBlockID(e - 1, t, i), o = k.world.getBlockID(e + 1, t, i), a = k.world.getBlockID(e, t, i + 1), s = k.world.getBlockID(e, t, i - 1); 0 == n && T.addWater(e, t - 1, i) && de(T.checkNeighboursAsWater, [e, t - 1, i]), 0 == r && T.addWater(e - 1, t, i) && de(T.checkNeighboursAsWater, [e - 1, t, i]), 0 == o && T.addWater(e + 1, t, i) && de(T.checkNeighboursAsWater, [e + 1, t, i]), 0 == a && T.addWater(e, t, i + 1) && de(T.checkNeighboursAsWater, [e, t, i + 1]), 0 == s && T.addWater(e, t, i - 1) && de(T.checkNeighboursAsWater, [e, t, i - 1]); } }), (this.checkNeighboursAsLava = function (e, t, i) { if ( !( e < 0 || e > k.worldSize - 1 || i < 0 || i > k.worldSize - 1 ) ) { var n = k.world.getBlockID(e, t - 1, i), r = k.world.getBlockID(e - 1, t, i), o = k.world.getBlockID(e + 1, t, i), a = k.world.getBlockID(e, t, i + 1), s = k.world.getBlockID(e, t, i - 1); 0 == n && (T.addLava(e, t - 1, i), _e(T.checkNeighboursAsLava, [e, t - 1, i])), 0 == r && (T.addLava(e - 1, t, i), _e(T.checkNeighboursAsLava, [e - 1, t, i])), 0 == o && (T.addLava(e + 1, t, i), _e(T.checkNeighboursAsLava, [e + 1, t, i])), 0 == a && (T.addLava(e, t, i + 1), _e(T.checkNeighboursAsLava, [e, t, i + 1])), 0 == s && (T.addLava(e, t, i - 1), _e(T.checkNeighboursAsLava, [e, t, i - 1])); } }), (this.flagToGrowGrass = function (e, t, i) { var n = P + Math.random() * (R - P); setTimeout(function () { if (k.world.getBlockID(e, t, i) == T.dirtID) { var n = T.checkUpForBlocker(e, t, i); (0 != n && n != T.redflowerID && n != T.yellowflowerID && n != T.bushID && n != T.redmushroomID && n != T.brownmushroomID && n != T.glassID && n != T.leafID) || T.setBlock(T.grassID, e, t, i); } }, n); }), (this.flagToRemoveGrass = function (e, t, i) { var n = M + Math.random() * (O - M); setTimeout(function () { if (k.world.getBlockID(e, t, i) == T.grassID) { var n = T.checkUpForBlocker(e, t, i); 0 != n && n != T.redflowerID && n != T.yellowflowerID && n != T.bushID && n != T.redmushroomID && n != T.brownmushroomID && n != T.glassID && n != T.leafID && T.setBlock(T.dirtID, e, t, i); } }, n); }), (this.checkBelowFoilage = function (e, t, i) { var n = w + Math.random() * (I - w); setTimeout(function () { var n = k.world.getBlockID(e, t, i); if ( n == T.redflowerID || n == T.yellowflowerID || n == T.bushID || n == T.redmushroomID || n == T.brownmushroomID ) { var r = k.world.getBlockID(e, t - 1, i); r != T.grassID && r != T.dirtID && (T.setBlock(0, e, t, i), de(T.checkNeighbours, [e, t, i])); } }, n); }), (this.checkAboveFoilage = function (e, t, i) { var n = w + Math.random() * (I - w); setTimeout(function () { var n = k.world.getBlockID(e, t, i); if ( (n == T.redflowerID || n == T.yellowflowerID || n == T.bushID || n == T.redmushroomID || n == T.brownmushroomID) && T.getBrightness(e, t, i) < 1 ) { T.setBlock(0, e, t, i), de(T.checkNeighbours, [e, t, i]); var r = k.world.getBlockID(e, t + 1, i); (r != T.sandID && r != T.gravelID) || T.checkDownSandGravel(e, t + 1, i, r); } }, n); }), (this.checkDownForGrass = function (e, t, i) { for ( var n = 0, r = t; (0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID) && r >= 0; ) (r -= 1), ((n = k.world.getBlockID(e, r, i)) != this.redflowerID && n != this.yellowflowerID && n != this.bushID && n != this.redmushroomID && n != this.brownmushroomID) || T.checkAboveFoilage(e, r, i); n == this.grassID && this.flagToRemoveGrass(e, r, i); }), (this.checkDownForDirt = function (e, t, i) { for ( var n = 0, r = t; (0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID) && r >= 0; ) (r -= 1), (n = k.world.getBlockID(e, r, i)); n == this.dirtID && this.flagToGrowGrass(e, r, i); }), (this.checkDownSandGravel = function (e, t, i, n) { for ( var r = 0, o = t; (0 == r || r == this.waterID || r == this.waterHackID || r == this.lavaID || r == this.emptySpongeID) && o >= 0; ) (o -= 1), (r = k.world.getBlockID(e, o, i)); if (0 != r) { T.setBlock(0, e, t, i), T.setBlock(n, e, o + 1, i); var a = k.world.getBlockID(e, t + 1, i); (a != T.sandID && a != T.gravelID) || T.checkDownSandGravel(e, t + 1, i, a); T.removeBlockCheckLit(e, t, i); T.checkNeighbours(e, t, i, false); } }), (this.checkUpForBlocker = function (e, t, i) { for ( var n = 0, r = t; (0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID) && r < 64; ) (r += 1), (n = k.world.getBlockID(e, r, i)); return n; }); var ve = {}; (this.updateRemainingSponges = function () { for (var e in ve) { var t = ve[e]; T.checkAddSponge(t.x, t.y, t.z, false); } }), (this.checkAddSponge = function (e, t, i, n) { (n || null == n) && (ve["s" + e + t + i] = { x: e, y: t, z: i, }); for ( var r = Math.max(e - 2, 1), o = Math.min(e + 2, _ - 3), a = Math.max(i - 2, 1), s = Math.min(i + 2, _ - 3), c = t - 2; c <= t + 2; c++ ) for (var u = r; u <= o; u++) for (var l = a; l <= s; l++) { var h = k.world.getBlockID(u, c, l); (h != T.waterID && 0 != h) || (T.setBlock(T.emptySpongeID, u, c, l), T.removeBlockCheckLit(u, c, l)); } }), (this.checkRemoveSponge = function (e, t, i) { delete ve["s" + e + t + i]; for ( var n = Math.max(e - 2, 1), r = Math.min(e + 2, _ - 3), o = Math.max(i - 2, 1), a = Math.min(i + 2, _ - 3), s = t - 2; s <= t + 2; s++ ) for (var c = n; c <= r; c++) for (var u = o; u <= a; u++) { var l; (l = c == e - 2 || c == e + 2 || u == i - 2 || u == i + 2), k.world.getBlockID(c, s, u) == T.emptySpongeID && (T.setBlock(0, c, s, u), l && de(T.checkNeighbours, [c, s, u])); } T.updateRemainingSponges(); }); var ye = function () { k.settings.drawDistance++, k.settings.drawDistance > 3 && (k.settings.drawDistance = 0), be(k.settings.drawDistance), k.emit("saveSettings"); }; k.on("cycleDrawDistance", ye); var be = function (e) { switch (((k.settings.drawDistance = e), e)) { case 0: (k.rendering.fogWorld = 0.002), (k.rendering.fogWater = 0.08), (k.rendering.fogLava = 0.2), (k.rendering._camera.maxZ = 800); break; case 1: (k.rendering.fogWorld = 0.008), (k.rendering.fogWater = 0.08), (k.rendering.fogLava = 0.2), (k.rendering._camera.maxZ = 200); break; case 2: (k.rendering.fogWorld = 0.05), (k.rendering.fogWater = 0.1), (k.rendering.fogLava = 0.2), (k.rendering._camera.maxZ = 50); break; case 3: (k.rendering.fogWorld = 0.2), (k.rendering.fogWater = 0.2), (k.rendering.fogLava = 0.2), (k.rendering._camera.maxZ = 10); } k.rendering._camLocBlock += 1; }; be(k.settings.drawDistance), k.on("toggleMusic", function () { k.settings.music ? ((k.settings.music = false), T.soundPlayer.setMusicVolume(0)) : ((k.settings.music = true), T.soundPlayer.setMusicVolume(1)), (T.soundPlayer.musicOn = k.settings.music), k.emit("saveSettings"); }), k.on("toggleSound", function () { k.settings.sound ? (k.settings.sound = false) : (k.settings.sound = true), (T.soundPlayer.soundOn = k.settings.sound), k.emit("saveSettings"); }), k.on("toggleInvertMouse", function () { k.settings.invert ? (k.settings.invert = false) : (k.settings.invert = true), (k.cameraControls.inverseY = k.settings.invert), k.emit("saveSettings"); }), k.on("toggleFps", function () { k.settings.fps ? (k.settings.fps = false) : (k.settings.fps = true), (k.version.showFps = k.settings.fps), (k.version.lastRedraw = 0), k.version.redraw(), k.emit("saveSettings"); }), k.on("saveSettings", function () { localStorage.setItem( "settings", JSON.stringify(k.settings) ); }), setInterval(function () { if (null != t.player) { var e = k.entities.getPositionData(k.playerEntity), i = k.rendering._rotationHolder.rotation; t.player.setPosition( { x: e.position[0], y: e.position[1], z: e.position[2], }, i, t.playerSpawned ); } }, 50), (k.setName = function (e) { T.setName && T.setName(e); }), (this.onHostDisconnect = function () { E || (this.worldInitialized && (G.isOpen && G.close(), c.isOpen && c.close(), V.isOpen && V.close()), z && z.show(3), (b = true)); }), (this.onHostFull = function () { z && z.show(2); }), (this.onKicked = function () { (E = true), z && z.show(5); }), (this.addPlayer = function (e, t, n, r, o) { return i(512)(k, e, t, n, r, o); }), (this.getPlayerPosition = function () { return k.entities.getPosition(k.playerEntity); }), (this.getPlayerRotation = function () { return k.rendering._rotationHolder.rotation; }), (this.setBlock = function (e, t, i, n) { var r = t.length ? t : [t, i, n]; this.setBlockTilesArray(e, r), k.setBlock(e, r), void 0 !== this.changedBlockHandler && null !== this.changedBlockHandler && this.changedBlockHandler.setBlock(r, e); }), (this.addBlock = function (blockToAdd, t, localPlayer, n) { var blockPos = t.length ? t : [t, localPlayer, n]; // if t is not arr, blockPos = [t, i, n] var o = !!t.length && localPlayer; // whether t is an arr AND i = true this.setBlockTilesArray(blockToAdd, blockPos); var addBlockRet = k.addBlock(blockToAdd, blockPos, o); if (!!addBlockRet) { if ( this.changedBlockHandler !== void 0 && this.changedBlockHandler !== null ) { this.changedBlockHandler.addBlock( blockPos, blockToAdd ); } if ( blockToAdd != this.leafID && blockToAdd != this.glassID && blockToAdd != this.redflowerID && blockToAdd != this.yellowflowerID && blockToAdd != this.bushID && blockToAdd != this.redmushroomID && blockToAdd != this.brownmushroomID ) { this.addBlockCheckLit( blockPos[0], blockPos[1], blockPos[2] ); } return true; } return false; }), (this.handleChangedBlocks = function (e) { for (var t in e) { var i = e[t]; this.setBlockTilesArray(i.bt, i.p), this.worldInitialized && (i.add ? this.addBlock(i.bt, i.p) : (this.setBlock(i.bt, i.p), 0 == i.bt && this.removeBlockCheckLit( i.p[0], i.p[1], i.p[2] ))); } this.worldGenerated && !this.worldInitialized && Ee(); }), (this.syncSavedWorld = function () { var e = targetBlockAdjacentPos.default .getInstance() .getChangedBlocks(); for (var t in e) { var i = e[t]; this.setBlockTilesArray(i.bt, i.p); } }), (this.setBlockTilesArray = function (e, t, i, n) { if (y) { var r = t.length ? t : [t, i, n]; y[(r[1] * _ + r[2]) * _ + r[0]] = e; } }), (this.updateChatLog = function (e) { void 0 !== c && c.update(e); }); } else console.log("seed must be an integer."); function Ee() { !(function () { for (var e = 0; e < _; ++e) for (var t = 0; t < 64; ++t) for (var i = 0; i < _; ++i) { var n = e, r = t, o = i, a = y[(r * _ + o) * _ + n], s = 0; null != T.lightDepths[n][o] && (s = T.lightDepths[n][o]), 0 != a && a != T.redflowerID && a != T.yellowflowerID && a != T.bushID && a != T.redmushroomID && a != T.brownmushroomID && a != T.glassID && a != T.leafID && a != T.emptySpongeID && r >= s && (s = r), (T.lightDepths[n][o] = s); } })(), k.world.on("worldDataNeeded", Te), k.setPaused(false), (c = blockInHand(k)), (k.version = d()), (k.version.showFps = k.settings.fps), k.entities.setPhysicsInterpolation(k.playerEntity, false), setTimeout(H, 100), (T.worldInitialized = true), k.hostInfo.gameFull && (G.isOpen && G.close(true), z.show(2)), null != A.get("host") ? (G.isOpen && G.close(true), T.noWebrtcJoin ? z.show(6) : z.show(0)) : null != A.get("join") && (G.isOpen && G.close(true), z.show(1)); } function Te(e, t, i, n, r) { var o = e.split("|"), a = parseInt(o[0], 10), s = parseInt(o[1], 10), c = parseInt(o[2], 10), u = a * g, l = s * g, h = c * g, f = false; if ( ((a < 0 || s < 0 || c < 0) && (f = true), (a >= _ / g || s >= 64 / g || c >= _ / g) && (f = true), f) ) { for (var d = T.bedrockID, p = 0; p < t.shape[0]; ++p) for (var m = 0; m < t.shape[1]; ++m) for (var b = 0; b < t.shape[2]; ++b) { (d = 0), (E = m - 1 + l) <= v && (d = T.waterID), E <= v - 2 && (d = T.bedrockID), t.set(p, m, b, d); } k.world.setChunkData(e, t); } else { for (d = T.bedrockID, p = 0; p < t.shape[0]; ++p) for (m = 0; m < t.shape[1]; ++m) for (b = 0; b < t.shape[2]; ++b) { var E, A = p - 1 + u, x = b - 1 + h; (null != (d = y[((E = m - 1 + l) * _ + x) * _ + A]) && 0 != E) || (d = T.bedrockID), (A < 0 || x < 0 || p + u >= _ || b + h >= _) && ((d = 0), E <= v && (d = T.waterID), E <= v - 2 && (d = T.bedrockID)), t.set(p, m, b, d); } k.world.setChunkData(e, t); } } function Ae(e) { e.ctrlKey && e.preventDefault(); } }, }, { key: "handleFireEvent", value: function (event) { var targetedBlockID = event.targetedBlockBlockID; var targetBlockPos = event.targetedBlockPosition; var blockPlacePos = event.targetedBlockAdjacentPosition; var isAdding = event.addMode; var blockInHand = event.chosenBlock; var isLocalPlayer = event.localPlayer; if (typeof noa == "undefined") { if (isAdding) this.setBlockTilesArray( this.blockArray[blockInHand], blockPlacePos ); else this.setBlockTilesArray(0, targetBlockPos); return false; } if (isAdding) { // is block past world height? if (blockPlacePos[1] >= noa.worldHeight) return false; var blockAtPlacePos = noa.world.getBlockID( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2] ); var blockToPlace = this.blockArray[blockInHand]; // add the block var blockAdded = this.addBlock( blockToPlace, blockPlacePos, isLocalPlayer ); if (!blockAdded) { return false; } if (blockToPlace == this.dirtID) this.flagToGrowGrass( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2] ); this.checkDownForGrass( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2] ); var blockUnder = noa.world.getBlockID( blockPlacePos[0], blockPlacePos[1] - 1, blockPlacePos[2] ); if ( (blockUnder == this.waterID || blockUnder == this.waterHackID) && blockAtPlacePos == 0 ) this.checkWaterBelowAdd( blockPlacePos[0], blockPlacePos[1] - 1, blockPlacePos[2] ); if ( blockToPlace == this.sandID || blockToPlace != this.gravelID ) this.checkDownSandGravel( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2], blockToPlace ); if (blockToPlace == this.spongeID) this.checkAddSponge( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2] ); if ( blockToPlace == this.redflowerID || blockToPlace == this.yellowflowerID || blockToPlace == this.bushID || blockToPlace == this.redmushroomID || (blockToPlace == this.brownmushroomID && blockUnder != this.dirtID && blockUnder != this.grassID) ) { this.checkBelowFoilage( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2] ); } this.checkAboveFoilage( blockPlacePos[0], blockPlacePos[1], blockPlacePos[2] ); return true; } else { if (targetedBlockID != this.bedrockID) { var blockFaceMatAccessor = noa.registry.getBlockFaceMaterialAccessor(); var blockTexId = blockFaceMatAccessor(targetedBlockID, 0); var blockTexture = noa.registry._textures[blockTexId]; // set air block to target, "breaking" the block this.setBlock(0, targetBlockPos); var f = this.removeBlockCheckLit( targetBlockPos[0], targetBlockPos[1], targetBlockPos[2] ); var targetVec3 = new BABYLON.Vector3( targetBlockPos[0], targetBlockPos[1], targetBlockPos[2] ); var blockDist = BABYLON.Vector3.Distance( noa.rendering._cameraHolder.position, targetVec3 ); if (blockTexture != null && blockDist < 15) this.addParticles( "debris", blockTexture, f ).mesh.position.copyFromFloats( targetBlockPos[0] + 0.5, targetBlockPos[1] + 0.5, targetBlockPos[2] + 0.5 ); this.checkDownForDirt( targetBlockPos[0], targetBlockPos[1], targetBlockPos[2] ), targetedBlockID == this.spongeID && this.checkRemoveSponge( targetBlockPos[0], targetBlockPos[1], targetBlockPos[2] ); var m = noa.world.getBlockID( targetBlockPos[0], targetBlockPos[1] + 1, targetBlockPos[2] ); (targetedBlockID != this.dirtID && targetedBlockID != this.grassID) || (m != this.redflowerID && m != this.yellowflowerID && m != this.bushID && m != this.redmushroomID && m != this.brownmushroomID) || this.checkBelowFoilage( targetBlockPos[0], targetBlockPos[1] + 1, targetBlockPos[2] ), (m != this.sandID && m != this.gravelID) || this.checkDownSandGravel( targetBlockPos[0], targetBlockPos[1] + 1, targetBlockPos[2], m ); var g = this.soundArray[targetedBlockID]; if (null != g && blockDist < 15) { var _ = 1 - blockDist / 25; this.soundPlayer.play(g.id, g.volume * _, g.pitch); } var blockUnder, y = false; return ( ((blockUnder = noa.world.getBlockID( targetBlockPos[0], targetBlockPos[1] - 1, targetBlockPos[2] )) != this.waterID && blockUnder != this.waterHackID) || (y = true), this.checkNeighbours( targetBlockPos[0], targetBlockPos[1], targetBlockPos[2], y ), true ); } } }, }, { key: "setChangedBlockHandler", value: function (e) { this.changedBlockHandler = e; }, }, { key: "setPlayer", value: function (e) { this.player = e; }, }, { key: "setHostInfo", value: function (e) { if ( ((this.hostInfo = e), this.hostInfo.gameFull || this.hostInfo.noSuchGame) ) { if (!t) var t = i(194)({}); this.hostInfo.noSuchGame ? (t.show(4), (document.body.style.overflow = "hidden")) : t.show(2), window.addEventListener("resize", function (e) { t.resize(); }); } }, }, { key: "getPlayerNames", value: function () { return this.network.getSpawnedPlayerNames(); }, }, { key: "kickPlayer", value: function (e) { return this.network.kickPlayer(e); }, }, { key: "teleportToPlayer", value: function (playerName) { for (var curPlayer in this.network.state.players) if ( this.network.state.players[curPlayer].state.name === playerName ) { var curPlayerPos = this.network.state.players[curPlayer].state.position; noa.entities.setPhysicsInterpolation( noa.playerEntity, false ); noa.entities.setPosition( noa.playerEntity, curPlayerPos.x, curPlayerPos.y, curPlayerPos.z ); setTimeout(function () { noa.entities.setPhysicsInterpolation( noa.playerEntity, true ); }, 100); return ( "Teleporting to " + playerName + " " + JSON.stringify(curPlayerPos) ); } return "No such player"; }, }, { key: "setSpawn", value: function () { return this.network.setSpawnToCurrentPosition(); }, }, { key: "teleportTo", value: function (e) { var t = this.network.getPositionFor(e); return null === t ? e + ": no such player" : (this.setPlayerPosition([t.x, t.y, t.z]), "teleported to " + e); }, }, ]) && s(t.prototype, r), c && s(t, c), e ); })(), u = (t.a = c); }, function (e, t, i) { var n = i(6), r = i(5).document, o = n(r) && n(r.createElement); e.exports = function (e) { return o ? r.createElement(e) : {}; }; }, function (e, t, i) { var n = i(14), r = i(5), o = r["__core-js_shared__"] || (r["__core-js_shared__"] = {}); (e.exports = function (e, t) { return o[e] || (o[e] = void 0 !== t ? t : {}); })("versions", []).push({ version: n.version, mode: i(47) ? "pure" : "global", copyright: "© 2018 Denis Pushkarev (zloirock.ru)", }); }, function (e, t, i) { t.f = i(8); }, function (e, t, i) { var n = i(96)("keys"), r = i(46); e.exports = function (e) { return n[e] || (n[e] = r(e)); }; }, function (e, t) { e.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split( "," ); }, function (e, t, i) { var n = i(36); e.exports = Array.isArray || function (e) { return "Array" == n(e); }; }, function (e, t, i) { var n = i(5).document; e.exports = n && n.documentElement; }, function (e, t, i) { var n = i(6), r = i(4), o = function (e, t) { if ((r(e), !n(t) && null !== t)) throw TypeError(t + ": can't set as prototype!"); }; e.exports = { set: Object.setPrototypeOf || ("__proto__" in {} ? (function (e, t, n) { try { (n = i(34)( Function.call, i(29).f(Object.prototype, "__proto__").set, 2 ))(e, []), (t = !(e instanceof Array)); } catch (e) { t = true; } return function (e, i) { return o(e, i), t ? (e.__proto__ = i) : n(e, i), e; }; })({}, false) : void 0), check: o, }; }, function (e, t) { e.exports = "\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"; }, function (e, t, i) { var n = i(6), r = i(102).set; e.exports = function (e, t, i) { var o, a = t.constructor; return ( a !== i && "function" == typeof a && (o = a.prototype) !== i.prototype && n(o) && r && r(e, o), e ); }; }, function (e, t, i) { "use strict"; var n = i(28), r = i(37); e.exports = function (e) { var t = String(r(this)), i = "", o = n(e); if (o < 0 || o == 1 / 0) throw RangeError("Count can't be negative"); for (; o > 0; (o >>>= 1) && (t += t)) 1 & o && (i += t); return i; }; }, function (e, t) { e.exports = Math.sign || function (e) { return 0 == (e = +e) || e != e ? e : e < 0 ? -1 : 1; }; }, function (e, t) { var i = Math.expm1; e.exports = !i || i(10) > 22025.465794806718 || i(10) < 22025.465794806718 || -2e-17 != i(-2e-17) ? function (e) { return 0 == (e = +e) ? e : e > -1e-6 && e < 1e-6 ? e + (e * e) / 2 : Math.exp(e) - 1; } : i; }, function (e, t, i) { var n = i(28), r = i(37); e.exports = function (e) { return function (t, i) { var o, a, s = String(r(t)), c = n(i), u = s.length; return c < 0 || c >= u ? e ? "" : void 0 : (o = s.charCodeAt(c)) < 55296 || o > 56319 || c + 1 === u || (a = s.charCodeAt(c + 1)) < 56320 || a > 57343 ? e ? s.charAt(c) : o : e ? s.slice(c, c + 2) : a - 56320 + ((o - 55296) << 10) + 65536; }; }; }, function (e, t, i) { "use strict"; var n = i(47), r = i(0), o = i(19), a = i(23), s = i(57), c = i(152), u = i(56), l = i(52), h = i(8)("iterator"), f = !([].keys && "next" in [].keys()), d = function () { return this; }; e.exports = function (e, t, i, p, m, g, _) { c(i, t, p); var v, y, b, E = function (e) { if (!f && e in S) return S[e]; switch (e) { case "keys": case "values": return function () { return new i(this, e); }; } return function () { return new i(this, e); }; }, T = t + " Iterator", A = "values" == m, x = false, S = e.prototype, C = S[h] || S["@@iterator"] || (m && S[m]), P = C || E(m), R = m ? (A ? E("entries") : P) : void 0, M = ("Array" == t && S.entries) || C; if ( (M && (b = l(M.call(new e()))) !== Object.prototype && b.next && (u(b, T, true), n || "function" == typeof b[h] || a(b, h, d)), A && C && "values" !== C.name && ((x = true), (P = function () { return C.call(this); })), (n && !_) || (!f && !x && S[h]) || a(S, h, P), (s[t] = P), (s[T] = d), m) ) if ( ((v = { values: A ? P : E("values"), keys: g ? P : E("keys"), entries: R, }), _) ) for (y in v) y in S || o(S, y, v[y]); else r(r.P + r.F * (f || x), t, v); return v; }; }, function (e, t, i) { var n = i(111), r = i(37); e.exports = function (e, t, i) { if (n(t)) throw TypeError("String#" + i + " doesn't accept regex!"); return String(r(e)); }; }, function (e, t, i) { var n = i(6), r = i(36), o = i(8)("match"); e.exports = function (e) { var t; return n(e) && (void 0 !== (t = e[o]) ? !!t : "RegExp" == r(e)); }; }, function (e, t, i) { var n = i(8)("match"); e.exports = function (e) { var t = /./; try { "/./"[e](t); } catch (i) { try { return (t[n] = false), !"/./"[e](t); } catch (e) {} } return true; }; }, function (e, t, i) { var n = i(57), r = i(8)("iterator"), o = Array.prototype; e.exports = function (e) { return void 0 !== e && (n.Array === e || o[r] === e); }; }, function (e, t, i) { "use strict"; var n = i(12), r = i(45); e.exports = function (e, t, i) { t in e ? n.f(e, t, r(0, i)) : (e[t] = i); }; }, function (e, t, i) { var n = i(66), r = i(8)("iterator"), o = i(57); e.exports = i(14).getIteratorMethod = function (e) { if (null != e) return e[r] || e["@@iterator"] || o[n(e)]; }; }, function (e, t, i) { "use strict"; var n = i(20), r = i(49), o = i(10); e.exports = function (e) { for ( var t = n(this), i = o(t.length), a = arguments.length, s = r(a > 1 ? arguments[1] : void 0, i), c = a > 2 ? arguments[2] : void 0, u = void 0 === c ? i : r(c, i); u > s; ) t[s++] = e; return t; }; }, function (e, t, i) { "use strict"; var n = i(58), r = i(156), o = i(57), a = i(24); (e.exports = i(109)( Array, "Array", function (e, t) { (this._t = a(e)), (this._i = 0), (this._k = t); }, function () { var e = this._t, t = this._k, i = this._i++; return !e || i >= e.length ? ((this._t = void 0), r(1)) : r(0, "keys" == t ? i : "values" == t ? e[i] : [i, e[i]]); }, "values" )), (o.Arguments = o.Array), n("keys"), n("values"), n("entries"); }, function (e, t, i) { "use strict"; var n, r, o = i(78), a = RegExp.prototype.exec, s = String.prototype.replace, c = a, u = ((n = /a/), (r = /b*/g), a.call(n, "a"), a.call(r, "a"), 0 !== n.lastIndex || 0 !== r.lastIndex), l = void 0 !== /()??/.exec("")[1]; (u || l) && (c = function (e) { var t, i, n, r, c = this; return ( l && (i = new RegExp("^" + c.source + "$(?!\\s)", o.call(c))), u && (t = c.lastIndex), (n = a.call(c, e)), u && n && (c.lastIndex = c.global ? n.index + n[0].length : t), l && n && n.length > 1 && s.call(n[0], i, function () { for (r = 1; r < arguments.length - 2; r++) void 0 === arguments[r] && (n[r] = void 0); }), n ); }), (e.exports = c); }, function (e, t, i) { "use strict"; var n = i(108)(true); e.exports = function (e, t, i) { return t + (i ? n(e, t).length : 1); }; }, function (e, t, i) { var n, r, o, a = i(34), s = i(146), c = i(101), u = i(95), l = i(5), h = l.process, f = l.setImmediate, d = l.clearImmediate, p = l.MessageChannel, m = l.Dispatch, g = 0, _ = {}, v = function () { var e = +this; if (_.hasOwnProperty(e)) { var t = _[e]; delete _[e], t(); } }, y = function (e) { v.call(e.data); }; (f && d) || ((f = function (e) { for (var t = [], i = 1; arguments.length > i; ) t.push(arguments[i++]); return ( (_[++g] = function () { s("function" == typeof e ? e : Function(e), t); }), n(g), g ); }), (d = function (e) { delete _[e]; }), "process" == i(36)(h) ? (n = function (e) { h.nextTick(a(v, e, 1)); }) : m && m.now ? (n = function (e) { m.now(a(v, e, 1)); }) : p ? ((o = (r = new p()).port2), (r.port1.onmessage = y), (n = a(o.postMessage, o, 1))) : l.addEventListener && "function" == typeof postMessage && !l.importScripts ? ((n = function (e) { l.postMessage(e + "", "*"); }), l.addEventListener("message", y, false)) : (n = "onreadystatechange" in u("script") ? function (e) { c.appendChild(u("script")).onreadystatechange = function () { c.removeChild(this), v.call(e); }; } : function (e) { setTimeout(a(v, e, 1), 0); })), (e.exports = { set: f, clear: d, }); }, function (e, t, i) { "use strict"; var n = i(5), r = i(13), o = i(47), a = i(84), s = i(23), c = i(61), u = i(3), l = i(60), h = i(28), f = i(10), d = i(164), p = i(51).f, m = i(12).f, g = i(116), _ = i(56), v = "prototype", y = "Wrong index!", b = n.ArrayBuffer, E = n.DataView, T = n.Math, A = n.RangeError, x = n.Infinity, S = b, C = T.abs, P = T.pow, R = T.floor, M = T.log, O = T.LN2, w = r ? "_b" : "buffer", I = r ? "_l" : "byteLength", D = r ? "_o" : "byteOffset"; function L(e, t, i) { var n, r, o, a = new Array(i), s = 8 * i - t - 1, c = (1 << s) - 1, u = c >> 1, l = 23 === t ? P(2, -24) - P(2, -77) : 0, h = 0, f = e < 0 || (0 === e && 1 / e < 0) ? 1 : 0; for ( (e = C(e)) != e || e === x ? ((r = e != e ? 1 : 0), (n = c)) : ((n = R(M(e) / O)), e * (o = P(2, -n)) < 1 && (n--, (o *= 2)), (e += n + u >= 1 ? l / o : l * P(2, 1 - u)) * o >= 2 && (n++, (o /= 2)), n + u >= c ? ((r = 0), (n = c)) : n + u >= 1 ? ((r = (e * o - 1) * P(2, t)), (n += u)) : ((r = e * P(2, u - 1) * P(2, t)), (n = 0))); t >= 8; a[h++] = 255 & r, r /= 256, t -= 8 ); for (n = (n << t) | r, s += t; s > 0; a[h++] = 255 & n, n /= 256, s -= 8); return (a[--h] |= 128 * f), a; } function F(e, t, i) { var n, r = 8 * i - t - 1, o = (1 << r) - 1, a = o >> 1, s = r - 7, c = i - 1, u = e[c--], l = 127 & u; for (u >>= 7; s > 0; l = 256 * l + e[c], c--, s -= 8); for ( n = l & ((1 << -s) - 1), l >>= -s, s += t; s > 0; n = 256 * n + e[c], c--, s -= 8 ); if (0 === l) l = 1 - a; else { if (l === o) return n ? NaN : u ? -x : x; (n += P(2, t)), (l -= a); } return (u ? -1 : 1) * n * P(2, l - t); } function B(e) { return (e[3] << 24) | (e[2] << 16) | (e[1] << 8) | e[0]; } function N(e) { return [255 & e]; } function k(e) { return [255 & e, (e >> 8) & 255]; } function U(e) { return [255 & e, (e >> 8) & 255, (e >> 16) & 255, (e >> 24) & 255]; } function V(e) { return L(e, 52, 8); } function G(e) { return L(e, 23, 4); } function z(e, t, i) { m(e[v], t, { get: function () { return this[i]; }, }); } function j(e, t, i, n) { var r = d(+i); if (r + t > e[I]) throw A(y); var o = e[w]._b, a = r + e[D], s = o.slice(a, a + t); return n ? s : s.reverse(); } function H(e, t, i, n, r, o) { var a = d(+i); if (a + t > e[I]) throw A(y); for (var s = e[w]._b, c = a + e[D], u = n(+r), l = 0; l < t; l++) s[c + l] = u[o ? l : t - l - 1]; } if (a.ABV) { if ( !u(function () { b(1); }) || !u(function () { new b(-1); }) || u(function () { return new b(), new b(1.5), new b(NaN), "ArrayBuffer" != b.name; }) ) { for ( var W, X = ((b = function (e) { return l(this, b), new S(d(e)); })[v] = S[v]), Y = p(S), K = 0; Y.length > K; ) (W = Y[K++]) in b || s(b, W, S[W]); o || (X.constructor = b); } var Q = new E(new b(2)), q = E[v].setInt8; Q.setInt8(0, 2147483648), Q.setInt8(1, 2147483649), (!Q.getInt8(0) && Q.getInt8(1)) || c( E[v], { setInt8: function (e, t) { q.call(this, e, (t << 24) >> 24); }, setUint8: function (e, t) { q.call(this, e, (t << 24) >> 24); }, }, true ); } else (b = function (e) { l(this, b, "ArrayBuffer"); var t = d(e); (this._b = g.call(new Array(t), 0)), (this[I] = t); }), (E = function (e, t, i) { l(this, E, "DataView"), l(e, b, "DataView"); var n = e[I], r = h(t); if (r < 0 || r > n) throw A("Wrong offset!"); if (r + (i = void 0 === i ? n - r : f(i)) > n) throw A("Wrong length!"); (this[w] = e), (this[D] = r), (this[I] = i); }), r && (z(b, "byteLength", "_l"), z(E, "buffer", "_b"), z(E, "byteLength", "_l"), z(E, "byteOffset", "_o")), c(E[v], { getInt8: function (e) { return (j(this, 1, e)[0] << 24) >> 24; }, getUint8: function (e) { return j(this, 1, e)[0]; }, getInt16: function (e) { var t = j(this, 2, e, arguments[1]); return (((t[1] << 8) | t[0]) << 16) >> 16; }, getUint16: function (e) { var t = j(this, 2, e, arguments[1]); return (t[1] << 8) | t[0]; }, getInt32: function (e) { return B(j(this, 4, e, arguments[1])); }, getUint32: function (e) { return B(j(this, 4, e, arguments[1])) >>> 0; }, getFloat32: function (e) { return F(j(this, 4, e, arguments[1]), 23, 4); }, getFloat64: function (e) { return F(j(this, 8, e, arguments[1]), 52, 8); }, setInt8: function (e, t) { H(this, 1, e, N, t); }, setUint8: function (e, t) { H(this, 1, e, N, t); }, setInt16: function (e, t) { H(this, 2, e, k, t, arguments[2]); }, setUint16: function (e, t) { H(this, 2, e, k, t, arguments[2]); }, setInt32: function (e, t) { H(this, 4, e, U, t, arguments[2]); }, setUint32: function (e, t) { H(this, 4, e, U, t, arguments[2]); }, setFloat32: function (e, t) { H(this, 4, e, G, t, arguments[2]); }, setFloat64: function (e, t) { H(this, 8, e, V, t, arguments[2]); }, }); _(b, "ArrayBuffer"), _(E, "DataView"), s(E[v], a.VIEW, true), (t.ArrayBuffer = b), (t.DataView = E); }, function (e, t) { e.exports = function (e) { return ( e.webpackPolyfill || ((e.deprecate = function () {}), (e.paths = []), e.children || (e.children = []), Object.defineProperty(e, "loaded", { enumerable: true, get: function () { return e.l; }, }), Object.defineProperty(e, "id", { enumerable: true, get: function () { return e.i; }, }), (e.webpackPolyfill = 1)), e ); }; }, function (e, t, i) { "use strict"; (function (t, n, r) { var o = i(86); function a(e) { var t = this; (this.next = null), (this.entry = null), (this.finish = function () { !(function (e, t, i) { var n = e.entry; e.entry = null; for (; n; ) { var r = n.callback; t.pendingcb--, r(i), (n = n.next); } t.corkedRequestsFree ? (t.corkedRequestsFree.next = e) : (t.corkedRequestsFree = e); })(t, e); }); } e.exports = v; var s, c = !t.browser && ["v0.10", "v0.9."].indexOf(t.version.slice(0, 5)) > -1 ? n : o.nextTick; v.WritableState = _; var u = i(68); u.inherits = i(1); var l = { deprecate: i(409), }, h = i(170), f = i(2).Buffer, d = r.Uint8Array || function () {}; var p, m = i(171); function g() {} function _(e, t) { (s = s || i(54)), (e = e || {}); var n = t instanceof s; (this.objectMode = !!e.objectMode), n && (this.objectMode = this.objectMode || !!e.writableObjectMode); var r = e.highWaterMark, u = e.writableHighWaterMark, l = this.objectMode ? 16 : 16384; (this.highWaterMark = r || 0 === r ? r : n && (u || 0 === u) ? u : l), (this.highWaterMark = Math.floor(this.highWaterMark)), (this.finalCalled = false), (this.needDrain = false), (this.ending = false), (this.ended = false), (this.finished = false), (this.destroyed = false); var h = false === e.decodeStrings; (this.decodeStrings = !h), (this.defaultEncoding = e.defaultEncoding || "utf8"), (this.length = 0), (this.writing = false), (this.corked = 0), (this.sync = true), (this.bufferProcessing = false), (this.onwrite = function (e) { !(function (e, t) { var i = e._writableState, n = i.sync, r = i.writecb; if ( ((function (e) { (e.writing = false), (e.writecb = null), (e.length -= e.writelen), (e.writelen = 0); })(i), t) ) !(function (e, t, i, n, r) { --t.pendingcb, i ? (o.nextTick(r, n), o.nextTick(x, e, t), (e._writableState.errorEmitted = true), e.emit("error", n)) : (r(n), (e._writableState.errorEmitted = true), e.emit("error", n), x(e, t)); })(e, i, n, t, r); else { var a = T(i); a || i.corked || i.bufferProcessing || !i.bufferedRequest || E(e, i), n ? c(b, e, i, a, r) : b(e, i, a, r); } })(t, e); }), (this.writecb = null), (this.writelen = 0), (this.bufferedRequest = null), (this.lastBufferedRequest = null), (this.pendingcb = 0), (this.prefinished = false), (this.errorEmitted = false), (this.bufferedRequestCount = 0), (this.corkedRequestsFree = new a(this)); } function v(e) { if (((s = s || i(54)), !(p.call(v, this) || this instanceof s))) return new v(e); (this._writableState = new _(e, this)), (this.writable = true), e && ("function" == typeof e.write && (this._write = e.write), "function" == typeof e.writev && (this._writev = e.writev), "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && (this._final = e.final)), h.call(this); } function y(e, t, i, n, r, o, a) { (t.writelen = n), (t.writecb = a), (t.writing = true), (t.sync = true), i ? e._writev(r, t.onwrite) : e._write(r, o, t.onwrite), (t.sync = false); } function b(e, t, i, n) { i || (function (e, t) { 0 === t.length && t.needDrain && ((t.needDrain = false), e.emit("drain")); })(e, t), t.pendingcb--, n(), x(e, t); } function E(e, t) { t.bufferProcessing = true; var i = t.bufferedRequest; if (e._writev && i && i.next) { var n = t.bufferedRequestCount, r = new Array(n), o = t.corkedRequestsFree; o.entry = i; for (var s = 0, c = true; i; ) (r[s] = i), i.isBuf || (c = false), (i = i.next), (s += 1); (r.allBuffers = c), y(e, t, true, t.length, r, "", o.finish), t.pendingcb++, (t.lastBufferedRequest = null), o.next ? ((t.corkedRequestsFree = o.next), (o.next = null)) : (t.corkedRequestsFree = new a(t)), (t.bufferedRequestCount = 0); } else { for (; i; ) { var u = i.chunk, l = i.encoding, h = i.callback; if ( (y(e, t, false, t.objectMode ? 1 : u.length, u, l, h), (i = i.next), t.bufferedRequestCount--, t.writing) ) break; } null === i && (t.lastBufferedRequest = null); } (t.bufferedRequest = i), (t.bufferProcessing = false); } function T(e) { return ( e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing ); } function A(e, t) { e._final(function (i) { t.pendingcb--, i && e.emit("error", i), (t.prefinished = true), e.emit("prefinish"), x(e, t); }); } function x(e, t) { var i = T(t); return ( i && (!(function (e, t) { t.prefinished || t.finalCalled || ("function" == typeof e._final ? (t.pendingcb++, (t.finalCalled = true), o.nextTick(A, e, t)) : ((t.prefinished = true), e.emit("prefinish"))); })(e, t), 0 === t.pendingcb && ((t.finished = true), e.emit("finish"))), i ); } u.inherits(v, h), (_.prototype.getBuffer = function () { for (var e = this.bufferedRequest, t = []; e; ) t.push(e), (e = e.next); return t; }), (function () { try { Object.defineProperty(_.prototype, "buffer", { get: l.deprecate( function () { return this.getBuffer(); }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003" ), }); } catch (e) {} })(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[Symbol.hasInstance] ? ((p = Function.prototype[Symbol.hasInstance]), Object.defineProperty(v, Symbol.hasInstance, { value: function (e) { return ( !!p.call(this, e) || (this === v && e && e._writableState instanceof _) ); }, })) : (p = function (e) { return e instanceof this; }), (v.prototype.pipe = function () { this.emit("error", new Error("Cannot pipe, not readable")); }), (v.prototype.write = function (e, t, i) { var n, r = this._writableState, a = false, s = !r.objectMode && ((n = e), f.isBuffer(n) || n instanceof d); return ( s && !f.isBuffer(e) && (e = (function (e) { return f.from(e); })(e)), "function" == typeof t && ((i = t), (t = null)), s ? (t = "buffer") : t || (t = r.defaultEncoding), "function" != typeof i && (i = g), r.ended ? (function (e, t) { var i = new Error("write after end"); e.emit("error", i), o.nextTick(t, i); })(this, i) : (s || (function (e, t, i, n) { var r = true, a = false; return ( null === i ? (a = new TypeError( "May not write null values to stream" )) : "string" == typeof i || void 0 === i || t.objectMode || (a = new TypeError( "Invalid non-string/buffer chunk" )), a && (e.emit("error", a), o.nextTick(n, a), (r = false)), r ); })(this, r, e, i)) && (r.pendingcb++, (a = (function (e, t, i, n, r, o) { if (!i) { var a = (function (e, t, i) { e.objectMode || false === e.decodeStrings || "string" != typeof t || (t = f.from(t, i)); return t; })(t, n, r); n !== a && ((i = true), (r = "buffer"), (n = a)); } var s = t.objectMode ? 1 : n.length; t.length += s; var c = t.length < t.highWaterMark; c || (t.needDrain = true); if (t.writing || t.corked) { var u = t.lastBufferedRequest; (t.lastBufferedRequest = { chunk: n, encoding: r, isBuf: i, callback: o, next: null, }), u ? (u.next = t.lastBufferedRequest) : (t.bufferedRequest = t.lastBufferedRequest), (t.bufferedRequestCount += 1); } else y(e, t, false, s, n, r, o); return c; })(this, r, s, e, t, i))), a ); }), (v.prototype.cork = function () { this._writableState.corked++; }), (v.prototype.uncork = function () { var e = this._writableState; e.corked && (e.corked--, e.writing || e.corked || e.finished || e.bufferProcessing || !e.bufferedRequest || E(this, e)); }), (v.prototype.setDefaultEncoding = function (e) { if ( ("string" == typeof e && (e = e.toLowerCase()), !( [ "hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw", ].indexOf((e + "").toLowerCase()) > -1 )) ) throw new TypeError("Unknown encoding: " + e); return (this._writableState.defaultEncoding = e), this; }), Object.defineProperty(v.prototype, "writableHighWaterMark", { enumerable: false, get: function () { return this._writableState.highWaterMark; }, }), (v.prototype._write = function (e, t, i) { i(new Error("_write() is not implemented")); }), (v.prototype._writev = null), (v.prototype.end = function (e, t, i) { var n = this._writableState; "function" == typeof e ? ((i = e), (e = null), (t = null)) : "function" == typeof t && ((i = t), (t = null)), null != e && this.write(e, t), n.corked && ((n.corked = 1), this.uncork()), n.ending || n.finished || (function (e, t, i) { (t.ending = true), x(e, t), i && (t.finished ? o.nextTick(i) : e.once("finish", i)); (t.ended = true), (e.writable = false); })(this, n, i); }), Object.defineProperty(v.prototype, "destroyed", { get: function () { return ( void 0 !== this._writableState && this._writableState.destroyed ); }, set: function (e) { this._writableState && (this._writableState.destroyed = e); }, }), (v.prototype.destroy = m.destroy), (v.prototype._undestroy = m.undestroy), (v.prototype._destroy = function (e, t) { this.end(), t(e); }); }.call(this, i(27), i(407).setImmediate, i(15))); }, function (e, t, i) { "use strict"; var n = i(2).Buffer, r = n.isEncoding || function (e) { switch ((e = "" + e) && e.toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "binary": case "base64": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": case "raw": return true; default: return false; } }; function o(e) { var t; switch ( ((this.encoding = (function (e) { var t = (function (e) { if (!e) return "utf8"; for (var t; ; ) switch (e) { case "utf8": case "utf-8": return "utf8"; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return "utf16le"; case "latin1": case "binary": return "latin1"; case "base64": case "ascii": case "hex": return e; default: if (t) return; (e = ("" + e).toLowerCase()), (t = true); } })(e); if ("string" != typeof t && (n.isEncoding === r || !r(e))) throw new Error("Unknown encoding: " + e); return t || e; })(e)), this.encoding) ) { case "utf16le": (this.text = c), (this.end = u), (t = 4); break; case "utf8": (this.fillLast = s), (t = 4); break; case "base64": (this.text = l), (this.end = h), (t = 3); break; default: return (this.write = f), void (this.end = d); } (this.lastNeed = 0), (this.lastTotal = 0), (this.lastChar = n.allocUnsafe(t)); } function a(e) { return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2; } function s(e) { var t = this.lastTotal - this.lastNeed, i = (function (e, t, i) { if (128 != (192 & t[0])) return (e.lastNeed = 0), "�"; if (e.lastNeed > 1 && t.length > 1) { if (128 != (192 & t[1])) return (e.lastNeed = 1), "�"; if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) return (e.lastNeed = 2), "�"; } })(this, e); return void 0 !== i ? i : this.lastNeed <= e.length ? (e.copy(this.lastChar, t, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (e.copy(this.lastChar, t, 0, e.length), void (this.lastNeed -= e.length)); } function c(e, t) { if ((e.length - t) % 2 == 0) { var i = e.toString("utf16le", t); if (i) { var n = i.charCodeAt(i.length - 1); if (n >= 55296 && n <= 56319) return ( (this.lastNeed = 2), (this.lastTotal = 4), (this.lastChar[0] = e[e.length - 2]), (this.lastChar[1] = e[e.length - 1]), i.slice(0, -1) ); } return i; } return ( (this.lastNeed = 1), (this.lastTotal = 2), (this.lastChar[0] = e[e.length - 1]), e.toString("utf16le", t, e.length - 1) ); } function u(e) { var t = e && e.length ? this.write(e) : ""; if (this.lastNeed) { var i = this.lastTotal - this.lastNeed; return t + this.lastChar.toString("utf16le", 0, i); } return t; } function l(e, t) { var i = (e.length - t) % 3; return 0 === i ? e.toString("base64", t) : ((this.lastNeed = 3 - i), (this.lastTotal = 3), 1 === i ? (this.lastChar[0] = e[e.length - 1]) : ((this.lastChar[0] = e[e.length - 2]), (this.lastChar[1] = e[e.length - 1])), e.toString("base64", t, e.length - i)); } function h(e) { var t = e && e.length ? this.write(e) : ""; return this.lastNeed ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : t; } function f(e) { return e.toString(this.encoding); } function d(e) { return e && e.length ? this.write(e) : ""; } (t.StringDecoder = o), (o.prototype.write = function (e) { if (0 === e.length) return ""; var t, i; if (this.lastNeed) { if (void 0 === (t = this.fillLast(e))) return ""; (i = this.lastNeed), (this.lastNeed = 0); } else i = 0; return i < e.length ? t ? t + this.text(e, i) : this.text(e, i) : t || ""; }), (o.prototype.end = function (e) { var t = e && e.length ? this.write(e) : ""; return this.lastNeed ? t + "�" : t; }), (o.prototype.text = function (e, t) { var i = (function (e, t, i) { var n = t.length - 1; if (n < i) return 0; var r = a(t[n]); if (r >= 0) return r > 0 && (e.lastNeed = r - 1), r; if (--n < i || -2 === r) return 0; if ((r = a(t[n])) >= 0) return r > 0 && (e.lastNeed = r - 2), r; if (--n < i || -2 === r) return 0; if ((r = a(t[n])) >= 0) return r > 0 && (2 === r ? (r = 0) : (e.lastNeed = r - 3)), r; return 0; })(this, e, t); if (!this.lastNeed) return e.toString("utf8", t); this.lastTotal = i; var n = e.length - (i - this.lastNeed); return e.copy(this.lastChar, 0, n), e.toString("utf8", t, n); }), (o.prototype.fillLast = function (e) { if (this.lastNeed <= e.length) return ( e.copy( this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed ), this.lastChar.toString(this.encoding, 0, this.lastTotal) ); e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), (this.lastNeed -= e.length); }); }, function (e, t, i) { "use strict"; (function (e, n) { var r = i(126), o = i(484); e.__TYPEDARRAY_POOL || (e.__TYPEDARRAY_POOL = { UINT8: o([32, 0]), UINT16: o([32, 0]), UINT32: o([32, 0]), INT8: o([32, 0]), INT16: o([32, 0]), INT32: o([32, 0]), FLOAT: o([32, 0]), DOUBLE: o([32, 0]), DATA: o([32, 0]), UINT8C: o([32, 0]), BUFFER: o([32, 0]), }); var a = "undefined" != typeof Uint8ClampedArray, s = e.__TYPEDARRAY_POOL; s.UINT8C || (s.UINT8C = o([32, 0])), s.BUFFER || (s.BUFFER = o([32, 0])); var c = s.DATA, u = s.BUFFER; function l(e) { if (e) { var t = e.length || e.byteLength, i = r.log2(t); c[i].push(e); } } function h(e) { e = r.nextPow2(e); var t = r.log2(e), i = c[t]; return i.length > 0 ? i.pop() : new ArrayBuffer(e); } function f(e) { return new Uint8Array(h(e), 0, e); } function d(e) { return new Uint16Array(h(2 * e), 0, e); } function p(e) { return new Uint32Array(h(4 * e), 0, e); } function m(e) { return new Int8Array(h(e), 0, e); } function g(e) { return new Int16Array(h(2 * e), 0, e); } function _(e) { return new Int32Array(h(4 * e), 0, e); } function v(e) { return new Float32Array(h(4 * e), 0, e); } function y(e) { return new Float64Array(h(8 * e), 0, e); } function b(e) { return a ? new Uint8ClampedArray(h(e), 0, e) : f(e); } function E(e) { return new DataView(h(e), 0, e); } function T(e) { e = r.nextPow2(e); var t = r.log2(e), i = u[t]; return i.length > 0 ? i.pop() : new n(e); } (t.free = function (e) { if (n.isBuffer(e)) u[r.log2(e.length)].push(e); else { if ( ("[object ArrayBuffer]" !== Object.prototype.toString.call(e) && (e = e.buffer), !e) ) return; var t = e.length || e.byteLength, i = 0 | r.log2(t); c[i].push(e); } }), (t.freeUint8 = t.freeUint16 = t.freeUint32 = t.freeInt8 = t.freeInt16 = t.freeInt32 = t.freeFloat32 = t.freeFloat = t.freeFloat64 = t.freeDouble = t.freeUint8Clamped = t.freeDataView = function (e) { l(e.buffer); }), (t.freeArrayBuffer = l), (t.freeBuffer = function (e) { u[r.log2(e.length)].push(e); }), (t.malloc = function (e, t) { if (void 0 === t || "arraybuffer" === t) return h(e); switch (t) { case "uint8": return f(e); case "uint16": return d(e); case "uint32": return p(e); case "int8": return m(e); case "int16": return g(e); case "int32": return _(e); case "float": case "float32": return v(e); case "double": case "float64": return y(e); case "uint8_clamped": return b(e); case "buffer": return T(e); case "data": case "dataview": return E(e); default: return null; } return null; }), (t.mallocArrayBuffer = h), (t.mallocUint8 = f), (t.mallocUint16 = d), (t.mallocUint32 = p), (t.mallocInt8 = m), (t.mallocInt16 = g), (t.mallocInt32 = _), (t.mallocFloat32 = t.mallocFloat = v), (t.mallocFloat64 = t.mallocDouble = y), (t.mallocUint8Clamped = b), (t.mallocDataView = E), (t.mallocBuffer = T), (t.clearCache = function () { for (var e = 0; e < 32; ++e) (s.UINT8[e].length = 0), (s.UINT16[e].length = 0), (s.UINT32[e].length = 0), (s.INT8[e].length = 0), (s.INT16[e].length = 0), (s.INT32[e].length = 0), (s.FLOAT[e].length = 0), (s.DOUBLE[e].length = 0), (s.UINT8C[e].length = 0), (c[e].length = 0), (u[e].length = 0); }); }.call(this, i(15), i(9).Buffer)); }, function (e, t, i) { "use strict"; function n(e) { var t = 32; return ( (e &= -e) && t--, 65535 & e && (t -= 16), 16711935 & e && (t -= 8), 252645135 & e && (t -= 4), 858993459 & e && (t -= 2), 1431655765 & e && (t -= 1), t ); } (t.INT_BITS = 32), (t.INT_MAX = 2147483647), (t.INT_MIN = -1 << 31), (t.sign = function (e) { return (e > 0) - (e < 0); }), (t.abs = function (e) { var t = e >> 31; return (e ^ t) - t; }), (t.min = function (e, t) { return t ^ ((e ^ t) & -(e < t)); }), (t.max = function (e, t) { return e ^ ((e ^ t) & -(e < t)); }), (t.isPow2 = function (e) { return !(e & (e - 1) || !e); }), (t.log2 = function (e) { var t, i; return ( (t = (e > 65535) << 4), (t |= i = ((e >>>= t) > 255) << 3), (t |= i = ((e >>>= i) > 15) << 2), (t |= i = ((e >>>= i) > 3) << 1) | ((e >>>= i) >> 1) ); }), (t.log10 = function (e) { return e >= 1e9 ? 9 : e >= 1e8 ? 8 : e >= 1e7 ? 7 : e >= 1e6 ? 6 : e >= 1e5 ? 5 : e >= 1e4 ? 4 : e >= 1e3 ? 3 : e >= 100 ? 2 : e >= 10 ? 1 : 0; }), (t.popCount = function (e) { return ( (16843009 * (((e = (858993459 & (e -= (e >>> 1) & 1431655765)) + ((e >>> 2) & 858993459)) + (e >>> 4)) & 252645135)) >>> 24 ); }), (t.countTrailingZeros = n), (t.nextPow2 = function (e) { return ( (e += 0 === e), --e, (e |= e >>> 1), (e |= e >>> 2), (e |= e >>> 4), (e |= e >>> 8), (e |= e >>> 16) + 1 ); }), (t.prevPow2 = function (e) { return ( (e |= e >>> 1), (e |= e >>> 2), (e |= e >>> 4), (e |= e >>> 8), (e |= e >>> 16) - (e >>> 1) ); }), (t.parity = function (e) { return ( (e ^= e >>> 16), (e ^= e >>> 8), (e ^= e >>> 4), (27030 >>> (e &= 15)) & 1 ); }); var r = new Array(256); !(function (e) { for (var t = 0; t < 256; ++t) { var i = t, n = t, r = 7; for (i >>>= 1; i; i >>>= 1) (n <<= 1), (n |= 1 & i), --r; e[t] = (n << r) & 255; } })(r), (t.reverse = function (e) { return ( (r[255 & e] << 24) | (r[(e >>> 8) & 255] << 16) | (r[(e >>> 16) & 255] << 8) | r[(e >>> 24) & 255] ); }), (t.interleave2 = function (e, t) { return ( (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e &= 65535) | (e << 8))) | (e << 4))) | (e << 2))) | (e << 1))) | ((t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t &= 65535) | (t << 8))) | (t << 4))) | (t << 2))) | (t << 1))) << 1) ); }), (t.deinterleave2 = function (e, t) { return ( ((e = 65535 & ((e = 16711935 & ((e = 252645135 & ((e = 858993459 & ((e = (e >>> t) & 1431655765) | (e >>> 1))) | (e >>> 2))) | (e >>> 4))) | (e >>> 16))) << 16) >> 16 ); }), (t.interleave3 = function (e, t, i) { return ( (e = 1227133513 & ((e = 3272356035 & ((e = 251719695 & ((e = 4278190335 & ((e &= 1023) | (e << 16))) | (e << 8))) | (e << 4))) | (e << 2))), (e |= (t = 1227133513 & ((t = 3272356035 & ((t = 251719695 & ((t = 4278190335 & ((t &= 1023) | (t << 16))) | (t << 8))) | (t << 4))) | (t << 2))) << 1) | ((i = 1227133513 & ((i = 3272356035 & ((i = 251719695 & ((i = 4278190335 & ((i &= 1023) | (i << 16))) | (i << 8))) | (i << 4))) | (i << 2))) << 2) ); }), (t.deinterleave3 = function (e, t) { return ( ((e = 1023 & ((e = 4278190335 & ((e = 251719695 & ((e = 3272356035 & ((e = (e >>> t) & 1227133513) | (e >>> 2))) | (e >>> 4))) | (e >>> 8))) | (e >>> 16))) << 22) >> 22 ); }), (t.nextCombination = function (e) { var t = e | (e - 1); return (t + 1) | (((~t & -~t) - 1) >>> (n(e) + 1)); }); }, function (e, t, i) { "use strict"; var n = i(1), r = i(196), o = i(2).Buffer, a = new Array(16); function s() { r.call(this, 64), (this._a = 1732584193), (this._b = 4023233417), (this._c = 2562383102), (this._d = 271733878); } function c(e, t) { return (e << t) | (e >>> (32 - t)); } function u(e, t, i, n, r, o, a) { return (c((e + ((t & i) | (~t & n)) + r + o) | 0, a) + t) | 0; } function l(e, t, i, n, r, o, a) { return (c((e + ((t & n) | (i & ~n)) + r + o) | 0, a) + t) | 0; } function h(e, t, i, n, r, o, a) { return (c((e + (t ^ i ^ n) + r + o) | 0, a) + t) | 0; } function f(e, t, i, n, r, o, a) { return (c((e + (i ^ (t | ~n)) + r + o) | 0, a) + t) | 0; } n(s, r), (s.prototype._update = function () { for (var e = a, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t); var i = this._a, n = this._b, r = this._c, o = this._d; (i = u(i, n, r, o, e[0], 3614090360, 7)), (o = u(o, i, n, r, e[1], 3905402710, 12)), (r = u(r, o, i, n, e[2], 606105819, 17)), (n = u(n, r, o, i, e[3], 3250441966, 22)), (i = u(i, n, r, o, e[4], 4118548399, 7)), (o = u(o, i, n, r, e[5], 1200080426, 12)), (r = u(r, o, i, n, e[6], 2821735955, 17)), (n = u(n, r, o, i, e[7], 4249261313, 22)), (i = u(i, n, r, o, e[8], 1770035416, 7)), (o = u(o, i, n, r, e[9], 2336552879, 12)), (r = u(r, o, i, n, e[10], 4294925233, 17)), (n = u(n, r, o, i, e[11], 2304563134, 22)), (i = u(i, n, r, o, e[12], 1804603682, 7)), (o = u(o, i, n, r, e[13], 4254626195, 12)), (r = u(r, o, i, n, e[14], 2792965006, 17)), (i = l( i, (n = u(n, r, o, i, e[15], 1236535329, 22)), r, o, e[1], 4129170786, 5 )), (o = l(o, i, n, r, e[6], 3225465664, 9)), (r = l(r, o, i, n, e[11], 643717713, 14)), (n = l(n, r, o, i, e[0], 3921069994, 20)), (i = l(i, n, r, o, e[5], 3593408605, 5)), (o = l(o, i, n, r, e[10], 38016083, 9)), (r = l(r, o, i, n, e[15], 3634488961, 14)), (n = l(n, r, o, i, e[4], 3889429448, 20)), (i = l(i, n, r, o, e[9], 568446438, 5)), (o = l(o, i, n, r, e[14], 3275163606, 9)), (r = l(r, o, i, n, e[3], 4107603335, 14)), (n = l(n, r, o, i, e[8], 1163531501, 20)), (i = l(i, n, r, o, e[13], 2850285829, 5)), (o = l(o, i, n, r, e[2], 4243563512, 9)), (r = l(r, o, i, n, e[7], 1735328473, 14)), (i = h( i, (n = l(n, r, o, i, e[12], 2368359562, 20)), r, o, e[5], 4294588738, 4 )), (o = h(o, i, n, r, e[8], 2272392833, 11)), (r = h(r, o, i, n, e[11], 1839030562, 16)), (n = h(n, r, o, i, e[14], 4259657740, 23)), (i = h(i, n, r, o, e[1], 2763975236, 4)), (o = h(o, i, n, r, e[4], 1272893353, 11)), (r = h(r, o, i, n, e[7], 4139469664, 16)), (n = h(n, r, o, i, e[10], 3200236656, 23)), (i = h(i, n, r, o, e[13], 681279174, 4)), (o = h(o, i, n, r, e[0], 3936430074, 11)), (r = h(r, o, i, n, e[3], 3572445317, 16)), (n = h(n, r, o, i, e[6], 76029189, 23)), (i = h(i, n, r, o, e[9], 3654602809, 4)), (o = h(o, i, n, r, e[12], 3873151461, 11)), (r = h(r, o, i, n, e[15], 530742520, 16)), (i = f( i, (n = h(n, r, o, i, e[2], 3299628645, 23)), r, o, e[0], 4096336452, 6 )), (o = f(o, i, n, r, e[7], 1126891415, 10)), (r = f(r, o, i, n, e[14], 2878612391, 15)), (n = f(n, r, o, i, e[5], 4237533241, 21)), (i = f(i, n, r, o, e[12], 1700485571, 6)), (o = f(o, i, n, r, e[3], 2399980690, 10)), (r = f(r, o, i, n, e[10], 4293915773, 15)), (n = f(n, r, o, i, e[1], 2240044497, 21)), (i = f(i, n, r, o, e[8], 1873313359, 6)), (o = f(o, i, n, r, e[15], 4264355552, 10)), (r = f(r, o, i, n, e[6], 2734768916, 15)), (n = f(n, r, o, i, e[13], 1309151649, 21)), (i = f(i, n, r, o, e[4], 4149444226, 6)), (o = f(o, i, n, r, e[11], 3174756917, 10)), (r = f(r, o, i, n, e[2], 718787259, 15)), (n = f(n, r, o, i, e[9], 3951481745, 21)), (this._a = (this._a + i) | 0), (this._b = (this._b + n) | 0), (this._c = (this._c + r) | 0), (this._d = (this._d + o) | 0); }), (s.prototype._digest = function () { (this._block[this._blockOffset++] = 128), this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), (this._blockOffset = 0)), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update(); var e = o.allocUnsafe(16); return ( e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e.writeInt32LE(this._d, 12), e ); }), (e.exports = s); }, function (e, t, i) { e.exports = r; var n = i(42).EventEmitter; function r() { n.call(this); } i(1)(r, n), (r.Readable = i(85)), (r.Writable = i(514)), (r.Duplex = i(515)), (r.Transform = i(516)), (r.PassThrough = i(517)), (r.Stream = r), (r.prototype.pipe = function (e, t) { var i = this; function r(t) { e.writable && false === e.write(t) && i.pause && i.pause(); } function o() { i.readable && i.resume && i.resume(); } i.on("data", r), e.on("drain", o), e._isStdio || (t && false === t.end) || (i.on("end", s), i.on("close", c)); var a = false; function s() { a || ((a = true), e.end()); } function c() { a || ((a = true), "function" == typeof e.destroy && e.destroy()); } function u(e) { if ((l(), 0 === n.listenerCount(this, "error"))) throw e; } function l() { i.removeListener("data", r), e.removeListener("drain", o), i.removeListener("end", s), i.removeListener("close", c), i.removeListener("error", u), e.removeListener("error", u), i.removeListener("end", l), i.removeListener("close", l), e.removeListener("close", l); } return ( i.on("error", u), e.on("error", u), i.on("end", l), i.on("close", l), e.on("close", l), e.emit("pipe", i), e ); }); }, function (e, t, i) { "use strict"; var n = i(9).Buffer, r = i(1), o = i(196), a = new Array(16), s = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, ], c = [ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11, ], u = [ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, ], l = [ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11, ], h = [0, 1518500249, 1859775393, 2400959708, 2840853838], f = [1352829926, 1548603684, 1836072691, 2053994217, 0]; function d() { o.call(this, 64), (this._a = 1732584193), (this._b = 4023233417), (this._c = 2562383102), (this._d = 271733878), (this._e = 3285377520); } function p(e, t) { return (e << t) | (e >>> (32 - t)); } function m(e, t, i, n, r, o, a, s) { return (p((e + (t ^ i ^ n) + o + a) | 0, s) + r) | 0; } function g(e, t, i, n, r, o, a, s) { return (p((e + ((t & i) | (~t & n)) + o + a) | 0, s) + r) | 0; } function _(e, t, i, n, r, o, a, s) { return (p((e + ((t | ~i) ^ n) + o + a) | 0, s) + r) | 0; } function v(e, t, i, n, r, o, a, s) { return (p((e + ((t & n) | (i & ~n)) + o + a) | 0, s) + r) | 0; } function y(e, t, i, n, r, o, a, s) { return (p((e + (t ^ (i | ~n)) + o + a) | 0, s) + r) | 0; } r(d, o), (d.prototype._update = function () { for (var e = a, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t); for ( var i = 0 | this._a, n = 0 | this._b, r = 0 | this._c, o = 0 | this._d, d = 0 | this._e, b = 0 | this._a, E = 0 | this._b, T = 0 | this._c, A = 0 | this._d, x = 0 | this._e, S = 0; S < 80; S += 1 ) { var C, P; S < 16 ? ((C = m(i, n, r, o, d, e[s[S]], h[0], u[S])), (P = y(b, E, T, A, x, e[c[S]], f[0], l[S]))) : S < 32 ? ((C = g(i, n, r, o, d, e[s[S]], h[1], u[S])), (P = v(b, E, T, A, x, e[c[S]], f[1], l[S]))) : S < 48 ? ((C = _(i, n, r, o, d, e[s[S]], h[2], u[S])), (P = _(b, E, T, A, x, e[c[S]], f[2], l[S]))) : S < 64 ? ((C = v(i, n, r, o, d, e[s[S]], h[3], u[S])), (P = g(b, E, T, A, x, e[c[S]], f[3], l[S]))) : ((C = y(i, n, r, o, d, e[s[S]], h[4], u[S])), (P = m(b, E, T, A, x, e[c[S]], f[4], l[S]))), (i = d), (d = o), (o = p(r, 10)), (r = n), (n = C), (b = x), (x = A), (A = p(T, 10)), (T = E), (E = P); } var R = (this._b + r + A) | 0; (this._b = (this._c + o + x) | 0), (this._c = (this._d + d + b) | 0), (this._d = (this._e + i + E) | 0), (this._e = (this._a + n + T) | 0), (this._a = R); }), (d.prototype._digest = function () { (this._block[this._blockOffset++] = 128), this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), (this._blockOffset = 0)), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update(); var e = n.alloc ? n.alloc(20) : new n(20); return ( e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e.writeInt32LE(this._d, 12), e.writeInt32LE(this._e, 16), e ); }), (e.exports = d); }, function (e, t, i) { ((t = e.exports = function (e) { e = e.toLowerCase(); var i = t[e]; if (!i) throw new Error(e + " is not supported (we accept pull requests)"); return new i(); }).sha = i(518)), (t.sha1 = i(519)), (t.sha224 = i(520)), (t.sha256 = i(197)), (t.sha384 = i(521)), (t.sha512 = i(198)); }, function (e, t, i) { "use strict"; (t.utils = i(527)), (t.Cipher = i(528)), (t.DES = i(529)), (t.CBC = i(530)), (t.EDE = i(531)); }, function (e, t, i) { var n = i(532), r = i(540), o = i(208); (t.createCipher = t.Cipher = n.createCipher), (t.createCipheriv = t.Cipheriv = n.createCipheriv), (t.createDecipher = t.Decipher = r.createDecipher), (t.createDecipheriv = t.Decipheriv = r.createDecipheriv), (t.listCiphers = t.getCiphers = function () { return Object.keys(o); }); }, function (e, t, i) { var n = { ECB: i(533), CBC: i(534), CFB: i(535), CFB8: i(536), CFB1: i(537), OFB: i(538), CTR: i(206), GCM: i(206), }, r = i(208); for (var o in r) r[o].module = n[r[o].mode]; e.exports = r; }, function (e, t, i) { (function (t) { var n = i(11), r = i(53); function o(e, i) { var r = (function (e) { var t = a(e); return { blinder: t .toRed(n.mont(e.modulus)) .redPow(new n(e.publicExponent)) .fromRed(), unblinder: t.invm(e.modulus), }; })(i), o = i.modulus.byteLength(), s = (n.mont(i.modulus), new n(e).mul(r.blinder).umod(i.modulus)), c = s.toRed(n.mont(i.prime1)), u = s.toRed(n.mont(i.prime2)), l = i.coefficient, h = i.prime1, f = i.prime2, d = c.redPow(i.exponent1), p = u.redPow(i.exponent2); (d = d.fromRed()), (p = p.fromRed()); var m = d.isub(p).imul(l).umod(h); return ( m.imul(f), p.iadd(m), new t(p.imul(r.unblinder).umod(i.modulus).toArray(false, o)) ); } function a(e) { for ( var t = e.modulus.byteLength(), i = new n(r(t)); i.cmp(e.modulus) >= 0 || !i.umod(e.prime1) || !i.umod(e.prime2); ) i = new n(r(t)); return i; } (e.exports = o), (o.getr = a); }.call(this, i(9).Buffer)); }, function (e, t, i) { var n = t; (n.utils = i(33)), (n.common = i(71)), (n.sha = i(556)), (n.ripemd = i(560)), (n.hmac = i(561)), (n.sha1 = n.sha.sha1), (n.sha256 = n.sha.sha256), (n.sha224 = n.sha.sha224), (n.sha384 = n.sha.sha384), (n.sha512 = n.sha.sha512), (n.ripemd160 = n.ripemd.ripemd160); }, function (e, t, i) { "use strict"; i.r(t), (t.default = function () { var e = new URL(document.location).searchParams; (this.isSinglePlayer = !!e.get("singlePlayer")), (this.isWebRTCSupported = false); try { (new RTCPeerConnection().ondatachannel = function (e) {}), (this.isWebRTCSupported = true); } catch (e) {} this.isWebGLSupported = false; var t = document.createElement("canvas"), i = t.getContext("webgl") || t.getContext("experimental-webgl"); i && i instanceof WebGLRenderingContext && (this.isWebGLSupported = true), (this.isMobile = false), new RegExp( "Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile", "i" ).test(navigator.userAgent) && (this.isMobile = true); }); }, function (e, t, i) { "use strict"; (function (e) { var n = i(93), r = i.n(n), o = i(55), a = i(18), s = i(7); function c(e, t, i) { return ( t in e ? Object.defineProperty(e, t, { value: i, enumerable: true, configurable: true, writable: true, }) : (e[t] = i), e ); } function u(e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; (n.enumerable = n.enumerable || false), (n.configurable = true), "value" in n && (n.writable = true), Object.defineProperty(e, n.key, n); } } var l = (function () { function t(e) { var i = this; !(function (e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.maxChangesPerSync = 1e3), this.initializeState(e), (this.maxPlayers = 10), (this.lastUpdate = 0), (this.changedBlocks = []); var n = this; (this.changedBlockHandler = { setBlock: function (e, t) { var i = { add: false, p: e.slice(), bt: t, }; s.default.getInstance().addBlockChange(i), n.changedBlocks.push(i); }, addBlock: function (e, t) { var i = { add: true, p: e.slice(), bt: t, }; s.default.getInstance().addBlockChange(i), n.changedBlocks.push(i); }, }), setInterval(function () { i.update(); }, 50); } var i, n, l; return ( (i = t), (n = [ { key: "update", value: function () { new Date(), this.lastUpdate; this.broadcastPlayers(); }, }, { key: "initializeState", value: function (e) { var t = {}, i = new o.a({ name: e.name, network: this, isClient: false, peer: { send: function () {}, }, }); (t[e.name] = i), (this.state = { name: e.name, players: t, code: null, gameStarted: false, game: e.game, seed: e.seed, chatLog: [], spawnPoint: null, }), (this.hostPlayer = i); }, }, { key: "setName", value: function (e) { (this.getPlayer().state.name = e), (this.state.name = e); }, }, { key: "getPlayer", value: function () { return this.hostPlayer; }, }, { key: "copyPlayers", value: function () { return Object.assign({}, this.state.players); }, }, { key: "playersToArray", value: function () { var e = []; for (var t in this.state.players) e.push({ name: t, peer: this.state.players[t].peer, state: this.state.players[t].state, }); return e; }, }, { key: "getSpawnedPlayerNames", value: function () { var e = []; for (var t in this.state.players) this.state.players[t].state.spawned && e.push(this.state.players[t].state.name); return e; }, }, { key: "kickPlayer", value: function (e) { if (this.state.name === e) return "No kicking yourself"; for (var t in this.state.players) if (this.state.players[t].state.name === e) { var i = { message: "kicking " + e, timestamp: +new Date(), type: "message", from: this.state.name, }; return ( this.handleMessage(i), this.broadcastPlayer(t, { type: "kicked", }), this.state.players[t].peer.destroy(), "Kicking " + e ); } return "No such player"; }, }, { key: "setSpawnToCurrentPosition", value: function () { return ( (this.state.spawnPoint = this.hostPlayer.state.position), "Spawn point set to " + JSON.stringify(this.hostPlayer.state.position) ); }, }, { key: "getPositionFor", value: function (e) { for (var t in this.state.players) if (this.state.players[t].state.name === e) return this.state.players[t].state.position; return null; }, }, { key: "handleData", value: function (e, t) { switch (t.type) { case "connected": this.handleConnected(e); break; case "playerState": this.handlePlayerState(e, t.data.state); break; case "setBlockTypeAt": this.state.game.setBlock( t.data.blockTypeId, t.data.position ); break; case "fireEvent": this.state.game.handleFireEvent(t.data), this.broadcastToOthers(e, { type: "fireEvent", data: t.data, }); break; case "message": this.handleMessage(t.message); break; case "requestChanges": var i = this.changedBlocks.slice( t.from, t.from + this.maxChangesPerSync ); i.length && this.broadcastPlayer(e, { type: "changedBlocks", blocks: i, from: t.from, }); break; default: throw Error("Unkown data type ", t.type); } }, }, { key: "broadcastPlayer", value: function (e, t) { var i = this.state.players[e].peer; i.connected && i.send(JSON.stringify(t)); }, }, { key: "broadcast", value: function (e) { for (var t in this.state.players) this.broadcastPlayer(t, e); }, }, { key: "broadcastToOthers", value: function (e, t) { for (var i in this.state.players) e !== i && this.broadcastPlayer(i, t); }, }, { key: "broadcastPlayers", value: function () { this.broadcast({ type: "players", players: this.playersToArray().map(function (e) { return { name: e.state.name, id: e.name, state: e.state, }; }), }); }, }, { key: "handleConnected", value: function (e) { this.broadcastPlayers(); }, }, { key: "getOpenGame", value: function (t) { var i = this; return new e(function (e, n) { a.a.getGame(t).then(function (t) { (i.gameCode = t.code), console.log("got code " + i.gameCode), e(i.gameCode); }); }); }, }, { key: "initNewGame", value: function (t) { var i = this; return new e(function (e, n) { i.getOpenGame(t).then(function (t) { i.setState({ code: t, }), e(t), a.a.createSignalingChannel(t, "host").then(function () { a.a.listenForData(t, function (e) { void 0 !== e.payload.signal && i.handlePlayerSignaling(e, t); }); }); }); }); }, }, { key: "handlePlayerSignaling", value: function (e, t) { var i = this, n = e.from.split("/")[1]; if (void 0 === this.state.players[n]) { var s = new r.a({ initiator: false, }); s.signal(e.payload.signal), s.on("signal", function (e) { a.a.sendSignalingTo(t, n, "host", e); }); var c = this.copyPlayers(); (c[n] = new o.a({ name: n, peer: s, })), this.setState( { players: c, }, function () { i.broadcastPlayers(); } ), s.on("connect", function () { var e = i.playersToArray().length, t = e > i.maxPlayers; i.sendWelcomeInfo(s, t, e), t && l(false); }), s.on("data", function (e) { i.handleData(n, JSON.parse(e)); }); var u = this, l = function (e) { var t = Object.assign({}, u.state.players); void 0 !== t[n] && (void 0 !== t[n].noaPlayer && t[n].noaPlayer.remove(), e && t[n].state.spawned && u.sendLeftMessage(t[n].state.name), delete t[n], u.setState({ players: t, }), s.destroy()); }; s.on("close", function () { l(true); }), s.on("error", function (e) { e.code; }); } }, }, { key: "sendWelcomeInfo", value: function (e, t, i) { e.send( JSON.stringify({ type: "welcomeInfo", hostName: this.hostPlayer.state.name, gameFull: t, playerCount: i, maxPlayers: this.maxPlayers, worldSeed: this.state.seed, worldSize: s.default.getInstance().getWorldSize(), spawnPoint: this.state.spawnPoint, numberOfChangedBlocks: this.changedBlocks.length, }) ); }, }, { key: "setState", value: function (e, t) { (this.state = (function (e) { for (var t = 1; t < arguments.length; t++) { var i = null != arguments[t] ? arguments[t] : {}, n = Object.keys(i); "function" == typeof Object.getOwnPropertySymbols && (n = n.concat( Object.getOwnPropertySymbols(i).filter(function (e) { return Object.getOwnPropertyDescriptor( i, e ).enumerable; }) )), n.forEach(function (t) { c(e, t, i[t]); }); } return e; })({}, this.state, e)), t && "function" == typeof t && t(); }, }, { key: "handlePlayerState", value: function (e, t) { this.state.players[e].setState(t); }, }, { key: "emitFireEvent", value: function (e) { this.broadcast({ type: "fireEvent", data: e, }); }, }, { key: "sendJoinedMessage", value: function (e) { var t = { message: "", timestamp: +new Date(), type: "joined", from: e, }; this.handleMessage(t); }, }, { key: "sendLeftMessage", value: function (e) { var t = { message: "", timestamp: +new Date(), type: "left", from: e, }; this.handleMessage(t); }, }, { key: "sendMessage", value: function (e) { var t = { message: e, timestamp: +new Date(), type: "message", from: this.state.name, }; this.handleMessage(t); }, }, { key: "handleMessage", value: function (e) { this.state.chatLog.push(e), this.state.game.updateChatLog(this.state.chatLog.slice(-20)), this.broadcastToOthers(this.state.name, { type: "chatLog", chatLog: this.state.chatLog.slice(-20), }); }, }, { key: "setChangedBlocks", value: function (e) { this.changedBlocks = e.splice(0); }, }, ]) && u(i.prototype, n), l && u(i, l), t ); })(); t.a = l; }.call(this, i(41))); }, function (e, t, i) { e.exports = !i(13) && !i(3)(function () { return ( 7 != Object.defineProperty(i(95)("div"), "a", { get: function () { return 7; }, }).a ); }); }, function (e, t, i) { var n = i(5), r = i(14), o = i(47), a = i(97), s = i(12).f; e.exports = function (e) { var t = r.Symbol || (r.Symbol = o ? {} : n.Symbol || {}); "_" == e.charAt(0) || e in t || s(t, e, { value: a.f(e), }); }; }, function (e, t, i) { var n = i(22), r = i(24), o = i(74)(false), a = i(98)("IE_PROTO"); e.exports = function (e, t) { var i, s = r(e), c = 0, u = []; for (i in s) i != a && n(s, i) && u.push(i); for (; t.length > c; ) n(s, (i = t[c++])) && (~o(u, i) || u.push(i)); return u; }; }, function (e, t, i) { var n = i(12), r = i(4), o = i(48); e.exports = i(13) ? Object.defineProperties : function (e, t) { r(e); for (var i, a = o(t), s = a.length, c = 0; s > c; ) n.f(e, (i = a[c++]), t[i]); return e; }; }, function (e, t, i) { function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(24), o = i(51).f, a = {}.toString, s = "object" == ("undefined" == typeof window ? "undefined" : n(window)) && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; e.exports.f = function (e) { return s && "[object Window]" == a.call(e) ? (function (e) { try { return o(e); } catch (e) { return s.slice(); } })(e) : o(r(e)); }; }, function (e, t, i) { "use strict"; var n = i(48), r = i(75), o = i(65), a = i(20), s = i(64), c = Object.assign; e.exports = !c || i(3)(function () { var e = {}, t = {}, i = Symbol(), n = "abcdefghijklmnopqrst"; return ( (e[i] = 7), n.split("").forEach(function (e) { t[e] = e; }), 7 != c({}, e)[i] || Object.keys(c({}, t)).join("") != n ); }) ? function (e, t) { for ( var i = a(e), c = arguments.length, u = 1, l = r.f, h = o.f; c > u; ) for ( var f, d = s(arguments[u++]), p = l ? n(d).concat(l(d)) : n(d), m = p.length, g = 0; m > g; ) h.call(d, (f = p[g++])) && (i[f] = d[f]); return i; } : c; }, function (e, t) { e.exports = Object.is || function (e, t) { return e === t ? 0 !== e || 1 / e == 1 / t : e != e && t != t; }; }, function (e, t, i) { "use strict"; var n = i(35), r = i(6), o = i(146), a = [].slice, s = {}; e.exports = Function.bind || function (e) { var t = n(this), i = a.call(arguments, 1), c = function n() { var r = i.concat(a.call(arguments)); return this instanceof n ? (function (e, t, i) { if (!(t in s)) { for (var n = [], r = 0; r < t; r++) n[r] = "a[" + r + "]"; s[t] = Function("F,a", "return new F(" + n.join(",") + ")"); } return s[t](e, i); })(t, r.length, r) : o(t, r, e); }; return r(t.prototype) && (c.prototype = t.prototype), c; }; }, function (e, t) { e.exports = function (e, t, i) { var n = void 0 === i; switch (t.length) { case 0: return n ? e() : e.call(i); case 1: return n ? e(t[0]) : e.call(i, t[0]); case 2: return n ? e(t[0], t[1]) : e.call(i, t[0], t[1]); case 3: return n ? e(t[0], t[1], t[2]) : e.call(i, t[0], t[1], t[2]); case 4: return n ? e(t[0], t[1], t[2], t[3]) : e.call(i, t[0], t[1], t[2], t[3]); } return e.apply(i, t); }; }, function (e, t, i) { var n = i(5).parseInt, r = i(76).trim, o = i(103), a = /^[-+]?0[xX]/; e.exports = 8 !== n(o + "08") || 22 !== n(o + "0x16") ? function (e, t) { var i = r(String(e), 3); return n(i, t >>> 0 || (a.test(i) ? 16 : 10)); } : n; }, function (e, t, i) { var n = i(5).parseFloat, r = i(76).trim; e.exports = 1 / n(i(103) + "-0") != -1 / 0 ? function (e) { var t = r(String(e), 3), i = n(t); return 0 === i && "-" == t.charAt(0) ? -0 : i; } : n; }, function (e, t, i) { var n = i(36); e.exports = function (e, t) { if ("number" != typeof e && "Number" != n(e)) throw TypeError(t); return +e; }; }, function (e, t, i) { var n = i(6), r = Math.floor; e.exports = function (e) { return !n(e) && isFinite(e) && r(e) === e; }; }, function (e, t) { e.exports = Math.log1p || function (e) { return (e = +e) > -1e-8 && e < 1e-8 ? e - (e * e) / 2 : Math.log(1 + e); }; }, function (e, t, i) { "use strict"; var n = i(50), r = i(45), o = i(56), a = {}; i(23)(a, i(8)("iterator"), function () { return this; }), (e.exports = function (e, t, i) { (e.prototype = n(a, { next: r(1, i), })), o(e, t + " Iterator"); }); }, function (e, t, i) { var n = i(4); e.exports = function (e, t, i, r) { try { return r ? t(n(i)[0], i[1]) : t(i); } catch (t) { var o = e.return; throw (void 0 !== o && n(o.call(e)), t); } }; }, function (e, t, i) { var n = i(35), r = i(20), o = i(64), a = i(10); e.exports = function (e, t, i, s, c) { n(t); var u = r(e), l = o(u), h = a(u.length), f = c ? h - 1 : 0, d = c ? -1 : 1; if (i < 2) for (;;) { if (f in l) { (s = l[f]), (f += d); break; } if (((f += d), c ? f < 0 : h <= f)) throw TypeError("Reduce of empty array with no initial value"); } for (; c ? f >= 0 : h > f; f += d) f in l && (s = t(s, l[f], f, u)); return s; }; }, function (e, t, i) { "use strict"; var n = i(20), r = i(49), o = i(10); e.exports = [].copyWithin || function (e, t) { var i = n(this), a = o(i.length), s = r(e, a), c = r(t, a), u = arguments.length > 2 ? arguments[2] : void 0, l = Math.min((void 0 === u ? a : r(u, a)) - c, a - s), h = 1; for ( c < s && s < c + l && ((h = -1), (c += l - 1), (s += l - 1)); l-- > 0; ) c in i ? (i[s] = i[c]) : delete i[s], (s += h), (c += h); return i; }; }, function (e, t) { e.exports = function (e, t) { return { value: t, done: !!e, }; }; }, function (e, t, i) { "use strict"; var n = i(118); i(0)( { target: "RegExp", proto: true, forced: n !== /./.exec, }, { exec: n, } ); }, function (e, t, i) { i(13) && "g" != /./g.flags && i(12).f(RegExp.prototype, "flags", { configurable: true, get: i(78), }); }, function (e, t, i) { "use strict"; var n, r, o, a, s = i(47), c = i(5), u = i(34), l = i(66), h = i(0), f = i(6), d = i(35), p = i(60), m = i(81), g = i(67), _ = i(120).set, v = i(342)(), y = i(160), b = i(343), E = i(82), T = i(161), A = c.TypeError, x = c.process, S = x && x.versions, C = (S && S.v8) || "", P = c.Promise, R = "process" == l(x), M = function () {}, O = (r = y.f), w = !!(function () { try { var e = P.resolve(1), t = ((e.constructor = {})[i(8)("species")] = function (e) { e(M, M); }); return ( (R || "function" == typeof PromiseRejectionEvent) && e.then(M) instanceof t && 0 !== C.indexOf("6.6") && -1 === E.indexOf("Chrome/66") ); } catch (e) {} })(), I = function (e) { var t; return !(!f(e) || "function" != typeof (t = e.then)) && t; }, D = function (e, t) { if (!e._n) { e._n = true; var i = e._c; v(function () { for ( var n = e._v, r = 1 == e._s, o = 0, a = function (t) { var i, o, a, s = r ? t.ok : t.fail, c = t.resolve, u = t.reject, l = t.domain; try { s ? (r || (2 == e._h && B(e), (e._h = 1)), true === s ? (i = n) : (l && l.enter(), (i = s(n)), l && (l.exit(), (a = true))), i === t.promise ? u(A("Promise-chain cycle")) : (o = I(i)) ? o.call(i, c, u) : c(i)) : u(n); } catch (e) { l && !a && l.exit(), u(e); } }; i.length > o; ) a(i[o++]); (e._c = []), (e._n = false), t && !e._h && L(e); }); } }, L = function (e) { _.call(c, function () { var t, i, n, r = e._v, o = F(e); if ( (o && ((t = b(function () { R ? x.emit("unhandledRejection", r, e) : (i = c.onunhandledrejection) ? i({ promise: e, reason: r, }) : (n = c.console) && n.error && n.error("Unhandled promise rejection", r); })), (e._h = R || F(e) ? 2 : 1)), (e._a = void 0), o && t.e) ) throw t.v; }); }, F = function (e) { return 1 !== e._h && 0 === (e._a || e._c).length; }, B = function (e) { _.call(c, function () { var t; R ? x.emit("rejectionHandled", e) : (t = c.onrejectionhandled) && t({ promise: e, reason: e._v, }); }); }, N = function (e) { var t = this; t._d || ((t._d = true), ((t = t._w || t)._v = e), (t._s = 2), t._a || (t._a = t._c.slice()), D(t, true)); }, k = function e(t) { var i, n = this; if (!n._d) { (n._d = true), (n = n._w || n); try { if (n === t) throw A("Promise can't be resolved itself"); (i = I(t)) ? v(function () { var r = { _w: n, _d: false, }; try { i.call(t, u(e, r, 1), u(N, r, 1)); } catch (e) { N.call(r, e); } }) : ((n._v = t), (n._s = 1), D(n, false)); } catch (e) { N.call( { _w: n, _d: false, }, e ); } } }; w || ((P = function (e) { p(this, P, "Promise", "_h"), d(e), n.call(this); try { e(u(k, this, 1), u(N, this, 1)); } catch (e) { N.call(this, e); } }), ((n = function (e) { (this._c = []), (this._a = void 0), (this._s = 0), (this._d = false), (this._v = void 0), (this._h = 0), (this._n = false); }).prototype = i(61)(P.prototype, { then: function (e, t) { var i = O(g(this, P)); return ( (i.ok = "function" != typeof e || e), (i.fail = "function" == typeof t && t), (i.domain = R ? x.domain : void 0), this._c.push(i), this._a && this._a.push(i), this._s && D(this, false), i.promise ); }, catch: function (e) { return this.then(void 0, e); }, })), (o = function () { var e = new n(); (this.promise = e), (this.resolve = u(k, e, 1)), (this.reject = u(N, e, 1)); }), (y.f = O = function (e) { return e === P || e === a ? new o(e) : r(e); })), h(h.G + h.W + h.F * !w, { Promise: P, }), i(56)(P, "Promise"), i(59)("Promise"), (a = i(14).Promise), h(h.S + h.F * !w, "Promise", { reject: function (e) { var t = O(this); return (0, t.reject)(e), t.promise; }, }), h(h.S + h.F * (s || !w), "Promise", { resolve: function (e) { return T(s && this === a ? P : this, e); }, }), h( h.S + h.F * !( w && i(77)(function (e) { P.all(e).catch(M); }) ), "Promise", { all: function (e) { var t = this, i = O(t), n = i.resolve, r = i.reject, o = b(function () { var i = [], o = 0, a = 1; m(e, false, function (e) { var s = o++, c = false; i.push(void 0), a++, t.resolve(e).then(function (e) { c || ((c = true), (i[s] = e), --a || n(i)); }, r); }), --a || n(i); }); return o.e && r(o.v), i.promise; }, race: function (e) { var t = this, i = O(t), n = i.reject, r = b(function () { m(e, false, function (e) { t.resolve(e).then(i.resolve, n); }); }); return r.e && n(r.v), i.promise; }, } ); }, function (e, t, i) { "use strict"; var n = i(35); function r(e) { var t, i; (this.promise = new e(function (e, n) { if (void 0 !== t || void 0 !== i) throw TypeError("Bad Promise constructor"); (t = e), (i = n); })), (this.resolve = n(t)), (this.reject = n(i)); } e.exports.f = function (e) { return new r(e); }; }, function (e, t, i) { var n = i(4), r = i(6), o = i(160); e.exports = function (e, t) { if ((n(e), r(t) && t.constructor === e)) return t; var i = o.f(e); return (0, i.resolve)(t), i.promise; }; }, function (e, t, i) { "use strict"; var n = i(12).f, r = i(50), o = i(61), a = i(34), s = i(60), c = i(81), u = i(109), l = i(156), h = i(59), f = i(13), d = i(40).fastKey, p = i(62), m = f ? "_s" : "size", g = function (e, t) { var i, n = d(t); if ("F" !== n) return e._i[n]; for (i = e._f; i; i = i.n) if (i.k == t) return i; }; e.exports = { getConstructor: function (e, t, i, u) { var l = e(function (e, n) { s(e, l, t, "_i"), (e._t = t), (e._i = r(null)), (e._f = void 0), (e._l = void 0), (e[m] = 0), null != n && c(n, i, e[u], e); }); return ( o(l.prototype, { clear: function () { for (var e = p(this, t), i = e._i, n = e._f; n; n = n.n) (n.r = true), n.p && (n.p = n.p.n = void 0), delete i[n.i]; (e._f = e._l = void 0), (e[m] = 0); }, delete: function (e) { var i = p(this, t), n = g(i, e); if (n) { var r = n.n, o = n.p; delete i._i[n.i], (n.r = true), o && (o.n = r), r && (r.p = o), i._f == n && (i._f = r), i._l == n && (i._l = o), i[m]--; } return !!n; }, forEach: function (e) { p(this, t); for ( var i, n = a(e, arguments.length > 1 ? arguments[1] : void 0, 3); (i = i ? i.n : this._f); ) for (n(i.v, i.k, this); i && i.r; ) i = i.p; }, has: function (e) { return !!g(p(this, t), e); }, }), f && n(l.prototype, "size", { get: function () { return p(this, t)[m]; }, }), l ); }, def: function (e, t, i) { var n, r, o = g(e, t); return ( o ? (o.v = i) : ((e._l = o = { i: (r = d(t, true)), k: t, v: i, p: (n = e._l), n: void 0, r: false, }), e._f || (e._f = o), n && (n.n = o), e[m]++, "F" !== r && (e._i[r] = o)), e ); }, getEntry: g, setStrong: function (e, t, i) { u( e, t, function (e, i) { (this._t = p(e, t)), (this._k = i), (this._l = void 0); }, function () { for (var e = this._k, t = this._l; t && t.r; ) t = t.p; return this._t && (this._l = t = t ? t.n : this._t._f) ? l(0, "keys" == e ? t.k : "values" == e ? t.v : [t.k, t.v]) : ((this._t = void 0), l(1)); }, i ? "entries" : "values", !i, true ), h(t); }, }; }, function (e, t, i) { "use strict"; var n = i(61), r = i(40).getWeak, o = i(4), a = i(6), s = i(60), c = i(81), u = i(31), l = i(22), h = i(62), f = u(5), d = u(6), p = 0, m = function (e) { return e._l || (e._l = new g()); }, g = function () { this.a = []; }, _ = function (e, t) { return f(e.a, function (e) { return e[0] === t; }); }; (g.prototype = { get: function (e) { var t = _(this, e); if (t) return t[1]; }, has: function (e) { return !!_(this, e); }, set: function (e, t) { var i = _(this, e); i ? (i[1] = t) : this.a.push([e, t]); }, delete: function (e) { var t = d(this.a, function (t) { return t[0] === e; }); return ~t && this.a.splice(t, 1), !!~t; }, }), (e.exports = { getConstructor: function (e, t, i, o) { var u = e(function (e, n) { s(e, u, t, "_i"), (e._t = t), (e._i = p++), (e._l = void 0), null != n && c(n, i, e[o], e); }); return ( n(u.prototype, { delete: function (e) { if (!a(e)) return false; var i = r(e); return true === i ? m(h(this, t)).delete(e) : i && l(i, this._i) && delete i[this._i]; }, has: function (e) { if (!a(e)) return false; var i = r(e); return true === i ? m(h(this, t)).has(e) : i && l(i, this._i); }, }), u ); }, def: function (e, t, i) { var n = r(o(t), true); return true === n ? m(e).set(t, i) : (n[e._i] = i), e; }, ufstore: m, }); }, function (e, t, i) { var n = i(28), r = i(10); e.exports = function (e) { if (void 0 === e) return 0; var t = n(e), i = r(t); if (t !== i) throw RangeError("Wrong length!"); return i; }; }, function (e, t, i) { var n = i(51), r = i(75), o = i(4), a = i(5).Reflect; e.exports = (a && a.ownKeys) || function (e) { var t = n.f(o(e)), i = r.f; return i ? t.concat(i(e)) : t; }; }, function (e, t, i) { var n = i(10), r = i(105), o = i(37); e.exports = function (e, t, i, a) { var s = String(o(e)), c = s.length, u = void 0 === i ? " " : String(i), l = n(t); if (l <= c || "" == u) return s; var h = l - c, f = r.call(u, Math.ceil(h / u.length)); return f.length > h && (f = f.slice(0, h)), a ? f + s : s + f; }; }, function (e, t, i) { var n = i(48), r = i(24), o = i(65).f; e.exports = function (e) { return function (t) { for (var i, a = r(t), s = n(a), c = s.length, u = 0, l = []; c > u; ) o.call(a, (i = s[u++])) && l.push(e ? [i, a[i]] : a[i]); return l; }; }; }, function (e, t) { var i = {}.toString; e.exports = Array.isArray || function (e) { return "[object Array]" == i.call(e); }; }, function (e, t, i) { "use strict"; (function (t, n) { var r = i(86); e.exports = y; var o, a = i(168); y.ReadableState = v; i(42).EventEmitter; var s = function (e, t) { return e.listeners(t).length; }, c = i(170), u = i(2).Buffer, l = t.Uint8Array || function () {}; var h = i(68); h.inherits = i(1); var f = i(404), d = void 0; d = f && f.debuglog ? f.debuglog("stream") : function () {}; var p, m = i(405), g = i(171); h.inherits(y, c); var _ = ["error", "close", "destroy", "pause", "resume"]; function v(e, t) { e = e || {}; var n = t instanceof (o = o || i(54)); (this.objectMode = !!e.objectMode), n && (this.objectMode = this.objectMode || !!e.readableObjectMode); var r = e.highWaterMark, a = e.readableHighWaterMark, s = this.objectMode ? 16 : 16384; (this.highWaterMark = r || 0 === r ? r : n && (a || 0 === a) ? a : s), (this.highWaterMark = Math.floor(this.highWaterMark)), (this.buffer = new m()), (this.length = 0), (this.pipes = null), (this.pipesCount = 0), (this.flowing = null), (this.ended = false), (this.endEmitted = false), (this.reading = false), (this.sync = true), (this.needReadable = false), (this.emittedReadable = false), (this.readableListening = false), (this.resumeScheduled = false), (this.destroyed = false), (this.defaultEncoding = e.defaultEncoding || "utf8"), (this.awaitDrain = 0), (this.readingMore = false), (this.decoder = null), (this.encoding = null), e.encoding && (p || (p = i(124).StringDecoder), (this.decoder = new p(e.encoding)), (this.encoding = e.encoding)); } function y(e) { if (((o = o || i(54)), !(this instanceof y))) return new y(e); (this._readableState = new v(e, this)), (this.readable = true), e && ("function" == typeof e.read && (this._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), c.call(this); } function b(e, t, i, n, r) { var o, a = e._readableState; null === t ? ((a.reading = false), (function (e, t) { if (t.ended) return; if (t.decoder) { var i = t.decoder.end(); i && i.length && (t.buffer.push(i), (t.length += t.objectMode ? 1 : i.length)); } (t.ended = true), x(e); })(e, a)) : (r || (o = (function (e, t) { var i; (n = t), u.isBuffer(n) || n instanceof l || "string" == typeof t || void 0 === t || e.objectMode || (i = new TypeError("Invalid non-string/buffer chunk")); var n; return i; })(a, t)), o ? e.emit("error", o) : a.objectMode || (t && t.length > 0) ? ("string" == typeof t || a.objectMode || Object.getPrototypeOf(t) === u.prototype || (t = (function (e) { return u.from(e); })(t)), n ? a.endEmitted ? e.emit( "error", new Error("stream.unshift() after end event") ) : E(e, a, t, true) : a.ended ? e.emit("error", new Error("stream.push() after EOF")) : ((a.reading = false), a.decoder && !i ? ((t = a.decoder.write(t)), a.objectMode || 0 !== t.length ? E(e, a, t, false) : C(e, a)) : E(e, a, t, false))) : n || (a.reading = false)); return (function (e) { return ( !e.ended && (e.needReadable || e.length < e.highWaterMark || 0 === e.length) ); })(a); } function E(e, t, i, n) { t.flowing && 0 === t.length && !t.sync ? (e.emit("data", i), e.read(0)) : ((t.length += t.objectMode ? 1 : i.length), n ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && x(e)), C(e, t); } Object.defineProperty(y.prototype, "destroyed", { get: function () { return ( void 0 !== this._readableState && this._readableState.destroyed ); }, set: function (e) { this._readableState && (this._readableState.destroyed = e); }, }), (y.prototype.destroy = g.destroy), (y.prototype._undestroy = g.undestroy), (y.prototype._destroy = function (e, t) { this.push(null), t(e); }), (y.prototype.push = function (e, t) { var i, n = this._readableState; return ( n.objectMode ? (i = true) : "string" == typeof e && ((t = t || n.defaultEncoding) !== n.encoding && ((e = u.from(e, t)), (t = "")), (i = true)), b(this, e, t, false, i) ); }), (y.prototype.unshift = function (e) { return b(this, e, null, true, false); }), (y.prototype.isPaused = function () { return false === this._readableState.flowing; }), (y.prototype.setEncoding = function (e) { return ( p || (p = i(124).StringDecoder), (this._readableState.decoder = new p(e)), (this._readableState.encoding = e), this ); }); var T = 8388608; function A(e, t) { return e <= 0 || (0 === t.length && t.ended) ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t.buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = (function (e) { return ( e >= T ? (e = T) : (e--, (e |= e >>> 1), (e |= e >>> 2), (e |= e >>> 4), (e |= e >>> 8), (e |= e >>> 16), e++), e ); })(e)), e <= t.length ? e : t.ended ? t.length : ((t.needReadable = true), 0)); } function x(e) { var t = e._readableState; (t.needReadable = false), t.emittedReadable || (d("emitReadable", t.flowing), (t.emittedReadable = true), t.sync ? r.nextTick(S, e) : S(e)); } function S(e) { d("emit readable"), e.emit("readable"), O(e); } function C(e, t) { t.readingMore || ((t.readingMore = true), r.nextTick(P, e, t)); } function P(e, t) { for ( var i = t.length; !t.reading && !t.flowing && !t.ended && t.length < t.highWaterMark && (d("maybeReadMore read 0"), e.read(0), i !== t.length); ) i = t.length; t.readingMore = false; } function R(e) { d("readable nexttick read 0"), e.read(0); } function M(e, t) { t.reading || (d("resume read 0"), e.read(0)), (t.resumeScheduled = false), (t.awaitDrain = 0), e.emit("resume"), O(e), t.flowing && !t.reading && e.read(0); } function O(e) { var t = e._readableState; for (d("flow", t.flowing); t.flowing && null !== e.read(); ); } function w(e, t) { return 0 === t.length ? null : (t.objectMode ? (i = t.buffer.shift()) : !e || e >= t.length ? ((i = t.decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.head.data : t.buffer.concat(t.length)), t.buffer.clear()) : (i = (function (e, t, i) { var n; e < t.head.data.length ? ((n = t.head.data.slice(0, e)), (t.head.data = t.head.data.slice(e))) : (n = e === t.head.data.length ? t.shift() : i ? (function (e, t) { var i = t.head, n = 1, r = i.data; e -= r.length; for (; (i = i.next); ) { var o = i.data, a = e > o.length ? o.length : e; if ( (a === o.length ? (r += o) : (r += o.slice(0, e)), 0 === (e -= a)) ) { a === o.length ? (++n, i.next ? (t.head = i.next) : (t.head = t.tail = null)) : ((t.head = i), (i.data = o.slice(a))); break; } ++n; } return (t.length -= n), r; })(e, t) : (function (e, t) { var i = u.allocUnsafe(e), n = t.head, r = 1; n.data.copy(i), (e -= n.data.length); for (; (n = n.next); ) { var o = n.data, a = e > o.length ? o.length : e; if ( (o.copy(i, i.length - e, 0, a), 0 === (e -= a)) ) { a === o.length ? (++r, n.next ? (t.head = n.next) : (t.head = t.tail = null)) : ((t.head = n), (n.data = o.slice(a))); break; } ++r; } return (t.length -= r), i; })(e, t)); return n; })(e, t.buffer, t.decoder)), i); var i; } function I(e) { var t = e._readableState; if (t.length > 0) throw new Error('"endReadable()" called on non-empty stream'); t.endEmitted || ((t.ended = true), r.nextTick(D, t, e)); } function D(e, t) { e.endEmitted || 0 !== e.length || ((e.endEmitted = true), (t.readable = false), t.emit("end")); } function L(e, t) { for (var i = 0, n = e.length; i < n; i++) if (e[i] === t) return i; return -1; } (y.prototype.read = function (e) { d("read", e), (e = parseInt(e, 10)); var t = this._readableState, i = e; if ( (0 !== e && (t.emittedReadable = false), 0 === e && t.needReadable && (t.length >= t.highWaterMark || t.ended)) ) return ( d("read: emitReadable", t.length, t.ended), 0 === t.length && t.ended ? I(this) : x(this), null ); if (0 === (e = A(e, t)) && t.ended) return 0 === t.length && I(this), null; var n, r = t.needReadable; return ( d("need readable", r), (0 === t.length || t.length - e < t.highWaterMark) && d("length less than watermark", (r = true)), t.ended || t.reading ? d("reading or ended", (r = false)) : r && (d("do read"), (t.reading = true), (t.sync = true), 0 === t.length && (t.needReadable = true), this._read(t.highWaterMark), (t.sync = false), t.reading || (e = A(i, t))), null === (n = e > 0 ? w(e, t) : null) ? ((t.needReadable = true), (e = 0)) : (t.length -= e), 0 === t.length && (t.ended || (t.needReadable = true), i !== e && t.ended && I(this)), null !== n && this.emit("data", n), n ); }), (y.prototype._read = function (e) { this.emit("error", new Error("_read() is not implemented")); }), (y.prototype.pipe = function (e, t) { var i = this, o = this._readableState; switch (o.pipesCount) { case 0: o.pipes = e; break; case 1: o.pipes = [o.pipes, e]; break; default: o.pipes.push(e); } (o.pipesCount += 1), d("pipe count=%d opts=%j", o.pipesCount, t); var c = (!t || false !== t.end) && e !== n.stdout && e !== n.stderr ? l : y; function u(t, n) { d("onunpipe"), t === i && n && false === n.hasUnpiped && ((n.hasUnpiped = true), d("cleanup"), e.removeListener("close", _), e.removeListener("finish", v), e.removeListener("drain", h), e.removeListener("error", g), e.removeListener("unpipe", u), i.removeListener("end", l), i.removeListener("end", y), i.removeListener("data", m), (f = true), !o.awaitDrain || (e._writableState && !e._writableState.needDrain) || h()); } function l() { d("onend"), e.end(); } o.endEmitted ? r.nextTick(c) : i.once("end", c), e.on("unpipe", u); var h = (function (e) { return function () { var t = e._readableState; d("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && s(e, "data") && ((t.flowing = true), O(e)); }; })(i); e.on("drain", h); var f = false; var p = false; function m(t) { d("ondata"), (p = false), false !== e.write(t) || p || (((1 === o.pipesCount && o.pipes === e) || (o.pipesCount > 1 && -1 !== L(o.pipes, e))) && !f && (d( "false write response, pause", i._readableState.awaitDrain ), i._readableState.awaitDrain++, (p = true)), i.pause()); } function g(t) { d("onerror", t), y(), e.removeListener("error", g), 0 === s(e, "error") && e.emit("error", t); } function _() { e.removeListener("finish", v), y(); } function v() { d("onfinish"), e.removeListener("close", _), y(); } function y() { d("unpipe"), i.unpipe(e); } return ( i.on("data", m), (function (e, t, i) { if ("function" == typeof e.prependListener) return e.prependListener(t, i); e._events && e._events[t] ? a(e._events[t]) ? e._events[t].unshift(i) : (e._events[t] = [i, e._events[t]]) : e.on(t, i); })(e, "error", g), e.once("close", _), e.once("finish", v), e.emit("pipe", i), o.flowing || (d("pipe resume"), i.resume()), e ); }), (y.prototype.unpipe = function (e) { var t = this._readableState, i = { hasUnpiped: false, }; if (0 === t.pipesCount) return this; if (1 === t.pipesCount) return e && e !== t.pipes ? this : (e || (e = t.pipes), (t.pipes = null), (t.pipesCount = 0), (t.flowing = false), e && e.emit("unpipe", this, i), this); if (!e) { var n = t.pipes, r = t.pipesCount; (t.pipes = null), (t.pipesCount = 0), (t.flowing = false); for (var o = 0; o < r; o++) n[o].emit("unpipe", this, i); return this; } var a = L(t.pipes, e); return -1 === a ? this : (t.pipes.splice(a, 1), (t.pipesCount -= 1), 1 === t.pipesCount && (t.pipes = t.pipes[0]), e.emit("unpipe", this, i), this); }), (y.prototype.on = function (e, t) { var i = c.prototype.on.call(this, e, t); if ("data" === e) false !== this._readableState.flowing && this.resume(); else if ("readable" === e) { var n = this._readableState; n.endEmitted || n.readableListening || ((n.readableListening = n.needReadable = true), (n.emittedReadable = false), n.reading ? n.length && x(this) : r.nextTick(R, this)); } return i; }), (y.prototype.addListener = y.prototype.on), (y.prototype.resume = function () { var e = this._readableState; return ( e.flowing || (d("resume"), (e.flowing = true), (function (e, t) { t.resumeScheduled || ((t.resumeScheduled = true), r.nextTick(M, e, t)); })(this, e)), this ); }), (y.prototype.pause = function () { return ( d("call pause flowing=%j", this._readableState.flowing), false !== this._readableState.flowing && (d("pause"), (this._readableState.flowing = false), this.emit("pause")), this ); }), (y.prototype.wrap = function (e) { var t = this, i = this._readableState, n = false; for (var r in (e.on("end", function () { if ((d("wrapped end"), i.decoder && !i.ended)) { var e = i.decoder.end(); e && e.length && t.push(e); } t.push(null); }), e.on("data", function (r) { (d("wrapped data"), i.decoder && (r = i.decoder.write(r)), i.objectMode && null == r) || ((i.objectMode || (r && r.length)) && (t.push(r) || ((n = true), e.pause()))); }), e)) void 0 === this[r] && "function" == typeof e[r] && (this[r] = (function (t) { return function () { return e[t].apply(e, arguments); }; })(r)); for (var o = 0; o < _.length; o++) e.on(_[o], this.emit.bind(this, _[o])); return ( (this._read = function (t) { d("wrapped _read", t), n && ((n = false), e.resume()); }), this ); }), Object.defineProperty(y.prototype, "readableHighWaterMark", { enumerable: false, get: function () { return this._readableState.highWaterMark; }, }), (y._fromList = w); }.call(this, i(15), i(27))); }, function (e, t, i) { e.exports = i(42).EventEmitter; }, function (e, t, i) { "use strict"; var n = i(86); function r(e, t) { e.emit("error", t); } e.exports = { destroy: function (e, t) { var i = this, o = this._readableState && this._readableState.destroyed, a = this._writableState && this._writableState.destroyed; return o || a ? (t ? t(e) : !e || (this._writableState && this._writableState.errorEmitted) || n.nextTick(r, this, e), this) : (this._readableState && (this._readableState.destroyed = true), this._writableState && (this._writableState.destroyed = true), this._destroy(e || null, function (e) { !t && e ? (n.nextTick(r, i, e), i._writableState && (i._writableState.errorEmitted = true)) : t && t(e); }), this); }, undestroy: function () { this._readableState && ((this._readableState.destroyed = false), (this._readableState.reading = false), (this._readableState.ended = false), (this._readableState.endEmitted = false)), this._writableState && ((this._writableState.destroyed = false), (this._writableState.ended = false), (this._writableState.ending = false), (this._writableState.finished = false), (this._writableState.errorEmitted = false)); }, }; }, function (e, t, i) { "use strict"; e.exports = a; var n = i(54), r = i(68); function o(e, t) { var i = this._transformState; i.transforming = false; var n = i.writecb; if (!n) return this.emit( "error", new Error("write callback called multiple times") ); (i.writechunk = null), (i.writecb = null), null != t && this.push(t), n(e); var r = this._readableState; (r.reading = false), (r.needReadable || r.length < r.highWaterMark) && this._read(r.highWaterMark); } function a(e) { if (!(this instanceof a)) return new a(e); n.call(this, e), (this._transformState = { afterTransform: o.bind(this), needTransform: false, transforming: false, writecb: null, writechunk: null, writeencoding: null, }), (this._readableState.needReadable = true), (this._readableState.sync = false), e && ("function" == typeof e.transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush)), this.on("prefinish", s); } function s() { var e = this; "function" == typeof this._flush ? this._flush(function (t, i) { c(e, t, i); }) : c(this, null, null); } function c(e, t, i) { if (t) return e.emit("error", t); if ((null != i && e.push(i), e._writableState.length)) throw new Error("Calling transform done when ws.length != 0"); if (e._transformState.transforming) throw new Error("Calling transform done when still transforming"); return e.push(null); } (r.inherits = i(1)), r.inherits(a, n), (a.prototype.push = function (e, t) { return ( (this._transformState.needTransform = false), n.prototype.push.call(this, e, t) ); }), (a.prototype._transform = function (e, t, i) { throw new Error("_transform() is not implemented"); }), (a.prototype._write = function (e, t, i) { var n = this._transformState; if ( ((n.writecb = i), (n.writechunk = e), (n.writeencoding = t), !n.transforming) ) { var r = this._readableState; (n.needTransform || r.needReadable || r.length < r.highWaterMark) && this._read(r.highWaterMark); } }), (a.prototype._read = function (e) { var t = this._transformState; null !== t.writechunk && t.writecb && !t.transforming ? ((t.transforming = true), this._transform(t.writechunk, t.writeencoding, t.afterTransform)) : (t.needTransform = true); }), (a.prototype._destroy = function (e, t) { var i = this; n.prototype._destroy.call(this, e, function (e) { t(e), i.emit("close"); }); }); }, function (exp, t) { // EPSILON i = 173 exp.exports = 1e-6; }, function (exp, t) { // createVec3 i = 174 exp.exports = function () { var vec3 = new Float32Array(3); vec3[0] = 0; vec3[1] = 0; vec3[2] = 0; return vec3; }; }, function (exp, t) { // fromValuesVec3(x, y, z) i = 175 exp.exports = function (x, y, z) { var vec3 = new Float32Array(3); vec3[0] = x; vec3[1] = y; vec3[2] = z; return vec3; }; }, function (exp, t) { // TODO i = 176 exp.exports = function (vec3_0, vec3_1) { var x = vec3_1[0]; var y = vec3_1[1]; var z = vec3_1[2]; var sumOfSquares = x * x + y * y + z * z; if (sumOfSquares > 0) { sumOfSquares = 1 / Math.sqrt(sumOfSquares); vec3_0[0] = vec3_1[0] * sumOfSquares; vec3_0[1] = vec3_1[1] * sumOfSquares; vec3_0[2] = vec3_1[2] * sumOfSquares; } return vec3_0; }; }, function (exp, t) { // multSum(vec3, vec3) i = 177 exp.exports = function (vec3_0, vec3_1) { return ( vec3_0[0] * vec3_1[0] + vec3_0[1] * vec3_1[1] + vec3_0[2] * vec3_1[2] ); }; }, function (e, t) { e.exports = function (e, t, i) { return ( (e[0] = t[0] - i[0]), (e[1] = t[1] - i[1]), (e[2] = t[2] - i[2]), e ); }; }, function (e, t) { e.exports = function (e, t, i) { return ( (e[0] = t[0] * i[0]), (e[1] = t[1] * i[1]), (e[2] = t[2] * i[2]), e ); }; }, function (e, t) { e.exports = function (e, t, i) { return ( (e[0] = t[0] / i[0]), (e[1] = t[1] / i[1]), (e[2] = t[2] / i[2]), e ); }; }, function (e, t) { e.exports = function (e, t) { var i = t[0] - e[0], n = t[1] - e[1], r = t[2] - e[2]; return Math.sqrt(i * i + n * n + r * r); }; }, function (e, t) { e.exports = function (e, t) { var i = t[0] - e[0], n = t[1] - e[1], r = t[2] - e[2]; return i * i + n * n + r * r; }; }, function (e, t) { e.exports = function (e) { var t = e[0], i = e[1], n = e[2]; return Math.sqrt(t * t + i * i + n * n); }; }, function (e, t) { e.exports = function (e) { var t = e[0], i = e[1], n = e[2]; return t * t + i * i + n * n; }; }, function (e, t, i) { "use strict"; e.exports = function (e) { for (var t = new Array(e), i = 0; i < e; ++i) t[i] = i; return t; }; }, function (e, t, i) { (function (e, n) { function r(e) { return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var o = /%[sdj%]/g; (t.format = function (e) { if (!v(e)) { for (var t = [], i = 0; i < arguments.length; i++) t.push(c(arguments[i])); return t.join(" "); } i = 1; for ( var n = arguments, r = n.length, a = String(e).replace(o, function (e) { if ("%%" === e) return "%"; if (i >= r) return e; switch (e) { case "%s": return String(n[i++]); case "%d": return Number(n[i++]); case "%j": try { return JSON.stringify(n[i++]); } catch (e) { return "[Circular]"; } default: return e; } }), s = n[i]; i < r; s = n[++i] ) g(s) || !E(s) ? (a += " " + s) : (a += " " + c(s)); return a; }), (t.deprecate = function (i, r) { if (y(e.process)) return function () { return t.deprecate(i, r).apply(this, arguments); }; if (true === n.noDeprecation) return i; var o = false; return function () { if (!o) { if (n.throwDeprecation) throw new Error(r); n.traceDeprecation ? console.trace(r) : console.error(r), (o = true); } return i.apply(this, arguments); }; }); var a, s = {}; function c(e, i) { var n = { seen: [], stylize: l, }; return ( arguments.length >= 3 && (n.depth = arguments[2]), arguments.length >= 4 && (n.colors = arguments[3]), m(i) ? (n.showHidden = i) : i && t._extend(n, i), y(n.showHidden) && (n.showHidden = false), y(n.depth) && (n.depth = 2), y(n.colors) && (n.colors = false), y(n.customInspect) && (n.customInspect = true), n.colors && (n.stylize = u), h(n, e, n.depth) ); } function u(e, t) { var i = c.styles[t]; return i ? "[" + c.colors[i][0] + "m" + e + "[" + c.colors[i][1] + "m" : e; } function l(e, t) { return e; } function h(e, i, n) { if ( e.customInspect && i && x(i.inspect) && i.inspect !== t.inspect && (!i.constructor || i.constructor.prototype !== i) ) { var r = i.inspect(n, e); return v(r) || (r = h(e, r, n)), r; } var o = (function (e, t) { if (y(t)) return e.stylize("undefined", "undefined"); if (v(t)) { var i = "'" + JSON.stringify(t) .replace(/^"|"$/g, "") .replace(/'/g, "\\'") .replace(/\\"/g, '"') + "'"; return e.stylize(i, "string"); } if (_(t)) return e.stylize("" + t, "number"); if (m(t)) return e.stylize("" + t, "boolean"); if (g(t)) return e.stylize("null", "null"); })(e, i); if (o) return o; var a = Object.keys(i), s = (function (e) { var t = {}; return ( e.forEach(function (e, i) { t[e] = true; }), t ); })(a); if ( (e.showHidden && (a = Object.getOwnPropertyNames(i)), A(i) && (a.indexOf("message") >= 0 || a.indexOf("description") >= 0)) ) return f(i); if (0 === a.length) { if (x(i)) { var c = i.name ? ": " + i.name : ""; return e.stylize("[Function" + c + "]", "special"); } if (b(i)) return e.stylize(RegExp.prototype.toString.call(i), "regexp"); if (T(i)) return e.stylize(Date.prototype.toString.call(i), "date"); if (A(i)) return f(i); } var u, l = "", E = false, S = ["{", "}"]; (p(i) && ((E = true), (S = ["[", "]"])), x(i)) && (l = " [Function" + (i.name ? ": " + i.name : "") + "]"); return ( b(i) && (l = " " + RegExp.prototype.toString.call(i)), T(i) && (l = " " + Date.prototype.toUTCString.call(i)), A(i) && (l = " " + f(i)), 0 !== a.length || (E && 0 != i.length) ? n < 0 ? b(i) ? e.stylize(RegExp.prototype.toString.call(i), "regexp") : e.stylize("[Object]", "special") : (e.seen.push(i), (u = E ? (function (e, t, i, n, r) { for (var o = [], a = 0, s = t.length; a < s; ++a) R(t, String(a)) ? o.push(d(e, t, i, n, String(a), true)) : o.push(""); return ( r.forEach(function (r) { r.match(/^\d+$/) || o.push(d(e, t, i, n, r, true)); }), o ); })(e, i, n, s, a) : a.map(function (t) { return d(e, i, n, s, t, E); })), e.seen.pop(), (function (e, t, i) { if ( e.reduce(function (e, t) { return ( 0, t.indexOf("\n") >= 0 && 0, e + t.replace(/\u001b\[\d\d?m/g, "").length + 1 ); }, 0) > 60 ) return ( i[0] + ("" === t ? "" : t + "\n ") + " " + e.join(",\n ") + " " + i[1] ); return i[0] + t + " " + e.join(", ") + " " + i[1]; })(u, l, S)) : S[0] + l + S[1] ); } function f(e) { return "[" + Error.prototype.toString.call(e) + "]"; } function d(e, t, i, n, r, o) { var a, s, c; if ( ((c = Object.getOwnPropertyDescriptor(t, r) || { value: t[r], }).get ? (s = c.set ? e.stylize("[Getter/Setter]", "special") : e.stylize("[Getter]", "special")) : c.set && (s = e.stylize("[Setter]", "special")), R(n, r) || (a = "[" + r + "]"), s || (e.seen.indexOf(c.value) < 0 ? (s = g(i) ? h(e, c.value, null) : h(e, c.value, i - 1)).indexOf( "\n" ) > -1 && (s = o ? s .split("\n") .map(function (e) { return " " + e; }) .join("\n") .substr(2) : "\n" + s .split("\n") .map(function (e) { return " " + e; }) .join("\n")) : (s = e.stylize("[Circular]", "special"))), y(a)) ) { if (o && r.match(/^\d+$/)) return s; (a = JSON.stringify("" + r)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? ((a = a.substr(1, a.length - 2)), (a = e.stylize(a, "name"))) : ((a = a .replace(/'/g, "\\'") .replace(/\\"/g, '"') .replace(/(^"|"$)/g, "'")), (a = e.stylize(a, "string"))); } return a + ": " + s; } function p(e) { return Array.isArray(e); } function m(e) { return "boolean" == typeof e; } function g(e) { return null === e; } function _(e) { return "number" == typeof e; } function v(e) { return "string" == typeof e; } function y(e) { return void 0 === e; } function b(e) { return E(e) && "[object RegExp]" === S(e); } function E(e) { return "object" === r(e) && null !== e; } function T(e) { return E(e) && "[object Date]" === S(e); } function A(e) { return E(e) && ("[object Error]" === S(e) || e instanceof Error); } function x(e) { return "function" == typeof e; } function S(e) { return Object.prototype.toString.call(e); } function C(e) { return e < 10 ? "0" + e.toString(10) : e.toString(10); } (t.debuglog = function (e) { if ( (y(a) && (a = n.env.NODE_DEBUG || ""), (e = e.toUpperCase()), !s[e]) ) if (new RegExp("\\b" + e + "\\b", "i").test(a)) { var i = n.pid; s[e] = function () { var n = t.format.apply(t, arguments); console.error("%s %d: %s", e, i, n); }; } else s[e] = function () {}; return s[e]; }), (t.inspect = c), (c.colors = { bold: [1, 22], italic: [3, 23], underline: [4, 24], inverse: [7, 27], white: [37, 39], grey: [90, 39], black: [30, 39], blue: [34, 39], cyan: [36, 39], green: [32, 39], magenta: [35, 39], red: [31, 39], yellow: [33, 39], }), (c.styles = { special: "cyan", number: "yellow", boolean: "yellow", undefined: "grey", null: "bold", string: "green", date: "magenta", regexp: "red", }), (t.isArray = p), (t.isBoolean = m), (t.isNull = g), (t.isNullOrUndefined = function (e) { return null == e; }), (t.isNumber = _), (t.isString = v), (t.isSymbol = function (e) { return "symbol" === r(e); }), (t.isUndefined = y), (t.isRegExp = b), (t.isObject = E), (t.isDate = T), (t.isError = A), (t.isFunction = x), (t.isPrimitive = function (e) { return ( null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" === r(e) || void 0 === e ); }), (t.isBuffer = i(449)); var P = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ]; function R(e, t) { return Object.prototype.hasOwnProperty.call(e, t); } (t.log = function () { var e, i; console.log( "%s - %s", ((e = new Date()), (i = [C(e.getHours()), C(e.getMinutes()), C(e.getSeconds())].join( ":" )), [e.getDate(), P[e.getMonth()], i].join(" ")), t.format.apply(t, arguments) ); }), (t.inherits = i(1)), (t._extend = function (e, t) { if (!t || !E(t)) return e; for (var i = Object.keys(t), n = i.length; n--; ) e[i[n]] = t[i[n]]; return e; }); }.call(this, i(15), i(27))); }, function (e, t, i) { "use strict"; var n = [], r = [], o = [], a = [], s = [], c = [], u = [], l = [], h = [], f = [], d = [], p = []; e.exports = function (e, t, i, m, g, _) { for (var v = u, y = h, b = f, E = p, T = 0; T < 3; T++) (v[T] = +i[T]), (b[T] = +t.max[T]), (y[T] = +t.base[T]); _ || (_ = 1e-10); var A = (function (e, t, i, u, h, f) { var p = n, m = r, g = o, _ = a, v = s, y = c, b = l, E = Math.floor, T = 0, A = 0, x = 0, S = 0, C = 0; if ((P(), 0 === x)) return 0; for (S = O(); A <= x; ) { if (R(S) && M()) return T; S = O(); } for (T += x, C = 0; C < 3; C++) (u[C] += i[C]), (h[C] += i[C]); return T; function P() { if ( ((A = 0), 0 !== (x = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]))) ) for (var e = 0; e < 3; e++) { var t = i[e] >= 0; _[e] = t ? 1 : -1; var n = t ? h[e] : u[e]; (p[e] = t ? u[e] : h[e]), (m[e] = w(n, _[e])), (g[e] = I(p[e], _[e])), (b[e] = i[e] / x), (v[e] = Math.abs(1 / b[e])); var r = t ? m[e] + 1 - n : n - m[e]; y[e] = v[e] < 1 / 0 ? v[e] * r : 1 / 0; } } function R(t) { for ( var i = _[0], n = 0 === t ? m[0] : g[0], r = m[0] + i, o = _[1], a = 1 === t ? m[1] : g[1], s = m[1] + o, c = _[2], u = 2 === t ? m[2] : g[2], l = m[2] + c, h = n; h != r; h += i ) for (var f = a; f != s; f += o) for (var d = u; d != l; d += c) if (e(h, f, d)) return true; return false; } function M() { T += A; var e = _[S], n = A / x, r = d; for (C = 0; C < 3; C++) { var o = i[C] * n; (u[C] += o), (h[C] += o), (r[C] = i[C] - o); } if ( (e > 0 ? (h[S] = Math.round(h[S])) : (u[S] = Math.round(u[S])), t(T, S, e, r)) ) return true; for (C = 0; C < 3; C++) i[C] = r[C]; return P(), 0 === x; } function O() { var e = y[0] < y[1] ? (y[0] < y[2] ? 0 : 2) : y[1] < y[2] ? 1 : 2, t = y[e] - A; for (A = y[e], m[e] += _[e], y[e] += v[e], C = 0; C < 3; C++) (p[C] += t * b[C]), (g[C] = I(p[C], _[C])); return e; } function w(e, t) { return E(e - t * f); } function I(e, t) { return E(e + t * f); } })(e, m, v, y, b, _); if (!g) { for (T = 0; T < 3; T++) E[T] = i[T] > 0 ? b[T] - t.max[T] : y[T] - t.base[T]; t.translate(E); } return A; }; }, function (e, t, i) { "use strict"; var n = {}; e.exports = n; var r = 13, o = 1 << r++, a = 1 << r++, s = 1 << r++; (n.ID_MASK = 511), (n.VAR_MASK = 7680), (n.SOLID_BIT = o), (n.OPAQUE_BIT = a), (n.OBJECT_BIT = s); }, function (e, t, i) { "use strict"; e.exports = function (e) { return (function (e) { var t = new Float32Array(256), i = new Float32Array(256), n = new Float32Array(256), r = new Float32Array(256), o = new Uint8ClampedArray(1024), a = new BABYLON.DynamicTexture( "waterTexture", { width: 16, height: 16, }, e.rendering._scene ); (a.hasAlpha = true), (a.anisotropicFilteringLevel = 1), a.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), (a.wrapU = 1), (a.wrapV = 1); var s = a.getContext(), c = new ImageData(o, 16, 16), u = 0; e.on("tick", function (e) { ++u % 2 != 0 && l.redraw(); }); var l = { texture: a, tick: function () {}, redraw: function () { l.update(), s.clearRect(0, 0, 16, 16), s.putImageData(c, 0, 0), a.update(); }, update: function () { for (var e = 0; e < 16; e++) for (var a = 0; a < 16; a++) { for (var s = 0, c = e - 1; c <= e + 1; c++) { var u = 15 & c, l = 15 & a; s += t[u + 16 * l]; } i[e + 16 * a] = s / 3.3 + 0.8 * n[e + 16 * a]; } for (var e = 0; e < 16; e++) for (var a = 0; a < 16; a++) (n[e + 16 * a] += 0.05 * r[e + 16 * a]), n[e + 16 * a] < 0 && (n[e + 16 * a] = 0), (r[e + 16 * a] -= 0.1), Math.random() < 0.05 && (r[e + 16 * a] = 0.5); var h = i; (i = t), (t = h); for (var f = 0; f < 256; f++) { var s = t[f]; s > 1 && (s = 1), s < 0 && (s = 0); var d = s * s, p = 32 + 32 * d, m = 50 + 64 * d, g = 196 + 50 * d; (o[4 * f + 0] = p), (o[4 * f + 1] = m), (o[4 * f + 2] = 255), (o[4 * f + 3] = g); } }, }; return (e.waterTexture = a), l; })(e); }; }, function (e, t, i) { "use strict"; var n, r = "undefined" != typeof window ? window.navigator.userAgent : "", o = /OS X/.test(r), a = /Opera/.test(r), s = !/like Gecko/.test(r) && !a, c = (e.exports = { 0: o ? "" : "", 1: "", 2: "", 3: "", 4: "", 5: "", 6: "", 8: "", 9: "", 12: "", 13: "", 16: "", 17: "", 18: "", 19: "", 20: "", 21: "", 23: "", 24: "", 25: "", 27: "", 28: "", 29: "", 30: "", 31: "", 32: "", 33: "", 34: "", 35: "", 36: "", 37: "", 38: "", 39: "", 40: "", 41: ""), n(i, 42, ""), n(i, 43, ""), n(i, 44, ""), n(i, 45, ""), n(i, 46, ""), n(i, 47, ""), n(i, 91, ""), n(i, 92, ""), n(i, 93, a ? "" : ""), n(i, 95, ""), n(i, 106, ""), n(i, 107, ""), n(i, 108, ""), n(i, 109, ""), n(i, 111, ""), n(i, 144, ""), n(i, 145, ""), n(i, 160, ""), n(i, 161, ""), n(i, 162, ""), n(i, 163, ""), n(i, 164, ""), n(i, 165, ""), n(i, 166, ""), n(i, 167, ""), n(i, 168, ""), n(i, 169, ""), n(i, 170, ""), n(i, 171, ""), n(i, 172, ""), n(i, 173, a && c ? "-" : ""), n(i, 174, ""), n(i, 175, ""), n(i, 176, ""), n(i, 177, ""), n(i, 178, ""), n(i, 179, ""), n(i, 180, ""), n(i, 181, ""), n(i, 182, ""), n(i, 183, ""), n(i, 186, ";"), n(i, 187, "="), n(i, 188, ","), n(i, 189, "-"), n(i, 190, "."), n(i, 191, "/"), n(i, 192, "`"), n(i, 219, "["), n(i, 220, "\\"), n(i, 221, "]"), n(i, 222, "'"), n(i, 223, ""), n(i, 224, ""), n(i, 226, ""), n(i, 229, ""), n(i, 231, s ? "`" : ""), n(i, 246, ""), n(i, 247, ""), n(i, 248, ""), n(i, 249, ""), n(i, 250, ""), n(i, 251, ""), n(i, 252, ""), n(i, 253, ""), n(i, 254, ""), i)); for (r = 58; r < 65; ++r) u[r] = String.fromCharCode(r); for (r = 48; r < 58; ++r) u[r] = r - 48 + ""; for (r = 65; r < 91; ++r) u[r] = String.fromCharCode(r); for (r = 96; r < 106; ++r) u[r] = ""; for (r = 112; r < 136; ++r) u[r] = "F" + (r - 111); }, function (e, t, i) { "use strict"; e.exports = function (e) { var t = {}; for (var i in e) e.hasOwnProperty(i) && (t[e[i]] = i); return t; }; }, function (e, t, i) { "use strict"; e.exports = function (e, t, i) { return 0 === e.length ? e : t ? (i || e.sort(t), (function (e, t) { for (var i = 1, n = e.length, r = e[0], o = e[0], a = 1; a < n; ++a) if (((o = r), t((r = e[a]), o))) { if (a === i) { i++; continue; } e[i++] = r; } return (e.length = i), e; })(e, t)) : (i || e.sort(), (function (e) { for ( var t = 1, i = e.length, n = e[0], r = e[0], o = 1; o < i; ++o, r = n ) if (((r = n), (n = e[o]) !== r)) { if (o === t) { t++; continue; } e[t++] = n; } return (e.length = t), e; })(e)); }; }, function (e, t, i) { "use strict"; function n(e, t, i, n, r, o) { var a = [ "function ", e, "(a,l,h,", n.join(","), "){", o ? "" : "var i=", i ? "l-1" : "h+1", ";while(l<=h){var m=(l+h)>>>1,x=a", r ? ".get(m)" : "[m]", ]; return ( o ? t.indexOf("c") < 0 ? a.push(";if(x===y){return m}else if(x<=y){") : a.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){") : a.push(";if(", t, "){i=m;"), i ? a.push("l=m+1}else{h=m-1}") : a.push("h=m-1}else{l=m+1}"), a.push("}"), o ? a.push("return -1};") : a.push("return i};"), a.join("") ); } function r(e, t, i, r) { return new Function( [ n("A", "x" + e + "y", t, ["y"], false, r), n("B", "x" + e + "y", t, ["y"], true, r), n("P", "c(x,y)" + e + "0", t, ["y", "c"], false, r), n("Q", "c(x,y)" + e + "0", t, ["y", "c"], true, r), "function dispatchBsearch", i, "(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch", i, ].join("") )(); } e.exports = { ge: r(">=", false, "GE"), gt: r(">", false, "GT"), lt: r("<", true, "LT"), le: r("<=", true, "LE"), eq: r("-", true, "EQ", true), }; }, function (e, t) { for ( var i = 0, n = ["ms", "moz", "webkit", "o"], r = 0; r < n.length && !window.requestAnimationFrame; ++r ) (window.requestAnimationFrame = window[n[r] + "RequestAnimationFrame"]), (window.cancelAnimationFrame = window[n[r] + "CancelAnimationFrame"] || window[n[r] + "CancelRequestAnimationFrame"]); window.requestAnimationFrame || (window.requestAnimationFrame = function (e, t) { var n = new Date().getTime(), r = Math.max(0, 16 - (n - i)), o = window.setTimeout(function () { e(n + r); }, r); return (i = n + r), o; }), window.cancelAnimationFrame || (window.cancelAnimationFrame = function (e) { clearTimeout(e); }); }, function (e, t) { var i, n, r = ""; function o(e, t, o, a) { e[i]( r + t, "wheel" == n ? o : function (e) { !e && (e = window.event); var t = { originalEvent: e, target: e.target || e.srcElement, type: "wheel", deltaMode: "MozMousePixelScroll" == e.type ? 0 : 1, deltaX: 0, delatZ: 0, preventDefault: function () { e.preventDefault ? e.preventDefault() : (e.returnValue = false); }, }; return ( "mousewheel" == n ? ((t.deltaY = -0.025 * e.wheelDelta), e.wheelDeltaX && (t.deltaX = -0.025 * e.wheelDeltaX)) : (t.deltaY = e.detail), o(t) ); }, a || false ); } window.addEventListener ? (i = "addEventListener") : ((i = "attachEvent"), (r = "on")), (n = "onwheel" in document.createElement("div") ? "wheel" : void 0 !== document.onmousewheel ? "mousewheel" : "DOMMouseScroll"), (e.exports = function (e, t, i) { o(e, n, t, i), "DOMMouseScroll" == n && o(e, "MozMousePixelScroll", t, i); }); }, function (e, t) { function i(e) { return (i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } "object" === i(window.performance) ? window.performance.now ? (e.exports = function () { return window.performance.now(); }) : window.performance.webkitNow && (e.exports = function () { return window.performance.webkitNow(); }) : Date.now ? (e.exports = Date.now) : (e.exports = function () { return new Date().getTime(); }); }, function (e, t, getterFunc) { "use strict"; var n = getterFunc(32); var vec3Math = getterFunc(16); var o = getterFunc(87); var a = getterFunc(187); var s = getterFunc(43).removeUnorderedListItem; if (!BABYLON) throw new Error("Babylon.js reference not found! Abort! Abort!"); e.exports = function (e, t, i) { return new h(e, t, i); }; var c = BABYLON.Vector3, u = BABYLON.Color3; window.BABYLON = BABYLON; var l = { showFPS: false, antiAlias: true, clearColor: [0.588, 0.835, 1], ambientColor: [1, 1, 1], lightDiffuse: [1, 1, 1], lightSpecular: [1, 1, 1], groundLightColor: [0.5, 0.5, 0.5], initialCameraZoom: 0, cameraZoomSpeed: 0.2, cameraMaxAngle: Math.PI / 2 - 0.01, useAO: true, AOmultipliers: [0.93, 0.8, 0.5], reverseAOmultiplier: 1, }; function h(e, t, i) { this.noa = e; var r = n({}, l, t); (this.zoomDistance = r.initialCameraZoom), (this._currentZoom = this.zoomDistance), (this._cameraZoomSpeed = r.cameraZoomSpeed), (this._maxCamAngle = r.cameraMaxAngle), (function (e, t, i) { if (!BABYLON) throw new Error("BABYLON.js engine not found!"); (e._engine = new BABYLON.Engine(t, i.antiAlias, void 0, true)), (e._scene = new BABYLON.Scene(e._engine)); var n = e._scene; function r(e) { return new u(e[0], e[1], e[2]); } n.detachControl(), (e._octree = new BABYLON.Octree()), (e._octree.blocks = []), (n._selectionOctree = e._octree), (e._rotationHolder = new BABYLON.Mesh("rotHolder", n)), (e._cameraHolder = new BABYLON.Mesh("camHolder", n)), (e._camera = new BABYLON.FreeCamera("camera", new c(0, 0, 0), n)), (e._camera.parent = e._cameraHolder), (e._camera.minZ = 0.01), (e._cameraHolder.visibility = false), (e._rotationHolder.visibility = false), (e._camScreen = BABYLON.Mesh.CreatePlane("camScreen", 10, n)), e.addDynamicMesh(e._camScreen), (e._camScreen.position.z = 0.11), (e._camScreen.parent = e._camera), (e._camScreenMat = e.makeStandardMaterial("camscreenmat")), (e._camScreenMat.specularColor = new u(0, 0, 0)), (e._camScreen.material = e._camScreenMat), e._camScreen.setEnabled(false), (e._camLocBlock = 0), (e._light = new BABYLON.HemisphericLight( "light", new c(0.1, 1, 0.3), n )), (n.clearColor = r(i.clearColor)), (n.ambientColor = r(i.ambientColor)), (e._light.diffuse = r(i.lightDiffuse)), (e._light.specular = r(i.lightSpecular)), (e._light.groundColor = r(i.groundLightColor)), (e.flatMaterial = e.makeStandardMaterial("flatmat")), (e.flatMaterial.specularColor = BABYLON.Color3.Black()); })(this, i, r), (this._meshedChunks = {}), (this._numMeshedChunks = 0), (this.useAO = !!r.useAO), (this.aoVals = r.AOmultipliers), (this.revAoVal = r.reverseAOmultiplier), (this.meshingCutoffTime = 6), (window.scene = this._scene), r.showFPS && (function () { var e = document.createElement("div"); e.id = "noa_fps"; "color:white; background-color:rgba(0,0,0,0.5);", "font:14px monospace; text-align:center;", "min-width:2em; margin:4px;", (e.style = "position:absolute; top:0; right:0; z-index:0;color:white; background-color:rgba(0,0,0,0.5);font:14px monospace; text-align:center;min-width:2em; margin:4px;"), document.body.appendChild(e); var t = 0, i = 0, n = performance.now(), r = n; E = function () { t++; var o = performance.now(); if ((o - r > i && (i = o - r), (r = o), !(o - n < 1e3))) { var a = Math.round((t / (o - n)) * 1e3), s = Math.round((1 / i) * 1e3); (e.innerHTML = a + "
" + s), (t = 0), (i = 0), (n = o); } }; })(); } (h.prototype.initScene = function () { (this.cameraTarget = this.noa.ents.createEntity(["position"])), this.noa.ents.addComponent(this.cameraTarget, "followsEntity", { entity: this.noa.playerEntity, offset: [0, this.noa.playerEyeOffset, 0], }); }), (h.prototype.getScene = function () { return this._scene; }), (h.prototype.tick = function (e) {}); var f = 0; (h.prototype.render = function (e) { (f += e), (function (e) { e._cameraHolder.rotation.copyFrom(e._rotationHolder.rotation); var t = e.noa.ents.getPositionData(e.cameraTarget).renderPosition; e._cameraHolder.position.copyFromFloats(t[0], t[1], t[2]); var i = e.zoomDistance, n = e._cameraZoomSpeed; i > 0 && (i = (function (e) { m || ((m = new o([0, 0, 0], [0.4, 0.4, 0.4])), (g = function (t, i, n) { return e.noa.world.getBlockSolidity(t, i, n); })); var t = e._cameraHolder.position; vec3Math.set(_, t.x - 0.2, t.y - 0.2, t.z - 0.2), m.setPosition(_); var i = -e.zoomDistance, n = e.getCameraVector(); return ( vec3Math.set(v, i * n.x, i * n.y, i * n.z), a( g, m, v, function (e, t, i, n) { return true; }, true ) ); })(e)) < e._currentZoom && (e._currentZoom = i); (e._currentZoom += n * (i - e._currentZoom)), (e._camera.position.z = -e._currentZoom); var s = e.getCameraPosition(), c = e.noa.world.getBlockID( Math.floor(s.x), Math.floor(s.y), Math.floor(s.z) ); !(function (e, t) { if (t === e._camLocBlock) return; if (0 === t || 40 === t) e._camScreen.setEnabled(false), (e._scene.fogColor = new BABYLON.Color3(0.9, 0.95, 1)), (e._scene.fogDensity = e.fogWorld), (e._scene.clearColor = e._scene.fogColor); else { var i = e.noa.registry.getBlockFaceMaterialAccessor(), n = i(t, 1), r = e.noa.registry.getMaterialData(n), o = r.color, a = r.alpha; o && a && a < 1 && (17 == t && ((e._camScreenMat.diffuseColor = new u(0.8, 0, 0)), (e._camScreenMat.alpha = 0.8), e._camScreen.setEnabled(true), (e._scene.fogColor = new BABYLON.Color3(0.1, 0, 0)), (e._scene.fogDensity = e.fogLava), (e._scene.clearColor = e._scene.fogColor)), (7 != t && 41 != t) || ((e._camScreenMat.diffuseColor = new u(0, 0, 0.8)), (e._camScreenMat.alpha = 0.5), e._camScreen.setEnabled(true), (e._scene.fogColor = new BABYLON.Color3(0, 0, 0.1)), (e._scene.fogDensity = e.fogWater), (e._scene.clearColor = e._scene.fogColor))); } e._camLocBlock = t; })(e, c); })(this), this._engine.beginFrame(), this._scene.render(), this.noa.addMode || y(this, f), this.noa.addMode && b(this, f), E(), this._engine.endFrame(), this.noa.version && ((this.noa.version.fps = Math.round( 1e3 / this._scene.getEngine().getDeltaTime() )), (this.noa.version.chunkUpdates += this.noa.world._blockChanges), this.noa.version.redraw(), (this.noa.world._blockChanges = 0)), this.noa.inputs.tick(); }), (h.prototype.resize = function (e) { this._engine.resize(); }), (h.prototype.highlightBlockFace = function (e, t, i, n) { var o = (function (e) { var t = e._highlightMesh; if (!t) { var i = BABYLON.Mesh.CreateBox("highlight", 1.005, e._scene), n = e.makeDynamicStandardMaterial("highlightMat"); (n.disableLighting = true), (n.backFaceCulling = false), (n.emissiveColor = new u(1, 1, 1)), (n.alpha = 0.2), (i.material = n), (t = e._highlightMesh = i); var r = 0.5, o = BABYLON.Mesh.CreateLines( "hightlightLines", [ new c(r, r, r), new c(r, -r, r), new c(-r, -r, r), new c(-r, r, r), new c(r, r, r), new c(r, r, -r), new c(r, -r, -r), new c(-r, -r, -r), new c(-r, r, -r), new c(r, r, -r), new c(r, r, r), new c(r, -r, r), new c(r, -r, -r), new c(r, r, -r), new c(r, r, r), new c(-r, r, r), new c(-r, -r, r), new c(-r, -r, -r), new c(-r, r, -r), new c(-r, r, r), ], e._scene ); (o.color = new u(0, 0, 0)), (o.parent = i), e.addDynamicMesh(t), e.addDynamicMesh(o); } return t; })(this); if (e && !n) { this._currentZoom, vec3Math.distance(this.noa.getPlayerEyePosition(), t); for (var a = 0, s = d, l = 0; l < 3; ++l) s[l] = t[l] + 0.5; o.position.copyFromFloats(s[0], s[1], s[2]), o.setEnabled(true); } else o.setEnabled(false); o = (function (e) { var t = function () { var e = noa.rendering.getScene(), t = 0.25 * Math.PI, i = BABYLON.Mesh.CreatePlane("plane1", 1, e), n = BABYLON.Mesh.CreatePlane("plane2", 1, e); (i.rotation.y = t), (n.rotation.y = Math.PI + t); var r = BABYLON.Mesh.CreatePlane("plane3", 1, e), o = BABYLON.Mesh.CreatePlane("plane4", 1, e); (r.rotation.y = 0.5 * -Math.PI + t), (o.rotation.y = 0.5 * Math.PI + t), (i.position = new BABYLON.Vector3(0, 0, 0.5)), (n.position = new BABYLON.Vector3(0, 0, 0.5)), (r.position = new BABYLON.Vector3(0, 0, 0.5)), (o.position = new BABYLON.Vector3(0, 0, 0.5)); var a = BABYLON.Mesh.MergeMeshes([i, n, r, o]); return a; }, i = e._previewMesh; if (!i) { var n = BABYLON.Mesh.CreatePlane("preview0", 1, e._scene), r = e.makeDynamicStandardMaterial("previewMat0"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (n.material = r); var o = BABYLON.Mesh.CreatePlane("preview1", 1, e._scene), r = e.makeDynamicStandardMaterial("previewMat1"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (o.material = r), (o.parent = n), (o.rotation.y = Math.PI), (o.position = new BABYLON.Vector3(0, 0, 1)); var a = BABYLON.Mesh.CreatePlane("preview2", 1, e._scene), r = e.makeDynamicStandardMaterial("previewMat2"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (a.material = r), (a.parent = n), (a.rotation.y = 0.5 * Math.PI), (a.position = new BABYLON.Vector3(-0.5, 0, 0.5)); var s = BABYLON.Mesh.CreatePlane("preview3", 1, e._scene), r = e.makeDynamicStandardMaterial("previewMat3"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (s.material = r), (s.parent = n), (s.rotation.y = -0.5 * Math.PI), (s.position = new BABYLON.Vector3(0.5, 0, 0.5)); var l = BABYLON.Mesh.CreatePlane("preview4", 1, e._scene), r = e.makeDynamicStandardMaterial("previewMat4"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (l.material = r), (l.parent = n), (l.rotation.x = -0.5 * Math.PI), (l.rotation.y = Math.PI), (l.position = new BABYLON.Vector3(0, -0.5, 0.5)); var h = BABYLON.Mesh.CreatePlane("preview5", 1, e._scene), r = e.makeDynamicStandardMaterial("previewMat5"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (h.material = r), (h.parent = n), (h.rotation.x = 0.5 * Math.PI), (h.position = new BABYLON.Vector3(0, 0.5, 0.5)); var f = 0.5, d = BABYLON.Mesh.CreateLines( "previewLines", [ new c(f, f, f), new c(f, -f, f), new c(-f, -f, f), new c(-f, f, f), new c(f, f, f), new c(f, f, -f), new c(f, -f, -f), new c(-f, -f, -f), new c(-f, f, -f), new c(f, f, -f), new c(f, f, f), new c(f, -f, f), new c(f, -f, -f), new c(f, f, -f), new c(f, f, f), new c(-f, f, f), new c(-f, -f, f), new c(-f, -f, -f), new c(-f, f, -f), new c(-f, f, f), ], e._scene ); (d.color = new u(0, 0, 0)), (d.position = new BABYLON.Vector3(0, 0, 0.5)), (d.parent = n); var t = t(); t.parent = n; var r = e.makeStandardMaterial("crossMat"); (r.diffuseTexture = new BABYLON.Texture(null, e._scene)), (t.material = r), (i = e._previewMesh = n), e.addDynamicMesh(i), e.addDynamicMesh(o), e.addDynamicMesh(a), e.addDynamicMesh(s), e.addDynamicMesh(l), e.addDynamicMesh(h), e.addDynamicMesh(d), e.addDynamicMesh(t); } return i; })(this); if (e && n) { for ( this._currentZoom, vec3Math.distance(this.noa.getPlayerEyePosition(), t), a = 0, s = d, l = 0; l < 3; ++l ) s[l] = t[l] + 0.5 + (1 + a) * i[l]; o.position.copyFromFloats(s[0], s[1], s[2] - 0.5), o.setEnabled(true); } else o.setEnabled(false); }); var d = vec3Math.create(); h.prototype.getCameraVector = function () { return c.TransformCoordinates( BABYLON.Axis.Z, this._rotationHolder.getWorldMatrix() ); }; var p = c.Zero(); (h.prototype.getCameraPosition = function () { return c.TransformCoordinates(p, this._camera.getWorldMatrix()); }), (h.prototype.getCameraRotation = function () { var e = this._rotationHolder.rotation; return [e.x, e.y]; }), (h.prototype.setCameraRotation = function (e, t) { var i = this._rotationHolder.rotation; (i.x = Math.max(-this._maxCamAngle, Math.min(this._maxCamAngle, e))), (i.y = t); }), (h.prototype.addDynamicMesh = function (e) { if (!((t = this._octree.dynamicContent.indexOf(e)) >= 0)) { this._octree.dynamicContent.push(e); for (var t = 0; t < e.getChildren().length; t++) this._octree.dynamicContent.push(e.getChildren()[t]), (e.getChildren()[t].useOctreeForCollisions = true); var i = s.bind(null, this._octree.dynamicContent, e); if (e.onDisposeObservable) e.onDisposeObservable.add(i); else { var n = e.onDispose || function () {}; e.onDispose = function () { n(), i(); }; } } }), (h.prototype.removeDynamicMesh = function (e) { s(this._octree.dynamicContent, e); }), (h.prototype.makeMeshInstance = function (e, t) { var i = e.createInstance(e.name + " instance" || false); return ( e.billboardMode && (i.billboardMode = e.billboardMode), t || this.addDynamicMesh(i), (e.getLOD = i.getLOD = function () { return e; }), (i._currentLOD = e), t && (i.isInFrustum = function () { return true; }), i ); }), (h.prototype.makeStandardMaterial = function (e) { var t = new BABYLON.StandardMaterial(e, this._scene); return ( setTimeout(function () { t.freeze(); }, 10), t ); }), (h.prototype.makeDynamicStandardMaterial = function (e) { return new BABYLON.StandardMaterial(e, this._scene); }), (h.prototype.prepareChunkForRendering = function (e) { var t = e.size, i = new c(e.x, e.y, e.z), n = new c(e.x + t, e.y + t, e.z + t); (e.octreeBlock = new BABYLON.OctreeBlock(i, n)), this._octree.blocks.push(e.octreeBlock), (window.chunk = e); }), (h.prototype.disposeChunkForRendering = function (e) { this.removeTerrainMesh(e), s(this._octree.blocks, e.octreeBlock), (e.octreeBlock.entries.length = 0), (e.octreeBlock = null); }), (h.prototype.addTerrainMesh = function (e, t) { (this._meshedChunks[e.id] = t), this._numMeshedChunks++, t.getIndices().length && e.octreeBlock.entries.push(t), t.getChildren().map(function (t) { e.octreeBlock.entries.push(t); }); }), (h.prototype.removeTerrainMesh = function (e) { var t = this._meshedChunks[e.id]; t && (s(e.octreeBlock.entries, t), t.getChildren().map(function (t) { s(e.octreeBlock.entries, t); }), t.dispose(), delete this._meshedChunks[e.id], this._numMeshedChunks--); }); var m, g, _ = vec3Math.create(), v = vec3Math.create(); var y = function (e, t) { var i = e._highlightMesh; i && (i.material.alpha = 0.05 + 0.25 * Math.abs(Math.sin(0.005 * t))); }; var b = function (e, t) { var i = e._previewMesh; if (i) { var n = 0.35 + 0.35 * Math.abs(Math.sin(0.003 * t)); (i.material.alpha = n), (i._children[0].material.alpha = n), (i._children[1].material.alpha = n), (i._children[2].material.alpha = n), (i._children[3].material.alpha = n), (i._children[4].material.alpha = n), (i._children[6].material.alpha = n); } }; (h.prototype.debug_SceneCheck = function () { var e = this._scene.meshes, t = this._octree.dynamicContent, i = [], n = this._scene.materials, r = []; n.forEach(function (e) { e.subMaterials ? e.subMaterials.forEach(function (e) { return r.push(e); }) : r.push(e); }), this._octree.blocks.forEach(function (e) { for (var t in e.entries) i.push(e.entries[t]); }), e.forEach(function (e) { (e._isDisposed && a(e, "disposed mesh in scene"), 0 !== e.getIndices().length) && (s(e, t, i) && a(e, "non-empty mesh missing from octree"), e.material ? (e.material.subMaterials || [e.material]).forEach(function (e) { s(e, n) && a(e, "mesh material not in scene"); }) : a(e, "non-empty scene mesh with no material")); }); var o = []; function a(e, t) { console.warn(e.name + " --- " + t); } function s(e, t, i) { return !!e && (i ? !(t.includes(e) || i.includes(e)) : !t.includes(e)); } return ( r.forEach(function (t) { var i = false; e.forEach(function (e) { e.material === t && (i = true), e.material && e.material.subMaterials && e.material.subMaterials.includes(t) && (i = true); }), i || o.push(t.name); }), o.length && console.warn("Materials unused by any mesh: ", o.join(", ")), t.forEach(function (t) { s(t, e) && a(t, "octree/dynamic mesh not in scene"); }), i.forEach(function (t) { s(t, e) && a(t, "octree block mesh not in scene"); }), "done." ); }), (h.prototype.debug_MeshCount = function () { var e = {}; for (var t in (this._scene.meshes.forEach(function (t) { var i = t.name || ""; (i = (i = (i = (i = i.replace(/-\d+.*/, "#")).replace( /\d+.*/, "#" )).replace( /(rotHolder|camHolder|camScreen)/, "rendering use" )).replace(/atlas sprite .*/, "atlas sprites")), (e[i] = e[i] || 0), e[i]++; }), e)) console.log(" " + (e[t] + " ").substr(0, 7) + t); }); var E = function () {}; }, function (e, t, i) { "use strict"; var n = i(32), r = (i(88), i(460)), o = i(42).EventEmitter, a = i(461); e.exports = function (e, t) { return new c(e, t); }; var s = { chunkSize: 24, chunkAddDistance: 3, chunkRemoveDistance: 4, }; function c(e, t) { this.noa = e; var i = n(s, t); (this.userData = null), (this.playerChunkLoaded = false), (this.Chunk = a), (this.chunkSize = i.chunkSize), (this.chunkAddDistance = i.chunkAddDistance), (this.chunkRemoveDistance = i.chunkRemoveDistance), this.chunkRemoveDistance < this.chunkAddDistance && (this.chunkRemoveDistance = this.chunkAddDistance), (this._chunkIDsToAdd = []), (this._chunkIDsToRemove = []), (this._chunkIDsInMemory = []), (this._chunkIDsToCreate = []), (this._chunkIDsToMesh = []), (this._chunkIDsToMeshFirst = []), (this._maxChunksPendingCreation = 20), (this._maxChunksPendingMeshing = 20), (this._maxProcessingPerTick = 9), (this._maxProcessingPerRender = 5), (this._blockChanges = 0); var o = this; e.on("beforeRender", function () { !(function (e) { var t = performance.now() + e._maxProcessingPerRender, i = false; for (; !i && performance.now() < t; ) (i = g(e, true)) || 0; })(o); }), (this._chunkHash = r([1024, 1024, 1024])); } function u(e, t, i, n) { var r = 0, o = 0, a = 0, s = true, c = false, u = void 0; try { for ( var l, d = i[Symbol.iterator](); !(s = (l = d.next()).done); s = true ) { var p = l.value; if (p.size) p.isInvalid && r++; else { var m = h(p), g = f(e, m[0], m[1], m[2]); g.isInvalid && r++, g.isFull && o++, g.isEmpty && a++; } } } catch (e) { (c = true), (u = e); } finally { try { s || null == d.return || d.return(); } finally { if (c) throw u; } } var _ = (i.length + " ").substr(0, 6), v = n ? [", ", o, " full, ", a, " empty"].join("") : ""; console.log(t, _, r, "invalid" + v); } function l(e, t, i) { return e + "|" + t + "|" + i; } function h(e) { var t = e.split("|"); return [parseInt(t[0]), parseInt(t[1]), parseInt(t[2])]; } function f(e, t, i, n) { var r = p(0 | t), o = p(0 | i), a = p(0 | n); return e._chunkHash.get(r, o, a); } function d(e, t, i, n, r) { var o = p(0 | t), a = p(0 | i), s = p(0 | n); e._chunkHash.set(o, a, s, r); } function p(e) { return (((0 | e) % 1024) + 1024) % 1024; } function m(e) { var t, i, n, r, o, s = true; if (e._chunkIDsToRemove.length) { var c = h(e._chunkIDsToRemove.pop()); (t = e), (i = c[0]), (n = c[1]), (r = c[2]), (o = f(t, i, n, r)), t.emit("chunkBeingRemoved", o.id, o.array, o.userData), t.noa.rendering.disposeChunkForRendering(o), o.dispose(), d(t, i, n, r, 0), b(o.id, t._chunkIDsInMemory), b(o.id, t._chunkIDsToMesh), b(o.id, t._chunkIDsToMeshFirst), o.isInvalid && (t._lastPlayerChunkID = ""), E(e, "removed"), T("removed"), (s = false); } if (e._chunkIDsToCreate.length >= e._maxChunksPendingCreation) return s; if (e._chunkIDsToMesh.length >= e._maxChunksPendingMeshing) return s; if (e._chunkIDsToAdd.length) { var u = e._chunkIDsToAdd.shift(); !(function (e, t) { var i = h(t), n = i[0], r = i[1], o = i[2]; if (n < -1 || r < -1 || o < -1) return; if ( n >= e.noa.worldSize / e.chunkSize + 1 || r > 64 / e.chunkSize || o >= e.noa.worldSize / e.chunkSize + 1 ) return; var s = e.chunkSize, c = new a(e.noa, t, n, r, o, s); d(e, n, r, o, c); var u = n * s - 1, l = r * s - 1, f = o * s - 1; y(t, e._chunkIDsToCreate), e.emit("worldDataNeeded", t, c.array, u, l, f); })(e, u), T("requested"), E(e, "requested"), (s = false); } return s; } function g(e, t) { var i; if (e._chunkIDsToMeshFirst.length) i = e._chunkIDsToMeshFirst.pop(); else { if (t || !e._chunkIDsToMesh.length) return true; i = e._chunkIDsToMesh.pop(); } var n = h(i), r = f(e, n[0], n[1], n[2]); if (!r.isInvalid) return r.updateMeshes(), E(e, "meshed"), T("meshed"), false; } function _(e, t, i, n, r, o, a, s) { var c = f(e, t, i, n); c && (c.set(r, o, a, s), y(c.id, e._chunkIDsToMeshFirst), e.emit("chunkChanged", c)); } function v(e, t) { var i = Object.keys(t); return ( i.sort(function (e, i) { return t[e] - t[i]; }), i.map(function (t) { return e[t]; }) ); } function y(e, t) { t.indexOf(e) >= 0 || t.push(e); } function b(e, t) { var i = t.indexOf(e); i >= 0 && t.splice(i, 1); } (c.prototype = Object.create(o.prototype)), (c.prototype.getBlockID = function (e, t, i) { var n = this.chunkSize, r = Math.floor(e / n), o = Math.floor(t / n), a = Math.floor(i / n), s = f(this, r, o, a); return s ? s.get(e - r * n, t - o * n, i - a * n) : 0; }), (c.prototype.getBlockSolidity = function (e, t, i) { var n = this.chunkSize, r = 0 | Math.floor(e / this.chunkSize), o = 0 | Math.floor(t / this.chunkSize), a = 0 | Math.floor(i / this.chunkSize), s = f(this, r, o, a); return s ? s.getSolidityAt(e - r * n, t - o * n, i - a * n) : 0; }), (c.prototype.getBlockOpacity = function (e, t, i) { return this.noa.registry._blockOpacity[this.getBlockID(e, t, i)]; }), (c.prototype.getBlockTransparency = function (e, t, i) { return this.noa.registry._blockTransparency[this.getBlockID(e, t, i)]; }), (c.prototype.getBlockFluidity = function (e, t, i) { return this.noa.registry._blockIsFluid[this.getBlockID(e, t, i)]; }), (c.prototype.getBlockProperties = function (e, t, i) { return this.noa.registry._blockProps[this.getBlockID(e, t, i)]; }), (c.prototype.getBlockObjectMesh = function (e, t, i) { var n = this.chunkSize, r = Math.floor(e / n), o = Math.floor(t / n), a = Math.floor(i / n), s = f(this, r, o, a); return s ? s.getObjectMeshAt(e - r * n, t - o * n, i - a * n) : null; }), (c.prototype.setBlockID = function (e, t, i, n) { var r = this.chunkSize, o = Math.floor(t / r), a = Math.floor(i / r), s = Math.floor(n / r); (t -= o * r), (i -= a * r), (n -= s * r), ++this._blockChanges, (function (e, t, i, n, r, o, a, s, c) { for ( var u = 0 === o ? -1 : o === r - 1 ? 1 : 0, l = 0 === a ? -1 : a === r - 1 ? 1 : 0, h = 0 === s ? -1 : s === r - 1 ? 1 : 0, f = -1; f < 2; ++f ) for (var d = -1; d < 2; ++d) for (var p = -1; p < 2; ++p) (0 !== f && f !== u) || (0 !== d && d !== l) || (0 !== p && p !== h) || _( e, t + f, i + d, n + p, [r, o, -1][f + 1], [r, a, -1][d + 1], [r, s, -1][p + 1], c ); })(this, o, a, s, r, t, i, n, e); }), (c.prototype.isBoxUnobstructed = function (e) { for ( var t = Math.floor, i = e.base, n = e.max, r = t(i[0]), o = t(n[0]) + 1, a = t(i[1]), s = t(n[1]) + 1, c = t(i[2]), u = t(n[2]) + 1, l = r; l < o; l++ ) for (var h = a; h < s; h++) for (var f = c; f < u; f++) if (this.getBlockSolidity(l, h, f)) return false; return true; }), (c.prototype.tick = function () { T("start"); var e = (function (e) { var t = e.noa.getPlayerPosition(), i = e.chunkSize, n = Math.floor(t[0] / i), r = Math.floor(t[1] / i), o = Math.floor(t[2] / i); return [n, r, o]; })(this), t = l(e[0], e[1], e[2]); t != this._lastPlayerChunkID && ((function (e, t, i, n) { for ( var r = Math.ceil(e.chunkAddDistance), o = e._chunkIDsToCreate, a = [], s = [], c = e.chunkAddDistance * e.chunkAddDistance, u = t - r; u <= t + r; ++u ) for (var h = i - r; h <= i + r; ++h) for (var d = n - r; d <= n + r; ++d) { var p = u - t, m = h - i, g = d - n, _ = p * p + m * m + g * g; if (!(_ > c) && !f(e, u, h, d)) { var y = l(u, h, d); o.indexOf(y) > -1 || (a.push(y), s.push(_)); } } e._chunkIDsToAdd = v(a, s); })(this, e[0], e[1], e[2]), (function (e, t, i, n) { for ( var r = e.chunkRemoveDistance * e.chunkRemoveDistance, o = e._chunkIDsInMemory, a = [], s = [], c = 0; c < o.length; c++ ) { var u = o[c], l = h(u), d = l[0] - t, p = l[1] - i, m = l[2] - n, g = d * d + p * p + m * m; if (g < r) { var _ = f(e, l[0], l[1], l[2]); if (!_.isInvalid) continue; g *= -1; } a.push(u), s.push(g); } e._chunkIDsToRemove = v(a, s); })(this, e[0], e[1], e[2])), (this._lastPlayerChunkID = t), T("build queues"), E(this, "start"); for ( var i = performance.now() + this._maxProcessingPerTick, n = false; !n && performance.now() < i; ) (n = g(this, false)), (n &= m(this)); E(this, "end"); var r = f(this, e[0], e[1], e[2]), o = !(!r || !r.isGenerated || r.isInvalid); (this.playerChunkLoaded = o), T("end"); }), (c.prototype.setChunkData = function (e, t, i) { E(this, "received"); var n = h(e), r = f(this, n[0], n[1], n[2]); r && !r.isInvalid && ((r.array = t), i && (r.userData = i), r.initData(), y(e, this._chunkIDsInMemory), b(e, this._chunkIDsToCreate), this.noa.rendering.prepareChunkForRendering(r), y(e, this._chunkIDsToMesh), this.emit("chunkAdded", r)); }), (c.prototype.invalidateAllChunks = function () { var e = this._chunkIDsInMemory.concat(this._chunkIDsToCreate), t = true, i = false, n = void 0; try { for ( var r, o = e[Symbol.iterator](); !(t = (r = o.next()).done); t = true ) { var a = h(r.value); f(this, a[0], a[1], a[2]).isInvalid = true; } } catch (e) { (i = true), (n = e); } finally { try { t || null == o.return || o.return(); } finally { if (i) throw n; } } this._lastPlayerChunkID = ""; }), (c.prototype.report = function () { console.log( "World report - playerChunkLoaded: ", this.playerChunkLoaded ), u(this, " to add ", this._chunkIDsToAdd), u(this, " to remove: ", this._chunkIDsToRemove), u(this, " in memory: ", this._chunkIDsInMemory, true), u(this, " creating: ", this._chunkIDsToCreate), u(this, " meshing: ", this._chunkIDsToMesh); }); var E = function (e, t) {}; var T = function (e) {}; }, function (e, t, i) { "use strict"; var n = i(88), r = !("undefined" == typeof Map); function o(e) { (this.length = e), (this.store = r ? new Map() : {}); } r ? ((o.prototype.get = function (e) { return this.store.get(e) || 0; }), (o.prototype.set = function (e, t) { return 0 === t ? this.store.delete(e) : this.store.set(e, t), t; })) : ((o.prototype.get = function (e) { return this.store[e] || 0; }), (o.prototype.set = function (e, t) { return 0 === t ? delete this.store[e] : (this.store[e] = t), t; })), (e.exports = function (e) { for (var t = 1, i = 0; i < e.length; ++i) t *= e[i]; return n(new o(t), e); }); }, function (e, t, i) { "use strict"; var n = i(188), r = i(88); (window.ndarray = r), (e.exports = m); var o, a, s, c, u = i(462), l = i(465), h = n.ID_MASK, f = (n.VAR_MASK, n.SOLID_BIT), d = n.OPAQUE_BIT, p = n.OBJECT_BIT; function m(e, t, i, n, u, h) { (this.id = t), (this.noa = e), (this.isDisposed = false), (this.isGenerated = false), (this.inInvalid = false), (this.octreeBlock = null), (this.isEmpty = false), (this.isFull = false); var f = h + 2, d = new Uint16Array(f * f * f); (this.array = new r(d, [f, f, f])), (this.i = i), (this.j = n), (this.k = u), (this.size = h), (this.x = i * h), (this.y = n * h), (this.z = u * h), (this._terrainDirty = false), (this._objectsDirty = false), (function (e) { (o = e.registry._blockSolidity), (a = e.registry._blockOpacity), (s = e.registry._blockMesh), (c = e.registry._blockHandlers); })(e), y(this), l.initChunk(this); } function g(e, t, i, n, r, o) { var a = c[t]; if (a) { var s = a[i]; if (s) { var u = e.size; n < 0 || r < 0 || o < 0 || n >= u || r >= u || o >= u || s(e.x + n, e.y + r, e.z + o); } } } function _(e) { return 0 !== e && (!(e & p) || !!(e & f)); } function v(e) { var t = e; return o[e] && (t |= f), a[e] && (t |= d), s[e] && (t |= p), t; } function y(e) { var t = e.array, i = e.size; e._unpaddedView = t.lo(1, 1, 1).hi(i, i, i); } function b(e, t, i, n, r) { l.addObjectBlock(e, t, i, n, r), (e._objectsDirty = true); } (m.prototype.get = function (e, t, i) { return h & this._unpaddedView.get(e, t, i); }), (m.prototype.getSolidityAt = function (e, t, i) { return !!(f & this._unpaddedView.get(e, t, i)); }), (m.prototype.set = function (e, t, i, n) { var r = this._unpaddedView.get(e, t, i), o = r & h; if (n !== o) { var a = v(n); this._unpaddedView.set(e, t, i, a), r & p && (function (e, t, i, n) { l.removeObjectBlock(e, t, i, n), (e._objectsDirty = true); })(this, e, t, i), a & p && b(this, n, e, t, i), 0 !== a && (this.isEmpty = false), a & d || (this.isFull = false), g(this, o, "onUnset", e, t, i), g(this, n, "onSet", e, t, i), (_(r) || _(a)) && (this._terrainDirty = true); } }), (m.prototype.mesh = function (e, t, i, n, r) { return u.meshChunk(this, e, t, i, n, r); }), (m.prototype.updateMeshes = function () { if (this._terrainDirty) { this.noa.rendering.removeTerrainMesh(this); var e = this.mesh(); e && this.noa.rendering.addTerrainMesh(this, e), (this._terrainDirty = false); } this._objectsDirty && (l.buildObjectMesh(this), (this._objectsDirty = false)); }), (m.prototype.initData = function () { y(this); for ( var e = d, t = true, i = this.array, n = i.data, r = i.shape[0], o = i.stride[2], a = (this._objectMeshes, 0); a < r; ++a ) for (var s = 0 === a || a === r - 1, c = 0; c < r; ++c) for ( var u = i.index(a, c, 0), l = s || 0 === c || c === r - 1, f = 0; f < r; ++f, u += o ) { var m = n[u] & h; if (0 !== m) { var _ = 0 | v(m); (n[u] = _), (e &= _), (t = false), l || 0 === f || f === r - 1 || (p & _ && b(this, m, a - 1, c - 1, f - 1), g(this, m, "onLoad", a - 1, c - 1, f - 1)); } else e = 0; } (this.isFull = !!(e & d)), (this.isEmpty = !!t), (this._terrainDirty = !(this.isFull || this.isEmpty)), (this.isGenerated = true); }), (m.prototype.dispose = function () { !(function (e, t) { for ( var i = e._unpaddedView, n = i.data, r = i.stride[0], o = i.stride[1], a = i.stride[2], s = i.shape[0], c = i.offset, u = 0; u < s; ++u ) { for (var l = 0; l < s; ++l) { for (var f = 0; f < s; ++f) { var d = h & n[c]; g(e, d, t, u, l, f), (c += a); } (c -= a * s), (c += o); } (c -= o * s), (c += r); } })(this, "onUnload"), l.disposeChunk(this), (this.array.data = null), (this.array = null), (this._unpaddedView = null), (this.isGenerated = false), (this.isDisposed = true); }); }, function (e, t, i) { "use strict"; e.exports = new (function () { var e = new o(), t = new r(); this.meshChunk = function (i, n, r, o, s, c, u) { a("start"); var l, h = i.noa, f = [i.i * i.size, i.j * i.size, i.k * i.size], d = i.array, p = n || h.registry.getBlockFaceMaterialAccessor(), m = r || h.registry.getMaterialVertexColorAccessor(), g = void 0 === s ? h.rendering.useAO : s, _ = c || h.rendering.aoVals, v = isNaN(u) ? h.rendering.revAoVal : u, y = e.mesh(d, p, m, g, _, v, f); return ( y.length && ((l = t.build(i, y, o)), a("built terrain")), a("end"), l || null ); }; })(); function n(e) { (this.id = 0 | e), (this.positions = []), (this.indices = []), (this.normals = []), (this.colors = []), (this.uvs = []); } function r() { var e; function t(e, t) { for ( var i, n = [], r = [], o = [], a = Object.keys(e), s = null, c = 0; c < a.length; ++c ) { var u = e[a[c]]; if (t(u)) if ( (n.push(u.positions.length), r.push(u.indices.length), o.push(u.id), s) ) { var l = s.positions.length / 3; (s.positions = s.positions.concat(u.positions)), (s.normals = s.normals.concat(u.normals)), (s.colors = s.colors.concat(u.colors)), (s.uvs = s.uvs.concat(u.uvs)); for (var h = 0, f = u.indices.length; h < f; ++h) s.indices.push(u.indices[h] + l); u.dispose(), delete e[a[c]]; } else (s = u), (i = a[c]); } return { mergedID: i, vertices: n, indices: r, matIDs: o, }; } function n(t, i, n, r, o) { var a = e.rendering.getScene(), s = new BABYLON.Mesh(i, a), c = new BABYLON.VertexData(); if ( ((c.positions = t.positions), (c.indices = t.indices), (c.normals = t.normals), (c.colors = t.colors), (c.uvs = t.uvs), c.applyToMesh(s), t.dispose(), 1 === n.length) ) s.material = n[0]; else { var u = new BABYLON.MultiMaterial("multimat " + i, a); s.subMeshes = []; c.positions.length, c.indices.length; for (var l = 0, h = 0, f = 0; f < n.length; f++) { u.subMaterials[f] = n[f]; var d = new BABYLON.SubMesh(f, l, r[f], h, o[f], s); (s.subMeshes[f] = d), (l += r[f]), (h += o[f]); } s.material = u; } return s; } (this.build = function (i, r, a) { e = i.noa; t(r, function (t) { if (a) return true; var i = e.registry.getMaterialTexture(t.id), n = e.registry.getMaterialData(t.id).alpha; return !(i || n < 1) && void 0; }); var s = t(r, function () { return true; }), c = n( r[s.mergedID], "chunk_" + i.id, s.matIDs.map(function (e) { return o(e, a); }), s.vertices, s.indices ), u = i.i * i.size, l = i.j * i.size, h = i.k * i.size; return ( (c.position.x = u), (c.position.y = l), (c.position.z = h), c.freezeWorldMatrix(), c.freezeNormals(), c ); }), (this.buildWithoutMultimats = function (i, r, a) { e = i.noa; t(r, function (t) { if (a) return true; var i = e.registry.getMaterialTexture(t.id), n = e.registry.getMaterialData(t.id).alpha; return !(i || n < 1) && void 0; }); for (var s = null, c = Object.keys(r), u = 0; u < c.length; ++u) { var l = r[c[u]], h = l.id, f = o(h, a), d = n(l, "chunk_inner_" + i.id + " " + h, [f]); if (s) d.parent = s; else { s = d; var p = i.i * i.size, m = i.j * i.size, g = i.k * i.size; (s.position.x = p), (s.position.y = m), (s.position.z = g); } d.freezeWorldMatrix(), d.freezeNormals(); } return s; }); var r = {}; function o(t, n) { if (n) return e.rendering.flatMaterial; var o = "terrain mat " + t; return ( r[o] || (r[o] = (function (t) { var n = e.registry.getMaterialTexture(t), r = e.registry.getMaterialData(t), o = r.alpha; if (!n && 1 == o) return e.rendering.flatMaterial; var a = e.rendering.flatMaterial.clone("terrain" + t); if (n) { var s = e.rendering.getScene(), c = new BABYLON.Texture( n, s, true, false, BABYLON.Texture.NEAREST_SAMPLINGMODE ); if (12 == t) { var u = i(463)(e); c = u.texture; } if (r.textureAlpha) { if (((c.hasAlpha = true), (a.diffuseTexture = c), 36 == t)) { if (e.waterTexture) a.diffuseTexture = e.waterTexture; else { var l = i(189)(e); a.diffuseTexture = l.texture; } a.useAlphaFromDiffuseTexture = true; } (34 != t && 36 != t) || (a.backFaceCulling = false); } else (a.ambientTexture = c), 12 == t && (a.backFaceCulling = false); } r.alpha < 1 && (a.alpha = r.alpha); return a; })(t)), r[o] ); } } function o() { var e = i(188), t = e.ID_MASK, r = (e.VAR_MASK, e.SOLID_BIT), o = e.OPAQUE_BIT, s = e.OBJECT_BIT, c = new Int16Array(256), u = new Uint16Array(256); function l(e, i, n, r, o, a) { for ( var s = n.shape[1], l = c, h = u, d = 0, p = n.data, m = n.index(e - 1, 0, 0), g = n.stride[0], _ = n.stride[1], v = n.stride[2], y = 0; y < s; ++y ) { var b = m; m += v; for (var E = 0; E < s; E++, d++, b += _) { var T = p[b], A = p[b + g], x = f(T, A, E, y); if (x) { if ( ((l[d] = x > 0 ? r(T & t, 2 * i) : -r(A & t, 2 * i + 1)), 0 != l[d]) ) { var S = a[0] + e + x, C = a[1] + E, P = a[2] + y; 1 == i && ((S = a[0] + y), (C = a[1] + e + x), (P = a[2] + E)), 2 == i && ((S = a[0] + E), (C = a[1] + y), (P = a[2] + e + x)), 0 == i && x > 0 && (S -= 1), 1 == i && x > 0 && (C -= 1), 2 == i && x > 0 && (P -= 1), noa.getBrightness(S, C, P) < 1 && (l[d] += 512 * x); } if (o) { var R = x > 0 ? e : e - 1, M = x > 0 ? e - 1 : e; h[d] = o(n, R, M, E, y); } } } } } this.mesh = function (e, t, i, n, r, o, s) { var h, f = [], p = n && o === r[0]; n && (h = p ? v : y); for (var m = 0; m < 3; ++m) { var g = (m + 1) % 3, _ = (m + 2) % 3, b = e .transpose(m, g, _) .lo(1, 1, 1) .hi(e.shape[m] - 2, e.shape[g] - 2, e.shape[_] - 2), E = b.shape[0] - 1, T = b.shape[1], A = b.shape[2]; c.length < T * A && ((c = new Int16Array(T * A)), (u = new Uint16Array(T * A))); for (var x = 0; x <= E; ++x) l(x, m, b, t, h, s), a("built masks"), d(x, m, g, _, T, A, n, f, i, r, o, s), a("build submeshes"); } return f; }; var h = i(464); function f(e, t, i, n) { var r = e & o, a = t & o; if (r && a) return 0; if (r) return 1; if (a) return -1; if (7 === e && 32809 === t) return 0; if (7 === t && 32809 === e) return 0; if (0 === t || t & s) return 1; if (0 === e || e & s) return -1; if (40 === t || t & s) return 1; if (40 === e || e & s) return -1; var c = 0; return ( 8206 == e && (c = 1), 8206 == t && (c = -1), 7 == e && (c = 1), 7 == t && (c = -1), 7 == e && 7 == t && (c = 0), 7 == e && 8206 == t && (c = -1), 8206 == e && 7 == t && (c = 1), 7 == e && 8215 == t && (c = -1), 8215 == e && 7 == t && (c = 1), 17 == e && 8206 == t && (c = 1), 8206 == e && 17 == t && (c = -1), 17 == e && 8215 == t && (c = 1), 8215 == e && 17 == t && (c = -1), 8206 == e && 8206 == t && ((c = 1), h(i, n) > 0.5 && (c = -1)), c ); } function d(e, t, i, r, o, a, s, l, h, f, d, v) { for ( var y = 0, b = c, E = u, T = s ? p : m, A = s ? _ : g, x = 0; x < a; ++x ) for (var S = 1, C = 1, P = 0; P < o; P += S, y += S) { var R = b[y]; if (R) { var M = E[y]; for (S = 1; S < o - P && T(y + S, b, R, E, M); ++S); e: for (C = 1; C < a - x; ++C) for (var O = 0; O < S; ++O) { if (!T(y + O + C * o, b, R, E, M)) break e; } var w = b[y]; w >= 512 && (w -= 512), w <= -512 && (w += 512); var I = Math.abs(w); l[I] || (l[I] = new n(I)); var D = l[I], L = D.colors, F = h(I); (F[0] = 1), (F[1] = 1), (F[2] = 1), w != R && ((F[0] = 0.6), (F[1] = 0.6), (F[2] = 0.6)); var B = A(L, F, M, f, d), N = 0; (36 == I || 12 == I) && 1 == t && w > 0 && (N = 0.07); var k = [0, 0, 0]; (k[t] = e), (k[i] = P), (k[r] = x); var U = [0, 0, 0]; U[i] = S; var V = [0, 0, 0]; V[r] = C; var G = D.positions; G.push( k[0], k[1] - N, k[2], k[0] + U[0], k[1] + U[1] - N, k[2] + U[2], k[0] + U[0] + V[0], k[1] + U[1] + V[1] - N, k[2] + U[2] + V[2], k[0] + V[0], k[1] + V[1] - N, k[2] + V[2] ); var z = R > 0 ? 1 : -1; 2 === t ? D.uvs.push(0, C, -z * S, C, -z * S, 0, 0, 0) : D.uvs.push(0, S, 0, 0, z * C, 0, z * C, S); var j = G.length / 3 - 4; R < 0 ? B ? D.indices.push(j, j + 1, j + 2, j, j + 2, j + 3) : D.indices.push(j + 1, j + 2, j + 3, j, j + 1, j + 3) : B ? D.indices.push(j, j + 2, j + 1, j, j + 3, j + 2) : D.indices.push(j + 3, j + 1, j, j + 3, j + 2, j + 1); var H = 0 === t ? z : 0, W = 1 === t ? z : 0, X = 2 === t ? z : 0; D.normals.push(H, W, X, H, W, X, H, W, X, H, W, X); for (var Y = 0; Y < C; ++Y) for (var K = 0; K < S; ++K) b[y + K + Y * o] = 0; } else S = 1; } } function p(e, t, i, n, r) { return i === t[e] && r === n[e]; } function m(e, t, i, n, r) { return i === t[e]; } function g(e, t, i, n, r) { return ( e.push(t[0], t[1], t[2], 1), e.push(t[0], t[1], t[2], 1), e.push(t[0], t[1], t[2], 1), e.push(t[0], t[1], t[2], 1), true ); } function _(e, t, i, n, r) { var o = b(i, 0, 0), a = b(i, 1, 0), s = b(i, 1, 1), c = b(i, 0, 1); E(e, t, o, n, r), E(e, t, a, n, r), E(e, t, s, n, r), E(e, t, c, n, r); return o === s ? c !== a || 2 == c : c !== a && o + s > c + a; } function v(e, t, i, n, o) { var a = 1, s = 1, c = 1, u = 1, l = r, h = l & e.get(t, n, o); return ( e.get(t, n + 1, o) & l && (++c, ++u), e.get(t, n - 1, o) & l && (++a, ++s), e.get(t, n, o + 1) & l && (++s, ++u), e.get(t, n, o - 1) & l && (++a, ++c), h ? ((u = 3 == u || e.get(t, n + 1, o + 1) & l ? 3 : 2), (s = 3 == s || e.get(t, n - 1, o + 1) & l ? 3 : 2), (c = 3 == c || e.get(t, n + 1, o - 1) & l ? 3 : 2), (a = 3 == a || e.get(t, n - 1, o - 1) & l ? 3 : 2)) : (1 === u && e.get(t, n + 1, o + 1) & l && (u = 2), 1 === s && e.get(t, n - 1, o + 1) & l && (s = 2), 1 === c && e.get(t, n + 1, o - 1) & l && (c = 2), 1 === a && e.get(t, n - 1, o - 1) & l && (a = 2)), (u << 6) | (c << 4) | (s << 2) | a ); } function y(e, t, i, n, o) { var a = 1, s = 1, c = 1, u = 1, l = r, h = l & e.get(t, n, o); return ( e.get(t, n + 1, o) & l && (++c, ++u), e.get(t, n - 1, o) & l && (++a, ++s), e.get(t, n, o + 1) & l && (++s, ++u), e.get(t, n, o - 1) & l && (++a, ++c), h ? ((u = 3 == u || e.get(t, n + 1, o + 1) & l ? 3 : 2), (s = 3 == s || e.get(t, n - 1, o + 1) & l ? 3 : 2), (c = 3 == c || e.get(t, n + 1, o - 1) & l ? 3 : 2), (a = 3 == a || e.get(t, n - 1, o - 1) & l ? 3 : 2)) : (1 === u && (e.get(t, n + 1, o + 1) & l ? (u = 2) : (e.get(i, n, o + 1) & l && e.get(i, n + 1, o) & l && e.get(i, n + 1, o + 1) & l) || (u = 0)), 1 === c && (e.get(t, n + 1, o - 1) & l ? (c = 2) : (e.get(i, n, o - 1) & l && e.get(i, n + 1, o) & l && e.get(i, n + 1, o - 1) & l) || (c = 0)), 1 === s && (e.get(t, n - 1, o + 1) & l ? (s = 2) : (e.get(i, n, o + 1) & l && e.get(i, n - 1, o) & l && e.get(i, n - 1, o + 1) & l) || (s = 0)), 1 === a && (e.get(t, n - 1, o - 1) & l ? (a = 2) : (e.get(i, n, o - 1) & l && e.get(i, n - 1, o) & l && e.get(i, n - 1, o - 1) & l) || (a = 0))), (u << 6) | (c << 4) | (s << 2) | a ); } function b(e, t, i) { return (e >> (t ? (i ? 6 : 4) : i ? 2 : 0)) & 3; } function E(e, t, i, n, r) { var o = 0 === i ? r : n[i - 1]; e.push(t[0] * o, t[1] * o, t[2] * o, 1); } } n.prototype.dispose = function () { (this.positions = null), (this.indices = null), (this.normals = null), (this.colors = null), (this.uvs = null); }; var a = function () {}; }, function (e, t, i) { "use strict"; e.exports = function (e) { return (function (e) { var t = new Float32Array(256), i = new Float32Array(256), n = new Float32Array(256), r = new Float32Array(256), o = new Uint8ClampedArray(1024), a = new BABYLON.DynamicTexture( "lavaTexture", { width: 16, height: 16, }, e.rendering._scene ); (a.hasAlpha = false), (a.anisotropicFilteringLevel = 1), a.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), (a.wrapU = 1), (a.wrapV = 1); var s = a.getContext(), c = new ImageData(o, 16, 16), u = 0; e.on("tick", function (e) { ++u % 2 != 1 && l.redraw(); }); var l = { texture: a, tick: function () {}, redraw: function () { l.update(), s.clearRect(0, 0, 16, 16), s.putImageData(c, 0, 0), a.update(); }, update: function () { for (var e = 0; e < 16; e++) for (var a = 0; a < 16; a++) { for ( var s = 0, c = 1.2 * Math.sin((a * Math.PI * 2) / 16), u = 1.2 * Math.sin((e * Math.PI * 2) / 16), l = e - 1; l <= e + 1; l++ ) for (var h = a - 1; h <= a + 1; h++) { var f = (l + c) & 15, d = (h + u) & 15; s += t[f + 16 * d]; } (i[e + 16 * a] = s / 10 + ((n[((e + 0) & 15) + 16 * ((a + 0) & 15)] + n[((e + 1) & 15) + 16 * ((a + 0) & 15)] + n[((e + 1) & 15) + 16 * ((a + 1) & 15)] + n[((e + 0) & 15) + 16 * ((a + 1) & 15)]) / 4) * 0.8), (n[e + 16 * a] += 0.01 * r[e + 16 * a]), n[e + 16 * a] < 0 && (n[e + 16 * a] = 0), (r[e + 16 * a] -= 0.06), Math.random() < 0.005 && (r[e + 16 * a] = 1.5); } var p = i; (i = t), (t = p); for (var m = 0; m < 256; m++) { var s = 2 * t[m]; s > 1 && (s = 1), s < 0 && (s = 0); var g = s, _ = 100 * g + 155, v = g * g * 255, y = g * g * g * g * 128; (o[4 * m + 0] = _), (o[4 * m + 1] = v), (o[4 * m + 2] = y), (o[4 * m + 3] = 255); } }, }; return l; })(e); }; }, function (e, t) { var i, n, r, o, a = Math.sqrt(5), s = Math.sqrt(7), c = Math.floor; function u(e) { return e - c(e); } e.exports = function () { for (i = a, n = s, r = 0; r < arguments.length; ++r) (o = arguments[r]), (i = u(i * (o + s))), (n *= o + a); return (i = u(i * n)); }; }, function (e, t, i) { "use strict"; var n = i(43).removeUnorderedListItem; e.exports = new (function () { function e(e) { for (var t = e._mergedObjectSystems; t.length; ) { var i = t.pop(); i.mesh && e.octreeBlock && e.octreeBlock.entries && n(e.octreeBlock.entries, i.mesh), i.mesh && i.mesh.dispose(), i.dispose(); } } function t(e, t, i, n, r, o) { var a = e._objectBlocks, s = new BABYLON.SolidParticleSystem("object_sps_" + e.id, t, { updatable: false, }), c = e.noa.registry._blockHandlers, u = e.noa.registry._blockMesh; for (var l in i) { var h, f = u[l], d = i[l], p = d.length, m = c[l]; m && (h = m.onCustomMeshCreate); s.addShape(f, p, { positionFunction: function (e, t, i) { var s = d[i], c = a[s]; e.position.copyFromFloats(n + c.x + 0.5, r + c.y, o + c.z + 0.5), h && h(e, n + c.x, r + c.y, o + c.z); (e.position.x -= n), (e.position.y -= r), (e.position.z -= o); }, }), (d.length = 0); } return s; } (this.initChunk = function (e) { (e._objectBlocks = {}), (e._mergedObjectSystems = []); }), (this.disposeChunk = function (t) { e(t), (t._objectBlocks = null); }), (this.addObjectBlock = function (e, t, i, n, o) { var a = i + "|" + n + "|" + o; e._objectBlocks[a] = new r(t, i, n, o, null); }), (this.removeObjectBlock = function (e, t, i, n) { var r = t + "|" + i + "|" + n; e._objectBlocks[r] && delete e._objectBlocks[r]; }), (this.buildObjectMesh = function (i) { o("start"), e(i); var n = i.noa.rendering.getScene(), r = i.noa.registry._blockMesh, a = {}; for (var s in i._objectBlocks) { var c = i._objectBlocks[s], u = c.id, l = r[u].material, h = l ? n.materials.indexOf(l) : -1; a[h] || (a[h] = {}), a[h][u] || (a[h][u] = []), a[h][u].push(s); } o("preprocess"); var f = i.i * i.size, d = i.j * i.size, p = i.k * i.size; for (var m in a) { var g = a[m], _ = t(i, n, g, f, d, p); o("made SPS"); var v = _.buildMesh(); o("built mesh"), (v.material = m > -1 ? n.materials[m] : null), (v.position.x = f), (v.position.y = d), (v.position.z = p), v.freezeWorldMatrix(), v.freezeNormals(), i.octreeBlock.entries.push(v), i._mergedObjectSystems.push(_); } o("end"); }); })(); function r(e, t, i, n) { (this.id = 0 | e), (this.x = 0 | t), (this.y = 0 | i), (this.z = 0 | n); } var o = function () {}; }, function (e, t, i) { "use strict"; var n = i(467), r = i(32); e.exports = function (e, t, i) { return (function (e, t, i) { t = r({}, o, t); var a = n(i, t), s = t.bindings; for (var c in s) { var u = Array.isArray(s[c]) ? s[c] : [s[c]]; u.unshift(c), a.bind.apply(a, u); } return a; })(0, t, i); }; var o = { bindings: { forward: "W", left: "A", backward: "S", right: "D", fire: "", "mid-fire": "", "alt-fire": "", jump: "", build: "B", chat: "T", fog: "F", saveLoc: "", loadLoc: "R", spawnSteve: "G", }, }; }, function (e, t, i) { "use strict"; var n = i(190), r = i(42).EventEmitter, o = i(468); function a(e, t) { (this.element = e || document), (t = t || {}), (this.preventDefaults = !!t.preventDefaults), (this.stopPropagation = !!t.stopPropagation), (this.down = new r()), (this.up = new r()), (this.state = { active: true, dx: 0, dy: 0, scrollx: 0, scrolly: 0, scrollz: 0, }), (this._keybindmap = {}), (this._keyStates = {}), (this._bindPressCounts = {}), this.initEvents(); } function s(e, t, i) { d(i.keyCode, n[i.keyCode], t, e, i); } function c(e, t, i) { if (e.state.active) return ( d(-1 - i.button, "", t, e, i), false ); } function u(e, t) { var i = t.movementX || t.mozMovementX || 0, n = t.movementY || t.mozMovementY || 0; if (t.touches && 0 == (i | n)) { var r = (function (e) { for (var t, i = e.changedTouches, n = 0; n < i.length; ++n) i[n].identifier == f && (t = i[n]); if (!t) return [0, 0]; var r = [t.clientX - l, t.clientY - h]; return (l = t.clientX), (h = t.clientY), r; })(t); (i = r[0]), (n = r[1]); } (e.state.dx += i), (e.state.dy += n); } (e.exports = function (e, t) { return new a(e, t); }), (a.prototype.initEvents = function () { window.addEventListener("keydown", s.bind(void 0, this, true), false), window.addEventListener("keyup", s.bind(void 0, this, false), false), this.element.addEventListener( "mousedown", c.bind(void 0, this, true), false ), this.element.addEventListener( "mouseup", c.bind(void 0, this, false), false ), (this.element.oncontextmenu = function (e) { if (e._keybindmap[""]) return false; }.bind(void 0, this)), this.element.addEventListener( "dragstart", c.bind(void 0, this, false), false ), this.element.addEventListener( "mousemove", u.bind(void 0, this), false ), this.element.addEventListener( "touchmove", u.bind(void 0, this), false ), this.element.addEventListener( "touchstart", function (e, t) { var i = t.changedTouches[0]; (l = i.clientX), (h = i.clientY), (f = i.identifier); }.bind(void 0, this), false ), o( document, function (e, t) { var i = 1; switch (t.deltaMode) { case 0: i = 1; break; case 1: i = 12; break; case 2: i = e.element.clientHeight || window.innerHeight; } return ( (e.state.scrollx += t.deltaX * i), (e.state.scrolly += t.deltaY * i), (e.state.scrollz += t.deltaZ * i || 0), false ); }.bind(void 0, this), false ); }), (a.prototype.bind = function (e) { for (var t = 1; t < arguments.length; ++t) { var i = arguments[t], n = this._keybindmap[i] || []; -1 == n.indexOf(e) && n.push(e), (this._keybindmap[i] = n); } this.state[e] = !!this.state[e]; }), (a.prototype.unbind = function (e) { for (var t in this._keybindmap) { var i = this._keybindmap[t], n = i.indexOf(e); n > -1 && i.splice(n, 1); } }), (a.prototype.tick = function () { this.state.dx = this.state.dy = 0; }), (a.prototype.getBoundKeys = function () { var e = []; for (var t in this._keybindmap) e.push(t); return e; }); var l = 0, h = 0, f = null; function d(e, t, i, n, r) { var o = n._keybindmap[t]; if ( o && (n.preventDefaults && r.preventDefault(), n.stopPropagation && r.stopPropagation(), n.state.active) ) { if (m(n._keyStates[e], i)) for (var a = 0; a < o.length; ++a) p(o[a], i, n, r); n._keyStates[e] = i; } } function p(e, t, i, n) { var r = i._bindPressCounts[e] || 0; ((r += t ? 1 : -1) < 0 && (r = 0), (i._bindPressCounts[e] = r), m(i.state[e], r)) && (t ? i.down : i.up).emit(e, n); i.state[e] = !!r; } function m(e, t) { return e ? !t : t; } }, function (e, t) { var i, n, r = ""; function o(e, t, o, a) { e[i]( r + t, "wheel" == n ? o : function (e) { !e && (e = window.event); var t = { originalEvent: e, target: e.target || e.srcElement, type: "wheel", deltaMode: "MozMousePixelScroll" == e.type ? 0 : 1, deltaX: 0, delatZ: 0, preventDefault: function () { e.preventDefault ? e.preventDefault() : (e.returnValue = false); }, }; return ( "mousewheel" == n ? ((t.deltaY = -0.025 * e.wheelDelta), e.wheelDeltaX && (t.deltaX = -0.025 * e.wheelDeltaX)) : (t.deltaY = e.detail), o(t) ); }, a || false ); } window.addEventListener ? (i = "addEventListener") : ((i = "attachEvent"), (r = "on")), (n = "onwheel" in document.createElement("div") ? "wheel" : void 0 !== document.onmousewheel ? "mousewheel" : "DOMMouseScroll"), (e.exports = function (e, t, i) { o(e, n, t, i), "DOMMouseScroll" == n && o(e, "MozMousePixelScroll", t, i); }); }, function (e, t, getterFunc) { "use strict"; var n = getterFunc(470); var vec3Math = getterFunc(16); var o = getterFunc(32); e.exports = function (e, t) { return (function (e, t) { t = o({}, a, t); var i = e.world, r = n( t, function (e, t, n) { var r = i.getBlockID(e, t, n); return ( 5 != r && 6 != r && 8 != r && 15 != r && 16 != r && i.getBlockSolidity(e, t, n) ); }, function (e, t, n) { return i.getBlockFluidity(e, t, n); } ); return ( (r._originalTick = r.tick), (r.tick = function (t) { this._originalTick(t), (function (e) { for ( var t = e.ents, i = t.getStatesList(t.names.physics), n = s, r = 0; r < i.length; ++r ) { var o = i[r], a = t.getPositionData(o.__id); (n[0] = a.width / 2), (n[1] = 0), (n[2] = n[0]); for ( var c = a.position, u = o.body.aabb.base, l = o.body.aabb.max, h = a._extents, f = 0; f < 3; f++ ) (c[f] = u[f] + n[f]), (h[f] = u[f]), (h[f + 3] = l[f]); } })(e); }), r ); })(e, t); }; var a = { gravity: [0, -10, 0], airFriction: 0.999, }; var s = vec3Math.create(); }, function (e, t, getterFunc) { "use strict"; var n = getterFunc(32); var r = getterFunc(191); var vec3Math = getterFunc(16); var a = getterFunc(187); var s = getterFunc(471); e.exports = function (e, t, i) { return new u(e, t, i); }; var c = { gravity: [0, -10, 0], airFriction: 0.995, minBounceImpulse: 0.5, fluidDensity: 1.2, fluidDrag: 4, }; function u(e, t, i) { (e = n({}, c, e)), (this.gravity = e.gravity), (this.airFriction = e.airFriction), (this.fluidDensity = e.fluidDensity), (this.fluidDrag = e.fluidDrag), (this.minBounceImpulse = e.minBounceImpulse), (this.bodies = []), (this.testSolid = t), (this.testFluid = i); } (u.prototype.addBody = function (e, t, i, n, o, a) { (e = e || new r([0, 0, 0], [1, 1, 1])), void 0 === t && (t = 1), void 0 === i && (i = 1), void 0 === n && (n = 0), void 0 === o && (o = 1); var c = new s(e, t, i, n, o, a); return this.bodies.push(c), c; }), (u.prototype.removeBody = function (e) { var t = this.bodies.indexOf(e); t < 0 || (this.bodies.splice(t, 1), (e.aabb = e.onCollide = null)); }); var l = vec3Math.create(), h = vec3Math.create(), f = vec3Math.create(), d = vec3Math.create(), p = vec3Math.create(), m = vec3Math.create(), g = vec3Math.create(); function _(e, t, i, n) { return ( vec3Math.set(n, 0, 0, 0), a(e.testSolid, t, i, function (e, t, i, r) { (n[t] = i), (r[t] = 0); }) ); } u.prototype.tick = function (e) { var t, i, n, r, a = S(0, vec3Math.squaredLength(this.gravity)); for (e /= 1e3, i = 0, r = this.bodies.length; i < r; ++i) { if ( ((t = this.bodies[i]), vec3Math.copy(g, t.resting), !x(this, t, e, a || 0 === t.gravityMultiplier)) ) { if ( (t._sleepFrameCount--, vec3Math.scale(h, t._forces, 1 / t.mass), vec3Math.scaleAndAdd(h, h, this.gravity, t.gravityMultiplier), vec3Math.scale(d, t._impulses, 1 / t.mass), vec3Math.add(t.velocity, t.velocity, d), vec3Math.scale(d, h, e), vec3Math.add(t.velocity, t.velocity, d), g[1] < 0) ) { var s = e * t.friction; vec3Math.scale(l, t.velocity, -1), (l[1] = 0); var c = vec3Math.length(l); c > s ? (vec3Math.scale(l, l, s / c), vec3Math.add(t.velocity, t.velocity, l)) : (t.velocity[0] = t.velocity[2] = 0); } else vec3Math.scale(t.velocity, t.velocity, this.airFriction); for ( vec3Math.scale(p, t.velocity, e), vec3Math.set(t._forces, 0, 0, 0), vec3Math.set(t._impulses, 0, 0, 0), t.autoStep && C(v, t.aabb), _(this, t.aabb, p, t.resting), t.autoStep && A(this, t, v, p), n = 0; n < 3; ++n ) (m[n] = 0), t.resting[n] && (g[n] || (m[n] = -t.velocity[n]), (t.velocity[n] = 0)); var u = vec3Math.length(m); u > 0.001 && (u > this.minBounceImpulse && t.restitution && (vec3Math.scale(m, m, t.restitution * t.mass), t.applyImpulse(m)), t.onCollide && t.onCollide(m)); for ( var y = t.aabb, b = Math.floor((y.base[0] + y.max[0]) / 2), E = Math.floor((y.base[2] + y.max[2]) / 2), T = Math.floor(y.base[1]), P = Math.floor(y.max[1]), R = 0, M = T; M <= P && this.testFluid(b, M, E); ++M ) ++R; if (R > 0) { var O = (T + R - y.base[1]) / y.vec[1]; O > 1 && (O = 1); var w = y.vec[0] * y.vec[1] * y.vec[2] * O; vec3Math.scale( f, this.gravity, -t.gravityMultiplier * this.fluidDensity * w ), vec3Math.scale(l, t.velocity, -this.fluidDrag * O), vec3Math.add(f, f, l), t.applyForce(f), (t.inFluid = true); } else t.inFluid = false; vec3Math.squaredLength(t.velocity) > 1e-5 && t._markActive(); } } }; var v = new r([], []), y = vec3Math.create(), b = vec3Math.create(), E = vec3Math.create(), T = vec3Math.create(); function A(e, t, i, n) { if (!(t.resting[1] >= 0) || t.inFluid) { var r = 0 !== t.resting[0], s = 0 !== t.resting[2]; if (r || s) { var c = Math.abs(n[0] / n[2]); if ((r || !(c > 4)) && (s || !(c < 0.25))) { vec3Math.add(b, i.base, n); var u = e.testSolid, l = (a(u, i, n, function (e, t, i, n) { if (1 !== t) return true; n[t] = 0; }), t.aabb.base[1]), h = Math.floor(l + 1.001) - l; vec3Math.set(E, 0, h, 0); var f = false; a(u, i, E, function (e, t, i, n) { return (f = true), true; }); if (!f) { vec3Math.subtract(T, b, i.base), (T[1] = 0); _(e, i, T, y); (r && !S(i.base[0], b[0])) || (s && !S(i.base[2], b[2])) || (C(t.aabb, i), (t.resting[0] = y[0]), (t.resting[2] = y[2]), t.onStep && t.onStep()); } } } } } function x(e, t, i, n) { if (t._sleepFrameCount > 0) return false; if (n) return true; var r = false; return ( vec3Math.scale(d, e.gravity, i), a( e.testSolid, t.aabb, d, function () { return (r = true), true; }, true ), r ); } function S(e, t) { return Math.abs(e - t) < 1e-5; } function C(e, t) { for (var i = 0; i < 3; i++) (e.base[i] = t.base[i]), (e.max[i] = t.max[i]), (e.vec[i] = t.vec[i]); } }, function (e, t, getterFunc) { var n = getterFunc(191); var vec3Math = getterFunc(16); function o(e, t, i, o, a, s, c) { (this.aabb = new n(e.base, e.vec)), (this.mass = t), (this.friction = i), (this.restitution = o), (this.gravityMultiplier = a), (this.onCollide = s), (this.autoStep = !!c), (this.onStep = null), (this.velocity = vec3Math.create()), (this.resting = [false, false, false]), (this.inFluid = false), (this._forces = vec3Math.create()), (this._impulses = vec3Math.create()), (this._sleepFrameCount = 10); } (e.exports = o), (o.prototype.setPosition = function (e) { vec3Math.subtract(e, e, this.aabb.base), this.aabb.translate(e), this._markActive(); }), (o.prototype.getPosition = function () { return vec3Math.clone(this.aabb.base); }), (o.prototype.applyForce = function (e) { vec3Math.add(this._forces, this._forces, e), this._markActive(); }), (o.prototype.applyImpulse = function (e) { vec3Math.add(this._impulses, this._impulses, e), this._markActive(); }), (o.prototype._markActive = function () { this._sleepFrameCount = 10; }), (o.prototype.atRestX = function () { return this.resting[0]; }), (o.prototype.atRestY = function () { return this.resting[1]; }), (o.prototype.atRestZ = function () { return this.resting[2]; }); }, function (e, t, i) { "use strict"; var n = i(32); e.exports = function (e, t) { return new o(e, t); }; var r = { rotationScale: 8e-4, inverseY: false, }; function o(e, t) { (this.noa = e), (t = n({}, r, t)), (this.rotationScale = t.rotationScale), (this.inverseY = t.inverseY); } o.prototype.updateForRender = function () { var e, t, i = this.noa.inputs.state, n = this.rotationScale * i.dy * (this.inverseY ? -1 : 1), r = this.rotationScale * i.dx, o = this.noa.rendering.getCameraRotation(), s = ((e = o[0] + n), (t = a), isFinite(t) ? Math.max(Math.min(e, t), -t) : e), c = (o[1] + r) % (2 * Math.PI); this.noa.rendering.setCameraRotation(s, c); }; var a = Math.PI / 2 - 1e-4; }, function (e, t, i) { "use strict"; var n = i(32); e.exports = function (e, t) { return new s(e, t); }; var r, o = { texturePath: "", }, a = { solid: true, opaque: true, fluidDensity: 1, viscosity: 0.5, }; function s(e, t) { this.noa = e; var i = n({}, o, t); (this._texturePath = i.texturePath), (this._blockSolidity = [false]), (this._blockOpacity = [false]), (this._blockIsFluid = [false]), (this._blockMats = [null, null, null, null, null, null]), (this._blockProps = [null]), (this._blockMesh = [null]), (this._blockHandlers = [null]), (this._matIDs = {}), (this._matData = []), (this._textures = []); for (var r = 1; r <= 32; r++) this.registerBlock(r); this.registerMaterial("dirt", [0.4, 0.3, 0], null), this.registerBlock(1, "dirt"); } function c(e) { (this.onLoad = e.onLoad || null), (this.onUnload = e.onUnload || null), (this.onSet = e.onSet || null), (this.onUnset = e.onUnset || null), (this.onCustomMeshCreate = e.onCustomMeshCreate || null); } function u(e, t, i) { var n = e._matIDs[t]; return void 0 === n && i && (n = e.registerMaterial(t)), n; } (s.prototype.registerBlock = function (e, t) { (t = t || {}), (a.solid = !t.fluid), (a.opaque = !t.fluid); var i = n({}, a, t); if (e < 1 || e > 255) throw "Invalid block id: " + e; e > this._blockSolidity.length && console.warn( "Probably better to register block IDs in counting order without gaps!" ), (this._blockSolidity[e] = !!i.solid), (this._blockOpacity[e] = !!i.opaque), (this._blockIsFluid[e] = !!i.fluid), (this._blockMesh[e] = i.blockMesh || null); var r, o = i.material || null; if (o) if ("string" == typeof o) r = [o, o, o, o, o, o]; else if (o.length && 2 == o.length) r = [o[1], o[1], o[0], o[0], o[1], o[1]]; else if (o.length && 3 == o.length) r = [o[2], o[2], o[0], o[1], o[2], o[2]]; else { if (!o.length || 6 != o.length) throw "Invalid material parameter: " + o; r = o; } else r = [null, null, null, null, null, null]; for (var s = 0; s < 6; ++s) this._blockMats[6 * e + s] = u(this, r[s], true); (this._blockProps[e] = {}), this._blockIsFluid[e] && ((this._blockProps[e].fluidDensity = i.fluidDensity), (this._blockProps[e].viscosity = i.viscosity)); var l = i.onLoad || i.onUnload || i.onSet || i.onUnset || i.onCustomMeshCreate; return (this._blockHandlers[e] = l ? new c(i) : null), e; }), (s.prototype.registerMaterial = function (e, t, i, n) { var r = this._matIDs[e] || this._matData.length; this._matIDs[e] = r; var o = 1; return ( t && 4 == t.length && (o = t.pop()), (this._matData[r] = { color: t || [1, 1, 1], alpha: o, texture: i ? this._texturePath + i : "", textureAlpha: !!n, }), null != i && (this._textures[r] = new BABYLON.Texture( this._texturePath + i, this.noa.rendering._scene, false, true, BABYLON.Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST )), r ); }), (s.prototype.getBlockSolidity = function (e) { return this._blockSolidity[e]; }), (s.prototype.getBlockOpacity = function (e) { return this._blockOpacity[e]; }), (s.prototype.getBlockFluidity = function (e) { return this._blockIsFluid[e]; }), (s.prototype.getBlockProps = function (e) { return this._blockProps[e]; }), (s.prototype.getBlockFaceMaterialAccessor = function () { if (!this._storedBFMAccessor) { var e = this._blockMats; this._storedBFMAccessor = function (t, i) { return e[6 * t + i]; }; } return this._storedBFMAccessor; }), (s.prototype.getMaterialColor = function (e) { return this._matData[e].color; }), (s.prototype.getTexture = function (e) { return this._textures[e]; }), (s.prototype.getMaterialVertexColorAccessor = function () { if (!r) { var e = this._matData; r = function (t) { return e[t].texture ? l : e[t].color; }; } return r; }); var l = [1, 1, 1]; (s.prototype.getMaterialTexture = function (e) { return this._matData[e].texture; }), (s.prototype.getMaterialData = function (e) { return this._matData[e]; }); }, function (exp, t, getterFunc) { "use strict"; var n = getterFunc(32); var r = getterFunc(87); var vec3Math = getterFunc(16); var a = getterFunc(475); exp.exports = function (e, t) { return new c(e, t); }; var s = { shadowDistance: 10, }; function c(e, t) { a.call(this), (this.noa = e), (t = n(s, t)), (this.names = {}); var r = t.shadowDistance; (this.names.position = this.createComponent(getterFunc(476)(e))), (this.names.physics = this.createComponent(getterFunc(477)(e))), (this.names.followsEntity = this.createComponent(getterFunc(478)(e))), (this.names.mesh = this.createComponent(getterFunc(479)(e))), (this.names.shadow = this.createComponent(getterFunc(480)(e, r))), (this.names.collideTerrain = this.createComponent(getterFunc(481)(e))), (this.names.collideEntities = this.createComponent(getterFunc(482)(e))), (this.names.every = this.createComponent(getterFunc(489)(e))), (this.names.smoothCamera = this.createComponent(getterFunc(490)(e))), (this.names.movement = this.createComponent(getterFunc(491)(e))), (this.names.receivesInputs = this.createComponent(getterFunc(492)(e))), (this.names.fadeOnZoom = this.createComponent(getterFunc(493)(e))), (this.isPlayer = function (t) { return t === e.playerEntity; }), (this.hasPhysics = this.getComponentAccessor(this.names.physics)), (this.cameraSmoothed = this.getComponentAccessor( this.names.smoothCamera )), (this.hasMesh = this.getComponentAccessor(this.names.mesh)), (this.hasPosition = this.getComponentAccessor(this.names.position)); var c = this.getStateAccessor(this.names.position); (this.getPositionData = c), (this.getPosition = function (e) { return c(e).position; }), (this.setPosition = function (e, t, i, n) { var r = this.getPositionData(e); vec3Math.set(r.position, t, i, n), (r._extentsChanged = true), this.hasPhysics(e) && l(this.getPhysicsBody(e).aabb, r); }); var u = this.getStateAccessor(this.names.physics); (this.getPhysicsBody = function (e) { return u(e).body; }), (this.getPhysicsInterpolation = function (e) { return u(e).interpolatePosition; }), (this.setPhysicsInterpolation = function (e, t) { u(e).interpolatePosition = t; }), (this.getMeshData = this.getStateAccessor(this.names.mesh)), (this.getMovement = this.getStateAccessor(this.names.movement)), (this.getCollideTerrain = this.getStateAccessor( this.names.collideTerrain )), (this.getCollideEntities = this.getStateAccessor( this.names.collideEntities )); var h = this; e.on("tick", function (e) {}), e.on("beforeRender", function (e) { h.render(e); }), this.createEntity(); } (c.prototype = Object.create(a.prototype)), (c.prototype.constructor = c), (c.prototype.addComponentAgain = function (e, t, i) { this.hasComponent(e, t) && this.removeComponent(e, t), this.addComponent(e, t, i); }), (c.prototype.isTerrainBlocked = function (e, t, i) { var n = u; return ( n.setPosition([e + 0.001, t + 0.001, i + 0.001]), this.getEntitiesInAABB(n, this.names.collideTerrain).length > 0 ); }); var u = new r([0, 0, 0], [0.998, 0.998, 0.998]); function l(e, t) { var i = t.width, n = t.position, r = i / 2; vec3Math.set(e.base, n[0] - r, n[1], n[2] - r), vec3Math.set(e.vec, i, t.height, i), vec3Math.add(e.max, e.base, e.vec); } (c.prototype.setEntitySize = function (e, t, i, n) { if (!this.hasPosition(e)) throw "Set size of entity without a position component"; var r = this.getPositionData(e); ((r.width = (t + n) / 2), (r.height = i), (r._extentsChanged = true), this.hasPhysics(e)) && l(this.getPhysicsBody(e).aabb, r); }), (c.prototype.getEntitiesInAABB = function (e, t) { for ( var i = [], n = this, r = t ? n.getStatesList(t).map(function (e) { return n.getPositionData(e.__id); }) : (r = n.getStatesList(this.names.position)), o = h, a = 0; a < r.length; a++ ) l(o, r[a]), e.intersects(o) && i.push(r[a].__id); return i; }); var h = new r([], []); c.prototype.add = function (e, t, i, n, r, a, s) { var c = this, u = this.createEntity(), l = vec3Math.create(); if ( (vec3Math.copy(l, e), this.addComponent(u, this.names.position, { position: l, width: t, height: i, }), a) ) { this.addComponent(u, this.names.physics); var h = this.getPhysicsBody(u), f = this.names.smoothCamera; h.onStep = function () { c.addComponentAgain(u, f); }; } return ( n && (r || (r = vec3Math.create()), this.addComponent(u, this.names.mesh, { mesh: n, offset: r, })), s && this.addComponent(u, this.names.shadow, { size: t, }), u ); }; }, function (e, t, i) { "use strict"; e.exports = r; var n = i(186)._extend; function r() { (this.components = {}), (this.comps = this.components), (this._uid = 1), (this._data = {}), (this._systems = []), (this._renderSystems = []), (this._deferredEntityRemovals = []), (this._deferredCompRemovals = []), (this._deferredMultiCompRemovals = []); } function o(e) { !(function (e) { for (; e._deferredEntityRemovals.length; ) { var t = e._deferredEntityRemovals.pop(); c(e, t); } })(e), u(e), (function (e) { for (; e._deferredMultiCompRemovals.length; ) { var t = e._deferredMultiCompRemovals.pop(); h(e, t.id, t.comp, t.state), (t.state = null); } })(e); } function a(e) { s || ((s = true), setTimeout(function () { o(e), (s = false); }, 0)); } var s = false; function c(e, t) { for (var i = Object.keys(e._data), n = 0; n < i.length; n++) { var r = i[n]; e._data[r].hash[t] && e.removeComponent(t, r, true); } } function u(e) { for (; e._deferredCompRemovals.length; ) { var t = e._deferredCompRemovals.pop(); l(e, t.id, t.comp); } } function l(e, t, i) { var n = e.components[i]; if (n) { var r = e._data[i]; if (r && r.hash[t]) { if (n.onRemove) if (n.multi) r.hash[t].forEach(function (e) { n.onRemove(t, e); }); else n.onRemove(t, r.hash[t]); n.multi && (r.hash[t].length = 0); var o = r.map[t], a = r.list; if (o === a.length - 1) a.pop(); else { a[o] = a.pop(); var s = a[o].__id; r.map[s] = o; } delete r.hash[t], delete r.map[t]; } } } function h(e, t, i, n) { var r = e.components[i]; if (r) { var o = e._data[i]; if (o) { var a = o.hash[t]; if (a) { var s = a.indexOf(n); s < 0 || (r.onRemove && r.onRemove && r.onRemove(t, n), a.splice(s, 1), 0 === a.length && e.removeComponent(t, i, true)); } } } } (r.prototype.createEntity = function (e) { var t = this._uid++; if (e && e.length) for (var i = 0; i < e.length; i++) this.addComponent(t, e[i]); return t; }), (r.prototype.deleteEntity = function (e, t) { return ( t ? c(this, e) : (this._deferredEntityRemovals.push(e), a(this)), this ); }), (r.prototype.createComponent = function (e) { if (!e) throw "Missing component definition"; var t = e.name; if (!t) throw "Component definition must have a name property."; if ("string" != typeof t) throw "Component name must be a string."; if ("" === t) throw "Component name must be a non-empty string."; if (this._data[t]) throw 'Component "' + t + '" already exists.'; var i = {}; return ( (i.name = t), (i.state = e.state || {}), (i.onAdd = e.onAdd || null), (i.onRemove = e.onRemove || null), (i.system = e.system || null), (i.renderSystem = e.renderSystem || null), (i.multi = !!e.multi), (this.components[t] = i), i.system && this._systems.push(t), i.renderSystem && this._renderSystems.push(t), (this._data[t] = { list: [], hash: {}, map: {}, }), t ); }), (r.prototype.deleteComponent = function (e) { var t = this._data[e]; if (!t) throw "Unknown component: " + e + "."; for (var i = t.list; i.length; ) { var n = i[i.length - 1].__id; this.removeComponent(n, e, true); } var r = this._systems.indexOf(e); return ( r > -1 && this._systems.splice(r, 1), (r = this._renderSystems.indexOf(e)) > -1 && this._renderSystems.splice(r, 1), delete this.components[e], delete this._data[e], this ); }), (r.prototype.addComponent = function (e, t, i) { var r = this.components[t], o = this._data[t]; if (!o) throw "Unknown component: " + t + "."; var a = false; if ( (this._deferredCompRemovals.forEach(function (i) { i.id === e && i.comp === t && (a = true); }), a && u(this), o.hash[e] && !r.multi) ) throw "Entity already has component: " + t + "."; var s = {}; if (((s.__id = e), n(s, r.state), n(s, i), (s.__id = e), r.multi)) { var c = o.hash[e]; c || ((c = []), (o.hash[e] = c), o.list.push(c), (o.map[e] = o.list.length - 1)), c.push(s); } else (o.hash[e] = s), o.list.push(s), (o.map[e] = o.list.length - 1); return r.onAdd && r.onAdd(e, s), this; }), (r.prototype.hasComponent = function (e, t) { var i = this._data[t]; if (!i) throw "Unknown component: " + t + "."; return void 0 !== i.hash[e]; }), (r.prototype.removeComponent = function (e, t, i) { var n = this.components[t], r = this._data[t]; if (!r) throw "Unknown component: " + t + "."; if (!r.hash[e]) { if (n.multi) return this; throw "Entity does not have component: " + t + "."; } return ( i ? l(this, e, t) : (this._deferredCompRemovals.push({ id: e, comp: t, }), a(this)), this ); }), (r.prototype.getState = function (e, t) { var i = this._data[t]; if (!i) throw "Unknown component: " + t + "."; return i.hash[e]; }), (r.prototype.getStateAccessor = function (e) { if (!this._data[e]) throw "Unknown component: " + e + "."; var t = this._data[e].hash; return function (e) { return t[e]; }; }), (r.prototype.getComponentAccessor = function (e) { if (!this._data[e]) throw "Unknown component: " + e + "."; var t = this._data[e].hash; return function (e) { return void 0 !== t[e]; }; }), (r.prototype.getStatesList = function (e) { var t = this._data[e]; if (!t) throw "Unknown component: " + e + "."; return t.list; }), (r.prototype.tick = function (e) { o(this); for (var t = this._systems, i = 0; i < t.length; ++i) { var n = t[i], r = this._data[n].list; this.components[n].system(e, r); } return o(this), this; }), (r.prototype.render = function (e) { o(this); for (var t = this._renderSystems, i = 0; i < t.length; ++i) { var n = t[i], r = this._data[n].list; this.components[n].renderSystem(e, r); } return o(this), this; }), (r.prototype.removeMultiComponent = function (e, t, i, n) { var r = this.components[t], o = this._data[t]; if (!o) throw "Unknown component: " + t + "."; if (!r.multi) throw "removeMultiComponent called on non-multi component"; var a = o.hash[e]; if (!a || !a[i]) throw "Multicomponent " + t + " instance not found at index " + i; var s = a[i]; return ( n ? h(this, e, t, s) : this._deferredMultiCompRemovals.push({ id: e, comp: t, state: s, }), this ); }); }, function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); function r(e, t, i, n) { var r = n / 2; (e[0] = t[0] - r), (e[1] = t[1]), (e[2] = t[2] - r), (e[3] = t[0] + r), (e[4] = t[1] + i), (e[5] = t[2] + r); } exp.exports = function (e) { var t = false; return { name: "position", state: { position: null, renderPosition: null, width: 0, height: 0, _extents: null, _extentsChanged: true, }, onAdd: function (e, i) { i.position ? i.position instanceof Float32Array || t || (console.warn( 'Better to set entity positions as instances of "gl-vec3"!' ), (t = true)) : (i.position = vec3Math.create()), (i.renderPosition = vec3Math.create()), vec3Math.copy(i.renderPosition, i.position), (i._extents = new Float32Array(6)); }, onRemove: null, system: function (e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; n._extentsChanged && (r(n._extents, n.position, n.height, n.width), (n._extentsChanged = false)); } }, }; }; }, function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); getterFunc(87); exp.exports = function (e) { var t = vec3Math.create(); return { name: "physics", state: { body: null, interpolatePosition: true, }, onAdd: function (t, i) { i.body = e.physics.addBody(); var n = e.ents.getPositionData(i.__id); e.ents.setEntitySize(i.__id, n.width, n.height, n.width); }, onRemove: function (t, i) { e.physics.removeBody(i.body); }, system: null, renderSystem: function (i, r) { for ( var o = -(e._tickRate - i) / 1e3, a = t, s = 0; s < r.length; ++s ) { var c = r[s], u = c.__id, l = e.ents.getPositionData(u); vec3Math.scaleAndAdd(a, l.position, c.body.velocity, o), c.interpolatePosition && !c.body.autoStep && vec3Math.lerp(a, l.renderPosition, a, 0.5), e.ents.cameraSmoothed(u) && c.body.autoStep && vec3Math.lerp(a, l.renderPosition, a, 0.33), vec3Math.copy(l.renderPosition, a); } }, }; }; }, function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); exp.exports = function (e) { return { name: "followsEntity", state: { entity: 0, offset: null, }, onAdd: function (e, r) { var o = vec3Math.create(); (r.offset = r.offset ? vec3Math.copy(o, r.offset) : o), t(r), i(r); }, onRemove: null, system: function (e, i) { for (var n = 0; n < i.length; n++) t(i[n]); }, renderSystem: function (e, t) { for (var n = 0; n < t.length; n++) i(t[n]); }, }; function t(t) { var i = t.__id, r = e.ents.getPositionData(i), o = e.ents.getPositionData(t.entity); o ? vec3Math.add(r.position, o.position, t.offset) : e.ents.removeComponentLater(i, e.ents.names.followsEntity); } function i(t) { var i = t.__id, r = e.ents.getPositionData(i), o = e.ents.getPositionData(t.entity); o ? vec3Math.add(r.renderPosition, o.renderPosition, t.offset) : e.ents.removeComponentLater(i, e.ents.names.followsEntity); } }; }, function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); exp.exports = function (e) { return { name: "mesh", state: { mesh: null, offset: null, }, onAdd: function (t, i) { if (!i.mesh) throw new Error( "Mesh component added without a mesh - probably a bug!" ); e.rendering.addDynamicMesh(i.mesh), i.offset || (i.offset = new vec3Math.create()); var r = e.ents.getPosition(t), o = i.mesh.position; (o.x = r[0] + i.offset[0]), (o.y = r[1] + i.offset[1]), (o.z = r[2] + i.offset[2]); }, onRemove: function (e, t) { t.mesh.dispose(); }, system: null, renderSystem: function (t, i) { for (var n = 0; n < i.length; ++n) { var r = i[n], o = r.__id, a = e.ents.getPositionData(o).renderPosition, s = a[0] + r.offset[0], c = a[1] + r.offset[1], u = a[2] + r.offset[2]; r.mesh.position.copyFromFloats(s, c, u); } }, }; }; }, function (exp, t, getterFunc) { "use strict"; var vec3Math = getterFunc(16); exp.exports = function (e, t) { t; var i = e.rendering.getScene(), n = BABYLON.Mesh.CreateDisc("shadow", 0.75, 30, i); return ( (n.rotation.x = Math.PI / 2), (n.material = e.rendering.makeStandardMaterial("shadowMat")), (n.material.diffuseColor = BABYLON.Color3.Black()), (n.material.specularColor = BABYLON.Color3.Black()), (n.material.alpha = 0.5), n.setEnabled(false), i.removeMesh(n), { name: "shadow", state: { mesh: null, size: 0.5, }, } ); }; vec3Math.fromValues(0, -1, 0), vec3Math.fromValues(0, 0, 0), vec3Math.fromValues(0, 0, 0); }, function (e, t, i) { "use strict"; e.exports = function (e) { return { name: "collideTerrain", state: { callback: null, }, onAdd: function (t, i) { var n = e.entities; n.hasPhysics(t) && (n.getPhysicsBody(t).onCollide = function (i) { var n = e.ents.getCollideTerrain(t).callback; n && n(i, t); }); }, onRemove: function (t, i) { var n = e.entities; n.hasPhysics(t) && (n.getPhysicsBody(t).onCollide = null); }, system: null, }; }; }, function (e, t, i) { "use strict"; var n = i(483); e.exports = function (e) { return { name: "collideEntities", state: { collideBits: 1, collideMask: 1, callback: null, }, onAdd: null, onRemove: null, system: function (t, i) { for (var r = e.ents, o = [], a = 0; a < i.length; a++) { var s = i[a].__id, c = r.getPositionData(s); o[a] = c._extents; } n(o, function (e, t) { var n = i[e], r = i[t]; n.collideMask & r.collideBits && n.callback && n.callback(r.__id), r.collideMask & n.collideBits && r.callback && r.callback(n.__id); }); }, }; }; }, function (e, t, i) { "use strict"; e.exports = function (e, t, i) { switch (arguments.length) { case 1: return (n = []), u((r = e), r, l, true), n; case 2: return "function" == typeof t ? u(e, e, t, true) : (function (e, t) { return (n = []), u(e, t, l, false), n; })(e, t); case 3: return u(e, t, i, false); default: throw new Error("box-intersect: Invalid arguments"); } var r; }; var n, r = i(125), o = i(192), a = i(486); function s(e, t) { for (var i = 0; i < e; ++i) if (!(t[i] <= t[i + e])) return true; return false; } function c(e, t, i, n) { for (var r = 0, o = 0, a = 0, c = e.length; a < c; ++a) { var u = e[a]; if (!s(t, u)) { for (var l = 0; l < 2 * t; ++l) i[r++] = u[l]; n[o++] = a; } } return o; } function u(e, t, i, n) { var s = e.length, u = t.length; if (!(s <= 0 || u <= 0)) { var l = e[0].length >>> 1; if (!(l <= 0)) { var h, f = r.mallocDouble(2 * l * s), d = r.mallocInt32(s); if ((s = c(e, l, f, d)) > 0) { if (1 === l && n) o.init(s), (h = o.sweepComplete(l, i, 0, s, f, d, 0, s, f, d)); else { var p = r.mallocDouble(2 * l * u), m = r.mallocInt32(u); (u = c(t, l, p, m)) > 0 && (o.init(s + u), (h = 1 === l ? o.sweepBipartite(l, i, 0, s, f, d, 0, u, p, m) : a(l, i, n, s, f, d, u, p, m)), r.free(p), r.free(m)); } r.free(f), r.free(d); } return h; } } } function l(e, t) { n.push([e, t]); } }, function (e, t, i) { "use strict"; function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } e.exports = function (e, t) { switch ((void 0 === t && (t = 0), n(e))) { case "number": if (e > 0) return (function (e, t) { var i, n; for (i = new Array(e), n = 0; n < e; ++n) i[n] = t; return i; })(0 | e, t); break; case "object": if ("number" == typeof e.length) return (function e(t, i, n) { var r = 0 | t[n]; if (r <= 0) return []; var o, a = new Array(r); if (n === t.length - 1) for (o = 0; o < r; ++o) a[o] = i; else for (o = 0; o < r; ++o) a[o] = e(t, i, n + 1); return a; })(e, t, 0); } return []; }; }, function (e, t, i) { "use strict"; e.exports = function (e, t) { t <= 4 * n ? r(0, t - 1, e) : (function e(t, i, h) { var f = ((i - t + 1) / 6) | 0, d = t + f, p = i - f, m = (t + i) >> 1, g = m - f, _ = m + f, v = d, y = g, b = m, E = _, T = p, A = t + 1, x = i - 1, S = 0; u(v, y, h) && ((S = v), (v = y), (y = S)); u(E, T, h) && ((S = E), (E = T), (T = S)); u(v, b, h) && ((S = v), (v = b), (b = S)); u(y, b, h) && ((S = y), (y = b), (b = S)); u(v, E, h) && ((S = v), (v = E), (E = S)); u(b, E, h) && ((S = b), (b = E), (E = S)); u(y, T, h) && ((S = y), (y = T), (T = S)); u(y, b, h) && ((S = y), (y = b), (b = S)); u(E, T, h) && ((S = E), (E = T), (T = S)); var C = h[2 * y]; var P = h[2 * y + 1]; var R = h[2 * E]; var M = h[2 * E + 1]; var O = 2 * v; var w = 2 * b; var I = 2 * T; var D = 2 * d; var L = 2 * m; var F = 2 * p; for (var B = 0; B < 2; ++B) { var N = h[O + B], k = h[w + B], U = h[I + B]; (h[D + B] = N), (h[L + B] = k), (h[F + B] = U); } a(g, t, h); a(_, i, h); for (var V = A; V <= x; ++V) if (l(V, C, P, h)) V !== A && o(V, A, h), ++A; else if (!l(V, R, M, h)) for (;;) { if (l(x, R, M, h)) { l(x, C, P, h) ? (s(V, A, x, h), ++A, --x) : (o(V, x, h), --x); break; } if (--x < V) break; } c(t, A - 1, C, P, h); c(i, x + 1, R, M, h); A - 2 - t <= n ? r(t, A - 2, h) : e(t, A - 2, h); i - (x + 2) <= n ? r(x + 2, i, h) : e(x + 2, i, h); x - A <= n ? r(A, x, h) : e(A, x, h); })(0, t - 1, e); }; var n = 32; function r(e, t, i) { for (var n = 2 * (e + 1), r = e + 1; r <= t; ++r) { for (var o = i[n++], a = i[n++], s = r, c = n - 2; s-- > e; ) { var u = i[c - 2], l = i[c - 1]; if (u < o) break; if (u === o && l < a) break; (i[c] = u), (i[c + 1] = l), (c -= 2); } (i[c] = o), (i[c + 1] = a); } } function o(e, t, i) { t *= 2; var n = i[(e *= 2)], r = i[e + 1]; (i[e] = i[t]), (i[e + 1] = i[t + 1]), (i[t] = n), (i[t + 1] = r); } function a(e, t, i) { (t *= 2), (i[(e *= 2)] = i[t]), (i[e + 1] = i[t + 1]); } function s(e, t, i, n) { (t *= 2), (i *= 2); var r = n[(e *= 2)], o = n[e + 1]; (n[e] = n[t]), (n[e + 1] = n[t + 1]), (n[t] = n[i]), (n[t + 1] = n[i + 1]), (n[i] = r), (n[i + 1] = o); } function c(e, t, i, n, r) { (t *= 2), (r[(e *= 2)] = r[t]), (r[t] = i), (r[e + 1] = r[t + 1]), (r[t + 1] = n); } function u(e, t, i) { t *= 2; var n = i[(e *= 2)], r = i[t]; return !(n < r) && (n !== r || i[e + 1] > i[t + 1]); } function l(e, t, i, n) { var r = n[(e *= 2)]; return r < t || (r === t && n[e + 1] < i); } }, function (e, t, i) { "use strict"; e.exports = function (e, t, i, o, l, P, R, M, O) { !(function (e, t) { var i = (8 * r.log2(t + 1) * (e + 1)) | 0, o = r.nextPow2(b * i); T.length < o && (n.free(T), (T = n.mallocInt32(o))); var a = r.nextPow2(E * i); A < a && (n.free(A), (A = n.mallocDouble(a))); })(e, o + R); var w, I = 0, D = 2 * e; x(I++, 0, 0, o, 0, R, i ? 16 : 0, -1 / 0, 1 / 0), i || x(I++, 0, 0, R, 0, o, 1, -1 / 0, 1 / 0); for (; I > 0; ) { var L = (I -= 1) * b, F = T[L], B = T[L + 1], N = T[L + 2], k = T[L + 3], U = T[L + 4], V = T[L + 5], G = I * E, z = A[G], j = A[G + 1], H = 1 & V, W = !!(16 & V), X = l, Y = P, K = M, Q = O; if ( (H && ((X = M), (Y = O), (K = l), (Q = P)), !( (2 & V && ((N = g(e, F, B, N, X, Y, j)), B >= N)) || (4 & V && (B = _(e, F, B, N, X, Y, z)) >= N) )) ) { var q = N - B, Z = U - k; if (W) { if (e * q * (q + Z) < d) { if ( void 0 !== (w = c.scanComplete(e, F, t, B, N, X, Y, k, U, K, Q)) ) return w; continue; } } else { if (e * Math.min(q, Z) < h) { if (void 0 !== (w = a(e, F, t, H, B, N, X, Y, k, U, K, Q))) return w; continue; } if (e * q * Z < f) { if ( void 0 !== (w = c.scanBipartite(e, F, t, H, B, N, X, Y, k, U, K, Q)) ) return w; continue; } } var J = p(e, F, B, N, X, Y, z, j); if (B < J) if (e * (J - B) < h) { if (void 0 !== (w = s(e, F + 1, t, B, J, X, Y, k, U, K, Q))) return w; } else if (F === e - 2) { if ( void 0 !== (w = H ? c.sweepBipartite(e, t, k, U, K, Q, B, J, X, Y) : c.sweepBipartite(e, t, B, J, X, Y, k, U, K, Q)) ) return w; } else x(I++, F + 1, B, J, k, U, H, -1 / 0, 1 / 0), x(I++, F + 1, k, U, B, J, 1 ^ H, -1 / 0, 1 / 0); if (J < N) { var $ = u(e, F, k, U, K, Q), ee = K[D * $ + F], te = m(e, F, $, U, K, Q, ee); if ( (te < U && x(I++, F, J, N, te, U, (4 | H) + (W ? 16 : 0), ee, j), k < $ && x(I++, F, J, N, k, $, (2 | H) + (W ? 16 : 0), z, ee), $ + 1 === te) ) { if ( void 0 !== (w = W ? C(e, F, t, J, N, X, Y, $, K, Q[$]) : S(e, F, t, H, J, N, X, Y, $, K, Q[$])) ) return w; } else if ($ < te) { var ie; if (W) { if (((ie = v(e, F, J, N, X, Y, ee)), J < ie)) { var ne = m(e, F, J, ie, X, Y, ee); if (F === e - 2) { if ( J < ne && void 0 !== (w = c.sweepComplete(e, t, J, ne, X, Y, $, te, K, Q)) ) return w; if ( ne < ie && void 0 !== (w = c.sweepBipartite(e, t, ne, ie, X, Y, $, te, K, Q)) ) return w; } else J < ne && x(I++, F + 1, J, ne, $, te, 16, -1 / 0, 1 / 0), ne < ie && (x(I++, F + 1, ne, ie, $, te, 0, -1 / 0, 1 / 0), x(I++, F + 1, $, te, ne, ie, 1, -1 / 0, 1 / 0)); } } else (ie = H ? y(e, F, J, N, X, Y, ee) : v(e, F, J, N, X, Y, ee)), J < ie && (F === e - 2 ? (w = H ? c.sweepBipartite(e, t, $, te, K, Q, J, ie, X, Y) : c.sweepBipartite(e, t, J, ie, X, Y, $, te, K, Q)) : (x(I++, F + 1, J, ie, $, te, H, -1 / 0, 1 / 0), x(I++, F + 1, $, te, J, ie, 1 ^ H, -1 / 0, 1 / 0))); } } } } }; var n = i(125), r = i(126), o = i(487), a = o.partial, s = o.full, c = i(192), u = i(488), l = i(193), h = 128, f = 1 << 22, d = 1 << 22, p = l("!(lo>=p0)&&!(p1>=hi)", ["p0", "p1"]), m = l("lo===p0", ["p0"]), g = l("lo" + p + "-" + d + "){"), e ? (A(true, false), T.push("}else{"), A(false, false)) : (T.push("if(" + a + "){"), A(true, true), T.push("}else{"), A(true, false), T.push("}}else{if(" + a + "){"), A(false, true), T.push("}else{"), A(false, false), T.push("}")), T.push("}}return " + t); var x = i.join("") + T.join(""); return new Function(x)(); } (t.partial = E(false)), (t.full = E(true)); }, function (e, t, i) { "use strict"; e.exports = function (e, t, i, a, s, c) { if (a <= i + 1) return i; var u = i, l = a, h = (a + i) >>> 1, f = 2 * e, d = h, p = s[f * h + t]; for (; u < l; ) { if (l - u < r) { o(e, t, u, l, s, c), (p = s[f * h + t]); break; } var m = l - u, g = (Math.random() * m + u) | 0, _ = s[f * g + t], v = (Math.random() * m + u) | 0, y = s[f * v + t], b = (Math.random() * m + u) | 0, E = s[f * b + t]; _ <= y ? E >= y ? ((d = v), (p = y)) : _ >= E ? ((d = g), (p = _)) : ((d = b), (p = E)) : y >= E ? ((d = v), (p = y)) : E >= _ ? ((d = g), (p = _)) : ((d = b), (p = E)); for (var T = f * (l - 1), A = f * d, x = 0; x < f; ++x, ++T, ++A) { var S = s[T]; (s[T] = s[A]), (s[A] = S); } var C = c[l - 1]; (c[l - 1] = c[d]), (c[d] = C), (d = n(e, t, u, l - 1, s, c, p)); for (var T = f * (l - 1), A = f * d, x = 0; x < f; ++x, ++T, ++A) { var S = s[T]; (s[T] = s[A]), (s[A] = S); } var C = c[l - 1]; if (((c[l - 1] = c[d]), (c[d] = C), h < d)) { for (l = d - 1; u < l && s[f * (l - 1) + t] === p; ) l -= 1; l += 1; } else { if (!(d < h)) break; for (u = d + 1; u < l && s[f * u + t] === p; ) u += 1; } } return n(e, t, i, h, s, c, s[f * h + t]); }; var n = i(193)("lo i && r[h + t] > u; --l, h -= a ) { for (var f = h, d = h + a, p = 0; p < a; ++p, ++f, ++d) { var m = r[f]; (r[f] = r[d]), (r[d] = m); } var g = o[l]; (o[l] = o[l - 1]), (o[l - 1] = g); } } }, function (e, t, i) { "use strict"; e.exports = function (e) { return { name: "every", state: { every: 100, callback: null, _ct: 0, }, onAdd: null, onRemove: null, system: function (e, t) { for (var i = 0; i < t.length; i++) { var n = t[i]; (n._ct += e), n._ct > n.every && (n.callback(n.every), (n._ct -= n.every)); } }, }; }; }, function (e, t, i) { "use strict"; e.exports = function (e) { return { name: "smooth-camera", state: { time: 100.1, }, onAdd: null, onRemove: null, system: function (t, i) { for (var n = 0; n < i.length; ++n) { var r = i[n]; (r.time -= t), r.time < 0 && e.ents.removeComponentLater(r.__id, "smooth-camera"); } }, }; }; }, function (exp, moveProperties, getterFunc) { "use strict"; var vec3Math = getterFunc(16); exp.exports = function (e) { return { name: "movement", state: { heading: 0, running: false, jumping: false, maxSpeed: 6, moveForce: 30, responsiveness: 15, runningFriction: 0, standingFriction: 50, airMoveMult: 0.5, jumpImpulse: 11, jumpForce: 6.5, jumpTime: 500, airJumps: 1, _jumpCount: 0, _isJumping: 0, _currjumptime: 0, }, onAdd: null, onRemove: null, system: function (t, i) { for (var curEntity = e.entities, j = 0; j < i.length; j++) { var moveProperties = i[j]; jump( t, moveProperties, curEntity.getPhysicsBody(moveProperties.__id) ); } }, }; }; var mathObj0 = vec3Math.create(); var mathObj1 = vec3Math.create(); var mathObj2 = vec3Math.create(); function jump(unused_var, moveProperties, physicsBody) { var blockIdAtFoot = noa.world.getBlockID( Math.floor(physicsBody.aabb.base[0]), Math.floor(physicsBody.aabb.base[1]), Math.floor(physicsBody.aabb.base[2]) ); // block at [0, .5, 0] from feet var blockIdAtLegs = noa.world.getBlockID( Math.floor(physicsBody.aabb.base[0]), Math.floor(physicsBody.aabb.base[1] + 0.5), Math.floor(physicsBody.aabb.base[2]) ); var inWater = false; var inLava = false; var waterId = 7; var lavaId = 17; var waterHackId = 41; var atRestY = physicsBody.atRestY() < 0; var canJump = atRestY || moveProperties._jumpCount < moveProperties.airJumps; physicsBody.autoStep = false; physicsBody.gravityMultiplier = 4.2; // if feet and legs are in water set inWater to true inWater = !( blockIdAtFoot != waterId && blockIdAtFoot != waterHackId && blockIdAtLegs != waterId && blockIdAtLegs != waterHackId ); inLava = blockIdAtFoot == lavaId; physicsBody.autoStep = (inWater || inLava) && blockIdAtLegs == 0; if (inWater) physicsBody.gravityMultiplier = 2.1; if (inLava) physicsBody.gravityMultiplier = 1.05; if ((atRestY && !moveProperties.jumping) || inWater || inLava) { moveProperties._isJumping = false; moveProperties._jumpCount = 0; } else if (moveProperties._isJumping) { if (moveProperties._currjumptime > 0) { var jumpForce = moveProperties.jumpForce; if (moveProperties._currjumptime < unused_var) { jumpForce *= moveProperties._currjumptime / unused_var; } physicsBody.applyForce([0, jumpForce, 0]); moveProperties._currjumptime -= unused_var; } } else { if (canJump) { moveProperties._isJumping = true; if (atRestY) moveProperties._jumpCount++; moveProperties._currjumptime = moveProperties.jumpTime; physicsBody.applyImpulse([0, moveProperties.jumpImpulse, 0]); if (!atRestY && physicsBody.velocity[1] < 0) physicsBody.velocity[1] = 0; } } if (moveProperties.jumpWasPressed) { if (inWater) physicsBody.applyForce([0, 3 * moveProperties.maxSpeed, 0]); if (inLava) physicsBody.applyForce([0, 1.5 * moveProperties.maxSpeed, 0]); } var mo0 = mathObj0; var mo1 = mathObj1; if (moveProperties.running) { var maxMovSpeed = moveProperties.maxSpeed; if (inWater) maxMovSpeed *= 0.5; if (inLava) maxMovSpeed *= 0.25; vec3Math.set(mo0, 0, 0, maxMovSpeed); vec3Math.rotateY(mo0, mo0, mathObj2, moveProperties.heading); vec3Math.subtract(mo1, mo0, physicsBody.velocity); mo1[1] = 0; var mo1Length = vec3Math.length(mo1); vec3Math.normalize(mo1, mo1); if (mo1Length > 0) { var moveForce = moveProperties.moveForce; if (atRestY) moveForce *= moveProperties.airMoveMult; var y = moveProperties.responsiveness * mo1Length; if (moveForce > y) moveForce = y; vec3Math.scale(mo1, mo1, moveForce); physicsBody.applyForce(mo1); } physicsBody.friction = moveProperties.runningFriction; } else physicsBody.friction = moveProperties.standingFriction; var bodyPos = physicsBody.getPosition(); if (bodyPos[0] <= 0.2) { physicsBody.setPosition([0.2, bodyPos[1], bodyPos[2]]); physicsBody.velocity[0] = 0; } if (bodyPos[0] >= noa.worldSize - 1 - 0.8) { physicsBody.setPosition([ noa.worldSize - 1 - 0.8, bodyPos[1], bodyPos[2], ]); physicsBody.velocity[0] = 0; } bodyPos = physicsBody.getPosition(); if (bodyPos[2] <= 0.2) { physicsBody.setPosition([bodyPos[0], bodyPos[1], 0.2]); physicsBody.velocity[2] = 0; } if (bodyPos[2] >= noa.worldSize - 1 - 0.8) { physicsBody.setPosition([ bodyPos[0], bodyPos[1], noa.worldSize - 1 - 0.8, ]); physicsBody.velocity[2] = 0; } if (bodyPos[1] <= 0) { physicsBody.setPosition([bodyPos[0], 0, bodyPos[2]]); physicsBody.velocity[1] = 0; } } }, function (e, t, i) { "use strict"; function n(e, t, i) { (e.jumping = !!t.jump), e.jumping && e.jumpWasPressed && (e.jumping = false), (e.jumpWasPressed = !!t.jump); var n = t.forward ? (t.backward ? 0 : 1) : t.backward ? -1 : 0, r = t.right ? (t.left ? 0 : 1) : t.left ? -1 : 0; 0 == (n | r) ? (e.running = false) : ((e.running = true), n ? (-1 == n && (i += Math.PI), r && (i += (Math.PI / 4) * n * r)) : (i += (r * Math.PI) / 2), (e.heading = i)); } e.exports = function (e) { return { name: "receivesInputs", state: {}, onAdd: null, onRemove: null, system: function (t, i) { for ( var r = e.entities, o = e.inputs.state, a = e.rendering.getCameraRotation()[1], s = 0; s < i.length; s++ ) { n(r.getMovement(i[s].__id), o, a); } }, }; }; }, function (e, t, i) { "use strict"; function n(e, t, i, n) { n.hasMesh(t) && ((e._showing && i < e.cutoff) || (!e._showing && i > e.cutoff)) && (n.getMeshData(t).mesh.visibility = e._showing = i > e.cutoff); } e.exports = function (e) { return { name: "fadeOnZoom", state: { cutoff: 1.5, _showing: true, }, onAdd: null, onRemove: null, system: function (t, i) { for ( var r = e.rendering._currentZoom, o = e.entities, a = 0; a < i.length; a++ ) { var s = i[a]; n(s, s.__id, r, o); } }, }; }; }, function (e, t, i) { "use strict"; e.exports = function (e, t, i, n, r, o) { var a = +t[0], s = +t[1], c = +t[2], u = +i[0], l = +i[1], h = +i[2], f = Math.sqrt(u * u + l * l + h * h); if (0 === f) throw new Error("Can't raycast along a zero vector"); return (function (e, t, i, n, r, o, a, s, c, u) { for ( var l = 0, h = Math.floor, f = 0 | h(t), d = 0 | h(i), p = 0 | h(n), m = r > 0 ? 1 : -1, g = o > 0 ? 1 : -1, _ = a > 0 ? 1 : -1, v = Math.abs(1 / r), y = Math.abs(1 / o), b = Math.abs(1 / a), E = v < 1 / 0 ? v * (m > 0 ? f + 1 - t : t - f) : 1 / 0, T = y < 1 / 0 ? y * (g > 0 ? d + 1 - i : i - d) : 1 / 0, A = b < 1 / 0 ? b * (_ > 0 ? p + 1 - n : n - p) : 1 / 0, x = -1; l <= s; ) { var S = e(f, d, p); if (S) return ( c && ((c[0] = t + l * r), (c[1] = i + l * o), (c[2] = n + l * a)), u && ((u[0] = u[1] = u[2] = 0), 0 === x && (u[0] = -m), 1 === x && (u[1] = -g), 2 === x && (u[2] = -_)), S ); E < T ? E < A ? ((f += m), (l = E), (E += v), (x = 0)) : ((p += _), (l = A), (A += b), (x = 2)) : T < A ? ((d += g), (l = T), (T += y), (x = 1)) : ((p += _), (l = A), (A += b), (x = 2)); } return ( c && ((c[0] = t + l * r), (c[1] = i + l * o), (c[2] = n + l * a)), u && (u[0] = u[1] = u[2] = 0), 0 ); })( e, a, s, c, (u /= f), (l /= f), (h /= f), (n = void 0 === n ? 64 : +n), r, o ); }; }, function (e, t, i) { "use strict"; var n = i(496); e.exports = function (e) { return (function (e) { var t = e.rendering.getScene(), i = new BABYLON.Texture( "assets/textures/grass_dirt.png", t, true, false, BABYLON.Constants.TEXTURE_NEAREST_NEAREST_MIPNEAREST ), o = (new BABYLON.Texture("assets/textures/grass.png", t, true, false), {}); return ( (o.debris = { cap: 64, g: -10, emit: 32, rate: 0, tex: i, alphas: [1, 1], colors: [r.White(), r.White()], sizes: [1, 1], init: function (e) { (e.position.x = 0.8 * Math.random() - 0.4), (e.position.y = 0.8 * Math.random() - 0.4), (e.position.z = 0.8 * Math.random() - 0.4), (e.velocity.x = 4 * Math.random() - 2), (e.velocity.y = 4 * Math.random()), (e.velocity.z = 4 * Math.random() - 2), (e.size = 0.05 + 0.15 * Math.random()), (e.age = 1.5 * Math.random()), (e.lifetime = 2); }, }), function (i, a, s) { var c = o[i]; if (c) { Math.random(), Math.random(); var u = new r(s, s, s), l = new n(c.cap, c.rate, t, u, [0, 1], [0, 1], e); return ( (l.gravity = c.g), l.setAlphaRange(c.alphas[0], c.alphas[1]), l.setColorRange(c.colors[0], c.colors[1]), l.setSizeRange(c.sizes[0], c.sizes[1]), (l.initParticle = c.init), (l.stopOnEmpty = true), l.setTexture(a), c.emit && (l.emit(c.emit), (l.disposeOnEmpty = true)), e.rendering.addDynamicMesh(l.mesh), l ); } } ); })(e); }; BABYLON.Vector3; var r = BABYLON.Color3; }, function (e, t) { e.exports = a; var i = BABYLON.Vector3, n = BABYLON.Color3; function r() { (this.position = i.Zero()), (this.velocity = i.Zero()), (this.size = 1), (this.age = 0), (this.lifetime = 1); } function o(e) { e.position.copyFromFloats(0, 0, 0), (e.velocity.x = 5 * (Math.random() - 0.5)), (e.velocity.y = 0.5 * Math.random() * 5 + 2), (e.velocity.z = 5 * (Math.random() - 0.5)), (e.size = 1 * Math.random()), (e.age = 0), (e.lifetime = 2); } function a(e, t, n, a, s, u, l) { if ((e || (e = 100), isNaN(t) && (t = 0), !n)) throw "Invalid scene passed to mesh-particle-system"; (a = a || { r: 1, g: 1, b: 1, a: 1, }), (s = s || [0, 1]), (u = u || [0, 1]), (this.capacity = e), (this.rate = t), (this.mesh = new BABYLON.Mesh("MPS-mesh", n)), (this.material = null), (this.texture = null), (this.gravity = -1), (this.friction = 0.85), (this.fps = 60), (this.disposeOnEmpty = false), (this.stopOnEmpty = false), (this.parent = null), (this.onDispose = null), (this.game = l), (this._scene = n), (this._alive = 0), (this._data = new Float32Array(e * c)), (this._dummyParticle = new r()), (this._color0 = new BABYLON.Color4(a.r, a.g, a.b, a.a)), (this._color1 = new BABYLON.Color4(a.r, a.g, a.b, a.a)), (this._updateColors = false), (this._size0 = 1), (this._size1 = 1), (this._positions = []), (this._colors = []), (this._playing = false), (this._disposed = false), (this._lastPos = i.Zero()), (this._startingThisFrame = false), (this._toEmit = 0), (this._createdOwnMaterial = false), (this._needsColorUpdate = true); for ( var h = this._positions, f = this._colors, d = [], p = [], m = (s[0], u[1], s[1], u[1], s[1], u[0], s[0], u[0], 0); m < e; m++ ) { h.push(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), d.push(4 * m, 4 * m + 1, 4 * m + 2), d.push(4 * m, 4 * m + 2, 4 * m + 3); var g = (1 / 16) * Math.floor(12 * Math.random()), _ = g + 0.25; p.push(_, g, g, g, g, _, _, _); for (var v = 0; v < 4; v++) f.push(a.r, a.g, a.b, a.a); } var y = new BABYLON.VertexData(); (y.positions = h), (y.indices = d), (y.uvs = p), (y.colors = f), y.applyToMesh(this.mesh, true), (this.initParticle = o); var b = this; this.curriedAnimate = function () { b.animate(0.001 * b._scene.getEngine().getDeltaTime()); }; } var s = a; (s.prototype.start = function () { if (!this._playing) { if (this._disposed) throw new Error("Already disposed"); this._scene.registerBeforeRender(this.curriedAnimate), (function (e) { for ( var t = e._dummyParticle, n = 0, r = new i(1 / 0, 1 / 0, 1 / 0), o = new i(-1 / 0, -1 / 0, -1 / 0), a = e.gravity / 2, s = 0; s < 30; ++s ) { e.initParticle(t), l(r, o, t.position.x, t.position.y, t.position.z); var c = t.lifetime, u = t.position.x + c * t.velocity.x, h = t.position.y + c * t.velocity.y + c * c * a, f = t.position.z + c * t.velocity.z; l(r, o, u, h, f), (n = Math.max(n, t.size)); } r.subtractFromFloatsToRef(n, n, n, r), o.subtractFromFloatsToRef(-n, -n, -n, o), (e.mesh._boundingInfo = new BABYLON.BoundingInfo(r, o)); })(this), (this._playing = true), (this._startingThisFrame = true); } }), (s.prototype.stop = function () { this._playing && (this._scene.unregisterBeforeRender(this.curriedAnimate), (this._playing = false)); }), (s.prototype.setTexture = function (e, t) { t ? (this.material && this._createdOwnMaterial && this.material.dispose(false, false), (this.material = t), (this._createdOwnMaterial = false)) : this.material || ((this.material = new BABYLON.StandardMaterial( "MPS-mat", this._scene )), (this.material.specularColor = n.Black()), (this.material.emissiveColor = n.White()), (this.material.checkReadyOnlyOnce = true), (this._createdOwnMaterial = true)), (this.mesh.material = this.material), (this.texture = e), (this._needsColorUpdate = true); }), (s.prototype.setAlphaRange = function (e, t) { (this._color0.a = e), (this._color1.a = t), (this._needsColorUpdate = true); }), (s.prototype.setColorRange = function (e, t) { (this._color0.r = e.r), (this._color0.g = e.g), (this._color0.b = e.b), (this._color1.r = t.r), (this._color1.g = t.g), (this._color1.b = t.b), (this._needsColorUpdate = true); }), (s.prototype.setSizeRange = function (e, t) { (this._size0 = e), (this._size1 = t); }), (s.prototype.emit = function (e) { this.start(), (this._toEmit += e); }), (s.prototype.dispose = function () { this.onDispose && this.onDispose(), (function (e) { e.stop(), e._createdOwnMaterial && ((e.material.ambientTexture = null), (e.material.opacityTexture = null), (e.material.diffuseTexture = null), e.material.dispose(false, false)); (e.material = null), e.mesh.geometry.dispose(), e.mesh.dispose(), (e.mesh = null), (e.texture = null), (e.curriedAnimate = null), (e.initParticle = null), (e._scene = null), (e._dummyParticle = null), (e._color0 = null), (e._color1 = null), (e._data = null), (e._positions.length = 0), (e._colors.length = 0), (e._positions = null), (e._colors = null), (e.parent = null), (e._disposed = true); })(this); }); var c = 9; function u(e, t) { return Math.abs(e - t) < 1e-5; } function l(e, t, i, n, r) { i < e.x ? (e.x = i) : i > t.x && (t.x = i), n < e.y ? (e.y = n) : n > t.y && (t.y = n), r < e.z ? (e.z = r) : r > t.z && (t.z = r); } function h(e) { var t = e._dummyParticle; e.initParticle(t); var i = e._data, n = e._alive * c; (i[n] = t.position.x), (i[n + 1] = t.position.y), (i[n + 2] = t.position.z), (i[n + 3] = t.velocity.x), (i[n + 4] = t.velocity.y), (i[n + 5] = t.velocity.z), (i[n + 6] = t.size), (i[n + 7] = t.age), (i[n + 8] = t.lifetime), (e._alive += 1); } function f(e, t) { for ( var i = e._data, n = (e._alive - 1) * c, r = t * c, o = 0; o < c; ++o ) i[r + o] = i[n + o]; e._alive -= 1; } function d(e) { return ( 0 != e && 7 != e && 17 != e && 40 != e && 41 != e && 5 != e && 6 != e && 8 != e && 15 != e && 16 != e ); } s.prototype.animate = function (e) { this && this._needsColorUpdate && (function (e) { e._needsColorUpdate = false; var t = e._color0, i = e._color1, r = !(u(t.a, 1) && u(t.a, i.a)), o = !(u(t.r, i.r) && u(t.g, i.g) && u(t.b, i.b)); (e._updateColors = r || o), (e.mesh.hasVertexAlpha = r), e.material && (o || r ? ((e.material.diffuseTexture = null), (e.material.ambientTexture = e.texture), (e.material.opacityTexture = e.texture), (e.material.diffuseColor = n.White()), (e.material.useAlphaFromDiffuseTexture = true), e.texture && (e.texture.hasAlpha = false)) : ((e.material.diffuseTexture = e.texture), (e.material.ambientTexture = null), (e.material.opacityTexture = null), (e.material.diffuseColor = new n(t.r, t.g, t.b)), (e.material.useAlphaFromDiffuseTexture = false), e.texture && (e.texture.hasAlpha = true))); })(this), e > 0.1 && (e = 0.1), (function (e) { if (e.parent) { var t = e.parent.absolutePosition; e._startingThisFrame && ((t = e.parent.getAbsolutePosition()), (e._startingThisFrame = false)), e.mesh.position.copyFrom(t); } var i = e.mesh.position.x - e._lastPos.x, n = e.mesh.position.y - e._lastPos.y, r = e.mesh.position.z - e._lastPos.z; if ( (e._lastPos.copyFrom(e.mesh.position), Math.abs(i) + Math.abs(n) + Math.abs(r) < 0.001) ) return; for (var o = e._alive, a = e._data, s = 0; s < o; s++) { var u = s * c; (a[u] -= i), (a[u + 1] -= n), (a[u + 2] -= r); } })(this), (function (e, t) { e._toEmit += t; var i = Math.floor(e._toEmit); e._toEmit -= i; var n = e._alive + i; n > e.capacity && (n = e.capacity); for (; e._alive < n; ) h(e); })(this, this.rate * e), (function (e, t) { for ( var i = e.gravity * t, n = e._data, r = e.friction, o = 0, a = e.mesh.position, s = 0; s < e._alive; ++s ) { (n[o + 4] += i), (n[o] += n[o + 3] * t), (n[o + 1] += n[o + 4] * t), (n[o + 2] += n[o + 5] * t); var u = a.x + n[o], l = a.y + n[o + 1], h = a.z + n[o + 2], p = 0.5 * n[o + 6]; if (n[o + 4] > 0) { var m = e.game.world.getBlockID( Math.floor(u), Math.floor(l + p), Math.floor(h) ); d(m) && ((n[o + 1] -= n[o + 4] * t), (n[o + 4] = 0)); } if (n[o + 4] < 0) { var m = e.game.world.getBlockID( Math.floor(u), Math.floor(l - p), Math.floor(h) ); d(m) && ((n[o + 1] -= n[o + 4] * t), (n[o + 4] = 0)); } if (n[o + 3] > 0) { var m = e.game.world.getBlockID( Math.floor(u + p), Math.floor(l), Math.floor(h) ); d(m) && ((n[o + 0] -= n[o + 3] * t), (n[o + 3] = 0)); } if (n[o + 3] < 0) { var m = e.game.world.getBlockID( Math.floor(u - p), Math.floor(l), Math.floor(h) ); d(m) && ((n[o + 0] -= n[o + 3] * t), (n[o + 3] = 0)); } if (n[o + 5] > 0) { var m = e.game.world.getBlockID( Math.floor(u), Math.floor(l), Math.floor(h + p) ); d(m) && ((n[o + 2] -= n[o + 5] * t), (n[o + 5] = 0)); } if (n[o + 5] < 0) { var m = e.game.world.getBlockID( Math.floor(u), Math.floor(l), Math.floor(h - p) ); d(m) && ((n[o + 2] -= n[o + 5] * t), (n[o + 5] = 0)); } 0 == n[o + 4] && ((n[o + 3] *= r), (n[o + 4] *= r), (n[o + 5] *= r)); var g = n[o + 7] + t; g > n[o + 8] ? (f(e, s), s--) : ((n[o + 7] = g), (o += c)); } })(this, e), (function (e) { var t = e._positions, n = e._data, r = e._scene.activeCamera, o = BABYLON.Matrix.Identity(); BABYLON.Matrix.LookAtLHToRef( r.globalPosition, e.mesh.position, i.Up(), o ), (o.m[12] = o.m[13] = o.m[14] = 0), o.invert(); for ( var a = o.m, s = e._alive, u = e._size0, l = e._size1 - u, h = 0; h < s; h++ ) for ( var f = h * c, d = n[f + 7] / n[f + 8], p = (n[f + 6] * (u + l * d)) / 2, m = 12 * h, g = 0; g < 4; g++ ) { var _ = 1 === g || 2 === g ? p : -p, v = g > 1 ? p : -p, y = _ * a[3] + v * a[7] + a[15]; (t[m] = n[f] + (_ * a[0] + v * a[4]) / y), (t[m + 1] = n[f + 1] + (_ * a[1] + v * a[5]) / y), (t[m + 2] = n[f + 2] + (_ * a[2] + v * a[6]) / y), (m += 3); } e.mesh.updateVerticesData( BABYLON.VertexBuffer.PositionKind, t, false, false ); })(this), this._updateColors && (function (e) { for ( var t = e._alive, i = e._data, n = e._colors, r = e._color0.r, o = e._color0.g, a = e._color0.b, s = e._color0.a, u = e._color1.r - r, l = e._color1.g - o, h = e._color1.b - a, f = e._color1.a - s, d = 0; d < t; d++ ) for ( var p = d * c, m = i[p + 7] / i[p + 8], g = r + u * m, _ = o + l * m, v = a + h * m, y = s + f * m, b = 16 * d, E = 0; E < 4; E++ ) (n[b] = g), (n[b + 1] = _), (n[b + 2] = v), (n[b + 3] = y), (b += 4); e.mesh.updateVerticesData( BABYLON.VertexBuffer.ColorKind, n, false, false ); })(this), (this.mesh.subMeshes[0].indexCount = 6 * this._alive), 0 === this._alive && 0 === this.rate && (this.disposeOnEmpty ? this.dispose() : this.stopOnEmpty && this.stop()); }; }, function (e, t, i) { "use strict"; var n = i(498), r = n.Howl; n.Howler; e.exports = function () { return (function () { for ( var e = "assets/sounds/", t = [ "grass1", "grass2", "grass3", "grass4", "gravel1", "gravel2", "gravel3", "gravel4", "stone1", "stone2", "stone3", "stone4", "wood1", "wood2", "wood3", "wood4", "calm1", "calm2", "calm3", ], i = null, n = { grass: { file: "grass", volume: 0.6, pitch: 1, }, cloth: { file: "grass", volume: 0.7, pitch: 1.2, }, gravel: { file: "gravel", volume: 1, pitch: 1, }, stone: { file: "stone", volume: 1, pitch: 1, }, metal: { file: "stone", volume: 1, pitch: 2, }, wood: { file: "wood", volume: 1, pitch: 1, }, }, o = {}, a = 0; a < t.length; a++ ) { var s = new r({ src: [e + t[a] + ".mp3", e + t[a] + ".ogg"], }); o[t[a]] = s; } var c = false, u = { musicOn: true, soundOn: true, startMusic: function () { var e = 3e5 + 9e5 * Math.random(); c || (e = 6e4 * Math.random()), (c = true), setTimeout(function () { var e = Math.floor(3 * Math.random()) + 1, t = (i = o["calm" + e]).play(), n = 1; u.musicOn || (n = 0), i.volume(n, t), i.on("end", function () { u.startMusic(); }); }, e); }, setMusicVolume: function (e) { null != i && i.volume(e); }, play: function (e, t, i) { if (u.soundOn) { var r = Math.floor(4 * Math.random()) + 1, a = n[e], s = o[a.file + r], c = s.play(), l = (t / (0.4 * Math.random() + 1)) * 0.5; s.volume(l, c); var h = i / (0.2 * Math.random() + 0.9); s.rate(h, c); } }, }; return u.startMusic(), u; })(); }; }, function (e, t, i) { (function (i, n) { var r; function o(e) { return (o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } /*! * howler.js v2.0.15 * howlerjs.com * * (c) 2013-2018, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */ /*! * howler.js v2.0.15 * howlerjs.com * * (c) 2013-2018, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */ !(function () { "use strict"; var o = function () { this.init(); }; o.prototype = { init: function () { var e = this || a; return ( (e._counter = 1e3), (e._codecs = {}), (e._howls = []), (e._muted = false), (e._volume = 1), (e._canPlayEvent = "canplaythrough"), (e._navigator = "undefined" != typeof window && window.navigator ? window.navigator : null), (e.masterGain = null), (e.noAudio = false), (e.usingWebAudio = true), (e.autoSuspend = true), (e.ctx = null), (e.mobileAutoEnable = true), e._setup(), e ); }, volume: function (e) { var t = this || a; if ( ((e = parseFloat(e)), t.ctx || p(), void 0 !== e && e >= 0 && e <= 1) ) { if (((t._volume = e), t._muted)) return t; t.usingWebAudio && t.masterGain.gain.setValueAtTime(e, a.ctx.currentTime); for (var i = 0; i < t._howls.length; i++) if (!t._howls[i]._webAudio) for ( var n = t._howls[i]._getSoundIds(), r = 0; r < n.length; r++ ) { var o = t._howls[i]._soundById(n[r]); o && o._node && (o._node.volume = o._volume * e); } return t; } return t._volume; }, mute: function (e) { var t = this || a; t.ctx || p(), (t._muted = e), t.usingWebAudio && t.masterGain.gain.setValueAtTime( e ? 0 : t._volume, a.ctx.currentTime ); for (var i = 0; i < t._howls.length; i++) if (!t._howls[i]._webAudio) for ( var n = t._howls[i]._getSoundIds(), r = 0; r < n.length; r++ ) { var o = t._howls[i]._soundById(n[r]); o && o._node && (o._node.muted = !!e || o._muted); } return t; }, unload: function () { for (var e = this || a, t = e._howls.length - 1; t >= 0; t--) e._howls[t].unload(); return ( e.usingWebAudio && e.ctx && void 0 !== e.ctx.close && (e.ctx.close(), (e.ctx = null), p()), e ); }, codecs: function (e) { return (this || a)._codecs[e.replace(/^x-/, "")]; }, _setup: function () { var e = this || a; if ( ((e.state = (e.ctx && e.ctx.state) || "running"), e._autoSuspend(), !e.usingWebAudio) ) if ("undefined" != typeof Audio) try { void 0 === new Audio().oncanplaythrough && (e._canPlayEvent = "canplay"); } catch (t) { e.noAudio = true; } else e.noAudio = true; try { new Audio().muted && (e.noAudio = true); } catch (e) {} return e.noAudio || e._setupCodecs(), e; }, _setupCodecs: function () { var e = this || a, t = null; try { t = "undefined" != typeof Audio ? new Audio() : null; } catch (t) { return e; } if (!t || "function" != typeof t.canPlayType) return e; var i = t.canPlayType("audio/mpeg;").replace(/^no$/, ""), n = e._navigator && e._navigator.userAgent.match(/OPR\/([0-6].)/g), r = n && parseInt(n[0].split("/")[1], 10) < 33; return ( (e._codecs = { mp3: !( r || (!i && !t.canPlayType("audio/mp3;").replace(/^no$/, "")) ), mpeg: !!i, opus: !!t .canPlayType('audio/ogg; codecs="opus"') .replace(/^no$/, ""), ogg: !!t .canPlayType('audio/ogg; codecs="vorbis"') .replace(/^no$/, ""), oga: !!t .canPlayType('audio/ogg; codecs="vorbis"') .replace(/^no$/, ""), wav: !!t .canPlayType('audio/wav; codecs="1"') .replace(/^no$/, ""), aac: !!t.canPlayType("audio/aac;").replace(/^no$/, ""), caf: !!t.canPlayType("audio/x-caf;").replace(/^no$/, ""), m4a: !!( t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/m4a;") || t.canPlayType("audio/aac;") ).replace(/^no$/, ""), mp4: !!( t.canPlayType("audio/x-mp4;") || t.canPlayType("audio/mp4;") || t.canPlayType("audio/aac;") ).replace(/^no$/, ""), weba: !!t .canPlayType('audio/webm; codecs="vorbis"') .replace(/^no$/, ""), webm: !!t .canPlayType('audio/webm; codecs="vorbis"') .replace(/^no$/, ""), dolby: !!t .canPlayType('audio/mp4; codecs="ec-3"') .replace(/^no$/, ""), flac: !!( t.canPlayType("audio/x-flac;") || t.canPlayType("audio/flac;") ).replace(/^no$/, ""), }), e ); }, _enableMobileAudio: function () { var e = this || a, t = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi|Chrome/i.test( e._navigator && e._navigator.userAgent ); if (!e._mobileEnabled && e.ctx && t) { (e._mobileEnabled = false), (e.mobileAutoEnable = false), e._mobileUnloaded || 44100 === e.ctx.sampleRate || ((e._mobileUnloaded = true), e.unload()), (e._scratchBuffer = e.ctx.createBuffer(1, 1, 22050)); var i = function t(i) { a._autoResume(); var n = e.ctx.createBufferSource(); (n.buffer = e._scratchBuffer), n.connect(e.ctx.destination), void 0 === n.start ? n.noteOn(0) : n.start(0), "function" == typeof e.ctx.resume && e.ctx.resume(), (n.onended = function () { n.disconnect(0), (e._mobileEnabled = true), document.removeEventListener("touchstart", t, true), document.removeEventListener("touchend", t, true), document.removeEventListener("click", t, true); for (var i = 0; i < e._howls.length; i++) e._howls[i]._emit("unlock"); }); }; return ( document.addEventListener("touchstart", i, true), document.addEventListener("touchend", i, true), document.addEventListener("click", i, true), e ); } }, _autoSuspend: function () { var e = this; if ( e.autoSuspend && e.ctx && void 0 !== e.ctx.suspend && a.usingWebAudio ) { for (var t = 0; t < e._howls.length; t++) if (e._howls[t]._webAudio) for (var i = 0; i < e._howls[t]._sounds.length; i++) if (!e._howls[t]._sounds[i]._paused) return e; return ( e._suspendTimer && clearTimeout(e._suspendTimer), (e._suspendTimer = setTimeout(function () { e.autoSuspend && ((e._suspendTimer = null), (e.state = "suspending"), e.ctx.suspend().then(function () { (e.state = "suspended"), e._resumeAfterSuspend && (delete e._resumeAfterSuspend, e._autoResume()); })); }, 3e4)), e ); } }, _autoResume: function () { var e = this; if (e.ctx && void 0 !== e.ctx.resume && a.usingWebAudio) return ( "running" === e.state && e._suspendTimer ? (clearTimeout(e._suspendTimer), (e._suspendTimer = null)) : "suspended" === e.state ? (e.ctx.resume().then(function () { e.state = "running"; for (var t = 0; t < e._howls.length; t++) e._howls[t]._emit("resume"); }), e._suspendTimer && (clearTimeout(e._suspendTimer), (e._suspendTimer = null))) : "suspending" === e.state && (e._resumeAfterSuspend = true), e ); }, }; var a = new o(), s = function (e) { e.src && 0 !== e.src.length ? this.init(e) : console.error( "An array of source files must be passed with any new Howl." ); }; s.prototype = { init: function (e) { var t = this; return ( a.ctx || p(), (t._autoplay = e.autoplay || false), (t._format = "string" != typeof e.format ? e.format : [e.format]), (t._html5 = e.html5 || false), (t._muted = e.mute || false), (t._loop = e.loop || false), (t._pool = e.pool || 5), (t._preload = "boolean" != typeof e.preload || e.preload), (t._rate = e.rate || 1), (t._sprite = e.sprite || {}), (t._src = "string" != typeof e.src ? e.src : [e.src]), (t._volume = void 0 !== e.volume ? e.volume : 1), (t._xhrWithCredentials = e.xhrWithCredentials || false), (t._duration = 0), (t._state = "unloaded"), (t._sounds = []), (t._endTimers = {}), (t._queue = []), (t._playLock = false), (t._onend = e.onend ? [ { fn: e.onend, }, ] : []), (t._onfade = e.onfade ? [ { fn: e.onfade, }, ] : []), (t._onload = e.onload ? [ { fn: e.onload, }, ] : []), (t._onloaderror = e.onloaderror ? [ { fn: e.onloaderror, }, ] : []), (t._onplayerror = e.onplayerror ? [ { fn: e.onplayerror, }, ] : []), (t._onpause = e.onpause ? [ { fn: e.onpause, }, ] : []), (t._onplay = e.onplay ? [ { fn: e.onplay, }, ] : []), (t._onstop = e.onstop ? [ { fn: e.onstop, }, ] : []), (t._onmute = e.onmute ? [ { fn: e.onmute, }, ] : []), (t._onvolume = e.onvolume ? [ { fn: e.onvolume, }, ] : []), (t._onrate = e.onrate ? [ { fn: e.onrate, }, ] : []), (t._onseek = e.onseek ? [ { fn: e.onseek, }, ] : []), (t._onunlock = e.onunlock ? [ { fn: e.onunlock, }, ] : []), (t._onresume = []), (t._webAudio = a.usingWebAudio && !t._html5), void 0 !== a.ctx && a.ctx && a.mobileAutoEnable && a._enableMobileAudio(), a._howls.push(t), t._autoplay && t._queue.push({ event: "play", action: function () { t.play(); }, }), t._preload && t.load(), t ); }, load: function () { var e = null; if (a.noAudio) this._emit("loaderror", null, "No audio support."); else { "string" == typeof this._src && (this._src = [this._src]); for (var t = 0; t < this._src.length; t++) { var i, n; if (this._format && this._format[t]) i = this._format[t]; else { if ("string" != typeof (n = this._src[t])) { this._emit( "loaderror", null, "Non-string found in selected audio sources - ignoring." ); continue; } (i = /^data:audio\/([^;,]+);/i.exec(n)) || (i = /\.([^.]+)$/.exec(n.split("?", 1)[0])), i && (i = i[1].toLowerCase()); } if ( (i || console.warn( 'No file extension was found. Consider using the "format" property or specify an extension.' ), i && a.codecs(i)) ) { e = this._src[t]; break; } } if (e) return ( (this._src = e), (this._state = "loading"), "https:" === window.location.protocol && "http:" === e.slice(0, 5) && ((this._html5 = true), (this._webAudio = false)), new c(this), this._webAudio && l(this), this ); this._emit( "loaderror", null, "No codec support for selected audio sources." ); } }, play: function (e, t) { var n = this, r = null; if ("number" == typeof e) (r = e), (e = null); else { if ( "string" == typeof e && "loaded" === n._state && !n._sprite[e] ) return null; if (void 0 === e) { e = "__default"; for (var o = 0, s = 0; s < n._sounds.length; s++) n._sounds[s]._paused && !n._sounds[s]._ended && (o++, (r = n._sounds[s]._id)); 1 === o ? (e = null) : (r = null); } } var c = r ? n._soundById(r) : n._inactiveSound(); if (!c) return null; if ( (r && !e && (e = c._sprite || "__default"), "loaded" !== n._state) ) { (c._sprite = e), (c._ended = false); var u = c._id; return ( n._queue.push({ event: "play", action: function () { n.play(u); }, }), u ); } if (r && !c._paused) return t || n._loadQueue("play"), c._id; n._webAudio && a._autoResume(); var l = Math.max(0, c._seek > 0 ? c._seek : n._sprite[e][0] / 1e3), h = Math.max(0, (n._sprite[e][0] + n._sprite[e][1]) / 1e3 - l), f = (1e3 * h) / Math.abs(c._rate); if ( ((c._paused = false), (c._ended = false), (c._sprite = e), (c._seek = l), (c._start = n._sprite[e][0] / 1e3), (c._stop = (n._sprite[e][0] + n._sprite[e][1]) / 1e3), (c._loop = !(!c._loop && !n._sprite[e][2])), !(c._seek >= c._stop)) ) { var d = c._node; if (n._webAudio) { var p = function () { n._refreshBuffer(c); var e = c._muted || n._muted ? 0 : c._volume; d.gain.setValueAtTime(e, a.ctx.currentTime), (c._playStart = a.ctx.currentTime), void 0 === d.bufferSource.start ? c._loop ? d.bufferSource.noteGrainOn(0, l, 86400) : d.bufferSource.noteGrainOn(0, l, h) : c._loop ? d.bufferSource.start(0, l, 86400) : d.bufferSource.start(0, l, h), f !== 1 / 0 && (n._endTimers[c._id] = setTimeout( n._ended.bind(n, c), f )), t || setTimeout(function () { n._emit("play", c._id); }, 0); }; "running" === a.state ? p() : (n.once("resume", p), n._clearTimer(c._id)); } else { var m = function () { (d.currentTime = l), (d.muted = c._muted || n._muted || a._muted || d.muted), (d.volume = c._volume * a.volume()), (d.playbackRate = c._rate); try { var r = d.play(); if ( (r && void 0 !== i && (r instanceof i || "function" == typeof r.then) ? ((n._playLock = true), r .then(function () { (n._playLock = false), t || n._emit("play", c._id); }) .catch(function () { (n._playLock = false), n._emit( "playerror", c._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction." ); })) : t || n._emit("play", c._id), (d.playbackRate = c._rate), d.paused) ) return void n._emit( "playerror", c._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction." ); "__default" !== e || c._loop ? (n._endTimers[c._id] = setTimeout( n._ended.bind(n, c), f )) : ((n._endTimers[c._id] = function () { n._ended(c), d.removeEventListener( "ended", n._endTimers[c._id], false ); }), d.addEventListener( "ended", n._endTimers[c._id], false )); } catch (e) { n._emit("playerror", c._id, e); } }, g = (window && window.ejecta) || (!d.readyState && a._navigator.isCocoonJS); if (d.readyState >= 3 || g) m(); else { d.addEventListener( a._canPlayEvent, function e() { m(), d.removeEventListener(a._canPlayEvent, e, false); }, false ), n._clearTimer(c._id); } } return c._id; } n._ended(c); }, pause: function (e) { var t = this; if ("loaded" !== t._state || t._playLock) return ( t._queue.push({ event: "pause", action: function () { t.pause(e); }, }), t ); for (var i = t._getSoundIds(e), n = 0; n < i.length; n++) { t._clearTimer(i[n]); var r = t._soundById(i[n]); if ( r && !r._paused && ((r._seek = t.seek(i[n])), (r._rateSeek = 0), (r._paused = true), t._stopFade(i[n]), r._node) ) if (t._webAudio) { if (!r._node.bufferSource) continue; void 0 === r._node.bufferSource.stop ? r._node.bufferSource.noteOff(0) : r._node.bufferSource.stop(0), t._cleanBuffer(r._node); } else (isNaN(r._node.duration) && r._node.duration !== 1 / 0) || r._node.pause(); arguments[1] || t._emit("pause", r ? r._id : null); } return t; }, stop: function (e, t) { var i = this; if ("loaded" !== i._state || i._playLock) return ( i._queue.push({ event: "stop", action: function () { i.stop(e); }, }), i ); for (var n = i._getSoundIds(e), r = 0; r < n.length; r++) { i._clearTimer(n[r]); var o = i._soundById(n[r]); o && ((o._seek = o._start || 0), (o._rateSeek = 0), (o._paused = true), (o._ended = true), i._stopFade(n[r]), o._node && (i._webAudio ? o._node.bufferSource && (void 0 === o._node.bufferSource.stop ? o._node.bufferSource.noteOff(0) : o._node.bufferSource.stop(0), i._cleanBuffer(o._node)) : (isNaN(o._node.duration) && o._node.duration !== 1 / 0) || ((o._node.currentTime = o._start || 0), o._node.pause())), t || i._emit("stop", o._id)); } return i; }, mute: function (e, t) { var i = this; if ("loaded" !== i._state || i._playLock) return ( i._queue.push({ event: "mute", action: function () { i.mute(e, t); }, }), i ); if (void 0 === t) { if ("boolean" != typeof e) return i._muted; i._muted = e; } for (var n = i._getSoundIds(t), r = 0; r < n.length; r++) { var o = i._soundById(n[r]); o && ((o._muted = e), o._interval && i._stopFade(o._id), i._webAudio && o._node ? o._node.gain.setValueAtTime( e ? 0 : o._volume, a.ctx.currentTime ) : o._node && (o._node.muted = !!a._muted || e), i._emit("mute", o._id)); } return i; }, volume: function () { var e, t, i, n = this, r = arguments; if (0 === r.length) return n._volume; if ( (1 === r.length || (2 === r.length && void 0 === r[1]) ? n._getSoundIds().indexOf(r[0]) >= 0 ? (t = parseInt(r[0], 10)) : (e = parseFloat(r[0])) : r.length >= 2 && ((e = parseFloat(r[0])), (t = parseInt(r[1], 10))), !(void 0 !== e && e >= 0 && e <= 1)) ) return (i = t ? n._soundById(t) : n._sounds[0]) ? i._volume : 0; if ("loaded" !== n._state || n._playLock) return ( n._queue.push({ event: "volume", action: function () { n.volume.apply(n, r); }, }), n ); void 0 === t && (n._volume = e), (t = n._getSoundIds(t)); for (var o = 0; o < t.length; o++) (i = n._soundById(t[o])) && ((i._volume = e), r[2] || n._stopFade(t[o]), n._webAudio && i._node && !i._muted ? i._node.gain.setValueAtTime(e, a.ctx.currentTime) : i._node && !i._muted && (i._node.volume = e * a.volume()), n._emit("volume", i._id)); return n; }, fade: function (e, t, i, n) { var r = this; if ("loaded" !== r._state || r._playLock) return ( r._queue.push({ event: "fade", action: function () { r.fade(e, t, i, n); }, }), r ); r.volume(e, n); for (var o = r._getSoundIds(n), s = 0; s < o.length; s++) { var c = r._soundById(o[s]); if (c) { if ((n || r._stopFade(o[s]), r._webAudio && !c._muted)) { var u = a.ctx.currentTime, l = u + i / 1e3; (c._volume = e), c._node.gain.setValueAtTime(e, u), c._node.gain.linearRampToValueAtTime(t, l); } r._startFadeInterval(c, e, t, i, o[s], void 0 === n); } } return r; }, _startFadeInterval: function (e, t, i, n, r, o) { var a = this, s = t, c = i - t, u = Math.abs(c / 0.01), l = Math.max(4, u > 0 ? n / u : n), h = Date.now(); (e._fadeTo = i), (e._interval = setInterval(function () { var r = (Date.now() - h) / n; (h = Date.now()), (s += c * r), (s = Math.max(0, s)), (s = Math.min(1, s)), (s = Math.round(100 * s) / 100), a._webAudio ? (e._volume = s) : a.volume(s, e._id, true), o && (a._volume = s), ((i < t && s <= i) || (i > t && s >= i)) && (clearInterval(e._interval), (e._interval = null), (e._fadeTo = null), a.volume(i, e._id), a._emit("fade", e._id)); }, l)); }, _stopFade: function (e) { var t = this._soundById(e); return ( t && t._interval && (this._webAudio && t._node.gain.cancelScheduledValues(a.ctx.currentTime), clearInterval(t._interval), (t._interval = null), this.volume(t._fadeTo, e), (t._fadeTo = null), this._emit("fade", e)), this ); }, loop: function () { var e, t, i, n = arguments; if (0 === n.length) return this._loop; if (1 === n.length) { if ("boolean" != typeof n[0]) return !!(i = this._soundById(parseInt(n[0], 10))) && i._loop; (e = n[0]), (this._loop = e); } else 2 === n.length && ((e = n[0]), (t = parseInt(n[1], 10))); for (var r = this._getSoundIds(t), o = 0; o < r.length; o++) (i = this._soundById(r[o])) && ((i._loop = e), this._webAudio && i._node && i._node.bufferSource && ((i._node.bufferSource.loop = e), e && ((i._node.bufferSource.loopStart = i._start || 0), (i._node.bufferSource.loopEnd = i._stop)))); return this; }, rate: function () { var e, t, i, n = this, r = arguments; if (0 === r.length) t = n._sounds[0]._id; else if (1 === r.length) { n._getSoundIds().indexOf(r[0]) >= 0 ? (t = parseInt(r[0], 10)) : (e = parseFloat(r[0])); } else 2 === r.length && ((e = parseFloat(r[0])), (t = parseInt(r[1], 10))); if ("number" != typeof e) return (i = n._soundById(t)) ? i._rate : n._rate; if ("loaded" !== n._state || n._playLock) return ( n._queue.push({ event: "rate", action: function () { n.rate.apply(n, r); }, }), n ); void 0 === t && (n._rate = e), (t = n._getSoundIds(t)); for (var o = 0; o < t.length; o++) if ((i = n._soundById(t[o]))) { (i._rateSeek = n.seek(t[o])), (i._playStart = n._webAudio ? a.ctx.currentTime : i._playStart), (i._rate = e), n._webAudio && i._node && i._node.bufferSource ? i._node.bufferSource.playbackRate.setValueAtTime( e, a.ctx.currentTime ) : i._node && (i._node.playbackRate = e); var s = n.seek(t[o]), c = (1e3 * ((n._sprite[i._sprite][0] + n._sprite[i._sprite][1]) / 1e3 - s)) / Math.abs(i._rate); (!n._endTimers[t[o]] && i._paused) || (n._clearTimer(t[o]), (n._endTimers[t[o]] = setTimeout(n._ended.bind(n, i), c))), n._emit("rate", i._id); } return n; }, seek: function () { var e, t, i = this, n = arguments; if (0 === n.length) t = i._sounds[0]._id; else if (1 === n.length) { i._getSoundIds().indexOf(n[0]) >= 0 ? (t = parseInt(n[0], 10)) : i._sounds.length && ((t = i._sounds[0]._id), (e = parseFloat(n[0]))); } else 2 === n.length && ((e = parseFloat(n[0])), (t = parseInt(n[1], 10))); if (void 0 === t) return i; if ("loaded" !== i._state || i._playLock) return ( i._queue.push({ event: "seek", action: function () { i.seek.apply(i, n); }, }), i ); var r = i._soundById(t); if (r) { if (!("number" == typeof e && e >= 0)) { if (i._webAudio) { var o = i.playing(t) ? a.ctx.currentTime - r._playStart : 0, s = r._rateSeek ? r._rateSeek - r._seek : 0; return r._seek + (s + o * Math.abs(r._rate)); } return r._node.currentTime; } var c = i.playing(t); c && i.pause(t, true), (r._seek = e), (r._ended = false), i._clearTimer(t), !i._webAudio && r._node && (r._node.currentTime = e); var u = function () { i._emit("seek", t), c && i.play(t, true); }; if (c && !i._webAudio) { setTimeout(function e() { i._playLock ? setTimeout(e, 0) : u(); }, 0); } else u(); } return i; }, playing: function (e) { if ("number" == typeof e) { var t = this._soundById(e); return !!t && !t._paused; } for (var i = 0; i < this._sounds.length; i++) if (!this._sounds[i]._paused) return true; return false; }, duration: function (e) { var t = this._duration, i = this._soundById(e); return i && (t = this._sprite[i._sprite][1] / 1e3), t; }, state: function () { return this._state; }, unload: function () { for (var e = this, t = e._sounds, i = 0; i < t.length; i++) { if ((t[i]._paused || e.stop(t[i]._id), !e._webAudio)) /MSIE |Trident\//.test( a._navigator && a._navigator.userAgent ) || (t[i]._node.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"), t[i]._node.removeEventListener("error", t[i]._errorFn, false), t[i]._node.removeEventListener( a._canPlayEvent, t[i]._loadFn, false ); delete t[i]._node, e._clearTimer(t[i]._id); } var n = a._howls.indexOf(e); n >= 0 && a._howls.splice(n, 1); var r = true; for (i = 0; i < a._howls.length; i++) if (a._howls[i]._src === e._src) { r = false; break; } return ( u && r && delete u[e._src], (a.noAudio = false), (e._state = "unloaded"), (e._sounds = []), (e = null), null ); }, on: function (e, t, i, n) { var r = this["_on" + e]; return ( "function" == typeof t && r.push( n ? { id: i, fn: t, once: n, } : { id: i, fn: t, } ), this ); }, off: function (e, t, i) { var n = this["_on" + e], r = 0; if (("number" == typeof t && ((i = t), (t = null)), t || i)) for (r = 0; r < n.length; r++) { var o = i === n[r].id; if ((t === n[r].fn && o) || (!t && o)) { n.splice(r, 1); break; } } else if (e) this["_on" + e] = []; else { var a = Object.keys(this); for (r = 0; r < a.length; r++) 0 === a[r].indexOf("_on") && Array.isArray(this[a[r]]) && (this[a[r]] = []); } return this; }, once: function (e, t, i) { return this.on(e, t, i, 1), this; }, _emit: function (e, t, i) { for (var n = this["_on" + e], r = n.length - 1; r >= 0; r--) (n[r].id && n[r].id !== t && "load" !== e) || (setTimeout( function (e) { e.call(this, t, i); }.bind(this, n[r].fn), 0 ), n[r].once && this.off(e, n[r].fn, n[r].id)); return this._loadQueue(e), this; }, _loadQueue: function (e) { if (this._queue.length > 0) { var t = this._queue[0]; t.event === e && (this._queue.shift(), this._loadQueue()), e || t.action(); } return this; }, _ended: function (e) { var t = e._sprite; if ( !this._webAudio && e._node && !e._node.paused && !e._node.ended && e._node.currentTime < e._stop ) return setTimeout(this._ended.bind(this, e), 100), this; var i = !(!e._loop && !this._sprite[t][2]); if ( (this._emit("end", e._id), !this._webAudio && i && this.stop(e._id, true).play(e._id), this._webAudio && i) ) { this._emit("play", e._id), (e._seek = e._start || 0), (e._rateSeek = 0), (e._playStart = a.ctx.currentTime); var n = (1e3 * (e._stop - e._start)) / Math.abs(e._rate); this._endTimers[e._id] = setTimeout(this._ended.bind(this, e), n); } return ( this._webAudio && !i && ((e._paused = true), (e._ended = true), (e._seek = e._start || 0), (e._rateSeek = 0), this._clearTimer(e._id), this._cleanBuffer(e._node), a._autoSuspend()), this._webAudio || i || this.stop(e._id, true), this ); }, _clearTimer: function (e) { if (this._endTimers[e]) { if ("function" != typeof this._endTimers[e]) clearTimeout(this._endTimers[e]); else { var t = this._soundById(e); t && t._node && t._node.removeEventListener( "ended", this._endTimers[e], false ); } delete this._endTimers[e]; } return this; }, _soundById: function (e) { for (var t = 0; t < this._sounds.length; t++) if (e === this._sounds[t]._id) return this._sounds[t]; return null; }, _inactiveSound: function () { this._drain(); for (var e = 0; e < this._sounds.length; e++) if (this._sounds[e]._ended) return this._sounds[e].reset(); return new c(this); }, _drain: function () { var e = this._pool, t = 0, i = 0; if (!(this._sounds.length < e)) { for (i = 0; i < this._sounds.length; i++) this._sounds[i]._ended && t++; for (i = this._sounds.length - 1; i >= 0; i--) { if (t <= e) return; this._sounds[i]._ended && (this._webAudio && this._sounds[i]._node && this._sounds[i]._node.disconnect(0), this._sounds.splice(i, 1), t--); } } }, _getSoundIds: function (e) { if (void 0 === e) { for (var t = [], i = 0; i < this._sounds.length; i++) t.push(this._sounds[i]._id); return t; } return [e]; }, _refreshBuffer: function (e) { return ( (e._node.bufferSource = a.ctx.createBufferSource()), (e._node.bufferSource.buffer = u[this._src]), e._panner ? e._node.bufferSource.connect(e._panner) : e._node.bufferSource.connect(e._node), (e._node.bufferSource.loop = e._loop), e._loop && ((e._node.bufferSource.loopStart = e._start || 0), (e._node.bufferSource.loopEnd = e._stop || 0)), e._node.bufferSource.playbackRate.setValueAtTime( e._rate, a.ctx.currentTime ), this ); }, _cleanBuffer: function (e) { if (a._scratchBuffer && e.bufferSource) { (e.bufferSource.onended = null), e.bufferSource.disconnect(0); try { e.bufferSource.buffer = a._scratchBuffer; } catch (e) {} } return (e.bufferSource = null), this; }, }; var c = function (e) { (this._parent = e), this.init(); }; c.prototype = { init: function () { var e = this._parent; return ( (this._muted = e._muted), (this._loop = e._loop), (this._volume = e._volume), (this._rate = e._rate), (this._seek = 0), (this._paused = true), (this._ended = true), (this._sprite = "__default"), (this._id = ++a._counter), e._sounds.push(this), this.create(), this ); }, create: function () { var e = this._parent, t = a._muted || this._muted || this._parent._muted ? 0 : this._volume; return ( e._webAudio ? ((this._node = void 0 === a.ctx.createGain ? a.ctx.createGainNode() : a.ctx.createGain()), this._node.gain.setValueAtTime(t, a.ctx.currentTime), (this._node.paused = true), this._node.connect(a.masterGain)) : ((this._node = new Audio()), (this._errorFn = this._errorListener.bind(this)), this._node.addEventListener("error", this._errorFn, false), (this._loadFn = this._loadListener.bind(this)), this._node.addEventListener( a._canPlayEvent, this._loadFn, false ), (this._node.src = e._src), (this._node.preload = "auto"), (this._node.volume = t * a.volume()), this._node.load()), this ); }, reset: function () { var e = this._parent; return ( (this._muted = e._muted), (this._loop = e._loop), (this._volume = e._volume), (this._rate = e._rate), (this._seek = 0), (this._rateSeek = 0), (this._paused = true), (this._ended = true), (this._sprite = "__default"), (this._id = ++a._counter), this ); }, _errorListener: function () { this._parent._emit( "loaderror", this._id, this._node.error ? this._node.error.code : 0 ), this._node.removeEventListener("error", this._errorFn, false); }, _loadListener: function () { var e = this._parent; (e._duration = Math.ceil(10 * this._node.duration) / 10), 0 === Object.keys(e._sprite).length && (e._sprite = { __default: [0, 1e3 * e._duration], }), "loaded" !== e._state && ((e._state = "loaded"), e._emit("load"), e._loadQueue()), this._node.removeEventListener( a._canPlayEvent, this._loadFn, false ); }, }; var u = {}, l = function (e) { var t = e._src; if (u[t]) return (e._duration = u[t].duration), void d(e); if (/^data:[^;]+;base64,/.test(t)) { for ( var i = atob(t.split(",")[1]), n = new Uint8Array(i.length), r = 0; r < i.length; ++r ) n[r] = i.charCodeAt(r); f(n.buffer, e); } else { var o = new XMLHttpRequest(); o.open("GET", t, true), (o.withCredentials = e._xhrWithCredentials), (o.responseType = "arraybuffer"), (o.onload = function () { var t = (o.status + "")[0]; "0" === t || "2" === t || "3" === t ? f(o.response, e) : e._emit( "loaderror", null, "Failed loading audio file with status: " + o.status + "." ); }), (o.onerror = function () { e._webAudio && ((e._html5 = true), (e._webAudio = false), (e._sounds = []), delete u[t], e.load()); }), h(o); } }, h = function (e) { try { e.send(); } catch (t) { e.onerror(); } }, f = function (e, t) { var n = function () { t._emit("loaderror", null, "Decoding audio data failed."); }, r = function (e) { e && t._sounds.length > 0 ? ((u[t._src] = e), d(t, e)) : n(); }; void 0 !== i && 1 === a.ctx.decodeAudioData.length ? a.ctx.decodeAudioData(e).then(r).catch(n) : a.ctx.decodeAudioData(e, r, n); }, d = function (e, t) { t && !e._duration && (e._duration = t.duration), 0 === Object.keys(e._sprite).length && (e._sprite = { __default: [0, 1e3 * e._duration], }), "loaded" !== e._state && ((e._state = "loaded"), e._emit("load"), e._loadQueue()); }, p = function () { try { "undefined" != typeof AudioContext ? (a.ctx = new AudioContext()) : "undefined" != typeof webkitAudioContext ? (a.ctx = new webkitAudioContext()) : (a.usingWebAudio = false); } catch (e) { a.usingWebAudio = false; } var e = /iP(hone|od|ad)/.test( a._navigator && a._navigator.platform ), t = a._navigator && a._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), i = t ? parseInt(t[1], 10) : null; if (e && i && i < 9) { var n = /safari/.test( a._navigator && a._navigator.userAgent.toLowerCase() ); ((a._navigator && a._navigator.standalone && !n) || (a._navigator && !a._navigator.standalone && !n)) && (a.usingWebAudio = false); } a.usingWebAudio && ((a.masterGain = void 0 === a.ctx.createGain ? a.ctx.createGainNode() : a.ctx.createGain()), a.masterGain.gain.setValueAtTime( a._muted ? 0 : 1, a.ctx.currentTime ), a.masterGain.connect(a.ctx.destination)), a._setup(); }; void 0 === (r = function () { return { Howler: a, Howl: s, }; }.apply(t, [])) || (e.exports = r), (t.Howler = a), (t.Howl = s), "undefined" != typeof window ? ((window.HowlerGlobal = o), (window.Howler = a), (window.Howl = s), (window.Sound = c)) : void 0 !== n && ((n.HowlerGlobal = o), (n.Howler = a), (n.Howl = s), (n.Sound = c)); })(), /*! * Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported. * * howler.js v2.0.15 * howlerjs.com * * (c) 2013-2018, James Simpson of GoldFire Studios * goldfirestudios.com * * MIT License */ (function () { "use strict"; var e; (HowlerGlobal.prototype._pos = [0, 0, 0]), (HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0]), (HowlerGlobal.prototype.stereo = function (e) { if (!this.ctx || !this.ctx.listener) return this; for (var t = this._howls.length - 1; t >= 0; t--) this._howls[t].stereo(e); return this; }), (HowlerGlobal.prototype.pos = function (e, t, i) { return this.ctx && this.ctx.listener ? ((t = "number" != typeof t ? this._pos[1] : t), (i = "number" != typeof i ? this._pos[2] : i), "number" != typeof e ? this._pos : ((this._pos = [e, t, i]), void 0 !== this.ctx.listener.positionX ? (this.ctx.listener.positionX.setTargetAtTime( this._pos[0], Howler.ctx.currentTime, 0.1 ), this.ctx.listener.positionY.setTargetAtTime( this._pos[1], Howler.ctx.currentTime, 0.1 ), this.ctx.listener.positionZ.setTargetAtTime( this._pos[2], Howler.ctx.currentTime, 0.1 )) : this.ctx.listener.setPosition( this._pos[0], this._pos[1], this._pos[2] ), this)) : this; }), (HowlerGlobal.prototype.orientation = function (e, t, i, n, r, o) { if (!this.ctx || !this.ctx.listener) return this; var a = this._orientation; return ( (t = "number" != typeof t ? a[1] : t), (i = "number" != typeof i ? a[2] : i), (n = "number" != typeof n ? a[3] : n), (r = "number" != typeof r ? a[4] : r), (o = "number" != typeof o ? a[5] : o), "number" != typeof e ? a : ((this._orientation = [e, t, i, n, r, o]), void 0 !== this.ctx.listener.forwardX ? (this.ctx.listener.forwardX.setTargetAtTime( e, Howler.ctx.currentTime, 0.1 ), this.ctx.listener.forwardY.setTargetAtTime( t, Howler.ctx.currentTime, 0.1 ), this.ctx.listener.forwardZ.setTargetAtTime( i, Howler.ctx.currentTime, 0.1 ), this.ctx.listener.upX.setTargetAtTime( e, Howler.ctx.currentTime, 0.1 ), this.ctx.listener.upY.setTargetAtTime( t, Howler.ctx.currentTime, 0.1 ), this.ctx.listener.upZ.setTargetAtTime( i, Howler.ctx.currentTime, 0.1 )) : this.ctx.listener.setOrientation(e, t, i, n, r, o), this) ); }), (Howl.prototype.init = ((e = Howl.prototype.init), function (t) { return ( (this._orientation = t.orientation || [1, 0, 0]), (this._stereo = t.stereo || null), (this._pos = t.pos || null), (this._pannerAttr = { coneInnerAngle: void 0 !== t.coneInnerAngle ? t.coneInnerAngle : 360, coneOuterAngle: void 0 !== t.coneOuterAngle ? t.coneOuterAngle : 360, coneOuterGain: void 0 !== t.coneOuterGain ? t.coneOuterGain : 0, distanceModel: void 0 !== t.distanceModel ? t.distanceModel : "inverse", maxDistance: void 0 !== t.maxDistance ? t.maxDistance : 1e4, panningModel: void 0 !== t.panningModel ? t.panningModel : "HRTF", refDistance: void 0 !== t.refDistance ? t.refDistance : 1, rolloffFactor: void 0 !== t.rolloffFactor ? t.rolloffFactor : 1, }), (this._onstereo = t.onstereo ? [ { fn: t.onstereo, }, ] : []), (this._onpos = t.onpos ? [ { fn: t.onpos, }, ] : []), (this._onorientation = t.onorientation ? [ { fn: t.onorientation, }, ] : []), e.call(this, t) ); })), (Howl.prototype.stereo = function (e, i) { var n = this; if (!n._webAudio) return n; if ("loaded" !== n._state) return ( n._queue.push({ event: "stereo", action: function () { n.stereo(e, i); }, }), n ); var r = void 0 === Howler.ctx.createStereoPanner ? "spatial" : "stereo"; if (void 0 === i) { if ("number" != typeof e) return n._stereo; (n._stereo = e), (n._pos = [e, 0, 0]); } for (var o = n._getSoundIds(i), a = 0; a < o.length; a++) { var s = n._soundById(o[a]); if (s) { if ("number" != typeof e) return s._stereo; (s._stereo = e), (s._pos = [e, 0, 0]), s._node && ((s._pannerAttr.panningModel = "equalpower"), (s._panner && s._panner.pan) || t(s, r), "spatial" === r ? void 0 !== s._panner.positionX ? (s._panner.positionX.setValueAtTime( e, Howler.ctx.currentTime ), s._panner.positionY.setValueAtTime( 0, Howler.ctx.currentTime ), s._panner.positionZ.setValueAtTime( 0, Howler.ctx.currentTime )) : s._panner.setPosition(e, 0, 0) : s._panner.pan.setValueAtTime( e, Howler.ctx.currentTime )), n._emit("stereo", s._id); } } return n; }), (Howl.prototype.pos = function (e, i, n, r) { var o = this; if (!o._webAudio) return o; if ("loaded" !== o._state) return ( o._queue.push({ event: "pos", action: function () { o.pos(e, i, n, r); }, }), o ); if ( ((i = "number" != typeof i ? 0 : i), (n = "number" != typeof n ? -0.5 : n), void 0 === r) ) { if ("number" != typeof e) return o._pos; o._pos = [e, i, n]; } for (var a = o._getSoundIds(r), s = 0; s < a.length; s++) { var c = o._soundById(a[s]); if (c) { if ("number" != typeof e) return c._pos; (c._pos = [e, i, n]), c._node && ((c._panner && !c._panner.pan) || t(c, "spatial"), void 0 !== c._panner.positionX ? (c._panner.positionX.setValueAtTime( e, Howler.ctx.currentTime ), c._panner.positionY.setValueAtTime( i, Howler.ctx.currentTime ), c._panner.positionZ.setValueAtTime( n, Howler.ctx.currentTime )) : c._panner.setOrientation(e, i, n)), o._emit("pos", c._id); } } return o; }), (Howl.prototype.orientation = function (e, i, n, r) { var o = this; if (!o._webAudio) return o; if ("loaded" !== o._state) return ( o._queue.push({ event: "orientation", action: function () { o.orientation(e, i, n, r); }, }), o ); if ( ((i = "number" != typeof i ? o._orientation[1] : i), (n = "number" != typeof n ? o._orientation[2] : n), void 0 === r) ) { if ("number" != typeof e) return o._orientation; o._orientation = [e, i, n]; } for (var a = o._getSoundIds(r), s = 0; s < a.length; s++) { var c = o._soundById(a[s]); if (c) { if ("number" != typeof e) return c._orientation; (c._orientation = [e, i, n]), c._node && (c._panner || (c._pos || (c._pos = o._pos || [0, 0, -0.5]), t(c, "spatial")), void 0 !== c._panner.orientationX ? (c._panner.orientationX.setValueAtTime( e, Howler.ctx.currentTime ), c._panner.orientationY.setValueAtTime( i, Howler.ctx.currentTime ), c._panner.orientationZ.setValueAtTime( n, Howler.ctx.currentTime )) : c._panner.setOrientation(e, i, n)), o._emit("orientation", c._id); } } return o; }), (Howl.prototype.pannerAttr = function () { var e, i, n, r = arguments; if (!this._webAudio) return this; if (0 === r.length) return this._pannerAttr; if (1 === r.length) { if ("object" !== o(r[0])) return (n = this._soundById(parseInt(r[0], 10))) ? n._pannerAttr : this._pannerAttr; (e = r[0]), void 0 === i && (e.pannerAttr || (e.pannerAttr = { coneInnerAngle: e.coneInnerAngle, coneOuterAngle: e.coneOuterAngle, coneOuterGain: e.coneOuterGain, distanceModel: e.distanceModel, maxDistance: e.maxDistance, refDistance: e.refDistance, rolloffFactor: e.rolloffFactor, panningModel: e.panningModel, }), (this._pannerAttr = { coneInnerAngle: void 0 !== e.pannerAttr.coneInnerAngle ? e.pannerAttr.coneInnerAngle : this._coneInnerAngle, coneOuterAngle: void 0 !== e.pannerAttr.coneOuterAngle ? e.pannerAttr.coneOuterAngle : this._coneOuterAngle, coneOuterGain: void 0 !== e.pannerAttr.coneOuterGain ? e.pannerAttr.coneOuterGain : this._coneOuterGain, distanceModel: void 0 !== e.pannerAttr.distanceModel ? e.pannerAttr.distanceModel : this._distanceModel, maxDistance: void 0 !== e.pannerAttr.maxDistance ? e.pannerAttr.maxDistance : this._maxDistance, refDistance: void 0 !== e.pannerAttr.refDistance ? e.pannerAttr.refDistance : this._refDistance, rolloffFactor: void 0 !== e.pannerAttr.rolloffFactor ? e.pannerAttr.rolloffFactor : this._rolloffFactor, panningModel: void 0 !== e.pannerAttr.panningModel ? e.pannerAttr.panningModel : this._panningModel, })); } else 2 === r.length && ((e = r[0]), (i = parseInt(r[1], 10))); for (var a = this._getSoundIds(i), s = 0; s < a.length; s++) if ((n = this._soundById(a[s]))) { var c = n._pannerAttr; c = { coneInnerAngle: void 0 !== e.coneInnerAngle ? e.coneInnerAngle : c.coneInnerAngle, coneOuterAngle: void 0 !== e.coneOuterAngle ? e.coneOuterAngle : c.coneOuterAngle, coneOuterGain: void 0 !== e.coneOuterGain ? e.coneOuterGain : c.coneOuterGain, distanceModel: void 0 !== e.distanceModel ? e.distanceModel : c.distanceModel, maxDistance: void 0 !== e.maxDistance ? e.maxDistance : c.maxDistance, refDistance: void 0 !== e.refDistance ? e.refDistance : c.refDistance, rolloffFactor: void 0 !== e.rolloffFactor ? e.rolloffFactor : c.rolloffFactor, panningModel: void 0 !== e.panningModel ? e.panningModel : c.panningModel, }; var u = n._panner; u ? ((u.coneInnerAngle = c.coneInnerAngle), (u.coneOuterAngle = c.coneOuterAngle), (u.coneOuterGain = c.coneOuterGain), (u.distanceModel = c.distanceModel), (u.maxDistance = c.maxDistance), (u.refDistance = c.refDistance), (u.rolloffFactor = c.rolloffFactor), (u.panningModel = c.panningModel)) : (n._pos || (n._pos = this._pos || [0, 0, -0.5]), t(n, "spatial")); } return this; }), (Sound.prototype.init = (function (e) { return function () { var t = this._parent; (this._orientation = t._orientation), (this._stereo = t._stereo), (this._pos = t._pos), (this._pannerAttr = t._pannerAttr), e.call(this), this._stereo ? t.stereo(this._stereo) : this._pos && t.pos(this._pos[0], this._pos[1], this._pos[2], this._id); }; })(Sound.prototype.init)), (Sound.prototype.reset = (function (e) { return function () { var t = this._parent; return ( (this._orientation = t._orientation), (this._stereo = t._stereo), (this._pos = t._pos), (this._pannerAttr = t._pannerAttr), this._stereo ? t.stereo(this._stereo) : this._pos ? t.pos(this._pos[0], this._pos[1], this._pos[2], this._id) : this._panner && (this._panner.disconnect(0), (this._panner = void 0), t._refreshBuffer(this)), e.call(this) ); }; })(Sound.prototype.reset)); var t = function (e, t) { "spatial" === (t = t || "spatial") ? ((e._panner = Howler.ctx.createPanner()), (e._panner.coneInnerAngle = e._pannerAttr.coneInnerAngle), (e._panner.coneOuterAngle = e._pannerAttr.coneOuterAngle), (e._panner.coneOuterGain = e._pannerAttr.coneOuterGain), (e._panner.distanceModel = e._pannerAttr.distanceModel), (e._panner.maxDistance = e._pannerAttr.maxDistance), (e._panner.refDistance = e._pannerAttr.refDistance), (e._panner.rolloffFactor = e._pannerAttr.rolloffFactor), (e._panner.panningModel = e._pannerAttr.panningModel), void 0 !== e._panner.positionX ? (e._panner.positionX.setValueAtTime( e._pos[0], Howler.ctx.currentTime ), e._panner.positionY.setValueAtTime( e._pos[1], Howler.ctx.currentTime ), e._panner.positionZ.setValueAtTime( e._pos[2], Howler.ctx.currentTime )) : e._panner.setPosition(e._pos[0], e._pos[1], e._pos[2]), void 0 !== e._panner.orientationX ? (e._panner.orientationX.setValueAtTime( e._orientation[0], Howler.ctx.currentTime ), e._panner.orientationY.setValueAtTime( e._orientation[1], Howler.ctx.currentTime ), e._panner.orientationZ.setValueAtTime( e._orientation[2], Howler.ctx.currentTime )) : e._panner.setOrientation( e._orientation[0], e._orientation[1], e._orientation[2] )) : ((e._panner = Howler.ctx.createStereoPanner()), e._panner.pan.setValueAtTime( e._stereo, Howler.ctx.currentTime )), e._panner.connect(e._node), e._paused || e._parent.pause(e._id, true).play(e._id, true); }; })(); }.call(this, i(41), i(15))); }, function (e, t, i) { "use strict"; e.exports = function () { return (function () { var e = 2, t = window.innerWidth, i = window.innerHeight, n = document.createElement("canvas"); (n.width = t), (n.height = i); var r = n.getContext("2d"); r.imageSmoothingEnabled = false; var o = document.getElementById("progress"); o.appendChild(n), (o.style.width = t + "px"), (o.style.height = i + "px"); var a = document.createElement("canvas"); (a.width = 128), (a.height = 128); var s = a.getContext("2d"); s.imageSmoothingEnabled = false; var c = 0, u = new Image(); (u.onload = function () { ++c >= 1 && (s.drawImage(this, 0, 0, 128, 128), (s.fillStyle = "rgba(0,0,0,0.7)"), s.fillRect(0, 0, 128, 128), (l = r.createPattern(a, "repeat")), h.redraw()); }), (u.src = "assets/textures/dirt.png"); var l = r.createPattern(a, "repeat"), h = { headline: "Generating level", task: "", percent: 0, isOpen: true, show: function () { (h.isOpen = true), h.redraw(), (o.style.display = "block"); }, hide: function () { (h.isOpen = false), (o.style.display = "none"); }, tick: function () { h.redraw(); }, redraw: function () { r.clearRect(0, 0, t, i), (r.fillStyle = "rgb(0,0,0)"), (r.fillStyle = l), r.fillRect(0, 0, t, i); var n = Math.floor(0.5 * i) - 25 * e, o = Math.floor(0.5 * t); (r.font = 14 * e + "px Minecraft"), (r.textBaseline = "alphabetic"), (r.textAlign = "center"); var a = 2 * e; (r.fillStyle = "rgb(63,63,63)"), r.fillText(h.headline, o + a, n + a), r.fillText(h.task, o + a, n + 50 * e + a), (r.fillStyle = "rgb(255,255,255)"), r.fillText(h.headline, o, n), r.fillText(h.task, o, n + 50 * e), (r.fillStyle = "rgb(128,128,128)"), r.fillRect(o - 100 * e, n + 60 * e, 200 * e, 4 * e); var s = Math.min(1, h.percent / 100); (r.fillStyle = "rgb(128,255,128)"), r.fillRect( o - 100 * e, n + 60 * e, Math.round(200 * s) * e, 4 * e ); }, resize: function () { if (h.isOpen) { (e = 2), window.innerHeight < 600 && (e = 1), (t = window.innerWidth), (i = window.innerHeight), (n.width = t), (n.height = i), (o.style.width = t + "px"), (o.style.height = i + "px"), (r.imageSmoothingEnabled = false), h.redraw(); } }, }; return h.resize(), h.hide(), h; })(hotbar); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { return (function (e) { var t = 0, i = [2, 3, 4, 9, 11, 12, 13, 14, 15], n = 3, r = document.createElement("canvas"); (r.width = 184 * n), (r.height = 24 * n); var o = r.getContext("2d"); o.imageSmoothingEnabled = false; var a = document.getElementById("hotbar"); a.appendChild(r), (a.style.width = 184 * n + "px"), (a.style.marginLeft = -184 * n * 0.5 + "px"); var s = 0, c = 0, u = function () { ++s >= c && g.redraw(); }, l = new Image(); (l.onload = u), (l.src = "assets/textures/hotbar_bg.png"); var h = new Image(); (h.onload = u), (h.src = "assets/textures/hotbar_selection.png"); var f = [ 2, 9, 3, 4, 13, 14, 8, 6, 5, 16, 15, 11, 12, 23, 22, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, ], d = []; c = f.length + 2; for (var p = 0; p < f.length; p++) { var m = new Image(); (m.onload = u), (m.src = "assets/textures/previews/" + f[p] + ".png"), (d[f[p]] = m); } e.on("tick", function (n) { var r = noa.inputs.state.scrolly; if (!(Math.abs(r) < 200)) { noa.inputs.state.scrolly = 0; var o = r > 0 ? -1 : 1, a = t - o; a < 0 && (a = 8), a > 8 && (a = 0), (t = a), g.redraw(), (g.currentId = i[t]), e.emit("setPreviewBlock", g.currentId); } }); var g = { currentId: i[t], setIndex: function (e) { e < 0 || e > 8 || ((t = e), (this.currentId = i[t]), this.redraw()); }, swap: function (n, r) { var o = r || t; null == r && this.checkExistingSwap(n, i[o], o), (i[o] = n), null == r && ((this.currentId = i[t]), e.emit("setPreviewBlock", n)), this.redraw(); }, checkExistingSwap: function (e, t, n) { for (var r = 0; r < i.length; r++) if (r != n) { var o = i[r]; if (o == e) { this.swap(t, r); break; } } }, pick: function (e) { for (var t = false, n = 0; n < i.length; n++) { var r = i[n]; if (r == e) { this.setIndex(n), (t = true); break; } } t ? this.redraw() : this.swap(e); }, redraw: function () { o.clearRect(0, 0, 184 * n, 24 * n), o.drawImage(l, 1 * n, 1 * n, 182 * n, 22 * n); for (var e = 0; e < i.length; e++) { var r = d[i[e]], a = e * (20 * n) + 4 * n; o.drawImage(r, a, 4 * n, 16 * n, 16 * n); } var a = t * (20 * n); o.drawImage(h, a, 0, 24 * n, 24 * n); }, resize: function () { var e = n; (n = 3), window.innerHeight < 600 && (n = 2), n != e && ((r.width = 184 * n), (r.height = 24 * n), (a.style.width = 184 * n + "px"), (a.style.marginLeft = -184 * n * 0.5 + "px"), (o.imageSmoothingEnabled = false), g.redraw()); }, }; return g.resize(), g; })(e); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { return (function (e) { var t = 1, i = false, n = { x: 0, y: 0, }, r = { x: 0, y: 0, }, o = document.createElement("canvas"); (o.width = 480 * t), (o.height = 300 * t); var a = o.getContext("2d"); a.imageSmoothingEnabled = false; var s = document.getElementById("previewWindow"); s.appendChild(o), (s.style.width = 480 * t + "px"), (s.style.height = 300 * t + "px"); var c = 0, u = 0, l = function () { ++c >= u && m.redraw(); }, h = [ 2, 9, 3, 4, 13, 14, 8, 6, 5, 16, 15, 11, 12, 23, 22, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, ], f = []; u = h.length; for (var d = 0; d < h.length; d++) { var p = new Image(); (p.onload = l), (p.src = "assets/textures/previews/" + h[d] + ".png"), (f[d] = p); } var m = { isOpen: false, open: function () { (i = false), m.redraw(), (s.style.display = "block"), s.addEventListener("mousemove", this.mousemove, false), document.addEventListener("mousedown", this.select, false), document.exitPointerLock(), (m.isOpen = true); }, close: function () { (s.style.display = "none"), s.removeEventListener("mousemove", this.mousemove), document.removeEventListener("mousedown", this.select); var e = document.getElementById("noa-container"); null != e && e.requestPointerLock(), (m.isOpen = false); }, mousemove: function (e) { var o = (function (e) { var t = e.target, i = 0, n = 0; for (; t && !isNaN(t.offsetLeft) && !isNaN(t.offsetTop); ) (i += t.offsetLeft - t.scrollLeft), (n += t.offsetTop - t.scrollTop), (t = t.offsetParent); return ( (i = e.clientX - i), (n = e.clientY - n), { x: i, y: n, } ); })(e), a = o.x, s = o.y, c = Math.floor((a + 8 * t) / (50 * t)) - 1, u = Math.floor((s + 32 * t) / (50 * t)) - 2; c < 0 || c > 7 || u < 0 || u > 3 ? i && ((i = false), (n.x = null), (n.y = null), m.redraw()) : ((r.x = n.x), (r.y = n.y), (i = true), (n.x = c), (n.y = u), (n.x == r.x && n.y == r.y) || m.redraw()); }, select: function (t) { if ((m.close(), i)) { var r = 8 * n.y + n.x, o = h[r]; e.swap(o); } }, redraw: function () { a.clearRect(0, 0, 480 * t, 300 * t), (a.fillStyle = "rgba(0,0,0,0.6)"), a.fillRect(0, 0, 480 * t, 300 * t), (function (e, i, n) { (a.font = 16 * t + "px Minecraft"), (a.textBaseline = "alphabetic"), (a.textAlign = "center"); var r = 2 * t; (a.fillStyle = "rgb(63,63,63)"), a.fillText(e, i + r, n + r), (a.fillStyle = "rgb(255,255,255)"), a.fillText(e, i, n); })("Select block", 480 * t * 0.5, 40 * t); var e = 48 * t, r = 82 * t, o = null; if (i) { a.fillStyle = "rgba(255,255,255,0.6)"; var s = n.x * (50 * t) + e - 10 * t, c = n.y * (50 * t) + r - 10 * t; a.fillRect(s, c, 52 * t, 52 * t), (o = 8 * n.y + n.x); } for (var s = 0, c = 0, u = 0; u < h.length; u++) { var l = f[u], d = 32, p = 0; u == o && ((d = 52), (p = 10)); var m = s * (50 * t) + e - p * t, g = c * (50 * t) + r - p * t; a.drawImage(l, m, g, d * t, d * t), ++s >= 8 && (++c, (s = 0)); } }, resize: function () { var e = t; (t = 2), window.innerHeight < 900 && (t = 1), t != e && ((o.width = 480 * t), (o.height = 300 * t), (s.style.width = 480 * t + "px"), (s.style.height = 300 * t + "px"), (a.imageSmoothingEnabled = false), m.redraw()); }, }; return m.close(), m.resize(), m; })(e); }; }, function (e, t, i) { "use strict"; var n = i(7).default, r = i(136).default, o = i(190); e.exports = function (e, t) { return (function (e, t, i) { var r = 2, a = r + 1, s = window.innerWidth, c = window.innerHeight, u = null, l = Math.floor(0.5 * c) - 120 * r, h = Math.floor(0.5 * s), f = null, d = false, p = document.createElement("canvas"); (p.width = s), (p.height = c); var m = p.getContext("2d"); m.imageSmoothingEnabled = false; var g = document.getElementById("menu"); g.appendChild(p), (g.style.width = s + "px"), (g.style.height = c + "px"); var _ = new t().isWebRTCSupported, v = new URLSearchParams(window.location.search), y = window.location.href; v.has("size") && v.delete("size"); if (v.has("host")) { y = window.location.href.split("?")[0]; var b = v.get("host"); v.delete("host"), v.append("join", b), (y += "?" + v.toString()); } document.querySelector(".js-copytextarea").value = y; var E = new Image(); E.src = "assets/textures/button.png"; var T = new Image(); T.src = "assets/textures/button_over.png"; var A = function (e, t, i, n) { (m.font = 12 * r + "px Minecraft"), (m.textBaseline = "alphabetic"), (m.textAlign = "center"); var o = 2 * r; (m.fillStyle = "rgb(63,63,63)"), m.fillText(e, t + o, i + o), (m.fillStyle = n || "rgb(255,255,255)"), m.fillText(e, t, i); }, x = function (e, t, i, n) { return { str: e, x: t, y: i, over: false, func: n, widthscale: 1, key: null, draw: function () { var e = E; this.over && (e = T), m.drawImage( e, h + this.x * r - 0.5 * E.width * a * this.widthscale, l + this.y * r, E.width * a * this.widthscale, E.height * a ); var t = "rgb(255,255,255)"; this.over && (t = "rgb(255,255,160)"), A(this.str, h + this.x * r, l + this.y * r + 19 * r, t); }, }; }, S = function () { (F = B), _e.redraw(), (u = null); }, C = function () { null != f && (O(), (f = null)); var t = "FAR"; 1 == e.settings.drawDistance && (t = "NORMAL"), 2 == e.settings.drawDistance && (t = "SHORT"), 3 == e.settings.drawDistance && (t = "TINY"), (q.str = "Render distance: " + t), (F = H), _e.redraw(), (u = null); }; function P() { var e = document.querySelector(".js-copytextarea"); e.focus(), e.select(), (d = true), _e.redraw(), setTimeout(function () { (d = false), _e.redraw(); }, 250); try { document.execCommand("copy"); } catch (e) {} } var R = function (e) { var t = new URLSearchParams(window.location.search), i = window.location.href.split("?")[0]; t.has("size") ? t.set("size", e) : t.append("size", e), t.has("join") && t.delete("join"), n.getInstance().clearData(); var r = 128; "small" == e && (r = 128), "normal" == e && (r = 256), "huge" == e && (r = 512), n.getInstance().setWorldSize(r), (i += "?" + t.toString()), (window.location.href = i); }, M = function () { null != f && O(), (f = u); var e = F[u], t = e.str, i = "> " + t + " <"; (e.str = i), (e.over = true), e.draw(), w(); }, O = function () { var e = F[f], t = e.str, i = t.substring(2, t.length - 2); (e.str = i), e.draw(), (f = null), I(); }, w = function () { document.addEventListener("keydown", D, false); }, I = function () { document.removeEventListener("keydown", D); }, D = function (t) { var i = o[t.keyCode]; !(function (t) { var i = F[f].key; e.inputs.unbind(i), e.inputs.bind(i, t), (e.settings[i] = t), e.emit("saveSettings"); })(i), (function (e) { var t = F[f]; if (null == t.key) return void O(); var i = t.str, n = i.substring(2, i.length - 2).split(":")[0] + ": " + e.toUpperCase(); (t.str = n), t.draw(), (f = null), I(); })((i = L(i))); }; function L(e) { var t = e.indexOf(">"); 0 == t && (e = e.substring(1, e.length)); var i = e.lastIndexOf("<"); return i == e.length - 1 && (e = e.substring(0, i)), e; } var F = null, B = [], N = x("Options...", 0, 20, C); B.push(N); var k = x("Generate new level...", 0, 60, function () { (F = $), _e.redraw(), (u = null); }); if ((B.push(k), !_ || i)) { var U = x("Save level..", 0, 100, function () { (F = re), _e.redraw(), (u = null); }); B.push(U); var V = x("Load level..", 0, 140, function () { (F = oe), _e.redraw(), (u = null); }); B.push(V); } else { var G = x("Copy", 0, 140, P); B.push(G); var z = x("Copy Hidden", 0, 100, P); B.push(z); } var j = x("Back to game", 0, 230, function () { _e.close(); }); B.push(j); var H = [], W = "ON"; e.settings.music || (W = "OFF"); var X = x("Music: " + W, 0, -20, function () { e.emit("toggleMusic"); var t = "ON"; e.settings.music || (t = "OFF"); (X.str = "Music: " + t), (X.over = true), _e.redraw(); }); H.push(X); var W = "ON"; e.settings.sound || (W = "OFF"); var Y = x("Sound: " + W, 0, 20, function () { e.emit("toggleSound"); var t = "ON"; e.settings.sound || (t = "OFF"); (Y.str = "Sound: " + t), (Y.over = true), _e.redraw(); }); H.push(Y); var W = "ON"; e.settings.invert || (W = "OFF"); var K = x("Invert mouse: " + W, 0, 60, function () { e.emit("toggleInvertMouse"); var t = "ON"; e.settings.invert || (t = "OFF"); (K.str = "Invert mouse: " + t), (K.over = true), _e.redraw(); }); H.push(K); var W = "ON"; e.settings.fps || (W = "OFF"); var Q = x("Show FPS: " + W, 0, 100, function () { e.emit("toggleFps"); var t = "ON"; e.settings.fps || (t = "OFF"); (Q.str = "Show FPS: " + t), (Q.over = true), _e.redraw(); }); H.push(Q); var q = x("Render distance: FAR", 0, 140, function () { e.emit("cycleDrawDistance"); var t = "FAR"; 1 == e.settings.drawDistance && (t = "NORMAL"); 2 == e.settings.drawDistance && (t = "SHORT"); 3 == e.settings.drawDistance && (t = "TINY"); (q.str = "Render distance: " + t), (q.over = true), _e.redraw(); }); H.push(q); var Z = x("Controls...", 0, 200, function () { (F = ae), _e.redraw(), (u = null); }); H.push(Z); var J = x("Done", 0, 260, S); H.push(J); var $ = [], ee = x("Small", 0, 50, function () { R("small"); }); $.push(ee); var te = x("Normal", 0, 100, function () { R("normal"); }); $.push(te); var ie = x("Huge", 0, 150, function () { R("huge"); }); $.push(ie); var ne = x("Cancel", 0, 200, S); $.push(ne); var re = [], ne = x("Cancel", 0, 260, S); re.push(ne); var oe = [], ne = x("Cancel", 0, 260, S); oe.push(ne); var ae = [], se = x( "Forward: " + L(e.settings.forward).toUpperCase(), -115, -20, M ); ae.push(se); var ce = x("Left: " + L(e.settings.left).toUpperCase(), 115, -20, M); ae.push(ce); var j = x("Back: " + L(e.settings.backward).toUpperCase(), -115, 20, M); ae.push(j); var ue = x("Right: " + L(e.settings.right).toUpperCase(), 115, 20, M); ae.push(ue); var le = x("Jump: " + L(e.settings.jump).toUpperCase(), -115, 60, M); ae.push(le); var he = x("Build: " + L(e.settings.build).toUpperCase(), 115, 60, M); ae.push(he); var fe = x("Chat: " + L(e.settings.chat).toUpperCase(), -115, 100, M); ae.push(fe); var de = x( "Toggle fog: " + L(e.settings.fog).toUpperCase(), 115, 100, M ); ae.push(de); var pe = x( "Save location: " + L(e.settings.saveLoc).toUpperCase(), -115, 140, M ); ae.push(pe); var me = x( "Load location: " + L(e.settings.loadLoc).toUpperCase(), 115, 140, M ); ae.push(me); (se.widthscale = 0.7), (ce.widthscale = 0.7), (j.widthscale = 0.7), (ue.widthscale = 0.7), (le.widthscale = 0.7), (he.widthscale = 0.7), (fe.widthscale = 0.7), (de.widthscale = 0.7), (pe.widthscale = 0.7), (me.widthscale = 0.7), (se.key = "forward"), (ce.key = "left"), (j.key = "backward"), (ue.key = "right"), (le.key = "jump"), (he.key = "build"), (fe.key = "chat"), (de.key = "fog"), (pe.key = "saveLoc"), (me.key = "loadLoc"); var J = x("Done", 0, 260, C); ae.push(J), (F = B); var ge = "ontouchstart" in window || navigator.msMaxTouchPoints, _e = { isOpen: false, mouseIsOut: false, open: function () { ge || ((F = B), _e.redraw(), (g.style.display = "block"), g.addEventListener("mousemove", this.mousemove, false), g.addEventListener("mouseout", this.mouseout), document.addEventListener("mousedown", this.press, false), document.exitPointerLock(), (_e.isOpen = true), (e.inputs.state.active = false)); }, close: function (t) { if (!ge) { if ( (null != f && (O(), (f = null)), (g.style.display = "none"), g.removeEventListener("mousemove", this.mousemove), g.removeEventListener("mouseout", this.mouseout), document.removeEventListener("mousedown", this.press), !t) ) { var i = document.getElementById("noa-container"); setTimeout(function () { null == i || _e.mouseIsOut || i.requestPointerLock(); }, 200); } (_e.isOpen = false), (e.inputs.state.active = true); } }, mouseout: function (e) { _e.mouseIsOut = true; }, mousemove: function (e) { _e.mouseIsOut = false; for ( var t = e.layerX, i = e.layerY, n = null, o = 0; o < F.length; o++ ) { var s = F[o]; s.over = false; var c = h + s.x * r - 0.5 * E.width * a, f = l + s.y * r, d = c + E.width * a, p = f + E.height * a; if (t > c && t < d && i > f && i < p) { n = o; break; } } null != n && n != u && ((F[n].over = true), _e.redraw()), null == n && null != u && ((F[u].over = false), _e.redraw()), (u = n); }, press: function (e) { if (null != F[u]) { var t = F[u].func; null != t && t(); } }, redraw: function () { m.clearRect(0, 0, s, c), (m.strokeStyle = "rgba(255,255,255,1)"), (m.lineWidth = r), (m.fillStyle = "rgba(0,0,0,0.6)"), m.fillRect(0, 0, s, c); var e = Math.floor(0.5 * c) - 120 * r, t = Math.floor(0.5 * s), i = "Game menu"; F == H && ((i = "Options"), (e -= 40 * r)), F == $ && (i = "Generate new level"), F == re && (i = "Save level"), F == oe && (i = "Load level"), F == ae && ((i = "Controls"), (e -= 40 * r)), A(i, t, e), (F != re && F != oe) || A("", t, e + 120 * r); for (var n = 0; n < F.length; n++) F[n].draw(); if (F == B && _) { var o = 300 * r, a = 30 * r; (m.fillStyle = "rgba(0,0,0,1)"), d && (m.fillStyle = "rgba(127,127,127,1)"), m.fillRect(0.5 * s - 0.5 * o, 0.5 * c - 20 * r, o, a), m.save(), m.rect(0.5 * s - 0.5 * o, 0.5 * c - 20 * r, o, a), m.clip(), A(y, t, 0.5 * c - 0 * r), m.restore(), m.strokeRect(0.5 * s - 0.5 * o, 0.5 * c - 20 * r, o, a); } }, resize: function () { (r = 2), window.innerHeight < 600 && (r = 1), (a = 1.5 * r), (s = window.innerWidth), (c = window.innerHeight), (l = Math.floor(0.5 * c) - 120 * r), (h = Math.floor(0.5 * s)), (p.width = s), (p.height = c), (g.style.width = s + "px"), (g.style.height = c + "px"), (m.imageSmoothingEnabled = false), _e.isOpen && _e.redraw(); }, }; return _e.resize(), _e.close(), _e; })(e, r, t); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { return (function (e) { var t = 2, i = document.createElement("canvas"); (i.width = 256 * t), (i.height = 34 * t); var n = i.getContext("2d"); n.imageSmoothingEnabled = false; var r = document.getElementById("version"); r.appendChild(i), (r.style.width = 256 * t + "px"), (r.style.height = 34 * t + "px"); var o = { showFps: false, fps: 0, chunkUpdates: 0, lastRedraw: 0, redrawInterval: 1e3, redraw: function () { if (!(performance.now() < o.lastRedraw + o.redrawInterval)) { (o.lastRedraw = performance.now()), n.clearRect(0, 0, 256 * t, 34 * t), (n.font = 14 * t + "px Minecraft, sans-serif"), (n.textBaseline = "alphabetic"), (n.textAlign = "left"); var e = 0 * t, i = 13 * t, r = 2 * t; (n.fillStyle = "rgb(63,63,63)"), n.fillText("0.0.23a_01", e + r, i + r), o.showFps && n.fillText( o.fps + " fps, " + o.chunkUpdates + " chunk updates", e + r, 2 * i + 4 * t + r ), (n.fillStyle = "rgb(255,255,255)"), n.fillText("0.0.23a_01", e, i), o.showFps && n.fillText( o.fps + " fps, " + o.chunkUpdates + " chunk updates", e, 2 * i + 4 * t ), (o.chunkUpdates = 0); } }, resize: function () { var e = t; (t = 2), window.innerHeight < 600 && (t = 1), t != e && ((i.width = 256 * t), (i.height = 34 * t), (r.style.width = 256 * t + "px"), (r.style.height = 34 * t + "px"), (n.imageSmoothingEnabled = false), (o.lastRedraw = 0), o.redraw()); }, }; return o.resize(), o.redraw(), o; })(); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { var t = e.rendering.getScene(), i = BABYLON.MeshBuilder.CreatePlane( "plane", { height: 2e3, width: 2e3, }, t ); return ( (i.material = e.rendering.makeStandardMaterial("cloudMat")), (i.material.diffuseTexture = new BABYLON.Texture( "assets/textures/clouds.png", t, true, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (i.material.diffuseTexture.anisotropicFilteringLevel = 8), (i.material.emissiveColor = new BABYLON.Color3(1, 1, 1)), (i.material.backFaceCulling = false), (i.material.disableLighting = true), (i.rotation.x = -Math.PI / 2), (i.position = new BABYLON.Vector3(0, 68, 0)), e.rendering.addDynamicMesh(i), i ); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { var t = BABYLON.MeshBuilder.CreatePlane( "crosshair", { height: 0.035, width: 0.035, }, scene ); (t.material = e.rendering.makeStandardMaterial("crosshairMat")), (t.material.diffuseTexture = new BABYLON.Texture( "assets/textures/crosshair.png", scene )), (t.material.diffuseTexture.wrapU = BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE), (t.material.diffuseTexture.wrapV = BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE), (t.material.emissiveColor = new BABYLON.Color3(1, 1, 1)), (t.material.diffuseTexture.hasAlpha = true), t.material.freeze(), (t.position = new BABYLON.Vector3(0, 0, 0.8)), (t.renderingGroupId = 2), (t.parent = scene.activeCamera), (t.alwaysSelectAsActiveMesh = true), e.rendering.addDynamicMesh(t); }; }, function (e, t, i) { "use strict"; e.exports = function (e, t) { var n = function (e, t, i) { var n, r = e.getVerticesData(BABYLON.VertexBuffer.UVKind), o = r.length; if (1 !== t) for (n = 0; n < o; n += 2) r[n] *= t; if (1 !== i) for (n = 1; n < o; n += 2) r[n] *= i; e.setVerticesData(BABYLON.VertexBuffer.UVKind, r); }, r = 4 * e.worldSize, o = 1 * e.worldSize + 2 * t, a = BABYLON.MeshBuilder.CreatePlane( "bedrock", { height: o, width: r, }, scene ); ((u = e.rendering.flatMaterial.clone("bedrockMat")).diffuseTexture = new BABYLON.Texture( "assets/textures/bedrock.png", scene, true, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (u.diffuseTexture.anisotropicFilteringLevel = 1), (u.diffuseTexture.uScale = r), (u.diffuseTexture.vScale = o), (u.diffuseColor = new BABYLON.Color3(0.6, 0.6, 0.6)), (a.rotation.x = Math.PI / 2), (a.position = new BABYLON.Vector3( 0.5 * -r - t, e.waterLevel - 1, 0.5 * o - t )), (a.material = u), e.rendering.addDynamicMesh(a), ((c = BABYLON.MeshBuilder.CreatePlane( "bedrock", { height: o, width: r, }, scene )).position = new BABYLON.Vector3( e.worldSize + 0.5 * r + t, e.waterLevel - 1, 0.5 * o - t )), (c.material = u), (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); var r = 9 * e.worldSize + 2 * t, o = 4 * e.worldSize, a = BABYLON.MeshBuilder.CreatePlane( "bedrock", { height: o, width: r, }, scene ); ((u = e.rendering.flatMaterial.clone("bedrockMat")).diffuseTexture = new BABYLON.Texture( "assets/textures/bedrock.png", scene, true, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (u.diffuseTexture.anisotropicFilteringLevel = 1), (u.diffuseTexture.uScale = r), (u.diffuseTexture.vScale = o), (u.diffuseColor = new BABYLON.Color3(0.6, 0.6, 0.6)), (a.rotation.x = Math.PI / 2), (a.position = new BABYLON.Vector3( 0.5 * e.worldSize, e.waterLevel - 1, 0.5 * -o - t )), (a.material = u), e.rendering.addDynamicMesh(a), ((c = BABYLON.MeshBuilder.CreatePlane( "bedrock", { height: o, width: r, }, scene )).position = new BABYLON.Vector3( 0.5 * e.worldSize, e.waterLevel - 1, 1 * e.worldSize + 0.5 * o + t )), (c.material = u), (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); var r = 4 * e.worldSize, o = 1 * e.worldSize + 2 * t, s = i(189)(e), a = BABYLON.MeshBuilder.CreatePlane( "water", { height: o, width: r, }, scene ); n(a, r, o), ((u = e.rendering.flatMaterial.clone("waterMat")).alpha = 0.85), (u.diffuseTexture = s.texture), (u.useAlphaFromDiffuseTexture = true), (u.backFaceCulling = false), (a.rotation.x = Math.PI / 2), (a.position = new BABYLON.Vector3( 0.5 * -r - t, e.waterLevel + 1 - 0.07, 0.5 * o - t )), (a.material = u), e.rendering.addDynamicMesh(a); var c = BABYLON.MeshBuilder.CreatePlane( "water", { height: o, width: r, }, scene ); n(c, r, o), (c.position = new BABYLON.Vector3( e.worldSize + 0.5 * r + t, e.waterLevel + 1 - 0.07, 0.5 * o - t )), (c.material = u), (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); var u, r = 9 * e.worldSize + 2 * t, o = 4 * e.worldSize, a = BABYLON.MeshBuilder.CreatePlane( "water", { height: o, width: r, }, scene ); n(a, r, o), ((u = e.rendering.flatMaterial.clone("waterMat")).alpha = 0.85), (u.diffuseTexture = s.texture), (u.useAlphaFromDiffuseTexture = true), (u.diffuseTexture.anisotropicFilteringLevel = 1), (u.backFaceCulling = false), (a.rotation.x = Math.PI / 2), (a.position = new BABYLON.Vector3( 0.5 * e.worldSize, e.waterLevel + 1 - 0.07, 0.5 * -o - t )), (a.material = u), e.rendering.addDynamicMesh(a); var c = BABYLON.MeshBuilder.CreatePlane( "water", { height: o, width: r, }, scene ); n(c, r, o), (c.position = new BABYLON.Vector3( 0.5 * e.worldSize, e.waterLevel + 1 - 0.07, 1 * e.worldSize + 0.5 * o + t )), (c.material = u), (c.rotation.x = Math.PI / 2), e.rendering.addDynamicMesh(c); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { var t = e.rendering.getScene(), i = 0.25 * Math.PI, n = BABYLON.Mesh.CreatePlane("plane1", 1, t), r = BABYLON.Mesh.CreatePlane("plane2", 1, t); (n.rotation.y = i), (r.rotation.y = Math.PI + i); var o = BABYLON.Mesh.CreatePlane("plane3", 1, t), a = BABYLON.Mesh.CreatePlane("plane4", 1, t); return ( (o.rotation.y = 0.5 * -Math.PI + i), (a.rotation.y = 0.5 * Math.PI + i), (n.position = new BABYLON.Vector3(0, 0.5, 0)), (r.position = new BABYLON.Vector3(0, 0.5, 0)), (o.position = new BABYLON.Vector3(0, 0.5, 0)), (a.position = new BABYLON.Vector3(0, 0.5, 0)), BABYLON.Mesh.MergeMeshes([n, r, o, a]) ); }; }, function (e, t, i) { "use strict"; e.exports = function (e) { var t = e.rendering.getScene(), i = BABYLON.Mesh.CreatePlane("plane1", 1, t); return ( (i.rotation.x = 0.5 * -Math.PI), (i.position = new BABYLON.Vector3(0, 1 - 0.07, 0)), BABYLON.Mesh.MergeMeshes([i]) ); }; }, function (e, t, i) { "use strict"; e.exports = function (e, t) { var i = {}; return ( (i.setBlock = function (i) { var n = t[i], r = e.registry.getBlockFaceMaterialAccessor(); if (e.rendering._previewMesh) { var o = r(n, 0), a = e.registry._matData[o]; (e.rendering._previewMesh.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (e.rendering._previewMesh.material.diffuseTexture.hasAlpha = true); var s = e.rendering._previewMesh._children[0], c = e.rendering._previewMesh._children[1], u = e.rendering._previewMesh._children[2], l = e.rendering._previewMesh._children[3], h = e.rendering._previewMesh._children[4]; (o = r(n, 1)), (a = e.registry._matData[o]), (s.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (s.material.diffuseTexture.hasAlpha = true), (o = r(n, 4)), (a = e.registry._matData[o]), (c.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (c.material.diffuseTexture.hasAlpha = true), (o = r(n, 5)), (a = e.registry._matData[o]), (u.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (u.material.diffuseTexture.hasAlpha = true), (o = r(n, 2)), (a = e.registry._matData[o]), (h.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (h.material.diffuseTexture.hasAlpha = true), (o = r(n, 3)), (a = e.registry._matData[o]), (l.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (l.material.diffuseTexture.hasAlpha = true), (o = r(n, 1)), (a = e.registry._matData[o]); var f = e.rendering._previewMesh._children[6]; (f.material.diffuseTexture = new BABYLON.Texture( a.texture, e.rendering._scene, false, true, BABYLON.Texture.NEAREST_SAMPLINGMODE )), (f.material.diffuseTexture.hasAlpha = true), (f.material.opacityTexture = f.material.diffuseTexture), (e.rendering._previewMesh.material.opacityTexture = e.rendering._previewMesh.material.diffuseTexture), (s.material.opacityTexture = s.material.diffuseTexture), (c.material.opacityTexture = c.material.diffuseTexture), (u.material.opacityTexture = u.material.diffuseTexture), (l.material.opacityTexture = l.material.diffuseTexture), (h.material.opacityTexture = h.material.diffuseTexture), 8 == n || 5 == n || 6 == n || 15 == n || 16 == n ? ((e.rendering._previewMesh.isVisible = false), (s.isVisible = false), (c.isVisible = false), (u.isVisible = false), (l.isVisible = false), (h.isVisible = false), (f.isVisible = true)) : ((e.rendering._previewMesh.isVisible = true), (s.isVisible = true), (c.isVisible = true), (u.isVisible = true), (l.isVisible = true), (h.isVisible = true), (f.isVisible = false)); } }), i ); }; }, function (e, t, i) { "use strict"; e.exports = function (e, t, n, r) { var o = i(195)(e), a = e.entities.add([t, n, r], 0.8, 1.8, o, [0, 1, 0], true, false), s = e.entities.getPhysicsBody(a); (s.friction = 1), (s.gravityMultiplier = 2); var c = i(511)(e); return (c.state.id = a), c; }; }, function (e, t, i) { "use strict"; e.exports = function (e) { return { name: "steveAI", state: { id: null, lastJump: 0.1, stand_frame: "", jump_frame: "", direction: Math.random() * Math.PI * 2, lifetime: 6e4, starttime: performance.now(), shouldRemove: false, }, remove: function () { e.entities.removeComponent(this.state.id, e.entities.names.mesh), e.entities.removeComponent( this.state.id, e.entities.names.position ), e.entities.removeComponent(this.state.id, e.entities.names.physics); }, tick: function (t) { var i = performance.now(), n = this.state.id; if (i > this.state.starttime + this.state.lifetime) this.state.shouldRemove = true; else { var r = e.entities.getPhysicsBody(n), o = r.resting[1] < 0, a = (o ? this.state.stand_frame : this.state.jump_frame, e.entities.getMeshData(n).mesh); this.state.direction += Math.sin(1e-6 * i) * (Math.random() - 0.5); var s = 3 * Math.sin(this.state.direction), c = 3 * Math.cos(this.state.direction); r.applyForce([s, 0, c]), a.animate(t); Math.atan2(r.velocity[0], r.velocity[2]); if ( ((a.rotation.y = this.state.direction), i > this.state.lastJump + 500 && o && Math.random() < 0.05) ) { r.applyImpulse([0, 7, 0]), (this.state.lastJump = i); } } }, }; }; }, function (e, t, i) { "use strict"; e.exports = function (e, t, n, r, o, a) { var s = i(195)(e), c = e.entities.add([t, n, r], 0.8, 1.8, s, [0, 1, 0], true, false); e.entities.addComponent(c, e.entities.names.collideTerrain); var u = (function (e, t) { var i = new BABYLON.DynamicTexture( t, { width: 256, height: 32, }, e.rendering._scene, true, false, BABYLON.Texture.NEAREST_SAMPLINGMODE ); (i.hasAlpha = true), (i.getAlphaFromRGB = true); var n = i.getContext(); (n.font = "24px Minecraft"), (n.textBaseline = "alphabetic"), (n.textAlign = "center"); return ( (n.fillStyle = "rgb(63,63,63)"), n.fillText(t, 130, 22), (n.fillStyle = "rgb(255,255,255)"), n.fillText(t, 128, 20), i.update(), i ); })(e, o), l = BABYLON.MeshBuilder.CreatePlane( o, { height: 0.16, width: 1.28, }, e.rendering._scene ); (l.material = noa.rendering.makeStandardMaterial(o + "Mat")), (l.material.diffuseTexture = u), (l.parent = s), (l.material.diffuseTexture.anisotropicFilteringLevel = 0), (l.billboardMode = BABYLON.Mesh.BILLBOARDMODE_Y), (l.position = new BABYLON.Vector3(0, 1.05, 0)), e.rendering.addDynamicMesh(l); var h = {}; return ( (h.name = o), (h.id = a), (h.noa_id = c), (h.mesh = s), (h.walking = false), (h.tick = function (e) { (s.walking = h.walking), s.animate(e); }), (h.setPosition = function (t, i, n) { e.entities.setPosition(h.noa_id, t, i, n); }), (h.setRotation = function (e, t, i) { (s.rotation.x = e), (s.rotation.y = t), (s.rotation.z = i); }), (h.getPosition = function () { return e.entities.getPosition(h.noa_id); }), (h.getRotation = function () { return s.rotation; }), (h.remove = function () { e.entities.removeComponent(h.noa_id, e.entities.names.mesh), e.entities.removeComponent(h.noa_id, e.entities.names.position), e.entities.removeComponent(h.noa_id, e.entities.names.physics), e.entities.removeComponent( h.noa_id, e.entities.names.collideTerrain ), e.removeListener("tick", h.tick), (h = null); }), e.on("tick", h.tick), h ); }; }, function (e, t, i) { "use strict"; (t.randomBytes = t.rng = t.pseudoRandomBytes = t.prng = i(53)), (t.createHash = t.Hash = i(69)), (t.createHmac = t.Hmac = i(199)); var n = i(523), r = Object.keys(n), o = [ "sha1", "sha224", "sha256", "sha384", "sha512", "md5", "rmd160", ].concat(r); t.getHashes = function () { return o; }; var a = i(202); (t.pbkdf2 = a.pbkdf2), (t.pbkdf2Sync = a.pbkdf2Sync); var s = i(525); (t.Cipher = s.Cipher), (t.createCipher = s.createCipher), (t.Cipheriv = s.Cipheriv), (t.createCipheriv = s.createCipheriv), (t.Decipher = s.Decipher), (t.createDecipher = s.createDecipher), (t.Decipheriv = s.Decipheriv), (t.createDecipheriv = s.createDecipheriv), (t.getCiphers = s.getCiphers), (t.listCiphers = s.listCiphers); var c = i(542); (t.DiffieHellmanGroup = c.DiffieHellmanGroup), (t.createDiffieHellmanGroup = c.createDiffieHellmanGroup), (t.getDiffieHellman = c.getDiffieHellman), (t.createDiffieHellman = c.createDiffieHellman), (t.DiffieHellman = c.DiffieHellman); var u = i(547); (t.createSign = u.createSign), (t.Sign = u.Sign), (t.createVerify = u.createVerify), (t.Verify = u.Verify), (t.createECDH = i(585)); var l = i(586); (t.publicEncrypt = l.publicEncrypt), (t.privateEncrypt = l.privateEncrypt), (t.publicDecrypt = l.publicDecrypt), (t.privateDecrypt = l.privateDecrypt); var h = i(589); (t.randomFill = h.randomFill), (t.randomFillSync = h.randomFillSync), (t.createCredentials = function () { throw new Error( [ "sorry, createCredentials is not implemented yet", "we accept pull requests", "https://github.com/crypto-browserify/crypto-browserify", ].join("\n") ); }), (t.constants = { DH_CHECK_P_NOT_SAFE_PRIME: 2, DH_CHECK_P_NOT_PRIME: 1, DH_UNABLE_TO_CHECK_GENERATOR: 4, DH_NOT_SUITABLE_GENERATOR: 8, NPN_ENABLED: 1, ALPN_ENABLED: 1, RSA_PKCS1_PADDING: 1, RSA_SSLV23_PADDING: 2, RSA_NO_PADDING: 3, RSA_PKCS1_OAEP_PADDING: 4, RSA_X931_PADDING: 5, RSA_PKCS1_PSS_PADDING: 6, POINT_CONVERSION_COMPRESSED: 2, POINT_CONVERSION_UNCOMPRESSED: 4, POINT_CONVERSION_HYBRID: 6, }); }, function (e, t, i) { e.exports = i(123); }, function (e, t, i) { e.exports = i(54); }, function (e, t, i) { e.exports = i(85).Transform; }, function (e, t, i) { e.exports = i(85).PassThrough; }, function (e, t, i) { var n = i(1), r = i(63), o = i(2).Buffer, a = [1518500249, 1859775393, -1894007588, -899497514], s = new Array(80); function c() { this.init(), (this._w = s), r.call(this, 64, 56); } function u(e) { return (e << 30) | (e >>> 2); } function l(e, t, i, n) { return 0 === e ? (t & i) | (~t & n) : 2 === e ? (t & i) | (t & n) | (i & n) : t ^ i ^ n; } n(c, r), (c.prototype.init = function () { return ( (this._a = 1732584193), (this._b = 4023233417), (this._c = 2562383102), (this._d = 271733878), (this._e = 3285377520), this ); }), (c.prototype._update = function (e) { for ( var t, i = this._w, n = 0 | this._a, r = 0 | this._b, o = 0 | this._c, s = 0 | this._d, c = 0 | this._e, h = 0; h < 16; ++h ) i[h] = e.readInt32BE(4 * h); for (; h < 80; ++h) i[h] = i[h - 3] ^ i[h - 8] ^ i[h - 14] ^ i[h - 16]; for (var f = 0; f < 80; ++f) { var d = ~~(f / 20), p = 0 | ((((t = n) << 5) | (t >>> 27)) + l(d, r, o, s) + c + i[f] + a[d]); (c = s), (s = o), (o = u(r)), (r = n), (n = p); } (this._a = (n + this._a) | 0), (this._b = (r + this._b) | 0), (this._c = (o + this._c) | 0), (this._d = (s + this._d) | 0), (this._e = (c + this._e) | 0); }), (c.prototype._hash = function () { var e = o.allocUnsafe(20); return ( e.writeInt32BE(0 | this._a, 0), e.writeInt32BE(0 | this._b, 4), e.writeInt32BE(0 | this._c, 8), e.writeInt32BE(0 | this._d, 12), e.writeInt32BE(0 | this._e, 16), e ); }), (e.exports = c); }, function (e, t, i) { var n = i(1), r = i(63), o = i(2).Buffer, a = [1518500249, 1859775393, -1894007588, -899497514], s = new Array(80); function c() { this.init(), (this._w = s), r.call(this, 64, 56); } function u(e) { return (e << 5) | (e >>> 27); } function l(e) { return (e << 30) | (e >>> 2); } function h(e, t, i, n) { return 0 === e ? (t & i) | (~t & n) : 2 === e ? (t & i) | (t & n) | (i & n) : t ^ i ^ n; } n(c, r), (c.prototype.init = function () { return ( (this._a = 1732584193), (this._b = 4023233417), (this._c = 2562383102), (this._d = 271733878), (this._e = 3285377520), this ); }), (c.prototype._update = function (e) { for ( var t, i = this._w, n = 0 | this._a, r = 0 | this._b, o = 0 | this._c, s = 0 | this._d, c = 0 | this._e, f = 0; f < 16; ++f ) i[f] = e.readInt32BE(4 * f); for (; f < 80; ++f) i[f] = ((t = i[f - 3] ^ i[f - 8] ^ i[f - 14] ^ i[f - 16]) << 1) | (t >>> 31); for (var d = 0; d < 80; ++d) { var p = ~~(d / 20), m = (u(n) + h(p, r, o, s) + c + i[d] + a[p]) | 0; (c = s), (s = o), (o = l(r)), (r = n), (n = m); } (this._a = (n + this._a) | 0), (this._b = (r + this._b) | 0), (this._c = (o + this._c) | 0), (this._d = (s + this._d) | 0), (this._e = (c + this._e) | 0); }), (c.prototype._hash = function () { var e = o.allocUnsafe(20); return ( e.writeInt32BE(0 | this._a, 0), e.writeInt32BE(0 | this._b, 4), e.writeInt32BE(0 | this._c, 8), e.writeInt32BE(0 | this._d, 12), e.writeInt32BE(0 | this._e, 16), e ); }), (e.exports = c); }, function (e, t, i) { var n = i(1), r = i(197), o = i(63), a = i(2).Buffer, s = new Array(64); function c() { this.init(), (this._w = s), o.call(this, 64, 56); } n(c, r), (c.prototype.init = function () { return ( (this._a = 3238371032), (this._b = 914150663), (this._c = 812702999), (this._d = 4144912697), (this._e = 4290775857), (this._f = 1750603025), (this._g = 1694076839), (this._h = 3204075428), this ); }), (c.prototype._hash = function () { var e = a.allocUnsafe(28); return ( e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e ); }), (e.exports = c); }, function (e, t, i) { var n = i(1), r = i(198), o = i(63), a = i(2).Buffer, s = new Array(160); function c() { this.init(), (this._w = s), o.call(this, 128, 112); } n(c, r), (c.prototype.init = function () { return ( (this._ah = 3418070365), (this._bh = 1654270250), (this._ch = 2438529370), (this._dh = 355462360), (this._eh = 1731405415), (this._fh = 2394180231), (this._gh = 3675008525), (this._hh = 1203062813), (this._al = 3238371032), (this._bl = 914150663), (this._cl = 812702999), (this._dl = 4144912697), (this._el = 4290775857), (this._fl = 1750603025), (this._gl = 1694076839), (this._hl = 3204075428), this ); }), (c.prototype._hash = function () { var e = a.allocUnsafe(48); function t(t, i, n) { e.writeInt32BE(t, n), e.writeInt32BE(i, n + 4); } return ( t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), e ); }), (e.exports = c); }, function (e, t, i) { "use strict"; var n = i(1), r = i(2).Buffer, o = i(44), a = r.alloc(128), s = 64; function c(e, t) { o.call(this, "digest"), "string" == typeof t && (t = r.from(t)), (this._alg = e), (this._key = t), t.length > s ? (t = e(t)) : t.length < s && (t = r.concat([t, a], s)); for ( var i = (this._ipad = r.allocUnsafe(s)), n = (this._opad = r.allocUnsafe(s)), c = 0; c < s; c++ ) (i[c] = 54 ^ t[c]), (n[c] = 92 ^ t[c]); this._hash = [i]; } n(c, o), (c.prototype._update = function (e) { this._hash.push(e); }), (c.prototype._final = function () { var e = this._alg(r.concat(this._hash)); return this._alg(r.concat([this._opad, e])); }), (e.exports = c); }, function (e, t, i) { e.exports = i(201); }, function (e, t, i) { (function (t, n, r) { var o, a = i(203), s = i(204), c = i(205), u = i(2).Buffer, l = t.crypto && t.crypto.subtle, h = { sha: "SHA-1", "sha-1": "SHA-1", sha1: "SHA-1", sha256: "SHA-256", "sha-256": "SHA-256", sha384: "SHA-384", "sha-384": "SHA-384", "sha-512": "SHA-512", sha512: "SHA-512", }, f = []; function d(e, t, i, n, r) { return l .importKey( "raw", e, { name: "PBKDF2", }, false, ["deriveBits"] ) .then(function (e) { return l.deriveBits( { name: "PBKDF2", salt: t, iterations: i, hash: { name: r, }, }, e, n << 3 ); }) .then(function (e) { return u.from(e); }); } e.exports = function (e, i, p, m, g, _) { "function" == typeof g && ((_ = g), (g = void 0)); var v = h[(g = g || "sha1").toLowerCase()]; if (!v || "function" != typeof t.Promise) return r.nextTick(function () { var t; try { t = c(e, i, p, m, g); } catch (e) { return _(e); } _(null, t); }); if ((a(e, i, p, m), "function" != typeof _)) throw new Error("No callback provided to pbkdf2"); u.isBuffer(e) || (e = u.from(e, s)), u.isBuffer(i) || (i = u.from(i, s)), (function (e, t) { e.then( function (e) { r.nextTick(function () { t(null, e); }); }, function (e) { r.nextTick(function () { t(e); }); } ); })( (function (e) { if (t.process && !t.process.browser) return n.resolve(false); if (!l || !l.importKey || !l.deriveBits) return n.resolve(false); if (void 0 !== f[e]) return f[e]; var i = d((o = o || u.alloc(8)), o, 10, 128, e) .then(function () { return true; }) .catch(function () { return false; }); return (f[e] = i), i; })(v).then(function (t) { return t ? d(e, i, p, m, v) : c(e, i, p, m, g); }), _ ); }; }.call(this, i(15), i(41), i(27))); }, function (e, t, i) { var n = i(526), r = i(132), o = i(133), a = i(541), s = i(90); function c(e, t, i) { if (((e = e.toLowerCase()), o[e])) return r.createCipheriv(e, t, i); if (a[e]) return new n({ key: t, iv: i, mode: e, }); throw new TypeError("invalid suite type"); } function u(e, t, i) { if (((e = e.toLowerCase()), o[e])) return r.createDecipheriv(e, t, i); if (a[e]) return new n({ key: t, iv: i, mode: e, decrypt: true, }); throw new TypeError("invalid suite type"); } (t.createCipher = t.Cipher = function (e, t) { var i, n; if (((e = e.toLowerCase()), o[e])) (i = o[e].key), (n = o[e].iv); else { if (!a[e]) throw new TypeError("invalid suite type"); (i = 8 * a[e].key), (n = a[e].iv); } var r = s(t, false, i, n); return c(e, r.key, r.iv); }), (t.createCipheriv = t.Cipheriv = c), (t.createDecipher = t.Decipher = function (e, t) { var i, n; if (((e = e.toLowerCase()), o[e])) (i = o[e].key), (n = o[e].iv); else { if (!a[e]) throw new TypeError("invalid suite type"); (i = 8 * a[e].key), (n = a[e].iv); } var r = s(t, false, i, n); return u(e, r.key, r.iv); }), (t.createDecipheriv = t.Decipheriv = u), (t.listCiphers = t.getCiphers = function () { return Object.keys(a).concat(r.getCiphers()); }); }, function (e, t, i) { var n = i(44), r = i(131), o = i(1), a = i(2).Buffer, s = { "des-ede3-cbc": r.CBC.instantiate(r.EDE), "des-ede3": r.EDE, "des-ede-cbc": r.CBC.instantiate(r.EDE), "des-ede": r.EDE, "des-cbc": r.CBC.instantiate(r.DES), "des-ecb": r.DES, }; function c(e) { n.call(this); var t, i = e.mode.toLowerCase(), r = s[i]; t = e.decrypt ? "decrypt" : "encrypt"; var o = e.key; a.isBuffer(o) || (o = a.from(o)), ("des-ede" !== i && "des-ede-cbc" !== i) || (o = a.concat([o, o.slice(0, 8)])); var c = e.iv; a.isBuffer(c) || (c = a.from(c)), (this._des = r.create({ key: o, iv: c, type: t, })); } (s.des = s["des-cbc"]), (s.des3 = s["des-ede3-cbc"]), (e.exports = c), o(c, n), (c.prototype._update = function (e) { return a.from(this._des.update(e)); }), (c.prototype._final = function () { return a.from(this._des.final()); }); }, function (e, t, i) { "use strict"; (t.readUInt32BE = function (e, t) { return ( ((e[0 + t] << 24) | (e[1 + t] << 16) | (e[2 + t] << 8) | e[3 + t]) >>> 0 ); }), (t.writeUInt32BE = function (e, t, i) { (e[0 + i] = t >>> 24), (e[1 + i] = (t >>> 16) & 255), (e[2 + i] = (t >>> 8) & 255), (e[3 + i] = 255 & t); }), (t.ip = function (e, t, i, n) { for (var r = 0, o = 0, a = 6; a >= 0; a -= 2) { for (var s = 0; s <= 24; s += 8) (r <<= 1), (r |= (t >>> (s + a)) & 1); for (s = 0; s <= 24; s += 8) (r <<= 1), (r |= (e >>> (s + a)) & 1); } for (a = 6; a >= 0; a -= 2) { for (s = 1; s <= 25; s += 8) (o <<= 1), (o |= (t >>> (s + a)) & 1); for (s = 1; s <= 25; s += 8) (o <<= 1), (o |= (e >>> (s + a)) & 1); } (i[n + 0] = r >>> 0), (i[n + 1] = o >>> 0); }), (t.rip = function (e, t, i, n) { for (var r = 0, o = 0, a = 0; a < 4; a++) for (var s = 24; s >= 0; s -= 8) (r <<= 1), (r |= (t >>> (s + a)) & 1), (r <<= 1), (r |= (e >>> (s + a)) & 1); for (a = 4; a < 8; a++) for (s = 24; s >= 0; s -= 8) (o <<= 1), (o |= (t >>> (s + a)) & 1), (o <<= 1), (o |= (e >>> (s + a)) & 1); (i[n + 0] = r >>> 0), (i[n + 1] = o >>> 0); }), (t.pc1 = function (e, t, i, n) { for (var r = 0, o = 0, a = 7; a >= 5; a--) { for (var s = 0; s <= 24; s += 8) (r <<= 1), (r |= (t >> (s + a)) & 1); for (s = 0; s <= 24; s += 8) (r <<= 1), (r |= (e >> (s + a)) & 1); } for (s = 0; s <= 24; s += 8) (r <<= 1), (r |= (t >> (s + a)) & 1); for (a = 1; a <= 3; a++) { for (s = 0; s <= 24; s += 8) (o <<= 1), (o |= (t >> (s + a)) & 1); for (s = 0; s <= 24; s += 8) (o <<= 1), (o |= (e >> (s + a)) & 1); } for (s = 0; s <= 24; s += 8) (o <<= 1), (o |= (e >> (s + a)) & 1); (i[n + 0] = r >>> 0), (i[n + 1] = o >>> 0); }), (t.r28shl = function (e, t) { return ((e << t) & 268435455) | (e >>> (28 - t)); }); var n = [ 14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24, ]; (t.pc2 = function (e, t, i, r) { for (var o = 0, a = 0, s = n.length >>> 1, c = 0; c < s; c++) (o <<= 1), (o |= (e >>> n[c]) & 1); for (c = s; c < n.length; c++) (a <<= 1), (a |= (t >>> n[c]) & 1); (i[r + 0] = o >>> 0), (i[r + 1] = a >>> 0); }), (t.expand = function (e, t, i) { var n = 0, r = 0; n = ((1 & e) << 5) | (e >>> 27); for (var o = 23; o >= 15; o -= 4) (n <<= 6), (n |= (e >>> o) & 63); for (o = 11; o >= 3; o -= 4) (r |= (e >>> o) & 63), (r <<= 6); (r |= ((31 & e) << 1) | (e >>> 31)), (t[i + 0] = n >>> 0), (t[i + 1] = r >>> 0); }); var r = [ 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11, ]; t.substitute = function (e, t) { for (var i = 0, n = 0; n < 4; n++) { (i <<= 4), (i |= r[64 * n + ((e >>> (18 - 6 * n)) & 63)]); } for (n = 0; n < 4; n++) { (i <<= 4), (i |= r[256 + 64 * n + ((t >>> (18 - 6 * n)) & 63)]); } return i >>> 0; }; var o = [ 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7, ]; (t.permute = function (e) { for (var t = 0, i = 0; i < o.length; i++) (t <<= 1), (t |= (e >>> o[i]) & 1); return t >>> 0; }), (t.padSplit = function (e, t, i) { for (var n = e.toString(2); n.length < t; ) n = "0" + n; for (var r = [], o = 0; o < t; o += i) r.push(n.slice(o, o + i)); return r.join(" "); }); }, function (e, t, i) { "use strict"; var n = i(25); function r(e) { (this.options = e), (this.type = this.options.type), (this.blockSize = 8), this._init(), (this.buffer = new Array(this.blockSize)), (this.bufferOff = 0); } (e.exports = r), (r.prototype._init = function () {}), (r.prototype.update = function (e) { return 0 === e.length ? [] : "decrypt" === this.type ? this._updateDecrypt(e) : this._updateEncrypt(e); }), (r.prototype._buffer = function (e, t) { for ( var i = Math.min(this.buffer.length - this.bufferOff, e.length - t), n = 0; n < i; n++ ) this.buffer[this.bufferOff + n] = e[t + n]; return (this.bufferOff += i), i; }), (r.prototype._flushBuffer = function (e, t) { return ( this._update(this.buffer, 0, e, t), (this.bufferOff = 0), this.blockSize ); }), (r.prototype._updateEncrypt = function (e) { var t = 0, i = 0, n = ((this.bufferOff + e.length) / this.blockSize) | 0, r = new Array(n * this.blockSize); 0 !== this.bufferOff && ((t += this._buffer(e, t)), this.bufferOff === this.buffer.length && (i += this._flushBuffer(r, i))); for ( var o = e.length - ((e.length - t) % this.blockSize); t < o; t += this.blockSize ) this._update(e, t, r, i), (i += this.blockSize); for (; t < e.length; t++, this.bufferOff++) this.buffer[this.bufferOff] = e[t]; return r; }), (r.prototype._updateDecrypt = function (e) { for ( var t = 0, i = 0, n = Math.ceil((this.bufferOff + e.length) / this.blockSize) - 1, r = new Array(n * this.blockSize); n > 0; n-- ) (t += this._buffer(e, t)), (i += this._flushBuffer(r, i)); return (t += this._buffer(e, t)), r; }), (r.prototype.final = function (e) { var t, i; return ( e && (t = this.update(e)), (i = "encrypt" === this.type ? this._finalEncrypt() : this._finalDecrypt()), t ? t.concat(i) : i ); }), (r.prototype._pad = function (e, t) { if (0 === t) return false; for (; t < e.length; ) e[t++] = 0; return true; }), (r.prototype._finalEncrypt = function () { if (!this._pad(this.buffer, this.bufferOff)) return []; var e = new Array(this.blockSize); return this._update(this.buffer, 0, e, 0), e; }), (r.prototype._unpad = function (e) { return e; }), (r.prototype._finalDecrypt = function () { n.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt"); var e = new Array(this.blockSize); return this._flushBuffer(e, 0), this._unpad(e); }); }, function (e, t, i) { "use strict"; var n = i(25), r = i(1), o = i(131), a = o.utils, s = o.Cipher; function c() { (this.tmp = new Array(2)), (this.keys = null); } function u(e) { s.call(this, e); var t = new c(); (this._desState = t), this.deriveKeys(t, e.key); } r(u, s), (e.exports = u), (u.create = function (e) { return new u(e); }); var l = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1]; (u.prototype.deriveKeys = function (e, t) { (e.keys = new Array(32)), n.equal(t.length, this.blockSize, "Invalid key length"); var i = a.readUInt32BE(t, 0), r = a.readUInt32BE(t, 4); a.pc1(i, r, e.tmp, 0), (i = e.tmp[0]), (r = e.tmp[1]); for (var o = 0; o < e.keys.length; o += 2) { var s = l[o >>> 1]; (i = a.r28shl(i, s)), (r = a.r28shl(r, s)), a.pc2(i, r, e.keys, o); } }), (u.prototype._update = function (e, t, i, n) { var r = this._desState, o = a.readUInt32BE(e, t), s = a.readUInt32BE(e, t + 4); a.ip(o, s, r.tmp, 0), (o = r.tmp[0]), (s = r.tmp[1]), "encrypt" === this.type ? this._encrypt(r, o, s, r.tmp, 0) : this._decrypt(r, o, s, r.tmp, 0), (o = r.tmp[0]), (s = r.tmp[1]), a.writeUInt32BE(i, o, n), a.writeUInt32BE(i, s, n + 4); }), (u.prototype._pad = function (e, t) { for (var i = e.length - t, n = t; n < e.length; n++) e[n] = i; return true; }), (u.prototype._unpad = function (e) { for (var t = e[e.length - 1], i = e.length - t; i < e.length; i++) n.equal(e[i], t); return e.slice(0, e.length - t); }), (u.prototype._encrypt = function (e, t, i, n, r) { for (var o = t, s = i, c = 0; c < e.keys.length; c += 2) { var u = e.keys[c], l = e.keys[c + 1]; a.expand(s, e.tmp, 0), (u ^= e.tmp[0]), (l ^= e.tmp[1]); var h = a.substitute(u, l), f = s; (s = (o ^ a.permute(h)) >>> 0), (o = f); } a.rip(s, o, n, r); }), (u.prototype._decrypt = function (e, t, i, n, r) { for (var o = i, s = t, c = e.keys.length - 2; c >= 0; c -= 2) { var u = e.keys[c], l = e.keys[c + 1]; a.expand(o, e.tmp, 0), (u ^= e.tmp[0]), (l ^= e.tmp[1]); var h = a.substitute(u, l), f = o; (o = (s ^ a.permute(h)) >>> 0), (s = f); } a.rip(o, s, n, r); }); }, function (e, t, i) { "use strict"; var n = i(25), r = i(1), o = {}; function a(e) { n.equal(e.length, 8, "Invalid IV length"), (this.iv = new Array(8)); for (var t = 0; t < this.iv.length; t++) this.iv[t] = e[t]; } (t.instantiate = function (e) { function t(t) { e.call(this, t), this._cbcInit(); } r(t, e); for (var i = Object.keys(o), n = 0; n < i.length; n++) { var a = i[n]; t.prototype[a] = o[a]; } return ( (t.create = function (e) { return new t(e); }), t ); }), (o._cbcInit = function () { var e = new a(this.options.iv); this._cbcState = e; }), (o._update = function (e, t, i, n) { var r = this._cbcState, o = this.constructor.super_.prototype, a = r.iv; if ("encrypt" === this.type) { for (var s = 0; s < this.blockSize; s++) a[s] ^= e[t + s]; o._update.call(this, a, 0, i, n); for (s = 0; s < this.blockSize; s++) a[s] = i[n + s]; } else { o._update.call(this, e, t, i, n); for (s = 0; s < this.blockSize; s++) i[n + s] ^= a[s]; for (s = 0; s < this.blockSize; s++) a[s] = e[t + s]; } }); }, function (e, t, i) { "use strict"; var n = i(25), r = i(1), o = i(131), a = o.Cipher, s = o.DES; function c(e, t) { n.equal(t.length, 24, "Invalid key length"); var i = t.slice(0, 8), r = t.slice(8, 16), o = t.slice(16, 24); this.ciphers = "encrypt" === e ? [ s.create({ type: "encrypt", key: i, }), s.create({ type: "decrypt", key: r, }), s.create({ type: "encrypt", key: o, }), ] : [ s.create({ type: "decrypt", key: o, }), s.create({ type: "encrypt", key: r, }), s.create({ type: "decrypt", key: i, }), ]; } function u(e) { a.call(this, e); var t = new c(this.type, this.options.key); this._edeState = t; } r(u, a), (e.exports = u), (u.create = function (e) { return new u(e); }), (u.prototype._update = function (e, t, i, n) { var r = this._edeState; r.ciphers[0]._update(e, t, i, n), r.ciphers[1]._update(i, n, i, n), r.ciphers[2]._update(i, n, i, n); }), (u.prototype._pad = s.prototype._pad), (u.prototype._unpad = s.prototype._unpad); }, function (e, t, i) { var n = i(133), r = i(209), o = i(2).Buffer, a = i(210), s = i(44), c = i(89), u = i(90); function l(e, t, i) { s.call(this), (this._cache = new f()), (this._cipher = new c.AES(t)), (this._prev = o.from(i)), (this._mode = e), (this._autopadding = true); } i(1)(l, s), (l.prototype._update = function (e) { var t, i; this._cache.add(e); for (var n = []; (t = this._cache.get()); ) (i = this._mode.encrypt(this, t)), n.push(i); return o.concat(n); }); var h = o.alloc(16, 16); function f() { this.cache = o.allocUnsafe(0); } function d(e, t, i) { var s = n[e.toLowerCase()]; if (!s) throw new TypeError("invalid suite type"); if (("string" == typeof t && (t = o.from(t)), t.length !== s.key / 8)) throw new TypeError("invalid key length " + t.length); if ( ("string" == typeof i && (i = o.from(i)), "GCM" !== s.mode && i.length !== s.iv) ) throw new TypeError("invalid iv length " + i.length); return "stream" === s.type ? new a(s.module, t, i) : "auth" === s.type ? new r(s.module, t, i) : new l(s.module, t, i); } (l.prototype._final = function () { var e = this._cache.flush(); if (this._autopadding) return (e = this._mode.encrypt(this, e)), this._cipher.scrub(), e; if (!e.equals(h)) throw ( (this._cipher.scrub(), new Error("data not multiple of block length")) ); }), (l.prototype.setAutoPadding = function (e) { return (this._autopadding = !!e), this; }), (f.prototype.add = function (e) { this.cache = o.concat([this.cache, e]); }), (f.prototype.get = function () { if (this.cache.length > 15) { var e = this.cache.slice(0, 16); return (this.cache = this.cache.slice(16)), e; } return null; }), (f.prototype.flush = function () { for ( var e = 16 - this.cache.length, t = o.allocUnsafe(e), i = -1; ++i < e; ) t.writeUInt8(e, i); return o.concat([this.cache, t]); }), (t.createCipheriv = d), (t.createCipher = function (e, t) { var i = n[e.toLowerCase()]; if (!i) throw new TypeError("invalid suite type"); var r = u(t, false, i.key, i.iv); return d(e, r.key, r.iv); }); }, function (e, t) { (t.encrypt = function (e, t) { return e._cipher.encryptBlock(t); }), (t.decrypt = function (e, t) { return e._cipher.decryptBlock(t); }); }, function (e, t, i) { var n = i(70); (t.encrypt = function (e, t) { var i = n(t, e._prev); return (e._prev = e._cipher.encryptBlock(i)), e._prev; }), (t.decrypt = function (e, t) { var i = e._prev; e._prev = t; var r = e._cipher.decryptBlock(t); return n(r, i); }); }, function (e, t, i) { var n = i(2).Buffer, r = i(70); function o(e, t, i) { var o = t.length, a = r(t, e._cache); return ( (e._cache = e._cache.slice(o)), (e._prev = n.concat([e._prev, i ? t : a])), a ); } t.encrypt = function (e, t, i) { for (var r, a = n.allocUnsafe(0); t.length; ) { if ( (0 === e._cache.length && ((e._cache = e._cipher.encryptBlock(e._prev)), (e._prev = n.allocUnsafe(0))), !(e._cache.length <= t.length)) ) { a = n.concat([a, o(e, t, i)]); break; } (r = e._cache.length), (a = n.concat([a, o(e, t.slice(0, r), i)])), (t = t.slice(r)); } return a; }; }, function (e, t, i) { var n = i(2).Buffer; function r(e, t, i) { var r = e._cipher.encryptBlock(e._prev)[0] ^ t; return (e._prev = n.concat([e._prev.slice(1), n.from([i ? t : r])])), r; } t.encrypt = function (e, t, i) { for (var o = t.length, a = n.allocUnsafe(o), s = -1; ++s < o; ) a[s] = r(e, t[s], i); return a; }; }, function (e, t, i) { var n = i(2).Buffer; function r(e, t, i) { for (var n, r, a = -1, s = 0; ++a < 8; ) (n = t & (1 << (7 - a)) ? 128 : 0), (s += (128 & (r = e._cipher.encryptBlock(e._prev)[0] ^ n)) >> a % 8), (e._prev = o(e._prev, i ? n : r)); return s; } function o(e, t) { var i = e.length, r = -1, o = n.allocUnsafe(e.length); for (e = n.concat([e, n.from([t])]); ++r < i; ) o[r] = (e[r] << 1) | (e[r + 1] >> 7); return o; } t.encrypt = function (e, t, i) { for (var o = t.length, a = n.allocUnsafe(o), s = -1; ++s < o; ) a[s] = r(e, t[s], i); return a; }; }, function (e, t, i) { (function (e) { var n = i(70); function r(e) { return (e._prev = e._cipher.encryptBlock(e._prev)), e._prev; } t.encrypt = function (t, i) { for (; t._cache.length < i.length; ) t._cache = e.concat([t._cache, r(t)]); var o = t._cache.slice(0, i.length); return (t._cache = t._cache.slice(i.length)), n(i, o); }; }.call(this, i(9).Buffer)); }, function (e, t, i) { var n = i(2).Buffer, r = n.alloc(16, 0); function o(e) { var t = n.allocUnsafe(16); return ( t.writeUInt32BE(e[0] >>> 0, 0), t.writeUInt32BE(e[1] >>> 0, 4), t.writeUInt32BE(e[2] >>> 0, 8), t.writeUInt32BE(e[3] >>> 0, 12), t ); } function a(e) { (this.h = e), (this.state = n.alloc(16, 0)), (this.cache = n.allocUnsafe(0)); } (a.prototype.ghash = function (e) { for (var t = -1; ++t < e.length; ) this.state[t] ^= e[t]; this._multiply(); }), (a.prototype._multiply = function () { for ( var e, t, i, n = [ (e = this.h).readUInt32BE(0), e.readUInt32BE(4), e.readUInt32BE(8), e.readUInt32BE(12), ], r = [0, 0, 0, 0], a = -1; ++a < 128; ) { for ( 0 != (this.state[~~(a / 8)] & (1 << (7 - (a % 8)))) && ((r[0] ^= n[0]), (r[1] ^= n[1]), (r[2] ^= n[2]), (r[3] ^= n[3])), i = 0 != (1 & n[3]), t = 3; t > 0; t-- ) n[t] = (n[t] >>> 1) | ((1 & n[t - 1]) << 31); (n[0] = n[0] >>> 1), i && (n[0] = n[0] ^ (225 << 24)); } this.state = o(r); }), (a.prototype.update = function (e) { var t; for (this.cache = n.concat([this.cache, e]); this.cache.length >= 16; ) (t = this.cache.slice(0, 16)), (this.cache = this.cache.slice(16)), this.ghash(t); }), (a.prototype.final = function (e, t) { return ( this.cache.length && this.ghash(n.concat([this.cache, r], 16)), this.ghash(o([0, e, 0, t])), this.state ); }), (e.exports = a); }, function (e, t, i) { var n = i(209), r = i(2).Buffer, o = i(133), a = i(210), s = i(44), c = i(89), u = i(90); function l(e, t, i) { s.call(this), (this._cache = new h()), (this._last = void 0), (this._cipher = new c.AES(t)), (this._prev = r.from(i)), (this._mode = e), (this._autopadding = true); } function h() { this.cache = r.allocUnsafe(0); } function f(e, t, i) { var s = o[e.toLowerCase()]; if (!s) throw new TypeError("invalid suite type"); if ( ("string" == typeof i && (i = r.from(i)), "GCM" !== s.mode && i.length !== s.iv) ) throw new TypeError("invalid iv length " + i.length); if (("string" == typeof t && (t = r.from(t)), t.length !== s.key / 8)) throw new TypeError("invalid key length " + t.length); return "stream" === s.type ? new a(s.module, t, i, true) : "auth" === s.type ? new n(s.module, t, i, true) : new l(s.module, t, i); } i(1)(l, s), (l.prototype._update = function (e) { var t, i; this._cache.add(e); for (var n = []; (t = this._cache.get(this._autopadding)); ) (i = this._mode.decrypt(this, t)), n.push(i); return r.concat(n); }), (l.prototype._final = function () { var e = this._cache.flush(); if (this._autopadding) return (function (e) { var t = e[15]; if (t < 1 || t > 16) throw new Error("unable to decrypt data"); var i = -1; for (; ++i < t; ) if (e[i + (16 - t)] !== t) throw new Error("unable to decrypt data"); if (16 === t) return; return e.slice(0, 16 - t); })(this._mode.decrypt(this, e)); if (e) throw new Error("data not multiple of block length"); }), (l.prototype.setAutoPadding = function (e) { return (this._autopadding = !!e), this; }), (h.prototype.add = function (e) { this.cache = r.concat([this.cache, e]); }), (h.prototype.get = function (e) { var t; if (e) { if (this.cache.length > 16) return ( (t = this.cache.slice(0, 16)), (this.cache = this.cache.slice(16)), t ); } else if (this.cache.length >= 16) return ( (t = this.cache.slice(0, 16)), (this.cache = this.cache.slice(16)), t ); return null; }), (h.prototype.flush = function () { if (this.cache.length) return this.cache; }), (t.createDecipher = function (e, t) { var i = o[e.toLowerCase()]; if (!i) throw new TypeError("invalid suite type"); var n = u(t, false, i.key, i.iv); return f(e, n.key, n.iv); }), (t.createDecipheriv = f); }, function (e, t) { (t["des-ecb"] = { key: 8, iv: 0, }), (t["des-cbc"] = t.des = { key: 8, iv: 8, }), (t["des-ede3-cbc"] = t.des3 = { key: 24, iv: 8, }), (t["des-ede3"] = { key: 24, iv: 0, }), (t["des-ede-cbc"] = { key: 16, iv: 8, }), (t["des-ede"] = { key: 16, iv: 0, }); }, function (e, t, i) { (function (e) { var n = i(211), r = i(545), o = i(546); var a = { binary: true, hex: true, base64: true, }; (t.DiffieHellmanGroup = t.createDiffieHellmanGroup = t.getDiffieHellman = function (t) { var i = new e(r[t].prime, "hex"), n = new e(r[t].gen, "hex"); return new o(i, n); }), (t.createDiffieHellman = t.DiffieHellman = function t(i, r, s, c) { return e.isBuffer(r) || void 0 === a[r] ? t(i, "binary", r, s) : ((r = r || "binary"), (c = c || "binary"), (s = s || new e([2])), e.isBuffer(s) || (s = new e(s, c)), "number" == typeof i ? new o(n(i, s), s, true) : (e.isBuffer(i) || (i = new e(i, r)), new o(i, s, true))); }); }.call(this, i(9).Buffer)); }, function (e, t) {}, function (e, t) {}, function (e) { e.exports = { modp1: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff", }, modp2: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff", }, modp5: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff", }, modp14: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff", }, modp15: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff", }, modp16: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff", }, modp17: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff", }, modp18: { gen: "02", prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff", }, }; }, function (e, t, i) { (function (t) { var n = i(11), r = new (i(212))(), o = new n(24), a = new n(11), s = new n(10), c = new n(3), u = new n(7), l = i(211), h = i(53); function f(e, i) { return ( (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)), (this._pub = new n(e)), this ); } function d(e, i) { return ( (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)), (this._priv = new n(e)), this ); } e.exports = m; var p = {}; function m(e, t, i) { this.setGenerator(t), (this.__prime = new n(e)), (this._prime = n.mont(this.__prime)), (this._primeLen = e.length), (this._pub = void 0), (this._priv = void 0), (this._primeCode = void 0), i ? ((this.setPublicKey = f), (this.setPrivateKey = d)) : (this._primeCode = 8); } function g(e, i) { var n = new t(e.toArray()); return i ? n.toString(i) : n; } Object.defineProperty(m.prototype, "verifyError", { enumerable: true, get: function () { return ( "number" != typeof this._primeCode && (this._primeCode = (function (e, t) { var i = t.toString("hex"), n = [i, e.toString(16)].join("_"); if (n in p) return p[n]; var h, f = 0; if ( e.isEven() || !l.simpleSieve || !l.fermatTest(e) || !r.test(e) ) return ( (f += 1), (f += "02" === i || "05" === i ? 8 : 4), (p[n] = f), f ); switch ((r.test(e.shrn(1)) || (f += 2), i)) { case "02": e.mod(o).cmp(a) && (f += 8); break; case "05": (h = e.mod(s)).cmp(c) && h.cmp(u) && (f += 8); break; default: f += 4; } return (p[n] = f), f; })(this.__prime, this.__gen)), this._primeCode ); }, }), (m.prototype.generateKeys = function () { return ( this._priv || (this._priv = new n(h(this._primeLen))), (this._pub = this._gen .toRed(this._prime) .redPow(this._priv) .fromRed()), this.getPublicKey() ); }), (m.prototype.computeSecret = function (e) { var i = (e = (e = new n(e)).toRed(this._prime)) .redPow(this._priv) .fromRed(), r = new t(i.toArray()), o = this.getPrime(); if (r.length < o.length) { var a = new t(o.length - r.length); a.fill(0), (r = t.concat([a, r])); } return r; }), (m.prototype.getPublicKey = function (e) { return g(this._pub, e); }), (m.prototype.getPrivateKey = function (e) { return g(this._priv, e); }), (m.prototype.getPrime = function (e) { return g(this.__prime, e); }), (m.prototype.getGenerator = function (e) { return g(this._gen, e); }), (m.prototype.setGenerator = function (e, i) { return ( (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)), (this.__gen = e), (this._gen = new n(e)), this ); }); }.call(this, i(9).Buffer)); }, function (e, t, i) { (function (t) { var n = i(69), r = i(128), o = i(1), a = i(548), s = i(584), c = i(201); function u(e) { r.Writable.call(this); var t = c[e]; if (!t) throw new Error("Unknown message digest"); (this._hashType = t.hash), (this._hash = n(t.hash)), (this._tag = t.id), (this._signType = t.sign); } function l(e) { r.Writable.call(this); var t = c[e]; if (!t) throw new Error("Unknown message digest"); (this._hash = n(t.hash)), (this._tag = t.id), (this._signType = t.sign); } function h(e) { return new u(e); } function f(e) { return new l(e); } Object.keys(c).forEach(function (e) { (c[e].id = new t(c[e].id, "hex")), (c[e.toLowerCase()] = c[e]); }), o(u, r.Writable), (u.prototype._write = function (e, t, i) { this._hash.update(e), i(); }), (u.prototype.update = function (e, i) { return ( "string" == typeof e && (e = new t(e, i)), this._hash.update(e), this ); }), (u.prototype.sign = function (e, t) { this.end(); var i = this._hash.digest(), n = a(i, e, this._hashType, this._signType, this._tag); return t ? n.toString(t) : n; }), o(l, r.Writable), (l.prototype._write = function (e, t, i) { this._hash.update(e), i(); }), (l.prototype.update = function (e, i) { return ( "string" == typeof e && (e = new t(e, i)), this._hash.update(e), this ); }), (l.prototype.verify = function (e, i, n) { "string" == typeof i && (i = new t(i, n)), this.end(); var r = this._hash.digest(); return s(i, r, e, this._signType, this._tag); }), (e.exports = { Sign: h, Verify: f, createSign: h, createVerify: f, }); }.call(this, i(9).Buffer)); }, function (e, t, i) { (function (t) { var n = i(199), r = i(134), o = i(17).ec, a = i(11), s = i(92), c = i(222); function u(e, i, r, o) { if ((e = new t(e.toArray())).length < i.byteLength()) { var a = new t(i.byteLength() - e.length); a.fill(0), (e = t.concat([a, e])); } var s = r.length, c = (function (e, i) { e = (e = l(e, i)).mod(i); var n = new t(e.toArray()); if (n.length < i.byteLength()) { var r = new t(i.byteLength() - n.length); r.fill(0), (n = t.concat([r, n])); } return n; })(r, i), u = new t(s); u.fill(1); var h = new t(s); return ( h.fill(0), (h = n(o, h) .update(u) .update(new t([0])) .update(e) .update(c) .digest()), (u = n(o, h).update(u).digest()), { k: (h = n(o, h) .update(u) .update(new t([1])) .update(e) .update(c) .digest()), v: (u = n(o, h).update(u).digest()), } ); } function l(e, t) { var i = new a(e), n = (e.length << 3) - t.bitLength(); return n > 0 && i.ishrn(n), i; } function h(e, i, r) { var o, a; do { for (o = new t(0); 8 * o.length < e.bitLength(); ) (i.v = n(r, i.k).update(i.v).digest()), (o = t.concat([o, i.v])); (a = l(o, e)), (i.k = n(r, i.k) .update(i.v) .update(new t([0])) .digest()), (i.v = n(r, i.k).update(i.v).digest()); } while (-1 !== a.cmp(e)); return a; } function f(e, t, i, n) { return e.toRed(a.mont(i)).redPow(t).fromRed().mod(n); } (e.exports = function (e, i, n, d, p) { var m = s(i); if (m.curve) { if ("ecdsa" !== d && "ecdsa/rsa" !== d) throw new Error("wrong private key type"); return (function (e, i) { var n = c[i.curve.join(".")]; if (!n) throw new Error("unknown curve " + i.curve.join(".")); var r = new o(n).keyFromPrivate(i.privateKey).sign(e); return new t(r.toDER()); })(e, m); } if ("dsa" === m.type) { if ("dsa" !== d) throw new Error("wrong private key type"); return (function (e, i, n) { for ( var r, o = i.params.priv_key, s = i.params.p, c = i.params.q, d = i.params.g, p = new a(0), m = l(e, c).mod(c), g = false, _ = u(o, c, e, n); false === g; ) (r = h(c, _, n)), (p = f(d, r, s, c)), 0 === (g = r .invm(c) .imul(m.add(o.mul(p))) .mod(c)).cmpn(0) && ((g = false), (p = new a(0))); return (function (e, i) { (e = e.toArray()), (i = i.toArray()), 128 & e[0] && (e = [0].concat(e)), 128 & i[0] && (i = [0].concat(i)); var n = [48, e.length + i.length + 4, 2, e.length]; return (n = n.concat(e, [2, i.length], i)), new t(n); })(p, g); })(e, m, n); } if ("rsa" !== d && "ecdsa/rsa" !== d) throw new Error("wrong private key type"); e = t.concat([p, e]); for ( var g = m.modulus.byteLength(), _ = [0, 1]; e.length + _.length + 1 < g; ) _.push(255); _.push(0); for (var v = -1; ++v < e.length; ) _.push(e[v]); return r(_, m); }), (e.exports.getKey = u), (e.exports.makeKey = h); }.call(this, i(9).Buffer)); }, function (e) { e.exports = { _args: [["elliptic@6.4.1", "/Users/wenlanyang/Github/MinecraftClassic"]], _development: true, _from: "elliptic@6.4.1", _id: "elliptic@6.4.1", _inBundle: false, _integrity: "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", _location: "/elliptic", _phantomChildren: {}, _requested: { type: "version", registry: true, raw: "elliptic@6.4.1", name: "elliptic", escapedName: "elliptic", rawSpec: "6.4.1", saveSpec: null, fetchSpec: "6.4.1", }, _requiredBy: ["/browserify-sign", "/create-ecdh"], _resolved: "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", _spec: "6.4.1", _where: "/Users/wenlanyang/Github/MinecraftClassic", author: { name: "Fedor Indutny", email: "fedor@indutny.com", }, bugs: { url: "https://github.com/indutny/elliptic/issues", }, dependencies: { "bn.js": "^4.4.0", brorand: "^1.0.1", "hash.js": "^1.0.0", "hmac-drbg": "^1.0.0", inherits: "^2.0.1", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0", }, description: "EC cryptography", devDependencies: { brfs: "^1.4.3", coveralls: "^2.11.3", grunt: "^0.4.5", "grunt-browserify": "^5.0.0", "grunt-cli": "^1.2.0", "grunt-contrib-connect": "^1.0.0", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-uglify": "^1.0.1", "grunt-mocha-istanbul": "^3.0.1", "grunt-saucelabs": "^8.6.2", istanbul: "^0.4.2", jscs: "^2.9.0", jshint: "^2.6.0", mocha: "^2.1.0", }, files: ["lib"], homepage: "https://github.com/indutny/elliptic", keywords: ["EC", "Elliptic", "curve", "Cryptography"], license: "MIT", main: "lib/elliptic.js", name: "elliptic", repository: { type: "git", url: "git+ssh://git@github.com/indutny/elliptic.git", }, scripts: { jscs: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", jshint: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", lint: "npm run jscs && npm run jshint", test: "npm run lint && npm run unit", unit: "istanbul test _mocha --reporter=spec test/index.js", version: "grunt dist && git add dist/", }, version: "6.4.1", }; }, function (e, t, i) { "use strict"; var n = t, r = i(11), o = i(25), a = i(214); (n.assert = o), (n.toArray = a.toArray), (n.zero2 = a.zero2), (n.toHex = a.toHex), (n.encode = a.encode), (n.getNAF = function (e, t) { for (var i = [], n = 1 << (t + 1), r = e.clone(); r.cmpn(1) >= 0; ) { var o; if (r.isOdd()) { var a = r.andln(n - 1); (o = a > (n >> 1) - 1 ? (n >> 1) - a : a), r.isubn(o); } else o = 0; i.push(o); for ( var s = 0 !== r.cmpn(0) && 0 === r.andln(n - 1) ? t + 1 : 1, c = 1; c < s; c++ ) i.push(0); r.iushrn(s); } return i; }), (n.getJSF = function (e, t) { var i = [[], []]; (e = e.clone()), (t = t.clone()); for (var n = 0, r = 0; e.cmpn(-n) > 0 || t.cmpn(-r) > 0; ) { var o, a, s, c = (e.andln(3) + n) & 3, u = (t.andln(3) + r) & 3; 3 === c && (c = -1), 3 === u && (u = -1), (o = 0 == (1 & c) ? 0 : (3 != (s = (e.andln(7) + n) & 7) && 5 !== s) || 2 !== u ? c : -c), i[0].push(o), (a = 0 == (1 & u) ? 0 : (3 != (s = (t.andln(7) + r) & 7) && 5 !== s) || 2 !== c ? u : -u), i[1].push(a), 2 * n === o + 1 && (n = 1 - n), 2 * r === a + 1 && (r = 1 - r), e.iushrn(1), t.iushrn(1); } return i; }), (n.cachedProperty = function (e, t, i) { var n = "_" + t; e.prototype[t] = function () { return void 0 !== this[n] ? this[n] : (this[n] = i.call(this)); }; }), (n.parseBytes = function (e) { return "string" == typeof e ? n.toArray(e, "hex") : e; }), (n.intFromLE = function (e) { return new r(e, "hex", "le"); }); }, function (e, t, i) { "use strict"; var n = i(11), r = i(17).utils, o = r.getNAF, a = r.getJSF, s = r.assert; function c(e, t) { (this.type = e), (this.p = new n(t.p, 16)), (this.red = t.prime ? n.red(t.prime) : n.mont(this.p)), (this.zero = new n(0).toRed(this.red)), (this.one = new n(1).toRed(this.red)), (this.two = new n(2).toRed(this.red)), (this.n = t.n && new n(t.n, 16)), (this.g = t.g && this.pointFromJSON(t.g, t.gRed)), (this._wnafT1 = new Array(4)), (this._wnafT2 = new Array(4)), (this._wnafT3 = new Array(4)), (this._wnafT4 = new Array(4)); var i = this.n && this.p.div(this.n); !i || i.cmpn(100) > 0 ? (this.redN = null) : ((this._maxwellTrick = true), (this.redN = this.n.toRed(this.red))); } function u(e, t) { (this.curve = e), (this.type = t), (this.precomputed = null); } (e.exports = c), (c.prototype.point = function () { throw new Error("Not implemented"); }), (c.prototype.validate = function () { throw new Error("Not implemented"); }), (c.prototype._fixedNafMul = function (e, t) { s(e.precomputed); var i = e._getDoubles(), n = o(t, 1), r = (1 << (i.step + 1)) - (i.step % 2 == 0 ? 2 : 1); r /= 3; for (var a = [], c = 0; c < n.length; c += i.step) { var u = 0; for (t = c + i.step - 1; t >= c; t--) u = (u << 1) + n[t]; a.push(u); } for ( var l = this.jpoint(null, null, null), h = this.jpoint(null, null, null), f = r; f > 0; f-- ) { for (c = 0; c < a.length; c++) { (u = a[c]) === f ? (h = h.mixedAdd(i.points[c])) : u === -f && (h = h.mixedAdd(i.points[c].neg())); } l = l.add(h); } return l.toP(); }), (c.prototype._wnafMul = function (e, t) { var i = 4, n = e._getNAFPoints(i); i = n.wnd; for ( var r = n.points, a = o(t, i), c = this.jpoint(null, null, null), u = a.length - 1; u >= 0; u-- ) { for (t = 0; u >= 0 && 0 === a[u]; u--) t++; if ((u >= 0 && t++, (c = c.dblp(t)), u < 0)) break; var l = a[u]; s(0 !== l), (c = "affine" === e.type ? l > 0 ? c.mixedAdd(r[(l - 1) >> 1]) : c.mixedAdd(r[(-l - 1) >> 1].neg()) : l > 0 ? c.add(r[(l - 1) >> 1]) : c.add(r[(-l - 1) >> 1].neg())); } return "affine" === e.type ? c.toP() : c; }), (c.prototype._wnafMulAdd = function (e, t, i, n, r) { for ( var s = this._wnafT1, c = this._wnafT2, u = this._wnafT3, l = 0, h = 0; h < n; h++ ) { var f = (S = t[h])._getNAFPoints(e); (s[h] = f.wnd), (c[h] = f.points); } for (h = n - 1; h >= 1; h -= 2) { var d = h - 1, p = h; if (1 === s[d] && 1 === s[p]) { var m = [t[d], null, null, t[p]]; 0 === t[d].y.cmp(t[p].y) ? ((m[1] = t[d].add(t[p])), (m[2] = t[d].toJ().mixedAdd(t[p].neg()))) : 0 === t[d].y.cmp(t[p].y.redNeg()) ? ((m[1] = t[d].toJ().mixedAdd(t[p])), (m[2] = t[d].add(t[p].neg()))) : ((m[1] = t[d].toJ().mixedAdd(t[p])), (m[2] = t[d].toJ().mixedAdd(t[p].neg()))); var g = [-3, -1, -5, -7, 0, 7, 5, 1, 3], _ = a(i[d], i[p]); (l = Math.max(_[0].length, l)), (u[d] = new Array(l)), (u[p] = new Array(l)); for (var v = 0; v < l; v++) { var y = 0 | _[0][v], b = 0 | _[1][v]; (u[d][v] = g[3 * (y + 1) + (b + 1)]), (u[p][v] = 0), (c[d] = m); } } else (u[d] = o(i[d], s[d])), (u[p] = o(i[p], s[p])), (l = Math.max(u[d].length, l)), (l = Math.max(u[p].length, l)); } var E = this.jpoint(null, null, null), T = this._wnafT4; for (h = l; h >= 0; h--) { for (var A = 0; h >= 0; ) { var x = true; for (v = 0; v < n; v++) (T[v] = 0 | u[v][h]), 0 !== T[v] && (x = false); if (!x) break; A++, h--; } if ((h >= 0 && A++, (E = E.dblp(A)), h < 0)) break; for (v = 0; v < n; v++) { var S, C = T[v]; 0 !== C && (C > 0 ? (S = c[v][(C - 1) >> 1]) : C < 0 && (S = c[v][(-C - 1) >> 1].neg()), (E = "affine" === S.type ? E.mixedAdd(S) : E.add(S))); } } for (h = 0; h < n; h++) c[h] = null; return r ? E : E.toP(); }), (c.BasePoint = u), (u.prototype.eq = function () { throw new Error("Not implemented"); }), (u.prototype.validate = function () { return this.curve.validate(this); }), (c.prototype.decodePoint = function (e, t) { e = r.toArray(e, t); var i = this.p.byteLength(); if ((4 === e[0] || 6 === e[0] || 7 === e[0]) && e.length - 1 == 2 * i) return ( 6 === e[0] ? s(e[e.length - 1] % 2 == 0) : 7 === e[0] && s(e[e.length - 1] % 2 == 1), this.point(e.slice(1, 1 + i), e.slice(1 + i, 1 + 2 * i)) ); if ((2 === e[0] || 3 === e[0]) && e.length - 1 === i) return this.pointFromX(e.slice(1, 1 + i), 3 === e[0]); throw new Error("Unknown point format"); }), (u.prototype.encodeCompressed = function (e) { return this.encode(e, true); }), (u.prototype._encode = function (e) { var t = this.curve.p.byteLength(), i = this.getX().toArray("be", t); return e ? [this.getY().isEven() ? 2 : 3].concat(i) : [4].concat(i, this.getY().toArray("be", t)); }), (u.prototype.encode = function (e, t) { return r.encode(this._encode(t), e); }), (u.prototype.precompute = function (e) { if (this.precomputed) return this; var t = { doubles: null, naf: null, beta: null, }; return ( (t.naf = this._getNAFPoints(8)), (t.doubles = this._getDoubles(4, e)), (t.beta = this._getBeta()), (this.precomputed = t), this ); }), (u.prototype._hasDoubles = function (e) { if (!this.precomputed) return false; var t = this.precomputed.doubles; return ( !!t && t.points.length >= Math.ceil((e.bitLength() + 1) / t.step) ); }), (u.prototype._getDoubles = function (e, t) { if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; for (var i = [this], n = this, r = 0; r < t; r += e) { for (var o = 0; o < e; o++) n = n.dbl(); i.push(n); } return { step: e, points: i, }; }), (u.prototype._getNAFPoints = function (e) { if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; for ( var t = [this], i = (1 << e) - 1, n = 1 === i ? null : this.dbl(), r = 1; r < i; r++ ) t[r] = t[r - 1].add(n); return { wnd: e, points: t, }; }), (u.prototype._getBeta = function () { return null; }), (u.prototype.dblp = function (e) { for (var t = this, i = 0; i < e; i++) t = t.dbl(); return t; }); }, function (e, t, i) { "use strict"; var n = i(91), r = i(17), o = i(11), a = i(1), s = n.base, c = r.utils.assert; function u(e) { s.call(this, "short", e), (this.a = new o(e.a, 16).toRed(this.red)), (this.b = new o(e.b, 16).toRed(this.red)), (this.tinv = this.two.redInvm()), (this.zeroA = 0 === this.a.fromRed().cmpn(0)), (this.threeA = 0 === this.a.fromRed().sub(this.p).cmpn(-3)), (this.endo = this._getEndomorphism(e)), (this._endoWnafT1 = new Array(4)), (this._endoWnafT2 = new Array(4)); } function l(e, t, i, n) { s.BasePoint.call(this, e, "affine"), null === t && null === i ? ((this.x = null), (this.y = null), (this.inf = true)) : ((this.x = new o(t, 16)), (this.y = new o(i, 16)), n && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), (this.inf = false)); } function h(e, t, i, n) { s.BasePoint.call(this, e, "jacobian"), null === t && null === i && null === n ? ((this.x = this.curve.one), (this.y = this.curve.one), (this.z = new o(0))) : ((this.x = new o(t, 16)), (this.y = new o(i, 16)), (this.z = new o(n, 16))), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), (this.zOne = this.z === this.curve.one); } a(u, s), (e.exports = u), (u.prototype._getEndomorphism = function (e) { if (this.zeroA && this.g && this.n && 1 === this.p.modn(3)) { var t, i; if (e.beta) t = new o(e.beta, 16).toRed(this.red); else { var n = this._getEndoRoots(this.p); t = (t = n[0].cmp(n[1]) < 0 ? n[0] : n[1]).toRed(this.red); } if (e.lambda) i = new o(e.lambda, 16); else { var r = this._getEndoRoots(this.n); 0 === this.g.mul(r[0]).x.cmp(this.g.x.redMul(t)) ? (i = r[0]) : ((i = r[1]), c(0 === this.g.mul(i).x.cmp(this.g.x.redMul(t)))); } return { beta: t, lambda: i, basis: e.basis ? e.basis.map(function (e) { return { a: new o(e.a, 16), b: new o(e.b, 16), }; }) : this._getEndoBasis(i), }; } }), (u.prototype._getEndoRoots = function (e) { var t = e === this.p ? this.red : o.mont(e), i = new o(2).toRed(t).redInvm(), n = i.redNeg(), r = new o(3).toRed(t).redNeg().redSqrt().redMul(i); return [n.redAdd(r).fromRed(), n.redSub(r).fromRed()]; }), (u.prototype._getEndoBasis = function (e) { for ( var t, i, n, r, a, s, c, u, l, h = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), f = e, d = this.n.clone(), p = new o(1), m = new o(0), g = new o(0), _ = new o(1), v = 0; 0 !== f.cmpn(0); ) { var y = d.div(f); (u = d.sub(y.mul(f))), (l = g.sub(y.mul(p))); var b = _.sub(y.mul(m)); if (!n && u.cmp(h) < 0) (t = c.neg()), (i = p), (n = u.neg()), (r = l); else if (n && 2 == ++v) break; (c = u), (d = f), (f = u), (g = p), (p = l), (_ = m), (m = b); } (a = u.neg()), (s = l); var E = n.sqr().add(r.sqr()); return ( a.sqr().add(s.sqr()).cmp(E) >= 0 && ((a = t), (s = i)), n.negative && ((n = n.neg()), (r = r.neg())), a.negative && ((a = a.neg()), (s = s.neg())), [ { a: n, b: r, }, { a: a, b: s, }, ] ); }), (u.prototype._endoSplit = function (e) { var t = this.endo.basis, i = t[0], n = t[1], r = n.b.mul(e).divRound(this.n), o = i.b.neg().mul(e).divRound(this.n), a = r.mul(i.a), s = o.mul(n.a), c = r.mul(i.b), u = o.mul(n.b); return { k1: e.sub(a).sub(s), k2: c.add(u).neg(), }; }), (u.prototype.pointFromX = function (e, t) { (e = new o(e, 16)).red || (e = e.toRed(this.red)); var i = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b), n = i.redSqrt(); if (0 !== n.redSqr().redSub(i).cmp(this.zero)) throw new Error("invalid point"); var r = n.fromRed().isOdd(); return ((t && !r) || (!t && r)) && (n = n.redNeg()), this.point(e, n); }), (u.prototype.validate = function (e) { if (e.inf) return true; var t = e.x, i = e.y, n = this.a.redMul(t), r = t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b); return 0 === i.redSqr().redISub(r).cmpn(0); }), (u.prototype._endoWnafMulAdd = function (e, t, i) { for ( var n = this._endoWnafT1, r = this._endoWnafT2, o = 0; o < e.length; o++ ) { var a = this._endoSplit(t[o]), s = e[o], c = s._getBeta(); a.k1.negative && (a.k1.ineg(), (s = s.neg(true))), a.k2.negative && (a.k2.ineg(), (c = c.neg(true))), (n[2 * o] = s), (n[2 * o + 1] = c), (r[2 * o] = a.k1), (r[2 * o + 1] = a.k2); } for (var u = this._wnafMulAdd(1, n, r, 2 * o, i), l = 0; l < 2 * o; l++) (n[l] = null), (r[l] = null); return u; }), a(l, s.BasePoint), (u.prototype.point = function (e, t, i) { return new l(this, e, t, i); }), (u.prototype.pointFromJSON = function (e, t) { return l.fromJSON(this, e, t); }), (l.prototype._getBeta = function () { if (this.curve.endo) { var e = this.precomputed; if (e && e.beta) return e.beta; var t = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); if (e) { var i = this.curve, n = function (e) { return i.point(e.x.redMul(i.endo.beta), e.y); }; (e.beta = t), (t.precomputed = { beta: null, naf: e.naf && { wnd: e.naf.wnd, points: e.naf.points.map(n), }, doubles: e.doubles && { step: e.doubles.step, points: e.doubles.points.map(n), }, }); } return t; } }), (l.prototype.toJSON = function () { return this.precomputed ? [ this.x, this.y, this.precomputed && { doubles: this.precomputed.doubles && { step: this.precomputed.doubles.step, points: this.precomputed.doubles.points.slice(1), }, naf: this.precomputed.naf && { wnd: this.precomputed.naf.wnd, points: this.precomputed.naf.points.slice(1), }, }, ] : [this.x, this.y]; }), (l.fromJSON = function (e, t, i) { "string" == typeof t && (t = JSON.parse(t)); var n = e.point(t[0], t[1], i); if (!t[2]) return n; function r(t) { return e.point(t[0], t[1], i); } var o = t[2]; return ( (n.precomputed = { beta: null, doubles: o.doubles && { step: o.doubles.step, points: [n].concat(o.doubles.points.map(r)), }, naf: o.naf && { wnd: o.naf.wnd, points: [n].concat(o.naf.points.map(r)), }, }), n ); }), (l.prototype.inspect = function () { return this.isInfinity() ? "" : ""; }), (l.prototype.isInfinity = function () { return this.inf; }), (l.prototype.add = function (e) { if (this.inf) return e; if (e.inf) return this; if (this.eq(e)) return this.dbl(); if (this.neg().eq(e)) return this.curve.point(null, null); if (0 === this.x.cmp(e.x)) return this.curve.point(null, null); var t = this.y.redSub(e.y); 0 !== t.cmpn(0) && (t = t.redMul(this.x.redSub(e.x).redInvm())); var i = t.redSqr().redISub(this.x).redISub(e.x), n = t.redMul(this.x.redSub(i)).redISub(this.y); return this.curve.point(i, n); }), (l.prototype.dbl = function () { if (this.inf) return this; var e = this.y.redAdd(this.y); if (0 === e.cmpn(0)) return this.curve.point(null, null); var t = this.curve.a, i = this.x.redSqr(), n = e.redInvm(), r = i.redAdd(i).redIAdd(i).redIAdd(t).redMul(n), o = r.redSqr().redISub(this.x.redAdd(this.x)), a = r.redMul(this.x.redSub(o)).redISub(this.y); return this.curve.point(o, a); }), (l.prototype.getX = function () { return this.x.fromRed(); }), (l.prototype.getY = function () { return this.y.fromRed(); }), (l.prototype.mul = function (e) { return ( (e = new o(e, 16)), this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e) ); }), (l.prototype.mulAdd = function (e, t, i) { var n = [this, t], r = [e, i]; return this.curve.endo ? this.curve._endoWnafMulAdd(n, r) : this.curve._wnafMulAdd(1, n, r, 2); }), (l.prototype.jmulAdd = function (e, t, i) { var n = [this, t], r = [e, i]; return this.curve.endo ? this.curve._endoWnafMulAdd(n, r, true) : this.curve._wnafMulAdd(1, n, r, 2, true); }), (l.prototype.eq = function (e) { return ( this === e || (this.inf === e.inf && (this.inf || (0 === this.x.cmp(e.x) && 0 === this.y.cmp(e.y)))) ); }), (l.prototype.neg = function (e) { if (this.inf) return this; var t = this.curve.point(this.x, this.y.redNeg()); if (e && this.precomputed) { var i = this.precomputed, n = function (e) { return e.neg(); }; t.precomputed = { naf: i.naf && { wnd: i.naf.wnd, points: i.naf.points.map(n), }, doubles: i.doubles && { step: i.doubles.step, points: i.doubles.points.map(n), }, }; } return t; }), (l.prototype.toJ = function () { return this.inf ? this.curve.jpoint(null, null, null) : this.curve.jpoint(this.x, this.y, this.curve.one); }), a(h, s.BasePoint), (u.prototype.jpoint = function (e, t, i) { return new h(this, e, t, i); }), (h.prototype.toP = function () { if (this.isInfinity()) return this.curve.point(null, null); var e = this.z.redInvm(), t = e.redSqr(), i = this.x.redMul(t), n = this.y.redMul(t).redMul(e); return this.curve.point(i, n); }), (h.prototype.neg = function () { return this.curve.jpoint(this.x, this.y.redNeg(), this.z); }), (h.prototype.add = function (e) { if (this.isInfinity()) return e; if (e.isInfinity()) return this; var t = e.z.redSqr(), i = this.z.redSqr(), n = this.x.redMul(t), r = e.x.redMul(i), o = this.y.redMul(t.redMul(e.z)), a = e.y.redMul(i.redMul(this.z)), s = n.redSub(r), c = o.redSub(a); if (0 === s.cmpn(0)) return 0 !== c.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl(); var u = s.redSqr(), l = u.redMul(s), h = n.redMul(u), f = c.redSqr().redIAdd(l).redISub(h).redISub(h), d = c.redMul(h.redISub(f)).redISub(o.redMul(l)), p = this.z.redMul(e.z).redMul(s); return this.curve.jpoint(f, d, p); }), (h.prototype.mixedAdd = function (e) { if (this.isInfinity()) return e.toJ(); if (e.isInfinity()) return this; var t = this.z.redSqr(), i = this.x, n = e.x.redMul(t), r = this.y, o = e.y.redMul(t).redMul(this.z), a = i.redSub(n), s = r.redSub(o); if (0 === a.cmpn(0)) return 0 !== s.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl(); var c = a.redSqr(), u = c.redMul(a), l = i.redMul(c), h = s.redSqr().redIAdd(u).redISub(l).redISub(l), f = s.redMul(l.redISub(h)).redISub(r.redMul(u)), d = this.z.redMul(a); return this.curve.jpoint(h, f, d); }), (h.prototype.dblp = function (e) { if (0 === e) return this; if (this.isInfinity()) return this; if (!e) return this.dbl(); if (this.curve.zeroA || this.curve.threeA) { for (var t = this, i = 0; i < e; i++) t = t.dbl(); return t; } var n = this.curve.a, r = this.curve.tinv, o = this.x, a = this.y, s = this.z, c = s.redSqr().redSqr(), u = a.redAdd(a); for (i = 0; i < e; i++) { var l = o.redSqr(), h = u.redSqr(), f = h.redSqr(), d = l.redAdd(l).redIAdd(l).redIAdd(n.redMul(c)), p = o.redMul(h), m = d.redSqr().redISub(p.redAdd(p)), g = p.redISub(m), _ = d.redMul(g); _ = _.redIAdd(_).redISub(f); var v = u.redMul(s); i + 1 < e && (c = c.redMul(f)), (o = m), (s = v), (u = _); } return this.curve.jpoint(o, u.redMul(r), s); }), (h.prototype.dbl = function () { return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl(); }), (h.prototype._zeroDbl = function () { var e, t, i; if (this.zOne) { var n = this.x.redSqr(), r = this.y.redSqr(), o = r.redSqr(), a = this.x.redAdd(r).redSqr().redISub(n).redISub(o); a = a.redIAdd(a); var s = n.redAdd(n).redIAdd(n), c = s.redSqr().redISub(a).redISub(a), u = o.redIAdd(o); (u = (u = u.redIAdd(u)).redIAdd(u)), (e = c), (t = s.redMul(a.redISub(c)).redISub(u)), (i = this.y.redAdd(this.y)); } else { var l = this.x.redSqr(), h = this.y.redSqr(), f = h.redSqr(), d = this.x.redAdd(h).redSqr().redISub(l).redISub(f); d = d.redIAdd(d); var p = l.redAdd(l).redIAdd(l), m = p.redSqr(), g = f.redIAdd(f); (g = (g = g.redIAdd(g)).redIAdd(g)), (e = m.redISub(d).redISub(d)), (t = p.redMul(d.redISub(e)).redISub(g)), (i = (i = this.y.redMul(this.z)).redIAdd(i)); } return this.curve.jpoint(e, t, i); }), (h.prototype._threeDbl = function () { var e, t, i; if (this.zOne) { var n = this.x.redSqr(), r = this.y.redSqr(), o = r.redSqr(), a = this.x.redAdd(r).redSqr().redISub(n).redISub(o); a = a.redIAdd(a); var s = n.redAdd(n).redIAdd(n).redIAdd(this.curve.a), c = s.redSqr().redISub(a).redISub(a); e = c; var u = o.redIAdd(o); (u = (u = u.redIAdd(u)).redIAdd(u)), (t = s.redMul(a.redISub(c)).redISub(u)), (i = this.y.redAdd(this.y)); } else { var l = this.z.redSqr(), h = this.y.redSqr(), f = this.x.redMul(h), d = this.x.redSub(l).redMul(this.x.redAdd(l)); d = d.redAdd(d).redIAdd(d); var p = f.redIAdd(f), m = (p = p.redIAdd(p)).redAdd(p); (e = d.redSqr().redISub(m)), (i = this.y.redAdd(this.z).redSqr().redISub(h).redISub(l)); var g = h.redSqr(); (g = (g = (g = g.redIAdd(g)).redIAdd(g)).redIAdd(g)), (t = d.redMul(p.redISub(e)).redISub(g)); } return this.curve.jpoint(e, t, i); }), (h.prototype._dbl = function () { var e = this.curve.a, t = this.x, i = this.y, n = this.z, r = n.redSqr().redSqr(), o = t.redSqr(), a = i.redSqr(), s = o.redAdd(o).redIAdd(o).redIAdd(e.redMul(r)), c = t.redAdd(t), u = (c = c.redIAdd(c)).redMul(a), l = s.redSqr().redISub(u.redAdd(u)), h = u.redISub(l), f = a.redSqr(); f = (f = (f = f.redIAdd(f)).redIAdd(f)).redIAdd(f); var d = s.redMul(h).redISub(f), p = i.redAdd(i).redMul(n); return this.curve.jpoint(l, d, p); }), (h.prototype.trpl = function () { if (!this.curve.zeroA) return this.dbl().add(this); var e = this.x.redSqr(), t = this.y.redSqr(), i = this.z.redSqr(), n = t.redSqr(), r = e.redAdd(e).redIAdd(e), o = r.redSqr(), a = this.x.redAdd(t).redSqr().redISub(e).redISub(n), s = (a = (a = (a = a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub( o )).redSqr(), c = n.redIAdd(n); c = (c = (c = c.redIAdd(c)).redIAdd(c)).redIAdd(c); var u = r.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(c), l = t.redMul(u); l = (l = l.redIAdd(l)).redIAdd(l); var h = this.x.redMul(s).redISub(l); h = (h = h.redIAdd(h)).redIAdd(h); var f = this.y.redMul(u.redMul(c.redISub(u)).redISub(a.redMul(s))); f = (f = (f = f.redIAdd(f)).redIAdd(f)).redIAdd(f); var d = this.z.redAdd(a).redSqr().redISub(i).redISub(s); return this.curve.jpoint(h, f, d); }), (h.prototype.mul = function (e, t) { return (e = new o(e, t)), this.curve._wnafMul(this, e); }), (h.prototype.eq = function (e) { if ("affine" === e.type) return this.eq(e.toJ()); if (this === e) return true; var t = this.z.redSqr(), i = e.z.redSqr(); if (0 !== this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)) return false; var n = t.redMul(this.z), r = i.redMul(e.z); return 0 === this.y.redMul(r).redISub(e.y.redMul(n)).cmpn(0); }), (h.prototype.eqXToP = function (e) { var t = this.z.redSqr(), i = e.toRed(this.curve.red).redMul(t); if (0 === this.x.cmp(i)) return true; for (var n = e.clone(), r = this.curve.redN.redMul(t); ; ) { if ((n.iadd(this.curve.n), n.cmp(this.curve.p) >= 0)) return false; if ((i.redIAdd(r), 0 === this.x.cmp(i))) return true; } }), (h.prototype.inspect = function () { return this.isInfinity() ? "" : ""; }), (h.prototype.isInfinity = function () { return 0 === this.z.cmpn(0); }); }, function (e, t, i) { "use strict"; var n = i(91), r = i(11), o = i(1), a = n.base, s = i(17).utils; function c(e) { a.call(this, "mont", e), (this.a = new r(e.a, 16).toRed(this.red)), (this.b = new r(e.b, 16).toRed(this.red)), (this.i4 = new r(4).toRed(this.red).redInvm()), (this.two = new r(2).toRed(this.red)), (this.a24 = this.i4.redMul(this.a.redAdd(this.two))); } function u(e, t, i) { a.BasePoint.call(this, e, "projective"), null === t && null === i ? ((this.x = this.curve.one), (this.z = this.curve.zero)) : ((this.x = new r(t, 16)), (this.z = new r(i, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red))); } o(c, a), (e.exports = c), (c.prototype.validate = function (e) { var t = e.normalize().x, i = t.redSqr(), n = i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t); return 0 === n.redSqrt().redSqr().cmp(n); }), o(u, a.BasePoint), (c.prototype.decodePoint = function (e, t) { return this.point(s.toArray(e, t), 1); }), (c.prototype.point = function (e, t) { return new u(this, e, t); }), (c.prototype.pointFromJSON = function (e) { return u.fromJSON(this, e); }), (u.prototype.precompute = function () {}), (u.prototype._encode = function () { return this.getX().toArray("be", this.curve.p.byteLength()); }), (u.fromJSON = function (e, t) { return new u(e, t[0], t[1] || e.one); }), (u.prototype.inspect = function () { return this.isInfinity() ? "" : ""; }), (u.prototype.isInfinity = function () { return 0 === this.z.cmpn(0); }), (u.prototype.dbl = function () { var e = this.x.redAdd(this.z).redSqr(), t = this.x.redSub(this.z).redSqr(), i = e.redSub(t), n = e.redMul(t), r = i.redMul(t.redAdd(this.curve.a24.redMul(i))); return this.curve.point(n, r); }), (u.prototype.add = function () { throw new Error("Not supported on Montgomery curve"); }), (u.prototype.diffAdd = function (e, t) { var i = this.x.redAdd(this.z), n = this.x.redSub(this.z), r = e.x.redAdd(e.z), o = e.x.redSub(e.z).redMul(i), a = r.redMul(n), s = t.z.redMul(o.redAdd(a).redSqr()), c = t.x.redMul(o.redISub(a).redSqr()); return this.curve.point(s, c); }), (u.prototype.mul = function (e) { for ( var t = e.clone(), i = this, n = this.curve.point(null, null), r = []; 0 !== t.cmpn(0); t.iushrn(1) ) r.push(t.andln(1)); for (var o = r.length - 1; o >= 0; o--) 0 === r[o] ? ((i = i.diffAdd(n, this)), (n = n.dbl())) : ((n = i.diffAdd(n, this)), (i = i.dbl())); return n; }), (u.prototype.mulAdd = function () { throw new Error("Not supported on Montgomery curve"); }), (u.prototype.jumlAdd = function () { throw new Error("Not supported on Montgomery curve"); }), (u.prototype.eq = function (e) { return 0 === this.getX().cmp(e.getX()); }), (u.prototype.normalize = function () { return ( (this.x = this.x.redMul(this.z.redInvm())), (this.z = this.curve.one), this ); }), (u.prototype.getX = function () { return this.normalize(), this.x.fromRed(); }); }, function (e, t, i) { "use strict"; var n = i(91), r = i(17), o = i(11), a = i(1), s = n.base, c = r.utils.assert; function u(e) { (this.twisted = 1 != (0 | e.a)), (this.mOneA = this.twisted && -1 == (0 | e.a)), (this.extended = this.mOneA), s.call(this, "edwards", e), (this.a = new o(e.a, 16).umod(this.red.m)), (this.a = this.a.toRed(this.red)), (this.c = new o(e.c, 16).toRed(this.red)), (this.c2 = this.c.redSqr()), (this.d = new o(e.d, 16).toRed(this.red)), (this.dd = this.d.redAdd(this.d)), c(!this.twisted || 0 === this.c.fromRed().cmpn(1)), (this.oneC = 1 == (0 | e.c)); } function l(e, t, i, n, r) { s.BasePoint.call(this, e, "projective"), null === t && null === i && null === n ? ((this.x = this.curve.zero), (this.y = this.curve.one), (this.z = this.curve.one), (this.t = this.curve.zero), (this.zOne = true)) : ((this.x = new o(t, 16)), (this.y = new o(i, 16)), (this.z = n ? new o(n, 16) : this.curve.one), (this.t = r && new o(r, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), (this.zOne = this.z === this.curve.one), this.curve.extended && !this.t && ((this.t = this.x.redMul(this.y)), this.zOne || (this.t = this.t.redMul(this.z.redInvm())))); } a(u, s), (e.exports = u), (u.prototype._mulA = function (e) { return this.mOneA ? e.redNeg() : this.a.redMul(e); }), (u.prototype._mulC = function (e) { return this.oneC ? e : this.c.redMul(e); }), (u.prototype.jpoint = function (e, t, i, n) { return this.point(e, t, i, n); }), (u.prototype.pointFromX = function (e, t) { (e = new o(e, 16)).red || (e = e.toRed(this.red)); var i = e.redSqr(), n = this.c2.redSub(this.a.redMul(i)), r = this.one.redSub(this.c2.redMul(this.d).redMul(i)), a = n.redMul(r.redInvm()), s = a.redSqrt(); if (0 !== s.redSqr().redSub(a).cmp(this.zero)) throw new Error("invalid point"); var c = s.fromRed().isOdd(); return ((t && !c) || (!t && c)) && (s = s.redNeg()), this.point(e, s); }), (u.prototype.pointFromY = function (e, t) { (e = new o(e, 16)).red || (e = e.toRed(this.red)); var i = e.redSqr(), n = i.redSub(this.c2), r = i.redMul(this.d).redMul(this.c2).redSub(this.a), a = n.redMul(r.redInvm()); if (0 === a.cmp(this.zero)) { if (t) throw new Error("invalid point"); return this.point(this.zero, e); } var s = a.redSqrt(); if (0 !== s.redSqr().redSub(a).cmp(this.zero)) throw new Error("invalid point"); return s.fromRed().isOdd() !== t && (s = s.redNeg()), this.point(s, e); }), (u.prototype.validate = function (e) { if (e.isInfinity()) return true; e.normalize(); var t = e.x.redSqr(), i = e.y.redSqr(), n = t.redMul(this.a).redAdd(i), r = this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i))); return 0 === n.cmp(r); }), a(l, s.BasePoint), (u.prototype.pointFromJSON = function (e) { return l.fromJSON(this, e); }), (u.prototype.point = function (e, t, i, n) { return new l(this, e, t, i, n); }), (l.fromJSON = function (e, t) { return new l(e, t[0], t[1], t[2]); }), (l.prototype.inspect = function () { return this.isInfinity() ? "" : ""; }), (l.prototype.isInfinity = function () { return ( 0 === this.x.cmpn(0) && (0 === this.y.cmp(this.z) || (this.zOne && 0 === this.y.cmp(this.curve.c))) ); }), (l.prototype._extDbl = function () { var e = this.x.redSqr(), t = this.y.redSqr(), i = this.z.redSqr(); i = i.redIAdd(i); var n = this.curve._mulA(e), r = this.x.redAdd(this.y).redSqr().redISub(e).redISub(t), o = n.redAdd(t), a = o.redSub(i), s = n.redSub(t), c = r.redMul(a), u = o.redMul(s), l = r.redMul(s), h = a.redMul(o); return this.curve.point(c, u, h, l); }), (l.prototype._projDbl = function () { var e, t, i, n = this.x.redAdd(this.y).redSqr(), r = this.x.redSqr(), o = this.y.redSqr(); if (this.curve.twisted) { var a = (u = this.curve._mulA(r)).redAdd(o); if (this.zOne) (e = n.redSub(r).redSub(o).redMul(a.redSub(this.curve.two))), (t = a.redMul(u.redSub(o))), (i = a.redSqr().redSub(a).redSub(a)); else { var s = this.z.redSqr(), c = a.redSub(s).redISub(s); (e = n.redSub(r).redISub(o).redMul(c)), (t = a.redMul(u.redSub(o))), (i = a.redMul(c)); } } else { var u = r.redAdd(o); (s = this.curve._mulC(this.z).redSqr()), (c = u.redSub(s).redSub(s)); (e = this.curve._mulC(n.redISub(u)).redMul(c)), (t = this.curve._mulC(u).redMul(r.redISub(o))), (i = u.redMul(c)); } return this.curve.point(e, t, i); }), (l.prototype.dbl = function () { return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl(); }), (l.prototype._extAdd = function (e) { var t = this.y.redSub(this.x).redMul(e.y.redSub(e.x)), i = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)), n = this.t.redMul(this.curve.dd).redMul(e.t), r = this.z.redMul(e.z.redAdd(e.z)), o = i.redSub(t), a = r.redSub(n), s = r.redAdd(n), c = i.redAdd(t), u = o.redMul(a), l = s.redMul(c), h = o.redMul(c), f = a.redMul(s); return this.curve.point(u, l, f, h); }), (l.prototype._projAdd = function (e) { var t, i, n = this.z.redMul(e.z), r = n.redSqr(), o = this.x.redMul(e.x), a = this.y.redMul(e.y), s = this.curve.d.redMul(o).redMul(a), c = r.redSub(s), u = r.redAdd(s), l = this.x .redAdd(this.y) .redMul(e.x.redAdd(e.y)) .redISub(o) .redISub(a), h = n.redMul(c).redMul(l); return ( this.curve.twisted ? ((t = n.redMul(u).redMul(a.redSub(this.curve._mulA(o)))), (i = c.redMul(u))) : ((t = n.redMul(u).redMul(a.redSub(o))), (i = this.curve._mulC(c).redMul(u))), this.curve.point(h, t, i) ); }), (l.prototype.add = function (e) { return this.isInfinity() ? e : e.isInfinity() ? this : this.curve.extended ? this._extAdd(e) : this._projAdd(e); }), (l.prototype.mul = function (e) { return this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve._wnafMul(this, e); }), (l.prototype.mulAdd = function (e, t, i) { return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, false); }), (l.prototype.jmulAdd = function (e, t, i) { return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, true); }), (l.prototype.normalize = function () { if (this.zOne) return this; var e = this.z.redInvm(); return ( (this.x = this.x.redMul(e)), (this.y = this.y.redMul(e)), this.t && (this.t = this.t.redMul(e)), (this.z = this.curve.one), (this.zOne = true), this ); }), (l.prototype.neg = function () { return this.curve.point( this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg() ); }), (l.prototype.getX = function () { return this.normalize(), this.x.fromRed(); }), (l.prototype.getY = function () { return this.normalize(), this.y.fromRed(); }), (l.prototype.eq = function (e) { return ( this === e || (0 === this.getX().cmp(e.getX()) && 0 === this.getY().cmp(e.getY())) ); }), (l.prototype.eqXToP = function (e) { var t = e.toRed(this.curve.red).redMul(this.z); if (0 === this.x.cmp(t)) return true; for (var i = e.clone(), n = this.curve.redN.redMul(this.z); ; ) { if ((i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0)) return false; if ((t.redIAdd(n), 0 === this.x.cmp(t))) return true; } }), (l.prototype.toP = l.prototype.normalize), (l.prototype.mixedAdd = l.prototype.add); }, function (e, t, i) { "use strict"; var n, r = t, o = i(135), a = i(17), s = a.utils.assert; function c(e) { "short" === e.type ? (this.curve = new a.curve.short(e)) : "edwards" === e.type ? (this.curve = new a.curve.edwards(e)) : (this.curve = new a.curve.mont(e)), (this.g = this.curve.g), (this.n = this.curve.n), (this.hash = e.hash), s(this.g.validate(), "Invalid curve"), s(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O"); } function u(e, t) { Object.defineProperty(r, e, { configurable: true, enumerable: true, get: function () { var i = new c(t); return ( Object.defineProperty(r, e, { configurable: true, enumerable: true, value: i, }), i ); }, }); } (r.PresetCurve = c), u("p192", { type: "short", prime: "p192", p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff", a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc", b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1", n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831", hash: o.sha256, gRed: false, g: [ "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811", ], }), u("p224", { type: "short", prime: "p224", p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001", a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe", b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4", n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d", hash: o.sha256, gRed: false, g: [ "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34", ], }), u("p256", { type: "short", prime: null, p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff", a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc", b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b", n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551", hash: o.sha256, gRed: false, g: [ "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5", ], }), u("p384", { type: "short", prime: null, p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff", a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc", b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef", n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973", hash: o.sha384, gRed: false, g: [ "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f", ], }), u("p521", { type: "short", prime: null, p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff", a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc", b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00", n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409", hash: o.sha512, gRed: false, g: [ "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650", ], }), u("curve25519", { type: "mont", prime: "p25519", p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", a: "76d06", b: "1", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", hash: o.sha256, gRed: false, g: ["9"], }), u("ed25519", { type: "edwards", prime: "p25519", p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed", a: "-1", c: "1", d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3", n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed", hash: o.sha256, gRed: false, g: [ "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", "6666666666666666666666666666666666666666666666666666666666666658", ], }); try { n = i(562); } catch (e) { n = void 0; } u("secp256k1", { type: "short", prime: "k256", p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f", a: "0", b: "7", n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141", h: "1", hash: o.sha256, beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", basis: [ { a: "3086d221a7d46bcde86c90e49284eb15", b: "-e4437ed6010e88286f547fa90abfe4c3", }, { a: "114ca50f7a8e2f3f657c1108d9d44cfd8", b: "3086d221a7d46bcde86c90e49284eb15", }, ], gRed: false, g: [ "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", n, ], }); }, function (e, t, i) { "use strict"; (t.sha1 = i(557)), (t.sha224 = i(558)), (t.sha256 = i(216)), (t.sha384 = i(559)), (t.sha512 = i(217)); }, function (e, t, i) { "use strict"; var n = i(33), r = i(71), o = i(215), a = n.rotl32, s = n.sum32, c = n.sum32_5, u = o.ft_1, l = r.BlockHash, h = [1518500249, 1859775393, 2400959708, 3395469782]; function f() { if (!(this instanceof f)) return new f(); l.call(this), (this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]), (this.W = new Array(80)); } n.inherits(f, l), (e.exports = f), (f.blockSize = 512), (f.outSize = 160), (f.hmacStrength = 80), (f.padLength = 64), (f.prototype._update = function (e, t) { for (var i = this.W, n = 0; n < 16; n++) i[n] = e[t + n]; for (; n < i.length; n++) i[n] = a(i[n - 3] ^ i[n - 8] ^ i[n - 14] ^ i[n - 16], 1); var r = this.h[0], o = this.h[1], l = this.h[2], f = this.h[3], d = this.h[4]; for (n = 0; n < i.length; n++) { var p = ~~(n / 20), m = c(a(r, 5), u(p, o, l, f), d, i[n], h[p]); (d = f), (f = l), (l = a(o, 30)), (o = r), (r = m); } (this.h[0] = s(this.h[0], r)), (this.h[1] = s(this.h[1], o)), (this.h[2] = s(this.h[2], l)), (this.h[3] = s(this.h[3], f)), (this.h[4] = s(this.h[4], d)); }), (f.prototype._digest = function (e) { return "hex" === e ? n.toHex32(this.h, "big") : n.split32(this.h, "big"); }); }, function (e, t, i) { "use strict"; var n = i(33), r = i(216); function o() { if (!(this instanceof o)) return new o(); r.call(this), (this.h = [ 3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428, ]); } n.inherits(o, r), (e.exports = o), (o.blockSize = 512), (o.outSize = 224), (o.hmacStrength = 192), (o.padLength = 64), (o.prototype._digest = function (e) { return "hex" === e ? n.toHex32(this.h.slice(0, 7), "big") : n.split32(this.h.slice(0, 7), "big"); }); }, function (e, t, i) { "use strict"; var n = i(33), r = i(217); function o() { if (!(this instanceof o)) return new o(); r.call(this), (this.h = [ 3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, 355462360, 4144912697, 1731405415, 4290775857, 2394180231, 1750603025, 3675008525, 1694076839, 1203062813, 3204075428, ]); } n.inherits(o, r), (e.exports = o), (o.blockSize = 1024), (o.outSize = 384), (o.hmacStrength = 192), (o.padLength = 128), (o.prototype._digest = function (e) { return "hex" === e ? n.toHex32(this.h.slice(0, 12), "big") : n.split32(this.h.slice(0, 12), "big"); }); }, function (e, t, i) { "use strict"; var n = i(33), r = i(71), o = n.rotl32, a = n.sum32, s = n.sum32_3, c = n.sum32_4, u = r.BlockHash; function l() { if (!(this instanceof l)) return new l(); u.call(this), (this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]), (this.endian = "little"); } function h(e, t, i, n) { return e <= 15 ? t ^ i ^ n : e <= 31 ? (t & i) | (~t & n) : e <= 47 ? (t | ~i) ^ n : e <= 63 ? (t & n) | (i & ~n) : t ^ (i | ~n); } function f(e) { return e <= 15 ? 0 : e <= 31 ? 1518500249 : e <= 47 ? 1859775393 : e <= 63 ? 2400959708 : 2840853838; } function d(e) { return e <= 15 ? 1352829926 : e <= 31 ? 1548603684 : e <= 47 ? 1836072691 : e <= 63 ? 2053994217 : 0; } n.inherits(l, u), (t.ripemd160 = l), (l.blockSize = 512), (l.outSize = 160), (l.hmacStrength = 192), (l.padLength = 64), (l.prototype._update = function (e, t) { for ( var i = this.h[0], n = this.h[1], r = this.h[2], u = this.h[3], l = this.h[4], v = i, y = n, b = r, E = u, T = l, A = 0; A < 80; A++ ) { var x = a(o(c(i, h(A, n, r, u), e[p[A] + t], f(A)), g[A]), l); (i = l), (l = u), (u = o(r, 10)), (r = n), (n = x), (x = a(o(c(v, h(79 - A, y, b, E), e[m[A] + t], d(A)), _[A]), T)), (v = T), (T = E), (E = o(b, 10)), (b = y), (y = x); } (x = s(this.h[1], r, E)), (this.h[1] = s(this.h[2], u, T)), (this.h[2] = s(this.h[3], l, v)), (this.h[3] = s(this.h[4], i, y)), (this.h[4] = s(this.h[0], n, b)), (this.h[0] = x); }), (l.prototype._digest = function (e) { return "hex" === e ? n.toHex32(this.h, "little") : n.split32(this.h, "little"); }); var p = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, ], m = [ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11, ], g = [ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, ], _ = [ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11, ]; }, function (e, t, i) { "use strict"; var n = i(33), r = i(25); function o(e, t, i) { if (!(this instanceof o)) return new o(e, t, i); (this.Hash = e), (this.blockSize = e.blockSize / 8), (this.outSize = e.outSize / 8), (this.inner = null), (this.outer = null), this._init(n.toArray(t, i)); } (e.exports = o), (o.prototype._init = function (e) { e.length > this.blockSize && (e = new this.Hash().update(e).digest()), r(e.length <= this.blockSize); for (var t = e.length; t < this.blockSize; t++) e.push(0); for (t = 0; t < e.length; t++) e[t] ^= 54; for (this.inner = new this.Hash().update(e), t = 0; t < e.length; t++) e[t] ^= 106; this.outer = new this.Hash().update(e); }), (o.prototype.update = function (e, t) { return this.inner.update(e, t), this; }), (o.prototype.digest = function (e) { return this.outer.update(this.inner.digest()), this.outer.digest(e); }); }, function (e, t) { e.exports = { doubles: { step: 4, points: [ [ "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821", ], [ "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf", ], [ "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695", ], [ "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9", ], [ "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36", ], [ "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f", ], [ "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999", ], [ "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09", ], [ "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d", ], [ "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088", ], [ "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d", ], [ "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8", ], [ "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a", ], [ "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453", ], [ "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160", ], [ "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0", ], [ "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6", ], [ "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589", ], [ "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17", ], [ "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda", ], [ "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd", ], [ "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2", ], [ "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6", ], [ "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f", ], [ "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01", ], [ "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3", ], [ "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f", ], [ "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7", ], [ "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78", ], [ "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1", ], [ "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150", ], [ "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82", ], [ "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc", ], [ "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b", ], [ "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51", ], [ "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45", ], [ "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120", ], [ "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84", ], [ "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d", ], [ "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d", ], [ "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8", ], [ "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8", ], [ "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac", ], [ "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f", ], [ "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962", ], [ "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907", ], [ "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec", ], [ "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d", ], [ "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414", ], [ "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd", ], [ "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0", ], [ "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811", ], [ "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1", ], [ "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c", ], [ "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73", ], [ "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd", ], [ "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405", ], [ "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589", ], [ "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e", ], [ "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27", ], [ "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1", ], [ "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482", ], [ "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945", ], [ "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573", ], [ "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82", ], ], }, naf: { wnd: 7, points: [ [ "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672", ], [ "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6", ], [ "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da", ], [ "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37", ], [ "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b", ], [ "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81", ], [ "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58", ], [ "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77", ], [ "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a", ], [ "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c", ], [ "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67", ], [ "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402", ], [ "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55", ], [ "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482", ], [ "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82", ], [ "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396", ], [ "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49", ], [ "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf", ], [ "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a", ], [ "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7", ], [ "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933", ], [ "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a", ], [ "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6", ], [ "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37", ], [ "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e", ], [ "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6", ], [ "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476", ], [ "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40", ], [ "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61", ], [ "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683", ], [ "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5", ], [ "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b", ], [ "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417", ], [ "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868", ], [ "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a", ], [ "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6", ], [ "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996", ], [ "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e", ], [ "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d", ], [ "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2", ], [ "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e", ], [ "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437", ], [ "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311", ], [ "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4", ], [ "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575", ], [ "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d", ], [ "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d", ], [ "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629", ], [ "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06", ], [ "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374", ], [ "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee", ], [ "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1", ], [ "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b", ], [ "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661", ], [ "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6", ], [ "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e", ], [ "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d", ], [ "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc", ], [ "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4", ], [ "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c", ], [ "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b", ], [ "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913", ], [ "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154", ], [ "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865", ], [ "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc", ], [ "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224", ], [ "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e", ], [ "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6", ], [ "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511", ], [ "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b", ], [ "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2", ], [ "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c", ], [ "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3", ], [ "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d", ], [ "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700", ], [ "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4", ], [ "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196", ], [ "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4", ], [ "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257", ], [ "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13", ], [ "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096", ], [ "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38", ], [ "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f", ], [ "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448", ], [ "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a", ], [ "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4", ], [ "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437", ], [ "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7", ], [ "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d", ], [ "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a", ], [ "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54", ], [ "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77", ], [ "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517", ], [ "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10", ], [ "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125", ], [ "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e", ], [ "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1", ], [ "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2", ], [ "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423", ], [ "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8", ], [ "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758", ], [ "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375", ], [ "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d", ], [ "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec", ], [ "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0", ], [ "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c", ], [ "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4", ], [ "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f", ], [ "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649", ], [ "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826", ], [ "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5", ], [ "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87", ], [ "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b", ], [ "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc", ], [ "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c", ], [ "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f", ], [ "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a", ], [ "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46", ], [ "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f", ], [ "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03", ], [ "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08", ], [ "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8", ], [ "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373", ], [ "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3", ], [ "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8", ], [ "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1", ], [ "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9", ], ], }, }; }, function (e, t, i) { "use strict"; function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(11), o = i(564), a = i(17), s = a.utils.assert, c = i(565), u = i(566); function l(e) { if (!(this instanceof l)) return new l(e); "string" == typeof e && (s(a.curves.hasOwnProperty(e), "Unknown curve " + e), (e = a.curves[e])), e instanceof a.curves.PresetCurve && (e = { curve: e, }), (this.curve = e.curve.curve), (this.n = this.curve.n), (this.nh = this.n.ushrn(1)), (this.g = this.curve.g), (this.g = e.curve.g), this.g.precompute(e.curve.n.bitLength() + 1), (this.hash = e.hash || e.curve.hash); } (e.exports = l), (l.prototype.keyPair = function (e) { return new c(this, e); }), (l.prototype.keyFromPrivate = function (e, t) { return c.fromPrivate(this, e, t); }), (l.prototype.keyFromPublic = function (e, t) { return c.fromPublic(this, e, t); }), (l.prototype.genKeyPair = function (e) { e || (e = {}); for ( var t = new o({ hash: this.hash, pers: e.pers, persEnc: e.persEnc || "utf8", entropy: e.entropy || a.rand(this.hash.hmacStrength), entropyEnc: (e.entropy && e.entropyEnc) || "utf8", nonce: this.n.toArray(), }), i = this.n.byteLength(), n = this.n.sub(new r(2)); ; ) { var s = new r(t.generate(i)); if (!(s.cmp(n) > 0)) return s.iaddn(1), this.keyFromPrivate(s); } }), (l.prototype._truncateToN = function (e, t) { var i = 8 * e.byteLength() - this.n.bitLength(); return ( i > 0 && (e = e.ushrn(i)), !t && e.cmp(this.n) >= 0 ? e.sub(this.n) : e ); }), (l.prototype.sign = function (e, t, i, a) { "object" === n(i) && ((a = i), (i = null)), a || (a = {}), (t = this.keyFromPrivate(t, i)), (e = this._truncateToN(new r(e, 16))); for ( var s = this.n.byteLength(), c = t.getPrivate().toArray("be", s), l = e.toArray("be", s), h = new o({ hash: this.hash, entropy: c, nonce: l, pers: a.pers, persEnc: a.persEnc || "utf8", }), f = this.n.sub(new r(1)), d = 0; ; d++ ) { var p = a.k ? a.k(d) : new r(h.generate(this.n.byteLength())); if ( !((p = this._truncateToN(p, true)).cmpn(1) <= 0 || p.cmp(f) >= 0) ) { var m = this.g.mul(p); if (!m.isInfinity()) { var g = m.getX(), _ = g.umod(this.n); if (0 !== _.cmpn(0)) { var v = p.invm(this.n).mul(_.mul(t.getPrivate()).iadd(e)); if (0 !== (v = v.umod(this.n)).cmpn(0)) { var y = (m.getY().isOdd() ? 1 : 0) | (0 !== g.cmp(_) ? 2 : 0); return ( a.canonical && v.cmp(this.nh) > 0 && ((v = this.n.sub(v)), (y ^= 1)), new u({ r: _, s: v, recoveryParam: y, }) ); } } } } } }), (l.prototype.verify = function (e, t, i, n) { (e = this._truncateToN(new r(e, 16))), (i = this.keyFromPublic(i, n)); var o = (t = new u(t, "hex")).r, a = t.s; if (o.cmpn(1) < 0 || o.cmp(this.n) >= 0) return false; if (a.cmpn(1) < 0 || a.cmp(this.n) >= 0) return false; var s, c = a.invm(this.n), l = c.mul(e).umod(this.n), h = c.mul(o).umod(this.n); return this.curve._maxwellTrick ? !(s = this.g.jmulAdd(l, i.getPublic(), h)).isInfinity() && s.eqXToP(o) : !(s = this.g.mulAdd(l, i.getPublic(), h)).isInfinity() && 0 === s.getX().umod(this.n).cmp(o); }), (l.prototype.recoverPubKey = function (e, t, i, n) { s((3 & i) === i, "The recovery param is more than two bits"), (t = new u(t, n)); var o = this.n, a = new r(e), c = t.r, l = t.s, h = 1 & i, f = i >> 1; if (c.cmp(this.curve.p.umod(this.curve.n)) >= 0 && f) throw new Error("Unable to find sencond key candinate"); c = f ? this.curve.pointFromX(c.add(this.curve.n), h) : this.curve.pointFromX(c, h); var d = t.r.invm(o), p = o.sub(a).mul(d).umod(o), m = l.mul(d).umod(o); return this.g.mulAdd(p, c, m); }), (l.prototype.getKeyRecoveryParam = function (e, t, i, n) { if (null !== (t = new u(t, n)).recoveryParam) return t.recoveryParam; for (var r = 0; r < 4; r++) { var o; try { o = this.recoverPubKey(e, t, r); } catch (e) { continue; } if (o.eq(i)) return r; } throw new Error("Unable to find valid recovery factor"); }); }, function (e, t, i) { "use strict"; var n = i(135), r = i(214), o = i(25); function a(e) { if (!(this instanceof a)) return new a(e); (this.hash = e.hash), (this.predResist = !!e.predResist), (this.outLen = this.hash.outSize), (this.minEntropy = e.minEntropy || this.hash.hmacStrength), (this._reseed = null), (this.reseedInterval = null), (this.K = null), (this.V = null); var t = r.toArray(e.entropy, e.entropyEnc || "hex"), i = r.toArray(e.nonce, e.nonceEnc || "hex"), n = r.toArray(e.pers, e.persEnc || "hex"); o( t.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._init(t, i, n); } (e.exports = a), (a.prototype._init = function (e, t, i) { var n = e.concat(t).concat(i); (this.K = new Array(this.outLen / 8)), (this.V = new Array(this.outLen / 8)); for (var r = 0; r < this.V.length; r++) (this.K[r] = 0), (this.V[r] = 1); this._update(n), (this._reseed = 1), (this.reseedInterval = 281474976710656); }), (a.prototype._hmac = function () { return new n.hmac(this.hash, this.K); }), (a.prototype._update = function (e) { var t = this._hmac().update(this.V).update([0]); e && (t = t.update(e)), (this.K = t.digest()), (this.V = this._hmac().update(this.V).digest()), e && ((this.K = this._hmac() .update(this.V) .update([1]) .update(e) .digest()), (this.V = this._hmac().update(this.V).digest())); }), (a.prototype.reseed = function (e, t, i, n) { "string" != typeof t && ((n = i), (i = t), (t = null)), (e = r.toArray(e, t)), (i = r.toArray(i, n)), o( e.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits" ), this._update(e.concat(i || [])), (this._reseed = 1); }), (a.prototype.generate = function (e, t, i, n) { if (this._reseed > this.reseedInterval) throw new Error("Reseed is required"); "string" != typeof t && ((n = i), (i = t), (t = null)), i && ((i = r.toArray(i, n || "hex")), this._update(i)); for (var o = []; o.length < e; ) (this.V = this._hmac().update(this.V).digest()), (o = o.concat(this.V)); var a = o.slice(0, e); return this._update(i), this._reseed++, r.encode(a, t); }); }, function (e, t, i) { "use strict"; var n = i(11), r = i(17).utils.assert; function o(e, t) { (this.ec = e), (this.priv = null), (this.pub = null), t.priv && this._importPrivate(t.priv, t.privEnc), t.pub && this._importPublic(t.pub, t.pubEnc); } (e.exports = o), (o.fromPublic = function (e, t, i) { return t instanceof o ? t : new o(e, { pub: t, pubEnc: i, }); }), (o.fromPrivate = function (e, t, i) { return t instanceof o ? t : new o(e, { priv: t, privEnc: i, }); }), (o.prototype.validate = function () { var e = this.getPublic(); return e.isInfinity() ? { result: false, reason: "Invalid public key", } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? { result: true, reason: null, } : { result: false, reason: "Public key * N != O", } : { result: false, reason: "Public key is not a point", }; }), (o.prototype.getPublic = function (e, t) { return ( "string" == typeof e && ((t = e), (e = null)), this.pub || (this.pub = this.ec.g.mul(this.priv)), t ? this.pub.encode(t, e) : this.pub ); }), (o.prototype.getPrivate = function (e) { return "hex" === e ? this.priv.toString(16, 2) : this.priv; }), (o.prototype._importPrivate = function (e, t) { (this.priv = new n(e, t || 16)), (this.priv = this.priv.umod(this.ec.curve.n)); }), (o.prototype._importPublic = function (e, t) { if (e.x || e.y) return ( "mont" === this.ec.curve.type ? r(e.x, "Need x coordinate") : ("short" !== this.ec.curve.type && "edwards" !== this.ec.curve.type) || r(e.x && e.y, "Need both x and y coordinate"), void (this.pub = this.ec.curve.point(e.x, e.y)) ); this.pub = this.ec.curve.decodePoint(e, t); }), (o.prototype.derive = function (e) { return e.mul(this.priv).getX(); }), (o.prototype.sign = function (e, t, i) { return this.ec.sign(e, this, t, i); }), (o.prototype.verify = function (e, t) { return this.ec.verify(e, t, this); }), (o.prototype.inspect = function () { return ( "" ); }); }, function (e, t, i) { "use strict"; var n = i(11), r = i(17).utils, o = r.assert; function a(e, t) { if (e instanceof a) return e; this._importDER(e, t) || (o(e.r && e.s, "Signature without r or s"), (this.r = new n(e.r, 16)), (this.s = new n(e.s, 16)), void 0 === e.recoveryParam ? (this.recoveryParam = null) : (this.recoveryParam = e.recoveryParam)); } function s() { this.place = 0; } function c(e, t) { var i = e[t.place++]; if (!(128 & i)) return i; for (var n = 15 & i, r = 0, o = 0, a = t.place; o < n; o++, a++) (r <<= 8), (r |= e[a]); return (t.place = a), r; } function u(e) { for (var t = 0, i = e.length - 1; !e[t] && !(128 & e[t + 1]) && t < i; ) t++; return 0 === t ? e : e.slice(t); } function l(e, t) { if (t < 128) e.push(t); else { var i = 1 + ((Math.log(t) / Math.LN2) >>> 3); for (e.push(128 | i); --i; ) e.push((t >>> (i << 3)) & 255); e.push(t); } } (e.exports = a), (a.prototype._importDER = function (e, t) { e = r.toArray(e, t); var i = new s(); if (48 !== e[i.place++]) return false; if (c(e, i) + i.place !== e.length) return false; if (2 !== e[i.place++]) return false; var o = c(e, i), a = e.slice(i.place, o + i.place); if (((i.place += o), 2 !== e[i.place++])) return false; var u = c(e, i); if (e.length !== u + i.place) return false; var l = e.slice(i.place, u + i.place); return ( 0 === a[0] && 128 & a[1] && (a = a.slice(1)), 0 === l[0] && 128 & l[1] && (l = l.slice(1)), (this.r = new n(a)), (this.s = new n(l)), (this.recoveryParam = null), true ); }), (a.prototype.toDER = function (e) { var t = this.r.toArray(), i = this.s.toArray(); for ( 128 & t[0] && (t = [0].concat(t)), 128 & i[0] && (i = [0].concat(i)), t = u(t), i = u(i); !(i[0] || 128 & i[1]); ) i = i.slice(1); var n = [2]; l(n, t.length), (n = n.concat(t)).push(2), l(n, i.length); var o = n.concat(i), a = [48]; return l(a, o.length), (a = a.concat(o)), r.encode(a, e); }); }, function (e, t, i) { "use strict"; var n = i(135), r = i(17), o = r.utils, a = o.assert, s = o.parseBytes, c = i(568), u = i(569); function l(e) { if ( (a("ed25519" === e, "only tested with ed25519 so far"), !(this instanceof l)) ) return new l(e); e = r.curves[e].curve; (this.curve = e), (this.g = e.g), this.g.precompute(e.n.bitLength() + 1), (this.pointClass = e.point().constructor), (this.encodingLength = Math.ceil(e.n.bitLength() / 8)), (this.hash = n.sha512); } (e.exports = l), (l.prototype.sign = function (e, t) { e = s(e); var i = this.keyFromSecret(t), n = this.hashInt(i.messagePrefix(), e), r = this.g.mul(n), o = this.encodePoint(r), a = this.hashInt(o, i.pubBytes(), e).mul(i.priv()), c = n.add(a).umod(this.curve.n); return this.makeSignature({ R: r, S: c, Rencoded: o, }); }), (l.prototype.verify = function (e, t, i) { (e = s(e)), (t = this.makeSignature(t)); var n = this.keyFromPublic(i), r = this.hashInt(t.Rencoded(), n.pubBytes(), e), o = this.g.mul(t.S()); return t.R().add(n.pub().mul(r)).eq(o); }), (l.prototype.hashInt = function () { for (var e = this.hash(), t = 0; t < arguments.length; t++) e.update(arguments[t]); return o.intFromLE(e.digest()).umod(this.curve.n); }), (l.prototype.keyFromPublic = function (e) { return c.fromPublic(this, e); }), (l.prototype.keyFromSecret = function (e) { return c.fromSecret(this, e); }), (l.prototype.makeSignature = function (e) { return e instanceof u ? e : new u(this, e); }), (l.prototype.encodePoint = function (e) { var t = e.getY().toArray("le", this.encodingLength); return (t[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0), t; }), (l.prototype.decodePoint = function (e) { var t = (e = o.parseBytes(e)).length - 1, i = e.slice(0, t).concat(-129 & e[t]), n = 0 != (128 & e[t]), r = o.intFromLE(i); return this.curve.pointFromY(r, n); }), (l.prototype.encodeInt = function (e) { return e.toArray("le", this.encodingLength); }), (l.prototype.decodeInt = function (e) { return o.intFromLE(e); }), (l.prototype.isPoint = function (e) { return e instanceof this.pointClass; }); }, function (e, t, i) { "use strict"; var n = i(17).utils, r = n.assert, o = n.parseBytes, a = n.cachedProperty; function s(e, t) { (this.eddsa = e), (this._secret = o(t.secret)), e.isPoint(t.pub) ? (this._pub = t.pub) : (this._pubBytes = o(t.pub)); } (s.fromPublic = function (e, t) { return t instanceof s ? t : new s(e, { pub: t, }); }), (s.fromSecret = function (e, t) { return t instanceof s ? t : new s(e, { secret: t, }); }), (s.prototype.secret = function () { return this._secret; }), a(s, "pubBytes", function () { return this.eddsa.encodePoint(this.pub()); }), a(s, "pub", function () { return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv()); }), a(s, "privBytes", function () { var e = this.eddsa, t = this.hash(), i = e.encodingLength - 1, n = t.slice(0, e.encodingLength); return (n[0] &= 248), (n[i] &= 127), (n[i] |= 64), n; }), a(s, "priv", function () { return this.eddsa.decodeInt(this.privBytes()); }), a(s, "hash", function () { return this.eddsa.hash().update(this.secret()).digest(); }), a(s, "messagePrefix", function () { return this.hash().slice(this.eddsa.encodingLength); }), (s.prototype.sign = function (e) { return ( r(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this) ); }), (s.prototype.verify = function (e, t) { return this.eddsa.verify(e, t, this); }), (s.prototype.getSecret = function (e) { return ( r(this._secret, "KeyPair is public only"), n.encode(this.secret(), e) ); }), (s.prototype.getPublic = function (e) { return n.encode(this.pubBytes(), e); }), (e.exports = s); }, function (e, t, i) { "use strict"; function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(11), o = i(17).utils, a = o.assert, s = o.cachedProperty, c = o.parseBytes; function u(e, t) { (this.eddsa = e), "object" !== n(t) && (t = c(t)), Array.isArray(t) && (t = { R: t.slice(0, e.encodingLength), S: t.slice(e.encodingLength), }), a(t.R && t.S, "Signature without R or S"), e.isPoint(t.R) && (this._R = t.R), t.S instanceof r && (this._S = t.S), (this._Rencoded = Array.isArray(t.R) ? t.R : t.Rencoded), (this._Sencoded = Array.isArray(t.S) ? t.S : t.Sencoded); } s(u, "S", function () { return this.eddsa.decodeInt(this.Sencoded()); }), s(u, "R", function () { return this.eddsa.decodePoint(this.Rencoded()); }), s(u, "Rencoded", function () { return this.eddsa.encodePoint(this.R()); }), s(u, "Sencoded", function () { return this.eddsa.encodeInt(this.S()); }), (u.prototype.toBytes = function () { return this.Rencoded().concat(this.Sencoded()); }), (u.prototype.toHex = function () { return o.encode(this.toBytes(), "hex").toUpperCase(); }), (e.exports = u); }, function (e, t, i) { "use strict"; var n = i(72); t.certificate = i(581); var r = n.define("RSAPrivateKey", function () { this.seq().obj( this.key("version").int(), this.key("modulus").int(), this.key("publicExponent").int(), this.key("privateExponent").int(), this.key("prime1").int(), this.key("prime2").int(), this.key("exponent1").int(), this.key("exponent2").int(), this.key("coefficient").int() ); }); t.RSAPrivateKey = r; var o = n.define("RSAPublicKey", function () { this.seq().obj( this.key("modulus").int(), this.key("publicExponent").int() ); }); t.RSAPublicKey = o; var a = n.define("SubjectPublicKeyInfo", function () { this.seq().obj( this.key("algorithm").use(s), this.key("subjectPublicKey").bitstr() ); }); t.PublicKey = a; var s = n.define("AlgorithmIdentifier", function () { this.seq().obj( this.key("algorithm").objid(), this.key("none").null_().optional(), this.key("curve").objid().optional(), this.key("params") .seq() .obj(this.key("p").int(), this.key("q").int(), this.key("g").int()) .optional() ); }), c = n.define("PrivateKeyInfo", function () { this.seq().obj( this.key("version").int(), this.key("algorithm").use(s), this.key("subjectPrivateKey").octstr() ); }); t.PrivateKey = c; var u = n.define("EncryptedPrivateKeyInfo", function () { this.seq().obj( this.key("algorithm") .seq() .obj( this.key("id").objid(), this.key("decrypt") .seq() .obj( this.key("kde") .seq() .obj( this.key("id").objid(), this.key("kdeparams") .seq() .obj(this.key("salt").octstr(), this.key("iters").int()) ), this.key("cipher") .seq() .obj(this.key("algo").objid(), this.key("iv").octstr()) ) ), this.key("subjectPrivateKey").octstr() ); }); t.EncryptedPrivateKey = u; var l = n.define("DSAPrivateKey", function () { this.seq().obj( this.key("version").int(), this.key("p").int(), this.key("q").int(), this.key("g").int(), this.key("pub_key").int(), this.key("priv_key").int() ); }); (t.DSAPrivateKey = l), (t.DSAparam = n.define("DSAparam", function () { this.int(); })); var h = n.define("ECPrivateKey", function () { this.seq().obj( this.key("version").int(), this.key("privateKey").octstr(), this.key("parameters").optional().explicit(0).use(f), this.key("publicKey").optional().explicit(1).bitstr() ); }); t.ECPrivateKey = h; var f = n.define("ECParameters", function () { this.choice({ namedCurve: this.objid(), }); }); t.signature = n.define("signature", function () { this.seq().obj(this.key("r").int(), this.key("s").int()); }); }, function (e, t, i) { var n = i(72), r = i(1); function o(e, t) { (this.name = e), (this.body = t), (this.decoders = {}), (this.encoders = {}); } (t.define = function (e, t) { return new o(e, t); }), (o.prototype._createNamed = function (e) { var t; try { t = i(572).runInThisContext( "(function " + this.name + "(entity) {\n this._initNamed(entity);\n})" ); } catch (e) { t = function (e) { this._initNamed(e); }; } return ( r(t, e), (t.prototype._initNamed = function (t) { e.call(this, t); }), new t(this) ); }), (o.prototype._getDecoder = function (e) { return ( (e = e || "der"), this.decoders.hasOwnProperty(e) || (this.decoders[e] = this._createNamed(n.decoders[e])), this.decoders[e] ); }), (o.prototype.decode = function (e, t, i) { return this._getDecoder(t).decode(e, i); }), (o.prototype._getEncoder = function (e) { return ( (e = e || "der"), this.encoders.hasOwnProperty(e) || (this.encoders[e] = this._createNamed(n.encoders[e])), this.encoders[e] ); }), (o.prototype.encode = function (e, t, i) { return this._getEncoder(t).encode(e, i); }); }, function (module, exports, __webpack_require__) { function _typeof(e) { return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var indexOf = __webpack_require__(573), Object_keys = function (e) { if (Object.keys) return Object.keys(e); var t = []; for (var i in e) t.push(i); return t; }, forEach = function (e, t) { if (e.forEach) return e.forEach(t); for (var i = 0; i < e.length; i++) t(e[i], i, e); }, defineProp = (function () { try { return ( Object.defineProperty({}, "_", {}), function (e, t, i) { Object.defineProperty(e, t, { writable: true, enumerable: false, configurable: true, value: i, }); } ); } catch (e) { return function (e, t, i) { e[t] = i; }; } })(), globals = [ "Array", "Boolean", "Date", "Error", "EvalError", "Function", "Infinity", "JSON", "Math", "NaN", "Number", "Object", "RangeError", "ReferenceError", "RegExp", "String", "SyntaxError", "TypeError", "URIError", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", "undefined", "unescape", ]; function Context() {} Context.prototype = {}; var Script = (exports.Script = function (e) { if (!(this instanceof Script)) return new Script(e); this.code = e; }); (Script.prototype.runInContext = function (e) { if (!(e instanceof Context)) throw new TypeError("needs a 'context' argument."); var t = document.createElement("iframe"); t.style || (t.style = {}), (t.style.display = "none"), document.body.appendChild(t); var i = t.contentWindow, n = i.eval, r = i.execScript; !n && r && (r.call(i, "null"), (n = i.eval)), forEach(Object_keys(e), function (t) { i[t] = e[t]; }), forEach(globals, function (t) { e[t] && (i[t] = e[t]); }); var o = Object_keys(i), a = n.call(i, this.code); return ( forEach(Object_keys(i), function (t) { (t in e || -1 === indexOf(o, t)) && (e[t] = i[t]); }), forEach(globals, function (t) { t in e || defineProp(e, t, i[t]); }), document.body.removeChild(t), a ); }), (Script.prototype.runInThisContext = function () { return eval(this.code); }), (Script.prototype.runInNewContext = function (e) { var t = Script.createContext(e), i = this.runInContext(t); return ( forEach(Object_keys(t), function (i) { e[i] = t[i]; }), i ); }), forEach(Object_keys(Script.prototype), function (e) { exports[e] = Script[e] = function (t) { var i = Script(t); return i[e].apply(i, [].slice.call(arguments, 1)); }; }), (exports.createScript = function (e) { return exports.Script(e); }), (exports.createContext = Script.createContext = function (e) { var t = new Context(); return ( "object" === _typeof(e) && forEach(Object_keys(e), function (i) { t[i] = e[i]; }), t ); }); }, function (e, t) { var i = [].indexOf; e.exports = function (e, t) { if (i) return e.indexOf(t); for (var n = 0; n < e.length; ++n) if (e[n] === t) return n; return -1; }; }, function (e, t, i) { var n = i(1); function r(e) { this._reporterState = { obj: null, path: [], options: e || {}, errors: [], }; } function o(e, t) { (this.path = e), this.rethrow(t); } (t.Reporter = r), (r.prototype.isError = function (e) { return e instanceof o; }), (r.prototype.save = function () { var e = this._reporterState; return { obj: e.obj, pathLen: e.path.length, }; }), (r.prototype.restore = function (e) { var t = this._reporterState; (t.obj = e.obj), (t.path = t.path.slice(0, e.pathLen)); }), (r.prototype.enterKey = function (e) { return this._reporterState.path.push(e); }), (r.prototype.exitKey = function (e) { var t = this._reporterState; t.path = t.path.slice(0, e - 1); }), (r.prototype.leaveKey = function (e, t, i) { var n = this._reporterState; this.exitKey(e), null !== n.obj && (n.obj[t] = i); }), (r.prototype.path = function () { return this._reporterState.path.join("/"); }), (r.prototype.enterObject = function () { var e = this._reporterState, t = e.obj; return (e.obj = {}), t; }), (r.prototype.leaveObject = function (e) { var t = this._reporterState, i = t.obj; return (t.obj = e), i; }), (r.prototype.error = function (e) { var t, i = this._reporterState, n = e instanceof o; if ( ((t = n ? e : new o( i.path .map(function (e) { return "[" + JSON.stringify(e) + "]"; }) .join(""), e.message || e, e.stack )), !i.options.partial) ) throw t; return n || i.errors.push(t), t; }), (r.prototype.wrapResult = function (e) { var t = this._reporterState; return t.options.partial ? { result: this.isError(e) ? null : e, errors: t.errors, } : e; }), n(o, Error), (o.prototype.rethrow = function (e) { if ( ((this.message = e + " at: " + (this.path || "(shallow)")), Error.captureStackTrace && Error.captureStackTrace(this, o), !this.stack) ) try { throw new Error(this.message); } catch (e) { this.stack = e.stack; } return this; }); }, function (e, t, i) { function n(e) { return (n = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e; } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; })(e); } var r = i(73).Reporter, o = i(73).EncoderBuffer, a = i(73).DecoderBuffer, s = i(25), c = [ "seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int", "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr", "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr", ], u = [ "key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains", ].concat(c); function l(e, t) { var i = {}; (this._baseState = i), (i.enc = e), (i.parent = t || null), (i.children = null), (i.tag = null), (i.args = null), (i.reverseArgs = null), (i.choice = null), (i.optional = false), (i.any = false), (i.obj = false), (i.use = null), (i.useDecoder = null), (i.key = null), (i.default = null), (i.explicit = null), (i.implicit = null), (i.contains = null), i.parent || ((i.children = []), this._wrap()); } e.exports = l; var h = [ "enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj", "use", "alteredUse", "key", "default", "explicit", "implicit", "contains", ]; (l.prototype.clone = function () { var e = this._baseState, t = {}; h.forEach(function (i) { t[i] = e[i]; }); var i = new this.constructor(t.parent); return (i._baseState = t), i; }), (l.prototype._wrap = function () { var e = this._baseState; u.forEach(function (t) { this[t] = function () { var i = new this.constructor(this); return e.children.push(i), i[t].apply(i, arguments); }; }, this); }), (l.prototype._init = function (e) { var t = this._baseState; s(null === t.parent), e.call(this), (t.children = t.children.filter(function (e) { return e._baseState.parent === this; }, this)), s.equal(t.children.length, 1, "Root node can have only one child"); }), (l.prototype._useArgs = function (e) { var t = this._baseState, i = e.filter(function (e) { return e instanceof this.constructor; }, this); (e = e.filter(function (e) { return !(e instanceof this.constructor); }, this)), 0 !== i.length && (s(null === t.children), (t.children = i), i.forEach(function (e) { e._baseState.parent = this; }, this)), 0 !== e.length && (s(null === t.args), (t.args = e), (t.reverseArgs = e.map(function (e) { if ("object" !== n(e) || e.constructor !== Object) return e; var t = {}; return ( Object.keys(e).forEach(function (i) { i == (0 | i) && (i |= 0); var n = e[i]; t[n] = i; }), t ); }))); }), [ "_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull", "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid", "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool", ].forEach(function (e) { l.prototype[e] = function () { var t = this._baseState; throw new Error(e + " not implemented for encoding: " + t.enc); }; }), c.forEach(function (e) { l.prototype[e] = function () { var t = this._baseState, i = Array.prototype.slice.call(arguments); return s(null === t.tag), (t.tag = e), this._useArgs(i), this; }; }), (l.prototype.use = function (e) { s(e); var t = this._baseState; return s(null === t.use), (t.use = e), this; }), (l.prototype.optional = function () { return (this._baseState.optional = true), this; }), (l.prototype.def = function (e) { var t = this._baseState; return ( s(null === t.default), (t.default = e), (t.optional = true), this ); }), (l.prototype.explicit = function (e) { var t = this._baseState; return ( s(null === t.explicit && null === t.implicit), (t.explicit = e), this ); }), (l.prototype.implicit = function (e) { var t = this._baseState; return ( s(null === t.explicit && null === t.implicit), (t.implicit = e), this ); }), (l.prototype.obj = function () { var e = this._baseState, t = Array.prototype.slice.call(arguments); return (e.obj = true), 0 !== t.length && this._useArgs(t), this; }), (l.prototype.key = function (e) { var t = this._baseState; return s(null === t.key), (t.key = e), this; }), (l.prototype.any = function () { return (this._baseState.any = true), this; }), (l.prototype.choice = function (e) { var t = this._baseState; return ( s(null === t.choice), (t.choice = e), this._useArgs( Object.keys(e).map(function (t) { return e[t]; }) ), this ); }), (l.prototype.contains = function (e) { var t = this._baseState; return s(null === t.use), (t.contains = e), this; }), (l.prototype._decode = function (e, t) { var i = this._baseState; if (null === i.parent) return e.wrapResult(i.children[0]._decode(e, t)); var n, r = i.default, o = true, s = null; if ((null !== i.key && (s = e.enterKey(i.key)), i.optional)) { var c = null; if ( (null !== i.explicit ? (c = i.explicit) : null !== i.implicit ? (c = i.implicit) : null !== i.tag && (c = i.tag), null !== c || i.any) ) { if (((o = this._peekTag(e, c, i.any)), e.isError(o))) return o; } else { var u = e.save(); try { null === i.choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t), (o = true); } catch (e) { o = false; } e.restore(u); } } if ((i.obj && o && (n = e.enterObject()), o)) { if (null !== i.explicit) { var l = this._decodeTag(e, i.explicit); if (e.isError(l)) return l; e = l; } var h = e.offset; if (null === i.use && null === i.choice) { if (i.any) u = e.save(); var f = this._decodeTag( e, null !== i.implicit ? i.implicit : i.tag, i.any ); if (e.isError(f)) return f; i.any ? (r = e.raw(u)) : (e = f); } if ( (t && t.track && null !== i.tag && t.track(e.path(), h, e.length, "tagged"), t && t.track && null !== i.tag && t.track(e.path(), e.offset, e.length, "content"), (r = i.any ? r : null === i.choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t)), e.isError(r)) ) return r; if ( (i.any || null !== i.choice || null === i.children || i.children.forEach(function (i) { i._decode(e, t); }), i.contains && ("octstr" === i.tag || "bitstr" === i.tag)) ) { var d = new a(r); r = this._getUse(i.contains, e._reporterState.obj)._decode(d, t); } } return ( i.obj && o && (r = e.leaveObject(n)), null === i.key || (null === r && true !== o) ? null !== s && e.exitKey(s) : e.leaveKey(s, i.key, r), r ); }), (l.prototype._decodeGeneric = function (e, t, i) { var n = this._baseState; return "seq" === e || "set" === e ? null : "seqof" === e || "setof" === e ? this._decodeList(t, e, n.args[0], i) : /str$/.test(e) ? this._decodeStr(t, e, i) : "objid" === e && n.args ? this._decodeObjid(t, n.args[0], n.args[1], i) : "objid" === e ? this._decodeObjid(t, null, null, i) : "gentime" === e || "utctime" === e ? this._decodeTime(t, e, i) : "null_" === e ? this._decodeNull(t, i) : "bool" === e ? this._decodeBool(t, i) : "objDesc" === e ? this._decodeStr(t, e, i) : "int" === e || "enum" === e ? this._decodeInt(t, n.args && n.args[0], i) : null !== n.use ? this._getUse(n.use, t._reporterState.obj)._decode(t, i) : t.error("unknown tag: " + e); }), (l.prototype._getUse = function (e, t) { var i = this._baseState; return ( (i.useDecoder = this._use(e, t)), s(null === i.useDecoder._baseState.parent), (i.useDecoder = i.useDecoder._baseState.children[0]), i.implicit !== i.useDecoder._baseState.implicit && ((i.useDecoder = i.useDecoder.clone()), (i.useDecoder._baseState.implicit = i.implicit)), i.useDecoder ); }), (l.prototype._decodeChoice = function (e, t) { var i = this._baseState, n = null, r = false; return ( Object.keys(i.choice).some(function (o) { var a = e.save(), s = i.choice[o]; try { var c = s._decode(e, t); if (e.isError(c)) return false; (n = { type: o, value: c, }), (r = true); } catch (t) { return e.restore(a), false; } return true; }, this), r ? n : e.error("Choice not matched") ); }), (l.prototype._createEncoderBuffer = function (e) { return new o(e, this.reporter); }), (l.prototype._encode = function (e, t, i) { var n = this._baseState; if (null === n.default || n.default !== e) { var r = this._encodeValue(e, t, i); if (void 0 !== r && !this._skipDefault(r, t, i)) return r; } }), (l.prototype._encodeValue = function (e, t, i) { var o = this._baseState; if (null === o.parent) return o.children[0]._encode(e, t || new r()); var a = null; if (((this.reporter = t), o.optional && void 0 === e)) { if (null === o.default) return; e = o.default; } var s = null, c = false; if (o.any) a = this._createEncoderBuffer(e); else if (o.choice) a = this._encodeChoice(e, t); else if (o.contains) (s = this._getUse(o.contains, i)._encode(e, t)), (c = true); else if (o.children) (s = o.children .map(function (i) { if ("null_" === i._baseState.tag) return i._encode(null, t, e); if (null === i._baseState.key) return t.error("Child should have a key"); var r = t.enterKey(i._baseState.key); if ("object" !== n(e)) return t.error("Child expected, but input is not object"); var o = i._encode(e[i._baseState.key], t, e); return t.leaveKey(r), o; }, this) .filter(function (e) { return e; })), (s = this._createEncoderBuffer(s)); else if ("seqof" === o.tag || "setof" === o.tag) { if (!o.args || 1 !== o.args.length) return t.error("Too many args for : " + o.tag); if (!Array.isArray(e)) return t.error("seqof/setof, but data is not Array"); var u = this.clone(); (u._baseState.implicit = null), (s = this._createEncoderBuffer( e.map(function (i) { var n = this._baseState; return this._getUse(n.args[0], e)._encode(i, t); }, u) )); } else null !== o.use ? (a = this._getUse(o.use, i)._encode(e, t)) : ((s = this._encodePrimitive(o.tag, e)), (c = true)); if (!o.any && null === o.choice) { var l = null !== o.implicit ? o.implicit : o.tag, h = null === o.implicit ? "universal" : "context"; null === l ? null === o.use && t.error("Tag could be omitted only for .use()") : null === o.use && (a = this._encodeComposite(l, c, h, s)); } return ( null !== o.explicit && (a = this._encodeComposite(o.explicit, false, "context", a)), a ); }), (l.prototype._encodeChoice = function (e, t) { var i = this._baseState, n = i.choice[e.type]; return ( n || s( false, e.type + " not found in " + JSON.stringify(Object.keys(i.choice)) ), n._encode(e.value, t) ); }), (l.prototype._encodePrimitive = function (e, t) { var i = this._baseState; if (/str$/.test(e)) return this._encodeStr(t, e); if ("objid" === e && i.args) return this._encodeObjid(t, i.reverseArgs[0], i.args[1]); if ("objid" === e) return this._encodeObjid(t, null, null); if ("gentime" === e || "utctime" === e) return this._encodeTime(t, e); if ("null_" === e) return this._encodeNull(); if ("int" === e || "enum" === e) return this._encodeInt(t, i.args && i.reverseArgs[0]); if ("bool" === e) return this._encodeBool(t); if ("objDesc" === e) return this._encodeStr(t, e); throw new Error("Unsupported tag: " + e); }), (l.prototype._isNumstr = function (e) { return /^[0-9 ]*$/.test(e); }), (l.prototype._isPrintstr = function (e) { return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e); }); }, function (e, t, i) { var n = i(219); (t.tagClass = { 0: "universal", 1: "application", 2: "context", 3: "private", }), (t.tagClassByName = n._reverse(t.tagClass)), (t.tag = { 0: "end", 1: "bool", 2: "int", 3: "bitstr", 4: "octstr", 5: "null_", 6: "objid", 7: "objDesc", 8: "external", 9: "real", 10: "enum", 11: "embed", 12: "utf8str", 13: "relativeOid", 16: "seq", 17: "set", 18: "numstr", 19: "printstr", 20: "t61str", 21: "videostr", 22: "ia5str", 23: "utctime", 24: "gentime", 25: "graphstr", 26: "iso646str", 27: "genstr", 28: "unistr", 29: "charstr", 30: "bmpstr", }), (t.tagByName = n._reverse(t.tag)); }, function (e, t, i) { var n = t; (n.der = i(220)), (n.pem = i(578)); }, function (e, t, i) { var n = i(1), r = i(9).Buffer, o = i(220); function a(e) { o.call(this, e), (this.enc = "pem"); } n(a, o), (e.exports = a), (a.prototype.decode = function (e, t) { for ( var i = e.toString().split(/[\r\n]+/g), n = t.label.toUpperCase(), a = /^-----(BEGIN|END) ([^-]+)-----$/, s = -1, c = -1, u = 0; u < i.length; u++ ) { var l = i[u].match(a); if (null !== l && l[2] === n) { if (-1 !== s) { if ("END" !== l[1]) break; c = u; break; } if ("BEGIN" !== l[1]) break; s = u; } } if (-1 === s || -1 === c) throw new Error("PEM section not found for: " + n); var h = i.slice(s + 1, c).join(""); h.replace(/[^a-z0-9\+\/=]+/gi, ""); var f = new r(h, "base64"); return o.prototype.decode.call(this, f, t); }); }, function (e, t, i) { var n = t; (n.der = i(221)), (n.pem = i(580)); }, function (e, t, i) { var n = i(1), r = i(221); function o(e) { r.call(this, e), (this.enc = "pem"); } n(o, r), (e.exports = o), (o.prototype.encode = function (e, t) { for ( var i = r.prototype.encode.call(this, e).toString("base64"), n = ["-----BEGIN " + t.label + "-----"], o = 0; o < i.length; o += 64 ) n.push(i.slice(o, o + 64)); return n.push("-----END " + t.label + "-----"), n.join("\n"); }); }, function (e, t, i) { "use strict"; var n = i(72), r = n.define("Time", function () { this.choice({ utcTime: this.utctime(), generalTime: this.gentime(), }); }), o = n.define("AttributeTypeValue", function () { this.seq().obj(this.key("type").objid(), this.key("value").any()); }), a = n.define("AlgorithmIdentifier", function () { this.seq().obj( this.key("algorithm").objid(), this.key("parameters").optional() ); }), s = n.define("SubjectPublicKeyInfo", function () { this.seq().obj( this.key("algorithm").use(a), this.key("subjectPublicKey").bitstr() ); }), c = n.define("RelativeDistinguishedName", function () { this.setof(o); }), u = n.define("RDNSequence", function () { this.seqof(c); }), l = n.define("Name", function () { this.choice({ rdnSequence: this.use(u), }); }), h = n.define("Validity", function () { this.seq().obj( this.key("notBefore").use(r), this.key("notAfter").use(r) ); }), f = n.define("Extension", function () { this.seq().obj( this.key("extnID").objid(), this.key("critical").bool().def(false), this.key("extnValue").octstr() ); }), d = n.define("TBSCertificate", function () { this.seq().obj( this.key("version").explicit(0).int(), this.key("serialNumber").int(), this.key("signature").use(a), this.key("issuer").use(l), this.key("validity").use(h), this.key("subject").use(l), this.key("subjectPublicKeyInfo").use(s), this.key("issuerUniqueID").implicit(1).bitstr().optional(), this.key("subjectUniqueID").implicit(2).bitstr().optional(), this.key("extensions").explicit(3).seqof(f).optional() ); }), p = n.define("X509Certificate", function () { this.seq().obj( this.key("tbsCertificate").use(d), this.key("signatureAlgorithm").use(a), this.key("signatureValue").bitstr() ); }); e.exports = p; }, function (e) { e.exports = { "2.16.840.1.101.3.4.1.1": "aes-128-ecb", "2.16.840.1.101.3.4.1.2": "aes-128-cbc", "2.16.840.1.101.3.4.1.3": "aes-128-ofb", "2.16.840.1.101.3.4.1.4": "aes-128-cfb", "2.16.840.1.101.3.4.1.21": "aes-192-ecb", "2.16.840.1.101.3.4.1.22": "aes-192-cbc", "2.16.840.1.101.3.4.1.23": "aes-192-ofb", "2.16.840.1.101.3.4.1.24": "aes-192-cfb", "2.16.840.1.101.3.4.1.41": "aes-256-ecb", "2.16.840.1.101.3.4.1.42": "aes-256-cbc", "2.16.840.1.101.3.4.1.43": "aes-256-ofb", "2.16.840.1.101.3.4.1.44": "aes-256-cfb", }; }, function (e, t, i) { (function (t) { var n = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m, r = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m, o = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m, a = i(90), s = i(132); e.exports = function (e, i) { var c, u = e.toString(), l = u.match(n); if (l) { var h = "aes" + l[1], f = new t(l[2], "hex"), d = new t(l[3].replace(/[\r\n]/g, ""), "base64"), p = a(i, f.slice(0, 8), parseInt(l[1], 10)).key, m = [], g = s.createDecipheriv(h, p, f); m.push(g.update(d)), m.push(g.final()), (c = t.concat(m)); } else { var _ = u.match(o); c = new t(_[2].replace(/[\r\n]/g, ""), "base64"); } return { tag: u.match(r)[1], data: c, }; }; }.call(this, i(9).Buffer)); }, function (e, t, i) { (function (t) { var n = i(11), r = i(17).ec, o = i(92), a = i(222); function s(e, t) { if (e.cmpn(0) <= 0) throw new Error("invalid sig"); if (e.cmp(t) >= t) throw new Error("invalid sig"); } e.exports = function (e, i, c, u, l) { var h = o(c); if ("ec" === h.type) { if ("ecdsa" !== u && "ecdsa/rsa" !== u) throw new Error("wrong public key type"); return (function (e, t, i) { var n = a[i.data.algorithm.curve.join(".")]; if (!n) throw new Error( "unknown curve " + i.data.algorithm.curve.join(".") ); var o = new r(n), s = i.data.subjectPrivateKey.data; return o.verify(t, e, s); })(e, i, h); } if ("dsa" === h.type) { if ("dsa" !== u) throw new Error("wrong public key type"); return (function (e, t, i) { var r = i.data.p, a = i.data.q, c = i.data.g, u = i.data.pub_key, l = o.signature.decode(e, "der"), h = l.s, f = l.r; s(h, a), s(f, a); var d = n.mont(r), p = h.invm(a); return ( 0 === c .toRed(d) .redPow(new n(t).mul(p).mod(a)) .fromRed() .mul(u.toRed(d).redPow(f.mul(p).mod(a)).fromRed()) .mod(r) .mod(a) .cmp(f) ); })(e, i, h); } if ("rsa" !== u && "ecdsa/rsa" !== u) throw new Error("wrong public key type"); i = t.concat([l, i]); for ( var f = h.modulus.byteLength(), d = [1], p = 0; i.length + d.length + 2 < f; ) d.push(255), p++; d.push(0); for (var m = -1; ++m < i.length; ) d.push(i[m]); d = new t(d); var g = n.mont(h.modulus); (e = (e = new n(e).toRed(g)).redPow(new n(h.publicExponent))), (e = new t(e.fromRed().toArray())); var _ = p < 8 ? 1 : 0; for ( f = Math.min(e.length, d.length), e.length !== d.length && (_ = 1), m = -1; ++m < f; ) _ |= e[m] ^ d[m]; return 0 === _; }; }.call(this, i(9).Buffer)); }, function (e, t, i) { (function (t) { var n = i(17), r = i(11); e.exports = function (e) { return new a(e); }; var o = { secp256k1: { name: "secp256k1", byteLength: 32, }, secp224r1: { name: "p224", byteLength: 28, }, prime256v1: { name: "p256", byteLength: 32, }, prime192v1: { name: "p192", byteLength: 24, }, ed25519: { name: "ed25519", byteLength: 32, }, secp384r1: { name: "p384", byteLength: 48, }, secp521r1: { name: "p521", byteLength: 66, }, }; function a(e) { (this.curveType = o[e]), this.curveType || (this.curveType = { name: e, }), (this.curve = new n.ec(this.curveType.name)), (this.keys = void 0); } function s(e, i, n) { Array.isArray(e) || (e = e.toArray()); var r = new t(e); if (n && r.length < n) { var o = new t(n - r.length); o.fill(0), (r = t.concat([o, r])); } return i ? r.toString(i) : r; } (o.p224 = o.secp224r1), (o.p256 = o.secp256r1 = o.prime256v1), (o.p192 = o.secp192r1 = o.prime192v1), (o.p384 = o.secp384r1), (o.p521 = o.secp521r1), (a.prototype.generateKeys = function (e, t) { return (this.keys = this.curve.genKeyPair()), this.getPublicKey(e, t); }), (a.prototype.computeSecret = function (e, i, n) { return ( (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)), s( this.curve .keyFromPublic(e) .getPublic() .mul(this.keys.getPrivate()) .getX(), n, this.curveType.byteLength ) ); }), (a.prototype.getPublicKey = function (e, t) { var i = this.keys.getPublic("compressed" === t, true); return ( "hybrid" === t && (i[i.length - 1] % 2 ? (i[0] = 7) : (i[0] = 6)), s(i, e) ); }), (a.prototype.getPrivateKey = function (e) { return s(this.keys.getPrivate(), e); }), (a.prototype.setPublicKey = function (e, i) { return ( (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)), this.keys._importPublic(e), this ); }), (a.prototype.setPrivateKey = function (e, i) { (i = i || "utf8"), t.isBuffer(e) || (e = new t(e, i)); var n = new r(e); return ( (n = n.toString(16)), (this.keys = this.curve.genKeyPair()), this.keys._importPrivate(n), this ); }); }.call(this, i(9).Buffer)); }, function (e, t, i) { (t.publicEncrypt = i(587)), (t.privateDecrypt = i(588)), (t.privateEncrypt = function (e, i) { return t.publicEncrypt(e, i, true); }), (t.publicDecrypt = function (e, i) { return t.privateDecrypt(e, i, true); }); }, function (e, t, i) { var n = i(92), r = i(53), o = i(69), a = i(223), s = i(224), c = i(11), u = i(225), l = i(134), h = i(2).Buffer; e.exports = function (e, t, i) { var f; f = e.padding ? e.padding : i ? 1 : 4; var d, p = n(e); if (4 === f) d = (function (e, t) { var i = e.modulus.byteLength(), n = t.length, u = o("sha1").update(h.alloc(0)).digest(), l = u.length, f = 2 * l; if (n > i - f - 2) throw new Error("message too long"); var d = h.alloc(i - n - f - 2), p = i - l - 1, m = r(l), g = s(h.concat([u, d, h.alloc(1, 1), t], p), a(m, p)), _ = s(m, a(g, l)); return new c(h.concat([h.alloc(1), _, g], i)); })(p, t); else if (1 === f) d = (function (e, t, i) { var n, o = t.length, a = e.modulus.byteLength(); if (o > a - 11) throw new Error("message too long"); n = i ? h.alloc(a - o - 3, 255) : (function (e) { var t, i = h.allocUnsafe(e), n = 0, o = r(2 * e), a = 0; for (; n < e; ) a === o.length && ((o = r(2 * e)), (a = 0)), (t = o[a++]) && (i[n++] = t); return i; })(a - o - 3); return new c(h.concat([h.from([0, i ? 1 : 2]), n, h.alloc(1), t], a)); })(p, t, i); else { if (3 !== f) throw new Error("unknown padding"); if ((d = new c(t)).cmp(p.modulus) >= 0) throw new Error("data too long for modulus"); } return i ? l(d, p) : u(d, p); }; }, function (e, t, i) { var n = i(92), r = i(223), o = i(224), a = i(11), s = i(134), c = i(69), u = i(225), l = i(2).Buffer; e.exports = function (e, t, i) { var h; h = e.padding ? e.padding : i ? 1 : 4; var f, d = n(e), p = d.modulus.byteLength(); if (t.length > p || new a(t).cmp(d.modulus) >= 0) throw new Error("decryption error"); f = i ? u(new a(t), d) : s(t, d); var m = l.alloc(p - f.length); if (((f = l.concat([m, f], p)), 4 === h)) return (function (e, t) { var i = e.modulus.byteLength(), n = c("sha1").update(l.alloc(0)).digest(), a = n.length; if (0 !== t[0]) throw new Error("decryption error"); var s = t.slice(1, a + 1), u = t.slice(a + 1), h = o(s, r(u, a)), f = o(u, r(h, i - a - 1)); if ( (function (e, t) { (e = l.from(e)), (t = l.from(t)); var i = 0, n = e.length; e.length !== t.length && (i++, (n = Math.min(e.length, t.length))); var r = -1; for (; ++r < n; ) i += e[r] ^ t[r]; return i; })(n, f.slice(0, a)) ) throw new Error("decryption error"); var d = a; for (; 0 === f[d]; ) d++; if (1 !== f[d++]) throw new Error("decryption error"); return f.slice(d); })(d, f); if (1 === h) return (function (e, t, i) { var n = t.slice(0, 2), r = 2, o = 0; for (; 0 !== t[r++]; ) if (r >= t.length) { o++; break; } var a = t.slice(2, r - 1); (("0002" !== n.toString("hex") && !i) || ("0001" !== n.toString("hex") && i)) && o++; a.length < 8 && o++; if (o) throw new Error("decryption error"); return t.slice(r); })(0, f, i); if (3 === h) return f; throw new Error("unknown padding"); }; }, function (e, t, i) { "use strict"; (function (e, n) { function r() { throw new Error( "secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11" ); } var o = i(2), a = i(53), s = o.Buffer, c = o.kMaxLength, u = e.crypto || e.msCrypto, l = Math.pow(2, 32) - 1; function h(e, t) { if ("number" != typeof e || e != e) throw new TypeError("offset must be a number"); if (e > l || e < 0) throw new TypeError("offset must be a uint32"); if (e > c || e > t) throw new RangeError("offset out of range"); } function f(e, t, i) { if ("number" != typeof e || e != e) throw new TypeError("size must be a number"); if (e > l || e < 0) throw new TypeError("size must be a uint32"); if (e + t > i || e > c) throw new RangeError("buffer too small"); } function d(e, t, i, r) { if (n.browser) { var o = e.buffer, s = new Uint8Array(o, t, i); return ( u.getRandomValues(s), r ? void n.nextTick(function () { r(null, e); }) : e ); } if (!r) return a(i).copy(e, t), e; a(i, function (i, n) { if (i) return r(i); n.copy(e, t), r(null, e); }); } (u && u.getRandomValues) || !n.browser ? ((t.randomFill = function (t, i, n, r) { if (!(s.isBuffer(t) || t instanceof e.Uint8Array)) throw new TypeError( '"buf" argument must be a Buffer or Uint8Array' ); if ("function" == typeof i) (r = i), (i = 0), (n = t.length); else if ("function" == typeof n) (r = n), (n = t.length - i); else if ("function" != typeof r) throw new TypeError('"cb" argument must be a function'); return h(i, t.length), f(n, i, t.length), d(t, i, n, r); }), (t.randomFillSync = function (t, i, n) { void 0 === i && (i = 0); if (!(s.isBuffer(t) || t instanceof e.Uint8Array)) throw new TypeError( '"buf" argument must be a Buffer or Uint8Array' ); h(i, t.length), void 0 === n && (n = t.length - i); return f(n, i, t.length), d(t, i, n); })) : ((t.randomFill = r), (t.randomFillSync = r)); }.call(this, i(15), i(27))); }, ]);