forked from sent/waves
28979 lines
1.5 MiB
28979 lines
1.5 MiB
(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)
|
||
}, /^\<svg/.test(r.svg.trim()) && (r.svg = "data:image/svg+xml;utf8," + r.svg);
|
||
var e = decomposeDataUri(r.svg);
|
||
e ? r._loadDataUri(e) : r._loadXhr()
|
||
})), this._load
|
||
}, SVGResource.prototype._loadDataUri = function(t) {
|
||
var e;
|
||
if ("base64" === t.encoding) {
|
||
if (!atob) throw new Error("Your browser doesn't support base64 conversions.");
|
||
e = atob(t.data)
|
||
} else e = t.data;
|
||
this._loadString(e)
|
||
}, SVGResource.prototype._loadXhr = function() {
|
||
var t = this,
|
||
e = new XMLHttpRequest;
|
||
e.onload = function() {
|
||
if (e.readyState !== e.DONE || 200 !== e.status) throw new Error("Failed to load SVG using XHR.");
|
||
t._loadString(e.response)
|
||
}, e.open("GET", this.svg, !0), e.send()
|
||
}, SVGResource.prototype._loadString = function(t) {
|
||
var e = SVGResource.getSize(t),
|
||
r = new Image;
|
||
r.src = "data:image/svg+xml," + t;
|
||
var n = e.width,
|
||
i = e.height;
|
||
if (!n || !i) throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");
|
||
this._width = Math.round(n * this.scale), this._height = Math.round(i * this.scale);
|
||
var o = this.source;
|
||
o.width = this._width, o.height = this._height, o._pixiId = "canvas_" + uid(), o.getContext("2d").drawImage(r, 0, 0, n, i, 0, 0, this.width, this.height), this._resolve(), this._resolve = null
|
||
}, SVGResource.getSize = function(t) {
|
||
var e = SVGResource.SVG_SIZE.exec(t),
|
||
r = {};
|
||
return e && (r[e[1]] = Math.round(parseFloat(e[3])), r[e[5]] = Math.round(parseFloat(e[7]))), r
|
||
}, SVGResource.prototype.dispose = function() {
|
||
r.prototype.dispose.call(this), this._resolve = null
|
||
}, SVGResource.test = function(t, e) {
|
||
return "svg" === e || "string" == typeof t && 0 === t.indexOf("data:image/svg+xml")
|
||
}, SVGResource
|
||
}(At);
|
||
Lt.SVG_SIZE = /<svg[^>]*(?:\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<items.length;i++)\n { items[i]." + t + "(" + i + ");}\n this.running = false;\n if( this.needsTidy) this.tidy()")
|
||
} else n = new Function("this.running = true; \n var items = this.items; \n for(var i=0;i<items.length;i++)\n { items[i]." + t + "(); }\n this.running = false;\n if( this.needsTidy) this.tidy() ");
|
||
Runner.hash[r] = n
|
||
}
|
||
return n
|
||
}, n(Runner, [{
|
||
key: "empty",
|
||
get: function() {
|
||
return 0 === this.items.length
|
||
}
|
||
}]), Runner
|
||
}();
|
||
(e.default = i).hash = {}
|
||
}, function(t, e) {
|
||
var r = t.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
|
||
"number" == typeof __g && (__g = r)
|
||
}, function(t, e) {
|
||
t.exports = function(t) {
|
||
try {
|
||
return !!t()
|
||
} catch (t) {
|
||
return !0
|
||
}
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = function(t) {
|
||
return "object" == typeof t ? null !== t : "function" == typeof t
|
||
}
|
||
}, function(r, n, i) {
|
||
var o;
|
||
! function(t) {
|
||
function SignalBinding(t, e, r, n, i) {
|
||
this._listener = e, this._isOnce = r, this.context = n, this._signal = t, this._priority = i || 0
|
||
}
|
||
|
||
function validateListener(t, e) {
|
||
if ("function" != typeof t) throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}", e))
|
||
}
|
||
|
||
function Signal() {
|
||
this._bindings = [], this._prevParams = null;
|
||
var t = this;
|
||
this.dispatch = function() {
|
||
Signal.prototype.dispatch.apply(t, arguments)
|
||
}
|
||
}
|
||
Signal.prototype = {
|
||
VERSION: "1.0.0",
|
||
memorize: !(SignalBinding.prototype = {
|
||
active: !0,
|
||
params: null,
|
||
execute: function(t) {
|
||
var e, r;
|
||
return this.active && this._listener && (r = this.params ? this.params.concat(t) : t, e = this._listener.apply(this.context, r), this._isOnce && this.detach()), e
|
||
},
|
||
detach: function() {
|
||
return this.isBound() ? this._signal.remove(this._listener, this.context) : null
|
||
},
|
||
isBound: function() {
|
||
return !!this._signal && !!this._listener
|
||
},
|
||
isOnce: function() {
|
||
return this._isOnce
|
||
},
|
||
getListener: function() {
|
||
return this._listener
|
||
},
|
||
getSignal: function() {
|
||
return this._signal
|
||
},
|
||
_destroy: function() {
|
||
delete this._signal, delete this._listener, delete this.context
|
||
},
|
||
toString: function() {
|
||
return "[SignalBinding isOnce:" + this._isOnce + ", isBound:" + this.isBound() + ", active:" + this.active + "]"
|
||
}
|
||
}),
|
||
_shouldPropagate: !0,
|
||
active: !0,
|
||
_registerListener: function(t, e, r, n) {
|
||
var i, o = this._indexOfListener(t, r);
|
||
if (-1 !== o) {
|
||
if ((i = this._bindings[o]).isOnce() !== e) throw new Error("You cannot add" + (e ? "" : "Once") + "() then add" + (e ? "Once" : "") + "() the same listener without removing the relationship first.")
|
||
} else i = new SignalBinding(this, t, e, r, n), this._addBinding(i);
|
||
return this.memorize && this._prevParams && i.execute(this._prevParams), i
|
||
},
|
||
_addBinding: function(t) {
|
||
for (var e = this._bindings.length; --e, this._bindings[e] && t._priority <= this._bindings[e]._priority;);
|
||
this._bindings.splice(e + 1, 0, t)
|
||
},
|
||
_indexOfListener: function(t, e) {
|
||
for (var r, n = this._bindings.length; n--;)
|
||
if ((r = this._bindings[n])._listener === t && r.context === e) return n;
|
||
return -1
|
||
},
|
||
has: function(t, e) {
|
||
return -1 !== this._indexOfListener(t, e)
|
||
},
|
||
add: function(t, e, r) {
|
||
return validateListener(t, "add"), this._registerListener(t, !1, e, r)
|
||
},
|
||
addOnce: function(t, e, r) {
|
||
return validateListener(t, "addOnce"), this._registerListener(t, !0, e, r)
|
||
},
|
||
remove: function(t, e) {
|
||
validateListener(t, "remove");
|
||
var r = this._indexOfListener(t, e);
|
||
return -1 !== r && (this._bindings[r]._destroy(), this._bindings.splice(r, 1)), t
|
||
},
|
||
removeAll: function() {
|
||
for (var t = this._bindings.length; t--;) this._bindings[t]._destroy();
|
||
this._bindings.length = 0
|
||
},
|
||
getNumListeners: function() {
|
||
return this._bindings.length
|
||
},
|
||
halt: function() {
|
||
this._shouldPropagate = !1
|
||
},
|
||
dispatch: function(t) {
|
||
if (this.active) {
|
||
var e, r = Array.prototype.slice.call(arguments),
|
||
n = this._bindings.length;
|
||
if (this.memorize && (this._prevParams = r), n)
|
||
for (e = this._bindings.slice(), this._shouldPropagate = !0; e[--n] && this._shouldPropagate && !1 !== e[n].execute(r););
|
||
}
|
||
},
|
||
forget: function() {
|
||
this._prevParams = null
|
||
},
|
||
dispose: function() {
|
||
this.removeAll(), delete this._bindings, delete this._prevParams
|
||
},
|
||
toString: function() {
|
||
return "[Signal active:" + this.active + " numListeners:" + this.getNumListeners() + "]"
|
||
}
|
||
};
|
||
var e = Signal;
|
||
e.Signal = Signal, void 0 === (o = function() {
|
||
return e
|
||
}.call(n, i, n, r)) || (r.exports = o)
|
||
}()
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n, i = r(5),
|
||
o = (n = i) && n.__esModule ? n : {
|
||
default: n
|
||
};
|
||
var a = {},
|
||
s = function(t) {
|
||
function System() {
|
||
return function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, System),
|
||
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, t.apply(this, arguments))
|
||
}
|
||
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)
|
||
}(System, t), System.prototype.addedToGame = function() {
|
||
var t = this.entity.game;
|
||
t.onEntityAddedToGame.add(this), t.onEntityRemovedFromGame.add(this), t.onPreupdate.add(this), t.onPostupdate.add(this), t.onEmpty.add(this), t.onResize.add(this)
|
||
}, System.prototype.removedFromGame = function() {
|
||
var t = this.entity.game;
|
||
t.onEntityAddedToGame.remove(this), t.onEntityRemovedFromGame.remove(this), t.onPreupdate.remove(this), t.onPostupdate.remove(this), t.onEmpty.remove(this), t.onResize.remove(this)
|
||
}, System.create = function(t, e) {
|
||
if (a[t]) return a[t];
|
||
|
||
function com(t, e) {
|
||
this.entity = t, this.data = e
|
||
}
|
||
for (var r in com.prototype = Object.create(System.prototype), com.id = t, e) com.prototype[r] = e[r];
|
||
return a[t] = com
|
||
}, System
|
||
}(o.default);
|
||
e.default = s
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(12),
|
||
i = r.n(n),
|
||
o = function() {
|
||
function Ticker() {
|
||
this.onUpdate = new i.a, this.updateBind = this.update.bind(this), this.active = !1, this.deltaTime = 1, this.timeElapsed = 0, this.lastTime = 0, this.speed = 1
|
||
}
|
||
var t = Ticker.prototype;
|
||
return t.start = function() {
|
||
this.active || (this.active = !0, requestAnimationFrame(this.updateBind))
|
||
}, t.stop = function() {
|
||
this.active && (this.active = !1)
|
||
}, t.update = function() {
|
||
if (this.active) {
|
||
requestAnimationFrame(this.updateBind);
|
||
var t = (new Date).getTime(),
|
||
e = t - this.lastTime;
|
||
100 < e && (e = 100), this.deltaTime = .06 * e, this.deltaTime *= this.speed, this.onUpdate.dispatch(this.deltaTime), this.lastTime = t
|
||
}
|
||
}, t.add = function(t, e) {
|
||
this.onUpdate.add(t, e)
|
||
}, t.remove = function(t, e) {
|
||
this.onUpdate.remove(t, e)
|
||
}, t.setTimeout = function(t, e) {
|
||
for (var r = this, n = arguments.length, i = new Array(2 < n ? n - 2 : 0), o = 2; o < n; o++) i[o - 2] = arguments[o];
|
||
var a = 0,
|
||
s = function() {
|
||
++a === e && (u(), t.apply(void 0, i))
|
||
},
|
||
u = function() {
|
||
r.remove(s)
|
||
};
|
||
return this.add(s), {
|
||
clear: u,
|
||
reset: function() {
|
||
a = 0
|
||
}
|
||
}
|
||
}, t.setInterval = function(t, e) {
|
||
for (var r = arguments.length, n = new Array(2 < r ? r - 2 : 0), i = 2; i < r; i++) n[i - 2] = arguments[i];
|
||
return this.setIntervalCount.apply(this, [t, e, 1 / 0].concat(n))
|
||
}, t.setIntervalCount = function(t, e, r) {
|
||
for (var n = this, i = arguments.length, o = new Array(3 < i ? i - 3 : 0), a = 3; a < i; a++) o[a - 3] = arguments[a];
|
||
var s = 0,
|
||
u = {};
|
||
return u = this.setTimeout(function interval() {
|
||
++s < r && Object.assign(u, n.setTimeout(interval, e)), t.apply(void 0, o)
|
||
}, e)
|
||
}, Ticker
|
||
}();
|
||
o.instance = new o, o.game = new o, e.a = o
|
||
}, function(t, e, r) {
|
||
var n = r(74)("wks"),
|
||
i = r(52),
|
||
o = r(9).Symbol,
|
||
a = "function" == typeof o;
|
||
(t.exports = function(t) {
|
||
return n[t] || (n[t] = a && o[t] || (a ? o : i)("Symbol." + t))
|
||
}).store = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r.d(e, "j", function() {
|
||
return isFbxFormatBinary
|
||
}), r.d(e, "i", function() {
|
||
return isFbxFormatASCII
|
||
}), r.d(e, "g", function() {
|
||
return getFbxVersion
|
||
}), r.d(e, "c", function() {
|
||
return convertFBXTimeToSeconds
|
||
}), r.d(e, "e", function() {
|
||
return getData
|
||
}), r.d(e, "d", function() {
|
||
return generateTransform
|
||
}), r.d(e, "f", function() {
|
||
return getEulerOrder
|
||
}), r.d(e, "k", function() {
|
||
return parseNumberArray
|
||
}), r.d(e, "b", function() {
|
||
return convertArrayBufferToString
|
||
}), r.d(e, "a", function() {
|
||
return append
|
||
}), r.d(e, "h", function() {
|
||
return inject
|
||
});
|
||
var P = r(2);
|
||
|
||
function isFbxFormatBinary(t) {
|
||
var e = "Kaydara FBX Binary \0";
|
||
return t.byteLength >= 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 + "</" + e + ">"
|
||
};
|
||
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("<script>document.F=Object<\/script>"), t.close(), c = t.F; r--;) delete c[h][a[r]];
|
||
return c()
|
||
};
|
||
t.exports = Object.create || function(t, e) {
|
||
var r;
|
||
return null !== t ? (u[h] = i(t), r = new u, u[h] = null, r[s] = t) : r = c(), void 0 === e ? r : o(r, e)
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(136),
|
||
i = r(101).concat("length", "prototype");
|
||
e.f = Object.getOwnPropertyNames || function(t) {
|
||
return n(t, i)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(9),
|
||
i = r(20),
|
||
o = r(19),
|
||
a = r(15)("species");
|
||
t.exports = function(t) {
|
||
var e = n[t];
|
||
o && e && !e[a] && i.f(e, a, {
|
||
configurable: !0,
|
||
get: function() {
|
||
return this
|
||
}
|
||
})
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = function(t, e, r, n) {
|
||
if (!(t instanceof e) || void 0 !== n && n in t) throw TypeError(r + ": incorrect invocation!");
|
||
return t
|
||
}
|
||
}, function(t, e, r) {
|
||
var f = r(33),
|
||
d = r(149),
|
||
p = r(113),
|
||
m = r(6),
|
||
v = r(17),
|
||
g = r(115),
|
||
y = {},
|
||
_ = {};
|
||
(e = t.exports = function(t, e, r, n, i) {
|
||
var o, a, s, u, h = i ? function() {
|
||
return t
|
||
} : g(t),
|
||
c = f(r, n, e ? 2 : 1),
|
||
l = 0;
|
||
if ("function" != typeof h) throw TypeError(t + " is not iterable!");
|
||
if (p(h)) {
|
||
for (o = v(t.length); l < o; l++)
|
||
if ((u = e ? c(m(a = t[l])[0], a[1]) : c(t[l])) === y || u === _) return u
|
||
} else
|
||
for (s = h.call(t); !(a = s.next()).done;)
|
||
if ((u = d(s, c, a.value, e)) === y || u === _) return u
|
||
}).BREAK = y, e.RETURN = _
|
||
}, function(t, e, r) {
|
||
var i = r(26);
|
||
t.exports = function(t, e, r) {
|
||
for (var n in e) i(t, n, e[n], r);
|
||
return t
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(20).f,
|
||
i = r(28),
|
||
o = r(15)("toStringTag");
|
||
t.exports = function(t, e, r) {
|
||
t && !i(t = r ? t : t.prototype, o) && n(t, o, {
|
||
configurable: !0,
|
||
value: e
|
||
})
|
||
}
|
||
}, function(t, e, r) {
|
||
var i = r(34),
|
||
o = r(15)("toStringTag"),
|
||
a = "Arguments" == i(function() {
|
||
return arguments
|
||
}());
|
||
t.exports = function(t) {
|
||
var e, r, n;
|
||
return void 0 === t ? "Undefined" : null === t ? "Null" : "string" == typeof(r = function(t, e) {
|
||
try {
|
||
return t[e]
|
||
} catch (t) {}
|
||
}(e = Object(t), o)) ? r : a ? i(e) : "Object" == (n = i(e)) && "function" == typeof e.callee ? "Arguments" : n
|
||
}
|
||
}, function(t, e, r) {
|
||
var a = r(1),
|
||
n = r(39),
|
||
s = r(10),
|
||
u = r(104),
|
||
i = "[" + u + "]",
|
||
o = RegExp("^" + i + i + "*"),
|
||
h = RegExp(i + i + "*$"),
|
||
c = function(t, e, r) {
|
||
var n = {},
|
||
i = s(function() {
|
||
return !!u[t]() || "
" != "
" [t]()
|
||
}),
|
||
o = n[t] = i ? e(l) : u[t];
|
||
r && (n[r] = o), a(a.P + a.F * i, "String", n)
|
||
},
|
||
l = c.trim = function(t, e) {
|
||
return t = String(n(t)), 1 & e && (t = t.replace(o, "")), 2 & e && (t = t.replace(h, "")), t
|
||
};
|
||
t.exports = c
|
||
}, function(t, e) {
|
||
t.exports = {}
|
||
}, function(t, e, r) {
|
||
var n = r(11);
|
||
t.exports = function(t, e) {
|
||
if (!n(t) || t._t !== e) throw TypeError("Incompatible receiver, " + e + " required!");
|
||
return t
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(411).Loader,
|
||
i = r(174).Resource,
|
||
o = r(173),
|
||
a = r(412);
|
||
n.Resource = i, n.async = o, n.encodeBinary = a, n.base64 = a, t.exports = n, t.exports.Loader = n, t.exports.default = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r.d(e, "a", function() {
|
||
return i
|
||
});
|
||
var n = r(4),
|
||
i = function() {
|
||
function Bone(t) {
|
||
this.parent, this.children = [], this.original = t, this.localMatrix = n.mat4.create(), this.worldMatrix = n.mat4.create(), this.point = n.vec3.create(), this.id = null
|
||
}
|
||
var t = Bone.prototype;
|
||
return t.collect = function(t, e) {
|
||
t.push(e);
|
||
for (var r = 0; r < e.children.length; r++) this.collect(t, e.children[r])
|
||
}, t.addChild = function(t) {
|
||
this.children.push(t), t.parent = this
|
||
}, t.removeChild = function(t) {
|
||
var e = this.children.indexOf(t); - 1 !== e && (this.children.splice(e, 1), t.parent = null)
|
||
}, t.update = function() {
|
||
this.parent ? this.worldMatrix = n.mat4.multiply(this.worldMatrix, this.parent.worldMatrix, this.localMatrix) : this.worldMatrix = n.mat4.copy(this.worldMatrix, this.localMatrix);
|
||
for (var t = 0; t < this.children.length; t++) this.children[t].update()
|
||
}, Bone
|
||
}()
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(12),
|
||
i = r.n(n),
|
||
o = function() {
|
||
function VisibilityChecker() {
|
||
void 0 !== document.hidden ? (this.hidden = "hidden", this.visibilityChange = "visibilitychange") : void 0 !== document.mozHidden ? (this.hidden = "mozHidden", this.visibilityChange = "mozvisibilitychange") : void 0 !== document.msHidden ? (this.hidden = "msHidden", this.visibilityChange = "msvisibilitychange") : void 0 !== document.webkitHidden && (this.hidden = "webkitHidden", this.visibilityChange = "webkitvisibilitychange"), this.onHide = new i.a, this.onShow = new i.a, this.init()
|
||
}
|
||
var t = VisibilityChecker.prototype;
|
||
return t.handleVisibilityChange = function() {
|
||
document[this.hidden] ? this.onHide.dispatch() : this.onShow.dispatch()
|
||
}, t.init = function() {
|
||
document.addEventListener(this.visibilityChange, this.handleVisibilityChange.bind(this), !1)
|
||
}, VisibilityChecker
|
||
}();
|
||
e.a = new o
|
||
}, function(t, e, r) {
|
||
var n = r(34);
|
||
t.exports = Object("z").propertyIsEnumerable(0) ? Object : function(t) {
|
||
return "String" == n(t) ? t.split("") : Object(t)
|
||
}
|
||
}, function(t, e) {
|
||
e.f = {}.propertyIsEnumerable
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(6);
|
||
t.exports = function() {
|
||
var t = n(this),
|
||
e = "";
|
||
return t.global && (e += "g"), t.ignoreCase && (e += "i"), t.multiline && (e += "m"), t.unicode && (e += "u"), t.sticky && (e += "y"), e
|
||
}
|
||
}, function(t, e, r) {
|
||
var i = r(6),
|
||
o = r(24),
|
||
a = r(15)("species");
|
||
t.exports = function(t, e) {
|
||
var r, n = i(t).constructor;
|
||
return void 0 === n || null == (r = i(n)[a]) ? e : o(r)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r.d(e, "a", function() {
|
||
return n
|
||
});
|
||
var a = r(4),
|
||
s = r(67),
|
||
n = function() {
|
||
function Skeleton() {
|
||
this.root, this.hash = {}, this.totalBones = 0
|
||
}
|
||
var t = Skeleton.prototype;
|
||
return t.collect = function(t, e) {
|
||
t.push(e);
|
||
for (var r = 0; r < e.children.length; r++) this.collect(t, e.children[r])
|
||
}, t.update = function() {
|
||
this.root.update()
|
||
}, t.injectBone = function(t, e, r) {
|
||
var n = this.hash[e],
|
||
i = this.hash[r],
|
||
o = new s.a(a.mat4.create());
|
||
o.id = t, n.removeChild(i), n.addChild(o), o.addChild(i), this.hash[t] = o
|
||
}, Skeleton.fromCollada = function(t) {
|
||
var o = new Skeleton,
|
||
e = new s.a(a.mat4.create());
|
||
return function runSkeleton(t, e, r) {
|
||
var n = new s.a(t.model);
|
||
n.id = t.id, o.hash[t.id] = n, o.totalBones++, e = e ? (e.addChild(n), n) : o.root = n;
|
||
for (var i = 0; i < t.children.length; i++) runSkeleton(t.children[i], e, r + "-")
|
||
}(t, o.root = e, ""), 0 === o.totalBones ? null : o
|
||
}, Skeleton
|
||
}()
|
||
}, function(t, e, r) {
|
||
var n = r(32),
|
||
i = r(9),
|
||
o = "__core-js_shared__",
|
||
a = i[o] || (i[o] = {});
|
||
(t.exports = function(t, e) {
|
||
return a[t] || (a[t] = void 0 !== e ? e : {})
|
||
})("versions", []).push({
|
||
version: n.version,
|
||
mode: r(49) ? "pure" : "global",
|
||
copyright: "© 2019 Denis Pushkarev (zloirock.ru)"
|
||
})
|
||
}, function(t, e, r) {
|
||
var u = r(29),
|
||
h = r(17),
|
||
c = r(54);
|
||
t.exports = function(s) {
|
||
return function(t, e, r) {
|
||
var n, i = u(t),
|
||
o = h(i.length),
|
||
a = c(r, o);
|
||
if (s && e != e) {
|
||
for (; a < o;)
|
||
if ((n = i[a++]) != n) return !0
|
||
} else
|
||
for (; a < o; a++)
|
||
if ((s || a in i) && i[a] === e) return s || a || 0;
|
||
return !s && -1
|
||
}
|
||
}
|
||
}, function(t, e) {
|
||
e.f = Object.getOwnPropertySymbols
|
||
}, function(t, e, r) {
|
||
var n = r(34);
|
||
t.exports = Array.isArray || function(t) {
|
||
return "Array" == n(t)
|
||
}
|
||
}, function(t, e, r) {
|
||
var u = r(35),
|
||
h = r(39);
|
||
t.exports = function(s) {
|
||
return function(t, e) {
|
||
var r, n, i = String(h(t)),
|
||
o = u(e),
|
||
a = i.length;
|
||
return o < 0 || a <= o ? s ? "" : void 0 : (r = i.charCodeAt(o)) < 55296 || 56319 < r || o + 1 === a || (n = i.charCodeAt(o + 1)) < 56320 || 57343 < n ? s ? i.charAt(o) : r : s ? i.slice(o, o + 2) : n - 56320 + (r - 55296 << 10) + 65536
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = r(34),
|
||
o = r(15)("match");
|
||
t.exports = function(t) {
|
||
var e;
|
||
return n(t) && (void 0 !== (e = t[o]) ? !!e : "RegExp" == i(t))
|
||
}
|
||
}, function(t, e, r) {
|
||
var o = r(15)("iterator"),
|
||
a = !1;
|
||
try {
|
||
var n = [7][o]();
|
||
n.return = function() {
|
||
a = !0
|
||
}, Array.from(n, function() {
|
||
throw 2
|
||
})
|
||
} catch (t) {}
|
||
t.exports = function(t, e) {
|
||
if (!e && !a) return !1;
|
||
var r = !1;
|
||
try {
|
||
var n = [7],
|
||
i = n[o]();
|
||
i.next = function() {
|
||
return {
|
||
done: r = !0
|
||
}
|
||
}, n[o] = function() {
|
||
return i
|
||
}, t(n)
|
||
} catch (t) {}
|
||
return r
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var i = r(62),
|
||
o = RegExp.prototype.exec;
|
||
t.exports = function(t, e) {
|
||
var r = t.exec;
|
||
if ("function" == typeof r) {
|
||
var n = r.call(t, e);
|
||
if ("object" != typeof n) throw new TypeError("RegExp exec method returned something other than an Object or null");
|
||
return n
|
||
}
|
||
if ("RegExp" !== i(t)) throw new TypeError("RegExp#exec called on incompatible receiver");
|
||
return o.call(t, e)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(153);
|
||
var c = r(26),
|
||
l = r(25),
|
||
f = r(10),
|
||
d = r(39),
|
||
p = r(15),
|
||
m = r(119),
|
||
v = p("species"),
|
||
g = !f(function() {
|
||
var t = /./;
|
||
return t.exec = function() {
|
||
var t = [];
|
||
return t.groups = {
|
||
a: "7"
|
||
}, t
|
||
}, "7" !== "".replace(t, "$<a>")
|
||
}),
|
||
y = function() {
|
||
var t = /(?:)/,
|
||
e = t.exec;
|
||
t.exec = function() {
|
||
return e.apply(this, arguments)
|
||
};
|
||
var r = "ab".split(t);
|
||
return 2 === r.length && "a" === r[0] && "b" === r[1]
|
||
}();
|
||
t.exports = function(r, t, e) {
|
||
var n = p(r),
|
||
o = !f(function() {
|
||
var t = {};
|
||
return t[n] = function() {
|
||
return 7
|
||
}, 7 != "" [r](t)
|
||
}),
|
||
i = o ? !f(function() {
|
||
var t = !1,
|
||
e = /a/;
|
||
return e.exec = function() {
|
||
return t = !0, null
|
||
}, "split" === r && (e.constructor = {}, e.constructor[v] = function() {
|
||
return e
|
||
}), e[n](""), !t
|
||
}) : void 0;
|
||
if (!o || !i || "replace" === r && !g || "split" === r && !y) {
|
||
var a = /./ [n],
|
||
s = e(d, n, "" [r], function(t, e, r, n, i) {
|
||
return e.exec === m ? o && !i ? {
|
||
done: !0,
|
||
value: a.call(e, r, n)
|
||
} : {
|
||
done: !0,
|
||
value: t.call(r, e, n)
|
||
} : {
|
||
done: !1
|
||
}
|
||
}),
|
||
u = s[0],
|
||
h = s[1];
|
||
c(String.prototype, r, u), l(RegExp.prototype, n, 2 == t ? function(t, e) {
|
||
return h.call(t, this, e)
|
||
} : function(t) {
|
||
return h.call(t, this)
|
||
})
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(9).navigator;
|
||
t.exports = n && n.userAgent || ""
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var g = r(9),
|
||
y = r(1),
|
||
_ = r(26),
|
||
b = r(60),
|
||
x = r(48),
|
||
w = r(59),
|
||
T = r(58),
|
||
S = r(11),
|
||
M = r(10),
|
||
E = r(80),
|
||
A = r(61),
|
||
P = r(105);
|
||
t.exports = function(n, t, e, r, i, o) {
|
||
var a = g[n],
|
||
s = a,
|
||
u = i ? "set" : "add",
|
||
h = s && s.prototype,
|
||
c = {},
|
||
l = function(t) {
|
||
var r = h[t];
|
||
_(h, t, "delete" == t ? function(t) {
|
||
return !(o && !S(t)) && r.call(this, 0 === t ? 0 : t)
|
||
} : "has" == t ? function(t) {
|
||
return !(o && !S(t)) && r.call(this, 0 === t ? 0 : t)
|
||
} : "get" == t ? function(t) {
|
||
return o && !S(t) ? void 0 : r.call(this, 0 === t ? 0 : t)
|
||
} : "add" == t ? function(t) {
|
||
return r.call(this, 0 === t ? 0 : t), this
|
||
} : function(t, e) {
|
||
return r.call(this, 0 === t ? 0 : t, e), this
|
||
})
|
||
};
|
||
if ("function" == typeof s && (o || h.forEach && !M(function() {
|
||
(new s).entries().next()
|
||
}))) {
|
||
var f = new s,
|
||
d = f[u](o ? {} : -0, 1) != f,
|
||
p = M(function() {
|
||
f.has(1)
|
||
}),
|
||
m = E(function(t) {
|
||
new s(t)
|
||
}),
|
||
v = !o && M(function() {
|
||
for (var t = new s, e = 5; e--;) t[u](e, e);
|
||
return !t.has(-0)
|
||
});
|
||
m || (((s = t(function(t, e) {
|
||
T(t, s, n);
|
||
var r = P(new a, t, s);
|
||
return null != e && w(e, i, r[u], r), r
|
||
})).prototype = h).constructor = s), (p || v) && (l("delete"), l("has"), i && l("get")), (v || d) && l(u), o && h.clear && delete h.clear
|
||
} else s = r.getConstructor(t, n, i, u), b(s.prototype, e), x.NEED = !0;
|
||
return A(s, n), c[n] = s, y(y.G + y.W + y.F * (s != a), c), o || r.setStrong(s, n, i), s
|
||
}
|
||
}, function(t, e, r) {
|
||
for (var n, i = r(9), o = r(25), a = r(52), s = a("typed_array"), u = a("view"), h = !(!i.ArrayBuffer || !i.DataView), c = h, l = 0, f = "Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(","); l < 9;)(n = i[f[l++]]) ? (o(n.prototype, s, !0), o(n.prototype, u, !0)) : c = !1;
|
||
t.exports = {
|
||
ABV: h,
|
||
CONSTR: c,
|
||
TYPED: s,
|
||
VIEW: u
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
t.exports = r(49) || !r(10)(function() {
|
||
var t = Math.random();
|
||
__defineSetter__.call(null, t, function() {}), delete r(9)[t]
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1);
|
||
t.exports = function(t) {
|
||
n(n.S, t, { of: function() {
|
||
for (var t = arguments.length, e = new Array(t); t--;) e[t] = arguments[t];
|
||
return new this(e)
|
||
}
|
||
})
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
a = r(24),
|
||
s = r(33),
|
||
u = r(59);
|
||
t.exports = function(t) {
|
||
n(n.S, t, {
|
||
from: function(t) {
|
||
var e, r, n, i, o = arguments[1];
|
||
return a(this), (e = void 0 !== o) && a(o), null == t ? new this : (r = [], e ? (n = 0, i = s(o, arguments[2], 2), u(t, !1, function(t) {
|
||
r.push(i(t, n++))
|
||
})) : u(t, !1, r.push, r), new this(r))
|
||
}
|
||
})
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var D = r(405),
|
||
F = r(407);
|
||
|
||
function Url() {
|
||
this.protocol = null, this.slashes = null, this.auth = null, this.host = null, this.port = null, this.hostname = null, this.hash = null, this.search = null, this.query = null, this.pathname = null, this.path = null, this.href = null
|
||
}
|
||
e.parse = urlParse, e.resolve = function(t, e) {
|
||
return urlParse(t, !1, !0).resolve(e)
|
||
}, e.resolveObject = function(t, e) {
|
||
return t ? urlParse(t, !1, !0).resolveObject(e) : e
|
||
}, e.format = function(t) {
|
||
F.isString(t) && (t = urlParse(t));
|
||
return t instanceof Url ? t.format() : Url.prototype.format.call(t)
|
||
}, e.Url = Url;
|
||
var k = /^([a-z0-9.+-]+:)/i,
|
||
n = /:[0-9]*$/,
|
||
L = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
|
||
i = ["{", "}", "|", "\\", "^", "`"].concat(["<", ">", '"', "`", " ", "\r", "\n", "\t"]),
|
||
N = ["'"].concat(i),
|
||
B = ["%", "/", "?", ";", "#"].concat(N),
|
||
U = ["/", "?", "#"],
|
||
G = /^[+a-z0-9A-Z_-]{0,63}$/,
|
||
j = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
|
||
z = {
|
||
javascript: !0,
|
||
"javascript:": !0
|
||
},
|
||
X = {
|
||
javascript: !0,
|
||
"javascript:": !0
|
||
},
|
||
V = {
|
||
http: !0,
|
||
https: !0,
|
||
ftp: !0,
|
||
gopher: !0,
|
||
file: !0,
|
||
"http:": !0,
|
||
"https:": !0,
|
||
"ftp:": !0,
|
||
"gopher:": !0,
|
||
"file:": !0
|
||
},
|
||
q = r(408);
|
||
|
||
function urlParse(t, e, r) {
|
||
if (t && F.isObject(t) && t instanceof Url) return t;
|
||
var n = new Url;
|
||
return n.parse(t, e, r), n
|
||
}
|
||
Url.prototype.parse = function(t, e, r) {
|
||
if (!F.isString(t)) throw new TypeError("Parameter 'url' must be a string, not " + typeof t);
|
||
var n = t.indexOf("?"),
|
||
i = -1 !== n && n < t.indexOf("#") ? "?" : "#",
|
||
o = t.split(i);
|
||
o[0] = o[0].replace(/\\/g, "/");
|
||
var a = t = o.join(i);
|
||
if (a = a.trim(), !r && 1 === t.split("#").length) {
|
||
var s = L.exec(a);
|
||
if (s) return this.path = a, this.href = a, this.pathname = s[1], s[2] ? (this.search = s[2], this.query = e ? q.parse(this.search.substr(1)) : this.search.substr(1)) : e && (this.search = "", this.query = {}), this
|
||
}
|
||
var u = k.exec(a);
|
||
if (u) {
|
||
var h = (u = u[0]).toLowerCase();
|
||
this.protocol = h, a = a.substr(u.length)
|
||
}
|
||
if (r || u || a.match(/^\/\/[^@\/]+@[^@\/]+/)) {
|
||
var c = "//" === a.substr(0, 2);
|
||
!c || u && X[u] || (a = a.substr(2), this.slashes = !0)
|
||
}
|
||
if (!X[u] && (c || u && !V[u])) {
|
||
for (var l, f, d = -1, p = 0; p < U.length; p++) {
|
||
-1 !== (m = a.indexOf(U[p])) && (-1 === d || m < d) && (d = m)
|
||
} - 1 !== (f = -1 === d ? a.lastIndexOf("@") : a.lastIndexOf("@", d)) && (l = a.slice(0, f), a = a.slice(f + 1), this.auth = decodeURIComponent(l)), d = -1;
|
||
for (p = 0; p < B.length; p++) {
|
||
var m; - 1 !== (m = a.indexOf(B[p])) && (-1 === d || m < d) && (d = m)
|
||
} - 1 === d && (d = a.length), this.host = a.slice(0, d), a = a.slice(d), this.parseHost(), this.hostname = this.hostname || "";
|
||
var v = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
|
||
if (!v)
|
||
for (var g = this.hostname.split(/\./), y = (p = 0, g.length); p < y; p++) {
|
||
var _ = g[p];
|
||
if (_ && !_.match(G)) {
|
||
for (var b = "", x = 0, w = _.length; x < w; x++) 127 < _.charCodeAt(x) ? b += "x" : b += _[x];
|
||
if (!b.match(G)) {
|
||
var T = g.slice(0, p),
|
||
S = g.slice(p + 1),
|
||
M = _.match(j);
|
||
M && (T.push(M[1]), S.unshift(M[2])), S.length && (a = "/" + S.join(".") + a), this.hostname = T.join(".");
|
||
break
|
||
}
|
||
}
|
||
}
|
||
255 < this.hostname.length ? this.hostname = "" : this.hostname = this.hostname.toLowerCase(), v || (this.hostname = D.toASCII(this.hostname));
|
||
var E = this.port ? ":" + this.port : "",
|
||
A = this.hostname || "";
|
||
this.host = A + E, this.href += this.host, v && (this.hostname = this.hostname.substr(1, this.hostname.length - 2), "/" !== a[0] && (a = "/" + a))
|
||
}
|
||
if (!z[h])
|
||
for (p = 0, y = N.length; p < y; p++) {
|
||
var P = N[p];
|
||
if (-1 !== a.indexOf(P)) {
|
||
var I = encodeURIComponent(P);
|
||
I === P && (I = escape(P)), a = a.split(P).join(I)
|
||
}
|
||
}
|
||
var O = a.indexOf("#"); - 1 !== O && (this.hash = a.substr(O), a = a.slice(0, O));
|
||
var C = a.indexOf("?");
|
||
if (-1 !== C ? (this.search = a.substr(C), this.query = a.substr(C + 1), e && (this.query = q.parse(this.query)), a = a.slice(0, C)) : e && (this.search = "", this.query = {}), a && (this.pathname = a), V[h] && this.hostname && !this.pathname && (this.pathname = "/"), this.pathname || this.search) {
|
||
E = this.pathname || "";
|
||
var R = this.search || "";
|
||
this.path = E + R
|
||
}
|
||
return this.href = this.format(), this
|
||
}, Url.prototype.format = function() {
|
||
var t = this.auth || "";
|
||
t && (t = (t = encodeURIComponent(t)).replace(/%3A/i, ":"), t += "@");
|
||
var e = this.protocol || "",
|
||
r = this.pathname || "",
|
||
n = this.hash || "",
|
||
i = !1,
|
||
o = "";
|
||
this.host ? i = t + this.host : this.hostname && (i = t + (-1 === this.hostname.indexOf(":") ? this.hostname : "[" + this.hostname + "]"), this.port && (i += ":" + this.port)), this.query && F.isObject(this.query) && Object.keys(this.query).length && (o = q.stringify(this.query));
|
||
var a = this.search || o && "?" + o || "";
|
||
return e && ":" !== e.substr(-1) && (e += ":"), this.slashes || (!e || V[e]) && !1 !== i ? (i = "//" + (i || ""), r && "/" !== r.charAt(0) && (r = "/" + r)) : i || (i = ""), n && "#" !== n.charAt(0) && (n = "#" + n), a && "?" !== a.charAt(0) && (a = "?" + a), e + i + (r = r.replace(/[?#]/g, function(t) {
|
||
return encodeURIComponent(t)
|
||
})) + (a = a.replace("#", "%23")) + n
|
||
}, Url.prototype.resolve = function(t) {
|
||
return this.resolveObject(urlParse(t, !1, !0)).format()
|
||
}, Url.prototype.resolveObject = function(t) {
|
||
if (F.isString(t)) {
|
||
var e = new Url;
|
||
e.parse(t, !1, !0), t = e
|
||
}
|
||
for (var r = new Url, n = Object.keys(this), i = 0; i < n.length; i++) {
|
||
var o = n[i];
|
||
r[o] = this[o]
|
||
}
|
||
if (r.hash = t.hash, "" === t.href) return r.href = r.format(), r;
|
||
if (t.slashes && !t.protocol) {
|
||
for (var a = Object.keys(t), s = 0; s < a.length; s++) {
|
||
var u = a[s];
|
||
"protocol" !== u && (r[u] = t[u])
|
||
}
|
||
return V[r.protocol] && r.hostname && !r.pathname && (r.path = r.pathname = "/"), r.href = r.format(), r
|
||
}
|
||
if (t.protocol && t.protocol !== r.protocol) {
|
||
if (!V[t.protocol]) {
|
||
for (var h = Object.keys(t), c = 0; c < h.length; c++) {
|
||
var l = h[c];
|
||
r[l] = t[l]
|
||
}
|
||
return r.href = r.format(), r
|
||
}
|
||
if (r.protocol = t.protocol, t.host || X[t.protocol]) r.pathname = t.pathname;
|
||
else {
|
||
for (var f = (t.pathname || "").split("/"); f.length && !(t.host = f.shift()););
|
||
t.host || (t.host = ""), t.hostname || (t.hostname = ""), "" !== f[0] && f.unshift(""), f.length < 2 && f.unshift(""), r.pathname = f.join("/")
|
||
}
|
||
if (r.search = t.search, r.query = t.query, r.host = t.host || "", r.auth = t.auth, r.hostname = t.hostname || t.host, r.port = t.port, r.pathname || r.search) {
|
||
var d = r.pathname || "",
|
||
p = r.search || "";
|
||
r.path = d + p
|
||
}
|
||
return r.slashes = r.slashes || t.slashes, r.href = r.format(), r
|
||
}
|
||
var m = r.pathname && "/" === r.pathname.charAt(0),
|
||
v = t.host || t.pathname && "/" === t.pathname.charAt(0),
|
||
g = v || m || r.host && t.pathname,
|
||
y = g,
|
||
_ = r.pathname && r.pathname.split("/") || [],
|
||
b = (f = t.pathname && t.pathname.split("/") || [], r.protocol && !V[r.protocol]);
|
||
if (b && (r.hostname = "", r.port = null, r.host && ("" === _[0] ? _[0] = r.host : _.unshift(r.host)), r.host = "", t.protocol && (t.hostname = null, t.port = null, t.host && ("" === f[0] ? f[0] = t.host : f.unshift(t.host)), t.host = null), g = g && ("" === f[0] || "" === _[0])), v) r.host = t.host || "" === t.host ? t.host : r.host, r.hostname = t.hostname || "" === t.hostname ? t.hostname : r.hostname, r.search = t.search, r.query = t.query, _ = f;
|
||
else if (f.length) _ || (_ = []), _.pop(), _ = _.concat(f), r.search = t.search, r.query = t.query;
|
||
else if (!F.isNullOrUndefined(t.search)) {
|
||
if (b) r.hostname = r.host = _.shift(), (M = !!(r.host && 0 < r.host.indexOf("@")) && r.host.split("@")) && (r.auth = M.shift(), r.host = r.hostname = M.shift());
|
||
return r.search = t.search, r.query = t.query, F.isNull(r.pathname) && F.isNull(r.search) || (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.href = r.format(), r
|
||
}
|
||
if (!_.length) return r.pathname = null, r.search ? r.path = "/" + r.search : r.path = null, r.href = r.format(), r;
|
||
for (var x = _.slice(-1)[0], w = (r.host || t.host || 1 < _.length) && ("." === x || ".." === x) || "" === x, T = 0, S = _.length; 0 <= S; S--) "." === (x = _[S]) ? _.splice(S, 1) : ".." === x ? (_.splice(S, 1), T++) : T && (_.splice(S, 1), T--);
|
||
if (!g && !y)
|
||
for (; T--; T) _.unshift("..");
|
||
!g || "" === _[0] || _[0] && "/" === _[0].charAt(0) || _.unshift(""), w && "/" !== _.join("/").substr(-1) && _.push("");
|
||
var M, E = "" === _[0] || _[0] && "/" === _[0].charAt(0);
|
||
b && (r.hostname = r.host = E ? "" : _.length ? _.shift() : "", (M = !!(r.host && 0 < r.host.indexOf("@")) && r.host.split("@")) && (r.auth = M.shift(), r.host = r.hostname = M.shift()));
|
||
return (g = g || r.host && _.length) && !E && _.unshift(""), _.length ? r.pathname = _.join("/") : (r.pathname = null, r.path = null), F.isNull(r.pathname) && F.isNull(r.search) || (r.path = (r.pathname ? r.pathname : "") + (r.search ? r.search : "")), r.auth = t.auth || r.auth, r.slashes = r.slashes || t.slashes, r.href = r.format(), r
|
||
}, Url.prototype.parseHost = function() {
|
||
var t = this.host,
|
||
e = n.exec(t);
|
||
e && (":" !== (e = e[0]) && (this.port = e.substr(1)), t = t.substr(0, t.length - e.length)), t && (this.hostname = t)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
|
||
function decodeText(t) {
|
||
if ("undefined" != typeof TextDecoder) return (new TextDecoder).decode(t);
|
||
for (var e = "", r = 0, n = t.length; r < n; r++) e += String.fromCharCode(t[r]);
|
||
return decodeURIComponent(escape(e))
|
||
}
|
||
|
||
function extractUrlBase(t) {
|
||
var e = t.lastIndexOf("/");
|
||
return -1 === e ? "./" : t.substr(0, e + 1)
|
||
}
|
||
r.r(e), r.d(e, "decodeText", function() {
|
||
return decodeText
|
||
}), r.d(e, "extractUrlBase", function() {
|
||
return extractUrlBase
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r.d(e, "a", function() {
|
||
return o
|
||
});
|
||
var n = r(12),
|
||
i = r.n(n),
|
||
o = function() {
|
||
function Transition() {
|
||
this.transitionOutComplete = new i.a, this.transitionInStart = new i.a, this.transitionComplete = new i.a
|
||
}
|
||
var t = Transition.prototype;
|
||
return t.start = function(t, e, r) {
|
||
this.container = t, this.currentScreen = e, this.nextScreen = r
|
||
}, t.resize = function(t, e) {
|
||
this.width = t, this.height = e
|
||
}, t._startTransitionOut = function() {}, t._onTransitionOutComplete = function() {
|
||
this.transitionOutComplete.dispatch()
|
||
}, t._startTransitionIn = function() {
|
||
this.transitionInStart.dispatch()
|
||
}, t._onTransitionInComplete = function() {
|
||
this.transitionComplete.dispatch()
|
||
}, Transition
|
||
}()
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = function(s) {
|
||
function BoxGeometry() {
|
||
var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1,
|
||
e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1,
|
||
r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1,
|
||
n = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1,
|
||
i = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 1,
|
||
o = 5 < arguments.length && void 0 !== arguments[5] ? arguments[5] : 1;
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, BoxGeometry);
|
||
var 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));
|
||
n = Math.floor(n), i = Math.floor(i), o = Math.floor(o);
|
||
var A = [],
|
||
P = [],
|
||
I = [],
|
||
O = [],
|
||
C = 0;
|
||
|
||
function buildPlane(t, e, r, n, i, o, a, s, u, h) {
|
||
var c = o / u,
|
||
l = a / h,
|
||
f = o / 2,
|
||
d = a / 2,
|
||
p = s / 2,
|
||
m = u + 1,
|
||
v = h + 1,
|
||
g = 0,
|
||
y = void 0,
|
||
_ = void 0,
|
||
b = new Float32Array(3);
|
||
for (_ = 0; _ < v; _++) {
|
||
var x = _ * l - d;
|
||
for (y = 0; y < m; y++) {
|
||
var w = y * c - f;
|
||
b[t] = w * n, b[e] = x * i, b[r] = p, P.push(b.x, b.y, b.z), b[t] = 0, b[e] = 0, b[r] = 0 < s ? 1 : -1, I.push(b.x, b.y, b.z), O.push(y / u), O.push(1 - _ / h), g += 1
|
||
}
|
||
}
|
||
for (_ = 0; _ < h; _++)
|
||
for (y = 0; y < u; y++) {
|
||
var T = C + y + m * _,
|
||
S = C + y + m * (_ + 1),
|
||
M = C + (y + 1) + m * (_ + 1),
|
||
E = C + (y + 1) + m * _;
|
||
A.push(T, S, E), A.push(S, M, E)
|
||
}
|
||
C += g
|
||
}
|
||
return buildPlane("z", "y", "x", -1, -1, r, e, t, o, i), buildPlane("z", "y", "x", 1, -1, r, e, -t, o, i), buildPlane("x", "z", "y", 1, 1, t, r, e, n, o), buildPlane("x", "z", "y", 1, -1, t, r, -e, n, o), buildPlane("x", "y", "z", 1, -1, t, e, r, n, i), buildPlane("x", "y", "z", -1, -1, t, e, -r, n, i), a.addAttribute("uvs", O, 2).addAttribute("position", P, 3).addAttribute("normals", I, 3).addIndex(new Uint16Array(A)), 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)
|
||
}(BoxGeometry, s), BoxGeometry
|
||
}(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)).Geometry);
|
||
e.default = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = function(b) {
|
||
function PlaneGeometry() {
|
||
var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 20,
|
||
e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 10,
|
||
r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 4,
|
||
n = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 2;
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, PlaneGeometry);
|
||
for (var i = 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, b.call(this)), o = [], a = [], s = [], u = [], h = 0; h <= n; ++h)
|
||
for (var c = h / n, l = 0; l <= r; ++l) {
|
||
var f = l / r;
|
||
o.push(f * t - t / 2, c * e - e / 2, 0), a.push(f, c), s.push(0, 0, 1)
|
||
}
|
||
for (var d = r + 1, p = 0; p < n; ++p)
|
||
for (var m = (p + 0) * d, v = (p + 1) * d, g = 0; g < r; ++g) {
|
||
var y = m + g,
|
||
_ = v + g;
|
||
u.push(y, y + 1, _), u.push(_, y + 1, _ + 1)
|
||
}
|
||
return i.addAttribute("position", o).addAttribute("normals", s).addAttribute("uvs", a).addIndex(u), i
|
||
}
|
||
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)
|
||
}(PlaneGeometry, b), PlaneGeometry
|
||
}(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)).Geometry);
|
||
e.default = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = function() {
|
||
function Keyboard() {
|
||
this._states = {
|
||
up: 0,
|
||
down: 1
|
||
}, this._keyCodes = {
|
||
37: {
|
||
label: "left",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
38: {
|
||
label: "up",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
39: {
|
||
label: "right",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
40: {
|
||
label: "down",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
49: {
|
||
label: "1",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
50: {
|
||
label: "2",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
51: {
|
||
label: "3",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
52: {
|
||
label: "4",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
53: {
|
||
label: "5",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
54: {
|
||
label: "6",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
55: {
|
||
label: "7",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
56: {
|
||
label: "8",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
57: {
|
||
label: "9",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
97: {
|
||
label: "numpad1",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
98: {
|
||
label: "numpad2",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
99: {
|
||
label: "numpad3",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
100: {
|
||
label: "numpad4",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
101: {
|
||
label: "numpad5",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
102: {
|
||
label: "numpad6",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
103: {
|
||
label: "numpad7",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
104: {
|
||
label: "numpad8",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
105: {
|
||
label: "numpad9",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
13: {
|
||
label: "enter",
|
||
state: 0,
|
||
preventBubble: !1
|
||
},
|
||
32: {
|
||
label: "space",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
65: {
|
||
label: "a",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
68: {
|
||
label: "d",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
83: {
|
||
label: "s",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
87: {
|
||
label: "w",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
89: {
|
||
label: "y",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
90: {
|
||
label: "z",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
88: {
|
||
label: "x",
|
||
state: 0,
|
||
preventBubble: !0
|
||
},
|
||
70: {
|
||
label: "f",
|
||
state: 0,
|
||
preventBubble: !0
|
||
}
|
||
}, this.hash = {}, this.hashUp = {}, this.started = !1, this.disabled = !1, this.start(), this.dirty = !1
|
||
}
|
||
var t = Keyboard.prototype;
|
||
return t.start = function() {
|
||
if (!this.started) {
|
||
this.started = !0;
|
||
var e = this;
|
||
this._onKeyDown = function(t) {
|
||
return e.processKeyDown(t)
|
||
}, this._onKeyUp = function(t) {
|
||
return e.processKeyUp(t)
|
||
}, window.addEventListener("keydown", this._onKeyDown, !1), window.addEventListener("keyup", this._onKeyUp, !1), window.addEventListener("blur", function() {
|
||
for (var t in this._keyCodes) this._keyCodes[t].state = 0
|
||
}.bind(this))
|
||
}
|
||
}, t.stop = function() {
|
||
if (this.started) {
|
||
for (var t in this.started = !1, this._keyCodes) this._keyCodes[t].state = this._states.up;
|
||
this.dirty = !0, window.removeEventListener("keydown", this._onKeyDown), window.removeEventListener("keyup", this._onKeyUp)
|
||
}
|
||
}, t.processKeyDown = function(t) {
|
||
if (!0 !== this.disabled) {
|
||
var e = t.keyCode;
|
||
if (this.keyCode = e, this._keyCodes.hasOwnProperty(e)) {
|
||
var r = this._keyCodes[e];
|
||
r.preventBubble && t.preventDefault(), r.state != this._states.down && (r.state = this._states.down, this.dirty = !0, this.hash[r.label] && this.hash[r.label](r))
|
||
}
|
||
}
|
||
}, t.processKeyUp = function(t) {
|
||
if (!0 !== this.disabled) {
|
||
var e = t.keyCode;
|
||
if (this.keyCode = null, this._keyCodes.hasOwnProperty(e)) {
|
||
var r = this._keyCodes[e];
|
||
r.preventBubble && t.preventDefault(), r.state != this._states.up && (r.state = this._states.up, this.dirty = !0, this.hashUp[r.label] && this.hashUp[r.label](r))
|
||
}
|
||
}
|
||
}, t.isPressed = function(t) {
|
||
var e = this.getCodeFromLabel(t);
|
||
return !!e && this._keyCodes[e].state === this._states.down
|
||
}, t.getCodeFromLabel = function(t) {
|
||
for (var e in this._keyCodes)
|
||
if (this._keyCodes[e].label === t) return e;
|
||
return !1
|
||
}, t.onKeyPress = function(t, e) {
|
||
this.hash[t] = e
|
||
}, t.onKeyRelease = function(t, e) {
|
||
this.hashUp[t] = e
|
||
}, Keyboard
|
||
}();
|
||
e.a = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r.d(e, "a", function() {
|
||
return n
|
||
});
|
||
var a = r(4),
|
||
s = (r(67), a.mat4.create()),
|
||
n = function() {
|
||
function SkinController(t, e) {
|
||
this.geometry = t, this.skeleton = e, this.bones = new Float32Array(16 * e.totalBones), this.bonesMat4 = [];
|
||
for (var r = 0; r < this.geometry.bones.length; r++) this.bonesMat4[r] = a.mat4.create()
|
||
}
|
||
return SkinController.prototype.update = function() {
|
||
for (var t = this.geometry, e = 0; e < this.geometry.bones.length; e++) {
|
||
var r = t.bones[e][0],
|
||
n = t.bones[e][1],
|
||
i = this.skeleton.hash[r].worldMatrix;
|
||
a.mat4.multiply(s, i, n);
|
||
for (var o = 0; o < 16; o++) this.bones[16 * e + o] = s[o];
|
||
a.mat4.copy(this.bonesMat4[e], s)
|
||
}
|
||
}, SkinController
|
||
}()
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var g = r(2),
|
||
w = r(16),
|
||
o = function() {
|
||
function GeometryParser(t) {
|
||
this.context = t
|
||
}
|
||
var t = GeometryParser.prototype;
|
||
return t.parse = function(t) {
|
||
var e = this.context.connections,
|
||
r = this.context.fbxTree,
|
||
n = new Map;
|
||
if ("Geometry" in r.Objects) {
|
||
var i = r.Objects.Geometry;
|
||
for (var o in i) {
|
||
var a = e.get(parseInt(o)),
|
||
s = this.parseGeometry(a, i[o], t);
|
||
n.set(parseInt(o), s)
|
||
}
|
||
}
|
||
return n
|
||
}, t.parseGeometry = function(t, e, r) {
|
||
switch (e.attrType) {
|
||
case "Mesh":
|
||
return this.parseMeshGeometry(t, e, r);
|
||
case "NurbsCurve":
|
||
return this.parseNurbsGeometry(e)
|
||
}
|
||
}, t.parseMeshGeometry = function(t, e, r) {
|
||
var n = this.context.fbxTree,
|
||
i = r.skeletons,
|
||
o = r.morphTargets,
|
||
a = t.parents.map(function(t) {
|
||
return n.Objects.Model[t.ID]
|
||
});
|
||
if (0 !== a.length) {
|
||
var s = t.children.reduce(function(t, e) {
|
||
return void 0 !== i[e.ID] && (t = i[e.ID]), t
|
||
}, null),
|
||
u = t.children.reduce(function(t, e) {
|
||
return void 0 !== o[e.ID] && (t = o[e.ID]), t
|
||
}, null),
|
||
h = a[0],
|
||
c = {};
|
||
"RotationOrder" in h && (c.eulerOrder = Object(w.f)(h.RotationOrder.value)), "InheritType" in h && (c.inheritType = parseInt(h.InheritType.value)), "GeometricTranslation" in h && (c.translation = h.GeometricTranslation.value), "GeometricRotation" in h && (c.rotation = h.GeometricRotation.value), "GeometricScaling" in h && (c.scale = h.GeometricScaling.value);
|
||
var l = Object(w.d)(c);
|
||
return this.genGeometry(e, s, u, l)
|
||
}
|
||
}, t.genGeometry = function(t, e, r, n) {
|
||
var i = new g.f;
|
||
t.attrName && (i.name = t.attrName);
|
||
var o = this.parseGeoNode(t, e),
|
||
a = this.genBuffers(o),
|
||
s = new g.l(a.vertex, 3);
|
||
if (n.applyToBufferAttribute(s), i.addAttribute("position", s), 0 < a.colors.length && i.addAttribute("color", new g.l(a.colors, 3)), e && (i.addAttribute("skinIndex", new g.O(a.weightsIndices, 4)), i.addAttribute("skinWeight", new g.l(a.vertexWeights, 4)), i.FBX_Deformer = e), 0 < a.normal.length) {
|
||
var u = new g.l(a.normal, 3);
|
||
(new g.u).getNormalMatrix(n).applyToBufferAttribute(u), i.addAttribute("normal", u)
|
||
}
|
||
if (a.uvs.forEach(function(t, e) {
|
||
var r = "uv" + (e + 1).toString();
|
||
0 === e && (r = "uv"), i.addAttribute(r, new g.l(a.uvs[e], 2))
|
||
}), o.material && "AllSame" !== o.material.mappingType) {
|
||
var h = a.materialIndex[0],
|
||
c = 0;
|
||
if (a.materialIndex.forEach(function(t, e) {
|
||
t !== h && (i.addGroup(c, e - c, h), h = t, c = e)
|
||
}), 0 < i.groups.length) {
|
||
var l = i.groups[i.groups.length - 1],
|
||
f = l.start + l.count;
|
||
f !== a.materialIndex.length && i.addGroup(f, a.materialIndex.length - f, h)
|
||
}
|
||
0 === i.groups.length && i.addGroup(0, a.materialIndex.length, a.materialIndex[0])
|
||
}
|
||
return this.addMorphTargets(i, t, r, n), i
|
||
}, t.parseGeoNode = function(t, e) {
|
||
var i = {};
|
||
if (i.vertexPositions = void 0 !== t.Vertices ? t.Vertices.a : [], i.vertexIndices = void 0 !== t.PolygonVertexIndex ? t.PolygonVertexIndex.a : [], t.LayerElementColor && (i.color = this.parseVertexColors(t.LayerElementColor[0])), t.LayerElementMaterial && (i.material = this.parseMaterialIndices(t.LayerElementMaterial[0])), t.LayerElementNormal && (i.normal = this.parseNormals(t.LayerElementNormal[0])), t.LayerElementUV) {
|
||
i.uv = [];
|
||
for (var r = 0; t.LayerElementUV[r];) i.uv.push(this.parseUVs(t.LayerElementUV[r])), r++
|
||
}
|
||
return i.weightTable = {}, null !== e && (i.skeleton = e).rawBones.forEach(function(r, n) {
|
||
r.indices.forEach(function(t, e) {
|
||
void 0 === i.weightTable[t] && (i.weightTable[t] = []), i.weightTable[t].push({
|
||
id: n,
|
||
weight: r.weights[e]
|
||
})
|
||
})
|
||
}), i
|
||
}, t.genBuffers = function(u) {
|
||
var h = {
|
||
vertex: [],
|
||
normal: [],
|
||
colors: [],
|
||
uvs: [],
|
||
materialIndex: [],
|
||
vertexWeights: [],
|
||
weightsIndices: []
|
||
},
|
||
c = 0,
|
||
l = 0,
|
||
f = !1,
|
||
d = [],
|
||
p = [],
|
||
m = [],
|
||
v = [],
|
||
g = [],
|
||
y = [],
|
||
_ = -1,
|
||
b = null,
|
||
x = this;
|
||
return u.vertexIndices.forEach(function(n, i) {
|
||
var t = !1;
|
||
n < 0 && (n ^= -1, t = !0);
|
||
var r = [],
|
||
e = [];
|
||
if (d.push(3 * n, 3 * n + 1, 3 * n + 2), u.color && (b = Object(w.e)(i, c, n, u.color), m.push(b[0], b[1], b[2])), u.skeleton) {
|
||
if (void 0 !== u.weightTable[n] && u.weightTable[n].forEach(function(t) {
|
||
e.push(t.weight), r.push(t.id)
|
||
}), 4 < e.length) {
|
||
f || (f = !0);
|
||
var a = [0, 0, 0, 0],
|
||
s = [0, 0, 0, 0];
|
||
e.forEach(function(t, e) {
|
||
var i = t,
|
||
o = r[e];
|
||
s.forEach(function(t, e, r) {
|
||
if (t < i) {
|
||
r[e] = i, i = t;
|
||
var n = a[e];
|
||
a[e] = o, o = n
|
||
}
|
||
})
|
||
}), r = a, e = s
|
||
}
|
||
for (; e.length < 4;) e.push(0), r.push(0);
|
||
for (var o = 0; o < 4; ++o) g.push(e[o]), y.push(r[o])
|
||
}
|
||
u.normal && (b = Object(w.e)(i, c, n, u.normal), p.push(b[0], b[1], b[2])), u.material && "AllSame" !== u.material.mappingType && (_ = Object(w.e)(i, c, n, u.material)[0]), u.uv && u.uv.forEach(function(t, e) {
|
||
var r = Object(w.e)(i, c, n, t);
|
||
void 0 === v[e] && (v[e] = []), v[e].push(r[0]), v[e].push(r[1])
|
||
}), l++, t && (x.genFace(h, u, d, _, p, m, v, g, y, l), c++, l = 0, d = [], p = [], m = [], v = [], g = [], y = [])
|
||
}), h
|
||
}, t.genFace = function(n, t, e, i, o, a, s, u, h, r) {
|
||
for (var c = function(r) {
|
||
n.vertex.push(t.vertexPositions[e[0]]), n.vertex.push(t.vertexPositions[e[1]]), n.vertex.push(t.vertexPositions[e[2]]), n.vertex.push(t.vertexPositions[e[3 * (r - 1)]]), n.vertex.push(t.vertexPositions[e[3 * (r - 1) + 1]]), n.vertex.push(t.vertexPositions[e[3 * (r - 1) + 2]]), n.vertex.push(t.vertexPositions[e[3 * r]]), n.vertex.push(t.vertexPositions[e[3 * r + 1]]), n.vertex.push(t.vertexPositions[e[3 * r + 2]]), t.skeleton && (n.vertexWeights.push(u[0]), n.vertexWeights.push(u[1]), n.vertexWeights.push(u[2]), n.vertexWeights.push(u[3]), n.vertexWeights.push(u[4 * (r - 1)]), n.vertexWeights.push(u[4 * (r - 1) + 1]), n.vertexWeights.push(u[4 * (r - 1) + 2]), n.vertexWeights.push(u[4 * (r - 1) + 3]), n.vertexWeights.push(u[4 * r]), n.vertexWeights.push(u[4 * r + 1]), n.vertexWeights.push(u[4 * r + 2]), n.vertexWeights.push(u[4 * r + 3]), n.weightsIndices.push(h[0]), n.weightsIndices.push(h[1]), n.weightsIndices.push(h[2]), n.weightsIndices.push(h[3]), n.weightsIndices.push(h[4 * (r - 1)]), n.weightsIndices.push(h[4 * (r - 1) + 1]), n.weightsIndices.push(h[4 * (r - 1) + 2]), n.weightsIndices.push(h[4 * (r - 1) + 3]), n.weightsIndices.push(h[4 * r]), n.weightsIndices.push(h[4 * r + 1]), n.weightsIndices.push(h[4 * r + 2]), n.weightsIndices.push(h[4 * r + 3])), t.color && (n.colors.push(a[0]), n.colors.push(a[1]), n.colors.push(a[2]), n.colors.push(a[3 * (r - 1)]), n.colors.push(a[3 * (r - 1) + 1]), n.colors.push(a[3 * (r - 1) + 2]), n.colors.push(a[3 * r]), n.colors.push(a[3 * r + 1]), n.colors.push(a[3 * r + 2])), t.material && "AllSame" !== t.material.mappingType && (n.materialIndex.push(i), n.materialIndex.push(i), n.materialIndex.push(i)), t.normal && (n.normal.push(o[0]), n.normal.push(o[1]), n.normal.push(o[2]), n.normal.push(o[3 * (r - 1)]), n.normal.push(o[3 * (r - 1) + 1]), n.normal.push(o[3 * (r - 1) + 2]), n.normal.push(o[3 * r]), n.normal.push(o[3 * r + 1]), n.normal.push(o[3 * r + 2])), t.uv && t.uv.forEach(function(t, e) {
|
||
void 0 === n.uvs[e] && (n.uvs[e] = []), n.uvs[e].push(s[e][0]), n.uvs[e].push(s[e][1]), n.uvs[e].push(s[e][2 * (r - 1)]), n.uvs[e].push(s[e][2 * (r - 1) + 1]), n.uvs[e].push(s[e][2 * r]), n.uvs[e].push(s[e][2 * r + 1])
|
||
})
|
||
}, l = 2; l < r; l++) c(l)
|
||
}, t.addMorphTargets = function(r, n, t, i) {
|
||
if (null !== t) {
|
||
var o = this.context.fbxTree;
|
||
r.morphAttributes.position = [];
|
||
var a = this;
|
||
t.rawTargets.forEach(function(t) {
|
||
var e = o.Objects.Geometry[t.geoID];
|
||
void 0 !== e && a.genMorphGeometry(r, n, e, i, t.name)
|
||
})
|
||
}
|
||
}, t.genMorphGeometry = function(t, e, r, n, i) {
|
||
for (var o = void 0 !== e.PolygonVertexIndex ? e.PolygonVertexIndex.a : [], a = void 0 !== e.Vertices ? e.Vertices.a.slice() : [], s = void 0 !== r.Vertices ? r.Vertices.a : [], u = void 0 !== r.Indexes ? r.Indexes.a : [], h = 0; h < u.length; h++) {
|
||
var c = 3 * u[h];
|
||
a[c] += s[3 * h], a[c + 1] += s[3 * h + 1], a[c + 2] += s[3 * h + 2]
|
||
}
|
||
var l = {
|
||
vertexIndices: o,
|
||
vertexPositions: a
|
||
},
|
||
f = this.genBuffers(l),
|
||
d = new g.l(f.vertex, 3);
|
||
d.name = i || r.attrName, n.applyToBufferAttribute(d), t.morphAttributes.position.push(d)
|
||
}, t.parseNormals = function(t) {
|
||
var e = t.MappingInformationType,
|
||
r = t.ReferenceInformationType,
|
||
n = t.Normals.a,
|
||
i = [];
|
||
return "IndexToDirect" === r && ("NormalIndex" in t ? i = t.NormalIndex.a : "NormalsIndex" in t && (i = t.NormalsIndex.a)), {
|
||
dataSize: 3,
|
||
buffer: n,
|
||
indices: i,
|
||
mappingType: e,
|
||
referenceType: r
|
||
}
|
||
}, t.parseUVs = function(t) {
|
||
var e = t.MappingInformationType,
|
||
r = t.ReferenceInformationType,
|
||
n = t.UV.a,
|
||
i = [];
|
||
return "IndexToDirect" === r && (i = t.UVIndex.a), {
|
||
dataSize: 2,
|
||
buffer: n,
|
||
indices: i,
|
||
mappingType: e,
|
||
referenceType: r
|
||
}
|
||
}, t.parseVertexColors = function(t) {
|
||
var e = t.MappingInformationType,
|
||
r = t.ReferenceInformationType,
|
||
n = t.Colors.a,
|
||
i = [];
|
||
return "IndexToDirect" === r && (i = t.ColorIndex.a), {
|
||
dataSize: 4,
|
||
buffer: n,
|
||
indices: i,
|
||
mappingType: e,
|
||
referenceType: r
|
||
}
|
||
}, t.parseMaterialIndices = function(t) {
|
||
var e = t.MappingInformationType,
|
||
r = t.ReferenceInformationType;
|
||
if ("NoMappingInformation" === e) return {
|
||
dataSize: 1,
|
||
buffer: [0],
|
||
indices: [0],
|
||
mappingType: "AllSame",
|
||
referenceType: r
|
||
};
|
||
for (var n = t.Materials.a, i = [], o = 0; o < n.length; ++o) i.push(o);
|
||
return {
|
||
dataSize: 1,
|
||
buffer: n,
|
||
indices: i,
|
||
mappingType: e,
|
||
referenceType: r
|
||
}
|
||
}, t.parseNurbsGeometry = function(t) {
|
||
if (void 0 === g.NURBSCurve) return new g.f;
|
||
var e = parseInt(t.Order);
|
||
if (isNaN(e)) return new g.f;
|
||
for (var r, n, i = e - 1, o = t.KnotVector.a, a = [], s = t.Points.a, u = 0, h = s.length; u < h; u += 4) a.push((new g.Q).fromArray(s, u));
|
||
if ("Closed" === t.Form) a.push(a[0]);
|
||
else if ("Periodic" === t.Form) {
|
||
r = i, n = o.length - 1 - r;
|
||
for (var c = 0; c < i; ++c) a.push(a[c])
|
||
}
|
||
var l = new g.NURBSCurve(i, o, a, r, n).getPoints(7 * a.length),
|
||
f = new Float32Array(3 * l.length);
|
||
l.forEach(function(t, e) {
|
||
t.toArray(f, 3 * e)
|
||
});
|
||
var d = new g.f;
|
||
return d.addAttribute("position", new g.e(f, 3)), d
|
||
}, GeometryParser
|
||
}(),
|
||
h = function() {
|
||
function AnimationParser(t) {
|
||
this.context = t
|
||
}
|
||
var t = AnimationParser.prototype;
|
||
return t.parse = function() {
|
||
var t = [],
|
||
e = this.parseClips();
|
||
if (void 0 !== e) {
|
||
for (var r in e) {
|
||
var n = e[r],
|
||
i = this.addClip(n);
|
||
t.push(i)
|
||
}
|
||
return t
|
||
}
|
||
}, t.parseClips = function() {
|
||
if (void 0 !== this.context.fbxTree.Objects.AnimationCurve) {
|
||
var t = this.parseAnimationCurveNodes();
|
||
this.parseAnimationCurves(t);
|
||
var e = this.parseAnimationLayers(t);
|
||
return this.parseAnimStacks(e)
|
||
}
|
||
}, t.parseAnimationCurveNodes = function() {
|
||
var t = this.context.fbxTree.Objects.AnimationCurveNode,
|
||
e = new Map;
|
||
for (var r in t) {
|
||
var n = t[r];
|
||
if (null !== n.attrName.match(/S|R|T|DeformPercent/)) {
|
||
var i = {
|
||
id: n.id,
|
||
attr: n.attrName,
|
||
curves: {}
|
||
};
|
||
e.set(i.id, i)
|
||
}
|
||
}
|
||
return e
|
||
}, t.parseAnimationCurves = function(t) {
|
||
var e = this.context.fbxTree,
|
||
r = this.context.connections,
|
||
n = e.Objects.AnimationCurve;
|
||
for (var i in n) {
|
||
var o = {
|
||
id: n[i].id,
|
||
times: n[i].KeyTime.a.map(w.c),
|
||
values: n[i].KeyValueFloat.a
|
||
},
|
||
a = r.get(o.id);
|
||
if (void 0 !== a) {
|
||
var s = a.parents[0].ID,
|
||
u = a.parents[0].relationship;
|
||
u.match(/X/) ? t.get(s).curves.x = o : u.match(/Y/) ? t.get(s).curves.y = o : u.match(/Z/) ? t.get(s).curves.z = o : u.match(/d|DeformPercent/) && t.has(s) && (t.get(s).curves.morph = o)
|
||
}
|
||
}
|
||
}, t.parseAnimationLayers = function(d) {
|
||
var p = this.context.fbxTree,
|
||
m = this.context.connections,
|
||
v = this.context.sceneGraph,
|
||
t = p.Objects.AnimationLayer,
|
||
r = new Map,
|
||
e = function(t) {
|
||
var f = [],
|
||
e = m.get(parseInt(t));
|
||
void 0 !== e && (e.children.forEach(function(t, e) {
|
||
if (d.has(t.ID)) {
|
||
var r = d.get(t.ID);
|
||
if (void 0 !== r.curves.x || void 0 !== r.curves.y || void 0 !== r.curves.z) {
|
||
if (void 0 === f[e]) {
|
||
var n = m.get(t.ID).parents.filter(function(t) {
|
||
return void 0 !== t.relationship
|
||
})[0].ID;
|
||
if (void 0 !== n) {
|
||
var i = p.Objects.Model[n.toString()],
|
||
o = {
|
||
modelName: g.F.sanitizeNodeName(i.attrName),
|
||
ID: i.id,
|
||
initialPosition: [0, 0, 0],
|
||
initialRotation: [0, 0, 0],
|
||
initialScale: [1, 1, 1]
|
||
};
|
||
v.traverse(function(t) {
|
||
t.ID === i.id && (o.transform = t.matrix, t.userData.transformData && (o.eulerOrder = t.userData.transformData.eulerOrder))
|
||
}), o.transform || (o.transform = new g.v), "PreRotation" in i && (o.preRotation = i.PreRotation.value), "PostRotation" in i && (o.postRotation = i.PostRotation.value), f[e] = o
|
||
}
|
||
}
|
||
f[e] && (f[e][r.attr] = r)
|
||
} else if (void 0 !== r.curves.morph) {
|
||
if (void 0 === f[e]) {
|
||
var a = m.get(t.ID).parents.filter(function(t) {
|
||
return void 0 !== t.relationship
|
||
})[0].ID,
|
||
s = m.get(a).parents[0].ID,
|
||
u = m.get(s).parents[0].ID,
|
||
h = m.get(u).parents[0].ID,
|
||
c = p.Objects.Model[h];
|
||
if (!p.Objects.Deformer[a]) return;
|
||
var l = {
|
||
modelName: g.F.sanitizeNodeName(c.attrName),
|
||
morphName: p.Objects.Deformer[a].attrName
|
||
};
|
||
f[e] = l
|
||
}
|
||
f[e][r.attr] = r
|
||
}
|
||
}
|
||
}), r.set(parseInt(t), f))
|
||
};
|
||
for (var n in t) e(n);
|
||
return r
|
||
}, t.parseAnimStacks = function(t) {
|
||
var e = this.context.fbxTree,
|
||
r = this.context.connections,
|
||
n = e.Objects.AnimationStack,
|
||
i = {};
|
||
for (var o in n) {
|
||
var a = r.get(parseInt(o)).children;
|
||
a.length;
|
||
var s = t.get(a[0].ID);
|
||
i[o] = {
|
||
name: n[o].attrName,
|
||
layer: s
|
||
}
|
||
}
|
||
return i
|
||
}, t.addClip = function(t) {
|
||
var e = [],
|
||
r = this;
|
||
return t.layer.forEach(function(t) {
|
||
e = e.concat(r.generateTracks(t))
|
||
}), new g.b(t.name, -1, e)
|
||
}, t.generateTracks = function(t) {
|
||
var e = [],
|
||
r = new g.P,
|
||
n = new g.G,
|
||
i = new g.P;
|
||
if (t.transform && t.transform.decompose(r, n, i), r = r.toArray(), n = (new g.k).setFromQuaternion(n, t.eulerOrder).toArray(), i = i.toArray(), void 0 !== t.T && 0 < Object.keys(t.T.curves).length) {
|
||
var o = this.generateVectorTrack(t.modelName, t.T.curves, r, "position");
|
||
void 0 !== o && e.push(o)
|
||
}
|
||
if (void 0 !== t.R && 0 < Object.keys(t.R.curves).length) {
|
||
var a = this.generateRotationTrack(t.modelName, t.R.curves, n, t.preRotation, t.postRotation, t.eulerOrder);
|
||
void 0 !== a && e.push(a)
|
||
}
|
||
if (void 0 !== t.S && 0 < Object.keys(t.S.curves).length) {
|
||
var s = this.generateVectorTrack(t.modelName, t.S.curves, i, "scale");
|
||
void 0 !== s && e.push(s)
|
||
}
|
||
if (void 0 !== t.DeformPercent) {
|
||
var u = this.generateMorphTrack(t);
|
||
void 0 !== u && e.push(u)
|
||
}
|
||
return e
|
||
}, t.generateVectorTrack = function(t, e, r, n) {
|
||
var i = this.getTimesForAllAxes(e),
|
||
o = this.getKeyframeTrackValues(i, e, r);
|
||
return new g.R(t + "." + n, i, o)
|
||
}, t.generateRotationTrack = function(t, e, r, n, i, o) {
|
||
void 0 !== e.x && (this.interpolateRotations(e.x), e.x.values = e.x.values.map(g.t.degToRad)), void 0 !== e.y && (this.interpolateRotations(e.y), e.y.values = e.y.values.map(g.t.degToRad)), void 0 !== e.z && (this.interpolateRotations(e.z), e.z.values = e.z.values.map(g.t.degToRad));
|
||
var a = this.getTimesForAllAxes(e),
|
||
s = this.getKeyframeTrackValues(a, e, r);
|
||
void 0 !== n && ((n = n.map(g.t.degToRad)).push(o), n = (new g.k).fromArray(n), n = (new g.G).setFromEuler(n)), void 0 !== i && ((i = i.map(g.t.degToRad)).push(o), i = (new g.k).fromArray(i), i = (new g.G).setFromEuler(i).inverse());
|
||
for (var u = new g.G, h = new g.k, c = [], l = 0; l < s.length; l += 3) h.set(s[l], s[l + 1], s[l + 2], o), u.setFromEuler(h), void 0 !== n && u.premultiply(n), void 0 !== i && u.multiply(i), u.toArray(c, l / 3 * 4);
|
||
return new g.H(t + ".quaternion", a, c)
|
||
}, t.generateMorphTrack = function(t) {
|
||
var e = this.context.sceneGraph,
|
||
r = t.DeformPercent.curves.morph,
|
||
n = r.values.map(function(t) {
|
||
return t / 100
|
||
}),
|
||
i = e.getObjectByName(t.modelName).morphTargetDictionary[t.morphName];
|
||
return new g.A(t.modelName + ".morphTargetInfluences[" + i + "]", r.times, n)
|
||
}, t.getTimesForAllAxes = function(t) {
|
||
var e = [];
|
||
return void 0 !== t.x && (e = e.concat(t.x.times)), void 0 !== t.y && (e = e.concat(t.y.times)), void 0 !== t.z && (e = e.concat(t.z.times)), e = e.sort(function(t, e) {
|
||
return t - e
|
||
}).filter(function(t, e, r) {
|
||
return r.indexOf(t) == e
|
||
})
|
||
}, t.getKeyframeTrackValues = function(t, i, e) {
|
||
var o = e,
|
||
a = [],
|
||
s = -1,
|
||
u = -1,
|
||
h = -1;
|
||
return t.forEach(function(t) {
|
||
if (i.x && (s = i.x.times.indexOf(t)), i.y && (u = i.y.times.indexOf(t)), i.z && (h = i.z.times.indexOf(t)), -1 !== s) {
|
||
var e = i.x.values[s];
|
||
a.push(e), o[0] = e
|
||
} else a.push(o[0]);
|
||
if (-1 !== u) {
|
||
var r = i.y.values[u];
|
||
a.push(r), o[1] = r
|
||
} else a.push(o[1]);
|
||
if (-1 !== h) {
|
||
var n = i.z.values[h];
|
||
a.push(n), o[2] = n
|
||
} else a.push(o[2])
|
||
}), a
|
||
}, t.interpolateRotations = function(t) {
|
||
for (var e = 1; e < t.values.length; e++) {
|
||
var r = t.values[e - 1],
|
||
n = t.values[e] - r,
|
||
i = Math.abs(n);
|
||
if (180 <= i) {
|
||
for (var o = i / 180, a = n / o, s = r + a, u = t.times[e - 1], h = (t.times[e] - u) / o, c = u + h, l = [], f = []; c < t.times[e];) l.push(c), c += h, f.push(s), s += a;
|
||
t.times = Object(w.h)(t.times, e, l), t.values = Object(w.h)(t.values, e, f)
|
||
}
|
||
}
|
||
}, AnimationParser
|
||
}();
|
||
r.d(e, "a", function() {
|
||
return n
|
||
});
|
||
var n = function() {
|
||
function FBXTreeParser(t, e) {
|
||
this.context = t, this.textureLoader = e
|
||
}
|
||
var t = FBXTreeParser.prototype;
|
||
return t.parse = function() {
|
||
this.context.connections = this.parseConnections();
|
||
var t = this.parseImages(),
|
||
e = this.parseTextures(t),
|
||
r = this.parseMaterials(e),
|
||
n = this.parseDeformers(),
|
||
i = new o(this.context).parse(n);
|
||
return this.parseScene(n, i, r), this.context.sceneGraph
|
||
}, t.parseConnections = function() {
|
||
var a = new Map,
|
||
t = this.context.fbxTree;
|
||
"Connections" in t && t.Connections.connections.forEach(function(t) {
|
||
var e = t[0],
|
||
r = t[1],
|
||
n = t[2];
|
||
a.has(e) || a.set(e, {
|
||
parents: [],
|
||
children: []
|
||
});
|
||
var i = {
|
||
ID: r,
|
||
relationship: n
|
||
};
|
||
a.get(e).parents.push(i), a.has(r) || a.set(r, {
|
||
parents: [],
|
||
children: []
|
||
});
|
||
var o = {
|
||
ID: e,
|
||
relationship: n
|
||
};
|
||
a.get(r).children.push(o)
|
||
});
|
||
return a
|
||
}, t.parseImages = function() {
|
||
var t = {},
|
||
e = {},
|
||
r = this.context.fbxTree;
|
||
if ("Video" in r.Objects) {
|
||
var n = r.Objects.Video;
|
||
for (var i in n) {
|
||
var o = n[i];
|
||
if (t[parseInt(i)] = o.RelativeFilename || o.Filename, "Content" in o) {
|
||
var a = o.Content instanceof ArrayBuffer && 0 < o.Content.byteLength,
|
||
s = "string" == typeof o.Content && "" !== o.Content;
|
||
if (a || s) {
|
||
var u = this.parseImage(n[i]);
|
||
e[o.RelativeFilename || o.Filename] = u
|
||
}
|
||
}
|
||
}
|
||
}
|
||
for (var h in t) {
|
||
var c = t[h];
|
||
void 0 !== e[c] ? t[h] = e[c] : t[h] = t[h].split("\\").pop()
|
||
}
|
||
return t
|
||
}, t.parseImage = function(t) {
|
||
var e, r = t.Content,
|
||
n = t.RelativeFilename || t.Filename,
|
||
i = n.slice(n.lastIndexOf(".") + 1).toLowerCase();
|
||
switch (i) {
|
||
case "bmp":
|
||
e = "image/bmp";
|
||
break;
|
||
case "jpg":
|
||
case "jpeg":
|
||
e = "image/jpeg";
|
||
break;
|
||
case "png":
|
||
e = "image/png";
|
||
break;
|
||
case "tif":
|
||
e = "image/tiff";
|
||
break;
|
||
case "tga":
|
||
if ("function" != typeof g.TGALoader) return;
|
||
if (null === g.Loader.Handlers.get(".tga")) {
|
||
var o = new g.TGALoader;
|
||
o.setPath(this.textureLoader.path), g.Loader.Handlers.add(/\.tga$/i, o)
|
||
}
|
||
e = "image/tga";
|
||
break;
|
||
default:
|
||
return
|
||
}
|
||
if ("string" == typeof r) return "data:" + e + ";base64," + r;
|
||
var a = new Uint8Array(r);
|
||
return window.URL.createObjectURL(new Blob([a], {
|
||
type: e
|
||
}))
|
||
}, t.parseTextures = function(t) {
|
||
var e = this.context.fbxTree,
|
||
r = new Map;
|
||
if ("Texture" in e.Objects) {
|
||
var n = e.Objects.Texture;
|
||
for (var i in n) {
|
||
var o = this.parseTexture(n[i], t);
|
||
r.set(parseInt(i), o)
|
||
}
|
||
}
|
||
return r
|
||
}, t.parseTexture = function(t, e) {
|
||
var r = this.loadTexture(t, e);
|
||
r.ID = t.id, r.name = t.attrName;
|
||
var n = t.WrapModeU,
|
||
i = t.WrapModeV,
|
||
o = void 0 !== n ? n.value : 0,
|
||
a = void 0 !== i ? i.value : 0;
|
||
if (r.wrapS = 0 === o ? g.I : g.g, r.wrapT = 0 === a ? g.I : g.g, "Scaling" in t) {
|
||
var s = t.Scaling.value;
|
||
r.repeat.x = s[0], r.repeat.y = s[1]
|
||
}
|
||
return r
|
||
}, t.loadTexture = function(t, e) {
|
||
return new g.N
|
||
}, t.parseMaterials = function(t) {
|
||
var e = new Map,
|
||
r = this.context.fbxTree;
|
||
if ("Material" in r.Objects) {
|
||
var n = r.Objects.Material;
|
||
for (var i in n) {
|
||
var o = this.parseMaterial(n[i], t);
|
||
null !== o && e.set(parseInt(i), o)
|
||
}
|
||
}
|
||
return e
|
||
}, t.parseMaterial = function(t, e) {
|
||
var r = this.context.connections,
|
||
n = t.id,
|
||
i = t.attrName,
|
||
o = t.ShadingModel;
|
||
if ("object" == typeof o && (o = o.value), !r.has(n)) return null;
|
||
var a, s = this.parseParameters(t, e, n);
|
||
switch (o.toLowerCase()) {
|
||
case "phong":
|
||
a = new g.y;
|
||
break;
|
||
case "lambert":
|
||
a = new g.x;
|
||
break;
|
||
default:
|
||
a = new g.y({
|
||
color: 3342591
|
||
})
|
||
}
|
||
return a.setValues(s), a.name = i, a
|
||
}, t.parseParameters = function(t, r, e) {
|
||
var n = this.context.connections,
|
||
i = {};
|
||
t.BumpFactor && (i.bumpScale = t.BumpFactor.value), t.Diffuse ? i.color = (new g.h).fromArray(t.Diffuse.value) : t.DiffuseColor && "Color" === t.DiffuseColor.type && (i.color = (new g.h).fromArray(t.DiffuseColor.value)), t.DisplacementFactor && (i.displacementScale = t.DisplacementFactor.value), t.Emissive ? i.emissive = (new g.h).fromArray(t.Emissive.value) : t.EmissiveColor && "Color" === t.EmissiveColor.type && (i.emissive = (new g.h).fromArray(t.EmissiveColor.value)), t.EmissiveFactor && (i.emissiveIntensity = parseFloat(t.EmissiveFactor.value)), t.Opacity && (i.opacity = parseFloat(t.Opacity.value)), i.opacity < 1 && (i.transparent = !0), t.ReflectionFactor && (i.reflectivity = t.ReflectionFactor.value), t.Shininess && (i.shininess = t.Shininess.value), t.Specular ? i.specular = (new g.h).fromArray(t.Specular.value) : t.SpecularColor && "Color" === t.SpecularColor.type && (i.specular = (new g.h).fromArray(t.SpecularColor.value));
|
||
var o = this;
|
||
return n.get(e).children.forEach(function(t) {
|
||
var e = t.relationship;
|
||
switch (e) {
|
||
case "Bump":
|
||
i.bumpMap = o.getTexture(r, t.ID);
|
||
break;
|
||
case "DiffuseColor":
|
||
i.map = o.getTexture(r, t.ID);
|
||
break;
|
||
case "DisplacementColor":
|
||
i.displacementMap = o.getTexture(r, t.ID);
|
||
break;
|
||
case "EmissiveColor":
|
||
i.emissiveMap = o.getTexture(r, t.ID);
|
||
break;
|
||
case "NormalMap":
|
||
i.normalMap = o.getTexture(r, t.ID);
|
||
break;
|
||
case "ReflectionColor":
|
||
i.envMap = o.getTexture(r, t.ID), i.envMap.mapping = g.EquirectangularReflectionMapping;
|
||
break;
|
||
case "SpecularColor":
|
||
i.specularMap = o.getTexture(r, t.ID);
|
||
break;
|
||
case "TransparentColor":
|
||
i.alphaMap = o.getTexture(r, t.ID), i.transparent = !0
|
||
}
|
||
}), i
|
||
}, t.getTexture = function(t, e) {
|
||
var r = this.context.fbxTree,
|
||
n = this.context.connections;
|
||
return "LayeredTexture" in r.Objects && e in r.Objects.LayeredTexture && (e = n.get(e).children[0].ID), t.get(e)
|
||
}, t.parseDeformers = function() {
|
||
var t = {},
|
||
e = {},
|
||
r = this.context.fbxTree,
|
||
n = this.context.connections;
|
||
if ("Deformer" in r.Objects) {
|
||
var i = r.Objects.Deformer;
|
||
for (var o in i) {
|
||
var a = i[o],
|
||
s = n.get(parseInt(o));
|
||
if ("Skin" === a.attrType) {
|
||
var u = this.parseSkeleton(s, i);
|
||
u.ID = o, s.parents.length, u.geometryID = s.parents[0].ID, t[o] = u
|
||
} else if ("BlendShape" === a.attrType) {
|
||
var h = {
|
||
id: o
|
||
};
|
||
h.rawTargets = this.parseMorphTargets(s, i), h.id = o, s.parents.length, e[o] = h
|
||
}
|
||
}
|
||
}
|
||
return {
|
||
skeletons: t,
|
||
morphTargets: e
|
||
}
|
||
}, t.parseSkeleton = function(t, n) {
|
||
var i = [];
|
||
return t.children.forEach(function(t) {
|
||
var e = n[t.ID];
|
||
if ("Cluster" === e.attrType) {
|
||
var r = {
|
||
ID: t.ID,
|
||
indices: [],
|
||
weights: [],
|
||
transformLink: (new g.v).fromArray(e.TransformLink.a)
|
||
};
|
||
"Indexes" in e && (r.indices = e.Indexes.a, r.weights = e.Weights.a), i.push(r)
|
||
}
|
||
}), {
|
||
rawBones: i,
|
||
bones: []
|
||
}
|
||
}, t.parseMorphTargets = function(t, e) {
|
||
for (var r = [], n = this.context.connections, i = 0; i < t.children.length; i++) {
|
||
var o = t.children[i],
|
||
a = e[o.ID],
|
||
s = {
|
||
name: a.attrName,
|
||
initialWeight: a.DeformPercent,
|
||
id: a.id,
|
||
fullWeights: a.FullWeights.a
|
||
};
|
||
if ("BlendShapeChannel" !== a.attrType) return;
|
||
s.geoID = n.get(parseInt(o.ID)).children.filter(function(t) {
|
||
return void 0 === t.relationship
|
||
})[0].ID, r.push(s)
|
||
}
|
||
return r
|
||
}, t.parseScene = function(t, e, r) {
|
||
this.context.sceneGraph = new g.m;
|
||
var n = this.context.sceneGraph,
|
||
i = this.context.connections,
|
||
o = this.parseModels(t.skeletons, e, r),
|
||
a = this.context.fbxTree.Objects.Model,
|
||
s = this;
|
||
o.forEach(function(r) {
|
||
var t = a[r.ID];
|
||
s.setLookAtProperties(r, t), i.get(r.ID).parents.forEach(function(t) {
|
||
var e = o.get(t.ID);
|
||
void 0 !== e && e.add(r)
|
||
}), null === r.parent && n.add(r)
|
||
}), this.bindSkeleton(t.skeletons, e, o), this.createAmbientLight(), this.setupMorphMaterials(), n.traverse(function(t) {
|
||
if (t.userData.transformData) {
|
||
t.parent && (t.userData.transformData.parentMatrixWorld = t.parent.matrix);
|
||
var e = Object(w.d)(t.userData.transformData);
|
||
t.applyMatrix(e)
|
||
}
|
||
});
|
||
var u = new h(this.context).parse();
|
||
1 === n.children.length && n.children[0].isGroup && (n.children[0].animations = u, n = this.context.sceneGraph = n.children[0]), n.animations = u
|
||
}, t.parseModels = function(t, e, r) {
|
||
var n = this.context.fbxTree,
|
||
i = this.context.connections,
|
||
o = new Map,
|
||
a = n.Objects.Model;
|
||
for (var s in a) {
|
||
var u = parseInt(s),
|
||
h = a[s],
|
||
c = i.get(u),
|
||
l = this.buildSkeleton(c, t, u, h.attrName);
|
||
if (!l) {
|
||
switch (h.attrType) {
|
||
case "Mesh":
|
||
l = this.createMesh(c, e, r);
|
||
break;
|
||
case "LimbNode":
|
||
case "Root":
|
||
l = new g.d, "Root" === h.attrType && (l.root = !0);
|
||
break;
|
||
case "Null":
|
||
default:
|
||
l = new g.m
|
||
}
|
||
l.name = g.F.sanitizeNodeName(h.attrName), l.ID = u
|
||
}
|
||
this.getTransformData(l, h), o.set(u, l)
|
||
}
|
||
return o
|
||
}, t.buildSkeleton = function(t, r, o, a) {
|
||
var s = null;
|
||
return t.parents.forEach(function(i) {
|
||
var t = function(t) {
|
||
var n = r[t];
|
||
n.rawBones.forEach(function(t, e) {
|
||
if (t.ID === i.ID) {
|
||
var r = s;
|
||
(s = new g.d).matrixWorld.copy(t.transformLink), s.name = g.F.sanitizeNodeName(a), s.ID = o, n.bones[e] = s, null !== r && s.add(r)
|
||
}
|
||
})
|
||
};
|
||
for (var e in r) t(e)
|
||
}), s
|
||
}, t.createCamera = function(t) {
|
||
var e, r = void 0,
|
||
n = this.context.fbxTree;
|
||
if (t.children.forEach(function(t) {
|
||
var e = n.Objects.NodeAttribute[t.ID];
|
||
void 0 !== e && (r = e)
|
||
}), void 0 === r) e = new g.B;
|
||
else {
|
||
var i = 0;
|
||
void 0 !== r.CameraProjectionType && 1 === r.CameraProjectionType.value && (i = 1);
|
||
var o = 1;
|
||
void 0 !== r.NearPlane && (o = r.NearPlane.value / 1e3);
|
||
var a = 1e3;
|
||
void 0 !== r.FarPlane && (a = r.FarPlane.value / 1e3);
|
||
var s = window.innerWidth,
|
||
u = window.innerHeight;
|
||
void 0 !== r.AspectWidth && void 0 !== r.AspectHeight && (s = r.AspectWidth.value, u = r.AspectHeight.value);
|
||
var h = s / u,
|
||
c = 45;
|
||
void 0 !== r.FieldOfView && (c = r.FieldOfView.value);
|
||
var l = r.FocalLength ? r.FocalLength.value : null;
|
||
switch (i) {
|
||
case 0:
|
||
e = new g.PerspectiveCamera(c, h, o, a), null !== l && e.setFocalLength(l);
|
||
break;
|
||
case 1:
|
||
e = new g.OrthographicCamera(-s / 2, s / 2, u / 2, -u / 2, o, a);
|
||
break;
|
||
default:
|
||
e = new g.B
|
||
}
|
||
}
|
||
return e
|
||
}, t.createLight = function(t) {
|
||
var e, r = void 0,
|
||
n = this.context.fbxTree;
|
||
if (t.children.forEach(function(t) {
|
||
var e = n.Objects.NodeAttribute[t.ID];
|
||
void 0 !== e && (r = e)
|
||
}), void 0 === r) e = new g.B;
|
||
else {
|
||
var i;
|
||
i = void 0 === r.LightType ? 0 : r.LightType.value;
|
||
var o = 16777215;
|
||
void 0 !== r.Color && (o = (new g.h).fromArray(r.Color.value));
|
||
var a = void 0 === r.Intensity ? 1 : r.Intensity.value / 100;
|
||
void 0 !== r.CastLightOnObject && 0 === r.CastLightOnObject.value && (a = 0);
|
||
var s = 0;
|
||
void 0 !== r.FarAttenuationEnd && (s = void 0 !== r.EnableFarAttenuation && 0 === r.EnableFarAttenuation.value ? 0 : r.FarAttenuationEnd.value);
|
||
switch (i) {
|
||
case 0:
|
||
e = new g.PointLight(o, a, s, 1);
|
||
break;
|
||
case 1:
|
||
e = new g.DirectionalLight(o, a);
|
||
break;
|
||
case 2:
|
||
var u = Math.PI / 3;
|
||
void 0 !== r.InnerAngle && (u = g.t.degToRad(r.InnerAngle.value));
|
||
var h = 0;
|
||
void 0 !== r.OuterAngle && (h = g.t.degToRad(r.OuterAngle.value), h = Math.max(h, 1)), e = new g.SpotLight(o, a, s, u, h, 1);
|
||
break;
|
||
default:
|
||
e = new g.PointLight(o, a)
|
||
}
|
||
void 0 !== r.CastShadows && 1 === r.CastShadows.value && (e.castShadow = !0)
|
||
}
|
||
return e
|
||
}, t.createMesh = function(t, e, r) {
|
||
var n, i = null,
|
||
o = null,
|
||
a = [];
|
||
return t.children.forEach(function(t) {
|
||
e.has(t.ID) && (i = e.get(t.ID)), r.has(t.ID) && a.push(r.get(t.ID))
|
||
}), 1 < a.length ? o = a : 0 < a.length ? o = a[0] : (o = new g.y({
|
||
color: 13421772
|
||
}), a.push(o)), "color" in i.attributes && a.forEach(function(t) {
|
||
t.vertexColors = g.S
|
||
}), i.FBX_Deformer ? (a.forEach(function(t) {
|
||
t.skinning = !0
|
||
}), (n = new g.K(i, o)).normalizeSkinWeights()) : n = new g.w(i, o), n
|
||
}, t.createCurve = function(t, r) {
|
||
var e = t.children.reduce(function(t, e) {
|
||
return r.has(e.ID) && (t = r.get(e.ID)), t
|
||
}, null),
|
||
n = new g.LineBasicMaterial({
|
||
color: 3342591,
|
||
linewidth: 1
|
||
});
|
||
return new g.Line(e, n)
|
||
}, t.getTransformData = function(t, e) {
|
||
var r = {};
|
||
"InheritType" in e && (r.inheritType = parseInt(e.InheritType.value)), r.eulerOrder = "RotationOrder" in e ? Object(w.f)(e.RotationOrder.value) : "ZYX", "Lcl_Translation" in e && (r.translation = e.Lcl_Translation.value), "PreRotation" in e && (r.preRotation = e.PreRotation.value), "Lcl_Rotation" in e && (r.rotation = e.Lcl_Rotation.value), "PostRotation" in e && (r.postRotation = e.PostRotation.value), "Lcl_Scaling" in e && (r.scale = e.Lcl_Scaling.value), "ScalingOffset" in e && (r.scalingOffset = e.ScalingOffset.value), "ScalingPivot" in e && (r.scalingPivot = e.ScalingPivot.value), "RotationOffset" in e && (r.rotationOffset = e.RotationOffset.value), "RotationPivot" in e && (r.rotationPivot = e.RotationPivot.value), t.userData.transformData = r
|
||
}, t.setLookAtProperties = function(n, t) {
|
||
var i = this.context.fbxTree,
|
||
e = this.context.connections,
|
||
o = this.context.sceneGraph;
|
||
"LookAtProperty" in t && e.get(n.ID).children.forEach(function(t) {
|
||
if ("LookAtProperty" === t.relationship) {
|
||
var e = i.Objects.Model[t.ID];
|
||
if ("Lcl_Translation" in e) {
|
||
var r = e.Lcl_Translation.value;
|
||
void 0 !== n.target ? (n.target.position.fromArray(r), o.add(n.target)) : n.lookAt((new g.P).fromArray(r))
|
||
}
|
||
}
|
||
})
|
||
}, t.bindSkeleton = function(e, n, i) {
|
||
var o = this.context.connections,
|
||
a = this.parsePoseNodes(),
|
||
t = function(t) {
|
||
var r = e[t];
|
||
o.get(parseInt(r.ID)).parents.forEach(function(t) {
|
||
if (n.has(t.ID)) {
|
||
var e = t.ID;
|
||
o.get(e).parents.forEach(function(t) {
|
||
i.has(t.ID) && i.get(t.ID).bind(new g.J(r.bones), a[t.ID])
|
||
})
|
||
}
|
||
})
|
||
};
|
||
for (var r in e) t(r)
|
||
}, t.parsePoseNodes = function() {
|
||
var t = this.context.fbxTree,
|
||
e = {};
|
||
if ("Pose" in t.Objects) {
|
||
var r = t.Objects.Pose;
|
||
for (var n in r)
|
||
if ("BindPose" === r[n].attrType) {
|
||
var i = r[n].PoseNode;
|
||
Array.isArray(i) ? i.forEach(function(t) {
|
||
e[t.Node] = (new g.v).fromArray(t.Matrix.a)
|
||
}) : e[i.Node] = (new g.v).fromArray(i.Matrix.a)
|
||
}
|
||
}
|
||
return e
|
||
}, t.createAmbientLight = function() {
|
||
var t = this.context.fbxTree,
|
||
e = this.context.sceneGraph;
|
||
if ("GlobalSettings" in t && "AmbientColor" in t.GlobalSettings) {
|
||
var r = t.GlobalSettings.AmbientColor.value,
|
||
n = r[0],
|
||
i = r[1],
|
||
o = r[2];
|
||
if (0 !== n || 0 !== i || 0 !== o) {
|
||
var a = new g.h(n, i, o);
|
||
e.add(new g.AmbientLight(a, 1))
|
||
}
|
||
}
|
||
}, t.setupMorphMaterials = function() {
|
||
var t = this.context.sceneGraph,
|
||
n = this;
|
||
t.traverse(function(r) {
|
||
r.isMesh && r.geometry.morphAttributes.position && r.geometry.morphAttributes.position.length && (Array.isArray(r.material) ? r.material.forEach(function(t, e) {
|
||
n.setupMorphMaterial(r, t, e)
|
||
}) : n.setupMorphMaterial(r, r.material))
|
||
})
|
||
}, t.setupMorphMaterial = function(t, e, r) {
|
||
var n = t.uuid,
|
||
i = e.uuid,
|
||
o = this.context.sceneGraph,
|
||
a = !1;
|
||
if (o.traverse(function(e) {
|
||
e.isMesh && (Array.isArray(e.material) ? e.material.forEach(function(t) {
|
||
t.uuid === i && e.uuid !== n && (a = !0)
|
||
}) : e.material.uuid === i && e.uuid !== n && (a = !0))
|
||
}), !0 === a) {
|
||
if (e.clone) {
|
||
var s = e.clone();
|
||
s.morphTargets = !0, void 0 === r ? t.material = s : t.material[r] = s
|
||
}
|
||
} else e.morphTargets = !0
|
||
}, FBXTreeParser
|
||
}()
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var p = r(0),
|
||
n = r(45),
|
||
i = r.n(n),
|
||
o = r(92),
|
||
a = r.n(o),
|
||
s = r(3),
|
||
u = r.n(s),
|
||
m = r(4),
|
||
v = r(73),
|
||
g = (r(67), r(2)),
|
||
y = r(95),
|
||
h = r(193),
|
||
c = r.n(h),
|
||
l = r(194),
|
||
f = r.n(l);
|
||
|
||
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 _ = function(n) {
|
||
var t, e, r, i, o;
|
||
|
||
function SkinMaterial(t, e) {
|
||
var r = p.UniformGroup.from({
|
||
bones: e.bones,
|
||
diffuse: t
|
||
});
|
||
return n.call(this, p.Program.from(f.a, c.a, "skinned-shader"), r) || this
|
||
}
|
||
return e = n, (t = SkinMaterial).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e, r = SkinMaterial, (i = [{
|
||
key: "map",
|
||
set: function(t) {
|
||
this.uniforms.diffuse = t
|
||
},
|
||
get: function() {
|
||
return this.uniforms.diffuse
|
||
}
|
||
}]) && _defineProperties(r.prototype, i), o && _defineProperties(r, o), SkinMaterial
|
||
}(p.Shader);
|
||
r.d(e, "a", function() {
|
||
return x
|
||
});
|
||
var d = new a.a,
|
||
b = new i.a({
|
||
color: 16711680,
|
||
instancing: !0
|
||
}),
|
||
x = (u.a, function() {
|
||
function PixiFBXContext() {
|
||
this.fbxTree = null, this.connections = null, this.sceneGraph = null, this.pixiTree = null, this.pixiNodes = {}, this.threeNodes = {}, this.threeSkeletons = [], this.mixer = null, this.pixiMeshes = []
|
||
}
|
||
var t = PixiFBXContext.prototype;
|
||
return t.convertMesh = function(t) {
|
||
var e = t.material,
|
||
r = t.geometry,
|
||
n = new p.Geometry;
|
||
for (var i in r.attributes) {
|
||
var o = r.attributes[i],
|
||
a = i.replace("uv", "uvs").replace("normal", "normals").replace("skinWeight", "weights").replace("skinIndex", "bone_indices");
|
||
n.addAttribute(a, o.array, o.itemSize, void 0, o instanceof g.O ? p.TYPES.UNSIGNED_SHORT : p.TYPES.FLOAT)
|
||
}
|
||
if (!t.skeleton) return {
|
||
geometry: n,
|
||
material: e
|
||
};
|
||
var s = new v.a,
|
||
u = t.skeleton.bones;
|
||
this.threeSkeletons.push(t.skeleton);
|
||
for (var h = [], c = 0; c < u.length; c++) {
|
||
var l = u[c];
|
||
l.pixiMat4 = m.mat4.create(), l.matrixWorld.toArray(l.pixiMat4, 0);
|
||
var f = m.mat4.create();
|
||
t.skeleton.boneInverses[c].toArray(f), h.push([l.id, f]), s.hash[l.id] = {
|
||
worldMatrix: l.pixiMat4
|
||
}
|
||
}
|
||
n.bones = h, s.totalBones = h.length, n.skinController = new y.a(n, s), n.skinController.update();
|
||
var d = {
|
||
geometry: n,
|
||
material: e = new _(p.Texture.WHITE, n.skinController)
|
||
};
|
||
return this.pixiMeshes.push(d), d
|
||
}, t.convertObject3D = function(t) {
|
||
var e = null;
|
||
(e = t.isBone ? new u.a : t.isMesh || t.isSkinnedMesh ? new u.a(this.convertMesh(t)) : new u.a).__name = t.name, e.name = t.name, this.pixiNodes[t.id] = e, this.threeNodes[t.id] = t, e.syncId = t.id;
|
||
for (var r = 0; r < t.children.length; r++) e.addChild(this.convertObject3D(t.children[r]));
|
||
return e
|
||
}, t.syncTree = function(t) {
|
||
var e = this.pixiNodes[t.id];
|
||
if (e && e.syncId) {
|
||
var r = e.transform;
|
||
r.position.copyFrom(t.position), r.scale.copyFrom(t.scale), t.quaternion.toArray(r.quat, 0), r._rotationDirty = !1, r._localID++
|
||
}
|
||
t.pixiMat4 && t.matrixWorld.toArray(t.pixiMat4);
|
||
for (var n = 0; n < t.children.length; n++) this.syncTree(t.children[n])
|
||
}, t.syncToPixi = function() {
|
||
this.sceneGraph.updateMatrixWorld(), this.syncTree(this.sceneGraph);
|
||
for (var t = 0, e = this.pixiMeshes.length; t < e; t++) {
|
||
var r = this.pixiMeshes[t];
|
||
r.geometry && r.geometry.skinController && r.geometry.skinController.update()
|
||
}
|
||
}, t.convertScene = function() {
|
||
return this.sceneGraph.updateMatrixWorld(), this.pixiTree = this.convertObject3D(this.sceneGraph), this.syncTree(this.sceneGraph), this.pixiTree
|
||
}, t.initMixer = function() {
|
||
this.mixer || (this.mixer = new g.c(this.sceneGraph))
|
||
}, t.startAnim = function(t) {
|
||
this.mixer || this.initMixer();
|
||
var e = this.mixer.clipAction(this.sceneGraph.animations[t]);
|
||
(this.currentAction = e).setLoop(g.s), e.play()
|
||
}, t.pose = function() {
|
||
this.currentAction && (this.currentAction.stop(), this.currentAction = null), this.sceneGraph.updateMatrixWorld(), this.syncTree(this.sceneGraph)
|
||
}, PixiFBXContext
|
||
}())
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = r(9).document,
|
||
o = n(i) && n(i.createElement);
|
||
t.exports = function(t) {
|
||
return o ? i.createElement(t) : {}
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(9),
|
||
i = r(32),
|
||
o = r(49),
|
||
a = r(135),
|
||
s = r(20).f;
|
||
t.exports = function(t) {
|
||
var e = i.Symbol || (i.Symbol = o ? {} : n.Symbol || {});
|
||
"_" == t.charAt(0) || t in e || s(e, t, {
|
||
value: a.f(t)
|
||
})
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(74)("keys"),
|
||
i = r(52);
|
||
t.exports = function(t) {
|
||
return n[t] || (n[t] = i(t))
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")
|
||
}, function(t, e, r) {
|
||
var n = r(9).document;
|
||
t.exports = n && n.documentElement
|
||
}, function(t, e, i) {
|
||
var r = i(11),
|
||
n = i(6),
|
||
o = function(t, e) {
|
||
if (n(t), !r(e) && null !== e) throw TypeError(e + ": can't set as prototype!")
|
||
};
|
||
t.exports = {
|
||
set: Object.setPrototypeOf || ("__proto__" in {} ? function(t, r, n) {
|
||
try {
|
||
(n = i(33)(Function.call, i(30).f(Object.prototype, "__proto__").set, 2))(t, []), r = !(t instanceof Array)
|
||
} catch (t) {
|
||
r = !0
|
||
}
|
||
return function(t, e) {
|
||
return o(t, e), r ? t.__proto__ = e : n(t, e), t
|
||
}
|
||
}({}, !1) : void 0),
|
||
check: o
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = "\t\n\v\f\r \u2028\u2029\ufeff"
|
||
}, function(t, e, r) {
|
||
var o = r(11),
|
||
a = r(103).set;
|
||
t.exports = function(t, e, r) {
|
||
var n, i = e.constructor;
|
||
return i !== r && "function" == typeof i && (n = i.prototype) !== r.prototype && o(n) && a && a(t, n), t
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var i = r(35),
|
||
o = r(39);
|
||
t.exports = function(t) {
|
||
var e = String(o(this)),
|
||
r = "",
|
||
n = i(t);
|
||
if (n < 0 || n == 1 / 0) throw RangeError("Count can't be negative");
|
||
for (; 0 < n;
|
||
(n >>>= 1) && (e += e)) 1 & n && (r += e);
|
||
return r
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = Math.sign || function(t) {
|
||
return 0 == (t = +t) || t != t ? t : t < 0 ? -1 : 1
|
||
}
|
||
}, function(t, e) {
|
||
var r = Math.expm1;
|
||
t.exports = !r || 22025.465794806718 < r(10) || r(10) < 22025.465794806718 || -2e-17 != r(-2e-17) ? function(t) {
|
||
return 0 == (t = +t) ? t : -1e-6 < t && t < 1e-6 ? t + t * t / 2 : Math.exp(t) - 1
|
||
} : r
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var _ = r(49),
|
||
b = r(1),
|
||
x = r(26),
|
||
w = r(25),
|
||
T = r(64),
|
||
S = r(110),
|
||
M = r(61),
|
||
E = r(31),
|
||
A = r(15)("iterator"),
|
||
P = !([].keys && "next" in [].keys()),
|
||
I = "values",
|
||
O = function() {
|
||
return this
|
||
};
|
||
t.exports = function(t, e, r, n, i, o, a) {
|
||
S(r, e, n);
|
||
var s, u, h, c = function(t) {
|
||
if (!P && t in p) return p[t];
|
||
switch (t) {
|
||
case "keys":
|
||
case I:
|
||
return function() {
|
||
return new r(this, t)
|
||
}
|
||
}
|
||
return function() {
|
||
return new r(this, t)
|
||
}
|
||
},
|
||
l = e + " Iterator",
|
||
f = i == I,
|
||
d = !1,
|
||
p = t.prototype,
|
||
m = p[A] || p["@@iterator"] || i && p[i],
|
||
v = m || c(i),
|
||
g = i ? f ? c("entries") : v : void 0,
|
||
y = "Array" == e && p.entries || m;
|
||
if (y && (h = E(y.call(new t))) !== Object.prototype && h.next && (M(h, l, !0), _ || "function" == typeof h[A] || w(h, A, O)), f && m && m.name !== I && (d = !0, v = function() {
|
||
return m.call(this)
|
||
}), _ && !a || !P && !d && p[A] || w(p, A, v), T[e] = v, T[l] = O, i)
|
||
if (s = {
|
||
values: f ? v : c(I),
|
||
keys: o ? v : c("keys"),
|
||
entries: g
|
||
}, a)
|
||
for (u in s) u in p || x(p, u, s[u]);
|
||
else b(b.P + b.F * (P || d), e, s);
|
||
return s
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(55),
|
||
i = r(51),
|
||
o = r(61),
|
||
a = {};
|
||
r(25)(a, r(15)("iterator"), function() {
|
||
return this
|
||
}), t.exports = function(t, e, r) {
|
||
t.prototype = n(a, {
|
||
next: i(1, r)
|
||
}), o(t, e + " Iterator")
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(79),
|
||
i = r(39);
|
||
t.exports = function(t, e, r) {
|
||
if (n(e)) throw TypeError("String#" + r + " doesn't accept regex!");
|
||
return String(i(t))
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(15)("match");
|
||
t.exports = function(e) {
|
||
var r = /./;
|
||
try {
|
||
"/./" [e](r)
|
||
} catch (t) {
|
||
try {
|
||
return r[n] = !1, !"/./" [e](r)
|
||
} catch (t) {}
|
||
}
|
||
return !0
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(64),
|
||
i = r(15)("iterator"),
|
||
o = Array.prototype;
|
||
t.exports = function(t) {
|
||
return void 0 !== t && (n.Array === t || o[i] === t)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(20),
|
||
i = r(51);
|
||
t.exports = function(t, e, r) {
|
||
e in t ? n.f(t, e, i(0, r)) : t[e] = r
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(62),
|
||
i = r(15)("iterator"),
|
||
o = r(64);
|
||
t.exports = r(32).getIteratorMethod = function(t) {
|
||
if (null != t) return t[i] || t["@@iterator"] || o[n(t)]
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(291);
|
||
t.exports = function(t, e) {
|
||
return new(n(t))(e)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var s = r(22),
|
||
u = r(54),
|
||
h = r(17);
|
||
t.exports = function(t) {
|
||
for (var e = s(this), r = h(e.length), n = arguments.length, i = u(1 < n ? arguments[1] : void 0, r), o = 2 < n ? arguments[2] : void 0, a = void 0 === o ? r : u(o, r); i < a;) e[i++] = t;
|
||
return e
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(50),
|
||
i = r(152),
|
||
o = r(64),
|
||
a = r(29);
|
||
t.exports = r(109)(Array, "Array", function(t, e) {
|
||
this._t = a(t), this._i = 0, this._k = e
|
||
}, function() {
|
||
var t = this._t,
|
||
e = this._k,
|
||
r = this._i++;
|
||
return !t || r >= t.length ? (this._t = void 0, i(1)) : i(0, "keys" == e ? r : "values" == e ? t[r] : [r, t[r]])
|
||
}, "values"), o.Arguments = o.Array, n("keys"), n("values"), n("entries")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n, i, o = r(71),
|
||
a = RegExp.prototype.exec,
|
||
s = String.prototype.replace,
|
||
u = a,
|
||
h = "lastIndex",
|
||
c = (n = /a/, i = /b*/g, a.call(n, "a"), a.call(i, "a"), 0 !== n[h] || 0 !== i[h]),
|
||
l = void 0 !== /()??/.exec("")[1];
|
||
(c || l) && (u = function(t) {
|
||
var e, r, n, i;
|
||
return l && (r = new RegExp("^" + this.source + "$(?!\\s)", o.call(this))), c && (e = this[h]), n = a.call(this, t), c && n && (this[h] = this.global ? n.index + n[0].length : e), l && n && 1 < n.length && s.call(n[0], r, function() {
|
||
for (i = 1; i < arguments.length - 2; i++) void 0 === arguments[i] && (n[i] = void 0)
|
||
}), n
|
||
}), t.exports = u
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(78)(!0);
|
||
t.exports = function(t, e, r) {
|
||
return e + (r ? n(t, e).length : 1)
|
||
}
|
||
}, function(t, e, r) {
|
||
var n, i, o, a = r(33),
|
||
s = r(142),
|
||
u = r(102),
|
||
h = r(98),
|
||
c = r(9),
|
||
l = c.process,
|
||
f = c.setImmediate,
|
||
d = c.clearImmediate,
|
||
p = c.MessageChannel,
|
||
m = c.Dispatch,
|
||
v = 0,
|
||
g = {},
|
||
y = "onreadystatechange",
|
||
_ = function() {
|
||
var t = +this;
|
||
if (g.hasOwnProperty(t)) {
|
||
var e = g[t];
|
||
delete g[t], e()
|
||
}
|
||
},
|
||
b = function(t) {
|
||
_.call(t.data)
|
||
};
|
||
f && d || (f = function(t) {
|
||
for (var e = [], r = 1; arguments.length > r;) e.push(arguments[r++]);
|
||
return g[++v] = function() {
|
||
s("function" == typeof t ? t : Function(t), e)
|
||
}, n(v), v
|
||
}, d = function(t) {
|
||
delete g[t]
|
||
}, "process" == r(34)(l) ? n = function(t) {
|
||
l.nextTick(a(_, t, 1))
|
||
} : m && m.now ? n = function(t) {
|
||
m.now(a(_, t, 1))
|
||
} : p ? (o = (i = new p).port2, i.port1.onmessage = b, n = a(o.postMessage, o, 1)) : c.addEventListener && "function" == typeof postMessage && !c.importScripts ? (n = function(t) {
|
||
c.postMessage(t + "", "*")
|
||
}, c.addEventListener("message", b, !1)) : n = y in h("script") ? function(t) {
|
||
u.appendChild(h("script"))[y] = function() {
|
||
u.removeChild(this), _.call(t)
|
||
}
|
||
} : function(t) {
|
||
setTimeout(a(_, t, 1), 0)
|
||
}), t.exports = {
|
||
set: f,
|
||
clear: d
|
||
}
|
||
}, function(t, e, r) {
|
||
var s = r(9),
|
||
u = r(121).set,
|
||
h = s.MutationObserver || s.WebKitMutationObserver,
|
||
c = s.process,
|
||
l = s.Promise,
|
||
f = "process" == r(34)(c);
|
||
t.exports = function() {
|
||
var r, n, i, t = function() {
|
||
var t, e;
|
||
for (f && (t = c.domain) && t.exit(); r;) {
|
||
e = r.fn, r = r.next;
|
||
try {
|
||
e()
|
||
} catch (t) {
|
||
throw r ? i() : n = void 0, t
|
||
}
|
||
}
|
||
n = void 0, t && t.enter()
|
||
};
|
||
if (f) i = function() {
|
||
c.nextTick(t)
|
||
};
|
||
else if (!h || s.navigator && s.navigator.standalone)
|
||
if (l && l.resolve) {
|
||
var e = l.resolve(void 0);
|
||
i = function() {
|
||
e.then(t)
|
||
}
|
||
} else i = function() {
|
||
u.call(s, t)
|
||
};
|
||
else {
|
||
var o = !0,
|
||
a = document.createTextNode("");
|
||
new h(t).observe(a, {
|
||
characterData: !0
|
||
}), i = function() {
|
||
a.data = o = !o
|
||
}
|
||
}
|
||
return function(t) {
|
||
var e = {
|
||
fn: t,
|
||
next: void 0
|
||
};
|
||
n && (n.next = e), r || (r = e, i()), n = e
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var i = r(24);
|
||
|
||
function PromiseCapability(t) {
|
||
var r, n;
|
||
this.promise = new t(function(t, e) {
|
||
if (void 0 !== r || void 0 !== n) throw TypeError("Bad Promise constructor");
|
||
r = t, n = e
|
||
}), this.resolve = i(r), this.reject = i(n)
|
||
}
|
||
t.exports.f = function(t) {
|
||
return new PromiseCapability(t)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(9),
|
||
i = r(19),
|
||
o = r(49),
|
||
a = r(85),
|
||
s = r(25),
|
||
u = r(60),
|
||
h = r(10),
|
||
c = r(58),
|
||
l = r(35),
|
||
f = r(17),
|
||
d = r(162),
|
||
p = r(56).f,
|
||
m = r(20).f,
|
||
v = r(117),
|
||
g = r(61),
|
||
y = "ArrayBuffer",
|
||
_ = "DataView",
|
||
b = "prototype",
|
||
x = "Wrong index!",
|
||
w = n[y],
|
||
T = n[_],
|
||
S = n.Math,
|
||
M = n.RangeError,
|
||
E = n.Infinity,
|
||
A = w,
|
||
P = S.abs,
|
||
I = S.pow,
|
||
O = S.floor,
|
||
C = S.log,
|
||
R = S.LN2,
|
||
D = "byteLength",
|
||
F = "byteOffset",
|
||
k = i ? "_b" : "buffer",
|
||
L = i ? "_l" : D,
|
||
N = i ? "_o" : F;
|
||
|
||
function packIEEE754(t, e, r) {
|
||
var n, i, o, a = new Array(r),
|
||
s = 8 * r - e - 1,
|
||
u = (1 << s) - 1,
|
||
h = u >> 1,
|
||
c = 23 === e ? I(2, -24) - I(2, -77) : 0,
|
||
l = 0,
|
||
f = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
|
||
for ((t = P(t)) != t || t === E ? (i = t != t ? 1 : 0, n = u) : (n = O(C(t) / R), t * (o = I(2, -n)) < 1 && (n--, o *= 2), 2 <= (t += 1 <= n + h ? c / o : c * I(2, 1 - h)) * o && (n++, o /= 2), u <= n + h ? (i = 0, n = u) : 1 <= n + h ? (i = (t * o - 1) * I(2, e), n += h) : (i = t * I(2, h - 1) * I(2, e), n = 0)); 8 <= e; a[l++] = 255 & i, i /= 256, e -= 8);
|
||
for (n = n << e | i, s += e; 0 < s; a[l++] = 255 & n, n /= 256, s -= 8);
|
||
return a[--l] |= 128 * f, a
|
||
}
|
||
|
||
function unpackIEEE754(t, e, r) {
|
||
var n, i = 8 * r - e - 1,
|
||
o = (1 << i) - 1,
|
||
a = o >> 1,
|
||
s = i - 7,
|
||
u = r - 1,
|
||
h = t[u--],
|
||
c = 127 & h;
|
||
for (h >>= 7; 0 < s; c = 256 * c + t[u], u--, s -= 8);
|
||
for (n = c & (1 << -s) - 1, c >>= -s, s += e; 0 < s; n = 256 * n + t[u], u--, s -= 8);
|
||
if (0 === c) c = 1 - a;
|
||
else {
|
||
if (c === o) return n ? NaN : h ? -E : E;
|
||
n += I(2, e), c -= a
|
||
}
|
||
return (h ? -1 : 1) * n * I(2, c - e)
|
||
}
|
||
|
||
function unpackI32(t) {
|
||
return t[3] << 24 | t[2] << 16 | t[1] << 8 | t[0]
|
||
}
|
||
|
||
function packI8(t) {
|
||
return [255 & t]
|
||
}
|
||
|
||
function packI16(t) {
|
||
return [255 & t, t >> 8 & 255]
|
||
}
|
||
|
||
function packI32(t) {
|
||
return [255 & t, t >> 8 & 255, t >> 16 & 255, t >> 24 & 255]
|
||
}
|
||
|
||
function packF64(t) {
|
||
return packIEEE754(t, 52, 8)
|
||
}
|
||
|
||
function packF32(t) {
|
||
return packIEEE754(t, 23, 4)
|
||
}
|
||
|
||
function addGetter(t, e, r) {
|
||
m(t[b], e, {
|
||
get: function() {
|
||
return this[r]
|
||
}
|
||
})
|
||
}
|
||
|
||
function get(t, e, r, n) {
|
||
var i = d(+r);
|
||
if (i + e > t[L]) throw M(x);
|
||
var o = t[k]._b,
|
||
a = i + t[N],
|
||
s = o.slice(a, a + e);
|
||
return n ? s : s.reverse()
|
||
}
|
||
|
||
function set(t, e, r, n, i, o) {
|
||
var a = d(+r);
|
||
if (a + e > t[L]) throw M(x);
|
||
for (var s = t[k]._b, u = a + t[N], h = n(+i), c = 0; c < e; c++) s[u + c] = h[o ? c : e - c - 1]
|
||
}
|
||
if (a.ABV) {
|
||
if (!h(function() {
|
||
w(1)
|
||
}) || !h(function() {
|
||
new w(-1)
|
||
}) || h(function() {
|
||
return new w, new w(1.5), new w(NaN), w.name != y
|
||
})) {
|
||
for (var B, U = (w = function(t) {
|
||
return c(this, w), new A(d(t))
|
||
})[b] = A[b], G = p(A), j = 0; G.length > j;)(B = G[j++]) in w || s(w, B, A[B]);
|
||
o || (U.constructor = w)
|
||
}
|
||
var z = new T(new w(2)),
|
||
X = T[b].setInt8;
|
||
z.setInt8(0, 2147483648), z.setInt8(1, 2147483649), !z.getInt8(0) && z.getInt8(1) || u(T[b], {
|
||
setInt8: function(t, e) {
|
||
X.call(this, t, e << 24 >> 24)
|
||
},
|
||
setUint8: function(t, e) {
|
||
X.call(this, t, e << 24 >> 24)
|
||
}
|
||
}, !0)
|
||
} else w = function(t) {
|
||
c(this, w, y);
|
||
var e = d(t);
|
||
this._b = v.call(new Array(e), 0), this[L] = e
|
||
}, T = function(t, e, r) {
|
||
c(this, T, _), c(t, w, _);
|
||
var n = t[L],
|
||
i = l(e);
|
||
if (i < 0 || n < i) throw M("Wrong offset!");
|
||
if (n < i + (r = void 0 === r ? n - i : f(r))) throw M("Wrong length!");
|
||
this[k] = t, this[N] = i, this[L] = r
|
||
}, i && (addGetter(w, D, "_l"), addGetter(T, "buffer", "_b"), addGetter(T, D, "_l"), addGetter(T, F, "_o")), u(T[b], {
|
||
getInt8: function(t) {
|
||
return get(this, 1, t)[0] << 24 >> 24
|
||
},
|
||
getUint8: function(t) {
|
||
return get(this, 1, t)[0]
|
||
},
|
||
getInt16: function(t) {
|
||
var e = get(this, 2, t, arguments[1]);
|
||
return (e[1] << 8 | e[0]) << 16 >> 16
|
||
},
|
||
getUint16: function(t) {
|
||
var e = get(this, 2, t, arguments[1]);
|
||
return e[1] << 8 | e[0]
|
||
},
|
||
getInt32: function(t) {
|
||
return unpackI32(get(this, 4, t, arguments[1]))
|
||
},
|
||
getUint32: function(t) {
|
||
return unpackI32(get(this, 4, t, arguments[1])) >>> 0
|
||
},
|
||
getFloat32: function(t) {
|
||
return unpackIEEE754(get(this, 4, t, arguments[1]), 23, 4)
|
||
},
|
||
getFloat64: function(t) {
|
||
return unpackIEEE754(get(this, 8, t, arguments[1]), 52, 8)
|
||
},
|
||
setInt8: function(t, e) {
|
||
set(this, 1, t, packI8, e)
|
||
},
|
||
setUint8: function(t, e) {
|
||
set(this, 1, t, packI8, e)
|
||
},
|
||
setInt16: function(t, e) {
|
||
set(this, 2, t, packI16, e, arguments[2])
|
||
},
|
||
setUint16: function(t, e) {
|
||
set(this, 2, t, packI16, e, arguments[2])
|
||
},
|
||
setInt32: function(t, e) {
|
||
set(this, 4, t, packI32, e, arguments[2])
|
||
},
|
||
setUint32: function(t, e) {
|
||
set(this, 4, t, packI32, e, arguments[2])
|
||
},
|
||
setFloat32: function(t, e) {
|
||
set(this, 4, t, packF32, e, arguments[2])
|
||
},
|
||
setFloat64: function(t, e) {
|
||
set(this, 8, t, packF64, e, arguments[2])
|
||
}
|
||
});
|
||
g(w, y), g(T, _), s(T[b], a.VIEW, !0), e[y] = w, e[_] = T
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
Object.defineProperty(e, "__esModule", {
|
||
value: !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
|
||
}
|
||
}();
|
||
|
||
function _classCallCheck(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}
|
||
var i = 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 n(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 o = function() {
|
||
function MiniSignal() {
|
||
_classCallCheck(this, MiniSignal), this._head = this._tail = void 0
|
||
}
|
||
return n(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 i)) throw new Error("MiniSignal#has(): First arg must be a MiniSignalBinding object.");
|
||
return t._owner === this
|
||
}
|
||
}, {
|
||
key: "dispatch",
|
||
value: function() {
|
||
var t = this._head;
|
||
if (!t) return !1;
|
||
for (; t;) t._once && this.detach(t), t._fn.apply(t._thisArg, arguments), t = t._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 i(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 i(t, !0, e))
|
||
}
|
||
}, {
|
||
key: "detach",
|
||
value: function(t) {
|
||
if (!(t instanceof i)) 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
|
||
}();
|
||
o.MiniSignalBinding = i, e.default = o, t.exports = e.default
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = _interopRequireDefault(r(3)),
|
||
i = _interopRequireDefault(r(424));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var o = function(r) {
|
||
function Camera(t) {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Camera);
|
||
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, r.call(this));
|
||
return e.add(i.default, t), e.position.z = 10, 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)
|
||
}(Camera, r), Camera
|
||
}(n.default);
|
||
e.default = o
|
||
}, , function(t, e, r) {
|
||
t.exports = function() {
|
||
return new Worker(r.p + "js/workers/worker.21cc18ec46e616e4eed8.js")
|
||
}
|
||
}, , , function(t, a, s) {
|
||
"use strict";
|
||
(function(t, e) {
|
||
s.d(a, "a", function() {
|
||
return n
|
||
});
|
||
var r = "undefined" != typeof window ? window : t.exports && void 0 !== e ? e : {},
|
||
n = function(l) {
|
||
var f = {},
|
||
n = l.document,
|
||
d = l.GreenSockGlobals = l.GreenSockGlobals || l;
|
||
if (d.TweenLite) return d.TweenLite;
|
||
var t, e, r, p, m, i, o, v = function(t) {
|
||
var e, r = t.split("."),
|
||
n = d;
|
||
for (e = 0; e < r.length; e++) n[r[e]] = n = n[r[e]] || {};
|
||
return n
|
||
},
|
||
g = v("com.greensock"),
|
||
y = 1e-8,
|
||
u = function(t) {
|
||
var e, r = [],
|
||
n = t.length;
|
||
for (e = 0; e !== n; r.push(t[e++]));
|
||
return r
|
||
},
|
||
_ = function() {},
|
||
b = (i = Object.prototype.toString, o = i.call([]), function(t) {
|
||
return null != t && (t instanceof Array || "object" == typeof t && !!t.push && i.call(t) === o)
|
||
}),
|
||
x = {},
|
||
w = function(s, u, h, c) {
|
||
this.sc = x[s] ? x[s].sc : [], (x[s] = this).gsClass = null, this.func = h;
|
||
var l = [];
|
||
this.check = function(t) {
|
||
for (var e, r, n, i, o = u.length, a = o; - 1 < --o;)(e = x[u[o]] || new w(u[o], [])).gsClass ? (l[o] = e.gsClass, a--) : t && e.sc.push(this);
|
||
if (0 === a && h)
|
||
for (n = (r = ("com.greensock." + s).split(".")).pop(), i = v(r.join("."))[n] = this.gsClass = h.apply(h, l), c && (d[n] = f[n] = i), o = 0; o < this.sc.length; o++) this.sc[o].check()
|
||
}, this.check(!0)
|
||
},
|
||
a = l._gsDefine = function(t, e, r, n) {
|
||
return new w(t, e, r, n)
|
||
},
|
||
T = g._class = function(t, e, r) {
|
||
return e = e || function() {}, a(t, [], function() {
|
||
return e
|
||
}, r), e
|
||
};
|
||
a.globals = d;
|
||
var s = [0, 0, 1, 1],
|
||
S = T("easing.Ease", function(t, e, r, n) {
|
||
this._func = t, this._type = r || 0, this._power = n || 0, this._params = e ? s.concat(e) : s
|
||
}, !0),
|
||
M = S.map = {},
|
||
h = S.register = function(t, e, r, n) {
|
||
for (var i, o, a, s, u = e.split(","), h = u.length, c = (r || "easeIn,easeOut,easeInOut").split(","); - 1 < --h;)
|
||
for (o = u[h], i = n ? T("easing." + o, null, !0) : g.easing[o] || {}, a = c.length; - 1 < --a;) s = c[a], M[o + "." + s] = M[s + o] = i[s] = t.getRatio ? t : t[s] || new t
|
||
};
|
||
for ((r = S.prototype)._calcEnd = !1, r.getRatio = function(t) {
|
||
if (this._func) return this._params[0] = t, this._func.apply(null, this._params);
|
||
var e = this._type,
|
||
r = this._power,
|
||
n = 1 === e ? 1 - t : 2 === e ? t : t < .5 ? 2 * t : 2 * (1 - t);
|
||
return 1 === r ? n *= n : 2 === r ? n *= n * n : 3 === r ? n *= n * n * n : 4 === r && (n *= n * n * n * n), 1 === e ? 1 - n : 2 === e ? n : t < .5 ? n / 2 : 1 - n / 2
|
||
}, e = (t = ["Linear", "Quad", "Cubic", "Quart", "Quint,Strong"]).length; - 1 < --e;) r = t[e] + ",Power" + e, h(new S(null, null, 1, e), r, "easeOut", !0), h(new S(null, null, 2, e), r, "easeIn" + (0 === e ? ",easeNone" : "")), h(new S(null, null, 3, e), r, "easeInOut");
|
||
M.linear = g.easing.Linear.easeIn, M.swing = g.easing.Quad.easeInOut;
|
||
var E = T("events.EventDispatcher", function(t) {
|
||
this._listeners = {}, this._eventTarget = t || this
|
||
});
|
||
(r = E.prototype).addEventListener = function(t, e, r, n, i) {
|
||
i = i || 0;
|
||
var o, a, s = this._listeners[t],
|
||
u = 0;
|
||
for (this !== p || m || p.wake(), null == s && (this._listeners[t] = s = []), a = s.length; - 1 < --a;)(o = s[a]).c === e && o.s === r ? s.splice(a, 1) : 0 === u && o.pr < i && (u = a + 1);
|
||
s.splice(u, 0, {
|
||
c: e,
|
||
s: r,
|
||
up: n,
|
||
pr: i
|
||
})
|
||
}, r.removeEventListener = function(t, e) {
|
||
var r, n = this._listeners[t];
|
||
if (n)
|
||
for (r = n.length; - 1 < --r;)
|
||
if (n[r].c === e) return void n.splice(r, 1)
|
||
}, r.dispatchEvent = function(t) {
|
||
var e, r, n, i = this._listeners[t];
|
||
if (i)
|
||
for (1 < (e = i.length) && (i = i.slice(0)), r = this._eventTarget; - 1 < --e;)(n = i[e]) && (n.up ? n.c.call(n.s || r, {
|
||
type: t,
|
||
target: r
|
||
}) : n.c.call(n.s || r))
|
||
};
|
||
var A = l.requestAnimationFrame,
|
||
P = l.cancelAnimationFrame,
|
||
I = Date.now || function() {
|
||
return (new Date).getTime()
|
||
},
|
||
O = I();
|
||
for (e = (t = ["ms", "moz", "webkit", "o"]).length; - 1 < --e && !A;) A = l[t[e] + "RequestAnimationFrame"], P = l[t[e] + "CancelAnimationFrame"] || l[t[e] + "CancelRequestAnimationFrame"];
|
||
T("Ticker", function(t, e) {
|
||
var i, o, a, s, u, h = this,
|
||
c = I(),
|
||
r = !(!1 === e || !A) && "auto",
|
||
l = 500,
|
||
f = 33,
|
||
d = function(t) {
|
||
var e, r, n = I() - O;
|
||
l < n && (c += n - f), O += n, h.time = (O - c) / 1e3, e = h.time - u, (!i || 0 < e || !0 === t) && (h.frame++, u += e + (s <= e ? .004 : s - e), r = !0), !0 !== t && (a = o(d)), r && h.dispatchEvent("tick")
|
||
};
|
||
E.call(h), h.time = h.frame = 0, h.tick = function() {
|
||
d(!0)
|
||
}, h.lagSmoothing = function(t, e) {
|
||
if (!arguments.length) return l < 1e8;
|
||
l = t || 1e8, f = Math.min(e, l, 0)
|
||
}, h.sleep = function() {
|
||
null != a && (r && P ? P(a) : clearTimeout(a), o = _, a = null, h === p && (m = !1))
|
||
}, h.wake = function(t) {
|
||
null !== a ? h.sleep() : t ? c += -O + (O = I()) : 10 < h.frame && (O = I() - l + 5), o = 0 === i ? _ : r && A ? A : function(t) {
|
||
return setTimeout(t, 1e3 * (u - h.time) + 1 | 0)
|
||
}, h === p && (m = !0), d(2)
|
||
}, h.fps = function(t) {
|
||
if (!arguments.length) return i;
|
||
s = 1 / ((i = t) || 60), u = this.time + s, h.wake()
|
||
}, h.useRAF = function(t) {
|
||
if (!arguments.length) return r;
|
||
h.sleep(), r = t, h.fps(i)
|
||
}, h.fps(t), setTimeout(function() {
|
||
"auto" === r && h.frame < 5 && "hidden" !== (n || {}).visibilityState && h.useRAF(!1)
|
||
}, 1500)
|
||
}), (r = g.Ticker.prototype = new g.events.EventDispatcher).constructor = g.Ticker;
|
||
var c = T("core.Animation", function(t, e) {
|
||
if (this.vars = e = e || {}, this._duration = this._totalDuration = t || 0, this._delay = Number(e.delay) || 0, this._timeScale = 1, this._active = !!e.immediateRender, this.data = e.data, this._reversed = !!e.reversed, Z) {
|
||
m || p.wake();
|
||
var r = this.vars.useFrames ? K : Z;
|
||
r.add(this, r._time), this.vars.paused && this.paused(!0)
|
||
}
|
||
});
|
||
p = c.ticker = new g.Ticker, (r = c.prototype)._dirty = r._gc = r._initted = r._paused = !1, r._totalTime = r._time = 0, r._rawPrevTime = -1, r._next = r._last = r._onUpdate = r._timeline = r.timeline = null, r._paused = !1;
|
||
var C = function() {
|
||
m && 2e3 < I() - O && ("hidden" !== (n || {}).visibilityState || !p.lagSmoothing()) && p.wake();
|
||
var t = setTimeout(C, 2e3);
|
||
t.unref && t.unref()
|
||
};
|
||
C(), r.play = function(t, e) {
|
||
return null != t && this.seek(t, e), this.reversed(!1).paused(!1)
|
||
}, r.pause = function(t, e) {
|
||
return null != t && this.seek(t, e), this.paused(!0)
|
||
}, r.resume = function(t, e) {
|
||
return null != t && this.seek(t, e), this.paused(!1)
|
||
}, r.seek = function(t, e) {
|
||
return this.totalTime(Number(t), !1 !== e)
|
||
}, r.restart = function(t, e) {
|
||
return this.reversed(!1).paused(!1).totalTime(t ? -this._delay : 0, !1 !== e, !0)
|
||
}, r.reverse = function(t, e) {
|
||
return null != t && this.seek(t || this.totalDuration(), e), this.reversed(!0).paused(!1)
|
||
}, r.render = function(t, e, r) {}, r.invalidate = function() {
|
||
return this._time = this._totalTime = 0, this._initted = this._gc = !1, this._rawPrevTime = -1, !this._gc && this.timeline || this._enabled(!0), this
|
||
}, r.isActive = function() {
|
||
var t, e = this._timeline,
|
||
r = this._startTime;
|
||
return !e || !this._gc && !this._paused && e.isActive() && (t = e.rawTime(!0)) >= r && t < r + this.totalDuration() / this._timeScale - y
|
||
}, r._enabled = function(t, e) {
|
||
return m || p.wake(), this._gc = !t, this._active = this.isActive(), !0 !== e && (t && !this.timeline ? this._timeline.add(this, this._startTime - this._delay) : !t && this.timeline && this._timeline._remove(this, !0)), !1
|
||
}, r._kill = function(t, e) {
|
||
return this._enabled(!1, !1)
|
||
}, r.kill = function(t, e) {
|
||
return this._kill(t, e), this
|
||
}, r._uncache = function(t) {
|
||
for (var e = t ? this : this.timeline; e;) e._dirty = !0, e = e.timeline;
|
||
return this
|
||
}, r._swapSelfInParams = function(t) {
|
||
for (var e = t.length, r = t.concat(); - 1 < --e;) "{self}" === t[e] && (r[e] = this);
|
||
return r
|
||
}, r._callback = function(t) {
|
||
var e = this.vars,
|
||
r = e[t],
|
||
n = e[t + "Params"],
|
||
i = e[t + "Scope"] || e.callbackScope || this;
|
||
switch (n ? n.length : 0) {
|
||
case 0:
|
||
r.call(i);
|
||
break;
|
||
case 1:
|
||
r.call(i, n[0]);
|
||
break;
|
||
case 2:
|
||
r.call(i, n[0], n[1]);
|
||
break;
|
||
default:
|
||
r.apply(i, n)
|
||
}
|
||
}, r.eventCallback = function(t, e, r, n) {
|
||
if ("on" === (t || "").substr(0, 2)) {
|
||
var i = this.vars;
|
||
if (1 === arguments.length) return i[t];
|
||
null == e ? delete i[t] : (i[t] = e, i[t + "Params"] = b(r) && -1 !== r.join("").indexOf("{self}") ? this._swapSelfInParams(r) : r, i[t + "Scope"] = n), "onUpdate" === t && (this._onUpdate = e)
|
||
}
|
||
return this
|
||
}, r.delay = function(t) {
|
||
return arguments.length ? (this._timeline.smoothChildTiming && this.startTime(this._startTime + t - this._delay), this._delay = t, this) : this._delay
|
||
}, r.duration = function(t) {
|
||
return arguments.length ? (this._duration = this._totalDuration = t, this._uncache(!0), this._timeline.smoothChildTiming && 0 < this._time && this._time < this._duration && 0 !== t && this.totalTime(this._totalTime * (t / this._duration), !0), this) : (this._dirty = !1, this._duration)
|
||
}, r.totalDuration = function(t) {
|
||
return this._dirty = !1, arguments.length ? this.duration(t) : this._totalDuration
|
||
}, r.time = function(t, e) {
|
||
return arguments.length ? (this._dirty && this.totalDuration(), this.totalTime(t > this._duration ? this._duration : t, e)) : this._time
|
||
}, r.totalTime = function(t, e, r) {
|
||
if (m || p.wake(), !arguments.length) return this._totalTime;
|
||
if (this._timeline) {
|
||
if (t < 0 && !r && (t += this.totalDuration()), this._timeline.smoothChildTiming) {
|
||
this._dirty && this.totalDuration();
|
||
var n = this._totalDuration,
|
||
i = this._timeline;
|
||
if (n < t && !r && (t = n), this._startTime = (this._paused ? this._pauseTime : i._time) - (this._reversed ? n - t : t) / this._timeScale, i._dirty || this._uncache(!1), i._timeline)
|
||
for (; i._timeline;) i._timeline._time !== (i._startTime + i._totalTime) / i._timeScale && i.totalTime(i._totalTime, !0), i = i._timeline
|
||
}
|
||
this._gc && this._enabled(!0, !1), this._totalTime === t && 0 !== this._duration || (k.length && J(), this.render(t, e, !1), k.length && J())
|
||
}
|
||
return this
|
||
}, r.progress = r.totalProgress = function(t, e) {
|
||
var r = this.duration();
|
||
return arguments.length ? this.totalTime(r * t, e) : r ? this._time / r : this.ratio
|
||
}, r.startTime = function(t) {
|
||
return arguments.length ? (t !== this._startTime && (this._startTime = t, this.timeline && this.timeline._sortChildren && this.timeline.add(this, t - this._delay)), this) : this._startTime
|
||
}, r.endTime = function(t) {
|
||
return this._startTime + (0 != t ? this.totalDuration() : this.duration()) / this._timeScale
|
||
}, r.timeScale = function(t) {
|
||
if (!arguments.length) return this._timeScale;
|
||
var e, r;
|
||
for (t = t || y, this._timeline && this._timeline.smoothChildTiming && (r = (e = this._pauseTime) || 0 === e ? e : this._timeline.totalTime(), this._startTime = r - (r - this._startTime) * this._timeScale / t), this._timeScale = t, r = this.timeline; r && r.timeline;) r._dirty = !0, r.totalDuration(), r = r.timeline;
|
||
return this
|
||
}, r.reversed = function(t) {
|
||
return arguments.length ? (t != this._reversed && (this._reversed = t, this.totalTime(this._timeline && !this._timeline.smoothChildTiming ? this.totalDuration() - this._totalTime : this._totalTime, !0)), this) : this._reversed
|
||
}, r.paused = function(t) {
|
||
if (!arguments.length) return this._paused;
|
||
var e, r, n = this._timeline;
|
||
return t != this._paused && n && (m || t || p.wake(), r = (e = n.rawTime()) - this._pauseTime, !t && n.smoothChildTiming && (this._startTime += r, this._uncache(!1)), this._pauseTime = t ? e : null, this._paused = t, this._active = this.isActive(), !t && 0 !== r && this._initted && this.duration() && (e = n.smoothChildTiming ? this._totalTime : (e - this._startTime) / this._timeScale, this.render(e, e === this._totalTime, !0))), this._gc && !t && this._enabled(!0, !1), this
|
||
};
|
||
var R = T("core.SimpleTimeline", function(t) {
|
||
c.call(this, 0, t), this.autoRemoveChildren = this.smoothChildTiming = !0
|
||
});
|
||
(r = R.prototype = new c).constructor = R, r.kill()._gc = !1, r._first = r._last = r._recent = null, r._sortChildren = !1, r.add = r.insert = function(t, e, r, n) {
|
||
var i, o;
|
||
if (t._startTime = Number(e || 0) + t._delay, t._paused && this !== t._timeline && (t._pauseTime = this.rawTime() - (t._timeline.rawTime() - t._pauseTime)), t.timeline && t.timeline._remove(t, !0), t.timeline = t._timeline = this, t._gc && t._enabled(!0, !0), i = this._last, this._sortChildren)
|
||
for (o = t._startTime; i && i._startTime > o;) i = i._prev;
|
||
return i ? (t._next = i._next, i._next = t) : (t._next = this._first, this._first = t), t._next ? t._next._prev = t : this._last = t, t._prev = i, this._recent = t, this._timeline && this._uncache(!0), this
|
||
}, r._remove = function(t, e) {
|
||
return t.timeline === this && (e || t._enabled(!1, !0), t._prev ? t._prev._next = t._next : this._first === t && (this._first = t._next), t._next ? t._next._prev = t._prev : this._last === t && (this._last = t._prev), t._next = t._prev = t.timeline = null, t === this._recent && (this._recent = this._last), this._timeline && this._uncache(!0)), this
|
||
}, r.render = function(t, e, r) {
|
||
var n, i = this._first;
|
||
for (this._totalTime = this._time = this._rawPrevTime = t; i;) n = i._next, (i._active || t >= i._startTime && !i._paused && !i._gc) && (i._reversed ? i.render((i._dirty ? i.totalDuration() : i._totalDuration) - (t - i._startTime) * i._timeScale, e, r) : i.render((t - i._startTime) * i._timeScale, e, r)), i = n
|
||
}, r.rawTime = function() {
|
||
return m || p.wake(), this._totalTime
|
||
};
|
||
var D = T("TweenLite", function(t, e, r) {
|
||
if (c.call(this, e, r), this.render = D.prototype.render, null == t) throw "Cannot tween a null target.";
|
||
this.target = t = "string" != typeof t ? t : D.selector(t) || t;
|
||
var n, i, o, a = t.jquery || t.length && t !== l && t[0] && (t[0] === l || t[0].nodeType && t[0].style && !t.nodeType),
|
||
s = this.vars.overwrite;
|
||
if (this._overwrite = s = null == s ? Y[D.defaultOverwrite] : "number" == typeof s ? s >> 0 : Y[s], (a || t instanceof Array || t.push && b(t)) && "number" != typeof t[0])
|
||
for (this._targets = o = u(t), this._propLookup = [], this._siblings = [], n = 0; n < o.length; n++)(i = o[n]) ? "string" != typeof i ? i.length && i !== l && i[0] && (i[0] === l || i[0].nodeType && i[0].style && !i.nodeType) ? (o.splice(n--, 1), this._targets = o = o.concat(u(i))) : (this._siblings[n] = $(i, this, !1), 1 === s && 1 < this._siblings[n].length && et(i, this, null, 1, this._siblings[n])) : "string" == typeof(i = o[n--] = D.selector(i)) && o.splice(n + 1, 1) : o.splice(n--, 1);
|
||
else this._propLookup = {}, this._siblings = $(t, this, !1), 1 === s && 1 < this._siblings.length && et(t, this, null, 1, this._siblings);
|
||
(this.vars.immediateRender || 0 === e && 0 === this._delay && !1 !== this.vars.immediateRender) && (this._time = -y, this.render(Math.min(0, -this._delay)))
|
||
}, !0),
|
||
F = function(t) {
|
||
return t && t.length && t !== l && t[0] && (t[0] === l || t[0].nodeType && t[0].style && !t.nodeType)
|
||
};
|
||
(r = D.prototype = new c).constructor = D, r.kill()._gc = !1, r.ratio = 0, r._firstPT = r._targets = r._overwrittenProps = r._startAt = null, r._notifyPluginsOfEnabled = r._lazy = !1, D.version = "2.1.3", D.defaultEase = r._ease = new S(null, null, 1, 1), D.defaultOverwrite = "auto", D.ticker = p, D.autoSleep = 120, D.lagSmoothing = function(t, e) {
|
||
p.lagSmoothing(t, e)
|
||
}, D.selector = l.$ || l.jQuery || function(t) {
|
||
var e = l.$ || l.jQuery;
|
||
return e ? (D.selector = e)(t) : (n || (n = l.document), n ? n.querySelectorAll ? n.querySelectorAll(t) : n.getElementById("#" === t.charAt(0) ? t.substr(1) : t) : t)
|
||
};
|
||
var k = [],
|
||
L = {},
|
||
N = /(?:(-|-=|\+=)?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/gi,
|
||
B = /[\+-]=-?[\.\d]/,
|
||
U = function(t) {
|
||
for (var e, r = this._firstPT; r;) e = r.blob ? 1 === t && null != this.end ? this.end : t ? this.join("") : this.start : r.c * t + r.s, r.m ? e = r.m.call(this._tween, e, this._target || r.t, this._tween) : e < 1e-6 && -1e-6 < e && !r.blob && (e = 0), r.f ? r.fp ? r.t[r.p](r.fp, e) : r.t[r.p](e) : r.t[r.p] = e, r = r._next
|
||
},
|
||
G = function(t) {
|
||
return (1e3 * t | 0) / 1e3 + ""
|
||
},
|
||
j = function(t, e, r, n) {
|
||
var i, o, a, s, u, h, c, l = [],
|
||
f = 0,
|
||
d = "",
|
||
p = 0;
|
||
for (l.start = t, l.end = e, t = l[0] = t + "", e = l[1] = e + "", r && (r(l), t = l[0], e = l[1]), l.length = 0, i = t.match(N) || [], o = e.match(N) || [], n && (n._next = null, n.blob = 1, l._firstPT = l._applyPT = n), u = o.length, s = 0; s < u; s++) c = o[s], d += (h = e.substr(f, e.indexOf(c, f) - f)) || !s ? h : ",", f += h.length, p ? p = (p + 1) % 5 : "rgba(" === h.substr(-5) && (p = 1), c === i[s] || i.length <= s ? d += c : (d && (l.push(d), d = ""), a = parseFloat(i[s]), l.push(a), l._firstPT = {
|
||
_next: l._firstPT,
|
||
t: l,
|
||
p: l.length - 1,
|
||
s: a,
|
||
c: ("=" === c.charAt(1) ? parseInt(c.charAt(0) + "1", 10) * parseFloat(c.substr(2)) : parseFloat(c) - a) || 0,
|
||
f: 0,
|
||
m: p && p < 4 ? Math.round : G
|
||
}), f += c.length;
|
||
return (d += e.substr(f)) && l.push(d), l.setRatio = U, B.test(e) && (l.end = null), l
|
||
},
|
||
z = function(t, e, r, n, i, o, a, s, u) {
|
||
"function" == typeof n && (n = n(u || 0, t));
|
||
var h = typeof t[e],
|
||
c = "function" !== h ? "" : e.indexOf("set") || "function" != typeof t["get" + e.substr(3)] ? e : "get" + e.substr(3),
|
||
l = "get" !== r ? r : c ? a ? t[c](a) : t[c]() : t[e],
|
||
f = "string" == typeof n && "=" === n.charAt(1),
|
||
d = {
|
||
t: t,
|
||
p: e,
|
||
s: l,
|
||
f: "function" === h,
|
||
pg: 0,
|
||
n: i || e,
|
||
m: o ? "function" == typeof o ? o : Math.round : 0,
|
||
pr: 0,
|
||
c: f ? parseInt(n.charAt(0) + "1", 10) * parseFloat(n.substr(2)) : parseFloat(n) - l || 0
|
||
};
|
||
if (("number" != typeof l || "number" != typeof n && !f) && (a || isNaN(l) || !f && isNaN(n) || "boolean" == typeof l || "boolean" == typeof n ? (d.fp = a, d = {
|
||
t: j(l, f ? parseFloat(d.s) + d.c + (d.s + "").replace(/[0-9\-\.]/g, "") : n, s || D.defaultStringFilter, d),
|
||
p: "setRatio",
|
||
s: 0,
|
||
c: 1,
|
||
f: 2,
|
||
pg: 0,
|
||
n: i || e,
|
||
pr: 0,
|
||
m: 0
|
||
}) : (d.s = parseFloat(l), f || (d.c = parseFloat(n) - d.s || 0))), d.c) return (d._next = this._firstPT) && (d._next._prev = d), this._firstPT = d
|
||
},
|
||
X = D._internals = {
|
||
isArray: b,
|
||
isSelector: F,
|
||
lazyTweens: k,
|
||
blobDif: j
|
||
},
|
||
V = D._plugins = {},
|
||
q = X.tweenLookup = {},
|
||
H = 0,
|
||
W = X.reservedProps = {
|
||
ease: 1,
|
||
delay: 1,
|
||
overwrite: 1,
|
||
onComplete: 1,
|
||
onCompleteParams: 1,
|
||
onCompleteScope: 1,
|
||
useFrames: 1,
|
||
runBackwards: 1,
|
||
startAt: 1,
|
||
onUpdate: 1,
|
||
onUpdateParams: 1,
|
||
onUpdateScope: 1,
|
||
onStart: 1,
|
||
onStartParams: 1,
|
||
onStartScope: 1,
|
||
onReverseComplete: 1,
|
||
onReverseCompleteParams: 1,
|
||
onReverseCompleteScope: 1,
|
||
onRepeat: 1,
|
||
onRepeatParams: 1,
|
||
onRepeatScope: 1,
|
||
easeParams: 1,
|
||
yoyo: 1,
|
||
immediateRender: 1,
|
||
repeat: 1,
|
||
repeatDelay: 1,
|
||
data: 1,
|
||
paused: 1,
|
||
reversed: 1,
|
||
autoCSS: 1,
|
||
lazy: 1,
|
||
onOverwrite: 1,
|
||
callbackScope: 1,
|
||
stringFilter: 1,
|
||
id: 1,
|
||
yoyoEase: 1,
|
||
stagger: 1
|
||
},
|
||
Y = {
|
||
none: 0,
|
||
all: 1,
|
||
auto: 2,
|
||
concurrent: 3,
|
||
allOnStart: 4,
|
||
preexisting: 5,
|
||
true: 1,
|
||
false: 0
|
||
},
|
||
K = c._rootFramesTimeline = new R,
|
||
Z = c._rootTimeline = new R,
|
||
Q = 30,
|
||
J = X.lazyRender = function() {
|
||
var t, e, r = k.length;
|
||
for (L = {}, t = 0; t < r; t++)(e = k[t]) && !1 !== e._lazy && (e.render(e._lazy[0], e._lazy[1], !0), e._lazy = !1);
|
||
k.length = 0
|
||
};
|
||
Z._startTime = p.time, K._startTime = p.frame, Z._active = K._active = !0, setTimeout(J, 1), c._updateRoot = D.render = function() {
|
||
var t, e, r;
|
||
if (k.length && J(), Z.render((p.time - Z._startTime) * Z._timeScale, !1, !1), K.render((p.frame - K._startTime) * K._timeScale, !1, !1), k.length && J(), p.frame >= Q) {
|
||
for (r in Q = p.frame + (parseInt(D.autoSleep, 10) || 120), q) {
|
||
for (t = (e = q[r].tweens).length; - 1 < --t;) e[t]._gc && e.splice(t, 1);
|
||
0 === e.length && delete q[r]
|
||
}
|
||
if ((!(r = Z._first) || r._paused) && D.autoSleep && !K._first && 1 === p._listeners.tick.length) {
|
||
for (; r && r._paused;) r = r._next;
|
||
r || p.sleep()
|
||
}
|
||
}
|
||
}, p.addEventListener("tick", c._updateRoot);
|
||
var $ = function(t, e, r) {
|
||
var n, i, o = t._gsTweenID;
|
||
if (q[o || (t._gsTweenID = o = "t" + H++)] || (q[o] = {
|
||
target: t,
|
||
tweens: []
|
||
}), e && ((n = q[o].tweens)[i = n.length] = e, r))
|
||
for (; - 1 < --i;) n[i] === e && n.splice(i, 1);
|
||
return q[o].tweens
|
||
},
|
||
tt = function(t, e, r, n) {
|
||
var i, o, a = t.vars.onOverwrite;
|
||
return a && (i = a(t, e, r, n)), (a = D.onOverwrite) && (o = a(t, e, r, n)), !1 !== i && !1 !== o
|
||
},
|
||
et = function(t, e, r, n, i) {
|
||
var o, a, s, u;
|
||
if (1 === n || 4 <= n) {
|
||
for (u = i.length, o = 0; o < u; o++)
|
||
if ((s = i[o]) !== e) s._gc || s._kill(null, t, e) && (a = !0);
|
||
else if (5 === n) break;
|
||
return a
|
||
}
|
||
var h, c = e._startTime + y,
|
||
l = [],
|
||
f = 0,
|
||
d = 0 === e._duration;
|
||
for (o = i.length; - 1 < --o;)(s = i[o]) === e || s._gc || s._paused || (s._timeline !== e._timeline ? (h = h || rt(e, 0, d), 0 === rt(s, h, d) && (l[f++] = s)) : s._startTime <= c && s._startTime + s.totalDuration() / s._timeScale > c && ((d || !s._initted) && c - s._startTime <= 2e-8 || (l[f++] = s)));
|
||
for (o = f; - 1 < --o;)
|
||
if (u = (s = l[o])._firstPT, 2 === n && s._kill(r, t, e) && (a = !0), 2 !== n || !s._firstPT && s._initted && u) {
|
||
if (2 !== n && !tt(s, e)) continue;
|
||
s._enabled(!1, !1) && (a = !0)
|
||
}
|
||
return a
|
||
},
|
||
rt = function(t, e, r) {
|
||
for (var n = t._timeline, i = n._timeScale, o = t._startTime; n._timeline;) {
|
||
if (o += n._startTime, i *= n._timeScale, n._paused) return -100;
|
||
n = n._timeline
|
||
}
|
||
return e < (o /= i) ? o - e : r && o === e || !t._initted && o - e < 2e-8 ? y : (o += t.totalDuration() / t._timeScale / i) > e + y ? 0 : o - e - y
|
||
};
|
||
r._init = function() {
|
||
var t, e, r, n, i, o, a = this.vars,
|
||
s = this._overwrittenProps,
|
||
u = this._duration,
|
||
h = !!a.immediateRender,
|
||
c = a.ease,
|
||
l = this._startAt;
|
||
if (a.startAt) {
|
||
for (n in l && (l.render(-1, !0), l.kill()), i = {}, a.startAt) i[n] = a.startAt[n];
|
||
if (i.data = "isStart", i.overwrite = !1, i.immediateRender = !0, i.lazy = h && !1 !== a.lazy, i.startAt = i.delay = null, i.onUpdate = a.onUpdate, i.onUpdateParams = a.onUpdateParams, i.onUpdateScope = a.onUpdateScope || a.callbackScope || this, this._startAt = D.to(this.target || {}, 0, i), h)
|
||
if (0 < this._time) this._startAt = null;
|
||
else if (0 !== u) return
|
||
} else if (a.runBackwards && 0 !== u)
|
||
if (l) l.render(-1, !0), l.kill(), this._startAt = null;
|
||
else {
|
||
for (n in 0 !== this._time && (h = !1), r = {}, a) W[n] && "autoCSS" !== n || (r[n] = a[n]);
|
||
if (r.overwrite = 0, r.data = "isFromStart", r.lazy = h && !1 !== a.lazy, r.immediateRender = h, this._startAt = D.to(this.target, 0, r), h) {
|
||
if (0 === this._time) return
|
||
} else this._startAt._init(), this._startAt._enabled(!1), this.vars.immediateRender && (this._startAt = null)
|
||
}
|
||
if (this._ease = c = c ? c instanceof S ? c : "function" == typeof c ? new S(c, a.easeParams) : M[c] || D.defaultEase : D.defaultEase, a.easeParams instanceof Array && c.config && (this._ease = c.config.apply(c, a.easeParams)), this._easeType = this._ease._type, this._easePower = this._ease._power, this._firstPT = null, this._targets)
|
||
for (o = this._targets.length, t = 0; t < o; t++) this._initProps(this._targets[t], this._propLookup[t] = {}, this._siblings[t], s ? s[t] : null, t) && (e = !0);
|
||
else e = this._initProps(this.target, this._propLookup, this._siblings, s, 0);
|
||
if (e && D._onPluginEvent("_onInitAllProps", this), s && (this._firstPT || "function" != typeof this.target && this._enabled(!1, !1)), a.runBackwards)
|
||
for (r = this._firstPT; r;) r.s += r.c, r.c = -r.c, r = r._next;
|
||
this._onUpdate = a.onUpdate, this._initted = !0
|
||
}, r._initProps = function(t, e, r, n, i) {
|
||
var o, a, s, u, h, c;
|
||
if (null == t) return !1;
|
||
for (o in L[t._gsTweenID] && J(), this.vars.css || t.style && t !== l && t.nodeType && V.css && !1 !== this.vars.autoCSS && function(t, e) {
|
||
var r, n = {};
|
||
for (r in t) W[r] || r in e && "transform" !== r && "x" !== r && "y" !== r && "width" !== r && "height" !== r && "className" !== r && "border" !== r || !(!V[r] || V[r] && V[r]._autoCSS) || (n[r] = t[r], delete t[r]);
|
||
t.css = n
|
||
}(this.vars, t), this.vars)
|
||
if (c = this.vars[o], W[o]) c && (c instanceof Array || c.push && b(c)) && -1 !== c.join("").indexOf("{self}") && (this.vars[o] = c = this._swapSelfInParams(c, this));
|
||
else if (V[o] && (u = new V[o])._onInitTween(t, this.vars[o], this, i)) {
|
||
for (this._firstPT = h = {
|
||
_next: this._firstPT,
|
||
t: u,
|
||
p: "setRatio",
|
||
s: 0,
|
||
c: 1,
|
||
f: 1,
|
||
n: o,
|
||
pg: 1,
|
||
pr: u._priority,
|
||
m: 0
|
||
}, a = u._overwriteProps.length; - 1 < --a;) e[u._overwriteProps[a]] = this._firstPT;
|
||
(u._priority || u._onInitAllProps) && (s = !0), (u._onDisable || u._onEnable) && (this._notifyPluginsOfEnabled = !0), h._next && (h._next._prev = h)
|
||
} else e[o] = z.call(this, t, o, "get", c, o, 0, null, this.vars.stringFilter, i);
|
||
return n && this._kill(n, t) ? this._initProps(t, e, r, n, i) : 1 < this._overwrite && this._firstPT && 1 < r.length && et(t, this, e, this._overwrite, r) ? (this._kill(e, t), this._initProps(t, e, r, n, i)) : (this._firstPT && (!1 !== this.vars.lazy && this._duration || this.vars.lazy && !this._duration) && (L[t._gsTweenID] = !0), s)
|
||
}, r.render = function(t, e, r) {
|
||
var n, i, o, a, s = this,
|
||
u = s._time,
|
||
h = s._duration,
|
||
c = s._rawPrevTime;
|
||
if (h - y <= t && 0 <= t) s._totalTime = s._time = h, s.ratio = s._ease._calcEnd ? s._ease.getRatio(1) : 1, s._reversed || (n = !0, i = "onComplete", r = r || s._timeline.autoRemoveChildren), 0 === h && (s._initted || !s.vars.lazy || r) && (s._startTime === s._timeline._duration && (t = 0), (c < 0 || t <= 0 && -y <= t || c === y && "isPause" !== s.data) && c !== t && (r = !0, y < c && (i = "onReverseComplete")), s._rawPrevTime = a = !e || t || c === t ? t : y);
|
||
else if (t < y) s._totalTime = s._time = 0, s.ratio = s._ease._calcEnd ? s._ease.getRatio(0) : 0, (0 !== u || 0 === h && 0 < c) && (i = "onReverseComplete", n = s._reversed), -y < t ? t = 0 : t < 0 && (s._active = !1, 0 === h && (s._initted || !s.vars.lazy || r) && (0 <= c && (c !== y || "isPause" !== s.data) && (r = !0), s._rawPrevTime = a = !e || t || c === t ? t : y)), (!s._initted || s._startAt && s._startAt.progress()) && (r = !0);
|
||
else if (s._totalTime = s._time = t, s._easeType) {
|
||
var l = t / h,
|
||
f = s._easeType,
|
||
d = s._easePower;
|
||
(1 === f || 3 === f && .5 <= l) && (l = 1 - l), 3 === f && (l *= 2), 1 === d ? l *= l : 2 === d ? l *= l * l : 3 === d ? l *= l * l * l : 4 === d && (l *= l * l * l * l), s.ratio = 1 === f ? 1 - l : 2 === f ? l : t / h < .5 ? l / 2 : 1 - l / 2
|
||
} else s.ratio = s._ease.getRatio(t / h);
|
||
if (s._time !== u || r) {
|
||
if (!s._initted) {
|
||
if (s._init(), !s._initted || s._gc) return;
|
||
if (!r && s._firstPT && (!1 !== s.vars.lazy && s._duration || s.vars.lazy && !s._duration)) return s._time = s._totalTime = u, s._rawPrevTime = c, k.push(s), void(s._lazy = [t, e]);
|
||
s._time && !n ? s.ratio = s._ease.getRatio(s._time / h) : n && s._ease._calcEnd && (s.ratio = s._ease.getRatio(0 === s._time ? 0 : 1))
|
||
}
|
||
for (!1 !== s._lazy && (s._lazy = !1), s._active || !s._paused && s._time !== u && 0 <= t && (s._active = !0), 0 === u && (s._startAt && (0 <= t ? s._startAt.render(t, !0, r) : i || (i = "_dummyGS")), s.vars.onStart && (0 === s._time && 0 !== h || e || s._callback("onStart"))), o = s._firstPT; o;) o.f ? o.t[o.p](o.c * s.ratio + o.s) : o.t[o.p] = o.c * s.ratio + o.s, o = o._next;
|
||
s._onUpdate && (t < 0 && s._startAt && -1e-4 !== t && s._startAt.render(t, !0, r), e || (s._time !== u || n || r) && s._callback("onUpdate")), i && (s._gc && !r || (t < 0 && s._startAt && !s._onUpdate && -1e-4 !== t && s._startAt.render(t, !0, r), n && (s._timeline.autoRemoveChildren && s._enabled(!1, !1), s._active = !1), !e && s.vars[i] && s._callback(i), 0 === h && s._rawPrevTime === y && a !== y && (s._rawPrevTime = 0)))
|
||
}
|
||
}, r._kill = function(t, e, r) {
|
||
if ("all" === t && (t = null), null == t && (null == e || e === this.target)) return this._lazy = !1, this._enabled(!1, !1);
|
||
e = "string" != typeof e ? e || this._targets || this.target : D.selector(e) || e;
|
||
var n, i, o, a, s, u, h, c, l, f = r && this._time && r._startTime === this._startTime && this._timeline === r._timeline,
|
||
d = this._firstPT;
|
||
if ((b(e) || F(e)) && "number" != typeof e[0])
|
||
for (n = e.length; - 1 < --n;) this._kill(t, e[n], r) && (u = !0);
|
||
else {
|
||
if (this._targets) {
|
||
for (n = this._targets.length; - 1 < --n;)
|
||
if (e === this._targets[n]) {
|
||
s = this._propLookup[n] || {}, this._overwrittenProps = this._overwrittenProps || [], i = this._overwrittenProps[n] = t ? this._overwrittenProps[n] || {} : "all";
|
||
break
|
||
}
|
||
} else {
|
||
if (e !== this.target) return !1;
|
||
s = this._propLookup, i = this._overwrittenProps = t ? this._overwrittenProps || {} : "all"
|
||
}
|
||
if (s) {
|
||
if (h = t || s, c = t !== i && "all" !== i && t !== s && ("object" != typeof t || !t._tempKill), r && (D.onOverwrite || this.vars.onOverwrite)) {
|
||
for (o in h) s[o] && (l || (l = []), l.push(o));
|
||
if ((l || !t) && !tt(this, r, e, l)) return !1
|
||
}
|
||
for (o in h)(a = s[o]) && (f && (a.f ? a.t[a.p](a.s) : a.t[a.p] = a.s, u = !0), a.pg && a.t._kill(h) && (u = !0), a.pg && 0 !== a.t._overwriteProps.length || (a._prev ? a._prev._next = a._next : a === this._firstPT && (this._firstPT = a._next), a._next && (a._next._prev = a._prev), a._next = a._prev = null), delete s[o]), c && (i[o] = 1);
|
||
!this._firstPT && this._initted && d && this._enabled(!1, !1)
|
||
}
|
||
}
|
||
return u
|
||
}, r.invalidate = function() {
|
||
this._notifyPluginsOfEnabled && D._onPluginEvent("_onDisable", this);
|
||
var t = this._time;
|
||
return this._firstPT = this._overwrittenProps = this._startAt = this._onUpdate = null, this._notifyPluginsOfEnabled = this._active = this._lazy = !1, this._propLookup = this._targets ? {} : [], c.prototype.invalidate.call(this), this.vars.immediateRender && (this._time = -y, this.render(t, !1, !1 !== this.vars.lazy)), this
|
||
}, r._enabled = function(t, e) {
|
||
if (m || p.wake(), t && this._gc) {
|
||
var r, n = this._targets;
|
||
if (n)
|
||
for (r = n.length; - 1 < --r;) this._siblings[r] = $(n[r], this, !0);
|
||
else this._siblings = $(this.target, this, !0)
|
||
}
|
||
return c.prototype._enabled.call(this, t, e), !(!this._notifyPluginsOfEnabled || !this._firstPT) && D._onPluginEvent(t ? "_onEnable" : "_onDisable", this)
|
||
}, D.to = function(t, e, r) {
|
||
return new D(t, e, r)
|
||
}, D.from = function(t, e, r) {
|
||
return r.runBackwards = !0, r.immediateRender = 0 != r.immediateRender, new D(t, e, r)
|
||
}, D.fromTo = function(t, e, r, n) {
|
||
return n.startAt = r, n.immediateRender = 0 != n.immediateRender && 0 != r.immediateRender, new D(t, e, n)
|
||
}, D.delayedCall = function(t, e, r, n, i) {
|
||
return new D(e, 0, {
|
||
delay: t,
|
||
onComplete: e,
|
||
onCompleteParams: r,
|
||
callbackScope: n,
|
||
onReverseComplete: e,
|
||
onReverseCompleteParams: r,
|
||
immediateRender: !1,
|
||
lazy: !1,
|
||
useFrames: i,
|
||
overwrite: 0
|
||
})
|
||
}, D.set = function(t, e) {
|
||
return new D(t, 0, e)
|
||
}, D.getTweensOf = function(t, e) {
|
||
if (null == t) return [];
|
||
var r, n, i, o;
|
||
if (t = "string" != typeof t ? t : D.selector(t) || t, (b(t) || F(t)) && "number" != typeof t[0]) {
|
||
for (r = t.length, n = []; - 1 < --r;) n = n.concat(D.getTweensOf(t[r], e));
|
||
for (r = n.length; - 1 < --r;)
|
||
for (o = n[r], i = r; - 1 < --i;) o === n[i] && n.splice(r, 1)
|
||
} else if (t._gsTweenID)
|
||
for (r = (n = $(t).concat()).length; - 1 < --r;)(n[r]._gc || e && !n[r].isActive()) && n.splice(r, 1);
|
||
return n || []
|
||
}, D.killTweensOf = D.killDelayedCallsTo = function(t, e, r) {
|
||
"object" == typeof e && (r = e, e = !1);
|
||
for (var n = D.getTweensOf(t, e), i = n.length; - 1 < --i;) n[i]._kill(r, t)
|
||
};
|
||
var nt = T("plugins.TweenPlugin", function(t, e) {
|
||
this._overwriteProps = (t || "").split(","), this._propName = this._overwriteProps[0], this._priority = e || 0, this._super = nt.prototype
|
||
}, !0);
|
||
if (r = nt.prototype, nt.version = "1.19.0", nt.API = 2, r._firstPT = null, r._addTween = z, r.setRatio = U, r._kill = function(t) {
|
||
var e, r = this._overwriteProps,
|
||
n = this._firstPT;
|
||
if (null != t[this._propName]) this._overwriteProps = [];
|
||
else
|
||
for (e = r.length; - 1 < --e;) null != t[r[e]] && r.splice(e, 1);
|
||
for (; n;) null != t[n.n] && (n._next && (n._next._prev = n._prev), n._prev ? (n._prev._next = n._next, n._prev = null) : this._firstPT === n && (this._firstPT = n._next)), n = n._next;
|
||
return !1
|
||
}, r._mod = r._roundProps = function(t) {
|
||
for (var e, r = this._firstPT; r;)(e = t[this._propName] || null != r.n && t[r.n.split(this._propName + "_").join("")]) && "function" == typeof e && (2 === r.f ? r.t._applyPT.m = e : r.m = e), r = r._next
|
||
}, D._onPluginEvent = function(t, e) {
|
||
var r, n, i, o, a, s = e._firstPT;
|
||
if ("_onInitAllProps" === t) {
|
||
for (; s;) {
|
||
for (a = s._next, n = i; n && n.pr > s.pr;) n = n._next;
|
||
(s._prev = n ? n._prev : o) ? s._prev._next = s: i = s, (s._next = n) ? n._prev = s : o = s, s = a
|
||
}
|
||
s = e._firstPT = i
|
||
}
|
||
for (; s;) s.pg && "function" == typeof s.t[t] && s.t[t]() && (r = !0), s = s._next;
|
||
return r
|
||
}, nt.activate = function(t) {
|
||
for (var e = t.length; - 1 < --e;) t[e].API === nt.API && (V[(new t[e])._propName] = t[e]);
|
||
return !0
|
||
}, a.plugin = function(t) {
|
||
if (!(t && t.propName && t.init && t.API)) throw "illegal plugin definition.";
|
||
var e, r = t.propName,
|
||
n = t.priority || 0,
|
||
i = t.overwriteProps,
|
||
o = {
|
||
init: "_onInitTween",
|
||
set: "setRatio",
|
||
kill: "_kill",
|
||
round: "_mod",
|
||
mod: "_mod",
|
||
initAll: "_onInitAllProps"
|
||
},
|
||
a = T("plugins." + r.charAt(0).toUpperCase() + r.substr(1) + "Plugin", function() {
|
||
nt.call(this, r, n), this._overwriteProps = i || []
|
||
}, !0 === t.global),
|
||
s = a.prototype = new nt(r);
|
||
for (e in (s.constructor = a).API = t.API, o) "function" == typeof t[e] && (s[o[e]] = t[e]);
|
||
return a.version = t.version, nt.activate([a]), a
|
||
}, t = l._gsQueue) {
|
||
for (e = 0; e < t.length; e++) t[e]();
|
||
for (r in x) x[r].func || l.console.log("GSAP encountered missing dependency: " + r)
|
||
}
|
||
return m = !1, D
|
||
}(r),
|
||
i = r.GreenSockGlobals,
|
||
o = i.com.greensock;
|
||
o.core.SimpleTimeline, o.core.Animation, i.Ease, i.Linear, i.Power1, i.Power2, i.Power3, i.Power4, i.TweenPlugin, o.events.EventDispatcher
|
||
}).call(this, s(485)(t), s(42))
|
||
}, , function(t, e, r) {
|
||
"use strict";
|
||
var l = r(0);
|
||
l.interaction.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;
|
||
window.is90degree ? (t.x = (r - n.top) * (this.interactionDOMElement.height / n.width) * i, t.y = (this.interactionDOMElement.height - (e - n.left) * (this.interactionDOMElement.width / n.height)) * i) : (t.x = (e - n.left) * (this.interactionDOMElement.width / n.width) * i, t.y = (r - n.top) * (this.interactionDOMElement.height / n.height) * i)
|
||
};
|
||
var n = r(12),
|
||
i = r.n(n),
|
||
f = r(14),
|
||
a = r(21),
|
||
o = function() {
|
||
function OrientationManager(t, e) {
|
||
if (this.view = t, this.mode = e.mode || 0, this.resizeMode = e.resizeMode || 0, 0 === this.resizeMode) {
|
||
var r = e.rotationImage || "image/high/device/rotate.jpg";
|
||
if (this.onRotationChanged = new i.a, this.rotationWarning = !0, this.orientation, this.rotateScreen = document.createElement("div"), this.rotateScreen.style.backgroundPosition = "50% 50%", this.rotateScreen.style.backgroundColor = "#3b3b3b", this.rotateScreen.style.backgroundRepeat = "no-repeat", this.rotateScreen.style.position = "absolute", this.rotateScreen.style.backgroundSize = "80%", this.rotateScreen.style.top = "0", this.rotateScreen.style.left = "0", this.rotateScreen.style.bottom = "0", this.rotateScreen.style.right = "0", this.rotateScreen.style.zIndex = 1e7, this.rotateScreen.style.display = "none", this.rotateScreen.style.height = "100%", this.rotateScreen.style.width = "100%", this.changeRotationImage(window.ASSET_URL + r), a.a.instance.iPad && this.changeRotationImage(window.ASSET_URL + r), document.body.appendChild(this.rotateScreen), a.a.instance.firefox) window.matchMedia("(orientation: portrait)").addListener(this.checkOrientationChangesFirefox.bind(this))
|
||
}
|
||
window.addEventListener("resize", function() {
|
||
this.resize(window.innerWidth, window.innerHeight)
|
||
}.bind(this)), this.resize(window.innerWidth, window.innerHeight)
|
||
}
|
||
var t = OrientationManager.prototype;
|
||
return t.checkOrientationResize = function() {}, t.changeRotationImage = function(t) {
|
||
this.rotateScreen.style.backgroundImage = "url(" + t + ")"
|
||
}, t.checkOrientationChangesFirefox = function() {
|
||
var t = screen.orientation || screen.mozOrientation || screen.msOrientation;
|
||
"landscape-primary" === t ? this.orientation = 90 : "landscape-secondary" === t && (this.orientation = -90), this.onRotationChanged.dispatch(this.orientation)
|
||
}, t.checkOrientationChanges = function() {
|
||
this.orientation = window.orientation, this.onRotationChanged.dispatch(window.orientation), 0 === this.orientation || 180 === this.orientation ? (f.a.instance.stop(), this.rotateScreen.style.display = "block") : (f.a.instance.start(), this.rotateScreen.style.display = "none")
|
||
}, t.resize = function(t, e) {
|
||
if (!a.a.instance.desktop) {
|
||
window.is90degree = !1;
|
||
var r = 0 === this.mode ? t < e : e < t;
|
||
if (0 === this.resizeMode) this.rotateScreen.style.display = r ? (f.a.instance.stop(), "block") : (f.a.instance.start(), "none");
|
||
else if (1 === this.resizeMode) {
|
||
var n = t < e ? "scale(" + 1 / (t / e) + ") rotate(90deg)" : "scale(1) rotate(0deg)";
|
||
t < e ? (this.view.style.webkitTransform = n, this.view.style.mozTransform = n, this.view.style.msTransform = n, this.view.style.oTransform = n, this.view.style.transform = n, window.is90degree = !0) : (this.view.style.webkitTransform = n, this.view.style.mozTransform = n, this.view.style.msTransform = n, this.view.style.oTransform = n, this.view.style.transform = n)
|
||
}
|
||
}
|
||
}, t.updateDeviceOrientation = function(t) {
|
||
this.alpha = t.alpha, this.beta = t.beta, this.gamma = t.gamma
|
||
}, OrientationManager
|
||
}(),
|
||
s = (r(66), r(182)),
|
||
u = r.n(s);
|
||
l.geometryCache || (l.geometryCache = {}, l.Geometry.from = function(t) {
|
||
if (l.geometryCache[t]) return l.geometryCache[t];
|
||
throw new Error('GEOMETRY: "' + t + '" does not exist in the cache')
|
||
});
|
||
var h = function() {
|
||
return function(r, n) {
|
||
if (r.data && "gbo" === r.extension) {
|
||
var t = r.data;
|
||
u()(t).then(function(t) {
|
||
var e = (new l.Geometry).addAttribute("uvs", t.uv, 2).addAttribute("position", t.position, 3).addAttribute("normals", t.normals, 3).interleave().addIndex(new Uint16Array(t.indices));
|
||
r.geometry = e, l.geometryCache[r.url.slice(0, -3) + "obj"] = e, l.geometryCache[r.url] = e, (l.geometryCache[r.name] = e).src = r.url, n()
|
||
})
|
||
} else n()
|
||
}
|
||
};
|
||
|
||
function uploadTextures(s, u, h) {
|
||
var c = this;
|
||
return void 0 === h && (h = 20), new Promise(function(e) {
|
||
var r = [];
|
||
for (var t in s) {
|
||
var n = s[t],
|
||
i = t;
|
||
n.tags && n.tags.tps && (i += "_image");
|
||
var o = l.utils.BaseTextureCache[i];
|
||
o && (n.tags && (n.tags[4444] && (o.type = l.TYPES.UNSIGNED_SHORT_4_4_4_4), n.tags.nearest && (o.scaleMode = l.SCALE_MODES.NEAREST)), o.isPowerOfTwo && (o.wrapMode = l.WRAP_MODES.REPEAT), r.push(o))
|
||
}
|
||
var a = 0;
|
||
f.a.instance.add(function updateFunction() {
|
||
for (var t = 0; t < h; t++) {
|
||
if (a === r.length) {
|
||
f.a.instance.remove(updateFunction, c), e();
|
||
break
|
||
}
|
||
u.texture.bind(r[a]), a++
|
||
}
|
||
}, c)
|
||
})
|
||
}
|
||
|
||
function unloadTextures(s, u, h) {
|
||
var c = this;
|
||
return void 0 === h && (h = 20), new Promise(function(e) {
|
||
var r = [];
|
||
for (var t in s) {
|
||
var n = s[t],
|
||
i = t;
|
||
n.tags && n.tags.tps && (i += "_image");
|
||
var o = l.utils.BaseTextureCache[i];
|
||
o && r.push(o)
|
||
}
|
||
var a = 0;
|
||
f.a.instance.add(function updateFunction() {
|
||
for (var t = 0; t < h; t++) {
|
||
if (a === r.length) {
|
||
f.a.instance.remove(updateFunction, c), e();
|
||
break
|
||
}
|
||
u.texture.destroyTexture(r[a], !0), a++
|
||
}
|
||
}, c)
|
||
})
|
||
}
|
||
|
||
function asyncGeneratorStep(t, e, r, n, i, o, a) {
|
||
try {
|
||
var s = t[o](a),
|
||
u = s.value
|
||
} catch (t) {
|
||
return void r(t)
|
||
}
|
||
s.done ? e(u) : Promise.resolve(u).then(n, i)
|
||
}
|
||
|
||
function _asyncToGenerator(o) {
|
||
return function() {
|
||
var t = this,
|
||
i = arguments;
|
||
return new Promise(function(e, r) {
|
||
var n = o.apply(t, i);
|
||
|
||
function _next(t) {
|
||
asyncGeneratorStep(n, e, r, _next, _throw, "next", t)
|
||
}
|
||
|
||
function _throw(t) {
|
||
asyncGeneratorStep(n, e, r, _next, _throw, "throw", t)
|
||
}
|
||
_next(void 0)
|
||
})
|
||
}
|
||
}
|
||
var c = new(function() {
|
||
function ResourceManager() {
|
||
this.cache = [], this.middlewares = [h], this.resources = {}, this.onProgress = new i.a, this.upload = !0
|
||
}
|
||
var t = ResourceManager.prototype;
|
||
return t.init = function(t, e) {
|
||
var r = this;
|
||
if (void 0 === e && (e = {}), !t) throw new Error("FIDO Resource manager expects a manifest");
|
||
var n = l.LoaderResource;
|
||
n.setExtensionXhrType("gbo", n.XHR_RESPONSE_TYPE.BUFFER), this.basePath = e.basePath || window.ASSET_URL, this.renderer = e.renderer || window.renderer, this.manifest = t, this.version = e.version || "default", this.upload = !!e.upload, e.middlewares && e.middlewares.forEach(function(t) {
|
||
return r.middlewares.push(t)
|
||
})
|
||
}, t.load = function() {
|
||
var e = _asyncToGenerator(regeneratorRuntime.mark(function _callee(e, r) {
|
||
var n, i, o, a, s, u, h, c, l, f, d, p = this;
|
||
return regeneratorRuntime.wrap(function(t) {
|
||
for (;;) switch (t.prev = t.next) {
|
||
case 0:
|
||
for (void 0 === r && (r = {}), n = this.getManifestFromIds(e), i = this.getLoader(), o = this.version, a = 0; a < n.length; a++)
|
||
if (!(s = n[a]).loaded)
|
||
for (u in s)
|
||
if (h = s[u], "audio" !== u)
|
||
for (c in h) l = h, f = !1, "misc" === u && "mp4" === l[c].default.split(".").pop() && (f = !0), f || i.add(c, this.basePath + (l[c][o] || l[c].default));
|
||
return i.on("progress", function() {
|
||
p.onProgress.dispatch(i.progress)
|
||
}), t.next = 9, new Promise(function(r) {
|
||
i.load(function(t, e) {
|
||
Object.assign(p.resources, e), r()
|
||
})
|
||
});
|
||
case 9:
|
||
a = 0;
|
||
case 10:
|
||
if (!(a < n.length)) {
|
||
t.next = 21;
|
||
break
|
||
}
|
||
if ((d = n[a]).loaded = !0, !(void 0 === r.upload ? this.upload : r.upload)) {
|
||
t.next = 18;
|
||
break
|
||
}
|
||
if (d.uploaded) {
|
||
t.next = 18;
|
||
break
|
||
}
|
||
return t.next = 17, uploadTextures(d.image, this.renderer);
|
||
case 17:
|
||
d.uploaded = !0;
|
||
case 18:
|
||
a++, t.next = 10;
|
||
break;
|
||
case 21:
|
||
case "end":
|
||
return t.stop()
|
||
}
|
||
}, _callee, this)
|
||
}));
|
||
return function(t) {
|
||
return e.apply(this, arguments)
|
||
}
|
||
}(), t.loadAssets = function() {}, t.unload = function() {
|
||
var e = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(e) {
|
||
var r, n, i;
|
||
return regeneratorRuntime.wrap(function(t) {
|
||
for (;;) switch (t.prev = t.next) {
|
||
case 0:
|
||
r = this.getManifestFromIds(e), n = 0;
|
||
case 2:
|
||
if (!(n < r.length)) {
|
||
t.next = 11;
|
||
break
|
||
}
|
||
if ((i = r[n]).uploaded) return t.next = 7, unloadTextures(i.image, this.renderer);
|
||
t.next = 8;
|
||
break;
|
||
case 7:
|
||
i.uploaded = !1;
|
||
case 8:
|
||
n++, t.next = 2;
|
||
break;
|
||
case 11:
|
||
case "end":
|
||
return t.stop()
|
||
}
|
||
}, _callee2, this)
|
||
}));
|
||
return function(t) {
|
||
return e.apply(this, arguments)
|
||
}
|
||
}(), t.manifestsAreLoaded = function(t) {
|
||
return this.getManifestFromIds(t).every(function(t) {
|
||
return t.loaded
|
||
})
|
||
}, t.hasManifestFor = function(t) {
|
||
return !!this.manifest[t]
|
||
}, t.getManifestFromIds = function(t) {
|
||
var e = this;
|
||
return t instanceof Array || (t = [t]), (t = Array.from(new Set(t))).map(function(t) {
|
||
if ("string" != typeof t) return t;
|
||
if (!e.manifest[t]) throw new Error(t + " does not exist in manifest");
|
||
return e.manifest[t]
|
||
})
|
||
}, t.getLoader = function() {
|
||
var e = new l.Loader;
|
||
return this.middlewares.forEach(function(t) {
|
||
return e.use(t())
|
||
}), e
|
||
}, t.getJson = function(t) {
|
||
return this.resources[t].data
|
||
}, ResourceManager
|
||
}());
|
||
var d = function(e) {
|
||
var t, r;
|
||
|
||
function LoadingScreen() {
|
||
var t;
|
||
return (t = e.call(this) || this)._build(), t
|
||
}
|
||
r = e, (t = LoadingScreen).prototype = Object.create(r.prototype), (t.prototype.constructor = t).__proto__ = r;
|
||
var n = LoadingScreen.prototype;
|
||
return n.updateProgress = function(t) {
|
||
this.bar.scale.x = t / 100
|
||
}, n.resize = function(t, e) {
|
||
this.view.position.set(t / 2, e / 2)
|
||
}, n.updateWaiting = function() {
|
||
this.waitingCount++, this.view.scale.x = 1 + Math.pow(Math.sin(.05 * this.waitingCount), 2)
|
||
}, n.startWaiting = function() {
|
||
this.waitingCount = 0, f.a.instance.add(this.updateWaiting, this)
|
||
}, n.stopWaiting = function() {
|
||
f.a.instance.remove(this.updateWaiting, this)
|
||
}, n.onShow = function() {
|
||
this._reset()
|
||
}, n.onHidden = function() {
|
||
this._reset()
|
||
}, n._build = function() {
|
||
this.view = new l.Container;
|
||
var t = (new l.Graphics).beginFill(10066329).drawRect(0, 0, 300, 50);
|
||
t.position.set(-150, -25), this.view.addChild(t), this.bar = (new l.Graphics).beginFill(3355443).drawRect(0, 0, 300, 50), this.bar.position.set(-150, -25), this.view.addChild(this.bar), this.addChild(this.view)
|
||
}, n._reset = function() {
|
||
this.updateProgress(0), this.stopWaiting()
|
||
}, LoadingScreen
|
||
}(l.Container);
|
||
|
||
function ScreenManager_asyncGeneratorStep(t, e, r, n, i, o, a) {
|
||
try {
|
||
var s = t[o](a),
|
||
u = s.value
|
||
} catch (t) {
|
||
return void r(t)
|
||
}
|
||
s.done ? e(u) : Promise.resolve(u).then(n, i)
|
||
}
|
||
|
||
function ScreenManager_asyncToGenerator(o) {
|
||
return function() {
|
||
var t = this,
|
||
i = arguments;
|
||
return new Promise(function(e, r) {
|
||
var n = o.apply(t, i);
|
||
|
||
function _next(t) {
|
||
ScreenManager_asyncGeneratorStep(n, e, r, _next, _throw, "next", t)
|
||
}
|
||
|
||
function _throw(t) {
|
||
ScreenManager_asyncGeneratorStep(n, e, r, _next, _throw, "throw", t)
|
||
}
|
||
_next(void 0)
|
||
})
|
||
}
|
||
}
|
||
|
||
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 p = function() {
|
||
function ScreenManager(t) {
|
||
void 0 === t && (t = {}), this.screens = {}, this.transitionMap = {}, this.container = t.container || new l.Container, this.loadingScreen = t.loadingScreen || new d, this.defaultTransition = t.defaultTransition || null, this.screenLoaded = new i.a, this.currentScreen, this.history = [], this.nextScreen = null
|
||
}
|
||
var t, e, r, n = ScreenManager.prototype;
|
||
return n.registerTransition = function(t, e, r, n) {
|
||
void 0 === r && (r = "all"), void 0 === n && (n = !1), t.transitionOutComplete.add(this._onTransitionOutComplete, this), t.transitionInStart.add(this._onTransitionInStart, this), t.transitionComplete.add(this._onTransitionComplete, this);
|
||
var i = this.transitionMap[e];
|
||
i || (i = this.transitionMap[e] = {}), i[r] = t, n && this.registerTransition(t, r, e)
|
||
}, n._getTransitionTo = function(t) {
|
||
var r = this,
|
||
e = function(t, e) {
|
||
return !!r.transitionMap[t] && (r.transitionMap[t][e] || r.transitionMap[t].all)
|
||
};
|
||
return this.currentScreen ? e(this.currentScreen.id, t) || e("all", t) || this.defaultTransition : this.getScreenById(t).transition || this.defaultTransition
|
||
}, n.gotoScreenByID = function(t, e, r, n) {
|
||
this.gotoScreen(t, e, r, n)
|
||
}, n.getScreenById = function(t) {
|
||
var e = this.screens[t];
|
||
if (e) return e;
|
||
throw new Error("screen not found with id : " + t)
|
||
}, n.addScreen = function(t, e) {
|
||
return (this.screens[e] = t).id = e, t.firstRun = !0, t.screenManager = this, t
|
||
}, n.goBack = function() {
|
||
this.history.pop();
|
||
var t = this.history.pop();
|
||
t && this.gotoScreen(t)
|
||
}, n.getScreenId = function(t) {
|
||
for (var e in this.screens)
|
||
if (this.screens[e] === t) return e;
|
||
return null
|
||
}, n.gotoScreen = function(t, e, r, n, i) {
|
||
if (void 0 === e && (e = {}), void 0 === r && (r = !1), void 0 === n && (n = !1), void 0 === i && (i = !1), "string" == typeof t && (t = this.getScreenById(t)), (n || this.currentScreen !== t) && (n || t !== this.nextScreen))
|
||
if (this.targetScreen = t, this.nextScreen) this.targetScreen._tmpParams = {
|
||
params: e,
|
||
instant: r,
|
||
forceRefresh: n,
|
||
screenIsPrepared: i
|
||
};
|
||
else {
|
||
var o = getManifestsForScreen(t, e);
|
||
c.manifestsAreLoaded(o) ? (t.firstRun && (t.init && t.init(), t.firstRun = !1), i || !checkObjectHasMethod(t, "asyncPrepare") ? (t != this.loadingScreen && this.history.push(t), this.nextScreen = t, tryMethodOnObject(this.nextScreen, "beforeShow", e), this.transition = null, r || (this.transition = this._getTransitionTo(this.nextScreen.id)), this.currentScreen && tryMethodOnObject(this.currentScreen, "onHide"), this.transition ? (tryMethodOnObject(this.transition, "resize", this.w, this.h), this.transition.start(this.container, this.currentScreen, this.nextScreen)) : this._instantTransition()) : this._prepareScreen(t, e, r, n)) : this._loadScreen(t, e, r, n)
|
||
}
|
||
}, n._loadScreen = function() {
|
||
var i = ScreenManager_asyncToGenerator(regeneratorRuntime.mark(function _callee(e, r, n, i) {
|
||
return regeneratorRuntime.wrap(function(t) {
|
||
for (;;) switch (t.prev = t.next) {
|
||
case 0:
|
||
return t.next = 2, this._loadAssets(getManifestsForScreen(e, r));
|
||
case 2:
|
||
e && this.gotoScreen(e, r, n, i);
|
||
case 3:
|
||
case "end":
|
||
return t.stop()
|
||
}
|
||
}, _callee, this)
|
||
}));
|
||
return function(t, e, r, n) {
|
||
return i.apply(this, arguments)
|
||
}
|
||
}(), n._loadAssets = function() {
|
||
var e = ScreenManager_asyncToGenerator(regeneratorRuntime.mark(function _callee2(e) {
|
||
return regeneratorRuntime.wrap(function(t) {
|
||
for (;;) switch (t.prev = t.next) {
|
||
case 0:
|
||
return this.gotoScreen(this.loadingScreen), c.onProgress.add(this.loadingScreen.updateProgress, this.loadingScreen), t.next = 4, c.load(e);
|
||
case 4:
|
||
c.onProgress.remove(this.loadingScreen.updateProgress, this.loadingScreen);
|
||
case 5:
|
||
case "end":
|
||
return t.stop()
|
||
}
|
||
}, _callee2, this)
|
||
}));
|
||
return function(t) {
|
||
return e.apply(this, arguments)
|
||
}
|
||
}(), n._prepareScreen = function() {
|
||
var i = ScreenManager_asyncToGenerator(regeneratorRuntime.mark(function _callee3(e, r, n, i) {
|
||
return regeneratorRuntime.wrap(function(t) {
|
||
for (;;) switch (t.prev = t.next) {
|
||
case 0:
|
||
return this.gotoScreen(this.loadingScreen), this.loadingScreen.startWaiting(), t.next = 4, e.asyncPrepare(r);
|
||
case 4:
|
||
this.gotoScreen(e, r, n, i, !0);
|
||
case 5:
|
||
case "end":
|
||
return t.stop()
|
||
}
|
||
}, _callee3, this)
|
||
}));
|
||
return function(t, e, r, n) {
|
||
return i.apply(this, arguments)
|
||
}
|
||
}(), n._instantTransition = function() {
|
||
this._onTransitionOutComplete(), this._onTransitionInStart(), this._onTransitionComplete()
|
||
}, n._onTransitionOutComplete = function() {
|
||
this.currentScreen && (tryMethodOnObject(this.currentScreen, "onHidden"), this.container.removeChild(this.currentScreen))
|
||
}, n._onTransitionInStart = function() {
|
||
tryMethodOnObject(this.nextScreen, "resize", this.w, this.h), tryMethodOnObject(this.nextScreen, "onShow"), this.nextScreen.parent !== this.container && this.container.addChild(this.nextScreen)
|
||
}, n._onTransitionComplete = function() {
|
||
if (this.currentScreen = this.nextScreen, this.nextScreen = null, this.currentScreen != this.targetScreen) {
|
||
var t = this.targetScreen._tmpParams;
|
||
this.gotoScreen(this.targetScreen, t.params, t.instant, t.forceRefresh, t.screenIsPrepared), delete this.targetScreen._tmpParams
|
||
} else tryMethodOnObject(this.currentScreen, "onShown")
|
||
}, n.resize = function(t, e) {
|
||
this.w = t, this.h = e, tryMethodOnObject(this.transition, "resize", t, e), tryMethodOnObject(this.currentScreen, "resize", t, e), tryMethodOnObject(this.nextScreen, "resize", t, e)
|
||
}, t = ScreenManager, (e = [{
|
||
key: "loadingScreen",
|
||
get: function() {
|
||
return this._loadingScreen
|
||
},
|
||
set: function(t) {
|
||
this._loadingScreen = t, this.addScreen(this._loadingScreen, "loading")
|
||
}
|
||
}, {
|
||
key: "defaultTransition",
|
||
get: function() {
|
||
return this.transitionMap.all ? this.transitionMap.all.all : null
|
||
},
|
||
set: function(t) {
|
||
t && this.registerTransition(t, "all", "all")
|
||
}
|
||
}]) && _defineProperties(t.prototype, e), r && _defineProperties(t, r), ScreenManager
|
||
}();
|
||
|
||
function getManifestsForScreen(t, e) {
|
||
var r = [];
|
||
return e && e.manifests && (r = r.concat(e.manifests)), t.manifests && (r = r.concat(t.manifests)), r
|
||
}
|
||
|
||
function tryMethodOnObject(t, e) {
|
||
if (checkObjectHasMethod(t, e)) {
|
||
for (var r = arguments.length, n = new Array(2 < r ? r - 2 : 0), i = 2; i < r; i++) n[i - 2] = arguments[i];
|
||
t[e].apply(t, n)
|
||
}
|
||
}
|
||
|
||
function checkObjectHasMethod(t, e) {
|
||
return t && t[e] && "function" == typeof t[e]
|
||
}
|
||
|
||
function shouldOptimiseCheck(t) {
|
||
var e;
|
||
if (void 0 === t && (t = !1), a.a.instance.iPad && 1 === window.devicePixelRatio || (e = navigator.userAgent, /Kindle/i.test(e) || /Silk/i.test(e) || /KFTT/i.test(e) || /KFOT/i.test(e) || /KFJWA/i.test(e) || /KFJWI/i.test(e) || /KFSOWI/i.test(e) || /KFTHWA/i.test(e) || /KFTHWI/i.test(e) || /KFAPWA/i.test(e) || /KFAPWI/i.test(e)) || function() {
|
||
if (a.a.instance.iOS_version && a.a.instance.iOS_version.length) return a.a.instance.iOS_version[0] < 10;
|
||
return !1
|
||
}() || function(t) {
|
||
if (!t) return;
|
||
var e = 0;
|
||
if (!a.a.instance.iOS_version) return !1;
|
||
var r = document.createElement("canvas"),
|
||
n = r.getContext("webgl", {}) || r.getContext("experimental-webgl", {}),
|
||
i = n.getExtension("EXT_texture_filter_anisotropic") || n.getExtension("MOZ_EXT_texture_filter_anisotropic") || n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
|
||
i && (e = n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));
|
||
return e <= 4
|
||
}(t)) return 2;
|
||
var r = function() {
|
||
{
|
||
if (window.gmi) {
|
||
var t = parseInt(window.gmi.device.class());
|
||
return -1 !== t ? t : 3e3
|
||
}
|
||
return 3e3
|
||
}
|
||
}();
|
||
return r < 2013 ? 2 : r < 2015 && a.a.instance.android ? 2 : 2015 < r ? 0 : 1
|
||
}
|
||
var m = function(n) {
|
||
var t, e;
|
||
|
||
function CartoonTransition() {
|
||
var t;
|
||
return (t = n.call(this) || this).circle = (new l.Graphics).beginFill(1044480).drawCircle(0, 0, 100), t
|
||
}
|
||
e = n, (t = CartoonTransition).prototype = Object.create(e.prototype), (t.prototype.constructor = t).__proto__ = e;
|
||
var r = CartoonTransition.prototype;
|
||
return r.start = function(t, e, r) {
|
||
n.prototype.start.call(this, t, e, r), t.addChild(this.circle), t.mask = this.circle, this.currentScreen ? this._startTransitionOut() : this._startTransitionIn()
|
||
}, r.resize = function(t, e) {
|
||
this.w = t, this.h = e, this.targetScale = t / 100 * 1.2, this.circle.x = t / 2, this.circle.y = e / 2
|
||
}, r._startTransitionOut = function() {
|
||
TweenLite.killTweensOf(this.circle), this.circle.scale.set(this.targetScale), TweenLite.to(this.circle.scale, 1, {
|
||
x: .001,
|
||
y: .001,
|
||
ease: Sine.easeOut,
|
||
onComplete: this._onTransitionOutComplete.bind(this)
|
||
})
|
||
}, r._onTransitionOutComplete = function() {
|
||
this.transitionOutComplete.dispatch(), this._startTransitionIn()
|
||
}, r._startTransitionIn = function() {
|
||
TweenLite.killTweensOf(this.circle), this.circle.scale.set(.001), TweenLite.to(this.circle.scale, 1, {
|
||
x: this.targetScale,
|
||
y: this.targetScale,
|
||
ease: Cubic.easeIn,
|
||
onComplete: this._onTransitionInComplete.bind(this)
|
||
}), this.transitionInStart.dispatch()
|
||
}, r._onTransitionInComplete = function() {
|
||
this.container.removeChild(this.circle), this.container.mask = null, this.transitionComplete.dispatch()
|
||
}, CartoonTransition
|
||
}(r(91).a),
|
||
v = r(183),
|
||
g = r.n(v);
|
||
|
||
function _construct(t, e, r) {
|
||
return (_construct = function() {
|
||
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
|
||
if (Reflect.construct.sham) return !1;
|
||
if ("function" == typeof Proxy) return !0;
|
||
try {
|
||
return Date.prototype.toString.call(Reflect.construct(Date, [], function() {})), !0
|
||
} catch (t) {
|
||
return !1
|
||
}
|
||
}() ? Reflect.construct : function(t, e, r) {
|
||
var n = [null];
|
||
n.push.apply(n, e);
|
||
var i = new(Function.bind.apply(t, n));
|
||
return r && _setPrototypeOf(i, r.prototype), i
|
||
}).apply(null, arguments)
|
||
}
|
||
|
||
function _setPrototypeOf(t, e) {
|
||
return (_setPrototypeOf = Object.setPrototypeOf || function(t, e) {
|
||
return t.__proto__ = e, t
|
||
})(t, e)
|
||
}
|
||
|
||
function App_asyncGeneratorStep(t, e, r, n, i, o, a) {
|
||
try {
|
||
var s = t[o](a),
|
||
u = s.value
|
||
} catch (t) {
|
||
return void r(t)
|
||
}
|
||
s.done ? e(u) : Promise.resolve(u).then(n, i)
|
||
}
|
||
a.a.instance.android && (l.settings.PRECISION_FRAGMENT = "lowp", l.settings.PRECISION_VERTEX = "highp");
|
||
var y = function() {
|
||
function App(t) {
|
||
var e;
|
||
if (t = t || App.defaultOptions, this.count = 0, t.fps && ((e = new g.a).dom.style.zIndex = 1e5, e.dom.style.position = "absolute", document.body.appendChild(e.dom), requestAnimationFrame(function loop() {
|
||
e.update(), requestAnimationFrame(loop)
|
||
})), t.version && function() {
|
||
var t = document.createElement("div");
|
||
document.getElementById("og-game-holder").appendChild(t);
|
||
var e = "-";
|
||
try {
|
||
e = "0.3.9"
|
||
} catch (t) {}
|
||
t.style.position = "absolute", t.style.left = "0px", t.style.bottom = "0px", t.style.zIndex = 1e7, t.style.color = "#1AB9C2", t.innerText = "v" + e, t.style.background = "#1A304B", t.style.border = "solid #1A1A39", t.style.fontFamily = "Lucida Console", t.style.fontWeight = "bold", t.style.padding = "5px", t.style.userSelect = "none", t.addEventListener("pointerdown", function() {
|
||
"1" === t.style.opacity ? t.style.opacity = "0" : t.style.opacity = "1"
|
||
})
|
||
}(), this.options = Object.assign({}, App.defaultOptions, t), this.setupPixi(), f.a.instance.start(), f.a.instance.add(this.update, this), this.resourceManager = c, this.optimisationLevel = shouldOptimiseCheck(), t.manifest) {
|
||
var r = t.verison || 0 === this.optimisationLevel ? "default" : "low",
|
||
n = void 0 === t.upload ? 0 === this.optimisationLevel : t.upload;
|
||
this.resourceManager.init(t.manifest, {
|
||
renderer: this.renderer,
|
||
basePath: window.ASSET_URL,
|
||
middlewares: t.middlewares,
|
||
version: r,
|
||
upload: n
|
||
})
|
||
}
|
||
this.screenManager = new p(this.options.screenManagerOptions), this.stage.addChild(this.screenManager.container), this.onReady = new i.a, this.options.orientationMode !== App.orientationModes.BOTH && (this.orientationManager = new o(this.view, this.options)), this.halfSpeed = 1 < this.optimisationLevel
|
||
}
|
||
var t = App.prototype;
|
||
return t.showFPS = function() {
|
||
var t = document.createElement("script");
|
||
t.onload = function() {
|
||
var t = new Stats;
|
||
document.body.appendChild(t.dom), requestAnimationFrame(function loop() {
|
||
t.update(), requestAnimationFrame(loop)
|
||
})
|
||
}, t.src = "//mrdoob.github.io/stats.js/build/stats.min.js", document.head.appendChild(t)
|
||
}, t.setupPixi = function() {
|
||
var t = this.options,
|
||
e = l.WebGLRenderer || l.Renderer;
|
||
if (t.forceCanvas) this.renderer = new l.CanvasRenderer(t.width, t.height), this.renderer.clearBeforeRender = !0;
|
||
else {
|
||
var r = {
|
||
resolution: 1,
|
||
backgroundColor: t.backgroundColor,
|
||
transparent: !!t.transparent
|
||
};
|
||
this.renderer = new e(r, t.width, t.height), this.renderer.clearBeforeRender = !1
|
||
}
|
||
window.WEBGL = l.isWebGL = this.renderer instanceof e, window.renderer = this.renderer, this.view = this.renderer.view, this.stage = new l.Container, this.view.style.position = "absolute", this.view.addEventListener("mousedown", function() {
|
||
window.focus()
|
||
}, !0), l.stage = this.stage
|
||
}, t.update = function() {
|
||
(!this.halfSpeed || this.count % 2) && this.renderer.render(this.stage), this.count++
|
||
}, t.startup = function() {
|
||
var o, t = (o = regeneratorRuntime.mark(function _callee() {
|
||
return regeneratorRuntime.wrap(function(t) {
|
||
for (;;) switch (t.prev = t.next) {
|
||
case 0:
|
||
if (c.hasManifestFor("preload")) return t.next = 3, this.resourceManager.load("preload");
|
||
t.next = 3;
|
||
break;
|
||
case 3:
|
||
return this.onPreload && this.onPreload(), this.onPreloaderAssetsLoaded(), this.options.loadingScreenClass && (this.screenManager.loadingScreen = _construct(this.options.loadingScreenClass, this.options.loadingScreenParams)), t.next = 8, this.screenManager._loadAssets("default");
|
||
case 8:
|
||
this.onAssetsLoaded(), this.onReady.dispatch();
|
||
case 10:
|
||
case "end":
|
||
return t.stop()
|
||
}
|
||
}, _callee, this)
|
||
}), function() {
|
||
var t = this,
|
||
i = arguments;
|
||
return new Promise(function(e, r) {
|
||
var n = o.apply(t, i);
|
||
|
||
function _next(t) {
|
||
App_asyncGeneratorStep(n, e, r, _next, _throw, "next", t)
|
||
}
|
||
|
||
function _throw(t) {
|
||
App_asyncGeneratorStep(n, e, r, _next, _throw, "throw", t)
|
||
}
|
||
_next(void 0)
|
||
})
|
||
});
|
||
return function() {
|
||
return t.apply(this, arguments)
|
||
}
|
||
}(), t.onPreloaderAssetsLoaded = function() {}, t.onAssetsLoaded = function() {}, t.resize = function(t, e) {
|
||
this.w = t, this.h = e;
|
||
var r = 1;
|
||
a.a.instance.isMobile && (r = window.devicePixelRatio ? window.devicePixelRatio : window.screen.deviceXDPI / window.screen.logicalXDPI), 2 < r && (r = 2);
|
||
var n = t / this.safeSize.width < e / this.safeSize.height ? t / this.safeSize.width : e / this.safeSize.height,
|
||
i = Math.min(this.maxSize.width * n, t),
|
||
o = Math.min(this.maxSize.height * n, e);
|
||
this.renderer.resize(i * r | 0, o * r | 0), this.view.style.width = i + "px", this.view.style.height = o + "px", this.view.style.left = t / 2 - i / 2 + "px", this.view.style.top = e / 2 - o / 2 + "px", this.screenManager.resize(i / n, o / n), this.screenManager.container.scale.set(n * r), this.overlayManager && (this.overlayManager.resize(i / n, o / n), this.overlayManager.view.scale.set(n * r)), this.topMenu && (this.topMenu.scale.set(n * r), this.topMenu.resize(i / n, o / n))
|
||
}, App
|
||
}();
|
||
y.resizeModes = {
|
||
DEFUALT: 0,
|
||
CSS_RESIZE_PRESERVE_RATIO: 1,
|
||
CSS_RESIZE: 2
|
||
}, y.orientationModes = {
|
||
LANDSCAPE: 0,
|
||
PORTRAIT: 1,
|
||
BOTH: 2
|
||
}, y.defaultOptions = {
|
||
width: 800,
|
||
height: 600,
|
||
forceCanvas: !1,
|
||
transparent: !1,
|
||
backgroundColor: 0,
|
||
resizeMode: y.resizeModes.DEFUALT,
|
||
orientationMode: y.orientationModes.LANDSCAPE,
|
||
loadingScreenClass: d,
|
||
config: null,
|
||
screenManagerOptions: {
|
||
defaultTransition: new m
|
||
}
|
||
};
|
||
e.a = y
|
||
}, function(t, e, r) {
|
||
t.exports = !r(19) && !r(10)(function() {
|
||
return 7 != Object.defineProperty(r(98)("div"), "a", {
|
||
get: function() {
|
||
return 7
|
||
}
|
||
}).a
|
||
})
|
||
}, function(t, e, r) {
|
||
e.f = r(15)
|
||
}, function(t, e, r) {
|
||
var a = r(28),
|
||
s = r(29),
|
||
u = r(75)(!1),
|
||
h = r(100)("IE_PROTO");
|
||
t.exports = function(t, e) {
|
||
var r, n = s(t),
|
||
i = 0,
|
||
o = [];
|
||
for (r in n) r != h && a(n, r) && o.push(r);
|
||
for (; e.length > i;) a(n, r = e[i++]) && (~u(o, r) || o.push(r));
|
||
return o
|
||
}
|
||
}, function(t, e, r) {
|
||
var a = r(20),
|
||
s = r(6),
|
||
u = r(53);
|
||
t.exports = r(19) ? Object.defineProperties : function(t, e) {
|
||
s(t);
|
||
for (var r, n = u(e), i = n.length, o = 0; o < i;) a.f(t, r = n[o++], e[r]);
|
||
return t
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(29),
|
||
i = r(56).f,
|
||
o = {}.toString,
|
||
a = "object" == typeof window && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
|
||
t.exports.f = function(t) {
|
||
return a && "[object Window]" == o.call(t) ? function(t) {
|
||
try {
|
||
return i(t)
|
||
} catch (t) {
|
||
return a.slice()
|
||
}
|
||
}(t) : i(n(t))
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var f = r(53),
|
||
d = r(76),
|
||
p = r(70),
|
||
m = r(22),
|
||
v = r(69),
|
||
i = Object.assign;
|
||
t.exports = !i || r(10)(function() {
|
||
var t = {},
|
||
e = {},
|
||
r = Symbol(),
|
||
n = "abcdefghijklmnopqrst";
|
||
return t[r] = 7, n.split("").forEach(function(t) {
|
||
e[t] = t
|
||
}), 7 != i({}, t)[r] || Object.keys(i({}, e)).join("") != n
|
||
}) ? function(t, e) {
|
||
for (var r = m(t), n = arguments.length, i = 1, o = d.f, a = p.f; i < n;)
|
||
for (var s, u = v(arguments[i++]), h = o ? f(u).concat(o(u)) : f(u), c = h.length, l = 0; l < c;) a.call(u, s = h[l++]) && (r[s] = u[s]);
|
||
return r
|
||
} : i
|
||
}, function(t, e) {
|
||
t.exports = Object.is || function(t, e) {
|
||
return t === e ? 0 !== t || 1 / t == 1 / e : t != t && e != e
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var o = r(24),
|
||
a = r(11),
|
||
s = r(142),
|
||
u = [].slice,
|
||
h = {};
|
||
t.exports = Function.bind || function(e) {
|
||
var r = o(this),
|
||
n = u.call(arguments, 1),
|
||
i = function() {
|
||
var t = n.concat(u.call(arguments));
|
||
return this instanceof i ? function(t, e, r) {
|
||
if (!(e in h)) {
|
||
for (var n = [], i = 0; i < e; i++) n[i] = "a[" + i + "]";
|
||
h[e] = Function("F,a", "return new F(" + n.join(",") + ")")
|
||
}
|
||
return h[e](t, r)
|
||
}(r, t.length, t) : s(r, t, e)
|
||
};
|
||
return a(r.prototype) && (i.prototype = r.prototype), i
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = function(t, e, r) {
|
||
var n = void 0 === r;
|
||
switch (e.length) {
|
||
case 0:
|
||
return n ? t() : t.call(r);
|
||
case 1:
|
||
return n ? t(e[0]) : t.call(r, e[0]);
|
||
case 2:
|
||
return n ? t(e[0], e[1]) : t.call(r, e[0], e[1]);
|
||
case 3:
|
||
return n ? t(e[0], e[1], e[2]) : t.call(r, e[0], e[1], e[2]);
|
||
case 4:
|
||
return n ? t(e[0], e[1], e[2], e[3]) : t.call(r, e[0], e[1], e[2], e[3])
|
||
}
|
||
return t.apply(r, e)
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(9).parseInt,
|
||
i = r(63).trim,
|
||
o = r(104),
|
||
a = /^[-+]?0[xX]/;
|
||
t.exports = 8 !== n(o + "08") || 22 !== n(o + "0x16") ? function(t, e) {
|
||
var r = i(String(t), 3);
|
||
return n(r, e >>> 0 || (a.test(r) ? 16 : 10))
|
||
} : n
|
||
}, function(t, e, r) {
|
||
var n = r(9).parseFloat,
|
||
i = r(63).trim;
|
||
t.exports = 1 / n(r(104) + "-0") != -1 / 0 ? function(t) {
|
||
var e = i(String(t), 3),
|
||
r = n(e);
|
||
return 0 === r && "-" == e.charAt(0) ? -0 : r
|
||
} : n
|
||
}, function(t, e, r) {
|
||
var n = r(34);
|
||
t.exports = function(t, e) {
|
||
if ("number" != typeof t && "Number" != n(t)) throw TypeError(e);
|
||
return +t
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = Math.floor;
|
||
t.exports = function(t) {
|
||
return !n(t) && isFinite(t) && i(t) === t
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = Math.log1p || function(t) {
|
||
return -1e-8 < (t = +t) && t < 1e-8 ? t - t * t / 2 : Math.log(1 + t)
|
||
}
|
||
}, function(t, e, r) {
|
||
var o = r(107),
|
||
n = Math.pow,
|
||
a = n(2, -52),
|
||
s = n(2, -23),
|
||
u = n(2, 127) * (2 - s),
|
||
h = n(2, -126);
|
||
t.exports = Math.fround || function(t) {
|
||
var e, r, n = Math.abs(t),
|
||
i = o(t);
|
||
return n < h ? i * (n / h / s + 1 / a - 1 / a) * h * s : u < (r = (e = (1 + s / a) * n) - (e - n)) || r != r ? i * (1 / 0) : i * r
|
||
}
|
||
}, function(t, e, r) {
|
||
var o = r(6);
|
||
t.exports = function(e, t, r, n) {
|
||
try {
|
||
return n ? t(o(r)[0], r[1]) : t(r)
|
||
} catch (t) {
|
||
var i = e.return;
|
||
throw void 0 !== i && o(i.call(e)), t
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
var c = r(24),
|
||
l = r(22),
|
||
f = r(69),
|
||
d = r(17);
|
||
t.exports = function(t, e, r, n, i) {
|
||
c(e);
|
||
var o = l(t),
|
||
a = f(o),
|
||
s = d(o.length),
|
||
u = i ? s - 1 : 0,
|
||
h = i ? -1 : 1;
|
||
if (r < 2)
|
||
for (;;) {
|
||
if (u in a) {
|
||
n = a[u], u += h;
|
||
break
|
||
}
|
||
if (u += h, i ? u < 0 : s <= u) throw TypeError("Reduce of empty array with no initial value")
|
||
}
|
||
for (; i ? 0 <= u : u < s; u += h) u in a && (n = e(n, a[u], u, o));
|
||
return n
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var h = r(22),
|
||
c = r(54),
|
||
l = r(17);
|
||
t.exports = [].copyWithin || function(t, e) {
|
||
var r = h(this),
|
||
n = l(r.length),
|
||
i = c(t, n),
|
||
o = c(e, n),
|
||
a = 2 < arguments.length ? arguments[2] : void 0,
|
||
s = Math.min((void 0 === a ? n : c(a, n)) - o, n - i),
|
||
u = 1;
|
||
for (o < i && i < o + s && (u = -1, o += s - 1, i += s - 1); 0 < s--;) o in r ? r[i] = r[o] : delete r[i], i += u, o += u;
|
||
return r
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = function(t, e) {
|
||
return {
|
||
value: e,
|
||
done: !!t
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(119);
|
||
r(1)({
|
||
target: "RegExp",
|
||
proto: !0,
|
||
forced: n !== /./.exec
|
||
}, {
|
||
exec: n
|
||
})
|
||
}, function(t, e, r) {
|
||
r(19) && "g" != /./g.flags && r(20).f(RegExp.prototype, "flags", {
|
||
configurable: !0,
|
||
get: r(71)
|
||
})
|
||
}, function(t, e) {
|
||
t.exports = function(t) {
|
||
try {
|
||
return {
|
||
e: !1,
|
||
v: t()
|
||
}
|
||
} catch (t) {
|
||
return {
|
||
e: !0,
|
||
v: t
|
||
}
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(6),
|
||
i = r(11),
|
||
o = r(123);
|
||
t.exports = function(t, e) {
|
||
if (n(t), i(e) && e.constructor === t) return e;
|
||
var r = o.f(t);
|
||
return (0, r.resolve)(e), r.promise
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(158),
|
||
i = r(65);
|
||
t.exports = r(84)("Map", function(t) {
|
||
return function() {
|
||
return t(this, 0 < arguments.length ? arguments[0] : void 0)
|
||
}
|
||
}, {
|
||
get: function(t) {
|
||
var e = n.getEntry(i(this, "Map"), t);
|
||
return e && e.v
|
||
},
|
||
set: function(t, e) {
|
||
return n.def(i(this, "Map"), 0 === t ? 0 : t, e)
|
||
}
|
||
}, n, !0)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var a = r(20).f,
|
||
s = r(55),
|
||
u = r(60),
|
||
h = r(33),
|
||
c = r(58),
|
||
l = r(59),
|
||
n = r(109),
|
||
i = r(152),
|
||
o = r(57),
|
||
f = r(19),
|
||
d = r(48).fastKey,
|
||
p = r(65),
|
||
m = f ? "_s" : "size",
|
||
v = function(t, e) {
|
||
var r, n = d(e);
|
||
if ("F" !== n) return t._i[n];
|
||
for (r = t._f; r; r = r.n)
|
||
if (r.k == e) return r
|
||
};
|
||
t.exports = {
|
||
getConstructor: function(t, o, r, n) {
|
||
var i = t(function(t, e) {
|
||
c(t, i, o, "_i"), t._t = o, t._i = s(null), t._f = void 0, t._l = void 0, t[m] = 0, null != e && l(e, r, t[n], t)
|
||
});
|
||
return u(i.prototype, {
|
||
clear: function() {
|
||
for (var t = p(this, o), e = t._i, r = t._f; r; r = r.n) r.r = !0, r.p && (r.p = r.p.n = void 0), delete e[r.i];
|
||
t._f = t._l = void 0, t[m] = 0
|
||
},
|
||
delete: function(t) {
|
||
var e = p(this, o),
|
||
r = v(e, t);
|
||
if (r) {
|
||
var n = r.n,
|
||
i = r.p;
|
||
delete e._i[r.i], r.r = !0, i && (i.n = n), n && (n.p = i), e._f == r && (e._f = n), e._l == r && (e._l = i), e[m]--
|
||
}
|
||
return !!r
|
||
},
|
||
forEach: function(t) {
|
||
p(this, o);
|
||
for (var e, r = h(t, 1 < arguments.length ? arguments[1] : void 0, 3); e = e ? e.n : this._f;)
|
||
for (r(e.v, e.k, this); e && e.r;) e = e.p
|
||
},
|
||
has: function(t) {
|
||
return !!v(p(this, o), t)
|
||
}
|
||
}), f && a(i.prototype, "size", {
|
||
get: function() {
|
||
return p(this, o)[m]
|
||
}
|
||
}), i
|
||
},
|
||
def: function(t, e, r) {
|
||
var n, i, o = v(t, e);
|
||
return o ? o.v = r : (t._l = o = {
|
||
i: i = d(e, !0),
|
||
k: e,
|
||
v: r,
|
||
p: n = t._l,
|
||
n: void 0,
|
||
r: !1
|
||
}, t._f || (t._f = o), n && (n.n = o), t[m]++, "F" !== i && (t._i[i] = o)), t
|
||
},
|
||
getEntry: v,
|
||
setStrong: function(t, r, e) {
|
||
n(t, r, function(t, e) {
|
||
this._t = p(t, r), this._k = e, this._l = void 0
|
||
}, function() {
|
||
for (var t = this._k, e = this._l; e && e.r;) e = e.p;
|
||
return this._t && (this._l = e = e ? e.n : this._t._f) ? i(0, "keys" == t ? e.k : "values" == t ? e.v : [e.k, e.v]) : (this._t = void 0, i(1))
|
||
}, e ? "entries" : "values", !e, !0), o(r)
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(158),
|
||
i = r(65);
|
||
t.exports = r(84)("Set", function(t) {
|
||
return function() {
|
||
return t(this, 0 < arguments.length ? arguments[0] : void 0)
|
||
}
|
||
}, {
|
||
add: function(t) {
|
||
return n.def(i(this, "Set"), t = 0 === t ? 0 : t, t)
|
||
}
|
||
}, n)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var o, n = r(41)(0),
|
||
a = r(26),
|
||
i = r(48),
|
||
s = r(139),
|
||
u = r(161),
|
||
h = r(11),
|
||
c = r(10),
|
||
l = r(65),
|
||
f = "WeakMap",
|
||
d = i.getWeak,
|
||
p = Object.isExtensible,
|
||
m = u.ufstore,
|
||
v = {},
|
||
g = function(t) {
|
||
return function() {
|
||
return t(this, 0 < arguments.length ? arguments[0] : void 0)
|
||
}
|
||
},
|
||
y = {
|
||
get: function(t) {
|
||
if (h(t)) {
|
||
var e = d(t);
|
||
return !0 === e ? m(l(this, f)).get(t) : e ? e[this._i] : void 0
|
||
}
|
||
},
|
||
set: function(t, e) {
|
||
return u.def(l(this, f), t, e)
|
||
}
|
||
},
|
||
_ = t.exports = r(84)(f, g, y, u, !0, !0);
|
||
c(function() {
|
||
return 7 != (new _).set((Object.freeze || Object)(v), 7).get(v)
|
||
}) && (s((o = u.getConstructor(g, f)).prototype, y), i.NEED = !0, n(["delete", "has", "get", "set"], function(n) {
|
||
var t = _.prototype,
|
||
i = t[n];
|
||
a(t, n, function(t, e) {
|
||
if (!h(t) || p(t)) return i.call(this, t, e);
|
||
this._f || (this._f = new o);
|
||
var r = this._f[n](t, e);
|
||
return "set" == n ? this : r
|
||
})
|
||
}))
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var a = r(60),
|
||
s = r(48).getWeak,
|
||
i = r(6),
|
||
u = r(11),
|
||
h = r(58),
|
||
c = r(59),
|
||
n = r(41),
|
||
l = r(28),
|
||
f = r(65),
|
||
o = n(5),
|
||
d = n(6),
|
||
p = 0,
|
||
m = function(t) {
|
||
return t._l || (t._l = new v)
|
||
},
|
||
v = function() {
|
||
this.a = []
|
||
},
|
||
g = function(t, e) {
|
||
return o(t.a, function(t) {
|
||
return t[0] === e
|
||
})
|
||
};
|
||
v.prototype = {
|
||
get: function(t) {
|
||
var e = g(this, t);
|
||
if (e) return e[1]
|
||
},
|
||
has: function(t) {
|
||
return !!g(this, t)
|
||
},
|
||
set: function(t, e) {
|
||
var r = g(this, t);
|
||
r ? r[1] = e : this.a.push([t, e])
|
||
},
|
||
delete: function(e) {
|
||
var t = d(this.a, function(t) {
|
||
return t[0] === e
|
||
});
|
||
return ~t && this.a.splice(t, 1), !!~t
|
||
}
|
||
}, t.exports = {
|
||
getConstructor: function(t, r, n, i) {
|
||
var o = t(function(t, e) {
|
||
h(t, o, r, "_i"), t._t = r, t._i = p++, t._l = void 0, null != e && c(e, n, t[i], t)
|
||
});
|
||
return a(o.prototype, {
|
||
delete: function(t) {
|
||
if (!u(t)) return !1;
|
||
var e = s(t);
|
||
return !0 === e ? m(f(this, r)).delete(t) : e && l(e, this._i) && delete e[this._i]
|
||
},
|
||
has: function(t) {
|
||
if (!u(t)) return !1;
|
||
var e = s(t);
|
||
return !0 === e ? m(f(this, r)).has(t) : e && l(e, this._i)
|
||
}
|
||
}), o
|
||
},
|
||
def: function(t, e, r) {
|
||
var n = s(i(e), !0);
|
||
return !0 === n ? m(t).set(e, r) : n[t._i] = r, t
|
||
},
|
||
ufstore: m
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(35),
|
||
i = r(17);
|
||
t.exports = function(t) {
|
||
if (void 0 === t) return 0;
|
||
var e = n(t),
|
||
r = i(e);
|
||
if (e !== r) throw RangeError("Wrong length!");
|
||
return r
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(56),
|
||
i = r(76),
|
||
o = r(6),
|
||
a = r(9).Reflect;
|
||
t.exports = a && a.ownKeys || function(t) {
|
||
var e = n.f(o(t)),
|
||
r = i.f;
|
||
return r ? e.concat(r(t)) : e
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var d = r(77),
|
||
p = r(11),
|
||
m = r(17),
|
||
v = r(33),
|
||
g = r(15)("isConcatSpreadable");
|
||
t.exports = function flattenIntoArray(t, e, r, n, i, o, a, s) {
|
||
for (var u, h, c = i, l = 0, f = !!a && v(a, s, 3); l < n;) {
|
||
if (l in r) {
|
||
if (u = f ? f(r[l], l, e) : r[l], h = !1, p(u) && (h = void 0 !== (h = u[g]) ? !!h : d(u)), h && 0 < o) c = flattenIntoArray(t, e, u, m(u.length), c, o - 1) - 1;
|
||
else {
|
||
if (9007199254740991 <= c) throw TypeError();
|
||
t[c] = u
|
||
}
|
||
c++
|
||
}
|
||
l++
|
||
}
|
||
return c
|
||
}
|
||
}, function(t, e, r) {
|
||
var c = r(17),
|
||
l = r(106),
|
||
f = r(39);
|
||
t.exports = function(t, e, r, n) {
|
||
var i = String(f(t)),
|
||
o = i.length,
|
||
a = void 0 === r ? " " : String(r),
|
||
s = c(e);
|
||
if (s <= o || "" == a) return i;
|
||
var u = s - o,
|
||
h = l.call(a, Math.ceil(u / a.length));
|
||
return h.length > u && (h = h.slice(0, u)), n ? h + i : i + h
|
||
}
|
||
}, function(t, e, r) {
|
||
var u = r(53),
|
||
h = r(29),
|
||
c = r(70).f;
|
||
t.exports = function(s) {
|
||
return function(t) {
|
||
for (var e, r = h(t), n = u(r), i = n.length, o = 0, a = []; o < i;) c.call(r, e = n[o++]) && a.push(s ? [e, r[e]] : r[e]);
|
||
return a
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(62),
|
||
i = r(168);
|
||
t.exports = function(t) {
|
||
return function() {
|
||
if (n(this) != t) throw TypeError(t + "#toJSON isn't generic");
|
||
return i(this)
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(59);
|
||
t.exports = function(t, e) {
|
||
var r = [];
|
||
return n(t, !1, r.push, r, e), r
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = Math.scale || function(t, e, r, n, i) {
|
||
return 0 === arguments.length || t != t || e != e || r != r || n != n || i != i ? NaN : t === 1 / 0 || t === -1 / 0 ? t : (t - e) * (i - n) / (r - e) + n
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = Object.prototype.hasOwnProperty,
|
||
d = "~";
|
||
|
||
function Events() {}
|
||
|
||
function EE(t, e, r) {
|
||
this.fn = t, this.context = e, this.once = r || !1
|
||
}
|
||
|
||
function addListener(t, e, r, n, i) {
|
||
if ("function" != typeof r) throw new TypeError("The listener must be a function");
|
||
var o = new EE(r, n || t, i),
|
||
a = d ? d + e : e;
|
||
return t._events[a] ? t._events[a].fn ? t._events[a] = [t._events[a], o] : t._events[a].push(o) : (t._events[a] = o, t._eventsCount++), t
|
||
}
|
||
|
||
function clearEvent(t, e) {
|
||
0 == --t._eventsCount ? t._events = new Events : delete t._events[e]
|
||
}
|
||
|
||
function EventEmitter() {
|
||
this._events = new Events, this._eventsCount = 0
|
||
}
|
||
Object.create && (Events.prototype = Object.create(null), (new Events).__proto__ || (d = !1)), EventEmitter.prototype.eventNames = function() {
|
||
var t, e, r = [];
|
||
if (0 === this._eventsCount) return r;
|
||
for (e in t = this._events) n.call(t, e) && r.push(d ? e.slice(1) : e);
|
||
return Object.getOwnPropertySymbols ? r.concat(Object.getOwnPropertySymbols(t)) : r
|
||
}, EventEmitter.prototype.listeners = function(t) {
|
||
var e = d ? d + t : t,
|
||
r = this._events[e];
|
||
if (!r) return [];
|
||
if (r.fn) return [r.fn];
|
||
for (var n = 0, i = r.length, o = new Array(i); n < i; n++) o[n] = r[n].fn;
|
||
return o
|
||
}, EventEmitter.prototype.listenerCount = function(t) {
|
||
var e = d ? d + t : t,
|
||
r = this._events[e];
|
||
return r ? r.fn ? 1 : r.length : 0
|
||
}, EventEmitter.prototype.emit = function(t, e, r, n, i, o) {
|
||
var a = d ? d + t : t;
|
||
if (!this._events[a]) return !1;
|
||
var s, u, h = this._events[a],
|
||
c = arguments.length;
|
||
if (h.fn) {
|
||
switch (h.once && this.removeListener(t, h.fn, void 0, !0), c) {
|
||
case 1:
|
||
return h.fn.call(h.context), !0;
|
||
case 2:
|
||
return h.fn.call(h.context, e), !0;
|
||
case 3:
|
||
return h.fn.call(h.context, e, r), !0;
|
||
case 4:
|
||
return h.fn.call(h.context, e, r, n), !0;
|
||
case 5:
|
||
return h.fn.call(h.context, e, r, n, i), !0;
|
||
case 6:
|
||
return h.fn.call(h.context, e, r, n, i, o), !0
|
||
}
|
||
for (u = 1, s = new Array(c - 1); u < c; u++) s[u - 1] = arguments[u];
|
||
h.fn.apply(h.context, s)
|
||
} else {
|
||
var l, f = h.length;
|
||
for (u = 0; u < f; u++) switch (h[u].once && this.removeListener(t, h[u].fn, void 0, !0), c) {
|
||
case 1:
|
||
h[u].fn.call(h[u].context);
|
||
break;
|
||
case 2:
|
||
h[u].fn.call(h[u].context, e);
|
||
break;
|
||
case 3:
|
||
h[u].fn.call(h[u].context, e, r);
|
||
break;
|
||
case 4:
|
||
h[u].fn.call(h[u].context, e, r, n);
|
||
break;
|
||
default:
|
||
if (!s)
|
||
for (l = 1, s = new Array(c - 1); l < c; l++) s[l - 1] = arguments[l];
|
||
h[u].fn.apply(h[u].context, s)
|
||
}
|
||
}
|
||
return !0
|
||
}, EventEmitter.prototype.on = function(t, e, r) {
|
||
return addListener(this, t, e, r, !1)
|
||
}, EventEmitter.prototype.once = function(t, e, r) {
|
||
return addListener(this, t, e, r, !0)
|
||
}, EventEmitter.prototype.removeListener = function(t, e, r, n) {
|
||
var i = d ? d + t : t;
|
||
if (!this._events[i]) return this;
|
||
if (!e) return clearEvent(this, i), this;
|
||
var o = this._events[i];
|
||
if (o.fn) o.fn !== e || n && !o.once || r && o.context !== r || clearEvent(this, i);
|
||
else {
|
||
for (var a = 0, s = [], u = o.length; a < u; a++)(o[a].fn !== e || n && !o[a].once || r && o[a].context !== r) && s.push(o[a]);
|
||
s.length ? this._events[i] = 1 === s.length ? s[0] : s : clearEvent(this, i)
|
||
}
|
||
return this
|
||
}, EventEmitter.prototype.removeAllListeners = function(t) {
|
||
var e;
|
||
return t ? (e = d ? d + t : t, this._events[e] && clearEvent(this, e)) : (this._events = new Events, this._eventsCount = 0), this
|
||
}, EventEmitter.prototype.off = EventEmitter.prototype.removeListener, EventEmitter.prototype.addListener = EventEmitter.prototype.on, EventEmitter.prefixed = d, EventEmitter.EventEmitter = EventEmitter, t.exports = EventEmitter
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
|
||
function earcut(t, e, r) {
|
||
r = r || 2;
|
||
var n, i, o, a, s, u, h, c = e && e.length,
|
||
l = c ? e[0] * r : t.length,
|
||
f = linkedList(t, 0, l, r, !0),
|
||
d = [];
|
||
if (!f || f.next === f.prev) return d;
|
||
if (c && (f = function(t, e, r, n) {
|
||
var i, o, a, s, u, h = [];
|
||
for (i = 0, o = e.length; i < o; i++) a = e[i] * n, s = i < o - 1 ? e[i + 1] * n : t.length, (u = linkedList(t, a, s, n, !1)) === u.next && (u.steiner = !0), h.push(getLeftmost(u));
|
||
for (h.sort(compareX), i = 0; i < h.length; i++) eliminateHole(h[i], r), r = filterPoints(r, r.next);
|
||
return r
|
||
}(t, e, f, r)), t.length > 80 * r) {
|
||
n = o = t[0], i = a = t[1];
|
||
for (var p = r; p < l; p += r)(s = t[p]) < n && (n = s), (u = t[p + 1]) < i && (i = u), o < s && (o = s), a < u && (a = u);
|
||
h = 0 !== (h = Math.max(o - n, a - i)) ? 1 / h : 0
|
||
}
|
||
return earcutLinked(f, d, r, n, i, h), d
|
||
}
|
||
|
||
function linkedList(t, e, r, n, i) {
|
||
var o, a;
|
||
if (i === 0 < signedArea(t, e, r, n))
|
||
for (o = e; o < r; o += n) a = insertNode(o, t[o], t[o + 1], a);
|
||
else
|
||
for (o = r - n; e <= o; o -= n) a = insertNode(o, t[o], t[o + 1], a);
|
||
return a && equals(a, a.next) && (removeNode(a), a = a.next), a
|
||
}
|
||
|
||
function filterPoints(t, e) {
|
||
if (!t) return t;
|
||
e || (e = t);
|
||
var r, n = t;
|
||
do {
|
||
if (r = !1, n.steiner || !equals(n, n.next) && 0 !== area(n.prev, n, n.next)) n = n.next;
|
||
else {
|
||
if (removeNode(n), (n = e = n.prev) === n.next) break;
|
||
r = !0
|
||
}
|
||
} while (r || n !== e);
|
||
return e
|
||
}
|
||
|
||
function earcutLinked(t, e, r, n, i, o, a) {
|
||
if (t) {
|
||
!a && o && function(t, e, r, n) {
|
||
var i = t;
|
||
for (; null === i.z && (i.z = zOrder(i.x, i.y, e, r, n)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next, i !== t;);
|
||
i.prevZ.nextZ = null, i.prevZ = null,
|
||
function(t) {
|
||
var e, r, n, i, o, a, s, u, h = 1;
|
||
do {
|
||
for (r = t, o = t = null, a = 0; r;) {
|
||
for (a++, n = r, e = s = 0; e < h && (s++, n = n.nextZ); e++);
|
||
for (u = h; 0 < s || 0 < u && n;) 0 !== s && (0 === u || !n || r.z <= n.z) ? (r = (i = r).nextZ, s--) : (n = (i = n).nextZ, u--), o ? o.nextZ = i : t = i, i.prevZ = o, o = i;
|
||
r = n
|
||
}
|
||
o.nextZ = null, h *= 2
|
||
} while (1 < a)
|
||
}(i)
|
||
}(t, n, i, o);
|
||
for (var s, u, h = t; t.prev !== t.next;)
|
||
if (s = t.prev, u = t.next, o ? isEarHashed(t, n, i, o) : isEar(t)) e.push(s.i / r), e.push(t.i / r), e.push(u.i / r), removeNode(t), t = u.next, h = u.next;
|
||
else if ((t = u) === h) {
|
||
a ? 1 === a ? earcutLinked(t = cureLocalIntersections(t, e, r), e, r, n, i, o, 2) : 2 === a && splitEarcut(t, e, r, n, i, o) : earcutLinked(filterPoints(t), e, r, n, i, o, 1);
|
||
break
|
||
}
|
||
}
|
||
}
|
||
|
||
function isEar(t) {
|
||
var e = t.prev,
|
||
r = t,
|
||
n = t.next;
|
||
if (0 <= area(e, r, n)) return !1;
|
||
for (var i = t.next.next; i !== t.prev;) {
|
||
if (pointInTriangle(e.x, e.y, r.x, r.y, n.x, n.y, i.x, i.y) && 0 <= area(i.prev, i, i.next)) return !1;
|
||
i = i.next
|
||
}
|
||
return !0
|
||
}
|
||
|
||
function isEarHashed(t, e, r, n) {
|
||
var i = t.prev,
|
||
o = t,
|
||
a = t.next;
|
||
if (0 <= area(i, o, a)) return !1;
|
||
for (var s = i.x < o.x ? i.x < a.x ? i.x : a.x : o.x < a.x ? o.x : a.x, u = i.y < o.y ? i.y < a.y ? i.y : a.y : o.y < a.y ? o.y : a.y, h = i.x > o.x ? i.x > a.x ? i.x : a.x : o.x > a.x ? o.x : a.x, c = i.y > o.y ? i.y > a.y ? i.y : a.y : o.y > a.y ? o.y : a.y, l = zOrder(s, u, e, r, n), f = zOrder(h, c, e, r, n), d = t.prevZ, p = t.nextZ; d && d.z >= l && p && p.z <= f;) {
|
||
if (d !== t.prev && d !== t.next && pointInTriangle(i.x, i.y, o.x, o.y, a.x, a.y, d.x, d.y) && 0 <= area(d.prev, d, d.next)) return !1;
|
||
if (d = d.prevZ, p !== t.prev && p !== t.next && pointInTriangle(i.x, i.y, o.x, o.y, a.x, a.y, p.x, p.y) && 0 <= area(p.prev, p, p.next)) return !1;
|
||
p = p.nextZ
|
||
}
|
||
for (; d && d.z >= l;) {
|
||
if (d !== t.prev && d !== t.next && pointInTriangle(i.x, i.y, o.x, o.y, a.x, a.y, d.x, d.y) && 0 <= area(d.prev, d, d.next)) return !1;
|
||
d = d.prevZ
|
||
}
|
||
for (; p && p.z <= f;) {
|
||
if (p !== t.prev && p !== t.next && pointInTriangle(i.x, i.y, o.x, o.y, a.x, a.y, p.x, p.y) && 0 <= area(p.prev, p, p.next)) return !1;
|
||
p = p.nextZ
|
||
}
|
||
return !0
|
||
}
|
||
|
||
function cureLocalIntersections(t, e, r) {
|
||
var n = t;
|
||
do {
|
||
var i = n.prev,
|
||
o = n.next.next;
|
||
!equals(i, o) && intersects(i, n, n.next, o) && locallyInside(i, o) && locallyInside(o, i) && (e.push(i.i / r), e.push(n.i / r), e.push(o.i / r), removeNode(n), removeNode(n.next), n = t = o), n = n.next
|
||
} while (n !== t);
|
||
return n
|
||
}
|
||
|
||
function splitEarcut(t, e, r, n, i, o) {
|
||
var a, s, u = t;
|
||
do {
|
||
for (var h = u.next.next; h !== u.prev;) {
|
||
if (u.i !== h.i && (s = h, (a = u).next.i !== s.i && a.prev.i !== s.i && ! function(t, e) {
|
||
var r = t;
|
||
do {
|
||
if (r.i !== t.i && r.next.i !== t.i && r.i !== e.i && r.next.i !== e.i && intersects(r, r.next, t, e)) return !0;
|
||
r = r.next
|
||
} while (r !== t);
|
||
return !1
|
||
}(a, s) && locallyInside(a, s) && locallyInside(s, a) && function(t, e) {
|
||
var r = t,
|
||
n = !1,
|
||
i = (t.x + e.x) / 2,
|
||
o = (t.y + e.y) / 2;
|
||
for (; r.y > o != r.next.y > o && r.next.y !== r.y && i < (r.next.x - r.x) * (o - r.y) / (r.next.y - r.y) + r.x && (n = !n), r = r.next, r !== t;);
|
||
return n
|
||
}(a, s))) {
|
||
var c = splitPolygon(u, h);
|
||
return u = filterPoints(u, u.next), c = filterPoints(c, c.next), earcutLinked(u, e, r, n, i, o), void earcutLinked(c, e, r, n, i, o)
|
||
}
|
||
h = h.next
|
||
}
|
||
u = u.next
|
||
} while (u !== t)
|
||
}
|
||
|
||
function compareX(t, e) {
|
||
return t.x - e.x
|
||
}
|
||
|
||
function eliminateHole(t, e) {
|
||
if (e = function(t, e) {
|
||
var r, n = e,
|
||
i = t.x,
|
||
o = t.y,
|
||
a = -1 / 0;
|
||
do {
|
||
if (o <= n.y && o >= n.next.y && n.next.y !== n.y) {
|
||
var s = n.x + (o - n.y) * (n.next.x - n.x) / (n.next.y - n.y);
|
||
if (s <= i && a < s) {
|
||
if ((a = s) === i) {
|
||
if (o === n.y) return n;
|
||
if (o === n.next.y) return n.next
|
||
}
|
||
r = n.x < n.next.x ? n : n.next
|
||
}
|
||
}
|
||
n = n.next
|
||
} while (n !== e);
|
||
if (!r) return null;
|
||
if (i === a) return r.prev;
|
||
var u, h = r,
|
||
c = r.x,
|
||
l = r.y,
|
||
f = 1 / 0;
|
||
n = r.next;
|
||
for (; n !== h;) i >= n.x && n.x >= c && i !== n.x && pointInTriangle(o < l ? i : a, o, c, l, o < l ? a : i, o, n.x, n.y) && ((u = Math.abs(o - n.y) / (i - n.x)) < f || u === f && n.x > r.x) && locallyInside(n, t) && (r = n, f = u), n = n.next;
|
||
return r
|
||
}(t, e)) {
|
||
var r = splitPolygon(e, t);
|
||
filterPoints(r, r.next)
|
||
}
|
||
}
|
||
|
||
function zOrder(t, e, r, n, i) {
|
||
return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - r) * i) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - n) * i) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1
|
||
}
|
||
|
||
function getLeftmost(t) {
|
||
for (var e = t, r = t;
|
||
(e.x < r.x || e.x === r.x && e.y < r.y) && (r = e), (e = e.next) !== t;);
|
||
return r
|
||
}
|
||
|
||
function pointInTriangle(t, e, r, n, i, o, a, s) {
|
||
return 0 <= (i - a) * (e - s) - (t - a) * (o - s) && 0 <= (t - a) * (n - s) - (r - a) * (e - s) && 0 <= (r - a) * (o - s) - (i - a) * (n - s)
|
||
}
|
||
|
||
function area(t, e, r) {
|
||
return (e.y - t.y) * (r.x - e.x) - (e.x - t.x) * (r.y - e.y)
|
||
}
|
||
|
||
function equals(t, e) {
|
||
return t.x === e.x && t.y === e.y
|
||
}
|
||
|
||
function intersects(t, e, r, n) {
|
||
return !!(equals(t, e) && equals(r, n) || equals(t, n) && equals(r, e)) || 0 < area(t, e, r) != 0 < area(t, e, n) && 0 < area(r, n, t) != 0 < area(r, n, e)
|
||
}
|
||
|
||
function locallyInside(t, e) {
|
||
return area(t.prev, t, t.next) < 0 ? 0 <= area(t, e, t.next) && 0 <= area(t, t.prev, e) : area(t, e, t.prev) < 0 || area(t, t.next, e) < 0
|
||
}
|
||
|
||
function splitPolygon(t, e) {
|
||
var r = new Node(t.i, t.x, t.y),
|
||
n = new Node(e.i, e.x, e.y),
|
||
i = t.next,
|
||
o = e.prev;
|
||
return (t.next = e).prev = t, (r.next = i).prev = r, (n.next = r).prev = n, (o.next = n).prev = o, n
|
||
}
|
||
|
||
function insertNode(t, e, r, n) {
|
||
var i = new Node(t, e, r);
|
||
return n ? (i.next = n.next, (i.prev = n).next.prev = i, n.next = i) : (i.prev = i).next = i, i
|
||
}
|
||
|
||
function removeNode(t) {
|
||
t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ)
|
||
}
|
||
|
||
function Node(t, e, r) {
|
||
this.i = t, this.x = e, this.y = r, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1
|
||
}
|
||
|
||
function signedArea(t, e, r, n) {
|
||
for (var i = 0, o = e, a = r - n; o < r; o += n) i += (t[a] - t[o]) * (t[o + 1] + t[a + 1]), a = o;
|
||
return i
|
||
}
|
||
t.exports = earcut, (t.exports.default = earcut).deviation = function(t, e, r, n) {
|
||
var i = e && e.length,
|
||
o = i ? e[0] * r : t.length,
|
||
a = Math.abs(signedArea(t, 0, o, r));
|
||
if (i)
|
||
for (var s = 0, u = e.length; s < u; s++) {
|
||
var h = e[s] * r,
|
||
c = s < u - 1 ? e[s + 1] * r : t.length;
|
||
a -= Math.abs(signedArea(t, h, c, r))
|
||
}
|
||
var l = 0;
|
||
for (s = 0; s < n.length; s += 3) {
|
||
var f = n[s] * r,
|
||
d = n[s + 1] * r,
|
||
p = n[s + 2] * r;
|
||
l += Math.abs((t[f] - t[p]) * (t[d + 1] - t[f + 1]) - (t[f] - t[d]) * (t[p + 1] - t[f + 1]))
|
||
}
|
||
return 0 === a && 0 === l ? 0 : Math.abs((l - a) / a)
|
||
}, earcut.flatten = function(t) {
|
||
for (var e = t[0][0].length, r = {
|
||
vertices: [],
|
||
holes: [],
|
||
dimensions: e
|
||
}, n = 0, i = 0; i < t.length; i++) {
|
||
for (var o = 0; o < t[i].length; o++)
|
||
for (var a = 0; a < e; a++) r.vertices.push(t[i][o][a]);
|
||
0 < i && (n += t[i - 1].length, r.holes.push(n))
|
||
}
|
||
return r
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
t.exports = 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
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
|
||
function _noop() {}
|
||
|
||
function onlyOnce(e) {
|
||
return function() {
|
||
if (null === e) throw new Error("Callback was already called.");
|
||
var t = e;
|
||
e = null, t.apply(this, arguments)
|
||
}
|
||
}
|
||
e.__esModule = !0, e.eachSeries = function(e, r, n, i) {
|
||
var o = 0,
|
||
a = e.length;
|
||
! function next(t) {
|
||
t || o === a ? n && n(t) : i ? setTimeout(function() {
|
||
r(e[o++], next)
|
||
}, 1) : r(e[o++], next)
|
||
}()
|
||
}, e.queue = function(e, t) {
|
||
if (null == t) t = 1;
|
||
else if (0 === t) throw new Error("Concurrency must not be zero");
|
||
var r = 0,
|
||
i = {
|
||
_tasks: [],
|
||
concurrency: t,
|
||
saturated: _noop,
|
||
unsaturated: _noop,
|
||
buffer: t / 4,
|
||
empty: _noop,
|
||
drain: _noop,
|
||
error: _noop,
|
||
started: !1,
|
||
paused: !1,
|
||
push: function(t, e) {
|
||
_insert(t, !1, e)
|
||
},
|
||
kill: function() {
|
||
r = 0, i.drain = _noop, i.started = !1, i._tasks = []
|
||
},
|
||
unshift: function(t, e) {
|
||
_insert(t, !0, e)
|
||
},
|
||
process: function() {
|
||
for (; !i.paused && r < i.concurrency && i._tasks.length;) {
|
||
var t = i._tasks.shift();
|
||
0 === i._tasks.length && i.empty(), (r += 1) === i.concurrency && i.saturated(), e(t.data, onlyOnce(_next(t)))
|
||
}
|
||
},
|
||
length: function() {
|
||
return i._tasks.length
|
||
},
|
||
running: function() {
|
||
return r
|
||
},
|
||
idle: function() {
|
||
return i._tasks.length + r === 0
|
||
},
|
||
pause: function() {
|
||
!0 !== i.paused && (i.paused = !0)
|
||
},
|
||
resume: function() {
|
||
if (!1 !== i.paused) {
|
||
i.paused = !1;
|
||
for (var t = 1; t <= i.concurrency; t++) i.process()
|
||
}
|
||
}
|
||
};
|
||
|
||
function _insert(t, e, r) {
|
||
if (null != r && "function" != typeof r) throw new Error("task callback must be a function");
|
||
if (i.started = !0, null == t && i.idle()) setTimeout(function() {
|
||
return i.drain()
|
||
}, 1);
|
||
else {
|
||
var n = {
|
||
data: t,
|
||
callback: "function" == typeof r ? r : _noop
|
||
};
|
||
e ? i._tasks.unshift(n) : i._tasks.push(n), setTimeout(function() {
|
||
return i.process()
|
||
}, 1)
|
||
}
|
||
}
|
||
|
||
function _next(t) {
|
||
return function() {
|
||
r -= 1, t.callback.apply(t, arguments), null != arguments[0] && i.error(arguments[0], t.data), r <= i.concurrency - i.buffer && i.unsaturated(), i.idle() && i.drain(), i.process()
|
||
}
|
||
}
|
||
return i
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0, e.Resource = void 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
|
||
}
|
||
}(),
|
||
i = _interopRequireDefault(r(172)),
|
||
o = _interopRequireDefault(r(125));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var a = !(!window.XDomainRequest || "withCredentials" in new XMLHttpRequest),
|
||
s = null;
|
||
|
||
function _noop() {}
|
||
var u = 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 o.default, this.onProgress = new o.default, this.onComplete = new o.default, this.onAfterMiddleware = new o.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:
|
||
a && 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, s || (s = document.createElement("a")), s.href = t;
|
||
var r = !(t = (0, i.default)(s.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"
|
||
}
|
||
}, n(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 ", "")
|
||
}
|
||
u.STATUS_FLAGS = {
|
||
NONE: 0,
|
||
DATA_URL: 1,
|
||
COMPLETE: 2,
|
||
LOADING: 4
|
||
}, u.TYPE = {
|
||
UNKNOWN: 0,
|
||
JSON: 1,
|
||
XML: 2,
|
||
IMAGE: 3,
|
||
AUDIO: 4,
|
||
VIDEO: 5,
|
||
TEXT: 6
|
||
}, u.LOAD_TYPE = {
|
||
XHR: 1,
|
||
IMAGE: 2,
|
||
AUDIO: 3,
|
||
VIDEO: 4
|
||
}, u.XHR_RESPONSE_TYPE = {
|
||
DEFAULT: "text",
|
||
BUFFER: "arraybuffer",
|
||
BLOB: "blob",
|
||
DOCUMENT: "document",
|
||
JSON: "json",
|
||
TEXT: "text"
|
||
}, u._loadTypeMap = {
|
||
gif: u.LOAD_TYPE.IMAGE,
|
||
png: u.LOAD_TYPE.IMAGE,
|
||
bmp: u.LOAD_TYPE.IMAGE,
|
||
jpg: u.LOAD_TYPE.IMAGE,
|
||
jpeg: u.LOAD_TYPE.IMAGE,
|
||
tif: u.LOAD_TYPE.IMAGE,
|
||
tiff: u.LOAD_TYPE.IMAGE,
|
||
webp: u.LOAD_TYPE.IMAGE,
|
||
tga: u.LOAD_TYPE.IMAGE,
|
||
svg: u.LOAD_TYPE.IMAGE,
|
||
"svg+xml": u.LOAD_TYPE.IMAGE,
|
||
mp3: u.LOAD_TYPE.AUDIO,
|
||
ogg: u.LOAD_TYPE.AUDIO,
|
||
wav: u.LOAD_TYPE.AUDIO,
|
||
mp4: u.LOAD_TYPE.VIDEO,
|
||
webm: u.LOAD_TYPE.VIDEO
|
||
}, u._xhrTypeMap = {
|
||
xhtml: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
html: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
htm: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
xml: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
tmx: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
svg: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
tsx: u.XHR_RESPONSE_TYPE.DOCUMENT,
|
||
gif: u.XHR_RESPONSE_TYPE.BLOB,
|
||
png: u.XHR_RESPONSE_TYPE.BLOB,
|
||
bmp: u.XHR_RESPONSE_TYPE.BLOB,
|
||
jpg: u.XHR_RESPONSE_TYPE.BLOB,
|
||
jpeg: u.XHR_RESPONSE_TYPE.BLOB,
|
||
tif: u.XHR_RESPONSE_TYPE.BLOB,
|
||
tiff: u.XHR_RESPONSE_TYPE.BLOB,
|
||
webp: u.XHR_RESPONSE_TYPE.BLOB,
|
||
tga: u.XHR_RESPONSE_TYPE.BLOB,
|
||
json: u.XHR_RESPONSE_TYPE.JSON,
|
||
text: u.XHR_RESPONSE_TYPE.TEXT,
|
||
txt: u.XHR_RESPONSE_TYPE.TEXT,
|
||
ttf: u.XHR_RESPONSE_TYPE.BUFFER,
|
||
otf: u.XHR_RESPONSE_TYPE.BUFFER
|
||
}, u.EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", t.exports.default = u
|
||
}, 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 Group(t) {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Group), this.children = t || []
|
||
}
|
||
return Group.prototype.add = function(t) {
|
||
return this.children.push(t), t
|
||
}, Group.prototype.remove = function(t) {
|
||
var e = this.children.indexOf(t);
|
||
return -1 === e ? null : (this.children.splice(e, 1), t)
|
||
}, Group.prototype.contains = function(t) {
|
||
return -1 !== this.children.indexOf(t)
|
||
}, Group.prototype.getIndex = function(t) {
|
||
return this.children.indexOf(t)
|
||
}, Group.prototype.getItem = function(t) {
|
||
return this.children[t]
|
||
}, Group.prototype.run = function(t, e) {
|
||
var r = void 0;
|
||
if (e)
|
||
for (r = 0; r < this.children.length; r++) t.call(e, this.children[r]);
|
||
else
|
||
for (r = 0; r < this.children.length; r++) t(this.children[r])
|
||
}, Group.prototype.empty = function() {
|
||
this.children.length = 0
|
||
}, n(Group, [{
|
||
key: "length",
|
||
get: function() {
|
||
return this.children.length
|
||
}
|
||
}]), Group
|
||
}();
|
||
e.default = i
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n, i = r(125),
|
||
o = (n = i) && n.__esModule ? n : {
|
||
default: n
|
||
};
|
||
var a = function() {
|
||
function Signals() {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Signals), this.signals = {}
|
||
}
|
||
return Signals.prototype.register = function(t) {
|
||
var e = arguments.length;
|
||
if (1 < e)
|
||
for (var r = 0; r < e; r++) this.register(arguments[r]);
|
||
else this.signals[t] || (this.signals[t] = new o.default)
|
||
}, Signals.prototype.resetSignals = function() {
|
||
for (var t in this.signals) this.signals[t].detachAll()
|
||
}, Signals
|
||
}();
|
||
e.default = a
|
||
}, 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
|
||
}
|
||
}(),
|
||
i = _interopRequireDefault(r(8)),
|
||
o = _interopRequireDefault(r(176)),
|
||
a = _interopRequireDefault(r(414)),
|
||
s = _interopRequireDefault(r(5));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var u = function(e) {
|
||
function Entity() {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Entity);
|
||
var t = 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));
|
||
return t.UID = Entity._UID++, t.data = null, t.static = !1, t.parent = null, t.name = "item" + t.UID, t.game = null, t.groups = [], t._gc = !1, t._adding = !1, t._init = new i.default("init", 1), t._addedToGame = new i.default("addedToGame", 1), t._start = new i.default("start"), t._update = new i.default("update", 1), t._render = new i.default("render", 2), t._removedFromGame = new i.default("removedFromGame", 1), t._reset = new i.default("reset"), t._activate = new i.default("activate"), t._deactivate = new i.default("deactivate"), t.updateFrequency = 1, t._scriptCount = 0, t._active = !0, t._worldActive = !0, t.onEntityDestroyed = new i.default("entityDestroyed", 1), t
|
||
}
|
||
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)
|
||
}(Entity, e), Entity.prototype.addSelf = function() {
|
||
this._init.add(this), this._start.add(this), this._update.add(this), this._reset.add(this), this._render.add(this), this._activate.remove(this), this._deactivate.add(this)
|
||
}, Entity.prototype.removeSelf = function() {
|
||
this._init.remove(this), this._start.remove(this), this._update.remove(this), this._reset.remove(this), this._render.remove(this), this._activate.remove(this), this._deactivate.remove(this)
|
||
}, Entity.prototype.destroy = function() {
|
||
this.onEntityDestroyed.run(this), this.onEntityDestroyed.removeAll()
|
||
}, Entity.prototype.addEntity = function(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {},
|
||
r = a.default.get(t);
|
||
return r.init(e), this.container.add(r), r
|
||
}, Entity.prototype.removeEntity = function(t) {
|
||
t.reset(), a.default.return(t), this.container.remove(t)
|
||
}, Entity.prototype.add = function(t, e, r) {
|
||
if (this[r = r || Entity.getComponentName(t)]) return this;
|
||
var n = new t(this, e);
|
||
return this[r] = n, this._init.add(n), this._start.add(n), this._update.add(n), this._reset.add(n), this._render.add(n), this._addedToGame.add(n), this._removedFromGame.add(n), this._class = t, this.checkUpdateable(n), this.checkRenderable(n), n.added && n.added(), this.game && n.addedToGame && n.addedToGame(), this
|
||
}, Entity.prototype.addScript = function(t, e) {
|
||
"string" != typeof t && (e = t, t = "component" + this._scriptCount++);
|
||
var r = s.default.create(t + "_" + this.constructor.name, e);
|
||
return r.id = t, this.add(r), this
|
||
}, Entity.prototype.addChild = function(t) {
|
||
this.container.add(t)
|
||
}, Entity.prototype.removeChild = function(t) {
|
||
this.container.remove(t)
|
||
}, Entity.prototype.removeChildren = function() {
|
||
this.container.removeAll()
|
||
}, Entity.prototype.remove = function(t, e) {
|
||
"string" == typeof t && (e = t);
|
||
var r = this[e = e || Entity.getComponentName(t)];
|
||
r && (this._init.remove(r), this._update.remove(r), this._start.remove(r), this._render.remove(r), this._reset.remove(r), this._addedToGame.remove(r), this._removedFromGame.remove(r), r.removed && r.removed(), this.checkRenderable(), this.checkUpdateable(), r.reset && r.reset(), this[e] = null)
|
||
}, Entity.prototype.checkRenderable = function() {
|
||
if (this.game) {
|
||
var t = this.game.onRenderEntities.contains(this._render),
|
||
e = this._render.empty;
|
||
t === e && (e ? this.game.onRenderEntities.remove(this._render) : this.game.onRenderEntities.add(this._render))
|
||
}
|
||
}, Entity.prototype.checkUpdateable = function() {
|
||
if (this.game) {
|
||
var t = this.game.onUpdateEntities.contains(this._update),
|
||
e = this._update.empty;
|
||
t === e && (e ? this.game.onUpdateEntities.remove(this._update) : this.game.onUpdateEntities.add(this._update))
|
||
}
|
||
}, Entity.getComponentName = function(t) {
|
||
var e = t.id || t.name[0].toLowerCase() + t.name.slice(1);
|
||
return e
|
||
}, n(Entity, [{
|
||
key: "active",
|
||
set: function(t) {
|
||
this._active = t;
|
||
var e = this.parent ? this.parent._worldActive && t : t;
|
||
if (e !== this._worldActive && ((this._worldActive = e) ? this._activate.run() : this._deactivate.run()), this.container)
|
||
for (var r = this.container.children, n = 0; n < r.length; n++) r[n].active = e
|
||
},
|
||
get: function() {
|
||
return this._active
|
||
}
|
||
}]), Entity
|
||
}(o.default);
|
||
(e.default = u)._UID = 0
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n, i = r(5);
|
||
var o = function(n) {
|
||
function Container(t, e) {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Container);
|
||
var r = 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, t, e));
|
||
return r.children = [], r.parent = null, r
|
||
}
|
||
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)
|
||
}(Container, n), Container.prototype.empty = function() {
|
||
for (var t = 0; t < this.children.length; t++) this.children[t].parent = null;
|
||
this.children.length = 0
|
||
}, Container.prototype.traverse = function(t) {
|
||
t(this.entity);
|
||
for (var e = this.children, r = 0, n = e.length; r < n; r++) e[r].container.traverse(t)
|
||
}, Container.prototype.add = function(t) {
|
||
if (t.parent) {
|
||
var e = t.parent.container.children.indexOf(t); - 1 !== e && t.parent.container.children.splice(e, 1)
|
||
}
|
||
t.parent = this.entity, this.children.push(t), t.active = t.active, this.entity.game && !t.game && this.entity.game.addToGame(t)
|
||
}, Container.prototype.removeAll = function() {
|
||
for (var t = 0; t < this.children.length; t++) {
|
||
var e = this.children[t];
|
||
this.entity.game && this.entity.game.removeFromGame(e), e.parent = null
|
||
}
|
||
this.children.length = 0
|
||
}, Container.prototype.remove = function(t) {
|
||
var e = this.children.indexOf(t); - 1 !== e && (this.children.splice(e, 1), this.entity.game && this.entity.game.removeFromGame(t), t.parent = null)
|
||
}, Container
|
||
}(((n = i) && n.__esModule ? n : {
|
||
default: n
|
||
}).default);
|
||
e.default = o
|
||
}, 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(473)),
|
||
o = _interopRequireDefault(r(474));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var a = function(e) {
|
||
function LambertMaterial() {
|
||
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, LambertMaterial),
|
||
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, [], "lambert"))
|
||
}
|
||
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)
|
||
}(LambertMaterial, e), LambertMaterial
|
||
}(n.default);
|
||
e.default = a
|
||
}, function(p, m, v) {
|
||
(function(t, f) {
|
||
var d;
|
||
! function(t) {
|
||
var e, r = t.Promise,
|
||
n = r && "resolve" in r && "reject" in r && "all" in r && "race" in r && (new r(function(t) {
|
||
e = t
|
||
}), "function" == typeof e);
|
||
m ? (m.Promise = n ? r : Promise, m.Polyfill = Promise) : void 0 === (d = function() {
|
||
return n ? r : Promise
|
||
}.call(m, v, m, p)) || (p.exports = d);
|
||
var i = "pending",
|
||
o = "sealed",
|
||
a = "fulfilled",
|
||
s = "rejected",
|
||
u = function() {};
|
||
|
||
function isArray(t) {
|
||
return "[object Array]" === Object.prototype.toString.call(t)
|
||
}
|
||
var h, c = void 0 !== f ? f : setTimeout,
|
||
l = [];
|
||
|
||
function asyncFlush() {
|
||
for (var t = 0; t < l.length; t++) l[t][0](l[t][1]);
|
||
h = !(l = [])
|
||
}
|
||
|
||
function asyncCall(t, e) {
|
||
l.push([t, e]), h || (h = !0, c(asyncFlush, 0))
|
||
}
|
||
|
||
function invokeCallback(t) {
|
||
var e = t.owner,
|
||
r = e.state_,
|
||
n = e.data_,
|
||
i = t[r],
|
||
o = t.then;
|
||
if ("function" == typeof i) {
|
||
r = a;
|
||
try {
|
||
n = i(n)
|
||
} catch (t) {
|
||
reject(o, t)
|
||
}
|
||
}
|
||
handleThenable(o, n) || (r === a && resolve(o, n), r === s && reject(o, n))
|
||
}
|
||
|
||
function handleThenable(e, r) {
|
||
var n;
|
||
try {
|
||
if (e === r) throw new TypeError("A promises callback cannot return that same promise.");
|
||
if (r && ("function" == typeof r || "object" == typeof r)) {
|
||
var t = r.then;
|
||
if ("function" == typeof t) return t.call(r, function(t) {
|
||
n || (n = !0, r !== t ? resolve(e, t) : fulfill(e, t))
|
||
}, function(t) {
|
||
n || (n = !0, reject(e, t))
|
||
}), !0
|
||
}
|
||
} catch (t) {
|
||
return n || reject(e, t), !0
|
||
}
|
||
return !1
|
||
}
|
||
|
||
function resolve(t, e) {
|
||
t !== e && handleThenable(t, e) || fulfill(t, e)
|
||
}
|
||
|
||
function fulfill(t, e) {
|
||
t.state_ === i && (t.state_ = o, t.data_ = e, asyncCall(publishFulfillment, t))
|
||
}
|
||
|
||
function reject(t, e) {
|
||
t.state_ === i && (t.state_ = o, t.data_ = e, asyncCall(publishRejection, t))
|
||
}
|
||
|
||
function publish(t) {
|
||
var e = t.then_;
|
||
t.then_ = void 0;
|
||
for (var r = 0; r < e.length; r++) invokeCallback(e[r])
|
||
}
|
||
|
||
function publishFulfillment(t) {
|
||
t.state_ = a, publish(t)
|
||
}
|
||
|
||
function publishRejection(t) {
|
||
t.state_ = s, publish(t)
|
||
}
|
||
|
||
function Promise(t) {
|
||
if ("function" != typeof t) throw new TypeError("Promise constructor takes a function argument");
|
||
if (this instanceof Promise == !1) throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
|
||
this.then_ = [],
|
||
function(t, e) {
|
||
function rejectPromise(t) {
|
||
reject(e, t)
|
||
}
|
||
try {
|
||
t(function(t) {
|
||
resolve(e, t)
|
||
}, rejectPromise)
|
||
} catch (t) {
|
||
rejectPromise(t)
|
||
}
|
||
}(t, this)
|
||
}
|
||
Promise.prototype = {
|
||
constructor: Promise,
|
||
state_: i,
|
||
then_: null,
|
||
data_: void 0,
|
||
then: function(t, e) {
|
||
var r = {
|
||
owner: this,
|
||
then: new this.constructor(u),
|
||
fulfilled: t,
|
||
rejected: e
|
||
};
|
||
return this.state_ === a || this.state_ === s ? asyncCall(invokeCallback, r) : this.then_.push(r), r.then
|
||
},
|
||
catch: function(t) {
|
||
return this.then(null, t)
|
||
}
|
||
}, Promise.all = function(a) {
|
||
if (!isArray(a)) throw new TypeError("You must pass an array to Promise.all().");
|
||
return new this(function(r, t) {
|
||
var n = [],
|
||
i = 0;
|
||
|
||
function resolver(e) {
|
||
return i++,
|
||
function(t) {
|
||
n[e] = t, --i || r(n)
|
||
}
|
||
}
|
||
for (var e, o = 0; o < a.length; o++)(e = a[o]) && "function" == typeof e.then ? e.then(resolver(o), t) : n[o] = e;
|
||
i || r(n)
|
||
})
|
||
}, Promise.race = function(i) {
|
||
if (!isArray(i)) throw new TypeError("You must pass an array to Promise.race().");
|
||
return new this(function(t, e) {
|
||
for (var r, n = 0; n < i.length; n++)(r = i[n]) && "function" == typeof r.then ? r.then(t, e) : t(r)
|
||
})
|
||
}, Promise.resolve = function(e) {
|
||
return e && "object" == typeof e && e.constructor === this ? e : new this(function(t) {
|
||
t(e)
|
||
})
|
||
}, Promise.reject = function(r) {
|
||
return new this(function(t, e) {
|
||
e(r)
|
||
})
|
||
}
|
||
}("undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : this)
|
||
}).call(this, v(42), v(402).setImmediate)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var u = Object.getOwnPropertySymbols,
|
||
h = Object.prototype.hasOwnProperty,
|
||
c = Object.prototype.propertyIsEnumerable;
|
||
t.exports = function() {
|
||
try {
|
||
if (!Object.assign) return !1;
|
||
var t = new String("abc");
|
||
if (t[5] = "de", "5" === Object.getOwnPropertyNames(t)[0]) return !1;
|
||
for (var e = {}, r = 0; r < 10; r++) e["_" + String.fromCharCode(r)] = r;
|
||
if ("0123456789" !== Object.getOwnPropertyNames(e).map(function(t) {
|
||
return e[t]
|
||
}).join("")) return !1;
|
||
var n = {};
|
||
return "abcdefghijklmnopqrst".split("").forEach(function(t) {
|
||
n[t] = t
|
||
}), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, n)).join("")
|
||
} catch (t) {
|
||
return !1
|
||
}
|
||
}() ? Object.assign : function(t, e) {
|
||
for (var r, n, i = function(t) {
|
||
if (null == t) throw new TypeError("Object.assign cannot be called with null or undefined");
|
||
return Object(t)
|
||
}(t), o = 1; o < arguments.length; o++) {
|
||
for (var a in r = Object(arguments[o])) h.call(r, a) && (i[a] = r[a]);
|
||
if (u) {
|
||
n = u(r);
|
||
for (var s = 0; s < n.length; s++) c.call(r, n[s]) && (i[n[s]] = r[n[s]])
|
||
}
|
||
}
|
||
return i
|
||
}
|
||
}, function(t, e) {
|
||
t.exports = function(p) {
|
||
return new Promise(function(t, e) {
|
||
var r = {},
|
||
n = 0,
|
||
i = {
|
||
buffer: p,
|
||
uint16: new Uint16Array(p),
|
||
float32: new Float32Array(p),
|
||
index: n
|
||
},
|
||
o = {};
|
||
o.size = i.uint16[n++], o.indexSize = i.uint16[n++], o.bounds = {};
|
||
var a = o.bounds;
|
||
n = 1, a.minX = i.float32[n++], a.maxX = i.float32[n++], a.minY = i.float32[n++], a.maxY = i.float32[n++], a.minZ = i.float32[n++], a.maxZ = i.float32[n++], a.sizeX = a.maxX - a.minX, a.sizeY = a.maxY - a.minY, a.sizeZ = a.maxZ - a.minZ, r.position = new Float32Array(3 * o.size), r.uv = new Float32Array(2 * o.size), r.normals = new Float32Array(3 * o.size), r.indices = new Uint16Array(o.indexSize), n = 14;
|
||
for (var s = 0; s < 3 * o.size; s += 3) {
|
||
var u = i.uint16[n++] / 65535 * a.sizeX + a.minX,
|
||
h = i.uint16[n++] / 65535 * a.sizeY + a.minY,
|
||
c = i.uint16[n++] / 65535 * a.sizeZ + a.minZ;
|
||
r.position[s] = u, r.position[s + 1] = h, r.position[s + 2] = c
|
||
}
|
||
for (s = 0; s < 2 * o.size; s += 2) {
|
||
var l = i.uint16[n++] / 65535,
|
||
f = i.uint16[n++] / 65535;
|
||
r.uv[s] = l, r.uv[s + 1] = f
|
||
}
|
||
for (s = 0; s < 3 * o.size; s++) {
|
||
var d = i.uint16[n++] / 65535 * 2 - 1;
|
||
r.normals[s] = d
|
||
}
|
||
for (s = 0; s < o.indexSize; s++) r.indices[s] = i.uint16[n++];
|
||
t(r)
|
||
})
|
||
}
|
||
}, function(t, r, n) {
|
||
var l;
|
||
t.exports = ((l = function() {
|
||
function e(t) {
|
||
return n.appendChild(t.dom), t
|
||
}
|
||
|
||
function u(t) {
|
||
for (var e = 0; e < n.children.length; e++) n.children[e].style.display = e === t ? "block" : "none";
|
||
r = t
|
||
}
|
||
var r = 0,
|
||
n = document.createElement("div");
|
||
n.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000", n.addEventListener("click", function(t) {
|
||
t.preventDefault(), u(++r % n.children.length)
|
||
}, !1);
|
||
var i = (performance || Date).now(),
|
||
o = i,
|
||
a = 0,
|
||
s = e(new l.Panel("FPS", "#0ff", "#002")),
|
||
h = e(new l.Panel("MS", "#0f0", "#020"));
|
||
if (self.performance && self.performance.memory) var c = e(new l.Panel("MB", "#f08", "#201"));
|
||
return u(0), {
|
||
REVISION: 16,
|
||
dom: n,
|
||
addPanel: e,
|
||
showPanel: u,
|
||
begin: function() {
|
||
i = (performance || Date).now()
|
||
},
|
||
end: function() {
|
||
a++;
|
||
var t = (performance || Date).now();
|
||
if (h.update(t - i, 200), o + 1e3 < t && (s.update(1e3 * a / (t - o), 100), o = t, a = 0, c)) {
|
||
var e = performance.memory;
|
||
c.update(e.usedJSHeapSize / 1048576, e.jsHeapSizeLimit / 1048576)
|
||
}
|
||
return t
|
||
},
|
||
update: function() {
|
||
i = this.end()
|
||
},
|
||
domElement: n,
|
||
setMode: u
|
||
}
|
||
}).Panel = function(r, n, i) {
|
||
var o = 1 / 0,
|
||
a = 0,
|
||
s = Math.round,
|
||
u = s(window.devicePixelRatio || 1),
|
||
h = 80 * u,
|
||
t = 48 * u,
|
||
c = 3 * u,
|
||
l = 2 * u,
|
||
f = 3 * u,
|
||
d = 15 * u,
|
||
p = 74 * u,
|
||
m = 30 * u,
|
||
v = document.createElement("canvas");
|
||
v.width = h, v.height = t, v.style.cssText = "width:80px;height:48px";
|
||
var g = v.getContext("2d");
|
||
return g.font = "bold " + 9 * u + "px Helvetica,Arial,sans-serif", g.textBaseline = "top", g.fillStyle = i, g.fillRect(0, 0, h, t), g.fillStyle = n, g.fillText(r, c, l), g.fillRect(f, d, p, m), g.fillStyle = i, g.globalAlpha = .9, g.fillRect(f, d, p, m), {
|
||
dom: v,
|
||
update: function(t, e) {
|
||
o = Math.min(o, t), a = Math.max(a, t), g.fillStyle = i, g.globalAlpha = 1, g.fillRect(0, 0, h, d), g.fillStyle = n, g.fillText(s(t) + " " + r + " (" + s(o) + "-" + s(a) + ")", c, l), g.drawImage(v, f + u, d, p - u, m, f, d, p - u, m), g.fillRect(f + p - u, d, u, m), g.fillStyle = i, g.globalAlpha = .9, g.fillRect(f + p - u, d, u, s((1 - t / e) * m))
|
||
}
|
||
}
|
||
}, l)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = function(t) {
|
||
var e, r;
|
||
|
||
function NoTransition() {
|
||
return t.call(this) || this
|
||
}
|
||
r = t, (e = NoTransition).prototype = Object.create(r.prototype), (e.prototype.constructor = e).__proto__ = r;
|
||
var n = NoTransition.prototype;
|
||
return n.start = function(t, e, r) {
|
||
this.transitionOutComplete.dispatch(), this.transitionInStart.dispatch(), this.transitionComplete.dispatch()
|
||
}, n.resize = function(t, e) {
|
||
this.width = t, this.height = e
|
||
}, NoTransition
|
||
}(r(91).a);
|
||
e.a = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = _interopRequireDefault(r(413)),
|
||
i = _interopRequireDefault(r(415)),
|
||
o = _interopRequireDefault(r(416)),
|
||
a = _interopRequireDefault(r(417)),
|
||
s = _interopRequireDefault(r(427));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var u = function(r) {
|
||
function BasicGame(t) {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, BasicGame);
|
||
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, r.call(this));
|
||
return e.register("onGameover"), e.register("onGameComplete"), e.addSystem(i.default, null, null, !1), e.rootContainer = e.system.container, e.addSystem(s.default, {}), e.addSystem(o.default, {}), e.addSystem(a.default, t), 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)
|
||
}(BasicGame, r), BasicGame.prototype.addChild = function(t) {
|
||
this.rootContainer.add(t)
|
||
}, BasicGame.prototype.removeChild = function(t) {
|
||
this.rootContainer.remove(t)
|
||
}, BasicGame
|
||
}(n.default);
|
||
e.default = u
|
||
}, , , , , , , function(t, e, r) {
|
||
"use strict";
|
||
var n = function() {
|
||
function LocalStorage(t) {
|
||
this.id = t || "com.goodboydigital", this.canSave = !1;
|
||
try {
|
||
localStorage.setItem(this.id + ".access", !0), localStorage.removeItem(this.id + ".access", !0), this.canSave = !0
|
||
} catch (t) {}
|
||
}
|
||
var t = LocalStorage.prototype;
|
||
return t.store = function(t, e) {
|
||
this.canSave && localStorage.setItem(this.id + "." + t, e)
|
||
}, t.get = function(t) {
|
||
if (this.canSave) return localStorage.getItem(this.id + "." + t)
|
||
}, t.storeObject = function(t, e) {
|
||
this.canSave && localStorage.setItem(this.id + "." + t, JSON.stringify(e))
|
||
}, t.getObject = function(t) {
|
||
if (this.canSave) return JSON.parse(localStorage.getItem(this.id + "." + t))
|
||
}, t.remove = function(t) {
|
||
this.canSave && localStorage.removeItem(this.id + "." + t)
|
||
}, t.reset = function() {
|
||
if (this.canSave)
|
||
for (var t in localStorage) - 1 !== t.indexOf(this.id + ".") && localStorage.removeItem(t)
|
||
}, LocalStorage
|
||
}();
|
||
e.a = n
|
||
}, function(t, e) {
|
||
t.exports = "//precision highp float;\nvarying vec2 vUvs;\n\nuniform sampler2D diffuse;\n//varying vec3 vNormal;\nvarying float vLight;\n\nvoid main()\n{\n gl_FragColor = texture2D(diffuse, vec2(vUvs.x, 1.-vUvs.y));//directionalLightWeighting;\n gl_FragColor.rgb = mix(gl_FragColor.rgb*vLight, gl_FragColor.rgb, 0.7);\n}\n"
|
||
}, function(t, e) {
|
||
t.exports = "\nattribute vec3 position;\nattribute vec3 normals;\nattribute vec4 bone_indices;\nattribute vec2 uvs;\n\nattribute vec4 weights;\n\nvarying vec2 vUvs;\n//varying vec3 vNormal;\nvarying float vLight;\n\nuniform mat4 view;\nuniform mat4 model;\nuniform mat3 normal;\nuniform mat4 projection;\n\nuniform mat4 bones[26];\n\nvoid main() {\n\n\tvUvs = uvs;\n\n\tvec4 outPosition = vec4(0.0);\n\tvec4 originalPosition = vec4(position, 1.);\n\n\tmat4 boneMatrix = mat4(0.0);\n\n\tboneMatrix += bones[int(bone_indices.x)] * weights.x;\n\tboneMatrix += bones[int(bone_indices.y)] * weights.y;\n\tboneMatrix += bones[int(bone_indices.z)] * weights.z;\n\tboneMatrix += bones[int(bone_indices.w)] * weights.w;\n\t//vNormal = normalize( normal * (vec4(boneMatrix * vec4(normals,0.0)).xyz) );\n\n\tvec3 transformedNormal = normalize( normal * (vec4(boneMatrix * vec4(normals,0.0)).xyz) );\n\n\t// no light for now\n\t// vLight = max(dot(transformedNormal, vec3(0.0, 0.0,1.0)), 0.0);\n\tvLight = 1.0;\n\n gl_Position = projection * view * model * boneMatrix * originalPosition;\n}\n"
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var a = r(0),
|
||
s = r(96),
|
||
u = r(97),
|
||
n = r(128),
|
||
h = r.n(n),
|
||
i = a.LoaderResource;
|
||
i.setExtensionXhrType("fbx", i.XHR_RESPONSE_TYPE.BUFFER), a.geometryCache || (a.geometryCache = {}, a.Geometry.from = function(t) {
|
||
if (a.geometryCache[t]) return a.geometryCache[t];
|
||
throw new Error('GEOMETRY: "' + t + '" does not exist in the cache')
|
||
}), a.sceneCache = {};
|
||
var c = null;
|
||
e.a = function(t) {
|
||
return function() {
|
||
return function(n, i) {
|
||
if (!n.data || "fbx" !== n.extension) return i();
|
||
c && t || (c = new h.a);
|
||
var o = n.url;
|
||
c.addEventListener("message", function onMessage(t) {
|
||
if (t.data.id === o) {
|
||
if (!t.data.fbxTree) throw new Error("fbx worker response is empty");
|
||
c.removeEventListener("message", onMessage);
|
||
var e = new u.a;
|
||
e.fbxTree = t.data.fbxTree;
|
||
var r = {};
|
||
setTimeout(function() {
|
||
new s.a(e, r).parse(e.fbxTree), setTimeout(function() {
|
||
e.convertScene(), a.sceneCache[n.url] = e, setTimeout(function() {
|
||
i()
|
||
}, 20)
|
||
}, 20)
|
||
}, 20)
|
||
}
|
||
}), c.postMessage({
|
||
parse: n.data,
|
||
id: o
|
||
})
|
||
}
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.a = function() {
|
||
return function(t, e) {
|
||
t.url += "?v=1gefx1jwdk0gj12hb", e()
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = function() {
|
||
function WebglSupport(t) {
|
||
this.imgUrl = t, this.supported = !1, this.experimental = !1, this.check()
|
||
}
|
||
var t = WebglSupport.prototype;
|
||
return t.check = function() {
|
||
var t, e = document.createElement("canvas");
|
||
try {
|
||
t = e.getContext("webgl"), this.supported = !0, this.experimental = !1
|
||
} catch (t) {}
|
||
try {
|
||
t = e.getContext("experimental-webgl"), this.supported = !0, this.experimental = !0
|
||
} catch (t) {}
|
||
return e = null, this.supported || this.fallback(), t
|
||
}, t.hasWebgl = function() {
|
||
return this.supported
|
||
}, t.fallback = function() {
|
||
var t = document.createElement("div");
|
||
t.style.position = "absolute", t.style.top = 0, t.style.left = 0, t.style.right = 0, t.style.bottom = 0, t.style.zIndex = 1e3, t.style.backgroundColor = "black", t.style.backgroundSize = "contain", t.style.backgroundPosition = "center center", t.style.backgroundRepeat = "no-repeat", this.imgUrl ? t.style.backgroundImage = "url(" + this.imgUrl + ")" : t.style.backgroundImage = "url(" + window.ASSET_URL + "image/high/preload/old_browser.jpg)", document.body.appendChild(t)
|
||
}, WebglSupport
|
||
}();
|
||
e.a = n
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var v, F, d, o = r(0),
|
||
Z = (r(66), r(4));
|
||
v = "undefined" != typeof window ? window : self, F = void 0 === v.document, d = 2 * Math.PI / 360, F && (v.console = {
|
||
log: function(t) {
|
||
var e = Array.prototype.slice.call(arguments, 0);
|
||
self.postMessage({
|
||
action: "log",
|
||
params: e
|
||
})
|
||
},
|
||
warn: function(t) {
|
||
var e = Array.prototype.slice.call(arguments, 0);
|
||
self.postMessage({
|
||
action: "warn",
|
||
params: e
|
||
})
|
||
},
|
||
error: function(t) {
|
||
var e = Array.prototype.slice.call(arguments, 0);
|
||
self.postMessage({
|
||
action: "error",
|
||
params: e
|
||
})
|
||
}
|
||
}, v.alert = console.error), v.Collada = {
|
||
libsPath: "./",
|
||
workerPath: "./",
|
||
no_flip: !0,
|
||
use_transferables: !0,
|
||
onerror: null,
|
||
verbose: !1,
|
||
config: {
|
||
forceParser: !1
|
||
},
|
||
init: function(t) {
|
||
for (var e in t = t || {}) this[e] = t[e];
|
||
if (this.config = t, F) try {
|
||
importScripts(this.libsPath + "gl-matrix-min.js", this.libsPath + "tinyxml.js")
|
||
} catch (t) {
|
||
Collada.throwException(Collada.LIBMISSING_ERROR)
|
||
}
|
||
Z.mat4.create(), Z.vec3.create(), Z.vec3.create(), Z.vec3.create(), Z.quat.create()
|
||
},
|
||
load: function(t, e) {
|
||
var r, n, i;
|
||
r = t, n = function(t) {
|
||
e(t ? Collada.parse(t) : null)
|
||
}, (i = new XMLHttpRequest).onload = function() {
|
||
this.response, 200 == this.status && n && n(this.response)
|
||
}, -1 == r.indexOf("://") && (r = Collada.dataPath + r), i.open("get", r, !0), i.send()
|
||
},
|
||
_xmlroot: null,
|
||
_nodes_by_id: null,
|
||
_transferables: null,
|
||
_controllers_found: null,
|
||
_geometries_found: null,
|
||
safeString: function(t) {
|
||
return t ? this.convertID ? this.convertID(t) : t.replace(/ /g, "_") : ""
|
||
},
|
||
LIBMISSING_ERROR: "Libraries loading error, when using workers remember to pass the URL to the tinyxml.js in the options.libsPath",
|
||
NOXMLPARSER_ERROR: "TinyXML not found, when using workers remember to pass the URL to the tinyxml.js in the options.libsPath (Workers do not allow to access the native XML DOMParser)",
|
||
throwException: function(t) {
|
||
throw F ? self.postMessage({
|
||
action: "exception",
|
||
msg: t
|
||
}) : Collada.onerror && Collada.onerror(t), t
|
||
},
|
||
getFilename: function(t) {
|
||
var e = t.lastIndexOf("\\");
|
||
return -1 != e && (t = t.substr(e + 1)), -1 != (e = t.lastIndexOf("/")) && (t = t.substr(e + 1)), t
|
||
},
|
||
last_name: 0,
|
||
generateName: function(t) {
|
||
var e = (t = t || "name_") + this.last_name;
|
||
return this.last_name++, e
|
||
},
|
||
parse: function(t, e, r) {
|
||
e = e || {}, r = r || "_dae_" + Date.now() + ".dae";
|
||
var n = null,
|
||
i = null;
|
||
if (this._transferables = [], this.verbose, v.DOMParser && !this.config.forceParser) i = (n = new DOMParser).parseFromString(t, "text/xml"), this.verbose;
|
||
else {
|
||
if (!v.DOMImplementation) return Collada.throwException(Collada.NOXMLPARSER_ERROR);
|
||
try {
|
||
n = new DOMImplementation
|
||
} catch (t) {
|
||
return Collada.throwException(Collada.NOXMLPARSER_ERROR)
|
||
}
|
||
i = n.loadXML(t), this.verbose;
|
||
for (var o = i._nodes_by_id = {}, a = 0, s = i.all.length; a < s; ++a)(o[(d = i.all[a]).id] = d).getAttribute("sid") && (o[d.getAttribute("sid")] = d);
|
||
this.extra_functions || (this.extra_functions = !0, DOMDocument.prototype.querySelector = DOMElement.prototype.querySelector = function(t) {
|
||
for (var e = t.split(" "), r = this; e.length;) {
|
||
var n = e.shift().split("#"),
|
||
i = n[0],
|
||
o = n[1],
|
||
a = i ? r.getElementsByTagName(i) : r.childNodes;
|
||
if (o) {
|
||
for (var s = 0; s < a.length; s++)
|
||
if (a.item(s).getAttribute("id") == o) {
|
||
if (0 == e.length) return a.item(s);
|
||
r = a.item(s);
|
||
break
|
||
}
|
||
} else {
|
||
if (0 == e.length) return a.item(0);
|
||
r = a.item(0)
|
||
}
|
||
}
|
||
return null
|
||
}, DOMDocument.prototype.querySelectorAll = DOMElement.prototype.querySelectorAll = function(t) {
|
||
var e = t.split(" ");
|
||
if (1 == e.length) return this.getElementsByTagName(t);
|
||
var o = [];
|
||
! function inner(t, e) {
|
||
if (e) {
|
||
var r = e.shift(),
|
||
n = t.getElementsByTagName(r);
|
||
if (0 != e.length)
|
||
for (var i = 0; i < n.length; i++) inner(n.item(i), e.concat());
|
||
else
|
||
for (var i = 0; i < n.length; i++) o.push(n.item(i))
|
||
}
|
||
}(this, e);
|
||
var r = new DOMNodeList(this.documentElement);
|
||
return r._nodes = o, r.length = o.length, r
|
||
}, Object.defineProperty(DOMElement.prototype, "textContent", {
|
||
get: function() {
|
||
return this.getChildNodes().item(0).toString()
|
||
},
|
||
set: function() {}
|
||
}))
|
||
}
|
||
var u = (this._xmlroot = i).querySelector("COLLADA");
|
||
u && (this._current_DAE_version = u.getAttribute("version"));
|
||
var h = i.getElementsByTagName("visual_scene").item(0);
|
||
if (!h) throw "visual_scene XML node not found in DAE";
|
||
this._nodes_by_id = {}, this._controllers_found = {}, this._geometries_found = {};
|
||
var c = {
|
||
object_type: "SceneTree",
|
||
light: null,
|
||
materials: {},
|
||
meshes: {},
|
||
resources: {},
|
||
root: {
|
||
children: []
|
||
},
|
||
external_files: {}
|
||
},
|
||
l = i.getElementsByTagName("asset")[0];
|
||
l && (c.metadata = this.readAsset(l));
|
||
var f = h.childNodes;
|
||
for (a = 0; a < f.length; a++) {
|
||
var d;
|
||
"node" == f.item(a).localName && (d = this.readNodeTree(f.item(a), c, 0, !1)) && c.root.children.push(d)
|
||
}
|
||
for (a = 0; a < f.length; a++) "node" == f.item(a).localName && this.readNodeInfo(f.item(a), c, 0, !1);
|
||
this.readLibraryControllers(c);
|
||
var p = this.readAnimations(i, c);
|
||
if (p) {
|
||
var m = "#animations_" + r.substr(0, r.indexOf("."));
|
||
c.resources[m] = p, c.root.animations = m
|
||
}
|
||
return c.images = this.readImages(i), this._nodes_by_id = {}, this._controllers_found = {}, this._geometries_found = {}, this._xmlroot = null, c
|
||
},
|
||
readAsset: function(t) {
|
||
for (var e = {}, r = 0; r < t.childNodes.length; r++) {
|
||
var n = t.childNodes.item(r);
|
||
if (1 == n.nodeType) switch (n.localName) {
|
||
case "contributor":
|
||
var i = n.querySelector("authoring_tool");
|
||
i && (e.authoring_tool = i.textContext);
|
||
break;
|
||
case "unit":
|
||
e.unit = n.getAttribute("name");
|
||
break;
|
||
default:
|
||
e[n.localName] = n.textContent
|
||
}
|
||
}
|
||
return e
|
||
},
|
||
readNodeTree: function(t, e, r, n) {
|
||
var i = this.safeString(t.getAttribute("id")),
|
||
o = this.safeString(t.getAttribute("sid"));
|
||
if (!i && !o) return null;
|
||
var a = {
|
||
id: o || i,
|
||
children: [],
|
||
_depth: r
|
||
},
|
||
s = t.getAttribute("type");
|
||
s && (a.type = s);
|
||
var u = t.getAttribute("name");
|
||
u && (a.name = u), this._nodes_by_id[a.id] = a, i && (this._nodes_by_id[i] = a), o && (this._nodes_by_id[o] = a), a.model = this.readTransform(t, r, n);
|
||
for (var h = 0; h < t.childNodes.length; h++) {
|
||
var c = t.childNodes.item(h);
|
||
if (1 == c.nodeType)
|
||
if ("node" != c.localName);
|
||
else {
|
||
var l = this.readNodeTree(c, e, r + 1, n);
|
||
l && a.children.push(l)
|
||
}
|
||
}
|
||
return a
|
||
},
|
||
readNodeInfo: function(t, e, r, n, i) {
|
||
var o, a = this.safeString(t.getAttribute("id")),
|
||
s = this.safeString(t.getAttribute("sid"));
|
||
if (a || s) o = this._nodes_by_id[a || s];
|
||
else {
|
||
if (!i) return null;
|
||
o = this._nodes_by_id[i.id || i.sid]
|
||
}
|
||
if (!o) return null;
|
||
for (var u = 0; u < t.childNodes.length; u++) {
|
||
var h = t.childNodes.item(u);
|
||
if (1 == h.nodeType)
|
||
if ("node" != h.localName) {
|
||
if ("instance_geometry" == h.localName) {
|
||
var c = (m = h.getAttribute("url")).toString().substr(1);
|
||
o.mesh = c, e.meshes[m] || (g = this.readGeometry(m, n)) && (g.name = c, e.meshes[c] = g);
|
||
var l = h.querySelectorAll("instance_material");
|
||
if (l)
|
||
for (var f = 0; f < l.length; ++f) {
|
||
var d = l.item(f);
|
||
if (d) {
|
||
var p = d.getAttribute("target").toString().substr(1);
|
||
e.materials[p] || (w = this.readMaterial(p)) && (w.id = p, e.materials[w.id] = w), 0 == f ? o.material = p : (o.materials || (o.materials = []), o.materials.push(p))
|
||
}
|
||
}
|
||
}
|
||
if ("instance_controller" == h.localName) {
|
||
var m = h.getAttribute("url"),
|
||
v = this._xmlroot.querySelector("controller" + m);
|
||
if (v) {
|
||
var g = this.readController(v, n, e),
|
||
y = h.querySelector("bind_material");
|
||
if (y)
|
||
for (var _ = y.querySelectorAll("technique_common"), b = 0; b < _.length; b++) {
|
||
var x = _.item(b).querySelectorAll("instance_material");
|
||
for (f = 0; f < x.length; f++) {
|
||
var w, T = x.item(f);
|
||
if (T) p = T.getAttribute("target").toString().substr(1), e.materials[p] || (w = this.readMaterial(p)) && (w.id = p, e.materials[w.id] = w), 0 == f ? o.material = p : (o.materials || (o.materials = []), o.materials.push(p))
|
||
}
|
||
}
|
||
if (g) {
|
||
var S = g;
|
||
"morph" == g.type && (S = g.mesh, o.morph_targets = g.morph_targets), S.name = m.toString(), o.mesh = m.toString(), e.meshes[m] = S
|
||
}
|
||
}
|
||
}
|
||
"instance_light" == h.localName && (m = h.getAttribute("url"), this.readLight(o, m)), "instance_camera" == h.localName && (m = h.getAttribute("url"), this.readCamera(o, m))
|
||
} else this.readNodeInfo(h, e, r + 1, n, t)
|
||
}
|
||
},
|
||
material_translate_table: {},
|
||
light_translate_table: {
|
||
point: "omni",
|
||
directional: "directional",
|
||
spot: "spot"
|
||
},
|
||
camera_translate_table: {
|
||
xfov: "fov",
|
||
aspect_ratio: "aspect",
|
||
znear: "near",
|
||
zfar: "far"
|
||
},
|
||
querySelectorAndId: function(t, e, r) {
|
||
for (var n = t.querySelectorAll(e), i = 0; i < n.length; i++) {
|
||
var o = n.item(i).getAttribute("id");
|
||
if (o && (o = o.toString()) == r) return n.item(i)
|
||
}
|
||
return null
|
||
},
|
||
getFirstChildElement: function(t, e) {
|
||
for (var r = t.childNodes, n = 0; n < r.length; ++n) {
|
||
var i = r.item(n);
|
||
if (i.localName && !e || e && e == i.localName) return i
|
||
}
|
||
return null
|
||
},
|
||
readMaterial: function(t) {
|
||
var e = this.querySelectorAndId(this._xmlroot, "library_materials material", t);
|
||
if (!e) return null;
|
||
var r = e.querySelector("instance_effect");
|
||
if (!r) return null;
|
||
var n = r.getAttribute("url").substr(1),
|
||
i = this.querySelectorAndId(this._xmlroot, "library_effects effect", n);
|
||
if (!i) return null;
|
||
var o = i.querySelector("technique");
|
||
if (!o) return null;
|
||
for (var a = i.querySelectorAll("newparam"), s = {}, u = 0; u < a.length; u++) {
|
||
var h, c = a[u].querySelector("init_from");
|
||
h = c ? c.innerHTML : a[u].querySelector("source").innerHTML, s[a[u].getAttribute("sid")] = {
|
||
parent: h
|
||
}
|
||
}
|
||
var l = {},
|
||
f = this.readImages(this._xmlroot),
|
||
d = o.querySelector("phong");
|
||
if (d || (d = o.querySelector("blinn")), d || (d = o.querySelector("lambert")), !d) return null;
|
||
for (u = 0; u < d.childNodes.length; ++u) {
|
||
var p = d.childNodes.item(u);
|
||
if (p.localName) {
|
||
var m = p.localName.toString();
|
||
this.material_translate_table[m] && (m = this.material_translate_table[m]);
|
||
var v = this.getFirstChildElement(p);
|
||
if (v)
|
||
if ("color" != v.localName.toString())
|
||
if ("float" != v.localName.toString()) {
|
||
if ("texture" == v.localName.toString()) {
|
||
l.textures || (l.textures = {});
|
||
var g = v.getAttribute("texture");
|
||
if (!g) continue; - 1 === g.indexOf(".") && f[g = this.getParentParam(s, g)] && (g = f[g].path);
|
||
var y = {
|
||
map_id: g
|
||
},
|
||
_ = v.getAttribute("texcoord");
|
||
y.uvs = _, l.textures[m] = y
|
||
}
|
||
} else l[m] = this.readContentAsFloats(v)[0];
|
||
else {
|
||
var b = this.readContentAsFloats(v);
|
||
"RGB_ZERO" == p.getAttribute("opaque") ? l[m] = b.subarray(0, 4) : l[m] = b.subarray(0, 3)
|
||
}
|
||
}
|
||
}
|
||
return l.object_type = "Material", l
|
||
},
|
||
getParentParam: function(t, e) {
|
||
return t[e] && t[e].parent ? this.getParentParam(t, t[e].parent) : e
|
||
},
|
||
readLight: function(t, e) {
|
||
var r = {},
|
||
n = null;
|
||
if (1 < e.length) n = this._xmlroot.querySelector("library_lights " + e);
|
||
else {
|
||
var i = this._xmlroot.querySelector("library_lights");
|
||
n = this.getFirstChildElement(i, "light")
|
||
}
|
||
if (!n) return null;
|
||
var o = [];
|
||
if (c = n.querySelector("technique_common"))
|
||
for (var a = 0; a < c.childNodes.length; a++) 1 == c.childNodes.item(a).nodeType && o.push(c.childNodes.item(a));
|
||
var s = n.querySelectorAll("technique");
|
||
for (a = 0; a < s.length; a++)
|
||
for (var u = s.item(a), h = 0; h < u.childNodes.length; h++) 1 == u.childNodes.item(h).nodeType && o.push(u.childNodes.item(h));
|
||
for (a = 0; a < o.length; a++) {
|
||
var c;
|
||
switch ((c = o[a]).localName) {
|
||
case "point":
|
||
case "directional":
|
||
case "spot":
|
||
r.type = this.light_translate_table[c.localName], parse_params(r, c);
|
||
break;
|
||
case "intensity":
|
||
r.intensity = this.readContentAsFloats(c)[0]
|
||
}
|
||
}
|
||
|
||
function parse_params(t, e) {
|
||
for (var r = 0; r < e.childNodes.length; r++) {
|
||
var n = e.childNodes.item(r);
|
||
if (n && 1 == n.nodeType) switch (n.localName) {
|
||
case "color":
|
||
t.color = Collada.readContentAsFloats(n);
|
||
break;
|
||
case "falloff_angle":
|
||
t.angle_end = Collada.readContentAsFloats(n)[0], t.angle = t.angle_end - 10
|
||
}
|
||
}
|
||
}
|
||
if (t.model) {
|
||
r.position = [t.model[12], t.model[13], t.model[14]];
|
||
var l = [-t.model[8], -t.model[9], -t.model[10]];
|
||
r.target = [r.position[0] + l[0], r.position[1] + l[1], r.position[2] + l[2]]
|
||
} else r.position = [0, 0, 0], r.target = [0, -1, 0];
|
||
t.light = r
|
||
},
|
||
readCamera: function(t, e) {
|
||
var r = {},
|
||
n = this._xmlroot.querySelector("library_cameras " + e);
|
||
if (!n) return null;
|
||
var i = [],
|
||
o = n.querySelector("technique_common");
|
||
if (o)
|
||
for (var a = 0; a < o.childNodes.length; a++) 1 == o.childNodes.item(a).nodeType && i.push(o.childNodes.item(a));
|
||
for (a = 0; a < i.length; a++) parse_params(r, i[a]);
|
||
|
||
function parse_params(t, e) {
|
||
for (var r = 0; r < e.childNodes.length; r++) {
|
||
var n = e.childNodes.item(r);
|
||
n && 1 == n.nodeType && (t[Collada.camera_translate_table[n.localName] || n.localName] = parseFloat(n.textContent))
|
||
}
|
||
}
|
||
r.yfov && !r.fov && r.aspect && (r.fov = r.yfov * r.aspect), t.camera = r
|
||
},
|
||
readTransform: function(t, e, r) {
|
||
for (var n = Z.mat4.create(), i = Z.mat4.create(), o = Z.quat.create(), a = 0; a < t.childNodes.length; a++) {
|
||
var s = t.childNodes.item(a);
|
||
if (s && 1 == s.nodeType) {
|
||
if ("matrix" == s.localName) return n = this.readContentAsFloats(s), this.transformMatrix(n, 0 == e), n;
|
||
if ("translate" != s.localName) {
|
||
if ("rotate" != s.localName) "scale" == s.localName && (h = this.readContentAsFloats(s), r && (u = h[1], h[1] = h[2], h[2] = -u), Z.mat4.scale(n, n, h));
|
||
else if (4 == (h = this.readContentAsFloats(s)).length) {
|
||
if ("jointOrientX" == s.getAttribute("sid") && (h[3] += 90), r) {
|
||
var u = h[1];
|
||
h[1] = h[2], h[2] = -u
|
||
}
|
||
0 != h[3] && (Z.quat.setAxisAngle(o, h.subarray(0, 3), h[3] * d), Z.mat4.fromQuat(i, o), Z.mat4.multiply(n, n, i))
|
||
}
|
||
} else {
|
||
var h = this.readContentAsFloats(s);
|
||
if (r && 0 < e) {
|
||
var u = h[1];
|
||
h[1] = h[2], h[2] = -u
|
||
}
|
||
Z.mat4.translate(n, n, h)
|
||
}
|
||
}
|
||
}
|
||
return n
|
||
},
|
||
readTransform2: function(t, e, r) {
|
||
for (var n = Z.mat4.create(), i = Z.quat.create(), o = Z.mat4.create(), a = Z.quat.create(), s = Z.vec3.create(), u = Z.vec3.fromValues(1, 1, 1), h = 0; h < t.childNodes.length; h++) {
|
||
var c = t.childNodes.item(h);
|
||
if ("matrix" == c.localName) return n = this.readContentAsFloats(c), this.transformMatrix(n, 0 == e), n;
|
||
if ("translate" != c.localName) {
|
||
if ("rotate" != c.localName) "scale" == c.localName && (f = this.readContentAsFloats(c), r && (l = f[1], f[1] = f[2], f[2] = -l), u.set(f));
|
||
else if (4 == (f = this.readContentAsFloats(c)).length) {
|
||
if ("jointOrientX" == c.getAttribute("sid") && (f[3] += 90), r) {
|
||
var l = f[1];
|
||
f[1] = f[2], f[2] = -l
|
||
}
|
||
0 != f[3] && (Z.quat.setAxisAngle(a, f.subarray(0, 3), f[3] * d), Z.quat.multiply(i, i, a))
|
||
}
|
||
} else {
|
||
var f = this.readContentAsFloats(c);
|
||
s.set(f)
|
||
}
|
||
}
|
||
return r && 0 < e && (l = s[1], s[1] = s[2], s[2] = -l), Z.mat4.translate(n, n, s), Z.mat4.fromQuat(o, i), Z.mat4.multiply(n, n, o), Z.mat4.scale(n, n, u), n
|
||
},
|
||
readGeometry: function(t, e, r) {
|
||
if (void 0 !== this._geometries_found[t]) return this._geometries_found[t];
|
||
var n = this._xmlroot.getElementById(t.substr(1));
|
||
if (!n) return this._geometries_found[t] = null;
|
||
if ("controller" == n.localName) {
|
||
var i = this.readController(n, e, r);
|
||
return this._geometries_found[t] = i
|
||
}
|
||
if ("geometry" != n.localName) return this._geometries_found[t] = null;
|
||
var o = n.querySelector("mesh");
|
||
if (!o) return this._geometries_found[t] = null;
|
||
for (var a = {}, s = o.querySelectorAll("source"), u = 0; u < s.length; u++) {
|
||
var h = s.item(u);
|
||
if (h.querySelector) {
|
||
var c = h.querySelector("float_array");
|
||
if (c) {
|
||
var l = this.readContentAsFloats(c),
|
||
f = h.querySelector("accessor"),
|
||
d = parseInt(f.getAttribute("stride"));
|
||
a[h.getAttribute("id")] = {
|
||
stride: d,
|
||
data: l
|
||
}
|
||
}
|
||
}
|
||
}
|
||
var p = a[o.querySelector("vertices input").getAttribute("source").substr(1)];
|
||
a[o.querySelector("vertices").getAttribute("id")] = p;
|
||
var m = null,
|
||
v = o.querySelector("polygons");
|
||
if (v && (m = this.readTriangles(v, a)), !m) {
|
||
var g = o.querySelectorAll("triangles");
|
||
g && g.length && (m = this.readTriangles(g, a))
|
||
}
|
||
if (!m) {
|
||
var y = o.querySelector("polylist");
|
||
y && (m = this.readPolylist(y, a))
|
||
}
|
||
if (!m) {
|
||
var _ = o.querySelector("linestrips");
|
||
_ && (m = this.readLineStrip(a, _))
|
||
}
|
||
if (!m) return this._geometries_found[t] = null;
|
||
if (e && !this.no_flip) {
|
||
for (var b = 0, x = m.vertices, w = (u = 0, x.length); u < w; u += 3) b = x[u + 1], x[u + 1] = x[u + 2], x[u + 2] = -b;
|
||
for (u = 0, w = (x = m.normals).length; u < w; u += 3) b = x[u + 1], x[u + 1] = x[u + 2], x[u + 2] = -b
|
||
}
|
||
if (F && this.use_transferables)
|
||
for (var u in m) {
|
||
var T = m[u];
|
||
T && T.buffer && 100 < T.length && this._transferables.push(T.buffer)
|
||
}
|
||
return m.filename = t, m.object_type = "Mesh", this._geometries_found[t] = m
|
||
},
|
||
readTriangles: function(t, e) {
|
||
for (var r = [], n = [], i = 0, o = {}, a = [], s = [], u = 0, h = "", c = 0; c < t.length; c++) {
|
||
var l = t.item(c),
|
||
f = "triangles" == l.localName;
|
||
h = l.getAttribute("material"), 0 == c && (n = this.readShapeInputs(l, e));
|
||
for (var d = l.querySelectorAll("p"), p = (n.length, 0); p < d.length; p++) {
|
||
var m = d.item(p);
|
||
if (!m || !m.textContent) break;
|
||
var v = m.textContent.trim().split(" "),
|
||
g = -1,
|
||
y = -1,
|
||
_ = -1,
|
||
b = 1;
|
||
for (var x in n) b = Math.max(b, n[x][4] + 1);
|
||
for (var w = 0, T = v.length; w < T; w += b) {
|
||
var S = v.slice(w, w + b).join(" ");
|
||
if (_ = y, o.hasOwnProperty(S)) y = o[S];
|
||
else {
|
||
for (var M = 0; M < n.length; ++M) {
|
||
var E = n[M],
|
||
A = E[1],
|
||
P = E[3],
|
||
I = parseInt(v[w + E[4]]);
|
||
0 == M && (a[A.length / E[2]] = I), I *= E[2];
|
||
for (var O = 0; O < E[2]; ++O) {
|
||
if (void 0 === P[I + O]) throw "UNDEFINED!";
|
||
A.push(P[I + O])
|
||
}
|
||
}
|
||
y = i, i += 1, o[S] = y
|
||
}
|
||
f || (0 == w && (g = y), 2 < w && (s.push(g), s.push(_))), s.push(y)
|
||
}
|
||
}
|
||
var C = {
|
||
name: "group" + c,
|
||
start: u,
|
||
length: s.length - u,
|
||
material: h || ""
|
||
};
|
||
u = s.length, r.push(C)
|
||
}
|
||
var R = {
|
||
vertices: new Float32Array(n[0][1]),
|
||
info: {
|
||
groups: r
|
||
},
|
||
_remap: new Uint32Array(a)
|
||
};
|
||
return this.transformMeshInfo(R, n, s), R
|
||
},
|
||
readPolylist: function(t, e) {
|
||
var r, n = 0,
|
||
i = {},
|
||
o = [],
|
||
a = [];
|
||
t.getAttribute("material"), r = this.readShapeInputs(t, e);
|
||
for (var s = t.querySelector("vcount"), u = this.readContentAsUInt32(s), h = t.querySelector("p"), c = this.readContentAsUInt32(h), l = r.length, f = 0, d = 0, p = u.length; d < p; ++d)
|
||
for (var m = u[d], v = -1, g = -1, y = -1, _ = 0; _ < m; ++_) {
|
||
var b = c.subarray(f, f + l).join(" ");
|
||
if (y = g, i.hasOwnProperty(b)) g = i[b];
|
||
else {
|
||
for (var x = 0; x < r.length; ++x) {
|
||
var w = r[x],
|
||
T = parseInt(c[f + x]),
|
||
S = w[1],
|
||
M = w[3];
|
||
0 == x && (o[S.length / l] = T), T *= w[2];
|
||
for (var E = 0; E < w[2]; ++E) S.push(M[T + E])
|
||
}
|
||
g = n, n += 1, i[b] = g
|
||
}
|
||
3 < m && (0 == _ && (v = g), 2 < _ && (a.push(v), a.push(y))), a.push(g), f += l
|
||
}
|
||
var A = {
|
||
vertices: new Float32Array(r[0][1]),
|
||
info: {},
|
||
_remap: new Uint32Array(o)
|
||
};
|
||
return this.transformMeshInfo(A, r, a), A
|
||
},
|
||
readShapeInputs: function(t, e) {
|
||
for (var r = [], n = t.querySelectorAll("input"), i = 0; i < n.length; i++) {
|
||
var o = n.item(i);
|
||
if (o.getAttribute) {
|
||
var a = o.getAttribute("semantic").toUpperCase(),
|
||
s = e[o.getAttribute("source").substr(1)],
|
||
u = parseInt(o.getAttribute("offset")),
|
||
h = 0;
|
||
o.getAttribute("set") && (h = parseInt(o.getAttribute("set"))), r.push([a, [], s.stride, s.data, u, h])
|
||
}
|
||
}
|
||
return r
|
||
},
|
||
transformMeshInfo: function(t, e, r) {
|
||
for (var n = {
|
||
normal: "normals",
|
||
texcoord: "coords"
|
||
}, i = 1; i < e.length; ++i) {
|
||
var o = e[i][0].toLowerCase(),
|
||
a = e[i][1];
|
||
a.length && (n[o] && (o = n[o]), t[o] && (o += e[i][5]), t[o] = new Float32Array(a))
|
||
}
|
||
return r && r.length && (65536 < t.vertices.length ? t.triangles = new Uint32Array(r) : t.triangles = new Uint16Array(r)), t
|
||
},
|
||
readLineStrip: function(t, e) {
|
||
for (var r = [], n = 0, i = {}, o = [], a = [], s = e.querySelectorAll("input"), u = 0; u < s.length; u++) {
|
||
var h = s.item(u);
|
||
if (h.getAttribute) {
|
||
var c = h.getAttribute("semantic").toUpperCase(),
|
||
l = t[h.getAttribute("source").substr(1)],
|
||
f = parseInt(h.getAttribute("offset")),
|
||
d = 0;
|
||
h.getAttribute("set") && (d = parseInt(h.getAttribute("set"))), r.push([c, [], l.stride, l.data, f, d])
|
||
}
|
||
}
|
||
var p = e.querySelectorAll("p"),
|
||
m = r.length;
|
||
for (u = 0; u < p.length; u++) {
|
||
var v = p.item(u);
|
||
if (!v || !v.textContent) break;
|
||
for (var g = v.textContent.trim().split(" "), y = -1, _ = 0, b = g.length; _ < b; _ += m) {
|
||
var x = g.slice(_, _ + m).join(" ");
|
||
if (i.hasOwnProperty(x)) y = i[x];
|
||
else {
|
||
for (var w = 0; w < r.length; ++w) {
|
||
var T = r[w],
|
||
S = parseInt(g[_ + w]),
|
||
M = T[1],
|
||
E = T[3];
|
||
0 == w && (o[M.length / m] = S), S *= T[2];
|
||
for (var A = 0; A < T[2]; ++A) M.push(E[S + A])
|
||
}
|
||
y = n, n += 1, i[x] = y
|
||
}
|
||
a.push(y)
|
||
}
|
||
}
|
||
var P = {
|
||
primitive: "line_strip",
|
||
vertices: new Float32Array(r[0][1]),
|
||
info: {}
|
||
};
|
||
return this.transformMeshInfo(P, r, a)
|
||
},
|
||
findXMLNodeById: function(t, e, r) {
|
||
var n;
|
||
if (this._xmlroot._nodes_by_id) {
|
||
if ((n = this._xmlroot._nodes_by_id[r]) && n.localName == e) return n
|
||
} else if (n = this._xmlroot.getElementById(r)) return n;
|
||
for (var i = t.childNodes, o = 0; o < i.length; ++o) {
|
||
var a = i.item(o);
|
||
if (1 == a.nodeType && a.localName == e && a.getAttribute("id") == r) return a
|
||
}
|
||
return null
|
||
},
|
||
readImages: function(t) {
|
||
var e = t.querySelector("library_images");
|
||
if (!e) return null;
|
||
for (var r = {}, n = e.childNodes, i = 0; i < n.length; ++i) {
|
||
var o = n.item(i);
|
||
if (1 == o.nodeType) {
|
||
var a = o.querySelector("init_from");
|
||
if (a && a.textContent) {
|
||
var s = this.getFilename(a.textContent),
|
||
u = o.getAttribute("id");
|
||
r[u] = {
|
||
filename: s,
|
||
map: u,
|
||
name: o.getAttribute("name"),
|
||
path: a.textContent
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return r
|
||
},
|
||
readAnimations: function(t, e) {
|
||
var r = t.querySelector("library_animations");
|
||
if (!r) return null;
|
||
for (var n = r.childNodes, i = {
|
||
object_type: "Animation",
|
||
takes: {}
|
||
}, o = {
|
||
tracks: []
|
||
}, a = o.tracks, s = 0; s < n.length; ++s) {
|
||
var u = n.item(s);
|
||
if (1 == u.nodeType && "animation" == u.localName)
|
||
if (u.getAttribute("id")) this.readAnimation(u, a);
|
||
else {
|
||
var h = u.querySelectorAll("animation");
|
||
if (h.length)
|
||
for (var c = 0; c < h.length; ++c) {
|
||
var l = h.item(c);
|
||
this.readAnimation(l, a)
|
||
} else this.readAnimation(u, a)
|
||
}
|
||
}
|
||
if (!a.length) return null;
|
||
var f = 0;
|
||
for (s = 0; s < a.length; ++s) f < a[s].duration && (f = a[s].duration);
|
||
return o.name = "default", o.duration = f, i.takes[o.name] = o, i
|
||
},
|
||
readAnimation: function(t, e) {
|
||
if ("animation" != t.localName) return null;
|
||
t.getAttribute("id");
|
||
var r = t.querySelectorAll("channel");
|
||
if (!r.length) return null;
|
||
for (var n = e || [], i = 0; i < r.length; ++i) {
|
||
var o = this.readChannel(r.item(i), t);
|
||
o && n.push(o)
|
||
}
|
||
return n
|
||
},
|
||
readChannel: function(t, e) {
|
||
if ("channel" != t.localName || "animation" != e.localName) return null;
|
||
var r = t.getAttribute("source"),
|
||
n = t.getAttribute("target"),
|
||
i = this.findXMLNodeById(e, "sampler", r.substr(1));
|
||
if (!i) return null;
|
||
for (var o = {}, a = {}, s = {}, u = i.querySelectorAll("input"), h = null, c = 0; c < u.length; c++) {
|
||
var l = u.item(c),
|
||
f = l.getAttribute("source"),
|
||
d = l.getAttribute("semantic"),
|
||
p = this.findXMLNodeById(e, "source", f.substr(1));
|
||
if (p) {
|
||
var m = p.querySelector("param");
|
||
if (m) {
|
||
var v = m.getAttribute("type");
|
||
o[d] = {
|
||
source: f,
|
||
type: v
|
||
};
|
||
var g = null;
|
||
if ("float" == v || "float4x4" == v) {
|
||
var y = p.querySelector("float_array"),
|
||
_ = this.readContentAsFloats(y);
|
||
g = s[f] = _;
|
||
var b = m.getAttribute("name");
|
||
"TIME" == b && (h = g), "OUTPUT" == d && (b = d), b && (a[b] = v)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (!h) return null;
|
||
var x = n.split("/"),
|
||
w = {},
|
||
T = x[0],
|
||
S = this._nodes_by_id[T],
|
||
M = S.id + "/" + x[1];
|
||
w.name = x[1], w.property = M, v = "number";
|
||
var E = 1,
|
||
A = a.OUTPUT;
|
||
switch (A) {
|
||
case "float":
|
||
E = 1;
|
||
break;
|
||
case "float3x3":
|
||
E = 9, v = "mat3";
|
||
break;
|
||
case "float4x4":
|
||
E = 16, v = "mat4"
|
||
}
|
||
w.type = v, w.value_size = E, w.duration = h[h.length - 1];
|
||
var P = s[o.OUTPUT.source];
|
||
if (!P) return null;
|
||
var I = h.length,
|
||
O = E + 1,
|
||
C = new Float32Array(I * O);
|
||
for (c = 0; c < h.length; ++c) {
|
||
C[c * O] = h[c];
|
||
var R = P.subarray(c * E, (c + 1) * E);
|
||
"float4x4" == A && this.transformMatrix(R, S ? 0 == S._depth : 0), C.set(R, c * O + 1)
|
||
}
|
||
if (F && this.use_transferables) {
|
||
var D = C;
|
||
D && D.buffer && 100 < D.length && this._transferables.push(D.buffer)
|
||
}
|
||
return w.data = C, w
|
||
},
|
||
findNode: function(t, e) {
|
||
if (t.id == e) return t;
|
||
if (t.children)
|
||
for (var r in t.children) {
|
||
var n = this.findNode(t.children[r], e);
|
||
if (n) return n
|
||
}
|
||
return null
|
||
},
|
||
readLibraryControllers: function(t) {
|
||
var e = this._xmlroot.querySelector("library_controllers");
|
||
if (!e) return null;
|
||
for (var r = e.childNodes, n = 0; n < r.length; ++n) {
|
||
var i = r.item(n);
|
||
if (1 == i.nodeType && "controller" == i.localName) {
|
||
var o = i.getAttribute("id");
|
||
this._controllers_found[o] || this.readController(i, null, t)
|
||
}
|
||
}
|
||
},
|
||
readController: function(t, e, r) {
|
||
if ("controller" == !t.localName) return null;
|
||
var n = t.getAttribute("id");
|
||
if (this._controllers_found[n]) return this._controllers_found[n];
|
||
var i = null,
|
||
o = t.querySelector("skin");
|
||
o && (i = this.readSkinController(o, e, r));
|
||
var a = t.querySelector("morph");
|
||
return a && (i = this.readMorphController(a, e, r, i)), this._controllers_found[n] ? n += "_1blah" : this._controllers_found[n] = i, i
|
||
},
|
||
readSkinController: function(t, e, r) {
|
||
var n = t.getAttribute("source"),
|
||
i = this.readGeometry(n, e, r);
|
||
if (!i) return null;
|
||
var o = this.readSources(t, e);
|
||
if (!o) return null;
|
||
var a = null,
|
||
s = t.querySelector("bind_shape_matrix");
|
||
s ? (a = this.readContentAsFloats(s), this.transformMatrix(a, !0, !0)) : a = Z.mat4.create();
|
||
var u = [],
|
||
h = t.querySelector("joints");
|
||
if (h) {
|
||
for (var c = null, l = null, f = h.querySelectorAll("input"), d = 0; d < f.length; d++) {
|
||
var p = f[d],
|
||
m = p.getAttribute("semantic").toUpperCase(),
|
||
v = o[p.getAttribute("source").substr(1)];
|
||
"JOINT" == m ? c = v : "INV_BIND_MATRIX" == m && (l = v)
|
||
}
|
||
if (!l || !c) return null;
|
||
for (var d in c) {
|
||
var g = l.subarray(16 * d, 16 * d + 16),
|
||
y = c[d],
|
||
_ = this._nodes_by_id[y];
|
||
_ && (this.transformMatrix(g, 0 == _._depth, !0), u.push([y, g]))
|
||
}
|
||
}
|
||
var b = t.querySelector("vertex_weights");
|
||
if (b) {
|
||
var x = null;
|
||
for (f = b.querySelectorAll("input"), d = 0; d < f.length; d++) "WEIGHT" == f[d].getAttribute("semantic").toUpperCase() && (x = o[f.item(d).getAttribute("source").substr(1)]);
|
||
if (!x) throw "no weights found";
|
||
for (var w = b.querySelector("vcount"), T = this.readContentAsUInt32(w), S = b.querySelector("v"), M = this.readContentAsUInt32(S), E = i.vertices.length / 3, A = new Float32Array(4 * E), P = new Uint8Array(4 * E), I = 0, O = i._remap, C = 0, R = (d = 0, T.length); d < R; ++d) {
|
||
for (var D = T[d], F = I, k = P.subarray(4 * d, 4 * d + 4), L = A.subarray(4 * d, 4 * d + 4), N = 0, B = 0; B < D && B < 4; ++B) k[B] = M[F + 2 * B], k[B] > C && (C = k[B]), L[B] = x[M[F + 2 * B + 1]], N += L[B];
|
||
if (4 < D && N < 1) {
|
||
var U = 1 / N;
|
||
for (B = 0; B < 4; ++B) L[B] *= U
|
||
}
|
||
I += 2 * D
|
||
}
|
||
var G = new Float32Array(4 * E),
|
||
j = new Uint8Array(4 * E),
|
||
z = [];
|
||
for (d = 0; d < E; ++d) {
|
||
for (var X = 4 * O[d], V = (L = A.subarray(X, X + 4), k = P.subarray(X, X + 4), 0); V < 3; ++V) {
|
||
var q = V,
|
||
H = L[V];
|
||
for (B = V + 1; B < 4; ++B) L[B] <= H || (H = L[q = B]);
|
||
if (q != V) {
|
||
var W = L[V];
|
||
L[V] = L[q], L[q] = W, W = k[V], k[V] = k[q], k[q] = W
|
||
}
|
||
}
|
||
G.set(L, 4 * d), j.set(k, 4 * d), L[0] && (z[k[0]] = !0), L[1] && (z[k[1]] = !0), L[2] && (z[k[2]] = !0), L[3] && (z[k[3]] = !0)
|
||
}
|
||
u.length;
|
||
var Y = [],
|
||
K = {};
|
||
for (d = 0; d < z.length; ++d) z[d] && (K[d] = Y.length, Y.push(u[d]));
|
||
if (Y.length < u.length) {
|
||
for (d = 0; d < j.length; d++) j[d] = K[j[d]];
|
||
u = Y
|
||
}
|
||
i.weights = G, i.bone_indices = j, i.bones = u, i.bind_matrix = a
|
||
}
|
||
return i
|
||
},
|
||
readMorphController: function(t, e, r, n) {
|
||
var i = t.getAttribute("source"),
|
||
o = this.readGeometry(i, e, r);
|
||
if (!o) return null;
|
||
var a = this.readSources(t, e),
|
||
s = [],
|
||
u = t.querySelector("targets");
|
||
if (!u) return null;
|
||
for (var h = u.querySelectorAll("input"), c = null, l = null, f = 0; f < h.length; f++) {
|
||
var d = h.item(f),
|
||
p = d.getAttribute("semantic").toUpperCase(),
|
||
m = a[d.getAttribute("source").substr(1)];
|
||
"MORPH_TARGET" == p ? c = m : "MORPH_WEIGHT" == p && (l = m)
|
||
}
|
||
if (!c || !l) return null;
|
||
for (var f in c) {
|
||
var v = "#" + c[f],
|
||
g = this.readGeometry(v, e, r);
|
||
r.meshes[v] = g, s.push({
|
||
mesh: v,
|
||
weight: l[f]
|
||
})
|
||
}
|
||
return o.morph_targets = s, o
|
||
},
|
||
readBindMaterials: function(t, e) {
|
||
for (var r = [], n = t.querySelectorAll("technique_common"), i = 0; i < n.length; i++)
|
||
for (var o = n.item(i).querySelectorAll("instance_material"), a = 0; a < o.length; a++) {
|
||
var s = o.item(a);
|
||
s && r.push(s.getAttribute("symbol"))
|
||
}
|
||
return r
|
||
},
|
||
readSources: function(t, e) {
|
||
for (var r = {}, n = t.querySelectorAll("source"), i = 0; i < n.length; i++) {
|
||
var o = n.item(i);
|
||
if (o.querySelector)
|
||
if (o.querySelector("float_array")) {
|
||
var a = this.readContentAsFloats(o);
|
||
r[o.getAttribute("id")] = a
|
||
} else {
|
||
var s = o.querySelector("Name_array");
|
||
if (s) {
|
||
if (!(h = this.readContentAsStringsArray(s))) continue;
|
||
r[o.getAttribute("id")] = h
|
||
} else {
|
||
var u = o.querySelector("IDREF_array");
|
||
if (u) {
|
||
var h;
|
||
if (!(h = this.readContentAsStringsArray(u))) continue;
|
||
r[o.getAttribute("id")] = h
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return r
|
||
},
|
||
readContentAsUInt32: function(t) {
|
||
if (!t) return null;
|
||
var e = t.textContent;
|
||
if (0 == (e = (e = e.replace(/\n/gi, " ")).trim()).length) return null;
|
||
for (var r = e.split(" "), n = new Uint32Array(r.length), i = 0; i < r.length; i++) n[i] = parseInt(r[i]);
|
||
return n
|
||
},
|
||
readContentAsFloats: function(t) {
|
||
if (!t) return null;
|
||
for (var e = t.textContent, r = (e = (e = (e = (e = e.replace(/\n/gi, " ")).replace(/\s\s+/gi, " ")).replace(/\t/gi, "")).trim()).split(" "), n = t.getAttribute("count"), i = n ? parseInt(n) : r.length, o = new Float32Array(i), a = 0; a < r.length; a++) o[a] = parseFloat(r[a]);
|
||
return o
|
||
},
|
||
readContentAsStringsArray: function(t) {
|
||
if (!t) return null;
|
||
for (var e = t.textContent, r = (e = (e = (e = e.replace(/\n/gi, " ")).replace(/\s\s/gi, " ")).trim()).split(" "), n = 0; n < r.length; n++) r[n] = r[n].trim();
|
||
if (t.getAttribute("count") && parseInt(t.getAttribute("count")) != r.length) {
|
||
var i = [],
|
||
o = "";
|
||
for (var a in r) o ? o += " " + r[a] : o = r[a], this._nodes_by_id[this.safeString(o)] && (i.push(this.safeString(o)), o = "");
|
||
var s = parseInt(t.getAttribute("count"));
|
||
return i.length == s ? i : null
|
||
}
|
||
return r
|
||
},
|
||
max3d_matrix_0: new Float32Array([0, -1, 0, 0, 0, 0, -1, 0, 1, 0, 0, -0, 0, 0, 0, 1]),
|
||
transformMatrix: function(t, e, r) {
|
||
if (Z.mat4.transpose(t, t), this.no_flip) return t;
|
||
if (e) {
|
||
var n = new Float32Array(t.subarray(4, 8));
|
||
t.set(t.subarray(8, 12), 4), t.set(n, 8), n = t.subarray(8, 12), vec4.scale(n, n, -1)
|
||
} else {
|
||
var i = Z.mat4.create(),
|
||
o = t;
|
||
i.set([o[0], o[2], -o[1]], 0), i.set([o[8], o[10], -o[9]], 4), i.set([-o[4], -o[6], o[5]], 8), i.set([o[12], o[14], -o[13]], 12), o.set(i)
|
||
}
|
||
return t
|
||
}
|
||
}, Collada.parseInWorker = F ? (Collada.loadInWorker = function(t, e) {
|
||
Collada.load(e, t)
|
||
}, function(t, e) {
|
||
t(Collada.parse(e))
|
||
}) : (Collada.launchWorker = function() {
|
||
var t = this.worker = new Worker(Collada.workerPath + "collada.js");
|
||
t.callback_ids = {}, t.addEventListener("error", function(t) {
|
||
Collada.onerror && Collada.onerror(err)
|
||
}), t.addEventListener("message", function(t) {
|
||
if (t.data) {
|
||
var e = t.data;
|
||
switch (e.action) {
|
||
case "log":
|
||
case "warn":
|
||
break;
|
||
case "exception":
|
||
Collada.onerror && Collada.onerror(e.msg);
|
||
break;
|
||
case "error":
|
||
break;
|
||
case "result":
|
||
var r = this.callback_ids[e.callback_id];
|
||
if (!r) throw "callback not found";
|
||
r(e.result)
|
||
}
|
||
}
|
||
}), this.callback_ids = {}, this.last_callback_id = 1, this.toWorker("init", [this.config])
|
||
}, Collada.toWorker = function(t, e, r) {
|
||
this.worker || this.launchWorker();
|
||
var n = this.last_callback_id++;
|
||
this.worker.callback_ids[n] = r, this.worker.postMessage({
|
||
func: t,
|
||
params: e,
|
||
callback_id: n
|
||
})
|
||
}, Collada.loadInWorker = function(t, e) {
|
||
this.toWorker("loadInWorker", [t], e)
|
||
}, function(t, e) {
|
||
this.toWorker("parseInWorker", [t], e)
|
||
}), F && self.addEventListener("message", function(t) {
|
||
if ("init" == t.data.func) return Collada.init.apply(Collada, t.data.params);
|
||
var e = t.data.func,
|
||
r = t.data.params,
|
||
n = t.data.callback_id,
|
||
i = function(t) {
|
||
self.postMessage({
|
||
action: "result",
|
||
callback_id: n,
|
||
result: t
|
||
}, Collada._transferables), Collada._transferables = null
|
||
},
|
||
o = Collada[e];
|
||
if (void 0 === o) i(null);
|
||
else try {
|
||
o.apply(Collada, r ? [i].concat(r) : [i])
|
||
} catch (t) {
|
||
i(null)
|
||
}
|
||
}, !1);
|
||
r(73), r(95), Z.mat4.create(), Z.vec3.create();
|
||
var c = r(16),
|
||
i = r(90),
|
||
u = function() {
|
||
function BinaryReader(t, e) {
|
||
this.dv = new DataView(t), this.offset = 0, this.littleEndian = void 0 === e || e
|
||
}
|
||
var t = BinaryReader.prototype;
|
||
return t.getOffset = function() {
|
||
return this.offset
|
||
}, t.size = function() {
|
||
return this.dv.buffer.byteLength
|
||
}, t.skip = function(t) {
|
||
this.offset += t
|
||
}, t.getBoolean = function() {
|
||
return 1 == (1 & this.getUint8())
|
||
}, t.getBooleanArray = function(t) {
|
||
for (var e = [], r = 0; r < t; r++) e.push(this.getBoolean());
|
||
return e
|
||
}, t.getUint8 = function() {
|
||
var t = this.dv.getUint8(this.offset);
|
||
return this.offset += 1, t
|
||
}, t.getInt16 = function() {
|
||
var t = this.dv.getInt16(this.offset, this.littleEndian);
|
||
return this.offset += 2, t
|
||
}, t.getInt32 = function() {
|
||
var t = this.dv.getInt32(this.offset, this.littleEndian);
|
||
return this.offset += 4, t
|
||
}, t.getInt32Array = function(t) {
|
||
for (var e = [], r = 0; r < t; r++) e.push(this.getInt32());
|
||
return e
|
||
}, t.getUint32 = function() {
|
||
var t = this.dv.getUint32(this.offset, this.littleEndian);
|
||
return this.offset += 4, t
|
||
}, t.getInt64 = function() {
|
||
var t, e;
|
||
return this.littleEndian ? (t = this.getUint32(), e = this.getUint32()) : (e = this.getUint32(), t = this.getUint32()), 2147483648 & e ? (e = 4294967295 & ~e, 4294967295 === (t = 4294967295 & ~t) && (e = e + 1 & 4294967295), -(4294967296 * e + (t = t + 1 & 4294967295))) : 4294967296 * e + t
|
||
}, t.getInt64Array = function(t) {
|
||
for (var e = [], r = 0; r < t; r++) e.push(this.getInt64());
|
||
return e
|
||
}, t.getUint64 = function() {
|
||
var t, e;
|
||
this.littleEndian ? (t = this.getUint32(), e = this.getUint32()) : (e = this.getUint32(), t = this.getUint32());
|
||
var r = 4294967296 * e + t;
|
||
return Math.abs(r), Number.MAX_SAFE_INTEGER, 4294967296 * e + t
|
||
}, t.getFloat32 = function() {
|
||
var t = this.dv.getFloat32(this.offset, this.littleEndian);
|
||
return this.offset += 4, t
|
||
}, t.getFloat32Array = function(t) {
|
||
for (var e = [], r = 0; r < t; r++) e.push(this.getFloat32());
|
||
return e
|
||
}, t.getFloat64 = function() {
|
||
var t = this.dv.getFloat64(this.offset, this.littleEndian);
|
||
return this.offset += 8, t
|
||
}, t.getFloat64Array = function(t) {
|
||
for (var e = [], r = 0; r < t; r++) e.push(this.getFloat64());
|
||
return e
|
||
}, t.getArrayBuffer = function(t) {
|
||
var e = this.dv.buffer.slice(this.offset, this.offset + t);
|
||
return this.offset += t, e
|
||
}, t.getString = function(t) {
|
||
for (var e = [], r = 0; r < t; r++) e[r] = this.getUint8();
|
||
var n = e.indexOf(0);
|
||
return 0 <= n && (e = e.slice(0, n)), Object(i.decodeText)(new Uint8Array(e))
|
||
}, BinaryReader
|
||
}(),
|
||
a = function() {
|
||
function FBXTree() {}
|
||
return FBXTree.prototype.add = function(t, e) {
|
||
this[t] = e
|
||
}, FBXTree
|
||
}(),
|
||
s = function() {
|
||
function BinaryParser(t) {
|
||
this.context = t
|
||
}
|
||
var t = BinaryParser.prototype;
|
||
return t.parse = function(t) {
|
||
var e = new u(t);
|
||
e.skip(23);
|
||
for (var r = e.getUint32(), n = new a; !this.endOfContent(e);) {
|
||
var i = this.parseNode(e, r);
|
||
null !== i && n.add(i.name, i)
|
||
}
|
||
return n
|
||
}, t.endOfContent = function(t) {
|
||
return t.size() % 16 == 0 ? (t.getOffset() + 160 + 16 & -16) >= t.size() : t.getOffset() + 160 + 16 >= t.size()
|
||
}, t.parseNode = function(t, e) {
|
||
var r = {},
|
||
n = 7500 <= e ? t.getUint64() : t.getUint32(),
|
||
i = 7500 <= e ? t.getUint64() : t.getUint32(),
|
||
o = (7500 <= e ? t.getUint64() : t.getUint32(), t.getUint8()),
|
||
a = t.getString(o);
|
||
if (0 === n) return null;
|
||
for (var s = [], u = 0; u < i; u++) s.push(this.parseProperty(t));
|
||
var h = 0 < s.length ? s[0] : "",
|
||
c = 1 < s.length ? s[1] : "",
|
||
l = 2 < s.length ? s[2] : "";
|
||
for (r.singleProperty = 1 === i && t.getOffset() === n; n > t.getOffset();) {
|
||
var f = this.parseNode(t, e);
|
||
null !== f && this.parseSubNode(a, r, f)
|
||
}
|
||
return r.propertyList = s, "number" == typeof h && (r.id = h), "" !== c && (r.attrName = c), "" !== l && (r.attrType = l), "" !== a && (r.name = a), r
|
||
}, t.parseSubNode = function(t, e, r) {
|
||
if (!0 === r.singleProperty) {
|
||
var n = r.propertyList[0];
|
||
Array.isArray(n) ? (e[r.name] = r).a = n : e[r.name] = n
|
||
} else if ("Connections" === t && "C" === r.name) {
|
||
var i = [];
|
||
r.propertyList.forEach(function(t, e) {
|
||
0 !== e && i.push(t)
|
||
}), void 0 === e.connections && (e.connections = []), e.connections.push(i)
|
||
} else if ("Properties70" === r.name) {
|
||
Object.keys(r).forEach(function(t) {
|
||
e[t] = r[t]
|
||
})
|
||
} else if ("Properties70" === t && "P" === r.name) {
|
||
var o, a = r.propertyList[0],
|
||
s = r.propertyList[1],
|
||
u = r.propertyList[2],
|
||
h = r.propertyList[3];
|
||
0 === a.indexOf("Lcl ") && (a = a.replace("Lcl ", "Lcl_")), 0 === s.indexOf("Lcl ") && (s = s.replace("Lcl ", "Lcl_")), o = "Color" === s || "ColorRGB" === s || "Vector" === s || "Vector3D" === s || 0 === s.indexOf("Lcl_") ? [r.propertyList[4], r.propertyList[5], r.propertyList[6]] : r.propertyList[4], e[a] = {
|
||
type: s,
|
||
type2: u,
|
||
flag: h,
|
||
value: o
|
||
}
|
||
} else void 0 === e[r.name] ? "number" == typeof r.id ? (e[r.name] = {}, e[r.name][r.id] = r) : e[r.name] = r : "PoseNode" === r.name ? (Array.isArray(e[r.name]) || (e[r.name] = [e[r.name]]), e[r.name].push(r)) : void 0 === e[r.name][r.id] && (e[r.name][r.id] = r)
|
||
}, t.parseProperty = function(t) {
|
||
var e = t.getString(1),
|
||
r = 0;
|
||
switch (e) {
|
||
case "C":
|
||
return t.getBoolean();
|
||
case "D":
|
||
return t.getFloat64();
|
||
case "F":
|
||
return t.getFloat32();
|
||
case "I":
|
||
return t.getInt32();
|
||
case "L":
|
||
return t.getInt64();
|
||
case "R":
|
||
return r = t.getUint32(), t.getArrayBuffer(r);
|
||
case "S":
|
||
return r = t.getUint32(), t.getString(r);
|
||
case "Y":
|
||
return t.getInt16();
|
||
case "b":
|
||
case "c":
|
||
case "d":
|
||
case "f":
|
||
case "i":
|
||
case "l":
|
||
var n = t.getUint32(),
|
||
i = t.getUint32(),
|
||
o = t.getUint32();
|
||
if (0 === i) switch (e) {
|
||
case "b":
|
||
case "c":
|
||
return t.getBooleanArray(n);
|
||
case "d":
|
||
return t.getFloat64Array(n);
|
||
case "f":
|
||
return t.getFloat32Array(n);
|
||
case "i":
|
||
return t.getInt32Array(n);
|
||
case "l":
|
||
return t.getInt64Array(n)
|
||
}
|
||
var a = new Zlib.Inflate(new Uint8Array(t.getArrayBuffer(o))),
|
||
s = new u(a.decompress().buffer);
|
||
switch (e) {
|
||
case "b":
|
||
case "c":
|
||
return s.getBooleanArray(n);
|
||
case "d":
|
||
return s.getFloat64Array(n);
|
||
case "f":
|
||
return s.getFloat32Array(n);
|
||
case "i":
|
||
return s.getInt32Array(n);
|
||
case "l":
|
||
return s.getInt64Array(n)
|
||
}
|
||
default:
|
||
throw new Error("THREE.FBXLoader: Unknown property type " + e)
|
||
}
|
||
}, BinaryParser
|
||
}(),
|
||
h = r(96),
|
||
l = function() {
|
||
function TextParser(t) {
|
||
this.context = t
|
||
}
|
||
var t = TextParser.prototype;
|
||
return t.getPrevNode = function() {
|
||
return this.nodeStack[this.currentIndent - 2]
|
||
}, t.getCurrentNode = function() {
|
||
return this.nodeStack[this.currentIndent - 1]
|
||
}, t.getCurrentProp = function() {
|
||
return this.currentProp
|
||
}, t.pushStack = function(t) {
|
||
this.nodeStack.push(t), this.currentIndent += 1
|
||
}, t.popStack = function() {
|
||
this.nodeStack.pop(), this.currentIndent -= 1
|
||
}, t.setCurrentProp = function(t, e) {
|
||
this.currentProp = t, this.currentPropName = e
|
||
}, t.parse = function(t) {
|
||
this.currentIndent = 0, this.allNodes = new a, this.nodeStack = [], this.currentProp = [], this.currentPropName = "";
|
||
var s = this,
|
||
u = t.split(/[\r\n]+/);
|
||
return u.forEach(function(t, e) {
|
||
var r = t.match(/^[\s\t]*;/),
|
||
n = t.match(/^[\s\t]*$/);
|
||
if (!r && !n) {
|
||
var i = t.match("^\\t{" + s.currentIndent + "}(\\w+):(.*){", ""),
|
||
o = t.match("^\\t{" + s.currentIndent + "}(\\w+):[\\s\\t\\r\\n](.*)"),
|
||
a = t.match("^\\t{" + (s.currentIndent - 1) + "}}");
|
||
i ? s.parseNodeBegin(t, i) : o ? s.parseNodeProperty(t, o, u[++e]) : a ? s.popStack() : t.match(/^[^\s\t}]/) && s.parseNodePropertyContinued(t)
|
||
}
|
||
}), this.allNodes
|
||
}, t.parseNodeBegin = function(t, e) {
|
||
var r = e[1].trim().replace(/^"/, "").replace(/"$/, ""),
|
||
n = e[2].split(",").map(function(t) {
|
||
return t.trim().replace(/^"/, "").replace(/"$/, "")
|
||
}),
|
||
i = {
|
||
name: r
|
||
},
|
||
o = this.parseNodeAttr(n),
|
||
a = this.getCurrentNode();
|
||
0 === this.currentIndent ? this.allNodes.add(r, i) : r in a ? ("PoseNode" === r ? a.PoseNode.push(i) : void 0 !== a[r].id && (a[r] = {}, a[r][a[r].id] = a[r]), "" !== o.id && (a[r][o.id] = i)) : "number" == typeof o.id ? (a[r] = {}, a[r][o.id] = i) : "Properties70" !== r && (a[r] = "PoseNode" === r ? [i] : i), "number" == typeof o.id && (i.id = o.id), "" !== o.name && (i.attrName = o.name), "" !== o.type && (i.attrType = o.type), this.pushStack(i)
|
||
}, t.parseNodeAttr = function(t) {
|
||
var e = t[0];
|
||
"" !== t[0] && (e = parseInt(t[0]), isNaN(e) && (e = t[0]));
|
||
var r = "",
|
||
n = "";
|
||
return 1 < t.length && (r = t[1].replace(/^(\w+)::/, ""), n = t[2]), {
|
||
id: e,
|
||
name: r,
|
||
type: n
|
||
}
|
||
}, t.parseNodeProperty = function(t, e, r) {
|
||
var n = e[1].replace(/^"/, "").replace(/"$/, "").trim(),
|
||
i = e[2].replace(/^"/, "").replace(/"$/, "").trim();
|
||
"Content" === n && "," === i && (i = r.replace(/"/g, "").replace(/,$/, "").trim());
|
||
var o = this.getCurrentNode();
|
||
if ("Properties70" !== o.name) {
|
||
if ("C" === n) {
|
||
var a = i.split(",").slice(1),
|
||
s = parseInt(a[0]),
|
||
u = parseInt(a[1]),
|
||
h = i.split(",").slice(3);
|
||
h = h.map(function(t) {
|
||
return t.trim().replace(/^"/, "")
|
||
}), n = "connections", i = [s, u], Object(c.a)(i, h), void 0 === o[n] && (o[n] = [])
|
||
}
|
||
"Node" === n && (o.id = i), n in o && Array.isArray(o[n]) ? o[n].push(i) : "a" !== n ? o[n] = i : o.a = i, this.setCurrentProp(o, n), "a" === n && "," !== i.slice(-1) && (o.a = Object(c.k)(i))
|
||
} else this.parseNodeSpecialProperty(t, n, i)
|
||
}, t.parseNodePropertyContinued = function(t) {
|
||
var e = this.getCurrentNode();
|
||
e.a += t, "," !== t.slice(-1) && (e.a = Object(c.k)(e.a))
|
||
}, t.parseNodeSpecialProperty = function(t, e, r) {
|
||
var n = r.split('",').map(function(t) {
|
||
return t.trim().replace(/^\"/, "").replace(/\s/, "_")
|
||
}),
|
||
i = n[0],
|
||
o = n[1],
|
||
a = n[2],
|
||
s = n[3],
|
||
u = n[4];
|
||
switch (o) {
|
||
case "int":
|
||
case "enum":
|
||
case "bool":
|
||
case "ULongLong":
|
||
case "double":
|
||
case "Number":
|
||
case "FieldOfView":
|
||
u = parseFloat(u);
|
||
break;
|
||
case "Color":
|
||
case "ColorRGB":
|
||
case "Vector3D":
|
||
case "Lcl_Translation":
|
||
case "Lcl_Rotation":
|
||
case "Lcl_Scaling":
|
||
u = Object(c.k)(u)
|
||
}
|
||
this.getPrevNode()[i] = {
|
||
type: o,
|
||
type2: a,
|
||
flag: s,
|
||
value: u
|
||
}, this.setCurrentProp(this.getPrevNode(), i)
|
||
}, TextParser
|
||
}(),
|
||
f = r(97),
|
||
n = (r(128), o.LoaderResource);
|
||
n.setExtensionXhrType("fbx", n.XHR_RESPONSE_TYPE.BUFFER), o.geometryCache || (o.geometryCache = {}, o.Geometry.from = function(t) {
|
||
if (o.geometryCache[t]) return o.geometryCache[t];
|
||
throw new Error('GEOMETRY: "' + t + '" does not exist in the cache')
|
||
}), o.sceneCache = {};
|
||
e.a = function() {
|
||
return function(t, e) {
|
||
if (!t.data || "fbx" !== t.extension) return e();
|
||
var r = t.data,
|
||
n = new f.a;
|
||
if (Object(c.j)(r)) n.fbxTree = new s(n).parse(r);
|
||
else {
|
||
var i = Object(c.b)(r);
|
||
if (!Object(c.i)(i)) throw new Error("THREE.FBXLoader: Unknown format.");
|
||
if (Object(c.g)(i) < 7e3) throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: " + Object(c.g)(i));
|
||
n.fbxTree = new l(n).parse(i)
|
||
}
|
||
new h.a(n, {}).parse(n.fbxTree), n.convertScene(), o.sceneCache[t.url] = n, e()
|
||
}
|
||
}
|
||
}, , function(t, e, r) {
|
||
"use strict";
|
||
(function(t) {
|
||
if (r(201), r(397), r(398), t._babelPolyfill) throw new Error("only one instance of babel-polyfill is allowed");
|
||
t._babelPolyfill = !0;
|
||
|
||
function define(t, e, r) {
|
||
t[e] || Object.defineProperty(t, e, {
|
||
writable: !0,
|
||
configurable: !0,
|
||
value: r
|
||
})
|
||
}
|
||
define(String.prototype, "padLeft", "".padStart), define(String.prototype, "padRight", "".padEnd), "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(t) {
|
||
[][t] && define(Array, t, Function.call.bind([][t]))
|
||
})
|
||
}).call(this, r(42))
|
||
}, function(t, e, r) {
|
||
r(202), r(204), r(205), r(206), r(207), r(208), r(209), r(210), r(211), r(212), r(213), r(214), r(215), r(216), r(217), r(218), r(219), r(220), r(221), r(222), r(223), r(224), r(225), r(226), r(227), r(228), r(229), r(230), r(231), r(232), r(233), r(234), r(235), r(236), r(237), r(238), r(239), r(240), r(241), r(242), r(243), r(244), r(245), r(246), r(247), r(248), r(249), r(250), r(251), r(252), r(253), r(254), r(255), r(256), r(257), r(258), r(259), r(260), r(261), r(262), r(263), r(264), r(265), r(266), r(267), r(268), r(269), r(270), r(271), r(272), r(273), r(274), r(275), r(276), r(277), r(278), r(279), r(281), r(282), r(284), r(285), r(286), r(287), r(288), r(289), r(290), r(292), r(293), r(294), r(295), r(296), r(297), r(298), r(299), r(300), r(301), r(302), r(303), r(304), r(118), r(305), r(153), r(306), r(154), r(307), r(308), r(309), r(310), r(311), r(157), r(159), r(160), r(312), r(313), r(314), r(315), r(316), r(317), r(318), r(319), r(320), r(321), r(322), r(323), r(324), r(325), r(326), r(327), r(328), r(329), r(330), r(331), r(332), r(333), r(334), r(335), r(336), r(337), r(338), r(339), r(340), r(341), r(342), r(343), r(344), r(345), r(346), r(347), r(348), r(349), r(350), r(351), r(352), r(353), r(354), r(355), r(356), r(357), r(358), r(359), r(360), r(361), r(362), r(363), r(364), r(365), r(366), r(367), r(368), r(369), r(370), r(371), r(372), r(373), r(374), r(375), r(376), r(377), r(378), r(379), r(380), r(381), r(382), r(383), r(384), r(385), r(386), r(387), r(388), r(389), r(390), r(391), r(392), r(393), r(394), r(395), r(396), t.exports = r(32)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(9),
|
||
a = r(28),
|
||
i = r(19),
|
||
o = r(1),
|
||
s = r(26),
|
||
u = r(48).KEY,
|
||
h = r(10),
|
||
c = r(74),
|
||
l = r(61),
|
||
f = r(52),
|
||
d = r(15),
|
||
p = r(135),
|
||
m = r(99),
|
||
v = r(203),
|
||
g = r(77),
|
||
y = r(6),
|
||
_ = r(11),
|
||
b = r(29),
|
||
x = r(38),
|
||
w = r(51),
|
||
T = r(55),
|
||
S = r(138),
|
||
M = r(30),
|
||
E = r(20),
|
||
A = r(53),
|
||
P = M.f,
|
||
I = E.f,
|
||
O = S.f,
|
||
C = n.Symbol,
|
||
R = n.JSON,
|
||
D = R && R.stringify,
|
||
F = "prototype",
|
||
k = d("_hidden"),
|
||
L = d("toPrimitive"),
|
||
N = {}.propertyIsEnumerable,
|
||
B = c("symbol-registry"),
|
||
U = c("symbols"),
|
||
G = c("op-symbols"),
|
||
j = Object[F],
|
||
z = "function" == typeof C,
|
||
X = n.QObject,
|
||
V = !X || !X[F] || !X[F].findChild,
|
||
q = i && h(function() {
|
||
return 7 != T(I({}, "a", {
|
||
get: function() {
|
||
return I(this, "a", {
|
||
value: 7
|
||
}).a
|
||
}
|
||
})).a
|
||
}) ? function(t, e, r) {
|
||
var n = P(j, e);
|
||
n && delete j[e], I(t, e, r), n && t !== j && I(j, e, n)
|
||
} : I,
|
||
H = function(t) {
|
||
var e = U[t] = T(C[F]);
|
||
return e._k = t, e
|
||
},
|
||
W = z && "symbol" == typeof C.iterator ? function(t) {
|
||
return "symbol" == typeof t
|
||
} : function(t) {
|
||
return t instanceof C
|
||
},
|
||
Y = function(t, e, r) {
|
||
return t === j && Y(G, e, r), y(t), e = x(e, !0), y(r), a(U, e) ? (r.enumerable ? (a(t, k) && t[k][e] && (t[k][e] = !1), r = T(r, {
|
||
enumerable: w(0, !1)
|
||
})) : (a(t, k) || I(t, k, w(1, {})), t[k][e] = !0), q(t, e, r)) : I(t, e, r)
|
||
},
|
||
K = function(t, e) {
|
||
y(t);
|
||
for (var r, n = v(e = b(e)), i = 0, o = n.length; i < o;) Y(t, r = n[i++], e[r]);
|
||
return t
|
||
},
|
||
Z = function(t) {
|
||
var e = N.call(this, t = x(t, !0));
|
||
return !(this === j && a(U, t) && !a(G, t)) && (!(e || !a(this, t) || !a(U, t) || a(this, k) && this[k][t]) || e)
|
||
},
|
||
Q = function(t, e) {
|
||
if (t = b(t), e = x(e, !0), t !== j || !a(U, e) || a(G, e)) {
|
||
var r = P(t, e);
|
||
return !r || !a(U, e) || a(t, k) && t[k][e] || (r.enumerable = !0), r
|
||
}
|
||
},
|
||
J = function(t) {
|
||
for (var e, r = O(b(t)), n = [], i = 0; r.length > i;) a(U, e = r[i++]) || e == k || e == u || n.push(e);
|
||
return n
|
||
},
|
||
$ = function(t) {
|
||
for (var e, r = t === j, n = O(r ? G : b(t)), i = [], o = 0; n.length > o;) !a(U, e = n[o++]) || r && !a(j, e) || i.push(U[e]);
|
||
return i
|
||
};
|
||
z || (s((C = function() {
|
||
if (this instanceof C) throw TypeError("Symbol is not a constructor!");
|
||
var e = f(0 < arguments.length ? arguments[0] : void 0),
|
||
r = function(t) {
|
||
this === j && r.call(G, t), a(this, k) && a(this[k], e) && (this[k][e] = !1), q(this, e, w(1, t))
|
||
};
|
||
return i && V && q(j, e, {
|
||
configurable: !0,
|
||
set: r
|
||
}), H(e)
|
||
})[F], "toString", function() {
|
||
return this._k
|
||
}), M.f = Q, E.f = Y, r(56).f = S.f = J, r(70).f = Z, r(76).f = $, i && !r(49) && s(j, "propertyIsEnumerable", Z, !0), p.f = function(t) {
|
||
return H(d(t))
|
||
}), o(o.G + o.W + o.F * !z, {
|
||
Symbol: C
|
||
});
|
||
for (var tt = "hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","), et = 0; tt.length > et;) d(tt[et++]);
|
||
for (var rt = A(d.store), nt = 0; rt.length > nt;) m(rt[nt++]);
|
||
o(o.S + o.F * !z, "Symbol", {
|
||
for: function(t) {
|
||
return a(B, t += "") ? B[t] : B[t] = C(t)
|
||
},
|
||
keyFor: function(t) {
|
||
if (!W(t)) throw TypeError(t + " is not a symbol!");
|
||
for (var e in B)
|
||
if (B[e] === t) return e
|
||
},
|
||
useSetter: function() {
|
||
V = !0
|
||
},
|
||
useSimple: function() {
|
||
V = !1
|
||
}
|
||
}), o(o.S + o.F * !z, "Object", {
|
||
create: function(t, e) {
|
||
return void 0 === e ? T(t) : K(T(t), e)
|
||
},
|
||
defineProperty: Y,
|
||
defineProperties: K,
|
||
getOwnPropertyDescriptor: Q,
|
||
getOwnPropertyNames: J,
|
||
getOwnPropertySymbols: $
|
||
}), R && o(o.S + o.F * (!z || h(function() {
|
||
var t = C();
|
||
return "[null]" != D([t]) || "{}" != D({
|
||
a: t
|
||
}) || "{}" != D(Object(t))
|
||
})), "JSON", {
|
||
stringify: function(t) {
|
||
for (var e, r, n = [t], i = 1; arguments.length > i;) n.push(arguments[i++]);
|
||
if (r = e = n[1], (_(e) || void 0 !== t) && !W(t)) return g(e) || (e = function(t, e) {
|
||
if ("function" == typeof r && (e = r.call(this, t, e)), !W(e)) return e
|
||
}), n[1] = e, D.apply(R, n)
|
||
}
|
||
}), C[F][L] || r(25)(C[F], L, C[F].valueOf), l(C, "Symbol"), l(Math, "Math", !0), l(n.JSON, "JSON", !0)
|
||
}, function(t, e, r) {
|
||
var s = r(53),
|
||
u = r(76),
|
||
h = r(70);
|
||
t.exports = function(t) {
|
||
var e = s(t),
|
||
r = u.f;
|
||
if (r)
|
||
for (var n, i = r(t), o = h.f, a = 0; i.length > a;) o.call(t, n = i[a++]) && e.push(n);
|
||
return e
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Object", {
|
||
create: r(55)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S + n.F * !r(19), "Object", {
|
||
defineProperty: r(20).f
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S + n.F * !r(19), "Object", {
|
||
defineProperties: r(137)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(29),
|
||
i = r(30).f;
|
||
r(40)("getOwnPropertyDescriptor", function() {
|
||
return function(t, e) {
|
||
return i(n(t), e)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(22),
|
||
i = r(31);
|
||
r(40)("getPrototypeOf", function() {
|
||
return function(t) {
|
||
return i(n(t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(22),
|
||
i = r(53);
|
||
r(40)("keys", function() {
|
||
return function(t) {
|
||
return i(n(t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(40)("getOwnPropertyNames", function() {
|
||
return r(138).f
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = r(48).onFreeze;
|
||
r(40)("freeze", function(e) {
|
||
return function(t) {
|
||
return e && n(t) ? e(i(t)) : t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = r(48).onFreeze;
|
||
r(40)("seal", function(e) {
|
||
return function(t) {
|
||
return e && n(t) ? e(i(t)) : t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = r(48).onFreeze;
|
||
r(40)("preventExtensions", function(e) {
|
||
return function(t) {
|
||
return e && n(t) ? e(i(t)) : t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11);
|
||
r(40)("isFrozen", function(e) {
|
||
return function(t) {
|
||
return !n(t) || !!e && e(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11);
|
||
r(40)("isSealed", function(e) {
|
||
return function(t) {
|
||
return !n(t) || !!e && e(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11);
|
||
r(40)("isExtensible", function(e) {
|
||
return function(t) {
|
||
return !!n(t) && (!e || e(t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S + n.F, "Object", {
|
||
assign: r(139)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Object", {
|
||
is: r(140)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Object", {
|
||
setPrototypeOf: r(103).set
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(62),
|
||
i = {};
|
||
i[r(15)("toStringTag")] = "z", i + "" != "[object z]" && r(26)(Object.prototype, "toString", function() {
|
||
return "[object " + n(this) + "]"
|
||
}, !0)
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.P, "Function", {
|
||
bind: r(141)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(20).f,
|
||
i = Function.prototype,
|
||
o = /^\s*function ([^ (]*)/;
|
||
"name" in i || r(19) && n(i, "name", {
|
||
configurable: !0,
|
||
get: function() {
|
||
try {
|
||
return ("" + this).match(o)[1]
|
||
} catch (t) {
|
||
return ""
|
||
}
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(11),
|
||
i = r(31),
|
||
o = r(15)("hasInstance"),
|
||
a = Function.prototype;
|
||
o in a || r(20).f(a, o, {
|
||
value: function(t) {
|
||
if ("function" != typeof this || !n(t)) return !1;
|
||
if (!n(this.prototype)) return t instanceof this;
|
||
for (; t = i(t);)
|
||
if (this.prototype === t) return !0;
|
||
return !1
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(143);
|
||
n(n.G + n.F * (parseInt != i), {
|
||
parseInt: i
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(144);
|
||
n(n.G + n.F * (parseFloat != i), {
|
||
parseFloat: i
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(9),
|
||
i = r(28),
|
||
o = r(34),
|
||
a = r(105),
|
||
c = r(38),
|
||
s = r(10),
|
||
u = r(56).f,
|
||
h = r(30).f,
|
||
l = r(20).f,
|
||
f = r(63).trim,
|
||
d = "Number",
|
||
p = n[d],
|
||
m = p,
|
||
v = p.prototype,
|
||
g = o(r(55)(v)) == d,
|
||
y = "trim" in String.prototype,
|
||
_ = function(t) {
|
||
var e = c(t, !1);
|
||
if ("string" == typeof e && 2 < e.length) {
|
||
var r, n, i, o = (e = y ? e.trim() : f(e, 3)).charCodeAt(0);
|
||
if (43 === o || 45 === o) {
|
||
if (88 === (r = e.charCodeAt(2)) || 120 === r) return NaN
|
||
} else if (48 === o) {
|
||
switch (e.charCodeAt(1)) {
|
||
case 66:
|
||
case 98:
|
||
n = 2, i = 49;
|
||
break;
|
||
case 79:
|
||
case 111:
|
||
n = 8, i = 55;
|
||
break;
|
||
default:
|
||
return +e
|
||
}
|
||
for (var a, s = e.slice(2), u = 0, h = s.length; u < h; u++)
|
||
if ((a = s.charCodeAt(u)) < 48 || i < a) return NaN;
|
||
return parseInt(s, n)
|
||
}
|
||
}
|
||
return +e
|
||
};
|
||
if (!p(" 0o1") || !p("0b1") || p("+0x1")) {
|
||
p = function(t) {
|
||
var e = arguments.length < 1 ? 0 : t,
|
||
r = this;
|
||
return r instanceof p && (g ? s(function() {
|
||
v.valueOf.call(r)
|
||
}) : o(r) != d) ? a(new m(_(e)), r, p) : _(e)
|
||
};
|
||
for (var b, x = r(19) ? u(m) : "MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","), w = 0; x.length > w; w++) i(m, b = x[w]) && !i(p, b) && l(p, b, h(m, b));
|
||
(p.prototype = v).constructor = p, r(26)(n, d, p)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
h = r(35),
|
||
c = r(145),
|
||
l = r(106),
|
||
i = 1..toFixed,
|
||
o = Math.floor,
|
||
a = [0, 0, 0, 0, 0, 0],
|
||
f = "Number.toFixed: incorrect invocation!",
|
||
d = function(t, e) {
|
||
for (var r = -1, n = e; ++r < 6;) n += t * a[r], a[r] = n % 1e7, n = o(n / 1e7)
|
||
},
|
||
p = function(t) {
|
||
for (var e = 6, r = 0; 0 <= --e;) r += a[e], a[e] = o(r / t), r = r % t * 1e7
|
||
},
|
||
m = function() {
|
||
for (var t = 6, e = ""; 0 <= --t;)
|
||
if ("" !== e || 0 === t || 0 !== a[t]) {
|
||
var r = String(a[t]);
|
||
e = "" === e ? r : e + l.call("0", 7 - r.length) + r
|
||
}
|
||
return e
|
||
},
|
||
v = function(t, e, r) {
|
||
return 0 === e ? r : e % 2 == 1 ? v(t, e - 1, r * t) : v(t * t, e / 2, r)
|
||
};
|
||
n(n.P + n.F * (!!i && ("0.000" !== 8e-5.toFixed(3) || "1" !== .9.toFixed(0) || "1.25" !== 1.255.toFixed(2) || "1000000000000000128" !== (0xde0b6b3a7640080).toFixed(0)) || !r(10)(function() {
|
||
i.call({})
|
||
})), "Number", {
|
||
toFixed: function(t) {
|
||
var e, r, n, i, o = c(this, f),
|
||
a = h(t),
|
||
s = "",
|
||
u = "0";
|
||
if (a < 0 || 20 < a) throw RangeError(f);
|
||
if (o != o) return "NaN";
|
||
if (o <= -1e21 || 1e21 <= o) return String(o);
|
||
if (o < 0 && (s = "-", o = -o), 1e-21 < o)
|
||
if (r = (e = function(t) {
|
||
for (var e = 0, r = t; 4096 <= r;) e += 12, r /= 4096;
|
||
for (; 2 <= r;) e += 1, r /= 2;
|
||
return e
|
||
}(o * v(2, 69, 1)) - 69) < 0 ? o * v(2, -e, 1) : o / v(2, e, 1), r *= 4503599627370496, 0 < (e = 52 - e)) {
|
||
for (d(0, r), n = a; 7 <= n;) d(1e7, 0), n -= 7;
|
||
for (d(v(10, n, 1), 0), n = e - 1; 23 <= n;) p(1 << 23), n -= 23;
|
||
p(1 << n), d(1, 1), p(2), u = m()
|
||
} else d(0, r), d(1 << -e, 0), u = m() + l.call("0", a);
|
||
return u = 0 < a ? s + ((i = u.length) <= a ? "0." + l.call("0", a - i) + u : u.slice(0, i - a) + "." + u.slice(i - a)) : s + u
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(10),
|
||
o = r(145),
|
||
a = 1..toPrecision;
|
||
n(n.P + n.F * (i(function() {
|
||
return "1" !== a.call(1, void 0)
|
||
}) || !i(function() {
|
||
a.call({})
|
||
})), "Number", {
|
||
toPrecision: function(t) {
|
||
var e = o(this, "Number#toPrecision: incorrect invocation!");
|
||
return void 0 === t ? a.call(e) : a.call(e, t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Number", {
|
||
EPSILON: Math.pow(2, -52)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(9).isFinite;
|
||
n(n.S, "Number", {
|
||
isFinite: function(t) {
|
||
return "number" == typeof t && i(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Number", {
|
||
isInteger: r(146)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Number", {
|
||
isNaN: function(t) {
|
||
return t != t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(146),
|
||
o = Math.abs;
|
||
n(n.S, "Number", {
|
||
isSafeInteger: function(t) {
|
||
return i(t) && o(t) <= 9007199254740991
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Number", {
|
||
MAX_SAFE_INTEGER: 9007199254740991
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Number", {
|
||
MIN_SAFE_INTEGER: -9007199254740991
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(144);
|
||
n(n.S + n.F * (Number.parseFloat != i), "Number", {
|
||
parseFloat: i
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(143);
|
||
n(n.S + n.F * (Number.parseInt != i), "Number", {
|
||
parseInt: i
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(147),
|
||
o = Math.sqrt,
|
||
a = Math.acosh;
|
||
n(n.S + n.F * !(a && 710 == Math.floor(a(Number.MAX_VALUE)) && a(1 / 0) == 1 / 0), "Math", {
|
||
acosh: function(t) {
|
||
return (t = +t) < 1 ? NaN : 94906265.62425156 < t ? Math.log(t) + Math.LN2 : i(t - 1 + o(t - 1) * o(t + 1))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = Math.asinh;
|
||
n(n.S + n.F * !(i && 0 < 1 / i(0)), "Math", {
|
||
asinh: function asinh(t) {
|
||
return isFinite(t = +t) && 0 != t ? t < 0 ? -asinh(-t) : Math.log(t + Math.sqrt(t * t + 1)) : t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = Math.atanh;
|
||
n(n.S + n.F * !(i && 1 / i(-0) < 0), "Math", {
|
||
atanh: function(t) {
|
||
return 0 == (t = +t) ? t : Math.log((1 + t) / (1 - t)) / 2
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(107);
|
||
n(n.S, "Math", {
|
||
cbrt: function(t) {
|
||
return i(t = +t) * Math.pow(Math.abs(t), 1 / 3)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
clz32: function(t) {
|
||
return (t >>>= 0) ? 31 - Math.floor(Math.log(t + .5) * Math.LOG2E) : 32
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = Math.exp;
|
||
n(n.S, "Math", {
|
||
cosh: function(t) {
|
||
return (i(t = +t) + i(-t)) / 2
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(108);
|
||
n(n.S + n.F * (i != Math.expm1), "Math", {
|
||
expm1: i
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
fround: r(148)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
u = Math.abs;
|
||
n(n.S, "Math", {
|
||
hypot: function(t, e) {
|
||
for (var r, n, i = 0, o = 0, a = arguments.length, s = 0; o < a;) s < (r = u(arguments[o++])) ? (i = i * (n = s / r) * n + 1, s = r) : i += 0 < r ? (n = r / s) * n : r;
|
||
return s === 1 / 0 ? 1 / 0 : s * Math.sqrt(i)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = Math.imul;
|
||
n(n.S + n.F * r(10)(function() {
|
||
return -5 != i(4294967295, 5) || 2 != i.length
|
||
}), "Math", {
|
||
imul: function(t, e) {
|
||
var r = +t,
|
||
n = +e,
|
||
i = 65535 & r,
|
||
o = 65535 & n;
|
||
return 0 | i * o + ((65535 & r >>> 16) * o + i * (65535 & n >>> 16) << 16 >>> 0)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
log10: function(t) {
|
||
return Math.log(t) * Math.LOG10E
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
log1p: r(147)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
log2: function(t) {
|
||
return Math.log(t) / Math.LN2
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
sign: r(107)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(108),
|
||
o = Math.exp;
|
||
n(n.S + n.F * r(10)(function() {
|
||
return -2e-17 != !Math.sinh(-2e-17)
|
||
}), "Math", {
|
||
sinh: function(t) {
|
||
return Math.abs(t = +t) < 1 ? (i(t) - i(-t)) / 2 : (o(t - 1) - o(-t - 1)) * (Math.E / 2)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(108),
|
||
o = Math.exp;
|
||
n(n.S, "Math", {
|
||
tanh: function(t) {
|
||
var e = i(t = +t),
|
||
r = i(-t);
|
||
return e == 1 / 0 ? 1 : r == 1 / 0 ? -1 : (e - r) / (o(t) + o(-t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
trunc: function(t) {
|
||
return (0 < t ? Math.floor : Math.ceil)(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
o = r(54),
|
||
a = String.fromCharCode,
|
||
i = String.fromCodePoint;
|
||
n(n.S + n.F * (!!i && 1 != i.length), "String", {
|
||
fromCodePoint: function(t) {
|
||
for (var e, r = [], n = arguments.length, i = 0; i < n;) {
|
||
if (e = +arguments[i++], o(e, 1114111) !== e) throw RangeError(e + " is not a valid code point");
|
||
r.push(e < 65536 ? a(e) : a(55296 + ((e -= 65536) >> 10), e % 1024 + 56320))
|
||
}
|
||
return r.join("")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
a = r(29),
|
||
s = r(17);
|
||
n(n.S, "String", {
|
||
raw: function(t) {
|
||
for (var e = a(t.raw), r = s(e.length), n = arguments.length, i = [], o = 0; o < r;) i.push(String(e[o++])), o < n && i.push(String(arguments[o]));
|
||
return i.join("")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(63)("trim", function(t) {
|
||
return function() {
|
||
return t(this, 3)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(78)(!0);
|
||
r(109)(String, "String", function(t) {
|
||
this._t = String(t), this._i = 0
|
||
}, function() {
|
||
var t, e = this._t,
|
||
r = this._i;
|
||
return r >= e.length ? {
|
||
value: void 0,
|
||
done: !0
|
||
} : (t = n(e, r), this._i += t.length, {
|
||
value: t,
|
||
done: !1
|
||
})
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(78)(!1);
|
||
n(n.P, "String", {
|
||
codePointAt: function(t) {
|
||
return i(this, t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
a = r(17),
|
||
s = r(111),
|
||
u = "endsWith",
|
||
h = "" [u];
|
||
n(n.P + n.F * r(112)(u), "String", {
|
||
endsWith: function(t) {
|
||
var e = s(this, t, u),
|
||
r = 1 < arguments.length ? arguments[1] : void 0,
|
||
n = a(e.length),
|
||
i = void 0 === r ? n : Math.min(a(r), n),
|
||
o = String(t);
|
||
return h ? h.call(e, o, i) : e.slice(i - o.length, i) === o
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(111);
|
||
n(n.P + n.F * r(112)("includes"), "String", {
|
||
includes: function(t) {
|
||
return !!~i(this, t, "includes").indexOf(t, 1 < arguments.length ? arguments[1] : void 0)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.P, "String", {
|
||
repeat: r(106)
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(17),
|
||
o = r(111),
|
||
a = "startsWith",
|
||
s = "" [a];
|
||
n(n.P + n.F * r(112)(a), "String", {
|
||
startsWith: function(t) {
|
||
var e = o(this, t, a),
|
||
r = i(Math.min(1 < arguments.length ? arguments[1] : void 0, e.length)),
|
||
n = String(t);
|
||
return s ? s.call(e, n, r) : e.slice(r, r + n.length) === n
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("anchor", function(e) {
|
||
return function(t) {
|
||
return e(this, "a", "name", t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("big", function(t) {
|
||
return function() {
|
||
return t(this, "big", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("blink", function(t) {
|
||
return function() {
|
||
return t(this, "blink", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("bold", function(t) {
|
||
return function() {
|
||
return t(this, "b", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("fixed", function(t) {
|
||
return function() {
|
||
return t(this, "tt", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("fontcolor", function(e) {
|
||
return function(t) {
|
||
return e(this, "font", "color", t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("fontsize", function(e) {
|
||
return function(t) {
|
||
return e(this, "font", "size", t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("italics", function(t) {
|
||
return function() {
|
||
return t(this, "i", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("link", function(e) {
|
||
return function(t) {
|
||
return e(this, "a", "href", t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("small", function(t) {
|
||
return function() {
|
||
return t(this, "small", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("strike", function(t) {
|
||
return function() {
|
||
return t(this, "strike", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("sub", function(t) {
|
||
return function() {
|
||
return t(this, "sub", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(27)("sup", function(t) {
|
||
return function() {
|
||
return t(this, "sup", "", "")
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Date", {
|
||
now: function() {
|
||
return (new Date).getTime()
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(22),
|
||
o = r(38);
|
||
n(n.P + n.F * r(10)(function() {
|
||
return null !== new Date(NaN).toJSON() || 1 !== Date.prototype.toJSON.call({
|
||
toISOString: function() {
|
||
return 1
|
||
}
|
||
})
|
||
}), "Date", {
|
||
toJSON: function(t) {
|
||
var e = i(this),
|
||
r = o(e);
|
||
return "number" != typeof r || isFinite(r) ? e.toISOString() : null
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(280);
|
||
n(n.P + n.F * (Date.prototype.toISOString !== i), "Date", {
|
||
toISOString: i
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(10),
|
||
i = Date.prototype.getTime,
|
||
o = Date.prototype.toISOString,
|
||
a = function(t) {
|
||
return 9 < t ? t : "0" + t
|
||
};
|
||
t.exports = n(function() {
|
||
return "0385-07-25T07:06:39.999Z" != o.call(new Date(-5e13 - 1))
|
||
}) || !n(function() {
|
||
o.call(new Date(NaN))
|
||
}) ? function() {
|
||
if (!isFinite(i.call(this))) throw RangeError("Invalid time value");
|
||
var t = this.getUTCFullYear(),
|
||
e = this.getUTCMilliseconds(),
|
||
r = t < 0 ? "-" : 9999 < t ? "+" : "";
|
||
return r + ("00000" + Math.abs(t)).slice(r ? -6 : -4) + "-" + a(this.getUTCMonth() + 1) + "-" + a(this.getUTCDate()) + "T" + a(this.getUTCHours()) + ":" + a(this.getUTCMinutes()) + ":" + a(this.getUTCSeconds()) + "." + (99 < e ? e : "0" + a(e)) + "Z"
|
||
} : o
|
||
}, function(t, e, r) {
|
||
var n = Date.prototype,
|
||
i = "Invalid Date",
|
||
o = n.toString,
|
||
a = n.getTime;
|
||
new Date(NaN) + "" != i && r(26)(n, "toString", function() {
|
||
var t = a.call(this);
|
||
return t == t ? o.call(this) : i
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(15)("toPrimitive"),
|
||
i = Date.prototype;
|
||
n in i || r(25)(i, n, r(283))
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(6),
|
||
i = r(38);
|
||
t.exports = function(t) {
|
||
if ("string" !== t && "number" !== t && "default" !== t) throw TypeError("Incorrect hint");
|
||
return i(n(this), "number" != t)
|
||
}
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Array", {
|
||
isArray: r(77)
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var f = r(33),
|
||
n = r(1),
|
||
d = r(22),
|
||
p = r(149),
|
||
m = r(113),
|
||
v = r(17),
|
||
g = r(114),
|
||
y = r(115);
|
||
n(n.S + n.F * !r(80)(function(t) {
|
||
Array.from(t)
|
||
}), "Array", {
|
||
from: function(t) {
|
||
var e, r, n, i, o = d(t),
|
||
a = "function" == typeof this ? this : Array,
|
||
s = arguments.length,
|
||
u = 1 < s ? arguments[1] : void 0,
|
||
h = void 0 !== u,
|
||
c = 0,
|
||
l = y(o);
|
||
if (h && (u = f(u, 2 < s ? arguments[2] : void 0, 2)), null == l || a == Array && m(l))
|
||
for (r = new a(e = v(o.length)); c < e; c++) g(r, c, h ? u(o[c], c) : o[c]);
|
||
else
|
||
for (i = l.call(o), r = new a; !(n = i.next()).done; c++) g(r, c, h ? p(i, u, [n.value, c], !0) : n.value);
|
||
return r.length = c, r
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(114);
|
||
n(n.S + n.F * r(10)(function() {
|
||
function F() {}
|
||
return !(Array.of.call(F) instanceof F)
|
||
}), "Array", { of: function() {
|
||
for (var t = 0, e = arguments.length, r = new("function" == typeof this ? this : Array)(e); t < e;) i(r, t, arguments[t++]);
|
||
return r.length = e, r
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(29),
|
||
o = [].join;
|
||
n(n.P + n.F * (r(69) != Object || !r(36)(o)), "Array", {
|
||
join: function(t) {
|
||
return o.call(i(this), void 0 === t ? "," : t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(102),
|
||
h = r(34),
|
||
c = r(54),
|
||
l = r(17),
|
||
f = [].slice;
|
||
n(n.P + n.F * r(10)(function() {
|
||
i && f.call(i)
|
||
}), "Array", {
|
||
slice: function(t, e) {
|
||
var r = l(this.length),
|
||
n = h(this);
|
||
if (e = void 0 === e ? r : e, "Array" == n) return f.call(this, t, e);
|
||
for (var i = c(t, r), o = c(e, r), a = l(o - i), s = new Array(a), u = 0; u < a; u++) s[u] = "String" == n ? this.charAt(i + u) : this[i + u];
|
||
return s
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(24),
|
||
o = r(22),
|
||
a = r(10),
|
||
s = [].sort,
|
||
u = [1, 2, 3];
|
||
n(n.P + n.F * (a(function() {
|
||
u.sort(void 0)
|
||
}) || !a(function() {
|
||
u.sort(null)
|
||
}) || !r(36)(s)), "Array", {
|
||
sort: function(t) {
|
||
return void 0 === t ? s.call(o(this)) : s.call(o(this), i(t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(0),
|
||
o = r(36)([].forEach, !0);
|
||
n(n.P + n.F * !o, "Array", {
|
||
forEach: function(t) {
|
||
return i(this, t, arguments[1])
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(11),
|
||
i = r(77),
|
||
o = r(15)("species");
|
||
t.exports = function(t) {
|
||
var e;
|
||
return i(t) && ("function" != typeof(e = t.constructor) || e !== Array && !i(e.prototype) || (e = void 0), n(e) && null === (e = e[o]) && (e = void 0)), void 0 === e ? Array : e
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(1);
|
||
n(n.P + n.F * !r(36)([].map, !0), "Array", {
|
||
map: function(t) {
|
||
return i(this, t, arguments[1])
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(2);
|
||
n(n.P + n.F * !r(36)([].filter, !0), "Array", {
|
||
filter: function(t) {
|
||
return i(this, t, arguments[1])
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(3);
|
||
n(n.P + n.F * !r(36)([].some, !0), "Array", {
|
||
some: function(t) {
|
||
return i(this, t, arguments[1])
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(4);
|
||
n(n.P + n.F * !r(36)([].every, !0), "Array", {
|
||
every: function(t) {
|
||
return i(this, t, arguments[1])
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(150);
|
||
n(n.P + n.F * !r(36)([].reduce, !0), "Array", {
|
||
reduce: function(t) {
|
||
return i(this, t, arguments.length, arguments[1], !1)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(150);
|
||
n(n.P + n.F * !r(36)([].reduceRight, !0), "Array", {
|
||
reduceRight: function(t) {
|
||
return i(this, t, arguments.length, arguments[1], !0)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(75)(!1),
|
||
o = [].indexOf,
|
||
a = !!o && 1 / [1].indexOf(1, -0) < 0;
|
||
n(n.P + n.F * (a || !r(36)(o)), "Array", {
|
||
indexOf: function(t) {
|
||
return a ? o.apply(this, arguments) || 0 : i(this, t, arguments[1])
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(29),
|
||
o = r(35),
|
||
a = r(17),
|
||
s = [].lastIndexOf,
|
||
u = !!s && 1 / [1].lastIndexOf(1, -0) < 0;
|
||
n(n.P + n.F * (u || !r(36)(s)), "Array", {
|
||
lastIndexOf: function(t) {
|
||
if (u) return s.apply(this, arguments) || 0;
|
||
var e = i(this),
|
||
r = a(e.length),
|
||
n = r - 1;
|
||
for (1 < arguments.length && (n = Math.min(n, o(arguments[1]))), n < 0 && (n = r + n); 0 <= n; n--)
|
||
if (n in e && e[n] === t) return n || 0;
|
||
return -1
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.P, "Array", {
|
||
copyWithin: r(151)
|
||
}), r(50)("copyWithin")
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.P, "Array", {
|
||
fill: r(117)
|
||
}), r(50)("fill")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(5),
|
||
o = !0;
|
||
"find" in [] && Array(1).find(function() {
|
||
o = !1
|
||
}), n(n.P + n.F * o, "Array", {
|
||
find: function(t) {
|
||
return i(this, t, 1 < arguments.length ? arguments[1] : void 0)
|
||
}
|
||
}), r(50)("find")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(41)(6),
|
||
o = "findIndex",
|
||
a = !0;
|
||
o in [] && Array(1)[o](function() {
|
||
a = !1
|
||
}), n(n.P + n.F * a, "Array", {
|
||
findIndex: function(t) {
|
||
return i(this, t, 1 < arguments.length ? arguments[1] : void 0)
|
||
}
|
||
}), r(50)(o)
|
||
}, function(t, e, r) {
|
||
r(57)("Array")
|
||
}, function(t, e, r) {
|
||
var n = r(9),
|
||
o = r(105),
|
||
i = r(20).f,
|
||
a = r(56).f,
|
||
s = r(79),
|
||
u = r(71),
|
||
h = n.RegExp,
|
||
c = h,
|
||
l = h.prototype,
|
||
f = /a/g,
|
||
d = /a/g,
|
||
p = new h(f) !== f;
|
||
if (r(19) && (!p || r(10)(function() {
|
||
return d[r(15)("match")] = !1, h(f) != f || h(d) == d || "/a/i" != h(f, "i")
|
||
}))) {
|
||
h = function(t, e) {
|
||
var r = this instanceof h,
|
||
n = s(t),
|
||
i = void 0 === e;
|
||
return !r && n && t.constructor === h && i ? t : o(p ? new c(n && !i ? t.source : t, e) : c((n = t instanceof h) ? t.source : t, n && i ? u.call(t) : e), r ? this : l, h)
|
||
};
|
||
for (var m = function(e) {
|
||
e in h || i(h, e, {
|
||
configurable: !0,
|
||
get: function() {
|
||
return c[e]
|
||
},
|
||
set: function(t) {
|
||
c[e] = t
|
||
}
|
||
})
|
||
}, v = a(c), g = 0; v.length > g;) m(v[g++]);
|
||
(l.constructor = h).prototype = l, r(26)(n, "RegExp", h)
|
||
}
|
||
r(57)("RegExp")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(154);
|
||
var n = r(6),
|
||
i = r(71),
|
||
o = r(19),
|
||
a = "toString",
|
||
s = /./ [a],
|
||
u = function(t) {
|
||
r(26)(RegExp.prototype, a, t, !0)
|
||
};
|
||
r(10)(function() {
|
||
return "/a/b" != s.call({
|
||
source: "a",
|
||
flags: "b"
|
||
})
|
||
}) ? u(function() {
|
||
var t = n(this);
|
||
return "/".concat(t.source, "/", "flags" in t ? t.flags : !o && t instanceof RegExp ? i.call(t) : void 0)
|
||
}) : s.name != a && u(function() {
|
||
return s.call(this)
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var l = r(6),
|
||
f = r(17),
|
||
d = r(120),
|
||
p = r(81);
|
||
r(82)("match", 1, function(n, i, h, c) {
|
||
return [function(t) {
|
||
var e = n(this),
|
||
r = null == t ? void 0 : t[i];
|
||
return void 0 !== r ? r.call(t, e) : new RegExp(t)[i](String(e))
|
||
}, function(t) {
|
||
var e = c(h, t, this);
|
||
if (e.done) return e.value;
|
||
var r = l(t),
|
||
n = String(this);
|
||
if (!r.global) return p(r, n);
|
||
for (var i, o = r.unicode, a = [], s = r.lastIndex = 0; null !== (i = p(r, n));) {
|
||
var u = String(i[0]);
|
||
"" === (a[s] = u) && (r.lastIndex = d(n, f(r.lastIndex), o)), s++
|
||
}
|
||
return 0 === s ? null : a
|
||
}]
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var T = r(6),
|
||
n = r(22),
|
||
S = r(17),
|
||
M = r(35),
|
||
E = r(120),
|
||
A = r(81),
|
||
P = Math.max,
|
||
I = Math.min,
|
||
f = Math.floor,
|
||
d = /\$([$&`']|\d\d?|<[^>]*>)/g,
|
||
p = /\$([$&`']|\d\d?)/g;
|
||
r(82)("replace", 2, function(i, o, x, w) {
|
||
return [function(t, e) {
|
||
var r = i(this),
|
||
n = null == t ? void 0 : t[o];
|
||
return void 0 !== n ? n.call(t, r, e) : x.call(String(r), t, e)
|
||
}, function(t, e) {
|
||
var r = w(x, t, this, e);
|
||
if (r.done) return r.value;
|
||
var n = T(t),
|
||
i = String(this),
|
||
o = "function" == typeof e;
|
||
o || (e = String(e));
|
||
var a = n.global;
|
||
if (a) {
|
||
var s = n.unicode;
|
||
n.lastIndex = 0
|
||
}
|
||
for (var u = [];;) {
|
||
var h = A(n, i);
|
||
if (null === h) break;
|
||
if (u.push(h), !a) break;
|
||
"" === String(h[0]) && (n.lastIndex = E(i, S(n.lastIndex), s))
|
||
}
|
||
for (var c, l = "", f = 0, d = 0; d < u.length; d++) {
|
||
h = u[d];
|
||
for (var p = String(h[0]), m = P(I(M(h.index), i.length), 0), v = [], g = 1; g < h.length; g++) v.push(void 0 === (c = h[g]) ? c : String(c));
|
||
var y = h.groups;
|
||
if (o) {
|
||
var _ = [p].concat(v, m, i);
|
||
void 0 !== y && _.push(y);
|
||
var b = String(e.apply(void 0, _))
|
||
} else b = getSubstitution(p, i, m, v, y, e);
|
||
f <= m && (l += i.slice(f, m) + b, f = m + p.length)
|
||
}
|
||
return l + i.slice(f)
|
||
}];
|
||
|
||
function getSubstitution(o, a, s, u, h, t) {
|
||
var c = s + o.length,
|
||
l = u.length,
|
||
e = p;
|
||
return void 0 !== h && (h = n(h), e = d), x.call(t, e, function(t, e) {
|
||
var r;
|
||
switch (e.charAt(0)) {
|
||
case "$":
|
||
return "$";
|
||
case "&":
|
||
return o;
|
||
case "`":
|
||
return a.slice(0, s);
|
||
case "'":
|
||
return a.slice(c);
|
||
case "<":
|
||
r = h[e.slice(1, -1)];
|
||
break;
|
||
default:
|
||
var n = +e;
|
||
if (0 === n) return t;
|
||
if (l < n) {
|
||
var i = f(n / 10);
|
||
return 0 === i ? t : i <= l ? void 0 === u[i - 1] ? e.charAt(1) : u[i - 1] + e.charAt(1) : t
|
||
}
|
||
r = u[n - 1]
|
||
}
|
||
return void 0 === r ? "" : r
|
||
})
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var u = r(6),
|
||
h = r(140),
|
||
c = r(81);
|
||
r(82)("search", 1, function(n, i, a, s) {
|
||
return [function(t) {
|
||
var e = n(this),
|
||
r = null == t ? void 0 : t[i];
|
||
return void 0 !== r ? r.call(t, e) : new RegExp(t)[i](String(e))
|
||
}, function(t) {
|
||
var e = s(a, t, this);
|
||
if (e.done) return e.value;
|
||
var r = u(t),
|
||
n = String(this),
|
||
i = r.lastIndex;
|
||
h(i, 0) || (r.lastIndex = 0);
|
||
var o = c(r, n);
|
||
return h(r.lastIndex, i) || (r.lastIndex = i), null === o ? -1 : o.index
|
||
}]
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var l = r(79),
|
||
_ = r(6),
|
||
b = r(72),
|
||
x = r(120),
|
||
w = r(17),
|
||
T = r(81),
|
||
f = r(119),
|
||
n = r(10),
|
||
S = Math.min,
|
||
d = [].push,
|
||
a = "split",
|
||
p = "length",
|
||
m = "lastIndex",
|
||
M = 4294967295,
|
||
E = !n(function() {
|
||
RegExp(M, "y")
|
||
});
|
||
r(82)("split", 2, function(i, o, v, g) {
|
||
var y;
|
||
return y = "c" == "abbc" [a](/(b)*/)[1] || 4 != "test" [a](/(?:)/, -1)[p] || 2 != "ab" [a](/(?:ab)*/)[p] || 4 != "." [a](/(.?)(.?)/)[p] || 1 < "." [a](/()()/)[p] || "" [a](/.?/)[p] ? function(t, e) {
|
||
var r = String(this);
|
||
if (void 0 === t && 0 === e) return [];
|
||
if (!l(t)) return v.call(r, t, e);
|
||
for (var n, i, o, a = [], s = (t.ignoreCase ? "i" : "") + (t.multiline ? "m" : "") + (t.unicode ? "u" : "") + (t.sticky ? "y" : ""), u = 0, h = void 0 === e ? M : e >>> 0, c = new RegExp(t.source, s + "g");
|
||
(n = f.call(c, r)) && !(u < (i = c[m]) && (a.push(r.slice(u, n.index)), 1 < n[p] && n.index < r[p] && d.apply(a, n.slice(1)), o = n[0][p], u = i, a[p] >= h));) c[m] === n.index && c[m]++;
|
||
return u === r[p] ? !o && c.test("") || a.push("") : a.push(r.slice(u)), a[p] > h ? a.slice(0, h) : a
|
||
} : "0" [a](void 0, 0)[p] ? function(t, e) {
|
||
return void 0 === t && 0 === e ? [] : v.call(this, t, e)
|
||
} : v, [function(t, e) {
|
||
var r = i(this),
|
||
n = null == t ? void 0 : t[o];
|
||
return void 0 !== n ? n.call(t, r, e) : y.call(String(r), t, e)
|
||
}, function(t, e) {
|
||
var r = g(y, t, this, e, y !== v);
|
||
if (r.done) return r.value;
|
||
var n = _(t),
|
||
i = String(this),
|
||
o = b(n, RegExp),
|
||
a = n.unicode,
|
||
s = (n.ignoreCase ? "i" : "") + (n.multiline ? "m" : "") + (n.unicode ? "u" : "") + (E ? "y" : "g"),
|
||
u = new o(E ? n : "^(?:" + n.source + ")", s),
|
||
h = void 0 === e ? M : e >>> 0;
|
||
if (0 === h) return [];
|
||
if (0 === i.length) return null === T(u, i) ? [i] : [];
|
||
for (var c = 0, l = 0, f = []; l < i.length;) {
|
||
u.lastIndex = E ? l : 0;
|
||
var d, p = T(u, E ? i : i.slice(l));
|
||
if (null === p || (d = S(w(u.lastIndex + (E ? 0 : l)), i.length)) === c) l = x(i, l, a);
|
||
else {
|
||
if (f.push(i.slice(c, l)), f.length === h) return f;
|
||
for (var m = 1; m <= p.length - 1; m++)
|
||
if (f.push(p[m]), f.length === h) return f;
|
||
l = c = d
|
||
}
|
||
}
|
||
return f.push(i.slice(c)), f
|
||
}]
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n, i, o, a, s = r(49),
|
||
u = r(9),
|
||
h = r(33),
|
||
c = r(62),
|
||
l = r(1),
|
||
f = r(11),
|
||
d = r(24),
|
||
p = r(58),
|
||
m = r(59),
|
||
v = r(72),
|
||
g = r(121).set,
|
||
y = r(122)(),
|
||
_ = r(123),
|
||
b = r(155),
|
||
x = r(83),
|
||
w = r(156),
|
||
T = "Promise",
|
||
S = u.TypeError,
|
||
M = u.process,
|
||
E = M && M.versions,
|
||
A = E && E.v8 || "",
|
||
P = u[T],
|
||
I = "process" == c(M),
|
||
O = function() {},
|
||
C = i = _.f,
|
||
R = !! function() {
|
||
try {
|
||
var t = P.resolve(1),
|
||
e = (t.constructor = {})[r(15)("species")] = function(t) {
|
||
t(O, O)
|
||
};
|
||
return (I || "function" == typeof PromiseRejectionEvent) && t.then(O) instanceof e && 0 !== A.indexOf("6.6") && -1 === x.indexOf("Chrome/66")
|
||
} catch (t) {}
|
||
}(),
|
||
D = function(t) {
|
||
var e;
|
||
return !(!f(t) || "function" != typeof(e = t.then)) && e
|
||
},
|
||
F = function(c, r) {
|
||
if (!c._n) {
|
||
c._n = !0;
|
||
var n = c._c;
|
||
y(function() {
|
||
for (var u = c._v, h = 1 == c._s, t = 0, e = function(t) {
|
||
var e, r, n, i = h ? t.ok : t.fail,
|
||
o = t.resolve,
|
||
a = t.reject,
|
||
s = t.domain;
|
||
try {
|
||
i ? (h || (2 == c._h && N(c), c._h = 1), !0 === i ? e = u : (s && s.enter(), e = i(u), s && (s.exit(), n = !0)), e === t.promise ? a(S("Promise-chain cycle")) : (r = D(e)) ? r.call(e, o, a) : o(e)) : a(u)
|
||
} catch (t) {
|
||
s && !n && s.exit(), a(t)
|
||
}
|
||
}; n.length > t;) e(n[t++]);
|
||
c._c = [], c._n = !1, r && !c._h && k(c)
|
||
})
|
||
}
|
||
},
|
||
k = function(o) {
|
||
g.call(u, function() {
|
||
var t, e, r, n = o._v,
|
||
i = L(o);
|
||
if (i && (t = b(function() {
|
||
I ? M.emit("unhandledRejection", n, o) : (e = u.onunhandledrejection) ? e({
|
||
promise: o,
|
||
reason: n
|
||
}) : (r = u.console) && r.error && r.error("Unhandled promise rejection", n)
|
||
}), o._h = I || L(o) ? 2 : 1), o._a = void 0, i && t.e) throw t.v
|
||
})
|
||
},
|
||
L = function(t) {
|
||
return 1 !== t._h && 0 === (t._a || t._c).length
|
||
},
|
||
N = function(e) {
|
||
g.call(u, function() {
|
||
var t;
|
||
I ? M.emit("rejectionHandled", e) : (t = u.onrejectionhandled) && t({
|
||
promise: e,
|
||
reason: e._v
|
||
})
|
||
})
|
||
},
|
||
B = function(t) {
|
||
var e = this;
|
||
e._d || (e._d = !0, (e = e._w || e)._v = t, e._s = 2, e._a || (e._a = e._c.slice()), F(e, !0))
|
||
},
|
||
U = function(t) {
|
||
var r, n = this;
|
||
if (!n._d) {
|
||
n._d = !0, n = n._w || n;
|
||
try {
|
||
if (n === t) throw S("Promise can't be resolved itself");
|
||
(r = D(t)) ? y(function() {
|
||
var e = {
|
||
_w: n,
|
||
_d: !1
|
||
};
|
||
try {
|
||
r.call(t, h(U, e, 1), h(B, e, 1))
|
||
} catch (t) {
|
||
B.call(e, t)
|
||
}
|
||
}): (n._v = t, n._s = 1, F(n, !1))
|
||
} catch (t) {
|
||
B.call({
|
||
_w: n,
|
||
_d: !1
|
||
}, t)
|
||
}
|
||
}
|
||
};
|
||
R || (P = function(t) {
|
||
p(this, P, T, "_h"), d(t), n.call(this);
|
||
try {
|
||
t(h(U, this, 1), h(B, this, 1))
|
||
} catch (t) {
|
||
B.call(this, t)
|
||
}
|
||
}, (n = function(t) {
|
||
this._c = [], this._a = void 0, this._s = 0, this._d = !1, this._v = void 0, this._h = 0, this._n = !1
|
||
}).prototype = r(60)(P.prototype, {
|
||
then: function(t, e) {
|
||
var r = C(v(this, P));
|
||
return r.ok = "function" != typeof t || t, r.fail = "function" == typeof e && e, r.domain = I ? M.domain : void 0, this._c.push(r), this._a && this._a.push(r), this._s && F(this, !1), r.promise
|
||
},
|
||
catch: function(t) {
|
||
return this.then(void 0, t)
|
||
}
|
||
}), o = function() {
|
||
var t = new n;
|
||
this.promise = t, this.resolve = h(U, t, 1), this.reject = h(B, t, 1)
|
||
}, _.f = C = function(t) {
|
||
return t === P || t === a ? new o(t) : i(t)
|
||
}), l(l.G + l.W + l.F * !R, {
|
||
Promise: P
|
||
}), r(61)(P, T), r(57)(T), a = r(32)[T], l(l.S + l.F * !R, T, {
|
||
reject: function(t) {
|
||
var e = C(this);
|
||
return (0, e.reject)(t), e.promise
|
||
}
|
||
}), l(l.S + l.F * (s || !R), T, {
|
||
resolve: function(t) {
|
||
return w(s && this === a ? P : this, t)
|
||
}
|
||
}), l(l.S + l.F * !(R && r(80)(function(t) {
|
||
P.all(t).catch(O)
|
||
})), T, {
|
||
all: function(t) {
|
||
var a = this,
|
||
e = C(a),
|
||
s = e.resolve,
|
||
u = e.reject,
|
||
r = b(function() {
|
||
var n = [],
|
||
i = 0,
|
||
o = 1;
|
||
m(t, !1, function(t) {
|
||
var e = i++,
|
||
r = !1;
|
||
n.push(void 0), o++, a.resolve(t).then(function(t) {
|
||
r || (r = !0, n[e] = t, --o || s(n))
|
||
}, u)
|
||
}), --o || s(n)
|
||
});
|
||
return r.e && u(r.v), e.promise
|
||
},
|
||
race: function(t) {
|
||
var e = this,
|
||
r = C(e),
|
||
n = r.reject,
|
||
i = b(function() {
|
||
m(t, !1, function(t) {
|
||
e.resolve(t).then(r.resolve, n)
|
||
})
|
||
});
|
||
return i.e && n(i.v), r.promise
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(161),
|
||
i = r(65);
|
||
r(84)("WeakSet", function(t) {
|
||
return function() {
|
||
return t(this, 0 < arguments.length ? arguments[0] : void 0)
|
||
}
|
||
}, {
|
||
add: function(t) {
|
||
return n.def(i(this, "WeakSet"), t, !0)
|
||
}
|
||
}, n, !1, !0)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(85),
|
||
o = r(124),
|
||
h = r(6),
|
||
c = r(54),
|
||
l = r(17),
|
||
a = r(11),
|
||
s = r(9).ArrayBuffer,
|
||
f = r(72),
|
||
d = o.ArrayBuffer,
|
||
p = o.DataView,
|
||
u = i.ABV && s.isView,
|
||
m = d.prototype.slice,
|
||
v = i.VIEW,
|
||
g = "ArrayBuffer";
|
||
n(n.G + n.W + n.F * (s !== d), {
|
||
ArrayBuffer: d
|
||
}), n(n.S + n.F * !i.CONSTR, g, {
|
||
isView: function(t) {
|
||
return u && u(t) || a(t) && v in t
|
||
}
|
||
}), n(n.P + n.U + n.F * r(10)(function() {
|
||
return !new d(2).slice(1, void 0).byteLength
|
||
}), g, {
|
||
slice: function(t, e) {
|
||
if (void 0 !== m && void 0 === e) return m.call(h(this), t);
|
||
for (var r = h(this).byteLength, n = c(t, r), i = c(void 0 === e ? r : e, r), o = new(f(this, d))(l(i - n)), a = new p(this), s = new p(o), u = 0; n < i;) s.setUint8(u++, a.getUint8(n++));
|
||
return o
|
||
}
|
||
}), r(57)(g)
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.G + n.W + n.F * !r(85).ABV, {
|
||
DataView: r(124).DataView
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Int8", 1, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Uint8", 1, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Uint8", 1, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
}, !0)
|
||
}, function(t, e, r) {
|
||
r(43)("Int16", 2, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Uint16", 2, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Int32", 4, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Uint32", 4, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Float32", 4, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(43)("Float64", 8, function(n) {
|
||
return function(t, e, r) {
|
||
return n(this, t, e, r)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
o = r(24),
|
||
a = r(6),
|
||
s = (r(9).Reflect || {}).apply,
|
||
u = Function.apply;
|
||
n(n.S + n.F * !r(10)(function() {
|
||
s(function() {})
|
||
}), "Reflect", {
|
||
apply: function(t, e, r) {
|
||
var n = o(t),
|
||
i = a(r);
|
||
return s ? s(n, e, i) : u.call(n, e, i)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
s = r(55),
|
||
u = r(24),
|
||
h = r(6),
|
||
c = r(11),
|
||
i = r(10),
|
||
l = r(141),
|
||
f = (r(9).Reflect || {}).construct,
|
||
d = i(function() {
|
||
function F() {}
|
||
return !(f(function() {}, [], F) instanceof F)
|
||
}),
|
||
p = !i(function() {
|
||
f(function() {})
|
||
});
|
||
n(n.S + n.F * (d || p), "Reflect", {
|
||
construct: function(t, e) {
|
||
u(t), h(e);
|
||
var r = arguments.length < 3 ? t : u(arguments[2]);
|
||
if (p && !d) return f(t, e, r);
|
||
if (t == r) {
|
||
switch (e.length) {
|
||
case 0:
|
||
return new t;
|
||
case 1:
|
||
return new t(e[0]);
|
||
case 2:
|
||
return new t(e[0], e[1]);
|
||
case 3:
|
||
return new t(e[0], e[1], e[2]);
|
||
case 4:
|
||
return new t(e[0], e[1], e[2], e[3])
|
||
}
|
||
var n = [null];
|
||
return n.push.apply(n, e), new(l.apply(t, n))
|
||
}
|
||
var i = r.prototype,
|
||
o = s(c(i) ? i : Object.prototype),
|
||
a = Function.apply.call(t, o, e);
|
||
return c(a) ? a : o
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(20),
|
||
i = r(1),
|
||
o = r(6),
|
||
a = r(38);
|
||
i(i.S + i.F * r(10)(function() {
|
||
Reflect.defineProperty(n.f({}, 1, {
|
||
value: 1
|
||
}), 1, {
|
||
value: 2
|
||
})
|
||
}), "Reflect", {
|
||
defineProperty: function(t, e, r) {
|
||
o(t), e = a(e, !0), o(r);
|
||
try {
|
||
return n.f(t, e, r), !0
|
||
} catch (t) {
|
||
return !1
|
||
}
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(30).f,
|
||
o = r(6);
|
||
n(n.S, "Reflect", {
|
||
deleteProperty: function(t, e) {
|
||
var r = i(o(t), e);
|
||
return !(r && !r.configurable) && delete t[e]
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(6),
|
||
o = function(t) {
|
||
this._t = i(t), this._i = 0;
|
||
var e, r = this._k = [];
|
||
for (e in t) r.push(e)
|
||
};
|
||
r(110)(o, "Object", function() {
|
||
var t, e = this._k;
|
||
do {
|
||
if (this._i >= e.length) return {
|
||
value: void 0,
|
||
done: !0
|
||
}
|
||
} while (!((t = e[this._i++]) in this._t));
|
||
return {
|
||
value: t,
|
||
done: !1
|
||
}
|
||
}), n(n.S, "Reflect", {
|
||
enumerate: function(t) {
|
||
return new o(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var o = r(30),
|
||
a = r(31),
|
||
s = r(28),
|
||
n = r(1),
|
||
u = r(11),
|
||
h = r(6);
|
||
n(n.S, "Reflect", {
|
||
get: function get(t, e) {
|
||
var r, n, i = arguments.length < 3 ? t : arguments[2];
|
||
return h(t) === i ? t[e] : (r = o.f(t, e)) ? s(r, "value") ? r.value : void 0 !== r.get ? r.get.call(i) : void 0 : u(n = a(t)) ? get(n, e, i) : void 0
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(30),
|
||
i = r(1),
|
||
o = r(6);
|
||
i(i.S, "Reflect", {
|
||
getOwnPropertyDescriptor: function(t, e) {
|
||
return n.f(o(t), e)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(31),
|
||
o = r(6);
|
||
n(n.S, "Reflect", {
|
||
getPrototypeOf: function(t) {
|
||
return i(o(t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Reflect", {
|
||
has: function(t, e) {
|
||
return e in t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(6),
|
||
o = Object.isExtensible;
|
||
n(n.S, "Reflect", {
|
||
isExtensible: function(t) {
|
||
return i(t), !o || o(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Reflect", {
|
||
ownKeys: r(163)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(6),
|
||
o = Object.preventExtensions;
|
||
n(n.S, "Reflect", {
|
||
preventExtensions: function(t) {
|
||
i(t);
|
||
try {
|
||
return o && o(t), !0
|
||
} catch (t) {
|
||
return !1
|
||
}
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var s = r(20),
|
||
u = r(30),
|
||
h = r(31),
|
||
c = r(28),
|
||
n = r(1),
|
||
l = r(51),
|
||
f = r(6),
|
||
d = r(11);
|
||
n(n.S, "Reflect", {
|
||
set: function set(t, e, r) {
|
||
var n, i, o = arguments.length < 4 ? t : arguments[3],
|
||
a = u.f(f(t), e);
|
||
if (!a) {
|
||
if (d(i = h(t))) return set(i, e, r, o);
|
||
a = l(0)
|
||
}
|
||
if (c(a, "value")) {
|
||
if (!1 === a.writable || !d(o)) return !1;
|
||
if (n = u.f(o, e)) {
|
||
if (n.get || n.set || !1 === n.writable) return !1;
|
||
n.value = r, s.f(o, e, n)
|
||
} else s.f(o, e, l(0, r));
|
||
return !0
|
||
}
|
||
return void 0 !== a.set && (a.set.call(o, r), !0)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(103);
|
||
i && n(n.S, "Reflect", {
|
||
setPrototypeOf: function(t, e) {
|
||
i.check(t, e);
|
||
try {
|
||
return i.set(t, e), !0
|
||
} catch (t) {
|
||
return !1
|
||
}
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(75)(!0);
|
||
n(n.P, "Array", {
|
||
includes: function(t) {
|
||
return i(this, t, 1 < arguments.length ? arguments[1] : void 0)
|
||
}
|
||
}), r(50)("includes")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(164),
|
||
o = r(22),
|
||
a = r(17),
|
||
s = r(24),
|
||
u = r(116);
|
||
n(n.P, "Array", {
|
||
flatMap: function(t) {
|
||
var e, r, n = o(this);
|
||
return s(t), e = a(n.length), r = u(n, 0), i(r, n, n, e, 0, 1, t, arguments[1]), r
|
||
}
|
||
}), r(50)("flatMap")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(164),
|
||
o = r(22),
|
||
a = r(17),
|
||
s = r(35),
|
||
u = r(116);
|
||
n(n.P, "Array", {
|
||
flatten: function() {
|
||
var t = arguments[0],
|
||
e = o(this),
|
||
r = a(e.length),
|
||
n = u(e, 0);
|
||
return i(n, e, e, r, 0, void 0 === t ? 1 : s(t)), n
|
||
}
|
||
}), r(50)("flatten")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(78)(!0);
|
||
n(n.P, "String", {
|
||
at: function(t) {
|
||
return i(this, t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(165),
|
||
o = r(83);
|
||
n(n.P + n.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(o), "String", {
|
||
padStart: function(t) {
|
||
return i(this, t, 1 < arguments.length ? arguments[1] : void 0, !0)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(165),
|
||
o = r(83);
|
||
n(n.P + n.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(o), "String", {
|
||
padEnd: function(t) {
|
||
return i(this, t, 1 < arguments.length ? arguments[1] : void 0, !1)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(63)("trimLeft", function(t) {
|
||
return function() {
|
||
return t(this, 1)
|
||
}
|
||
}, "trimStart")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
r(63)("trimRight", function(t) {
|
||
return function() {
|
||
return t(this, 2)
|
||
}
|
||
}, "trimEnd")
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(39),
|
||
o = r(17),
|
||
a = r(79),
|
||
s = r(71),
|
||
u = RegExp.prototype,
|
||
h = function(t, e) {
|
||
this._r = t, this._s = e
|
||
};
|
||
r(110)(h, "RegExp String", function() {
|
||
var t = this._r.exec(this._s);
|
||
return {
|
||
value: t,
|
||
done: null === t
|
||
}
|
||
}), n(n.P, "String", {
|
||
matchAll: function(t) {
|
||
if (i(this), !a(t)) throw TypeError(t + " is not a regexp!");
|
||
var e = String(this),
|
||
r = "flags" in u ? String(t.flags) : s.call(t),
|
||
n = new RegExp(t.source, ~r.indexOf("g") ? r : "g" + r);
|
||
return n.lastIndex = o(t.lastIndex), new h(n, e)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
r(99)("asyncIterator")
|
||
}, function(t, e, r) {
|
||
r(99)("observable")
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
u = r(163),
|
||
h = r(29),
|
||
c = r(30),
|
||
l = r(114);
|
||
n(n.S, "Object", {
|
||
getOwnPropertyDescriptors: function(t) {
|
||
for (var e, r, n = h(t), i = c.f, o = u(n), a = {}, s = 0; o.length > s;) void 0 !== (r = i(n, e = o[s++])) && l(a, e, r);
|
||
return a
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(166)(!1);
|
||
n(n.S, "Object", {
|
||
values: function(t) {
|
||
return i(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(166)(!0);
|
||
n(n.S, "Object", {
|
||
entries: function(t) {
|
||
return i(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(22),
|
||
o = r(24),
|
||
a = r(20);
|
||
r(19) && n(n.P + r(86), "Object", {
|
||
__defineGetter__: function(t, e) {
|
||
a.f(i(this), t, {
|
||
get: o(e),
|
||
enumerable: !0,
|
||
configurable: !0
|
||
})
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(22),
|
||
o = r(24),
|
||
a = r(20);
|
||
r(19) && n(n.P + r(86), "Object", {
|
||
__defineSetter__: function(t, e) {
|
||
a.f(i(this), t, {
|
||
set: o(e),
|
||
enumerable: !0,
|
||
configurable: !0
|
||
})
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(22),
|
||
o = r(38),
|
||
a = r(31),
|
||
s = r(30).f;
|
||
r(19) && n(n.P + r(86), "Object", {
|
||
__lookupGetter__: function(t) {
|
||
var e, r = i(this),
|
||
n = o(t, !0);
|
||
do {
|
||
if (e = s(r, n)) return e.get
|
||
} while (r = a(r))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(22),
|
||
o = r(38),
|
||
a = r(31),
|
||
s = r(30).f;
|
||
r(19) && n(n.P + r(86), "Object", {
|
||
__lookupSetter__: function(t) {
|
||
var e, r = i(this),
|
||
n = o(t, !0);
|
||
do {
|
||
if (e = s(r, n)) return e.set
|
||
} while (r = a(r))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.P + n.R, "Map", {
|
||
toJSON: r(167)("Map")
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.P + n.R, "Set", {
|
||
toJSON: r(167)("Set")
|
||
})
|
||
}, function(t, e, r) {
|
||
r(87)("Map")
|
||
}, function(t, e, r) {
|
||
r(87)("Set")
|
||
}, function(t, e, r) {
|
||
r(87)("WeakMap")
|
||
}, function(t, e, r) {
|
||
r(87)("WeakSet")
|
||
}, function(t, e, r) {
|
||
r(88)("Map")
|
||
}, function(t, e, r) {
|
||
r(88)("Set")
|
||
}, function(t, e, r) {
|
||
r(88)("WeakMap")
|
||
}, function(t, e, r) {
|
||
r(88)("WeakSet")
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.G, {
|
||
global: r(9)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "System", {
|
||
global: r(9)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(34);
|
||
n(n.S, "Error", {
|
||
isError: function(t) {
|
||
return "Error" === i(t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
clamp: function(t, e, r) {
|
||
return Math.min(r, Math.max(e, t))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
DEG_PER_RAD: Math.PI / 180
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = 180 / Math.PI;
|
||
n(n.S, "Math", {
|
||
degrees: function(t) {
|
||
return t * i
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
o = r(169),
|
||
a = r(148);
|
||
n(n.S, "Math", {
|
||
fscale: function(t, e, r, n, i) {
|
||
return a(o(t, e, r, n, i))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
iaddh: function(t, e, r, n) {
|
||
var i = t >>> 0,
|
||
o = r >>> 0;
|
||
return (e >>> 0) + (n >>> 0) + ((i & o | (i | o) & ~(i + o >>> 0)) >>> 31) | 0
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
isubh: function(t, e, r, n) {
|
||
var i = t >>> 0,
|
||
o = r >>> 0;
|
||
return (e >>> 0) - (n >>> 0) - ((~i & o | ~(i ^ o) & i - o >>> 0) >>> 31) | 0
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
imulh: function(t, e) {
|
||
var r = +t,
|
||
n = +e,
|
||
i = 65535 & r,
|
||
o = 65535 & n,
|
||
a = r >> 16,
|
||
s = n >> 16,
|
||
u = (a * o >>> 0) + (i * o >>> 16);
|
||
return a * s + (u >> 16) + ((i * s >>> 0) + (65535 & u) >> 16)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
RAD_PER_DEG: 180 / Math.PI
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = Math.PI / 180;
|
||
n(n.S, "Math", {
|
||
radians: function(t) {
|
||
return t * i
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
scale: r(169)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
umulh: function(t, e) {
|
||
var r = +t,
|
||
n = +e,
|
||
i = 65535 & r,
|
||
o = 65535 & n,
|
||
a = r >>> 16,
|
||
s = n >>> 16,
|
||
u = (a * o >>> 0) + (i * o >>> 16);
|
||
return a * s + (u >>> 16) + ((i * s >>> 0) + (65535 & u) >>> 16)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1);
|
||
n(n.S, "Math", {
|
||
signbit: function(t) {
|
||
return (t = +t) != t ? t : 0 == t ? 1 / t == 1 / 0 : 0 < t
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(32),
|
||
o = r(9),
|
||
a = r(72),
|
||
s = r(156);
|
||
n(n.P + n.R, "Promise", {
|
||
finally: function(e) {
|
||
var r = a(this, i.Promise || o.Promise),
|
||
t = "function" == typeof e;
|
||
return this.then(t ? function(t) {
|
||
return s(r, e()).then(function() {
|
||
return t
|
||
})
|
||
} : e, t ? function(t) {
|
||
return s(r, e()).then(function() {
|
||
throw t
|
||
})
|
||
} : e)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
i = r(123),
|
||
o = r(155);
|
||
n(n.S, "Promise", {
|
||
try: function(t) {
|
||
var e = i.f(this),
|
||
r = o(t);
|
||
return (r.e ? e.reject : e.resolve)(r.v), e.promise
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = n.key,
|
||
a = n.set;
|
||
n.exp({
|
||
defineMetadata: function(t, e, r, n) {
|
||
a(t, e, i(r), o(n))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
o = r(6),
|
||
a = n.key,
|
||
s = n.map,
|
||
u = n.store;
|
||
n.exp({
|
||
deleteMetadata: function(t, e) {
|
||
var r = arguments.length < 3 ? void 0 : a(arguments[2]),
|
||
n = s(o(e), r, !1);
|
||
if (void 0 === n || !n.delete(t)) return !1;
|
||
if (n.size) return !0;
|
||
var i = u.get(e);
|
||
return i.delete(r), !!i.size || u.delete(e)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = r(31),
|
||
a = n.has,
|
||
s = n.get,
|
||
u = n.key,
|
||
h = function(t, e, r) {
|
||
if (a(t, e, r)) return s(t, e, r);
|
||
var n = o(e);
|
||
return null !== n ? h(t, n, r) : void 0
|
||
};
|
||
n.exp({
|
||
getMetadata: function(t, e) {
|
||
return h(t, i(e), arguments.length < 3 ? void 0 : u(arguments[2]))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var o = r(159),
|
||
a = r(168),
|
||
n = r(44),
|
||
i = r(6),
|
||
s = r(31),
|
||
u = n.keys,
|
||
h = n.key,
|
||
c = function(t, e) {
|
||
var r = u(t, e),
|
||
n = s(t);
|
||
if (null === n) return r;
|
||
var i = c(n, e);
|
||
return i.length ? r.length ? a(new o(r.concat(i))) : i : r
|
||
};
|
||
n.exp({
|
||
getMetadataKeys: function(t) {
|
||
return c(i(t), arguments.length < 2 ? void 0 : h(arguments[1]))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = n.get,
|
||
a = n.key;
|
||
n.exp({
|
||
getOwnMetadata: function(t, e) {
|
||
return o(t, i(e), arguments.length < 3 ? void 0 : a(arguments[2]))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = n.keys,
|
||
a = n.key;
|
||
n.exp({
|
||
getOwnMetadataKeys: function(t) {
|
||
return o(i(t), arguments.length < 2 ? void 0 : a(arguments[1]))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = r(31),
|
||
a = n.has,
|
||
s = n.key,
|
||
u = function(t, e, r) {
|
||
if (a(t, e, r)) return !0;
|
||
var n = o(e);
|
||
return null !== n && u(t, n, r)
|
||
};
|
||
n.exp({
|
||
hasMetadata: function(t, e) {
|
||
return u(t, i(e), arguments.length < 3 ? void 0 : s(arguments[2]))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = n.has,
|
||
a = n.key;
|
||
n.exp({
|
||
hasOwnMetadata: function(t, e) {
|
||
return o(t, i(e), arguments.length < 3 ? void 0 : a(arguments[2]))
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(44),
|
||
i = r(6),
|
||
o = r(24),
|
||
a = n.key,
|
||
s = n.set;
|
||
n.exp({
|
||
metadata: function(r, n) {
|
||
return function(t, e) {
|
||
s(r, n, (void 0 !== e ? i : o)(t), a(e))
|
||
}
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(122)(),
|
||
o = r(9).process,
|
||
a = "process" == r(34)(o);
|
||
n(n.G, {
|
||
asap: function(t) {
|
||
var e = a && o.domain;
|
||
i(e ? e.bind(t) : t)
|
||
}
|
||
})
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var n = r(1),
|
||
o = r(9),
|
||
a = r(32),
|
||
i = r(122)(),
|
||
s = r(15)("observable"),
|
||
u = r(24),
|
||
h = r(6),
|
||
c = r(58),
|
||
l = r(60),
|
||
f = r(25),
|
||
d = r(59),
|
||
p = d.RETURN,
|
||
m = function(t) {
|
||
return null == t ? void 0 : u(t)
|
||
},
|
||
v = function(t) {
|
||
var e = t._c;
|
||
e && (t._c = void 0, e())
|
||
},
|
||
g = function(t) {
|
||
return void 0 === t._o
|
||
},
|
||
y = function(t) {
|
||
g(t) || (t._o = void 0, v(t))
|
||
},
|
||
_ = function(e, t) {
|
||
h(e), this._c = void 0, this._o = e, e = new b(this);
|
||
try {
|
||
var r = t(e),
|
||
n = r;
|
||
null != r && ("function" == typeof r.unsubscribe ? r = function() {
|
||
n.unsubscribe()
|
||
} : u(r), this._c = r)
|
||
} catch (t) {
|
||
return void e.error(t)
|
||
}
|
||
g(this) && v(this)
|
||
};
|
||
_.prototype = l({}, {
|
||
unsubscribe: function() {
|
||
y(this)
|
||
}
|
||
});
|
||
var b = function(t) {
|
||
this._s = t
|
||
};
|
||
b.prototype = l({}, {
|
||
next: function(t) {
|
||
var e = this._s;
|
||
if (!g(e)) {
|
||
var r = e._o;
|
||
try {
|
||
var n = m(r.next);
|
||
if (n) return n.call(r, t)
|
||
} catch (t) {
|
||
try {
|
||
y(e)
|
||
} finally {
|
||
throw t
|
||
}
|
||
}
|
||
}
|
||
},
|
||
error: function(t) {
|
||
var e = this._s;
|
||
if (g(e)) throw t;
|
||
var r = e._o;
|
||
e._o = void 0;
|
||
try {
|
||
var n = m(r.error);
|
||
if (!n) throw t;
|
||
t = n.call(r, t)
|
||
} catch (t) {
|
||
try {
|
||
v(e)
|
||
} finally {
|
||
throw t
|
||
}
|
||
}
|
||
return v(e), t
|
||
},
|
||
complete: function(t) {
|
||
var e = this._s;
|
||
if (!g(e)) {
|
||
var r = e._o;
|
||
e._o = void 0;
|
||
try {
|
||
var n = m(r.complete);
|
||
t = n ? n.call(r, t) : void 0
|
||
} catch (t) {
|
||
try {
|
||
v(e)
|
||
} finally {
|
||
throw t
|
||
}
|
||
}
|
||
return v(e), t
|
||
}
|
||
}
|
||
});
|
||
var x = function(t) {
|
||
c(this, x, "Observable", "_f")._f = u(t)
|
||
};
|
||
l(x.prototype, {
|
||
subscribe: function(t) {
|
||
return new _(t, this._f)
|
||
},
|
||
forEach: function(n) {
|
||
var i = this;
|
||
return new(a.Promise || o.Promise)(function(t, e) {
|
||
u(n);
|
||
var r = i.subscribe({
|
||
next: function(t) {
|
||
try {
|
||
return n(t)
|
||
} catch (t) {
|
||
e(t), r.unsubscribe()
|
||
}
|
||
},
|
||
error: e,
|
||
complete: t
|
||
})
|
||
})
|
||
}
|
||
}), l(x, {
|
||
from: function(t) {
|
||
var e = "function" == typeof this ? this : x,
|
||
r = m(h(t)[s]);
|
||
if (r) {
|
||
var n = h(r.call(t));
|
||
return n.constructor === e ? n : new e(function(t) {
|
||
return n.subscribe(t)
|
||
})
|
||
}
|
||
return new e(function(e) {
|
||
var r = !1;
|
||
return i(function() {
|
||
if (!r) {
|
||
try {
|
||
if (d(t, !1, function(t) {
|
||
if (e.next(t), r) return p
|
||
}) === p) return
|
||
} catch (t) {
|
||
if (r) throw t;
|
||
return void e.error(t)
|
||
}
|
||
e.complete()
|
||
}
|
||
}),
|
||
function() {
|
||
r = !0
|
||
}
|
||
})
|
||
},
|
||
of: function() {
|
||
for (var t = 0, e = arguments.length, n = new Array(e); t < e;) n[t] = arguments[t++];
|
||
return new("function" == typeof this ? this : x)(function(e) {
|
||
var r = !1;
|
||
return i(function() {
|
||
if (!r) {
|
||
for (var t = 0; t < n.length; ++t)
|
||
if (e.next(n[t]), r) return;
|
||
e.complete()
|
||
}
|
||
}),
|
||
function() {
|
||
r = !0
|
||
}
|
||
})
|
||
}
|
||
}), f(x.prototype, s, function() {
|
||
return this
|
||
}), n(n.G, {
|
||
Observable: x
|
||
}), r(57)("Observable")
|
||
}, function(t, e, r) {
|
||
var n = r(9),
|
||
i = r(1),
|
||
o = r(83),
|
||
a = [].slice,
|
||
s = /MSIE .\./.test(o),
|
||
u = function(i) {
|
||
return function(t, e) {
|
||
var r = 2 < arguments.length,
|
||
n = !!r && a.call(arguments, 2);
|
||
return i(r ? function() {
|
||
("function" == typeof t ? t : Function(t)).apply(this, n)
|
||
} : t, e)
|
||
}
|
||
};
|
||
i(i.G + i.B + i.F * s, {
|
||
setTimeout: u(n.setTimeout),
|
||
setInterval: u(n.setInterval)
|
||
})
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(121);
|
||
n(n.G + n.B, {
|
||
setImmediate: i.set,
|
||
clearImmediate: i.clear
|
||
})
|
||
}, function(t, e, r) {
|
||
for (var n = r(118), i = r(53), o = r(26), a = r(9), s = r(25), u = r(64), h = r(15), c = h("iterator"), l = h("toStringTag"), f = u.Array, d = {
|
||
CSSRuleList: !0,
|
||
CSSStyleDeclaration: !1,
|
||
CSSValueList: !1,
|
||
ClientRectList: !1,
|
||
DOMRectList: !1,
|
||
DOMStringList: !1,
|
||
DOMTokenList: !0,
|
||
DataTransferItemList: !1,
|
||
FileList: !1,
|
||
HTMLAllCollection: !1,
|
||
HTMLCollection: !1,
|
||
HTMLFormElement: !1,
|
||
HTMLSelectElement: !1,
|
||
MediaList: !0,
|
||
MimeTypeArray: !1,
|
||
NamedNodeMap: !1,
|
||
NodeList: !0,
|
||
PaintRequestList: !1,
|
||
Plugin: !1,
|
||
PluginArray: !1,
|
||
SVGLengthList: !1,
|
||
SVGNumberList: !1,
|
||
SVGPathSegList: !1,
|
||
SVGPointList: !1,
|
||
SVGStringList: !1,
|
||
SVGTransformList: !1,
|
||
SourceBufferList: !1,
|
||
StyleSheetList: !0,
|
||
TextTrackCueList: !1,
|
||
TextTrackList: !1,
|
||
TouchList: !1
|
||
}, p = i(d), m = 0; m < p.length; m++) {
|
||
var v, g = p[m],
|
||
y = d[g],
|
||
_ = a[g],
|
||
b = _ && _.prototype;
|
||
if (b && (b[c] || s(b, c, f), b[l] || s(b, l, g), u[g] = f, y))
|
||
for (v in n) b[v] || o(b, v, n[v], !0)
|
||
}
|
||
}, function(_, t, e) {
|
||
(function(t) {
|
||
! function(e) {
|
||
"use strict";
|
||
var s, t = Object.prototype,
|
||
u = t.hasOwnProperty,
|
||
r = "function" == typeof Symbol ? Symbol : {},
|
||
i = r.iterator || "@@iterator",
|
||
n = r.asyncIterator || "@@asyncIterator",
|
||
o = r.toStringTag || "@@toStringTag",
|
||
a = "object" == typeof _,
|
||
h = e.regeneratorRuntime;
|
||
if (h) a && (_.exports = h);
|
||
else {
|
||
(h = e.regeneratorRuntime = a ? _.exports : {}).wrap = wrap;
|
||
var l = "suspendedStart",
|
||
f = "suspendedYield",
|
||
d = "executing",
|
||
p = "completed",
|
||
m = {},
|
||
c = {};
|
||
c[i] = function() {
|
||
return this
|
||
};
|
||
var v = Object.getPrototypeOf,
|
||
g = v && v(v(values([])));
|
||
g && g !== t && u.call(g, i) && (c = g);
|
||
var y = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
||
GeneratorFunction.prototype = y.constructor = GeneratorFunctionPrototype, GeneratorFunctionPrototype.constructor = GeneratorFunction, GeneratorFunctionPrototype[o] = GeneratorFunction.displayName = "GeneratorFunction", h.isGeneratorFunction = function(t) {
|
||
var e = "function" == typeof t && t.constructor;
|
||
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name))
|
||
}, h.mark = function(t) {
|
||
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, o in t || (t[o] = "GeneratorFunction")), t.prototype = Object.create(y), t
|
||
}, h.awrap = function(t) {
|
||
return {
|
||
__await: t
|
||
}
|
||
}, defineIteratorMethods(AsyncIterator.prototype), AsyncIterator.prototype[n] = function() {
|
||
return this
|
||
}, h.AsyncIterator = AsyncIterator, h.async = function(t, e, r, n) {
|
||
var i = new AsyncIterator(wrap(t, e, r, n));
|
||
return h.isGeneratorFunction(e) ? i : i.next().then(function(t) {
|
||
return t.done ? t.value : i.next()
|
||
})
|
||
}, defineIteratorMethods(y), y[o] = "Generator", y[i] = function() {
|
||
return this
|
||
}, y.toString = function() {
|
||
return "[object Generator]"
|
||
}, h.keys = function(e) {
|
||
var r = [];
|
||
for (var t in e) r.push(t);
|
||
return r.reverse(),
|
||
function next() {
|
||
for (; r.length;) {
|
||
var t = r.pop();
|
||
if (t in e) return next.value = t, next.done = !1, next
|
||
}
|
||
return next.done = !0, next
|
||
}
|
||
}, h.values = values, Context.prototype = {
|
||
constructor: Context,
|
||
reset: function(t) {
|
||
if (this.prev = 0, this.next = 0, this.sent = this._sent = s, this.done = !1, this.delegate = null, this.method = "next", this.arg = s, this.tryEntries.forEach(resetTryEntry), !t)
|
||
for (var e in this) "t" === e.charAt(0) && u.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = s)
|
||
},
|
||
stop: function() {
|
||
this.done = !0;
|
||
var t = this.tryEntries[0].completion;
|
||
if ("throw" === t.type) throw t.arg;
|
||
return this.rval
|
||
},
|
||
dispatchException: function(r) {
|
||
if (this.done) throw r;
|
||
var n = this;
|
||
|
||
function handle(t, e) {
|
||
return i.type = "throw", i.arg = r, n.next = t, e && (n.method = "next", n.arg = s), !!e
|
||
}
|
||
for (var t = this.tryEntries.length - 1; 0 <= t; --t) {
|
||
var e = this.tryEntries[t],
|
||
i = e.completion;
|
||
if ("root" === e.tryLoc) return handle("end");
|
||
if (e.tryLoc <= this.prev) {
|
||
var o = u.call(e, "catchLoc"),
|
||
a = u.call(e, "finallyLoc");
|
||
if (o && a) {
|
||
if (this.prev < e.catchLoc) return handle(e.catchLoc, !0);
|
||
if (this.prev < e.finallyLoc) return handle(e.finallyLoc)
|
||
} else if (o) {
|
||
if (this.prev < e.catchLoc) return handle(e.catchLoc, !0)
|
||
} else {
|
||
if (!a) throw new Error("try statement without catch or finally");
|
||
if (this.prev < e.finallyLoc) return handle(e.finallyLoc)
|
||
}
|
||
}
|
||
}
|
||
},
|
||
abrupt: function(t, e) {
|
||
for (var r = this.tryEntries.length - 1; 0 <= r; --r) {
|
||
var n = this.tryEntries[r];
|
||
if (n.tryLoc <= this.prev && u.call(n, "finallyLoc") && this.prev < n.finallyLoc) {
|
||
var i = n;
|
||
break
|
||
}
|
||
}
|
||
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
||
var o = i ? i.completion : {};
|
||
return o.type = t, o.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, m) : this.complete(o)
|
||
},
|
||
complete: function(t, e) {
|
||
if ("throw" === t.type) throw t.arg;
|
||
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), m
|
||
},
|
||
finish: function(t) {
|
||
for (var e = this.tryEntries.length - 1; 0 <= e; --e) {
|
||
var r = this.tryEntries[e];
|
||
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), m
|
||
}
|
||
},
|
||
catch: function(t) {
|
||
for (var e = this.tryEntries.length - 1; 0 <= e; --e) {
|
||
var r = this.tryEntries[e];
|
||
if (r.tryLoc === t) {
|
||
var n = r.completion;
|
||
if ("throw" === n.type) {
|
||
var i = n.arg;
|
||
resetTryEntry(r)
|
||
}
|
||
return i
|
||
}
|
||
}
|
||
throw new Error("illegal catch attempt")
|
||
},
|
||
delegateYield: function(t, e, r) {
|
||
return this.delegate = {
|
||
iterator: values(t),
|
||
resultName: e,
|
||
nextLoc: r
|
||
}, "next" === this.method && (this.arg = s), m
|
||
}
|
||
}
|
||
}
|
||
|
||
function wrap(t, e, r, n) {
|
||
var o, a, s, u, i = e && e.prototype instanceof Generator ? e : Generator,
|
||
h = Object.create(i.prototype),
|
||
c = new Context(n || []);
|
||
return h._invoke = (o = t, a = r, s = c, u = l, function(t, e) {
|
||
if (u === d) throw new Error("Generator is already running");
|
||
if (u === p) {
|
||
if ("throw" === t) throw e;
|
||
return doneResult()
|
||
}
|
||
for (s.method = t, s.arg = e;;) {
|
||
var r = s.delegate;
|
||
if (r) {
|
||
var n = maybeInvokeDelegate(r, s);
|
||
if (n) {
|
||
if (n === m) continue;
|
||
return n
|
||
}
|
||
}
|
||
if ("next" === s.method) s.sent = s._sent = s.arg;
|
||
else if ("throw" === s.method) {
|
||
if (u === l) throw u = p, s.arg;
|
||
s.dispatchException(s.arg)
|
||
} else "return" === s.method && s.abrupt("return", s.arg);
|
||
u = d;
|
||
var i = tryCatch(o, a, s);
|
||
if ("normal" === i.type) {
|
||
if (u = s.done ? p : f, i.arg === m) continue;
|
||
return {
|
||
value: i.arg,
|
||
done: s.done
|
||
}
|
||
}
|
||
"throw" === i.type && (u = p, s.method = "throw", s.arg = i.arg)
|
||
}
|
||
}), h
|
||
}
|
||
|
||
function tryCatch(t, e, r) {
|
||
try {
|
||
return {
|
||
type: "normal",
|
||
arg: t.call(e, r)
|
||
}
|
||
} catch (t) {
|
||
return {
|
||
type: "throw",
|
||
arg: t
|
||
}
|
||
}
|
||
}
|
||
|
||
function Generator() {}
|
||
|
||
function GeneratorFunction() {}
|
||
|
||
function GeneratorFunctionPrototype() {}
|
||
|
||
function defineIteratorMethods(t) {
|
||
["next", "throw", "return"].forEach(function(e) {
|
||
t[e] = function(t) {
|
||
return this._invoke(e, t)
|
||
}
|
||
})
|
||
}
|
||
|
||
function AsyncIterator(s) {
|
||
function invoke(t, e, r, n) {
|
||
var i = tryCatch(s[t], s, e);
|
||
if ("throw" !== i.type) {
|
||
var o = i.arg,
|
||
a = o.value;
|
||
return a && "object" == typeof a && u.call(a, "__await") ? Promise.resolve(a.__await).then(function(t) {
|
||
invoke("next", t, r, n)
|
||
}, function(t) {
|
||
invoke("throw", t, r, n)
|
||
}) : Promise.resolve(a).then(function(t) {
|
||
o.value = t, r(o)
|
||
}, n)
|
||
}
|
||
n(i.arg)
|
||
}
|
||
var t;
|
||
"object" == typeof e.process && e.process.domain && (invoke = e.process.domain.bind(invoke)), this._invoke = function(r, n) {
|
||
function callInvokeWithMethodAndArg() {
|
||
return new Promise(function(t, e) {
|
||
invoke(r, n, t, e)
|
||
})
|
||
}
|
||
return t = t ? t.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg()
|
||
}
|
||
}
|
||
|
||
function maybeInvokeDelegate(t, e) {
|
||
var r = t.iterator[e.method];
|
||
if (r === s) {
|
||
if (e.delegate = null, "throw" === e.method) {
|
||
if (t.iterator.return && (e.method = "return", e.arg = s, maybeInvokeDelegate(t, e), "throw" === e.method)) return m;
|
||
e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method")
|
||
}
|
||
return m
|
||
}
|
||
var n = tryCatch(r, t.iterator, e.arg);
|
||
if ("throw" === n.type) return e.method = "throw", e.arg = n.arg, e.delegate = null, m;
|
||
var i = n.arg;
|
||
return i ? i.done ? (e[t.resultName] = i.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next", e.arg = s), e.delegate = null, m) : i : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, m)
|
||
}
|
||
|
||
function pushTryEntry(t) {
|
||
var e = {
|
||
tryLoc: t[0]
|
||
};
|
||
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e)
|
||
}
|
||
|
||
function resetTryEntry(t) {
|
||
var e = t.completion || {};
|
||
e.type = "normal", delete e.arg, t.completion = e
|
||
}
|
||
|
||
function Context(t) {
|
||
this.tryEntries = [{
|
||
tryLoc: "root"
|
||
}], t.forEach(pushTryEntry, this), this.reset(!0)
|
||
}
|
||
|
||
function values(t) {
|
||
if (t) {
|
||
var e = t[i];
|
||
if (e) return e.call(t);
|
||
if ("function" == typeof t.next) return t;
|
||
if (!isNaN(t.length)) {
|
||
var r = -1,
|
||
n = function next() {
|
||
for (; ++r < t.length;)
|
||
if (u.call(t, r)) return next.value = t[r], next.done = !1, next;
|
||
return next.value = s, next.done = !0, next
|
||
};
|
||
return n.next = n
|
||
}
|
||
}
|
||
return {
|
||
next: doneResult
|
||
}
|
||
}
|
||
|
||
function doneResult() {
|
||
return {
|
||
value: s,
|
||
done: !0
|
||
}
|
||
}
|
||
}("object" == typeof t ? t : "object" == typeof window ? window : "object" == typeof self ? self : this)
|
||
}).call(this, e(42))
|
||
}, function(t, e, r) {
|
||
r(399), t.exports = r(32).RegExp.escape
|
||
}, function(t, e, r) {
|
||
var n = r(1),
|
||
i = r(400)(/[\\^$*+?.()|[\]{}]/g, "\\$&");
|
||
n(n.S, "RegExp", {
|
||
escape: function(t) {
|
||
return i(t)
|
||
}
|
||
})
|
||
}, function(t, e) {
|
||
t.exports = function(e, r) {
|
||
var n = r === Object(r) ? function(t) {
|
||
return r[t]
|
||
} : r;
|
||
return function(t) {
|
||
return String(t).replace(e, n)
|
||
}
|
||
}
|
||
}, function(t, e, c) {
|
||
"use strict";
|
||
(function(t) {
|
||
var e = c(180),
|
||
r = c(181),
|
||
n = c.n(r);
|
||
window.Promise || (window.Promise = e.Polyfill), Object.assign || (Object.assign = n.a);
|
||
var i = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {};
|
||
if (Date.now && Date.prototype.getTime || (Date.now = function() {
|
||
return (new Date).getTime()
|
||
}), !i.performance || !i.performance.now) {
|
||
var o = Date.now();
|
||
i.performance || (i.performance = {}), i.performance.now = function() {
|
||
return Date.now() - o
|
||
}
|
||
}
|
||
for (var a = Date.now(), s = ["ms", "moz", "webkit", "o"], u = 0; u < s.length && !i.requestAnimationFrame; ++u) {
|
||
var h = s[u];
|
||
i.requestAnimationFrame = i[h + "RequestAnimationFrame"], i.cancelAnimationFrame = i[h + "CancelAnimationFrame"] || i[h + "CancelRequestAnimationFrame"]
|
||
}
|
||
i.requestAnimationFrame || (i.requestAnimationFrame = function(t) {
|
||
if ("function" != typeof t) throw new TypeError(t + "is not a function");
|
||
var e = Date.now(),
|
||
r = 16 + a - e;
|
||
return r < 0 && (r = 0), a = e, setTimeout(function() {
|
||
a = Date.now(), t(performance.now())
|
||
}, r)
|
||
}), i.cancelAnimationFrame || (i.cancelAnimationFrame = function(t) {
|
||
return clearTimeout(t)
|
||
}), Math.sign || (Math.sign = function(t) {
|
||
return 0 === (t = Number(t)) || isNaN(t) ? t : 0 < t ? 1 : -1
|
||
}), Number.isInteger || (Number.isInteger = function(t) {
|
||
return "number" == typeof t && isFinite(t) && Math.floor(t) === t
|
||
}), window.ArrayBuffer || (window.ArrayBuffer = Array), window.Float32Array || (window.Float32Array = Array), window.Uint32Array || (window.Uint32Array = Array), window.Uint16Array || (window.Uint16Array = Array), window.Uint8Array || (window.Uint8Array = Array), window.Int32Array || (window.Int32Array = Array)
|
||
}).call(this, c(42))
|
||
}, function(t, n, i) {
|
||
(function(t) {
|
||
var e = void 0 !== t && t || "undefined" != typeof self && self || window,
|
||
r = Function.prototype.apply;
|
||
|
||
function Timeout(t, e) {
|
||
this._id = t, this._clearFn = e
|
||
}
|
||
n.setTimeout = function() {
|
||
return new Timeout(r.call(setTimeout, e, arguments), clearTimeout)
|
||
}, n.setInterval = function() {
|
||
return new Timeout(r.call(setInterval, e, arguments), clearInterval)
|
||
}, n.clearTimeout = n.clearInterval = function(t) {
|
||
t && t.close()
|
||
}, Timeout.prototype.unref = Timeout.prototype.ref = function() {}, Timeout.prototype.close = function() {
|
||
this._clearFn.call(e, this._id)
|
||
}, n.enroll = function(t, e) {
|
||
clearTimeout(t._idleTimeoutId), t._idleTimeout = e
|
||
}, n.unenroll = function(t) {
|
||
clearTimeout(t._idleTimeoutId), t._idleTimeout = -1
|
||
}, n._unrefActive = n.active = function(t) {
|
||
clearTimeout(t._idleTimeoutId);
|
||
var e = t._idleTimeout;
|
||
0 <= e && (t._idleTimeoutId = setTimeout(function() {
|
||
t._onTimeout && t._onTimeout()
|
||
}, e))
|
||
}, i(403), n.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== t && t.setImmediate || this && this.setImmediate, n.clearImmediate = "undefined" != typeof self && self.clearImmediate || void 0 !== t && t.clearImmediate || this && this.clearImmediate
|
||
}).call(this, i(42))
|
||
}, function(t, e, r) {
|
||
(function(t, f) {
|
||
! function(r, n) {
|
||
"use strict";
|
||
if (!r.setImmediate) {
|
||
var i, o, e, a, t, s = 1,
|
||
u = {},
|
||
h = !1,
|
||
c = r.document,
|
||
l = Object.getPrototypeOf && Object.getPrototypeOf(r);
|
||
l = l && l.setTimeout ? l : r, i = "[object process]" === {}.toString.call(r.process) ? function(t) {
|
||
f.nextTick(function() {
|
||
runIfPresent(t)
|
||
})
|
||
} : function() {
|
||
if (r.postMessage && !r.importScripts) {
|
||
var t = !0,
|
||
e = r.onmessage;
|
||
return r.onmessage = function() {
|
||
t = !1
|
||
}, r.postMessage("", "*"), r.onmessage = e, t
|
||
}
|
||
}() ? (a = "setImmediate$" + Math.random() + "$", t = function(t) {
|
||
t.source === r && "string" == typeof t.data && 0 === t.data.indexOf(a) && runIfPresent(+t.data.slice(a.length))
|
||
}, r.addEventListener ? r.addEventListener("message", t, !1) : r.attachEvent("onmessage", t), function(t) {
|
||
r.postMessage(a + t, "*")
|
||
}) : r.MessageChannel ? ((e = new MessageChannel).port1.onmessage = function(t) {
|
||
runIfPresent(t.data)
|
||
}, function(t) {
|
||
e.port2.postMessage(t)
|
||
}) : c && "onreadystatechange" in c.createElement("script") ? (o = c.documentElement, function(t) {
|
||
var e = c.createElement("script");
|
||
e.onreadystatechange = function() {
|
||
runIfPresent(t), e.onreadystatechange = null, o.removeChild(e), e = null
|
||
}, o.appendChild(e)
|
||
}) : function(t) {
|
||
setTimeout(runIfPresent, 0, t)
|
||
}, l.setImmediate = function(t) {
|
||
"function" != typeof t && (t = new Function("" + t));
|
||
for (var e = new Array(arguments.length - 1), r = 0; r < e.length; r++) e[r] = arguments[r + 1];
|
||
var n = {
|
||
callback: t,
|
||
args: e
|
||
};
|
||
return u[s] = n, i(s), s++
|
||
}, l.clearImmediate = clearImmediate
|
||
}
|
||
|
||
function clearImmediate(t) {
|
||
delete u[t]
|
||
}
|
||
|
||
function runIfPresent(t) {
|
||
if (h) setTimeout(runIfPresent, 0, t);
|
||
else {
|
||
var e = u[t];
|
||
if (e) {
|
||
h = !0;
|
||
try {
|
||
! function(t) {
|
||
var e = t.callback,
|
||
r = t.args;
|
||
switch (r.length) {
|
||
case 0:
|
||
e();
|
||
break;
|
||
case 1:
|
||
e(r[0]);
|
||
break;
|
||
case 2:
|
||
e(r[0], r[1]);
|
||
break;
|
||
case 3:
|
||
e(r[0], r[1], r[2]);
|
||
break;
|
||
default:
|
||
e.apply(n, r)
|
||
}
|
||
}(e)
|
||
} finally {
|
||
clearImmediate(t), h = !1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}("undefined" == typeof self ? void 0 === t ? this : t : self)
|
||
}).call(this, r(42), r(404))
|
||
}, function(t, e) {
|
||
var r, n, i = t.exports = {};
|
||
|
||
function defaultSetTimout() {
|
||
throw new Error("setTimeout has not been defined")
|
||
}
|
||
|
||
function defaultClearTimeout() {
|
||
throw new Error("clearTimeout has not been defined")
|
||
}
|
||
|
||
function runTimeout(e) {
|
||
if (r === setTimeout) return setTimeout(e, 0);
|
||
if ((r === defaultSetTimout || !r) && setTimeout) return r = setTimeout, setTimeout(e, 0);
|
||
try {
|
||
return r(e, 0)
|
||
} catch (t) {
|
||
try {
|
||
return r.call(null, e, 0)
|
||
} catch (t) {
|
||
return r.call(this, e, 0)
|
||
}
|
||
}
|
||
}! function() {
|
||
try {
|
||
r = "function" == typeof setTimeout ? setTimeout : defaultSetTimout
|
||
} catch (t) {
|
||
r = defaultSetTimout
|
||
}
|
||
try {
|
||
n = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout
|
||
} catch (t) {
|
||
n = defaultClearTimeout
|
||
}
|
||
}();
|
||
var o, a = [],
|
||
s = !1,
|
||
u = -1;
|
||
|
||
function cleanUpNextTick() {
|
||
s && o && (s = !1, o.length ? a = o.concat(a) : u = -1, a.length && drainQueue())
|
||
}
|
||
|
||
function drainQueue() {
|
||
if (!s) {
|
||
var t = runTimeout(cleanUpNextTick);
|
||
s = !0;
|
||
for (var e = a.length; e;) {
|
||
for (o = a, a = []; ++u < e;) o && o[u].run();
|
||
u = -1, e = a.length
|
||
}
|
||
o = null, s = !1,
|
||
function(e) {
|
||
if (n === clearTimeout) return clearTimeout(e);
|
||
if ((n === defaultClearTimeout || !n) && clearTimeout) return n = clearTimeout, clearTimeout(e);
|
||
try {
|
||
n(e)
|
||
} catch (t) {
|
||
try {
|
||
return n.call(null, e)
|
||
} catch (t) {
|
||
return n.call(this, e)
|
||
}
|
||
}
|
||
}(t)
|
||
}
|
||
}
|
||
|
||
function Item(t, e) {
|
||
this.fun = t, this.array = e
|
||
}
|
||
|
||
function noop() {}
|
||
i.nextTick = function(t) {
|
||
var e = new Array(arguments.length - 1);
|
||
if (1 < arguments.length)
|
||
for (var r = 1; r < arguments.length; r++) e[r - 1] = arguments[r];
|
||
a.push(new Item(t, e)), 1 !== a.length || s || runTimeout(drainQueue)
|
||
}, Item.prototype.run = function() {
|
||
this.fun.apply(null, this.array)
|
||
}, i.title = "browser", i.browser = !0, i.env = {}, i.argv = [], i.version = "", i.versions = {}, i.on = noop, i.addListener = noop, i.once = noop, i.off = noop, i.removeListener = noop, i.removeAllListeners = noop, i.emit = noop, i.prependListener = noop, i.prependOnceListener = noop, i.listeners = function(t) {
|
||
return []
|
||
}, i.binding = function(t) {
|
||
throw new Error("process.binding is not supported")
|
||
}, i.cwd = function() {
|
||
return "/"
|
||
}, i.chdir = function(t) {
|
||
throw new Error("process.chdir is not supported")
|
||
}, i.umask = function() {
|
||
return 0
|
||
}
|
||
}, function(t, d, p) {
|
||
(function(c, l) {
|
||
var f;
|
||
! function(t) {
|
||
d && d.nodeType, c && c.nodeType;
|
||
var e = "object" == typeof l && l;
|
||
e.global !== e && e.window !== e && e.self;
|
||
var r, g = 2147483647,
|
||
y = 36,
|
||
_ = 1,
|
||
b = 26,
|
||
i = 38,
|
||
o = 700,
|
||
x = 72,
|
||
w = 128,
|
||
T = "-",
|
||
n = /^xn--/,
|
||
a = /[^\x20-\x7E]/,
|
||
s = /[\x2E\u3002\uFF0E\uFF61]/g,
|
||
u = {
|
||
overflow: "Overflow: input needs wider integers to process",
|
||
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
||
"invalid-input": "Invalid input"
|
||
},
|
||
h = y - _,
|
||
S = Math.floor,
|
||
M = String.fromCharCode;
|
||
|
||
function error(t) {
|
||
throw new RangeError(u[t])
|
||
}
|
||
|
||
function map(t, e) {
|
||
for (var r = t.length, n = []; r--;) n[r] = e(t[r]);
|
||
return n
|
||
}
|
||
|
||
function mapDomain(t, e) {
|
||
var r = t.split("@"),
|
||
n = "";
|
||
return 1 < r.length && (n = r[0] + "@", t = r[1]), n + map((t = t.replace(s, ".")).split("."), e).join(".")
|
||
}
|
||
|
||
function ucs2decode(t) {
|
||
for (var e, r, n = [], i = 0, o = t.length; i < o;) 55296 <= (e = t.charCodeAt(i++)) && e <= 56319 && i < o ? 56320 == (64512 & (r = t.charCodeAt(i++))) ? n.push(((1023 & e) << 10) + (1023 & r) + 65536) : (n.push(e), i--) : n.push(e);
|
||
return n
|
||
}
|
||
|
||
function ucs2encode(t) {
|
||
return map(t, function(t) {
|
||
var e = "";
|
||
return 65535 < t && (e += M((t -= 65536) >>> 10 & 1023 | 55296), t = 56320 | 1023 & t), e += M(t)
|
||
}).join("")
|
||
}
|
||
|
||
function digitToBasic(t, e) {
|
||
return t + 22 + 75 * (t < 26) - ((0 != e) << 5)
|
||
}
|
||
|
||
function adapt(t, e, r) {
|
||
var n = 0;
|
||
for (t = r ? S(t / o) : t >> 1, t += S(t / e); h * b >> 1 < t; n += y) t = S(t / h);
|
||
return S(n + (h + 1) * t / (t + i))
|
||
}
|
||
|
||
function decode(t) {
|
||
var e, r, n, i, o, a, s, u, h, c, l, f = [],
|
||
d = t.length,
|
||
p = 0,
|
||
m = w,
|
||
v = x;
|
||
for ((r = t.lastIndexOf(T)) < 0 && (r = 0), n = 0; n < r; ++n) 128 <= t.charCodeAt(n) && error("not-basic"), f.push(t.charCodeAt(n));
|
||
for (i = 0 < r ? r + 1 : 0; i < d;) {
|
||
for (o = p, a = 1, s = y; d <= i && error("invalid-input"), l = t.charCodeAt(i++), (y <= (u = l - 48 < 10 ? l - 22 : l - 65 < 26 ? l - 65 : l - 97 < 26 ? l - 97 : y) || u > S((g - p) / a)) && error("overflow"), p += u * a, !(u < (h = s <= v ? _ : v + b <= s ? b : s - v)); s += y) a > S(g / (c = y - h)) && error("overflow"), a *= c;
|
||
v = adapt(p - o, e = f.length + 1, 0 == o), S(p / e) > g - m && error("overflow"), m += S(p / e), p %= e, f.splice(p++, 0, m)
|
||
}
|
||
return ucs2encode(f)
|
||
}
|
||
|
||
function encode(t) {
|
||
var e, r, n, i, o, a, s, u, h, c, l, f, d, p, m, v = [];
|
||
for (f = (t = ucs2decode(t)).length, e = w, o = x, a = r = 0; a < f; ++a)(l = t[a]) < 128 && v.push(M(l));
|
||
for (n = i = v.length, i && v.push(T); n < f;) {
|
||
for (s = g, a = 0; a < f; ++a) e <= (l = t[a]) && l < s && (s = l);
|
||
for (s - e > S((g - r) / (d = n + 1)) && error("overflow"), r += (s - e) * d, e = s, a = 0; a < f; ++a)
|
||
if ((l = t[a]) < e && ++r > g && error("overflow"), l == e) {
|
||
for (u = r, h = y; !(u < (c = h <= o ? _ : o + b <= h ? b : h - o)); h += y) m = u - c, p = y - c, v.push(M(digitToBasic(c + m % p, 0))), u = S(m / p);
|
||
v.push(M(digitToBasic(u, 0))), o = adapt(r, d, n == i), r = 0, ++n
|
||
}++r, ++e
|
||
}
|
||
return v.join("")
|
||
}
|
||
r = {
|
||
version: "1.4.1",
|
||
ucs2: {
|
||
decode: ucs2decode,
|
||
encode: ucs2encode
|
||
},
|
||
decode: decode,
|
||
encode: encode,
|
||
toASCII: function(t) {
|
||
return mapDomain(t, function(t) {
|
||
return a.test(t) ? "xn--" + encode(t) : t
|
||
})
|
||
},
|
||
toUnicode: function(t) {
|
||
return mapDomain(t, function(t) {
|
||
return n.test(t) ? decode(t.slice(4).toLowerCase()) : t
|
||
})
|
||
}
|
||
}, void 0 === (f = function() {
|
||
return r
|
||
}.call(d, p, d, c)) || (c.exports = f)
|
||
}()
|
||
}).call(this, p(406)(t), p(42))
|
||
}, function(t, e) {
|
||
t.exports = function(t) {
|
||
return t.webpackPolyfill || (t.deprecate = function() {}, t.paths = [], t.children || (t.children = []), Object.defineProperty(t, "loaded", {
|
||
enumerable: !0,
|
||
get: function() {
|
||
return t.l
|
||
}
|
||
}), Object.defineProperty(t, "id", {
|
||
enumerable: !0,
|
||
get: function() {
|
||
return t.i
|
||
}
|
||
}), t.webpackPolyfill = 1), t
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
t.exports = {
|
||
isString: function(t) {
|
||
return "string" == typeof t
|
||
},
|
||
isObject: function(t) {
|
||
return "object" == typeof t && null !== t
|
||
},
|
||
isNull: function(t) {
|
||
return null === t
|
||
},
|
||
isNullOrUndefined: function(t) {
|
||
return null == t
|
||
}
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.decode = e.parse = r(409), e.encode = e.stringify = r(410)
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
t.exports = function(t, e, r, n) {
|
||
e = e || "&", r = r || "=";
|
||
var i = {};
|
||
if ("string" != typeof t || 0 === t.length) return i;
|
||
var o = /\+/g;
|
||
t = t.split(e);
|
||
var a = 1e3;
|
||
n && "number" == typeof n.maxKeys && (a = n.maxKeys);
|
||
var s, u, h = t.length;
|
||
0 < a && a < h && (h = a);
|
||
for (var c = 0; c < h; ++c) {
|
||
var l, f, d, p, m = t[c].replace(o, "%20"),
|
||
v = m.indexOf(r);
|
||
f = 0 <= v ? (l = m.substr(0, v), m.substr(v + 1)) : (l = m, ""), d = decodeURIComponent(l), p = decodeURIComponent(f), s = i, u = d, Object.prototype.hasOwnProperty.call(s, u) ? g(i[d]) ? i[d].push(p) : i[d] = [i[d], p] : i[d] = p
|
||
}
|
||
return i
|
||
};
|
||
var g = Array.isArray || function(t) {
|
||
return "[object Array]" === Object.prototype.toString.call(t)
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
var o = function(t) {
|
||
switch (typeof t) {
|
||
case "string":
|
||
return t;
|
||
case "boolean":
|
||
return t ? "true" : "false";
|
||
case "number":
|
||
return isFinite(t) ? t : "";
|
||
default:
|
||
return ""
|
||
}
|
||
};
|
||
t.exports = function(r, n, i, t) {
|
||
return n = n || "&", i = i || "=", null === r && (r = void 0), "object" == typeof r ? map(s(r), function(t) {
|
||
var e = encodeURIComponent(o(t)) + i;
|
||
return a(r[t]) ? map(r[t], function(t) {
|
||
return e + encodeURIComponent(o(t))
|
||
}).join(n) : e + encodeURIComponent(o(r[t]))
|
||
}).join(n) : t ? encodeURIComponent(o(t)) + i + encodeURIComponent(o(r)) : ""
|
||
};
|
||
var a = Array.isArray || function(t) {
|
||
return "[object Array]" === Object.prototype.toString.call(t)
|
||
};
|
||
|
||
function map(t, e) {
|
||
if (t.map) return t.map(e);
|
||
for (var r = [], n = 0; n < t.length; n++) r.push(e(t[n], n));
|
||
return r
|
||
}
|
||
var s = Object.keys || function(t) {
|
||
var e = [];
|
||
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.push(r);
|
||
return e
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0, e.Loader = void 0;
|
||
var c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
|
||
return typeof t
|
||
} : function(t) {
|
||
return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
|
||
},
|
||
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
|
||
}
|
||
}(),
|
||
o = _interopRequireDefault(r(125)),
|
||
i = _interopRequireDefault(r(172)),
|
||
a = 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(173)),
|
||
l = r(174);
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var s = /(#[\w-]+)?$/,
|
||
u = e.Loader = function() {
|
||
function Loader() {
|
||
var r = this,
|
||
t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "",
|
||
e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 10;
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Loader), this.baseUrl = t, this.progress = 0, this.loading = !1, this.defaultQueryString = "", this._beforeMiddleware = [], this._afterMiddleware = [], this._resourcesParsing = [], this._boundLoadResource = function(t, e) {
|
||
return r._loadResource(t, e)
|
||
}, this._queue = a.queue(this._boundLoadResource, e), this._queue.pause(), this.resources = {}, this.onProgress = new o.default, this.onError = new o.default, this.onLoad = new o.default, this.onStart = new o.default, this.onComplete = new o.default;
|
||
for (var n = 0; n < Loader._defaultBeforeMiddleware.length; ++n) this.pre(Loader._defaultBeforeMiddleware[n]);
|
||
for (var i = 0; i < Loader._defaultAfterMiddleware.length; ++i) this.use(Loader._defaultAfterMiddleware[i])
|
||
}
|
||
return Loader.prototype.add = function(t, e, r, n) {
|
||
if (Array.isArray(t)) {
|
||
for (var i = 0; i < t.length; ++i) this.add(t[i]);
|
||
return this
|
||
}
|
||
if ("object" === (void 0 === t ? "undefined" : c(t)) && (n = e || t.callback || t.onComplete, e = (r = t).url, t = t.name || t.key || t.url), "string" != typeof e && (n = r, r = e, e = t), "string" != typeof e) throw new Error("No url passed to add resource to loader.");
|
||
if ("function" == typeof r && (n = r, r = null), this.loading && (!r || !r.parentResource)) throw new Error("Cannot add resources while the loader is running.");
|
||
if (this.resources[t]) throw new Error('Resource named "' + t + '" already exists.');
|
||
if (e = this._prepareUrl(e), this.resources[t] = new l.Resource(t, e, r), "function" == typeof n && this.resources[t].onAfterMiddleware.once(n), this.loading) {
|
||
for (var o = r.parentResource, a = [], s = 0; s < o.children.length; ++s) o.children[s].isComplete || a.push(o.children[s]);
|
||
var u = o.progressChunk * (a.length + 1) / (a.length + 2);
|
||
o.children.push(this.resources[t]), o.progressChunk = u;
|
||
for (var h = 0; h < a.length; ++h) a[h].progressChunk = u;
|
||
this.resources[t].progressChunk = u
|
||
}
|
||
return this._queue.push(this.resources[t]), this
|
||
}, Loader.prototype.pre = function(t) {
|
||
return this._beforeMiddleware.push(t), this
|
||
}, Loader.prototype.use = function(t) {
|
||
return this._afterMiddleware.push(t), this
|
||
}, Loader.prototype.reset = function() {
|
||
for (var t in this.progress = 0, this.loading = !1, this._queue.kill(), this._queue.pause(), this.resources) {
|
||
var e = this.resources[t];
|
||
e._onLoadBinding && e._onLoadBinding.detach(), e.isLoading && e.abort()
|
||
}
|
||
return this.resources = {}, this
|
||
}, Loader.prototype.load = function(t) {
|
||
if ("function" == typeof t && this.onComplete.once(t), this.loading) return this;
|
||
if (this._queue.idle()) this._onStart(), this._onComplete();
|
||
else {
|
||
for (var e = 100 / this._queue._tasks.length, r = 0; r < this._queue._tasks.length; ++r) this._queue._tasks[r].data.progressChunk = e;
|
||
this._onStart(), this._queue.resume()
|
||
}
|
||
return this
|
||
}, Loader.prototype._prepareUrl = function(t) {
|
||
var e = (0, i.default)(t, {
|
||
strictMode: !0
|
||
}),
|
||
r = void 0;
|
||
if (r = e.protocol || !e.path || 0 === t.indexOf("//") ? t : this.baseUrl.length && this.baseUrl.lastIndexOf("/") !== this.baseUrl.length - 1 && "/" !== t.charAt(0) ? this.baseUrl + "/" + t : this.baseUrl + t, this.defaultQueryString) {
|
||
var n = s.exec(r)[0]; - 1 !== (r = r.substr(0, r.length - n.length)).indexOf("?") ? r += "&" + this.defaultQueryString : r += "?" + this.defaultQueryString, r += n
|
||
}
|
||
return r
|
||
}, Loader.prototype._loadResource = function(r, t) {
|
||
var n = this;
|
||
r._dequeue = t, a.eachSeries(this._beforeMiddleware, function(t, e) {
|
||
t.call(n, r, function() {
|
||
e(r.isComplete ? {} : null)
|
||
})
|
||
}, function() {
|
||
r.isComplete ? n._onLoad(r) : (r._onLoadBinding = r.onComplete.once(n._onLoad, n), r.load())
|
||
}, !0)
|
||
}, Loader.prototype._onStart = function() {
|
||
this.progress = 0, this.loading = !0, this.onStart.dispatch(this)
|
||
}, Loader.prototype._onComplete = function() {
|
||
this.progress = 100, this.loading = !1, this.onComplete.dispatch(this, this.resources)
|
||
}, Loader.prototype._onLoad = function(r) {
|
||
var n = this;
|
||
r._onLoadBinding = null, this._resourcesParsing.push(r), r._dequeue(), a.eachSeries(this._afterMiddleware, function(t, e) {
|
||
t.call(n, r, e)
|
||
}, function() {
|
||
r.onAfterMiddleware.dispatch(r), n.progress = Math.min(100, n.progress + r.progressChunk), n.onProgress.dispatch(n, r), r.error ? n.onError.dispatch(r.error, n, r) : n.onLoad.dispatch(n, r), n._resourcesParsing.splice(n._resourcesParsing.indexOf(r), 1), n._queue.idle() && 0 === n._resourcesParsing.length && n._onComplete()
|
||
}, !0)
|
||
}, n(Loader, [{
|
||
key: "concurrency",
|
||
get: function() {
|
||
return this._queue.concurrency
|
||
},
|
||
set: function(t) {
|
||
this._queue.concurrency = t
|
||
}
|
||
}]), Loader
|
||
}();
|
||
u._defaultBeforeMiddleware = [], u._defaultAfterMiddleware = [], u.pre = function(t) {
|
||
return u._defaultBeforeMiddleware.push(t), u
|
||
}, u.use = function(t) {
|
||
return u._defaultAfterMiddleware.push(t), u
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
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
|
||
}, 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
|
||
}
|
||
}(),
|
||
i = _interopRequireDefault(r(8)),
|
||
o = _interopRequireDefault(r(175)),
|
||
a = _interopRequireDefault(r(176)),
|
||
s = _interopRequireDefault(r(177));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var u = function(r) {
|
||
function Game() {
|
||
var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {};
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Game);
|
||
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, r.call(this));
|
||
return e._width = 100, e._height = 100, e.entitiesToRemove = [], e.entitiesToAdd = [], e.allEntities = new o.default, e.onUpdateEntities = new i.default("run", 1), e.onRenderEntities = new i.default("run", 2), e.onResize = new i.default("resize", 2), e.onEntityAddedToGame = new i.default("entityAddedToGame", 1), e.onEntityRemovedFromGame = new i.default("entityRemovedFromGame", 1), e.onPreupdate = new i.default("preupdate", 1), e.onPostupdate = new i.default("postupdate", 1), e.onEmpty = new i.default("empty", 1), e.system = new s.default, e.system.name = "system", e.addToGame(e.system), e.startTime = 0, e.fps = 60, e.frameDuration = 1e3 / e.fps, e.lag = 0, e.time = 0, e.paused = !1, e.updateAndRender = void 0 === t.updateAndRender || t.updateAndRender, e.signals = e.system.signals, 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)
|
||
}(Game, r), Game.prototype.addSystem = function(t, e, r) {
|
||
var n = !(3 < arguments.length && void 0 !== arguments[3]) || arguments[3];
|
||
if (r = r || s.default.getComponentName(t), this.system[r]) throw new Error(r + " system already exists with that name");
|
||
if (this.system.add(t, e, r), this.system[r].game = this, n) {
|
||
var i = t.shortcut;
|
||
i || (i = r).includes("System") && (i = i.split("System")[0]), this[i] = this.system[r]
|
||
}
|
||
return this
|
||
}, Game.prototype.addToGame = function(t) {
|
||
if (t._gc) {
|
||
var e = this.entitiesToRemove.indexOf(t);
|
||
this.entitiesToRemove.splice(e, 1), t._gc = !1
|
||
}
|
||
if (t.game) {
|
||
if (t.game === this) return;
|
||
this._removeEntity(t)
|
||
}(t.game = this).allEntities.add(t), t._addedToGame.run(this), this.onEntityAddedToGame.run(t), this.entitiesToAdd.push(t)
|
||
}, Game.prototype.removeFromGame = function(t) {
|
||
!t._gc && t.game && (t._gc = !0, this.entitiesToRemove.push(t))
|
||
}, Game.prototype.render = function(t, e) {
|
||
this.onRenderEntities.run(t, e)
|
||
}, Game.prototype.update = function(t) {
|
||
this.time += t, this._addEntities(), this._removeEntities(), this.onPreupdate.run(), this._removeEntities(), this.onUpdateEntities.run(t), this._removeEntities(), this.onPostupdate.run(), this.updateAndRender && this.render(t, 1)
|
||
}, Game.prototype.empty = function() {
|
||
this._removeEntities(), this.onEmpty.run();
|
||
for (var t = 0; t < this.allEntities.children.length; t++) {
|
||
var e = this.allEntities.children[t];
|
||
e._removedFromGame.run(this), e.game = null, e._gc = !1
|
||
}
|
||
this.allEntities.empty(), this.rootContainer && this.rootContainer.empty(), this.onUpdateEntities.removeAll(), this.onRenderEntities.removeAll(), this.onResize.removeAll(), this.onEntityAddedToGame.removeAll(), this.onEntityRemovedFromGame.removeAll(), this.onPreupdate.removeAll(), this.onPostupdate.removeAll(), this.onEmpty.removeAll(), this.entitiesToAdd.length = 0, this.entitiesToRemove.length = 0, this.addToGame(this.system, !0)
|
||
}, Game.prototype.resize = function(t, e) {
|
||
this._width = t, this._height = e, this.onResize.run(t, e)
|
||
}, Game.prototype._addEntities = function() {
|
||
if (this.entitiesToAdd.length) {
|
||
for (var t = 0; t < this.entitiesToAdd.length; t++) {
|
||
var e = this.entitiesToAdd[t];
|
||
e._update.empty || this.onUpdateEntities.add(e._update), e._render.empty || this.onRenderEntities.add(e._render), e._start.run(), e.onEntityDestroyed.add(this, 1)
|
||
}
|
||
this.entitiesToAdd.length = 0
|
||
}
|
||
}, Game.prototype.entityDestroyed = function(t) {
|
||
t.parent ? t.parent.container.remove(t) : t.game && this.removeFromGame(t), t.onEntityDestroyed.remove(this)
|
||
}, Game.prototype._removeEntities = function() {
|
||
var t = this.entitiesToRemove;
|
||
if (t.length) {
|
||
for (var e = 0; e < t.length; e++) {
|
||
var r = t[e];
|
||
this._removeEntity(r)
|
||
}
|
||
t.length = 0
|
||
}
|
||
}, Game.prototype._removeEntity = function(t) {
|
||
t.onEntityDestroyed.remove(this), this.onEntityRemovedFromGame.run(t), t._removedFromGame.run(this), this.allEntities.remove(t), t._update.empty || this.onUpdateEntities.remove(t._update), t._render.empty || this.onRenderEntities.remove(t._render), t.game = null, t._gc = !1
|
||
}, Game.prototype.resume = function() {}, n(Game, [{
|
||
key: "width",
|
||
get: function() {
|
||
return this._width
|
||
}
|
||
}, {
|
||
key: "height",
|
||
get: function() {
|
||
return this._height
|
||
}
|
||
}]), Game
|
||
}(a.default);
|
||
e.default = u
|
||
}, 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 Pool(t) {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Pool), this.classType = t, this.pool = [], this.totalCreated = 0, this.debug = !1
|
||
}
|
||
return Pool.prototype.prepopulate = function(t) {
|
||
for (var e = 0; e < t; e++) this.pool.push(new this.classType)
|
||
}, Pool.prototype.get = function() {
|
||
var t = this.pool.pop();
|
||
return t || (this.totalCreated++, this.debug, t = new this.classType), t
|
||
}, Pool.prototype.return = function(t) {
|
||
-1 === this.pool.indexOf(t) && this.pool.push(t), this.debug
|
||
}, Pool.getPool = function(t) {
|
||
return t._CLASS_ID || (t._CLASS_ID = Pool.idGenerator++, Pool.pools[t._CLASS_ID] = new Pool(t)), Pool.pools[t._CLASS_ID]
|
||
}, Pool.get = function(t) {
|
||
t._CLASS_ID || (t._CLASS_ID = Pool.idGenerator++, Pool.pools[t._CLASS_ID] = new Pool(t));
|
||
var e = Pool.pools[t._CLASS_ID].get();
|
||
return e._CLASS_ID = t._CLASS_ID, e
|
||
}, Pool.return = function(t) {
|
||
Pool.pools[t._CLASS_ID].return(t)
|
||
}, n(Pool, [{
|
||
key: "total",
|
||
get: function() {
|
||
return this.pool.length
|
||
}
|
||
}]), Pool
|
||
}();
|
||
(e.default = i).pools = [], i.idGenerator = 1
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = _interopRequireDefault(r(13)),
|
||
i = _interopRequireDefault(r(178));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var o = function(n) {
|
||
function ContainerSystem(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, ContainerSystem);
|
||
var r = 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, t, e));
|
||
return t.add(i.default, null, "container"), r
|
||
}
|
||
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)
|
||
}(ContainerSystem, n), ContainerSystem.prototype.empty = function() {
|
||
this.entity.container.empty()
|
||
}, ContainerSystem.prototype.entityAddedToGame = function(t) {
|
||
if (t.container)
|
||
for (var e = t.container.children, r = 0; r < e.length; r++) this.entity.game.addToGame(e[r])
|
||
}, ContainerSystem.prototype.entityRemovedFromGame = function(t) {
|
||
if (t.container) {
|
||
t.parent;
|
||
for (var e = t.container.children, r = 0; r < e.length; r++) this.entity.game.removeFromGame(e[r])
|
||
}
|
||
}, ContainerSystem
|
||
}(n.default);
|
||
e.default = o
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n, i = r(13),
|
||
o = (n = i) && n.__esModule ? n : {
|
||
default: n
|
||
},
|
||
a = r(4);
|
||
var s = function(n) {
|
||
function TransformSystem(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, TransformSystem);
|
||
var r = 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, t, e));
|
||
return r.dynamics = 0, r.statics = 0, r.free = 0, r
|
||
}
|
||
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)
|
||
}(TransformSystem, n), TransformSystem.prototype.render = function() {
|
||
var t = this.entity.container;
|
||
this.dynamics = 0, this.statics = 0;
|
||
for (var e = this.free = 0; e < t.children.length; e++) this.updateTransform(t.children[e])
|
||
}, TransformSystem.prototype.updateLocal = function(t) {
|
||
var e = t.quat;
|
||
if (t._rotationDirty) {
|
||
t._rotationDirty = !1;
|
||
var r = t.rotation.x,
|
||
n = t.rotation.y,
|
||
i = t.rotation.z,
|
||
o = Math.cos(r / 2),
|
||
a = Math.cos(n / 2),
|
||
s = Math.cos(i / 2),
|
||
u = Math.sin(r / 2),
|
||
h = Math.sin(n / 2),
|
||
c = Math.sin(i / 2);
|
||
e[0] = u * a * s + o * h * c, e[1] = o * h * s - u * a * c, e[2] = o * a * c + u * h * s, e[3] = o * a * s - u * h * c
|
||
}
|
||
var l = e[0],
|
||
f = e[1],
|
||
d = e[2],
|
||
p = e[3],
|
||
m = l + l,
|
||
v = f + f,
|
||
g = d + d,
|
||
y = l * m,
|
||
_ = l * v,
|
||
b = l * g,
|
||
x = f * v,
|
||
w = f * g,
|
||
T = d * g,
|
||
S = p * m,
|
||
M = p * v,
|
||
E = p * g,
|
||
A = t.localTransform,
|
||
P = t.scale.x,
|
||
I = t.scale.y,
|
||
O = t.scale.z;
|
||
A[0] = (1 - (x + T)) * P, A[1] = (_ + E) * P, A[2] = (b - M) * P, A[4] = (_ - E) * I, A[5] = (1 - (y + T)) * I, A[6] = (w + S) * I, A[8] = (b + M) * O, A[9] = (w - S) * O, A[10] = (1 - (y + x)) * O, A[12] = t.position.x, A[13] = t.position.y, A[14] = t.position.z, t._currentLocalID = t._localID, t._parentID = -1, t._worldID++
|
||
}, TransformSystem.prototype.updateWithParent = function(t, e) {
|
||
var r = t.worldTransform,
|
||
n = e.worldTransform,
|
||
i = t.localTransform;
|
||
if (0 === t._currentLocalID) r[0] = n[0], r[1] = n[1], r[2] = n[2], r[4] = n[4], r[5] = n[5], r[6] = n[6], r[8] = n[8], r[9] = n[9], r[10] = n[10], r[12] = n[12], r[13] = n[13], r[14] = n[14], this.free++;
|
||
else {
|
||
var o = n[0],
|
||
a = n[1],
|
||
s = n[2],
|
||
u = n[4],
|
||
h = n[5],
|
||
c = n[6],
|
||
l = n[8],
|
||
f = n[9],
|
||
d = n[10],
|
||
p = n[12],
|
||
m = n[13],
|
||
v = n[14],
|
||
g = i[0],
|
||
y = i[1],
|
||
_ = i[2];
|
||
r[0] = g * o + y * u + _ * l, r[1] = g * a + y * h + _ * f, r[2] = g * s + y * c + _ * d, g = i[4], y = i[5], _ = i[6], r[4] = g * o + y * u + _ * l, r[5] = g * a + y * h + _ * f, r[6] = g * s + y * c + _ * d, g = i[8], y = i[9], _ = i[10], r[8] = g * o + y * u + _ * l, r[9] = g * a + y * h + _ * f, r[10] = g * s + y * c + _ * d, g = i[12], y = i[13], _ = i[14], r[12] = g * o + y * u + _ * l + p, r[13] = g * a + y * h + _ * f + m, r[14] = g * s + y * c + _ * d + v
|
||
}
|
||
t._parentID = e._worldID, t._worldID++
|
||
}, TransformSystem.prototype.updateTransform = function(t) {
|
||
var e = t.transform,
|
||
r = t.parent;
|
||
if (e && t._worldActive && (e.custom || (e._localID !== e._currentLocalID ? (this.updateLocal(e), this.dynamics++) : this.statics++), r && r.transform ? e._parentID !== r.transform._worldID && this.updateWithParent(e, r.transform) : a.mat4.copy(e.worldTransform, e.localTransform), t.container))
|
||
for (var n = t.container.children, i = 0; i < n.length; i++) this.updateTransform(n[i])
|
||
}, TransformSystem
|
||
}(o.default);
|
||
e.default = s
|
||
}, 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
|
||
}
|
||
}(),
|
||
i = _interopRequireDefault(r(13)),
|
||
o = _interopRequireDefault(r(126)),
|
||
w = 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)),
|
||
s = r(4),
|
||
a = _interopRequireDefault(r(425)),
|
||
u = _interopRequireDefault(r(426));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var h = s.vec3.create(),
|
||
c = s.vec3.create(),
|
||
l = (new w.Rectangle, function(i) {
|
||
function View3dSystem(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, View3dSystem);
|
||
var r = 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, i.call(this, t, e));
|
||
if (r.w = -1, r.h = -1, r.stage = e.stage || new w.Container, r.geometryCache = {}, r.instanceBuffer = new w.Buffer(new Float32Array(1)), r.instancingIndex = 0, r.instanceBatch = [], r.bufferCache = {}, r.renderables = [], r.transparentRenderables = [], r.count = 0, r.camera = e.camera || new o.default, r.container = new w.Container, r.stage.addChild(r.container), r.container._render = r.renderChildren.bind(r), r.container.filterArea = new w.Rectangle(0, 0, 1e5, 1e5), r.ambientLight = new a.default(16777215, .5), r.renderer = e.renderer, r.globalUniforms = new w.UniformGroup({
|
||
projection: s.mat4.create(),
|
||
view: s.mat4.create(),
|
||
uEyePosition: new Float32Array([0, 1, 0]),
|
||
projectionView: s.mat4.create(),
|
||
uFogColor: new Float32Array([1, 0, 0]),
|
||
uFogDensity: .1,
|
||
uGlobalAmbient: r.ambientLight.output
|
||
}, !0), r.resize(1, 1), r.lightsDirty = !0, r.lightUniforms = new w.UniformGroup({}, !0), r.instances = {}, r.drawCount = 0, r.fogEnabled = !1, (e.fogEnabled || void 0 !== e.fogColor || void 0 !== e.uFogColor) && (r.fogEnabled = !0, r.fogColor = void 0 === e.fogColor ? 0 : e.fogColor, r.fogDensity = void 0 === e.fogDensity ? .01 : e.fogDensity), void 0 === e.instancing) {
|
||
var n = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
|
||
e.instancing = !n
|
||
}
|
||
return r.allowInstancing = r.renderer.geometry.hasInstance && e.instancing, r.layer = new u.default(r.allowInstancing), r.lightsSig = "", r.lights = [], r.freezeLights = !1, r
|
||
}
|
||
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)
|
||
}(View3dSystem, i), View3dSystem.prototype.map2dFrom3d = function(t, e) {
|
||
c[0] = e.x, c[1] = e.y, c[2] = e.z, s.vec3.transformMat4(h, c, this.camera.camera.view), s.vec3.transformMat4(h, h, this.camera.camera.projection);
|
||
var r = .5 * this.w,
|
||
n = .5 * this.h;
|
||
return t.x = h[0] * r + r, t.y = -h[1] * n + n, t
|
||
}, View3dSystem.prototype.map3dFrom2d = function(t, e) {}, View3dSystem.prototype.setCamera = function(t) {
|
||
this.camera = t
|
||
}, View3dSystem.prototype.renderChildren = function(t) {
|
||
this.layer.update(this.camera), this.drawCount = 0, this.ambientLight.update(), this.globalUniforms.update();
|
||
var e = this.camera.camera;
|
||
this.renderTexture ? (t.renderTexture.bind(this.renderTexture), t.renderTexture.clear(), e.updateProjection(this.renderTexture.width, this.renderTexture.height)) : e.updateProjection(t.width, t.height), this.camera.game || this.game.addChild(this.camera), t.batch.flush();
|
||
var r = this.globalUniforms.uniforms;
|
||
r.projection = e.projection;
|
||
var n = r.uEyePosition;
|
||
n[0] = e.position.x, n[1] = e.position.y, n[2] = e.position.z, r.view = e.view, s.mat4.multiply(r.projectionView, e.projection, e.view);
|
||
var i = this.lights;
|
||
if (this.lightsDirty) {
|
||
i.sort(function(t, e) {
|
||
return t.light.type - e.light.type || t.UID - e.UID
|
||
});
|
||
var o = {
|
||
0: 0,
|
||
1: 0,
|
||
2: 0
|
||
};
|
||
this.lightSig = i.map(function(t) {
|
||
return t.light.type
|
||
}).join("-"), this.lightsDirty = !1;
|
||
var a = this.lightUniforms.uniforms;
|
||
i.forEach(function(t) {
|
||
var e = t.light.type + "_" + o[t.light.type]++,
|
||
r = t.light;
|
||
r._lightId = e, a["uLightColor" + e] = r.output, a["uLightDirection" + e] = r.direction, 1 === r.type && (a["uLightPosition" + e] = r.position, a["uLightDistance" + e] || Object.defineProperty(a, "uLightDistance" + e, {
|
||
enumerable: !0,
|
||
get: function() {
|
||
return r.distance
|
||
}
|
||
})), 2 === r.type && (a["uLightPosition" + e] = r.position, a["uLightDistance" + e] = r.distance)
|
||
})
|
||
}
|
||
this.lightUniforms.update(), this.renderGroup(this.layer.opaqueRenderables, t, i), this.renderGroup(this.layer.transparentRenderables, t, i), t.renderTexture.bind(null)
|
||
}, View3dSystem.prototype.renderInstances = function(t, e, r, n, i) {
|
||
var o = r.uniforms,
|
||
a = n.isFrag ? n.geometry : n,
|
||
s = r.id + ":" + a.id,
|
||
u = this.geometryCache[s];
|
||
if (!u) {
|
||
var h = new w.Buffer(new Float32Array(1));
|
||
(u = a.clone()).instancedBuffer = h, u.instanced = !0, u.addAttribute("i_mat1", h, 3, !1, null, 84, 0, !0), u.addAttribute("i_mat2", h, 3, !1, null, 84, 12, !0), u.addAttribute("i_mat3", h, 3, !1, null, 84, 24, !0), u.addAttribute("i_mat4", h, 3, !1, null, 84, 36, !0), u.addAttribute("i_norm1", h, 3, !1, null, 84, 48, !0), u.addAttribute("i_norm2", h, 3, !1, null, 84, 60, !0), u.addAttribute("i_norm3", h, 3, !1, null, 84, 72, !0), this.geometryCache[s] = u
|
||
}
|
||
var c = w.utils.nextPow2(21 * e),
|
||
l = this.bufferCache[c];
|
||
l || (l = this.bufferCache[c] = new Float32Array(c));
|
||
for (var f = t[0], d = o.normal, p = 0, m = 0; m < e; m++) {
|
||
var v = t[m],
|
||
g = v.view3d,
|
||
y = v.transform.worldTransform,
|
||
_ = 0;
|
||
if (l[p++] = y[_++], l[p++] = y[_++], l[p++] = y[_++], _++, l[p++] = y[_++], l[p++] = y[_++], l[p++] = y[_++], _++, l[p++] = y[_++], l[p++] = y[_++], l[p++] = y[_++], _++, l[p++] = y[_++], l[p++] = y[_++], l[p++] = y[_++], d)
|
||
for (var b = g._cachedNormal, x = 0; x < 9; x++) l[p++] = b[x];
|
||
else p += 9
|
||
}
|
||
u.instancedBuffer.update(l), i.shader.bind(r), i.state.setState(f.view3d.state), i.geometry.bind(u), i.geometry.draw(f.view3d.draw, n.size, n.start, e), this.drawCount++
|
||
}, View3dSystem.prototype.renderGroup = function(t, e, r) {
|
||
for (var n = null, i = null, o = this.instanceBatch, a = 0, s = 0; s < t.length; s++) {
|
||
var u = t[s];
|
||
if (u._worldActive && u.view3d.renderable) {
|
||
var h = u.view3d,
|
||
c = h._geometry,
|
||
l = h._material,
|
||
f = c.isFrag ? c.geometry : c,
|
||
d = l.uniforms;
|
||
if (d.model = u.transform.worldTransform, d.normal && (u.transform._worldID !== h._transformDirty && (h._transformDirty = u.transform._worldID, normalFromMat4(h._cachedNormal, d.model)), d.normal = h._cachedNormal), l !== n) {
|
||
d.lights = this.lightUniforms, d.globals3d = this.globalUniforms, (l.needsUpdate || !this.freezeLights && l.lightSig !== this.lightSig) && (l.needsUpdate = !1, l.build && l.build({
|
||
sig: this.lightSig,
|
||
lights: r
|
||
}, this.fogEnabled), l.lightSig = this.lightSig);
|
||
var p = d.uMapFrame;
|
||
if (p) {
|
||
var m = d.uMap.baseTexture,
|
||
v = d.uMap.frame;
|
||
p.x = v.x / m.width, p.y = v.y / m.height, p.width = v.width / m.width, p.height = v.height / m.height
|
||
}
|
||
}
|
||
if (l.instancing) {
|
||
if (l === n && c === i) {
|
||
o[a++] = u;
|
||
continue
|
||
}
|
||
a && (this.renderInstances(o, a, n, i, e), a = 0), o[a++] = u
|
||
} else a && (this.renderInstances(o, a, n, i, e), a = 0), h.render ? h.render(e) : (e.shader.bind(l), e.state.setState(h.state), e.geometry.bind(f), e.geometry.draw(h.draw, c.size, c.start, c.instanceCount), this.drawCount++);
|
||
n = l, i = c
|
||
}
|
||
}
|
||
a && this.renderInstances(o, a, n, i, e)
|
||
}, View3dSystem.prototype.start = function() {
|
||
this.game.addChild(this.camera), this.game.group.initGroups(["_lights"])
|
||
}, View3dSystem.prototype.entityAddedToGame = function(t) {
|
||
t.view3d && this.layer.add(t), t.isLight && (this.lights.push(t), this.lightsDirty = !0)
|
||
}, View3dSystem.prototype.entityRemovedFromGame = function(t) {
|
||
if (t.view3d && this.layer.remove(t), t.isLight) {
|
||
var e = this.lights.indexOf(t); - 1 !== e && (this.lights.splice(e, 1), this.lightsDirty = !0)
|
||
}
|
||
}, View3dSystem.prototype.empty = function() {
|
||
this.layer.empty(), this.lights.length = 0
|
||
}, View3dSystem.prototype.resize = function(t, e) {
|
||
this.w === t && this.h === e || (this.w = t, this.h = e)
|
||
}, n(View3dSystem, [{
|
||
key: "fogColor",
|
||
set: function(t) {
|
||
this._hexFogColor = t, w.utils.hex2rgb(t, this.globalUniforms.uniforms.uFogColor)
|
||
},
|
||
get: function() {
|
||
return this._hexFogColor
|
||
}
|
||
}, {
|
||
key: "fogDensity",
|
||
set: function(t) {
|
||
this.globalUniforms.uniforms.uFogDensity = t
|
||
},
|
||
get: function() {
|
||
return this.globalUniforms.uniforms.uFogDensity
|
||
}
|
||
}]), View3dSystem
|
||
}(i.default));
|
||
|
||
function normalFromMat4(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],
|
||
l = r * a - n * o,
|
||
f = r * s - i * o,
|
||
d = n * s - i * a,
|
||
p = l * c - f * h + d * u;
|
||
p = 1 / p, t[0] = (a * c - s * h) * p, t[1] = (s * u - o * c) * p, t[2] = (o * h - a * u) * p, t[3] = (i * h - n * c) * p, t[4] = (r * c - i * u) * p, t[5] = (n * u - r * h) * p, t[6] = d * p, t[7] = -f * p, t[8] = l * p
|
||
}
|
||
e.default = l
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = _interopRequireDefault(r(177)),
|
||
i = _interopRequireDefault(r(178)),
|
||
o = _interopRequireDefault(r(419));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var a = function(e) {
|
||
function BasicEntity() {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, BasicEntity);
|
||
var t = 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));
|
||
return t.add(i.default), t.add(o.default), t
|
||
}
|
||
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)
|
||
}(BasicEntity, e), BasicEntity
|
||
}(n.default);
|
||
e.default = a
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var o = r(4),
|
||
n = _interopRequireDefault(r(5)),
|
||
i = _interopRequireDefault(r(420)),
|
||
a = r(421);
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var s = o.vec3.create(),
|
||
u = o.vec3.create(),
|
||
h = o.vec3.create(),
|
||
c = function(n) {
|
||
function Transform(t, e) {
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Transform);
|
||
var r = 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, t, e));
|
||
return r.custom = !1, r.static = !1, r.parent = null, r.dirty = !0, r.position = new i.default(r.onChange, r, 0, 0, 0), r.scale = new i.default(r.onChange, r, 1, 1, 1), r.rotation = new i.default(r.onRotationChange, r, 0, 0, 0), r.localTransform = o.mat4.identity(o.mat4.create()), r.worldTransform = o.mat4.identity(o.mat4.create()), r._localID = 0, r._currentLocalID = -2, r._worldID = 0, r._parentID = -1, r.quat = o.quat.create(), r._rotationDirty = !0, r
|
||
}
|
||
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)
|
||
}(Transform, n), Transform.prototype.extractScale = function(t) {
|
||
var e = this.worldTransform;
|
||
return t[0] = o.vec3.len([e[0], e[1], e[2]]), t[1] = o.vec3.len([e[4], e[5], e[6]]), t[2] = o.vec3.len([e[8], e[9], e[10]]), t
|
||
}, Transform.prototype.extractRotation = function(t) {
|
||
var e = o.mat4.create();
|
||
t = t || this.worldTransform;
|
||
var r = 1 / o.vec3.len([t[0], t[1], t[2]]),
|
||
n = 1 / o.vec3.len([t[4], t[5], t[6]]),
|
||
i = 1 / o.vec3.len([t[8], t[9], t[10]]);
|
||
return e[0] = t[0] * r, e[1] = t[1] * r, e[2] = t[2] * r, e[3] = 0, e[4] = t[4] * n, e[5] = t[5] * n, e[6] = t[6] * n, e[7] = 0, e[8] = t[8] * i, e[9] = t[9] * i, e[10] = t[10] * i, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e
|
||
}, Transform.prototype.getForward = function() {
|
||
var t = this.worldTransform,
|
||
e = new Float32Array([t[8], t[9], t[10]]);
|
||
return o.vec3.normalize(e, e), o.vec3.scale(e, e, -1), e
|
||
}, Transform.prototype.extractPosition = function(t) {
|
||
var e = this.worldTransform;
|
||
return t[0] = e[12], t[1] = e[13], t[2] = e[14], t
|
||
}, Transform.prototype.onChange = function() {
|
||
this._localID++
|
||
}, Transform.prototype.onRotationChange = function() {
|
||
this._localID++, this._rotationDirty = !0
|
||
}, Transform.prototype.init = function(t) {
|
||
this.position.x = t.x || 0, this.position.y = t.y || 0, this.rotation.z = t.r * (Math.PI / 180) || 0
|
||
}, Transform.prototype.reset = function() {
|
||
o.mat4.identity(this.localTransform), o.mat4.identity(this.worldTransform), this._localID = 0, this._currentLocalID = -2, this._worldID = 0, this._parentID = -1
|
||
}, Transform.prototype.applyMatrix = function(t) {
|
||
var e = s,
|
||
r = u,
|
||
n = h;
|
||
(0, a.decompose)(e, r, n, t), this.position.x = e[0], this.position.y = e[1], this.position.z = e[2], this.scale.x = n[0], this.scale.y = n[1], this.scale.z = n[2], this.rotation.x = r[0], this.rotation.y = r[1], this.rotation.z = r[2]
|
||
}, Transform
|
||
}(n.default);
|
||
e.default = c
|
||
}, 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 ObservablePoint(t, e) {
|
||
var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0,
|
||
n = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0,
|
||
i = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 0;
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, ObservablePoint), this._x = r, this._y = n, this._z = i, this.cb = t, this.scope = e
|
||
}
|
||
return ObservablePoint.prototype.set = function(t, e, r) {
|
||
var n = t || 0,
|
||
i = e || (0 !== e ? n : 0),
|
||
o = r || (0 !== r ? n : 0);
|
||
this._x === n && this._y === i && this._z === o || (this._x = n, this._y = i, this._z = o, this.cb.call(this.scope))
|
||
}, ObservablePoint.prototype.copyFrom = function(t) {
|
||
return this._x === t.x && this._y === t.y && this._z === t.z || (this._x = t.x, this._y = t.y, this._z = t.z, this.cb.call(this.scope)), this
|
||
}, ObservablePoint.prototype.copyTo = function(t) {
|
||
return t.set(this._x, this._y, this._z), t
|
||
}, n(ObservablePoint, [{
|
||
key: "x",
|
||
get: function() {
|
||
return this._x
|
||
},
|
||
set: function(t) {
|
||
this._x !== t && (this._x = t, this.cb.call(this.scope))
|
||
}
|
||
}, {
|
||
key: "y",
|
||
get: function() {
|
||
return this._y
|
||
},
|
||
set: function(t) {
|
||
this._y !== t && (this._y = t, this.cb.call(this.scope))
|
||
}
|
||
}, {
|
||
key: "z",
|
||
get: function() {
|
||
return this._z
|
||
},
|
||
set: function(t) {
|
||
this._z !== t && (this._z = t, this.cb.call(this.scope))
|
||
}
|
||
}]), ObservablePoint
|
||
}();
|
||
e.default = i
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0, e.decompose = function(t, e, r, n) {
|
||
var i = n,
|
||
o = l.vec3.len(l.vec3.set(d, i[0], i[1], i[2])),
|
||
a = l.vec3.len(l.vec3.set(d, i[4], i[5], i[6])),
|
||
s = l.vec3.len(l.vec3.set(d, i[8], i[9], i[10]));
|
||
l.mat4.determinant(n) < 0 && (o = -o);
|
||
t[0] = i[12], t[1] = i[13], t[2] = i[14], l.mat4.copy(p, n);
|
||
var u = 1 / o,
|
||
h = 1 / a,
|
||
c = 1 / s;
|
||
return p[0] *= u, p[1] *= u, p[2] *= u, p[4] *= h, p[5] *= h, p[6] *= h, p[8] *= c, p[9] *= c, p[10] *= c, e = (0, f.eulerFromRotationMatrix)(e, p, "XYZ"), r[0] = o, r[1] = a, r[2] = s, this
|
||
};
|
||
var l = r(4),
|
||
f = r(422),
|
||
d = l.vec3.create(),
|
||
p = l.mat4.create()
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0, e.eulerFromRotationMatrix = function(t, e, r) {
|
||
var n = function(t, e, r) {
|
||
return Math.min(Math.max(t, e), r)
|
||
},
|
||
i = e,
|
||
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],
|
||
p = 0,
|
||
m = 0,
|
||
v = 0;
|
||
"XYZ" === (r = r || "XYZ") ? (m = Math.asin(n(s, -1, 1)), v = Math.abs(s) < .99999 ? (p = Math.atan2(-c, d), Math.atan2(-a, o)) : (p = Math.atan2(f, h), 0)) : "YXZ" === r ? (p = Math.asin(-n(c, -1, 1)), v = Math.abs(c) < .99999 ? (m = Math.atan2(s, d), Math.atan2(u, h)) : (m = Math.atan2(-l, o), 0)) : "ZXY" === r ? (p = Math.asin(n(f, -1, 1)), v = Math.abs(f) < .99999 ? (m = Math.atan2(-l, d), Math.atan2(-a, h)) : (m = 0, Math.atan2(u, o))) : "ZYX" === r ? (m = Math.asin(-n(l, -1, 1)), v = Math.abs(l) < .99999 ? (p = Math.atan2(f, d), Math.atan2(u, o)) : (p = 0, Math.atan2(-a, h))) : "YZX" === r ? (v = Math.asin(n(u, -1, 1)), m = Math.abs(u) < .99999 ? (p = Math.atan2(-c, h), Math.atan2(-l, o)) : (p = 0, Math.atan2(s, d))) : "XZY" === r && (v = Math.asin(-n(a, -1, 1)), m = Math.abs(a) < .99999 ? (p = Math.atan2(f, h), Math.atan2(s, o)) : (p = Math.atan2(-c, d), 0));
|
||
return t[0] = p, t[1] = m, t[2] = v, t
|
||
}
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n, 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)),
|
||
a = r(4),
|
||
s = r(8),
|
||
u = (n = s) && n.__esModule ? n : {
|
||
default: n
|
||
};
|
||
var h = function() {};
|
||
o.State.prototype.onBlendChange = new u.default("onBlendChange", 1), Object.defineProperty(o.State.prototype, "blend", {
|
||
set: function(t) {
|
||
!!(1 & this.data) !== t && (this.data ^= 1, this.onBlendChange.run())
|
||
}
|
||
});
|
||
var c = function() {
|
||
function View3d(t, e) {
|
||
if (function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, View3d), this.entity = t, this.data = e, this.zdist = 0, this.draw = void 0 === e.draw ? o.DRAW_MODES.TRIANGLES : e.draw, this._geometry = e.geometry, this._material = e.material, this._state = e.state, this.render = e.render, this._cachedNormal = a.mat3.create(), this._transformDirty = -1, this.orderBias = e.orderBias || 0, !this._state) {
|
||
var r = new o.State;
|
||
r.depthTest = !0, r.culling = !0, r.blend = !1, r.clockwiseFrontFace = !0, this._state = r
|
||
}
|
||
this._state.onBlendChange.add(this), this.renderable = !0, this.group = null, this.instanced = !1, this.layer = null, this.id = null, this.onChange = h, this.tick = -1
|
||
}
|
||
return View3d.prototype.onBlendChange = function() {
|
||
this.layer && this.layer.onChange(this.entity)
|
||
}, View3d.prototype.added = function() {
|
||
this.entity.game && this.entity.game.system.view3d.entityAddedToGame(this.entity)
|
||
}, View3d.prototype.removed = function() {
|
||
this.entity.game && this.entity.game.system.view3d.entityRemovedFromGame(this.entity)
|
||
}, i(View3d, [{
|
||
key: "state",
|
||
set: function(t) {
|
||
this._state !== t && (this._state.onBlendChange.remove(this), this._state = t, this._state.onBlendChange.add(this))
|
||
},
|
||
get: function() {
|
||
return this._state
|
||
}
|
||
}, {
|
||
key: "material",
|
||
set: function(t) {
|
||
this._material !== t && (this._material = t, this.layer && this.layer.onChange(this.entity))
|
||
},
|
||
get: function() {
|
||
return this._material
|
||
}
|
||
}, {
|
||
key: "geometry",
|
||
set: function(t) {
|
||
this._geometry !== t && (this._geometry = t, this.layer && this.layer.onChange(this.entity))
|
||
},
|
||
get: function() {
|
||
return this._geometry
|
||
}
|
||
}]), View3d
|
||
}();
|
||
e.default = c
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n, c = r(4),
|
||
i = r(5),
|
||
o = (n = i) && n.__esModule ? n : {
|
||
default: n
|
||
},
|
||
a = r(0);
|
||
var l = new Float32Array(3),
|
||
f = new Float32Array(3),
|
||
d = new Float32Array(3),
|
||
p = new Float32Array([0, 0, 1]),
|
||
s = function(n) {
|
||
function CameraComponent(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, CameraComponent);
|
||
var r = 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, t, e));
|
||
return r.fov = e.fov || 60, r.near = e.near || .1, r.far = e.far || 1e3, r.projection = c.mat4.create(), r.view = c.mat4.create(), r.forward = new a.Point, r.position = new a.Point, r.mode = e.mode || CameraComponent.PERSPECTIVE, r.lookAtTarget = null, r.custom = !1, r.size = 170, r.dirty = 0, r
|
||
}
|
||
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)
|
||
}(CameraComponent, n), CameraComponent.prototype.updateProjection = function(t, e) {
|
||
if (this.mode === CameraComponent.PERSPECTIVE) c.mat4.perspective(this.projection, this.fov * (Math.PI / 180), t / e, this.near, this.far);
|
||
else {
|
||
var r = e / t,
|
||
n = this.size;
|
||
c.mat4.ortho(this.projection, -n, n, -n * r, n * r, this.near, this.far)
|
||
}
|
||
var i = d;
|
||
if (this.custom) {
|
||
var o = c.mat4.invert(c.mat4.create(), this.view);
|
||
i[0] = o[8], i[1] = o[9], i[2] = o[10], c.vec3.normalize(i, i), c.vec3.scale(i, i, -1), this.forward.x = i[0], this.forward.y = i[1], this.forward.z = i[2], this.position.x = o[12], this.position.y = o[13], this.position.z = o[14]
|
||
} else {
|
||
var a = this.entity.transform.worldTransform;
|
||
if (this.lookAtTarget) {
|
||
var s = l,
|
||
u = f,
|
||
h = this.lookAtTarget;
|
||
s[0] = a[12], s[1] = a[13], s[2] = a[14], u[0] = h.x, u[1] = h.y, u[2] = h.z, c.mat4.lookAt(this.view, s, u, p), c.vec3.sub(i, s, u), c.vec3.normalize(i, i)
|
||
} else i[0] = a[8], i[1] = a[9], i[2] = a[10], c.vec3.normalize(i, i), c.vec3.scale(i, i, -1), c.mat4.invert(this.view, a);
|
||
this.forward.x = i[0], this.forward.y = i[1], this.forward.z = i[2], this.position.x = a[12], this.position.y = a[13], this.position.z = a[14]
|
||
}
|
||
this.dirty++
|
||
}, CameraComponent
|
||
}(o.default);
|
||
(e.default = s).id = "camera", s.PERSPECTIVE = 0, s.ORTHOGRAPHIC = 1
|
||
}, 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
|
||
}
|
||
}(),
|
||
i = 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));
|
||
var o = function() {
|
||
function AmbientLight(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1;
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, AmbientLight), this._color = new Float32Array(3), this._hexColor = 0, this.color = 16777215, this._intensity = e, this.output = new Float32Array(3), this.dirty = !0
|
||
}
|
||
return AmbientLight.prototype.update = function() {
|
||
if (this.dirty) {
|
||
this.dirty = !1;
|
||
var t = this.output,
|
||
e = this._color,
|
||
r = this._intensity;
|
||
t[0] = Math.pow(e[0] * r, 2.2), t[1] = Math.pow(e[1] * r, 2.2), t[2] = Math.pow(e[2] * r, 2.2)
|
||
}
|
||
}, n(AmbientLight, [{
|
||
key: "color",
|
||
set: function(t) {
|
||
this._hexColor !== t && (this._hexColor = t, i.utils.hex2rgb(t, this._color), this.dirty = !0)
|
||
},
|
||
get: function() {
|
||
return this._hexColor
|
||
}
|
||
}, {
|
||
key: "intensity",
|
||
set: function(t) {
|
||
this._intensity !== t && (this._intensity = t, this.dirty = !0)
|
||
},
|
||
get: function() {
|
||
return this._intensity
|
||
}
|
||
}]), AmbientLight
|
||
}();
|
||
e.default = o
|
||
}, 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 s = function(t, e) {
|
||
var r = t.view3d,
|
||
n = e.view3d,
|
||
i = r._geometry,
|
||
o = n._geometry,
|
||
a = i.isFrag ? i.geometry : i,
|
||
s = o.isFrag ? o.geometry : o;
|
||
return r.orderBias - n.orderBias || r._material.program.id - n._material.program.id || r._material.id - n._material.id || r.geometry.id - n.geometry.id || a.id - s.id || r.state.data - n.state.data || r.zdist - n.zdist
|
||
},
|
||
u = function(t, e) {
|
||
var r = t.view3d,
|
||
n = e.view3d;
|
||
return r.orderBias - n.orderBias || r.zdist - n.zdist
|
||
},
|
||
n = function() {},
|
||
i = function() {
|
||
function Layer() {
|
||
var t = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0];
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, Layer), this.opaqueRenderables = [], this.transparentRenderables = [], this.tick = 0, this.changedEntities = [], this.changedEntityCount = 0, this.allowInstancing = t, this.instances = {}
|
||
}
|
||
return Layer.prototype.updateZDist = function(t, e) {
|
||
for (var r = e.camera.forward, n = e.camera.position, i = n.x, o = n.y, a = n.z, s = r.x, u = r.y, h = r.z, c = 0; c < t.length; c++) {
|
||
var l = t[c],
|
||
f = l.transform.worldTransform;
|
||
l.view3d.zdist = -((f[12] - i) * s + (f[13] - o) * u + (f[14] - a) * h)
|
||
}
|
||
}, Layer.prototype.update = function(t) {
|
||
this.tick++;
|
||
for (var e = !1, r = 0; r < this.changedEntityCount; r++) {
|
||
var n = this.changedEntities[r],
|
||
i = n.view3d;
|
||
if (!n._gc) {
|
||
var o = i._state.blend ? this.transparentRenderables : this.opaqueRenderables;
|
||
if (i.group !== o) {
|
||
if (i.group) {
|
||
var a = i.group.indexOf(n); - 1 !== a && i.group.splice(a, 1)
|
||
}(i.group = o).push(n), o === this.transparentRenderables ? !0 : e = !0
|
||
}
|
||
}
|
||
}
|
||
e && this.opaqueRenderables.sort(s), this.updateZDist(this.transparentRenderables, t), this.transparentRenderables.sort(u), this.changedEntityCount = 0
|
||
}, Layer.prototype.add = function(t) {
|
||
(t.view3d.layer = this).onChange(t)
|
||
}, Layer.prototype.onChange = function(t) {
|
||
var e = t.view3d;
|
||
this.allowInstancing || (t.view3d._material.instancing = !1), e.tick !== this.tick && (e.tick = this.tick, this.changedEntities[this.changedEntityCount++] = t)
|
||
}, Layer.prototype.remove = function(t) {
|
||
var e = t.view3d.group;
|
||
if (e) {
|
||
var r = e.indexOf(t); - 1 !== r && e.splice(r, 1)
|
||
}
|
||
t.view3d.onChange = n, t.view3d.group = null, t.view3d.layer = null, t.view3d.id = null
|
||
}, Layer.prototype.empty = function() {
|
||
this.opaqueRenderables.forEach(function(t) {
|
||
t.view3d.onChange = n, t.view3d.group = null, t.view3d.layer = null, t.view3d.id = null, t.view3d.instanced = !1
|
||
}), this.transparentRenderables.forEach(function(t) {
|
||
t.view3d.onChange = n, t.view3d.group = null, t.view3d.layer = null, t.view3d.id = null, t.view3d.instanced = !1
|
||
}), this.opaqueRenderables.length = 0, this.transparentRenderables.length = 0, this.changedEntities.length = 0, this.changedEntityCount = 0, this.instances = {}
|
||
}, Layer
|
||
}();
|
||
e.default = i
|
||
}, function(t, e, r) {
|
||
"use strict";
|
||
e.__esModule = !0;
|
||
var n = _interopRequireDefault(r(13)),
|
||
i = _interopRequireDefault(r(175));
|
||
|
||
function _interopRequireDefault(t) {
|
||
return t && t.__esModule ? t : {
|
||
default: t
|
||
}
|
||
}
|
||
var o = [],
|
||
a = function(n) {
|
||
function GroupSystem(t) {
|
||
var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
|
||
! function(t, e) {
|
||
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
||
}(this, GroupSystem);
|
||
var r = 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, t, e));
|
||
return r.groups = {}, e.groups && r.initGroups(e.groups), t.game.groups = r.groups, r
|
||
}
|
||
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)
|
||
}(GroupSystem, n), GroupSystem.prototype.entityAddedToGame = function(t) {
|
||
for (var e = 0; e < t.groups.length; e++) {
|
||
var r = t.groups[e],
|
||
n = this.groups[r];
|
||
n || (n = this.groups[r] = new i.default), n.add(t)
|
||
}
|
||
}, GroupSystem.prototype.entityRemovedFromGame = function(t) {
|
||
for (var e = 0; e < t.groups.length; e++) {
|
||
var r = t.groups[e];
|
||
this.groups[r].remove(t)
|
||
}
|
||
}, GroupSystem.prototype.addGroup = function(t) {
|
||
for (var e = 0; e < t.children.length; e++) this.add(t.children[e])
|
||
}, GroupSystem.prototype.initGroups = function(t) {
|
||
for (var e = 0; e < t.length; e++) {
|
||
var r = t[e],
|
||
n = this.groups[r];
|
||
n || (n = this.groups[r] = new i.default)
|
||
}
|
||
}, GroupSystem.prototype.find = function(t, e) {
|
||
var r = this.groups;
|
||
if (e) {
|
||
if (r[e])
|
||
for (var n = r[e].children, i = 0; i < n.length; i++)
|
||
if (n[i].name === t) return n[i]
|
||
} else
|
||
for (var o = this.game.allEntities.children, a = 0; a < o.length; a++)
|
||
if (o[a].name === t) return o[a];
|
||
return null
|
||
}, GroupSystem.prototype.findAll = function(t, e) {
|
||
var r = this.game.groups;
|
||
if (!r[e]) return null;
|
||
for (var n = r[e].children, i = o.length = 0; i < n.length; i++) n[i].data.name === t && o.push(n[i]);
|
||
return o
|
||
}, GroupSystem.prototype.empty = function() {
|
||
var t = this.groups;
|
||
for (var e in t) t[e].empty()
|
||
}, GroupSystem
|
||
}(n.default);
|
||
e.default = a
|
||
}, function(t, e) {
|
||
t.exports = "\nattribute vec3 position;\nattribute vec3 normals;\nattribute vec2 uvs;\n\nuniform mat4 projection;\nuniform mat4 view;\nuniform vec3 uEyePosition;\n\n\nvarying vec3 vNormal;\nvarying vec3 vPosition;\nvarying vec3 vEyePosition;\n\n#ifdef SKINNING\n attribute vec4 weights;\n attribute vec4 bone_indices;\n\n uniform mat4 bones[60];\n#endif\n\n#ifdef INSTANCING\n\tattribute vec3 i_mat1;\n\tattribute vec3 i_mat2;\n\tattribute vec3 i_mat3;\n\tattribute vec3 i_mat4;\n\n attribute vec3 i_norm1;\n\tattribute vec3 i_norm2;\n\tattribute vec3 i_norm3;\n\n#else\n uniform mat4 model;\n uniform mat3 normal;\n#endif\n\n#if defined( MAP ) || defined( EMISSIVE_MAP ) || defined( OCCLUSION_MAP )\n\tvarying vec2 vUv;\n uniform vec4 uMapFrame;\n#endif\n\n#ifdef FOG\n uniform float uFogDensity;\n varying float vFogFactor;\n#endif\n\n#ifdef ENV_REFLECT\n varying vec3 vReflection;\n#endif\n\n#HOOK_VERTEX_START\n\nvoid main() {\n\n\t\n #if defined( MAP ) || defined( EMISSIVE_MAP )\n\t//vUv = uvs;\n\tvUv = (uvs * uMapFrame.zw ) + uMapFrame.xy;\n\t#endif\n\n #ifdef INSTANCING\n\n mat4 model = mat4(vec4(i_mat1, 0.), \n vec4(i_mat2, 0.), \n vec4(i_mat3, 0.), \n vec4(i_mat4, 1.));\n\n mat3 normal = mat3(i_norm1, \n i_norm2, \n i_norm3);\n\n #endif\n\n vec4 transformed = vec4(position, 1.0);;\n\n vNormal = normalize( normal * normals);\n \n #ifdef SKINNING\n\n mat4 boneMatrix = mat4(0.0);\n\n mat4 skinMatrix = weights.x * bones[int(bone_indices.x)] +\n weights.y * bones[int(bone_indices.y)] +\n weights.z * bones[int(bone_indices.z)] +\n weights.w * bones[int(bone_indices.w)];\n\n boneMatrix += bones[int(bone_indices.x)] * weights.x;\n boneMatrix += bones[int(bone_indices.y)] * weights.y;\n boneMatrix += bones[int(bone_indices.z)] * weights.z;\n boneMatrix += bones[int(bone_indices.w)] * weights.w;\n \n transformed = boneMatrix * transformed;\n\n vNormal = normalize( normal * (vec4(skinMatrix * vec4(normals,0.0)).xyz) );\n\n #endif\n\n\n #HOOK_VERTEX_MAIN\n\n\tvec4 worldPosition = model * transformed;\n vec4 worldViewPosition = projection * view * worldPosition;\n\n vPosition = worldPosition.xyz;\n vEyePosition = uEyePosition;\n \n gl_Position = worldViewPosition;\n \n \n vec3 eyeToSurfaceDir = normalize(vPosition - uEyePosition);\n vec3 direction = reflect(eyeToSurfaceDir, vNormal);\n\n #ifdef ENV_REFLECT\n vReflection = direction;//reflect(cameraToVertex, worldNormal); // calculate reflection vector R \n #endif\n\n #ifdef FOG\n\n #define LOG2 1.442695\n\n \n float fogDistance = length(worldViewPosition);\n float fogAmount = 1. - exp2(-uFogDensity * uFogDensity * fogDistance * fogDistance * LOG2);\n fogAmount = clamp(fogAmount, 0., 1.);\n \n vFogFactor = fogAmount;\n\n #endif\n\n\t#HOOK_VERTEX_END\n\n}\n"
|
||
}, function(t, e) {
|
||
t.exports = "\n\nuniform vec3 uGlobalAmbient;\n\nuniform float uOpacity;\n\nvarying vec3 vNormal;\nvarying vec3 vPosition;\n\nvarying vec3 vEyePosition;\n\n\n#ifdef COLOR\nuniform vec3 uColor;\n\n#endif\n\n#ifdef OCCLUSION_MAP\nuniform sampler2D uOcclusionMap;\n#endif\n\n#if defined( MAP ) || defined( EMISSIVE_MAP ) || defined( OCCLUSION_MAP )\nvarying vec2 vUv;\n#endif\n\n#ifdef MAP\nuniform sampler2D uMap;\n#endif\n\n#ifdef FOG\n varying float vFogFactor;\n uniform vec3 uFogColor;\n#endif\n\n#ifdef ENV_REFLECT\n varying vec3 vReflection;\n uniform samplerCube uEnviromentMap;\n#endif\n\n#HOOK_LIGHT_UNIFROMS\n\n/** \n gamma stuff!\n*/\nvec3 gammaCorrectInput(vec3 color) {\n return pow(color, vec3(2.2));\n}\n\nfloat gammaCorrectInput(float color) {\n return pow(color, 2.2);\n}\n\nvec4 gammaCorrectInput(vec4 color) {\n return vec4(pow(color.rgb, vec3(2.2)), color.a);\n}\n\nvec3 gammaCorrectOutput(vec3 color) {\n color += vec3(0.0000001);\n return pow(color, vec3(0.45));\n}\n\nvec4 texture2DSRGB(sampler2D tex, vec2 uv) {\n vec4 rgba = texture2D(tex, uv);\n rgba.rgb = gammaCorrectInput(rgba.rgb);\n return rgba;\n}\n\nvec4 textureCubeSRGB(samplerCube tex, vec3 uvw) {\n vec4 rgba = textureCube(tex, uvw);\n rgba.rgb = gammaCorrectInput(rgba.rgb);\n return rgba;\n}\n\n\n/// speculer lights...\nuniform vec3 uSpecular;\n\n#ifdef SHININESS_FLOAT\n uniform float uShininess;\n#endif\n\n#ifdef SHININESS_MAP\n uniform sampler2D uShininessMap;\n#endif\n\n// we write the specular to here..\nfloat dShininess;\n\n// glosyness..\nvoid getShininess() {\n dShininess = 1.0;\n #ifdef SHININESS_FLOAT\n dShininess *= uShininess;\n #endif\n #ifdef SHININESS_MAP\n dShininess *= texture2D(uShininessMap, vUv).r;\n #endif\n \n //IOS hack.. \n dShininess += 0.0000001;\n}\n\n/// emissive lights...\n#ifdef EMISSIVE_FLOAT\n uniform float uEmissive;\n#endif\n\n#ifdef EMISSIVE_COLOR\n uniform vec3 uEmissiveColor;\n#endif\n\n#ifdef EMISSIVE_MAP\n uniform sampler2D uEmissiveMap;\n#endif\n\n// we write the specular to here..\nvec3 dEmissive;\n\n// glosyness..\nvec3 getEmission() {\n vec3 emission = vec3(1.);\n\n #ifdef EMISSIVE_FLOAT\n emission *= uEmissive;\n #endif\n\n #ifdef EMISSIVE_COLOR\n emission *= uEmissiveColor;\n #endif\n \n #ifdef EMISSIVE_MAP\n emission *= texture2D(uEmissiveMap, vUv).rgb;\n #endif\n \n// emission*=0.1;\n return emission;\n}\n\nfloat diffuseLighting(vec3 normal, vec3 lightDirection)\n{\n\treturn max(dot(normal, -lightDirection), 0.0);\n}\n\nfloat specularLighting(vec3 normal, vec3 eyeToSurfaceDir, vec3 lightDirection) \n{\n vec3 reflection = normalize(reflect(eyeToSurfaceDir, normal));\n\n float specPow = dShininess;\n\n return pow(max(dot(reflection, -lightDirection), 0.0), specPow + 0.0001);\n}\n\n// float specularLighting(vec3 normal, vec3 eyeToSurfaceDir, vec3 lightDirection) \n// {\n// vec3 R = normalize(reflect(lightDirection, normal));\n\n// float specPow = dShininess;\n\n// return pow(max(dot(eyeToSurfaceDir, R), 0.0), specPow + 0.0001);\n// }\n// float specularLighting2(vec3 normal, vec3 L, vec3 lightDirection) \n// {\n// vec3 h = normalize( -normalize(lightDirection) + normalize(uEyePosition) );\n// float nh = max( dot( h, vNormal ), 0.0 );\n// float dGlossiness = 100.;\n// float specPow = exp2(dGlossiness * 11.0);\n// // glossiness is linear, power is not; 0 - 2048\n \n// // Hack: On Mac OS X, calling pow with zero for the exponent generates hideous artifacts so bias up a little\n// specPow = max(specPow, 0.0001);\n// return pow(nh, specPow) * (specPow + 2.0) / 8.0;\n// }\n\n#define saturate(a) clamp( a, 0.0, 1.0 )\n\n\n#HOOK_FRAGMENT_START\n\nvoid main() {\n vec4 finalColor = vec4(0.0,0.0,0.0, uOpacity);\n vec4 diffuseColor = vec4(1., 1., 1., uOpacity);\n\n #ifdef COLOR\n diffuseColor.rgb *= uColor;\n #endif\n\n #ifdef MAP\n diffuseColor *= texture2DSRGB(uMap, vUv);\n \n #endif\n\n #ifdef OCCLUSION_MAP\n diffuseColor *= texture2DSRGB(uOcclusionMap, vUv);\n #endif\n\n vec3 eyeToSurfaceDir = normalize(vPosition - vEyePosition);\n \n vec3 worldNormal = normalize(vNormal);\n\n vec3 lighting = vec3(0.0);\n vec3 specular = vec3(0.0);\n\n lighting += uGlobalAmbient;\n\n \n \n // some temp variables \n vec3 lightDirectionNormal;\n vec3 lightDirection;\n float attenuation;\n float distancFromLight;\n\n getShininess();\n \n vec3 reflection = vec3(1.);\n\n #ifdef ENV_REFLECT\n \n reflection = textureCubeSRGB(uEnviromentMap, normalize(vReflection) ).rgb;\n \n #endif\n\n // do lighting..\n #HOOK_LIGHT;\n\n\n //finalColor = mix(finalColor, reflection, 0.1); \n \n // finalColor.rgb = diffuseColor.rgb * lighting;// + uEmissive;\n\n finalColor.rgb = (diffuseColor.rgb * lighting * reflection) + specular;\n// finalColor.rgb = mix(diffuseColor.rgb * lighting, specular, 1.);\n // finalColor.rgb += specular;//mix(finalColor.rgb, specularLighting, )\n //finalColor *= diffuseColor.a;\n \n #HOOK_FRAGMENT_MAIN\n\n \n #ifdef EMISSIVE\n\n finalColor.rgb += getEmission() * reflection.rgb;\n\n #endif\n\n gl_FragColor = vec4(finalColor.rgb * diffuseColor.a, diffuseColor.a);\n \n #HOOK_FRAGMENT_END\n\n #ifdef FOG\n \n gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor * finalColor.a, vFogFactor);\n\n #endif\n\n gl_FragColor.rgb = gammaCorrectOutput(gl_FragColor.rgb);\n}\n"
|
||
}, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function(t, e) {
|
||
t.exports = "#define saturate(a) clamp( a, 0.0, 1.0 )\n\nattribute vec3 position;\nattribute vec3 normals;\nattribute vec2 uvs;\n\nuniform mat4 projection;\nuniform mat4 view;\n\nvarying vec3 vEyePosition;\n\n// intensty is multiplied in..\nuniform vec3 uGlobalAmbient;\n\n#ifdef INSTANCING\n\tattribute vec3 i_mat1;\n\tattribute vec3 i_mat2;\n\tattribute vec3 i_mat3;\n\tattribute vec3 i_mat4;\n\n attribute vec3 i_norm1;\n\tattribute vec3 i_norm2;\n\tattribute vec3 i_norm3;\n\n#else\n uniform mat4 model;\n uniform mat3 normal;\n#endif\n\n#if defined( MAP ) || defined( EMISSIVE_MAP ) || defined( OCCLUSION_MAP )\n\tvarying vec2 vUv;\n uniform vec4 uMapFrame;\n#endif\n\n#ifdef FOG\n uniform float uFogDensity;\n varying float vFogFactor;\n#endif\n\nvarying vec3 vLighting;\n\n#HOOK_LIGHT_UNIFROMS\n\n/// speculer lights...\nuniform vec3 uSpecular;\n\n#ifdef SHININESS_FLOAT\n uniform float uShininess;\n#endif\n\n// we write the specular to here..\nfloat dShininess;\n\n// glosyness..\nvoid getShininess() {\n dShininess = 1.0;\n #ifdef SHININESS_FLOAT\n dShininess *= uShininess;\n #endif\n \n //IOS hack.. \n dShininess += 0.0000001;\n}\n\nfloat diffuseLighting(vec3 normal, vec3 lightDirection)\n{\n\treturn max(dot(normal, -lightDirection), 0.0);\n}\n\nfloat specularLighting(vec3 normal, vec3 eyeToSurfaceDir, vec3 lightDirection) \n{\n return 0.;\n \n vec3 reflection = normalize(reflect(eyeToSurfaceDir, normal));\n\n float specPow = dShininess;\n\n return pow(max(dot(reflection, -lightDirection), 0.0), specPow + 0.0001);\n}\n\n\n#HOOK_VERTEX_START\n\nvoid main() {\n\n\t\n\t#ifdef MAP\n\t\tvUv = (uvs * uMapFrame.zw ) + uMapFrame.xy;\n\t#endif\n\n #ifdef INSTANCING\n\n mat4 model = mat4(vec4(i_mat1, 0.), \n vec4(i_mat2, 0.), \n vec4(i_mat3, 0.), \n vec4(i_mat4, 1.));\n\n mat3 normal = mat3(i_norm1, \n i_norm2, \n i_norm3);\n\n #endif\n\n\tvec3 transformed = position;\n\n\t#HOOK_VERTEX_MAIN\n\n\tvec4 worldPosition = model * vec4(transformed, 1.0);\n\tvec4 worldViewPosition = projection * view * worldPosition;\n\n vec3 lighting = vec3(0.0);\n vec3 specular = vec3(0.0);\n\n lighting += uGlobalAmbient;\n \n vec3 vPosition = worldPosition.xyz;\n\n vec3 eyeToSurfaceDir = normalize(vPosition - vEyePosition);\n \n vec3 worldNormal = normalize(normal * normals);\n \n // some temp variables \n vec3 lightDirectionNormal;\n vec3 lightDirection;\n float attenuation;\n float distancFromLight;\n\n\n #HOOK_LIGHT;\n\n vLighting = lighting;\n\n\tgl_Position = worldViewPosition;\n\n\t#ifdef FOG\n float depth = worldViewPosition.z;\n vFogFactor = exp(-depth * uFogDensity);\n vFogFactor = clamp(vFogFactor, 0.0, 1.0);\n #endif\n\n \n\t#HOOK_VERTEX_END\n\n}\n"
|
||
}, function(t, e) {
|
||
t.exports = "\n// basic.frag\n\n\nuniform float uOpacity;\n\nuniform vec3 uAmbiantLight;\n\nvarying vec3 vLighting;\n\n#ifdef COLOR\n uniform vec3 uColor;\n#endif\n\n#ifdef MAP\n varying vec2 vUv;\n uniform sampler2D uMap;\n#endif\n\n#ifdef FOG\n varying float vFogFactor;\n uniform vec3 uFogColor;\n#endif\n\n/** \n gamma stuff!\n*/\nvec3 gammaCorrectInput(vec3 color) {\n return pow(color, vec3(2.2));\n}\n\nfloat gammaCorrectInput(float color) {\n return pow(color, 2.2);\n}\n\nvec4 gammaCorrectInput(vec4 color) {\n return vec4(pow(color.rgb, vec3(2.2)), color.a);\n}\n\nvec3 gammaCorrectOutput(vec3 color) {\n color += vec3(0.0000001);\n return pow(color, vec3(0.45));\n}\n\nvec4 texture2DSRGB(sampler2D tex, vec2 uv) {\n vec4 rgba = texture2D(tex, uv);\n rgba.rgb = gammaCorrectInput(rgba.rgb);\n return rgba;\n}\n\n/// emissive lights...\n#ifdef EMISSIVE_FLOAT\n uniform float uEmissive;\n#endif\n\n#ifdef EMISSIVE_FLOEMISSIVE_COLORAT\n uniform vec3 uEmissiveColor;\n#endif\n\n#ifdef EMISSIVE_MAP\n uniform sampler2D uEmissiveMap;\n#endif\n\n// we write the specular to here..\nvec3 dEmissive;\n\n// glosyness..\nvec3 getEmission() {\n vec3 emission = vec3(1.);\n\n #ifdef EMISSIVE_FLOAT\n emission *= uEmissive;\n #endif\n\n #ifdef EMISSIVE_COLOR\n emission *= uEmissiveColor;\n #endif\n \n #ifdef EMISSIVE_MAP\n emission *= texture2D(uEmissiveMap, vUv).rgb;\n #endif\n \n return emission;\n}\n\n#HOOK_FRAGMENT_START\n\nvoid main() {\n vec4 finalColor = vec4(0.0,0.0,0.0, uOpacity);\n vec4 diffuseColor = vec4(1., 1., 1., uOpacity);\n\n #ifdef COLOR\n diffuseColor.rgb *= uColor;\n #endif\n\n #ifdef MAP\n diffuseColor *= texture2DSRGB(uMap, vUv);\n #endif\n\n finalColor.rgb = diffuseColor.rgb * vLighting;\n\n #HOOK_FRAGMENT_MAIN\n\n #ifdef EMISSIVE\n\n finalColor.rgb += getEmission();\n\n #endif\n\n gl_FragColor = vec4(finalColor.rgb * finalColor.a, finalColor.a);\n \n #HOOK_FRAGMENT_END\n\n \n #ifdef FOG\n gl_FragColor.rgb = mix(uFogColor, gl_FragColor.rgb, vFogFactor);\n #endif\n\n gl_FragColor.rgb = gammaCorrectOutput(gl_FragColor.rgb);\n}\n"
|
||
}, , , , , , , , , , , function(t, e) {
|
||
t.exports = function(t) {
|
||
if (!t.webpackPolyfill) {
|
||
var e = Object.create(t);
|
||
e.children || (e.children = []), Object.defineProperty(e, "loaded", {
|
||
enumerable: !0,
|
||
get: function() {
|
||
return e.l
|
||
}
|
||
}), Object.defineProperty(e, "id", {
|
||
enumerable: !0,
|
||
get: function() {
|
||
return e.i
|
||
}
|
||
}), Object.defineProperty(e, "exports", {
|
||
enumerable: !0
|
||
}), e.webpackPolyfill = 1
|
||
}
|
||
return e
|
||
}
|
||
}]
|
||
]) |