Skip to content

Instantly share code, notes, and snippets.

@FinnT730
Created May 7, 2019 18:21
Show Gist options
  • Save FinnT730/80f7ef31371ad4c2a7dcde4ecfa2abb6 to your computer and use it in GitHub Desktop.
Save FinnT730/80f7ef31371ad4c2a7dcde4ecfa2abb6 to your computer and use it in GitHub Desktop.
..
This file has been truncated, but you can view the full file.
! function (e) {
var t = {};
function i(r) {
if (t[r]) return t[r].exports;
var n = t[r] = {
i: r,
l: !1,
exports: {}
};
return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports
}
i.m = e, i.c = t, i.d = function (e, t, r) {
i.o(e, t) || Object.defineProperty(e, t, {
enumerable: !0,
get: r
})
}, i.r = function (e) {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
value: "Module"
}), Object.defineProperty(e, "__esModule", {
value: !0
})
}, i.t = function (e, t) {
if (1 & t && (e = i(e)), 8 & t) return e;
if (4 & t && "object" == typeof e && e && e.__esModule) return e;
var r = Object.create(null);
if (i.r(r), Object.defineProperty(r, "default", {
enumerable: !0,
value: e
}), 2 & t && "string" != typeof e)
for (var n in e) i.d(r, n, function (t) {
return e[t]
}.bind(null, n));
return r
}, i.n = function (e) {
var t = e && e.__esModule ? function () {
return e.default
} : function () {
return e
};
return i.d(t, "a", t), t
}, i.o = function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}, i.p = "/", i(i.s = 228)
}([function (e, t, i) {
var r = i(5),
n = i(14),
o = i(23),
s = i(19),
a = i(34),
c = function e(t, i, c) {
var h, u, l, f, d = t & e.F,
p = t & e.G,
m = t & e.P,
g = t & e.B,
_ = p ? r : t & e.S ? r[i] || (r[i] = {}) : (r[i] || {}).prototype,
v = p ? n : n[i] || (n[i] = {}),
y = v.prototype || (v.prototype = {});
for (h in p && (c = i), c) l = ((u = !d && _ && void 0 !== _[h]) ? _ : c)[h], f = g && u ? a(l, r) : m && "function" == typeof l ? a(Function.call, l) : l, _ && s(_, h, l, t & e.U), v[h] != l && o(v, h, f), m && y[h] != l && (y[h] = l)
};
r.core = n, c.F = 1, c.G = 2, c.S = 4, c.P = 8, c.B = 16, c.W = 32, c.U = 64, c.R = 128, e.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: !1,
writable: !0,
configurable: !0
}
})
} : 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 r = i(9),
n = r.Buffer;
function o(e, t) {
for (var i in e) t[i] = e[i]
}
function s(e, t, i) {
return n(e, t, i)
}
n.from && n.alloc && n.allocUnsafe && n.allocUnsafeSlow ? e.exports = r : (o(r, t), t.Buffer = s), o(n, s), s.from = function (e, t, i) {
if ("number" == typeof e) throw new TypeError("Argument must not be a number");
return n(e, t, i)
}, s.alloc = function (e, t, i) {
if ("number" != typeof e) throw new TypeError("Argument must be a number");
var r = n(e);
return void 0 !== t ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r
}, s.allocUnsafe = function (e) {
if ("number" != typeof e) throw new TypeError("Argument must be a number");
return n(e)
}, s.allocUnsafeSlow = function (e) {
if ("number" != typeof e) throw new TypeError("Argument must be a number");
return r.SlowBuffer(e)
}
}, function (e, t) {
e.exports = function (e) {
try {
return !!e()
} catch (e) {
return !0
}
}
}, function (e, t, i) {
var r = i(6);
e.exports = function (e) {
if (!r(e)) throw TypeError(e + " is not an object!");
return e
}
}, function (e, t) {
var i = e.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
"number" == typeof __g && (__g = 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)
}
e.exports = function (e) {
return "object" === i(e) ? null !== e : "function" == typeof e
}
}, function (e, t, i) {
"use strict";
function r(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
i.r(t);
var n = 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, n;
return t = e, n = [{
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
}
}]) && r(t.prototype, i), n && r(t, n), e
}();
t.default = n
}, function (e, t, i) {
var r = i(96)("wks"),
n = i(45),
o = i(5).Symbol,
s = "function" == typeof o;
(e.exports = function (e) {
return r[e] || (r[e] = s && o[e] || (s ? o : n)("Symbol." + e))
}).store = r
}, function (e, t, i) {
"use strict";
(function (e) {
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
* @license MIT
*/
var r = i(397),
n = i(398),
o = i(168);
function s() {
return c.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823
}
function a(e, t) {
if (s() < 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 l(this, e)
}
return h(this, e, t, i)
}
function h(e, t, i, r) {
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, r) {
if (t.byteLength, i < 0 || t.byteLength < i) throw new RangeError("'offset' is out of bounds");
if (t.byteLength < i + (r || 0)) throw new RangeError("'length' is out of bounds");
t = void 0 === i && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t, i) : new Uint8Array(t, i, r);
c.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = c.prototype : e = f(e, t);
return e
}(e, t, i, r) : "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 r = 0 | p(t, i),
n = (e = a(e, r)).write(t, i);
n !== r && (e = e.slice(0, n));
return e
}(e, t, i) : function (e, t) {
if (c.isBuffer(t)) {
var i = 0 | d(t.length);
return 0 === (e = a(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 || (r = t.length) != r ? a(e, 0) : f(e, t);
if ("Buffer" === t.type && o(t.data)) return f(e, t.data)
}
var r;
throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")
}(e, t)
}
function u(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 l(e, t) {
if (u(t), e = a(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 = a(e, i);
for (var r = 0; r < i; r += 1) e[r] = 255 & t[r];
return e
}
function d(e) {
if (e >= s()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + s().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 r = !1;;) switch (t) {
case "ascii":
case "latin1":
case "binary":
return i;
case "utf8":
case "utf-8":
case void 0:
return z(e).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return 2 * i;
case "hex":
return i >>> 1;
case "base64":
return U(e).length;
default:
if (r) return z(e).length;
t = ("" + t).toLowerCase(), r = !0
}
}
function m(e, t, i) {
var r = e[t];
e[t] = e[i], e[i] = r
}
function g(e, t, i, r, n) {
if (0 === e.length) return -1;
if ("string" == typeof i ? (r = i, i = 0) : i > 2147483647 ? i = 2147483647 : i < -2147483648 && (i = -2147483648), i = +i, isNaN(i) && (i = n ? 0 : e.length - 1), i < 0 && (i = e.length + i), i >= e.length) {
if (n) return -1;
i = e.length - 1
} else if (i < 0) {
if (!n) return -1;
i = 0
}
if ("string" == typeof t && (t = c.from(t, r)), c.isBuffer(t)) return 0 === t.length ? -1 : _(e, t, i, r, n);
if ("number" == typeof t) return t &= 255, c.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? n ? Uint8Array.prototype.indexOf.call(e, t, i) : Uint8Array.prototype.lastIndexOf.call(e, t, i) : _(e, [t], i, r, n);
throw new TypeError("val must be string, number or Buffer")
}
function _(e, t, i, r, n) {
var o, s = 1,
a = e.length,
c = t.length;
if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r || "utf-16le" === r)) {
if (e.length < 2 || t.length < 2) return -1;
s = 2, a /= 2, c /= 2, i /= 2
}
function h(e, t) {
return 1 === s ? e[t] : e.readUInt16BE(t * s)
}
if (n) {
var u = -1;
for (o = i; o < a; o++)
if (h(e, o) === h(t, -1 === u ? 0 : o - u)) {
if (-1 === u && (u = o), o - u + 1 === c) return u * s
} else -1 !== u && (o -= o - u), u = -1
} else
for (i + c > a && (i = a - c), o = i; o >= 0; o--) {
for (var l = !0, f = 0; f < c; f++)
if (h(e, o + f) !== h(t, f)) {
l = !1;
break
} if (l) return o
}
return -1
}
function v(e, t, i, r) {
i = Number(i) || 0;
var n = e.length - i;
r ? (r = Number(r)) > n && (r = n) : r = n;
var o = t.length;
if (o % 2 != 0) throw new TypeError("Invalid hex string");
r > o / 2 && (r = o / 2);
for (var s = 0; s < r; ++s) {
var a = parseInt(t.substr(2 * s, 2), 16);
if (isNaN(a)) return s;
e[i + s] = a
}
return s
}
function y(e, t, i, r) {
return G(z(t, e.length - i), e, i, r)
}
function b(e, t, i, r) {
return G(function (e) {
for (var t = [], i = 0; i < e.length; ++i) t.push(255 & e.charCodeAt(i));
return t
}(t), e, i, r)
}
function x(e, t, i, r) {
return b(e, t, i, r)
}
function w(e, t, i, r) {
return G(U(t), e, i, r)
}
function S(e, t, i, r) {
return G(function (e, t) {
for (var i, r, n, o = [], s = 0; s < e.length && !((t -= 2) < 0); ++s) i = e.charCodeAt(s), r = i >> 8, n = i % 256, o.push(n), o.push(r);
return o
}(t, e.length - i), e, i, r)
}
function T(e, t, i) {
return 0 === t && i === e.length ? r.fromByteArray(e) : r.fromByteArray(e.slice(t, i))
}
function A(e, t, i) {
i = Math.min(e.length, i);
for (var r = [], n = t; n < i;) {
var o, s, a, c, h = e[n],
u = null,
l = h > 239 ? 4 : h > 223 ? 3 : h > 191 ? 2 : 1;
if (n + l <= i) switch (l) {
case 1:
h < 128 && (u = h);
break;
case 2:
128 == (192 & (o = e[n + 1])) && (c = (31 & h) << 6 | 63 & o) > 127 && (u = c);
break;
case 3:
o = e[n + 1], s = e[n + 2], 128 == (192 & o) && 128 == (192 & s) && (c = (15 & h) << 12 | (63 & o) << 6 | 63 & s) > 2047 && (c < 55296 || c > 57343) && (u = c);
break;
case 4:
o = e[n + 1], s = e[n + 2], a = e[n + 3], 128 == (192 & o) && 128 == (192 & s) && 128 == (192 & a) && (c = (15 & h) << 18 | (63 & o) << 12 | (63 & s) << 6 | 63 & a) > 65535 && c < 1114112 && (u = c)
}
null === u ? (u = 65533, l = 1) : u > 65535 && (u -= 65536, r.push(u >>> 10 & 1023 | 55296), u = 56320 | 1023 & u), r.push(u), n += l
}
return function (e) {
var t = e.length;
if (t <= M) return String.fromCharCode.apply(String, e);
var i = "",
r = 0;
for (; r < t;) i += String.fromCharCode.apply(String, e.slice(r, r += M));
return i
}(r)
}
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 !1
}
}(), t.kMaxLength = s(), c.poolSize = 8192, c._augment = function (e) {
return e.__proto__ = c.prototype, e
}, c.from = function (e, t, i) {
return h(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: !0
})), c.alloc = function (e, t, i) {
return function (e, t, i, r) {
return u(t), t <= 0 ? a(e, t) : void 0 !== i ? "string" == typeof r ? a(e, t).fill(i, r) : a(e, t).fill(i) : a(e, t)
}(null, e, t, i)
}, c.allocUnsafe = function (e) {
return l(null, e)
}, c.allocUnsafeSlow = function (e) {
return l(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, r = t.length, n = 0, o = Math.min(i, r); n < o; ++n)
if (e[n] !== t[n]) {
i = e[n], r = t[n];
break
} return i < r ? -1 : r < 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 !0;
default:
return !1
}
}, 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 r = c.allocUnsafe(t),
n = 0;
for (i = 0; i < e.length; ++i) {
var s = e[i];
if (!c.isBuffer(s)) throw new TypeError('"list" argument must be an Array of Buffers');
s.copy(r, n), n += s.length
}
return r
}, c.byteLength = p, c.prototype._isBuffer = !0, 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 ? A(this, 0, e) : function (e, t, i) {
var r = !1;
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 C(this, t, i);
case "utf8":
case "utf-8":
return A(this, t, i);
case "ascii":
return E(this, t, i);
case "latin1":
case "binary":
return P(this, t, i);
case "base64":
return T(this, t, i);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return R(this, t, i);
default:
if (r) throw new TypeError("Unknown encoding: " + e);
e = (e + "").toLowerCase(), r = !0
}
}.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 += " ... ")), "<Buffer " + e + ">"
}, c.prototype.compare = function (e, t, i, r, n) {
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 === r && (r = 0), void 0 === n && (n = this.length), t < 0 || i > e.length || r < 0 || n > this.length) throw new RangeError("out of range index");
if (r >= n && t >= i) return 0;
if (r >= n) return -1;
if (t >= i) return 1;
if (this === e) return 0;
for (var o = (n >>>= 0) - (r >>>= 0), s = (i >>>= 0) - (t >>>= 0), a = Math.min(o, s), h = this.slice(r, n), u = e.slice(t, i), l = 0; l < a; ++l)
if (h[l] !== u[l]) {
o = h[l], s = u[l];
break
} return o < s ? -1 : s < 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, !0)
}, c.prototype.lastIndexOf = function (e, t, i) {
return g(this, e, t, i, !1)
}, c.prototype.write = function (e, t, i, r) {
if (void 0 === t) r = "utf8", i = this.length, t = 0;
else if (void 0 === i && "string" == typeof t) r = 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 === r && (r = "utf8")) : (r = i, i = void 0)
}
var n = this.length - t;
if ((void 0 === i || i > n) && (i = n), e.length > 0 && (i < 0 || t < 0) || t > this.length) throw new RangeError("Attempt to write outside buffer bounds");
r || (r = "utf8");
for (var o = !1;;) switch (r) {
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 x(this, e, t, i);
case "base64":
return w(this, e, t, i);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return S(this, e, t, i);
default:
if (o) throw new TypeError("Unknown encoding: " + r);
r = ("" + r).toLowerCase(), o = !0
}
}, c.prototype.toJSON = function () {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
}
};
var M = 4096;
function E(e, t, i) {
var r = "";
i = Math.min(e.length, i);
for (var n = t; n < i; ++n) r += String.fromCharCode(127 & e[n]);
return r
}
function P(e, t, i) {
var r = "";
i = Math.min(e.length, i);
for (var n = t; n < i; ++n) r += String.fromCharCode(e[n]);
return r
}
function C(e, t, i) {
var r = e.length;
(!t || t < 0) && (t = 0), (!i || i < 0 || i > r) && (i = r);
for (var n = "", o = t; o < i; ++o) n += N(e[o]);
return n
}
function R(e, t, i) {
for (var r = e.slice(t, i), n = "", o = 0; o < r.length; o += 2) n += String.fromCharCode(r[o] + 256 * r[o + 1]);
return n
}
function I(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 D(e, t, i, r, n, o) {
if (!c.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (t > n || t < o) throw new RangeError('"value" argument is out of bounds');
if (i + r > e.length) throw new RangeError("Index out of range")
}
function O(e, t, i, r) {
t < 0 && (t = 65535 + t + 1);
for (var n = 0, o = Math.min(e.length - i, 2); n < o; ++n) e[i + n] = (t & 255 << 8 * (r ? n : 1 - n)) >>> 8 * (r ? n : 1 - n)
}
function L(e, t, i, r) {
t < 0 && (t = 4294967295 + t + 1);
for (var n = 0, o = Math.min(e.length - i, 4); n < o; ++n) e[i + n] = t >>> 8 * (r ? n : 3 - n) & 255
}
function F(e, t, i, r, n, o) {
if (i + r > e.length) throw new RangeError("Index out of range");
if (i < 0) throw new RangeError("Index out of range")
}
function B(e, t, i, r, o) {
return o || F(e, 0, i, 4), n.write(e, t, i, r, 23, 4), i + 4
}
function k(e, t, i, r, o) {
return o || F(e, 0, i, 8), n.write(e, t, i, r, 52, 8), i + 8
}
c.prototype.slice = function (e, t) {
var i, r = this.length;
if ((e = ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), (t = void 0 === t ? r : ~~t) < 0 ? (t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e), c.TYPED_ARRAY_SUPPORT)(i = this.subarray(e, t)).__proto__ = c.prototype;
else {
var n = t - e;
i = new c(n, void 0);
for (var o = 0; o < n; ++o) i[o] = this[o + e]
}
return i
}, c.prototype.readUIntLE = function (e, t, i) {
e |= 0, t |= 0, i || I(e, t, this.length);
for (var r = this[e], n = 1, o = 0; ++o < t && (n *= 256);) r += this[e + o] * n;
return r
}, c.prototype.readUIntBE = function (e, t, i) {
e |= 0, t |= 0, i || I(e, t, this.length);
for (var r = this[e + --t], n = 1; t > 0 && (n *= 256);) r += this[e + --t] * n;
return r
}, c.prototype.readUInt8 = function (e, t) {
return t || I(e, 1, this.length), this[e]
}, c.prototype.readUInt16LE = function (e, t) {
return t || I(e, 2, this.length), this[e] | this[e + 1] << 8
}, c.prototype.readUInt16BE = function (e, t) {
return t || I(e, 2, this.length), this[e] << 8 | this[e + 1]
}, c.prototype.readUInt32LE = function (e, t) {
return t || I(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 || I(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 || I(e, t, this.length);
for (var r = this[e], n = 1, o = 0; ++o < t && (n *= 256);) r += this[e + o] * n;
return r >= (n *= 128) && (r -= Math.pow(2, 8 * t)), r
}, c.prototype.readIntBE = function (e, t, i) {
e |= 0, t |= 0, i || I(e, t, this.length);
for (var r = t, n = 1, o = this[e + --r]; r > 0 && (n *= 256);) o += this[e + --r] * n;
return o >= (n *= 128) && (o -= Math.pow(2, 8 * t)), o
}, c.prototype.readInt8 = function (e, t) {
return t || I(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
}, c.prototype.readInt16LE = function (e, t) {
t || I(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 || I(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 || I(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 || I(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 || I(e, 4, this.length), n.read(this, e, !0, 23, 4)
}, c.prototype.readFloatBE = function (e, t) {
return t || I(e, 4, this.length), n.read(this, e, !1, 23, 4)
}, c.prototype.readDoubleLE = function (e, t) {
return t || I(e, 8, this.length), n.read(this, e, !0, 52, 8)
}, c.prototype.readDoubleBE = function (e, t) {
return t || I(e, 8, this.length), n.read(this, e, !1, 52, 8)
}, c.prototype.writeUIntLE = function (e, t, i, r) {
(e = +e, t |= 0, i |= 0, r) || D(this, e, t, i, Math.pow(2, 8 * i) - 1, 0);
var n = 1,
o = 0;
for (this[t] = 255 & e; ++o < i && (n *= 256);) this[t + o] = e / n & 255;
return t + i
}, c.prototype.writeUIntBE = function (e, t, i, r) {
(e = +e, t |= 0, i |= 0, r) || D(this, e, t, i, Math.pow(2, 8 * i) - 1, 0);
var n = i - 1,
o = 1;
for (this[t + n] = 255 & e; --n >= 0 && (o *= 256);) this[t + n] = e / o & 255;
return t + i
}, c.prototype.writeUInt8 = function (e, t, i) {
return e = +e, t |= 0, i || D(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 || D(this, e, t, 2, 65535, 0), c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : O(this, e, t, !0), t + 2
}, c.prototype.writeUInt16BE = function (e, t, i) {
return e = +e, t |= 0, i || D(this, e, t, 2, 65535, 0), c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : O(this, e, t, !1), t + 2
}, c.prototype.writeUInt32LE = function (e, t, i) {
return e = +e, t |= 0, i || D(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, !0), t + 4
}, c.prototype.writeUInt32BE = function (e, t, i) {
return e = +e, t |= 0, i || D(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, !1), t + 4
}, c.prototype.writeIntLE = function (e, t, i, r) {
if (e = +e, t |= 0, !r) {
var n = Math.pow(2, 8 * i - 1);
D(this, e, t, i, n - 1, -n)
}
var o = 0,
s = 1,
a = 0;
for (this[t] = 255 & e; ++o < i && (s *= 256);) e < 0 && 0 === a && 0 !== this[t + o - 1] && (a = 1), this[t + o] = (e / s >> 0) - a & 255;
return t + i
}, c.prototype.writeIntBE = function (e, t, i, r) {
if (e = +e, t |= 0, !r) {
var n = Math.pow(2, 8 * i - 1);
D(this, e, t, i, n - 1, -n)
}
var o = i - 1,
s = 1,
a = 0;
for (this[t + o] = 255 & e; --o >= 0 && (s *= 256);) e < 0 && 0 === a && 0 !== this[t + o + 1] && (a = 1), this[t + o] = (e / s >> 0) - a & 255;
return t + i
}, c.prototype.writeInt8 = function (e, t, i) {
return e = +e, t |= 0, i || D(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 || D(this, e, t, 2, 32767, -32768), c.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e, this[t + 1] = e >>> 8) : O(this, e, t, !0), t + 2
}, c.prototype.writeInt16BE = function (e, t, i) {
return e = +e, t |= 0, i || D(this, e, t, 2, 32767, -32768), c.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8, this[t + 1] = 255 & e) : O(this, e, t, !1), t + 2
}, c.prototype.writeInt32LE = function (e, t, i) {
return e = +e, t |= 0, i || D(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, !0), t + 4
}, c.prototype.writeInt32BE = function (e, t, i) {
return e = +e, t |= 0, i || D(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, !1), t + 4
}, c.prototype.writeFloatLE = function (e, t, i) {
return B(this, e, t, !0, i)
}, c.prototype.writeFloatBE = function (e, t, i) {
return B(this, e, t, !1, i)
}, c.prototype.writeDoubleLE = function (e, t, i) {
return k(this, e, t, !0, i)
}, c.prototype.writeDoubleBE = function (e, t, i) {
return k(this, e, t, !1, i)
}, c.prototype.copy = function (e, t, i, r) {
if (i || (i = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length), t || (t = 0), r > 0 && r < i && (r = i), r === 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 (r < 0) throw new RangeError("sourceEnd out of bounds");
r > this.length && (r = this.length), e.length - t < r - i && (r = e.length - t + i);
var n, o = r - i;
if (this === e && i < t && t < r)
for (n = o - 1; n >= 0; --n) e[n + t] = this[n + i];
else if (o < 1e3 || !c.TYPED_ARRAY_SUPPORT)
for (n = 0; n < o; ++n) e[n + t] = this[n + i];
else Uint8Array.prototype.set.call(e, this.subarray(i, i + o), t);
return o
}, c.prototype.fill = function (e, t, i, r) {
if ("string" == typeof e) {
if ("string" == typeof t ? (r = t, t = 0, i = this.length) : "string" == typeof i && (r = i, i = this.length), 1 === e.length) {
var n = e.charCodeAt(0);
n < 256 && (e = n)
}
if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string");
if ("string" == typeof r && !c.isEncoding(r)) throw new TypeError("Unknown encoding: " + r)
} 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 s = c.isBuffer(e) ? e : z(new c(e, r).toString()),
a = s.length;
for (o = 0; o < i - t; ++o) this[o + t] = s[o % a]
}
return this
};
var V = /[^+\/0-9A-Za-z-_]/g;
function N(e) {
return e < 16 ? "0" + e.toString(16) : e.toString(16)
}
function z(e, t) {
var i;
t = t || 1 / 0;
for (var r = e.length, n = null, o = [], s = 0; s < r; ++s) {
if ((i = e.charCodeAt(s)) > 55295 && i < 57344) {
if (!n) {
if (i > 56319) {
(t -= 3) > -1 && o.push(239, 191, 189);
continue
}
if (s + 1 === r) {
(t -= 3) > -1 && o.push(239, 191, 189);
continue
}
n = i;
continue
}
if (i < 56320) {
(t -= 3) > -1 && o.push(239, 191, 189), n = i;
continue
}
i = 65536 + (n - 55296 << 10 | i - 56320)
} else n && (t -= 3) > -1 && o.push(239, 191, 189);
if (n = 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 U(e) {
return r.toByteArray(function (e) {
if ((e = function (e) {
return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "")
}(e).replace(V, "")).length < 2) return "";
for (; e.length % 4 != 0;) e += "=";
return e
}(e))
}
function G(e, t, i, r) {
for (var n = 0; n < r && !(n + i >= t.length || n >= e.length); ++n) t[n + i] = e[n];
return n
}
}).call(this, i(15))
}, function (e, t, i) {
var r = i(28),
n = Math.min;
e.exports = function (e) {
return e > 0 ? n(r(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, r) {
"use strict";
function n(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 s(e, t, i) {
if (s.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 a;
"object" === t(e) ? e.exports = s : r.BN = s, s.BN = s, s.wordSize = 26;
try {
a = i(542).Buffer
} catch (e) {}
function c(e, t, i) {
for (var r = 0, n = Math.min(e.length, i), o = t; o < n; o++) {
var s = e.charCodeAt(o) - 48;
r <<= 4, r |= s >= 49 && s <= 54 ? s - 49 + 10 : s >= 17 && s <= 22 ? s - 17 + 10 : 15 & s
}
return r
}
function h(e, t, i, r) {
for (var n = 0, o = Math.min(e.length, i), s = t; s < o; s++) {
var a = e.charCodeAt(s) - 48;
n *= r, n += a >= 49 ? a - 49 + 10 : a >= 17 ? a - 17 + 10 : a
}
return n
}
s.isBN = function (e) {
return e instanceof s || null !== e && "object" === t(e) && e.constructor.wordSize === s.wordSize && Array.isArray(e.words)
}, s.max = function (e, t) {
return e.cmp(t) > 0 ? e : t
}, s.min = function (e, t) {
return e.cmp(t) < 0 ? e : t
}, s.prototype._init = function (e, i, r) {
if ("number" == typeof e) return this._initNumber(e, i, r);
if ("object" === t(e)) return this._initArray(e, i, r);
"hex" === i && (i = 16), n(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" === r && this._initArray(this.toArray(), i, r)
}, s.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) : (n(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863, 1], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i)
}, s.prototype._initArray = function (e, t, i) {
if (n("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 r = 0; r < this.length; r++) this.words[r] = 0;
var o, s, a = 0;
if ("be" === i)
for (r = e.length - 1, o = 0; r >= 0; r -= 3) s = e[r] | e[r - 1] << 8 | e[r - 2] << 16, this.words[o] |= s << a & 67108863, this.words[o + 1] = s >>> 26 - a & 67108863, (a += 24) >= 26 && (a -= 26, o++);
else if ("le" === i)
for (r = 0, o = 0; r < e.length; r += 3) s = e[r] | e[r + 1] << 8 | e[r + 2] << 16, this.words[o] |= s << a & 67108863, this.words[o + 1] = s >>> 26 - a & 67108863, (a += 24) >= 26 && (a -= 26, o++);
return this.strip()
}, s.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 r, n, o = 0;
for (i = e.length - 6, r = 0; i >= t; i -= 6) n = c(e, i, i + 6), this.words[r] |= n << o & 67108863, this.words[r + 1] |= n >>> 26 - o & 4194303, (o += 24) >= 26 && (o -= 26, r++);
i + 6 !== t && (n = c(e, t, i + 6), this.words[r] |= n << o & 67108863, this.words[r + 1] |= n >>> 26 - o & 4194303), this.strip()
}, s.prototype._parseBase = function (e, t, i) {
this.words = [0], this.length = 1;
for (var r = 0, n = 1; n <= 67108863; n *= t) r++;
r--, n = n / t | 0;
for (var o = e.length - i, s = o % r, a = Math.min(o, o - s) + i, c = 0, u = i; u < a; u += r) c = h(e, u, u + r, t), this.imuln(n), this.words[0] + c < 67108864 ? this.words[0] += c : this._iaddn(c);
if (0 !== s) {
var l = 1;
for (c = h(e, u, e.length, t), u = 0; u < s; u++) l *= t;
this.imuln(l), this.words[0] + c < 67108864 ? this.words[0] += c : this._iaddn(c)
}
}, s.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
}, s.prototype.clone = function () {
var e = new s(null);
return this.copy(e), e
}, s.prototype._expand = function (e) {
for (; this.length < e;) this.words[this.length++] = 0;
return this
}, s.prototype.strip = function () {
for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--;
return this._normSign()
}, s.prototype._normSign = function () {
return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this
}, s.prototype.inspect = function () {
return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">"
};
var u = ["", "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"],
l = [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 r = e.length + t.length | 0;
i.length = r, r = r - 1 | 0;
var n = 0 | e.words[0],
o = 0 | t.words[0],
s = n * o,
a = 67108863 & s,
c = s / 67108864 | 0;
i.words[0] = a;
for (var h = 1; h < r; h++) {
for (var u = c >>> 26, l = 67108863 & c, f = Math.min(h, t.length - 1), d = Math.max(0, h - e.length + 1); d <= f; d++) {
var p = h - d | 0;
u += (s = (n = 0 | e.words[p]) * (o = 0 | t.words[d]) + l) / 67108864 | 0, l = 67108863 & s
}
i.words[h] = 0 | l, c = 0 | u
}
return 0 !== c ? i.words[h] = 0 | c : i.length--, i.strip()
}
s.prototype.toString = function (e, t) {
var i;
if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) {
i = "";
for (var r = 0, o = 0, s = 0; s < this.length; s++) {
var a = this.words[s],
c = (16777215 & (a << r | o)).toString(16);
i = 0 !== (o = a >>> 24 - r & 16777215) || s !== this.length - 1 ? u[6 - c.length] + c + i : c + i, (r += 2) >= 26 && (r -= 26, s--)
}
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 h = l[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 : u[h - m.length] + m + i
}
for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i;
return 0 !== this.negative && (i = "-" + i), i
}
n(!1, "Base should be between 2 and 36")
}, s.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 && n(!1, "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e
}, s.prototype.toJSON = function () {
return this.toString(16)
}, s.prototype.toBuffer = function (e, t) {
return n(void 0 !== a), this.toArrayLike(a, e, t)
}, s.prototype.toArray = function (e, t) {
return this.toArrayLike(Array, e, t)
}, s.prototype.toArrayLike = function (e, t, i) {
var r = this.byteLength(),
o = i || Math.max(1, r);
n(r <= o, "byte array longer than desired length"), n(o > 0, "Requested array length <= 0"), this.strip();
var s, a, c = "le" === t,
h = new e(o),
u = this.clone();
if (c) {
for (a = 0; !u.isZero(); a++) s = u.andln(255), u.iushrn(8), h[a] = s;
for (; a < o; a++) h[a] = 0
} else {
for (a = 0; a < o - r; a++) h[a] = 0;
for (a = 0; !u.isZero(); a++) s = u.andln(255), u.iushrn(8), h[o - a - 1] = s
}
return h
}, Math.clz32 ? s.prototype._countBits = function (e) {
return 32 - Math.clz32(e)
} : s.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
}, s.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
}, s.prototype.bitLength = function () {
var e = this.words[this.length - 1],
t = this._countBits(e);
return 26 * (this.length - 1) + t
}, s.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
}, s.prototype.byteLength = function () {
return Math.ceil(this.bitLength() / 8)
}, s.prototype.toTwos = function (e) {
return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone()
}, s.prototype.fromTwos = function (e) {
return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone()
}, s.prototype.isNeg = function () {
return 0 !== this.negative
}, s.prototype.neg = function () {
return this.clone().ineg()
}, s.prototype.ineg = function () {
return this.isZero() || (this.negative ^= 1), this
}, s.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()
}, s.prototype.ior = function (e) {
return n(0 == (this.negative | e.negative)), this.iuor(e)
}, s.prototype.or = function (e) {
return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this)
}, s.prototype.uor = function (e) {
return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this)
}, s.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()
}, s.prototype.iand = function (e) {
return n(0 == (this.negative | e.negative)), this.iuand(e)
}, s.prototype.and = function (e) {
return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this)
}, s.prototype.uand = function (e) {
return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this)
}, s.prototype.iuxor = function (e) {
var t, i;
this.length > e.length ? (t = this, i = e) : (t = e, i = this);
for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r];
if (this !== t)
for (; r < t.length; r++) this.words[r] = t.words[r];
return this.length = t.length, this.strip()
}, s.prototype.ixor = function (e) {
return n(0 == (this.negative | e.negative)), this.iuxor(e)
}, s.prototype.xor = function (e) {
return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this)
}, s.prototype.uxor = function (e) {
return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this)
}, s.prototype.inotn = function (e) {
n("number" == typeof e && e >= 0);
var t = 0 | Math.ceil(e / 26),
i = e % 26;
this._expand(t), i > 0 && t--;
for (var r = 0; r < t; r++) this.words[r] = 67108863 & ~this.words[r];
return i > 0 && (this.words[r] = ~this.words[r] & 67108863 >> 26 - i), this.strip()
}, s.prototype.notn = function (e) {
return this.clone().inotn(e)
}, s.prototype.setn = function (e, t) {
n("number" == typeof e && e >= 0);
var i = e / 26 | 0,
r = e % 26;
return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << r : this.words[i] & ~(1 << r), this.strip()
}, s.prototype.iadd = function (e) {
var t, i, r;
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, r = e) : (i = e, r = this);
for (var n = 0, o = 0; o < r.length; o++) t = (0 | i.words[o]) + (0 | r.words[o]) + n, this.words[o] = 67108863 & t, n = t >>> 26;
for (; 0 !== n && o < i.length; o++) t = (0 | i.words[o]) + n, this.words[o] = 67108863 & t, n = t >>> 26;
if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++;
else if (i !== this)
for (; o < i.length; o++) this.words[o] = i.words[o];
return this
}, s.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)
}, s.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, r, n = this.cmp(e);
if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this;
n > 0 ? (i = this, r = e) : (i = e, r = this);
for (var o = 0, s = 0; s < r.length; s++) o = (t = (0 | i.words[s]) - (0 | r.words[s]) + o) >> 26, this.words[s] = 67108863 & t;
for (; 0 !== o && s < i.length; s++) o = (t = (0 | i.words[s]) + o) >> 26, this.words[s] = 67108863 & t;
if (0 === o && s < i.length && i !== this)
for (; s < i.length; s++) this.words[s] = i.words[s];
return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this.strip()
}, s.prototype.sub = function (e) {
return this.clone().isub(e)
};
var p = function (e, t, i) {
var r, n, o, s = e.words,
a = t.words,
c = i.words,
h = 0,
u = 0 | s[0],
l = 8191 & u,
f = u >>> 13,
d = 0 | s[1],
p = 8191 & d,
m = d >>> 13,
g = 0 | s[2],
_ = 8191 & g,
v = g >>> 13,
y = 0 | s[3],
b = 8191 & y,
x = y >>> 13,
w = 0 | s[4],
S = 8191 & w,
T = w >>> 13,
A = 0 | s[5],
M = 8191 & A,
E = A >>> 13,
P = 0 | s[6],
C = 8191 & P,
R = P >>> 13,
I = 0 | s[7],
D = 8191 & I,
O = I >>> 13,
L = 0 | s[8],
F = 8191 & L,
B = L >>> 13,
k = 0 | s[9],
V = 8191 & k,
N = k >>> 13,
z = 0 | a[0],
U = 8191 & z,
G = z >>> 13,
W = 0 | a[1],
j = 8191 & W,
H = W >>> 13,
X = 0 | a[2],
Y = 8191 & X,
K = X >>> 13,
q = 0 | a[3],
Z = 8191 & q,
Q = q >>> 13,
J = 0 | a[4],
$ = 8191 & J,
ee = J >>> 13,
te = 0 | a[5],
ie = 8191 & te,
re = te >>> 13,
ne = 0 | a[6],
oe = 8191 & ne,
se = ne >>> 13,
ae = 0 | a[7],
ce = 8191 & ae,
he = ae >>> 13,
ue = 0 | a[8],
le = 8191 & ue,
fe = ue >>> 13,
de = 0 | a[9],
pe = 8191 & de,
me = de >>> 13;
i.negative = e.negative ^ t.negative, i.length = 19;
var ge = (h + (r = Math.imul(l, U)) | 0) + ((8191 & (n = (n = Math.imul(l, G)) + Math.imul(f, U) | 0)) << 13) | 0;
h = ((o = Math.imul(f, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p, U), n = (n = Math.imul(p, G)) + Math.imul(m, U) | 0, o = Math.imul(m, G);
var _e = (h + (r = r + Math.imul(l, j) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, H) | 0) + Math.imul(f, j) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, H) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math.imul(_, U), n = (n = Math.imul(_, G)) + Math.imul(v, U) | 0, o = Math.imul(v, G), r = r + Math.imul(p, j) | 0, n = (n = n + Math.imul(p, H) | 0) + Math.imul(m, j) | 0, o = o + Math.imul(m, H) | 0;
var ve = (h + (r = r + Math.imul(l, Y) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, K) | 0) + Math.imul(f, Y) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, K) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math.imul(b, U), n = (n = Math.imul(b, G)) + Math.imul(x, U) | 0, o = Math.imul(x, G), r = r + Math.imul(_, j) | 0, n = (n = n + Math.imul(_, H) | 0) + Math.imul(v, j) | 0, o = o + Math.imul(v, H) | 0, r = r + Math.imul(p, Y) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, Y) | 0, o = o + Math.imul(m, K) | 0;
var ye = (h + (r = r + Math.imul(l, Z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, Q) | 0) + Math.imul(f, Z) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, Q) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math.imul(S, U), n = (n = Math.imul(S, G)) + Math.imul(T, U) | 0, o = Math.imul(T, G), r = r + Math.imul(b, j) | 0, n = (n = n + Math.imul(b, H) | 0) + Math.imul(x, j) | 0, o = o + Math.imul(x, H) | 0, r = r + Math.imul(_, Y) | 0, n = (n = n + Math.imul(_, K) | 0) + Math.imul(v, Y) | 0, o = o + Math.imul(v, K) | 0, r = r + Math.imul(p, Z) | 0, n = (n = n + Math.imul(p, Q) | 0) + Math.imul(m, Z) | 0, o = o + Math.imul(m, Q) | 0;
var be = (h + (r = r + Math.imul(l, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, ee) | 0) + Math.imul(f, $) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math.imul(M, U), n = (n = Math.imul(M, G)) + Math.imul(E, U) | 0, o = Math.imul(E, G), r = r + Math.imul(S, j) | 0, n = (n = n + Math.imul(S, H) | 0) + Math.imul(T, j) | 0, o = o + Math.imul(T, H) | 0, r = r + Math.imul(b, Y) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(x, Y) | 0, o = o + Math.imul(x, K) | 0, r = r + Math.imul(_, Z) | 0, n = (n = n + Math.imul(_, Q) | 0) + Math.imul(v, Z) | 0, o = o + Math.imul(v, Q) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math.imul(p, ee) | 0) + Math.imul(m, $) | 0, o = o + Math.imul(m, ee) | 0;
var xe = (h + (r = r + Math.imul(l, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, re) | 0) + Math.imul(f, ie) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, re) | 0) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, r = Math.imul(C, U), n = (n = Math.imul(C, G)) + Math.imul(R, U) | 0, o = Math.imul(R, G), r = r + Math.imul(M, j) | 0, n = (n = n + Math.imul(M, H) | 0) + Math.imul(E, j) | 0, o = o + Math.imul(E, H) | 0, r = r + Math.imul(S, Y) | 0, n = (n = n + Math.imul(S, K) | 0) + Math.imul(T, Y) | 0, o = o + Math.imul(T, K) | 0, r = r + Math.imul(b, Z) | 0, n = (n = n + Math.imul(b, Q) | 0) + Math.imul(x, Z) | 0, o = o + Math.imul(x, Q) | 0, r = r + Math.imul(_, $) | 0, n = (n = n + Math.imul(_, ee) | 0) + Math.imul(v, $) | 0, o = o + Math.imul(v, ee) | 0, r = r + Math.imul(p, ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, o = o + Math.imul(m, re) | 0;
var we = (h + (r = r + Math.imul(l, oe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, se) | 0) + Math.imul(f, oe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, se) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math.imul(D, U), n = (n = Math.imul(D, G)) + Math.imul(O, U) | 0, o = Math.imul(O, G), r = r + Math.imul(C, j) | 0, n = (n = n + Math.imul(C, H) | 0) + Math.imul(R, j) | 0, o = o + Math.imul(R, H) | 0, r = r + Math.imul(M, Y) | 0, n = (n = n + Math.imul(M, K) | 0) + Math.imul(E, Y) | 0, o = o + Math.imul(E, K) | 0, r = r + Math.imul(S, Z) | 0, n = (n = n + Math.imul(S, Q) | 0) + Math.imul(T, Z) | 0, o = o + Math.imul(T, Q) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math.imul(b, ee) | 0) + Math.imul(x, $) | 0, o = o + Math.imul(x, ee) | 0, r = r + Math.imul(_, ie) | 0, n = (n = n + Math.imul(_, re) | 0) + Math.imul(v, ie) | 0, o = o + Math.imul(v, re) | 0, r = r + Math.imul(p, oe) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, oe) | 0, o = o + Math.imul(m, se) | 0;
var Se = (h + (r = r + Math.imul(l, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, he) | 0) + Math.imul(f, ce) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math.imul(F, U), n = (n = Math.imul(F, G)) + Math.imul(B, U) | 0, o = Math.imul(B, G), r = r + Math.imul(D, j) | 0, n = (n = n + Math.imul(D, H) | 0) + Math.imul(O, j) | 0, o = o + Math.imul(O, H) | 0, r = r + Math.imul(C, Y) | 0, n = (n = n + Math.imul(C, K) | 0) + Math.imul(R, Y) | 0, o = o + Math.imul(R, K) | 0, r = r + Math.imul(M, Z) | 0, n = (n = n + Math.imul(M, Q) | 0) + Math.imul(E, Z) | 0, o = o + Math.imul(E, Q) | 0, r = r + Math.imul(S, $) | 0, n = (n = n + Math.imul(S, ee) | 0) + Math.imul(T, $) | 0, o = o + Math.imul(T, ee) | 0, r = r + Math.imul(b, ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(x, ie) | 0, o = o + Math.imul(x, re) | 0, r = r + Math.imul(_, oe) | 0, n = (n = n + Math.imul(_, se) | 0) + Math.imul(v, oe) | 0, o = o + Math.imul(v, se) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n + Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, o = o + Math.imul(m, he) | 0;
var Te = (h + (r = r + Math.imul(l, le) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, fe) | 0) + Math.imul(f, le) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, fe) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math.imul(V, U), n = (n = Math.imul(V, G)) + Math.imul(N, U) | 0, o = Math.imul(N, G), r = r + Math.imul(F, j) | 0, n = (n = n + Math.imul(F, H) | 0) + Math.imul(B, j) | 0, o = o + Math.imul(B, H) | 0, r = r + Math.imul(D, Y) | 0, n = (n = n + Math.imul(D, K) | 0) + Math.imul(O, Y) | 0, o = o + Math.imul(O, K) | 0, r = r + Math.imul(C, Z) | 0, n = (n = n + Math.imul(C, Q) | 0) + Math.imul(R, Z) | 0, o = o + Math.imul(R, Q) | 0, r = r + Math.imul(M, $) | 0, n = (n = n + Math.imul(M, ee) | 0) + Math.imul(E, $) | 0, o = o + Math.imul(E, ee) | 0, r = r + Math.imul(S, ie) | 0, n = (n = n + Math.imul(S, re) | 0) + Math.imul(T, ie) | 0, o = o + Math.imul(T, re) | 0, r = r + Math.imul(b, oe) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(x, oe) | 0, o = o + Math.imul(x, se) | 0, r = r + Math.imul(_, ce) | 0, n = (n = n + Math.imul(_, he) | 0) + Math.imul(v, ce) | 0, o = o + Math.imul(v, he) | 0, r = r + Math.imul(p, le) | 0, n = (n = n + Math.imul(p, fe) | 0) + Math.imul(m, le) | 0, o = o + Math.imul(m, fe) | 0;
var Ae = (h + (r = r + Math.imul(l, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(l, me) | 0) + Math.imul(f, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(f, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math.imul(V, j), n = (n = Math.imul(V, H)) + Math.imul(N, j) | 0, o = Math.imul(N, H), r = r + Math.imul(F, Y) | 0, n = (n = n + Math.imul(F, K) | 0) + Math.imul(B, Y) | 0, o = o + Math.imul(B, K) | 0, r = r + Math.imul(D, Z) | 0, n = (n = n + Math.imul(D, Q) | 0) + Math.imul(O, Z) | 0, o = o + Math.imul(O, Q) | 0, r = r + Math.imul(C, $) | 0, n = (n = n + Math.imul(C, ee) | 0) + Math.imul(R, $) | 0, o = o + Math.imul(R, ee) | 0, r = r + Math.imul(M, ie) | 0, n = (n = n + Math.imul(M, re) | 0) + Math.imul(E, ie) | 0, o = o + Math.imul(E, re) | 0, r = r + Math.imul(S, oe) | 0, n = (n = n + Math.imul(S, se) | 0) + Math.imul(T, oe) | 0, o = o + Math.imul(T, se) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(x, ce) | 0, o = o + Math.imul(x, he) | 0, r = r + Math.imul(_, le) | 0, n = (n = n + Math.imul(_, fe) | 0) + Math.imul(v, le) | 0, o = o + Math.imul(v, fe) | 0;
var Me = (h + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) + Math.imul(m, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math.imul(V, Y), n = (n = Math.imul(V, K)) + Math.imul(N, Y) | 0, o = Math.imul(N, K), r = r + Math.imul(F, Z) | 0, n = (n = n + Math.imul(F, Q) | 0) + Math.imul(B, Z) | 0, o = o + Math.imul(B, Q) | 0, r = r + Math.imul(D, $) | 0, n = (n = n + Math.imul(D, ee) | 0) + Math.imul(O, $) | 0, o = o + Math.imul(O, ee) | 0, r = r + Math.imul(C, ie) | 0, n = (n = n + Math.imul(C, re) | 0) + Math.imul(R, ie) | 0, o = o + Math.imul(R, re) | 0, r = r + Math.imul(M, oe) | 0, n = (n = n + Math.imul(M, se) | 0) + Math.imul(E, oe) | 0, o = o + Math.imul(E, se) | 0, r = r + Math.imul(S, ce) | 0, n = (n = n + Math.imul(S, he) | 0) + Math.imul(T, ce) | 0, o = o + Math.imul(T, he) | 0, r = r + Math.imul(b, le) | 0, n = (n = n + Math.imul(b, fe) | 0) + Math.imul(x, le) | 0, o = o + Math.imul(x, fe) | 0;
var Ee = (h + (r = r + Math.imul(_, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(_, me) | 0) + Math.imul(v, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(v, me) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math.imul(V, Z), n = (n = Math.imul(V, Q)) + Math.imul(N, Z) | 0, o = Math.imul(N, Q), r = r + Math.imul(F, $) | 0, n = (n = n + Math.imul(F, ee) | 0) + Math.imul(B, $) | 0, o = o + Math.imul(B, ee) | 0, r = r + Math.imul(D, ie) | 0, n = (n = n + Math.imul(D, re) | 0) + Math.imul(O, ie) | 0, o = o + Math.imul(O, re) | 0, r = r + Math.imul(C, oe) | 0, n = (n = n + Math.imul(C, se) | 0) + Math.imul(R, oe) | 0, o = o + Math.imul(R, se) | 0, r = r + Math.imul(M, ce) | 0, n = (n = n + Math.imul(M, he) | 0) + Math.imul(E, ce) | 0, o = o + Math.imul(E, he) | 0, r = r + Math.imul(S, le) | 0, n = (n = n + Math.imul(S, fe) | 0) + Math.imul(T, le) | 0, o = o + Math.imul(T, fe) | 0;
var Pe = (h + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) + Math.imul(x, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(x, me) | 0) + (n >>> 13) | 0) + (Pe >>> 26) | 0, Pe &= 67108863, r = Math.imul(V, $), n = (n = Math.imul(V, ee)) + Math.imul(N, $) | 0, o = Math.imul(N, ee), r = r + Math.imul(F, ie) | 0, n = (n = n + Math.imul(F, re) | 0) + Math.imul(B, ie) | 0, o = o + Math.imul(B, re) | 0, r = r + Math.imul(D, oe) | 0, n = (n = n + Math.imul(D, se) | 0) + Math.imul(O, oe) | 0, o = o + Math.imul(O, se) | 0, r = r + Math.imul(C, ce) | 0, n = (n = n + Math.imul(C, he) | 0) + Math.imul(R, ce) | 0, o = o + Math.imul(R, he) | 0, r = r + Math.imul(M, le) | 0, n = (n = n + Math.imul(M, fe) | 0) + Math.imul(E, le) | 0, o = o + Math.imul(E, fe) | 0;
var Ce = (h + (r = r + Math.imul(S, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(S, me) | 0) + Math.imul(T, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(T, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math.imul(V, ie), n = (n = Math.imul(V, re)) + Math.imul(N, ie) | 0, o = Math.imul(N, re), r = r + Math.imul(F, oe) | 0, n = (n = n + Math.imul(F, se) | 0) + Math.imul(B, oe) | 0, o = o + Math.imul(B, se) | 0, r = r + Math.imul(D, ce) | 0, n = (n = n + Math.imul(D, he) | 0) + Math.imul(O, ce) | 0, o = o + Math.imul(O, he) | 0, r = r + Math.imul(C, le) | 0, n = (n = n + Math.imul(C, fe) | 0) + Math.imul(R, le) | 0, o = o + Math.imul(R, fe) | 0;
var Re = (h + (r = r + Math.imul(M, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(M, me) | 0) + Math.imul(E, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(E, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math.imul(V, oe), n = (n = Math.imul(V, se)) + Math.imul(N, oe) | 0, o = Math.imul(N, se), r = r + Math.imul(F, ce) | 0, n = (n = n + Math.imul(F, he) | 0) + Math.imul(B, ce) | 0, o = o + Math.imul(B, he) | 0, r = r + Math.imul(D, le) | 0, n = (n = n + Math.imul(D, fe) | 0) + Math.imul(O, le) | 0, o = o + Math.imul(O, fe) | 0;
var Ie = (h + (r = r + Math.imul(C, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(C, me) | 0) + Math.imul(R, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math.imul(V, ce), n = (n = Math.imul(V, he)) + Math.imul(N, ce) | 0, o = Math.imul(N, he), r = r + Math.imul(F, le) | 0, n = (n = n + Math.imul(F, fe) | 0) + Math.imul(B, le) | 0, o = o + Math.imul(B, fe) | 0;
var De = (h + (r = r + Math.imul(D, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(D, me) | 0) + Math.imul(O, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(O, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math.imul(V, le), n = (n = Math.imul(V, fe)) + Math.imul(N, le) | 0, o = Math.imul(N, fe);
var Oe = (h + (r = r + Math.imul(F, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(F, me) | 0) + Math.imul(B, pe) | 0)) << 13) | 0;
h = ((o = o + Math.imul(B, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863;
var Le = (h + (r = Math.imul(V, pe)) | 0) + ((8191 & (n = (n = Math.imul(V, me)) + Math.imul(N, pe) | 0)) << 13) | 0;
return h = ((o = Math.imul(N, me)) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863, c[0] = ge, c[1] = _e, c[2] = ve, c[3] = ye, c[4] = be, c[5] = xe, c[6] = we, c[7] = Se, c[8] = Te, c[9] = Ae, c[10] = Me, c[11] = Ee, c[12] = Pe, c[13] = Ce, c[14] = Re, c[15] = Ie, c[16] = De, c[17] = Oe, c[18] = Le, 0 !== h && (c[19] = h, 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), s.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 r = 0, n = 0, o = 0; o < i.length - 1; o++) {
var s = n;
n = 0;
for (var a = 67108863 & r, c = Math.min(o, t.length - 1), h = Math.max(0, o - e.length + 1); h <= c; h++) {
var u = o - h,
l = (0 | e.words[u]) * (0 | t.words[h]),
f = 67108863 & l;
a = 67108863 & (f = f + a | 0), n += (s = (s = s + (l / 67108864 | 0) | 0) + (f >>> 26) | 0) >>> 26, s &= 67108863
}
i.words[o] = a, r = s, s = n
}
return 0 !== r ? i.words[o] = r : i.length--, i.strip()
}(this, e, t) : m(this, e, t)
}, g.prototype.makeRBT = function (e) {
for (var t = new Array(e), i = s.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this.revBin(r, i, e);
return t
}, g.prototype.revBin = function (e, t, i) {
if (0 === e || e === i - 1) return e;
for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1;
return r
}, g.prototype.permute = function (e, t, i, r, n, o) {
for (var s = 0; s < o; s++) r[s] = t[e[s]], n[s] = i[e[s]]
}, g.prototype.transform = function (e, t, i, r, n, o) {
this.permute(o, e, t, i, r, n);
for (var s = 1; s < n; s <<= 1)
for (var a = s << 1, c = Math.cos(2 * Math.PI / a), h = Math.sin(2 * Math.PI / a), u = 0; u < n; u += a)
for (var l = c, f = h, d = 0; d < s; d++) {
var p = i[u + d],
m = r[u + d],
g = i[u + d + s],
_ = r[u + d + s],
v = l * g - f * _;
_ = l * _ + f * g, g = v, i[u + d] = p + g, r[u + d] = m + _, i[u + d + s] = p - g, r[u + d + s] = m - _, d !== a && (v = c * l - h * f, f = c * f + h * l, l = v)
}
}, g.prototype.guessLen13b = function (e, t) {
var i = 1 | Math.max(t, e),
r = 1 & i,
n = 0;
for (i = i / 2 | 0; i; i >>>= 1) n++;
return 1 << n + 1 + r
}, g.prototype.conjugate = function (e, t, i) {
if (!(i <= 1))
for (var r = 0; r < i / 2; r++) {
var n = e[r];
e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n
}
}, g.prototype.normalize13b = function (e, t) {
for (var i = 0, r = 0; r < t / 2; r++) {
var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i;
e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0
}
return e
}, g.prototype.convert13b = function (e, t, i, r) {
for (var o = 0, s = 0; s < t; s++) o += 0 | e[s], i[2 * s] = 8191 & o, o >>>= 13, i[2 * s + 1] = 8191 & o, o >>>= 13;
for (s = 2 * t; s < r; ++s) i[s] = 0;
n(0 === o), n(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 r = 2 * this.guessLen13b(e.length, t.length),
n = this.makeRBT(r),
o = this.stub(r),
s = new Array(r),
a = new Array(r),
c = new Array(r),
h = new Array(r),
u = new Array(r),
l = new Array(r),
f = i.words;
f.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, h, r), this.transform(s, o, a, c, r, n), this.transform(h, o, u, l, r, n);
for (var d = 0; d < r; d++) {
var p = a[d] * u[d] - c[d] * l[d];
c[d] = a[d] * l[d] + c[d] * u[d], a[d] = p
}
return this.conjugate(a, c, r), this.transform(a, c, f, o, r, n), this.conjugate(f, o, r), this.normalize13b(f, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i.strip()
}, s.prototype.mul = function (e) {
var t = new s(null);
return t.words = new Array(this.length + e.length), this.mulTo(e, t)
}, s.prototype.mulf = function (e) {
var t = new s(null);
return t.words = new Array(this.length + e.length), m(this, e, t)
}, s.prototype.imul = function (e) {
return this.clone().mulTo(e, this)
}, s.prototype.imuln = function (e) {
n("number" == typeof e), n(e < 67108864);
for (var t = 0, i = 0; i < this.length; i++) {
var r = (0 | this.words[i]) * e,
o = (67108863 & r) + (67108863 & t);
t >>= 26, t += r / 67108864 | 0, t += o >>> 26, this.words[i] = 67108863 & o
}
return 0 !== t && (this.words[i] = t, this.length++), this
}, s.prototype.muln = function (e) {
return this.clone().imuln(e)
}, s.prototype.sqr = function () {
return this.mul(this)
}, s.prototype.isqr = function () {
return this.imul(this.clone())
}, s.prototype.pow = function (e) {
var t = function (e) {
for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) {
var r = i / 26 | 0,
n = i % 26;
t[i] = (e.words[r] & 1 << n) >>> n
}
return t
}(e);
if (0 === t.length) return new s(1);
for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr());
if (++r < t.length)
for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n));
return i
}, s.prototype.iushln = function (e) {
n("number" == typeof e && e >= 0);
var t, i = e % 26,
r = (e - i) / 26,
o = 67108863 >>> 26 - i << 26 - i;
if (0 !== i) {
var s = 0;
for (t = 0; t < this.length; t++) {
var a = this.words[t] & o,
c = (0 | this.words[t]) - a << i;
this.words[t] = c | s, s = a >>> 26 - i
}
s && (this.words[t] = s, this.length++)
}
if (0 !== r) {
for (t = this.length - 1; t >= 0; t--) this.words[t + r] = this.words[t];
for (t = 0; t < r; t++) this.words[t] = 0;
this.length += r
}
return this.strip()
}, s.prototype.ishln = function (e) {
return n(0 === this.negative), this.iushln(e)
}, s.prototype.iushrn = function (e, t, i) {
var r;
n("number" == typeof e && e >= 0), r = t ? (t - t % 26) / 26 : 0;
var o = e % 26,
s = Math.min((e - o) / 26, this.length),
a = 67108863 ^ 67108863 >>> o << o,
c = i;
if (r -= s, r = Math.max(0, r), c) {
for (var h = 0; h < s; h++) c.words[h] = this.words[h];
c.length = s
}
if (0 === s);
else if (this.length > s)
for (this.length -= s, h = 0; h < this.length; h++) this.words[h] = this.words[h + s];
else this.words[0] = 0, this.length = 1;
var u = 0;
for (h = this.length - 1; h >= 0 && (0 !== u || h >= r); h--) {
var l = 0 | this.words[h];
this.words[h] = u << 26 - o | l >>> o, u = l & a
}
return c && 0 !== u && (c.words[c.length++] = u), 0 === this.length && (this.words[0] = 0, this.length = 1), this.strip()
}, s.prototype.ishrn = function (e, t, i) {
return n(0 === this.negative), this.iushrn(e, t, i)
}, s.prototype.shln = function (e) {
return this.clone().ishln(e)
}, s.prototype.ushln = function (e) {
return this.clone().iushln(e)
}, s.prototype.shrn = function (e) {
return this.clone().ishrn(e)
}, s.prototype.ushrn = function (e) {
return this.clone().iushrn(e)
}, s.prototype.testn = function (e) {
n("number" == typeof e && e >= 0);
var t = e % 26,
i = (e - t) / 26,
r = 1 << t;
return !(this.length <= i) && !!(this.words[i] & r)
}, s.prototype.imaskn = function (e) {
n("number" == typeof e && e >= 0);
var t = e % 26,
i = (e - t) / 26;
if (n(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 r = 67108863 ^ 67108863 >>> t << t;
this.words[this.length - 1] &= r
}
return this.strip()
}, s.prototype.maskn = function (e) {
return this.clone().imaskn(e)
}, s.prototype.iaddn = function (e) {
return n("number" == typeof e), n(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)
}, s.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
}, s.prototype.isubn = function (e) {
if (n("number" == typeof e), n(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()
}, s.prototype.addn = function (e) {
return this.clone().iaddn(e)
}, s.prototype.subn = function (e) {
return this.clone().isubn(e)
}, s.prototype.iabs = function () {
return this.negative = 0, this
}, s.prototype.abs = function () {
return this.clone().iabs()
}, s.prototype._ishlnsubmul = function (e, t, i) {
var r, o, s = e.length + i;
this._expand(s);
var a = 0;
for (r = 0; r < e.length; r++) {
o = (0 | this.words[r + i]) + a;
var c = (0 | e.words[r]) * t;
a = ((o -= 67108863 & c) >> 26) - (c / 67108864 | 0), this.words[r + i] = 67108863 & o
}
for (; r < this.length - i; r++) a = (o = (0 | this.words[r + i]) + a) >> 26, this.words[r + i] = 67108863 & o;
if (0 === a) return this.strip();
for (n(-1 === a), a = 0, r = 0; r < this.length; r++) a = (o = -(0 | this.words[r]) + a) >> 26, this.words[r] = 67108863 & o;
return this.negative = 1, this.strip()
}, s.prototype._wordDiv = function (e, t) {
var i = (this.length, e.length),
r = this.clone(),
n = e,
o = 0 | n.words[n.length - 1];
0 !== (i = 26 - this._countBits(o)) && (n = n.ushln(i), r.iushln(i), o = 0 | n.words[n.length - 1]);
var a, c = r.length - n.length;
if ("mod" !== t) {
(a = new s(null)).length = c + 1, a.words = new Array(a.length);
for (var h = 0; h < a.length; h++) a.words[h] = 0
}
var u = r.clone()._ishlnsubmul(n, 1, c);
0 === u.negative && (r = u, a && (a.words[c] = 1));
for (var l = c - 1; l >= 0; l--) {
var f = 67108864 * (0 | r.words[n.length + l]) + (0 | r.words[n.length + l - 1]);
for (f = Math.min(f / o | 0, 67108863), r._ishlnsubmul(n, f, l); 0 !== r.negative;) f--, r.negative = 0, r._ishlnsubmul(n, 1, l), r.isZero() || (r.negative ^= 1);
a && (a.words[l] = f)
}
return a && a.strip(), r.strip(), "div" !== t && 0 !== i && r.iushrn(i), {
div: a || null,
mod: r
}
}, s.prototype.divmod = function (e, t, i) {
return n(!e.isZero()), this.isZero() ? {
div: new s(0),
mod: new s(0)
} : 0 !== this.negative && 0 === e.negative ? (a = this.neg().divmod(e, t), "mod" !== t && (r = a.div.neg()), "div" !== t && (o = a.mod.neg(), i && 0 !== o.negative && o.iadd(e)), {
div: r,
mod: o
}) : 0 === this.negative && 0 !== e.negative ? (a = this.divmod(e.neg(), t), "mod" !== t && (r = a.div.neg()), {
div: r,
mod: a.mod
}) : 0 != (this.negative & e.negative) ? (a = this.neg().divmod(e.neg(), t), "div" !== t && (o = a.mod.neg(), i && 0 !== o.negative && o.isub(e)), {
div: a.div,
mod: o
}) : e.length > this.length || this.cmp(e) < 0 ? {
div: new s(0),
mod: this
} : 1 === e.length ? "div" === t ? {
div: this.divn(e.words[0]),
mod: null
} : "mod" === t ? {
div: null,
mod: new s(this.modn(e.words[0]))
} : {
div: this.divn(e.words[0]),
mod: new s(this.modn(e.words[0]))
} : this._wordDiv(e, t);
var r, o, a
}, s.prototype.div = function (e) {
return this.divmod(e, "div", !1).div
}, s.prototype.mod = function (e) {
return this.divmod(e, "mod", !1).mod
}, s.prototype.umod = function (e) {
return this.divmod(e, "mod", !0).mod
}, s.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,
r = e.ushrn(1),
n = e.andln(1),
o = i.cmp(r);
return o < 0 || 1 === n && 0 === o ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn(1)
}, s.prototype.modn = function (e) {
n(e <= 67108863);
for (var t = (1 << 26) % e, i = 0, r = this.length - 1; r >= 0; r--) i = (t * i + (0 | this.words[r])) % e;
return i
}, s.prototype.idivn = function (e) {
n(e <= 67108863);
for (var t = 0, i = this.length - 1; i >= 0; i--) {
var r = (0 | this.words[i]) + 67108864 * t;
this.words[i] = r / e | 0, t = r % e
}
return this.strip()
}, s.prototype.divn = function (e) {
return this.clone().idivn(e)
}, s.prototype.egcd = function (e) {
n(0 === e.negative), n(!e.isZero());
var t = this,
i = e.clone();
t = 0 !== t.negative ? t.umod(e) : t.clone();
for (var r = new s(1), o = new s(0), a = new s(0), c = new s(1), h = 0; t.isEven() && i.isEven();) t.iushrn(1), i.iushrn(1), ++h;
for (var u = i.clone(), l = 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;)(r.isOdd() || o.isOdd()) && (r.iadd(u), o.isub(l)), r.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;)(a.isOdd() || c.isOdd()) && (a.iadd(u), c.isub(l)), a.iushrn(1), c.iushrn(1);
t.cmp(i) >= 0 ? (t.isub(i), r.isub(a), o.isub(c)) : (i.isub(t), a.isub(r), c.isub(o))
}
return {
a: a,
b: c,
gcd: i.iushln(h)
}
}, s.prototype._invmp = function (e) {
n(0 === e.negative), n(!e.isZero());
var t = this,
i = e.clone();
t = 0 !== t.negative ? t.umod(e) : t.clone();
for (var r, o = new s(1), a = new s(0), c = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) {
for (var h = 0, u = 1; 0 == (t.words[0] & u) && h < 26; ++h, u <<= 1);
if (h > 0)
for (t.iushrn(h); h-- > 0;) o.isOdd() && o.iadd(c), o.iushrn(1);
for (var l = 0, f = 1; 0 == (i.words[0] & f) && l < 26; ++l, f <<= 1);
if (l > 0)
for (i.iushrn(l); l-- > 0;) a.isOdd() && a.iadd(c), a.iushrn(1);
t.cmp(i) >= 0 ? (t.isub(i), o.isub(a)) : (i.isub(t), a.isub(o))
}
return (r = 0 === t.cmpn(1) ? o : a).cmpn(0) < 0 && r.iadd(e), r
}, s.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 r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1);
for (;;) {
for (; t.isEven();) t.iushrn(1);
for (; i.isEven();) i.iushrn(1);
var n = t.cmp(i);
if (n < 0) {
var o = t;
t = i, i = o
} else if (0 === n || 0 === i.cmpn(1)) break;
t.isub(i)
}
return i.iushln(r)
}, s.prototype.invm = function (e) {
return this.egcd(e).a.umod(e)
}, s.prototype.isEven = function () {
return 0 == (1 & this.words[0])
}, s.prototype.isOdd = function () {
return 1 == (1 & this.words[0])
}, s.prototype.andln = function (e) {
return this.words[0] & e
}, s.prototype.bincn = function (e) {
n("number" == typeof e);
var t = e % 26,
i = (e - t) / 26,
r = 1 << t;
if (this.length <= i) return this._expand(i + 1), this.words[i] |= r, this;
for (var o = r, s = i; 0 !== o && s < this.length; s++) {
var a = 0 | this.words[s];
o = (a += o) >>> 26, a &= 67108863, this.words[s] = a
}
return 0 !== o && (this.words[s] = o, this.length++), this
}, s.prototype.isZero = function () {
return 1 === this.length && 0 === this.words[0]
}, s.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), n(e <= 67108863, "Number is too big");
var r = 0 | this.words[0];
t = r === e ? 0 : r < e ? -1 : 1
}
return 0 !== this.negative ? 0 | -t : t
}, s.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
}, s.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 r = 0 | this.words[i],
n = 0 | e.words[i];
if (r !== n) {
r < n ? t = -1 : r > n && (t = 1);
break
}
}
return t
}, s.prototype.gtn = function (e) {
return 1 === this.cmpn(e)
}, s.prototype.gt = function (e) {
return 1 === this.cmp(e)
}, s.prototype.gten = function (e) {
return this.cmpn(e) >= 0
}, s.prototype.gte = function (e) {
return this.cmp(e) >= 0
}, s.prototype.ltn = function (e) {
return -1 === this.cmpn(e)
}, s.prototype.lt = function (e) {
return -1 === this.cmp(e)
}, s.prototype.lten = function (e) {
return this.cmpn(e) <= 0
}, s.prototype.lte = function (e) {
return this.cmp(e) <= 0
}, s.prototype.eqn = function (e) {
return 0 === this.cmpn(e)
}, s.prototype.eq = function (e) {
return 0 === this.cmp(e)
}, s.red = function (e) {
return new S(e)
}, s.prototype.toRed = function (e) {
return n(!this.red, "Already a number in reduction context"), n(0 === this.negative, "red works only with positives"), e.convertTo(this)._forceRed(e)
}, s.prototype.fromRed = function () {
return n(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(this)
}, s.prototype._forceRed = function (e) {
return this.red = e, this
}, s.prototype.forceRed = function (e) {
return n(!this.red, "Already a number in reduction context"), this._forceRed(e)
}, s.prototype.redAdd = function (e) {
return n(this.red, "redAdd works only with red numbers"), this.red.add(this, e)
}, s.prototype.redIAdd = function (e) {
return n(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e)
}, s.prototype.redSub = function (e) {
return n(this.red, "redSub works only with red numbers"), this.red.sub(this, e)
}, s.prototype.redISub = function (e) {
return n(this.red, "redISub works only with red numbers"), this.red.isub(this, e)
}, s.prototype.redShl = function (e) {
return n(this.red, "redShl works only with red numbers"), this.red.shl(this, e)
}, s.prototype.redMul = function (e) {
return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red.mul(this, e)
}, s.prototype.redIMul = function (e) {
return n(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red.imul(this, e)
}, s.prototype.redSqr = function () {
return n(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(this)
}, s.prototype.redISqr = function () {
return n(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(this)
}, s.prototype.redSqrt = function () {
return n(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(this)
}, s.prototype.redInvm = function () {
return n(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(this)
}, s.prototype.redNeg = function () {
return n(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(this)
}, s.prototype.redPow = function (e) {
return n(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 s(t, 16), this.n = this.p.bitLength(), this.k = new s(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 x() {
v.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")
}
function w() {
v.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")
}
function S(e) {
if ("string" == typeof e) {
var t = s._prime(e);
this.m = t.p, this.prime = t
} else n(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null
}
function T(e) {
S.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this.shift % 26), this.r = new s(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 s(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 r = t < this.n ? -1 : i.ucmp(this.p);
return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 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), r = 0; r < i; r++) t.words[r] = e.words[r];
if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1);
var n = e.words[9];
for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) {
var o = 0 | e.words[r];
e.words[r - 10] = (4194303 & o) << 4 | n >>> 22, n = o
}
n >>>= 22, e.words[r - 10] = n, 0 === n && 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 r = 0 | e.words[i];
t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (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(x, v), o(w, v), w.prototype.imulK = function (e) {
for (var t = 0, i = 0; i < e.length; i++) {
var r = 19 * (0 | e.words[i]) + t,
n = 67108863 & r;
r >>>= 26, e.words[i] = n, t = r
}
return 0 !== t && (e.words[e.length++] = t), e
}, s._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 x;
else {
if ("p25519" !== e) throw new Error("Unknown prime " + e);
t = new w
}
return _[e] = t, t
}, S.prototype._verify1 = function (e) {
n(0 === e.negative, "red works only with positives"), n(e.red, "red works only with red numbers")
}, S.prototype._verify2 = function (e, t) {
n(0 == (e.negative | t.negative), "red works only with positives"), n(e.red && e.red === t.red, "red works only with red numbers")
}, S.prototype.imod = function (e) {
return this.prime ? this.prime.ireduce(e)._forceRed(this) : e.umod(this.m)._forceRed(this)
}, S.prototype.neg = function (e) {
return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this)
}, S.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)
}, S.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
}, S.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)
}, S.prototype.isub = function (e, t) {
this._verify2(e, t);
var i = e.isub(t);
return i.cmpn(0) < 0 && i.iadd(this.m), i
}, S.prototype.shl = function (e, t) {
return this._verify1(e), this.imod(e.ushln(t))
}, S.prototype.imul = function (e, t) {
return this._verify2(e, t), this.imod(e.imul(t))
}, S.prototype.mul = function (e, t) {
return this._verify2(e, t), this.imod(e.mul(t))
}, S.prototype.isqr = function (e) {
return this.imul(e, e.clone())
}, S.prototype.sqr = function (e) {
return this.mul(e, e)
}, S.prototype.sqrt = function (e) {
if (e.isZero()) return e.clone();
var t = this.m.andln(3);
if (n(t % 2 == 1), 3 === t) {
var i = this.m.add(new s(1)).iushrn(2);
return this.pow(e, i)
}
for (var r = this.m.subn(1), o = 0; !r.isZero() && 0 === r.andln(1);) o++, r.iushrn(1);
n(!r.isZero());
var a = new s(1).toRed(this),
c = a.redNeg(),
h = this.m.subn(1).iushrn(1),
u = this.m.bitLength();
for (u = new s(2 * u * u).toRed(this); 0 !== this.pow(u, h).cmp(c);) u.redIAdd(c);
for (var l = this.pow(u, r), f = this.pow(e, r.addn(1).iushrn(1)), d = this.pow(e, r), p = o; 0 !== d.cmp(a);) {
for (var m = d, g = 0; 0 !== m.cmp(a); g++) m = m.redSqr();
n(g < p);
var _ = this.pow(l, new s(1).iushln(p - g - 1));
f = f.redMul(_), l = _.redSqr(), d = d.redMul(l), p = g
}
return f
}, S.prototype.invm = function (e) {
var t = e._invmp(this.m);
return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t)
}, S.prototype.pow = function (e, t) {
if (t.isZero()) return new s(1).toRed(this);
if (0 === t.cmpn(1)) return e.clone();
var i = new Array(16);
i[0] = new s(1).toRed(this), i[1] = e;
for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e);
var n = i[0],
o = 0,
a = 0,
c = t.bitLength() % 26;
for (0 === c && (c = 26), r = t.length - 1; r >= 0; r--) {
for (var h = t.words[r], u = c - 1; u >= 0; u--) {
var l = h >> u & 1;
n !== i[0] && (n = this.sqr(n)), 0 !== l || 0 !== o ? (o <<= 1, o |= l, (4 === ++a || 0 === r && 0 === u) && (n = this.mul(n, i[o]), a = 0, o = 0)) : a = 0
}
c = 26
}
return n
}, S.prototype.convertTo = function (e) {
var t = e.umod(this.m);
return t === e ? t.clone() : t
}, S.prototype.convertFrom = function (e) {
var t = e.clone();
return t.red = null, t
}, s.mont = function (e) {
return new T(e)
}, o(T, S), T.prototype.convertTo = function (e) {
return this.imod(e.ushln(this.shift))
}, T.prototype.convertFrom = function (e) {
var t = this.imod(e.mul(this.rinv));
return t.red = null, t
}, T.prototype.imul = function (e, t) {
if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e;
var i = e.imul(t),
r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
n = i.isub(r).iushrn(this.shift),
o = n;
return n.cmp(this.m) >= 0 ? o = n.isub(this.m) : n.cmpn(0) < 0 && (o = n.iadd(this.m)), o._forceRed(this)
}, T.prototype.mul = function (e, t) {
if (e.isZero() || t.isZero()) return new s(0)._forceRed(this);
var i = e.mul(t),
r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
n = i.isub(r).iushrn(this.shift),
o = n;
return n.cmp(this.m) >= 0 ? o = n.isub(this.m) : n.cmpn(0) < 0 && (o = n.iadd(this.m)), o._forceRed(this)
}, T.prototype.invm = function (e) {
return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)
}
}(e, this)
}).call(this, i(167)(e))
}, function (e, t, i) {
var r = i(4),
n = i(137),
o = i(39),
s = Object.defineProperty;
t.f = i(13) ? Object.defineProperty : function (e, t, i) {
if (r(e), t = o(t, !0), r(i), n) try {
return s(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 (e, t) {
var i = e.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 r;
r = function () {
return this
}();
try {
r = r || new Function("return this")()
} catch (e) {
"object" === ("undefined" == typeof window ? "undefined" : i(window)) && (r = window)
}
e.exports = r
}, function (e, t, i) {
e.exports = {
EPSILON: i(173),
create: i(174),
clone: i(412),
angle: i(413),
fromValues: i(175),
copy: i(414),
set: i(415),
equals: i(416),
exactEquals: i(417),
add: i(418),
subtract: i(178),
sub: i(419),
multiply: i(179),
mul: i(420),
divide: i(180),
div: i(421),
min: i(422),
max: i(423),
floor: i(424),
ceil: i(425),
round: i(426),
scale: i(427),
scaleAndAdd: i(428),
distance: i(181),
dist: i(429),
squaredDistance: i(182),
sqrDist: i(430),
length: i(183),
len: i(431),
squaredLength: i(184),
sqrLen: i(432),
negate: i(433),
inverse: i(434),
normalize: i(176),
dot: i(177),
cross: i(435),
lerp: i(436),
random: i(437),
transformMat4: i(438),
transformMat3: i(439),
transformQuat: i(440),
rotateX: i(441),
rotateY: i(442),
rotateZ: i(443),
forEach: i(444)
}
}, function (e, t, i) {
"use strict";
var r = t;
r.version = i(548).version, r.utils = i(549), r.rand = i(213), r.curve = i(91), r.curves = i(554), r.ec = i(562), r.eddsa = i(566)
}, function (e, t, i) {
"use strict";
(function (e) {
function i(t, i, r, n, o, s, a) {
try {
var c = t[s](a),
h = c.value
} catch (e) {
return void r(e)
}
c.done ? i(h) : e.resolve(h).then(n, o)
}
function r(t) {
return function () {
var r = this,
n = arguments;
return new e(function (e, o) {
var s = t.apply(r, n);
function a(t) {
i(s, e, o, a, c, "next", t)
}
function c(t) {
i(s, e, o, a, c, "throw", t)
}
a(void 0)
})
}
}
function n(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
var o = function () {
function t() {
! function (e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}(this, t)
}
var i, o, s;
return i = t, o = null, s = [{
key: "init",
value: function () {
self.baseUrl = "https://9p1bb7fwdf.execute-api.us-east-1.amazonaws.com/prod", self.socket = null
}
}, {
key: "getICECandidates",
value: function () {
return new e(function (e, i) {
t.executeXhr("/get-ice-candidates", "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 r = JSON.parse(i);
e(r), setInterval(function () {
t.executeXhr("/game/" + r.code + "/heartbeat", "put").then(function (e) {})
}, 5e3)
})
})
}
}, {
key: "getGame",
value: function (i) {
return null == i ? t.getNewGame() : new e(function (e, r) {
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),
r = {
payload: t.p,
meta: t.m,
msgEvent: t.o,
to: t.m.t,
from: t.m.f
};
i(r)
});
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 s;
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:
s = e.sent, self.socket = s, s.addEventListener("open", function () {
i(), setInterval(function () {
s.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: "sendSignalingTo",
value: function () {
var e = r(regeneratorRuntime.mark(function e(t, i, r, n) {
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 + "/" + r,
t: i,
o: "message"
},
p: {
signal: JSON.stringify(n)
}
}, self.socket.send(JSON.stringify(o));
case 5:
case "end":
return e.stop()
}
}, e, this)
}));
return function (t, i, r, n) {
return e.apply(this, arguments)
}
}()
}, {
key: "getWebSocket",
value: function () {
var e = r(regeneratorRuntime.mark(function e(i, r) {
var n, o, s;
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 + "/" + r, "get");
case 3:
return e.t1 = e.sent, n = e.t0.parse.call(e.t0, e.t1).v, e.t2 = JSON, e.next = 8, t.executeXhr("/get-signaling-host/" + i + "/" + r, "get");
case 8:
return e.t3 = e.sent, o = e.t2.parse.call(e.t2, e.t3).v, s = o + "/v2/" + n, e.abrupt("return", new WebSocket(s));
case 12:
case "end":
return e.stop()
}
}, e, this)
}));
return function (t, i) {
return e.apply(this, arguments)
}
}()
}, {
key: "addPlayerToGame",
value: function (i, r) {
return new e(function (e, r) {
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, r) {
return new e(function (e, n) {
var o = new XMLHttpRequest,
s = t.pathUrl(i);
o.open(r, s), o.onreadystatechange = function () {
4 !== o.readyState || 404 !== o.status || n()
}, o.send(), o.onload = function () {
e(o.responseText)
}, o.onerror = function (e) {
console.log(e), n(e)
}
})
}
}], o && n(i.prototype, o), s && n(i, s), t
}();
t.a = o
}).call(this, i(52))
}, function (e, t, i) {
var r = i(5),
n = i(23),
o = i(22),
s = i(45)("src"),
a = Function.toString,
c = ("" + a).split("toString");
i(14).inspectSource = function (e) {
return a.call(e)
}, (e.exports = function (e, t, i, a) {
var h = "function" == typeof i;
h && (o(i, "name") || n(i, "name", t)), e[t] !== i && (h && (o(i, s) || n(i, s, e[t] ? "" + e[t] : c.join(String(t)))), e === r ? e[t] = i : a ? e[t] ? e[t] = i : n(e, t, i) : (delete e[t], n(e, t, i)))
})(Function.prototype, "toString", function () {
return "function" == typeof this && this[s] || a.call(this)
})
}, function (e, t, i) {
var r = i(37);
e.exports = function (e) {
return Object(r(e))
}
}, function (e, t, i) {
var r = i(0),
n = i(3),
o = i(37),
s = /"/g,
a = function (e, t, i, r) {
var n = String(o(e)),
a = "<" + t;
return "" !== i && (a += " " + i + '="' + String(r).replace(s, "&quot;") + '"'), a + ">" + n + "</" + t + ">"
};
e.exports = function (e, t) {
var i = {};
i[e] = t(a), r(r.P + r.F * n(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 r = i(12),
n = i(44);
e.exports = i(13) ? function (e, t, i) {
return r.f(e, t, n(1, i))
} : function (e, t, i) {
return e[t] = i, e
}
}, function (e, t, i) {
var r = i(64),
n = i(37);
e.exports = function (e) {
return r(n(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 r = i(3);
e.exports = function (e, t) {
return !!e && r(function () {
t ? e.call(null, function () {}, 1) : e.call(null)
})
}
}, function (e, t) {
var i, r, n = e.exports = {};
function o() {
throw new Error("setTimeout has not been defined")
}
function s() {
throw new Error("clearTimeout has not been defined")
}
function a(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 {
r = "function" == typeof clearTimeout ? clearTimeout : s
} catch (e) {
r = s
}
}();
var c, h = [],
u = !1,
l = -1;
function f() {
u && c && (u = !1, c.length ? h = c.concat(h) : l = -1, h.length && d())
}
function d() {
if (!u) {
var e = a(f);
u = !0;
for (var t = h.length; t;) {
for (c = h, h = []; ++l < t;) c && c[l].run();
l = -1, t = h.length
}
c = null, u = !1,
function (e) {
if (r === clearTimeout) return clearTimeout(e);
if ((r === s || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e);
try {
r(e)
} catch (t) {
try {
return r.call(null, e)
} catch (t) {
return r.call(this, e)
}
}
}(e)
}
}
function p(e, t) {
this.fun = e, this.array = t
}
function m() {}
n.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];
h.push(new p(e, t)), 1 !== h.length || u || a(d)
}, p.prototype.run = function () {
this.fun.apply(null, this.array)
}, n.title = "browser", n.browser = !0, n.env = {}, n.argv = [], n.version = "", n.versions = {}, n.on = m, n.addListener = m, n.once = m, n.off = m, n.removeListener = m, n.removeAllListeners = m, n.emit = m, n.prependListener = m, n.prependOnceListener = m, n.listeners = function (e) {
return []
}, n.binding = function (e) {
throw new Error("process.binding is not supported")
}, n.cwd = function () {
return "/"
}, n.chdir = function (e) {
throw new Error("process.chdir is not supported")
}, n.umask = function () {
return 0
}
}, function (e, t) {
var i = Math.ceil,
r = Math.floor;
e.exports = function (e) {
return isNaN(e = +e) ? 0 : (e > 0 ? r : i)(e)
}
}, function (e, t, i) {
var r = i(65),
n = i(44),
o = i(24),
s = i(39),
a = i(22),
c = i(137),
h = Object.getOwnPropertyDescriptor;
t.f = i(13) ? h : function (e, t) {
if (e = o(e), t = s(t, !0), c) try {
return h(e, t)
} catch (e) {}
if (a(e, t)) return n(!r.f.call(e, t), e[t])
}
}, function (e, t, i) {
var r = i(0),
n = i(14),
o = i(3);
e.exports = function (e, t) {
var i = (n.Object || {})[e] || Object[e],
s = {};
s[e] = t(i), r(r.S + r.F * o(function () {
i(1)
}), "Object", s)
}
}, function (e, t, i) {
var r = i(34),
n = i(64),
o = i(20),
s = i(10),
a = i(321);
e.exports = function (e, t) {
var i = 1 == e,
c = 2 == e,
h = 3 == e,
u = 4 == e,
l = 6 == e,
f = 5 == e || l,
d = t || a;
return function (t, a, p) {
for (var m, g, _ = o(t), v = n(_), y = r(a, p, 3), b = s(v.length), x = 0, w = i ? d(t, b) : c ? d(t, 0) : void 0; b > x; x++)
if ((f || x in v) && (g = y(m = v[x], x, _), e))
if (i) w[x] = g;
else if (g) switch (e) {
case 3:
return !0;
case 5:
return m;
case 6:
return x;
case 2:
w.push(m)
} else if (u) return !1;
return l ? -1 : h || u ? u : w
}
}
}, function (e, t, i) {
"use strict";
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 n = Object.prototype.hasOwnProperty,
o = Object.prototype.toString,
s = Object.defineProperty,
a = Object.getOwnPropertyDescriptor,
c = function (e) {
return "function" == typeof Array.isArray ? Array.isArray(e) : "[object Array]" === o.call(e)
},
h = function (e) {
if (!e || "[object Object]" !== o.call(e)) return !1;
var t, i = n.call(e, "constructor"),
r = e.constructor && e.constructor.prototype && n.call(e.constructor.prototype, "isPrototypeOf");
if (e.constructor && !i && !r) return !1;
for (t in e);
return void 0 === t || n.call(e, t)
},
u = function (e, t) {
s && "__proto__" === t.name ? s(e, t.name, {
enumerable: !0,
configurable: !0,
value: t.newValue,
writable: !0
}) : e[t.name] = t.newValue
},
l = function (e, t) {
if ("__proto__" === t) {
if (!n.call(e, t)) return;
if (a) return a(e, t).value
}
return e[t]
};
e.exports = function e() {
var t, i, n, o, s, a, f = arguments[0],
d = 1,
p = arguments.length,
m = !1;
for ("boolean" == typeof f && (m = f, f = arguments[1] || {}, d = 2), (null == f || "object" !== r(f) && "function" != typeof f) && (f = {}); d < p; ++d)
if (null != (t = arguments[d]))
for (i in t) n = l(f, i), f !== (o = l(t, i)) && (m && o && (h(o) || (s = c(o))) ? (s ? (s = !1, a = n && c(n) ? n : []) : a = n && h(n) ? n : {}, u(f, {
name: i,
newValue: e(m, a, o)
})) : void 0 !== o && u(f, {
name: i,
newValue: o
}));
return f
}
}, function (e, t, i) {
"use strict";
var r = i(25),
n = 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 s(e) {
return (e >>> 24 | e >>> 8 & 65280 | e << 8 & 16711680 | (255 & e) << 24) >>> 0
}
function a(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 = n, 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), n = 0; n < e.length; n += 2) i.push(parseInt(e[n] + e[n + 1], 16))
} else
for (var r = 0, n = 0; n < e.length; n++) {
var s = e.charCodeAt(n);
s < 128 ? i[r++] = s : s < 2048 ? (i[r++] = s >> 6 | 192, i[r++] = 63 & s | 128) : o(e, n) ? (s = 65536 + ((1023 & s) << 10) + (1023 & e.charCodeAt(++n)), i[r++] = s >> 18 | 240, i[r++] = s >> 12 & 63 | 128, i[r++] = s >> 6 & 63 | 128, i[r++] = 63 & s | 128) : (i[r++] = s >> 12 | 224, i[r++] = s >> 6 & 63 | 128, i[r++] = 63 & s | 128)
} else
for (n = 0; n < e.length; n++) i[n] = 0 | e[n];
return i
}, t.toHex = function (e) {
for (var t = "", i = 0; i < e.length; i++) t += a(e[i].toString(16));
return t
}, t.htonl = s, t.toHex32 = function (e, t) {
for (var i = "", r = 0; r < e.length; r++) {
var n = e[r];
"little" === t && (n = s(n)), i += c(n.toString(16))
}
return i
}, t.zero2 = a, t.zero8 = c, t.join32 = function (e, t, i, n) {
var o = i - t;
r(o % 4 == 0);
for (var s = new Array(o / 4), a = 0, c = t; a < s.length; a++, c += 4) {
var h;
h = "big" === n ? 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], s[a] = h >>> 0
}
return s
}, t.split32 = function (e, t) {
for (var i = new Array(4 * e.length), r = 0, n = 0; r < e.length; r++, n += 4) {
var o = e[r];
"big" === t ? (i[n] = o >>> 24, i[n + 1] = o >>> 16 & 255, i[n + 2] = o >>> 8 & 255, i[n + 3] = 255 & o) : (i[n + 3] = o >>> 24, i[n + 2] = o >>> 16 & 255, i[n + 1] = o >>> 8 & 255, i[n] = 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, r) {
return e + t + i + r >>> 0
}, t.sum32_5 = function (e, t, i, r, n) {
return e + t + i + r + n >>> 0
}, t.sum64 = function (e, t, i, r) {
var n = e[t],
o = r + e[t + 1] >>> 0,
s = (o < r ? 1 : 0) + i + n;
e[t] = s >>> 0, e[t + 1] = o
}, t.sum64_hi = function (e, t, i, r) {
return (t + r >>> 0 < t ? 1 : 0) + e + i >>> 0
}, t.sum64_lo = function (e, t, i, r) {
return t + r >>> 0
}, t.sum64_4_hi = function (e, t, i, r, n, o, s, a) {
var c = 0,
h = t;
return c += (h = h + r >>> 0) < t ? 1 : 0, c += (h = h + o >>> 0) < o ? 1 : 0, e + i + n + s + (c += (h = h + a >>> 0) < a ? 1 : 0) >>> 0
}, t.sum64_4_lo = function (e, t, i, r, n, o, s, a) {
return t + r + o + a >>> 0
}, t.sum64_5_hi = function (e, t, i, r, n, o, s, a, c, h) {
var u = 0,
l = t;
return u += (l = l + r >>> 0) < t ? 1 : 0, u += (l = l + o >>> 0) < o ? 1 : 0, u += (l = l + a >>> 0) < a ? 1 : 0, e + i + n + s + c + (u += (l = l + h >>> 0) < h ? 1 : 0) >>> 0
}, t.sum64_5_lo = function (e, t, i, r, n, o, s, a, c, h) {
return t + r + o + a + h >>> 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 r = i(35);
e.exports = function (e, t, i) {
if (r(e), void 0 === t) return e;
switch (i) {
case 1:
return function (i) {
return e.call(t, i)
};
case 2:
return function (i, r) {
return e.call(t, i, r)
};
case 3:
return function (i, r, n) {
return e.call(t, i, r, n)
}
}
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 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)
}
if (i(13)) {
var n = i(46),
o = i(5),
s = i(3),
a = i(0),
c = i(84),
h = i(121),
u = i(34),
l = i(60),
f = i(44),
d = i(23),
p = i(61),
m = i(28),
g = i(10),
_ = i(163),
v = i(48),
y = i(39),
b = i(22),
x = i(66),
w = i(6),
S = i(20),
T = i(113),
A = i(49),
M = i(51),
E = i(50).f,
P = i(115),
C = i(45),
R = i(8),
I = i(31),
D = i(74),
O = i(67),
L = i(117),
F = i(57),
B = i(77),
k = i(59),
V = i(116),
N = i(154),
z = i(12),
U = i(29),
G = z.f,
W = U.f,
j = o.RangeError,
H = o.TypeError,
X = o.Uint8Array,
Y = Array.prototype,
K = h.ArrayBuffer,
q = h.DataView,
Z = I(0),
Q = I(2),
J = I(3),
$ = I(4),
ee = I(5),
te = I(6),
ie = D(!0),
re = D(!1),
ne = L.values,
oe = L.keys,
se = L.entries,
ae = Y.lastIndexOf,
ce = Y.reduce,
he = Y.reduceRight,
ue = Y.join,
le = Y.sort,
fe = Y.slice,
de = Y.toString,
pe = Y.toLocaleString,
me = R("iterator"),
ge = R("toStringTag"),
_e = C("typed_constructor"),
ve = C("def_constructor"),
ye = c.CONSTR,
be = c.TYPED,
xe = c.VIEW,
we = I(1, function (e, t) {
return Ee(O(e, e[ve]), t)
}),
Se = s(function () {
return 1 === new X(new Uint16Array([1]).buffer)[0]
}),
Te = !!X && !!X.prototype.set && s(function () {
new X(1).set({})
}),
Ae = function (e, t) {
var i = m(e);
if (i < 0 || i % t) throw j("Wrong offset!");
return i
},
Me = function (e) {
if (w(e) && be in e) return e;
throw H(e + " is not a typed array!")
},
Ee = function (e, t) {
if (!(w(e) && _e in e)) throw H("It is not a typed array constructor!");
return new e(t)
},
Pe = function (e, t) {
return Ce(O(e, e[ve]), t)
},
Ce = function (e, t) {
for (var i = 0, r = t.length, n = Ee(e, r); r > i;) n[i] = t[i++];
return n
},
Re = function (e, t, i) {
G(e, t, {
get: function () {
return this._d[i]
}
})
},
Ie = function (e) {
var t, i, r, n, o, s, a = S(e),
c = arguments.length,
h = c > 1 ? arguments[1] : void 0,
l = void 0 !== h,
f = P(a);
if (null != f && !T(f)) {
for (s = f.call(a), r = [], t = 0; !(o = s.next()).done; t++) r.push(o.value);
a = r
}
for (l && c > 2 && (h = u(h, arguments[2], 2)), t = 0, i = g(a.length), n = Ee(this, i); i > t; t++) n[t] = l ? h(a[t], t) : a[t];
return n
},
De = function () {
for (var e = 0, t = arguments.length, i = Ee(this, t); t > e;) i[e] = arguments[e++];
return i
},
Oe = !!X && s(function () {
pe.call(new X(1))
}),
Le = function () {
return pe.apply(Oe ? fe.call(Me(this)) : Me(this), arguments)
},
Fe = {
copyWithin: function (e, t) {
return N.call(Me(this), e, t, arguments.length > 2 ? arguments[2] : void 0)
},
every: function (e) {
return $(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
fill: function (e) {
return V.apply(Me(this), arguments)
},
filter: function (e) {
return Pe(this, Q(Me(this), e, arguments.length > 1 ? arguments[1] : void 0))
},
find: function (e) {
return ee(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
findIndex: function (e) {
return te(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
forEach: function (e) {
Z(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
indexOf: function (e) {
return re(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
includes: function (e) {
return ie(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
join: function (e) {
return ue.apply(Me(this), arguments)
},
lastIndexOf: function (e) {
return ae.apply(Me(this), arguments)
},
map: function (e) {
return we(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
reduce: function (e) {
return ce.apply(Me(this), arguments)
},
reduceRight: function (e) {
return he.apply(Me(this), arguments)
},
reverse: function () {
for (var e, t = Me(this).length, i = Math.floor(t / 2), r = 0; r < i;) e = this[r], this[r++] = this[--t], this[t] = e;
return this
},
some: function (e) {
return J(Me(this), e, arguments.length > 1 ? arguments[1] : void 0)
},
sort: function (e) {
return le.call(Me(this), e)
},
subarray: function (e, t) {
var i = Me(this),
r = i.length,
n = v(e, r);
return new(O(i, i[ve]))(i.buffer, i.byteOffset + n * i.BYTES_PER_ELEMENT, g((void 0 === t ? r : v(t, r)) - n))
}
},
Be = function (e, t) {
return Pe(this, fe.call(Me(this), e, t))
},
ke = function (e) {
Me(this);
var t = Ae(arguments[1], 1),
i = this.length,
r = S(e),
n = g(r.length),
o = 0;
if (n + t > i) throw j("Wrong length!");
for (; o < n;) this[t + o] = r[o++]
},
Ve = {
entries: function () {
return se.call(Me(this))
},
keys: function () {
return oe.call(Me(this))
},
values: function () {
return ne.call(Me(this))
}
},
Ne = function (e, t) {
return w(e) && e[be] && "symbol" != r(t) && t in e && String(+t) == String(t)
},
ze = function (e, t) {
return Ne(e, t = y(t, !0)) ? f(2, e[t]) : W(e, t)
},
Ue = function (e, t, i) {
return !(Ne(e, t = y(t, !0)) && w(i) && b(i, "value")) || b(i, "get") || b(i, "set") || i.configurable || b(i, "writable") && !i.writable || b(i, "enumerable") && !i.enumerable ? G(e, t, i) : (e[t] = i.value, e)
};
ye || (U.f = ze, z.f = Ue), a(a.S + a.F * !ye, "Object", {
getOwnPropertyDescriptor: ze,
defineProperty: Ue
}), s(function () {
de.call({})
}) && (de = pe = function () {
return ue.call(this)
});
var Ge = p({}, Fe);
p(Ge, Ve), d(Ge, me, Ve.values), p(Ge, {
slice: Be,
set: ke,
constructor: function () {},
toString: de,
toLocaleString: Le
}), Re(Ge, "buffer", "b"), Re(Ge, "byteOffset", "o"), Re(Ge, "byteLength", "l"), Re(Ge, "length", "e"), G(Ge, ge, {
get: function () {
return this[be]
}
}), e.exports = function (e, t, i, r) {
var h = e + ((r = !!r) ? "Clamped" : "") + "Array",
u = "get" + e,
f = "set" + e,
p = o[h],
m = p || {},
v = p && M(p),
y = !p || !c.ABV,
b = {},
S = p && p.prototype,
T = function (e, i) {
G(e, i, {
get: function () {
return function (e, i) {
var r = e._d;
return r.v[u](i * t + r.o, Se)
}(this, i)
},
set: function (e) {
return function (e, i, n) {
var o = e._d;
r && (n = (n = Math.round(n)) < 0 ? 0 : n > 255 ? 255 : 255 & n), o.v[f](i * t + o.o, n, Se)
}(this, i, e)
},
enumerable: !0
})
};
y ? (p = i(function (e, i, r, n) {
l(e, p, h, "_d");
var o, s, a, c, u = 0,
f = 0;
if (w(i)) {
if (!(i instanceof K || "ArrayBuffer" == (c = x(i)) || "SharedArrayBuffer" == c)) return be in i ? Ce(p, i) : Ie.call(p, i);
o = i, f = Ae(r, t);
var m = i.byteLength;
if (void 0 === n) {
if (m % t) throw j("Wrong length!");
if ((s = m - f) < 0) throw j("Wrong length!")
} else if ((s = g(n) * t) + f > m) throw j("Wrong length!");
a = s / t
} else a = _(i), o = new K(s = a * t);
for (d(e, "_d", {
b: o,
o: f,
l: s,
e: a,
v: new q(o)
}); u < a;) T(e, u++)
}), S = p.prototype = A(Ge), d(S, "constructor", p)) : s(function () {
p(1)
}) && s(function () {
new p(-1)
}) && B(function (e) {
new p, new p(null), new p(1.5), new p(e)
}, !0) || (p = i(function (e, i, r, n) {
var o;
return l(e, p, h), w(i) ? i instanceof K || "ArrayBuffer" == (o = x(i)) || "SharedArrayBuffer" == o ? void 0 !== n ? new m(i, Ae(r, t), n) : void 0 !== r ? new m(i, Ae(r, t)) : new m(i) : be in i ? Ce(p, i) : Ie.call(p, i) : new m(_(i))
}), Z(v !== Function.prototype ? E(m).concat(E(v)) : E(m), function (e) {
e in p || d(p, e, m[e])
}), p.prototype = S, n || (S.constructor = p));
var P = S[me],
C = !!P && ("values" == P.name || null == P.name),
R = Ve.values;
d(p, _e, !0), d(S, be, h), d(S, xe, !0), d(S, ve, p), (r ? new p(1)[ge] == h : ge in S) || G(S, ge, {
get: function () {
return h
}
}), b[h] = p, a(a.G + a.W + a.F * (p != m), b), a(a.S, h, {
BYTES_PER_ELEMENT: t
}), a(a.S + a.F * s(function () {
m.of.call(p, 1)
}), h, {
from: Ie,
of: De
}), "BYTES_PER_ELEMENT" in S || d(S, "BYTES_PER_ELEMENT", t), a(a.P, h, Fe), k(h), a(a.P + a.F * Te, h, {
set: ke
}), a(a.P + a.F * !C, h, Ve), n || S.toString == de || (S.toString = de), a(a.P + a.F * s(function () {
new p(1).slice()
}), h, {
slice: Be
}), a(a.P + a.F * (s(function () {
return [1, 2].toLocaleString() != new p([1, 2]).toLocaleString()
}) || !s(function () {
S.toLocaleString.call([1, 2])
})), h, {
toLocaleString: Le
}), F[h] = C ? P : R, n || C || d(S, me, R)
}
} else e.exports = function () {}
}, function (e, t, i) {
var r = i(6);
e.exports = function (e, t) {
if (!r(e)) return e;
var i, n;
if (t && "function" == typeof (i = e.toString) && !r(n = i.call(e))) return n;
if ("function" == typeof (i = e.valueOf) && !r(n = i.call(e))) return n;
if (!t && "function" == typeof (i = e.toString) && !r(n = i.call(e))) return n;
throw TypeError("Can't convert object to primitive value")
}
}, function (e, t, i) {
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 n = i(45)("meta"),
o = i(6),
s = i(22),
a = i(12).f,
c = 0,
h = Object.isExtensible || function () {
return !0
},
u = !i(3)(function () {
return h(Object.preventExtensions({}))
}),
l = function (e) {
a(e, n, {
value: {
i: "O" + ++c,
w: {}
}
})
},
f = e.exports = {
KEY: n,
NEED: !1,
fastKey: function (e, t) {
if (!o(e)) return "symbol" == r(e) ? e : ("string" == typeof e ? "S" : "P") + e;
if (!s(e, n)) {
if (!h(e)) return "F";
if (!t) return "E";
l(e)
}
return e[n].i
},
getWeak: function (e, t) {
if (!s(e, n)) {
if (!h(e)) return !0;
if (!t) return !1;
l(e)
}
return e[n].w
},
onFreeze: function (e) {
return u && f.NEED && h(e) && !s(e, n) && l(e), e
}
}
}, 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 r() {
this._events = this._events || {}, this._maxListeners = this._maxListeners || void 0
}
function n(e) {
return "function" == typeof e
}
function o(e) {
return "object" === i(e) && null !== e
}
function s(e) {
return void 0 === e
}
e.exports = r, r.EventEmitter = r, r.prototype._events = void 0, r.prototype._maxListeners = void 0, r.defaultMaxListeners = 10, r.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
}, r.prototype.emit = function (e) {
var t, i, r, a, c, h;
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 u = new Error('Uncaught, unspecified "error" event. (' + t + ")");
throw u.context = t, u
}
if (s(i = this._events[e])) return !1;
if (n(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:
a = Array.prototype.slice.call(arguments, 1), i.apply(this, a)
} else if (o(i))
for (a = Array.prototype.slice.call(arguments, 1), r = (h = i.slice()).length, c = 0; c < r; c++) h[c].apply(this, a);
return !0
}, r.prototype.addListener = function (e, t) {
var i;
if (!n(t)) throw TypeError("listener must be a function");
return this._events || (this._events = {}), this._events.newListener && this.emit("newListener", e, n(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 = s(this._maxListeners) ? r.defaultMaxListeners : this._maxListeners) && i > 0 && this._events[e].length > i && (this._events[e].warned = !0, 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
}, r.prototype.on = r.prototype.addListener, r.prototype.once = function (e, t) {
if (!n(t)) throw TypeError("listener must be a function");
var i = !1;
function r() {
this.removeListener(e, r), i || (i = !0, t.apply(this, arguments))
}
return r.listener = t, this.on(e, r), this
}, r.prototype.removeListener = function (e, t) {
var i, r, s, a;
if (!n(t)) throw TypeError("listener must be a function");
if (!this._events || !this._events[e]) return this;
if (s = (i = this._events[e]).length, r = -1, i === t || n(i.listener) && i.listener === t) delete this._events[e], this._events.removeListener && this.emit("removeListener", e, t);
else if (o(i)) {
for (a = s; a-- > 0;)
if (i[a] === t || i[a].listener && i[a].listener === t) {
r = a;
break
} if (r < 0) return this;
1 === i.length ? (i.length = 0, delete this._events[e]) : i.splice(r, 1), this._events.removeListener && this.emit("removeListener", e, t)
}
return this
}, r.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 (n(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
}, r.prototype.listeners = function (e) {
return this._events && this._events[e] ? n(this._events[e]) ? [this._events[e]] : this._events[e].slice() : []
}, r.prototype.listenerCount = function (e) {
if (this._events) {
var t = this._events[e];
if (n(t)) return 1;
if (t) return t.length
}
return 0
}, r.listenerCount = function (e, t) {
return e.listenerCount(t)
}
}, function (e, t, i) {
"use strict";
e.exports = {
Timer: function (e, t) {
var i = t || "",
r = e || 1,
n = [],
o = [],
s = 0,
a = 0,
c = 0,
h = 0,
u = !0;
this.start = function () {
u && (n.length = o.length = 0, u = !1), s = a = performance.now(), c++
}, this.add = function (e) {
var t = performance.now();
o.indexOf(e) < 0 && o.push(e);
var i = o.indexOf(e);
n[i] || (n[i] = 0), n[i] += t - a, a = t
}, this.report = function () {
if (h += performance.now() - s, c === r) {
var e = " total: " + (h / r).toFixed(2) + "ms (avg, " + r + " runs)";
console.log(i + ":", o.map(function (e, t) {
return e + ": " + (n[t] / r).toFixed(2) + "ms "
}).join(""), r > 1 ? e : ""), u = !0, c = 0, h = 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 r = i(2).Buffer,
n = i(127).Transform,
o = i(123).StringDecoder;
function s(e) {
n.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)(s, n), s.prototype.update = function (e, t, i) {
"string" == typeof e && (e = r.from(e, t));
var n = this._update(e);
return this.hashMode ? this : (i && (n = this._toString(n, i)), n)
}, s.prototype.setAutoPadding = function () {}, s.prototype.getAuthTag = function () {
throw new Error("trying to get auth tag in unsupported state")
}, s.prototype.setAuthTag = function () {
throw new Error("trying to set auth tag in unsupported state")
}, s.prototype.setAAD = function () {
throw new Error("trying to set aad in unsupported state")
}, s.prototype._transform = function (e, t, i) {
var r;
try {
this.hashMode ? this._update(e) : this.push(this._update(e))
} catch (e) {
r = e
} finally {
i(r)
}
}, s.prototype._flush = function (e) {
var t;
try {
this.push(this.__final())
} catch (e) {
t = e
}
e(t)
}, s.prototype._finalOrDigest = function (e) {
var t = this.__final() || r.alloc(0);
return e && (t = this._toString(t, e, !0)), t
}, s.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 r = this._decoder.write(e);
return i && (r += this._decoder.end()), r
}, e.exports = s
}, 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,
r = Math.random();
e.exports = function (e) {
return "Symbol(".concat(void 0 === e ? "" : e, ")_", (++i + r).toString(36))
}
}, function (e, t) {
e.exports = !1
}, function (e, t, i) {
var r = i(139),
n = i(99);
e.exports = Object.keys || function (e) {
return r(e, n)
}
}, function (e, t, i) {
var r = i(28),
n = Math.max,
o = Math.min;
e.exports = function (e, t) {
return (e = r(e)) < 0 ? n(e + t, 0) : o(e, t)
}
}, function (e, t, i) {
var r = i(4),
n = i(140),
o = i(99),
s = i(98)("IE_PROTO"),
a = function () {},
c = function () {
var e, t = i(95)("iframe"),
r = o.length;
for (t.style.display = "none", i(101).appendChild(t), t.src = "javascript:", (e = t.contentWindow.document).open(), e.write("<script>document.F=Object<\/script>"), e.close(), c = e.F; r--;) delete c.prototype[o[r]];
return c()
};
e.exports = Object.create || function (e, t) {
var i;
return null !== e ? (a.prototype = r(e), i = new a, a.prototype = null, i[s] = e) : i = c(), void 0 === t ? i : n(i, t)
}
}, function (e, t, i) {
var r = i(139),
n = i(99).concat("length", "prototype");
t.f = Object.getOwnPropertyNames || function (e) {
return r(e, n)
}
}, function (e, t, i) {
var r = i(22),
n = i(20),
o = i(98)("IE_PROTO"),
s = Object.prototype;
e.exports = Object.getPrototypeOf || function (e) {
return e = n(e), r(e, o) ? e[o] : "function" == typeof e.constructor && e instanceof e.constructor ? e.constructor.prototype : e instanceof Object ? s : null
}
}, function (e, t, i) {
e.exports = i(394).Promise
}, function (e, t, i) {
"use strict";
(function (t, r) {
var n = 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 s = new t.Uint8Array(e);
e > 0 && o.getRandomValues(s);
var a = n.from(s.buffer);
if ("function" == typeof i) return r.nextTick(function () {
i(null, a)
});
return a
} : 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 r = i(86),
n = Object.keys || function (e) {
var t = [];
for (var i in e) t.push(i);
return t
};
e.exports = l;
var o = i(68);
o.inherits = i(1);
var s = i(169),
a = i(122);
o.inherits(l, s);
for (var c = n(a.prototype), h = 0; h < c.length; h++) {
var u = c[h];
l.prototype[u] || (l.prototype[u] = a.prototype[u])
}
function l(e) {
if (!(this instanceof l)) return new l(e);
s.call(this, e), a.call(this, e), e && !1 === e.readable && (this.readable = !1), e && !1 === e.writable && (this.writable = !1), this.allowHalfOpen = !0, e && !1 === e.allowHalfOpen && (this.allowHalfOpen = !1), this.once("end", f)
}
function f() {
this.allowHalfOpen || this._writableState.ended || r.nextTick(d, this)
}
function d(e) {
e.end()
}
Object.defineProperty(l.prototype, "writableHighWaterMark", {
enumerable: !1,
get: function () {
return this._writableState.highWaterMark
}
}), Object.defineProperty(l.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)
}
}), l.prototype._destroy = function (e, t) {
this.push(null), this.end(), r.nextTick(t, e)
}
}, function (e, t, i) {
"use strict";
var r = i(94);
function n(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
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, !0 === 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: !1,
spawned: !1
}, 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 = r.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)
}
}]) && n(t.prototype, i), o && n(t, o), e
}();
t.a = o
}, function (e, t, i) {
var r = i(12).f,
n = i(22),
o = i(8)("toStringTag");
e.exports = function (e, t, i) {
e && !n(e = i ? e : e.prototype, o) && r(e, o, {
configurable: !0,
value: t
})
}
}, function (e, t) {
e.exports = {}
}, function (e, t, i) {
var r = i(8)("unscopables"),
n = Array.prototype;
null == n[r] && i(23)(n, r, {}), e.exports = function (e) {
n[r][e] = !0
}
}, function (e, t, i) {
"use strict";
var r = i(5),
n = i(12),
o = i(13),
s = i(8)("species");
e.exports = function (e) {
var t = r[e];
o && t && !t[s] && n.f(t, s, {
configurable: !0,
get: function () {
return this
}
})
}
}, function (e, t) {
e.exports = function (e, t, i, r) {
if (!(e instanceof t) || void 0 !== r && r in e) throw TypeError(i + ": incorrect invocation!");
return e
}
}, function (e, t, i) {
var r = i(19);
e.exports = function (e, t, i) {
for (var n in t) r(e, n, t[n], i);
return e
}
}, function (e, t, i) {
var r = i(6);
e.exports = function (e, t) {
if (!r(e) || e._t !== t) throw TypeError("Incompatible receiver, " + t + " required!");
return e
}
}, function (e, t, i) {
var r = i(2).Buffer;
function n(e, t) {
this._block = r.alloc(e), this._finalSize = t, this._blockSize = e, this._len = 0
}
n.prototype.update = function (e, t) {
"string" == typeof e && (t = t || "utf8", e = r.from(e, t));
for (var i = this._block, n = this._blockSize, o = e.length, s = this._len, a = 0; a < o;) {
for (var c = s % n, h = Math.min(o - a, n - c), u = 0; u < h; u++) i[c + u] = e[a + u];
a += h, (s += h) % n == 0 && this._update(i)
}
return this._len += o, this
}, n.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 r = (4294967295 & i) >>> 0,
n = (i - r) / 4294967296;
this._block.writeUInt32BE(n, this._blockSize - 8), this._block.writeUInt32BE(r, this._blockSize - 4)
}
this._update(this._block);
var o = this._hash();
return e ? o.toString(e) : o
}, n.prototype._update = function () {
throw new Error("_update must be implemented by subclass")
}, e.exports = n
}, function (e, t, i) {
var r = i(36);
e.exports = Object("z").propertyIsEnumerable(0) ? Object : function (e) {
return "String" == r(e) ? e.split("") : Object(e)
}
}, function (e, t) {
t.f = {}.propertyIsEnumerable
}, function (e, t, i) {
var r = i(36),
n = i(8)("toStringTag"),
o = "Arguments" == r(function () {
return arguments
}());
e.exports = function (e) {
var t, i, s;
return void 0 === e ? "Undefined" : null === e ? "Null" : "string" == typeof (i = function (e, t) {
try {
return e[t]
} catch (e) {}
}(t = Object(e), n)) ? i : o ? r(t) : "Object" == (s = r(t)) && "function" == typeof t.callee ? "Arguments" : s
}
}, function (e, t, i) {
var r = i(4),
n = i(35),
o = i(8)("species");
e.exports = function (e, t) {
var i, s = r(e).constructor;
return void 0 === s || null == (i = r(s)[o]) ? t : n(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 r(e) {
return Object.prototype.toString.call(e)
}
t.isArray = function (e) {
return Array.isArray ? Array.isArray(e) : "[object Array]" === r(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]" === r(e)
}, t.isObject = function (e) {
return "object" === i(e) && null !== e
}, t.isDate = function (e) {
return "[object Date]" === r(e)
}, t.isError = function (e) {
return "[object Error]" === r(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 r = i(1),
n = i(126),
o = i(128),
s = i(129),
a = i(43);
function c(e) {
a.call(this, "digest"), this._hash = e
}
r(c, a), 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 n : "rmd160" === e || "ripemd160" === e ? new o : new c(s(e))
}
}, function (e, t, i) {
(function (t) {
e.exports = function (e, i) {
for (var r = Math.min(e.length, i.length), n = new t(r), o = 0; o < r; ++o) n[o] = e[o] ^ i[o];
return n
}
}).call(this, i(9).Buffer)
}, function (e, t, i) {
"use strict";
var r = i(33),
n = 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 = r.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 = r.join32(e, 0, e.length - i, this.endian);
for (var n = 0; n < e.length; n += this._delta32) this._update(e, n, n + this._delta32)
}
return this
}, o.prototype.digest = function (e) {
return this.update(this._pad()), n(null === this.pending), this._digest(e)
}, o.prototype._pad = function () {
var e = this.pendingTotal,
t = this._delta8,
i = t - (e + this.padLength) % t,
r = new Array(i + this.padLength);
r[0] = 128;
for (var n = 1; n < i; n++) r[n] = 0;
if (e <<= 3, "big" === this.endian) {
for (var o = 8; o < this.padLength; o++) r[n++] = 0;
r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = e >>> 24 & 255, r[n++] = e >>> 16 & 255, r[n++] = e >>> 8 & 255, r[n++] = 255 & e
} else
for (r[n++] = 255 & e, r[n++] = e >>> 8 & 255, r[n++] = e >>> 16 & 255, r[n++] = e >>> 24 & 255, r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = 0, o = 8; o < this.padLength; o++) r[n++] = 0;
return r
}
}, function (e, t, i) {
var r = t;
r.bignum = i(11), r.define = i(570).define, r.base = i(73), r.constants = i(219), r.decoders = i(576), r.encoders = i(578)
}, function (e, t, i) {
var r = t;
r.Reporter = i(573).Reporter, r.DecoderBuffer = i(218).DecoderBuffer, r.EncoderBuffer = i(218).EncoderBuffer, r.Node = i(574)
}, function (e, t, i) {
var r = i(24),
n = i(10),
o = i(48);
e.exports = function (e) {
return function (t, i, s) {
var a, c = r(t),
h = n(c.length),
u = o(s, h);
if (e && i != i) {
for (; h > u;)
if ((a = c[u++]) != a) return !0
} else
for (; h > u; u++)
if ((e || u in c) && c[u] === i) return e || u || 0;
return !e && -1
}
}
}, function (e, t) {
t.f = Object.getOwnPropertySymbols
}, function (e, t, i) {
var r = i(0),
n = i(37),
o = i(3),
s = i(103),
a = "[" + s + "]",
c = RegExp("^" + a + a + "*"),
h = RegExp(a + a + "*$"),
u = function (e, t, i) {
var n = {},
a = o(function () {
return !!s[e]() || "​…" != "​…" [e]()
}),
c = n[e] = a ? t(l) : s[e];
i && (n[i] = c), r(r.P + r.F * a, "String", n)
},
l = u.trim = function (e, t) {
return e = String(n(e)), 1 & t && (e = e.replace(c, "")), 2 & t && (e = e.replace(h, "")), e
};
e.exports = u
}, function (e, t, i) {
var r = i(8)("iterator"),
n = !1;
try {
var o = [7][r]();
o.return = function () {
n = !0
}, Array.from(o, function () {
throw 2
})
} catch (e) {}
e.exports = function (e, t) {
if (!t && !n) return !1;
var i = !1;
try {
var o = [7],
s = o[r]();
s.next = function () {
return {
done: i = !0
}
}, o[r] = function () {
return s
}, e(o)
} catch (e) {}
return i
}
}, function (e, t, i) {
"use strict";
var r = i(4);
e.exports = function () {
var e = r(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 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 n = i(66),
o = RegExp.prototype.exec;
e.exports = function (e, t) {
var i = e.exec;
if ("function" == typeof i) {
var s = i.call(e, t);
if ("object" !== r(s)) throw new TypeError("RegExp exec method returned something other than an Object or null");
return s
}
if ("RegExp" !== n(e)) throw new TypeError("RegExp#exec called on incompatible receiver");
return o.call(e, t)
}
}, function (e, t, i) {
"use strict";
i(156);
var r = i(19),
n = i(23),
o = i(3),
s = i(37),
a = i(8),
c = i(118),
h = a("species"),
u = !o(function () {
var e = /./;
return e.exec = function () {
var e = [];
return e.groups = {
a: "7"
}, e
}, "7" !== "".replace(e, "$<a>")
}),
l = 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 = a(e),
d = !o(function () {
var t = {};
return t[f] = function () {
return 7
}, 7 != "" [e](t)
}),
p = d ? !o(function () {
var t = !1,
i = /a/;
return i.exec = function () {
return t = !0, null
}, "split" === e && (i.constructor = {}, i.constructor[h] = function () {
return i
}), i[f](""), !t
}) : void 0;
if (!d || !p || "replace" === e && !u || "split" === e && !l) {
var m = /./ [f],
g = i(s, f, "" [e], function (e, t, i, r, n) {
return t.exec === c ? d && !n ? {
done: !0,
value: m.call(t, i, r)
} : {
done: !0,
value: e.call(i, t, r)
} : {
done: !1
}
}),
_ = g[0],
v = g[1];
r(String.prototype, e, _), n(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 r = i(34),
n = i(152),
o = i(113),
s = i(4),
a = i(10),
c = i(115),
h = {},
u = {};
(t = e.exports = function (e, t, i, l, f) {
var d, p, m, g, _ = f ? function () {
return e
} : c(e),
v = r(i, l, t ? 2 : 1),
y = 0;
if ("function" != typeof _) throw TypeError(e + " is not iterable!");
if (o(_)) {
for (d = a(e.length); d > y; y++)
if ((g = t ? v(s(p = e[y])[0], p[1]) : v(e[y])) === h || g === u) return g
} else
for (m = _.call(e); !(p = m.next()).done;)
if ((g = n(m, v, p.value, t)) === h || g === u) return g
}).BREAK = h, t.RETURN = u
}, function (e, t, i) {
var r = i(5).navigator;
e.exports = r && r.userAgent || ""
}, function (e, t, i) {
"use strict";
var r = i(5),
n = i(0),
o = i(19),
s = i(61),
a = i(40),
c = i(81),
h = i(60),
u = i(6),
l = i(3),
f = i(77),
d = i(56),
p = i(104);
e.exports = function (e, t, i, m, g, _) {
var v = r[e],
y = v,
b = g ? "set" : "add",
x = y && y.prototype,
w = {},
S = function (e) {
var t = x[e];
o(x, e, "delete" == e ? function (e) {
return !(_ && !u(e)) && t.call(this, 0 === e ? 0 : e)
} : "has" == e ? function (e) {
return !(_ && !u(e)) && t.call(this, 0 === e ? 0 : e)
} : "get" == e ? function (e) {
return _ && !u(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 && (_ || x.forEach && !l(function () {
(new y).entries().next()
}))) {
var T = new y,
A = T[b](_ ? {} : -0, 1) != T,
M = l(function () {
T.has(1)
}),
E = f(function (e) {
new y(e)
}),
P = !_ && l(function () {
for (var e = new y, t = 5; t--;) e[b](t, t);
return !e.has(-0)
});
E || ((y = t(function (t, i) {
h(t, y, e);
var r = p(new v, t, y);
return null != i && c(i, g, r[b], r), r
})).prototype = x, x.constructor = y), (M || P) && (S("delete"), S("has"), g && S("get")), (P || A) && S(b), _ && x.clear && delete x.clear
} else y = m.getConstructor(t, e, g, b), s(y.prototype, i), a.NEED = !0;
return d(y, e), w[e] = y, n(n.G + n.W + n.F * (y != v), w), _ || m.setStrong(y, e, g), y
}
}, function (e, t, i) {
for (var r, n = i(5), o = i(23), s = i(45), a = s("typed_array"), c = s("view"), h = !(!n.ArrayBuffer || !n.DataView), u = h, l = 0, f = "Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(","); l < 9;)(r = n[f[l++]]) ? (o(r.prototype, a, !0), o(r.prototype, c, !0)) : u = !1;
e.exports = {
ABV: h,
CONSTR: u,
TYPED: a,
VIEW: c
}
}, function (e, t, i) {
(t = e.exports = i(169)).Stream = t, t.Readable = t, t.Writable = i(122), t.Duplex = i(54), t.Transform = i(172), t.PassThrough = i(409)
}, 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, r, n) {
if ("function" != typeof e) throw new TypeError('"callback" argument must be a function');
var o, s, a = arguments.length;
switch (a) {
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, r)
});
case 4:
return t.nextTick(function () {
e.call(null, i, r, n)
});
default:
for (o = new Array(a - 1), s = 0; s < o.length;) o[s++] = arguments[s];
return t.nextTick(function () {
e.apply(null, o)
})
}
}
} : e.exports = t
}).call(this, i(27))
}, function (e, t, i) {
e.exports = n;
var r = i(16);
function n(e, t) {
if (!(this instanceof n)) return new n(e, t);
var i = r.create();
r.add(i, e, t), this.base = r.min(r.create(), e, i), this.vec = r.clone(t), this.max = r.max(r.create(), e, i), this.mag = r.length(this.vec)
}
var o = n.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 r.add(this.max, this.max, e), r.add(this.base, this.base, e), this
}, o.setPosition = function (e) {
return r.add(this.max, e, this.vec), r.copy(this.base, e), this
}, o.expand = function (e) {
var t = r.create(),
i = r.create();
return r.max(t, e.max, this.max), r.min(i, e.base, this.base), r.subtract(t, t, i), new n(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]),
r = Math.max(e.base[2], this.base[2]);
return new n([t, i, r], [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]) - r])
}
}, function (e, t, i) {
var r = i(185),
n = i(445),
o = "undefined" != typeof Float64Array;
function s(e, t) {
return e[0] - t[0]
}
function a() {
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(s);
var r = new Array(i.length);
for (e = 0; e < r.length; ++e) r[e] = i[e][1];
return r
}
function c(e, t) {
var i = ["View", t, "d", e].join("");
t < 0 && (i = "View_Nil" + e);
var n = "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 " + (n ? "this.data.get(this.offset)" : "this.data[this.offset]") + "};proto.set=function " + i + "_set(v){return " + (n ? "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)(h[e][0])
}
o = ["'use strict'"];
var s = r(t),
c = s.map(function (e) {
return "i" + e
}),
u = "this.offset+" + s.map(function (e) {
return "this.stride[" + e + "]*i" + e
}).join("+"),
l = s.map(function (e) {
return "b" + e
}).join(","),
f = s.map(function (e) {
return "c" + e
}).join(",");
o.push("function " + i + "(a," + l + "," + f + ",d){this.data=a", "this.shape=[" + l + "]", "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 " + s.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){"), n ? o.push("return this.data.set(" + u + ",v)}") : o.push("return this.data[" + u + "]=v}"), o.push("proto.get=function " + i + "_get(" + c.join(",") + "){"), n ? o.push("return this.data.get(" + u + ")}") : o.push("return this.data[" + u + "]}"), o.push("proto.index=function " + i + "_index(", c.join(), "){return " + u + "}"), o.push("proto.hi=function " + i + "_hi(" + c.join(",") + "){return new " + i + "(this.data," + s.map(function (e) {
return ["(typeof i", e, "!=='number'||i", e, "<0)?this.shape[", e, "]:i", e, "|0"].join("")
}).join(",") + "," + s.map(function (e) {
return "this.stride[" + e + "]"
}).join(",") + ",this.offset)}");
var d = s.map(function (e) {
return "a" + e + "=this.shape[" + e + "]"
}),
p = s.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," + s.map(function (e) {
return "a" + e
}).join(",") + "," + s.map(function (e) {
return "c" + e
}).join(",") + ",b)}"), o.push("proto.step=function " + i + "_step(" + c.join(",") + "){var " + s.map(function (e) {
return "a" + e + "=this.shape[" + e + "]"
}).join(",") + "," + s.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," + s.map(function (e) {
return "a" + e
}).join(",") + "," + s.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," + s.map(function (e) {
return "shape[" + e + "]"
}).join(",") + "," + s.map(function (e) {
return "stride[" + e + "]"
}).join(",") + ",offset)}"), new Function("CTOR_LIST", "ORDER", o.join("\n"))(h[e], a)
}
var h = {
float32: [],
float64: [],
int8: [],
int16: [],
int32: [],
uint8: [],
uint16: [],
uint32: [],
array: [],
uint8_clamped: [],
buffer: [],
generic: []
};
e.exports = function (e, t, i, r) {
if (void 0 === e) return (0, h.array[0])([]);
"number" == typeof e && (e = [e]), void 0 === t && (t = [e.length]);
var s = t.length;
if (void 0 === i) {
i = new Array(s);
for (var a = s - 1, u = 1; a >= 0; --a) i[a] = u, u *= t[a]
}
if (void 0 === r)
for (r = 0, a = 0; a < s; ++a) i[a] < 0 && (r -= (t[a] - 1) * i[a]);
for (var l = function (e) {
if (n(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 = h[l]; f.length <= s + 1;) f.push(c(l, f.length - 1));
return (0, f[s + 1])(e, t, i, r)
}
}, function (e, t, i) {
var r = i(2).Buffer;
function n(e) {
r.isBuffer(e) || (e = r.from(e));
for (var t = e.length / 4 | 0, i = new Array(t), n = 0; n < t; n++) i[n] = e.readUInt32BE(4 * n);
return i
}
function o(e) {
for (; 0 < e.length; e++) e[0] = 0
}
function s(e, t, i, r, n) {
for (var o, s, a, c, h = i[0], u = i[1], l = 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 < n; v++) o = h[d >>> 24] ^ u[p >>> 16 & 255] ^ l[m >>> 8 & 255] ^ f[255 & g] ^ t[_++], s = h[p >>> 24] ^ u[m >>> 16 & 255] ^ l[g >>> 8 & 255] ^ f[255 & d] ^ t[_++], a = h[m >>> 24] ^ u[g >>> 16 & 255] ^ l[d >>> 8 & 255] ^ f[255 & p] ^ t[_++], c = h[g >>> 24] ^ u[d >>> 16 & 255] ^ l[p >>> 8 & 255] ^ f[255 & m] ^ t[_++], d = o, p = s, m = a, g = c;
return o = (r[d >>> 24] << 24 | r[p >>> 16 & 255] << 16 | r[m >>> 8 & 255] << 8 | r[255 & g]) ^ t[_++], s = (r[p >>> 24] << 24 | r[m >>> 16 & 255] << 16 | r[g >>> 8 & 255] << 8 | r[255 & d]) ^ t[_++], a = (r[m >>> 24] << 24 | r[g >>> 16 & 255] << 16 | r[d >>> 8 & 255] << 8 | r[255 & p]) ^ t[_++], c = (r[g >>> 24] << 24 | r[d >>> 16 & 255] << 16 | r[p >>> 8 & 255] << 8 | r[255 & m]) ^ t[_++], [o >>>= 0, s >>>= 0, a >>>= 0, c >>>= 0]
}
var a = [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 = [], r = [], n = [
[],
[],
[],
[]
], o = [
[],
[],
[],
[]
], s = 0, a = 0, c = 0; c < 256; ++c) {
var h = a ^ a << 1 ^ a << 2 ^ a << 3 ^ a << 4;
h = h >>> 8 ^ 255 & h ^ 99, i[s] = h, r[h] = s;
var u = e[s],
l = e[u],
f = e[l],
d = 257 * e[h] ^ 16843008 * h;
n[0][s] = d << 24 | d >>> 8, n[1][s] = d << 16 | d >>> 16, n[2][s] = d << 8 | d >>> 24, n[3][s] = d, d = 16843009 * f ^ 65537 * l ^ 257 * u ^ 16843008 * s, o[0][h] = d << 24 | d >>> 8, o[1][h] = d << 16 | d >>> 16, o[2][h] = d << 8 | d >>> 24, o[3][h] = d, 0 === s ? s = a = 1 : (s = u ^ e[e[e[f ^ u]]], a ^= e[e[a]])
}
return {
SBOX: i,
INV_SBOX: r,
SUB_MIX: n,
INV_SUB_MIX: o
}
}();
function h(e) {
this._key = n(e), this._reset()
}
h.blockSize = 16, h.keySize = 32, h.prototype.blockSize = h.blockSize, h.prototype.keySize = h.keySize, h.prototype._reset = function () {
for (var e = this._key, t = e.length, i = t + 6, r = 4 * (i + 1), n = [], o = 0; o < t; o++) n[o] = e[o];
for (o = t; o < r; o++) {
var s = n[o - 1];
o % t == 0 ? (s = s << 8 | s >>> 24, s = c.SBOX[s >>> 24] << 24 | c.SBOX[s >>> 16 & 255] << 16 | c.SBOX[s >>> 8 & 255] << 8 | c.SBOX[255 & s], s ^= a[o / t | 0] << 24) : t > 6 && o % t == 4 && (s = c.SBOX[s >>> 24] << 24 | c.SBOX[s >>> 16 & 255] << 16 | c.SBOX[s >>> 8 & 255] << 8 | c.SBOX[255 & s]), n[o] = n[o - t] ^ s
}
for (var h = [], u = 0; u < r; u++) {
var l = r - u,
f = n[l - (u % 4 ? 0 : 4)];
h[u] = u < 4 || l <= 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 = n, this._invKeySchedule = h
}, h.prototype.encryptBlockRaw = function (e) {
return s(e = n(e), this._keySchedule, c.SUB_MIX, c.SBOX, this._nRounds)
}, h.prototype.encryptBlock = function (e) {
var t = this.encryptBlockRaw(e),
i = r.allocUnsafe(16);
return i.writeUInt32BE(t[0], 0), i.writeUInt32BE(t[1], 4), i.writeUInt32BE(t[2], 8), i.writeUInt32BE(t[3], 12), i
}, h.prototype.decryptBlock = function (e) {
var t = (e = n(e))[1];
e[1] = e[3], e[3] = t;
var i = s(e, this._invKeySchedule, c.INV_SUB_MIX, c.INV_SBOX, this._nRounds),
o = r.allocUnsafe(16);
return o.writeUInt32BE(i[0], 0), o.writeUInt32BE(i[3], 4), o.writeUInt32BE(i[2], 8), o.writeUInt32BE(i[1], 12), o
}, h.prototype.scrub = function () {
o(this._keySchedule), o(this._invKeySchedule), o(this._key)
}, e.exports.AES = h
}, function (e, t, i) {
var r = i(2).Buffer,
n = i(126);
e.exports = function (e, t, i, o) {
if (r.isBuffer(e) || (e = r.from(e, "binary")), t && (r.isBuffer(t) || (t = r.from(t, "binary")), 8 !== t.length)) throw new RangeError("salt should be Buffer with 8 byte length");
for (var s = i / 8, a = r.alloc(s), c = r.alloc(o || 0), h = r.alloc(0); s > 0 || o > 0;) {
var u = new n;
u.update(h), u.update(e), t && u.update(t), h = u.digest();
var l = 0;
if (s > 0) {
var f = a.length - s;
l = Math.min(s, h.length), h.copy(a, f, 0, l), s -= l
}
if (l < h.length && o > 0) {
var d = c.length - o,
p = Math.min(o, h.length - l);
h.copy(c, d, l, l + p), o -= p
}
}
return h.fill(0), {
key: a,
iv: c
}
}
}, function (e, t, i) {
"use strict";
var r = t;
r.base = i(550), r.short = i(551), r.mont = i(552), r.edwards = i(553)
}, function (e, t, i) {
(function (t) {
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 n = i(569),
o = i(581),
s = i(582),
a = i(131),
c = i(202);
function h(e) {
var i;
"object" !== r(e) || t.isBuffer(e) || (i = e.passphrase, e = e.key), "string" == typeof e && (e = new t(e));
var h, u, l = s(e, i),
f = l.tag,
d = l.data;
switch (f) {
case "CERTIFICATE":
u = n.certificate.decode(d, "der").tbsCertificate.subjectPublicKeyInfo;
case "PUBLIC KEY":
switch (u || (u = n.PublicKey.decode(d, "der")), h = u.algorithm.algorithm.join(".")) {
case "1.2.840.113549.1.1.1":
return n.RSAPublicKey.decode(u.subjectPublicKey.data, "der");
case "1.2.840.10045.2.1":
return u.subjectPrivateKey = u.subjectPublicKey, {
type: "ec",
data: u
};
case "1.2.840.10040.4.1":
return u.algorithm.params.pub_key = n.DSAparam.decode(u.subjectPublicKey.data, "der"), {
type: "dsa",
data: u.algorithm.params
};
default:
throw new Error("unknown key id " + h)
}
throw new Error("unknown key type " + f);
case "ENCRYPTED PRIVATE KEY":
d = function (e, i) {
var r = e.algorithm.decrypt.kde.kdeparams.salt,
n = parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(), 10),
s = o[e.algorithm.decrypt.cipher.algo.join(".")],
h = e.algorithm.decrypt.cipher.iv,
u = e.subjectPrivateKey,
l = parseInt(s.split("-")[1], 10) / 8,
f = c.pbkdf2Sync(i, r, n, l),
d = a.createDecipheriv(s, f, h),
p = [];
return p.push(d.update(u)), p.push(d.final()), t.concat(p)
}(d = n.EncryptedPrivateKey.decode(d, "der"), i);
case "PRIVATE KEY":
switch (h = (u = n.PrivateKey.decode(d, "der")).algorithm.algorithm.join(".")) {
case "1.2.840.113549.1.1.1":
return n.RSAPrivateKey.decode(u.subjectPrivateKey, "der");
case "1.2.840.10045.2.1":
return {
curve: u.algorithm.curve, privateKey: n.ECPrivateKey.decode(u.subjectPrivateKey, "der").privateKey
};
case "1.2.840.10040.4.1":
return u.algorithm.params.priv_key = n.DSAparam.decode(u.subjectPrivateKey, "der"), {
type: "dsa",
params: u.algorithm.params
};
default:
throw new Error("unknown key id " + h)
}
throw new Error("unknown key type " + f);
case "RSA PUBLIC KEY":
return n.RSAPublicKey.decode(d, "der");
case "RSA PRIVATE KEY":
return n.RSAPrivateKey.decode(d, "der");
case "DSA PRIVATE KEY":
return {
type: "dsa", params: n.DSAPrivateKey.decode(d, "der")
};
case "EC PRIVATE KEY":
return {
curve: (d = n.ECPrivateKey.decode(d, "der")).parameters.value, privateKey: d.privateKey
};
default:
throw new Error("unknown key type " + f)
}
}
e.exports = h, h.signature = n.signature
}).call(this, i(9).Buffer)
}, function (e, t, i) {
(function (t, r) {
function n(e, i, r, n, o, s, a) {
try {
var c = e[s](a),
h = c.value
} catch (e) {
return void r(e)
}
c.done ? i(h) : t.resolve(h).then(n, 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 s = i(399)("simple-peer"),
a = i(402),
c = i(1),
h = i(53),
u = i(85),
l = 5e3;
function f(e) {
var i, r, n = this;
if (!(n instanceof f)) return new f(e);
if (n._id = h(4).toString("hex").slice(0, 7), n._debug("new peer %o", e), e = Object.assign({
allowHalfOpen: !1
}, e), u.Duplex.call(n, e), n.channelName = e.initiator ? e.channelName || h(20).toString("hex") : null, n._isChromium = "undefined" != typeof window && !!window.webkitRTCPeerConnection, n.initiator = e.initiator || !1, n.channelConfig = e.channelConfig || f.channelConfig, n.config = Object.assign({}, f.config, e.config), n.constraints = n._transformConstraints(e.constraints || f.constraints), n.offerConstraints = n._transformConstraints(e.offerConstraints || {}), n.answerConstraints = n._transformConstraints(e.answerConstraints || {}), n.sdpTransform = e.sdpTransform || function (e) {
return e
}, n.streams = e.streams || (e.stream ? [e.stream] : []), n.trickle = void 0 === e.trickle || e.trickle, n.allowHalfTrickle = void 0 !== e.allowHalfTrickle && e.allowHalfTrickle, n.iceCompleteTimeout = e.iceCompleteTimeout || l, n.destroyed = !1, n.connected = !1, n.remoteAddress = void 0, n.remoteFamily = void 0, n.remotePort = void 0, n.localAddress = void 0, n.localPort = void 0, n._wrtc = e.wrtc && "object" === o(e.wrtc) ? e.wrtc : a(), !n._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");
n._pcReady = !1, n._channelReady = !1, n._iceComplete = !1, n._iceCompleteTimer = null, n._channel = null, n._pendingCandidates = [], n._isNegotiating = !n.initiator, n._batchedNegotiation = !1, n._queuedNegotiation = !1, n._sendersAwaitingStable = [], n._senderMap = new Map, n._firstStable = !0, n._closingInterval = null, n._remoteTracks = [], n._remoteStreams = [], n._chunk = null, n._cb = null, n._interval = null, n._pc = new n._wrtc.RTCPeerConnection(n.config, n.constraints), (n._isChromium || n._wrtc && n._wrtc.electronDaemon) && (i = n._wrtc.RTCPeerConnection, (r = n._pc).createOffer = function (e) {
var r = this;
return new t(function (t, n) {
i.prototype.createOffer.call(r, t, n, e)
})
}, r.createAnswer = function (e) {
var r = this;
return new t(function (t, n) {
i.prototype.createAnswer.call(r, t, n, e)
})
}, r.setLocalDescription = function (e) {
var r = this;
return new t(function (t, n) {
i.prototype.setLocalDescription.call(r, e, t, n)
})
}, r.setRemoteDescription = function (e) {
var r = this;
return new t(function (t, n) {
i.prototype.setRemoteDescription.call(r, e, t, n)
})
}), n._isReactNativeWebrtc = "number" == typeof n._pc._peerConnectionId, n._pc.oniceconnectionstatechange = function () {
n._onIceStateChange()
}, n._pc.onicegatheringstatechange = function () {
n._onIceStateChange()
}, n._pc.onsignalingstatechange = function () {
n._onSignalingStateChange()
}, n._pc.onicecandidate = function (e) {
n._onIceCandidate(e)
}, n.initiator ? n._setupData({
channel: n._pc.createDataChannel(n.channelName, n.channelConfig)
}) : n._pc.ondatachannel = function (e) {
n._setupData(e)
}, "addTrack" in n._pc && (n.streams && n.streams.forEach(function (e) {
n.addStream(e)
}), n._pc.ontrack = function (e) {
n._onTrack(e)
}), n.initiator && n._needsNegotiation(), n._onFinishBound = function () {
n._onFinish()
}, n.once("finish", n._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, u.Duplex), f.WEBRTC_SUPPORT = !!a(), 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),
r = this._senderMap.get(e) || new Map;
r.set(t, i), this._senderMap.set(e, r), this._needsNegotiation()
}, f.prototype.replaceTrack = function () {
var e, i = (e = regeneratorRuntime.mark(function e(t, i, r) {
var n, o, s;
return regeneratorRuntime.wrap(function (e) {
for (;;) switch (e.prev = e.next) {
case 0:
if ((n = this)._debug("replaceTrack()"), o = n._senderMap.get(t), (s = o ? o.get(r) : null) || n.destroy(new Error("Cannot replace track that was never added.")), i && n._senderMap.set(i, o), null == s.replaceTrack) {
e.next = 11;
break
}
return e.next = 9, s.replaceTrack(i);
case 9:
e.next = 12;
break;
case 11:
n.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,
r = arguments;
return new t(function (t, o) {
var s = e.apply(i, r);
function a(e) {
n(s, t, o, a, c, "next", e)
}
function c(e) {
n(s, t, o, a, c, "throw", e)
}
a(void 0)
})
});
return function (e, t, r) {
return i.apply(this, arguments)
}
}(), f.prototype.removeTrack = function (e, t) {
this._debug("removeSender()");
var i = this._senderMap.get(e),
r = i ? i.get(t) : null;
r || this.destroy(new Error("Cannot remove track that was never added."));
try {
this._pc.removeTrack(r)
} catch (e) {
"NS_ERROR_UNEXPECTED" === e.name ? this._sendersAwaitingStable.push(r) : 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 = !0, setTimeout(function () {
e._batchedNegotiation = !1, e._debug("starting batched negotiation"), e.negotiate()
}, 0))
}, f.prototype.negotiate = function () {
this.initiator ? this._isNegotiating ? (this._queuedNegotiation = !0, this._debug("already negotiating, queueing")) : (this._debug("start negotiation"), this._createOffer()) : this._isNegotiating || (this._debug("requesting negotiation from initiator"), this.emit("signal", {
renegotiate: !0
})), this._isNegotiating = !0
}, 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 = !1, this._readableState.ended || this.push(null), this._writableState.finished || this.end(), this.destroyed = !0, this.connected = !1, this._pcReady = !1, this._channelReady = !1, 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 = !1;
t._closingInterval = setInterval(function () {
t._channel && "closing" === t._channel.readyState ? (i && t._onChannelClose(), i = !0) : i = !1
}, 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 () {
s("started iceComplete timeout");
var e = this;
e.destroyed || e._iceCompleteTimer || (e._iceCompleteTimer = setTimeout(function () {
e._iceComplete || (e._iceComplete = !0, 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 = !0, 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 r = [];
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, r.push(t)
}), e(null, r)
}
}, 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 = !0, function t() {
e.destroyed || e.getStats(function (i, r) {
if (!e.destroyed) {
i && (r = []);
var n = {},
o = {},
s = {},
a = !1;
if (r.forEach(function (e) {
"remotecandidate" !== e.type && "remote-candidate" !== e.type || (n[e.id] = e), "localcandidate" !== e.type && "local-candidate" !== e.type || (o[e.id] = e), "candidatepair" !== e.type && "candidate-pair" !== e.type || (s[e.id] = e)
}), r.forEach(function (e) {
"transport" === e.type && e.selectedCandidatePairId && h(s[e.selectedCandidatePairId]), ("googCandidatePair" === e.type && "true" === e.googActiveConnection || ("candidatepair" === e.type || "candidate-pair" === e.type) && e.selected) && h(e)
}), a || Object.keys(s).length && !Object.keys(o).length) {
if (e._connecting = !1, e.connected = !0, 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 h(t) {
a = !0;
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 r = n[t.remoteCandidateId];
r && r.ip ? (e.remoteAddress = r.ip, e.remotePort = Number(r.port)) : r && r.ipAddress ? (e.remoteAddress = r.ipAddress, e.remotePort = Number(r.portNumber)) : "string" == typeof t.googRemoteAddress && (r = t.googRemoteAddress.split(":"), e.remoteAddress = r[0], e.remotePort = Number(r[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 = !1, e._debug("flushing sender queue", e._sendersAwaitingStable), e._sendersAwaitingStable.forEach(function (t) {
e._pc.removeTrack(t), e._queuedNegotiation = !0
}), e._sendersAwaitingStable = [], e._queuedNegotiation && (e._debug("flushing negotiation queue"), e._queuedNegotiation = !1, e._needsNegotiation()), e._debug("negotiate"), e.emit("negotiate")), e._firstStable = !1, 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 = !0, this.emit("_iceComplete")), e.candidate && this._startIceCompleteTimeout())
}, f.prototype._onChannelMessage = function (e) {
if (!this.destroyed) {
var t = e.data;
t instanceof ArrayBuffer && (t = r.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 = !0, 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], s.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(52), i(9).Buffer)
}, function (e, t, i) {
"use strict";
var r = i(7);
function n(e) {
var t = 2,
i = 256,
r = 10,
n = document.createElement("canvas");
n.width = window.innerWidth - 16, n.height = i * t;
var o = n.getContext("2d");
o.imageSmoothingEnabled = !1;
var s = document.getElementById("chat");
s.appendChild(n), s.style.width = n.width + "px", s.style.height = i * t + "px";
var a = "",
c = 0,
u = [],
l = 0,
f = {
player: null,
isOpen: !1,
open: function () {
r = 20, c = performance.now(), f.isOpen = !0, i = 512, f.resize(), document.addEventListener("keypress", f.keypress, !1), document.addEventListener("keydown", f.keydown, !1), document.exitPointerLock(), e.inputs.state.active = !1
},
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), r = 10, f.isOpen = !1, i = 256, f.resize(), e.inputs.state.active = !0
},
sendMessage: function (e) {
if (0 == e.indexOf("/")) {
var t = 'Unknown command. Type "/help" for help.';
if (0 == e.indexOf("/ban") && (t = "Command disabled."), 0 == e.indexOf("/banip") && (t = "Command disabled."), 0 == e.indexOf("/say") && (t = "Command disabled."), 0 == e.indexOf("/deop") && (t = "Command disabled."), 0 == e.indexOf("/kick")) {
var i = e.substr(e.indexOf("kick") + 5).trim();
t = h.getInstance().kickPlayer(i)
}
if (0 == e.indexOf("/op") && (t = "Command disabled."), 0 == e.indexOf("/tp")) {
var r = e.substr(e.indexOf("tp") + 3).trim();
t = h.getInstance().teleportToPlayer(r)
}
return 0 == e.indexOf("/unban") && (t = "Command disabled."), 0 == e.indexOf("/setspawn") && (t = h.getInstance().setSpawn()), 0 == e.indexOf("/solid") && (t = "Command disabled."), 0 == e.indexOf("/list") && (t = JSON.stringify(h.getInstance().getPlayerNames()).slice(1, -1)), 0 == e.indexOf("/help") && (t = "Available Commands: /list /kick /tp /setspawn /help"), u.push({
type: "local",
message: t,
from: "",
timestamp: (new Date).getTime()
}), void(u.length > 20 && u.shift())
}
null != f.player && f.player.sendMessage(e)
},
keydown: function (e) {
if (e.shiftKey && 55 == e.keyCode && (e.preventDefault(), f.keypress(e)), 13 == e.keyCode) {
var t = a.trim();
return t.length > 0 && f.sendMessage(t), a = "", void f.redraw()
}
8 == e.keyCode && a.length > 0 && (a = a.substring(0, a.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 && a.length < 64 - (i + 2) && (a += t), f.redraw()
}
},
update: function (e) {
for (u = function (e) {
for (var t = e.concat(), i = 0; i < t.length; ++i)
for (var r = i + 1; r < t.length; ++r) JSON.stringify(t[i]) === JSON.stringify(t[r]) && t.splice(r--, 1);
return t
}(u.concat(e)); u.length > 20;) u.shift();
f.redraw()
},
tick: function () {
var e = (new Date).getTime();
if (!(e < l + 1e3)) {
for (var t = !1, i = 0; i < u.length; i++) {
u[i].timestamp + 1e4 < e && (u[i].isOld = !0, t = !0)
}
t && f.redraw(), l = e
}
},
redraw: function () {
o.clearRect(0, 0, n.width, i * t), o.font = 14 * t + "px Minecraft, sans-serif", o.textBaseline = "alphabetic", o.textAlign = "left";
var e = 4 * t,
s = 2 * t;
if (f.isOpen) {
o.fillStyle = "rgba(0,0,0,0.6)", o.fillRect(0, i * t - 25 * t, n.width, i * t);
var c = i * t - 7 * t;
o.fillStyle = "rgb(63,63,63)", o.fillText("> " + a, e + s, c + s), o.fillStyle = "rgb(255,255,255)", o.fillText("> " + a, e, c)
}
e = 0;
for (var h = 1, l = u.length - 1; l >= 0; l--)
if (!u[l].isOld || f.isOpen) {
if (h > r) break;
var d = "",
p = "rgb(255,255,255)";
switch (u[l].type) {
case "message":
d = u[l].from + ": " + u[l].message;
break;
case "left":
d = u[l].from + " left the game", p = "rgb(255,255,64)";
break;
case "joined":
d = u[l].from + " joined the game", p = "rgb(255,255,64)";
break;
case "local":
d = u[l].message, p = "rgb(255,255,64)"
}
var m = i * t - 25 * t - 15 * h++ * t;
o.fillStyle = "rgb(63,63,63)", o.fillText(d, e + s, m + s), o.fillStyle = p, o.fillText(d, e, m)
}
},
resize: function () {
t = 2, window.innerHeight < 600 && (t = 1), n.width = window.innerWidth - 16, n.height = i * t, s.style.width = n.width + "px", s.style.height = i * t + "px", o.imageSmoothingEnabled = !1, f.redraw()
}
};
return f.resize(), f
}
var o = function (e) {
return n(e)
};
function s(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 a(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
window.BABYLON = i(410);
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, n, c;
return t = e, c = [{
key: "getInstance",
value: function () {
return void 0 === e.instance && (e.instance = new e), e.instance
}
}], (n = [{
key: "initialize",
value: function (e) {
var t = this;
this.playerSpawned = !1, this.worldGenerated = !1, this.worldInitialized = !1, this.client = null, this.network = e.network;
var n = i(411),
a = i(494);
this.soundPlayer = i(496)();
var c, h = i(498),
u = i(499),
l = i(500),
f = i(501),
d = i(502),
p = i(194),
m = h(),
g = 32,
_ = 128,
v = 30,
y = null,
b = !1,
x = !1,
w = this;
if (Math.round(e.seed) == e.seed) {
this.player = void 0 !== e.player ? e.player : null;
var S = new URLSearchParams(window.location.search),
T = S.get("size");
if ("small" == T && (_ = 128), "normal" == T && (_ = 256), "huge" == T && (_ = 512), r.default.getInstance().gameSaved() ? _ = r.default.getInstance().getWorldSize() : r.default.getInstance().setWorldSize(_), "undefined" != typeof Worker) {
if (void 0 === A) {
var A = new Worker("assets/js/RandomLevelWorker.js");
A.postMessage({
worldSize: _,
seed: e.seed
}), m.show()
}
A.onmessage = function (e) {
var t = e.data;
m.task = t.string, m.percent = t.percent, m.tick(), null != t.tiles && (y = t.tiles, w.worldGenerated = !0, null == w.client ? r.default.getInstance().gameSaved() ? (w.syncSavedWorld(), xe()) : xe() : w.client && (w.hostInfo ? w.hostInfo.numberOfChangedBlocks <= 0 ? xe() : w.client.broadcast({
type: "requestChanges",
from: w.client.state.changedBlocks.length
}) : xe()))
}
} else console.log("No worker support.");
var M = .5 * _,
E = 8e3,
P = 24e3,
C = 8e3,
R = 24e3,
I = 3e3,
D = 12e3,
O = {
chunkSize: g,
chunkAddDistance: 7,
chunkRemoveDistance: 8,
blockTestDistance: 6,
playerStart: [M + .5, 48, M + .5],
playerHeight: 1.8,
texturePath: "assets/textures/",
useAO: !1,
stickyPointerLock: !0
};
this.lightDepths = new Array(_);
for (var L = 0; L < _; L++) this.lightDepths[L] = new Array(_);
var F = {
music: !1,
sound: !0,
invert: !1,
fps: !1,
drawDistance: 0,
forward: "W",
left: "A",
backward: "S",
right: "D",
jump: "<space>",
build: "B",
chat: "T",
fog: "F",
saveLoc: "<enter>",
loadLoc: "R",
username: ""
},
B = JSON.parse(localStorage.getItem("settings"));
null == B || B.back || (F = B);
var k = {
forward: F.forward,
left: F.left,
backward: F.backward,
right: F.right,
fire: "<mouse 1>",
"mid-fire": "<mouse 2>",
"alt-fire": "<mouse 3>",
jump: F.jump,
build: F.build,
chat: F.chat,
fog: F.fog,
saveLoc: F.saveLoc,
loadLoc: F.loadLoc,
spawnSteve: "G"
};
O.bindings = k, O.settings = F, this.soundPlayer.musicOn = F.music, this.soundPlayer.soundOn = F.sound;
var V = n(O);
V.setPaused(!0), V.worldSize = _, V.worldHeight = 64, V.waterLevel = v, V.time = 0, V.rendering._camera.minZ = .1, V.rendering._camera.fov = 70 * Math.PI / 180, V.rendering._scene.fogColor = new BABYLON.Color3(.9, .95, 1), V.rendering._scene.fogMode = BABYLON.Scene.FOGMODE_EXP2, V.rendering._scene.fogDensity = .002, V.rendering._scene.clearColor = V.rendering._scene.fogColor, this.hostInfo ? V.hostInfo = this.hostInfo : V.hostInfo = {
maxPlayers: this.player.network.maxPlayers
};
var N = u(V),
z = l(N),
U = f(V, e.singlePlayer),
G = p(V);
this.addParticles = a(V);
var W = N.currentId - 1;
V.on("tick", function (e) {
if (V.time += e, null != w.player && null == c.player && (c.player = w.player), c && c.tick(), G && G.isOpen && G.tick(), H && (H.material.diffuseTexture.uOffset = 2e-7 * V.time), w.steveArray)
for (var t = 0; t < w.steveArray.length; t++) {
var i = w.steveArray[t];
if (i.tick(e), i.state.shouldRemove) i.remove(), w.steveArray.splice(t, 1)[0] = null
}! function () {
if (V.time > le + ue) {
var e = fe.slice();
fe.length = 0;
for (var t = 0; t < e.length; t++) {
var i, r = e[t];
(i = r).func.apply(i, s(r.args))
}
le = V.time
}
if (V.time > me + pe) {
var e = ge.slice();
ge.length = 0;
for (var t = 0; t < e.length; t++) {
var n, r = e[t];
(n = r).func.apply(n, s(r.args))
}
me = V.time
}
}()
}), this.getBrightness = function (e, t, i) {
return e < 0 || t < 0 || i < 0 || e >= _ - 1 || i >= _ - 1 ? t >= v ? 1 : .6 : t >= w.lightDepths[e][i] + 1 ? 1 : .6
}, V.getBrightness = this.getBrightness, this.addBlockCheckLit = function (e, t, i) {
var r = this.lightDepths[e][i];
if (t >= r) {
if (Math.floor(t / g) != Math.floor(r / g)) {
var n = V.world.getBlockID(e, r, i);
V.world.setBlockID(0, e, r, i), V.world.setBlockID(n, e, r, i)
}
this.lightDepths[e][i] = t
}
}, this.removeBlockCheckLit = function (e, t, i) {
var r = this.lightDepths[e][i];
if (t >= r) {
for (var n = 0, o = t;
(0 == n || n == this.redflowerID || n == this.yellowflowerID || n == this.bushID || n == this.redmushroomID || n == this.brownmushroomID || n == this.glassID || n == this.leafID || n == this.emptySpongeID) && o >= 0;) o -= 1, n = V.world.getBlockID(e, o, i);
return Math.floor(o / g) != Math.floor(r / g) && (V.world.setBlockID(0, e, o, i), V.world.setBlockID(n, e, o, i)), this.lightDepths[e][i] = o, 1
}
return .6
};
var j = function e() {
var t = !1;
if (w.hostInfo && null != w.hostInfo.spawnPoint && null != w.hostInfo.spawnPoint && (t = !0), t) V.entities.setPosition(V.playerEntity, w.hostInfo.spawnPoint.x, w.hostInfo.spawnPoint.y, w.hostInfo.spawnPoint.z);
else {
for (var i = 0, r = 0; i < v && r < 50;) {
var n = Math.floor(M - _ / 4 + Math.random() * (_ / 2)) + .5,
o = Math.floor(M - _ / 4 + Math.random() * (_ / 2)) + .5,
s = V.pick([n, 100, o], [0, -1, 0], 1e3, !0);
null != s && (i = s.position[1]), ++r
}
if (r >= 50) return void setTimeout(e, 100);
V.entities.setPosition(V.playerEntity, s.position[0], s.position[1] + 1, s.position[2])
}
m.hide(), w.updateResetPosition(), w.playerSpawned = !0, setTimeout(function () {
V.entities.setPhysicsInterpolation(V.playerEntity, !0)
}, 100)
},
H = i(503)(V),
X = (i(504)(V), i(505)(V, g), i(506)),
Y = i(507),
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 Z = null;
"lava" == (Q = K[L]) && (Z = [.4, 0, 0, .95]), V.registry.registerMaterial(Q, Z, Q + ".png")
}
for (L = 0; L < q.length; L++) {
var Q;
Z = null;
"water" == (Q = q[L]) && (Z = [0, 0, .4, .85]);
V.registry.registerMaterial(Q, Z, Q + ".png", !0)
}
V.registry.registerMaterial("empty_sponge", [0, 0, 0, 0], null, !0);
var J = [],
$ = [null, null, null, 8, 5, 6, 15, 16];
for (L = 3; L < 8; L++) {
var ee = q[L],
te = X(V);
(oe = V.rendering.makeStandardMaterial(ee + "Mat")).diffuseTexture = new BABYLON.Texture("assets/textures/" + ee + ".png", scene, !0, !0, 1), oe.diffuseTexture.hasAlpha = !0, oe.diffuseTexture.getAlphaFromRGB = !0, te.material = oe;
var ie = $[L],
re = V.registry.registerBlock(ie, {
material: [null, ee, null, null, null, null],
opaque: !1,
blockMesh: te
});
J.push(re)
}
this.grassID = V.registry.registerBlock(1, {
material: ["grass", "dirt", "grass_dirt"]
}), this.stoneID = V.registry.registerBlock(2, {
material: "stone"
}), this.dirtID = V.registry.registerBlock(3, {
material: "dirt"
}), this.woodID = V.registry.registerBlock(4, {
material: "wood"
}), this.redflowerID = J[1], this.yellowflowerID = J[2], this.waterID = V.registry.registerBlock(7, {
material: "water",
opaque: !1,
solid: !1,
fluid: !0,
fluidDensity: 1,
viscosity: .5
}), this.bushID = J[0], this.rockID = V.registry.registerBlock(9, {
material: "rock"
}), this.bedrockID = V.registry.registerBlock(10, {
material: "bedrock"
}), this.sandID = V.registry.registerBlock(11, {
material: "sand"
}), this.gravelID = V.registry.registerBlock(12, {
material: "gravel"
}), this.treeID = V.registry.registerBlock(13, {
material: ["tree_top", "tree_top", "tree_side"]
}), this.leafID = V.registry.registerBlock(14, {
material: "leaves_opaque",
opaque: !1
}), this.redmushroomID = J[3], this.brownmushroomID = J[4], this.lavaID = V.registry.registerBlock(17, {
material: "lava",
solid: !1,
fluid: !0,
fluidDensity: 1,
viscosity: .5
}), this.rockGoldID = V.registry.registerBlock(18, {
material: "rock_gold"
}), this.rockbronzeID = V.registry.registerBlock(19, {
material: "rock_bronze"
}), this.rockcoalID = V.registry.registerBlock(20, {
material: "rock_coal"
}), this.goldID = V.registry.registerBlock(21, {
material: "gold"
}), this.spongeID = V.registry.registerBlock(22, {
material: "sponge"
}), this.glassID = V.registry.registerBlock(23, {
material: "glass",
opaque: !1
}), this.colorBlockArray = [];
for (L = 0; L < 16; L++) {
var ne = V.registry.registerBlock(24 + L, {
material: "color" + L
});
this.colorBlockArray.push(ne)
}
this.emptySpongeID = V.registry.registerBlock(40, {
material: "empty_sponge",
opaque: !1,
solid: !1
});
var oe;
te = Y(V);
(oe = V.rendering.makeStandardMaterial(ee + "Mat")).diffuseTexture = V.waterTexture, oe.alpha = .85, oe.useAlphaFromDiffuseTexture = !0, oe.backFaceCulling = !1, oe.disableLighting = !0, oe.emissiveColor = new BABYLON.Color3(.6, .6, .6), te.material = oe, this.waterHackID = V.registry.registerBlock(41, {
material: [null, "water", null, null, null, null],
opaque: !1,
solid: !1,
fluid: !0,
fluidDensity: 1,
viscosity: .5,
blockMesh: te
}), this.soundArray = [null, {
id: "grass",
volume: .9,
pitch: 1
}, {
id: "stone",
volume: 1,
pitch: 1
}, {
id: "grass",
volume: .8,
pitch: 1
}, {
id: "wood",
volume: 1,
pitch: 1
}, null, null, null, null, {
id: "stone",
volume: 1,
pitch: 1
}, null, {
id: "gravel",
volume: .8,
pitch: 1
}, {
id: "gravel",
volume: .8,
pitch: 1
}, {
id: "wood",
volume: 1,
pitch: 1
}, {
id: "grass",
volume: 1,
pitch: .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: .7,
pitch: 1
}, {
id: "cloth",
volume: 1,
pitch: .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 se = i(508)(V, this.blockArray);
se.setBlock(W), window.addEventListener("beforeunload", function (e) {
!w.playerSpawned || b || x || (e.preventDefault(), e.returnValue = "")
}), document.addEventListener("mousewheel", Se, !1), document.addEventListener("DOMMouseScroll", Se, !1), V.inputs.down.on("fire", function () {
if (V.targetedBlock) {
var e = {
targetedBlockBlockID: V.targetedBlock.blockID,
targetedBlockPosition: V.targetedBlock.position,
targetedBlockAdjacentPosition: V.targetedBlock.adjacent,
chosenBlock: W,
addMode: V.addMode
};
V.addMode && (e.localPlayer = !0);
var t = w.handleFireEvent(e);
delete e.localPlayer, null != w.player && t && w.player.emitFireEvent(e)
}
}), V.inputs.down.on("mid-fire", function () {
if (V.targetedBlock) {
var e = V.targetedBlock.blockID;
if (e == w.rockcoalID || e == w.rockbronzeID || e == w.rockGoldID) return;
1 == e && (e = 3), N.pick(e), W = e - 1, se.setBlock(W)
}
}), V.inputs.down.on("alt-fire", function () {
V.addMode ? V.addMode = !1 : (V.addMode = !0, se.setBlock(W)), V.resetTargetBlock(), V.emit("targetBlockChanged", V.targetedBlock)
}), document.addEventListener("keydown", function (e) {
var t = e.keyCode;
if (8 == t && e.preventDefault(), e.ctrlKey && e.preventDefault(), !G.isOpen && ae)
if (ae = !1, 27 == t && c.isOpen) c.close();
else if (27 == t && (U.isOpen ? U.close() : (U.open(), z.isOpen && z.close())), !U.isOpen && (!c || !c.isOpen) && t >= 49 && t <= 57) {
var i = t - 49;
N.setIndex(i), W = N.currentId - 1, se.setBlock(W)
}
}, !1), document.addEventListener("keyup", function (e) {
ae = !0
}, !1);
var ae = !0;
V.inputs.down.on("build", function (e, t) {
U.isOpen || c.isOpen || z.open()
}), V.inputs.down.on("chat", function (e, t) {
U.isOpen || c.isOpen || (z.isOpen && z.close(), c.open())
}), V.inputs.down.on("fog", function (e, t) {
U.isOpen || c.isOpen || ye()
}), V.inputs.down.on("saveLoc", function (e, t) {
U.isOpen || c.isOpen || w.updateResetPosition()
}), V.inputs.down.on("loadLoc", function (e, t) {
U.isOpen || c.isOpen || w.applyResetPosition()
}), V.inputs.down.on("spawnSteve", function (e, t) {
U.isOpen || c.isOpen || w.spawnSteve()
});
var ce = !1;
document.addEventListener("pointerlockchange", function (e) {
var t = !1;
c && (t = c.isOpen), null != document.pointerLockElement || !ce || z.isOpen || t || G.isOpen ? (ce = !0, V.inputs.state.forward = !1, V.inputs.state.backward = !1, V.inputs.state.left = !1, V.inputs.state.right = !1, t && ae && c.close()) : U.open()
}, !1), window.addEventListener("resize", function (e) {
U.resize(), m.resize(), G.resize(), N.resize(), c && c.resize(), V.version && V.version.resize(), z.resize()
}), V.on("setPreviewBlock", function (e) {
W = e - 1, se.setBlock(W)
});
var he = {
position: [O.playerStart[0], O.playerStart[1], O.playerStart[2]],
rotation: [0, 0, 0]
};
this.setPlayerPosition = function (e) {
var t = V.playerEntity;
V.entities.setPhysicsInterpolation(t, !1), V.entities.setPosition(t, e[0], e[1] + .5, e[2]), setTimeout(function () {
V.entities.setPhysicsInterpolation(t, !0)
}, 100)
}, this.updateResetPosition = function () {
var e = V.playerEntity,
t = V.entities.getPosition(e);
he.position[0] = t[0], he.position[1] = t[1], he.position[2] = t[2], he.rotation[0] = 0, he.rotation[1] = V.rendering._rotationHolder.rotation.y, he.rotation[2] = 0, w.applyResetPosition()
}, this.applyResetPosition = function () {
V.entities.setPhysicsInterpolation(V.playerEntity, !1);
var e = V.playerEntity;
V.entities.setPosition(e, he.position[0], he.position[1] + .5, he.position[2]), V.rendering._rotationHolder.rotation.x = he.rotation[0], V.rendering._rotationHolder.rotation.y = he.rotation[1], V.rendering._rotationHolder.rotation.z = he.rotation[2], setTimeout(function () {
V.entities.setPhysicsInterpolation(V.playerEntity, !0)
}, 100)
}, this.steveArray = [], this.spawnSteve = function () {
var e = V.entities.getPositionData(V.playerEntity),
t = i(509),
r = e.position[0],
n = e.position[1] + .5,
o = e.position[2],
s = t(V, r, n, o);
w.steveArray.push(s)
};
var ue = 250,
le = 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 r = this.waterID;
this.shouldWaterHaveSurface(e, t, i) && (r = this.waterHackID), this.setBlock(r, e, t, i);
var n = V.world.getBlockID(e - 1, t, i),
o = V.world.getBlockID(e + 1, t, i),
s = V.world.getBlockID(e, t, i + 1),
a = V.world.getBlockID(e, t, i - 1);
if (n == this.waterID || n == this.waterHackID) {
r = this.waterID;
var c = V.world.getBlockID(e - 1, t + 1, i);
this.shouldWaterHaveSurface(e - 1, t, i) && 0 != c && (r = this.waterHackID), this.setBlock(r, e - 1, t, i)
}
if (o == this.waterID || o == this.waterHackID) {
r = this.waterID;
var h = V.world.getBlockID(e + 1, t + 1, i);
this.shouldWaterHaveSurface(e + 1, t, i) && 0 != h && (r = this.waterHackID), this.setBlock(r, e + 1, t, i)
}
if (s == this.waterID || s == this.waterHackID) {
r = this.waterID;
var u = V.world.getBlockID(e, t + 1, i + 1);
this.shouldWaterHaveSurface(e, t, i + 1) && 0 != u && (r = this.waterHackID), this.setBlock(r, e, t, i + 1)
}
if (a == this.waterID || a == this.waterHackID) {
r = this.waterID;
var l = V.world.getBlockID(e, t + 1, i - 1);
this.shouldWaterHaveSurface(e, t, i - 1) && 0 != l && (r = this.waterHackID), this.setBlock(r, e, t, i - 1)
}
}, this.checkWaterHackBelowDestroy = function (e, t, i) {
V.world.getBlockID(e, t, i) == this.waterHackID && this.addBlock(this.waterID, e, t, i);
var r, n = V.world.getBlockID(e - 1, t, i),
o = V.world.getBlockID(e + 1, t, i),
s = V.world.getBlockID(e, t, i + 1),
a = V.world.getBlockID(e, t, i - 1);
if (n == this.waterID || n == this.waterHackID) {
r = this.waterID;
var c = V.world.getBlockID(e - 1, t + 1, i);
this.shouldWaterHaveSurface(e - 1, t, i) && 0 != c && (r = this.waterHackID), this.setBlock(r, e - 1, t, i)
}
if (o == this.waterID || o == this.waterHackID) {
r = this.waterID;
var h = V.world.getBlockID(e + 1, t + 1, i);
this.shouldWaterHaveSurface(e + 1, t, i) && 0 != h && (r = this.waterHackID), this.setBlock(r, e + 1, t, i)
}
if (s == this.waterID || s == this.waterHackID) {
r = this.waterID;
var u = V.world.getBlockID(e, t + 1, i + 1);
this.shouldWaterHaveSurface(e, t, i + 1) && 0 != u && (r = this.waterHackID), this.setBlock(r, e, t, i + 1)
}
if (a == this.waterID || a == this.waterHackID) {
r = this.waterID;
var l = V.world.getBlockID(e, t + 1, i - 1);
this.shouldWaterHaveSurface(e, t, i - 1) && 0 != l && (r = this.waterHackID), this.setBlock(r, e, t, i - 1)
}
}, this.shouldWaterHaveSurface = function (e, t, i) {
var r = V.world.getBlockID(e, t + 1, i),
n = V.world.getBlockID(e - 1, t + 1, i),
o = V.world.getBlockID(e + 1, t + 1, i),
s = V.world.getBlockID(e, t + 1, i + 1),
a = V.world.getBlockID(e, t + 1, i - 1);
return (0 == r || 0 == n || 0 == o || 0 == s || 0 == a) && r != this.waterID && n != this.waterID && o != this.waterID && s != this.waterID && a != this.waterID && r != this.waterHackID && n != this.waterHackID && o != this.waterHackID && s != this.waterHackID && a != this.waterHackID
}, this.addWater = function (e, t, i) {
if (e < 0 || e >= V.worldSize - 1 || i < 0 || i >= V.worldSize - 1) return !1;
var r = this.waterID,
n = V.world.getBlockID(e, t + 1, i);
if (this.shouldWaterHaveSurface(e, t, i) && 0 != n && n != this.emptySpongeID && (r = this.waterHackID), this.addBlock(this.waterID, e, t, i), r != this.waterID) {
this.addBlock(r, e, t, i);
var o = V.world.getBlockID(e - 1, t, i),
s = V.world.getBlockID(e + 1, t, i),
a = V.world.getBlockID(e, t, i + 1),
c = V.world.getBlockID(e, t, i - 1),
h = V.world.getBlockID(e - 1, t + 1, i),
u = V.world.getBlockID(e + 1, t + 1, i),
l = V.world.getBlockID(e, t + 1, i + 1),
f = V.world.getBlockID(e, t + 1, i - 1);
o == this.waterID && 0 != h && (V.setBlock(r, e - 1, t, i), this.setBlockTilesArray(r, e - 1, t, i)), s == this.waterID && 0 != u && (V.setBlock(r, e + 1, t, i), this.setBlockTilesArray(r, e - 1, t, i)), a == this.waterID && 0 != l && (V.setBlock(r, e, t, i + 1), this.setBlockTilesArray(r, e - 1, t, i)), c == this.waterID && 0 != f && (V.setBlock(r, e, t, i - 1), this.setBlockTilesArray(r, e - 1, t, i))
}
var d = V.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), !0
}, this.addLava = function (e, t, i) {
this.addBlock(this.lavaID, e, t, i);
var r = V.world.getBlockID(e, t - 1, i);
r == this.grassID && this.flagToRemoveGrass(e, t - 1, i), r == this.waterID && this.setBlock(this.stoneID, e, t - 1, i)
}, this.checkNeighbours = function (e, t, i, r) {
if (!(e < 0 || e >= V.worldSize - 1 || i < 0 || i >= V.worldSize - 1) && 0 == V.world.getBlockID(e, t, i)) {
var n = V.world.getBlockID(e, t + 1, i),
o = V.world.getBlockID(e - 1, t, i),
s = V.world.getBlockID(e + 1, t, i),
a = V.world.getBlockID(e, t, i + 1),
c = V.world.getBlockID(e, t, i - 1);
n != w.lavaID && o != w.lavaID && s != w.lavaID && a != w.lavaID && c != w.lavaID || setTimeout(function () {
w.addLava(e, t, i), _e(w.checkNeighboursAsLava, [e, t, i])
}, 1500), n != w.waterID && o != w.waterID && s != w.waterID && a != w.waterID && c != w.waterID && n != w.waterHackID && o != w.waterHackID && s != w.waterHackID && a != w.waterHackID && c != w.waterHackID || setTimeout(function () {
w.addWater(e, t, i) && de(w.checkNeighboursAsWater, [e, t, i])
}, 150), r && setTimeout(function () {
w.checkWaterHackBelowDestroy(e, t - 1, i)
}, 160)
}
}, this.checkNeighboursAsWater = function (e, t, i) {
if (!(e <= 0 || e >= V.worldSize - 1 || i <= 0 || i >= V.worldSize - 1)) {
var r = V.world.getBlockID(e, t - 1, i),
n = V.world.getBlockID(e - 1, t, i),
o = V.world.getBlockID(e + 1, t, i),
s = V.world.getBlockID(e, t, i + 1),
a = V.world.getBlockID(e, t, i - 1);
0 == r && w.addWater(e, t - 1, i) && de(w.checkNeighboursAsWater, [e, t - 1, i]), 0 == n && w.addWater(e - 1, t, i) && de(w.checkNeighboursAsWater, [e - 1, t, i]), 0 == o && w.addWater(e + 1, t, i) && de(w.checkNeighboursAsWater, [e + 1, t, i]), 0 == s && w.addWater(e, t, i + 1) && de(w.checkNeighboursAsWater, [e, t, i + 1]), 0 == a && w.addWater(e, t, i - 1) && de(w.checkNeighboursAsWater, [e, t, i - 1])
}
}, this.checkNeighboursAsLava = function (e, t, i) {
if (!(e < 0 || e > V.worldSize - 1 || i < 0 || i > V.worldSize - 1)) {
var r = V.world.getBlockID(e, t - 1, i),
n = V.world.getBlockID(e - 1, t, i),
o = V.world.getBlockID(e + 1, t, i),
s = V.world.getBlockID(e, t, i + 1),
a = V.world.getBlockID(e, t, i - 1);
0 == r && (w.addLava(e, t - 1, i), _e(w.checkNeighboursAsLava, [e, t - 1, i])), 0 == n && (w.addLava(e - 1, t, i), _e(w.checkNeighboursAsLava, [e - 1, t, i])), 0 == o && (w.addLava(e + 1, t, i), _e(w.checkNeighboursAsLava, [e + 1, t, i])), 0 == s && (w.addLava(e, t, i + 1), _e(w.checkNeighboursAsLava, [e, t, i + 1])), 0 == a && (w.addLava(e, t, i - 1), _e(w.checkNeighboursAsLava, [e, t, i - 1]))
}
}, this.flagToGrowGrass = function (e, t, i) {
var r = E + Math.random() * (P - E);
setTimeout(function () {
if (V.world.getBlockID(e, t, i) == w.dirtID) {
var r = w.checkUpForBlocker(e, t, i);
0 != r && r != w.redflowerID && r != w.yellowflowerID && r != w.bushID && r != w.redmushroomID && r != w.brownmushroomID && r != w.glassID && r != w.leafID || w.setBlock(w.grassID, e, t, i)
}
}, r)
}, this.flagToRemoveGrass = function (e, t, i) {
var r = C + Math.random() * (R - C);
setTimeout(function () {
if (V.world.getBlockID(e, t, i) == w.grassID) {
var r = w.checkUpForBlocker(e, t, i);
0 != r && r != w.redflowerID && r != w.yellowflowerID && r != w.bushID && r != w.redmushroomID && r != w.brownmushroomID && r != w.glassID && r != w.leafID && w.setBlock(w.dirtID, e, t, i)
}
}, r)
}, this.checkBelowFoilage = function (e, t, i) {
var r = I + Math.random() * (D - I);
setTimeout(function () {
var r = V.world.getBlockID(e, t, i);
if (r == w.redflowerID || r == w.yellowflowerID || r == w.bushID || r == w.redmushroomID || r == w.brownmushroomID) {
var n = V.world.getBlockID(e, t - 1, i);
n != w.grassID && n != w.dirtID && (w.setBlock(0, e, t, i), de(w.checkNeighbours, [e, t, i]))
}
}, r)
}, this.checkAboveFoilage = function (e, t, i) {
var r = I + Math.random() * (D - I);
setTimeout(function () {
var r = V.world.getBlockID(e, t, i);
if ((r == w.redflowerID || r == w.yellowflowerID || r == w.bushID || r == w.redmushroomID || r == w.brownmushroomID) && w.getBrightness(e, t, i) < 1) {
w.setBlock(0, e, t, i), de(w.checkNeighbours, [e, t, i]);
var n = V.world.getBlockID(e, t + 1, i);
n != w.sandID && n != w.gravelID || w.checkDownSandGravel(e, t + 1, i, n)
}
}, r)
}, this.checkDownForGrass = function (e, t, i) {
for (var r = 0, n = t;
(0 == r || r == this.redflowerID || r == this.yellowflowerID || r == this.bushID || r == this.redmushroomID || r == this.brownmushroomID || r == this.glassID || r == this.leafID) && n >= 0;) n -= 1, (r = V.world.getBlockID(e, n, i)) != this.redflowerID && r != this.yellowflowerID && r != this.bushID && r != this.redmushroomID && r != this.brownmushroomID || w.checkAboveFoilage(e, n, i);
r == this.grassID && this.flagToRemoveGrass(e, n, i)
}, this.checkDownForDirt = function (e, t, i) {
for (var r = 0, n = t;
(0 == r || r == this.redflowerID || r == this.yellowflowerID || r == this.bushID || r == this.redmushroomID || r == this.brownmushroomID || r == this.glassID || r == this.leafID) && n >= 0;) n -= 1, r = V.world.getBlockID(e, n, i);
r == this.dirtID && this.flagToGrowGrass(e, n, i)
}, this.checkDownSandGravel = function (e, t, i, r) {
for (var n = 0, o = t;
(0 == n || n == this.waterID || n == this.waterHackID || n == this.lavaID || n == this.emptySpongeID) && o >= 0;) o -= 1, n = V.world.getBlockID(e, o, i);
if (0 != n) {
w.setBlock(0, e, t, i), w.setBlock(r, e, o + 1, i);
var s = V.world.getBlockID(e, t + 1, i);
s != w.sandID && s != w.gravelID || w.checkDownSandGravel(e, t + 1, i, s);
w.removeBlockCheckLit(e, t, i);
w.checkNeighbours(e, t, i, !1)
}
}, this.checkUpForBlocker = function (e, t, i) {
for (var r = 0, n = t;
(0 == r || r == this.redflowerID || r == this.yellowflowerID || r == this.bushID || r == this.redmushroomID || r == this.brownmushroomID || r == this.glassID || r == this.leafID) && n < 64;) n += 1, r = V.world.getBlockID(e, n, i);
return r
};
var ve = {};
this.updateRemainingSponges = function () {
for (var e in ve) {
var t = ve[e];
w.checkAddSponge(t.x, t.y, t.z, !1)
}
}, this.checkAddSponge = function (e, t, i, r) {
(r || null == r) && (ve["s" + e + t + i] = {
x: e,
y: t,
z: i
});
for (var n = Math.max(e - 2, 1), o = Math.min(e + 2, _ - 3), s = Math.max(i - 2, 1), a = Math.min(i + 2, _ - 3), c = t - 2; c <= t + 2; c++)
for (var h = n; h <= o; h++)
for (var u = s; u <= a; u++) {
var l = V.world.getBlockID(h, c, u);
l != w.waterID && 0 != l || (w.setBlock(w.emptySpongeID, h, c, u), w.removeBlockCheckLit(h, c, u))
}
}, this.checkRemoveSponge = function (e, t, i) {
delete ve["s" + e + t + i];
for (var r = Math.max(e - 2, 1), n = Math.min(e + 2, _ - 3), o = Math.max(i - 2, 1), s = Math.min(i + 2, _ - 3), a = t - 2; a <= t + 2; a++)
for (var c = r; c <= n; c++)
for (var h = o; h <= s; h++) {
var u;
u = c == e - 2 || c == e + 2 || h == i - 2 || h == i + 2, V.world.getBlockID(c, a, h) == w.emptySpongeID && (w.setBlock(0, c, a, h), u && de(w.checkNeighbours, [c, a, h]))
}
w.updateRemainingSponges()
};
var ye = function () {
V.settings.drawDistance++, V.settings.drawDistance > 3 && (V.settings.drawDistance = 0), be(V.settings.drawDistance), V.emit("saveSettings")
};
V.on("cycleDrawDistance", ye);
var be = function (e) {
switch (V.settings.drawDistance = e, e) {
case 0:
V.rendering.fogWorld = .002, V.rendering.fogWater = .08, V.rendering.fogLava = .2, V.rendering._camera.maxZ = 800;
break;
case 1:
V.rendering.fogWorld = .008, V.rendering.fogWater = .08, V.rendering.fogLava = .2, V.rendering._camera.maxZ = 200;
break;
case 2:
V.rendering.fogWorld = .05, V.rendering.fogWater = .1, V.rendering.fogLava = .2, V.rendering._camera.maxZ = 50;
break;
case 3:
V.rendering.fogWorld = .2, V.rendering.fogWater = .2, V.rendering.fogLava = .2, V.rendering._camera.maxZ = 10
}
V.rendering._camLocBlock += 1
};
be(V.settings.drawDistance), V.on("toggleMusic", function () {
V.settings.music ? (V.settings.music = !1, w.soundPlayer.setMusicVolume(0)) : (V.settings.music = !0, w.soundPlayer.setMusicVolume(1)), w.soundPlayer.musicOn = V.settings.music, V.emit("saveSettings")
}), V.on("toggleSound", function () {
V.settings.sound ? V.settings.sound = !1 : V.settings.sound = !0, w.soundPlayer.soundOn = V.settings.sound, V.emit("saveSettings")
}), V.on("toggleInvertMouse", function () {
V.settings.invert ? V.settings.invert = !1 : V.settings.invert = !0, V.cameraControls.inverseY = V.settings.invert, V.emit("saveSettings")
}), V.on("toggleFps", function () {
V.settings.fps ? V.settings.fps = !1 : V.settings.fps = !0, V.version.showFps = V.settings.fps, V.version.lastRedraw = 0, V.version.redraw(), V.emit("saveSettings")
}), V.on("saveSettings", function () {
localStorage.setItem("settings", JSON.stringify(V.settings))
}), setInterval(function () {
if (null != t.player) {
var e = V.entities.getPositionData(V.playerEntity),
i = V.rendering._rotationHolder.rotation;
t.player.setPosition({
x: e.position[0],
y: e.position[1],
z: e.position[2]
}, i, t.playerSpawned)
}
}, 50), V.setName = function (e) {
w.setName && w.setName(e)
}, this.onHostDisconnect = function () {
x || (this.worldInitialized && (U.isOpen && U.close(), c.isOpen && c.close(), z.isOpen && z.close()), G && G.show(3), b = !0)
}, this.onHostFull = function () {
G && G.show(2)
}, this.onKicked = function () {
x = !0, G && G.show(5)
}, this.addPlayer = function (e, t, r, n, o) {
return i(511)(V, e, t, r, n, o)
}, this.getPlayerPosition = function () {
return V.entities.getPosition(V.playerEntity)
}, this.getPlayerRotation = function () {
return V.rendering._rotationHolder.rotation
}, this.setBlock = function (e, t, i, r) {
var n = t.length ? t : [t, i, r];
this.setBlockTilesArray(e, n), V.setBlock(e, n), void 0 !== this.changedBlockHandler && null !== this.changedBlockHandler && this.changedBlockHandler.setBlock(n, e)
}, this.addBlock = function (e, t, i, r) {
var n = t.length ? t : [t, i, r],
o = !!t.length && i;
return this.setBlockTilesArray(e, n), !!V.addBlock(e, n, o) && (void 0 !== this.changedBlockHandler && null !== this.changedBlockHandler && this.changedBlockHandler.addBlock(n, e), e != this.leafID && e != this.glassID && e != this.redflowerID && e != this.yellowflowerID && e != this.bushID && e != this.redmushroomID && e != this.brownmushroomID && this.addBlockCheckLit(n[0], n[1], n[2]), !0)
}, 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 && xe()
}, this.syncSavedWorld = function () {
var e = r.default.getInstance().getChangedBlocks();
for (var t in e) {
var i = e[t];
this.setBlockTilesArray(i.bt, i.p)
}
}, this.setBlockTilesArray = function (e, t, i, r) {
if (y) {
var n = t.length ? t : [t, i, r];
y[(n[1] * _ + n[2]) * _ + n[0]] = e
}
}, this.updateChatLog = function (e) {
void 0 !== c && c.update(e)
}
} else console.log("seed must be an integer.");
function xe() {
! function () {
for (var e = 0; e < _; ++e)
for (var t = 0; t < 64; ++t)
for (var i = 0; i < _; ++i) {
var r = e,
n = t,
o = i,
s = y[(n * _ + o) * _ + r],
a = 0;
null != w.lightDepths[r][o] && (a = w.lightDepths[r][o]), 0 != s && s != w.redflowerID && s != w.yellowflowerID && s != w.bushID && s != w.redmushroomID && s != w.brownmushroomID && s != w.glassID && s != w.leafID && s != w.emptySpongeID && n >= a && (a = n), w.lightDepths[r][o] = a
}
}(), V.world.on("worldDataNeeded", we), V.setPaused(!1), c = o(V), V.version = d(), V.version.showFps = V.settings.fps, V.entities.setPhysicsInterpolation(V.playerEntity, !1), setTimeout(j, 100), w.worldInitialized = !0, V.hostInfo.gameFull && (U.isOpen && U.close(!0), G.show(2)), null != S.get("host") ? (U.isOpen && U.close(!0), w.noWebrtcJoin ? G.show(6) : G.show(0)) : null != S.get("join") && (U.isOpen && U.close(!0), G.show(1))
}
function we(e, t, i, r, n) {
var o = e.split("|"),
s = parseInt(o[0], 10),
a = parseInt(o[1], 10),
c = parseInt(o[2], 10),
h = s * g,
u = a * g,
l = c * g,
f = !1;
if ((s < 0 || a < 0 || c < 0) && (f = !0), (s >= _ / g || a >= 64 / g || c >= _ / g) && (f = !0), f) {
for (var d = w.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, (x = m - 1 + u) <= v && (d = w.waterID), x <= v - 2 && (d = w.bedrockID), t.set(p, m, b, d)
}
V.world.setChunkData(e, t)
} else {
for (d = w.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 x, S = p - 1 + h,
T = b - 1 + l;
null != (d = y[((x = m - 1 + u) * _ + T) * _ + S]) && 0 != x || (d = w.bedrockID), (S < 0 || T < 0 || p + h >= _ || b + l >= _) && (d = 0, x <= v && (d = w.waterID), x <= v - 2 && (d = w.bedrockID)), t.set(p, m, b, d)
}
V.world.setChunkData(e, t)
}
}
function Se(e) {
e.ctrlKey && e.preventDefault()
}
}
}, {
key: "handleFireEvent",
value: function (e) {
var t = e.targetedBlockBlockID,
i = e.targetedBlockPosition,
r = e.targetedBlockAdjacentPosition,
n = e.addMode,
o = e.chosenBlock,
s = e.localPlayer;
if ("undefined" == typeof noa) return n ? this.setBlockTilesArray(this.blockArray[o], r) : this.setBlockTilesArray(0, i), !1;
if (n) {
if (r[1] >= noa.worldHeight) return !1;
var a = noa.world.getBlockID(r[0], r[1], r[2]);
if (!this.addBlock(this.blockArray[o], r, s)) return !1;
var c = this.blockArray[o];
return c == this.dirtID && this.flagToGrowGrass(r[0], r[1], r[2]), this.checkDownForGrass(r[0], r[1], r[2]), (v = noa.world.getBlockID(r[0], r[1] - 1, r[2])) != this.waterID && v != this.waterHackID || 0 != a || this.checkWaterBelowAdd(r[0], r[1] - 1, r[2]), c != this.sandID && c != this.gravelID || this.checkDownSandGravel(r[0], r[1], r[2], c), c == this.spongeID && this.checkAddSponge(r[0], r[1], r[2]), c != this.redflowerID && c != this.yellowflowerID && c != this.bushID && c != this.redmushroomID && c != this.brownmushroomID || (v != this.dirtID && v != this.grassID && this.checkBelowFoilage(r[0], r[1], r[2]), this.checkAboveFoilage(r[0], r[1], r[2])), !0
}
if (t != this.bedrockID) {
var h = noa.registry.getBlockFaceMaterialAccessor()(t, 0),
u = noa.registry._textures[h];
this.setBlock(0, i);
var l = i,
f = this.removeBlockCheckLit(l[0], l[1], l[2]),
d = new BABYLON.Vector3(l[0], l[1], l[2]),
p = BABYLON.Vector3.Distance(noa.rendering._cameraHolder.position, d);
if (null != u && p < 15) this.addParticles("debris", u, f).mesh.position.copyFromFloats(l[0] + .5, l[1] + .5, l[2] + .5);
this.checkDownForDirt(i[0], i[1], i[2]), t == this.spongeID && this.checkRemoveSponge(i[0], i[1], i[2]);
var m = noa.world.getBlockID(l[0], l[1] + 1, l[2]);
t != this.dirtID && t != this.grassID || m != this.redflowerID && m != this.yellowflowerID && m != this.bushID && m != this.redmushroomID && m != this.brownmushroomID || this.checkBelowFoilage(i[0], i[1] + 1, i[2]), m != this.sandID && m != this.gravelID || this.checkDownSandGravel(i[0], i[1] + 1, i[2], m);
var g = this.soundArray[t];
if (null != g && p < 15) {
var _ = 1 - p / 25;
this.soundPlayer.play(g.id, g.volume * _, g.pitch)
}
var v, y = !1;
return (v = noa.world.getBlockID(l[0], l[1] - 1, l[2])) != this.waterID && v != this.waterHackID || (y = !0), this.checkNeighbours(i[0], i[1], i[2], y), !0
}
}
}, {
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 (e) {
for (var t in this.network.state.players)
if (this.network.state.players[t].state.name === e) {
var i = this.network.state.players[t].state.position;
return noa.entities.setPhysicsInterpolation(noa.playerEntity, !1), noa.entities.setPosition(noa.playerEntity, i.x, i.y, i.z), setTimeout(function () {
noa.entities.setPhysicsInterpolation(noa.playerEntity, !0)
}, 100), "Teleporting to " + e + " " + JSON.stringify(i)
} 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)
}
}]) && a(t.prototype, n), c && a(t, c), e
}(),
h = t.a = c
}, function (e, t, i) {
var r = i(6),
n = i(5).document,
o = r(n) && r(n.createElement);
e.exports = function (e) {
return o ? n.createElement(e) : {}
}
}, function (e, t, i) {
var r = i(14),
n = i(5),
o = n["__core-js_shared__"] || (n["__core-js_shared__"] = {});
(e.exports = function (e, t) {
return o[e] || (o[e] = void 0 !== t ? t : {})
})("versions", []).push({
version: r.version,
mode: i(46) ? "pure" : "global",
copyright: "© 2018 Denis Pushkarev (zloirock.ru)"
})
}, function (e, t, i) {
t.f = i(8)
}, function (e, t, i) {
var r = i(96)("keys"),
n = i(45);
e.exports = function (e) {
return r[e] || (r[e] = n(e))
}
}, function (e, t) {
e.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")
}, function (e, t, i) {
var r = i(36);
e.exports = Array.isArray || function (e) {
return "Array" == r(e)
}
}, function (e, t, i) {
var r = i(5).document;
e.exports = r && r.documentElement
}, function (e, t, i) {
var r = i(6),
n = i(4),
o = function (e, t) {
if (n(e), !r(t) && null !== t) throw TypeError(t + ": can't set as prototype!")
};
e.exports = {
set: Object.setPrototypeOf || ("__proto__" in {} ? function (e, t, r) {
try {
(r = i(34)(Function.call, i(29).f(Object.prototype, "__proto__").set, 2))(e, []), t = !(e instanceof Array)
} catch (e) {
t = !0
}
return function (e, i) {
return o(e, i), t ? e.__proto__ = i : r(e, i), e
}
}({}, !1) : void 0),
check: o
}
}, function (e, t) {
e.exports = "\t\n\v\f\r Â áš€á Žâ€€â€â€‚â€ƒâ€„â€…â€†â€‡â€ˆâ€‰â€Šâ€¯âŸã€€\u2028\u2029\ufeff"
}, function (e, t, i) {
var r = i(6),
n = i(102).set;
e.exports = function (e, t, i) {
var o, s = t.constructor;
return s !== i && "function" == typeof s && (o = s.prototype) !== i.prototype && r(o) && n && n(e, o), e
}
}, function (e, t, i) {
"use strict";
var r = i(28),
n = i(37);
e.exports = function (e) {
var t = String(n(this)),
i = "",
o = r(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 r = i(28),
n = i(37);
e.exports = function (e) {
return function (t, i) {
var o, s, a = String(n(t)),
c = r(i),
h = a.length;
return c < 0 || c >= h ? e ? "" : void 0 : (o = a.charCodeAt(c)) < 55296 || o > 56319 || c + 1 === h || (s = a.charCodeAt(c + 1)) < 56320 || s > 57343 ? e ? a.charAt(c) : o : e ? a.slice(c, c + 2) : s - 56320 + (o - 55296 << 10) + 65536
}
}
}, function (e, t, i) {
"use strict";
var r = i(46),
n = i(0),
o = i(19),
s = i(23),
a = i(57),
c = i(151),
h = i(56),
u = i(51),
l = 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, x = function (e) {
if (!f && e in A) return A[e];
switch (e) {
case "keys":
case "values":
return function () {
return new i(this, e)
}
}
return function () {
return new i(this, e)
}
},
w = t + " Iterator",
S = "values" == m,
T = !1,
A = e.prototype,
M = A[l] || A["@@iterator"] || m && A[m],
E = M || x(m),
P = m ? S ? x("entries") : E : void 0,
C = "Array" == t && A.entries || M;
if (C && (b = u(C.call(new e))) !== Object.prototype && b.next && (h(b, w, !0), r || "function" == typeof b[l] || s(b, l, d)), S && M && "values" !== M.name && (T = !0, E = function () {
return M.call(this)
}), r && !_ || !f && !T && A[l] || s(A, l, E), a[t] = E, a[w] = d, m)
if (v = {
values: S ? E : x("values"),
keys: g ? E : x("keys"),
entries: P
}, _)
for (y in v) y in A || o(A, y, v[y]);
else n(n.P + n.F * (f || T), t, v);
return v
}
}, function (e, t, i) {
var r = i(111),
n = i(37);
e.exports = function (e, t, i) {
if (r(t)) throw TypeError("String#" + i + " doesn't accept regex!");
return String(n(e))
}
}, function (e, t, i) {
var r = i(6),
n = i(36),
o = i(8)("match");
e.exports = function (e) {
var t;
return r(e) && (void 0 !== (t = e[o]) ? !!t : "RegExp" == n(e))
}
}, function (e, t, i) {
var r = i(8)("match");
e.exports = function (e) {
var t = /./;
try {
"/./" [e](t)
} catch (i) {
try {
return t[r] = !1, !"/./" [e](t)
} catch (e) {}
}
return !0
}
}, function (e, t, i) {
var r = i(57),
n = i(8)("iterator"),
o = Array.prototype;
e.exports = function (e) {
return void 0 !== e && (r.Array === e || o[n] === e)
}
}, function (e, t, i) {
"use strict";
var r = i(12),
n = i(44);
e.exports = function (e, t, i) {
t in e ? r.f(e, t, n(0, i)) : e[t] = i
}
}, function (e, t, i) {
var r = i(66),
n = i(8)("iterator"),
o = i(57);
e.exports = i(14).getIteratorMethod = function (e) {
if (null != e) return e[n] || e["@@iterator"] || o[r(e)]
}
}, function (e, t, i) {
"use strict";
var r = i(20),
n = i(48),
o = i(10);
e.exports = function (e) {
for (var t = r(this), i = o(t.length), s = arguments.length, a = n(s > 1 ? arguments[1] : void 0, i), c = s > 2 ? arguments[2] : void 0, h = void 0 === c ? i : n(c, i); h > a;) t[a++] = e;
return t
}
}, function (e, t, i) {
"use strict";
var r = i(58),
n = i(155),
o = i(57),
s = i(24);
e.exports = i(109)(Array, "Array", function (e, t) {
this._t = s(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, n(1)) : n(0, "keys" == t ? i : "values" == t ? e[i] : [i, e[i]])
}, "values"), o.Arguments = o.Array, r("keys"), r("values"), r("entries")
}, function (e, t, i) {
"use strict";
var r, n, o = i(78),
s = RegExp.prototype.exec,
a = String.prototype.replace,
c = s,
h = (r = /a/, n = /b*/g, s.call(r, "a"), s.call(n, "a"), 0 !== r.lastIndex || 0 !== n.lastIndex),
u = void 0 !== /()??/.exec("")[1];
(h || u) && (c = function (e) {
var t, i, r, n, c = this;
return u && (i = new RegExp("^" + c.source + "$(?!\\s)", o.call(c))), h && (t = c.lastIndex), r = s.call(c, e), h && r && (c.lastIndex = c.global ? r.index + r[0].length : t), u && r && r.length > 1 && a.call(r[0], i, function () {
for (n = 1; n < arguments.length - 2; n++) void 0 === arguments[n] && (r[n] = void 0)
}), r
}), e.exports = c
}, function (e, t, i) {
"use strict";
var r = i(108)(!0);
e.exports = function (e, t, i) {
return t + (i ? r(e, t).length : 1)
}
}, function (e, t, i) {
var r, n, o, s = i(34),
a = i(145),
c = i(101),
h = i(95),
u = i(5),
l = u.process,
f = u.setImmediate,
d = u.clearImmediate,
p = u.MessageChannel,
m = u.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 () {
a("function" == typeof e ? e : Function(e), t)
}, r(g), g
}, d = function (e) {
delete _[e]
}, "process" == i(36)(l) ? r = function (e) {
l.nextTick(s(v, e, 1))
} : m && m.now ? r = function (e) {
m.now(s(v, e, 1))
} : p ? (o = (n = new p).port2, n.port1.onmessage = y, r = s(o.postMessage, o, 1)) : u.addEventListener && "function" == typeof postMessage && !u.importScripts ? (r = function (e) {
u.postMessage(e + "", "*")
}, u.addEventListener("message", y, !1)) : r = "onreadystatechange" in h("script") ? function (e) {
c.appendChild(h("script")).onreadystatechange = function () {
c.removeChild(this), v.call(e)
}
} : function (e) {
setTimeout(s(v, e, 1), 0)
}), e.exports = {
set: f,
clear: d
}
}, function (e, t, i) {
"use strict";
var r = i(5),
n = i(13),
o = i(46),
s = i(84),
a = i(23),
c = i(61),
h = i(3),
u = i(60),
l = i(28),
f = i(10),
d = i(163),
p = i(50).f,
m = i(12).f,
g = i(116),
_ = i(56),
v = "prototype",
y = "Wrong index!",
b = r.ArrayBuffer,
x = r.DataView,
w = r.Math,
S = r.RangeError,
T = r.Infinity,
A = b,
M = w.abs,
E = w.pow,
P = w.floor,
C = w.log,
R = w.LN2,
I = n ? "_b" : "buffer",
D = n ? "_l" : "byteLength",
O = n ? "_o" : "byteOffset";
function L(e, t, i) {
var r, n, o, s = new Array(i),
a = 8 * i - t - 1,
c = (1 << a) - 1,
h = c >> 1,
u = 23 === t ? E(2, -24) - E(2, -77) : 0,
l = 0,
f = e < 0 || 0 === e && 1 / e < 0 ? 1 : 0;
for ((e = M(e)) != e || e === T ? (n = e != e ? 1 : 0, r = c) : (r = P(C(e) / R), e * (o = E(2, -r)) < 1 && (r--, o *= 2), (e += r + h >= 1 ? u / o : u * E(2, 1 - h)) * o >= 2 && (r++, o /= 2), r + h >= c ? (n = 0, r = c) : r + h >= 1 ? (n = (e * o - 1) * E(2, t), r += h) : (n = e * E(2, h - 1) * E(2, t), r = 0)); t >= 8; s[l++] = 255 & n, n /= 256, t -= 8);
for (r = r << t | n, a += t; a > 0; s[l++] = 255 & r, r /= 256, a -= 8);
return s[--l] |= 128 * f, s
}
function F(e, t, i) {
var r, n = 8 * i - t - 1,
o = (1 << n) - 1,
s = o >> 1,
a = n - 7,
c = i - 1,
h = e[c--],
u = 127 & h;
for (h >>= 7; a > 0; u = 256 * u + e[c], c--, a -= 8);
for (r = u & (1 << -a) - 1, u >>= -a, a += t; a > 0; r = 256 * r + e[c], c--, a -= 8);
if (0 === u) u = 1 - s;
else {
if (u === o) return r ? NaN : h ? -T : T;
r += E(2, t), u -= s
}
return (h ? -1 : 1) * r * E(2, u - t)
}
function B(e) {
return e[3] << 24 | e[2] << 16 | e[1] << 8 | e[0]
}
function k(e) {
return [255 & e]
}
function V(e) {
return [255 & e, e >> 8 & 255]
}
function N(e) {
return [255 & e, e >> 8 & 255, e >> 16 & 255, e >> 24 & 255]
}
function z(e) {
return L(e, 52, 8)
}
function U(e) {
return L(e, 23, 4)
}
function G(e, t, i) {
m(e[v], t, {
get: function () {
return this[i]
}
})
}
function W(e, t, i, r) {
var n = d(+i);
if (n + t > e[D]) throw S(y);
var o = e[I]._b,
s = n + e[O],
a = o.slice(s, s + t);
return r ? a : a.reverse()
}
function j(e, t, i, r, n, o) {
var s = d(+i);
if (s + t > e[D]) throw S(y);
for (var a = e[I]._b, c = s + e[O], h = r(+n), u = 0; u < t; u++) a[c + u] = h[o ? u : t - u - 1]
}
if (s.ABV) {
if (!h(function () {
b(1)
}) || !h(function () {
new b(-1)
}) || h(function () {
return new b, new b(1.5), new b(NaN), "ArrayBuffer" != b.name
})) {
for (var H, X = (b = function (e) {
return u(this, b), new A(d(e))
})[v] = A[v], Y = p(A), K = 0; Y.length > K;)(H = Y[K++]) in b || a(b, H, A[H]);
o || (X.constructor = b)
}
var q = new x(new b(2)),
Z = x[v].setInt8;
q.setInt8(0, 2147483648), q.setInt8(1, 2147483649), !q.getInt8(0) && q.getInt8(1) || c(x[v], {
setInt8: function (e, t) {
Z.call(this, e, t << 24 >> 24)
},
setUint8: function (e, t) {
Z.call(this, e, t << 24 >> 24)
}
}, !0)
} else b = function (e) {
u(this, b, "ArrayBuffer");
var t = d(e);
this._b = g.call(new Array(t), 0), this[D] = t
}, x = function (e, t, i) {
u(this, x, "DataView"), u(e, b, "DataView");
var r = e[D],
n = l(t);
if (n < 0 || n > r) throw S("Wrong offset!");
if (n + (i = void 0 === i ? r - n : f(i)) > r) throw S("Wrong length!");
this[I] = e, this[O] = n, this[D] = i
}, n && (G(b, "byteLength", "_l"), G(x, "buffer", "_b"), G(x, "byteLength", "_l"), G(x, "byteOffset", "_o")), c(x[v], {
getInt8: function (e) {
return W(this, 1, e)[0] << 24 >> 24
},
getUint8: function (e) {
return W(this, 1, e)[0]
},
getInt16: function (e) {
var t = W(this, 2, e, arguments[1]);
return (t[1] << 8 | t[0]) << 16 >> 16
},
getUint16: function (e) {
var t = W(this, 2, e, arguments[1]);
return t[1] << 8 | t[0]
},
getInt32: function (e) {
return B(W(this, 4, e, arguments[1]))
},
getUint32: function (e) {
return B(W(this, 4, e, arguments[1])) >>> 0
},
getFloat32: function (e) {
return F(W(this, 4, e, arguments[1]), 23, 4)
},
getFloat64: function (e) {
return F(W(this, 8, e, arguments[1]), 52, 8)
},
setInt8: function (e, t) {
j(this, 1, e, k, t)
},
setUint8: function (e, t) {
j(this, 1, e, k, t)
},
setInt16: function (e, t) {
j(this, 2, e, V, t, arguments[2])
},
setUint16: function (e, t) {
j(this, 2, e, V, t, arguments[2])
},
setInt32: function (e, t) {
j(this, 4, e, N, t, arguments[2])
},
setUint32: function (e, t) {
j(this, 4, e, N, t, arguments[2])
},
setFloat32: function (e, t) {
j(this, 4, e, U, t, arguments[2])
},
setFloat64: function (e, t) {
j(this, 8, e, z, t, arguments[2])
}
});
_(b, "ArrayBuffer"), _(x, "DataView"), a(x[v], s.VIEW, !0), t.ArrayBuffer = b, t.DataView = x
}, function (e, t, i) {
"use strict";
(function (t, r, n) {
var o = i(86);
function s(e) {
var t = this;
this.next = null, this.entry = null, this.finish = function () {
! function (e, t, i) {
var r = e.entry;
e.entry = null;
for (; r;) {
var n = r.callback;
t.pendingcb--, n(i), r = r.next
}
t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e
}(t, e)
}
}
e.exports = v;
var a, c = !t.browser && ["v0.10", "v0.9."].indexOf(t.version.slice(0, 5)) > -1 ? r : o.nextTick;
v.WritableState = _;
var h = i(68);
h.inherits = i(1);
var u = {
deprecate: i(408)
},
l = i(170),
f = i(2).Buffer,
d = n.Uint8Array || function () {};
var p, m = i(171);
function g() {}
function _(e, t) {
a = a || i(54), e = e || {};
var r = t instanceof a;
this.objectMode = !!e.objectMode, r && (this.objectMode = this.objectMode || !!e.writableObjectMode);
var n = e.highWaterMark,
h = e.writableHighWaterMark,
u = this.objectMode ? 16 : 16384;
this.highWaterMark = n || 0 === n ? n : r && (h || 0 === h) ? h : u, this.highWaterMark = Math.floor(this.highWaterMark), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
var l = !1 === e.decodeStrings;
this.decodeStrings = !l, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function (e) {
! function (e, t) {
var i = e._writableState,
r = i.sync,
n = i.writecb;
if (function (e) {
e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0
}(i), t) ! function (e, t, i, r, n) {
--t.pendingcb, i ? (o.nextTick(n, r), o.nextTick(T, e, t), e._writableState.errorEmitted = !0, e.emit("error", r)) : (n(r), e._writableState.errorEmitted = !0, e.emit("error", r), T(e, t))
}(e, i, r, t, n);
else {
var s = w(i);
s || i.corked || i.bufferProcessing || !i.bufferedRequest || x(e, i), r ? c(b, e, i, s, n) : b(e, i, s, n)
}
}(t, e)
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, this.corkedRequestsFree = new s(this)
}
function v(e) {
if (a = a || i(54), !(p.call(v, this) || this instanceof a)) return new v(e);
this._writableState = new _(e, this), this.writable = !0, 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)), l.call(this)
}
function y(e, t, i, r, n, o, s) {
t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, i ? e._writev(n, t.onwrite) : e._write(n, o, t.onwrite), t.sync = !1
}
function b(e, t, i, r) {
i || function (e, t) {
0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain"))
}(e, t), t.pendingcb--, r(), T(e, t)
}
function x(e, t) {
t.bufferProcessing = !0;
var i = t.bufferedRequest;
if (e._writev && i && i.next) {
var r = t.bufferedRequestCount,
n = new Array(r),
o = t.corkedRequestsFree;
o.entry = i;
for (var a = 0, c = !0; i;) n[a] = i, i.isBuf || (c = !1), i = i.next, a += 1;
n.allBuffers = c, y(e, t, !0, t.length, n, "", o.finish), t.pendingcb++, t.lastBufferedRequest = null, o.next ? (t.corkedRequestsFree = o.next, o.next = null) : t.corkedRequestsFree = new s(t), t.bufferedRequestCount = 0
} else {
for (; i;) {
var h = i.chunk,
u = i.encoding,
l = i.callback;
if (y(e, t, !1, t.objectMode ? 1 : h.length, h, u, l), i = i.next, t.bufferedRequestCount--, t.writing) break
}
null === i && (t.lastBufferedRequest = null)
}
t.bufferedRequest = i, t.bufferProcessing = !1
}
function w(e) {
return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing
}
function S(e, t) {
e._final(function (i) {
t.pendingcb--, i && e.emit("error", i), t.prefinished = !0, e.emit("prefinish"), T(e, t)
})
}
function T(e, t) {
var i = w(t);
return i && (! function (e, t) {
t.prefinished || t.finalCalled || ("function" == typeof e._final ? (t.pendingcb++, t.finalCalled = !0, o.nextTick(S, e, t)) : (t.prefinished = !0, e.emit("prefinish")))
}(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"))), i
}
h.inherits(v, l), _.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: u.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 r, n = this._writableState,
s = !1,
a = !n.objectMode && (r = e, f.isBuffer(r) || r instanceof d);
return a && !f.isBuffer(e) && (e = function (e) {
return f.from(e)
}(e)), "function" == typeof t && (i = t, t = null), a ? t = "buffer" : t || (t = n.defaultEncoding), "function" != typeof i && (i = g), n.ended ? function (e, t) {
var i = new Error("write after end");
e.emit("error", i), o.nextTick(t, i)
}(this, i) : (a || function (e, t, i, r) {
var n = !0,
s = !1;
return null === i ? s = new TypeError("May not write null values to stream") : "string" == typeof i || void 0 === i || t.objectMode || (s = new TypeError("Invalid non-string/buffer chunk")), s && (e.emit("error", s), o.nextTick(r, s), n = !1), n
}(this, n, e, i)) && (n.pendingcb++, s = function (e, t, i, r, n, o) {
if (!i) {
var s = function (e, t, i) {
e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = f.from(t, i));
return t
}(t, r, n);
r !== s && (i = !0, n = "buffer", r = s)
}
var a = t.objectMode ? 1 : r.length;
t.length += a;
var c = t.length < t.highWaterMark;
c || (t.needDrain = !0);
if (t.writing || t.corked) {
var h = t.lastBufferedRequest;
t.lastBufferedRequest = {
chunk: r,
encoding: n,
isBuf: i,
callback: o,
next: null
}, h ? h.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t.bufferedRequestCount += 1
} else y(e, t, !1, a, r, n, o);
return c
}(this, n, a, e, t, i)), s
}, 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 || x(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: !1,
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 r = this._writableState;
"function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t = null), null != e && this.write(e, t), r.corked && (r.corked = 1, this.uncork()), r.ending || r.finished || function (e, t, i) {
t.ending = !0, T(e, t), i && (t.finished ? o.nextTick(i) : e.once("finish", i));
t.ended = !0, e.writable = !1
}(this, r, 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(406).setImmediate, i(15))
}, function (e, t, i) {
"use strict";
var r = i(2).Buffer,
n = r.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 !0;
default:
return !1
}
};
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 = !0
}
}(e);
if ("string" != typeof t && (r.isEncoding === n || !n(e))) throw new Error("Unknown encoding: " + e);
return t || e
}(e), this.encoding) {
case "utf16le":
this.text = c, this.end = h, t = 4;
break;
case "utf8":
this.fillLast = a, t = 4;
break;
case "base64":
this.text = u, this.end = l, t = 3;
break;
default:
return this.write = f, void(this.end = d)
}
this.lastNeed = 0, this.lastTotal = 0, this.lastChar = r.allocUnsafe(t)
}
function s(e) {
return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2
}
function a(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 r = i.charCodeAt(i.length - 1);
if (r >= 55296 && r <= 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 h(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 u(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 l(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 r = t.length - 1;
if (r < i) return 0;
var n = s(t[r]);
if (n >= 0) return n > 0 && (e.lastNeed = n - 1), n;
if (--r < i || -2 === n) return 0;
if ((n = s(t[r])) >= 0) return n > 0 && (e.lastNeed = n - 2), n;
if (--r < i || -2 === n) return 0;
if ((n = s(t[r])) >= 0) return n > 0 && (2 === n ? n = 0 : e.lastNeed = n - 3), n;
return 0
}(this, e, t);
if (!this.lastNeed) return e.toString("utf8", t);
this.lastTotal = i;
var r = e.length - (i - this.lastNeed);
return e.copy(this.lastChar, 0, r), e.toString("utf8", t, r)
}, 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, r) {
var n = i(125),
o = i(483);
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 s = "undefined" != typeof Uint8ClampedArray,
a = e.__TYPEDARRAY_POOL;
a.UINT8C || (a.UINT8C = o([32, 0])), a.BUFFER || (a.BUFFER = o([32, 0]));
var c = a.DATA,
h = a.BUFFER;
function u(e) {
if (e) {
var t = e.length || e.byteLength,
i = n.log2(t);
c[i].push(e)
}
}
function l(e) {
e = n.nextPow2(e);
var t = n.log2(e),
i = c[t];
return i.length > 0 ? i.pop() : new ArrayBuffer(e)
}
function f(e) {
return new Uint8Array(l(e), 0, e)
}
function d(e) {
return new Uint16Array(l(2 * e), 0, e)
}
function p(e) {
return new Uint32Array(l(4 * e), 0, e)
}
function m(e) {
return new Int8Array(l(e), 0, e)
}
function g(e) {
return new Int16Array(l(2 * e), 0, e)
}
function _(e) {
return new Int32Array(l(4 * e), 0, e)
}
function v(e) {
return new Float32Array(l(4 * e), 0, e)
}
function y(e) {
return new Float64Array(l(8 * e), 0, e)
}
function b(e) {
return s ? new Uint8ClampedArray(l(e), 0, e) : f(e)
}
function x(e) {
return new DataView(l(e), 0, e)
}
function w(e) {
e = n.nextPow2(e);
var t = n.log2(e),
i = h[t];
return i.length > 0 ? i.pop() : new r(e)
}
t.free = function (e) {
if (r.isBuffer(e)) h[n.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 | n.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) {
u(e.buffer)
}, t.freeArrayBuffer = u, t.freeBuffer = function (e) {
h[n.log2(e.length)].push(e)
}, t.malloc = function (e, t) {
if (void 0 === t || "arraybuffer" === t) return l(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 w(e);
case "data":
case "dataview":
return x(e);
default:
return null
}
return null
}, t.mallocArrayBuffer = l, 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 = x, t.mallocBuffer = w, t.clearCache = function () {
for (var e = 0; e < 32; ++e) a.UINT8[e].length = 0, a.UINT16[e].length = 0, a.UINT32[e].length = 0, a.INT8[e].length = 0, a.INT16[e].length = 0, a.INT32[e].length = 0, a.FLOAT[e].length = 0, a.DOUBLE[e].length = 0, a.UINT8C[e].length = 0, c[e].length = 0, h[e].length = 0
}
}).call(this, i(15), i(9).Buffer)
}, function (e, t, i) {
"use strict";
function r(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 = r, 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 n = new Array(256);
! function (e) {
for (var t = 0; t < 256; ++t) {
var i = t,
r = t,
n = 7;
for (i >>>= 1; i; i >>>= 1) r <<= 1, r |= 1 & i, --n;
e[t] = r << n & 255
}
}(n), t.reverse = function (e) {
return n[255 & e] << 24 | n[e >>> 8 & 255] << 16 | n[e >>> 16 & 255] << 8 | n[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 >>> r(e) + 1
}
}, function (e, t, i) {
"use strict";
var r = i(1),
n = i(196),
o = i(2).Buffer,
s = new Array(16);
function a() {
n.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 h(e, t, i, r, n, o, s) {
return c(e + (t & i | ~t & r) + n + o | 0, s) + t | 0
}
function u(e, t, i, r, n, o, s) {
return c(e + (t & r | i & ~r) + n + o | 0, s) + t | 0
}
function l(e, t, i, r, n, o, s) {
return c(e + (t ^ i ^ r) + n + o | 0, s) + t | 0
}
function f(e, t, i, r, n, o, s) {
return c(e + (i ^ (t | ~r)) + n + o | 0, s) + t | 0
}
r(a, n), a.prototype._update = function () {
for (var e = s, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t);
var i = this._a,
r = this._b,
n = this._c,
o = this._d;
i = h(i, r, n, o, e[0], 3614090360, 7), o = h(o, i, r, n, e[1], 3905402710, 12), n = h(n, o, i, r, e[2], 606105819, 17), r = h(r, n, o, i, e[3], 3250441966, 22), i = h(i, r, n, o, e[4], 4118548399, 7), o = h(o, i, r, n, e[5], 1200080426, 12), n = h(n, o, i, r, e[6], 2821735955, 17), r = h(r, n, o, i, e[7], 4249261313, 22), i = h(i, r, n, o, e[8], 1770035416, 7), o = h(o, i, r, n, e[9], 2336552879, 12), n = h(n, o, i, r, e[10], 4294925233, 17), r = h(r, n, o, i, e[11], 2304563134, 22), i = h(i, r, n, o, e[12], 1804603682, 7), o = h(o, i, r, n, e[13], 4254626195, 12), n = h(n, o, i, r, e[14], 2792965006, 17), i = u(i, r = h(r, n, o, i, e[15], 1236535329, 22), n, o, e[1], 4129170786, 5), o = u(o, i, r, n, e[6], 3225465664, 9), n = u(n, o, i, r, e[11], 643717713, 14), r = u(r, n, o, i, e[0], 3921069994, 20), i = u(i, r, n, o, e[5], 3593408605, 5), o = u(o, i, r, n, e[10], 38016083, 9), n = u(n, o, i, r, e[15], 3634488961, 14), r = u(r, n, o, i, e[4], 3889429448, 20), i = u(i, r, n, o, e[9], 568446438, 5), o = u(o, i, r, n, e[14], 3275163606, 9), n = u(n, o, i, r, e[3], 4107603335, 14), r = u(r, n, o, i, e[8], 1163531501, 20), i = u(i, r, n, o, e[13], 2850285829, 5), o = u(o, i, r, n, e[2], 4243563512, 9), n = u(n, o, i, r, e[7], 1735328473, 14), i = l(i, r = u(r, n, o, i, e[12], 2368359562, 20), n, o, e[5], 4294588738, 4), o = l(o, i, r, n, e[8], 2272392833, 11), n = l(n, o, i, r, e[11], 1839030562, 16), r = l(r, n, o, i, e[14], 4259657740, 23), i = l(i, r, n, o, e[1], 2763975236, 4), o = l(o, i, r, n, e[4], 1272893353, 11), n = l(n, o, i, r, e[7], 4139469664, 16), r = l(r, n, o, i, e[10], 3200236656, 23), i = l(i, r, n, o, e[13], 681279174, 4), o = l(o, i, r, n, e[0], 3936430074, 11), n = l(n, o, i, r, e[3], 3572445317, 16), r = l(r, n, o, i, e[6], 76029189, 23), i = l(i, r, n, o, e[9], 3654602809, 4), o = l(o, i, r, n, e[12], 3873151461, 11), n = l(n, o, i, r, e[15], 530742520, 16), i = f(i, r = l(r, n, o, i, e[2], 3299628645, 23), n, o, e[0], 4096336452, 6), o = f(o, i, r, n, e[7], 1126891415, 10), n = f(n, o, i, r, e[14], 2878612391, 15), r = f(r, n, o, i, e[5], 4237533241, 21), i = f(i, r, n, o, e[12], 1700485571, 6), o = f(o, i, r, n, e[3], 2399980690, 10), n = f(n, o, i, r, e[10], 4293915773, 15), r = f(r, n, o, i, e[1], 2240044497, 21), i = f(i, r, n, o, e[8], 1873313359, 6), o = f(o, i, r, n, e[15], 4264355552, 10), n = f(n, o, i, r, e[6], 2734768916, 15), r = f(r, n, o, i, e[13], 1309151649, 21), i = f(i, r, n, o, e[4], 4149444226, 6), o = f(o, i, r, n, e[11], 3174756917, 10), n = f(n, o, i, r, e[2], 718787259, 15), r = f(r, n, o, i, e[9], 3951481745, 21), this._a = this._a + i | 0, this._b = this._b + r | 0, this._c = this._c + n | 0, this._d = this._d + o | 0
}, a.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 = a
}, function (e, t, i) {
e.exports = n;
var r = i(41).EventEmitter;
function n() {
r.call(this)
}
i(1)(n, r), n.Readable = i(85), n.Writable = i(513), n.Duplex = i(514), n.Transform = i(515), n.PassThrough = i(516), n.Stream = n, n.prototype.pipe = function (e, t) {
var i = this;
function n(t) {
e.writable && !1 === e.write(t) && i.pause && i.pause()
}
function o() {
i.readable && i.resume && i.resume()
}
i.on("data", n), e.on("drain", o), e._isStdio || t && !1 === t.end || (i.on("end", a), i.on("close", c));
var s = !1;
function a() {
s || (s = !0, e.end())
}
function c() {
s || (s = !0, "function" == typeof e.destroy && e.destroy())
}
function h(e) {
if (u(), 0 === r.listenerCount(this, "error")) throw e
}
function u() {
i.removeListener("data", n), e.removeListener("drain", o), i.removeListener("end", a), i.removeListener("close", c), i.removeListener("error", h), e.removeListener("error", h), i.removeListener("end", u), i.removeListener("close", u), e.removeListener("close", u)
}
return i.on("error", h), e.on("error", h), i.on("end", u), i.on("close", u), e.on("close", u), e.emit("pipe", i), e
}
}, function (e, t, i) {
"use strict";
var r = i(9).Buffer,
n = i(1),
o = i(196),
s = new Array(16),
a = [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],
h = [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],
u = [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],
l = [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, r, n, o, s, a) {
return p(e + (t ^ i ^ r) + o + s | 0, a) + n | 0
}
function g(e, t, i, r, n, o, s, a) {
return p(e + (t & i | ~t & r) + o + s | 0, a) + n | 0
}
function _(e, t, i, r, n, o, s, a) {
return p(e + ((t | ~i) ^ r) + o + s | 0, a) + n | 0
}
function v(e, t, i, r, n, o, s, a) {
return p(e + (t & r | i & ~r) + o + s | 0, a) + n | 0
}
function y(e, t, i, r, n, o, s, a) {
return p(e + (t ^ (i | ~r)) + o + s | 0, a) + n | 0
}
n(d, o), d.prototype._update = function () {
for (var e = s, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t);
for (var i = 0 | this._a, r = 0 | this._b, n = 0 | this._c, o = 0 | this._d, d = 0 | this._e, b = 0 | this._a, x = 0 | this._b, w = 0 | this._c, S = 0 | this._d, T = 0 | this._e, A = 0; A < 80; A += 1) {
var M, E;
A < 16 ? (M = m(i, r, n, o, d, e[a[A]], l[0], h[A]), E = y(b, x, w, S, T, e[c[A]], f[0], u[A])) : A < 32 ? (M = g(i, r, n, o, d, e[a[A]], l[1], h[A]), E = v(b, x, w, S, T, e[c[A]], f[1], u[A])) : A < 48 ? (M = _(i, r, n, o, d, e[a[A]], l[2], h[A]), E = _(b, x, w, S, T, e[c[A]], f[2], u[A])) : A < 64 ? (M = v(i, r, n, o, d, e[a[A]], l[3], h[A]), E = g(b, x, w, S, T, e[c[A]], f[3], u[A])) : (M = y(i, r, n, o, d, e[a[A]], l[4], h[A]), E = m(b, x, w, S, T, e[c[A]], f[4], u[A])), i = d, d = o, o = p(n, 10), n = r, r = M, b = T, T = S, S = p(w, 10), w = x, x = E
}
var P = this._b + n + S | 0;
this._b = this._c + o + T | 0, this._c = this._d + d + b | 0, this._d = this._e + i + x | 0, this._e = this._a + r + w | 0, this._a = P
}, 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 = r.alloc ? r.alloc(20) : new r(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(517), t.sha1 = i(518), t.sha224 = i(519), t.sha256 = i(197), t.sha384 = i(520), t.sha512 = i(198)
}, function (e, t, i) {
"use strict";
t.utils = i(526), t.Cipher = i(527), t.DES = i(528), t.CBC = i(529), t.EDE = i(530)
}, function (e, t, i) {
var r = i(531),
n = i(539),
o = i(208);
t.createCipher = t.Cipher = r.createCipher, t.createCipheriv = t.Cipheriv = r.createCipheriv, t.createDecipher = t.Decipher = n.createDecipher, t.createDecipheriv = t.Decipheriv = n.createDecipheriv, t.listCiphers = t.getCiphers = function () {
return Object.keys(o)
}
}, function (e, t, i) {
var r = {
ECB: i(532),
CBC: i(533),
CFB: i(534),
CFB8: i(535),
CFB1: i(536),
OFB: i(537),
CTR: i(206),
GCM: i(206)
},
n = i(208);
for (var o in n) n[o].module = r[n[o].mode];
e.exports = n
}, function (e, t, i) {
(function (t) {
var r = i(11),
n = i(53);
function o(e, i) {
var n = function (e) {
var t = s(e);
return {
blinder: t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed(),
unblinder: t.invm(e.modulus)
}
}(i),
o = i.modulus.byteLength(),
a = (r.mont(i.modulus), new r(e).mul(n.blinder).umod(i.modulus)),
c = a.toRed(r.mont(i.prime1)),
h = a.toRed(r.mont(i.prime2)),
u = i.coefficient,
l = i.prime1,
f = i.prime2,
d = c.redPow(i.exponent1),
p = h.redPow(i.exponent2);
d = d.fromRed(), p = p.fromRed();
var m = d.isub(p).imul(u).umod(l);
return m.imul(f), p.iadd(m), new t(p.imul(n.unblinder).umod(i.modulus).toArray(!1, o))
}
function s(e) {
for (var t = e.modulus.byteLength(), i = new r(n(t)); i.cmp(e.modulus) >= 0 || !i.umod(e.prime1) || !i.umod(e.prime2);) i = new r(n(t));
return i
}
e.exports = o, o.getr = s
}).call(this, i(9).Buffer)
}, function (e, t, i) {
var r = t;
r.utils = i(33), r.common = i(71), r.sha = i(555), r.ripemd = i(559), r.hmac = i(560), r.sha1 = r.sha.sha1, r.sha256 = r.sha.sha256, r.sha224 = r.sha.sha224, r.sha384 = r.sha.sha384, r.sha512 = r.sha.sha512, r.ripemd160 = r.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 = !1;
try {
(new RTCPeerConnection).ondatachannel = function (e) {}, this.isWebRTCSupported = !0
} catch (e) {}
this.isWebGLSupported = !1;
var t = document.createElement("canvas"),
i = t.getContext("webgl") || t.getContext("experimental-webgl");
i && i instanceof WebGLRenderingContext && (this.isWebGLSupported = !0), this.isMobile = !1, new RegExp("Android|webOS|iPhone|iPad|BlackBerry|Windows Phone|Opera Mini|IEMobile|Mobile", "i").test(navigator.userAgent) && (this.isMobile = !0)
}
}, function (e, t, i) {
"use strict";
(function (e) {
var r = i(93),
n = i.n(r),
o = i(55),
s = i(18),
a = i(7);
function c(e, t, i) {
return t in e ? Object.defineProperty(e, t, {
value: i,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = i, e
}
function h(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
var u = 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 r = this;
this.changedBlockHandler = {
setBlock: function (e, t) {
var i = {
add: !1,
p: e.slice(),
bt: t
};
a.default.getInstance().addBlockChange(i), r.changedBlocks.push(i)
},
addBlock: function (e, t) {
var i = {
add: !0,
p: e.slice(),
bt: t
};
a.default.getInstance().addBlockChange(i), r.changedBlocks.push(i)
}
}, setInterval(function () {
i.update()
}, 50)
}
var i, r, u;
return i = t, (r = [{
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: !1,
peer: {
send: function () {}
}
});
t[e.name] = i, this.state = {
name: e.name,
players: t,
code: null,
gameStarted: !1,
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, r) {
s.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, r) {
i.getOpenGame(t).then(function (t) {
i.setState({
code: t
}), e(t), s.a.createSignalingChannel(t, "host").then(function () {
s.a.listenForData(t, function (e) {
void 0 !== e.payload.signal && i.handlePlayerSignaling(e, t)
})
})
})
})
}
}, {
key: "handlePlayerSignaling",
value: function (e, t) {
var i = this,
r = e.from.split("/")[1];
if (void 0 === this.state.players[r]) {
var a = new n.a({
initiator: !1
});
a.signal(e.payload.signal), a.on("signal", function (e) {
s.a.sendSignalingTo(t, r, "host", e)
});
var c = this.copyPlayers();
c[r] = new o.a({
name: r,
peer: a
}), this.setState({
players: c
}, function () {
i.broadcastPlayers()
}), a.on("connect", function () {
var e = i.playersToArray().length,
t = e > i.maxPlayers;
i.sendWelcomeInfo(a, t, e), t && u(!1)
}), a.on("data", function (e) {
i.handleData(r, JSON.parse(e))
});
var h = this,
u = function (e) {
var t = Object.assign({}, h.state.players);
void 0 !== t[r] && (void 0 !== t[r].noaPlayer && t[r].noaPlayer.remove(), e && t[r].state.spawned && h.sendLeftMessage(t[r].state.name), delete t[r], h.setState({
players: t
}), a.destroy())
};
a.on("close", function () {
u(!0)
}), a.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: a.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] : {},
r = Object.keys(i);
"function" == typeof Object.getOwnPropertySymbols && (r = r.concat(Object.getOwnPropertySymbols(i).filter(function (e) {
return Object.getOwnPropertyDescriptor(i, e).enumerable
}))), r.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)
}
}]) && h(i.prototype, r), u && h(i, u), t
}();
t.a = u
}).call(this, i(52))
}, 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 r = i(5),
n = i(14),
o = i(46),
s = i(97),
a = i(12).f;
e.exports = function (e) {
var t = n.Symbol || (n.Symbol = o ? {} : r.Symbol || {});
"_" == e.charAt(0) || e in t || a(t, e, {
value: s.f(e)
})
}
}, function (e, t, i) {
var r = i(22),
n = i(24),
o = i(74)(!1),
s = i(98)("IE_PROTO");
e.exports = function (e, t) {
var i, a = n(e),
c = 0,
h = [];
for (i in a) i != s && r(a, i) && h.push(i);
for (; t.length > c;) r(a, i = t[c++]) && (~o(h, i) || h.push(i));
return h
}
}, function (e, t, i) {
var r = i(12),
n = i(4),
o = i(47);
e.exports = i(13) ? Object.defineProperties : function (e, t) {
n(e);
for (var i, s = o(t), a = s.length, c = 0; a > c;) r.f(e, i = s[c++], t[i]);
return e
}
}, function (e, t, i) {
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 n = i(24),
o = i(50).f,
s = {}.toString,
a = "object" == ("undefined" == typeof window ? "undefined" : r(window)) && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
e.exports.f = function (e) {
return a && "[object Window]" == s.call(e) ? function (e) {
try {
return o(e)
} catch (e) {
return a.slice()
}
}(e) : o(n(e))
}
}, function (e, t, i) {
"use strict";
var r = i(47),
n = i(75),
o = i(65),
s = i(20),
a = i(64),
c = Object.assign;
e.exports = !c || i(3)(function () {
var e = {},
t = {},
i = Symbol(),
r = "abcdefghijklmnopqrst";
return e[i] = 7, r.split("").forEach(function (e) {
t[e] = e
}), 7 != c({}, e)[i] || Object.keys(c({}, t)).join("") != r
}) ? function (e, t) {
for (var i = s(e), c = arguments.length, h = 1, u = n.f, l = o.f; c > h;)
for (var f, d = a(arguments[h++]), p = u ? r(d).concat(u(d)) : r(d), m = p.length, g = 0; m > g;) l.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 r = i(35),
n = i(6),
o = i(145),
s = [].slice,
a = {};
e.exports = Function.bind || function (e) {
var t = r(this),
i = s.call(arguments, 1),
c = function r() {
var n = i.concat(s.call(arguments));
return this instanceof r ? function (e, t, i) {
if (!(t in a)) {
for (var r = [], n = 0; n < t; n++) r[n] = "a[" + n + "]";
a[t] = Function("F,a", "return new F(" + r.join(",") + ")")
}
return a[t](e, i)
}(t, n.length, n) : o(t, n, e)
};
return n(t.prototype) && (c.prototype = t.prototype), c
}
}, function (e, t) {
e.exports = function (e, t, i) {
var r = void 0 === i;
switch (t.length) {
case 0:
return r ? e() : e.call(i);
case 1:
return r ? e(t[0]) : e.call(i, t[0]);
case 2:
return r ? e(t[0], t[1]) : e.call(i, t[0], t[1]);
case 3:
return r ? e(t[0], t[1], t[2]) : e.call(i, t[0], t[1], t[2]);
case 4:
return r ? 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 r = i(5).parseInt,
n = i(76).trim,
o = i(103),
s = /^[-+]?0[xX]/;
e.exports = 8 !== r(o + "08") || 22 !== r(o + "0x16") ? function (e, t) {
var i = n(String(e), 3);
return r(i, t >>> 0 || (s.test(i) ? 16 : 10))
} : r
}, function (e, t, i) {
var r = i(5).parseFloat,
n = i(76).trim;
e.exports = 1 / r(i(103) + "-0") != -1 / 0 ? function (e) {
var t = n(String(e), 3),
i = r(t);
return 0 === i && "-" == t.charAt(0) ? -0 : i
} : r
}, function (e, t, i) {
var r = i(36);
e.exports = function (e, t) {
if ("number" != typeof e && "Number" != r(e)) throw TypeError(t);
return +e
}
}, function (e, t, i) {
var r = i(6),
n = Math.floor;
e.exports = function (e) {
return !r(e) && isFinite(e) && n(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 r = i(49),
n = i(44),
o = i(56),
s = {};
i(23)(s, i(8)("iterator"), function () {
return this
}), e.exports = function (e, t, i) {
e.prototype = r(s, {
next: n(1, i)
}), o(e, t + " Iterator")
}
}, function (e, t, i) {
var r = i(4);
e.exports = function (e, t, i, n) {
try {
return n ? t(r(i)[0], i[1]) : t(i)
} catch (t) {
var o = e.return;
throw void 0 !== o && r(o.call(e)), t
}
}
}, function (e, t, i) {
var r = i(35),
n = i(20),
o = i(64),
s = i(10);
e.exports = function (e, t, i, a, c) {
r(t);
var h = n(e),
u = o(h),
l = s(h.length),
f = c ? l - 1 : 0,
d = c ? -1 : 1;
if (i < 2)
for (;;) {
if (f in u) {
a = u[f], f += d;
break
}
if (f += d, c ? f < 0 : l <= f) throw TypeError("Reduce of empty array with no initial value")
}
for (; c ? f >= 0 : l > f; f += d) f in u && (a = t(a, u[f], f, h));
return a
}
}, function (e, t, i) {
"use strict";
var r = i(20),
n = i(48),
o = i(10);
e.exports = [].copyWithin || function (e, t) {
var i = r(this),
s = o(i.length),
a = n(e, s),
c = n(t, s),
h = arguments.length > 2 ? arguments[2] : void 0,
u = Math.min((void 0 === h ? s : n(h, s)) - c, s - a),
l = 1;
for (c < a && a < c + u && (l = -1, c += u - 1, a += u - 1); u-- > 0;) c in i ? i[a] = i[c] : delete i[a], a += l, c += l;
return i
}
}, function (e, t) {
e.exports = function (e, t) {
return {
value: t,
done: !!e
}
}
}, function (e, t, i) {
"use strict";
var r = i(118);
i(0)({
target: "RegExp",
proto: !0,
forced: r !== /./.exec
}, {
exec: r
})
}, function (e, t, i) {
i(13) && "g" != /./g.flags && i(12).f(RegExp.prototype, "flags", {
configurable: !0,
get: i(78)
})
}, function (e, t, i) {
"use strict";
var r, n, o, s, a = i(46),
c = i(5),
h = i(34),
u = i(66),
l = 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(159),
b = i(343),
x = i(82),
w = i(160),
S = c.TypeError,
T = c.process,
A = T && T.versions,
M = A && A.v8 || "",
E = c.Promise,
P = "process" == u(T),
C = function () {},
R = n = y.f,
I = !! function () {
try {
var e = E.resolve(1),
t = (e.constructor = {})[i(8)("species")] = function (e) {
e(C, C)
};
return (P || "function" == typeof PromiseRejectionEvent) && e.then(C) instanceof t && 0 !== M.indexOf("6.6") && -1 === x.indexOf("Chrome/66")
} catch (e) {}
}(),
D = function (e) {
var t;
return !(!f(e) || "function" != typeof (t = e.then)) && t
},
O = function (e, t) {
if (!e._n) {
e._n = !0;
var i = e._c;
v(function () {
for (var r = e._v, n = 1 == e._s, o = 0, s = function (t) {
var i, o, s, a = n ? t.ok : t.fail,
c = t.resolve,
h = t.reject,
u = t.domain;
try {
a ? (n || (2 == e._h && B(e), e._h = 1), !0 === a ? i = r : (u && u.enter(), i = a(r), u && (u.exit(), s = !0)), i === t.promise ? h(S("Promise-chain cycle")) : (o = D(i)) ? o.call(i, c, h) : c(i)) : h(r)
} catch (e) {
u && !s && u.exit(), h(e)
}
}; i.length > o;) s(i[o++]);
e._c = [], e._n = !1, t && !e._h && L(e)
})
}
},
L = function (e) {
_.call(c, function () {
var t, i, r, n = e._v,
o = F(e);
if (o && (t = b(function () {
P ? T.emit("unhandledRejection", n, e) : (i = c.onunhandledrejection) ? i({
promise: e,
reason: n
}) : (r = c.console) && r.error && r.error("Unhandled promise rejection", n)
}), e._h = P || 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;
P ? T.emit("rejectionHandled", e) : (t = c.onrejectionhandled) && t({
promise: e,
reason: e._v
})
})
},
k = function (e) {
var t = this;
t._d || (t._d = !0, (t = t._w || t)._v = e, t._s = 2, t._a || (t._a = t._c.slice()), O(t, !0))
},
V = function e(t) {
var i, r = this;
if (!r._d) {
r._d = !0, r = r._w || r;
try {
if (r === t) throw S("Promise can't be resolved itself");
(i = D(t)) ? v(function () {
var n = {
_w: r,
_d: !1
};
try {
i.call(t, h(e, n, 1), h(k, n, 1))
} catch (e) {
k.call(n, e)
}
}): (r._v = t, r._s = 1, O(r, !1))
} catch (e) {
k.call({
_w: r,
_d: !1
}, e)
}
}
};
I || (E = function (e) {
p(this, E, "Promise", "_h"), d(e), r.call(this);
try {
e(h(V, this, 1), h(k, this, 1))
} catch (e) {
k.call(this, e)
}
}, (r = function (e) {
this._c = [], this._a = void 0, this._s = 0, this._d = !1, this._v = void 0, this._h = 0, this._n = !1
}).prototype = i(61)(E.prototype, {
then: function (e, t) {
var i = R(g(this, E));
return i.ok = "function" != typeof e || e, i.fail = "function" == typeof t && t, i.domain = P ? T.domain : void 0, this._c.push(i), this._a && this._a.push(i), this._s && O(this, !1), i.promise
},
catch: function (e) {
return this.then(void 0, e)
}
}), o = function () {
var e = new r;
this.promise = e, this.resolve = h(V, e, 1), this.reject = h(k, e, 1)
}, y.f = R = function (e) {
return e === E || e === s ? new o(e) : n(e)
}), l(l.G + l.W + l.F * !I, {
Promise: E
}), i(56)(E, "Promise"), i(59)("Promise"), s = i(14).Promise, l(l.S + l.F * !I, "Promise", {
reject: function (e) {
var t = R(this);
return (0, t.reject)(e), t.promise
}
}), l(l.S + l.F * (a || !I), "Promise", {
resolve: function (e) {
return w(a && this === s ? E : this, e)
}
}), l(l.S + l.F * !(I && i(77)(function (e) {
E.all(e).catch(C)
})), "Promise", {
all: function (e) {
var t = this,
i = R(t),
r = i.resolve,
n = i.reject,
o = b(function () {
var i = [],
o = 0,
s = 1;
m(e, !1, function (e) {
var a = o++,
c = !1;
i.push(void 0), s++, t.resolve(e).then(function (e) {
c || (c = !0, i[a] = e, --s || r(i))
}, n)
}), --s || r(i)
});
return o.e && n(o.v), i.promise
},
race: function (e) {
var t = this,
i = R(t),
r = i.reject,
n = b(function () {
m(e, !1, function (e) {
t.resolve(e).then(i.resolve, r)
})
});
return n.e && r(n.v), i.promise
}
})
}, function (e, t, i) {
"use strict";
var r = i(35);
function n(e) {
var t, i;
this.promise = new e(function (e, r) {
if (void 0 !== t || void 0 !== i) throw TypeError("Bad Promise constructor");
t = e, i = r
}), this.resolve = r(t), this.reject = r(i)
}
e.exports.f = function (e) {
return new n(e)
}
}, function (e, t, i) {
var r = i(4),
n = i(6),
o = i(159);
e.exports = function (e, t) {
if (r(e), n(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 r = i(12).f,
n = i(49),
o = i(61),
s = i(34),
a = i(60),
c = i(81),
h = i(109),
u = i(155),
l = i(59),
f = i(13),
d = i(40).fastKey,
p = i(62),
m = f ? "_s" : "size",
g = function (e, t) {
var i, r = d(t);
if ("F" !== r) return e._i[r];
for (i = e._f; i; i = i.n)
if (i.k == t) return i
};
e.exports = {
getConstructor: function (e, t, i, h) {
var u = e(function (e, r) {
a(e, u, t, "_i"), e._t = t, e._i = n(null), e._f = void 0, e._l = void 0, e[m] = 0, null != r && c(r, i, e[h], e)
});
return o(u.prototype, {
clear: function () {
for (var e = p(this, t), i = e._i, r = e._f; r; r = r.n) r.r = !0, r.p && (r.p = r.p.n = void 0), delete i[r.i];
e._f = e._l = void 0, e[m] = 0
},
delete: function (e) {
var i = p(this, t),
r = g(i, e);
if (r) {
var n = r.n,
o = r.p;
delete i._i[r.i], r.r = !0, o && (o.n = n), n && (n.p = o), i._f == r && (i._f = n), i._l == r && (i._l = o), i[m]--
}
return !!r
},
forEach: function (e) {
p(this, t);
for (var i, r = s(e, arguments.length > 1 ? arguments[1] : void 0, 3); i = i ? i.n : this._f;)
for (r(i.v, i.k, this); i && i.r;) i = i.p
},
has: function (e) {
return !!g(p(this, t), e)
}
}), f && r(u.prototype, "size", {
get: function () {
return p(this, t)[m]
}
}), u
},
def: function (e, t, i) {
var r, n, o = g(e, t);
return o ? o.v = i : (e._l = o = {
i: n = d(t, !0),
k: t,
v: i,
p: r = e._l,
n: void 0,
r: !1
}, e._f || (e._f = o), r && (r.n = o), e[m]++, "F" !== n && (e._i[n] = o)), e
},
getEntry: g,
setStrong: function (e, t, i) {
h(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) ? u(0, "keys" == e ? t.k : "values" == e ? t.v : [t.k, t.v]) : (this._t = void 0, u(1))
}, i ? "entries" : "values", !i, !0), l(t)
}
}
}, function (e, t, i) {
"use strict";
var r = i(61),
n = i(40).getWeak,
o = i(4),
s = i(6),
a = i(60),
c = i(81),
h = i(31),
u = i(22),
l = i(62),
f = h(5),
d = h(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 h = e(function (e, r) {
a(e, h, t, "_i"), e._t = t, e._i = p++, e._l = void 0, null != r && c(r, i, e[o], e)
});
return r(h.prototype, {
delete: function (e) {
if (!s(e)) return !1;
var i = n(e);
return !0 === i ? m(l(this, t)).delete(e) : i && u(i, this._i) && delete i[this._i]
},
has: function (e) {
if (!s(e)) return !1;
var i = n(e);
return !0 === i ? m(l(this, t)).has(e) : i && u(i, this._i)
}
}), h
},
def: function (e, t, i) {
var r = n(o(t), !0);
return !0 === r ? m(e).set(t, i) : r[e._i] = i, e
},
ufstore: m
}
}, function (e, t, i) {
var r = i(28),
n = i(10);
e.exports = function (e) {
if (void 0 === e) return 0;
var t = r(e),
i = n(t);
if (t !== i) throw RangeError("Wrong length!");
return i
}
}, function (e, t, i) {
var r = i(50),
n = i(75),
o = i(4),
s = i(5).Reflect;
e.exports = s && s.ownKeys || function (e) {
var t = r.f(o(e)),
i = n.f;
return i ? t.concat(i(e)) : t
}
}, function (e, t, i) {
var r = i(10),
n = i(105),
o = i(37);
e.exports = function (e, t, i, s) {
var a = String(o(e)),
c = a.length,
h = void 0 === i ? " " : String(i),
u = r(t);
if (u <= c || "" == h) return a;
var l = u - c,
f = n.call(h, Math.ceil(l / h.length));
return f.length > l && (f = f.slice(0, l)), s ? f + a : a + f
}
}, function (e, t, i) {
var r = i(47),
n = i(24),
o = i(65).f;
e.exports = function (e) {
return function (t) {
for (var i, s = n(t), a = r(s), c = a.length, h = 0, u = []; c > h;) o.call(s, i = a[h++]) && u.push(e ? [i, s[i]] : s[i]);
return u
}
}
}, function (e, t) {
e.exports = function (e) {
return e.webpackPolyfill || (e.deprecate = function () {}, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", {
enumerable: !0,
get: function () {
return e.l
}
}), Object.defineProperty(e, "id", {
enumerable: !0,
get: function () {
return e.i
}
}), e.webpackPolyfill = 1), e
}
}, 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, r) {
var n = i(86);
e.exports = y;
var o, s = i(168);
y.ReadableState = v;
i(41).EventEmitter;
var a = function (e, t) {
return e.listeners(t).length
},
c = i(170),
h = i(2).Buffer,
u = t.Uint8Array || function () {};
var l = i(68);
l.inherits = i(1);
var f = i(403),
d = void 0;
d = f && f.debuglog ? f.debuglog("stream") : function () {};
var p, m = i(404),
g = i(171);
l.inherits(y, c);
var _ = ["error", "close", "destroy", "pause", "resume"];
function v(e, t) {
e = e || {};
var r = t instanceof(o = o || i(54));
this.objectMode = !!e.objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode);
var n = e.highWaterMark,
s = e.readableHighWaterMark,
a = this.objectMode ? 16 : 16384;
this.highWaterMark = n || 0 === n ? n : r && (s || 0 === s) ? s : a, this.highWaterMark = Math.floor(this.highWaterMark), this.buffer = new m, this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.destroyed = !1, this.defaultEncoding = e.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, e.encoding && (p || (p = i(123).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 = !0, 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, r, n) {
var o, s = e._readableState;
null === t ? (s.reading = !1, 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 = !0, T(e)
}(e, s)) : (n || (o = function (e, t) {
var i;
r = t, h.isBuffer(r) || r instanceof u || "string" == typeof t || void 0 === t || e.objectMode || (i = new TypeError("Invalid non-string/buffer chunk"));
var r;
return i
}(s, t)), o ? e.emit("error", o) : s.objectMode || t && t.length > 0 ? ("string" == typeof t || s.objectMode || Object.getPrototypeOf(t) === h.prototype || (t = function (e) {
return h.from(e)
}(t)), r ? s.endEmitted ? e.emit("error", new Error("stream.unshift() after end event")) : x(e, s, t, !0) : s.ended ? e.emit("error", new Error("stream.push() after EOF")) : (s.reading = !1, s.decoder && !i ? (t = s.decoder.write(t), s.objectMode || 0 !== t.length ? x(e, s, t, !1) : M(e, s)) : x(e, s, t, !1))) : r || (s.reading = !1));
return function (e) {
return !e.ended && (e.needReadable || e.length < e.highWaterMark || 0 === e.length)
}(s)
}
function x(e, t, i, r) {
t.flowing && 0 === t.length && !t.sync ? (e.emit("data", i), e.read(0)) : (t.length += t.objectMode ? 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && T(e)), M(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, r = this._readableState;
return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r.encoding && (e = h.from(e, t), t = ""), i = !0), b(this, e, t, !1, i)
}, y.prototype.unshift = function (e) {
return b(this, e, null, !0, !1)
}, y.prototype.isPaused = function () {
return !1 === this._readableState.flowing
}, y.prototype.setEncoding = function (e) {
return p || (p = i(123).StringDecoder), this._readableState.decoder = new p(e), this._readableState.encoding = e, this
};
var w = 8388608;
function S(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 >= w ? e = w : (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 = !0, 0))
}
function T(e) {
var t = e._readableState;
t.needReadable = !1, t.emittedReadable || (d("emitReadable", t.flowing), t.emittedReadable = !0, t.sync ? n.nextTick(A, e) : A(e))
}
function A(e) {
d("emit readable"), e.emit("readable"), R(e)
}
function M(e, t) {
t.readingMore || (t.readingMore = !0, n.nextTick(E, e, t))
}
function E(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 = !1
}
function P(e) {
d("readable nexttick read 0"), e.read(0)
}
function C(e, t) {
t.reading || (d("resume read 0"), e.read(0)), t.resumeScheduled = !1, t.awaitDrain = 0, e.emit("resume"), R(e), t.flowing && !t.reading && e.read(0)
}
function R(e) {
var t = e._readableState;
for (d("flow", t.flowing); t.flowing && null !== e.read(););
}
function I(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 r;
e < t.head.data.length ? (r = t.head.data.slice(0, e), t.head.data = t.head.data.slice(e)) : r = e === t.head.data.length ? t.shift() : i ? function (e, t) {
var i = t.head,
r = 1,
n = i.data;
e -= n.length;
for (; i = i.next;) {
var o = i.data,
s = e > o.length ? o.length : e;
if (s === o.length ? n += o : n += o.slice(0, e), 0 === (e -= s)) {
s === o.length ? (++r, i.next ? t.head = i.next : t.head = t.tail = null) : (t.head = i, i.data = o.slice(s));
break
}++r
}
return t.length -= r, n
}(e, t) : function (e, t) {
var i = h.allocUnsafe(e),
r = t.head,
n = 1;
r.data.copy(i), e -= r.data.length;
for (; r = r.next;) {
var o = r.data,
s = e > o.length ? o.length : e;
if (o.copy(i, i.length - e, 0, s), 0 === (e -= s)) {
s === o.length ? (++n, r.next ? t.head = r.next : t.head = t.tail = null) : (t.head = r, r.data = o.slice(s));
break
}++n
}
return t.length -= n, i
}(e, t);
return r
}(e, t.buffer, t.decoder), i);
var i
}
function D(e) {
var t = e._readableState;
if (t.length > 0) throw new Error('"endReadable()" called on non-empty stream');
t.endEmitted || (t.ended = !0, n.nextTick(O, t, e))
}
function O(e, t) {
e.endEmitted || 0 !== e.length || (e.endEmitted = !0, t.readable = !1, t.emit("end"))
}
function L(e, t) {
for (var i = 0, r = e.length; i < r; 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 = !1), 0 === e && t.needReadable && (t.length >= t.highWaterMark || t.ended)) return d("read: emitReadable", t.length, t.ended), 0 === t.length && t.ended ? D(this) : T(this), null;
if (0 === (e = S(e, t)) && t.ended) return 0 === t.length && D(this), null;
var r, n = t.needReadable;
return d("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && d("length less than watermark", n = !0), t.ended || t.reading ? d("reading or ended", n = !1) : n && (d("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this._read(t.highWaterMark), t.sync = !1, t.reading || (e = S(i, t))), null === (r = e > 0 ? I(e, t) : null) ? (t.needReadable = !0, e = 0) : t.length -= e, 0 === t.length && (t.ended || (t.needReadable = !0), i !== e && t.ended && D(this)), null !== r && this.emit("data", r), r
}, 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 || !1 !== t.end) && e !== r.stdout && e !== r.stderr ? u : y;
function h(t, r) {
d("onunpipe"), t === i && r && !1 === r.hasUnpiped && (r.hasUnpiped = !0, d("cleanup"), e.removeListener("close", _), e.removeListener("finish", v), e.removeListener("drain", l), e.removeListener("error", g), e.removeListener("unpipe", h), i.removeListener("end", u), i.removeListener("end", y), i.removeListener("data", m), f = !0, !o.awaitDrain || e._writableState && !e._writableState.needDrain || l())
}
function u() {
d("onend"), e.end()
}
o.endEmitted ? n.nextTick(c) : i.once("end", c), e.on("unpipe", h);
var l = function (e) {
return function () {
var t = e._readableState;
d("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && a(e, "data") && (t.flowing = !0, R(e))
}
}(i);
e.on("drain", l);
var f = !1;
var p = !1;
function m(t) {
d("ondata"), p = !1, !1 !== 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 = !0), i.pause())
}
function g(t) {
d("onerror", t), y(), e.removeListener("error", g), 0 === a(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] ? s(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: !1
};
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 = !1, e && e.emit("unpipe", this, i), this);
if (!e) {
var r = t.pipes,
n = t.pipesCount;
t.pipes = null, t.pipesCount = 0, t.flowing = !1;
for (var o = 0; o < n; o++) r[o].emit("unpipe", this, i);
return this
}
var s = L(t.pipes, e);
return -1 === s ? this : (t.pipes.splice(s, 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) !1 !== this._readableState.flowing && this.resume();
else if ("readable" === e) {
var r = this._readableState;
r.endEmitted || r.readableListening || (r.readableListening = r.needReadable = !0, r.emittedReadable = !1, r.reading ? r.length && T(this) : n.nextTick(P, this))
}
return i
}, y.prototype.addListener = y.prototype.on, y.prototype.resume = function () {
var e = this._readableState;
return e.flowing || (d("resume"), e.flowing = !0, function (e, t) {
t.resumeScheduled || (t.resumeScheduled = !0, n.nextTick(C, e, t))
}(this, e)), this
}, y.prototype.pause = function () {
return d("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (d("pause"), this._readableState.flowing = !1, this.emit("pause")), this
}, y.prototype.wrap = function (e) {
var t = this,
i = this._readableState,
r = !1;
for (var n 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 (n) {
(d("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n) || (i.objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause()))
}), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function (t) {
return function () {
return e[t].apply(e, arguments)
}
}(n));
for (var o = 0; o < _.length; o++) e.on(_[o], this.emit.bind(this, _[o]));
return this._read = function (t) {
d("wrapped _read", t), r && (r = !1, e.resume())
}, this
}, Object.defineProperty(y.prototype, "readableHighWaterMark", {
enumerable: !1,
get: function () {
return this._readableState.highWaterMark
}
}), y._fromList = I
}).call(this, i(15), i(27))
}, function (e, t, i) {
e.exports = i(41).EventEmitter
}, function (e, t, i) {
"use strict";
var r = i(86);
function n(e, t) {
e.emit("error", t)
}
e.exports = {
destroy: function (e, t) {
var i = this,
o = this._readableState && this._readableState.destroyed,
s = this._writableState && this._writableState.destroyed;
return o || s ? (t ? t(e) : !e || this._writableState && this._writableState.errorEmitted || r.nextTick(n, this, e), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(e || null, function (e) {
!t && e ? (r.nextTick(n, i, e), i._writableState && (i._writableState.errorEmitted = !0)) : t && t(e)
}), this)
},
undestroy: function () {
this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1)
}
}
}, function (e, t, i) {
"use strict";
e.exports = s;
var r = i(54),
n = i(68);
function o(e, t) {
var i = this._transformState;
i.transforming = !1;
var r = i.writecb;
if (!r) return this.emit("error", new Error("write callback called multiple times"));
i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e);
var n = this._readableState;
n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
}
function s(e) {
if (!(this instanceof s)) return new s(e);
r.call(this, e), this._transformState = {
afterTransform: o.bind(this),
needTransform: !1,
transforming: !1,
writecb: null,
writechunk: null,
writeencoding: null
}, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e.transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush)), this.on("prefinish", a)
}
function a() {
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)
}
n.inherits = i(1), n.inherits(s, r), s.prototype.push = function (e, t) {
return this._transformState.needTransform = !1, r.prototype.push.call(this, e, t)
}, s.prototype._transform = function (e, t, i) {
throw new Error("_transform() is not implemented")
}, s.prototype._write = function (e, t, i) {
var r = this._transformState;
if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) {
var n = this._readableState;
(r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
}
}, s.prototype._read = function (e) {
var t = this._transformState;
null !== t.writechunk && t.writecb && !t.transforming ? (t.transforming = !0, this._transform(t.writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = !0
}, s.prototype._destroy = function (e, t) {
var i = this;
r.prototype._destroy.call(this, e, function (e) {
t(e), i.emit("close")
})
}
}, function (e, t) {
e.exports = 1e-6
}, function (e, t) {
e.exports = function () {
var e = new Float32Array(3);
return e[0] = 0, e[1] = 0, e[2] = 0, e
}
}, function (e, t) {
e.exports = function (e, t, i) {
var r = new Float32Array(3);
return r[0] = e, r[1] = t, r[2] = i, r
}
}, function (e, t) {
e.exports = function (e, t) {
var i = t[0],
r = t[1],
n = t[2],
o = i * i + r * r + n * n;
o > 0 && (o = 1 / Math.sqrt(o), e[0] = t[0] * o, e[1] = t[1] * o, e[2] = t[2] * o);
return e
}
}, function (e, t) {
e.exports = function (e, t) {
return e[0] * t[0] + e[1] * t[1] + e[2] * t[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],
r = t[1] - e[1],
n = t[2] - e[2];
return Math.sqrt(i * i + r * r + n * n)
}
}, function (e, t) {
e.exports = function (e, t) {
var i = t[0] - e[0],
r = t[1] - e[1],
n = t[2] - e[2];
return i * i + r * r + n * n
}
}, function (e, t) {
e.exports = function (e) {
var t = e[0],
i = e[1],
r = e[2];
return Math.sqrt(t * t + i * i + r * r)
}
}, function (e, t) {
e.exports = function (e) {
var t = e[0],
i = e[1],
r = e[2];
return t * t + i * i + r * r
}
}, 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, r) {
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 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 r = arguments, n = r.length, s = String(e).replace(o, function (e) {
if ("%%" === e) return "%";
if (i >= n) return e;
switch (e) {
case "%s":
return String(r[i++]);
case "%d":
return Number(r[i++]);
case "%j":
try {
return JSON.stringify(r[i++])
} catch (e) {
return "[Circular]"
}
default:
return e
}
}), a = r[i]; i < n; a = r[++i]) g(a) || !x(a) ? s += " " + a : s += " " + c(a);
return s
}, t.deprecate = function (i, n) {
if (y(e.process)) return function () {
return t.deprecate(i, n).apply(this, arguments)
};
if (!0 === r.noDeprecation) return i;
var o = !1;
return function () {
if (!o) {
if (r.throwDeprecation) throw new Error(n);
r.traceDeprecation ? console.trace(n) : console.error(n), o = !0
}
return i.apply(this, arguments)
}
};
var s, a = {};
function c(e, i) {
var r = {
seen: [],
stylize: u
};
return arguments.length >= 3 && (r.depth = arguments[2]), arguments.length >= 4 && (r.colors = arguments[3]), m(i) ? r.showHidden = i : i && t._extend(r, i), y(r.showHidden) && (r.showHidden = !1), y(r.depth) && (r.depth = 2), y(r.colors) && (r.colors = !1), y(r.customInspect) && (r.customInspect = !0), r.colors && (r.stylize = h), l(r, e, r.depth)
}
function h(e, t) {
var i = c.styles[t];
return i ? "[" + c.colors[i][0] + "m" + e + "[" + c.colors[i][1] + "m" : e
}
function u(e, t) {
return e
}
function l(e, i, r) {
if (e.customInspect && i && T(i.inspect) && i.inspect !== t.inspect && (!i.constructor || i.constructor.prototype !== i)) {
var n = i.inspect(r, e);
return v(n) || (n = l(e, n, r)), n
}
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 s = Object.keys(i),
a = function (e) {
var t = {};
return e.forEach(function (e, i) {
t[e] = !0
}), t
}(s);
if (e.showHidden && (s = Object.getOwnPropertyNames(i)), S(i) && (s.indexOf("message") >= 0 || s.indexOf("description") >= 0)) return f(i);
if (0 === s.length) {
if (T(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 (w(i)) return e.stylize(Date.prototype.toString.call(i), "date");
if (S(i)) return f(i)
}
var h, u = "",
x = !1,
A = ["{", "}"];
(p(i) && (x = !0, A = ["[", "]"]), T(i)) && (u = " [Function" + (i.name ? ": " + i.name : "") + "]");
return b(i) && (u = " " + RegExp.prototype.toString.call(i)), w(i) && (u = " " + Date.prototype.toUTCString.call(i)), S(i) && (u = " " + f(i)), 0 !== s.length || x && 0 != i.length ? r < 0 ? b(i) ? e.stylize(RegExp.prototype.toString.call(i), "regexp") : e.stylize("[Object]", "special") : (e.seen.push(i), h = x ? function (e, t, i, r, n) {
for (var o = [], s = 0, a = t.length; s < a; ++s) P(t, String(s)) ? o.push(d(e, t, i, r, String(s), !0)) : o.push("");
return n.forEach(function (n) {
n.match(/^\d+$/) || o.push(d(e, t, i, r, n, !0))
}), o
}(e, i, r, a, s) : s.map(function (t) {
return d(e, i, r, a, t, x)
}), 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]
}(h, u, A)) : A[0] + u + A[1]
}
function f(e) {
return "[" + Error.prototype.toString.call(e) + "]"
}
function d(e, t, i, r, n, o) {
var s, a, c;
if ((c = Object.getOwnPropertyDescriptor(t, n) || {
value: t[n]
}).get ? a = c.set ? e.stylize("[Getter/Setter]", "special") : e.stylize("[Getter]", "special") : c.set && (a = e.stylize("[Setter]", "special")), P(r, n) || (s = "[" + n + "]"), a || (e.seen.indexOf(c.value) < 0 ? (a = g(i) ? l(e, c.value, null) : l(e, c.value, i - 1)).indexOf("\n") > -1 && (a = o ? a.split("\n").map(function (e) {
return " " + e
}).join("\n").substr(2) : "\n" + a.split("\n").map(function (e) {
return " " + e
}).join("\n")) : a = e.stylize("[Circular]", "special")), y(s)) {
if (o && n.match(/^\d+$/)) return a;
(s = JSON.stringify("" + n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/) ? (s = s.substr(1, s.length - 2), s = e.stylize(s, "name")) : (s = s.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"), s = e.stylize(s, "string"))
}
return s + ": " + a
}
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 x(e) && "[object RegExp]" === A(e)
}
function x(e) {
return "object" === n(e) && null !== e
}
function w(e) {
return x(e) && "[object Date]" === A(e)
}
function S(e) {
return x(e) && ("[object Error]" === A(e) || e instanceof Error)
}
function T(e) {
return "function" == typeof e
}
function A(e) {
return Object.prototype.toString.call(e)
}
function M(e) {
return e < 10 ? "0" + e.toString(10) : e.toString(10)
}
t.debuglog = function (e) {
if (y(s) && (s = r.env.NODE_DEBUG || ""), e = e.toUpperCase(), !a[e])
if (new RegExp("\\b" + e + "\\b", "i").test(s)) {
var i = r.pid;
a[e] = function () {
var r = t.format.apply(t, arguments);
console.error("%s %d: %s", e, i, r)
}
} else a[e] = function () {};
return a[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" === n(e)
}, t.isUndefined = y, t.isRegExp = b, t.isObject = x, t.isDate = w, t.isError = S, t.isFunction = T, t.isPrimitive = function (e) {
return null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e || "symbol" === n(e) || void 0 === e
}, t.isBuffer = i(448);
var E = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
function P(e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}
t.log = function () {
var e, i;
console.log("%s - %s", (e = new Date, i = [M(e.getHours()), M(e.getMinutes()), M(e.getSeconds())].join(":"), [e.getDate(), E[e.getMonth()], i].join(" ")), t.format.apply(t, arguments))
}, t.inherits = i(1), t._extend = function (e, t) {
if (!t || !x(t)) return e;
for (var i = Object.keys(t), r = i.length; r--;) e[i[r]] = t[i[r]];
return e
}
}).call(this, i(15), i(27))
}, function (e, t, i) {
"use strict";
var r = [],
n = [],
o = [],
s = [],
a = [],
c = [],
h = [],
u = [],
l = [],
f = [],
d = [],
p = [];
e.exports = function (e, t, i, m, g, _) {
for (var v = h, y = l, b = f, x = p, w = 0; w < 3; w++) v[w] = +i[w], b[w] = +t.max[w], y[w] = +t.base[w];
_ || (_ = 1e-10);
var S = function (e, t, i, h, l, f) {
var p = r,
m = n,
g = o,
_ = s,
v = a,
y = c,
b = u,
x = Math.floor,
w = 0,
S = 0,
T = 0,
A = 0,
M = 0;
if (E(), 0 === T) return 0;
for (A = R(); S <= T;) {
if (P(A) && C()) return w;
A = R()
}
for (w += T, M = 0; M < 3; M++) h[M] += i[M], l[M] += i[M];
return w;
function E() {
if (S = 0, 0 !== (T = 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 r = t ? l[e] : h[e];
p[e] = t ? h[e] : l[e], m[e] = I(r, _[e]), g[e] = D(p[e], _[e]), b[e] = i[e] / T, v[e] = Math.abs(1 / b[e]);
var n = t ? m[e] + 1 - r : r - m[e];
y[e] = v[e] < 1 / 0 ? v[e] * n : 1 / 0
}
}
function P(t) {
for (var i = _[0], r = 0 === t ? m[0] : g[0], n = m[0] + i, o = _[1], s = 1 === t ? m[1] : g[1], a = m[1] + o, c = _[2], h = 2 === t ? m[2] : g[2], u = m[2] + c, l = r; l != n; l += i)
for (var f = s; f != a; f += o)
for (var d = h; d != u; d += c)
if (e(l, f, d)) return !0;
return !1
}
function C() {
w += S;
var e = _[A],
r = S / T,
n = d;
for (M = 0; M < 3; M++) {
var o = i[M] * r;
h[M] += o, l[M] += o, n[M] = i[M] - o
}
if (e > 0 ? l[A] = Math.round(l[A]) : h[A] = Math.round(h[A]), t(w, A, e, n)) return !0;
for (M = 0; M < 3; M++) i[M] = n[M];
return E(), 0 === T
}
function R() {
var e = y[0] < y[1] ? y[0] < y[2] ? 0 : 2 : y[1] < y[2] ? 1 : 2,
t = y[e] - S;
for (S = y[e], m[e] += _[e], y[e] += v[e], M = 0; M < 3; M++) p[M] += t * b[M], g[M] = D(p[M], _[M]);
return e
}
function I(e, t) {
return x(e - t * f)
}
function D(e, t) {
return x(e + t * f)
}
}(e, m, v, y, b, _);
if (!g) {
for (w = 0; w < 3; w++) x[w] = i[w] > 0 ? b[w] - t.max[w] : y[w] - t.base[w];
t.translate(x)
}
return S
}
}, function (e, t, i) {
"use strict";
var r = {};
e.exports = r;
var n = 13,
o = 1 << n++,
s = 1 << n++,
a = 1 << n++;
r.ID_MASK = 511, r.VAR_MASK = 7680, r.SOLID_BIT = o, r.OPAQUE_BIT = s, r.OBJECT_BIT = a
}, function (e, t, i) {
"use strict";
e.exports = function (e) {
return function (e) {
var t = new Float32Array(256),
i = new Float32Array(256),
r = new Float32Array(256),
n = new Float32Array(256),
o = new Uint8ClampedArray(1024),
s = new BABYLON.DynamicTexture("waterTexture", {
width: 16,
height: 16
}, e.rendering._scene);
s.hasAlpha = !0, s.anisotropicFilteringLevel = 1, s.updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE), s.wrapU = 1, s.wrapV = 1;
var a = s.getContext(),
c = new ImageData(o, 16, 16),
h = 0;
e.on("tick", function (e) {
++h % 2 != 0 && u.redraw()
});
var u = {
texture: s,
tick: function () {},
redraw: function () {
u.update(), a.clearRect(0, 0, 16, 16), a.putImageData(c, 0, 0), s.update()
},
update: function () {
for (var e = 0; e < 16; e++)
for (var s = 0; s < 16; s++) {
for (var a = 0, c = e - 1; c <= e + 1; c++) {
var h = 15 & c,
u = 15 & s;
a += t[h + 16 * u]
}
i[e + 16 * s] = a / 3.3 + .8 * r[e + 16 * s]
}
for (var e = 0; e < 16; e++)
for (var s = 0; s < 16; s++) r[e + 16 * s] += .05 * n[e + 16 * s], r[e + 16 * s] < 0 && (r[e + 16 * s] = 0), n[e + 16 * s] -= .1, Math.random() < .05 && (n[e + 16 * s] = .5);
var l = i;
i = t, t = l;
for (var f = 0; f < 256; f++) {
var a = t[f];
a > 1 && (a = 1), a < 0 && (a = 0);
var d = a * a,
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 = s, u
}(e)
}
}, function (e, t, i) {
"use strict";
var r, n = "undefined" != typeof window ? window.navigator.userAgent : "",
o = /OS X/.test(n),
s = /Opera/.test(n),
a = !/like Gecko/.test(n) && !s,
c = e.exports = {
0: o ? "<menu>" : "<UNK>",
1: "<mouse 1>",
2: "<mouse 2>",
3: "<break>",
4: "<mouse 3>",
5: "<mouse 4>",
6: "<mouse 5>",
8: "<backspace>",
9: "<tab>",
12: "<clear>",
13: "<enter>",
16: "<shift>",
17: "<control>",
18: "<alt>",
19: "<pause>",
20: "<caps-lock>",
21: "<ime-hangul>",
23: "<ime-junja>",
24: "<ime-final>",
25: "<ime-kanji>",
27: "<escape>",
28: "<ime-convert>",
29: "<ime-nonconvert>",
30: "<ime-accept>",
31: "<ime-mode-change>",
32: "<space>",
33: "<page-up>",
34: "<page-down>",
35: "<end>",
36: "<home>",
37: "<left>",
38: "<up>",
39: "<right>",
40: "<down>",
41: "<select>",
42: "<print>",
43: "<execute>",
44: "<snapshot>",
45: "<insert>",
46: "<delete>",
47: "<help>",
91: "<meta>",
92: "<meta>",
93: o ? "<meta>" : "<menu>",
95: "<sleep>",
106: "<num-*>",
107: "<num-+>",
108: "<num-enter>",
109: "<num--\x3e",
110: "<num-.>",
111: "<num-/>",
144: "<num-lock>",
145: "<scroll-lock>",
160: "<shift-left>",
161: "<shift-right>",
162: "<control-left>",
163: "<control-right>",
164: "<alt-left>",
165: "<alt-right>",
166: "<browser-back>",
167: "<browser-forward>",
168: "<browser-refresh>",
169: "<browser-stop>",
170: "<browser-search>",
171: "<browser-favorites>",
172: "<browser-home>",
173: o && a ? "-" : "<volume-mute>",
174: "<volume-down>",
175: "<volume-up>",
176: "<next-track>",
177: "<prev-track>",
178: "<stop>",
179: "<play-pause>",
180: "<launch-mail>",
181: "<launch-media-select>",
182: "<launch-app 1>",
183: "<launch-app 2>",
186: ";",
187: "=",
188: ",",
189: "-",
190: ".",
191: "/",
192: "`",
219: "[",
220: "\\",
221: "]",
222: "'",
223: "<meta>",
224: "<meta>",
226: "<alt-gr>",
229: "<ime-process>",
231: s ? "`" : "<unicode>",
246: "<attention>",
247: "<crsel>",
248: "<exsel>",
249: "<erase-eof>",
250: "<play>",
251: "<zoom>",
252: "<no-name>",
253: "<pa-1>",
254: "<clear>"
};
for (r = 58; r < 65; ++r) c[r] = String.fromCharCode(r);
for (r = 48; r < 58; ++r) c[r] = r - 48 + "";
for (r = 65; r < 91; ++r) c[r] = String.fromCharCode(r);
for (r = 96; r < 106; ++r) c[r] = "<num-" + (r - 96) + ">";
for (r = 112; r < 136; ++r) c[r] = "F" + (r - 111)
}, function (e, t, i) {
e.exports = n;
var r = i(16);
function n(e, t) {
if (!(this instanceof n)) return new n(e, t);
var i = r.create();
r.add(i, e, t), this.base = r.min(r.create(), e, i), this.vec = r.clone(t), this.max = r.max(r.create(), e, i), this.mag = r.length(this.vec)
}
var o = n.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 r.add(this.max, this.max, e), r.add(this.base, this.base, e), this
}, o.setPosition = function (e) {
return r.add(this.max, e, this.vec), r.copy(this.base, e), this
}, o.expand = function (e) {
var t = r.create(),
i = r.create();
return r.max(t, e.max, this.max), r.min(i, e.base, this.base), r.subtract(t, t, i), new n(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]),
r = Math.max(e.base[2], this.base[2]);
return new n([t, i, r], [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]) - r])
}
}, function (e, t, i) {
"use strict";
e.exports = {
init: function (e) {
var t = n.nextPow2(e);
a.length < t && (r.free(a), a = r.mallocInt32(t));
c.length < t && (r.free(c), c = r.mallocInt32(t));
h.length < t && (r.free(h), h = r.mallocInt32(t));
u.length < t && (r.free(u), u = r.mallocInt32(t));
l.length < t && (r.free(l), l = r.mallocInt32(t));
f.length < t && (r.free(f), f = r.mallocInt32(t));
var i = 8 * t;
d.length < i && (r.free(d), d = r.mallocDouble(i))
},
sweepBipartite: function (e, t, i, r, n, l, f, g, _, v) {
for (var y = 0, b = 2 * e, x = e - 1, w = b - 1, S = i; S < r; ++S) {
var T = l[S],
A = b * S;
d[y++] = n[A + x], d[y++] = -(T + 1), d[y++] = n[A + w], d[y++] = T
}
for (var S = f; S < g; ++S) {
var T = v[S] + s,
M = b * S;
d[y++] = _[M + x], d[y++] = -T, d[y++] = _[M + w], d[y++] = T
}
var E = y >>> 1;
o(d, E);
for (var P = 0, C = 0, S = 0; S < E; ++S) {
var R = 0 | d[2 * S + 1];
if (R >= s) p(h, u, C--, R = R - s | 0);
else if (R >= 0) p(a, c, P--, R);
else if (R <= -s) {
R = -R - s | 0;
for (var I = 0; I < P; ++I) {
var D = t(a[I], R);
if (void 0 !== D) return D
}
m(h, u, C++, R)
} else {
R = -R - 1 | 0;
for (var I = 0; I < C; ++I) {
var D = t(R, h[I]);
if (void 0 !== D) return D
}
m(a, c, P++, R)
}
}
},
sweepComplete: function (e, t, i, r, n, s, g, _, v, y) {
for (var b = 0, x = 2 * e, w = e - 1, S = x - 1, T = i; T < r; ++T) {
var A = s[T] + 1 << 1,
M = x * T;
d[b++] = n[M + w], d[b++] = -A, d[b++] = n[M + S], d[b++] = A
}
for (var T = g; T < _; ++T) {
var A = y[T] + 1 << 1,
E = x * T;
d[b++] = v[E + w], d[b++] = 1 | -A, d[b++] = v[E + S], d[b++] = 1 | A
}
var P = b >>> 1;
o(d, P);
for (var C = 0, R = 0, I = 0, T = 0; T < P; ++T) {
var D = 0 | d[2 * T + 1],
O = 1 & D;
if (T < P - 1 && D >> 1 == d[2 * T + 3] >> 1 && (O = 2, T += 1), D < 0) {
for (var L = -(D >> 1) - 1, F = 0; F < I; ++F) {
var B = t(l[F], L);
if (void 0 !== B) return B
}
if (0 !== O)
for (var F = 0; F < C; ++F) {
var B = t(a[F], L);
if (void 0 !== B) return B
}
if (1 !== O)
for (var F = 0; F < R; ++F) {
var B = t(h[F], L);
if (void 0 !== B) return B
}
0 === O ? m(a, c, C++, L) : 1 === O ? m(h, u, R++, L) : 2 === O && m(l, f, I++, L)
} else {
var L = (D >> 1) - 1;
0 === O ? p(a, c, C--, L) : 1 === O ? p(h, u, R--, L) : 2 === O && p(l, f, I--, L)
}
}
},
scanBipartite: function (e, t, i, r, n, h, u, l, f, g, _, v) {
var y = 0,
b = 2 * e,
x = t,
w = t + e,
S = 1,
T = 1;
r ? T = s : S = s;
for (var A = n; A < h; ++A) {
var M = A + S,
E = b * A;
d[y++] = u[E + x], d[y++] = -M, d[y++] = u[E + w], d[y++] = M
}
for (var A = f; A < g; ++A) {
var M = A + T,
P = b * A;
d[y++] = _[P + x], d[y++] = -M
}
var C = y >>> 1;
o(d, C);
for (var R = 0, A = 0; A < C; ++A) {
var I = 0 | d[2 * A + 1];
if (I < 0) {
var M = -I,
D = !1;
if (M >= s ? (D = !r, M -= s) : (D = !!r, M -= 1), D) m(a, c, R++, M);
else {
var O = v[M],
L = b * M,
F = _[L + t + 1],
B = _[L + t + 1 + e];
e: for (var k = 0; k < R; ++k) {
var V = a[k],
N = b * V;
if (!(B < u[N + t + 1] || u[N + t + 1 + e] < F)) {
for (var z = t + 2; z < e; ++z)
if (_[L + z + e] < u[N + z] || u[N + z + e] < _[L + z]) continue e;
var U, G = l[V];
if (void 0 !== (U = r ? i(O, G) : i(G, O))) return U
}
}
}
} else p(a, c, R--, I - S)
}
},
scanComplete: function (e, t, i, r, n, c, h, u, l, f, p) {
for (var m = 0, g = 2 * e, _ = t, v = t + e, y = r; y < n; ++y) {
var b = y + s,
x = g * y;
d[m++] = c[x + _], d[m++] = -b, d[m++] = c[x + v], d[m++] = b
}
for (var y = u; y < l; ++y) {
var b = y + 1,
w = g * y;
d[m++] = f[w + _], d[m++] = -b
}
var S = m >>> 1;
o(d, S);
for (var T = 0, y = 0; y < S; ++y) {
var A = 0 | d[2 * y + 1];
if (A < 0) {
var b = -A;
if (b >= s) a[T++] = b - s;
else {
var M = p[b -= 1],
E = g * b,
P = f[E + t + 1],
C = f[E + t + 1 + e];
e: for (var R = 0; R < T; ++R) {
var I = a[R],
D = h[I];
if (D === M) break;
var O = g * I;
if (!(C < c[O + t + 1] || c[O + t + 1 + e] < P)) {
for (var L = t + 2; L < e; ++L)
if (f[E + L + e] < c[O + L] || c[O + L + e] < f[E + L]) continue e;
var F = i(D, M);
if (void 0 !== F) return F
}
}
}
} else {
for (var b = A - s, R = T - 1; R >= 0; --R)
if (a[R] === b) {
for (var L = R + 1; L < T; ++L) a[L - 1] = a[L];
break
}-- T
}
}
}
};
var r = i(124),
n = i(125),
o = i(484),
s = 1 << 28,
a = r.mallocInt32(1024),
c = r.mallocInt32(1024),
h = r.mallocInt32(1024),
u = r.mallocInt32(1024),
l = r.mallocInt32(1024),
f = r.mallocInt32(1024),
d = r.mallocDouble(8192);
function p(e, t, i, r) {
var n = t[r],
o = e[i - 1];
e[n] = o, t[o] = n
}
function m(e, t, i, r) {
e[i] = r, t[r] = i
}
}, function (e, t, i) {
"use strict";
e.exports = function (e, t) {
var i = "abcdef".split("").concat(t),
n = [];
e.indexOf("lo") >= 0 && n.push("lo=e[k+n]");
e.indexOf("hi") >= 0 && n.push("hi=e[k+o]");
return i.push(r.replace("_", n.join()).replace("$", e)), Function.apply(void 0, i)
};
var r = "for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"
}, function (module, exports, __webpack_require__) {
"use strict";
function overlay(game) {
var scale = 2,
buttonscale = scale + 1,
patternScale = 8,
width = window.innerWidth,
height = window.innerHeight,
mouseOverButton = null,
tickRate = 500,
lastTick = 0,
blinkCount = 0,
blinkCopy = !1,
ypos = Math.floor(.5 * height) - 120 * scale,
center = Math.floor(.5 * width),
urlParams = new URLSearchParams(window.location.search),
url = window.location.href.split("?")[0];
if (urlParams.has("size") && urlParams.delete("size"), urlParams.has("host")) {
var value = urlParams.get("host");
urlParams.delete("host"), urlParams.append("join", value), url += "?" + urlParams.toString(), history.pushState && window.history.pushState({
path: url
}, "", url)
} else url = window.location.href;
var copyTextarea = document.querySelector(".js-copytextarea");
copyTextarea.value = url;
var allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,.:-_'*!\\\"#%/()=+?[]{}<>@|$;",
username = "";
game.settings && "" != game.settings.username && null != game.settings.username && (username = game.settings.username);
var state = 0,
canvas = document.createElement("canvas");
canvas.width = width, canvas.height = height;
var context = canvas.getContext("2d");
context.imageSmoothingEnabled = !1;
var div = document.getElementById("overlay");
div.appendChild(canvas), div.style.width = width + "px", div.style.height = height + "px";
var patternSize = 16 * patternScale,
patternCanvas = document.createElement("canvas");
patternCanvas.width = patternSize, patternCanvas.height = patternSize;
var patternContext = patternCanvas.getContext("2d");
patternContext.imageSmoothingEnabled = !1;
var loaded = 0,
totalLoad = 3,
checkLoading = function () {
++loaded >= totalLoad && (patternContext.drawImage(bg, 0, 0, patternSize, patternSize), patternContext.fillStyle = "rgba(0,0,0,0.7)", patternContext.fillRect(0, 0, patternSize, patternSize), pattern = context.createPattern(patternCanvas, "repeat"), obj.redraw())
},
bg = new Image;
bg.onload = checkLoading, bg.src = "assets/textures/dirt.png";
var button = new Image;
button.onload = checkLoading, button.src = "assets/textures/button.png";
var button_over = new Image;
button_over.onload = checkLoading, button_over.src = "assets/textures/button_over.png";
var pattern = context.createPattern(patternCanvas, "repeat"),
drawText = function (e, t, i, r) {
context.font = 12 * scale + "px Minecraft", context.textBaseline = "alphabetic", context.textAlign = "center";
var n = 2 * scale;
context.fillStyle = "rgb(63,63,63)", context.fillText(e, t + n, i + n), context.fillStyle = r || "rgb(255,255,255)", context.fillText(e, t, i)
},
makeButton = function (e, t, i, r) {
return {
str: e,
x: t,
y: i,
over: !1,
func: r,
widthscale: 1,
key: null,
draw: function () {
this.widthscale < 1 && (context.fillStyle = "rgba(0,0,0,1)", context.fillRect(center - scale + this.x * scale - .5 * button.width * buttonscale * this.widthscale, ypos + this.y * scale, 2 * scale + button.width * buttonscale * this.widthscale, button.height * buttonscale));
var e = button;
this.over && (e = button_over), context.drawImage(e, center + this.x * scale - .5 * button.width * buttonscale * this.widthscale, ypos + this.y * scale, button.width * buttonscale * this.widthscale, button.height * buttonscale);
var t = "rgb(255,255,255)";
this.over && (t = "rgb(255,255,160)"), drawText(this.str, center + this.x * scale, ypos + this.y * scale + 19 * scale, t)
}
}
};
function submitUsername() {
var e = username.trim();
e !== game.hostInfo.hostName && e.length > 0 && (game.settings.username = e, game.emit("saveSettings"), game.setName(e), obj.hide())
}
function copyUrl() {
var e = document.querySelector(".js-copytextarea");
e.focus(), e.select(), blinkCopy = !0, obj.redraw(), setTimeout(function () {
blinkCopy = !1, obj.redraw()
}, 250);
try {
document.execCommand("copy")
} catch (e) {}
}
function newGame() {
var e = window.location.href.split("?")[0];
window.location.href = e
}
function takeOverHost() {
var e = window.location.href.split("?")[0];
window.location.href = e
}
function newGameWebrtc() {
obj.show(0)
}
var startButtonHost = makeButton("Start", 78, 170, submitUsername);
startButtonHost.widthscale = .5;
var startButtonClient = makeButton("Start", 0, 130, submitUsername),
copyButton = makeButton("Copy", 0, 80, copyUrl),
copyButtonHidden = makeButton("Copy Hidden", 0, 40, copyUrl),
newgameButton = makeButton("Launch a new game", 0, 130, newGame),
newgameHostButton = makeButton("Relaunch the game as a host", 0, 120, takeOverHost),
newgameButtonNoWebrtc = makeButton("Launch a new game", 0, 130, newGameWebrtc),
array0 = [startButtonHost, copyButton, copyButtonHidden],
array1 = [startButtonClient],
array2 = [newgameButton],
array3 = [newgameHostButton],
array4 = [newgameButton],
array5 = [newgameButton],
array6 = [newgameButtonNoWebrtc],
activeArray = array1,
obj = {
isOpen: !0,
show: function show(openState) {
state = openState, 1 != state || obj.isWebRTCSupported || (state = 6), activeArray = eval("array" + state), document.addEventListener("keypress", obj.keypress, !1), document.addEventListener("keydown", obj.keydown, !1), div.addEventListener("mousemove", this.mousemove, !1), document.addEventListener("mousedown", this.press, !1), obj.isOpen = !0, obj.redraw(), div.style.display = "block", document.exitPointerLock(), game.inputs && (game.inputs.state.active = !1)
},
hide: function () {
document.removeEventListener("keypress", obj.keypress), document.removeEventListener("keydown", obj.keydown), div.removeEventListener("mousemove", this.mousemove), document.removeEventListener("mousedown", this.press), obj.isOpen = !1, div.style.display = "none";
var e = document.getElementById("noa-container");
setTimeout(function () {
null != e && e.requestPointerLock()
}, 200), game.inputs && (game.inputs.state.active = !0)
},
mousemove: function (e) {
for (var t = e.layerX, i = e.layerY, r = null, n = 0; n < activeArray.length; n++) {
var o = activeArray[n],
s = center + o.x * scale - .5 * button.width * buttonscale * o.widthscale,
a = ypos + o.y * scale,
c = s + button.width * buttonscale * o.widthscale,
h = a + button.height * buttonscale;
if (t > s && t < c && i > a && i < h) {
r = n;
break
}
}
null != r && r != mouseOverButton && (activeArray[r].over = !0, obj.redraw()), null == r && null != mouseOverButton && (activeArray[mouseOverButton].over = !1, obj.redraw()), mouseOverButton = r
},
press: function (e) {
if (null != activeArray[mouseOverButton]) {
var t = activeArray[mouseOverButton].func;
null != t && t()
}
},
keydown: function (e) {
13 != e.keyCode ? (8 == e.keyCode && username.length > 0 && (username = username.substring(0, username.length - 1)), obj.redraw()) : submitUsername()
},
keypress: function (e) {
var t = e.key;
allowedChars.indexOf(t) >= 0 && username.length < 32 && (username += t), obj.redraw()
},
tick: function () {
var e = performance.now();
e < lastTick + tickRate || (blinkCount++, obj.redraw(), lastTick = e)
},
redraw: function () {
context.clearRect(0, 0, width, height), state <= 1 || 3 == state ? (context.fillStyle = "rgba(0,0,0,0.6)", context.fillRect(0, 0, width, height)) : (context.fillStyle = pattern, context.fillRect(0, 0, width, height)), context.font = 14 * scale + "px Minecraft, sans-serif", context.textBaseline = "alphabetic", context.textAlign = "center", context.strokeStyle = "rgba(255,255,255,1)", context.lineWidth = scale;
var e = 0;
if (0 == state) {
if (drawText("Game generated!", center, ypos - 10 * scale), obj.isWebRTCSupported) {
drawText("You are the host. You can invite some (" + (game.hostInfo.maxPlayers - 1) + ") friends to join you.", center, ypos + 24 * scale);
var t = 300 * scale,
i = 30 * scale;
copyButtonHidden.draw(), context.fillStyle = "rgba(0,0,0,1)", blinkCopy && (context.fillStyle = "rgba(127,127,127,1)"), context.fillRect(.5 * width - .5 * t, .5 * height - 80 * scale, t, i), context.save(), context.rect(.5 * width - .5 * t, .5 * height - 80 * scale, t, i), context.clip(), drawText(url, center, ypos + 60 * scale), context.restore(), context.strokeRect(.5 * width - .5 * t, .5 * height - 80 * scale, t, i), copyButton.draw(), e = 40 * scale
} else drawText("Your current browser does not have support for WebRTC.", center, ypos + 24 * scale), drawText("That means you can only play in single player mode.", center, ypos + 41 * scale), drawText("Please use another browser to play multiplayer,", center, ypos + 58 * scale), startButtonHost.y = 130;
drawText("Pick a username and start the game.", center, ypos + 115 * scale + e);
t = 150 * scale, i = 30 * scale;
var r = -78 * scale;
context.fillStyle = "rgba(0,0,0,1)", context.fillRect(r + .5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), context.save(), context.rect(r + .5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), context.clip(), drawText(username, center + r, ypos + 150 * scale + e);
var n = context.measureText(username).width;
blinkCount % 2 == 0 && (context.fillStyle = "rgba(255,255,255,1)", context.fillRect(r + center + .5 * n, ypos + 135 * scale + e, scale, 20 * scale)), context.restore(), context.strokeRect(.5 * width - .5 * t + r, .5 * height + 10 * scale + e, t, i), startButtonHost.draw(), drawText("Left click to place or mine blocks (right click to toggle).", center, ypos + 190 * scale + e)
}
if (1 == state) {
var o = "Welcome!";
"temp" != game.hostInfo.hostName && (o = 'Welcome to "' + game.hostInfo.hostName + '".'), drawText(o, center, ypos + 0 * scale), drawText(" You are player " + game.hostInfo.playerCount + " of " + game.hostInfo.maxPlayers + ".", center, ypos + 17 * scale), drawText("Pick a username and start the game.", center, ypos + 115 * scale + (e = -40 * scale));
t = 300 * scale, i = 30 * scale;
context.fillStyle = "rgba(0,0,0,1)", context.fillRect(.5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), context.save(), context.rect(.5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), context.clip(), drawText(username, center, ypos + 150 * scale + e);
n = context.measureText(username).width;
blinkCount % 2 == 0 && (context.fillStyle = "rgba(255,255,255,1)", context.fillRect(center + .5 * n, ypos + 135 * scale + e, scale, 20 * scale)), context.restore(), context.strokeRect(.5 * width - .5 * t, .5 * height + 10 * scale + e, t, i), startButtonClient.draw(), drawText("Left click to place or mine blocks (right click to toggle).", center, ypos + 240 * scale + e)
}
2 == state && (drawText("The game you are trying to join is full.", center, ypos + 88 * scale), drawText("Come back later or host you own game.", center, ypos + 105 * scale), newgameButton.draw()), 3 == state && (drawText("The End!", center, ypos + 4 * scale), drawText("The host left the game.", center, ypos + 38 * scale), drawText("If you launch a new game you will become the host and be able to", center, ypos + 75 * scale), drawText("invite friends. The new game will be based on this world.", center, ypos + 92 * scale), newgameHostButton.draw()), 4 == state && (drawText("The game you are trying to join doesn't exist.", center, ypos + 88 * scale), drawText("You can still host a new game and invite your friends.", center, ypos + 105 * scale), newgameButton.draw()), 5 == state && (drawText("You were kicked!", center, ypos + 88 * scale), drawText("You can host a new game and invite your own friends.", center, ypos + 105 * scale), newgameButton.draw()), 6 == state && (drawText("Your current browser does not have support for WebRTC.", center, ypos + 71 * scale), drawText("If you want to join a game, please use another browser.", center, ypos + 88 * scale), drawText("Or you can launch a single player game.", center, ypos + 105 * scale), newgameButtonNoWebrtc.draw())
},
resize: function () {
scale = 2, window.innerHeight < 600 && (scale = 1), buttonscale = 1.5 * scale, width = window.innerWidth, height = window.innerHeight, center = Math.floor(.5 * width), ypos = Math.floor(.5 * height) - 120 * scale, canvas.width = width, canvas.height = height, div.style.width = width + "px", div.style.height = height + "px", context.imageSmoothingEnabled = !1, obj.redraw()
},
isWebRTCSupported: !1
};
try {
var remoteConnection = new RTCPeerConnection;
remoteConnection.ondatachannel = function (e) {}, obj.isWebRTCSupported = !0
} catch (e) {}
return obj.hide(), obj
}
module.exports = function (e) {
return overlay(e)
}
}, function (e, t, i) {
"use strict";
e.exports = function (e) {
var t = e.rendering._scene,
i = new BABYLON.StandardMaterial("head", t),
r = new BABYLON.Texture("assets/textures/stevehead.png", t, !0, !1, BABYLON.Texture.NEAREST_SAMPLINGMODE);
i.diffuseTexture = r, i.specularColor = new BABYLON.Color3(0, 0, 0);
for (var n = new Array(6), o = 0; o < 6; o++) n[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1);
var s = {
width: .45,
height: .45,
depth: .45,
faceUV: n
},
a = BABYLON.MeshBuilder.CreateBox("head", s, t);
a.material = i, a.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.WORLD);
var c = new BABYLON.StandardMaterial("torso", t);
r = new BABYLON.Texture("assets/textures/stevetorso.png", t, !0, !1, BABYLON.Texture.NEAREST_SAMPLINGMODE);
c.diffuseTexture = r, c.specularColor = new BABYLON.Color3(0, 0, 0);
for (n = new Array(6), o = 0; o < 6; o++) n[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1);
s = {
width: .45,
height: .675,
depth: .225,
faceUV: n
};
var h = BABYLON.MeshBuilder.CreateBox("torso", s, t);
h.material = c;
var u = new BABYLON.StandardMaterial("arm", t);
r = new BABYLON.Texture("assets/textures/stevearm.png", t, !0, !1, BABYLON.Texture.NEAREST_SAMPLINGMODE);
u.diffuseTexture = r, u.specularColor = new BABYLON.Color3(0, 0, 0);
for (n = new Array(6), o = 0; o < 6; o++) n[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1);
s = {
width: .225,
height: .675,
depth: .225,
faceUV: n
};
var l = BABYLON.MeshBuilder.CreateBox("leftArm", s, t);
l.material = u;
var f = BABYLON.MeshBuilder.CreateBox("rightLeg", s, t);
f.material = u;
var d = new BABYLON.StandardMaterial("leg", t);
r = new BABYLON.Texture("assets/textures/steveleg.png", t, !0, !1, BABYLON.Texture.NEAREST_SAMPLINGMODE);
d.diffuseTexture = r, d.specularColor = new BABYLON.Color3(0, 0, 0);
for (n = new Array(6), o = 0; o < 6; o++) n[o] = new BABYLON.Vector4(o / 8, 0, (o + 1) / 8, 1);
s = {
width: .225,
height: .675,
depth: .225,
faceUV: n
};
var p = BABYLON.MeshBuilder.CreateBox("leftLeg", s, t);
p.material = d;
var m = BABYLON.MeshBuilder.CreateBox("rightLeg", s, t);
m.material = d, l.setPivotPoint(new BABYLON.Vector3(0, .225, 0)), f.setPivotPoint(new BABYLON.Vector3(0, .225, 0)), p.setPivotPoint(new BABYLON.Vector3(0, .3375, 0)), m.setPivotPoint(new BABYLON.Vector3(0, .3375, 0)), a.parent = h, p.parent = h, m.parent = h, l.parent = h, f.parent = h, a.setPositionWithLocalVector(new BABYLON.Vector3(0, .5625, 0)), p.setPositionWithLocalVector(new BABYLON.Vector3(.1125, -.3375, 0)), m.setPositionWithLocalVector(new BABYLON.Vector3(-.1125, -.3375, 0)), l.setPositionWithLocalVector(new BABYLON.Vector3(.3375, .225, 0)), f.setPositionWithLocalVector(new BABYLON.Vector3(-.3375, .225, 0));
var g = 0,
_ = 0,
v = 0;
return h.walking = !0, h.animate = function (e) {
var t = .01 * (g += e),
i = 5e-4 * g,
r = 65e-5 * g,
n = 1.2,
o = 1;
this.walking || (n = 0, o = 0), _ += (n - _) / 4, v += (o - v) / 4, p.rotation.x = Math.sin(t) * _, m.rotation.x = -Math.sin(t) * _, l.rotation.x = -Math.sin(t) * _, f.rotation.x = Math.sin(t) * _, l.rotation.z = Math.abs(Math.sin(i)) * v, f.rotation.z = -Math.abs(Math.sin(r)) * v
}, h
}
}, function (e, t, i) {
"use strict";
var r = i(2).Buffer,
n = i(127).Transform;
function o(e) {
n.call(this), this._block = r.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1
}
i(1)(o, n), o.prototype._transform = function (e, t, i) {
var r = null;
try {
this.update(e, t)
} catch (e) {
r = e
}
i(r)
}, o.prototype._flush = function (e) {
var t = null;
try {
this.push(this.digest())
} catch (e) {
t = e
}
e(t)
}, o.prototype.update = function (e, t) {
if (function (e, t) {
if (!r.isBuffer(e) && "string" != typeof e) throw new TypeError(t + " must be a string or a buffer")
}(e, "Data"), this._finalized) throw new Error("Digest already called");
r.isBuffer(e) || (e = r.from(e, t));
for (var i = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize;) {
for (var o = this._blockOffset; o < this._blockSize;) i[o++] = e[n++];
this._update(), this._blockOffset = 0
}
for (; n < e.length;) i[this._blockOffset++] = e[n++];
for (var s = 0, a = 8 * e.length; a > 0; ++s) this._length[s] += a, (a = this._length[s] / 4294967296 | 0) > 0 && (this._length[s] -= 4294967296 * a);
return this
}, o.prototype._update = function () {
throw new Error("_update is not implemented")
}, o.prototype.digest = function (e) {
if (this._finalized) throw new Error("Digest already called");
this._finalized = !0;
var t = this._digest();
void 0 !== e && (t = t.toString(e)), this._block.fill(0), this._blockOffset = 0;
for (var i = 0; i < 4; ++i) this._length[i] = 0;
return t
}, o.prototype._digest = function () {
throw new Error("_digest is not implemented")
}, e.exports = o
}, function (e, t, i) {
var r = i(1),
n = i(63),
o = i(2).Buffer,
s = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298],
a = new Array(64);
function c() {
this.init(), this._w = a, n.call(this, 64, 56)
}
function h(e, t, i) {
return i ^ e & (t ^ i)
}
function u(e, t, i) {
return e & t | i & (e | t)
}
function l(e) {
return (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10)
}
function f(e) {
return (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7)
}
function d(e) {
return (e >>> 7 | e << 25) ^ (e >>> 18 | e << 14) ^ e >>> 3
}
r(c, n), c.prototype.init = function () {
return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this
}, c.prototype._update = function (e) {
for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, o = 0 | this._c, a = 0 | this._d, c = 0 | this._e, p = 0 | this._f, m = 0 | this._g, g = 0 | this._h, _ = 0; _ < 16; ++_) i[_] = e.readInt32BE(4 * _);
for (; _ < 64; ++_) i[_] = 0 | (((t = i[_ - 2]) >>> 17 | t << 15) ^ (t >>> 19 | t << 13) ^ t >>> 10) + i[_ - 7] + d(i[_ - 15]) + i[_ - 16];
for (var v = 0; v < 64; ++v) {
var y = g + f(c) + h(c, p, m) + s[v] + i[v] | 0,
b = l(r) + u(r, n, o) | 0;
g = m, m = p, p = c, c = a + y | 0, a = o, o = n, n = r, r = y + b | 0
}
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = o + this._c | 0, this._d = a + this._d | 0, this._e = c + this._e | 0, this._f = p + this._f | 0, this._g = m + this._g | 0, this._h = g + this._h | 0
}, c.prototype._hash = function () {
var e = o.allocUnsafe(32);
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.writeInt32BE(this._h, 28), e
}, e.exports = c
}, function (e, t, i) {
var r = i(1),
n = i(63),
o = i(2).Buffer,
s = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591],
a = new Array(160);
function c() {
this.init(), this._w = a, n.call(this, 128, 112)
}
function h(e, t, i) {
return i ^ e & (t ^ i)
}
function u(e, t, i) {
return e & t | i & (e | t)
}
function l(e, t) {
return (e >>> 28 | t << 4) ^ (t >>> 2 | e << 30) ^ (t >>> 7 | e << 25)
}
function f(e, t) {
return (e >>> 14 | t << 18) ^ (e >>> 18 | t << 14) ^ (t >>> 9 | e << 23)
}
function d(e, t) {
return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ e >>> 7
}
function p(e, t) {
return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ (e >>> 7 | t << 25)
}
function m(e, t) {
return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ e >>> 6
}
function g(e, t) {
return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ (e >>> 6 | t << 26)
}
function _(e, t) {
return e >>> 0 < t >>> 0 ? 1 : 0
}
r(c, n), c.prototype.init = function () {
return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this
}, c.prototype._update = function (e) {
for (var t = this._w, i = 0 | this._ah, r = 0 | this._bh, n = 0 | this._ch, o = 0 | this._dh, a = 0 | this._eh, c = 0 | this._fh, v = 0 | this._gh, y = 0 | this._hh, b = 0 | this._al, x = 0 | this._bl, w = 0 | this._cl, S = 0 | this._dl, T = 0 | this._el, A = 0 | this._fl, M = 0 | this._gl, E = 0 | this._hl, P = 0; P < 32; P += 2) t[P] = e.readInt32BE(4 * P), t[P + 1] = e.readInt32BE(4 * P + 4);
for (; P < 160; P += 2) {
var C = t[P - 30],
R = t[P - 30 + 1],
I = d(C, R),
D = p(R, C),
O = m(C = t[P - 4], R = t[P - 4 + 1]),
L = g(R, C),
F = t[P - 14],
B = t[P - 14 + 1],
k = t[P - 32],
V = t[P - 32 + 1],
N = D + B | 0,
z = I + F + _(N, D) | 0;
z = (z = z + O + _(N = N + L | 0, L) | 0) + k + _(N = N + V | 0, V) | 0, t[P] = z, t[P + 1] = N
}
for (var U = 0; U < 160; U += 2) {
z = t[U], N = t[U + 1];
var G = u(i, r, n),
W = u(b, x, w),
j = l(i, b),
H = l(b, i),
X = f(a, T),
Y = f(T, a),
K = s[U],
q = s[U + 1],
Z = h(a, c, v),
Q = h(T, A, M),
J = E + Y | 0,
$ = y + X + _(J, E) | 0;
$ = ($ = ($ = $ + Z + _(J = J + Q | 0, Q) | 0) + K + _(J = J + q | 0, q) | 0) + z + _(J = J + N | 0, N) | 0;
var ee = H + W | 0,
te = j + G + _(ee, H) | 0;
y = v, E = M, v = c, M = A, c = a, A = T, a = o + $ + _(T = S + J | 0, S) | 0, o = n, S = w, n = r, w = x, r = i, x = b, i = $ + te + _(b = J + ee | 0, J) | 0
}
this._al = this._al + b | 0, this._bl = this._bl + x | 0, this._cl = this._cl + w | 0, this._dl = this._dl + S | 0, this._el = this._el + T | 0, this._fl = this._fl + A | 0, this._gl = this._gl + M | 0, this._hl = this._hl + E | 0, this._ah = this._ah + i + _(this._al, b) | 0, this._bh = this._bh + r + _(this._bl, x) | 0, this._ch = this._ch + n + _(this._cl, w) | 0, this._dh = this._dh + o + _(this._dl, S) | 0, this._eh = this._eh + a + _(this._el, T) | 0, this._fh = this._fh + c + _(this._fl, A) | 0, this._gh = this._gh + v + _(this._gl, M) | 0, this._hh = this._hh + y + _(this._hl, E) | 0
}, c.prototype._hash = function () {
var e = o.allocUnsafe(64);
function t(t, i, r) {
e.writeInt32BE(t, r), e.writeInt32BE(i, r + 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), t(this._gh, this._gl, 48), t(this._hh, this._hl, 56), e
}, e.exports = c
}, function (e, t, i) {
"use strict";
var r = i(1),
n = i(521),
o = i(43),
s = i(2).Buffer,
a = i(200),
c = i(128),
h = i(129),
u = s.alloc(128);
function l(e, t) {
o.call(this, "digest"), "string" == typeof t && (t = s.from(t));
var i = "sha512" === e || "sha384" === e ? 128 : 64;
(this._alg = e, this._key = t, t.length > i) ? t = ("rmd160" === e ? new c : h(e)).update(t).digest(): t.length < i && (t = s.concat([t, u], i));
for (var r = this._ipad = s.allocUnsafe(i), n = this._opad = s.allocUnsafe(i), a = 0; a < i; a++) r[a] = 54 ^ t[a], n[a] = 92 ^ t[a];
this._hash = "rmd160" === e ? new c : h(e), this._hash.update(r)
}
r(l, o), l.prototype._update = function (e) {
this._hash.update(e)
}, l.prototype._final = function () {
var e = this._hash.digest();
return ("rmd160" === this._alg ? new c : h(this._alg)).update(this._opad).update(e).digest()
}, e.exports = function (e, t) {
return "rmd160" === (e = e.toLowerCase()) || "ripemd160" === e ? new l("rmd160", t) : "md5" === e ? new n(a, t) : new l(e, t)
}
}, function (e, t, i) {
var r = i(126);
e.exports = function (e) {
return (new r).update(e).digest()
}
}, function (e) {
e.exports = {
sha224WithRSAEncryption: {
sign: "rsa",
hash: "sha224",
id: "302d300d06096086480165030402040500041c"
},
"RSA-SHA224": {
sign: "ecdsa/rsa",
hash: "sha224",
id: "302d300d06096086480165030402040500041c"
},
sha256WithRSAEncryption: {
sign: "rsa",
hash: "sha256",
id: "3031300d060960864801650304020105000420"
},
"RSA-SHA256": {
sign: "ecdsa/rsa",
hash: "sha256",
id: "3031300d060960864801650304020105000420"
},
sha384WithRSAEncryption: {
sign: "rsa",
hash: "sha384",
id: "3041300d060960864801650304020205000430"
},
"RSA-SHA384": {
sign: "ecdsa/rsa",
hash: "sha384",
id: "3041300d060960864801650304020205000430"
},
sha512WithRSAEncryption: {
sign: "rsa",
hash: "sha512",
id: "3051300d060960864801650304020305000440"
},
"RSA-SHA512": {
sign: "ecdsa/rsa",
hash: "sha512",
id: "3051300d060960864801650304020305000440"
},
"RSA-SHA1": {
sign: "rsa",
hash: "sha1",
id: "3021300906052b0e03021a05000414"
},
"ecdsa-with-SHA1": {
sign: "ecdsa",
hash: "sha1",
id: ""
},
sha256: {
sign: "ecdsa",
hash: "sha256",
id: ""
},
sha224: {
sign: "ecdsa",
hash: "sha224",
id: ""
},
sha384: {
sign: "ecdsa",
hash: "sha384",
id: ""
},
sha512: {
sign: "ecdsa",
hash: "sha512",
id: ""
},
"DSA-SHA": {
sign: "dsa",
hash: "sha1",
id: ""
},
"DSA-SHA1": {
sign: "dsa",
hash: "sha1",
id: ""
},
DSA: {
sign: "dsa",
hash: "sha1",
id: ""
},
"DSA-WITH-SHA224": {
sign: "dsa",
hash: "sha224",
id: ""
},
"DSA-SHA224": {
sign: "dsa",
hash: "sha224",
id: ""
},
"DSA-WITH-SHA256": {
sign: "dsa",
hash: "sha256",
id: ""
},
"DSA-SHA256": {
sign: "dsa",
hash: "sha256",
id: ""
},
"DSA-WITH-SHA384": {
sign: "dsa",
hash: "sha384",
id: ""
},
"DSA-SHA384": {
sign: "dsa",
hash: "sha384",
id: ""
},
"DSA-WITH-SHA512": {
sign: "dsa",
hash: "sha512",
id: ""
},
"DSA-SHA512": {
sign: "dsa",
hash: "sha512",
id: ""
},
"DSA-RIPEMD160": {
sign: "dsa",
hash: "rmd160",
id: ""
},
ripemd160WithRSA: {
sign: "rsa",
hash: "rmd160",
id: "3021300906052b2403020105000414"
},
"RSA-RIPEMD160": {
sign: "rsa",
hash: "rmd160",
id: "3021300906052b2403020105000414"
},
md5WithRSAEncryption: {
sign: "rsa",
hash: "md5",
id: "3020300c06082a864886f70d020505000410"
},
"RSA-MD5": {
sign: "rsa",
hash: "md5",
id: "3020300c06082a864886f70d020505000410"
}
}
}, function (e, t, i) {
t.pbkdf2 = i(523), t.pbkdf2Sync = i(205)
}, function (e, t, i) {
(function (t) {
var i = Math.pow(2, 30) - 1;
function r(e, i) {
if ("string" != typeof e && !t.isBuffer(e)) throw new TypeError(i + " must be a buffer or string")
}
e.exports = function (e, t, n, o) {
if (r(e, "Password"), r(t, "Salt"), "number" != typeof n) throw new TypeError("Iterations not a number");
if (n < 0) throw new TypeError("Bad iterations");
if ("number" != typeof o) throw new TypeError("Key length not a number");
if (o < 0 || o > i || o != o) throw new TypeError("Bad key length")
}
}).call(this, i(9).Buffer)
}, function (e, t, i) {
(function (t) {
var i;
t.browser ? i = "utf-8" : i = parseInt(t.version.split(".")[0].slice(1), 10) >= 6 ? "utf-8" : "binary";
e.exports = i
}).call(this, i(27))
}, function (e, t, i) {
var r = i(200),
n = i(128),
o = i(129),
s = i(203),
a = i(204),
c = i(2).Buffer,
h = c.alloc(128),
u = {
md5: 16,
sha1: 20,
sha224: 28,
sha256: 32,
sha384: 48,
sha512: 64,
rmd160: 20,
ripemd160: 20
};
function l(e, t, i) {
var s = function (e) {
return "rmd160" === e || "ripemd160" === e ? function (e) {
return (new n).update(e).digest()
} : "md5" === e ? r : function (t) {
return o(e).update(t).digest()
}
}(e),
a = "sha512" === e || "sha384" === e ? 128 : 64;
t.length > a ? t = s(t) : t.length < a && (t = c.concat([t, h], a));
for (var l = c.allocUnsafe(a + u[e]), f = c.allocUnsafe(a + u[e]), d = 0; d < a; d++) l[d] = 54 ^ t[d], f[d] = 92 ^ t[d];
var p = c.allocUnsafe(a + i + 4);
l.copy(p, 0, 0, a), this.ipad1 = p, this.ipad2 = l, this.opad = f, this.alg = e, this.blocksize = a, this.hash = s, this.size = u[e]
}
l.prototype.run = function (e, t) {
return e.copy(t, this.blocksize), this.hash(t).copy(this.opad, this.blocksize), this.hash(this.opad)
}, e.exports = function (e, t, i, r, n) {
s(e, t, i, r), c.isBuffer(e) || (e = c.from(e, a)), c.isBuffer(t) || (t = c.from(t, a));
var o = new l(n = n || "sha1", e, t.length),
h = c.allocUnsafe(r),
f = c.allocUnsafe(t.length + 4);
t.copy(f, 0, 0, t.length);
for (var d = 0, p = u[n], m = Math.ceil(r / p), g = 1; g <= m; g++) {
f.writeUInt32BE(g, t.length);
for (var _ = o.run(f, o.ipad1), v = _, y = 1; y < i; y++) {
v = o.run(v, o.ipad2);
for (var b = 0; b < p; b++) _[b] ^= v[b]
}
_.copy(h, d), d += p
}
return h
}
}, function (e, t, i) {
var r = i(70),
n = i(2).Buffer,
o = i(207);
function s(e) {
var t = e._cipher.encryptBlockRaw(e._prev);
return o(e._prev), t
}
t.encrypt = function (e, t) {
var i = Math.ceil(t.length / 16),
o = e._cache.length;
e._cache = n.concat([e._cache, n.allocUnsafe(16 * i)]);
for (var a = 0; a < i; a++) {
var c = s(e),
h = o + 16 * a;
e._cache.writeUInt32BE(c[0], h + 0), e._cache.writeUInt32BE(c[1], h + 4), e._cache.writeUInt32BE(c[2], h + 8), e._cache.writeUInt32BE(c[3], h + 12)
}
var u = e._cache.slice(0, t.length);
return e._cache = e._cache.slice(t.length), r(t, u)
}
}, function (e, t) {
e.exports = function (e) {
for (var t, i = e.length; i--;) {
if (255 !== (t = e.readUInt8(i))) {
t++, e.writeUInt8(t, i);
break
}
e.writeUInt8(0, i)
}
}
}, function (e) {
e.exports = {
"aes-128-ecb": {
cipher: "AES",
key: 128,
iv: 0,
mode: "ECB",
type: "block"
},
"aes-192-ecb": {
cipher: "AES",
key: 192,
iv: 0,
mode: "ECB",
type: "block"
},
"aes-256-ecb": {
cipher: "AES",
key: 256,
iv: 0,
mode: "ECB",
type: "block"
},
"aes-128-cbc": {
cipher: "AES",
key: 128,
iv: 16,
mode: "CBC",
type: "block"
},
"aes-192-cbc": {
cipher: "AES",
key: 192,
iv: 16,
mode: "CBC",
type: "block"
},
"aes-256-cbc": {
cipher: "AES",
key: 256,
iv: 16,
mode: "CBC",
type: "block"
},
aes128: {
cipher: "AES",
key: 128,
iv: 16,
mode: "CBC",
type: "block"
},
aes192: {
cipher: "AES",
key: 192,
iv: 16,
mode: "CBC",
type: "block"
},
aes256: {
cipher: "AES",
key: 256,
iv: 16,
mode: "CBC",
type: "block"
},
"aes-128-cfb": {
cipher: "AES",
key: 128,
iv: 16,
mode: "CFB",
type: "stream"
},
"aes-192-cfb": {
cipher: "AES",
key: 192,
iv: 16,
mode: "CFB",
type: "stream"
},
"aes-256-cfb": {
cipher: "AES",
key: 256,
iv: 16,
mode: "CFB",
type: "stream"
},
"aes-128-cfb8": {
cipher: "AES",
key: 128,
iv: 16,
mode: "CFB8",
type: "stream"
},
"aes-192-cfb8": {
cipher: "AES",
key: 192,
iv: 16,
mode: "CFB8",
type: "stream"
},
"aes-256-cfb8": {
cipher: "AES",
key: 256,
iv: 16,
mode: "CFB8",
type: "stream"
},
"aes-128-cfb1": {
cipher: "AES",
key: 128,
iv: 16,
mode: "CFB1",
type: "stream"
},
"aes-192-cfb1": {
cipher: "AES",
key: 192,
iv: 16,
mode: "CFB1",
type: "stream"
},
"aes-256-cfb1": {
cipher: "AES",
key: 256,
iv: 16,
mode: "CFB1",
type: "stream"
},
"aes-128-ofb": {
cipher: "AES",
key: 128,
iv: 16,
mode: "OFB",
type: "stream"
},
"aes-192-ofb": {
cipher: "AES",
key: 192,
iv: 16,
mode: "OFB",
type: "stream"
},
"aes-256-ofb": {
cipher: "AES",
key: 256,
iv: 16,
mode: "OFB",
type: "stream"
},
"aes-128-ctr": {
cipher: "AES",
key: 128,
iv: 16,
mode: "CTR",
type: "stream"
},
"aes-192-ctr": {
cipher: "AES",
key: 192,
iv: 16,
mode: "CTR",
type: "stream"
},
"aes-256-ctr": {
cipher: "AES",
key: 256,
iv: 16,
mode: "CTR",
type: "stream"
},
"aes-128-gcm": {
cipher: "AES",
key: 128,
iv: 12,
mode: "GCM",
type: "auth"
},
"aes-192-gcm": {
cipher: "AES",
key: 192,
iv: 12,
mode: "GCM",
type: "auth"
},
"aes-256-gcm": {
cipher: "AES",
key: 256,
iv: 12,
mode: "GCM",
type: "auth"
}
}
}, function (e, t, i) {
var r = i(89),
n = i(2).Buffer,
o = i(43),
s = i(1),
a = i(538),
c = i(70),
h = i(207);
function u(e, t, i, s) {
o.call(this);
var c = n.alloc(4, 0);
this._cipher = new r.AES(t);
var u = this._cipher.encryptBlock(c);
this._ghash = new a(u), i = function (e, t, i) {
if (12 === t.length) return e._finID = n.concat([t, n.from([0, 0, 0, 1])]), n.concat([t, n.from([0, 0, 0, 2])]);
var r = new a(i),
o = t.length,
s = o % 16;
r.update(t), s && (s = 16 - s, r.update(n.alloc(s, 0))), r.update(n.alloc(8, 0));
var c = 8 * o,
u = n.alloc(8);
u.writeUIntBE(c, 0, 8), r.update(u), e._finID = r.state;
var l = n.from(e._finID);
return h(l), l
}(this, i, u), this._prev = n.from(i), this._cache = n.allocUnsafe(0), this._secCache = n.allocUnsafe(0), this._decrypt = s, this._alen = 0, this._len = 0, this._mode = e, this._authTag = null, this._called = !1
}
s(u, o), u.prototype._update = function (e) {
if (!this._called && this._alen) {
var t = 16 - this._alen % 16;
t < 16 && (t = n.alloc(t, 0), this._ghash.update(t))
}
this._called = !0;
var i = this._mode.encrypt(this, e);
return this._decrypt ? this._ghash.update(e) : this._ghash.update(i), this._len += e.length, i
}, u.prototype._final = function () {
if (this._decrypt && !this._authTag) throw new Error("Unsupported state or unable to authenticate data");
var e = c(this._ghash.final(8 * this._alen, 8 * this._len), this._cipher.encryptBlock(this._finID));
if (this._decrypt && function (e, t) {
var i = 0;
e.length !== t.length && i++;
for (var r = Math.min(e.length, t.length), n = 0; n < r; ++n) i += e[n] ^ t[n];
return i
}(e, this._authTag)) throw new Error("Unsupported state or unable to authenticate data");
this._authTag = e, this._cipher.scrub()
}, u.prototype.getAuthTag = function () {
if (this._decrypt || !n.isBuffer(this._authTag)) throw new Error("Attempting to get auth tag in unsupported state");
return this._authTag
}, u.prototype.setAuthTag = function (e) {
if (!this._decrypt) throw new Error("Attempting to set auth tag in unsupported state");
this._authTag = e
}, u.prototype.setAAD = function (e) {
if (this._called) throw new Error("Attempting to set AAD in unsupported state");
this._ghash.update(e), this._alen += e.length
}, e.exports = u
}, function (e, t, i) {
var r = i(89),
n = i(2).Buffer,
o = i(43);
function s(e, t, i, s) {
o.call(this), this._cipher = new r.AES(t), this._prev = n.from(i), this._cache = n.allocUnsafe(0), this._secCache = n.allocUnsafe(0), this._decrypt = s, this._mode = e
}
i(1)(s, o), s.prototype._update = function (e) {
return this._mode.encrypt(this, e, this._decrypt)
}, s.prototype._final = function () {
this._cipher.scrub()
}, e.exports = s
}, function (e, t, i) {
var r = i(53);
e.exports = v, v.simpleSieve = g, v.fermatTest = _;
var n = i(11),
o = new n(24),
s = new(i(212)),
a = new n(1),
c = new n(2),
h = new n(5),
u = (new n(16), new n(8), new n(10)),
l = new n(3),
f = (new n(7), new n(11)),
d = new n(4),
p = (new n(12), null);
function m() {
if (null !== p) return p;
var e = [];
e[0] = 2;
for (var t = 1, i = 3; i < 1048576; i += 2) {
for (var r = Math.ceil(Math.sqrt(i)), n = 0; n < t && e[n] <= r && i % e[n] != 0; n++);
t !== n && e[n] <= r || (e[t++] = i)
}
return p = e, e
}
function g(e) {
for (var t = m(), i = 0; i < t.length; i++)
if (0 === e.modn(t[i])) return 0 === e.cmpn(t[i]);
return !0
}
function _(e) {
var t = n.mont(e);
return 0 === c.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)
}
function v(e, t) {
if (e < 16) return new n(2 === t || 5 === t ? [140, 123] : [140, 39]);
var i, p;
for (t = new n(t);;) {
for (i = new n(r(Math.ceil(e / 8))); i.bitLength() > e;) i.ishrn(1);
if (i.isEven() && i.iadd(a), i.testn(1) || i.iadd(c), t.cmp(c)) {
if (!t.cmp(h))
for (; i.mod(u).cmp(l);) i.iadd(d)
} else
for (; i.mod(o).cmp(f);) i.iadd(d);
if (g(p = i.shrn(1)) && g(i) && _(p) && _(i) && s.test(p) && s.test(i)) return i
}
}
}, function (e, t, i) {
var r = i(11),
n = i(213);
function o(e) {
this.rand = e || new n.Rand
}
e.exports = o, o.create = function (e) {
return new o(e)
}, o.prototype._randbelow = function (e) {
var t = e.bitLength(),
i = Math.ceil(t / 8);
do {
var n = new r(this.rand.generate(i))
} while (n.cmp(e) >= 0);
return n
}, o.prototype._randrange = function (e, t) {
var i = t.sub(e);
return e.add(this._randbelow(i))
}, o.prototype.test = function (e, t, i) {
var n = e.bitLength(),
o = r.mont(e),
s = new r(1).toRed(o);
t || (t = Math.max(1, n / 48 | 0));
for (var a = e.subn(1), c = 0; !a.testn(c); c++);
for (var h = e.shrn(c), u = a.toRed(o); t > 0; t--) {
var l = this._randrange(new r(2), a);
i && i(l);
var f = l.toRed(o).redPow(h);
if (0 !== f.cmp(s) && 0 !== f.cmp(u)) {
for (var d = 1; d < c; d++) {
if (0 === (f = f.redSqr()).cmp(s)) return !1;
if (0 === f.cmp(u)) break
}
if (d === c) return !1
}
}
return !0
}, o.prototype.getDivisor = function (e, t) {
var i = e.bitLength(),
n = r.mont(e),
o = new r(1).toRed(n);
t || (t = Math.max(1, i / 48 | 0));
for (var s = e.subn(1), a = 0; !s.testn(a); a++);
for (var c = e.shrn(a), h = s.toRed(n); t > 0; t--) {
var u = this._randrange(new r(2), s),
l = e.gcd(u);
if (0 !== l.cmpn(1)) return l;
var f = u.toRed(n).redPow(c);
if (0 !== f.cmp(o) && 0 !== f.cmp(h)) {
for (var d = 1; d < a; d++) {
if (0 === (f = f.redSqr()).cmp(o)) return f.fromRed().subn(1).gcd(e);
if (0 === f.cmp(h)) break
}
if (d === a) return (f = f.redSqr()).fromRed().subn(1).gcd(e)
}
}
return !1
}
}, function (e, t, i) {
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 n;
function o(e) {
this.rand = e
}
if (e.exports = function (e) {
return n || (n = new o(null)), n.generate(e)
}, e.exports.Rand = o, o.prototype.generate = function (e) {
return this._rand(e)
}, o.prototype._rand = function (e) {
if (this.rand.getBytes) return this.rand.getBytes(e);
for (var t = new Uint8Array(e), i = 0; i < t.length; i++) t[i] = this.rand.getByte();
return t
}, "object" === ("undefined" == typeof self ? "undefined" : r(self))) self.crypto && self.crypto.getRandomValues ? o.prototype._rand = function (e) {
var t = new Uint8Array(e);
return self.crypto.getRandomValues(t), t
} : self.msCrypto && self.msCrypto.getRandomValues ? o.prototype._rand = function (e) {
var t = new Uint8Array(e);
return self.msCrypto.getRandomValues(t), t
} : "object" === ("undefined" == typeof window ? "undefined" : r(window)) && (o.prototype._rand = function () {
throw new Error("Not implemented yet")
});
else try {
var s = i(543);
if ("function" != typeof s.randomBytes) throw new Error("Not supported");
o.prototype._rand = function (e) {
return s.randomBytes(e)
}
} catch (e) {}
}, function (e, t, i) {
"use strict";
var r = t;
function n(e) {
return 1 === e.length ? "0" + e : e
}
function o(e) {
for (var t = "", i = 0; i < e.length; i++) t += n(e[i].toString(16));
return t
}
r.toArray = function (e, t) {
if (Array.isArray(e)) return e.slice();
if (!e) return [];
var i = [];
if ("string" != typeof e) {
for (var r = 0; r < e.length; r++) i[r] = 0 | e[r];
return i
}
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 (r = 0; r < e.length; r++) {
var n = e.charCodeAt(r),
o = n >> 8,
s = 255 & n;
o ? i.push(o, s) : i.push(s)
}
return i
}, r.zero2 = n, r.toHex = o, r.encode = function (e, t) {
return "hex" === t ? o(e) : e
}
}, function (e, t, i) {
"use strict";
var r = i(33).rotr32;
function n(e, t, i) {
return e & t ^ ~e & i
}
function o(e, t, i) {
return e & t ^ e & i ^ t & i
}
function s(e, t, i) {
return e ^ t ^ i
}
t.ft_1 = function (e, t, i, r) {
return 0 === e ? n(t, i, r) : 1 === e || 3 === e ? s(t, i, r) : 2 === e ? o(t, i, r) : void 0
}, t.ch32 = n, t.maj32 = o, t.p32 = s, t.s0_256 = function (e) {
return r(e, 2) ^ r(e, 13) ^ r(e, 22)
}, t.s1_256 = function (e) {
return r(e, 6) ^ r(e, 11) ^ r(e, 25)
}, t.g0_256 = function (e) {
return r(e, 7) ^ r(e, 18) ^ e >>> 3
}, t.g1_256 = function (e) {
return r(e, 17) ^ r(e, 19) ^ e >>> 10
}
}, function (e, t, i) {
"use strict";
var r = i(33),
n = i(71),
o = i(215),
s = i(25),
a = r.sum32,
c = r.sum32_4,
h = r.sum32_5,
u = o.ch32,
l = o.maj32,
f = o.s0_256,
d = o.s1_256,
p = o.g0_256,
m = o.g1_256,
g = n.BlockHash,
_ = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298];
function v() {
if (!(this instanceof v)) return new v;
g.call(this), this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], this.k = _, this.W = new Array(64)
}
r.inherits(v, g), e.exports = v, v.blockSize = 512, v.outSize = 256, v.hmacStrength = 192, v.padLength = 64, v.prototype._update = function (e, t) {
for (var i = this.W, r = 0; r < 16; r++) i[r] = e[t + r];
for (; r < i.length; r++) i[r] = c(m(i[r - 2]), i[r - 7], p(i[r - 15]), i[r - 16]);
var n = this.h[0],
o = this.h[1],
g = this.h[2],
_ = this.h[3],
v = this.h[4],
y = this.h[5],
b = this.h[6],
x = this.h[7];
for (s(this.k.length === i.length), r = 0; r < i.length; r++) {
var w = h(x, d(v), u(v, y, b), this.k[r], i[r]),
S = a(f(n), l(n, o, g));
x = b, b = y, y = v, v = a(_, w), _ = g, g = o, o = n, n = a(w, S)
}
this.h[0] = a(this.h[0], n), this.h[1] = a(this.h[1], o), this.h[2] = a(this.h[2], g), this.h[3] = a(this.h[3], _), this.h[4] = a(this.h[4], v), this.h[5] = a(this.h[5], y), this.h[6] = a(this.h[6], b), this.h[7] = a(this.h[7], x)
}, v.prototype._digest = function (e) {
return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big")
}
}, function (e, t, i) {
"use strict";
var r = i(33),
n = i(71),
o = i(25),
s = r.rotr64_hi,
a = r.rotr64_lo,
c = r.shr64_hi,
h = r.shr64_lo,
u = r.sum64,
l = r.sum64_hi,
f = r.sum64_lo,
d = r.sum64_4_hi,
p = r.sum64_4_lo,
m = r.sum64_5_hi,
g = r.sum64_5_lo,
_ = n.BlockHash,
v = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591];
function y() {
if (!(this instanceof y)) return new y;
_.call(this), this.h = [1779033703, 4089235720, 3144134277, 2227873595, 1013904242, 4271175723, 2773480762, 1595750129, 1359893119, 2917565137, 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209], this.k = v, this.W = new Array(160)
}
function b(e, t, i, r, n) {
var o = e & i ^ ~e & n;
return o < 0 && (o += 4294967296), o
}
function x(e, t, i, r, n, o) {
var s = t & r ^ ~t & o;
return s < 0 && (s += 4294967296), s
}
function w(e, t, i, r, n) {
var o = e & i ^ e & n ^ i & n;
return o < 0 && (o += 4294967296), o
}
function S(e, t, i, r, n, o) {
var s = t & r ^ t & o ^ r & o;
return s < 0 && (s += 4294967296), s
}
function T(e, t) {
var i = s(e, t, 28) ^ s(t, e, 2) ^ s(t, e, 7);
return i < 0 && (i += 4294967296), i
}
function A(e, t) {
var i = a(e, t, 28) ^ a(t, e, 2) ^ a(t, e, 7);
return i < 0 && (i += 4294967296), i
}
function M(e, t) {
var i = s(e, t, 14) ^ s(e, t, 18) ^ s(t, e, 9);
return i < 0 && (i += 4294967296), i
}
function E(e, t) {
var i = a(e, t, 14) ^ a(e, t, 18) ^ a(t, e, 9);
return i < 0 && (i += 4294967296), i
}
function P(e, t) {
var i = s(e, t, 1) ^ s(e, t, 8) ^ c(e, t, 7);
return i < 0 && (i += 4294967296), i
}
function C(e, t) {
var i = a(e, t, 1) ^ a(e, t, 8) ^ h(e, t, 7);
return i < 0 && (i += 4294967296), i
}
function R(e, t) {
var i = s(e, t, 19) ^ s(t, e, 29) ^ c(e, t, 6);
return i < 0 && (i += 4294967296), i
}
function I(e, t) {
var i = a(e, t, 19) ^ a(t, e, 29) ^ h(e, t, 6);
return i < 0 && (i += 4294967296), i
}
r.inherits(y, _), e.exports = y, y.blockSize = 1024, y.outSize = 512, y.hmacStrength = 192, y.padLength = 128, y.prototype._prepareBlock = function (e, t) {
for (var i = this.W, r = 0; r < 32; r++) i[r] = e[t + r];
for (; r < i.length; r += 2) {
var n = R(i[r - 4], i[r - 3]),
o = I(i[r - 4], i[r - 3]),
s = i[r - 14],
a = i[r - 13],
c = P(i[r - 30], i[r - 29]),
h = C(i[r - 30], i[r - 29]),
u = i[r - 32],
l = i[r - 31];
i[r] = d(n, o, s, a, c, h, u, l), i[r + 1] = p(n, o, s, a, c, h, u, l)
}
}, y.prototype._update = function (e, t) {
this._prepareBlock(e, t);
var i = this.W,
r = this.h[0],
n = this.h[1],
s = this.h[2],
a = this.h[3],
c = this.h[4],
h = this.h[5],
d = this.h[6],
p = this.h[7],
_ = this.h[8],
v = this.h[9],
y = this.h[10],
P = this.h[11],
C = this.h[12],
R = this.h[13],
I = this.h[14],
D = this.h[15];
o(this.k.length === i.length);
for (var O = 0; O < i.length; O += 2) {
var L = I,
F = D,
B = M(_, v),
k = E(_, v),
V = b(_, v, y, P, C),
N = x(_, v, y, P, C, R),
z = this.k[O],
U = this.k[O + 1],
G = i[O],
W = i[O + 1],
j = m(L, F, B, k, V, N, z, U, G, W),
H = g(L, F, B, k, V, N, z, U, G, W);
L = T(r, n), F = A(r, n), B = w(r, n, s, a, c), k = S(r, n, s, a, c, h);
var X = l(L, F, B, k),
Y = f(L, F, B, k);
I = C, D = R, C = y, R = P, y = _, P = v, _ = l(d, p, j, H), v = f(p, p, j, H), d = c, p = h, c = s, h = a, s = r, a = n, r = l(j, H, X, Y), n = f(j, H, X, Y)
}
u(this.h, 0, r, n), u(this.h, 2, s, a), u(this.h, 4, c, h), u(this.h, 6, d, p), u(this.h, 8, _, v), u(this.h, 10, y, P), u(this.h, 12, C, R), u(this.h, 14, I, D)
}, y.prototype._digest = function (e) {
return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big")
}
}, function (e, t, i) {
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 n = i(1),
o = i(73).Reporter,
s = i(9).Buffer;
function a(e, t) {
o.call(this, t), s.isBuffer(e) ? (this.base = e, this.offset = 0, this.length = e.length) : this.error("Input not Buffer")
}
function c(e, t) {
if (Array.isArray(e)) this.length = 0, this.value = e.map(function (e) {
return e instanceof c || (e = new c(e, t)), this.length += e.length, e
}, this);
else if ("number" == typeof e) {
if (!(0 <= e && e <= 255)) return t.error("non-byte EncoderBuffer value");
this.value = e, this.length = 1
} else if ("string" == typeof e) this.value = e, this.length = s.byteLength(e);
else {
if (!s.isBuffer(e)) return t.error("Unsupported type: " + r(e));
this.value = e, this.length = e.length
}
}
n(a, o), t.DecoderBuffer = a, a.prototype.save = function () {
return {
offset: this.offset,
reporter: o.prototype.save.call(this)
}
}, a.prototype.restore = function (e) {
var t = new a(this.base);
return t.offset = e.offset, t.length = this.offset, this.offset = e.offset, o.prototype.restore.call(this, e.reporter), t
}, a.prototype.isEmpty = function () {
return this.offset === this.length
}, a.prototype.readUInt8 = function (e) {
return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, !0) : this.error(e || "DecoderBuffer overrun")
}, a.prototype.skip = function (e, t) {
if (!(this.offset + e <= this.length)) return this.error(t || "DecoderBuffer overrun");
var i = new a(this.base);
return i._reporterState = this._reporterState, i.offset = this.offset, i.length = this.offset + e, this.offset += e, i
}, a.prototype.raw = function (e) {
return this.base.slice(e ? e.offset : this.offset, this.length)
}, t.EncoderBuffer = c, c.prototype.join = function (e, t) {
return e || (e = new s(this.length)), t || (t = 0), 0 === this.length ? e : (Array.isArray(this.value) ? this.value.forEach(function (i) {
i.join(e, t), t += i.length
}) : ("number" == typeof this.value ? e[t] = this.value : "string" == typeof this.value ? e.write(this.value, t) : s.isBuffer(this.value) && this.value.copy(e, t), t += this.length), e)
}
}, function (e, t, i) {
var r = t;
r._reverse = function (e) {
var t = {};
return Object.keys(e).forEach(function (i) {
(0 | i) == i && (i |= 0);
var r = e[i];
t[r] = i
}), t
}, r.der = i(575)
}, function (e, t, i) {
var r = i(1),
n = i(72),
o = n.base,
s = n.bignum,
a = n.constants.der;
function c(e) {
this.enc = "der", this.name = e.name, this.entity = e, this.tree = new h, this.tree._init(e.body)
}
function h(e) {
o.Node.call(this, "der", e)
}
function u(e, t) {
var i = e.readUInt8(t);
if (e.isError(i)) return i;
var r = a.tagClass[i >> 6],
n = 0 == (32 & i);
if (31 == (31 & i)) {
var o = i;
for (i = 0; 128 == (128 & o);) {
if (o = e.readUInt8(t), e.isError(o)) return o;
i <<= 7, i |= 127 & o
}
} else i &= 31;
return {
cls: r,
primitive: n,
tag: i,
tagStr: a.tag[i]
}
}
function l(e, t, i) {
var r = e.readUInt8(i);
if (e.isError(r)) return r;
if (!t && 128 === r) return null;
if (0 == (128 & r)) return r;
var n = 127 & r;
if (n > 4) return e.error("length octect is too long");
r = 0;
for (var o = 0; o < n; o++) {
r <<= 8;
var s = e.readUInt8(i);
if (e.isError(s)) return s;
r |= s
}
return r
}
e.exports = c, c.prototype.decode = function (e, t) {
return e instanceof o.DecoderBuffer || (e = new o.DecoderBuffer(e, t)), this.tree._decode(e, t)
}, r(h, o.Node), h.prototype._peekTag = function (e, t, i) {
if (e.isEmpty()) return !1;
var r = e.save(),
n = u(e, 'Failed to peek tag: "' + t + '"');
return e.isError(n) ? n : (e.restore(r), n.tag === t || n.tagStr === t || n.tagStr + "of" === t || i)
}, h.prototype._decodeTag = function (e, t, i) {
var r = u(e, 'Failed to decode tag of "' + t + '"');
if (e.isError(r)) return r;
var n = l(e, r.primitive, 'Failed to get length of "' + t + '"');
if (e.isError(n)) return n;
if (!i && r.tag !== t && r.tagStr !== t && r.tagStr + "of" !== t) return e.error('Failed to match tag: "' + t + '"');
if (r.primitive || null !== n) return e.skip(n, 'Failed to match body of: "' + t + '"');
var o = e.save(),
s = this._skipUntilEnd(e, 'Failed to skip indefinite length body: "' + this.tag + '"');
return e.isError(s) ? s : (n = e.offset - o.offset, e.restore(o), e.skip(n, 'Failed to match body of: "' + t + '"'))
}, h.prototype._skipUntilEnd = function (e, t) {
for (;;) {
var i = u(e, t);
if (e.isError(i)) return i;
var r, n = l(e, i.primitive, t);
if (e.isError(n)) return n;
if (r = i.primitive || null !== n ? e.skip(n) : this._skipUntilEnd(e, t), e.isError(r)) return r;
if ("end" === i.tagStr) break
}
}, h.prototype._decodeList = function (e, t, i, r) {
for (var n = []; !e.isEmpty();) {
var o = this._peekTag(e, "end");
if (e.isError(o)) return o;
var s = i.decode(e, "der", r);
if (e.isError(s) && o) break;
n.push(s)
}
return n
}, h.prototype._decodeStr = function (e, t) {
if ("bitstr" === t) {
var i = e.readUInt8();
return e.isError(i) ? i : {
unused: i,
data: e.raw()
}
}
if ("bmpstr" === t) {
var r = e.raw();
if (r.length % 2 == 1) return e.error("Decoding of string type: bmpstr length mismatch");
for (var n = "", o = 0; o < r.length / 2; o++) n += String.fromCharCode(r.readUInt16BE(2 * o));
return n
}
if ("numstr" === t) {
var s = e.raw().toString("ascii");
return this._isNumstr(s) ? s : e.error("Decoding of string type: numstr unsupported characters")
}
if ("octstr" === t) return e.raw();
if ("objDesc" === t) return e.raw();
if ("printstr" === t) {
var a = e.raw().toString("ascii");
return this._isPrintstr(a) ? a : e.error("Decoding of string type: printstr unsupported characters")
}
return /str$/.test(t) ? e.raw().toString() : e.error("Decoding of string type: " + t + " unsupported")
}, h.prototype._decodeObjid = function (e, t, i) {
for (var r, n = [], o = 0; !e.isEmpty();) {
var s = e.readUInt8();
o <<= 7, o |= 127 & s, 0 == (128 & s) && (n.push(o), o = 0)
}
128 & s && n.push(o);
var a = n[0] / 40 | 0,
c = n[0] % 40;
if (r = i ? n : [a, c].concat(n.slice(1)), t) {
var h = t[r.join(" ")];
void 0 === h && (h = t[r.join(".")]), void 0 !== h && (r = h)
}
return r
}, h.prototype._decodeTime = function (e, t) {
var i = e.raw().toString();
if ("gentime" === t) var r = 0 | i.slice(0, 4),
n = 0 | i.slice(4, 6),
o = 0 | i.slice(6, 8),
s = 0 | i.slice(8, 10),
a = 0 | i.slice(10, 12),
c = 0 | i.slice(12, 14);
else {
if ("utctime" !== t) return e.error("Decoding " + t + " time is not supported yet");
r = 0 | i.slice(0, 2), n = 0 | i.slice(2, 4), o = 0 | i.slice(4, 6), s = 0 | i.slice(6, 8), a = 0 | i.slice(8, 10), c = 0 | i.slice(10, 12);
r = r < 70 ? 2e3 + r : 1900 + r
}
return Date.UTC(r, n - 1, o, s, a, c, 0)
}, h.prototype._decodeNull = function (e) {
return null
}, h.prototype._decodeBool = function (e) {
var t = e.readUInt8();
return e.isError(t) ? t : 0 !== t
}, h.prototype._decodeInt = function (e, t) {
var i = e.raw(),
r = new s(i);
return t && (r = t[r.toString(10)] || r), r
}, h.prototype._use = function (e, t) {
return "function" == typeof e && (e = e(t)), e._getDecoder("der").tree
}
}, function (e, t, i) {
var r = i(1),
n = i(9).Buffer,
o = i(72),
s = o.base,
a = o.constants.der;
function c(e) {
this.enc = "der", this.name = e.name, this.entity = e, this.tree = new h, this.tree._init(e.body)
}
function h(e) {
s.Node.call(this, "der", e)
}
function u(e) {
return e < 10 ? "0" + e : e
}
e.exports = c, c.prototype.encode = function (e, t) {
return this.tree._encode(e, t).join()
}, r(h, s.Node), h.prototype._encodeComposite = function (e, t, i, r) {
var o, s = function (e, t, i, r) {
var n;
"seqof" === e ? e = "seq" : "setof" === e && (e = "set");
if (a.tagByName.hasOwnProperty(e)) n = a.tagByName[e];
else {
if ("number" != typeof e || (0 | e) !== e) return r.error("Unknown tag: " + e);
n = e
}
if (n >= 31) return r.error("Multi-octet tag encoding unsupported");
t || (n |= 32);
return n |= a.tagClassByName[i || "universal"] << 6
}(e, t, i, this.reporter);
if (r.length < 128) return (o = new n(2))[0] = s, o[1] = r.length, this._createEncoderBuffer([o, r]);
for (var c = 1, h = r.length; h >= 256; h >>= 8) c++;
(o = new n(2 + c))[0] = s, o[1] = 128 | c;
h = 1 + c;
for (var u = r.length; u > 0; h--, u >>= 8) o[h] = 255 & u;
return this._createEncoderBuffer([o, r])
}, h.prototype._encodeStr = function (e, t) {
if ("bitstr" === t) return this._createEncoderBuffer([0 | e.unused, e.data]);
if ("bmpstr" === t) {
for (var i = new n(2 * e.length), r = 0; r < e.length; r++) i.writeUInt16BE(e.charCodeAt(r), 2 * r);
return this._createEncoderBuffer(i)
}
return "numstr" === t ? this._isNumstr(e) ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: numstr supports only digits and space") : "printstr" === t ? this._isPrintstr(e) ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark") : /str$/.test(t) ? this._createEncoderBuffer(e) : "objDesc" === t ? this._createEncoderBuffer(e) : this.reporter.error("Encoding of string type: " + t + " unsupported")
}, h.prototype._encodeObjid = function (e, t, i) {
if ("string" == typeof e) {
if (!t) return this.reporter.error("string objid given, but no values map found");
if (!t.hasOwnProperty(e)) return this.reporter.error("objid not found in values map");
e = t[e].split(/[\s\.]+/g);
for (var r = 0; r < e.length; r++) e[r] |= 0
} else if (Array.isArray(e)) {
e = e.slice();
for (r = 0; r < e.length; r++) e[r] |= 0
}
if (!Array.isArray(e)) return this.reporter.error("objid() should be either array or string, got: " + JSON.stringify(e));
if (!i) {
if (e[1] >= 40) return this.reporter.error("Second objid identifier OOB");
e.splice(0, 2, 40 * e[0] + e[1])
}
var o = 0;
for (r = 0; r < e.length; r++) {
var s = e[r];
for (o++; s >= 128; s >>= 7) o++
}
var a = new n(o),
c = a.length - 1;
for (r = e.length - 1; r >= 0; r--) {
s = e[r];
for (a[c--] = 127 & s;
(s >>= 7) > 0;) a[c--] = 128 | 127 & s
}
return this._createEncoderBuffer(a)
}, h.prototype._encodeTime = function (e, t) {
var i, r = new Date(e);
return "gentime" === t ? i = [u(r.getFullYear()), u(r.getUTCMonth() + 1), u(r.getUTCDate()), u(r.getUTCHours()), u(r.getUTCMinutes()), u(r.getUTCSeconds()), "Z"].join("") : "utctime" === t ? i = [u(r.getFullYear() % 100), u(r.getUTCMonth() + 1), u(r.getUTCDate()), u(r.getUTCHours()), u(r.getUTCMinutes()), u(r.getUTCSeconds()), "Z"].join("") : this.reporter.error("Encoding " + t + " time is not supported yet"), this._encodeStr(i, "octstr")
}, h.prototype._encodeNull = function () {
return this._createEncoderBuffer("")
}, h.prototype._encodeInt = function (e, t) {
if ("string" == typeof e) {
if (!t) return this.reporter.error("String int or enum given, but no values map");
if (!t.hasOwnProperty(e)) return this.reporter.error("Values map doesn't contain: " + JSON.stringify(e));
e = t[e]
}
if ("number" != typeof e && !n.isBuffer(e)) {
var i = e.toArray();
!e.sign && 128 & i[0] && i.unshift(0), e = new n(i)
}
if (n.isBuffer(e)) {
var r = e.length;
0 === e.length && r++;
var o = new n(r);
return e.copy(o), 0 === e.length && (o[0] = 0), this._createEncoderBuffer(o)
}
if (e < 128) return this._createEncoderBuffer(e);
if (e < 256) return this._createEncoderBuffer([0, e]);
r = 1;
for (var s = e; s >= 256; s >>= 8) r++;
for (s = (o = new Array(r)).length - 1; s >= 0; s--) o[s] = 255 & e, e >>= 8;
return 128 & o[0] && o.unshift(0), this._createEncoderBuffer(new n(o))
}, h.prototype._encodeBool = function (e) {
return this._createEncoderBuffer(e ? 255 : 0)
}, h.prototype._use = function (e, t) {
return "function" == typeof e && (e = e(t)), e._getEncoder("der").tree
}, h.prototype._skipDefault = function (e, t, i) {
var r, n = this._baseState;
if (null === n.default) return !1;
var o = e.join();
if (void 0 === n.defaultBuffer && (n.defaultBuffer = this._encodeValue(n.default, t, i).join()), o.length !== n.defaultBuffer.length) return !1;
for (r = 0; r < o.length; r++)
if (o[r] !== n.defaultBuffer[r]) return !1;
return !0
}
}, function (e) {
e.exports = {
"1.3.132.0.10": "secp256k1",
"1.3.132.0.33": "p224",
"1.2.840.10045.3.1.1": "p192",
"1.2.840.10045.3.1.7": "p256",
"1.3.132.0.34": "p384",
"1.3.132.0.35": "p521"
}
}, function (e, t, i) {
var r = i(69),
n = i(2).Buffer;
function o(e) {
var t = n.allocUnsafe(4);
return t.writeUInt32BE(e, 0), t
}
e.exports = function (e, t) {
for (var i, s = n.alloc(0), a = 0; s.length < t;) i = o(a++), s = n.concat([s, r("sha1").update(e).update(i).digest()]);
return s.slice(0, t)
}
}, function (e, t) {
e.exports = function (e, t) {
for (var i = e.length, r = -1; ++r < i;) e[r] ^= t[r];
return e
}
}, function (e, t, i) {
var r = i(11),
n = i(2).Buffer;
e.exports = function (e, t) {
return n.from(e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed().toArray())
}
}, function (e, t, i) {
"use strict";
(function (e) {
var r = i(93),
n = i.n(r),
o = i(55),
s = i(18),
a = i(7),
c = i(227);
function h(e, t, i) {
return t in e ? Object.defineProperty(e, t, {
value: i,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = i, e
}
function u(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 l(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
var f = function () {
function t(e) {
! function (e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}(this, t), this.initializeState(e), this.welcomeInfoResolve = null, this.peer = null
}
var i, r, f;
return i = t, (r = [{
key: "initializeState",
value: function (e) {
this.state = {
code: e.code,
name: e.name,
connected: !1,
connecting: !1,
gameStarted: !1,
error: "",
host: null,
players: [],
game: e.game,
changedBlocks: [],
enqueuedChangedBlocks: [],
chatLog: []
}
}
}, {
key: "handleData",
value: function (e) {
switch (e.type) {
case "startGame":
this.setState({
gameStarted: !0
});
break;
case "players":
this.handlePlayers(e.players);
break;
case "changedBlocks":
this.handleChangedBlocks(e);
break;
case "fireEvent":
this.state.game.handleFireEvent(e.data);
break;
case "chatLog":
this.handleChatLog(e.chatLog);
break;
case "welcomeInfo":
this.handleWelcomeInfo(e);
break;
case "kicked":
this.handleOnKicked();
break;
default:
throw Error("Unknown input type " + e.type)
}
}
}, {
key: "handleChangedBlocks",
value: function (e) {
if (e.blocks.length || !this.state.game.playerSpawned)
if (this.state.game.worldGenerated) {
if (this.state.enqueuedChangedBlocks.length) {
this.state.changedBlocks = this.state.enqueuedChangedBlocks.splice(0), this.state.game.handleChangedBlocks(this.state.changedBlocks);
for (var t = 0; t < this.state.changedBlocks.length; t++) a.default.getInstance().addBlockChange(this.state.changedBlocks[t])
}
for (var i = 0; i < e.blocks.length; i++) void 0 === this.state.changedBlocks[e.from + i] && (this.state.changedBlocks[e.from + i] = e.blocks[i], a.default.getInstance().addBlockChange(e.blocks[i]));
this.state.game.handleChangedBlocks(e.blocks)
} else this.state.enqueuedChangedBlocks = u(this.state.enqueuedChangedBlocks).concat(u(e.blocks))
}
}, {
key: "broadcast",
value: function (e) {
this.peer.connected && this.peer.send(JSON.stringify(e))
}
}, {
key: "joinGame",
value: function () {
var t = this;
return new e(function (e, i) {
t.setState({
error: "",
connecting: !0
});
var r = t.state,
n = r.code;
r.database;
s.a.getGame(n).then(function (i) {
null == i ? t.handleNoSuchGame(e, n) : t.handleJoinExistingGame(n, e)
})
})
}
}, {
key: "handleJoinExistingGame",
value: function (e, t) {
var i = this;
s.a.getICECandidates().then(function (r) {
var o = c(8);
s.a.createSignalingChannel(e, o).then(function () {
var a = new n.a({
initiator: !0,
trickle: !1,
reconnectTimer: 3e3,
config: {
iceServers: r
}
});
i.peer = a, a.on("signal", function (t) {
s.a.sendSignalingTo(e, "host", o, t).then(function () {})
}), s.a.listenForData(e, function (e) {
void 0 !== e.payload.signal && a.signal(e.payload.signal)
}), a.on("data", function (e) {
i.handleData(JSON.parse(e))
}), i.handleConnectionEstablished(a, t, e), i.pollWorldChanges(), i.handleHostDisconnected(a, e), a.on("error", function (e) {
"ERR_ICE_CONNECTION_FAILURE" === e.code && (console.log("Host disconnected!"), console.log(e), console.log(this))
})
})
})
}
}, {
key: "handleHostDisconnected",
value: function (e, t) {
var i = this;
e.on("close", function () {
i.setState({
gameStarted: !1,
connected: !1,
error: "Disconnected from host",
code: ""
}), i.removeOtherPlayers()
})
}
}, {
key: "handleConnectionEstablished",
value: function (e, t, i) {
var r = this;
e.on("connect", function () {
setTimeout(function () {
r.broadcast({
type: "connected"
}), r.setState({
connected: !0,
connecting: !1
})
}, 1e3), t(i)
})
}
}, {
key: "pollWorldChanges",
value: function () {
var e = this;
setInterval(function () {
var t = e.state.changedBlocks.length ? e.state.changedBlocks.length : e.state.enqueuedChangedBlocks.length;
e.broadcast({
type: "requestChanges",
from: t
})
}, 1e3)
}
}, {
key: "handleNoSuchGame",
value: function (e, t) {
this.handleWelcomeInfo({
hostName: "no host",
gameFull: !0,
playerCount: 0,
maxPlayers: 0,
worldSeed: 0,
noSuchGame: !0,
worldSize: 128,
numberOfChangedBlocks: 0
}), e(t)
}
}, {
key: "getWelcomeInfo",
value: function () {
var t = this;
return new e(function (e, i) {
t.welcomeInfoResolve = e
})
}
}, {
key: "getSpawnedPlayerNames",
value: function () {
var e = [this.state.name];
for (var t in this.state.players) this.state.players[t].state.spawned && e.push(this.state.players[t].state.name);
return e
}
}, {
key: "setBlockAt",
value: function (e, t) {
this.broadcast({
type: "setBlockTypeAt",
data: {
position: e,
blockTypeId: t
}
})
}
}, {
key: "emitFireEvent",
value: function (e) {
this.broadcast({
type: "fireEvent",
data: e
})
}
}, {
key: "sendJoined",
value: function (e) {
var t = {
message: "",
timestamp: +new Date,
type: "joined",
from: e
};
this.broadcast({
type: "message",
message: t
})
}
}, {
key: "sendMessage",
value: function (e) {
var t = {
message: e,
timestamp: +new Date,
type: "message",
from: this.state.name
};
this.broadcast({
type: "message",
message: t
})
}
}, {
key: "setState",
value: function (e, t) {
"Disconnected from host" == e.error && this.state.game.onHostDisconnect && this.state.game.onHostDisconnect(), this.state = function (e) {
for (var t = 1; t < arguments.length; t++) {
var i = null != arguments[t] ? arguments[t] : {},
r = Object.keys(i);
"function" == typeof Object.getOwnPropertySymbols && (r = r.concat(Object.getOwnPropertySymbols(i).filter(function (e) {
return Object.getOwnPropertyDescriptor(i, e).enumerable
}))), r.forEach(function (t) {
h(e, t, i[t])
})
}
return e
}({}, this.state, e), t && "function" == typeof t && t()
}
}, {
key: "removeOtherPlayers",
value: function () {
for (var e in this.state.players) e !== this.state.name && (this.state.players[e].noaPlayer.remove(), delete this.state.players[e])
}
}, {
key: "handlePlayers",
value: function (e) {
if (this.state.game.playerSpawned) {
var t = [];
for (var i in e)
if (!0 === e[i].state.spawned) {
var r = e[i].state.name;
t.push(r), r !== this.state.name && void 0 === this.state.players[r] && (this.state.players[r] = new o.a({
name: r,
isClient: !0
})), r !== this.state.name && this.state.players[r].setState(e[i].state)
} for (var n in this.state.players) - 1 === t.indexOf(n) && (this.state.players[n].noaPlayer.remove(), delete this.state.players[n])
}
}
}, {
key: "kickPlayer",
value: function (e) {
return "Command not allowed"
}
}, {
key: "setSpawnToCurrentPosition",
value: function () {
return "Command not allowed"
}
}, {
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: "handleChatLog",
value: function (e) {
this.state.game.playerSpawned && (this.state.chatLog = e, this.state.game.updateChatLog(this.state.chatLog))
}
}, {
key: "handleOnKicked",
value: function () {
this.state.game.playerSpawned && this.state.game.onKicked()
}
}, {
key: "handleWelcomeInfo",
value: function (e) {
null != this.welcomeInfoResolve && this.welcomeInfoResolve(e), this.state.game.setHostInfo({
hostName: e.hostName,
gameFull: e.gameFull,
playerCount: e.playerCount,
maxPlayers: e.maxPlayers,
worldSeed: e.worldSeed,
worldSize: e.worldSize,
spawnPoint: e.spawnPoint,
noSuchGame: void 0 !== e.noSuchGame && e.noSuchGame,
numberOfChangedBlocks: e.numberOfChangedBlocks
}), e.gameFull && this.peer.destroy()
}
}]) && l(i.prototype, r), f && l(i, f), t
}();
t.a = f
}).call(this, i(52))
}, function (e, t, i) {
(function (t) {
var r = i(512);
e.exports = function (e, i) {
if (t.isBuffer(e) && (i = e, e = 0), "number" != typeof e && (e = 16), !t.isBuffer(i)) {
var n = Math.log(Math.pow(64, e)) / Math.log(2) / 8;
i = r.randomBytes(n)
}
return i.toString("base64").replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "").substr(0, e || void 0)
}
}).call(this, i(9).Buffer)
}, function (e, t, i) {
"use strict";
i.r(t);
i(229), i(396);
var r = i(18),
n = i(136),
o = i(226),
s = i(94),
a = i(55),
c = i(135),
h = i(7);
function u(e, t) {
for (var i = 0; i < t.length; i++) {
var r = t[i];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r)
}
}
new(function () {
function e() {
var t = this;
! function (e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}(this, e), r.a.init(), r.a.executeXhr("/game/multiplayer-enabled", "get").then(function (e) {
var i = new s.a,
r = Math.floor(99999999999999 * Math.random()),
n = new URL(document.location).searchParams;
h.default.getInstance().gameSaved() && (r = h.default.getInstance().getWorldSeed()), i.noWebrtcJoin = !1;
var o = new c.default;
if (o.isMobile) document.getElementById("mobile").style.display = "block";
else if (o.isWebGLSupported) {
var a = JSON.parse(e).multiplayerEnabled;
o.isSinglePlayer || "true" !== a ? t.setupAsSinglePlayer(r, i) : null === n.get("join") ? t.setupAsHost(n, r, i) : o.isWebRTCSupported ? t.setupAsClient(n, i) : (t.setupAsHost(n, r, i), i.noWebrtcJoin = !0)
} else document.getElementById("webgl_webrtc").style.display = "block"
})
}
var t, i, l;
return t = e, (i = [{
key: "setupAsClient",
value: function (e, t) {
var i = e.get("join"),
r = new o.a({
code: i,
game: t
}),
n = null;
t.setName = function (e) {
null === n && (n = new a.a({
name: e,
network: r,
isSelf: !0,
isClient: !0
}, function (e) {
r.broadcast({
type: "playerState",
data: {
state: e
}
})
}), r.setState({
name: e
}), t.setPlayer(n))
}, r.joinGame().then(function (e) {
h.default.getInstance().clearData()
}), r.getWelcomeInfo().then(function (e) {
h.default.getInstance().setWorldSeed(e.worldSeed), h.default.getInstance().setWorldSize(e.worldSize), t.initialize({
seed: e.worldSeed,
network: r
}), t.client = r
})
}
}, {
key: "setupAsSinglePlayer",
value: function (e, t) {
var i = new n.a({
name: "temp",
seed: e,
game: t
});
if (h.default.getInstance().setWorldSeed(e), h.default.getInstance().gameSaved()) {
var r = h.default.getInstance().getChangedBlocks();
i.setChangedBlocks(r)
}
t.initialize({
seed: e,
player: i.getPlayer(),
network: i,
singlePlayer: !0
}), t.setChangedBlockHandler(i.changedBlockHandler), t.setName = function (e) {
i.setName(e)
}
}
}, {
key: "setupAsHost",
value: function (e, t, i) {
var r = this,
o = null !== e.get("host") ? e.get("host") : null,
s = new n.a({
name: "temp",
seed: t,
game: i
});
if (h.default.getInstance().setWorldSeed(t), h.default.getInstance().gameSaved()) {
var a = h.default.getInstance().getChangedBlocks();
s.setChangedBlocks(a)
}
s.initNewGame(o).then(function (n) {
r.setHostUrl(e, n), i.initialize({
seed: t,
player: s.getPlayer(),
network: s
}), i.setChangedBlockHandler(s.changedBlockHandler)
}), i.setName = function (e) {
s.setName(e)
}
}
}, {
key: "setHostUrl",
value: function (e, t) {
if ("URLSearchParams" in window) {
var i = new URLSearchParams(window.location.search);
i.set("host", t), history.pushState({}, t, "?" + i.toString())
}
}
}]) && u(t.prototype, i), l && u(t, l), e
}())
}, function (e, t, i) {
"use strict";
(function (e) {
i(230), i(373), i(375), i(377), i(379), i(381), i(383), i(385), i(387), i(389), i(393), e._babelPolyfill && "undefined" != typeof console && console.warn && console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."), e._babelPolyfill = !0
}).call(this, i(15))
}, function (e, t, i) {
i(231), i(233), i(234), i(235), i(236), i(237), i(238), i(239), i(240), i(241), i(242), i(243), i(244), i(245), i(246), i(247), i(248), i(249), i(250), i(251), i(252), i(253), i(254), i(255), i(256), i(257), i(258), i(259), i(260), i(261), i(262), i(263), i(264), i(265), i(266), i(267), i(268), i(269), i(270), i(271), i(272), i(273), i(274), i(276), i(277), i(278), i(279), i(280), i(281), i(282), i(283), i(284), i(285), i(286), i(287), i(288), i(289), i(290), i(291), i(292), i(293), i(294), i(295), i(296), i(297), i(298), i(299), i(300), i(301), i(302), i(303), i(304), i(305), i(306), i(307), i(308), i(309), i(311), i(312), i(314), i(315), i(316), i(317), i(318), i(319), i(320), i(323), i(324), i(325), i(326), i(327), i(328), i(329), i(330), i(331), i(332), i(333), i(334), i(335), i(117), i(336), i(156), i(337), i(157), i(338), i(339), i(340), i(341), i(158), i(344), i(345), i(346), i(347), i(348), i(349), i(350), i(351), i(352), i(353), i(354), i(355), i(356), i(357), i(358), i(359), i(360), i(361), i(362), i(363), i(364), i(365), i(366), i(367), i(368), i(369), i(370), i(371), i(372), e.exports = i(14)
}, function (e, t, i) {
"use strict";
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 n = i(5),
o = i(22),
s = i(13),
a = i(0),
c = i(19),
h = i(40).KEY,
u = i(3),
l = i(96),
f = i(56),
d = i(45),
p = i(8),
m = i(97),
g = i(138),
_ = i(232),
v = i(100),
y = i(4),
b = i(6),
x = i(24),
w = i(39),
S = i(44),
T = i(49),
A = i(141),
M = i(29),
E = i(12),
P = i(47),
C = M.f,
R = E.f,
I = A.f,
D = n.Symbol,
O = n.JSON,
L = O && O.stringify,
F = p("_hidden"),
B = p("toPrimitive"),
k = {}.propertyIsEnumerable,
V = l("symbol-registry"),
N = l("symbols"),
z = l("op-symbols"),
U = Object.prototype,
G = "function" == typeof D,
W = n.QObject,
j = !W || !W.prototype || !W.prototype.findChild,
H = s && u(function () {
return 7 != T(R({}, "a", {
get: function () {
return R(this, "a", {
value: 7
}).a
}
})).a
}) ? function (e, t, i) {
var r = C(U, t);
r && delete U[t], R(e, t, i), r && e !== U && R(U, t, r)
} : R,
X = function (e) {
var t = N[e] = T(D.prototype);
return t._k = e, t
},
Y = G && "symbol" == r(D.iterator) ? function (e) {
return "symbol" == r(e)
} : function (e) {
return e instanceof D
},
K = function (e, t, i) {
return e === U && K(z, t, i), y(e), t = w(t, !0), y(i), o(N, t) ? (i.enumerable ? (o(e, F) && e[F][t] && (e[F][t] = !1), i = T(i, {
enumerable: S(0, !1)
})) : (o(e, F) || R(e, F, S(1, {})), e[F][t] = !0), H(e, t, i)) : R(e, t, i)
},
q = function (e, t) {
y(e);
for (var i, r = _(t = x(t)), n = 0, o = r.length; o > n;) K(e, i = r[n++], t[i]);
return e
},
Z = function (e) {
var t = k.call(this, e = w(e, !0));
return !(this === U && o(N, e) && !o(z, e)) && (!(t || !o(this, e) || !o(N, e) || o(this, F) && this[F][e]) || t)
},
Q = function (e, t) {
if (e = x(e), t = w(t, !0), e !== U || !o(N, t) || o(z, t)) {
var i = C(e, t);
return !i || !o(N, t) || o(e, F) && e[F][t] || (i.enumerable = !0), i
}
},
J = function (e) {
for (var t, i = I(x(e)), r = [], n = 0; i.length > n;) o(N, t = i[n++]) || t == F || t == h || r.push(t);
return r
},
$ = function (e) {
for (var t, i = e === U, r = I(i ? z : x(e)), n = [], s = 0; r.length > s;) !o(N, t = r[s++]) || i && !o(U, t) || n.push(N[t]);
return n
};
G || (c((D = function () {
if (this instanceof D) throw TypeError("Symbol is not a constructor!");
var e = d(arguments.length > 0 ? arguments[0] : void 0);
return s && j && H(U, e, {
configurable: !0,
set: function t(i) {
this === U && t.call(z, i), o(this, F) && o(this[F], e) && (this[F][e] = !1), H(this, e, S(1, i))
}
}), X(e)
}).prototype, "toString", function () {
return this._k
}), M.f = Q, E.f = K, i(50).f = A.f = J, i(65).f = Z, i(75).f = $, s && !i(46) && c(U, "propertyIsEnumerable", Z, !0), m.f = function (e) {
return X(p(e))
}), a(a.G + a.W + a.F * !G, {
Symbol: D
});
for (var ee = "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","), te = 0; ee.length > te;) p(ee[te++]);
for (var ie = P(p.store), re = 0; ie.length > re;) g(ie[re++]);
a(a.S + a.F * !G, "Symbol", {
for: function (e) {
return o(V, e += "") ? V[e] : V[e] = D(e)
},
keyFor: function (e) {
if (!Y(e)) throw TypeError(e + " is not a symbol!");
for (var t in V)
if (V[t] === e) return t
},
useSetter: function () {
j = !0
},
useSimple: function () {
j = !1
}
}), a(a.S + a.F * !G, "Object", {
create: function (e, t) {
return void 0 === t ? T(e) : q(T(e), t)
},
defineProperty: K,
defineProperties: q,
getOwnPropertyDescriptor: Q,
getOwnPropertyNames: J,
getOwnPropertySymbols: $
}), O && a(a.S + a.F * (!G || u(function () {
var e = D();
return "[null]" != L([e]) || "{}" != L({
a: e
}) || "{}" != L(Object(e))
})), "JSON", {
stringify: function (e) {
for (var t, i, r = [e], n = 1; arguments.length > n;) r.push(arguments[n++]);
if (i = t = r[1], (b(t) || void 0 !== e) && !Y(e)) return v(t) || (t = function (e, t) {
if ("function" == typeof i && (t = i.call(this, e, t)), !Y(t)) return t
}), r[1] = t, L.apply(O, r)
}
}), D.prototype[B] || i(23)(D.prototype, B, D.prototype.valueOf), f(D, "Symbol"), f(Math, "Math", !0), f(n.JSON, "JSON", !0)
}, function (e, t, i) {
var r = i(47),
n = i(75),
o = i(65);
e.exports = function (e) {
var t = r(e),
i = n.f;
if (i)
for (var s, a = i(e), c = o.f, h = 0; a.length > h;) c.call(e, s = a[h++]) && t.push(s);
return t
}
}, function (e, t, i) {
var r = i(0);
r(r.S, "Object", {
create: i(49)
})
}, function (e, t, i) {
var r = i(0);
r(r.S + r.F * !i(13), "Object", {
defineProperty: i(12).f
})
}, function (e, t, i) {
var r = i(0);
r(r.S + r.F * !i(13), "Object", {
defineProperties: i(140)
})
}, function (e, t, i) {
var r = i(24),
n = i(29).f;
i(30)("getOwnPropertyDescriptor", function () {
return function (e, t) {
return n(r(e), t)
}
})
}, function (e, t, i) {
var r = i(20),
n = i(51);
i(30)("getPrototypeOf", function () {
return function (e) {
return n(r(e))
}
})
}, function (e, t, i) {
var r = i(20),
n = i(47);
i(30)("keys", function () {
return function (e) {
return n(r(e))
}
})
}, function (e, t, i) {
i(30)("getOwnPropertyNames", function () {
return i(141).f
})
}, function (e, t, i) {
var r = i(6),
n = i(40).onFreeze;
i(30)("freeze", function (e) {
return function (t) {
return e && r(t) ? e(n(t)) : t
}
})
}, function (e, t, i) {
var r = i(6),
n = i(40).onFreeze;
i(30)("seal", function (e) {
return function (t) {
return e && r(t) ? e(n(t)) : t
}
})
}, function (e, t, i) {
var r = i(6),
n = i(40).onFreeze;
i(30)("preventExtensions", function (e) {
return function (t) {
return e && r(t) ? e(n(t)) : t
}
})
}, function (e, t, i) {
var r = i(6);
i(30)("isFrozen", function (e) {
return function (t) {
return !r(t) || !!e && e(t)
}
})
}, function (e, t, i) {
var r = i(6);
i(30)("isSealed", function (e) {
return function (t) {
return !r(t) || !!e && e(t)
}
})
}, function (e, t, i) {
var r = i(6);
i(30)("isExtensible", function (e) {
return function (t) {
return !!r(t) && (!e || e(t))
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S + r.F, "Object", {
assign: i(142)
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Object", {
is: i(143)
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Object", {
setPrototypeOf: i(102).set
})
}, function (e, t, i) {
"use strict";
var r = i(66),
n = {};
n[i(8)("toStringTag")] = "z", n + "" != "[object z]" && i(19)(Object.prototype, "toString", function () {
return "[object " + r(this) + "]"
}, !0)
}, function (e, t, i) {
var r = i(0);
r(r.P, "Function", {
bind: i(144)
})
}, function (e, t, i) {
var r = i(12).f,
n = Function.prototype,
o = /^\s*function ([^ (]*)/;
"name" in n || i(13) && r(n, "name", {
configurable: !0,
get: function () {
try {
return ("" + this).match(o)[1]
} catch (e) {
return ""
}
}
})
}, function (e, t, i) {
"use strict";
var r = i(6),
n = i(51),
o = i(8)("hasInstance"),
s = Function.prototype;
o in s || i(12).f(s, o, {
value: function (e) {
if ("function" != typeof this || !r(e)) return !1;
if (!r(this.prototype)) return e instanceof this;
for (; e = n(e);)
if (this.prototype === e) return !0;
return !1
}
})
}, function (e, t, i) {
var r = i(0),
n = i(146);
r(r.G + r.F * (parseInt != n), {
parseInt: n
})
}, function (e, t, i) {
var r = i(0),
n = i(147);
r(r.G + r.F * (parseFloat != n), {
parseFloat: n
})
}, function (e, t, i) {
"use strict";
var r = i(5),
n = i(22),
o = i(36),
s = i(104),
a = i(39),
c = i(3),
h = i(50).f,
u = i(29).f,
l = i(12).f,
f = i(76).trim,
d = r.Number,
p = d,
m = d.prototype,
g = "Number" == o(i(49)(m)),
_ = "trim" in String.prototype,
v = function (e) {
var t = a(e, !1);
if ("string" == typeof t && t.length > 2) {
var i, r, n, o = (t = _ ? t.trim() : f(t, 3)).charCodeAt(0);
if (43 === o || 45 === o) {
if (88 === (i = t.charCodeAt(2)) || 120 === i) return NaN
} else if (48 === o) {
switch (t.charCodeAt(1)) {
case 66:
case 98:
r = 2, n = 49;
break;
case 79:
case 111:
r = 8, n = 55;
break;
default:
return +t
}
for (var s, c = t.slice(2), h = 0, u = c.length; h < u; h++)
if ((s = c.charCodeAt(h)) < 48 || s > n) return NaN;
return parseInt(c, r)
}
}
return +t
};
if (!d(" 0o1") || !d("0b1") || d("+0x1")) {
d = function (e) {
var t = arguments.length < 1 ? 0 : e,
i = this;
return i instanceof d && (g ? c(function () {
m.valueOf.call(i)
}) : "Number" != o(i)) ? s(new p(v(t)), i, d) : v(t)
};
for (var y, b = i(13) ? h(p) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","), x = 0; b.length > x; x++) n(p, y = b[x]) && !n(d, y) && l(d, y, u(p, y));
d.prototype = m, m.constructor = d, i(19)(r, "Number", d)
}
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(28),
o = i(148),
s = i(105),
a = 1..toFixed,
c = Math.floor,
h = [0, 0, 0, 0, 0, 0],
u = "Number.toFixed: incorrect invocation!",
l = function (e, t) {
for (var i = -1, r = t; ++i < 6;) r += e * h[i], h[i] = r % 1e7, r = c(r / 1e7)
},
f = function (e) {
for (var t = 6, i = 0; --t >= 0;) i += h[t], h[t] = c(i / e), i = i % e * 1e7
},
d = function () {
for (var e = 6, t = ""; --e >= 0;)
if ("" !== t || 0 === e || 0 !== h[e]) {
var i = String(h[e]);
t = "" === t ? i : t + s.call("0", 7 - i.length) + i
} return t
},
p = function e(t, i, r) {
return 0 === i ? r : i % 2 == 1 ? e(t, i - 1, r * t) : e(t * t, i / 2, r)
};
r(r.P + r.F * (!!a && ("0.000" !== 8e-5.toFixed(3) || "1" !== .9.toFixed(0) || "1.25" !== 1.255.toFixed(2) || "1000000000000000128" !== (0xde0b6b3a7640080).toFixed(0)) || !i(3)(function () {
a.call({})
})), "Number", {
toFixed: function (e) {
var t, i, r, a, c = o(this, u),
h = n(e),
m = "",
g = "0";
if (h < 0 || h > 20) throw RangeError(u);
if (c != c) return "NaN";
if (c <= -1e21 || c >= 1e21) return String(c);
if (c < 0 && (m = "-", c = -c), c > 1e-21)
if (i = (t = function (e) {
for (var t = 0, i = e; i >= 4096;) t += 12, i /= 4096;
for (; i >= 2;) t += 1, i /= 2;
return t
}(c * p(2, 69, 1)) - 69) < 0 ? c * p(2, -t, 1) : c / p(2, t, 1), i *= 4503599627370496, (t = 52 - t) > 0) {
for (l(0, i), r = h; r >= 7;) l(1e7, 0), r -= 7;
for (l(p(10, r, 1), 0), r = t - 1; r >= 23;) f(1 << 23), r -= 23;
f(1 << r), l(1, 1), f(2), g = d()
} else l(0, i), l(1 << -t, 0), g = d() + s.call("0", h);
return g = h > 0 ? m + ((a = g.length) <= h ? "0." + s.call("0", h - a) + g : g.slice(0, a - h) + "." + g.slice(a - h)) : m + g
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(3),
o = i(148),
s = 1..toPrecision;
r(r.P + r.F * (n(function () {
return "1" !== s.call(1, void 0)
}) || !n(function () {
s.call({})
})), "Number", {
toPrecision: function (e) {
var t = o(this, "Number#toPrecision: incorrect invocation!");
return void 0 === e ? s.call(t) : s.call(t, e)
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Number", {
EPSILON: Math.pow(2, -52)
})
}, function (e, t, i) {
var r = i(0),
n = i(5).isFinite;
r(r.S, "Number", {
isFinite: function (e) {
return "number" == typeof e && n(e)
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Number", {
isInteger: i(149)
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Number", {
isNaN: function (e) {
return e != e
}
})
}, function (e, t, i) {
var r = i(0),
n = i(149),
o = Math.abs;
r(r.S, "Number", {
isSafeInteger: function (e) {
return n(e) && o(e) <= 9007199254740991
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Number", {
MAX_SAFE_INTEGER: 9007199254740991
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Number", {
MIN_SAFE_INTEGER: -9007199254740991
})
}, function (e, t, i) {
var r = i(0),
n = i(147);
r(r.S + r.F * (Number.parseFloat != n), "Number", {
parseFloat: n
})
}, function (e, t, i) {
var r = i(0),
n = i(146);
r(r.S + r.F * (Number.parseInt != n), "Number", {
parseInt: n
})
}, function (e, t, i) {
var r = i(0),
n = i(150),
o = Math.sqrt,
s = Math.acosh;
r(r.S + r.F * !(s && 710 == Math.floor(s(Number.MAX_VALUE)) && s(1 / 0) == 1 / 0), "Math", {
acosh: function (e) {
return (e = +e) < 1 ? NaN : e > 94906265.62425156 ? Math.log(e) + Math.LN2 : n(e - 1 + o(e - 1) * o(e + 1))
}
})
}, function (e, t, i) {
var r = i(0),
n = Math.asinh;
r(r.S + r.F * !(n && 1 / n(0) > 0), "Math", {
asinh: function e(t) {
return isFinite(t = +t) && 0 != t ? t < 0 ? -e(-t) : Math.log(t + Math.sqrt(t * t + 1)) : t
}
})
}, function (e, t, i) {
var r = i(0),
n = Math.atanh;
r(r.S + r.F * !(n && 1 / n(-0) < 0), "Math", {
atanh: function (e) {
return 0 == (e = +e) ? e : Math.log((1 + e) / (1 - e)) / 2
}
})
}, function (e, t, i) {
var r = i(0),
n = i(106);
r(r.S, "Math", {
cbrt: function (e) {
return n(e = +e) * Math.pow(Math.abs(e), 1 / 3)
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
clz32: function (e) {
return (e >>>= 0) ? 31 - Math.floor(Math.log(e + .5) * Math.LOG2E) : 32
}
})
}, function (e, t, i) {
var r = i(0),
n = Math.exp;
r(r.S, "Math", {
cosh: function (e) {
return (n(e = +e) + n(-e)) / 2
}
})
}, function (e, t, i) {
var r = i(0),
n = i(107);
r(r.S + r.F * (n != Math.expm1), "Math", {
expm1: n
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
fround: i(275)
})
}, function (e, t, i) {
var r = i(106),
n = Math.pow,
o = n(2, -52),
s = n(2, -23),
a = n(2, 127) * (2 - s),
c = n(2, -126);
e.exports = Math.fround || function (e) {
var t, i, n = Math.abs(e),
h = r(e);
return n < c ? h * (n / c / s + 1 / o - 1 / o) * c * s : (i = (t = (1 + s / o) * n) - (t - n)) > a || i != i ? h * (1 / 0) : h * i
}
}, function (e, t, i) {
var r = i(0),
n = Math.abs;
r(r.S, "Math", {
hypot: function (e, t) {
for (var i, r, o = 0, s = 0, a = arguments.length, c = 0; s < a;) c < (i = n(arguments[s++])) ? (o = o * (r = c / i) * r + 1, c = i) : o += i > 0 ? (r = i / c) * r : i;
return c === 1 / 0 ? 1 / 0 : c * Math.sqrt(o)
}
})
}, function (e, t, i) {
var r = i(0),
n = Math.imul;
r(r.S + r.F * i(3)(function () {
return -5 != n(4294967295, 5) || 2 != n.length
}), "Math", {
imul: function (e, t) {
var i = +e,
r = +t,
n = 65535 & i,
o = 65535 & r;
return 0 | n * o + ((65535 & i >>> 16) * o + n * (65535 & r >>> 16) << 16 >>> 0)
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
log10: function (e) {
return Math.log(e) * Math.LOG10E
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
log1p: i(150)
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
log2: function (e) {
return Math.log(e) / Math.LN2
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
sign: i(106)
})
}, function (e, t, i) {
var r = i(0),
n = i(107),
o = Math.exp;
r(r.S + r.F * i(3)(function () {
return -2e-17 != !Math.sinh(-2e-17)
}), "Math", {
sinh: function (e) {
return Math.abs(e = +e) < 1 ? (n(e) - n(-e)) / 2 : (o(e - 1) - o(-e - 1)) * (Math.E / 2)
}
})
}, function (e, t, i) {
var r = i(0),
n = i(107),
o = Math.exp;
r(r.S, "Math", {
tanh: function (e) {
var t = n(e = +e),
i = n(-e);
return t == 1 / 0 ? 1 : i == 1 / 0 ? -1 : (t - i) / (o(e) + o(-e))
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Math", {
trunc: function (e) {
return (e > 0 ? Math.floor : Math.ceil)(e)
}
})
}, function (e, t, i) {
var r = i(0),
n = i(48),
o = String.fromCharCode,
s = String.fromCodePoint;
r(r.S + r.F * (!!s && 1 != s.length), "String", {
fromCodePoint: function (e) {
for (var t, i = [], r = arguments.length, s = 0; r > s;) {
if (t = +arguments[s++], n(t, 1114111) !== t) throw RangeError(t + " is not a valid code point");
i.push(t < 65536 ? o(t) : o(55296 + ((t -= 65536) >> 10), t % 1024 + 56320))
}
return i.join("")
}
})
}, function (e, t, i) {
var r = i(0),
n = i(24),
o = i(10);
r(r.S, "String", {
raw: function (e) {
for (var t = n(e.raw), i = o(t.length), r = arguments.length, s = [], a = 0; i > a;) s.push(String(t[a++])), a < r && s.push(String(arguments[a]));
return s.join("")
}
})
}, function (e, t, i) {
"use strict";
i(76)("trim", function (e) {
return function () {
return e(this, 3)
}
})
}, function (e, t, i) {
"use strict";
var r = i(108)(!0);
i(109)(String, "String", function (e) {
this._t = String(e), this._i = 0
}, function () {
var e, t = this._t,
i = this._i;
return i >= t.length ? {
value: void 0,
done: !0
} : (e = r(t, i), this._i += e.length, {
value: e,
done: !1
})
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(108)(!1);
r(r.P, "String", {
codePointAt: function (e) {
return n(this, e)
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(10),
o = i(110),
s = "".endsWith;
r(r.P + r.F * i(112)("endsWith"), "String", {
endsWith: function (e) {
var t = o(this, e, "endsWith"),
i = arguments.length > 1 ? arguments[1] : void 0,
r = n(t.length),
a = void 0 === i ? r : Math.min(n(i), r),
c = String(e);
return s ? s.call(t, c, a) : t.slice(a - c.length, a) === c
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(110);
r(r.P + r.F * i(112)("includes"), "String", {
includes: function (e) {
return !!~n(this, e, "includes").indexOf(e, arguments.length > 1 ? arguments[1] : void 0)
}
})
}, function (e, t, i) {
var r = i(0);
r(r.P, "String", {
repeat: i(105)
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(10),
o = i(110),
s = "".startsWith;
r(r.P + r.F * i(112)("startsWith"), "String", {
startsWith: function (e) {
var t = o(this, e, "startsWith"),
i = n(Math.min(arguments.length > 1 ? arguments[1] : void 0, t.length)),
r = String(e);
return s ? s.call(t, r, i) : t.slice(i, i + r.length) === r
}
})
}, function (e, t, i) {
"use strict";
i(21)("anchor", function (e) {
return function (t) {
return e(this, "a", "name", t)
}
})
}, function (e, t, i) {
"use strict";
i(21)("big", function (e) {
return function () {
return e(this, "big", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("blink", function (e) {
return function () {
return e(this, "blink", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("bold", function (e) {
return function () {
return e(this, "b", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("fixed", function (e) {
return function () {
return e(this, "tt", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("fontcolor", function (e) {
return function (t) {
return e(this, "font", "color", t)
}
})
}, function (e, t, i) {
"use strict";
i(21)("fontsize", function (e) {
return function (t) {
return e(this, "font", "size", t)
}
})
}, function (e, t, i) {
"use strict";
i(21)("italics", function (e) {
return function () {
return e(this, "i", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("link", function (e) {
return function (t) {
return e(this, "a", "href", t)
}
})
}, function (e, t, i) {
"use strict";
i(21)("small", function (e) {
return function () {
return e(this, "small", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("strike", function (e) {
return function () {
return e(this, "strike", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("sub", function (e) {
return function () {
return e(this, "sub", "", "")
}
})
}, function (e, t, i) {
"use strict";
i(21)("sup", function (e) {
return function () {
return e(this, "sup", "", "")
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Date", {
now: function () {
return (new Date).getTime()
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(20),
o = i(39);
r(r.P + r.F * i(3)(function () {
return null !== new Date(NaN).toJSON() || 1 !== Date.prototype.toJSON.call({
toISOString: function () {
return 1
}
})
}), "Date", {
toJSON: function (e) {
var t = n(this),
i = o(t);
return "number" != typeof i || isFinite(i) ? t.toISOString() : null
}
})
}, function (e, t, i) {
var r = i(0),
n = i(310);
r(r.P + r.F * (Date.prototype.toISOString !== n), "Date", {
toISOString: n
})
}, function (e, t, i) {
"use strict";
var r = i(3),
n = Date.prototype.getTime,
o = Date.prototype.toISOString,
s = function (e) {
return e > 9 ? e : "0" + e
};
e.exports = r(function () {
return "0385-07-25T07:06:39.999Z" != o.call(new Date(-5e13 - 1))
}) || !r(function () {
o.call(new Date(NaN))
}) ? function () {
if (!isFinite(n.call(this))) throw RangeError("Invalid time value");
var e = this,
t = e.getUTCFullYear(),
i = e.getUTCMilliseconds(),
r = t < 0 ? "-" : t > 9999 ? "+" : "";
return r + ("00000" + Math.abs(t)).slice(r ? -6 : -4) + "-" + s(e.getUTCMonth() + 1) + "-" + s(e.getUTCDate()) + "T" + s(e.getUTCHours()) + ":" + s(e.getUTCMinutes()) + ":" + s(e.getUTCSeconds()) + "." + (i > 99 ? i : "0" + s(i)) + "Z"
} : o
}, function (e, t, i) {
var r = Date.prototype,
n = r.toString,
o = r.getTime;
new Date(NaN) + "" != "Invalid Date" && i(19)(r, "toString", function () {
var e = o.call(this);
return e == e ? n.call(this) : "Invalid Date"
})
}, function (e, t, i) {
var r = i(8)("toPrimitive"),
n = Date.prototype;
r in n || i(23)(n, r, i(313))
}, function (e, t, i) {
"use strict";
var r = i(4),
n = i(39);
e.exports = function (e) {
if ("string" !== e && "number" !== e && "default" !== e) throw TypeError("Incorrect hint");
return n(r(this), "number" != e)
}
}, function (e, t, i) {
var r = i(0);
r(r.S, "Array", {
isArray: i(100)
})
}, function (e, t, i) {
"use strict";
var r = i(34),
n = i(0),
o = i(20),
s = i(152),
a = i(113),
c = i(10),
h = i(114),
u = i(115);
n(n.S + n.F * !i(77)(function (e) {
Array.from(e)
}), "Array", {
from: function (e) {
var t, i, n, l, f = o(e),
d = "function" == typeof this ? this : Array,
p = arguments.length,
m = p > 1 ? arguments[1] : void 0,
g = void 0 !== m,
_ = 0,
v = u(f);
if (g && (m = r(m, p > 2 ? arguments[2] : void 0, 2)), null == v || d == Array && a(v))
for (i = new d(t = c(f.length)); t > _; _++) h(i, _, g ? m(f[_], _) : f[_]);
else
for (l = v.call(f), i = new d; !(n = l.next()).done; _++) h(i, _, g ? s(l, m, [n.value, _], !0) : n.value);
return i.length = _, i
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(114);
r(r.S + r.F * i(3)(function () {
function e() {}
return !(Array.of.call(e) instanceof e)
}), "Array", {
of: function () {
for (var e = 0, t = arguments.length, i = new("function" == typeof this ? this : Array)(t); t > e;) n(i, e, arguments[e++]);
return i.length = t, i
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(24),
o = [].join;
r(r.P + r.F * (i(64) != Object || !i(26)(o)), "Array", {
join: function (e) {
return o.call(n(this), void 0 === e ? "," : e)
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(101),
o = i(36),
s = i(48),
a = i(10),
c = [].slice;
r(r.P + r.F * i(3)(function () {
n && c.call(n)
}), "Array", {
slice: function (e, t) {
var i = a(this.length),
r = o(this);
if (t = void 0 === t ? i : t, "Array" == r) return c.call(this, e, t);
for (var n = s(e, i), h = s(t, i), u = a(h - n), l = new Array(u), f = 0; f < u; f++) l[f] = "String" == r ? this.charAt(n + f) : this[n + f];
return l
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(35),
o = i(20),
s = i(3),
a = [].sort,
c = [1, 2, 3];
r(r.P + r.F * (s(function () {
c.sort(void 0)
}) || !s(function () {
c.sort(null)
}) || !i(26)(a)), "Array", {
sort: function (e) {
return void 0 === e ? a.call(o(this)) : a.call(o(this), n(e))
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(0),
o = i(26)([].forEach, !0);
r(r.P + r.F * !o, "Array", {
forEach: function (e) {
return n(this, e, arguments[1])
}
})
}, function (e, t, i) {
var r = i(322);
e.exports = function (e, t) {
return new(r(e))(t)
}
}, function (e, t, i) {
var r = i(6),
n = i(100),
o = i(8)("species");
e.exports = function (e) {
var t;
return n(e) && ("function" != typeof (t = e.constructor) || t !== Array && !n(t.prototype) || (t = void 0), r(t) && null === (t = t[o]) && (t = void 0)), void 0 === t ? Array : t
}
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(1);
r(r.P + r.F * !i(26)([].map, !0), "Array", {
map: function (e) {
return n(this, e, arguments[1])
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(2);
r(r.P + r.F * !i(26)([].filter, !0), "Array", {
filter: function (e) {
return n(this, e, arguments[1])
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(3);
r(r.P + r.F * !i(26)([].some, !0), "Array", {
some: function (e) {
return n(this, e, arguments[1])
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(4);
r(r.P + r.F * !i(26)([].every, !0), "Array", {
every: function (e) {
return n(this, e, arguments[1])
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(153);
r(r.P + r.F * !i(26)([].reduce, !0), "Array", {
reduce: function (e) {
return n(this, e, arguments.length, arguments[1], !1)
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(153);
r(r.P + r.F * !i(26)([].reduceRight, !0), "Array", {
reduceRight: function (e) {
return n(this, e, arguments.length, arguments[1], !0)
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(74)(!1),
o = [].indexOf,
s = !!o && 1 / [1].indexOf(1, -0) < 0;
r(r.P + r.F * (s || !i(26)(o)), "Array", {
indexOf: function (e) {
return s ? o.apply(this, arguments) || 0 : n(this, e, arguments[1])
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(24),
o = i(28),
s = i(10),
a = [].lastIndexOf,
c = !!a && 1 / [1].lastIndexOf(1, -0) < 0;
r(r.P + r.F * (c || !i(26)(a)), "Array", {
lastIndexOf: function (e) {
if (c) return a.apply(this, arguments) || 0;
var t = n(this),
i = s(t.length),
r = i - 1;
for (arguments.length > 1 && (r = Math.min(r, o(arguments[1]))), r < 0 && (r = i + r); r >= 0; r--)
if (r in t && t[r] === e) return r || 0;
return -1
}
})
}, function (e, t, i) {
var r = i(0);
r(r.P, "Array", {
copyWithin: i(154)
}), i(58)("copyWithin")
}, function (e, t, i) {
var r = i(0);
r(r.P, "Array", {
fill: i(116)
}), i(58)("fill")
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(5),
o = !0;
"find" in [] && Array(1).find(function () {
o = !1
}), r(r.P + r.F * o, "Array", {
find: function (e) {
return n(this, e, arguments.length > 1 ? arguments[1] : void 0)
}
}), i(58)("find")
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(31)(6),
o = "findIndex",
s = !0;
o in [] && Array(1)[o](function () {
s = !1
}), r(r.P + r.F * s, "Array", {
findIndex: function (e) {
return n(this, e, arguments.length > 1 ? arguments[1] : void 0)
}
}), i(58)(o)
}, function (e, t, i) {
i(59)("Array")
}, function (e, t, i) {
var r = i(5),
n = i(104),
o = i(12).f,
s = i(50).f,
a = i(111),
c = i(78),
h = r.RegExp,
u = h,
l = h.prototype,
f = /a/g,
d = /a/g,
p = new h(f) !== f;
if (i(13) && (!p || i(3)(function () {
return d[i(8)("match")] = !1, h(f) != f || h(d) == d || "/a/i" != h(f, "i")
}))) {
h = function (e, t) {
var i = this instanceof h,
r = a(e),
o = void 0 === t;
return !i && r && e.constructor === h && o ? e : n(p ? new u(r && !o ? e.source : e, t) : u((r = e instanceof h) ? e.source : e, r && o ? c.call(e) : t), i ? this : l, h)
};
for (var m = function (e) {
e in h || o(h, e, {
configurable: !0,
get: function () {
return u[e]
},
set: function (t) {
u[e] = t
}
})
}, g = s(u), _ = 0; g.length > _;) m(g[_++]);
l.constructor = h, h.prototype = l, i(19)(r, "RegExp", h)
}
i(59)("RegExp")
}, function (e, t, i) {
"use strict";
i(157);
var r = i(4),
n = i(78),
o = i(13),
s = /./.toString,
a = function (e) {
i(19)(RegExp.prototype, "toString", e, !0)
};
i(3)(function () {
return "/a/b" != s.call({
source: "a",
flags: "b"
})
}) ? a(function () {
var e = r(this);
return "/".concat(e.source, "/", "flags" in e ? e.flags : !o && e instanceof RegExp ? n.call(e) : void 0)
}) : "toString" != s.name && a(function () {
return s.call(this)
})
}, function (e, t, i) {
"use strict";
var r = i(4),
n = i(10),
o = i(119),
s = i(79);
i(80)("match", 1, function (e, t, i, a) {
return [function (i) {
var r = e(this),
n = null == i ? void 0 : i[t];
return void 0 !== n ? n.call(i, r) : new RegExp(i)[t](String(r))
}, function (e) {
var t = a(i, e, this);
if (t.done) return t.value;
var c = r(e),
h = String(this);
if (!c.global) return s(c, h);
var u = c.unicode;
c.lastIndex = 0;
for (var l, f = [], d = 0; null !== (l = s(c, h));) {
var p = String(l[0]);
f[d] = p, "" === p && (c.lastIndex = o(h, n(c.lastIndex), u)), d++
}
return 0 === d ? null : f
}]
})
}, function (e, t, i) {
"use strict";
var r = i(4),
n = i(20),
o = i(10),
s = i(28),
a = i(119),
c = i(79),
h = Math.max,
u = Math.min,
l = Math.floor,
f = /\$([$&`']|\d\d?|<[^>]*>)/g,
d = /\$([$&`']|\d\d?)/g;
i(80)("replace", 2, function (e, t, i, p) {
return [function (r, n) {
var o = e(this),
s = null == r ? void 0 : r[t];
return void 0 !== s ? s.call(r, o, n) : i.call(String(o), r, n)
}, function (e, t) {
var n = p(i, e, this, t);
if (n.done) return n.value;
var l = r(e),
f = String(this),
d = "function" == typeof t;
d || (t = String(t));
var g = l.global;
if (g) {
var _ = l.unicode;
l.lastIndex = 0
}
for (var v = [];;) {
var y = c(l, f);
if (null === y) break;
if (v.push(y), !g) break;
"" === String(y[0]) && (l.lastIndex = a(f, o(l.lastIndex), _))
}
for (var b, x = "", w = 0, S = 0; S < v.length; S++) {
y = v[S];
for (var T = String(y[0]), A = h(u(s(y.index), f.length), 0), M = [], E = 1; E < y.length; E++) M.push(void 0 === (b = y[E]) ? b : String(b));
var P = y.groups;
if (d) {
var C = [T].concat(M, A, f);
void 0 !== P && C.push(P);
var R = String(t.apply(void 0, C))
} else R = m(T, f, A, M, P, t);
A >= w && (x += f.slice(w, A) + R, w = A + T.length)
}
return x + f.slice(w)
}];
function m(e, t, r, o, s, a) {
var c = r + e.length,
h = o.length,
u = d;
return void 0 !== s && (s = n(s), u = f), i.call(a, u, function (i, n) {
var a;
switch (n.charAt(0)) {
case "$":
return "$";
case "&":
return e;
case "`":
return t.slice(0, r);
case "'":
return t.slice(c);
case "<":
a = s[n.slice(1, -1)];
break;
default:
var u = +n;
if (0 === u) return n;
if (u > h) {
var f = l(u / 10);
return 0 === f ? n : f <= h ? void 0 === o[f - 1] ? n.charAt(1) : o[f - 1] + n.charAt(1) : n
}
a = o[u - 1]
}
return void 0 === a ? "" : a
})
}
})
}, function (e, t, i) {
"use strict";
var r = i(4),
n = i(143),
o = i(79);
i(80)("search", 1, function (e, t, i, s) {
return [function (i) {
var r = e(this),
n = null == i ? void 0 : i[t];
return void 0 !== n ? n.call(i, r) : new RegExp(i)[t](String(r))
}, function (e) {
var t = s(i, e, this);
if (t.done) return t.value;
var a = r(e),
c = String(this),
h = a.lastIndex;
n(h, 0) || (a.lastIndex = 0);
var u = o(a, c);
return n(a.lastIndex, h) || (a.lastIndex = h), null === u ? -1 : u.index
}]
})
}, function (e, t, i) {
"use strict";
var r = i(111),
n = i(4),
o = i(67),
s = i(119),
a = i(10),
c = i(79),
h = i(118),
u = Math.min,
l = [].push,
f = !! function () {
try {
return new RegExp("x", "y")
} catch (e) {}
}();
i(80)("split", 2, function (e, t, i, d) {
var p = i;
return "c" == "abbc".split(/(b)*/)[1] || 4 != "test".split(/(?:)/, -1).length || 2 != "ab".split(/(?:ab)*/).length || 4 != ".".split(/(.?)(.?)/).length || ".".split(/()()/).length > 1 || "".split(/.?/).length ? p = function (e, t) {
var n = String(this);
if (void 0 === e && 0 === t) return [];
if (!r(e)) return i.call(n, e, t);
for (var o, s, a, c = [], u = (e.ignoreCase ? "i" : "") + (e.multiline ? "m" : "") + (e.unicode ? "u" : "") + (e.sticky ? "y" : ""), f = 0, d = void 0 === t ? 4294967295 : t >>> 0, p = new RegExp(e.source, u + "g");
(o = h.call(p, n)) && !((s = p.lastIndex) > f && (c.push(n.slice(f, o.index)), o.length > 1 && o.index < n.length && l.apply(c, o.slice(1)), a = o[0].length, f = s, c.length >= d));) p.lastIndex === o.index && p.lastIndex++;
return f === n.length ? !a && p.test("") || c.push("") : c.push(n.slice(f)), c.length > d ? c.slice(0, d) : c
} : "0".split(void 0, 0).length && (p = function (e, t) {
return void 0 === e && 0 === t ? [] : i.call(this, e, t)
}), [function (i, r) {
var n = e(this),
o = null == i ? void 0 : i[t];
return void 0 !== o ? o.call(i, n, r) : p.call(String(n), i, r)
}, function (e, t) {
var r = d(p, e, this, t, p !== i);
if (r.done) return r.value;
var h = n(e),
l = String(this),
m = o(h, RegExp),
g = h.unicode,
_ = (h.ignoreCase ? "i" : "") + (h.multiline ? "m" : "") + (h.unicode ? "u" : "") + (f ? "y" : "g"),
v = new m(f ? h : "^(?:" + h.source + ")", _),
y = void 0 === t ? 4294967295 : t >>> 0;
if (0 === y) return [];
if (0 === l.length) return null === c(v, l) ? [l] : [];
for (var b = 0, x = 0, w = []; x < l.length;) {
v.lastIndex = f ? x : 0;
var S, T = c(v, f ? l : l.slice(x));
if (null === T || (S = u(a(v.lastIndex + (f ? 0 : x)), l.length)) === b) x = s(l, x, g);
else {
if (w.push(l.slice(b, x)), w.length === y) return w;
for (var A = 1; A <= T.length - 1; A++)
if (w.push(T[A]), w.length === y) return w;
x = b = S
}
}
return w.push(l.slice(b)), w
}]
})
}, function (e, t, i) {
var r = i(5),
n = i(120).set,
o = r.MutationObserver || r.WebKitMutationObserver,
s = r.process,
a = r.Promise,
c = "process" == i(36)(s);
e.exports = function () {
var e, t, i, h = function () {
var r, n;
for (c && (r = s.domain) && r.exit(); e;) {
n = e.fn, e = e.next;
try {
n()
} catch (r) {
throw e ? i() : t = void 0, r
}
}
t = void 0, r && r.enter()
};
if (c) i = function () {
s.nextTick(h)
};
else if (!o || r.navigator && r.navigator.standalone)
if (a && a.resolve) {
var u = a.resolve(void 0);
i = function () {
u.then(h)
}
} else i = function () {
n.call(r, h)
};
else {
var l = !0,
f = document.createTextNode("");
new o(h).observe(f, {
characterData: !0
}), i = function () {
f.data = l = !l
}
}
return function (r) {
var n = {
fn: r,
next: void 0
};
t && (t.next = n), e || (e = n, i()), t = n
}
}
}, function (e, t) {
e.exports = function (e) {
try {
return {
e: !1,
v: e()
}
} catch (e) {
return {
e: !0,
v: e
}
}
}
}, function (e, t, i) {
"use strict";
var r = i(161),
n = i(62);
e.exports = i(83)("Map", function (e) {
return function () {
return e(this, arguments.length > 0 ? arguments[0] : void 0)
}
}, {
get: function (e) {
var t = r.getEntry(n(this, "Map"), e);
return t && t.v
},
set: function (e, t) {
return r.def(n(this, "Map"), 0 === e ? 0 : e, t)
}
}, r, !0)
}, function (e, t, i) {
"use strict";
var r = i(161),
n = i(62);
e.exports = i(83)("Set", function (e) {
return function () {
return e(this, arguments.length > 0 ? arguments[0] : void 0)
}
}, {
add: function (e) {
return r.def(n(this, "Set"), e = 0 === e ? 0 : e, e)
}
}, r)
}, function (e, t, i) {
"use strict";
var r, n = i(31)(0),
o = i(19),
s = i(40),
a = i(142),
c = i(162),
h = i(6),
u = i(3),
l = i(62),
f = s.getWeak,
d = Object.isExtensible,
p = c.ufstore,
m = {},
g = function (e) {
return function () {
return e(this, arguments.length > 0 ? arguments[0] : void 0)
}
},
_ = {
get: function (e) {
if (h(e)) {
var t = f(e);
return !0 === t ? p(l(this, "WeakMap")).get(e) : t ? t[this._i] : void 0
}
},
set: function (e, t) {
return c.def(l(this, "WeakMap"), e, t)
}
},
v = e.exports = i(83)("WeakMap", g, _, c, !0, !0);
u(function () {
return 7 != (new v).set((Object.freeze || Object)(m), 7).get(m)
}) && (a((r = c.getConstructor(g, "WeakMap")).prototype, _), s.NEED = !0, n(["delete", "has", "get", "set"], function (e) {
var t = v.prototype,
i = t[e];
o(t, e, function (t, n) {
if (h(t) && !d(t)) {
this._f || (this._f = new r);
var o = this._f[e](t, n);
return "set" == e ? this : o
}
return i.call(this, t, n)
})
}))
}, function (e, t, i) {
"use strict";
var r = i(162),
n = i(62);
i(83)("WeakSet", function (e) {
return function () {
return e(this, arguments.length > 0 ? arguments[0] : void 0)
}
}, {
add: function (e) {
return r.def(n(this, "WeakSet"), e, !0)
}
}, r, !1, !0)
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(84),
o = i(121),
s = i(4),
a = i(48),
c = i(10),
h = i(6),
u = i(5).ArrayBuffer,
l = i(67),
f = o.ArrayBuffer,
d = o.DataView,
p = n.ABV && u.isView,
m = f.prototype.slice,
g = n.VIEW;
r(r.G + r.W + r.F * (u !== f), {
ArrayBuffer: f
}), r(r.S + r.F * !n.CONSTR, "ArrayBuffer", {
isView: function (e) {
return p && p(e) || h(e) && g in e
}
}), r(r.P + r.U + r.F * i(3)(function () {
return !new f(2).slice(1, void 0).byteLength
}), "ArrayBuffer", {
slice: function (e, t) {
if (void 0 !== m && void 0 === t) return m.call(s(this), e);
for (var i = s(this).byteLength, r = a(e, i), n = a(void 0 === t ? i : t, i), o = new(l(this, f))(c(n - r)), h = new d(this), u = new d(o), p = 0; r < n;) u.setUint8(p++, h.getUint8(r++));
return o
}
}), i(59)("ArrayBuffer")
}, function (e, t, i) {
var r = i(0);
r(r.G + r.W + r.F * !i(84).ABV, {
DataView: i(121).DataView
})
}, function (e, t, i) {
i(38)("Int8", 1, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Uint8", 1, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Uint8", 1, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
}, !0)
}, function (e, t, i) {
i(38)("Int16", 2, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Uint16", 2, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Int32", 4, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Uint32", 4, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Float32", 4, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
i(38)("Float64", 8, function (e) {
return function (t, i, r) {
return e(this, t, i, r)
}
})
}, function (e, t, i) {
var r = i(0),
n = i(35),
o = i(4),
s = (i(5).Reflect || {}).apply,
a = Function.apply;
r(r.S + r.F * !i(3)(function () {
s(function () {})
}), "Reflect", {
apply: function (e, t, i) {
var r = n(e),
c = o(i);
return s ? s(r, t, c) : a.call(r, t, c)
}
})
}, function (e, t, i) {
var r = i(0),
n = i(49),
o = i(35),
s = i(4),
a = i(6),
c = i(3),
h = i(144),
u = (i(5).Reflect || {}).construct,
l = c(function () {
function e() {}
return !(u(function () {}, [], e) instanceof e)
}),
f = !c(function () {
u(function () {})
});
r(r.S + r.F * (l || f), "Reflect", {
construct: function (e, t) {
o(e), s(t);
var i = arguments.length < 3 ? e : o(arguments[2]);
if (f && !l) return u(e, t, i);
if (e == i) {
switch (t.length) {
case 0:
return new e;
case 1:
return new e(t[0]);
case 2:
return new e(t[0], t[1]);
case 3:
return new e(t[0], t[1], t[2]);
case 4:
return new e(t[0], t[1], t[2], t[3])
}
var r = [null];
return r.push.apply(r, t), new(h.apply(e, r))
}
var c = i.prototype,
d = n(a(c) ? c : Object.prototype),
p = Function.apply.call(e, d, t);
return a(p) ? p : d
}
})
}, function (e, t, i) {
var r = i(12),
n = i(0),
o = i(4),
s = i(39);
n(n.S + n.F * i(3)(function () {
Reflect.defineProperty(r.f({}, 1, {
value: 1
}), 1, {
value: 2
})
}), "Reflect", {
defineProperty: function (e, t, i) {
o(e), t = s(t, !0), o(i);
try {
return r.f(e, t, i), !0
} catch (e) {
return !1
}
}
})
}, function (e, t, i) {
var r = i(0),
n = i(29).f,
o = i(4);
r(r.S, "Reflect", {
deleteProperty: function (e, t) {
var i = n(o(e), t);
return !(i && !i.configurable) && delete e[t]
}
})
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(4),
o = function (e) {
this._t = n(e), this._i = 0;
var t, i = this._k = [];
for (t in e) i.push(t)
};
i(151)(o, "Object", function () {
var e, t = this._k;
do {
if (this._i >= t.length) return {
value: void 0,
done: !0
}
} while (!((e = t[this._i++]) in this._t));
return {
value: e,
done: !1
}
}), r(r.S, "Reflect", {
enumerate: function (e) {
return new o(e)
}
})
}, function (e, t, i) {
var r = i(29),
n = i(51),
o = i(22),
s = i(0),
a = i(6),
c = i(4);
s(s.S, "Reflect", {
get: function e(t, i) {
var s, h, u = arguments.length < 3 ? t : arguments[2];
return c(t) === u ? t[i] : (s = r.f(t, i)) ? o(s, "value") ? s.value : void 0 !== s.get ? s.get.call(u) : void 0 : a(h = n(t)) ? e(h, i, u) : void 0
}
})
}, function (e, t, i) {
var r = i(29),
n = i(0),
o = i(4);
n(n.S, "Reflect", {
getOwnPropertyDescriptor: function (e, t) {
return r.f(o(e), t)
}
})
}, function (e, t, i) {
var r = i(0),
n = i(51),
o = i(4);
r(r.S, "Reflect", {
getPrototypeOf: function (e) {
return n(o(e))
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Reflect", {
has: function (e, t) {
return t in e
}
})
}, function (e, t, i) {
var r = i(0),
n = i(4),
o = Object.isExtensible;
r(r.S, "Reflect", {
isExtensible: function (e) {
return n(e), !o || o(e)
}
})
}, function (e, t, i) {
var r = i(0);
r(r.S, "Reflect", {
ownKeys: i(164)
})
}, function (e, t, i) {
var r = i(0),
n = i(4),
o = Object.preventExtensions;
r(r.S, "Reflect", {
preventExtensions: function (e) {
n(e);
try {
return o && o(e), !0
} catch (e) {
return !1
}
}
})
}, function (e, t, i) {
var r = i(12),
n = i(29),
o = i(51),
s = i(22),
a = i(0),
c = i(44),
h = i(4),
u = i(6);
a(a.S, "Reflect", {
set: function e(t, i, a) {
var l, f, d = arguments.length < 4 ? t : arguments[3],
p = n.f(h(t), i);
if (!p) {
if (u(f = o(t))) return e(f, i, a, d);
p = c(0)
}
if (s(p, "value")) {
if (!1 === p.writable || !u(d)) return !1;
if (l = n.f(d, i)) {
if (l.get || l.set || !1 === l.writable) return !1;
l.value = a, r.f(d, i, l)
} else r.f(d, i, c(0, a));
return !0
}
return void 0 !== p.set && (p.set.call(d, a), !0)
}
})
}, function (e, t, i) {
var r = i(0),
n = i(102);
n && r(r.S, "Reflect", {
setPrototypeOf: function (e, t) {
n.check(e, t);
try {
return n.set(e, t), !0
} catch (e) {
return !1
}
}
})
}, function (e, t, i) {
i(374), e.exports = i(14).Array.includes
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(74)(!0);
r(r.P, "Array", {
includes: function (e) {
return n(this, e, arguments.length > 1 ? arguments[1] : void 0)
}
}), i(58)("includes")
}, function (e, t, i) {
i(376), e.exports = i(14).String.padStart
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(165),
o = i(82);
r(r.P + r.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(o), "String", {
padStart: function (e) {
return n(this, e, arguments.length > 1 ? arguments[1] : void 0, !0)
}
})
}, function (e, t, i) {
i(378), e.exports = i(14).String.padEnd
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(165),
o = i(82);
r(r.P + r.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(o), "String", {
padEnd: function (e) {
return n(this, e, arguments.length > 1 ? arguments[1] : void 0, !1)
}
})
}, function (e, t, i) {
i(380), e.exports = i(97).f("asyncIterator")
}, function (e, t, i) {
i(138)("asyncIterator")
}, function (e, t, i) {
i(382), e.exports = i(14).Object.getOwnPropertyDescriptors
}, function (e, t, i) {
var r = i(0),
n = i(164),
o = i(24),
s = i(29),
a = i(114);
r(r.S, "Object", {
getOwnPropertyDescriptors: function (e) {
for (var t, i, r = o(e), c = s.f, h = n(r), u = {}, l = 0; h.length > l;) void 0 !== (i = c(r, t = h[l++])) && a(u, t, i);
return u
}
})
}, function (e, t, i) {
i(384), e.exports = i(14).Object.values
}, function (e, t, i) {
var r = i(0),
n = i(166)(!1);
r(r.S, "Object", {
values: function (e) {
return n(e)
}
})
}, function (e, t, i) {
i(386), e.exports = i(14).Object.entries
}, function (e, t, i) {
var r = i(0),
n = i(166)(!0);
r(r.S, "Object", {
entries: function (e) {
return n(e)
}
})
}, function (e, t, i) {
"use strict";
i(158), i(388), e.exports = i(14).Promise.finally
}, function (e, t, i) {
"use strict";
var r = i(0),
n = i(14),
o = i(5),
s = i(67),
a = i(160);
r(r.P + r.R, "Promise", {
finally: function (e) {
var t = s(this, n.Promise || o.Promise),
i = "function" == typeof e;
return this.then(i ? function (i) {
return a(t, e()).then(function () {
return i
})
} : e, i ? function (i) {
return a(t, e()).then(function () {
throw i
})
} : e)
}
})
}, function (e, t, i) {
i(390), i(391), i(392), e.exports = i(14)
}, function (e, t, i) {
var r = i(5),
n = i(0),
o = i(82),
s = [].slice,
a = /MSIE .\./.test(o),
c = function (e) {
return function (t, i) {
var r = arguments.length > 2,
n = !!r && s.call(arguments, 2);
return e(r ? function () {
("function" == typeof t ? t : Function(t)).apply(this, n)
} : t, i)
}
};
n(n.G + n.B + n.F * a, {
setTimeout: c(r.setTimeout),
setInterval: c(r.setInterval)
})
}, function (e, t, i) {
var r = i(0),
n = i(120);
r(r.G + r.B, {
setImmediate: n.set,
clearImmediate: n.clear
})
}, function (e, t, i) {
for (var r = i(117), n = i(47), o = i(19), s = i(5), a = i(23), c = i(57), h = i(8), u = h("iterator"), l = h("toStringTag"), f = c.Array, d = {
CSSRuleList: !0,
CSSStyleDeclaration: !1,
CSSValueList: !1,
ClientRectList: !1,
DOMRectList: !1,
DOMStringList: !1,
DOMTokenList: !0,
DataTransferItemList: !1,
FileList: !1,
HTMLAllCollection: !1,
HTMLCollection: !1,
HTMLFormElement: !1,
HTMLSelectElement: !1,
MediaList: !0,
MimeTypeArray: !1,
NamedNodeMap: !1,
NodeList: !0,
PaintRequestList: !1,
Plugin: !1,
PluginArray: !1,
SVGLengthList: !1,
SVGNumberList: !1,
SVGPathSegList: !1,
SVGPointList: !1,
SVGStringList: !1,
SVGTransformList: !1,
SourceBufferList: !1,
StyleSheetList: !0,
TextTrackCueList: !1,
TextTrackList: !1,
TouchList: !1
}, p = n(d), m = 0; m < p.length; m++) {
var g, _ = p[m],
v = d[_],
y = s[_],
b = y && y.prototype;
if (b && (b[u] || a(b, u, f), b[l] || a(b, l, _), c[_] = f, v))
for (g in r) b[g] || o(b, g, r[g], !0)
}
}, function (e, 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)
}! function (r) {
"use strict";
var n, o = Object.prototype,
s = o.hasOwnProperty,
a = "function" == typeof Symbol ? Symbol : {},
c = a.iterator || "@@iterator",
h = a.asyncIterator || "@@asyncIterator",
u = a.toStringTag || "@@toStringTag",
l = "object" === i(e),
f = r.regeneratorRuntime;
if (f) l && (e.exports = f);
else {
(f = r.regeneratorRuntime = l ? e.exports : {}).wrap = w;
var d = "suspendedStart",
p = "suspendedYield",
m = "executing",
g = "completed",
_ = {},
v = {};
v[c] = function () {
return this
};
var y = Object.getPrototypeOf,
b = y && y(y(O([])));
b && b !== o && s.call(b, c) && (v = b);
var x = M.prototype = T.prototype = Object.create(v);
A.prototype = x.constructor = M, M.constructor = A, M[u] = A.displayName = "GeneratorFunction", f.isGeneratorFunction = function (e) {
var t = "function" == typeof e && e.constructor;
return !!t && (t === A || "GeneratorFunction" === (t.displayName || t.name))
}, f.mark = function (e) {
return Object.setPrototypeOf ? Object.setPrototypeOf(e, M) : (e.__proto__ = M, u in e || (e[u] = "GeneratorFunction")), e.prototype = Object.create(x), e
}, f.awrap = function (e) {
return {
__await: e
}
}, E(P.prototype), P.prototype[h] = function () {
return this
}, f.AsyncIterator = P, f.async = function (e, t, i, r) {
var n = new P(w(e, t, i, r));
return f.isGeneratorFunction(t) ? n : n.next().then(function (e) {
return e.done ? e.value : n.next()
})
}, E(x), x[u] = "Generator", x[c] = function () {
return this
}, x.toString = function () {
return "[object Generator]"
}, f.keys = function (e) {
var t = [];
for (var i in e) t.push(i);
return t.reverse(),
function i() {
for (; t.length;) {
var r = t.pop();
if (r in e) return i.value = r, i.done = !1, i
}
return i.done = !0, i
}
}, f.values = O, D.prototype = {
constructor: D,
reset: function (e) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = n, this.done = !1, this.delegate = null, this.method = "next", this.arg = n, this.tryEntries.forEach(I), !e)
for (var t in this) "t" === t.charAt(0) && s.call(this, t) && !isNaN(+t.slice(1)) && (this[t] = n)
},
stop: function () {
this.done = !0;
var e = this.tryEntries[0].completion;
if ("throw" === e.type) throw e.arg;
return this.rval
},
dispatchException: function (e) {
if (this.done) throw e;
var t = this;
function i(i, r) {
return a.type = "throw", a.arg = e, t.next = i, r && (t.method = "next", t.arg = n), !!r
}
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var o = this.tryEntries[r],
a = o.completion;
if ("root" === o.tryLoc) return i("end");
if (o.tryLoc <= this.prev) {
var c = s.call(o, "catchLoc"),
h = s.call(o, "finallyLoc");
if (c && h) {
if (this.prev < o.catchLoc) return i(o.catchLoc, !0);
if (this.prev < o.finallyLoc) return i(o.finallyLoc)
} else if (c) {
if (this.prev < o.catchLoc) return i(o.catchLoc, !0)
} else {
if (!h) throw new Error("try statement without catch or finally");
if (this.prev < o.finallyLoc) return i(o.finallyLoc)
}
}
}
},
abrupt: function (e, t) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var r = this.tryEntries[i];
if (r.tryLoc <= this.prev && s.call(r, "finallyLoc") && this.prev < r.finallyLoc) {
var n = r;
break
}
}
n && ("break" === e || "continue" === e) && n.tryLoc <= t && t <= n.finallyLoc && (n = null);
var o = n ? n.completion : {};
return o.type = e, o.arg = t, n ? (this.method = "next", this.next = n.finallyLoc, _) : this.complete(o)
},
complete: function (e, t) {
if ("throw" === e.type) throw e.arg;
return "break" === e.type || "continue" === e.type ? this.next = e.arg : "return" === e.type ? (this.rval = this.arg = e.arg, this.method = "return", this.next = "end") : "normal" === e.type && t && (this.next = t), _
},
finish: function (e) {
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
var i = this.tryEntries[t];
if (i.finallyLoc === e) return this.complete(i.completion, i.afterLoc), I(i), _
}
},
catch: function (e) {
for (var t = this.tryEntries.length - 1; t >= 0; --t) {
var i = this.tryEntries[t];
if (i.tryLoc === e) {
var r = i.completion;
if ("throw" === r.type) {
var n = r.arg;
I(i)
}
return n
}
}
throw new Error("illegal catch attempt")
},
delegateYield: function (e, t, i) {
return this.delegate = {
iterator: O(e),
resultName: t,
nextLoc: i
}, "next" === this.method && (this.arg = n), _
}
}
}
function w(e, t, i, r) {
var n = t && t.prototype instanceof T ? t : T,
o = Object.create(n.prototype),
s = new D(r || []);
return o._invoke = function (e, t, i) {
var r = d;
return function (n, o) {
if (r === m) throw new Error("Generator is already running");
if (r === g) {
if ("throw" === n) throw o;
return L()
}
for (i.method = n, i.arg = o;;) {
var s = i.delegate;
if (s) {
var a = C(s, i);
if (a) {
if (a === _) continue;
return a
}
}
if ("next" === i.method) i.sent = i._sent = i.arg;
else if ("throw" === i.method) {
if (r === d) throw r = g, i.arg;
i.dispatchException(i.arg)
} else "return" === i.method && i.abrupt("return", i.arg);
r = m;
var c = S(e, t, i);
if ("normal" === c.type) {
if (r = i.done ? g : p, c.arg === _) continue;
return {
value: c.arg,
done: i.done
}
}
"throw" === c.type && (r = g, i.method = "throw", i.arg = c.arg)
}
}
}(e, i, s), o
}
function S(e, t, i) {
try {
return {
type: "normal",
arg: e.call(t, i)
}
} catch (e) {
return {
type: "throw",
arg: e
}
}
}
function T() {}
function A() {}
function M() {}
function E(e) {
["next", "throw", "return"].forEach(function (t) {
e[t] = function (e) {
return this._invoke(t, e)
}
})
}
function P(e) {
var r;
this._invoke = function (n, o) {
function a() {
return new t(function (r, a) {
! function r(n, o, a, c) {
var h = S(e[n], e, o);
if ("throw" !== h.type) {
var u = h.arg,
l = u.value;
return l && "object" === i(l) && s.call(l, "__await") ? t.resolve(l.__await).then(function (e) {
r("next", e, a, c)
}, function (e) {
r("throw", e, a, c)
}) : t.resolve(l).then(function (e) {
u.value = e, a(u)
}, function (e) {
return r("throw", e, a, c)
})
}
c(h.arg)
}(n, o, r, a)
})
}
return r = r ? r.then(a, a) : a()
}
}
function C(e, t) {
var i = e.iterator[t.method];
if (i === n) {
if (t.delegate = null, "throw" === t.method) {
if (e.iterator.return && (t.method = "return", t.arg = n, C(e, t), "throw" === t.method)) return _;
t.method = "throw", t.arg = new TypeError("The iterator does not provide a 'throw' method")
}
return _
}
var r = S(i, e.iterator, t.arg);
if ("throw" === r.type) return t.method = "throw", t.arg = r.arg, t.delegate = null, _;
var o = r.arg;
return o ? o.done ? (t[e.resultName] = o.value, t.next = e.nextLoc, "return" !== t.method && (t.method = "next", t.arg = n), t.delegate = null, _) : o : (t.method = "throw", t.arg = new TypeError("iterator result is not an object"), t.delegate = null, _)
}
function R(e) {
var t = {
tryLoc: e[0]
};
1 in e && (t.catchLoc = e[1]), 2 in e && (t.finallyLoc = e[2], t.afterLoc = e[3]), this.tryEntries.push(t)
}
function I(e) {
var t = e.completion || {};
t.type = "normal", delete t.arg, e.completion = t
}
function D(e) {
this.tryEntries = [{
tryLoc: "root"
}], e.forEach(R, this), this.reset(!0)
}
function O(e) {
if (e) {
var t = e[c];
if (t) return t.call(e);
if ("function" == typeof e.next) return e;
if (!isNaN(e.length)) {
var i = -1,
r = function t() {
for (; ++i < e.length;)
if (s.call(e, i)) return t.value = e[i], t.done = !1, t;
return t.value = n, t.done = !0, t
};
return r.next = r
}
}
return {
next: L
}
}
function L() {
return {
value: n,
done: !0
}
}
}(function () {
return this || "object" === ("undefined" == typeof self ? "undefined" : i(self)) && self
}() || Function("return this")())
}).call(this, i(167)(e), i(52))
}, function (e, t, i) {
(function (r, n) {
var o, s, a;
function c(e) {
return (c = "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)
}
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version 3.3.1
*/
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version 3.3.1
*/
a = function () {
"use strict";
function e(e) {
return "function" == typeof e
}
var t = Array.isArray ? Array.isArray : function (e) {
return "[object Array]" === Object.prototype.toString.call(e)
},
o = 0,
s = void 0,
a = void 0,
h = function (e, t) {
g[o] = e, g[o + 1] = t, 2 === (o += 2) && (a ? a(_) : w())
},
u = "undefined" != typeof window ? window : void 0,
l = u || {},
f = l.MutationObserver || l.WebKitMutationObserver,
d = "undefined" == typeof self && void 0 !== r && "[object process]" === {}.toString.call(r),
p = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel;
function m() {
var e = setTimeout;
return function () {
return e(_, 1)
}
}
var g = new Array(1e3);
function _() {
for (var e = 0; e < o; e += 2) {
(0, g[e])(g[e + 1]), g[e] = void 0, g[e + 1] = void 0
}
o = 0
}
var v, y, b, x, w = void 0;
function S(e, t) {
var i = arguments,
r = this,
n = new this.constructor(M);
void 0 === n[A] && W(n);
var o, s = r._state;
return s ? (o = i[s - 1], h(function () {
return U(s, n, o, r._result)
})) : k(r, n, e, t), n
}
function T(e) {
if (e && "object" === c(e) && e.constructor === this) return e;
var t = new this(M);
return O(t, e), t
}
d ? w = function () {
return r.nextTick(_)
} : f ? (y = 0, b = new f(_), x = document.createTextNode(""), b.observe(x, {
characterData: !0
}), w = function () {
x.data = y = ++y % 2
}) : p ? ((v = new MessageChannel).port1.onmessage = _, w = function () {
return v.port2.postMessage(0)
}) : w = void 0 === u ? function () {
try {
var e = i(395);
return s = e.runOnLoop || e.runOnContext,
function () {
s(_)
}
} catch (e) {
return m()
}
}() : m();
var A = Math.random().toString(36).substring(16);
function M() {}
var E = void 0,
P = 1,
C = 2,
R = new N;
function I(e) {
try {
return e.then
} catch (e) {
return R.error = e, R
}
}
function D(t, i, r) {
i.constructor === t.constructor && r === S && i.constructor.resolve === T ? function (e, t) {
t._state === P ? F(e, t._result) : t._state === C ? B(e, t._result) : k(t, void 0, function (t) {
return O(e, t)
}, function (t) {
return B(e, t)
})
}(t, i) : r === R ? B(t, R.error) : void 0 === r ? F(t, i) : e(r) ? function (e, t, i) {
h(function (e) {
var r = !1,
n = function (e, t, i, r) {
try {
e.call(t, i, r)
} catch (e) {
return e
}
}(i, t, function (i) {
r || (r = !0, t !== i ? O(e, i) : F(e, i))
}, function (t) {
r || (r = !0, B(e, t))
}, e._label);
!r && n && (r = !0, B(e, n))
}, e)
}(t, i, r) : F(t, i)
}
function O(e, t) {
var i;
e === t ? B(e, new TypeError("You cannot resolve a promise with itself")) : "function" == typeof (i = t) || "object" === c(i) && null !== i ? D(e, t, I(t)) : F(e, t)
}
function L(e) {
e._onerror && e._onerror(e._result), V(e)
}
function F(e, t) {
e._state === E && (e._result = t, e._state = P, 0 !== e._subscribers.length && h(V, e))
}
function B(e, t) {
e._state === E && (e._state = C, e._result = t, h(L, e))
}
function k(e, t, i, r) {
var n = e._subscribers,
o = n.length;
e._onerror = null, n[o] = t, n[o + P] = i, n[o + C] = r, 0 === o && e._state && h(V, e)
}
function V(e) {
var t = e._subscribers,
i = e._state;
if (0 !== t.length) {
for (var r = void 0, n = void 0, o = e._result, s = 0; s < t.length; s += 3) r = t[s], n = t[s + i], r ? U(i, r, n, o) : n(o);
e._subscribers.length = 0
}
}
function N() {
this.error = null
}
var z = new N;
function U(t, i, r, n) {
var o = e(r),
s = void 0,
a = void 0,
c = void 0,
h = void 0;
if (o) {
if ((s = function (e, t) {
try {
return e(t)
} catch (e) {
return z.error = e, z
}
}(r, n)) === z ? (h = !0, a = s.error, s = null) : c = !0, i === s) return void B(i, new TypeError("A promises callback cannot return that same promise."))
} else s = n, c = !0;
i._state !== E || (o && c ? O(i, s) : h ? B(i, a) : t === P ? F(i, s) : t === C && B(i, s))
}
var G = 0;
function W(e) {
e[A] = G++, e._state = void 0, e._result = void 0, e._subscribers = []
}
function j(e, i) {
this._instanceConstructor = e, this.promise = new e(M), this.promise[A] || W(this.promise), t(i) ? (this._input = i, this.length = i.length, this._remaining = i.length, this._result = new Array(this.length), 0 === this.length ? F(this.promise, this._result) : (this.length = this.length || 0, this._enumerate(), 0 === this._remaining && F(this.promise, this._result))) : B(this.promise, new Error("Array Methods must be provided an Array"))
}
function H(e) {
this[A] = G++, this._result = this._state = void 0, this._subscribers = [], M !== e && ("function" != typeof e && function () {
throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")
}(), this instanceof H ? function (e, t) {
try {
t(function (t) {
O(e, t)
}, function (t) {
B(e, t)
})
} catch (t) {
B(e, t)
}
}(this, e) : function () {
throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")
}())
}
function X() {
var e = void 0;
if (void 0 !== n) e = n;
else if ("undefined" != typeof self) e = self;
else try {
e = Function("return this")()
} catch (e) {
throw new Error("polyfill failed because global object is unavailable in this environment")
}
var t = e.Promise;
if (t) {
var i = null;
try {
i = Object.prototype.toString.call(t.resolve())
} catch (e) {}
if ("[object Promise]" === i && !t.cast) return
}
e.Promise = H
}
return j.prototype._enumerate = function () {
for (var e = this.length, t = this._input, i = 0; this._state === E && i < e; i++) this._eachEntry(t[i], i)
}, j.prototype._eachEntry = function (e, t) {
var i = this._instanceConstructor,
r = i.resolve;
if (r === T) {
var n = I(e);
if (n === S && e._state !== E) this._settledAt(e._state, t, e._result);
else if ("function" != typeof n) this._remaining--, this._result[t] = e;
else if (i === H) {
var o = new i(M);
D(o, e, n), this._willSettleAt(o, t)
} else this._willSettleAt(new i(function (t) {
return t(e)
}), t)
} else this._willSettleAt(r(e), t)
}, j.prototype._settledAt = function (e, t, i) {
var r = this.promise;
r._state === E && (this._remaining--, e === C ? B(r, i) : this._result[t] = i), 0 === this._remaining && F(r, this._result)
}, j.prototype._willSettleAt = function (e, t) {
var i = this;
k(e, void 0, function (e) {
return i._settledAt(P, t, e)
}, function (e) {
return i._settledAt(C, t, e)
})
}, H.all = function (e) {
return new j(this, e).promise
}, H.race = function (e) {
var i = this;
return t(e) ? new i(function (t, r) {
for (var n = e.length, o = 0; o < n; o++) i.resolve(e[o]).then(t, r)
}) : new i(function (e, t) {
return t(new TypeError("You must pass an array to race."))
})
}, H.resolve = T, H.reject = function (e) {
var t = new this(M);
return B(t, e), t
}, H._setScheduler = function (e) {
a = e
}, H._setAsap = function (e) {
h = e
}, H._asap = h, H.prototype = {
constructor: H,
then: S,
catch: function (e) {
return this.then(null, e)
}
}, X(), H.polyfill = X, H.Promise = H, H
}, "object" === c(t) && void 0 !== e ? e.exports = a() : void 0 === (s = "function" == typeof (o = a) ? o.call(t, i, t, e) : o) || (e.exports = s)
}).call(this, i(27), i(15))
}, function (e, t) {}, function (e, t, i) {}, function (e, t, i) {
"use strict";
t.byteLength = function (e) {
var t = h(e),
i = t[0],
r = t[1];
return 3 * (i + r) / 4 - r
}, t.toByteArray = function (e) {
for (var t, i = h(e), r = i[0], s = i[1], a = new o(function (e, t, i) {
return 3 * (t + i) / 4 - i
}(0, r, s)), c = 0, u = s > 0 ? r - 4 : r, l = 0; l < u; l += 4) t = n[e.charCodeAt(l)] << 18 | n[e.charCodeAt(l + 1)] << 12 | n[e.charCodeAt(l + 2)] << 6 | n[e.charCodeAt(l + 3)], a[c++] = t >> 16 & 255, a[c++] = t >> 8 & 255, a[c++] = 255 & t;
2 === s && (t = n[e.charCodeAt(l)] << 2 | n[e.charCodeAt(l + 1)] >> 4, a[c++] = 255 & t);
1 === s && (t = n[e.charCodeAt(l)] << 10 | n[e.charCodeAt(l + 1)] << 4 | n[e.charCodeAt(l + 2)] >> 2, a[c++] = t >> 8 & 255, a[c++] = 255 & t);
return a
}, t.fromByteArray = function (e) {
for (var t, i = e.length, n = i % 3, o = [], s = 0, a = i - n; s < a; s += 16383) o.push(u(e, s, s + 16383 > a ? a : s + 16383));
1 === n ? (t = e[i - 1], o.push(r[t >> 2] + r[t << 4 & 63] + "==")) : 2 === n && (t = (e[i - 2] << 8) + e[i - 1], o.push(r[t >> 10] + r[t >> 4 & 63] + r[t << 2 & 63] + "="));
return o.join("")
};
for (var r = [], n = [], o = "undefined" != typeof Uint8Array ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, c = s.length; a < c; ++a) r[a] = s[a], n[s.charCodeAt(a)] = a;
function h(e) {
var t = e.length;
if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
var i = e.indexOf("=");
return -1 === i && (i = t), [i, i === t ? 0 : 4 - i % 4]
}
function u(e, t, i) {
for (var n, o, s = [], a = t; a < i; a += 3) n = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (255 & e[a + 2]), s.push(r[(o = n) >> 18 & 63] + r[o >> 12 & 63] + r[o >> 6 & 63] + r[63 & o]);
return s.join("")
}
n["-".charCodeAt(0)] = 62, n["_".charCodeAt(0)] = 63
}, function (e, t) {
t.read = function (e, t, i, r, n) {
var o, s, a = 8 * n - r - 1,
c = (1 << a) - 1,
h = c >> 1,
u = -7,
l = i ? n - 1 : 0,
f = i ? -1 : 1,
d = e[t + l];
for (l += f, o = d & (1 << -u) - 1, d >>= -u, u += a; u > 0; o = 256 * o + e[t + l], l += f, u -= 8);
for (s = o & (1 << -u) - 1, o >>= -u, u += r; u > 0; s = 256 * s + e[t + l], l += f, u -= 8);
if (0 === o) o = 1 - h;
else {
if (o === c) return s ? NaN : 1 / 0 * (d ? -1 : 1);
s += Math.pow(2, r), o -= h
}
return (d ? -1 : 1) * s * Math.pow(2, o - r)
}, t.write = function (e, t, i, r, n, o) {
var s, a, c, h = 8 * o - n - 1,
u = (1 << h) - 1,
l = u >> 1,
f = 23 === n ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
d = r ? 0 : o - 1,
p = r ? 1 : -1,
m = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (a = isNaN(t) ? 1 : 0, s = u) : (s = Math.floor(Math.log(t) / Math.LN2), t * (c = Math.pow(2, -s)) < 1 && (s--, c *= 2), (t += s + l >= 1 ? f / c : f * Math.pow(2, 1 - l)) * c >= 2 && (s++, c /= 2), s + l >= u ? (a = 0, s = u) : s + l >= 1 ? (a = (t * c - 1) * Math.pow(2, n), s += l) : (a = t * Math.pow(2, l - 1) * Math.pow(2, n), s = 0)); n >= 8; e[i + d] = 255 & a, d += p, a /= 256, n -= 8);
for (s = s << n | a, h += n; h > 0; e[i + d] = 255 & s, d += p, s /= 256, h -= 8);
e[i + d - p] |= 128 * m
}
}, function (e, t, i) {
(function (r) {
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)
}
t.log = function () {
var e;
return "object" === ("undefined" == typeof console ? "undefined" : n(console)) && console.log && (e = console).log.apply(e, arguments)
}, t.formatArgs = function (t) {
if (t[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + t[0] + (this.useColors ? "%c " : " ") + "+" + e.exports.humanize(this.diff), !this.useColors) return;
var i = "color: " + this.color;
t.splice(1, 0, i, "color: inherit");
var r = 0,
n = 0;
t[0].replace(/%[a-zA-Z%]/g, function (e) {
"%%" !== e && (r++, "%c" === e && (n = r))
}), t.splice(n, 0, i)
}, t.save = function (e) {
try {
e ? t.storage.setItem("debug", e) : t.storage.removeItem("debug")
} catch (e) {}
}, t.load = function () {
var e;
try {
e = t.storage.getItem("debug")
} catch (e) {}!e && void 0 !== r && "env" in r && (e = r.env.DEBUG);
return e
}, t.useColors = function () {
if ("undefined" != typeof window && window.process && ("renderer" === window.process.type || window.process.__nwjs)) return !0;
if ("undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1;
return "undefined" != typeof document && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || "undefined" != typeof window && window.console && (window.console.firebug || window.console.exception && window.console.table) || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || "undefined" != typeof navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)
}, t.storage = function () {
try {
return localStorage
} catch (e) {}
}(), t.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], e.exports = i(400)(t), e.exports.formatters.j = function (e) {
try {
return JSON.stringify(e)
} catch (e) {
return "[UnexpectedJSONParseError]: " + e.message
}
}
}).call(this, i(27))
}, function (e, t, i) {
function r(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")
}()
}
e.exports = function (e) {
function t(e) {
for (var t = 0, i = 0; i < e.length; i++) t = (t << 5) - t + e.charCodeAt(i), t |= 0;
return n.colors[Math.abs(t) % n.colors.length]
}
function n(e) {
var i;
function r() {
for (var e = arguments.length, t = new Array(e), o = 0; o < e; o++) t[o] = arguments[o];
if (r.enabled) {
var s = r,
a = Number(new Date),
c = a - (i || a);
s.diff = c, s.prev = i, s.curr = a, i = a, t[0] = n.coerce(t[0]), "string" != typeof t[0] && t.unshift("%O");
var h = 0;
t[0] = t[0].replace(/%([a-zA-Z%])/g, function (e, i) {
if ("%%" === e) return e;
h++;
var r = n.formatters[i];
if ("function" == typeof r) {
var o = t[h];
e = r.call(s, o), t.splice(h, 1), h--
}
return e
}), n.formatArgs.call(s, t), (s.log || n.log).apply(s, t)
}
}
return r.namespace = e, r.enabled = n.enabled(e), r.useColors = n.useColors(), r.color = t(e), r.destroy = o, r.extend = s, "function" == typeof n.init && n.init(r), n.instances.push(r), r
}
function o() {
var e = n.instances.indexOf(this);
return -1 !== e && (n.instances.splice(e, 1), !0)
}
function s(e, t) {
var i = n(this.namespace + (void 0 === t ? ":" : t) + e);
return i.log = this.log, i
}
function a(e) {
return e.toString().substring(2, e.toString().length - 2).replace(/\.\*\?$/, "*")
}
return n.debug = n, n.default = n, n.coerce = function (e) {
return e instanceof Error ? e.stack || e.message : e
}, n.disable = function () {
var e = r(n.names.map(a)).concat(r(n.skips.map(a).map(function (e) {
return "-" + e
}))).join(",");
return n.enable(""), e
}, n.enable = function (e) {
var t;
n.save(e), n.names = [], n.skips = [];
var i = ("string" == typeof e ? e : "").split(/[\s,]+/),
r = i.length;
for (t = 0; t < r; t++) i[t] && ("-" === (e = i[t].replace(/\*/g, ".*?"))[0] ? n.skips.push(new RegExp("^" + e.substr(1) + "$")) : n.names.push(new RegExp("^" + e + "$")));
for (t = 0; t < n.instances.length; t++) {
var o = n.instances[t];
o.enabled = n.enabled(o.namespace)
}
}, n.enabled = function (e) {
if ("*" === e[e.length - 1]) return !0;
var t, i;
for (t = 0, i = n.skips.length; t < i; t++)
if (n.skips[t].test(e)) return !1;
for (t = 0, i = n.names.length; t < i; t++)
if (n.names[t].test(e)) return !0;
return !1
}, n.humanize = i(401), Object.keys(e).forEach(function (t) {
n[t] = e[t]
}), n.instances = [], n.names = [], n.skips = [], n.formatters = {}, n.selectColor = t, n.enable(n.load()), n
}
}, 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 r = 1e3,
n = 60 * r,
o = 60 * n,
s = 24 * o,
a = 7 * s,
c = 365.25 * s;
function h(e, t, i, r) {
var n = t >= 1.5 * i;
return Math.round(e / i) + " " + r + (n ? "s" : "")
}
e.exports = function (e, t) {
t = t || {};
var u = i(e);
if ("string" === u && e.length > 0) return function (e) {
if ((e = String(e)).length > 100) return;
var t = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);
if (!t) return;
var i = parseFloat(t[1]);
switch ((t[2] || "ms").toLowerCase()) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return i * c;
case "weeks":
case "week":
case "w":
return i * a;
case "days":
case "day":
case "d":
return i * s;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return i * o;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return i * n;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return i * r;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return i;
default:
return
}
}(e);
if ("number" === u && !1 === isNaN(e)) return t.long ? function (e) {
var t = Math.abs(e);
if (t >= s) return h(e, t, s, "day");
if (t >= o) return h(e, t, o, "hour");
if (t >= n) return h(e, t, n, "minute");
if (t >= r) return h(e, t, r, "second");
return e + " ms"
}(e) : function (e) {
var t = Math.abs(e);
if (t >= s) return Math.round(e / s) + "d";
if (t >= o) return Math.round(e / o) + "h";
if (t >= n) return Math.round(e / n) + "m";
if (t >= r) return Math.round(e / r) + "s";
return e + "ms"
}(e);
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e))
}
}, function (e, t) {
e.exports = function () {
if ("undefined" == typeof window) return null;
var e = {
RTCPeerConnection: window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection,
RTCSessionDescription: window.RTCSessionDescription || window.mozRTCSessionDescription || window.webkitRTCSessionDescription,
RTCIceCandidate: window.RTCIceCandidate || window.mozRTCIceCandidate || window.webkitRTCIceCandidate
};
return e.RTCPeerConnection ? e : null
}
}, function (e, t) {}, function (e, t, i) {
"use strict";
var r = i(2).Buffer,
n = i(405);
e.exports = function () {
function e() {
! function (e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}(this, e), this.head = null, this.tail = null, this.length = 0
}
return e.prototype.push = function (e) {
var t = {
data: e,
next: null
};
this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length
}, e.prototype.unshift = function (e) {
var t = {
data: e,
next: this.head
};
0 === this.length && (this.tail = t), this.head = t, ++this.length
}, e.prototype.shift = function () {
if (0 !== this.length) {
var e = this.head.data;
return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --this.length, e
}
}, e.prototype.clear = function () {
this.head = this.tail = null, this.length = 0
}, e.prototype.join = function (e) {
if (0 === this.length) return "";
for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data;
return i
}, e.prototype.concat = function (e) {
if (0 === this.length) return r.alloc(0);
if (1 === this.length) return this.head.data;
for (var t, i, n, o = r.allocUnsafe(e >>> 0), s = this.head, a = 0; s;) t = s.data, i = o, n = a, t.copy(i, n), a += s.data.length, s = s.next;
return o
}, e
}(), n && n.inspect && n.inspect.custom && (e.exports.prototype[n.inspect.custom] = function () {
var e = n.inspect({
length: this.length
});
return this.constructor.name + " " + e
})
}, function (e, t) {}, function (e, t, i) {
(function (e) {
var r = void 0 !== e && e || "undefined" != typeof self && self || window,
n = Function.prototype.apply;
function o(e, t) {
this._id = e, this._clearFn = t
}
t.setTimeout = function () {
return new o(n.call(setTimeout, r, arguments), clearTimeout)
}, t.setInterval = function () {
return new o(n.call(setInterval, r, arguments), clearInterval)
}, t.clearTimeout = t.clearInterval = function (e) {
e && e.close()
}, o.prototype.unref = o.prototype.ref = function () {}, o.prototype.close = function () {
this._clearFn.call(r, this._id)
}, t.enroll = function (e, t) {
clearTimeout(e._idleTimeoutId), e._idleTimeout = t
}, t.unenroll = function (e) {
clearTimeout(e._idleTimeoutId), e._idleTimeout = -1
}, t._unrefActive = t.active = function (e) {
clearTimeout(e._idleTimeoutId);
var t = e._idleTimeout;
t >= 0 && (e._idleTimeoutId = setTimeout(function () {
e._onTimeout && e._onTimeout()
}, t))
}, i(407), t.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== e && e.setImmediate || this && this.setImmediate, t.clearImmediate = "undefined" != typeof self && self.clearImmediate || void 0 !== e && e.clearImmediate || this && this.clearImmediate
}).call(this, i(15))
}, function (e, t, i) {
(function (e, t) {
! function (e, i) {
"use strict";
if (!e.setImmediate) {
var r, n, o, s, a, c = 1,
h = {},
u = !1,
l = e.document,
f = Object.getPrototypeOf && Object.getPrototypeOf(e);
f = f && f.setTimeout ? f : e, "[object process]" === {}.toString.call(e.process) ? r = function (e) {
t.nextTick(function () {
p(e)
})
} : ! function () {
if (e.postMessage && !e.importScripts) {
var t = !0,
i = e.onmessage;
return e.onmessage = function () {
t = !1
}, e.postMessage("", "*"), e.onmessage = i, t
}
}() ? e.MessageChannel ? ((o = new MessageChannel).port1.onmessage = function (e) {
p(e.data)
}, r = function (e) {
o.port2.postMessage(e)
}) : l && "onreadystatechange" in l.createElement("script") ? (n = l.documentElement, r = function (e) {
var t = l.createElement("script");
t.onreadystatechange = function () {
p(e), t.onreadystatechange = null, n.removeChild(t), t = null
}, n.appendChild(t)
}) : r = function (e) {
setTimeout(p, 0, e)
} : (s = "setImmediate$" + Math.random() + "$", a = function (t) {
t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(s) && p(+t.data.slice(s.length))
}, e.addEventListener ? e.addEventListener("message", a, !1) : e.attachEvent("onmessage", a), r = function (t) {
e.postMessage(s + t, "*")
}), f.setImmediate = function (e) {
"function" != typeof e && (e = new Function("" + e));
for (var t = new Array(arguments.length - 1), i = 0; i < t.length; i++) t[i] = arguments[i + 1];
var n = {
callback: e,
args: t
};
return h[c] = n, r(c), c++
}, f.clearImmediate = d
}
function d(e) {
delete h[e]
}
function p(e) {
if (u) setTimeout(p, 0, e);
else {
var t = h[e];
if (t) {
u = !0;
try {
! function (e) {
var t = e.callback,
r = e.args;
switch (r.length) {
case 0:
t();
break;
case 1:
t(r[0]);
break;
case 2:
t(r[0], r[1]);
break;
case 3:
t(r[0], r[1], r[2]);
break;
default:
t.apply(i, r)
}
}(t)
} finally {
d(e), u = !1
}
}
}
}
}("undefined" == typeof self ? void 0 === e ? this : e : self)
}).call(this, i(15), i(27))
}, function (e, t, i) {
(function (t) {
function i(e) {
try {
if (!t.localStorage) return !1
} catch (e) {
return !1
}
var i = t.localStorage[e];
return null != i && "true" === String(i).toLowerCase()
}
e.exports = function (e, t) {
if (i("noDeprecation")) return e;
var r = !1;
return function () {
if (!r) {
if (i("throwDeprecation")) throw new Error(t);
i("traceDeprecation") ? console.trace(t) : console.warn(t), r = !0
}
return e.apply(this, arguments)
}
}
}).call(this, i(15))
}, function (e, t, i) {
"use strict";
e.exports = o;
var r = i(172),
n = i(68);
function o(e) {
if (!(this instanceof o)) return new o(e);
r.call(this, e)
}
n.inherits = i(1), n.inherits(o, r), o.prototype._transform = function (e, t, i) {
i(null, e)
}
}, 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 r, n, o, s, a = this && this.__decorate || function (e, t, r, n) {
var o, s = arguments.length,
a = s < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, r) : n;
if ("object" == ("undefined" == typeof Reflect ? "undefined" : i(Reflect)) && "function" == typeof Reflect.decorate) a = Reflect.decorate(e, t, r, n);
else
for (var c = e.length - 1; c >= 0; c--)(o = e[c]) && (a = (s < 3 ? o(a) : s > 3 ? o(t, r, a) : o(t, r)) || a);
return s > 3 && a && Object.defineProperty(t, r, a), a
},
c = this && this.__extends || function (e, t) {
function i() {
this.constructor = e
}
for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
i.prototype = t.prototype, e.prototype = new i
};
! function (e) {
e.ToGammaSpace = 1 / 2.2, e.ToLinearSpace = 2.2, e.Epsilon = .001;
var t = function () {
function e() {}
return e.WithinEpsilon = function (e, t, i) {
void 0 === i && (i = 1.401298e-45);
var r = e - t;
return -i <= r && r <= i
}, e.ToHex = function (e) {
var t = e.toString(16);
return e <= 15 ? ("0" + t).toUpperCase() : t.toUpperCase()
}, e.Sign = function (e) {
return 0 === (e = +e) || isNaN(e) ? e : e > 0 ? 1 : -1
}, e.Clamp = function (e, t, i) {
return void 0 === t && (t = 0), void 0 === i && (i = 1), Math.min(i, Math.max(t, e))
}, e
}();
e.MathTools = t;
var i = function () {
function i(e, t, i) {
void 0 === e && (e = 0), void 0 === t && (t = 0), void 0 === i && (i = 0), this.r = e, this.g = t, this.b = i
}
return i.prototype.toString = function () {
return "{R: " + this.r + " G:" + this.g + " B:" + this.b + "}"
}, i.prototype.getClassName = function () {
return "Color3"
}, i.prototype.getHashCode = function () {
var e = this.r || 0;
return 397 * (e = 397 * e ^ (this.g || 0)) ^ (this.b || 0)
}, i.prototype.toArray = function (e, t) {
return void 0 === t && (t = 0), e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, this
}, i.prototype.toColor4 = function (e) {
return void 0 === e && (e = 1), new r(this.r, this.g, this.b, e)
}, i.prototype.asArray = function () {
var e = [];
return this.toArray(e, 0), e
}, i.prototype.toLuminance = function () {
return .3 * this.r + .59 * this.g + .11 * this.b
}, i.prototype.multiply = function (e) {
return new i(this.r * e.r, this.g * e.g, this.b * e.b)
}, i.prototype.multiplyToRef = function (e, t) {
return t.r = this.r * e.r, t.g = this.g * e.g, t.b = this.b * e.b, this
}, i.prototype.equals = function (e) {
return e && this.r === e.r && this.g === e.g && this.b === e.b
}, i.prototype.equalsFloats = function (e, t, i) {
return this.r === e && this.g === t && this.b === i
}, i.prototype.scale = function (e) {
return new i(this.r * e, this.g * e, this.b * e)
}, i.prototype.scaleToRef = function (e, t) {
return t.r = this.r * e, t.g = this.g * e, t.b = this.b * e, this
}, i.prototype.add = function (e) {
return new i(this.r + e.r, this.g + e.g, this.b + e.b)
}, i.prototype.addToRef = function (e, t) {
return t.r = this.r + e.r, t.g = this.g + e.g, t.b = this.b + e.b, this
}, i.prototype.subtract = function (e) {
return new i(this.r - e.r, this.g - e.g, this.b - e.b)
}, i.prototype.subtractToRef = function (e, t) {
return t.r = this.r - e.r, t.g = this.g - e.g, t.b = this.b - e.b, this
}, i.prototype.clone = function () {
return new i(this.r, this.g, this.b)
}, i.prototype.copyFrom = function (e) {
return this.r = e.r, this.g = e.g, this.b = e.b, this
}, i.prototype.copyFromFloats = function (e, t, i) {
return this.r = e, this.g = t, this.b = i, this
}, i.prototype.toHexString = function () {
var e = 255 * this.r | 0,
i = 255 * this.g | 0,
r = 255 * this.b | 0;
return "#" + t.ToHex(e) + t.ToHex(i) + t.ToHex(r)
}, i.prototype.toLinearSpace = function () {
var e = new i;
return this.toLinearSpaceToRef(e), e
}, i.prototype.toLinearSpaceToRef = function (t) {
return t.r = Math.pow(this.r, e.ToLinearSpace), t.g = Math.pow(this.g, e.ToLinearSpace), t.b = Math.pow(this.b, e.ToLinearSpace), this
}, i.prototype.toGammaSpace = function () {
var e = new i;
return this.toGammaSpaceToRef(e), e
}, i.prototype.toGammaSpaceToRef = function (t) {
return t.r = Math.pow(this.r, e.ToGammaSpace), t.g = Math.pow(this.g, e.ToGammaSpace), t.b = Math.pow(this.b, e.ToGammaSpace), this
}, i.FromHexString = function (e) {
if ("#" !== e.substring(0, 1) || 7 !== e.length) return new i(0, 0, 0);
var t = parseInt(e.substring(1, 3), 16),
r = parseInt(e.substring(3, 5), 16),
n = parseInt(e.substring(5, 7), 16);
return i.FromInts(t, r, n)
}, i.FromArray = function (e, t) {
return void 0 === t && (t = 0), new i(e[t], e[t + 1], e[t + 2])
}, i.FromInts = function (e, t, r) {
return new i(e / 255, t / 255, r / 255)
}, i.Lerp = function (e, t, r) {
return new i(e.r + (t.r - e.r) * r, e.g + (t.g - e.g) * r, e.b + (t.b - e.b) * r)
}, i.Red = function () {
return new i(1, 0, 0)
}, i.Green = function () {
return new i(0, 1, 0)
}, i.Blue = function () {
return new i(0, 0, 1)
}, i.Black = function () {
return new i(0, 0, 0)
}, i.White = function () {
return new i(1, 1, 1)
}, i.Purple = function () {
return new i(.5, 0, .5)
}, i.Magenta = function () {
return new i(1, 0, 1)
}, i.Yellow = function () {
return new i(1, 1, 0)
}, i.Gray = function () {
return new i(.5, .5, .5)
}, i
}();
e.Color3 = i;
var r = function () {
function e(e, t, i, r) {
this.r = e, this.g = t, this.b = i, this.a = r
}
return e.prototype.addInPlace = function (e) {
return this.r += e.r, this.g += e.g, this.b += e.b, this.a += e.a, this
}, e.prototype.asArray = function () {
var e = [];
return this.toArray(e, 0), e
}, e.prototype.toArray = function (e, t) {
return void 0 === t && (t = 0), e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e[t + 3] = this.a, this
}, e.prototype.add = function (t) {
return new e(this.r + t.r, this.g + t.g, this.b + t.b, this.a + t.a)
}, e.prototype.subtract = function (t) {
return new e(this.r - t.r, this.g - t.g, this.b - t.b, this.a - t.a)
}, e.prototype.subtractToRef = function (e, t) {
return t.r = this.r - e.r, t.g = this.g - e.g, t.b = this.b - e.b, t.a = this.a - e.a, this
}, e.prototype.scale = function (t) {
return new e(this.r * t, this.g * t, this.b * t, this.a * t)
}, e.prototype.scaleToRef = function (e, t) {
return t.r = this.r * e, t.g = this.g * e, t.b = this.b * e, t.a = this.a * e, this
}, e.prototype.multiply = function (t) {
return new e(this.r * t.r, this.g * t.g, this.b * t.b, this.a * t.a)
}, e.prototype.multiplyToRef = function (e, t) {
return t.r = this.r * e.r, t.g = this.g * e.g, t.b = this.b * e.b, t.a = this.a * e.a, t
}, e.prototype.toString = function () {
return "{R: " + this.r + " G:" + this.g + " B:" + this.b + " A:" + this.a + "}"
}, e.prototype.getClassName = function () {
return "Color4"
}, e.prototype.getHashCode = function () {
var e = this.r || 0;
return 397 * (e = 397 * (e = 397 * e ^ (this.g || 0)) ^ (this.b || 0)) ^ (this.a || 0)
}, e.prototype.clone = function () {
return new e(this.r, this.g, this.b, this.a)
}, e.prototype.copyFrom = function (e) {
return this.r = e.r, this.g = e.g, this.b = e.b, this.a = e.a, this
}, e.prototype.toHexString = function () {
var e = 255 * this.r | 0,
i = 255 * this.g | 0,
r = 255 * this.b | 0,
n = 255 * this.a | 0;
return "#" + t.ToHex(e) + t.ToHex(i) + t.ToHex(r) + t.ToHex(n)
}, e.FromHexString = function (t) {
if ("#" !== t.substring(0, 1) || 9 !== t.length) return new e(0, 0, 0, 0);
var i = parseInt(t.substring(1, 3), 16),
r = parseInt(t.substring(3, 5), 16),
n = parseInt(t.substring(5, 7), 16),
o = parseInt(t.substring(7, 9), 16);
return e.FromInts(i, r, n, o)
}, e.Lerp = function (t, i, r) {
var n = new e(0, 0, 0, 0);
return e.LerpToRef(t, i, r, n), n
}, e.LerpToRef = function (e, t, i, r) {
r.r = e.r + (t.r - e.r) * i, r.g = e.g + (t.g - e.g) * i, r.b = e.b + (t.b - e.b) * i, r.a = e.a + (t.a - e.a) * i
}, e.FromArray = function (t, i) {
return void 0 === i && (i = 0), new e(t[i], t[i + 1], t[i + 2], t[i + 3])
}, e.FromInts = function (t, i, r, n) {
return new e(t / 255, i / 255, r / 255, n / 255)
}, e.CheckColors4 = function (e, t) {
if (e.length === 3 * t) {
for (var i = [], r = 0; r < e.length; r += 3) {
var n = r / 3 * 4;
i[n] = e[r], i[n + 1] = e[r + 1], i[n + 2] = e[r + 2], i[n + 3] = 1
}
return i
}
return e
}, e
}();
e.Color4 = r;
var n = function () {
function i(e, t) {
this.x = e, this.y = t
}
return i.prototype.toString = function () {
return "{X: " + this.x + " Y:" + this.y + "}"
}, i.prototype.getClassName = function () {
return "Vector2"
}, i.prototype.getHashCode = function () {
var e = this.x || 0;
return 397 * e ^ (this.y || 0)
}, i.prototype.toArray = function (e, t) {
return void 0 === t && (t = 0), e[t] = this.x, e[t + 1] = this.y, this
}, i.prototype.asArray = function () {
var e = [];
return this.toArray(e, 0), e
}, i.prototype.copyFrom = function (e) {
return this.x = e.x, this.y = e.y, this
}, i.prototype.copyFromFloats = function (e, t) {
return this.x = e, this.y = t, this
}, i.prototype.add = function (e) {
return new i(this.x + e.x, this.y + e.y)
}, i.prototype.addToRef = function (e, t) {
return t.x = this.x + e.x, t.y = this.y + e.y, this
}, i.prototype.addInPlace = function (e) {
return this.x += e.x, this.y += e.y, this
}, i.prototype.addVector3 = function (e) {
return new i(this.x + e.x, this.y + e.y)
}, i.prototype.subtract = function (e) {
return new i(this.x - e.x, this.y - e.y)
}, i.prototype.subtractToRef = function (e, t) {
return t.x = this.x - e.x, t.y = this.y - e.y, this
}, i.prototype.subtractInPlace = function (e) {
return this.x -= e.x, this.y -= e.y, this
}, i.prototype.multiplyInPlace = function (e) {
return this.x *= e.x, this.y *= e.y, this
}, i.prototype.multiply = function (e) {
return new i(this.x * e.x, this.y * e.y)
}, i.prototype.multiplyToRef = function (e, t) {
return t.x = this.x * e.x, t.y = this.y * e.y, this
}, i.prototype.multiplyByFloats = function (e, t) {
return new i(this.x * e, this.y * t)
}, i.prototype.divide = function (e) {
return new i(this.x / e.x, this.y / e.y)
}, i.prototype.divideToRef = function (e, t) {
return t.x = this.x / e.x, t.y = this.y / e.y, this
}, i.prototype.negate = function () {
return new i(-this.x, -this.y)
}, i.prototype.scaleInPlace = function (e) {
return this.x *= e, this.y *= e, this
}, i.prototype.scale = function (e) {
return new i(this.x * e, this.y * e)
}, i.prototype.equals = function (e) {
return e && this.x === e.x && this.y === e.y
}, i.prototype.equalsWithEpsilon = function (i, r) {
return void 0 === r && (r = e.Epsilon), i && t.WithinEpsilon(this.x, i.x, r) && t.WithinEpsilon(this.y, i.y, r)
}, i.prototype.length = function () {
return Math.sqrt(this.x * this.x + this.y * this.y)
}, i.prototype.lengthSquared = function () {
return this.x * this.x + this.y * this.y
}, i.prototype.normalize = function () {
var e = this.length();
if (0 === e) return this;
var t = 1 / e;
return this.x *= t, this.y *= t, this
}, i.prototype.clone = function () {
return new i(this.x, this.y)
}, i.Zero = function () {
return new i(0, 0)
}, i.FromArray = function (e, t) {
return void 0 === t && (t = 0), new i(e[t], e[t + 1])
}, i.FromArrayToRef = function (e, t, i) {
i.x = e[t], i.y = e[t + 1]
}, i.CatmullRom = function (e, t, r, n, o) {
var s = o * o,
a = o * s;
return new i(.5 * (2 * t.x + (-e.x + r.x) * o + (2 * e.x - 5 * t.x + 4 * r.x - n.x) * s + (-e.x + 3 * t.x - 3 * r.x + n.x) * a), .5 * (2 * t.y + (-e.y + r.y) * o + (2 * e.y - 5 * t.y + 4 * r.y - n.y) * s + (-e.y + 3 * t.y - 3 * r.y + n.y) * a))
}, i.Clamp = function (e, t, r) {
var n = e.x;
n = (n = n > r.x ? r.x : n) < t.x ? t.x : n;
var o = e.y;
return new i(n, o = (o = o > r.y ? r.y : o) < t.y ? t.y : o)
}, i.Hermite = function (e, t, r, n, o) {
var s = o * o,
a = o * s,
c = 2 * a - 3 * s + 1,
h = -2 * a + 3 * s,
u = a - 2 * s + o,
l = a - s;
return new i(e.x * c + r.x * h + t.x * u + n.x * l, e.y * c + r.y * h + t.y * u + n.y * l)
}, i.Lerp = function (e, t, r) {
return new i(e.x + (t.x - e.x) * r, e.y + (t.y - e.y) * r)
}, i.Dot = function (e, t) {
return e.x * t.x + e.y * t.y
}, i.Normalize = function (e) {
var t = e.clone();
return t.normalize(), t
}, i.Minimize = function (e, t) {
return new i(e.x < t.x ? e.x : t.x, e.y < t.y ? e.y : t.y)
}, i.Maximize = function (e, t) {
return new i(e.x > t.x ? e.x : t.x, e.y > t.y ? e.y : t.y)
}, i.Transform = function (e, t) {
var r = i.Zero();
return i.TransformToRef(e, t, r), r
}, i.TransformToRef = function (e, t, i) {
var r = e.x * t.m[0] + e.y * t.m[4] + t.m[12],
n = e.x * t.m[1] + e.y * t.m[5] + t.m[13];
i.x = r, i.y = n
}, i.PointInTriangle = function (e, t, i, r) {
var n = .5 * (-i.y * r.x + t.y * (-i.x + r.x) + t.x * (i.y - r.y) + i.x * r.y),
o = n < 0 ? -1 : 1,
s = (t.y * r.x - t.x * r.y + (r.y - t.y) * e.x + (t.x - r.x) * e.y) * o,
a = (t.x * i.y - t.y * i.x + (t.y - i.y) * e.x + (i.x - t.x) * e.y) * o;
return s > 0 && a > 0 && s + a < 2 * n * o
}, i.Distance = function (e, t) {
return Math.sqrt(i.DistanceSquared(e, t))
}, i.DistanceSquared = function (e, t) {
var i = e.x - t.x,
r = e.y - t.y;
return i * i + r * r
}, i.Center = function (e, t) {
var i = e.add(t);
return i.scaleInPlace(.5), i
}, i.DistanceOfPointFromSegment = function (e, t, r) {
var n = i.DistanceSquared(t, r);
if (0 === n) return i.Distance(e, t);
var o = r.subtract(t),
s = Math.max(0, Math.min(1, i.Dot(e.subtract(t), o) / n)),
a = t.add(o.multiplyByFloats(s, s));
return i.Distance(e, a)
}, i
}();
e.Vector2 = n;
var o = function () {
function i(e, t, i) {
this.x = e, this.y = t, this.z = i
}
return i.prototype.toString = function () {
return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + "}"
}, i.prototype.getClassName = function () {
return "Vector3"
}, i.prototype.getHashCode = function () {
var e = this.x || 0;
return 397 * (e = 397 * e ^ (this.y || 0)) ^ (this.z || 0)
}, i.prototype.asArray = function () {
var e = [];
return this.toArray(e, 0), e
}, i.prototype.toArray = function (e, t) {
return void 0 === t && (t = 0), e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, this
}, i.prototype.toQuaternion = function () {
var e = new c(0, 0, 0, 1),
t = Math.cos(.5 * (this.x + this.z)),
i = Math.sin(.5 * (this.x + this.z)),
r = Math.cos(.5 * (this.z - this.x)),
n = Math.sin(.5 * (this.z - this.x)),
o = Math.cos(.5 * this.y),
s = Math.sin(.5 * this.y);
return e.x = r * s, e.y = -n * s, e.z = i * o, e.w = t * o, e
}, i.prototype.addInPlace = function (e) {
return this.x += e.x, this.y += e.y, this.z += e.z, this
}, i.prototype.add = function (e) {
return new i(this.x + e.x, this.y + e.y, this.z + e.z)
}, i.prototype.addToRef = function (e, t) {
return t.x = this.x + e.x, t.y = this.y + e.y, t.z = this.z + e.z, this
}, i.prototype.subtractInPlace = function (e) {
return this.x -= e.x, this.y -= e.y, this.z -= e.z, this
}, i.prototype.subtract = function (e) {
return new i(this.x - e.x, this.y - e.y, this.z - e.z)
}, i.prototype.subtractToRef = function (e, t) {
return t.x = this.x - e.x, t.y = this.y - e.y, t.z = this.z - e.z, this
}, i.prototype.subtractFromFloats = function (e, t, r) {
return new i(this.x - e, this.y - t, this.z - r)
}, i.prototype.subtractFromFloatsToRef = function (e, t, i, r) {
return r.x = this.x - e, r.y = this.y - t, r.z = this.z - i, this
}, i.prototype.negate = function () {
return new i(-this.x, -this.y, -this.z)
}, i.prototype.scaleInPlace = function (e) {
return this.x *= e, this.y *= e, this.z *= e, this
}, i.prototype.scale = function (e) {
return new i(this.x * e, this.y * e, this.z * e)
}, i.prototype.scaleToRef = function (e, t) {
t.x = this.x * e, t.y = this.y * e, t.z = this.z * e
}, i.prototype.equals = function (e) {
return e && this.x === e.x && this.y === e.y && this.z === e.z
}, i.prototype.equalsWithEpsilon = function (i, r) {
return void 0 === r && (r = e.Epsilon), i && t.WithinEpsilon(this.x, i.x, r) && t.WithinEpsilon(this.y, i.y, r) && t.WithinEpsilon(this.z, i.z, r)
}, i.prototype.equalsToFloats = function (e, t, i) {
return this.x === e && this.y === t && this.z === i
}, i.prototype.multiplyInPlace = function (e) {
return this.x *= e.x, this.y *= e.y, this.z *= e.z, this
}, i.prototype.multiply = function (e) {
return new i(this.x * e.x, this.y * e.y, this.z * e.z)
}, i.prototype.multiplyToRef = function (e, t) {
return t.x = this.x * e.x, t.y = this.y * e.y, t.z = this.z * e.z, this
}, i.prototype.multiplyByFloats = function (e, t, r) {
return new i(this.x * e, this.y * t, this.z * r)
}, i.prototype.divide = function (e) {
return new i(this.x / e.x, this.y / e.y, this.z / e.z)
}, i.prototype.divideToRef = function (e, t) {
return t.x = this.x / e.x, t.y = this.y / e.y, t.z = this.z / e.z, this
}, i.prototype.MinimizeInPlace = function (e) {
return e.x < this.x && (this.x = e.x), e.y < this.y && (this.y = e.y), e.z < this.z && (this.z = e.z), this
}, i.prototype.MaximizeInPlace = function (e) {
return e.x > this.x && (this.x = e.x), e.y > this.y && (this.y = e.y), e.z > this.z && (this.z = e.z), this
}, i.prototype.length = function () {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
}, i.prototype.lengthSquared = function () {
return this.x * this.x + this.y * this.y + this.z * this.z
}, i.prototype.normalize = function () {
var e = this.length();
if (0 === e || 1 === e) return this;
var t = 1 / e;
return this.x *= t, this.y *= t, this.z *= t, this
}, i.prototype.clone = function () {
return new i(this.x, this.y, this.z)
}, i.prototype.copyFrom = function (e) {
return this.x = e.x, this.y = e.y, this.z = e.z, this
}, i.prototype.copyFromFloats = function (e, t, i) {
return this.x = e, this.y = t, this.z = i, this
}, i.GetClipFactor = function (e, t, r, n) {
var o = i.Dot(e, r) - n;
return o / (o - (i.Dot(t, r) - n))
}, i.FromArray = function (e, t) {
return t || (t = 0), new i(e[t], e[t + 1], e[t + 2])
}, i.FromFloatArray = function (e, t) {
return t || (t = 0), new i(e[t], e[t + 1], e[t + 2])
}, i.FromArrayToRef = function (e, t, i) {
i.x = e[t], i.y = e[t + 1], i.z = e[t + 2]
}, i.FromFloatArrayToRef = function (e, t, i) {
i.x = e[t], i.y = e[t + 1], i.z = e[t + 2]
}, i.FromFloatsToRef = function (e, t, i, r) {
r.x = e, r.y = t, r.z = i
}, i.Zero = function () {
return new i(0, 0, 0)
}, i.Up = function () {
return new i(0, 1, 0)
}, i.Forward = function () {
return new i(0, 0, 1)
}, i.Right = function () {
return new i(1, 0, 0)
}, i.Left = function () {
return new i(-1, 0, 0)
}, i.TransformCoordinates = function (e, t) {
var r = i.Zero();
return i.TransformCoordinatesToRef(e, t, r), r
}, i.TransformCoordinatesToRef = function (e, t, i) {
var r = e.x * t.m[0] + e.y * t.m[4] + e.z * t.m[8] + t.m[12],
n = e.x * t.m[1] + e.y * t.m[5] + e.z * t.m[9] + t.m[13],
o = e.x * t.m[2] + e.y * t.m[6] + e.z * t.m[10] + t.m[14],
s = e.x * t.m[3] + e.y * t.m[7] + e.z * t.m[11] + t.m[15];
i.x = r / s, i.y = n / s, i.z = o / s
}, i.TransformCoordinatesFromFloatsToRef = function (e, t, i, r, n) {
var o = e * r.m[0] + t * r.m[4] + i * r.m[8] + r.m[12],
s = e * r.m[1] + t * r.m[5] + i * r.m[9] + r.m[13],
a = e * r.m[2] + t * r.m[6] + i * r.m[10] + r.m[14],
c = e * r.m[3] + t * r.m[7] + i * r.m[11] + r.m[15];
n.x = o / c, n.y = s / c, n.z = a / c
}, i.TransformNormal = function (e, t) {
var r = i.Zero();
return i.TransformNormalToRef(e, t, r), r
}, i.TransformNormalToRef = function (e, t, i) {
var r = e.x * t.m[0] + e.y * t.m[4] + e.z * t.m[8],
n = e.x * t.m[1] + e.y * t.m[5] + e.z * t.m[9],
o = e.x * t.m[2] + e.y * t.m[6] + e.z * t.m[10];
i.x = r, i.y = n, i.z = o
}, i.TransformNormalFromFloatsToRef = function (e, t, i, r, n) {
n.x = e * r.m[0] + t * r.m[4] + i * r.m[8], n.y = e * r.m[1] + t * r.m[5] + i * r.m[9], n.z = e * r.m[2] + t * r.m[6] + i * r.m[10]
}, i.CatmullRom = function (e, t, r, n, o) {
var s = o * o,
a = o * s;
return new i(.5 * (2 * t.x + (-e.x + r.x) * o + (2 * e.x - 5 * t.x + 4 * r.x - n.x) * s + (-e.x + 3 * t.x - 3 * r.x + n.x) * a), .5 * (2 * t.y + (-e.y + r.y) * o + (2 * e.y - 5 * t.y + 4 * r.y - n.y) * s + (-e.y + 3 * t.y - 3 * r.y + n.y) * a), .5 * (2 * t.z + (-e.z + r.z) * o + (2 * e.z - 5 * t.z + 4 * r.z - n.z) * s + (-e.z + 3 * t.z - 3 * r.z + n.z) * a))
}, i.Clamp = function (e, t, r) {
var n = e.x;
n = (n = n > r.x ? r.x : n) < t.x ? t.x : n;
var o = e.y;
o = (o = o > r.y ? r.y : o) < t.y ? t.y : o;
var s = e.z;
return new i(n, o, s = (s = s > r.z ? r.z : s) < t.z ? t.z : s)
}, i.Hermite = function (e, t, r, n, o) {
var s = o * o,
a = o * s,
c = 2 * a - 3 * s + 1,
h = -2 * a + 3 * s,
u = a - 2 * s + o,
l = a - s;
return new i(e.x * c + r.x * h + t.x * u + n.x * l, e.y * c + r.y * h + t.y * u + n.y * l, e.z * c + r.z * h + t.z * u + n.z * l)
}, i.Lerp = function (e, t, r) {
return new i(e.x + (t.x - e.x) * r, e.y + (t.y - e.y) * r, e.z + (t.z - e.z) * r)
}, i.Dot = function (e, t) {
return e.x * t.x + e.y * t.y + e.z * t.z
}, i.Cross = function (e, t) {
var r = i.Zero();
return i.CrossToRef(e, t, r), r
}, i.CrossToRef = function (e, t, i) {
A.Vector3[0].x = e.y * t.z - e.z * t.y, A.Vector3[0].y = e.z * t.x - e.x * t.z, A.Vector3[0].z = e.x * t.y - e.y * t.x, i.copyFrom(A.Vector3[0])
}, i.Normalize = function (e) {
var t = i.Zero();
return i.NormalizeToRef(e, t), t
}, i.NormalizeToRef = function (e, t) {
t.copyFrom(e), t.normalize()
}, i.Project = function (e, t, r, n) {
var o = n.width,
s = n.height,
a = n.x,
c = n.y,
u = i._viewportMatrixCache ? i._viewportMatrixCache : i._viewportMatrixCache = new h;
h.FromValuesToRef(o / 2, 0, 0, 0, 0, -s / 2, 0, 0, 0, 0, 1, 0, a + o / 2, s / 2 + c, 0, 1, u);
var l = i._matrixCache ? i._matrixCache : i._matrixCache = new h;
return t.multiplyToRef(r, l), l.multiplyToRef(u, l), i.TransformCoordinates(e, l)
}, i.UnprojectFromTransform = function (e, r, n, o, s) {
var a = i._matrixCache ? i._matrixCache : i._matrixCache = new h;
o.multiplyToRef(s, a), a.invert(), e.x = e.x / r * 2 - 1, e.y = -(e.y / n * 2 - 1);
var c = i.TransformCoordinates(e, a),
u = e.x * a.m[3] + e.y * a.m[7] + e.z * a.m[11] + a.m[15];
return t.WithinEpsilon(u, 1) && (c = c.scale(1 / u)), c
}, i.Unproject = function (e, r, n, o, s, a) {
var c = i._matrixCache ? i._matrixCache : i._matrixCache = new h;
o.multiplyToRef(s, c), c.multiplyToRef(a, c), c.invert();
var u = new i(e.x / r * 2 - 1, -(e.y / n * 2 - 1), e.z),
l = i.TransformCoordinates(u, c),
f = u.x * c.m[3] + u.y * c.m[7] + u.z * c.m[11] + c.m[15];
return t.WithinEpsilon(f, 1) && (l = l.scale(1 / f)), l
}, i.Minimize = function (e, t) {
var i = e.clone();
return i.MinimizeInPlace(t), i
}, i.Maximize = function (e, t) {
var i = e.clone();
return i.MaximizeInPlace(t), i
}, i.Distance = function (e, t) {
return Math.sqrt(i.DistanceSquared(e, t))
}, i.DistanceSquared = function (e, t) {
var i = e.x - t.x,
r = e.y - t.y,
n = e.z - t.z;
return i * i + r * r + n * n
}, i.Center = function (e, t) {
var i = e.add(t);
return i.scaleInPlace(.5), i
}, i.RotationFromAxis = function (e, t, r) {
var n = i.Zero();
return i.RotationFromAxisToRef(e, t, r, n), n
}, i.RotationFromAxisToRef = function (r, n, o, s) {
var a = r.normalize(),
c = o.normalize(),
h = d.X,
u = d.Y,
l = 0,
f = 0,
p = 0,
m = 0,
g = 0,
_ = 0,
v = 0,
y = -1,
b = 0,
x = A.Vector3[0],
w = 0,
S = A.Vector3[1];
t.WithinEpsilon(c.z, 0, e.Epsilon) ? _ = 1 : t.WithinEpsilon(c.x, 0, e.Epsilon) ? m = 1 : (m = -(v = c.z / c.x) * Math.sqrt(1 / (1 + v * v)), _ = Math.sqrt(1 / (1 + v * v))), S.x = m, S.y = g, S.z = _, S.normalize(), i.CrossToRef(a, S, x), x.normalize(), i.Dot(c, x) < 0 && (y = 1), w = i.Dot(a, S), w = Math.min(1, Math.max(-1, w)), p = Math.acos(w) * y, i.Dot(S, h) < 0 && (p = Math.PI + p, S = S.scaleInPlace(-1), b++);
var T = A.Vector3[2],
M = A.Vector3[3];
m = 0, g = 0, _ = 0, y = -1, t.WithinEpsilon(c.z, 0, e.Epsilon) ? m = 1 : (m = -(v = S.z / S.x) * Math.sqrt(1 / (1 + v * v)), _ = Math.sqrt(1 / (1 + v * v))), T.x = m, T.y = g, T.z = _, T.normalize(), i.CrossToRef(T, S, M), M.normalize(), i.CrossToRef(c, T, x), x.normalize(), i.Dot(S, x) < 0 && (y = 1), w = i.Dot(c, T), w = Math.min(1, Math.max(-1, w)), f = Math.acos(w) * y, i.Dot(M, u) < 0 && (f = Math.PI + f, b++), y = -1, i.CrossToRef(h, S, x), x.normalize(), i.Dot(x, u) < 0 && (y = 1), w = i.Dot(S, h), w = Math.min(1, Math.max(-1, w)), l = -Math.acos(w) * y, w < 0 && b < 2 && (l = Math.PI + l), s.x = f, s.y = l, s.z = p
}, i
}();
e.Vector3 = o;
var s = function () {
function i(e, t, i, r) {
this.x = e, this.y = t, this.z = i, this.w = r
}
return i.prototype.toString = function () {
return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + " W:" + this.w + "}"
}, i.prototype.getClassName = function () {
return "Vector4"
}, i.prototype.getHashCode = function () {
var e = this.x || 0;
return 397 * (e = 397 * (e = 397 * e ^ (this.y || 0)) ^ (this.z || 0)) ^ (this.w || 0)
}, i.prototype.asArray = function () {
var e = [];
return this.toArray(e, 0), e
}, i.prototype.toArray = function (e, t) {
return void 0 === t && (t = 0), e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, this
}, i.prototype.addInPlace = function (e) {
return this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this
}, i.prototype.add = function (e) {
return new i(this.x + e.x, this.y + e.y, this.z + e.z, this.w + e.w)
}, i.prototype.addToRef = function (e, t) {
return t.x = this.x + e.x, t.y = this.y + e.y, t.z = this.z + e.z, t.w = this.w + e.w, this
}, i.prototype.subtractInPlace = function (e) {
return this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this
}, i.prototype.subtract = function (e) {
return new i(this.x - e.x, this.y - e.y, this.z - e.z, this.w - e.w)
}, i.prototype.subtractToRef = function (e, t) {
return t.x = this.x - e.x, t.y = this.y - e.y, t.z = this.z - e.z, t.w = this.w - e.w, this
}, i.prototype.subtractFromFloats = function (e, t, r, n) {
return new i(this.x - e, this.y - t, this.z - r, this.w - n)
}, i.prototype.subtractFromFloatsToRef = function (e, t, i, r, n) {
return n.x = this.x - e, n.y = this.y - t, n.z = this.z - i, n.w = this.w - r, this
}, i.prototype.negate = function () {
return new i(-this.x, -this.y, -this.z, -this.w)
}, i.prototype.scaleInPlace = function (e) {
return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this
}, i.prototype.scale = function (e) {
return new i(this.x * e, this.y * e, this.z * e, this.w * e)
}, i.prototype.scaleToRef = function (e, t) {
t.x = this.x * e, t.y = this.y * e, t.z = this.z * e, t.w = this.w * e
}, i.prototype.equals = function (e) {
return e && this.x === e.x && this.y === e.y && this.z === e.z && this.w === e.w
}, i.prototype.equalsWithEpsilon = function (i, r) {
return void 0 === r && (r = e.Epsilon), i && t.WithinEpsilon(this.x, i.x, r) && t.WithinEpsilon(this.y, i.y, r) && t.WithinEpsilon(this.z, i.z, r) && t.WithinEpsilon(this.w, i.w, r)
}, i.prototype.equalsToFloats = function (e, t, i, r) {
return this.x === e && this.y === t && this.z === i && this.w === r
}, i.prototype.multiplyInPlace = function (e) {
return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this
}, i.prototype.multiply = function (e) {
return new i(this.x * e.x, this.y * e.y, this.z * e.z, this.w * e.w)
}, i.prototype.multiplyToRef = function (e, t) {
return t.x = this.x * e.x, t.y = this.y * e.y, t.z = this.z * e.z, t.w = this.w * e.w, this
}, i.prototype.multiplyByFloats = function (e, t, r, n) {
return new i(this.x * e, this.y * t, this.z * r, this.w * n)
}, i.prototype.divide = function (e) {
return new i(this.x / e.x, this.y / e.y, this.z / e.z, this.w / e.w)
}, i.prototype.divideToRef = function (e, t) {
return t.x = this.x / e.x, t.y = this.y / e.y, t.z = this.z / e.z, t.w = this.w / e.w, this
}, i.prototype.MinimizeInPlace = function (e) {
return e.x < this.x && (this.x = e.x), e.y < this.y && (this.y = e.y), e.z < this.z && (this.z = e.z), e.w < this.w && (this.w = e.w), this
}, i.prototype.MaximizeInPlace = function (e) {
return e.x > this.x && (this.x = e.x), e.y > this.y && (this.y = e.y), e.z > this.z && (this.z = e.z), e.w > this.w && (this.w = e.w), this
}, i.prototype.length = function () {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)
}, i.prototype.lengthSquared = function () {
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w
}, i.prototype.normalize = function () {
var e = this.length();
if (0 === e) return this;
var t = 1 / e;
return this.x *= t, this.y *= t, this.z *= t, this.w *= t, this
}, i.prototype.toVector3 = function () {
return new o(this.x, this.y, this.z)
}, i.prototype.clone = function () {
return new i(this.x, this.y, this.z, this.w)
}, i.prototype.copyFrom = function (e) {
return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w, this
}, i.prototype.copyFromFloats = function (e, t, i, r) {
return this.x = e, this.y = t, this.z = i, this.w = r, this
}, i.FromArray = function (e, t) {
return t || (t = 0), new i(e[t], e[t + 1], e[t + 2], e[t + 3])
}, i.FromArrayToRef = function (e, t, i) {
i.x = e[t], i.y = e[t + 1], i.z = e[t + 2], i.w = e[t + 3]
}, i.FromFloatArrayToRef = function (e, t, i) {
i.x = e[t], i.y = e[t + 1], i.z = e[t + 2], i.w = e[t + 3]
}, i.FromFloatsToRef = function (e, t, i, r, n) {
n.x = e, n.y = t, n.z = i, n.w = r
}, i.Zero = function () {
return new i(0, 0, 0, 0)
}, i.Normalize = function (e) {
var t = i.Zero();
return i.NormalizeToRef(e, t), t
}, i.NormalizeToRef = function (e, t) {
t.copyFrom(e), t.normalize()
}, i.Minimize = function (e, t) {
var i = e.clone();
return i.MinimizeInPlace(t), i
}, i.Maximize = function (e, t) {
var i = e.clone();
return i.MaximizeInPlace(t), i
}, i.Distance = function (e, t) {
return Math.sqrt(i.DistanceSquared(e, t))
}, i.DistanceSquared = function (e, t) {
var i = e.x - t.x,
r = e.y - t.y,
n = e.z - t.z,
o = e.w - t.w;
return i * i + r * r + n * n + o * o
}, i.Center = function (e, t) {
var i = e.add(t);
return i.scaleInPlace(.5), i
}, i
}();
e.Vector4 = s;
var a = function () {
function e(e, t) {
this.width = e, this.height = t
}
return e.prototype.toString = function () {
return "{W: " + this.width + ", H: " + this.height + "}"
}, e.prototype.getClassName = function () {
return "Size"
}, e.prototype.getHashCode = function () {
var e = this.width || 0;
return 397 * e ^ (this.height || 0)
}, e.prototype.copyFrom = function (e) {
this.width = e.width, this.height = e.height
}, e.prototype.copyFromFloats = function (e, t) {
this.width = e, this.height = t
}, e.prototype.multiplyByFloats = function (t, i) {
return new e(this.width * t, this.height * i)
}, e.prototype.clone = function () {
return new e(this.width, this.height)
}, e.prototype.equals = function (e) {
return !!e && this.width === e.width && this.height === e.height
}, Object.defineProperty(e.prototype, "surface", {
get: function () {
return this.width * this.height
},
enumerable: !0,
configurable: !0
}), e.Zero = function () {
return new e(0, 0)
}, e.prototype.add = function (t) {
return new e(this.width + t.width, this.height + t.height)
}, e.prototype.substract = function (t) {
return new e(this.width - t.width, this.height - t.height)
}, e.Lerp = function (t, i, r) {
return new e(t.width + (i.width - t.width) * r, t.height + (i.height - t.height) * r)
}, e
}();
e.Size = a;
var c = function () {
function e(e, t, i, r) {
void 0 === e && (e = 0), void 0 === t && (t = 0), void 0 === i && (i = 0), void 0 === r && (r = 1), this.x = e, this.y = t, this.z = i, this.w = r
}
return e.prototype.toString = function () {
return "{X: " + this.x + " Y:" + this.y + " Z:" + this.z + " W:" + this.w + "}"
}, e.prototype.getClassName = function () {
return "Quaternion"
}, e.prototype.getHashCode = function () {
var e = this.x || 0;
return 397 * (e = 397 * (e = 397 * e ^ (this.y || 0)) ^ (this.z || 0)) ^ (this.w || 0)
}, e.prototype.asArray = function () {
return [this.x, this.y, this.z, this.w]
}, e.prototype.equals = function (e) {
return e && this.x === e.x && this.y === e.y && this.z === e.z && this.w === e.w
}, e.prototype.clone = function () {
return new e(this.x, this.y, this.z, this.w)
}, e.prototype.copyFrom = function (e) {
return this.x = e.x, this.y = e.y, this.z = e.z, this.w = e.w, this
}, e.prototype.copyFromFloats = function (e, t, i, r) {
return this.x = e, this.y = t, this.z = i, this.w = r, this
}, e.prototype.add = function (t) {
return new e(this.x + t.x, this.y + t.y, this.z + t.z, this.w + t.w)
}, e.prototype.subtract = function (t) {
return new e(this.x - t.x, this.y - t.y, this.z - t.z, this.w - t.w)
}, e.prototype.scale = function (t) {
return new e(this.x * t, this.y * t, this.z * t, this.w * t)
}, e.prototype.multiply = function (t) {
var i = new e(0, 0, 0, 1);
return this.multiplyToRef(t, i), i
}, e.prototype.multiplyToRef = function (e, t) {
var i = this.x * e.w + this.y * e.z - this.z * e.y + this.w * e.x,
r = -this.x * e.z + this.y * e.w + this.z * e.x + this.w * e.y,
n = this.x * e.y - this.y * e.x + this.z * e.w + this.w * e.z,
o = -this.x * e.x - this.y * e.y - this.z * e.z + this.w * e.w;
return t.copyFromFloats(i, r, n, o), this
}, e.prototype.multiplyInPlace = function (e) {
return this.multiplyToRef(e, this), this
}, e.prototype.conjugateToRef = function (e) {
return e.copyFromFloats(-this.x, -this.y, -this.z, this.w), this
}, e.prototype.conjugateInPlace = function () {
return this.x *= -1, this.y *= -1, this.z *= -1, this
}, e.prototype.conjugate = function () {
return new e(-this.x, -this.y, -this.z, this.w)
}, e.prototype.length = function () {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)
}, e.prototype.normalize = function () {
var e = 1 / this.length();
return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this
}, e.prototype.toEulerAngles = function (e) {
void 0 === e && (e = "YZX");
var t = o.Zero();
return this.toEulerAnglesToRef(t, e), t
}, e.prototype.toEulerAnglesToRef = function (e, t) {
void 0 === t && (t = "YZX");
var i = this.z,
r = this.x,
n = this.y,
o = this.w,
s = o * o,
a = i * i,
c = r * r,
h = n * n,
u = n * i - r * o,
l = .4999999;
return u < -l ? (e.y = 2 * Math.atan2(n, o), e.x = Math.PI / 2, e.z = 0) : u > l ? (e.y = 2 * Math.atan2(n, o), e.x = -Math.PI / 2, e.z = 0) : (e.z = Math.atan2(2 * (r * n + i * o), -a - c + h + s), e.x = Math.asin(-2 * (i * n - r * o)), e.y = Math.atan2(2 * (i * r + n * o), a - c - h + s)), this
}, e.prototype.toRotationMatrix = function (e) {
var t = this.x * this.x,
i = this.y * this.y,
r = this.z * this.z,
n = this.x * this.y,
o = this.z * this.w,
s = this.z * this.x,
a = this.y * this.w,
c = this.y * this.z,
h = this.x * this.w;
return e.m[0] = 1 - 2 * (i + r), e.m[1] = 2 * (n + o), e.m[2] = 2 * (s - a), e.m[3] = 0, e.m[4] = 2 * (n - o), e.m[5] = 1 - 2 * (r + t), e.m[6] = 2 * (c + h), e.m[7] = 0, e.m[8] = 2 * (s + a), e.m[9] = 2 * (c - h), e.m[10] = 1 - 2 * (i + t), e.m[11] = 0, e.m[12] = 0, e.m[13] = 0, e.m[14] = 0, e.m[15] = 1, this
}, e.prototype.fromRotationMatrix = function (t) {
return e.FromRotationMatrixToRef(t, this), this
}, e.FromRotationMatrix = function (t) {
var i = new e;
return e.FromRotationMatrixToRef(t, i), i
}, e.FromRotationMatrixToRef = function (e, t) {
var i, r = e.m,
n = r[0],
o = r[4],
s = r[8],
a = r[1],
c = r[5],
h = r[9],
u = r[2],
l = r[6],
f = r[10],
d = n + c + f;
d > 0 ? (i = .5 / Math.sqrt(d + 1), t.w = .25 / i, t.x = (l - h) * i, t.y = (s - u) * i, t.z = (a - o) * i) : n > c && n > f ? (i = 2 * Math.sqrt(1 + n - c - f), t.w = (l - h) / i, t.x = .25 * i, t.y = (o + a) / i, t.z = (s + u) / i) : c > f ? (i = 2 * Math.sqrt(1 + c - n - f), t.w = (s - u) / i, t.x = (o + a) / i, t.y = .25 * i, t.z = (h + l) / i) : (i = 2 * Math.sqrt(1 + f - n - c), t.w = (a - o) / i, t.x = (s + u) / i, t.y = (h + l) / i, t.z = .25 * i)
}, e.Inverse = function (t) {
return new e(-t.x, -t.y, -t.z, t.w)
}, e.Identity = function () {
return new e(0, 0, 0, 1)
}, e.RotationAxis = function (t, i) {
return e.RotationAxisToRef(t, i, new e)
}, e.RotationAxisToRef = function (e, t, i) {
var r = Math.sin(t / 2);
return e.normalize(), i.w = Math.cos(t / 2), i.x = e.x * r, i.y = e.y * r, i.z = e.z * r, i
}, e.FromArray = function (t, i) {
return i || (i = 0), new e(t[i], t[i + 1], t[i + 2], t[i + 3])
}, e.RotationYawPitchRoll = function (t, i, r) {
var n = new e;
return e.RotationYawPitchRollToRef(t, i, r, n), n
}, e.RotationYawPitchRollToRef = function (e, t, i, r) {
var n = .5 * i,
o = .5 * t,
s = .5 * e,
a = Math.sin(n),
c = Math.cos(n),
h = Math.sin(o),
u = Math.cos(o),
l = Math.sin(s),
f = Math.cos(s);
r.x = f * h * c + l * u * a, r.y = l * u * c - f * h * a, r.z = f * u * a - l * h * c, r.w = f * u * c + l * h * a
}, e.RotationAlphaBetaGamma = function (t, i, r) {
var n = new e;
return e.RotationAlphaBetaGammaToRef(t, i, r, n), n
}, e.RotationAlphaBetaGammaToRef = function (e, t, i, r) {
var n = .5 * (i + e),
o = .5 * (i - e),
s = .5 * t;
r.x = Math.cos(o) * Math.sin(s), r.y = Math.sin(o) * Math.sin(s), r.z = Math.sin(n) * Math.cos(s), r.w = Math.cos(n) * Math.cos(s)
}, e.Slerp = function (t, i, r) {
var n = e.Identity();
return e.SlerpToRef(t, i, r, n), n
}, e.SlerpToRef = function (e, t, i, r) {
var n, o, s = i,
a = e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w,
c = !1;
if (a < 0 && (c = !0, a = -a), a > .999999) o = 1 - s, n = c ? -s : s;
else {
var h = Math.acos(a),
u = 1 / Math.sin(h);
o = Math.sin((1 - s) * h) * u, n = c ? -Math.sin(s * h) * u : Math.sin(s * h) * u
}
r.x = o * e.x + n * t.x, r.y = o * e.y + n * t.y, r.z = o * e.z + n * t.z, r.w = o * e.w + n * t.w
}, e
}();
e.Quaternion = c;
var h = function () {
function e() {
this.m = new Float32Array(16)
}
return e.prototype.isIdentity = function () {
return 1 === this.m[0] && 1 === this.m[5] && 1 === this.m[10] && 1 === this.m[15] && 0 === this.m[1] && 0 === this.m[2] && 0 === this.m[3] && 0 === this.m[4] && 0 === this.m[6] && 0 === this.m[7] && 0 === this.m[8] && 0 === this.m[9] && 0 === this.m[11] && 0 === this.m[12] && 0 === this.m[13] && 0 === this.m[14]
}, e.prototype.determinant = function () {
var e = this.m[10] * this.m[15] - this.m[11] * this.m[14],
t = this.m[9] * this.m[15] - this.m[11] * this.m[13],
i = this.m[9] * this.m[14] - this.m[10] * this.m[13],
r = this.m[8] * this.m[15] - this.m[11] * this.m[12],
n = this.m[8] * this.m[14] - this.m[10] * this.m[12],
o = this.m[8] * this.m[13] - this.m[9] * this.m[12];
return this.m[0] * (this.m[5] * e - this.m[6] * t + this.m[7] * i) - this.m[1] * (this.m[4] * e - this.m[6] * r + this.m[7] * n) + this.m[2] * (this.m[4] * t - this.m[5] * r + this.m[7] * o) - this.m[3] * (this.m[4] * i - this.m[5] * n + this.m[6] * o)
}, e.prototype.toArray = function () {
return this.m
}, e.prototype.asArray = function () {
return this.toArray()
}, e.prototype.invert = function () {
return this.invertToRef(this), this
}, e.prototype.reset = function () {
for (var e = 0; e < 16; e++) this.m[e] = 0;
return this
}, e.prototype.add = function (t) {
var i = new e;
return this.addToRef(t, i), i
}, e.prototype.addToRef = function (e, t) {
for (var i = 0; i < 16; i++) t.m[i] = this.m[i] + e.m[i];
return this
}, e.prototype.addToSelf = function (e) {
for (var t = 0; t < 16; t++) this.m[t] += e.m[t];
return this
}, e.prototype.invertToRef = function (e) {
var t = this.m[0],
i = this.m[1],
r = this.m[2],
n = this.m[3],
o = this.m[4],
s = this.m[5],
a = this.m[6],
c = this.m[7],
h = this.m[8],
u = this.m[9],
l = this.m[10],
f = this.m[11],
d = this.m[12],
p = this.m[13],
m = this.m[14],
g = this.m[15],
_ = l * g - f * m,
v = u * g - f * p,
y = u * m - l * p,
b = h * g - f * d,
x = h * m - l * d,
w = h * p - u * d,
S = s * _ - a * v + c * y,
T = -(o * _ - a * b + c * x),
A = o * v - s * b + c * w,
M = -(o * y - s * x + a * w),
E = 1 / (t * S + i * T + r * A + n * M),
P = a * g - c * m,
C = s * g - c * p,
R = s * m - a * p,
I = o * g - c * d,
D = o * m - a * d,
O = o * p - s * d,
L = a * f - c * l,
F = s * f - c * u,
B = s * l - a * u,
k = o * f - c * h,
V = o * l - a * h,
N = o * u - s * h;
return e.m[0] = S * E, e.m[4] = T * E, e.m[8] = A * E, e.m[12] = M * E, e.m[1] = -(i * _ - r * v + n * y) * E, e.m[5] = (t * _ - r * b + n * x) * E, e.m[9] = -(t * v - i * b + n * w) * E, e.m[13] = (t * y - i * x + r * w) * E, e.m[2] = (i * P - r * C + n * R) * E, e.m[6] = -(t * P - r * I + n * D) * E, e.m[10] = (t * C - i * I + n * O) * E, e.m[14] = -(t * R - i * D + r * O) * E, e.m[3] = -(i * L - r * F + n * B) * E, e.m[7] = (t * L - r * k + n * V) * E, e.m[11] = -(t * F - i * k + n * N) * E, e.m[15] = (t * B - i * V + r * N) * E, this
}, e.prototype.setTranslation = function (e) {
return this.m[12] = e.x, this.m[13] = e.y, this.m[14] = e.z, this
}, e.prototype.getTranslation = function () {
return new o(this.m[12], this.m[13], this.m[14])
}, e.prototype.multiply = function (t) {
var i = new e;
return this.multiplyToRef(t, i), i
}, e.prototype.copyFrom = function (e) {
for (var t = 0; t < 16; t++) this.m[t] = e.m[t];
return this
}, e.prototype.copyToArray = function (e, t) {
void 0 === t && (t = 0);
for (var i = 0; i < 16; i++) e[t + i] = this.m[i];
return this
}, e.prototype.multiplyToRef = function (e, t) {
return this.multiplyToArray(e, t.m, 0), this
}, e.prototype.multiplyToArray = function (e, t, i) {
var r = this.m[0],
n = this.m[1],
o = this.m[2],
s = this.m[3],
a = this.m[4],
c = this.m[5],
h = this.m[6],
u = this.m[7],
l = this.m[8],
f = this.m[9],
d = this.m[10],
p = this.m[11],
m = this.m[12],
g = this.m[13],
_ = this.m[14],
v = this.m[15],
y = e.m[0],
b = e.m[1],
x = e.m[2],
w = e.m[3],
S = e.m[4],
T = e.m[5],
A = e.m[6],
M = e.m[7],
E = e.m[8],
P = e.m[9],
C = e.m[10],
R = e.m[11],
I = e.m[12],
D = e.m[13],
O = e.m[14],
L = e.m[15];
return t[i] = r * y + n * S + o * E + s * I, t[i + 1] = r * b + n * T + o * P + s * D, t[i + 2] = r * x + n * A + o * C + s * O, t[i + 3] = r * w + n * M + o * R + s * L, t[i + 4] = a * y + c * S + h * E + u * I, t[i + 5] = a * b + c * T + h * P + u * D, t[i + 6] = a * x + c * A + h * C + u * O, t[i + 7] = a * w + c * M + h * R + u * L, t[i + 8] = l * y + f * S + d * E + p * I, t[i + 9] = l * b + f * T + d * P + p * D, t[i + 10] = l * x + f * A + d * C + p * O, t[i + 11] = l * w + f * M + d * R + p * L, t[i + 12] = m * y + g * S + _ * E + v * I, t[i + 13] = m * b + g * T + _ * P + v * D, t[i + 14] = m * x + g * A + _ * C + v * O, t[i + 15] = m * w + g * M + _ * R + v * L, this
}, e.prototype.equals = function (e) {
return e && this.m[0] === e.m[0] && this.m[1] === e.m[1] && this.m[2] === e.m[2] && this.m[3] === e.m[3] && this.m[4] === e.m[4] && this.m[5] === e.m[5] && this.m[6] === e.m[6] && this.m[7] === e.m[7] && this.m[8] === e.m[8] && this.m[9] === e.m[9] && this.m[10] === e.m[10] && this.m[11] === e.m[11] && this.m[12] === e.m[12] && this.m[13] === e.m[13] && this.m[14] === e.m[14] && this.m[15] === e.m[15]
}, e.prototype.clone = function () {
return e.FromValues(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5], this.m[6], this.m[7], this.m[8], this.m[9], this.m[10], this.m[11], this.m[12], this.m[13], this.m[14], this.m[15])
}, e.prototype.getClassName = function () {
return "Matrix"
}, e.prototype.getHashCode = function () {
for (var e = this.m[0] || 0, t = 1; t < 16; t++) e = 397 * e ^ (this.m[t] || 0);
return e
}, e.prototype.decompose = function (i, r, n) {
n.x = this.m[12], n.y = this.m[13], n.z = this.m[14];
var o = t.Sign(this.m[0] * this.m[1] * this.m[2] * this.m[3]) < 0 ? -1 : 1,
s = t.Sign(this.m[4] * this.m[5] * this.m[6] * this.m[7]) < 0 ? -1 : 1,
a = t.Sign(this.m[8] * this.m[9] * this.m[10] * this.m[11]) < 0 ? -1 : 1;
return i.x = o * Math.sqrt(this.m[0] * this.m[0] + this.m[1] * this.m[1] + this.m[2] * this.m[2]), i.y = s * Math.sqrt(this.m[4] * this.m[4] + this.m[5] * this.m[5] + this.m[6] * this.m[6]), i.z = a * Math.sqrt(this.m[8] * this.m[8] + this.m[9] * this.m[9] + this.m[10] * this.m[10]), 0 === i.x || 0 === i.y || 0 === i.z ? (r.x = 0, r.y = 0, r.z = 0, r.w = 1, !1) : (e.FromValuesToRef(this.m[0] / i.x, this.m[1] / i.x, this.m[2] / i.x, 0, this.m[4] / i.y, this.m[5] / i.y, this.m[6] / i.y, 0, this.m[8] / i.z, this.m[9] / i.z, this.m[10] / i.z, 0, 0, 0, 0, 1, A.Matrix[0]), c.FromRotationMatrixToRef(A.Matrix[0], r), !0)
}, e.prototype.getRotationMatrix = function () {
var t = e.Identity();
return this.getRotationMatrixToRef(t), t
}, e.prototype.getRotationMatrixToRef = function (t) {
var i = this.m,
r = i[0] * i[1] * i[2] * i[3] < 0 ? -1 : 1,
n = i[4] * i[5] * i[6] * i[7] < 0 ? -1 : 1,
o = i[8] * i[9] * i[10] * i[11] < 0 ? -1 : 1,
s = r * Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]),
a = n * Math.sqrt(i[4] * i[4] + i[5] * i[5] + i[6] * i[6]),
c = o * Math.sqrt(i[8] * i[8] + i[9] * i[9] + i[10] * i[10]);
e.FromValuesToRef(i[0] / s, i[1] / s, i[2] / s, 0, i[4] / a, i[5] / a, i[6] / a, 0, i[8] / c, i[9] / c, i[10] / c, 0, 0, 0, 0, 1, t)
}, e.FromArray = function (t, i) {
var r = new e;
return i || (i = 0), e.FromArrayToRef(t, i, r), r
}, e.FromArrayToRef = function (e, t, i) {
for (var r = 0; r < 16; r++) i.m[r] = e[r + t]
}, e.FromFloat32ArrayToRefScaled = function (e, t, i, r) {
for (var n = 0; n < 16; n++) r.m[n] = e[n + t] * i
}, e.FromValuesToRef = function (e, t, i, r, n, o, s, a, c, h, u, l, f, d, p, m, g) {
g.m[0] = e, g.m[1] = t, g.m[2] = i, g.m[3] = r, g.m[4] = n, g.m[5] = o, g.m[6] = s, g.m[7] = a, g.m[8] = c, g.m[9] = h, g.m[10] = u, g.m[11] = l, g.m[12] = f, g.m[13] = d, g.m[14] = p, g.m[15] = m
}, e.prototype.getRow = function (e) {
if (e < 0 || e > 3) return null;
var t = 4 * e;
return new s(this.m[t + 0], this.m[t + 1], this.m[t + 2], this.m[t + 3])
}, e.prototype.setRow = function (e, t) {
if (e < 0 || e > 3) return this;
var i = 4 * e;
return this.m[i + 0] = t.x, this.m[i + 1] = t.y, this.m[i + 2] = t.z, this.m[i + 3] = t.w, this
}, e.FromValues = function (t, i, r, n, o, s, a, c, h, u, l, f, d, p, m, g) {
var _ = new e;
return _.m[0] = t, _.m[1] = i, _.m[2] = r, _.m[3] = n, _.m[4] = o, _.m[5] = s, _.m[6] = a, _.m[7] = c, _.m[8] = h, _.m[9] = u, _.m[10] = l, _.m[11] = f, _.m[12] = d, _.m[13] = p, _.m[14] = m, _.m[15] = g, _
}, e.Compose = function (t, i, r) {
var n = e.FromValues(t.x, 0, 0, 0, 0, t.y, 0, 0, 0, 0, t.z, 0, 0, 0, 0, 1),
o = e.Identity();
return i.toRotationMatrix(o), (n = n.multiply(o)).setTranslation(r), n
}, e.Identity = function () {
return e.FromValues(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
}, e.IdentityToRef = function (t) {
e.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, t)
}, e.Zero = function () {
return e.FromValues(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}, e.RotationX = function (t) {
var i = new e;
return e.RotationXToRef(t, i), i
}, e.Invert = function (t) {
var i = new e;
return t.invertToRef(i), i
}, e.RotationXToRef = function (e, t) {
var i = Math.sin(e),
r = Math.cos(e);
t.m[0] = 1, t.m[15] = 1, t.m[5] = r, t.m[10] = r, t.m[9] = -i, t.m[6] = i, t.m[1] = 0, t.m[2] = 0, t.m[3] = 0, t.m[4] = 0, t.m[7] = 0, t.m[8] = 0, t.m[11] = 0, t.m[12] = 0, t.m[13] = 0, t.m[14] = 0
}, e.RotationY = function (t) {
var i = new e;
return e.RotationYToRef(t, i), i
}, e.RotationYToRef = function (e, t) {
var i = Math.sin(e),
r = Math.cos(e);
t.m[5] = 1, t.m[15] = 1, t.m[0] = r, t.m[2] = -i, t.m[8] = i, t.m[10] = r, t.m[1] = 0, t.m[3] = 0, t.m[4] = 0, t.m[6] = 0, t.m[7] = 0, t.m[9] = 0, t.m[11] = 0, t.m[12] = 0, t.m[13] = 0, t.m[14] = 0
}, e.RotationZ = function (t) {
var i = new e;
return e.RotationZToRef(t, i), i
}, e.RotationZToRef = function (e, t) {
var i = Math.sin(e),
r = Math.cos(e);
t.m[10] = 1, t.m[15] = 1, t.m[0] = r, t.m[1] = i, t.m[4] = -i, t.m[5] = r, t.m[2] = 0, t.m[3] = 0, t.m[6] = 0, t.m[7] = 0, t.m[8] = 0, t.m[9] = 0, t.m[11] = 0, t.m[12] = 0, t.m[13] = 0, t.m[14] = 0
}, e.RotationAxis = function (t, i) {
var r = e.Zero();
return e.RotationAxisToRef(t, i, r), r
}, e.RotationAxisToRef = function (e, t, i) {
var r = Math.sin(-t),
n = Math.cos(-t),
o = 1 - n;
e.normalize(), i.m[0] = e.x * e.x * o + n, i.m[1] = e.x * e.y * o - e.z * r, i.m[2] = e.x * e.z * o + e.y * r, i.m[3] = 0, i.m[4] = e.y * e.x * o + e.z * r, i.m[5] = e.y * e.y * o + n, i.m[6] = e.y * e.z * o - e.x * r, i.m[7] = 0, i.m[8] = e.z * e.x * o - e.y * r, i.m[9] = e.z * e.y * o + e.x * r, i.m[10] = e.z * e.z * o + n, i.m[11] = 0, i.m[15] = 1
}, e.RotationYawPitchRoll = function (t, i, r) {
var n = new e;
return e.RotationYawPitchRollToRef(t, i, r, n), n
}, e.RotationYawPitchRollToRef = function (e, t, i, r) {
c.RotationYawPitchRollToRef(e, t, i, this._tempQuaternion), this._tempQuaternion.toRotationMatrix(r)
}, e.Scaling = function (t, i, r) {
var n = e.Zero();
return e.ScalingToRef(t, i, r, n), n
}, e.ScalingToRef = function (e, t, i, r) {
r.m[0] = e, r.m[1] = 0, r.m[2] = 0, r.m[3] = 0, r.m[4] = 0, r.m[5] = t, r.m[6] = 0, r.m[7] = 0, r.m[8] = 0, r.m[9] = 0, r.m[10] = i, r.m[11] = 0, r.m[12] = 0, r.m[13] = 0, r.m[14] = 0, r.m[15] = 1
}, e.Translation = function (t, i, r) {
var n = e.Identity();
return e.TranslationToRef(t, i, r, n), n
}, e.TranslationToRef = function (t, i, r, n) {
e.FromValuesToRef(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t, i, r, 1, n)
}, e.Lerp = function (t, i, r) {
for (var n = e.Zero(), o = 0; o < 16; o++) n.m[o] = t.m[o] * (1 - r) + i.m[o] * r;
return n
}, e.DecomposeLerp = function (t, i, r) {
var n = new o(0, 0, 0),
s = new c,
a = new o(0, 0, 0);
t.decompose(n, s, a);
var h = new o(0, 0, 0),
u = new c,
l = new o(0, 0, 0);
i.decompose(h, u, l);
var f = o.Lerp(n, h, r),
d = c.Slerp(s, u, r),
p = o.Lerp(a, l, r);
return e.Compose(f, d, p)
}, e.LookAtLH = function (t, i, r) {
var n = e.Zero();
return e.LookAtLHToRef(t, i, r, n), n
}, e.LookAtLHToRef = function (t, i, r, n) {
i.subtractToRef(t, this._zAxis), this._zAxis.normalize(), o.CrossToRef(r, this._zAxis, this._xAxis), 0 === this._xAxis.lengthSquared() ? this._xAxis.x = 1 : this._xAxis.normalize(), o.CrossToRef(this._zAxis, this._xAxis, this._yAxis), this._yAxis.normalize();
var s = -o.Dot(this._xAxis, t),
a = -o.Dot(this._yAxis, t),
c = -o.Dot(this._zAxis, t);
return e.FromValuesToRef(this._xAxis.x, this._yAxis.x, this._zAxis.x, 0, this._xAxis.y, this._yAxis.y, this._zAxis.y, 0, this._xAxis.z, this._yAxis.z, this._zAxis.z, 0, s, a, c, 1, n)
}, e.LookAtRH = function (t, i, r) {
var n = e.Zero();
return e.LookAtRHToRef(t, i, r, n), n
}, e.LookAtRHToRef = function (t, i, r, n) {
t.subtractToRef(i, this._zAxis), this._zAxis.normalize(), o.CrossToRef(r, this._zAxis, this._xAxis), 0 === this._xAxis.lengthSquared() ? this._xAxis.x = 1 : this._xAxis.normalize(), o.CrossToRef(this._zAxis, this._xAxis, this._yAxis), this._yAxis.normalize();
var s = -o.Dot(this._xAxis, t),
a = -o.Dot(this._yAxis, t),
c = -o.Dot(this._zAxis, t);
return e.FromValuesToRef(this._xAxis.x, this._yAxis.x, this._zAxis.x, 0, this._xAxis.y, this._yAxis.y, this._zAxis.y, 0, this._xAxis.z, this._yAxis.z, this._zAxis.z, 0, s, a, c, 1, n)
}, e.OrthoLH = function (t, i, r, n) {
var o = e.Zero();
return e.OrthoLHToRef(t, i, r, n, o), o
}, e.OrthoLHToRef = function (t, i, r, n, o) {
var s = 2 / t,
a = 2 / i,
c = 1 / (n - r),
h = r / (r - n);
e.FromValuesToRef(s, 0, 0, 0, 0, a, 0, 0, 0, 0, c, 0, 0, 0, h, 1, o)
}, e.OrthoOffCenterLH = function (t, i, r, n, o, s) {
var a = e.Zero();
return e.OrthoOffCenterLHToRef(t, i, r, n, o, s, a), a
}, e.OrthoOffCenterLHToRef = function (e, t, i, r, n, o, s) {
s.m[0] = 2 / (t - e), s.m[1] = s.m[2] = s.m[3] = 0, s.m[5] = 2 / (r - i), s.m[4] = s.m[6] = s.m[7] = 0, s.m[10] = 1 / (o - n), s.m[8] = s.m[9] = s.m[11] = 0, s.m[12] = (e + t) / (e - t), s.m[13] = (r + i) / (i - r), s.m[14] = -n / (o - n), s.m[15] = 1
}, e.OrthoOffCenterRH = function (t, i, r, n, o, s) {
var a = e.Zero();
return e.OrthoOffCenterRHToRef(t, i, r, n, o, s, a), a
}, e.OrthoOffCenterRHToRef = function (t, i, r, n, o, s, a) {
e.OrthoOffCenterLHToRef(t, i, r, n, o, s, a), a.m[10] *= -1
}, e.PerspectiveLH = function (t, i, r, n) {
var o = e.Zero();
return o.m[0] = 2 * r / t, o.m[1] = o.m[2] = o.m[3] = 0, o.m[5] = 2 * r / i, o.m[4] = o.m[6] = o.m[7] = 0, o.m[10] = -n / (r - n), o.m[8] = o.m[9] = 0, o.m[11] = 1, o.m[12] = o.m[13] = o.m[15] = 0, o.m[14] = r * n / (r - n), o
}, e.PerspectiveFovLH = function (t, i, r, n) {
var o = e.Zero();
return e.PerspectiveFovLHToRef(t, i, r, n, o), o
}, e.PerspectiveFovLHToRef = function (e, t, i, r, n, o) {
void 0 === o && (o = !0);
var s = 1 / Math.tan(.5 * e);
n.m[0] = o ? s / t : s, n.m[1] = n.m[2] = n.m[3] = 0, n.m[5] = o ? s : s * t, n.m[4] = n.m[6] = n.m[7] = 0, n.m[8] = n.m[9] = 0, n.m[10] = r / (r - i), n.m[11] = 1, n.m[12] = n.m[13] = n.m[15] = 0, n.m[14] = -i * r / (r - i)
}, e.PerspectiveFovRH = function (t, i, r, n) {
var o = e.Zero();
return e.PerspectiveFovRHToRef(t, i, r, n, o), o
}, e.PerspectiveFovRHToRef = function (e, t, i, r, n, o) {
void 0 === o && (o = !0);
var s = 1 / Math.tan(.5 * e);
n.m[0] = o ? s / t : s, n.m[1] = n.m[2] = n.m[3] = 0, n.m[5] = o ? s : s * t, n.m[4] = n.m[6] = n.m[7] = 0, n.m[8] = n.m[9] = 0, n.m[10] = r / (i - r), n.m[11] = -1, n.m[12] = n.m[13] = n.m[15] = 0, n.m[14] = i * r / (i - r)
}, e.PerspectiveFovWebVRToRef = function (e, t, i, r, n) {
void 0 === n && (n = !0);
var o = Math.tan(e.upDegrees * Math.PI / 180),
s = Math.tan(e.downDegrees * Math.PI / 180),
a = Math.tan(e.leftDegrees * Math.PI / 180),
c = Math.tan(e.rightDegrees * Math.PI / 180),
h = 2 / (a + c),
u = 2 / (o + s);
r.m[0] = h, r.m[1] = r.m[2] = r.m[3] = r.m[4] = 0, r.m[5] = u, r.m[6] = r.m[7] = 0, r.m[8] = (a - c) * h * .5, r.m[9] = -(o - s) * u * .5, r.m[10] = -i / (t - i), r.m[11] = 1, r.m[12] = r.m[13] = r.m[15] = 0, r.m[14] = t * i / (t - i)
}, e.GetFinalMatrix = function (t, i, r, n, o, s) {
var a = t.width,
c = t.height,
h = t.x,
u = t.y,
l = e.FromValues(a / 2, 0, 0, 0, 0, -c / 2, 0, 0, 0, 0, s - o, 0, h + a / 2, c / 2 + u, o, 1);
return i.multiply(r).multiply(n).multiply(l)
}, e.GetAsMatrix2x2 = function (e) {
return new Float32Array([e.m[0], e.m[1], e.m[4], e.m[5]])
}, e.GetAsMatrix3x3 = function (e) {
return new Float32Array([e.m[0], e.m[1], e.m[2], e.m[4], e.m[5], e.m[6], e.m[8], e.m[9], e.m[10]])
}, e.Transpose = function (t) {
var i = new e;
return i.m[0] = t.m[0], i.m[1] = t.m[4], i.m[2] = t.m[8], i.m[3] = t.m[12], i.m[4] = t.m[1], i.m[5] = t.m[5], i.m[6] = t.m[9], i.m[7] = t.m[13], i.m[8] = t.m[2], i.m[9] = t.m[6], i.m[10] = t.m[10], i.m[11] = t.m[14], i.m[12] = t.m[3], i.m[13] = t.m[7], i.m[14] = t.m[11], i.m[15] = t.m[15], i
}, e.Reflection = function (t) {
var i = new e;
return e.ReflectionToRef(t, i), i
}, e.ReflectionToRef = function (e, t) {
e.normalize();
var i = e.normal.x,
r = e.normal.y,
n = e.normal.z,
o = -2 * i,
s = -2 * r,
a = -2 * n;
t.m[0] = o * i + 1, t.m[1] = s * i, t.m[2] = a * i, t.m[3] = 0, t.m[4] = o * r, t.m[5] = s * r + 1, t.m[6] = a * r, t.m[7] = 0, t.m[8] = o * n, t.m[9] = s * n, t.m[10] = a * n + 1, t.m[11] = 0, t.m[12] = o * e.d, t.m[13] = s * e.d, t.m[14] = a * e.d, t.m[15] = 1
}, e.FromXYZAxesToRef = function (e, t, i, r) {
r.m[0] = e.x, r.m[1] = e.y, r.m[2] = e.z, r.m[3] = 0, r.m[4] = t.x, r.m[5] = t.y, r.m[6] = t.z, r.m[7] = 0, r.m[8] = i.x, r.m[9] = i.y, r.m[10] = i.z, r.m[11] = 0, r.m[12] = 0, r.m[13] = 0, r.m[14] = 0, r.m[15] = 1
}, e.FromQuaternionToRef = function (e, t) {
var i = e.x * e.x,
r = e.y * e.y,
n = e.z * e.z,
o = e.x * e.y,
s = e.z * e.w,
a = e.z * e.x,
c = e.y * e.w,
h = e.y * e.z,
u = e.x * e.w;
t.m[0] = 1 - 2 * (r + n), t.m[1] = 2 * (o + s), t.m[2] = 2 * (a - c), t.m[3] = 0, t.m[4] = 2 * (o - s), t.m[5] = 1 - 2 * (n + i), t.m[6] = 2 * (h + u), t.m[7] = 0, t.m[8] = 2 * (a + c), t.m[9] = 2 * (h - u), t.m[10] = 1 - 2 * (r + i), t.m[11] = 0, t.m[12] = 0, t.m[13] = 0, t.m[14] = 0, t.m[15] = 1
}, e._tempQuaternion = new c, e._xAxis = o.Zero(), e._yAxis = o.Zero(), e._zAxis = o.Zero(), e
}();
e.Matrix = h;
var u = function () {
function e(e, t, i, r) {
this.normal = new o(e, t, i), this.d = r
}
return e.prototype.asArray = function () {
return [this.normal.x, this.normal.y, this.normal.z, this.d]
}, e.prototype.clone = function () {
return new e(this.normal.x, this.normal.y, this.normal.z, this.d)
}, e.prototype.getClassName = function () {
return "Plane"
}, e.prototype.getHashCode = function () {
var e = this.normal.getHashCode();
return 397 * e ^ (this.d || 0)
}, e.prototype.normalize = function () {
var e = Math.sqrt(this.normal.x * this.normal.x + this.normal.y * this.normal.y + this.normal.z * this.normal.z),
t = 0;
return 0 !== e && (t = 1 / e), this.normal.x *= t, this.normal.y *= t, this.normal.z *= t, this.d *= t, this
}, e.prototype.transform = function (t) {
var i = h.Transpose(t),
r = this.normal.x,
n = this.normal.y,
o = this.normal.z,
s = this.d;
return new e(r * i.m[0] + n * i.m[1] + o * i.m[2] + s * i.m[3], r * i.m[4] + n * i.m[5] + o * i.m[6] + s * i.m[7], r * i.m[8] + n * i.m[9] + o * i.m[10] + s * i.m[11], r * i.m[12] + n * i.m[13] + o * i.m[14] + s * i.m[15])
}, e.prototype.dotCoordinate = function (e) {
return this.normal.x * e.x + this.normal.y * e.y + this.normal.z * e.z + this.d
}, e.prototype.copyFromPoints = function (e, t, i) {
var r, n = t.x - e.x,
o = t.y - e.y,
s = t.z - e.z,
a = i.x - e.x,
c = i.y - e.y,
h = i.z - e.z,
u = o * h - s * c,
l = s * a - n * h,
f = n * c - o * a,
d = Math.sqrt(u * u + l * l + f * f);
return r = 0 !== d ? 1 / d : 0, this.normal.x = u * r, this.normal.y = l * r, this.normal.z = f * r, this.d = -(this.normal.x * e.x + this.normal.y * e.y + this.normal.z * e.z), this
}, e.prototype.isFrontFacingTo = function (e, t) {
return o.Dot(this.normal, e) <= t
}, e.prototype.signedDistanceTo = function (e) {
return o.Dot(e, this.normal) + this.d
}, e.FromArray = function (t) {
return new e(t[0], t[1], t[2], t[3])
}, e.FromPoints = function (t, i, r) {
var n = new e(0, 0, 0, 0);
return n.copyFromPoints(t, i, r), n
}, e.FromPositionAndNormal = function (t, i) {
var r = new e(0, 0, 0, 0);
return i.normalize(), r.normal = i, r.d = -(i.x * t.x + i.y * t.y + i.z * t.z), r
}, e.SignedDistanceToPlaneFromPositionAndNormal = function (e, t, i) {
var r = -(t.x * e.x + t.y * e.y + t.z * e.z);
return o.Dot(i, t) + r
}, e
}();
e.Plane = u;
var l = function () {
function e(e, t, i, r) {
this.x = e, this.y = t, this.width = i, this.height = r
}
return e.prototype.toGlobal = function (t, i) {
return new e(this.x * t, this.y * i, this.width * t, this.height * i)
}, e
}();
e.Viewport = l;
var f = function () {
function e() {}
return e.GetPlanes = function (t) {
for (var i = [], r = 0; r < 6; r++) i.push(new u(0, 0, 0, 0));
return e.GetPlanesToRef(t, i), i
}, e.GetPlanesToRef = function (e, t) {
t[0].normal.x = e.m[3] + e.m[2], t[0].normal.y = e.m[7] + e.m[6], t[0].normal.z = e.m[11] + e.m[10], t[0].d = e.m[15] + e.m[14], t[0].normalize(), t[1].normal.x = e.m[3] - e.m[2], t[1].normal.y = e.m[7] - e.m[6], t[1].normal.z = e.m[11] - e.m[10], t[1].d = e.m[15] - e.m[14], t[1].normalize(), t[2].normal.x = e.m[3] + e.m[0], t[2].normal.y = e.m[7] + e.m[4], t[2].normal.z = e.m[11] + e.m[8], t[2].d = e.m[15] + e.m[12], t[2].normalize(), t[3].normal.x = e.m[3] - e.m[0], t[3].normal.y = e.m[7] - e.m[4], t[3].normal.z = e.m[11] - e.m[8], t[3].d = e.m[15] - e.m[12], t[3].normalize(), t[4].normal.x = e.m[3] - e.m[1], t[4].normal.y = e.m[7] - e.m[5], t[4].normal.z = e.m[11] - e.m[9], t[4].d = e.m[15] - e.m[13], t[4].normalize(), t[5].normal.x = e.m[3] + e.m[1], t[5].normal.y = e.m[7] + e.m[5], t[5].normal.z = e.m[11] + e.m[9], t[5].d = e.m[15] + e.m[13], t[5].normalize()
}, e
}();
e.Frustum = f,
function (e) {
e[e.LOCAL = 0] = "LOCAL", e[e.WORLD = 1] = "WORLD"
}(e.Space || (e.Space = {}));
var d = (e.Space, function () {
function e() {}
return e.X = new o(1, 0, 0), e.Y = new o(0, 1, 0), e.Z = new o(0, 0, 1), e
}());
e.Axis = d;
var p = function () {
function e() {}
return e.interpolate = function (e, t, i, r, n) {
for (var o = 1 - 3 * r + 3 * t, s = 3 * r - 6 * t, a = 3 * t, c = e, h = 0; h < 5; h++) {
var u = c * c;
c -= (o * (u * c) + s * u + a * c - e) * (1 / (3 * o * u + 2 * s * c + a)), c = Math.min(1, Math.max(0, c))
}
return 3 * Math.pow(1 - c, 2) * c * i + 3 * (1 - c) * Math.pow(c, 2) * n + Math.pow(c, 3)
}, e
}();
e.BezierCurve = p,
function (e) {
e[e.CW = 0] = "CW", e[e.CCW = 1] = "CCW"
}(e.Orientation || (e.Orientation = {}));
var m = e.Orientation,
g = function () {
function e(e) {
var t = this;
this.degrees = function () {
return 180 * t._radians / Math.PI
}, this.radians = function () {
return t._radians
}, this._radians = e, this._radians < 0 && (this._radians += 2 * Math.PI)
}
return e.BetweenTwoPoints = function (t, i) {
var r = i.subtract(t);
return new e(Math.atan2(r.y, r.x))
}, e.FromRadians = function (t) {
return new e(t)
}, e.FromDegrees = function (t) {
return new e(t * Math.PI / 180)
}, e
}();
e.Angle = g;
var _ = function () {
return function (e, t, i) {
this.startPoint = e, this.midPoint = t, this.endPoint = i;
var r = Math.pow(t.x, 2) + Math.pow(t.y, 2),
o = (Math.pow(e.x, 2) + Math.pow(e.y, 2) - r) / 2,
s = (r - Math.pow(i.x, 2) - Math.pow(i.y, 2)) / 2,
a = (e.x - t.x) * (t.y - i.y) - (t.x - i.x) * (e.y - t.y);
this.centerPoint = new n((o * (t.y - i.y) - s * (e.y - t.y)) / a, ((e.x - t.x) * s - (t.x - i.x) * o) / a), this.radius = this.centerPoint.subtract(this.startPoint).length(), this.startAngle = g.BetweenTwoPoints(this.centerPoint, this.startPoint);
var c = this.startAngle.degrees(),
h = g.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees(),
u = g.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();
h - c > 180 && (h -= 360), h - c < -180 && (h += 360), u - h > 180 && (u -= 360), u - h < -180 && (u += 360), this.orientation = h - c < 0 ? m.CW : m.CCW, this.angle = g.FromDegrees(this.orientation === m.CW ? c - u : u - c)
}
}();
e.Arc2 = _;
var v = function () {
function e(e, t) {
this._points = new Array, this._length = 0, this.closed = !1, this._points.push(new n(e, t))
}
return e.prototype.addLineTo = function (e, t) {
if (closed) return this;
var i = new n(e, t),
r = this._points[this._points.length - 1];
return this._points.push(i), this._length += i.subtract(r).length(), this
}, e.prototype.addArcTo = function (e, t, i, r, o) {
if (void 0 === o && (o = 36), closed) return this;
var s = this._points[this._points.length - 1],
a = new n(e, t),
c = new n(i, r),
h = new _(s, a, c),
u = h.angle.radians() / o;
h.orientation === m.CW && (u *= -1);
for (var l = h.startAngle.radians() + u, f = 0; f < o; f++) {
var d = Math.cos(l) * h.radius + h.centerPoint.x,
p = Math.sin(l) * h.radius + h.centerPoint.y;
this.addLineTo(d, p), l += u
}
return this
}, e.prototype.close = function () {
return this.closed = !0, this
}, e.prototype.length = function () {
var e = this._length;
if (!this.closed) {
var t = this._points[this._points.length - 1];
e += this._points[0].subtract(t).length()
}
return e
}, e.prototype.getPoints = function () {
return this._points
}, e.prototype.getPointAtLengthPosition = function (e) {
if (e < 0 || e > 1) return n.Zero();
for (var t = e * this.length(), i = 0, r = 0; r < this._points.length; r++) {
var o = (r + 1) % this._points.length,
s = this._points[r],
a = this._points[o].subtract(s),
c = a.length() + i;
if (t >= i && t <= c) {
var h = a.normalize(),
u = t - i;
return new n(s.x + h.x * u, s.y + h.y * u)
}
i = c
}
return n.Zero()
}, e.StartingAt = function (t, i) {
return new e(t, i)
}, e
}();
e.Path2 = v;
var y = function () {
function i(e, t, i) {
this.path = e, this._curve = new Array, this._distances = new Array, this._tangents = new Array, this._normals = new Array, this._binormals = new Array;
for (var r = 0; r < e.length; r++) this._curve[r] = e[r].clone();
this._raw = i || !1, this._compute(t)
}
return i.prototype.getCurve = function () {
return this._curve
}, i.prototype.getTangents = function () {
return this._tangents
}, i.prototype.getNormals = function () {
return this._normals
}, i.prototype.getBinormals = function () {
return this._binormals
}, i.prototype.getDistances = function () {
return this._distances
}, i.prototype.update = function (e, t) {
for (var i = 0; i < e.length; i++) this._curve[i].x = e[i].x, this._curve[i].y = e[i].y, this._curve[i].z = e[i].z;
return this._compute(t), this
}, i.prototype._compute = function (e) {
var t = this._curve.length;
this._tangents[0] = this._getFirstNonNullVector(0), this._raw || this._tangents[0].normalize(), this._tangents[t - 1] = this._curve[t - 1].subtract(this._curve[t - 2]), this._raw || this._tangents[t - 1].normalize();
var i = this._tangents[0],
r = this._normalVector(this._curve[0], i, e);
this._normals[0] = r, this._raw || this._normals[0].normalize(), this._binormals[0] = o.Cross(i, this._normals[0]), this._raw || this._binormals[0].normalize(), this._distances[0] = 0;
for (var n, s, a, c, h = 1; h < t; h++) n = this._getLastNonNullVector(h), h < t - 1 && (s = this._getFirstNonNullVector(h), this._tangents[h] = n.add(s), this._tangents[h].normalize()), this._distances[h] = this._distances[h - 1] + n.length(), a = this._tangents[h], c = this._binormals[h - 1], this._normals[h] = o.Cross(c, a), this._raw || this._normals[h].normalize(), this._binormals[h] = o.Cross(a, this._normals[h]), this._raw || this._binormals[h].normalize()
}, i.prototype._getFirstNonNullVector = function (e) {
for (var t = 1, i = this._curve[e + t].subtract(this._curve[e]); 0 === i.length() && e + t + 1 < this._curve.length;) t++, i = this._curve[e + t].subtract(this._curve[e]);
return i
}, i.prototype._getLastNonNullVector = function (e) {
for (var t = 1, i = this._curve[e].subtract(this._curve[e - t]); 0 === i.length() && e > t + 1;) t++, i = this._curve[e].subtract(this._curve[e - t]);
return i
}, i.prototype._normalVector = function (i, r, n) {
var s, a, c = r.length();
(0 === c && (c = 1), null == n) ? (t.WithinEpsilon(Math.abs(r.y) / c, 1, e.Epsilon) ? t.WithinEpsilon(Math.abs(r.x) / c, 1, e.Epsilon) ? t.WithinEpsilon(Math.abs(r.z) / c, 1, e.Epsilon) || (a = new o(0, 0, 1)) : a = new o(1, 0, 0) : a = new o(0, -1, 0), s = o.Cross(r, a)) : (s = o.Cross(r, n), o.CrossToRef(s, r, s));
return s.normalize(), s
}, i
}();
e.Path3D = y;
var b = function () {
function e(e) {
this._length = 0, this._points = e, this._length = this._computeLength(e)
}
return e.CreateQuadraticBezier = function (t, i, r, n) {
n = n > 2 ? n : 3;
for (var s = new Array, a = function (e, t, i, r) {
return (1 - e) * (1 - e) * t + 2 * e * (1 - e) * i + e * e * r
}, c = 0; c <= n; c++) s.push(new o(a(c / n, t.x, i.x, r.x), a(c / n, t.y, i.y, r.y), a(c / n, t.z, i.z, r.z)));
return new e(s)
}, e.CreateCubicBezier = function (t, i, r, n, s) {
s = s > 3 ? s : 4;
for (var a = new Array, c = function (e, t, i, r, n) {
return (1 - e) * (1 - e) * (1 - e) * t + 3 * e * (1 - e) * (1 - e) * i + 3 * e * e * (1 - e) * r + e * e * e * n
}, h = 0; h <= s; h++) a.push(new o(c(h / s, t.x, i.x, r.x, n.x), c(h / s, t.y, i.y, r.y, n.y), c(h / s, t.z, i.z, r.z, n.z)));
return new e(a)
}, e.CreateHermiteSpline = function (t, i, r, n, s) {
for (var a = new Array, c = 1 / s, h = 0; h <= s; h++) a.push(o.Hermite(t, i, r, n, h * c));
return new e(a)
}, e.prototype.getPoints = function () {
return this._points
}, e.prototype.length = function () {
return this._length
}, e.prototype.continue = function (t) {
for (var i = this._points[this._points.length - 1], r = this._points.slice(), n = t.getPoints(), o = 1; o < n.length; o++) r.push(n[o].subtract(n[0]).add(i));
return new e(r)
}, e.prototype._computeLength = function (e) {
for (var t = 0, i = 1; i < e.length; i++) t += e[i].subtract(e[i - 1]).length();
return t
}, e
}();
e.Curve3 = b;
var x = function () {
function e() {
this.L00 = o.Zero(), this.L1_1 = o.Zero(), this.L10 = o.Zero(), this.L11 = o.Zero(), this.L2_2 = o.Zero(), this.L2_1 = o.Zero(), this.L20 = o.Zero(), this.L21 = o.Zero(), this.L22 = o.Zero()
}
return e.prototype.addLight = function (e, t, i) {
var r = new o(t.r, t.g, t.b).scale(i);
this.L00 = this.L00.add(r.scale(.282095)), this.L1_1 = this.L1_1.add(r.scale(.488603 * e.y)), this.L10 = this.L10.add(r.scale(.488603 * e.z)), this.L11 = this.L11.add(r.scale(.488603 * e.x)), this.L2_2 = this.L2_2.add(r.scale(1.092548 * e.x * e.y)), this.L2_1 = this.L2_1.add(r.scale(1.092548 * e.y * e.z)), this.L21 = this.L21.add(r.scale(1.092548 * e.x * e.z)), this.L20 = this.L20.add(r.scale(.315392 * (3 * e.z * e.z - 1))), this.L22 = this.L22.add(r.scale(.546274 * (e.x * e.x - e.y * e.y)))
}, e.prototype.scale = function (e) {
this.L00 = this.L00.scale(e), this.L1_1 = this.L1_1.scale(e), this.L10 = this.L10.scale(e), this.L11 = this.L11.scale(e), this.L2_2 = this.L2_2.scale(e), this.L2_1 = this.L2_1.scale(e), this.L20 = this.L20.scale(e), this.L21 = this.L21.scale(e), this.L22 = this.L22.scale(e)
}, e
}();
e.SphericalHarmonics = x;
var w = function () {
function e() {
this.x = o.Zero(), this.y = o.Zero(), this.z = o.Zero(), this.xx = o.Zero(), this.yy = o.Zero(), this.zz = o.Zero(), this.xy = o.Zero(), this.yz = o.Zero(), this.zx = o.Zero()
}
return e.prototype.addAmbient = function (e) {
var t = new o(e.r, e.g, e.b);
this.xx = this.xx.add(t), this.yy = this.yy.add(t), this.zz = this.zz.add(t)
}, e.getSphericalPolynomialFromHarmonics = function (t) {
var i = new e;
return i.x = t.L11.scale(1.02333), i.y = t.L1_1.scale(1.02333), i.z = t.L10.scale(1.02333), i.xx = t.L00.scale(.886277).subtract(t.L20.scale(.247708)).add(t.L22.scale(.429043)), i.yy = t.L00.scale(.886277).subtract(t.L20.scale(.247708)).subtract(t.L22.scale(.429043)), i.zz = t.L00.scale(.886277).add(t.L20.scale(.495417)), i.yz = t.L2_1.scale(.858086), i.zx = t.L21.scale(.858086), i.xy = t.L2_2.scale(.858086), i
}, e
}();
e.SphericalPolynomial = w;
var S = function () {
function e(e, t) {
void 0 === e && (e = o.Zero()), void 0 === t && (t = o.Up()), this.position = e, this.normal = t
}
return e.prototype.clone = function () {
return new e(this.position.clone(), this.normal.clone())
}, e
}();
e.PositionNormalVertex = S;
var T = function () {
function e(e, t, i) {
void 0 === e && (e = o.Zero()), void 0 === t && (t = o.Up()), void 0 === i && (i = n.Zero()), this.position = e, this.normal = t, this.uv = i
}
return e.prototype.clone = function () {
return new e(this.position.clone(), this.normal.clone(), this.uv.clone())
}, e
}();
e.PositionNormalTextureVertex = T;
var A = function () {
function e() {}
return e.Color3 = [i.Black(), i.Black(), i.Black()], e.Vector2 = [n.Zero(), n.Zero(), n.Zero()], e.Vector3 = [o.Zero(), o.Zero(), o.Zero(), o.Zero(), o.Zero(), o.Zero(), o.Zero(), o.Zero(), o.Zero()], e.Vector4 = [s.Zero(), s.Zero(), s.Zero()], e.Quaternion = [new c(0, 0, 0, 0)], e.Matrix = [h.Zero(), h.Zero(), h.Zero(), h.Zero(), h.Zero(), h.Zero(), h.Zero(), h.Zero()], e
}();
e.Tmp = A
}(s || (s = {})),
function (e) {
function t(e, t) {
return function (i, r) {
i.__serializableMembers || (i.__serializableMembers = {}), i.__serializableMembers[r] || (i.__serializableMembers[r] = {
type: e,
sourceName: t
})
}
}
e.serialize = function (e) {
return t(0, e)
}, e.serializeAsTexture = function (e) {
return t(1, e)
}, e.serializeAsColor3 = function (e) {
return t(2, e)
}, e.serializeAsFresnelParameters = function (e) {
return t(3, e)
}, e.serializeAsVector2 = function (e) {
return t(4, e)
}, e.serializeAsVector3 = function (e) {
return t(5, e)
}, e.serializeAsMeshReference = function (e) {
return t(6, e)
}, e.serializeAsColorCurves = function (e) {
return t(7, e)
};
var i = function () {
function t() {}
return t.Serialize = function (t, i) {
for (var r in i || (i = {}), i.tags = e.Tags.GetTags(t), t.__serializableMembers) {
var n = t.__serializableMembers[r],
o = n.sourceName || r,
s = n.type,
a = t[r];
if (null != a) switch (s) {
case 0:
i[o] = a;
break;
case 1:
i[o] = a.serialize();
break;
case 2:
i[o] = a.asArray();
break;
case 3:
i[o] = a.serialize();
break;
case 4:
case 5:
i[o] = a.asArray();
break;
case 6:
i[o] = a.id;
break;
case 7:
i[o] = a.serialize()
}
}
return i
}, t.Parse = function (t, i, r, n) {
var o = t();
for (var s in e.Tags.AddTagsTo(o, i.tags), o.__serializableMembers) {
var a = o.__serializableMembers[s],
c = i[a.sourceName || s],
h = a.type;
if (null != c) switch (h) {
case 0:
o[s] = c;
break;
case 1:
o[s] = e.Texture.Parse(c, r, n);
break;
case 2:
o[s] = e.Color3.FromArray(c);
break;
case 3:
o[s] = e.FresnelParameters.Parse(c);
break;
case 4:
o[s] = e.Vector2.FromArray(c);
break;
case 5:
o[s] = e.Vector3.FromArray(c);
break;
case 6:
o[s] = r.getLastMeshByID(c);
break;
case 7:
o[s] = e.ColorCurves.Parse(c)
}
}
return o
}, t.Clone = function (t, i) {
var r = t();
for (var n in e.Tags.AddTagsTo(r, i.tags), r.__serializableMembers) {
var o = r.__serializableMembers[n],
s = i[n],
a = o.type;
if (null != s) switch (a) {
case 0:
case 6:
r[n] = s;
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 7:
r[n] = s.clone()
}
}
return r
}, t
}();
e.SerializationHelper = i
}(s || (s = {})),
function (e) {
var t = function () {
function e(e, t) {
void 0 === t && (t = !1), this.initalize(e, t)
}
return e.prototype.initalize = function (e, t) {
return void 0 === t && (t = !1), this.mask = e, this.skipNextObservers = t, this
}, e
}();
e.EventState = t;
var i = function () {
return function (e, t) {
this.callback = e, this.mask = t
}
}();
e.Observer = i;
var r = function () {
function e() {
this._observers = new Array, this._eventState = new t(0)
}
return e.prototype.add = function (e, t, r) {
if (void 0 === t && (t = -1), void 0 === r && (r = !1), !e) return null;
var n = new i(e, t);
return r ? this._observers.unshift(n) : this._observers.push(n), n
}, e.prototype.remove = function (e) {
var t = this._observers.indexOf(e);
return -1 !== t && (this._observers.splice(t, 1), !0)
}, e.prototype.removeCallback = function (e) {
for (var t = 0; t < this._observers.length; t++)
if (this._observers[t].callback === e) return this._observers.splice(t, 1), !0;
return !1
}, e.prototype.notifyObservers = function (e, t) {
void 0 === t && (t = -1);
var i = this._eventState;
i.mask = t, i.skipNextObservers = !1;
for (var r = 0, n = this._observers; r < n.length; r++) {
var o = n[r];
if (o.mask & t && o.callback(e, i), i.skipNextObservers) return !1
}
return !0
}, e.prototype.hasObservers = function () {
return this._observers.length > 0
}, e.prototype.clear = function () {
this._observers = new Array
}, e.prototype.clone = function () {
var t = new e;
return t._observers = this._observers.slice(0), t
}, e
}();
e.Observable = r
}(s || (s = {})), r = s || (s = {}), n = function () {
function e(t, i) {
this.idbFactory = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB, this.callbackManifestChecked = i, this.currentSceneUrl = e.ReturnFullUrlLocation(t), this.db = null, this.enableSceneOffline = !1, this.enableTexturesOffline = !1, this.manifestVersionFound = 0, this.mustUpdateRessources = !1, this.hasReachedQuota = !1, e.IDBStorageEnabled ? this.checkManifestFile() : this.callbackManifestChecked(!0)
}
return e.prototype.checkManifestFile = function () {
function e() {
i.enableSceneOffline = !1, i.enableTexturesOffline = !1, i.callbackManifestChecked(!1)
}
var t = this,
i = this,
n = !1,
o = this.currentSceneUrl + ".manifest",
s = new XMLHttpRequest;
navigator.onLine && (n = !0, o = o + (null == o.match(/\?/) ? "?" : "&") + (new Date).getTime()), s.open("GET", o, !0), s.addEventListener("load", function () {
if (200 === s.status || r.Tools.ValidateXHRData(s, 1)) try {
var i = JSON.parse(s.response);
t.enableSceneOffline = i.enableSceneOffline, t.enableTexturesOffline = i.enableTexturesOffline, i.version && !isNaN(parseInt(i.version)) && (t.manifestVersionFound = i.version), t.callbackManifestChecked && t.callbackManifestChecked(!0)
} catch (t) {
e()
} else e()
}, !1), s.addEventListener("error", function (i) {
if (n) {
n = !1;
var r = t.currentSceneUrl + ".manifest";
s.open("GET", r, !0), s.send()
} else e()
}, !1);
try {
s.send()
} catch (e) {
r.Tools.Error("Error on XHR send request."), i.callbackManifestChecked(!1)
}
}, e.prototype.openAsync = function (e, t) {
function i() {
o.isSupported = !1, t && t()
}
var n = this,
o = this;
if (this.idbFactory && (this.enableSceneOffline || this.enableTexturesOffline))
if (this.db) e && e();
else {
this.hasReachedQuota = !1, this.isSupported = !0;
var s = this.idbFactory.open("babylonjs", 1);
s.onerror = function (e) {
i()
}, s.onblocked = function (e) {
r.Tools.Error("IDB request blocked. Please reload the page."), i()
}, s.onsuccess = function (t) {
n.db = s.result, e()
}, s.onupgradeneeded = function (e) {
n.db = e.target.result;
try {
n.db.createObjectStore("scenes", {
keyPath: "sceneUrl"
}), n.db.createObjectStore("versions", {
keyPath: "sceneUrl"
}), n.db.createObjectStore("textures", {
keyPath: "textureUrl"
})
} catch (e) {
r.Tools.Error("Error while creating object stores. Exception: " + e.message), i()
}
}
}
else this.isSupported = !1, t && t()
}, e.prototype.loadImageFromDB = function (t, i) {
var r = this,
n = e.ReturnFullUrlLocation(t),
o = function () {
r.hasReachedQuota || null === r.db ? i.src = t : r._saveImageIntoDBAsync(n, i)
};
this.mustUpdateRessources ? o() : this._loadImageFromDBAsync(n, i, o)
}, e.prototype._loadImageFromDBAsync = function (e, t, i) {
if (this.isSupported && null !== this.db) {
var n, o = this.db.transaction(["textures"]);
o.onabort = function (i) {
t.src = e
}, o.oncomplete = function (o) {
var s;
if (n) {
var a = window.URL || window.webkitURL;
s = a.createObjectURL(n.data, {
oneTimeOnly: !0
}), t.onerror = function () {
r.Tools.Error("Error loading image from blob URL: " + s + " switching back to web url: " + e), t.src = e
}, t.src = s
} else i()
};
var s = o.objectStore("textures").get(e);
s.onsuccess = function (e) {
n = e.target.result
}, s.onerror = function (i) {
r.Tools.Error("Error loading texture " + e + " from DB."), t.src = e
}
} else r.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), t.src = e
}, e.prototype._saveImageIntoDBAsync = function (t, i) {
var n = this;
if (this.isSupported) {
var o = function () {
var e;
if (s) {
var t = window.URL || window.webkitURL;
try {
e = t.createObjectURL(s, {
oneTimeOnly: !0
})
} catch (i) {
e = t.createObjectURL(s)
}
}
i.src = e
};
if (e.IsUASupportingBlobStorage) {
var s, a = new XMLHttpRequest;
a.open("GET", t, !0), a.responseType = "blob", a.addEventListener("load", function () {
if (200 === a.status) {
s = a.response;
var r = n.db.transaction(["textures"], "readwrite");
r.onabort = function (e) {
try {
e.srcElement.error && "QuotaExceededError" === e.srcElement.error.name && (n.hasReachedQuota = !0)
} catch (e) {}
o()
}, r.oncomplete = function (e) {
o()
};
var c = {
textureUrl: t,
data: s
};
try {
var h = r.objectStore("textures").put(c);
h.onsuccess = function (e) {}, h.onerror = function (e) {
o()
}
} catch (r) {
25 === r.code && (e.IsUASupportingBlobStorage = !1), i.src = t
}
} else i.src = t
}, !1), a.addEventListener("error", function (e) {
r.Tools.Error("Error in XHR request in BABYLON.Database."), i.src = t
}, !1), a.send()
} else i.src = t
} else r.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), i.src = t
}, e.prototype._checkVersionFromDB = function (e, t) {
var i = this;
this._loadVersionFromDBAsync(e, t, function (r) {
i._saveVersionIntoDBAsync(e, t)
})
}, e.prototype._loadVersionFromDBAsync = function (e, t, i) {
var n, o = this;
if (this.isSupported) try {
var s = this.db.transaction(["versions"]);
s.oncomplete = function (e) {
n ? o.manifestVersionFound > n.data ? (o.mustUpdateRessources = !0, i()) : t(n.data) : (o.mustUpdateRessources = !0, i())
}, s.onabort = function (e) {
t(-1)
};
var a = s.objectStore("versions").get(e);
a.onsuccess = function (e) {
n = e.target.result
}, a.onerror = function (i) {
r.Tools.Error("Error loading version for scene " + e + " from DB."), t(-1)
}
} catch (e) {
r.Tools.Error("Error while accessing 'versions' object store (READ OP). Exception: " + e.message), t(-1)
} else r.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), t(-1)
}, e.prototype._saveVersionIntoDBAsync = function (e, t) {
var i = this;
if (this.isSupported && !this.hasReachedQuota) try {
var n = this.db.transaction(["versions"], "readwrite");
n.onabort = function (e) {
try {
e.srcElement.error && "QuotaExceededError" === e.srcElement.error.name && (i.hasReachedQuota = !0)
} catch (e) {}
t(-1)
}, n.oncomplete = function (e) {
t(i.manifestVersionFound)
};
var o = {
sceneUrl: e,
data: this.manifestVersionFound
},
s = n.objectStore("versions").put(o);
s.onsuccess = function (e) {}, s.onerror = function (e) {
r.Tools.Error("Error in DB add version request in BABYLON.Database.")
}
} catch (e) {
r.Tools.Error("Error while accessing 'versions' object store (WRITE OP). Exception: " + e.message), t(-1)
} else t(-1)
}, e.prototype.loadFileFromDB = function (t, i, r, n, o) {
var s = this,
a = e.ReturnFullUrlLocation(t),
c = function (e) {
s._saveFileIntoDBAsync(a, i, r)
};
this._checkVersionFromDB(a, function (e) {
-1 !== e ? s.mustUpdateRessources ? s._saveFileIntoDBAsync(a, i, r, o) : s._loadFileFromDBAsync(a, i, c, o) : n()
})
}, e.prototype._loadFileFromDBAsync = function (e, t, i, n) {
if (this.isSupported) {
var o;
o = -1 !== e.indexOf(".babylon") ? "scenes" : "textures";
var s, a = this.db.transaction([o]);
a.oncomplete = function (e) {
s ? t(s.data) : i()
}, a.onabort = function (e) {
i()
};
var c = a.objectStore(o).get(e);
c.onsuccess = function (e) {
s = e.target.result
}, c.onerror = function (t) {
r.Tools.Error("Error loading file " + e + " from DB."), i()
}
} else r.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), t()
}, e.prototype._saveFileIntoDBAsync = function (e, t, i, n) {
var o = this;
if (this.isSupported) {
var s;
s = -1 !== e.indexOf(".babylon") ? "scenes" : "textures";
var a, c = new XMLHttpRequest;
c.open("GET", e, !0), n && (c.responseType = "arraybuffer"), c.onprogress = i, c.addEventListener("load", function () {
if (200 === c.status || r.Tools.ValidateXHRData(c, n ? 6 : 1))
if (a = n ? c.response : c.responseText, o.hasReachedQuota) t(a);
else {
var i, h = o.db.transaction([s], "readwrite");
h.onabort = function (e) {
try {
e.srcElement.error && "QuotaExceededError" === e.srcElement.error.name && (o.hasReachedQuota = !0)
} catch (e) {}
t(a)
}, h.oncomplete = function (e) {
t(a)
}, i = "scenes" === s ? {
sceneUrl: e,
data: a,
version: o.manifestVersionFound
} : {
textureUrl: e,
data: a
};
try {
var u = h.objectStore(s).put(i);
u.onsuccess = function (e) {}, u.onerror = function (e) {
r.Tools.Error("Error in DB add file request in BABYLON.Database.")
}
} catch (e) {
t(a)
}
}
else t()
}, !1), c.addEventListener("error", function (e) {
r.Tools.Error("error on XHR request."), t()
}, !1), c.send()
} else r.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."), t()
}, e.IsUASupportingBlobStorage = !0, e.IDBStorageEnabled = !0, e.parseURL = function (e) {
document.createElement("a").href = e;
var t = e.substring(0, e.lastIndexOf("#")),
i = e.substring(t.lastIndexOf("/") + 1, e.length);
return e.substring(0, e.indexOf(i, 0))
}, e.ReturnFullUrlLocation = function (t) {
return -1 === t.indexOf("http:/") ? e.parseURL(window.location.href) + t : t
}, e
}(), r.Database = n,
function (e) {
! function (t) {
var i = function () {
function t() {}
return t.GetTGAHeader = function (e) {
var t = 0;
return {
id_length: e[t++],
colormap_type: e[t++],
image_type: e[t++],
colormap_index: e[t++] | e[t++] << 8,
colormap_length: e[t++] | e[t++] << 8,
colormap_size: e[t++],
origin: [e[t++] | e[t++] << 8, e[t++] | e[t++] << 8],
width: e[t++] | e[t++] << 8,
height: e[t++] | e[t++] << 8,
pixel_size: e[t++],
flags: e[t++]
}
}, t.UploadContent = function (i, r) {
if (r.length < 19) e.Tools.Error("Unable to load TGA file - Not enough data to contain header");
else {
var n = 18,
o = t.GetTGAHeader(r);
if (o.id_length + n > r.length) e.Tools.Error("Unable to load TGA file - Not enough data");
else {
n += o.id_length;
var s = !1,
a = !1,
c = !1;
switch (o.image_type) {
case t._TYPE_RLE_INDEXED:
s = !0;
case t._TYPE_INDEXED:
a = !0;
break;
case t._TYPE_RLE_RGB:
s = !0;
case t._TYPE_RGB:
!0;
break;
case t._TYPE_RLE_GREY:
s = !0;
case t._TYPE_GREY:
c = !0
}
var h, u, l, f, d, p, m, g, _ = (o.flags, o.pixel_size >> 3),
v = o.width * o.height * _;
if (a && (u = r.subarray(n, n += o.colormap_length * (o.colormap_size >> 3))), s) {
h = new Uint8Array(v);
for (var y, b, x, w = 0, S = new Uint8Array(_); n < v && w < v;)
if (b = 1 + (127 & (y = r[n++])), 128 & y) {
for (x = 0; x < _; ++x) S[x] = r[n++];
for (x = 0; x < b; ++x) h.set(S, w + x * _);
w += _ * b
} else {
for (b *= _, x = 0; x < b; ++x) h[w + x] = r[n++];
w += b
}
} else h = r.subarray(n, n += a ? o.width * o.height : v);
switch ((o.flags & t._ORIGIN_MASK) >> t._ORIGIN_SHIFT) {
default:
case t._ORIGIN_UL:
l = 0, d = 1, g = o.width, f = 0, p = 1, m = o.height;
break;
case t._ORIGIN_BL:
l = 0, d = 1, g = o.width, f = o.height - 1, p = -1, m = -1;
break;
case t._ORIGIN_UR:
l = o.width - 1, d = -1, g = -1, f = 0, p = 1, m = o.height;
break;
case t._ORIGIN_BR:
l = o.width - 1, d = -1, g = -1, f = o.height - 1, p = -1, m = -1
}
var T = t["_getImageData" + (c ? "Grey" : "") + o.pixel_size + "bits"](o, u, h, f, p, m, l, d, g);
i.texImage2D(i.TEXTURE_2D, 0, i.RGBA, o.width, o.height, 0, i.RGBA, i.UNSIGNED_BYTE, T)
}
}
}, t._getImageData8bits = function (e, t, i, r, n, o, s, a, c) {
var h, u, l, f = i,
d = t,
p = e.width,
m = e.height,
g = 0,
_ = new Uint8Array(p * m * 4);
for (l = r; l !== o; l += n)
for (u = s; u !== c; u += a, g++) h = f[g], _[4 * (u + p * l) + 3] = 255, _[4 * (u + p * l) + 2] = d[3 * h + 0], _[4 * (u + p * l) + 1] = d[3 * h + 1], _[4 * (u + p * l) + 0] = d[3 * h + 2];
return _
}, t._getImageData16bits = function (e, t, i, r, n, o, s, a, c) {
var h, u, l, f = i,
d = e.width,
p = e.height,
m = 0,
g = new Uint8Array(d * p * 4);
for (l = r; l !== o; l += n)
for (u = s; u !== c; u += a, m += 2) h = f[m + 0] + (f[m + 1] << 8), g[4 * (u + d * l) + 0] = (31744 & h) >> 7, g[4 * (u + d * l) + 1] = (992 & h) >> 2, g[4 * (u + d * l) + 2] = (31 & h) >> 3, g[4 * (u + d * l) + 3] = 32768 & h ? 0 : 255;
return g
}, t._getImageData24bits = function (e, t, i, r, n, o, s, a, c) {
var h, u, l = i,
f = e.width,
d = e.height,
p = 0,
m = new Uint8Array(f * d * 4);
for (u = r; u !== o; u += n)
for (h = s; h !== c; h += a, p += 3) m[4 * (h + f * u) + 3] = 255, m[4 * (h + f * u) + 2] = l[p + 0], m[4 * (h + f * u) + 1] = l[p + 1], m[4 * (h + f * u) + 0] = l[p + 2];
return m
}, t._getImageData32bits = function (e, t, i, r, n, o, s, a, c) {
var h, u, l = i,
f = e.width,
d = e.height,
p = 0,
m = new Uint8Array(f * d * 4);
for (u = r; u !== o; u += n)
for (h = s; h !== c; h += a, p += 4) m[4 * (h + f * u) + 2] = l[p + 0], m[4 * (h + f * u) + 1] = l[p + 1], m[4 * (h + f * u) + 0] = l[p + 2], m[4 * (h + f * u) + 3] = l[p + 3];
return m
}, t._getImageDataGrey8bits = function (e, t, i, r, n, o, s, a, c) {
var h, u, l, f = i,
d = e.width,
p = e.height,
m = 0,
g = new Uint8Array(d * p * 4);
for (l = r; l !== o; l += n)
for (u = s; u !== c; u += a, m++) h = f[m], g[4 * (u + d * l) + 0] = h, g[4 * (u + d * l) + 1] = h, g[4 * (u + d * l) + 2] = h, g[4 * (u + d * l) + 3] = 255;
return g
}, t._getImageDataGrey16bits = function (e, t, i, r, n, o, s, a, c) {
var h, u, l = i,
f = e.width,
d = e.height,
p = 0,
m = new Uint8Array(f * d * 4);
for (u = r; u !== o; u += n)
for (h = s; h !== c; h += a, p += 2) m[4 * (h + f * u) + 0] = l[p + 0], m[4 * (h + f * u) + 1] = l[p + 0], m[4 * (h + f * u) + 2] = l[p + 0], m[4 * (h + f * u) + 3] = l[p + 1];
return m
}, t._TYPE_NO_DATA = 0, t._TYPE_INDEXED = 1, t._TYPE_RGB = 2, t._TYPE_GREY = 3, t._TYPE_RLE_INDEXED = 9, t._TYPE_RLE_RGB = 10, t._TYPE_RLE_GREY = 11, t._ORIGIN_MASK = 48, t._ORIGIN_SHIFT = 4, t._ORIGIN_BL = 0, t._ORIGIN_BR = 1, t._ORIGIN_UL = 2, t._ORIGIN_UR = 3, t
}();
t.TGATools = i
}(e.Internals || (e.Internals = {}))
}(s || (s = {})),
function (e) {
var t = function () {
function e(t) {
this.length = 0, this._duplicateId = 0, this.data = new Array(t), this._id = e._GlobalId++
}
return e.prototype.push = function (e) {
this.data[this.length++] = e, this.length > this.data.length && (this.data.length *= 2), e.__smartArrayFlags || (e.__smartArrayFlags = {}), e.__smartArrayFlags[this._id] = this._duplicateId
}, e.prototype.pushNoDuplicate = function (e) {
return !(e.__smartArrayFlags && e.__smartArrayFlags[this._id] === this._duplicateId || (this.push(e), 0))
}, e.prototype.sort = function (e) {
this.data.sort(e)
}, e.prototype.reset = function () {
this.length = 0, this._duplicateId++
}, e.prototype.concat = function (e) {
if (0 !== e.length) {
this.length + e.length > this.data.length && (this.data.length = 2 * (this.length + e.length));
for (var t = 0; t < e.length; t++) this.data[this.length++] = (e.data || e)[t]
}
}, e.prototype.concatWithNoDuplicate = function (e) {
if (0 !== e.length) {
this.length + e.length > this.data.length && (this.data.length = 2 * (this.length + e.length));
for (var t = 0; t < e.length; t++) {
var i = (e.data || e)[t];
this.pushNoDuplicate(i)
}
}
}, e.prototype.indexOf = function (e) {
var t = this.data.indexOf(e);
return t >= this.length ? -1 : t
}, e._GlobalId = 0, e
}();
e.SmartArray = t
}(s || (s = {})),
function (e) {
var t = function () {
function e() {
this._count = 0, this._data = {}
}
return e.prototype.copyFrom = function (e) {
var t = this;
this.clear(), e.forEach(function (e, i) {
return t.add(e, i)
})
}, e.prototype.get = function (e) {
var t = this._data[e];
if (void 0 !== t) return t
}, e.prototype.getOrAddWithFactory = function (e, t) {
var i = this.get(e);
return void 0 !== i ? i : ((i = t(e)) && this.add(e, i), i)
}, e.prototype.getOrAdd = function (e, t) {
var i = this.get(e);
return void 0 !== i ? i : (this.add(e, t), t)
}, e.prototype.contains = function (e) {
return void 0 !== this._data[e]
}, e.prototype.add = function (e, t) {
return void 0 === this._data[e] && (this._data[e] = t, ++this._count, !0)
}, e.prototype.set = function (e, t) {
return void 0 !== this._data[e] && (this._data[e] = t, !0)
}, e.prototype.getAndRemove = function (e) {
var t = this.get(e);
return void 0 !== t ? (delete this._data[e], --this._count, t) : null
}, e.prototype.remove = function (e) {
return !!this.contains(e) && (delete this._data[e], --this._count, !0)
}, e.prototype.clear = function () {
this._data = {}, this._count = 0
}, Object.defineProperty(e.prototype, "count", {
get: function () {
return this._count
},
enumerable: !0,
configurable: !0
}), e.prototype.forEach = function (e) {
for (var t in this._data) {
e(t, this._data[t])
}
}, e.prototype.first = function (e) {
for (var t in this._data) {
var i = e(t, this._data[t]);
if (i) return i
}
return null
}, e
}();
e.StringDictionary = t
}(s || (s = {})),
function (e) {
var t, r = function (t, i) {
return t ? t instanceof e.Mesh ? null : t instanceof e.SubMesh ? t.clone(i) : t.clone ? t.clone() : null : null
},
n = function () {
function n() {}
return n.Instantiate = function (e) {
for (var t = e.split("."), i = window || this, r = 0, n = t.length; r < n; r++) i = i[t[r]];
return "function" != typeof i ? null : i
}, n.SetImmediate = function (e) {
window.setImmediate ? window.setImmediate(e) : setTimeout(e, 1)
}, n.IsExponentOfTwo = function (e) {
var t = 1;
do {
t *= 2
} while (t < e);
return t === e
}, n.GetExponentOfTwo = function (e, t) {
var i = 1;
do {
i *= 2
} while (i < e);
return i > t && (i = t), i
}, n.GetFilename = function (e) {
var t = e.lastIndexOf("/");
return t < 0 ? e : e.substring(t + 1)
}, n.GetDOMTextContent = function (e) {
for (var t = "", i = e.firstChild; i;) 3 === i.nodeType && (t += i.textContent), i = i.nextSibling;
return t
}, n.ToDegrees = function (e) {
return 180 * e / Math.PI
}, n.ToRadians = function (e) {
return e * Math.PI / 180
}, n.EncodeArrayBufferTobase64 = function (e) {
for (var t, i, r, n, o, s, a, c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", h = "", u = 0, l = new Uint8Array(e); u < l.length;) n = (t = l[u++]) >> 2, o = (3 & t) << 4 | (i = u < l.length ? l[u++] : Number.NaN) >> 4, s = (15 & i) << 2 | (r = u < l.length ? l[u++] : Number.NaN) >> 6, a = 63 & r, isNaN(i) ? s = a = 64 : isNaN(r) && (a = 64), h += c.charAt(n) + c.charAt(o) + c.charAt(s) + c.charAt(a);
return "data:image/png;base64," + h
}, n.ExtractMinAndMaxIndexed = function (t, i, r, n, o) {
void 0 === o && (o = null);
for (var s = new e.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE), a = new e.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), c = r; c < r + n; c++) {
var h = new e.Vector3(t[3 * i[c]], t[3 * i[c] + 1], t[3 * i[c] + 2]);
s = e.Vector3.Minimize(h, s), a = e.Vector3.Maximize(h, a)
}
return o && (s.x -= s.x * o.x + o.y, s.y -= s.y * o.x + o.y, s.z -= s.z * o.x + o.y, a.x += a.x * o.x + o.y, a.y += a.y * o.x + o.y, a.z += a.z * o.x + o.y), {
minimum: s,
maximum: a
}
}, n.ExtractMinAndMax = function (t, i, r, n, o) {
void 0 === n && (n = null);
var s = new e.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE),
a = new e.Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
o || (o = 3);
for (var c = i; c < i + r; c++) {
var h = new e.Vector3(t[c * o], t[c * o + 1], t[c * o + 2]);
s = e.Vector3.Minimize(h, s), a = e.Vector3.Maximize(h, a)
}
return n && (s.x -= s.x * n.x + n.y, s.y -= s.y * n.x + n.y, s.z -= s.z * n.x + n.y, a.x += a.x * n.x + n.y, a.y += a.y * n.x + n.y, a.z += a.z * n.x + n.y), {
minimum: s,
maximum: a
}
}, n.Vector2ArrayFeeder = function (t) {
return function (i) {
var r = void 0 !== t.BYTES_PER_ELEMENT;
if (i >= (r ? t.length / 2 : t.length)) return null;
if (r) {
var n = t;
return new e.Vector2(n[2 * i + 0], n[2 * i + 1])
}
return t[i]
}
}, n.ExtractMinAndMaxVector2 = function (t, i) {
void 0 === i && (i = null);
for (var r = new e.Vector2(Number.MAX_VALUE, Number.MAX_VALUE), n = new e.Vector2(-Number.MAX_VALUE, -Number.MAX_VALUE), o = 0, s = t(o++); s;) r = e.Vector2.Minimize(s, r), n = e.Vector2.Maximize(s, n), s = t(o++);
return i && (r.x -= r.x * i.x + i.y, r.y -= r.y * i.x + i.y, n.x += n.x * i.x + i.y, n.y += n.y * i.x + i.y), {
minimum: r,
maximum: n
}
}, n.MakeArray = function (e, t) {
if (!0 === t || void 0 !== e && null != e) return Array.isArray(e) ? e : [e]
}, n.GetPointerPrefix = function () {
var e = "pointer";
return window.PointerEvent || navigator.pointerEnabled || (e = "mouse"), e
}, n.QueueNewFrame = function (e, t) {
void 0 === t && (t = window), t.requestAnimationFrame ? t.requestAnimationFrame(e) : t.msRequestAnimationFrame ? t.msRequestAnimationFrame(e) : t.webkitRequestAnimationFrame ? t.webkitRequestAnimationFrame(e) : t.mozRequestAnimationFrame ? t.mozRequestAnimationFrame(e) : t.oRequestAnimationFrame ? t.oRequestAnimationFrame(e) : window.setTimeout(e, 16)
}, n.RequestFullscreen = function (e) {
var t = e.requestFullscreen || e.msRequestFullscreen || e.webkitRequestFullscreen || e.mozRequestFullScreen;
t && t.call(e)
}, n.ExitFullscreen = function () {
document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.msCancelFullScreen && document.msCancelFullScreen()
}, n.SetCorsBehavior = function (e, t) {
if (n.CorsBehavior) switch (i(n.CorsBehavior)) {
case "function":
var r = n.CorsBehavior(e);
if (r) return r;
break;
case "string":
default:
t.crossOrigin = n.CorsBehavior
}
}, n.CleanUrl = function (e) {
return e.replace(/#/gm, "%23")
}, n.LoadImage = function (t, i, r, o) {
t instanceof ArrayBuffer && (t = n.EncodeArrayBufferTobase64(t)), t = n.CleanUrl(t);
var s = new Image;
"data:" !== t.substr(0, 5) && n.SetCorsBehavior(t, s), s.onload = function () {
i(s)
}, s.onerror = function (e) {
n.Error("Error while trying to load texture: " + t), n.UseFallbackTexture ? (s.src = "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z", i(s)) : r()
};
var a = function () {
s.src = t
};
if ("data:" !== t.substr(0, 5) && o && o.enableTexturesOffline && e.Database.IsUASupportingBlobStorage) o.openAsync(function () {
o.loadImageFromDB(t, s)
}, a);
else if (-1 === t.indexOf("file:")) a();
else try {
var c, h = t.substring(5).toLowerCase();
try {
c = URL.createObjectURL(e.FilesInput.FilesTextures[h], {
oneTimeOnly: !0
})
} catch (t) {
c = URL.createObjectURL(e.FilesInput.FilesTextures[h])
}
s.src = c
} catch (e) {
s.src = null
}
return s
}, n.LoadFile = function (t, i, r, o, s, a) {
t = n.CleanUrl(t);
var c = function () {
var e = new XMLHttpRequest,
o = n.BaseUrl + t;
e.open("GET", o, !0), s && (e.responseType = "arraybuffer"), e.onprogress = r, e.onreadystatechange = function () {
if (4 === e.readyState)
if (e.onreadystatechange = null, e.status >= 200 && e.status < 300 || navigator.isCocoonJS && 0 === e.status) i(s ? e.response : e.responseText);
else {
if (!a) throw new Error("Error status: " + e.status + " - Unable to load " + o);
a()
}
}, e.send(null)
};
if (-1 !== t.indexOf("file:")) {
var h = t.substring(5).toLowerCase();
n.ReadFile(e.FilesInput.FilesToLoad[h], i, r, s)
} else o && o.enableSceneOffline ? o.openAsync(function () {
o.loadFileFromDB(t, i, r, c, s)
}, c) : c()
}, n.ReadFileAsDataURL = function (e, t, i) {
var r = new FileReader;
r.onload = function (e) {
t(e.target.result)
}, r.onprogress = i, r.readAsDataURL(e)
}, n.ReadFile = function (e, t, i, r) {
var o = new FileReader;
o.onerror = function (i) {
n.Log("Error while reading file: " + e.name), t(JSON.stringify({
autoClear: !0,
clearColor: [1, 0, 0],
ambientColor: [0, 0, 0],
gravity: [0, -9.807, 0],
meshes: [],
cameras: [],
lights: []
}))
}, o.onload = function (e) {
t(e.target.result)
}, o.onprogress = i, r ? o.readAsArrayBuffer(e) : o.readAsText(e)
}, n.FileAsURL = function (e) {
var t = new Blob([e]);
return (window.URL || window.webkitURL).createObjectURL(t)
}, n.Format = function (e, t) {
return void 0 === t && (t = 2), e.toFixed(t)
}, n.CheckExtends = function (e, t, i) {
e.x < t.x && (t.x = e.x), e.y < t.y && (t.y = e.y), e.z < t.z && (t.z = e.z), e.x > i.x && (i.x = e.x), e.y > i.y && (i.y = e.y), e.z > i.z && (i.z = e.z)
}, n.DeepCopy = function (e, t, n, o) {
for (var s in e)
if (("_" !== s[0] || o && -1 !== o.indexOf(s)) && (!n || -1 === n.indexOf(s))) {
var a = e[s],
c = i(a);
if ("function" !== c)
if ("object" === c)
if (a instanceof Array) {
if (t[s] = [], a.length > 0)
if ("object" == i(a[0]))
for (var h = 0; h < a.length; h++) {
var u = r(a[h], t); - 1 === t[s].indexOf(u) && t[s].push(u)
} else t[s] = a.slice(0)
} else t[s] = r(a, t);
else t[s] = a
}
}, n.IsEmpty = function (e) {
for (var t in e) return !1;
return !0
}, n.RegisterTopRootEvents = function (e) {
for (var t = 0; t < e.length; t++) {
var i = e[t];
window.addEventListener(i.name, i.handler, !1);
try {
window.parent && window.parent.addEventListener(i.name, i.handler, !1)
} catch (e) {}
}
}, n.UnregisterTopRootEvents = function (e) {
for (var t = 0; t < e.length; t++) {
var i = e[t];
window.removeEventListener(i.name, i.handler);
try {
window.parent && window.parent.removeEventListener(i.name, i.handler)
} catch (e) {}
}
}, n.DumpFramebuffer = function (e, i, r, o, s) {
void 0 === s && (s = "image/png");
for (var a = 4 * e, c = i / 2, h = r.readPixels(0, 0, e, i), u = 0; u < c; u++)
for (var l = 0; l < a; l++) {
var f = l + u * a,
d = l + (i - u - 1) * a,
p = h[f];
h[f] = h[d], h[d] = p
}
t || (t = document.createElement("canvas")), t.width = e, t.height = i;
var m = t.getContext("2d"),
g = m.createImageData(e, i);
g.data.set(h), m.putImageData(g, 0, 0), n.EncodeScreenshotCanvasData(o, s)
}, n.EncodeScreenshotCanvasData = function (e, i) {
void 0 === i && (i = "image/png");
var r = t.toDataURL(i);
if (e) e(r);
else if ("download" in document.createElement("a")) {
var n = window.document.createElement("a");
n.href = r;
var o = new Date,
s = (o.getFullYear() + "-" + (o.getMonth() + 1)).slice(-2) + "-" + o.getDate() + "_" + o.getHours() + "-" + ("0" + o.getMinutes()).slice(-2);
n.setAttribute("download", "screenshot_" + s + ".png"), window.document.body.appendChild(n), n.addEventListener("click", function () {
n.parentElement.removeChild(n)
}), n.click()
} else {
var a = window.open(""),
c = a.document.createElement("img");
c.src = r, a.document.body.appendChild(c)
}
}, n.CreateScreenshot = function (e, i, r, o, s) {
var a, c;
if (void 0 === s && (s = "image/png"), r.precision) a = Math.round(e.getRenderWidth() * r.precision), c = Math.round(a / e.getAspectRatio(i));
else if (r.width && r.height) a = r.width, c = r.height;
else if (r.width && !r.height) a = r.width, c = Math.round(a / e.getAspectRatio(i));
else if (r.height && !r.width) c = r.height, a = Math.round(c * e.getAspectRatio(i));
else {
if (isNaN(r)) return void n.Error("Invalid 'size' parameter !");
c = r, a = r
}
t || (t = document.createElement("canvas")), t.width = a, t.height = c, t.getContext("2d").drawImage(e.getRenderingCanvas(), 0, 0, a, c), n.EncodeScreenshotCanvasData(o, s)
}, n.CreateScreenshotUsingRenderTarget = function (t, i, r, o, s) {
var a, c;
if (void 0 === s && (s = "image/png"), r.precision) a = Math.round(t.getRenderWidth() * r.precision), c = Math.round(a / t.getAspectRatio(i)), r = {
width: a,
height: c
};
else if (r.width && r.height) a = r.width, c = r.height;
else if (r.width && !r.height) a = r.width, c = Math.round(a / t.getAspectRatio(i)), r = {
width: a,
height: c
};
else if (r.height && !r.width) c = r.height, r = {
width: a = Math.round(c * t.getAspectRatio(i)),
height: c
};
else {
if (isNaN(r)) return void n.Error("Invalid 'size' parameter !");
c = r, a = r
}
var h = i.getScene(),
u = null;
h.activeCamera !== i && (u = h.activeCamera, h.activeCamera = i);
var l = new e.RenderTargetTexture("screenShot", r, h, !1, !1);
l.renderList = h.meshes, l.onAfterRenderObservable.add(function () {
n.DumpFramebuffer(a, c, t, o, s)
}), h.incrementRenderId(), h.resetCachedMaterial(), l.render(!0), l.dispose(), u && (h.activeCamera = u), i.getProjectionMatrix(!0)
}, n.ValidateXHRData = function (t, i) {
void 0 === i && (i = 7);
try {
if (1 & i) {
if (t.responseText && t.responseText.length > 0) return !0;
if (1 === i) return !1
}
if (2 & i) {
var r = e.Internals.TGATools.GetTGAHeader(t.response);
if (r.width && r.height && r.width > 0 && r.height > 0) return !0;
if (2 === i) return !1
}
if (4 & i) {
var n = new Uint8Array(t.response, 0, 3);
return 68 === n[0] && 68 === n[1] && 83 === n[2]
}
} catch (e) {}
return !1
}, n.RandomId = function () {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (e) {
var t = 16 * Math.random() | 0;
return ("x" === e ? t : 3 & t | 8).toString(16)
})
}, Object.defineProperty(n, "NoneLogLevel", {
get: function () {
return n._NoneLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "MessageLogLevel", {
get: function () {
return n._MessageLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "WarningLogLevel", {
get: function () {
return n._WarningLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "ErrorLogLevel", {
get: function () {
return n._ErrorLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "AllLogLevel", {
get: function () {
return n._MessageLogLevel | n._WarningLogLevel | n._ErrorLogLevel
},
enumerable: !0,
configurable: !0
}), n._AddLogEntry = function (e) {
n._LogCache = e + n._LogCache, n.OnNewCacheEntry && n.OnNewCacheEntry(e)
}, n._FormatMessage = function (e) {
var t = function (e) {
return e < 10 ? "0" + e : "" + e
},
i = new Date;
return "[" + t(i.getHours()) + ":" + t(i.getMinutes()) + ":" + t(i.getSeconds()) + "]: " + e
}, n._LogDisabled = function (e) {}, n._LogEnabled = function (e) {
var t = n._FormatMessage(e);
console.log("BJS - " + t);
var i = "<div style='color:white'>" + t + "</div><br>";
n._AddLogEntry(i)
}, n._WarnDisabled = function (e) {}, n._WarnEnabled = function (e) {
var t = n._FormatMessage(e);
console.warn("BJS - " + t);
var i = "<div style='color:orange'>" + t + "</div><br>";
n._AddLogEntry(i)
}, n._ErrorDisabled = function (e) {}, n._ErrorEnabled = function (e) {
n.errorsCount++;
var t = n._FormatMessage(e);
console.error("BJS - " + t);
var i = "<div style='color:red'>" + t + "</div><br>";
n._AddLogEntry(i)
}, Object.defineProperty(n, "LogCache", {
get: function () {
return n._LogCache
},
enumerable: !0,
configurable: !0
}), n.ClearLogCache = function () {
n._LogCache = "", n.errorsCount = 0
}, Object.defineProperty(n, "LogLevels", {
set: function (e) {
(e & n.MessageLogLevel) === n.MessageLogLevel ? n.Log = n._LogEnabled : n.Log = n._LogDisabled, (e & n.WarningLogLevel) === n.WarningLogLevel ? n.Warn = n._WarnEnabled : n.Warn = n._WarnDisabled, (e & n.ErrorLogLevel) === n.ErrorLogLevel ? n.Error = n._ErrorEnabled : n.Error = n._ErrorDisabled
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "PerformanceNoneLogLevel", {
get: function () {
return n._PerformanceNoneLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "PerformanceUserMarkLogLevel", {
get: function () {
return n._PerformanceUserMarkLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "PerformanceConsoleLogLevel", {
get: function () {
return n._PerformanceConsoleLogLevel
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(n, "PerformanceLogLevel", {
set: function (e) {
return (e & n.PerformanceUserMarkLogLevel) === n.PerformanceUserMarkLogLevel ? (n.StartPerformanceCounter = n._StartUserMark, void(n.EndPerformanceCounter = n._EndUserMark)) : (e & n.PerformanceConsoleLogLevel) === n.PerformanceConsoleLogLevel ? (n.StartPerformanceCounter = n._StartPerformanceConsole, void(n.EndPerformanceCounter = n._EndPerformanceConsole)) : (n.StartPerformanceCounter = n._StartPerformanceCounterDisabled, void(n.EndPerformanceCounter = n._EndPerformanceCounterDisabled))
},
enumerable: !0,
configurable: !0
}), n._StartPerformanceCounterDisabled = function (e, t) {}, n._EndPerformanceCounterDisabled = function (e, t) {}, n._StartUserMark = function (e, t) {
void 0 === t && (t = !0), t && n._performance.mark && n._performance.mark(e + "-Begin")
}, n._EndUserMark = function (e, t) {
void 0 === t && (t = !0), t && n._performance.mark && (n._performance.mark(e + "-End"), n._performance.measure(e, e + "-Begin", e + "-End"))
}, n._StartPerformanceConsole = function (e, t) {
void 0 === t && (t = !0), t && (n._StartUserMark(e, t), console.time && console.time(e))
}, n._EndPerformanceConsole = function (e, t) {
void 0 === t && (t = !0), t && (n._EndUserMark(e, t), console.time && console.timeEnd(e))
}, Object.defineProperty(n, "Now", {
get: function () {
return window.performance && window.performance.now ? window.performance.now() : (new Date).getTime()
},
enumerable: !0,
configurable: !0
}), n.getClassName = function (e, t) {
void 0 === t && (t = !1);
var r = null;
if (!t && e.getClassName) r = e.getClassName();
else {
if (e instanceof Object) r = (t ? e : Object.getPrototypeOf(e)).constructor.__bjsclassName__;
r || (r = i(e))
}
return r
}, n.first = function (e, t) {
for (var i = 0, r = e; i < r.length; i++) {
var n = r[i];
if (t(n)) return n
}
}, n.getFullClassName = function (e, t) {
void 0 === t && (t = !1);
var r = null,
n = null;
if (!t && e.getClassName) r = e.getClassName();
else {
if (e instanceof Object) {
var o = t ? e : Object.getPrototypeOf(e);
r = o.constructor.__bjsclassName__, n = o.constructor.__bjsmoduleName__
}
r || (r = i(e))
}
return r ? (null != n ? n + "." : "") + r : null
}, n.arrayOrStringFeeder = function (e) {
return function (t) {
if (t >= e.length) return null;
var i = e.charCodeAt ? e.charCodeAt(t) : e[t];
return i && i.getHashCode && (i = i.getHashCode()), "string" == typeof i ? n.hashCodeFromStream(n.arrayOrStringFeeder(i)) : i
}
}, n.hashCodeFromStream = function (e) {
for (var t = 0, i = 0, r = e(i++); null != r;) t = (t << 5) - t + r, t |= 0, r = e(i++);
return t
}, n.BaseUrl = "", n.CorsBehavior = "anonymous", n.UseFallbackTexture = !0, n._NoneLogLevel = 0, n._MessageLogLevel = 1, n._WarningLogLevel = 2, n._ErrorLogLevel = 4, n._LogCache = "", n.errorsCount = 0, n.Log = n._LogEnabled, n.Warn = n._WarnEnabled, n.Error = n._ErrorEnabled, n._PerformanceNoneLogLevel = 0, n._PerformanceUserMarkLogLevel = 1, n._PerformanceConsoleLogLevel = 2, n._performance = window.performance, n.StartPerformanceCounter = n._StartPerformanceCounterDisabled, n.EndPerformanceCounter = n._EndPerformanceCounterDisabled, n
}();
e.Tools = n;
var o = function () {
function e() {
this._startMonitoringTime = 0, this._min = 0, this._max = 0, this._average = 0, this._lastSecAverage = 0, this._current = 0, this._totalValueCount = 0, this._totalAccumulated = 0, this._lastSecAccumulated = 0, this._lastSecTime = 0, this._lastSecValueCount = 0
}
return Object.defineProperty(e.prototype, "min", {
get: function () {
return this._min
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "max", {
get: function () {
return this._max
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "average", {
get: function () {
return this._average
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "lastSecAverage", {
get: function () {
return this._lastSecAverage
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "current", {
get: function () {
return this._current
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "total", {
get: function () {
return this._totalAccumulated
},
enumerable: !0,
configurable: !0
}), e.prototype.fetchNewFrame = function () {
this._totalValueCount++, this._current = 0, this._lastSecValueCount++
}, e.prototype.addCount = function (e, t) {
this._current += e, t && this._fetchResult()
}, e.prototype.beginMonitoring = function () {
this._startMonitoringTime = n.Now
}, e.prototype.endMonitoring = function (e) {
void 0 === e && (e = !0), e && this.fetchNewFrame();
var t = n.Now;
this._current = t - this._startMonitoringTime, e && this._fetchResult()
}, e.prototype._fetchResult = function () {
this._totalAccumulated += this._current, this._lastSecAccumulated += this._current, this._min = Math.min(this._min, this._current), this._max = Math.max(this._max, this._current), this._average = this._totalAccumulated / this._totalValueCount;
var e = n.Now;
e - this._lastSecTime > 1e3 && (this._lastSecAverage = this._lastSecAccumulated / this._lastSecValueCount, this._lastSecTime = e, this._lastSecAccumulated = 0, this._lastSecValueCount = 0)
}, e
}();
e.PerfCounter = o, e.className = function (e, t) {
return function (i) {
i.__bjsclassName__ = e, i.__bjsmoduleName__ = null != t ? t : null
}
};
var s = function () {
function e(e, t, i, r) {
void 0 === r && (r = 0), this.iterations = e, this._fn = t, this._successCallback = i, this.index = r - 1, this._done = !1
}
return e.prototype.executeNext = function () {
this._done || (this.index + 1 < this.iterations ? (++this.index, this._fn(this)) : this.breakLoop())
}, e.prototype.breakLoop = function () {
this._done = !0, this._successCallback()
}, e.Run = function (t, i, r, n) {
void 0 === n && (n = 0);
var o = new e(t, i, r, n);
return o.executeNext(), o
}, e.SyncAsyncForLoop = function (t, i, r, n, o, s) {
void 0 === s && (s = 0), e.Run(Math.ceil(t / i), function (e) {
o && o() ? e.breakLoop() : setTimeout(function () {
for (var n = 0; n < i; ++n) {
var s = e.index * i + n;
if (s >= t) break;
if (r(s), o && o()) {
e.breakLoop();
break
}
}
e.executeNext()
}, s)
}, n)
}, e
}();
e.AsyncLoop = s
}(s || (s = {})),
function (e) {
! function (e) {
var t = function () {
function e() {
this._isAlphaBlendDirty = !1, this._isBlendFunctionParametersDirty = !1, this._alphaBlend = !1, this._blendFunctionParameters = new Array(4), this.reset()
}
return Object.defineProperty(e.prototype, "isDirty", {
get: function () {
return this._isAlphaBlendDirty || this._isBlendFunctionParametersDirty
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "alphaBlend", {
get: function () {
return this._alphaBlend
},
set: function (e) {
this._alphaBlend !== e && (this._alphaBlend = e, this._isAlphaBlendDirty = !0)
},
enumerable: !0,
configurable: !0
}), e.prototype.setAlphaBlendFunctionParameters = function (e, t, i, r) {
this._blendFunctionParameters[0] === e && this._blendFunctionParameters[1] === t && this._blendFunctionParameters[2] === i && this._blendFunctionParameters[3] === r || (this._blendFunctionParameters[0] = e, this._blendFunctionParameters[1] = t, this._blendFunctionParameters[2] = i, this._blendFunctionParameters[3] = r, this._isBlendFunctionParametersDirty = !0)
}, e.prototype.reset = function () {
this._alphaBlend = !1, this._blendFunctionParameters[0] = null, this._blendFunctionParameters[1] = null, this._blendFunctionParameters[2] = null, this._blendFunctionParameters[3] = null, this._isAlphaBlendDirty = !0, this._isBlendFunctionParametersDirty = !1
}, e.prototype.apply = function (e) {
this.isDirty && (this._isAlphaBlendDirty && (this._alphaBlend ? e.enable(e.BLEND) : e.disable(e.BLEND), this._isAlphaBlendDirty = !1), this._isBlendFunctionParametersDirty && (e.blendFuncSeparate(this._blendFunctionParameters[0], this._blendFunctionParameters[1], this._blendFunctionParameters[2], this._blendFunctionParameters[3]), this._isBlendFunctionParametersDirty = !1))
}, e
}();
e._AlphaState = t
}(e.Internals || (e.Internals = {}))
}(s || (s = {})),
function (e) {
! function (e) {
var t = function () {
function e() {
this._isDepthTestDirty = !1, this._isDepthMaskDirty = !1, this._isDepthFuncDirty = !1, this._isCullFaceDirty = !1, this._isCullDirty = !1, this._isZOffsetDirty = !1, this.reset()
}
return Object.defineProperty(e.prototype, "isDirty", {
get: function () {
return this._isDepthFuncDirty || this._isDepthTestDirty || this._isDepthMaskDirty || this._isCullFaceDirty || this._isCullDirty || this._isZOffsetDirty
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "zOffset", {
get: function () {
return this._zOffset
},
set: function (e) {
this._zOffset !== e && (this._zOffset = e, this._isZOffsetDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "cullFace", {
get: function () {
return this._cullFace
},
set: function (e) {
this._cullFace !== e && (this._cullFace = e, this._isCullFaceDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "cull", {
get: function () {
return this._cull
},
set: function (e) {
this._cull !== e && (this._cull = e, this._isCullDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "depthFunc", {
get: function () {
return this._depthFunc
},
set: function (e) {
this._depthFunc !== e && (this._depthFunc = e, this._isDepthFuncDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "depthMask", {
get: function () {
return this._depthMask
},
set: function (e) {
this._depthMask !== e && (this._depthMask = e, this._isDepthMaskDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(e.prototype, "depthTest", {
get: function () {
return this._depthTest
},
set: function (e) {
this._depthTest !== e && (this._depthTest = e, this._isDepthTestDirty = !0)
},
enumerable: !0,
configurable: !0
}), e.prototype.reset = function () {
this._depthMask = !0, this._depthTest = !0, this._depthFunc = null, this._cullFace = null, this._cull = null, this._zOffset = 0, this._isDepthTestDirty = !0, this._isDepthMaskDirty = !0, this._isDepthFuncDirty = !1, this._isCullFaceDirty = !1, this._isCullDirty = !1, this._isZOffsetDirty = !1
}, e.prototype.apply = function (e) {
this.isDirty && (this._isCullDirty && (this.cull ? e.enable(e.CULL_FACE) : e.disable(e.CULL_FACE), this._isCullDirty = !1), this._isCullFaceDirty && (e.cullFace(this.cullFace), this._isCullFaceDirty = !1), this._isDepthMaskDirty && (e.depthMask(this.depthMask), this._isDepthMaskDirty = !1), this._isDepthTestDirty && (this.depthTest ? e.enable(e.DEPTH_TEST) : e.disable(e.DEPTH_TEST), this._isDepthTestDirty = !1), this._isDepthFuncDirty && (e.depthFunc(this.depthFunc), this._isDepthFuncDirty = !1), this._isZOffsetDirty && (this.zOffset ? (e.enable(e.POLYGON_OFFSET_FILL), e.polygonOffset(this.zOffset, 0)) : e.disable(e.POLYGON_OFFSET_FILL), this._isZOffsetDirty = !1))
}, e
}();
e._DepthCullingState = t
}(e.Internals || (e.Internals = {}))
}(s || (s = {})),
function (e) {
! function (t) {
var i = function () {
function t() {
this._isStencilTestDirty = !1, this._isStencilMaskDirty = !1, this._isStencilFuncDirty = !1, this._isStencilOpDirty = !1, this.reset()
}
return Object.defineProperty(t.prototype, "isDirty", {
get: function () {
return this._isStencilTestDirty || this._isStencilMaskDirty || this._isStencilFuncDirty || this._isStencilOpDirty
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilFunc", {
get: function () {
return this._stencilFunc
},
set: function (e) {
this._stencilFunc !== e && (this._stencilFunc = e, this._isStencilFuncDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilFuncRef", {
get: function () {
return this._stencilFuncRef
},
set: function (e) {
this._stencilFuncRef !== e && (this._stencilFuncRef = e, this._isStencilFuncDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilFuncMask", {
get: function () {
return this._stencilFuncMask
},
set: function (e) {
this._stencilFuncMask !== e && (this._stencilFuncMask = e, this._isStencilFuncDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilOpStencilFail", {
get: function () {
return this._stencilOpStencilFail
},
set: function (e) {
this._stencilOpStencilFail !== e && (this._stencilOpStencilFail = e, this._isStencilOpDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilOpDepthFail", {
get: function () {
return this._stencilOpDepthFail
},
set: function (e) {
this._stencilOpDepthFail !== e && (this._stencilOpDepthFail = e, this._isStencilOpDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilOpStencilDepthPass", {
get: function () {
return this._stencilOpStencilDepthPass
},
set: function (e) {
this._stencilOpStencilDepthPass !== e && (this._stencilOpStencilDepthPass = e, this._isStencilOpDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilMask", {
get: function () {
return this._stencilMask
},
set: function (e) {
this._stencilMask !== e && (this._stencilMask = e, this._isStencilMaskDirty = !0)
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(t.prototype, "stencilTest", {
get: function () {
return this._stencilTest
},
set: function (e) {
this._stencilTest !== e && (this._stencilTest = e, this._isStencilTestDirty = !0)
},
enumerable: !0,
configurable: !0
}), t.prototype.reset = function () {
this._stencilTest = !1, this._stencilMask = 255, this._stencilFunc = e.Engine.ALWAYS, this._stencilFuncRef = 1, this._stencilFuncMask = 255, this._stencilOpStencilFail = e.Engine.KEEP, this._stencilOpDepthFail = e.Engine.KEEP, this._stencilOpStencilDepthPass = e.Engine.REPLACE, this._isStencilTestDirty = !0, this._isStencilMaskDirty = !0, this._isStencilFuncDirty = !0, this._isStencilOpDirty = !0
}, t.prototype.apply = function (e) {
this.isDirty && (this._isStencilTestDirty && (this.stencilTest ? e.enable(e.STENCIL_TEST) : e.disable(e.STENCIL_TEST), this._isStencilTestDirty = !1), this._isStencilMaskDirty && (e.stencilMask(this.stencilMask), this._isStencilMaskDirty = !1), this._isStencilFuncDirty && (e.stencilFunc(this.stencilFunc, this.stencilFuncRef, this.stencilFuncMask), this._isStencilFuncDirty = !1), this._isStencilOpDirty && (e.stencilOp(this.stencilOpStencilFail, this.stencilOpDepthFail, this.stencilOpStencilDepthPass), this._isStencilOpDirty = !1))
}, t
}();
t._StencilState = i
}(e.Internals || (e.Internals = {}))
}(s || (s = {})),
function (e) {
var t = function (e, t, i, r) {
var n = e.createShader("vertex" === i ? e.VERTEX_SHADER : e.FRAGMENT_SHADER);
if (e.shaderSource(n, (r ? r + "\n" : "") + t), e.compileShader(n), !e.getShaderParameter(n, e.COMPILE_STATUS)) throw new Error(e.getShaderInfoLog(n));
return n
},
i = function (e, t) {
return t === h.TEXTURETYPE_FLOAT ? e.FLOAT : t === h.TEXTURETYPE_HALF_FLOAT ? 36193 : e.UNSIGNED_BYTE
},
r = function (t, i, r) {
var n = r.NEAREST,
o = r.NEAREST;
return t === e.Texture.BILINEAR_SAMPLINGMODE ? (n = r.LINEAR, o = i ? r.LINEAR_MIPMAP_NEAREST : r.LINEAR) : t === e.Texture.TRILINEAR_SAMPLINGMODE ? (n = r.LINEAR, o = i ? r.LINEAR_MIPMAP_LINEAR : r.LINEAR) : t === e.Texture.NEAREST_SAMPLINGMODE && (n = r.NEAREST, o = i ? r.NEAREST_MIPMAP_LINEAR : r.NEAREST), {
min: o,
mag: n
}
},
n = function (t, i, n, o, s, a, c, h, u, l) {
void 0 === l && (l = e.Texture.TRILINEAR_SAMPLINGMODE);
var f = n.getEngine(),
d = e.Tools.GetExponentOfTwo(o, f.getCaps().maxTextureSize),
p = e.Tools.GetExponentOfTwo(s, f.getCaps().maxTextureSize);
f._bindTextureDirectly(i.TEXTURE_2D, t), i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL, void 0 === a ? 1 : a ? 1 : 0), t._baseWidth = o, t._baseHeight = s, t._width = d, t._height = p, t.isReady = !0, u(d, p);
var m = r(l, !c, i);
i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MAG_FILTER, m.mag), i.texParameteri(i.TEXTURE_2D, i.TEXTURE_MIN_FILTER, m.min), c || h || i.generateMipmap(i.TEXTURE_2D), f._bindTextureDirectly(i.TEXTURE_2D, null), f.resetTextureCache(), n._removePendingData(t), t.onLoadedCallbacks.forEach(function (e) {
e()
}), t.onLoadedCallbacks = []
},
o = function (t, i, r, n, o, s) {
void 0 === s && (s = null);
var a;
a = e.Tools.LoadImage(t, function () {
r[i] = a, r._internalCount++, n._removePendingData(a), 6 === r._internalCount && o(r)
}, function () {
n._removePendingData(a), s && s()
}, n.database), n._addPendingData(a)
},
s = function (e, t, i, r, n) {
void 0 === n && (n = null);
var s = [];
s._internalCount = 0;
for (var a = 0; a < 6; a++) o(r[a], a, s, t, i, n)
},
a = function () {
return function () {}
}();
e.InstancingAttributeInfo = a;
var c = function () {
return function () {}
}();
e.EngineCapabilities = c;
var h = function () {
function o(t, i, r, n) {
var s = this;
void 0 === n && (n = !0), this.isFullscreen = !1, this.isPointerLock = !1, this.cullBackFaces = !0, this.renderEvenInBackground = !0, this.enableOfflineSupport = !0, this.scenes = new Array, this._windowIsBackground = !1, this._webGLVersion = "1.0", this._badOS = !1, this._drawCalls = new e.PerfCounter, this._renderingQueueLaunched = !1, this._activeRenderLoops = [], this.fpsRange = 60, this.previousFramesDuration = [], this.fps = 60, this.deltaTime = 0, this._depthCullingState = new e.Internals._DepthCullingState, this._stencilState = new e.Internals._StencilState, this._alphaState = new e.Internals._AlphaState, this._alphaMode = o.ALPHA_DISABLE, this._loadedTexturesCache = new Array, this._maxTextureChannels = 16, this._activeTexturesCache = new Array(this._maxTextureChannels), this._compiledEffects = {}, this._vertexAttribArraysEnabled = [], this._uintIndicesCurrentlySet = !1, this._currentBoundBuffer = new Array, this._currentBufferPointers = [], this._currentInstanceLocations = new Array, this._currentInstanceBuffers = new Array, this._texturesSupported = new Array, this._onVRFullScreenTriggered = function () {
if (s._vrDisplayEnabled && s._vrDisplayEnabled.isPresenting) {
s._oldSize = new e.Size(s.getRenderWidth(), s.getRenderHeight()), s._oldHardwareScaleFactor = s.getHardwareScalingLevel();
var t = s._vrDisplayEnabled.getEyeParameters("left");
s.setHardwareScalingLevel(1), s.setSize(2 * t.renderWidth, t.renderHeight)
} else s.setHardwareScalingLevel(s._oldHardwareScaleFactor), s.setSize(s._oldSize.width, s._oldSize.height), s._vrDisplayEnabled = void 0
}, this._renderingCanvas = t, this._externalData = new e.StringDictionary, r = r || {}, null != i && (r.antialias = i), void 0 === r.preserveDrawingBuffer && (r.preserveDrawingBuffer = !1);
var a = this._canRenderToFloatTexture(),
h = this._canRenderToHalfFloatTexture();
if (!this._gl) {
if (!t) throw new Error("The provided canvas is null or undefined.");
try {
this._gl = t.getContext("webgl", r) || t.getContext("experimental-webgl", r)
} catch (e) {
throw new Error("WebGL not supported")
}
}
if (!this._gl) throw new Error("WebGL not supported");
this._onBlur = function () {
s._windowIsBackground = !0
}, this._onFocus = function () {
s._windowIsBackground = !1
}, window.addEventListener("blur", this._onBlur), window.addEventListener("focus", this._onFocus);
var u = r.limitDeviceRatio || window.devicePixelRatio || 1;
this._hardwareScalingLevel = n ? 1 / Math.min(u, window.devicePixelRatio || 1) : 1, this.resize(), this._isStencilEnable = r.stencil, this._caps = new c, this._caps.maxTexturesImageUnits = this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS), this._caps.maxTextureSize = this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE), this._caps.maxCubemapTextureSize = this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE), this._caps.maxRenderTextureSize = this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE), this._caps.maxVertexAttribs = this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS), this._glVersion = this._gl.getParameter(this._gl.VERSION);
var l = this._gl.getExtension("WEBGL_debug_renderer_info");
if (null != l && (this._glRenderer = this._gl.getParameter(l.UNMASKED_RENDERER_WEBGL), this._glVendor = this._gl.getParameter(l.UNMASKED_VENDOR_WEBGL)), this._glVendor || (this._glVendor = "Unknown vendor"), this._glRenderer || (this._glRenderer = "Unknown renderer"), this._caps.standardDerivatives = null !== this._gl.getExtension("OES_standard_derivatives"), this._caps.astc = this._gl.getExtension("WEBGL_compressed_texture_astc"), this._caps.s3tc = this._gl.getExtension("WEBGL_compressed_texture_s3tc"), this._caps.pvrtc = this._gl.getExtension("WEBGL_compressed_texture_pvrtc") || this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"), this._caps.etc1 = this._gl.getExtension("WEBGL_compressed_texture_etc1"), this._caps.etc2 = this._gl.getExtension("WEBGL_compressed_texture_etc") || this._gl.getExtension("WEBGL_compressed_texture_es3_0"), this._caps.textureFloat = null !== this._gl.getExtension("OES_texture_float"), this._caps.textureAnisotropicFilterExtension = this._gl.getExtension("EXT_texture_filter_anisotropic") || this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic") || this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"), this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0, this._caps.instancedArrays = this._gl.getExtension("ANGLE_instanced_arrays"), this._caps.uintIndices = null !== this._gl.getExtension("OES_element_index_uint"), this._caps.fragmentDepthSupported = null !== this._gl.getExtension("EXT_frag_depth"), this._caps.highPrecisionShaderSupported = !0, this._caps.drawBuffersExtension = this._gl.getExtension("WEBGL_draw_buffers"), this._caps.textureFloatLinearFiltering = this._gl.getExtension("OES_texture_float_linear"), this._caps.textureLOD = this._gl.getExtension("EXT_shader_texture_lod"), this._caps.textureFloatRender = a, this._caps.textureHalfFloat = null !== this._gl.getExtension("OES_texture_half_float"), this._caps.textureHalfFloatLinearFiltering = this._gl.getExtension("OES_texture_half_float_linear"), this._caps.textureHalfFloatRender = h, this._caps.astc && this.texturesSupported.push(".astc"), this._caps.s3tc && this.texturesSupported.push(".dds"), this._caps.pvrtc && this.texturesSupported.push(".pvr"), this._caps.etc2 && this.texturesSupported.push(".etc2"), this._caps.etc1 && this.texturesSupported.push(".etc1"), this._gl.getShaderPrecisionFormat) {
var f = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);
this._caps.highPrecisionShaderSupported = 0 !== f.precision
}
this.setDepthBuffer(!0), this.setDepthFunctionToLessOrEqual(), this.setDepthWrite(!0), this._onFullscreenChange = function () {
void 0 !== document.fullscreen ? s.isFullscreen = document.fullscreen : void 0 !== document.mozFullScreen ? s.isFullscreen = document.mozFullScreen : void 0 !== document.webkitIsFullScreen ? s.isFullscreen = document.webkitIsFullScreen : void 0 !== document.msIsFullScreen && (s.isFullscreen = document.msIsFullScreen), s.isFullscreen && s._pointerLockRequested && (t.requestPointerLock = t.requestPointerLock || t.msRequestPointerLock || t.mozRequestPointerLock || t.webkitRequestPointerLock, t.requestPointerLock && t.requestPointerLock())
}, document.addEventListener("fullscreenchange", this._onFullscreenChange, !1), document.addEventListener("mozfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("webkitfullscreenchange", this._onFullscreenChange, !1), document.addEventListener("msfullscreenchange", this._onFullscreenChange, !1), this._onPointerLockChange = function () {
s.isPointerLock = document.mozPointerLockElement === t || document.webkitPointerLockElement === t || document.msPointerLockElement === t || document.pointerLockElement === t
}, document.addEventListener("pointerlockchange", this._onPointerLockChange, !1), document.addEventListener("mspointerlockchange", this._onPointerLockChange, !1), document.addEventListener("mozpointerlockchange", this._onPointerLockChange, !1), document.addEventListener("webkitpointerlockchange", this._onPointerLockChange, !1), e.AudioEngine && !o.audioEngine && (o.audioEngine = new e.AudioEngine), this._loadingScreen = new e.DefaultLoadingScreen(this._renderingCanvas), r.autoEnableWebVR && this.initWebVR();
this._badOS = /AppleWebKit.*10.[\d] Mobile/.test(navigator.userAgent), e.Tools.Log("Babylon.js engine (v" + o.Version + ") launched")
}
return Object.defineProperty(o, "NEVER", {
get: function () {
return o._NEVER
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALWAYS", {
get: function () {
return o._ALWAYS
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "LESS", {
get: function () {
return o._LESS
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "EQUAL", {
get: function () {
return o._EQUAL
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "LEQUAL", {
get: function () {
return o._LEQUAL
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "GREATER", {
get: function () {
return o._GREATER
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "GEQUAL", {
get: function () {
return o._GEQUAL
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "NOTEQUAL", {
get: function () {
return o._NOTEQUAL
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "KEEP", {
get: function () {
return o._KEEP
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "REPLACE", {
get: function () {
return o._REPLACE
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "INCR", {
get: function () {
return o._INCR
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "DECR", {
get: function () {
return o._DECR
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "INVERT", {
get: function () {
return o._INVERT
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "INCR_WRAP", {
get: function () {
return o._INCR_WRAP
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "DECR_WRAP", {
get: function () {
return o._DECR_WRAP
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_DISABLE", {
get: function () {
return o._ALPHA_DISABLE
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_ONEONE", {
get: function () {
return o._ALPHA_ONEONE
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_ADD", {
get: function () {
return o._ALPHA_ADD
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_COMBINE", {
get: function () {
return o._ALPHA_COMBINE
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_SUBTRACT", {
get: function () {
return o._ALPHA_SUBTRACT
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_MULTIPLY", {
get: function () {
return o._ALPHA_MULTIPLY
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "ALPHA_MAXIMIZED", {
get: function () {
return o._ALPHA_MAXIMIZED
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "DELAYLOADSTATE_NONE", {
get: function () {
return o._DELAYLOADSTATE_NONE
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "DELAYLOADSTATE_LOADED", {
get: function () {
return o._DELAYLOADSTATE_LOADED
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "DELAYLOADSTATE_LOADING", {
get: function () {
return o._DELAYLOADSTATE_LOADING
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "DELAYLOADSTATE_NOTLOADED", {
get: function () {
return o._DELAYLOADSTATE_NOTLOADED
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTUREFORMAT_ALPHA", {
get: function () {
return o._TEXTUREFORMAT_ALPHA
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTUREFORMAT_LUMINANCE", {
get: function () {
return o._TEXTUREFORMAT_LUMINANCE
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTUREFORMAT_LUMINANCE_ALPHA", {
get: function () {
return o._TEXTUREFORMAT_LUMINANCE_ALPHA
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTUREFORMAT_RGB", {
get: function () {
return o._TEXTUREFORMAT_RGB
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTUREFORMAT_RGBA", {
get: function () {
return o._TEXTUREFORMAT_RGBA
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTURETYPE_UNSIGNED_INT", {
get: function () {
return o._TEXTURETYPE_UNSIGNED_INT
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTURETYPE_FLOAT", {
get: function () {
return o._TEXTURETYPE_FLOAT
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "TEXTURETYPE_HALF_FLOAT", {
get: function () {
return o._TEXTURETYPE_HALF_FLOAT
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o, "Version", {
get: function () {
return "2.5"
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o.prototype, "texturesSupported", {
get: function () {
return this._texturesSupported
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o.prototype, "textureFormatInUse", {
get: function () {
return this._textureFormatInUse
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o.prototype, "webGLVersion", {
get: function () {
return this._webGLVersion
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o.prototype, "isStencilEnable", {
get: function () {
return this._isStencilEnable
},
enumerable: !0,
configurable: !0
}), o.prototype._prepareWorkingCanvas = function () {
this._workingCanvas || (this._workingCanvas = document.createElement("canvas"), this._workingContext = this._workingCanvas.getContext("2d"))
}, o.prototype.resetTextureCache = function () {
for (var e = 0; e < this._maxTextureChannels; e++) this._activeTexturesCache[e] = null
}, o.prototype.getGlInfo = function () {
return {
vendor: this._glVendor,
renderer: this._glRenderer,
version: this._glVersion
}
}, o.prototype.getAspectRatio = function (e, t) {
void 0 === t && (t = !1);
var i = e.viewport;
return this.getRenderWidth(t) * i.width / (this.getRenderHeight(t) * i.height)
}, o.prototype.getRenderWidth = function (e) {
return void 0 === e && (e = !1), !e && this._currentRenderTarget ? this._currentRenderTarget._width : this._renderingCanvas.width
}, o.prototype.getRenderHeight = function (e) {
return void 0 === e && (e = !1), !e && this._currentRenderTarget ? this._currentRenderTarget._height : this._renderingCanvas.height
}, o.prototype.getRenderingCanvas = function () {
return this._renderingCanvas
}, o.prototype.getRenderingCanvasClientRect = function () {
return this._renderingCanvas.getBoundingClientRect()
}, o.prototype.setHardwareScalingLevel = function (e) {
this._hardwareScalingLevel = e, this.resize()
}, o.prototype.getHardwareScalingLevel = function () {
return this._hardwareScalingLevel
}, o.prototype.getLoadedTexturesCache = function () {
return this._loadedTexturesCache
}, o.prototype.getCaps = function () {
return this._caps
}, Object.defineProperty(o.prototype, "drawCalls", {
get: function () {
return this._drawCalls.current
},
enumerable: !0,
configurable: !0
}), Object.defineProperty(o.prototype, "drawCallsPerfCounter", {
get: function () {
return this._drawCalls
},
enumerable: !0,
configurable: !0
}), o.prototype.getDepthFunction = function () {
return this._depthCullingState.depthFunc
}, o.prototype.setDepthFunction = function (e) {
this._depthCullingState.depthFunc = e
}, o.prototype.setDepthFunctionToGreater = function () {
this._depthCullingState.depthFunc = this._gl.GREATER
}, o.prototype.setDepthFunctionToGreaterOrEqual = function () {
this._depthCullingState.depthFunc = this._gl.GEQUAL
}, o.prototype.setDepthFunctionToLess = function () {
this._depthCullingState.depthFunc = this._gl.LESS
}, o.prototype.setDepthFunctionToLessOrEqual = function () {
this._depthCullingState.depthFunc = this._gl.LEQUAL
}, o.prototype.getStencilBuffer = function () {
return this._stencilState.stencilTest
}, o.prototype.setStencilBuffer = function (e) {
this._stencilState.stencilTest = e
}, o.prototype.getStencilMask = function () {
return this._stencilState.stencilMask
}, o.prototype.setStencilMask = function (e) {
this._stencilState.stencilMask = e
}, o.prototype.getStencilFunction = function () {
return this._stencilState.stencilFunc
}, o.prototype.getStencilFunctionReference = function () {
return this._stencilState.stencilFuncRef
}, o.prototype.getStencilFunctionMask = function () {
return this._stencilState.stencilFuncMask
}, o.prototype.setStencilFunction = function (e) {
this._stencilState.stencilFunc = e
}, o.prototype.setStencilFunctionReference = function (e) {
this._stencilState.stencilFuncRef = e
}, o.prototype.setStencilFunctionMask = function (e) {
this._stencilState.stencilFuncMask = e
}, o.prototype.getStencilOperationFail = function () {
return this._stencilState.stencilOpStencilFail
}, o.prototype.getStencilOperationDepthFail = function () {
return this._stencilState.stencilOpDepthFail
}, o.prototype.getStencilOperationPass = function () {
return this._stencilState.stencilOpStencilDepthPass
}, o.prototype.setStencilOperationFail = function (e) {
this._stencilState.stencilOpStencilFail = e
}, o.prototype.setStencilOperationDepthFail = function (e) {
this._stencilState.stencilOpDepthFail = e
}, o.prototype.setStencilOperationPass = function (e) {
this._stencilState.stencilOpStencilDepthPass = e
}, o.prototype.stopRenderLoop = function (e) {
if (e) {
var t = this._activeRenderLoops.indexOf(e);
t >= 0 && this._activeRenderLoops.splice(t, 1)
} else this._activeRenderLoops = []
}, o.prototype._renderLoop = function () {
var t = !0;
if (!this.renderEvenInBackground && this._windowIsBackground && (t = !1), t) {
this.beginFrame();
for (var i = 0; i < this._activeRenderLoops.length; i++) {
(0, this._activeRenderLoops[i])()
}
this.endFrame()
}
this._activeRenderLoops.length > 0 ? e.Tools.QueueNewFrame(this._bindedRenderFunction, this._vrDisplayEnabled) : this._renderingQueueLaunched = !1
}, o.prototype.runRenderLoop = function (t) {
-1 === this._activeRenderLoops.indexOf(t) && (this._activeRenderLoops.push(t), this._renderingQueueLaunched || (this._renderingQueueLaunched = !0, this._bindedRenderFunction = this._renderLoop.bind(this), e.Tools.QueueNewFrame(this._bindedRenderFunction)))
}, o.prototype.switchFullscreen = function (t) {
this.isFullscreen ? e.Tools.ExitFullscreen() : (this._pointerLockRequested = t, e.Tools.RequestFullscreen(this._renderingCanvas))
}, o.prototype.clear = function (e, t, i, r) {
void 0 === r && (r = !1), this.applyStates();
var n = 0;
t && (this._gl.clearColor(e.r, e.g, e.b, void 0 !== e.a ? e.a : 1), n |= this._gl.COLOR_BUFFER_BIT), i && (this._gl.clearDepth(1), n |= this._gl.DEPTH_BUFFER_BIT), r && (this._gl.clearStencil(0), n |= this._gl.STENCIL_BUFFER_BIT), this._gl.clear(n)
}, o.prototype.scissorClear = function (e, t, i, r, n) {
var o = this._gl,
s = o.getParameter(o.SCISSOR_TEST),
a = o.getParameter(o.SCISSOR_BOX);
o.enable(o.SCISSOR_TEST), o.scissor(e, t, i, r), this.clear(n, !0, !0, !0), o.scissor(a[0], a[1], a[2], a[3]), !0 === s ? o.enable(o.SCISSOR_TEST) : o.disable(o.SCISSOR_TEST)
}, o.prototype.setViewport = function (e, t, i) {
var r = t || (navigator.isCocoonJS ? window.innerWidth : this._renderingCanvas.width),
n = i || (navigator.isCocoonJS ? window.innerHeight : this._renderingCanvas.height),
o = e.x || 0,
s = e.y || 0;
this._cachedViewport = e, this._gl.viewport(o * r, s * n, r * e.width, n * e.height)
}, o.prototype.setDirectViewport = function (e, t, i, r) {
var n = this._cachedViewport;
return this._cachedViewport = null, this._gl.viewport(e, t, i, r), n
}, o.prototype.beginFrame = function () {
this._measureFps()
}, o.prototype.endFrame = function () {
this._badOS && this.flushFramebuffer(), this._vrDisplayEnabled && this._vrDisplayEnabled.isPresenting && this._vrDisplayEnabled.submitFrame()
}, o.prototype.resize = function () {
var t = navigator.isCocoonJS ? window.innerWidth : this._renderingCanvas.clientWidth,
i = navigator.isCocoonJS ? window.innerHeight : this._renderingCanvas.clientHeight;
this.setSize(t / this._hardwareScalingLevel, i / this._hardwareScalingLevel);
for (var r = 0; r < this.scenes.length; r++) {
var n = this.scenes[r];
e.DebugLayer && n.debugLayer.isVisible() && n.debugLayer._syncPositions()
}
}, o.prototype.setSize = function (e, t) {
this._renderingCanvas.width = e, this._renderingCanvas.height = t;
for (var i = 0; i < this.scenes.length; i++)
for (var r = this.scenes[i], n = 0; n < r.cameras.length; n++) {
r.cameras[n]._currentRenderId = 0
}
}, o.prototype.initWebVR = function () {
this.vrDisplaysPromise || this._getVRDisplays()
}, o.prototype.enableVR = function (e) {
this._vrDisplayEnabled = e, this._vrDisplayEnabled.requestPresent([{
source: this.getRenderingCanvas()
}]).then(this._onVRFullScreenTriggered)
}, o.prototype.disableVR = function () {
this._vrDisplayEnabled && this._vrDisplayEnabled.exitPresent().then(this._onVRFullScreenTriggered)
}, o.prototype._getVRDisplays = function () {
var e = this;
navigator.getVRDisplays && (this.vrDisplaysPromise = navigator.getVRDisplays().then(function (t) {
var i = (t.length, 0);
return e._vrDisplays = t.filter(function (e) {
return t[i] instanceof VRDisplay
}), e._vrDisplays
}))
}, o.prototype.bindFramebuffer = function (e, t, i, r) {
this._currentRenderTarget = e, this.bindUnboundFramebuffer(e._framebuffer);
var n = this._gl;
e.isCube && n.framebufferTexture2D(n.FRAMEBUFFER, n.COLOR_ATTACHMENT0, n.TEXTURE_CUBE_MAP_POSITIVE_X + t, e, 0), n.viewport(0, 0, i || e._width, r || e._height), this.wipeCaches()
}, o.prototype.bindUnboundFramebuffer = function (e) {
this._currentFramebuffer !== e && (this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, e), this._currentFramebuffer = e)
}, o.prototype.unBindFramebuffer = function (e, t) {
if (void 0 === t && (t = !1), this._currentRenderTarget = null, e.generateMipMaps && !t) {
var i = this._gl;
this._bindTextureDirectly(i.TEXTURE_2D, e), i.generateMipmap(i.TEXTURE_2D), this._bindTextureDirectly(i.TEXTURE_2D, null)
}
this.bindUnboundFramebuffer(null)
}, o.prototype.generateMipMapsForCubemap = function (e) {
if (e.generateMipMaps) {
var t = this._gl;
this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, e), t.generateMipmap(t.TEXTURE_CUBE_MAP), this._bindTextureDirectly(t.TEXTURE_CUBE_MAP, null)
}
}, o.prototype.flushFramebuffer = function () {
this._gl.flush()
}, o.prototype.restoreDefaultFramebuffer = function () {
this._currentRenderTarget = null, this.bindUnboundFramebuffer(null), this.setViewport(this._cachedViewport), this.wipeCaches()
}, o.prototype._resetVertexBufferBinding = function () {
this.bindArrayBuffer(null), this._cachedVertexBuffers = null
}, o.prototype.createVertexBuffer = function (e) {
var t = this._gl.createBuffer();
return this.bindArrayBuffer(t), e instanceof Float32Array ? this._gl.bufferData(this._gl.ARRAY_BUFFER, e, this._gl.STATIC_DRAW) : this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(e), this._gl.STATIC_DRAW), this._resetVertexBufferBinding(), t.references = 1, t
}, o.prototype.createDynamicVertexBuffer = function (e) {
var t = this._gl.createBuffer();
return this.bindArrayBuffer(t), e instanceof Float32Array ? this._gl.bufferData(this._gl.ARRAY_BUFFER, e, this._gl.DYNAMIC_DRAW) : this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(e), this._gl.DYNAMIC_DRAW), this._resetVertexBufferBinding(), t.references = 1, t
}, o.prototype.updateDynamicVertexBuffer = function (e, t, i, r) {
this.bindArrayBuffer(e), void 0 === i && (i = 0), void 0 === r ? t instanceof Float32Array ? this._gl.bufferSubData(this._gl.ARRAY_BUFFER, i, t) : this._gl.bufferSubData(this._gl.ARRAY_BUFFER, i, new Float32Array(t)) : t instanceof Float32Array ? this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, t.subarray(i, i + r)) : this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(t).subarray(i, i + r)), this._resetVertexBufferBinding()
}, o.prototype._resetIndexBufferBinding = function () {
this.bindIndexBuffer(null), this._cachedIndexBuffer = null
}, o.prototype.createIndexBuffer = function (e) {
var t = this._gl.createBuffer();
this.bindIndexBuffer(t);
var i, r = !1;
if (this._caps.uintIndices) {
for (var n = 0; n < e.length; n++)
if (e[n] > 65535) {
r = !0;
break
} i = r ? new Uint32Array(e) : new Uint16Array(e)
} else i = new Uint16Array(e);
return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, i, this._gl.STATIC_DRAW), this._resetIndexBufferBinding(), t.references = 1, t.is32Bits = r, t
}, o.prototype.bindArrayBuffer = function (e) {
this.bindBuffer(e, this._gl.ARRAY_BUFFER)
}, o.prototype.bindIndexBuffer = function (e) {
this.bindBuffer(e, this._gl.ELEMENT_ARRAY_BUFFER)
}, o.prototype.bindBuffer = function (e, t) {
this._currentBoundBuffer[t] !== e && (this._gl.bindBuffer(t, e), this._currentBoundBuffer[t] = e)
}, o.prototype.updateArrayBuffer = function (e) {
this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, e)
}, o.prototype.vertexAttribPointer = function (e, t, i, r, n, o, s) {
var a = this._currentBufferPointers[t],
c = !1;
a ? (a.buffer !== e && (a.buffer = e, c = !0), a.size !== i && (a.size = i, c = !0), a.type !== r && (a.type = r, c = !0), a.normalized !== n && (a.normalized = n, c = !0), a.stride !== o && (a.stride = o, c = !0), a.offset !== s && (a.offset = s, c = !0)) : (c = !0, this._currentBufferPointers[t] = {
indx: t,
size: i,
type: r,
normalized: n,
stride: o,
offset: s,
buffer: e
}), c && (this.bindArrayBuffer(e), this._gl.vertexAttribPointer(t, i, r, n, o, s))
}, o.prototype.bindBuffersDirectly = function (e, t, i, r, n) {
if (this._cachedVertexBuffers !== e || this._cachedEffectForVertexBuffers !== n) {
this._cachedVertexBuffers = e, this._cachedEffectForVertexBuffers = n;
for (var o = n.getAttributesCount(), s = 0, a = 0; a < o; a++)
if (a < i.length) {
(c = n.getAttributeLocation(a)) >= 0 && (this._vertexAttribArraysEnabled[c] || (this._gl.enableVertexAttribArray(c), this._vertexAttribArraysEnabled[c] = !0), this.vertexAttribPointer(e, c, i[a], this._gl.FLOAT, !1, r, s)), s += 4 * i[a]
} else {
var c = n.getAttributeLocation(a);
this._vertexAttribArraysEnabled[c] && (this._gl.disableVertexAttribArray(c), this._vertexAttribArraysEnabled[c] = !1)
}
}
this._cachedIndexBuffer !== t && (this._cachedIndexBuffer = t, this.bindIndexBuffer(t), this._uintIndicesCurrentlySet = t.is32Bits)
}, o.prototype.bindBuffers = function (e, t, i) {
if (this._cachedVertexBuffers !== e || this._cachedEffectForVertexBuffers !== i) {
this._cachedVertexBuffers = e, this._cachedEffectForVertexBuffers = i;
for (var r = i.getAttributesNames(), n = 0; n < r.length; n++) {
var o = i.getAttributeLocation(n);
if (o >= 0) {
var s = e[r[n]];
if (!s) {
this._vertexAttribArraysEnabled[o] && (this._gl.disableVertexAttribArray(o), this._vertexAttribArraysEnabled[o] = !1);
continue
}
this._vertexAttribArraysEnabled[o] || (this._gl.enableVertexAttribArray(o), this._vertexAttribArraysEnabled[o] = !0);
var a = s.getBuffer();
this.vertexAttribPointer(a, o, s.getSize(), this._gl.FLOAT, !1, 4 * s.getStrideSize(), 4 * s.getOffset()), s.getIsInstanced() && (this._caps.instancedArrays.vertexAttribDivisorANGLE(o, 1), this._currentInstanceLocations.push(o), this._currentInstanceBuffers.push(a))
}
}
}
null != t && this._cachedIndexBuffer !== t && (this._cachedIndexBuffer = t, this.bindIndexBuffer(t), this._uintIndicesCurrentlySet = t.is32Bits)
}, o.prototype.unbindInstanceAttributes = function () {
for (var e, t = 0, i = this._currentInstanceLocations.length; t < i; t++) {
var r = this._currentInstanceBuffers[t];
e != r && (e = r, this.bindArrayBuffer(r));
var n = this._currentInstanceLocations[t];
this._caps.instancedArrays.vertexAttribDivisorANGLE(n, 0)
}
this._currentInstanceBuffers.length = 0, this._currentInstanceLocations.length = 0
}, o.prototype._releaseBuffer = function (e) {
return e.references--, 0 === e.references && (this._gl.deleteBuffer(e), !0)
}, o.prototype.createInstancesBuffer = function (e) {
var t = this._gl.createBuffer();
return t.capacity = e, this.bindArrayBuffer(t), this._gl.bufferData(this._gl.ARRAY_BUFFER, e, this._gl.DYNAMIC_DRAW), t
}, o.prototype.deleteInstancesBuffer = function (e) {
this._gl.deleteBuffer(e)
}, o.prototype.updateAndBindInstancesBuffer = function (e, t, i) {
if (this.bindArrayBuffer(e), t && this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, t), void 0 !== i[0].index) {
for (var r = 0, n = 0; n < i.length; n++) {
r += 4 * (o = i[n]).attributeSize
}
for (n = 0; n < i.length; n++) {
var o = i[n];
this._vertexAttribArraysEnabled[o.index] || (this._gl.enableVertexAttribArray(o.index), this._vertexAttribArraysEnabled[o.index] = !0), this.vertexAttribPointer(e, o.index, o.attributeSize, o.attribyteType || this._gl.FLOAT, o.normalized || !1, r, o.offset), this._caps.instancedArrays.vertexAttribDivisorANGLE(o.index, 1), this._currentInstanceLocations.push(o.index), this._currentInstanceBuffers.push(e)
}
} else
for (var s = 0; s < 4; s++) {
var a = i[s];
this._vertexAttribArraysEnabled[a] || (this._gl.enableVertexAttribArray(a), this._vertexAttribArraysEnabled[a] = !0), this.vertexAttribPointer(e, a, 4, this._gl.FLOAT, !1, 64, 16 * s), this._caps.instancedArrays.vertexAttribDivisorANGLE(a, 1), this._currentInstanceLocations.push(a), this._currentInstanceBuffers.push(e)
}
}, o.prototype.applyStates = function () {
this._depthCullingState.apply(this._gl), this._stencilState.apply(this._gl), this._alphaState.apply(this._gl)
}, o.prototype.draw = function (e, t, i, r) {
this.applyStates(), this._drawCalls.addCount(1, !1);
var n = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT,
o = this._uintIndicesCurrentlySet ? 4 : 2;
return r ? void this._caps.instancedArrays.drawElementsInstancedANGLE(e ? this._gl.TRIANGLES : this._gl.LINES, i, n, t * o, r) : void this._gl.drawElements(e ? this._gl.TRIANGLES : this._gl.LINES, i, n, t * o)
}, o.prototype.drawPointClouds = function (e, t, i) {
return this.applyStates(), this._drawCalls.addCount(1, !1), i ? void this._caps.instancedArrays.drawArraysInstancedANGLE(this._gl.POINTS, e, t, i) : void this._gl.drawArrays(this._gl.POINTS, e, t)
}, o.prototype.drawUnIndexed = function (e, t, i, r) {
return this.applyStates(), this._drawCalls.addCount(1, !1), r ? void this._caps.instancedArrays.drawArraysInstancedANGLE(e ? this._gl.TRIANGLES : this._gl.LINES, t, i, r) : void this._gl.drawArrays(e ? this._gl.TRIANGLES : this._gl.LINES, t, i)
}, o.prototype._releaseEffect = function (e) {
this._compiledEffects[e._key] && (delete this._compiledEffects[e._key], e.getProgram() && this._gl.deleteProgram(e.getProgram()))
}, o.prototype.createEffect = function (t, i, r, n, o, s, a, c, h) {
var u = (t.vertexElement || t.vertex || t) + "+" + (t.fragmentElement || t.fragment || t) + "@" + o;
if (this._compiledEffects[u]) return this._compiledEffects[u];
var l = new e.Effect(t, i, r, n, this, o, s, a, c, h);
return l._key = u, this._compiledEffects[u] = l, l
}, o.prototype.createEffectForParticles = function (e, t, i, r, n, o, s) {
return void 0 === t && (t = []), void 0 === i && (i = []), void 0 === r && (r = ""), this.createEffect({
vertex: "particles",
fragmentElement: e
}, ["position", "color", "options"], ["view", "projection"].concat(t), ["diffuseSampler"].concat(i), r, n, o, s)
}, o.prototype.createShaderProgram = function (e, i, r, n) {
n = n || this._gl;
var o = t(n, e, "vertex", r),
s = t(n, i, "fragment", r),
a = n.createProgram();
if (n.attachShader(a, o), n.attachShader(a, s), n.linkProgram(a), !n.getProgramParameter(a, n.LINK_STATUS)) {
var c = n.getProgramInfoLog(a);
if (c) throw new Error(c)
}
return n.deleteShader(o), n.deleteShader(s), a
}, o.prototype.getUniforms = function (e, t) {
for (var i = [], r = 0; r < t.length; r++) i.push(this._gl.getUniformLocation(e, t[r]));
return i
}, o.prototype.getAttributes = function (e, t) {
for (var i = [], r = 0; r < t.length; r++) try {
i.push(this._gl.getAttribLocation(e, t[r]))
} catch (e) {
i.push(-1)
}
return i
}, o.prototype.enableEffect = function (e) {
this.setProgram(e.getProgram()), this._currentEffect = e, e.onBind && e.onBind(e)
}, o.prototype.setIntArray = function (e, t) {
e && this._gl.uniform1iv(e, t)
}, o.prototype.setIntArray2 = function (e, t) {
e && t.length % 2 == 0 && this._gl.uniform2iv(e, t)
}, o.prototype.setIntArray3 = function (e, t) {
e && t.length % 3 == 0 && this._gl.uniform3iv(e, t)
}, o.prototype.setIntArray4 = function (e, t) {
e && t.length % 4 == 0 && this._gl.uniform4iv(e, t)
}, o.prototype.setFloatArray = function (e, t) {
e && this._gl.uniform1fv(e, t)
}, o.prototype.setFloatArray2 = function (e, t) {
e && t.length % 2 == 0 && this._gl.uniform2fv(e, t)
}, o.prototype.setFloatArray3 = function (e, t) {
e && t.length % 3 == 0 && this._gl.uniform3fv(e, t)
}, o.prototype.setFloatArray4 = function (e, t) {
e && t.length % 4 == 0 && this._gl.uniform4fv(e, t)
}, o.prototype.setArray = function (e, t) {
e && this._gl.uniform1fv(e, t)
}, o.prototype.setArray2 = function (e, t) {
e && t.length % 2 == 0 && this._gl.uniform2fv(e, t)
}, o.prototype.setArray3 = function (e, t) {
e && t.length % 3 == 0 && this._gl.uniform3fv(e, t)
}, o.prototype.setArray4 = function (e, t) {
e && t.length % 4 == 0 && this._gl.uniform4fv(e, t)
}, o.prototype.setMatrices = function (e, t) {
e && this._gl.uniformMatrix4fv(e, !1, t)
}, o.prototype.setMatrix = function (e, t) {
e && this._gl.uniformMatrix4fv(e, !1, t.toArray())
}, o.prototype.setMatrix3x3 = function (e, t) {
e && this._gl.uniformMatrix3fv(e, !1, t)
}, o.prototype.setMatrix2x2 = function (e, t) {
e && this._gl.uniformMatrix2fv(e, !1, t)
}, o.prototype.setFloat = function (e, t) {
e && this._gl.uniform1f(e, t)
}, o.prototype.setFloat2 = function (e, t, i) {
e && this._gl.uniform2f(e, t, i)
}, o.prototype.setFloat3 = function (e, t, i, r) {
e && this._gl.uniform3f(e, t, i, r)
}, o.prototype.setBool = function (e, t) {
e && this._gl.uniform1i(e, t)
}, o.prototype.setFloat4 = function (e, t, i, r, n) {
e && this._gl.uniform4f(e, t, i, r, n)
}, o.prototype.setColor3 = function (e, t) {
e && this._gl.uniform3f(e, t.r, t.g, t.b)
}, o.prototype.setColor4 = function (e, t, i) {
e && this._gl.uniform4f(e, t.r, t.g, t.b, i)
}, o.prototype.setState = function (e, t, i, r) {
void 0 === t && (t = 0), void 0 === r && (r = !1);
var n = r ? this._gl.FRONT : this._gl.BACK,
o = r ? this._gl.BACK : this._gl.FRONT,
s = this.cullBackFaces ? n : o;
(this._depthCullingState.cull !== e || i || this._depthCullingState.cullFace !== s) && (e ? (this._depthCullingState.cullFace = s, this._depthCullingState.cull = !0) : this._depthCullingState.cull = !1), this._depthCullingState.zOffset = t
}, o.prototype.setDepthBuffer = function (e) {
this._depthCullingState.depthTest = e
}, o.prototype.getDepthWrite = function () {
return this._depthCullingState.depthMask
}, o.prototype.setDepthWrite = function (e) {
this._depthCullingState.depthMask = e
}, o.prototype.setColorWrite = function (e) {
this._gl.colorMask(e, e, e, e)
}, o.prototype.setAlphaMode = function (e, t) {
if (void 0 === t && (t = !1), this._alphaMode !== e) {
switch (e) {
case o.ALPHA_DISABLE:
this._alphaState.alphaBlend = !1;
break;
case o.ALPHA_COMBINE:
this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
break;
case o.ALPHA_ONEONE:
this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0;
break;
case o.ALPHA_ADD:
this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE, this._gl.ZERO, this._gl.ONE), this._alphaState.alphaBlend = !0;
break;
case o.ALPHA_SUBTRACT:
this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
break;
case o.ALPHA_MULTIPLY:
this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR, this._gl.ZERO, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0;
break;
case o.ALPHA_MAXIMIZED:
this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_COLOR, this._gl.ONE, this._gl.ONE), this._alphaState.alphaBlend = !0
}
t || this.setDepthWrite(e === o.ALPHA_DISABLE), this._alphaMode = e
}
}, o.prototype.getAlphaMode = function () {
return this._alphaMode
}, o.prototype.setAlphaTesting = function (e) {
this._alphaTest = e
}, o.prototype.getAlphaTesting = function () {
return this._alphaTest
}, o.prototype.wipeCaches = function () {
this.resetTextureCache(), this._currentEffect = null, this._stencilState.reset(), this._depthCullingState.reset(), this.setDepthFunctionToLessOrEqual(), this._alphaState.reset(), this._cachedVertexBuffers = null, this._cachedIndexBuffer = null, this._cachedEffectForVertexBuffers = null
}, o.prototype.setSamplingMode = function (t, i) {
var r = this._gl;
this._bindTextureDirectly(r.TEXTURE_2D, t);
var n = r.NEAREST,
o = r.NEAREST;
i === e.Texture.BILINEAR_SAMPLINGMODE ? (n = r.LINEAR, o = r.LINEAR) : i === e.Texture.TRILINEAR_SAMPLINGMODE && (n = r.LINEAR, o = r.LINEAR_MIPMAP_LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, n), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, o), this._bindTextureDirectly(r.TEXTURE_2D, null), t.samplingMode = i
}, o.prototype.setTextureFormatToUse = function (e) {
for (var t = 0, i = this.texturesSupported.length; t < i; t++)
if (".astc" !== this._texturesSupported[t] && ".pvr" !== this._texturesSupported[t] && ".etc1" !== this._texturesSupported[t] && ".etc2" !== this._texturesSupported[t])
for (var r = 0, n = e.length; r < n; r++)
if (this._texturesSupported[t] === e[r].toLowerCase()) return this._textureFormatInUse = this._texturesSupported[t];
return this._textureFormatInUse = null
}, o.prototype.createTexture = function (t, i, r, o, s, a, c, h) {
var u = this;
void 0 === s && (s = e.Texture.TRILINEAR_SAMPLINGMODE), void 0 === a && (a = null), void 0 === c && (c = null), void 0 === h && (h = null);
var l, f = this._gl.createTexture(),
d = !1;
if ("data:" === t.substr(0, 5) && (d = !0), d) {
var p = t;
d = p.split(":"), t = p, l = d[1].substr(d[1].length - 4, 4).toLowerCase()
} else {
var m = t.lastIndexOf(".");
l = t.substring(m).toLowerCase(), !this._textureFormatInUse || d || o.database || (l = this._textureFormatInUse, t = t.substring(0, m) + this._textureFormatInUse)
}
var g = ".dds" === l,
_ = ".tga" === l;
o._addPendingData(f), f.url = t, f.noMipmap = i, f.references = 1, f.samplingMode = s, f.onLoadedCallbacks = [a], this._loadedTexturesCache.push(f);
var v, y = function () {
o._removePendingData(f), c && c()
};
if (_) v = function (t) {
var a = new Uint8Array(t),
c = e.Internals.TGATools.GetTGAHeader(a);
n(f, u._gl, o, c.width, c.height, r, i, !1, function () {
e.Internals.TGATools.UploadContent(u._gl, a)
}, s)
}, d instanceof Array ? v(h) : e.Tools.LoadFile(t, function (e) {
v(e)
}, null, o.database, !0, y);
else if (g) v = function (t) {
var a = e.Internals.DDSTools.GetDDSInfo(t),
c = (a.isRGB || a.isLuminance || a.mipmapCount > 1) && !i && a.width >> a.mipmapCount - 1 == 1;
n(f, u._gl, o, a.width, a.height, r, !c, a.isFourCC, function () {
e.Internals.DDSTools.UploadDDSLevels(u._gl, u.getCaps().s3tc, t, a, c, 1)
}, s)
}, d instanceof Array ? v(h) : e.Tools.LoadFile(t, function (e) {
v(e)
}, null, o.database, !0, y);
else {
var b = function (t) {
n(f, u._gl, o, t.width, t.height, r, i, !1, function (i, r) {
var n = t.width === i && t.height === r;
n || (u._prepareWorkingCanvas(), u._workingCanvas.width = i, u._workingCanvas.height = r, s === e.Texture.NEAREST_SAMPLINGMODE && (u._workingContext.imageSmoothingEnabled = !1, u._workingContext.mozImageSmoothingEnabled = !1, u._workingContext.oImageSmoothingEnabled = !1, u._workingContext.webkitImageSmoothingEnabled = !1, u._workingContext.msImageSmoothingEnabled = !1), u._workingContext.drawImage(t, 0, 0, t.width, t.height, 0, 0, i, r), s === e.Texture.NEAREST_SAMPLINGMODE && (u._workingContext.imageSmoothingEnabled = !0, u._workingContext.mozImageSmoothingEnabled = !0, u._workingContext.oImageSmoothingEnabled = !0, u._workingContext.webkitImageSmoothingEnabled = !0, u._workingContext.msImageSmoothingEnabled = !0)), u._gl.texImage2D(u._gl.TEXTURE_2D, 0, u._gl.RGBA, u._gl.RGBA, u._gl.UNSIGNED_BYTE, n ? t : u._workingCanvas)
}, s)
};
d instanceof Array ? e.Tools.LoadImage(h, b, y, o.database) : e.Tools.LoadImage(t, b, y, o.database)
}
return f
}, o.prototype._getInternalFormat = function (e) {
var t = this._gl.RGBA;
switch (e) {
case o.TEXTUREFORMAT_ALPHA:
t = this._gl.ALPHA;
break;
case o.TEXTUREFORMAT_LUMINANCE:
t = this._gl.LUMINANCE;
break;
case o.TEXTUREFORMAT_LUMINANCE_ALPHA:
t = this._gl.LUMINANCE_ALPHA;
break;
case o.TEXTUREFORMAT_RGB:
t = this._gl.RGB;
break;
case o.TEXTUREFORMAT_RGBA:
t = this._gl.RGBA
}
return t
}, o.prototype.updateRawTexture = function (e, t, i, r, n) {
void 0 === n && (n = null);
var o = this._getInternalFormat(i);
this._bindTextureDirectly(this._gl.TEXTURE_2D, e), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, void 0 === r ? 1 : r ? 1 : 0), e._width % 4 != 0 && this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT, 1), n ? this._gl.compressedTexImage2D(this._gl.TEXTURE_2D, 0, this.getCaps().s3tc[n], e._width, e._height, 0, t) : this._gl.texImage2D(this._gl.TEXTURE_2D, 0, o, e._width, e._height, 0, o, this._gl.UNSIGNED_BYTE, t), e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this.resetTextureCache(), e.isReady = !0
}, o.prototype.createRawTexture = function (e, t, i, n, o, s, a, c) {
void 0 === c && (c = null);
var h = this._gl.createTexture();
h._baseWidth = t, h._baseHeight = i, h._width = t, h._height = i, h.references = 1, this.updateRawTexture(h, e, n, s, c), this._bindTextureDirectly(this._gl.TEXTURE_2D, h);
var u = r(a, o, this._gl);
return this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, u.mag), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, u.min), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), h.samplingMode = a, this._loadedTexturesCache.push(h), h
}, o.prototype.createDynamicTexture = function (t, i, r, n) {
var o = this._gl.createTexture();
return o._baseWidth = t, o._baseHeight = i, r && (t = e.Tools.GetExponentOfTwo(t, this._caps.maxTextureSize), i = e.Tools.GetExponentOfTwo(i, this._caps.maxTextureSize)), this.resetTextureCache(), o._width = t, o._height = i, o.isReady = !1, o.generateMipMaps = r, o.references = 1, o.samplingMode = n, this.updateTextureSamplingMode(n, o), this._loadedTexturesCache.push(o), o
}, o.prototype.updateTextureSamplingMode = function (e, t) {
var i = r(e, t.generateMipMaps, this._gl);
t.isCube ? (this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, t), this._gl.texParameteri(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MAG_FILTER, i.mag), this._gl.texParameteri(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MIN_FILTER, i.min), this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null)) : (this._bindTextureDirectly(this._gl.TEXTURE_2D, t), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, i.mag), this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, i.min), this._bindTextureDirectly(this._gl.TEXTURE_2D, null))
}, o.prototype.updateDynamicTexture = function (e, t, i, r) {
void 0 === r && (r = !1), this._bindTextureDirectly(this._gl.TEXTURE_2D, e), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, i ? 1 : 0), r && this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t), e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), r && this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), this.resetTextureCache(), e.isReady = !0
}, o.prototype.updateVideoTexture = function (e, t, i) {
if (!e._isDisabled) {
this._bindTextureDirectly(this._gl.TEXTURE_2D, e), this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, i ? 0 : 1);
try {
void 0 === this._videoTextureSupported && (this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t), 0 !== this._gl.getError() ? this._videoTextureSupported = !1 : this._videoTextureSupported = !0), this._videoTextureSupported ? this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, t) : (e._workingCanvas || (e._workingCanvas = document.createElement("canvas"), e._workingContext = e._workingCanvas.getContext("2d"), e._workingCanvas.width = e._width, e._workingCanvas.height = e._height), e._workingContext.drawImage(t, 0, 0, t.videoWidth, t.videoHeight, 0, 0, e._width, e._height), this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, e._workingCanvas)), e.generateMipMaps && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(this._gl.TEXTURE_2D, null), this.resetTextureCache(), e.isReady = !0
} catch (t) {
e._isDisabled = !0
}
}
}, o.prototype.createRenderTargetTexture = function (t, n) {
var s = !1,
a = !0,
c = !1,
h = o.TEXTURETYPE_UNSIGNED_INT,
u = e.Texture.TRILINEAR_SAMPLINGMODE;
void 0 !== n && (s = void 0 === n.generateMipMaps ? n : n.generateMipMaps, c = (a = void 0 === n.generateDepthBuffer || n.generateDepthBuffer) && n.generateStencilBuffer, h = void 0 === n.type ? h : n.type, void 0 !== n.samplingMode && (u = n.samplingMode), (h !== o.TEXTURETYPE_FLOAT || this._caps.textureFloatLinearFiltering) && (h !== o.TEXTURETYPE_HALF_FLOAT || this._caps.textureHalfFloatLinearFiltering) || (u = e.Texture.NEAREST_SAMPLINGMODE));
var l = this._gl,
f = l.createTexture();
this._bindTextureDirectly(l.TEXTURE_2D, f);
var d, p = t.width || t,
m = t.height || t,
g = r(u, s, l);
h !== o.TEXTURETYPE_FLOAT || this._caps.textureFloat || (h = o.TEXTURETYPE_UNSIGNED_INT, e.Tools.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")), l.texParameteri(l.TEXTURE_2D, l.TEXTURE_MAG_FILTER, g.mag), l.texParameteri(l.TEXTURE_2D, l.TEXTURE_MIN_FILTER, g.min), l.texParameteri(l.TEXTURE_2D, l.TEXTURE_WRAP_S, l.CLAMP_TO_EDGE), l.texParameteri(l.TEXTURE_2D, l.TEXTURE_WRAP_T, l.CLAMP_TO_EDGE), l.texImage2D(l.TEXTURE_2D, 0, l.RGBA, p, m, 0, l.RGBA, i(l, h), null), c ? (d = l.createRenderbuffer(), l.bindRenderbuffer(l.RENDERBUFFER, d), l.renderbufferStorage(l.RENDERBUFFER, l.DEPTH_STENCIL, p, m)) : a && (d = l.createRenderbuffer(), l.bindRenderbuffer(l.RENDERBUFFER, d), l.renderbufferStorage(l.RENDERBUFFER, l.DEPTH_COMPONENT16, p, m));
var _ = l.createFramebuffer();
return this.bindUnboundFramebuffer(_), c ? l.framebufferRenderbuffer(l.FRAMEBUFFER, l.DEPTH_STENCIL_ATTACHMENT, l.RENDERBUFFER, d) : a && l.framebufferRenderbuffer(l.FRAMEBUFFER, l.DEPTH_ATTACHMENT, l.RENDERBUFFER, d), l.framebufferTexture2D(l.FRAMEBUFFER, l.COLOR_ATTACHMENT0, l.TEXTURE_2D, f, 0), s && this._gl.generateMipmap(this._gl.TEXTURE_2D), this._bindTextureDirectly(l.TEXTURE_2D, null), l.bindRenderbuffer(l.RENDERBUFFER, null), this.bindUnboundFramebuffer(null), f._framebuffer = _, a && (f._depthBuffer = d), f._baseWidth = p, f._baseHeight = m, f._width = p, f._height = m, f.isReady = !0, f.generateMipMaps = s, f.references = 1, f.samplingMode = u, f.type = h, this.resetTextureCache(), this._loadedTexturesCache.push(f), f
}, o.prototype.createRenderTargetCubeTexture = function (t, i) {
var n = this._gl,
o = n.createTexture(),
s = !0,
a = !0,
c = !1,
h = e.Texture.TRILINEAR_SAMPLINGMODE;
void 0 !== i && (s = void 0 === i.generateMipMaps ? i : i.generateMipMaps, c = (a = void 0 === i.generateDepthBuffer || i.generateDepthBuffer) && i.generateStencilBuffer, void 0 !== i.samplingMode && (h = i.samplingMode)), o.isCube = !0, o.references = 1, o.generateMipMaps = s, o.references = 1, o.samplingMode = h;
var u, l = r(h, s, n);
this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, o);
for (var f = 0; f < 6; f++) n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X + f, 0, n.RGBA, t, t, 0, n.RGBA, n.UNSIGNED_BYTE, null);
n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MAG_FILTER, l.mag), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_MIN_FILTER, l.min), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_CUBE_MAP, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), c ? (u = n.createRenderbuffer(), n.bindRenderbuffer(n.RENDERBUFFER, u), n.renderbufferStorage(n.RENDERBUFFER, n.DEPTH_STENCIL, t, t)) : a && (u = n.createRenderbuffer(), n.bindRenderbuffer(n.RENDERBUFFER, u), n.renderbufferStorage(n.RENDERBUFFER, n.DEPTH_COMPONENT16, t, t));
var d = n.createFramebuffer();
return this.bindUnboundFramebuffer(d), c ? n.framebufferRenderbuffer(n.FRAMEBUFFER, n.DEPTH_STENCIL_ATTACHMENT, n.RENDERBUFFER, u) : a && n.framebufferRenderbuffer(n.FRAMEBUFFER, n.DEPTH_ATTACHMENT, n.RENDERBUFFER, u), o.generateMipMaps && (this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, o), n.generateMipmap(n.TEXTURE_CUBE_MAP)), this._bindTextureDirectly(n.TEXTURE_CUBE_MAP, null), n.bindRenderbuffer(n.RENDERBUFFER, null), this.bindUnboundFramebuffer(null), o._framebuffer = d, a && (o._depthBuffer = u), o._width = t, o._height = t, o.isReady = !0, this.resetTextureCache(), this._loadedTexturesCache.push(o), o
}, o.prototype.createCubeTexture = function (t, i, r, n, o, a) {
var c = this;
void 0 === o && (o = null), void 0 === a && (a = null);
var h = this._gl,
u = h.createTexture();
u.isCube = !0, u.url = t, u.references = 1, u.onLoadedCallbacks = [];
var l = t.substr(t.length - 4, 4).toLowerCase();
return this.getCaps().s3tc && ".dds" === l ? e.Tools.LoadFile(t, function (t) {
var i = e.Internals.DDSTools.GetDDSInfo(t),
r = (i.isRGB || i.isLuminance || i.mipmapCount > 1) && !n;
c._bindTextureDirectly(h.TEXTURE_CUBE_MAP, u), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 1), e.Internals.DDSTools.UploadDDSLevels(c._gl, c.getCaps().s3tc, t, i, r, 6), n || i.isFourCC || 1 !== i.mipmapCount || h.generateMipmap(h.TEXTURE_CUBE_MAP), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_MAG_FILTER, h.LINEAR), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_MIN_FILTER, r ? h.LINEAR_MIPMAP_LINEAR : h.LINEAR), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_WRAP_S, h.CLAMP_TO_EDGE), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_WRAP_T, h.CLAMP_TO_EDGE), c._bindTextureDirectly(h.TEXTURE_CUBE_MAP, null), c.resetTextureCache(), u._width = i.width, u._height = i.height, u.isReady = !0
}, null, null, !0, a) : s(0, i, function (t) {
var i = e.Tools.GetExponentOfTwo(t[0].width, c._caps.maxCubemapTextureSize),
r = i;
c._prepareWorkingCanvas(), c._workingCanvas.width = i, c._workingCanvas.height = r;
var s = [h.TEXTURE_CUBE_MAP_POSITIVE_X, h.TEXTURE_CUBE_MAP_POSITIVE_Y, h.TEXTURE_CUBE_MAP_POSITIVE_Z, h.TEXTURE_CUBE_MAP_NEGATIVE_X, h.TEXTURE_CUBE_MAP_NEGATIVE_Y, h.TEXTURE_CUBE_MAP_NEGATIVE_Z];
c._bindTextureDirectly(h.TEXTURE_CUBE_MAP, u), h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL, 0);
for (var a = 0; a < s.length; a++) c._workingContext.drawImage(t[a], 0, 0, t[a].width, t[a].height, 0, 0, i, r), h.texImage2D(s[a], 0, h.RGBA, h.RGBA, h.UNSIGNED_BYTE, c._workingCanvas);
n || h.generateMipmap(h.TEXTURE_CUBE_MAP), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_MAG_FILTER, h.LINEAR), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_MIN_FILTER, n ? h.LINEAR : h.LINEAR_MIPMAP_LINEAR), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_WRAP_S, h.CLAMP_TO_EDGE), h.texParameteri(h.TEXTURE_CUBE_MAP, h.TEXTURE_WRAP_T, h.CLAMP_TO_EDGE), c._bindTextureDirectly(h.TEXTURE_CUBE_MAP, null), c.resetTextureCache(), u._width = i, u._height = r, u.isReady = !0, u.onLoadedCallbacks.forEach(function (e) {
e()
}), o && o()
}, r, a), this._loadedTexturesCache.push(u), u
}, o.prototype.updateTextureSize = function (e, t, i) {
e._width = t, e._height = i, e._size = t * i, e._baseWidth = t, e._baseHeight = i
}, o.prototype.createRawCubeTexture = function (t, i, r, n, s, a, c, h) {
var u = this,
l = this._gl,
f = l.createTexture();
i._addPendingData(f), f.isCube = !0, f.references = 1, f.url = t;
var d = this._getInternalFormat(n),
p = l.UNSIGNED_BYTE;
s === o.TEXTURETYPE_FLOAT && (p = l.FLOAT);
var m = r,
g = m,
_ = e.Tools.IsExponentOfTwo(m) && e.Tools.IsExponentOfTwo(g);
f._width = m, f._height = g;
var v = function (t) {
var r = c(t),
n = [l.TEXTURE_CUBE_MAP_POSITIVE_X, l.TEXTURE_CUBE_MAP_POSITIVE_Y, l.TEXTURE_CUBE_MAP_POSITIVE_Z, l.TEXTURE_CUBE_MAP_NEGATIVE_X, l.TEXTURE_CUBE_MAP_NEGATIVE_Y, l.TEXTURE_CUBE_MAP_NEGATIVE_Z];
if (m = f._width, g = f._height, _ = e.Tools.IsExponentOfTwo(m) && e.Tools.IsExponentOfTwo(g), u._bindTextureDirectly(l.TEXTURE_CUBE_MAP, f), l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL, 0), !a && _)
if (h) {
var o = [];
o.push(r[0]), o.push(r[3]), o.push(r[1]), o.push(r[4]), o.push(r[2]), o.push(r[5]);
for (var s = h(o), v = 0; v < s.length; v++) {
var y = m >> v;
l.texImage2D(n[0], v, d, y, y, 0, d, p, s[v][0]), l.texImage2D(n[1], v, d, y, y, 0, d, p, s[v][2]), l.texImage2D(n[2], v, d, y, y, 0, d, p, s[v][4]), l.texImage2D(n[3], v, d, y, y, 0, d, p, s[v][1]), l.texImage2D(n[4], v, d, y, y, 0, d, p, s[v][3]), l.texImage2D(n[5], v, d, y, y, 0, d, p, s[v][5])
}
} else {
for (var b = 0; b < n.length; b++) {
var x = r[b];
l.texImage2D(n[b], 0, d, m, g, 0, d, p, x)
}
if (l.generateMipmap(l.TEXTURE_CUBE_MAP), p === l.FLOAT && d === l.RGB && 1282 === l.getError()) {
e.Tools.Log("RGB32F not renderable on Firefox, trying fallback to RGBA32F.");
for (b = 0; b < n.length; b++) {
x = r[b];
for (var w = new Float32Array(m * g * 4), S = 0; S < m; S++)
for (var T = 0; T < g; T++) {
var A = 3 * (T * m + S),
M = 4 * (T * m + S);
w[M + 0] = x[A + 0], w[M + 1] = x[A + 1], w[M + 2] = x[A + 2], w[M + 3] = 1
}
l.texImage2D(n[b], 0, l.RGBA, m, g, 0, l.RGBA, p, w)
}
l.generateMipmap(l.TEXTURE_CUBE_MAP)
}
}
else a = !0;
p === l.FLOAT && !u._caps.textureFloatLinearFiltering || 36193 === p && !u._caps.textureHalfFloatLinearFiltering ? (l.texParameteri(l.TEXTURE_CUBE_MAP, l.TEXTURE_MAG_FILTER, l.NEAREST), l.texParameteri(l.TEXTURE_CUBE_MAP, l.TEXTURE_MIN_FILTER, l.NEAREST)) : (l.texParameteri(l.TEXTURE_CUBE_MAP, l.TEXTURE_MAG_FILTER, l.LINEAR), l.texParameteri(l.TEXTURE_CUBE_MAP, l.TEX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment