(this.webpackJsonp = this.webpackJsonp || []).push([ [2], [function(t, e, r) { "use strict"; r.r(e); var n = {}; r.r(n), r.d(n, "isMobile", function() { return h.a }), r.d(n, "EventEmitter", function() { return l.a }), r.d(n, "earcut", function() { return d.a }), r.d(n, "url", function() { return m.a }), r.d(n, "BaseTextureCache", function() { return k }), r.d(n, "CanvasRenderTarget", function() { return L }), r.d(n, "DATA_URI", function() { return U }), r.d(n, "ProgramCache", function() { return D }), r.d(n, "TextureCache", function() { return F }), r.d(n, "clearTextureCache", function() { return clearTextureCache }), r.d(n, "correctBlendMode", function() { return correctBlendMode }), r.d(n, "createIndicesForQuads", function() { return createIndicesForQuads }), r.d(n, "decomposeDataUri", function() { return decomposeDataUri }), r.d(n, "deprecation", function() { return deprecation }), r.d(n, "destroyTextureCache", function() { return destroyTextureCache }), r.d(n, "determineCrossOrigin", function() { return determineCrossOrigin }), r.d(n, "getResolutionOfUrl", function() { return getResolutionOfUrl }), r.d(n, "hex2rgb", function() { return hex2rgb }), r.d(n, "hex2string", function() { return hex2string }), r.d(n, "isPow2", function() { return isPow2 }), r.d(n, "isWebGLSupported", function() { return isWebGLSupported }), r.d(n, "log2", function() { return log2 }), r.d(n, "nextPow2", function() { return nextPow2 }), r.d(n, "premultiplyBlendMode", function() { return C }), r.d(n, "premultiplyRgba", function() { return premultiplyRgba }), r.d(n, "premultiplyTint", function() { return premultiplyTint }), r.d(n, "premultiplyTintToRgba", function() { return premultiplyTintToRgba }), r.d(n, "removeItems", function() { return removeItems }), r.d(n, "rgb2hex", function() { return rgb2hex }), r.d(n, "sayHello", function() { return sayHello }), r.d(n, "sign", function() { return sign }), r.d(n, "skipHello", function() { return skipHello }), r.d(n, "string2hex", function() { return string2hex }), r.d(n, "trimCanvas", function() { return trimCanvas }), r.d(n, "uid", function() { return uid }); var i = {}; r.r(i), r.d(i, "AccessibilityManager", function() { return vt }), r.d(i, "accessibleTarget", function() { return mt }); var o = {}; r.r(o), r.d(o, "Extract", function() { return fr }); var a = {}; r.r(a), r.d(a, "InteractionData", function() { return dr }), r.d(a, "InteractionEvent", function() { return mr }), r.d(a, "InteractionManager", function() { return br }), r.d(a, "InteractionTrackingData", function() { return vr }), r.d(a, "interactiveTarget", function() { return yr }); var s = {}; r.r(s), r.d(s, "BasePrepare", function() { return $r }), r.d(s, "CountLimiter", function() { return Jr }), r.d(s, "Prepare", function() { return tn }), r.d(s, "TimeLimiter", function() { return en }); r(401); var u = r(46), h = r.n(u); var M = { MIPMAP_TEXTURES: 1, RESOLUTION: 1, FILTER_RESOLUTION: 1, SPRITE_MAX_TEXTURES: function(t) { var e = !0; if (h.a.tablet || h.a.phone) { if (e = !1, h.a.apple.device) { var r = navigator.userAgent.match(/OS (\d+)_(\d+)?/); r && 11 <= parseInt(r[1], 10) && (e = !0) } if (h.a.android.device) { var n = navigator.userAgent.match(/Android\s([0-9.]*)/); n && 7 <= parseInt(n[1], 10) && (e = !0) } } return e ? t : 4 }(32), SPRITE_BATCH_SIZE: 4096, RENDER_OPTIONS: { view: null, antialias: !1, forceFXAA: !1, autoResize: !1, transparent: !1, backgroundColor: 0, clearBeforeRender: !0, preserveDrawingBuffer: !1, width: 800, height: 600, legacy: !1 }, GC_MODE: 0, GC_MAX_IDLE: 3600, GC_MAX_CHECK_COUNT: 600, WRAP_MODE: 33071, SCALE_MODE: 1, PRECISION_VERTEX: "highp", PRECISION_FRAGMENT: h.a.apple.device ? "highp" : "mediump", CAN_UPLOAD_SAME_BUFFER: !h.a.apple.device, CREATE_IMAGE_BITMAP: !0, ROUND_PIXELS: !1 }, c = r(170), l = r.n(c), f = r(171), d = r.n(f), p = r(89), m = r.n(p), v = { WEBGL_LEGACY: 0, WEBGL: 1, WEBGL2: 2 }, g = { UNKNOWN: 0, WEBGL: 1, CANVAS: 2 }, y = { NORMAL: 0, ADD: 1, MULTIPLY: 2, SCREEN: 3, OVERLAY: 4, DARKEN: 5, LIGHTEN: 6, COLOR_DODGE: 7, COLOR_BURN: 8, HARD_LIGHT: 9, SOFT_LIGHT: 10, DIFFERENCE: 11, EXCLUSION: 12, HUE: 13, SATURATION: 14, COLOR: 15, LUMINOSITY: 16, NORMAL_NPM: 17, ADD_NPM: 18, SCREEN_NPM: 19, NONE: 20, SRC_OVER: 0, SRC_IN: 21, SRC_OUT: 22, SRC_ATOP: 23, DST_OVER: 24, DST_IN: 25, DST_OUT: 26, DST_ATOP: 27, ERASE: 26, SUBTRACT: 28 }, x = { POINTS: 0, LINES: 1, LINE_LOOP: 2, LINE_STRIP: 3, TRIANGLES: 4, TRIANGLE_STRIP: 5, TRIANGLE_FAN: 6 }, _ = { RGBA: 6408, RGB: 6407, ALPHA: 6406, LUMINANCE: 6409, LUMINANCE_ALPHA: 6410, DEPTH_COMPONENT: 6402, DEPTH_STENCIL: 34041 }, b = { TEXTURE_2D: 3553, TEXTURE_CUBE_MAP: 34067, TEXTURE_2D_ARRAY: 35866, TEXTURE_CUBE_MAP_POSITIVE_X: 34069, TEXTURE_CUBE_MAP_NEGATIVE_X: 34070, TEXTURE_CUBE_MAP_POSITIVE_Y: 34071, TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072, TEXTURE_CUBE_MAP_POSITIVE_Z: 34073, TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074 }, w = { UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123, UNSIGNED_SHORT_5_6_5: 33635, UNSIGNED_SHORT_4_4_4_4: 32819, UNSIGNED_SHORT_5_5_5_1: 32820, FLOAT: 5126, HALF_FLOAT: 36193 }, T = { LINEAR: 1, NEAREST: 0 }, S = { CLAMP: 33071, REPEAT: 10497, MIRRORED_REPEAT: 33648 }, E = { OFF: 0, POW2: 1, ON: 2 }, A = { AUTO: 0, MANUAL: 1 }, P = { LOW: "lowp", MEDIUM: "mediump", HIGH: "highp" }, I = !(M.RETINA_PREFIX = /@([0-9\.]+)x/), O = "5.0.0-rc.3"; function skipHello() { I = !0 } function sayHello(t) { if (!I) { if (-1 < navigator.userAgent.toLowerCase().indexOf("chrome")) { var e = ["\n %c %c %c PixiJS " + O + " - ✰ " + t + " ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n", "background: #ff66a5; padding:5px 0;", "background: #ff66a5; padding:5px 0;", "color: #ff66a5; background: #030307; padding:5px 0;", "background: #ff66a5; padding:5px 0;", "background: #ffc3dc; padding:5px 0;", "background: #ff66a5; padding:5px 0;", "color: #ff2424; background: #fff; padding:5px 0;", "color: #ff2424; background: #fff; padding:5px 0;", "color: #ff2424; background: #fff; padding:5px 0;"]; window.console.log.apply(console, e) } else window.console && window.console.log("PixiJS " + O + " - " + t + " - http://www.pixijs.com/"); I = !0 } } function isWebGLSupported() { var t = { stencil: !0, failIfMajorPerformanceCaveat: !0 }; try { if (!window.WebGLRenderingContext) return !1; var e = document.createElement("canvas"), r = e.getContext("webgl", t) || e.getContext("experimental-webgl", t), n = !(!r || !r.getContextAttributes().stencil); if (r) { var i = r.getExtension("WEBGL_lose_context"); i && i.loseContext() } return r = null, n } catch (t) { return !1 } } function hex2rgb(t, e) { return (e = e || [])[0] = (t >> 16 & 255) / 255, e[1] = (t >> 8 & 255) / 255, e[2] = (255 & t) / 255, e } function hex2string(t) { return t = t.toString(16), "#" + (t = "000000".substr(0, 6 - t.length) + t) } function string2hex(t) { return "string" == typeof t && "#" === t[0] && (t = t.substr(1)), parseInt(t, 16) } function rgb2hex(t) { return (255 * t[0] << 16) + (255 * t[1] << 8) + (255 * t[2] | 0) } var C = function() { for (var t = [], e = [], r = 0; r < 32; r++) e[t[r] = r] = r; t[y.NORMAL_NPM] = y.NORMAL, t[y.ADD_NPM] = y.ADD, t[y.SCREEN_NPM] = y.SCREEN, e[y.NORMAL] = y.NORMAL_NPM, e[y.ADD] = y.ADD_NPM, e[y.SCREEN] = y.SCREEN_NPM; var n = []; return n.push(e), n.push(t), n }(); function correctBlendMode(t, e) { return C[e ? 1 : 0][t] } function premultiplyRgba(t, e, r, n) { return (r = r || new Float32Array(4))[2] = n || void 0 === n ? (r[0] = t[0] * e, r[1] = t[1] * e, t[2] * e) : (r[0] = t[0], r[1] = t[1], t[2]), r[3] = e, r } function premultiplyTint(t, e) { if (1 === e) return (255 * e << 24) + t; if (0 === e) return 0; var r = t >> 16 & 255, n = t >> 8 & 255, i = 255 & t; return (255 * e << 24) + ((r = r * e + .5 | 0) << 16) + ((n = n * e + .5 | 0) << 8) + (i = i * e + .5 | 0) } function premultiplyTintToRgba(t, e, r, n) { return (r = r || new Float32Array(4))[0] = (t >> 16 & 255) / 255, r[1] = (t >> 8 & 255) / 255, r[2] = (255 & t) / 255, (n || void 0 === n) && (r[0] *= e, r[1] *= e, r[2] *= e), r[3] = e, r } function createIndicesForQuads(t) { for (var e = 6 * t, r = new Uint16Array(e), n = 0, i = 0; n < e; n += 6, i += 4) r[n + 0] = i + 0, r[n + 1] = i + 1, r[n + 2] = i + 2, r[n + 3] = i + 0, r[n + 4] = i + 2, r[n + 5] = i + 3; return r } function removeItems(t, e, r) { var n, i = t.length; if (!(i <= e || 0 === r)) { var o = i - (r = i < e + r ? i - e : r); for (n = e; n < o; ++n) t[n] = t[n + r]; t.length = o } } var R = 0; function uid() { return ++R } function sign(t) { return 0 === t ? 0 : t < 0 ? -1 : 1 } function nextPow2(t) { return t += 0 === t, --t, t |= t >>> 1, t |= t >>> 2, t |= t >>> 4, t |= t >>> 8, (t |= t >>> 16) + 1 } function isPow2(t) { return !(t & t - 1 || !t) } function log2(t) { var e = (65535 < t) << 4, r = (255 < (t >>>= e)) << 3; return e |= r, e |= r = (15 < (t >>>= r)) << 2, (e |= r = (3 < (t >>>= r)) << 1) | (t >>>= r) >> 1 } var D = {}, F = Object.create(null), k = Object.create(null); function destroyTextureCache() { var t; for (t in F) F[t].destroy(); for (t in k) k[t].destroy() } function clearTextureCache() { var t; for (t in F) delete F[t]; for (t in k) delete k[t] } function trimCanvas(t) { var e, r, n, i = t.width, o = t.height, a = t.getContext("2d"), s = a.getImageData(0, 0, i, o).data, u = s.length, h = { top: null, left: null, right: null, bottom: null }, c = null; for (e = 0; e < u; e += 4) 0 !== s[e + 3] && (r = e / 4 % i, n = ~~(e / 4 / i), null === h.top && (h.top = n), null === h.left ? h.left = r : r < h.left && (h.left = r), null === h.right ? h.right = r + 1 : h.right < r && (h.right = r + 1), null === h.bottom ? h.bottom = n : h.bottom < n && (h.bottom = n)); return null !== h.top && (i = h.right - h.left, o = h.bottom - h.top + 1, c = a.getImageData(h.left, h.top, i, o)), { height: o, width: i, data: c } } var L = function(t, e, r) { this.canvas = document.createElement("canvas"), this.context = this.canvas.getContext("2d"), this.resolution = r || M.RESOLUTION, this.resize(t, e) }, N = { width: { configurable: !0 }, height: { configurable: !0 } }; L.prototype.clear = function() { this.context.setTransform(1, 0, 0, 1, 0, 0), this.context.clearRect(0, 0, this.canvas.width, this.canvas.height) }, L.prototype.resize = function(t, e) { this.canvas.width = t * this.resolution, this.canvas.height = e * this.resolution }, L.prototype.destroy = function() { this.context = null, this.canvas = null }, N.width.get = function() { return this.canvas.width }, N.width.set = function(t) { this.canvas.width = t }, N.height.get = function() { return this.canvas.height }, N.height.set = function(t) { this.canvas.height = t }, Object.defineProperties(L.prototype, N); var B, U = /^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i; function decomposeDataUri(t) { var e = U.exec(t); if (e) return { mediaType: e[1] ? e[1].toLowerCase() : void 0, subType: e[2] ? e[2].toLowerCase() : void 0, charset: e[3] ? e[3].toLowerCase() : void 0, encoding: e[4] ? e[4].toLowerCase() : void 0, data: e[5] } } function determineCrossOrigin(t, e) { if (void 0 === e && (e = window.location), 0 === t.indexOf("data:")) return ""; e = e || window.location, B || (B = document.createElement("a")), B.href = t; var r = !(t = m.a.parse(B.href)).port && "" === e.port || t.port === e.port; return t.hostname === e.hostname && r && t.protocol === e.protocol ? "" : "anonymous" } function getResolutionOfUrl(t, e) { var r = M.RETINA_PREFIX.exec(t); return r ? parseFloat(r[1]) : void 0 !== e ? e : 1 } var G = {}; function deprecation(t, e, r) { if (void 0 === r && (r = 3), !G[e]) { var n = (new Error).stack; void 0 === n || (n = n.split("\n").splice(r).join("\n"), console.groupCollapsed), G[e] = !0 } } var q = function(t, e) { void 0 === t && (t = 0), void 0 === e && (e = 0), this.x = t, this.y = e }; q.prototype.clone = function() { return new q(this.x, this.y) }, q.prototype.copyFrom = function(t) { return this.set(t.x, t.y), this }, q.prototype.copyTo = function(t) { return t.set(this.x, this.y), t }, q.prototype.equals = function(t) { return t.x === this.x && t.y === this.y }, q.prototype.set = function(t, e) { this.x = t || 0, this.y = e || (0 !== e ? this.x : 0) }; var j = function(t, e, r, n) { void 0 === r && (r = 0), void 0 === n && (n = 0), this._x = r, this._y = n, this.cb = t, this.scope = e }, z = { x: { configurable: !0 }, y: { configurable: !0 } }; j.prototype.clone = function(t, e) { void 0 === t && (t = null), void 0 === e && (e = null); var r = t || this.cb, n = e || this.scope; return new j(r, n, this._x, this._y) }, j.prototype.set = function(t, e) { var r = t || 0, n = e || (0 !== e ? r : 0); this._x === r && this._y === n || (this._x = r, this._y = n, this.cb.call(this.scope)) }, j.prototype.copyFrom = function(t) { return this._x === t.x && this._y === t.y || (this._x = t.x, this._y = t.y, this.cb.call(this.scope)), this }, j.prototype.copyTo = function(t) { return t.set(this._x, this._y), t }, j.prototype.equals = function(t) { return t.x === this._x && t.y === this._y }, z.x.get = function() { return this._x }, z.x.set = function(t) { this._x !== t && (this._x = t, this.cb.call(this.scope)) }, z.y.get = function() { return this._y }, z.y.set = function(t) { this._y !== t && (this._y = t, this.cb.call(this.scope)) }, Object.defineProperties(j.prototype, z); var X = 2 * Math.PI, V = 180 / Math.PI, H = Math.PI / 180, W = { POLY: 0, RECT: 1, CIRC: 2, ELIP: 3, RREC: 4 }, Y = function(t, e, r, n, i, o) { void 0 === t && (t = 1), void 0 === e && (e = 0), void 0 === r && (r = 0), void 0 === n && (n = 1), void 0 === i && (i = 0), void 0 === o && (o = 0), this.a = t, this.b = e, this.c = r, this.d = n, this.tx = i, this.ty = o, this.array = null }, K = { IDENTITY: { configurable: !0 }, TEMP_MATRIX: { configurable: !0 } }; Y.prototype.fromArray = function(t) { this.a = t[0], this.b = t[1], this.c = t[3], this.d = t[4], this.tx = t[2], this.ty = t[5] }, Y.prototype.set = function(t, e, r, n, i, o) { return this.a = t, this.b = e, this.c = r, this.d = n, this.tx = i, this.ty = o, this }, Y.prototype.toArray = function(t, e) { this.array || (this.array = new Float32Array(9)); var r = e || this.array; return r[8] = (r[7] = t ? (r[0] = this.a, r[1] = this.b, r[2] = 0, r[3] = this.c, r[4] = this.d, r[5] = 0, r[6] = this.tx, this.ty) : (r[0] = this.a, r[1] = this.c, r[2] = this.tx, r[3] = this.b, r[4] = this.d, r[5] = this.ty, r[6] = 0), 1), r }, Y.prototype.apply = function(t, e) { e = e || new q; var r = t.x, n = t.y; return e.x = this.a * r + this.c * n + this.tx, e.y = this.b * r + this.d * n + this.ty, e }, Y.prototype.applyInverse = function(t, e) { e = e || new q; var r = 1 / (this.a * this.d + this.c * -this.b), n = t.x, i = t.y; return e.x = this.d * r * n + -this.c * r * i + (this.ty * this.c - this.tx * this.d) * r, e.y = this.a * r * i + -this.b * r * n + (-this.ty * this.a + this.tx * this.b) * r, e }, Y.prototype.translate = function(t, e) { return this.tx += t, this.ty += e, this }, Y.prototype.scale = function(t, e) { return this.a *= t, this.d *= e, this.c *= t, this.b *= e, this.tx *= t, this.ty *= e, this }, Y.prototype.rotate = function(t) { var e = Math.cos(t), r = Math.sin(t), n = this.a, i = this.c, o = this.tx; return this.a = n * e - this.b * r, this.b = n * r + this.b * e, this.c = i * e - this.d * r, this.d = i * r + this.d * e, this.tx = o * e - this.ty * r, this.ty = o * r + this.ty * e, this }, Y.prototype.append = function(t) { var e = this.a, r = this.b, n = this.c, i = this.d; return this.a = t.a * e + t.b * n, this.b = t.a * r + t.b * i, this.c = t.c * e + t.d * n, this.d = t.c * r + t.d * i, this.tx = t.tx * e + t.ty * n + this.tx, this.ty = t.tx * r + t.ty * i + this.ty, this }, Y.prototype.setTransform = function(t, e, r, n, i, o, a, s, u) { return this.a = Math.cos(a + u) * i, this.b = Math.sin(a + u) * i, this.c = -Math.sin(a - s) * o, this.d = Math.cos(a - s) * o, this.tx = t - (r * this.a + n * this.c), this.ty = e - (r * this.b + n * this.d), this }, Y.prototype.prepend = function(t) { var e = this.tx; if (1 !== t.a || 0 !== t.b || 0 !== t.c || 1 !== t.d) { var r = this.a, n = this.c; this.a = r * t.a + this.b * t.c, this.b = r * t.b + this.b * t.d, this.c = n * t.a + this.d * t.c, this.d = n * t.b + this.d * t.d } return this.tx = e * t.a + this.ty * t.c + t.tx, this.ty = e * t.b + this.ty * t.d + t.ty, this }, Y.prototype.decompose = function(t) { var e = this.a, r = this.b, n = this.c, i = this.d, o = -Math.atan2(-n, i), a = Math.atan2(r, e), s = Math.abs(o + a); return s < 1e-5 || Math.abs(X - s) < 1e-5 ? (t.rotation = a, t.skew.x = t.skew.y = 0) : (t.rotation = 0, t.skew.x = o, t.skew.y = a), t.scale.x = Math.sqrt(e * e + r * r), t.scale.y = Math.sqrt(n * n + i * i), t.position.x = this.tx, t.position.y = this.ty, t }, Y.prototype.invert = function() { var t = this.a, e = this.b, r = this.c, n = this.d, i = this.tx, o = t * n - e * r; return this.a = n / o, this.b = -e / o, this.c = -r / o, this.d = t / o, this.tx = (r * this.ty - n * i) / o, this.ty = -(t * this.ty - e * i) / o, this }, Y.prototype.identity = function() { return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.tx = 0, this.ty = 0, this }, Y.prototype.clone = function() { var t = new Y; return t.a = this.a, t.b = this.b, t.c = this.c, t.d = this.d, t.tx = this.tx, t.ty = this.ty, t }, Y.prototype.copyTo = function(t) { return t.a = this.a, t.b = this.b, t.c = this.c, t.d = this.d, t.tx = this.tx, t.ty = this.ty, t }, Y.prototype.copyFrom = function(t) { return this.a = t.a, this.b = t.b, this.c = t.c, this.d = t.d, this.tx = t.tx, this.ty = t.ty, this }, K.IDENTITY.get = function() { return new Y }, K.TEMP_MATRIX.get = function() { return new Y }, Object.defineProperties(Y, K); var Z = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1], Q = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1], J = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1], $ = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1], tt = [], et = []; function signum(t) { return t < 0 ? -1 : 0 < t ? 1 : 0 }! function() { for (var t = 0; t < 16; t++) { var e = []; et.push(e); for (var r = 0; r < 16; r++) for (var n = signum(Z[t] * Z[r] + J[t] * Q[r]), i = signum(Q[t] * Z[r] + $[t] * Q[r]), o = signum(Z[t] * J[r] + J[t] * $[r]), a = signum(Q[t] * J[r] + $[t] * $[r]), s = 0; s < 16; s++) if (Z[s] === n && Q[s] === i && J[s] === o && $[s] === a) { e.push(s); break } } for (var u = 0; u < 16; u++) { var h = new Y; h.set(Z[u], Q[u], J[u], $[u], 0, 0), tt.push(h) } }(); var rt = { E: 0, SE: 1, S: 2, SW: 3, W: 4, NW: 5, N: 6, NE: 7, MIRROR_VERTICAL: 8, MIRROR_HORIZONTAL: 12, uX: function(t) { return Z[t] }, uY: function(t) { return Q[t] }, vX: function(t) { return J[t] }, vY: function(t) { return $[t] }, inv: function(t) { return 8 & t ? 15 & t : 7 & -t }, add: function(t, e) { return et[t][e] }, sub: function(t, e) { return et[t][rt.inv(e)] }, rotate180: function(t) { return 4 ^ t }, isVertical: function(t) { return 2 == (3 & t) }, byDirection: function(t, e) { return 2 * Math.abs(t) <= Math.abs(e) ? 0 <= e ? rt.S : rt.N : 2 * Math.abs(e) <= Math.abs(t) ? 0 < t ? rt.E : rt.W : 0 < e ? 0 < t ? rt.SE : rt.SW : 0 < t ? rt.NE : rt.NW }, matrixAppendRotationInv: function(t, e, r, n) { void 0 === r && (r = 0), void 0 === n && (n = 0); var i = tt[rt.inv(e)]; i.tx = r, i.ty = n, t.append(i) } }, nt = function() { this.worldTransform = new Y, this.localTransform = new Y, this.position = new j(this.onChange, this, 0, 0), this.scale = new j(this.onChange, this, 1, 1), this.pivot = new j(this.onChange, this, 0, 0), this.skew = new j(this.updateSkew, this, 0, 0), this._rotation = 0, this._cx = 1, this._sx = 0, this._cy = 0, this._sy = 1, this._localID = 0, this._currentLocalID = 0, this._worldID = 0, this._parentID = 0 }, it = { rotation: { configurable: !0 } }; nt.prototype.onChange = function() { this._localID++ }, nt.prototype.updateSkew = function() { this._cx = Math.cos(this._rotation + this.skew._y), this._sx = Math.sin(this._rotation + this.skew._y), this._cy = -Math.sin(this._rotation - this.skew._x), this._sy = Math.cos(this._rotation - this.skew._x), this._localID++ }, nt.prototype.updateLocalTransform = function() { var t = this.localTransform; this._localID !== this._currentLocalID && (t.a = this._cx * this.scale._x, t.b = this._sx * this.scale._x, t.c = this._cy * this.scale._y, t.d = this._sy * this.scale._y, t.tx = this.position._x - (this.pivot._x * t.a + this.pivot._y * t.c), t.ty = this.position._y - (this.pivot._x * t.b + this.pivot._y * t.d), this._currentLocalID = this._localID, this._parentID = -1) }, nt.prototype.updateTransform = function(t) { var e = this.localTransform; if (this._localID !== this._currentLocalID && (e.a = this._cx * this.scale._x, e.b = this._sx * this.scale._x, e.c = this._cy * this.scale._y, e.d = this._sy * this.scale._y, e.tx = this.position._x - (this.pivot._x * e.a + this.pivot._y * e.c), e.ty = this.position._y - (this.pivot._x * e.b + this.pivot._y * e.d), this._currentLocalID = this._localID, this._parentID = -1), this._parentID !== t._worldID) { var r = t.worldTransform, n = this.worldTransform; n.a = e.a * r.a + e.b * r.c, n.b = e.a * r.b + e.b * r.d, n.c = e.c * r.a + e.d * r.c, n.d = e.c * r.b + e.d * r.d, n.tx = e.tx * r.a + e.ty * r.c + r.tx, n.ty = e.tx * r.b + e.ty * r.d + r.ty, this._parentID = t._worldID, this._worldID++ } }, nt.prototype.setFromMatrix = function(t) { t.decompose(this), this._localID++ }, it.rotation.get = function() { return this._rotation }, it.rotation.set = function(t) { this._rotation !== t && (this._rotation = t, this.updateSkew()) }, Object.defineProperties(nt.prototype, it), nt.IDENTITY = new nt; var ot = function(t, e, r, n) { void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === r && (r = 0), void 0 === n && (n = 0), this.x = Number(t), this.y = Number(e), this.width = Number(r), this.height = Number(n), this.type = W.RECT }, at = { left: { configurable: !0 }, right: { configurable: !0 }, top: { configurable: !0 }, bottom: { configurable: !0 } }, st = { EMPTY: { configurable: !0 } }; at.left.get = function() { return this.x }, at.right.get = function() { return this.x + this.width }, at.top.get = function() { return this.y }, at.bottom.get = function() { return this.y + this.height }, st.EMPTY.get = function() { return new ot(0, 0, 0, 0) }, ot.prototype.clone = function() { return new ot(this.x, this.y, this.width, this.height) }, ot.prototype.copyFrom = function(t) { return this.x = t.x, this.y = t.y, this.width = t.width, this.height = t.height, this }, ot.prototype.copyTo = function(t) { return t.x = this.x, t.y = this.y, t.width = this.width, t.height = this.height, t }, ot.prototype.contains = function(t, e) { return !(this.width <= 0 || this.height <= 0) && (t >= this.x && t < this.x + this.width && e >= this.y && e < this.y + this.height) }, ot.prototype.pad = function(t, e) { t = t || 0, e = e || (0 !== e ? t : 0), this.x -= t, this.y -= e, this.width += 2 * t, this.height += 2 * e }, ot.prototype.fit = function(t) { var e = Math.max(this.x, t.x), r = Math.min(this.x + this.width, t.x + t.width), n = Math.max(this.y, t.y), i = Math.min(this.y + this.height, t.y + t.height); this.x = e, this.width = Math.max(r - e, 0), this.y = n, this.height = Math.max(i - n, 0) }, ot.prototype.ceil = function(t, e) { void 0 === t && (t = 1), void 0 === e && (e = .001); var r = Math.ceil((this.x + this.width - e) * t) / t, n = Math.ceil((this.y + this.height - e) * t) / t; this.x = Math.floor((this.x + e) * t) / t, this.y = Math.floor((this.y + e) * t) / t, this.width = r - this.x, this.height = n - this.y }, ot.prototype.enlarge = function(t) { var e = Math.min(this.x, t.x), r = Math.max(this.x + this.width, t.x + t.width), n = Math.min(this.y, t.y), i = Math.max(this.y + this.height, t.y + t.height); this.x = e, this.width = r - e, this.y = n, this.height = i - n }, Object.defineProperties(ot.prototype, at), Object.defineProperties(ot, st); var ut = function(t, e, r) { void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === r && (r = 0), this.x = t, this.y = e, this.radius = r, this.type = W.CIRC }; ut.prototype.clone = function() { return new ut(this.x, this.y, this.radius) }, ut.prototype.contains = function(t, e) { if (this.radius <= 0) return !1; var r = this.radius * this.radius, n = this.x - t, i = this.y - e; return (n *= n) + (i *= i) <= r }, ut.prototype.getBounds = function() { return new ot(this.x - this.radius, this.y - this.radius, 2 * this.radius, 2 * this.radius) }; var ht = function(t, e, r, n) { void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === r && (r = 0), void 0 === n && (n = 0), this.x = t, this.y = e, this.width = r, this.height = n, this.type = W.ELIP }; ht.prototype.clone = function() { return new ht(this.x, this.y, this.width, this.height) }, ht.prototype.contains = function(t, e) { if (this.width <= 0 || this.height <= 0) return !1; var r = (t - this.x) / this.width, n = (e - this.y) / this.height; return (r *= r) + (n *= n) <= 1 }, ht.prototype.getBounds = function() { return new ot(this.x - this.width, this.y - this.height, this.width, this.height) }; var ct = function() { for (var t = [], e = arguments.length; e--;) t[e] = arguments[e]; if (Array.isArray(t[0]) && (t = t[0]), t[0] instanceof q) { for (var r = [], n = 0, i = t.length; n < i; n++) r.push(t[n].x, t[n].y); t = r } this.points = t, this.type = W.POLY, this.closeStroke = !0 }; ct.prototype.clone = function() { var t = new ct(this.points.slice()); return t.closeStroke = this.closeStroke, t }, ct.prototype.contains = function(t, e) { for (var r = !1, n = this.points.length / 2, i = 0, o = n - 1; i < n; o = i++) { var a = this.points[2 * i], s = this.points[2 * i + 1], u = this.points[2 * o], h = this.points[2 * o + 1]; e < s != e < h && t < (e - s) / (h - s) * (u - a) + a && (r = !r) } return r }; var lt = function(t, e, r, n, i) { void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === r && (r = 0), void 0 === n && (n = 0), void 0 === i && (i = 20), this.x = t, this.y = e, this.width = r, this.height = n, this.radius = i, this.type = W.RREC }; lt.prototype.clone = function() { return new lt(this.x, this.y, this.width, this.height, this.radius) }, lt.prototype.contains = function(t, e) { if (this.width <= 0 || this.height <= 0) return !1; if (t >= this.x && t <= this.x + this.width && e >= this.y && e <= this.y + this.height) { if (e >= this.y + this.radius && e <= this.y + this.height - this.radius || t >= this.x + this.radius && t <= this.x + this.width - this.radius) return !0; var r = t - (this.x + this.radius), n = e - (this.y + this.radius), i = this.radius * this.radius; if (r * r + n * n <= i) return !0; if ((r = t - (this.x + this.width - this.radius)) * r + n * n <= i) return !0; if (r * r + (n = e - (this.y + this.height - this.radius)) * n <= i) return !0; if ((r = t - (this.x + this.radius)) * r + n * n <= i) return !0 } return !1 }, M.SORTABLE_CHILDREN = !1; var ft = function() { this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null }; ft.prototype.isEmpty = function() { return this.minX > this.maxX || this.minY > this.maxY }, ft.prototype.clear = function() { this.updateID++, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0 }, ft.prototype.getRectangle = function(t) { return this.minX > this.maxX || this.minY > this.maxY ? ot.EMPTY : ((t = t || new ot(0, 0, 1, 1)).x = this.minX, t.y = this.minY, t.width = this.maxX - this.minX, t.height = this.maxY - this.minY, t) }, ft.prototype.addPoint = function(t) { this.minX = Math.min(this.minX, t.x), this.maxX = Math.max(this.maxX, t.x), this.minY = Math.min(this.minY, t.y), this.maxY = Math.max(this.maxY, t.y) }, ft.prototype.addQuad = function(t) { var e = this.minX, r = this.minY, n = this.maxX, i = this.maxY, o = t[0], a = t[1]; e = o < e ? o : e, r = a < r ? a : r, n = n < o ? o : n, i = i < a ? a : i, e = (o = t[2]) < e ? o : e, r = (a = t[3]) < r ? a : r, n = n < o ? o : n, i = i < a ? a : i, e = (o = t[4]) < e ? o : e, r = (a = t[5]) < r ? a : r, n = n < o ? o : n, i = i < a ? a : i, e = (o = t[6]) < e ? o : e, r = (a = t[7]) < r ? a : r, n = n < o ? o : n, i = i < a ? a : i, this.minX = e, this.minY = r, this.maxX = n, this.maxY = i }, ft.prototype.addFrame = function(t, e, r, n, i) { var o = t.worldTransform, a = o.a, s = o.b, u = o.c, h = o.d, c = o.tx, l = o.ty, f = this.minX, d = this.minY, p = this.maxX, m = this.maxY, v = a * e + u * r + c, g = s * e + h * r + l; f = v < f ? v : f, d = g < d ? g : d, p = p < v ? v : p, m = m < g ? g : m, f = (v = a * n + u * r + c) < f ? v : f, d = (g = s * n + h * r + l) < d ? g : d, p = p < v ? v : p, m = m < g ? g : m, f = (v = a * e + u * i + c) < f ? v : f, d = (g = s * e + h * i + l) < d ? g : d, p = p < v ? v : p, m = m < g ? g : m, f = (v = a * n + u * i + c) < f ? v : f, d = (g = s * n + h * i + l) < d ? g : d, p = p < v ? v : p, m = m < g ? g : m, this.minX = f, this.minY = d, this.maxX = p, this.maxY = m }, ft.prototype.addVertexData = function(t, e, r) { for (var n = this.minX, i = this.minY, o = this.maxX, a = this.maxY, s = e; s < r; s += 2) { var u = t[s], h = t[s + 1]; n = u < n ? u : n, i = h < i ? h : i, o = o < u ? u : o, a = a < h ? h : a } this.minX = n, this.minY = i, this.maxX = o, this.maxY = a }, ft.prototype.addVertices = function(t, e, r, n) { for (var i = t.worldTransform, o = i.a, a = i.b, s = i.c, u = i.d, h = i.tx, c = i.ty, l = this.minX, f = this.minY, d = this.maxX, p = this.maxY, m = r; m < n; m += 2) { var v = e[m], g = e[m + 1], y = o * v + s * g + h, _ = u * g + a * v + c; l = y < l ? y : l, f = _ < f ? _ : f, d = d < y ? y : d, p = p < _ ? _ : p } this.minX = l, this.minY = f, this.maxX = d, this.maxY = p }, ft.prototype.addBounds = function(t) { var e = this.minX, r = this.minY, n = this.maxX, i = this.maxY; this.minX = t.minX < e ? t.minX : e, this.minY = t.minY < r ? t.minY : r, this.maxX = t.maxX > n ? t.maxX : n, this.maxY = t.maxY > i ? t.maxY : i }, ft.prototype.addBoundsMask = function(t, e) { var r = t.minX > e.minX ? t.minX : e.minX, n = t.minY > e.minY ? t.minY : e.minY, i = t.maxX < e.maxX ? t.maxX : e.maxX, o = t.maxY < e.maxY ? t.maxY : e.maxY; if (r <= i && n <= o) { var a = this.minX, s = this.minY, u = this.maxX, h = this.maxY; this.minX = r < a ? r : a, this.minY = n < s ? n : s, this.maxX = u < i ? i : u, this.maxY = h < o ? o : h } }, ft.prototype.addBoundsArea = function(t, e) { var r = t.minX > e.x ? t.minX : e.x, n = t.minY > e.y ? t.minY : e.y, i = t.maxX < e.x + e.width ? t.maxX : e.x + e.width, o = t.maxY < e.y + e.height ? t.maxY : e.y + e.height; if (r <= i && n <= o) { var a = this.minX, s = this.minY, u = this.maxX, h = this.maxY; this.minX = r < a ? r : a, this.minY = n < s ? n : s, this.maxX = u < i ? i : u, this.maxY = h < o ? o : h } }; var dt = function(t) { function DisplayObject() { t.call(this), this.tempDisplayObjectParent = null, this.transform = new nt, this.alpha = 1, this.visible = !0, this.renderable = !0, this.parent = null, this.worldAlpha = 1, this._lastSortedIndex = 0, this._zIndex = 0, this.filterArea = null, this.filters = null, this._enabledFilters = null, this._bounds = new ft, this._boundsID = 0, this._lastBoundsID = -1, this._boundsRect = null, this._localBoundsRect = null, this._mask = null, this._destroyed = !1, this.isSprite = !1 } t && (DisplayObject.__proto__ = t); var e = { _tempDisplayObjectParent: { configurable: !0 }, x: { configurable: !0 }, y: { configurable: !0 }, worldTransform: { configurable: !0 }, localTransform: { configurable: !0 }, position: { configurable: !0 }, scale: { configurable: !0 }, pivot: { configurable: !0 }, skew: { configurable: !0 }, rotation: { configurable: !0 }, angle: { configurable: !0 }, zIndex: { configurable: !0 }, worldVisible: { configurable: !0 }, mask: { configurable: !0 } }; return ((DisplayObject.prototype = Object.create(t && t.prototype)).constructor = DisplayObject).mixin = function(t) { for (var e = Object.keys(t), r = 0; r < e.length; ++r) { var n = e[r]; Object.defineProperty(DisplayObject.prototype, n, Object.getOwnPropertyDescriptor(t, n)) } }, e._tempDisplayObjectParent.get = function() { return null === this.tempDisplayObjectParent && (this.tempDisplayObjectParent = new DisplayObject), this.tempDisplayObjectParent }, DisplayObject.prototype.updateTransform = function() { this.transform.updateTransform(this.parent.transform), this.worldAlpha = this.alpha * this.parent.worldAlpha, this._bounds.updateID++ }, DisplayObject.prototype._recursivePostUpdateTransform = function() { this.parent ? (this.parent._recursivePostUpdateTransform(), this.transform.updateTransform(this.parent.transform)) : this.transform.updateTransform(this._tempDisplayObjectParent.transform) }, DisplayObject.prototype.getBounds = function(t, e) { return t || (this.parent ? (this._recursivePostUpdateTransform(), this.updateTransform()) : (this.parent = this._tempDisplayObjectParent, this.updateTransform(), this.parent = null)), this._boundsID !== this._lastBoundsID && this.calculateBounds(), e || (this._boundsRect || (this._boundsRect = new ot), e = this._boundsRect), this._bounds.getRectangle(e) }, DisplayObject.prototype.getLocalBounds = function(t) { var e = this.transform, r = this.parent; this.parent = null, this.transform = this._tempDisplayObjectParent.transform, t || (this._localBoundsRect || (this._localBoundsRect = new ot), t = this._localBoundsRect); var n = this.getBounds(!1, t); return this.parent = r, this.transform = e, n }, DisplayObject.prototype.toGlobal = function(t, e, r) { return void 0 === r && (r = !1), r || (this._recursivePostUpdateTransform(), this.parent ? this.displayObjectUpdateTransform() : (this.parent = this._tempDisplayObjectParent, this.displayObjectUpdateTransform(), this.parent = null)), this.worldTransform.apply(t, e) }, DisplayObject.prototype.toLocal = function(t, e, r, n) { return e && (t = e.toGlobal(t, r, n)), n || (this._recursivePostUpdateTransform(), this.parent ? this.displayObjectUpdateTransform() : (this.parent = this._tempDisplayObjectParent, this.displayObjectUpdateTransform(), this.parent = null)), this.worldTransform.applyInverse(t, r) }, DisplayObject.prototype.render = function(t) {}, DisplayObject.prototype.setParent = function(t) { if (!t || !t.addChild) throw new Error("setParent: Argument must be a Container"); return t.addChild(this), t }, DisplayObject.prototype.setTransform = function(t, e, r, n, i, o, a, s, u) { return void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === r && (r = 1), void 0 === n && (n = 1), void 0 === i && (i = 0), void 0 === o && (o = 0), void 0 === a && (a = 0), void 0 === s && (s = 0), void 0 === u && (u = 0), this.position.x = t, this.position.y = e, this.scale.x = r || 1, this.scale.y = n || 1, this.rotation = i, this.skew.x = o, this.skew.y = a, this.pivot.x = s, this.pivot.y = u, this }, DisplayObject.prototype.destroy = function() { this.removeAllListeners(), this.parent && this.parent.removeChild(this), this.transform = null, this.parent = null, this._bounds = null, this._currentBounds = null, this._mask = null, this.filterArea = null, this.interactive = !1, this.interactiveChildren = !1, this._destroyed = !0 }, e.x.get = function() { return this.position.x }, e.x.set = function(t) { this.transform.position.x = t }, e.y.get = function() { return this.position.y }, e.y.set = function(t) { this.transform.position.y = t }, e.worldTransform.get = function() { return this.transform.worldTransform }, e.localTransform.get = function() { return this.transform.localTransform }, e.position.get = function() { return this.transform.position }, e.position.set = function(t) { this.transform.position.copyFrom(t) }, e.scale.get = function() { return this.transform.scale }, e.scale.set = function(t) { this.transform.scale.copyFrom(t) }, e.pivot.get = function() { return this.transform.pivot }, e.pivot.set = function(t) { this.transform.pivot.copyFrom(t) }, e.skew.get = function() { return this.transform.skew }, e.skew.set = function(t) { this.transform.skew.copyFrom(t) }, e.rotation.get = function() { return this.transform.rotation }, e.rotation.set = function(t) { this.transform.rotation = t }, e.angle.get = function() { return this.transform.rotation * V }, e.angle.set = function(t) { this.transform.rotation = t * H }, e.zIndex.get = function() { return this._zIndex }, e.zIndex.set = function(t) { this._zIndex = t, this.parent && (this.parent.sortDirty = !0) }, e.worldVisible.get = function() { var t = this; do { if (!t.visible) return !1; t = t.parent } while (t); return !0 }, e.mask.get = function() { return this._mask }, e.mask.set = function(t) { this._mask && (this._mask.renderable = !0, this._mask.isMask = !1), this._mask = t, this._mask && (this._mask.renderable = !1, this._mask.isMask = !0) }, Object.defineProperties(DisplayObject.prototype, e), DisplayObject }(l.a); function sortChildren(t, e) { return t.zIndex === e.zIndex ? t._lastSortedIndex - e._lastSortedIndex : t.zIndex - e.zIndex } dt.prototype.displayObjectUpdateTransform = dt.prototype.updateTransform; var pt = function(i) { function Container() { i.call(this), this.children = [], this.sortableChildren = M.SORTABLE_CHILDREN, this.sortDirty = !1 } i && (Container.__proto__ = i); var t = { width: { configurable: !0 }, height: { configurable: !0 } }; return ((Container.prototype = Object.create(i && i.prototype)).constructor = Container).prototype.onChildrenChange = function() {}, Container.prototype.addChild = function(t) { var e = arguments, r = arguments.length; if (1 < r) for (var n = 0; n < r; n++) this.addChild(e[n]); else t.parent && t.parent.removeChild(t), (t.parent = this).sortDirty = !0, t.transform._parentID = -1, this.children.push(t), this._boundsID++, this.onChildrenChange(this.children.length - 1), this.emit("childAdded", t, this, this.children.length - 1), t.emit("added", this); return t }, Container.prototype.addChildAt = function(t, e) { if (e < 0 || e > this.children.length) throw new Error(t + "addChildAt: The index " + e + " supplied is out of bounds " + this.children.length); return t.parent && t.parent.removeChild(t), (t.parent = this).sortDirty = !0, t.transform._parentID = -1, this.children.splice(e, 0, t), this._boundsID++, this.onChildrenChange(e), t.emit("added", this), this.emit("childAdded", t, this, e), t }, Container.prototype.swapChildren = function(t, e) { if (t !== e) { var r = this.getChildIndex(t), n = this.getChildIndex(e); this.children[r] = e, this.children[n] = t, this.onChildrenChange(r < n ? r : n) } }, Container.prototype.getChildIndex = function(t) { var e = this.children.indexOf(t); if (-1 === e) throw new Error("The supplied DisplayObject must be a child of the caller"); return e }, Container.prototype.setChildIndex = function(t, e) { if (e < 0 || e >= this.children.length) throw new Error("The index " + e + " supplied is out of bounds " + this.children.length); var r = this.getChildIndex(t); removeItems(this.children, r, 1), this.children.splice(e, 0, t), this.onChildrenChange(e) }, Container.prototype.getChildAt = function(t) { if (t < 0 || t >= this.children.length) throw new Error("getChildAt: Index (" + t + ") does not exist."); return this.children[t] }, Container.prototype.removeChild = function(t) { var e = arguments, r = arguments.length; if (1 < r) for (var n = 0; n < r; n++) this.removeChild(e[n]); else { var i = this.children.indexOf(t); if (-1 === i) return null; t.parent = null, t.transform._parentID = -1, removeItems(this.children, i, 1), this._boundsID++, this.onChildrenChange(i), t.emit("removed", this), this.emit("childRemoved", t, this, i) } return t }, Container.prototype.removeChildAt = function(t) { var e = this.getChildAt(t); return e.parent = null, e.transform._parentID = -1, removeItems(this.children, t, 1), this._boundsID++, this.onChildrenChange(t), e.emit("removed", this), this.emit("childRemoved", e, this, t), e }, Container.prototype.removeChildren = function(t, e) { void 0 === t && (t = 0); var r, n = t, i = "number" == typeof e ? e : this.children.length, o = i - n; if (0 < o && o <= i) { r = this.children.splice(n, o); for (var a = 0; a < r.length; ++a) r[a].parent = null, r[a].transform && (r[a].transform._parentID = -1); this._boundsID++, this.onChildrenChange(t); for (var s = 0; s < r.length; ++s) r[s].emit("removed", this), this.emit("childRemoved", r[s], this, s); return r } if (0 === o && 0 === this.children.length) return []; throw new RangeError("removeChildren: numeric values are outside the acceptable range.") }, Container.prototype.sortChildren = function() { for (var t = !1, e = 0, r = this.children.length; e < r; ++e) { var n = this.children[e]; n._lastSortedIndex = e, t || 0 === n.zIndex || (t = !0) } t && 1 < this.children.length && this.children.sort(sortChildren), this.sortDirty = !1 }, Container.prototype.updateTransform = function() { this.sortableChildren && this.sortDirty && this.sortChildren(), this._boundsID++, this.transform.updateTransform(this.parent.transform), this.worldAlpha = this.alpha * this.parent.worldAlpha; for (var t = 0, e = this.children.length; t < e; ++t) { var r = this.children[t]; r.visible && r.updateTransform() } }, Container.prototype.calculateBounds = function() { this._bounds.clear(), this._calculateBounds(); for (var t = 0; t < this.children.length; t++) { var e = this.children[t]; e.visible && e.renderable && (e.calculateBounds(), e._mask ? (e._mask.calculateBounds(), this._bounds.addBoundsMask(e._bounds, e._mask._bounds)) : e.filterArea ? this._bounds.addBoundsArea(e._bounds, e.filterArea) : this._bounds.addBounds(e._bounds)) } this._lastBoundsID = this._boundsID }, Container.prototype._calculateBounds = function() {}, Container.prototype.render = function(t) { if (this.visible && !(this.worldAlpha <= 0) && this.renderable) if (this._mask || this.filters) this.renderAdvanced(t); else { this._render(t); for (var e = 0, r = this.children.length; e < r; ++e) this.children[e].render(t) } }, Container.prototype.renderAdvanced = function(t) { t.batch.flush(); var e = this.filters, r = this._mask; if (e) { this._enabledFilters || (this._enabledFilters = []); for (var n = this._enabledFilters.length = 0; n < e.length; n++) e[n].enabled && this._enabledFilters.push(e[n]); this._enabledFilters.length && t.filter.push(this, this._enabledFilters) } r && t.mask.push(this, this._mask), this._render(t); for (var i = 0, o = this.children.length; i < o; i++) this.children[i].render(t); t.batch.flush(), r && t.mask.pop(this, this._mask), e && this._enabledFilters && this._enabledFilters.length && t.filter.pop() }, Container.prototype._render = function(t) {}, Container.prototype.destroy = function(t) { i.prototype.destroy.call(this), this.sortDirty = !1; var e = "boolean" == typeof t ? t : t && t.children, r = this.removeChildren(0, this.children.length); if (e) for (var n = 0; n < r.length; ++n) r[n].destroy(t) }, t.width.get = function() { return this.scale.x * this.getLocalBounds().width }, t.width.set = function(t) { var e = this.getLocalBounds().width; this.scale.x = 0 !== e ? t / e : 1, this._width = t }, t.height.get = function() { return this.scale.y * this.getLocalBounds().height }, t.height.set = function(t) { var e = this.getLocalBounds().height; this.scale.y = 0 !== e ? t / e : 1, this._height = t }, Object.defineProperties(Container.prototype, t), Container }(dt); pt.prototype.containerUpdateTransform = pt.prototype.updateTransform; var mt = { accessible: !1, accessibleTitle: null, accessibleHint: null, tabIndex: 0, _accessibleActive: !1, _accessibleDiv: !1 }; dt.mixin(mt); var vt = function(t) { this._hookDiv = null, (h.a.tablet || h.a.phone) && this.createTouchHook(); var e = document.createElement("div"); e.style.width = "100px", e.style.height = "100px", e.style.position = "absolute", e.style.top = "0px", e.style.left = "0px", e.style.zIndex = 2, this.div = e, this.pool = [], this.renderId = 0, this.debug = !1, this.renderer = t, this.children = [], this._onKeyDown = this._onKeyDown.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this.isActive = !1, this.isMobileAccessibility = !1, window.addEventListener("keydown", this._onKeyDown, !1) }; vt.prototype.createTouchHook = function() { var t = this, e = document.createElement("button"); e.style.width = "1px", e.style.height = "1px", e.style.position = "absolute", e.style.top = "-1000px", e.style.left = "-1000px", e.style.zIndex = 2, e.style.backgroundColor = "#FF0000", e.title = "HOOK DIV", e.addEventListener("focus", function() { t.isMobileAccessibility = !0, t.activate(), t.destroyTouchHook() }), document.body.appendChild(e), this._hookDiv = e }, vt.prototype.destroyTouchHook = function() { this._hookDiv && (document.body.removeChild(this._hookDiv), this._hookDiv = null) }, vt.prototype.activate = function() { this.isActive || (this.isActive = !0, window.document.addEventListener("mousemove", this._onMouseMove, !0), window.removeEventListener("keydown", this._onKeyDown, !1), this.renderer.on("postrender", this.update, this), this.renderer.view.parentNode && this.renderer.view.parentNode.appendChild(this.div)) }, vt.prototype.deactivate = function() { this.isActive && !this.isMobileAccessibility && (this.isActive = !1, window.document.removeEventListener("mousemove", this._onMouseMove, !0), window.addEventListener("keydown", this._onKeyDown, !1), this.renderer.off("postrender", this.update), this.div.parentNode && this.div.parentNode.removeChild(this.div)) }, vt.prototype.updateAccessibleObjects = function(t) { if (t.visible) { t.accessible && t.interactive && (t._accessibleActive || this.addChild(t), t.renderId = this.renderId); for (var e = t.children, r = 0; r < e.length; r++) this.updateAccessibleObjects(e[r]) } }, vt.prototype.update = function() { if (this.renderer.renderingToScreen) { this.updateAccessibleObjects(this.renderer._lastObjectRendered); var t = this.renderer.view.getBoundingClientRect(), e = t.width / this.renderer.width, r = t.height / this.renderer.height, n = this.div; n.style.left = t.left + "px", n.style.top = t.top + "px", n.style.width = this.renderer.width + "px", n.style.height = this.renderer.height + "px"; for (var i = 0; i < this.children.length; i++) { var o = this.children[i]; if (o.renderId !== this.renderId) o._accessibleActive = !1, removeItems(this.children, i, 1), this.div.removeChild(o._accessibleDiv), this.pool.push(o._accessibleDiv), o._accessibleDiv = null, i--, 0 === this.children.length && this.deactivate(); else { n = o._accessibleDiv; var a = o.hitArea, s = o.worldTransform; o.hitArea ? (n.style.left = (s.tx + a.x * s.a) * e + "px", n.style.top = (s.ty + a.y * s.d) * r + "px", n.style.width = a.width * s.a * e + "px", n.style.height = a.height * s.d * r + "px") : (a = o.getBounds(), this.capHitArea(a), n.style.left = a.x * e + "px", n.style.top = a.y * r + "px", n.style.width = a.width * e + "px", n.style.height = a.height * r + "px", n.title !== o.accessibleTitle && null !== o.accessibleTitle && (n.title = o.accessibleTitle), n.getAttribute("aria-label") !== o.accessibleHint && null !== o.accessibleHint && n.setAttribute("aria-label", o.accessibleHint)) } } this.renderId++ } }, vt.prototype.capHitArea = function(t) { t.x < 0 && (t.width += t.x, t.x = 0), t.y < 0 && (t.height += t.y, t.y = 0), t.x + t.width > this.renderer.width && (t.width = this.renderer.width - t.x), t.y + t.height > this.renderer.height && (t.height = this.renderer.height - t.y) }, vt.prototype.addChild = function(t) { var e = this.pool.pop(); e || ((e = document.createElement("button")).style.width = "100px", e.style.height = "100px", e.style.backgroundColor = this.debug ? "rgba(255,0,0,0.5)" : "transparent", e.style.position = "absolute", e.style.zIndex = 2, e.style.borderStyle = "none", -1 < navigator.userAgent.toLowerCase().indexOf("chrome") ? e.setAttribute("aria-live", "off") : e.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? e.setAttribute("aria-relevant", "additions") : e.setAttribute("aria-relevant", "text"), e.addEventListener("click", this._onClick.bind(this)), e.addEventListener("focus", this._onFocus.bind(this)), e.addEventListener("focusout", this._onFocusOut.bind(this))), t.accessibleTitle && null !== t.accessibleTitle ? e.title = t.accessibleTitle : t.accessibleHint && null !== t.accessibleHint || (e.title = "displayObject " + t.tabIndex), t.accessibleHint && null !== t.accessibleHint && e.setAttribute("aria-label", t.accessibleHint), t._accessibleActive = !0, (t._accessibleDiv = e).displayObject = t, this.children.push(t), this.div.appendChild(t._accessibleDiv), t._accessibleDiv.tabIndex = t.tabIndex }, vt.prototype._onClick = function(t) { var e = this.renderer.plugins.interaction; e.dispatchEvent(t.target.displayObject, "click", e.eventData) }, vt.prototype._onFocus = function(t) { t.target.getAttribute("aria-live", "off") || t.target.setAttribute("aria-live", "assertive"); var e = this.renderer.plugins.interaction; e.dispatchEvent(t.target.displayObject, "mouseover", e.eventData) }, vt.prototype._onFocusOut = function(t) { t.target.getAttribute("aria-live", "off") || t.target.setAttribute("aria-live", "polite"); var e = this.renderer.plugins.interaction; e.dispatchEvent(t.target.displayObject, "mouseout", e.eventData) }, vt.prototype._onKeyDown = function(t) { 9 === t.keyCode && this.activate() }, vt.prototype._onMouseMove = function(t) { 0 === t.movementX && 0 === t.movementY || this.deactivate() }, vt.prototype.destroy = function() { this.destroyTouchHook(), this.div = null; for (var t = 0; t < this.children.length; t++) this.children[t].div = null; window.document.removeEventListener("mousemove", this._onMouseMove, !0), window.removeEventListener("keydown", this._onKeyDown), this.pool = null, this.children = null, this.renderer = null }; var gt = function(t) { this.items = [], this._name = t }, yt = { empty: { configurable: !0 }, name: { configurable: !0 } }; gt.prototype.emit = function(t, e, r, n, i, o, a, s) { if (8 < arguments.length) throw new Error("max arguments reached"); for (var u = this.name, h = this.items, c = 0, l = h.length; c < l; c++) h[c][u](t, e, r, n, i, o, a, s); return this }, gt.prototype.add = function(t) { return t[this._name] && (this.remove(t), this.items.push(t)), this }, gt.prototype.remove = function(t) { var e = this.items.indexOf(t); return -1 !== e && this.items.splice(e, 1), this }, gt.prototype.contains = function(t) { return -1 !== this.items.indexOf(t) }, gt.prototype.removeAll = function() { return this.items.length = 0, this }, gt.prototype.destroy = function() { this.removeAll(), this.items = null, this._name = null }, yt.empty.get = function() { return 0 === this.items.length }, yt.name.get = function() { return this._name }, Object.defineProperties(gt.prototype, yt), gt.prototype.dispatch = gt.prototype.emit, gt.prototype.run = gt.prototype.emit, M.TARGET_FPMS = .06; var _t = { INTERACTION: 50, HIGH: 25, NORMAL: 0, LOW: -25, UTILITY: -50 }, bt = function(t, e, r, n) { void 0 === e && (e = null), void 0 === r && (r = 0), void 0 === n && (n = !1), this.fn = t, this.context = e, this.priority = r, this.once = n, this.next = null, this.previous = null, this._destroyed = !1 }; bt.prototype.match = function(t, e) { return e = e || null, this.fn === t && this.context === e }, bt.prototype.emit = function(t) { this.fn && (this.context ? this.fn.call(this.context, t) : this.fn(t)); var e = this.next; return this.once && this.destroy(!0), this._destroyed && (this.next = null), e }, bt.prototype.connect = function(t) { (this.previous = t).next && (t.next.previous = this), this.next = t.next, t.next = this }, bt.prototype.destroy = function(t) { void 0 === t && (t = !1), this._destroyed = !0, this.fn = null, this.context = null, this.previous && (this.previous.next = this.next), this.next && (this.next.previous = this.previous); var e = this.next; return this.next = t ? null : e, this.previous = null, e }; var xt = function() { var e = this; this._head = new bt(null, null, 1 / 0), this._requestId = null, this._maxElapsedMS = 100, this._minElapsedMS = 0, this.autoStart = !1, this.deltaTime = 1, this.deltaMS = 1 / M.TARGET_FPMS, this.elapsedMS = 1 / M.TARGET_FPMS, this.lastTime = -1, this.speed = 1, this.started = !1, this._protected = !1, this._tick = function(t) { e._requestId = null, e.started && (e.update(t), e.started && null === e._requestId && e._head.next && (e._requestId = requestAnimationFrame(e._tick))) } }, wt = { FPS: { configurable: !0 }, minFPS: { configurable: !0 }, maxFPS: { configurable: !0 } }, Tt = { shared: { configurable: !0 }, system: { configurable: !0 } }; xt.prototype._requestIfNeeded = function() { null === this._requestId && this._head.next && (this.lastTime = performance.now(), this._requestId = requestAnimationFrame(this._tick)) }, xt.prototype._cancelIfNeeded = function() { null !== this._requestId && (cancelAnimationFrame(this._requestId), this._requestId = null) }, xt.prototype._startIfPossible = function() { this.started ? this._requestIfNeeded() : this.autoStart && this.start() }, xt.prototype.add = function(t, e, r) { return void 0 === r && (r = _t.NORMAL), this._addListener(new bt(t, e, r)) }, xt.prototype.addOnce = function(t, e, r) { return void 0 === r && (r = _t.NORMAL), this._addListener(new bt(t, e, r, !0)) }, xt.prototype._addListener = function(t) { var e = this._head.next, r = this._head; if (e) { for (; e;) { if (t.priority > e.priority) { t.connect(r); break } e = (r = e).next } t.previous || t.connect(r) } else t.connect(r); return this._startIfPossible(), this }, xt.prototype.remove = function(t, e) { for (var r = this._head.next; r;) r = r.match(t, e) ? r.destroy() : r.next; return this._head.next || this._cancelIfNeeded(), this }, xt.prototype.start = function() { this.started || (this.started = !0, this._requestIfNeeded()) }, xt.prototype.stop = function() { this.started && (this.started = !1, this._cancelIfNeeded()) }, xt.prototype.destroy = function() { if (!this._protected) { this.stop(); for (var t = this._head.next; t;) t = t.destroy(!0); this._head.destroy(), this._head = null } }, xt.prototype.update = function(t) { var e; if (void 0 === t && (t = performance.now()), t > this.lastTime) { if ((e = this.elapsedMS = t - this.lastTime) > this._maxElapsedMS && (e = this._maxElapsedMS), e *= this.speed, this._minElapsedMS && e + 1 < this._minElapsedMS) return; this.deltaMS = e, this.deltaTime = this.deltaMS * M.TARGET_FPMS; for (var r = this._head, n = r.next; n;) n = n.emit(this.deltaTime); r.next || this._cancelIfNeeded() } else this.deltaTime = this.deltaMS = this.elapsedMS = 0; this.lastTime = t }, wt.FPS.get = function() { return 1e3 / this.elapsedMS }, wt.minFPS.get = function() { return 1e3 / this._maxElapsedMS }, wt.minFPS.set = function(t) { var e = Math.min(this.maxFPS, t), r = Math.min(Math.max(0, e) / 1e3, M.TARGET_FPMS); this._maxElapsedMS = 1 / r }, wt.maxFPS.get = function() { return this._minElapsedMS ? 1e3 / this._minElapsedMS : 1e3 * M.TARGET_FPMS }, wt.maxFPS.set = function(t) { if (t / 1e3 >= M.TARGET_FPMS) this._minElapsedMS = 0; else { var e = Math.max(this.minFPS, t), r = Math.min(Math.max(1, e) / 1e3, M.TARGET_FPMS); this._minElapsedMS = 1 / r } }, Tt.shared.get = function() { if (!xt._shared) { var t = xt._shared = new xt; t.autoStart = !0, t._protected = !0 } return xt._shared }, Tt.system.get = function() { if (!xt._system) { var t = xt._system = new xt; t.autoStart = !0, t._protected = !0 } return xt._system }, Object.defineProperties(xt.prototype, wt), Object.defineProperties(xt, Tt); var St = function() {}; St.init = function(t) { var e = this; t = Object.assign({ autoStart: !0, sharedTicker: !1 }, t), Object.defineProperty(this, "ticker", { set: function(t) { this._ticker && this._ticker.remove(this.render, this), (this._ticker = t) && t.add(this.render, this, _t.LOW) }, get: function() { return this._ticker } }), this.stop = function() { e._ticker.stop() }, this.start = function() { e._ticker.start() }, this._ticker = null, this.ticker = t.sharedTicker ? xt.shared : new xt, t.autoStart && this.start() }, St.destroy = function() { if (this._ticker) { var t = this._ticker; this.ticker = null, t.destroy() } }; var Mt = function(t, e) { void 0 === t && (t = 0), void 0 === e && (e = 0), this._width = t, this._height = e, this.destroyed = !1, this.internal = !1, this.onResize = new gt("setRealSize", 2), this.onUpdate = new gt("update") }, Et = { valid: { configurable: !0 }, width: { configurable: !0 }, height: { configurable: !0 } }; Mt.prototype.bind = function(t) { this.onResize.add(t), this.onUpdate.add(t), (this._width || this._height) && this.onResize.run(this._width, this._height) }, Mt.prototype.unbind = function(t) { this.onResize.remove(t), this.onUpdate.remove(t) }, Mt.prototype.resize = function(t, e) { t === this._width && e === this._height || (this._width = t, this._height = e, this.onResize.run(t, e)) }, Et.valid.get = function() { return !!this._width && !!this._height }, Mt.prototype.update = function() { this.destroyed || this.onUpdate.run() }, Mt.prototype.load = function() { return Promise.resolve() }, Et.width.get = function() { return this._width }, Et.height.get = function() { return this._height }, Mt.prototype.upload = function(t, e, r) { return !1 }, Mt.prototype.style = function(t, e, r) { return !1 }, Mt.prototype.dispose = function() {}, Mt.prototype.destroy = function() { this.destroyed || (this.onResize.removeAll(), this.onResize = null, this.onUpdate.removeAll(), this.onUpdate = null, this.destroyed = !0, this.dispose()) }, Object.defineProperties(Mt.prototype, Et); var At = function(e) { function BaseImageResource(t) { e.call(this, t.width, t.height), this.source = t } return e && (BaseImageResource.__proto__ = e), ((BaseImageResource.prototype = Object.create(e && e.prototype)).constructor = BaseImageResource).crossOrigin = function(t, e, r) { void 0 === r && 0 !== e.indexOf("data:") ? t.crossOrigin = determineCrossOrigin(e) : !1 !== r && (t.crossOrigin = "string" == typeof r ? r : "anonymous") }, BaseImageResource.prototype.upload = function(t, e, r, n) { var i = t.gl, o = e.realWidth, a = e.realHeight; return n = n || this.source, i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e.premultiplyAlpha), e.target === i.TEXTURE_2D && r.width === o && r.height === a ? i.texSubImage2D(i.TEXTURE_2D, 0, 0, 0, e.format, e.type, n) : (r.width = o, r.height = a, i.texImage2D(e.target, 0, e.format, e.format, e.type, n)), !0 }, BaseImageResource.prototype.dispose = function() { this.source = null }, BaseImageResource }(Mt), Pt = function(a) { function ImageResource(t, e) { if (e = e || {}, !(t instanceof HTMLImageElement)) { var r = new Image; a.crossOrigin(r, t, e.crossorigin), r.src = t, t = r } a.call(this, t), this.url = t.src, this._process = null, this.preserveBitmap = !1, this.createBitmap = !1 !== e.createBitmap && M.CREATE_IMAGE_BITMAP && !!window.createImageBitmap, this.premultiplyAlpha = !1 !== e.premultiplyAlpha, this.bitmap = null, this._load = null, !1 !== e.autoLoad && this.load() } return a && (ImageResource.__proto__ = a), ((ImageResource.prototype = Object.create(a && a.prototype)).constructor = ImageResource).prototype.load = function(t) { var n = this; return void 0 !== t && (this.createBitmap = t), this._load || (this._load = new Promise(function(t) { n.url = n.source.src; var e = n.source, r = function() { n.destroyed || (e.onload = null, e.onerror = null, n.resize(e.width, e.height), n._load = null, n.createBitmap ? t(n.process()) : t(n)) }; e.complete && e.src ? r() : e.onload = r })), this._load }, ImageResource.prototype.process = function() { var e = this; return null !== this._process ? this._process : null === this.bitmap && window.createImageBitmap ? (this._process = window.createImageBitmap(this.source, 0, 0, this.source.width, this.source.height, { premultiplyAlpha: this.premultiplyAlpha ? "premultiply" : "none" }).then(function(t) { return e.destroyed ? Promise.reject() : (e.bitmap = t, e.update(), e._process = null, Promise.resolve(e)) }), this._process) : Promise.resolve(this) }, ImageResource.prototype.upload = function(t, e, r) { if (e.premultiplyAlpha = this.premultiplyAlpha, !this.createBitmap) return a.prototype.upload.call(this, t, e, r); if (!this.bitmap && (this.process(), !this.bitmap)) return !1; if (a.prototype.upload.call(this, t, e, r, this.bitmap), !this.preserveBitmap) { var n = !0; for (var i in e._glTextures) { var o = e._glTextures[i]; if (o !== r && o.dirtyId !== e.dirtyId) { n = !1; break } } n && (this.bitmap.close && this.bitmap.close(), this.bitmap = null) } return !0 }, ImageResource.prototype.dispose = function() { a.prototype.dispose.call(this), this.bitmap && (this.bitmap.close(), this.bitmap = null), this._process = null, this._load = null }, ImageResource }(At), It = []; function autoDetectResource(t, e) { if (!t) return null; var r = ""; if ("string" == typeof t) { var n = /\.(\w{3,4})(?:$|\?|#)/i.exec(t); n && (r = n[1].toLowerCase()) } for (var i = It.length - 1; 0 <= i; --i) { var o = It[i]; if (o.test && o.test(t, r)) return new o(t, e) } return new Pt(t, e) } var Ot = function(o) { function BufferResource(t, e) { var r = e || {}, n = r.width, i = r.height; if (!n || !i) throw new Error("BufferResource width or height invalid"); o.call(this, n, i), this.data = t } return o && (BufferResource.__proto__ = o), ((BufferResource.prototype = Object.create(o && o.prototype)).constructor = BufferResource).prototype.upload = function(t, e, r) { var n = t.gl; if (n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e.premultiplyAlpha), r.width === e.width && r.height === e.height) n.texSubImage2D(e.target, 0, 0, 0, e.width, e.height, e.format, e.type, this.data); else { r.width = e.width, r.height = e.height; var i = e.format; 2 === t.context.webGLVersion && e.type === t.gl.FLOAT && e.format === t.gl.RGBA && (i = t.gl.RGBA32F), n.texImage2D(e.target, 0, i, e.width, e.height, 0, e.format, e.type, this.data) } return !0 }, BufferResource.prototype.dispose = function() { this.data = null }, BufferResource.test = function(t) { return t instanceof Float32Array || t instanceof Uint8Array || t instanceof Uint32Array }, BufferResource }(Mt), Ct = { scaleMode: T.NEAREST, format: _.RGBA, premultiplyAlpha: !1 }, Rt = function(d) { function BaseTexture(t, e) { void 0 === t && (t = null), void 0 === e && (e = null), d.call(this); var r = (e = e || {}).premultiplyAlpha, n = e.mipmap, i = e.scaleMode, o = e.width, a = e.height, s = e.wrapMode, u = e.format, h = e.type, c = e.target, l = e.resolution, f = e.resourceOptions; !t || t instanceof Mt || ((t = autoDetectResource(t, f)).internal = !0), this.width = o || 0, this.height = a || 0, this.resolution = l || M.RESOLUTION, this.mipmap = void 0 !== n ? n : M.MIPMAP_TEXTURES, this.wrapMode = s || M.WRAP_MODE, this.scaleMode = void 0 !== i ? i : M.SCALE_MODE, this.format = u || _.RGBA, this.type = h || w.UNSIGNED_BYTE, this.target = c || b.TEXTURE_2D, this.premultiplyAlpha = !1 !== r, this.uid = uid(), this.touched = 0, this.isPowerOfTwo = !1, this._refreshPOT(), this._glTextures = {}, this.dirtyId = 0, this.dirtyStyleId = 0, this.cacheId = null, this.valid = 0 < o && 0 < a, this.textureCacheIds = [], this.destroyed = !1, this.resource = null, this.setResource(t) } d && (BaseTexture.__proto__ = d), (BaseTexture.prototype = Object.create(d && d.prototype)).constructor = BaseTexture; var t = { realWidth: { configurable: !0 }, realHeight: { configurable: !0 } }; return t.realWidth.get = function() { return this.width * this.resolution }, t.realHeight.get = function() { return this.height * this.resolution }, BaseTexture.prototype.setStyle = function(t, e) { var r; return void 0 !== t && t !== this.scaleMode && (this.scaleMode = t, r = !0), void 0 !== e && e !== this.mipmap && (this.mipmap = e, r = !0), r && this.dirtyStyleId++, this }, BaseTexture.prototype.setSize = function(t, e, r) { return this.resolution = r || this.resolution, this.width = t, this.height = e, this._refreshPOT(), this.update(), this }, BaseTexture.prototype.setRealSize = function(t, e, r) { return this.resolution = r || this.resolution, this.width = t / this.resolution, this.height = e / this.resolution, this._refreshPOT(), this.update(), this }, BaseTexture.prototype._refreshPOT = function() { this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight) }, BaseTexture.prototype.setResolution = function(t) { var e = this.resolution; return e === t || (this.resolution = t, this.valid && (this.width = this.width * e / t, this.height = this.height * e / t, this.emit("update")), this._refreshPOT()), this }, BaseTexture.prototype.setResource = function(t) { if (this.resource === t) return this; if (this.resource) throw new Error("Resource can be set only once"); return t.bind(this), this.resource = t, this }, BaseTexture.prototype.update = function() { this.valid ? (this.dirtyId++, this.dirtyStyleId++, this.emit("update", this)) : 0 < this.width && 0 < this.height && (this.valid = !0, this.emit("loaded", this), this.emit("update", this)) }, BaseTexture.prototype.destroy = function() { this.resource && (this.resource.unbind(this), this.resource.internal && this.resource.destroy(), this.resource = null), this.cacheId && (delete k[this.cacheId], delete F[this.cacheId], this.cacheId = null), this.dispose(), BaseTexture.removeFromCache(this), this.textureCacheIds = null, this.destroyed = !0 }, BaseTexture.prototype.dispose = function() { this.emit("dispose", this) }, BaseTexture.from = function(t, e) { var r = null; r = "string" == typeof t ? t : (t._pixiId || (t._pixiId = "pixiid_" + uid()), t._pixiId); var n = k[r]; return n || ((n = new BaseTexture(t, e)).cacheId = r, BaseTexture.addToCache(n, r)), n }, BaseTexture.fromBuffer = function(t, e, r, n) { t = t || new Float32Array(e * r * 4); var i = new Ot(t, { width: e, height: r }), o = t instanceof Float32Array ? w.FLOAT : w.UNSIGNED_BYTE; return new BaseTexture(i, Object.assign(Ct, n || { width: e, height: r, type: o })) }, BaseTexture.addToCache = function(t, e) { e && (-1 === t.textureCacheIds.indexOf(e) && t.textureCacheIds.push(e), k[e], k[e] = t) }, BaseTexture.removeFromCache = function(t) { if ("string" == typeof t) { var e = k[t]; if (e) { var r = e.textureCacheIds.indexOf(t); return -1 < r && e.textureCacheIds.splice(r, 1), delete k[t], e } } else if (t && t.textureCacheIds) { for (var n = 0; n < t.textureCacheIds.length; ++n) delete k[t.textureCacheIds[n]]; return t.textureCacheIds.length = 0, t } return null }, Object.defineProperties(BaseTexture.prototype, t), BaseTexture }(l.a), Dt = function(s) { function ArrayResource(t, e) { var r; e = e || {}; var n = t; Array.isArray(t) && (n = (r = t).length), s.call(this, e.width, e.height), this.items = [], this.itemDirtyIds = []; for (var i = 0; i < n; i++) { var o = new Rt; this.items.push(o), this.itemDirtyIds.push(-1) } if (this.length = n, this._load = null, r) for (var a = 0; a < n; a++) this.addResourceAt(autoDetectResource(r[a], e), a) } return s && (ArrayResource.__proto__ = s), ((ArrayResource.prototype = Object.create(s && s.prototype)).constructor = ArrayResource).prototype.dispose = function() { for (var t = 0, e = this.length; t < e; t++) this.items[t].destroy(); this.items = null, this.itemDirtyIds = null, this._load = null }, ArrayResource.prototype.addResourceAt = function(t, e) { if (!this.items[e]) throw new Error("Index " + e + " is out of bounds"); return t.valid && !this.valid && this.resize(t.width, t.height), this.items[e].setResource(t), this }, ArrayResource.prototype.bind = function(t) { s.prototype.bind.call(this, t), t.target = b.TEXTURE_2D_ARRAY; for (var e = 0; e < this.length; e++) this.items[e].on("update", t.update, t) }, ArrayResource.prototype.unbind = function(t) { s.prototype.unbind.call(this, t); for (var e = 0; e < this.length; e++) this.items[e].off("update", t.update, t) }, ArrayResource.prototype.load = function() { var n = this; if (this._load) return this._load; var i = this.items.map(function(t) { return t.resource }), t = i.map(function(t) { return t.load() }); return this._load = Promise.all(t).then(function() { var t = i[0], e = t.width, r = t.height; return n.resize(e, r), Promise.resolve(n) }), this._load }, ArrayResource.prototype.upload = function(t, e, r) { var n = this.length, i = this.itemDirtyIds, o = this.items, a = t.gl; r.dirtyId < 0 && a.texImage3D(a.TEXTURE_2D_ARRAY, 0, e.format, this._width, this._height, n, 0, e.format, e.type, null); for (var s = 0; s < n; s++) { var u = o[s]; i[s] < u.dirtyId && (i[s] = u.dirtyId, u.valid && a.texSubImage3D(a.TEXTURE_2D_ARRAY, 0, 0, 0, s, u.resource.width, u.resource.height, 1, e.format, e.type, u.resource.source)) } return !0 }, ArrayResource }(Mt), Ft = function(t) { function CanvasResource() { t.apply(this, arguments) } return t && (CanvasResource.__proto__ = t), ((CanvasResource.prototype = Object.create(t && t.prototype)).constructor = CanvasResource).test = function(t) { return t instanceof HTMLCanvasElement }, CanvasResource }(At), kt = function(n) { function CubeResource(t, e) { if (e = e || {}, n.call(this, t, e), this.length !== CubeResource.SIDES) throw new Error("Invalid length. Got " + this.length + ", expected 6"); for (var r = 0; r < CubeResource.SIDES; r++) this.items[r].target = b.TEXTURE_CUBE_MAP_POSITIVE_X + r; !1 !== e.autoLoad && this.load() } return n && (CubeResource.__proto__ = n), ((CubeResource.prototype = Object.create(n && n.prototype)).constructor = CubeResource).prototype.bind = function(t) { n.prototype.bind.call(this, t), t.target = b.TEXTURE_CUBE_MAP }, CubeResource.prototype.upload = function(t, e, r) { for (var n = this.itemDirtyIds, i = 0; i < CubeResource.SIDES; i++) { var o = this.items[i]; n[i] < o.dirtyId && (n[i] = o.dirtyId, o.valid && o.resource.upload(t, o, r)) } return !0 }, CubeResource }(Dt); kt.SIDES = 6; var Lt = function(r) { function SVGResource(t, e) { e = e || {}, r.call(this, document.createElement("canvas")), this.svg = t, this.scale = e.scale || 1, this._resolve = null, this._load = null, !1 !== e.autoLoad && this.load() } return r && (SVGResource.__proto__ = r), ((SVGResource.prototype = Object.create(r && r.prototype)).constructor = SVGResource).prototype.load = function() { var r = this; return this._load || (this._load = new Promise(function(t) { r._resolve = function() { r.resize(r.source.width, r.source.height), t(r) }, /^\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i; var Nt = function(c) { function VideoResource(t, e) { if (e = e || {}, !(t instanceof HTMLVideoElement)) { var r = document.createElement("video"); r.setAttribute("webkit-playsinline", ""), r.setAttribute("playsinline", ""), "string" == typeof t && (t = [t]), c.crossOrigin(r, t[0].src || t[0], e.crossorigin); for (var n = 0; n < t.length; ++n) { var i = document.createElement("source"), o = t[n], a = o.src, s = o.mime, u = (a = a || t[n]).split("?").shift().toLowerCase(), h = u.substr(u.lastIndexOf(".") + 1); s = s || "video/" + h, i.src = a, i.type = s, r.appendChild(i) } t = r } c.call(this, t), this._autoUpdate = !0, this._isAutoUpdating = !1, this._updateFPS = e.updateFPS || 0, this._msToNextUpdate = 0, this.autoPlay = !1 !== e.autoPlay, this._load = null, this._resolve = null, this._onCanPlay = this._onCanPlay.bind(this), !1 !== e.autoLoad && this.load() } c && (VideoResource.__proto__ = c); var t = { autoUpdate: { configurable: !0 }, updateFPS: { configurable: !0 } }; return ((VideoResource.prototype = Object.create(c && c.prototype)).constructor = VideoResource).prototype.update = function(t) { if (void 0 === t && (t = 0), !this.destroyed) { var e = xt.shared.elapsedMS * this.source.playbackRate; this._msToNextUpdate = Math.floor(this._msToNextUpdate - e), (!this._updateFPS || this._msToNextUpdate <= 0) && (c.prototype.update.call(this, t), this._msToNextUpdate = this._updateFPS ? Math.floor(1e3 / this._updateFPS) : 0) } }, VideoResource.prototype.load = function() { var e = this; if (this._load) return this._load; var r = this.source; return (r.readyState === r.HAVE_ENOUGH_DATA || r.readyState === r.HAVE_FUTURE_DATA) && r.width && r.height && (r.complete = !0), r.addEventListener("play", this._onPlayStart.bind(this)), r.addEventListener("pause", this._onPlayStop.bind(this)), this._isSourceReady() ? this._onCanPlay() : (r.addEventListener("canplay", this._onCanPlay), r.addEventListener("canplaythrough", this._onCanPlay)), this._load = new Promise(function(t) { e.valid ? t(e) : (e._resolve = t, r.load()) }), this._load }, VideoResource.prototype._isSourcePlaying = function() { var t = this.source; return 0 < t.currentTime && !1 === t.paused && !1 === t.ended && 2 < t.readyState }, VideoResource.prototype._isSourceReady = function() { return 3 === this.source.readyState || 4 === this.source.readyState }, VideoResource.prototype._onPlayStart = function() { this.valid || this._onCanPlay(), !this._isAutoUpdating && this.autoUpdate && (xt.shared.add(this.update, this), this._isAutoUpdating = !0) }, VideoResource.prototype._onPlayStop = function() { this._isAutoUpdating && (xt.shared.remove(this.update, this), this._isAutoUpdating = !1) }, VideoResource.prototype._onCanPlay = function() { var t = this.source; t.removeEventListener("canplay", this._onCanPlay), t.removeEventListener("canplaythrough", this._onCanPlay); var e = this.valid; this.resize(t.videoWidth, t.videoHeight), !e && this._resolve && (this._resolve(this), this._resolve = null), this._isSourcePlaying() ? this._onPlayStart() : this.autoPlay && t.play() }, VideoResource.prototype.dispose = function() { this._isAutoUpdating && xt.shared.remove(this.update, this), this.source && (this.source.pause(), this.source.src = "", this.source.load()), c.prototype.dispose.call(this) }, t.autoUpdate.get = function() { return this._autoUpdate }, t.autoUpdate.set = function(t) { t !== this._autoUpdate && (this._autoUpdate = t, !this._autoUpdate && this._isAutoUpdating ? (xt.shared.remove(this.update, this), this._isAutoUpdating = !1) : this._autoUpdate && !this._isAutoUpdating && (xt.shared.add(this.update, this), this._isAutoUpdating = !0)) }, t.updateFPS.get = function() { return this._updateFPS }, t.updateFPS.set = function(t) { t !== this._updateFPS && (this._updateFPS = t) }, VideoResource.test = function(t, e) { return t instanceof HTMLVideoElement || -1 < VideoResource.TYPES.indexOf(e) }, Object.defineProperties(VideoResource.prototype, t), VideoResource }(At); Nt.TYPES = ["mp4", "m4v", "webm", "ogg", "ogv", "h264", "avi", "mov"], It.push(Pt, Ft, Nt, Lt, Ot, kt, Dt); var Bt = { INSTALLED: It, autoDetectResource: autoDetectResource, ArrayResource: Dt, BufferResource: Ot, CanvasResource: Ft, CubeResource: kt, ImageResource: Pt, SVGResource: Lt, VideoResource: Nt, Resource: Mt, BaseImageResource: At }, Ut = function(t) { this.renderer = t, this.renderer.runners.contextChange.add(this) }; Ut.prototype.contextChange = function(t) {}, Ut.prototype.destroy = function() { this.renderer.runners.contextChange.remove(this), this.renderer = null }; var Gt = function(t) { function DepthResource() { t.apply(this, arguments) } return t && (DepthResource.__proto__ = t), ((DepthResource.prototype = Object.create(t && t.prototype)).constructor = DepthResource).prototype.upload = function(t, e, r) { var n = t.gl; return n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, e.premultiplyAlpha), r.width === e.width && r.height === e.height ? n.texSubImage2D(e.target, 0, 0, 0, e.width, e.height, e.format, e.type, this.data) : (r.width = e.width, r.height = e.height, n.texImage2D(e.target, 0, n.DEPTH_COMPONENT16, e.width, e.height, 0, e.format, e.type, this.data)), !0 }, DepthResource }(Ot), jt = function(t, e) { this.width = Math.ceil(t || 100), this.height = Math.ceil(e || 100), this.stencil = !1, this.depth = !1, this.dirtyId = 0, this.dirtyFormat = 0, this.dirtySize = 0, this.depthTexture = null, this.colorTextures = [], this.glFramebuffers = {}, this.disposeRunner = new gt("disposeFramebuffer", 2) }, zt = { colorTexture: { configurable: !0 } }; zt.colorTexture.get = function() { return this.colorTextures[0] }, jt.prototype.addColorTexture = function(t, e) { return void 0 === t && (t = 0), this.colorTextures[t] = e || new Rt(null, { scaleMode: 0, resolution: 1, mipmap: !1, width: this.width, height: this.height }), this.dirtyId++, this.dirtyFormat++, this }, jt.prototype.addDepthTexture = function(t) { return this.depthTexture = t || new Rt(new Gt(null, { width: this.width, height: this.height }), { scaleMode: 0, resolution: 1, width: this.width, height: this.height, mipmap: !1, format: _.DEPTH_COMPONENT, type: w.UNSIGNED_SHORT }), this.dirtyId++, this.dirtyFormat++, this }, jt.prototype.enableDepth = function() { return this.depth = !0, this.dirtyId++, this.dirtyFormat++, this }, jt.prototype.enableStencil = function() { return this.stencil = !0, this.dirtyId++, this.dirtyFormat++, this }, jt.prototype.resize = function(t, e) { if (t = Math.ceil(t), e = Math.ceil(e), t !== this.width || e !== this.height) { this.width = t, this.height = e, this.dirtyId++, this.dirtySize++; for (var r = 0; r < this.colorTextures.length; r++) { var n = this.colorTextures[r], i = n.resolution; n.setSize(t / i, e / i) } if (this.depthTexture) { var o = this.depthTexture.resolution; this.depthTexture.setSize(t / o, e / o) } } }, jt.prototype.dispose = function() { this.disposeRunner.run(this, !1) }, Object.defineProperties(jt.prototype, zt); var Xt = function(i) { function BaseRenderTexture(t) { "number" == typeof t && (t = { width: arguments[0], height: arguments[1], scaleMode: arguments[2], resolution: arguments[3] }); i.call(this, null, t); var e = t || {}, r = e.width, n = e.height; this.mipmap = !1, this.width = Math.ceil(r) || 100, this.height = Math.ceil(n) || 100, this.valid = !0, this._canvasRenderTarget = null, this.clearColor = [0, 0, 0, 0], this.framebuffer = new jt(this.width * this.resolution, this.height * this.resolution).addColorTexture(0, this).enableStencil(), this.stencilMaskStack = [], this.filterStack = [{}] } return i && (BaseRenderTexture.__proto__ = i), ((BaseRenderTexture.prototype = Object.create(i && i.prototype)).constructor = BaseRenderTexture).prototype.resize = function(t, e) { t = Math.ceil(t), e = Math.ceil(e), this.framebuffer.resize(t * this.resolution, e * this.resolution) }, BaseRenderTexture.prototype.dispose = function() { this.framebuffer.dispose(), i.prototype.dispose.call(this) }, BaseRenderTexture.prototype.destroy = function() { i.prototype.destroy.call(this, !0), this.framebuffer = null, this.renderer = null }, BaseRenderTexture }(Rt), Vt = function() { this.x0 = 0, this.y0 = 0, this.x1 = 1, this.y1 = 0, this.x2 = 1, this.y2 = 1, this.x3 = 0, this.y3 = 1, this.uvsFloat32 = new Float32Array(8) }; Vt.prototype.set = function(t, e, r) { var n = e.width, i = e.height; if (r) { var o = t.width / 2 / n, a = t.height / 2 / i, s = t.x / n + o, u = t.y / i + a; r = rt.add(r, rt.NW), this.x0 = s + o * rt.uX(r), this.y0 = u + a * rt.uY(r), r = rt.add(r, 2), this.x1 = s + o * rt.uX(r), this.y1 = u + a * rt.uY(r), r = rt.add(r, 2), this.x2 = s + o * rt.uX(r), this.y2 = u + a * rt.uY(r), r = rt.add(r, 2), this.x3 = s + o * rt.uX(r), this.y3 = u + a * rt.uY(r) } else this.x0 = t.x / n, this.y0 = t.y / i, this.x1 = (t.x + t.width) / n, this.y1 = t.y / i, this.x2 = (t.x + t.width) / n, this.y2 = (t.y + t.height) / i, this.x3 = t.x / n, this.y3 = (t.y + t.height) / i; this.uvsFloat32[0] = this.x0, this.uvsFloat32[1] = this.y0, this.uvsFloat32[2] = this.x1, this.uvsFloat32[3] = this.y1, this.uvsFloat32[4] = this.x2, this.uvsFloat32[5] = this.y2, this.uvsFloat32[6] = this.x3, this.uvsFloat32[7] = this.y3 }; var qt = new Vt, Ht = function(a) { function Texture(t, e, r, n, i, o) { if (a.call(this), this.noFrame = !1, e || (this.noFrame = !0, e = new ot(0, 0, 1, 1)), t instanceof Texture && (t = t.baseTexture), this.baseTexture = t, this._frame = e, this.trim = n, this.valid = !1, this.requiresUpdate = !1, this._uvs = qt, this.uvMatrix = null, this.orig = r || e, this._rotate = Number(i || 0), !0 === i) this._rotate = 2; else if (this._rotate % 2 != 0) throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually"); t.valid ? (this.noFrame && (e = new ot(0, 0, t.width, t.height), t.on("update", this.onBaseTextureUpdated, this)), this.frame = e) : t.once("loaded", this.onBaseTextureUpdated, this), this.defaultAnchor = o ? new q(o.x, o.y) : new q(0, 0), this._updateID = 0, this.textureCacheIds = [] } a && (Texture.__proto__ = a); var t = { frame: { configurable: !0 }, rotate: { configurable: !0 }, width: { configurable: !0 }, height: { configurable: !0 } }; return ((Texture.prototype = Object.create(a && a.prototype)).constructor = Texture).prototype.update = function() { this.baseTexture.update() }, Texture.prototype.onBaseTextureUpdated = function(t) { this._updateID++, this.noFrame ? this.frame = new ot(0, 0, t.width, t.height) : this.frame = this._frame, this.emit("update", this) }, Texture.prototype.destroy = function(t) { this.baseTexture && (t && (F[this.baseTexture.imageUrl] && Texture.removeFromCache(this.baseTexture.imageUrl), this.baseTexture.destroy()), this.baseTexture.off("update", this.onBaseTextureUpdated, this), this.baseTexture = null), this._frame = null, this._uvs = null, this.trim = null, this.orig = null, this.valid = !1, Texture.removeFromCache(this), this.textureCacheIds = null }, Texture.prototype.clone = function() { return new Texture(this.baseTexture, this.frame, this.orig, this.trim, this.rotate, this.defaultAnchor) }, Texture.prototype.updateUvs = function() { this._uvs === qt && (this._uvs = new Vt), this._uvs.set(this._frame, this.baseTexture, this.rotate), this._updateID++ }, Texture.from = function(t, e) { void 0 === e && (e = {}); var r = null; r = "string" == typeof t ? t : (t._pixiId || (t._pixiId = "pixiid_" + uid()), t._pixiId); var n = F[r]; return n || (e.resolution || (e.resolution = getResolutionOfUrl(t)), (n = new Texture(new Rt(t, e))).baseTexture.cacheId = r, Rt.addToCache(n.baseTexture, r), Texture.addToCache(n, r)), n }, Texture.fromBuffer = function(t, e, r, n) { return new Texture(Rt.fromBuffer(t, e, r, n)) }, Texture.fromLoader = function(t, e, r) { var n = new Pt(t); n.url = e; var i = new Texture(new Rt(n, { scaleMode: M.SCALE_MODE, resolution: getResolutionOfUrl(e) })); return r || (r = e), Rt.addToCache(i.baseTexture, r), Texture.addToCache(i, r), r !== e && (Rt.addToCache(i.baseTexture, e), Texture.addToCache(i, e)), i }, Texture.addToCache = function(t, e) { e && (-1 === t.textureCacheIds.indexOf(e) && t.textureCacheIds.push(e), F[e], F[e] = t) }, Texture.removeFromCache = function(t) { if ("string" == typeof t) { var e = F[t]; if (e) { var r = e.textureCacheIds.indexOf(t); return -1 < r && e.textureCacheIds.splice(r, 1), delete F[t], e } } else if (t && t.textureCacheIds) { for (var n = 0; n < t.textureCacheIds.length; ++n) F[t.textureCacheIds[n]] === t && delete F[t.textureCacheIds[n]]; return t.textureCacheIds.length = 0, t } return null }, t.frame.get = function() { return this._frame }, t.frame.set = function(t) { this._frame = t, this.noFrame = !1; var e = t.x, r = t.y, n = t.width, i = t.height, o = e + n > this.baseTexture.width, a = r + i > this.baseTexture.height; if (o || a) { var s = o && a ? "and" : "or", u = "X: " + e + " + " + n + " = " + (e + n) + " > " + this.baseTexture.width, h = "Y: " + r + " + " + i + " = " + (r + i) + " > " + this.baseTexture.height; throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: " + u + " " + s + " " + h) } this.valid = n && i && this.baseTexture.valid, this.trim || this.rotate || (this.orig = t), this.valid && this.updateUvs() }, t.rotate.get = function() { return this._rotate }, t.rotate.set = function(t) { this._rotate = t, this.valid && this.updateUvs() }, t.width.get = function() { return this.orig.width }, t.height.get = function() { return this.orig.height }, Object.defineProperties(Texture.prototype, t), Texture }(l.a); function removeAllHandlers(t) { t.destroy = function() {}, t.on = function() {}, t.once = function() {}, t.emit = function() {} } Ht.EMPTY = new Ht(new Rt), removeAllHandlers(Ht.EMPTY), removeAllHandlers(Ht.EMPTY.baseTexture), Ht.WHITE = function() { var t = document.createElement("canvas"); t.width = 16, t.height = 16; var e = t.getContext("2d"); return e.fillStyle = "white", e.fillRect(0, 0, 16, 16), new Ht(new Rt(new Ft(t))) }(), removeAllHandlers(Ht.WHITE), removeAllHandlers(Ht.WHITE.baseTexture); var Wt = function(s) { function RenderTexture(t, e) { var r = null; if (!(t instanceof Xt)) { var n = arguments[1], i = arguments[2], o = arguments[3], a = arguments[4]; r = arguments[0], e = null, t = new Xt({ width: n, height: i, scaleMode: o, resolution: a }) } s.call(this, t, e), this.legacyRenderer = r, this.valid = !0, this.filterFrame = null, this.filterPoolKey = null, this.updateUvs() } return s && (RenderTexture.__proto__ = s), ((RenderTexture.prototype = Object.create(s && s.prototype)).constructor = RenderTexture).prototype.resize = function(t, e, r) { void 0 === r && (r = !0), t = Math.ceil(t), e = Math.ceil(e), this.valid = 0 < t && 0 < e, this._frame.width = this.orig.width = t, this._frame.height = this.orig.height = e, r && this.baseTexture.resize(t, e), this.updateUvs() }, RenderTexture.create = function(t) { return "number" == typeof t && (t = { width: t, height: arguments[1], scaleMode: arguments[2], resolution: arguments[3] }), new RenderTexture(new Xt(t)) }, RenderTexture }(Ht), Yt = function(t, e, r, n, i, o, a) { void 0 === r && (r = !1), void 0 === n && (n = 5126), this.buffer = t, this.size = e, this.normalized = r, this.type = n, this.stride = i, this.start = o, this.instance = a }; Yt.prototype.destroy = function() { this.buffer = null }, Yt.from = function(t, e, r, n, i) { return new Yt(t, e, r, n, i) }; var Kt = 0, Zt = function(t, e, r) { void 0 === e && (e = !0), void 0 === r && (r = !1), this.data = t || new Float32Array(1), this._glBuffers = {}, this._updateID = 0, this.index = r, this.static = e, this.id = Kt++, this.disposeRunner = new gt("disposeBuffer", 2) }; function getBufferType(t) { if (4 === t.BYTES_PER_ELEMENT) return t instanceof Float32Array ? "Float32Array" : t instanceof Uint32Array ? "Uint32Array" : "Int32Array"; if (2 === t.BYTES_PER_ELEMENT) { if (t instanceof Uint16Array) return "Uint16Array" } else if (1 === t.BYTES_PER_ELEMENT && t instanceof Uint8Array) return "Uint8Array"; return null } Zt.prototype.update = function(t) { this.data = t || this.data, this._updateID++ }, Zt.prototype.dispose = function() { this.disposeRunner.run(this, !1) }, Zt.prototype.destroy = function() { this.dispose(), this.data = null }, Zt.from = function(t) { return t instanceof Array && (t = new Float32Array(t)), new Zt(t) }; var Qt = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array }; var Jt = { 5126: 4, 5123: 2, 5121: 1 }, $t = 0, te = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array, Uint16Array: Uint16Array }, ee = function(t, e) { void 0 === t && (t = []), void 0 === e && (e = {}), this.buffers = t, this.indexBuffer = null, this.attributes = e, this.glVertexArrayObjects = {}, this.id = $t++, this.instanced = !1, this.instanceCount = 1, this._size = null, this.disposeRunner = new gt("disposeGeometry", 2), this.refCount = 0 }; ee.prototype.addAttribute = function(t, e, r, n, i, o, a, s) { if (void 0 === n && (n = !1), void 0 === s && (s = !1), !e) throw new Error("You must pass a buffer when creating an attribute"); e.data || (e instanceof Array && (e = new Float32Array(e)), e = new Zt(e)); var u = t.split("|"); if (1 < u.length) { for (var h = 0; h < u.length; h++) this.addAttribute(u[h], e, r, n, i); return this } var c = this.buffers.indexOf(e); return -1 === c && (this.buffers.push(e), c = this.buffers.length - 1), this.attributes[t] = new Yt(c, r, n, i, o, a, s), this.instanced = this.instanced || s, this }, ee.prototype.getAttribute = function(t) { return this.buffers[this.attributes[t].buffer] }, ee.prototype.addIndex = function(t) { return t.data || (t instanceof Array && (t = new Uint16Array(t)), t = new Zt(t)), t.index = !0, this.indexBuffer = t, -1 === this.buffers.indexOf(t) && this.buffers.push(t), this }, ee.prototype.getIndex = function() { return this.indexBuffer }, ee.prototype.interleave = function() { if (1 === this.buffers.length || 2 === this.buffers.length && this.indexBuffer) return this; var t, e = [], r = [], n = new Zt; for (t in this.attributes) { var i = this.attributes[t], o = this.buffers[i.buffer]; e.push(o.data), r.push(i.size * Jt[i.type] / 4), i.buffer = 0 } for (n.data = function(t, e) { for (var r = 0, n = 0, i = {}, o = 0; o < t.length; o++) n += e[o], r += t[o].length; for (var a = new ArrayBuffer(4 * r), s = null, u = 0, h = 0; h < t.length; h++) { var c = e[h], l = t[h], f = getBufferType(l); i[f] || (i[f] = new Qt[f](a)), s = i[f]; for (var d = 0; d < l.length; d++) s[(d / c | 0) * n + u + d % c] = l[d]; u += c } return new Float32Array(a) }(e, r), t = 0; t < this.buffers.length; t++) this.buffers[t] !== this.indexBuffer && this.buffers[t].destroy(); return this.buffers = [n], this.indexBuffer && this.buffers.push(this.indexBuffer), this }, ee.prototype.getSize = function() { for (var t in this.attributes) { var e = this.attributes[t]; return this.buffers[e.buffer].data.length / (e.stride / 4 || e.size) } return 0 }, ee.prototype.dispose = function() { this.disposeRunner.run(this, !1) }, ee.prototype.destroy = function() { this.dispose(), this.buffers = null, this.indexBuffer.destroy(), this.attributes = null }, ee.prototype.clone = function() { for (var t = new ee, e = 0; e < this.buffers.length; e++) t.buffers[e] = new Zt(this.buffers[e].data.slice()); for (var r in this.attributes) { var n = this.attributes[r]; t.attributes[r] = new Yt(n.buffer, n.size, n.normalized, n.type, n.stride, n.start, n.instance) } return this.indexBuffer && (t.indexBuffer = t.buffers[this.buffers.indexOf(this.indexBuffer)], t.indexBuffer.index = !0), t }, ee.merge = function(t) { for (var e, r = new ee, n = [], i = [], o = [], a = 0; a < t.length; a++) { e = t[a]; for (var s = 0; s < e.buffers.length; s++) i[s] = i[s] || 0, i[s] += e.buffers[s].data.length, o[s] = 0 } for (var u = 0; u < e.buffers.length; u++) n[u] = new(te[getBufferType(e.buffers[u].data)])(i[u]), r.buffers[u] = new Zt(n[u]); for (var h = 0; h < t.length; h++) { e = t[h]; for (var c = 0; c < e.buffers.length; c++) n[c].set(e.buffers[c].data, o[c]), o[c] += e.buffers[c].data.length } if (r.attributes = e.attributes, e.indexBuffer) { r.indexBuffer = r.buffers[e.buffers.indexOf(e.indexBuffer)], r.indexBuffer.index = !0; for (var l = 0, f = 0, d = 0, p = 0, m = 0; m < e.buffers.length; m++) if (e.buffers[m] !== e.indexBuffer) { p = m; break } for (var v in e.attributes) { var g = e.attributes[v]; (0 | g.buffer) === p && (f += g.size * Jt[g.type] / 4) } for (var y = 0; y < t.length; y++) { for (var _ = t[y].indexBuffer.data, b = 0; b < _.length; b++) r.indexBuffer.data[b + d] += l; l += e.buffers[p].data.length / f, d += _.length } } return r }; var re = function(t) { function Quad() { t.call(this), this.addAttribute("aVertexPosition", [0, 0, 1, 0, 1, 1, 0, 1]).addIndex([0, 1, 3, 2]) } return t && (Quad.__proto__ = t), (Quad.prototype = Object.create(t && t.prototype)).constructor = Quad }(ee), ne = function(t) { function QuadUv() { t.call(this), this.vertices = new Float32Array([-1, -1, 1, -1, 1, 1, -1, 1]), this.uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]), this.vertexBuffer = new Zt(this.vertices), this.uvBuffer = new Zt(this.uvs), this.addAttribute("aVertexPosition", this.vertexBuffer).addAttribute("aTextureCoord", this.uvBuffer).addIndex([0, 1, 2, 0, 2, 3]) } return t && (QuadUv.__proto__ = t), ((QuadUv.prototype = Object.create(t && t.prototype)).constructor = QuadUv).prototype.map = function(t, e) { var r = 0, n = 0; return this.uvs[0] = r, this.uvs[1] = n, this.uvs[2] = r + e.width / t.width, this.uvs[3] = n, this.uvs[4] = r + e.width / t.width, this.uvs[5] = n + e.height / t.height, this.uvs[6] = r, this.uvs[7] = n + e.height / t.height, r = e.x, n = e.y, this.vertices[0] = r, this.vertices[1] = n, this.vertices[2] = r + e.width, this.vertices[3] = n, this.vertices[4] = r + e.width, this.vertices[5] = n + e.height, this.vertices[6] = r, this.vertices[7] = n + e.height, this.invalidate(), this }, QuadUv.prototype.invalidate = function() { return this.vertexBuffer._updateID++, this.uvBuffer._updateID++, this }, QuadUv }(ee); var ie = 0, oe = function(t, e) { this.uniforms = t, this.group = !0, this.syncUniforms = {}, this.dirtyId = 0, this.id = ie++, this.static = !!e }; oe.prototype.update = function() { this.dirtyId++ }, oe.prototype.add = function(t, e, r) { this.uniforms[t] = new oe(e, r) }, oe.from = function(t, e) { return new oe(t, e) }; var ae = function() { this.renderTexture = null, this.target = null, this.legacy = !1, this.resolution = 1, this.sourceFrame = new ot, this.destinationFrame = new ot, this.filters = [] }; ae.prototype.clear = function() { this.target = null, this.filters = null, this.renderTexture = null }; var se = "screen", ue = function(e) { function FilterSystem(t) { e.call(this, t), this.defaultFilterStack = [{}], this.texturePool = {}, this.statePool = [], this.quad = new re, this.quadUv = new ne, this.tempRect = new ot, this.activeState = {}, this.globalUniforms = new oe({ outputFrame: this.tempRect, inputSize: new Float32Array(4), inputPixel: new Float32Array(4), inputClamp: new Float32Array(4), resolution: 1, filterArea: new Float32Array(4), filterClamp: new Float32Array(4) }, !0), this._pixelsWidth = t.view.width, this._pixelsHeight = t.view.height } return e && (FilterSystem.__proto__ = e), ((FilterSystem.prototype = Object.create(e && e.prototype)).constructor = FilterSystem).prototype.push = function(t, e) { for (var r = this.renderer, n = this.defaultFilterStack, i = this.statePool.pop() || new ae, o = e[0].resolution, a = e[0].padding, s = e[0].autoFit, u = e[0].legacy, h = 1; h < e.length; h++) { var c = e[h]; o = Math.min(o, c.resolution), a = Math.max(a, c.padding), s = s || c.autoFit, u = u || c.legacy } 1 === n.length && (this.defaultFilterStack[0].renderTexture = r.renderTexture.current), n.push(i), i.resolution = o, i.legacy = u, i.target = t, i.sourceFrame.copyFrom(t.filterArea || t.getBounds(!0)), i.sourceFrame.pad(a), s && i.sourceFrame.fit(this.renderer.renderTexture.sourceFrame), i.sourceFrame.ceil(o), i.renderTexture = this.getOptimalFilterTexture(i.sourceFrame.width, i.sourceFrame.height, o), i.filters = e, i.destinationFrame.width = i.renderTexture.width, i.destinationFrame.height = i.renderTexture.height, i.renderTexture.filterFrame = i.sourceFrame, r.renderTexture.bind(i.renderTexture, i.sourceFrame), r.renderTexture.clear() }, FilterSystem.prototype.pop = function() { var t = this.defaultFilterStack, e = t.pop(), r = e.filters; this.activeState = e; var n = this.globalUniforms.uniforms; n.outputFrame = e.sourceFrame, n.resolution = e.resolution; var i = n.inputSize, o = n.inputPixel, a = n.inputClamp; if (i[0] = e.destinationFrame.width, i[1] = e.destinationFrame.height, i[2] = 1 / i[0], i[3] = 1 / i[1], o[0] = i[0] * e.resolution, o[1] = i[1] * e.resolution, o[2] = 1 / o[0], o[3] = 1 / o[1], a[0] = .5 * o[2], a[1] = .5 * o[3], a[2] = e.sourceFrame.width * i[2] - .5 * o[2], a[3] = e.sourceFrame.height * i[3] - .5 * o[3], e.legacy) { var s = n.filterArea; s[0] = e.destinationFrame.width, s[1] = e.destinationFrame.height, s[2] = e.sourceFrame.x, s[3] = e.sourceFrame.y, n.filterClamp = n.inputClamp } this.globalUniforms.update(); var u = t[t.length - 1]; if (1 === r.length) r[0].apply(this, e.renderTexture, u.renderTexture, !1, e), this.returnFilterTexture(e.renderTexture); else { var h = e.renderTexture, c = this.getOptimalFilterTexture(h.width, h.height, e.resolution); c.filterFrame = h.filterFrame; var l = 0; for (l = 0; l < r.length - 1; ++l) { r[l].apply(this, h, c, !0, e); var f = h; h = c, c = f } r[l].apply(this, h, u.renderTexture, !1, e), this.returnFilterTexture(h), this.returnFilterTexture(c) } e.clear(), this.statePool.push(e) }, FilterSystem.prototype.applyFilter = function(t, e, r, n) { var i = this.renderer; i.renderTexture.bind(r, r ? r.filterFrame : null), n && i.renderTexture.clear(), t.uniforms.uSampler = e, t.uniforms.filterGlobals = this.globalUniforms, i.state.setState(t.state), i.shader.bind(t), t.legacy ? (this.quadUv.map(e._frame, e.filterFrame), i.geometry.bind(this.quadUv), i.geometry.draw(x.TRIANGLES)) : (i.geometry.bind(this.quad), i.geometry.draw(x.TRIANGLE_STRIP)) }, FilterSystem.prototype.calculateScreenSpaceMatrix = function(t) { var e, r, n, i, o = this.activeState; return e = t, r = o.sourceFrame, n = o.destinationFrame, (i = e.identity()).translate(r.x / n.width, r.y / n.height), i.scale(n.width, n.height), i }, FilterSystem.prototype.calculateSpriteMatrix = function(t, e) { var r, n, i, o, a, s, u, h = this.activeState; return r = t, n = h.sourceFrame, i = h.destinationFrame, a = (o = e)._texture.orig, s = r.set(i.width, 0, 0, i.height, n.x, n.y), (u = o.worldTransform.copyTo(Y.TEMP_MATRIX)).invert(), s.prepend(u), s.scale(1 / a.width, 1 / a.height), s.translate(o.anchor.x, o.anchor.y), s }, FilterSystem.prototype.destroy = function(t) { void 0 === t && (t = !1), t ? this.texturePool = {} : this.emptyPool() }, FilterSystem.prototype.getOptimalFilterTexture = function(t, e, r) { void 0 === r && (r = 1); var n = se; e *= r, (t *= r) === this._pixelsWidth && e === this._pixelsHeight || (n = (65535 & (t = nextPow2(t))) << 16 | 65535 & (e = nextPow2(e))), this.texturePool[n] || (this.texturePool[n] = []); var i = this.texturePool[n].pop(); return i || (i = Wt.create({ width: t / r, height: e / r, resolution: r })), i.filterPoolKey = n, i }, FilterSystem.prototype.getFilterTexture = function(t) { var e = this.activeState.renderTexture, r = this.getOptimalFilterTexture(e.width, e.height, t || e.baseTexture.resolution); return r.filterFrame = e.filterFrame, r }, FilterSystem.prototype.returnFilterTexture = function(t) { var e = t.filterPoolKey; t.filterFrame = null, this.texturePool[e].push(t) }, FilterSystem.prototype.emptyPool = function() { for (var t in this.texturePool) { var e = this.texturePool[t]; if (e) for (var r = 0; r < e.length; r++) e[r].destroy(!0) } this.texturePool = {} }, FilterSystem.prototype.resize = function() { var t = this.texturePool[se]; if (t) for (var e = 0; e < t.length; e++) t[e].destroy(!0); this.texturePool[se] = [], this._pixelsWidth = this.renderer.view.width, this._pixelsHeight = this.renderer.view.height }, FilterSystem }(Ut), he = function(t) { function ObjectRenderer() { t.apply(this, arguments) } return t && (ObjectRenderer.__proto__ = t), ((ObjectRenderer.prototype = Object.create(t && t.prototype)).constructor = ObjectRenderer).prototype.start = function() {}, ObjectRenderer.prototype.stop = function() { this.flush() }, ObjectRenderer.prototype.flush = function() {}, ObjectRenderer.prototype.render = function(t) {}, ObjectRenderer }(Ut), ce = function(e) { function BatchSystem(t) { e.call(this, t), this.emptyRenderer = new he(t), this.currentRenderer = this.emptyRenderer } return e && (BatchSystem.__proto__ = e), ((BatchSystem.prototype = Object.create(e && e.prototype)).constructor = BatchSystem).prototype.setObjectRenderer = function(t) { this.currentRenderer !== t && (this.currentRenderer.stop(), this.currentRenderer = t, this.currentRenderer.start()) }, BatchSystem.prototype.flush = function() { this.setObjectRenderer(this.emptyRenderer) }, BatchSystem.prototype.reset = function() { this.setObjectRenderer(this.emptyRenderer) }, BatchSystem }(Ut); M.PREFER_ENV = h.a.any ? v.WEBGL : v.WEBGL2; var le = 0, fe = function(e) { function ContextSystem(t) { e.call(this, t), this.webGLVersion = 1, this.extensions = {}, this.handleContextLost = this.handleContextLost.bind(this), this.handleContextRestored = this.handleContextRestored.bind(this), t.view.addEventListener("webglcontextlost", this.handleContextLost, !1), t.view.addEventListener("webglcontextrestored", this.handleContextRestored, !1) } e && (ContextSystem.__proto__ = e), (ContextSystem.prototype = Object.create(e && e.prototype)).constructor = ContextSystem; var t = { isLost: { configurable: !0 } }; return t.isLost.get = function() { return !this.gl || this.gl.isContextLost() }, ContextSystem.prototype.contextChange = function(t) { (this.gl = t).isContextLost() && t.getExtension("WEBGL_lose_context") && t.getExtension("WEBGL_lose_context").restoreContext() }, ContextSystem.prototype.initFromContext = function(t) { this.gl = t, this.validateContext(t), this.renderer.gl = t, this.renderer.CONTEXT_UID = le++, this.renderer.runners.contextChange.run(t) }, ContextSystem.prototype.initFromOptions = function(t) { var e = this.createContext(this.renderer.view, t); this.initFromContext(e) }, ContextSystem.prototype.createContext = function(t, e) { var r; if (M.PREFER_ENV >= v.WEBGL2 && (r = t.getContext("webgl2", e)), r) this.webGLVersion = 2; else if (this.webGLVersion = 1, !(r = t.getContext("webgl", e) || t.getContext("experimental-webgl", e))) throw new Error("This browser does not support WebGL. Try using the canvas renderer"); return this.gl = r, this.getExtensions(), r }, ContextSystem.prototype.getExtensions = function() { var t = this.gl; 1 === this.webGLVersion && Object.assign(this.extensions, { drawBuffers: t.getExtension("WEBGL_draw_buffers"), depthTexture: t.getExtension("WEBKIT_WEBGL_depth_texture"), floatTexture: t.getExtension("OES_texture_float"), loseContext: t.getExtension("WEBGL_lose_context"), vertexArrayObject: t.getExtension("OES_vertex_array_object") || t.getExtension("MOZ_OES_vertex_array_object") || t.getExtension("WEBKIT_OES_vertex_array_object") }) }, ContextSystem.prototype.handleContextLost = function(t) { t.preventDefault() }, ContextSystem.prototype.handleContextRestored = function() { this.renderer.runners.contextChange.run(this.gl) }, ContextSystem.prototype.destroy = function() { var t = this.renderer.view; t.removeEventListener("webglcontextlost", this.handleContextLost), t.removeEventListener("webglcontextrestored", this.handleContextRestored), this.gl.useProgram(null), this.extensions.loseContext && this.extensions.loseContext.loseContext() }, ContextSystem.prototype.postrender = function() { this.gl.flush() }, ContextSystem.prototype.validateContext = function(t) { t.getContextAttributes().stencil }, Object.defineProperties(ContextSystem.prototype, t), ContextSystem }(Ut), de = function(e) { function FramebufferSystem(t) { e.call(this, t), this.managedFramebuffers = [], this.unknownFramebuffer = new jt(10, 10) } e && (FramebufferSystem.__proto__ = e); var t = { size: { configurable: !0 } }; return ((FramebufferSystem.prototype = Object.create(e && e.prototype)).constructor = FramebufferSystem).prototype.contextChange = function() { var t = this.gl = this.renderer.gl; if (this.CONTEXT_UID = this.renderer.CONTEXT_UID, this.current = this.unknownFramebuffer, this.viewport = new ot, this.hasMRT = !0, this.writeDepthTexture = !0, this.disposeAll(!0), 1 === this.renderer.context.webGLVersion) { var e = this.renderer.context.extensions.drawBuffers, r = this.renderer.context.extensions.depthTexture; M.PREFER_ENV === v.WEBGL_LEGACY && (r = e = null), t.drawBuffers = e ? function(t) { return e.drawBuffersWEBGL(t) } : (this.hasMRT = !1, function() {}), r || (this.writeDepthTexture = !1) } }, FramebufferSystem.prototype.bind = function(t, e) { var r = this.gl; if (t) { var n = t.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(t); this.current !== t && (this.current = t, r.bindFramebuffer(r.FRAMEBUFFER, n.framebuffer)), n.dirtyId !== t.dirtyId && (n.dirtyId = t.dirtyId, n.dirtyFormat !== t.dirtyFormat ? (n.dirtyFormat = t.dirtyFormat, this.updateFramebuffer(t)) : n.dirtySize !== t.dirtySize && (n.dirtySize = t.dirtySize, this.resizeFramebuffer(t))); for (var i = 0; i < t.colorTextures.length; i++) t.colorTextures[i].texturePart ? this.renderer.texture.unbind(t.colorTextures[i].texture) : this.renderer.texture.unbind(t.colorTextures[i]); t.depthTexture && this.renderer.texture.unbind(t.depthTexture), e ? this.setViewport(e.x, e.y, e.width, e.height) : this.setViewport(0, 0, t.width, t.height) } else this.current && (this.current = null, r.bindFramebuffer(r.FRAMEBUFFER, null)), e ? this.setViewport(e.x, e.y, e.width, e.height) : this.setViewport(0, 0, this.renderer.width, this.renderer.height) }, FramebufferSystem.prototype.setViewport = function(t, e, r, n) { var i = this.viewport; i.width === r && i.height === n && i.x === t && i.y === e || (i.x = t, i.y = e, i.width = r, i.height = n, this.gl.viewport(t, e, r, n)) }, t.size.get = function() { return this.current ? { x: 0, y: 0, width: this.current.width, height: this.current.height } : { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height } }, FramebufferSystem.prototype.clear = function(t, e, r, n) { var i = this.gl; i.clearColor(t, e, r, n), i.clear(i.COLOR_BUFFER_BIT | i.DEPTH_BUFFER_BIT) }, FramebufferSystem.prototype.initFramebuffer = function(t) { var e = { framebuffer: this.gl.createFramebuffer(), stencil: null, dirtyId: 0, dirtyFormat: 0, dirtySize: 0 }; return t.glFramebuffers[this.CONTEXT_UID] = e, this.managedFramebuffers.push(t), t.disposeRunner.add(this), e }, FramebufferSystem.prototype.resizeFramebuffer = function(t) { var e = this.gl, r = t.glFramebuffers[this.CONTEXT_UID]; r.stencil && (e.bindRenderbuffer(e.RENDERBUFFER, r.stencil), e.renderbufferStorage(e.RENDERBUFFER, e.DEPTH_STENCIL, t.width, t.height)); for (var n = t.colorTextures, i = 0; i < n.length; i++) this.renderer.texture.bind(n[i], 0); t.depthTexture && this.renderer.texture.bind(t.depthTexture, 0) }, FramebufferSystem.prototype.updateFramebuffer = function(t) { var e = this.gl, r = t.glFramebuffers[this.CONTEXT_UID], n = t.colorTextures.length; e.drawBuffers || (n = Math.min(n, 1)); for (var i = [], o = 0; o < n; o++) { var a = t.colorTextures[o]; a.texturePart ? (this.renderer.texture.bind(a.texture, 0), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + o, e.TEXTURE_CUBE_MAP_NEGATIVE_X + a.side, a.texture._glTextures[this.CONTEXT_UID].texture, 0)) : (this.renderer.texture.bind(a, 0), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + o, e.TEXTURE_2D, a._glTextures[this.CONTEXT_UID].texture, 0)), i.push(e.COLOR_ATTACHMENT0 + o) } if ((1 < i.length && e.drawBuffers(i), t.depthTexture) && this.writeDepthTexture) { var s = t.depthTexture; this.renderer.texture.bind(s, 0), e.framebufferTexture2D(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.TEXTURE_2D, s._glTextures[this.CONTEXT_UID].texture, 0) } r.stencil || !t.stencil && !t.depth || (r.stencil = e.createRenderbuffer(), e.bindRenderbuffer(e.RENDERBUFFER, r.stencil), t.depthTexture || e.framebufferRenderbuffer(e.FRAMEBUFFER, e.DEPTH_STENCIL_ATTACHMENT, e.RENDERBUFFER, r.stencil), e.renderbufferStorage(e.RENDERBUFFER, e.DEPTH_STENCIL, t.width, t.height)) }, FramebufferSystem.prototype.disposeFramebuffer = function(t, e) { var r = t.glFramebuffers[this.CONTEXT_UID], n = this.gl; if (r) { delete t.glFramebuffers[this.CONTEXT_UID]; var i = this.managedFramebuffers.indexOf(t); 0 <= i && this.managedFramebuffers.splice(i, 1), t.disposeRunner.remove(this), e || (n.deleteFramebuffer(r.framebuffer), r.stencil && n.deleteRenderbuffer(r.stencil)) } }, FramebufferSystem.prototype.disposeAll = function(t) { var e = this.managedFramebuffers; this.managedFramebuffers = []; for (var r = 0; r < e.count; r++) this.disposeFramebuffer(e[r], t) }, FramebufferSystem.prototype.reset = function() { this.current = this.unknownFramebuffer, this.viewport = new ot }, Object.defineProperties(FramebufferSystem.prototype, t), FramebufferSystem }(Ut), pe = function(t) { this.buffer = t, this.updateID = -1, this.byteLength = -1, this.refCount = 0 }, me = { 5126: 4, 5123: 2, 5121: 1 }, ve = function(e) { function GeometrySystem(t) { e.call(this, t), this._activeGeometry = null, this._activeVao = null, this.hasVao = !0, this.hasInstance = !0, this.boundBuffers = {}, this.managedGeometries = {}, this.managedBuffers = {} } return e && (GeometrySystem.__proto__ = e), ((GeometrySystem.prototype = Object.create(e && e.prototype)).constructor = GeometrySystem).prototype.contextChange = function() { this.disposeAll(!0); var t = this.gl = this.renderer.gl; if (this.CONTEXT_UID = this.renderer.CONTEXT_UID, !t.createVertexArray) { var e = this.renderer.context.extensions.vertexArrayObject; M.PREFER_ENV === v.WEBGL_LEGACY && (e = null), t.deleteVertexArray = e ? (t.createVertexArray = function() { return e.createVertexArrayOES() }, t.bindVertexArray = function(t) { return e.bindVertexArrayOES(t) }, function(t) { return e.deleteVertexArrayOES(t) }) : (this.hasVao = !1, t.createVertexArray = function() {}, t.bindVertexArray = function() {}, function() {}) } if (!t.vertexAttribDivisor) { var o = t.getExtension("ANGLE_instanced_arrays"); o ? (t.vertexAttribDivisor = function(t, e) { return o.vertexAttribDivisorANGLE(t, e) }, t.drawElementsInstanced = function(t, e, r, n, i) { return o.drawElementsInstancedANGLE(t, e, r, n, i) }, t.drawArraysInstanced = function(t, e, r, n) { return o.drawArraysInstancedANGLE(t, e, r, n) }) : this.hasInstance = !1 } }, GeometrySystem.prototype.bind = function(t, e) { e = e || this.renderer.shader.shader; var r = this.gl, n = t.glVertexArrayObjects[this.CONTEXT_UID]; n || ((this.managedGeometries[t.id] = t).disposeRunner.add(this), t.glVertexArrayObjects[this.CONTEXT_UID] = n = {}); var i = n[e.program.id] || this.initGeometryVao(t, e.program); this._activeGeometry = t, this._activeVao !== i && (this._activeVao = i, this.hasVao ? r.bindVertexArray(i) : this.activateVao(t, e.program)), this.updateBuffers() }, GeometrySystem.prototype.reset = function() { this.unbind() }, GeometrySystem.prototype.updateBuffers = function() { for (var t = this._activeGeometry, e = this.gl, r = 0; r < t.buffers.length; r++) { var n = t.buffers[r], i = n._glBuffers[this.CONTEXT_UID]; if (n._updateID !== i.updateID) { i.updateID = n._updateID; var o = n.index ? e.ELEMENT_ARRAY_BUFFER : e.ARRAY_BUFFER; if (e.bindBuffer(o, i.buffer), (this._boundBuffer = i).byteLength >= n.data.byteLength) e.bufferSubData(o, 0, n.data); else { var a = n.static ? e.STATIC_DRAW : e.DYNAMIC_DRAW; i.byteLength = n.data.byteLength, e.bufferData(o, n.data, a) } } } }, GeometrySystem.prototype.checkCompatibility = function(t, e) { var r = t.attributes, n = e.attributeData; for (var i in n) if (!r[i]) throw new Error('shader and geometry incompatible, geometry missing the "' + i + '" attribute') }, GeometrySystem.prototype.getSignature = function(t, e) { var r = t.attributes, n = e.attributeData, i = ["g", t.id]; for (var o in r) n[o] && i.push(o); return i.join("-") }, GeometrySystem.prototype.initGeometryVao = function(t, e) { this.checkCompatibility(t, e); var r = this.gl, n = this.CONTEXT_UID, i = this.getSignature(t, e), o = t.glVertexArrayObjects[this.CONTEXT_UID], a = o[i]; if (a) return o[e.id] = a; var s = t.buffers, u = t.attributes, h = {}, c = {}; for (var l in s) h[l] = 0, c[l] = 0; for (var f in u) !u[f].size && e.attributeData[f] ? u[f].size = e.attributeData[f].size : u[f].size, h[u[f].buffer] += u[f].size * me[u[f].type]; for (var d in u) { var p = u[d], m = p.size; void 0 === p.stride && (h[p.buffer] === m * me[p.type] ? p.stride = 0 : p.stride = h[p.buffer]), void 0 === p.start && (p.start = c[p.buffer], c[p.buffer] += m * me[p.type]) } a = r.createVertexArray(), r.bindVertexArray(a); for (var v = 0; v < s.length; v++) { var g = s[v]; g._glBuffers[n] || (g._glBuffers[n] = new pe(r.createBuffer()), (this.managedBuffers[g.id] = g).disposeRunner.add(this)), g._glBuffers[n].refCount++ } return this.activateVao(t, e), r.bindVertexArray(this._activeVao), o[e.id] = a, o[i] = a }, GeometrySystem.prototype.disposeBuffer = function(t, e) { if (this.managedBuffers[t.id]) { delete this.managedBuffers[t.id]; var r = t._glBuffers[this.CONTEXT_UID], n = this.gl; t.disposeRunner.remove(this), r && (e || n.deleteBuffer(r.buffer), delete t._glBuffers[this.CONTEXT_UID]) } }, GeometrySystem.prototype.disposeGeometry = function(t, e) { if (this.managedGeometries[t.id]) { delete this.managedGeometries[t.id]; var r = t.glVertexArrayObjects[this.CONTEXT_UID], n = this.gl, i = t.buffers; if (t.disposeRunner.remove(this), r) { for (var o = 0; o < i.length; o++) { var a = i[o]._glBuffers[this.CONTEXT_UID]; a.refCount--, 0 !== a.refCount || e || this.disposeBuffer(i[o], e) } if (!e) for (var s in r) "g" === s[0] && n.deleteVertexArray(r[s]); delete t.glVertexArrayObjects[this.CONTEXT_UID] } } }, GeometrySystem.prototype.disposeAll = function(t) { for (var e = Object.keys(this.managedGeometries), r = 0; r < e.length; r++) this.disposeGeometry(this.managedGeometries[e[r]], t); e = Object.keys(this.managedBuffers); for (var n = 0; n < e.length; n++) this.disposeBuffer(this.managedBuffers[e[n]], t) }, GeometrySystem.prototype.activateVao = function(t, e) { var r = this.gl, n = this.CONTEXT_UID, i = t.buffers, o = t.attributes; t.indexBuffer && r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, t.indexBuffer._glBuffers[n].buffer); var a = null; for (var s in o) { var u = o[s], h = i[u.buffer]._glBuffers[n]; if (e.attributeData[s]) { a !== h && (r.bindBuffer(r.ARRAY_BUFFER, h.buffer), a = h); var c = e.attributeData[s].location; if (r.enableVertexAttribArray(c), r.vertexAttribPointer(c, u.size, u.type || r.FLOAT, u.normalized, u.stride, u.start), u.instance) { if (!this.hasInstance) throw new Error("geometry error, GPU Instancing is not supported on this device"); r.vertexAttribDivisor(c, 1) } } } }, GeometrySystem.prototype.draw = function(t, e, r, n) { var i = this.gl, o = this._activeGeometry; return o.indexBuffer ? o.instanced ? i.drawElementsInstanced(t, e || o.indexBuffer.data.length, i.UNSIGNED_SHORT, 2 * (r || 0), n || 1) : i.drawElements(t, e || o.indexBuffer.data.length, i.UNSIGNED_SHORT, 2 * (r || 0)) : o.instanced ? i.drawArraysInstanced(t, r, e || o.getSize(), n || 1) : i.drawArrays(t, r, e || o.getSize()), this }, GeometrySystem.prototype.unbind = function() { this.gl.bindVertexArray(null), this._activeVao = null, this._activeGeometry = null }, GeometrySystem }(Ut); function compileProgram(t, e, r, n) { var i = compileShader(t, t.VERTEX_SHADER, e), o = compileShader(t, t.FRAGMENT_SHADER, r), a = t.createProgram(); if (t.attachShader(a, i), t.attachShader(a, o), n) for (var s in n) t.bindAttribLocation(a, n[s], s); return t.linkProgram(a), t.getProgramParameter(a, t.LINK_STATUS) || (t.getProgramInfoLog(a), t.deleteProgram(a), a = null), t.deleteShader(i), t.deleteShader(o), a } function compileShader(t, e, r) { var n = t.createShader(e); return t.shaderSource(n, r), t.compileShader(n), t.getShaderParameter(n, t.COMPILE_STATUS) ? n : null } function core_es_defaultValue(t, e) { switch (t) { case "float": return 0; case "vec2": return new Float32Array(2 * e); case "vec3": return new Float32Array(3 * e); case "vec4": return new Float32Array(4 * e); case "int": case "sampler2D": case "sampler2DArray": return 0; case "ivec2": return new Int32Array(2 * e); case "ivec3": return new Int32Array(3 * e); case "ivec4": return new Int32Array(4 * e); case "bool": return !1; case "bvec2": return booleanArray(2 * e); case "bvec3": return booleanArray(3 * e); case "bvec4": return booleanArray(4 * e); case "mat2": return new Float32Array([1, 0, 0, 1]); case "mat3": return new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); case "mat4": return new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) } return null } function booleanArray(t) { for (var e = new Array(t), r = 0; r < e.length; r++) e[r] = !1; return e } function setPrecision(t, e) { return "precision" !== t.substring(0, 9) ? "precision " + e + " float;\n" + t : t } var ge = { float: 1, vec2: 2, vec3: 3, vec4: 4, int: 1, ivec2: 2, ivec3: 3, ivec4: 4, bool: 1, bvec2: 2, bvec3: 3, bvec4: 4, mat2: 4, mat3: 9, mat4: 16, sampler2D: 1 }; var ye = null, _e = { FLOAT: "float", FLOAT_VEC2: "vec2", FLOAT_VEC3: "vec3", FLOAT_VEC4: "vec4", INT: "int", INT_VEC2: "ivec2", INT_VEC3: "ivec3", INT_VEC4: "ivec4", BOOL: "bool", BOOL_VEC2: "bvec2", BOOL_VEC3: "bvec3", BOOL_VEC4: "bvec4", FLOAT_MAT2: "mat2", FLOAT_MAT3: "mat3", FLOAT_MAT4: "mat4", SAMPLER_2D: "sampler2D", SAMPLER_CUBE: "samplerCube", SAMPLER_2D_ARRAY: "sampler2DArray" }; function mapType(t, e) { if (!ye) { var r = Object.keys(_e); ye = {}; for (var n = 0; n < r.length; ++n) { var i = r[n]; ye[t[i]] = _e[i] } } return ye[e] } var be = { float: "\n if(cv !== v)\n {\n cv.v = v;\n gl.uniform1f(location, v)\n }", vec2: "\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(location, v[0], v[1])\n }", vec3: "\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n\n gl.uniform3f(location, v[0], v[1], v[2])\n }", vec4: "gl.uniform4f(location, v[0], v[1], v[2], v[3])", int: "gl.uniform1i(location, v)", ivec2: "gl.uniform2i(location, v[0], v[1])", ivec3: "gl.uniform3i(location, v[0], v[1], v[2])", ivec4: "gl.uniform4i(location, v[0], v[1], v[2], v[3])", bool: "gl.uniform1i(location, v)", bvec2: "gl.uniform2i(location, v[0], v[1])", bvec3: "gl.uniform3i(location, v[0], v[1], v[2])", bvec4: "gl.uniform4i(location, v[0], v[1], v[2], v[3])", mat2: "gl.uniformMatrix2fv(location, false, v)", mat3: "gl.uniformMatrix3fv(location, false, v)", mat4: "gl.uniformMatrix4fv(location, false, v)", sampler2D: "gl.uniform1i(location, v)", samplerCube: "gl.uniform1i(location, v)", sampler2DArray: "gl.uniform1i(location, v)" }, xe = { float: "gl.uniform1fv(location, v)", vec2: "gl.uniform2fv(location, v)", vec3: "gl.uniform3fv(location, v)", vec4: "gl.uniform4fv(location, v)", mat4: "gl.uniformMatrix4fv(location, false, v)", mat3: "gl.uniformMatrix3fv(location, false, v)", mat2: "gl.uniformMatrix2fv(location, false, v)", int: "gl.uniform1iv(location, v)", ivec2: "gl.uniform2iv(location, v)", ivec3: "gl.uniform3iv(location, v)", ivec4: "gl.uniform4iv(location, v)", bool: "gl.uniform1iv(location, v)", bvec2: "gl.uniform2iv(location, v)", bvec3: "gl.uniform3iv(location, v)", bvec4: "gl.uniform4iv(location, v)", sampler2D: "gl.uniform1iv(location, v)", samplerCube: "gl.uniform1iv(location, v)", sampler2DArray: "gl.uniform1iv(location, v)" }; var we = null; var Te, Se = ["precision mediump float;", "void main(void){", "float test = 0.1;", "%forloop%", "gl_FragColor = vec4(0.0);", "}"].join("\n"); function checkMaxIfStatementsInShader(t, e) { if (0 === t) throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`"); for (var r = e.createShader(e.FRAGMENT_SHADER);;) { var n = Se.replace(/%forloop%/gi, generateIfTestSrc(t)); if (e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS)) break; t = t / 2 | 0 } return t } function generateIfTestSrc(t) { for (var e = "", r = 0; r < t; ++r) 0 < r && (e += "\nelse "), r < t - 1 && (e += "if(test == " + r + ".0){}"); return e } var Me = 0, Ee = {}, Ae = function Program(t, e, r) { void 0 === r && (r = "pixi-shader"), this.id = Me++, this.vertexSrc = t || Program.defaultVertexSrc, this.fragmentSrc = e || Program.defaultFragmentSrc, this.vertexSrc = this.vertexSrc.trim(), this.fragmentSrc = this.fragmentSrc.trim(), "#version" !== this.vertexSrc.substring(0, 8) && (r = r.replace(/\s+/g, "-"), Ee[r] ? (Ee[r]++, r += "-" + Ee[r]) : Ee[r] = 1, this.vertexSrc = "#define SHADER_NAME " + r + "\n" + this.vertexSrc, this.fragmentSrc = "#define SHADER_NAME " + r + "\n" + this.fragmentSrc, this.vertexSrc = setPrecision(this.vertexSrc, M.PRECISION_VERTEX), this.fragmentSrc = setPrecision(this.fragmentSrc, M.PRECISION_FRAGMENT)), this.extractData(this.vertexSrc, this.fragmentSrc), this.glPrograms = {}, this.syncUniforms = null }, Pe = { defaultVertexSrc: { configurable: !0 }, defaultFragmentSrc: { configurable: !0 } }; Ae.prototype.extractData = function(t, e) { var r = function() { if (we) return we; var t, e = document.createElement("canvas"); if (M.PREFER_ENV >= v.WEBGL2 && (t = e.getContext("webgl2", {})), !t) { if (!(t = e.getContext("webgl", {}) || e.getContext("experimental-webgl", {}))) throw new Error("This browser does not support WebGL. Try using the canvas renderer"); t.getExtension("WEBGL_draw_buffers") } return we = t }(); if (r) { var n = compileProgram(r, t, e); this.attributeData = this.getAttributeData(n, r), this.uniformData = this.getUniformData(n, r), r.deleteProgram(n) } else this.uniformData = {}, this.attributeData = {} }, Ae.prototype.getAttributeData = function(t, e) { for (var r, n = {}, i = [], o = e.getProgramParameter(t, e.ACTIVE_ATTRIBUTES), a = 0; a < o; a++) { var s = e.getActiveAttrib(t, a), u = mapType(e, s.type), h = { type: u, name: s.name, size: (r = u, ge[r]), location: 0 }; n[s.name] = h, i.push(h) } i.sort(function(t, e) { return t.name > e.name ? 1 : -1 }); for (var c = 0; c < i.length; c++) i[c].location = c; return n }, Ae.prototype.getUniformData = function(t, e) { for (var r = {}, n = e.getProgramParameter(t, e.ACTIVE_UNIFORMS), i = 0; i < n; i++) { var o = e.getActiveUniform(t, i), a = o.name.replace(/\[.*?\]/, ""), s = o.name.match(/\[.*?\]/, ""), u = mapType(e, o.type); r[a] = { type: u, size: o.size, isArray: s, value: core_es_defaultValue(u, o.size) } } return r }, Pe.defaultVertexSrc.get = function() { return "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}\n" }, Pe.defaultFragmentSrc.get = function() { return "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\n}" }, Ae.from = function(t, e, r) { var n = t + e, i = D[n]; return i || (D[n] = i = new Ae(t, e, r)), i }, Object.defineProperties(Ae, Pe); var Ie = function(t, e) { for (var r in this.program = t, this.uniformGroup = e ? e instanceof oe ? e : new oe(e) : new oe({}), t.uniformData) this.uniformGroup.uniforms[r] instanceof Array && (this.uniformGroup.uniforms[r] = new Float32Array(this.uniformGroup.uniforms[r])) }, Oe = { uniforms: { configurable: !0 } }; Ie.prototype.checkUniformExists = function(t, e) { if (e.uniforms[t]) return !0; for (var r in e.uniforms) { var n = e.uniforms[r]; if (n.group && this.checkUniformExists(t, n)) return !0 } return !1 }, Ie.prototype.destroy = function() { this.uniformGroup = null }, Oe.uniforms.get = function() { return this.uniformGroup.uniforms }, Ie.from = function(t, e, r) { var n = Ae.from(t, e); return new Ie(n, r) }, Object.defineProperties(Ie.prototype, Oe); var Ce = function() { this.data = 0, this.blendMode = y.NORMAL, this.polygonOffset = 0, this.blend = !0 }, Re = { blend: { configurable: !0 }, offsets: { configurable: !0 }, culling: { configurable: !0 }, depthTest: { configurable: !0 }, clockwiseFrontFace: { configurable: !0 }, blendMode: { configurable: !0 }, polygonOffset: { configurable: !0 } }; Re.blend.get = function() { return !!(1 & this.data) }, Re.blend.set = function(t) { !!(1 & this.data) !== t && (this.data ^= 1) }, Re.offsets.get = function() { return !!(2 & this.data) }, Re.offsets.set = function(t) { !!(2 & this.data) !== t && (this.data ^= 2) }, Re.culling.get = function() { return !!(4 & this.data) }, Re.culling.set = function(t) { !!(4 & this.data) !== t && (this.data ^= 4) }, Re.depthTest.get = function() { return !!(8 & this.data) }, Re.depthTest.set = function(t) { !!(8 & this.data) !== t && (this.data ^= 8) }, Re.clockwiseFrontFace.get = function() { return !!(16 & this.data) }, Re.clockwiseFrontFace.set = function(t) { !!(16 & this.data) !== t && (this.data ^= 16) }, Re.blendMode.get = function() { return this._blendMode }, Re.blendMode.set = function(t) { this.blend = t !== y.NONE, this._blendMode = t }, Re.polygonOffset.get = function() { return this._polygonOffset }, Re.polygonOffset.set = function(t) { this.offsets = !!t, this._polygonOffset = t }, Ce.for2d = function() { var t = new Ce; return t.depthTest = !1, t.blend = !0, t }, Object.defineProperties(Ce.prototype, Re); var De = function(i) { function Filter(t, e, r) { var n = Ae.from(t || Filter.defaultVertexSrc, e || Filter.defaultFragmentSrc); i.call(this, n, r), this.padding = 0, this.resolution = M.FILTER_RESOLUTION, this.enabled = !0, this.autoFit = !0, this.legacy = !!this.program.attributeData.aTextureCoord, this.state = new Ce } i && (Filter.__proto__ = i); var t = { blendMode: { configurable: !0 } }, e = { defaultVertexSrc: { configurable: !0 }, defaultFragmentSrc: { configurable: !0 } }; return ((Filter.prototype = Object.create(i && i.prototype)).constructor = Filter).prototype.apply = function(t, e, r, n, i, o) { t.applyFilter(this, e, r, n, i, o) }, t.blendMode.get = function() { return this.state.blendMode }, t.blendMode.set = function(t) { this.state.blendMode = t }, e.defaultVertexSrc.get = function() { return "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n" }, e.defaultFragmentSrc.get = function() { return "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n}\n" }, Object.defineProperties(Filter.prototype, t), Object.defineProperties(Filter, e), Filter }(Ie); De.SOURCE_KEY_MAP = {}; var Fe = new Y, ke = function(t, e) { this._texture = t, this.mapCoord = new Y, this.uClampFrame = new Float32Array(4), this.uClampOffset = new Float32Array(2), this._updateID = -1, this.clampOffset = 0, this.clampMargin = void 0 === e ? .5 : e, this.isSimple = !1 }, Le = { texture: { configurable: !0 } }; Le.texture.get = function() { return this._texture }, Le.texture.set = function(t) { this._texture = t, this._updateID = -1 }, ke.prototype.multiplyUvs = function(t, e) { void 0 === e && (e = t); for (var r = this.mapCoord, n = 0; n < t.length; n += 2) { var i = t[n], o = t[n + 1]; e[n] = i * r.a + o * r.c + r.tx, e[n + 1] = i * r.b + o * r.d + r.ty } return e }, ke.prototype.update = function(t) { var e = this._texture; if (!e || !e.valid) return !1; if (!t && this._updateID === e._updateID) return !1; this._updateID = e._updateID; var r = e._uvs; this.mapCoord.set(r.x1 - r.x0, r.y1 - r.y0, r.x3 - r.x0, r.y3 - r.y0, r.x0, r.y0); var n = e.orig, i = e.trim; i && (Fe.set(n.width / i.width, 0, 0, n.height / i.height, -i.x / i.width, -i.y / i.height), this.mapCoord.append(Fe)); var o = e.baseTexture, a = this.uClampFrame, s = this.clampMargin / o.resolution, u = this.clampOffset; return a[0] = (e._frame.x + s + u) / o.width, a[1] = (e._frame.y + s + u) / o.height, a[2] = (e._frame.x + e._frame.width - s + u) / o.width, a[3] = (e._frame.y + e._frame.height - s + u) / o.height, this.uClampOffset[0] = u / o.realWidth, this.uClampOffset[1] = u / o.realHeight, this.isSimple = e._frame.width === o.width && e._frame.height === o.height && 0 === e.rotate, !0 }, Object.defineProperties(ke.prototype, Le); var Ne = function(r) { function SpriteMaskFilter(t) { var e = new Y; r.call(this, "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 otherMatrix;\n\nvarying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\n}\n", "varying vec2 vMaskCoord;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform sampler2D mask;\nuniform float alpha;\nuniform float npmAlpha;\nuniform vec4 maskClamp;\n\nvoid main(void)\n{\n float clip = step(3.5,\n step(maskClamp.x, vMaskCoord.x) +\n step(maskClamp.y, vMaskCoord.y) +\n step(vMaskCoord.x, maskClamp.z) +\n step(vMaskCoord.y, maskClamp.w));\n\n vec4 original = texture2D(uSampler, vTextureCoord);\n vec4 masky = texture2D(mask, vMaskCoord);\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n original *= (alphaMul * masky.r * alpha * clip);\n\n gl_FragColor = original;\n}\n"), t.renderable = !1, this.maskSprite = t, this.maskMatrix = e } return r && (SpriteMaskFilter.__proto__ = r), ((SpriteMaskFilter.prototype = Object.create(r && r.prototype)).constructor = SpriteMaskFilter).prototype.apply = function(t, e, r, n) { var i = this.maskSprite, o = this.maskSprite.texture; o.valid && (o.transform || (o.transform = new ke(o, 0)), o.transform.update(), this.uniforms.npmAlpha = o.baseTexture.premultiplyAlpha ? 0 : 1, this.uniforms.mask = o, this.uniforms.otherMatrix = t.calculateSpriteMatrix(this.maskMatrix, i).prepend(o.transform.mapCoord), this.uniforms.alpha = i.worldAlpha, this.uniforms.maskClamp = o.transform.uClampFrame, t.applyFilter(this, e, r, n)) }, SpriteMaskFilter }(De), Be = function(e) { function MaskSystem(t) { e.call(this, t), this.scissor = !1, this.scissorData = null, this.scissorRenderTarget = null, this.enableScissor = !1, this.alphaMaskPool = [], this.alphaMaskIndex = 0 } return e && (MaskSystem.__proto__ = e), ((MaskSystem.prototype = Object.create(e && e.prototype)).constructor = MaskSystem).prototype.push = function(t, e) { if (e.isSprite) this.pushSpriteMask(t, e); else if (this.enableScissor && !this.scissor && this.renderer._activeRenderTarget.root && !this.renderer.stencil.stencilMaskStack.length && e.isFastRect()) { var r = e.worldTransform, n = Math.atan2(r.b, r.a); (n = Math.round(n * (180 / Math.PI))) % 90 ? this.pushStencilMask(e) : this.pushScissorMask(t, e) } else this.pushStencilMask(e) }, MaskSystem.prototype.pop = function(t, e) { e.isSprite ? this.popSpriteMask(t, e) : this.enableScissor && !this.renderer.stencil.stencilMaskStack.length ? this.popScissorMask(t, e) : this.popStencilMask(t, e) }, MaskSystem.prototype.pushSpriteMask = function(t, e) { var r = this.alphaMaskPool[this.alphaMaskIndex]; r || (r = this.alphaMaskPool[this.alphaMaskIndex] = [new Ne(e)]), r[0].resolution = this.renderer.resolution, r[0].maskSprite = e; var n = t.filterArea; t.filterArea = e.getBounds(!0), this.renderer.filter.push(t, r), t.filterArea = n, this.alphaMaskIndex++ }, MaskSystem.prototype.popSpriteMask = function() { this.renderer.filter.pop(), this.alphaMaskIndex-- }, MaskSystem.prototype.pushStencilMask = function(t) { this.renderer.batch.flush(), this.renderer.stencil.pushStencil(t) }, MaskSystem.prototype.popStencilMask = function() { this.renderer.stencil.popStencil() }, MaskSystem.prototype.pushScissorMask = function(t, e) { e.renderable = !0; var r = this.renderer._activeRenderTarget, n = e.getBounds(); n.fit(r.size), e.renderable = !1, this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST); var i = this.renderer.resolution; this.renderer.gl.scissor(n.x * i, (r.root ? r.size.height - n.y - n.height : n.y) * i, n.width * i, n.height * i), this.scissorRenderTarget = r, this.scissorData = e, this.scissor = !0 }, MaskSystem.prototype.popScissorMask = function() { this.scissorRenderTarget = null, this.scissorData = null, this.scissor = !1; var t = this.renderer.gl; t.disable(t.SCISSOR_TEST) }, MaskSystem }(Ut), Ue = function(e) { function StencilSystem(t) { e.call(this, t), this.stencilMaskStack = [] } return e && (StencilSystem.__proto__ = e), ((StencilSystem.prototype = Object.create(e && e.prototype)).constructor = StencilSystem).prototype.setMaskStack = function(t) { var e = this.renderer.gl; t.length !== this.stencilMaskStack.length && (0 === t.length ? e.disable(e.STENCIL_TEST) : e.enable(e.STENCIL_TEST)), this.stencilMaskStack = t }, StencilSystem.prototype.pushStencil = function(t) { var e = this.renderer.gl, r = this.stencilMaskStack.length; 0 === r && e.enable(e.STENCIL_TEST), this.stencilMaskStack.push(t), e.colorMask(!1, !1, !1, !1), e.stencilFunc(e.EQUAL, r, this._getBitwiseMask()), e.stencilOp(e.KEEP, e.KEEP, e.INCR), t.renderable = !0, t.render(this.renderer), this.renderer.batch.flush(), t.renderable = !1, this._useCurrent() }, StencilSystem.prototype.popStencil = function() { var t = this.renderer.gl, e = this.stencilMaskStack.pop(); 0 === this.stencilMaskStack.length ? (t.disable(t.STENCIL_TEST), t.clear(t.STENCIL_BUFFER_BIT), t.clearStencil(0)) : (t.colorMask(!1, !1, !1, !1), t.stencilOp(t.KEEP, t.KEEP, t.DECR), e.renderable = !0, e.render(this.renderer), this.renderer.batch.flush(), e.renderable = !1, this._useCurrent()) }, StencilSystem.prototype._useCurrent = function() { var t = this.renderer.gl; t.colorMask(!0, !0, !0, !0), t.stencilFunc(t.EQUAL, this.stencilMaskStack.length, this._getBitwiseMask()), t.stencilOp(t.KEEP, t.KEEP, t.KEEP) }, StencilSystem.prototype._getBitwiseMask = function() { return (1 << this.stencilMaskStack.length) - 1 }, StencilSystem.prototype.destroy = function() { e.prototype.destroy.call(this, this), this.stencilMaskStack = null }, StencilSystem }(Ut), Ge = function(e) { function ProjectionSystem(t) { e.call(this, t), this.destinationFrame = null, this.sourceFrame = null, this.defaultFrame = null, this.projectionMatrix = new Y, this.transform = null } return e && (ProjectionSystem.__proto__ = e), ((ProjectionSystem.prototype = Object.create(e && e.prototype)).constructor = ProjectionSystem).prototype.update = function(t, e, r, n) { this.destinationFrame = t || this.destinationFrame || this.defaultFrame, this.sourceFrame = e || this.sourceFrame || t, this.calculateProjection(this.destinationFrame, this.sourceFrame, r, n), this.transform && this.projectionMatrix.append(this.transform); var i = this.renderer; i.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix, i.globalUniforms.update(), i.shader.shader && i.shader.syncUniformGroup(i.shader.shader.uniforms.globals) }, ProjectionSystem.prototype.calculateProjection = function(t, e, r, n) { var i = this.projectionMatrix; i.ty = n ? (i.a = 1 / t.width * 2 * r, i.d = -1 / t.height * 2 * r, i.tx = -1 - e.x * i.a, 1 - e.y * i.d) : (i.a = 1 / t.width * 2 * r, i.d = 1 / t.height * 2 * r, i.tx = -1 - e.x * i.a, -1 - e.y * i.d) }, ProjectionSystem.prototype.setTransform = function() {}, ProjectionSystem }(Ut), je = new ot, ze = function(e) { function RenderTextureSystem(t) { e.call(this, t), this.clearColor = t._backgroundColorRgba, this.defaultMaskStack = [], this.current = null, this.sourceFrame = new ot, this.destinationFrame = new ot } return e && (RenderTextureSystem.__proto__ = e), ((RenderTextureSystem.prototype = Object.create(e && e.prototype)).constructor = RenderTextureSystem).prototype.bind = function(t, e, r) { void 0 === t && (t = null), this.current = t; var n, i = this.renderer; if (t) { var o = t.baseTexture; n = o.resolution, r || (je.width = o.realWidth, je.height = o.realHeight, r = je), e || (e = r), this.renderer.framebuffer.bind(o.framebuffer, r), this.renderer.projection.update(r, e, n, !1), this.renderer.stencil.setMaskStack(o.stencilMaskStack) } else n = this.renderer.resolution, r || (je.width = i.width, je.height = i.height, r = je), e || (e = r), i.framebuffer.bind(null, r), this.renderer.projection.update(r, e, n, !0), this.renderer.stencil.setMaskStack(this.defaultMaskStack); this.sourceFrame.copyFrom(e), this.destinationFrame.x = r.x / n, this.destinationFrame.y = r.y / n, this.destinationFrame.width = r.width / n, this.destinationFrame.height = r.height / n }, RenderTextureSystem.prototype.clear = function(t) { t = this.current ? t || this.current.baseTexture.clearColor : t || this.clearColor, this.renderer.framebuffer.clear(t[0], t[1], t[2], t[3]) }, RenderTextureSystem.prototype.resize = function() { this.bind(null) }, RenderTextureSystem.prototype.reset = function() { this.bind(null) }, RenderTextureSystem }(Ut), Xe = function(t, e) { this.program = t, this.uniformData = e, this.uniformGroups = {} }; Xe.prototype.destroy = function() { this.uniformData = null, this.uniformGroups = null, this.program = null }; var Ve = 0, qe = function(e) { function ShaderSystem(t) { e.call(this, t), this.systemCheck(), this.gl = null, this.shader = null, this.program = null, this.cache = {}, this.id = Ve++ } return e && (ShaderSystem.__proto__ = e), ((ShaderSystem.prototype = Object.create(e && e.prototype)).constructor = ShaderSystem).prototype.systemCheck = function() { if (! function() { if ("boolean" == typeof Te) return Te; try { var t = new Function("param1", "param2", "param3", "return param1[param2] === param3;"); Te = !0 === t({ a: "b" }, "a", "b") } catch (t) { Te = !1 } return Te }()) throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.") }, ShaderSystem.prototype.contextChange = function(t) { this.gl = t }, ShaderSystem.prototype.bind = function(t, e) { t.uniforms.globals = this.renderer.globalUniforms; var r = t.program, n = r.glPrograms[this.renderer.CONTEXT_UID] || this.generateShader(t); return this.shader = t, this.program !== r && (this.program = r, this.gl.useProgram(n.program)), e || this.syncUniformGroup(t.uniformGroup), n }, ShaderSystem.prototype.setUniforms = function(t) { var e = this.shader.program, r = e.glPrograms[this.renderer.CONTEXT_UID]; e.syncUniforms(r.uniformData, t, this.renderer) }, ShaderSystem.prototype.syncUniformGroup = function(t) { var e = this.getglProgram(); t.static && t.dirtyId === e.uniformGroups[t.id] || (e.uniformGroups[t.id] = t.dirtyId, this.syncUniforms(t, e)) }, ShaderSystem.prototype.syncUniforms = function(t, e) { (t.syncUniforms[this.shader.program.id] || this.createSyncGroups(t))(e.uniformData, t.uniforms, this.renderer) }, ShaderSystem.prototype.createSyncGroups = function(t) { var e = this.getSignature(t, this.shader.program.uniformData); return this.cache[e] || (this.cache[e] = function(t, e) { var r = 0, n = "var v = null;\n var cv = null\n var gl = renderer.gl"; for (var i in t.uniforms) { var o = e[i]; o ? "float" === o.type && 1 === o.size ? n += "\n if(uv." + i + " !== ud." + i + ".value)\n {\n ud." + i + ".value = uv." + i + "\n gl.uniform1f(ud." + i + ".location, uv." + i + ")\n }\n" : "sampler2D" !== o.type && "samplerCube" !== o.type && "sampler2DArray" !== o.type || 1 !== o.size || o.isArray ? "mat3" === o.type && 1 === o.size ? void 0 !== t.uniforms[i].a ? n += "\n gl.uniformMatrix3fv(ud." + i + ".location, false, uv." + i + ".toArray(true));\n \n" : n += "\n gl.uniformMatrix3fv(ud." + i + ".location, false, uv." + i + ");\n \n" : "vec2" === o.type && 1 === o.size ? void 0 !== t.uniforms[i].x ? n += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v.x || cv[1] !== v.y)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n gl.uniform2f(ud." + i + ".location, v.x, v.y);\n }\n" : n += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v[0] || cv[1] !== v[1])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n gl.uniform2f(ud." + i + ".location, v[0], v[1]);\n }\n \n" : "vec4" === o.type && 1 === o.size ? void 0 !== t.uniforms[i].width ? n += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\n {\n cv[0] = v.x;\n cv[1] = v.y;\n cv[2] = v.width;\n cv[3] = v.height;\n gl.uniform4f(ud." + i + ".location, v.x, v.y, v.width, v.height)\n }\n" : n += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\n {\n cv[0] = v[0];\n cv[1] = v[1];\n cv[2] = v[2];\n cv[3] = v[3];\n\n gl.uniform4f(ud." + i + ".location, v[0], v[1], v[2], v[3])\n }\n \n" : n += "\n cv = ud." + i + ".value;\n v = uv." + i + ";\n " + (1 === o.size ? be : xe)[o.type].replace("location", "ud." + i + ".location") + ";\n" : (n += "\n renderer.texture.bind(uv." + i + ", " + r + ");\n\n if(ud." + i + ".value !== " + r + ")\n {\n ud." + i + ".value = " + r + ";\n gl.uniform1i(ud." + i + ".location, " + r + ");\n; // eslint-disable-line max-len\n }\n", r++) : t.uniforms[i].group && (n += "\n renderer.shader.syncUniformGroup(uv." + i + ");\n ") } return new Function("ud", "uv", "renderer", n) }(t, this.shader.program.uniformData)), t.syncUniforms[this.shader.program.id] = this.cache[e], t.syncUniforms[this.shader.program.id] }, ShaderSystem.prototype.getSignature = function(t, e) { var r = t.uniforms, n = []; for (var i in r) n.push(i), e[i] && n.push(e[i].type); return n.join("-") }, ShaderSystem.prototype.getglProgram = function() { return this.shader ? this.shader.program.glPrograms[this.renderer.CONTEXT_UID] : null }, ShaderSystem.prototype.generateShader = function(t) { var e = this.gl, r = t.program, n = {}; for (var i in r.attributeData) n[i] = r.attributeData[i].location; var o = compileProgram(e, r.vertexSrc, r.fragmentSrc, n), a = {}; for (var s in r.uniformData) { var u = r.uniformData[s]; a[s] = { location: e.getUniformLocation(o, s), value: core_es_defaultValue(u.type, u.size) } } var h = new Xe(o, a); return r.glPrograms[this.renderer.CONTEXT_UID] = h }, ShaderSystem.prototype.reset = function() { this.program = null, this.shader = null }, ShaderSystem.prototype.destroy = function() { this.destroyed = !0 }, ShaderSystem }(Ut); var He = function(e) { function StateSystem(t) { e.call(this, t), this.gl = null, this.stateId = 0, this.polygonOffset = 0, this.blendMode = y.NONE, this._blendEq = !1, this.map = [], this.map[0] = this.setBlend, this.map[1] = this.setOffset, this.map[2] = this.setCullFace, this.map[3] = this.setDepthTest, this.map[4] = this.setFrontFace, this.checks = [], this.defaultState = new Ce, this.defaultState.blend = !0, this.defaultState.depth = !0 } return e && (StateSystem.__proto__ = e), ((StateSystem.prototype = Object.create(e && e.prototype)).constructor = StateSystem).prototype.contextChange = function(t) { var e, r; this.gl = t, this.blendModes = (e = t, void 0 === r && (r = []), r[y.NORMAL] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.ADD] = [e.ONE, e.DST_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.MULTIPLY] = [e.DST_COLOR, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.SCREEN] = [e.ONE, e.ONE_MINUS_SRC_COLOR, e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.OVERLAY] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.DARKEN] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.LIGHTEN] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.COLOR_DODGE] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.COLOR_BURN] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.HARD_LIGHT] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.SOFT_LIGHT] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.DIFFERENCE] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.EXCLUSION] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.HUE] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.SATURATION] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.COLOR] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.LUMINOSITY] = [e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.NONE] = [0, 0], r[y.NORMAL_NPM] = [e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA], r[y.ADD_NPM] = [e.SRC_ALPHA, e.DST_ALPHA, e.ONE, e.DST_ALPHA], r[y.SCREEN_NPM] = [e.SRC_ALPHA, e.ONE_MINUS_SRC_COLOR, e.ONE, e.ONE_MINUS_SRC_COLOR], r[y.SRC_IN] = [e.DST_ALPHA, e.ZERO], r[y.SRC_OUT] = [e.ONE_MINUS_DST_ALPHA, e.ZERO], r[y.SRC_ATOP] = [e.DST_ALPHA, e.ONE_MINUS_SRC_ALPHA], r[y.DST_OVER] = [e.ONE_MINUS_DST_ALPHA, e.ONE], r[y.DST_IN] = [e.ZERO, e.SRC_ALPHA], r[y.DST_OUT] = [e.ZERO, e.ONE_MINUS_SRC_ALPHA], r[y.DST_ATOP] = [e.ONE_MINUS_DST_ALPHA, e.SRC_ALPHA], r[y.SUBTRACT] = [e.ONE, e.ONE, e.ONE, e.ONE, e.FUNC_REVERSE_SUBTRACT, e.FUNC_ADD], r), this.setState(this.defaultState), this.reset() }, StateSystem.prototype.setState = function(t) { if (t = t || this.defaultState, this.stateId !== t.data) { for (var e = this.stateId ^ t.data, r = 0; e;) 1 & e && this.map[r].call(this, !!(t.data & 1 << r)), e >>= 1, r++; this.stateId = t.data } for (var n = 0; n < this.checks.length; n++) this.checks[n](this, t) }, StateSystem.prototype.forceState = function(t) { t = t || this.defaultState; for (var e = 0; e < this.map.length; e++) this.map[e].call(this, !!(t.data & 1 << e)); for (var r = 0; r < this.checks.length; r++) this.checks[r](this, t); this.stateId = t.data }, StateSystem.prototype.setBlend = function(t) { this.updateCheck(StateSystem.checkBlendMode, t), this.gl[t ? "enable" : "disable"](this.gl.BLEND) }, StateSystem.prototype.setOffset = function(t) { this.gl[t ? "enable" : "disable"](this.gl.POLYGON_OFFSET_FILL) }, StateSystem.prototype.setDepthTest = function(t) { this.gl[t ? "enable" : "disable"](this.gl.DEPTH_TEST) }, StateSystem.prototype.setCullFace = function(t) { this.gl[t ? "enable" : "disable"](this.gl.CULL_FACE) }, StateSystem.prototype.setFrontFace = function(t) { this.gl.frontFace(this.gl[t ? "CW" : "CCW"]) }, StateSystem.prototype.setBlendMode = function(t) { if (t !== this.blendMode) { this.blendMode = t; var e = this.blendModes[t], r = this.gl; 2 === e.length ? r.blendFunc(e[0], e[1]) : r.blendFuncSeparate(e[0], e[1], e[2], e[3]), 6 === e.length ? (this._blendEq = !0, r.blendEquationSeparate(e[4], e[5])) : this._blendEq && (this._blendEq = !1, r.blendEquationSeparate(r.FUNC_ADD, r.FUNC_ADD)) } }, StateSystem.prototype.setPolygonOffset = function(t, e) { this.gl.polygonOffset(t, e) }, StateSystem.prototype.reset = function() { this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, !1), this.forceState(0), this._blendEq = !0, this.blendMode = -1, this.setBlendMode(0) }, StateSystem.prototype.updateCheck = function(t, e) { var r = this.checks.indexOf(t); e && -1 === r ? this.checks.push(t) : e || -1 === r || this.checks.splice(r, 1) }, StateSystem.checkBlendMode = function(t, e) { t.setBlendMode(e.blendMode) }, StateSystem }(Ut), We = function(e) { function TextureGCSystem(t) { e.call(this, t), this.count = 0, this.checkCount = 0, this.maxIdle = M.GC_MAX_IDLE, this.checkCountMax = M.GC_MAX_CHECK_COUNT, this.mode = M.GC_MODE } return e && (TextureGCSystem.__proto__ = e), ((TextureGCSystem.prototype = Object.create(e && e.prototype)).constructor = TextureGCSystem).prototype.postrender = function() { this.count++, this.mode !== A.MANUAL && (this.checkCount++, this.checkCount > this.checkCountMax && (this.checkCount = 0, this.run())) }, TextureGCSystem.prototype.run = function() { for (var t = this.renderer.texture, e = t.managedTextures, r = !1, n = 0; n < e.length; n++) { var i = e[n]; !i.framebuffer && this.count - i.touched > this.maxIdle && (t.destroyTexture(i, !0), r = !(e[n] = null)) } if (r) { for (var o = 0, a = 0; a < e.length; a++) null !== e[a] && (e[o++] = e[a]); e.length = o } }, TextureGCSystem.prototype.unload = function(t) { var e = this.renderer.textureSystem; t._texture && t._texture._glRenderTargets && e.destroyTexture(t._texture); for (var r = t.children.length - 1; 0 <= r; r--) this.unload(t.children[r]) }, TextureGCSystem }(Ut), Ye = function(t) { this.texture = t, this.width = -1, this.height = -1, this.dirtyId = -1, this.dirtyStyleId = -1, this.mipmap = !1, this.wrapMode = 33071 }, Ke = function(e) { function TextureSystem(t) { e.call(this, t), this.boundTextures = [], this.currentLocation = -1, this.managedTextures = [], this._unknownBoundTextures = !1, this.unknownTexture = new Rt } return e && (TextureSystem.__proto__ = e), ((TextureSystem.prototype = Object.create(e && e.prototype)).constructor = TextureSystem).prototype.contextChange = function() { var t = this.gl = this.renderer.gl; this.CONTEXT_UID = this.renderer.CONTEXT_UID, this.webGLVersion = this.renderer.context.webGLVersion; var e = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS); this.boundTextures.length = e; for (var r = 0; r < e; r++) this.boundTextures[r] = null; this.emptyTextures = {}; var n = new Ye(t.createTexture()); t.bindTexture(t.TEXTURE_2D, n.texture), t.texImage2D(t.TEXTURE_2D, 0, t.RGBA, 1, 1, 0, t.RGBA, t.UNSIGNED_BYTE, new Uint8Array(4)), this.emptyTextures[t.TEXTURE_2D] = n, this.emptyTextures[t.TEXTURE_CUBE_MAP] = new Ye(t.createTexture()), t.bindTexture(t.TEXTURE_CUBE_MAP, this.emptyTextures[t.TEXTURE_CUBE_MAP].texture); for (var i = 0; i < 6; i++) t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, t.RGBA, 1, 1, 0, t.RGBA, t.UNSIGNED_BYTE, null); t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MAG_FILTER, t.LINEAR), t.texParameteri(t.TEXTURE_CUBE_MAP, t.TEXTURE_MIN_FILTER, t.LINEAR); for (var o = 0; o < this.boundTextures.length; o++) this.bind(null, o) }, TextureSystem.prototype.bind = function(t, e) { void 0 === e && (e = 0); var r = this.gl; if (t) { if ((t = t.baseTexture || t).valid) { t.touched = this.renderer.textureGC.count; var n = t._glTextures[this.CONTEXT_UID] || this.initTexture(t); this.currentLocation !== e && (this.currentLocation = e, r.activeTexture(r.TEXTURE0 + e)), this.boundTextures[e] !== t && r.bindTexture(t.target, n.texture), n.dirtyId !== t.dirtyId && this.updateTexture(t), this.boundTextures[e] = t } } else this.currentLocation !== e && (this.currentLocation = e, r.activeTexture(r.TEXTURE0 + e)), r.bindTexture(r.TEXTURE_2D, this.emptyTextures[r.TEXTURE_2D].texture), this.boundTextures[e] = null }, TextureSystem.prototype.reset = function() { this._unknownBoundTextures = !0, this.currentLocation = -1; for (var t = 0; t < this.boundTextures.length; t++) this.boundTextures[t] = this.unknownTexture }, TextureSystem.prototype.unbind = function(t) { var e = this.gl, r = this.boundTextures; if (this._unknownBoundTextures) { this._unknownBoundTextures = !1; for (var n = 0; n < r.length; n++) r[n] === this.unknownTexture && this.bind(null, n) } for (var i = 0; i < r.length; i++) r[i] === t && (this.currentLocation !== i && (e.activeTexture(e.TEXTURE0 + i), this.currentLocation = i), e.bindTexture(e.TEXTURE_2D, this.emptyTextures[t.target].texture), r[i] = null) }, TextureSystem.prototype.initTexture = function(t) { var e = new Ye(this.gl.createTexture()); return e.dirtyId = -1, t._glTextures[this.CONTEXT_UID] = e, this.managedTextures.push(t), t.on("dispose", this.destroyTexture, this), e }, TextureSystem.prototype.updateTexture = function(t) { var e = t._glTextures[this.CONTEXT_UID], r = this.renderer; if (t.resource && t.resource.upload(r, t, e)); else { var n = t.realWidth, i = t.realHeight, o = r.gl; (e.width !== n || e.height !== i || e.dirtyId < 0) && (e.width = n, e.height = i, o.texImage2D(t.target, 0, t.format, n, i, 0, t.format, t.type, null)) } t.dirtyStyleId !== e.dirtyStyleId && this.updateTextureStyle(t), e.dirtyId = t.dirtyId }, TextureSystem.prototype.destroyTexture = function(t, e) { var r = this.gl; if ((t = t.baseTexture || t)._glTextures[this.renderer.CONTEXT_UID] && (this.unbind(t), r.deleteTexture(t._glTextures[this.renderer.CONTEXT_UID].texture), t.off("dispose", this.destroyTexture, this), delete t._glTextures[this.renderer.CONTEXT_UID], !e)) { var n = this.managedTextures.indexOf(t); - 1 !== n && removeItems(this.managedTextures, n, 1) } }, TextureSystem.prototype.updateTextureStyle = function(t) { var e = t._glTextures[this.CONTEXT_UID]; e && (t.mipmap !== E.POW2 && 2 === this.webGLVersion || t.isPowerOfTwo ? (e.mipmap = 1 <= t.mipmap, e.wrapMode = t.wrapMode) : (e.mipmap = 0, e.wrapMode = S.CLAMP), t.resource && t.resource.style(this.renderer, t, e) || this.setStyle(t, e), e.dirtyStyleId = t.dirtyStyleId) }, TextureSystem.prototype.setStyle = function(t, e) { var r = this.gl; e.mipmap && r.generateMipmap(t.target), r.texParameteri(t.target, r.TEXTURE_WRAP_S, e.wrapMode), r.texParameteri(t.target, r.TEXTURE_WRAP_T, e.wrapMode), e.mipmap ? r.texParameteri(t.target, r.TEXTURE_MIN_FILTER, t.scaleMode ? r.LINEAR_MIPMAP_LINEAR : r.NEAREST_MIPMAP_NEAREST) : r.texParameteri(t.target, r.TEXTURE_MIN_FILTER, t.scaleMode ? r.LINEAR : r.NEAREST), r.texParameteri(t.target, r.TEXTURE_MAG_FILTER, t.scaleMode ? r.LINEAR : r.NEAREST) }, TextureSystem }(Ut), Ze = { FilterSystem: ue, BatchSystem: ce, ContextSystem: fe, FramebufferSystem: de, GeometrySystem: ve, MaskSystem: Be, StencilSystem: Ue, ProjectionSystem: Ge, RenderTextureSystem: ze, ShaderSystem: qe, StateSystem: He, TextureGCSystem: We, TextureSystem: Ke }, Qe = new Y, Je = function(r) { function AbstractRenderer(t, e) { r.call(this), (e = Object.assign({}, M.RENDER_OPTIONS, e)).roundPixels && (M.ROUND_PIXELS = e.roundPixels, deprecation(0, "Renderer roundPixels option is deprecated, please use PIXI.settings.ROUND_PIXELS", 2)), this.options = e, this.type = g.UNKNOWN, this.screen = new ot(0, 0, e.width, e.height), this.view = e.view || document.createElement("canvas"), this.resolution = e.resolution || M.RESOLUTION, this.transparent = e.transparent, this.autoDensity = e.autoDensity || e.autoResize || !1, this.preserveDrawingBuffer = e.preserveDrawingBuffer, this.clearBeforeRender = e.clearBeforeRender, this._backgroundColor = 0, this._backgroundColorRgba = [0, 0, 0, 0], this._backgroundColorString = "#000000", this.backgroundColor = e.backgroundColor || this._backgroundColor, this._tempDisplayObjectParent = new pt, this._lastObjectRendered = this._tempDisplayObjectParent, this.plugins = {} } r && (AbstractRenderer.__proto__ = r); var t = { width: { configurable: !0 }, height: { configurable: !0 }, backgroundColor: { configurable: !0 } }; return ((AbstractRenderer.prototype = Object.create(r && r.prototype)).constructor = AbstractRenderer).prototype.initPlugins = function(t) { for (var e in t) this.plugins[e] = new t[e](this) }, t.width.get = function() { return this.view.width }, t.height.get = function() { return this.view.height }, AbstractRenderer.prototype.resize = function(t, e) { this.screen.width = t, this.screen.height = e, this.view.width = t * this.resolution, this.view.height = e * this.resolution, this.autoDensity && (this.view.style.width = t + "px", this.view.style.height = e + "px") }, AbstractRenderer.prototype.generateTexture = function(t, e, r, n) { 0 === (n = n || t.getLocalBounds()).width && (n.width = 1), 0 === n.height && (n.height = 1); var i = Wt.create(0 | n.width, 0 | n.height, e, r); return Qe.tx = -n.x, Qe.ty = -n.y, this.render(t, i, !1, Qe, !!t.parent), i }, AbstractRenderer.prototype.destroy = function(t) { for (var e in this.plugins) this.plugins[e].destroy(), this.plugins[e] = null; t && this.view.parentNode && this.view.parentNode.removeChild(this.view), this.plugins = null, this.type = g.UNKNOWN, this.view = null, this.screen = null, this.resolution = 0, this.transparent = !1, this.autoDensity = !1, this.blendModes = null, this.options = null, this.preserveDrawingBuffer = !1, this.clearBeforeRender = !1, this._backgroundColor = 0, this._backgroundColorRgba = null, this._backgroundColorString = null, this._tempDisplayObjectParent = null, this._lastObjectRendered = null }, t.backgroundColor.get = function() { return this._backgroundColor }, t.backgroundColor.set = function(t) { this._backgroundColor = t, this._backgroundColorString = hex2string(t), hex2rgb(t, this._backgroundColorRgba) }, Object.defineProperties(AbstractRenderer.prototype, t), AbstractRenderer }(l.a), $e = function(r) { function Renderer(t) { void 0 === t && (t = {}), r.call(this, "WebGL", t), t = this.options, this.type = g.WEBGL, this.gl = null, this.CONTEXT_UID = 0, this.runners = { destroy: new gt("destroy"), contextChange: new gt("contextChange", 1), reset: new gt("reset"), update: new gt("update"), postrender: new gt("postrender"), prerender: new gt("prerender"), resize: new gt("resize", 2) }, this.globalUniforms = new oe({ projectionMatrix: new Y }, !0), this.addSystem(Be, "mask").addSystem(fe, "context").addSystem(He, "state").addSystem(qe, "shader").addSystem(Ke, "texture").addSystem(ve, "geometry").addSystem(de, "framebuffer").addSystem(Ue, "stencil").addSystem(Ge, "projection").addSystem(We, "textureGC").addSystem(ue, "filter").addSystem(ze, "renderTexture").addSystem(ce, "batch"), this.initPlugins(Renderer.__plugins), t.context ? this.context.initFromContext(t.context) : this.context.initFromOptions({ alpha: this.transparent, antialias: t.antialias, premultipliedAlpha: this.transparent && "notMultiplied" !== this.transparent, stencil: !0, preserveDrawingBuffer: t.preserveDrawingBuffer, powerPreference: this.options.powerPreference }), this.renderingToScreen = !0, sayHello(2 === this.context.webGLVersion ? "WebGL 2" : "WebGL 1"), this.resize(this.options.width, this.options.height) } return r && (Renderer.__proto__ = r), ((Renderer.prototype = Object.create(r && r.prototype)).constructor = Renderer).create = function(t) { if (isWebGLSupported()) return new Renderer(t); throw new Error('WebGL unsupported in this browser, use "pixi.js-legacy" for fallback canvas2d support.') }, Renderer.prototype.addSystem = function(t, e) { e || (e = t.name); var r = new t(this); if (this[e]) throw new Error('Whoops! The name "' + e + '" is already in use'); for (var n in this[e] = r, this.runners) this.runners[n].add(r); return this }, Renderer.prototype.render = function(t, e, r, n, i) { if (this.renderingToScreen = !e, this.runners.prerender.run(), this.emit("prerender"), !this.context.isLost) { if (e || (this._lastObjectRendered = t), !i) { var o = t.parent; t.parent = this._tempDisplayObjectParent, t.updateTransform(), t.parent = o } this.renderTexture.bind(e), this.batch.currentRenderer.start(), (void 0 !== r ? r : this.clearBeforeRender) && this.renderTexture.clear(), t.render(this), this.batch.currentRenderer.flush(), e && e.baseTexture.update(), this.runners.postrender.run(), this.emit("postrender") } }, Renderer.prototype.resize = function(t, e) { r.prototype.resize.call(this, t, e), this.runners.resize.run(t, e) }, Renderer.prototype.reset = function() { return this.runners.reset.run(), this }, Renderer.prototype.clear = function() { this.framebuffer.bind(), this.framebuffer.clear() }, Renderer.prototype.destroy = function(t) { this.runners.destroy.run(), r.prototype.destroy.call(this, t), this.gl = null }, Renderer.registerPlugin = function(t, e) { (Renderer.__plugins = Renderer.__plugins || {})[t] = e }, Renderer }(Je); function autoDetectRenderer(t) { return $e.create(t) } var tr = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}", er = "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n", rr = function(t) { function CubeTexture() { t.apply(this, arguments) } return t && (CubeTexture.__proto__ = t), ((CubeTexture.prototype = Object.create(t && t.prototype)).constructor = CubeTexture).from = function(t, e) { return new CubeTexture(new kt(t, e)) }, CubeTexture }(Rt), nr = function(e) { function BatchGeometry(t) { void 0 === t && (t = !1), e.call(this), this._buffer = new Zt(null, t, !1), this._indexBuffer = new Zt(null, t, !0), this.addAttribute("aVertexPosition", this._buffer, 2, !1, w.FLOAT).addAttribute("aTextureCoord", this._buffer, 2, !1, w.FLOAT).addAttribute("aColor", this._buffer, 4, !0, w.UNSIGNED_BYTE).addAttribute("aTextureId", this._buffer, 1, !0, w.FLOAT).addIndex(this._indexBuffer) } return e && (BatchGeometry.__proto__ = e), (BatchGeometry.prototype = Object.create(e && e.prototype)).constructor = BatchGeometry }(ee), ir = function() { this.textures = [], this.ids = [], this.blend = 0, this.textureCount = 0, this.start = 0, this.size = 0, this.type = 4 }, or = function(t) { this.vertices = new ArrayBuffer(t), this.float32View = new Float32Array(this.vertices), this.uint32View = new Uint32Array(this.vertices) }; or.prototype.destroy = function() { this.vertices = null, this.float32View = null, this.uint32View = null }; var ar = ["varying vec2 vTextureCoord;", "varying vec4 vColor;", "varying float vTextureId;", "uniform sampler2D uSamplers[%count%];", "void main(void){", "vec4 color;", "%forloop%", "gl_FragColor = color * vColor;", "}"].join("\n"), sr = {}, ur = {}; function generateMultiTextureShader(t, e) { if (!ur[e]) { for (var r = new Int32Array(e), n = 0; n < e; n++) r[n] = n; sr[e] = oe.from({ uSamplers: r }, !0); var i = ar; i = (i = i.replace(/%count%/gi, e)).replace(/%forloop%/gi, function(t) { var e = ""; e += "\n", e += "\n"; for (var r = 0; r < t; r++) 0 < r && (e += "\nelse "), r < t - 1 && (e += "if(vTextureId < " + r + ".5)"), e += "\n{", e += "\n\tcolor = texture2D(uSamplers[" + r + "], vTextureCoord);", e += "\n}"; return e += "\n", e += "\n" }(e)), ur[e] = new Ae("precision highp float;\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform vec4 tint;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vTextureId = aTextureId;\n vColor = aColor * tint;\n}\n", i) } var o = { tint: new Float32Array([1, 1, 1, 1]), translationMatrix: new Y, default: sr[e] }; return new Ie(ur[e], o) } var hr = 0, cr = function(r) { function BatchRenderer(t) { r.call(this, t), this.vertSize = 6, this.vertByteSize = 4 * this.vertSize, this.size = 8e3, this.currentSize = 0, this.currentIndexSize = 0, this.attributeBuffers = {}, this.aBuffers = {}, this.iBuffers = {}, this.onlySprites = !1, this.shader = null, this.currentIndex = 0, this.groups = []; for (var e = 0; e < this.size / 4; e++) this.groups[e] = new ir; this.elements = [], this.vaos = [], this.vaoMax = 2, this.vertexCount = 0, this.renderer.on("prerender", this.onPrerender, this), this.state = Ce.for2d() } return r && (BatchRenderer.__proto__ = r), ((BatchRenderer.prototype = Object.create(r && r.prototype)).constructor = BatchRenderer).prototype.contextChange = function() { var t = this.renderer.gl; M.PREFER_ENV === v.WEBGL_LEGACY ? this.MAX_TEXTURES = 1 : (this.MAX_TEXTURES = Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS), M.SPRITE_MAX_TEXTURES), this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, t)), this.shader = generateMultiTextureShader(0, this.MAX_TEXTURES); for (var e = 0; e < this.vaoMax; e++) this.vaos[e] = new nr }, BatchRenderer.prototype.onPrerender = function() { this.vertexCount = 0 }, BatchRenderer.prototype.render = function(t) { t._texture.valid && (this.currentSize + t.vertexData.length / 2 > this.size && this.flush(), this.elements[this.currentIndex++] = t, this.currentSize += t.vertexData.length / 2, this.currentIndexSize += t.indices.length) }, BatchRenderer.prototype.getIndexBuffer = function(t) { var e = nextPow2(Math.ceil(t / 12)), r = log2(e), n = 12 * e; this.iBuffers.length <= r && (this.iBuffers.length = r + 1); var i = this.iBuffers[r]; return i || (this.iBuffers[r] = i = new Uint16Array(n)), i }, BatchRenderer.prototype.getAttributeBuffer = function(t) { var e = nextPow2(Math.ceil(t / 8)), r = log2(e), n = 8 * e; this.aBuffers.length <= r && (this.iBuffers.length = r + 1); var i = this.aBuffers[n]; return i || (this.aBuffers[n] = i = new or(n * this.vertByteSize)), i }, BatchRenderer.prototype.flush = function() { if (0 !== this.currentSize) { var t, e, r, n = this.renderer.gl, i = this.MAX_TEXTURES, o = this.getAttributeBuffer(this.currentSize), a = this.getIndexBuffer(this.currentIndexSize), s = this.elements, u = this.groups, h = o.float32View, c = o.uint32View, l = this.renderer.textureGC.count, f = 0, d = 0, p = 0, m = 0, v = u[0], g = -1; for (v.textureCount = 0, v.start = 0, v.blend = g, hr++, r = 0; r < this.currentIndex; ++r) { var y = s[r]; s[r] = null, t = y._texture.baseTexture; var _ = C[t.premultiplyAlpha ? 1 : 0][y.blendMode]; g !== _ && (g = _, e = null, m = i, hr++), e !== t && (e = t)._enabled !== hr && (m === i && (hr++, m = 0, v.size = d - v.start, (v = u[p++]).textureCount = 0, v.blend = g, v.start = d), t.touched = l, t._enabled = hr, t._id = m, v.textures[v.textureCount++] = t, m++), this.packGeometry(y, h, c, a, f, d), f += y.vertexData.length / 2 * this.vertSize, d += y.indices.length } v.size = d - v.start, M.CAN_UPLOAD_SAME_BUFFER ? (this.vaos[this.vertexCount]._buffer.update(o.vertices, 0), this.vaos[this.vertexCount]._indexBuffer.update(a, 0), this.renderer.geometry.updateBuffers()) : (this.vaoMax <= this.vertexCount && (this.vaoMax++, this.vaos[this.vertexCount] = new nr), this.vaos[this.vertexCount]._buffer.update(o.vertices, 0), this.vaos[this.vertexCount]._indexBuffer.update(a, 0), this.renderer.geometry.bind(this.vaos[this.vertexCount]), this.renderer.geometry.updateBuffers(), this.vertexCount++); var b = this.renderer.texture, x = this.renderer.state; for (r = 0; r < p; r++) { for (var w = u[r], T = w.textureCount, S = 0; S < T; S++) b.bind(w.textures[S], S), w.textures[S] = null; x.setBlendMode(w.blend), n.drawElements(w.type, w.size, n.UNSIGNED_SHORT, 2 * w.start) } this.currentIndex = 0, this.currentSize = 0, this.currentIndexSize = 0 } }, BatchRenderer.prototype.packGeometry = function(t, e, r, n, i, o) { for (var a = i / this.vertSize, s = t.uvs, u = t.indices, h = t.vertexData, c = t._texture.baseTexture._id, l = Math.min(t.worldAlpha, 1), f = l < 1 && t._texture.baseTexture.premultiplyAlpha ? premultiplyTint(t._tintRGB, l) : t._tintRGB + (255 * l << 24), d = 0; d < h.length; d += 2) e[i++] = h[d], e[i++] = h[d + 1], e[i++] = s[d], e[i++] = s[d + 1], r[i++] = f, e[i++] = c; for (var p = 0; p < u.length; p++) n[o++] = a + u[p] }, BatchRenderer.prototype.start = function() { this.renderer.state.setState(this.state), this.renderer.shader.bind(this.shader), M.CAN_UPLOAD_SAME_BUFFER && this.renderer.geometry.bind(this.vaos[this.vertexCount]) }, BatchRenderer.prototype.stop = function() { this.flush() }, BatchRenderer.prototype.destroy = function() { for (var t = 0; t < this.vaoMax; t++) this.vaos[t] && this.vaos[t].destroy(); this.indexBuffer && this.indexBuffer.destroy(), this.renderer.off("prerender", this.onPrerender, this), this.shader && (this.shader.destroy(), this.shader = null), this.vaos = null, this.indexBuffer = null, this.indices = null, this.sprites = null, r.prototype.destroy.call(this) }, BatchRenderer }(he), lr = new ot, fr = function(t) { (this.renderer = t).extract = this }; fr.prototype.image = function(t) { var e = new Image; return e.src = this.base64(t), e }, fr.prototype.base64 = function(t) { return this.canvas(t).toDataURL() }, fr.prototype.canvas = function(t) { var e, r, n, i = this.renderer, o = !1, a = !1; t && (t instanceof Wt ? n = t : (n = this.renderer.generateTexture(t), a = !0)), n ? (e = n.baseTexture.resolution, r = n.frame, o = !1, i.renderTexture.bind(n)) : (e = this.renderer.resolution, o = !0, (r = lr).width = this.renderer.width, r.height = this.renderer.height, i.renderTexture.bind(null)); var s = r.width * e, u = r.height * e, h = new L(s, u, 1), c = new Uint8Array(4 * s * u), l = i.gl; l.readPixels(r.x * e, r.y * e, s, u, l.RGBA, l.UNSIGNED_BYTE, c); var f = h.context.getImageData(0, 0, s, u); return f.data.set(c), h.context.putImageData(f, 0, 0), o && (h.context.scale(1, -1), h.context.drawImage(h.canvas, 0, -u)), a && n.destroy(!0), h.canvas }, fr.prototype.pixels = function(t) { var e, r, n, i = this.renderer, o = !1; t && (t instanceof Wt ? n = t : (n = this.renderer.generateTexture(t), o = !0)), n ? (e = n.baseTexture.resolution, r = n.frame, i.renderTexture.bind(n)) : (e = i.resolution, (r = lr).width = i.width, r.height = i.height, i.renderTexture.bind(null)); var a = r.width * e, s = r.height * e, u = new Uint8Array(4 * a * s), h = i.gl; return h.readPixels(r.x * e, r.y * e, a, s, h.RGBA, h.UNSIGNED_BYTE, u), o && n.destroy(!0), u }, fr.prototype.destroy = function() { this.renderer.extract = null, this.renderer = null }; var dr = function() { this.global = new q, this.target = null, this.originalEvent = null, this.identifier = null, this.isPrimary = !1, this.button = 0, this.buttons = 0, this.width = 0, this.height = 0, this.tiltX = 0, this.tiltY = 0, this.pointerType = null, this.pressure = 0, this.rotationAngle = 0, this.twist = 0, this.tangentialPressure = 0 }, pr = { pointerId: { configurable: !0 } }; pr.pointerId.get = function() { return this.identifier }, dr.prototype.getLocalPosition = function(t, e, r) { return t.worldTransform.applyInverse(r || this.global, e) }, dr.prototype.copyEvent = function(t) { t.isPrimary && (this.isPrimary = !0), this.button = t.button, this.buttons = Number.isInteger(t.buttons) ? t.buttons : t.which, this.width = t.width, this.height = t.height, this.tiltX = t.tiltX, this.tiltY = t.tiltY, this.pointerType = t.pointerType, this.pressure = t.pressure, this.rotationAngle = t.rotationAngle, this.twist = t.twist || 0, this.tangentialPressure = t.tangentialPressure || 0 }, dr.prototype.reset = function() { this.isPrimary = !1 }, Object.defineProperties(dr.prototype, pr); var mr = function() { this.stopped = !1, this.target = null, this.currentTarget = null, this.type = null, this.data = null }; mr.prototype.stopPropagation = function() { this.stopped = !0 }, mr.prototype.reset = function() { this.stopped = !1, this.currentTarget = null, this.target = null }; var vr = function InteractionTrackingData(t) { this._pointerId = t, this._flags = InteractionTrackingData.FLAGS.NONE }, gr = { pointerId: { configurable: !0 }, flags: { configurable: !0 }, none: { configurable: !0 }, over: { configurable: !0 }, rightDown: { configurable: !0 }, leftDown: { configurable: !0 } }; vr.prototype._doSet = function(t, e) { this._flags = e ? this._flags | t : this._flags & ~t }, gr.pointerId.get = function() { return this._pointerId }, gr.flags.get = function() { return this._flags }, gr.flags.set = function(t) { this._flags = t }, gr.none.get = function() { return this._flags === this.constructor.FLAGS.NONE }, gr.over.get = function() { return 0 != (this._flags & this.constructor.FLAGS.OVER) }, gr.over.set = function(t) { this._doSet(this.constructor.FLAGS.OVER, t) }, gr.rightDown.get = function() { return 0 != (this._flags & this.constructor.FLAGS.RIGHT_DOWN) }, gr.rightDown.set = function(t) { this._doSet(this.constructor.FLAGS.RIGHT_DOWN, t) }, gr.leftDown.get = function() { return 0 != (this._flags & this.constructor.FLAGS.LEFT_DOWN) }, gr.leftDown.set = function(t) { this._doSet(this.constructor.FLAGS.LEFT_DOWN, t) }, Object.defineProperties(vr.prototype, gr), vr.FLAGS = Object.freeze({ NONE: 0, OVER: 1, LEFT_DOWN: 2, RIGHT_DOWN: 4 }); var yr = { interactive: !1, interactiveChildren: !0, hitArea: null, get buttonMode() { return "pointer" === this.cursor }, set buttonMode(t) { t ? this.cursor = "pointer" : "pointer" === this.cursor && (this.cursor = null) }, cursor: null, get trackedPointers() { return void 0 === this._trackedPointers && (this._trackedPointers = {}), this._trackedPointers }, _trackedPointers: void 0 }; dt.mixin(yr); var _r = { target: null, data: { global: null } }, br = function(r) { function InteractionManager(t, e) { r.call(this), e = e || {}, this.renderer = t, this.autoPreventDefault = void 0 === e.autoPreventDefault || e.autoPreventDefault, this.interactionFrequency = e.interactionFrequency || 10, this.mouse = new dr, this.mouse.identifier = 1, this.mouse.global.set(-999999), this.activeInteractionData = {}, this.activeInteractionData[1] = this.mouse, this.interactionDataPool = [], this.eventData = new mr, this.interactionDOMElement = null, this.moveWhenInside = !1, this.eventsAdded = !1, this.mouseOverRenderer = !1, this.supportsTouchEvents = "ontouchstart" in window, this.supportsPointerEvents = !!window.PointerEvent, this.onPointerUp = this.onPointerUp.bind(this), this.processPointerUp = this.processPointerUp.bind(this), this.onPointerCancel = this.onPointerCancel.bind(this), this.processPointerCancel = this.processPointerCancel.bind(this), this.onPointerDown = this.onPointerDown.bind(this), this.processPointerDown = this.processPointerDown.bind(this), this.onPointerMove = this.onPointerMove.bind(this), this.processPointerMove = this.processPointerMove.bind(this), this.onPointerOut = this.onPointerOut.bind(this), this.processPointerOverOut = this.processPointerOverOut.bind(this), this.onPointerOver = this.onPointerOver.bind(this), this.cursorStyles = { default: "inherit", pointer: "pointer" }, this.currentCursorMode = null, this.cursor = null, this._tempPoint = new q, this.resolution = 1, this.setTargetElement(this.renderer.view, this.renderer.resolution) } return r && (InteractionManager.__proto__ = r), ((InteractionManager.prototype = Object.create(r && r.prototype)).constructor = InteractionManager).prototype.hitTest = function(t, e) { return _r.target = null, _r.data.global = t, e || (e = this.renderer._lastObjectRendered), this.processInteractive(_r, e, null, !0), _r.target }, InteractionManager.prototype.setTargetElement = function(t, e) { void 0 === e && (e = 1), this.removeEvents(), this.interactionDOMElement = t, this.resolution = e, this.addEvents() }, InteractionManager.prototype.addEvents = function() { this.interactionDOMElement && (xt.system.add(this.update, this, _t.INTERACTION), window.navigator.msPointerEnabled ? (this.interactionDOMElement.style["-ms-content-zooming"] = "none", this.interactionDOMElement.style["-ms-touch-action"] = "none") : this.supportsPointerEvents && (this.interactionDOMElement.style["touch-action"] = "none"), this.supportsPointerEvents ? (window.document.addEventListener("pointermove", this.onPointerMove, !0), this.interactionDOMElement.addEventListener("pointerdown", this.onPointerDown, !0), this.interactionDOMElement.addEventListener("pointerleave", this.onPointerOut, !0), this.interactionDOMElement.addEventListener("pointerover", this.onPointerOver, !0), window.addEventListener("pointercancel", this.onPointerCancel, !0), window.addEventListener("pointerup", this.onPointerUp, !0)) : (window.document.addEventListener("mousemove", this.onPointerMove, !0), this.interactionDOMElement.addEventListener("mousedown", this.onPointerDown, !0), this.interactionDOMElement.addEventListener("mouseout", this.onPointerOut, !0), this.interactionDOMElement.addEventListener("mouseover", this.onPointerOver, !0), window.addEventListener("mouseup", this.onPointerUp, !0)), this.supportsTouchEvents && (this.interactionDOMElement.addEventListener("touchstart", this.onPointerDown, !0), this.interactionDOMElement.addEventListener("touchcancel", this.onPointerCancel, !0), this.interactionDOMElement.addEventListener("touchend", this.onPointerUp, !0), this.interactionDOMElement.addEventListener("touchmove", this.onPointerMove, !0)), this.eventsAdded = !0) }, InteractionManager.prototype.removeEvents = function() { this.interactionDOMElement && (xt.system.remove(this.update, this), window.navigator.msPointerEnabled ? (this.interactionDOMElement.style["-ms-content-zooming"] = "", this.interactionDOMElement.style["-ms-touch-action"] = "") : this.supportsPointerEvents && (this.interactionDOMElement.style["touch-action"] = ""), this.supportsPointerEvents ? (window.document.removeEventListener("pointermove", this.onPointerMove, !0), this.interactionDOMElement.removeEventListener("pointerdown", this.onPointerDown, !0), this.interactionDOMElement.removeEventListener("pointerleave", this.onPointerOut, !0), this.interactionDOMElement.removeEventListener("pointerover", this.onPointerOver, !0), window.removeEventListener("pointercancel", this.onPointerCancel, !0), window.removeEventListener("pointerup", this.onPointerUp, !0)) : (window.document.removeEventListener("mousemove", this.onPointerMove, !0), this.interactionDOMElement.removeEventListener("mousedown", this.onPointerDown, !0), this.interactionDOMElement.removeEventListener("mouseout", this.onPointerOut, !0), this.interactionDOMElement.removeEventListener("mouseover", this.onPointerOver, !0), window.removeEventListener("mouseup", this.onPointerUp, !0)), this.supportsTouchEvents && (this.interactionDOMElement.removeEventListener("touchstart", this.onPointerDown, !0), this.interactionDOMElement.removeEventListener("touchcancel", this.onPointerCancel, !0), this.interactionDOMElement.removeEventListener("touchend", this.onPointerUp, !0), this.interactionDOMElement.removeEventListener("touchmove", this.onPointerMove, !0)), this.interactionDOMElement = null, this.eventsAdded = !1) }, InteractionManager.prototype.update = function(t) { if (this._deltaTime += t, !(this._deltaTime < this.interactionFrequency) && (this._deltaTime = 0, this.interactionDOMElement)) if (this.didMove) this.didMove = !1; else { for (var e in this.cursor = null, this.activeInteractionData) if (this.activeInteractionData.hasOwnProperty(e)) { var r = this.activeInteractionData[e]; if (r.originalEvent && "touch" !== r.pointerType) { var n = this.configureInteractionEventForDOMEvent(this.eventData, r.originalEvent, r); this.processInteractive(n, this.renderer._lastObjectRendered, this.processPointerOverOut, !0) } } this.setCursorMode(this.cursor) } }, InteractionManager.prototype.setCursorMode = function(t) { if (t = t || "default", this.currentCursorMode !== t) { this.currentCursorMode = t; var e = this.cursorStyles[t]; if (e) switch (typeof e) { case "string": this.interactionDOMElement.style.cursor = e; break; case "function": e(t); break; case "object": Object.assign(this.interactionDOMElement.style, e) } else "string" != typeof t || Object.prototype.hasOwnProperty.call(this.cursorStyles, t) || (this.interactionDOMElement.style.cursor = t) } }, InteractionManager.prototype.dispatchEvent = function(t, e, r) { r.stopped || (r.currentTarget = t, r.type = e, t.emit(e, r), t[e] && t[e](r)) }, InteractionManager.prototype.mapPositionToPoint = function(t, e, r) { var n; n = this.interactionDOMElement.parentElement ? this.interactionDOMElement.getBoundingClientRect() : { x: 0, y: 0, width: 0, height: 0 }; var i = 1 / this.resolution; t.x = (e - n.left) * (this.interactionDOMElement.width / n.width) * i, t.y = (r - n.top) * (this.interactionDOMElement.height / n.height) * i }, InteractionManager.prototype.processInteractive = function(t, e, r, n, i) { if (!e || !e.visible) return !1; var o = t.data.global, a = !1, s = i = e.interactive || i, u = !0; if (e.hitArea ? (n && (e.worldTransform.applyInverse(o, this._tempPoint), e.hitArea.contains(this._tempPoint.x, this._tempPoint.y) ? a = !0 : u = n = !1), s = !1) : e._mask && n && (e._mask.containsPoint && e._mask.containsPoint(o) || (u = n = !1)), u && e.interactiveChildren && e.children) for (var h = e.children, c = h.length - 1; 0 <= c; c--) { var l = h[c], f = this.processInteractive(t, l, r, n, s); if (f) { if (!l.parent) continue; s = !1, f && (t.target && (n = !1), a = !0) } } return i && (n && !t.target && !e.hitArea && e.containsPoint && e.containsPoint(o) && (a = !0), e.interactive && (a && !t.target && (t.target = e), r && r(t, e, !!a))), a }, InteractionManager.prototype.onPointerDown = function(t) { if (!this.supportsTouchEvents || "touch" !== t.pointerType) { var e = this.normalizeToPointerData(t); if (this.autoPreventDefault && e[0].isNormalized)(t.cancelable || !("cancelable" in t)) && t.preventDefault(); for (var r = e.length, n = 0; n < r; n++) { var i = e[n], o = this.getInteractionDataForPointerId(i), a = this.configureInteractionEventForDOMEvent(this.eventData, i, o); if (a.data.originalEvent = t, this.processInteractive(a, this.renderer._lastObjectRendered, this.processPointerDown, !0), this.emit("pointerdown", a), "touch" === i.pointerType) this.emit("touchstart", a); else if ("mouse" === i.pointerType || "pen" === i.pointerType) { var s = 2 === i.button; this.emit(s ? "rightdown" : "mousedown", this.eventData) } } } }, InteractionManager.prototype.processPointerDown = function(t, e, r) { var n = t.data, i = t.data.identifier; if (r) if (e.trackedPointers[i] || (e.trackedPointers[i] = new vr(i)), this.dispatchEvent(e, "pointerdown", t), "touch" === n.pointerType) this.dispatchEvent(e, "touchstart", t); else if ("mouse" === n.pointerType || "pen" === n.pointerType) { var o = 2 === n.button; o ? e.trackedPointers[i].rightDown = !0 : e.trackedPointers[i].leftDown = !0, this.dispatchEvent(e, o ? "rightdown" : "mousedown", t) } }, InteractionManager.prototype.onPointerComplete = function(t, e, r) { for (var n = this.normalizeToPointerData(t), i = n.length, o = t.target !== this.interactionDOMElement ? "outside" : "", a = 0; a < i; a++) { var s = n[a], u = this.getInteractionDataForPointerId(s), h = this.configureInteractionEventForDOMEvent(this.eventData, s, u); if (h.data.originalEvent = t, this.processInteractive(h, this.renderer._lastObjectRendered, r, e || !o), this.emit(e ? "pointercancel" : "pointerup" + o, h), "mouse" === s.pointerType || "pen" === s.pointerType) { var c = 2 === s.button; this.emit(c ? "rightup" + o : "mouseup" + o, h) } else "touch" === s.pointerType && (this.emit(e ? "touchcancel" : "touchend" + o, h), this.releaseInteractionDataForPointerId(s.pointerId, u)) } }, InteractionManager.prototype.onPointerCancel = function(t) { this.supportsTouchEvents && "touch" === t.pointerType || this.onPointerComplete(t, !0, this.processPointerCancel) }, InteractionManager.prototype.processPointerCancel = function(t, e) { var r = t.data, n = t.data.identifier; void 0 !== e.trackedPointers[n] && (delete e.trackedPointers[n], this.dispatchEvent(e, "pointercancel", t), "touch" === r.pointerType && this.dispatchEvent(e, "touchcancel", t)) }, InteractionManager.prototype.onPointerUp = function(t) { this.supportsTouchEvents && "touch" === t.pointerType || this.onPointerComplete(t, !1, this.processPointerUp) }, InteractionManager.prototype.processPointerUp = function(t, e, r) { var n = t.data, i = t.data.identifier, o = e.trackedPointers[i], a = "touch" === n.pointerType, s = "mouse" === n.pointerType || "pen" === n.pointerType, u = !1; if (s) { var h = 2 === n.button, c = vr.FLAGS, l = h ? c.RIGHT_DOWN : c.LEFT_DOWN, f = void 0 !== o && o.flags & l; r ? (this.dispatchEvent(e, h ? "rightup" : "mouseup", t), f && (this.dispatchEvent(e, h ? "rightclick" : "click", t), u = !0)) : f && this.dispatchEvent(e, h ? "rightupoutside" : "mouseupoutside", t), o && (h ? o.rightDown = !1 : o.leftDown = !1) } r ? (this.dispatchEvent(e, "pointerup", t), a && this.dispatchEvent(e, "touchend", t), o && (s && !u || this.dispatchEvent(e, "pointertap", t), a && (this.dispatchEvent(e, "tap", t), o.over = !1))) : o && (this.dispatchEvent(e, "pointerupoutside", t), a && this.dispatchEvent(e, "touchendoutside", t)), o && o.none && delete e.trackedPointers[i] }, InteractionManager.prototype.onPointerMove = function(t) { if (!this.supportsTouchEvents || "touch" !== t.pointerType) { var e = this.normalizeToPointerData(t); "mouse" !== e[0].pointerType && "pen" !== e[0].pointerType || (this.didMove = !0, this.cursor = null); for (var r = e.length, n = 0; n < r; n++) { var i = e[n], o = this.getInteractionDataForPointerId(i), a = this.configureInteractionEventForDOMEvent(this.eventData, i, o); a.data.originalEvent = t; var s = "touch" !== i.pointerType || this.moveWhenInside; this.processInteractive(a, this.renderer._lastObjectRendered, this.processPointerMove, s), this.emit("pointermove", a), "touch" === i.pointerType && this.emit("touchmove", a), "mouse" !== i.pointerType && "pen" !== i.pointerType || this.emit("mousemove", a) } "mouse" === e[0].pointerType && this.setCursorMode(this.cursor) } }, InteractionManager.prototype.processPointerMove = function(t, e, r) { var n = t.data, i = "touch" === n.pointerType, o = "mouse" === n.pointerType || "pen" === n.pointerType; o && this.processPointerOverOut(t, e, r), this.moveWhenInside && !r || (this.dispatchEvent(e, "pointermove", t), i && this.dispatchEvent(e, "touchmove", t), o && this.dispatchEvent(e, "mousemove", t)) }, InteractionManager.prototype.onPointerOut = function(t) { if (!this.supportsTouchEvents || "touch" !== t.pointerType) { var e = this.normalizeToPointerData(t)[0]; "mouse" === e.pointerType && (this.mouseOverRenderer = !1, this.setCursorMode(null)); var r = this.getInteractionDataForPointerId(e), n = this.configureInteractionEventForDOMEvent(this.eventData, e, r); n.data.originalEvent = e, this.processInteractive(n, this.renderer._lastObjectRendered, this.processPointerOverOut, !1), this.emit("pointerout", n), "mouse" === e.pointerType || "pen" === e.pointerType ? this.emit("mouseout", n) : this.releaseInteractionDataForPointerId(r.identifier) } }, InteractionManager.prototype.processPointerOverOut = function(t, e, r) { var n = t.data, i = t.data.identifier, o = "mouse" === n.pointerType || "pen" === n.pointerType, a = e.trackedPointers[i]; r && !a && (a = e.trackedPointers[i] = new vr(i)), void 0 !== a && (r && this.mouseOverRenderer ? (a.over || (a.over = !0, this.dispatchEvent(e, "pointerover", t), o && this.dispatchEvent(e, "mouseover", t)), o && null === this.cursor && (this.cursor = e.cursor)) : a.over && (a.over = !1, this.dispatchEvent(e, "pointerout", this.eventData), o && this.dispatchEvent(e, "mouseout", t), a.none && delete e.trackedPointers[i])) }, InteractionManager.prototype.onPointerOver = function(t) { var e = this.normalizeToPointerData(t)[0], r = this.getInteractionDataForPointerId(e), n = this.configureInteractionEventForDOMEvent(this.eventData, e, r); "mouse" === (n.data.originalEvent = e).pointerType && (this.mouseOverRenderer = !0), this.emit("pointerover", n), "mouse" !== e.pointerType && "pen" !== e.pointerType || this.emit("mouseover", n) }, InteractionManager.prototype.getInteractionDataForPointerId = function(t) { var e, r = t.pointerId; return 1 === r || "mouse" === t.pointerType ? e = this.mouse : this.activeInteractionData[r] ? e = this.activeInteractionData[r] : ((e = this.interactionDataPool.pop() || new dr).identifier = r, this.activeInteractionData[r] = e), e.copyEvent(t), e }, InteractionManager.prototype.releaseInteractionDataForPointerId = function(t) { var e = this.activeInteractionData[t]; e && (delete this.activeInteractionData[t], e.reset(), this.interactionDataPool.push(e)) }, InteractionManager.prototype.configureInteractionEventForDOMEvent = function(t, e, r) { return t.data = r, this.mapPositionToPoint(r.global, e.clientX, e.clientY), "touch" === e.pointerType && (e.globalX = r.global.x, e.globalY = r.global.y), r.originalEvent = e, t.reset(), t }, InteractionManager.prototype.normalizeToPointerData = function(t) { var e = []; if (this.supportsTouchEvents && t instanceof TouchEvent) for (var r = 0, n = t.changedTouches.length; r < n; r++) { var i = t.changedTouches[r]; void 0 === i.button && (i.button = t.touches.length ? 1 : 0), void 0 === i.buttons && (i.buttons = t.touches.length ? 1 : 0), void 0 === i.isPrimary && (i.isPrimary = 1 === t.touches.length && "touchstart" === t.type), void 0 === i.width && (i.width = i.radiusX || 1), void 0 === i.height && (i.height = i.radiusY || 1), void 0 === i.tiltX && (i.tiltX = 0), void 0 === i.tiltY && (i.tiltY = 0), void 0 === i.pointerType && (i.pointerType = "touch"), void 0 === i.pointerId && (i.pointerId = i.identifier || 0), void 0 === i.pressure && (i.pressure = i.force || .5), void 0 === i.twist && (i.twist = 0), void 0 === i.tangentialPressure && (i.tangentialPressure = 0), void 0 === i.layerX && (i.layerX = i.offsetX = i.clientX), void 0 === i.layerY && (i.layerY = i.offsetY = i.clientY), i.isNormalized = !0, e.push(i) } else !(t instanceof MouseEvent) || this.supportsPointerEvents && t instanceof window.PointerEvent || (void 0 === t.isPrimary && (t.isPrimary = !0), void 0 === t.width && (t.width = 1), void 0 === t.height && (t.height = 1), void 0 === t.tiltX && (t.tiltX = 0), void 0 === t.tiltY && (t.tiltY = 0), void 0 === t.pointerType && (t.pointerType = "mouse"), void 0 === t.pointerId && (t.pointerId = 1), void 0 === t.pressure && (t.pressure = .5), void 0 === t.twist && (t.twist = 0), void 0 === t.tangentialPressure && (t.tangentialPressure = 0), t.isNormalized = !0), e.push(t); return e }, InteractionManager.prototype.destroy = function() { this.removeEvents(), this.removeAllListeners(), this.renderer = null, this.mouse = null, this.eventData = null, this.interactionDOMElement = null, this.onPointerDown = null, this.processPointerDown = null, this.onPointerUp = null, this.processPointerUp = null, this.onPointerCancel = null, this.processPointerCancel = null, this.onPointerMove = null, this.processPointerMove = null, this.onPointerOut = null, this.processPointerOverOut = null, this.onPointerOver = null, this._tempPoint = null }, InteractionManager }(l.a), xr = { adaptive: !0, maxLength: 10, minSegments: 8, maxSegments: 2048, _segmentsCount: function(t, e) { if (void 0 === e && (e = 20), !this.adaptive) return e; var r = Math.ceil(t / this.maxLength); return r < this.minSegments ? r = this.minSegments : r > this.maxSegments && (r = this.maxSegments), r } }, wr = function() { this.reset() }; wr.prototype.clone = function() { var t = new wr; return t.color = this.color, t.alpha = this.alpha, t.texture = this.texture, t.matrix = this.matrix, t.visible = this.visible, t }, wr.prototype.reset = function() { this.color = 16777215, this.alpha = 1, this.texture = Ht.WHITE, this.matrix = null, this.visible = !1 }, wr.prototype.destroy = function() { this.texture = null, this.matrix = null }; var Tr = function(t, e, r, n) { void 0 === e && (e = null), void 0 === r && (r = null), void 0 === n && (n = null), this.shape = t, this.lineStyle = r, this.fillStyle = e, this.matrix = n, this.type = t.type, this.points = [], this.holes = [] }; Tr.prototype.clone = function() { return new Tr(this.shape, this.fillStyle, this.lineStyle, this.matrix) }, Tr.prototype.destroy = function() { this.shape = null, this.holes.length = 0, this.holes = null, this.points.length = 0, this.points = null, this.lineStyle = null, this.fillStyle = null }; var Sr = { build: function(t) { var e, r, n = t.shape, i = t.points, o = n.x, a = n.y; if (i.length = 0, r = t.type === W.CIRC ? (e = n.radius, n.radius) : (e = n.width, n.height), 0 !== e && 0 !== r) { var s = Math.floor(30 * Math.sqrt(n.radius)) || Math.floor(15 * Math.sqrt(n.width + n.height)); s /= 2.3; for (var u = 2 * Math.PI / s, h = 0; h < s; h++) i.push(o + Math.sin(u * h) * e, a + Math.cos(u * h) * r); i.push(i[0], i[1]) } }, triangulate: function(t, e) { var r = t.points, n = e.points, i = e.indices, o = n.length / 2, a = o; n.push(t.shape.x, t.shape.y); for (var s = 0; s < r.length; s += 2) n.push(r[s], r[s + 1]), i.push(o++, a, o) } }; function buildLine(t, e) { t.lineStyle.native ? function(t, e) { var r = 0, n = t.points || t.shape.points; if (0 === n.length) return; var i = e.points, o = e.indices, a = n.length / 2, s = i.length / 2; for (r = 1; r < a; r++) { var u = n[2 * (r - 1)], h = n[2 * (r - 1) + 1], c = n[2 * r], l = n[2 * r + 1]; i.push(u, h), i.push(c, l), o.push(s++, s++) } }(t, e) : function(t, e) { var r = t.shape, n = t.points || r.points.slice(); if (0 === n.length) return; var i = t.lineStyle, o = new q(n[0], n[1]), a = new q(n[n.length - 2], n[n.length - 1]), s = r.type !== W.POLY || r.closeStroke, u = o.x === a.x && o.y === a.y; if (s) { n = n.slice(), u && (n.pop(), n.pop(), a.set(n[n.length - 2], n[n.length - 1])); var h = a.x + .5 * (o.x - a.x), c = a.y + .5 * (o.y - a.y); n.unshift(h, c), n.push(h, c) } var l = e.points, f = n.length / 2, d = n.length, p = l.length / 2, m = i.width / 2, v = n[0], g = n[1], y = n[2], _ = n[3], b = 0, x = 0, w = -(g - _), T = v - y, S = 0, M = 0, E = 0, A = 0, P = Math.sqrt(w * w + T * T); w /= P, T /= P, w *= m, T *= m; var I = i.alignment, O = 2 * (1 - I), C = 2 * I; l.push(v - w * O, g - T * O), l.push(v + w * C, g + T * C); for (var R = 1; R < f - 1; ++R) { v = n[2 * (R - 1)], g = n[2 * (R - 1) + 1], y = n[2 * R], _ = n[2 * R + 1], b = n[2 * (R + 1)], x = n[2 * (R + 1) + 1], w = -(g - _), T = v - y, P = Math.sqrt(w * w + T * T), w /= P, T /= P, w *= m, T *= m, S = -(_ - x), M = y - b, P = Math.sqrt(S * S + M * M), S /= P, M /= P; var D = -T + g - (-T + _), F = -w + y - (-w + v), k = (-w + v) * (-T + _) - (-w + y) * (-T + g), L = -(M *= m) + x - (-M + _), N = -(S *= m) + y - (-S + b), B = (-S + b) * (-M + _) - (-S + y) * (-M + x), U = D * N - L * F; if (Math.abs(U) < .1) U += 10.1, l.push(y - w * O, _ - T * O), l.push(y + w * C, _ + T * C); else { var G = (F * B - N * k) / U, j = (L * k - D * B) / U, z = (G - y) * (G - y) + (j - _) * (j - _); 196 * m * m < z ? (E = w - S, A = T - M, P = Math.sqrt(E * E + A * A), E /= P, A /= P, E *= m, A *= m, l.push(y - E * O, _ - A * O), l.push(y + E * C, _ + A * C), l.push(y - E * C * O, _ - A * O), d++) : (l.push(y + (G - y) * O, _ + (j - _) * O), l.push(y - (G - y) * C, _ - (j - _) * C)) } } v = n[2 * (f - 2)], g = n[2 * (f - 2) + 1], y = n[2 * (f - 1)], _ = n[2 * (f - 1) + 1], w = -(g - _), T = v - y, P = Math.sqrt(w * w + T * T), w /= P, T /= P, w *= m, T *= m, l.push(y - w * O, _ - T * O), l.push(y + w * C, _ + T * C); for (var X = e.indices, V = 0; V < d - 2; ++V) X.push(p, p + 1, p + 2), p++ }(t, e) } var Mr = { build: function(t) { t.points = t.shape.points.slice() }, triangulate: function(t, e) { var r = t.points, n = t.holes, i = e.points, o = e.indices; if (6 <= r.length) { for (var a = [], s = 0; s < n.length; s++) { var u = n[s]; a.push(r.length / 2), r = r.concat(u.points) } var h = d()(r, a, 2); if (!h) return; for (var c = i.length / 2, l = 0; l < h.length; l += 3) o.push(h[l] + c), o.push(h[l + 1] + c), o.push(h[l + 2] + c); for (var f = 0; f < r.length; f++) i.push(r[f]) } } }, Er = { build: function(t) { var e = t.shape, r = t.points, n = e.x, i = e.y, o = e.width, a = e.height, s = e.radius; r.length = 0, r.push(n, i + s), quadraticBezierCurve(n, i + a - s, n, i + a, n + s, i + a, r), quadraticBezierCurve(n + o - s, i + a, n + o, i + a, n + o, i + a - s, r), quadraticBezierCurve(n + o, i + s, n + o, i, n + o - s, i, r), quadraticBezierCurve(n + s, i, n, i, n, i + s + 1e-10, r) }, triangulate: function(t, e) { for (var r = t.points, n = e.points, i = e.indices, o = n.length / 2, a = d()(r, null, 2), s = 0, u = a.length; s < u; s += 3) i.push(a[s] + o), i.push(a[s + 1] + o), i.push(a[s + 2] + o); for (var h = 0, c = r.length; h < c; h++) n.push(r[h], r[++h]) } }; function getPt(t, e, r) { return t + (e - t) * r } function quadraticBezierCurve(t, e, r, n, i, o, a) { void 0 === a && (a = []); for (var s = a, u = 0, h = 0, c = 0, l = 0, f = 0, d = 0, p = 0, m = 0; p <= 20; ++p) u = getPt(t, r, m = p / 20), h = getPt(e, n, m), c = getPt(r, i, m), l = getPt(n, o, m), f = getPt(u, c, m), d = getPt(h, l, m), s.push(f, d); return s } var Ar = [], Pr = [], Ir = 0, Or = {}; Or[W.POLY] = Mr, Or[W.CIRC] = Sr, Or[W.ELIP] = Sr, Or[W.RECT] = { build: function(t) { var e = t.shape, r = e.x, n = e.y, i = e.width, o = e.height, a = t.points; a.length = 0, a.push(r, n, r + i, n, r + i, n + o, r, n + o) }, triangulate: function(t, e) { var r = t.points, n = e.points, i = n.length / 2; n.push(r[0], r[1], r[2], r[3], r[6], r[7], r[4], r[5]), e.indices.push(i, i + 1, i + 2, i + 1, i + 2, i + 3) } }, Or[W.RREC] = Er; var Cr = function() { this.style = null, this.size = 0, this.start = 0, this.attribStart = 0, this.attribSize = 0 }, Rr = function(r) { function GraphicsGeometry() { r.call(this), this.points = [], this.colors = [], this.uvs = [], this.indices = [], this.textureIds = [], this.graphicsData = [], this.dirty = 0, this.batchDirty = -1, this.cacheDirty = -1, this.clearDirty = 0, this.drawCalls = [], this.batches = [], this.shapeIndex = 0, this._bounds = new ft, this.boundsDirty = -1, this.boundsPadding = 0, this.batchable = !1, this.indicesUint16 = null, this.uvsFloat32 = null } r && (GraphicsGeometry.__proto__ = r), (GraphicsGeometry.prototype = Object.create(r && r.prototype)).constructor = GraphicsGeometry; var t = { bounds: { configurable: !0 } }; return t.bounds.get = function() { return this.boundsDirty !== this.dirty && (this.boundsDirty = this.dirty, this.calculateBounds()), this._bounds }, GraphicsGeometry.prototype.clear = function() { if (0 < this.graphicsData.length) { this.boundsDirty = -1, this.dirty++, this.clearDirty++, this.batchDirty++, this.graphicsData.length = 0, this.shapeIndex = 0, this.points.length = 0, this.colors.length = 0, this.uvs.length = 0, this.indices.length = 0; for (var t = this.textureIds.length = 0; t < this.drawCalls.length; t++) this.drawCalls[t].textures.length = 0, Pr.push(this.drawCalls[t]); for (var e = this.drawCalls.length = 0; e < this.batches.length; e++) { var r = this.batches[e]; r.start = 0, r.attribStart = 0, r.style = null, Ar.push(r) } this.batches.length = 0 } return this }, GraphicsGeometry.prototype.drawShape = function(t, e, r, n) { var i = new Tr(t, e, r, n); return this.graphicsData.push(i), this.dirty++, this }, GraphicsGeometry.prototype.drawHole = function(t, e) { if (!this.graphicsData.length) return null; var r = new Tr(t, null, null, e), n = this.graphicsData[this.graphicsData.length - 1]; return r.lineStyle = n.lineStyle, n.holes.push(r), this.dirty++, r }, GraphicsGeometry.prototype.destroy = function(t) { r.prototype.destroy.call(this, t); for (var e = 0; e < this.graphicsData.length; ++e) this.graphicsData[e].destroy(); this.points.length = 0, this.points = null, this.colors.length = 0, this.colors = null, this.uvs.length = 0, this.uvs = null, this.indices.length = 0, this.indices = null, this.indexBuffer.destroy(), this.indexBuffer = null, this.graphicsData.length = 0, this.graphicsData = null, this.drawCalls.length = 0, this.drawCalls = null, this.batches.length = 0, this.batches = null, this._bounds = null }, GraphicsGeometry.prototype.containsPoint = function(t) { for (var e = this.graphicsData, r = 0; r < e.length; ++r) { var n = e[r]; if (n.fillStyle.visible && (n.shape && n.shape.contains(t.x, t.y))) { if (n.holes) for (var i = 0; i < n.holes.length; i++) { if (n.holes[i].shape.contains(t.x, t.y)) return !1 } return !0 } } return !1 }, GraphicsGeometry.prototype.updateBatches = function() { if (this.dirty !== this.cacheDirty && 0 !== this.graphicsData.length) { if (this.dirty !== this.cacheDirty) for (var t = 0; t < this.graphicsData.length; t++) { var e = this.graphicsData[t]; if (e.fillStyle && !e.fillStyle.texture.baseTexture.valid) return; if (e.lineStyle && !e.lineStyle.texture.baseTexture.valid) return } this.cacheDirty = this.dirty; var r = this.uvs, n = this.batches.pop() || Ar.pop() || new Cr; n.style = n.style || this.graphicsData[0].fillStyle || this.graphicsData[0].lineStyle; var i = n.style.texture.baseTexture, o = n.style.color + n.style.alpha; this.batches.push(n); for (var a = this.shapeIndex; a < this.graphicsData.length; a++) { this.shapeIndex++; var s = this.graphicsData[a], u = Or[s.type], h = s.fillStyle, c = s.lineStyle; u.build(s), s.matrix && this.transformPoints(s.points, s.matrix); for (var l = 0; l < 2; l++) { var f = 0 === l ? h : c; if (f.visible) { var d = f.texture.baseTexture; if (i !== d || f.color + f.alpha !== o) { d.wrapMode = 10497, i = d, o = f.color + f.alpha; var p = this.indices.length, m = this.points.length / 2; n.size = p - n.start, n.attribSize = m - n.attribStart, 0 < n.size && (n = Ar.pop() || new Cr, this.batches.push(n)), n.style = f, n.start = p, n.attribStart = m } var v = this.points.length / 2; if (0 === l) s.holes.length ? (this.processHoles(s.holes), Mr.triangulate(s, this)) : u.triangulate(s, this); else { buildLine(s, this); for (var g = 0; g < s.holes.length; g++) buildLine(s.holes[g], this) } var y = this.points.length / 2 - v; this.addUvs(this.points, r, f.texture, v, y, f.matrix) } } } var _ = this.indices.length, b = this.points.length / 2; if (n.size = _ - n.start, n.attribSize = b - n.attribStart, this.indicesUint16 = new Uint16Array(this.indices), this.batchable = this.isBatchable(), this.batchable) { this.batchDirty++, this.uvsFloat32 = new Float32Array(this.uvs); for (var x = 0; x < this.batches.length; x++) for (var w = this.batches[x], T = 0; T < w.size; T++) { var S = w.start + T; this.indicesUint16[S] = this.indicesUint16[S] - w.attribStart } } else this.buildDrawCalls() } }, GraphicsGeometry.prototype.isBatchable = function() { for (var t = this.batches, e = 0; e < t.length; e++) if (t[e].style.native) return !1; return this.points.length < 2 * GraphicsGeometry.BATCHABLE_SIZE }, GraphicsGeometry.prototype.buildDrawCalls = function() { Ir++; for (var t = 0; t < this.drawCalls.length; t++) this.drawCalls[t].textures.length = 0, Pr.push(this.drawCalls[t]); this.drawCalls.length = 0; var e = this.uvs, r = this.colors, n = this.textureIds, i = Pr.pop() || new ir; i.textureCount = 0, i.start = 0, i.size = 0, i.type = x.TRIANGLES; var o = 0, a = null, s = 0, u = !1, h = x.TRIANGLES, c = 0; this.drawCalls.push(i); for (var l = 0; l < this.batches.length; l++) { var f = this.batches[l], d = f.style, p = d.texture.baseTexture; u !== d.native && (h = (u = d.native) ? x.LINES : x.TRIANGLES, a = null, o = 8, Ir++), a !== p && (a = p)._enabled !== Ir && (8 === o && (Ir++, (o = 0) < i.size && (i = Pr.pop() || new ir, this.drawCalls.push(i)), i.start = c, i.size = 0, i.textureCount = 0, i.type = h), p.touched = 1, p._enabled = Ir, p._id = o, p.wrapMode = 10497, i.textures[i.textureCount++] = p, o++), i.size += f.size, c += f.size, s = p._id, this.addColors(r, d.color, d.alpha, f.attribSize), this.addTextureIds(n, s, f.attribSize) } for (var m = this.points, v = new ArrayBuffer(3 * m.length * 4), g = new Float32Array(v), y = new Uint32Array(v), _ = 0, b = 0; b < m.length / 2; b++) g[_++] = m[2 * b], g[_++] = m[2 * b + 1], g[_++] = e[2 * b], g[_++] = e[2 * b + 1], y[_++] = r[b], g[_++] = n[b]; this._buffer.update(v), this._indexBuffer.update(this.indicesUint16) }, GraphicsGeometry.prototype.processHoles = function(t) { for (var e = 0; e < t.length; e++) { var r = t[e]; Or[r.type].build(r), r.matrix && this.transformPoints(r.points, r.matrix) } }, GraphicsGeometry.prototype.calculateBounds = function() { var t = 1 / 0, e = -1 / 0, r = 1 / 0, n = -1 / 0; if (this.graphicsData.length) for (var i = null, o = 0, a = 0, s = 0, u = 0, h = 0; h < this.graphicsData.length; h++) { var c = this.graphicsData[h], l = c.type, f = c.lineStyle ? c.lineStyle.width : 0; if (i = c.shape, l === W.RECT || l === W.RREC) o = i.x - f / 2, a = i.y - f / 2, t = o < t ? o : t, e = e < o + (s = i.width + f) ? o + s : e, r = a < r ? a : r, n = n < a + (u = i.height + f) ? a + u : n; else if (l === W.CIRC) o = i.x, a = i.y, t = o - (s = i.radius + f / 2) < t ? o - s : t, e = e < o + s ? o + s : e, r = a - (u = i.radius + f / 2) < r ? a - u : r, n = n < a + u ? a + u : n; else if (l === W.ELIP) o = i.x, a = i.y, t = o - (s = i.width + f / 2) < t ? o - s : t, e = e < o + s ? o + s : e, r = a - (u = i.height + f / 2) < r ? a - u : r, n = n < a + u ? a + u : n; else for (var d = i.points, p = 0, m = 0, v = 0, g = 0, y = 0, _ = 0, b = 0, x = 0, w = 0; w + 2 < d.length; w += 2) o = d[w], a = d[w + 1], p = d[w + 2], m = d[w + 3], v = Math.abs(p - o), g = Math.abs(m - a), u = f, (s = Math.sqrt(v * v + g * g)) < 1e-9 || (t = (b = (p + o) / 2) - (y = (u / s * g + v) / 2) < t ? b - y : t, e = e < b + y ? b + y : e, r = (x = (m + a) / 2) - (_ = (u / s * v + g) / 2) < r ? x - _ : r, n = n < x + _ ? x + _ : n) } else n = r = e = t = 0; var T = this.boundsPadding; this._bounds.minX = t - T, this._bounds.maxX = e + T, this._bounds.minY = r - T, this._bounds.maxY = n + T }, GraphicsGeometry.prototype.transformPoints = function(t, e) { for (var r = 0; r < t.length / 2; r++) { var n = t[2 * r], i = t[2 * r + 1]; t[2 * r] = e.a * n + e.c * i + e.tx, t[2 * r + 1] = e.b * n + e.d * i + e.ty } }, GraphicsGeometry.prototype.addColors = function(t, e, r, n) { for (var i = premultiplyTint((e >> 16) + (65280 & e) + ((255 & e) << 16), r); 0 < n--;) t.push(i) }, GraphicsGeometry.prototype.addTextureIds = function(t, e, r) { for (; 0 < r--;) t.push(e) }, GraphicsGeometry.prototype.addUvs = function(t, e, r, n, i, o) { for (var a = 0, s = e.length, u = r.frame; a < i;) { var h = t[2 * (n + a)], c = t[2 * (n + a) + 1]; if (o) { var l = o.a * h + o.c * c + o.tx; c = o.b * h + o.d * c + o.ty, h = l } a++, e.push(h / u.width, c / u.height) } var f = r.baseTexture; (u.width < f.width || u.height < f.height) && this.adjustUvs(e, r, s, i) }, GraphicsGeometry.prototype.adjustUvs = function(t, e, r, n) { for (var i = e.baseTexture, o = r + 2 * n, a = e.frame, s = a.width / i.width, u = a.height / i.height, h = a.x / a.width, c = a.y / a.width, l = Math.floor(t[r] + 1e-6), f = Math.floor(t[r + 1] + 1e-6), d = r + 2; d < o; d += 2) l = Math.min(l, Math.floor(t[d] + 1e-6)), f = Math.min(f, Math.floor(t[d + 1] + 1e-6)); h -= l, c -= f; for (var p = r; p < o; p += 2) t[p] = (t[p] + h) * s, t[p + 1] = (t[p + 1] + c) * u }, Object.defineProperties(GraphicsGeometry.prototype, t), GraphicsGeometry }(nr); Rr.BATCHABLE_SIZE = 100; var Dr = function(t) { function LineStyle() { t.apply(this, arguments) } return t && (LineStyle.__proto__ = t), ((LineStyle.prototype = Object.create(t && t.prototype)).constructor = LineStyle).prototype.clone = function() { var t = new LineStyle; return t.color = this.color, t.alpha = this.alpha, t.texture = this.texture, t.matrix = this.matrix, t.visible = this.visible, t.width = this.width, t.alignment = this.alignment, t.native = this.native, t }, LineStyle.prototype.reset = function() { t.prototype.reset.call(this), this.color = 0, this.width = 0, this.alignment = .5, this.native = !1 }, LineStyle }(wr), Fr = function() {}; Fr.curveLength = function(t, e, r, n, i, o, a, s) { for (var u = 0, h = 0, c = 0, l = 0, f = 0, d = 0, p = 0, m = 0, v = 0, g = 0, y = 0, _ = t, b = e, x = 1; x <= 10; ++x) g = _ - (m = (p = (d = (f = 1 - (h = x / 10)) * f) * f) * t + 3 * d * h * r + 3 * f * (c = h * h) * i + (l = c * h) * a), y = b - (v = p * e + 3 * d * h * n + 3 * f * c * o + l * s), _ = m, b = v, u += Math.sqrt(g * g + y * y); return u }, Fr.curveTo = function(t, e, r, n, i, o, a) { var s = a[a.length - 2], u = a[a.length - 1]; a.length -= 2; var h = xr._segmentsCount(Fr.curveLength(s, u, t, e, r, n, i, o)), c = 0, l = 0, f = 0, d = 0, p = 0; a.push(s, u); for (var m = 1, v = 0; m <= h; ++m) f = (l = (c = 1 - (v = m / h)) * c) * c, p = (d = v * v) * v, a.push(f * s + 3 * l * v * t + 3 * c * d * r + p * i, f * u + 3 * l * v * e + 3 * c * d * n + p * o) }; var kr = function() {}; kr.curveLength = function(t, e, r, n, i, o) { var a = t - 2 * r + i, s = e - 2 * n + o, u = 2 * r - 2 * t, h = 2 * n - 2 * e, c = 4 * (a * a + s * s), l = 4 * (a * u + s * h), f = u * u + h * h, d = 2 * Math.sqrt(c + l + f), p = Math.sqrt(c), m = 2 * c * p, v = 2 * Math.sqrt(f), g = l / p; return (m * d + p * l * (d - v) + (4 * f * c - l * l) * Math.log((2 * p + g + d) / (g + v))) / (4 * m) }, kr.curveTo = function(t, e, r, n, i) { for (var o = i[i.length - 2], a = i[i.length - 1], s = xr._segmentsCount(kr.curveLength(o, a, t, e, r, n)), u = 0, h = 0, c = 1; c <= s; ++c) { var l = c / s; u = o + (t - o) * l, h = a + (e - a) * l, i.push(u + (t + (r - t) * l - u) * l, h + (e + (n - e) * l - h) * l) } }; var Lr = function() {}; Lr.curveTo = function(t, e, r, n, i, o) { var a = o[o.length - 2], s = o[o.length - 1] - e, u = a - t, h = n - e, c = r - t, l = Math.abs(s * c - u * h); if (l < 1e-8 || 0 === i) return o[o.length - 2] === t && o[o.length - 1] === e || o.push(t, e), null; var f = s * s + u * u, d = h * h + c * c, p = s * h + u * c, m = i * Math.sqrt(f) / l, v = i * Math.sqrt(d) / l, g = m * p / f, y = v * p / d, _ = m * c + v * u, b = m * h + v * s, x = u * (v + g), w = s * (v + g), T = c * (m + y), S = h * (m + y); return { cx: _ + t, cy: b + e, radius: i, startAngle: Math.atan2(w - b, x - _), endAngle: Math.atan2(S - b, T - _), anticlockwise: c * s < u * h } }, Lr.arc = function(t, e, r, n, i, o, a, s, u) { for (var h = a - o, c = xr._segmentsCount(Math.abs(h) * i, 40 * Math.ceil(Math.abs(h) / X)), l = h / (2 * c), f = 2 * l, d = Math.cos(l), p = Math.sin(l), m = c - 1, v = m % 1 / m, g = 0; g <= m; ++g) { var y = l + o + f * (g + v * g), _ = Math.cos(y), b = -Math.sin(y); u.push((d * _ + p * b) * i + r, (d * -b + p * _) * i + n) } }; var Nr = function(d) { function Star(t, e, r, n, i, o) { i = i || n / 2; for (var a = -1 * Math.PI / 2 + o, s = 2 * r, u = X / s, h = [], c = 0; c < s; c++) { var l = c % 2 ? i : n, f = c * u + a; h.push(t + l * Math.cos(f), e + l * Math.sin(f)) } d.call(this, h) } return d && (Star.__proto__ = d), (Star.prototype = Object.create(d && d.prototype)).constructor = Star }(ct), Br = new Float32Array(3), Ur = null, Gr = function(e) { function Graphics(t) { void 0 === t && (t = null), e.call(this), this.geometry = t || new Rr, this.geometry.refCount++, this.shader = null, this.state = Ce.for2d(), this._fillStyle = new wr, this._lineStyle = new Dr, this._matrix = null, this._holeMode = !1, this.currentPath = null, this.batches = [], this.batchTint = -1, this.vertexData = null, this._transformID = -1, this.batchDirty = -1, this.tint = 16777215, this.blendMode = y.NORMAL } e && (Graphics.__proto__ = e); var t = { blendMode: { configurable: !0 }, tint: { configurable: !0 }, fill: { configurable: !0 }, line: { configurable: !0 } }; return ((Graphics.prototype = Object.create(e && e.prototype)).constructor = Graphics).prototype.clone = function() { return this.finishPoly(), new Graphics(this.geometry) }, t.blendMode.set = function(t) { this.state.blendMode = t }, t.blendMode.get = function() { return this.state.blendMode }, t.tint.get = function() { return this._tint }, t.tint.set = function(t) { this._tint = t }, t.fill.get = function() { return this._fillStyle }, t.line.get = function() { return this._lineStyle }, Graphics.prototype.lineStyle = function(t, e, r, n, i) { return void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === r && (r = 1), void 0 === n && (n = .5), void 0 === i && (i = !1), this.lineTextureStyle(t, Ht.WHITE, e, r, null, n, i), this }, Graphics.prototype.lineTextureStyle = function(t, e, r, n, i, o, a) { void 0 === t && (t = 0), void 0 === e && (e = Ht.WHITE), void 0 === r && (r = 16777215), void 0 === n && (n = 1), void 0 === i && (i = null), void 0 === o && (o = .5), void 0 === a && (a = !1), this.currentPath && this.startPoly(); var s = 0 < t && 0 < n; return s ? (i && (i = i.clone()).invert(), Object.assign(this._lineStyle, { color: r, width: t, alpha: n, matrix: i, texture: e, alignment: o, native: a, visible: s })) : this._lineStyle.reset(), this }, Graphics.prototype.startPoly = function() { if (this.currentPath) { var t = this.currentPath.points, e = this.currentPath.points.length; 2 < e && (this.drawShape(this.currentPath), this.currentPath = new ct, this.currentPath.closeStroke = !1, this.currentPath.points.push(t[e - 2], t[e - 1])) } else this.currentPath = new ct, this.currentPath.closeStroke = !1 }, Graphics.prototype.finishPoly = function() { this.currentPath && (2 < this.currentPath.points.length ? (this.drawShape(this.currentPath), this.currentPath = null) : this.currentPath.points.length = 0) }, Graphics.prototype.moveTo = function(t, e) { return this.startPoly(), this.currentPath.points[0] = t, this.currentPath.points[1] = e, this }, Graphics.prototype.lineTo = function(t, e) { this.currentPath || this.moveTo(0, 0); var r = this.currentPath.points, n = r[r.length - 2], i = r[r.length - 1]; return n === t && i === e || r.push(t, e), this }, Graphics.prototype._initCurve = function(t, e) { void 0 === t && (t = 0), void 0 === e && (e = 0), this.currentPath ? 0 === this.currentPath.points.length && (this.currentPath.points = [t, e]) : this.moveTo(t, e) }, Graphics.prototype.quadraticCurveTo = function(t, e, r, n) { this._initCurve(); var i = this.currentPath.points; return 0 === i.length && this.moveTo(0, 0), kr.curveTo(t, e, r, n, i), this }, Graphics.prototype.bezierCurveTo = function(t, e, r, n, i, o) { return this._initCurve(), Fr.curveTo(t, e, r, n, i, o, this.currentPath.points), this }, Graphics.prototype.arcTo = function(t, e, r, n, i) { this._initCurve(t, e); var o = this.currentPath.points, a = Lr.curveTo(t, e, r, n, i, o); if (a) { var s = a.cx, u = a.cy, h = a.radius, c = a.startAngle, l = a.endAngle, f = a.anticlockwise; this.arc(s, u, h, c, l, f) } return this }, Graphics.prototype.arc = function(t, e, r, n, i, o) { if (void 0 === o && (o = !1), n === i) return this; if (!o && i <= n ? i += X : o && n <= i && (n += X), 0 === i - n) return this; var a = t + Math.cos(n) * r, s = e + Math.sin(n) * r, u = this.currentPath ? this.currentPath.points : null; if (u) { var h = Math.abs(u[u.length - 2] - a), c = Math.abs(u[u.length - 1] - s); h < .001 && c < .001 || u.push(a, s) } else this.moveTo(a, s), u = this.currentPath.points; return Lr.arc(a, s, t, e, r, n, i, o, u), this }, Graphics.prototype.beginFill = function(t, e) { return void 0 === t && (t = 0), void 0 === e && (e = 1), this.beginTextureFill(Ht.WHITE, t, e) }, Graphics.prototype.beginTextureFill = function(t, e, r, n) { void 0 === t && (t = Ht.WHITE), void 0 === e && (e = 16777215), void 0 === r && (r = 1), void 0 === n && (n = null), this.currentPath && this.startPoly(); var i = 0 < r; return i ? (n && (n = n.clone()).invert(), Object.assign(this._fillStyle, { color: e, alpha: r, texture: t, matrix: n, visible: i })) : this._fillStyle.reset(), this }, Graphics.prototype.endFill = function() { return this.finishPoly(), this._fillStyle.reset(), this }, Graphics.prototype.drawRect = function(t, e, r, n) { return this.drawShape(new ot(t, e, r, n)) }, Graphics.prototype.drawRoundedRect = function(t, e, r, n, i) { return this.drawShape(new lt(t, e, r, n, i)) }, Graphics.prototype.drawCircle = function(t, e, r) { return this.drawShape(new ut(t, e, r)) }, Graphics.prototype.drawEllipse = function(t, e, r, n) { return this.drawShape(new ht(t, e, r, n)) }, Graphics.prototype.drawPolygon = function(t) { var e = arguments, r = t, n = !0; if (r.points && (n = r.closeStroke, r = r.points), !Array.isArray(r)) { r = new Array(arguments.length); for (var i = 0; i < r.length; ++i) r[i] = e[i] } var o = new ct(r); return o.closeStroke = n, this.drawShape(o), this }, Graphics.prototype.drawShape = function(t) { return this._holeMode ? this.geometry.drawHole(t, this._matrix) : this.geometry.drawShape(t, this._fillStyle.clone(), this._lineStyle.clone(), this._matrix), this }, Graphics.prototype.drawStar = function(t, e, r, n, i, o) { return void 0 === o && (o = 0), this.drawPolygon(new Nr(t, e, r, n, i, o)) }, Graphics.prototype.clear = function() { return this.geometry.clear(), this._matrix = null, this._holeMode = !1, this.currentPath = null, this._spriteRect = null, this }, Graphics.prototype.isFastRect = function() { return !1 }, Graphics.prototype._render = function(t) { this.finishPoly(); var e = this.geometry; if (e.updateBatches(), e.batchable) { if (this.batchDirty !== e.batchDirty) { this.batches = [], this.batchTint = -1, this._transformID = -1, this.batchDirty = e.batchDirty, this.vertexData = new Float32Array(e.points); for (var r = this.blendMode, n = 0; n < e.batches.length; n++) { var i = e.batches[n], o = i.style.color, a = new Float32Array(this.vertexData.buffer, 4 * i.attribStart * 2, 2 * i.attribSize), s = new Float32Array(e.uvsFloat32.buffer, 4 * i.attribStart * 2, 2 * i.attribSize), u = { vertexData: a, blendMode: r, indices: new Uint16Array(e.indicesUint16.buffer, 2 * i.start, i.size), uvs: s, _batchRGB: hex2rgb(o), _tintRGB: o, _texture: i.style.texture, alpha: i.style.alpha, worldAlpha: 1 }; this.batches[n] = u } } if (t.batch.setObjectRenderer(t.plugins.batch), this.batches.length) { this.calculateVertices(), this.calculateTints(); for (var h = 0; h < this.batches.length; h++) { var c = this.batches[h]; c.worldAlpha = this.worldAlpha * c.alpha, t.plugins.batch.render(c) } } } else { if (t.batch.flush(), !this.shader) { if (!Ur) { for (var l = new Int32Array(16), f = 0; f < 16; f++) l[f] = f; var d = { tint: new Float32Array([1, 1, 1, 1]), translationMatrix: new Y, default: oe.from({ uSamplers: l }, !0) }, p = t.plugins.batch.shader.program; Ur = new Ie(p, d) } this.shader = Ur } var m = this.shader.uniforms; m.translationMatrix = this.transform.worldTransform; var v = this.tint, g = this.worldAlpha; m.tint[0] = (v >> 16 & 255) / 255 * g, m.tint[1] = (v >> 8 & 255) / 255 * g, m.tint[2] = (255 & v) / 255 * g, m.tint[3] = g, t.shader.bind(this.shader), t.geometry.bind(e, this.shader), t.state.setState(this.state); for (var y = 0; y < e.drawCalls.length; y++) { for (var _ = e.drawCalls[y], b = _.textureCount, x = 0; x < b; x++) t.texture.bind(_.textures[x], x); t.geometry.draw(_.type, _.size, _.start) } } }, Graphics.prototype._calculateBounds = function() { this.finishPoly(); var t = this.geometry.bounds; this._bounds.addFrame(this.transform, t.minX, t.minY, t.maxX, t.maxY) }, Graphics.prototype.containsPoint = function(t) { return this.worldTransform.applyInverse(t, Graphics._TEMP_POINT), this.geometry.containsPoint(Graphics._TEMP_POINT) }, Graphics.prototype.calculateTints = function() { if (this.batchTint !== this.tint) { this.batchTint = this.tint; for (var t = hex2rgb(this.tint, Br), e = 0; e < this.batches.length; e++) { var r = this.batches[e], n = r._batchRGB, i = (t[0] * n[0] * 255 << 16) + (t[1] * n[1] * 255 << 8) + (0 | t[2] * n[2] * 255); r._tintRGB = (i >> 16) + (65280 & i) + ((255 & i) << 16) } } }, Graphics.prototype.calculateVertices = function() { if (this._transformID !== this.transform._worldID) { this._transformID = this.transform._worldID; for (var t = this.transform.worldTransform, e = t.a, r = t.b, n = t.c, i = t.d, o = t.tx, a = t.ty, s = this.geometry.points, u = this.vertexData, h = 0, c = 0; c < s.length; c += 2) { var l = s[c], f = s[c + 1]; u[h++] = e * l + n * f + o, u[h++] = i * f + r * l + a } } }, Graphics.prototype.closePath = function() { var t = this.currentPath; return t && (t.closeStroke = !0), this }, Graphics.prototype.setMatrix = function(t) { return this._matrix = t, this }, Graphics.prototype.beginHole = function() { return this.finishPoly(), this._holeMode = !0, this }, Graphics.prototype.endHole = function() { return this.finishPoly(), this._holeMode = !1, this }, Graphics.prototype.destroy = function(t) { e.prototype.destroy.call(this, t), this.geometry.refCount--, 0 === this.geometry.refCount && this.geometry.dispose(), this._matrix = null, this.currentPath = null, this._lineStyle.destroy(), this._lineStyle = null, this._fillStyle.destroy(), this._fillStyle = null, this.geometry = null, this.shader = null, this.vertexData = null, this.batches.length = 0, this.batches = null, e.prototype.destroy.call(this, t) }, Object.defineProperties(Graphics.prototype, t), Graphics }(pt); Gr._TEMP_POINT = new q; var jr = new q, zr = new Uint16Array([0, 1, 2, 0, 2, 3]), Xr = function(r) { function Sprite(t) { r.call(this), this._anchor = new j(this._onAnchorUpdate, this, t ? t.defaultAnchor.x : 0, t ? t.defaultAnchor.y : 0), this._texture = null, this._width = 0, this._height = 0, this._tint = null, this._tintRGB = null, this.tint = 16777215, this.blendMode = y.NORMAL, this.shader = null, this.cachedTint = 16777215, this.uvs = null, this.texture = t || Ht.EMPTY, this.vertexData = new Float32Array(8), this.vertexTrimmedData = null, this._transformID = -1, this._textureID = -1, this._transformTrimmedID = -1, this._textureTrimmedID = -1, this.indices = zr, this.size = 4, this.start = 0, this.pluginName = "batch", this.isSprite = !0, this._roundPixels = M.ROUND_PIXELS } r && (Sprite.__proto__ = r); var t = { roundPixels: { configurable: !0 }, width: { configurable: !0 }, height: { configurable: !0 }, anchor: { configurable: !0 }, tint: { configurable: !0 }, texture: { configurable: !0 } }; return ((Sprite.prototype = Object.create(r && r.prototype)).constructor = Sprite).prototype._onTextureUpdate = function() { this._textureID = -1, this._textureTrimmedID = -1, this.cachedTint = 16777215, this.uvs = this._texture._uvs.uvsFloat32, this._width && (this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width), this._height && (this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height) }, Sprite.prototype._onAnchorUpdate = function() { this._transformID = -1, this._transformTrimmedID = -1 }, Sprite.prototype.calculateVertices = function() { var t = this._texture; if (this._transformID !== this.transform._worldID || this._textureID !== t._updateID) { this._transformID = this.transform._worldID, this._textureID = t._updateID; var e = this.transform.worldTransform, r = e.a, n = e.b, i = e.c, o = e.d, a = e.tx, s = e.ty, u = this.vertexData, h = t.trim, c = t.orig, l = this._anchor, f = 0, d = 0, p = 0, m = 0; if (p = h ? (f = (d = h.x - l._x * c.width) + h.width, (m = h.y - l._y * c.height) + h.height) : (f = (d = -l._x * c.width) + c.width, (m = -l._y * c.height) + c.height), u[0] = r * d + i * m + a, u[1] = o * m + n * d + s, u[2] = r * f + i * m + a, u[3] = o * m + n * f + s, u[4] = r * f + i * p + a, u[5] = o * p + n * f + s, u[6] = r * d + i * p + a, u[7] = o * p + n * d + s, this._roundPixels) for (var v = 0; v < 8; v++) u[v] = Math.round(u[v]) } }, Sprite.prototype.calculateTrimmedVertices = function() { if (this.vertexTrimmedData) { if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID) return } else this.vertexTrimmedData = new Float32Array(8); this._transformTrimmedID = this.transform._worldID, this._textureTrimmedID = this._texture._updateID; var t = this._texture, e = this.vertexTrimmedData, r = t.orig, n = this._anchor, i = this.transform.worldTransform, o = i.a, a = i.b, s = i.c, u = i.d, h = i.tx, c = i.ty, l = -n._x * r.width, f = l + r.width, d = -n._y * r.height, p = d + r.height; e[0] = o * l + s * d + h, e[1] = u * d + a * l + c, e[2] = o * f + s * d + h, e[3] = u * d + a * f + c, e[4] = o * f + s * p + h, e[5] = u * p + a * f + c, e[6] = o * l + s * p + h, e[7] = u * p + a * l + c }, Sprite.prototype._render = function(t) { this.calculateVertices(), t.batch.setObjectRenderer(t.plugins[this.pluginName]), t.plugins[this.pluginName].render(this) }, Sprite.prototype._calculateBounds = function() { var t = this._texture.trim, e = this._texture.orig; !t || t.width === e.width && t.height === e.height ? (this.calculateVertices(), this._bounds.addQuad(this.vertexData)) : (this.calculateTrimmedVertices(), this._bounds.addQuad(this.vertexTrimmedData)) }, Sprite.prototype.getLocalBounds = function(t) { return 0 === this.children.length ? (this._bounds.minX = this._texture.orig.width * -this._anchor._x, this._bounds.minY = this._texture.orig.height * -this._anchor._y, this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x), this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y), t || (this._localBoundsRect || (this._localBoundsRect = new ot), t = this._localBoundsRect), this._bounds.getRectangle(t)) : r.prototype.getLocalBounds.call(this, t) }, Sprite.prototype.containsPoint = function(t) { this.worldTransform.applyInverse(t, jr); var e = this._texture.orig.width, r = this._texture.orig.height, n = -e * this.anchor.x, i = 0; return jr.x >= n && jr.x < n + e && (i = -r * this.anchor.y, jr.y >= i && jr.y < i + r) }, Sprite.prototype.destroy = function(t) { if (r.prototype.destroy.call(this, t), this._texture.off("update", this._onTextureUpdate, this), this._anchor = null, "boolean" == typeof t ? t : t && t.texture) { var e = "boolean" == typeof t ? t : t && t.baseTexture; this._texture.destroy(!!e) } this._texture = null, this.shader = null }, Sprite.from = function(t, e) { return new Sprite(t instanceof Ht ? t : new Ht.from(t, e)) }, t.roundPixels.set = function(t) { this._roundPixels !== t && (this._transformID = -1), this._roundPixels = t }, t.roundPixels.get = function() { return this._roundPixels }, t.width.get = function() { return Math.abs(this.scale.x) * this._texture.orig.width }, t.width.set = function(t) { var e = sign(this.scale.x) || 1; this.scale.x = e * t / this._texture.orig.width, this._width = t }, t.height.get = function() { return Math.abs(this.scale.y) * this._texture.orig.height }, t.height.set = function(t) { var e = sign(this.scale.y) || 1; this.scale.y = e * t / this._texture.orig.height, this._height = t }, t.anchor.get = function() { return this._anchor }, t.anchor.set = function(t) { this._anchor.copyFrom(t) }, t.tint.get = function() { return this._tint }, t.tint.set = function(t) { this._tint = t, this._tintRGB = (t >> 16) + (65280 & t) + ((255 & t) << 16) }, t.texture.get = function() { return this._texture }, t.texture.set = function(t) { this._texture !== t && (this._texture = t || Ht.EMPTY, this.cachedTint = 16777215, this._textureID = -1, this._textureTrimmedID = -1, t && (t.baseTexture.valid ? this._onTextureUpdate() : t.once("update", this._onTextureUpdate, this))) }, Object.defineProperties(Sprite.prototype, t), Sprite }(pt), Vr = { LINEAR_VERTICAL: 0, LINEAR_HORIZONTAL: 1 }, qr = { align: "left", breakWords: !1, dropShadow: !1, dropShadowAlpha: 1, dropShadowAngle: Math.PI / 6, dropShadowBlur: 0, dropShadowColor: "black", dropShadowDistance: 5, fill: "black", fillGradientType: Vr.LINEAR_VERTICAL, fillGradientStops: [], fontFamily: "Arial", fontSize: 26, fontStyle: "normal", fontVariant: "normal", fontWeight: "normal", letterSpacing: 0, lineHeight: 0, lineJoin: "miter", miterLimit: 10, padding: 0, stroke: "black", strokeThickness: 0, textBaseline: "alphabetic", trim: !1, whiteSpace: "pre", wordWrap: !1, wordWrapWidth: 100, leading: 0 }, Hr = function(t) { this.styleID = 0, this.reset(), deepCopyProperties(this, t, t) }, Wr = { align: { configurable: !0 }, breakWords: { configurable: !0 }, dropShadow: { configurable: !0 }, dropShadowAlpha: { configurable: !0 }, dropShadowAngle: { configurable: !0 }, dropShadowBlur: { configurable: !0 }, dropShadowColor: { configurable: !0 }, dropShadowDistance: { configurable: !0 }, fill: { configurable: !0 }, fillGradientType: { configurable: !0 }, fillGradientStops: { configurable: !0 }, fontFamily: { configurable: !0 }, fontSize: { configurable: !0 }, fontStyle: { configurable: !0 }, fontVariant: { configurable: !0 }, fontWeight: { configurable: !0 }, letterSpacing: { configurable: !0 }, lineHeight: { configurable: !0 }, leading: { configurable: !0 }, lineJoin: { configurable: !0 }, miterLimit: { configurable: !0 }, padding: { configurable: !0 }, stroke: { configurable: !0 }, strokeThickness: { configurable: !0 }, textBaseline: { configurable: !0 }, trim: { configurable: !0 }, whiteSpace: { configurable: !0 }, wordWrap: { configurable: !0 }, wordWrapWidth: { configurable: !0 } }; function getSingleColor(t) { return "number" == typeof t ? hex2string(t) : ("string" == typeof t && 0 === t.indexOf("0x") && (t = t.replace("0x", "#")), t) } function getColor(t) { if (Array.isArray(t)) { for (var e = 0; e < t.length; ++e) t[e] = getSingleColor(t[e]); return t } return getSingleColor(t) } function deepCopyProperties(t, e, r) { for (var n in r) Array.isArray(e[n]) ? t[n] = e[n].slice() : t[n] = e[n] } Hr.prototype.clone = function() { var t = {}; return deepCopyProperties(t, this, qr), new Hr(t) }, Hr.prototype.reset = function() { deepCopyProperties(this, qr, qr) }, Wr.align.get = function() { return this._align }, Wr.align.set = function(t) { this._align !== t && (this._align = t, this.styleID++) }, Wr.breakWords.get = function() { return this._breakWords }, Wr.breakWords.set = function(t) { this._breakWords !== t && (this._breakWords = t, this.styleID++) }, Wr.dropShadow.get = function() { return this._dropShadow }, Wr.dropShadow.set = function(t) { this._dropShadow !== t && (this._dropShadow = t, this.styleID++) }, Wr.dropShadowAlpha.get = function() { return this._dropShadowAlpha }, Wr.dropShadowAlpha.set = function(t) { this._dropShadowAlpha !== t && (this._dropShadowAlpha = t, this.styleID++) }, Wr.dropShadowAngle.get = function() { return this._dropShadowAngle }, Wr.dropShadowAngle.set = function(t) { this._dropShadowAngle !== t && (this._dropShadowAngle = t, this.styleID++) }, Wr.dropShadowBlur.get = function() { return this._dropShadowBlur }, Wr.dropShadowBlur.set = function(t) { this._dropShadowBlur !== t && (this._dropShadowBlur = t, this.styleID++) }, Wr.dropShadowColor.get = function() { return this._dropShadowColor }, Wr.dropShadowColor.set = function(t) { var e = getColor(t); this._dropShadowColor !== e && (this._dropShadowColor = e, this.styleID++) }, Wr.dropShadowDistance.get = function() { return this._dropShadowDistance }, Wr.dropShadowDistance.set = function(t) { this._dropShadowDistance !== t && (this._dropShadowDistance = t, this.styleID++) }, Wr.fill.get = function() { return this._fill }, Wr.fill.set = function(t) { var e = getColor(t); this._fill !== e && (this._fill = e, this.styleID++) }, Wr.fillGradientType.get = function() { return this._fillGradientType }, Wr.fillGradientType.set = function(t) { this._fillGradientType !== t && (this._fillGradientType = t, this.styleID++) }, Wr.fillGradientStops.get = function() { return this._fillGradientStops }, Wr.fillGradientStops.set = function(t) { (function(t, e) { if (!Array.isArray(t) || !Array.isArray(e)) return !1; if (t.length !== e.length) return !1; for (var r = 0; r < t.length; ++r) if (t[r] !== e[r]) return !1; return !0 })(this._fillGradientStops, t) || (this._fillGradientStops = t, this.styleID++) }, Wr.fontFamily.get = function() { return this._fontFamily }, Wr.fontFamily.set = function(t) { this.fontFamily !== t && (this._fontFamily = t, this.styleID++) }, Wr.fontSize.get = function() { return this._fontSize }, Wr.fontSize.set = function(t) { this._fontSize !== t && (this._fontSize = t, this.styleID++) }, Wr.fontStyle.get = function() { return this._fontStyle }, Wr.fontStyle.set = function(t) { this._fontStyle !== t && (this._fontStyle = t, this.styleID++) }, Wr.fontVariant.get = function() { return this._fontVariant }, Wr.fontVariant.set = function(t) { this._fontVariant !== t && (this._fontVariant = t, this.styleID++) }, Wr.fontWeight.get = function() { return this._fontWeight }, Wr.fontWeight.set = function(t) { this._fontWeight !== t && (this._fontWeight = t, this.styleID++) }, Wr.letterSpacing.get = function() { return this._letterSpacing }, Wr.letterSpacing.set = function(t) { this._letterSpacing !== t && (this._letterSpacing = t, this.styleID++) }, Wr.lineHeight.get = function() { return this._lineHeight }, Wr.lineHeight.set = function(t) { this._lineHeight !== t && (this._lineHeight = t, this.styleID++) }, Wr.leading.get = function() { return this._leading }, Wr.leading.set = function(t) { this._leading !== t && (this._leading = t, this.styleID++) }, Wr.lineJoin.get = function() { return this._lineJoin }, Wr.lineJoin.set = function(t) { this._lineJoin !== t && (this._lineJoin = t, this.styleID++) }, Wr.miterLimit.get = function() { return this._miterLimit }, Wr.miterLimit.set = function(t) { this._miterLimit !== t && (this._miterLimit = t, this.styleID++) }, Wr.padding.get = function() { return this._padding }, Wr.padding.set = function(t) { this._padding !== t && (this._padding = t, this.styleID++) }, Wr.stroke.get = function() { return this._stroke }, Wr.stroke.set = function(t) { var e = getColor(t); this._stroke !== e && (this._stroke = e, this.styleID++) }, Wr.strokeThickness.get = function() { return this._strokeThickness }, Wr.strokeThickness.set = function(t) { this._strokeThickness !== t && (this._strokeThickness = t, this.styleID++) }, Wr.textBaseline.get = function() { return this._textBaseline }, Wr.textBaseline.set = function(t) { this._textBaseline !== t && (this._textBaseline = t, this.styleID++) }, Wr.trim.get = function() { return this._trim }, Wr.trim.set = function(t) { this._trim !== t && (this._trim = t, this.styleID++) }, Wr.whiteSpace.get = function() { return this._whiteSpace }, Wr.whiteSpace.set = function(t) { this._whiteSpace !== t && (this._whiteSpace = t, this.styleID++) }, Wr.wordWrap.get = function() { return this._wordWrap }, Wr.wordWrap.set = function(t) { this._wordWrap !== t && (this._wordWrap = t, this.styleID++) }, Wr.wordWrapWidth.get = function() { return this._wordWrapWidth }, Wr.wordWrapWidth.set = function(t) { this._wordWrapWidth !== t && (this._wordWrapWidth = t, this.styleID++) }, Hr.prototype.toFontString = function() { var t = "number" == typeof this.fontSize ? this.fontSize + "px" : this.fontSize, e = this.fontFamily; Array.isArray(this.fontFamily) || (e = this.fontFamily.split(",")); for (var r = e.length - 1; 0 <= r; r--) { var n = e[r].trim(); /([\"\'])[^\'\"]+\1/.test(n) || (n = '"' + n + '"'), e[r] = n } return this.fontStyle + " " + this.fontVariant + " " + this.fontWeight + " " + t + " " + e.join(",") }, Object.defineProperties(Hr.prototype, Wr); var Yr = function(t, e, r, n, i, o, a, s, u) { this.text = t, this.style = e, this.width = r, this.height = n, this.lines = i, this.lineWidths = o, this.lineHeight = a, this.maxLineWidth = s, this.fontProperties = u }; Yr.measureText = function(t, e, r, n) { void 0 === n && (n = Yr._canvas), r = null == r ? e.wordWrap : r; var i = e.toFontString(), o = Yr.measureFont(i); 0 === o.fontSize && (o.fontSize = e.fontSize, o.ascent = e.fontSize); var a = n.getContext("2d"); a.font = i; for (var s = (r ? Yr.wordWrap(t, e, n) : t).split(/(?:\r\n|\r|\n)/), u = new Array(s.length), h = 0, c = 0; c < s.length; c++) { var l = a.measureText(s[c]).width + (s[c].length - 1) * e.letterSpacing; u[c] = l, h = Math.max(h, l) } var f = h + e.strokeThickness; e.dropShadow && (f += e.dropShadowDistance); var d = e.lineHeight || o.fontSize + e.strokeThickness, p = Math.max(d, o.fontSize + e.strokeThickness) + (s.length - 1) * (d + e.leading); return e.dropShadow && (p += e.dropShadowDistance), new Yr(t, e, f, p, s, u, d + e.leading, h, o) }, Yr.wordWrap = function(t, e, r) { void 0 === r && (r = Yr._canvas); for (var n = r.getContext("2d"), i = 0, o = "", a = "", s = {}, u = e.letterSpacing, h = e.whiteSpace, c = Yr.collapseSpaces(h), l = Yr.collapseNewlines(h), f = !c, d = e.wordWrapWidth + u, p = Yr.tokenize(t), m = 0; m < p.length; m++) { var v = p[m]; if (Yr.isNewline(v)) { if (!l) { a += Yr.addLine(o), f = !c, o = "", i = 0; continue } v = " " } if (c) { var g = Yr.isBreakingSpace(v), y = Yr.isBreakingSpace(o[o.length - 1]); if (g && y) continue } var _ = Yr.getFromCache(v, u, s, n); if (d < _) if ("" !== o && (a += Yr.addLine(o), o = "", i = 0), Yr.canBreakWords(v, e.breakWords)) for (var b = v.split(""), x = 0; x < b.length; x++) { for (var w = b[x], T = 1; b[x + T];) { var S = b[x + T], M = w[w.length - 1]; if (Yr.canBreakChars(M, S, v, x, e.breakWords)) break; w += S, T++ } x += w.length - 1; var E = Yr.getFromCache(w, u, s, n); d < E + i && (a += Yr.addLine(o), f = !1, o = "", i = 0), o += w, i += E } else { 0 < o.length && (a += Yr.addLine(o), o = "", i = 0); var A = m === p.length - 1; a += Yr.addLine(v, !A), f = !1, o = "", i = 0 } else d < _ + i && (f = !1, a += Yr.addLine(o), o = "", i = 0), (0 < o.length || !Yr.isBreakingSpace(v) || f) && (o += v, i += _) } return a += Yr.addLine(o, !1) }, Yr.addLine = function(t, e) { return void 0 === e && (e = !0), t = Yr.trimRight(t), t = e ? t + "\n" : t }, Yr.getFromCache = function(t, e, r, n) { var i = r[t]; if (void 0 === i) { var o = t.length * e; i = n.measureText(t).width + o, r[t] = i } return i }, Yr.collapseSpaces = function(t) { return "normal" === t || "pre-line" === t }, Yr.collapseNewlines = function(t) { return "normal" === t }, Yr.trimRight = function(t) { if ("string" != typeof t) return ""; for (var e = t.length - 1; 0 <= e; e--) { var r = t[e]; if (!Yr.isBreakingSpace(r)) break; t = t.slice(0, -1) } return t }, Yr.isNewline = function(t) { return "string" == typeof t && 0 <= Yr._newlines.indexOf(t.charCodeAt(0)) }, Yr.isBreakingSpace = function(t) { return "string" == typeof t && 0 <= Yr._breakingSpaces.indexOf(t.charCodeAt(0)) }, Yr.tokenize = function(t) { var e = [], r = ""; if ("string" != typeof t) return e; for (var n = 0; n < t.length; n++) { var i = t[n]; Yr.isBreakingSpace(i) || Yr.isNewline(i) ? ("" !== r && (e.push(r), r = ""), e.push(i)) : r += i } return "" !== r && e.push(r), e }, Yr.canBreakWords = function(t, e) { return e }, Yr.canBreakChars = function(t, e, r, n, i) { return !0 }, Yr.measureFont = function(t) { if (Yr._fonts[t]) return Yr._fonts[t]; var e = {}, r = Yr._canvas, n = Yr._context; n.font = t; var i = Yr.METRICS_STRING + Yr.BASELINE_SYMBOL, o = Math.ceil(n.measureText(i).width), a = Math.ceil(n.measureText(Yr.BASELINE_SYMBOL).width), s = 2 * a; a = a * Yr.BASELINE_MULTIPLIER | 0, r.width = o, r.height = s, n.fillStyle = "#f00", n.fillRect(0, 0, o, s), n.font = t, n.textBaseline = "alphabetic", n.fillStyle = "#000", n.fillText(i, 0, a); var u = n.getImageData(0, 0, o, s).data, h = u.length, c = 4 * o, l = 0, f = 0, d = !1; for (l = 0; l < a; ++l) { for (var p = 0; p < c; p += 4) if (255 !== u[f + p]) { d = !0; break } if (d) break; f += c } for (e.ascent = a - l, f = h - c, d = !1, l = s; a < l; --l) { for (var m = 0; m < c; m += 4) if (255 !== u[f + m]) { d = !0; break } if (d) break; f -= c } return e.descent = l - a, e.fontSize = e.ascent + e.descent, Yr._fonts[t] = e }, Yr.clearMetrics = function(t) { void 0 === t && (t = ""), t ? delete Yr._fonts[t] : Yr._fonts = {} }; var Kr = document.createElement("canvas"); Kr.width = Kr.height = 10, Yr._canvas = Kr, Yr._context = Kr.getContext("2d"), Yr._fonts = {}, Yr.METRICS_STRING = "|Éq", Yr.BASELINE_SYMBOL = "M", Yr.BASELINE_MULTIPLIER = 1.4, Yr._newlines = [10, 13]; var Zr = { texture: !0, children: !(Yr._breakingSpaces = [9, 32, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8200, 8201, 8202, 8287, 12288]), baseTexture: !0 }, Qr = function(i) { function Text(t, e, r) { (r = r || document.createElement("canvas")).width = 3, r.height = 3; var n = Ht.from(r); n.orig = new ot, n.trim = new ot, i.call(this, n), this.canvas = r, this.context = this.canvas.getContext("2d"), this._resolution = M.RESOLUTION, this._autoResolution = !0, this._text = null, this._style = null, this._styleListener = null, this._font = "", this.text = t, this.style = e, this.localStyleID = -1 } i && (Text.__proto__ = i); var t = { width: { configurable: !0 }, height: { configurable: !0 }, style: { configurable: !0 }, text: { configurable: !0 }, resolution: { configurable: !0 } }; return ((Text.prototype = Object.create(i && i.prototype)).constructor = Text).prototype.updateText = function(t) { var e = this._style; if (this.localStyleID !== e.styleID && (this.dirty = !0, this.localStyleID = e.styleID), this.dirty || !t) { this._font = this._style.toFontString(); var r, n, i = this.context, o = Yr.measureText(this._text || " ", this._style, this._style.wordWrap, this.canvas), a = o.width, s = o.height, u = o.lines, h = o.lineHeight, c = o.lineWidths, l = o.maxLineWidth, f = o.fontProperties; if (this.canvas.width = Math.ceil((Math.max(1, a) + 2 * e.padding) * this._resolution), this.canvas.height = Math.ceil((Math.max(1, s) + 2 * e.padding) * this._resolution), i.scale(this._resolution, this._resolution), i.clearRect(0, 0, this.canvas.width, this.canvas.height), i.font = this._font, i.strokeStyle = e.stroke, i.lineWidth = e.strokeThickness, i.textBaseline = e.textBaseline, i.lineJoin = e.lineJoin, i.miterLimit = e.miterLimit, e.dropShadow) { var d = e.dropShadowColor, p = hex2rgb("number" == typeof d ? d : string2hex(d)); i.shadowColor = "rgba(" + 255 * p[0] + "," + 255 * p[1] + "," + 255 * p[2] + "," + e.dropShadowAlpha + ")", i.shadowBlur = e.dropShadowBlur, i.shadowOffsetX = Math.cos(e.dropShadowAngle) * e.dropShadowDistance, i.shadowOffsetY = Math.sin(e.dropShadowAngle) * e.dropShadowDistance } else i.shadowColor = 0, i.shadowBlur = 0, i.shadowOffsetX = 0, i.shadowOffsetY = 0; i.fillStyle = this._generateFillStyle(e, u); for (var m = 0; m < u.length; m++) r = e.strokeThickness / 2, n = e.strokeThickness / 2 + m * h + f.ascent, "right" === e.align ? r += l - c[m] : "center" === e.align && (r += (l - c[m]) / 2), e.stroke && e.strokeThickness && this.drawLetterSpacing(u[m], r + e.padding, n + e.padding, !0), e.fill && this.drawLetterSpacing(u[m], r + e.padding, n + e.padding); this.updateTexture() } }, Text.prototype.drawLetterSpacing = function(t, e, r, n) { void 0 === n && (n = !1); var i = this._style.letterSpacing; if (0 !== i) for (var o = String.prototype.split.call(t, ""), a = e, s = 0, u = ""; s < t.length;) u = o[s++], n ? this.context.strokeText(u, a, r) : this.context.fillText(u, a, r), a += this.context.measureText(u).width + i; else n ? this.context.strokeText(t, e, r) : this.context.fillText(t, e, r) }, Text.prototype.updateTexture = function() { var t = this.canvas; if (this._style.trim) { var e = trimCanvas(t); e.data && (t.width = e.width, t.height = e.height, this.context.putImageData(e.data, 0, 0)) } var r = this._texture, n = this._style, i = n.trim ? 0 : n.padding, o = r.baseTexture; r.trim.width = r._frame.width = t.width / this._resolution, r.trim.height = r._frame.height = t.height / this._resolution, r.trim.x = -i, r.trim.y = -i, r.orig.width = r._frame.width - 2 * i, r.orig.height = r._frame.height - 2 * i, this._onTextureUpdate(), o.setRealSize(t.width, t.height, this._resolution), this.dirty = !1 }, Text.prototype.render = function(t) { this._autoResolution && this._resolution !== t.resolution && (this._resolution = t.resolution, this.dirty = !0), this.updateText(!0), i.prototype.render.call(this, t) }, Text.prototype._renderCanvas = function(t) { this._autoResolution && this._resolution !== t.resolution && (this._resolution = t.resolution, this.dirty = !0), this.updateText(!0), i.prototype._renderCanvas.call(this, t) }, Text.prototype.getLocalBounds = function(t) { return this.updateText(!0), i.prototype.getLocalBounds.call(this, t) }, Text.prototype._calculateBounds = function() { this.updateText(!0), this.calculateVertices(), this._bounds.addQuad(this.vertexData) }, Text.prototype._onStyleChange = function() { this.dirty = !0 }, Text.prototype._generateFillStyle = function(t, e) { if (!Array.isArray(t.fill)) return t.fill; var r, n, i, o, a = this.canvas.width / this._resolution, s = this.canvas.height / this._resolution, u = t.fill.slice(), h = t.fillGradientStops.slice(); if (!h.length) for (var c = u.length + 1, l = 1; l < c; ++l) h.push(l / c); if (u.unshift(t.fill[0]), h.unshift(0), u.push(t.fill[t.fill.length - 1]), h.push(1), t.fillGradientType === Vr.LINEAR_VERTICAL) { r = this.context.createLinearGradient(a / 2, 0, a / 2, s), n = (u.length + 1) * e.length; for (var f = i = 0; f < e.length; f++) { i += 1; for (var d = 0; d < u.length; d++) o = "number" == typeof h[d] ? h[d] / e.length + f / e.length : i / n, r.addColorStop(o, u[d]), i++ } } else { r = this.context.createLinearGradient(0, s / 2, a, s / 2), n = u.length + 1, i = 1; for (var p = 0; p < u.length; p++) o = "number" == typeof h[p] ? h[p] : i / n, r.addColorStop(o, u[p]), i++ } return r }, Text.prototype.destroy = function(t) { "boolean" == typeof t && (t = { children: t }), t = Object.assign({}, Zr, t), i.prototype.destroy.call(this, t), this.context = null, this.canvas = null, this._style = null }, t.width.get = function() { return this.updateText(!0), Math.abs(this.scale.x) * this._texture.orig.width }, t.width.set = function(t) { this.updateText(!0); var e = sign(this.scale.x) || 1; this.scale.x = e * t / this._texture.orig.width, this._width = t }, t.height.get = function() { return this.updateText(!0), Math.abs(this.scale.y) * this._texture.orig.height }, t.height.set = function(t) { this.updateText(!0); var e = sign(this.scale.y) || 1; this.scale.y = e * t / this._texture.orig.height, this._height = t }, t.style.get = function() { return this._style }, t.style.set = function(t) { t = t || {}, this._style = t instanceof Hr ? t : new Hr(t), this.localStyleID = -1, this.dirty = !0 }, t.text.get = function() { return this._text }, t.text.set = function(t) { t = String(null == t ? "" : t), this._text !== t && (this._text = t, this.dirty = !0) }, t.resolution.get = function() { return this._resolution }, t.resolution.set = function(t) { this._autoResolution = !1, this._resolution !== t && (this._resolution = t, this.dirty = !0) }, Object.defineProperties(Text.prototype, t), Text }(Xr); M.UPLOADS_PER_FRAME = 4; var Jr = function(t) { this.maxItemsPerFrame = t, this.itemsLeft = 0 }; Jr.prototype.beginFrame = function() { this.itemsLeft = this.maxItemsPerFrame }, Jr.prototype.allowedToUpload = function() { return 0 < this.itemsLeft-- }; var $r = function(t) { var e = this; this.limiter = new Jr(M.UPLOADS_PER_FRAME), this.renderer = t, this.uploadHookHelper = null, this.queue = [], this.addHooks = [], this.uploadHooks = [], this.completes = [], this.ticking = !1, this.delayedTick = function() { e.queue && e.prepareItems() }, this.registerFindHook(findText), this.registerFindHook(findTextStyle), this.registerFindHook(findMultipleBaseTextures), this.registerFindHook(findBaseTexture), this.registerFindHook(findTexture), this.registerUploadHook(drawText), this.registerUploadHook(calculateTextStyle) }; function findMultipleBaseTextures(t, e) { var r = !1; if (t && t._textures && t._textures.length) for (var n = 0; n < t._textures.length; n++) if (t._textures[n] instanceof Ht) { var i = t._textures[n].baseTexture; - 1 === e.indexOf(i) && (e.push(i), r = !0) } return r } function findBaseTexture(t, e) { return t instanceof Rt && (-1 === e.indexOf(t) && e.push(t), !0) } function findTexture(t, e) { if (t._texture && t._texture instanceof Ht) { var r = t._texture.baseTexture; return -1 === e.indexOf(r) && e.push(r), !0 } return !1 } function drawText(t, e) { return e instanceof Qr && (e.updateText(!0), !0) } function calculateTextStyle(t, e) { if (e instanceof Hr) { var r = e.toFontString(); return Yr.measureFont(r), !0 } return !1 } function findText(t, e) { if (t instanceof Qr) { -1 === e.indexOf(t.style) && e.push(t.style), -1 === e.indexOf(t) && e.push(t); var r = t._texture.baseTexture; return -1 === e.indexOf(r) && e.push(r), !0 } return !1 } function findTextStyle(t, e) { return t instanceof Hr && (-1 === e.indexOf(t) && e.push(t), !0) } $r.prototype.upload = function(t, e) { "function" == typeof t && (e = t, t = null), t && this.add(t), this.queue.length ? (e && this.completes.push(e), this.ticking || (this.ticking = !0, xt.system.addOnce(this.tick, this, _t.UTILITY))) : e && e() }, $r.prototype.tick = function() { setTimeout(this.delayedTick, 0) }, $r.prototype.prepareItems = function() { for (this.limiter.beginFrame(); this.queue.length && this.limiter.allowedToUpload();) { var t = this.queue[0], e = !1; if (t && !t._destroyed) for (var r = 0, n = this.uploadHooks.length; r < n; r++) if (this.uploadHooks[r](this.uploadHookHelper, t)) { this.queue.shift(), e = !0; break } e || this.queue.shift() } if (this.queue.length) xt.system.addOnce(this.tick, this, _t.UTILITY); else { this.ticking = !1; for (var i = this.completes.slice(0), o = this.completes.length = 0, a = i.length; o < a; o++) i[o]() } }, $r.prototype.registerFindHook = function(t) { return t && this.addHooks.push(t), this }, $r.prototype.registerUploadHook = function(t) { return t && this.uploadHooks.push(t), this }, $r.prototype.add = function(t) { for (var e = 0, r = this.addHooks.length; e < r && !this.addHooks[e](t, this.queue); e++); if (t instanceof pt) for (var n = t.children.length - 1; 0 <= n; n--) this.add(t.children[n]); return this }, $r.prototype.destroy = function() { this.ticking && xt.system.remove(this.tick, this), this.ticking = !1, this.addHooks = null, this.uploadHooks = null, this.renderer = null, this.completes = null, this.queue = null, this.limiter = null, this.uploadHookHelper = null }; var tn = function(e) { function Prepare(t) { e.call(this, t), this.uploadHookHelper = this.renderer, this.registerFindHook(findGraphics), this.registerUploadHook(uploadBaseTextures), this.registerUploadHook(uploadGraphics) } return e && (Prepare.__proto__ = e), (Prepare.prototype = Object.create(e && e.prototype)).constructor = Prepare }($r); function uploadBaseTextures(t, e) { return e instanceof Rt && (e._glTextures[t.CONTEXT_UID] || t.textureManager.updateTexture(e), !0) } function uploadGraphics(t, e) { return e instanceof Gr && ((e.dirty || e.clearDirty || !e._webGL[t.plugins.graphics.CONTEXT_UID]) && t.plugins.graphics.updateGraphics(e), !0) } function findGraphics(t, e) { return t instanceof Gr && (e.push(t), !0) } var en = function(t) { this.maxMilliseconds = t, this.frameStart = 0 }; en.prototype.beginFrame = function() { this.frameStart = Date.now() }, en.prototype.allowedToUpload = function() { return Date.now() - this.frameStart < this.maxMilliseconds }; var rn = function Application(e) { var r = this; e = Object.assign({ forceCanvas: !1 }, e), this.renderer = autoDetectRenderer(e), this.stage = new pt, Application._plugins.forEach(function(t) { t.init.call(r, e) }) }, nn = { view: { configurable: !0 }, screen: { configurable: !0 } }; rn.registerPlugin = function(t) { rn._plugins.push(t) }, rn.prototype.render = function() { this.renderer.render(this.stage) }, nn.view.get = function() { return this.renderer.view }, nn.screen.get = function() { return this.renderer.screen }, rn.prototype.destroy = function(t) { var e = this, r = rn._plugins.slice(0); r.reverse(), r.forEach(function(t) { t.destroy.call(e) }), this.stage.destroy(), this.stage = null, this.renderer.destroy(t), this.renderer = null, this._options = null }, Object.defineProperties(rn.prototype, nn), rn._plugins = []; var on = function() {}; on.init = function(t) { var e = this; Object.defineProperty(this, "resizeTo", { set: function(t) { window.removeEventListener("resize", this.resize), (this._resizeTo = t) && (window.addEventListener("resize", this.resize), this.resize()) }, get: function() { return this._resizeTo } }), this.resize = function() { e._resizeTo && (e._resizeTo === window ? e.renderer.resize(window.innerWidth, window.innerHeight) : e.renderer.resize(e._resizeTo.clientWidth, e._resizeTo.clientHeight)) }, this._resizeTo = null, this.resizeTo = t.resizeTo || null }, on.destroy = function() { this.resizeTo = null, this.resize = null }, rn.registerPlugin(on); var an = r(66), sn = r.n(an); function unwrapExports(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t } function createCommonjsModule(t, e) { return t(e = { exports: {} }, e.exports), e.exports } var un = function(t, e) { e = e || {}; for (var n = { key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ } }, r = n.parser[e.strictMode ? "strict" : "loose"].exec(t), i = {}, o = 14; o--;) i[n.key[o]] = r[o] || ""; return i[n.q.name] = {}, i[n.key[12]].replace(n.q.parser, function(t, e, r) { e && (i[n.q.name][e] = r) }), i }, hn = createCommonjsModule(function(t, e) { Object.defineProperty(e, "__esModule", { value: !0 }); var r = function() { function defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function(t, e, r) { return e && defineProperties(t.prototype, e), r && defineProperties(t, r), t } }(); function _classCallCheck(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") } var n = function() { function MiniSignalBinding(t, e, r) { void 0 === e && (e = !1), _classCallCheck(this, MiniSignalBinding), this._fn = t, this._once = e, this._thisArg = r, this._next = this._prev = this._owner = null } return r(MiniSignalBinding, [{ key: "detach", value: function() { return null !== this._owner && (this._owner.detach(this), !0) } }]), MiniSignalBinding }(); function _addMiniSignalBinding(t, e) { return t._head ? (t._tail._next = e)._prev = t._tail : t._head = e, (t._tail = e)._owner = t, e } var i = function() { function MiniSignal() { _classCallCheck(this, MiniSignal), this._head = this._tail = void 0 } return r(MiniSignal, [{ key: "handlers", value: function() { var t = !(arguments.length <= 0 || void 0 === arguments[0]) && arguments[0], e = this._head; if (t) return !!e; for (var r = []; e;) r.push(e), e = e._next; return r } }, { key: "has", value: function(t) { if (!(t instanceof n)) throw new Error("MiniSignal#has(): First arg must be a MiniSignalBinding object."); return t._owner === this } }, { key: "dispatch", value: function() { var t = arguments, e = this._head; if (!e) return !1; for (; e;) e._once && this.detach(e), e._fn.apply(e._thisArg, t), e = e._next; return !0 } }, { key: "add", value: function(t) { var e = arguments.length <= 1 || void 0 === arguments[1] ? null : arguments[1]; if ("function" != typeof t) throw new Error("MiniSignal#add(): First arg must be a Function."); return _addMiniSignalBinding(this, new n(t, !1, e)) } }, { key: "once", value: function(t) { var e = arguments.length <= 1 || void 0 === arguments[1] ? null : arguments[1]; if ("function" != typeof t) throw new Error("MiniSignal#once(): First arg must be a Function."); return _addMiniSignalBinding(this, new n(t, !0, e)) } }, { key: "detach", value: function(t) { if (!(t instanceof n)) throw new Error("MiniSignal#detach(): First arg must be a MiniSignalBinding object."); return t._owner !== this || (t._prev && (t._prev._next = t._next), t._next && (t._next._prev = t._prev), t === this._head ? (this._head = t._next, null === t._next && (this._tail = null)) : t === this._tail && (this._tail = t._prev, this._tail._next = null), t._owner = null), this } }, { key: "detachAll", value: function() { var t = this._head; if (!t) return this; for (this._head = this._tail = null; t;) t._owner = null, t = t._next; return this } }]), MiniSignal }(); i.MiniSignalBinding = n, e.default = i, t.exports = e.default }); unwrapExports(hn); var cn = createCommonjsModule(function(t, e) { e.__esModule = !0, e.Resource = void 0; var r = function() { function defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function(t, e, r) { return e && defineProperties(t.prototype, e), r && defineProperties(t, r), t } }(), i = _interopRequireDefault(un), n = _interopRequireDefault(hn); function _interopRequireDefault(t) { return t && t.__esModule ? t : { default: t } } var o = !(!window.XDomainRequest || "withCredentials" in new XMLHttpRequest), a = null; function _noop() {} var s = e.Resource = function() { function Resource(t, e, r) { if (function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, Resource), "string" != typeof t || "string" != typeof e) throw new Error("Both name and url are required for constructing a resource."); r = r || {}, this._flags = 0, this._setFlag(Resource.STATUS_FLAGS.DATA_URL, 0 === e.indexOf("data:")), this.name = t, this.url = e, this.extension = this._getExtension(), this.data = null, this.crossOrigin = !0 === r.crossOrigin ? "anonymous" : r.crossOrigin, this.timeout = r.timeout || 0, this.loadType = r.loadType || this._determineLoadType(), this.xhrType = r.xhrType, this.metadata = r.metadata || {}, this.error = null, this.xhr = null, this.children = [], this.type = Resource.TYPE.UNKNOWN, this.progressChunk = 0, this._dequeue = _noop, this._onLoadBinding = null, this._elementTimer = 0, this._boundComplete = this.complete.bind(this), this._boundOnError = this._onError.bind(this), this._boundOnProgress = this._onProgress.bind(this), this._boundOnTimeout = this._onTimeout.bind(this), this._boundXhrOnError = this._xhrOnError.bind(this), this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this), this._boundXhrOnAbort = this._xhrOnAbort.bind(this), this._boundXhrOnLoad = this._xhrOnLoad.bind(this), this.onStart = new n.default, this.onProgress = new n.default, this.onComplete = new n.default, this.onAfterMiddleware = new n.default } return Resource.setExtensionLoadType = function(t, e) { setExtMap(Resource._loadTypeMap, t, e) }, Resource.setExtensionXhrType = function(t, e) { setExtMap(Resource._xhrTypeMap, t, e) }, Resource.prototype.complete = function() { this._clearEvents(), this._finish() }, Resource.prototype.abort = function(t) { if (!this.error) { if (this.error = new Error(t), this._clearEvents(), this.xhr) this.xhr.abort(); else if (this.xdr) this.xdr.abort(); else if (this.data) if (this.data.src) this.data.src = Resource.EMPTY_GIF; else for (; this.data.firstChild;) this.data.removeChild(this.data.firstChild); this._finish() } }, Resource.prototype.load = function(t) { var e = this; if (!this.isLoading) if (this.isComplete) t && setTimeout(function() { return t(e) }, 1); else switch (t && this.onComplete.once(t), this._setFlag(Resource.STATUS_FLAGS.LOADING, !0), this.onStart.dispatch(this), !1 !== this.crossOrigin && "string" == typeof this.crossOrigin || (this.crossOrigin = this._determineCrossOrigin(this.url)), this.loadType) { case Resource.LOAD_TYPE.IMAGE: this.type = Resource.TYPE.IMAGE, this._loadElement("image"); break; case Resource.LOAD_TYPE.AUDIO: this.type = Resource.TYPE.AUDIO, this._loadSourceElement("audio"); break; case Resource.LOAD_TYPE.VIDEO: this.type = Resource.TYPE.VIDEO, this._loadSourceElement("video"); break; case Resource.LOAD_TYPE.XHR: default: o && this.crossOrigin ? this._loadXdr() : this._loadXhr() } }, Resource.prototype._hasFlag = function(t) { return 0 != (this._flags & t) }, Resource.prototype._setFlag = function(t, e) { this._flags = e ? this._flags | t : this._flags & ~t }, Resource.prototype._clearEvents = function() { clearTimeout(this._elementTimer), this.data && this.data.removeEventListener && (this.data.removeEventListener("error", this._boundOnError, !1), this.data.removeEventListener("load", this._boundComplete, !1), this.data.removeEventListener("progress", this._boundOnProgress, !1), this.data.removeEventListener("canplaythrough", this._boundComplete, !1)), this.xhr && (this.xhr.removeEventListener ? (this.xhr.removeEventListener("error", this._boundXhrOnError, !1), this.xhr.removeEventListener("timeout", this._boundXhrOnTimeout, !1), this.xhr.removeEventListener("abort", this._boundXhrOnAbort, !1), this.xhr.removeEventListener("progress", this._boundOnProgress, !1), this.xhr.removeEventListener("load", this._boundXhrOnLoad, !1)) : (this.xhr.onerror = null, this.xhr.ontimeout = null, this.xhr.onprogress = null, this.xhr.onload = null)) }, Resource.prototype._finish = function() { if (this.isComplete) throw new Error("Complete called again for an already completed resource."); this._setFlag(Resource.STATUS_FLAGS.COMPLETE, !0), this._setFlag(Resource.STATUS_FLAGS.LOADING, !1), this.onComplete.dispatch(this) }, Resource.prototype._loadElement = function(t) { this.metadata.loadElement ? this.data = this.metadata.loadElement : "image" === t && void 0 !== window.Image ? this.data = new Image : this.data = document.createElement(t), this.crossOrigin && (this.data.crossOrigin = this.crossOrigin), this.metadata.skipSource || (this.data.src = this.url), this.data.addEventListener("error", this._boundOnError, !1), this.data.addEventListener("load", this._boundComplete, !1), this.data.addEventListener("progress", this._boundOnProgress, !1), this.timeout && (this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout)) }, Resource.prototype._loadSourceElement = function(t) { if (this.metadata.loadElement ? this.data = this.metadata.loadElement : "audio" === t && void 0 !== window.Audio ? this.data = new Audio : this.data = document.createElement(t), null !== this.data) { if (this.crossOrigin && (this.data.crossOrigin = this.crossOrigin), !this.metadata.skipSource) if (navigator.isCocoonJS) this.data.src = Array.isArray(this.url) ? this.url[0] : this.url; else if (Array.isArray(this.url)) for (var e = this.metadata.mimeType, r = 0; r < this.url.length; ++r) this.data.appendChild(this._createSource(t, this.url[r], Array.isArray(e) ? e[r] : e)); else { var n = this.metadata.mimeType; this.data.appendChild(this._createSource(t, this.url, Array.isArray(n) ? n[0] : n)) } this.data.addEventListener("error", this._boundOnError, !1), this.data.addEventListener("load", this._boundComplete, !1), this.data.addEventListener("progress", this._boundOnProgress, !1), this.data.addEventListener("canplaythrough", this._boundComplete, !1), this.data.load(), this.timeout && (this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout)) } else this.abort("Unsupported element: " + t) }, Resource.prototype._loadXhr = function() { "string" != typeof this.xhrType && (this.xhrType = this._determineXhrType()); var t = this.xhr = new XMLHttpRequest; t.open("GET", this.url, !0), t.timeout = this.timeout, this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON || this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT ? t.responseType = Resource.XHR_RESPONSE_TYPE.TEXT : t.responseType = this.xhrType, t.addEventListener("error", this._boundXhrOnError, !1), t.addEventListener("timeout", this._boundXhrOnTimeout, !1), t.addEventListener("abort", this._boundXhrOnAbort, !1), t.addEventListener("progress", this._boundOnProgress, !1), t.addEventListener("load", this._boundXhrOnLoad, !1), t.send() }, Resource.prototype._loadXdr = function() { "string" != typeof this.xhrType && (this.xhrType = this._determineXhrType()); var t = this.xhr = new XDomainRequest; t.timeout = this.timeout || 5e3, t.onerror = this._boundXhrOnError, t.ontimeout = this._boundXhrOnTimeout, t.onprogress = this._boundOnProgress, t.onload = this._boundXhrOnLoad, t.open("GET", this.url, !0), setTimeout(function() { return t.send() }, 1) }, Resource.prototype._createSource = function(t, e, r) { r || (r = t + "/" + this._getExtension(e)); var n = document.createElement("source"); return n.src = e, n.type = r, n }, Resource.prototype._onError = function(t) { this.abort("Failed to load element using: " + t.target.nodeName) }, Resource.prototype._onProgress = function(t) { t && t.lengthComputable && this.onProgress.dispatch(this, t.loaded / t.total) }, Resource.prototype._onTimeout = function() { this.abort("Load timed out.") }, Resource.prototype._xhrOnError = function() { var t = this.xhr; this.abort(reqType(t) + " Request failed. Status: " + t.status + ', text: "' + t.statusText + '"') }, Resource.prototype._xhrOnTimeout = function() { var t = this.xhr; this.abort(reqType(t) + " Request timed out.") }, Resource.prototype._xhrOnAbort = function() { var t = this.xhr; this.abort(reqType(t) + " Request was aborted by the user.") }, Resource.prototype._xhrOnLoad = function() { var t = this.xhr, e = "", r = void 0 === t.status ? 200 : t.status; if ("" !== t.responseType && "text" !== t.responseType && void 0 !== t.responseType || (e = t.responseText), 0 === r && (0 < e.length || t.responseType === Resource.XHR_RESPONSE_TYPE.BUFFER) ? r = 200 : 1223 === r && (r = 204), 2 === (r / 100 | 0)) { if (this.xhrType === Resource.XHR_RESPONSE_TYPE.TEXT) this.data = e, this.type = Resource.TYPE.TEXT; else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.JSON) try { this.data = JSON.parse(e), this.type = Resource.TYPE.JSON } catch (t) { return void this.abort("Error trying to parse loaded json: " + t) } else if (this.xhrType === Resource.XHR_RESPONSE_TYPE.DOCUMENT) try { if (window.DOMParser) { var n = new DOMParser; this.data = n.parseFromString(e, "text/xml") } else { var i = document.createElement("div"); i.innerHTML = e, this.data = i } this.type = Resource.TYPE.XML } catch (t) { return void this.abort("Error trying to parse loaded xml: " + t) } else this.data = t.response || e; this.complete() } else this.abort("[" + t.status + "] " + t.statusText + ": " + t.responseURL) }, Resource.prototype._determineCrossOrigin = function(t, e) { if (0 === t.indexOf("data:")) return ""; if (window.origin !== window.location.origin) return "anonymous"; e = e || window.location, a || (a = document.createElement("a")), a.href = t; var r = !(t = (0, i.default)(a.href, { strictMode: !0 })).port && "" === e.port || t.port === e.port, n = t.protocol ? t.protocol + ":" : ""; return t.host === e.hostname && r && n === e.protocol ? "" : "anonymous" }, Resource.prototype._determineXhrType = function() { return Resource._xhrTypeMap[this.extension] || Resource.XHR_RESPONSE_TYPE.TEXT }, Resource.prototype._determineLoadType = function() { return Resource._loadTypeMap[this.extension] || Resource.LOAD_TYPE.XHR }, Resource.prototype._getExtension = function() { var t = this.url, e = ""; if (this.isDataUrl) { var r = t.indexOf("/"); e = t.substring(r + 1, t.indexOf(";", r)) } else { var n = t.indexOf("?"), i = t.indexOf("#"), o = Math.min(-1 < n ? n : t.length, -1 < i ? i : t.length); e = (t = t.substring(0, o)).substring(t.lastIndexOf(".") + 1) } return e.toLowerCase() }, Resource.prototype._getMimeFromXhrType = function(t) { switch (t) { case Resource.XHR_RESPONSE_TYPE.BUFFER: return "application/octet-binary"; case Resource.XHR_RESPONSE_TYPE.BLOB: return "application/blob"; case Resource.XHR_RESPONSE_TYPE.DOCUMENT: return "application/xml"; case Resource.XHR_RESPONSE_TYPE.JSON: return "application/json"; case Resource.XHR_RESPONSE_TYPE.DEFAULT: case Resource.XHR_RESPONSE_TYPE.TEXT: default: return "text/plain" } }, r(Resource, [{ key: "isDataUrl", get: function() { return this._hasFlag(Resource.STATUS_FLAGS.DATA_URL) } }, { key: "isComplete", get: function() { return this._hasFlag(Resource.STATUS_FLAGS.COMPLETE) } }, { key: "isLoading", get: function() { return this._hasFlag(Resource.STATUS_FLAGS.LOADING) } }]), Resource }(); function setExtMap(t, e, r) { e && 0 === e.indexOf(".") && (e = e.substring(1)), e && (t[e] = r) } function reqType(t) { return t.toString().replace("object ", "") } s.STATUS_FLAGS = { NONE: 0, DATA_URL: 1, COMPLETE: 2, LOADING: 4 }, s.TYPE = { UNKNOWN: 0, JSON: 1, XML: 2, IMAGE: 3, AUDIO: 4, VIDEO: 5, TEXT: 6 }, s.LOAD_TYPE = { XHR: 1, IMAGE: 2, AUDIO: 3, VIDEO: 4 }, s.XHR_RESPONSE_TYPE = { DEFAULT: "text", BUFFER: "arraybuffer", BLOB: "blob", DOCUMENT: "document", JSON: "json", TEXT: "text" }, s._loadTypeMap = { gif: s.LOAD_TYPE.IMAGE, png: s.LOAD_TYPE.IMAGE, bmp: s.LOAD_TYPE.IMAGE, jpg: s.LOAD_TYPE.IMAGE, jpeg: s.LOAD_TYPE.IMAGE, tif: s.LOAD_TYPE.IMAGE, tiff: s.LOAD_TYPE.IMAGE, webp: s.LOAD_TYPE.IMAGE, tga: s.LOAD_TYPE.IMAGE, svg: s.LOAD_TYPE.IMAGE, "svg+xml": s.LOAD_TYPE.IMAGE, mp3: s.LOAD_TYPE.AUDIO, ogg: s.LOAD_TYPE.AUDIO, wav: s.LOAD_TYPE.AUDIO, mp4: s.LOAD_TYPE.VIDEO, webm: s.LOAD_TYPE.VIDEO }, s._xhrTypeMap = { xhtml: s.XHR_RESPONSE_TYPE.DOCUMENT, html: s.XHR_RESPONSE_TYPE.DOCUMENT, htm: s.XHR_RESPONSE_TYPE.DOCUMENT, xml: s.XHR_RESPONSE_TYPE.DOCUMENT, tmx: s.XHR_RESPONSE_TYPE.DOCUMENT, svg: s.XHR_RESPONSE_TYPE.DOCUMENT, tsx: s.XHR_RESPONSE_TYPE.DOCUMENT, gif: s.XHR_RESPONSE_TYPE.BLOB, png: s.XHR_RESPONSE_TYPE.BLOB, bmp: s.XHR_RESPONSE_TYPE.BLOB, jpg: s.XHR_RESPONSE_TYPE.BLOB, jpeg: s.XHR_RESPONSE_TYPE.BLOB, tif: s.XHR_RESPONSE_TYPE.BLOB, tiff: s.XHR_RESPONSE_TYPE.BLOB, webp: s.XHR_RESPONSE_TYPE.BLOB, tga: s.XHR_RESPONSE_TYPE.BLOB, json: s.XHR_RESPONSE_TYPE.JSON, text: s.XHR_RESPONSE_TYPE.TEXT, txt: s.XHR_RESPONSE_TYPE.TEXT, ttf: s.XHR_RESPONSE_TYPE.BUFFER, otf: s.XHR_RESPONSE_TYPE.BUFFER }, s.EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", t.exports.default = s }); unwrapExports(cn); cn.Resource; var ln = createCommonjsModule(function(t, e) { e.__esModule = !0, e.encodeBinary = encodeBinary; var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; function encodeBinary(t) { for (var e = "", r = 0; r < t.length;) { for (var n = [0, 0, 0], i = [0, 0, 0, 0], o = 0; o < n.length; ++o) r < t.length ? n[o] = 255 & t.charCodeAt(r++) : n[o] = 0; switch (i[0] = n[0] >> 2, i[1] = (3 & n[0]) << 4 | n[1] >> 4, i[2] = (15 & n[1]) << 2 | n[2] >> 6, i[3] = 63 & n[2], r - (t.length - 1)) { case 2: i[3] = 64, i[2] = 64; break; case 1: i[3] = 64 } for (var a = 0; a < i.length; ++a) e += s.charAt(i[a]) } return e } t.exports.default = encodeBinary }); unwrapExports(ln); ln.encodeBinary; var fn = createCommonjsModule(function(t, e) { e.__esModule = !0, e.blobMiddlewareFactory = function() { return function(t, e) { if (t.data) { if (t.xhr && t.xhrType === cn.Resource.XHR_RESPONSE_TYPE.BLOB) if (window.Blob && "string" != typeof t.data) { if (0 === t.data.type.indexOf("image")) { var r = i.createObjectURL(t.data); return t.blob = t.data, t.data = new Image, t.data.src = r, t.type = cn.Resource.TYPE.IMAGE, void(t.data.onload = function() { i.revokeObjectURL(r), t.data.onload = null, e() }) } } else { var n = t.xhr.getResponseHeader("content-type"); if (n && 0 === n.indexOf("image")) return t.data = new Image, t.data.src = "data:" + n + ";base64," + (0, ln.encodeBinary)(t.xhr.responseText), t.type = cn.Resource.TYPE.IMAGE, void(t.data.onload = function() { t.data.onload = null, e() }) } e() } else e() } }; var i = window.URL || window.webkitURL }); unwrapExports(fn); var dn = fn.blobMiddlewareFactory, pn = function() {}; pn.use = function(t, e) { t.data && t.type === an.Resource.TYPE.IMAGE && (t.texture = Ht.fromLoader(t.data, t.url, t.name)), e() }; var mn = function(s) { function Loader(t, e) { var n = this; s.call(this, t, e), l.a.call(this); for (var r = 0; r < Loader._plugins.length; ++r) { var i = Loader._plugins[r], o = i.pre, a = i.use; o && this.pre(o), a && this.use(a) } this.onStart.add(function(t) { return n.emit("start", t) }), this.onProgress.add(function(t, e) { return n.emit("progress", t, e) }), this.onError.add(function(t, e, r) { return n.emit("error", t, e, r) }), this.onLoad.add(function(t, e) { return n.emit("load", t, e) }), this.onComplete.add(function(t, e) { return n.emit("complete", t, e) }), this._protected = !1 } s && (Loader.__proto__ = s); var t = { shared: { configurable: !0 } }; return ((Loader.prototype = Object.create(s && s.prototype)).constructor = Loader).prototype.destroy = function() { this._protected || (this.removeAllListeners(), this.reset()) }, t.shared.get = function() { var t = Loader._shared; return t || ((t = new Loader)._protected = !0, Loader._shared = t), t }, Object.defineProperties(Loader, t), Loader }(sn.a); Object.assign(mn.prototype, l.a.prototype), mn._plugins = [], mn.registerPlugin = function(t) { return mn._plugins.push(t), t.add && t.add(), mn }, mn.registerPlugin({ use: dn() }), mn.registerPlugin(pn); var vn = function() {}; vn.init = function(t) { t = Object.assign({ sharedLoader: !1 }, t), this.loader = t.sharedLoader ? mn.shared : new mn }, vn.destroy = function() { this.loader && (this.loader.destroy(), this.loader = null) }; var gn = an.Resource, yn = function(i) { function ParticleContainer(t, e, r, n) { void 0 === t && (t = 1500), void 0 === r && (r = 16384), void 0 === n && (n = !1), i.call(this); 16384 < r && (r = 16384), t < r && (r = t), this._properties = [!1, !0, !1, !1, !1], this._maxSize = t, this._batchSize = r, this._buffers = null, this._bufferUpdateIDs = [], this._updateID = 0, this.interactiveChildren = !1, this.blendMode = y.NORMAL, this.autoResize = n, this.roundPixels = !0, this.baseTexture = null, this.setProperties(e), this._tint = 0, this.tintRgb = new Float32Array(4), this.tint = 16777215 } i && (ParticleContainer.__proto__ = i); var t = { tint: { configurable: !0 } }; return ((ParticleContainer.prototype = Object.create(i && i.prototype)).constructor = ParticleContainer).prototype.setProperties = function(t) { t && (this._properties[0] = "vertices" in t || "scale" in t ? !!t.vertices || !!t.scale : this._properties[0], this._properties[1] = "position" in t ? !!t.position : this._properties[1], this._properties[2] = "rotation" in t ? !!t.rotation : this._properties[2], this._properties[3] = "uvs" in t ? !!t.uvs : this._properties[3], this._properties[4] = "tint" in t || "alpha" in t ? !!t.tint || !!t.alpha : this._properties[4]) }, ParticleContainer.prototype.updateTransform = function() { this.displayObjectUpdateTransform() }, t.tint.get = function() { return this._tint }, t.tint.set = function(t) { hex2rgb(this._tint = t, this.tintRgb) }, ParticleContainer.prototype.render = function(t) { var e = this; this.visible && !(this.worldAlpha <= 0) && this.children.length && this.renderable && (this.baseTexture || (this.baseTexture = this.children[0]._texture.baseTexture, this.baseTexture.valid || this.baseTexture.once("update", function() { return e.onChildrenChange(0) })), t.batch.setObjectRenderer(t.plugins.particle), t.plugins.particle.render(this)) }, ParticleContainer.prototype.onChildrenChange = function(t) { for (var e = Math.floor(t / this._batchSize); this._bufferUpdateIDs.length < e;) this._bufferUpdateIDs.push(0); this._bufferUpdateIDs[e] = ++this._updateID }, ParticleContainer.prototype.dispose = function() { if (this._buffers) { for (var t = 0; t < this._buffers.length; ++t) this._buffers[t].destroy(); this._buffers = null } }, ParticleContainer.prototype.destroy = function(t) { i.prototype.destroy.call(this, t), this.dispose(), this._properties = null, this._buffers = null, this._bufferUpdateIDs = null }, Object.defineProperties(ParticleContainer.prototype, t), ParticleContainer }(pt), _n = function(t, e, r) { this.geometry = new ee, this.indexBuffer = null, this.size = r, this.dynamicProperties = [], this.staticProperties = []; for (var n = 0; n < t.length; ++n) { var i = t[n]; i = { attributeName: i.attributeName, size: i.size, uploadFunction: i.uploadFunction, type: i.type || w.FLOAT, offset: i.offset }, e[n] ? this.dynamicProperties.push(i) : this.staticProperties.push(i) } this.staticStride = 0, this.staticBuffer = null, this.staticData = null, this.staticDataUint32 = null, this.dynamicStride = 0, this.dynamicBuffer = null, this.dynamicData = null, this.dynamicDataUint32 = null, this._updateID = 0, this.initBuffers() }; _n.prototype.initBuffers = function() { var t = this.geometry, e = 0; this.indexBuffer = new Zt(createIndicesForQuads(this.size), !0, !0), t.addIndex(this.indexBuffer); for (var r = this.dynamicStride = 0; r < this.dynamicProperties.length; ++r) { var n = this.dynamicProperties[r]; n.offset = e, e += n.size, this.dynamicStride += n.size } var i = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4); this.dynamicData = new Float32Array(i), this.dynamicDataUint32 = new Uint32Array(i), this.dynamicBuffer = new Zt(this.dynamicData, !1, !1); for (var o = 0, a = this.staticStride = 0; a < this.staticProperties.length; ++a) { var s = this.staticProperties[a]; s.offset = o, o += s.size, this.staticStride += s.size } var u = new ArrayBuffer(this.size * this.staticStride * 4 * 4); this.staticData = new Float32Array(u), this.staticDataUint32 = new Uint32Array(u), this.staticBuffer = new Zt(this.staticData, !0, !1); for (var h = 0; h < this.dynamicProperties.length; ++h) { var c = this.dynamicProperties[h]; t.addAttribute(c.attributeName, this.dynamicBuffer, 0, c.type === w.UNSIGNED_BYTE, c.type, 4 * this.dynamicStride, 4 * c.offset) } for (var l = 0; l < this.staticProperties.length; ++l) { var f = this.staticProperties[l]; t.addAttribute(f.attributeName, this.staticBuffer, 0, f.type === w.UNSIGNED_BYTE, f.type, 4 * this.staticStride, 4 * f.offset) } }, _n.prototype.uploadDynamic = function(t, e, r) { for (var n = 0; n < this.dynamicProperties.length; n++) { var i = this.dynamicProperties[n]; i.uploadFunction(t, e, r, i.type === w.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData, this.dynamicStride, i.offset) } this.dynamicBuffer._updateID++ }, _n.prototype.uploadStatic = function(t, e, r) { for (var n = 0; n < this.staticProperties.length; n++) { var i = this.staticProperties[n]; i.uploadFunction(t, e, r, i.type === w.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData, this.staticStride, i.offset) } this.staticBuffer._updateID++ }, _n.prototype.destroy = function() { this.indexBuffer = null, this.dynamicProperties = null, this.dynamicBuffer = null, this.dynamicData = null, this.dynamicDataUint32 = null, this.staticProperties = null, this.staticBuffer = null, this.staticData = null, this.staticDataUint32 = null, this.geometry.destroy() }; var bn = function(e) { function ParticleRenderer(t) { e.call(this, t), this.shader = null, this.properties = null, this.tempMatrix = new Y, this.properties = [{ attributeName: "aVertexPosition", size: 2, uploadFunction: this.uploadVertices, offset: 0 }, { attributeName: "aPositionCoord", size: 2, uploadFunction: this.uploadPosition, offset: 0 }, { attributeName: "aRotation", size: 1, uploadFunction: this.uploadRotation, offset: 0 }, { attributeName: "aTextureCoord", size: 2, uploadFunction: this.uploadUvs, offset: 0 }, { attributeName: "aColor", size: 1, type: w.UNSIGNED_BYTE, uploadFunction: this.uploadTint, offset: 0 }], this.shader = Ie.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nattribute vec2 aPositionCoord;\nattribute float aRotation;\n\nuniform mat3 translationMatrix;\nuniform vec4 uColor;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nvoid main(void){\n float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);\n float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);\n\n vec2 v = vec2(x, y);\n v = v + aPositionCoord;\n\n gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = aTextureCoord;\n vColor = aColor * uColor;\n}\n", "varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void){\n vec4 color = texture2D(uSampler, vTextureCoord) * vColor;\n gl_FragColor = color;\n}", {}) } return e && (ParticleRenderer.__proto__ = e), ((ParticleRenderer.prototype = Object.create(e && e.prototype)).constructor = ParticleRenderer).prototype.render = function(t) { var e = t.children, r = t._maxSize, n = t._batchSize, i = this.renderer, o = e.length; if (0 !== o) { r < o && (o = r); var a = t._buffers; a || (a = t._buffers = this.generateBuffers(t)); var s = e[0]._texture.baseTexture; this.renderer.state.setBlendMode(correctBlendMode(t.blendMode, s.premultiplyAlpha)); var u = i.gl, h = t.worldTransform.copyTo(this.tempMatrix); h.prepend(i.globalUniforms.uniforms.projectionMatrix), this.shader.uniforms.translationMatrix = h.toArray(!0), this.shader.uniforms.uColor = premultiplyRgba(t.tintRgb, t.worldAlpha, this.shader.uniforms.uColor, s.premultiplyAlpha), this.shader.uniforms.uSampler = s, this.renderer.shader.bind(this.shader); for (var c = !1, l = 0, f = 0; l < o; l += n, f += 1) { var d = o - l; if (n < d && (d = n), f >= a.length) { if (!t.autoResize) break; a.push(this._generateOneMoreBuffer(t)) } var p = a[f]; p.uploadDynamic(e, l, d); var m = t._bufferUpdateIDs[f] || 0; (c = c || p._updateID < m) && (p._updateID = t._updateID, p.uploadStatic(e, l, d)), i.geometry.bind(p.geometry), u.drawElements(u.TRIANGLES, 6 * d, u.UNSIGNED_SHORT, 0) } } }, ParticleRenderer.prototype.generateBuffers = function(t) { for (var e = [], r = t._maxSize, n = t._batchSize, i = t._properties, o = 0; o < r; o += n) e.push(new _n(this.properties, i, n)); return e }, ParticleRenderer.prototype._generateOneMoreBuffer = function(t) { var e = t._batchSize, r = t._properties; return new _n(this.properties, r, e) }, ParticleRenderer.prototype.uploadVertices = function(t, e, r, n, i, o) { for (var a = 0, s = 0, u = 0, h = 0, c = 0; c < r; ++c) { var l = t[e + c], f = l._texture, d = l.scale.x, p = l.scale.y, m = f.trim, v = f.orig; m ? (a = (s = m.x - l.anchor.x * v.width) + m.width, u = (h = m.y - l.anchor.y * v.height) + m.height) : (a = v.width * (1 - l.anchor.x), s = v.width * -l.anchor.x, u = v.height * (1 - l.anchor.y), h = v.height * -l.anchor.y), n[o] = s * d, n[o + 1] = h * p, n[o + i] = a * d, n[o + i + 1] = h * p, n[o + 2 * i] = a * d, n[o + 2 * i + 1] = u * p, n[o + 3 * i] = s * d, n[o + 3 * i + 1] = u * p, o += 4 * i } }, ParticleRenderer.prototype.uploadPosition = function(t, e, r, n, i, o) { for (var a = 0; a < r; a++) { var s = t[e + a].position; n[o] = s.x, n[o + 1] = s.y, n[o + i] = s.x, n[o + i + 1] = s.y, n[o + 2 * i] = s.x, n[o + 2 * i + 1] = s.y, n[o + 3 * i] = s.x, n[o + 3 * i + 1] = s.y, o += 4 * i } }, ParticleRenderer.prototype.uploadRotation = function(t, e, r, n, i, o) { for (var a = 0; a < r; a++) { var s = t[e + a].rotation; n[o] = s, n[o + i] = s, n[o + 2 * i] = s, n[o + 3 * i] = s, o += 4 * i } }, ParticleRenderer.prototype.uploadUvs = function(t, e, r, n, i, o) { for (var a = 0; a < r; ++a) { var s = t[e + a]._texture._uvs; n[o + 3 * i + 1] = s ? (n[o] = s.x0, n[o + 1] = s.y0, n[o + i] = s.x1, n[o + i + 1] = s.y1, n[o + 2 * i] = s.x2, n[o + 2 * i + 1] = s.y2, n[o + 3 * i] = s.x3, s.y3) : (n[o] = 0, n[o + 1] = 0, n[o + i] = 0, n[o + i + 1] = 0, n[o + 2 * i] = 0, n[o + 2 * i + 1] = 0, n[o + 3 * i] = 0), o += 4 * i } }, ParticleRenderer.prototype.uploadTint = function(t, e, r, n, i, o) { for (var a = 0; a < r; ++a) { var s = t[e + a], u = s._texture.baseTexture.premultiplyAlpha, h = s.alpha, c = h < 1 && u ? premultiplyTint(s._tintRGB, h) : s._tintRGB + (255 * h << 24); n[o] = c, n[o + i] = c, n[o + 2 * i] = c, n[o + 3 * i] = c, o += 4 * i } }, ParticleRenderer.prototype.destroy = function() { e.prototype.destroy.call(this), this.shader && (this.shader.destroy(), this.shader = null), this.tempMatrix = null }, ParticleRenderer }(he), xn = function(t, e, r) { void 0 === r && (r = null), this.baseTexture = t, this.textures = {}, this.animations = {}, this.data = e, this.resolution = this._updateResolution(r || (this.baseTexture.resource ? this.baseTexture.resource.url : null)), this._frames = this.data.frames, this._frameKeys = Object.keys(this._frames), this._batchIndex = 0, this._callback = null }, wn = { BATCH_SIZE: { configurable: !0 } }; wn.BATCH_SIZE.get = function() { return 1e3 }, xn.prototype._updateResolution = function(t) { var e = this.data.meta.scale, r = getResolutionOfUrl(t, null); return null === r && (r = void 0 !== e ? parseFloat(e) : 1), 1 !== r && this.baseTexture.setResolution(r), r }, xn.prototype.parse = function(t) { this._batchIndex = 0, this._callback = t, this._frameKeys.length <= xn.BATCH_SIZE ? (this._processFrames(0), this._processAnimations(), this._parseComplete()) : this._nextBatch() }, xn.prototype._processFrames = function(t) { for (var e = t, r = xn.BATCH_SIZE; e - t < r && e < this._frameKeys.length;) { var n = this._frameKeys[e], i = this._frames[n], o = i.frame; if (o) { var a = null, s = null, u = !1 !== i.trimmed && i.sourceSize ? i.sourceSize : i.frame, h = new ot(0, 0, Math.floor(u.w) / this.resolution, Math.floor(u.h) / this.resolution); a = i.rotated ? new ot(Math.floor(o.x) / this.resolution, Math.floor(o.y) / this.resolution, Math.floor(o.h) / this.resolution, Math.floor(o.w) / this.resolution) : new ot(Math.floor(o.x) / this.resolution, Math.floor(o.y) / this.resolution, Math.floor(o.w) / this.resolution, Math.floor(o.h) / this.resolution), !1 !== i.trimmed && i.spriteSourceSize && (s = new ot(Math.floor(i.spriteSourceSize.x) / this.resolution, Math.floor(i.spriteSourceSize.y) / this.resolution, Math.floor(o.w) / this.resolution, Math.floor(o.h) / this.resolution)), this.textures[n] = new Ht(this.baseTexture, a, h, s, i.rotated ? 2 : 0, i.anchor), Ht.addToCache(this.textures[n], n) } e++ } }, xn.prototype._processAnimations = function() { var t = this.data.animations || {}; for (var e in t) { this.animations[e] = []; for (var r = 0; r < t[e].length; r++) { var n = t[e][r]; this.animations[e].push(this.textures[n]) } } }, xn.prototype._parseComplete = function() { var t = this._callback; this._callback = null, this._batchIndex = 0, t.call(this, this.textures) }, xn.prototype._nextBatch = function() { var t = this; this._processFrames(this._batchIndex * xn.BATCH_SIZE), this._batchIndex++, setTimeout(function() { t._batchIndex * xn.BATCH_SIZE < t._frameKeys.length ? t._nextBatch() : (t._processAnimations(), t._parseComplete()) }, 0) }, xn.prototype.destroy = function(t) { for (var e in void 0 === t && (t = !1), this.textures) this.textures[e].destroy(); this._frames = null, this._frameKeys = null, this.data = null, this.textures = null, t && this.baseTexture.destroy(), this.baseTexture = null }, Object.defineProperties(xn, wn); var Tn = function() {}; Tn.use = function(r, n) { var t = r.name + "_image"; if (r.data && r.type === gn.TYPE.JSON && r.data.frames && !this.resources[t]) { var e = { crossOrigin: r.crossOrigin, metadata: r.metadata.imageMetadata, parentResource: r }, i = Tn.getResourcePath(r, this.baseUrl); this.add(t, i, e, function(t) { if (t.error) n(t.error); else { var e = new xn(t.texture.baseTexture, r.data, r.url); e.parse(function() { r.spritesheet = e, r.textures = e.textures, n() }) } }) } else n() }, Tn.getResourcePath = function(t, e) { return t.isDataUrl ? t.data.meta.image : m.a.resolve(t.url.replace(e, ""), t.data.meta.image) }; var Sn = new q, Mn = function(n) { function TilingSprite(t, e, r) { void 0 === e && (e = 100), void 0 === r && (r = 100), n.call(this, t), this.tileTransform = new nt, this._width = e, this._height = r, this._canvasPattern = null, this.uvMatrix = t.uvMatrix || new ke(t), this.pluginName = "tilingSprite", this.uvRespectAnchor = !1 } n && (TilingSprite.__proto__ = n), (TilingSprite.prototype = Object.create(n && n.prototype)).constructor = TilingSprite; var t = { clampMargin: { configurable: !0 }, tileScale: { configurable: !0 }, tilePosition: { configurable: !0 }, width: { configurable: !0 }, height: { configurable: !0 } }; return t.clampMargin.get = function() { return this.uvMatrix.clampMargin }, t.clampMargin.set = function(t) { this.uvMatrix.clampMargin = t, this.uvMatrix.update(!0) }, t.tileScale.get = function() { return this.tileTransform.scale }, t.tileScale.set = function(t) { this.tileTransform.scale.copyFrom(t) }, t.tilePosition.get = function() { return this.tileTransform.position }, t.tilePosition.set = function(t) { this.tileTransform.position.copyFrom(t) }, TilingSprite.prototype._onTextureUpdate = function() { this.uvMatrix && (this.uvMatrix.texture = this._texture), this.cachedTint = 16777215 }, TilingSprite.prototype._render = function(t) { var e = this._texture; e && e.valid && (this.tileTransform.updateLocalTransform(), this.uvMatrix.update(), t.batch.setObjectRenderer(t.plugins[this.pluginName]), t.plugins[this.pluginName].render(this)) }, TilingSprite.prototype._calculateBounds = function() { var t = this._width * -this._anchor._x, e = this._height * -this._anchor._y, r = this._width * (1 - this._anchor._x), n = this._height * (1 - this._anchor._y); this._bounds.addFrame(this.transform, t, e, r, n) }, TilingSprite.prototype.getLocalBounds = function(t) { return 0 === this.children.length ? (this._bounds.minX = this._width * -this._anchor._x, this._bounds.minY = this._height * -this._anchor._y, this._bounds.maxX = this._width * (1 - this._anchor._x), this._bounds.maxY = this._height * (1 - this._anchor._y), t || (this._localBoundsRect || (this._localBoundsRect = new ot), t = this._localBoundsRect), this._bounds.getRectangle(t)) : n.prototype.getLocalBounds.call(this, t) }, TilingSprite.prototype.containsPoint = function(t) { this.worldTransform.applyInverse(t, Sn); var e = this._width, r = this._height, n = -e * this.anchor._x; if (Sn.x >= n && Sn.x < n + e) { var i = -r * this.anchor._y; if (Sn.y >= i && Sn.y < i + r) return !0 } return !1 }, TilingSprite.prototype.destroy = function(t) { n.prototype.destroy.call(this, t), this.tileTransform = null, this.uvMatrix = null }, TilingSprite.from = function(t, e, r) { return new TilingSprite(Ht.from(t), e, r) }, TilingSprite.fromFrame = function(t, e, r) { var n = F[t]; if (!n) throw new Error('The frameId "' + t + '" does not exist in the texture cache ' + this); return new TilingSprite(n, e, r) }, TilingSprite.fromImage = function(t, e, r, n) { return n && "object" != typeof n && (n = { scaleMode: arguments[4], resourceOptions: { crossorigin: arguments[3] } }), new TilingSprite(Ht.from(t, n), e, r) }, t.width.get = function() { return this._width }, t.width.set = function(t) { this._width = t }, t.height.get = function() { return this._height }, t.height.set = function(t) { this._height = t }, Object.defineProperties(TilingSprite.prototype, t), TilingSprite }(Xr), En = "attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n", An = new Y, Pn = function(r) { function TilingSpriteRenderer(t) { r.call(this, t); var e = { globals: this.renderer.globalUniforms }; this.shader = Ie.from(En, "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 sample = texture2D(uSampler, coord);\n gl_FragColor = sample * uColor;\n}\n", e), this.simpleShader = Ie.from(En, "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\n\nvoid main(void)\n{\n vec4 sample = texture2D(uSampler, vTextureCoord);\n gl_FragColor = sample * uColor;\n}\n", e), this.quad = new ne } return r && (TilingSpriteRenderer.__proto__ = r), ((TilingSpriteRenderer.prototype = Object.create(r && r.prototype)).constructor = TilingSpriteRenderer).prototype.render = function(t) { var e = this.renderer, r = this.quad, n = r.vertices; n[0] = n[6] = t._width * -t.anchor.x, n[1] = n[3] = t._height * -t.anchor.y, n[2] = n[4] = t._width * (1 - t.anchor.x), n[5] = n[7] = t._height * (1 - t.anchor.y), t.uvRespectAnchor && ((n = r.uvs)[0] = n[6] = -t.anchor.x, n[1] = n[3] = -t.anchor.y, n[2] = n[4] = 1 - t.anchor.x, n[5] = n[7] = 1 - t.anchor.y), r.invalidate(); var i = t._texture, o = i.baseTexture, a = t.tileTransform.localTransform, s = t.uvMatrix, u = o.isPowerOfTwo && i.frame.width === o.width && i.frame.height === o.height; u && (o._glTextures[e.CONTEXT_UID] ? u = o.wrapMode !== S.CLAMP : o.wrapMode === S.CLAMP && (o.wrapMode = S.REPEAT)); var h = u ? this.simpleShader : this.shader, c = i.width, l = i.height, f = t._width, d = t._height; An.set(a.a * c / f, a.b * c / d, a.c * l / f, a.d * l / d, a.tx / f, a.ty / d), An.invert(), u ? An.prepend(s.mapCoord) : (h.uniforms.uMapCoord = s.mapCoord.toArray(!0), h.uniforms.uClampFrame = s.uClampFrame, h.uniforms.uClampOffset = s.uClampOffset), h.uniforms.uTransform = An.toArray(!0), h.uniforms.uColor = premultiplyTintToRgba(t.tint, t.worldAlpha, h.uniforms.uColor, o.premultiplyAlpha), h.uniforms.translationMatrix = t.transform.worldTransform.toArray(!0), h.uniforms.uSampler = i, e.shader.bind(h), e.geometry.bind(r), e.state.setBlendMode(correctBlendMode(t.blendMode, o.premultiplyAlpha)), e.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0) }, TilingSpriteRenderer }(he), In = function(n) { function BitmapText(t, e) { var r = this; void 0 === e && (e = {}), n.call(this), this._textWidth = 0, this._textHeight = 0, this._glyphs = [], this._font = { tint: void 0 !== e.tint ? e.tint : 16777215, align: e.align || "left", name: null, size: 0 }, this.font = e.font, this._text = t, this._maxWidth = 0, this._maxLineHeight = 0, this._letterSpacing = 0, this._anchor = new j(function() { r.dirty = !0 }, this, 0, 0), this.dirty = !1, this.roundPixels = M.ROUND_PIXELS, this.updateText() } n && (BitmapText.__proto__ = n); var t = { tint: { configurable: !0 }, align: { configurable: !0 }, anchor: { configurable: !0 }, font: { configurable: !0 }, text: { configurable: !0 }, maxWidth: { configurable: !0 }, maxLineHeight: { configurable: !0 }, textWidth: { configurable: !0 }, letterSpacing: { configurable: !0 }, textHeight: { configurable: !0 } }; return ((BitmapText.prototype = Object.create(n && n.prototype)).constructor = BitmapText).prototype.updateText = function() { for (var t = BitmapText.fonts[this._font.name], e = this._font.size / t.size, r = new q, n = [], i = [], o = this._text.replace(/(?:\r\n|\r)/g, "\n") || " ", a = o.length, s = this._maxWidth * t.size / this._font.size, u = null, h = 0, c = 0, l = 0, f = -1, d = 0, p = 0, m = 0, v = 0; v < a; v++) { var g = o.charCodeAt(v), y = o.charAt(v); if (/(?:\s)/.test(y) && (f = v, d = h), "\r" !== y && "\n" !== y) { var _ = t.chars[g]; _ && (u && _.kerning[u] && (r.x += _.kerning[u]), n.push({ texture: _.texture, line: l, charCode: g, position: new q(r.x + _.xOffset + this._letterSpacing / 2, r.y + _.yOffset) }), r.x += _.xAdvance + this._letterSpacing, h = r.x, m = Math.max(m, _.yOffset + _.texture.height), u = g, -1 !== f && 0 < s && r.x > s && (removeItems(n, 1 + f - ++p, 1 + v - f), v = f, f = -1, i.push(d), c = Math.max(c, d), l++, r.x = 0, r.y += t.lineHeight, u = null)) } else i.push(h), c = Math.max(c, h), ++l, ++p, r.x = 0, r.y += t.lineHeight, u = null } var b = o.charAt(o.length - 1); "\r" !== b && "\n" !== b && (/(?:\s)/.test(b) && (h = d), i.push(h), c = Math.max(c, h)); for (var x = [], w = 0; w <= l; w++) { var T = 0; "right" === this._font.align ? T = c - i[w] : "center" === this._font.align && (T = (c - i[w]) / 2), x.push(T) } for (var S = n.length, M = this.tint, E = 0; E < S; E++) { var A = this._glyphs[E]; A ? A.texture = n[E].texture : ((A = new Xr(n[E].texture)).roundPixels = this.roundPixels, this._glyphs.push(A)), A.position.x = (n[E].position.x + x[n[E].line]) * e, A.position.y = n[E].position.y * e, A.scale.x = A.scale.y = e, A.tint = M, A.parent || this.addChild(A) } for (var P = S; P < this._glyphs.length; ++P) this.removeChild(this._glyphs[P]); if (this._textWidth = c * e, this._textHeight = (r.y + t.lineHeight) * e, 0 !== this.anchor.x || 0 !== this.anchor.y) for (var I = 0; I < S; I++) this._glyphs[I].x -= this._textWidth * this.anchor.x, this._glyphs[I].y -= this._textHeight * this.anchor.y; this._maxLineHeight = m * e }, BitmapText.prototype.updateTransform = function() { this.validate(), this.containerUpdateTransform() }, BitmapText.prototype.getLocalBounds = function() { return this.validate(), n.prototype.getLocalBounds.call(this) }, BitmapText.prototype.validate = function() { this.dirty && (this.updateText(), this.dirty = !1) }, t.tint.get = function() { return this._font.tint }, t.tint.set = function(t) { this._font.tint = "number" == typeof t && 0 <= t ? t : 16777215, this.dirty = !0 }, t.align.get = function() { return this._font.align }, t.align.set = function(t) { this._font.align = t || "left", this.dirty = !0 }, t.anchor.get = function() { return this._anchor }, t.anchor.set = function(t) { "number" == typeof t ? this._anchor.set(t) : this._anchor.copyFrom(t) }, t.font.get = function() { return this._font }, t.font.set = function(t) { t && (this._font.size = "string" == typeof t ? (t = t.split(" "), this._font.name = 1 === t.length ? t[0] : t.slice(1).join(" "), 2 <= t.length ? parseInt(t[0], 10) : BitmapText.fonts[this._font.name].size) : (this._font.name = t.name, "number" == typeof t.size ? t.size : parseInt(t.size, 10)), this.dirty = !0) }, t.text.get = function() { return this._text }, t.text.set = function(t) { t = String(null == t ? "" : t), this._text !== t && (this._text = t, this.dirty = !0) }, t.maxWidth.get = function() { return this._maxWidth }, t.maxWidth.set = function(t) { this._maxWidth !== t && (this._maxWidth = t, this.dirty = !0) }, t.maxLineHeight.get = function() { return this.validate(), this._maxLineHeight }, t.textWidth.get = function() { return this.validate(), this._textWidth }, t.letterSpacing.get = function() { return this._letterSpacing }, t.letterSpacing.set = function(t) { this._letterSpacing !== t && (this._letterSpacing = t, this.dirty = !0) }, t.textHeight.get = function() { return this.validate(), this._textHeight }, BitmapText.registerFont = function(t, e) { var r = {}, n = t.getElementsByTagName("info")[0], i = t.getElementsByTagName("common")[0], o = t.getElementsByTagName("page"), a = getResolutionOfUrl(o[0].getAttribute("file"), M.RESOLUTION), s = {}; r.font = n.getAttribute("face"), r.size = parseInt(n.getAttribute("size"), 10), r.lineHeight = parseInt(i.getAttribute("lineHeight"), 10) / a, r.chars = {}, e instanceof Ht && (e = [e]); for (var u = 0; u < o.length; u++) { var h = o[u].getAttribute("id"), c = o[u].getAttribute("file"); s[h] = e instanceof Array ? e[u] : e[c] } for (var l = t.getElementsByTagName("char"), f = 0; f < l.length; f++) { var d = l[f], p = parseInt(d.getAttribute("id"), 10), m = d.getAttribute("page") || 0, v = new ot(parseInt(d.getAttribute("x"), 10) / a + s[m].frame.x / a, parseInt(d.getAttribute("y"), 10) / a + s[m].frame.y / a, parseInt(d.getAttribute("width"), 10) / a, parseInt(d.getAttribute("height"), 10) / a); r.chars[p] = { xOffset: parseInt(d.getAttribute("xoffset"), 10) / a, yOffset: parseInt(d.getAttribute("yoffset"), 10) / a, xAdvance: parseInt(d.getAttribute("xadvance"), 10) / a, kerning: {}, texture: new Ht(s[m].baseTexture, v), page: m } } for (var g = t.getElementsByTagName("kerning"), y = 0; y < g.length; y++) { var _ = g[y], b = parseInt(_.getAttribute("first"), 10) / a, x = parseInt(_.getAttribute("second"), 10) / a, w = parseInt(_.getAttribute("amount"), 10) / a; r.chars[x] && (r.chars[x].kerning[b] = w) } return BitmapText.fonts[r.font] = r }, Object.defineProperties(BitmapText.prototype, t), BitmapText }(pt); In.fonts = {}; var On = function() {}; On.parse = function(t, e) { t.bitmapFont = In.registerFont(t.data, e) }, On.add = function() { gn.setExtensionXhrType("fnt", gn.XHR_RESPONSE_TYPE.DOCUMENT) }, On.dirname = function(t) { var e = t.replace(/\/$/, "").replace(/\/[^\/]*$/, ""); return e === t ? "." : "" === e ? "/" : e }, On.use = function(e, r) { if (e.data && e.type === gn.TYPE.XML) if (0 !== e.data.getElementsByTagName("page").length && 0 !== e.data.getElementsByTagName("info").length && null !== e.data.getElementsByTagName("info")[0].getAttribute("face")) { var t = e.isDataUrl ? "" : On.dirname(e.url); e.isDataUrl && ("." === t && (t = ""), this.baseUrl && t && "/" === this.baseUrl.charAt(this.baseUrl.length - 1) && (t += "/")), (t = t.replace(this.baseUrl, "")) && "/" !== t.charAt(t.length - 1) && (t += "/"); for (var n = e.data.getElementsByTagName("page"), i = {}, o = function(t) { i[t.metadata.pageFile] = t.texture, Object.keys(i).length === n.length && (On.parse(e, i), r()) }, a = 0; a < n.length; ++a) { var s = n[a].getAttribute("file"), u = t + s, h = !1; for (var c in this.resources) { var l = this.resources[c]; if (l.url === u) { l.metadata.pageFile = s, l.texture ? o(l) : l.onAfterMiddleware.add(o), h = !0; break } } if (!h) { var f = { crossOrigin: e.crossOrigin, loadType: gn.LOAD_TYPE.IMAGE, metadata: Object.assign({ pageFile: s }, e.metadata.imageMetadata), parentResource: e }; this.add(u, f, o) } } } else r(); else r() }; var Cn = function(e) { function AlphaFilter(t) { void 0 === t && (t = 1), e.call(this, tr, "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n", { uAlpha: 1 }), this.alpha = t } e && (AlphaFilter.__proto__ = e), (AlphaFilter.prototype = Object.create(e && e.prototype)).constructor = AlphaFilter; var t = { alpha: { configurable: !0 } }; return t.alpha.get = function() { return this.uniforms.uAlpha }, t.alpha.set = function(t) { this.uniforms.uAlpha = t }, Object.defineProperties(AlphaFilter.prototype, t), AlphaFilter }(De), Rn = "\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n \n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n \n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n \n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }"; var Dn = { 5: [.153388, .221461, .250301], 7: [.071303, .131514, .189879, .214607], 9: [.028532, .067234, .124009, .179044, .20236], 11: [.0093, .028002, .065984, .121703, .175713, .198596], 13: [.002406, .009255, .027867, .065666, .121117, .174868, .197641], 15: [489e-6, .002403, .009246, .02784, .065602, .120999, .174697, .197448] }, Fn = ["varying vec2 vBlurTexCoords[%size%];", "uniform sampler2D uSampler;", "void main(void)", "{", " gl_FragColor = vec4(0.0);", " %blur%", "}"].join("\n"); var kn = function(s) { function BlurFilterPass(t, e, r, n, i) { var o = function(t, e) { var r, n = Math.ceil(t / 2), i = Rn, o = ""; r = e ? "vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);" : "vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);"; for (var a = 0; a < t; a++) { var s = r.replace("%index%", a); o += s = s.replace("%sampleIndex%", a - (n - 1) + ".0"), o += "\n" } return i = (i = i.replace("%blur%", o)).replace("%size%", t) }(i = i || 5, t), a = function(t) { for (var e, r = Dn[t], n = r.length, i = Fn, o = "", a = 0; a < t; a++) { var s = "gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%", a); n <= (e = a) && (e = t - a - 1), o += s = s.replace("%value%", r[e]), o += "\n" } return i = (i = i.replace("%blur%", o)).replace("%size%", t) }(i); s.call(this, o, a), this.horizontal = t, this.resolution = n || M.RESOLUTION, this._quality = 0, this.quality = r || 4, this.blur = e || 8 } s && (BlurFilterPass.__proto__ = s); var t = { blur: { configurable: !0 }, quality: { configurable: !0 } }; return ((BlurFilterPass.prototype = Object.create(s && s.prototype)).constructor = BlurFilterPass).prototype.apply = function(t, e, r, n) { if (r ? this.horizontal ? this.uniforms.strength = 1 / r.width * (r.width / e.width) : this.uniforms.strength = 1 / r.height * (r.height / e.height) : this.horizontal ? this.uniforms.strength = 1 / t.renderer.width * (t.renderer.width / e.width) : this.uniforms.strength = 1 / t.renderer.height * (t.renderer.height / e.height), this.uniforms.strength *= this.strength, this.uniforms.strength /= this.passes, 1 === this.passes) t.applyFilter(this, e, r, n); else { var i = t.getFilterTexture(), o = t.renderer, a = e, s = i; this.state.blend = !1, t.applyFilter(this, a, s, !1); for (var u = 1; u < this.passes - 1; u++) { o.renderTexture.bind(a, a.filterFrame); var h = this.uniforms.uSampler = s; s = a, a = h, o.shader.bind(this), o.geometry.draw(5) } this.state.blend = !0, t.applyFilter(this, s, r, n), t.returnFilterTexture(i) } }, t.blur.get = function() { return this.strength }, t.blur.set = function(t) { this.padding = 1 + 2 * Math.abs(t), this.strength = t }, t.quality.get = function() { return this._quality }, t.quality.set = function(t) { this._quality = t, this.passes = t }, Object.defineProperties(BlurFilterPass.prototype, t), BlurFilterPass }(De), Ln = function(i) { function BlurFilter(t, e, r, n) { i.call(this), this.blurXFilter = new kn(!0, t, e, r, n), this.blurYFilter = new kn(!1, t, e, r, n), this.resolution = r || M.RESOLUTION, this.quality = e || 4, this.blur = t || 8, this.repeatEdgePixels = !1 } i && (BlurFilter.__proto__ = i); var t = { blur: { configurable: !0 }, quality: { configurable: !0 }, blurX: { configurable: !0 }, blurY: { configurable: !0 }, blendMode: { configurable: !0 }, repeatEdgePixels: { configurable: !0 } }; return ((BlurFilter.prototype = Object.create(i && i.prototype)).constructor = BlurFilter).prototype.apply = function(t, e, r, n) { var i = Math.abs(this.blurXFilter.strength), o = Math.abs(this.blurYFilter.strength); if (i && o) { var a = t.getFilterTexture(); this.blurXFilter.apply(t, e, a, !0), this.blurYFilter.apply(t, a, r, n), t.returnFilterTexture(a) } else o ? this.blurYFilter.apply(t, e, r, n) : this.blurXFilter.apply(t, e, r, n) }, BlurFilter.prototype.updatePadding = function() { this._repeatEdgePixels ? this.padding = 0 : this.padding = 2 * Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) }, t.blur.get = function() { return this.blurXFilter.blur }, t.blur.set = function(t) { this.blurXFilter.blur = this.blurYFilter.blur = t, this.updatePadding() }, t.quality.get = function() { return this.blurXFilter.quality }, t.quality.set = function(t) { this.blurXFilter.quality = this.blurYFilter.quality = t }, t.blurX.get = function() { return this.blurXFilter.blur }, t.blurX.set = function(t) { this.blurXFilter.blur = t, this.updatePadding() }, t.blurY.get = function() { return this.blurYFilter.blur }, t.blurY.set = function(t) { this.blurYFilter.blur = t, this.updatePadding() }, t.blendMode.get = function() { return this.blurYFilter.blendMode }, t.blendMode.set = function(t) { this.blurYFilter.blendMode = t }, t.repeatEdgePixels.get = function() { return this._repeatEdgePixels }, t.repeatEdgePixels.set = function(t) { this._repeatEdgePixels = t, this.updatePadding() }, Object.defineProperties(BlurFilter.prototype, t), BlurFilter }(De), Nn = function(e) { function ColorMatrixFilter() { var t = { m: new Float32Array([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]), uAlpha: 1 }; e.call(this, er, "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float m[20];\nuniform float uAlpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (uAlpha == 0.0) {\n gl_FragColor = c;\n return;\n }\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (c.a > 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n", t), this.alpha = 1 } e && (ColorMatrixFilter.__proto__ = e); var t = { matrix: { configurable: !0 }, alpha: { configurable: !0 } }; return ((ColorMatrixFilter.prototype = Object.create(e && e.prototype)).constructor = ColorMatrixFilter).prototype._loadMatrix = function(t, e) { void 0 === e && (e = !1); var r = t; e && (this._multiply(r, this.uniforms.m, t), r = this._colorMatrix(r)), this.uniforms.m = r }, ColorMatrixFilter.prototype._multiply = function(t, e, r) { return t[0] = e[0] * r[0] + e[1] * r[5] + e[2] * r[10] + e[3] * r[15], t[1] = e[0] * r[1] + e[1] * r[6] + e[2] * r[11] + e[3] * r[16], t[2] = e[0] * r[2] + e[1] * r[7] + e[2] * r[12] + e[3] * r[17], t[3] = e[0] * r[3] + e[1] * r[8] + e[2] * r[13] + e[3] * r[18], t[4] = e[0] * r[4] + e[1] * r[9] + e[2] * r[14] + e[3] * r[19] + e[4], t[5] = e[5] * r[0] + e[6] * r[5] + e[7] * r[10] + e[8] * r[15], t[6] = e[5] * r[1] + e[6] * r[6] + e[7] * r[11] + e[8] * r[16], t[7] = e[5] * r[2] + e[6] * r[7] + e[7] * r[12] + e[8] * r[17], t[8] = e[5] * r[3] + e[6] * r[8] + e[7] * r[13] + e[8] * r[18], t[9] = e[5] * r[4] + e[6] * r[9] + e[7] * r[14] + e[8] * r[19] + e[9], t[10] = e[10] * r[0] + e[11] * r[5] + e[12] * r[10] + e[13] * r[15], t[11] = e[10] * r[1] + e[11] * r[6] + e[12] * r[11] + e[13] * r[16], t[12] = e[10] * r[2] + e[11] * r[7] + e[12] * r[12] + e[13] * r[17], t[13] = e[10] * r[3] + e[11] * r[8] + e[12] * r[13] + e[13] * r[18], t[14] = e[10] * r[4] + e[11] * r[9] + e[12] * r[14] + e[13] * r[19] + e[14], t[15] = e[15] * r[0] + e[16] * r[5] + e[17] * r[10] + e[18] * r[15], t[16] = e[15] * r[1] + e[16] * r[6] + e[17] * r[11] + e[18] * r[16], t[17] = e[15] * r[2] + e[16] * r[7] + e[17] * r[12] + e[18] * r[17], t[18] = e[15] * r[3] + e[16] * r[8] + e[17] * r[13] + e[18] * r[18], t[19] = e[15] * r[4] + e[16] * r[9] + e[17] * r[14] + e[18] * r[19] + e[19], t }, ColorMatrixFilter.prototype._colorMatrix = function(t) { var e = new Float32Array(t); return e[4] /= 255, e[9] /= 255, e[14] /= 255, e[19] /= 255, e }, ColorMatrixFilter.prototype.brightness = function(t, e) { var r = [t, 0, 0, 0, 0, 0, t, 0, 0, 0, 0, 0, t, 0, 0, 0, 0, 0, 1, 0]; this._loadMatrix(r, e) }, ColorMatrixFilter.prototype.greyscale = function(t, e) { var r = [t, t, t, 0, 0, t, t, t, 0, 0, t, t, t, 0, 0, 0, 0, 0, 1, 0]; this._loadMatrix(r, e) }, ColorMatrixFilter.prototype.blackAndWhite = function(t) { this._loadMatrix([.3, .6, .1, 0, 0, .3, .6, .1, 0, 0, .3, .6, .1, 0, 0, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.hue = function(t, e) { t = (t || 0) / 180 * Math.PI; var r = Math.cos(t), n = Math.sin(t), i = (0, Math.sqrt)(1 / 3), o = [r + 1 / 3 * (1 - r), 1 / 3 * (1 - r) - i * n, 1 / 3 * (1 - r) + i * n, 0, 0, 1 / 3 * (1 - r) + i * n, r + 1 / 3 * (1 - r), 1 / 3 * (1 - r) - i * n, 0, 0, 1 / 3 * (1 - r) - i * n, 1 / 3 * (1 - r) + i * n, r + 1 / 3 * (1 - r), 0, 0, 0, 0, 0, 1, 0]; this._loadMatrix(o, e) }, ColorMatrixFilter.prototype.contrast = function(t, e) { var r = (t || 0) + 1, n = -.5 * (r - 1), i = [r, 0, 0, 0, n, 0, r, 0, 0, n, 0, 0, r, 0, n, 0, 0, 0, 1, 0]; this._loadMatrix(i, e) }, ColorMatrixFilter.prototype.saturate = function(t, e) { void 0 === t && (t = 0); var r = 2 * t / 3 + 1, n = -.5 * (r - 1), i = [r, n, n, 0, 0, n, r, n, 0, 0, n, n, r, 0, 0, 0, 0, 0, 1, 0]; this._loadMatrix(i, e) }, ColorMatrixFilter.prototype.desaturate = function() { this.saturate(-1) }, ColorMatrixFilter.prototype.negative = function(t) { this._loadMatrix([-1, 0, 0, 1, 0, 0, -1, 0, 1, 0, 0, 0, -1, 1, 0, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.sepia = function(t) { this._loadMatrix([.393, .7689999, .18899999, 0, 0, .349, .6859999, .16799999, 0, 0, .272, .5339999, .13099999, 0, 0, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.technicolor = function(t) { this._loadMatrix([1.9125277891456083, -.8545344976951645, -.09155508482755585, 0, 11.793603434377337, -.3087833385928097, 1.7658908555458428, -.10601743074722245, 0, -70.35205161461398, -.231103377548616, -.7501899197440212, 1.847597816108189, 0, 30.950940869491138, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.polaroid = function(t) { this._loadMatrix([1.438, -.062, -.062, 0, 0, -.122, 1.378, -.122, 0, 0, -.016, -.016, 1.483, 0, 0, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.toBGR = function(t) { this._loadMatrix([0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.kodachrome = function(t) { this._loadMatrix([1.1285582396593525, -.3967382283601348, -.03992559172921793, 0, 63.72958762196502, -.16404339962244616, 1.0835251566291304, -.05498805115633132, 0, 24.732407896706203, -.16786010706155763, -.5603416277695248, 1.6014850761964943, 0, 35.62982807460946, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.browni = function(t) { this._loadMatrix([.5997023498159715, .34553243048391263, -.2708298674538042, 0, 47.43192855600873, -.037703249837783157, .8609577587992641, .15059552388459913, 0, -36.96841498319127, .24113635128153335, -.07441037908422492, .44972182064877153, 0, -7.562075277591283, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.vintage = function(t) { this._loadMatrix([.6279345635605994, .3202183420819367, -.03965408211312453, 0, 9.651285835294123, .02578397704808868, .6441188644374771, .03259127616149294, 0, 7.462829176470591, .0466055556782719, -.0851232987247891, .5241648018700465, 0, 5.159190588235296, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.colorTone = function(t, e, r, n, i) { var o = ((r = r || 16770432) >> 16 & 255) / 255, a = (r >> 8 & 255) / 255, s = (255 & r) / 255, u = ((n = n || 3375104) >> 16 & 255) / 255, h = (n >> 8 & 255) / 255, c = (255 & n) / 255, l = [.3, .59, .11, 0, 0, o, a, s, t = t || .2, 0, u, h, c, e = e || .15, 0, o - u, a - h, s - c, 0, 0]; this._loadMatrix(l, i) }, ColorMatrixFilter.prototype.night = function(t, e) { var r = [-2 * (t = t || .1), -t, 0, 0, 0, -t, 0, t, 0, 0, 0, t, 2 * t, 0, 0, 0, 0, 0, 1, 0]; this._loadMatrix(r, e) }, ColorMatrixFilter.prototype.predator = function(t, e) { var r = [11.224130630493164 * t, -4.794486999511719 * t, -2.8746118545532227 * t, 0 * t, .40342438220977783 * t, -3.6330697536468506 * t, 9.193157196044922 * t, -2.951810836791992 * t, 0 * t, -1.316135048866272 * t, -3.2184197902679443 * t, -4.2375030517578125 * t, 7.476448059082031 * t, 0 * t, .8044459223747253 * t, 0, 0, 0, 1, 0]; this._loadMatrix(r, e) }, ColorMatrixFilter.prototype.lsd = function(t) { this._loadMatrix([2, -.4, .5, 0, 0, -.5, 2, -.4, 0, 0, -.4, -.5, 3, 0, 0, 0, 0, 0, 1, 0], t) }, ColorMatrixFilter.prototype.reset = function() { this._loadMatrix([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0], !1) }, t.matrix.get = function() { return this.uniforms.m }, t.matrix.set = function(t) { this.uniforms.m = t }, t.alpha.get = function() { return this.uniforms.uAlpha }, t.alpha.set = function(t) { this.uniforms.uAlpha = t }, Object.defineProperties(ColorMatrixFilter.prototype, t), ColorMatrixFilter }(De); Nn.prototype.grayscale = Nn.prototype.greyscale; var Bn = function(n) { function DisplacementFilter(t, e) { var r = new Y; t.renderable = !1, n.call(this, "attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n", "varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n", { mapSampler: t._texture, filterMatrix: r, scale: { x: 1, y: 1 }, rotation: new Float32Array([1, 0, 0, 1]) }), this.maskSprite = t, this.maskMatrix = r, null == e && (e = 20), this.scale = new q(e, e) } n && (DisplacementFilter.__proto__ = n); var t = { map: { configurable: !0 } }; return ((DisplacementFilter.prototype = Object.create(n && n.prototype)).constructor = DisplacementFilter).prototype.apply = function(t, e, r) { this.uniforms.filterMatrix = t.calculateSpriteMatrix(this.maskMatrix, this.maskSprite), this.uniforms.scale.x = this.scale.x, this.uniforms.scale.y = this.scale.y; var n = this.maskSprite.transform.worldTransform, i = Math.sqrt(n.a * n.a + n.b * n.b), o = Math.sqrt(n.c * n.c + n.d * n.d); 0 !== i && 0 !== o && (this.uniforms.rotation[0] = n.a / i, this.uniforms.rotation[1] = n.b / i, this.uniforms.rotation[2] = n.c / o, this.uniforms.rotation[3] = n.d / o), t.applyFilter(this, e, r) }, t.map.get = function() { return this.uniforms.mapSampler }, t.map.set = function(t) { this.uniforms.mapSampler = t }, Object.defineProperties(DisplacementFilter.prototype, t), DisplacementFilter }(De), Un = function(t) { function FXAAFilter() { t.call(this, "\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputPixel;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n", 'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputPixel;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputPixel.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n') } return t && (FXAAFilter.__proto__ = t), (FXAAFilter.prototype = Object.create(t && t.prototype)).constructor = FXAAFilter }(De), Gn = function(r) { function NoiseFilter(t, e) { void 0 === t && (t = .5), void 0 === e && (e = Math.random()), r.call(this, er, "precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n", { uNoise: 0, uSeed: 0 }), this.noise = t, this.seed = e } r && (NoiseFilter.__proto__ = r), (NoiseFilter.prototype = Object.create(r && r.prototype)).constructor = NoiseFilter; var t = { noise: { configurable: !0 }, seed: { configurable: !0 } }; return t.noise.get = function() { return this.uniforms.uNoise }, t.noise.set = function(t) { this.uniforms.uNoise = t }, t.seed.get = function() { return this.uniforms.uSeed }, t.seed.set = function(t) { this.uniforms.uSeed = t }, Object.defineProperties(NoiseFilter.prototype, t), NoiseFilter }(De), jn = new Y; dt.prototype._cacheAsBitmap = !1, dt.prototype._cacheData = !1; var zn = function() { this.textureCacheId = null, this.originalRender = null, this.originalRenderCanvas = null, this.originalCalculateBounds = null, this.originalGetLocalBounds = null, this.originalUpdateTransform = null, this.originalHitTest = null, this.originalDestroy = null, this.originalMask = null, this.originalFilterArea = null, this.sprite = null }; Object.defineProperties(dt.prototype, { cacheAsBitmap: { get: function() { return this._cacheAsBitmap }, set: function(t) { var e; this._cacheAsBitmap !== t && ((this._cacheAsBitmap = t) ? (this._cacheData || (this._cacheData = new zn), (e = this._cacheData).originalRender = this.render, e.originalRenderCanvas = this.renderCanvas, e.originalUpdateTransform = this.updateTransform, e.originalCalculateBounds = this.calculateBounds, e.originalGetLocalBounds = this.getLocalBounds, e.originalDestroy = this.destroy, e.originalContainsPoint = this.containsPoint, e.originalMask = this._mask, e.originalFilterArea = this.filterArea, this.render = this._renderCached, this.renderCanvas = this._renderCachedCanvas, this.destroy = this._cacheAsBitmapDestroy) : ((e = this._cacheData).sprite && this._destroyCachedDisplayObject(), this.render = e.originalRender, this.renderCanvas = e.originalRenderCanvas, this.calculateBounds = e.originalCalculateBounds, this.getLocalBounds = e.originalGetLocalBounds, this.destroy = e.originalDestroy, this.updateTransform = e.originalUpdateTransform, this.containsPoint = e.originalContainsPoint, this._mask = e.originalMask, this.filterArea = e.originalFilterArea)) } } }), dt.prototype._renderCached = function(t) { !this.visible || this.worldAlpha <= 0 || !this.renderable || (this._initCachedDisplayObject(t), this._cacheData.sprite.transform._worldID = this.transform._worldID, this._cacheData.sprite.worldAlpha = this.worldAlpha, this._cacheData.sprite._render(t)) }, dt.prototype._initCachedDisplayObject = function(t) { if (!this._cacheData || !this._cacheData.sprite) { var e = this.alpha; this.alpha = 1, t.batch.flush(); var r = this.getLocalBounds().clone(); if (this.filters) { var n = this.filters[0].padding; r.pad(n) } r.ceil(M.RESOLUTION); var i = t._activeRenderTarget, o = Wt.create(r.width, r.height), a = "cacheAsBitmap_" + uid(); this._cacheData.textureCacheId = a, Rt.addToCache(o.baseTexture, a), Ht.addToCache(o, a); var s = jn; s.tx = -r.x, s.ty = -r.y, this.transform.worldTransform.identity(), this.render = this._cacheData.originalRender, t.render(this, o, !0, s, !0), t.renderTexture.bind(i), this.render = this._renderCached, this.updateTransform = this.displayObjectUpdateTransform, this.calculateBounds = this._calculateCachedBounds, this.getLocalBounds = this._getCachedLocalBounds, this._mask = null, this.filterArea = null; var u = new Xr(o); u.transform.worldTransform = this.transform.worldTransform, u.anchor.x = -r.x / r.width, u.anchor.y = -r.y / r.height, u.alpha = e, u._bounds = this._bounds, this._cacheData.sprite = u, this.transform._parentID = -1, this.parent ? this.updateTransform() : (this.parent = t._tempDisplayObjectParent, this.updateTransform(), this.parent = null), this.containsPoint = u.containsPoint.bind(u) } }, dt.prototype._renderCachedCanvas = function(t) { !this.visible || this.worldAlpha <= 0 || !this.renderable || (this._initCachedDisplayObjectCanvas(t), this._cacheData.sprite.worldAlpha = this.worldAlpha, this._cacheData.sprite._renderCanvas(t)) }, dt.prototype._initCachedDisplayObjectCanvas = function(t) { if (!this._cacheData || !this._cacheData.sprite) { var e = this.getLocalBounds(), r = this.alpha; this.alpha = 1; var n = t.context; e.ceil(M.RESOLUTION); var i = Wt.create(e.width, e.height), o = "cacheAsBitmap_" + uid(); this._cacheData.textureCacheId = o, Rt.addToCache(i.baseTexture, o), Ht.addToCache(i, o); var a = jn; this.transform.localTransform.copyTo(a), a.invert(), a.tx -= e.x, a.ty -= e.y, this.renderCanvas = this._cacheData.originalRenderCanvas, t.render(this, i, !0, a, !1), t.context = n, this.renderCanvas = this._renderCachedCanvas, this.updateTransform = this.displayObjectUpdateTransform, this.calculateBounds = this._calculateCachedBounds, this.getLocalBounds = this._getCachedLocalBounds, this._mask = null, this.filterArea = null; var s = new Xr(i); s.transform.worldTransform = this.transform.worldTransform, s.anchor.x = -e.x / e.width, s.anchor.y = -e.y / e.height, s.alpha = r, s._bounds = this._bounds, this._cacheData.sprite = s, this.transform._parentID = -1, this.parent ? this.updateTransform() : (this.parent = t._tempDisplayObjectParent, this.updateTransform(), this.parent = null), this.containsPoint = s.containsPoint.bind(s) } }, dt.prototype._calculateCachedBounds = function() { this._bounds.clear(), this._cacheData.sprite.transform._worldID = this.transform._worldID, this._cacheData.sprite._calculateBounds(), this._lastBoundsID = this._boundsID }, dt.prototype._getCachedLocalBounds = function() { return this._cacheData.sprite.getLocalBounds() }, dt.prototype._destroyCachedDisplayObject = function() { this._cacheData.sprite._texture.destroy(!0), this._cacheData.sprite = null, Rt.removeFromCache(this._cacheData.textureCacheId), Ht.removeFromCache(this._cacheData.textureCacheId), this._cacheData.textureCacheId = null }, dt.prototype._cacheAsBitmapDestroy = function(t) { this.cacheAsBitmap = !1, this.destroy(t) }, dt.prototype.name = null, pt.prototype.getChildByName = function(t) { for (var e = 0; e < this.children.length; e++) if (this.children[e].name === t) return this.children[e]; return null }, dt.prototype.getGlobalPosition = function(t, e) { return void 0 === t && (t = new q), void 0 === e && (e = !1), this.parent ? this.parent.toGlobal(this.position, t, e) : (t.x = this.position.x, t.y = this.position.y), t }; var Xn = function(t, e) { this.uvBuffer = t, this.uvMatrix = e, this.data = null, this._bufferUpdateId = -1, this._textureUpdateId = -1, this._updateID = 0 }; Xn.prototype.update = function(t) { if (t || this._bufferUpdateId !== this.uvBuffer._updateID || this._textureUpdateId !== this.uvMatrix._updateID) { this._bufferUpdateId = this.uvBuffer._updateID, this._textureUpdateId = this.uvMatrix._updateID; var e = this.uvBuffer.data; this.data && this.data.length === e.length || (this.data = new Float32Array(e.length)), this.uvMatrix.multiplyUvs(e, this.data), this._updateID++ } }; var Vn = new q, qn = new ct, Hn = function(i) { function Mesh(t, e, r, n) { void 0 === n && (n = x.TRIANGLES), i.call(this), (this.geometry = t).refCount++, this.shader = e, this.state = r || Ce.for2d(), this.drawMode = n, this.start = 0, this.size = 0, this.uvs = null, this.indices = null, this.vertexData = new Float32Array(1), this.vertexDirty = 0, this._transformID = -1, this.tint = 16777215, this.blendMode = y.NORMAL, this._roundPixels = M.ROUND_PIXELS, this.batchUvs = null } i && (Mesh.__proto__ = i), (Mesh.prototype = Object.create(i && i.prototype)).constructor = Mesh; var t = { uvBuffer: { configurable: !0 }, verticesBuffer: { configurable: !0 }, material: { configurable: !0 }, blendMode: { configurable: !0 }, roundPixels: { configurable: !0 }, tint: { configurable: !0 }, texture: { configurable: !0 } }; return t.uvBuffer.get = function() { return this.geometry.buffers[1].data }, t.verticesBuffer.get = function() { return this.geometry.buffers[0].data }, t.material.set = function(t) { this.shader = t }, t.material.get = function() { return this.shader }, t.blendMode.set = function(t) { this.state.blendMode = t }, t.blendMode.get = function() { return this.state.blendMode }, t.roundPixels.set = function(t) { this._roundPixels !== t && (this._transformID = -1), this._roundPixels = t }, t.roundPixels.get = function() { return this._roundPixels }, t.tint.get = function() { return this.shader.tint }, t.tint.set = function(t) { this.shader.tint = t }, t.texture.get = function() { return this.shader.texture }, t.texture.set = function(t) { this.shader.texture = t }, Mesh.prototype._render = function(t) { var e = this.geometry.buffers[0].data; this.shader.batchable && this.drawMode === x.TRIANGLES && e.length < 2 * Mesh.BATCHABLE_SIZE ? this._renderToBatch(t) : this._renderDefault(t) }, Mesh.prototype._renderDefault = function(t) { var e = this.shader; e.alpha = this.worldAlpha, e.update && e.update(), t.batch.flush(), e.program.uniformData.translationMatrix && (e.uniforms.translationMatrix = this.transform.worldTransform.toArray(!0)), t.shader.bind(e), t.state.setState(this.state), t.geometry.bind(this.geometry, e), t.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount) }, Mesh.prototype._renderToBatch = function(t) { var e = this.geometry; this.shader.uvMatrix && (this.shader.uvMatrix.update(), this.calculateUvs()), this.calculateVertices(), this.indices = e.indexBuffer.data, this._tintRGB = this.shader._tintRGB, this._texture = this.shader.texture; var r = this.material.pluginName; t.batch.setObjectRenderer(t.plugins[r]), t.plugins[r].render(this) }, Mesh.prototype.calculateVertices = function() { var t = this.geometry, e = t.buffers[0].data; if (t.vertexDirtyId !== this.vertexDirty || this._transformID !== this.transform._worldID) { this._transformID = this.transform._worldID, this.vertexData.length !== e.length && (this.vertexData = new Float32Array(e.length)); for (var r = this.transform.worldTransform, n = r.a, i = r.b, o = r.c, a = r.d, s = r.tx, u = r.ty, h = this.vertexData, c = 0; c < h.length / 2; c++) { var l = e[2 * c], f = e[2 * c + 1]; h[2 * c] = n * l + o * f + s, h[2 * c + 1] = i * l + a * f + u } if (this._roundPixels) for (var d = 0; d < h.length; d++) h[d] = Math.round(h[d]); this.vertexDirty = t.vertexDirtyId } }, Mesh.prototype.calculateUvs = function() { var t = this.geometry.buffers[1]; this.shader.uvMatrix.isSimple ? this.uvs = t.data : (this.batchUvs || (this.batchUvs = new Xn(t, this.shader.uvMatrix)), this.batchUvs.update(), this.uvs = this.batchUvs.data) }, Mesh.prototype._calculateBounds = function() { this.calculateVertices(), this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length) }, Mesh.prototype.containsPoint = function(t) { if (!this.getBounds().contains(t.x, t.y)) return !1; this.worldTransform.applyInverse(t, Vn); for (var e = this.geometry.getAttribute("aVertexPosition").data, r = qn.points, n = this.geometry.getIndex().data, i = n.length, o = 4 === this.drawMode ? 3 : 1, a = 0; a + 2 < i; a += o) { var s = 2 * n[a], u = 2 * n[a + 1], h = 2 * n[a + 2]; if (r[0] = e[s], r[1] = e[s + 1], r[2] = e[u], r[3] = e[u + 1], r[4] = e[h], r[5] = e[h + 1], qn.contains(Vn.x, Vn.y)) return !0 } return !1 }, Mesh.prototype.destroy = function(t) { i.prototype.destroy.call(this, t), this.geometry.refCount--, 0 === this.geometry.refCount && this.geometry.dispose(), this.geometry = null, this.shader = null, this.state = null, this.uvs = null, this.indices = null, this.vertexData = null }, Object.defineProperties(Mesh.prototype, t), Mesh }(pt); Hn.BATCHABLE_SIZE = 100; var Wn = function(n) { function MeshMaterial(t, e) { var r = { uSampler: t, alpha: 1, uTextureMatrix: Y.IDENTITY, uColor: new Float32Array([1, 1, 1, 1]) }; (e = Object.assign({ tint: 16777215, alpha: 1, pluginName: "batch" }, e)).uniforms && Object.assign(r, e.uniforms), n.call(this, e.program || Ae.from("attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTextureMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\n}\n", "varying vec2 vTextureCoord;\nuniform vec4 uColor;\n\nuniform sampler2D uSampler;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;\n}\n"), r), this._colorDirty = !1, this.uvMatrix = new ke(t), this.batchable = void 0 === e.program, this.pluginName = e.pluginName, this.tint = e.tint, this.alpha = e.alpha } n && (MeshMaterial.__proto__ = n), (MeshMaterial.prototype = Object.create(n && n.prototype)).constructor = MeshMaterial; var t = { texture: { configurable: !0 }, alpha: { configurable: !0 }, tint: { configurable: !0 } }; return t.texture.get = function() { return this.uniforms.uSampler }, t.texture.set = function(t) { this.uniforms.uSampler !== t && (this.uniforms.uSampler = t, this.uvMatrix.texture = t) }, t.alpha.set = function(t) { t !== this._alpha && (this._alpha = t, this._colorDirty = !0) }, t.alpha.get = function() { return this._alpha }, t.tint.set = function(t) { t !== this._tint && (this._tint = t, this._tintRGB = (t >> 16) + (65280 & t) + ((255 & t) << 16), this._colorDirty = !0) }, t.tint.get = function() { return this._tint }, MeshMaterial.prototype.update = function() { if (this._colorDirty) { this._colorDirty = !1; var t = this.texture.baseTexture; premultiplyTintToRgba(this._tint, this._alpha, this.uniforms.uColor, t.premultiplyAlpha) } this.uvMatrix.update() && (this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord) }, Object.defineProperties(MeshMaterial.prototype, t), MeshMaterial }(Ie), Yn = function(a) { function MeshGeometry(t, e, r) { a.call(this); var n = new Zt(t), i = new Zt(e, !0), o = new Zt(r, !0, !0); this.addAttribute("aVertexPosition", n, 2, !1, w.FLOAT).addAttribute("aTextureCoord", i, 2, !1, w.FLOAT).addIndex(o), this._updateId = -1 } a && (MeshGeometry.__proto__ = a), (MeshGeometry.prototype = Object.create(a && a.prototype)).constructor = MeshGeometry; var t = { vertexDirtyId: { configurable: !0 } }; return t.vertexDirtyId.get = function() { return this.buffers[0]._updateID }, Object.defineProperties(MeshGeometry.prototype, t), MeshGeometry }(ee), Kn = function(i) { function PlaneGeometry(t, e, r, n) { void 0 === t && (t = 100), void 0 === e && (e = 100), void 0 === r && (r = 10), void 0 === n && (n = 10), i.call(this), this.segWidth = r, this.segHeight = n, this.width = t, this.height = e, this.build() } return i && (PlaneGeometry.__proto__ = i), ((PlaneGeometry.prototype = Object.create(i && i.prototype)).constructor = PlaneGeometry).prototype.build = function() { for (var t = this.segWidth * this.segHeight, e = [], r = [], n = [], i = this.segWidth - 1, o = this.segHeight - 1, a = this.width / i, s = this.height / o, u = 0; u < t; u++) { var h = u % this.segWidth, c = u / this.segWidth | 0; e.push(h * a, c * s), r.push(h / i, c / o) } for (var l = i * o, f = 0; f < l; f++) { var d = f % i, p = f / i | 0, m = p * this.segWidth + d, v = p * this.segWidth + d + 1, g = (p + 1) * this.segWidth + d, y = (p + 1) * this.segWidth + d + 1; n.push(m, v, g, v, y, g) } this.buffers[0].data = new Float32Array(e), this.buffers[1].data = new Float32Array(r), this.indexBuffer.data = new Uint16Array(n), this.buffers[0].update(), this.buffers[1].update(), this.indexBuffer.update() }, PlaneGeometry }(Yn), Zn = function(r) { function RopeGeometry(t, e) { void 0 === t && (t = 200), r.call(this, new Float32Array(4 * e.length), new Float32Array(4 * e.length), new Uint16Array(6 * (e.length - 1))), this.points = e, this.width = t, this.build() } return r && (RopeGeometry.__proto__ = r), ((RopeGeometry.prototype = Object.create(r && r.prototype)).constructor = RopeGeometry).prototype.build = function() { var t = this.points; if (t) { var e = this.getAttribute("aVertexPosition"), r = this.getAttribute("aTextureCoord"), n = this.getIndex(); if (!(t.length < 1)) { e.data.length / 4 !== t.length && (e.data = new Float32Array(4 * t.length), r.data = new Float32Array(4 * t.length), n.data = new Uint16Array(6 * (t.length - 1))); var i = r.data, o = n.data; i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1; for (var a = t.length, s = 0; s < a; s++) { var u = 4 * s, h = s / (a - 1); i[u] = h, i[u + 1] = 0, i[u + 2] = h, i[u + 3] = 1 } for (var c = 0, l = 0; l < a - 1; l++) { var f = 2 * l; o[c++] = f, o[c++] = f + 1, o[c++] = f + 2, o[c++] = f + 2, o[c++] = f + 1, o[c++] = f + 3 } r.update(), n.update(), this.updateVertices() } } }, RopeGeometry.prototype.updateVertices = function() { var t = this.points; if (!(t.length < 1)) { for (var e, r = t[0], n = 0, i = 0, o = this.buffers[0].data, a = t.length, s = 0; s < a; s++) { var u = t[s], h = 4 * s; i = -((e = s < t.length - 1 ? t[s + 1] : u).x - r.x), n = e.y - r.y; var c = Math.sqrt(n * n + i * i), l = this.width / 2; n /= c, i /= c, n *= l, i *= l, o[h] = u.x + n, o[h + 1] = u.y + i, o[h + 2] = u.x - n, o[h + 3] = u.y - i, r = u } this.buffers[0].update() } }, RopeGeometry.prototype.update = function() { this.updateVertices() }, RopeGeometry }(Yn), Qn = function(i) { function SimpleRope(t, e) { var r = new Zn(t.height, e), n = new Wn(t); i.call(this, r, n), this.autoUpdate = !0 } return i && (SimpleRope.__proto__ = i), ((SimpleRope.prototype = Object.create(i && i.prototype)).constructor = SimpleRope).prototype._render = function(t) { (this.autoUpdate || this.geometry.width !== this.shader.texture.height) && (this.geometry.width = this.shader.texture.height, this.geometry.update()), i.prototype._render.call(this, t) }, SimpleRope }(Hn), Jn = function(o) { function SimplePlane(t, e, r) { var n = new Kn(t.width, t.height, e, r), i = new Wn(Ht.WHITE); o.call(this, n, i), this.texture = t } o && (SimplePlane.__proto__ = o); var t = { texture: { configurable: !0 } }; return ((SimplePlane.prototype = Object.create(o && o.prototype)).constructor = SimplePlane).prototype.textureUpdated = function() { this._textureID = this.shader.texture._updateID, this.geometry.width = this.shader.texture.width, this.geometry.height = this.shader.texture.height, this.geometry.build() }, t.texture.set = function(t) { this.shader.texture !== t && (this.shader.texture = t, this._textureID = -1, t.baseTexture.valid ? this.textureUpdated() : t.once("update", this.textureUpdated, this)) }, t.texture.get = function() { return this.shader.texture }, SimplePlane.prototype._render = function(t) { this._textureID !== this.shader.texture._updateID && this.textureUpdated(), o.prototype._render.call(this, t) }, Object.defineProperties(SimplePlane.prototype, t), SimplePlane }(Hn), $n = function(s) { function SimpleMesh(t, e, r, n, i) { void 0 === t && (t = Ht.EMPTY); var o = new Yn(e, r, n); o.getAttribute("aVertexPosition").static = !1; var a = new Wn(t); s.call(this, o, a, null, i), this.autoUpdate = !0 } s && (SimpleMesh.__proto__ = s), (SimpleMesh.prototype = Object.create(s && s.prototype)).constructor = SimpleMesh; var t = { vertices: { configurable: !0 } }; return t.vertices.get = function() { return this.geometry.getAttribute("aVertexPosition").data }, t.vertices.set = function(t) { this.geometry.getAttribute("aVertexPosition").data = t }, SimpleMesh.prototype._render = function(t) { this.autoUpdate && this.geometry.getAttribute("aVertexPosition").update(), s.prototype._render.call(this, t) }, Object.defineProperties(SimpleMesh.prototype, t), SimpleMesh }(Hn), ti = function(o) { function NineSlicePlane(t, e, r, n, i) { o.call(this, Ht.WHITE, 4, 4), this._origWidth = t.orig.width, this._origHeight = t.orig.height, this._width = this._origWidth, this._height = this._origHeight, this._leftWidth = void 0 !== e ? e : 10, this._rightWidth = void 0 !== n ? n : 10, this._topHeight = void 0 !== r ? r : 10, this._bottomHeight = void 0 !== i ? i : 10, this.texture = t } o && (NineSlicePlane.__proto__ = o); var t = { vertices: { configurable: !0 }, width: { configurable: !0 }, height: { configurable: !0 }, leftWidth: { configurable: !0 }, rightWidth: { configurable: !0 }, topHeight: { configurable: !0 }, bottomHeight: { configurable: !0 } }; return ((NineSlicePlane.prototype = Object.create(o && o.prototype)).constructor = NineSlicePlane).prototype.textureUpdated = function() { this._textureID = this.shader.texture._updateID, this._refresh() }, t.vertices.get = function() { return this.geometry.getAttribute("aVertexPosition").data }, t.vertices.set = function(t) { this.geometry.getAttribute("aVertexPosition").data = t }, NineSlicePlane.prototype.updateHorizontalVertices = function() { var t = this.vertices, e = this._topHeight + this._bottomHeight, r = this._height > e ? 1 : this._height / e; t[9] = t[11] = t[13] = t[15] = this._topHeight * r, t[17] = t[19] = t[21] = t[23] = this._height - this._bottomHeight * r, t[25] = t[27] = t[29] = t[31] = this._height }, NineSlicePlane.prototype.updateVerticalVertices = function() { var t = this.vertices, e = this._leftWidth + this._rightWidth, r = this._width > e ? 1 : this._width / e; t[2] = t[10] = t[18] = t[26] = this._leftWidth * r, t[4] = t[12] = t[20] = t[28] = this._width - this._rightWidth * r, t[6] = t[14] = t[22] = t[30] = this._width }, t.width.get = function() { return this._width }, t.width.set = function(t) { this._width = t, this._refresh() }, t.height.get = function() { return this._height }, t.height.set = function(t) { this._height = t, this._refresh() }, t.leftWidth.get = function() { return this._leftWidth }, t.leftWidth.set = function(t) { this._leftWidth = t, this._refresh() }, t.rightWidth.get = function() { return this._rightWidth }, t.rightWidth.set = function(t) { this._rightWidth = t, this._refresh() }, t.topHeight.get = function() { return this._topHeight }, t.topHeight.set = function(t) { this._topHeight = t, this._refresh() }, t.bottomHeight.get = function() { return this._bottomHeight }, t.bottomHeight.set = function(t) { this._bottomHeight = t, this._refresh() }, NineSlicePlane.prototype._refresh = function() { var t = this.texture, e = this.geometry.buffers[1].data; this._origWidth = t.orig.width, this._origHeight = t.orig.height; var r = 1 / this._origWidth, n = 1 / this._origHeight; e[0] = e[8] = e[16] = e[24] = 0, e[1] = e[3] = e[5] = e[7] = 0, e[6] = e[14] = e[22] = e[30] = 1, e[25] = e[27] = e[29] = e[31] = 1, e[2] = e[10] = e[18] = e[26] = r * this._leftWidth, e[4] = e[12] = e[20] = e[28] = 1 - r * this._rightWidth, e[9] = e[11] = e[13] = e[15] = n * this._topHeight, e[17] = e[19] = e[21] = e[23] = 1 - n * this._bottomHeight, this.updateHorizontalVertices(), this.updateVerticalVertices(), this.geometry.buffers[0].update(), this.geometry.buffers[1].update() }, Object.defineProperties(NineSlicePlane.prototype, t), NineSlicePlane }(Jn), ei = function(r) { function AnimatedSprite(t, e) { r.call(this, t[0] instanceof Ht ? t[0] : t[0].texture), this._textures = null, this._durations = null, this.textures = t, this._autoUpdate = !1 !== e, this.animationSpeed = 1, this.loop = !0, this.updateAnchor = !1, this.onComplete = null, this.onFrameChange = null, this.onLoop = null, this._currentTime = 0, this.playing = !1 } r && (AnimatedSprite.__proto__ = r); var t = { totalFrames: { configurable: !0 }, textures: { configurable: !0 }, currentFrame: { configurable: !0 } }; return ((AnimatedSprite.prototype = Object.create(r && r.prototype)).constructor = AnimatedSprite).prototype.stop = function() { this.playing && (this.playing = !1, this._autoUpdate && xt.shared.remove(this.update, this)) }, AnimatedSprite.prototype.play = function() { this.playing || (this.playing = !0, this._autoUpdate && xt.shared.add(this.update, this, _t.HIGH)) }, AnimatedSprite.prototype.gotoAndStop = function(t) { this.stop(); var e = this.currentFrame; this._currentTime = t, e !== this.currentFrame && this.updateTexture() }, AnimatedSprite.prototype.gotoAndPlay = function(t) { var e = this.currentFrame; this._currentTime = t, e !== this.currentFrame && this.updateTexture(), this.play() }, AnimatedSprite.prototype.update = function(t) { var e = this.animationSpeed * t, r = this.currentFrame; if (null !== this._durations) { var n = this._currentTime % 1 * this._durations[this.currentFrame]; for (n += e / 60 * 1e3; n < 0;) this._currentTime--, n += this._durations[this.currentFrame]; var i = Math.sign(this.animationSpeed * t); for (this._currentTime = Math.floor(this._currentTime); n >= this._durations[this.currentFrame];) n -= this._durations[this.currentFrame] * i, this._currentTime += i; this._currentTime += n / this._durations[this.currentFrame] } else this._currentTime += e; this._currentTime < 0 && !this.loop ? (this.gotoAndStop(0), this.onComplete && this.onComplete()) : this._currentTime >= this._textures.length && !this.loop ? (this.gotoAndStop(this._textures.length - 1), this.onComplete && this.onComplete()) : r !== this.currentFrame && (this.loop && this.onLoop && (0 < this.animationSpeed && this.currentFrame < r ? this.onLoop() : this.animationSpeed < 0 && this.currentFrame > r && this.onLoop()), this.updateTexture()) }, AnimatedSprite.prototype.updateTexture = function() { this._texture = this._textures[this.currentFrame], this._textureID = -1, this._textureTrimmedID = -1, this.cachedTint = 16777215, this.uvs = this._texture._uvs.uvsFloat32, this.updateAnchor && this._anchor.copy(this._texture.defaultAnchor), this.onFrameChange && this.onFrameChange(this.currentFrame) }, AnimatedSprite.prototype.destroy = function(t) { this.stop(), r.prototype.destroy.call(this, t), this.onComplete = null, this.onFrameChange = null, this.onLoop = null }, AnimatedSprite.fromFrames = function(t) { for (var e = [], r = 0; r < t.length; ++r) e.push(Ht.from(t[r])); return new AnimatedSprite(e) }, AnimatedSprite.fromImages = function(t) { for (var e = [], r = 0; r < t.length; ++r) e.push(Ht.from(t[r])); return new AnimatedSprite(e) }, t.totalFrames.get = function() { return this._textures.length }, t.textures.get = function() { return this._textures }, t.textures.set = function(t) { if (t[0] instanceof Ht) this._textures = t, this._durations = null; else { this._textures = [], this._durations = []; for (var e = 0; e < t.length; e++) this._textures.push(t[e].texture), this._durations.push(t[e].time) } this.gotoAndStop(0), this.updateTexture() }, t.currentFrame.get = function() { var t = Math.floor(this._currentTime) % this._textures.length; return t < 0 && (t += this._textures.length), t }, Object.defineProperties(AnimatedSprite.prototype, t), AnimatedSprite }(Xr); r.d(e, "VERSION", function() { return ri }), r.d(e, "filters", function() { return ni }), r.d(e, "useDeprecated", function() { return useDeprecated }), r.d(e, "accessibility", function() { return i }), r.d(e, "extract", function() { return o }), r.d(e, "interaction", function() { return a }), r.d(e, "prepare", function() { return s }), r.d(e, "utils", function() { return n }), r.d(e, "Application", function() { return rn }), r.d(e, "AbstractRenderer", function() { return Je }), r.d(e, "Attribute", function() { return Yt }), r.d(e, "BaseRenderTexture", function() { return Xt }), r.d(e, "BaseTexture", function() { return Rt }), r.d(e, "BatchDrawCall", function() { return ir }), r.d(e, "BatchGeometry", function() { return nr }), r.d(e, "BatchRenderer", function() { return cr }), r.d(e, "Buffer", function() { return Zt }), r.d(e, "CubeTexture", function() { return rr }), r.d(e, "Filter", function() { return De }), r.d(e, "Framebuffer", function() { return jt }), r.d(e, "GLProgram", function() { return Xe }), r.d(e, "GLTexture", function() { return Rt }), r.d(e, "Geometry", function() { return ee }), r.d(e, "ObjectRenderer", function() { return he }), r.d(e, "Program", function() { return Ae }), r.d(e, "Quad", function() { return re }), r.d(e, "QuadUv", function() { return ne }), r.d(e, "RenderTexture", function() { return Wt }), r.d(e, "Renderer", function() { return $e }), r.d(e, "Shader", function() { return Ie }), r.d(e, "SpriteMaskFilter", function() { return Ne }), r.d(e, "State", function() { return Ce }), r.d(e, "System", function() { return Ut }), r.d(e, "Texture", function() { return Ht }), r.d(e, "TextureMatrix", function() { return ke }), r.d(e, "TextureUvs", function() { return Vt }), r.d(e, "UniformGroup", function() { return oe }), r.d(e, "autoDetectRenderer", function() { return autoDetectRenderer }), r.d(e, "checkMaxIfStatementsInShader", function() { return checkMaxIfStatementsInShader }), r.d(e, "defaultFilterVertex", function() { return er }), r.d(e, "defaultVertex", function() { return tr }), r.d(e, "generateMultiTextureShader", function() { return generateMultiTextureShader }), r.d(e, "resources", function() { return Bt }), r.d(e, "systems", function() { return Ze }), r.d(e, "AppLoaderPlugin", function() { return vn }), r.d(e, "Loader", function() { return mn }), r.d(e, "LoaderResource", function() { return gn }), r.d(e, "TextureLoader", function() { return pn }), r.d(e, "ParticleContainer", function() { return yn }), r.d(e, "ParticleRenderer", function() { return bn }), r.d(e, "Spritesheet", function() { return xn }), r.d(e, "SpritesheetLoader", function() { return Tn }), r.d(e, "TilingSprite", function() { return Mn }), r.d(e, "TilingSpriteRenderer", function() { return Pn }), r.d(e, "BitmapFontLoader", function() { return On }), r.d(e, "BitmapText", function() { return In }), r.d(e, "Ticker", function() { return xt }), r.d(e, "TickerPlugin", function() { return St }), r.d(e, "UPDATE_PRIORITY", function() { return _t }), r.d(e, "BLEND_MODES", function() { return y }), r.d(e, "DRAW_MODES", function() { return x }), r.d(e, "ENV", function() { return v }), r.d(e, "FORMATS", function() { return _ }), r.d(e, "GC_MODES", function() { return A }), r.d(e, "MIPMAP_MODES", function() { return E }), r.d(e, "PRECISION", function() { return P }), r.d(e, "RENDERER_TYPE", function() { return g }), r.d(e, "SCALE_MODES", function() { return T }), r.d(e, "TARGETS", function() { return b }), r.d(e, "TYPES", function() { return w }), r.d(e, "WRAP_MODES", function() { return S }), r.d(e, "Bounds", function() { return ft }), r.d(e, "Container", function() { return pt }), r.d(e, "DisplayObject", function() { return dt }), r.d(e, "GRAPHICS_CURVES", function() { return xr }), r.d(e, "Graphics", function() { return Gr }), r.d(e, "GraphicsData", function() { return Tr }), r.d(e, "GraphicsGeometry", function() { return Rr }), r.d(e, "Circle", function() { return ut }), r.d(e, "DEG_TO_RAD", function() { return H }), r.d(e, "Ellipse", function() { return ht }), r.d(e, "GroupD8", function() { return rt }), r.d(e, "Matrix", function() { return Y }), r.d(e, "ObservablePoint", function() { return j }), r.d(e, "PI_2", function() { return X }), r.d(e, "Point", function() { return q }), r.d(e, "Polygon", function() { return ct }), r.d(e, "RAD_TO_DEG", function() { return V }), r.d(e, "Rectangle", function() { return ot }), r.d(e, "RoundedRectangle", function() { return lt }), r.d(e, "SHAPES", function() { return W }), r.d(e, "Transform", function() { return nt }), r.d(e, "Mesh", function() { return Hn }), r.d(e, "MeshBatchUvs", function() { return Xn }), r.d(e, "MeshGeometry", function() { return Yn }), r.d(e, "MeshMaterial", function() { return Wn }), r.d(e, "NineSlicePlane", function() { return ti }), r.d(e, "PlaneGeometry", function() { return Kn }), r.d(e, "RopeGeometry", function() { return Zn }), r.d(e, "SimpleMesh", function() { return $n }), r.d(e, "SimplePlane", function() { return Jn }), r.d(e, "SimpleRope", function() { return Qn }), r.d(e, "Runner", function() { return gt }), r.d(e, "Sprite", function() { return Xr }), r.d(e, "AnimatedSprite", function() { return ei }), r.d(e, "TEXT_GRADIENT", function() { return Vr }), r.d(e, "Text", function() { return Qr }), r.d(e, "TextMetrics", function() { return Yr }), r.d(e, "TextStyle", function() { return Hr }), r.d(e, "isMobile", function() { return h.a }), r.d(e, "settings", function() { return M }); function useDeprecated() { var e = this; Object.defineProperties(e, { SVG_SIZE: { get: function() { return deprecation(0, "PIXI.utils.SVG_SIZE has moved to PIXI.SVGResource.SVG_SIZE"), e.SVGResource.SVG_SIZE } }, TransformStatic: { get: function() { return deprecation(0, "PIXI.TransformStatic has been removed, use PIXI.Transform"), e.Transform } }, TransformBase: { get: function() { return deprecation(0, "PIXI.TransformBase has been removed, use PIXI.Transform"), e.Transform } }, TRANSFORM_MODE: { get: function() { return deprecation(0, "PIXI.TRANSFORM_MODE has been removed"), { STATIC: 0, DYNAMIC: 1 } } }, WebGLRenderer: { get: function() { return deprecation(0, "PIXI.WebGLRenderer has moved to PIXI.Renderer"), e.Renderer } }, CanvasRenderTarget: { get: function() { return deprecation(0, "PIXI.CanvasRenderTarget has moved to PIXI.utils.CanvasRenderTarget"), e.utils.CanvasRenderTarget } }, loader: { get: function() { return deprecation(0, "PIXI.loader has moved to PIXI.Loader.shared"), e.Loader.shared } }, FilterManager: { get: function() { return deprecation(0, "PIXI.FilterManager has moved to PIXI.systems.FilterSystem"), e.systems.FilterManager } } }), e.extras = {}, Object.defineProperties(e.extras, { TilingSprite: { get: function() { return deprecation(0, "PIXI.extras.TilingSprite has moved to PIXI.TilingSprite"), e.TilingSprite } }, TilingSpriteRenderer: { get: function() { return deprecation(0, "PIXI.extras.TilingSpriteRenderer has moved to PIXI.TilingSpriteRenderer"), e.TilingSpriteRenderer } }, AnimatedSprite: { get: function() { return deprecation(0, "PIXI.extras.AnimatedSprite has moved to PIXI.AnimatedSprite"), e.AnimatedSprite } }, BitmapText: { get: function() { return deprecation(0, "PIXI.extras.BitmapText has moved to PIXI.BitmapText"), e.BitmapText } } }), Object.defineProperties(e.utils, { getSvgSize: { get: function() { return deprecation(0, "PIXI.utils.getSvgSize has moved to PIXI.SVGResource.getSize"), e.SVGResource.getSize } } }), e.mesh = {}, Object.defineProperties(e.mesh, { Mesh: { get: function() { return deprecation(0, "PIXI.mesh.Mesh has moved to PIXI.SimpleMesh"), e.SimpleMesh } }, NineSlicePlane: { get: function() { return deprecation(0, "PIXI.mesh.NineSlicePlane has moved to PIXI.NineSlicePlane"), e.NineSlicePlane } }, Plane: { get: function() { return deprecation(0, "PIXI.mesh.Plane has moved to PIXI.SimplePlane"), e.SimplePlane } }, Rope: { get: function() { return deprecation(0, "PIXI.mesh.Rope has moved to PIXI.SimpleRope"), e.SimpleRope } }, RawMesh: { get: function() { return deprecation(0, "PIXI.mesh.RawMesh has moved to PIXI.Mesh"), e.Mesh } }, CanvasMeshRenderer: { get: function() { return deprecation(0, "PIXI.mesh.CanvasMeshRenderer has moved to PIXI.CanvasMeshRenderer"), e.CanvasMeshRenderer } }, MeshRenderer: { get: function() { return deprecation(0, "PIXI.mesh.MeshRenderer has moved to PIXI.MeshRenderer"), e.MeshRenderer } } }), e.particles = {}, Object.defineProperties(e.particles, { ParticleContainer: { get: function() { return deprecation(0, "PIXI.particles.ParticleContainer has moved to PIXI.ParticleContainer"), e.ParticleContainer } }, ParticleRenderer: { get: function() { return deprecation(0, "PIXI.particles.ParticleRenderer has moved to PIXI.ParticleRenderer"), e.ParticleRenderer } } }), e.ticker = {}, Object.defineProperties(e.ticker, { Ticker: { get: function() { return deprecation(0, "PIXI.ticker.Ticker has moved to PIXI.Ticker"), e.Ticker } }, shared: { get: function() { return deprecation(0, "PIXI.ticker.shared has moved to PIXI.Ticker.shared"), e.Ticker.shared } } }), e.loaders = {}, Object.defineProperties(e.loaders, { Loader: { get: function() { return deprecation(0, "PIXI.loaders.Loader has moved to PIXI.Loader"), e.Loader } }, Resource: { get: function() { return deprecation(0, "PIXI.loaders.Resource has moved to PIXI.LoaderResource"), e.LoaderResource } }, bitmapFontParser: { get: function() { return deprecation(0, "PIXI.loaders.bitmapFontParser has moved to PIXI.BitmapFontLoader.use"), e.BitmapFontLoader.use } }, parseBitmapFontData: { get: function() { return deprecation(0, "PIXI.loaders.parseBitmapFontData has moved to PIXI.BitmapFontLoader.parse"), e.BitmapFontLoader.parse } }, spritesheetParser: { get: function() { return deprecation(0, "PIXI.loaders.spritesheetParser has moved to PIXI.SpritesheetLoader.use"), e.SpritesheetLoader.use } }, getResourcePath: { get: function() { return deprecation(0, "PIXI.loaders.getResourcePath has moved to PIXI.SpritesheetLoader.getResourcePath"), e.SpritesheetLoader.getResourcePath } } }), e.Loader.addPixiMiddleware = function(t) { return deprecation(0, "PIXI.loaders.Loader.addPixiMiddleware is deprecated, use PIXI.loaders.Loader.registerPlugin"), e.loaders.Loader.registerPlugin({ use: t() }) }, Object.defineProperty(e.extract, "WebGLExtract", { get: function() { return deprecation(0, "PIXI.extract.WebGLExtract has moved to PIXI.extract.Extract"), e.extract.Extract } }), Object.defineProperty(e.prepare, "WebGLPrepare", { get: function() { return deprecation(0, "PIXI.prepare.WebGLPrepare has moved to PIXI.prepare.Prepare"), e.prepare.Prepare } }), e.Container.prototype._renderWebGL = function(t) { deprecation(0, "PIXI.Container#_renderWebGL has moved to PIXI.Container#_render"), this._render(t) }, e.Container.prototype.renderWebGL = function(t) { deprecation(0, "PIXI.Container#renderWebGL has moved to PIXI.Container#render"), this.render(t) }, e.DisplayObject.prototype.renderWebGL = function(t) { deprecation(0, "PIXI.DisplayObject#renderWebGL has moved to PIXI.DisplayObject#render"), this.render(t) }, e.Container.prototype.renderAdvancedWebGL = function(t) { deprecation(0, "PIXI.Container#renderAdvancedWebGL has moved to PIXI.Container#renderAdvanced"), this.renderAdvanced(t) }, Object.defineProperties(e.settings, { TRANSFORM_MODE: { get: function() { return deprecation(0, "PIXI.settings.TRANSFORM_MODE has been removed."), 0 }, set: function() { deprecation(0, "PIXI.settings.TRANSFORM_MODE has been removed.") } } }); var o = e.BaseTexture; o.fromImage = function(t, e, r, n) { deprecation(0, "PIXI.BaseTexture.fromImage has been replaced with PIXI.BaseTexture.from"); var i = { scale: n, crossorigin: e }; return o.from(t, { scaleMode: r, resourceOptions: i }) }, o.fromCanvas = function(t, e) { return deprecation(0, "PIXI.BaseTexture.fromCanvas has been replaced with PIXI.BaseTexture.from"), o.from(t, { scaleMode: e }) }, o.fromSVG = function(t, e, r, n) { deprecation(0, "PIXI.BaseTexture.fromSVG has been replaced with PIXI.BaseTexture.from"); var i = { scale: n, crossorigin: e }; return o.from(t, { scaleMode: r, resourceOptions: i }) }, e.Point.prototype.copy = function(t) { return deprecation(0, "PIXI.Point.copy has been replaced with PIXI.Point#copyFrom"), this.copyFrom(t) }, e.ObservablePoint.prototype.copy = function(t) { return deprecation(0, "PIXI.ObservablePoint.copy has been replaced with PIXI.ObservablePoint#copyFrom"), this.copyFrom(t) }, e.Rectangle.prototype.copy = function(t) { return deprecation(0, "PIXI.Rectangle.copy has been replaced with PIXI.Rectangle#copyFrom"), this.copyFrom(t) }, e.Matrix.prototype.copy = function(t) { return deprecation(0, "PIXI.Matrix.copy has been replaced with PIXI.Matrix#copyTo"), this.copyTo(t) }, Object.assign(e.systems.FilterSystem.prototype, { getRenderTarget: function(t, e) { return deprecation(0, "FilterManager#getRenderTarget has been replaced with FilterSystem#getFilterTexture"), this.getFilterTexture(e) }, returnRenderTarget: function(t) { deprecation(0, "FilterManager#returnRenderTarget has been replaced with FilterSystem#returnFilterTexture"), this.returnFilterTexture(t) } }), Object.defineProperties(e.RenderTexture.prototype, { sourceFrame: { get: function() { return deprecation(0, "PIXI.RenderTexture#sourceFrame has been removed"), this.filterFrame } }, size: { get: function() { return deprecation(0, "PIXI.RenderTexture#size has been removed"), this._frame } } }); var t = function(i) { function BlurXFilter(t, e, r, n) { deprecation(0, "PIXI.filters.BlurXFilter is deprecated, use PIXI.filters.BlurFilterPass"), i.call(this, !0, t, e, r, n) } return i && (BlurXFilter.__proto__ = i), (BlurXFilter.prototype = Object.create(i && i.prototype)).constructor = BlurXFilter }(e.filters.BlurFilterPass), r = function(i) { function BlurYFilter(t, e, r, n) { deprecation(0, "PIXI.filters.BlurYFilter is deprecated, use PIXI.filters.BlurFilterPass"), i.call(this, !1, t, e, r, n) } return i && (BlurYFilter.__proto__ = i), (BlurYFilter.prototype = Object.create(i && i.prototype)).constructor = BlurYFilter }(e.filters.BlurFilterPass); Object.assign(e.filters, { BlurXFilter: t, BlurYFilter: r }); var i = e.Sprite, a = e.Texture, n = e.Graphics; function spriteFrom(t, e, r, n) { return deprecation(0, "PIXI.Sprite." + t + " is deprecated, use PIXI.Sprite.from"), i.from(e, { resourceOptions: { scale: n, crossorigin: r } }) } function textureFrom(t, e, r, n) { return deprecation(0, "PIXI.Texture." + t + " is deprecated, use PIXI.Texture.from"), a.from(e, { resourceOptions: { scale: n, crossorigin: r } }) } n.prototype.generateCanvasTexture || (n.prototype.generateCanvasTexture = function() { deprecation(0, 'PIXI.Graphics#generateCanvasTexture is only available in "pixi.js-legacy"') }), i.fromImage = spriteFrom.bind(null, "fromImage"), i.fromSVG = spriteFrom.bind(null, "fromSVG"), i.fromCanvas = spriteFrom.bind(null, "fromCanvas"), i.fromVideo = spriteFrom.bind(null, "fromVideo"), i.fromFrame = spriteFrom.bind(null, "fromFrame"), a.fromImage = textureFrom.bind(null, "fromImage"), a.fromSVG = textureFrom.bind(null, "fromSVG"), a.fromCanvas = textureFrom.bind(null, "fromCanvas"), a.fromVideo = textureFrom.bind(null, "fromVideo"), a.fromFrame = textureFrom.bind(null, "fromFrame"), Object.defineProperty(e.AbstractRenderer.prototype, "autoResize", { get: function() { return deprecation(0, "PIXI.AbstractRenderer autoResize is deprecated, use autoDensity"), this.autoDensity }, set: function(t) { deprecation(0, "PIXI.AbstractRenderer autoResize is deprecated, use autoDensity"), this.autoDensity = t } }), e.utils.mixins = { mixin: function() { deprecation(0, "PIXI.utils.mixins.mixin no longer available") }, delayMixin: function() { deprecation(0, "PIXI.utils.mixins.delayMixin no longer available") }, performMixins: function() { deprecation(0, "PIXI.utils.mixins.performMixins no longer available") } } } $e.registerPlugin("accessibility", vt), $e.registerPlugin("extract", fr), $e.registerPlugin("interaction", br), $e.registerPlugin("particle", bn), $e.registerPlugin("prepare", tn), $e.registerPlugin("batch", cr), $e.registerPlugin("tilingSprite", Pn), mn.registerPlugin(On), mn.registerPlugin(Tn), rn.registerPlugin(St), rn.registerPlugin(vn); var ri = "5.0.0-rc.3", ni = { AlphaFilter: Cn, BlurFilter: Ln, BlurFilterPass: kn, ColorMatrixFilter: Nn, DisplacementFilter: Bn, FXAAFilter: Un, NoiseFilter: Gn } }, function(t, e, r) { var m = r(9), v = r(32), g = r(25), y = r(26), _ = r(33), b = "prototype", x = function(t, e, r) { var n, i, o, a, s = t & x.F, u = t & x.G, h = t & x.S, c = t & x.P, l = t & x.B, f = u ? m : h ? m[e] || (m[e] = {}) : (m[e] || {})[b], d = u ? v : v[e] || (v[e] = {}), p = d[b] || (d[b] = {}); for (n in u && (r = e), r) o = ((i = !s && f && void 0 !== f[n]) ? f : r)[n], a = l && i ? _(o, m) : c && "function" == typeof o ? _(Function.call, o) : o, f && y(f, n, o, t & x.U), d[n] != o && g(d, n, a), c && p[n] != o && (p[n] = o) }; m.core = v, x.F = 1, x.G = 2, x.S = 4, x.P = 8, x.B = 16, x.W = 32, x.U = 64, x.R = 128, t.exports = x }, function(t, e, r) { "use strict"; var n = {}; r.r(n), r.d(n, "DEG2RAD", function() { return u }), r.d(n, "RAD2DEG", function() { return h }), r.d(n, "generateUUID", function() { return generateUUID }), r.d(n, "clamp", function() { return Math_clamp }), r.d(n, "euclideanModulo", function() { return euclideanModulo }), r.d(n, "mapLinear", function() { return mapLinear }), r.d(n, "lerp", function() { return lerp }), r.d(n, "smoothstep", function() { return smoothstep }), r.d(n, "smootherstep", function() { return smootherstep }), r.d(n, "randInt", function() { return randInt }), r.d(n, "randFloat", function() { return randFloat }), r.d(n, "randFloatSpread", function() { return randFloatSpread }), r.d(n, "degToRad", function() { return degToRad }), r.d(n, "radToDeg", function() { return radToDeg }), r.d(n, "isPowerOfTwo", function() { return isPowerOfTwo }), r.d(n, "ceilPowerOfTwo", function() { return ceilPowerOfTwo }), r.d(n, "floorPowerOfTwo", function() { return floorPowerOfTwo }); var i = r(90); function _inheritsLoose(t, e) { t.prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e } function _defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } for (var o = function() { function BufferAttribute(t, e, r) { if (Array.isArray(t)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.name = "", this.array = t, this.itemSize = e, this.count = void 0 !== t ? t.length / e : 0, this.normalized = !0 === r, this.dynamic = !1, this.updateRange = { offset: 0, count: -1 }, this.version = 0, this.isBufferAttribute = !0 } var t, e, r, n = BufferAttribute.prototype; return n.onUploadCallback = function() {}, n.setArray = function(t) { if (Array.isArray(t)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); return this.count = void 0 !== t ? t.length / this.itemSize : 0, this.array = t, this }, n.setDynamic = function(t) { return this.dynamic = t, this }, n.copy = function(t) { return this.name = t.name, this.array = new t.array.constructor(t.array), this.itemSize = t.itemSize, this.count = t.count, this.normalized = t.normalized, this.dynamic = t.dynamic, this }, n.copyAt = function(t, e, r) { t *= this.itemSize, r *= e.itemSize; for (var n = 0, i = this.itemSize; n < i; n++) this.array[t + n] = e.array[r + n]; return this }, n.copyArray = function(t) { return this.array.set(t), this }, n.copyColorsArray = function(t) { for (var e = this.array, r = 0, n = 0, i = t.length; n < i; n++) { var o = t[n]; void 0 === o && (o = new Color), e[r++] = o.r, e[r++] = o.g, e[r++] = o.b } return this }, n.copyVector2sArray = function(t) { for (var e = this.array, r = 0, n = 0, i = t.length; n < i; n++) { var o = t[n]; void 0 === o && (o = new Vector2), e[r++] = o.x, e[r++] = o.y } return this }, n.copyVector3sArray = function(t) { for (var e = this.array, r = 0, n = 0, i = t.length; n < i; n++) { var o = t[n]; void 0 === o && (o = new Vector3), e[r++] = o.x, e[r++] = o.y, e[r++] = o.z } return this }, n.copyVector4sArray = function(t) { for (var e = this.array, r = 0, n = 0, i = t.length; n < i; n++) { var o = t[n]; void 0 === o && (o = new Vector4), e[r++] = o.x, e[r++] = o.y, e[r++] = o.z, e[r++] = o.w } return this }, n.set = function(t, e) { return void 0 === e && (e = 0), this.array.set(t, e), this }, n.getX = function(t) { return this.array[t * this.itemSize] }, n.setX = function(t, e) { return this.array[t * this.itemSize] = e, this }, n.getY = function(t) { return this.array[t * this.itemSize + 1] }, n.setY = function(t, e) { return this.array[t * this.itemSize + 1] = e, this }, n.getZ = function(t) { return this.array[t * this.itemSize + 2] }, n.setZ = function(t, e) { return this.array[t * this.itemSize + 2] = e, this }, n.getW = function(t) { return this.array[t * this.itemSize + 3] }, n.setW = function(t, e) { return this.array[t * this.itemSize + 3] = e, this }, n.setXY = function(t, e, r) { return t *= this.itemSize, this.array[t + 0] = e, this.array[t + 1] = r, this }, n.setXYZ = function(t, e, r, n) { return t *= this.itemSize, this.array[t + 0] = e, this.array[t + 1] = r, this.array[t + 2] = n, this }, n.setXYZW = function(t, e, r, n, i) { return t *= this.itemSize, this.array[t + 0] = e, this.array[t + 1] = r, this.array[t + 2] = n, this.array[t + 3] = i, this }, n.onUpload = function(t) { return this.onUploadCallback = t, this }, n.clone = function() { return new this.constructor(this.array, this.itemSize).copy(this) }, t = BufferAttribute, (e = [{ key: "needsUpdate", set: function(t) { !0 === t && this.version++ } }]) && _defineProperties(t.prototype, e), r && _defineProperties(t, r), BufferAttribute }(), a = function(n) { function Float32BufferAttribute(t, e, r) { return n.call(this, new Float32Array(t), e, r) || this } return _inheritsLoose(Float32BufferAttribute, n), Float32BufferAttribute }(o), s = function(n) { function Uint16BufferAttribute(t, e, r) { return n.call(this, new Uint16Array(t), e, r) || this } return _inheritsLoose(Uint16BufferAttribute, n), Uint16BufferAttribute }(o), u = Math.PI / 180, h = 180 / Math.PI, c = [], l = 0; l < 256; l++) c[l] = (l < 16 ? "0" : "") + l.toString(16); function generateUUID() { var t = 4294967295 * Math.random() | 0, e = 4294967295 * Math.random() | 0, r = 4294967295 * Math.random() | 0, n = 4294967295 * Math.random() | 0; return (c[255 & t] + c[t >> 8 & 255] + c[t >> 16 & 255] + c[t >> 24 & 255] + "-" + c[255 & e] + c[e >> 8 & 255] + "-" + c[e >> 16 & 15 | 64] + c[e >> 24 & 255] + "-" + c[63 & r | 128] + c[r >> 8 & 255] + "-" + c[r >> 16 & 255] + c[r >> 24 & 255] + c[255 & n] + c[n >> 8 & 255] + c[n >> 16 & 255] + c[n >> 24 & 255]).toUpperCase() } function Math_clamp(t, e, r) { return Math.max(e, Math.min(r, t)) } function euclideanModulo(t, e) { return (t % e + e) % e } function mapLinear(t, e, r, n, i) { return n + (t - e) * (i - n) / (r - e) } function lerp(t, e, r) { return (1 - r) * t + r * e } function smoothstep(t, e, r) { return t <= e ? 0 : r <= t ? 1 : (t = (t - e) / (r - e)) * t * (3 - 2 * t) } function smootherstep(t, e, r) { return t <= e ? 0 : r <= t ? 1 : (t = (t - e) / (r - e)) * t * t * (t * (6 * t - 15) + 10) } function randInt(t, e) { return t + Math.floor(Math.random() * (e - t + 1)) } function randFloat(t, e) { return t + Math.random() * (e - t) } function randFloatSpread(t) { return t * (.5 - Math.random()) } function degToRad(t) { return t * u } function radToDeg(t) { return t * h } function isPowerOfTwo(t) { return 0 == (t & t - 1) && 0 !== t } function ceilPowerOfTwo(t) { return Math.pow(2, Math.ceil(Math.log(t) / Math.LN2)) } function floorPowerOfTwo(t) { return Math.pow(2, Math.floor(Math.log(t) / Math.LN2)) } var f = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }; function hue2rgb(t, e, r) { return r < 0 && (r += 1), 1 < r && (r -= 1), r < 1 / 6 ? t + 6 * (e - t) * r : r < .5 ? e : r < 2 / 3 ? t + 6 * (e - t) * (2 / 3 - r) : t } function SRGBToLinear(t) { return t < .04045 ? .0773993808 * t : Math.pow(.9478672986 * t + .0521327014, 2.4) } function LinearToSRGB(t) { return t < .0031308 ? 12.92 * t : 1.055 * Math.pow(t, .41666) - .055 } var d = { h: 0, s: 0, l: 0 }, p = { h: 0, s: 0, l: 0 }, m = function() { function Color() {} var t = Color.prototype; return t.copnstructor = function(t, e, r) { return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, void 0 === e && void 0 === r ? this.set(t) : this.setRGB(t, e, r) }, t.set = function(t) { return t && t.isColor ? this.copy(t) : "number" == typeof t ? this.setHex(t) : "string" == typeof t && this.setStyle(t), this }, t.setScalar = function(t) { return this.r = t, this.g = t, this.b = t, this }, t.setHex = function(t) { return t = Math.floor(t), this.r = (t >> 16 & 255) / 255, this.g = (t >> 8 & 255) / 255, this.b = (255 & t) / 255, this }, t.setRGB = function(t, e, r) { return this.r = t, this.g = e, this.b = r, this }, t.setHSL = function(t, e, r) { if (t = euclideanModulo(t, 1), e = Math_clamp(e, 0, 1), r = Math_clamp(r, 0, 1), 0 === e) this.r = this.g = this.b = r; else { var n = r <= .5 ? r * (1 + e) : r + e - r * e, i = 2 * r - n; this.r = hue2rgb(i, n, t + 1 / 3), this.g = hue2rgb(i, n, t), this.b = hue2rgb(i, n, t - 1 / 3) } return this }, t.setStyle = function(t) { function handleAlpha(t) { void 0 !== t && parseFloat(t) } var e; if (e = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)) { var r, n = e[1], i = e[2]; switch (n) { case "rgb": case "rgba": if (r = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) return this.r = Math.min(255, parseInt(r[1], 10)) / 255, this.g = Math.min(255, parseInt(r[2], 10)) / 255, this.b = Math.min(255, parseInt(r[3], 10)) / 255, handleAlpha(r[5]), this; if (r = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) return this.r = Math.min(100, parseInt(r[1], 10)) / 100, this.g = Math.min(100, parseInt(r[2], 10)) / 100, this.b = Math.min(100, parseInt(r[3], 10)) / 100, handleAlpha(r[5]), this; break; case "hsl": case "hsla": if (r = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) { var o = parseFloat(r[1]) / 360, a = parseInt(r[2], 10) / 100, s = parseInt(r[3], 10) / 100; return handleAlpha(r[5]), this.setHSL(o, a, s) } } } else if (e = /^\#([A-Fa-f0-9]+)$/.exec(t)) { var u = e[1], h = u.length; if (3 === h) return this.r = parseInt(u.charAt(0) + u.charAt(0), 16) / 255, this.g = parseInt(u.charAt(1) + u.charAt(1), 16) / 255, this.b = parseInt(u.charAt(2) + u.charAt(2), 16) / 255, this; if (6 === h) return this.r = parseInt(u.charAt(0) + u.charAt(1), 16) / 255, this.g = parseInt(u.charAt(2) + u.charAt(3), 16) / 255, this.b = parseInt(u.charAt(4) + u.charAt(5), 16) / 255, this } if (t && 0 < t.length) { var c = f[t]; void 0 !== c && this.setHex(c) } return this }, t.clone = function() { return new this.constructor(this.r, this.g, this.b) }, t.copy = function(t) { return this.r = t.r, this.g = t.g, this.b = t.b, this }, t.copyGammaToLinear = function(t, e) { return void 0 === e && (e = 2), this.r = Math.pow(t.r, e), this.g = Math.pow(t.g, e), this.b = Math.pow(t.b, e), this }, t.copyLinearToGamma = function(t, e) { void 0 === e && (e = 2); var r = 0 < e ? 1 / e : 1; return this.r = Math.pow(t.r, r), this.g = Math.pow(t.g, r), this.b = Math.pow(t.b, r), this }, t.convertGammaToLinear = function(t) { return this.copyGammaToLinear(this, t), this }, t.convertLinearToGamma = function(t) { return this.copyLinearToGamma(this, t), this }, t.copySRGBToLinear = function(t) { return this.r = SRGBToLinear(t.r), this.g = SRGBToLinear(t.g), this.b = SRGBToLinear(t.b), this }, t.copyLinearToSRGB = function(t) { this.r = LinearToSRGB(t.r), this.g = LinearToSRGB(t.g), this.b = LinearToSRGB(t.b) }, t.convertSRGBToLinear = function() { return this.copySRGBToLinear(this), this }, t.convertLinearToSRGB = function() { return this.copyLinearToSRGB(this), this }, t.getHex = function() { return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0 }, t.getHexString = function() { return ("000000" + this.getHex().toString(16)).slice(-6) }, t.getHSL = function(t) { void 0 === t && (t = { h: 0, s: 0, l: 0 }); var e, r, n = this.r, i = this.g, o = this.b, a = Math.max(n, i, o), s = Math.min(n, i, o), u = (s + a) / 2; if (s === a) r = e = 0; else { var h = a - s; switch (r = u <= .5 ? h / (a + s) : h / (2 - a - s), a) { case n: e = (i - o) / h + (i < o ? 6 : 0); break; case i: e = (o - n) / h + 2; break; case o: e = (n - i) / h + 4 } e /= 6 } return t.h = e, t.s = r, t.l = u, t }, t.getStyle = function() { return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")" }, t.offsetHSL = function(t, e, r) { var n = tempHsl; return this.getHSL(n), n.h += t, n.s += e, n.l += r, this.setHSL(n.h, n.s, n.l), this }, t.add = function(t) { return this.r += t.r, this.g += t.g, this.b += t.b, this }, t.addColors = function(t, e) { return this.r = t.r + e.r, this.g = t.g + e.g, this.b = t.b + e.b, this }, t.addScalar = function(t) { return this.r += t, this.g += t, this.b += t, this }, t.sub = function(t) { return this.r = Math.max(0, this.r - t.r), this.g = Math.max(0, this.g - t.g), this.b = Math.max(0, this.b - t.b), this }, t.multiply = function(t) { return this.r *= t.r, this.g *= t.g, this.b *= t.b, this }, t.multiplyScalar = function(t) { return this.r *= t, this.g *= t, this.b *= t, this }, t.lerp = function(t, e) { return this.r += (t.r - this.r) * e, this.g += (t.g - this.g) * e, this.b += (t.b - this.b) * e, this }, t.lerpHSL = function(t, e) { var r = d, n = p; this.getHSL(r), t.getHSL(n); var i = lerp(r.h, n.h, e), o = lerp(r.s, n.s, e), a = lerp(r.l, n.l, e); return this.setHSL(i, o, a), this }, t.equals = function(t) { return t.r === this.r && t.g === this.g && t.b === this.b }, t.fromArray = function(t, e) { return void 0 === e && (e = 0), this.r = t[e], this.g = t[e + 1], this.b = t[e + 2], this }, t.toArray = function(t, e) { return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.r, t[e + 1] = this.g, t[e + 2] = this.b, t }, t.toJSON = function() { return this.getHex() }, Color }(), v = function() { function Vector3(t, e, r) { this.x = t || 0, this.y = e || 0, this.z = r || 0, this.isVector3 = !0 } var t = Vector3.prototype; return t.set = function(t, e, r) { return this.x = t, this.y = e, this.z = r, this }, t.setScalar = function(t) { return this.x = t, this.y = t, this.z = t, this }, t.setX = function(t) { return this.x = t, this }, t.setY = function(t) { return this.y = t, this }, t.setZ = function(t) { return this.z = t, this }, t.setComponent = function(t, e) { switch (t) { case 0: this.x = e; break; case 1: this.y = e; break; case 2: this.z = e; break; default: throw new Error("index is out of range: " + t) } return this }, t.getComponent = function(t) { switch (t) { case 0: return this.x; case 1: return this.y; case 2: return this.z; default: throw new Error("index is out of range: " + t) } }, t.clone = function() { return new this.constructor(this.x, this.y, this.z) }, t.copy = function(t) { return this.x = t.x, this.y = t.y, this.z = t.z, this }, t.add = function(t, e) { return void 0 !== e ? this.addVectors(t, e) : (this.x += t.x, this.y += t.y, this.z += t.z, this) }, t.addScalar = function(t) { return this.x += t, this.y += t, this.z += t, this }, t.addVectors = function(t, e) { return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this }, t.addScaledVector = function(t, e) { return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this }, t.sub = function(t, e) { return void 0 !== e ? this.subVectors(t, e) : (this.x -= t.x, this.y -= t.y, this.z -= t.z, this) }, t.subScalar = function(t) { return this.x -= t, this.y -= t, this.z -= t, this }, t.subVectors = function(t, e) { return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this }, t.multiply = function(t, e) { return void 0 !== e ? this.multiplyVectors(t, e) : (this.x *= t.x, this.y *= t.y, this.z *= t.z, this) }, t.multiplyScalar = function(t) { return this.x *= t, this.y *= t, this.z *= t, this }, t.multiplyVectors = function(t, e) { return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this }, t.applyMatrix3 = function(t) { var e = this.x, r = this.y, n = this.z, i = t.elements; return this.x = i[0] * e + i[3] * r + i[6] * n, this.y = i[1] * e + i[4] * r + i[7] * n, this.z = i[2] * e + i[5] * r + i[8] * n, this }, t.applyMatrix4 = function(t) { var e = this.x, r = this.y, n = this.z, i = t.elements, o = 1 / (i[3] * e + i[7] * r + i[11] * n + i[15]); return this.x = (i[0] * e + i[4] * r + i[8] * n + i[12]) * o, this.y = (i[1] * e + i[5] * r + i[9] * n + i[13]) * o, this.z = (i[2] * e + i[6] * r + i[10] * n + i[14]) * o, this }, t.applyQuaternion = function(t) { var e = this.x, r = this.y, n = this.z, i = t.x, o = t.y, a = t.z, s = t.w, u = s * e + o * n - a * r, h = s * r + a * e - i * n, c = s * n + i * r - o * e, l = -i * e - o * r - a * n; return this.x = u * s + l * -i + h * -a - c * -o, this.y = h * s + l * -o + c * -i - u * -a, this.z = c * s + l * -a + u * -o - h * -i, this }, t.transformDirection = function(t) { var e = this.x, r = this.y, n = this.z, i = t.elements; return this.x = i[0] * e + i[4] * r + i[8] * n, this.y = i[1] * e + i[5] * r + i[9] * n, this.z = i[2] * e + i[6] * r + i[10] * n, this.normalize() }, t.divide = function(t) { return this.x /= t.x, this.y /= t.y, this.z /= t.z, this }, t.divideScalar = function(t) { return this.multiplyScalar(1 / t) }, t.min = function(t) { return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this }, t.max = function(t) { return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this }, t.clamp = function(t, e) { return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this }, t.clampScalar = function(t, e) { var r = g, n = y; return r.set(t, t, t), n.set(e, e, e), this.clamp(r, n) }, t.clampLength = function(t, e) { var r = this.length(); return this.divideScalar(r || 1).multiplyScalar(Math.max(t, Math.min(e, r))) }, t.floor = function() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this }, t.ceil = function() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this }, t.round = function() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this }, t.roundToZero = function() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this }, t.negate = function() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this }, t.dot = function(t) { return this.x * t.x + this.y * t.y + this.z * t.z }, t.lengthSq = function() { return this.x * this.x + this.y * this.y + this.z * this.z }, t.length = function() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z) }, t.manhattanLength = function() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) }, t.normalize = function() { return this.divideScalar(this.length() || 1) }, t.setLength = function(t) { return this.normalize().multiplyScalar(t) }, t.lerp = function(t, e) { return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this }, t.lerpVectors = function(t, e, r) { return this.subVectors(e, t).multiplyScalar(r).add(t) }, t.cross = function(t, e) { return void 0 !== e ? this.crossVectors(t, e) : this.crossVectors(this, t) }, t.crossVectors = function(t, e) { var r = t.x, n = t.y, i = t.z, o = e.x, a = e.y, s = e.z; return this.x = n * s - i * a, this.y = i * o - r * s, this.z = r * a - n * o, this }, t.projectOnVector = function(t) { var e = t.dot(this) / t.lengthSq(); return this.copy(t).multiplyScalar(e) }, t.projectOnPlane = function(t) { var e = g; return e.copy(this).projectOnVector(t), this.sub(e) }, t.reflect = function(t) { var e = new g; return this.sub(e.copy(t).multiplyScalar(2 * this.dot(t))) }, t.angleTo = function(t) { var e = this.dot(t) / Math.sqrt(this.lengthSq() * t.lengthSq()); return Math.acos(Math_clamp(e, -1, 1)) }, t.distanceTo = function(t) { return Math.sqrt(this.distanceToSquared(t)) }, t.distanceToSquared = function(t) { var e = this.x - t.x, r = this.y - t.y, n = this.z - t.z; return e * e + r * r + n * n }, t.manhattanDistanceTo = function(t) { return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z) }, t.setFromSpherical = function(t) { return this.setFromSphericalCoords(t.radius, t.phi, t.theta) }, t.setFromSphericalCoords = function(t, e, r) { var n = Math.sin(e) * t; return this.x = n * Math.sin(r), this.y = Math.cos(e) * t, this.z = n * Math.cos(r), this }, t.setFromCylindrical = function(t) { return this.setFromCylindricalCoords(t.radius, t.theta, t.y) }, t.setFromCylindricalCoords = function(t, e, r) { return this.x = t * Math.sin(e), this.y = r, this.z = t * Math.cos(e), this }, t.setFromMatrixPosition = function(t) { var e = t.elements; return this.x = e[12], this.y = e[13], this.z = e[14], this }, t.setFromMatrixScale = function(t) { var e = this.setFromMatrixColumn(t, 0).length(), r = this.setFromMatrixColumn(t, 1).length(), n = this.setFromMatrixColumn(t, 2).length(); return this.x = e, this.y = r, this.z = n, this }, t.setFromMatrixColumn = function(t, e) { return this.fromArray(t.elements, 4 * e) }, t.equals = function(t) { return t.x === this.x && t.y === this.y && t.z === this.z }, t.fromArray = function(t, e) { return void 0 === e && (e = 0), this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this }, t.toArray = function(t, e) { return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t }, t.fromBufferAttribute = function(t, e, r) { return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this }, Vector3 }(), g = new v, y = new v, _ = function() { function Vector4(t, e, r, n) { this.x = t || 0, this.y = e || 0, this.z = r || 0, this.w = void 0 !== n ? n : 1, this.isVector4 = !0 } var t = Vector4.prototype; return t.set = function(t, e, r, n) { return this.x = t, this.y = e, this.z = r, this.w = n, this }, t.setScalar = function(t) { return this.x = t, this.y = t, this.z = t, this.w = t, this }, t.setX = function(t) { return this.x = t, this }, t.setY = function(t) { return this.y = t, this }, t.setZ = function(t) { return this.z = t, this }, t.setW = function(t) { return this.w = t, this }, t.setComponent = function(t, e) { switch (t) { case 0: this.x = e; break; case 1: this.y = e; break; case 2: this.z = e; break; case 3: this.w = e; break; default: throw new Error("index is out of range: " + t) } return this }, t.getComponent = function(t) { switch (t) { case 0: return this.x; case 1: return this.y; case 2: return this.z; case 3: return this.w; default: throw new Error("index is out of range: " + t) } }, t.clone = function() { return new this.constructor(this.x, this.y, this.z, this.w) }, t.copy = function(t) { return this.x = t.x, this.y = t.y, this.z = t.z, this.w = void 0 !== t.w ? t.w : 1, this }, t.add = function(t, e) { return void 0 !== e ? this.addVectors(t, e) : (this.x += t.x, this.y += t.y, this.z += t.z, this.w += t.w, this) }, t.addScalar = function(t) { return this.x += t, this.y += t, this.z += t, this.w += t, this }, t.addVectors = function(t, e) { return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this.w = t.w + e.w, this }, t.addScaledVector = function(t, e) { return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this.w += t.w * e, this }, t.sub = function(t, e) { return void 0 !== e ? this.subVectors(t, e) : (this.x -= t.x, this.y -= t.y, this.z -= t.z, this.w -= t.w, this) }, t.subScalar = function(t) { return this.x -= t, this.y -= t, this.z -= t, this.w -= t, this }, t.subVectors = function(t, e) { return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this.w = t.w - e.w, this }, t.multiplyScalar = function(t) { return this.x *= t, this.y *= t, this.z *= t, this.w *= t, this }, t.applyMatrix4 = function(t) { var e = this.x, r = this.y, n = this.z, i = this.w, o = t.elements; return this.x = o[0] * e + o[4] * r + o[8] * n + o[12] * i, this.y = o[1] * e + o[5] * r + o[9] * n + o[13] * i, this.z = o[2] * e + o[6] * r + o[10] * n + o[14] * i, this.w = o[3] * e + o[7] * r + o[11] * n + o[15] * i, this }, t.divideScalar = function(t) { return this.multiplyScalar(1 / t) }, t.setAxisAngleFromQuaternion = function(t) { this.w = 2 * Math.acos(t.w); var e = Math.sqrt(1 - t.w * t.w); return this.z = e < 1e-4 ? (this.x = 1, this.y = 0) : (this.x = t.x / e, this.y = t.y / e, t.z / e), this }, t.setAxisAngleFromRotationMatrix = function(t) { var e, r, n, i, o = t.elements, a = o[0], s = o[4], u = o[8], h = o[1], c = o[5], l = o[9], f = o[2], d = o[6], p = o[10]; if (Math.abs(s - h) < .01 && Math.abs(u - f) < .01 && Math.abs(l - d) < .01) { if (Math.abs(s + h) < .1 && Math.abs(u + f) < .1 && Math.abs(l + d) < .1 && Math.abs(a + c + p - 3) < .1) return this.set(1, 0, 0, 0), this; e = Math.PI; var m = (a + 1) / 2, v = (c + 1) / 2, g = (p + 1) / 2, y = (s + h) / 4, _ = (u + f) / 4, b = (l + d) / 4; return v < m && g < m ? i = m < .01 ? (r = 0, n = .707106781) : (n = y / (r = Math.sqrt(m)), _ / r) : g < v ? i = v < .01 ? (n = 0, r = .707106781) : (r = y / (n = Math.sqrt(v)), b / n) : g < .01 ? (n = r = .707106781, i = 0) : (r = _ / (i = Math.sqrt(g)), n = b / i), this.set(r, n, i, e), this } var x = Math.sqrt((d - l) * (d - l) + (u - f) * (u - f) + (h - s) * (h - s)); return Math.abs(x) < .001 && (x = 1), this.x = (d - l) / x, this.y = (u - f) / x, this.z = (h - s) / x, this.w = Math.acos((a + c + p - 1) / 2), this }, t.min = function(t) { return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this.w = Math.min(this.w, t.w), this }, t.max = function(t) { return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this.w = Math.max(this.w, t.w), this }, t.clamp = function(t, e) { return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this.w = Math.max(t.w, Math.min(e.w, this.w)), this }, t.clampScalar = function(t, e) { var r = b, n = x; return r.set(t, t, t, t), n.set(e, e, e, e), this.clamp(r, n) }, t.clampLength = function(t, e) { var r = this.length(); return this.divideScalar(r || 1).multiplyScalar(Math.max(t, Math.min(e, r))) }, t.floor = function() { return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this }, t.ceil = function() { return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this }, t.round = function() { return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this }, t.roundToZero = function() { return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this }, t.negate = function() { return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this }, t.dot = function(t) { return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w }, t.lengthSq = function() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w }, t.length = function() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w) }, t.manhattanLength = function() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w) }, t.normalize = function() { return this.divideScalar(this.length() || 1) }, t.setLength = function(t) { return this.normalize().multiplyScalar(t) }, t.lerp = function(t, e) { return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this.w += (t.w - this.w) * e, this }, t.lerpVectors = function(t, e, r) { return this.subVectors(e, t).multiplyScalar(r).add(t) }, t.equals = function(t) { return t.x === this.x && t.y === this.y && t.z === this.z && t.w === this.w }, t.fromArray = function(t, e) { return void 0 === e && (e = 0), this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this.w = t[e + 3], this }, t.toArray = function(t, e) { return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t[e + 3] = this.w, t }, t.fromBufferAttribute = function(t, e, r) { return this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this.w = t.getW(e), this }, Vector4 }(), b = new _, x = new _, w = function() { function Matrix3() { this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], arguments.length, this.isMatrix3 = !0 } var t = Matrix3.prototype; return t.set = function(t, e, r, n, i, o, a, s, u) { var h = this.elements; return h[0] = t, h[1] = n, h[2] = a, h[3] = e, h[4] = i, h[5] = s, h[6] = r, h[7] = o, h[8] = u, this }, t.identity = function() { return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this }, t.clone = function() { return (new this.constructor).fromArray(this.elements) }, t.copy = function(t) { var e = this.elements, r = t.elements; return e[0] = r[0], e[1] = r[1], e[2] = r[2], e[3] = r[3], e[4] = r[4], e[5] = r[5], e[6] = r[6], e[7] = r[7], e[8] = r[8], this }, t.setFromMatrix4 = function(t) { var e = t.elements; return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]), this }, t.applyToBufferAttribute = function(t) { for (var e = T, r = 0, n = t.count; r < n; r++) e.x = t.getX(r), e.y = t.getY(r), e.z = t.getZ(r), e.applyMatrix3(this), t.setXYZ(r, e.x, e.y, e.z); return t }, t.multiply = function(t) { return this.multiplyMatrices(this, t) }, t.premultiply = function(t) { return this.multiplyMatrices(t, this) }, t.multiplyMatrices = function(t, e) { var r = t.elements, n = e.elements, i = this.elements, o = r[0], a = r[3], s = r[6], u = r[1], h = r[4], c = r[7], l = r[2], f = r[5], d = r[8], p = n[0], m = n[3], v = n[6], g = n[1], y = n[4], _ = n[7], b = n[2], x = n[5], w = n[8]; return i[0] = o * p + a * g + s * b, i[3] = o * m + a * y + s * x, i[6] = o * v + a * _ + s * w, i[1] = u * p + h * g + c * b, i[4] = u * m + h * y + c * x, i[7] = u * v + h * _ + c * w, i[2] = l * p + f * g + d * b, i[5] = l * m + f * y + d * x, i[8] = l * v + f * _ + d * w, this }, t.multiplyScalar = function(t) { var e = this.elements; return e[0] *= t, e[3] *= t, e[6] *= t, e[1] *= t, e[4] *= t, e[7] *= t, e[2] *= t, e[5] *= t, e[8] *= t, this }, t.determinant = function() { var t = this.elements, e = t[0], r = t[1], n = t[2], i = t[3], o = t[4], a = t[5], s = t[6], u = t[7], h = t[8]; return e * o * h - e * a * u - r * i * h + r * a * s + n * i * u - n * o * s }, t.getInverse = function(t, e) { t && t.isMatrix4; var r = t.elements, n = this.elements, i = r[0], o = r[1], a = r[2], s = r[3], u = r[4], h = r[5], c = r[6], l = r[7], f = r[8], d = f * u - h * l, p = h * c - f * s, m = l * s - u * c, v = i * d + o * p + a * m; if (0 === v) { var g = "THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0"; if (!0 === e) throw new Error(g); return this.identity() } var y = 1 / v; return n[0] = d * y, n[1] = (a * l - f * o) * y, n[2] = (h * o - a * u) * y, n[3] = p * y, n[4] = (f * i - a * c) * y, n[5] = (a * s - h * i) * y, n[6] = m * y, n[7] = (o * c - l * i) * y, n[8] = (u * i - o * s) * y, this }, t.transpose = function() { var t, e = this.elements; return t = e[1], e[1] = e[3], e[3] = t, t = e[2], e[2] = e[6], e[6] = t, t = e[5], e[5] = e[7], e[7] = t, this }, t.getNormalMatrix = function(t) { return this.setFromMatrix4(t).getInverse(this).transpose() }, t.transposeIntoArray = function(t) { var e = this.elements; return t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = e[1], t[4] = e[4], t[5] = e[7], t[6] = e[2], t[7] = e[5], t[8] = e[8], this }, t.setUvTransform = function(t, e, r, n, i, o, a) { var s = Math.cos(i), u = Math.sin(i); this.set(r * s, r * u, -r * (s * o + u * a) + o + t, -n * u, n * s, -n * (-u * o + s * a) + a + e, 0, 0, 1) }, t.scale = function(t, e) { var r = this.elements; return r[0] *= t, r[3] *= t, r[6] *= t, r[1] *= e, r[4] *= e, r[7] *= e, this }, t.rotate = function(t) { var e = Math.cos(t), r = Math.sin(t), n = this.elements, i = n[0], o = n[3], a = n[6], s = n[1], u = n[4], h = n[7]; return n[0] = e * i + r * s, n[3] = e * o + r * u, n[6] = e * a + r * h, n[1] = -r * i + e * s, n[4] = -r * o + e * u, n[7] = -r * a + e * h, this }, t.translate = function(t, e) { var r = this.elements; return r[0] += t * r[2], r[3] += t * r[5], r[6] += t * r[8], r[1] += e * r[2], r[4] += e * r[5], r[7] += e * r[8], this }, t.equals = function(t) { for (var e = this.elements, r = t.elements, n = 0; n < 9; n++) if (e[n] !== r[n]) return !1; return !0 }, t.fromArray = function(t, e) { void 0 === e && (e = 0); for (var r = 0; r < 9; r++) this.elements[r] = t[r + e]; return this }, t.toArray = function(t, e) { void 0 === t && (t = []), void 0 === e && (e = 0); var r = this.elements; return t[e] = r[0], t[e + 1] = r[1], t[e + 2] = r[2], t[e + 3] = r[3], t[e + 4] = r[4], t[e + 5] = r[5], t[e + 6] = r[6], t[e + 7] = r[7], t[e + 8] = r[8], t }, Matrix3 }(), T = new v, S = function() { function Matrix4() { this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], arguments.length, this.isMatrix4 = !0 } var t = Matrix4.prototype; return t.set = function(t, e, r, n, i, o, a, s, u, h, c, l, f, d, p, m) { var v = this.elements; return v[0] = t, v[4] = e, v[8] = r, v[12] = n, v[1] = i, v[5] = o, v[9] = a, v[13] = s, v[2] = u, v[6] = h, v[10] = c, v[14] = l, v[3] = f, v[7] = d, v[11] = p, v[15] = m, this }, t.identity = function() { return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this }, t.clone = function() { return (new Matrix4).fromArray(this.elements) }, t.copy = function(t) { var e = this.elements, r = t.elements; return e[0] = r[0], e[1] = r[1], e[2] = r[2], e[3] = r[3], e[4] = r[4], e[5] = r[5], e[6] = r[6], e[7] = r[7], e[8] = r[8], e[9] = r[9], e[10] = r[10], e[11] = r[11], e[12] = r[12], e[13] = r[13], e[14] = r[14], e[15] = r[15], this }, t.copyPosition = function(t) { var e = this.elements, r = t.elements; return e[12] = r[12], e[13] = r[13], e[14] = r[14], this }, t.extractBasis = function(t, e, r) { return t.setFromMatrixColumn(this, 0), e.setFromMatrixColumn(this, 1), r.setFromMatrixColumn(this, 2), this }, t.makeBasis = function(t, e, r) { return this.set(t.x, e.x, r.x, 0, t.y, e.y, r.y, 0, t.z, e.z, r.z, 0, 0, 0, 0, 1), this }, t.extractRotation = function(t) { var e = E, r = this.elements, n = t.elements, i = 1 / e.setFromMatrixColumn(t, 0).length(), o = 1 / e.setFromMatrixColumn(t, 1).length(), a = 1 / e.setFromMatrixColumn(t, 2).length(); return r[0] = n[0] * i, r[1] = n[1] * i, r[2] = n[2] * i, r[3] = 0, r[4] = n[4] * o, r[5] = n[5] * o, r[6] = n[6] * o, r[7] = 0, r[8] = n[8] * a, r[9] = n[9] * a, r[10] = n[10] * a, r[11] = 0, r[12] = 0, r[13] = 0, r[14] = 0, r[15] = 1, this }, t.makeRotationFromEuler = function(t) { !t || t.isEuler; var e = this.elements, r = t.x, n = t.y, i = t.z, o = Math.cos(r), a = Math.sin(r), s = Math.cos(n), u = Math.sin(n), h = Math.cos(i), c = Math.sin(i); if ("XYZ" === t.order) { var l = o * h, f = o * c, d = a * h, p = a * c; e[0] = s * h, e[4] = -s * c, e[8] = u, e[1] = f + d * u, e[5] = l - p * u, e[9] = -a * s, e[2] = p - l * u, e[6] = d + f * u, e[10] = o * s } else if ("YXZ" === t.order) { var m = s * h, v = s * c, g = u * h, y = u * c; e[0] = m + y * a, e[4] = g * a - v, e[8] = o * u, e[1] = o * c, e[5] = o * h, e[9] = -a, e[2] = v * a - g, e[6] = y + m * a, e[10] = o * s } else if ("ZXY" === t.order) { var _ = s * h, b = s * c, x = u * h, w = u * c; e[0] = _ - w * a, e[4] = -o * c, e[8] = x + b * a, e[1] = b + x * a, e[5] = o * h, e[9] = w - _ * a, e[2] = -o * u, e[6] = a, e[10] = o * s } else if ("ZYX" === t.order) { var T = o * h, S = o * c, M = a * h, E = a * c; e[0] = s * h, e[4] = M * u - S, e[8] = T * u + E, e[1] = s * c, e[5] = E * u + T, e[9] = S * u - M, e[2] = -u, e[6] = a * s, e[10] = o * s } else if ("YZX" === t.order) { var A = o * s, P = o * u, I = a * s, O = a * u; e[0] = s * h, e[4] = O - A * c, e[8] = I * c + P, e[1] = c, e[5] = o * h, e[9] = -a * h, e[2] = -u * h, e[6] = P * c + I, e[10] = A - O * c } else if ("XZY" === t.order) { var C = o * s, R = o * u, D = a * s, F = a * u; e[0] = s * h, e[4] = -c, e[8] = u * h, e[1] = C * c + F, e[5] = o * h, e[9] = R * c - D, e[2] = D * c - R, e[6] = a * h, e[10] = F * c + C } return e[3] = 0, e[7] = 0, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, this }, t.makeRotationFromQuaternion = function(t) { return this.compose(I, t, O) }, t.lookAt = function() { var t = E, e = A, r = P, n = this.elements; return r.subVectors(eye, target), 0 === r.lengthSq() && (r.z = 1), r.normalize(), t.crossVectors(up, r), 0 === t.lengthSq() && (1 === Math.abs(up.z) ? r.x += 1e-4 : r.z += 1e-4, r.normalize(), t.crossVectors(up, r)), t.normalize(), e.crossVectors(r, t), n[0] = t.x, n[4] = e.x, n[8] = r.x, n[1] = t.y, n[5] = e.y, n[9] = r.y, n[2] = t.z, n[6] = e.z, n[10] = r.z, this }, t.multiply = function(t, e) { return void 0 !== e ? this.multiplyMatrices(t, e) : this.multiplyMatrices(this, t) }, t.premultiply = function(t) { return this.multiplyMatrices(t, this) }, t.multiplyMatrices = function(t, e) { var r = t.elements, n = e.elements, i = this.elements, o = r[0], a = r[4], s = r[8], u = r[12], h = r[1], c = r[5], l = r[9], f = r[13], d = r[2], p = r[6], m = r[10], v = r[14], g = r[3], y = r[7], _ = r[11], b = r[15], x = n[0], w = n[4], T = n[8], S = n[12], M = n[1], E = n[5], A = n[9], P = n[13], I = n[2], O = n[6], C = n[10], R = n[14], D = n[3], F = n[7], k = n[11], L = n[15]; return i[0] = o * x + a * M + s * I + u * D, i[4] = o * w + a * E + s * O + u * F, i[8] = o * T + a * A + s * C + u * k, i[12] = o * S + a * P + s * R + u * L, i[1] = h * x + c * M + l * I + f * D, i[5] = h * w + c * E + l * O + f * F, i[9] = h * T + c * A + l * C + f * k, i[13] = h * S + c * P + l * R + f * L, i[2] = d * x + p * M + m * I + v * D, i[6] = d * w + p * E + m * O + v * F, i[10] = d * T + p * A + m * C + v * k, i[14] = d * S + p * P + m * R + v * L, i[3] = g * x + y * M + _ * I + b * D, i[7] = g * w + y * E + _ * O + b * F, i[11] = g * T + y * A + _ * C + b * k, i[15] = g * S + y * P + _ * R + b * L, this }, t.multiplyScalar = function(t) { var e = this.elements; return e[0] *= t, e[4] *= t, e[8] *= t, e[12] *= t, e[1] *= t, e[5] *= t, e[9] *= t, e[13] *= t, e[2] *= t, e[6] *= t, e[10] *= t, e[14] *= t, e[3] *= t, e[7] *= t, e[11] *= t, e[15] *= t, this }, t.applyToBufferAttribute = function(t) { for (var e = E, r = 0, n = t.count; r < n; r++) e.x = t.getX(r), e.y = t.getY(r), e.z = t.getZ(r), e.applyMatrix4(this), t.setXYZ(r, e.x, e.y, e.z); return t }, t.determinant = function() { var t = this.elements, e = t[0], r = t[4], n = t[8], i = t[12], o = t[1], a = t[5], s = t[9], u = t[13], h = t[2], c = t[6], l = t[10], f = t[14]; return t[3] * (+i * s * c - n * u * c - i * a * l + r * u * l + n * a * f - r * s * f) + t[7] * (+e * s * f - e * u * l + i * o * l - n * o * f + n * u * h - i * s * h) + t[11] * (+e * u * c - e * a * f - i * o * c + r * o * f + i * a * h - r * u * h) + t[15] * (-n * a * h - e * s * c + e * a * l + n * o * c - r * o * l + r * s * h) }, t.transpose = function() { var t, e = this.elements; return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this }, t.setPosition = function(t) { var e = this.elements; return e[12] = t.x, e[13] = t.y, e[14] = t.z, this }, t.getInverse = function(t, e) { var r = this.elements, n = t.elements, i = n[0], o = n[1], a = n[2], s = n[3], u = n[4], h = n[5], c = n[6], l = n[7], f = n[8], d = n[9], p = n[10], m = n[11], v = n[12], g = n[13], y = n[14], _ = n[15], b = d * y * l - g * p * l + g * c * m - h * y * m - d * c * _ + h * p * _, x = v * p * l - f * y * l - v * c * m + u * y * m + f * c * _ - u * p * _, w = f * g * l - v * d * l + v * h * m - u * g * m - f * h * _ + u * d * _, T = v * d * c - f * g * c - v * h * p + u * g * p + f * h * y - u * d * y, S = i * b + o * x + a * w + s * T; if (0 === S) { var M = "THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0"; if (!0 === e) throw new Error(M); return this.identity() } var E = 1 / S; return r[0] = b * E, r[1] = (g * p * s - d * y * s - g * a * m + o * y * m + d * a * _ - o * p * _) * E, r[2] = (h * y * s - g * c * s + g * a * l - o * y * l - h * a * _ + o * c * _) * E, r[3] = (d * c * s - h * p * s - d * a * l + o * p * l + h * a * m - o * c * m) * E, r[4] = x * E, r[5] = (f * y * s - v * p * s + v * a * m - i * y * m - f * a * _ + i * p * _) * E, r[6] = (v * c * s - u * y * s - v * a * l + i * y * l + u * a * _ - i * c * _) * E, r[7] = (u * p * s - f * c * s + f * a * l - i * p * l - u * a * m + i * c * m) * E, r[8] = w * E, r[9] = (v * d * s - f * g * s - v * o * m + i * g * m + f * o * _ - i * d * _) * E, r[10] = (u * g * s - v * h * s + v * o * l - i * g * l - u * o * _ + i * h * _) * E, r[11] = (f * h * s - u * d * s - f * o * l + i * d * l + u * o * m - i * h * m) * E, r[12] = T * E, r[13] = (f * g * a - v * d * a + v * o * p - i * g * p - f * o * y + i * d * y) * E, r[14] = (v * h * a - u * g * a - v * o * c + i * g * c + u * o * y - i * h * y) * E, r[15] = (u * d * a - f * h * a + f * o * c - i * d * c - u * o * p + i * h * p) * E, this }, t.scale = function(t) { var e = this.elements, r = t.x, n = t.y, i = t.z; return e[0] *= r, e[4] *= n, e[8] *= i, e[1] *= r, e[5] *= n, e[9] *= i, e[2] *= r, e[6] *= n, e[10] *= i, e[3] *= r, e[7] *= n, e[11] *= i, this }, t.getMaxScaleOnAxis = function() { var t = this.elements, e = t[0] * t[0] + t[1] * t[1] + t[2] * t[2], r = t[4] * t[4] + t[5] * t[5] + t[6] * t[6], n = t[8] * t[8] + t[9] * t[9] + t[10] * t[10]; return Math.sqrt(Math.max(e, r, n)) }, t.makeTranslation = function(t, e, r) { return this.set(1, 0, 0, t, 0, 1, 0, e, 0, 0, 1, r, 0, 0, 0, 1), this }, t.makeRotationX = function(t) { var e = Math.cos(t), r = Math.sin(t); return this.set(1, 0, 0, 0, 0, e, -r, 0, 0, r, e, 0, 0, 0, 0, 1), this }, t.makeRotationY = function(t) { var e = Math.cos(t), r = Math.sin(t); return this.set(e, 0, r, 0, 0, 1, 0, 0, -r, 0, e, 0, 0, 0, 0, 1), this }, t.makeRotationZ = function(t) { var e = Math.cos(t), r = Math.sin(t); return this.set(e, -r, 0, 0, r, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this }, t.makeRotationAxis = function(t, e) { var r = Math.cos(e), n = Math.sin(e), i = 1 - r, o = t.x, a = t.y, s = t.z, u = i * o, h = i * a; return this.set(u * o + r, u * a - n * s, u * s + n * a, 0, u * a + n * s, h * a + r, h * s - n * o, 0, u * s - n * a, h * s + n * o, i * s * s + r, 0, 0, 0, 0, 1), this }, t.makeScale = function(t, e, r) { return this.set(t, 0, 0, 0, 0, e, 0, 0, 0, 0, r, 0, 0, 0, 0, 1), this }, t.makeShear = function(t, e, r) { return this.set(1, e, r, 0, t, 1, r, 0, t, e, 1, 0, 0, 0, 0, 1), this }, t.compose = function(t, e, r) { var n = this.elements, i = e._x, o = e._y, a = e._z, s = e._w, u = i + i, h = o + o, c = a + a, l = i * u, f = i * h, d = i * c, p = o * h, m = o * c, v = a * c, g = s * u, y = s * h, _ = s * c, b = r.x, x = r.y, w = r.z; return n[0] = (1 - (p + v)) * b, n[1] = (f + _) * b, n[2] = (d - y) * b, n[3] = 0, n[4] = (f - _) * x, n[5] = (1 - (l + v)) * x, n[6] = (m + g) * x, n[7] = 0, n[8] = (d + y) * w, n[9] = (m - g) * w, n[10] = (1 - (l + p)) * w, n[11] = 0, n[12] = t.x, n[13] = t.y, n[14] = t.z, n[15] = 1, this }, t.decompose = function(t, e, r) { var n = E, i = M, o = this.elements, a = n.set(o[0], o[1], o[2]).length(), s = n.set(o[4], o[5], o[6]).length(), u = n.set(o[8], o[9], o[10]).length(); this.determinant() < 0 && (a = -a), t.x = o[12], t.y = o[13], t.z = o[14], i.copy(this); var h = 1 / a, c = 1 / s, l = 1 / u; return i.elements[0] *= h, i.elements[1] *= h, i.elements[2] *= h, i.elements[4] *= c, i.elements[5] *= c, i.elements[6] *= c, i.elements[8] *= l, i.elements[9] *= l, i.elements[10] *= l, e.setFromRotationMatrix(i), r.x = a, r.y = s, r.z = u, this }, t.makePerspective = function(t, e, r, n, i, o) { var a = this.elements, s = 2 * i / (e - t), u = 2 * i / (r - n), h = (e + t) / (e - t), c = (r + n) / (r - n), l = -(o + i) / (o - i), f = -2 * o * i / (o - i); return a[0] = s, a[4] = 0, a[8] = h, a[12] = 0, a[1] = 0, a[5] = u, a[9] = c, a[13] = 0, a[2] = 0, a[6] = 0, a[10] = l, a[14] = f, a[3] = 0, a[7] = 0, a[11] = -1, a[15] = 0, this }, t.makeOrthographic = function(t, e, r, n, i, o) { var a = this.elements, s = 1 / (e - t), u = 1 / (r - n), h = 1 / (o - i), c = (e + t) * s, l = (r + n) * u, f = (o + i) * h; return a[0] = 2 * s, a[4] = 0, a[8] = 0, a[12] = -c, a[1] = 0, a[5] = 2 * u, a[9] = 0, a[13] = -l, a[2] = 0, a[6] = 0, a[10] = -2 * h, a[14] = -f, a[3] = 0, a[7] = 0, a[11] = 0, a[15] = 1, this }, t.equals = function(t) { for (var e = this.elements, r = t.elements, n = 0; n < 16; n++) if (e[n] !== r[n]) return !1; return !0 }, t.fromArray = function(t, e) { void 0 === e && (e = 0); for (var r = 0; r < 16; r++) this.elements[r] = t[r + e]; return this }, t.toArray = function(t, e) { void 0 === t && (t = []), void 0 === e && (e = 0); var r = this.elements; return t[e] = r[0], t[e + 1] = r[1], t[e + 2] = r[2], t[e + 3] = r[3], t[e + 4] = r[4], t[e + 5] = r[5], t[e + 6] = r[6], t[e + 7] = r[7], t[e + 8] = r[8], t[e + 9] = r[9], t[e + 10] = r[10], t[e + 11] = r[11], t[e + 12] = r[12], t[e + 13] = r[13], t[e + 14] = r[14], t[e + 15] = r[15], t }, Matrix4 }(), M = new S, E = new v, A = new v, P = new v, I = new v(0, 0, 0), O = new v(1, 1, 1); function Quaternion_defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } v.prototype.project = function(t) { return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix) }, v.prototype.unproject = function(t) { var e = M; return this.applyMatrix4(e.getInverse(t.projectionMatrix)).applyMatrix4(t.matrixWorld) }; var C = function() { function Quaternion(t, e, r, n) { this._x = t || 0, this._y = e || 0, this._z = r || 0, this._w = void 0 !== n ? n : 1, this.isQuaternion = !0 } var t, e, r, n = Quaternion.prototype; return n.slerp = function(t, e, r, n) { return r.copy(t).slerp(e, n) }, Quaternion.slerpFlat = function(t, e, r, n, i, o, a) { var s = r[n + 0], u = r[n + 1], h = r[n + 2], c = r[n + 3], l = i[o + 0], f = i[o + 1], d = i[o + 2], p = i[o + 3]; if (c !== p || s !== l || u !== f || h !== d) { var m = 1 - a, v = s * l + u * f + h * d + c * p, g = 0 <= v ? 1 : -1, y = 1 - v * v; if (y > Number.EPSILON) { var _ = Math.sqrt(y), b = Math.atan2(_, v * g); m = Math.sin(m * b) / _, a = Math.sin(a * b) / _ } var x = a * g; if (s = s * m + l * x, u = u * m + f * x, h = h * m + d * x, c = c * m + p * x, m === 1 - a) { var w = 1 / Math.sqrt(s * s + u * u + h * h + c * c); s *= w, u *= w, h *= w, c *= w } } t[e] = s, t[e + 1] = u, t[e + 2] = h, t[e + 3] = c }, n.set = function(t, e, r, n) { return this._x = t, this._y = e, this._z = r, this._w = n, this.onChangeCallback(), this }, n.clone = function() { return new this.constructor(this._x, this._y, this._z, this._w) }, n.copy = function(t) { return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this.onChangeCallback(), this }, n.setFromEuler = function(t, e) { if (!t || !t.isEuler) throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."); var r = t._x, n = t._y, i = t._z, o = t.order, a = Math.cos, s = Math.sin, u = a(r / 2), h = a(n / 2), c = a(i / 2), l = s(r / 2), f = s(n / 2), d = s(i / 2); return "XYZ" === o ? (this._x = l * h * c + u * f * d, this._y = u * f * c - l * h * d, this._z = u * h * d + l * f * c, this._w = u * h * c - l * f * d) : "YXZ" === o ? (this._x = l * h * c + u * f * d, this._y = u * f * c - l * h * d, this._z = u * h * d - l * f * c, this._w = u * h * c + l * f * d) : "ZXY" === o ? (this._x = l * h * c - u * f * d, this._y = u * f * c + l * h * d, this._z = u * h * d + l * f * c, this._w = u * h * c - l * f * d) : "ZYX" === o ? (this._x = l * h * c - u * f * d, this._y = u * f * c + l * h * d, this._z = u * h * d - l * f * c, this._w = u * h * c + l * f * d) : "YZX" === o ? (this._x = l * h * c + u * f * d, this._y = u * f * c + l * h * d, this._z = u * h * d - l * f * c, this._w = u * h * c - l * f * d) : "XZY" === o && (this._x = l * h * c - u * f * d, this._y = u * f * c - l * h * d, this._z = u * h * d + l * f * c, this._w = u * h * c + l * f * d), !1 !== e && this.onChangeCallback(), this }, n.setFromAxisAngle = function(t, e) { var r = e / 2, n = Math.sin(r); return this._x = t.x * n, this._y = t.y * n, this._z = t.z * n, this._w = Math.cos(r), this.onChangeCallback(), this }, n.setFromRotationMatrix = function(t) { var e, r = t.elements, n = r[0], i = r[4], o = r[8], a = r[1], s = r[5], u = r[9], h = r[2], c = r[6], l = r[10], f = n + s + l; return this._z = 0 < f ? (e = .5 / Math.sqrt(f + 1), this._w = .25 / e, this._x = (c - u) * e, this._y = (o - h) * e, (a - i) * e) : s < n && l < n ? (e = 2 * Math.sqrt(1 + n - s - l), this._w = (c - u) / e, this._x = .25 * e, this._y = (i + a) / e, (o + h) / e) : l < s ? (e = 2 * Math.sqrt(1 + s - n - l), this._w = (o - h) / e, this._x = (i + a) / e, this._y = .25 * e, (u + c) / e) : (e = 2 * Math.sqrt(1 + l - n - s), this._w = (a - i) / e, this._x = (o + h) / e, this._y = (u + c) / e, .25 * e), this.onChangeCallback(), this }, n.setFromUnitVectors = function(t, e) { var r, n = R; return (r = t.dot(e) + 1) < 1e-6 ? (r = 0, Math.abs(t.x) > Math.abs(t.z) ? n.set(-t.y, t.x, 0) : n.set(0, -t.z, t.y)) : n.crossVectors(t, e), this._x = n.x, this._y = n.y, this._z = n.z, this._w = r, this.normalize() }, n.angleTo = function(t) { return 2 * Math.acos(Math.abs(Math_clamp(this.dot(t), -1, 1))) }, n.rotateTowards = function(t, e) { var r = this.angleTo(t); if (0 === r) return this; var n = Math.min(1, e / r); return this.slerp(t, n), this }, n.inverse = function() { return this.conjugate() }, n.conjugate = function() { return this._x *= -1, this._y *= -1, this._z *= -1, this.onChangeCallback(), this }, n.dot = function(t) { return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w }, n.lengthSq = function() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w }, n.length = function() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w) }, n.normalize = function() { var t = this.length(); return this._w = 0 === t ? (this._x = 0, this._y = 0, this._z = 0, 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w * t), this.onChangeCallback(), this }, n.multiply = function(t, e) { return void 0 !== e ? this.multiplyQuaternions(t, e) : this.multiplyQuaternions(this, t) }, n.premultiply = function(t) { return this.multiplyQuaternions(t, this) }, n.multiplyQuaternions = function(t, e) { var r = t._x, n = t._y, i = t._z, o = t._w, a = e._x, s = e._y, u = e._z, h = e._w; return this._x = r * h + o * a + n * u - i * s, this._y = n * h + o * s + i * a - r * u, this._z = i * h + o * u + r * s - n * a, this._w = o * h - r * a - n * s - i * u, this.onChangeCallback(), this }, n.slerp = function(t, e) { if (0 === e) return this; if (1 === e) return this.copy(t); var r = this._x, n = this._y, i = this._z, o = this._w, a = o * t._w + r * t._x + n * t._y + i * t._z; if (a < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, a = -a) : this.copy(t), 1 <= a) return this._w = o, this._x = r, this._y = n, this._z = i, this; var s = 1 - a * a; if (s <= Number.EPSILON) { var u = 1 - e; return this._w = u * o + e * this._w, this._x = u * r + e * this._x, this._y = u * n + e * this._y, this._z = u * i + e * this._z, this.normalize() } var h = Math.sqrt(s), c = Math.atan2(h, a), l = Math.sin((1 - e) * c) / h, f = Math.sin(e * c) / h; return this._w = o * l + this._w * f, this._x = r * l + this._x * f, this._y = n * l + this._y * f, this._z = i * l + this._z * f, this.onChangeCallback(), this }, n.equals = function(t) { return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w }, n.fromArray = function(t, e) { return void 0 === e && (e = 0), this._x = t[e], this._y = t[e + 1], this._z = t[e + 2], this._w = t[e + 3], this.onChangeCallback(), this }, n.toArray = function(t, e) { return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._w, t }, n.onChange = function(t) { return this.onChangeCallback = t, this }, n.onChangeCallback = function() {}, t = Quaternion, (e = [{ key: "x", get: function() { return this._z }, set: function(t) { this._x = t, this.onChangeCallback() } }, { key: "y", get: function() { return this._y }, set: function(t) { this._y = t, this.onChangeCallback() } }, { key: "z", set: function(t) { this._z = t, this.onChangeCallback() } }, { key: "w", get: function() { return this._w }, set: function(t) { this._w = t, this.onChangeCallback() } }]) && Quaternion_defineProperties(t.prototype, e), r && Quaternion_defineProperties(t, r), Quaternion }(), R = new v, D = new C; function Euler_defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } v.prototype.applyEuler = function(t) { var e = D; return !t || t.isEuler, this.applyQuaternion(e.setFromEuler(t)) }, v.prototype.applyAxisAngle = function(t, e) { var r = D; return this.applyQuaternion(r.setFromAxisAngle(t, e)) }; var F = function() { function Euler(t, e, r, n) { this._x = t || 0, this._y = e || 0, this._z = r || 0, this._order = n || Euler.DefaultOrder, this.isEuler = !0 } var t, e, r, n = Euler.prototype; return n.set = function(t) { this._y = t, this.onChangeCallback() }, n.set = function(t, e, r, n) { return this._x = t, this._y = e, this._z = r, this._order = n || this._order, this.onChangeCallback(), this }, n.clone = function() { return new this.constructor(this._x, this._y, this._z, this._order) }, n.copy = function(t) { return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this.onChangeCallback(), this }, n.setFromRotationMatrix = function(t, e, r) { var n = Math_clamp, i = t.elements, o = i[0], a = i[4], s = i[8], u = i[1], h = i[5], c = i[9], l = i[2], f = i[6], d = i[10]; return "XYZ" === (e = e || this._order) ? (this._y = Math.asin(n(s, -1, 1)), Math.abs(s) < .99999 ? (this._x = Math.atan2(-c, d), this._z = Math.atan2(-a, o)) : (this._x = Math.atan2(f, h), this._z = 0)) : "YXZ" === e ? (this._x = Math.asin(-n(c, -1, 1)), Math.abs(c) < .99999 ? (this._y = Math.atan2(s, d), this._z = Math.atan2(u, h)) : (this._y = Math.atan2(-l, o), this._z = 0)) : "ZXY" === e ? (this._x = Math.asin(n(f, -1, 1)), Math.abs(f) < .99999 ? (this._y = Math.atan2(-l, d), this._z = Math.atan2(-a, h)) : (this._y = 0, this._z = Math.atan2(u, o))) : "ZYX" === e ? (this._y = Math.asin(-n(l, -1, 1)), Math.abs(l) < .99999 ? (this._x = Math.atan2(f, d), this._z = Math.atan2(u, o)) : (this._x = 0, this._z = Math.atan2(-a, h))) : "YZX" === e ? (this._z = Math.asin(n(u, -1, 1)), Math.abs(u) < .99999 ? (this._x = Math.atan2(-c, h), this._y = Math.atan2(-l, o)) : (this._x = 0, this._y = Math.atan2(s, d))) : "XZY" === e && (this._z = Math.asin(-n(a, -1, 1)), Math.abs(a) < .99999 ? (this._x = Math.atan2(f, h), this._y = Math.atan2(s, o)) : (this._x = Math.atan2(-c, d), this._y = 0)), this._order = e, !1 !== r && this.onChangeCallback(), this }, n.setFromQuaternion = function(t, e, r) { return L.makeRotationFromQuaternion(t), this.setFromRotationMatrix(L, e, r) }, n.setFromVector3 = function(t, e) { return this.set(t.x, t.y, t.z, e || this._order) }, n.reorder = function(t) { return N.setFromEuler(this), this.setFromQuaternion(N, t) }, n.equals = function(t) { return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order }, n.fromArray = function(t) { return this._x = t[0], this._y = t[1], this._z = t[2], void 0 !== t[3] && (this._order = t[3]), this.onChangeCallback(), this }, n.toArray = function(t, e) { return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._order, t }, n.toVector3 = function(t) { return t ? t.set(this._x, this._y, this._z) : new v(this._x, this._y, this._z) }, n.onChange = function(t) { return this.onChangeCallback = t, this }, n.onChangeCallback = function() {}, t = Euler, (e = [{ key: "x", get: function() { return this._x }, set: function(t) { this._z = t, this.onChangeCallback() } }, { key: "y", get: function() { return this._y } }, { key: "z", get: function() { return this._z } }, { key: "order", get: function() { return this._order }, set: function(t) { this._order = t, this.onChangeCallback() } }]) && Euler_defineProperties(t.prototype, e), r && Euler_defineProperties(t, r), Euler }(), L = new S, N = new C; F.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"], F.DefaultOrder = "XYZ"; var B = r(37), U = r.n(B), G = r(45), j = r.n(G), z = r(179), X = r.n(z); U.a.prototype.setValues = function(t) {}; var V = function() { function Interpolant(t, e, r, n) { this.parameterPositions = t, this._cachedIndex = 0, this.resultBuffer = void 0 !== n ? n : new e.constructor(r), this.sampleValues = e, this.valueSize = r, this.settings = null, this.DefaultSettings_ = {} } var t = Interpolant.prototype; return t.evaluate = function(t) { var e = this.parameterPositions, r = this._cachedIndex, n = e[r], i = e[r - 1]; t: { e: { var o;r: { n: if (!(t < n)) { for (var a = r + 2;;) { if (void 0 === n) { if (t < i) break n; return r = e.length, this._cachedIndex = r, this.afterEnd_(r - 1, t, i) } if (r === a) break; if (i = n, t < (n = e[++r])) break e } o = e.length; break r }if (i <= t) break t; var s = e[1];t < s && (r = 2, i = s); for (a = r - 2;;) { if (void 0 === i) return this._cachedIndex = 0, this.beforeStart_(0, t, n); if (r === a) break; if (n = i, (i = e[--r - 1]) <= t) break e } o = r, r = 0 } for (; r < o;) { var u = r + o >>> 1; t < e[u] ? o = u : r = u + 1 } if (n = e[r], void 0 === (i = e[r - 1])) return this._cachedIndex = 0, this.beforeStart_(0, t, n); if (void 0 === n) return r = e.length, this._cachedIndex = r, this.afterEnd_(r - 1, i, t) } this._cachedIndex = r, this.intervalChanged_(r, i, n) } return this.interpolate_(r, i, t, n) }, t.getSettings_ = function() { return this.settings || this.DefaultSettings_ }, t.copySampleValue_ = function(t) { for (var e = this.resultBuffer, r = this.sampleValues, n = this.valueSize, i = t * n, o = 0; o !== n; ++o) e[o] = r[i + o]; return e }, t.interpolate_ = function() { throw new Error("call to abstract method") }, t.intervalChanged_ = function() {}, Interpolant }(); Object.assign(V.prototype, { beforeStart_: V.prototype.copySampleValue_, afterEnd_: V.prototype.copySampleValue_ }); var q = function(o) { var t, e; function CubicInterpolant(t, e, r, n) { var i; return (i = o.call(this, t, e, r, n) || this)._weightPrev = -0, i._offsetPrev = -0, i._weightNext = -0, i._offsetNext = -0, i.DefaultSettings_ = { endingStart: 2400, endingEnd: 2400 }, i } e = o, (t = CubicInterpolant).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e; var r = CubicInterpolant.prototype; return r.intervalChanged = function(t, e, r) { var n = this.parameterPositions, i = t - 2, o = t + 1, a = n[i], s = n[o]; if (void 0 === a) switch (this.getSettings_().endingStart) { case 2401: i = t, a = 2 * e - r; break; case 2402: a = e + n[i = n.length - 2] - n[i + 1]; break; default: i = t, a = r } if (void 0 === s) switch (this.getSettings_().endingEnd) { case 2401: o = t, s = 2 * r - e; break; case 2402: s = r + n[o = 1] - n[0]; break; default: o = t - 1, s = e } var u = .5 * (r - e), h = this.valueSize; this._weightPrev = u / (e - a), this._weightNext = u / (s - r), this._offsetPrev = i * h, this._offsetNext = o * h }, r.interpolate_ = function(t, e, r, n) { for (var i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, s = t * a, u = s - a, h = this._offsetPrev, c = this._offsetNext, l = this._weightPrev, f = this._weightNext, d = (r - e) / (n - e), p = d * d, m = p * d, v = -l * m + 2 * l * p - l * d, g = (1 + l) * m + (-1.5 - 2 * l) * p + (-.5 + l) * d + 1, y = (-1 - f) * m + (1.5 + f) * p + .5 * d, _ = f * m - f * p, b = 0; b !== a; ++b) i[b] = v * o[h + b] + g * o[u + b] + y * o[s + b] + _ * o[c + b]; return i }, CubicInterpolant }(V); var H = function(i) { var t, e; function LinearInterpolant(t, e, r, n) { return i.call(this, t, e, r, n) || this } return e = i, (t = LinearInterpolant).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, LinearInterpolant.prototype.interpolate_ = function(t, e, r, n) { for (var i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, s = t * a, u = s - a, h = (r - e) / (n - e), c = 1 - h, l = 0; l !== a; ++l) i[l] = o[u + l] * c + o[s + l] * h; return i }, LinearInterpolant }(V); var W = function(i) { var t, e; function DiscreteInterpolant(t, e, r, n) { return i.call(this, t, e, r, n) || this } return e = i, (t = DiscreteInterpolant).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, DiscreteInterpolant.prototype.interpolate_ = function(t) { return this.copySampleValue_(t - 1) }, DiscreteInterpolant }(V), Y = r(18), K = function() { function KeyframeTrack(t, e, r, n) { if (void 0 === t) throw new Error("THREE.KeyframeTrack: track name is undefined"); if (void 0 === e || 0 === e.length) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + t); this.name = t, this.times = Y.b(e, this.TimeBufferType), this.values = Y.b(r, this.ValueBufferType), this.setInterpolation(n || this.DefaultInterpolation) } var t = KeyframeTrack.prototype; return t.toJSON = function(t) { var e, r = t.constructor; if (void 0 !== r.toJSON) e = r.toJSON(t); else { e = { name: t.name, times: Y.b(t.times, Array), values: Y.b(t.values, Array) }; var n = t.getInterpolation(); n !== t.DefaultInterpolation && (e.interpolation = n) } return e.type = t.ValueTypeName, e }, t.InterpolantFactoryMethodDiscrete = function(t) { return new W(this.times, this.values, this.getValueSize(), t) }, t.InterpolantFactoryMethodLinear = function(t) { return new H(this.times, this.values, this.getValueSize(), t) }, t.InterpolantFactoryMethodSmooth = function(t) { return new q(this.times, this.values, this.getValueSize(), t) }, t.setInterpolation = function(t) { var e; switch (t) { case 2300: e = this.InterpolantFactoryMethodDiscrete; break; case 2301: e = this.InterpolantFactoryMethodLinear; break; case 2302: e = this.InterpolantFactoryMethodSmooth } if (void 0 !== e) return this.createInterpolant = e, this; var r = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; if (void 0 === this.createInterpolant) { if (t === this.DefaultInterpolation) throw new Error(r); this.setInterpolation(this.DefaultInterpolation) } return this }, t.getInterpolation = function() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return 2300; case this.InterpolantFactoryMethodLinear: return 2301; case this.InterpolantFactoryMethodSmooth: return 2302 } }, t.getValueSize = function() { return this.values.length / this.times.length }, t.shift = function(t) { if (0 !== t) for (var e = this.times, r = 0, n = e.length; r !== n; ++r) e[r] += t; return this }, t.scale = function(t) { if (1 !== t) for (var e = this.times, r = 0, n = e.length; r !== n; ++r) e[r] *= t; return this }, t.trim = function(t, e) { for (var r = this.times, n = r.length, i = 0, o = n - 1; i !== n && r[i] < t;) ++i; for (; - 1 !== o && r[o] > e;) --o; if (++o, 0 !== i || o !== n) { o <= i && (i = (o = Math.max(o, 1)) - 1); var a = this.getValueSize(); this.times = Y.a(r, i, o), this.values = Y.a(this.values, i * a, o * a) } return this }, t.validate = function() { var t = !0, e = this.getValueSize(); e - Math.floor(e) != 0 && (t = !1); var r = this.times, n = this.values, i = r.length; 0 === i && (t = !1); for (var o = null, a = 0; a !== i; a++) { var s = r[a]; if ("number" == typeof s && isNaN(s)) { t = !1; break } if (null !== o && s < o) { t = !1; break } o = s } if (void 0 !== n && Y.e(n)) for (var u = 0, h = n.length; u !== h; ++u) { var c = n[u]; if (isNaN(c)) { t = !1; break } } return t }, t.optimize = function() { for (var t = this.times, e = this.values, r = this.getValueSize(), n = 2302 === this.getInterpolation(), i = 1, o = t.length - 1, a = 1; a < o; ++a) { var s = !1, u = t[a]; if (u !== t[a + 1] && (1 !== a || u !== u[0])) if (n) s = !0; else for (var h = a * r, c = h - r, l = h + r, f = 0; f !== r; ++f) { var d = e[h + f]; if (d !== e[c + f] || d !== e[l + f]) { s = !0; break } } if (s) { if (a !== i) { t[i] = t[a]; for (var p = a * r, m = i * r, v = 0; v !== r; ++v) e[m + v] = e[p + v] }++i } } if (0 < o) { t[i] = t[o]; for (var g = o * r, y = i * r, _ = 0; _ !== r; ++_) e[y + _] = e[g + _]; ++i } return i !== t.length && (this.times = Y.a(t, 0, i), this.values = Y.a(e, 0, i * r)), this }, t.clone = function() { var t = Y.a(this.times, 0), e = Y.a(this.values, 0), r = new this.constructor(this.name, t, e); return r.createInterpolant = this.createInterpolant, r }, KeyframeTrack }(); Object.assign(K.prototype, { TimeBufferType: Float32Array, ValueBufferType: Float32Array, DefaultInterpolation: 2301 }); var Z = function(n) { var t, e; function BooleanKeyframeTrack(t, e, r) { return n.call(this, t, e, r) || this } return e = n, (t = BooleanKeyframeTrack).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, BooleanKeyframeTrack }(K); Object.assign(Z.prototype, { ValueTypeName: "bool", ValueBufferType: Array, DefaultInterpolation: 2300, InterpolantFactoryMethodLinear: void 0, InterpolantFactoryMethodSmooth: void 0 }); var Q = function(o) { var t, e; function ColorKeyframeTrack(t, e, r, n) { var i; return (i = o.call(this, t, e, r, n) || this).ValueTypeName = "color", i.ValueBufferType = Array, i } return e = o, (t = ColorKeyframeTrack).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, ColorKeyframeTrack }(K); Object.assign(Q.prototype, { ValueTypeName: "color", ValueBufferType: Array }); var J = function(i) { var t, e; function QuaternionLinearInterpolant(t, e, r, n) { return i.call(this, t, e, r, n) || this } return e = i, (t = QuaternionLinearInterpolant).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, QuaternionLinearInterpolant.prototype.interpolate_ = function(t, e, r, n) { for (var i = this.resultBuffer, o = this.sampleValues, a = this.valueSize, s = t * a, u = (r - e) / (n - e), h = s + a; s !== h; s += 4) C.slerpFlat(i, 0, o, s - a, o, s, u); return i }, QuaternionLinearInterpolant }(V); var $ = function(i) { var t, e; function QuaternionKeyframeTrack(t, e, r, n) { return i.call(this, t, e, r, n) || this } return e = i, (t = QuaternionKeyframeTrack).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodLinear = function(t) { return new J(this.times, this.values, this.getValueSize(), t) }, QuaternionKeyframeTrack }(K); Object.assign($.prototype, { ValueTypeName: "quaternion", DefaultInterpolation: 2301, InterpolantFactoryMethodSmooth: void 0 }); var tt = function(o) { var t, e; function NumberKeyframeTrack(t, e, r, n) { var i; return (i = o.call(this, t, e, r, n) || this).ValueTypeName = "number", i } return e = o, (t = NumberKeyframeTrack).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, NumberKeyframeTrack }(K); Object.assign(tt.prototype, { ValueTypeName: "number" }); var et = function(i) { var t, e; function VectorKeyframeTrack(t, e, r, n) { return i.call(this, t, e, r, n) || this } return e = i, (t = VectorKeyframeTrack).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, VectorKeyframeTrack }(K); Object.assign(Z.prototype, { ValueTypeName: "vector" }); var rt = function(i) { var t, e; function StringKeyframeTrack(t, e, r, n) { return i.call(this, t, e, r, n) || this } return e = i, (t = StringKeyframeTrack).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, StringKeyframeTrack }(K); Object.assign(rt.prototype, { ValueTypeName: "string", ValueBufferType: Array, DefaultInterpolation: 2300, InterpolantFactoryMethodLinear: void 0, InterpolantFactoryMethodSmooth: void 0 }); var nt = function() { function AnimationClip(t, e, r) { this.name = t, this.tracks = r, this.duration = void 0 !== e ? e : -1, this.uuid = generateUUID(), this.duration < 0 && this.resetDuration() } var t = AnimationClip.prototype; return t.resetDuration = function() { for (var t = 0, e = 0, r = this.tracks.length; e !== r; ++e) { var n = this.tracks[e]; t = Math.max(t, n.times[n.times.length - 1]) } return this.duration = t, this }, t.trim = function() { for (var t = 0; t < this.tracks.length; t++) this.tracks[t].trim(0, this.duration); return this }, t.validate = function() { for (var t = !0, e = 0; e < this.tracks.length; e++) t = t && this.tracks[e].validate(); return t }, t.optimize = function() { for (var t = 0; t < this.tracks.length; t++) this.tracks[t].optimize(); return this }, t.clone = function() { for (var t = [], e = 0; e < this.tracks.length; e++) t.push(this.tracks[e].clone()); return new AnimationClip(this.name, this.duration, t) }, AnimationClip.parse = function(t) { for (var e = [], r = t.tracks, n = 1 / (t.fps || 1), i = 0, o = r.length; i !== o; ++i) e.push(parseKeyframeTrack(r[i]).scale(n)); return new AnimationClip(t.name, t.duration, e) }, AnimationClip.CreateFromMorphTargetSequence = function(t, e, r, n) { for (var i = e.length, o = [], a = 0; a < i; a++) { var s = [], u = []; s.push((a + i - 1) % i, a, (a + 1) % i), u.push(0, 1, 0); var h = Y.d(s); s = Y.f(s, 1, h), u = Y.f(u, 1, h), n || 0 !== s[0] || (s.push(i), u.push(u[0])), o.push(new tt(".morphTargetInfluences[" + e[a].name + "]", s, u).scale(1 / r)) } return new AnimationClip(t, -1, o) }, AnimationClip.findByName = function(t, e) { var r = t; if (!Array.isArray(t)) { var n = t; r = n.geometry && n.geometry.animations || n.animations } for (var i = 0; i < r.length; i++) if (r[i].name === e) return r[i]; return null }, AnimationClip.CreateClipsFromMorphTargetSequences = function(t, e, r) { for (var n = {}, i = /^([\w-]*?)([\d]+)$/, o = 0, a = t.length; o < a; o++) { var s = t[o], u = s.name.match(i); if (u && 1 < u.length) { var h = u[1], c = n[h]; c || (n[h] = c = []), c.push(s) } } var l = []; for (var f in n) l.push(AnimationClip.CreateFromMorphTargetSequence(f, n[f], e, r)); return l }, AnimationClip.parseAnimation = function(t, e) { if (!t) return null; for (var r = function(t, e, r, n, i) { if (0 !== r.length) { var o = [], a = []; Y.c(r, o, a, n), 0 !== o.length && i.push(new t(e, o, a)) } }, n = [], i = t.name || "default", o = t.length || -1, a = t.fps || 30, s = t.hierarchy || [], u = 0; u < s.length; u++) { var h = s[u].keys; if (h && 0 !== h.length) if (h[0].morphTargets) { for (var c = {}, l = 0; l < h.length; l++) if (h[l].morphTargets) for (var f = 0; f < h[l].morphTargets.length; f++) c[h[l].morphTargets[f]] = -1; for (var d in c) { for (var p = [], m = [], v = 0; v !== h[k].morphTargets.length; ++v) { var g = h[k]; p.push(g.time), m.push(g.morphTarget === d ? 1 : 0) } n.push(new tt(".morphTargetInfluence[" + d + "]", p, m)) } o = c.length * (a || 1) } else { var y = ".bones[" + e[u].name + "]"; r(et, y + ".position", h, "pos", n), r($, y + ".quaternion", h, "rot", n), r(et, y + ".scale", h, "scl", n) } } return 0 === n.length ? null : new AnimationClip(i, o, n) }, AnimationClip }(); function parseKeyframeTrack(t) { if (void 0 === t.type) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); var e = function(t) { switch (t.toLowerCase()) { case "scalar": case "double": case "float": case "number": case "integer": return tt; case "vector": case "vector2": case "vector3": case "vector4": return et; case "color": return Q; case "quaternion": return $; case "bool": case "boolean": return Z; case "string": return rt } throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + t) }(t.type); if (void 0 === t.times) { var r = [], n = []; Y.c(t.keys, r, n, "value"), t.times = r, t.values = n } return void 0 !== e.parse ? e.parse(t) : new e(t.name, t.times, t.values, t.interpolation) } var it = function() { function AnimationAction(t, e, r) { this._mixer = t, this._clip = e, this._localRoot = r || null; for (var n = e.tracks, i = n.length, o = new Array(i), a = { endingStart: 2400, endingEnd: 2400 }, s = 0; s !== i; ++s) { var u = n[s].createInterpolant(null); (o[s] = u).settings = a } this._interpolantSettings = a, this._interpolants = o, this._propertyBindings = new Array(i), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = 2201, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = 1 / 0, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0 } var t = AnimationAction.prototype; return t.play = function() { return this._mixer._activateAction(this), this }, t.stop = function() { return this._mixer._deactivateAction(this), this.reset() }, t.reset = function() { return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping() }, t.isRunning = function() { return this.enabled && !this.paused && 0 !== this.timeScale && null === this._startTime && this._mixer._isActiveAction(this) }, t.isScheduled = function() { return this._mixer._isActiveAction(this) }, t.startAt = function(t) { return this._startTime = t, this }, t.setLoop = function(t, e) { return this.loop = t, this.repetitions = e, this }, t.setEffectiveWeight = function(t) { return this.weight = t, this._effectiveWeight = this.enabled ? t : 0, this.stopFading() }, t.getEffectiveWeight = function() { return this._effectiveWeight }, t.fadeIn = function(t) { return this._scheduleFading(t, 0, 1) }, t.fadeOut = function(t) { return this._scheduleFading(t, 1, 0) }, t.crossFadeFrom = function(t, e, r) { if (t.fadeOut(e), this.fadeIn(e), r) { var n = this._clip.duration, i = t._clip.duration, o = i / n, a = n / i; t.warp(1, o, e), this.warp(a, 1, e) } return this }, t.crossFadeTo = function(t, e, r) { return t.crossFadeFrom(this, e, r) }, t.stopFading = function() { var t = this._weightInterpolant; return null !== t && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(t)), this }, t.setEffectiveTimeScale = function(t) { return this.timeScale = t, this._effectiveTimeScale = this.paused ? 0 : t, this.stopWarping() }, t.getEffectiveTimeScale = function() { return this._effectiveTimeScale }, t.setDuration = function(t) { return this.timeScale = this._clip.duration / t, this.stopWarping() }, t.syncWith = function(t) { return this.time = t.time, this.timeScale = t.timeScale, this.stopWarping() }, t.halt = function(t) { return this.warp(this._effectiveTimeScale, 0, t) }, t.warp = function(t, e, r) { var n = this._mixer, i = n.time, o = this._timeScaleInterpolant, a = this.timeScale; null === o && (o = n._lendControlInterpolant(), this._timeScaleInterpolant = o); var s = o.parameterPositions, u = o.sampleValues; return s[0] = i, s[1] = i + r, u[0] = t / a, u[1] = e / a, this }, t.stopWarping = function() { var t = this._timeScaleInterpolant; return null !== t && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(t)), this }, t.getMixer = function() { return this._mixer }, t.getClip = function() { return this._clip }, t.getRoot = function() { return this._localRoot || this._mixer._root }, t._update = function(t, e, r, n) { if (this.enabled) { var i = this._startTime; if (null !== i) { var o = (t - i) * r; if (o < 0 || 0 === r) return; this._startTime = null, e = r * o } e *= this._updateTimeScale(t); var a = this._updateTime(e), s = this._updateWeight(t); if (0 < s) for (var u = this._interpolants, h = this._propertyBindings, c = 0, l = u.length; c !== l; ++c) u[c].evaluate(a), h[c].accumulate(n, s) } else this._updateWeight(t) }, t._updateWeight = function(t) { var e = 0; if (this.enabled) { e = this.weight; var r = this._weightInterpolant; if (null !== r) { var n = r.evaluate(t)[0]; e *= n, t > r.parameterPositions[1] && (this.stopFading(), 0 === n && (this.enabled = !1)) } } return this._effectiveWeight = e }, t._updateTimeScale = function(t) { var e = 0; if (!this.paused) { e = this.timeScale; var r = this._timeScaleInterpolant; if (null !== r) e *= r.evaluate(t)[0], t > r.parameterPositions[1] && (this.stopWarping(), 0 === e ? this.paused = !0 : this.timeScale = e) } return this._effectiveTimeScale = e }, t._updateTime = function(t) { var e = this.time + t, r = this._clip.duration, n = this.loop, i = this._loopCount, o = 2202 === n; if (0 === t) return -1 === i ? e : o && 1 == (1 & i) ? r - e : e; if (2200 === n) { -1 === i && (this._loopCount = 0, this._setEndings(!0, !0, !1)); t: { if (r <= e) e = r; else { if (!(e < 0)) break t; e = 0 } this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, this._mixer.dispatchEvent({ type: "finished", action: this, direction: t < 0 ? -1 : 1 }) } } else { if (-1 === i && (0 <= t ? (i = 0, this._setEndings(!0, 0 === this.repetitions, o)) : this._setEndings(0 === this.repetitions, !0, o)), r <= e || e < 0) { var a = Math.floor(e / r); e -= r * a, i += Math.abs(a); var s = this.repetitions - i; if (s <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, e = 0 < t ? r : 0, this._mixer.dispatchEvent({ type: "finished", action: this, direction: 0 < t ? 1 : -1 }); else { if (1 === s) { var u = t < 0; this._setEndings(u, !u, o) } else this._setEndings(!1, !1, o); this._loopCount = i, this._mixer.dispatchEvent({ type: "loop", action: this, loopDelta: a }) } } if (o && 1 == (1 & i)) return r - (this.time = e) } return this.time = e }, t._setEndings = function(t, e, r) { var n = this._interpolantSettings; n.endingEnd = r ? n.endingStart = 2401 : (n.endingStart = t ? this.zeroSlopeAtStart ? 2401 : 2400 : 2402, e ? this.zeroSlopeAtEnd ? 2401 : 2400 : 2402) }, t._scheduleFading = function(t, e, r) { var n = this._mixer, i = n.time, o = this._weightInterpolant; null === o && (o = n._lendControlInterpolant(), this._weightInterpolant = o); var a = o.parameterPositions, s = o.sampleValues; return a[0] = i, s[0] = e, a[1] = i + t, s[1] = r, this }, AnimationAction }(), ot = "\\[\\]\\.:\\/", at = new RegExp("[" + ot + "]", "g"), st = "[^" + ot + "]", ut = "[^" + ot.replace("\\.", "") + "]", ht = /((?:WC+[\/:])*)/.source.replace("WC", st), ct = /(WCOD+)?/.source.replace("WCOD", ut), lt = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", st), ft = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", st), dt = new RegExp("^" + ht + ct + lt + ft + "$"), pt = ["material", "materials", "bones"], mt = function() { function Composite(t, e, r) { var n = r || vt.parseTrackName(e); this._targetGroup = t, this._bindings = t.subscribe_(e, n) } var t = Composite.prototype; return t.getValue = function(t, e) { this.bind(); var r = this._targetGroup.nCachedObjects_, n = this._bindings[r]; void 0 !== n && n.getValue(t, e) }, t.setValue = function(t, e) { for (var r = this._bindings, n = this._targetGroup.nCachedObjects_, i = r.length; n !== i; ++n) r[n].setValue(t, e) }, t.bind = function() { for (var t = this._bindings, e = this._targetGroup.nCachedObjects_, r = t.length; e !== r; ++e) t[e].bind() }, t.unbind = function() { for (var t = this._bindings, e = this._targetGroup.nCachedObjects_, r = t.length; e !== r; ++e) t[e].unbind() }, Composite }(), vt = function() { function PropertyBinding(t, e, r) { this.path = e, this.parsedPath = r || PropertyBinding.parseTrackName(e), this.node = PropertyBinding.findNode(t, this.parsedPath.nodeName) || t, this.rootNode = t } PropertyBinding.sanitizeNodeName = function(t) { return t.replace(/\s/g, "_").replace(at, "") }, PropertyBinding.create = function(t, e, r) { return t && t.isAnimationObjectGroup ? new PropertyBinding.Composite(t, e, r) : new PropertyBinding(t, e, r) }, PropertyBinding.parseTrackName = function(t) { var e = dt.exec(t); if (!e) throw new Error("PropertyBinding: Cannot parse trackName: " + t); var r = { nodeName: e[2], objectName: e[3], objectIndex: e[4], propertyName: e[5], propertyIndex: e[6] }, n = r.nodeName && r.nodeName.lastIndexOf("."); if (void 0 !== n && -1 !== n) { var i = r.nodeName.substring(n + 1); - 1 !== pt.indexOf(i) && (r.nodeName = r.nodeName.substring(0, n), r.objectName = i) } if (null === r.propertyName || 0 === r.propertyName.length) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + t); return r }, PropertyBinding.findNode = function(t, i) { if (!i || "" === i || "root" === i || "." === i || -1 === i || i === t.name || i === t.uuid) return t; if (t.skeleton) { var e = t.skeleton.getBoneByName(i); if (void 0 !== e) return e } if (t.children) { var r = function searchNodeSubtree(t) { for (var e = 0; e < t.length; e++) { var r = t[e]; if (r.name === i || r.uuid === i) return r; var n = searchNodeSubtree(r.children); if (n) return n } return null }(t.children); if (r) return r } return null }; var t = PropertyBinding.prototype; return t._getValue_unavailable = function() {}, t._setValue_unavailable = function() {}, t.getValue = function(t, e) { this.bind(), this.getValue(t, e) }, t.setValue = function(t, e) { this.bind(), this.setValue(t, e) }, t.bind = function() { var t = this.node, e = this.parsedPath, r = e.objectName, n = e.propertyName, i = e.propertyIndex; if (t || (t = PropertyBinding.findNode(this.rootNode, e.nodeName) || this.rootNode, this.node = t), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, t) { if (r) { var o = e.objectIndex; switch (r) { case "materials": if (!t.material) return; if (!t.material.materials) return; t = t.material.materials; break; case "bones": if (!t.skeleton) return; t = t.skeleton.bones; for (var a = 0; a < t.length; a++) if (t[a].name === o) { o = a; break } break; default: if (void 0 === t[r]) return; t = t[r] } if (void 0 !== o) { if (void 0 === t[o]) return; t = t[o] } } var s = t[n]; if (void 0 !== s) { var u = this.Versioning.None; void 0 !== (this.targetObject = t).needsUpdate ? u = this.Versioning.NeedsUpdate : void 0 !== t.matrixWorldNeedsUpdate && (u = this.Versioning.MatrixWorldNeedsUpdate); var h = this.BindingType.Direct; if (void 0 !== i) { if ("morphTargetInfluences" === n) { if (!t.geometry) return; if (t.geometry.isBufferGeometry) { if (!t.geometry.morphAttributes) return; for (var c = 0; c < this.node.geometry.morphAttributes.position.length; c++) if (t.geometry.morphAttributes.position[c].name === i) { i = c; break } } else { if (!t.geometry.morphTargets) return; for (var l = 0; l < this.node.geometry.morphTargets.length; l++) if (t.geometry.morphTargets[l].name === i) { i = l; break } } } h = this.BindingType.ArrayElement, this.resolvedProperty = s, this.propertyIndex = i } else void 0 !== s.fromArray && void 0 !== s.toArray ? (h = this.BindingType.HasFromToArray, this.resolvedProperty = s) : Array.isArray(s) ? (h = this.BindingType.EntireArray, this.resolvedProperty = s) : this.propertyName = n; this.getValue = this.GetterByBindingType[h], this.setValue = this.SetterByBindingTypeAndVersioning[h][u] } else e.nodeName } }, t.unbind = function() { this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound }, PropertyBinding }(); Object.assign(vt.prototype, { BindingType: { Direct: 0, EntireArray: 1, ArrayElement: 2, HasFromToArray: 3 }, Versioning: { None: 0, NeedsUpdate: 1, MatrixWorldNeedsUpdate: 2 }, GetterByBindingType: [function(t, e) { t[e] = this.node[this.propertyName] }, function(t, e) { for (var r = this.resolvedProperty, n = 0, i = r.length; n !== i; ++n) t[e++] = r[n] }, function(t, e) { t[e] = this.resolvedProperty[this.propertyIndex] }, function(t, e) { this.resolvedProperty.toArray(t, e) }], SetterByBindingTypeAndVersioning: [ [function(t, e) { this.targetObject[this.propertyName] = t[e] }, function(t, e) { this.targetObject[this.propertyName] = t[e], this.targetObject.needsUpdate = !0 }, function(t, e) { this.targetObject[this.propertyName] = t[e], this.targetObject.matrixWorldNeedsUpdate = !0 }], [function(t, e) { for (var r = this.resolvedProperty, n = 0, i = r.length; n !== i; ++n) r[n] = t[e++] }, function(t, e) { for (var r = this.resolvedProperty, n = 0, i = r.length; n !== i; ++n) r[n] = t[e++]; this.targetObject.needsUpdate = !0 }, function(t, e) { for (var r = this.resolvedProperty, n = 0, i = r.length; n !== i; ++n) r[n] = t[e++]; this.targetObject.matrixWorldNeedsUpdate = !0 }], [function(t, e) { this.resolvedProperty[this.propertyIndex] = t[e] }, function(t, e) { this.resolvedProperty[this.propertyIndex] = t[e], this.targetObject.needsUpdate = !0 }, function(t, e) { this.resolvedProperty[this.propertyIndex] = t[e], this.targetObject.matrixWorldNeedsUpdate = !0 }], [function(t, e) { this.resolvedProperty.fromArray(t, e) }, function(t, e) { this.resolvedProperty.fromArray(t, e), this.targetObject.needsUpdate = !0 }, function(t, e) { this.resolvedProperty.fromArray(t, e), this.targetObject.matrixWorldNeedsUpdate = !0 }] ] }), Object.assign(vt, { Composite: mt }); var gt = function() { function PropertyMixer(t, e, r) { this.binding = t, this.valueSize = r; var n, i = Float64Array; switch (e) { case "quaternion": n = this._slerp; break; case "string": case "bool": i = Array, n = this._select; break; default: n = this._lerp } this.buffer = new i(4 * r), this._mixBufferRegion = n, this.cumulativeWeight = 0, this.useCount = 0, this.referenceCount = 0 } var t = PropertyMixer.prototype; return t.accumulate = function(t, e) { var r = this.buffer, n = this.valueSize, i = t * n + n, o = this.cumulativeWeight; if (0 === o) { for (var a = 0; a !== n; ++a) r[i + a] = r[a]; o = e } else { var s = e / (o += e); this._mixBufferRegion(r, i, 0, s, n) } this.cumulativeWeight = o }, t.apply = function(t) { var e = this.valueSize, r = this.buffer, n = t * e + e, i = this.cumulativeWeight, o = this.binding; if (this.cumulativeWeight = 0, i < 1) { var a = 3 * e; this._mixBufferRegion(r, n, a, 1 - i, e) } for (var s = e, u = e + e; s !== u; ++s) if (r[s] !== r[s + e]) { o.setValue(r, n); break } }, t.saveOriginalState = function() { var t = this.binding, e = this.buffer, r = this.valueSize, n = 3 * r; t.getValue(e, n); for (var i = r, o = n; i !== o; ++i) e[i] = e[n + i % r]; this.cumulativeWeight = 0 }, t.restoreOriginalState = function() { var t = 3 * this.valueSize; this.binding.setValue(this.buffer, t) }, t._select = function(t, e, r, n, i) { if (.5 <= n) for (var o = 0; o !== i; ++o) t[e + o] = t[r + o] }, t._slerp = function(t, e, r, n) { C.slerpFlat(t, e, t, e, t, r, n) }, t._lerp = function(t, e, r, n, i) { for (var o = 1 - n, a = 0; a !== i; ++a) { var s = e + a; t[s] = t[s] * o + t[r + a] * n } }, PropertyMixer }(), yt = function() { function AnimationMixer(t) { this._root = t, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1 } var t = AnimationMixer.prototype; return t._bindAction = function(t, e) { var r = t._localRoot || this._root, n = t._clip.tracks, i = n.length, o = t._propertyBindings, a = t._interpolants, s = r.uuid, u = this._bindingsByRootAndName, h = u[s]; void 0 === h && (h = {}, u[s] = h); for (var c = 0; c !== i; ++c) { var l = n[c], f = l.name, d = h[f]; if (void 0 !== d) o[c] = d; else { if (void 0 !== (d = o[c])) { null === d._cacheIndex && (++d.referenceCount, this._addInactiveBinding(d, s, f)); continue } var p = e && e._propertyBindings[c].binding.parsedPath; ++(d = new gt(vt.create(r, f, p), l.ValueTypeName, l.getValueSize())).referenceCount, this._addInactiveBinding(d, s, f), o[c] = d } a[c].resultBuffer = d.buffer } }, t._activateAction = function(t) { if (!this._isActiveAction(t)) { if (null === t._cacheIndex) { var e = (t._localRoot || this._root).uuid, r = t._clip.uuid, n = this._actionsByClip[r]; this._bindAction(t, n && n.knownActions[0]), this._addInactiveAction(t, r, e) } for (var i = t._propertyBindings, o = 0, a = i.length; o !== a; ++o) { var s = i[o]; 0 == s.useCount++ && (this._lendBinding(s), s.saveOriginalState()) } this._lendAction(t) } }, t._deactivateAction = function(t) { if (this._isActiveAction(t)) { for (var e = t._propertyBindings, r = 0, n = e.length; r !== n; ++r) { var i = e[r]; 0 == --i.useCount && (i.restoreOriginalState(), this._takeBackBinding(i)) } this._takeBackAction(t) } }, t._initMemoryManager = function() { this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; var t = this; this.stats = { actions: { get total() { return t._actions.length }, get inUse() { return t._nActiveActions } }, bindings: { get total() { return t._bindings.length }, get inUse() { return t._nActiveBindings } }, controlInterpolants: { get total() { return t._controlInterpolants.length }, get inUse() { return t._nActiveControlInterpolants } } } }, t._isActiveAction = function(t) { var e = t._cacheIndex; return null !== e && e < this._nActiveActions }, t._addInactiveAction = function(t, e, r) { var n = this._actions, i = this._actionsByClip, o = i[e]; if (void 0 === o) o = { knownActions: [t], actionByRoot: {} }, t._byClipCacheIndex = 0, i[e] = o; else { var a = o.knownActions; t._byClipCacheIndex = a.length, a.push(t) } t._cacheIndex = n.length, n.push(t), o.actionByRoot[r] = t }, t._removeInactiveAction = function(t) { var e = this._actions, r = e[e.length - 1], n = t._cacheIndex; e[r._cacheIndex = n] = r, e.pop(), t._cacheIndex = null; var i = t._clip.uuid, o = this._actionsByClip, a = o[i], s = a.knownActions, u = s[s.length - 1], h = t._byClipCacheIndex; s[u._byClipCacheIndex = h] = u, s.pop(), t._byClipCacheIndex = null, delete a.actionByRoot[(t._localRoot || this._root).uuid], 0 === s.length && delete o[i], this._removeInactiveBindingsForAction(t) }, t._removeInactiveBindingsForAction = function(t) { for (var e = t._propertyBindings, r = 0, n = e.length; r !== n; ++r) { var i = e[r]; 0 == --i.referenceCount && this._removeInactiveBinding(i) } }, t._lendAction = function(t) { var e = this._actions, r = t._cacheIndex, n = this._nActiveActions++, i = e[n]; e[t._cacheIndex = n] = t, e[i._cacheIndex = r] = i }, t._takeBackAction = function(t) { var e = this._actions, r = t._cacheIndex, n = --this._nActiveActions, i = e[n]; e[t._cacheIndex = n] = t, e[i._cacheIndex = r] = i }, t._addInactiveBinding = function(t, e, r) { var n = this._bindingsByRootAndName, i = n[e], o = this._bindings; void 0 === i && (i = {}, n[e] = i), (i[r] = t)._cacheIndex = o.length, o.push(t) }, t._removeInactiveBinding = function(t) { var e = this._bindings, r = t.binding, n = r.rootNode.uuid, i = r.path, o = this._bindingsByRootAndName, a = o[n], s = e[e.length - 1], u = t._cacheIndex; e[s._cacheIndex = u] = s, e.pop(), delete a[i]; t: { for (var h in a) break t;delete o[n] } }, t._lendBinding = function(t) { var e = this._bindings, r = t._cacheIndex, n = this._nActiveBindings++, i = e[n]; e[t._cacheIndex = n] = t, e[i._cacheIndex = r] = i }, t._takeBackBinding = function(t) { var e = this._bindings, r = t._cacheIndex, n = --this._nActiveBindings, i = e[n]; e[t._cacheIndex = n] = t, e[i._cacheIndex = r] = i }, t._lendControlInterpolant = function() { var t = this._controlInterpolants, e = this._nActiveControlInterpolants++, r = t[e]; return void 0 === r && (t[(r = new H(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer)).__cacheIndex = e] = r), r }, t._takeBackControlInterpolant = function(t) { var e = this._controlInterpolants, r = t.__cacheIndex, n = --this._nActiveControlInterpolants, i = e[n]; e[t.__cacheIndex = n] = t, e[i.__cacheIndex = r] = i }, t.clipAction = function(t, e) { var r = e || this._root, n = r.uuid, i = "string" == typeof t ? nt.findByName(r, t) : t, o = null !== i ? i.uuid : t, a = this._actionsByClip[o], s = null; if (void 0 !== a) { var u = a.actionByRoot[n]; if (void 0 !== u) return u; s = a.knownActions[0], null === i && (i = s._clip) } if (null === i) return null; var h = new it(this, i, e); return this._bindAction(h, s), this._addInactiveAction(h, o, n), h }, t.existingAction = function(t, e) { var r = e || this._root, n = r.uuid, i = "string" == typeof t ? nt.findByName(r, t) : t, o = i ? i.uuid : t, a = this._actionsByClip[o]; return void 0 !== a && a.actionByRoot[n] || null }, t.stopAllAction = function() { var t = this._actions, e = this._nActiveActions, r = this._bindings, n = this._nActiveBindings; this._nActiveActions = 0; for (var i = this._nActiveBindings = 0; i !== e; ++i) t[i].reset(); for (var o = 0; o !== n; ++o) r[o].useCount = 0; return this }, t.update = function(t) { t *= this.timeScale; for (var e = this._actions, r = this._nActiveActions, n = this.time += t, i = Math.sign(t), o = this._accuIndex ^= 1, a = 0; a !== r; ++a) { e[a]._update(n, t, i, o) } for (var s = this._bindings, u = this._nActiveBindings, h = 0; h !== u; ++h) s[h].apply(o); return this }, t.getRoot = function() { return this._root }, t.uncacheClip = function(t) { var e = this._actions, r = t.uuid, n = this._actionsByClip, i = n[r]; if (void 0 !== i) { for (var o = i.knownActions, a = 0, s = o.length; a !== s; ++a) { var u = o[a]; this._deactivateAction(u); var h = u._cacheIndex, c = e[e.length - 1]; u._cacheIndex = null, u._byClipCacheIndex = null, e[c._cacheIndex = h] = c, e.pop(), this._removeInactiveBindingsForAction(u) } delete n[r] } }, t.uncacheRoot = function(t) { var e = t.uuid, r = this._actionsByClip; for (var n in r) { var i = r[n].actionByRoot[e]; void 0 !== i && (this._deactivateAction(i), this._removeInactiveAction(i)) } var o = this._bindingsByRootAndName[e]; if (void 0 !== o) for (var a in o) { var s = o[a]; s.restoreOriginalState(), this._removeInactiveBinding(s) } }, t.uncacheAction = function(t, e) { var r = this.existingAction(t, e); null !== r && (this._deactivateAction(r), this._removeInactiveAction(r)) }, t.dispatchEvent = function() {}, AnimationMixer }(); Object.assign(yt.prototype, { _controlInterpolantsResultBuffer: new Float32Array(1) }); var _t = 0, bt = new C, xt = new S, wt = new v, Tt = new v, St = function() { function Object3D() { Object.defineProperty(this, "id", { value: _t++ }), this.uuid = generateUUID(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = Object3D.DefaultUp.clone(); var t = new v, e = new F, r = new C, n = new v(1, 1, 1); e.onChange(function() { r.setFromEuler(e, !1) }), r.onChange(function() { e.setFromQuaternion(r, void 0, !1) }), this.position = void 0, this.rotation = void 0, this.quaternion = void 0, this.scale = void 0, this.modelViewMatrix = void 0, this.normalMatrix = void 0, Object.defineProperties(this, { position: { configurable: !0, enumerable: !0, value: t }, rotation: { configurable: !0, enumerable: !0, value: e }, quaternion: { configurable: !0, enumerable: !0, value: r }, scale: { configurable: !0, enumerable: !0, value: n }, modelViewMatrix: { value: new S }, normalMatrix: { value: new w } }), this.matrix = new S, this.matrixWorld = new S, this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.visible = !0, this.userData = {}, this.isObject3D = !0 } var t = Object3D.prototype; return t.applyMatrix = function(t) { this.matrix.multiplyMatrices(t, this.matrix), this.matrix.decompose(this.position, this.quaternion, this.scale) }, t.lookAt = function(t, e, r) { var n = bt, i = xt, o = wt, a = Tt; t.isVector3 ? o.copy(t) : o.set(t, e, r); var s = this.parent; this.updateWorldMatrix(!0, !1), a.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? i.lookAt(a, o, this.up) : i.lookAt(o, a, this.up), this.quaternion.setFromRotationMatrix(i), s && (i.extractRotation(s.matrixWorld), n.setFromRotationMatrix(i), this.quaternion.premultiply(n.inverse())) }, t.add = function(t) { if (1 < arguments.length) { for (var e = 0; e < arguments.length; e++) this.add(arguments[e]); return this } return t === this || t && t.isObject3D && (null !== t.parent && t.parent.remove(t), (t.parent = this).children.push(t)), this }, t.remove = function(t) { if (1 < arguments.length) { for (var e = 0; e < arguments.length; e++) this.remove(arguments[e]); return this } var r = this.children.indexOf(t); return -1 !== r && (t.parent = null, t.dispatchEvent({ type: "removed" }), this.children.splice(r, 1)), this }, t.getObjectById = function(t) { return this.getObjectByProperty("id", t) }, t.getObjectByName = function(t) { return this.getObjectByProperty("name", t) }, t.getObjectByProperty = function(t, e) { if (this[t] === e) return this; for (var r = 0, n = this.children.length; r < n; r++) { var i = this.children[r].getObjectByProperty(t, e); if (void 0 !== i) return i } }, t.getWorldPosition = function(t) { return void 0 === t && (t = new v), this.updateMatrixWorld(!0), t.setFromMatrixPosition(this.matrixWorld) }, t.getWorldQuaternion = function(t) { var e = wt, r = Tt; return void 0 === t && (t = new C), this.updateMatrixWorld(!0), this.matrixWorld.decompose(e, t, r), t }, t.getWorldScale = function(t) { var e = wt, r = bt; return void 0 === t && (t = new v), this.updateMatrixWorld(!0), this.matrixWorld.decompose(e, r, t), t }, t.getWorldDirection = function(t) { void 0 === t && (t = new v), this.updateMatrixWorld(!0); var e = this.matrixWorld.elements; return t.set(e[8], e[9], e[10]).normalize() }, t.traverse = function(t) { t(this); for (var e = this.children, r = 0, n = e.length; r < n; r++) e[r].traverse(t) }, t.traverseVisible = function(t) { if (!1 !== this.visible) { t(this); for (var e = this.children, r = 0, n = e.length; r < n; r++) e[r].traverseVisible(t) } }, t.traverseAncestors = function(t) { var e = this.parent; null !== e && (t(e), e.traverseAncestors(t)) }, t.updateMatrix = function() { this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0 }, t.updateMatrixWorld = function(t) { this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || t) && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), t = !(this.matrixWorldNeedsUpdate = !1)); for (var e = this.children, r = 0, n = e.length; r < n; r++) e[r].updateMatrixWorld(t) }, t.updateWorldMatrix = function(t, e) { var r = this.parent; if (!0 === t && null !== r && r.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), !0 === e) for (var n = this.children, i = 0, o = n.length; i < o; i++) n[i].updateWorldMatrix(!1, !0) }, Object3D }(); St.DefaultUp = new v(0, 1, 0), St.DefaultMatrixAutoUpdate = !0; var Mt = function(e) { var t, r; function Group() { var t; return (t = e.call(this) || this).type = "Group", t.isGroup = !0, t } return r = e, (t = Group).prototype = Object.create(r.prototype), (t.prototype.constructor = t).__proto__ = r, Group }(St); var Et = function(e) { var t, r; function Bone() { var t; return (t = e.call(this) || this).type = "Bone", t.isBone = !0, t.root = !1, t } return r = e, (t = Bone).prototype = Object.create(r.prototype), (t.prototype.constructor = t).__proto__ = r, Bone }(St), At = 1, Pt = function() { function BufferGeometry() { Object.defineProperty(this, "id", { value: At += 2 }), this.uuid = generateUUID(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.isBufferGeometry = !0 } var t = BufferGeometry.prototype; return t.getIndex = function() { return this.index }, t.setIndex = function(t) { Array.isArray(t) ? this.index = new(65535 < arrayMax(t) ? Uint32BufferAttribute : Uint16BufferAttribute)(t, 1) : this.index = t }, t.addAttribute = function(t, e) { return e && e.isBufferAttribute || e && e.isInterleavedBufferAttribute ? ("index" === t ? this.setIndex(e) : this.attributes[t] = e, this) : this.addAttribute(t, new o(e, arguments[2])) }, t.getAttribute = function(t) { return this.attributes[t] }, t.removeAttribute = function(t) { return delete this.attributes[t], this }, t.addGroup = function(t, e, r) { this.groups.push({ start: t, count: e, materialIndex: void 0 !== r ? r : 0 }) }, t.clearGroups = function() { this.groups = [] }, t.applyMatrix = function(t) { var e = this.attributes.position; void 0 !== e && (t.applyToBufferAttribute(e), e.needsUpdate = !0); var r = this.attributes.normal; void 0 !== r && ((new w).getNormalMatrix(t).applyToBufferAttribute(r), r.needsUpdate = !0); var n = this.attributes.tangent; void 0 !== n && ((new w).getNormalMatrix(t).applyToBufferAttribute(n), n.needsUpdate = !0); return this }, BufferGeometry }(), It = 0, Ot = function Texture(t, e, r, n, i, o, a, s, u, h) { Object.defineProperty(this, "id", { value: It++ }), this.uuid = generateUUID(), this.name = "", this.image = void 0 !== t ? t : Texture.DEFAULT_IMAGE, this.mapping = void 0 !== e ? e : Texture.DEFAULT_MAPPING, this.wrapS = void 0 !== r ? r : 33071, this.wrapT = void 0 !== n ? n : 33071, this.magFilter = void 0 !== i ? i : 1006, this.minFilter = void 0 !== o ? o : 1008, this.anisotropy = void 0 !== u ? u : 1, this.format = void 0 !== a ? a : 1023, this.type = void 0 !== s ? s : 1009, this.encoding = void 0 !== h ? h : 3e3 }; Ot.DEFAULT_IMAGE = void 0, Ot.DEFAULT_MAPPING = 300; var Ct = new S, Rt = new S, Dt = function() { function Skeleton(t, e) { if (t = t || [], this.bones = t.slice(0), this.boneMatrices = new Float32Array(16 * this.bones.length), void 0 === e) this.calculateInverses(); else if (this.bones.length === e.length) this.boneInverses = e.slice(0); else { this.boneInverses = []; for (var r = 0, n = this.bones.length; r < n; r++) this.boneInverses.push(new S) } } var t = Skeleton.prototype; return t.calculateInverses = function() { this.boneInverses = []; for (var t = 0, e = this.bones.length; t < e; t++) { var r = new S; this.bones[t] && r.getInverse(this.bones[t].matrixWorld), this.boneInverses.push(r) } }, t.pose = function() { var t, e, r; for (e = 0, r = this.bones.length; e < r; e++)(t = this.bones[e]) && t.matrixWorld.getInverse(this.boneInverses[e]); for (e = 0, r = this.bones.length; e < r; e++)(t = this.bones[e]) && (t.parent && t.parent.isBone ? (t.matrix.getInverse(t.parent.matrixWorld), t.matrix.multiply(t.matrixWorld)) : t.matrix.copy(t.matrixWorld), t.matrix.decompose(t.position, t.quaternion, t.scale)) }, t.update = function() { for (var t = Ct, e = Rt, r = this.bones, n = this.boneInverses, i = this.boneMatrices, o = this.boneTexture, a = 0, s = r.length; a < s; a++) { var u = r[a] ? r[a].matrixWorld : e; t.multiplyMatrices(u, n[a]), t.toArray(i, 16 * a) } void 0 !== o && (o.needsUpdate = !0) }, t.clone = function() { return new Skeleton(this.bones, this.boneInverses) }, t.getBoneByName = function(t) { for (var e = 0, r = this.bones.length; e < r; e++) { var n = this.bones[e]; if (n.name === t) return n } }, Skeleton }(); var Ft = function(n) { var t, e; function Mesh(t, e) { var r; return (r = n.call(this) || this).type = "Bone", r.isMesh = !0, r.geometry = void 0 !== t ? t : new Pt, r.material = void 0 !== e ? e : new MeshBasicMaterial({ color: 16777215 * Math.random() }), r } return e = n, (t = Mesh).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, Mesh }(St); var kt = function(n) { var t, e; function SkinnedMesh(t, e) { var r; return (r = n.call(this, t, e) || this).type = "SkinnedMesh", r.isSkinnedMesh = !0, r.bindMode = "attached", r.bindMatrix = new S, r.bindMatrixInverse = new S, r } e = n, (t = SkinnedMesh).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e; var r = SkinnedMesh.prototype; return r.bind = function(t, e) { this.skeleton = t, void 0 === e && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), e = this.matrixWorld), this.bindMatrix.copy(e), this.bindMatrixInverse.getInverse(e) }, r.pose = function() { this.skeleton.pose() }, r.normalizeSkinWeights = function() { for (var t = new _, e = this.geometry.attributes.skinWeight, r = 0, n = e.count; r < n; r++) { t.x = e.getX(r), t.y = e.getY(r), t.z = e.getZ(r), t.w = e.getW(r); var i = 1 / t.manhattanLength(); i !== 1 / 0 ? t.multiplyScalar(i) : t.set(1, 0, 0, 0), e.setXYZW(r, t.x, t.y, t.z, t.w) } }, r.updateMatrixWorld = function(t) { n.prototype.updateMatrixWorld.call(this, t), "attached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.matrixWorld) : "detached" === this.bindMode && this.bindMatrixInverse.getInverse(this.bindMatrix) }, SkinnedMesh }(Ft); r.d(e, "e", function() { return o }), r.d(e, "l", function() { return a }), r.d(e, "O", function() { return s }), r.d(e, "t", function() { return n }), r.d(e, "h", function() { return m }), r.d(e, "P", function() { return v }), r.d(e, "Q", function() { return _ }), r.d(e, "u", function() { return w }), r.d(e, "v", function() { return S }), r.d(e, "G", function() { return C }), r.d(e, "k", function() { return F }), r.d(e, "I", function() { return 10497 }), r.d(e, "g", function() { return 33071 }), r.d(e, "S", function() { return 2 }), r.d(e, "r", function() { return 2200 }), r.d(e, "s", function() { return 2201 }), r.d(e, "y", function() { return j.a }), r.d(e, "x", function() { return X.a }), r.d(e, "A", function() { return tt }), r.d(e, "H", function() { return $ }), r.d(e, "R", function() { return et }), r.d(e, "b", function() { return nt }), r.d(e, "c", function() { return yt }), r.d(e, "F", function() { return vt }), r.d(e, "q", function() { return i }), r.d(e, "B", function() { return St }), r.d(e, "m", function() { return Mt }), r.d(e, "d", function() { return Et }), r.d(e, "f", function() { return Pt }), r.d(e, "N", function() { return Ot }), r.d(e, "J", function() { return Dt }), r.d(e, "w", function() { return Ft }), r.d(e, "K", function() { return kt }) }, function(t, e, r) { "use strict"; e.__esModule = !0; var i = function() { function defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function(t, e, r) { return e && defineProperties(t.prototype, e), r && defineProperties(t, r), t } }(), o = function(t) { { if (t && t.__esModule) return t; var e = {}; if (null != t) for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e } }(r(0)), n = _interopRequireDefault(r(418)), a = _interopRequireDefault(r(423)); function _interopRequireDefault(t) { return t && t.__esModule ? t : { default: t } } var s = function(n) { function Entity3d(t) { ! function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, Entity3d); var e = function(t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, n.call(this)); if (t) { if (!t.state) { var r = new o.State; r.depthTest = !0, r.blend = !1, r.culling = !0, t.state = r } e.add(a.default, t) } return e } return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(Entity3d, n), i(Entity3d, [{ key: "x", set: function(t) { this.transform.position.x = t }, get: function() { return this.transform.position.x } }, { key: "y", set: function(t) { this.transform.position.y = t }, get: function() { return this.transform.position.y } }, { key: "z", set: function(t) { this.transform.position.z = t }, get: function() { return this.transform.position.z } }, { key: "sx", set: function(t) { this.transform.scale.x = t }, get: function() { return this.transform.scale.x } }, { key: "sy", set: function(t) { this.transform.scale.y = t }, get: function() { return this.transform.scale.y } }, { key: "sz", set: function(t) { this.transform.scale.z = t }, get: function() { return this.transform.scale.z } }, { key: "rx", set: function(t) { this.transform.rotation.x = t }, get: function() { return this.transform.rotation.x } }, { key: "ry", set: function(t) { this.transform.rotation.y = t }, get: function() { return this.transform.rotation.y } }, { key: "rz", set: function(t) { this.transform.rotation.z = t }, get: function() { return this.transform.rotation.z } }, { key: "position", get: function() { return this.transform.position } }, { key: "scale", get: function() { return this.transform.scale } }, { key: "rotation", get: function() { return this.transform.rotation } }]), Entity3d }(n.default); e.default = s }, function(t, e, r) { "use strict"; r.r(e); var n = {}; r.r(n), r.d(n, "EPSILON", function() { return F }), r.d(n, "ARRAY_TYPE", function() { return g }), r.d(n, "RANDOM", function() { return d }), r.d(n, "setMatrixArrayType", function() { return setMatrixArrayType }), r.d(n, "toRadian", function() { return toRadian }), r.d(n, "equals", function() { return equals }); var i = {}; r.r(i), r.d(i, "create", function() { return create }), r.d(i, "clone", function() { return clone }), r.d(i, "copy", function() { return copy }), r.d(i, "identity", function() { return identity }), r.d(i, "fromValues", function() { return fromValues }), r.d(i, "set", function() { return set }), r.d(i, "transpose", function() { return transpose }), r.d(i, "invert", function() { return invert }), r.d(i, "adjoint", function() { return adjoint }), r.d(i, "determinant", function() { return determinant }), r.d(i, "multiply", function() { return multiply }), r.d(i, "rotate", function() { return rotate }), r.d(i, "scale", function() { return mat2_scale }), r.d(i, "fromRotation", function() { return fromRotation }), r.d(i, "fromScaling", function() { return fromScaling }), r.d(i, "str", function() { return str }), r.d(i, "frob", function() { return frob }), r.d(i, "LDU", function() { return LDU }), r.d(i, "add", function() { return add }), r.d(i, "subtract", function() { return subtract }), r.d(i, "exactEquals", function() { return exactEquals }), r.d(i, "equals", function() { return mat2_equals }), r.d(i, "multiplyScalar", function() { return multiplyScalar }), r.d(i, "multiplyScalarAndAdd", function() { return multiplyScalarAndAdd }), r.d(i, "mul", function() { return m }), r.d(i, "sub", function() { return v }); var o = {}; r.r(o), r.d(o, "create", function() { return mat2d_create }), r.d(o, "clone", function() { return mat2d_clone }), r.d(o, "copy", function() { return mat2d_copy }), r.d(o, "identity", function() { return mat2d_identity }), r.d(o, "fromValues", function() { return mat2d_fromValues }), r.d(o, "set", function() { return mat2d_set }), r.d(o, "invert", function() { return mat2d_invert }), r.d(o, "determinant", function() { return mat2d_determinant }), r.d(o, "multiply", function() { return mat2d_multiply }), r.d(o, "rotate", function() { return mat2d_rotate }), r.d(o, "scale", function() { return mat2d_scale }), r.d(o, "translate", function() { return translate }), r.d(o, "fromRotation", function() { return mat2d_fromRotation }), r.d(o, "fromScaling", function() { return mat2d_fromScaling }), r.d(o, "fromTranslation", function() { return fromTranslation }), r.d(o, "str", function() { return mat2d_str }), r.d(o, "frob", function() { return mat2d_frob }), r.d(o, "add", function() { return mat2d_add }), r.d(o, "subtract", function() { return mat2d_subtract }), r.d(o, "multiplyScalar", function() { return mat2d_multiplyScalar }), r.d(o, "multiplyScalarAndAdd", function() { return mat2d_multiplyScalarAndAdd }), r.d(o, "exactEquals", function() { return mat2d_exactEquals }), r.d(o, "equals", function() { return mat2d_equals }), r.d(o, "mul", function() { return y }), r.d(o, "sub", function() { return _ }); var a = {}; r.r(a), r.d(a, "create", function() { return mat3_create }), r.d(a, "fromMat4", function() { return fromMat4 }), r.d(a, "clone", function() { return mat3_clone }), r.d(a, "copy", function() { return mat3_copy }), r.d(a, "fromValues", function() { return mat3_fromValues }), r.d(a, "set", function() { return mat3_set }), r.d(a, "identity", function() { return mat3_identity }), r.d(a, "transpose", function() { return mat3_transpose }), r.d(a, "invert", function() { return mat3_invert }), r.d(a, "adjoint", function() { return mat3_adjoint }), r.d(a, "determinant", function() { return mat3_determinant }), r.d(a, "multiply", function() { return mat3_multiply }), r.d(a, "translate", function() { return mat3_translate }), r.d(a, "rotate", function() { return mat3_rotate }), r.d(a, "scale", function() { return mat3_scale }), r.d(a, "fromTranslation", function() { return mat3_fromTranslation }), r.d(a, "fromRotation", function() { return mat3_fromRotation }), r.d(a, "fromScaling", function() { return mat3_fromScaling }), r.d(a, "fromMat2d", function() { return fromMat2d }), r.d(a, "fromQuat", function() { return fromQuat }), r.d(a, "normalFromMat4", function() { return normalFromMat4 }), r.d(a, "projection", function() { return projection }), r.d(a, "str", function() { return mat3_str }), r.d(a, "frob", function() { return mat3_frob }), r.d(a, "add", function() { return mat3_add }), r.d(a, "subtract", function() { return mat3_subtract }), r.d(a, "multiplyScalar", function() { return mat3_multiplyScalar }), r.d(a, "multiplyScalarAndAdd", function() { return mat3_multiplyScalarAndAdd }), r.d(a, "exactEquals", function() { return mat3_exactEquals }), r.d(a, "equals", function() { return mat3_equals }), r.d(a, "mul", function() { return b }), r.d(a, "sub", function() { return x }); var s = {}; r.r(s), r.d(s, "create", function() { return mat4_create }), r.d(s, "clone", function() { return mat4_clone }), r.d(s, "copy", function() { return mat4_copy }), r.d(s, "fromValues", function() { return mat4_fromValues }), r.d(s, "set", function() { return mat4_set }), r.d(s, "identity", function() { return mat4_identity }), r.d(s, "transpose", function() { return mat4_transpose }), r.d(s, "invert", function() { return mat4_invert }), r.d(s, "adjoint", function() { return mat4_adjoint }), r.d(s, "determinant", function() { return mat4_determinant }), r.d(s, "multiply", function() { return mat4_multiply }), r.d(s, "translate", function() { return mat4_translate }), r.d(s, "scale", function() { return mat4_scale }), r.d(s, "rotate", function() { return mat4_rotate }), r.d(s, "rotateX", function() { return rotateX }), r.d(s, "rotateY", function() { return rotateY }), r.d(s, "rotateZ", function() { return rotateZ }), r.d(s, "fromTranslation", function() { return mat4_fromTranslation }), r.d(s, "fromScaling", function() { return mat4_fromScaling }), r.d(s, "fromRotation", function() { return mat4_fromRotation }), r.d(s, "fromXRotation", function() { return fromXRotation }), r.d(s, "fromYRotation", function() { return fromYRotation }), r.d(s, "fromZRotation", function() { return fromZRotation }), r.d(s, "fromRotationTranslation", function() { return fromRotationTranslation }), r.d(s, "fromQuat2", function() { return fromQuat2 }), r.d(s, "getTranslation", function() { return getTranslation }), r.d(s, "getScaling", function() { return getScaling }), r.d(s, "getRotation", function() { return getRotation }), r.d(s, "fromRotationTranslationScale", function() { return fromRotationTranslationScale }), r.d(s, "fromRotationTranslationScaleOrigin", function() { return fromRotationTranslationScaleOrigin }), r.d(s, "fromQuat", function() { return mat4_fromQuat }), r.d(s, "frustum", function() { return frustum }), r.d(s, "perspective", function() { return perspective }), r.d(s, "perspectiveFromFieldOfView", function() { return perspectiveFromFieldOfView }), r.d(s, "ortho", function() { return ortho }), r.d(s, "lookAt", function() { return lookAt }), r.d(s, "targetTo", function() { return targetTo }), r.d(s, "str", function() { return mat4_str }), r.d(s, "frob", function() { return mat4_frob }), r.d(s, "add", function() { return mat4_add }), r.d(s, "subtract", function() { return mat4_subtract }), r.d(s, "multiplyScalar", function() { return mat4_multiplyScalar }), r.d(s, "multiplyScalarAndAdd", function() { return mat4_multiplyScalarAndAdd }), r.d(s, "exactEquals", function() { return mat4_exactEquals }), r.d(s, "equals", function() { return mat4_equals }), r.d(s, "mul", function() { return w }), r.d(s, "sub", function() { return T }); var u = {}; r.r(u), r.d(u, "create", function() { return vec3_create }), r.d(u, "clone", function() { return vec3_clone }), r.d(u, "length", function() { return vec3_length }), r.d(u, "fromValues", function() { return vec3_fromValues }), r.d(u, "copy", function() { return vec3_copy }), r.d(u, "set", function() { return vec3_set }), r.d(u, "add", function() { return vec3_add }), r.d(u, "subtract", function() { return vec3_subtract }), r.d(u, "multiply", function() { return vec3_multiply }), r.d(u, "divide", function() { return divide }), r.d(u, "ceil", function() { return ceil }), r.d(u, "floor", function() { return floor }), r.d(u, "min", function() { return min }), r.d(u, "max", function() { return max }), r.d(u, "round", function() { return round }), r.d(u, "scale", function() { return vec3_scale }), r.d(u, "scaleAndAdd", function() { return scaleAndAdd }), r.d(u, "distance", function() { return distance }), r.d(u, "squaredDistance", function() { return squaredDistance }), r.d(u, "squaredLength", function() { return squaredLength }), r.d(u, "negate", function() { return negate }), r.d(u, "inverse", function() { return inverse }), r.d(u, "normalize", function() { return normalize }), r.d(u, "dot", function() { return vec3_dot }), r.d(u, "cross", function() { return cross }), r.d(u, "lerp", function() { return lerp }), r.d(u, "hermite", function() { return hermite }), r.d(u, "bezier", function() { return bezier }), r.d(u, "random", function() { return random }), r.d(u, "transformMat4", function() { return transformMat4 }), r.d(u, "transformMat3", function() { return transformMat3 }), r.d(u, "transformQuat", function() { return transformQuat }), r.d(u, "rotateX", function() { return vec3_rotateX }), r.d(u, "rotateY", function() { return vec3_rotateY }), r.d(u, "rotateZ", function() { return vec3_rotateZ }), r.d(u, "angle", function() { return angle }), r.d(u, "str", function() { return vec3_str }), r.d(u, "exactEquals", function() { return vec3_exactEquals }), r.d(u, "equals", function() { return vec3_equals }), r.d(u, "sub", function() { return M }), r.d(u, "mul", function() { return E }), r.d(u, "div", function() { return A }), r.d(u, "dist", function() { return P }), r.d(u, "sqrDist", function() { return I }), r.d(u, "len", function() { return O }), r.d(u, "sqrLen", function() { return C }), r.d(u, "forEach", function() { return R }); var h = {}; r.r(h), r.d(h, "create", function() { return vec4_create }), r.d(h, "clone", function() { return vec4_clone }), r.d(h, "fromValues", function() { return vec4_fromValues }), r.d(h, "copy", function() { return vec4_copy }), r.d(h, "set", function() { return vec4_set }), r.d(h, "add", function() { return vec4_add }), r.d(h, "subtract", function() { return vec4_subtract }), r.d(h, "multiply", function() { return vec4_multiply }), r.d(h, "divide", function() { return vec4_divide }), r.d(h, "ceil", function() { return vec4_ceil }), r.d(h, "floor", function() { return vec4_floor }), r.d(h, "min", function() { return vec4_min }), r.d(h, "max", function() { return vec4_max }), r.d(h, "round", function() { return vec4_round }), r.d(h, "scale", function() { return vec4_scale }), r.d(h, "scaleAndAdd", function() { return vec4_scaleAndAdd }), r.d(h, "distance", function() { return vec4_distance }), r.d(h, "squaredDistance", function() { return vec4_squaredDistance }), r.d(h, "length", function() { return vec4_length }), r.d(h, "squaredLength", function() { return vec4_squaredLength }), r.d(h, "negate", function() { return vec4_negate }), r.d(h, "inverse", function() { return vec4_inverse }), r.d(h, "normalize", function() { return vec4_normalize }), r.d(h, "dot", function() { return vec4_dot }), r.d(h, "lerp", function() { return vec4_lerp }), r.d(h, "random", function() { return vec4_random }), r.d(h, "transformMat4", function() { return vec4_transformMat4 }), r.d(h, "transformQuat", function() { return vec4_transformQuat }), r.d(h, "str", function() { return vec4_str }), r.d(h, "exactEquals", function() { return vec4_exactEquals }), r.d(h, "equals", function() { return vec4_equals }), r.d(h, "sub", function() { return k }), r.d(h, "mul", function() { return L }), r.d(h, "div", function() { return N }), r.d(h, "dist", function() { return B }), r.d(h, "sqrDist", function() { return U }), r.d(h, "len", function() { return G }), r.d(h, "sqrLen", function() { return j }), r.d(h, "forEach", function() { return z }); var c = {}; r.r(c), r.d(c, "create", function() { return quat_create }), r.d(c, "identity", function() { return quat_identity }), r.d(c, "setAxisAngle", function() { return setAxisAngle }), r.d(c, "getAxisAngle", function() { return getAxisAngle }), r.d(c, "multiply", function() { return quat_multiply }), r.d(c, "rotateX", function() { return quat_rotateX }), r.d(c, "rotateY", function() { return quat_rotateY }), r.d(c, "rotateZ", function() { return quat_rotateZ }), r.d(c, "calculateW", function() { return calculateW }), r.d(c, "slerp", function() { return slerp }), r.d(c, "random", function() { return quat_random }), r.d(c, "invert", function() { return quat_invert }), r.d(c, "conjugate", function() { return conjugate }), r.d(c, "fromMat3", function() { return fromMat3 }), r.d(c, "fromEuler", function() { return fromEuler }), r.d(c, "str", function() { return quat_str }), r.d(c, "clone", function() { return K }), r.d(c, "fromValues", function() { return Z }), r.d(c, "copy", function() { return Q }), r.d(c, "set", function() { return J }), r.d(c, "add", function() { return $ }), r.d(c, "mul", function() { return tt }), r.d(c, "scale", function() { return et }), r.d(c, "dot", function() { return rt }), r.d(c, "lerp", function() { return nt }), r.d(c, "length", function() { return it }), r.d(c, "len", function() { return ot }), r.d(c, "squaredLength", function() { return at }), r.d(c, "sqrLen", function() { return st }), r.d(c, "normalize", function() { return ut }), r.d(c, "exactEquals", function() { return ht }), r.d(c, "equals", function() { return ct }), r.d(c, "rotationTo", function() { return lt }), r.d(c, "sqlerp", function() { return ft }), r.d(c, "setAxes", function() { return dt }); var l = {}; r.r(l), r.d(l, "create", function() { return quat2_create }), r.d(l, "clone", function() { return quat2_clone }), r.d(l, "fromValues", function() { return quat2_fromValues }), r.d(l, "fromRotationTranslationValues", function() { return fromRotationTranslationValues }), r.d(l, "fromRotationTranslation", function() { return quat2_fromRotationTranslation }), r.d(l, "fromTranslation", function() { return quat2_fromTranslation }), r.d(l, "fromRotation", function() { return quat2_fromRotation }), r.d(l, "fromMat4", function() { return quat2_fromMat4 }), r.d(l, "copy", function() { return quat2_copy }), r.d(l, "identity", function() { return quat2_identity }), r.d(l, "set", function() { return quat2_set }), r.d(l, "getReal", function() { return pt }), r.d(l, "getDual", function() { return getDual }), r.d(l, "setReal", function() { return mt }), r.d(l, "setDual", function() { return setDual }), r.d(l, "getTranslation", function() { return quat2_getTranslation }), r.d(l, "translate", function() { return quat2_translate }), r.d(l, "rotateX", function() { return quat2_rotateX }), r.d(l, "rotateY", function() { return quat2_rotateY }), r.d(l, "rotateZ", function() { return quat2_rotateZ }), r.d(l, "rotateByQuatAppend", function() { return rotateByQuatAppend }), r.d(l, "rotateByQuatPrepend", function() { return rotateByQuatPrepend }), r.d(l, "rotateAroundAxis", function() { return rotateAroundAxis }), r.d(l, "add", function() { return quat2_add }), r.d(l, "multiply", function() { return quat2_multiply }), r.d(l, "mul", function() { return vt }), r.d(l, "scale", function() { return quat2_scale }), r.d(l, "dot", function() { return gt }), r.d(l, "lerp", function() { return quat2_lerp }), r.d(l, "invert", function() { return quat2_invert }), r.d(l, "conjugate", function() { return quat2_conjugate }), r.d(l, "length", function() { return yt }), r.d(l, "len", function() { return _t }), r.d(l, "squaredLength", function() { return bt }), r.d(l, "sqrLen", function() { return xt }), r.d(l, "normalize", function() { return quat2_normalize }), r.d(l, "str", function() { return quat2_str }), r.d(l, "exactEquals", function() { return quat2_exactEquals }), r.d(l, "equals", function() { return quat2_equals }); var f = {}; r.r(f), r.d(f, "create", function() { return vec2_create }), r.d(f, "clone", function() { return vec2_clone }), r.d(f, "fromValues", function() { return vec2_fromValues }), r.d(f, "copy", function() { return vec2_copy }), r.d(f, "set", function() { return vec2_set }), r.d(f, "add", function() { return vec2_add }), r.d(f, "subtract", function() { return vec2_subtract }), r.d(f, "multiply", function() { return vec2_multiply }), r.d(f, "divide", function() { return vec2_divide }), r.d(f, "ceil", function() { return vec2_ceil }), r.d(f, "floor", function() { return vec2_floor }), r.d(f, "min", function() { return vec2_min }), r.d(f, "max", function() { return vec2_max }), r.d(f, "round", function() { return vec2_round }), r.d(f, "scale", function() { return vec2_scale }), r.d(f, "scaleAndAdd", function() { return vec2_scaleAndAdd }), r.d(f, "distance", function() { return vec2_distance }), r.d(f, "squaredDistance", function() { return vec2_squaredDistance }), r.d(f, "length", function() { return vec2_length }), r.d(f, "squaredLength", function() { return vec2_squaredLength }), r.d(f, "negate", function() { return vec2_negate }), r.d(f, "inverse", function() { return vec2_inverse }), r.d(f, "normalize", function() { return vec2_normalize }), r.d(f, "dot", function() { return vec2_dot }), r.d(f, "cross", function() { return vec2_cross }), r.d(f, "lerp", function() { return vec2_lerp }), r.d(f, "random", function() { return vec2_random }), r.d(f, "transformMat2", function() { return transformMat2 }), r.d(f, "transformMat2d", function() { return transformMat2d }), r.d(f, "transformMat3", function() { return vec2_transformMat3 }), r.d(f, "transformMat4", function() { return vec2_transformMat4 }), r.d(f, "rotate", function() { return vec2_rotate }), r.d(f, "angle", function() { return vec2_angle }), r.d(f, "str", function() { return vec2_str }), r.d(f, "exactEquals", function() { return vec2_exactEquals }), r.d(f, "equals", function() { return vec2_equals }), r.d(f, "len", function() { return Tt }), r.d(f, "sub", function() { return St }), r.d(f, "mul", function() { return Mt }), r.d(f, "div", function() { return Et }), r.d(f, "dist", function() { return At }), r.d(f, "sqrDist", function() { return Pt }), r.d(f, "sqrLen", function() { return It }), r.d(f, "forEach", function() { return Ot }); var F = 1e-6, g = "undefined" != typeof Float32Array ? Float32Array : Array, d = Math.random; function setMatrixArrayType(t) { g = t } var p = Math.PI / 180; function toRadian(t) { return t * p } function equals(t, e) { return Math.abs(t - e) <= F * Math.max(1, Math.abs(t), Math.abs(e)) } function create() { var t = new g(4); return g != Float32Array && (t[1] = 0, t[2] = 0), t[0] = 1, t[3] = 1, t } function clone(t) { var e = new g(4); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e } function copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t } function identity(t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 1, t } function fromValues(t, e, r, n) { var i = new g(4); return i[0] = t, i[1] = e, i[2] = r, i[3] = n, i } function set(t, e, r, n, i) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t } function transpose(t, e) { if (t === e) { var r = e[1]; t[1] = e[2], t[2] = r } else t[0] = e[0], t[1] = e[2], t[2] = e[1], t[3] = e[3]; return t } function invert(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = r * o - i * n; return a ? (a = 1 / a, t[0] = o * a, t[1] = -n * a, t[2] = -i * a, t[3] = r * a, t) : null } function adjoint(t, e) { var r = e[0]; return t[0] = e[3], t[1] = -e[1], t[2] = -e[2], t[3] = r, t } function determinant(t) { return t[0] * t[3] - t[2] * t[1] } function multiply(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = r[0], u = r[1], h = r[2], c = r[3]; return t[0] = n * s + o * u, t[1] = i * s + a * u, t[2] = n * h + o * c, t[3] = i * h + a * c, t } function rotate(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = Math.sin(r), u = Math.cos(r); return t[0] = n * u + o * s, t[1] = i * u + a * s, t[2] = n * -s + o * u, t[3] = i * -s + a * u, t } function mat2_scale(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = r[0], u = r[1]; return t[0] = n * s, t[1] = i * s, t[2] = o * u, t[3] = a * u, t } function fromRotation(t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = -r, t[3] = n, t } function fromScaling(t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = e[1], t } function str(t) { return "mat2(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")" } function frob(t) { return Math.sqrt(Math.pow(t[0], 2) + Math.pow(t[1], 2) + Math.pow(t[2], 2) + Math.pow(t[3], 2)) } function LDU(t, e, r, n) { return t[2] = n[2] / n[0], r[0] = n[0], r[1] = n[1], r[3] = n[3] - t[2] * r[1], [t, e, r] } function add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t } function subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t } function exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] } function mat2_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = t[3], a = e[0], s = e[1], u = e[2], h = e[3]; return Math.abs(r - a) <= F * Math.max(1, Math.abs(r), Math.abs(a)) && Math.abs(n - s) <= F * Math.max(1, Math.abs(n), Math.abs(s)) && Math.abs(i - u) <= F * Math.max(1, Math.abs(i), Math.abs(u)) && Math.abs(o - h) <= F * Math.max(1, Math.abs(o), Math.abs(h)) } function multiplyScalar(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t } function multiplyScalarAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t } var m = multiply, v = subtract; function mat2d_create() { var t = new g(6); return g != Float32Array && (t[1] = 0, t[2] = 0, t[4] = 0, t[5] = 0), t[0] = 1, t[3] = 1, t } function mat2d_clone(t) { var e = new g(6); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e } function mat2d_copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t } function mat2d_identity(t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = 0, t[5] = 0, t } function mat2d_fromValues(t, e, r, n, i, o) { var a = new g(6); return a[0] = t, a[1] = e, a[2] = r, a[3] = n, a[4] = i, a[5] = o, a } function mat2d_set(t, e, r, n, i, o, a) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = o, t[5] = a, t } function mat2d_invert(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = e[4], s = e[5], u = r * o - n * i; return u ? (u = 1 / u, t[0] = o * u, t[1] = -n * u, t[2] = -i * u, t[3] = r * u, t[4] = (i * s - o * a) * u, t[5] = (n * a - r * s) * u, t) : null } function mat2d_determinant(t) { return t[0] * t[3] - t[1] * t[2] } function mat2d_multiply(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = r[0], c = r[1], l = r[2], f = r[3], d = r[4], p = r[5]; return t[0] = n * h + o * c, t[1] = i * h + a * c, t[2] = n * l + o * f, t[3] = i * l + a * f, t[4] = n * d + o * p + s, t[5] = i * d + a * p + u, t } function mat2d_rotate(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = Math.sin(r), c = Math.cos(r); return t[0] = n * c + o * h, t[1] = i * c + a * h, t[2] = n * -h + o * c, t[3] = i * -h + a * c, t[4] = s, t[5] = u, t } function mat2d_scale(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = r[0], c = r[1]; return t[0] = n * h, t[1] = i * h, t[2] = o * c, t[3] = a * c, t[4] = s, t[5] = u, t } function translate(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = r[0], c = r[1]; return t[0] = n, t[1] = i, t[2] = o, t[3] = a, t[4] = n * h + o * c + s, t[5] = i * h + a * c + u, t } function mat2d_fromRotation(t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = -r, t[3] = n, t[4] = 0, t[5] = 0, t } function mat2d_fromScaling(t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = e[1], t[4] = 0, t[5] = 0, t } function fromTranslation(t, e) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = e[0], t[5] = e[1], t } function mat2d_str(t) { return "mat2d(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ")" } function mat2d_frob(t) { return Math.sqrt(Math.pow(t[0], 2) + Math.pow(t[1], 2) + Math.pow(t[2], 2) + Math.pow(t[3], 2) + Math.pow(t[4], 2) + Math.pow(t[5], 2) + 1) } function mat2d_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t } function mat2d_subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t[4] = e[4] - r[4], t[5] = e[5] - r[5], t } function mat2d_multiplyScalar(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t[4] = e[4] * r, t[5] = e[5] * r, t } function mat2d_multiplyScalarAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t[4] = e[4] + r[4] * n, t[5] = e[5] + r[5] * n, t } function mat2d_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] } function mat2d_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = t[3], a = t[4], s = t[5], u = e[0], h = e[1], c = e[2], l = e[3], f = e[4], d = e[5]; return Math.abs(r - u) <= F * Math.max(1, Math.abs(r), Math.abs(u)) && Math.abs(n - h) <= F * Math.max(1, Math.abs(n), Math.abs(h)) && Math.abs(i - c) <= F * Math.max(1, Math.abs(i), Math.abs(c)) && Math.abs(o - l) <= F * Math.max(1, Math.abs(o), Math.abs(l)) && Math.abs(a - f) <= F * Math.max(1, Math.abs(a), Math.abs(f)) && Math.abs(s - d) <= F * Math.max(1, Math.abs(s), Math.abs(d)) } var y = mat2d_multiply, _ = mat2d_subtract; function mat3_create() { var t = new g(9); return g != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[0] = 1, t[4] = 1, t[8] = 1, t } function fromMat4(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[4], t[4] = e[5], t[5] = e[6], t[6] = e[8], t[7] = e[9], t[8] = e[10], t } function mat3_clone(t) { var e = new g(9); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e } function mat3_copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t } function mat3_fromValues(t, e, r, n, i, o, a, s, u) { var h = new g(9); return h[0] = t, h[1] = e, h[2] = r, h[3] = n, h[4] = i, h[5] = o, h[6] = a, h[7] = s, h[8] = u, h } function mat3_set(t, e, r, n, i, o, a, s, u, h) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = o, t[5] = a, t[6] = s, t[7] = u, t[8] = h, t } function mat3_identity(t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t } function mat3_transpose(t, e) { if (t === e) { var r = e[1], n = e[2], i = e[5]; t[1] = e[3], t[2] = e[6], t[3] = r, t[5] = e[7], t[6] = n, t[7] = i } else t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = e[1], t[4] = e[4], t[5] = e[7], t[6] = e[2], t[7] = e[5], t[8] = e[8]; return t } function mat3_invert(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = e[4], s = e[5], u = e[6], h = e[7], c = e[8], l = c * a - s * h, f = -c * o + s * u, d = h * o - a * u, p = r * l + n * f + i * d; return p ? (p = 1 / p, t[0] = l * p, t[1] = (-c * n + i * h) * p, t[2] = (s * n - i * a) * p, t[3] = f * p, t[4] = (c * r - i * u) * p, t[5] = (-s * r + i * o) * p, t[6] = d * p, t[7] = (-h * r + n * u) * p, t[8] = (a * r - n * o) * p, t) : null } function mat3_adjoint(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = e[4], s = e[5], u = e[6], h = e[7], c = e[8]; return t[0] = a * c - s * h, t[1] = i * h - n * c, t[2] = n * s - i * a, t[3] = s * u - o * c, t[4] = r * c - i * u, t[5] = i * o - r * s, t[6] = o * h - a * u, t[7] = n * u - r * h, t[8] = r * a - n * o, t } function mat3_determinant(t) { var e = t[0], r = t[1], n = t[2], i = t[3], o = t[4], a = t[5], s = t[6], u = t[7], h = t[8]; return e * (h * o - a * u) + r * (-h * i + a * s) + n * (u * i - o * s) } function mat3_multiply(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = e[8], f = r[0], d = r[1], p = r[2], m = r[3], v = r[4], g = r[5], y = r[6], _ = r[7], b = r[8]; return t[0] = f * n + d * a + p * h, t[1] = f * i + d * s + p * c, t[2] = f * o + d * u + p * l, t[3] = m * n + v * a + g * h, t[4] = m * i + v * s + g * c, t[5] = m * o + v * u + g * l, t[6] = y * n + _ * a + b * h, t[7] = y * i + _ * s + b * c, t[8] = y * o + _ * u + b * l, t } function mat3_translate(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = e[8], f = r[0], d = r[1]; return t[0] = n, t[1] = i, t[2] = o, t[3] = a, t[4] = s, t[5] = u, t[6] = f * n + d * a + h, t[7] = f * i + d * s + c, t[8] = f * o + d * u + l, t } function mat3_rotate(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = e[8], f = Math.sin(r), d = Math.cos(r); return t[0] = d * n + f * a, t[1] = d * i + f * s, t[2] = d * o + f * u, t[3] = d * a - f * n, t[4] = d * s - f * i, t[5] = d * u - f * o, t[6] = h, t[7] = c, t[8] = l, t } function mat3_scale(t, e, r) { var n = r[0], i = r[1]; return t[0] = n * e[0], t[1] = n * e[1], t[2] = n * e[2], t[3] = i * e[3], t[4] = i * e[4], t[5] = i * e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t } function mat3_fromTranslation(t, e) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 1, t[5] = 0, t[6] = e[0], t[7] = e[1], t[8] = 1, t } function mat3_fromRotation(t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = 0, t[3] = -r, t[4] = n, t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t } function mat3_fromScaling(t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = e[1], t[5] = 0, t[6] = 0, t[7] = 0, t[8] = 1, t } function fromMat2d(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = 0, t[3] = e[2], t[4] = e[3], t[5] = 0, t[6] = e[4], t[7] = e[5], t[8] = 1, t } function fromQuat(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = r + r, s = n + n, u = i + i, h = r * a, c = n * a, l = n * s, f = i * a, d = i * s, p = i * u, m = o * a, v = o * s, g = o * u; return t[0] = 1 - l - p, t[3] = c - g, t[6] = f + v, t[1] = c + g, t[4] = 1 - h - p, t[7] = d - m, t[2] = f - v, t[5] = d + m, t[8] = 1 - h - l, t } function normalFromMat4(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = e[4], s = e[5], u = e[6], h = e[7], c = e[8], l = e[9], f = e[10], d = e[11], p = e[12], m = e[13], v = e[14], g = e[15], y = r * s - n * a, _ = r * u - i * a, b = r * h - o * a, x = n * u - i * s, w = n * h - o * s, T = i * h - o * u, S = c * m - l * p, M = c * v - f * p, E = c * g - d * p, A = l * v - f * m, P = l * g - d * m, I = f * g - d * v, O = y * I - _ * P + b * A + x * E - w * M + T * S; return O ? (O = 1 / O, t[0] = (s * I - u * P + h * A) * O, t[1] = (u * E - a * I - h * M) * O, t[2] = (a * P - s * E + h * S) * O, t[3] = (i * P - n * I - o * A) * O, t[4] = (r * I - i * E + o * M) * O, t[5] = (n * E - r * P - o * S) * O, t[6] = (m * T - v * w + g * x) * O, t[7] = (v * b - p * T - g * _) * O, t[8] = (p * w - m * b + g * y) * O, t) : null } function projection(t, e, r) { return t[0] = 2 / e, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = -2 / r, t[5] = 0, t[6] = -1, t[7] = 1, t[8] = 1, t } function mat3_str(t) { return "mat3(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ")" } function mat3_frob(t) { return Math.sqrt(Math.pow(t[0], 2) + Math.pow(t[1], 2) + Math.pow(t[2], 2) + Math.pow(t[3], 2) + Math.pow(t[4], 2) + Math.pow(t[5], 2) + Math.pow(t[6], 2) + Math.pow(t[7], 2) + Math.pow(t[8], 2)) } function mat3_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t[6] = e[6] + r[6], t[7] = e[7] + r[7], t[8] = e[8] + r[8], t } function mat3_subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t[4] = e[4] - r[4], t[5] = e[5] - r[5], t[6] = e[6] - r[6], t[7] = e[7] - r[7], t[8] = e[8] - r[8], t } function mat3_multiplyScalar(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t[4] = e[4] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t[8] = e[8] * r, t } function mat3_multiplyScalarAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t[4] = e[4] + r[4] * n, t[5] = e[5] + r[5] * n, t[6] = e[6] + r[6] * n, t[7] = e[7] + r[7] * n, t[8] = e[8] + r[8] * n, t } function mat3_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] && t[6] === e[6] && t[7] === e[7] && t[8] === e[8] } function mat3_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = t[3], a = t[4], s = t[5], u = t[6], h = t[7], c = t[8], l = e[0], f = e[1], d = e[2], p = e[3], m = e[4], v = e[5], g = e[6], y = e[7], _ = e[8]; return Math.abs(r - l) <= F * Math.max(1, Math.abs(r), Math.abs(l)) && Math.abs(n - f) <= F * Math.max(1, Math.abs(n), Math.abs(f)) && Math.abs(i - d) <= F * Math.max(1, Math.abs(i), Math.abs(d)) && Math.abs(o - p) <= F * Math.max(1, Math.abs(o), Math.abs(p)) && Math.abs(a - m) <= F * Math.max(1, Math.abs(a), Math.abs(m)) && Math.abs(s - v) <= F * Math.max(1, Math.abs(s), Math.abs(v)) && Math.abs(u - g) <= F * Math.max(1, Math.abs(u), Math.abs(g)) && Math.abs(h - y) <= F * Math.max(1, Math.abs(h), Math.abs(y)) && Math.abs(c - _) <= F * Math.max(1, Math.abs(c), Math.abs(_)) } var b = mat3_multiply, x = mat3_subtract; function mat4_create() { var t = new g(16); return g != Float32Array && (t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0), t[0] = 1, t[5] = 1, t[10] = 1, t[15] = 1, t } function mat4_clone(t) { var e = new g(16); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e } function mat4_copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t } function mat4_fromValues(t, e, r, n, i, o, a, s, u, h, c, l, f, d, p, m) { var v = new g(16); return v[0] = t, v[1] = e, v[2] = r, v[3] = n, v[4] = i, v[5] = o, v[6] = a, v[7] = s, v[8] = u, v[9] = h, v[10] = c, v[11] = l, v[12] = f, v[13] = d, v[14] = p, v[15] = m, v } function mat4_set(t, e, r, n, i, o, a, s, u, h, c, l, f, d, p, m, v) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = o, t[5] = a, t[6] = s, t[7] = u, t[8] = h, t[9] = c, t[10] = l, t[11] = f, t[12] = d, t[13] = p, t[14] = m, t[15] = v, t } function mat4_identity(t) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t } function mat4_transpose(t, e) { if (t === e) { var r = e[1], n = e[2], i = e[3], o = e[6], a = e[7], s = e[11]; t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = r, t[6] = e[9], t[7] = e[13], t[8] = n, t[9] = o, t[11] = e[14], t[12] = i, t[13] = a, t[14] = s } else t[0] = e[0], t[1] = e[4], t[2] = e[8], t[3] = e[12], t[4] = e[1], t[5] = e[5], t[6] = e[9], t[7] = e[13], t[8] = e[2], t[9] = e[6], t[10] = e[10], t[11] = e[14], t[12] = e[3], t[13] = e[7], t[14] = e[11], t[15] = e[15]; return t } function mat4_invert(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = e[4], s = e[5], u = e[6], h = e[7], c = e[8], l = e[9], f = e[10], d = e[11], p = e[12], m = e[13], v = e[14], g = e[15], y = r * s - n * a, _ = r * u - i * a, b = r * h - o * a, x = n * u - i * s, w = n * h - o * s, T = i * h - o * u, S = c * m - l * p, M = c * v - f * p, E = c * g - d * p, A = l * v - f * m, P = l * g - d * m, I = f * g - d * v, O = y * I - _ * P + b * A + x * E - w * M + T * S; return O ? (O = 1 / O, t[0] = (s * I - u * P + h * A) * O, t[1] = (i * P - n * I - o * A) * O, t[2] = (m * T - v * w + g * x) * O, t[3] = (f * w - l * T - d * x) * O, t[4] = (u * E - a * I - h * M) * O, t[5] = (r * I - i * E + o * M) * O, t[6] = (v * b - p * T - g * _) * O, t[7] = (c * T - f * b + d * _) * O, t[8] = (a * P - s * E + h * S) * O, t[9] = (n * E - r * P - o * S) * O, t[10] = (p * w - m * b + g * y) * O, t[11] = (l * b - c * w - d * y) * O, t[12] = (s * M - a * A - u * S) * O, t[13] = (r * A - n * M + i * S) * O, t[14] = (m * _ - p * x - v * y) * O, t[15] = (c * x - l * _ + f * y) * O, t) : null } function mat4_adjoint(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = e[4], s = e[5], u = e[6], h = e[7], c = e[8], l = e[9], f = e[10], d = e[11], p = e[12], m = e[13], v = e[14], g = e[15]; return t[0] = s * (f * g - d * v) - l * (u * g - h * v) + m * (u * d - h * f), t[1] = -(n * (f * g - d * v) - l * (i * g - o * v) + m * (i * d - o * f)), t[2] = n * (u * g - h * v) - s * (i * g - o * v) + m * (i * h - o * u), t[3] = -(n * (u * d - h * f) - s * (i * d - o * f) + l * (i * h - o * u)), t[4] = -(a * (f * g - d * v) - c * (u * g - h * v) + p * (u * d - h * f)), t[5] = r * (f * g - d * v) - c * (i * g - o * v) + p * (i * d - o * f), t[6] = -(r * (u * g - h * v) - a * (i * g - o * v) + p * (i * h - o * u)), t[7] = r * (u * d - h * f) - a * (i * d - o * f) + c * (i * h - o * u), t[8] = a * (l * g - d * m) - c * (s * g - h * m) + p * (s * d - h * l), t[9] = -(r * (l * g - d * m) - c * (n * g - o * m) + p * (n * d - o * l)), t[10] = r * (s * g - h * m) - a * (n * g - o * m) + p * (n * h - o * s), t[11] = -(r * (s * d - h * l) - a * (n * d - o * l) + c * (n * h - o * s)), t[12] = -(a * (l * v - f * m) - c * (s * v - u * m) + p * (s * f - u * l)), t[13] = r * (l * v - f * m) - c * (n * v - i * m) + p * (n * f - i * l), t[14] = -(r * (s * v - u * m) - a * (n * v - i * m) + p * (n * u - i * s)), t[15] = r * (s * f - u * l) - a * (n * f - i * l) + c * (n * u - i * s), t } function mat4_determinant(t) { var e = t[0], r = t[1], n = t[2], i = t[3], o = t[4], a = t[5], s = t[6], u = t[7], h = t[8], c = t[9], l = t[10], f = t[11], d = t[12], p = t[13], m = t[14], v = t[15]; return (e * a - r * o) * (l * v - f * m) - (e * s - n * o) * (c * v - f * p) + (e * u - i * o) * (c * m - l * p) + (r * s - n * a) * (h * v - f * d) - (r * u - i * a) * (h * m - l * d) + (n * u - i * s) * (h * p - c * d) } function mat4_multiply(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = e[8], f = e[9], d = e[10], p = e[11], m = e[12], v = e[13], g = e[14], y = e[15], _ = r[0], b = r[1], x = r[2], w = r[3]; return t[0] = _ * n + b * s + x * l + w * m, t[1] = _ * i + b * u + x * f + w * v, t[2] = _ * o + b * h + x * d + w * g, t[3] = _ * a + b * c + x * p + w * y, _ = r[4], b = r[5], x = r[6], w = r[7], t[4] = _ * n + b * s + x * l + w * m, t[5] = _ * i + b * u + x * f + w * v, t[6] = _ * o + b * h + x * d + w * g, t[7] = _ * a + b * c + x * p + w * y, _ = r[8], b = r[9], x = r[10], w = r[11], t[8] = _ * n + b * s + x * l + w * m, t[9] = _ * i + b * u + x * f + w * v, t[10] = _ * o + b * h + x * d + w * g, t[11] = _ * a + b * c + x * p + w * y, _ = r[12], b = r[13], x = r[14], w = r[15], t[12] = _ * n + b * s + x * l + w * m, t[13] = _ * i + b * u + x * f + w * v, t[14] = _ * o + b * h + x * d + w * g, t[15] = _ * a + b * c + x * p + w * y, t } function mat4_translate(t, e, r) { var n = r[0], i = r[1], o = r[2], a = void 0, s = void 0, u = void 0, h = void 0, c = void 0, l = void 0, f = void 0, d = void 0, p = void 0, m = void 0, v = void 0, g = void 0; return t[15] = e === t ? (t[12] = e[0] * n + e[4] * i + e[8] * o + e[12], t[13] = e[1] * n + e[5] * i + e[9] * o + e[13], t[14] = e[2] * n + e[6] * i + e[10] * o + e[14], e[3] * n + e[7] * i + e[11] * o + e[15]) : (a = e[0], s = e[1], u = e[2], h = e[3], c = e[4], l = e[5], f = e[6], d = e[7], p = e[8], m = e[9], v = e[10], g = e[11], t[0] = a, t[1] = s, t[2] = u, t[3] = h, t[4] = c, t[5] = l, t[6] = f, t[7] = d, t[8] = p, t[9] = m, t[10] = v, t[11] = g, t[12] = a * n + c * i + p * o + e[12], t[13] = s * n + l * i + m * o + e[13], t[14] = u * n + f * i + v * o + e[14], h * n + d * i + g * o + e[15]), t } function mat4_scale(t, e, r) { var n = r[0], i = r[1], o = r[2]; return t[0] = e[0] * n, t[1] = e[1] * n, t[2] = e[2] * n, t[3] = e[3] * n, t[4] = e[4] * i, t[5] = e[5] * i, t[6] = e[6] * i, t[7] = e[7] * i, t[8] = e[8] * o, t[9] = e[9] * o, t[10] = e[10] * o, t[11] = e[11] * o, t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15], t } function mat4_rotate(t, e, r, n) { var i, o, a, s, u, h, c, l, f, d, p, m, v, g, y, _, b, x, w, T, S, M, E, A, P = n[0], I = n[1], O = n[2], C = Math.sqrt(P * P + I * I + O * O); return C < F ? null : (P *= C = 1 / C, I *= C, O *= C, i = Math.sin(r), a = 1 - (o = Math.cos(r)), s = e[0], u = e[1], h = e[2], c = e[3], l = e[4], f = e[5], d = e[6], p = e[7], m = e[8], v = e[9], g = e[10], y = e[11], _ = P * P * a + o, b = I * P * a + O * i, x = O * P * a - I * i, w = P * I * a - O * i, T = I * I * a + o, S = O * I * a + P * i, M = P * O * a + I * i, E = I * O * a - P * i, A = O * O * a + o, t[0] = s * _ + l * b + m * x, t[1] = u * _ + f * b + v * x, t[2] = h * _ + d * b + g * x, t[3] = c * _ + p * b + y * x, t[4] = s * w + l * T + m * S, t[5] = u * w + f * T + v * S, t[6] = h * w + d * T + g * S, t[7] = c * w + p * T + y * S, t[8] = s * M + l * E + m * A, t[9] = u * M + f * E + v * A, t[10] = h * M + d * E + g * A, t[11] = c * M + p * E + y * A, e !== t && (t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t) } function rotateX(t, e, r) { var n = Math.sin(r), i = Math.cos(r), o = e[4], a = e[5], s = e[6], u = e[7], h = e[8], c = e[9], l = e[10], f = e[11]; return e !== t && (t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[4] = o * i + h * n, t[5] = a * i + c * n, t[6] = s * i + l * n, t[7] = u * i + f * n, t[8] = h * i - o * n, t[9] = c * i - a * n, t[10] = l * i - s * n, t[11] = f * i - u * n, t } function rotateY(t, e, r) { var n = Math.sin(r), i = Math.cos(r), o = e[0], a = e[1], s = e[2], u = e[3], h = e[8], c = e[9], l = e[10], f = e[11]; return e !== t && (t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = o * i - h * n, t[1] = a * i - c * n, t[2] = s * i - l * n, t[3] = u * i - f * n, t[8] = o * n + h * i, t[9] = a * n + c * i, t[10] = s * n + l * i, t[11] = u * n + f * i, t } function rotateZ(t, e, r) { var n = Math.sin(r), i = Math.cos(r), o = e[0], a = e[1], s = e[2], u = e[3], h = e[4], c = e[5], l = e[6], f = e[7]; return e !== t && (t[8] = e[8], t[9] = e[9], t[10] = e[10], t[11] = e[11], t[12] = e[12], t[13] = e[13], t[14] = e[14], t[15] = e[15]), t[0] = o * i + h * n, t[1] = a * i + c * n, t[2] = s * i + l * n, t[3] = u * i + f * n, t[4] = h * i - o * n, t[5] = c * i - a * n, t[6] = l * i - s * n, t[7] = f * i - u * n, t } function mat4_fromTranslation(t, e) { return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = e[0], t[13] = e[1], t[14] = e[2], t[15] = 1, t } function mat4_fromScaling(t, e) { return t[0] = e[0], t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = e[1], t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = e[2], t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t } function mat4_fromRotation(t, e, r) { var n, i, o, a = r[0], s = r[1], u = r[2], h = Math.sqrt(a * a + s * s + u * u); return h < F ? null : (a *= h = 1 / h, s *= h, u *= h, n = Math.sin(e), o = 1 - (i = Math.cos(e)), t[0] = a * a * o + i, t[1] = s * a * o + u * n, t[2] = u * a * o - s * n, t[3] = 0, t[4] = a * s * o - u * n, t[5] = s * s * o + i, t[6] = u * s * o + a * n, t[7] = 0, t[8] = a * u * o + s * n, t[9] = s * u * o - a * n, t[10] = u * u * o + i, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t) } function fromXRotation(t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = 1, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = n, t[6] = r, t[7] = 0, t[8] = 0, t[9] = -r, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t } function fromYRotation(t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = 0, t[2] = -r, t[3] = 0, t[4] = 0, t[5] = 1, t[6] = 0, t[7] = 0, t[8] = r, t[9] = 0, t[10] = n, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t } function fromZRotation(t, e) { var r = Math.sin(e), n = Math.cos(e); return t[0] = n, t[1] = r, t[2] = 0, t[3] = 0, t[4] = -r, t[5] = n, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 1, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t } function fromRotationTranslation(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = n + n, u = i + i, h = o + o, c = n * s, l = n * u, f = n * h, d = i * u, p = i * h, m = o * h, v = a * s, g = a * u, y = a * h; return t[0] = 1 - (d + m), t[1] = l + y, t[2] = f - g, t[3] = 0, t[4] = l - y, t[5] = 1 - (c + m), t[6] = p + v, t[7] = 0, t[8] = f + g, t[9] = p - v, t[10] = 1 - (c + d), t[11] = 0, t[12] = r[0], t[13] = r[1], t[14] = r[2], t[15] = 1, t } function fromQuat2(t, e) { var r = new g(3), n = -e[0], i = -e[1], o = -e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = n * n + i * i + o * o + a * a; return r[2] = 0 < l ? (r[0] = 2 * (s * a + c * n + u * o - h * i) / l, r[1] = 2 * (u * a + c * i + h * n - s * o) / l, 2 * (h * a + c * o + s * i - u * n) / l) : (r[0] = 2 * (s * a + c * n + u * o - h * i), r[1] = 2 * (u * a + c * i + h * n - s * o), 2 * (h * a + c * o + s * i - u * n)), fromRotationTranslation(t, e, r), t } function getTranslation(t, e) { return t[0] = e[12], t[1] = e[13], t[2] = e[14], t } function getScaling(t, e) { var r = e[0], n = e[1], i = e[2], o = e[4], a = e[5], s = e[6], u = e[8], h = e[9], c = e[10]; return t[0] = Math.sqrt(r * r + n * n + i * i), t[1] = Math.sqrt(o * o + a * a + s * s), t[2] = Math.sqrt(u * u + h * h + c * c), t } function getRotation(t, e) { var r = e[0] + e[5] + e[10], n = 0; return 0 < r ? (n = 2 * Math.sqrt(r + 1), t[3] = .25 * n, t[0] = (e[6] - e[9]) / n, t[1] = (e[8] - e[2]) / n, t[2] = (e[1] - e[4]) / n) : e[0] > e[5] && e[0] > e[10] ? (n = 2 * Math.sqrt(1 + e[0] - e[5] - e[10]), t[3] = (e[6] - e[9]) / n, t[0] = .25 * n, t[1] = (e[1] + e[4]) / n, t[2] = (e[8] + e[2]) / n) : e[5] > e[10] ? (n = 2 * Math.sqrt(1 + e[5] - e[0] - e[10]), t[3] = (e[8] - e[2]) / n, t[0] = (e[1] + e[4]) / n, t[1] = .25 * n, t[2] = (e[6] + e[9]) / n) : (n = 2 * Math.sqrt(1 + e[10] - e[0] - e[5]), t[3] = (e[1] - e[4]) / n, t[0] = (e[8] + e[2]) / n, t[1] = (e[6] + e[9]) / n, t[2] = .25 * n), t } function fromRotationTranslationScale(t, e, r, n) { var i = e[0], o = e[1], a = e[2], s = e[3], u = i + i, h = o + o, c = a + a, l = i * u, f = i * h, d = i * c, p = o * h, m = o * c, v = a * c, g = s * u, y = s * h, _ = s * c, b = n[0], x = n[1], w = n[2]; return t[0] = (1 - (p + v)) * b, t[1] = (f + _) * b, t[2] = (d - y) * b, t[3] = 0, t[4] = (f - _) * x, t[5] = (1 - (l + v)) * x, t[6] = (m + g) * x, t[7] = 0, t[8] = (d + y) * w, t[9] = (m - g) * w, t[10] = (1 - (l + p)) * w, t[11] = 0, t[12] = r[0], t[13] = r[1], t[14] = r[2], t[15] = 1, t } function fromRotationTranslationScaleOrigin(t, e, r, n, i) { var o = e[0], a = e[1], s = e[2], u = e[3], h = o + o, c = a + a, l = s + s, f = o * h, d = o * c, p = o * l, m = a * c, v = a * l, g = s * l, y = u * h, _ = u * c, b = u * l, x = n[0], w = n[1], T = n[2], S = i[0], M = i[1], E = i[2], A = (1 - (m + g)) * x, P = (d + b) * x, I = (p - _) * x, O = (d - b) * w, C = (1 - (f + g)) * w, R = (v + y) * w, D = (p + _) * T, F = (v - y) * T, k = (1 - (f + m)) * T; return t[0] = A, t[1] = P, t[2] = I, t[3] = 0, t[4] = O, t[5] = C, t[6] = R, t[7] = 0, t[8] = D, t[9] = F, t[10] = k, t[11] = 0, t[12] = r[0] + S - (A * S + O * M + D * E), t[13] = r[1] + M - (P * S + C * M + F * E), t[14] = r[2] + E - (I * S + R * M + k * E), t[15] = 1, t } function mat4_fromQuat(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = r + r, s = n + n, u = i + i, h = r * a, c = n * a, l = n * s, f = i * a, d = i * s, p = i * u, m = o * a, v = o * s, g = o * u; return t[0] = 1 - l - p, t[1] = c + g, t[2] = f - v, t[3] = 0, t[4] = c - g, t[5] = 1 - h - p, t[6] = d + m, t[7] = 0, t[8] = f + v, t[9] = d - m, t[10] = 1 - h - l, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, t } function frustum(t, e, r, n, i, o, a) { var s = 1 / (r - e), u = 1 / (i - n), h = 1 / (o - a); return t[0] = 2 * o * s, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = 2 * o * u, t[6] = 0, t[7] = 0, t[8] = (r + e) * s, t[9] = (i + n) * u, t[10] = (a + o) * h, t[11] = -1, t[12] = 0, t[13] = 0, t[14] = a * o * 2 * h, t[15] = 0, t } function perspective(t, e, r, n, i) { var o = 1 / Math.tan(e / 2), a = void 0; return t[0] = o / r, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = o, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[11] = -1, t[12] = 0, t[13] = 0, t[15] = 0, t[14] = null != i && i !== 1 / 0 ? (a = 1 / (n - i), t[10] = (i + n) * a, 2 * i * n * a) : (t[10] = -1, -2 * n), t } function perspectiveFromFieldOfView(t, e, r, n) { var i = Math.tan(e.upDegrees * Math.PI / 180), o = Math.tan(e.downDegrees * Math.PI / 180), a = Math.tan(e.leftDegrees * Math.PI / 180), s = Math.tan(e.rightDegrees * Math.PI / 180), u = 2 / (a + s), h = 2 / (i + o); return t[0] = u, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = h, t[6] = 0, t[7] = 0, t[8] = -(a - s) * u * .5, t[9] = (i - o) * h * .5, t[10] = n / (r - n), t[11] = -1, t[12] = 0, t[13] = 0, t[14] = n * r / (r - n), t[15] = 0, t } function ortho(t, e, r, n, i, o, a) { var s = 1 / (e - r), u = 1 / (n - i), h = 1 / (o - a); return t[0] = -2 * s, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -2 * u, t[6] = 0, t[7] = 0, t[8] = 0, t[9] = 0, t[10] = 2 * h, t[11] = 0, t[12] = (e + r) * s, t[13] = (i + n) * u, t[14] = (a + o) * h, t[15] = 1, t } function lookAt(t, e, r, n) { var i = void 0, o = void 0, a = void 0, s = void 0, u = void 0, h = void 0, c = void 0, l = void 0, f = void 0, d = void 0, p = e[0], m = e[1], v = e[2], g = n[0], y = n[1], _ = n[2], b = r[0], x = r[1], w = r[2]; return Math.abs(p - b) < F && Math.abs(m - x) < F && Math.abs(v - w) < F ? mat4_identity(t) : (c = p - b, l = m - x, f = v - w, i = y * (f *= d = 1 / Math.sqrt(c * c + l * l + f * f)) - _ * (l *= d), o = _ * (c *= d) - g * f, a = g * l - y * c, (d = Math.sqrt(i * i + o * o + a * a)) ? (i *= d = 1 / d, o *= d, a *= d) : a = o = i = 0, s = l * a - f * o, u = f * i - c * a, h = c * o - l * i, (d = Math.sqrt(s * s + u * u + h * h)) ? (s *= d = 1 / d, u *= d, h *= d) : h = u = s = 0, t[0] = i, t[1] = s, t[2] = c, t[3] = 0, t[4] = o, t[5] = u, t[6] = l, t[7] = 0, t[8] = a, t[9] = h, t[10] = f, t[11] = 0, t[12] = -(i * p + o * m + a * v), t[13] = -(s * p + u * m + h * v), t[14] = -(c * p + l * m + f * v), t[15] = 1, t) } function targetTo(t, e, r, n) { var i = e[0], o = e[1], a = e[2], s = n[0], u = n[1], h = n[2], c = i - r[0], l = o - r[1], f = a - r[2], d = c * c + l * l + f * f; 0 < d && (c *= d = 1 / Math.sqrt(d), l *= d, f *= d); var p = u * f - h * l, m = h * c - s * f, v = s * l - u * c; return 0 < (d = p * p + m * m + v * v) && (p *= d = 1 / Math.sqrt(d), m *= d, v *= d), t[0] = p, t[1] = m, t[2] = v, t[3] = 0, t[4] = l * v - f * m, t[5] = f * p - c * v, t[6] = c * m - l * p, t[7] = 0, t[8] = c, t[9] = l, t[10] = f, t[11] = 0, t[12] = i, t[13] = o, t[14] = a, t[15] = 1, t } function mat4_str(t) { return "mat4(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ", " + t[8] + ", " + t[9] + ", " + t[10] + ", " + t[11] + ", " + t[12] + ", " + t[13] + ", " + t[14] + ", " + t[15] + ")" } function mat4_frob(t) { return Math.sqrt(Math.pow(t[0], 2) + Math.pow(t[1], 2) + Math.pow(t[2], 2) + Math.pow(t[3], 2) + Math.pow(t[4], 2) + Math.pow(t[5], 2) + Math.pow(t[6], 2) + Math.pow(t[7], 2) + Math.pow(t[8], 2) + Math.pow(t[9], 2) + Math.pow(t[10], 2) + Math.pow(t[11], 2) + Math.pow(t[12], 2) + Math.pow(t[13], 2) + Math.pow(t[14], 2) + Math.pow(t[15], 2)) } function mat4_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t[6] = e[6] + r[6], t[7] = e[7] + r[7], t[8] = e[8] + r[8], t[9] = e[9] + r[9], t[10] = e[10] + r[10], t[11] = e[11] + r[11], t[12] = e[12] + r[12], t[13] = e[13] + r[13], t[14] = e[14] + r[14], t[15] = e[15] + r[15], t } function mat4_subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t[4] = e[4] - r[4], t[5] = e[5] - r[5], t[6] = e[6] - r[6], t[7] = e[7] - r[7], t[8] = e[8] - r[8], t[9] = e[9] - r[9], t[10] = e[10] - r[10], t[11] = e[11] - r[11], t[12] = e[12] - r[12], t[13] = e[13] - r[13], t[14] = e[14] - r[14], t[15] = e[15] - r[15], t } function mat4_multiplyScalar(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t[4] = e[4] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t[8] = e[8] * r, t[9] = e[9] * r, t[10] = e[10] * r, t[11] = e[11] * r, t[12] = e[12] * r, t[13] = e[13] * r, t[14] = e[14] * r, t[15] = e[15] * r, t } function mat4_multiplyScalarAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t[4] = e[4] + r[4] * n, t[5] = e[5] + r[5] * n, t[6] = e[6] + r[6] * n, t[7] = e[7] + r[7] * n, t[8] = e[8] + r[8] * n, t[9] = e[9] + r[9] * n, t[10] = e[10] + r[10] * n, t[11] = e[11] + r[11] * n, t[12] = e[12] + r[12] * n, t[13] = e[13] + r[13] * n, t[14] = e[14] + r[14] * n, t[15] = e[15] + r[15] * n, t } function mat4_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] && t[6] === e[6] && t[7] === e[7] && t[8] === e[8] && t[9] === e[9] && t[10] === e[10] && t[11] === e[11] && t[12] === e[12] && t[13] === e[13] && t[14] === e[14] && t[15] === e[15] } function mat4_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = t[3], a = t[4], s = t[5], u = t[6], h = t[7], c = t[8], l = t[9], f = t[10], d = t[11], p = t[12], m = t[13], v = t[14], g = t[15], y = e[0], _ = e[1], b = e[2], x = e[3], w = e[4], T = e[5], S = e[6], M = e[7], E = e[8], A = e[9], P = e[10], I = e[11], O = e[12], C = e[13], R = e[14], D = e[15]; return Math.abs(r - y) <= F * Math.max(1, Math.abs(r), Math.abs(y)) && Math.abs(n - _) <= F * Math.max(1, Math.abs(n), Math.abs(_)) && Math.abs(i - b) <= F * Math.max(1, Math.abs(i), Math.abs(b)) && Math.abs(o - x) <= F * Math.max(1, Math.abs(o), Math.abs(x)) && Math.abs(a - w) <= F * Math.max(1, Math.abs(a), Math.abs(w)) && Math.abs(s - T) <= F * Math.max(1, Math.abs(s), Math.abs(T)) && Math.abs(u - S) <= F * Math.max(1, Math.abs(u), Math.abs(S)) && Math.abs(h - M) <= F * Math.max(1, Math.abs(h), Math.abs(M)) && Math.abs(c - E) <= F * Math.max(1, Math.abs(c), Math.abs(E)) && Math.abs(l - A) <= F * Math.max(1, Math.abs(l), Math.abs(A)) && Math.abs(f - P) <= F * Math.max(1, Math.abs(f), Math.abs(P)) && Math.abs(d - I) <= F * Math.max(1, Math.abs(d), Math.abs(I)) && Math.abs(p - O) <= F * Math.max(1, Math.abs(p), Math.abs(O)) && Math.abs(m - C) <= F * Math.max(1, Math.abs(m), Math.abs(C)) && Math.abs(v - R) <= F * Math.max(1, Math.abs(v), Math.abs(R)) && Math.abs(g - D) <= F * Math.max(1, Math.abs(g), Math.abs(D)) } var w = mat4_multiply, T = mat4_subtract; function vec3_create() { var t = new g(3); return g != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t } function vec3_clone(t) { var e = new g(3); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e } function vec3_length(t) { var e = t[0], r = t[1], n = t[2]; return Math.sqrt(e * e + r * r + n * n) } function vec3_fromValues(t, e, r) { var n = new g(3); return n[0] = t, n[1] = e, n[2] = r, n } function vec3_copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t } function vec3_set(t, e, r, n) { return t[0] = e, t[1] = r, t[2] = n, t } function vec3_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t } function vec3_subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t } function vec3_multiply(t, e, r) { return t[0] = e[0] * r[0], t[1] = e[1] * r[1], t[2] = e[2] * r[2], t } function divide(t, e, r) { return t[0] = e[0] / r[0], t[1] = e[1] / r[1], t[2] = e[2] / r[2], t } function ceil(t, e) { return t[0] = Math.ceil(e[0]), t[1] = Math.ceil(e[1]), t[2] = Math.ceil(e[2]), t } function floor(t, e) { return t[0] = Math.floor(e[0]), t[1] = Math.floor(e[1]), t[2] = Math.floor(e[2]), t } function min(t, e, r) { return t[0] = Math.min(e[0], r[0]), t[1] = Math.min(e[1], r[1]), t[2] = Math.min(e[2], r[2]), t } function max(t, e, r) { return t[0] = Math.max(e[0], r[0]), t[1] = Math.max(e[1], r[1]), t[2] = Math.max(e[2], r[2]), t } function round(t, e) { return t[0] = Math.round(e[0]), t[1] = Math.round(e[1]), t[2] = Math.round(e[2]), t } function vec3_scale(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t } function scaleAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t } function distance(t, e) { var r = e[0] - t[0], n = e[1] - t[1], i = e[2] - t[2]; return Math.sqrt(r * r + n * n + i * i) } function squaredDistance(t, e) { var r = e[0] - t[0], n = e[1] - t[1], i = e[2] - t[2]; return r * r + n * n + i * i } function squaredLength(t) { var e = t[0], r = t[1], n = t[2]; return e * e + r * r + n * n } function negate(t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t } function inverse(t, e) { return t[0] = 1 / e[0], t[1] = 1 / e[1], t[2] = 1 / e[2], t } function normalize(t, e) { var r = e[0], n = e[1], i = e[2], o = r * r + n * n + i * i; return 0 < o && (o = 1 / Math.sqrt(o), t[0] = e[0] * o, t[1] = e[1] * o, t[2] = e[2] * o), t } function vec3_dot(t, e) { return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] } function cross(t, e, r) { var n = e[0], i = e[1], o = e[2], a = r[0], s = r[1], u = r[2]; return t[0] = i * u - o * s, t[1] = o * a - n * u, t[2] = n * s - i * a, t } function lerp(t, e, r, n) { var i = e[0], o = e[1], a = e[2]; return t[0] = i + n * (r[0] - i), t[1] = o + n * (r[1] - o), t[2] = a + n * (r[2] - a), t } function hermite(t, e, r, n, i, o) { var a = o * o, s = a * (2 * o - 3) + 1, u = a * (o - 2) + o, h = a * (o - 1), c = a * (3 - 2 * o); return t[0] = e[0] * s + r[0] * u + n[0] * h + i[0] * c, t[1] = e[1] * s + r[1] * u + n[1] * h + i[1] * c, t[2] = e[2] * s + r[2] * u + n[2] * h + i[2] * c, t } function bezier(t, e, r, n, i, o) { var a = 1 - o, s = a * a, u = o * o, h = s * a, c = 3 * o * s, l = 3 * u * a, f = u * o; return t[0] = e[0] * h + r[0] * c + n[0] * l + i[0] * f, t[1] = e[1] * h + r[1] * c + n[1] * l + i[1] * f, t[2] = e[2] * h + r[2] * c + n[2] * l + i[2] * f, t } function random(t, e) { e = e || 1; var r = 2 * d() * Math.PI, n = 2 * d() - 1, i = Math.sqrt(1 - n * n) * e; return t[0] = Math.cos(r) * i, t[1] = Math.sin(r) * i, t[2] = n * e, t } function transformMat4(t, e, r) { var n = e[0], i = e[1], o = e[2], a = r[3] * n + r[7] * i + r[11] * o + r[15]; return a = a || 1, t[0] = (r[0] * n + r[4] * i + r[8] * o + r[12]) / a, t[1] = (r[1] * n + r[5] * i + r[9] * o + r[13]) / a, t[2] = (r[2] * n + r[6] * i + r[10] * o + r[14]) / a, t } function transformMat3(t, e, r) { var n = e[0], i = e[1], o = e[2]; return t[0] = n * r[0] + i * r[3] + o * r[6], t[1] = n * r[1] + i * r[4] + o * r[7], t[2] = n * r[2] + i * r[5] + o * r[8], t } function transformQuat(t, e, r) { var n = r[0], i = r[1], o = r[2], a = r[3], s = e[0], u = e[1], h = e[2], c = i * h - o * u, l = o * s - n * h, f = n * u - i * s, d = i * f - o * l, p = o * c - n * f, m = n * l - i * c, v = 2 * a; return c *= v, l *= v, f *= v, d *= 2, p *= 2, m *= 2, t[0] = s + c + d, t[1] = u + l + p, t[2] = h + f + m, t } function vec3_rotateX(t, e, r, n) { var i = [], o = []; return i[0] = e[0] - r[0], i[1] = e[1] - r[1], i[2] = e[2] - r[2], o[0] = i[0], o[1] = i[1] * Math.cos(n) - i[2] * Math.sin(n), o[2] = i[1] * Math.sin(n) + i[2] * Math.cos(n), t[0] = o[0] + r[0], t[1] = o[1] + r[1], t[2] = o[2] + r[2], t } function vec3_rotateY(t, e, r, n) { var i = [], o = []; return i[0] = e[0] - r[0], i[1] = e[1] - r[1], i[2] = e[2] - r[2], o[0] = i[2] * Math.sin(n) + i[0] * Math.cos(n), o[1] = i[1], o[2] = i[2] * Math.cos(n) - i[0] * Math.sin(n), t[0] = o[0] + r[0], t[1] = o[1] + r[1], t[2] = o[2] + r[2], t } function vec3_rotateZ(t, e, r, n) { var i = [], o = []; return i[0] = e[0] - r[0], i[1] = e[1] - r[1], i[2] = e[2] - r[2], o[0] = i[0] * Math.cos(n) - i[1] * Math.sin(n), o[1] = i[0] * Math.sin(n) + i[1] * Math.cos(n), o[2] = i[2], t[0] = o[0] + r[0], t[1] = o[1] + r[1], t[2] = o[2] + r[2], t } function angle(t, e) { var r = vec3_fromValues(t[0], t[1], t[2]), n = vec3_fromValues(e[0], e[1], e[2]); normalize(r, r), normalize(n, n); var i = vec3_dot(r, n); return 1 < i ? 0 : i < -1 ? Math.PI : Math.acos(i) } function vec3_str(t) { return "vec3(" + t[0] + ", " + t[1] + ", " + t[2] + ")" } function vec3_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] } function vec3_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = e[0], a = e[1], s = e[2]; return Math.abs(r - o) <= F * Math.max(1, Math.abs(r), Math.abs(o)) && Math.abs(n - a) <= F * Math.max(1, Math.abs(n), Math.abs(a)) && Math.abs(i - s) <= F * Math.max(1, Math.abs(i), Math.abs(s)) } var S, M = vec3_subtract, E = vec3_multiply, A = divide, P = distance, I = squaredDistance, O = vec3_length, C = squaredLength, R = (S = vec3_create(), function(t, e, r, n, i, o) { var a = void 0, s = void 0; for (e || (e = 3), r || (r = 0), s = n ? Math.min(n * e + r, t.length) : t.length, a = r; a < s; a += e) S[0] = t[a], S[1] = t[a + 1], S[2] = t[a + 2], i(S, S, o), t[a] = S[0], t[a + 1] = S[1], t[a + 2] = S[2]; return t }); function vec4_create() { var t = new g(4); return g != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 0), t } function vec4_clone(t) { var e = new g(4); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e } function vec4_fromValues(t, e, r, n) { var i = new g(4); return i[0] = t, i[1] = e, i[2] = r, i[3] = n, i } function vec4_copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t } function vec4_set(t, e, r, n, i) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t } function vec4_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t } function vec4_subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t[2] = e[2] - r[2], t[3] = e[3] - r[3], t } function vec4_multiply(t, e, r) { return t[0] = e[0] * r[0], t[1] = e[1] * r[1], t[2] = e[2] * r[2], t[3] = e[3] * r[3], t } function vec4_divide(t, e, r) { return t[0] = e[0] / r[0], t[1] = e[1] / r[1], t[2] = e[2] / r[2], t[3] = e[3] / r[3], t } function vec4_ceil(t, e) { return t[0] = Math.ceil(e[0]), t[1] = Math.ceil(e[1]), t[2] = Math.ceil(e[2]), t[3] = Math.ceil(e[3]), t } function vec4_floor(t, e) { return t[0] = Math.floor(e[0]), t[1] = Math.floor(e[1]), t[2] = Math.floor(e[2]), t[3] = Math.floor(e[3]), t } function vec4_min(t, e, r) { return t[0] = Math.min(e[0], r[0]), t[1] = Math.min(e[1], r[1]), t[2] = Math.min(e[2], r[2]), t[3] = Math.min(e[3], r[3]), t } function vec4_max(t, e, r) { return t[0] = Math.max(e[0], r[0]), t[1] = Math.max(e[1], r[1]), t[2] = Math.max(e[2], r[2]), t[3] = Math.max(e[3], r[3]), t } function vec4_round(t, e) { return t[0] = Math.round(e[0]), t[1] = Math.round(e[1]), t[2] = Math.round(e[2]), t[3] = Math.round(e[3]), t } function vec4_scale(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t } function vec4_scaleAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t[2] = e[2] + r[2] * n, t[3] = e[3] + r[3] * n, t } function vec4_distance(t, e) { var r = e[0] - t[0], n = e[1] - t[1], i = e[2] - t[2], o = e[3] - t[3]; return Math.sqrt(r * r + n * n + i * i + o * o) } function vec4_squaredDistance(t, e) { var r = e[0] - t[0], n = e[1] - t[1], i = e[2] - t[2], o = e[3] - t[3]; return r * r + n * n + i * i + o * o } function vec4_length(t) { var e = t[0], r = t[1], n = t[2], i = t[3]; return Math.sqrt(e * e + r * r + n * n + i * i) } function vec4_squaredLength(t) { var e = t[0], r = t[1], n = t[2], i = t[3]; return e * e + r * r + n * n + i * i } function vec4_negate(t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = -e[3], t } function vec4_inverse(t, e) { return t[0] = 1 / e[0], t[1] = 1 / e[1], t[2] = 1 / e[2], t[3] = 1 / e[3], t } function vec4_normalize(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = r * r + n * n + i * i + o * o; return 0 < a && (a = 1 / Math.sqrt(a), t[0] = r * a, t[1] = n * a, t[2] = i * a, t[3] = o * a), t } function vec4_dot(t, e) { return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3] * e[3] } function vec4_lerp(t, e, r, n) { var i = e[0], o = e[1], a = e[2], s = e[3]; return t[0] = i + n * (r[0] - i), t[1] = o + n * (r[1] - o), t[2] = a + n * (r[2] - a), t[3] = s + n * (r[3] - s), t } function vec4_random(t, e) { var r, n, i, o, a, s; for (e = e || 1; 1 <= (a = (r = 2 * d() - 1) * r + (n = 2 * d() - 1) * n);); for (; 1 <= (s = (i = 2 * d() - 1) * i + (o = 2 * d() - 1) * o);); var u = Math.sqrt((1 - a) / s); return t[0] = e * r, t[1] = e * n, t[2] = e * i * u, t[3] = e * o * u, t } function vec4_transformMat4(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3]; return t[0] = r[0] * n + r[4] * i + r[8] * o + r[12] * a, t[1] = r[1] * n + r[5] * i + r[9] * o + r[13] * a, t[2] = r[2] * n + r[6] * i + r[10] * o + r[14] * a, t[3] = r[3] * n + r[7] * i + r[11] * o + r[15] * a, t } function vec4_transformQuat(t, e, r) { var n = e[0], i = e[1], o = e[2], a = r[0], s = r[1], u = r[2], h = r[3], c = h * n + s * o - u * i, l = h * i + u * n - a * o, f = h * o + a * i - s * n, d = -a * n - s * i - u * o; return t[0] = c * h + d * -a + l * -u - f * -s, t[1] = l * h + d * -s + f * -a - c * -u, t[2] = f * h + d * -u + c * -s - l * -a, t[3] = e[3], t } function vec4_str(t) { return "vec4(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")" } function vec4_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] } function vec4_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = t[3], a = e[0], s = e[1], u = e[2], h = e[3]; return Math.abs(r - a) <= F * Math.max(1, Math.abs(r), Math.abs(a)) && Math.abs(n - s) <= F * Math.max(1, Math.abs(n), Math.abs(s)) && Math.abs(i - u) <= F * Math.max(1, Math.abs(i), Math.abs(u)) && Math.abs(o - h) <= F * Math.max(1, Math.abs(o), Math.abs(h)) } var D, k = vec4_subtract, L = vec4_multiply, N = vec4_divide, B = vec4_distance, U = vec4_squaredDistance, G = vec4_length, j = vec4_squaredLength, z = (D = vec4_create(), function(t, e, r, n, i, o) { var a = void 0, s = void 0; for (e || (e = 4), r || (r = 0), s = n ? Math.min(n * e + r, t.length) : t.length, a = r; a < s; a += e) D[0] = t[a], D[1] = t[a + 1], D[2] = t[a + 2], D[3] = t[a + 3], i(D, D, o), t[a] = D[0], t[a + 1] = D[1], t[a + 2] = D[2], t[a + 3] = D[3]; return t }); function quat_create() { var t = new g(4); return g != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0), t[3] = 1, t } function quat_identity(t) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t } function setAxisAngle(t, e, r) { r *= .5; var n = Math.sin(r); return t[0] = n * e[0], t[1] = n * e[1], t[2] = n * e[2], t[3] = Math.cos(r), t } function getAxisAngle(t, e) { var r = 2 * Math.acos(e[3]), n = Math.sin(r / 2); return t[2] = F < n ? (t[0] = e[0] / n, t[1] = e[1] / n, e[2] / n) : (t[0] = 1, t[1] = 0), r } function quat_multiply(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = r[0], u = r[1], h = r[2], c = r[3]; return t[0] = n * c + a * s + i * h - o * u, t[1] = i * c + a * u + o * s - n * h, t[2] = o * c + a * h + n * u - i * s, t[3] = a * c - n * s - i * u - o * h, t } function quat_rotateX(t, e, r) { r *= .5; var n = e[0], i = e[1], o = e[2], a = e[3], s = Math.sin(r), u = Math.cos(r); return t[0] = n * u + a * s, t[1] = i * u + o * s, t[2] = o * u - i * s, t[3] = a * u - n * s, t } function quat_rotateY(t, e, r) { r *= .5; var n = e[0], i = e[1], o = e[2], a = e[3], s = Math.sin(r), u = Math.cos(r); return t[0] = n * u - o * s, t[1] = i * u + a * s, t[2] = o * u + n * s, t[3] = a * u - i * s, t } function quat_rotateZ(t, e, r) { r *= .5; var n = e[0], i = e[1], o = e[2], a = e[3], s = Math.sin(r), u = Math.cos(r); return t[0] = n * u + i * s, t[1] = i * u - n * s, t[2] = o * u + a * s, t[3] = a * u - o * s, t } function calculateW(t, e) { var r = e[0], n = e[1], i = e[2]; return t[0] = r, t[1] = n, t[2] = i, t[3] = Math.sqrt(Math.abs(1 - r * r - n * n - i * i)), t } function slerp(t, e, r, n) { var i = e[0], o = e[1], a = e[2], s = e[3], u = r[0], h = r[1], c = r[2], l = r[3], f = void 0, d = void 0, p = void 0, m = void 0, v = void 0; return (d = i * u + o * h + a * c + s * l) < 0 && (d = -d, u = -u, h = -h, c = -c, l = -l), v = F < 1 - d ? (f = Math.acos(d), p = Math.sin(f), m = Math.sin((1 - n) * f) / p, Math.sin(n * f) / p) : (m = 1 - n, n), t[0] = m * i + v * u, t[1] = m * o + v * h, t[2] = m * a + v * c, t[3] = m * s + v * l, t } function quat_random(t) { var e = d(), r = d(), n = d(), i = Math.sqrt(1 - e), o = Math.sqrt(e); return t[0] = i * Math.sin(2 * Math.PI * r), t[1] = i * Math.cos(2 * Math.PI * r), t[2] = o * Math.sin(2 * Math.PI * n), t[3] = o * Math.cos(2 * Math.PI * n), t } function quat_invert(t, e) { var r = e[0], n = e[1], i = e[2], o = e[3], a = r * r + n * n + i * i + o * o, s = a ? 1 / a : 0; return t[0] = -r * s, t[1] = -n * s, t[2] = -i * s, t[3] = o * s, t } function conjugate(t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = e[3], t } function fromMat3(t, e) { var r = e[0] + e[4] + e[8], n = void 0; if (0 < r) n = Math.sqrt(r + 1), t[3] = .5 * n, n = .5 / n, t[0] = (e[5] - e[7]) * n, t[1] = (e[6] - e[2]) * n, t[2] = (e[1] - e[3]) * n; else { var i = 0; e[4] > e[0] && (i = 1), e[8] > e[3 * i + i] && (i = 2); var o = (i + 1) % 3, a = (i + 2) % 3; n = Math.sqrt(e[3 * i + i] - e[3 * o + o] - e[3 * a + a] + 1), t[i] = .5 * n, n = .5 / n, t[3] = (e[3 * o + a] - e[3 * a + o]) * n, t[o] = (e[3 * o + i] + e[3 * i + o]) * n, t[a] = (e[3 * a + i] + e[3 * i + a]) * n } return t } function fromEuler(t, e, r, n) { var i = .5 * Math.PI / 180; e *= i, r *= i, n *= i; var o = Math.sin(e), a = Math.cos(e), s = Math.sin(r), u = Math.cos(r), h = Math.sin(n), c = Math.cos(n); return t[0] = o * u * c - a * s * h, t[1] = a * s * c + o * u * h, t[2] = a * u * h - o * s * c, t[3] = a * u * c + o * s * h, t } function quat_str(t) { return "quat(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ")" } var X, V, q, H, W, Y, K = vec4_clone, Z = vec4_fromValues, Q = vec4_copy, J = vec4_set, $ = vec4_add, tt = quat_multiply, et = vec4_scale, rt = vec4_dot, nt = vec4_lerp, it = vec4_length, ot = it, at = vec4_squaredLength, st = at, ut = vec4_normalize, ht = vec4_exactEquals, ct = vec4_equals, lt = (X = vec3_create(), V = vec3_fromValues(1, 0, 0), q = vec3_fromValues(0, 1, 0), function(t, e, r) { var n = vec3_dot(e, r); return n < -.999999 ? (cross(X, V, e), O(X) < 1e-6 && cross(X, q, e), normalize(X, X), setAxisAngle(t, X, Math.PI), t) : .999999 < n ? (t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t) : (cross(X, e, r), t[0] = X[0], t[1] = X[1], t[2] = X[2], t[3] = 1 + n, ut(t, t)) }), ft = (H = quat_create(), W = quat_create(), function(t, e, r, n, i, o) { return slerp(H, e, i, o), slerp(W, r, n, o), slerp(t, H, W, 2 * o * (1 - o)), t }), dt = (Y = mat3_create(), function(t, e, r, n) { return Y[0] = r[0], Y[3] = r[1], Y[6] = r[2], Y[1] = n[0], Y[4] = n[1], Y[7] = n[2], Y[2] = -e[0], Y[5] = -e[1], Y[8] = -e[2], ut(t, fromMat3(t, Y)) }); function quat2_create() { var t = new g(8); return g != Float32Array && (t[0] = 0, t[1] = 0, t[2] = 0, t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0), t[3] = 1, t } function quat2_clone(t) { var e = new g(8); return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e } function quat2_fromValues(t, e, r, n, i, o, a, s) { var u = new g(8); return u[0] = t, u[1] = e, u[2] = r, u[3] = n, u[4] = i, u[5] = o, u[6] = a, u[7] = s, u } function fromRotationTranslationValues(t, e, r, n, i, o, a) { var s = new g(8); s[0] = t, s[1] = e, s[2] = r, s[3] = n; var u = .5 * i, h = .5 * o, c = .5 * a; return s[4] = u * n + h * r - c * e, s[5] = h * n + c * t - u * r, s[6] = c * n + u * e - h * t, s[7] = -u * t - h * e - c * r, s } function quat2_fromRotationTranslation(t, e, r) { var n = .5 * r[0], i = .5 * r[1], o = .5 * r[2], a = e[0], s = e[1], u = e[2], h = e[3]; return t[0] = a, t[1] = s, t[2] = u, t[3] = h, t[4] = n * h + i * u - o * s, t[5] = i * h + o * a - n * u, t[6] = o * h + n * s - i * a, t[7] = -n * a - i * s - o * u, t } function quat2_fromTranslation(t, e) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = .5 * e[0], t[5] = .5 * e[1], t[6] = .5 * e[2], t[7] = 0, t } function quat2_fromRotation(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0, t } function quat2_fromMat4(t, e) { var r = quat_create(); getRotation(r, e); var n = new g(3); return getTranslation(n, e), quat2_fromRotationTranslation(t, r, n), t } function quat2_copy(t, e) { return t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = e[4], t[5] = e[5], t[6] = e[6], t[7] = e[7], t } function quat2_identity(t) { return t[0] = 0, t[1] = 0, t[2] = 0, t[3] = 1, t[4] = 0, t[5] = 0, t[6] = 0, t[7] = 0, t } function quat2_set(t, e, r, n, i, o, a, s, u) { return t[0] = e, t[1] = r, t[2] = n, t[3] = i, t[4] = o, t[5] = a, t[6] = s, t[7] = u, t } var pt = Q; function getDual(t, e) { return t[0] = e[4], t[1] = e[5], t[2] = e[6], t[3] = e[7], t } var mt = Q; function setDual(t, e) { return t[4] = e[0], t[5] = e[1], t[6] = e[2], t[7] = e[3], t } function quat2_getTranslation(t, e) { var r = e[4], n = e[5], i = e[6], o = e[7], a = -e[0], s = -e[1], u = -e[2], h = e[3]; return t[0] = 2 * (r * h + o * a + n * u - i * s), t[1] = 2 * (n * h + o * s + i * a - r * u), t[2] = 2 * (i * h + o * u + r * s - n * a), t } function quat2_translate(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = .5 * r[0], u = .5 * r[1], h = .5 * r[2], c = e[4], l = e[5], f = e[6], d = e[7]; return t[0] = n, t[1] = i, t[2] = o, t[3] = a, t[4] = a * s + i * h - o * u + c, t[5] = a * u + o * s - n * h + l, t[6] = a * h + n * u - i * s + f, t[7] = -n * s - i * u - o * h + d, t } function quat2_rotateX(t, e, r) { var n = -e[0], i = -e[1], o = -e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = s * a + c * n + u * o - h * i, f = u * a + c * i + h * n - s * o, d = h * a + c * o + s * i - u * n, p = c * a - s * n - u * i - h * o; return quat_rotateX(t, e, r), n = t[0], i = t[1], o = t[2], a = t[3], t[4] = l * a + p * n + f * o - d * i, t[5] = f * a + p * i + d * n - l * o, t[6] = d * a + p * o + l * i - f * n, t[7] = p * a - l * n - f * i - d * o, t } function quat2_rotateY(t, e, r) { var n = -e[0], i = -e[1], o = -e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = s * a + c * n + u * o - h * i, f = u * a + c * i + h * n - s * o, d = h * a + c * o + s * i - u * n, p = c * a - s * n - u * i - h * o; return quat_rotateY(t, e, r), n = t[0], i = t[1], o = t[2], a = t[3], t[4] = l * a + p * n + f * o - d * i, t[5] = f * a + p * i + d * n - l * o, t[6] = d * a + p * o + l * i - f * n, t[7] = p * a - l * n - f * i - d * o, t } function quat2_rotateZ(t, e, r) { var n = -e[0], i = -e[1], o = -e[2], a = e[3], s = e[4], u = e[5], h = e[6], c = e[7], l = s * a + c * n + u * o - h * i, f = u * a + c * i + h * n - s * o, d = h * a + c * o + s * i - u * n, p = c * a - s * n - u * i - h * o; return quat_rotateZ(t, e, r), n = t[0], i = t[1], o = t[2], a = t[3], t[4] = l * a + p * n + f * o - d * i, t[5] = f * a + p * i + d * n - l * o, t[6] = d * a + p * o + l * i - f * n, t[7] = p * a - l * n - f * i - d * o, t } function rotateByQuatAppend(t, e, r) { var n = r[0], i = r[1], o = r[2], a = r[3], s = e[0], u = e[1], h = e[2], c = e[3]; return t[0] = s * a + c * n + u * o - h * i, t[1] = u * a + c * i + h * n - s * o, t[2] = h * a + c * o + s * i - u * n, t[3] = c * a - s * n - u * i - h * o, s = e[4], u = e[5], h = e[6], c = e[7], t[4] = s * a + c * n + u * o - h * i, t[5] = u * a + c * i + h * n - s * o, t[6] = h * a + c * o + s * i - u * n, t[7] = c * a - s * n - u * i - h * o, t } function rotateByQuatPrepend(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = r[0], u = r[1], h = r[2], c = r[3]; return t[0] = n * c + a * s + i * h - o * u, t[1] = i * c + a * u + o * s - n * h, t[2] = o * c + a * h + n * u - i * s, t[3] = a * c - n * s - i * u - o * h, s = r[4], u = r[5], h = r[6], c = r[7], t[4] = n * c + a * s + i * h - o * u, t[5] = i * c + a * u + o * s - n * h, t[6] = o * c + a * h + n * u - i * s, t[7] = a * c - n * s - i * u - o * h, t } function rotateAroundAxis(t, e, r, n) { if (Math.abs(n) < F) return quat2_copy(t, e); var i = Math.sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]); n *= .5; var o = Math.sin(n), a = o * r[0] / i, s = o * r[1] / i, u = o * r[2] / i, h = Math.cos(n), c = e[0], l = e[1], f = e[2], d = e[3]; t[0] = c * h + d * a + l * u - f * s, t[1] = l * h + d * s + f * a - c * u, t[2] = f * h + d * u + c * s - l * a, t[3] = d * h - c * a - l * s - f * u; var p = e[4], m = e[5], v = e[6], g = e[7]; return t[4] = p * h + g * a + m * u - v * s, t[5] = m * h + g * s + v * a - p * u, t[6] = v * h + g * u + p * s - m * a, t[7] = g * h - p * a - m * s - v * u, t } function quat2_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t[2] = e[2] + r[2], t[3] = e[3] + r[3], t[4] = e[4] + r[4], t[5] = e[5] + r[5], t[6] = e[6] + r[6], t[7] = e[7] + r[7], t } function quat2_multiply(t, e, r) { var n = e[0], i = e[1], o = e[2], a = e[3], s = r[4], u = r[5], h = r[6], c = r[7], l = e[4], f = e[5], d = e[6], p = e[7], m = r[0], v = r[1], g = r[2], y = r[3]; return t[0] = n * y + a * m + i * g - o * v, t[1] = i * y + a * v + o * m - n * g, t[2] = o * y + a * g + n * v - i * m, t[3] = a * y - n * m - i * v - o * g, t[4] = n * c + a * s + i * h - o * u + l * y + p * m + f * g - d * v, t[5] = i * c + a * u + o * s - n * h + f * y + p * v + d * m - l * g, t[6] = o * c + a * h + n * u - i * s + d * y + p * g + l * v - f * m, t[7] = a * c - n * s - i * u - o * h + p * y - l * m - f * v - d * g, t } var vt = quat2_multiply; function quat2_scale(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t[2] = e[2] * r, t[3] = e[3] * r, t[4] = e[4] * r, t[5] = e[5] * r, t[6] = e[6] * r, t[7] = e[7] * r, t } var gt = rt; function quat2_lerp(t, e, r, n) { var i = 1 - n; return gt(e, r) < 0 && (n = -n), t[0] = e[0] * i + r[0] * n, t[1] = e[1] * i + r[1] * n, t[2] = e[2] * i + r[2] * n, t[3] = e[3] * i + r[3] * n, t[4] = e[4] * i + r[4] * n, t[5] = e[5] * i + r[5] * n, t[6] = e[6] * i + r[6] * n, t[7] = e[7] * i + r[7] * n, t } function quat2_invert(t, e) { var r = bt(e); return t[0] = -e[0] / r, t[1] = -e[1] / r, t[2] = -e[2] / r, t[3] = e[3] / r, t[4] = -e[4] / r, t[5] = -e[5] / r, t[6] = -e[6] / r, t[7] = e[7] / r, t } function quat2_conjugate(t, e) { return t[0] = -e[0], t[1] = -e[1], t[2] = -e[2], t[3] = e[3], t[4] = -e[4], t[5] = -e[5], t[6] = -e[6], t[7] = e[7], t } var yt = it, _t = yt, bt = at, xt = bt; function quat2_normalize(t, e) { var r = bt(e); if (0 < r) { r = Math.sqrt(r); var n = e[0] / r, i = e[1] / r, o = e[2] / r, a = e[3] / r, s = e[4], u = e[5], h = e[6], c = e[7], l = n * s + i * u + o * h + a * c; t[0] = n, t[1] = i, t[2] = o, t[3] = a, t[4] = (s - n * l) / r, t[5] = (u - i * l) / r, t[6] = (h - o * l) / r, t[7] = (c - a * l) / r } return t } function quat2_str(t) { return "quat2(" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] + ", " + t[4] + ", " + t[5] + ", " + t[6] + ", " + t[7] + ")" } function quat2_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] && t[2] === e[2] && t[3] === e[3] && t[4] === e[4] && t[5] === e[5] && t[6] === e[6] && t[7] === e[7] } function quat2_equals(t, e) { var r = t[0], n = t[1], i = t[2], o = t[3], a = t[4], s = t[5], u = t[6], h = t[7], c = e[0], l = e[1], f = e[2], d = e[3], p = e[4], m = e[5], v = e[6], g = e[7]; return Math.abs(r - c) <= F * Math.max(1, Math.abs(r), Math.abs(c)) && Math.abs(n - l) <= F * Math.max(1, Math.abs(n), Math.abs(l)) && Math.abs(i - f) <= F * Math.max(1, Math.abs(i), Math.abs(f)) && Math.abs(o - d) <= F * Math.max(1, Math.abs(o), Math.abs(d)) && Math.abs(a - p) <= F * Math.max(1, Math.abs(a), Math.abs(p)) && Math.abs(s - m) <= F * Math.max(1, Math.abs(s), Math.abs(m)) && Math.abs(u - v) <= F * Math.max(1, Math.abs(u), Math.abs(v)) && Math.abs(h - g) <= F * Math.max(1, Math.abs(h), Math.abs(g)) } function vec2_create() { var t = new g(2); return g != Float32Array && (t[0] = 0, t[1] = 0), t } function vec2_clone(t) { var e = new g(2); return e[0] = t[0], e[1] = t[1], e } function vec2_fromValues(t, e) { var r = new g(2); return r[0] = t, r[1] = e, r } function vec2_copy(t, e) { return t[0] = e[0], t[1] = e[1], t } function vec2_set(t, e, r) { return t[0] = e, t[1] = r, t } function vec2_add(t, e, r) { return t[0] = e[0] + r[0], t[1] = e[1] + r[1], t } function vec2_subtract(t, e, r) { return t[0] = e[0] - r[0], t[1] = e[1] - r[1], t } function vec2_multiply(t, e, r) { return t[0] = e[0] * r[0], t[1] = e[1] * r[1], t } function vec2_divide(t, e, r) { return t[0] = e[0] / r[0], t[1] = e[1] / r[1], t } function vec2_ceil(t, e) { return t[0] = Math.ceil(e[0]), t[1] = Math.ceil(e[1]), t } function vec2_floor(t, e) { return t[0] = Math.floor(e[0]), t[1] = Math.floor(e[1]), t } function vec2_min(t, e, r) { return t[0] = Math.min(e[0], r[0]), t[1] = Math.min(e[1], r[1]), t } function vec2_max(t, e, r) { return t[0] = Math.max(e[0], r[0]), t[1] = Math.max(e[1], r[1]), t } function vec2_round(t, e) { return t[0] = Math.round(e[0]), t[1] = Math.round(e[1]), t } function vec2_scale(t, e, r) { return t[0] = e[0] * r, t[1] = e[1] * r, t } function vec2_scaleAndAdd(t, e, r, n) { return t[0] = e[0] + r[0] * n, t[1] = e[1] + r[1] * n, t } function vec2_distance(t, e) { var r = e[0] - t[0], n = e[1] - t[1]; return Math.sqrt(r * r + n * n) } function vec2_squaredDistance(t, e) { var r = e[0] - t[0], n = e[1] - t[1]; return r * r + n * n } function vec2_length(t) { var e = t[0], r = t[1]; return Math.sqrt(e * e + r * r) } function vec2_squaredLength(t) { var e = t[0], r = t[1]; return e * e + r * r } function vec2_negate(t, e) { return t[0] = -e[0], t[1] = -e[1], t } function vec2_inverse(t, e) { return t[0] = 1 / e[0], t[1] = 1 / e[1], t } function vec2_normalize(t, e) { var r = e[0], n = e[1], i = r * r + n * n; return 0 < i && (i = 1 / Math.sqrt(i), t[0] = e[0] * i, t[1] = e[1] * i), t } function vec2_dot(t, e) { return t[0] * e[0] + t[1] * e[1] } function vec2_cross(t, e, r) { var n = e[0] * r[1] - e[1] * r[0]; return t[0] = t[1] = 0, t[2] = n, t } function vec2_lerp(t, e, r, n) { var i = e[0], o = e[1]; return t[0] = i + n * (r[0] - i), t[1] = o + n * (r[1] - o), t } function vec2_random(t, e) { e = e || 1; var r = 2 * d() * Math.PI; return t[0] = Math.cos(r) * e, t[1] = Math.sin(r) * e, t } function transformMat2(t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[2] * i, t[1] = r[1] * n + r[3] * i, t } function transformMat2d(t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[2] * i + r[4], t[1] = r[1] * n + r[3] * i + r[5], t } function vec2_transformMat3(t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[3] * i + r[6], t[1] = r[1] * n + r[4] * i + r[7], t } function vec2_transformMat4(t, e, r) { var n = e[0], i = e[1]; return t[0] = r[0] * n + r[4] * i + r[12], t[1] = r[1] * n + r[5] * i + r[13], t } function vec2_rotate(t, e, r, n) { var i = e[0] - r[0], o = e[1] - r[1], a = Math.sin(n), s = Math.cos(n); return t[0] = i * s - o * a + r[0], t[1] = i * a + o * s + r[1], t } function vec2_angle(t, e) { var r = t[0], n = t[1], i = e[0], o = e[1], a = r * r + n * n; 0 < a && (a = 1 / Math.sqrt(a)); var s = i * i + o * o; 0 < s && (s = 1 / Math.sqrt(s)); var u = (r * i + n * o) * a * s; return 1 < u ? 0 : u < -1 ? Math.PI : Math.acos(u) } function vec2_str(t) { return "vec2(" + t[0] + ", " + t[1] + ")" } function vec2_exactEquals(t, e) { return t[0] === e[0] && t[1] === e[1] } function vec2_equals(t, e) { var r = t[0], n = t[1], i = e[0], o = e[1]; return Math.abs(r - i) <= F * Math.max(1, Math.abs(r), Math.abs(i)) && Math.abs(n - o) <= F * Math.max(1, Math.abs(n), Math.abs(o)) } var wt, Tt = vec2_length, St = vec2_subtract, Mt = vec2_multiply, Et = vec2_divide, At = vec2_distance, Pt = vec2_squaredDistance, It = vec2_squaredLength, Ot = (wt = vec2_create(), function(t, e, r, n, i, o) { var a = void 0, s = void 0; for (e || (e = 2), r || (r = 0), s = n ? Math.min(n * e + r, t.length) : t.length, a = r; a < s; a += e) wt[0] = t[a], wt[1] = t[a + 1], i(wt, wt, o), t[a] = wt[0], t[a + 1] = wt[1]; return t }); r.d(e, "glMatrix", function() { return n }), r.d(e, "mat2", function() { return i }), r.d(e, "mat2d", function() { return o }), r.d(e, "mat3", function() { return a }), r.d(e, "mat4", function() { return s }), r.d(e, "quat", function() { return c }), r.d(e, "quat2", function() { return l }), r.d(e, "vec2", function() { return f }), r.d(e, "vec3", function() { return u }), r.d(e, "vec4", function() { return h }) }, function(t, e, r) { "use strict"; e.__esModule = !0; var n = function() { function Component(t, e) { if (function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, Component), !t) throw new Error("component requires an entity"); this.entity = t, this.data = e, this.name = "", this.game = null, this.active = !1 } return Component.create = function(t, r) { if (Component.mapHash[t]) return Component.mapHash[t]; function com(t, e) { this.entity = t, this.data = e, r.constructor && r.constructor.call(this) } for (var e in com.prototype = Object.create(Component.prototype), com.id = t, r) com.prototype[e] = r[e]; return Component.mapHash[t] = com }, Component }(); (e.default = n).mapHash = {} }, function(t, e, r) { var n = r(11); t.exports = function(t) { if (!n(t)) throw TypeError(t + " is not an object!"); return t } }, function(t, e, r) { "use strict"; function _defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } function mockPromise() { for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++) e[r] = arguments[r]; return { then: function(t) { return t.apply(void 0, e) } } } r.d(e, "a", function() { return s }); var n = function() { function PokiSDKMockup() {} var t = PokiSDKMockup.prototype; return t.init = function() { return mockPromise() }, t.gameLoadingStart = function() { return mockPromise() }, t.gameLoadingFinished = function() { return mockPromise() }, t.gameplayStart = function() { return mockPromise() }, t.gameplayStop = function() { return mockPromise() }, t.commercialBreak = function() { return mockPromise() }, t.happyTime = function(t) { return mockPromise() }, t.rewardedBreak = function() { return mockPromise(!0) }, PokiSDKMockup }(), i = function() { function PokiSDKHangoutMockup() {} var t = PokiSDKHangoutMockup.prototype; return t.setDebug = function() { return mockPromise() }, t.getLobbyId = function() { return mockPromise() }, t.getLeaderboard = function(t, e, r) { return mockPromise([{ name: "Yutani", image: "icon_07_yutani", score: 999999 }, { name: "Spike", image: "icon_08_spike", score: 810312 }, { name: "Fresh", image: "icon_09_fresh", score: 555555 }, { name: "Tricky", image: "icon_11_tricky", score: 345678 }, { name: "Lucy", image: "icon_04_lucy", score: 171110 }, { name: "Ninja", image: "icon_03_ninja", score: 123456 }, { name: "Brody", image: "icon_00_brody", score: 65900 }, { name: "Tagbot", image: "icon_01_tagbot", score: 15505 }, { name: "Tasha", image: "icon_02_tasha", score: 1e3 }, { name: "King", image: "icon_05_king", score: 500 }, { name: "ME", image: "icon_friend", score: r }].sort(function(t, e) { return e.score - t.score })) }, t.initHighscoreSession = function() { return mockPromise() }, t.saveHighscore = function() { return mockPromise() }, PokiSDKHangoutMockup }(), o = new n, a = new i, s = function() { function Tabouzigt() {} var t, e, r; return Tabouzigt.sendCustomMessage = function(t, e, r) { window.parent && window.parent.postMessage({ type: "pokiMessageEvent", content: { event: "pokiTrackingCustom", data: { eventNoun: t, eventVerb: e, eventData: r } } }, "*") }, t = Tabouzigt, r = [{ key: "SDK", get: function() { var t = window.Tabouzigtsdk || o; return t && !t.sendCustomMessage && (t.sendCustomMessage = this.sendCustomMessage), t } }, { key: "hangout", get: function() { var t = window.Tabouzigtsdk || o; return t && t.hangout ? t.hangout : a } }], (e = null) && _defineProperties(t.prototype, e), r && _defineProperties(t, r), Tabouzigt }() }, function(t, e, r) { "use strict"; e.__esModule = !0; var n = function() { function defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function(t, e, r) { return e && defineProperties(t.prototype, e), r && defineProperties(t, r), t } }(); var i = function() { function Runner(t) { var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; ! function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, Runner), this.items = [], this._name = t, this.running = !1, this.dispatch = Runner.generateRun(t, e), this.run = this.dispatch, this.emit = this.dispatch, this.dummy = {}, this.dummy[t] = function() {} } return Runner.prototype.add = function(t) { t[this._name] && (this.remove(t), this.items.push(t), this.toRemove = [], this.needsTidy = !1) }, Runner.prototype.tidy = function() { for (var t = 0; t < this.toRemove.length; t++) { var e = this.toRemove[t]; - 1 !== e && this.items.splice(e, 1) } }, Runner.prototype.remove = function(t) { var e = this.items.indexOf(t); this.running ? (this.needsTidy = !0, this.toRemove.push(e), this.items[e] = this.dummy) : -1 !== e && this.items.splice(e, 1) }, Runner.prototype.contains = function(t) { return -1 !== this.items.indexOf(t) }, Runner.prototype.removeAll = function() { this.items.length = 0 }, Runner.generateRun = function(t, e) { var r = t + "|" + e, n = Runner.hash[r]; if (!n) { if (0 < e) { for (var i = "arg0", o = 1; o < e; o++) i += ",arg" + o; n = new Function(i, "this.running = true; \n var items = this.items; \n for(var i=0;i= e.length && e === convertArrayBufferToString(t, 0, e.length) } function isFbxFormatASCII(t) { var e, r, n = ["K", "a", "y", "d", "a", "r", "a", "\\", "F", "B", "X", "\\", "B", "i", "n", "a", "r", "y", "\\", "\\"], i = 0; for (var o = 0; o < n.length; ++o) { if ((void 0, r = t[(e = 1) - 1], t = t.slice(i + e), i++, r) === n[o]) return !1 } return !0 } function getFbxVersion(t) { var e = t.match(/FBXVersion: (\d+)/); if (e) return parseInt(e[1]); throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.") } function convertFBXTimeToSeconds(t) { return t / 46186158e3 } var s = []; function getData(t, e, r, n) { var i; switch (n.mappingType) { case "ByPolygonVertex": i = t; break; case "ByPolygon": i = e; break; case "ByVertice": i = r; break; case "AllSame": i = n.indices[0] } "IndexToDirect" === n.referenceType && (i = n.indices[i]); var o = i * n.dataSize, a = o + n.dataSize; return function(t, e, r, n) { for (var i = r, o = 0; i < n; i++, o++) t[o] = e[i]; return t }(s, n.buffer, o, a) } var I = new P.k, O = new P.P; function generateTransform(t) { var e = new P.v, r = new P.v, n = new P.v, i = new P.v, o = new P.v, a = new P.v, s = new P.v, u = new P.v, h = new P.v, c = new P.v, l = new P.v, f = t.inheritType ? t.inheritType : 0; if (t.translation && e.setPosition(O.fromArray(t.translation)), t.preRotation) { var d = t.preRotation.map(P.t.degToRad); d.push(t.eulerOrder), r.makeRotationFromEuler(I.fromArray(d)) } if (t.rotation) { var p = t.rotation.map(P.t.degToRad); p.push(t.eulerOrder), n.makeRotationFromEuler(I.fromArray(p)) } if (t.postRotation) { var m = t.postRotation.map(P.t.degToRad); m.push(t.eulerOrder), i.makeRotationFromEuler(I.fromArray(m)) } t.scale && o.scale(O.fromArray(t.scale)), t.scalingOffset && s.setPosition(O.fromArray(t.scalingOffset)), t.scalingPivot && a.setPosition(O.fromArray(t.scalingPivot)), t.rotationOffset && u.setPosition(O.fromArray(t.rotationOffset)), t.rotationPivot && h.setPosition(O.fromArray(t.rotationPivot)), t.parentMatrixWorld && (c = t.parentMatrixWorld); var v = r.multiply(n).multiply(i), g = new P.v; c.extractRotation(g); var y, _, b, x, w = new P.v; if (w.copyPosition(c), b = w.getInverse(w).multiply(c), _ = g.getInverse(g).multiply(b), y = o, 0 === f) x = g.multiply(v).multiply(_).multiply(y); else if (1 === f) x = g.multiply(_).multiply(v).multiply(y); else { var T = (new P.v).copy(o), S = _.multiply(T.getInverse(T)); x = g.multiply(v).multiply(S).multiply(y) } var M = e.multiply(u).multiply(h).multiply(r).multiply(n).multiply(i).multiply(h.getInverse(h)).multiply(s).multiply(a).multiply(o).multiply(a.getInverse(a)), E = (new P.v).copyPosition(M), A = c.multiply(E); return l.copyPosition(A), M = l.multiply(x) } function getEulerOrder(t) { var e = ["ZYX", "YZX", "XZY", "ZXY", "YXZ", "XYZ"]; return 6 === (t = t || 0) ? e[0] : e[t] } function parseNumberArray(t) { return t.split(",").map(function(t) { return parseFloat(t) }) } function convertArrayBufferToString(t, e, r) { return void 0 === e && (e = 0), void 0 === r && (r = t.byteLength), P.q.decodeText(new Uint8Array(t, e, r)) } function append(t, e) { for (var r = 0, n = t.length, i = e.length; r < i; r++, n++) t[n] = e[r] } function inject(t, e, r) { return t.slice(0, e).concat(r).concat(t.slice(e)) } }, function(t, e, r) { var n = r(35), i = Math.min; t.exports = function(t) { return 0 < t ? i(n(t), 9007199254740991) : 0 } }, function(t, e, r) { "use strict"; function arraySlice(t, e, r) { return isTypedArray(t) ? new t.constructor(t.subarray(e, void 0 !== r ? r : t.length)) : t.slice(e, r) } function convertArray(t, e, r) { return !t || !r && t.constructor === e ? t : "number" == typeof e.BYTES_PER_ELEMENT ? new e(t) : Array.prototype.slice.call(t) } function isTypedArray(t) { return ArrayBuffer.isView(t) && !(t instanceof DataView) } function getKeyframeOrder(r) { for (var t = r.length, e = new Array(t), n = 0; n !== t; ++n) e[n] = n; return e.sort(function(t, e) { return r[t] - r[e] }), e } function sortedArray(t, e, r) { for (var n = t.length, i = new t.constructor(n), o = 0, a = 0; a !== n; ++o) for (var s = r[o] * e, u = 0; u !== e; ++u) i[a++] = t[s + u]; return i } function flattenJSON(t, e, r, n) { for (var i = 1, o = t[0]; void 0 !== o && void 0 === o[n];) o = t[i++]; if (void 0 !== o) { var a = o[n]; if (void 0 !== a) if (Array.isArray(a)) for (; void 0 !== (a = o[n]) && (e.push(o.time), r.push.apply(r, a)), void 0 !== (o = t[i++]);); else if (void 0 !== a.toArray) for (; void 0 !== (a = o[n]) && (e.push(o.time), a.toArray(r, r.length)), void 0 !== (o = t[i++]);); else for (; void 0 !== (a = o[n]) && (e.push(o.time), r.push(a)), void 0 !== (o = t[i++]);); } } function subclip(t, e, r, n, i) { i = i || 30; var o = t.clone(); o.name = e; for (var a = [], s = 0; s < o.tracks.length; ++s) { for (var u = o.tracks[s], h = u.getValueSize(), c = [], l = [], f = 0; f < u.times.length; ++f) { var d = u.times[f] * i; if (!(d < r || n <= d)) { c.push(u.times[f]); for (var p = 0; p < h; ++p) l.push(u.values[f * h + p]) } } 0 !== c.length && (u.times = convertArray(c, u.times.constructor), u.values = convertArray(l, u.values.constructor), a.push(u)) } o.tracks = a; var m = 1 / 0; for (s = 0; s < o.tracks.length; ++s) m > o.tracks[s].times[0] && (m = o.tracks[s].times[0]); for (s = 0; s < o.tracks.length; ++s) o.tracks[s].shift(-1 * m); return o.resetDuration(), o } r.d(e, "a", function() { return arraySlice }), r.d(e, "b", function() { return convertArray }), r.d(e, "e", function() { return isTypedArray }), r.d(e, "d", function() { return getKeyframeOrder }), r.d(e, "f", function() { return sortedArray }), r.d(e, "c", function() { return flattenJSON }), r.d(e, "g", function() { return subclip }) }, function(t, e, r) { t.exports = !r(10)(function() { return 7 != Object.defineProperty({}, "a", { get: function() { return 7 } }).a }) }, function(t, e, r) { var n = r(6), i = r(134), o = r(38), a = Object.defineProperty; e.f = r(19) ? Object.defineProperty : function(t, e, r) { if (n(t), e = o(e, !0), n(r), i) try { return a(t, e, r) } catch (t) {} if ("get" in r || "set" in r) throw TypeError("Accessors not supported!"); return "value" in r && (t[e] = r.value), t } }, function(t, e, r) { "use strict"; function _defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } var n = function() { function Device() { this.arora = !1, this.chrome = !1, this.epiphany = !1, this.firefox = !1, this.mobileSafari = !1, this.ie = !1, this.ieVersion = 0, this.trident = !1, this.tridentVersion = 0, this.midori = !1, this.opera = !1, this.safari = !1, this.silk = !1, this.webApp = !1, this.cocoonJS = !1, this.android = !1, this.chromeOS = !1, this.iOS = !1, this.linux = !1, this.macOS = !1, this.windows = !1, this.desktop = !1, this.pixelRatio = 0, this.iPhone = !1, this.iPhone4 = !1, this.iPad = !1, this.blob = !1, this.canvas = !1, this.localStorage = !1, this.file = !1, this.fileSystem = !1, this.webGL = !1, this.worker = !1, this.audioData = !1, this.webAudio = !1, this.ogg = !1, this.opus = !1, this.mp3 = !1, this.wav = !1, this.m4a = !1, this.webm = !1; var t = navigator.userAgent; this._checkBrowser(t), this._checkOS(t), this._checkDevice(t), this._checkAudio(), this._checkFeatures(), this._checkIsMobile(), this._checkIsTouch() } var t, e, r, n = Device.prototype; return n._checkBrowser = function(t) { /Arora/.test(t) ? this.arora = !0 : /Opera|OPR|op/.test(t) ? (this.opera = !0, this.chrome = !1) : /Chrome/.test(t) ? this.chrome = !0 : /Epiphany/.test(t) ? this.epiphany = !0 : /Firefox/.test(t) ? this.firefox = !0 : /Mobile Safari/.test(t) ? this.mobileSafari = !0 : /MSIE (\d+\.\d+);/.test(t) || navigator.userAgent.match(/Trident.*rv[ :]*11\./) ? (this.ie = !0, this.ieVersion = parseInt(RegExp.$1, 10)) : /Midori/.test(t) ? this.midori = !0 : /Safari/.test(t) ? this.safari = !0 : /\bSilk\b/.test(t) ? this.silk = !0 : /Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(t) && (this.ie = !0, this.trident = !0, this.tridentVersion = parseInt(RegExp.$1, 10), this.ieVersion = parseInt(RegExp.$3, 10)), navigator.standalone && (this.webApp = !0), navigator.isCocoonJS && (this.cocoonJS = !0) }, n._checkOS = function(t) { if (/Android/.test(t)) this.android = !0; else if (/CrOS/.test(t)) this.chromeOS = !0; else if (/iP[ao]d|iPhone/i.test(t)) { this.iOS = !0; var e = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/); this.iOS_version = [parseInt(e[1], 10), parseInt(e[2], 10), parseInt(e[3] || 0, 10)] } else /Linux/.test(t) ? this.linux = !0 : /Mac OS/.test(t) ? this.macOS = !0 : /Windows/.test(t) && (this.windows = !0); (this.windows || this.macOS || this.linux || this.chromeOS) && (this.desktop = !0) }, n._checkDevice = function() { this.pixelRatio = window.devicePixelRatio || 1, this.iPhone = -1 !== navigator.userAgent.toLowerCase().indexOf("iphone"), this.iPhone4 = 2 === this.pixelRatio && this.iPhone, this.iPhone4 && (this.iPhone4 = 480 == window.screen.height && 320 == window.screen.width || 480 == window.screen.width && 320 == window.screen.height), this.iPad = -1 !== navigator.userAgent.toLowerCase().indexOf("ipad") }, n._checkFeatures = function() { void 0 !== window.Blob && (this.blob = !0), this.canvas = !!window.CanvasRenderingContext2D; try { this.localStorage = !!localStorage.getItem } catch (t) { this.localStorage = !1 } this.file = !!(window.File && window.FileReader && window.FileList && window.Blob), this.fileSystem = !!window.requestFileSystem, this.webGL = function() { try { var t = document.createElement("canvas"); return !!window.WebGLRenderingContext && (t.getContext("webgl") || t.getContext("experimental-webgl")) } catch (t) { return !1 } }(), (this.android || this.ie) && (this.webGL = !1), this.worker = !!window.Worker, ("ontouchstart" in document.documentElement || window.navigator.msPointerEnabled) && (this.touch = !0) }, n._checkAudio = function() { this.audioData = !!window.Audio, this.webaudio = !(!window.AudioContext && !window.webkitAudioContext); var t = document.createElement("audio"); try { !1 == !!t.canPlayType && (t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, "") && (this.ogg = !0), t.canPlayType("audio/mpeg;").replace(/^no$/, "") && (this.mp3 = !0), t.canPlayType('audio/wav; codecs="1"').replace(/^no$/, "") && (this.wav = !0), (t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/aac;").replace(/^no$/, "")) && (this.m4a = !0)) } catch (t) {} }, n._checkIsMobile = function() { var t, e = !1; t = navigator.userAgent || navigator.vendor || window.opera, (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4))) && (e = !0), this.isMobile = e, this.mobile = e }, n._checkIsTouch = function() { this.isTouch = "ontouchstart" in window || 0 < navigator.MaxTouchPoints || 0 < navigator.msMaxTouchPoints }, n.is_touch_device = function() {}, n.getInfo = function() { var t = "DEVICE OUTPUT\n\n"; return t += "---\n", t += "Browser Info :: \n", t += "Arora : " + this.arora + "\n", t += "Chrome : " + this.chrome + "\n", t += "Epiphany : " + this.epiphany + "\n", t += "Firefox : " + this.firefox + "\n", t += "Mobile Safari : " + this.mobileSafari + "\n", t += "IE : " + this.ie, this.ie ? t += " (Version " + this.ieVersion + ")\n" : t += "\n", t += "Midori : " + this.midori + "\n", t += "Opera : " + this.opera + "\n", t += "Safari : " + this.safari + "\n", t += "Web App : " + this.webApp + "\n", t += "CocoonJS : " + this.cocoonJS + "\n", t += "Android : " + this.android + "\n", t += "---\n", t += "Operating System :: \n", t += "Chrome OS : " + this.chromeOS + "\n", t += "iOS : " + this.iOS + "\n", t += "Linux : " + this.linux + "\n", t += "Mac OS : " + this.macOS + "\n", t += "Windows : " + this.windows + "\n", t += "Desktop : " + this.desktop + "\n", t += "---\n", t += "Device Type : \n", t += "Pixel Ratio : " + this.pixelRatio + "\n", t += "iPhone : " + this.iPhone + "\n", t += "iPhone 4 : " + this.iPhone4 + "\n", t += "iPad : " + this.iPad + "\n", t += "---\n", t += "Features :: \n", t += "Blob : " + this.blob + "\n", t += "Canvas : " + this.canvas + "\n", t += "LocalStorage : " + this.localStorage + "\n", t += "File : " + this.file + "\n", t += "File System : " + this.fileSystem + "\n", t += "WebGL : " + this.webGL + "\n", t += "Workers : " + this.worker + "\n", t += "---\n", t += "Audio :: \n", t += "AudioData : " + this.audioData + "\n", t += "WebAudio : " + this.webAudio + "\n", t += "Supports .ogg : " + this.ogg + "\n", t += "Supports Opus : " + this.opus + "\n", t += "Supports .mp3 : " + this.mp3 + "\n", t += "Supports .wav : " + this.wav + "\n", t += "Supports .m4a : " + this.m4a + "\n", t += "Supports .webm : " + this.webm }, t = Device, (e = [{ key: "ie9", get: function() { return this.ie && 9 === this.ieVersion } }, { key: "useSM2", get: function() { return this.ie || this.opera } }]) && _defineProperties(t.prototype, e), r && _defineProperties(t, r), Device }(); n.instance = new n, e.a = n }, function(t, e, r) { var n = r(39); t.exports = function(t) { return Object(n(t)) } }, function(i, f, t) { (function(r) { var n; ! function() { "use strict"; var t = function() { this.init() }; t.prototype = { init: function() { var t = this || b; return t._counter = 1e3, t._html5AudioPool = [], t.html5PoolSize = 10, t._codecs = {}, t._howls = [], t._muted = !1, t._volume = 1, t._canPlayEvent = "canplaythrough", t._navigator = "undefined" != typeof window && window.navigator ? window.navigator : null, t.masterGain = null, t.noAudio = !1, t.usingWebAudio = !0, t.autoSuspend = !0, t.ctx = null, t.autoUnlock = !0, t._setup(), t }, volume: function(t) { var e = this || b; if (t = parseFloat(t), e.ctx || l(), void 0 !== t && 0 <= t && t <= 1) { if (e._volume = t, e._muted) return e; e.usingWebAudio && e.masterGain.gain.setValueAtTime(t, b.ctx.currentTime); for (var r = 0; r < e._howls.length; r++) if (!e._howls[r]._webAudio) for (var n = e._howls[r]._getSoundIds(), i = 0; i < n.length; i++) { var o = e._howls[r]._soundById(n[i]); o && o._node && (o._node.volume = o._volume * t) } return e } return e._volume }, mute: function(t) { var e = this || b; e.ctx || l(), e._muted = t, e.usingWebAudio && e.masterGain.gain.setValueAtTime(t ? 0 : e._volume, b.ctx.currentTime); for (var r = 0; r < e._howls.length; r++) if (!e._howls[r]._webAudio) for (var n = e._howls[r]._getSoundIds(), i = 0; i < n.length; i++) { var o = e._howls[r]._soundById(n[i]); o && o._node && (o._node.muted = !!t || o._muted) } return e }, unload: function() { for (var t = this || b, e = t._howls.length - 1; 0 <= e; e--) t._howls[e].unload(); return t.usingWebAudio && t.ctx && void 0 !== t.ctx.close && (t.ctx.close(), t.ctx = null, l()), t }, codecs: function(t) { return (this || b)._codecs[t.replace(/^x-/, "")] }, _setup: function() { var e = this || b; if (e.state = e.ctx && e.ctx.state || "suspended", e._autoSuspend(), !e.usingWebAudio) if ("undefined" != typeof Audio) try { void 0 === (new Audio).oncanplaythrough && (e._canPlayEvent = "canplay") } catch (t) { e.noAudio = !0 } else e.noAudio = !0; try { (new Audio).muted && (e.noAudio = !0) } catch (t) {} return e.noAudio || e._setupCodecs(), e }, _setupCodecs: function() { var e = this || b, t = null; try { t = "undefined" != typeof Audio ? new Audio : null } catch (t) { return e } if (!t || "function" != typeof t.canPlayType) return e; var r = t.canPlayType("audio/mpeg;").replace(/^no$/, ""), n = e._navigator && e._navigator.userAgent.match(/OPR\/([0-6].)/g), i = n && parseInt(n[0].split("/")[1], 10) < 33; return e._codecs = { mp3: !(i || !r && !t.canPlayType("audio/mp3;").replace(/^no$/, "")), mpeg: !!r, opus: !!t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""), ogg: !!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), oga: !!t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""), wav: !!t.canPlayType('audio/wav; codecs="1"').replace(/^no$/, ""), aac: !!t.canPlayType("audio/aac;").replace(/^no$/, ""), caf: !!t.canPlayType("audio/x-caf;").replace(/^no$/, ""), m4a: !!(t.canPlayType("audio/x-m4a;") || t.canPlayType("audio/m4a;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""), mp4: !!(t.canPlayType("audio/x-mp4;") || t.canPlayType("audio/mp4;") || t.canPlayType("audio/aac;")).replace(/^no$/, ""), weba: !!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), webm: !!t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, ""), dolby: !!t.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""), flac: !!(t.canPlayType("audio/x-flac;") || t.canPlayType("audio/flac;")).replace(/^no$/, "") }, e }, _unlockAudio: function() { var s = this || b, t = /iPhone|iPad|iPod|Android|BlackBerry|BB10|Silk|Mobi|Chrome|Safari/i.test(s._navigator && s._navigator.userAgent); if (!s._audioUnlocked && s.ctx && t) { s._audioUnlocked = !1, s.autoUnlock = !1, s._mobileUnloaded || 44100 === s.ctx.sampleRate || (s._mobileUnloaded = !0, s.unload()), s._scratchBuffer = s.ctx.createBuffer(1, 1, 22050); var u = function(t) { for (var e = 0; e < s.html5PoolSize; e++) { var r = new Audio; r._unlocked = !0, s._releaseHtml5Audio(r) } for (e = 0; e < s._howls.length; e++) if (!s._howls[e]._webAudio) for (var n = s._howls[e]._getSoundIds(), i = 0; i < n.length; i++) { var o = s._howls[e]._soundById(n[i]); o && o._node && !o._node._unlocked && (o._node._unlocked = !0, o._node.load()) } s._autoResume(); var a = s.ctx.createBufferSource(); a.buffer = s._scratchBuffer, a.connect(s.ctx.destination), void 0 === a.start ? a.noteOn(0) : a.start(0), "function" == typeof s.ctx.resume && s.ctx.resume(), a.onended = function() { a.disconnect(0), s._audioUnlocked = !0, document.removeEventListener("touchstart", u, !0), document.removeEventListener("touchend", u, !0), document.removeEventListener("click", u, !0); for (var t = 0; t < s._howls.length; t++) s._howls[t]._emit("unlock") } }; return document.addEventListener("touchstart", u, !0), document.addEventListener("touchend", u, !0), document.addEventListener("click", u, !0), s } }, _obtainHtml5Audio: function() { var t = this || b; if (t._html5AudioPool.length) return t._html5AudioPool.pop(); var e = (new Audio).play(); return e && "undefined" != typeof Promise && (e instanceof Promise || "function" == typeof e.then) && e.catch(function() {}), new Audio }, _releaseHtml5Audio: function(t) { var e = this || b; return t._unlocked && e._html5AudioPool.push(t), e }, _autoSuspend: function() { var t = this; if (t.autoSuspend && t.ctx && void 0 !== t.ctx.suspend && b.usingWebAudio) { for (var e = 0; e < t._howls.length; e++) if (t._howls[e]._webAudio) for (var r = 0; r < t._howls[e]._sounds.length; r++) if (!t._howls[e]._sounds[r]._paused) return t; return t._suspendTimer && clearTimeout(t._suspendTimer), t._suspendTimer = setTimeout(function() { t.autoSuspend && (t._suspendTimer = null, t.state = "suspending", t.ctx.suspend().then(function() { t.state = "suspended", t._resumeAfterSuspend && (delete t._resumeAfterSuspend, t._autoResume()) })) }, 3e4), t } }, _autoResume: function() { var e = this; if (e.ctx && void 0 !== e.ctx.resume && b.usingWebAudio) return "running" === e.state && e._suspendTimer ? (clearTimeout(e._suspendTimer), e._suspendTimer = null) : "suspended" === e.state ? (e.ctx.resume().then(function() { e.state = "running"; for (var t = 0; t < e._howls.length; t++) e._howls[t]._emit("resume") }), e._suspendTimer && (clearTimeout(e._suspendTimer), e._suspendTimer = null)) : "suspending" === e.state && (e._resumeAfterSuspend = !0), e } }; var b = new t, e = function(t) { t.src && 0 !== t.src.length && this.init(t) }; e.prototype = { init: function(t) { var e = this; return b.ctx || l(), e._autoplay = t.autoplay || !1, e._format = "string" != typeof t.format ? t.format : [t.format], e._html5 = t.html5 || !1, e._muted = t.mute || !1, e._loop = t.loop || !1, e._pool = t.pool || 5, e._preload = "boolean" != typeof t.preload || t.preload, e._rate = t.rate || 1, e._sprite = t.sprite || {}, e._src = "string" != typeof t.src ? t.src : [t.src], e._volume = void 0 !== t.volume ? t.volume : 1, e._xhrWithCredentials = t.xhrWithCredentials || !1, e._duration = 0, e._state = "unloaded", e._sounds = [], e._endTimers = {}, e._queue = [], e._playLock = !1, e._onend = t.onend ? [{ fn: t.onend }] : [], e._onfade = t.onfade ? [{ fn: t.onfade }] : [], e._onload = t.onload ? [{ fn: t.onload }] : [], e._onloaderror = t.onloaderror ? [{ fn: t.onloaderror }] : [], e._onplayerror = t.onplayerror ? [{ fn: t.onplayerror }] : [], e._onpause = t.onpause ? [{ fn: t.onpause }] : [], e._onplay = t.onplay ? [{ fn: t.onplay }] : [], e._onstop = t.onstop ? [{ fn: t.onstop }] : [], e._onmute = t.onmute ? [{ fn: t.onmute }] : [], e._onvolume = t.onvolume ? [{ fn: t.onvolume }] : [], e._onrate = t.onrate ? [{ fn: t.onrate }] : [], e._onseek = t.onseek ? [{ fn: t.onseek }] : [], e._onunlock = t.onunlock ? [{ fn: t.onunlock }] : [], e._onresume = [], e._webAudio = b.usingWebAudio && !e._html5, void 0 !== b.ctx && b.ctx && b.autoUnlock && b._unlockAudio(), b._howls.push(e), e._autoplay && e._queue.push({ event: "play", action: function() { e.play() } }), e._preload && e.load(), e }, load: function() { var t = this, e = null; if (b.noAudio) t._emit("loaderror", null, "No audio support."); else { "string" == typeof t._src && (t._src = [t._src]); for (var r = 0; r < t._src.length; r++) { var n, i; if (t._format && t._format[r]) n = t._format[r]; else { if ("string" != typeof(i = t._src[r])) { t._emit("loaderror", null, "Non-string found in selected audio sources - ignoring."); continue }(n = /^data:audio\/([^;,]+);/i.exec(i)) || (n = /\.([^.]+)$/.exec(i.split("?", 1)[0])), n && (n = n[1].toLowerCase()) } if (n && b.codecs(n)) { e = t._src[r]; break } } if (e) return t._src = e, t._state = "loading", "https:" === window.location.protocol && "http:" === e.slice(0, 5) && (t._html5 = !0, t._webAudio = !1), new o(t), t._webAudio && s(t), t; t._emit("loaderror", null, "No codec support for selected audio sources.") } }, play: function(e, r) { var n = this, t = null; if ("number" == typeof e) t = e, e = null; else { if ("string" == typeof e && "loaded" === n._state && !n._sprite[e]) return null; if (void 0 === e && (e = "__default", !n._playLock)) { for (var i = 0, o = 0; o < n._sounds.length; o++) n._sounds[o]._paused && !n._sounds[o]._ended && (i++, t = n._sounds[o]._id); 1 === i ? e = null : t = null } } var a = t ? n._soundById(t) : n._inactiveSound(); if (!a) return null; if (t && !e && (e = a._sprite || "__default"), "loaded" !== n._state) { a._sprite = e, a._ended = !1; var s = a._id; return n._queue.push({ event: "play", action: function() { n.play(s) } }), s } if (t && !a._paused) return r || n._loadQueue("play"), a._id; n._webAudio && b._autoResume(); var u = Math.max(0, 0 < a._seek ? a._seek : n._sprite[e][0] / 1e3), h = Math.max(0, (n._sprite[e][0] + n._sprite[e][1]) / 1e3 - u), c = 1e3 * h / Math.abs(a._rate), l = n._sprite[e][0] / 1e3, f = (n._sprite[e][0] + n._sprite[e][1]) / 1e3, d = !(!a._loop && !n._sprite[e][2]); a._sprite = e, a._ended = !1; var p = function() { a._paused = !1, a._seek = u, a._start = l, a._stop = f, a._loop = d }; if (!(f <= u)) { var m = a._node; if (n._webAudio) { var v = function() { n._playLock = !1, p(), n._refreshBuffer(a); var t = a._muted || n._muted ? 0 : a._volume; m.gain.setValueAtTime(t, b.ctx.currentTime), a._playStart = b.ctx.currentTime, void 0 === m.bufferSource.start ? a._loop ? m.bufferSource.noteGrainOn(0, u, 86400) : m.bufferSource.noteGrainOn(0, u, h) : a._loop ? m.bufferSource.start(0, u, 86400) : m.bufferSource.start(0, u, h), c !== 1 / 0 && (n._endTimers[a._id] = setTimeout(n._ended.bind(n, a), c)), r || setTimeout(function() { n._emit("play", a._id), n._loadQueue() }, 0) }; "running" === b.state ? v() : (n._playLock = !0, n.once("resume", v), n._clearTimer(a._id)) } else { var g = function() { m.currentTime = u, m.muted = a._muted || n._muted || b._muted || m.muted, m.volume = a._volume * b.volume(), m.playbackRate = a._rate; try { var t = m.play(); if (t && "undefined" != typeof Promise && (t instanceof Promise || "function" == typeof t.then) ? (n._playLock = !0, p(), t.then(function() { n._playLock = !1, m._unlocked = !0, r || (n._emit("play", a._id), n._loadQueue()) }).catch(function() { n._playLock = !1, n._emit("playerror", a._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."), a._ended = !0, a._paused = !0 })) : r || (n._playLock = !1, p(), n._emit("play", a._id), n._loadQueue()), m.playbackRate = a._rate, m.paused) return void n._emit("playerror", a._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."); "__default" !== e || a._loop ? n._endTimers[a._id] = setTimeout(n._ended.bind(n, a), c) : (n._endTimers[a._id] = function() { n._ended(a), m.removeEventListener("ended", n._endTimers[a._id], !1) }, m.addEventListener("ended", n._endTimers[a._id], !1)) } catch (t) { n._emit("playerror", a._id, t) } }, y = window && window.ejecta || !m.readyState && b._navigator.isCocoonJS; if (3 <= m.readyState || y) g(); else { n._playLock = !0; var _ = function() { g(), m.removeEventListener(b._canPlayEvent, _, !1) }; m.addEventListener(b._canPlayEvent, _, !1), n._clearTimer(a._id) } } return a._id } n._ended(a) }, pause: function(t) { var e = this; if ("loaded" !== e._state || e._playLock) return e._queue.push({ event: "pause", action: function() { e.pause(t) } }), e; for (var r = e._getSoundIds(t), n = 0; n < r.length; n++) { e._clearTimer(r[n]); var i = e._soundById(r[n]); if (i && !i._paused && (i._seek = e.seek(r[n]), i._rateSeek = 0, i._paused = !0, e._stopFade(r[n]), i._node)) if (e._webAudio) { if (!i._node.bufferSource) continue; void 0 === i._node.bufferSource.stop ? i._node.bufferSource.noteOff(0) : i._node.bufferSource.stop(0), e._cleanBuffer(i._node) } else isNaN(i._node.duration) && i._node.duration !== 1 / 0 || i._node.pause(); arguments[1] || e._emit("pause", i ? i._id : null) } return e }, stop: function(t, e) { var r = this; if ("loaded" !== r._state || r._playLock) return r._queue.push({ event: "stop", action: function() { r.stop(t) } }), r; for (var n = r._getSoundIds(t), i = 0; i < n.length; i++) { r._clearTimer(n[i]); var o = r._soundById(n[i]); o && (o._seek = o._start || 0, o._rateSeek = 0, o._paused = !0, o._ended = !0, r._stopFade(n[i]), o._node && (r._webAudio ? o._node.bufferSource && (void 0 === o._node.bufferSource.stop ? o._node.bufferSource.noteOff(0) : o._node.bufferSource.stop(0), r._cleanBuffer(o._node)) : isNaN(o._node.duration) && o._node.duration !== 1 / 0 || (o._node.currentTime = o._start || 0, o._node.pause())), e || r._emit("stop", o._id)) } return r }, mute: function(t, e) { var r = this; if ("loaded" !== r._state || r._playLock) return r._queue.push({ event: "mute", action: function() { r.mute(t, e) } }), r; if (void 0 === e) { if ("boolean" != typeof t) return r._muted; r._muted = t } for (var n = r._getSoundIds(e), i = 0; i < n.length; i++) { var o = r._soundById(n[i]); o && (o._muted = t, o._interval && r._stopFade(o._id), r._webAudio && o._node ? o._node.gain.setValueAtTime(t ? 0 : o._volume, b.ctx.currentTime) : o._node && (o._node.muted = !!b._muted || t), r._emit("mute", o._id)) } return r }, volume: function() { var t, e, r, n = this, i = arguments; if (0 === i.length) return n._volume; if (1 === i.length || 2 === i.length && void 0 === i[1] ? 0 <= n._getSoundIds().indexOf(i[0]) ? e = parseInt(i[0], 10) : t = parseFloat(i[0]) : 2 <= i.length && (t = parseFloat(i[0]), e = parseInt(i[1], 10)), !(void 0 !== t && 0 <= t && t <= 1)) return (r = e ? n._soundById(e) : n._sounds[0]) ? r._volume : 0; if ("loaded" !== n._state || n._playLock) return n._queue.push({ event: "volume", action: function() { n.volume.apply(n, i) } }), n; void 0 === e && (n._volume = t), e = n._getSoundIds(e); for (var o = 0; o < e.length; o++)(r = n._soundById(e[o])) && (r._volume = t, i[2] || n._stopFade(e[o]), n._webAudio && r._node && !r._muted ? r._node.gain.setValueAtTime(t, b.ctx.currentTime) : r._node && !r._muted && (r._node.volume = t * b.volume()), n._emit("volume", r._id)); return n }, fade: function(t, e, r, n) { var i = this; if ("loaded" !== i._state || i._playLock) return i._queue.push({ event: "fade", action: function() { i.fade(t, e, r, n) } }), i; t = parseFloat(t), e = parseFloat(e), r = parseFloat(r), i.volume(t, n); for (var o = i._getSoundIds(n), a = 0; a < o.length; a++) { var s = i._soundById(o[a]); if (s) { if (n || i._stopFade(o[a]), i._webAudio && !s._muted) { var u = b.ctx.currentTime, h = u + r / 1e3; s._volume = t, s._node.gain.setValueAtTime(t, u), s._node.gain.linearRampToValueAtTime(e, h) } i._startFadeInterval(s, t, e, r, o[a], void 0 === n) } } return i }, _startFadeInterval: function(e, r, n, i, t, o) { var a = this, s = r, u = n - r, h = Math.abs(u / .01), c = Math.max(4, 0 < h ? i / h : i), l = Date.now(); e._fadeTo = n, e._interval = setInterval(function() { var t = (Date.now() - l) / i; l = Date.now(), s += u * t, s = Math.max(0, s), s = Math.min(1, s), s = Math.round(100 * s) / 100, a._webAudio ? e._volume = s : a.volume(s, e._id, !0), o && (a._volume = s), (n < r && s <= n || r < n && n <= s) && (clearInterval(e._interval), e._interval = null, e._fadeTo = null, a.volume(n, e._id), a._emit("fade", e._id)) }, c) }, _stopFade: function(t) { var e = this._soundById(t); return e && e._interval && (this._webAudio && e._node.gain.cancelScheduledValues(b.ctx.currentTime), clearInterval(e._interval), e._interval = null, this.volume(e._fadeTo, t), e._fadeTo = null, this._emit("fade", t)), this }, loop: function() { var t, e, r, n = arguments; if (0 === n.length) return this._loop; if (1 === n.length) { if ("boolean" != typeof n[0]) return !!(r = this._soundById(parseInt(n[0], 10))) && r._loop; t = n[0], this._loop = t } else 2 === n.length && (t = n[0], e = parseInt(n[1], 10)); for (var i = this._getSoundIds(e), o = 0; o < i.length; o++)(r = this._soundById(i[o])) && (r._loop = t, this._webAudio && r._node && r._node.bufferSource && (r._node.bufferSource.loop = t) && (r._node.bufferSource.loopStart = r._start || 0, r._node.bufferSource.loopEnd = r._stop)); return this }, rate: function() { var t, e, r, n = this, i = arguments; if (0 === i.length) e = n._sounds[0]._id; else if (1 === i.length) { 0 <= n._getSoundIds().indexOf(i[0]) ? e = parseInt(i[0], 10) : t = parseFloat(i[0]) } else 2 === i.length && (t = parseFloat(i[0]), e = parseInt(i[1], 10)); if ("number" != typeof t) return (r = n._soundById(e)) ? r._rate : n._rate; if ("loaded" !== n._state || n._playLock) return n._queue.push({ event: "rate", action: function() { n.rate.apply(n, i) } }), n; void 0 === e && (n._rate = t), e = n._getSoundIds(e); for (var o = 0; o < e.length; o++) if (r = n._soundById(e[o])) { n.playing(e[o]) && (r._rateSeek = n.seek(e[o]), r._playStart = n._webAudio ? b.ctx.currentTime : r._playStart), r._rate = t, n._webAudio && r._node && r._node.bufferSource ? r._node.bufferSource.playbackRate.setValueAtTime(t, b.ctx.currentTime) : r._node && (r._node.playbackRate = t); var a = n.seek(e[o]), s = 1e3 * ((n._sprite[r._sprite][0] + n._sprite[r._sprite][1]) / 1e3 - a) / Math.abs(r._rate); !n._endTimers[e[o]] && r._paused || (n._clearTimer(e[o]), n._endTimers[e[o]] = setTimeout(n._ended.bind(n, r), s)), n._emit("rate", r._id) } return n }, seek: function() { var t, e, r = this, n = arguments; if (0 === n.length) e = r._sounds[0]._id; else if (1 === n.length) { 0 <= r._getSoundIds().indexOf(n[0]) ? e = parseInt(n[0], 10) : r._sounds.length && (e = r._sounds[0]._id, t = parseFloat(n[0])) } else 2 === n.length && (t = parseFloat(n[0]), e = parseInt(n[1], 10)); if (void 0 === e) return r; if ("loaded" !== r._state || r._playLock) return r._queue.push({ event: "seek", action: function() { r.seek.apply(r, n) } }), r; var i = r._soundById(e); if (i) { if (!("number" == typeof t && 0 <= t)) { if (r._webAudio) { var o = r.playing(e) ? b.ctx.currentTime - i._playStart : 0, a = i._rateSeek ? i._rateSeek - i._seek : 0; return i._seek + (a + o * Math.abs(i._rate)) } return i._node.currentTime } var s = r.playing(e); s && r.pause(e, !0), i._seek = t, i._ended = !1, r._clearTimer(e), r._webAudio || !i._node || isNaN(i._node.duration) || (i._node.currentTime = t); var u = function() { r._emit("seek", e), s && r.play(e, !0) }; if (s && !r._webAudio) { var h = function() { r._playLock ? setTimeout(h, 0) : u() }; setTimeout(h, 0) } else u() } return r }, playing: function(t) { if ("number" == typeof t) { var e = this._soundById(t); return !!e && !e._paused } for (var r = 0; r < this._sounds.length; r++) if (!this._sounds[r]._paused) return !0; return !1 }, duration: function(t) { var e = this._duration, r = this._soundById(t); return r && (e = this._sprite[r._sprite][1] / 1e3), e }, state: function() { return this._state }, unload: function() { for (var t = this, e = t._sounds, r = 0; r < e.length; r++) { if (e[r]._paused || t.stop(e[r]._id), !t._webAudio) /MSIE |Trident\//.test(b._navigator && b._navigator.userAgent) || (e[r]._node.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"), e[r]._node.removeEventListener("error", e[r]._errorFn, !1), e[r]._node.removeEventListener(b._canPlayEvent, e[r]._loadFn, !1), b._releaseHtml5Audio(e[r]._node); delete e[r]._node, t._clearTimer(e[r]._id) } var n = b._howls.indexOf(t); 0 <= n && b._howls.splice(n, 1); var i = !0; for (r = 0; r < b._howls.length; r++) if (b._howls[r]._src === t._src || 0 <= t._src.indexOf(b._howls[r]._src)) { i = !1; break } return a && i && delete a[t._src], b.noAudio = !1, t._state = "unloaded", t._sounds = [], t = null }, on: function(t, e, r, n) { var i = this["_on" + t]; return "function" == typeof e && i.push(n ? { id: r, fn: e, once: n } : { id: r, fn: e }), this }, off: function(t, e, r) { var n = this["_on" + t], i = 0; if ("number" == typeof e && (r = e, e = null), e || r) for (i = 0; i < n.length; i++) { var o = r === n[i].id; if (e === n[i].fn && o || !e && o) { n.splice(i, 1); break } } else if (t) this["_on" + t] = []; else { var a = Object.keys(this); for (i = 0; i < a.length; i++) 0 === a[i].indexOf("_on") && Array.isArray(this[a[i]]) && (this[a[i]] = []) } return this }, once: function(t, e, r) { return this.on(t, e, r, 1), this }, _emit: function(t, e, r) { for (var n = this["_on" + t], i = n.length - 1; 0 <= i; i--) n[i].id && n[i].id !== e && "load" !== t || (setTimeout(function(t) { t.call(this, e, r) }.bind(this, n[i].fn), 0), n[i].once && this.off(t, n[i].fn, n[i].id)); return this._loadQueue(t), this }, _loadQueue: function(t) { if (0 < this._queue.length) { var e = this._queue[0]; e.event === t && (this._queue.shift(), this._loadQueue()), t || e.action() } return this }, _ended: function(t) { var e = this, r = t._sprite; if (!e._webAudio && t._node && !t._node.paused && !t._node.ended && t._node.currentTime < t._stop) return setTimeout(e._ended.bind(e, t), 100), e; var n = !(!t._loop && !e._sprite[r][2]); if (e._emit("end", t._id), !e._webAudio && n && e.stop(t._id, !0).play(t._id), e._webAudio && n) { e._emit("play", t._id), t._seek = t._start || 0, t._rateSeek = 0, t._playStart = b.ctx.currentTime; var i = 1e3 * (t._stop - t._start) / Math.abs(t._rate); e._endTimers[t._id] = setTimeout(e._ended.bind(e, t), i) } return e._webAudio && !n && (t._paused = !0, t._ended = !0, t._seek = t._start || 0, t._rateSeek = 0, e._clearTimer(t._id), e._cleanBuffer(t._node), b._autoSuspend()), e._webAudio || n || e.stop(t._id, !0), e }, _clearTimer: function(t) { if (this._endTimers[t]) { if ("function" != typeof this._endTimers[t]) clearTimeout(this._endTimers[t]); else { var e = this._soundById(t); e && e._node && e._node.removeEventListener("ended", this._endTimers[t], !1) } delete this._endTimers[t] } return this }, _soundById: function(t) { for (var e = 0; e < this._sounds.length; e++) if (t === this._sounds[e]._id) return this._sounds[e]; return null }, _inactiveSound: function() { this._drain(); for (var t = 0; t < this._sounds.length; t++) if (this._sounds[t]._ended) return this._sounds[t].reset(); return new o(this) }, _drain: function() { var t = this, e = t._pool, r = 0, n = 0; if (!(t._sounds.length < e)) { for (n = 0; n < t._sounds.length; n++) t._sounds[n]._ended && r++; for (n = t._sounds.length - 1; 0 <= n; n--) { if (r <= e) return; t._sounds[n]._ended && (t._webAudio && t._sounds[n]._node && t._sounds[n]._node.disconnect(0), t._sounds.splice(n, 1), r--) } } }, _getSoundIds: function(t) { if (void 0 !== t) return [t]; for (var e = [], r = 0; r < this._sounds.length; r++) e.push(this._sounds[r]._id); return e }, _refreshBuffer: function(t) { return t._node.bufferSource = b.ctx.createBufferSource(), t._node.bufferSource.buffer = a[this._src], t._panner ? t._node.bufferSource.connect(t._panner) : t._node.bufferSource.connect(t._node), t._node.bufferSource.loop = t._loop, t._loop && (t._node.bufferSource.loopStart = t._start || 0, t._node.bufferSource.loopEnd = t._stop || 0), t._node.bufferSource.playbackRate.setValueAtTime(t._rate, b.ctx.currentTime), this }, _cleanBuffer: function(t) { var e = b._navigator && 0 <= b._navigator.vendor.indexOf("Apple"); if (b._scratchBuffer && t.bufferSource && (t.bufferSource.onended = null, t.bufferSource.disconnect(0), e)) try { t.bufferSource.buffer = b._scratchBuffer } catch (t) {} return t.bufferSource = null, this } }; var o = function(t) { this._parent = t, this.init() }; o.prototype = { init: function() { var t = this, e = t._parent; return t._muted = e._muted, t._loop = e._loop, t._volume = e._volume, t._rate = e._rate, t._seek = 0, t._paused = !0, t._ended = !0, t._sprite = "__default", t._id = ++b._counter, e._sounds.push(t), t.create(), t }, create: function() { var t = this, e = t._parent, r = b._muted || t._muted || t._parent._muted ? 0 : t._volume; return e._webAudio ? (t._node = void 0 === b.ctx.createGain ? b.ctx.createGainNode() : b.ctx.createGain(), t._node.gain.setValueAtTime(r, b.ctx.currentTime), t._node.paused = !0, t._node.connect(b.masterGain)) : (t._node = b._obtainHtml5Audio(), t._errorFn = t._errorListener.bind(t), t._node.addEventListener("error", t._errorFn, !1), t._loadFn = t._loadListener.bind(t), t._node.addEventListener(b._canPlayEvent, t._loadFn, !1), t._node.src = e._src, t._node.preload = "auto", t._node.volume = r * b.volume(), t._node.load()), t }, reset: function() { var t = this, e = t._parent; return t._muted = e._muted, t._loop = e._loop, t._volume = e._volume, t._rate = e._rate, t._seek = 0, t._rateSeek = 0, t._paused = !0, t._ended = !0, t._sprite = "__default", t._id = ++b._counter, t }, _errorListener: function() { this._parent._emit("loaderror", this._id, this._node.error ? this._node.error.code : 0), this._node.removeEventListener("error", this._errorFn, !1) }, _loadListener: function() { var t = this._parent; t._duration = Math.ceil(10 * this._node.duration) / 10, 0 === Object.keys(t._sprite).length && (t._sprite = { __default: [0, 1e3 * t._duration] }), "loaded" !== t._state && (t._state = "loaded", t._emit("load"), t._loadQueue()), this._node.removeEventListener(b._canPlayEvent, this._loadFn, !1) } }; var a = {}, s = function(e) { var t = e._src; if (a[t]) return e._duration = a[t].duration, void c(e); if (/^data:[^;]+;base64,/.test(t)) { for (var r = atob(t.split(",")[1]), n = new Uint8Array(r.length), i = 0; i < r.length; ++i) n[i] = r.charCodeAt(i); h(n.buffer, e) } else { var o = new XMLHttpRequest; o.open("GET", t, !0), o.withCredentials = e._xhrWithCredentials, o.responseType = "arraybuffer", o.onload = function() { var t = (o.status + "")[0]; "0" === t || "2" === t || "3" === t ? h(o.response, e) : e._emit("loaderror", null, "Failed loading audio file with status: " + o.status + ".") }, o.onerror = function() { e._webAudio && (e._html5 = !0, e._webAudio = !1, e._sounds = [], delete a[t], e.load()) }, u(o) } }, u = function(e) { try { e.send() } catch (t) { e.onerror() } }, h = function(t, e) { var r = function() { e._emit("loaderror", null, "Decoding audio data failed.") }, n = function(t) { t && 0 < e._sounds.length ? (a[e._src] = t, c(e, t)) : r() }; "undefined" != typeof Promise && 1 === b.ctx.decodeAudioData.length ? b.ctx.decodeAudioData(t).then(n).catch(r) : b.ctx.decodeAudioData(t, n, r) }, c = function(t, e) { e && !t._duration && (t._duration = e.duration), 0 === Object.keys(t._sprite).length && (t._sprite = { __default: [0, 1e3 * t._duration] }), "loaded" !== t._state && (t._state = "loaded", t._emit("load"), t._loadQueue()) }, l = function() { if (b.usingWebAudio) { try { "undefined" != typeof AudioContext ? b.ctx = new AudioContext : "undefined" != typeof webkitAudioContext ? b.ctx = new webkitAudioContext : b.usingWebAudio = !1 } catch (t) { b.usingWebAudio = !1 } b.ctx || (b.usingWebAudio = !1); var t = /iP(hone|od|ad)/.test(b._navigator && b._navigator.platform), e = b._navigator && b._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/), r = e ? parseInt(e[1], 10) : null; if (t && r && r < 9) { var n = /safari/.test(b._navigator && b._navigator.userAgent.toLowerCase()); (b._navigator && b._navigator.standalone && !n || b._navigator && !b._navigator.standalone && !n) && (b.usingWebAudio = !1) } b.usingWebAudio && (b.masterGain = void 0 === b.ctx.createGain ? b.ctx.createGainNode() : b.ctx.createGain(), b.masterGain.gain.setValueAtTime(b._muted ? 0 : 1, b.ctx.currentTime), b.masterGain.connect(b.ctx.destination)), b._setup() } }; void 0 === (n = function() { return { Howler: b, Howl: e } }.apply(f, [])) || (i.exports = n), f.Howler = b, f.Howl = e, "undefined" != typeof window ? (window.HowlerGlobal = t, window.Howler = b, window.Howl = e, window.Sound = o) : void 0 !== r && (r.HowlerGlobal = t, r.Howler = b, r.Howl = e, r.Sound = o) }(), function() { "use strict"; var e, r, n; HowlerGlobal.prototype._pos = [0, 0, 0], HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0], HowlerGlobal.prototype.stereo = function(t) { if (!this.ctx || !this.ctx.listener) return this; for (var e = this._howls.length - 1; 0 <= e; e--) this._howls[e].stereo(t); return this }, HowlerGlobal.prototype.pos = function(t, e, r) { var n = this; return n.ctx && n.ctx.listener ? (e = "number" != typeof e ? n._pos[1] : e, r = "number" != typeof r ? n._pos[2] : r, "number" != typeof t ? n._pos : (n._pos = [t, e, r], void 0 !== n.ctx.listener.positionX ? (n.ctx.listener.positionX.setTargetAtTime(n._pos[0], Howler.ctx.currentTime, .1), n.ctx.listener.positionY.setTargetAtTime(n._pos[1], Howler.ctx.currentTime, .1), n.ctx.listener.positionZ.setTargetAtTime(n._pos[2], Howler.ctx.currentTime, .1)) : n.ctx.listener.setPosition(n._pos[0], n._pos[1], n._pos[2]), n)) : n }, HowlerGlobal.prototype.orientation = function(t, e, r, n, i, o) { var a = this; if (!a.ctx || !a.ctx.listener) return a; var s = a._orientation; return e = "number" != typeof e ? s[1] : e, r = "number" != typeof r ? s[2] : r, n = "number" != typeof n ? s[3] : n, i = "number" != typeof i ? s[4] : i, o = "number" != typeof o ? s[5] : o, "number" != typeof t ? s : (a._orientation = [t, e, r, n, i, o], void 0 !== a.ctx.listener.forwardX ? (a.ctx.listener.forwardX.setTargetAtTime(t, Howler.ctx.currentTime, .1), a.ctx.listener.forwardY.setTargetAtTime(e, Howler.ctx.currentTime, .1), a.ctx.listener.forwardZ.setTargetAtTime(r, Howler.ctx.currentTime, .1), a.ctx.listener.upX.setTargetAtTime(t, Howler.ctx.currentTime, .1), a.ctx.listener.upY.setTargetAtTime(e, Howler.ctx.currentTime, .1), a.ctx.listener.upZ.setTargetAtTime(r, Howler.ctx.currentTime, .1)) : a.ctx.listener.setOrientation(t, e, r, n, i, o), a) }, Howl.prototype.init = (e = Howl.prototype.init, function(t) { return this._orientation = t.orientation || [1, 0, 0], this._stereo = t.stereo || null, this._pos = t.pos || null, this._pannerAttr = { coneInnerAngle: void 0 !== t.coneInnerAngle ? t.coneInnerAngle : 360, coneOuterAngle: void 0 !== t.coneOuterAngle ? t.coneOuterAngle : 360, coneOuterGain: void 0 !== t.coneOuterGain ? t.coneOuterGain : 0, distanceModel: void 0 !== t.distanceModel ? t.distanceModel : "inverse", maxDistance: void 0 !== t.maxDistance ? t.maxDistance : 1e4, panningModel: void 0 !== t.panningModel ? t.panningModel : "HRTF", refDistance: void 0 !== t.refDistance ? t.refDistance : 1, rolloffFactor: void 0 !== t.rolloffFactor ? t.rolloffFactor : 1 }, this._onstereo = t.onstereo ? [{ fn: t.onstereo }] : [], this._onpos = t.onpos ? [{ fn: t.onpos }] : [], this._onorientation = t.onorientation ? [{ fn: t.onorientation }] : [], e.call(this, t) }), Howl.prototype.stereo = function(t, e) { var r = this; if (!r._webAudio) return r; if ("loaded" !== r._state) return r._queue.push({ event: "stereo", action: function() { r.stereo(t, e) } }), r; var n = void 0 === Howler.ctx.createStereoPanner ? "spatial" : "stereo"; if (void 0 === e) { if ("number" != typeof t) return r._stereo; r._stereo = t, r._pos = [t, 0, 0] } for (var i = r._getSoundIds(e), o = 0; o < i.length; o++) { var a = r._soundById(i[o]); if (a) { if ("number" != typeof t) return a._stereo; a._stereo = t, a._pos = [t, 0, 0], a._node && (a._pannerAttr.panningModel = "equalpower", a._panner && a._panner.pan || h(a, n), "spatial" === n ? void 0 !== a._panner.positionX ? (a._panner.positionX.setValueAtTime(t, Howler.ctx.currentTime), a._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime), a._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime)) : a._panner.setPosition(t, 0, 0) : a._panner.pan.setValueAtTime(t, Howler.ctx.currentTime)), r._emit("stereo", a._id) } } return r }, Howl.prototype.pos = function(t, e, r, n) { var i = this; if (!i._webAudio) return i; if ("loaded" !== i._state) return i._queue.push({ event: "pos", action: function() { i.pos(t, e, r, n) } }), i; if (e = "number" != typeof e ? 0 : e, r = "number" != typeof r ? -.5 : r, void 0 === n) { if ("number" != typeof t) return i._pos; i._pos = [t, e, r] } for (var o = i._getSoundIds(n), a = 0; a < o.length; a++) { var s = i._soundById(o[a]); if (s) { if ("number" != typeof t) return s._pos; s._pos = [t, e, r], s._node && (s._panner && !s._panner.pan || h(s, "spatial"), void 0 !== s._panner.positionX ? (s._panner.positionX.setValueAtTime(t, Howler.ctx.currentTime), s._panner.positionY.setValueAtTime(e, Howler.ctx.currentTime), s._panner.positionZ.setValueAtTime(r, Howler.ctx.currentTime)) : s._panner.setPosition(t, e, r)), i._emit("pos", s._id) } } return i }, Howl.prototype.orientation = function(t, e, r, n) { var i = this; if (!i._webAudio) return i; if ("loaded" !== i._state) return i._queue.push({ event: "orientation", action: function() { i.orientation(t, e, r, n) } }), i; if (e = "number" != typeof e ? i._orientation[1] : e, r = "number" != typeof r ? i._orientation[2] : r, void 0 === n) { if ("number" != typeof t) return i._orientation; i._orientation = [t, e, r] } for (var o = i._getSoundIds(n), a = 0; a < o.length; a++) { var s = i._soundById(o[a]); if (s) { if ("number" != typeof t) return s._orientation; s._orientation = [t, e, r], s._node && (s._panner || (s._pos || (s._pos = i._pos || [0, 0, -.5]), h(s, "spatial")), void 0 !== s._panner.orientationX ? (s._panner.orientationX.setValueAtTime(t, Howler.ctx.currentTime), s._panner.orientationY.setValueAtTime(e, Howler.ctx.currentTime), s._panner.orientationZ.setValueAtTime(r, Howler.ctx.currentTime)) : s._panner.setOrientation(t, e, r)), i._emit("orientation", s._id) } } return i }, Howl.prototype.pannerAttr = function() { var t, e, r, n = this, i = arguments; if (!n._webAudio) return n; if (0 === i.length) return n._pannerAttr; if (1 === i.length) { if ("object" != typeof i[0]) return (r = n._soundById(parseInt(i[0], 10))) ? r._pannerAttr : n._pannerAttr; t = i[0], void 0 === e && (t.pannerAttr || (t.pannerAttr = { coneInnerAngle: t.coneInnerAngle, coneOuterAngle: t.coneOuterAngle, coneOuterGain: t.coneOuterGain, distanceModel: t.distanceModel, maxDistance: t.maxDistance, refDistance: t.refDistance, rolloffFactor: t.rolloffFactor, panningModel: t.panningModel }), n._pannerAttr = { coneInnerAngle: void 0 !== t.pannerAttr.coneInnerAngle ? t.pannerAttr.coneInnerAngle : n._coneInnerAngle, coneOuterAngle: void 0 !== t.pannerAttr.coneOuterAngle ? t.pannerAttr.coneOuterAngle : n._coneOuterAngle, coneOuterGain: void 0 !== t.pannerAttr.coneOuterGain ? t.pannerAttr.coneOuterGain : n._coneOuterGain, distanceModel: void 0 !== t.pannerAttr.distanceModel ? t.pannerAttr.distanceModel : n._distanceModel, maxDistance: void 0 !== t.pannerAttr.maxDistance ? t.pannerAttr.maxDistance : n._maxDistance, refDistance: void 0 !== t.pannerAttr.refDistance ? t.pannerAttr.refDistance : n._refDistance, rolloffFactor: void 0 !== t.pannerAttr.rolloffFactor ? t.pannerAttr.rolloffFactor : n._rolloffFactor, panningModel: void 0 !== t.pannerAttr.panningModel ? t.pannerAttr.panningModel : n._panningModel }) } else 2 === i.length && (t = i[0], e = parseInt(i[1], 10)); for (var o = n._getSoundIds(e), a = 0; a < o.length; a++) if (r = n._soundById(o[a])) { var s = r._pannerAttr; s = { coneInnerAngle: void 0 !== t.coneInnerAngle ? t.coneInnerAngle : s.coneInnerAngle, coneOuterAngle: void 0 !== t.coneOuterAngle ? t.coneOuterAngle : s.coneOuterAngle, coneOuterGain: void 0 !== t.coneOuterGain ? t.coneOuterGain : s.coneOuterGain, distanceModel: void 0 !== t.distanceModel ? t.distanceModel : s.distanceModel, maxDistance: void 0 !== t.maxDistance ? t.maxDistance : s.maxDistance, refDistance: void 0 !== t.refDistance ? t.refDistance : s.refDistance, rolloffFactor: void 0 !== t.rolloffFactor ? t.rolloffFactor : s.rolloffFactor, panningModel: void 0 !== t.panningModel ? t.panningModel : s.panningModel }; var u = r._panner; u ? (u.coneInnerAngle = s.coneInnerAngle, u.coneOuterAngle = s.coneOuterAngle, u.coneOuterGain = s.coneOuterGain, u.distanceModel = s.distanceModel, u.maxDistance = s.maxDistance, u.refDistance = s.refDistance, u.rolloffFactor = s.rolloffFactor, u.panningModel = s.panningModel) : (r._pos || (r._pos = n._pos || [0, 0, -.5]), h(r, "spatial")) } return n }, Sound.prototype.init = (r = Sound.prototype.init, function() { var t = this, e = t._parent; t._orientation = e._orientation, t._stereo = e._stereo, t._pos = e._pos, t._pannerAttr = e._pannerAttr, r.call(this), t._stereo ? e.stereo(t._stereo) : t._pos && e.pos(t._pos[0], t._pos[1], t._pos[2], t._id) }), Sound.prototype.reset = (n = Sound.prototype.reset, function() { var t = this, e = t._parent; return t._orientation = e._orientation, t._stereo = e._stereo, t._pos = e._pos, t._pannerAttr = e._pannerAttr, t._stereo ? e.stereo(t._stereo) : t._pos ? e.pos(t._pos[0], t._pos[1], t._pos[2], t._id) : t._panner && (t._panner.disconnect(0), t._panner = void 0, e._refreshBuffer(t)), n.call(this) }); var h = function(t, e) { "spatial" === (e = e || "spatial") ? (t._panner = Howler.ctx.createPanner(), t._panner.coneInnerAngle = t._pannerAttr.coneInnerAngle, t._panner.coneOuterAngle = t._pannerAttr.coneOuterAngle, t._panner.coneOuterGain = t._pannerAttr.coneOuterGain, t._panner.distanceModel = t._pannerAttr.distanceModel, t._panner.maxDistance = t._pannerAttr.maxDistance, t._panner.refDistance = t._pannerAttr.refDistance, t._panner.rolloffFactor = t._pannerAttr.rolloffFactor, t._panner.panningModel = t._pannerAttr.panningModel, void 0 !== t._panner.positionX ? (t._panner.positionX.setValueAtTime(t._pos[0], Howler.ctx.currentTime), t._panner.positionY.setValueAtTime(t._pos[1], Howler.ctx.currentTime), t._panner.positionZ.setValueAtTime(t._pos[2], Howler.ctx.currentTime)) : t._panner.setPosition(t._pos[0], t._pos[1], t._pos[2]), void 0 !== t._panner.orientationX ? (t._panner.orientationX.setValueAtTime(t._orientation[0], Howler.ctx.currentTime), t._panner.orientationY.setValueAtTime(t._orientation[1], Howler.ctx.currentTime), t._panner.orientationZ.setValueAtTime(t._orientation[2], Howler.ctx.currentTime)) : t._panner.setOrientation(t._orientation[0], t._orientation[1], t._orientation[2])) : (t._panner = Howler.ctx.createStereoPanner(), t._panner.pan.setValueAtTime(t._stereo, Howler.ctx.currentTime)), t._panner.connect(t._node), t._paused || t._parent.pause(t._id, !0).play(t._id, !0) } }() }).call(this, t(42)) }, function(t, e) { t.exports = function(t) { if ("function" != typeof t) throw TypeError(t + " is not a function!"); return t } }, function(t, e, r) { var n = r(20), i = r(51); t.exports = r(19) ? function(t, e, r) { return n.f(t, e, i(1, r)) } : function(t, e, r) { return t[e] = r, t } }, function(t, e, r) { var o = r(9), a = r(25), s = r(28), u = r(52)("src"), n = "toString", i = Function[n], h = ("" + i).split(n); r(32).inspectSource = function(t) { return i.call(t) }, (t.exports = function(t, e, r, n) { var i = "function" == typeof r; i && (s(r, "name") || a(r, "name", e)), t[e] !== r && (i && (s(r, u) || a(r, u, t[e] ? "" + t[e] : h.join(String(e)))), t === o ? t[e] = r : n ? t[e] ? t[e] = r : a(t, e, r) : (delete t[e], a(t, e, r))) })(Function.prototype, n, function() { return "function" == typeof this && this[u] || i.call(this) }) }, function(t, e, r) { var n = r(1), i = r(10), a = r(39), s = /"/g, o = function(t, e, r, n) { var i = String(a(t)), o = "<" + e; return "" !== r && (o += " " + r + '="' + String(n).replace(s, """) + '"'), o + ">" + i + "" }; t.exports = function(e, t) { var r = {}; r[e] = t(o), n(n.P + n.F * i(function() { var t = "" [e]('"'); return t !== t.toLowerCase() || 3 < t.split('"').length }), "String", r) } }, function(t, e) { var r = {}.hasOwnProperty; t.exports = function(t, e) { return r.call(t, e) } }, function(t, e, r) { var n = r(69), i = r(39); t.exports = function(t) { return n(i(t)) } }, function(t, e, r) { var n = r(70), i = r(51), o = r(29), a = r(38), s = r(28), u = r(134), h = Object.getOwnPropertyDescriptor; e.f = r(19) ? h : function(t, e) { if (t = o(t), e = a(e, !0), u) try { return h(t, e) } catch (t) {} if (s(t, e)) return i(!n.f.call(t, e), t[e]) } }, function(t, e, r) { var n = r(28), i = r(22), o = r(100)("IE_PROTO"), a = Object.prototype; t.exports = Object.getPrototypeOf || function(t) { return t = i(t), n(t, o) ? t[o] : "function" == typeof t.constructor && t instanceof t.constructor ? t.constructor.prototype : t instanceof Object ? a : null } }, function(t, e) { var r = t.exports = { version: "2.6.3" }; "number" == typeof __e && (__e = r) }, function(t, e, r) { var o = r(24); t.exports = function(n, i, t) { if (o(n), void 0 === i) return n; switch (t) { case 1: return function(t) { return n.call(i, t) }; case 2: return function(t, e) { return n.call(i, t, e) }; case 3: return function(t, e, r) { return n.call(i, t, e, r) } } return function() { return n.apply(i, arguments) } } }, function(t, e) { var r = {}.toString; t.exports = function(t) { return r.call(t).slice(8, -1) } }, function(t, e) { var r = Math.ceil, n = Math.floor; t.exports = function(t) { return isNaN(t = +t) ? 0 : (0 < t ? n : r)(t) } }, function(t, e, r) { "use strict"; var n = r(10); t.exports = function(t, e) { return !!t && n(function() { e ? t.call(null, function() {}, 1) : t.call(null) }) } }, function(t, e, r) { "use strict"; e.__esModule = !0; var n = function() { function defineProperties(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function(t, e, r) { return e && defineProperties(t.prototype, e), r && defineProperties(t, r), t } }(), u = function(t) { { if (t && t.__esModule) return t; var e = {}; if (null != t) for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e } }(r(0)), h = r(4); function filterEmptyLine(t) { return "" !== t } var c = { uniformData: { id: -1 } }, l = 0, i = {}, f = {}, o = function(s) { function BaseMaterial() { var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, e = arguments[1], r = arguments[2], n = arguments[3], i = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : "base"; ! function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, BaseMaterial); var o = { uShininess: t.shininess || 32, uOpacity: void 0 === t.opacity ? 1 : t.opacity, uSpecular: new Float32Array([0, 0, 0]), uColor: new Float32Array([1, 1, 1]), normal: h.mat3.create() }, a = function(t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, s.call(this, c, o)); return a.type = i, a.name = t.name || a.type + "-shader", a.options = {}, a.needsUpdate = !0, a.id = l++, a.skinning = !!t.skinning, a.skinning && (o.bones = new Float32Array(960)), a.specularColor = t.specular || 0, a.color = t.color || 16777215, a.instancing = !!t.instancing, a.emissive = !1, a.instancing && (a.name += "-instanced"), t.uniforms && Object.assign(o, t.uniforms), t.map && (o.uMap = t.map, o.uMapFrame = new u.Rectangle(0, 0, 1, 1)), t.enviromentMap && (o.uEnviromentMap = t.enviromentMap), t.shininessMap && (o.uShininessMap = t.shininessMap), t.occlusionMap && (o.uOcclusionMap = t.occlusionMap), a.emissive = !!(t.emissive || t.emissiveColor || t.emissiveMap), a.emissive && (void 0 !== t.emissive && (o.uEmissive = t.emissive), t.emissiveColor && (o.uEmissiveColor = new Float32Array([1, 1, 1]), a.emissiveColor = t.emissiveColor), t.emissiveMap && (o.uEmissiveMap = t.emissiveMap)), a.vertexSource = e, a.fragmentSource = r, a.fragmentInjection = t.fragment || {}, a.vertexInjection = t.vertex || {}, a.sig = a.getSignature(t), a.program = c, a.rebuildId = 0, a.defines = n || [], a } return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(BaseMaterial, s), BaseMaterial.prototype.injectLights = function(t, e) { var r = f[e.sig]; if (!r) { var n = [], i = []; e.lights.forEach(function(t) { var e = t.light._lightId; 0 === t.light.type ? (n.push("uniform vec3 uLightColor" + e + ";"), n.push("uniform vec3 uLightDirection" + e + ";"), i.push("\n\n attenuation = 1.;\n\n attenuation *= diffuseLighting(worldNormal,uLightDirection" + e + ");\n\n lighting += attenuation * uLightColor" + e + ";\n \n attenuation *= specularLighting(worldNormal, eyeToSurfaceDir,uLightDirection" + e + ");\n\n specular += attenuation * uSpecular * uLightColor" + e + ";\n \n ")) : 1 === t.light.type ? (n.push("uniform vec3 uLightColor" + e + ";"), n.push("uniform vec3 uLightDirection" + e + ";"), n.push("uniform vec3 uLightPosition" + e + ";"), n.push("uniform float uLightDistance" + e + ";"), i.push("\n \n lightDirection = vPosition - uLightPosition" + e + ";\n \n lightDirectionNormal = normalize(lightDirection);\n \n distancFromLight = length(lightDirection);\n \n attenuation = pow( saturate(-distancFromLight / uLightDistance" + e + " + 1.0) , 1. );\n \n if(attenuation > 0.0001)\n {\n attenuation *= diffuseLighting(worldNormal,lightDirectionNormal);\n\n lighting += attenuation * uLightColor" + e + ";\n \n attenuation *= specularLighting(worldNormal,eyeToSurfaceDir,lightDirectionNormal);\n\n specular += attenuation * uSpecular * uLightColor" + e + ";\n \n }")) : 2 === t.light.type && (n.push("uniform vec3 uLightColor" + e + ";"), n.push("uniform vec3 uLightDirection" + e + ";"), n.push("uniform vec3 uLightPosition" + e + ";"), n.push("uniform float uLightDistance" + e + ";"), i.push("\n \n lightDirection = uLightPosition" + e + " - vPosition;\n float dist = length(lightDirection);\n \n L = normalize(lightDirection);\n\n float attenuation = pow( saturate(-dist / uLightDistance" + e + " + 1.0) , 1. );\n \n float dotFromDirection = dot(L, -uLightDirection" + e + ");\n \n float limit = cos(30. * (3.14/180.) );\n\n if(dotFromDirection >= 0.000001)\n {\n if(attenuation > 0.001)\n {\n lighting += diffuseLighting(N,L,uLightColor" + e + ") * attenuation;\n lighting += specularLighting(N,L,V) * attenuation;\n lighting *= reflection;\n \n }\n }")) }), f[e.sig] = r = { uniforms: n.join("\n"), code: i.join("\n") } } var o = t.fragment, a = t.vertex; o = (o = o.replace(/#HOOK_LIGHT_UNIFROMS/g, r.uniforms)).replace(/#HOOK_LIGHT/g, r.code), a = (a = a.replace(/#HOOK_LIGHT_UNIFROMS/g, r.uniforms)).replace(/#HOOK_LIGHT/g, r.code), t.fragment = o, t.vertex = a }, BaseMaterial.prototype.injectDefines = function(t, e) { var r = this.uniforms, n = [r.uColor ? "#define COLOR" : "", this.skinning ? "#define SKINNING" : "", r.uMap ? "#define MAP" : "", r.uOcclusionMap ? "#define OCCLUSION_MAP" : "", r.uShininess ? "#define SHININESS_FLOAT" : "", r.uShininessMap ? "#define SHININESS_MAP" : "", this.emissive ? "#define EMISSIVE" : "", void 0 !== r.uEmissive ? "#define EMISSIVE_FLOAT" : "", r.uEmissiveColor ? "#define EMISSIVE_COLOR" : "", r.uEmissiveMap ? "#define EMISSIVE_MAP" : "", r.uEnviromentMap ? "#define ENV_REFLECT" : "", this.instancing ? "#define INSTANCING" : "", e ? "#define FOG" : ""].concat(this.defines).filter(filterEmptyLine).join("\n"); t.vertex = n + "\n" + t.vertex, t.fragment = n + "\n" + t.fragment }, BaseMaterial.prototype.injectHooks = function(t) { var e = this.vertexInjection, r = t.vertex; r = (r = (r = r.replace(/#HOOK_VERTEX_START/g, e.start || "")).replace(/#HOOK_VERTEX_MAIN/g, e.main || "")).replace(/#HOOK_VERTEX_END/g, e.end || ""); var n = this.fragmentInjection, i = t.fragment; i = (i = (i = i.replace(/#HOOK_FRAGMENT_START/g, n.start || "")).replace(/#HOOK_FRAGMENT_MAIN/g, n.main || "")).replace(/#HOOK_FRAGMENT_END/g, n.end || ""), t.fragment = i, t.vertex = r }, BaseMaterial.prototype.build = function(t, e) { if (i[this.sig + t.sig]) this.program = i[this.sig + t.sig]; else { var r = { vertex: this.vertexSource, fragment: this.fragmentSource }; this.injectDefines(r, e), this.injectHooks(r), this.injectLights(r, t), this.program = u.Program.from(r.vertex, r.fragment, this.name), i[this.sig + t.sig] = this.program } }, BaseMaterial.prototype.getSignature = function(t) { var e = [this.type]; for (var r in t) e.push(r); return e.sort(), t.vertex && e.push(t.vertex.start || "", t.vertex.main || "", t.vertex.end || ""), t.fragment && e.push(t.fragment.start || "", t.fragment.main || "", t.fragment.end || ""), e.join("-") }, n(BaseMaterial, [{ key: "opacity", set: function(t) { this.uniforms.uOpacity = t }, get: function() { return this.uniforms.uOpacity } }, { key: "map", set: function(t) { this.uniforms.uMap = t }, get: function() { return this.uniforms.uMap } }, { key: "occlusionMap", set: function(t) { this.uniforms.uOcclusionMap = t }, get: function() { return this.uniforms.uOcclusionMap } }, { key: "shininessMap", set: function(t) { this.uniforms.uShininessMap = t }, get: function() { return this.uniforms.uShininessMap } }, { key: "shininess", set: function(t) { this.uniforms.uShininess = t }, get: function() { return this.uniforms.uShininess } }, { key: "emissive", set: function(t) { this.uniforms.uEmissive = t }, get: function() { return this.uniforms.uEmissive } }, { key: "emissiveMap", set: function(t) { this.uniforms.uEmissiveMap = t }, get: function() { return this.uniforms.uEmissiveMap } }, { key: "enviromentMap", set: function(t) { this.uniforms.uEnviromentMap = t }, get: function() { return this.uniforms.uEnviromentMap } }, { key: "emissiveColor", set: function(t) { this._hexEmissiveColor = t, u.utils.hex2rgb(t, this.uniforms.uEmissiveColor) }, get: function() { return this._hexEmissiveColor } }, { key: "color", set: function(t) { this._hexColor = t, u.utils.hex2rgb(t, this.uniforms.uColor) }, get: function() { return this._hexColor } }, { key: "specularColor", set: function(t) { this._hexSpecularColor = t, u.utils.hex2rgb(t, this.uniforms.uSpecular) }, get: function() { return this._hexSpecularColor } }]), BaseMaterial }(u.Shader); e.default = o }, function(t, e, r) { var i = r(11); t.exports = function(t, e) { if (!i(t)) return t; var r, n; if (e && "function" == typeof(r = t.toString) && !i(n = r.call(t))) return n; if ("function" == typeof(r = t.valueOf) && !i(n = r.call(t))) return n; if (!e && "function" == typeof(r = t.toString) && !i(n = r.call(t))) return n; throw TypeError("Can't convert object to primitive value") } }, function(t, e) { t.exports = function(t) { if (null == t) throw TypeError("Can't call method on " + t); return t } }, function(t, e, r) { var i = r(1), o = r(32), a = r(10); t.exports = function(t, e) { var r = (o.Object || {})[t] || Object[t], n = {}; n[t] = e(r), i(i.S + i.F * a(function() { r(1) }), "Object", n) } }, function(t, e, r) { var _ = r(33), b = r(69), x = r(22), w = r(17), n = r(116); t.exports = function(l, t) { var f = 1 == l, d = 2 == l, p = 3 == l, m = 4 == l, v = 6 == l, g = 5 == l || v, y = t || n; return function(t, e, r) { for (var n, i, o = x(t), a = b(o), s = _(e, r, 3), u = w(a.length), h = 0, c = f ? y(t, u) : d ? y(t, 0) : void 0; h < u; h++) if ((g || h in a) && (i = s(n = a[h], h, o), l)) if (f) c[h] = i; else if (i) switch (l) { case 3: return !0; case 5: return n; case 6: return h; case 2: c.push(n) } else if (m) return !1; return v ? -1 : p || m ? m : c } } }, function(t, e) { var r; r = function() { return this }(); try { r = r || new Function("return this")() } catch (t) { "object" == typeof window && (r = window) } t.exports = r }, function(t, e, r) { "use strict"; if (r(19)) { var g = r(49), y = r(9), _ = r(10), b = r(1), x = r(85), n = r(124), f = r(33), w = r(58), i = r(51), T = r(25), o = r(60), a = r(35), S = r(17), M = r(162), s = r(54), u = r(38), h = r(28), E = r(62), A = r(11), d = r(22), p = r(113), P = r(55), I = r(31), O = r(56).f, m = r(115), c = r(52), l = r(15), v = r(41), C = r(75), R = r(72), D = r(118), F = r(64), k = r(80), L = r(57), N = r(117), B = r(151), U = r(20), G = r(30), j = U.f, z = G.f, X = y.RangeError, V = y.TypeError, q = y.Uint8Array, H = "ArrayBuffer", W = "Shared" + H, Y = "BYTES_PER_ELEMENT", K = "prototype", Z = Array[K], Q = n.ArrayBuffer, J = n.DataView, $ = v(0), tt = v(2), et = v(3), rt = v(4), nt = v(5), it = v(6), ot = C(!0), at = C(!1), st = D.values, ut = D.keys, ht = D.entries, ct = Z.lastIndexOf, lt = Z.reduce, ft = Z.reduceRight, dt = Z.join, pt = Z.sort, mt = Z.slice, vt = Z.toString, gt = Z.toLocaleString, yt = l("iterator"), _t = l("toStringTag"), bt = c("typed_constructor"), xt = c("def_constructor"), wt = x.CONSTR, Tt = x.TYPED, St = x.VIEW, Mt = "Wrong length!", Et = v(1, function(t, e) { return Ct(R(t, t[xt]), e) }), At = _(function() { return 1 === new q(new Uint16Array([1]).buffer)[0] }), Pt = !!q && !!q[K].set && _(function() { new q(1).set({}) }), It = function(t, e) { var r = a(t); if (r < 0 || r % e) throw X("Wrong offset!"); return r }, Ot = function(t) { if (A(t) && Tt in t) return t; throw V(t + " is not a typed array!") }, Ct = function(t, e) { if (!(A(t) && bt in t)) throw V("It is not a typed array constructor!"); return new t(e) }, Rt = function(t, e) { return Dt(R(t, t[xt]), e) }, Dt = function(t, e) { for (var r = 0, n = e.length, i = Ct(t, n); r < n;) i[r] = e[r++]; return i }, Ft = function(t, e, r) { j(t, e, { get: function() { return this._d[r] } }) }, kt = function(t) { var e, r, n, i, o, a, s = d(t), u = arguments.length, h = 1 < u ? arguments[1] : void 0, c = void 0 !== h, l = m(s); if (null != l && !p(l)) { for (a = l.call(s), n = [], e = 0; !(o = a.next()).done; e++) n.push(o.value); s = n } for (c && 2 < u && (h = f(h, arguments[2], 2)), e = 0, r = S(s.length), i = Ct(this, r); e < r; e++) i[e] = c ? h(s[e], e) : s[e]; return i }, Lt = function() { for (var t = 0, e = arguments.length, r = Ct(this, e); t < e;) r[t] = arguments[t++]; return r }, Nt = !!q && _(function() { gt.call(new q(1)) }), Bt = function() { return gt.apply(Nt ? mt.call(Ot(this)) : Ot(this), arguments) }, Ut = { copyWithin: function(t, e) { return B.call(Ot(this), t, e, 2 < arguments.length ? arguments[2] : void 0) }, every: function(t) { return rt(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, fill: function(t) { return N.apply(Ot(this), arguments) }, filter: function(t) { return Rt(this, tt(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0)) }, find: function(t) { return nt(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, findIndex: function(t) { return it(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, forEach: function(t) { $(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, indexOf: function(t) { return at(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, includes: function(t) { return ot(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, join: function(t) { return dt.apply(Ot(this), arguments) }, lastIndexOf: function(t) { return ct.apply(Ot(this), arguments) }, map: function(t) { return Et(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, reduce: function(t) { return lt.apply(Ot(this), arguments) }, reduceRight: function(t) { return ft.apply(Ot(this), arguments) }, reverse: function() { for (var t, e = Ot(this).length, r = Math.floor(e / 2), n = 0; n < r;) t = this[n], this[n++] = this[--e], this[e] = t; return this }, some: function(t) { return et(Ot(this), t, 1 < arguments.length ? arguments[1] : void 0) }, sort: function(t) { return pt.call(Ot(this), t) }, subarray: function(t, e) { var r = Ot(this), n = r.length, i = s(t, n); return new(R(r, r[xt]))(r.buffer, r.byteOffset + i * r.BYTES_PER_ELEMENT, S((void 0 === e ? n : s(e, n)) - i)) } }, Gt = function(t, e) { return Rt(this, mt.call(Ot(this), t, e)) }, jt = function(t) { Ot(this); var e = It(arguments[1], 1), r = this.length, n = d(t), i = S(n.length), o = 0; if (r < i + e) throw X(Mt); for (; o < i;) this[e + o] = n[o++] }, zt = { entries: function() { return ht.call(Ot(this)) }, keys: function() { return ut.call(Ot(this)) }, values: function() { return st.call(Ot(this)) } }, Xt = function(t, e) { return A(t) && t[Tt] && "symbol" != typeof e && e in t && String(+e) == String(e) }, Vt = function(t, e) { return Xt(t, e = u(e, !0)) ? i(2, t[e]) : z(t, e) }, qt = function(t, e, r) { return !(Xt(t, e = u(e, !0)) && A(r) && h(r, "value")) || h(r, "get") || h(r, "set") || r.configurable || h(r, "writable") && !r.writable || h(r, "enumerable") && !r.enumerable ? j(t, e, r) : (t[e] = r.value, t) }; wt || (G.f = Vt, U.f = qt), b(b.S + b.F * !wt, "Object", { getOwnPropertyDescriptor: Vt, defineProperty: qt }), _(function() { vt.call({}) }) && (vt = gt = function() { return dt.call(this) }); var Ht = o({}, Ut); o(Ht, zt), T(Ht, yt, zt.values), o(Ht, { slice: Gt, set: jt, constructor: function() {}, toString: vt, toLocaleString: Bt }), Ft(Ht, "buffer", "b"), Ft(Ht, "byteOffset", "o"), Ft(Ht, "byteLength", "l"), Ft(Ht, "length", "e"), j(Ht, _t, { get: function() { return this[Tt] } }), t.exports = function(t, l, e, o) { var f = t + ((o = !!o) ? "Clamped" : "") + "Array", r = "get" + t, a = "set" + t, d = y[f], s = d || {}, n = d && I(d), i = !d || !x.ABV, u = {}, h = d && d[K], p = function(t, i) { j(t, i, { get: function() { return t = i, (e = this._d).v[r](t * l + e.o, At); var t, e }, set: function(t) { return e = i, r = t, n = this._d, o && (r = (r = Math.round(r)) < 0 ? 0 : 255 < r ? 255 : 255 & r), void n.v[a](e * l + n.o, r, At); var e, r, n }, enumerable: !0 }) }; i ? (d = e(function(t, e, r, n) { w(t, d, f, "_d"); var i, o, a, s, u = 0, h = 0; if (A(e)) { if (!(e instanceof Q || (s = E(e)) == H || s == W)) return Tt in e ? Dt(d, e) : kt.call(d, e); i = e, h = It(r, l); var c = e.byteLength; if (void 0 === n) { if (c % l) throw X(Mt); if ((o = c - h) < 0) throw X(Mt) } else if (c < (o = S(n) * l) + h) throw X(Mt); a = o / l } else a = M(e), i = new Q(o = a * l); for (T(t, "_d", { b: i, o: h, l: o, e: a, v: new J(i) }); u < a;) p(t, u++) }), h = d[K] = P(Ht), T(h, "constructor", d)) : _(function() { d(1) }) && _(function() { new d(-1) }) && k(function(t) { new d, new d(null), new d(1.5), new d(t) }, !0) || (d = e(function(t, e, r, n) { var i; return w(t, d, f), A(e) ? e instanceof Q || (i = E(e)) == H || i == W ? void 0 !== n ? new s(e, It(r, l), n) : void 0 !== r ? new s(e, It(r, l)) : new s(e) : Tt in e ? Dt(d, e) : kt.call(d, e) : new s(M(e)) }), $(n !== Function.prototype ? O(s).concat(O(n)) : O(s), function(t) { t in d || T(d, t, s[t]) }), d[K] = h, g || (h.constructor = d)); var c = h[yt], m = !!c && ("values" == c.name || null == c.name), v = zt.values; T(d, bt, !0), T(h, Tt, f), T(h, St, !0), T(h, xt, d), (o ? new d(1)[_t] == f : _t in h) || j(h, _t, { get: function() { return f } }), u[f] = d, b(b.G + b.W + b.F * (d != s), u), b(b.S, f, { BYTES_PER_ELEMENT: l }), b(b.S + b.F * _(function() { s.of.call(d, 1) }), f, { from: kt, of: Lt }), Y in h || T(h, Y, l), b(b.P, f, Ut), L(f), b(b.P + b.F * Pt, f, { set: jt }), b(b.P + b.F * !m, f, zt), g || h.toString == vt || (h.toString = vt), b(b.P + b.F * _(function() { new d(1).slice() }), f, { slice: Gt }), b(b.P + b.F * (_(function() { return [1, 2].toLocaleString() != new d([1, 2]).toLocaleString() }) || !_(function() { h.toLocaleString.call([1, 2]) })), f, { toLocaleString: Bt }), F[f] = m ? c : v, g || m || T(h, yt, v) } } else t.exports = function() {} }, function(t, e, r) { var o = r(157), n = r(1), i = r(74)("metadata"), a = i.store || (i.store = new(r(160))), s = function(t, e, r) { var n = a.get(t); if (!n) { if (!r) return; a.set(t, n = new o) } var i = n.get(e); if (!i) { if (!r) return; n.set(e, i = new o) } return i }; t.exports = { store: a, map: s, has: function(t, e, r) { var n = s(e, r, !1); return void 0 !== n && n.has(t) }, get: function(t, e, r) { var n = s(e, r, !1); return void 0 === n ? void 0 : n.get(t) }, set: function(t, e, r, n) { s(r, n, !0).set(t, e) }, keys: function(t, e) { var r = s(t, e, !1), n = []; return r && r.forEach(function(t, e) { n.push(e) }), n }, key: function(t) { return void 0 === t || "symbol" == typeof t ? t : String(t) }, exp: function(t) { n(n.S, "Reflect", t) } } }, function(t, e, r) { "use strict"; e.__esModule = !0; ! function(t) { { if (t && t.__esModule) return; var e = {}; if (null != t) for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); e.default = t } }(r(0)); var n = _interopRequireDefault(r(37)), i = _interopRequireDefault(r(428)), o = _interopRequireDefault(r(429)); function _interopRequireDefault(t) { return t && t.__esModule ? t : { default: t } } var a = function(e) { function PhongMaterial() { var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return function(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, PhongMaterial), function(t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, e.call(this, t, i.default, o.default, [], "phong")) } return function(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(PhongMaterial, e), PhongMaterial }(n.default); e.default = a }, function(e, r, t) { var n, b, x; ! function(t) { var o = /iPhone/i, a = /iPod/i, s = /iPad/i, u = /\bAndroid(?:.+)Mobile\b/i, h = /Android/i, c = /\bAndroid(?:.+)SD4930UR\b/i, l = /\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i, f = /Windows Phone/i, d = /\bWindows(?:.+)ARM\b/i, p = /BlackBerry/i, v = /BB10/i, g = /Opera Mini/i, y = /\b(CriOS|Chrome)(?:.+)Mobile/i, _ = /\Mobile(?:.+)Firefox\b/i; function m(t, e) { return t.test(e) } function i(t) { var e = t || ("undefined" != typeof navigator ? navigator.userAgent : ""), r = e.split("[FBAN"); void 0 !== r[1] && (e = r[0]), void 0 !== (r = e.split("Twitter"))[1] && (e = r[0]); var n = { apple: { phone: m(o, e) && !m(f, e), ipod: m(a, e), tablet: !m(o, e) && m(s, e) && !m(f, e), device: (m(o, e) || m(a, e) || m(s, e)) && !m(f, e) }, amazon: { phone: m(c, e), tablet: !m(c, e) && m(l, e), device: m(c, e) || m(l, e) }, android: { phone: !m(f, e) && m(c, e) || !m(f, e) && m(u, e), tablet: !m(f, e) && !m(c, e) && !m(u, e) && (m(l, e) || m(h, e)), device: !m(f, e) && (m(c, e) || m(l, e) || m(u, e) || m(h, e)) }, windows: { phone: m(f, e), tablet: m(d, e), device: m(f, e) || m(d, e) }, other: { blackberry: m(p, e), blackberry10: m(v, e), opera: m(g, e), firefox: m(_, e), chrome: m(y, e), device: m(p, e) || m(v, e) || m(g, e) || m(_, e) || m(y, e) } }; return n.any = n.apple.device || n.android.device || n.windows.device || n.other.device, n.phone = n.apple.phone || n.android.phone || n.windows.phone, n.tablet = n.apple.tablet || n.android.tablet || n.windows.tablet, n } e.exports && "undefined" == typeof window ? e.exports = i : e.exports && "undefined" != typeof window ? e.exports = i() : (b = [], n = t.isMobile = i(), void 0 === (x = "function" == typeof n ? n.apply(r, b) : n) || (e.exports = x)) }(this) }, function(t, e, r) { "use strict"; var n = r(12), i = r.n(n), o = r(68), c = r(23), a = function() { function SoundManagerHowler() { this.disabled = !1, (window.smm = this).preload = !0, this.currentSound = null, this.sounds = {}, this.groups = {}, this.globalVolume = 1, this.isMuted = !1, this._visibilityActive = !0, this.preload = !0, window.onfocus = this._onFocus.bind(this), this.onMuteToggle = new i.a, o.a.onHide.add(function() { this.onVisibilityHide() }.bind(this)), o.a.onShow.add(function() { this.onVisibilityShow() }.bind(this)) } var t = SoundManagerHowler.prototype; return t.enableVisibility = function() { this._visibilityActive = !0 }, t.disableVisibility = function() { this._visibilityActive = !1 }, t.onVisibilityHide = function() { this._visibilityActive && (c.Howler.mute(!0), c.Howler.volume(0)) }, t.onVisibilityShow = function() { this._visibilityActive && this._onFocus() }, t._onFocus = function() { this.isMuted ? this.mute() : this.unmute() }, t.addSound = function(t, e, r) { if (!this.disabled) { for (var n, i = "", o = 1, a = null, s = 0; s < e.length; s++) "/" === e[s] && (a = s); for (null !== a && (i = e.slice(a + 1, e.length)), e = i; this.exists(i);) i = e + "-" + o, o++; r = r || {}; var u = t.split(".").pop(); n = "ogg" === u || "mp3" === u || "wav" === u ? [t] : [t + ".ogg", t + ".mp3"]; var h = new c.Howl({ src: n, preload: this.preload, autoplay: r.autoplay || !1, loop: r.loop || !1, volume: r.volume }); r.autoplay && (this.preload || h.load(), h.play()), h.realVolume = r.volume || 1, this.sounds[i] = h } }, t.addSounds = function(t, e) { for (var r = 0; r < t.length; r++) { var n = t[r]; this.addSound(e + n, n) } }, t.addGroup = function(t, e) { if (!this.disabled && !this.groups[e]) { var r = { index: 0, type: 0, sounds: t }; this.groups[e] = r } }, t.getSoundByAlias = function(t) { return this.sounds[t] }, t.getSound = function(t) { return this.currentSound }, t.exists = function(t) { return this.sounds[t] }, t.play = function(t, e) { if (void 0 === e && (e = {}), !this.disabled && this.sounds[t]) return e.volume && (this.sounds[t].volume = e.volume * this.globalVolume), e.time && (this.sounds[t].currentTime = e.time), this.preload || this.sounds[t].load(), this.sounds[t].play(), this.currentSound = this.sounds[t], this.currentSound; this.sounds[t] }, t.fadeTo = function(t, e, r) { if (void 0 === r && (r = 2.5), void 0 !== e) { var n = this.sounds[t]; n && TweenLite.to(n, r, { _volume: e, onUpdate: this.actuallyChangeVolume.bind(this), onComplete: this.stopAndReset.bind(this), onCompleteParams: [t], onUpdateParams: ["{self}", t] }) } }, t.actuallyChangeVolume = function(t, e) { this.setVolume(e, t.target._volume) }, t.setVolume = function(t, e) { if (!this.disabled) { var r = this.sounds[t]; r.realVolume = e, r.volume(e * this.globalVolume) } }, t.stopAndReset = function(t) { this.stop(t), this.setVolume(t, 1), this.stop(t) }, t.isPlaying = function(t) { if (!this.disabled) return !this.sounds[t]._audioNode[0].paused }, t.playGroup = function(t) { if (!this.disabled && this.groups[t]) { var e = this.groups[t], r = Math.random() * e.sounds.length | 0; this.preload || this.sounds[e.sounds[r]].load(), this.sounds[e.sounds[r]].play(), this.currentSound = this.sounds[e.sounds[r]] } }, t.setVolume = function(t, e) { if (!this.disabled) { var r = this.sounds[t]; r.realVolume = e, r.volume = e * this.globalVolume } }, t.stop = function(t) { !this.disabled && this.sounds[t] && this.sounds[t].stop() }, t.pause = function(t) { !this.disabled && this.sounds[t] && this.sounds[t].pause() }, t.stopAll = function() { if (!this.disabled) for (var t in this.sounds) this.sounds[t].stop() }, t.setPlaybackSpeed = function(t, e) { if (!this.disabled) { var r = this.sounds[t]; r._playbackSpeed = e; var n = "music" == t ? 0 : 1; r._webAudio && c.Howler._howls[n]._audioNode[0] && (c.Howler._howls[n]._audioNode[0].bufferSource.playbackRate.value = e) } }, t.getPlaybackSpeed = function(t) { if (!this.disabled) return this.sounds[t]._playbackSpeed || 1 }, t.setGlobalVolume = function(t) { for (var e in this.globalVolume = t, this.sounds) { var r = this.sounds[e]; r.volume = r.realVolume * t } }, t.mute = function() { for (var t in this.isMuted = !0, c.Howler.mute(!0), c.Howler.volume(0), this.sounds) this.sounds[t].mute(!0); this.onMuteToggle.dispatch(!0) }, t.unmute = function() { for (var t in this.isMuted = !1, c.Howler.mute(!1), c.Howler.volume(1), this.sounds) this.sounds[t].mute(!1); this.onMuteToggle.dispatch(!1) }, t.check = function() { this.lastSeen = Date.now(); ! function loop() { lastSeen = Date.now(), setTimeout(loop, 50) }(), document.getElementById("music").addEventListener("timeupdate", function() { 100 < Date.now() - exports.lastSeen && this.pause() }, !1) }, SoundManagerHowler }(); e.a = new a }, function(t, e, r) { var n = r(52)("meta"), i = r(11), o = r(28), a = r(20).f, s = 0, u = Object.isExtensible || function() { return !0 }, h = !r(10)(function() { return u(Object.preventExtensions({})) }), c = function(t) { a(t, n, { value: { i: "O" + ++s, w: {} } }) }, l = t.exports = { KEY: n, NEED: !1, fastKey: function(t, e) { if (!i(t)) return "symbol" == typeof t ? t : ("string" == typeof t ? "S" : "P") + t; if (!o(t, n)) { if (!u(t)) return "F"; if (!e) return "E"; c(t) } return t[n].i }, getWeak: function(t, e) { if (!o(t, n)) { if (!u(t)) return !0; if (!e) return !1; c(t) } return t[n].w }, onFreeze: function(t) { return h && l.NEED && u(t) && !o(t, n) && c(t), t } } }, function(t, e) { t.exports = !1 }, function(t, e, r) { var n = r(15)("unscopables"), i = Array.prototype; null == i[n] && r(25)(i, n, {}), t.exports = function(t) { i[n][t] = !0 } }, function(t, e) { t.exports = function(t, e) { return { enumerable: !(1 & t), configurable: !(2 & t), writable: !(4 & t), value: e } } }, function(t, e) { var r = 0, n = Math.random(); t.exports = function(t) { return "Symbol(".concat(void 0 === t ? "" : t, ")_", (++r + n).toString(36)) } }, function(t, e, r) { var n = r(136), i = r(101); t.exports = Object.keys || function(t) { return n(t, i) } }, function(t, e, r) { var n = r(35), i = Math.max, o = Math.min; t.exports = function(t, e) { return (t = n(t)) < 0 ? i(t + e, 0) : o(t, e) } }, function(t, e, n) { var i = n(6), o = n(137), a = n(101), s = n(100)("IE_PROTO"), u = function() {}, h = "prototype", c = function() { var t, e = n(98)("iframe"), r = a.length; for (e.style.display = "none", n(102).appendChild(e), e.src = "javascript:", (t = e.contentWindow.document).open(), t.write("