text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ccpwgl_int=t():e.ccpwgl_int=t()}(window,(function(){return function(e){var t=window.webpackHotUpdateccpwgl_int;window.webpackHotUpdateccpwgl_int=function(e,r){!function(e,t){if(!R[e]||!_[e])return;for(var r in _[e]=!1,t)Object.prototype.hasOwnProperty.call(t,r)&&(p[r]=t[r]);0==--m&&0===b&&S()}(e,r),t&&t(e,r)};var r,n=!0,i="a27ed43f7bbb3a78e75d",a={},o=[],s=[];function u(e){var t=I[e];if(!t)return D;var n=function(n){return t.hot.active?(I[n]?-1===I[n].parents.indexOf(e)&&I[n].parents.push(e):(o=[e],r=n),-1===t.children.indexOf(n)&&t.children.push(n)):(console.warn("[HMR] unexpected require("+n+") from disposed module "+e),o=[]),D(n)},i=function(e){return{configurable:!0,enumerable:!0,get:function(){return D[e]},set:function(t){D[e]=t}}};for(var a in D)Object.prototype.hasOwnProperty.call(D,a)&&"e"!==a&&"t"!==a&&Object.defineProperty(n,a,i(a));return n.e=function(e){return"ready"===f&&h("prepare"),b++,D.e(e).then(t,(function(e){throw t(),e}));function t(){b--,"prepare"===f&&(g[e]||T(e),0===b&&0===m&&S())}},n.t=function(e,t){return 1&t&&(e=n(e)),D.t(e,-2&t)},n}function c(t){var n={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_selfInvalidated:!1,_disposeHandlers:[],_main:r!==t,active:!0,accept:function(e,t){if(void 0===e)n._selfAccepted=!0;else if("function"==typeof e)n._selfAccepted=e;else if("object"==typeof e)for(var r=0;r<e.length;r++)n._acceptedDependencies[e[r]]=t||function(){};else n._acceptedDependencies[e]=t||function(){}},decline:function(e){if(void 0===e)n._selfDeclined=!0;else if("object"==typeof e)for(var t=0;t<e.length;t++)n._declinedDependencies[e[t]]=!0;else n._declinedDependencies[e]=!0},dispose:function(e){n._disposeHandlers.push(e)},addDisposeHandler:function(e){n._disposeHandlers.push(e)},removeDisposeHandler:function(e){var t=n._disposeHandlers.indexOf(e);t>=0&&n._disposeHandlers.splice(t,1)},invalidate:function(){switch(this._selfInvalidated=!0,f){case"idle":(p={})[t]=e[t],h("ready");break;case"ready":A(t);break;case"prepare":case"check":case"dispose":case"apply":(y=y||[]).push(t)}},check:w,apply:O,status:function(e){if(!e)return f;l.push(e)},addStatusHandler:function(e){l.push(e)},removeStatusHandler:function(e){var t=l.indexOf(e);t>=0&&l.splice(t,1)},data:a[t]};return r=void 0,n}var l=[],f="idle";function h(e){f=e;for(var t=0;t<l.length;t++)l[t].call(null,e)}var d,p,v,y,m=0,b=0,g={},_={},R={};function E(e){return+e+""===e?+e:e}function w(e){if("idle"!==f)throw new Error("check() is only allowed in idle status");return n=e,h("check"),(t=1e4,t=t||1e4,new Promise((function(e,r){if("undefined"==typeof XMLHttpRequest)return r(new Error("No browser support"));try{var n=new XMLHttpRequest,a=D.p+""+i+".hot-update.json";n.open("GET",a,!0),n.timeout=t,n.send(null)}catch(e){return r(e)}n.onreadystatechange=function(){if(4===n.readyState)if(0===n.status)r(new Error("Manifest request to "+a+" timed out."));else if(404===n.status)e();else if(200!==n.status&&304!==n.status)r(new Error("Manifest request to "+a+" failed."));else{try{var t=JSON.parse(n.responseText)}catch(e){return void r(e)}e(t)}}}))).then((function(e){if(!e)return h(P()?"ready":"idle"),null;_={},g={},R=e.c,v=e.h,h("prepare");var t=new Promise((function(e,t){d={resolve:e,reject:t}}));p={};return T(1),"prepare"===f&&0===b&&0===m&&S(),t}));var t}function T(e){R[e]?(_[e]=!0,m++,function(e){var t=document.createElement("script");t.charset="utf-8",t.src=D.p+""+e+"."+i+".hot-update.js",document.head.appendChild(t)}(e)):g[e]=!0}function S(){h("ready");var e=d;if(d=null,e)if(n)Promise.resolve().then((function(){return O(n)})).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}));else{var t=[];for(var r in p)Object.prototype.hasOwnProperty.call(p,r)&&t.push(E(r));e.resolve(t)}}function O(t){if("ready"!==f)throw new Error("apply() is only allowed in ready status");return function t(n){var s,u,c,l,f;function d(e){for(var t=[e],r={},n=t.map((function(e){return{chain:[e],id:e}}));n.length>0;){var i=n.pop(),a=i.id,o=i.chain;if((l=I[a])&&(!l.hot._selfAccepted||l.hot._selfInvalidated)){if(l.hot._selfDeclined)return{type:"self-declined",chain:o,moduleId:a};if(l.hot._main)return{type:"unaccepted",chain:o,moduleId:a};for(var s=0;s<l.parents.length;s++){var u=l.parents[s],c=I[u];if(c){if(c.hot._declinedDependencies[a])return{type:"declined",chain:o.concat([u]),moduleId:a,parentId:u};-1===t.indexOf(u)&&(c.hot._acceptedDependencies[a]?(r[u]||(r[u]=[]),m(r[u],[a])):(delete r[u],t.push(u),n.push({chain:o.concat([u]),id:u})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:r}}function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];-1===e.indexOf(n)&&e.push(n)}}P();var b={},g=[],_={},w=function(){console.warn("[HMR] unexpected require("+S.moduleId+") to disposed module")};for(var T in p)if(Object.prototype.hasOwnProperty.call(p,T)){var S;f=E(T),S=p[T]?d(f):{type:"disposed",moduleId:T};var O=!1,A=!1,C=!1,M="";switch(S.chain&&(M="\nUpdate propagation: "+S.chain.join(" -> ")),S.type){case"self-declined":n.onDeclined&&n.onDeclined(S),n.ignoreDeclined||(O=new Error("Aborted because of self decline: "+S.moduleId+M));break;case"declined":n.onDeclined&&n.onDeclined(S),n.ignoreDeclined||(O=new Error("Aborted because of declined dependency: "+S.moduleId+" in "+S.parentId+M));break;case"unaccepted":n.onUnaccepted&&n.onUnaccepted(S),n.ignoreUnaccepted||(O=new Error("Aborted because "+f+" is not accepted"+M));break;case"accepted":n.onAccepted&&n.onAccepted(S),A=!0;break;case"disposed":n.onDisposed&&n.onDisposed(S),C=!0;break;default:throw new Error("Unexception type "+S.type)}if(O)return h("abort"),Promise.reject(O);if(A)for(f in _[f]=p[f],m(g,S.outdatedModules),S.outdatedDependencies)Object.prototype.hasOwnProperty.call(S.outdatedDependencies,f)&&(b[f]||(b[f]=[]),m(b[f],S.outdatedDependencies[f]));C&&(m(g,[S.moduleId]),_[f]=w)}var k,x=[];for(u=0;u<g.length;u++)f=g[u],I[f]&&I[f].hot._selfAccepted&&_[f]!==w&&!I[f].hot._selfInvalidated&&x.push({module:f,parents:I[f].parents.slice(),errorHandler:I[f].hot._selfAccepted});h("dispose"),Object.keys(R).forEach((function(e){!1===R[e]&&function(e){delete installedChunks[e]}(e)}));var j,G,F=g.slice();for(;F.length>0;)if(f=F.pop(),l=I[f]){var L={},B=l.hot._disposeHandlers;for(c=0;c<B.length;c++)(s=B[c])(L);for(a[f]=L,l.hot.active=!1,delete I[f],delete b[f],c=0;c<l.children.length;c++){var U=I[l.children[c]];U&&((k=U.parents.indexOf(f))>=0&&U.parents.splice(k,1))}}for(f in b)if(Object.prototype.hasOwnProperty.call(b,f)&&(l=I[f]))for(G=b[f],c=0;c<G.length;c++)j=G[c],(k=l.children.indexOf(j))>=0&&l.children.splice(k,1);h("apply"),void 0!==v&&(i=v,v=void 0);for(f in p=void 0,_)Object.prototype.hasOwnProperty.call(_,f)&&(e[f]=_[f]);var N=null;for(f in b)if(Object.prototype.hasOwnProperty.call(b,f)&&(l=I[f])){G=b[f];var V=[];for(u=0;u<G.length;u++)if(j=G[u],s=l.hot._acceptedDependencies[j]){if(-1!==V.indexOf(s))continue;V.push(s)}for(u=0;u<V.length;u++){s=V[u];try{s(G)}catch(e){n.onErrored&&n.onErrored({type:"accept-errored",moduleId:f,dependencyId:G[u],error:e}),n.ignoreErrored||N||(N=e)}}}for(u=0;u<x.length;u++){var H=x[u];f=H.module,o=H.parents,r=f;try{D(f)}catch(e){if("function"==typeof H.errorHandler)try{H.errorHandler(e)}catch(t){n.onErrored&&n.onErrored({type:"self-accept-error-handler-errored",moduleId:f,error:t,originalError:e}),n.ignoreErrored||N||(N=t),N||(N=e)}else n.onErrored&&n.onErrored({type:"self-accept-errored",moduleId:f,error:e}),n.ignoreErrored||N||(N=e)}}if(N)return h("fail"),Promise.reject(N);if(y)return t(n).then((function(e){return g.forEach((function(t){e.indexOf(t)<0&&e.push(t)})),e}));return h("idle"),new Promise((function(e){e(g)}))}(t=t||{})}function P(){if(y)return p||(p={}),y.forEach(A),y=void 0,!0}function A(t){Object.prototype.hasOwnProperty.call(p,t)||(p[t]=e[t])}var I={};function D(t){if(I[t])return I[t].exports;var r=I[t]={i:t,l:!1,exports:{},hot:c(t),parents:(s=o,o=[],s),children:[]};return e[t].call(r.exports,r,r.exports,u(t)),r.l=!0,r.exports}return D.m=e,D.c=I,D.d=function(e,t,r){D.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},D.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},D.t=function(e,t){if(1&t&&(e=D(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(D.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)D.d(r,n,function(t){return e[t]}.bind(null,n));return r},D.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return D.d(t,"a",t),t},D.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},D.p="",D.h=function(){return i},u(26)(D.s=26)}([function(e,t,r){"use strict";r.d(t,"B",(function(){return i.num})),r.d(t,"G",(function(){return i.vec2})),r.d(t,"H",(function(){return i.vec3})),r.d(t,"I",(function(){return i.vec4})),r.d(t,"C",(function(){return i.quat})),r.d(t,"y",(function(){return i.mat3})),r.d(t,"z",(function(){return i.mat4})),r.d(t,"A",(function(){return i.noise})),r.d(t,"v",(function(){return i.curve})),r.d(t,"w",(function(){return ko})),r.d(t,"D",(function(){return D})),r.d(t,"E",(function(){return U})),r.d(t,"x",(function(){return y})),r.d(t,"s",(function(){return X})),r.d(t,"q",(function(){return st})),r.d(t,"r",(function(){return ht})),r.d(t,"p",(function(){return ha})),r.d(t,"t",(function(){return da})),r.d(t,"l",(function(){return pa})),r.d(t,"b",(function(){return _a})),r.d(t,"a",(function(){return Oa})),r.d(t,"c",(function(){return Ua})),r.d(t,"g",(function(){return Na})),r.d(t,"j",(function(){return Va})),r.d(t,"e",(function(){return Ha})),r.d(t,"f",(function(){return za})),r.d(t,"k",(function(){return qa})),r.d(t,"h",(function(){return Xa})),r.d(t,"i",(function(){return Wa})),r.d(t,"d",(function(){return to})),r.d(t,"m",(function(){return ao})),r.d(t,"o",(function(){return oo})),r.d(t,"n",(function(){return so})),r.d(t,"F",(function(){return a})),r.d(t,"u",(function(){return n}));var n={};r.r(n),r.d(n,"GL_COLOR_BUFFER_BIT",(function(){return H})),r.d(n,"GL_DEPTH_BUFFER_BIT",(function(){return z})),r.d(n,"GL_STENCIL_BUFFER_BIT",(function(){return q})),r.d(n,"GL_TEXTURE_2D",(function(){return X})),r.d(n,"GL_TEXTURE_CUBE_MAP",(function(){return Y})),r.d(n,"GL_TEXTURE_3D",(function(){return W})),r.d(n,"GL_TEXTURE_MAG_FILTER",(function(){return K})),r.d(n,"GL_TEXTURE_MIN_FILTER",(function(){return Q})),r.d(n,"GL_TEXTURE_WRAP_S",(function(){return Z})),r.d(n,"GL_TEXTURE_WRAP_T",(function(){return J})),r.d(n,"GL_BYTE",(function(){return $})),r.d(n,"GL_UNSIGNED_BYTE",(function(){return ee})),r.d(n,"GL_SHORT",(function(){return te})),r.d(n,"GL_UNSIGNED_SHORT",(function(){return re})),r.d(n,"GL_INT",(function(){return ne})),r.d(n,"GL_UNSIGNED_INT",(function(){return ie})),r.d(n,"GL_FLOAT",(function(){return ae})),r.d(n,"GL_HALF_FLOAT_OES",(function(){return oe})),r.d(n,"GL_HALF_FLOAT",(function(){return se})),r.d(n,"GL_DEPTH_COMPONENT16",(function(){return ue})),r.d(n,"GL_DEPTH_COMPONENT24",(function(){return ce})),r.d(n,"GL_DEPTH_COMPONENT32F",(function(){return le})),r.d(n,"GL_FLOAT_VEC2",(function(){return fe})),r.d(n,"GL_FLOAT_VEC3",(function(){return he})),r.d(n,"GL_FLOAT_VEC4",(function(){return de})),r.d(n,"GL_INT_VEC2",(function(){return pe})),r.d(n,"GL_INT_VEC3",(function(){return ve})),r.d(n,"GL_INT_VEC4",(function(){return ye})),r.d(n,"GL_BOOL",(function(){return me})),r.d(n,"GL_BOOL_VEC2",(function(){return be})),r.d(n,"GL_BOOL_VEC3",(function(){return ge})),r.d(n,"GL_BOOL_VEC4",(function(){return _e})),r.d(n,"GL_FLOAT_MAT2",(function(){return Re})),r.d(n,"GL_FLOAT_MAT3",(function(){return Ee})),r.d(n,"GL_FLOAT_MAT4",(function(){return we})),r.d(n,"GL_TYPE_LENGTH",(function(){return Te})),r.d(n,"GL_SAMPLER_2D",(function(){return Se})),r.d(n,"GL_SAMPLER_3D",(function(){return Oe})),r.d(n,"GL_SAMPLER_CUBE",(function(){return Pe})),r.d(n,"GL_DEPTH_COMPONENT",(function(){return Ae})),r.d(n,"GL_ALPHA",(function(){return Ie})),r.d(n,"GL_RGB",(function(){return De})),r.d(n,"GL_RGBA",(function(){return Ce})),r.d(n,"GL_LUMINANCE",(function(){return Me})),r.d(n,"GL_LUMINANCE_ALPHA",(function(){return ke})),r.d(n,"GL_DEPTH_STENCIL",(function(){return xe})),r.d(n,"GL_UNSIGNED_INT_24_8_WEBGL",(function(){return je})),r.d(n,"GL_R8",(function(){return Ge})),r.d(n,"GL_R16F",(function(){return Fe})),r.d(n,"GL_R32F",(function(){return Le})),r.d(n,"GL_R8UI",(function(){return Be})),r.d(n,"GL_RG8",(function(){return Ue})),r.d(n,"GL_RG16F",(function(){return Ne})),r.d(n,"GL_RG32F",(function(){return Ve})),r.d(n,"GL_RGB8",(function(){return He})),r.d(n,"GL_SRGB8",(function(){return ze})),r.d(n,"GL_RGB565",(function(){return qe})),r.d(n,"GL_R11F_G11F_B10F",(function(){return Xe})),r.d(n,"GL_RGB9_E5",(function(){return Ye})),r.d(n,"GL_RGB16F",(function(){return We})),r.d(n,"GL_RGB32F",(function(){return Ke})),r.d(n,"GL_RGB8UI",(function(){return Qe})),r.d(n,"GL_RGBA8",(function(){return Ze})),r.d(n,"GL_RGB5_A1",(function(){return Je})),r.d(n,"GL_RGBA16F",(function(){return $e})),r.d(n,"GL_RGBA32F",(function(){return et})),r.d(n,"GL_RGBA8UI",(function(){return tt})),r.d(n,"GL_RGBA16I",(function(){return rt})),r.d(n,"GL_RGBA16UI",(function(){return nt})),r.d(n,"GL_RGBA32I",(function(){return it})),r.d(n,"GL_RGBA32UI",(function(){return at})),r.d(n,"GL_NEAREST",(function(){return ot})),r.d(n,"GL_LINEAR",(function(){return st})),r.d(n,"GL_NEAREST_MIPMAP_NEAREST",(function(){return ut})),r.d(n,"GL_LINEAR_MIPMAP_NEAREST",(function(){return ct})),r.d(n,"GL_NEAREST_MIPMAP_LINEAR",(function(){return lt})),r.d(n,"GL_LINEAR_MIPMAP_LINEAR",(function(){return ft})),r.d(n,"GL_REPEAT",(function(){return ht})),r.d(n,"GL_CLAMP_TO_EDGE",(function(){return dt})),r.d(n,"GL_MIRRORED_REPEAT",(function(){return pt})),r.d(n,"GL_ZERO",(function(){return vt})),r.d(n,"GL_ONE",(function(){return yt})),r.d(n,"GL_SRC_COLOR",(function(){return mt})),r.d(n,"GL_ONE_MINUS_SRC_COLOR",(function(){return bt})),r.d(n,"GL_SRC_ALPHA",(function(){return gt})),r.d(n,"GL_ONE_MINUS_SRC_ALPHA",(function(){return _t})),r.d(n,"GL_DST_ALPHA",(function(){return Rt})),r.d(n,"GL_ONE_MINUS_DST_ALPHA",(function(){return Et})),r.d(n,"GL_DST_COLOR",(function(){return wt})),r.d(n,"GL_ONE_MINUS_DST_COLOR",(function(){return Tt})),r.d(n,"GL_SRC_ALPHA_SATURATE",(function(){return St})),r.d(n,"GL_CONSTANT_COLOR",(function(){return Ot})),r.d(n,"GL_ONE_MINUS_CONSTANT_COLOR",(function(){return Pt})),r.d(n,"GL_CONSTANT_ALPHA",(function(){return At})),r.d(n,"GL_ONE_MINUS_CONSTANT_ALPHA",(function(){return It})),r.d(n,"GL_VERTEX_SHADER",(function(){return Dt})),r.d(n,"GL_FRAGMENT_SHADER",(function(){return Ct})),r.d(n,"GL_FRONT",(function(){return Mt})),r.d(n,"GL_BACK",(function(){return kt})),r.d(n,"GL_FRONT_AND_BACK",(function(){return xt})),r.d(n,"GL_NEVER",(function(){return jt})),r.d(n,"GL_LESS",(function(){return Gt})),r.d(n,"GL_EQUAL",(function(){return Ft})),r.d(n,"GL_LEQUAL",(function(){return Lt})),r.d(n,"GL_GREATER",(function(){return Bt})),r.d(n,"GL_NOTEQUAL",(function(){return Ut})),r.d(n,"GL_GEQUAL",(function(){return Nt})),r.d(n,"GL_ALWAYS",(function(){return Vt})),r.d(n,"GL_KEEP",(function(){return Ht})),r.d(n,"GL_REPLACE",(function(){return zt})),r.d(n,"GL_INCR",(function(){return qt})),r.d(n,"GL_DECR",(function(){return Xt})),r.d(n,"GL_INCR_WRAP",(function(){return Yt})),r.d(n,"GL_DECR_WRAP",(function(){return Wt})),r.d(n,"GL_INVERT",(function(){return Kt})),r.d(n,"GL_STREAM_DRAW",(function(){return Qt})),r.d(n,"GL_STATIC_DRAW",(function(){return Zt})),r.d(n,"GL_DYNAMIC_DRAW",(function(){return Jt})),r.d(n,"GL_ARRAY_BUFFER",(function(){return $t})),r.d(n,"GL_ELEMENT_ARRAY_BUFFER",(function(){return er})),r.d(n,"GL_POINTS",(function(){return tr})),r.d(n,"GL_LINES",(function(){return rr})),r.d(n,"GL_LINE_LOOP",(function(){return nr})),r.d(n,"GL_LINE_STRIP",(function(){return ir})),r.d(n,"GL_TRIANGLES",(function(){return ar})),r.d(n,"GL_TRIANGLE_STRIP",(function(){return or})),r.d(n,"GL_TRIANGLE_FAN",(function(){return sr})),r.d(n,"GL_CW",(function(){return ur})),r.d(n,"GL_CCW",(function(){return cr})),r.d(n,"GL_CULL_FACE",(function(){return lr})),r.d(n,"GL_DEPTH_TEST",(function(){return fr})),r.d(n,"GL_BLEND",(function(){return hr})),r.d(n,"RM_ANY",(function(){return dr})),r.d(n,"RM_OPAQUE",(function(){return pr})),r.d(n,"RM_DECAL",(function(){return vr})),r.d(n,"RM_TRANSPARENT",(function(){return yr})),r.d(n,"RM_ADDITIVE",(function(){return mr})),r.d(n,"RM_DEPTH",(function(){return br})),r.d(n,"RM_FULLSCREEN",(function(){return gr})),r.d(n,"RM_PICKABLE",(function(){return _r})),r.d(n,"RM_DISTORTION",(function(){return Rr})),r.d(n,"RS_ZENABLE",(function(){return Er})),r.d(n,"RS_FILLMODE",(function(){return wr})),r.d(n,"RS_SHADEMODE",(function(){return Tr})),r.d(n,"RS_ZWRITEENABLE",(function(){return Sr})),r.d(n,"RS_ALPHATESTENABLE",(function(){return Or})),r.d(n,"RS_LASTPIXEL",(function(){return Pr})),r.d(n,"RS_SRCBLEND",(function(){return Ar})),r.d(n,"RS_DESTBLEND",(function(){return Ir})),r.d(n,"RS_CULLMODE",(function(){return Dr})),r.d(n,"RS_ZFUNC",(function(){return Cr})),r.d(n,"RS_ALPHAREF",(function(){return Mr})),r.d(n,"RS_ALPHAFUNC",(function(){return kr})),r.d(n,"RS_DITHERENABLE",(function(){return xr})),r.d(n,"RS_ALPHABLENDENABLE",(function(){return jr})),r.d(n,"RS_FOGENABLE",(function(){return Gr})),r.d(n,"RS_SPECULARENABLE",(function(){return Fr})),r.d(n,"RS_FOGCOLOR",(function(){return Lr})),r.d(n,"RS_FOGTABLEMODE",(function(){return Br})),r.d(n,"RS_FOGSTART",(function(){return Ur})),r.d(n,"RS_FOGEND",(function(){return Nr})),r.d(n,"RS_FOGDENSITY",(function(){return Vr})),r.d(n,"RS_RANGEFOGENABLE",(function(){return Hr})),r.d(n,"RS_STENCILENABLE",(function(){return zr})),r.d(n,"RS_STENCILFAIL",(function(){return qr})),r.d(n,"RS_STENCILZFAIL",(function(){return Xr})),r.d(n,"RS_STENCILPASS",(function(){return Yr})),r.d(n,"RS_STENCILFUNC",(function(){return Wr})),r.d(n,"RS_STENCILREF",(function(){return Kr})),r.d(n,"RS_STENCILMASK",(function(){return Qr})),r.d(n,"RS_STENCILWRITEMASK",(function(){return Zr})),r.d(n,"RS_TEXTUREFACTOR",(function(){return Jr})),r.d(n,"RS_WRAP0",(function(){return $r})),r.d(n,"RS_WRAP1",(function(){return en})),r.d(n,"RS_WRAP2",(function(){return tn})),r.d(n,"RS_WRAP3",(function(){return rn})),r.d(n,"RS_WRAP4",(function(){return nn})),r.d(n,"RS_WRAP5",(function(){return an})),r.d(n,"RS_WRAP6",(function(){return on})),r.d(n,"RS_WRAP7",(function(){return sn})),r.d(n,"RS_CLIPPING",(function(){return un})),r.d(n,"RS_LIGHTING",(function(){return cn})),r.d(n,"RS_AMBIENT",(function(){return ln})),r.d(n,"RS_FOGVERTEXMODE",(function(){return fn})),r.d(n,"RS_COLORVERTEX",(function(){return hn})),r.d(n,"RS_LOCALVIEWER",(function(){return dn})),r.d(n,"RS_NORMALIZENORMALS",(function(){return pn})),r.d(n,"RS_DIFFUSEMATERIALSOURCE",(function(){return vn})),r.d(n,"RS_SPECULARMATERIALSOURCE",(function(){return yn})),r.d(n,"RS_AMBIENTMATERIALSOURCE",(function(){return mn})),r.d(n,"RS_EMISSIVEMATERIALSOURCE",(function(){return bn})),r.d(n,"RS_VERTEXBLEND",(function(){return gn})),r.d(n,"RS_CLIPPLANEENABLE",(function(){return _n})),r.d(n,"RS_POINTSIZE",(function(){return Rn})),r.d(n,"RS_POINTSIZE_MIN",(function(){return En})),r.d(n,"RS_POINTSPRITEENABLE",(function(){return wn})),r.d(n,"RS_POINTSCALEENABLE",(function(){return Tn})),r.d(n,"RS_POINTSCALE_A",(function(){return Sn})),r.d(n,"RS_POINTSCALE_B",(function(){return On})),r.d(n,"RS_POINTSCALE_C",(function(){return Pn})),r.d(n,"RS_MULTISAMPLEANTIALIAS",(function(){return An})),r.d(n,"RS_MULTISAMPLEMASK",(function(){return In})),r.d(n,"RS_PATCHEDGESTYLE",(function(){return Dn})),r.d(n,"RS_DEBUGMONITORTOKEN",(function(){return Cn})),r.d(n,"RS_POINTSIZE_MAX",(function(){return Mn})),r.d(n,"RS_INDEXEDVERTEXBLENDENABLE",(function(){return kn})),r.d(n,"RS_COLORWRITEENABLE",(function(){return xn})),r.d(n,"RS_TWEENFACTOR",(function(){return jn})),r.d(n,"RS_BLENDOP",(function(){return Gn})),r.d(n,"RS_POSITIONDEGREE",(function(){return Fn})),r.d(n,"RS_NORMALDEGREE",(function(){return Ln})),r.d(n,"RS_SCISSORTESTENABLE",(function(){return Bn})),r.d(n,"RS_SLOPESCALEDEPTHBIAS",(function(){return Un})),r.d(n,"RS_ANTIALIASEDLINEENABLE",(function(){return Nn})),r.d(n,"RS_TWOSIDEDSTENCILMODE",(function(){return Vn})),r.d(n,"RS_CCW_STENCILFAIL",(function(){return Hn})),r.d(n,"RS_CCW_STENCILZFAIL",(function(){return zn})),r.d(n,"RS_CCW_STENCILPASS",(function(){return qn})),r.d(n,"RS_CCW_STENCILFUNC",(function(){return Xn})),r.d(n,"RS_COLORWRITEENABLE1",(function(){return Yn})),r.d(n,"RS_COLORWRITEENABLE2",(function(){return Wn})),r.d(n,"RS_COLORWRITEENABLE3",(function(){return Kn})),r.d(n,"RS_BLENDFACTOR",(function(){return Qn})),r.d(n,"RS_SRGBWRITEENABLE",(function(){return Zn})),r.d(n,"RS_DEPTHBIAS",(function(){return Jn})),r.d(n,"RS_SEPARATEALPHABLENDENABLE",(function(){return $n})),r.d(n,"RS_SRCBLENDALPHA",(function(){return ei})),r.d(n,"RS_DESTBLENDALPHA",(function(){return ti})),r.d(n,"RS_BLENDOPALPHA",(function(){return ri})),r.d(n,"CULL_NONE",(function(){return ni})),r.d(n,"CULL_CW",(function(){return ii})),r.d(n,"CULL_CCW",(function(){return ai})),r.d(n,"CMP_NEVER",(function(){return oi})),r.d(n,"CMP_LESS",(function(){return si})),r.d(n,"CMP_EQUAL",(function(){return ui})),r.d(n,"CMP_LEQUAL",(function(){return ci})),r.d(n,"CMP_GREATER",(function(){return li})),r.d(n,"CMP_NOTEQUAL",(function(){return fi})),r.d(n,"CMP_GREATEREQUAL",(function(){return hi})),r.d(n,"CMP_ALWAYS",(function(){return di})),r.d(n,"BLEND_ZERO",(function(){return pi})),r.d(n,"BLEND_ONE",(function(){return vi})),r.d(n,"BLEND_SRCCOLOR",(function(){return yi})),r.d(n,"BLEND_INVSRCCOLOR",(function(){return mi})),r.d(n,"BLEND_SRCALPHA",(function(){return bi})),r.d(n,"BLEND_INVSRCALPHA",(function(){return gi})),r.d(n,"BLEND_DESTALPHA",(function(){return _i})),r.d(n,"BLEND_INVDESTALPHA",(function(){return Ri})),r.d(n,"BLEND_DESTCOLOR",(function(){return Ei})),r.d(n,"BLEND_INVDESTCOLOR",(function(){return wi})),r.d(n,"BLEND_SRCALPHASAT",(function(){return Ti})),r.d(n,"BLEND_BOTHSRCALPHA",(function(){return Si})),r.d(n,"BLEND_BOTHINVSRCALPHA",(function(){return Oi})),r.d(n,"BLEND_BLENDFACTOR",(function(){return Pi})),r.d(n,"BLEND_INVBLENDFACTOR",(function(){return Ai})),r.d(n,"BLENDOP_ADD",(function(){return Ii})),r.d(n,"BLENDOP_SUBTRACT",(function(){return Di})),r.d(n,"BLENDOP_REVSUBTRACT",(function(){return Ci})),r.d(n,"BLENDOP_MIN",(function(){return Mi})),r.d(n,"BLENDOP_MAX",(function(){return ki})),r.d(n,"TF_ALPHA",(function(){return xi})),r.d(n,"TF_LUMINANCE",(function(){return ji})),r.d(n,"TF_LUMINANCE_ALPHA",(function(){return Gi})),r.d(n,"TF_RGB",(function(){return Fi})),r.d(n,"TF_RGBA",(function(){return Li})),r.d(n,"TF_RED",(function(){return Bi})),r.d(n,"TF_R",(function(){return Ui})),r.d(n,"TF_RG",(function(){return Ni})),r.d(n,"TF_RED_INTEGER",(function(){return Vi})),r.d(n,"TF_R_INTEGER",(function(){return Hi})),r.d(n,"TF_RG_INTEGER",(function(){return zi})),r.d(n,"TF_RGB_INTEGER",(function(){return qi})),r.d(n,"TF_RGBA_INTEGER",(function(){return Xi})),r.d(n,"TT_UNSIGNED_BYTE",(function(){return Yi})),r.d(n,"TT_UNSIGNED_INT",(function(){return Wi})),r.d(n,"TT_FLOAT",(function(){return Ki})),r.d(n,"TT_HALF_FLOAT",(function(){return Qi})),r.d(n,"TT_BYTE",(function(){return Zi})),r.d(n,"TT_SHORT",(function(){return Ji})),r.d(n,"TT_UNSIGNED_SHORT",(function(){return $i})),r.d(n,"TT_INT",(function(){return ea})),r.d(n,"TT_UNSIGNED_INTEGER",(function(){return ta})),r.d(n,"TT_UNSIGNED_SHORT_4_4_4_4",(function(){return ra})),r.d(n,"TT_UNSIGNED_SHORT_5_5_5_1",(function(){return na})),r.d(n,"TT_UNSIGNED_SHORT_5_6_5",(function(){return ia})),r.d(n,"TT_UNSIGNED_INT_2_10_10_10_REV",(function(){return aa})),r.d(n,"TT_UNSIGNED_INT_24_8",(function(){return oa})),r.d(n,"TT_UNSIGNED_INT_10F_11F_11F_REV",(function(){return sa})),r.d(n,"TT_UNSIGNED_INT_5_9_9_9_REV",(function(){return ua})),r.d(n,"TT_FLOAT_32_UNSIGNED_INT_24_8_REV",(function(){return ca})),r.d(n,"WrapModes",(function(){return la})),r.d(n,"BlendTable",(function(){return fa})),r.d(n,"FilterMode",(function(){return ha})),r.d(n,"MipFilterMode",(function(){return da})),r.d(n,"DDS_MAGIC",(function(){return pa})),r.d(n,"DDSD_CAPS",(function(){return va})),r.d(n,"DDSD_HEIGHT",(function(){return ya})),r.d(n,"DDSD_WIDTH",(function(){return ma})),r.d(n,"DDSD_PITCH",(function(){return ba})),r.d(n,"DDSD_PIXELFORMAT",(function(){return ga})),r.d(n,"DDSD_MIPMAPCOUNT",(function(){return _a})),r.d(n,"DDSD_LINEARSIZE",(function(){return Ra})),r.d(n,"DDSD_DEPTH",(function(){return Ea})),r.d(n,"DDSCAPS_COMPLEX",(function(){return wa})),r.d(n,"DDSCAPS_MIPMAP",(function(){return Ta})),r.d(n,"DDSCAPS_TEXTURE",(function(){return Sa})),r.d(n,"DDSCAPS2_CUBEMAP",(function(){return Oa})),r.d(n,"DDSCAPS2_CUBEMAP_POSITIVEX",(function(){return Pa})),r.d(n,"DDSCAPS2_CUBEMAP_NEGATIVEX",(function(){return Aa})),r.d(n,"DDSCAPS2_CUBEMAP_POSITIVEY",(function(){return Ia})),r.d(n,"DDSCAPS2_CUBEMAP_NEGATIVEY",(function(){return Da})),r.d(n,"DDSCAPS2_CUBEMAP_POSITIVEZ",(function(){return Ca})),r.d(n,"DDSCAPS2_CUBEMAP_NEGATIVEZ",(function(){return Ma})),r.d(n,"DDSCAPS2_VOLUME",(function(){return ka})),r.d(n,"DDPF_ALPHAPIXELS",(function(){return xa})),r.d(n,"DDPF_ALPHA",(function(){return ja})),r.d(n,"DDPF_FOURCC",(function(){return Ga})),r.d(n,"DDPF_RGB",(function(){return Fa})),r.d(n,"DDPF_YUV",(function(){return La})),r.d(n,"DDPF_LUMINANCE",(function(){return Ba})),r.d(n,"DDS_HEADER_LENGTH_INT",(function(){return Ua})),r.d(n,"DDS_HEADER_OFFSET_MAGIC",(function(){return Na})),r.d(n,"DDS_HEADER_OFFSET_SIZE",(function(){return Va})),r.d(n,"DDS_HEADER_OFFSET_FLAGS",(function(){return Ha})),r.d(n,"DDS_HEADER_OFFSET_HEIGHT",(function(){return za})),r.d(n,"DDS_HEADER_OFFSET_WIDTH",(function(){return qa})),r.d(n,"DDS_HEADER_OFFSET_MIPMAP_COUNT",(function(){return Xa})),r.d(n,"DDS_HEADER_OFFSET_PF_FLAGS",(function(){return Ya})),r.d(n,"DDS_HEADER_OFFSET_PF_FOURCC",(function(){return Wa})),r.d(n,"DDS_HEADER_OFFSET_RGB_BPP",(function(){return Ka})),r.d(n,"DDS_HEADER_OFFSET_R_MASK",(function(){return Qa})),r.d(n,"DDS_HEADER_OFFSET_G_MASK",(function(){return Za})),r.d(n,"DDS_HEADER_OFFSET_B_MASK",(function(){return Ja})),r.d(n,"DDS_HEADER_OFFSET_A_MASK",(function(){return $a})),r.d(n,"DDS_HEADER_OFFSET_CAPS1",(function(){return eo})),r.d(n,"DDS_HEADER_OFFSET_CAPS2",(function(){return to})),r.d(n,"DDS_HEADER_OFFSET_CAPS3",(function(){return ro})),r.d(n,"DDS_HEADER_OFFSET_CAPS4",(function(){return no})),r.d(n,"DDS_HEADER_OFFSET_DXGI_FORMAT",(function(){return io})),r.d(n,"FOURCC_DXT1",(function(){return ao})),r.d(n,"FOURCC_DXT5",(function(){return oo})),r.d(n,"FOURCC_DXT3",(function(){return so})),r.d(n,"FOURCC_DXT10",(function(){return uo})),r.d(n,"FOURCC_D3DFMT_R16G16B16A16F",(function(){return co})),r.d(n,"FOURCC_D3DFMT_R32G32B32A32F",(function(){return lo})),r.d(n,"DXGI_FORMAT_R16G16B16A16_FLOAT",(function(){return fo})),r.d(n,"DXGI_FORMAT_B8G8R8X8_UNORM",(function(){return ho})),r.d(n,"VendorRequestAnimationFrame",(function(){return po})),r.d(n,"VendorCancelAnimationFrame",(function(){return vo})),r.d(n,"VendorRequestFullScreen",(function(){return yo})),r.d(n,"VendorExitFullScreen",(function(){return mo})),r.d(n,"VendorGetFullScreenElement",(function(){return bo})),r.d(n,"VendorWebglPrefixes",(function(){return go})),r.d(n,"WebglContextNames",(function(){return _o})),r.d(n,"Webgl2ContextNames",(function(){return Ro})),r.d(n,"WebglVersion",(function(){return Eo}));var i=r(4),a=r(3),o=r(10);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=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(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(o,e);var t,r,n,i=l(o);function o(){var e;s(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return p(h(e=i.call(this,...r)),"name",""),p(h(e),"display",!0),p(h(e),"visible",{log:!0,info:!0,debug:!0,warn:!0,error:!0}),p(h(e),"history",100),p(h(e),"throttle",20),p(h(e),"_logs",[]),p(h(e),"_throttled",null),e}return t=o,(r=[{key:"Set",value:function(e){e&&(Object(a.assignIfExists)(this,e,["name","display","history","throttle"]),Object(a.assignIfExists)(this.visible,e.visible,["log","info","debug","warn","error"]))}},{key:"log",value:function(e){if(e._logged)return e;Object(a.isError)(e)&&(e={err:e}),e.err?(e.type="error",e.name||(e.name=e.err.name),e.message||(e.message=e.err.message)):(e.type=o.LogType[e.type?e.type.toUpperCase():"LOG"]||"log",e.message=e.message||"");var t=e.name||this.constructor.category;if(t=(t=t.replace(/_/g," ")).charAt(0).toUpperCase()+t.slice(1),e.name=t,this.display&&this.visible[e.type]||(e.hide=!0),this.throttle){if(!e.hide){this._throttled||(this._throttled={}),this._throttled[e.type]||(this._throttled[e.type]=[]);var r=this._throttled[e.type];r.includes(e.message)?e.hide=!0:(r.unshift(e.message),r.splice(this.throttle))}}else this._throttled=null;if(!e.hide){var n="".concat(this.name," ").concat(e.name,":");e.err||e.data?(console.group(n,e.message),e.err&&console.debug(e.err.stack||e.err.toString()),e.data&&console.debug(JSON.stringify(e.data,null,4)),console.groupEnd()):console[e.type](n,e.message)}return this.history?(this._logs.unshift(e),this._logs.splice(this.history)):this._logs=[],e._logged=!0,this.emit(e.type,e),e}}])&&u(t.prototype,r),n&&u(t,n),o}(o.a);p(v,"LogType",{ERROR:"error",WARNING:"warn",INFO:"info",LOG:"log",DEBUG:"debug"}),p(v,"category","logger");var y=new v;function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}o.a.defaultLogger=y;var b=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._loadedObjects={},this._errors={}}var t,r,n;return t=e,(r=[{key:"AddError",value:function(e,t){return this._errors[e]=this._errors[e]||[],this._errors[e].includes(t)||(t.data=t.data||{},t.data.path=t.data.path||e,this._errors[e].push(t)),t}},{key:"GetErrors",value:function(e){return e&&e in this._errors?Object.assign([],this._errors[e]):null}},{key:"HasErrors",value:function(e){return e&&e in this._errors}},{key:"Find",value:function(e){return e in this._loadedObjects?this._loadedObjects[e]:null}},{key:"Add",value:function(e,t){this._loadedObjects[e]=t}},{key:"Remove",value:function(e){delete this._loadedObjects[e]}},{key:"Clear",value:function(){this._loadedObjects={}}},{key:"UnloadAndClear",value:function(){for(var e in this._loadedObjects)this._loadedObjects.hasOwnProperty(e)&&this._loadedObjects[e].Unload();this._loadedObjects={}}},{key:"PurgeInactive",value:function(e,t,r){for(var n in this._loadedObjects)if(this._loadedObjects.hasOwnProperty(n)){var i=this._loadedObjects[n];i.doNotPurge||(i.IsPurged()&&(i.OnUnloaded(),this.Remove(n)),i._isGood&&(e-i.activeFrame)%t>=r&&i.Unload()&&(i.OnUnloaded(),this.Remove(n)))}}}])&&m(t.prototype,r),n&&m(t,n),e}(),g=r(15),_=r(1);function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t=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(e){return!1}}();return function(){var r,n=P(e);if(t){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S(this,r)}}function S(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?O(e):t}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var I=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}(r,e);var t=T(r);function r(){var e;R(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return A(O(e=t.call(this,...i)),"motherLode",new b),A(O(e),"systemMirror",!1),A(O(e),"maxPrepareTime",.05),A(O(e),"autoPurgeResources",!0),A(O(e),"activeFrame",0),A(O(e),"purgeTime",30),A(O(e),"_prepareBudget",0),A(O(e),"_prepareQueue",[]),A(O(e),"_purgeTime",0),A(O(e),"_purgeFrame",0),A(O(e),"_purgeFrameLimit",1e3),A(O(e),"_pendingLoads",0),A(O(e),"_noLoadFrames",0),e}return function(e,t,r){t&&E(e.prototype,t),r&&E(e,r)}(r,[{key:"Set",value:function(e){e&&Object(a.assignIfExists)(this,e,["systemMirror","maxPrepareTime","autoPurgeResources","purgeTime"])}},{key:"OnResError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new _.Tw2Error({path:e});e=r.NormalizePath(e);var n=this.motherLode.Find(e);return n?n.OnError(t):this.OnResEvent("error",e,{type:"error",message:t.message,err:t}),t}},{key:"OnResEvent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.DefaultLog[e.toUpperCase()];if(i){n=Object.assign({},i,n);var a={res:this.motherLode.Find(t),path:t,log:n},o=n.err;o&&(this.motherLode.AddError(t,o),a.err=o,Object.assign(a,o.data)),n.message=n.message.includes(t)?n.message:n.message+=' "'.concat(t,'"'),this.emit(e.toLowerCase(),a)}}},{key:"IsLoading",value:function(){return this._noLoadFrames<2}},{key:"Clear",value:function(){this.motherLode.Clear()}},{key:"UnloadAndClear",value:function(){this.motherLode.UnloadAndClear()}},{key:"PrepareLoop",value:function(e){0===this._prepareQueue.length&&0===this._pendingLoads?this._noLoadFrames<2&&this._noLoadFrames++:this._noLoadFrames=0,this._prepareBudget=this.maxPrepareTime;for(var t=Date.now();this._prepareQueue.length;){var r=this._prepareQueue[0][0],n=this._prepareQueue[0][1],i=this._prepareQueue[0][2];this._prepareQueue.shift();try{r.Prepare(n,i)}catch(e){r.OnError(e)}if(this._prepareBudget-=.001*(Date.now()-t),this._prepareBudget<0)break}return this._purgeTime+=e,this._purgeTime>1&&(this.activeFrame+=1,this._purgeTime-=Math.floor(this._purgeTime),this._purgeFrame+=1,this._purgeFrame>=5&&this.autoPurgeResources&&this.motherLode.PurgeInactive(this._purgeFrame,this._purgeFrameLimit,this.purgeTime)),!0}},{key:"GetResource",value:function(e){var t;if(e=r.NormalizePath(e),t=this.motherLode.Find(e))return t.IsPurged()&&t.Reload(),t;if(0===e.indexOf("dynamic:/"))return this.OnResError(e,new _.ErrFeatureNotImplemented({feature:"Dynamic resources"})),null;var n=r.GetPathExt(e);if(null===n)return this.OnResError(e,new _.ErrResourceExtensionUndefined({path:e})),null;var i=U.GetExtension(n);if(!i)return this.OnResError(e,new _.ErrResourceExtensionUnregistered({path:e,extension:n})),null;try{return(t=new i).path=e,r.LoadResource(this,t)}catch(t){return this.OnResError(e,t),null}}},{key:"GetObject",value:function(e,t,n){e=r.NormalizePath(e);var i=this.motherLode.Find(e);if(i)i.AddObject(t,n);else try{(i=new g.a).path=e,i.AddObject(t,n),r.LoadResource(this,i)}catch(t){this.OnResError(e,t)}}},{key:"ReloadResource",value:function(e){var t=e.path,n=this.motherLode.Find(t);if(n&&!n.IsPurged())return n;try{return r.LoadResource(this,e)}catch(r){return this.OnResError(t,r),e}}},{key:"BuildUrl",value:function(e){var t=e.indexOf(":/");if(-1===t)throw new _.ErrResourcePrefixUndefined({path:e});var r=e.substr(0,t);if("http"===r||"https"===r)return e;var n=U.GetPath(r);if(!n)throw new _.ErrResourcePrefixUnregistered({path:e,prefix:r});return n+e.substr(t+2)}}],[{key:"NormalizePath",value:function(e){return"str:/"===e.substr(0,5)||(e=e.toLowerCase()).replace("\\","/"),e}},{key:"GetPathExt",value:function(e){if("str:/"===e.substr(0,5)){var t=e.indexOf("/",5);return-1===t?null:e.substr(5,t-5)}var r=e.lastIndexOf(".");return-1===r?null:e.substr(r+1)}},{key:"LoadResource",value:function(e,t){var n=t.path,i=e.BuildUrl(n);if(e.motherLode.Add(n,t),t.DoCustomLoad&&t.DoCustomLoad(i,r.GetPathExt(i)))return t;var a=r.CreateHttpRequest(t);a.onreadystatechange=r.DoLoadResource(e,t),a.open("GET",i);try{a.send(),e._pendingLoads++,t.OnRequested()}catch(e){throw new _.ErrHTTPRequestSend({path:n})}return t}},{key:"DoLoadResource",value:function(e,t){var r=t.path;return function(){var n=0;try{n=this.readyState}catch(n){return e._pendingLoads--,void t.OnError(new _.ErrHTTPReadyState({path:r}))}if(4===n){var i=this.status;if(200===i){var a=null,o=null;try{a=this.responseText,o=this.responseXML}catch(e){a=this.response}e._prepareQueue.push([t,a,o]),t.OnLoaded()}else t.OnError(new _.ErrHTTPStatus({path:r,status:i}));e._pendingLoads--}}}},{key:"CreateHttpRequest",value:function(e){var t=null;if(window.XMLHttpRequest)t=new XMLHttpRequest;else if(window.ActiveXObject)try{t=new window.ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{t=new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}if(!t)throw new _.ErrHTTPInstance({path:e.path});return e.requestResponseType&&(t.responseType=e.requestResponseType),t}}]),r}(o.a);A(I,"DefaultLog",{ERROR:{type:"error",message:"Uncaught error"},WARNING:{type:"warn",message:"Undefined warning"},REQUESTED:{type:"info",message:"Requested"},RELOADING:{type:"info",message:"Reloading"},LOADED:{type:"info",message:"Loaded"},PREPARED:{type:"log",message:"Prepared"},PURGED:{type:"info",message:"Purged"},UNLOADED:{type:"info",message:"Unloaded"},DEBUG:{type:"debug",message:"Debug"}}),A(I,"category","resource_manager");var D=new I;function C(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function M(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function x(e){var t=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(e){return!1}}();return function(){var r,n=F(e);if(t){var i=F(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return j(this,r)}}function j(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?G(e):t}function G(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(r,e);var t=x(r);function r(){var e;C(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return L(G(e=t.call(this,...i)),"_type",{}),L(G(e),"_path",{}),L(G(e),"_variable",{}),L(G(e),"_extension",{}),L(G(e),"_class",{}),L(G(e),"_dynamicPath",{}),L(G(e),"_schema",{}),L(G(e),"_missing",{}),e}return function(e,t,r){t&&M(e.prototype,t),r&&M(e,r)}(r,[{key:"HasPath",value:function(e){return e&&e in this._path}},{key:"GetPath",value:function(e){return r.GetStoreItem(this,"path",e)}},{key:"RegisterPath",value:function(e,t){return t.lastIndexOf("/")!==t.length-1&&(t+="/"),r.RestrictedPathPrefixes.includes(e)?(this.emit("error",{type:"path",key:e,value:t,log:{type:"error",message:'Cannot register restricted prefix "'.concat(e,'"')}}),!1):r.SetStoreItem(this,"path",e,t,a.isString)}},{key:"RegisterPaths",value:function(e){return r.RegisterFromObject(this,"RegisterPath",e)}},{key:"HasDynamicPath",value:function(e){return e&&e in this._dynamicPath}},{key:"GetDynamicPath",value:function(e){return r.GetStoreItem(this,"dynamicPath",e)}},{key:"RegisterDynamicPath",value:function(e,t){return r.SetStoreItem(this,"dynamicPath",e,t,a.isArray)}},{key:"RegisterDynamicPaths",value:function(e){return r.RegisterFromObject(this,"RegisterDynamicPath",e)}},{key:"HasExtension",value:function(e){return e&&e in this._extension}},{key:"GetExtension",value:function(e){return r.GetStoreItem(this,"extension",e)}},{key:"RegisterExtension",value:function(e,t){return r.SetStoreItem(this,"extension",e,t,a.isFunction)}},{key:"RegisterExtensions",value:function(e){return r.RegisterFromObject(this,"RegisterExtension",e)}},{key:"HasClass",value:function(e){return e&&e in this._class}},{key:"GetClass",value:function(e){var t=r.GetStoreItem(this,"class",e);if(!t&&(e.includes("Tr2")||e.includes("Tri"))){var n="Tw2"+e.substring(3);(t=r.GetStoreItem(this,"class",n))&&this.emit("substitute",{type:"class",key:n,originalKey:e,value:t,log:{type:"warning",message:'"'.concat(e,'" class not found, substituting with "').concat(n,'"')}})}return t&&t.partialImplementation&&this.emit("partial",{type:"class",key:e,value:t,log:{type:"warning",message:'"'.concat(e,'" class partially implemented')}}),t}},{key:"RegisterClass",value:function(e,t){return r.SetStoreItem(this,"class",e,t,a.isFunction)}},{key:"RegisterClasses",value:function(e){return r.RegisterFromObject(this,"RegisterClass",e)}},{key:"HasVariable",value:function(e){return e&&e in this._variable}},{key:"GetVariable",value:function(e){return r.GetStoreItem(this,"variable",e)}},{key:"GetVariableValue",value:function(e,t){var r=this.GetVariable(e);return r&&r.GetValue?r.GetValue(t):null}},{key:"SetVariableValue",value:function(e,t){var r=this.GetVariable(e);return r&&r.SetValue?(r.SetValue(t),!0):null}},{key:"RegisterVariable",value:function(e,t,n){var i=this.CreateType(e,t,n);return r.SetStoreItem(this,"variable",e,i),i}},{key:"RegisterVariables",value:function(e){return r.RegisterFromObject(this,"RegisterVariable",e)}},{key:"GetType",value:function(e){return r.GetStoreItem(this,"type",e)}},{key:"HasType",value:function(e){return e&&e in this._type}},{key:"GetTypeByValue",value:function(e){for(var t in this._type)if(this._type.hasOwnProperty(t)&&"isValue"in this._type[t]&&this._type[t].isValue(e))return this._type[t];return null}},{key:"CreateType",value:function(e,t,r){return Object(a.isPlain)(t)&&(r=t.Type||t.type,t=t.value),r||(r=this.GetTypeByValue(t)),Object(a.isString)(r)&&(r=this.GetType(r)),Object(a.isFunction)(r)?new r(e,t):null}},{key:"RegisterType",value:function(e,t){return r.SetStoreItem(this,"type",e,t,a.isFunction)}},{key:"RegisterTypes",value:function(e){return r.RegisterFromObject(this,"RegisterType",e)}},{key:"HasSchema",value:function(e){return e&&e in this._schema}},{key:"GetSchema",value:function(e){return r.GetStoreItem(this,"schema",e)}},{key:"RegisterSchema",value:function(e,t){return r.SetStoreItem(this,"schema",e,t,e=>e&&"Tw2Schema"===e.constructor.name)}},{key:"RegisterSchemas",value:function(e){return r.RegisterFromObject(this,"RegisterSchema",e)}},{key:"Register",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"uuid"in e&&Object(a.enableUUID)(e.uuid),"logger"in e&&y.Set(e.logger),"resMan"in e&&D.Set(e.resMan),this.RegisterPaths(e.paths),this.RegisterDynamicPaths(e.dynamicPaths),this.RegisterTypes(e.types),this.RegisterClasses(e.classes),this.RegisterExtensions(e.extensions),this.RegisterVariables(e.variables),this.RegisterSchemas(e.schemas)}}],[{key:"GetStoreItem",value:function(e,t,r){var n=e["_"+t];if(n&&Object(a.isString)(r)){if(r in n)return n[r];e._missing[t]||(e._missing[t]=[]),e._missing[t].includes(r)||e._missing[t].push(r),e.emit("missing",{type:t,key:r,log:{type:"debug",message:"Missing ".concat(t,': "').concat(r,'"')}})}return null}},{key:"SetStoreItem",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(i&&!i(n))return e.emit("error",{type:t,key:r,value:n,log:{type:"error",message:"Invalid ".concat(t,': "').concat(r,'"')}}),!1;var o=e["_"+t];if(o&&Object(a.isString)(r)&&!Object(a.isUndefined)(n)){var s=o[r];return o[r]=n,e.emit("registered",{type:t,key:r,value:n,oldValue:s,log:{type:"debug",message:"".concat(s?"Re-registered":"Registered"," ").concat(t,' "').concat(r,'"')}}),!0}return!1}},{key:"RegisterFromObject",value:function(e,t,r){if(r&&t in e){r=Object(a.toArray)(r);for(var n=0;n<r.length;n++)for(var i in r[n])r[n].hasOwnProperty(i)&&e[t](i,r[n][i]);return!0}return!1}}]),r}(o.a);L(B,"RestrictedPathPrefixes",["dynamic","rgba"]),L(B,"category","variable_store");var U=new B,N=r(13),V=r(7),H=16384,z=256,q=1024,X=3553,Y=34067,W=32879,K=10240,Q=10241,Z=10242,J=10243,$=5120,ee=5121,te=5122,re=5123,ne=5124,ie=5125,ae=5126,oe=36193,se=5131,ue=33189,ce=33190,le=36012,fe=35664,he=35665,de=35666,pe=35667,ve=35668,ye=35669,me=35670,be=35671,ge=35672,_e=35673,Re=35674,Ee=35675,we=35676,Te={[ae]:1,[ne]:1,[$]:1,[me]:1,[fe]:2,[pe]:2,[be]:2,[he]:3,[ve]:3,[ge]:3,[de]:4,[ye]:4,[_e]:4,[Ee]:9,[we]:16},Se=35678,Oe=35679,Pe=35680,Ae=6402,Ie=6406,De=6407,Ce=6408,Me=6409,ke=6410,xe=34041,je=34042,Ge=33321,Fe=33325,Le=33326,Be=33330,Ue=33323,Ne=33327,Ve=33328,He=32849,ze=35905,qe=36194,Xe=35898,Ye=35901,We=34843,Ke=34837,Qe=36221,Ze=32856,Je=32855,$e=34842,et=34836,tt=36220,rt=36232,nt=36214,it=36226,at=36208,ot=9728,st=9729,ut=9984,ct=9985,lt=9986,ft=9987,ht=10497,dt=33071,pt=33648,vt=0,yt=1,mt=768,bt=769,gt=770,_t=771,Rt=772,Et=773,wt=774,Tt=775,St=776,Ot=32769,Pt=32770,At=32771,It=32772,Dt=35633,Ct=35632,Mt=1028,kt=1029,xt=1032,jt=512,Gt=513,Ft=514,Lt=515,Bt=516,Ut=517,Nt=518,Vt=519,Ht=7680,zt=7681,qt=7682,Xt=7683,Yt=34055,Wt=34056,Kt=5386,Qt=35040,Zt=35044,Jt=35048,$t=34962,er=34963,tr=0,rr=1,nr=2,ir=3,ar=4,or=5,sr=6,ur=2304,cr=2305,lr=2884,fr=2929,hr=3042,dr=-1,pr=0,vr=1,yr=2,mr=3,br=4,gr=5,_r=6,Rr=7,Er=7,wr=8,Tr=9,Sr=14,Or=15,Pr=16,Ar=19,Ir=20,Dr=22,Cr=23,Mr=24,kr=25,xr=26,jr=27,Gr=28,Fr=29,Lr=34,Br=35,Ur=36,Nr=37,Vr=38,Hr=48,zr=52,qr=53,Xr=54,Yr=55,Wr=56,Kr=57,Qr=58,Zr=59,Jr=60,$r=128,en=129,tn=130,rn=131,nn=132,an=133,on=134,sn=135,un=136,cn=137,ln=139,fn=140,hn=141,dn=142,pn=143,vn=145,yn=146,mn=147,bn=148,gn=151,_n=152,Rn=154,En=155,wn=156,Tn=157,Sn=158,On=159,Pn=160,An=161,In=162,Dn=163,Cn=165,Mn=166,kn=167,xn=168,jn=170,Gn=171,Fn=172,Ln=173,Bn=174,Un=175,Nn=176,Vn=185,Hn=186,zn=187,qn=188,Xn=189,Yn=190,Wn=191,Kn=192,Qn=193,Zn=194,Jn=195,$n=206,ei=207,ti=208,ri=209,ni=1,ii=2,ai=3,oi=1,si=2,ui=3,ci=4,li=5,fi=6,hi=7,di=8,pi=1,vi=2,yi=3,mi=4,bi=5,gi=6,_i=7,Ri=8,Ei=9,wi=10,Ti=11,Si=12,Oi=13,Pi=14,Ai=15,Ii=1,Di=2,Ci=3,Mi=4,ki=5,xi=0,ji=1,Gi=2,Fi=4,Li=5,Bi=6,Ui=6,Ni=7,Vi=8,Hi=8,zi=9,qi=10,Xi=11,Yi=0,Wi=0,Ki=1,Qi=2,Zi=3,Ji=4,$i=5,ea=6,ta=7,ra=8,na=9,ia=10,aa=11,oa=12,sa=13,ua=14,ca=15,la=[0,ht,pt,dt,dt,dt],fa=[-1,vt,yt,mt,bt,gt,_t,Rt,Et,wt,Tt,St,-1,-1,Ot,Pt],ha={[ot]:1,[st]:2},da={[ot]:0,[st]:0,[ut]:1,[ct]:1,[lt]:2,[ft]:2},pa=542327876,va=1,ya=2,ma=4,ba=8,ga=4096,_a=131072,Ra=524288,Ea=8388608,wa=8,Ta=4194304,Sa=4096,Oa=512,Pa=1024,Aa=2048,Ia=4096,Da=8192,Ca=16384,Ma=32768,ka=2097152,xa=1,ja=2,Ga=4,Fa=64,La=512,Ba=131072,Ua=31,Na=0,Va=1,Ha=2,za=3,qa=4,Xa=7,Ya=20,Wa=21,Ka=22,Qa=23,Za=24,Ja=25,$a=26,eo=27,to=28,ro=29,no=30,io=32,ao=827611204,oo=894720068,so=861165636,uo=827611204,co=113,lo=116,fo=10,ho=88,po=["requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame"],vo=["cancelAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","msRequestAnimationFrame"],yo=["requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen"],mo=["exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen"],bo=["fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement"],go=["","MOZ_","WEBKIT_","WEBGL_"],_o=["webgl","experimental-webgl"],Ro=["webgl2","experimental-webgl2"],Eo={NONE:0,WEBGL:1,WEBGL2:2};function wo(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function To(e,t){return(To=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function So(e){var t=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(e){return!1}}();return function(){var r,n=Po(e);if(t){var i=Po(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Oo(this,r)}}function Oo(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Po(e){return(Po=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ao(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Io,Do,Co=r(30),Mo=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&To(e,t)}(o,e);var t,r,n,a=So(o);function o(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(e=a.call(this)).name="Device",e.gl=null,e.glVersion=Eo.NONE,e.vrDisplay=null,e.ext=null,e.dt=0,e.frameCounter=0,e.startTime=e.Now(),e.currentTime=e.startTime,e.previousTime=null,e.eyePosition=i.vec3.create(),e.targetResolution=i.vec4.create(),e.world=i.mat4.create(),e.view=i.mat4.create(),e.viewInverse=i.mat4.create(),e.viewTranspose=i.mat4.create(),e.projection=i.mat4.create(),e.projectionInverse=i.mat4.create(),e.projectionTranspose=i.mat4.create(),e.viewProjection=i.mat4.create(),e.viewProjectionTranspose=i.mat4.create(),e.canvas=null,e.viewportWidth=0,e.viewportHeight=0,e.viewportAspect=0,e.viewportPixelRatio="devicePixelRatio"in window?window.devicePixelRatio:1,e.effectDir="/effect.gles2/",e.mipLevelSkipCount=0,e.shaderModel="hi",e.enableAnisotropicFiltering=!0,e.alphaBlendBackBuffer=!0,e.antialiasing=!0,e.msaaSamples=0,e.wrapModes=[],e.shadowHandles=null,e.perObjectData=null,e._alphaBlendState=null,e._alphaTestState=null,e._depthOffsetState=null,e._shadowStateBuffer=null,e._scheduled=[],e._quadBuffer=null,e._quadDecl=null,e._cameraQuadBuffer=null,e._currentRenderMode=dr,e._fallbackCube=null,e._fallbackTexture=null,e._blitEffect=null,e}return t=o,n=[{key:"CreateContext",value:function(e,t,r){function n(e,t,r){r=Array.isArray(r)?r:[r];for(var n=0;n<r.length;n++)try{return e.getContext(r[n],t)}catch(e){}return null}var i=null,a=Eo.NONE;return r&&(i=n(e,t,Ro))&&(a=Eo.WEBGL2),i||(i=n(e,t,_o))&&(a=Eo.WEBGL),{gl:i,version:a}}}],(r=[{key:"Now",value:function(){return this.constructor.Clock.now()}},{key:"CreateDevice",value:function(e,t){this.gl=null,this.glVersion=Eo.NONE,this.effectDir="/effect.gles2/",this.canvas=null,this.doneInit=!1;var r=()=>!1,n=()=>!0;this.ext={drawElementsInstanced:r,drawArraysInstanced:r,vertexAttribDivisor:r,hasInstancedArrays:r};var i=o.CreateContext(e,t,t.webgl2),a=i.gl,s=i.version;if(!a)return this.glVersion;switch(this.debugMode&&(this.debugUtils=Co,a=this.debugUtils.makeDebugContext(a)),this.gl=a,this.glVersion=s,this.canvas=e,this.emit("created",{device:this,gl:a,params:t,canvas:e,log:{type:"debug",message:"Webgl".concat(s," context created")}}),this.glVersion){case Eo.WEBGL2:this.ext={drawElementsInstanced:function(e,t,r,n,i){a.drawElementsInstanced(e,t,r,n,i)},drawArraysInstanced:function(e,t,r,n){a.drawArraysInstanced(e,t,r,n)},vertexAttribDivisor:function(e,t){a.vertexAttribDivisor(e,t)},hasInstancedArrays:n};break;default:this.GetExtension("OES_standard_derivatives"),this.GetExtension("OES_element_index_uint"),this.GetExtension("OES_texture_float"),this.GetExtension("EXT_shader_texture_lod");var u=this.GetExtension("ANGLE_instanced_arrays");u&&(this.ext={drawElementsInstanced:function(e,t,r,n,i){u.drawElementsInstancedANGLE(e,t,r,n,i)},drawArraysInstanced:function(e,t,r,n){u.drawArraysInstancedANGLE(e,t,r,n)},vertexAttribDivisor:function(e,t){u.vertexAttribDivisorANGLE(e,t)},hasInstancedArrays:n})}this.ext.CompressedTextureS3TC=this.GetExtension("compressed_texture_s3tc"),this.ext.AnisotropicFilter=this.GetExtension("EXT_texture_filter_anisotropic"),this.ext.AnisotropicFilter&&(this.ext.AnisotropicFilter.maxAnisotropy=a.getParameter(this.ext.AnisotropicFilter.MAX_TEXTURE_MAX_ANISOTROPY_EXT));var c=this.GetExtension("CCP_shader_binary");if(c){var l=a.getParameter(this.gl.RENDERER).match(/Mali-(\w+).*/);l&&(this.effectDir="/effect.gles2.mali"+l[1]+"/",this.ext.ShaderBinary=c)}return this.alphaBlendBackBuffer=!t||void 0===t.alpha||t.alpha,this.msaaSamples=this.gl.getParameter(this.gl.SAMPLES),this.antialiasing=this.msaaSamples>1,this.Resize(),this._quadBuffer=a.createBuffer(),a.bindBuffer(a.ARRAY_BUFFER,this._quadBuffer),a.bufferData(a.ARRAY_BUFFER,new Float32Array([1,1,0,1,1,1,-1,1,0,1,0,1,1,-1,0,1,1,0,-1,-1,0,1,0,0]),a.STATIC_DRAW),this._cameraQuadBuffer=a.createBuffer(),this._quadDecl=new V.a([["POSITION",0,4],["TEXCOORD",0,2]]),this.wrapModes=Array.from(la),this._alphaBlendState={dirty:!1,states:{[Ar]:bi,[Ir]:gi,[Gn]:Ii,[$n]:0,[ri]:Ii,[ei]:bi,[ti]:gi}},this._alphaTestState={dirty:!1,states:{[Or]:0,[Mr]:-1,[kr]:li,[un]:0,[_n]:0}},this._depthOffsetState={dirty:!1,states:{[Un]:0,[Jn]:0}},this._shadowStateBuffer=new Float32Array(24),this.glVersion}},{key:"Schedule",value:function(e){this._scheduled.includes(e)||this._scheduled.push(e)}},{key:"Resize",value:function(){var e=this.vrDisplay&&this.vrDisplay.isPresenting;if(e){var t=this.vrDisplay.getEyeParameters("left"),r=this.vrDisplay.getEyeParameters("right");this.canvas.width=2*Math.max(t.renderWidth,r.renderWidth),this.canvas.height=Math.max(r.renderHeight,r.renderHeight)}else this.canvas.width=this.canvas.offsetWidth*this.viewportPixelRatio,this.canvas.height=this.canvas.offsetHeight*this.viewportPixelRatio;this.viewportWidth=this.canvas.clientWidth,this.viewportHeight=this.canvas.clientHeight,this.viewportAspect=this.viewportWidth/this.viewportHeight,U.SetVariableValue("ViewportSize",[this.viewportWidth,this.viewportHeight,this.viewportWidth,this.viewportHeight]),this.emit("resized",{width:this.viewportWidth,height:this.viewportHeight,aspect:this.viewportAspect,source:e?this.vrDisplay:this.canvas})}},{key:"Tick",value:function(){this.canvas.clientWidth===this.viewportWidth&&this.canvas.clientHeight===this.viewportHeight||this.Resize();var e=null===this.previousTime?0:this.previousTime,t=this.Now();this.currentTime=.001*(t-this.startTime),this.dt=null===this.previousTime?0:.001*(t-this.previousTime),this.previousTime=t,U.SetVariableValue("Time",[this.currentTime,this.currentTime-Math.floor(this.currentTime),this.frameCounter,e]),this.emit("tick",{dt:this.dt,previous:e,current:this.currentTime,frame:this.frameCounter}),D.PrepareLoop(this.dt);for(var r=0;r<this._scheduled.length;++r)this._scheduled[r](this.dt)||(this._scheduled.splice(r,1),--r);this.frameCounter++}},{key:"RequestAnimationFrame",value:function(e){return this.vrDisplay?this.vrDisplay.requestAnimationFrame(e):o.RequestAnimationFrame(e)}},{key:"CancelAnimationFrame",value:function(e){return this.vrDisplay?this.vrDisplay.cancelAnimationFrame(e):o.CancelAnimationFrame(e)}},{key:"SetWorld",value:function(e){i.mat4.copy(this.world,e)}},{key:"SetView",value:function(e){i.mat4.copy(this.view,e),i.mat4.invert(this.viewInverse,this.view),i.mat4.transpose(this.viewTranspose,this.view),i.mat4.getTranslation(this.eyePosition,this.viewInverse),this.UpdateViewProjection()}},{key:"SetProjection",value:function(e,t){i.mat4.copy(this.projection,e),i.mat4.transpose(this.projectionTranspose,this.projection),i.mat4.invert(this.projectionInverse,this.projection),this.GetTargetResolution(this.targetResolution),t&&this.UpdateViewProjection()}},{key:"UpdateViewProjection",value:function(){i.mat4.multiply(this.viewProjection,this.projection,this.view),i.mat4.transpose(this.viewProjectionTranspose,this.viewProjection),U.SetVariableValue("ViewProjectionMat",this.viewProjection)}},{key:"GetTargetResolution",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.vec4.create(),t=this.projection[0]?this.projection[5]/this.projection[0]:0,r=1;t>1.6&&(r=t/1.6);var n=2*Math.atan(r/this.projection[5]);return e[0]=this.viewportWidth,e[1]=this.viewportHeight,e[2]=n,e[3]=n*t,e}},{key:"GetEyePosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.vec3.create();return i.vec3.copy(e,this.eyePosition)}},{key:"IsAlphaTestEnabled",value:function(){return this._alphaTestState.states[Or]}},{key:"IsFrameBufferComplete",value:function(e){return this.gl.checkFramebufferStatus(e)===this.gl.FRAMEBUFFER_COMPLETE}},{key:"GetExtension",value:function(e){for(var t=0;t<go.length;t++){var r=this.gl.getExtension(go[t]+e);if(r)return r}return null}},{key:"GetFallbackTexture",value:function(){return this._fallbackTexture||(this._fallbackTexture=this.CreateSolidTexture()),this._fallbackTexture}},{key:"GetFallbackCubeMap",value:function(){return this._fallbackCube||(this._fallbackCube=this.CreateSolidCube()),this._fallbackCube}},{key:"CreateSolidTexture",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0],t=this.gl,r=this.gl.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(e)),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.bindTexture(t.TEXTURE_2D,null),r}},{key:"CreateSolidCube",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0],t=this.gl,r=this.gl.createTexture();t.bindTexture(t.TEXTURE_CUBE_MAP,r);for(var n=0;n<6;++n)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(e));return t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.NEAREST),t.bindTexture(t.TEXTURE_CUBE_MAP,null),r}},{key:"RenderFullScreenQuad",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Main";if(!e||!e.IsGood())return!1;var r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,this._quadBuffer);for(var n=0;n<e.GetPassCount(t);++n){if(e.ApplyPass(t,n),!this._quadDecl.SetDeclaration(e.GetPassInput(t,n),24))return!1;this.ApplyShadowState(),r.drawArrays(r.TRIANGLE_STRIP,0,4)}return!0}},{key:"RenderTexture",value:function(e){return null===this._blitEffect&&(this._blitEffect=N.a.create({effectFilePath:"res:/graphics/effect/managed/space/system/blit.fx",textures:{BlitSource:""}})),this._blitEffect.parameters.BlitSource.SetTextureRes(e),this.RenderFullScreenQuad(this._blitEffect)}},{key:"RenderCameraSpaceQuad",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Main";if(!e||!e.IsGood())return!1;for(var r=new Float32Array([1,1,0,1,1,1,-1,1,0,1,0,1,1,-1,0,1,1,0,-1,-1,0,1,0,0]),n=this.projectionInverse,a=0;a<4;++a){var o=r.subarray(6*a,6*a+4);i.vec4.transformMat4(o,o,n),i.vec3.scale(o,o,1/o[3]),o[3]=1}var s=this.gl;s.bindBuffer(s.ARRAY_BUFFER,this._cameraQuadBuffer),s.bufferData(s.ARRAY_BUFFER,r,s.STATIC_DRAW);for(var u=0;u<e.GetPassCount(t);++u){if(e.ApplyPass(t,u),!this._quadDecl.SetDeclaration(e.GetPassInput(t,u),24))return!1;this.ApplyShadowState(),s.drawArrays(s.TRIANGLE_STRIP,0,4)}return!0}},{key:"SetRenderState",value:function(e,t){var r=this.gl;switch(this._currentRenderMode=dr,e){case Er:return void(t?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST));case Sr:return void r.depthMask(!!t);case Or:case Mr:case kr:case un:case _n:return void(this._alphaTestState[e]!==t&&(this._alphaTestState.states[e]=t,this._alphaTestState.dirty=!0));case Ar:case Ir:case Gn:case $n:case ri:case ei:case ti:return void(this._alphaBlendState[e]!==t&&(this._alphaBlendState.states[e]=t,this._alphaBlendState.dirty=!0));case Dr:switch(t){case ni:return void r.disable(r.CULL_FACE);case ii:return r.enable(r.CULL_FACE),void r.cullFace(r.FRONT);case ai:return r.enable(r.CULL_FACE),void r.cullFace(r.BACK)}return;case Cr:return void r.depthFunc(512+t-1);case jr:return void(t?r.enable(r.BLEND):r.disable(r.BLEND));case xn:return void r.colorMask(0!=(1&t),0!=(2&t),0!=(4&t),0!=(8&t));case Bn:return void(t?r.enable(r.SCISSOR_TEST):r.disable(r.SCISSOR_TEST));case Un:case Jn:return t=i.num.dwordToFloat(t),void(this._depthOffsetState[e]!==t&&(this._depthOffsetState.states[e]=t,this._depthOffsetState.dirty=!0))}}},{key:"ApplyShadowState",value:function(){var e,t,r,n=this.gl;if(this._alphaBlendState.dirty){var i=n.FUNC_ADD;this._alphaBlendState.states[Gn]===Di?i=n.FUNC_SUBTRACT:this._alphaBlendState.states[Gn]===Ci&&(i=n.FUNC_REVERSE_SUBTRACT);var a=fa[this._alphaBlendState.states[Ar]],o=fa[this._alphaBlendState.states[Ir]];if(this._alphaBlendState.states[$n]){var s=n.FUNC_ADD;this._alphaBlendState.states[Gn]===Di?s=n.FUNC_SUBTRACT:this._alphaBlendState.states[Gn]===Ci&&(s=n.FUNC_REVERSE_SUBTRACT);var u=fa[this._alphaBlendState.states[ei]],c=fa[this._alphaBlendState.states[ti]];n.blendEquationSeparate(i,s),n.blendFuncSeparate(a,o,u,c)}else n.blendEquation(i),n.blendFunc(a,o);this._alphaBlendState.dirty=!1}if(this._depthOffsetState.dirty&&(n.polygonOffset(this._depthOffsetState.states[Un],this._depthOffsetState.states[Jn]),this._depthOffsetState.dirty=!1),this.shadowHandles&&this._alphaTestState.states[Or]){switch(this._alphaTestState.states[kr]){case oi:e=0,t=1,r=-256;break;case si:e=0,t=-1,r=this._alphaTestState.states[Mr]-1;break;case ui:e=1,t=0,r=this._alphaTestState.states[Mr];break;case ci:e=0,t=-1,r=this._alphaTestState.states[Mr];break;case li:e=0,t=1,r=-this._alphaTestState.states[Mr]-1;break;case hi:e=0,t=1,r=-this._alphaTestState.states[Mr];break;default:e=0,t=0,r=1}n.uniform4f(this.shadowHandles.shadowStateInt,t,r,e,0)}}},{key:"SetStandardStates",value:function(e){if(this._currentRenderMode!==e){switch(this.gl.frontFace(this.gl.CW),e){case pr:case _r:case Rr:this.SetRenderState(Er,!0),this.SetRenderState(Sr,!0),this.SetRenderState(Cr,ci),this.SetRenderState(Dr,ii),this.SetRenderState(jr,!1),this.SetRenderState(Or,!1),this.SetRenderState($n,!1),this.SetRenderState(Un,0),this.SetRenderState(Jn,0),this.SetRenderState(xn,15);break;case vr:this.SetRenderState(jr,!1),this.SetRenderState(Or,!0),this.SetRenderState(kr,li),this.SetRenderState(Mr,127),this.SetRenderState(Er,!0),this.SetRenderState(Sr,!0),this.SetRenderState(Cr,ci),this.SetRenderState(Dr,ii),this.SetRenderState(Gn,Ii),this.SetRenderState(Un,0),this.SetRenderState(Jn,0),this.SetRenderState($n,!1),this.SetRenderState(xn,15);break;case yr:this.SetRenderState(Dr,ii),this.SetRenderState(jr,!0),this.SetRenderState(Ar,bi),this.SetRenderState(Ir,gi),this.SetRenderState(Gn,Ii),this.SetRenderState(Er,!0),this.SetRenderState(Sr,!1),this.SetRenderState(Cr,ci),this.SetRenderState(Or,!1),this.SetRenderState(Un,0),this.SetRenderState(Jn,0),this.SetRenderState($n,!1),this.SetRenderState(xn,15);break;case mr:this.SetRenderState(Dr,ni),this.SetRenderState(jr,!0),this.SetRenderState(Ar,vi),this.SetRenderState(Ir,vi),this.SetRenderState(Gn,Ii),this.SetRenderState(Er,!0),this.SetRenderState(Sr,!1),this.SetRenderState(Cr,ci),this.SetRenderState(Or,!1),this.SetRenderState(Un,0),this.SetRenderState(Jn,0),this.SetRenderState($n,!1),this.SetRenderState(xn,15);break;case gr:this.SetRenderState(jr,!1),this.SetRenderState(Or,!1),this.SetRenderState(Dr,ni),this.SetRenderState(Er,!1),this.SetRenderState(Sr,!1),this.SetRenderState(Cr,di),this.SetRenderState(Un,0),this.SetRenderState(Jn,0),this.SetRenderState($n,!1),this.SetRenderState(xn,15);break;default:return}this._currentRenderMode=e}}}])&&wo(t.prototype,r),n&&wo(t,n),o}(o.a);Ao(Mo,"Clock",Date),Ao(Mo,"RequestAnimationFrame",(Io=Object(a.get)(window,po),function(e){return Io(e)})),Ao(Mo,"CancelAnimationFrame",(Do=Object(a.get)(window,vo),function(e){return Do(e)})),Ao(Mo,"category","device"),Mo.prototype.RM_ANY=dr,Mo.prototype.RM_OPAQUE=pr,Mo.prototype.RM_DECAL=vr,Mo.prototype.RM_TRANSPARENT=yr,Mo.prototype.RM_ADDITIVE=mr,Mo.prototype.RM_DEPTH=br,Mo.prototype.RM_DISTORTION=Rr,Mo.prototype.RM_FULLSCREEN=gr,Mo.prototype.RM_PICKABLE=_r,Mo.prototype.RM_DISTORTION=Rr;var ko=new Mo},function(e,t,r){"use strict";r.r(t),r.d(t,"Tw2BatchAccumulator",(function(){return s})),r.d(t,"Tw2ForwardingRenderBatch",(function(){return g})),r.d(t,"Tw2GeometryBatch",(function(){return A})),r.d(t,"Tw2GeometryLineBatch",(function(){return j})),r.d(t,"Tw2RenderBatch",(function(){return l})),r.d(t,"Tw2InstancedMeshBatch",(function(){return z})),r.d(t,"Tw2CurveSet",(function(){return Y})),r.d(t,"Tw2ValueBinding",(function(){return nt})),r.d(t,"Tw2BasicPerObjectData",(function(){return bt})),r.d(t,"EveBasicPerObjectData",(function(){return bt})),r.d(t,"Tw2PerObjectData",(function(){return lt})),r.d(t,"Tw2RawData",(function(){return st})),r.d(t,"Tw2BlendShapeData",(function(){return Rt})),r.d(t,"Tw2GeometryAnimation",(function(){return wt})),r.d(t,"Tw2GeometryBone",(function(){return Ot})),r.d(t,"Tw2GeometryCurve",(function(){return At})),r.d(t,"Tw2GeometryMesh",(function(){return Dt})),r.d(t,"Tw2GeometryMeshArea",(function(){return Mt})),r.d(t,"Tw2GeometryMeshBinding",(function(){return xt})),r.d(t,"Tw2GeometryModel",(function(){return Ft})),r.d(t,"Tw2GeometrySkeleton",(function(){return Lt})),r.d(t,"Tw2GeometryTrackGroup",(function(){return Ut})),r.d(t,"Tw2GeometryTransformTrack",(function(){return Vt})),r.d(t,"Tw2Effect",(function(){return Ht.a})),r.d(t,"Tw2InstancedMesh",(function(){return rr})),r.d(t,"Tw2Mesh",(function(){return Xt})),r.d(t,"Tw2MeshArea",(function(){return ir})),r.d(t,"Tw2MeshLineArea",(function(){return lr})),r.d(t,"Tw2Animation",(function(){return dr})),r.d(t,"Tw2AnimationController",(function(){return un})),r.d(t,"Tw2Bone",(function(){return Jr})),r.d(t,"Tw2Model",(function(){return en})),r.d(t,"Tw2Track",(function(){return rn})),r.d(t,"Tw2TrackGroup",(function(){return an})),r.d(t,"Tw2Parameter",(function(){return W.a})),r.d(t,"Tw2VectorParameter",(function(){return W.b})),r.d(t,"Tw2FloatParameter",(function(){return ne})),r.d(t,"Tw2MatrixParameter",(function(){return de})),r.d(t,"Tw2TransformParameter",(function(){return we})),r.d(t,"Tw2VariableParameter",(function(){return Me})),r.d(t,"Tw2Vector2Parameter",(function(){return Be})),r.d(t,"Tw2Vector3Parameter",(function(){return Xe})),r.d(t,"Tw2Vector4Parameter",(function(){return $e})),r.d(t,"Tw2TextureParameter",(function(){return et.a})),r.d(t,"Tw2PostEffect",(function(){return bn})),r.d(t,"Tw2PostEffectManager",(function(){return Rn})),r.d(t,"Tw2PostEffectStep",(function(){return vn})),r.d(t,"Tw2PostProcess",(function(){return wn})),r.d(t,"Tw2BinaryReader",(function(){return pr.a})),r.d(t,"Tw2ObjectReader",(function(){return vr.a})),r.d(t,"Tw2EffectRes",(function(){return Ir})),r.d(t,"Tw2GeometryRes",(function(){return Lr})),r.d(t,"Tw2LoadingObject",(function(){return Br.a})),r.d(t,"Tw2Resource",(function(){return yr.a})),r.d(t,"Tw2TextureRes",(function(){return Ur.a})),r.d(t,"Tw2VideoRes",(function(){return Qr})),r.d(t,"Tw2SamplerState",(function(){return mr.b})),r.d(t,"Tw2SamplerOverride",(function(){return mr.a})),r.d(t,"Tw2VertexDeclaration",(function(){return gt.a})),r.d(t,"Tw2VertexElement",(function(){return gt.b})),r.d(t,"Tw2Error",(function(){return it.B})),r.d(t,"ErrHTTPRequest",(function(){return it.k})),r.d(t,"ErrHTTPRequestSend",(function(){return it.l})),r.d(t,"ErrHTTPInstance",(function(){return it.i})),r.d(t,"ErrHTTPStatus",(function(){return it.m})),r.d(t,"ErrHTTPReadyState",(function(){return it.j})),r.d(t,"ErrXMLBinaryFormat",(function(){return it.z})),r.d(t,"ErrXMLObjectTypeUndefined",(function(){return it.A})),r.d(t,"ErrGeometryMeshMissingParticleElement",(function(){return it.h})),r.d(t,"ErrGeometryMeshElementComponentsMissing",(function(){return it.g})),r.d(t,"ErrGeometryMeshBoneNameInvalid",(function(){return it.e})),r.d(t,"ErrGeometryMeshEffectBinding",(function(){return it.f})),r.d(t,"ErrGeometryFileType",(function(){return it.d})),r.d(t,"ErrResourcePrefixUnregistered",(function(){return it.s})),r.d(t,"ErrResourcePrefixUndefined",(function(){return it.r})),r.d(t,"ErrResourceExtensionUnregistered",(function(){return it.p})),r.d(t,"ErrResourceExtensionUndefined",(function(){return it.o})),r.d(t,"ErrResourceFormat",(function(){return it.q})),r.d(t,"ErrShaderVersion",(function(){return it.x})),r.d(t,"ErrShaderHeaderSize",(function(){return it.u})),r.d(t,"ErrShaderPermutationValue",(function(){return it.w})),r.d(t,"ErrShaderCompile",(function(){return it.t})),r.d(t,"ErrShaderLink",(function(){return it.v})),r.d(t,"ErrDeclarationValueType",(function(){return it.b})),r.d(t,"ErrSingletonInstantiation",(function(){return it.y})),r.d(t,"ErrAbstractClassMethod",(function(){return it.a})),r.d(t,"ErrFeatureNotImplemented",(function(){return it.c})),r.d(t,"ErrIndexBounds",(function(){return it.n})),r.d(t,"Tw2EventEmitter",(function(){return Tn.a})),r.d(t,"Tw2Float",(function(){return Sn})),r.d(t,"Tw2Frustum",(function(){return An})),r.d(t,"Tw2RenderTarget",(function(){return hn}));var n=r(0);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;i(this,e),o(this,"batches",[]),o(this,"_sortMethod",null),this._sortMethod=t}var t,r,s;return t=e,(r=[{key:"Commit",value:function(e){this.batches.push(e)}},{key:"Clear",value:function(){this.batches=[]}},{key:"Render",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Main";this._sortMethod&&this.batches.sort(this._sortMethod);for(var r=0;r<this.batches.length;++r)this.batches[r]instanceof e?this.batches[r].Render(t):(this.batches[r].renderMode!==n.w.RM_ANY&&n.w.SetStandardStates(this.batches[r].renderMode),n.w.perObjectData=this.batches[r].perObjectData,this.batches[r].Commit(t))}},{key:"length",get:function(){return this.batches.length}}])&&a(t.prototype,r),s&&a(t,s),e}();function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"renderMode",n.w.RM_ANY),c(this,"perObjectData",null)}var t,r,i;return t=e,(r=[{key:"Commit",value:function(e){}}])&&u(t.prototype,r),i&&u(t,i),e}();function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=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(e){return!1}}();return function(){var r,n=m(e);if(t){var i=m(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return v(this,r)}}function v(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?y(e):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var g=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(a,e);var t,r,n,i=p(a);function a(){var e;f(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return b(y(e=i.call(this,...r)),"geometryProvider",null),e}return t=a,(r=[{key:"Commit",value:function(e){this.geometryProvider&&this.geometryProvider.Render(this,e)}}])&&h(t.prototype,r),n&&h(t,n),a}(l);function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function R(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t=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(e){return!1}}();return function(){var r,n=O(e);if(t){var i=O(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return T(this,r)}}function T(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?S(e):t}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var A=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&E(e,t)}(a,e);var t,r,n,i=w(a);function a(){var e;_(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return P(S(e=i.call(this,...r)),"geometryRes",null),P(S(e),"meshIx",0),P(S(e),"start",0),P(S(e),"count",1),P(S(e),"effect",null),e}return t=a,(r=[{key:"Commit",value:function(e){this.geometryRes&&this.effect&&this.geometryRes.RenderAreas(this.meshIx,this.start,this.count,this.effect,e)}}])&&R(t.prototype,r),n&&R(t,n),a}(l);function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function C(e,t){return(C=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(e){var t=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(e){return!1}}();return function(){var r,n=x(e);if(t){var i=x(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k(this,r)}}function k(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var j=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&C(e,t)}(a,e);var t,r,n,i=M(a);function a(){return I(this,a),i.apply(this,arguments)}return t=a,(r=[{key:"Commit",value:function(e){this.geometryRes&&this.effect&&this.geometryRes.RenderLines(this.meshIx,this.start,this.count,this.effect,e)}}])&&D(t.prototype,r),n&&D(t,n),a}(A);function G(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t=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(e){return!1}}();return function(){var r,n=V(e);if(t){var i=V(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return U(this,r)}}function U(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?N(e):t}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(a,e);var t,r,n,i=B(a);function a(){var e;G(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return H(N(e=i.call(this,...r)),"instanceMesh",null),e}return t=a,(r=[{key:"Commit",value:function(e){this.instanceMesh&&this.effect&&this.instanceMesh.RenderAreas(this.meshIx,this.start,this.count,this.effect,e)}}])&&F(t.prototype,r),n&&F(t,n),a}(A);function q(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function X(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Y=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),X(this,"_id",n.F.generateID()),X(this,"name",""),X(this,"curves",[]),X(this,"bindings",[]),X(this,"scale",1),X(this,"playOnLoad",!0),X(this,"isPlaying",!1),X(this,"scaledTime",0)}var t,r,i;return t=e,(r=[{key:"Initialize",value:function(){this.playOnLoad&&this.Play()}},{key:"Play",value:function(){this.isPlaying=!0,this.scaledTime=0}},{key:"PlayFrom",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.isPlaying=!0,this.scaledTime=e}},{key:"Stop",value:function(){this.isPlaying=!1}},{key:"Update",value:function(e){if(this.isPlaying){this.scaledTime+=e*this.scale;for(var t=0;t<this.curves.length;++t)this.curves[t].UpdateValue(this.scaledTime);for(var r=0;r<this.bindings.length;++r)this.bindings[r].CopyValue()}}},{key:"GetMaxCurveDuration",value:function(){for(var e=0,t=0;t<this.curves.length;++t)"GetLength"in this.curves[t]&&(e=Math.max(e,this.curves[t].GetLength()));return e}}])&&q(t.prototype,r),i&&q(t,i),e}(),W=r(6);function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Q(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function J(e){var t=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(e){return!1}}();return function(){var r,n=te(e);if(t){var i=te(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return $(this,r)}}function $(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ee(e):t}function ee(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function te(e){return(te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ne=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Z(e,t)}(o,e);var t,r,i,a=J(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return K(this,o),re(ee(e=a.call(this,t)),"name",""),re(ee(e),"value",1),re(ee(e),"constantBuffer",null),re(ee(e),"offset",null),e.value=n.F.isArrayLike(r)?r[0]:r,e}return t=o,i=[{key:"isValue",value:function(e){return n.F.isNumber(e)}}],(r=[{key:"SetValue",value:function(e){this.value=e,this.OnValueChanged()}},{key:"GetValue",value:function(){return this.value}},{key:"Apply",value:function(e,t){e[t]=this.value}},{key:"EqualsValue",value:function(e){return this.value===e}},{key:"Copy",value:function(e,t){t&&(this.name=e.name),this.SetValue(e.GetValue())}}])&&Q(t.prototype,r),i&&Q(t,i),o}(W.a);function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function se(e){var t=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(e){return!1}}();return function(){var r,n=ce(e);if(t){var i=ce(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ue(this,r)}}function ue(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ce(e){return(ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}re(ne,"constantBufferSize",1);var le,fe,he,de=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(o,e);var t,r,i,a=se(o);function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.z.create();return ie(this,o),a.call(this,e,t)}return t=o,(r=[{key:"Compose",value:function(e,t,r){"value"in e&&(e=e.value),"value"in t&&(t=t.value),"value"in r&&(r=r.value),n.z.fromRotationTranslationScale(this.value,e,t,r),this.OnValueChanged()}},{key:"Decompose",value:function(e,t,r){n.z.getRotation("value"in e?e.value:e,this.value),n.z.getTranslation("value"in t?t.value:t,this.value),n.z.getScaling("value"in r?r.value:r,this.value),"OnValueChanged"in e&&e.OnValueChanged(),"OnValueChanged"in t&&t.OnValueChanged(),"OnValueChanged"in r&&r.OnValueChanged()}},{key:"x",get:function(){return this.GetIndexValue(12)},set:function(e){this.SetIndexValue(12,e)}},{key:"y",get:function(){return this.GetIndexValue(13)},set:function(e){this.SetIndexValue(13,e)}},{key:"z",get:function(){return this.GetIndexValue(14)},set:function(e){this.SetIndexValue(14,e)}}])&&ae(t.prototype,r),i&&ae(t,i),o}(W.b);function pe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ye(e,t,r){return(ye="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Re(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function me(e,t){return(me=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function be(e){var t=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(e){return!1}}();return function(){var r,n=Re(e);if(t){var i=Re(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ge(this,r)}}function ge(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_e(e):t}function _e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(e){return(Re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ee(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}he=16,(fe="constantBufferSize")in(le=de)?Object.defineProperty(le,fe,{value:he,enumerable:!0,configurable:!0,writable:!0}):le[fe]=he;var we=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&me(e,t)}(o,e);var t,r,i,a=be(o);function o(){var e;pe(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Ee(_e(e=a.call(this,...r)),"name",""),Ee(_e(e),"scaling",n.H.fromValues(1,1,1)),Ee(_e(e),"rotationCenter",n.H.create()),Ee(_e(e),"rotation",n.C.create()),Ee(_e(e),"translation",n.H.create()),Ee(_e(e),"transform",n.z.create()),Ee(_e(e),"worldTransform",n.z.create()),Ee(_e(e),"constantBuffer",null),Ee(_e(e),"offset",null),e}return t=o,(r=[{key:"Initialize",value:function(){this.OnValueChanged()}},{key:"GetValue",value:function(e){return e?Array.from(this.transform):new Float32Array(this.transform)}},{key:"OnValueChanged",value:function(e,t){n.z.fromRotationTranslationScaleOrigin(this.transform,this.rotation,this.translation,this.scaling,this.rotationCenter),n.z.transpose(this.worldTransform,this.transform),ye(Re(o.prototype),"OnValueChanged",this).call(this,e,t)}},{key:"Bind",value:function(e,t,r){return!this.constantBuffer&&r>=this.size&&(this.constantBuffer=e,this.offset=t,this.Apply(e,t,r),!0)}},{key:"Apply",value:function(e,t,r){r>=this.constructor.constantBufferSize?e.set(this.worldTransform,t):e.set(this.worldTransform.subarray(0,r),t)}},{key:"Copy",value:function(e,t){t&&(this.name=e.name),n.C.copy(this.rotation,e.rotation),n.H.copy(this.translation,e.translation),n.H.copy(this.scaling,e.scaling),n.H.copy(this.rotationCenter,e.rotationCenter),this.OnValueChanged()}}])&&ve(t.prototype,r),i&&ve(t,i),o}(W.a);function Te(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Oe(e,t){return(Oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Pe(e){var t=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(e){return!1}}();return function(){var r,n=De(e);if(t){var i=De(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ae(this,r)}}function Ae(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Ie(e):t}function Ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function De(e){return(De=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ce(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ee(we,"constantBufferSize",16);var Me=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Oe(e,t)}(o,e);var t,r,i,a=Pe(o);function o(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return Te(this,o),Ce(Ie(e=a.call(this,t)),"variableName",""),e.variableName=r,e}return t=o,(r=[{key:"GetValue",value:function(e){return n.E.GetVariableValue(this.variableName,e)}},{key:"Apply",value:function(e,t,r){this.variable&&this.variable.Apply(e,t,r)}},{key:"AddCallback",value:function(){return!1}},{key:"Copy",value:function(e,t){t&&(this.name=e.name),this.variableName=e.variableName}},{key:"variable",get:function(){return n.E.GetVariable(this.variableName)}},{key:"size",get:function(){return this.variable?this.variable.size:0}}])&&Se(t.prototype,r),i&&Se(t,i),o}(W.a);function ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function je(e,t){return(je=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ge(e){var t=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(e){return!1}}();return function(){var r,n=Le(e);if(t){var i=Le(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Fe(this,r)}}function Fe(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Le(e){return(Le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Be=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&je(e,t)}(o,e);var t,r,i,a=Ge(o);function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.G.fromValues(1,1);return ke(this,o),a.call(this,e,t)}return t=o,(r=[{key:"x",get:function(){return this.GetIndexValue(0)},set:function(e){this.SetIndexValue(0,e)}},{key:"y",get:function(){return this.GetIndexValue(1)},set:function(e){this.SetIndexValue(1,e)}}])&&xe(t.prototype,r),i&&xe(t,i),o}(W.b);function Ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ve(e,t){return(Ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e){var t=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(e){return!1}}();return function(){var r,n=qe(e);if(t){var i=qe(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ze(this,r)}}function ze(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function qe(e){return(qe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Be,"constantBufferSize",2);var Xe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ve(e,t)}(o,e);var t,r,i,a=He(o);function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.H.fromValues(1,1,1);return Ue(this,o),a.call(this,e,t)}return t=o,(r=[{key:"x",get:function(){return this.GetIndexValue(0)},set:function(e){this.SetIndexValue(0,e)}},{key:"y",get:function(){return this.GetIndexValue(1)},set:function(e){this.SetIndexValue(1,e)}},{key:"z",get:function(){return this.GetIndexValue(2)},set:function(e){this.SetIndexValue(2,e)}}])&&Ne(t.prototype,r),i&&Ne(t,i),o}(W.b);function Ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function We(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ke(e,t){return(Ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qe(e){var t=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(e){return!1}}();return function(){var r,n=Je(e);if(t){var i=Je(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ze(this,r)}}function Ze(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Je(e){return(Je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Xe,"constantBufferSize",3);var $e=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ke(e,t)}(o,e);var t,r,i,a=Qe(o);function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.I.fromValues(1,1,1,1);return Ye(this,o),a.call(this,e,t)}return t=o,(r=[{key:"x",get:function(){return this.GetIndexValue(0)},set:function(e){this.SetIndexValue(0,e)}},{key:"y",get:function(){return this.GetIndexValue(1)},set:function(e){this.SetIndexValue(1,e)}},{key:"z",get:function(){return this.GetIndexValue(2)},set:function(e){this.SetIndexValue(2,e)}},{key:"w",get:function(){return this.GetIndexValue(3)},set:function(e){this.SetIndexValue(3,e)}}])&&We(t.prototype,r),i&&We(t,i),o}(W.b);!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}($e,"constantBufferSize",4);var et=r(9);function tt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function rt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),rt(this,"_id",n.F.generateID()),rt(this,"name",""),rt(this,"sourceObject",null),rt(this,"sourceAttribute",""),rt(this,"_sourceElement",null),rt(this,"sourceIsArray",null),rt(this,"destinationObject",null),rt(this,"destinationAttribute",""),rt(this,"_destinationElement",null),rt(this,"destinationIsArray",null),rt(this,"scale",1),rt(this,"offset",n.C.create()),rt(this,"_copyFunc",null)}var t,r,i;return t=e,i=[{key:"CopyValueToValue",value:function(){this.destinationObject[this.destinationAttribute]=this.sourceObject[this.sourceAttribute]*this.scale+this.offset[0]}},{key:"CopyArray",value:function(){for(var e=Math.min(this.destinationObject[this.destinationAttribute].length,this.sourceObject[this.sourceAttribute].length),t=0;t<e;++t)this.destinationObject[this.destinationAttribute][t]=this.sourceObject[this.sourceAttribute][t]*this.scale+this.offset[t]}},{key:"CopyElementToElement",value:function(){this.destinationObject[this.destinationAttribute][this._destinationElement]=this.sourceObject[this.sourceAttribute][this._sourceElement]*this.scale+this.offset[0]}},{key:"ReplicateValue",value:function(){for(var e=0;e<this.destinationObject[this.destinationAttribute].length;++e)this.destinationObject[this.destinationAttribute][e]=this.sourceObject[this.sourceAttribute]*this.scale+this.offset[e]}},{key:"ReplicateElement",value:function(){for(var e=0;e<this.destinationObject[this.destinationAttribute].length;++e)this.destinationObject[this.destinationAttribute][e]=this.sourceObject[this.sourceAttribute][this._sourceElement]*this.scale+this.offset[e]}},{key:"ExtractPos",value:function(){for(var e=0;e<this.destinationObject[this.destinationAttribute].length;++e)this.destinationObject[this.destinationAttribute][e]=this.sourceObject[this.sourceAttribute][e+12]*this.scale+this.offset[e]}},{key:"CopyElementToValue",value:function(){this.destinationObject[this.destinationAttribute]=this.sourceObject[this.sourceAttribute][this._sourceElement]*this.scale+this.offset[0]}},{key:"CopyValueToElement",value:function(){this.destinationObject[this.destinationAttribute][this._destinationElement]=this.sourceObject[this.sourceAttribute]*this.scale+this.offset[0]}},{key:"CopyFloatToBoolean",value:function(){this.destinationObject[this.destinationAttribute]=0!==this.sourceObject[this.sourceAttribute]}}],(r=[{key:"Initialize",value:function(){if(this.sourceObject&&""!==this.sourceAttribute&&this.destinationObject&&""!==this.destinationAttribute){var t=!1,r=!1,i=this.sourceAttribute.substr(-2);".x"===i||".r"===i?(t=!0,this._sourceElement=0,this.sourceAttribute=this.sourceAttribute.substr(0,this.sourceAttribute.length-2)):".y"===i||".g"===i?(t=!0,this._sourceElement=1,this.sourceAttribute=this.sourceAttribute.substr(0,this.sourceAttribute.length-2)):".z"===i||".b"===i?(t=!0,this._sourceElement=2,this.sourceAttribute=this.sourceAttribute.substr(0,this.sourceAttribute.length-2)):".w"===i||".a"===i?(t=!0,this._sourceElement=3,this.sourceAttribute=this.sourceAttribute.substr(0,this.sourceAttribute.length-2)):this.sourceObject instanceof $e&&("v1"===this.sourceAttribute?(t=!0,this._sourceElement=0,this.sourceAttribute="value"):"v2"===this.sourceAttribute?(t=!0,this._sourceElement=1,this.sourceAttribute="value"):"v3"===this.sourceAttribute?(t=!0,this._sourceElement=2,this.sourceAttribute="value"):"v4"===this.sourceAttribute&&(t=!0,this._sourceElement=3,this.sourceAttribute="value"));var a=this.destinationAttribute.substr(-2);".x"===a||".r"===a?(r=!0,this._destinationElement=0,this.destinationAttribute=this.destinationAttribute.substr(0,this.destinationAttribute.length-2)):".y"===a||".g"===a?(r=!0,this._destinationElement=1,this.destinationAttribute=this.destinationAttribute.substr(0,this.destinationAttribute.length-2)):".z"===a||".b"===a?(r=!0,this._destinationElement=2,this.destinationAttribute=this.destinationAttribute.substr(0,this.destinationAttribute.length-2)):".w"===a||".a"===a?(r=!0,this._destinationElement=3,this.destinationAttribute=this.destinationAttribute.substr(0,this.destinationAttribute.length-2)):this.destinationObject instanceof $e&&("v1"===this.destinationAttribute?(r=!0,this._destinationElement=0,this.destinationAttribute="value"):"v2"===this.destinationAttribute?(r=!0,this._destinationElement=1,this.destinationAttribute="value"):"v3"===this.destinationAttribute?(r=!0,this._destinationElement=2,this.destinationAttribute="value"):"v4"===this.destinationAttribute&&(r=!0,this._destinationElement=3,this.destinationAttribute="value")),this.sourceAttribute in this.sourceObject&&this.destinationAttribute in this.destinationObject&&(this.sourceIsArray=n.F.isArrayLike(this.sourceObject[this.sourceAttribute]),this.destinationIsArray=n.F.isArrayLike(this.destinationObject[this.destinationAttribute]),this.sourceIsArray===this.destinationIsArray&&typeof this.sourceObject[this.sourceAttribute]==typeof this.destinationObject[this.destinationAttribute]?this.sourceIsArray?t?this._copyFunc=r?e.CopyElementToElement:e.ReplicateElement:this.sourceObject[this.sourceAttribute].length<=this.destinationObject[this.destinationAttribute].length?this._copyFunc=e.CopyArray:16===this.sourceObject[this.sourceAttribute].length&&(this._copyFunc=e.ExtractPos):this._copyFunc=e.CopyValueToValue:this.sourceIsArray&&t&&n.F.isNumber(this.destinationObject[this.destinationAttribute])?this._copyFunc=e.CopyElementToValue:this.destinationIsArray&&n.F.isNumber(this.sourceObject[this.sourceAttribute])?this._copyFunc=r?e.CopyValueToElement:e.ReplicateValue:n.F.isNumber(this.sourceObject[this.sourceAttribute])&&n.F.isBoolean(this.destinationObject[this.destinationAttribute])&&(this._copyFunc=e.CopyFloatToBoolean))}}},{key:"CopyValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this;this._copyFunc&&(this._copyFunc.call(this),"OnValueChanged"in this.destinationObject&&this.destinationObject.OnValueChanged(e,[this.destinationAttribute]))}}])&&tt(t.prototype,r),i&&tt(t,i),e}(),it=r(2);function at(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ot(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var st=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ot(this,"nextOffset",0),ot(this,"data",null),ot(this,"elements",{}),t&&this.DeclareFromObject(t)}var t,r,i;return t=e,(r=[{key:"Set",value:function(e,t){var r=this.elements[e],n="subarray"in t?"subarray":"slice";this.data.set(t.length>r.size?t[n](0,r.size):t,r.offset)}},{key:"Get",value:function(e){return this.elements[e].array}},{key:"GetData",value:function(e){return this.data.subarray(this.elements[e].offset,this.elements[e].offset+this.elements[e].array.length)}},{key:"Create",value:function(){for(var e in this.data=new Float32Array(this.nextOffset),this.elements)if(this.elements.hasOwnProperty(e)){var t=this.elements[e];if(t.array=this.data.subarray(t.offset,t.offset+t.size),null!==t.value){if(1===t.size)n.F.isNumber(t.value)?t.array[0]=t.value:t.array[0]=t.value[0];else for(var r=0;r<t.size;r++)t.array[r]=t.value[r];t.value=null}}}},{key:"Declare",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null!==r&&!n.F.isArrayLike(r)&&!n.F.isNumber(r))throw new it.b({declaration:e,valueType:typeof r});this.elements[e]={offset:this.nextOffset,size:t,array:null,value:r},this.nextOffset+=t}},{key:"DeclareFromObject",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<e.length;t++){var r=e[t];n.F.isArray(r)?this.Declare(r[0],r[1],r[2]):this.Declare(r.name,r.size,r.value)}this.Create()}}])&&at(t.prototype,r),i&&at(t,i),e}();function ut(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ct(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var lt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ct(this,"perObjectVSData",null),ct(this,"perObjectPSData",null),t&&this.DeclareFromObject(t)}var t,r,i;return t=e,(r=[{key:"SetPerObjectDataToDevice",value:function(e){var t=n.w.gl;this.perObjectVSData&&e[3]&&t.uniform4fv(e[3],this.perObjectVSData.data),this.perObjectPSData&&e[4]&&t.uniform4fv(e[4],this.perObjectPSData.data)}},{key:"DeclareFromObject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.VSData&&(this.perObjectVSData=new st(e.VSData)),e.PSData&&(this.perObjectPSData=new st(e.PSData))}}])&&ut(t.prototype,r),i&&ut(t,i),e}();function ft(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ht(e,t,r){return(ht="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=mt(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function dt(e,t){return(dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function pt(e){var t=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(e){return!1}}();return function(){var r,n=mt(e);if(t){var i=mt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return vt(this,r)}}function vt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?yt(e):t}function yt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mt(e){return(mt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var bt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dt(e,t)}(o,e);var t,r,i,a=pt(o);function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(yt(t=a.call(this)),"perObjectFFEData",null),e&&t.DeclareFromObject(e),t}return t=o,(r=[{key:"SetPerObjectDataToDevice",value:function(e){ht(mt(o.prototype),"SetPerObjectDataToDevice",this).call(this,e),this.perObjectFFEData&&e[5]&&n.w.gl.uniform4fv(e[5],this.perObjectFFEData.data)}},{key:"DeclareFromObject",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ht(mt(o.prototype),"DeclareFromObject",this).call(this,e),e.FFEData&&(this.perObjectFFEData=new st(e.FFEData))}}])&&ft(t.prototype,r),i&&ft(t,i),o}(lt),gt=r(7);function _t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Rt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_t(this,"name",""),_t(this,"declaration",new gt.a),_t(this,"buffers",[]),_t(this,"indexes",null),_t(this,"weightProxy",null)};function Et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Et(this,"name",""),Et(this,"duration",0),Et(this,"trackGroups",[])};function Tt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function St(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ot=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),St(this,"name",""),St(this,"parentIndex",-1),St(this,"position",n.H.create()),St(this,"orientation",n.C.create()),St(this,"scaleShear",n.y.create()),St(this,"localTransform",n.z.create()),St(this,"worldTransform",n.z.create()),St(this,"worldTransformInv",n.z.create())}var t,r,i;return t=e,(r=[{key:"UpdateTransform",value:function(){n.z.fromMat3(this.localTransform,this.scaleShear),n.C.normalize(this.orientation,this.orientation);var t=n.z.fromQuat(e.global.mat4_0,this.orientation);return n.z.multiply(this.localTransform,this.localTransform,t),this.localTransform[12]=this.position[0],this.localTransform[13]=this.position[1],this.localTransform[14]=this.position[2],this.localTransform}}])&&Tt(t.prototype,r),i&&Tt(t,i),e}();function Pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}St(Ot,"global",{mat4_0:n.z.create()});var At=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pt(this,"dimension",0),Pt(this,"degree",0),Pt(this,"knots",null),Pt(this,"controls",null)};function It(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Dt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),It(this,"name",""),It(this,"declaration",new gt.a),It(this,"areas",[]),It(this,"buffer",null),It(this,"bufferLength",0),It(this,"bufferData",null),It(this,"indexes",null),It(this,"indexData",null),It(this,"indexType",0),It(this,"minBounds",n.H.create()),It(this,"maxBounds",n.H.create()),It(this,"boundsSpherePosition",n.H.create()),It(this,"boundsSphereRadius",0),It(this,"bones",[]),It(this,"boneBindings",[])};function Ct(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Mt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ct(this,"name",""),Ct(this,"start",0),Ct(this,"count",0),Ct(this,"minBounds",n.H.create()),Ct(this,"maxBounds",n.H.create()),Ct(this,"boundsSpherePosition",n.H.create()),Ct(this,"boundsSphereRadius",0)};function kt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),kt(this,"mesh",null),kt(this,"bones",[])};function jt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Gt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ft=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Gt(this,"name",""),Gt(this,"meshBindings",[]),Gt(this,"skeleton",null)}var t,r,n;return t=e,(r=[{key:"FindBoneByName",value:function(e){if(!this.skeleton)return null;for(var t=0;t<this.skeleton.bones.length;++t)if(this.skeleton.bones[t].name===e)return this.skeleton.bones[t];return null}}])&&jt(t.prototype,r),n&&jt(t,n),e}();var Lt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"bones",[])};function Bt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ut=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Bt(this,"name",""),Bt(this,"model",null),Bt(this,"transformTracks",[])};function Nt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Vt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Nt(this,"name",""),Nt(this,"position",null),Nt(this,"orientation",null),Nt(this,"scaleShear",null)},Ht=r(13);function zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function qt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Xt=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),qt(this,"_id",n.F.generateID()),qt(this,"name",""),qt(this,"display",!0),qt(this,"visible",{opaqueAreas:!0,transparentAreas:!0,additiveAreas:!0,pickableAreas:!0,decalAreas:!0,depthAreas:!0}),qt(this,"opaqueAreas",[]),qt(this,"transparentAreas",[]),qt(this,"additiveAreas",[]),qt(this,"pickableAreas",[]),qt(this,"decalAreas",[]),qt(this,"depthAreas",[]),qt(this,"meshIndex",0),qt(this,"geometryResPath",""),qt(this,"lowDetailGeometryResPath",""),qt(this,"geometryResource",null)}var t,r,i;return t=e,i=[{key:"GetAreaBatches",value:function(e,t,r,n,i){for(var a=0;a<t.length;++a){var o=t[a];if(o.effect&&o.display){var s=new o.constructor.batchType;s.renderMode=r,s.perObjectData=i,s.geometryRes=e.geometryResource,s.meshIx=e.meshIndex,s.start=o.index,s.count=o.count,s.effect=o.effect,n.Commit(s)}}}}],(r=[{key:"Initialize",value:function(){""!==this.geometryResPath&&(this.geometryResource=n.D.GetResource(this.geometryResPath))}},{key:"IsGood",value:function(){return this.geometryResource&&this.geometryResource.IsGood()}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.includes(this.geometryResource)||e.push(this.geometryResource),n.F.perArrayChild(this.opaqueAreas,"GetResources",e),n.F.perArrayChild(this.transparentAreas,"GetResources",e),n.F.perArrayChild(this.additiveAreas,"GetResources",e),n.F.perArrayChild(this.pickableAreas,"GetResources",e),n.F.perArrayChild(this.decalAreas,"GetResources",e),n.F.perArrayChild(this.depthAreas,"GetResources",e),e}},{key:"GetBatches",value:function(e,t,r){if(!this.IsGood()||!this.display)return!1;var i=this.constructor.GetAreaBatches;switch(e){case n.w.RM_OPAQUE:return void(this.visible.opaqueAreas&&i(this,this.opaqueAreas,e,t,r));case n.w.RM_DECAL:return void(this.visible.decalAreas&&i(this,this.opaqueAreas,e,t,r));case n.w.RM_TRANSPARENT:return void(this.visible.transparentAreas&&i(this,this.transparentAreas,e,t,r));case n.w.RM_ADDITIVE:return void(this.visible.transparentAreas&&i(this,this.additiveAreas,e,t,r));case n.w.RM_PICKABLE:return void(this.visible.pickableAreas&&i(this,this.pickableAreas,e,t,r))}}}])&&zt(t.prototype,r),i&&zt(t,i),e}();function Yt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Kt(e,t,r){return(Kt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=er(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function Qt(e,t){return(Qt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zt(e){var t=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(e){return!1}}();return function(){var r,n=er(e);if(t){var i=er(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Jt(this,r)}}function Jt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?$t(e):t}function $t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function er(e){return(er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qt(e,t)}(o,e);var t,r,i,a=Zt(o);function o(){var e;Yt(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return tr($t(e=a.call(this,...r)),"instanceGeometryResource",null),tr($t(e),"instanceGeometryResPath",""),tr($t(e),"instanceMeshIndex",0),tr($t(e),"minBounds",n.H.create()),tr($t(e),"maxBounds",n.H.create()),e}return t=o,i=[{key:"GetAreaBatches",value:function(e,t,r,n,i){for(var a=0;a<t.length;++a){var o=t[a];if(o.effect&&o.display){var s=new z;s.renderMode=r,s.perObjectData=i,s.instanceMesh=e,s.meshIx=o.meshIndex,s.start=o.index,s.count=o.count,s.effect=o.effect,n.Commit(s)}}}}],(r=[{key:"Initialize",value:function(){Kt(er(o.prototype),"Initialize",this).call(this),""!==this.instanceGeometryResPath&&(this.instanceGeometryResource=n.D.GetResource(this.instanceGeometryResPath))}},{key:"IsGood",value:function(){var e=this.instanceGeometryResource,t=Kt(er(o.prototype),"IsGood",this).call(this),r=!!e&&(!e.IsGood||e.IsGood());return t&&r}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Kt(er(o.prototype),"GetResources",this).call(this,e),this.instanceGeometryResource&&"GetResources"in this.instanceGeometryResource&&this.instanceGeometryResource.GetResources(e),e}},{key:"RenderAreas",value:function(e,t,r,n,i){if(this.IsGood()){var a=this.instanceGeometryResource.GetInstanceBuffer(this.instanceMeshIndex);a&&this.geometryResource.RenderAreasInstanced(e,t,r,n,i,a,this.instanceGeometryResource.GetInstanceDeclaration(this.instanceMeshIndex),this.instanceGeometryResource.GetInstanceStride(this.instanceMeshIndex),this.instanceGeometryResource.GetInstanceCount(this.instanceMeshIndex))}}}])&&Wt(t.prototype,r),i&&Wt(t,i),o}(Xt);function nr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ir=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),nr(this,"_id",n.F.generateID()),nr(this,"name",""),nr(this,"effect",null),nr(this,"meshIndex",0),nr(this,"index",0),nr(this,"count",1),nr(this,"display",!0)};function ar(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function or(e,t){return(or=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sr(e){var t=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(e){return!1}}();return function(){var r,n=cr(e);if(t){var i=cr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ur(this,r)}}function ur(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function cr(e){return(cr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}nr(ir,"batchType",A);var lr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&or(e,t)}(r,e);var t=sr(r);function r(){return ar(this,r),t.apply(this,arguments)}return r}(ir);function fr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(lr,"batchType",j);var dr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hr(this,"animationRes",null),hr(this,"time",0),hr(this,"timeScale",1),hr(this,"cycle",!1),hr(this,"isPlaying",!1),hr(this,"callback",null),hr(this,"trackGroups",[])}var t,r,n;return t=e,(r=[{key:"IsFinished",value:function(){return!this.cycle&&this.time>=this.animationRes.duration}}])&&fr(t.prototype,r),n&&fr(t,n),e}(),pr=r(17),vr=r(16),yr=r(8),mr=r(14);function br(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function gr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var _r=function(){function e(t,r,i,a,o){function s(){for(var e=t.ReadUInt32(),r=e;i.charCodeAt(r);)++r;return i.substr(e,r-e)}!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),gr(this,"techniques",{}),gr(this,"annotations",{});var u=n.w.wrapModes,c=n.w.gl,l=1;r>6&&(l=t.ReadUInt8());for(var f=0;f<l;++f){var h={name:"Main",passes:[]};r>6&&(h.name=s()),this.techniques[h.name]=h;for(var d=t.ReadUInt8(),p=0;p<d;++p){for(var v={stages:[{},{}]},y=t.ReadUInt8(),m=!0,b=0;b<y;++b){var g={};g.inputDefinition=new gt.a,g.constants=[],g.textures=[],g.samplers=[];for(var _=t.ReadUInt8(),R=t.ReadUInt8(),E=0;E<R;++E){var w=t.ReadUInt8();t.ReadUInt8();var T=t.ReadUInt8();t.ReadUInt8(),g.inputDefinition.elements[E]=new gt.b(w,T,0)}g.inputDefinition.RebuildHash();var S=void 0,O=void 0,P=void 0,A=void 0;if(r<5)S=t.ReadUInt32(),O=t.data.subarray(t.cursor,t.cursor+S),t.cursor+=S,P=t.ReadUInt32(),A=t.data.subarray(t.cursor,t.cursor+P),t.cursor+=P;else{S=t.ReadUInt32();var I=t.ReadUInt32();O=i.substr(I,S),P=t.ReadUInt32(),I=t.ReadUInt32(),A=i.substr(I,P)}g.shader=e.CompileShader(_,"",O,o),m?(g.shadowShader=0===P?e.CompileShader(_,"\n#define PS\n",O,o,!0):e.CompileShader(_,"",A,o,!0),null===g.shadowShader&&(m=!1)):g.shadowShader=null,r>=3&&(t.ReadUInt32(),t.ReadUInt32(),t.ReadUInt32()),g.constantSize=0;for(var D=t.ReadUInt32(),C=0;C<D;++C){var M={};if(M.name=s(),M.offset=t.ReadUInt32()/4,M.size=t.ReadUInt32()/4,M.type=t.ReadUInt8(),M.dimension=t.ReadUInt8(),M.elements=t.ReadUInt32(),M.isSRGB=t.ReadUInt8(),M.isAutoregister=t.ReadUInt8(),g.constants[C]=M,!e.ConstantIgnore.includes(M.name)){var k=M.offset+M.size;k>g.constantSize&&(g.constantSize=k)}}var x=t.ReadUInt32()/4;if(g.constantValues=new Float32Array(x),r<5)for(var j=0;j<x;++j)g.constantValues[j]=t.ReadFloat32();else{var G=t.ReadUInt32(),F=t.cursor;t.cursor=a+G;for(var L=0;L<x;++L)g.constantValues[L]=t.ReadFloat32();t.cursor=F}g.constantSize=Math.max(g.constantSize,x);for(var B=t.ReadUInt8(),U=0;U<B;++U){var N={};N.registerIndex=t.ReadUInt8(),N.name=s(),N.type=t.ReadUInt8(),N.isSRGB=t.ReadUInt8(),N.isAutoregister=t.ReadUInt8(),g.textures.push(N)}for(var V=t.ReadUInt8(),H=0;H<V;++H){var z=t.ReadUInt8(),q=r>=4?s():"";t.ReadUInt8();var X=t.ReadUInt8(),Y=t.ReadUInt8(),W=t.ReadUInt8(),K=t.ReadUInt8(),Q=t.ReadUInt8(),Z=t.ReadUInt8();t.ReadFloat32();var J=t.ReadUInt8();t.ReadUInt8();var $=n.C.create();$[0]=t.ReadFloat32(),$[1]=t.ReadFloat32(),$[2]=t.ReadFloat32(),$[3]=t.ReadFloat32(),t.ReadFloat32(),t.ReadFloat32(),r<4&&t.ReadUInt8();var ee=new mr.b;if(ee.registerIndex=z,ee.name=q,1===X){switch(W){case 0:ee.minFilter=c.NEAREST;break;case 1:ee.minFilter=c.NEAREST_MIPMAP_NEAREST;break;default:ee.minFilter=c.NEAREST_MIPMAP_LINEAR}ee.minFilterNoMips=c.NEAREST}else{switch(W){case 0:ee.minFilter=c.LINEAR;break;case 1:ee.minFilter=c.LINEAR_MIPMAP_NEAREST;break;default:ee.minFilter=c.LINEAR_MIPMAP_LINEAR}ee.minFilterNoMips=c.LINEAR}ee.magFilter=1===Y?c.NEAREST:c.LINEAR,ee.addressU=u[K],ee.addressV=u[Q],ee.addressW=u[Z],3!==X&&3!==Y&&3!==W||(ee.anisotropy=Math.max(J,1));for(var te=0;te<g.textures.length;++te)if(g.textures[te].registerIndex===ee.registerIndex){ee.samplerType=4===g.textures[te].type?c.TEXTURE_CUBE_MAP:c.TEXTURE_2D,ee.isVolume=3===g.textures[te].type;break}ee.ComputeHash(),g.samplers.push(ee)}r>=3&&t.ReadUInt8(),v.stages[_]=g}v.states=[];for(var re=t.ReadUInt8(),ne=0;ne<re;++ne){var ie=t.ReadUInt32(),ae=t.ReadUInt32();v.states.push({state:ie,value:ae})}v.shaderProgram=e.CreateProgram(v.stages[0].shader,v.stages[1].shader,v,o),m?(v.shadowShaderProgram=e.CreateProgram(v.stages[0].shadowShader,v.stages[1].shadowShader,v,o,!0),null===v.shadowShaderProgram&&(v.shadowShaderProgram=v.shaderProgram)):v.shadowShaderProgram=v.shaderProgram,h.passes[p]=v}}for(var oe=t.ReadUInt16(),se=0;se<oe;++se){for(var ue=s(),ce=[],le=t.ReadUInt8(),fe=0;fe<le;++fe)switch(ce[fe]={},ce[fe].name=s(),ce[fe].type=t.ReadUInt8(),ce[fe].type){case 0:ce[fe].value=0!==t.ReadUInt32();break;case 1:ce[fe].value=t.ReadInt32();break;case 2:ce[fe].value=t.ReadFloat32();break;default:ce[fe].value=s()}this.annotations[ue]=ce}}var t,r,i;return t=e,i=[{key:"Has",value:function(e,t,r){for(var n in e)if(e.hasOwnProperty(n))for(var i=e[n],a=0;a<i.passes.length;a++)for(var o=i.passes[a],s=0;s<o.stages.length;s++)for(var u=o.stages[s],c=0;c<u[t].length;c++)if(u[t][c].name===r)return!0;return!1}},{key:"CompileShader",value:function(e,t,r,i,a){var o=n.w.ext,s=n.w.gl,u=s.createShader(0===e?s.VERTEX_SHADER:s.FRAGMENT_SHADER);if(o.ShaderBinary)o.ShaderBinary.shaderBinary(u,r);else{var c=t+(n.F.isString(r)?r:String.fromCharCode.apply(null,r));c=c.substr(0,c.length-1),s.shaderSource(u,c),s.compileShader(u)}if(!s.getShaderParameter(u,s.COMPILE_STATUS)){if(!a)throw new it.t({path:i,shaderType:0===e?"vertex":"fragment",infoLog:s.getShaderInfoLog(u)});return null}return u}},{key:"CreateProgram",value:function(e,t,r,i,a){var o=n.w.gl,s={};if(s.program=o.createProgram(),o.attachShader(s.program,e),o.attachShader(s.program,t),o.linkProgram(s.program),!o.getProgramParameter(s.program,o.LINK_STATUS)){if(!a)throw new it.v({path:i,infoLog:o.getProgramInfoLog(s.program)});return null}o.useProgram(s.program),s.constantBufferHandles=[];for(var u=0;u<16;++u)s.constantBufferHandles[u]=o.getUniformLocation(s.program,"cb"+u);s.samplerHandles=[];for(var c=0;c<16;++c)s.samplerHandles[c]=o.getUniformLocation(s.program,"s"+c),o.uniform1i(s.samplerHandles[c],c);for(var l=0;l<16;++l)s.samplerHandles[l+12]=o.getUniformLocation(s.program,"vs"+l),o.uniform1i(s.samplerHandles[l+12],l+12);s.input=new gt.a;for(var f=0;f<r.stages[0].inputDefinition.elements.length;++f){var h=o.getAttribLocation(s.program,"attr"+f);if(h>=0){var d=new gt.b(r.stages[0].inputDefinition.elements[f].usage,r.stages[0].inputDefinition.elements[f].usageIndex);d.location=h,s.input.elements.push(d)}}s.input.RebuildHash(),s.shadowStateInt=o.getUniformLocation(s.program,"ssi"),s.shadowStateFloat=o.getUniformLocation(s.program,"ssf"),s.shadowStateYFlip=o.getUniformLocation(s.program,"ssyf"),o.uniform3f(s.shadowStateYFlip,0,0,1),s.volumeSlices=[];for(var p=0;p<r.stages[1].samplers.length;++p)r.stages[1].samplers[p].isVolume&&(s.volumeSlices[r.stages[1].samplers[p].registerIndex]=o.getUniformLocation(s.program,"s"+r.stages[1].samplers[p].registerIndex+"sl"));return s}}],(r=[{key:"ApplyPass",value:function(e,t){var r=n.w,i=r.gl;t=this.techniques[e].passes[t];for(var a=0;a<t.states.length;++a)r.SetRenderState(t.states[a].state,t.states[a].value);r.IsAlphaTestEnabled()?(i.useProgram(t.shadowShaderProgram.program),r.shadowHandles=t.shadowShaderProgram):(i.useProgram(t.shaderProgram.program),r.shadowHandles=null)}},{key:"HasConstant",value:function(e){return this.constructor.Has(this.techniques,"constants",e)}},{key:"HasTexture",value:function(e){return this.constructor.Has(this.techniques,"textures",e)}},{key:"HasSampler",value:function(e){return this.constructor.Has(this.techniques,"samplers",e)}}])&&br(t.prototype,r),i&&br(t,i),e}();function Rr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function wr(e,t){return(wr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Tr(e){var t=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(e){return!1}}();return function(){var r,n=Pr(e);if(t){var i=Pr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Sr(this,r)}}function Sr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Or(e):t}function Or(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(e){return(Pr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ar(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}gr(_r,"ConstantIgnore",["PerFrameVS","PerObjectVS","PerFramePS","PerObjectPS"]);var Ir=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&wr(e,t)}(a,e);var t,r,n,i=Tr(a);function a(){var e;Rr(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Ar(Or(e=i.call(this,...r)),"passes",[]),Ar(Or(e),"annotations",{}),Ar(Or(e),"permutations",[]),Ar(Or(e),"offsets",[]),Ar(Or(e),"reader",null),Ar(Or(e),"version",0),Ar(Or(e),"stringTable",""),Ar(Or(e),"shaders",{}),e}return t=a,(r=[{key:"Prepare",value:function(e){this.permutations=[],this.offsets=[],this.passes=[],this.annotations={},this.reader=null,this.version=0,this.stringTable="",this.shaders={};var t=new pr.a(new Uint8Array(e)),r="";function n(){for(var e=t.ReadUInt32(),n=e;r.charCodeAt(n);)++n;return r.substr(e,n-e)}var i=t.ReadUInt32();if(i<2||i>7)this.OnError(new it.x({path:this.path,version:i}));else{var a,o;if(i<5){if(0===(a=t.ReadUInt32()))return void this.OnError(new it.u({path:this.path}));t.ReadUInt32();var s=t.ReadUInt32();t.cursor=8+3*a*4,o=t.ReadUInt32(),this.stringTableOffset=t.cursor,r=String.fromCharCode.apply(null,t.data.subarray(t.cursor,t.cursor+o)),t.cursor=s}else{o=t.ReadUInt32(),this.stringTableOffset=t.cursor,r=String.fromCharCode.apply(null,t.data.subarray(t.cursor,t.cursor+o)),t.cursor+=o;for(var u=t.ReadUInt8(),c=0;c<u;++c){for(var l={name:n(),defaultOption:t.ReadUInt8(),description:n(),type:t.ReadUInt8(),options:{},optionCount:t.ReadUInt8()},f=0;f<l.optionCount;++f)l.options[n()]=f;this.permutations.push(l)}if(0===(a=t.ReadUInt32()))return void this.OnError(new it.u({path:this.path}));for(var h=0;h<a;++h)this.offsets.push({index:t.ReadUInt32(),offset:t.ReadUInt32(),size:t.ReadUInt32()});t.ReadUInt32(),t.cursor=t.ReadUInt32()}this.reader=t,this.version=i,this.stringTable=r,this.OnPrepared()}}},{key:"GetShader",value:function(e){if(!this.IsGood())return null;for(var t=0,r=1,n=0;n<this.permutations.length;++n){var i=this.permutations[n],a=i.defaultOption;if(e.hasOwnProperty(i.name)){var o=e[i.name];if(!i.options.hasOwnProperty(o))return this.OnError(new it.w({path:this.path,permutation:i.name,valueName:o})),null;a=i.options[o]}t+=a*r,r*=i.optionCount}if(this.shaders.hasOwnProperty(t))return this.shaders[t];this.reader.cursor=this.offsets[t].offset;var s=null;try{s=new _r(this.reader,this.version,this.stringTable,this.stringTableOffset,this.path)}catch(e){return this.OnError(e),null}return this.shaders[t]=s,s}}])&&Er(t.prototype,r),n&&Er(t,n),a}(yr.a);function Dr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Mr(e,t){return(Mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kr(e){var t=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(e){return!1}}();return function(){var r,n=Gr(e);if(t){var i=Gr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return xr(this,r)}}function xr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?jr(e):t}function jr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gr(e){return(Gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ir.prototype.requestResponseType="arraybuffer";var Lr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mr(e,t)}(o,e);var t,r,i,a=kr(o);function o(){var e;Dr(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Fr(jr(e=a.call(this,...r)),"meshes",[]),Fr(jr(e),"minBounds",n.H.create()),Fr(jr(e),"maxBounds",n.H.create()),Fr(jr(e),"boundsSpherePosition",n.H.create()),Fr(jr(e),"boundsSphereRadius",0),Fr(jr(e),"models",[]),Fr(jr(e),"animations",[]),Fr(jr(e),"systemMirror",!1),e}return t=o,i=[{key:"BindMeshToModel",value:function(e,t,r){var n=new xt;n.mesh=e;for(var i=0;i<n.mesh.boneBindings.length;++i){var a=n.mesh.boneBindings[i],o=t.FindBoneByName(a);if(!o)throw new it.e({path:r.path,mesh:n.mesh.name,bone:a,model:t.name});n.bones[n.bones.length]=o}t.meshBindings[t.meshBindings.length]=n}},{key:"ReadVertexBuffer",value:function(e,t,r){for(var i=e.ReadUInt8(),a=0,o=0;o<i;++o){var s=new gt.b;s.usage=e.ReadUInt8(),s.usageIndex=e.ReadUInt8(),s.fileType=e.ReadUInt8(),s.type=n.w.gl.FLOAT,s.elements=1+(s.fileType>>5),s.offset=4*a,t.elements[o]=s,a+=s.elements}t.RebuildHash(),t.stride=4*a;var u=e.ReadUInt32();if(0===u)return null;for(var c=new Float32Array(a*u),l=0,f=0;f<u;++f)for(var h=0;h<i;++h){var d=t.elements[h];switch(15&d.fileType){case 0:if(0!=(16&d.fileType))for(var p=0;p<d.elements;++p)c[l++]=e.ReadInt8()/127;else for(var v=0;v<d.elements;++v)c[l++]=e.ReadInt8();break;case 1:if(0!=(16&d.fileType))for(var y=0;y<d.elements;++y)c[l++]=e.ReadInt8()/32767;else for(var m=0;m<d.elements;++m)c[l++]=e.ReadInt16();break;case 2:for(var b=0;b<d.elements;++b)c[l++]=e.ReadInt32();break;case 3:for(var g=0;g<d.elements;++g)c[l++]=e.ReadFloat16();break;case 4:for(var _=0;_<d.elements;++_)c[l++]=e.ReadFloat32();break;case 8:if(0!=(16&d.fileType))for(var R=0;R<d.elements;++R)c[l++]=e.ReadUInt8()/255;else for(var E=0;E<d.elements;++E)c[l++]=e.ReadUInt8();break;case 9:if(0!=(16&d.fileType))for(var w=0;w<t.elements[h].elements;++w)c[l++]=e.ReadUInt8()/65535;else for(var T=0;T<d.elements;++T)c[l++]=e.ReadUInt16();break;case 10:for(var S=0;S<d.elements;++S)c[l++]=e.ReadUInt32();break;default:throw new it.d({path:r,key:"fileType",value:15&d.fileType})}}return c}},{key:"ReadIndexBuffer",value:function(e){var t=e.ReadUInt8(),r=e.ReadUInt32();if(0===t){for(var n=new Uint16Array(r),i=0;i<r;++i)n[i]=e.ReadUInt16();return n}for(var a=new Uint32Array(r),o=0;o<r;++o)a[o]=e.ReadUInt32();return a}},{key:"ReadCurve",value:function(e){if(0===e.ReadUInt8())return null;var t=new At;t.dimension=e.ReadUInt8(),t.degree=e.ReadUInt8();var r=e.ReadUInt32();t.knots=new Float32Array(r);for(var n=0;n<r;++n)t.knots[n]=e.ReadFloat32();var i=e.ReadUInt32();t.controls=new Float32Array(i);for(var a=0;a<i;++a)t.controls[a]=e.ReadFloat32();return t}}],(r=[{key:"GetInstanceBuffer",value:function(e){return e<this.meshes.length?this.meshes[e].buffer:void 0}},{key:"GetInstanceDeclaration",value:function(e){return this.meshes[e].declaration}},{key:"GetInstanceStride",value:function(e){return this.meshes[e].declaration.stride}},{key:"GetInstanceCount",value:function(e){return 4*this.meshes[e].bufferLength/this.meshes[e].declaration.stride}},{key:"Prepare",value:function(e){var t=n.w.gl,r=new pr.a(new Uint8Array(e));r.ReadUInt8();for(var i=r.ReadUInt8(),a=0;a<i;++a){var s=new Dt;s.name=r.ReadString();var u=o.ReadVertexBuffer(r,s.declaration,this.path);u?(s.bufferLength=u.length,s.buffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,s.buffer),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW)):s.buffer=null;var c=o.ReadIndexBuffer(r);c?(s.indexes=t.createBuffer(),s.indexType=2===c.BYTES_PER_ELEMENT?t.UNSIGNED_SHORT:t.UNSIGNED_INT,t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,s.indexes),t.bufferData(t.ELEMENT_ARRAY_BUFFER,c,t.STATIC_DRAW)):s.indexes=null;for(var l=r.ReadUInt8(),f=0;f<l;++f)s.areas[f]=new Mt,s.areas[f].name=r.ReadString(),s.areas[f].start=r.ReadUInt32()*c.BYTES_PER_ELEMENT,s.areas[f].count=3*r.ReadUInt32(),s.areas[f].minBounds=n.H.fromValues(r.ReadFloat32(),r.ReadFloat32(),r.ReadFloat32()),s.areas[f].maxBounds=n.H.fromValues(r.ReadFloat32(),r.ReadFloat32(),r.ReadFloat32());var h=r.ReadUInt8();s.boneBindings=[];for(var d=0;d<h;++d)s.boneBindings[d]=r.ReadString();var p=r.ReadUInt16();if((p||this.systemMirror)&&(s.bufferData=u,s.indexData=c),p){s.blendShapes=[];for(var v=0;v<p;++v)s.blendShapes[v]=new Rt,s.blendShapes[v].name=r.ReadString(),s.blendShapes[v].buffer=o.ReadVertexBuffer(r,s.blendShapes[v].declaration,this.path),s.blendShapes[v].indexes=o.ReadIndexBuffer(r)}this.meshes[a]=s}for(var y=r.ReadUInt8(),m=0;m<y;++m){var b=new Ft;b.name=r.ReadString(),b.skeleton=new Lt;for(var g=r.ReadUInt8(),_=0;_<g;++_){var R=new Ot;R.name=r.ReadString();var E=r.ReadUInt8();if(R.parentIndex=r.ReadUInt8(),255===R.parentIndex&&(R.parentIndex=-1),0!=(1&E)?n.H.set(R.position,r.ReadFloat32(),r.ReadFloat32(),r.ReadFloat32()):n.H.set(R.position,0,0,0),0!=(2&E)?n.C.set(R.orientation,r.ReadFloat32(),r.ReadFloat32(),r.ReadFloat32(),r.ReadFloat32()):n.C.identity(R.orientation),0!=(4&E))for(var w=0;w<9;++w)R.scaleShear[w]=r.ReadFloat32();else n.y.identity(R.scaleShear);b.skeleton.bones[_]=R}for(var T=0;T<b.skeleton.bones.length;++T)b.skeleton.bones[T].UpdateTransform(),-1!==b.skeleton.bones[T].parentIndex?n.z.multiply(b.skeleton.bones[T].worldTransform,b.skeleton.bones[b.skeleton.bones[T].parentIndex].worldTransform,b.skeleton.bones[T].localTransform):n.z.copy(b.skeleton.bones[T].worldTransform,b.skeleton.bones[T].localTransform),n.z.invert(b.skeleton.bones[T].worldTransformInv,b.skeleton.bones[T].worldTransform);for(var S=r.ReadUInt8(),O=0;O<S;++O){var P=r.ReadUInt8();P<this.meshes.length&&o.BindMeshToModel(this.meshes[P],b,this)}this.models[this.models.length]=b}for(var A=r.ReadUInt8(),I=0;I<A;++I){var D=new wt;D.name=r.ReadString(),D.duration=r.ReadFloat32();for(var C=r.ReadUInt8(),M=0;M<C;++M){var k=new Ut;k.name=r.ReadString();for(var x=0;x<this.models.length;++x)if(this.models[x].name===k.name){k.model=this.models[x];break}for(var j=r.ReadUInt8(),G=0;G<j;++G){var F=new Vt;if(F.name=r.ReadString(),F.orientation=o.ReadCurve(r),F.position=o.ReadCurve(r),F.scaleShear=o.ReadCurve(r),F.orientation)for(var L=0,B=0,U=0,N=0,V=0;V<F.orientation.controls.length;V+=4){var H=F.orientation.controls[V],z=F.orientation.controls[V+1],q=F.orientation.controls[V+2],X=F.orientation.controls[V+3];L*H+B*z+U*q+N*X<0&&(F.orientation.controls[V]=-H,F.orientation.controls[V+1]=-z,F.orientation.controls[V+2]=-q,F.orientation.controls[V+3]=-X),L=H,B=z,U=q,N=X}k.transformTracks[k.transformTracks.length]=F}D.trackGroups[D.trackGroups.length]=k}this.animations[this.animations.length]=D}this.OnPrepared()}},{key:"RenderAreasInstanced",value:function(e,t,r,i,a,o,s,u,c){if(this.KeepAlive(),!this.IsGood()||!i.IsGood()||e>=this.meshes.length)return!1;var l=n.w,f=l.ext,h=l.gl,d=this.meshes[e],p=i.GetPassCount(a);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,d.indexes);for(var v=0;v<p;++v){i.ApplyPass(a,v);var y=i.GetPassInput(a,v);if(0!==y.elements.length){h.bindBuffer(h.ARRAY_BUFFER,d.buffer),d.declaration.SetPartialDeclaration(y,d.declaration.stride),h.bindBuffer(h.ARRAY_BUFFER,o);var m=s.SetPartialDeclaration(y,u,8,1);l.ApplyShadowState();for(var b=0;b<r;++b)if(b+t<d.areas.length){for(var g=d.areas[b+t],_=g.start,R=g.count;b+1<r&&(g=d.areas[b+1+t]).start===_+2*R;)R+=g.count,++b;f.drawElementsInstanced(h.TRIANGLES,R,d.indexType,_,c)}s.ResetInstanceDivisors(m)}}return!0}},{key:"RenderAreas",value:function(e,t,r,i,a){if(this.KeepAlive(),!this.IsGood()||!i.IsGood()||e>=this.meshes.length)return!1;var o=n.w,s=o.gl,u=this.meshes[e]||this.meshes[0],c=i.GetPassCount(a);s.bindBuffer(s.ARRAY_BUFFER,u.buffer),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,u.indexes);for(var l=0;l<c;++l){i.ApplyPass(a,l);var f=i.GetPassInput(a,l);if(!u.declaration.SetDeclaration(f,u.declaration.stride))return this.OnError(new it.f({path:this.path,pass:l,passInput:f,meshStride:u.declaration.stride})),!1;o.ApplyShadowState();for(var h=0;h<r;++h)if(h+t<u.areas.length){for(var d=u.areas[h+t],p=d.start,v=d.count;h+1<r&&(d=u.areas[h+1+t]).start===p+2*v;)v+=d.count,++h;s.drawElements(s.TRIANGLES,v,u.indexType,p)}}return!0}},{key:"RenderLines",value:function(e,t,r,i,a){if(this.KeepAlive(),!this.IsGood()||!i.IsGood()||e>=this.meshes.length)return!1;var o=n.w,s=o.gl,u=this.meshes[e],c=i.GetPassCount(a);s.bindBuffer(s.ARRAY_BUFFER,u.buffer),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,u.indexes);for(var l=0;l<c;++l){i.ApplyPass(a,l);var f=i.GetPassInput(a,l);if(!u.declaration.SetDeclaration(f,u.declaration.stride))return this.OnError(new it.f({path:this.path,pass:l,passInput:f,meshStride:u.declaration.stride})),!1;o.ApplyShadowState();for(var h=0;h<r;++h)if(h+t<u.areas.length){for(var d=u.areas[h+t],p=d.start,v=d.count;h+1<r&&(d=u.areas[h+1+t]).start===p+2*v;)v+=d.count,++h;s.drawElements(s.LINES,v,u.indexType,p)}}return!0}},{key:"RenderDebugInfo",value:function(e){if(!this.IsGood())return!1;for(var t=0;t<this.models.length;++t)if(this.models[t].skeleton)for(var r=0;r<this.models[t].skeleton.bones.length;++r){var n=this.models[t].skeleton.bones[r];if(n.parentIndex>=0){var i=this.models[t].skeleton.bones[n.parentIndex];e.AddLine([n.worldTransform[12],n.worldTransform[13],n.worldTransform[14]],[i.worldTransform[12],i.worldTransform[13],i.worldTransform[14]],[0,.7,0,1],[0,.7,0,1])}}}},{key:"Unload",value:function(){for(var e=0;e<this.meshes.length;++e){var t=n.w.gl;this.meshes[e].buffer&&(t.deleteBuffer(this.meshes[e].buffer),this.meshes[e].buffer=null),this.meshes[e].indexes&&(t.deleteBuffer(this.meshes[e].indexes),this.meshes[e].indexes=null)}return this._isPurged=!0,this._isGood=!1,!0}}])&&Cr(t.prototype,r),i&&Cr(t,i),o}(yr.a);Lr.prototype.requestResponseType="arraybuffer";var Br=r(15),Ur=r(11);function Nr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Hr(e,t,r){return(Hr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Wr(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function zr(e,t){return(zr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qr(e){var t=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(e){return!1}}();return function(){var r,n=Wr(e);if(t){var i=Wr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Xr(this,r)}}function Xr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Yr(e):t}function Yr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wr(e){return(Wr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Qr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zr(e,t)}(o,e);var t,r,i,a=qr(o);function o(){var e;Nr(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Kr(Yr(e=a.call(this,...r)),"texture",null),Kr(Yr(e),"video",null),Kr(Yr(e),"width",0),Kr(Yr(e),"height",0),Kr(Yr(e),"cycle",!0),Kr(Yr(e),"playOnLoad",!0),Kr(Yr(e),"_currentSampler",0),Kr(Yr(e),"_currentTime",-1),Kr(Yr(e),"_playable",!1),Kr(Yr(e),"_isPlaying",!1),Kr(Yr(e),"_onPlaying",null),Kr(Yr(e),"_onPause",null),Kr(Yr(e),"_onEnded",null),e}return t=o,(r=[{key:"IsGood",value:function(){return this.KeepAlive(),Hr(Wr(o.prototype),"IsGood",this).call(this)&&this.video&&this._playable}},{key:"KeepAlive",value:function(){this.activeFrame=n.D.activeFrame}},{key:"Play",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.cycle=e,this._onEnded=t,this.video&&this._playable?(this.video.loop=this.cycle,this.video.play()):this.playOnLoad=!0}},{key:"Pause",value:function(){this.video?this.video.pause():this.playOnLoad=!1}},{key:"Prepare",value:function(e){var t=n.w.gl;switch(e){case"mp4":case"webm":case"ogg":this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),this.width=this.video.width,this.height=this.video.height,this.video.loop=this.cycle,this.playOnLoad&&this.video.play();break;default:throw new it.p({path:this.path,extension:e})}this.OnPrepared()}},{key:"DoCustomLoad",value:function(e,t){switch(t){case"mp4":case"webm":case"ogg":break;default:throw new it.p({path:e,extension:t})}return this.OnRequested(),n.D._pendingLoads++,this.video=document.createElement("video"),this.video.crossOrigin="anonymous",this.video.muted=!0,this.video.onerror=()=>{n.D._pendingLoads--,this.video=null,this.OnError(new it.k({path:e}))},this.video.oncanplay=()=>{this._playable=!0,this.video.oncanplay=null,n.D._pendingLoads--,n.D._prepareQueue.push([this,t,null]),this.OnLoaded()},this.video.onended=()=>{this._isPlaying=!1,this._onEnded&&this._onEnded(this)},this.video.onpause=()=>{this._isPlaying=!1,this._onPause&&this._onPause(this)},this.video.onplaying=()=>{this._isPlaying=!0,this._onPlaying&&this._onPlaying(this)},this.video.src=e,!0}},{key:"Unload",value:function(){return this.texture&&(n.w.gl.deleteTexture(this.texture),this.texture=null),this._isPlaying=!1,this._playable=!1,this.playOnLoad=!0,this.video=null,!0}},{key:"Bind",value:function(e){var t=n.w,r=t.gl;this.KeepAlive();var i=e.samplerType;i===r.TEXTURE_2D&&(this.texture?(this._currentTime=this.video.currentTime,r.bindTexture(r.TEXTURE_2D,this.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,this.video),r.bindTexture(r.TEXTURE_2D,null),r.bindTexture(i,this.texture),e.hash!==this._currentSampler&&(e.Apply(!1),this._currentSampler=e.hash)):r.bindTexture(r.TEXTURE_2D,t.GetFallbackTexture()))}}])&&Vr(t.prototype,r),i&&Vr(t,i),o}(yr.a);function Zr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Jr=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Zr(this,"boneRes",null),Zr(this,"localTransform",n.z.create()),Zr(this,"worldTransform",n.z.create()),Zr(this,"offsetTransform",n.z.create())};function $r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var en=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$r(this,"modelRes",null),$r(this,"bones",[]),$r(this,"bonesByName",{})};function tn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rn=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),tn(this,"trackRes",null),tn(this,"bone",null)};function nn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var an=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),nn(this,"trackGroupRes",null),nn(this,"model",null),nn(this,"transformTracks",[])};function on(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function sn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var un=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),sn(this,"geometryResources",[]),sn(this,"models",[]),sn(this,"animations",[]),sn(this,"meshBindings",[]),sn(this,"loaded",!1),sn(this,"update",!0),sn(this,"pendingCommands",[]),sn(this,"onPendingCleared",null),sn(this,"_geometryResource",null),t&&this.SetGeometryResource(t)}var t,r,i;return t=e,i=[{key:"AddModel",value:function(e,t){for(var r=0;r<e.models.length;++r)if(e.models[r].modelRes.name===t.name)return null;var n=new en;n.modelRes=t;var i=t.skeleton;if(null!==i)for(var a=0;a<i.bones.length;++a){var o=new Jr;o.boneRes=i.bones[a],n.bones.push(o),n.bonesByName[o.boneRes.name]=o}return e.models.push(n),n}},{key:"FindMeshBindings",value:function(e,t){for(var r=0;r<e.meshBindings.length;++r)if(e.meshBindings[r].resource===t)return e.meshBindings[r];return null}},{key:"DoRebuildCachedData",value:function(t,r){var n=[];if(r.meshes.length)for(var i=0;i<r.models.length;++i){var a=e.AddModel(t,r.models[i]);a&&n.push(a)}for(var o=0;o<t.geometryResources.length;++o)t.AddAnimationsFromRes(t.geometryResources[o]);if(0===r.models.length){for(var s=0;s<r.meshes.length;++s)Lr.BindMeshToModel(r.meshes[s],t.geometryResources[0].models[0],r);r.models.push(t.geometryResources[0].models[0])}for(var u=0;u<r.models.length;++u){for(var c=null,l=0;l<t.models.length;++l)if(t.models[l].modelRes.name===r.models[u].name){c=t.models[l];break}if(null!==c)for(var f=0;f<r.models[u].meshBindings.length;++f){var h=r.meshes.indexOf(r.models[u].meshBindings[f].mesh),d=e.FindMeshBindings(t,r);null===d&&((d=[]).resource=r,t.meshBindings.push(d)),d[h]=new Float32Array(12*r.models[u].meshBindings[f].bones.length);for(var p=0;p<r.models[u].meshBindings[f].bones.length;++p)for(var v=0;v<c.bones.length;++v)if(c.bones[v].boneRes.name===r.models[u].meshBindings[f].bones[p].name){c.bones[v].bindingArrays||(c.bones[v].bindingArrays=[]),c.bones[v].bindingArrays[c.bones[v].bindingArrays.length]={array:d[h],offset:12*p};break}}}if(r.meshes.length&&r.models.length&&t.ResetBoneTransforms(),t.loaded=!0,t.animations.length){if(t.pendingCommands.length)for(var y=0;y<t.pendingCommands.length;++y)t.pendingCommands[y].args?t.pendingCommands[y].func.apply(t,t.pendingCommands[y].args):t.pendingCommands[y].func.apply(t);t.pendingCommands=[],t.onPendingCleared&&t.onPendingCleared(t)}}}],(r=[{key:"GetAnimationsByName",value:function(){if(!this.loaded)return null;for(var e={},t=0;t<this.animations.length;t++)e[this.animations[t].animationRes.name]=this.animations[t];return e}},{key:"GetAnimation",value:function(e){for(var t=0;t<this.animations.length;t++)if(this.animations[t].animationRes.name===e)return this.animations[t];return null}},{key:"ResetAnimation",value:function(e){var t=this.GetAnimation(e);if(t)return t.time=0,t.isPlaying=!1,t.callback=null,!0}},{key:"PlayAnimation",value:function(e,t,r){if(0===this.animations.length)return this.pendingCommands.push({func:this.PlayAnimation,args:[e,t,r]}),!0;var i=this.GetAnimation(e);return i?(i.time=0,i.isPlaying=!0,n.F.isUndefined(t)||(i.cycle=t),r&&(i.callback=r),!0):void 0}},{key:"PlayAnimationFrom",value:function(e,t,r,i){if(0===this.animations.length)return this.pendingCommands.push({func:this.PlayAnimationFrom,args:[e,t,r,i]}),!0;var a=this.GetAnimation(e);return a?(a.time=Math.max(Math.min(t,a.animationRes.duration),0),a.isPlaying=!0,n.F.isUndefined(r)||(a.cycle=r),i&&(a.callback=i),!0):void 0}},{key:"GetPlayingAnimations",value:function(){for(var e=[],t=0;t<this.animations.length;t++)this.animations[t].isPlaying&&e.push(this.animations[t].animationRes.name);return e}},{key:"StopAnimation",value:function(e){if(0!==this.animations.length){e=n.F.toArray(e);for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;for(var i=0;i<this.animations.length;++i)this.animations[i].animationRes.name in t&&(this.animations[i].isPlaying=!1)}else this.pendingCommands.push({func:this.StopAnimation,args:e})}},{key:"StopAllAnimations",value:function(){if(0!==this.animations.length)for(var e=0;e<this.animations.length;++e)this.animations[e].isPlaying=!1;else this.pendingCommands.push({func:this.StopAllAnimations,args:null})}},{key:"StopAllAnimationsExcept",value:function(e){if(0!==this.animations.length){n.F.toArray(e);for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;for(var i=0;i<this.animations.length;++i)this.animations[i].animationRes.name in t||(this.animations[i].isPlaying=!1)}else this.pendingCommands.push({func:this.StopAllAnimationsExcept,args:e})}},{key:"SetGeometryResource",value:function(e){this.models=[],this.animations=[],this.meshBindings=[];for(var t=0;t<this.geometryResources.length;++t)this.geometryResources[t].UnregisterNotification(this);this.loaded=!1,this.geometryResources=[],e&&(this.geometryResources.push(e),e.RegisterNotification(this))}},{key:"AddGeometryResource",value:function(e){for(var t=0;t<this.geometryResources.length;++t)if(this.geometryResources[t]===e)return;this.geometryResources.push(e),e.RegisterNotification(this)}},{key:"AddAnimationsFromRes",value:function(e){for(var t=0;t<e.animations.length;++t){for(var r=null,n=0;n<this.animations.length;++n)if(this.animations[n].animationRes===e.animations[t]){r=this.animations[t];break}r||((r=new dr).animationRes=e.animations[t],this.animations.push(r));for(var i=0;i<r.animationRes.trackGroups.length;++i){for(var a=!1,o=0;o<r.trackGroups.length;++o)if(r.trackGroups[o].trackGroupRes===r.animationRes.trackGroups[i]){a=!0;break}if(!a){for(var s=null,u=0;u<this.models.length;++u)if(this.models[u].modelRes.name===r.animationRes.trackGroups[i].name){s=this.models[u];break}if(null!==s){var c=new an;c.trackGroupRes=r.animationRes.trackGroups[i];for(var l=0;l<c.trackGroupRes.transformTracks.length;++l)for(var f=0;f<s.bones.length;++f)if(s.bones[f].boneRes.name===c.trackGroupRes.transformTracks[l].name){var h=new rn;h.trackRes=c.trackGroupRes.transformTracks[l],h.bone=s.bones[f],c.transformTracks.push(h);break}r.trackGroups.push(c)}}}}}},{key:"ResetBoneTransforms",value:function(){for(var t=0;t<this.models.length;++t)for(var r=0;r<this.models[t].bones.length;++r){var i=this.models[t].bones[r],a=i.boneRes;n.z.copy(i.localTransform,a.localTransform),-1!==a.parentIndex?n.z.multiply(i.worldTransform,i.localTransform,this.models[t].bones[i.boneRes.parentIndex].worldTransform):n.z.set(i.worldTransform,i.localTransform),n.z.identity(i.offsetTransform)}for(var o=n.z.identity(e.global.mat4_0),s=0;s<this.meshBindings.length;++s)for(var u=0;u<this.meshBindings[s].length;++u)for(var c=0;16*c<this.meshBindings[s][u].length;++c)for(var l=0;l<16;++l)this.meshBindings[s][u][16*c+l]=o[l]}},{key:"GetBoneMatrices",value:function(t,r){if(0===this.geometryResources.length)return new Float32Array;r||(r=this.geometryResources[0]);var n=e.FindMeshBindings(this,r);return n&&t<n.length?n[t]:new Float32Array}},{key:"FindModelForMesh",value:function(e,t){if(0===this.geometryResources.length)return null;if(t||(t=this.geometryResources[0]),!t.IsGood())return null;for(var r=t.meshes[e],n=0;n<this.models.length;++n)for(;0<this.models[n].modelRes.meshBindings.length;++n)if(this.models[n].modelRes.meshBindings[0].mesh===r)return this.models[n];return null}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.geometryResources.length;t++)e.includes(this.geometryResources[t])||e.push(this.geometryResources[t]);return e}},{key:"RebuildCachedData",value:function(t){for(var r=!1,n=0;n<this.geometryResources.length;++n)if(this.geometryResources[n]===t){r=!0;break}if(r){for(var i=0;i<this.geometryResources.length;++i)if(!this.geometryResources[i].IsGood())return;for(var a=0;a<this.geometryResources.length;++a)e.DoRebuildCachedData(this,this.geometryResources[a])}}},{key:"Update",value:function(t){if(this.models&&this.update){for(var r=0;r<this.geometryResources.length;++r)this.geometryResources[r].KeepAlive();for(var i=e.global,a=i.mat4_0,o=i.quat_0,s=i.vec3_0,u=i.mat3_0,c=0;c<this.animations.length;++c){var l=this.animations[c];if(l.isPlaying){var f=l.animationRes;l.time+=t*l.timeScale,l.time>f.duration&&(l.callback&&l.callback(this,l),l.cycle?l.time=l.time%f.duration:(l.isPlaying=!1,l.time=f.duration));for(var h=0;h<l.trackGroups.length;++h)for(var d=0;d<l.trackGroups[h].transformTracks.length;++d){var p=l.trackGroups[h].transformTracks[d];p.trackRes.position?n.v.evaluate(p.trackRes.position,l.time,s,l.cycle,f.duration):s[0]=s[1]=s[2]=0,p.trackRes.orientation?(n.v.evaluate(p.trackRes.orientation,l.time,o,l.cycle,f.duration),n.C.normalize(o,o)):n.C.identity(o),p.trackRes.scaleShear?n.v.evaluate(p.trackRes.scaleShear,l.time,u,l.cycle,f.duration):n.y.identity(u),n.z.fromMat3(p.bone.localTransform,u),n.z.multiply(p.bone.localTransform,p.bone.localTransform,n.z.fromQuat(a,o)),p.bone.localTransform[12]=s[0],p.bone.localTransform[13]=s[1],p.bone.localTransform[14]=s[2]}}}for(var v=0;v<this.models.length;++v)for(var y=0;y<this.models[v].bones.length;++y){var m=this.models[v].bones[y];if(-1!==m.boneRes.parentIndex?n.z.multiply(m.worldTransform,this.models[v].bones[m.boneRes.parentIndex].worldTransform,m.localTransform):n.z.copy(m.worldTransform,m.localTransform),n.z.multiply(m.offsetTransform,m.worldTransform,m.boneRes.worldTransformInv),m.bindingArrays)for(var b=0;b<m.bindingArrays.length;++b)m.bindingArrays[b].array[m.bindingArrays[b].offset+0]=m.offsetTransform[0],m.bindingArrays[b].array[m.bindingArrays[b].offset+1]=m.offsetTransform[4],m.bindingArrays[b].array[m.bindingArrays[b].offset+2]=m.offsetTransform[8],m.bindingArrays[b].array[m.bindingArrays[b].offset+3]=m.offsetTransform[12],m.bindingArrays[b].array[m.bindingArrays[b].offset+4]=m.offsetTransform[1],m.bindingArrays[b].array[m.bindingArrays[b].offset+5]=m.offsetTransform[5],m.bindingArrays[b].array[m.bindingArrays[b].offset+6]=m.offsetTransform[9],m.bindingArrays[b].array[m.bindingArrays[b].offset+7]=m.offsetTransform[13],m.bindingArrays[b].array[m.bindingArrays[b].offset+8]=m.offsetTransform[2],m.bindingArrays[b].array[m.bindingArrays[b].offset+9]=m.offsetTransform[6],m.bindingArrays[b].array[m.bindingArrays[b].offset+10]=m.offsetTransform[10],m.bindingArrays[b].array[m.bindingArrays[b].offset+11]=m.offsetTransform[14]}}}},{key:"RenderDebugInfo",value:function(e){for(var t=0;t<this.models.length;++t)for(var r=0;r<this.models[t].bones.length;++r){var n=this.models[t].bones[r];if(n.boneRes.parentIndex>=0){var i=this.models[t].bones[n.boneRes.parentIndex];e.AddLine([n.worldTransform[12],n.worldTransform[13],n.worldTransform[14]],[i.worldTransform[12],i.worldTransform[13],i.worldTransform[14]])}}}}])&&on(t.prototype,r),i&&on(t,i),e}();sn(un,"global",{vec3_0:n.H.create(),quat_0:n.C.create(),mat3_0:n.y.create(),mat4_0:n.z.create()});var cn=r(3);function ln(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var hn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),fn(this,"_id",n.F.generateID()),fn(this,"name",""),fn(this,"texture",null),fn(this,"width",null),fn(this,"height",null),fn(this,"hasDepth",null),fn(this,"_frameBuffer",null),fn(this,"_renderBuffer",null)}var t,r,i;return t=e,(r=[{key:"Destroy",value:function(){var e=n.w.gl;this.texture&&(e.deleteTexture(this.texture.texture),this.texture=null),this._renderBuffer&&(e.deleteRenderbuffer(this._renderBuffer),this._renderBuffer=null),this._frameBuffer&&(e.deleteFramebuffer(this._frameBuffer),this._frameBuffer=null)}},{key:"Create",value:function(e,t,r){var i=n.w.gl;this.Destroy(),this.texture=new Ur.a,this.texture.Attach(i.createTexture()),this._frameBuffer=i.createFramebuffer(),i.bindFramebuffer(i.FRAMEBUFFER,this._frameBuffer),i.bindTexture(i.TEXTURE_2D,this.texture.texture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.UNSIGNED_BYTE,null),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.bindTexture(i.TEXTURE_2D,null),this._renderBuffer=null,r&&(this._renderBuffer=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,this._renderBuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_COMPONENT16,e,t)),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture.texture,0),r&&i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,this._renderBuffer),i.bindRenderbuffer(i.RENDERBUFFER,null),i.bindFramebuffer(i.FRAMEBUFFER,null),this.texture.width=this.width=e,this.texture.height=this.height=t,this.hasDepth=r}},{key:"Set",value:function(){n.w.gl.bindFramebuffer(n.w.gl.FRAMEBUFFER,this._frameBuffer),n.w.gl.viewport(0,0,this.width,this.height)}},{key:"Unset",value:function(){n.w.gl.bindFramebuffer(n.w.gl.FRAMEBUFFER,null),n.w.gl.viewport(0,0,n.w.viewportWidth,n.w.viewportHeight)}}])&&ln(t.prototype,r),i&&ln(t,i),e}();function dn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),pn(this,"_id",Object(cn.generateID)()),pn(this,"name",""),pn(this,"index",-1),pn(this,"display",!0),pn(this,"effect",null),pn(this,"target",null),pn(this,"inputs",{}),pn(this,"_renderTarget",null),pn(this,"_rebuildPending",!0),pn(this,"_onModified",null)}var t,r,n;return t=e,n=[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return Object(cn.assignIfExists)(t,e,["name","display","target","index"]),e.inputs&&Object.assign(t.inputs,e.inputs),t.effect=Ht.a.create({name:e.name,autoParameter:!0,effectFilePath:e.effectFilePath,parameters:e.parameters,textures:e.textures,overrides:e.overrides}),t}}],(r=[{key:"OnValueChanged",value:function(){this._rebuildPending=!0,this._onModified&&this._onModified(this)}},{key:"IsGood",value:function(){return!!this.effect&&this.effect.IsGood()}},{key:"KeepAlive",value:function(){this.effect&&this.effect.KeepAlive()}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.effect&&this.effect.GetResources(e),e}}])&&dn(t.prototype,r),n&&dn(t,n),e}();function yn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),mn(this,"_id",Object(cn.generateID)()),mn(this,"name",""),mn(this,"display",!0),mn(this,"index",-1),mn(this,"width",0),mn(this,"height",0),mn(this,"texture",null),mn(this,"curveSet",null),mn(this,"targets",{}),mn(this,"items",[]),mn(this,"_visibleItems",[]),mn(this,"_rebuildPending",!0),mn(this,"_onChildModified",e=>this.OnValueChanged(e))}var t,r,i;return t=e,i=[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;if(Object(cn.assignIfExists)(t,e,["name","display","index"]),e.targets)for(var r=0;r<e.targets.length;r++)t.targets[e.targets[r]]=null;if(e.steps)for(var n=0;n<e.steps.length;n++)t.CreateItem(e.steps[n]);return t}}],(r=[{key:"OnValueChanged",value:function(){this._rebuildPending=!0}},{key:"IsGood",value:function(){for(var e=0,t=0;t<this.items.length;t++)this.items[t].IsGood()&&e++;return e===this.items.length}},{key:"KeepAlive",value:function(){this.items.forEach(e=>e.KeepAlive())}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.items.length;t++)this.items[t].GetResources(e);return e}},{key:"CreateItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=vn.create(e);return this.AddItem(t),t}},{key:"AddItem",value:function(e){this.items.includes(e)||(e._onModified=this._onChildModified,-1===e.index&&(e.index=this.items.length),this.items.push(e),this.OnValueChanged())}},{key:"RemoveItem",value:function(e){var t=this.items.indexOf(e);-1!==t&&(e._onModified=null,this.items.splice(t,1),this.OnValueChanged())}},{key:"ClearItems",value:function(){for(var e=0;e<this.items.length;e++)this.items[e]._onModified=null;this.items=[],this.OnValueChanged()}},{key:"GetTarget",value:function(e){return e&&e in this.targets?this.targets[e]:null}},{key:"HasTarget",value:function(e){return!(!e||!this.targets[e])}},{key:"CreateTarget",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.w.viewportWidth,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.w.viewportHeight;return this.targets[e]||(this.targets[e]=new hn,this.targets[e].name=e),this.targets[e].Create(t,r,!1),this.targets[e]}},{key:"Update",value:function(e){this.curveSet&&this.curveSet.Update(e)}},{key:"Render",value:function(){var e=n.w,t=e.gl,r=e.viewportWidth,i=e.viewportHeight;if(!this.IsGood()||!this.display||r<=0||i<=0)return!1;if(r!==this.width||i!==this.height||this._rebuildPending||!this.texture){for(var a in this.texture||(this.texture=new Ur.a,this.texture.Attach(t.createTexture())),t.bindTexture(t.TEXTURE_2D,this.texture.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r,i,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),this.width=r,this.height=i,this.targets)this.targets.hasOwnProperty(a)&&this.CreateTarget(a,r,i);this._visibleItems=[];for(var o=0;o<this.items.length;++o){var s=this.items[o],u=s.inputs,c=s.effect,l=c.shader,f=c.parameters;for(var h in l.HasTexture(!f.BlitCurrent)&&(f.BlitCurrent=new et.a("BlitCurrent","rgba:/0,0,0,255")),l.HasTexture(!f.BlitOriginal)&&(f.BlitOriginal=new et.a("BlitOriginal","rgba:/0,0,0,255")),s.target?(this.HasTarget(s.target)||this.CreateTarget(s.target,r,i),s._renderTarget=this.GetTarget(s.target)):s._renderTarget=null,u)if(u.hasOwnProperty(h))if(l.HasTexture(h)){f[h]||(f[h]=new et.a(h));var d=f[h],p=u[h];p?(this.HasTarget(p)||this.CreateTarget(p,r,i),d.SetTextureRes(this.GetTarget(p).texture)):d.SetTextureRes(this.texture)}else console.warn("Invalid input parameter ".concat(h)),delete u[h];if("BlitCurrent"in u&&l.HasConstant("g_texelSize")){f.g_texelSize||(f.g_texelSize=new $e("g_texelSize",[1,1,1,1]));var v=f.g_texelSize,y=this.GetTarget(u.BlitCurrent);y?(v.value[0]=1/y.width,v.value[1]=1/y.width):(v.value[0]=1/r,v.value[1]=1/r),v.OnValueChanged()}s.display&&this._visibleItems.push(s),s._rebuildPending=!1}this._visibleItems.sort((e,t)=>e.index-t.index),this.rebuildPending=!1}t.bindTexture(t.TEXTURE_2D,this.texture.texture),t.copyTexImage2D(t.TEXTURE_2D,0,e.alphaBlendBackBuffer?t.RGBA:t.RGB,0,0,r,i,0),t.bindTexture(t.TEXTURE_2D,null),e.SetStandardStates(n.w.RM_OPAQUE);for(var m=0,b=0;b<this._visibleItems.length;++b){var g=this._visibleItems[b];g.display&&(g._renderTarget?g._renderTarget.Set():(t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,r,i)),e.RenderFullScreenQuad(g.effect),m++)}return!!m}},{key:"steps",get:function(){return this.items}}])&&yn(t.prototype,r),i&&yn(t,i),e}();function gn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}mn(bn,"Item",vn);var Rn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),_n(this,"_id",Object(cn.generateID)()),_n(this,"name","Post manager"),_n(this,"display",!0),_n(this,"items",[])}var t,r,n;return t=e,(r=[{key:"CreateItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=bn.create(e);return this.AddItem(t),t}},{key:"AddItem",value:function(e){this.items.includes(e)||(-1===e.index&&(e.index=this.items.length),this.items.push(e))}},{key:"RemoveItem",value:function(e){var t=this.items.indexOf(e);-1!==t&&this.items.splice(t,1)}},{key:"ClearItems",value:function(){for(var e=0;e<this.items.length;e++)this.items[e].ClearItems();this.items=[]}},{key:"IsGood",value:function(){for(var e=0,t=0;t<this.items.length;t++)this.items[t].IsGood()&&e++;return e===this.items.length}},{key:"KeepAlive",value:function(){for(var e=0;e<this.items.length;e++)this.items[e].KeepAlive()}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.items.length;t++)this.items[t].GetResources(e);return e}},{key:"Update",value:function(e){for(var t=0;t<this.items.length;t++)this.items[t].Update(e)}},{key:"Render",value:function(){if(!this.display)return this.KeepAlive(),!1;for(var e=0,t=0;t<this.items.length;t++)this.items[t].Render()&&e++;return!!e}},{key:"effects",get:function(){return this.items}}])&&gn(t.prototype,r),n&&gn(t,n),e}();function En(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}_n(Rn,"Item",bn);var wn=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),En(this,"stages",[])};En(wn,"partialImplementation",!0);var Tn=r(10);var Sn=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"value",0)};function On(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Pn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var An=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Pn(this,"planes",[n.I.create(),n.I.create(),n.I.create(),n.I.create(),n.I.create(),n.I.create()]),Pn(this,"viewPos",n.H.create()),Pn(this,"viewDir",n.H.create()),Pn(this,"halfWidthProjection",1)}var t,r,i;return t=e,(r=[{key:"Initialize",value:function(t,r,i,a,o){var s=e.global.mat4_0,u=a||n.z.invert(s,t);this.viewPos.set(u.subarray(12,14)),this.viewDir.set(u.subarray(8,10)),this.halfWidthProjection=r[0]*i*.5;var c=o||n.z.multiply(s,r,t);this.planes[0][0]=c[2],this.planes[0][1]=c[6],this.planes[0][2]=c[10],this.planes[0][3]=c[14],this.planes[1][0]=c[3]+c[0],this.planes[1][1]=c[7]+c[4],this.planes[1][2]=c[11]+c[8],this.planes[1][3]=c[15]+c[12],this.planes[2][0]=c[3]-c[1],this.planes[2][1]=c[7]-c[5],this.planes[2][2]=c[11]-c[9],this.planes[2][3]=c[15]-c[13],this.planes[3][0]=c[3]-c[0],this.planes[3][1]=c[7]-c[4],this.planes[3][2]=c[11]-c[8],this.planes[3][3]=c[15]-c[12],this.planes[4][0]=c[3]+c[1],this.planes[4][1]=c[7]+c[5],this.planes[4][2]=c[11]+c[9],this.planes[4][3]=c[15]+c[13],this.planes[5][0]=c[3]-c[2],this.planes[5][1]=c[7]-c[6],this.planes[5][2]=c[11]-c[10],this.planes[5][3]=c[15]-c[14];for(var l=0;l<6;++l){var f=n.H.length(this.planes[l]);this.planes[l][0]/=f,this.planes[l][1]/=f,this.planes[l][2]/=f,this.planes[l][3]/=f}}},{key:"IsSphereVisible",value:function(e,t){for(var r=0;r<6;++r)if(this.planes[r][0]*e[0]+this.planes[r][1]*e[1]+this.planes[r][2]*e[2]+this.planes[r][3]<-t)return!1;return!0}},{key:"GetPixelSizeAcross",value:function(t,r){var i=n.H.subtract(e.global.vec3_0,this.viewPos,t),a=n.H.dot(this.viewDir,i);return a<1e-5&&(a=1e-5),r<1e-5?0:r/a*this.halfWidthProjection*2}}])&&On(t.prototype,r),i&&On(t,i),e}();Pn(An,"global",{vec3_0:n.H.create(),mat4_0:n.z.create()})},function(e,t,r){"use strict";r.d(t,"B",(function(){return g})),r.d(t,"k",(function(){return _})),r.d(t,"l",(function(){return R})),r.d(t,"i",(function(){return E})),r.d(t,"m",(function(){return w})),r.d(t,"j",(function(){return T})),r.d(t,"z",(function(){return S})),r.d(t,"A",(function(){return O})),r.d(t,"h",(function(){return P})),r.d(t,"g",(function(){return A})),r.d(t,"e",(function(){return I})),r.d(t,"f",(function(){return D})),r.d(t,"d",(function(){return C})),r.d(t,"s",(function(){return M})),r.d(t,"r",(function(){return k})),r.d(t,"p",(function(){return x})),r.d(t,"o",(function(){return j})),r.d(t,"q",(function(){return G})),r.d(t,"x",(function(){return F})),r.d(t,"u",(function(){return L})),r.d(t,"w",(function(){return B})),r.d(t,"t",(function(){return U})),r.d(t,"v",(function(){return N})),r.d(t,"b",(function(){return V})),r.d(t,"y",(function(){return H})),r.d(t,"a",(function(){return z})),r.d(t,"c",(function(){return q})),r.d(t,"n",(function(){return X}));var n=r(3);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function s(e){var t=h();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return f(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)})(e)}function f(e,t,r){return(f=h()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&d(i,r.prototype),i}).apply(null,arguments)}function h(){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(e){return!1}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var v,y,m,b=Object(n.isFunction)(Error.captureStackTrace),g=function(e){o(f,e);var t,r,u,l=s(f);function f(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Undefined error";i(this,f);var a=r;return"string"==typeof t?(a=t,t={}):t.message&&(a=t.message,delete t.message),(e=l.call(this)).message=Object(n.template)(a,t),e.name=e.constructor.name,e.data=t,b?Error.captureStackTrace(c(e),f):e.stack=new Error(e.message).stack,e}return t=f,(r=[{key:"emitOn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e&&e.emit&&e.emit(t,Object.assign({err:this,log:{type:"error",message:this.message,err:this}},this.data,r)),this}}])&&a(t.prototype,r),u&&a(t,u),f}(l(Error));m="error",(y="category")in(v=g)?Object.defineProperty(v,y,{value:m,enumerable:!0,configurable:!0,writable:!0}):v[y]=m;var _=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Communication error while requesting resource")}return r}(g),R=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Communication send error while requesting resource")}return r}(g),E=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Could not create an XML HTTP instance")}return r}(g),w=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Communication status error while loading resource (%status%)")}return r}(g),T=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Communication ready state error while loading resource")}return r}(g),S=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Invalid binary format")}return r}(g),O=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,'XML Object type "%type%" undefined type')}return r}(g),P=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Input geometry mesh lacks element required by particle system")}return r}(g),A=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Input geometry mesh elements do not have the required number of components")}return r}(g),I=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Geometry mesh has invalid bone name for model")}return r}(g),D=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Error binding geometry mesh to effect")}return r}(g),C=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Invalid geometry file type (%fileType%)")}return r}(g),M=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Unregistered resource prefix (%prefix%)")}return r}(g),k=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Undefined resource prefix")}return r}(g),x=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Unregistered resource extension (%extension%)")}return r}(g),j=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Undefined resource extension")}return r}(g),G=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Invalid resource format")}return r}(g),F=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Invalid version of effect file (%version%)")}return r}(g),L=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Effect file contains no compiled effects")}return r}(g),B=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Invalid shader permutation value")}return r}(g),U=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Error compiling %shaderType% shader (%infoLog%)")}return r}(g),N=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Error linking shaders")}return r}(g),V=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Invalid declaration value type (%declaration%:%valueType%)")}return r}(g),H=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Multiple class instantiations not yet supported")}return r}(g),z=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Abstract class method not implemented directly on child class")}return r}(g),q=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"%feature=Feature% not implemented")}return r}(g),X=function(e){o(r,e);var t=s(r);function r(e){return i(this,r),t.call(this,e,"Array index out of bounds")}return r}(g)},function(e,t,r){"use strict";r.r(t),r.d(t,"addToArray",(function(){return S})),r.d(t,"perArrayChild",(function(){return O})),r.d(t,"removeFromArray",(function(){return P})),r.d(t,"toArray",(function(){return A})),r.d(t,"toUniqueArray",(function(){return I})),r.d(t,"assignIfExists",(function(){return D})),r.d(t,"get",(function(){return C})),r.d(t,"template",(function(){return M})),r.d(t,"isArray",(function(){return i})),r.d(t,"isArrayLike",(function(){return a})),r.d(t,"isBoolean",(function(){return o})),r.d(t,"isCanvas",(function(){return s})),r.d(t,"isDescriptor",(function(){return u})),r.d(t,"isDNA",(function(){return c})),r.d(t,"isError",(function(){return l})),r.d(t,"isNumber",(function(){return f})),r.d(t,"isFunction",(function(){return h})),r.d(t,"isNoU",(function(){return d})),r.d(t,"isNull",(function(){return p})),r.d(t,"isObject",(function(){return v})),r.d(t,"isObjectLike",(function(){return y})),r.d(t,"isPlain",(function(){return m})),r.d(t,"isPrimary",(function(){return b})),r.d(t,"isString",(function(){return g})),r.d(t,"isSymbol",(function(){return _})),r.d(t,"isTag",(function(){return R})),r.d(t,"isTyped",(function(){return E})),r.d(t,"isUndefined",(function(){return w})),r.d(t,"isVector",(function(){return T})),r.d(t,"enableUUID",(function(){return G})),r.d(t,"generateID",(function(){return F})),r.d(t,"getURL",(function(){return q})),r.d(t,"getURLString",(function(){return X})),r.d(t,"getURLInteger",(function(){return Y})),r.d(t,"getURLFloat",(function(){return W})),r.d(t,"getURLBoolean",(function(){return K}));var n=Object.prototype.toString,i=Array.isArray;function a(e){return!!e&&(i(e)||E(e))}function o(e){return R(e,"[object Boolean]")}function s(e){return!!(e&&e instanceof HTMLCanvasElement)}function u(e){if(!e||!e.hasOwnProperty)return!1;for(var t=["value","initializer","get","set"],r=0,n=t.length;r<n;r++)if(e.hasOwnProperty(t[r]))return!0;return!1}function c(e){return g(e)&&e.match(/(\w|\d|[-_])+:(\w|\d|[-_])+:(\w|\d|[-_])+/)}function l(e){return!!(e&&e instanceof Error||"error"===e.constructor.category)}function f(e){return R(e,"[object Number]")}function h(e){return"function"==typeof e}function d(e){return null==e}function p(e){return null===e}function v(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function y(e){return null!==e&&"object"==typeof e}function m(e){if(!v(e)||!R(e,"[object Object]"))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function b(e){return o(e)||f(e)||g(e)}function g(e){return R(e,"[object String]")}function _(e){return"symbol"==typeof e||R(e,"[object Symbol]")}function R(e,t){return n.call(e)===t}function E(e){return!!e&&!!(e.buffer instanceof ArrayBuffer&&e.BYTES_PER_ELEMENT)}function w(e){return void 0===e}function T(e){if(!e)return!1;if(E(e))return!0;if(i(e)){for(var t=0;t<e.length;t++)if(!f(e[t]))return!1;return!0}}function S(e){for(var t=!1,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0;a<n.length;a++)-1===e.indexOf(n[a])&&(e.push(n[a]),t=!0);return t}function O(e,t){for(var r=e.length,n=arguments.length,i=new Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];for(var o=0;o<r;o++)t in e&&e[o][t](...i)}function P(e){for(var t=!1,r=0;r<(arguments.length<=1?0:arguments.length-1);r++){var n=e.indexOf(r+1<1||arguments.length<=r+1?void 0:arguments[r+1]);-1!==n&&(e.splice(n,1),t=!0)}return t}function A(e){return i(e)?e:[e]}function I(e){return Array.from(new Set(A(e)))}function D(e,t,r){if(t){r=A(r);for(var n=0;n<r.length;n++){var i=r[n];if(void 0!==t[i])if(a(e[i]))if(E(e[i]))if(e[i].length!==t[i].length){var o=e[i].constructor;e[i]=new o(t[i])}else e[i].set(t[i]);else{e[i]=e[i].splice(e[i].length,0);for(var s=0;s<t[i].length;s++)e[i].push(t[i][s])}else if(E(t[i])){var u=t[i].constructor;e[i]=new u(t[i])}else e[i]=t[i]}}}function C(e,t,r){if(!i(t))return t in e?e[t]:r;for(var n=0;n<t.length;n++)if(t[n]in e)return e[t[n]];return r}function M(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.match(/%([^%]+)?%/g)||[],n=0;n<r.length;n++){var i=r[n],a=i.substring(1,i.length-1).split("="),o=a[0]in t?t[a[0]]:a[1];e=e.replace(i,o)}return e}var k=null,x=0,j=null;function G(e){if(e!==k){if(null!==k)throw new Error("Cannot change id generation type once set");if(e){j=[];for(var t=0;t<256;t++)j[t]=(t<16?"0":"")+t.toString(16).toUpperCase()}k=e}}function F(){return null===k&&(k=!1),k?(e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0,j[255&e]+j[e>>8&255]+j[e>>16&255]+j[e>>24&255]+"-"+j[255&t]+j[t>>8&255]+"-"+j[t>>16&15|64]+j[t>>24&255]+"-"+j[63&r|128]+j[r>>8&255]+"-"+j[r>>16&255]+j[r>>24&255]+j[255&n]+j[n>>8&255]+j[n>>16&255]+j[n>>24&255]):x++;var e,t,r,n}for(var L={},B=window.location.search.substring(1).split("&"),U=0;U<B.length;U++){var N=B[U].split("="),V=N[0].toLowerCase(),H=unescape(N[1]);if(V){var z=H.toLowerCase();L[V]="true"===z||"false"!==z&&H}}function q(){return Object.assign({},L)}function X(e,t){return(e=e.toLowerCase())in L?L[e]:t}function Y(e,t){return(e=e.toLowerCase())in L?parseInt(L[e],10):t}function W(e,t){return(e=e.toLowerCase())in L?parseFloat(L[e]):t}function K(e,t){return(e=e.toLowerCase())in L?L[e]:t}},function(e,t,r){"use strict";r.r(t),r.d(t,"num",(function(){return f})),r.d(t,"vec2",(function(){return u})),r.d(t,"vec3",(function(){return a})),r.d(t,"vec4",(function(){return o})),r.d(t,"quat",(function(){return s})),r.d(t,"mat3",(function(){return n})),r.d(t,"mat4",(function(){return i})),r.d(t,"noise",(function(){return oi})),r.d(t,"curve",(function(){return si}));var n={};r.r(n),r.d(n,"create",(function(){return v})),r.d(n,"fromMat4",(function(){return y})),r.d(n,"clone",(function(){return m})),r.d(n,"copy",(function(){return b})),r.d(n,"fromValues",(function(){return g})),r.d(n,"set",(function(){return _})),r.d(n,"identity",(function(){return R})),r.d(n,"transpose",(function(){return E})),r.d(n,"invert",(function(){return w})),r.d(n,"adjoint",(function(){return T})),r.d(n,"determinant",(function(){return S})),r.d(n,"multiply",(function(){return O})),r.d(n,"translate",(function(){return P})),r.d(n,"rotate",(function(){return A})),r.d(n,"scale",(function(){return I})),r.d(n,"fromTranslation",(function(){return D})),r.d(n,"fromRotation",(function(){return C})),r.d(n,"fromScaling",(function(){return M})),r.d(n,"fromMat2d",(function(){return k})),r.d(n,"fromQuat",(function(){return x})),r.d(n,"normalFromMat4",(function(){return j})),r.d(n,"projection",(function(){return G})),r.d(n,"str",(function(){return F})),r.d(n,"frob",(function(){return L})),r.d(n,"add",(function(){return B})),r.d(n,"subtract",(function(){return U})),r.d(n,"multiplyScalar",(function(){return N})),r.d(n,"multiplyScalarAndAdd",(function(){return V})),r.d(n,"exactEquals",(function(){return H})),r.d(n,"equals",(function(){return z})),r.d(n,"mul",(function(){return q})),r.d(n,"sub",(function(){return X}));var i={};r.r(i),r.d(i,"create",(function(){return Y})),r.d(i,"clone",(function(){return W})),r.d(i,"copy",(function(){return K})),r.d(i,"fromValues",(function(){return Q})),r.d(i,"set",(function(){return Z})),r.d(i,"identity",(function(){return J})),r.d(i,"transpose",(function(){return $})),r.d(i,"invert",(function(){return ee})),r.d(i,"adjoint",(function(){return te})),r.d(i,"determinant",(function(){return re})),r.d(i,"multiply",(function(){return ne})),r.d(i,"translate",(function(){return ie})),r.d(i,"scale",(function(){return ae})),r.d(i,"rotate",(function(){return oe})),r.d(i,"rotateX",(function(){return se})),r.d(i,"rotateY",(function(){return ue})),r.d(i,"rotateZ",(function(){return ce})),r.d(i,"fromTranslation",(function(){return le})),r.d(i,"fromScaling",(function(){return fe})),r.d(i,"fromRotation",(function(){return he})),r.d(i,"fromXRotation",(function(){return de})),r.d(i,"fromYRotation",(function(){return pe})),r.d(i,"fromZRotation",(function(){return ve})),r.d(i,"fromRotationTranslation",(function(){return ye})),r.d(i,"fromQuat2",(function(){return me})),r.d(i,"getTranslation",(function(){return be})),r.d(i,"getScaling",(function(){return ge})),r.d(i,"getRotation",(function(){return _e})),r.d(i,"fromRotationTranslationScale",(function(){return Re})),r.d(i,"fromRotationTranslationScaleOrigin",(function(){return Ee})),r.d(i,"fromQuat",(function(){return we})),r.d(i,"frustum",(function(){return Te})),r.d(i,"perspective",(function(){return Se})),r.d(i,"perspectiveFromFieldOfView",(function(){return Oe})),r.d(i,"ortho",(function(){return Pe})),r.d(i,"lookAt",(function(){return Ae})),r.d(i,"targetTo",(function(){return Ie})),r.d(i,"str",(function(){return De})),r.d(i,"frob",(function(){return Ce})),r.d(i,"add",(function(){return Me})),r.d(i,"subtract",(function(){return ke})),r.d(i,"multiplyScalar",(function(){return xe})),r.d(i,"multiplyScalarAndAdd",(function(){return je})),r.d(i,"exactEquals",(function(){return Ge})),r.d(i,"equals",(function(){return Fe})),r.d(i,"mul",(function(){return Le})),r.d(i,"sub",(function(){return Be}));var a={};r.r(a),r.d(a,"create",(function(){return Ue})),r.d(a,"clone",(function(){return Ne})),r.d(a,"length",(function(){return Ve})),r.d(a,"fromValues",(function(){return He})),r.d(a,"copy",(function(){return ze})),r.d(a,"set",(function(){return qe})),r.d(a,"add",(function(){return Xe})),r.d(a,"subtract",(function(){return Ye})),r.d(a,"multiply",(function(){return We})),r.d(a,"divide",(function(){return Ke})),r.d(a,"ceil",(function(){return Qe})),r.d(a,"floor",(function(){return Ze})),r.d(a,"min",(function(){return Je})),r.d(a,"max",(function(){return $e})),r.d(a,"round",(function(){return et})),r.d(a,"scale",(function(){return tt})),r.d(a,"scaleAndAdd",(function(){return rt})),r.d(a,"distance",(function(){return nt})),r.d(a,"squaredDistance",(function(){return it})),r.d(a,"squaredLength",(function(){return at})),r.d(a,"negate",(function(){return ot})),r.d(a,"inverse",(function(){return st})),r.d(a,"normalize",(function(){return ut})),r.d(a,"dot",(function(){return ct})),r.d(a,"cross",(function(){return lt})),r.d(a,"lerp",(function(){return ft})),r.d(a,"hermite",(function(){return ht})),r.d(a,"bezier",(function(){return dt})),r.d(a,"random",(function(){return pt})),r.d(a,"transformMat4",(function(){return vt})),r.d(a,"transformMat3",(function(){return yt})),r.d(a,"transformQuat",(function(){return mt})),r.d(a,"rotateX",(function(){return bt})),r.d(a,"rotateY",(function(){return gt})),r.d(a,"rotateZ",(function(){return _t})),r.d(a,"angle",(function(){return Rt})),r.d(a,"str",(function(){return Et})),r.d(a,"exactEquals",(function(){return wt})),r.d(a,"equals",(function(){return Tt})),r.d(a,"sub",(function(){return Ot})),r.d(a,"mul",(function(){return Pt})),r.d(a,"div",(function(){return At})),r.d(a,"dist",(function(){return It})),r.d(a,"sqrDist",(function(){return Dt})),r.d(a,"len",(function(){return Ct})),r.d(a,"sqrLen",(function(){return Mt})),r.d(a,"forEach",(function(){return kt}));var o={};r.r(o),r.d(o,"create",(function(){return xt})),r.d(o,"clone",(function(){return jt})),r.d(o,"fromValues",(function(){return Gt})),r.d(o,"copy",(function(){return Ft})),r.d(o,"set",(function(){return Lt})),r.d(o,"add",(function(){return Bt})),r.d(o,"subtract",(function(){return Ut})),r.d(o,"multiply",(function(){return Nt})),r.d(o,"divide",(function(){return Vt})),r.d(o,"ceil",(function(){return Ht})),r.d(o,"floor",(function(){return zt})),r.d(o,"min",(function(){return qt})),r.d(o,"max",(function(){return Xt})),r.d(o,"round",(function(){return Yt})),r.d(o,"scale",(function(){return Wt})),r.d(o,"scaleAndAdd",(function(){return Kt})),r.d(o,"distance",(function(){return Qt})),r.d(o,"squaredDistance",(function(){return Zt})),r.d(o,"length",(function(){return Jt})),r.d(o,"squaredLength",(function(){return $t})),r.d(o,"negate",(function(){return er})),r.d(o,"inverse",(function(){return tr})),r.d(o,"normalize",(function(){return rr})),r.d(o,"dot",(function(){return nr})),r.d(o,"lerp",(function(){return ir})),r.d(o,"random",(function(){return ar})),r.d(o,"transformMat4",(function(){return or})),r.d(o,"transformQuat",(function(){return sr})),r.d(o,"str",(function(){return ur})),r.d(o,"exactEquals",(function(){return cr})),r.d(o,"equals",(function(){return lr})),r.d(o,"sub",(function(){return fr})),r.d(o,"mul",(function(){return hr})),r.d(o,"div",(function(){return dr})),r.d(o,"dist",(function(){return pr})),r.d(o,"sqrDist",(function(){return vr})),r.d(o,"len",(function(){return yr})),r.d(o,"sqrLen",(function(){return mr})),r.d(o,"forEach",(function(){return br}));var s={};r.r(s),r.d(s,"create",(function(){return gr})),r.d(s,"identity",(function(){return _r})),r.d(s,"setAxisAngle",(function(){return Rr})),r.d(s,"getAxisAngle",(function(){return Er})),r.d(s,"multiply",(function(){return wr})),r.d(s,"rotateX",(function(){return Tr})),r.d(s,"rotateY",(function(){return Sr})),r.d(s,"rotateZ",(function(){return Or})),r.d(s,"calculateW",(function(){return Pr})),r.d(s,"slerp",(function(){return Ar})),r.d(s,"random",(function(){return Ir})),r.d(s,"invert",(function(){return Dr})),r.d(s,"conjugate",(function(){return Cr})),r.d(s,"fromMat3",(function(){return Mr})),r.d(s,"fromEuler",(function(){return kr})),r.d(s,"str",(function(){return xr})),r.d(s,"clone",(function(){return Nr})),r.d(s,"fromValues",(function(){return Vr})),r.d(s,"copy",(function(){return Hr})),r.d(s,"set",(function(){return zr})),r.d(s,"add",(function(){return qr})),r.d(s,"mul",(function(){return Xr})),r.d(s,"scale",(function(){return Yr})),r.d(s,"dot",(function(){return Wr})),r.d(s,"lerp",(function(){return Kr})),r.d(s,"length",(function(){return Qr})),r.d(s,"len",(function(){return Zr})),r.d(s,"squaredLength",(function(){return Jr})),r.d(s,"sqrLen",(function(){return $r})),r.d(s,"normalize",(function(){return en})),r.d(s,"exactEquals",(function(){return tn})),r.d(s,"equals",(function(){return rn})),r.d(s,"rotationTo",(function(){return nn})),r.d(s,"sqlerp",(function(){return an})),r.d(s,"setAxes",(function(){return on}));var u={};r.r(u),r.d(u,"create",(function(){return sn})),r.d(u,"clone",(function(){return un})),r.d(u,"fromValues",(function(){return cn})),r.d(u,"copy",(function(){return ln})),r.d(u,"set",(function(){return fn})),r.d(u,"add",(function(){return hn})),r.d(u,"subtract",(function(){return dn})),r.d(u,"multiply",(function(){return pn})),r.d(u,"divide",(function(){return vn})),r.d(u,"ceil",(function(){return yn})),r.d(u,"floor",(function(){return mn})),r.d(u,"min",(function(){return bn})),r.d(u,"max",(function(){return gn})),r.d(u,"round",(function(){return _n})),r.d(u,"scale",(function(){return Rn})),r.d(u,"scaleAndAdd",(function(){return En})),r.d(u,"distance",(function(){return wn})),r.d(u,"squaredDistance",(function(){return Tn})),r.d(u,"length",(function(){return Sn})),r.d(u,"squaredLength",(function(){return On})),r.d(u,"negate",(function(){return Pn})),r.d(u,"inverse",(function(){return An})),r.d(u,"normalize",(function(){return In})),r.d(u,"dot",(function(){return Dn})),r.d(u,"cross",(function(){return Cn})),r.d(u,"lerp",(function(){return Mn})),r.d(u,"random",(function(){return kn})),r.d(u,"transformMat2",(function(){return xn})),r.d(u,"transformMat2d",(function(){return jn})),r.d(u,"transformMat3",(function(){return Gn})),r.d(u,"transformMat4",(function(){return Fn})),r.d(u,"rotate",(function(){return Ln})),r.d(u,"angle",(function(){return Bn})),r.d(u,"str",(function(){return Un})),r.d(u,"exactEquals",(function(){return Nn})),r.d(u,"equals",(function(){return Vn})),r.d(u,"len",(function(){return qn})),r.d(u,"sub",(function(){return Xn})),r.d(u,"mul",(function(){return Yn})),r.d(u,"div",(function(){return Wn})),r.d(u,"dist",(function(){return Kn})),r.d(u,"sqrDist",(function(){return Qn})),r.d(u,"sqrLen",(function(){return Zn})),r.d(u,"forEach",(function(){return Jn}));var c,l,f={};f.biCumulative=function(e,t){if(1===t){var r=1-e;return 1-r*r*r}return 2===t?3*e*e-2*e*e*e:e*e*e},f.dwordToFloat=function(e){var t=(16711680&e)>>16,r=(4278190080&e)>>24,n=(r<<1&255|t>>7)-127,i=(127&t)<<16|(65280&e)>>8<<8|255&e;return 0===i&&-127===n?0:(1-2*(r>>7))*(1+i*Math.pow(2,-23))*Math.pow(2,n)},f.exponentialDecay=function(e,t,r,n,i){return t*i/n+r*(e*n-t)/(n*n)*(1-Math.pow(Math.E,-n*i/r))},f.fromHalfFloat=function(e){var t=(32768&e)>>15,r=(31744&e)>>10,n=1023&e;return 0===r?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):31===r?n?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,r-15)*(1+n/Math.pow(2,10))},f.getLongWordOrder=function(e){return 0===e||255===e||-16777216===e?0:1+f.getLongWordOrder(e>>8)},f.log2=function(e){return Math.log(e)*Math.LOG2E},f.toHalfFloat=function(e){c||(c=new Float32Array(1),l=new Int32Array(c.buffer)),c[0]=e;var t=l[0],r=t>>16&32768,n=t>>12&2047,i=t>>23&255;return i<103?r:i>142?(r|=31744,r|=(255===i?0:1)&&8388607&t):i<113?r|=((n|=2048)>>114-i)+(n>>113-i&1):(r|=i-112<<10|n>>1,r+=1&n)};var h=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array,p=Math.random;Math.PI;function v(){var e=new d(9);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function y(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function m(e){var t=new d(9);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 b(e,t){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 g(e,t,r,n,i,a,o,s,u){var c=new d(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=n,c[4]=i,c[5]=a,c[6]=o,c[7]=s,c[8]=u,c}function _(e,t,r,n,i,a,o,s,u,c){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=u,e[8]=c,e}function R(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function E(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function w(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=l*o-s*c,h=-l*a+s*u,d=c*a-o*u,p=r*f+n*h+i*d;return p?(p=1/p,e[0]=f*p,e[1]=(-l*n+i*c)*p,e[2]=(s*n-i*o)*p,e[3]=h*p,e[4]=(l*r-i*u)*p,e[5]=(-s*r+i*a)*p,e[6]=d*p,e[7]=(-c*r+n*u)*p,e[8]=(o*r-n*a)*p,e):null}function T(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8];return e[0]=o*l-s*c,e[1]=i*c-n*l,e[2]=n*s-i*o,e[3]=s*u-a*l,e[4]=r*l-i*u,e[5]=i*a-r*s,e[6]=a*c-o*u,e[7]=n*u-r*c,e[8]=r*o-n*a,e}function S(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function O(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=r[0],d=r[1],p=r[2],v=r[3],y=r[4],m=r[5],b=r[6],g=r[7],_=r[8];return e[0]=h*n+d*o+p*c,e[1]=h*i+d*s+p*l,e[2]=h*a+d*u+p*f,e[3]=v*n+y*o+m*c,e[4]=v*i+y*s+m*l,e[5]=v*a+y*u+m*f,e[6]=b*n+g*o+_*c,e[7]=b*i+g*s+_*l,e[8]=b*a+g*u+_*f,e}function P(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=h*n+d*o+c,e[7]=h*i+d*s+l,e[8]=h*a+d*u+f,e}function A(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=Math.sin(r),d=Math.cos(r);return e[0]=d*n+h*o,e[1]=d*i+h*s,e[2]=d*a+h*u,e[3]=d*o-h*n,e[4]=d*s-h*i,e[5]=d*u-h*a,e[6]=c,e[7]=l,e[8]=f,e}function I(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function D(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function C(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=-r,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function M(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function k(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function x(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,h=i*o,d=i*s,p=i*u,v=a*o,y=a*s,m=a*u;return e[0]=1-f-p,e[3]=l-m,e[6]=h+y,e[1]=l+m,e[4]=1-c-p,e[7]=d-v,e[2]=h-y,e[5]=d+v,e[8]=1-c-f,e}function j(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],h=t[10],d=t[11],p=t[12],v=t[13],y=t[14],m=t[15],b=r*s-n*o,g=r*u-i*o,_=r*c-a*o,R=n*u-i*s,E=n*c-a*s,w=i*c-a*u,T=l*v-f*p,S=l*y-h*p,O=l*m-d*p,P=f*y-h*v,A=f*m-d*v,I=h*m-d*y,D=b*I-g*A+_*P+R*O-E*S+w*T;return D?(D=1/D,e[0]=(s*I-u*A+c*P)*D,e[1]=(u*O-o*I-c*S)*D,e[2]=(o*A-s*O+c*T)*D,e[3]=(i*A-n*I-a*P)*D,e[4]=(r*I-i*O+a*S)*D,e[5]=(n*O-r*A-a*T)*D,e[6]=(v*w-y*E+m*R)*D,e[7]=(y*_-p*w-m*g)*D,e[8]=(p*E-v*_+m*b)*D,e):null}function G(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function F(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function L(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2))}function B(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function U(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function N(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function V(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e}function H(e,t){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]}function z(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],c=e[7],l=e[8],f=t[0],d=t[1],p=t[2],v=t[3],y=t[4],m=t[5],b=t[6],g=t[7],_=t[8];return Math.abs(r-f)<=h*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(n-d)<=h*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(i-p)<=h*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(a-v)<=h*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(o-y)<=h*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(s-m)<=h*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(u-b)<=h*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(c-g)<=h*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(l-_)<=h*Math.max(1,Math.abs(l),Math.abs(_))}var q=O,X=U;function Y(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function W(e){var t=new d(16);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 K(e,t){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 Q(e,t,r,n,i,a,o,s,u,c,l,f,h,p,v,y){var m=new d(16);return m[0]=e,m[1]=t,m[2]=r,m[3]=n,m[4]=i,m[5]=a,m[6]=o,m[7]=s,m[8]=u,m[9]=c,m[10]=l,m[11]=f,m[12]=h,m[13]=p,m[14]=v,m[15]=y,m}function Z(e,t,r,n,i,a,o,s,u,c,l,f,h,d,p,v,y){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=u,e[8]=c,e[9]=l,e[10]=f,e[11]=h,e[12]=d,e[13]=p,e[14]=v,e[15]=y,e}function J(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function $(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function ee(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],h=t[10],d=t[11],p=t[12],v=t[13],y=t[14],m=t[15],b=r*s-n*o,g=r*u-i*o,_=r*c-a*o,R=n*u-i*s,E=n*c-a*s,w=i*c-a*u,T=l*v-f*p,S=l*y-h*p,O=l*m-d*p,P=f*y-h*v,A=f*m-d*v,I=h*m-d*y,D=b*I-g*A+_*P+R*O-E*S+w*T;return D?(D=1/D,e[0]=(s*I-u*A+c*P)*D,e[1]=(i*A-n*I-a*P)*D,e[2]=(v*w-y*E+m*R)*D,e[3]=(h*E-f*w-d*R)*D,e[4]=(u*O-o*I-c*S)*D,e[5]=(r*I-i*O+a*S)*D,e[6]=(y*_-p*w-m*g)*D,e[7]=(l*w-h*_+d*g)*D,e[8]=(o*A-s*O+c*T)*D,e[9]=(n*O-r*A-a*T)*D,e[10]=(p*E-v*_+m*b)*D,e[11]=(f*_-l*E-d*b)*D,e[12]=(s*S-o*P-u*T)*D,e[13]=(r*P-n*S+i*T)*D,e[14]=(v*g-p*R-y*b)*D,e[15]=(l*R-f*g+h*b)*D,e):null}function te(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],h=t[10],d=t[11],p=t[12],v=t[13],y=t[14],m=t[15];return e[0]=s*(h*m-d*y)-f*(u*m-c*y)+v*(u*d-c*h),e[1]=-(n*(h*m-d*y)-f*(i*m-a*y)+v*(i*d-a*h)),e[2]=n*(u*m-c*y)-s*(i*m-a*y)+v*(i*c-a*u),e[3]=-(n*(u*d-c*h)-s*(i*d-a*h)+f*(i*c-a*u)),e[4]=-(o*(h*m-d*y)-l*(u*m-c*y)+p*(u*d-c*h)),e[5]=r*(h*m-d*y)-l*(i*m-a*y)+p*(i*d-a*h),e[6]=-(r*(u*m-c*y)-o*(i*m-a*y)+p*(i*c-a*u)),e[7]=r*(u*d-c*h)-o*(i*d-a*h)+l*(i*c-a*u),e[8]=o*(f*m-d*v)-l*(s*m-c*v)+p*(s*d-c*f),e[9]=-(r*(f*m-d*v)-l*(n*m-a*v)+p*(n*d-a*f)),e[10]=r*(s*m-c*v)-o*(n*m-a*v)+p*(n*c-a*s),e[11]=-(r*(s*d-c*f)-o*(n*d-a*f)+l*(n*c-a*s)),e[12]=-(o*(f*y-h*v)-l*(s*y-u*v)+p*(s*h-u*f)),e[13]=r*(f*y-h*v)-l*(n*y-i*v)+p*(n*h-i*f),e[14]=-(r*(s*y-u*v)-o*(n*y-i*v)+p*(n*u-i*s)),e[15]=r*(s*h-u*f)-o*(n*h-i*f)+l*(n*u-i*s),e}function re(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],f=e[10],h=e[11],d=e[12],p=e[13],v=e[14],y=e[15];return(t*o-r*a)*(f*y-h*v)-(t*s-n*a)*(l*y-h*p)+(t*u-i*a)*(l*v-f*p)+(r*s-n*o)*(c*y-h*d)-(r*u-i*o)*(c*v-f*d)+(n*u-i*s)*(c*p-l*d)}function ne(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=t[9],d=t[10],p=t[11],v=t[12],y=t[13],m=t[14],b=t[15],g=r[0],_=r[1],R=r[2],E=r[3];return e[0]=g*n+_*s+R*f+E*v,e[1]=g*i+_*u+R*h+E*y,e[2]=g*a+_*c+R*d+E*m,e[3]=g*o+_*l+R*p+E*b,g=r[4],_=r[5],R=r[6],E=r[7],e[4]=g*n+_*s+R*f+E*v,e[5]=g*i+_*u+R*h+E*y,e[6]=g*a+_*c+R*d+E*m,e[7]=g*o+_*l+R*p+E*b,g=r[8],_=r[9],R=r[10],E=r[11],e[8]=g*n+_*s+R*f+E*v,e[9]=g*i+_*u+R*h+E*y,e[10]=g*a+_*c+R*d+E*m,e[11]=g*o+_*l+R*p+E*b,g=r[12],_=r[13],R=r[14],E=r[15],e[12]=g*n+_*s+R*f+E*v,e[13]=g*i+_*u+R*h+E*y,e[14]=g*a+_*c+R*d+E*m,e[15]=g*o+_*l+R*p+E*b,e}function ie(e,t,r){var n=r[0],i=r[1],a=r[2],o=void 0,s=void 0,u=void 0,c=void 0,l=void 0,f=void 0,h=void 0,d=void 0,p=void 0,v=void 0,y=void 0,m=void 0;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*a+t[12],e[13]=t[1]*n+t[5]*i+t[9]*a+t[13],e[14]=t[2]*n+t[6]*i+t[10]*a+t[14],e[15]=t[3]*n+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],u=t[2],c=t[3],l=t[4],f=t[5],h=t[6],d=t[7],p=t[8],v=t[9],y=t[10],m=t[11],e[0]=o,e[1]=s,e[2]=u,e[3]=c,e[4]=l,e[5]=f,e[6]=h,e[7]=d,e[8]=p,e[9]=v,e[10]=y,e[11]=m,e[12]=o*n+l*i+p*a+t[12],e[13]=s*n+f*i+v*a+t[13],e[14]=u*n+h*i+y*a+t[14],e[15]=c*n+d*i+m*a+t[15]),e}function ae(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function oe(e,t,r,n){var i,a,o,s,u,c,l,f,d,p,v,y,m,b,g,_,R,E,w,T,S,O,P,A,I=n[0],D=n[1],C=n[2],M=Math.sqrt(I*I+D*D+C*C);return M<h?null:(I*=M=1/M,D*=M,C*=M,i=Math.sin(r),o=1-(a=Math.cos(r)),s=t[0],u=t[1],c=t[2],l=t[3],f=t[4],d=t[5],p=t[6],v=t[7],y=t[8],m=t[9],b=t[10],g=t[11],_=I*I*o+a,R=D*I*o+C*i,E=C*I*o-D*i,w=I*D*o-C*i,T=D*D*o+a,S=C*D*o+I*i,O=I*C*o+D*i,P=D*C*o-I*i,A=C*C*o+a,e[0]=s*_+f*R+y*E,e[1]=u*_+d*R+m*E,e[2]=c*_+p*R+b*E,e[3]=l*_+v*R+g*E,e[4]=s*w+f*T+y*S,e[5]=u*w+d*T+m*S,e[6]=c*w+p*T+b*S,e[7]=l*w+v*T+g*S,e[8]=s*O+f*P+y*A,e[9]=u*O+d*P+m*A,e[10]=c*O+p*P+b*A,e[11]=l*O+v*P+g*A,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function se(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[4],o=t[5],s=t[6],u=t[7],c=t[8],l=t[9],f=t[10],h=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+c*n,e[5]=o*i+l*n,e[6]=s*i+f*n,e[7]=u*i+h*n,e[8]=c*i-a*n,e[9]=l*i-o*n,e[10]=f*i-s*n,e[11]=h*i-u*n,e}function ue(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[0],o=t[1],s=t[2],u=t[3],c=t[8],l=t[9],f=t[10],h=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i-c*n,e[1]=o*i-l*n,e[2]=s*i-f*n,e[3]=u*i-h*n,e[8]=a*n+c*i,e[9]=o*n+l*i,e[10]=s*n+f*i,e[11]=u*n+h*i,e}function ce(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[0],o=t[1],s=t[2],u=t[3],c=t[4],l=t[5],f=t[6],h=t[7];return t!==e&&(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[0]=a*i+c*n,e[1]=o*i+l*n,e[2]=s*i+f*n,e[3]=u*i+h*n,e[4]=c*i-a*n,e[5]=l*i-o*n,e[6]=f*i-s*n,e[7]=h*i-u*n,e}function le(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function fe(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function he(e,t,r){var n,i,a,o=r[0],s=r[1],u=r[2],c=Math.sqrt(o*o+s*s+u*u);return c<h?null:(o*=c=1/c,s*=c,u*=c,n=Math.sin(t),a=1-(i=Math.cos(t)),e[0]=o*o*a+i,e[1]=s*o*a+u*n,e[2]=u*o*a-s*n,e[3]=0,e[4]=o*s*a-u*n,e[5]=s*s*a+i,e[6]=u*s*a+o*n,e[7]=0,e[8]=o*u*a+s*n,e[9]=s*u*a-o*n,e[10]=u*u*a+i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function de(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function pe(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ve(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ye(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,u=i+i,c=a+a,l=n*s,f=n*u,h=n*c,d=i*u,p=i*c,v=a*c,y=o*s,m=o*u,b=o*c;return e[0]=1-(d+v),e[1]=f+b,e[2]=h-m,e[3]=0,e[4]=f-b,e[5]=1-(l+v),e[6]=p+y,e[7]=0,e[8]=h+m,e[9]=p-y,e[10]=1-(l+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function me(e,t){var r=new d(3),n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=n*n+i*i+a*a+o*o;return f>0?(r[0]=2*(s*o+l*n+u*a-c*i)/f,r[1]=2*(u*o+l*i+c*n-s*a)/f,r[2]=2*(c*o+l*a+s*i-u*n)/f):(r[0]=2*(s*o+l*n+u*a-c*i),r[1]=2*(u*o+l*i+c*n-s*a),r[2]=2*(c*o+l*a+s*i-u*n)),ye(e,t,r),e}function be(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function ge(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e}function _e(e,t){var r=t[0]+t[5]+t[10],n=0;return r>0?(n=2*Math.sqrt(r+1),e[3]=.25*n,e[0]=(t[6]-t[9])/n,e[1]=(t[8]-t[2])/n,e[2]=(t[1]-t[4])/n):t[0]>t[5]&&t[0]>t[10]?(n=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/n,e[0]=.25*n,e[1]=(t[1]+t[4])/n,e[2]=(t[8]+t[2])/n):t[5]>t[10]?(n=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/n,e[0]=(t[1]+t[4])/n,e[1]=.25*n,e[2]=(t[6]+t[9])/n):(n=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/n,e[0]=(t[8]+t[2])/n,e[1]=(t[6]+t[9])/n,e[2]=.25*n),e}function Re(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,c=a+a,l=o+o,f=i*u,h=i*c,d=i*l,p=a*c,v=a*l,y=o*l,m=s*u,b=s*c,g=s*l,_=n[0],R=n[1],E=n[2];return e[0]=(1-(p+y))*_,e[1]=(h+g)*_,e[2]=(d-b)*_,e[3]=0,e[4]=(h-g)*R,e[5]=(1-(f+y))*R,e[6]=(v+m)*R,e[7]=0,e[8]=(d+b)*E,e[9]=(v-m)*E,e[10]=(1-(f+p))*E,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function Ee(e,t,r,n,i){var a=t[0],o=t[1],s=t[2],u=t[3],c=a+a,l=o+o,f=s+s,h=a*c,d=a*l,p=a*f,v=o*l,y=o*f,m=s*f,b=u*c,g=u*l,_=u*f,R=n[0],E=n[1],w=n[2],T=i[0],S=i[1],O=i[2],P=(1-(v+m))*R,A=(d+_)*R,I=(p-g)*R,D=(d-_)*E,C=(1-(h+m))*E,M=(y+b)*E,k=(p+g)*w,x=(y-b)*w,j=(1-(h+v))*w;return e[0]=P,e[1]=A,e[2]=I,e[3]=0,e[4]=D,e[5]=C,e[6]=M,e[7]=0,e[8]=k,e[9]=x,e[10]=j,e[11]=0,e[12]=r[0]+T-(P*T+D*S+k*O),e[13]=r[1]+S-(A*T+C*S+x*O),e[14]=r[2]+O-(I*T+M*S+j*O),e[15]=1,e}function we(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,f=n*s,h=i*o,d=i*s,p=i*u,v=a*o,y=a*s,m=a*u;return e[0]=1-f-p,e[1]=l+m,e[2]=h-y,e[3]=0,e[4]=l-m,e[5]=1-c-p,e[6]=d+v,e[7]=0,e[8]=h+y,e[9]=d-v,e[10]=1-c-f,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Te(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(i-n),c=1/(a-o);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0,e}function Se(e,t,r,n,i){var a=1/Math.tan(t/2),o=void 0;return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(o=1/(n-i),e[10]=(i+n)*o,e[14]=2*i*n*o):(e[10]=-1,e[14]=-2*n),e}function Oe(e,t,r,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),u=2/(o+s),c=2/(i+a);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(o-s)*u*.5,e[9]=(i-a)*c*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function Pe(e,t,r,n,i,a,o){var s=1/(t-r),u=1/(n-i),c=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*u,e[14]=(o+a)*c,e[15]=1,e}function Ae(e,t,r,n){var i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,c=void 0,l=void 0,f=void 0,d=void 0,p=void 0,v=t[0],y=t[1],m=t[2],b=n[0],g=n[1],_=n[2],R=r[0],E=r[1],w=r[2];return Math.abs(v-R)<h&&Math.abs(y-E)<h&&Math.abs(m-w)<h?J(e):(l=v-R,f=y-E,d=m-w,i=g*(d*=p=1/Math.sqrt(l*l+f*f+d*d))-_*(f*=p),a=_*(l*=p)-b*d,o=b*f-g*l,(p=Math.sqrt(i*i+a*a+o*o))?(i*=p=1/p,a*=p,o*=p):(i=0,a=0,o=0),s=f*o-d*a,u=d*i-l*o,c=l*a-f*i,(p=Math.sqrt(s*s+u*u+c*c))?(s*=p=1/p,u*=p,c*=p):(s=0,u=0,c=0),e[0]=i,e[1]=s,e[2]=l,e[3]=0,e[4]=a,e[5]=u,e[6]=f,e[7]=0,e[8]=o,e[9]=c,e[10]=d,e[11]=0,e[12]=-(i*v+a*y+o*m),e[13]=-(s*v+u*y+c*m),e[14]=-(l*v+f*y+d*m),e[15]=1,e)}function Ie(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],f=a-r[1],h=o-r[2],d=l*l+f*f+h*h;d>0&&(l*=d=1/Math.sqrt(d),f*=d,h*=d);var p=u*h-c*f,v=c*l-s*h,y=s*f-u*l;return(d=p*p+v*v+y*y)>0&&(p*=d=1/Math.sqrt(d),v*=d,y*=d),e[0]=p,e[1]=v,e[2]=y,e[3]=0,e[4]=f*y-h*v,e[5]=h*p-l*y,e[6]=l*v-f*p,e[7]=0,e[8]=l,e[9]=f,e[10]=h,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e}function De(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Ce(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2)+Math.pow(e[9],2)+Math.pow(e[10],2)+Math.pow(e[11],2)+Math.pow(e[12],2)+Math.pow(e[13],2)+Math.pow(e[14],2)+Math.pow(e[15],2))}function Me(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function ke(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function xe(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function je(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function Ge(e,t){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]}function Fe(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],u=e[6],c=e[7],l=e[8],f=e[9],d=e[10],p=e[11],v=e[12],y=e[13],m=e[14],b=e[15],g=t[0],_=t[1],R=t[2],E=t[3],w=t[4],T=t[5],S=t[6],O=t[7],P=t[8],A=t[9],I=t[10],D=t[11],C=t[12],M=t[13],k=t[14],x=t[15];return Math.abs(r-g)<=h*Math.max(1,Math.abs(r),Math.abs(g))&&Math.abs(n-_)<=h*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(i-R)<=h*Math.max(1,Math.abs(i),Math.abs(R))&&Math.abs(a-E)<=h*Math.max(1,Math.abs(a),Math.abs(E))&&Math.abs(o-w)<=h*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-T)<=h*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(u-S)<=h*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-O)<=h*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(l-P)<=h*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(f-A)<=h*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(d-I)<=h*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-D)<=h*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(v-C)<=h*Math.max(1,Math.abs(v),Math.abs(C))&&Math.abs(y-M)<=h*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(m-k)<=h*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(b-x)<=h*Math.max(1,Math.abs(b),Math.abs(x))}var Le=ne,Be=ke;function Ue(){var e=new d(3);return d!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Ne(e){var t=new d(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ve(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function He(e,t,r){var n=new d(3);return n[0]=e,n[1]=t,n[2]=r,n}function ze(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function qe(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function Xe(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function Ye(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function We(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function Ke(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function Qe(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function Ze(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function Je(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function $e(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function et(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function tt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function rt(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function nt(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function it(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function at(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function ot(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function st(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function ut(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function ct(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function lt(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}function ft(e,t,r,n){var i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e}function ht(e,t,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e}function dt(e,t,r,n,i,a){var o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,f=3*u*o,h=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*f+i[0]*h,e[1]=t[1]*c+r[1]*l+n[1]*f+i[1]*h,e[2]=t[2]*c+r[2]*l+n[2]*f+i[2]*h,e}function pt(e,t){t=t||1;var r=2*p()*Math.PI,n=2*p()-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e}function vt(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e}function yt(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function mt(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],l=i*c-a*u,f=a*s-n*c,h=n*u-i*s,d=i*h-a*f,p=a*l-n*h,v=n*f-i*l,y=2*o;return l*=y,f*=y,h*=y,d*=2,p*=2,v*=2,e[0]=s+l+d,e[1]=u+f+p,e[2]=c+h+v,e}function bt(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function gt(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function _t(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function Rt(e,t){var r=He(e[0],e[1],e[2]),n=He(t[0],t[1],t[2]);ut(r,r),ut(n,n);var i=ct(r,n);return i>1?0:i<-1?Math.PI:Math.acos(i)}function Et(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function wt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Tt(e,t){var r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=h*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=h*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=h*Math.max(1,Math.abs(i),Math.abs(s))}var St,Ot=Ye,Pt=We,At=Ke,It=nt,Dt=it,Ct=Ve,Mt=at,kt=(St=Ue(),function(e,t,r,n,i,a){var o=void 0,s=void 0;for(t||(t=3),r||(r=0),s=n?Math.min(n*t+r,e.length):e.length,o=r;o<s;o+=t)St[0]=e[o],St[1]=e[o+1],St[2]=e[o+2],i(St,St,a),e[o]=St[0],e[o+1]=St[1],e[o+2]=St[2];return e});function xt(){var e=new d(4);return d!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function jt(e){var t=new d(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Gt(e,t,r,n){var i=new d(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function Ft(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Lt(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function Bt(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function Ut(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function Nt(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function Vt(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function Ht(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function zt(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function qt(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function Xt(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function Yt(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function Wt(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function Kt(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e}function Qt(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+a*a)}function Zt(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return r*r+n*n+i*i+a*a}function Jt(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function $t(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function er(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function tr(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function rr(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o),e}function nr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function ir(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e}function ar(e,t){var r,n,i,a,o,s;t=t||1;do{o=(r=2*p()-1)*r+(n=2*p()-1)*n}while(o>=1);do{s=(i=2*p()-1)*i+(a=2*p()-1)*a}while(s>=1);var u=Math.sqrt((1-o)/s);return e[0]=t*r,e[1]=t*n,e[2]=t*i*u,e[3]=t*a*u,e}function or(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e}function sr(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,f=c*i+u*n-o*a,h=c*a+o*i-s*n,d=-o*n-s*i-u*a;return e[0]=l*c+d*-o+f*-u-h*-s,e[1]=f*c+d*-s+h*-o-l*-u,e[2]=h*c+d*-u+l*-s-f*-o,e[3]=t[3],e}function ur(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function cr(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function lr(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=t[0],s=t[1],u=t[2],c=t[3];return Math.abs(r-o)<=h*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=h*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=h*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=h*Math.max(1,Math.abs(a),Math.abs(c))}var fr=Ut,hr=Nt,dr=Vt,pr=Qt,vr=Zt,yr=Jt,mr=$t,br=function(){var e=xt();return function(t,r,n,i,a,o){var s=void 0,u=void 0;for(r||(r=4),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();function gr(){var e=new d(4);return d!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function _r(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Rr(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function Er(e,t){var r=2*Math.acos(t[3]),n=Math.sin(r/2);return n>h?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r}function wr(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e}function Tr(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e}function Sr(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e}function Or(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e}function Pr(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function Ar(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3],u=r[0],c=r[1],l=r[2],f=r[3],d=void 0,p=void 0,v=void 0,y=void 0,m=void 0;return(p=i*u+a*c+o*l+s*f)<0&&(p=-p,u=-u,c=-c,l=-l,f=-f),1-p>h?(d=Math.acos(p),v=Math.sin(d),y=Math.sin((1-n)*d)/v,m=Math.sin(n*d)/v):(y=1-n,m=n),e[0]=y*i+m*u,e[1]=y*a+m*c,e[2]=y*o+m*l,e[3]=y*s+m*f,e}function Ir(e){var t=p(),r=p(),n=p(),i=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=i*Math.sin(2*Math.PI*r),e[1]=i*Math.cos(2*Math.PI*r),e[2]=a*Math.sin(2*Math.PI*n),e[3]=a*Math.cos(2*Math.PI*n),e}function Dr(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e}function Cr(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Mr(e,t){var r=t[0]+t[4]+t[8],n=void 0;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[3*a+o]-t[3*o+a])*n,e[a]=(t[3*a+i]+t[3*i+a])*n,e[o]=(t[3*o+i]+t[3*i+o])*n}return e}function kr(e,t,r,n){var i=.5*Math.PI/180;t*=i,r*=i,n*=i;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(r),u=Math.cos(r),c=Math.sin(n),l=Math.cos(n);return e[0]=a*u*l-o*s*c,e[1]=o*s*l+a*u*c,e[2]=o*u*c-a*s*l,e[3]=o*u*l+a*s*c,e}function xr(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}var jr,Gr,Fr,Lr,Br,Ur,Nr=jt,Vr=Gt,Hr=Ft,zr=Lt,qr=Bt,Xr=wr,Yr=Wt,Wr=nr,Kr=ir,Qr=Jt,Zr=Qr,Jr=$t,$r=Jr,en=rr,tn=cr,rn=lr,nn=(jr=Ue(),Gr=He(1,0,0),Fr=He(0,1,0),function(e,t,r){var n=ct(t,r);return n<-.999999?(lt(jr,Gr,t),Ct(jr)<1e-6&&lt(jr,Fr,t),ut(jr,jr),Rr(e,jr,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(lt(jr,t,r),e[0]=jr[0],e[1]=jr[1],e[2]=jr[2],e[3]=1+n,en(e,e))}),an=(Lr=gr(),Br=gr(),function(e,t,r,n,i,a){return Ar(Lr,t,i,a),Ar(Br,r,n,a),Ar(e,Lr,Br,2*a*(1-a)),e}),on=(Ur=v(),function(e,t,r,n){return Ur[0]=r[0],Ur[3]=r[1],Ur[6]=r[2],Ur[1]=n[0],Ur[4]=n[1],Ur[7]=n[2],Ur[2]=-t[0],Ur[5]=-t[1],Ur[8]=-t[2],en(e,Mr(e,Ur))});function sn(){var e=new d(2);return d!=Float32Array&&(e[0]=0,e[1]=0),e}function un(e){var t=new d(2);return t[0]=e[0],t[1]=e[1],t}function cn(e,t){var r=new d(2);return r[0]=e,r[1]=t,r}function ln(e,t){return e[0]=t[0],e[1]=t[1],e}function fn(e,t,r){return e[0]=t,e[1]=r,e}function hn(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function dn(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function pn(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function vn(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function yn(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function mn(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function bn(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function gn(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function _n(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function Rn(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function En(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e}function wn(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function Tn(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function Sn(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function On(e){var t=e[0],r=e[1];return t*t+r*r}function Pn(e,t){return e[0]=-t[0],e[1]=-t[1],e}function An(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function In(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),e[0]=t[0]*i,e[1]=t[1]*i),e}function Dn(e,t){return e[0]*t[0]+e[1]*t[1]}function Cn(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e}function Mn(e,t,r,n){var i=t[0],a=t[1];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e}function kn(e,t){t=t||1;var r=2*p()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function xn(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function jn(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function Gn(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function Fn(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}function Ln(e,t,r,n){var i=t[0]-r[0],a=t[1]-r[1],o=Math.sin(n),s=Math.cos(n);return e[0]=i*s-a*o+r[0],e[1]=i*o+a*s+r[1],e}function Bn(e,t){var r=e[0],n=e[1],i=t[0],a=t[1],o=r*r+n*n;o>0&&(o=1/Math.sqrt(o));var s=i*i+a*a;s>0&&(s=1/Math.sqrt(s));var u=(r*i+n*a)*o*s;return u>1?0:u<-1?Math.PI:Math.acos(u)}function Un(e){return"vec2("+e[0]+", "+e[1]+")"}function Nn(e,t){return e[0]===t[0]&&e[1]===t[1]}function Vn(e,t){var r=e[0],n=e[1],i=t[0],a=t[1];return Math.abs(r-i)<=h*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=h*Math.max(1,Math.abs(n),Math.abs(a))}var Hn,zn,qn=Sn,Xn=dn,Yn=pn,Wn=vn,Kn=wn,Qn=Tn,Zn=On,Jn=function(){var e=sn();return function(t,r,n,i,a,o){var s=void 0,u=void 0;for(r||(r=2),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}();a.fromSpherical=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=a*Math.sin(n)*Math.sin(i),e[1]=a*Math.cos(i),e[2]=a*Math.cos(n)*Math.sin(i),r&&(e[0]+=r[0],e[1]+=r[1],e[2]+=r[2]),e},a.getSpherical=function(e,t){var r=0,n=0,i=a.length(t);return 0!==i&&(r=Math.acos(Math.max(t[1]/i,Math.min(-1,1))),n=Math.atan2(t[0],t[2])),e[0]=r,e[1]=n,e[2]=i,e},a.exponentialDecay=function(e,t,r,n,i,a){return e[0]=f.exponentialDecay(t[0],r[0],n,i,a),e[1]=f.exponentialDecay(t[1],r[1],n,i,a),e[2]=f.exponentialDecay(t[2],r[2],n,i,a),e},a.project=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=r[0]*i+r[4]*a+r[8]*o+r[12],u=r[1]*i+r[5]*a+r[9]*o+r[13],c=r[3]*i+r[7]*a+r[11]*o+r[15],l=(s/c+1)/2,f=1-(u/c+1)/2;return e[0]=l*n[2]+n[0],e[1]=f*n[3]+n[1],e[2]=c,e},a.unproject=function(e,t,r,n){Hn||(Hn=o.create());var i=t[0],a=t[1],s=t[2];if(Hn[0]=2*(i-n[0])/n[2]-1,Hn[1]=2*(a-n[1])/n[3]-1,Hn[2]=2*s-1,Hn[3]=1,o.transformMat4(Hn,Hn,r),0===Hn[3])throw e[0]=0,e[1]=0,e[2]=0,new Error("Perspective divide error");return e[0]=Hn[0]/Hn[3],e[1]=Hn[1]/Hn[3],e[2]=Hn[2]/Hn[3],e},s.exp=function(e,t){var r=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);return r?(e[0]=Math.sin(r)*t[0]/r,e[1]=Math.sin(r)*t[1]/r,e[2]=Math.sin(r)*t[2]/r,e[3]=Math.cos(r)):(e[0]=0,e[1]=0,e[2]=0,e[3]=1),e},s.ln=function(e,t){var r=s.length(t);if(r>1.0001||r<.99999)e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=0;else if(r=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])){var n=Math.atan2(r,t[3])/r;e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=0}else e[0]=0,e[1]=0,e[2]=0,e[3]=0;return e},s.pow=function(e,t,r){return 1===r?s.copy(e,t):(s.ln(e,t),e[0]*=r,e[1]*=r,e[2]*=r,e[3]*=r,s.exp(e,e),e)},i.arcFromForward=function(e,t){zn||(zn=a.create());var r=a.normalize(zn,t);if(i.identity(e),r[2]<-.99999)return e;if(r[2]>.99999)return e[5]=-1,e[10]=-1,e;var n=(1+r[2])/(r[0]*r[0]+r[1]*r[1]);return e[0]=n*r[1]*r[1]-r[2],e[1]=-n*r[0]*r[1],e[2]=r[0],e[4]=e[1],e[5]=n*r[0]*r[0]-r[2],e[6]=r[1],e[8]=-r[0],e[9]=-r[1],e[10]=-r[2],e},i.copyTranslation=function(e,t){return e[12]=t[12],e[13]=t[13],e[14]=t[14],e},i.fromMat3=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[4]=t[3],e[5]=t[4],e[6]=t[5],e[8]=t[6],e[9]=t[7],e[10]=t[8],e[3]=e[7]=e[11]=e[12]=e[13]=e[14]=0,e[15]=1,e},i.lookAtGL=function(){var e,t,r;return function(n,i,o,s){return e||(e=a.create(),t=a.create(),r=a.create()),a.subtract(r,i,o),0===a.squaredLength(r)&&(r[2]=1),a.normalize(r,r),a.cross(e,s,r),0===a.squaredLength(e)&&(r[2]+=1e-4,a.cross(e,s,r)),a.normalize(e,e),a.cross(t,r,e),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[4]=t[0],n[5]=t[1],n[6]=t[2],n[8]=r[0],n[9]=r[1],n[10]=r[2],n}}(),i.perspectiveGL=function(e,t,r,n,a){var o=Math.tan(t/360*Math.PI)*n,s=o*r;return i.frustum(e,-s,s,-o,o,n,a),e},i.setTranslation=function(e,t){return e[12]=t[0],e[13]=t[1],e[14]=t[2],e},i.setTranslationFromValues=function(e,t,r,n){return e[12]=t,e[13]=r,e[14]=n,e};var $n,ei,ti,ri,ni,ii,ai,oi={};oi.turbulence=($n=[],ei=[],ti=[],ri=!1,function(e,t,r,n,i,s){ri||function(){for(var e=0;e<256;e++)$n[e]=o.fromValues(Math.random()-.5,Math.random()-.5,Math.random()-.5,Math.random()-.5),ei[e]=e;for(var t=256;--t;){var r=ei[t],n=Math.floor(256*Math.random());ei[t]=ei[n],ei[n]=r}for(var i=0;i<256;i++)ei[256+i]=ei[i],$n[256+i]=$n[i],$n[512+i]=$n[i];for(var s=0;s<15;++s)ti[s]=a.create();ri=!0}(),t+=4096,r+=4096,n+=4096,i+=4096;var u=Math.floor(t),c=Math.floor(r),l=Math.floor(n),f=Math.floor(i),h=t-u,d=r-c,p=n-l,v=i-f,y=1+(u&=255),m=1+(c&=255),b=1+(l&=255),g=1+(f&=255),_=ei[u],R=ei[y],E=ei[_+c],w=ei[R+c],T=ei[_+m],S=ei[R+m],O=a.lerp(ti[0],$n[E+l+f],$n[w+l+f],h),P=a.lerp(ti[1],$n[T+l+f],$n[S+l+f],h),A=a.lerp(ti[2],$n[E+b+f],$n[w+b+f],h),I=a.lerp(ti[3],$n[E+b+f],$n[w+b+f],h),D=a.lerp(ti[4],O,P,d),C=a.lerp(ti[5],A,I,d),M=a.lerp(ti[6],D,C,p);O=a.lerp(ti[7],$n[E+l+g],$n[w+l+g],h),P=a.lerp(ti[8],$n[T+l+g],$n[S+l+g],h),A=a.lerp(ti[9],$n[E+b+g],$n[w+b+g],h),I=a.lerp(ti[10],$n[E+b+g],$n[w+b+g],h),D=a.lerp(ti[11],O,P,d),C=a.lerp(ti[12],A,I,d);var k=a.lerp(ti[13],D,C,p),x=a.lerp(ti[14],M,k,v);return e[0]+=x[0]*s,e[1]+=x[1]*s,e[2]+=x[2]*s,e}),oi.perlin1=(ni=!1,ii=null,ai=null,function(e){ni||function(){ii=new Array(514),ai=new Array(514);var e=0,t=0,r=0;for(e=0;e<256;e++)ii[e]=e,ai[e]=2*Math.random()-1;for(;--e;)r=ii[e],ii[e]=ii[t=Math.floor(256*Math.random())],ii[t]=r;for(e=0;e<258;e++)ii[256+e]=ii[e],ai[256+e]=ai[e];ni=!0}();var t=e+4096,r=255&Math.floor(t),n=r+1&255,i=t-Math.floor(t),a=i-1,o=i*i*(3-2*i),s=i*ai[ii[r]];return s+o*(a*ai[ii[n]]-s)}),oi.perlin1D=function(e,t,r,n){for(var i=0,a=e,o=1,s=0;s<n;++s)i+=oi.perlin1(a)/o,o*=t,a*=r;return i};var si={evaluate:function(e,t,r,n,i){for(var a=e.knots.length,o=a-1,s=0,u=0;u<e.knots.length;++u)if(e.knots[u]>t){o=u;break}if(0===e.degree)for(var c=0;c<e.dimension;++c)r[c]=e.controls[o*e.dimension+c];else if(1===e.degree){var l=n?(o+a-1)%a:0===o?0:o-1,f=e.knots[o]-e.knots[l];f<0&&(f+=i),f>0&&(s=(t-e.knots[e.knots.length-1])/f);for(var h=0;h<e.dimension;++h)r[h]=e.controls[l*e.dimension+h]*(1-s)+e.controls[o*e.dimension+h]*s}else{var d=n?(o+a-2)%a:0===o?0:o-2,p=n?(o+a-1)%a:0===o?0:o-1,v=d*e.dimension,y=p*e.dimension,m=o*e.dimension,b=e.knots[d],g=e.knots[p],_=e.knots[o],R=e.knots[(o+1)%a];b>_&&(_+=i,R+=i,t+=i),g>_&&(_+=i,R+=i,t+=i),R<_&&(R+=i);var E=t-g,w=E/(_-g),T=(t-b)/(_-b),S=T+w-w*T,O=w*(E/(R-g)),P=S-O;S=1-S;for(var A=0;A<e.dimension;++A)r[A]=S*e.controls[v+A]+P*e.controls[y+A]+O*e.controls[m+A]}},ag_horner1:function(e,t,r){for(var n=e[t];--t>=0;)n=r*n+e[t];return n},ag_zeroin2:function(e,t,r,n,i,a){var o,s,u,c,l,f,h,d,p,v;for(var y=!0;y&&(o=e,c=r,u=s=t-e),Math.abs(c)<Math.abs(n)&&(e=t,t=o,o=e,r=n,n=c,c=r),y=!1,l=2.384185792e-7*Math.abs(t)+.5*i,f=.5*(o-t),Math.abs(f)>l&&0!==n;)Math.abs(u)<l||Math.abs(r)<=Math.abs(n)?u=s=f:(v=n/r,e===o?(h=2*f*v,d=1-v):(h=v*(2*f*(d=r/c)*(d-(p=n/c))-(t-e)*(p-1)),d=(d-1)*(p-1)*(v-1)),h>0?d=-d:h=-h,v=u,u=s,2*h<3*f*d-Math.abs(l*d)&&h<Math.abs(.5*v*d)?s=h/d:u=s=f),e=t,r=n,Math.abs(s)>l?t+=s:f>0?t+=l:t-=l,(n=si.ag_horner1(a.p,a.deg,t))*(c/Math.abs(c))>0&&(y=!0);return t},ag_zeroin:function(e,t,r,n){var i,a;return i=si.ag_horner1(n.p,n.deg,e),Math.abs(i)<1.192092896e-7?e:(a=si.ag_horner1(n.p,n.deg,t),Math.abs(a)<1.192092896e-7?t:si.ag_zeroin2(e,t,i,a,r,n))},polyZeroes:function(e,t,r,n,i,a,o){var s,u,c,l,f,h,d,p,v,y,m,b,g,_,R,E=new Array(22),w=new Array(22),T=new Array(22),S={p:[],deg:0};for(d=y=0,p=0,s=0;s<t+1;++s)p+=Math.abs(e[s]);if(p<=(b=(Math.abs(r)+Math.abs(i))*(t+1)*1.192092896e-7))return-1;for(g=E,_=w,R=T,s=0;s<t+1;++s)g[s]=1/p*e[s];for(;Math.abs(g[t])<b;)t--;if(l=0,0===t)return l;if(1===t)return o[0]=-g[0]/g[1],u=n?r<o[0]+b:r<o[0]-b,c=a?i>o[0]-b:i>o[0]+b,(l=u&&c?1:0)&&(n&&o[0]<r?o[0]=r:a&&o[0]>i&&(o[0]=i)),l;for(S.p=g,S.deg=t,s=1;s<=t;s++)_[s-1]=s*g[s];if(0===(f=si.polyZeroes(_,t-1,r,0,i,0,R)).length)return 0;for(s=h=0;s<=f;s++){if(l>t)return l;0===s?(v=r,m=si.ag_horner1(g,t,v),Math.abs(m)<=b&&n&&(o[l++]=r)):(v=d,m=y),s===f?(d=i,h=0):d=R[s],y=si.ag_horner1(g,t,d),h?h=0:Math.abs(y)<b?(s!==f||a)&&(o[l++]=d,h=1):(m<0&&y>0||m>0&&y<0)&&(o[l++]=si.ag_zeroin(v,d,0,S),l>1&&o[l-2]>=o[l-1]-b&&(o[l-2]=.5*(o[l-2]+o[l-1]),l--))}return l}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(1),i=r(0);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"elementType",4),o(this,"customName",""),o(this,"dimension",1),o(this,"usageIndex",0),o(this,"usedByGPU",!0)}var t,r,s;return t=e,(r=[{key:"GetDimension",value:function(){switch(this.elementType){case e.Type.LIFETIME:return 2;case e.Type.POSITION:case e.Type.VELOCITY:return 3;case e.Type.MASS:return 1}return this.dimension}},{key:"GetDeclaration",value:function(){var t;switch(this.elementType){case e.Type.LIFETIME:t=n.Tw2VertexDeclaration.Type.TANGENT;break;case e.Type.POSITION:t=n.Tw2VertexDeclaration.Type.POSITION;break;case e.Type.VELOCITY:t=n.Tw2VertexDeclaration.Type.NORMAL;break;case e.Type.MASS:t=n.Tw2VertexDeclaration.Type.BINORMAL;break;default:t=n.Tw2VertexDeclaration.Type.TEXCOORD}return new n.Tw2VertexElement(t,this.usageIndex,i.w.gl.FLOAT,this.GetDimension())}}])&&a(t.prototype,r),s&&a(t,s),e}();o(s,"Type",{LIFETIME:0,POSITION:1,VELOCITY:2,MASS:3,CUSTOM:4})},function(e,t,r){"use strict";r.d(t,"a",(function(){return v})),r.d(t,"b",(function(){return y}));var n=r(0),i=r(2);function a(e,t,r){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=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(e){return!1}}();return function(){var r,n=l(e);if(t){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?c(e):t}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function d(e,t,r){return t&&h(e.prototype,t),r&&h(e,r),e}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";f(this,e),p(this,"_id",n.F.generateID()),p(this,"name",""),p(this,"_onModified",[]),this.name=t}return d(e,[{key:"OnValueChanged",value:function(e,t){for(var r=0;r<this._onModified.length;r++)this._onModified[r](this,e,t)}},{key:"AddCallback",value:function(e){return this._onModified.includes(e)||this._onModified.push(e),!0}},{key:"RemoveCallback",value:function(e){var t=this._onModified.indexOf(e);-1!==t&&this._onModified.splice(t,1)}},{key:"GetValue",value:function(e){}},{key:"Bind",value:function(e,t,r){return!1}},{key:"UnBind",value:function(){}},{key:"Apply",value:function(e,t,r){}},{key:"Copy",value:function(e){}},{key:"Clone",value:function(){var e=new this.constructor;return e.Copy(this,!0),e}},{key:"size",get:function(){return this.constructor.constantBufferSize}}]),e}();p(v,"constantBufferSize",0);var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(r,e);var t=s(r);function r(e,n){var i;return f(this,r),p(c(i=t.call(this,e)),"constantBuffer",null),p(c(i),"offset",null),p(c(i),"value",new Float32Array(i.size)),n&&i.value.set(n),i}return d(r,[{key:"SetValue",value:function(e){this.value.set(e),this.OnValueChanged()}},{key:"SetIndexValue",value:function(e,t){if(void 0===this.value[e])throw new i.n;this.value[e]!==t&&(this.value[e]=t,this.OnValueChanged())}},{key:"GetValue",value:function(e){var t=this.constantBuffer?this.constantBuffer.subarray(this.offset,this.offset+this.size):this.value;return e?Array.from(t):new Float32Array(t)}},{key:"GetIndexValue",value:function(e){if(void 0!==this.value[e])return this.value[e];throw new i.n}},{key:"OnValueChanged",value:function(e,t){this.constantBuffer&&this.Apply(this.constantBuffer,this.offset),a(l(r.prototype),"OnValueChanged",this).call(this,e,t)}},{key:"Bind",value:function(e,t,r){return!this.constantBuffer&&r>=this.size&&(this.constantBuffer=e,this.offset=t,this.Apply(e,t,r),!0)}},{key:"Unbind",value:function(){this.constantBuffer=null}},{key:"Apply",value:function(e,t,r){e.set(this.value,t)}},{key:"EqualsValue",value:function(e){for(var t=0;t<this.size;t++)if(this.value[t]!==e[t])return!1;return!0}},{key:"Copy",value:function(e,t){t&&(this.name=e.name),this.SetValue(e.GetValue())}}],[{key:"isValue",value:function(e){return n.F.isArrayLike(e)&&e.length===this.constantBufferSize}}]),r}(v)},function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(0);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=function e(t,r,n,o){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;i(this,e),a(this,"usage",null),a(this,"usageIndex",null),a(this,"type",null),a(this,"elements",null),a(this,"offset",0),a(this,"location",null),a(this,"customSetter",null),this.usage=t,this.usageIndex=r,this.type=n,this.elements=o,this.offset=s};function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"elements",[]),u(this,"_elementsSorted",[]),u(this,"stride",null),void 0!==r&&(this.stride=r),t&&this.DeclareFromObject(t)}var t,r,i;return t=e,i=[{key:"CompareDeclarationElements",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e.usage<t.usage?-1:e.usage>t.usage?1:e.usageIndex+r<t.usageIndex?-1:e.usageIndex+r>t.usageIndex?1:0}}],(r=[{key:"RebuildHash",value:function(){this._elementsSorted=[];for(var t=0;t<this.elements.length;++t)this._elementsSorted[t]=this.elements[t];this._elementsSorted.sort(e.CompareDeclarationElements)}},{key:"FindUsage",value:function(e,t){for(var r=0;r<this._elementsSorted.length;++r){var n=this._elementsSorted[r];if(n.usage===e){if(n.usageIndex===t)return n;if(n.usageIndex>t)return null}if(n.usage>e)return null}return null}},{key:"SetDeclaration",value:function(t,r){for(var i=n.w.gl,a=0,o=0;o<t._elementsSorted.length;++o){var s=t._elementsSorted[o];if(!(s.location<0))for(;;){if(a>=this._elementsSorted.length){i.disableVertexAttribArray(s.location),i.vertexAttrib4f(s.location,0,0,0,0);break}var u=this._elementsSorted[a],c=e.CompareDeclarationElements(u,s);if(c>0){i.disableVertexAttribArray(s.location),i.vertexAttrib4f(s.location,0,0,0,0);break}if(0===c){u.customSetter?u.customSetter(s):(i.enableVertexAttribArray(s.location),i.vertexAttribPointer(s.location,u.elements,u.type,!1,r,u.offset));break}a++}}return!0}},{key:"SetPartialDeclaration",value:function(t,r){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=n.w.ext,s=n.w.gl,u=[],c=0,l=0;l<t._elementsSorted.length;++l){var f=t._elementsSorted[l];if(!(f.location<0))for(;;){var h=this._elementsSorted[c],d=e.CompareDeclarationElements(h,f,i);if(0===d){h.customSetter?h.customSetter(f):(s.enableVertexAttribArray(f.location),s.vertexAttribPointer(f.location,h.elements,h.type,!1,r,h.offset),o.vertexAttribDivisor(f.location,a),a&&u.push(f.location));break}if(d>0){a||(s.disableVertexAttribArray(f.location),s.vertexAttrib4f(f.location,0,0,0,0));break}if(++c>=this._elementsSorted.length)return a||(s.disableVertexAttribArray(f.location),s.vertexAttrib4f(f.location,0,0,0,0)),u}}return u}},{key:"ResetInstanceDivisors",value:function(e){if(e)for(var t=0;t<e.length;++t)n.w.ext.vertexAttribDivisor(e[t],0)}},{key:"DeclareFromObject",value:function(t,r){this.elements.splice(0,this.elements.length);for(var i=0,a=0;a<t.length;a++){var s=t[a],u=void 0,c=void 0,l=void 0,f=void 0,h=void 0;n.F.isArray(s)?(u=s[0],c=s[1],f=s[2],l=s[3],h=s[4]):(u=s.usage,c=s.usageIndex,f=s.elements,l=s.type,h=s.offset),n.F.isString(u)&&(u=e.Type[u.toUpperCase()]),n.F.isNoU(l)&&(l="FLOAT"),n.F.isString(l)&&(l=n.w.gl[l.toUpperCase()]),n.F.isNoU(h)&&(h=i),this.elements.push(new o(u,c,l,f,h)),i+=4*f}void 0!==r&&(this.stride=r),this.RebuildHash()}}])&&s(t.prototype,r),i&&s(t,i),e}();u(c,"Type",{POSITION:0,COLOR:1,NORMAL:2,TANGENT:3,BINORMAL:4,TEXCOORD:5,BLENDWEIGHT:6,BLENDINDICES:7})},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(2);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"path",""),o(this,"_isLoading",!1),o(this,"_isGood",!1),o(this,"_isPurged",!1),o(this,"_notifications",[]),o(this,"activeFrame",0),o(this,"doNotPurge",0)}var t,r,s;return t=e,(r=[{key:"IsLoading",value:function(){return this.KeepAlive(),this._isLoading}},{key:"IsGood",value:function(){return this.KeepAlive(),this._isGood}},{key:"IsPurged",value:function(){return this._isPurged}},{key:"Unload",value:function(){}},{key:"Reload",value:function(){this.Unload(),n.D.ReloadResource(this)}},{key:"KeepAlive",value:function(){this.activeFrame=n.D.activeFrame,this.IsPurged()&&this.Reload()}},{key:"GetErrors",value:function(){return n.D.motherLode.GetErrors(this.path)}},{key:"HasErrors",value:function(){return n.D.motherLode.HasErrors(this.path)}},{key:"OnError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.B;return this._isGood=!1,n.D.OnResEvent("error",this.path,{type:"error",message:e.message,err:e}),this.UpdateNotifications("OnResError"),e}},{key:"OnWarning",value:function(e){n.D.OnResEvent("warning",this.path,e)}},{key:"OnDebug",value:function(e){n.D.OnResEvent("debug",this.path,e)}},{key:"OnRequested",value:function(e){this._isLoading=!0,this._isPurged=!1,n.D.OnResEvent(this.IsPurged()?"reloading":"requested",this.path,e),this.UpdateNotifications("ReleaseCachedData")}},{key:"OnLoaded",value:function(e){this._isLoading=!1,this.HasErrors()||n.D.OnResEvent("loaded",this.path,e)}},{key:"OnPrepared",value:function(e){this._isLoading=!1,this.HasErrors()||(this._isGood=!0,n.D.OnResEvent("prepared",this.path,e),this.UpdateNotifications("RebuildCachedData"))}},{key:"OnUnloaded",value:function(e){n.D.OnResEvent(this.IsPurged()?"purged":"unloaded",this.path,e)}},{key:"RegisterNotification",value:function(e){this._notifications.includes(e)||(this._notifications.push(e),this.HasErrors()?"OnResError"in e&&e.OnResError(this):this.IsGood()&&"RebuildCachedData"in e&&e.RebuildCachedData(this))}},{key:"UnregisterNotification",value:function(e){this._notifications.splice(this._notifications.indexOf(e),1)}},{key:"UpdateNotifications",value:function(e){for(var t=0;t<this._notifications.length;t++)e in this._notifications[t]&&this._notifications[t][e](this)}}])&&a(t.prototype,r),s&&a(t,s),e}();s.prototype.DoCustomLoad=null,s.prototype.requestResponseType=null},function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r(0),i=r(14),a=r(6),o=r(11);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=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(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(v,e);var t,r,a,f=l(v);function v(e,t){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,v),p(h(r=f.call(this,e)),"resourcePath",""),p(h(r),"useAllOverrides",!1),p(h(r),"addressUMode",1),p(h(r),"addressVMode",1),p(h(r),"addressWMode",1),p(h(r),"filterMode",2),p(h(r),"mipFilterMode",2),p(h(r),"maxAnisotropy",4),p(h(r),"textureRes",null),p(h(r),"_sampler",null),t&&(r.resourcePath=t,r.Initialize()),r}return t=v,a=[{key:"isValue",value:function(e){return n.F.isString(e)}}],(r=[{key:"Initialize",value:function(){this.OnValueChanged()}},{key:"SetTexturePath",value:function(e){this.resourcePath=e,this.OnValueChanged()}},{key:"GetValue",value:function(){return this.isTextureAttached?null:this.resourcePath}},{key:"SetTextureRes",value:function(e){return this.textureRes!==e&&(this.resourcePath="",this.textureRes=e,this.textureRes&&(this.textureRes._isAttached=!0),!0)}},{key:"OnValueChanged",value:function(e,t){if(""!==this.resourcePath)if(0===this.resourcePath.indexOf("rgba:/")){if(!this.textureRes||this.textureRes.path!==this.resourcePath){var r=this.resourcePath.replace("rgba:/","").split(","),i=n.w.CreateSolidTexture([parseFloat(r[0]),parseFloat(r[1]),parseFloat(r[2]),void 0!==r[3]?parseFloat(r[3]):255]);this.textureRes=new o.a,this.textureRes.path=this.resourcePath,this.textureRes.Attach(i)}}else this.resourcePath=this.resourcePath.toLowerCase(),this.textureRes=""!==this.resourcePath?n.D.GetResource(this.resourcePath):null;this.UpdateOverrides(),u(d(v.prototype),"OnValueChanged",this).call(this,e,t)}},{key:"Apply",value:function(e,t,r){this.textureRes&&(this.useAllOverrides&&this._sampler&&(this._sampler.samplerType=t.samplerType,this._sampler.isVolume=t.isVolume,this._sampler.registerIndex=t.registerIndex,t=this._sampler),n.w.gl.activeTexture(n.w.gl.TEXTURE0+e),this.textureRes.Bind(t,r))}},{key:"SetOverrides",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.F.assignIfExists(this,e,v.overrideProperties),this.OnValueChanged()}},{key:"GetOverrides",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n.F.assignIfExists(e,this,v.overrideProperties),e}},{key:"UpdateOverrides",value:function(){if(this.useAllOverrides){this._sampler=this._sampler||new i.b;var e=n.w.wrapModes,t=n.w.gl,r=this._sampler;if(1===this.filterMode){switch(this.mipFilterMode){case 0:r.minFilter=t.NEAREST;break;case 1:r.minFilter=t.NEAREST_MIPMAP_NEAREST;break;default:r.minFilter=t.NEAREST_MIPMAP_LINEAR}r.minFilterNoMips=t.NEAREST,r.magFilter=t.NEAREST}else{switch(this.mipFilterMode){case 0:r.minFilter=t.LINEAR;break;case 1:r.minFilter=t.LINEAR_MIPMAP_NEAREST;break;default:r.minFilter=t.LINEAR_MIPMAP_LINEAR}r.minFilterNoMips=t.LINEAR,r.magFilter=t.LINEAR}r.addressU=e[this.addressUMode],r.addressV=e[this.addressVMode],r.addressW=e[this.addressWMode],r.anisotropy=this.maxAnisotropy,r.ComputeHash()}else this._sampler&&(this._sampler=null)}},{key:"EqualsValue",value:function(e){return e.toLowerCase()===this.GetValue()}},{key:"Copy",value:function(e,t){t&&(this.name=e.name),this.resourcePath=e.resourcePath,this.SetOverrides(e.GetOverrides)}},{key:"Clone",value:function(){var e=new v;return e.Copy(this,!0),e}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.textureRes&&!e.includes(this.textureRes)&&e.push(this.textureRes),e}},{key:"isTextureAttached",get:function(){return this.textureRes&&this.textureRes._isAttached}}])&&s(t.prototype,r),a&&s(t,a),v}(a.a);p(v,"overrideProperties",["useAllOverrides","addressUMode","addressVMode","addressWMode","filterMode","mipFilterMode","maxAnisotropy"]),v.prototype.SetValue=v.prototype.SetTexturePath},function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}r.d(t,"a",(function(){return u}));var i,a,o,s=new WeakMap,u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,i;return t=e,(r=[{key:"emit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.log&&!t.log._logged&&(t.log=this.log(t.log));var r=s.get(this);return r?((e=e.toLowerCase())in r&&r[e].forEach((function(n,i){i.call(n.context,t),n.once&&r[e].delete(i)})),this):this}},{key:"on",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=s.get(this);return i||(i={},s.set(this,i)),i[e=e.toLowerCase()]||(i[e]=new Set),i[e].add(t,{context:r,once:n}),this}},{key:"once",value:function(e,t,r){return this.on(e,t,r,!0)}},{key:"off",value:function(e,t){var r=s.get(this);if(!r)return this;if("*"===(e=e.toLowerCase()))for(var n in r)r.hasOwnProperty(n)&&r[n].delete(t);else e in r&&r[e].delete(t);return this}},{key:"del",value:function(e){var t=s.get(this);return t?((e=e.toLowerCase())in t&&delete t[e],this):this}},{key:"clr",value:function(e){var t=s.get(this);if(!t)return this;for(var r in t)t.hasOwnProperty(r)&&t[r].has(e)&&t[r].delete(e);return this}},{key:"kill",value:function(){return s.has(this)&&(this.emit("kill"),s.delete(this)),this}},{key:"log",value:function(e){return e.name||(e.name=this.constructor.category||this.constructor.name),this.constructor.defaultLogger?this.constructor.defaultLogger.log(e,this):e}}])&&n(t.prototype,r),i&&n(t,i),e}();o=null,(a="defaultLogger")in(i=u)?Object.defineProperty(i,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):i[a]=o},function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r(8),i=r(2),a=r(0);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=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(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(v,e);var t,r,n,f=l(v);function v(){var e;o(this,v);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return p(h(e=f.call(this,...r)),"texture",null),p(h(e),"isCube",!1),p(h(e),"width",0),p(h(e),"height",0),p(h(e),"hasMipMaps",!1),p(h(e),"requestResponseType",null),p(h(e),"_currentSampler",0),p(h(e),"_isAttached",!1),p(h(e),"_extension",null),e}return t=v,n=[{key:"IsPowerOfTwo",value:function(e){return 0==(e&e-1)}},{key:"AddMipLevelSkipCount",value:function(e){var t=a.w,r=t.mipLevelSkipCount>0?"."+t.mipLevelSkipCount.toString():"";if(t.mipLevelSkipCount>0){var n=e.lastIndexOf(".");n>=0&&(e=e.substr(0,n-2)+r+e.substr(n))}return e}},{key:"Int32ToFourCC",value:function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}}],(r=[{key:"Prepare",value:function(e){var t=a.w.gl,r="ccpGLFormat"in e?e.ccpGLFormat:t.RGBA;switch(this._extension){case"cube":this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_CUBE_MAP,this.texture);var n=document.createElement("canvas");n.width=n.height=e.height;for(var o=n.getContext("2d"),s=0;s<6;++s)o.drawImage(e,s*n.width,0,n.width,n.height,0,0,n.width,n.height),t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,r,r,t.UNSIGNED_BYTE,n);t.generateMipmap(t.TEXTURE_CUBE_MAP),t.bindTexture(t.TEXTURE_CUBE_MAP,null),this.width=n.width,this.height=n.height,this.hasMipMaps=!0;break;case"png":this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texImage2D(t.TEXTURE_2D,0,r,r,t.UNSIGNED_BYTE,e),this.hasMipMaps=v.IsPowerOfTwo(e.width)&&v.IsPowerOfTwo(e.height),this.hasMipMaps&&t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null),this.width=e.width,this.height=e.height;break;case"dds":var u=a.w.ext.CompressedTextureS3TC,c=new Int32Array(e,0,a.c),l=c[a.i],f=c[a.g]===a.l,h=(c[a.d]&a.a)===a.a,d=c[a.i],p=c[a.e]&a.b?Math.max(1,c[a.h]):1;if(!u)throw new i.q("Compressed textures not supported by your device");if(!f)throw new i.q("Invalid DDS, missing magic number");if(!l)throw new i.q("Invalid DDS, missing FourCC code");var y,m,b=c[a.k],g=c[a.f],_=c[a.j]+4;switch(d){case a.m:y=8,m=u.COMPRESSED_RGBA_S3TC_DXT1_EXT;break;case a.n:y=16,m=u.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case a.o:y=16,m=u.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:var R=v.Int32ToFourCC(d);throw new i.q("Invalid DDS, ".concat(R," unsupported"))}if(this.hasMipMaps=p>1,this.isCube=h,this.width=b,this.height=g,this.isCube)throw new i.c({feature:"DDS cube maps"});this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture);for(var E=0;E<p;++E){var w=Math.max(4,b)/4*Math.max(4,g)/4*y,T=new Uint8Array(e,_,w);t.compressedTexImage2D(t.TEXTURE_2D,E,m,b,g,0,T),_+=w,b*=.5,g*=.5}t.bindTexture(t.TEXTURE_2D,null);break;default:throw new i.q("Invalid format, ".concat(this._extension," unsupported"))}this._extension=null,this._isAttached=!1,this.OnPrepared()}},{key:"DoCustomLoad",value:function(e,t){switch(this._extension=t,this._extension){case"cube":this.isCube=!0,e=e.substr(0,e.length-5)+".png";break;case"png":this.isCube=!1;break;case"dds":return this._extension=t,this.requestResponseType="arraybuffer",!1;default:throw this._extension=null,new i.p({path:e,extension:t})}this.OnRequested(),a.D._pendingLoads++;var r=new Image;return r.crossOrigin="anonymous",r.onerror=()=>{a.D._pendingLoads--,this._extension=null,this.OnError(new i.k({path:e}))},r.onload=()=>{a.D._pendingLoads--,a.D._prepareQueue.push([this,r,null]),this.OnLoaded()},r.src=v.AddMipLevelSkipCount(e),!0}},{key:"Unload",value:function(){return this.texture&&(a.w.gl.deleteTexture(this.texture),this.texture=null),this._isPurged=!0,this._isGood=!1,this._isAttached=!1,this._extension=null,this.requestResponseType=null,!0}},{key:"Attach",value:function(e){this.path="",this.texture=e,this._isPurged=!1,this._isAttached=!0,this._extension=null,this.requestResponseType=null,this.OnLoaded({hide:!0,data:{isAttachment:!0}}),this.OnPrepared({hide:!0,data:{isAttachment:!0}})}},{key:"Reload",value:function(){if(!this._isAttached)return u(d(v.prototype),"Reload",this).call(this)}},{key:"Bind",value:function(e,t){var r=a.w,n=r.gl;this.KeepAlive();var i=e.samplerType;if(i===(this.isCube?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D))if(this.texture)e.isVolume&&n.uniform1f(t,this.height/this.width),n.bindTexture(i,this.texture),(e.hash!==this._currentSampler||this._updateSampler)&&(e.Apply(this.hasMipMaps),this._currentSampler=e.hash,this._updateSampler=!1);else{var o=i===n.TEXTURE_2D?r.GetFallbackTexture():r.GetFallbackCubeMap();n.bindTexture(i,o)}}}])&&s(t.prototype,r),n&&s(t,n),v}(n.a)},function(e,t,r){"use strict";r.r(t),r.d(t,"Tw2CurveKey",(function(){return s})),r.d(t,"Tw2Curve",(function(){return u})),r.d(t,"Tw2ColorKey",(function(){return b})),r.d(t,"Tw2ColorCurve",(function(){return g})),r.d(t,"Tw2ColorKey2",(function(){return I})),r.d(t,"Tw2ColorCurve2",(function(){return D})),r.d(t,"Tw2EventKey",(function(){return U})),r.d(t,"Tw2EventCurve",(function(){return N})),r.d(t,"Tw2PerlinCurve",(function(){return Q})),r.d(t,"Tw2QuaternionKey2",(function(){return oe})),r.d(t,"Tw2QuaternionCurve",(function(){return se})),r.d(t,"Tw2RandomConstantCurve",(function(){return ye})),r.d(t,"Tw2Torque",(function(){return Oe})),r.d(t,"Tw2RigidOrientation",(function(){return Pe})),r.d(t,"Tw2QuaternionKey",(function(){return Fe})),r.d(t,"Tw2RotationCurve",(function(){return Le})),r.d(t,"Tw2ScalarKey",(function(){return We})),r.d(t,"Tw2ScalarCurve",(function(){return Ke})),r.d(t,"Tw2ScalarKey2",(function(){return at})),r.d(t,"Tw2ScalarCurve2",(function(){return ot})),r.d(t,"Tw2SineCurve",(function(){return vt})),r.d(t,"Tw2Vector2Key",(function(){return St})),r.d(t,"Tw2Vector2Curve",(function(){return Ot})),r.d(t,"Tw2Vector3Key",(function(){return Gt})),r.d(t,"Tw2Vector3Curve",(function(){return Ft})),r.d(t,"Tw2VectorKey",(function(){return Yt})),r.d(t,"Tw2VectorCurve",(function(){return Wt})),r.d(t,"Tw2ColorSequencer",(function(){return fr})),r.d(t,"Tw2EulerRotation",(function(){return _r})),r.d(t,"Tw2QuaternionSequencer",(function(){return Ir})),r.d(t,"Tw2RGBAScalarSequencer",(function(){return Lr})),r.d(t,"Tw2ScalarSequencer",(function(){return Yr})),r.d(t,"Tw2VectorSequencer",(function(){return rn})),r.d(t,"Tw2XYZScalarSequencer",(function(){return hn})),r.d(t,"Tw2YPRSequencer",(function(){return Rn})),r.d(t,"Tw2WbgTrack",(function(){return En})),r.d(t,"Tw2WbgTransformTrack",(function(){return wn})),r.d(t,"Tw2TransformTrack",(function(){return On})),r.d(t,"Tw2MayaEulerRotationCurve",(function(){return jn})),r.d(t,"Tw2MayaScalarCurve",(function(){return zn})),r.d(t,"Tw2MayaVector3Curve",(function(){return $n})),r.d(t,"Tw2MayaAnimationEngine",(function(){return ni}));var n=r(0);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function e(){a(this,e),o(this,"_id",n.F.generateID()),o(this,"name",""),o(this,"time",0)},u=function(){function e(){a(this,e),o(this,"_id",n.F.generateID()),o(this,"name","")}var t,r,s;return t=e,s=[{key:"Compare",value:function(e,t){return e.time<t.time?-1:e.time>t.time?1:0}},{key:"Sort",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.keys;r&&r.length&&(r.sort(e.Compare),t.length=r[r.length-1].time)}},{key:"Sort2",value:function(t){if(t.keys&&t.keys.length){t.keys.sort(e.Compare);var r=t.keys[t.keys.length-1];if(r.time>t.length){var n=t.length,i=t.endValue,a=t.endTangent;t.length=r.time,t.endValue=r.value,t.endTangent=r.leftTangent,n>0&&(r.time=n,r.value=i,r.leftTangent=a)}}}}],(r=[{key:"Initialize",value:function(){this.Sort()}},{key:"Sort",value:function(){}},{key:"GetLength",value:function(){return 0}},{key:"UpdateValue",value:function(e){}}])&&i(t.prototype,r),s&&i(t,s),e}();function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=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(e){return!1}}();return function(){var r,n=y(e);if(t){var i=y(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return p(this,r)}}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(u,"inputDimension",null),o(u,"outputDimension",null),o(u,"valueProperty",null),o(u,"curveType",null),o(u,"Key",null),o(u,"Interpolation",null),o(u,"Extrapolation",null),o(u,"Type",{CURVE:1,CURVE2:2,CURVE_MAYA:3,CURVE_NO_KEYS:4,SEQUENCER:100,SEQUENCER2:101}),o(u,"global",{vec3_0:n.H.create(),vec4_0:n.I.create(),quat_0:n.C.create(),quat_1:n.C.create()});var b=function(e){f(r,e);var t=d(r);function r(){var e;l(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return m(v(e=t.call(this,...a)),"value",n.I.create()),m(v(e),"left",n.I.create()),m(v(e),"right",n.I.create()),m(v(e),"interpolation",0),e}return r}(s),g=function(e){f(o,e);var t,r,i,a=d(o);function o(){var e;l(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return m(v(e=a.call(this,...r)),"start",0),m(v(e),"value",n.I.create()),m(v(e),"extrapolation",0),m(v(e),"keys",[]),m(v(e),"_currentKey",1),m(v(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){if(0===this.length)return n.I.copy(t,this.value);var r=this.keys[0],i=this.keys[this.keys.length-1];if(e>=i.time)switch(this.extrapolation){case o.Extrapolation.NONE:return n.I.copy(t,this.value);case o.Extrapolation.CONSTANT:return n.I.copy(t,i.value);case o.Extrapolation.GRADIENT:return n.I.scaleAndAdd(t,i.value,i.right,e-i.time);default:e%=i.time}else if(e<0||e<r.time)switch(this.extrapolation){case o.Extrapolation.NONE:return n.I.copy(t,this.value);case o.Extrapolation.GRADIENT:return n.I.scaleAndAdd(t,r.value,r.left,e*this.length-i.time);default:return n.I.copy(t,r.value)}for(var a=this.keys[this._currentKey],s=this.keys[this._currentKey-1];e>=a.time||e<s.time;)e<s.time&&(this._currentKey=0),this._currentKey++,a=this.keys[this._currentKey],s=this.keys[this._currentKey-1];var u=(e-s.time)/(a.time-s.time);switch(s.interpolation){case o.Interpolation.CONSTANT:return n.I.copy(t,s.value);default:return t[0]=s.value[0]*(1-u)+a.value[0]*u,t[1]=s.value[1]*(1-u)+a.value[1]*u,t[2]=s.value[2]*(1-u)+a.value[2]*u,t[3]=s.value[3]*(1-u)+a.value[3]*u,t}}}])&&c(t.prototype,r),i&&c(t,i),o}(u);function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){var t=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(e){return!1}}();return function(){var r,n=P(e);if(t){var i=P(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return S(this,r)}}function S(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?O(e):t}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}m(g,"inputDimension",4),m(g,"ouputDimension",4),m(g,"valueProperty","value"),m(g,"curveType",u.Type.CURVE),m(g,"Key",b),m(g,"Extrapolation",{NONE:0,CONSTANT:1,GRADIENT:2,CYCLE:3}),m(g,"Interpolation",{NONE:0,CONSTANT:1,LINEAR:2});var I=function(e){E(r,e);var t=T(r);function r(){var e;R(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return A(O(e=t.call(this,...a)),"value",n.I.create()),A(O(e),"leftTangent",n.I.create()),A(O(e),"rightTangent",n.I.create()),A(O(e),"interpolation",1),e}return r}(s),D=function(e){E(o,e);var t,r,i,a=T(o);function o(){var e;R(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return A(O(e=a.call(this,...r)),"cycle",!1),A(O(e),"reversed",!1),A(O(e),"timeOffset",0),A(O(e),"timeScale",1),A(O(e),"startValue",n.I.fromValues(0,0,0,1)),A(O(e),"currentValue",n.I.fromValues(0,0,0,1)),A(O(e),"endValue",n.I.fromValues(0,0,0,1)),A(O(e),"startTangent",n.I.create()),A(O(e),"endTangent",n.I.create()),A(O(e),"interpolation",1),A(O(e),"keys",[]),A(O(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort2(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.currentValue)}},{key:"GetValueAt",value:function(e,t){if(e=e/this.timeScale+this.timeOffset,this.length<=0||e<=0)return n.I.copy(t,this.startValue);if(e>this.length){if(!this.cycle)return this.reversed?n.I.copy(t,this.startValue):n.I.copy(t,this.endValue);e%=this.length}if(this.reversed&&(e=this.length-e),0===this.keys.length)return this.Interpolate(e,null,null,t);var r=this.keys[0],i=this.keys[this.keys.length-1];if(e<=r.time)return this.Interpolate(e,null,r,t);if(e>=i.time)return this.Interpolate(e,i,null,t);for(var a=0;a+1<this.keys.length&&(r=this.keys[a],i=this.keys[a+1],!(r.time<=e&&i.time>e));++a);return this.Interpolate(e,r,i,t)}},{key:"Interpolate",value:function(e,t,r,i){n.I.copy(i,this.startValue);var a=this.startValue,s=this.endValue,u=this.interpolation,c=this.length;switch(null!==t&&(u=t.interpolation,e-=t.time),u){case o.Interpolation.LINEAR:return t&&r?(a=t.value,s=r.value,c=r.time-t.time):r?(s=r.value,c=r.time):t&&(a=t.value,c=this.length-t.time),i[0]=a[0]+(s[0]-a[0])*(e/c),i[1]=a[1]+(s[1]-a[1])*(e/c),i[2]=a[2]+(s[2]-a[2])*(e/c),i[3]=a[3]+(s[3]-a[3])*(e/c),i;default:return i}}}])&&_(t.prototype,r),i&&_(t,i),o}(u);function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){var t=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(e){return!1}}();return function(){var r,n=L(e);if(t){var i=L(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return G(this,r)}}function G(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?F(e):t}function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function B(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}A(D,"inputDimension",4),A(D,"outputDimension",4),A(D,"valueProperty","currentValue"),A(D,"curveType",u.Type.CURVE2),A(D,"Key",I),A(D,"Interpolation",{CONSTANT:0,LINEAR:1});var U=function(e){k(r,e);var t=j(r);function r(){var e;M(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return B(F(e=t.call(this,...i)),"value",""),e}return r}(s),N=function(e){k(a,e);var t,r,n,i=j(a);function a(){var e;M(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return B(F(e=i.call(this,...r)),"value",""),B(F(e),"keys",[]),B(F(e),"extrapolation",0),B(F(e),"_time",0),B(F(e),"_currentKey",0),B(F(e),"_length",0),e}return t=a,(r=[{key:"Sort",value:function(){this.keys.length&&(this.keys.sort(u.Compare),this._length=this.keys[this.keys.length-1].time)}},{key:"GetLength",value:function(){return this._length}},{key:"UpdateValue",value:function(e){if(this._length<=0)return this.value;var t=this._time;if(this._time=e,this._time<t&&(this._currentKey=0),this.extrapolation===a.Extrapolation.CYCLE){var r=this._time%this._length;r<t&&(this._currentKey=0),this._time=r}for(;this._currentKey<this.keys.length&&this._time>=this.keys[this._currentKey].time;)this.value=this.keys[this._currentKey].value,++this._currentKey}}])&&C(t.prototype,r),n&&C(t,n),a}(u);function V(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t=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(e){return!1}}();return function(){var r,n=W(e);if(t){var i=W(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return X(this,r)}}function X(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Y(e):t}function Y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}B(N,"dimension",1),B(N,"outputDimension",1),B(N,"valueProperty","value"),B(N,"curveType",u.Type.CURVE),B(N,"Key",U),B(N,"Extrapolation",{NONE:0,CYCLE:3});var Q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&z(e,t)}(o,e);var t,r,i,a=q(o);function o(){var e;V(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return K(Y(e=a.call(this,...r)),"value",0),K(Y(e),"start",0),K(Y(e),"speed",1),K(Y(e),"alpha",1.1),K(Y(e),"beta",2),K(Y(e),"offset",0),K(Y(e),"scale",1),K(Y(e),"N",3),K(Y(e),"_startOffset",100*Math.random()),e}return t=o,(r=[{key:"UpdateValue",value:function(e){this.value=this.GetValueAt(e)}},{key:"GetValueAt",value:function(e){return e-=this._startOffset,(n.A.perlin1D(e*this.speed,this.alpha,this.beta,this.N)+1)/2*this.scale+this.offset}}])&&H(t.prototype,r),i&&H(t,i),o}(u);function Z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function J(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ee(e,t)}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(e){var t=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(e){return!1}}();return function(){var r,n=ie(e);if(t){var i=ie(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return re(this,r)}}function re(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ne(e):t}function ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}K(Q,"outputDimension",1),K(Q,"valueProperty","value"),K(Q,"curveType",u.Type.CURVE_NO_KEYS);var oe=function(e){$(r,e);var t=te(r);function r(){var e;J(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return ae(ne(e=t.call(this,...a)),"value",n.C.create()),ae(ne(e),"leftTangent",n.I.create()),ae(ne(e),"rightTangent",n.I.create()),ae(ne(e),"interpolation",1),e}return r}(s),se=function(e){$(o,e);var t,r,i,a=te(o);function o(){var e;J(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return ae(ne(e=a.call(this,...r)),"cycle",!1),ae(ne(e),"reversed",!1),ae(ne(e),"timeOffset",0),ae(ne(e),"timeScale",1),ae(ne(e),"startValue",n.C.create()),ae(ne(e),"currentValue",n.C.create()),ae(ne(e),"endValue",n.C.create()),ae(ne(e),"startTangent",n.I.create()),ae(ne(e),"endTangent",n.I.create()),ae(ne(e),"interpolation",1),ae(ne(e),"keys",[]),ae(ne(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort2(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.currentValue)}},{key:"GetValueAt",value:function(e,t){if(e=e/this.timeScale+this.timeOffset,this.length<=0||e<=0)return t[0]=this.startValue[0],t[1]=this.startValue[1],t[2]=this.startValue[2],t;if(e>this.length){if(!this.cycle)return this.reversed?(t[0]=this.startValue[0],t[1]=this.startValue[1],t[2]=this.startValue[2],t):(t[0]=this.endValue[0],t[1]=this.endValue[1],t[2]=this.endValue[2],t);e%=this.length}if(this.reversed&&(e=this.length-e),0===this.keys.length)return this.Interpolate(e,null,null,t);var r=this.keys[0],n=this.keys[this.keys.length-1];if(e<=r.time)return this.Interpolate(e,null,r,t);if(e>=n.time)return this.Interpolate(e,n,null,t);for(var i=0;i+1<this.keys.length&&(r=this.keys[i],n=this.keys[i+1],!(r.time<=e&&n.time>e));++i);return this.Interpolate(e,r,n,t)}},{key:"Interpolate",value:function(e,t,r,i){i[0]=this.startValue[0],i[1]=this.startValue[1],i[2]=this.startValue[2];var a=this.startValue,s=this.endValue,u=this.interpolation,c=this.length;switch(null!==t&&(u=t.interpolation,e-=t.time),u){case o.Interpolation.SPHERICAL_LINEAR:return t&&r?(a=t.value,s=r.value,c=r.time-t.time):r?(s=r.value,c=r.time):t&&(a=t.value,c=this.length-t.time),n.C.slerp(i,a,s,e/c),i;default:return i}}}])&&Z(t.prototype,r),i&&Z(t,i),o}(u);function ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function le(e,t){return(le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function fe(e){var t=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(e){return!1}}();return function(){var r,n=pe(e);if(t){var i=pe(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return he(this,r)}}function he(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?de(e):t}function de(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(e){return(pe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ve(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}ae(se,"inputDimension",4),ae(se,"outputDimension",4),ae(se,"valueProperty","currentValue"),ae(se,"curveType",u.Type.CURVE2),ae(se,"Key",oe),ae(se,"Interpolation",{CONSTANT:0,SPHERICAL_LINEAR:4});var ye=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(a,e);var t,r,n,i=fe(a);function a(){var e;ue(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return ve(de(e=i.call(this,...r)),"value",0),ve(de(e),"min",0),ve(de(e),"max",1),ve(de(e),"hold",!0),e}return t=a,(r=[{key:"UpdateValue",value:function(){this.value=this.GetValueAt()}},{key:"GetValueAt",value:function(){return this.hold?this.value:this.min+(this.max-this.min)*Math.random()}}])&&ce(t.prototype,r),n&&ce(t,n),a}(u);function me(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ge(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_e(e,t)}function _e(e,t){return(_e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Re(e){var t=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(e){return!1}}();return function(){var r,n=Te(e);if(t){var i=Te(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ee(this,r)}}function Ee(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Te(e){return(Te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Se(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}ve(ye,"outputDimension",1),ve(ye,"valueProperty","value"),ve(ye,"curveType",u.Type.CURVE_NO_KEYS);var Oe=function(e){ge(r,e);var t=Re(r);function r(){var e;be(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Se(we(e=t.call(this,...a)),"rot0",n.C.create()),Se(we(e),"omega0",n.H.create()),Se(we(e),"torque",n.H.create()),e}return r}(s),Pe=function(e){ge(o,e);var t,r,i,a=Re(o);function o(){var e;be(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Se(we(e=a.call(this,...r)),"name",""),Se(we(e),"I",1),Se(we(e),"drag",1),Se(we(e),"value",n.C.create()),Se(we(e),"start",0),Se(we(e),"states",[]),Se(we(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort(this,this.states)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){if(0===this.states.length||e<0||e<this.states[0].time)return n.C.copy(t,this.value);var r=0;if(e>=this.states[this.states.length-1].time)r=this.states.length-1;else for(;r+1<this.states.length&&!(e>=this.states[r].time&&e<this.states[r+1].time);++r);var i=u.global.vec3_0,a=u.global.quat_0,o=this.states[r];return n.H.exponentialDecay(i,o.omega0,o.torque,this.I,this.drag,e-o.time),n.C.exp(a,i),n.C.multiply(t,this.states[r].rot0,a),t}}])&&me(t.prototype,r),i&&me(t,i),o}(u);function Ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function De(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ce(e,t)}function Ce(e,t){return(Ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Me(e){var t=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(e){return!1}}();return function(){var r,n=je(e);if(t){var i=je(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ke(this,r)}}function ke(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?xe(e):t}function xe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Se(Pe,"inputDimension",4),Se(Pe,"outputDimension",4),Se(Pe,"valueProperty","value"),Se(Pe,"curveType",u.Type.CURVE),Se(Pe,"Key",Oe);var Fe=function(e){De(r,e);var t=Me(r);function r(){var e;Ie(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Ge(xe(e=t.call(this,...a)),"value",n.C.create()),Ge(xe(e),"left",n.I.create()),Ge(xe(e),"right",n.I.create()),Ge(xe(e),"interpolation",5),e}return r}(s),Le=function(e){De(o,e);var t,r,i,a=Me(o);function o(){var e;Ie(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Ge(xe(e=a.call(this,...r)),"start",0),Ge(xe(e),"value",n.C.create()),Ge(xe(e),"extrapolation",0),Ge(xe(e),"keys",[]),Ge(xe(e),"_currentKey",1),Ge(xe(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){if(0===this.length)return n.C.copy(t,this.value);var r=u.global,i=this.keys[0],a=this.keys[this.keys.length-1];if(e>=a.time)switch(this.extrapolation){case o.Extrapolation.NONE:return n.C.copy(t,this.value);case o.Extrapolation.CONSTANT:return n.C.copy(t,a.value);default:e%=a.time}else if(e<0||e<i.time)switch(this.extrapolation){case o.Extrapolation.NONE:return n.C.copy(t,this.value);default:return n.C.copy(t,i.value)}for(var s=this.keys[this._currentKey],c=this.keys[this._currentKey-1];e>=s.time||e<c.time;)e<c.time&&(this._currentKey=0),this._currentKey++,s=this.keys[this._currentKey],c=this.keys[this._currentKey-1];var l=(e-c.time)/(s.time-c.time);switch(c.interpolation){case o.Interpolation.CONSTANT:return n.C.copy(t,c.value);case o.Interpolation.LINEAR:return t[0]=c.value[0]*(1-l)+s.value[0]*l,t[1]=c.value[1]*(1-l)+s.value[1]*l,t[2]=c.value[2]*(1-l)+s.value[2]*l,t[3]=c.value[3]*(1-l)+s.value[3]*l,t;case o.Interpolation.HERMITE:for(var f=n.C.identity(r.quat_0),h=[c.value,c.right,s.left,s.value],d=3;d>0;d--){var p=n.B.biCumulative(l,d);p>1&&n.C.multiply(t,f,h[d]),t[0]=-h[d-1][0],t[1]=-h[d-1][1],t[2]=-h[d-1][2],t[3]=h[d-1][3],n.C.multiply(t,t,h[d]),n.C.pow(t,t,p),n.C.multiply(f,f,t)}return n.C.multiply(t,f,c.value);case o.Interpolation.SLERP:return n.C.slerp(t,c.value,s.value,l);default:return n.C.sqlerp(t,c.value,c.right,s.left,s.value,l)}}}])&&Ae(t.prototype,r),i&&Ae(t,i),o}(u);function Be(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ne(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ve(e,t)}function Ve(e,t){return(Ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e){var t=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(e){return!1}}();return function(){var r,n=Xe(e);if(t){var i=Xe(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ze(this,r)}}function ze(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?qe(e):t}function qe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xe(e){return(Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ge(Le,"outputDimention",4),Ge(Le,"inputDimension",4),Ge(Le,"valueProperty","value"),Ge(Le,"curveType",u.Type.CURVE),Ge(Le,"Child",Fe),Ge(Le,"Extrapolation",{NONE:0,CONSTANT:1,GRADIENT:2,CYCLE:3}),Ge(Le,"Interpolation",{NONE:0,CONSTANT:1,LINEAR:2,HERMITE:3,SLERP:5,SQUAD:6});var We=function(e){Ne(r,e);var t=He(r);function r(){var e;Ue(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return Ye(qe(e=t.call(this,...i)),"value",0),Ye(qe(e),"left",0),Ye(qe(e),"right",0),Ye(qe(e),"interpolation",0),e}return r}(s),Ke=function(e){Ne(a,e);var t,r,n,i=He(a);function a(){var e;Ue(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Ye(qe(e=i.call(this,...r)),"start",0),Ye(qe(e),"timeScale",1),Ye(qe(e),"timeOffset",0),Ye(qe(e),"value",0),Ye(qe(e),"extrapolation",0),Ye(qe(e),"keys",[]),Ye(qe(e),"_currentKey",1),Ye(qe(e),"length",0),e}return t=a,(r=[{key:"Sort",value:function(){u.Sort(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.value=this.GetValueAt(e)}},{key:"GetValueAt",value:function(e){if(e=e/this.timeScale-this.timeOffset,0===this.length)return this.value;var t=this.keys[0],r=this.keys[this.keys.length-1];if(e>=r.time)switch(this.extrapolation){case a.Extrapolation.NONE:return this.value;case a.Extrapolation.CONSTANT:return r.value;case a.Extrapolation.GRADIENT:return r.value+(e-r.time)*r.right;default:e%=r.time}else if(e<0||e<t.time)switch(this.extrapolation){case a.Extrapolation.NONE:return this.value;case a.Extrapolation.GRADIENT:return t.value+(e*this.length-r.time)*t.left;default:return t.value}for(var n=this.keys[this._currentKey],i=this.keys[this._currentKey-1];e>=n.time||e<i.time;)e<i.time&&(this._currentKey=0),this._currentKey++,n=this.keys[this._currentKey],i=this.keys[this._currentKey-1];var o=(e-i.time)/(n.time-i.time);switch(i.interpolation){case a.Interpolation.CONSTANT:return i.value;case a.Interpolation.LINEAR:return i.value*(1-o)+n.value*o;case a.Interpolation.HERMITE:var s=-2*o*o*o+3*o*o,u=o*o*o-2*o*o+o,c=o*o*o-o*o;return(2*o*o*o-3*o*o+1)*i.value+s*n.value+u*i.right+c*n.left;default:var l=1+(Math.sqrt(i.value/n.value)-1)*Math.exp(-e/i.right);return l*l*n.value}}}])&&Be(t.prototype,r),n&&Be(t,n),a}(u);function Qe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Je(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$e(e,t)}function $e(e,t){return($e=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function et(e){var t=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(e){return!1}}();return function(){var r,n=nt(e);if(t){var i=nt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return tt(this,r)}}function tt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?rt(e):t}function rt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function nt(e){return(nt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function it(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ye(Ke,"inputDimension",1),Ye(Ke,"outputDimension",1),Ye(Ke,"valueProperty","value"),Ye(Ke,"curveType",u.Type.CURVE),Ye(Ke,"Key",We),Ye(Ke,"Extrapolation",{NONE:0,CONSTANT:1,GRADIENT:2,CYCLE:3}),Ye(Ke,"Interpolation",{NONE:0,CONSTANT:1,LINEAR:2,HERMITE:3,CATMULROM:4});var at=function(e){Je(r,e);var t=et(r);function r(){var e;Ze(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return it(rt(e=t.call(this,...i)),"value",0),it(rt(e),"leftTangent",0),it(rt(e),"rightTangent",0),it(rt(e),"interpolation",1),e}return r}(s),ot=function(e){Je(a,e);var t,r,n,i=et(a);function a(){var e;Ze(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return it(rt(e=i.call(this,...r)),"cycle",!1),it(rt(e),"reversed",!1),it(rt(e),"timeOffset",0),it(rt(e),"timeScale",1),it(rt(e),"startValue",0),it(rt(e),"currentValue",0),it(rt(e),"endValue",0),it(rt(e),"startTangent",0),it(rt(e),"endTangent",0),it(rt(e),"interpolation",1),it(rt(e),"keys",[]),it(rt(e),"length",0),e}return t=a,(r=[{key:"Sort",value:function(){u.Sort2(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.currentValue=this.GetValueAt(e)}},{key:"GetValueAt",value:function(e){if(e=e/this.timeScale+this.timeOffset,this.length<=0||e<=0)return this.startValue;if(e>this.length){if(!this.cycle)return this.reversed?this.startValue:this.endValue;e%=this.length}if(this.reversed&&(e=this.length-e),0===this.keys.length)return this.Interpolate(e,null,null);var t=this.keys[0],r=this.keys[this.keys.length-1];if(e<=t.time)return this.Interpolate(e,null,t);if(e>=r.time)return this.Interpolate(e,r,null);for(var n=0;n+1<this.keys.length&&(t=this.keys[n],r=this.keys[n+1],!(t.time<=e&&r.time>e));++n);return this.Interpolate(e,t,r)}},{key:"Interpolate",value:function(e,t,r){var n=this.startValue,i=this.endValue,o=this.interpolation,s=this.length;switch(null!==t&&(o=t.interpolation,e-=t.time),o){case a.Interpolation.LINEAR:return t&&r?(n=t.value,i=r.value,s=r.time-t.time):r?(i=r.value,s=r.time):t&&(n=t.value,s=this.length-t.time),n+e/s*(i-n);case a.Interpolation.HERMITE:var u=this.startTangent,c=this.endTangent;t&&r?(n=t.value,u=t.rightTangent,i=r.value,c=r.leftTangent,s=r.time-t.time):r?(i=r.value,c=r.leftTangent,s=r.time):t&&(n=t.value,u=t.rightTangent,s=this.length-t.time);var l=e/s,f=l*l,h=f*l,d=-2*h+3*f,p=h-f;return n*(1-d)+i*d+u*(l+p-f)+c*p;default:return this.startValue}}}])&&Qe(t.prototype,r),n&&Qe(t,n),a}(u);function st(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ut(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ct(e,t){return(ct=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function lt(e){var t=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(e){return!1}}();return function(){var r,n=dt(e);if(t){var i=dt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ft(this,r)}}function ft(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ht(e):t}function ht(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dt(e){return(dt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}it(ot,"inputDimension",1),it(ot,"outputDimension",1),it(ot,"valueProperty","currentValue"),it(ot,"curveType",u.Type.CURVE2),it(ot,"Key",at),it(ot,"Interpolation",{CONSTANT:0,LINEAR:1,HERMITE:2});var vt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ct(e,t)}(a,e);var t,r,n,i=lt(a);function a(){var e;st(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return pt(ht(e=i.call(this,...r)),"value",0),pt(ht(e),"offset",0),pt(ht(e),"scale",1),pt(ht(e),"speed",1),e}return t=a,(r=[{key:"UpdateValue",value:function(e){this.value=this.GetValueAt(e)}},{key:"GetValueAt",value:function(e){return Math.sin(e*Math.PI*2*this.speed)*this.scale+this.offset}}])&&ut(t.prototype,r),n&&ut(t,n),a}(u);function yt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&gt(e,t)}function gt(e,t){return(gt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _t(e){var t=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(e){return!1}}();return function(){var r,n=wt(e);if(t){var i=wt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Rt(this,r)}}function Rt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Et(e):t}function Et(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wt(e){return(wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}pt(vt,"outputDimension",1),pt(vt,"valueProperty","value"),pt(vt,"curveType",u.Type.CURVE_NO_KEYS);var St=function(e){bt(r,e);var t=_t(r);function r(){var e;mt(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Tt(Et(e=t.call(this,...a)),"value",n.G.create()),Tt(Et(e),"leftTangent",n.G.create()),Tt(Et(e),"rightTangent",n.G.create()),Tt(Et(e),"interpolation",1),e}return r}(s),Ot=function(e){bt(o,e);var t,r,i,a=_t(o);function o(){var e;mt(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Tt(Et(e=a.call(this,...r)),"cycle",!1),Tt(Et(e),"reversed",!1),Tt(Et(e),"timeOffset",0),Tt(Et(e),"timeScale",1),Tt(Et(e),"startValue",n.G.create()),Tt(Et(e),"currentValue",n.G.create()),Tt(Et(e),"endValue",n.G.create()),Tt(Et(e),"startTangent",n.G.create()),Tt(Et(e),"endTangent",n.G.create()),Tt(Et(e),"interpolation",1),Tt(Et(e),"keys",[]),Tt(Et(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort2(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.currentValue)}},{key:"GetValueAt",value:function(e,t){if(e=e/this.timeScale+this.timeOffset,this.length<=0||e<=0)return n.G.copy(t,this.startValue);if(e>this.length){if(!this.cycle)return this.reversed?n.G.copy(t,this.startValue):n.G.copy(t,this.endValue);e%=this.length}if(this.reversed&&(e=this.length-e),0===this.keys.length)return this.Interpolate(e,null,null,t);var r=this.keys[0],i=this.keys[this.keys.length-1];if(e<=r.time)return this.Interpolate(e,null,r,t);if(e>=i.time)return this.Interpolate(e,i,null,t);for(var a=0;a+1<this.keys.length&&(r=this.keys[a],i=this.keys[a+1],!(r.time<=e&&i.time>e));++a);return this.Interpolate(e,r,i,t)}},{key:"Interpolate",value:function(e,t,r,i){n.G.copy(i,this.startValue);var a=this.startValue,s=this.endValue,u=this.interpolation,c=this.length;switch(null!==t&&(u=t.interpolation,e-=t.time),u){case o.Interpolation.LINEAR:return t&&r?(a=t.value,s=r.value,c=r.time-t.time):r?(s=r.value,c=r.time):t&&(a=t.value,c=this.length-t.time),i[0]=a[0]+(s[0]-a[0])*(e/c),i[1]=a[1]+(s[1]-a[1])*(e/c),i;case o.Interpolation.HERMITE:var l=this.startTangent,f=this.endTangent;t&&r?(a=t.value,l=t.rightTangent,s=r.value,f=r.leftTangent,c=r.time-t.time):r?(s=r.value,f=r.leftTangent,c=r.time):t&&(a=t.value,l=t.rightTangent,c=this.length-t.time);var h=e/c,d=h*h,p=d*h,v=-2*p+3*d,y=1-v,m=p-d,b=h+m-d;return i[0]=a[0]*y+s[0]*v+l[0]*b+f[0]*m,i[1]=a[1]*y+s[1]*v+l[1]*b+f[1]*m,i;default:return i}}}])&&yt(t.prototype,r),i&&yt(t,i),o}(u);function Pt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function At(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function It(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Dt(e,t)}function Dt(e,t){return(Dt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ct(e){var t=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(e){return!1}}();return function(){var r,n=xt(e);if(t){var i=xt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Mt(this,r)}}function Mt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?kt(e):t}function kt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xt(e){return(xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function jt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Tt(Ot,"inputDimension",2),Tt(Ot,"outputDimension",2),Tt(Ot,"valueProperty","value"),Tt(Ot,"curveType",u.Type.CURVE2),Tt(Ot,"Key",St),Tt(Ot,"Interpolation",{CONSTANT:0,LINEAR:1,HERMITE:2});var Gt=function(e){It(r,e);var t=Ct(r);function r(){var e;At(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return jt(kt(e=t.call(this,...a)),"value",n.H.create()),jt(kt(e),"leftTangent",n.H.create()),jt(kt(e),"rightTangent",n.H.create()),jt(kt(e),"interpolation",1),e}return r}(s),Ft=function(e){It(o,e);var t,r,i,a=Ct(o);function o(){var e;At(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return jt(kt(e=a.call(this,...r)),"cycle",!1),jt(kt(e),"reversed",!1),jt(kt(e),"timeOffset",0),jt(kt(e),"timeScale",1),jt(kt(e),"startValue",n.H.create()),jt(kt(e),"currentValue",n.H.create()),jt(kt(e),"endValue",n.H.create()),jt(kt(e),"startTangent",n.H.create()),jt(kt(e),"endTangent",n.H.create()),jt(kt(e),"interpolation",1),jt(kt(e),"keys",[]),jt(kt(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort2(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.currentValue)}},{key:"GetValueAt",value:function(e,t){if(e=e/this.timeScale+this.timeOffset,this.length<=0||e<=0)return n.H.copy(t,this.startValue);if(e>this.length){if(!this.cycle)return this.reversed?n.H.copy(t,this.startValue):n.H.copy(t,this.endValue);e%=this.length}if(this.reversed&&(e=this.length-e),0===this.keys.length)return this.Interpolate(e,null,null,t);var r=this.keys[0],i=this.keys[this.keys.length-1];if(e<=r.time)return this.Interpolate(e,null,r,t);if(e>=i.time)return this.Interpolate(e,i,null,t);for(var a=0;a+1<this.keys.length&&(r=this.keys[a],i=this.keys[a+1],!(r.time<=e&&i.time>e));++a);return this.Interpolate(e,r,i,t)}},{key:"Interpolate",value:function(e,t,r,i){n.H.copy(i,this.startValue);var a=this.startValue,s=this.endValue,u=this.interpolation,c=this.length;switch(null!==t&&(u=t.interpolation,e-=t.time),u){case o.Interpolation.LINEAR:return t&&r?(a=t.value,s=r.value,c=r.time-t.time):r?(s=r.value,c=r.time):t&&(a=t.value,c=this.length-t.time),i[0]=a[0]+(s[0]-a[0])*(e/c),i[1]=a[1]+(s[1]-a[1])*(e/c),i[2]=a[2]+(s[2]-a[2])*(e/c),i;case o.Interpolation.HERMITE:var l=this.startTangent,f=this.endTangent;t&&r?(a=t.value,l=t.rightTangent,s=r.value,f=r.leftTangent,c=r.time-t.time):r?(s=r.value,f=r.leftTangent,c=r.time):t&&(a=t.value,l=t.rightTangent,c=this.length-t.time);var h=e/c,d=h*h,p=d*h,v=-2*p+3*d,y=1-v,m=p-d,b=h+m-d;return i[0]=a[0]*y+s[0]*v+l[0]*b+f[0]*m,i[1]=a[1]*y+s[1]*v+l[1]*b+f[1]*m,i[2]=a[2]*y+s[2]*v+l[2]*b+f[2]*m,i;default:return i}}}])&&Pt(t.prototype,r),i&&Pt(t,i),o}(u);function Lt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Bt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ut(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Nt(e,t)}function Nt(e,t){return(Nt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Vt(e){var t=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(e){return!1}}();return function(){var r,n=qt(e);if(t){var i=qt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Ht(this,r)}}function Ht(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?zt(e):t}function zt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qt(e){return(qt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}jt(Ft,"inputDimension",3),jt(Ft,"outputDimension",3),jt(Ft,"valueProperty","currentValue"),jt(Ft,"curveType",u.Type.CURVE2),jt(Ft,"Key",Gt),jt(Ft,"Interpolation",{CONSTANT:0,LINEAR:1,HERMITE:2});var Yt=function(e){Ut(r,e);var t=Vt(r);function r(){var e;Bt(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Xt(zt(e=t.call(this,...a)),"value",n.H.create()),Xt(zt(e),"left",n.H.create()),Xt(zt(e),"right",n.H.create()),Xt(zt(e),"interpolation",0),e}return r}(s),Wt=function(e){Ut(o,e);var t,r,i,a=Vt(o);function o(){var e;Bt(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Xt(zt(e=a.call(this,...r)),"start",0),Xt(zt(e),"value",n.H.create()),Xt(zt(e),"extrapolation",0),Xt(zt(e),"keys",[]),Xt(zt(e),"_currentKey",1),Xt(zt(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){u.Sort(this)}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){if(0===this.length)return n.H.copy(t,this.value);var r=this.keys[0],i=this.keys[this.keys.length-1];if(e>=i.time)switch(this.extrapolation){case o.Extrapolation.NONE:return n.H.copy(t,this.value);case o.Extrapolation.CONSTANT:return n.H.copy(t,i.value);case o.Extrapolation.GRADIENT:return n.H.scaleAndAdd(t,i.value,i.right,e-i.time);default:e%=i.time}else if(e<0||e<r.time)switch(this.extrapolation){case o.Extrapolation.NONE:return n.H.copy(t,this.value);case o.Extrapolation.GRADIENT:return n.H.scaleAndAdd(t,r.value,r.left,e*this.length-i.time);default:return n.H.copy(t,r.value)}for(var a=this.keys[this._currentKey],s=this.keys[this._currentKey-1];e>=a.time||e<s.time;)e<s.time&&(this._currentKey=0),this._currentKey++,a=this.keys[this._currentKey],s=this.keys[this._currentKey-1];var u=(e-s.time)/(a.time-s.time);switch(s.interpolation){case o.Interpolation.CONSTANT:return n.H.copy(t,s.value);case o.Interpolation.LINEAR:return t[0]=s.value[0]*(1-u)+a.value[0]*u,t[1]=s.value[1]*(1-u)+a.value[1]*u,t[2]=s.value[2]*(1-u)+a.value[2]*u,t;case o.Interpolation.HERMITE:var c=2*u*u*u-3*u*u+1,l=-2*u*u*u+3*u*u,f=u*u*u-2*u*u+u,h=u*u*u-u*u;return t[0]=c*s.value[0]+l*a.value[0]+f*s.right[0]+h*a.left[0],t[1]=c*s.value[1]+l*a.value[1]+f*s.right[1]+h*a.left[1],t[2]=c*s.value[2]+l*a.value[2]+f*s.right[2]+h*a.left[2],t;default:return t}}}])&&Lt(t.prototype,r),i&&Lt(t,i),o}(u);function Kt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Zt(e,t){return(Zt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Jt(e){var t=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(e){return!1}}();return function(){var r,n=er(e);if(t){var i=er(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return $t(this,r)}}function $t(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function er(e){return(er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Xt(Wt,"inputDimension",3),Xt(Wt,"outputDimension",3),Xt(Wt,"valueProperty","value"),Xt(Wt,"curveType",u.Type.CURVE),Xt(Wt,"Key",Yt),Xt(Wt,"Extrapolation",{NONE:0,CONSTANT:1,GRADIENT:2,CYCLE:3}),Xt(Wt,"Interpolation",{NONE:0,CONSTANT:1,LINEAR:2,HERMITE:3});var rr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Zt(e,t)}(a,e);var t,r,n,i=Jt(a);function a(){return Kt(this,a),i.apply(this,arguments)}return t=a,n=[{key:"Sort",value:function(e){var t=e.functions;if(t&&t.length)for(var r=0;r<t.length;r++)t[r]&&"Sort"in t[r]&&t[r].Sort()}},{key:"Sort2",value:function(e){var t=e.constructor.childProperties;if(t)for(var r=0;r<t.length;r++){var n=e[t[r]];n&&"Sort"in n&&n.Sort()}}}],(r=null)&&Qt(t.prototype,r),n&&Qt(t,n),a}(u);function nr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ir(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ar(e,t){return(ar=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function or(e){var t=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(e){return!1}}();return function(){var r,n=cr(e);if(t){var i=cr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return sr(this,r)}}function sr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ur(e):t}function ur(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cr(e){return(cr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}tr(rr,"childProperties",null),tr(rr,"childArray",null),tr(rr,"Operator",null);var fr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ar(e,t)}(o,e);var t,r,i,a=or(o);function o(){var e;nr(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return lr(ur(e=a.call(this,...r)),"start",0),lr(ur(e),"value",n.I.create()),lr(ur(e),"operator",0),lr(ur(e),"functions",[]),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort(this)}},{key:"GetLength",value:function(){for(var e=0,t=0;t<this.functions.length;++t)"GetLength"in this.functions[t]&&(e=Math.max(e,this.functions[t].GetLength()));return e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){var r=rr.global.vec4_0;switch(this.operator){case o.Operator.MULTIPLY:n.I.set(t,1,1,1,1);for(var i=0;i<this.functions.length;++i)this.functions[i].GetValueAt(e,r),n.I.multiply(t,t,r);return t;default:n.I.set(t,0,0,0,0);for(var a=0;a<this.functions.length;++a)this.functions[a].GetValueAt(e,r),n.I.add(t,t,r);return t}}}])&&ir(t.prototype,r),i&&ir(t,i),o}(rr);function hr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pr(e,t){return(pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vr(e){var t=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(e){return!1}}();return function(){var r,n=br(e);if(t){var i=br(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return yr(this,r)}}function yr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?mr(e):t}function mr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function br(e){return(br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}lr(fr,"inputDimension",4),lr(fr,"outputDimension",4),lr(fr,"valueProperty","value"),lr(fr,"curveType",rr.Type.SEQUENCER),lr(fr,"childArray","functions"),lr(fr,"Operator",{MULTIPLY:0,ADD:1});var _r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pr(e,t)}(o,e);var t,r,i,a=vr(o);function o(){var e;hr(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return gr(mr(e=a.call(this,...r)),"yawCurve",null),gr(mr(e),"pitchCurve",null),gr(mr(e),"rollCurve",null),gr(mr(e),"currentValue",n.C.create()),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort2(this)}},{key:"GetLength",value:function(){var e=0;return this.yawCurve&&"GetLength"in this.yawCurve&&(e=this.yawCurve.GetLength()),this.pitchCurve&&"GetLength"in this.pitchCurve&&(e=Math.max(e,this.pitchCurve.GetLength())),this.rollCurve&&"GetLength"in this.rollCurve&&(e=Math.max(e,this.rollCurve.GetLength())),e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.currentValue)}},{key:"GetValueAt",value:function(e,t){var r=this.yawCurve?this.yawCurve.GetValueAt(e):0,n=this.pitchCurve?this.pitchCurve.GetValueAt(e):0,i=this.rollCurve?this.rollCurve.GetValueAt(e):0,a=Math.sin(r/2),o=Math.cos(r/2),s=Math.sin(n/2),u=Math.cos(n/2),c=Math.sin(i/2),l=Math.cos(i/2);return t[0]=a*u*c+o*s*l,t[1]=a*u*l-o*s*c,t[2]=o*u*c-a*s*l,t[3]=o*u*l+a*s*c,t}}])&&dr(t.prototype,r),i&&dr(t,i),o}(rr);function Rr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function wr(e,t){return(wr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Tr(e){var t=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(e){return!1}}();return function(){var r,n=Pr(e);if(t){var i=Pr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Sr(this,r)}}function Sr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Or(e):t}function Or(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pr(e){return(Pr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ar(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}gr(_r,"inputDimension",1),gr(_r,"outputDimension",3),gr(_r,"valueProperty","currentValue"),gr(_r,"curveType",rr.Type.SEQUENCER2),gr(_r,"childProperties",["yawCurve","pitchCurve","rollCurve"]);var Ir=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&wr(e,t)}(o,e);var t,r,i,a=Tr(o);function o(){var e;Rr(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Ar(Or(e=a.call(this,...r)),"start",0),Ar(Or(e),"value",n.C.create()),Ar(Or(e),"functions",[]),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort(this)}},{key:"GetLength",value:function(){for(var e=0,t=0;t<this.functions.length;++t)"GetLength"in this.functions[t]&&(e=Math.max(e,this.functions[t].GetLength()));return e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){n.C.identity(t);for(var r=rr.global.quat_0,i=0;i<this.functions.length;++i)this.functions[i].GetValueAt(e,r),n.C.multiply(t,t,r);return t}}])&&Er(t.prototype,r),i&&Er(t,i),o}(rr);function Dr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Mr(e,t){return(Mr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kr(e){var t=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(e){return!1}}();return function(){var r,n=Gr(e);if(t){var i=Gr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return xr(this,r)}}function xr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?jr(e):t}function jr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Gr(e){return(Gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ar(Ir,"inputDimension",4),Ar(Ir,"outputDimension",4),Ar(Ir,"valueProperty","value"),Ar(Ir,"curveType",rr.Type.SEQUENCER),Ar(Ir,"childArray","functions");var Lr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mr(e,t)}(o,e);var t,r,i,a=kr(o);function o(){var e;Dr(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Fr(jr(e=a.call(this,...r)),"value",n.I.create()),Fr(jr(e),"RedCurve",null),Fr(jr(e),"GreenCurve",null),Fr(jr(e),"BlueCurve",null),Fr(jr(e),"AlphaCurve",null),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort2(this)}},{key:"GetLength",value:function(){var e=0;return this.RedCurve&&"GetLength"in this.RedCurve&&(e=this.RedCurve.GetLength()),this.GreenCurve&&"GetLength"in this.GreenCurve&&(e=Math.max(e,this.GreenCurve.GetLength())),this.BlueCurve&&"GetLength"in this.BlueCurve&&(e=Math.max(e,this.BlueCurve.GetLength())),this.AlphaCurve&&"GetLength"in this.AlphaCurve&&(e=Math.max(e,this.AlphaCurve.GetLength())),e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){return t[0]=this.RedCurve?this.RedCurve.GetValueAt(e):0,t[1]=this.GreenCurve?this.GreenCurve.GetValueAt(e):0,t[2]=this.BlueCurve?this.BlueCurve.GetValueAt(e):0,t[3]=this.AlphaCurve?this.AlphaCurve.GetValueAt(e):0,t}}])&&Cr(t.prototype,r),i&&Cr(t,i),o}(rr);function Br(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ur(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Nr(e,t){return(Nr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Vr(e){var t=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(e){return!1}}();return function(){var r,n=qr(e);if(t){var i=qr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Hr(this,r)}}function Hr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?zr(e):t}function zr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function qr(e){return(qr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Fr(Lr,"inputDimension",1),Fr(Lr,"outputDimension",4),Fr(Lr,"valueProperty","value"),Fr(Lr,"curveType",rr.Type.SEQUENCER2),Fr(Lr,"childProperties",["RedCurve","GreenCurve","BlueCurve","AlphaCurve"]);var Yr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Nr(e,t)}(a,e);var t,r,n,i=Vr(a);function a(){var e;Br(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Xr(zr(e=i.call(this,...r)),"value",0),Xr(zr(e),"operator",0),Xr(zr(e),"functions",[]),Xr(zr(e),"inMinClamp",0),Xr(zr(e),"inMaxClamp",1),Xr(zr(e),"outMinClamp",0),Xr(zr(e),"outMaxClamp",1),Xr(zr(e),"clamping",!1),e}return t=a,(r=[{key:"Sort",value:function(){rr.Sort(this)}},{key:"GetLength",value:function(){for(var e=0,t=0;t<this.functions.length;++t)"GetLength"in this.functions[t]&&(e=Math.max(e,this.functions[t].GetLength()));return e}},{key:"UpdateValue",value:function(e){this.value=this.GetValueAt(e)}},{key:"GetValueAt",value:function(e){var t;switch(this.operator){case a.Operator.MULTIPLY:t=1;for(var r=0;r<this.functions.length;++r){var n=this.functions[r].GetValueAt(e);this.clamping&&(n=Math.min(Math.max(n,this.inMinClamp),this.inMaxClamp)),t*=n}break;default:t=0;for(var i=0;i<this.functions.length;++i){var o=this.functions[i].GetValueAt(e);this.clamping&&(o=Math.min(Math.max(o,this.inMinClamp),this.inMaxClamp)),t+=o}}return this.clamping&&(t=Math.min(Math.max(t,this.outMinClamp),this.outMaxClamp)),t}}])&&Ur(t.prototype,r),n&&Ur(t,n),a}(rr);function Wr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Qr(e,t){return(Qr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zr(e){var t=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(e){return!1}}();return function(){var r,n=en(e);if(t){var i=en(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Jr(this,r)}}function Jr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?$r(e):t}function $r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function en(e){return(en=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Xr(Yr,"inputDimension",1),Xr(Yr,"outputDimension",1),Xr(Yr,"valueProperty","value"),Xr(Yr,"curveType",rr.Type.SEQUENCER),Xr(Yr,"childArray","functions"),Xr(Yr,"Operator",{MULTIPLY:0,ADD:1});var rn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qr(e,t)}(o,e);var t,r,i,a=Zr(o);function o(){var e;Wr(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return tn($r(e=a.call(this,...r)),"start",0),tn($r(e),"value",n.H.create()),tn($r(e),"operator",0),tn($r(e),"functions",[]),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort(this)}},{key:"GetLength",value:function(){for(var e=0,t=0;t<this.functions.length;++t)"GetLength"in this.functions[t]&&(e=Math.max(e,this.functions[t].GetLength()));return e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){var r=rr.global.vec3_0;switch(this.operator){case o.Operator.MULTIPLY:n.H.set(t,1,1,1);for(var i=0;i<this.functions.length;++i)this.functions[i].GetValueAt(e,r),n.H.multiply(t,t,r);return t;default:n.H.set(t,0,0,0);for(var a=0;a<this.functions.length;++a)this.functions[a].GetValueAt(e,r),n.H.add(t,t,r);return t}}}])&&Kr(t.prototype,r),i&&Kr(t,i),o}(rr);function nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function an(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function on(e,t){return(on=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function sn(e){var t=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(e){return!1}}();return function(){var r,n=ln(e);if(t){var i=ln(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return un(this,r)}}function un(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?cn(e):t}function cn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ln(e){return(ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function fn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}tn(rn,"inputDimension",3),tn(rn,"outputDimension",3),tn(rn,"valueProperty","value"),tn(rn,"curveType",rr.Type.SEQUENCER),tn(rn,"childArray","functions"),tn(rn,"Operator",{MULTIPLY:0,ADD:1});var hn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&on(e,t)}(o,e);var t,r,i,a=sn(o);function o(){var e;nn(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return fn(cn(e=a.call(this,...r)),"value",n.H.create()),fn(cn(e),"XCurve",null),fn(cn(e),"YCurve",null),fn(cn(e),"ZCurve",null),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort2(this)}},{key:"GetLength",value:function(){var e=0;return this.XCurve&&"GetLength"in this.XCurve&&(e=this.XCurve.GetLength()),this.YCurve&&"GetLength"in this.YCurve&&(e=Math.max(e,this.YCurve.GetLength())),this.ZCurve&&"GetLength"in this.ZCurve&&(e=Math.max(e,this.ZCurve.GetLength())),e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){return t[0]=this.XCurve?this.XCurve.GetValueAt(e):0,t[1]=this.YCurve?this.YCurve.GetValueAt(e):0,t[2]=this.ZCurve?this.ZCurve.GetValueAt(e):0,t}}])&&an(t.prototype,r),i&&an(t,i),o}(rr);function dn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function vn(e,t){return(vn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function yn(e){var t=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(e){return!1}}();return function(){var r,n=gn(e);if(t){var i=gn(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return mn(this,r)}}function mn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?bn(e):t}function bn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gn(e){return(gn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}fn(hn,"inputDimension",1),fn(hn,"outputDimension",3),fn(hn,"valueProperty","value"),fn(hn,"curveType",rr.Type.SEQUENCER2),fn(hn,"childProperties",["XCurve","YCurve","ZCurve"]);var Rn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&vn(e,t)}(o,e);var t,r,i,a=yn(o);function o(){var e;dn(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return _n(bn(e=a.call(this,...r)),"value",n.C.create()),_n(bn(e),"YawPitchRoll",n.H.create()),_n(bn(e),"YawCurve",null),_n(bn(e),"PitchCurve",null),_n(bn(e),"RollCurve",null),e}return t=o,(r=[{key:"Sort",value:function(){rr.Sort2(this)}},{key:"GetLength",value:function(){var e=0;return this.YawCurve&&"GetLength"in this.YawCurve&&(e=this.YawCurve.GetLength()),this.PitchCurve&&"GetLength"in this.PitchCurve&&(e=Math.max(e,this.PitchCurve.GetLength())),this.RollCurve&&"GetLength"in this.RollCurve&&(e=Math.max(e,this.RollCurve.GetLength())),e}},{key:"UpdateValue",value:function(e){this.GetValueAt(e,this.value)}},{key:"GetValueAt",value:function(e,t){this.YawCurve&&(this.YawPitchRoll[0]=this.YawCurve.GetValueAt(e)),this.PitchCurve&&(this.YawPitchRoll[1]=this.PitchCurve.GetValueAt(e)),this.RollCurve&&(this.YawPitchRoll[2]=this.RollCurve.GetValueAt(e));var r=Math.sin(this.YawPitchRoll[0]/180*Math.PI/2),n=Math.cos(this.YawPitchRoll[0]/180*Math.PI/2),i=Math.sin(this.YawPitchRoll[1]/180*Math.PI/2),a=Math.cos(this.YawPitchRoll[1]/180*Math.PI/2),o=Math.sin(this.YawPitchRoll[2]/180*Math.PI/2),s=Math.cos(this.YawPitchRoll[2]/180*Math.PI/2);return t[0]=r*a*o+n*i*s,t[1]=r*a*s-n*i*o,t[2]=n*a*o-r*i*s,t[3]=n*a*s+r*i*o,t}}])&&pn(t.prototype,r),i&&pn(t,i),o}(rr);function En(){this._id=n.F.generateID(),this.name="",this.geometryResPath="",this.geometryRes=null,this.group="",this.duration=0,this.cycle=!1,this.Initialize=function(){if(this.geometryResPath){this.geometryRes=n.D.GetResource(this.geometryResPath);var e=this,t={OnResPrepared:function(){!function(e){if(e.name&&e.group&&e.geometryRes)for(var t=0;t<e.geometryRes.animations.length;++t)for(var r=e.geometryRes.animations[t],n=0;n<r.trackGroups.length;++n)r.trackGroups[n].name===e.group&&e._ApplyTracks(r.trackGroups[n],r.duration)}(e)}};this.geometryRes.RegisterNotification(t)}},this.UpdateValue=function(e){this._TracksReady()&&(this.cycle&&(e%=this.duration),e<=this.duration&&e>=0&&this._UpdateValue(e))}}function wn(){this._id=n.F.generateID(),this.translation=n.H.create(),this.rotation=n.C.create(),this.rotation[3]=1,this.scale=n.H.create();var e=null,t=null,r=null,i=n.z.create();this._TracksReady=function(){return e||t||r},this._ApplyTracks=function(n,i){for(var a=0;a<n.transformTracks.length;++a){var o=n.transformTracks[a];o.name===this.name&&(this.duration=i,e=o.position,t=o.orientation,r=o.scaleShear)}this.UpdateValue(0)},this._UpdateValue=function(a){e&&n.v.evaluate(e,a,this.translation,this.cycle,this.duration),t&&(n.v.evaluate(t,a,this.rotation,this.cycle,this.duration),n.C.normalize(this.rotation,this.rotation)),r&&n.v.evaluate(r,a,i,this.cycle,this.duration),this.scale[0]=i[0],this.scale[1]=i[5],this.scale[2]=i[10]}}function Tn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Sn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}_n(Rn,"inputDimension",1),_n(Rn,"outputDimension",4),_n(Rn,"valueProperty","value"),_n(Rn,"curveType",rr.Type.SEQUENCER2),_n(Rn,"childProperties",["YawCurve","PitchCurve","RollCurve"]),wn.prototype=new En;var On=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Sn(this,"_id",n.F.generateID()),Sn(this,"name",""),Sn(this,"resPath",""),Sn(this,"res",null),Sn(this,"group",""),Sn(this,"cycle",!1),Sn(this,"duration",0),Sn(this,"translation",n.H.create()),Sn(this,"rotation",n.C.create()),Sn(this,"scale",n.H.fromValues(0,0,0)),Sn(this,"scaleShear",n.z.create()),Sn(this,"positionCurve",null),Sn(this,"orientationCurve",null),Sn(this,"scaleCurve",null)}var t,r,i;return t=e,(r=[{key:"Initialize",value:function(){""!==this.resPath&&(this.res=n.D.GetResource(this.resPath))}},{key:"GetLength",value:function(){return this.duration}},{key:"UpdateValue",value:function(e){this.res&&this.res.IsGood()&&(this.positionCurve||this.FindTracks(),this.positionCurve&&(this.cycle&&(e%=this.duration),e>this.duration||e<0||(n.v.evaluate(this.positionCurve,e,this.translation,this.cycle,this.duration),n.v.evaluate(this.orientationCurve,e,this.rotation,this.cycle,this.duration),n.C.normalize(this.rotation,this.rotation),n.v.evaluate(this.scaleCurve,e,this.scaleShear,this.cycle,this.duration),n.z.getScaling(this.scale,this.scaleCurve))))}},{key:"FindTracks",value:function(){for(var e=null,t=0;t<this.res.animations.length;++t)for(var r=0;r<this.res.animations[t].trackGroups.length;++r)if(this.res.animations[t].trackGroups[r].name===this.group){this.duration=this.res.animations[t].duration,e=this.res.animations[t].trackGroups[r];break}if(e)for(var n=0;n<e.transformTracks.length;++n)if(this.name===e.transformTracks[n].name){this.positionCurve=e.transformTracks[n].position,this.orientationCurve=e.transformTracks[n].orientation,this.scaleCurve=e.transformTracks[n].scaleShear;break}}}])&&Tn(t.prototype,r),i&&Tn(t,i),e}();function Pn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function An(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function In(e,t){return(In=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Dn(e){var t=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(e){return!1}}();return function(){var r,n=kn(e);if(t){var i=kn(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Cn(this,r)}}function Cn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Mn(e):t}function Mn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kn(e){return(kn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var jn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&In(e,t)}(o,e);var t,r,i,a=Dn(o);function o(){var e;Pn(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return xn(Mn(e=a.call(this,...r)),"xIndex",-1),xn(Mn(e),"yIndex",-1),xn(Mn(e),"zIndex",-1),xn(Mn(e),"animationEngine",null),xn(Mn(e),"eulerValue",n.H.create()),xn(Mn(e),"updateQuaternion",!1),xn(Mn(e),"quatValue",n.C.create()),xn(Mn(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){this.ComputeLength()}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){if(this.animationEngine&&(this.xIndex&&(this.eulerValue[0]=this.animationEngine.Evaluate(this.xIndex,e)),this.yIndex&&(this.yIndex===this.xIndex?this.eulerValue[1]=this.eulerValue[0]:this.eulerValue[1]=this.animationEngine.Evaluate(this.yIndex,e)),this.zIndex&&(this.zIndex===this.xIndex?this.eulerValue[2]=this.eulerValue[0]:this.eulerValue[2]=this.animationEngine.Evaluate(this.zIndex,e)),this.updateQuaternion)){var t=Math.sin(this.eulerValue[0]/2),r=Math.cos(this.eulerValue[0]/2),n=Math.sin(this.eulerValue[1]/2),i=Math.cos(this.eulerValue[1]/2),a=Math.sin(this.eulerValue[2]/2),o=Math.cos(this.eulerValue[2]/2);this.quatValue[0]=t*i*a+r*n*o,this.quatValue[1]=t*i*o-r*n*a,this.quatValue[2]=r*i*a-t*n*o,this.quatValue[3]=r*i*o+t*n*a}}},{key:"ComputeLength",value:function(){this.animationEngine&&0!==this.animationEngine.GetNumberOfCurves()&&(this.length=0,this.xIndex>=0&&(this.length=this.animationEngine.GetLength(this.xIndex)),this.yIndex>=0&&(this.length=Math.max(this.length,this.animationEngine.GetLength(this.yIndex))),this.zIndex>=0&&(this.length=Math.max(this.length,this.animationEngine.GetLength(this.zIndex))))}}])&&An(t.prototype,r),i&&An(t,i),o}(u);function Gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ln(e,t){return(Ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Bn(e){var t=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(e){return!1}}();return function(){var r,n=Vn(e);if(t){var i=Vn(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Un(this,r)}}function Un(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Nn(e):t}function Nn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Vn(e){return(Vn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Hn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}xn(jn,"outputDimension",3),xn(jn,"valueProperty","eulerValue"),xn(jn,"curveType",u.Type.CURVE_MAYA);var zn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ln(e,t)}(a,e);var t,r,n,i=Bn(a);function a(){var e;Gn(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Hn(Nn(e=i.call(this,...r)),"index",-1),Hn(Nn(e),"animationEngine",null),Hn(Nn(e),"value",0),Hn(Nn(e),"length",0),e}return t=a,(r=[{key:"Sort",value:function(){this.ComputeLength()}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.animationEngine&&(this.value=this.animationEngine.Evaluate(this.index,e))}},{key:"ComputeLength",value:function(){this.animationEngine&&0!==this.animationEngine.GetNumberOfCurves()&&this.index>=0&&(this.length=this.animationEngine.GetLength(this.index))}}])&&Fn(t.prototype,r),n&&Fn(t,n),a}(u);function qn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Yn(e,t){return(Yn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wn(e){var t=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(e){return!1}}();return function(){var r,n=Zn(e);if(t){var i=Zn(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Kn(this,r)}}function Kn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Qn(e):t}function Qn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zn(e){return(Zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Jn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Hn(zn,"outputDimension",1),Hn(zn,"valueProperty","value"),Hn(zn,"curveType",u.Type.CURVE_MAYA);var $n=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yn(e,t)}(o,e);var t,r,i,a=Wn(o);function o(){var e;qn(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Jn(Qn(e=a.call(this,...r)),"xIndex",-1),Jn(Qn(e),"yIndex",-1),Jn(Qn(e),"zIndex",-1),Jn(Qn(e),"animationEngine",null),Jn(Qn(e),"value",n.H.create()),Jn(Qn(e),"length",0),e}return t=o,(r=[{key:"Sort",value:function(){this.ComputeLength()}},{key:"GetLength",value:function(){return this.length}},{key:"UpdateValue",value:function(e){this.animationEngine&&(this.xIndex&&(this.value[0]=this.animationEngine.Evaluate(this.xIndex,e)),this.yIndex&&(this.yIndex===this.xIndex?this.value[1]=this.value[0]:this.value[1]=this.animationEngine.Evaluate(this.yIndex,e)),this.zIndex&&(this.zIndex===this.xIndex?this.value[2]=this.value[0]:this.value[2]=this.animationEngine.Evaluate(this.zIndex,e)))}},{key:"ComputeLength",value:function(){this.animationEngine&&0!==this.animationEngine.GetNumberOfCurves()&&(this.length=0,this.xIndex>=0&&(this.length=this.animationEngine.GetLength(this.xIndex)),this.yIndex>=0&&(this.length=Math.max(this.length,this.animationEngine.GetLength(this.yIndex))),this.zIndex>=0&&(this.length=Math.max(this.length,this.animationEngine.GetLength(this.zIndex))))}}])&&Xn(t.prototype,r),i&&Xn(t,i),o}(u);Jn($n,"outputDimension",3),Jn($n,"valueProperty","value"),Jn($n,"curveType",u.Type.CURVE_MAYA);var ei=r(1);function ti(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ri(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ni=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ri(this,"_id",n.F.generateID()),ri(this,"curves",[]),ri(this,"hermiteSegments",[]),ri(this,"bezierSegments",[]),ri(this,"_currentCurveIndex",0),ri(this,"_evalCache",null)}var t,r,i;return t=e,(r=[{key:"Evaluate",value:function(t,r){if(this.curves.length<=t)return 0;if(this._currentCurveIndex=t,!this._evalCache){this._evalCache=new Array(this.curves.length);for(var n=0;n<this._evalCache.length;++n)this._evalCache[n]=-1}var i=this.curves[t],a=i[e.AnimCurveFields.SEGMENT_OFFSET],o=null;return r<(o=i[e.AnimCurveFields.IS_WEIGHTED]?this.bezierSegments:this.hermiteSegments)[a][e.AnimSegment.TIME]?i[e.AnimCurveFields.PRE_INFINITY]===e.INFINITY?o[a][e.AnimSegment.VALUE]:this._EvaluateInfinities(i,o,a,r,!0):r>i[e.AnimCurveFields.END_TIME]?i[e.AnimCurveFields.POST_INFINITY]===e.INFINITY?i[e.AnimCurveFields.END_VALUE]:this._EvaluateInfinities(i,o,a,r,!1):this._EvaluateImpl(i,o,a,r)}},{key:"_EvaluateImpl",value:function(t,r,n,i){var a,o=!1,s=null,u=null;if(this._evalCache[this._currentCurveIndex]>=0)if(u=n+this._evalCache[this._currentCurveIndex],this._evalCache[this._currentCurveIndex]<t[e.AnimCurveFields.NUM_SEGMENTS-1]&&i>r[u][e.AnimSegment.TIME]){if(i===r[s=n+this._evalCache[this._currentCurveIndex]+1][e.AnimSegment.TIME])return this._evalCache[this._currentCurveIndex]++,r[s][e.AnimSegment.VALUE];i<r[s][e.AnimSegment.TIME]?(a=this._evalCache[this._currentCurveIndex]+1,o=!0):s=null}else if(this._evalCache[this._currentCurveIndex]>0&&i<r[u][e.AnimSegment.TIME]){var c=n+this._evalCache[this._currentCurveIndex]-1;if(i>r[c][e.AnimSegment.TIME])a=this._evalCache[this._currentCurveIndex],o=!0;else if(i===r[c][e.AnimSegment.TIME])return this._evalCache[this._currentCurveIndex]--,r[c][e.AnimSegment.VALUE]}if(!o){var l=this._Find(t,i,r,n);if(a=l[1],l[0]||0===a)return a===t[e.AnimCurveFields.NUM_SEGMENTS]?(a--,this._evalCache[this._currentCurveIndex]=a,t[e.AnimCurveFields.END_VALUE]):(this._evalCache[this._currentCurveIndex]=a,r[n+a][e.AnimSegment.VALUE]);if(a===t[e.AnimCurveFields.NUM_SEGMENTS]+1)return this._evalCache[this._currentCurveIndex]=0,t[e.AnimCurveFields.END_VALUE]}if(this._evalCache[this._currentCurveIndex]!==a-1&&(this._evalCache[this._currentCurveIndex]=a-1,u=n+this._evalCache[this._currentCurveIndex],null===s&&(s=n+a)),t[e.AnimCurveFields.IS_WEIGHTED]){var f=r[u];if(f[e.BezierSegment.IS_STEP])return f[e.BezierSegment.VALUE];if(f[e.BezierSegment.IS_STEP_NEXT])return null===s?t[e.AnimCurveFields.END_VALUE]:r[s][e.BezierSegment.VALUE];var h=t[e.AnimCurveFields.END_TIME];return this._evalCache[this._currentCurveIndex]+1<t[e.AnimCurveFields.NUM_SEGMENTS]&&(h=r[s][e.BezierSegment.TIME]),this._EvaluateBezier(f,i,h)}var d=r[u];return d[e.HermiteSegment.IS_STEP]?d[e.HermiteSegment.VALUE]:d[e.HermiteSegment.IS_STEP_NEXT]?null===s?t[e.AnimCurveFields.END_VALUE]:r[s][e.HermiteSegment.VALUE]:this._EvaluateHermite(d,i)}},{key:"_EvaluateInfinities",value:function(e,t,r,n,i){throw new ei.ErrFeatureNotImplemented({feature:"Maya animation engine evaluate infinities"})}},{key:"_EvaluateHermite",value:function(t,r){var n=r-t[e.HermiteSegment.TIME],i=t[e.HermiteSegment.COEFF];return n*(n*(n*i[0]+i[1])+i[2])+i[3]}},{key:"_EvaluateBezier",value:function(t,r,i){var a,o;if(o=(r-t[e.BezierSegment.TIME])/(i-t[e.BezierSegment.TIME]),t[e.BezierSegment.IS_LINEAR])a=o;else{var s=n.I.create();s[3]=t[e.BezierSegment.COEFF][3],s[2]=t[e.BezierSegment.COEFF][2],s[1]=t[e.BezierSegment.COEFF][1],s[0]=t[e.BezierSegment.COEFF][0]-o;var u=[];a=1===n.v.polyZeroes(s,3,0,1,1,1,u)?u[0]:0}var c=t[e.BezierSegment.POLYY];return a*(a*(a*c[3]+c[2])+c[1])+c[0]}},{key:"_Find",value:function(t,r,n,i){var a,o,s,u,c=0,l=0;if((a=t[e.AnimCurveFields.NUM_SEGMENTS]+1)>0){s=0,u=a-1;do{if(r<(l=(o=s+u>>1)<a-1?n[i+o][e.AnimSegment.TIME]:t[e.AnimCurveFields.END_TIME]))u=o-1;else{if(!(r>l))return[!0,c=o];s=o+1}}while(s<=u);c=s}return[!1,c]}},{key:"GetNumberOfCurves",value:function(){return this.curves.length}},{key:"GetLength",value:function(t){if(t<0||t>=this.curves.length)return 0;var r,n=this.curves[t];return r=n[e.AnimCurveFields.IS_WEIGHTED]?this.bezierSegments[n[e.AnimCurveFields.SEGMENT_OFFSET]]:this.hermiteSegments[n[e.AnimCurveFields.SEGMENT_OFFSET]],n[e.AnimCurveFields.END_TIME]-r[e.AnimSegment.TIME]}}])&&ti(t.prototype,r),i&&ti(t,i),e}();ri(ni,"AnimCurveFields",{NUM_SEGMENTS:0,SEGMENT_OFFSET:1,END_TIME:2,END_VALUE:3,IN_TANGENT:4,OUT_TANGENT:5,PRE_INFINITY:6,POST_INFINITY:7,IS_WEIGHTED:8}),ri(ni,"AnimSegment",{TIME:0,VALUE:1}),ri(ni,"HermiteSegment",{TIME:0,VALUE:1,COEFF:2,IS_STEP:3,IS_STEP_NEXT:4}),ri(ni,"BezierSegment",{TIME:0,VALUE:1,COEFF:2,POLYY:3,IS_STEP:4,IS_STEP_NEXT:5,IS_LINEAR:6}),ri(ni,"INFINITY",0)},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(9);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"_id",n.F.generateID()),o(this,"name",""),o(this,"effectFilePath",""),o(this,"effectRes",null),o(this,"parameters",{}),o(this,"techniques",[]),o(this,"samplerOverrides",[]),o(this,"autoParameter",!1),o(this,"options",{}),o(this,"shader",null)}var t,r,s;return t=e,s=[{key:"ToEffectResPath",value:function(e){return(e=e?e.substr(0,e.lastIndexOf(".")).replace("/effect/",n.w.effectDir)+".sm_"+n.w.shaderModel:"").toLowerCase()}},{key:"FromEffectResPath",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fx";return(e=e.substr(0,e.lastIndexOf(".")).replace(n.w.effectDir,"/effect/")+"."+t).toLowerCase()}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;if(n.F.assignIfExists(t,e,["name","effectFilePath","display","autoParameter"]),"parameters"in e&&t.SetParameters(e.parameters),"textures"in e&&t.SetTextures(e.textures),"overrides"in e&&t.SetOverrides(e.overrides),""===t.name&&""!==e.effectFilePath){var r=e.effectFilePath;t.name=r.substring(r.lastIndexOf("/")+1,r.length)}return!t.name&&t.effectFilePath&&(t.name=t.effectFilePath.substring(t.effectFilePath.lastIndexOf("/")+1,t.effectFilePath.lastIndexOf("."))),t.Initialize(),t}}],(r=[{key:"Initialize",value:function(){if(""!==this.effectFilePath){this.effectFilePath=this.effectFilePath.toLowerCase();var t=e.ToEffectResPath(this.effectFilePath);this.effectRes=n.D.GetResource(t),this.effectRes.RegisterNotification(this)}}},{key:"IsGood",value:function(){return this.KeepAlive(),null!==this.shader}},{key:"KeepAlive",value:function(){for(var e=this.GetResources(),t=0;t<e.length;t++)e[t].KeepAlive()}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];for(var t in this.effectRes&&!e.includes(this.effectRes)&&e.push(this.effectRes),this.parameters)this.parameters.hasOwnProperty(t)&&"GetResources"in this.parameters[t]&&this.parameters[t].GetResources(e);return e}},{key:"RebuildCachedData",value:function(e){this.shader=e.GetShader(this.options),this.BindParameters()}},{key:"UnBindParameters",value:function(){for(var e in this.techniques)if(this.techniques.hasOwnProperty(e))for(var t=this.techniques[e],r=0;r<t.length;++r)for(var n=0;n<t[r].stages.length;++n)for(var i=0;i<t[r].stages[n].reroutedParameters.length;++i)t[r].stages[n].reroutedParameters[i].Unbind();this.techniques={}}},{key:"BindParameters",value:function(){if(this.UnBindParameters(),!this.IsGood())return!1;for(var t in this.shader.techniques)if(this.shader.techniques.hasOwnProperty(t)){for(var r=this.shader.techniques[t],a=[],o=0;o<r.passes.length;++o){var s=[];s.stages=[];for(var u=0;u<r.passes[o].stages.length;++u){var c=r.passes[o].stages[u],l={};l.constantBuffer=new Float32Array(c.constantSize),l.reroutedParameters=[],l.parameters=[],l.textures=[],l.constantBuffer.set(c.constantValues);for(var f=0;f<c.constants.length;++f){var h=c.constants[f],d=h.name,p=h.Type;if(!e.ConstantIgnore.includes(d))if(d in this.parameters){var v=this.parameters[d];v.Bind(l.constantBuffer,h.offset,h.size)?l.reroutedParameters.push(v):l.parameters.push({parameter:v,constantBuffer:l.constantBuffer,offset:h.offset,size:h.size})}else if(n.E.HasVariable(d))l.parameters.push({parameter:n.E.GetVariable(d),constantBuffer:l.constantBuffer,offset:h.offset,size:h.size});else if(h.isAutoregister&&p){var y=n.E.RegisterVariable(d,void 0,p);y&&l.parameters.push({parameter:y,constantBuffer:l.constantBuffer,offset:h.offset,size:h.size})}else if(this.autoParameter&&1===h.elements){var m=l.constantBuffer.subarray(h.offset,h.offset+h.size);0===m.length?m=void 0:1===m.length&&(m=m[0]);var b=n.E.CreateType(d,m,p);b&&(this.parameters[d]=b,b.Bind(l.constantBuffer,h.offset,h.size)?l.reroutedParameters.push(b):l.parameter.push({parameter:b,constantBuffer:l.constantBuffer,offset:h.offset,size:h.size}))}}for(var g=0;g<c.textures.length;++g){var _=c.textures[g].name,R=null;if(_ in this.parameters)R=this.parameters[_];else if(n.E.HasVariable(_))R=n.E.GetVariable(_);else if(c.textures[g].isAutoregister)R=n.E.RegisterVariable(_,void 0,i.a);else{if(!this.autoParameter)continue;R=this.parameters[_]=new i.a(_)}for(var E={parameter:R,slot:c.textures[g].registerIndex,sampler:null},w=0;w<c.samplers.length;++w)if(c.samplers[w].registerIndex===E.slot){c.samplers[w].name in this.samplerOverrides?E.sampler=this.samplerOverrides[c.samplers[w].name].GetSampler(c.samplers[w]):E.sampler=c.samplers[w];break}0===u&&(E.slot+=12),l.textures.push(E)}s.stages.push(l)}a.push(s)}this.techniques[t]=a}return n.w.effectObserver&&n.w.effectObserver.OnEffectChanged(this),this.autoParameter=!1,!0}},{key:"ApplyPass",value:function(e,t){if(this.IsGood()&&e in this.techniques&&!(t>=this.techniques[e].length)){this.shader.ApplyPass(e,t);for(var r=this.techniques[e][t],i=this.shader.techniques[e].passes[t],a=n.w,o=a.gl,s=a.IsAlphaTestEnabled()&&i.shadowShaderProgram?i.shadowShaderProgram:i.shaderProgram,u=0;u<2;++u){for(var c=r.stages[u],l=0;l<c.parameters.length;++l){var f=c.parameters[l];f.parameter.Apply(f.constantBuffer,f.offset,f.size)}for(var h=0;h<c.textures.length;++h){var d=c.textures[h];d.parameter.Apply(d.slot,d.sampler,s.volumeSlices[d.sampler.registerIndex])}}var p=s.constantBufferHandles;p[0]&&o.uniform4fv(p[0],r.stages[0].constantBuffer),p[7]&&o.uniform4fv(p[7],r.stages[1].constantBuffer),a.perFrameVSData&&p[1]&&o.uniform4fv(p[1],a.perFrameVSData.data),a.perFramePSData&&p[2]&&o.uniform4fv(p[2],a.perFramePSData.data),a.perObjectData&&a.perObjectData.SetPerObjectDataToDevice(p)}}},{key:"GetPassCount",value:function(e){return null!==this.shader&&e in this.techniques?this.techniques[e].length:0}},{key:"GetPassInput",value:function(e,t){return null===this.shader||!(e in this.techniques)||t>=this.techniques[e].length?null:n.w.IsAlphaTestEnabled()&&this.shader.techniques[e].passes[t].shadowShaderProgram?this.shader.techniques[e].passes[t].shadowShaderProgram.input:this.shader.techniques[e].passes[t].shaderProgram.input}},{key:"Render",value:function(e){for(var t=this.GetPassCount("Main"),r=0;r<t;++r)this.ApplyPass("Main",r),e(this,r)}},{key:"GetTextures",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in this.parameters)if(this.parameters.hasOwnProperty(t)&&this.parameters[t]instanceof i.a){var r=this.parameters[t].GetValue();r&&(e[t]=r)}return e}},{key:"SetTextures",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r],a=this.parameters[r];i.a.isValue(n)&&(a?a.EqualsValue(n)||(a.SetTexturePath(n),t=!0):(this.parameters[r]=new i.a(r,n),t=!0))}return t}},{key:"GetParameters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in this.parameters)!this.parameters.hasOwnProperty(t)||this.parameters[t]instanceof i.a||(e[t]=this.parameters[t].GetValue(!0));return e}},{key:"SetParameters",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1;for(var r in e)if(e.hasOwnProperty(r)){var i=e[r],a=this.parameters[r];if(a)a.constructor.isValue(i)&&!a.EqualsValue(i)&&(this.parameters[r].SetValue(i),t=!0);else{var o=n.E.CreateType(r,i);o&&(this.parameters[r]=o,t=!0)}}return t}},{key:"SetOverrides",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1;for(var r in e)if(e.hasOwnProperty(r)){var n=this.parameters[r];if(n&&n instanceof i.a){var a=!1,o=e[r];for(var s in o)if(o.hasOwnProperty(s)&&i.a.overrideProperties.includes(s)&&o[s]!==n[s]){a=!0;break}a&&(n.SetOverrides(e[r]),t=!0)}}return t}},{key:"GetOverrides",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in this.parameters)if(this.parameters.hasOwnProperty(t)){var r=this.parameters[t];r&&r instanceof i.a&&r.useAllOverrides&&(e[t]=this.parameters[t].GetOverrides())}return e}},{key:"AutoParameter",value:function(){return this.autoParameter=!0,this.BindParameters()}}])&&a(t.prototype,r),s&&a(t,s),e}();o(s,"ConstantIgnore",["PerFrameVS","PerObjectVS","PerFramePS","PerObjectPS","PerObjectPSInt"])},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return c}));var n=r(0);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"name",""),a(this,"registerIndex",0),a(this,"minFilter",n.q),a(this,"maxFilter",n.q),a(this,"magFilter",n.q),a(this,"minFilterNoMips",n.q),a(this,"addressU",n.r),a(this,"addressV",n.r),a(this,"addressW",n.r),a(this,"anisotropy",1),a(this,"samplerType",n.s),a(this,"isVolume",!1),a(this,"hash",0)}var t,r,o;return t=e,(r=[{key:"ComputeHash",value:function(){this.hash=2166136261,this.hash*=16777619,this.hash^=this.minFilter,this.hash*=16777619,this.hash^=this.maxFilter,this.hash*=16777619,this.hash^=this.addressU,this.hash*=16777619,this.hash^=this.addressV,this.hash*=16777619,this.hash^=this.anisotropy}},{key:"Apply",value:function(e){var t=this.samplerType,r=n.w,i=r.gl;i.texParameteri(t,i.TEXTURE_WRAP_S,e?this.addressU:i.CLAMP_TO_EDGE),i.texParameteri(t,i.TEXTURE_WRAP_T,e?this.addressV:i.CLAMP_TO_EDGE),i.texParameteri(t,i.TEXTURE_MIN_FILTER,e?this.minFilter:this.minFilterNoMips),i.texParameteri(t,i.TEXTURE_MAG_FILTER,this.magFilter),r.ext.AnisotropicFilter&&r.enableAnisotropicFiltering&&i.texParameterf(t,r.ext.AnisotropicFilter.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(this.anisotropy,r.ext.AnisotropicFilter.maxAnisotropy))}},{key:"filterMode",get:function(){return this.minFilterNoMips in n.p?n.p[this.minFilterNoMips]:2}},{key:"mipFilterMode",get:function(){return this.minFilter in n.t?n.t[this.minFilter]:2}}])&&i(t.prototype,r),o&&i(t,o),e}();function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"name",""),u(this,"addressU",0),u(this,"addressV",0),u(this,"addressW",0),u(this,"filter",0),u(this,"mipFilter",0),u(this,"lodBias",0),u(this,"maxMipLevel",0),u(this,"maxAnisotropy",0),u(this,"_sampler",null)}var t,r,i;return t=e,(r=[{key:"GetSampler",value:function(e){if(this._sampler)return this._sampler;this._sampler=new o;var t=this._sampler;t.registerIndex=e.registerIndex,t.name=e.name;var r=n.w.wrapModes,i=n.w.gl;if(1===this.filter){switch(this.mipFilter){case 0:t.minFilter=i.NEAREST;break;case 1:t.minFilter=i.NEAREST_MIPMAP_NEAREST;break;default:t.minFilter=i.NEAREST_MIPMAP_LINEAR}t.minFilterNoMips=i.NEAREST,t.magFilter=i.NEAREST}else{switch(this.mipFilter){case 0:t.minFilter=i.LINEAR;break;case 1:t.minFilter=i.LINEAR_MIPMAP_NEAREST;break;default:t.minFilter=i.LINEAR_MIPMAP_LINEAR}t.minFilterNoMips=i.LINEAR,t.magFilter=i.LINEAR}return 3!==this.filter&&3!==this.mipFilter||(t.anisotropy=Math.max(this.maxAnisotropy,1)),t.addressU=r[this.addressU],t.addressV=r[this.addressV],t.addressW=r[this.addressW],t.samplerType=e.samplerType,t.isVolume=e.isVolume,t.ComputeHash(),t}}])&&s(t.prototype,r),i&&s(t,i),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return v}));var n=r(0),i=r(8),a=r(16);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=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(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(v,e);var t,r,i,f=l(v);function v(){var e;o(this,v);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return p(h(e=f.call(this,...r)),"path",""),p(h(e),"_redContents",null),p(h(e),"_inPrepare",null),p(h(e),"_objects",[]),p(h(e),"_constructor",null),e}return t=v,(r=[{key:"AddObject",value:function(e,t){this.HasErrors()?t&&t(this.GetErrors()[0]):this._objects.push({onResolved:e,onRejected:t})}},{key:"Prepare",value:function(e){for(null===this._inPrepare&&(this._redContents=e,this._constructor=new a.a(this._redContents),this._inPrepare=0,this._constructor.Construct());this._inPrepare<this._objects.length;){var t=this._objects[this._inPrepare];try{t.onResolved(this._constructor.Construct())}catch(e){t.onRejected&&(t.onRejected(e),t.onRejected=null),this.OnWarning({err:e,message:"Error preparing child object"})}this._inPrepare++}this.OnPrepared()}},{key:"OnError",value:function(e){u(d(v.prototype),"OnError",this).call(this,e);for(var t=0;t<this._objects.length;t++){var r=this._objects[t];r.onRejected&&r.onRejected(e)}return n.D.motherLode.Remove(this.path),this._objects=[],e}},{key:"OnPrepared",value:function(e){n.D.motherLode.Remove(this.path),this._objects=[],u(d(v.prototype),"OnPrepared",this).call(this,e)}}])&&s(t.prototype,r),i&&s(t,i),v}(i.a);v.prototype.requestResponseType="arraybuffer"},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(0),i=r(17),a=r(2);function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"xmlNode",null),s(this,"_inputStack",null),s(this,"_initializeObjects",null),s(this,"_ids",{}),s(this,"_reader",null),s(this,"_stringTable",null),s(this,"_start",null),t&&(this.xmlNode=t,t&&this.Initialize())}return function(e,t,r){t&&o(e.prototype,t),r&&o(e,r)}(e,[{key:"Initialize",value:function(){if(!e.IsValidXML(this.xmlNode))throw new a.z({message:"Invalid binary, expected binred"});this._reader=new i.a(new Uint8Array(this.xmlNode)),this._reader.cursor+=6,this._stringTable=[];for(var t=this._reader.ReadUInt32(),r=0;r<t;++r){var n=this._reader.ReadUInt16();this._stringTable.push(String.fromCharCode.apply(null,this._reader.data.subarray(this._reader.cursor,this._reader.cursor+n))),this._reader.cursor+=n}this._start=this._reader.cursor}},{key:"Construct",value:function(){return this._reader.cursor=this._start,e.ReadElement(this)}}],[{key:"IsValidXML",value:function(e){return e&&"binred"===String.fromCharCode.apply(null,new Uint8Array(e).subarray(0,6))}},{key:"ConstructObject",value:function(t){if("json"===t.type)return t;var r=n.E.GetClass(t.type);if(!r){if(!e.DEBUG_ENABLED)throw new a.A({type:t.type});r=Object}var i=new r;for(var o in t)if(t.hasOwnProperty(o)&&"type"!==o)if(t[o].constructor===Object){if(this.DEBUG_ENABLED&&(i[o]=i[o]||{}),i[o])for(var s in t[o])t[o].hasOwnProperty(s)&&(i[o][s]=t[o][s])}else i[o]=t[o];return"Initialize"in i&&i.Initialize(),i}},{key:"ReadUint",value:function(e,t){switch(48&t){case this.ElementSize.SMALL:return e._reader.ReadUInt8();case this.ElementSize.MEDIUM:return e._reader.ReadUInt16();default:return e._reader.ReadUInt32()}}},{key:"ReadElementData",value:function(e,t){var r,n,i,o,s;switch(15&t){case this.ElementRawType.NULL:return null;case this.ElementRawType.BOOL:switch(48&t){case this.ElementSize.SMALL:return 0!==e._reader.ReadUInt8();case this.ElementSize.MEDIUM:return!1;default:return!0}case this.ElementRawType.INT:switch(48&t){case this.ElementSize.SMALL:return e._reader.ReadInt8();case this.ElementSize.MEDIUM:return e._reader.ReadInt16();default:return e._reader.ReadInt32()}case this.ElementRawType.UINT:return this.ReadUint(e,t);case this.ElementRawType.FLOAT:switch(48&t){case this.ElementSize.SMALL:return e._reader.ReadFloat16();case this.ElementSize.MEDIUM:return e._reader.ReadFloat32();default:throw new a.c({feature:"Element raw type Float64"})}case this.ElementRawType.STRING:return r=this.ReadUint(e,t),e._stringTable[r];case this.ElementRawType.ARRAY:for(o=this.ReadUint(e,t),i=[],n=0;n<o;++n)i.push(this.ReadElement(e));return i;case this.ElementRawType.MAPPING:for(o=this.ReadUint(e,t),i={},n=0;n<o;++n)i[e._stringTable[this.ReadUint(e,t)]]=this.ReadElement(e);return i;case this.ElementRawType.OBJECT:for(o=this.ReadUint(e,t),i={},n=0;n<o;++n)i[e._stringTable[this.ReadUint(e,t)]]=this.ReadElement(e);return this.ConstructObject(i);case this.ElementRawType.TYPED_ARRAY:for(o=this.ReadUint(e,t),s=e._reader.ReadUInt8(),i=[],n=0;n<o;++n)i.push(this.ReadElementData(e,s));return s in this.TypedArrays&&(i=new this.TypedArrays[s](i)),i;case this.ElementRawType.TYPED_MAPPING:for(o=this.ReadUint(e,t),s=e._reader.ReadUInt8(),i={},n=0;n<o;++n)i[e._stringTable[this.ReadUint(e,t)]]=this.ReadElementData(e,s);return i}}},{key:"ReadElement",value:function(e){var t,r=e._reader.ReadUInt8();if(r===this.REFERENCE_BIT)return e._ids[e._reader.ReadUInt16()];0!=(r&this.ID_BIT)&&(t=e._reader.ReadUInt16());var n=this.ReadElementData(e,63&r);return 0!=(r&this.ID_BIT)&&(e._ids[t]=n),n}}]),e}();s(u,"DEBUG_ENABLED",!1),s(u,"ID_BIT",64),s(u,"REFERENCE_BIT",128),s(u,"ElementRawType",{NULL:0,BOOL:1,INT:2,UINT:3,FLOAT:4,STRING:5,ARRAY:6,MAPPING:7,OBJECT:8,TYPED_ARRAY:9,TYPED_MAPPING:10}),s(u,"ElementSize",{SMALL:0,MEDIUM:16,LARGE:32}),s(u,"TypedArrays",{2:Int8Array,3:Uint8Array,18:Int16Array,19:Uint16Array,34:Int32Array,35:Uint32Array,4:Float32Array,20:Float32Array,36:Float64Array});var c=u.ElementRawType,l=u.ElementSize;u.ElementTypes={NULL:c.NULL|l.SMALL,BOOL:c.BOOL|l.SMALL,FALSE:c.BOOL|l.MEDIUM,TRUE:c.BOOL|l.LARGE,INT8:c.INT|l.SMALL,UINT8:c.UINT|l.SMALL,INT16:c.INT|l.MEDIUM,UINT16:c.UINT|l.MEDIUM,INT32:c.INT|l.LARGE,UINT32:c.UINT|l.LARGE,FLOAT16:c.FLOAT|l.SMALL,FLOAT32:c.FLOAT|l.MEDIUM,FLOAT64:c.FLOAT|l.LARGE,SHORT_STRING:c.STRING|l.SMALL,MEDIUM_STRING:c.STRING|l.MEDIUM,LARGE_STRING:c.STRING|l.LARGE,SHORT_ARRAY:c.ARRAY|l.SMALL,MEDIUM_ARRAY:c.ARRAY|l.MEDIUM,LARGE_ARRAY:c.ARRAY|l.LARGE,SHORT_MAPPING:c.MAPPING|l.SMALL,MEDIUM_MAPPING:c.MAPPING|l.MEDIUM,LARGE_MAPPING:c.MAPPING|l.LARGE,SHORT_OBJECT:c.OBJECT|l.SMALL,MEDIUM_OBJECT:c.OBJECT|l.MEDIUM,LARGE_OBJECT:c.OBJECT|l.LARGE,SHORT_TYPED_ARRAY:c.TYPED_ARRAY|l.SMALL,MEDIUM_TYPED_ARRAY:c.TYPED_ARRAY|l.MEDIUM,LARGE_TYPED_ARRAY:c.TYPED_ARRAY|l.LARGE,SHORT_TYPED_MAPPING:c.TYPED_MAPPING|l.SMALL,MEDIUM_TYPED_MAPPING:c.TYPED_MAPPING|l.MEDIUM,LARGE_TYPED_MAPPING:c.TYPED_MAPPING|l.LARGE}},function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return a}));var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"data",null),i(this,"cursor",0),this.data=t}var t,r,a;return t=e,(r=[{key:"ReadUInt8",value:function(){return this.data[this.cursor++]}},{key:"ReadInt8",value:function(){var e=this.data[this.cursor++];return e>127&&(e=e-255-1),e}},{key:"ReadUInt16",value:function(){return this.data[this.cursor++]+(this.data[this.cursor++]<<8)}},{key:"ReadInt16",value:function(){var e=this.data[this.cursor++]+(this.data[this.cursor++]<<8);return e>32767&&(e=e-65535-1),e}},{key:"ReadUInt32",value:function(){return this.data[this.cursor++]+(this.data[this.cursor++]<<8)+(this.data[this.cursor++]<<16)+(this.data[this.cursor++]<<24>>>0)}},{key:"ReadInt32",value:function(){var e=this.data[this.cursor++]+(this.data[this.cursor++]<<8)+(this.data[this.cursor++]<<16)+(this.data[this.cursor++]<<24>>>0);return e>2147483647&&(e=e-4294967295-1),e}},{key:"ReadFloat16",value:function(){var e=this.data[this.cursor++],t=this.data[this.cursor++],r=(t>>2&31)-15,n=(3&t)<<8|e;return 0===n&&-15===r?0:(1-2*(t>>7))*(1+n*Math.pow(2,-10))*Math.pow(2,r)}},{key:"ReadFloat32",value:function(){var e=this.data[this.cursor++],t=this.data[this.cursor++],r=this.data[this.cursor++],n=this.data[this.cursor++],i=(n<<1&255|r>>7)-127,a=(127&r)<<16|t<<8|e;return 0===a&&-127===i?0:(1-2*(n>>7))*(1+a*Math.pow(2,-23))*Math.pow(2,i)}},{key:"ReadString",value:function(){for(var e=this.data[this.cursor++],t="",r=0;r<e;++r)t+=String.fromCharCode(this.data[this.cursor++]);return t}}])&&n(t.prototype,r),a&&n(t,a),e}()},function(e,t,r){"use strict";r.r(t);var n=r(24);r.d(t,"Tw2StaticEmitter",(function(){return n.c})),r.d(t,"Tw2DynamicEmitter",(function(){return n.a})),r.d(t,"Tw2GpuUniqueEmitter",(function(){return n.b}));var i=r(23);r.d(t,"Tw2ParticleAttractorForce",(function(){return i.a})),r.d(t,"Tw2ParticleDirectForce",(function(){return i.b})),r.d(t,"Tw2ParticleDragForce",(function(){return i.c})),r.d(t,"Tw2ParticleFluidDragForce",(function(){return i.d})),r.d(t,"Tw2ParticleSpring",(function(){return i.e})),r.d(t,"Tw2ParticleTurbulenceForce",(function(){return i.f}));var a=r(25);r.d(t,"Tw2RandomIntegerAttributeGenerator",(function(){return a.a})),r.d(t,"Tw2RandomUniformAttributeGenerator",(function(){return a.b})),r.d(t,"Tw2SphereShapeAttributeGenerator",(function(){return a.c}));var o=r(21);for(var s in o)["default","Tw2StaticEmitter","Tw2DynamicEmitter","Tw2GpuUniqueEmitter","Tw2ParticleAttractorForce","Tw2ParticleDirectForce","Tw2ParticleDragForce","Tw2ParticleFluidDragForce","Tw2ParticleSpring","Tw2ParticleTurbulenceForce","Tw2RandomIntegerAttributeGenerator","Tw2RandomUniformAttributeGenerator","Tw2SphereShapeAttributeGenerator"].indexOf(s)<0&&function(e){r.d(t,e,(function(){return o[e]}))}(s);var u=r(22);r.d(t,"Tw2ParticleSystem",(function(){return u.a}));var c=r(19);r.d(t,"Tw2ParticleElement",(function(){return c.a}));var l=r(5);r.d(t,"Tw2ParticleElementDeclaration",(function(){return l.a}))},function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return i}));var i=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n(this,"elementType",null),n(this,"customName",null),n(this,"dimension",null),n(this,"usageIndex",null),n(this,"usedByGPU",null),n(this,"buffer",null),n(this,"startOffset",0),n(this,"offset",0),n(this,"instanceStride",0),n(this,"vertexStride",0),n(this,"dirty",!1),t&&(this.elementType=t.elementType,this.customName=t.customName,this.dimension=t.GetDimension(),this.usageIndex=t.usageIndex,this.usedByGPU=t.usedByGPU)}},function(e,t,r){"use strict";r.r(t),r.d(t,"EveChild",(function(){return o})),r.d(t,"EveChildBillboard",(function(){return m})),r.d(t,"EveChildCloud",(function(){return O})),r.d(t,"EveChildContainer",(function(){return G})),r.d(t,"EveChildExplosion",(function(){return V})),r.d(t,"EveChildMesh",(function(){return Z})),r.d(t,"EveChildParticleSystem",(function(){return se})),r.d(t,"EveLensflare",(function(){return de})),r.d(t,"EveMeshOverlayEffect",(function(){return ye})),r.d(t,"EveOccluder",(function(){return le})),r.d(t,"EveStretch",(function(){return ge})),r.d(t,"EvePerMuzzleData",(function(){return Te})),r.d(t,"EveTurretFiringFX",(function(){return Se})),r.d(t,"EveStarfield",(function(){return Pe})),r.d(t,"EveObject",(function(){return De})),r.d(t,"EveEffectRoot",(function(){return We})),r.d(t,"EveMissileWarhead",(function(){return it})),r.d(t,"EveMissile",(function(){return at})),r.d(t,"EvePlanet",(function(){return wt})),r.d(t,"EveShip",(function(){return kt})),r.d(t,"EveSpaceObject",(function(){return Be})),r.d(t,"EveStation",(function(){return Be})),r.d(t,"EveTransform",(function(){return pt})),r.d(t,"EveObjectSetItem",(function(){return Lt})),r.d(t,"EveObjectSet",(function(){return Bt})),r.d(t,"EveBoosterBatch",(function(){return Qt})),r.d(t,"EveBoosterSetItem",(function(){return Zt})),r.d(t,"EveBoosterSet",(function(){return Jt})),r.d(t,"EveCurveLineSetItem",(function(){return cr})),r.d(t,"EveCurveLineSet",(function(){return lr})),r.d(t,"EveLocator",(function(){return dr})),r.d(t,"EvePlaneSetBatch",(function(){return Tr})),r.d(t,"EvePlaneSetItem",(function(){return Sr})),r.d(t,"EvePlaneSet",(function(){return Or})),r.d(t,"EveSpaceObjectDecal",(function(){return Ir})),r.d(t,"EveSpotlightSetBatch",(function(){return Ur})),r.d(t,"EveSpotlightSetItem",(function(){return Nr})),r.d(t,"EveSpotlightSet",(function(){return Vr})),r.d(t,"EveSpriteSetBatch",(function(){return $r})),r.d(t,"EveSpriteSetItem",(function(){return en})),r.d(t,"EveSpriteSet",(function(){return tn})),r.d(t,"EveTurretSetItem",(function(){return vn})),r.d(t,"EveTurretSet",(function(){return yn})),r.d(t,"EveSpaceScene",(function(){return gn})),r.d(t,"EveSOF",(function(){return _n}));var n=r(0);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"_id",n.F.generateID()),a(this,"name",""),a(this,"display",!0),a(this,"useSRT",!0),a(this,"lowestLodVisible",2),a(this,"staticTransform",!1),a(this,"rotation",n.C.create()),a(this,"translation",n.H.create()),a(this,"scaling",n.H.fromValues(1,1,1)),a(this,"localTransform",n.z.create()),a(this,"worldTransform",n.z.create()),a(this,"worldTransformLast",n.z.create()),a(this,"_perObjectData",null),a(this,"isEffectChild",!0)}var t,r,o;return t=e,(r=[{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e}},{key:"Update",value:function(e,t){this.useSRT&&(n.C.normalize(this.rotation,this.rotation),n.z.fromRotationTranslationScale(this.localTransform,this.rotation,this.translation,this.scaling)),n.z.copy(this.worldTransformLast,this.worldTransform),n.z.multiply(this.worldTransform,t,this.localTransform)}},{key:"GetBatches",value:function(e,t,r){}}])&&i(t.prototype,r),o&&i(t,o),e}();a(o,"global",{mat4_0:n.z.create(),vec3_0:n.H.create()}),a(o,"perObjectData",{FFEData:[["world",16],["worldInverseTranspose",16]]});var s=r(1);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=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(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d(this,r)}}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?p(e):t}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var m=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(d,e);var t,r,i,a=h(d);function d(){var e;u(this,d);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return y(p(e=a.call(this,...r)),"mesh",null),y(p(e),"_perObjectData",new s.Tw2BasicPerObjectData(o.perObjectData)),e}return t=d,(r=[{key:"GetResources",value:function(e){return this.mesh&&this.mesh.GetResources(e),e}},{key:"Update",value:function(e,t){l(v(d.prototype),"Update",this).call(this,e,t);var r=o.global.mat4_0,i=o.global.vec3_0;n.z.lookAt(r,n.w.eyePosition,this.worldTransform.subarray(12),[0,1,0]),n.z.transpose(r,r),n.z.getScaling(i,t),n.H.multiply(i,i,this.scaling),this.worldTransform[0]=r[0]*i[0],this.worldTransform[1]=r[1]*i[0],this.worldTransform[2]=r[2]*i[0],this.worldTransform[4]=r[4]*i[1],this.worldTransform[5]=r[5]*i[1],this.worldTransform[6]=r[6]*i[1],this.worldTransform[8]=r[8]*i[2],this.worldTransform[9]=r[9]*i[2],this.worldTransform[10]=r[10]*i[2]}},{key:"GetBatches",value:function(e,t){this.display&&this.mesh&&(n.z.transpose(this._perObjectData.perObjectFFEData.Get("world"),this.worldTransform),n.z.invert(this._perObjectData.perObjectFFEData.Get("worldInverseTranspose"),this.worldTransform),this.mesh.GetBatches(e,t,this._perObjectData))}}])&&c(t.prototype,r),i&&c(t,i),d}(o);function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=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(e){return!1}}();return function(){var r,n=E(e);if(t){var i=E(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return R(this,r)}}function R(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w,T,S,O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(r,e);var t=_(r);function r(){return b(this,r),t.apply(this,arguments)}return r}(o);function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function I(e,t,r){return(I="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=x(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e){var t=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(e){return!1}}();return function(){var r,n=x(e);if(t){var i=x(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return M(this,r)}}function M(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?k(e):t}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}S=!0,(T="partialImplementation")in(w=O)?Object.defineProperty(w,T,{value:S,enumerable:!0,configurable:!0,writable:!0}):w[T]=S;var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(a,e);var t,r,n,i=C(a);function a(){var e;P(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return j(k(e=i.call(this,...r)),"objects",[]),j(k(e),"curveSets",[]),e}return t=a,(r=[{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.objects.length;t++)"GetResources"in this.objects[t]&&this.objects[t].GetResources(e);return e}},{key:"Update",value:function(e,t){I(x(a.prototype),"Update",this).call(this,e,t);for(var r=0;r<this.curveSets.length;r++)this.curveSets[r].Update(e);for(var n=0;n<this.objects.length;n++)this.objects[n].Update(e,this.worldTransform)}},{key:"GetBatches",value:function(e,t,r){if(this.display)for(var n=0;n<this.objects.length;n++)this.objects[n].GetBatches(e,t,r)}}])&&A(t.prototype,r),n&&A(t,n),a}(o);function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t=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(e){return!1}}();return function(){var r,n=N(e);if(t){var i=N(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return U(this,r)}}function U(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var V=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(r,e);var t=B(r);function r(){return F(this,r),t.apply(this,arguments)}return r}(o);function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e){var t=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(e){return!1}}();return function(){var r,n=K(e);if(t){var i=K(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Y(this,r)}}function Y(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?W(e):t}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(V,"partialImplementation",!0);var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)}(u,e);var t,r,i,a=X(u);function u(){var e;H(this,u);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Q(W(e=a.call(this,...r)),"mesh",null),Q(W(e),"useSpaceObjectData",!0),e}return t=u,(r=[{key:"GetResources",value:function(e){return this.mesh&&this.mesh.GetResources(e),e}},{key:"GetBatches",value:function(e,t,r){this.display&&this.mesh&&(this.useSpaceObjectData?(this._perObjectData||(this._perObjectData=new s.Tw2PerObjectData,this._perObjectData.perObjectVSData=new s.Tw2RawData,this._perObjectData.perObjectVSData.data=new Float32Array(r.perObjectVSData.data.length),this._perObjectData.perObjectVSData.data[33]=1,this._perObjectData.perObjectVSData.data[35]=1,this._perObjectData.perObjectPSData=new s.Tw2RawData,this._perObjectData.perObjectPSData.data=new Float32Array(r.perObjectPSData.data.length),this._perObjectData.perObjectPSData.data[1]=1,this._perObjectData.perObjectPSData.data[3]=1),this._perObjectData.perObjectVSData.data.set(r.perObjectVSData.data),this._perObjectData.perObjectPSData.data.set(r.perObjectPSData.data),n.z.transpose(this._perObjectData.perObjectVSData.data,this.worldTransform),n.z.transpose(this._perObjectData.perObjectVSData.data.subarray(16),this.worldTransformLast)):(this._perObjectData||(this._perObjectData=new s.Tw2BasicPerObjectData(o.perObjectData)),n.z.transpose(this._perObjectData.perObjectFFEData.Get("world"),this.worldTransform),n.z.invert(this._perObjectData.perObjectFFEData.Get("worldInverseTranspose"),this.worldTransform)),this.mesh.GetBatches(e,t,this._perObjectData))}}])&&z(t.prototype,r),i&&z(t,i),u}(o);function J(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ee(e,t,r){return(ee="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=ae(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function te(e,t){return(te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function re(e){var t=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(e){return!1}}();return function(){var r,n=ae(e);if(t){var i=ae(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ne(this,r)}}function ne(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ie(e):t}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var se=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&te(e,t)}(u,e);var t,r,i,a=re(u);function u(){var e;J(this,u);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return oe(ie(e=a.call(this,...r)),"mesh",null),oe(ie(e),"particleEmitters",[]),oe(ie(e),"particleSystems",[]),oe(ie(e),"_perObjectData",new s.Tw2BasicPerObjectData(o.perObjectData)),e}return t=u,(r=[{key:"GetResources",value:function(e){return this.mesh&&this.mesh.GetResources(e),e}},{key:"Update",value:function(e,t){ee(ae(u.prototype),"Update",this).call(this,e,t);for(var r=0;r<this.particleEmitters.length;++r)this.particleEmitters[r].Update(e);for(var n=0;n<this.particleSystems.length;++n)this.particleSystems[n].Update(e)}},{key:"GetBatches",value:function(e,t){this.display&&this.mesh&&(n.z.transpose(this._perObjectData.perObjectFFEData.Get("world"),this.worldTransform),n.z.invert(this._perObjectData.perObjectFFEData.Get("worldInverseTranspose"),this.worldTransform),this.mesh.GetBatches(e,t,this._perObjectData))}}])&&$(t.prototype,r),i&&$(t,i),u}(o);function ue(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ce(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var le=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ce(this,"_id",n.F.generateID()),ce(this,"name",""),ce(this,"value",1),ce(this,"sprites",[]),e.init()}var t,r,i;return t=e,i=[{key:"CollectSamples",value:function(e,t,r,i){var a=n.w,o=this.global,s=o.effect,u=o.vertexBuffer,c=o.decl;if(!s.effectRes||!s.effectRes.IsGood())return!1;s.parameters.BackBuffer.textureRes=e,s.parameters.OccluderIndex.SetValue([t,r,i]),a.SetStandardStates(a.RM_ADDITIVE),a.gl.bindBuffer(a.gl.ARRAY_BUFFER,u);for(var l=0;l<s.GetPassCount("Main");++l){if(s.ApplyPass("Main",l),c.SetDeclaration(s.GetPassInput("Main",l),16))return!1;a.ApplyShadowState(),a.gl.drawArrays(a.gl.TRIANGLES,0,1530)}return!0}},{key:"init",value:function(){if(!e.global){var t=n.w,r=e.global={};r.mat4_0=n.z.create(),r.vec4_0=n.I.create(),r.accumulator=new s.Tw2BatchAccumulator,r.effect=s.Tw2Effect.create({name:"Occluder sampler",effectFilePath:"res:/graphics/effect/managed/space/specialfx/lensflares/collectsamples.fx",parameters:{OccluderPosition:[1,1,1,1],OccluderIndex:[1,1,1],BackBuffer:""}}),r.vertexBuffer=null,r.decl=new s.Tw2VertexDeclaration,r.decl.elements.push(new s.Tw2VertexElement(s.Tw2VertexDeclaration.Type.POSITION,0,t.gl.FLOAT,2,0)),r.decl.elements.push(new s.Tw2VertexElement(s.Tw2VertexDeclaration.Type.TEXCOORD,0,t.gl.FLOAT,2,8)),r.decl.RebuildHash();for(var i=new Float32Array(6120),a=0,o=0;o<16;++o)for(var u=0;u<16;++u){var c=(o+Math.random())/16*2-1,l=(u+Math.random())/16*2-1;i[a++]=1,i[a++]=1,i[a++]=c,i[a++]=l,i[a++]=-1,i[a++]=1,i[a++]=c,i[a++]=l,i[a++]=1,i[a++]=-1,i[a++]=c,i[a++]=l,i[a++]=-1,i[a++]=1,i[a++]=c,i[a++]=l,i[a++]=1,i[a++]=-1,i[a++]=c,i[a++]=l,i[a++]=-1,i[a++]=-1,i[a++]=c,i[a++]=l}r.vertexBuffer=t.gl.createBuffer(),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,r.vertexBuffer),t.gl.bufferData(t.gl.ARRAY_BUFFER,i,t.gl.STATIC_DRAW),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,null)}}}],(r=[{key:"UpdateValue",value:function(t,r){if(n.w.alphaBlendBackBuffer){var i=n.w,a=e.global,o=a.mat4_0,s=a.vec4_0;a.accumulator.Clear();for(var u=0;u<this.sprites.length;++u)this.sprites[u].UpdateViewDependentData(t),this.sprites[u].GetBatches(i.RM_DECAL,a.accumulator);n.E.SetVariableValue("OccluderValue",[(1<<2*r)/255,(2<<2*r)/255,0,0]),a.accumulator.Render(),n.z.multiply(o,i.viewProjection,this.sprites[0].worldTransform),n.I.transformMat4(s,[0,0,0,1],o);var c=.5*(s[0]/s[3]+1),l=.5*(s[1]/s[3]+1);n.I.set(s,.5,.5,0,1),n.I.transformMat4(s,s,o);var f=.5*(s[0]/s[3]+1),h=.5*(s[1]/s[3]+1);s[0]=c,s[1]=l,s[2]=f-c,s[3]=h-l,a.effect.parameters.OccluderPosition.SetValue(s)}}}])&&ue(t.prototype,r),i&&ue(t,i),e}();function fe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function he(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}ce(le,"global",null);var de=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),he(this,"_id",n.F.generateID()),he(this,"name",""),he(this,"display",!0),he(this,"update",!0),he(this,"doOcclusionQueries",!0),he(this,"cameraFactor",20),he(this,"position",n.H.create()),he(this,"flares",[]),he(this,"occluders",[]),he(this,"backgroundOccluders",[]),he(this,"occlusionIntensity",1),he(this,"backgroundOcclusionIntensity",1),he(this,"distanceToEdgeCurves",[]),he(this,"distanceToCenterCurves",[]),he(this,"radialAngleCurves",[]),he(this,"xDistanceToCenter",[]),he(this,"yDistanceToCenter",[]),he(this,"bindings",[]),he(this,"curveSets",[]),he(this,"mesh",null),he(this,"_direction",n.H.create()),he(this,"_transform",n.z.create()),he(this,"_backBuffer",null),e.init()}var t,r,i;return t=e,i=[{key:"init",value:function(){if(!e.global){var t=e.global={};t.vec3_0=n.H.create(),t.vec3_1=n.H.create(),t.vec3_2=n.H.create(),t.vec3_3=n.H.create(),t.vec4_0=n.I.create(),t.vec4_1=n.I.create(),t.mat4_0=n.z.create(),t.backBuffer=new s.Tw2TextureRes,t.backBuffer.width=0,t.backBuffer.height=0,t.backBuffer.hasMipMaps=!1,t.occludedLevelIndex=0,t.occluderLevels=[new s.Tw2RenderTarget,new s.Tw2RenderTarget,new s.Tw2RenderTarget,new s.Tw2RenderTarget]}}}],(r=[{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.mesh&&this.mesh.GetResources(e);for(var t=0;t<this.flares.length;t++)this.flares[t].GetResources(e);return le.global&&le.global.effect&&!e.includes(le.global.effect)&&e.push(le.global.effect),e}},{key:"UpdateOccluders",value:function(){if(this.doOcclusionQueries){var t=n.w,r=e.global;if(!r.occluderLevels[0].texture||r.occluderLevels[0].width<2*this.occluders.length)for(var i=0;i<r.occluderLevels.length;++i)r.occluderLevels[i].Create(2*this.occluders.length,1,!1);for(var a=0;a<this.flares.length;++a)"_backBuffer"in this.flares[a]&&(this.flares[a]._backBuffer.textureRes=r.occluderLevels.texture);this.occlusionIntensity=1,this.backgroundOcclusionIntensity=1,r.occluderLevels[r.occludedLevelIndex].Set(),t.SetStandardStates(t.RM_OPAQUE),t.gl.clearColor(0,0,0,1),t.gl.clear(t.gl.COLOR_BUFFER_BIT),r.occluderLevels[r.occludedLevelIndex].Unset();var o=1;t.antialiasing&&(o=t.msaaSamples,t.gl.sampleCoverage(1/o,!1));for(var s=0;s<this.occluders.length;++s)t.SetRenderState(t.RS_COLORWRITEENABLE,8),t.gl.colorMask(!1,!1,!1,!0),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT),t.antialiasing&&(t.gl.enable(t.gl.SAMPLE_COVERAGE),t.gl.sampleCoverage(.25,!1)),this.occluders[s].UpdateValue(this._transform,s),t.antialiasing&&t.gl.disable(t.gl.SAMPLE_COVERAGE),r.backBuffer.texture||r.backBuffer.Attach(t.gl.createTexture()),t.gl.bindTexture(t.gl.TEXTURE_2D,r.backBuffer.texture),r.backBuffer.width===t.viewportWidth&&r.backBuffer.height===t.viewportHeight||(t.gl.texImage2D(t.gl.TEXTURE_2D,0,t.gl.RGBA,t.viewportWidth,t.viewportHeight,0,t.gl.RGBA,t.gl.UNSIGNED_BYTE,null),t.gl.texParameteri(t.gl.TEXTURE_2D,t.gl.TEXTURE_MAG_FILTER,t.gl.LINEAR),t.gl.texParameteri(t.gl.TEXTURE_2D,t.gl.TEXTURE_MIN_FILTER,t.gl.LINEAR),r.backBuffer.width=t.viewportWidth,r.backBuffer.height=t.viewportHeight),t.gl.copyTexImage2D(t.gl.TEXTURE_2D,0,t.alphaBlendBackBuffer?t.gl.RGBA:t.gl.RGB,0,0,r.backBuffer.width,r.backBuffer.height,0),t.gl.bindTexture(t.gl.TEXTURE_2D,null),r.occluderLevels[r.occludedLevelIndex].Set(),le.CollectSamples(r.backBuffer,s,r.occluderLevels[0].width/2,o),r.occluderLevels[r.occludedLevelIndex].Unset();t.antialiasing&&t.gl.sampleCoverage(1,!1),r.occluderLevels[(r.occludedLevelIndex+1)%r.occluderLevels.length].Set();var u=new Uint8Array(4*r.occluderLevels[0].width);t.gl.readPixels(0,0,2,1,t.gl.RGBA,t.gl.UNSIGNED_BYTE,u),r.occluderLevels[(r.occludedLevelIndex+1)%r.occluderLevels.length].Unset(),this.occlusionIntensity=1;for(var c=0;c<2*r.occluderLevels[0].width;c+=4)this.occlusionIntensity*=u[c+1]?u[c]/u[c+1]:1;this.backgroundOcclusionIntensity=this.occlusionIntensity,n.E.SetVariableValue("LensflareFxOccScale",[this.occlusionIntensity,this.occlusionIntensity,0,0]),r.occludedLevelIndex=(r.occludedLevelIndex+1)%r.occluderLevels.length}}},{key:"GetBatches",value:function(t,r,i){if(this.display){var a=n.I.set(e.global.vec4_0,0,0,1,0);if(n.I.transformMat4(a,a,n.w.viewInverse),n.H.dot(a,this._direction)<0)return;for(var o=0;o<this.flares.length;++o)this.flares[o].GetBatches(t,r,i);this.mesh&&this.mesh.GetBatches(t,r,i)}}},{key:"PrepareRender",value:function(){if(this.display){var t=e.global,r=t.vec4_0,i=t.vec3_0,a=n.z.identity(t.mat4_0),o=t.vec3_2,s=t.vec3_3,u=t.vec3_1,c=t.vec4_1;n.H.transformMat4(i,[0,0,0],n.w.viewInverse),0===n.H.length(this.position)?n.H.negate(u,i):(n.H.negate(u,this.position),n.H.normalize(this._direction,u)),n.I.transformMat4(r,[0,0,1,0],n.w.viewInverse),n.H.scaleAndAdd(o,i,r,-this.cameraFactor),n.H.negate(s,this._direction),n.z.arcFromForward(this._transform,s),n.z.setTranslation(this._transform,o),n.z.scale(a,a,[this.occlusionIntensity,this.occlusionIntensity,1]);var l=this._direction;n.E.SetVariableValue("LensflareFxDirectionScale",[l[0],l[1],l[2],1]),n.I.set(c,l[0],l[1],l[2],0),n.I.transformMat4(c,c,n.w.view),n.I.transformMat4(c,c,n.w.projection),c[0]/=c[3],c[1]/=c[3];for(var f=1-Math.min(1-Math.abs(c[0]),1-Math.abs(c[1])),h=Math.sqrt(c[0]*c[0]+c[1]*c[1]),d=Math.atan2(c[1],c[0])+Math.PI,p=0;p<this.distanceToEdgeCurves.length;++p)this.distanceToEdgeCurves[p].UpdateValue(f);for(var v=0;v<this.distanceToCenterCurves.length;++v)this.distanceToCenterCurves[v].UpdateValue(h);for(var y=0;y<this.radialAngleCurves.length;++y)this.radialAngleCurves[y].UpdateValue(d);for(var m=0;m<this.xDistanceToCenter.length;++m)this.xDistanceToCenter[m].UpdateValue(c[0]+10);for(var b=0;b<this.yDistanceToCenter.length;++b)this.yDistanceToCenter[b].UpdateValue(c[1]+10);for(var g=0;g<this.bindings.length;++g)this.bindings[g].CopyValue();for(var _=0;_<this.flares.length;++_)this.flares[_].UpdateViewDependentData(this._transform)}}}])&&fe(t.prototype,r),i&&fe(t,i),e}();function pe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ve(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}he(de,"global",null);var ye=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ve(this,"_id",n.F.generateID()),ve(this,"name",""),ve(this,"display",!0),ve(this,"visible",{opaqueEffects:!0,decalEffects:!0,transparentEffects:!0,additiveEffects:!0,distortionEffects:!0}),ve(this,"update",!0),ve(this,"curveSet",null),ve(this,"opaqueEffects",[]),ve(this,"decalEffects",[]),ve(this,"transparentEffects",[]),ve(this,"additiveEffects",[]),ve(this,"distortionEffects",[])}var t,r,i;return t=e,(r=[{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return n.F.perArrayChild(this.opaqueEffects,"GetResources",e),n.F.perArrayChild(this.decalEffects,"GetResources",e),n.F.perArrayChild(this.transparentEffects,"GetResources",e),n.F.perArrayChild(this.additiveEffects,"GetResources",e),n.F.perArrayChild(this.distortionEffects,"GetResources",e),e}},{key:"Update",value:function(e){this.update&&this.curveSet&&this.curveSet.Update(e)}},{key:"GetBatches",value:function(e,t,r,n){if(this.display&&n&&n.IsGood())for(var i=this.GetEffects(e),a=0;a<i.length;a++){var o=new s.Tw2GeometryBatch;o.renderMode=e,o.perObjectData=r,o.geometryRes=n.geometryResource,o.meshIx=n.meshIndex,o.start=0,o.count=n.geometryResource.meshes[n.meshIndex].areas.length,o.effect=i[a],t.Commit(o)}}},{key:"GetEffects",value:function(e){if(this.display)switch(e){case n.w.RM_OPAQUE:if(this.visible.opaqueEffects)return this.opaqueEffects;break;case n.w.RM_TRANSPARENT:if(this.visible.transparentEffects)return this.transparentEffects;break;case n.w.RM_ADDITIVE:if(this.visible.additiveEffects)return this.additiveEffects;break;case n.w.RM_DECAL:if(this.visible.decalEffects)return this.decalEffects;break;case n.w.RM_DISTORTION:if(this.visible.distortionEffects)return this.distortionEffects}return[]}}])&&pe(t.prototype,r),i&&pe(t,i),e}();function me(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ge=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),be(this,"_id",n.F.generateID()),be(this,"name",""),be(this,"display",!0),be(this,"update",!0),be(this,"curveSets",[]),be(this,"source",null),be(this,"dest",null),be(this,"sourceObject",null),be(this,"destObject",null),be(this,"stretchObject",null),be(this,"length",new s.Tw2Float),be(this,"_time",0),be(this,"_useTransformsForStretch",!1),be(this,"_sourcePosition",n.H.create()),be(this,"_destinationPosition",n.H.create()),be(this,"_displaySourceObject",!0),be(this,"_sourceTransform",null),be(this,"_displayDestObject",!0),be(this,"_isNegZForward",!1),e.init()}var t,r,i;return t=e,i=[{key:"init",value:function(){e.global||(e.global={vec3_0:n.H.create(),vec3_1:n.H.create(),vec3_2:n.H.create(),mat4_0:n.z.create(),mat4_1:n.z.create()})}}],(r=[{key:"SetSourcePosition",value:function(e){this._useTransformsForStretch=!1,this._sourcePosition=e}},{key:"SetDestinationPosition",value:function(e){this._destinationPosition=e}},{key:"SetSourceTransform",value:function(e){this._useTransformsForStretch=!0,this._sourceTransform=e}},{key:"SetIsNegZForward",value:function(e){this._isNegZForward=e}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.source&&this.source.GetResources&&this.source.GetResources(e),this.dest&&this.dest.GetResources&&this.dest.GetResources(e),this.sourceObject&&this.sourceObject.GetResources&&this.sourceObject.GetResources(e),this.destObject&&this.destObject.GetResources&&this.destObject.GetResources(e),this.stretchObject&&this.stretchObject.GetResources&&this.stretchObject.GetResources(e),e}},{key:"UpdateViewDependentData",value:function(){if(this.display){var t=e.global,r=n.H.subtract(t.vec3_0,this._destinationPosition,this._sourcePosition),i=n.z.identity(t.mat4_0),a=n.H.set(t.vec3_1,0,0,0),o=n.H.set(t.vec3_2,0,0,0),s=n.z.identity(t.mat4_1),u=n.H.length(r);n.H.normalize(r,r),this._useTransformsForStretch?(n.z.rotateX(i,i,-Math.PI/2),n.z.multiply(i,this._sourceTransform,i)):(Math.abs(r[1])>.9?o[2]=1:o[1]=1,n.H.cross(a,o,r),n.H.normalize(a,a),n.H.cross(o,r,a),i[0]=a[0],i[1]=a[1],i[2]=a[2],i[4]=-r[0],i[5]=-r[1],i[6]=-r[2],i[8]=o[0],i[9]=o[1],i[10]=o[2]),this.destObject&&this._displayDestObject&&(n.z.setTranslation(i,this._destinationPosition),this.destObject.UpdateViewDependentData(i)),this.sourceObject&&this._displaySourceObject&&(this._useTransformsForStretch?(n.z.identity(i),n.z.rotateX(i,i,-Math.PI/2),n.z.multiply(i,this._sourceTransform,i)):n.z.setTranslation(i,this._sourcePosition),this.sourceObject.UpdateViewDependentData(i)),this.stretchObject&&(this._useTransformsForStretch?(n.z.identity(i),n.z.scale(i,i,[1,1,u]),n.z.multiply(i,this._sourceTransform,i)):(i[0]=a[0],i[1]=a[1],i[2]=a[2],i[4]=o[0],i[5]=o[1],i[6]=o[2],i[8]=-r[0],i[9]=-r[1],i[10]=-r[2],this._isNegZForward&&(u=-u),n.z.scale(s,s,[1,1,u]),n.z.multiply(i,i,s)),this.stretchObject.UpdateViewDependentData(i))}}},{key:"Update",value:function(t){for(var r=0;r<this.curveSets.length;++r)this.curveSets[r].Update(t);this._time+=t,this.source?this.source.GetValueAt(this._time,this._sourcePosition):this._useTransformsForStretch&&(this._sourcePosition[0]=this._sourceTransform[12],this._sourcePosition[1]=this._sourceTransform[13],this._sourcePosition[2]=this._sourceTransform[14]),this.dest&&this.source.GetValueAt(this._time,this._destinationPosition);var i=n.H.subtract(e.global.vec3_0,this._destinationPosition,this._sourcePosition);this.length.value=n.H.length(i),n.H.normalize(i,i),this.sourceObject&&this._displaySourceObject&&this.sourceObject.Update(t),this.stretchObject&&this.stretchObject.Update(t),this.destObject&&this._displayDestObject&&this.destObject.Update(t)}},{key:"GetBatches",value:function(e,t,r){this.display&&(this.sourceObject&&this._displaySourceObject&&this.sourceObject.GetBatches(e,t,r),this.destObject&&this._displayDestObject&&this.destObject.GetBatches(e,t,r),this.stretchObject&&this.stretchObject.GetBatches(e,t,r))}}])&&me(t.prototype,r),i&&me(t,i),e}();function _e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ee(e,t,r){return t&&Re(e.prototype,t),r&&Re(e,r),e}function we(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}be(ge,"global",null);var Te=function(){function e(){_e(this,e),we(this,"_id",n.F.generateID()),we(this,"started",!1),we(this,"readyToStart",!1),we(this,"muzzlePositionBone",null),we(this,"muzzleTransform",n.z.create()),we(this,"currentStartDelay",0),we(this,"constantDelay",0),we(this,"elapsedTime",0)}return Ee(e,[{key:"muzzlePosition",get:function(){return this.muzzleTransform.subarray(12,15)}}]),e}(),Se=function(){function e(){_e(this,e),we(this,"_id",n.F.generateID()),we(this,"name",""),we(this,"display",!0),we(this,"stretch",[]),we(this,"useMuzzleTransform",!1),we(this,"isFiring",!1),we(this,"isLoopFiring",!1),we(this,"firingDelay1",0),we(this,"firingDelay2",0),we(this,"firingDelay3",0),we(this,"firingDelay4",0),we(this,"firingDelay5",0),we(this,"firingDelay6",0),we(this,"firingDelay7",0),we(this,"firingDelay8",0),we(this,"endPosition",n.H.create()),we(this,"_firingDuration",0),we(this,"_perMuzzleData",[])}return Ee(e,[{key:"Initialize",value:function(){this._firingDuration=this.GetCurveDuration();for(var e=0;e<this.stretch.length;++e)this._perMuzzleData[e]=new Te;var t=this._perMuzzleData;t.length>0&&(t[0].constantDelay=this.firingDelay1),t.length>1&&(t[1].constantDelay=this.firingDelay2),t.length>2&&(t[2].constantDelay=this.firingDelay3),t.length>3&&(t[3].constantDelay=this.firingDelay4),t.length>4&&(t[4].constantDelay=this.firingDelay5),t.length>5&&(t[5].constantDelay=this.firingDelay6),t.length>6&&(t[6].constantDelay=this.firingDelay7),t.length>7&&(t[7].constantDelay=this.firingDelay8)}},{key:"GetCurveDuration",value:function(){for(var e=0,t=0;t<this.stretch.length;++t)for(var r=this.stretch[t],n=0;n<r.curveSets.length;++n)e=Math.max(e,r.curveSets[n].GetMaxCurveDuration());return e}},{key:"GetPerMuzzleEffectCount",value:function(){return this.stretch.length}},{key:"SetMuzzleBoneID",value:function(e,t){this._perMuzzleData[e].muzzlePositionBone=t}},{key:"GetMuzzleTransform",value:function(e){return this._perMuzzleData[e].muzzleTransform}},{key:"PrepareFiring",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=0;r<this.stretch.length;++r)t<0||t===r?(this._perMuzzleData[r].currentStartDelay=e+this._perMuzzleData[r].constantDelay,this._perMuzzleData[r].started=!1,this._perMuzzleData[r].readyToStart=!1,this._perMuzzleData[r].elapsedTime=0):(this._perMuzzleData[r].currentStartDelay=Number.MAX_VALUE,this._perMuzzleData[r].started=!1,this._perMuzzleData[r].readyToStart=!1,this._perMuzzleData[r].elapsedTime=0);this.isFiring=!0}},{key:"StartMuzzleEffect",value:function(e){for(var t=this.stretch[e],r=0;r<t.curveSets.length;++r){var n=t.curveSets[r];switch(n.name){case"play_start":case"play_loop":n.PlayFrom(-this._perMuzzleData[e].currentStartDelay);break;case"play_stop":n.Stop()}}this._perMuzzleData[e].started=!0,this._perMuzzleData[e].readyToStart=!1}},{key:"StopFiring",value:function(){for(var e=0;e<this.stretch.length;++e){for(var t=this.stretch[e],r=0;r<t.curveSets.length;++r){var n=t.curveSets[r];switch(n.name){case"play_start":case"play_loop":n.Stop();break;case"play_stop":n.Play()}}this._perMuzzleData[e].started=!1,this._perMuzzleData[e].readyToStart=!1,this._perMuzzleData[e].currentStartDelay=0,this._perMuzzleData[e].elapsedTime=0}this.isFiring=!1}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.stretch.length;t++)this.stretch[t].GetResources(e);return e}},{key:"UpdateViewDependentData",value:function(){for(var e=0;e<this.stretch.length;++e)this.stretch[e].UpdateViewDependentData()}},{key:"Update",value:function(e){for(var t=0;t<this.stretch.length;++t)this._perMuzzleData[t].started&&(this._perMuzzleData[t].elapsedTime+=e),(this._perMuzzleData[t].elapsedTime<this._firingDuration||this.isLoopFiring)&&this.isFiring&&(this._perMuzzleData[t].started?(this.useMuzzleTransform?this.stretch[t].SetSourceTransform(this._perMuzzleData[t].muzzleTransform):this.stretch[t].SetSourcePosition(this._perMuzzleData[t].muzzlePosition),this.stretch[t].SetDestinationPosition(this.endPosition),this.stretch[t].SetIsNegZForward(!0)):(this._perMuzzleData[t].readyToStart?(this.StartMuzzleEffect(t),this._perMuzzleData[t].currentStartDelay=0,this._perMuzzleData[t].elapsedTime=0):this._perMuzzleData[t].currentStartDelay-=e,this._perMuzzleData[t].currentStartDelay<=0&&(this._perMuzzleData[t].readyToStart=!0))),this.stretch[t].Update(e)}},{key:"GetBatches",value:function(e,t,r){if(this.display&&this.isFiring)for(var n=0;n<this.stretch.length;++n)this._perMuzzleData[n].started&&(this._firingDuration>=this._perMuzzleData[n].elapsedTime||this.isLoopFiring)&&this.stretch[n].GetBatches(e,t,r)}}]),e}();function Oe(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Pe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Oe(this,"_id",n.F.generateID()),Oe(this,"name",""),Oe(this,"display",!0),Oe(this,"effect",null),Oe(this,"maxDist",0),Oe(this,"maxFlashRate",0),Oe(this,"minFlashIntensity",0),Oe(this,"minFlashRate",0),Oe(this,"seed",20)};function Ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ie(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Oe(Pe,"partialImplementation",!0);var De=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ie(this,"_id",n.F.generateID()),Ie(this,"name",""),Ie(this,"display",!0)}var t,r,i;return t=e,(r=[{key:"Initialize",value:function(){}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e}},{key:"Update",value:function(e){}},{key:"GetBatches",value:function(e,t){}}])&&Ae(t.prototype,r),i&&Ae(t,i),e}();function Ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Me(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ke(e,t){return(ke=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function xe(e){var t=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(e){return!1}}();return function(){var r,n=Fe(e);if(t){var i=Fe(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return je(this,r)}}function je(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Ge(e):t}function Ge(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Fe(e){return(Fe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Le(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ie(De,"global",{vec3_0:n.H.create(),vec3_1:n.H.create(),vec3_2:n.H.create(),vec3_3:n.H.create(),vec3_4:n.H.create(),vec3_5:n.H.create(),vec3_6:n.H.create(),vec3_7:n.H.create(),mat4_0:n.z.create(),mat4_1:n.z.create(),mat4_2:n.z.create()});var Be=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ke(e,t)}(o,e);var t,r,i,a=xe(o);function o(){var e;Ce(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Le(Ge(e=a.call(this,...r)),"visible",{mesh:!0,children:!0,effectChildren:!0,planeSets:!0,spotlightSets:!0,decals:!0,spriteSets:!0,overlayEffects:!0,lineSets:!0,killmarks:!0,customMasks:!0,turretSets:!0,boosters:!0}),Le(Ge(e),"mesh",null),Le(Ge(e),"animation",new s.Tw2AnimationController),Le(Ge(e),"locators",[]),Le(Ge(e),"spriteSets",[]),Le(Ge(e),"turretSets",[]),Le(Ge(e),"decals",[]),Le(Ge(e),"spotlightSets",[]),Le(Ge(e),"planeSets",[]),Le(Ge(e),"curveSets",[]),Le(Ge(e),"lineSets",[]),Le(Ge(e),"overlayEffects",[]),Le(Ge(e),"children",[]),Le(Ge(e),"effectChildren",[]),Le(Ge(e),"customMasks",[]),Le(Ge(e),"lod",3),Le(Ge(e),"killCount",0),Le(Ge(e),"transform",n.z.create()),Le(Ge(e),"boundingSphereCenter",n.H.create()),Le(Ge(e),"boundingSphereRadius",0),Le(Ge(e),"shapeEllipsoidRadius",n.H.create()),Le(Ge(e),"shapeEllipsoidCenter",n.H.create()),Le(Ge(e),"_perObjectData",new s.Tw2PerObjectData(o.perObjectData)),e}return t=o,(r=[{key:"Initialize",value:function(){if(this.mesh){this.animation.SetGeometryResource(this.mesh.geometryResource);for(var e=0;e<this.decals.length;++e)this.decals[e].SetParentGeometry(this.mesh.geometryResource)}}},{key:"ResetLod",value:function(){this.lod=3}},{key:"UpdateLod",value:function(e){var t=n.H.transformMat4(o.global.vec3_0,this.boundingSphereCenter,this.transform);e.IsSphereVisible(t,this.boundingSphereRadius)?e.GetPixelSizeAcross(t,this.boundingSphereRadius)<100?this.lod=1:this.lod=2:this.lod=0}},{key:"AddCustomMask",value:function(e,t,r,i,a,o){var s=n.z.fromRotationTranslationScale(n.z.create(),r,e,t);n.z.invert(s,s),n.z.transpose(s,s),this.customMasks.push({transform:s,maskData:n.I.fromValues(1,i?1:0,0,0),materialID:n.I.fromValues(a,0,0,0),targets:o})}},{key:"GetLocatorCount",value:function(e){return this.FindLocatorsByPrefix(e).length}},{key:"FindLocatorJointByName",value:function(e){var t=this.FindLocatorBoneByName(e);return t?t.worldTransform:null}},{key:"FindLocatorTransformByName",value:function(e){var t=this.FindLocatorByName(e);return t?t.transform:null}},{key:"HasLocatorPrefix",value:function(e){for(var t=0;t<this.locators.length;t++)if(this.locators[t].name.substring(0,e.length)===e)return!0;return!1}},{key:"FindLocatorBoneByName",value:function(e){var t=this.animation.FindModelForMesh(0);if(t)for(var r=0;r<t.bones.length;++r)if(t.bones[r].boneRes.name===e)return t.bones[r];return null}},{key:"FindLocatorByName",value:function(e){for(var t=0;t<this.locators.length;t++)if(this.locators[t].name===e)return this.locators[t];return null}},{key:"FindLocatorsByPrefix",value:function(e){for(var t=[],r=0;r<this.locators.length;r++)0===this.locators[r].name.indexOf(e)&&t.push(this.locators[r]);return t}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;return this.mesh&&this.mesh.GetResources(e),this.animation&&this.animation.GetResources(e),n.F.perArrayChild(this.spriteSets,"GetResources",e),n.F.perArrayChild(this.turretSets,"GetResources",e),n.F.perArrayChild(this.decals,"GetResources",e),n.F.perArrayChild(this.spotlightSets,"GetResources",e),n.F.perArrayChild(this.planeSets,"GetResources",e),n.F.perArrayChild(this.lineSets,"GetResources",e),n.F.perArrayChild(this.overlayEffects,"GetResources",e),n.F.perArrayChild(this.effectChildren,"GetResources",e),t||n.F.perArrayChild(this.children,"GetResources",e),e}},{key:"UpdateViewDependentData",value:function(){for(var e=0;e<this.children.length;++e)this.children[e].UpdateViewDependentData(this.transform);n.z.transpose(this._perObjectData.perObjectVSData.Get("WorldMat"),this.transform),n.z.transpose(this._perObjectData.perObjectVSData.Get("WorldMatLast"),this.transform);var t=this._perObjectData.perObjectVSData.Get("EllipsoidCenter"),r=this._perObjectData.perObjectVSData.Get("EllipsoidRadii");this.shapeEllipsoidRadius[0]>0?(t[0]=this.shapeEllipsoidCenter[0],t[1]=this.shapeEllipsoidCenter[1],t[2]=this.shapeEllipsoidCenter[2],r[0]=this.shapeEllipsoidRadius[0],r[1]=this.shapeEllipsoidRadius[1],r[2]=this.shapeEllipsoidRadius[2]):this.mesh&&this.mesh.IsGood()&&(n.H.subtract(t,this.mesh.geometryResource.maxBounds,this.mesh.geometryResource.minBounds),n.H.scale(t,t,.8660254035),n.H.add(r,this.mesh.geometryResource.maxBounds,this.mesh.geometryResource.minBounds),n.H.scale(r,r,.5));for(var i=0;i<this.customMasks.length;++i){var a=this.visible.customMasks?this.customMasks[i].targets:[0,0,0,0];this._perObjectData.perObjectVSData.Set(i?"CustomMaskMatrix1":"CustomMaskMatrix0",this.customMasks[i].transform),this._perObjectData.perObjectVSData.Set(i?"CustomMaskData1":"CustomMaskData0",this.customMasks[i].maskData),this._perObjectData.perObjectPSData.Set(i?"CustomMaskMaterialID1":"CustomMaskMaterialID0",this.customMasks[i].materialID),this._perObjectData.perObjectPSData.Set(i?"CustomMaskTarget1":"CustomMaskTarget0",a)}this.animation.animations.length&&this._perObjectData.perObjectVSData.Set("JointMat",this.animation.GetBoneMatrices(0));for(var o=0;o<this.lineSets.length;++o)this.lineSets[o].UpdateViewDependentData(this.transform)}},{key:"Update",value:function(e){if(this.lod>0){for(var t=0;t<this.spriteSets.length;++t)this.spriteSets[t].Update(e);for(var r=0;r<this.planeSets.length;r++)this.planeSets[r].Update(e);for(var n=0;n<this.spotlightSets.length;n++)this.spotlightSets[n].Update(e);for(var i=0;i<this.children.length;++i)this.children[i].Update(e);for(var a=0;a<this.effectChildren.length;++a)this.effectChildren[a].Update(e,this.transform);for(var o=0;o<this.curveSets.length;++o)this.curveSets[o].Update(e);for(var s=0;s<this.overlayEffects.length;++s)this.overlayEffects[s].Update(e);for(var u=0;u<this.lineSets.length;u++)this.lineSets[u].Update(e);this.animation.Update(e)}}},{key:"GetBatches",value:function(e,t){if(this.display){var r=this.visible;if(r.mesh&&this.mesh&&this.lod>0&&this.mesh.GetBatches(e,t,this._perObjectData),this.lod>1){if(r.spriteSets)for(var n=0;n<this.spriteSets.length;n++)this.spriteSets[n].GetBatches(e,t,this._perObjectData,this.transform);if(r.spotlightSets)for(var i=0;i<this.spotlightSets.length;i++)this.spotlightSets[i].GetBatches(e,t,this._perObjectData);if(r.planeSets)for(var a=0;a<this.planeSets.length;a++)this.planeSets[a].GetBatches(e,t,this._perObjectData);if(r.decals)for(var o=0;o<this.decals.length;o++)this.decals[o].GetBatches(e,t,this._perObjectData,r.killmarks?this.killCount:0);if(r.lineSets)for(var s=0;s<this.lineSets.length;s++)this.lineSets[s].GetBatches(e,t)}if(r.children)for(var u=0;u<this.children.length;u++)this.children[u].GetBatches(e,t,this._perObjectData);if(r.effectChildren)for(var c=0;c<this.effectChildren.length;c++)this.effectChildren[c].GetBatches(e,t,this._perObjectData);if(r.overlayEffects&&this.mesh&&this.mesh.IsGood())for(var l=0;l<this.overlayEffects.length;l++)this.overlayEffects[l].GetBatches(e,t,this._perObjectData,this.mesh)}}},{key:"RenderDebugInfo",value:function(e){this.animation.RenderDebugInfo(e)}}])&&Me(t.prototype,r),i&&Me(t,i),o}(De);function Ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ne(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ve(e,t){return(Ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function He(e){var t=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(e){return!1}}();return function(){var r,n=Xe(e);if(t){var i=Xe(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ze(this,r)}}function ze(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?qe(e):t}function qe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xe(e){return(Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ye(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Le(Be,"perObjectData",{VSData:[["WorldMat",16],["WorldMatLast",16],["Shipdata",4,[0,1,0,-10]],["Clipdata1",4],["EllipsoidRadii",4],["EllipsoidCenter",4],["CustomMaskMatrix0",16,n.z.identity([])],["CustomMaskMatrix1",16,n.z.identity([])],["CustomMaskData0",4],["CustomMaskData1",4],["JointMat",696]],PSData:[["Shipdata",4,[0,1,0,1]],["Clipdata1",4],["Clipdata2",4],["ShLighting",28],["CustomMaskMaterialID0",4],["CustomMaskMaterialID1",4],["CustomMaskTarget0",4],["CustomMaskTarget1",4]]});var We=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ve(e,t)}(o,e);var t,r,i,a=He(o);function o(){var e;Ue(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Ye(qe(e=a.call(this,...r)),"curveSets",[]),Ye(qe(e),"effectChildren",[]),Ye(qe(e),"duration",0),Ye(qe(e),"scaling",n.H.fromValues(1,1,1)),Ye(qe(e),"rotation",n.C.create()),Ye(qe(e),"translation",n.H.create()),Ye(qe(e),"localTransform",n.z.create()),Ye(qe(e),"rotationTransform",n.z.create()),Ye(qe(e),"boundingSphereCenter",n.H.create()),Ye(qe(e),"boundingSphereRadius",0),Ye(qe(e),"_perObjectData",new s.Tw2PerObjectData(Be.perObjectData)),e}return t=o,(r=[{key:"Start",value:function(){for(var e=0;e<this.curveSets.length;++e)this.curveSets[e].Play()}},{key:"Stop",value:function(){for(var e=0;e<this.curveSets.length;++e)this.curveSets[e].Stop()}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.effectChildren.length;++t)this.effectChildren[t].GetResources(e);return e}},{key:"Update",value:function(e){n.C.normalize(this.rotation,this.rotation),n.z.fromRotationTranslationScale(this.localTransform,this.rotation,this.translation,this.scaling);for(var t=0;t<this.curveSets.length;++t)this.curveSets[t].Update(e);for(var r=0;r<this.effectChildren.length;++r)this.effectChildren[r].Update(e,this.localTransform)}},{key:"GetBatches",value:function(e,t){if(this.display)for(var r=0;r<this.effectChildren.length;++r)this.effectChildren[r].GetBatches(e,t,this._perObjectData)}}])&&Ne(t.prototype,r),i&&Ne(t,i),o}(De);function Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Qe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ze(e,t,r){return t&&Qe(e.prototype,t),r&&Qe(e,r),e}function Je(e,t){return(Je=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $e(e){var t=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(e){return!1}}();return function(){var r,n=rt(e);if(t){var i=rt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return et(this,r)}}function et(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?tt(e):t}function tt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rt(e){return(rt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var it=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Je(e,t)}(r,e);var t=$e(r);function r(){var e;Ke(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return nt(tt(e=t.call(this,...a)),"mesh",null),nt(tt(e),"spriteSet",null),nt(tt(e),"state",r.State.READY),nt(tt(e),"time",0),nt(tt(e),"durationEjectPhase",0),nt(tt(e),"startEjectVelocity",0),nt(tt(e),"acceleration",1),nt(tt(e),"maxExplosionDistance",40),nt(tt(e),"impactSize",0),nt(tt(e),"impactDuration",.6),nt(tt(e),"pathOffset",n.H.create()),nt(tt(e),"transform",n.z.create()),nt(tt(e),"velocity",n.H.create()),nt(tt(e),"_perObjectData",new s.Tw2PerObjectData(r.perObjectData)),e}return Ze(r,[{key:"Initialize",value:function(){this.spriteSet&&this.spriteSet.UseQuads(!0)}},{key:"Launch",value:function(e){n.z.copy(this.transform,e),this.velocity[0]=e[8]*this.startEjectVelocity,this.velocity[1]=e[9]*this.startEjectVelocity,this.velocity[2]=e[10]*this.startEjectVelocity,this.time=0,this.state=r.State.IN_FLIGHT}},{key:"Clone",value:function(){var e=new r;return e.mesh=this.mesh,e.spriteSet=this.spriteSet,e}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.mesh&&this.mesh.GetResources(e),this.spriteSet&&this.spriteSet.GetResources(e)}},{key:"UpdateViewDependentData",value:function(){this.display&&this.state!==r.State.DEAD&&(n.z.transpose(this._perObjectData.perObjectVSData.Get("WorldMat"),this.transform),n.z.transpose(this._perObjectData.perObjectVSData.Get("WorldMatLast"),this.transform))}},{key:"Update",value:function(e,t,i){if(this.state===r.State.IN_FLIGHT){var a=r.global,o=n.z.getTranslation(a.vec3_0,this.transform),s=a.vec3_1,u=a.vec3_2,c=a.vec3_3;this.time+=e,this.time>this.durationEjectPhase?(n.H.subtract(o,this.velocity,t),n.H.lerp(o,o,t,1-Math.exp(.9999*-e)),n.z.setTranslation(this.transform,o),n.H.subtract(s,i,o),n.H.length(s)<this.maxExplosionDistance&&(console.log(o,s),this.state=r.State.DEAD)):(n.H.scale(s,this.velocity,e),this.transform[12]+=s[0],this.transform[13]+=s[1],this.transform[14]+=s[2]);var l=n.H.normalize(s,this.velocity);Math.abs(l[0])<.99?n.H.cross(u,l,[1,0,0]):n.H.cross(u,l,[0,1,0]),n.H.normalize(u,u),n.H.cross(c,u,l),this.transform[0]=u[0],this.transform[1]=u[1],this.transform[2]=u[2],this.transform[4]=c[0],this.transform[5]=c[1],this.transform[6]=c[2],this.transform[8]=l[0],this.transform[9]=l[1],this.transform[10]=l[2]}this.spriteSet&&this.spriteSet.Update(e)}},{key:"GetBatches",value:function(e,t){this.display&&this.mesh&&this.state!==r.State.DEAD&&(this.mesh&&this.mesh.GetBatches(e,t,this._perObjectData),this.spriteSet&&this.spriteSet.GetBatches(e,t,this._perObjectData,this.transform))}}]),r}(De);nt(it,"perObjectData",{VSData:[["WorldMat",16],["WorldMatLast",16],["Shipdata",4,[0,1,0,-10]],["Clipdata1",4],["JointMat",696]],PSData:[["Shipdata",4,[0,1,0,1]],["Clipdata1",4],["Clipdata2",4]]}),nt(it,"State",{READY:0,IN_FLIGHT:1,DEAD:2});var at=function(){function e(){Ke(this,e),nt(this,"_id",n.F.generateID()),nt(this,"name",""),nt(this,"display",!0),nt(this,"warheads",[]),nt(this,"curveSets",[]),nt(this,"speed",1),nt(this,"position",n.H.create()),nt(this,"target",n.H.create()),nt(this,"boundingSphereCenter",n.H.create()),nt(this,"boundingSphereRadius",0),nt(this,"warheadExplosionCallback",null),nt(this,"missileFinishedCallback",null)}return Ze(e,[{key:"Launch",value:function(e,t,r){if(n.H.copy(this.position,e),n.H.copy(this.target,r),this.warheads.length>t.length)this.warheads.splice(t.length);else for(;this.warheads.length<t.length;)this.warheads.push(this.warheads[0].Clone());for(var i=0;i<this.warheads.length;++i)this.warheads[0].Launch(t[i])}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=0;t<this.warheads.length;++t)this.warheads[t].GetResources(e)}},{key:"UpdateViewDependentData",value:function(){for(var e=0;e<this.warheads.length;++e)this.warheads[e].UpdateViewDependentData()}},{key:"Update",value:function(e){var t=n.H.subtract(it.global.vec3_0,this.target,this.position),r=n.H.length(t);r>.1&&(n.H.normalize(t,t),n.H.scale(t,t,Math.min(e*this.speed,r)),n.H.add(this.position,this.position,t));for(var i=0;i<this.curveSets.length;++i)this.curveSets[i].Update(e);for(var a=!1,o=0;o<this.warheads.length;++o){var s=this.warheads[o].state;this.warheads[o].Update(e,this.position,this.target),s!==it.State.DEAD&&this.warheads[o].state===it.State.DEAD&&(this.warheadExplosionCallback&&this.warheadExplosionCallback(this.warheads[o]),a=!0)}if(a&&this.missileFinishedCallback){for(var u=0;u<this.warheads.length;++u)if(this.warheads[u].state!==it.State.DEAD)return;this.missileFinishedCallback(this)}}},{key:"GetBatches",value:function(e,t){if(this.display)for(var r=0;r<this.warheads.length;++r)this.warheads[r].GetBatches(e,t)}}]),e}();function ot(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function st(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ut(e,t){return(ut=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ct(e){var t=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(e){return!1}}();return function(){var r,n=ht(e);if(t){var i=ht(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return lt(this,r)}}function lt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ft(e):t}function ft(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ht(e){return(ht=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function dt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var pt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ut(e,t)}(o,e);var t,r,i,a=ct(o);function o(){var e;ot(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return dt(ft(e=a.call(this,...r)),"visible",{mesh:!0,children:!0}),dt(ft(e),"mesh",null),dt(ft(e),"curveSets",[]),dt(ft(e),"children",[]),dt(ft(e),"particleSystems",[]),dt(ft(e),"particleEmitters",[]),dt(ft(e),"modifier",o.Modifier.NONE),dt(ft(e),"sortValueMultiplier",1),dt(ft(e),"distanceBasedScaleArg1",.2),dt(ft(e),"distanceBasedScaleArg2",.63),dt(ft(e),"useDistanceBasedScale",!1),dt(ft(e),"scaling",n.H.fromValues(1,1,1)),dt(ft(e),"translation",n.H.create()),dt(ft(e),"rotation",n.C.create()),dt(ft(e),"localTransform",n.z.create()),dt(ft(e),"worldTransform",n.z.create()),dt(ft(e),"_perObjectData",new s.Tw2BasicPerObjectData(o.perObjectData)),e}return t=o,i=[{key:"Multiply3x3",value:function(e,t,r){r||(r=t);var n=t[0],i=t[1];return t=t[2],r[0]=e[0]*n+e[4]*i+e[8]*t,r[1]=e[1]*n+e[5]*i+e[9]*t,r[2]=e[2]*n+e[6]*i+e[10]*t,r}}],(r=[{key:"Initialize",value:function(){n.z.fromRotationTranslationScale(this.localTransform,this.rotation,this.translation,this.scaling)}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(this.mesh&&this.mesh.GetResources(e),!t)for(var r=0;r<this.children;r++)this.children[r].GetResources(e);return e}},{key:"UpdateViewDependentData",value:function(e){var t=n.w,r=o.global,i=r.vec3_0,a=r.vec3_1,s=r.vec3_2,u=t.viewInverse;switch(n.C.normalize(this.rotation,this.rotation),n.z.fromRotationTranslationScale(this.localTransform,this.rotation,this.translation,this.scaling),n.z.getScaling(a,e),this.modifier){case o.Modifier.BILLBOARD:case o.Modifier.SIMPLE_HALO:var c=r.vec3_3;if(n.z.multiply(this.worldTransform,e,this.localTransform),n.H.multiply(i,this.scaling,a),this.modifier===o.Modifier.SIMPLE_HALO){n.H.subtract(s,t.GetEyePosition(s),this.worldTransform.subarray(12)),n.H.normalize(c,this.worldTransform.subarray(8)),n.H.normalize(s,s);var l=n.H.dot(s,c);l<0&&(l=0),n.H.scale(i,i,l*l)}this.worldTransform[0]=u[0]*i[0],this.worldTransform[1]=u[1]*i[0],this.worldTransform[2]=u[2]*i[0],this.worldTransform[4]=u[4]*i[1],this.worldTransform[5]=u[5]*i[1],this.worldTransform[6]=u[6]*i[1],this.worldTransform[8]=u[8]*i[2],this.worldTransform[9]=u[9]*i[2],this.worldTransform[10]=u[10]*i[2];break;case o.Modifier.EVE_CAMERA_ROTATION:var f=r.vec3_3;n.H.transformMat4(f,this.translation,e),n.z.fromRotationTranslationScale(this.localTransform,this.rotation,f,this.scaling),n.z.multiply(this.worldTransform,u,this.localTransform),this.worldTransform[12]=this.localTransform[12],this.worldTransform[13]=this.localTransform[13],this.worldTransform[14]=this.localTransform[14];break;case o.Modifier.EVE_CAMERA_ROTATION_ALIGNED:case o.Modifier.EVE_SIMPLE_HALO:var h=r.vec3_3,d=r.vec3_4,p=r.vec3_5,v=r.vec3_6,y=r.vec3_7,m=r.mat4_0,b=r.mat4_1,g=r.mat4_2;if(n.z.translate(this.worldTransform,e,this.translation),n.z.transpose(m,e),t.GetEyePosition(s),s[0]-=this.worldTransform[12],s[1]-=this.worldTransform[13],s[2]-=this.worldTransform[14],n.H.copy(h,s),n.H.transformMat4(h,h,m),n.H.divide(h,h,a),n.H.normalize(h,h),n.H.set(d,t.view[0],t.view[4],t.view[8]),n.H.transformMat4(d,d,m),n.H.normalize(d,d),n.H.cross(p,h,d),n.H.normalize(p,p),n.H.cross(d,p,h),b[0]=d[0],b[1]=d[1],b[2]=d[2],b[4]=p[0],b[5]=p[1],b[6]=p[2],b[8]=h[0],b[9]=h[1],b[10]=h[2],b[15]=1,n.z.fromQuat(g,this.rotation),n.z.multiply(b,b,g),this.modifier===o.Modifier.EVE_SIMPLE_HALO){n.H.normalize(v,this.worldTransform.subarray(8)),n.H.normalize(y,s);var _=-n.H.dot(y,v);_<0&&(_=0),n.z.multiply(this.worldTransform,this.worldTransform,b),n.z.scale(this.worldTransform,this.worldTransform,[this.scaling[0]*_,this.scaling[1]*_,this.scaling[2]*_])}else n.z.scale(this.worldTransform,this.worldTransform,this.scaling),n.z.multiply(this.worldTransform,this.worldTransform,b);break;case o.Modifier.LOOK_AT_CAMERA:var R=r.mat4_0;n.z.multiply(this.worldTransform,e,this.localTransform),n.z.lookAt(R,u.subarray(12),this.worldTransform.subarray(12),[0,1,0]),n.z.transpose(R,R),n.H.multiply(i,this.scaling,a),this.worldTransform[0]=R[0]*i[0],this.worldTransform[1]=R[1]*i[0],this.worldTransform[2]=R[2]*i[0],this.worldTransform[4]=R[4]*i[1],this.worldTransform[5]=R[5]*i[1],this.worldTransform[6]=R[6]*i[1],this.worldTransform[8]=R[8]*i[2],this.worldTransform[9]=R[9]*i[2],this.worldTransform[10]=R[10]*i[2];break;default:n.z.multiply(this.worldTransform,e,this.localTransform)}for(var E=0;E<this.children.length;++E)this.children[E].UpdateViewDependentData(this.worldTransform)}},{key:"Update",value:function(e){for(var t=0;t<this.children.length;++t)this.children[t].Update(e);for(var r=0;r<this.particleEmitters.length;++r)this.particleEmitters[r].Update(e);for(var n=0;n<this.particleSystems.length;++n)this.particleSystems[n].Update(e);for(var i=0;i<this.curveSets.length;++i)this.curveSets[i].Update(e)}},{key:"GetBatches",value:function(e,t,r){if(this.display&&(this.visible.mesh&&this.mesh&&(n.z.transpose(this._perObjectData.perObjectFFEData.Get("World"),this.worldTransform),n.z.invert(this._perObjectData.perObjectFFEData.Get("WorldInverseTranspose"),this.worldTransform),r&&(this._perObjectData.perObjectVSData=r.perObjectVSData,this._perObjectData.perObjectPSData=r.perObjectPSData),this.mesh.GetBatches(e,t,this._perObjectData)),this.visible.children))for(var i=0;i<this.children.length;++i)this.children[i].GetBatches(e,t,r)}}])&&st(t.prototype,r),i&&st(t,i),o}(De);function vt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function mt(e,t){return(mt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function bt(e){var t=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(e){return!1}}();return function(){var r,n=Rt(e);if(t){var i=Rt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return gt(this,r)}}function gt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_t(e):t}function _t(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rt(e){return(Rt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Et(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}dt(pt,"perObjectData",{FFEData:[["World",16],["WorldInverseTranspose",16]]}),dt(pt,"Modifier",{NONE:0,BILLBOARD:1,TRANSLATE_WITH_CAMERA:2,LOOK_AT_CAMERA:3,SIMPLE_HALO:4,EVE_CAMERA_ROTATION_ALIGNED:100,EVE_BOOSTER:101,EVE_SIMPLE_HALO:102,EVE_CAMERA_ROTATION:103});var wt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&mt(e,t)}(o,e);var t,r,i,a=bt(o);function o(){var e;vt(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Et(_t(e=a.call(this,...r)),"highDetail",new pt),Et(_t(e),"effectHeight",new s.Tw2Effect),Et(_t(e),"heightMap",new s.Tw2RenderTarget),Et(_t(e),"zOnlyModel",null),Et(_t(e),"itemID",0),Et(_t(e),"heightMapResPath1",""),Et(_t(e),"heightMapResPath2",""),Et(_t(e),"heightDirty",!1),Et(_t(e),"lockedResources",[]),Et(_t(e),"watchedResources",[]),e}return t=o,i=[{key:"MeshLoaded",value:function(e,t){e.highDetail.children.unshift(t),e.lockedResources=[],e.GetPlanetResources(e.highDetail,[],e.lockedResources);var r,n=e.highDetail.children[0].mesh,i=null;for(var a in r=(r=n.transparentAreas.length?(i=n.transparentAreas[0].effect).effectFilePath:n.opaqueAreas.length?(i=n.opaqueAreas[0].effect).effectFilePath:"res:/Graphics/Effect/Managed/Space/Planet/EarthlikePlanet.fx").replace(".fx","BlitHeight.fx"),e.watchedResources=[],i.parameters)i.parameters.hasOwnProperty(a)&&(e.effectHeight.parameters[a]=i.parameters[a],"textureRes"in i.parameters[a]&&e.watchedResources.push(i.parameters[a].textureRes));for(var o=0;o<e.highDetail.children[0].children.length;++o)if(n=e.highDetail.children[0].children[o].mesh){if(i=null,n.transparentAreas.length)i=n.transparentAreas[0].effect;else{if(!n.opaqueAreas.length)continue;i=n.opaqueAreas[0].effect}for(var u in i.parameters)i.parameters.hasOwnProperty(u)&&(e.effectHeight.parameters[u]=i.parameters[u],"textureRes"in i.parameters[u]&&e.watchedResources.push(i.parameters[u].textureRes))}var c=new s.Tw2TextureParameter("NormalHeight1",e.heightMapResPath1);c.Initialize(),e.watchedResources.push(c.textureRes),e.lockedResources.push(c.textureRes),e.effectHeight.parameters.NormalHeight1=c;var l=new s.Tw2TextureParameter("NormalHeight2",e.heightMapResPath2);l.Initialize(),e.watchedResources.push(l.textureRes),e.lockedResources.push(l.textureRes),e.effectHeight.parameters.NormalHeight2=l,e.effectHeight.parameters.Random=new s.Tw2FloatParameter("Random",e.itemID%100),e.effectHeight.parameters.TargetTextureHeight=new s.Tw2FloatParameter("TargetTextureHeight",1024),e.effectHeight.effectFilePath=r,e.effectHeight.Initialize(),e.heightDirty=!0,e.heightMap.Create(2048,1024,!1),e.watchedResources.push(e.effectHeight.effectRes);for(var f=0;f<e.lockedResources.length;++f)e.lockedResources[f].doNotPurge++,e.lockedResources[f].IsPurged()&&e.lockedResources[f].Reload()}}],(r=[{key:"Create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=e.itemID,i=void 0===r?0:r,a=e.planetPath,s=e.atmospherePath,u=e.heightMap1,c=e.heightMap2;this.itemID=i,this.heightMapResPath1=u,this.heightMapResPath2=c,this.highDetail.children=[],this.heightDirty=!0;var l=1;function f(){--l<1&&t&&t()}a&&l++,s&&l++,a&&n.D.GetObject(a,e=>{o.MeshLoaded(this,e),f()}),s&&n.D.GetObject(s,e=>{this.highDetail.children.push(e),f()}),n.D.GetObject("res:/dx9/model/worldobject/planet/planetzonly.red",e=>{this.zOnlyModel=e,f()})}},{key:"GetPlanetResources",value:function(e,t,r){if(!t.includes(e))if(t.push(e),!e||n.F.isUndefined(e.doNotPurge))for(var i in e)e.hasOwnProperty(i)&&n.F.isObjectLike(e[i])&&this.GetPlanetResources(e[i],t,r);else r.push(e)}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.highDetail&&this.highDetail.GetResources(e),this.effectHeight&&this.effectHeight.GetResources(e),e}},{key:"UpdateViewDependentData",value:function(e){this.highDetail.UpdateViewDependentData(e),this.zOnlyModel&&(this.zOnlyModel.translation=this.highDetail.translation,this.zOnlyModel.scaling=this.highDetail.scaling,this.zOnlyModel.UpdateViewDependentData(e))}},{key:"Update",value:function(e){this.highDetail.Update(e)}},{key:"GetBatches",value:function(e,t){if(this.display&&this.heightDirty&&this.watchedResources.length&&""!==this.heightMapResPath1){for(var r=0;r<this.watchedResources.length;++r)if(this.watchedResources[r]&&!this.watchedResources[r].IsGood())return;this.watchedResources=[],this.heightMap.Set(),n.w.SetStandardStates(n.w.RM_FULLSCREEN),n.w.gl.clearColor(0,0,0,0),n.w.gl.clear(n.w.gl.COLOR_BUFFER_BIT),n.w.RenderFullScreenQuad(this.effectHeight),this.heightMap.Unset(),this.heightDirty=!1;for(var i=0;i<this.lockedResources.length;++i)this.lockedResources[i].doNotPurge--;var a=this.highDetail.children[0].mesh,o=null;a.transparentAreas.length?o=a.transparentAreas[0].effect:a.opaqueAreas.length&&(o=a.opaqueAreas[0].effect),o&&(o.parameters.HeightMap.textureRes=this.heightMap.texture)}this.display&&this.highDetail.GetBatches(e,t)}},{key:"GetZOnlyBatches",value:function(e,t){this.display&&this.zOnlyModel&&this.zOnlyModel.GetBatches(e,t)}}])&&yt(t.prototype,r),i&&yt(t,i),o}(De);function Tt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function St(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ot(e,t,r){return(Ot="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ct(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function Pt(e,t){return(Pt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(e){var t=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(e){return!1}}();return function(){var r,n=Ct(e);if(t){var i=Ct(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return It(this,r)}}function It(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Dt(e):t}function Dt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ct(e){return(Ct=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Mt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var kt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pt(e,t)}(a,e);var t,r,n,i=At(a);function a(){var e;Tt(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Mt(Dt(e=i.call(this,...r)),"boosters",null),Mt(Dt(e),"turretSets",[]),Mt(Dt(e),"boosterGain",1),e}return t=a,(r=[{key:"Initialize",value:function(){Ot(Ct(a.prototype),"Initialize",this).call(this),this.boosters&&this.RebuildBoosterSet()}},{key:"RebuildBoosterSet",value:function(){this.boosters&&this.boosters.UpdateItemsFromLocators(this.FindLocatorsByPrefix("locator_booster"))}},{key:"RebuildTurretPositions",value:function(){for(var e=0;e<this.turretSets.length;e++)this.RebuildTurretSet(e)}},{key:"RebuildTurretSet",value:function(e){if(void 0!==this.turretSets[e]){for(var t=this.turretSets[e],r=t.locatorName,n=this.GetLocatorCount(r),i=[],a=0;a<n;++a){var o=r+String.fromCharCode("a".charCodeAt(0)+a),s=this.FindLocatorByName(o);s&&(s.FindBone(this.animation),i.push(s))}t.UpdateItemsFromLocators(i)}}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;Ot(Ct(a.prototype),"GetResources",this).call(this,e,t);for(var r=0;r<this.turretSets.length;r++)this.turretSets[r].GetResources(e);return this.boosters&&this.boosters.GetResources(e),e}},{key:"UpdateViewDependentData",value:function(){Ot(Ct(a.prototype),"UpdateViewDependentData",this).call(this);for(var e=0;e<this.turretSets.length;++e)this.turretSets[e].UpdateViewDependentData()}},{key:"Update",value:function(e){Ot(Ct(a.prototype),"Update",this).call(this,e),this.boosters&&(this.boosters._locatorRebuildPending&&this.RebuildBoosterSet(),this.boosters.Update(e,this.transform));for(var t=0;t<this.turretSets.length;++t)this.turretSets[t]._locatorRebuildPending&&this.RebuildTurretSet(t),this.turretSets[t].Update(e,this.transform)}},{key:"GetBatches",value:function(e,t){if(this.display&&(Ot(Ct(a.prototype),"GetBatches",this).call(this,e,t),this._perObjectData.perObjectVSData.Get("Shipdata")[0]=this.boosterGain,this._perObjectData.perObjectPSData.Get("Shipdata")[0]=this.boosterGain,this.boosters&&this.visible.boosters&&this.boosters.GetBatches(e,t,this._perObjectData),this.visible.turretSets))if(this.lod>1)for(var r=0;r<this.turretSets.length;++r)this.turretSets[r].GetBatches(e,t,this._perObjectData,this.visible.firingEffects);else if(this.visible.firingEffects)for(var n=0;n<this.turretSets.length;++n)this.turretSets[n].firingEffect&&this.turretSets[n].firingEffect.GetBatches(e,t,this._perObjectData)}}])&&St(t.prototype,r),n&&St(t,n),a}(Be);function xt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Gt(e,t,r){return t&&jt(e.prototype,t),r&&jt(e,r),e}function Ft(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Lt=function(){function e(){xt(this,e),Ft(this,"_id",n.F.generateID()),Ft(this,"name",""),Ft(this,"display",!0),Ft(this,"_rebuildPending",!0),Ft(this,"_onModified",null)}return Gt(e,[{key:"OnValueChanged",value:function(){this._rebuildPending=!0,this._onModified&&this._onModified(this)}}]),e}(),Bt=function(){function e(){xt(this,e),Ft(this,"_id",n.F.generateID()),Ft(this,"name",""),Ft(this,"display",!0),Ft(this,"items",[]),Ft(this,"_visibleItems",[]),Ft(this,"_rebuildPending",!1),Ft(this,"_onChildModified",e=>this.OnValueChanged(e))}return Gt(e,[{key:"Initialize",value:function(){this.Rebuild()}},{key:"OnValueChanged",value:function(){this._rebuildPending=!0}},{key:"CreateItem",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.constructor.Item;if(t&&"create"in t){var r=t.create(e);return this.AddItem(r),r}return null}},{key:"AddItem",value:function(e){this.items.includes(e)||(e._onModified=this._onChildModified,this.items.push(e),this.OnValueChanged())}},{key:"RemoveItem",value:function(e){var t=this.items.indexOf(e);-1!==t&&(e._onModified=null,this.items.splice(t,1),this.OnValueChanged())}},{key:"ClearItems",value:function(){for(var e=0;e<this.items.length;e++)this.items[e]._onModified=null;this.items=[],this.OnValueChanged()}},{key:"FindItemByID",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null!==e)for(var t=0;t<this.items.length;t++)if(this.items[t]._id===e)return this.items[t];return null}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e}},{key:"Update",value:function(e){this._rebuildPending&&this.Rebuild()}},{key:"Unload",value:function(){}},{key:"Rebuild",value:function(){this.constructor.RebuildItems(this),this._rebuildPending=!1}},{key:"GetBatches",value:function(e,t,r){}},{key:"Render",value:function(){}}],[{key:"RebuildItems",value:function(e){e._visibleItems=[];for(var t=0;t<e.items.length;t++){var r=e.items[t];r._onModified=e._onChildModified,r._rebuildPending=!1,r.display&&e._visibleItems.push(r)}}}]),e}();function Ut(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Vt(e,t,r){return t&&Nt(e.prototype,t),r&&Nt(e,r),e}function Ht(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zt(e,t)}function zt(e,t){return(zt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qt(e){var t=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(e){return!1}}();return function(){var r,n=Wt(e);if(t){var i=Wt(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Xt(this,r)}}function Xt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Yt(e):t}function Yt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wt(e){return(Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Kt(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ft(Bt,"Item",null),Ft(Bt,"global",{vec3_0:n.H.create(),vec3_1:n.H.create(),vec3_2:n.H.create(),vec4_0:n.I.create(),vec4_1:n.I.create(),mat4_0:n.z.create()});var Qt=function(e){Ht(r,e);var t=qt(r);function r(){var e;Ut(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return Kt(Yt(e=t.call(this,...i)),"boosters",null),e}return Vt(r,[{key:"Commit",value:function(e){this.boosters.Render(e)}}]),r}(s.Tw2RenderBatch),Zt=function(e){Ht(r,e);var t=qt(r);function r(){var e;Ut(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Kt(Yt(e=t.call(this,...a)),"visible",{glow:!0,symHalo:!0,halo:!0,trail:!0,customValues:!0}),Kt(Yt(e),"locatorName",null),Kt(Yt(e),"updateFromLocator",!1),Kt(Yt(e),"seed",7*Math.random()),Kt(Yt(e),"wavePhase",Math.random()),Kt(Yt(e),"atlas0",0),Kt(Yt(e),"atlas1",0),Kt(Yt(e),"transform",n.z.create()),Kt(Yt(e),"customValues",null),e}return Vt(r,[{key:"GetPosition",value:function(e){return n.z.getTranslation(e,this.transform)}},{key:"GetDirection",value:function(e){n.H.set(e,this.transform[8],this.transform[9],this.transform[10]),n.H.normalize(e,e);var t=this.GetScale();return t<3&&n.H.scale(e,e,t/3),e}},{key:"GetScale",value:function(){var e=this.transform;return Math.max(n.H.length([e[0],e[1],e[2]]),n.H.length([e[4],e[5],e[6]]))}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return n.F.assignIfExists(t.visible,e.visible,["glow","symHalo","halo","trail"]),n.F.assignIfExists(t,e,["name","display","seed","wavePhase","transform","locatorName","updateFromLocator","atlas0","atlas1"]),t}}]),r}(Lt),Jt=function(e){Ht(r,e);var t=qt(r);function r(){var e;Ut(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Kt(Yt(e=t.call(this,...a)),"visible",{glows:!0,symHalos:!0,halos:!0,trails:!0}),Kt(Yt(e),"effect",null),Kt(Yt(e),"glows",null),Kt(Yt(e),"alwaysOn",!0),Kt(Yt(e),"maxVel",250),Kt(Yt(e),"glowDistance",2.5),Kt(Yt(e),"glowScale",1),Kt(Yt(e),"glowColor",n.I.create()),Kt(Yt(e),"warpGlowColor",n.I.create()),Kt(Yt(e),"haloDistance",3.01),Kt(Yt(e),"haloScaleX",1),Kt(Yt(e),"haloScaleY",1),Kt(Yt(e),"haloColor",n.I.create()),Kt(Yt(e),"warpHaloColor",n.I.create()),Kt(Yt(e),"symHaloDistance",3),Kt(Yt(e),"symHaloScale",1),Kt(Yt(e),"trailColor",n.I.create()),Kt(Yt(e),"trailSize",n.I.create()),Kt(Yt(e),"_parentTransform",n.z.create()),Kt(Yt(e),"_positions",null),Kt(Yt(e),"_decl",new s.Tw2VertexDeclaration(r.vertexDeclarations)),Kt(Yt(e),"_perObjectData",new s.Tw2PerObjectData(r.perObjectData)),Kt(Yt(e),"_locatorRebuildPending",!0),e}return Vt(r,[{key:"FindItemByLocatorName",value:function(e){for(var t=0;t<this.items.length;t++)if(this.items[t].locatorName&&this.items[t].locatorName===e)return this.items[t];return null}},{key:"UpdateItemsFromLocators",value:function(e){for(var t=Array.from(this.items),r=0;r<e.length;r++){var i=e[r],a=i.name,o=i.transform,s=i.atlasIndex0,u=i.atlasIndex1,c=this.FindItemByLocatorName(a);c?(t.splice(t.indexOf(c),1),c.updateFromLocator&&(n.z.copy(c.transform,o),c.atlas0=s,c.atlas1=u,c.OnValueChanged())):this.CreateItem({name:a,locatorName:a,updateFromLocator:!0,atlas0:s,atlas1:u,transform:o})}for(var l=0;l<t.length;l++)null!==t[l].locatorName&&(this.RemoveItem(t[l]),l--);this._locatorRebuildPending=!1,this._rebuildPending&&this.Rebuild()}},{key:"RebuildItemsFromLocators",value:function(){this._locatorRebuildPending=!0}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.effect&&this.effect.GetResources(e),this.glows&&this.glows.effect.GetResources(e),e}},{key:"Update",value:function(e,t){n.z.copy(this._parentTransform,t),this._rebuildPending&&this.Rebuild(),this.glows&&this.glows.Update(e)}},{key:"Unload",value:function(){this._positions&&(n.w.gl.deleteBuffer(this._positions),this._positions=null),this.glows&&this.glows.Unload()}},{key:"Rebuild",value:function(){this.constructor.RebuildItems(this);var e=this._visibleItems.length;if(this._rebuildPending=!1,e){for(var t=n.w,i=r._box,a=new Float32Array(e*i.length*6*28),o=[0,3,1,3,2,1],s=0,u=0;u<e;++u)for(var c=this._visibleItems[u],l=0;l<i.length;++l)for(var f=0;f<o.length;++f)a[s++]=i[l][o[f]][0],a[s++]=i[l][o[f]][1],a[s++]=i[l][o[f]][2],a[s++]=0,a[s++]=0,a.set(c.transform,s),s+=16,a[s++]=0,a[s++]=1,a[s++]=1,a[s++]=1,a[s++]=c.wavePhase,a[s++]=c.atlas0,a[s++]=c.atlas1;this._positions=t.gl.createBuffer(),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,this._positions),t.gl.bufferData(t.gl.ARRAY_BUFFER,a,t.gl.STATIC_DRAW),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,null),this._positions.count=12*e*3,this.glows&&this.glows.Rebuild()}}},{key:"GetBatches",value:function(e,t,r){if(this.display&&e===n.w.RM_ADDITIVE&&this._positions&&this._visibleItems.length){if(this.effect){var i=new Qt;n.z.transpose(this._perObjectData.perObjectVSData.Get("WorldMat"),this._parentTransform),this._perObjectData.perObjectVSData.Set("Shipdata",r.perObjectVSData.Get("Shipdata")),this._perObjectData.perObjectPSData=r.perObjectPSData,i.perObjectData=this._perObjectData,i.boosters=this,i.renderMode=n.w.RM_ADDITIVE,t.Commit(i)}this.glows&&this.glows.GetBoosterGlowBatches(e,t,r,this._parentTransform,r.perObjectVSData.Get("Shipdata")[0],0)}}},{key:"Render",value:function(e){if(!this.effect||!this.effect.IsGood())return!1;n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,this._positions);for(var t=0;t<this.effect.GetPassCount(e);++t){if(this.effect.ApplyPass(e,t),!this._decl.SetDeclaration(this.effect.GetPassInput(e,t),112))return!1;n.w.ApplyShadowState(),n.w.gl.drawArrays(n.w.gl.TRIANGLES,0,this._positions.count)}return!0}}],[{key:"RebuildItems",value:function(e){var t=e.glows,i=r.global,a=i.vec3_0;t&&t.ClearItems(),e._visibleItems=[];for(var o=0;o<e.items.length;o++){var s=e.items[o];if(s._onModified=e._onChildModified,s.display){if(e._visibleItems.push(s),t){var u=s.customValues&&s.customValues.display?s.customValues:e,c=s.GetPosition(i.vec3_1),l=s.GetDirection(i.vec3_2),f=s.GetScale();e.visible.glows&&s.visible.glow&&t.CreateItem({name:s.name+"_glow",position:n.H.subtract(a,c,n.H.scale(a,l,u.glowDistance)),blinkRate:s.seed,blinkPhase:s.seed,minScale:u.glowScale*f,maxScale:u.glowScale*f,color:u.glowColor,warpColor:u.warpGlowColor}),e.visible.symHalos&&s.visible.symHalo&&t.CreateItem({name:s.name+"_symHalo",position:n.H.subtract(a,c,n.H.scale(a,l,u.symHaloDistance)),blinkRate:s.seed,blinkPhase:s.seed+1,minScale:u.symHaloScale*f,maxScale:u.symHaloScale*f,color:u.haloColor,warpColor:u.warpHaloColor}),e.visible.halos&&s.visible.halo&&t.CreateItem({name:s.name+"_halo",position:n.H.subtract(a,c,n.H.scale(a,l,u.haloDistance)),blinkRate:s.seed,blinkPhase:s.seed+1,minScale:u.haloScaleX*f,maxScale:u.haloScaleY*f,color:u.haloColor,warpColor:u.warpHaloColor})}s._rebuildPending=!1}}}}]),r}(Bt);function $t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function er(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function tr(e,t,r){return t&&er(e.prototype,t),r&&er(e,r),e}function rr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nr(e,t)}function nr(e,t){return(nr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ir(e){var t=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(e){return!1}}();return function(){var r,n=sr(e);if(t){var i=sr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ar(this,r)}}function ar(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?or(e):t}function or(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sr(e){return(sr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ur(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Kt(Jt,"Item",Zt),Kt(Jt,"perObjectData",{VSData:[["WorldMat",16],["Shipdata",4]]}),Kt(Jt,"vertexDeclarations",[["POSITION",0,3],["TEXCOORD",0,2],["TEXCOORD",1,4],["TEXCOORD",2,4],["TEXCOORD",3,4],["TEXCOORD",4,4],["TEXCOORD",5,4],["TEXCOORD",6,1],["TEXCOORD",7,2]]),Kt(Jt,"_box",[[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]],[[-1,-1,-1],[-1,1,-1],[1,1,-1],[1,-1,-1]],[[-1,-1,0],[-1,1,0],[-1,1,-1],[-1,-1,-1]],[[1,-1,0],[1,-1,-1],[1,1,-1],[1,1,0]],[[-1,-1,0],[-1,-1,-1],[1,-1,-1],[1,-1,0]],[[-1,1,0],[1,1,0],[1,1,-1],[-1,1,-1]]]);var cr=function(e){rr(r,e);var t=ir(r);function r(){var e;$t(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return ur(or(e=t.call(this,...a)),"type",r.Type.INVALID),ur(or(e),"position1",n.H.create()),ur(or(e),"color1",n.I.fromValues(1,1,1,1)),ur(or(e),"position2",n.H.create()),ur(or(e),"color2",n.I.fromValues(1,1,1,1)),ur(or(e),"intermediatePosition",n.H.create()),ur(or(e),"width",1),ur(or(e),"multiColor",n.I.fromValues(0,0,0,1)),ur(or(e),"multiColorBorder",-1),ur(or(e),"overlayColor",n.I.fromValues(0,0,0,1)),ur(or(e),"animationSpeed",0),ur(or(e),"animationScale",1),ur(or(e),"numOfSegments",1),e}return tr(r,[{key:"ChangeColor",value:function(e,t){n.H.copy(this.color1,e),n.H.copy(this.color2,t),this.OnValueChanged()}},{key:"ChangeWidth",value:function(e){this.width=e,this.OnValueChanged()}},{key:"ChangeCartesian",value:function(e,t,r){n.H.copy(this.position1,e),n.H.copy(this.position2,t),n.H.copy(this.intermediatePosition,r),this.OnValueChanged()}},{key:"ChangePositionCartesian",value:function(e,t){n.H.copy(this.position1,e),n.H.copy(this.position2,t),this.OnValueChanged()}},{key:"ChangeIntermediateCartesian",value:function(e){n.H.copy(this.intermediatePosition,e),this.OnValueChanged()}},{key:"ChangeSpherical",value:function(e,t,r,i){n.H.fromSpherical(this.position1,e,i),n.H.fromSpherical(this.position2,t,i),n.H.fromSpherical(this.intermediatePosition,r,i),this.OnValueChanged()}},{key:"ChangePositionSpherical",value:function(e,t,r){n.H.fromSpherical(this.position1,e,r),n.H.fromSpherical(this.position2,t,r),this.OnValueChanged()}},{key:"ChangeIntermediateSpherical",value:function(e,t){n.H.fromSpherical(this.intermediatePosition,e,t),this.OnValueChanged()}},{key:"ChangeMultiColor",value:function(e,t){n.I.copy(this.multiColor,e),this.multiColorBorder=t,this.OnValueChanged()}},{key:"ChangeAnimation",value:function(e,t,r){n.I.copy(this.overlayColor,e),this.animationSpeed=t,this.animationScale=r,this.OnValueChanged()}},{key:"ChangeSegmentation",value:function(e){this.type!==r.Type.STRAIGHT&&(this.numOfSegments=e,this.OnValueChanged())}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return n.F.assignIfExists(t,e,["name","display","type","position1","color1","position2","color2","intermediatePosition","width","multiColor","multiColorBorder","overlayColor","animationSpeed","animationScale","numOfSegments"]),t}}]),r}(Lt);ur(cr,"Type",{INVALID:0,STRAIGHT:1,SPHERED:2,CURVED:3}),ur(cr,"DEFAULT_CURVED_SEGMENTS",20),ur(cr,"DEFAULT_SPHERED_SEGMENTS",20);var lr=function(e){rr(r,e);var t=ir(r);function r(){var e;return $t(this,r),ur(or(e=t.call(this)),"lineEffect",s.Tw2Effect.create({effectFilePath:"res:/Graphics/Effect/Managed/Space/SpecialFX/Lines3D.fx",textures:{TexMap:"res:/texture/global/white.dds.0.png",OverlayTexMap:"res:/texture/global/white.dds.0.png"}})),ur(or(e),"pickEffect",null),ur(or(e),"lineWidthFactor",1),ur(or(e),"additive",!1),ur(or(e),"pickable",!0),ur(or(e),"depthOffset",0),ur(or(e),"translation",n.H.create()),ur(or(e),"rotation",n.C.create()),ur(or(e),"scaling",n.H.fromValues(1,1,1)),ur(or(e),"transform",n.z.create()),ur(or(e),"parentTransform",n.z.create()),ur(or(e),"_vertexSize",26),ur(or(e),"_vbSize",0),ur(or(e),"_vb",null),ur(or(e),"_perObjectData",new s.Tw2PerObjectData(r.perObjectData)),ur(or(e),"_decl",new s.Tw2VertexDeclaration(r.vertexDeclarations,4*e._vertexSize)),r.init(),e}return tr(r,[{key:"Initialize",value:function(){this.OnValueChanged(),this.Rebuild()}},{key:"AddStraightLine",value:function(e,t,r,n,i){return this.CreateItem({type:cr.Type.STRAIGHT,position1:e,position2:t,color1:n,color2:i,width:r})}},{key:"AddCurvedLineCrt",value:function(e,t,r,n,i,a){return this.CreateItem({type:cr.Type.CURVED,position1:e,position2:t,intermediatePosition:r,color1:i,color2:a,width:n,numOfSegments:cr.DEFAULT_CURVED_SEGMENTS})}},{key:"AddCurvedLineSph",value:function(e,t,i,a,o,s,u){var c=r.global;return this.CreateItem({type:cr.Type.CURVED,position1:n.H.fromSpherical(c.vec3_0,e,i),position2:n.H.fromSpherical(c.vec3_1,t,i),intermediatePosition:n.H.fromSpherical(c.vec3_2,a,i),color1:s,color2:u,width:o,numOfSegments:cr.DEFAULT_CURVED_SEGMENTS})}},{key:"AddSpheredLineCrt",value:function(e,t,r,n,i,a){return this.CreateItem({type:cr.Type.SPHERED,position1:e,position2:t,intermediatePosition:r,color1:i,color2:a,width:n,numOfSegments:cr.DEFAULT_SPHERED_SEGMENTS})}},{key:"AddSpheredLineSph",value:function(e,t,i,a,o,s,u){var c=r.global;return this.CreateItem({type:cr.Type.SPHERED,position1:n.H.fromSpherical(c.vec3_0,e,i),position2:n.H.fromSpherical(c.vec3_1,t,i),intermediatePosition:n.H.fromSpherical(c.vec3_2,a,i),color1:s,color2:u,width:o,numOfSegments:cr.DEFAULT_SPHERED_SEGMENTS})}},{key:"OnValueChanged",value:function(){n.z.fromRotationTranslationScale(this.transform,this.rotation,this.translation,this.scaling),this._rebuildPending=!0}},{key:"UpdateViewDependentData",value:function(e){n.z.copy(this.parentTransform,e)}},{key:"Update",value:function(){this._rebuildPending&&this.Rebuild()}},{key:"Unload",value:function(){this._vb&&(n.w.gl.deleteBuffer(this._vb),this._vb=null)}},{key:"Rebuild",value:function(){r.RebuildItems(this),this._vb=null,this._vbSize=this.lineCount,this._rebuildPending=!1;var e=this._visibleItems.length;if(e){for(var t,i=r.global,a=new Float32Array(6*this._vbSize*this._vertexSize),o=i.vec3_0,s=i.vec3_1,u=i.vec3_2,c=i.vec3_3,l=i.vec3_4,f=i.vec3_5,h=i.vec3_6,d=i.mat4_0,p=i.vec3_7,v=i.vec3_8,y=i.vec3_9,m=i.vec3_10,b=i.vec4_0,g=i.vec4_1,_=0,R=0;R<e;++R){var E=this._visibleItems[R];switch(E.type){case cr.Type.INVALID:break;case cr.Type.STRAIGHT:r.WriteLineVerticesToBuffer(this,E.position1,E.color1,0,E.position2,E.color2,1,R,a,_),_+=6*this._vertexSize;break;case cr.Type.SPHERED:n.H.subtract(o,E.position1,E.intermediatePosition),n.H.subtract(s,E.position2,E.intermediatePosition),n.H.normalize(u,o),n.H.normalize(c,s),n.H.cross(l,o,s);var w=Math.acos(n.H.dot(u,c))/E.numOfSegments;n.z.identity(d),n.z.rotate(d,d,w,l),n.H.copy(p,o),n.I.copy(b,E.color1);for(var T=0;T<this.lines[R].numOfSegments;++T){var S=(T+1)/E.numOfSegments;n.H.transformMat4(v,p,d),g[0]=E.color1[0]*(1-S)+E.color2[0]*S,g[1]=E.color1[1]*(1-S)+E.color2[1]*S,g[2]=E.color1[2]*(1-S)+E.color2[2]*S,g[3]=E.color1[3]*(1-S)+E.color2[3]*S,n.H.add(y,p,E.intermediatePosition),n.H.add(m,v,E.intermediatePosition),r.WriteLineVerticesToBuffer(this,y,b,T/E.numOfSegments,m,g,S,R,a,_),_+=6*this._vertexSize,t=p,p=v,v=t,t=b,b=g,g=t}break;case cr.Type.CURVED:n.H.subtract(f,E.intermediatePosition,E.position1),n.H.subtract(h,E.position2,E.intermediatePosition),n.H.copy(y,E.position1),n.H.copy(b,E.color1);for(var O=0;O<E.numOfSegments;++O){var P=(O+1)/E.numOfSegments;n.H.hermite(m,E.position1,f,E.position2,h,P),g[0]=E.color1[0]*(1-P)+E.color2[0]*P,g[1]=E.color1[1]*(1-P)+E.color2[1]*P,g[2]=E.color1[2]*(1-P)+E.color2[2]*P,g[3]=E.color1[3]*(1-P)+E.color2[3]*P,r.WriteLineVerticesToBuffer(this,y,b,O/E.numOfSegments,m,g,P,R,a,_),_+=6*this._vertexSize,t=y,y=m,m=t,t=b,b=g,g=t}}}this._vb=n.w.gl.createBuffer(),n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,this._vb),n.w.gl.bufferData(n.w.gl.ARRAY_BUFFER,a,n.w.gl.STATIC_DRAW),n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,null)}}},{key:"GetBatches",value:function(e,t){if(this.display&&this._vb){var i;switch(e){case n.w.RM_TRANSPARENT:if(this.additive||!this.lineEffect)return;i=this.lineEffect;break;case n.w.RM_ADDITIVE:if(!this.additive||!this.lineEffect)return;i=this.lineEffect;break;case n.w.RM_PICKABLE:if(!this.pickable||!this.pickEffect)return;i=this.pickEffect}var a=new s.Tw2ForwardingRenderBatch,o=r.global.mat4_0;n.z.multiply(o,this.transform,this.parentTransform),n.z.transpose(this._perObjectData.perObjectVSData.Get("WorldMat"),o),n.z.transpose(this._perObjectData.perObjectPSData.Get("WorldMat"),o),a.perObjectData=this._perObjectData,a.geometryProvider=this,a.renderMode=e,a.effect=i,t.Commit(a)}}},{key:"Render",value:function(e,t){if(!e.effect||!e.effect.IsGood())return!1;n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,this._vb);for(var r=e.effect.GetPassCount(t),i=0;i<r;++i){e.effect.ApplyPass(t,i);var a=e.effect.GetPassInput(t,i);if(!this._decl.SetDeclaration(a,this._decl.stride))return!1;n.w.ApplyShadowState(),n.w.gl.drawArrays(n.w.gl.TRIANGLES,0,6*this._vbSize)}return!0}},{key:"lines",get:function(){return this.items},set:function(e){this.items=e}},{key:"lineCount",get:function(){for(var e=0,t=0;t<this.items.length;t++)this.items[t].type!==cr.Type.INVALID&&(e+=this.items[t].numOfSegments);return e}}],[{key:"FillColorVertices",value:function(e,t,r){return t[r++]=e.multiColor[0],t[r++]=e.multiColor[1],t[r++]=e.multiColor[2],t[r++]=e.multiColor[3],t[r++]=e.overlayColor[0],t[r++]=e.overlayColor[1],t[r++]=e.overlayColor[2],t[r++]=e.overlayColor[3],r}},{key:"WriteLineVerticesToBuffer",value:function(e,t,n,i,a,o,s,u,c,l){var f=e.items[u];c[l++]=t[0],c[l++]=t[1],c[l++]=t[2],c[l++]=a[0]-t[0],c[l++]=a[1]-t[1],c[l++]=a[2]-t[2],c[l++]=-e.lineWidthFactor*f.width,c[l++]=0,c[l++]=i,c[l++]=f.multiColorBorder,c[l++]=s-i,c[l++]=f.animationSpeed,c[l++]=f.animationScale,c[l++]=u,c[l++]=n[0],c[l++]=n[1],c[l++]=n[2],c[l++]=n[3],l=r.FillColorVertices(f,c,l),c[l++]=t[0],c[l++]=t[1],c[l++]=t[2],c[l++]=a[0]-t[0],c[l++]=a[1]-t[1],c[l++]=a[2]-t[2],c[l++]=e.lineWidthFactor*f.width,c[l++]=0,c[l++]=i,c[l++]=f.multiColorBorder,c[l++]=s-i,c[l++]=f.animationSpeed,c[l++]=f.animationScale,c[l++]=u,c[l++]=n[0],c[l++]=n[1],c[l++]=n[2],c[l++]=n[3],l=r.FillColorVertices(f,c,l),c[l++]=a[0],c[l++]=a[1],c[l++]=a[2],c[l++]=t[0]-a[0],c[l++]=t[1]-a[1],c[l++]=t[2]-a[2],c[l++]=-e.lineWidthFactor*f.width,c[l++]=1,c[l++]=s,c[l++]=f.multiColorBorder,c[l++]=s-i,c[l++]=f.animationSpeed,c[l++]=f.animationScale,c[l++]=u,c[l++]=o[0],c[l++]=o[1],c[l++]=o[2],c[l++]=o[3],l=r.FillColorVertices(f,c,l),c[l++]=t[0],c[l++]=t[1],c[l++]=t[2],c[l++]=a[0]-t[0],c[l++]=a[1]-t[1],c[l++]=a[2]-t[2],c[l++]=e.lineWidthFactor*f.width,c[l++]=0,c[l++]=i,c[l++]=f.multiColorBorder,c[l++]=s-i,c[l++]=f.animationSpeed,c[l++]=f.animationScale,c[l++]=u,c[l++]=n[0],c[l++]=n[1],c[l++]=n[2],c[l++]=n[3],l=r.FillColorVertices(f,c,l),c[l++]=a[0],c[l++]=a[1],c[l++]=a[2],c[l++]=t[0]-a[0],c[l++]=t[1]-a[1],c[l++]=t[2]-a[2],c[l++]=e.lineWidthFactor*f.width,c[l++]=1,c[l++]=s,c[l++]=f.multiColorBorder,c[l++]=s-i,c[l++]=f.animationSpeed,c[l++]=f.animationScale,c[l++]=u,c[l++]=o[0],c[l++]=o[1],c[l++]=o[2],c[l++]=o[3],l=r.FillColorVertices(f,c,l),c[l++]=a[0],c[l++]=a[1],c[l++]=a[2],c[l++]=t[0]-a[0],c[l++]=t[1]-a[1],c[l++]=t[2]-a[2],c[l++]=-e.lineWidthFactor*f.width,c[l++]=1,c[l++]=s,c[l++]=f.multiColorBorder,c[l++]=s-i,c[l++]=f.animationSpeed,c[l++]=f.animationScale,c[l++]=u,c[l++]=o[0],c[l++]=o[1],c[l++]=o[2],c[l++]=o[3],r.FillColorVertices(f,c,l)}},{key:"init",value:function(){r.global||(r.global={vec3_0:n.H.create(),vec3_1:n.H.create(),vec3_2:n.H.create(),vec3_3:n.H.create(),vec3_4:n.H.create(),vec3_5:n.H.create(),vec3_6:n.H.create(),vec3_7:n.H.create(),vec3_8:n.H.create(),vec3_9:n.H.create(),vec3_10:n.H.create(),vec4_0:n.I.create(),vec4_1:n.I.create(),mat4_0:n.z.create()})}}]),r}(Bt);function fr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function hr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}ur(lr,"Item",cr),ur(lr,"global",null),ur(lr,"perObjectData",{VSData:[["WorldMat",16]],PSData:[["WorldMat",16]]}),ur(lr,"vertexDeclarations",[["POSITION",0,3],["TEXCOORD",0,4],["TEXCOORD",1,4],["TEXCOORD",2,3],["COLOR",0,4],["COLOR",1,4],["COLOR",2,4]]);var dr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hr(this,"name",""),hr(this,"transform",n.z.create()),hr(this,"atlasIndex0",null),hr(this,"atlasIndex1",null),hr(this,"bone",null)}var t,r,i;return t=e,(r=[{key:"FindBone",value:function(e){this.bone=null;var t=e.FindModelForMesh(0);if(t)for(var r=0;r<t.bones.length;++r)if(t.bones[r].boneRes.name===this.name){this.bone=t.bones[r];break}return this.bone}}])&&fr(t.prototype,r),i&&fr(t,i),e}();function pr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function yr(e,t,r){return t&&vr(e.prototype,t),r&&vr(e,r),e}function mr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&br(e,t)}function br(e,t){return(br=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gr(e){var t=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(e){return!1}}();return function(){var r,n=Er(e);if(t){var i=Er(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _r(this,r)}}function _r(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Rr(e):t}function Rr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Er(e){return(Er=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}hr(dr,"Prefix",{AUDIO:"locator_audio",ATTACH:"locator_attach",BOOSTER:"locator_booster",TURRET:"locator_turret",XL_TURRET:"locator_xl"});var Tr=function(e){mr(r,e);var t=gr(r);function r(){var e;pr(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return wr(Rr(e=t.call(this,...i)),"planeSet",null),e}return yr(r,[{key:"Commit",value:function(e){this.planeSet.Render(e)}}]),r}(s.Tw2RenderBatch),Sr=function(e){mr(r,e);var t=gr(r);function r(){var e;pr(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return wr(Rr(e=t.call(this,...a)),"boneIndex",0),wr(Rr(e),"groupIndex",-1),wr(Rr(e),"maskAtlasID",0),wr(Rr(e),"position",n.H.create()),wr(Rr(e),"scaling",n.H.fromValues(1,1,1)),wr(Rr(e),"rotation",n.C.create()),wr(Rr(e),"transform",n.z.create()),wr(Rr(e),"color",n.I.fromValues(1,1,1,1)),wr(Rr(e),"layer1Transform",n.I.fromValues(1,1,0,0)),wr(Rr(e),"layer2Transform",n.I.fromValues(1,1,0,0)),wr(Rr(e),"layer1Scroll",n.I.create()),wr(Rr(e),"layer2Scroll",n.I.create()),e}return yr(r,null,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return n.F.assignIfExists(t,e,["name","display","boneIndex","groupIndex","maskAtlasID","position","scaling","rotation","transform","color","layer1Transform","layer2Transform","layer1Scroll","layer2Scroll"]),t}}]),r}(Lt),Or=function(e){mr(r,e);var t=gr(r);function r(){var e;pr(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return wr(Rr(e=t.call(this,...i)),"effect",null),wr(Rr(e),"hideOnLowQuality",!1),wr(Rr(e),"_time",0),wr(Rr(e),"_vertexBuffer",null),wr(Rr(e),"_indexBuffer",null),wr(Rr(e),"_decl",new s.Tw2VertexDeclaration(r.vertexDeclarations)),e}return yr(r,[{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.effect&&this.effect.GetResources(e),e}},{key:"Update",value:function(e){this._time+=e,this._rebuildPending&&this.Rebuild()}},{key:"Unload",value:function(){this._vertexBuffer&&(n.w.gl.deleteBuffer(this._vertexBuffer),this._vertexBuffer=null),this._indexBuffer&&(n.w.gl.deleteBuffer(this._indexBuffer),this._indexBuffer=null)}},{key:"Rebuild",value:function(){this.Unload(),r.RebuildItems(this),this._rebuildPending=!1;var e=this._visibleItems.length;if(e){for(var t=r.global.mat4_0,i=new Float32Array(4*e*35),a=0;a<e;++a){var o=this._visibleItems[a],s=4*a*35;i[s+35-3]=0,i[s+35+35-3]=1,i[s+70+35-3]=2,i[s+105+35-3]=3;for(var u=n.z.fromRotationTranslationScale(t,o.rotation,o.position,o.scaling),c=0;c<4;++c){var l=s+35*c;i[l]=u[0],i[l+1]=u[4],i[l+2]=u[8],i[l+3]=u[12],i[l+4]=u[1],i[l+5]=u[5],i[l+6]=u[9],i[l+7]=u[13],i[l+8]=u[2],i[l+9]=u[6],i[l+10]=u[10],i[l+11]=u[14],i[l+12]=o.color[0],i[l+13]=o.color[1],i[l+14]=o.color[2],i[l+15]=o.color[3],i[l+16]=o.layer1Transform[0],i[l+17]=o.layer1Transform[1],i[l+18]=o.layer1Transform[2],i[l+19]=o.layer1Transform[3],i[l+20]=o.layer2Transform[0],i[l+21]=o.layer2Transform[1],i[l+22]=o.layer2Transform[2],i[l+23]=o.layer2Transform[3],i[l+24]=o.layer1Scroll[0],i[l+25]=o.layer1Scroll[1],i[l+26]=o.layer1Scroll[2],i[l+27]=o.layer1Scroll[3],i[l+28]=o.layer2Scroll[0],i[l+29]=o.layer2Scroll[1],i[l+30]=o.layer2Scroll[2],i[l+31]=o.layer2Scroll[3],i[l+33]=o.boneIndex,i[l+34]=o.maskAtlasID}}this._vertexBuffer=n.w.gl.createBuffer(),n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,this._vertexBuffer),n.w.gl.bufferData(n.w.gl.ARRAY_BUFFER,i,n.w.gl.STATIC_DRAW),n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,null);for(var f=new Uint16Array(6*e),h=0;h<e;++h){var d=6*h,p=4*h;f[d]=p,f[d+1]=p+2,f[d+2]=p+1,f[d+3]=p,f[d+4]=p+3,f[d+5]=p+2}this._indexBuffer=n.w.gl.createBuffer(),n.w.gl.bindBuffer(n.w.gl.ELEMENT_ARRAY_BUFFER,this._indexBuffer),n.w.gl.bufferData(n.w.gl.ELEMENT_ARRAY_BUFFER,f,n.w.gl.STATIC_DRAW),n.w.gl.bindBuffer(n.w.gl.ELEMENT_ARRAY_BUFFER,null),this._indexBuffer.count=6*e}}},{key:"GetBatches",value:function(e,t,r){if(this.display&&e===n.w.RM_ADDITIVE&&this._indexBuffer&&this._visibleItems.length){var i=new Tr;i.renderMode=n.w.RM_ADDITIVE,i.planeSet=this,i.perObjectData=r,t.Commit(i)}}},{key:"Render",value:function(e){if(!this.effect||!this.effect.IsGood())return!1;n.w.SetStandardStates(n.w.RM_ADDITIVE),n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,this._vertexBuffer),n.w.gl.bindBuffer(n.w.gl.ELEMENT_ARRAY_BUFFER,this._indexBuffer);for(var t=0;t<this.effect.GetPassCount(e);++t){if(this.effect.ApplyPass(e,t),!this._decl.SetDeclaration(this.effect.GetPassInput(e,t),140))return!1;n.w.ApplyShadowState(),n.w.gl.drawElements(n.w.gl.TRIANGLES,this._indexBuffer.count,n.w.gl.UNSIGNED_SHORT,0)}return!0}},{key:"planes",get:function(){return this.items},set:function(e){this.items=e}}]),r}(Bt);function Pr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ar(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}wr(Or,"Item",Sr),wr(Or,"vertexDeclarations",[["TEXCOORD",0,4],["TEXCOORD",1,4],["TEXCOORD",2,4],["COLOR",0,4],["TEXCOORD",3,4],["TEXCOORD",4,4],["TEXCOORD",5,4],["TEXCOORD",6,4],["TEXCOORD",7,3]]);var Ir=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Ar(this,"_id",n.F.generateID()),Ar(this,"name",""),Ar(this,"display",!0),Ar(this,"decalEffect",null),Ar(this,"pickEffect",null),Ar(this,"parentGeometry",null),Ar(this,"parentBoneIndex",-1),Ar(this,"groupIndex",-1),Ar(this,"pickable",!0),Ar(this,"position",n.H.create()),Ar(this,"rotation",n.C.create()),Ar(this,"scaling",n.H.create()),Ar(this,"decalMatrix",n.z.create()),Ar(this,"invDecalMatrix",n.z.create()),Ar(this,"indexBuffer",[]),Ar(this,"_indexBuffer",null),Ar(this,"_perObjectData",new s.Tw2PerObjectData(e.perObjectData))}var t,r,i;return t=e,(r=[{key:"Initialize",value:function(){this.SetIndexBuffer(this.indexBuffer)}},{key:"OnValueChanged",value:function(){if(!this._indexBuffer&&this.indexBuffer){var e=n.w.gl,t=new Uint16Array(this.indexBuffer);this._indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW)}n.z.fromRotationTranslationScale(this.decalMatrix,this.rotation,this.position,this.scaling),n.z.invert(this.invDecalMatrix,this.decalMatrix)}},{key:"SetParentGeometry",value:function(e){this.parentGeometry=e}},{key:"SetIndexBuffer",value:function(e){this.indexBuffer=e,this.Unload(),this.OnValueChanged()}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.parentGeometry&&!e.includes(this.parentGeometry)&&e.push(this.parentGeometry),this.decalEffect&&this.decalEffect.GetResources(e),this.pickEffect&&this.pickEffect.GetResources(e),e}},{key:"Unload",value:function(){this._indexBuffer&&(n.w.gl.deleteBuffer(this._indexBuffer),this._indexBuffer=null)}},{key:"GetBatches",value:function(e,t,r,i){var a;switch(e){case n.w.RM_DECAL:a=this.decalEffect;break;case n.w.RM_PICKABLE:a=this.pickable?this.pickEffect:null}if(this.display&&a&&a.IsGood()&&this.indexBuffer.length&&this.parentGeometry&&this.parentGeometry.IsGood()){var o=new s.Tw2ForwardingRenderBatch;if(this._perObjectData.perObjectVSData.Set("worldMatrix",r.perObjectVSData.Get("WorldMat")),this.parentBoneIndex>=0){var u=r.perObjectVSData.Get("JointMat"),c=12*this.parentBoneIndex;if(u[c]||u[c+4]||u[c+8]){var l=this._perObjectData.perObjectVSData.Get("parentBoneMatrix");l[0]=u[c],l[1]=u[c+4],l[2]=u[c+8],l[3]=0,l[4]=u[c+1],l[5]=u[c+5],l[6]=u[c+9],l[7]=0,l[8]=u[c+2],l[9]=u[c+6],l[10]=u[c+10],l[11]=0,l[12]=u[c+3],l[13]=u[c+7],l[14]=u[c+11],l[15]=1,n.z.transpose(l,l)}}n.z.invert(this._perObjectData.perObjectVSData.Get("invWorldMatrix"),this._perObjectData.perObjectVSData.Get("worldMatrix")),n.z.transpose(this._perObjectData.perObjectVSData.Get("decalMatrix"),this.decalMatrix),n.z.transpose(this._perObjectData.perObjectVSData.Get("invDecalMatrix"),this.invDecalMatrix),this._perObjectData.perObjectPSData.Get("displayData")[0]=i||0,this._perObjectData.perObjectPSData.Set("shipData",r.perObjectPSData.data),o.perObjectData=this._perObjectData,o.geometryProvider=this,o.renderMode=e,o.effect=a,t.Commit(o)}}},{key:"Render",value:function(e,t){var r=this.parentGeometry.meshes[0].indexes,i=this.parentGeometry.meshes[0].areas[0].start,a=this.parentGeometry.meshes[0].areas[0].count,o=this.parentGeometry.meshes[0].indexType;n.E.SetVariableValue("u_DecalMatrix",this.decalMatrix),n.E.SetVariableValue("u_InvDecalMatrix",this.invDecalMatrix),this.parentGeometry.meshes[0].indexes=this._indexBuffer,this.parentGeometry.meshes[0].areas[0].start=0,this.parentGeometry.meshes[0].areas[0].count=this.indexBuffer.length,this.parentGeometry.meshes[0].indexType=n.w.gl.UNSIGNED_SHORT,this.parentGeometry.RenderAreas(0,0,1,e.effect,t),this.parentGeometry.meshes[0].indexes=r,this.parentGeometry.meshes[0].areas[0].start=i,this.parentGeometry.meshes[0].areas[0].count=a,this.parentGeometry.meshes[0].indexType=o}}])&&Pr(t.prototype,r),i&&Pr(t,i),e}();function Dr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Mr(e,t,r){return t&&Cr(e.prototype,t),r&&Cr(e,r),e}function kr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xr(e,t)}function xr(e,t){return(xr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function jr(e){var t=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(e){return!1}}();return function(){var r,n=Lr(e);if(t){var i=Lr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Gr(this,r)}}function Gr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Fr(e):t}function Fr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lr(e){return(Lr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Br(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Ar(Ir,"perObjectData",{VSData:[["worldMatrix",16],["invWorldMatrix",16],["decalMatrix",16],["invDecalMatrix",16],["parentBoneMatrix",16,n.z.identity([])]],PSData:[["displayData",4],["shipData",12]]});var Ur=function(e){kr(r,e);var t=jr(r);function r(){var e;Dr(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return Br(Fr(e=t.call(this,...i)),"spotlightSet",null),e}return Mr(r,[{key:"Commit",value:function(e){this.spotlightSet.RenderCones(e),this.spotlightSet.RenderGlow(e)}}]),r}(s.Tw2RenderBatch),Nr=function(e){kr(r,e);var t=jr(r);function r(){var e;Dr(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Br(Fr(e=t.call(this,...a)),"transform",n.z.create()),Br(Fr(e),"coneColor",n.I.create()),Br(Fr(e),"spriteColor",n.I.create()),Br(Fr(e),"flareColor",n.I.create()),Br(Fr(e),"spriteScale",n.H.fromValues(1,1,1)),Br(Fr(e),"boosterGainInfluence",0),Br(Fr(e),"boneIndex",0),Br(Fr(e),"groupIndex",-1),Br(Fr(e),"coneIntensity",0),Br(Fr(e),"spriteIntensity",0),Br(Fr(e),"flareIntensity",0),e}return Mr(r,null,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return n.F.assignIfExists(t,e,["name","display","boosterGainInfluence","boneIndex","groupIndex","coneIntensity","spriteIntensity","flareIntensity","transform","coneColor","spriteColor","flareColor","spriteScale"]),t}}]),r}(Lt),Vr=function(e){kr(r,e);var t=jr(r);function r(){var e;Dr(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return Br(Fr(e=t.call(this,...i)),"coneEffect",null),Br(Fr(e),"glowEffect",null),Br(Fr(e),"_coneVertexBuffer",null),Br(Fr(e),"_spriteVertexBuffer",null),Br(Fr(e),"_indexBuffer",null),Br(Fr(e),"_decl",new s.Tw2VertexDeclaration(r.vertexDeclarations)),e}return Mr(r,[{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.coneEffect&&this.coneEffect.GetResources(e),this.glowEffect&&this.glowEffect.GetResources(e),e}},{key:"Unload",value:function(){this._coneVertexBuffer&&(n.w.gl.deleteBuffer(this._coneVertexBuffer),this._coneVertexBuffer=null),this._spriteVertexBuffer&&(n.w.gl.deleteBuffer(this._spriteVertexBuffer),this._spriteVertexBuffer=null),this._indexBuffer&&(n.w.gl.deleteBuffer(this._indexBuffer),this._indexBuffer=null)}},{key:"Rebuild",value:function(){this.Unload(),r.RebuildItems(this),this._rebuildPending=!1;var e=this._visibleItems.length;if(e){for(var t=n.w,i=[1,0,2,3],a=new Float32Array(22*(4*e*4)),o=0;o<e;++o)for(var s=this._visibleItems[o],u=0;u<4;++u)for(var c=0;c<4;++c){var l=22*(4*o*4+4*u+c);a[l]=s.coneColor[0]*s.coneIntensity,a[l+1]=s.coneColor[1]*s.coneIntensity,a[l+2]=s.coneColor[2]*s.coneIntensity,a[l+3]=s.coneColor[3],a[l+4]=s.transform[0],a[l+5]=s.transform[4],a[l+6]=s.transform[8],a[l+7]=s.transform[12],a[l+8]=s.transform[1],a[l+9]=s.transform[5],a[l+10]=s.transform[9],a[l+11]=s.transform[13],a[l+12]=s.transform[2],a[l+13]=s.transform[6],a[l+14]=s.transform[10],a[l+15]=s.transform[14],a[l+16]=1,a[l+17]=1,a[l+18]=1,a[l+19]=4*u+i[c],a[l+20]=s.boneIndex,a[l+21]=s.boosterGainInfluence?255:0}this._coneVertexBuffer=t.gl.createBuffer(),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,this._coneVertexBuffer),t.gl.bufferData(t.gl.ARRAY_BUFFER,a,t.gl.STATIC_DRAW),this._coneVertexBuffer.count=4*e*6;for(var f=new Float32Array(22*(2*e*4)),h=[1,0,2,3],d=0;d<e;++d)for(var p=this._visibleItems[d],v=0;v<2;++v)for(var y=0;y<4;++y){var m=22*(2*d*4+4*v+y);v%2==0?(f[m]=p.spriteColor[0]*p.spriteIntensity,f[m+1]=p.spriteColor[1]*p.spriteIntensity,f[m+2]=p.spriteColor[2]*p.spriteIntensity,f[m+3]=p.spriteColor[3],f[m+16]=p.spriteScale[0],f[m+17]=1,f[m+18]=1):(f[m]=p.flareColor[0]*p.flareIntensity,f[m+1]=p.flareColor[1]*p.flareIntensity,f[m+2]=p.flareColor[2]*p.flareIntensity,f[m+3]=p.flareColor[3],f[m+16]=1,f[m+17]=p.spriteScale[1],f[m+18]=p.spriteScale[2]),f[m+4]=p.transform[0],f[m+5]=p.transform[4],f[m+6]=p.transform[8],f[m+7]=p.transform[12],f[m+8]=p.transform[1],f[m+9]=p.transform[5],f[m+10]=p.transform[9],f[m+11]=p.transform[13],f[m+12]=p.transform[2],f[m+13]=p.transform[6],f[m+14]=p.transform[10],f[m+15]=p.transform[14],f[m+19]=4*v+h[y],f[m+20]=p.boneIndex,f[m+21]=p.boosterGainInfluence?255:0}this._spriteVertexBuffer=t.gl.createBuffer(),t.gl.bindBuffer(t.gl.ARRAY_BUFFER,this._spriteVertexBuffer),t.gl.bufferData(t.gl.ARRAY_BUFFER,f,t.gl.STATIC_DRAW),this._spriteVertexBuffer.count=2*e*6;for(var b=new Uint16Array(4*e*6),g=0;g<4*e;++g){var _=6*g,R=4*g;b[_]=R,b[_+1]=R+1,b[_+2]=R+2,b[_+3]=R+2,b[_+4]=R+3,b[_+5]=R}this._indexBuffer=t.gl.createBuffer(),t.gl.bindBuffer(t.gl.ELEMENT_ARRAY_BUFFER,this._indexBuffer),t.gl.bufferData(t.gl.ELEMENT_ARRAY_BUFFER,b,t.gl.STATIC_DRAW),t.gl.bindBuffer(t.gl.ELEMENT_ARRAY_BUFFER,null),this._indexBuffer.count=e}}},{key:"GetBatches",value:function(e,t,r){if(this.display&&e===n.w.RM_ADDITIVE&&this._indexBuffer&&this._indexBuffer.count){var i=new Ur;i.renderMode=n.w.RM_ADDITIVE,i.spotlightSet=this,i.perObjectData=r,t.Commit(i)}}},{key:"RenderCones",value:function(e){return r.Render(this,this.coneEffect,e,this._coneVertexBuffer)}},{key:"RenderGlow",value:function(e){return r.Render(this,this.glowEffect,e,this._spriteVertexBuffer)}},{key:"spotlightItems",get:function(){return this.items},set:function(e){this.items=e}}],[{key:"Render",value:function(e,t,r,i){if(!t||!t.IsGood()||!i)return!1;n.w.SetStandardStates(n.w.RM_ADDITIVE),n.w.gl.bindBuffer(n.w.gl.ARRAY_BUFFER,i),n.w.gl.bindBuffer(n.w.gl.ELEMENT_ARRAY_BUFFER,e._indexBuffer);for(var a=0;a<t.GetPassCount(r);++a){if(t.ApplyPass(r,a),!e._decl.SetDeclaration(t.GetPassInput(r,a),88))return!1;n.w.ApplyShadowState(),n.w.gl.drawElements(n.w.gl.TRIANGLES,i.count,n.w.gl.UNSIGNED_SHORT,0)}return!0}}]),r}(Bt);function Hr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function qr(e,t,r){return t&&zr(e.prototype,t),r&&zr(e,r),e}function Xr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Yr(e,t)}function Yr(e,t){return(Yr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wr(e){var t=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(e){return!1}}();return function(){var r,n=Zr(e);if(t){var i=Zr(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Kr(this,r)}}function Kr(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?Qr(e):t}function Qr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zr(e){return(Zr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Jr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Br(Vr,"Item",Nr),Br(Vr,"vertexDeclarations",[["COLOR",0,4],["TEXCOORD",0,4],["TEXCOORD",1,4],["TEXCOORD",2,4],["TEXCOORD",3,3],["TEXCOORD",4,3]]);var $r=function(e){Xr(r,e);var t=Wr(r);function r(){var e;Hr(this,r);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return Jr(Qr(e=t.call(this,...i)),"boosterGlow",!1),Jr(Qr(e),"spriteSet",null),Jr(Qr(e),"world",null),Jr(Qr(e),"boosterGain",0),Jr(Qr(e),"warpIntensity",0),e}return qr(r,[{key:"Commit",value:function(e){this.boosterGlow?this.spriteSet.RenderBoosterGlow(e,this.world,this.boosterGain,this.warpIntensity):this.spriteSet.Render(e,this.world,this.perObjectData)}}]),r}(s.Tw2RenderBatch),en=function(e){Xr(r,e);var t=Wr(r);function r(){var e;Hr(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return Jr(Qr(e=t.call(this,...a)),"position",n.H.create()),Jr(Qr(e),"blinkRate",0),Jr(Qr(e),"blinkPhase",0),Jr(Qr(e),"minScale",1),Jr(Qr(e),"maxScale",1),Jr(Qr(e),"falloff",0),Jr(Qr(e),"color",n.I.create()),Jr(Qr(e),"warpColor",n.I.create()),Jr(Qr(e),"boneIndex",0),Jr(Qr(e),"groupIndex",-1),e}return qr(r,null,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return n.F.assignIfExists(t,e,["name","display","blinkRate","blinkPhase","minScale","maxScale","falloff","boneIndex","groupIndex","position","color","warpColor"]),t}}]),r}(Lt),tn=function(e){Xr(r,e);var t=Wr(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Hr(this,r),Jr(Qr(e=t.call(this)),"effect",null),Jr(Qr(e),"useQuads",null),Jr(Qr(e),"isSkinned",null),Jr(Qr(e),"_time",0),Jr(Qr(e),"_vertexBuffer",null),Jr(Qr(e),"_indexBuffer",null),Jr(Qr(e),"_instanceBuffer",null),Jr(Qr(e),"_decl",new s.Tw2VertexDeclaration),Jr(Qr(e),"_vdecl",new s.Tw2VertexDeclaration([["TEXCOORD",5,1]])),e.UseQuads(n,i),e}return qr(r,[{key:"UseQuads",value:function(e,t){this.useQuads!==e&&(this.useQuads=e,this.isSkinned=t,this._decl.DeclareFromObject(e?r.quadVertexDeclarations:r.vertexDeclarations),this._rebuildPending=!0)}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.effect&&this.effect.GetResources(e),e}},{key:"Update",value:function(e){this._time+=e,this._rebuildPending&&this.Rebuild()}},{key:"Unload",value:function(){var e=n.w.gl;this._vertexBuffer&&(e.deleteBuffer(this._vertexBuffer),this._vertexBuffer=null),this._indexBuffer&&(e.deleteBuffer(this._indexBuffer),this._indexBuffer=null),this._instanceBuffer&&(e.deleteBuffer(this._instanceBuffer),this._instanceBuffer=null)}},{key:"Rebuild",value:function(){this.constructor.RebuildItems(this),this._rebuildPending=!1;var e=this._visibleItems.length;if(e){var t=n.w.gl;if(this.useQuads)return this._vertexBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._vertexBuffer),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,1,2,2,3,0]),t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null),void(this._instanceBuffer=t.createBuffer());for(var r=new Float32Array(4*e*13),i=0;i<e;++i){var a=this._visibleItems[i],o=4*i*13;r[o]=0,r[o+13]=1,r[o+26]=2,r[o+39]=3;for(var s=0;s<4;++s){var u=o+13*s;r[u+1]=a.boneIndex,r[u+2]=a.position[0],r[u+3]=a.position[1],r[u+4]=a.position[2],r[u+5]=a.color[0],r[u+6]=a.color[1],r[u+7]=a.color[2],r[u+8]=a.blinkPhase,r[u+9]=a.blinkRate,r[u+10]=a.minScale,r[u+11]=a.maxScale,r[u+12]=a.falloff}}this._vertexBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._vertexBuffer),t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,null);for(var c=new Uint16Array(6*e),l=0;l<e;++l){var f=6*l,h=4*l;c[f]=h,c[f+1]=h+2,c[f+2]=h+1,c[f+3]=h,c[f+4]=h+3,c[f+5]=h+2}this._indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this._indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,c,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null),this._indexBuffer.count=6*e}}},{key:"GetBatches",value:function(e,t,r,i){if(this.display&&e===n.w.RM_ADDITIVE&&this._vertexBuffer&&this._visibleItems.length){var a=new $r;a.world=i,a.renderMode=n.w.RM_ADDITIVE,a.spriteSet=this,a.perObjectData=r,t.Commit(a)}}},{key:"GetBoosterGlowBatches",value:function(e,t,r,i,a,o){if(this.display&&e===n.w.RM_ADDITIVE&&this._vertexBuffer&&this._visibleItems.length){var s=new $r;s.boosterGlow=!0,s.world=i,s.boosterGain=a,s.warpIntensity=o,s.renderMode=n.w.RM_ADDITIVE,s.spriteSet=this,s.perObjectData=r,t.Commit(s)}}},{key:"Render",value:function(e,t,r){if(this.useQuads)return this.RenderQuads(e,t,r);if(!this.effect||!this.effect.IsGood()||!this._indexBuffer)return!1;var i=n.w,a=i.gl;i.SetStandardStates(i.RM_ADDITIVE),a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this._indexBuffer);for(var o=0;o<this.effect.GetPassCount(e);++o){if(this.effect.ApplyPass(e,o),!this._decl.SetDeclaration(this.effect.GetPassInput(e,o),52))return!1;i.ApplyShadowState(),a.drawElements(a.TRIANGLES,this._indexBuffer.count,a.UNSIGNED_SHORT,0)}return!0}},{key:"RenderBoosterGlow",value:function(e,t,r,i){if(!this.effect||!this.effect.IsGood()||!this._instanceBuffer)return!1;var a=n.w,o=a.gl,s=Bt.global.vec3_0,u=this._visibleItems.length,c=new Float32Array(17*u);a.SetStandardStates(a.RM_ADDITIVE);for(var l=0,f=0;f<u;++f){var h=this._visibleItems[f];n.H.transformMat4(s,h.position,t),c[l++]=s[0],c[l++]=s[1],c[l++]=s[2],c[l++]=t[8],c[l++]=h.blinkPhase,c[l++]=t[9],c[l++]=h.minScale,c[l++]=h.maxScale,c[l++]=t[10],c[l++]=h.color[0],c[l++]=h.color[1],c[l++]=h.color[2],c[l++]=r,c[l++]=h.warpColor[0],c[l++]=h.warpColor[1],c[l++]=h.warpColor[2],c[l++]=i}o.bindBuffer(o.ARRAY_BUFFER,this._instanceBuffer),o.bufferData(o.ARRAY_BUFFER,c,o.DYNAMIC_DRAW);for(var d=0;d<this.effect.GetPassCount(e);++d){this.effect.ApplyPass(e,d);var p=this.effect.GetPassInput(e,d);o.bindBuffer(o.ARRAY_BUFFER,this._vertexBuffer),this._vdecl.SetPartialDeclaration(p,4),o.bindBuffer(o.ARRAY_BUFFER,this._instanceBuffer);var v=this._decl.SetPartialDeclaration(p,68,0,1);a.ApplyShadowState(),a.ext.drawArraysInstanced(o.TRIANGLES,0,6,u),this._decl.ResetInstanceDivisors(v)}return!0}},{key:"RenderQuads",value:function(e,t,r){if(!this.effect||!this.effect.IsGood()||!this._instanceBuffer)return!1;var i=n.w,a=i.gl,o=this._visibleItems.length,s=new Float32Array(17*o),u=Bt.global.vec3_0,c=r.perObjectVSData.Get("JointMat");i.SetStandardStates(i.RM_ADDITIVE);for(var l=0,f=0;f<o;++f){var h=this._visibleItems[f];if(this.isSkinned){var d=12*h.boneIndex;u[0]=c[d]*h.position[0]+c[d+1]*h.position[1]+c[d+2]*h.position[2]+c[d+3],u[1]=c[d+4]*h.position[0]+c[d+5]*h.position[1]+c[d+6]*h.position[2]+c[d+7],u[2]=c[d+8]*h.position[0]+c[d+9]*h.position[1]+c[d+10]*h.position[2]+c[d+11],n.H.transformMat4(u,u,t)}else n.H.transformMat4(u,h.position,t);s[l++]=u[0],s[l++]=u[1],s[l++]=u[2],s[l++]=1,s[l++]=h.blinkPhase,s[l++]=h.blinkRate,s[l++]=h.minScale,s[l++]=h.maxScale,s[l++]=h.falloff,s[l++]=h.color[0],s[l++]=h.color[1],s[l++]=h.color[2],s[l++]=1,s[l++]=h.warpColor[0],s[l++]=h.warpColor[1],s[l++]=h.warpColor[2],s[l++]=1}a.bindBuffer(a.ARRAY_BUFFER,this._instanceBuffer),a.bufferData(a.ARRAY_BUFFER,s,a.DYNAMIC_DRAW);for(var p=0;p<this.effect.GetPassCount(e);++p){this.effect.ApplyPass(e,p);var v=this.effect.GetPassInput(e,p);a.bindBuffer(a.ARRAY_BUFFER,this._vertexBuffer),this._vdecl.SetPartialDeclaration(v,4),a.bindBuffer(a.ARRAY_BUFFER,this._instanceBuffer);var y=this._decl.SetPartialDeclaration(v,68,0,1);i.ApplyShadowState(),i.ext.drawArraysInstanced(a.TRIANGLES,0,6,o),this._decl.ResetInstanceDivisors(y)}return!0}},{key:"sprites",get:function(){return this.items},set:function(e){this.items=e}}]),r}(Bt);function rn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function an(e,t,r){return t&&nn(e.prototype,t),r&&nn(e,r),e}function on(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&sn(e,t)}function sn(e,t){return(sn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function un(e){var t=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(e){return!1}}();return function(){var r,n=fn(e);if(t){var i=fn(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return cn(this,r)}}function cn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ln(e):t}function ln(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fn(e){return(fn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Jr(tn,"Item",en),Jr(tn,"vertexDeclarations",[["TEXCOORD",5,2],["POSITION",0,3],["COLOR",0,3],["TEXCOORD",0,1],["TEXCOORD",1,1],["TEXCOORD",2,1],["TEXCOORD",3,1],["TEXCOORD",4,1]]),Jr(tn,"quadVertexDeclarations",[["POSITION",0,3],["TEXCOORD",0,4],["TEXCOORD",1,2],["COLOR",0,4],["COLOR",1,4]]);var dn,pn,vn=function(e){on(r,e);var t=un(r);function r(){var e;rn(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return hn(ln(e=t.call(this,...a)),"bone",null),hn(ln(e),"locatorName",null),hn(ln(e),"updateFromLocator",!1),hn(ln(e),"canFireWhenHidden",!1),hn(ln(e),"position",n.H.create()),hn(ln(e),"rotation",n.C.create()),hn(ln(e),"_localTransform",n.z.create()),hn(ln(e),"_localRotation",n.C.create()),e}return an(r,[{key:"UpdateTransforms",value:function(){n.z.fromRotationTranslation(this._localTransform,this.rotation,this.position),this.bone?(n.z.multiply(this._localTransform,this.bone.offsetTransform,this._localTransform),n.z.getRotation(this._localRotation,this._localTransform)):n.C.copy(this._localRotation,this.rotation)}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this;return n.F.assignIfExists(t,e,["name","display","locatorName","updateFromLocator","position","rotation","bone","canFireWhenHidden"]),t.UpdateTransforms(),t}}]),r}(Lt),yn=function(e){on(r,e);var t=un(r);function r(){var e;rn(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return hn(ln(e=t.call(this,...a)),"visible",{turrets:!0,firingEffects:!0}),hn(ln(e),"activeAnimation",new s.Tw2AnimationController),hn(ln(e),"inactiveAnimation",new s.Tw2AnimationController),hn(ln(e),"geometryResPath",""),hn(ln(e),"geometryResource",null),hn(ln(e),"turretEffect",null),hn(ln(e),"firingEffectResPath",""),hn(ln(e),"firingEffect",null),hn(ln(e),"fireCallback",null),hn(ln(e),"fireCallbackPending",!1),hn(ln(e),"state",r.State.IDLE),hn(ln(e),"bottomClipHeight",0),hn(ln(e),"locatorName",""),hn(ln(e),"sysBoneHeight",0),hn(ln(e),"hasCyclingFiringPos",!1),hn(ln(e),"targetPosition",n.H.create()),hn(ln(e),"parentMatrix",n.z.create()),hn(ln(e),"boundingSphere",n.C.create()),hn(ln(e),"_activeTurret",-1),hn(ln(e),"_recheckTimeLeft",0),hn(ln(e),"_currentCyclingFiresPos",0),hn(ln(e),"_perObjectDataActive",new s.Tw2PerObjectData(r.perObjectData)),hn(ln(e),"_perObjectDataInactive",new s.Tw2PerObjectData(r.perObjectData)),hn(ln(e),"_locatorRebuildPending",!0),e}return an(r,[{key:"Initialize",value:function(){this.turretEffect&&""!==this.geometryResPath&&(this.geometryResource=n.D.GetResource(this.geometryResPath),this.activeAnimation.SetGeometryResource(this.geometryResource),this.inactiveAnimation.SetGeometryResource(this.geometryResource),this.geometryResource&&this.geometryResource.RegisterNotification(this)),""!==this.firingEffectResPath&&n.D.GetObject(this.firingEffectResPath,e=>this.firingEffect=e),this.Rebuild()}},{key:"InitializeFiringEffect",value:function(){if(this.firingEffect&&this.geometryResource&&this.geometryResource.models.length)for(var e=this.geometryResource.models[0],t=0;t<this.firingEffect.GetPerMuzzleEffectCount();++t)this.firingEffect.SetMuzzleBoneID(t,e.FindBoneByName(r.positionBoneSkeletonNames[t]))}},{key:"GetClosestTurret",value:function(){for(var e=-1,t=-2,i=r.global,a=i.vec3_0,o=i.vec4_0,s=i.vec4_1,u=0;u<this.items.length;++u){var c=this.items[u];if(c.display||c.canFireWhenHidden){s[0]=c._localTransform[12],s[1]=c._localTransform[13],s[2]=c._localTransform[14],s[3]=1,n.I.transformMat4(s,s,this.parentMatrix),n.H.subtract(a,this.targetPosition,s),n.H.normalize(a,a),n.I.set(o,0,1,0,0),n.I.transformMat4(o,o,c._localTransform),n.I.transformMat4(o,o,this.parentMatrix);var l=n.H.dot(o,a);l>t&&(e=this.items.indexOf(c),t=l)}}return e}},{key:"EnterStateDeactive",value:function(){this.state!==r.State.INACTIVE&&this.state!==r.State.PACKING&&(this.turretEffect?(this.activeAnimation.StopAllAnimations(),this.inactiveAnimation.StopAllAnimations(),this.activeAnimation.PlayAnimation("Pack",!1,()=>{this.state=r.State.INACTIVE,this.activeAnimation.PlayAnimation("Inactive",!0)}),this.inactiveAnimation.PlayAnimation("Pack",!1,()=>{this.state=r.State.INACTIVE,this.inactiveAnimation.PlayAnimation("Inactive",!0)}),this.state=r.State.PACKING):this.state=r.State.INACTIVE,this._activeTurret=-1,this.firingEffect&&this.firingEffect.StopFiring())}},{key:"EnterStateIdle",value:function(){this.state!==r.State.IDLE&&this.state!==r.State.UNPACKING&&(this.turretEffect?(this.activeAnimation.StopAllAnimations(),this.inactiveAnimation.StopAllAnimations(),this.state===r.State.FIRING?(this.activeAnimation.PlayAnimation("Active",!0),this.inactiveAnimation.PlayAnimation("Active",!0)):(this.activeAnimation.PlayAnimation("Deploy",!1,()=>{this.state=r.State.IDLE,this.activeAnimation.PlayAnimation("Active",!0)}),this.inactiveAnimation.PlayAnimation("Deploy",!1,()=>{this.state=r.State.IDLE,this.inactiveAnimation.PlayAnimation("Active",!0)})),this.state=r.State.UNPACKING):this.state=r.State.IDLE,this._activeTurret=-1,this.firingEffect&&this.firingEffect.StopFiring())}},{key:"EnterStateFiring",value:function(){if(!this.turretEffect||this.state===r.State.FIRING)return r.DoStartFiring(this),void(this.turretEffect&&this.activeAnimation.PlayAnimation("Fire",!1,()=>{this.activeAnimation.PlayAnimation("Active",!0)}));this.activeAnimation.StopAllAnimations(),this.inactiveAnimation.StopAllAnimations(),this.state===r.State.INACTIVE?(this.activeAnimation.PlayAnimation("Deploy",!1,()=>{r.DoStartFiring(this),this.activeAnimation.PlayAnimation("Fire",!1,()=>{this.activeAnimation.PlayAnimation("Active",!0)})}),this.inactiveAnimation.PlayAnimation("Deploy",!1,()=>{this.inactiveAnimation.PlayAnimation("Active",!0)}),this.state=r.State.UNPACKING):(r.DoStartFiring(this),this.activeAnimation.PlayAnimation("Fire",!1,()=>{this.activeAnimation.PlayAnimation("Active",!0)}),this.inactiveAnimation.PlayAnimation("Active",!0))}},{key:"RebuildCachedData",value:function(){for(var e=new s.Tw2VertexElement(s.Tw2VertexDeclaration.Type.TEXCOORD,1,n.w.gl.FLOAT,2),t=this.geometryResource.meshes,i=this.activeAnimation,a=this.inactiveAnimation,o=0;o<t.length;++o)t[o].declaration.elements.push(e),t[o].declaration.RebuildHash();switch(this.state){case r.State.INACTIVE:i.PlayAnimation("Inactive",!0),a.PlayAnimation("Inactive",!0);break;case r.State.IDLE:i.PlayAnimation("Active",!0),a.PlayAnimation("Active",!0);break;case r.State.FIRING:i.PlayAnimation("Fire",!1,()=>i.PlayAnimation("Active",!0)),a.PlayAnimation("Active",!0);break;case r.State.PACKING:this.EnterStateIdle();break;case r.State.UNPACKING:this.EnterStateDeactive()}}},{key:"FindItemByLocatorName",value:function(e){for(var t=0;t<this.items.length;t++)if(this.items[t].locatorName===e)return this.items[t];return null}},{key:"UpdateItemsFromLocators",value:function(e){for(var t=r.global,i=Array.from(this.items),a=t.mat4_0,o=0;o<e.length;o++){var s=e[o],u=s.name,c=s.transform,l=s.bone,f=void 0===l?null:l,h=this.FindItemByLocatorName(u);h?i.splice(i.indexOf(h),1):h=this.CreateItem({name:u,locatorName:u,updateFromLocator:!0}),h.updateFromLocator&&(h.bone=f,n.z.copy(a,c),n.H.normalize(a.subarray(0,3),a.subarray(0,3)),n.H.normalize(a.subarray(4,7),a.subarray(4,7)),n.H.normalize(a.subarray(8,11),a.subarray(8,11)),n.z.getRotation(h.rotation,a),n.z.getTranslation(h.position,a),h.OnValueChanged())}for(var d=0;d<i.length;d++)i[d].locatorName&&(this.RemoveItem(i[d]),d--);this._locatorRebuildPending=!1,this._rebuildPending&&this.Rebuild()}},{key:"RebuildItemsFromLocators",value:function(){this._locatorRebuildPending=!0}},{key:"GetResources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.geometryResource&&!e.includes(this.geometryResource)&&e.push(this.geometryResource),this.turretEffect&&this.turretEffect.GetResources(e),this.firingEffect&&this.firingEffect.GetResources(e),e}},{key:"UpdateViewDependentData",value:function(){this.firingEffect&&this.firingEffect.UpdateViewDependentData()}},{key:"Update",value:function(e,t){if(this._rebuildPending&&this.Rebuild(),this.turretEffect&&(this.activeAnimation.Update(e),this.inactiveAnimation.Update(e)),n.z.copy(this.parentMatrix,t),this.firingEffect&&this._visibleItems.length){if(-1!==this._activeTurret){this.firingEffect.isLoopFiring&&this.state===r.State.FIRING&&(this._recheckTimeLeft-=e,this._recheckTimeLeft<=0&&r.DoStartFiring(this));var i=this.items[this._activeTurret];if(this.activeAnimation.models.length)for(var a=this.activeAnimation.models[0].bonesByName,o=0;o<this.firingEffect.GetPerMuzzleEffectCount();++o){var s=a[r.positionBoneSkeletonNames[o]].worldTransform,u=this.firingEffect.GetMuzzleTransform(o);n.z.multiply(u,i._localTransform,s),n.z.multiply(u,u,t)}else for(var c=0;c<this.firingEffect.GetPerMuzzleEffectCount();++c)n.z.multiply(this.firingEffect.GetMuzzleTransform(c),t,i._localTransform);if(this.fireCallbackPending){if(this.fireCallback){for(var l=[],f=0;f<this.firingEffect.GetPerMuzzleEffectCount();++f)l.push(this.firingEffect.GetMuzzleTransform(f));this.fireCallback(this,l)}this.fireCallbackPending=!1}}n.H.copy(this.firingEffect.endPosition,this.targetPosition),this.firingEffect.Update(e)}}},{key:"GetBatches",value:function(e,t,i,a){if(this.turretEffect&&this.geometryResource&&this.display&&this._visibleItems.length){if(e===n.w.RM_OPAQUE&&this.visible.turrets){var o=this.inactiveAnimation.GetBoneMatrices(0);if(0!==o.length){r.UpdatePerObjectData(this,this._perObjectDataInactive.perObjectVSData,o),this._perObjectDataInactive.perObjectPSData=i.perObjectPSData;var u=new s.Tw2ForwardingRenderBatch;if(u.renderMode=e,u.renderActive=!1,u.perObjectData=this._perObjectDataInactive,u.geometryProvider=this,t.Commit(u),this.state===r.State.FIRING){var c=this.activeAnimation.GetBoneMatrices(0);if(0!==c.length){r.UpdatePerObjectData(this,this._perObjectDataActive.perObjectVSData,c,!0),this._perObjectDataActive.perObjectPSData=i.perObjectPSData;var l=new s.Tw2ForwardingRenderBatch;l.renderActive=!0,l.perObjectData=this._perObjectDataActive,l.geometryProvider=this,t.Commit(l)}}}}this.GetFiringEffectBatches(e,t,i,a)}}},{key:"GetFiringEffectBatches",value:function(e,t,r,n){this.firingEffect&&this.display&&this._visibleItems.length&&this.visible.firingEffects&&!n&&this.firingEffect.GetBatches(e,t,r)}},{key:"Render",value:function(e,t){if(!this.turretEffect||!this.turretEffect.IsGood()||!this._visibleItems.length)return!1;for(var i=0,a=function(e){n.w.gl.disableVertexAttribArray(e.location),n.w.gl.vertexAttrib2f(e.location,i,i)},o=0;o<this.geometryResource.meshes.length;++o){this.geometryResource.meshes[o].declaration.FindUsage(s.Tw2VertexDeclaration.Type.TEXCOORD,1).customSetter=a}for(var u=0;i<this.items.length;++i)if(this.items[i].display){var c=this.state===r.State.FIRING&&i===this._activeTurret;e.renderActive===c&&(this.geometryResource.RenderAreas(0,0,1,this.turretEffect,t),u++)}return!!u}},{key:"turrets",get:function(){return this.items},set:function(e){this.items=e}}],[{key:"RebuildItems",value:function(e){e._visibleItems=[];for(var t=0;t<e.items.length;t++){var r=e.items[t];r._onModified=e._onChildModified,r.display&&(e._visibleItems.push(r),r._rebuildPending&&(r.UpdateTransforms(),r._rebuildPending=!1))}}},{key:"UpdatePerObjectData",value:function(e,t,i,a){n.z.transpose(t.Get("shipMatrix"),e.parentMatrix);var o=i.length/12;t.Get("turretSetData")[0]=o,t.Get("baseCutoffData")[0]=e.bottomClipHeight;for(var s=t.Get("turretTranslation"),u=t.Get("turretRotation"),c=t.Get("turretPoseTransAndRot"),l=0;l<e._visibleItems.length;++l){for(var f=e._visibleItems[l],h=0;h<o;++h)c[2*(l*o+h)*4]=i[12*h+3],c[2*(l*o+h)*4+1]=i[12*h+7],c[2*(l*o+h)*4+2]=i[12*h+11],c[2*(l*o+h)*4+3]=1,r.mat3x4toquat(i,h,c,2*(l*o+h)+1);f.bone&&!a&&f.UpdateTransforms(),s[4*l]=f._localTransform[12],s[4*l+1]=f._localTransform[13],s[4*l+2]=f._localTransform[14],s[4*l+3]=1,u[4*l]=f.rotation[0],u[4*l+1]=f.rotation[1],u[4*l+2]=f.rotation[2],u[4*l+3]=f.rotation[3]}}},{key:"DoStartFiring",value:function(e){e.hasCyclingFiringPos&&(e._currentCyclingFiresPos=1-e._currentCyclingFiresPos),e.firingEffect&&e.firingEffect.PrepareFiring(0,e.hasCyclingFiringPos?e._currentCyclingFiresPos:-1),e._activeTurret=e.GetClosestTurret(),e.state=r.State.FIRING,e._recheckTimeLeft=2,e.fireCallback&&(e.fireCallbackPending=!0)}}]),r}(Bt);function mn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function bn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}hn(yn,"Item",vn),hn(yn,"State",{INACTIVE:0,IDLE:1,FIRING:2,PACKING:2,UNPACKING:4}),hn(yn,"worldNames",["turretWorld0","turretWorld1","turretWorld2"]),hn(yn,"positionBoneSkeletonNames",["Pos_Fire01","Pos_Fire02","Pos_Fire03","Pos_Fire04","Pos_Fire05","Pos_Fire06","Pos_Fire07","Pos_Fire08"]),hn(yn,"perObjectData",{VSData:[["baseCutoffData",4],["turretSetData",4],["shipMatrix",16],["turretTranslation",96],["turretRotation",96],["turretPoseTransAndRot",576]]}),hn(yn,"mat3x4toquat",(function(e,t,r,i){dn||(dn=n.z.create(),pn=n.C.create()),t*=12,i*=4,dn[0]=e[t],dn[1]=e[t+4],dn[2]=e[t+8],dn[3]=0,dn[4]=e[t+1],dn[5]=e[t+5],dn[6]=e[t+9],dn[7]=0,dn[8]=e[t+2],dn[9]=e[t+6],dn[10]=e[t+10],dn[11]=0,dn[12]=e[t+3],dn[13]=e[t+7],dn[14]=e[t+11],dn[15]=1,n.z.getRotation(pn,dn),r[i]=pn[0],r[i+1]=pn[1],r[i+2]=pn[2],r[i+3]=pn[3]}));var gn=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._id=n.F.generateID(),this.name="",this.display=!0,this.visible={},this.visible.lensflares=!0,this.visible.objects=!0,this.visible.planets=!0,this.visible.fog=!0,this.visible.clearColor=!0,this.visible.environmentReflection=!0,this.visible.environmentDiffuse=!0,this.visible.environmentBlur=!0,Object.defineProperty(this.visible,"environment",{get:()=>this.backgroundRenderingEnabled,set:e=>{this.backgroundRenderingEnabled=e?1:0}}),this.lensflares=[],this.objects=[],this.planets=[],this.nebulaIntensity=1,this.ambientColor=n.C.fromValues(.25,.25,.25,1),this.backgroundEffect=null,this.backgroundRenderingEnabled=1,this.clearColor=n.I.fromValues(0,0,0,0),this.lodEnabled=!1,this.fogStart=0,this.fogEnd=0,this.fogMax=0,this.fogType=0,this.fogBlur=0,this.fogColor=n.I.fromValues(.25,.25,.25,1),this.sunDirection=n.H.fromValues(1,-1,1),this.sunDiffuseColor=n.I.fromValues(1,1,1,1),this.envMapScaling=n.H.fromValues(1,1,1),this.envMapRotation=n.C.create(),this.envMapResPath="",this.envMap1ResPath="",this.envMap2ResPath="",this.envMap3ResPath="",this.envMapRes=null,this.envMap1Res=null,this.envMap2Res=null,this.envMap3Res=null,this.renderDebugInfo=!1,this._debugHelper=null,this._batches=new s.Tw2BatchAccumulator,this._perFrameVS=new s.Tw2RawData(e.perFrameData.VSData),this._perFramePS=new s.Tw2RawData(e.perFrameData.PSData),e.init()}var t,r,i;return t=e,i=[{key:"init",value:function(){e.global||(e.global={vec3_0:n.H.create(),vec4_0:n.I.create(),mat4_0:n.z.create(),mat4_1:n.z.create(),mat4_2:n.z.create(),mat4_ID:n.z.create(),frustum:new s.Tw2Frustum,emptyTexture:n.D.GetResource("res:/texture/global/black.dds.0.png")})}}],(r=[{key:"Initialize",value:function(){this.SetEnvMapPath(0,this.envMapResPath),this.SetEnvMapPath(1,this.envMap1ResPath),this.SetEnvMapPath(2,this.envMap2ResPath),this.SetEnvMapPath(3,this.envMap3ResPath)}},{key:"SetEnvMapReflection",value:function(e){this.SetEnvMapPath(0,e)}},{key:"SetEnvMapDiffuse",value:function(e){this.SetEnvMapPath(1,e)}},{key:"SetEnvMapBlur",value:function(e){this.SetEnvMapPath(2,e)}},{key:"SetEnvMapPath",value:function(e,t){var r=(e,t,r)=>(e=e.toLowerCase(),this[t]=e,this[r]=""===e?null:n.D.GetResource(e),!0);switch(e){case 0:return r(t,"envMapResPath","envMapRes");case 1:return r(t,"envMap1ResPath","envMap1Res");case 2:return r(t,"envMap2ResPath","envMap2Res");case 3:return r(t,"envMap3ResPath","envMap3Res")}return!1}},{key:"EnableLod",value:function(e){if(this.lodEnabled=e,!e)for(var t=0;t<this.objects.length;++t)this.objects[t].ResetLod&&this.objects[t].ResetLod()}},{key:"KeepAlive",value:function(){for(var e=this.GetResources(),t=0;t<e.length;t++)e[t].KeepAlive()}},{key:"GetResources",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=0;r<this.lensflares.length;r++)this.lensflares[r].GetResources(e);if(this.backgroundEffect&&this.backgroundEffect.GetResources(e),this.envMapRes&&!e.includes(this.envMapRes)&&e.push(this.envMapRes),this.envMap1Res&&!e.includes(this.envMap1Res)&&e.push(this.envMapRes),this.envMap2Res&&!e.includes(this.envMap2Res)&&e.push(this.envMapRes),this.envMap3Res&&!e.includes(this.envMap3Res)&&e.push(this.envMapRes),!t){for(var n=0;n<this.planets.length;n++)this.planets[n].GetResources(e);for(var i=0;i<this.objects.length;i++)"GetResources"in this.objects[i]&&this.objects[i].GetResources(e)}return e}},{key:"Update",value:function(e){for(var t=0;t<this.planets.length;++t)"Update"in this.planets[t]&&this.planets[t].Update(e);for(var r=0;r<this.objects.length;++r)"Update"in this.objects[r]&&this.objects[r].Update(e)}},{key:"RenderBatches",value:function(e,t){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this._batches,n=0;n<t.length;++n)"GetBatches"in t[n]&&t[n].GetBatches(e,r)}},{key:"Render",value:function(){this.ApplyPerFrameData();var t=n.w,r=e.global,i=n.z.identity(r.mat4_ID),a=this.visible;if(a.environment&&this.backgroundEffect&&(t.SetStandardStates(t.RM_FULLSCREEN),t.RenderCameraSpaceQuad(this.backgroundEffect)),a.planets&&this.planets.length){var o=n.z.copy(r.mat4_0,t.projection),s=n.z.copy(r.mat4_1,t.projection),u=1e11;s[10]=u/(1e4-u),s[14]=-10000.0010000001,t.SetProjection(s,!0),this.ApplyPerFrameData();for(var c=0;c<this.planets.length;++c)this.planets[c].UpdateViewDependentData&&this.planets[c].UpdateViewDependentData(i);this._batches.Clear(),t.gl.depthRange(.9,1),this.RenderBatches(t.RM_OPAQUE,this.planets),this.RenderBatches(t.RM_DECAL,this.planets),this.RenderBatches(t.RM_TRANSPARENT,this.planets),this.RenderBatches(t.RM_ADDITIVE,this.planets),this._batches.Render(),t.SetProjection(o,!0),this.ApplyPerFrameData(),t.gl.depthRange(0,.9)}if(this.lodEnabled){r.frustum.Initialize(t.view,t.projection,t.viewportWidth,t.viewInverse,t.viewProjection);for(var l=0;l<this.objects.length;++l)this.objects[l].UpdateLod&&this.objects[l].UpdateLod(r.frustum)}if(a.objects)for(var f=0;f<this.objects.length;++f)this.objects[f].UpdateViewDependentData&&this.objects[f].UpdateViewDependentData(i);if(a.lensflares)for(var h=0;h<this.lensflares.length;++h)this.lensflares[h].PrepareRender();if(this._batches.Clear(),a.planets)for(var d=0;d<this.planets.length;++d)this.planets[d].GetZOnlyBatches(t.RM_OPAQUE,this._batches);if(a.objects&&(this.RenderBatches(t.RM_OPAQUE,this.objects),this.RenderBatches(t.RM_DECAL,this.objects),this.RenderBatches(t.RM_TRANSPARENT,this.objects),this.RenderBatches(t.RM_ADDITIVE,this.objects)),a.lensflares)for(var p=0;p<this.lensflares.length;++p)this.lensflares[p].GetBatches(t.RM_ADDITIVE,this._batches);if(this._batches.Render(),a.lensflares)for(var v=0;v<this.lensflares.length;++v)this.lensflares[v].UpdateOccluders();if(this.renderDebugInfo&&e.DebugRenderer){this._debugHelper||(this._debugHelper=new e.DebugRenderer);for(var y=0;y<this.objects.length;++y)this.objects[y].RenderDebugInfo&&this.objects[y].RenderDebugInfo(this._debugHelper);this._debugHelper.Render()}}},{key:"ApplyPerFrameData",value:function(){var t=n.w,r=e.global,i=r.mat4_2,a=r.vec3_0,o=this.visible;n.z.fromQuat(i,this.envMapRotation),n.z.scale(i,i,this.envMapScaling),n.z.transpose(i,i),n.H.negate(a,this.sunDirection),n.H.normalize(a,a);var s=this.fogEnd-this.fogStart;Math.abs(s)<1e-5&&(s=1e-5);var u=1/s,c=this._perFrameVS;c.Set("FogFactors",[this.fogEnd*u,u,this.visible.fog?this.fogMax:0,1]),c.Set("ViewportAdjustment",[1,1,1,1]),c.Set("MiscSettings",[t.currentTime,0,t.viewportWidth,t.viewportHeight]),c.Set("SunData.DirWorld",a),c.Set("SunData.DiffuseColor",this.sunDiffuseColor),c.Set("TargetResolution",t.targetResolution),c.Set("ViewInverseTransposeMat",t.viewInverse),c.Set("ViewProjectionMat",t.viewProjectionTranspose),c.Set("ViewMat",t.viewTranspose),c.Set("ProjectionMat",t.projectionTranspose),c.Set("EnvMapRotationMat",i),t.perFrameVSData=c;var l=this._perFramePS;l.Set("ViewInverseTransposeMat",t.viewInverse),l.Set("ViewMat",t.viewTranspose),l.Set("EnvMapRotationMat",i),l.Set("SunData.DirWorld",a),l.Set("SunData.DiffuseColor",this.sunDiffuseColor),l.Set("SceneData.AmbientColor",this.ambientColor),l.Set("MiscSettings",[t.currentTime,this.fogType,this.fogBlur,1]),l.Set("SceneData.FogColor",this.fogColor),l.Set("FovXY",[t.targetResolution[3],t.targetResolution[2]]),l.Set("ShadowMapSettings",[1,1,0,0]),l.Set("TargetResolution",t.targetResolution),l.Get("SceneData.NebulaIntensity")[0]=this.nebulaIntensity,l.Get("ViewportSize")[0]=t.viewportWidth,l.Get("ViewportSize")[1]=t.viewportHeight,l.Get("ShadowCameraRange")[0]=1,l.Get("ProjectionToView")[0]=-t.projection[14],l.Get("ProjectionToView")[1]=-t.projection[10]-1,t.perFramePSData=l;var f=this.envMapRes&&o.environmentReflection?this.envMapRes:r.emptyTexture,h=this.envMap1Res&&o.environmentDiffuse?this.envMap1Res:r.emptyTexture,d=this.envMap2Res&&o.environmentBlur?this.envMap2Res:r.emptyTexture,p=this.envMap3Res?this.envMap3Res:r.emptyTexture;n.E.GetVariable("EveSpaceSceneEnvMap").SetTextureRes(f),n.E.GetVariable("EnvMap1").SetTextureRes(h),n.E.GetVariable("EnvMap2").SetTextureRes(d),n.E.GetVariable("EnvMap3").SetTextureRes(p)}}])&&mn(t.prototype,r),i&&mn(t,i),e}();bn(gn,"perFrameData",{PSData:[["ViewInverseTransposeMat",16],["ViewMat",16],["EnvMapRotationMat",16],["SunData.DirWorld",4],["SunData.DiffuseColor",4],["SceneData.AmbientColor",3],["SceneData.NebulaIntensity",1],["SceneData.FogColor",4],["ViewportOffset",2],["ViewportSize",2],["TargetResolution",4],["ShadowMapSettings",4],["ShadowCameraRange",4],["ProjectionToView",2],["FovXY",2],["MiscSettings",4]],VSData:[["ViewInverseTransposeMat",16],["ViewProjectionMat",16],["ViewMat",16],["ProjectionMat",16],["ShadowViewMat",16],["ShadowViewProjectionMat",16],["EnvMapRotationMat",16],["SunData.DirWorld",4],["SunData.DiffuseColor",4],["FogFactors",4],["TargetResolution",4],["ViewportAdjustment",4],["MiscSettings",4]]}),bn(gn,"global",null),bn(gn,"DebugRenderer",window.Tw2DebugRenderer||null);r(12);function _n(){var e=null,t=null;function r(e,t,r){return t in e?e[t]:r}function i(t){return r(e.generic,t?"shaderPrefixAnimated":"shaderPrefix","")}function a(e,t,n,i,a){var o=null;if(r(i,"resPathInsert","").length&&(o=i.resPathInsert),"respathinsert"in a&&1===a.respathinsert.length){if("none"===a.respathinsert[0])return e;o=a.respathinsert[0]}if("MaterialMap"===t||"PaintMaskMap"===t||"PmdgMap"===t){var s=e.lastIndexOf("/"),u=e;if(s>=0&&(u=e.substr(0,s+1)+o+"/"+e.substr(s+1)),(s=u.lastIndexOf("_"))>=0){u=u.substr(0,s)+"_"+o+u.substr(s);var c=r(n,"textureOverrides",{});if(t in c&&i.name in c[t])return u}}return e}function o(e,t){for(var r=0;r<e.length;++r)if(t.substr(0,e[r].length)===e[r])return r;return null}function u(t,n,i,a){var s,u,c,l;return"mesh"in i&&null!==(u=o(s=e.generic.materialPrefixes,t))&&u<i.mesh.length&&0==(r(n,"blockedMaterials",0)&1<<u)&&(c=r(e.material,i.mesh[u],null))?(l=t.substr(s[u].length),r(c.parameters,l,void 0)):(u=o(s=e.generic.patternMaterialPrefixes,t),"pattern"in i&&null!==u&&1+u<i.pattern.length&&(c=r(e.material,i.pattern[1+u],null))||null!==u&&(c=r(e.material,a.defaultPatternLayer1MaterialName,null))?(l=t.substr(s[u].length),r(c.parameters,l,void 0)):void 0)}function c(e){switch(e){case 2:return 4;case 1:return 3;default:return 1}}function l(t,n,o,l,f,h,d,p){for(var v,y,m,b,g=r(o,n,[]),_=0;_<g.length;++_){var R=g[_],E=new s.Tw2Effect;E.effectFilePath=e.generic.areaShaderLocation+(v=p||R.shader,y=o.isSkinned,m=void 0,b=void 0,m=i(y),b=(v="/"+v).lastIndexOf("/"),v.substr(0,b+1)+m+v.substr(b+1));for(var w=r(r(e.generic.areaShaders,R.shader,{}),"parameters",[]),T=0;T<w.length;++T){var S=w[T],O=u(S,R,d,f);(O=(O=(O=(O=O||r(r(r(e.generic.hullAreas,R.name,{}),"parameters",{}),S))||r(r(r(f.hullAreas,R.name,{}),"parameters",{}),S))||r(r(r(l.areas,R.name,{}),"parameters",{}),S))||r(r(R,"parameters",{}),S))&&(E.parameters[S]=new s.Tw2Vector4Parameter(S,O))}var P=r(R,"textures",[]);for(T in P)if(P.hasOwnProperty(T)){var A=P[T];A=a(A,T,R,l,d),E.parameters[T]=new s.Tw2TextureParameter(T,A)}for(T=0;T<h.layers.length;++T)if(h.layers[T]&&!(h.layers[T].textureName in E.parameters)){var I=new s.Tw2TextureParameter(h.layers[T].textureName);I.resourcePath=h.layers[T].textureResFilePath,I.useAllOverrides=!0,I.addressUMode=c(r(h.layers[T],"projectionTypeU",0)),I.addressVMode=c(r(h.layers[T],"projectionTypeV",0)),I.Initialize(),E.parameters[h.layers[T].textureName]=I}var D=r(r(e.generic.areaShaders,R.shader,{}),"defaultTextures",{});for(var C in D)D.hasOwnProperty(C)&&(C in E.parameters||(E.parameters[C]=new s.Tw2TextureParameter(C,D[C])));E.Initialize();var M=new s.Tw2MeshArea;M.name=R.name,M.effect=E,M.index=r(R,"index",0),M.count=r(R,"count",1),t.push(M)}}var f=!1,h=[];function d(t){for(var n=t.split(":"),i={},a=3;a<n.length;++a){var o=n[a].split("?");i[o[0]]=o[1].split(";")}var u=e.hull[n[0]],c=e.faction[n[1]],f=e.race[n[2]],h=new(2===r(u,"buildClass",0)?Be:kt);return function(e,t,n,i,a,o){var u=new s.Tw2Mesh;u.geometryResPath=t.geometryResFilePath,e.boundingSphereCenter[0]=t.boundingSphere[0],e.boundingSphereCenter[1]=t.boundingSphere[1],e.boundingSphereCenter[2]=t.boundingSphere[2],e.boundingSphereRadius=t.boundingSphere[3],l(r(u,"opaqueAreas",[]),"opaqueAreas",t,n,i,o,a),l(r(u,"transparentAreas",[]),"transparentAreas",t,n,i,o,a),l(r(u,"additiveAreas",[]),"additiveAreas",t,n,i,o,a),l(r(u,"decalAreas",[]),"decalAreas",t,n,i,o,a),l(r(u,"depthAreas",[]),"depthAreas",t,n,i,o,a),u.Initialize(),e.mesh=u,"shapeEllipsoidCenter"in t&&(e.shapeEllipsoidCenter=t.shapeEllipsoidCenter),"shapeEllipsoidRadius"in t&&(e.shapeEllipsoidRadius=t.shapeEllipsoidRadius)}(h,u,c,f,i,function(t,n,i){var a={patterns:[],layers:[]};if("pattern"in i){for(var o={},s=0;s<e.pattern.length;++s)if(e.pattern[s].name===i.pattern[0]){o=e.pattern[s];break}var u=r(o,"layer1",null);u&&a.layers.push(u),(u=r(o,"layer2",null))&&a.layers.push(u);for(var c=r(o,"projections",[]),l=0;l<c.length;++l)c[l].name===t.name&&((u=r(o=c[l],"transformLayer1",null))&&a.patterns.push(u),(u=r(o,"transformLayer2",null))&&a.patterns.push(u))}else r(t,"defaultPattern")&&(o=r(t,"defaultPattern",{}),(u=r(o,"transformLayer1",null))&&a.patterns.push(u),(u=r(o,"transformLayer2",null))&&a.patterns.push(u),o=r(n,"defaultPattern",{}),(u=r(o,"layer1",null))&&a.layers.push(u),(u=r(o,"layer2",null))&&a.layers.push(u));return a}(u,f,i)),h.Initialize(),h}function p(t,n,i){for(var a=-1,o=0;o<e.generic.materialPrefixes.length;++o)t.substr(0,e.generic.materialPrefixes[o].length)===e.generic.materialPrefixes[o]&&(a=o,t=t.substr(e.generic.materialPrefixes[o].length));if(-1!==a){var s=r(n,"materialUsageMtl"+(a+1),a);if(s>=0&&s<e.generic.materialPrefixes.length&&(t=e.generic.materialPrefixes[s]+t)in i.parameters)return i.parameters[t]}}this.LoadData=function(r){null===e?(r&&h.push(r),f||((t=new s.Tw2Effect).effectFilePath="res:/graphics/effect/managed/space/spaceobject/fx/blinkinglightspool.fx",t.parameters.MainIntensity=new s.Tw2FloatParameter("MainIntensity",1),t.parameters.GradientMap=new s.Tw2TextureParameter("GradientMap","res:/texture/particle/whitesharp_gradient.dds.0.png"),t.Initialize(),n.D.GetObject("res:/dx9/model/spaceobjectfactory/data.red",(function(t){e=t;for(var r=0;r<h.length;++r)h[r]();h=[]})),f=!0)):r&&r()},this.BuildFromDNA=function(t,r){if(null===e)this.LoadData((function(){var e=d(t);r&&r(e)}));else{var n=d(t);r&&r(n)}};var v=[0,0,0,0];function y(e,t,r,n){switch(n){case"overridable":return t||(r||v);case"half_overridable":return e.indexOf("GlowColor")>=0?r||v:t||(r||v);case"not_overridable":case"half_overridable_2":return r||v}return v}function m(t,r,i){var a=e.faction[r],o=e.faction[i],u=null;a&&a.areas&&"hull"in a.areas&&(u=a.areas.hull);var c=null;if(o&&o.areas&&"hull"in o.areas&&(c=o.areas.hull),(u||c)&&t.turretEffect){var l=t.turretEffect.parameters;for(var f in l)if(l.hasOwnProperty(f)){if(l[f].constructor.prototype!==s.Tw2Vector4Parameter.prototype)continue;var h=null,d=null;u&&(h=p(f,a,u)),c&&(d=p(f,a,u)),n.I.copy(l[f].value,y(f,h,d,t.turretEffect.name))}t.turretEffect.BindParameters()}}function b(t){if("all"!==t){var r={};for(var n in e[t])e[t].hasOwnProperty(n)&&(r[n]=e[t][n].description||"");return r}return e}this.SetupTurretMaterial=function(t,r,n,i){null===e?this.LoadData((function(){m(t,r,n),i&&i()})):(m(t,r,n),i&&i())},this.GetHullNames=function(e){this.LoadData((function(){e(b("hull"))}))},this.GetFactionNames=function(e){this.LoadData((function(){e(b("faction"))}))},this.GetRaceNames=function(e){this.LoadData((function(){e(b("race"))}))},this.GetSofData=function(e){this.LoadData((function(){e(b("all"))}))}}},function(e,t){},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),i=r(1),a=r(19),o=r(5);function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"_id",n.F.generateID()),u(this,"name",""),u(this,"aliveCount",0),u(this,"maxParticleCount",0),u(this,"emitParticleOnDeathEmitter",null),u(this,"emitParticleDuringLifeEmitter",null),u(this,"elements",[]),u(this,"isValid",!1),u(this,"requiresSorting",!1),u(this,"updateSimulation",!0),u(this,"applyForce",!0),u(this,"applyAging",!0),u(this,"isGlobal",!1),u(this,"forces",[]),u(this,"constraints",[]),u(this,"updateBoundingBox",!1),u(this,"aabbMin",n.H.create()),u(this,"aabbMax",n.H.create()),u(this,"peakAliveCount",0),u(this,"bufferDirty",!1),u(this,"_vb",null),u(this,"_declaration",null),u(this,"_stdElements",[null,null,null,null]),u(this,"_elements",[]),u(this,"instanceStride",[null,null]),u(this,"vertexStride",[null,null]),u(this,"buffers",[null,null]),e.init()}var t,r,c;return t=e,c=[{key:"init",value:function(){e.global||(e.global={vec3_0:n.H.create(),mat4_0:n.z.create()})}}],(r=[{key:"Initialize",value:function(){this.UpdateElementDeclaration()}},{key:"UpdateElementDeclaration",value:function(){this.isValid=!1;var e=n.w.gl;if(this._vb&&(e.deleteBuffer(this._vb),this._vb=null),this._declaration=null,this.aliveCount=0,0!==this.elements.length){this._stdElements=[null,null,null,null],this._elements=[],this.instanceStride=[0,0],this.vertexStride=[0,0],this._declaration=new i.Tw2VertexDeclaration,this.buffers=[null,null];for(var t=0;t<this.elements.length;++t){var r=this.elements[t].usedByGPU?0:1,s=new a.a(this.elements[t]);if(s.startOffset=this.vertexStride[r],s.offset=s.startOffset,this.elements[t].elementType!==o.a.Type.CUSTOM&&(this._stdElements[this.elements[t].elementType]=s),this.vertexStride[r]+=s.dimension,this._elements.push(s),0===r){var u=this.elements[t].GetDeclaration();u.offset=4*s.startOffset,this._declaration.elements.push(u)}}this._declaration.RebuildHash();for(var c=0;c<this._elements.length;++c){var l=this._elements[c].usedByGPU?0:1;this._elements[c].vertexStride=this.vertexStride[l]}this.instanceStride[0]=4*this.vertexStride[0],this.instanceStride[1]=4*this.vertexStride[1];for(var f=0;f<this._elements.length;++f){var h=this._elements[f].usedByGPU?0:1;this._elements[f].instanceStride=this.instanceStride[h]}this.buffers=[null,null],this.instanceStride[0]&&this.maxParticleCount&&(this.buffers[0]=new Float32Array(this.instanceStride[0]*this.maxParticleCount),this._vb=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._vb),e.bufferData(e.ARRAY_BUFFER,this.buffers[0].length,e.DYNAMIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,null)),this.instanceStride[1]&&(this.buffers[1]=new Float32Array(this.instanceStride[1]*this.maxParticleCount));for(var d=0;d<this._elements.length;++d){var p=this._elements[d].usedByGPU?0:1;this._elements[d].buffer=this.buffers[p]}this.requiresSorting&&(this._sortedIndexes=new Array(this.maxParticleCount),this._sortedBuffer=new Float32Array(this.instanceStride[0]*this.maxParticleCount),this._distancesBuffer=new Float32Array(this.maxParticleCount)),this.isValid=!0,this.bufferDirty=!0}}},{key:"HasElement",value:function(e){return null!==this._stdElements[e]}},{key:"GetElement",value:function(e){return this._stdElements[e]&&(this._stdElements[e].offset=this._stdElements[e].startOffset),this._stdElements[e]}},{key:"BeginSpawnParticle",value:function(){return!this.isValid||this.aliveCount>=this.maxParticleCount?null:this.aliveCount++}},{key:"EndSpawnParticle",value:function(){this.bufferDirty=!0}},{key:"Update",value:function(t){if(t=Math.min(t,.1),this.applyAging&&this.HasElement(o.a.Type.LIFETIME)){for(var r=this.GetElement(o.a.Type.LIFETIME),i=this.emitParticleOnDeathEmitter?this.GetElement(o.a.Type.POSITION):null,a=this.emitParticleOnDeathEmitter?this.GetElement(o.a.Type.VELOCITY):null,s=0;s<this.aliveCount;++s)if(r.buffer[r.offset]+=t/r.buffer[r.offset+1],r.buffer[r.offset]>1){if(this.emitParticleOnDeathEmitter&&this.emitParticleOnDeathEmitter.SpawnParticles(i,a,1),this.aliveCount--,s<this.aliveCount){for(var u=0;u<2;++u)this.buffers[u]&&this.buffers[u].set(this.buffers[u].subarray(this.instanceStride[u]*this.aliveCount,this.instanceStride[u]*this.aliveCount+this.instanceStride[u]),s*this.instanceStride[u]);--s,this.bufferDirty=!0}}else r.offset+=r.instanceStride,i&&(i.offset+=i.instanceStride),a&&(a.offset+=a.instanceStride);r.dirty=!0}var c=e.global.vec3_0;if(this.updateSimulation&&this.HasElement(o.a.Type.POSITION)&&this.HasElement(o.a.Type.VELOCITY)){for(var l=this.applyForce&&this.forces.length,f=0;f<this.forces.length;++f)this.forces[f].Update(t);for(var h=this.GetElement(o.a.Type.POSITION),d=this.GetElement(o.a.Type.VELOCITY),p=l?this.GetElement(o.a.Type.MASS):null,v=0;v<this.aliveCount;++v){if(l){for(var y=p?p.buffer[p.offset]:1,m=n.H.set(c,0,0,0),b=0;b<this.forces.length;++b)this.forces[b].ApplyForce(h,d,m,t,y);p&&n.H.scale(m,m,1/p.buffer[p.offset]),d.buffer[d.offset]+=m[0]*t,d.buffer[d.offset+1]+=m[1]*t,d.buffer[d.offset+2]+=m[2]*t}h.buffer[h.offset]+=d.buffer[d.offset]*t,h.buffer[h.offset+1]+=d.buffer[d.offset+1]*t,h.buffer[h.offset+2]+=d.buffer[d.offset+2]*t,this.emitParticleDuringLifeEmitter&&this.emitParticleDuringLifeEmitter.SpawnParticles(h,d,t),h.offset+=h.instanceStride,d.offset+=d.instanceStride,p&&(p.offset+=p.instanceStride)}h.dirty=!0,d.dirty=!0}if(this.updateSimulation&&this.constraints.length)for(var g=0;g<this.constraints.length;++g)this.constraints[g].ApplyConstraint(this.buffers,this.instanceStride,this.aliveCount,t);if(this.updateBoundingBox&&this.GetBoundingBox(this.aabbMin,this.aabbMax),this.emitParticleDuringLifeEmitter&&(!this.HasElement(o.a.Type.POSITION)||!this.HasElement(o.a.Type.VELOCITY))&&this.updateSimulation)for(var _=this.GetElement(o.a.Type.POSITION),R=this.GetElement(o.a.Type.VELOCITY),E=0;E<this.aliveCount;++E)this.emitParticleDuringLifeEmitter.SpawnParticles(_,R,1),_&&(_.offset+=_.instanceStride),R&&(R.offset+=R.instanceStride);for(var w=0;w<this._elements.length;++w){var T=this._elements[w];T.offset=T.startOffset,T.dirty&&(this.bufferDirty=!0,T.dirty=!1)}}},{key:"GetBoundingBox",value:function(e,t){if(this.aliveCount&&this.HasElement(o.a.Type.POSITION)){var r=this.GetElement(o.a.Type.POSITION);e[0]=r.buffer[r.offset],e[1]=r.buffer[r.offset+1],e[2]=r.buffer[r.offset+2],t[0]=r.buffer[r.offset],t[1]=r.buffer[r.offset+1],t[2]=r.buffer[r.offset+2];for(var n=0;n<this.aliveCount;++n)e[0]=Math.min(e[0],r.buffer[r.offset]),e[1]=Math.min(e[1],r.buffer[r.offset+1]),e[2]=Math.min(e[2],r.buffer[r.offset+2]),t[0]=Math.max(t[0],r.buffer[r.offset]),t[1]=Math.max(t[1],r.buffer[r.offset+1]),t[2]=Math.max(t[2],r.buffer[r.offset+2]),r.offset+=r.instanceStride;return!0}return!1}},{key:"_Sort",value:function(){for(var t=n.z.multiply(e.global.mat4_0,n.w.projection,n.w.view),r=this.GetElement(o.a.Type.POSITION),i=this.aliveCount,a=this._distancesBuffer,s=0;s<i;++s){var u=r.offset+r.instanceStride*s,c=r.buffer[u]-t[12],l=c*c;l+=(c=r.buffer[u+1]-t[13])*c,l+=(c=r.buffer[u+2]-t[14])*c,a[s]=l}for(var f=0;f<this.maxParticleCount;++f)this._sortedIndexes[f]=f;this._sortedIndexes.sort((function(e,t){if(e>=i&&t>=i)return e<t?-1:e>t?1:0;if(e>=i)return 1;if(t>=i)return-1;var r=a[e],n=a[t];return r<n?1:r>n?-1:0}))}},{key:"GetInstanceBuffer",value:function(){if(0!==this.aliveCount){var e=n.w.gl;if(this.requiresSorting&&this.HasElement(o.a.Type.POSITION)&&this.buffers){this._Sort();for(var t=this.instanceStride[0],r=this.buffers[0],i=0;i<this.aliveCount;++i)for(var a=i*t,s=this._sortedIndexes[i]*t,u=0;u<t;++u)this._sortedBuffer[a+u]=r[u+s];e.bindBuffer(e.ARRAY_BUFFER,this._vb),e.bufferSubData(e.ARRAY_BUFFER,0,this._sortedBuffer.subarray(0,this.vertexStride[0]*this.aliveCount)),this.bufferDirty=!1}else this.bufferDirty&&(e.bindBuffer(e.ARRAY_BUFFER,this._vb),e.bufferSubData(e.ARRAY_BUFFER,0,this.buffers[0].subarray(0,this.vertexStride[0]*this.aliveCount)),this.bufferDirty=!1);return this._vb}}},{key:"GetInstanceDeclaration",value:function(){return this._declaration}},{key:"GetInstanceStride",value:function(){return this.instanceStride[0]}},{key:"GetInstanceCount",value:function(){return this.aliveCount}}])&&s(t.prototype,r),c&&s(t,c),e}();u(c,"global",null)},function(e,t,r){"use strict";r.d(t,"a",(function(){return v})),r.d(t,"b",(function(){return T})),r.d(t,"c",(function(){return k})),r.d(t,"d",(function(){return V})),r.d(t,"e",(function(){return Z})),r.d(t,"f",(function(){return oe}));var n=r(0);function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"_id",n.F.generateID()),a(this,"name","")}var t,r,o;return t=e,(r=[{key:"ApplyForce",value:function(e,t,r,n,i){}},{key:"Update",value:function(e){}}])&&i(t.prototype,r),o&&i(t,o),e}();function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t=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(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?h(e):t}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(o,"global",{vec3_0:n.H.create(),vec3_1:n.H.create(),vec4_0:n.I.create()});var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(f,e);var t,r,i,a=l(f);function f(){var e;s(this,f);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return p(h(e=a.call(this,...r)),"magnitude",0),p(h(e),"position",n.H.create()),e}return t=f,(r=[{key:"ApplyForce",value:function(e,t,r){var i=o.global.vec3_0;i[0]=this.position[0]-e.buffer[e.offset],i[1]=this.position[1]-e.buffer[e.offset+1],i[2]=this.position[2]-e.buffer[e.offset+2],n.H.normalize(i,i),n.H.scale(i,i,this.magnitude),n.H.add(r,r,i)}}])&&u(t.prototype,r),i&&u(t,i),f}(o);function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=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(e){return!1}}();return function(){var r,n=E(e);if(t){var i=E(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _(this,r)}}function _(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?R(e):t}function R(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var T=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(o,e);var t,r,i,a=g(o);function o(){var e;y(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return w(R(e=a.call(this,...r)),"force",n.H.create()),e}return t=o,(r=[{key:"ApplyForce",value:function(e,t,r){n.H.add(r,r,this.force)}}])&&m(t.prototype,r),i&&m(t,i),o}(o);function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=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(e){return!1}}();return function(){var r,n=C(e);if(t){var i=C(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return I(this,r)}}function I(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?D(e):t}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&P(e,t)}(a,e);var t,r,n,i=A(a);function a(){var e;S(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return M(D(e=i.call(this,...r)),"drag",.1),e}return t=a,(r=[{key:"ApplyForce",value:function(e,t,r){r[0]+=t.buffer[t.offset]*-this.drag,r[1]+=t.buffer[t.offset+1]*-this.drag,r[2]+=t.buffer[t.offset+2]*-this.drag}}])&&O(t.prototype,r),n&&O(t,n),a}(o);function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function G(e,t){return(G=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function F(e){var t=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(e){return!1}}();return function(){var r,n=U(e);if(t){var i=U(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return L(this,r)}}function L(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?B(e):t}function B(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var V=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&G(e,t)}(s,e);var t,r,i,a=F(s);function s(){var e;x(this,s);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return N(B(e=a.call(this,...r)),"drag",.1),e}return t=s,(r=[{key:"ApplyForce",value:function(e,t,r,i,a){var s=o.global.vec3_0,u=o.global.vec3_1,c=Math.sqrt(t.buffer[t.offset]*t.buffer[t.offset]+t.buffer[t.offset+1]*t.buffer[t.offset+1]+t.buffer[t.offset+2]*t.buffer[t.offset+2]);s[0]=t.buffer[t.offset]*-c*this.drag,s[1]=t.buffer[t.offset+1]*-c*this.drag,s[2]=t.buffer[t.offset+2]*-c*this.drag,n.H.scale(u,s,i*a),u[0]+=t.buffer[t.offset],u[1]+=t.buffer[t.offset+1],u[2]+=t.buffer[t.offset+2],t.buffer[t.offset]*u[0]+t.buffer[t.offset+1]*u[1]+t.buffer[t.offset+2]*u[2]<0?(r[0]=-t.buffer[t.offset]/i/a,r[1]=-t.buffer[t.offset+1]/i/a,r[2]=-t.buffer[t.offset+2]/i/a):n.H.copy(r,s)}}])&&j(t.prototype,r),i&&j(t,i),s}(o);function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e){var t=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(e){return!1}}();return function(){var r,n=K(e);if(t){var i=K(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Y(this,r)}}function Y(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?W(e):t}function W(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function K(e){return(K=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Q(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)}(o,e);var t,r,i,a=X(o);function o(){var e;H(this,o);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Q(W(e=a.call(this,...r)),"springConstant",0),Q(W(e),"position",n.H.create()),e}return t=o,(r=[{key:"ApplyForce",value:function(e,t,r){r[0]+=(this.position[0]-e.buffer[e.offset])*this.springConstant,r[1]+=(this.position[1]-e.buffer[e.offset+1])*this.springConstant,r[2]+=(this.position[2]-e.buffer[e.offset+2])*this.springConstant}}])&&z(t.prototype,r),i&&z(t,i),o}(o);function J(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(e){var t=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(e){return!1}}();return function(){var r,n=ie(e);if(t){var i=ie(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return re(this,r)}}function re(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?ne(e):t}function ne(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ae(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var oe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ee(e,t)}(s,e);var t,r,i,a=te(s);function s(){var e;J(this,s);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return ae(ne(e=a.call(this,...r)),"noiseLevel",3),ae(ne(e),"noiseRatio",.5),ae(ne(e),"amplitude",n.H.fromValues(1,1,1)),ae(ne(e),"frequency",n.I.fromValues(1,1,1,1)),ae(ne(e),"_time",0),e}return t=s,(r=[{key:"ApplyForce",value:function(e,t,r){if(0!==this.noiseLevel){for(var i=e.buffer[e.offset]*this.frequency[0],a=e.buffer[e.offset+1]*this.frequency[1],s=e.buffer[e.offset+2]*this.frequency[2],u=this._time*this.frequency[3],c=0,l=.5,f=1/this.noiseRatio,h=n.I.set(o.global.vec4_0,0,0,0,0),d=0;d<this.noiseLevel;++d)n.A.turbulence(h,i,a,s,u,l),c+=l,i*=f,a*=f,s*=f,u*=f,l*=this.noiseRatio;r[0]+=h[0]*this.amplitude[0]*c,r[1]+=h[1]*this.amplitude[1]*c,r[2]+=h[2]*this.amplitude[2]*c}}},{key:"Update",value:function(e){this._time+=e}}])&&$(t.prototype,r),i&&$(t,i),s}(o)},function(e,t,r){"use strict";r.d(t,"c",(function(){return y})),r.d(t,"a",(function(){return S})),r.d(t,"b",(function(){return k}));var n=r(0),i=r(1);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"_id",n.F.generateID()),o(this,"name",""),o(this,"particleSystem",null)}var t,r,i;return t=e,(r=[{key:"Initialize",value:function(){}},{key:"Update",value:function(e){}}])&&a(t.prototype,r),i&&a(t,i),e}();function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=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(e){return!1}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?d(e):t}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(s,e);var t,r,a,o=f(s);function s(){var e;u(this,s);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return v(d(e=o.call(this,...r)),"geometryResourcePath",""),v(d(e),"geometryResource",null),v(d(e),"geometryIndex",0),v(d(e),"_spawned",!1),e}return t=s,(r=[{key:"Initialize",value:function(){""!==this.geometryResourcePath&&(this.geometryResource=n.D.GetResource(this.geometryResourcePath),this.geometryResource.systemMirror=!0,this.geometryResource.RegisterNotification(this)),this._spawned=!1}},{key:"RebuildCachedData",value:function(){this.geometryResource&&this.geometryResource.meshes.length&&(this.geometryResource.meshes[0].bufferData||(this.geometryResource.systemMirror=!0,this.geometryResource.Reload()))}},{key:"Update",value:function(){var e=this.geometryResource;if(!this._spawned&&this.particleSystem&&e&&e.IsGood()&&e.meshes.length>this.geometryIndex&&e.meshes[this.geometryIndex].bufferData){this._spawned=!0;for(var t=e.meshes[this.geometryIndex],r=this.particleSystem.elements,n=new Array(r.length),a=0;a<r.length;++a){var o=r[a].GetDeclaration(),s=t.declaration.FindUsage(o.usage,o.usageIndex-8);if(null===s)return void e.OnError(new i.ErrGeometryMeshMissingParticleElement({path:e.path,elementUsage:o.usage,elementUsageIndex:o.usageIndex}));if(s.elements<o.elements)return void e.OnError(new i.ErrGeometryMeshElementComponentsMissing({path:e.path,inputCount:s.elements,elementCount:o.elements,elementUsage:o.usage,elementUsageIndex:o.usageIndex}));n[a]=s.offset/4}for(var u=t.bufferData.length/t.declaration.stride*4,c=0;c<u;++c){var l=this.particleSystem.BeginSpawnParticle();if(null===l)break;for(var f=0;f<this.particleSystem._elements.length;++f)for(var h=this.particleSystem._elements[f],d=0;d<h.dimension;++d)h.buffer[h.instanceStride*l+h.startOffset+d]=t.bufferData[n[f]+d+c*t.declaration.stride/4];this.particleSystem.EndSpawnParticle()}}}}])&&c(t.prototype,r),a&&c(t,a),s}(s);function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=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(e){return!1}}();return function(){var r,n=w(e);if(t){var i=w(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return R(this,r)}}function R(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?E(e):t}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(a,e);var t,r,n,i=_(a);function a(){var e;m(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return T(E(e=i.call(this,...r)),"rate",0),T(E(e),"isValid",!1),T(E(e),"_accumulatedRate",0),T(E(e),"generators",[]),e}return t=a,(r=[{key:"Initialize",value:function(){this.Rebind()}},{key:"Update",value:function(e){this.SpawnParticles(null,null,Math.min(e,.1))}},{key:"Rebind",value:function(){if(this.isValid=!1,this.particleSystem){for(var e=0;e<this.generators.length;++e)if(!this.generators[e].Bind(this.particleSystem))return;this.isValid=!0}}},{key:"SpawnParticles",value:function(e,t,r){if(this.isValid){this._accumulatedRate+=this.rate*r;var n=Math.floor(this._accumulatedRate);this._accumulatedRate-=n;for(var i=0;i<n;++i){var a=this.particleSystem.BeginSpawnParticle();if(null===a)break;for(var o=0;o<this.generators.length;++o)this.generators[o].Generate(e,t,a);this.particleSystem.EndSpawnParticle()}}}}])&&b(t.prototype,r),n&&b(t,n),a}(s);function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=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(e){return!1}}();return function(){var r,n=C(e);if(t){var i=C(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return I(this,r)}}function I(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?D(e):t}function D(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&P(e,t)}(r,e);var t=A(r);function r(){var e;O(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return M(D(e=t.call(this,...a)),"angle",0),M(D(e),"innerAngle",0),M(D(e),"drag",0),M(D(e),"rate",0),M(D(e),"radius",0),M(D(e),"gravity",0),M(D(e),"maxSpeed",0),M(D(e),"minSpeed",0),M(D(e),"minLifeTime",0),M(D(e),"maxLifeTime",0),M(D(e),"sizeVariance",0),M(D(e),"attractorPosition",n.H.create()),M(D(e),"attractorStrength",0),M(D(e),"turbulenceAmplitude",0),M(D(e),"turbulenceFrequency",0),M(D(e),"textureIndex",0),M(D(e),"sizes",n.H.create()),M(D(e),"position",n.H.create()),M(D(e),"color0",n.I.create()),M(D(e),"color1",n.I.create()),M(D(e),"color2",n.I.create()),M(D(e),"color3",n.I.create()),e}return r}(s);M(k,"partialImplementation",!0)},function(e,t,r){"use strict";r.d(t,"a",(function(){return y})),r.d(t,"b",(function(){return S})),r.d(t,"c",(function(){return x}));var n=r(0),i=r(5);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"_id",n.F.generateID()),o(this,"name","")}var t,r,i;return t=e,(r=[{key:"Bind",value:function(e){return!1}},{key:"Generate",value:function(e,t,r){}}])&&a(t.prototype,r),i&&a(t,i),e}();function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function f(e){var t=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(e){return!1}}();return function(){var r,n=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return h(this,r)}}function h(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?d(e):t}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}o(s,"global",{vec3_0:n.H.create()});var y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(s,e);var t,r,a,o=f(s);function s(){var e;u(this,s);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return v(d(e=o.call(this,...r)),"elementType",i.a.Type.CUSTOM),v(d(e),"customName",""),v(d(e),"minRange",n.I.create()),v(d(e),"maxRange",n.I.create()),v(d(e),"_element",null),e}return t=s,(r=[{key:"Bind",value:function(e){for(var t=0;t<e._elements.length;++t)if(e._elements[t].elementType===this.elementType&&(this.elementType!==i.a.Type.CUSTOM||e._elements[t].customName===this.customName))return this._element=e._elements[t],!0;return!1}},{key:"Generate",value:function(e,t,r){for(var n=0;n<this._element.dimension;++n)this._element.buffer[this._element.instanceStride*r+this._element.startOffset+n]=Math.floor(this.minRange[n]+Math.random()*(this.maxRange[n]-this.minRange[n])+.5)}}])&&c(t.prototype,r),a&&c(t,a),s}(s);function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e){var t=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(e){return!1}}();return function(){var r,n=w(e);if(t){var i=w(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return R(this,r)}}function R(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?E(e):t}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(s,e);var t,r,a,o=_(s);function s(){var e;m(this,s);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return T(E(e=o.call(this,...r)),"elementType",i.a.Type.CUSTOM),T(E(e),"customName",""),T(E(e),"minRange",n.I.create()),T(E(e),"maxRange",n.I.create()),T(E(e),"_element",null),e}return t=s,(r=[{key:"Bind",value:function(e){for(var t=0;t<e._elements.length;++t)if(e._elements[t].elementType===this.elementType&&(this.elementType!==i.a.Type.CUSTOM||e._elements[t].customName===this.customName))return this._element=e._elements[t],!0;return!1}},{key:"Generate",value:function(e,t,r){for(var n=0;n<this._element.dimension;++n)this._element.buffer[this._element.instanceStride*r+this._element.startOffset+n]=this.minRange[n]+Math.random()*(this.maxRange[n]-this.minRange[n])}}])&&b(t.prototype,r),a&&b(t,a),s}(s);function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=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(e){return!1}}();return function(){var r,n=M(e);if(t){var i=M(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return D(this,r)}}function D(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?C(e):t}function C(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(u,e);var t,r,a,o=I(u);function u(){var e;O(this,u);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return k(C(e=o.call(this,...r)),"minRadius",0),k(C(e),"maxRadius",0),k(C(e),"minPhi",0),k(C(e),"maxPhi",360),k(C(e),"minTheta",0),k(C(e),"maxTheta",360),k(C(e),"controlPosition",!0),k(C(e),"controlVelocity",!0),k(C(e),"minSpeed",0),k(C(e),"maxSpeed",0),k(C(e),"parentVelocityFactor",1),k(C(e),"position",n.H.create()),k(C(e),"rotation",n.C.create()),k(C(e),"_position",null),k(C(e),"_velocity",null),e}return t=u,(r=[{key:"Bind",value:function(e){this._position=null,this._velocity=null;for(var t=0;t<e._elements.length;++t)e._elements[t].elementType===i.a.Type.POSITION&&this.controlPosition?this._position=e._elements[t]:e._elements[t].elementType===i.a.Type.VELOCITY&&this.controlVelocity&&(this._velocity=e._elements[t]);return!(this.controlPosition&&null===this._position||this.controlVelocity&&null===this._velocity)}},{key:"Generate",value:function(e,t,r){var i=(this.minPhi+Math.random()*(this.maxPhi-this.minPhi))/180*Math.PI,a=(this.minTheta+Math.random()*(this.maxTheta-this.minTheta))/180*Math.PI,o=s.global.vec3_0;if(o[0]=Math.sin(i)*Math.cos(a),o[1]=-Math.cos(i),o[2]=Math.sin(i)*Math.sin(a),n.H.transformQuat(o,o,this.rotation),this._velocity){var u=this.minSpeed+Math.random()*(this.maxSpeed-this.minSpeed),c=this._velocity.instanceStride*r+this._velocity.startOffset;this._velocity.buffer[c]=o[0]*u,this._velocity.buffer[c+1]=o[1]*u,this._velocity.buffer[c+2]=o[2]*u,t&&(this._velocity.buffer[c]+=t.buffer[t.offset]*this.parentVelocityFactor,this._velocity.buffer[c+1]+=t.buffer[t.offset+1]*this.parentVelocityFactor,this._velocity.buffer[c+2]+=t.buffer[t.offset+2]*this.parentVelocityFactor)}if(this._position){n.H.scale(o,o,this.minRadius+Math.random()*(this.maxRadius-this.minRadius)),n.H.add(o,o,this.position),e&&(o[0]+=e.buffer[e.offset],o[1]+=e.buffer[e.offset+1],o[2]+=e.buffer[e.offset+2]);var l=this._position.instanceStride*r+this._position.startOffset;this._position.buffer[l]=o[0],this._position.buffer[l+1]=o[1],this._position.buffer[l+2]=o[2]}}}])&&P(t.prototype,r),a&&P(t,a),u}(s)},function(e,t,r){"use strict";r.r(t);var n=r(4);r.d(t,"math",(function(){return n}));var i=r(1),a=r(12),o=r(20),s=r(18),u=r(0);for(var c in r.d(t,"util",(function(){return u.F})),r.d(t,"device",(function(){return u.w})),r.d(t,"store",(function(){return u.E})),r.d(t,"resMan",(function(){return u.D})),r.d(t,"logger",(function(){return u.x})),r.d(t,"consts",(function(){return u.u})),r.d(t,"Tw2BatchAccumulator",(function(){return i.Tw2BatchAccumulator})),r.d(t,"Tw2ForwardingRenderBatch",(function(){return i.Tw2ForwardingRenderBatch})),r.d(t,"Tw2GeometryBatch",(function(){return i.Tw2GeometryBatch})),r.d(t,"Tw2GeometryLineBatch",(function(){return i.Tw2GeometryLineBatch})),r.d(t,"Tw2RenderBatch",(function(){return i.Tw2RenderBatch})),r.d(t,"Tw2InstancedMeshBatch",(function(){return i.Tw2InstancedMeshBatch})),r.d(t,"Tw2CurveSet",(function(){return i.Tw2CurveSet})),r.d(t,"Tw2ValueBinding",(function(){return i.Tw2ValueBinding})),r.d(t,"Tw2BasicPerObjectData",(function(){return i.Tw2BasicPerObjectData})),r.d(t,"EveBasicPerObjectData",(function(){return i.EveBasicPerObjectData})),r.d(t,"Tw2PerObjectData",(function(){return i.Tw2PerObjectData})),r.d(t,"Tw2RawData",(function(){return i.Tw2RawData})),r.d(t,"Tw2BlendShapeData",(function(){return i.Tw2BlendShapeData})),r.d(t,"Tw2GeometryAnimation",(function(){return i.Tw2GeometryAnimation})),r.d(t,"Tw2GeometryBone",(function(){return i.Tw2GeometryBone})),r.d(t,"Tw2GeometryCurve",(function(){return i.Tw2GeometryCurve})),r.d(t,"Tw2GeometryMesh",(function(){return i.Tw2GeometryMesh})),r.d(t,"Tw2GeometryMeshArea",(function(){return i.Tw2GeometryMeshArea})),r.d(t,"Tw2GeometryMeshBinding",(function(){return i.Tw2GeometryMeshBinding})),r.d(t,"Tw2GeometryModel",(function(){return i.Tw2GeometryModel})),r.d(t,"Tw2GeometrySkeleton",(function(){return i.Tw2GeometrySkeleton})),r.d(t,"Tw2GeometryTrackGroup",(function(){return i.Tw2GeometryTrackGroup})),r.d(t,"Tw2GeometryTransformTrack",(function(){return i.Tw2GeometryTransformTrack})),r.d(t,"Tw2Effect",(function(){return i.Tw2Effect})),r.d(t,"Tw2InstancedMesh",(function(){return i.Tw2InstancedMesh})),r.d(t,"Tw2Mesh",(function(){return i.Tw2Mesh})),r.d(t,"Tw2MeshArea",(function(){return i.Tw2MeshArea})),r.d(t,"Tw2MeshLineArea",(function(){return i.Tw2MeshLineArea})),r.d(t,"Tw2Animation",(function(){return i.Tw2Animation})),r.d(t,"Tw2AnimationController",(function(){return i.Tw2AnimationController})),r.d(t,"Tw2Bone",(function(){return i.Tw2Bone})),r.d(t,"Tw2Model",(function(){return i.Tw2Model})),r.d(t,"Tw2Track",(function(){return i.Tw2Track})),r.d(t,"Tw2TrackGroup",(function(){return i.Tw2TrackGroup})),r.d(t,"Tw2Parameter",(function(){return i.Tw2Parameter})),r.d(t,"Tw2VectorParameter",(function(){return i.Tw2VectorParameter})),r.d(t,"Tw2FloatParameter",(function(){return i.Tw2FloatParameter})),r.d(t,"Tw2MatrixParameter",(function(){return i.Tw2MatrixParameter})),r.d(t,"Tw2TransformParameter",(function(){return i.Tw2TransformParameter})),r.d(t,"Tw2VariableParameter",(function(){return i.Tw2VariableParameter})),r.d(t,"Tw2Vector2Parameter",(function(){return i.Tw2Vector2Parameter})),r.d(t,"Tw2Vector3Parameter",(function(){return i.Tw2Vector3Parameter})),r.d(t,"Tw2Vector4Parameter",(function(){return i.Tw2Vector4Parameter})),r.d(t,"Tw2TextureParameter",(function(){return i.Tw2TextureParameter})),r.d(t,"Tw2PostEffect",(function(){return i.Tw2PostEffect})),r.d(t,"Tw2PostEffectManager",(function(){return i.Tw2PostEffectManager})),r.d(t,"Tw2PostEffectStep",(function(){return i.Tw2PostEffectStep})),r.d(t,"Tw2PostProcess",(function(){return i.Tw2PostProcess})),r.d(t,"Tw2BinaryReader",(function(){return i.Tw2BinaryReader})),r.d(t,"Tw2ObjectReader",(function(){return i.Tw2ObjectReader})),r.d(t,"Tw2EffectRes",(function(){return i.Tw2EffectRes})),r.d(t,"Tw2GeometryRes",(function(){return i.Tw2GeometryRes})),r.d(t,"Tw2LoadingObject",(function(){return i.Tw2LoadingObject})),r.d(t,"Tw2Resource",(function(){return i.Tw2Resource})),r.d(t,"Tw2TextureRes",(function(){return i.Tw2TextureRes})),r.d(t,"Tw2VideoRes",(function(){return i.Tw2VideoRes})),r.d(t,"Tw2SamplerState",(function(){return i.Tw2SamplerState})),r.d(t,"Tw2SamplerOverride",(function(){return i.Tw2SamplerOverride})),r.d(t,"Tw2VertexDeclaration",(function(){return i.Tw2VertexDeclaration})),r.d(t,"Tw2VertexElement",(function(){return i.Tw2VertexElement})),r.d(t,"Tw2Error",(function(){return i.Tw2Error})),r.d(t,"ErrHTTPRequest",(function(){return i.ErrHTTPRequest})),r.d(t,"ErrHTTPRequestSend",(function(){return i.ErrHTTPRequestSend})),r.d(t,"ErrHTTPInstance",(function(){return i.ErrHTTPInstance})),r.d(t,"ErrHTTPStatus",(function(){return i.ErrHTTPStatus})),r.d(t,"ErrHTTPReadyState",(function(){return i.ErrHTTPReadyState})),r.d(t,"ErrXMLBinaryFormat",(function(){return i.ErrXMLBinaryFormat})),r.d(t,"ErrXMLObjectTypeUndefined",(function(){return i.ErrXMLObjectTypeUndefined})),r.d(t,"ErrGeometryMeshMissingParticleElement",(function(){return i.ErrGeometryMeshMissingParticleElement})),r.d(t,"ErrGeometryMeshElementComponentsMissing",(function(){return i.ErrGeometryMeshElementComponentsMissing})),r.d(t,"ErrGeometryMeshBoneNameInvalid",(function(){return i.ErrGeometryMeshBoneNameInvalid})),r.d(t,"ErrGeometryMeshEffectBinding",(function(){return i.ErrGeometryMeshEffectBinding})),r.d(t,"ErrGeometryFileType",(function(){return i.ErrGeometryFileType})),r.d(t,"ErrResourcePrefixUnregistered",(function(){return i.ErrResourcePrefixUnregistered})),r.d(t,"ErrResourcePrefixUndefined",(function(){return i.ErrResourcePrefixUndefined})),r.d(t,"ErrResourceExtensionUnregistered",(function(){return i.ErrResourceExtensionUnregistered})),r.d(t,"ErrResourceExtensionUndefined",(function(){return i.ErrResourceExtensionUndefined})),r.d(t,"ErrResourceFormat",(function(){return i.ErrResourceFormat})),r.d(t,"ErrShaderVersion",(function(){return i.ErrShaderVersion})),r.d(t,"ErrShaderHeaderSize",(function(){return i.ErrShaderHeaderSize})),r.d(t,"ErrShaderPermutationValue",(function(){return i.ErrShaderPermutationValue})),r.d(t,"ErrShaderCompile",(function(){return i.ErrShaderCompile})),r.d(t,"ErrShaderLink",(function(){return i.ErrShaderLink})),r.d(t,"ErrDeclarationValueType",(function(){return i.ErrDeclarationValueType})),r.d(t,"ErrSingletonInstantiation",(function(){return i.ErrSingletonInstantiation})),r.d(t,"ErrAbstractClassMethod",(function(){return i.ErrAbstractClassMethod})),r.d(t,"ErrFeatureNotImplemented",(function(){return i.ErrFeatureNotImplemented})),r.d(t,"ErrIndexBounds",(function(){return i.ErrIndexBounds})),r.d(t,"Tw2EventEmitter",(function(){return i.Tw2EventEmitter})),r.d(t,"Tw2Float",(function(){return i.Tw2Float})),r.d(t,"Tw2Frustum",(function(){return i.Tw2Frustum})),r.d(t,"Tw2RenderTarget",(function(){return i.Tw2RenderTarget})),r.d(t,"Tw2CurveKey",(function(){return a.Tw2CurveKey})),r.d(t,"Tw2Curve",(function(){return a.Tw2Curve})),r.d(t,"Tw2ColorKey",(function(){return a.Tw2ColorKey})),r.d(t,"Tw2ColorCurve",(function(){return a.Tw2ColorCurve})),r.d(t,"Tw2ColorKey2",(function(){return a.Tw2ColorKey2})),r.d(t,"Tw2ColorCurve2",(function(){return a.Tw2ColorCurve2})),r.d(t,"Tw2EventKey",(function(){return a.Tw2EventKey})),r.d(t,"Tw2EventCurve",(function(){return a.Tw2EventCurve})),r.d(t,"Tw2PerlinCurve",(function(){return a.Tw2PerlinCurve})),r.d(t,"Tw2QuaternionKey2",(function(){return a.Tw2QuaternionKey2})),r.d(t,"Tw2QuaternionCurve",(function(){return a.Tw2QuaternionCurve})),r.d(t,"Tw2RandomConstantCurve",(function(){return a.Tw2RandomConstantCurve})),r.d(t,"Tw2Torque",(function(){return a.Tw2Torque})),r.d(t,"Tw2RigidOrientation",(function(){return a.Tw2RigidOrientation})),r.d(t,"Tw2QuaternionKey",(function(){return a.Tw2QuaternionKey})),r.d(t,"Tw2RotationCurve",(function(){return a.Tw2RotationCurve})),r.d(t,"Tw2ScalarKey",(function(){return a.Tw2ScalarKey})),r.d(t,"Tw2ScalarCurve",(function(){return a.Tw2ScalarCurve})),r.d(t,"Tw2ScalarKey2",(function(){return a.Tw2ScalarKey2})),r.d(t,"Tw2ScalarCurve2",(function(){return a.Tw2ScalarCurve2})),r.d(t,"Tw2SineCurve",(function(){return a.Tw2SineCurve})),r.d(t,"Tw2Vector2Key",(function(){return a.Tw2Vector2Key})),r.d(t,"Tw2Vector2Curve",(function(){return a.Tw2Vector2Curve})),r.d(t,"Tw2Vector3Key",(function(){return a.Tw2Vector3Key})),r.d(t,"Tw2Vector3Curve",(function(){return a.Tw2Vector3Curve})),r.d(t,"Tw2VectorKey",(function(){return a.Tw2VectorKey})),r.d(t,"Tw2VectorCurve",(function(){return a.Tw2VectorCurve})),r.d(t,"Tw2ColorSequencer",(function(){return a.Tw2ColorSequencer})),r.d(t,"Tw2EulerRotation",(function(){return a.Tw2EulerRotation})),r.d(t,"Tw2QuaternionSequencer",(function(){return a.Tw2QuaternionSequencer})),r.d(t,"Tw2RGBAScalarSequencer",(function(){return a.Tw2RGBAScalarSequencer})),r.d(t,"Tw2ScalarSequencer",(function(){return a.Tw2ScalarSequencer})),r.d(t,"Tw2VectorSequencer",(function(){return a.Tw2VectorSequencer})),r.d(t,"Tw2XYZScalarSequencer",(function(){return a.Tw2XYZScalarSequencer})),r.d(t,"Tw2YPRSequencer",(function(){return a.Tw2YPRSequencer})),r.d(t,"Tw2WbgTrack",(function(){return a.Tw2WbgTrack})),r.d(t,"Tw2WbgTransformTrack",(function(){return a.Tw2WbgTransformTrack})),r.d(t,"Tw2TransformTrack",(function(){return a.Tw2TransformTrack})),r.d(t,"Tw2MayaEulerRotationCurve",(function(){return a.Tw2MayaEulerRotationCurve})),r.d(t,"Tw2MayaScalarCurve",(function(){return a.Tw2MayaScalarCurve})),r.d(t,"Tw2MayaVector3Curve",(function(){return a.Tw2MayaVector3Curve})),r.d(t,"Tw2MayaAnimationEngine",(function(){return a.Tw2MayaAnimationEngine})),r.d(t,"EveChild",(function(){return o.EveChild})),r.d(t,"EveChildBillboard",(function(){return o.EveChildBillboard})),r.d(t,"EveChildCloud",(function(){return o.EveChildCloud})),r.d(t,"EveChildContainer",(function(){return o.EveChildContainer})),r.d(t,"EveChildExplosion",(function(){return o.EveChildExplosion})),r.d(t,"EveChildMesh",(function(){return o.EveChildMesh})),r.d(t,"EveChildParticleSystem",(function(){return o.EveChildParticleSystem})),r.d(t,"EveLensflare",(function(){return o.EveLensflare})),r.d(t,"EveMeshOverlayEffect",(function(){return o.EveMeshOverlayEffect})),r.d(t,"EveOccluder",(function(){return o.EveOccluder})),r.d(t,"EveStretch",(function(){return o.EveStretch})),r.d(t,"EvePerMuzzleData",(function(){return o.EvePerMuzzleData})),r.d(t,"EveTurretFiringFX",(function(){return o.EveTurretFiringFX})),r.d(t,"EveStarfield",(function(){return o.EveStarfield})),r.d(t,"EveObject",(function(){return o.EveObject})),r.d(t,"EveEffectRoot",(function(){return o.EveEffectRoot})),r.d(t,"EveMissileWarhead",(function(){return o.EveMissileWarhead})),r.d(t,"EveMissile",(function(){return o.EveMissile})),r.d(t,"EvePlanet",(function(){return o.EvePlanet})),r.d(t,"EveShip",(function(){return o.EveShip})),r.d(t,"EveSpaceObject",(function(){return o.EveSpaceObject})),r.d(t,"EveStation",(function(){return o.EveStation})),r.d(t,"EveTransform",(function(){return o.EveTransform})),r.d(t,"EveObjectSetItem",(function(){return o.EveObjectSetItem})),r.d(t,"EveObjectSet",(function(){return o.EveObjectSet})),r.d(t,"EveBoosterBatch",(function(){return o.EveBoosterBatch})),r.d(t,"EveBoosterSetItem",(function(){return o.EveBoosterSetItem})),r.d(t,"EveBoosterSet",(function(){return o.EveBoosterSet})),r.d(t,"EveCurveLineSetItem",(function(){return o.EveCurveLineSetItem})),r.d(t,"EveCurveLineSet",(function(){return o.EveCurveLineSet})),r.d(t,"EveLocator",(function(){return o.EveLocator})),r.d(t,"EvePlaneSetBatch",(function(){return o.EvePlaneSetBatch})),r.d(t,"EvePlaneSetItem",(function(){return o.EvePlaneSetItem})),r.d(t,"EvePlaneSet",(function(){return o.EvePlaneSet})),r.d(t,"EveSpaceObjectDecal",(function(){return o.EveSpaceObjectDecal})),r.d(t,"EveSpotlightSetBatch",(function(){return o.EveSpotlightSetBatch})),r.d(t,"EveSpotlightSetItem",(function(){return o.EveSpotlightSetItem})),r.d(t,"EveSpotlightSet",(function(){return o.EveSpotlightSet})),r.d(t,"EveSpriteSetBatch",(function(){return o.EveSpriteSetBatch})),r.d(t,"EveSpriteSetItem",(function(){return o.EveSpriteSetItem})),r.d(t,"EveSpriteSet",(function(){return o.EveSpriteSet})),r.d(t,"EveTurretSetItem",(function(){return o.EveTurretSetItem})),r.d(t,"EveTurretSet",(function(){return o.EveTurretSet})),r.d(t,"EveSpaceScene",(function(){return o.EveSpaceScene})),r.d(t,"EveSOF",(function(){return o.EveSOF})),s)["default","math","util","device","store","resMan","logger","consts","Tw2BatchAccumulator","Tw2ForwardingRenderBatch","Tw2GeometryBatch","Tw2GeometryLineBatch","Tw2RenderBatch","Tw2InstancedMeshBatch","Tw2CurveSet","Tw2ValueBinding","Tw2BasicPerObjectData","EveBasicPerObjectData","Tw2PerObjectData","Tw2RawData","Tw2BlendShapeData","Tw2GeometryAnimation","Tw2GeometryBone","Tw2GeometryCurve","Tw2GeometryMesh","Tw2GeometryMeshArea","Tw2GeometryMeshBinding","Tw2GeometryModel","Tw2GeometrySkeleton","Tw2GeometryTrackGroup","Tw2GeometryTransformTrack","Tw2Effect","Tw2InstancedMesh","Tw2Mesh","Tw2MeshArea","Tw2MeshLineArea","Tw2Animation","Tw2AnimationController","Tw2Bone","Tw2Model","Tw2Track","Tw2TrackGroup","Tw2Parameter","Tw2VectorParameter","Tw2FloatParameter","Tw2MatrixParameter","Tw2TransformParameter","Tw2VariableParameter","Tw2Vector2Parameter","Tw2Vector3Parameter","Tw2Vector4Parameter","Tw2TextureParameter","Tw2PostEffect","Tw2PostEffectManager","Tw2PostEffectStep","Tw2PostProcess","Tw2BinaryReader","Tw2ObjectReader","Tw2EffectRes","Tw2GeometryRes","Tw2LoadingObject","Tw2Resource","Tw2TextureRes","Tw2VideoRes","Tw2SamplerState","Tw2SamplerOverride","Tw2VertexDeclaration","Tw2VertexElement","Tw2Error","ErrHTTPRequest","ErrHTTPRequestSend","ErrHTTPInstance","ErrHTTPStatus","ErrHTTPReadyState","ErrXMLBinaryFormat","ErrXMLObjectTypeUndefined","ErrGeometryMeshMissingParticleElement","ErrGeometryMeshElementComponentsMissing","ErrGeometryMeshBoneNameInvalid","ErrGeometryMeshEffectBinding","ErrGeometryFileType","ErrResourcePrefixUnregistered","ErrResourcePrefixUndefined","ErrResourceExtensionUnregistered","ErrResourceExtensionUndefined","ErrResourceFormat","ErrShaderVersion","ErrShaderHeaderSize","ErrShaderPermutationValue","ErrShaderCompile","ErrShaderLink","ErrDeclarationValueType","ErrSingletonInstantiation","ErrAbstractClassMethod","ErrFeatureNotImplemented","ErrIndexBounds","Tw2EventEmitter","Tw2Float","Tw2Frustum","Tw2RenderTarget","Tw2CurveKey","Tw2Curve","Tw2ColorKey","Tw2ColorCurve","Tw2ColorKey2","Tw2ColorCurve2","Tw2EventKey","Tw2EventCurve","Tw2PerlinCurve","Tw2QuaternionKey2","Tw2QuaternionCurve","Tw2RandomConstantCurve","Tw2Torque","Tw2RigidOrientation","Tw2QuaternionKey","Tw2RotationCurve","Tw2ScalarKey","Tw2ScalarCurve","Tw2ScalarKey2","Tw2ScalarCurve2","Tw2SineCurve","Tw2Vector2Key","Tw2Vector2Curve","Tw2Vector3Key","Tw2Vector3Curve","Tw2VectorKey","Tw2VectorCurve","Tw2ColorSequencer","Tw2EulerRotation","Tw2QuaternionSequencer","Tw2RGBAScalarSequencer","Tw2ScalarSequencer","Tw2VectorSequencer","Tw2XYZScalarSequencer","Tw2YPRSequencer","Tw2WbgTrack","Tw2WbgTransformTrack","Tw2TransformTrack","Tw2MayaEulerRotationCurve","Tw2MayaScalarCurve","Tw2MayaVector3Curve","Tw2MayaAnimationEngine","EveChild","EveChildBillboard","EveChildCloud","EveChildContainer","EveChildExplosion","EveChildMesh","EveChildParticleSystem","EveLensflare","EveMeshOverlayEffect","EveOccluder","EveStretch","EvePerMuzzleData","EveTurretFiringFX","EveStarfield","EveObject","EveEffectRoot","EveMissileWarhead","EveMissile","EvePlanet","EveShip","EveSpaceObject","EveStation","EveTransform","EveObjectSetItem","EveObjectSet","EveBoosterBatch","EveBoosterSetItem","EveBoosterSet","EveCurveLineSetItem","EveCurveLineSet","EveLocator","EvePlaneSetBatch","EvePlaneSetItem","EvePlaneSet","EveSpaceObjectDecal","EveSpotlightSetBatch","EveSpotlightSetItem","EveSpotlightSet","EveSpriteSetBatch","EveSpriteSetItem","EveSpriteSet","EveTurretSetItem","EveTurretSet","EveSpaceScene","EveSOF"].indexOf(c)<0&&function(e){r.d(t,e,(function(){return s[e]}))}(c);var l=n.vec4,f=n.mat4;u.E.Register({resMan:{systemMirror:!1,autoPurgeResources:!0,purgeTime:60,maxPrepareTime:.05},logger:{name:"CCPWGL",history:50,throttle:10,display:!0,visible:{error:!0,warning:!0,log:!0,info:!1,debug:!1}},paths:{res:"https://developers.eveonline.com/ccpwgl/assetpath/1097993/"},extensions:{sm_hi:i.Tw2EffectRes,sm_lo:i.Tw2EffectRes,wbg:i.Tw2GeometryRes,png:i.Tw2TextureRes,dds:i.Tw2TextureRes,cube:i.Tw2TextureRes,mp4:i.Tw2VideoRes,ogg:i.Tw2VideoRes,webm:i.Tw2VideoRes},classes:[i,a,o,s],types:{float:i.Tw2FloatParameter,number:i.Tw2FloatParameter,texture:i.Tw2TextureParameter,vector2:i.Tw2Vector2Parameter,vector3:i.Tw2Vector3Parameter,vector4:i.Tw2Vector4Parameter,matrix4:i.Tw2MatrixParameter},variables:{WorldMat:f.create(),ViewMat:f.create(),ProjectionMat:f.create(),ViewProjectionMat:f.create(),ViewportSize:l.create(),Time:l.create(),u_DecalMatrix:f.create(),u_InvDecalMatrix:f.create(),EveSpaceSceneEnvMap:"",EnvMap1:"",EnvMap2:"",EnvMap3:"",ShadowLightness:0,OccluderValue:l.fromValues(1,1,0,0),LensflareFxOccScale:l.fromValues(1,1,0,0),LensflareFxDirectionScale:l.create()}})},,,,function(e,t,r){(function(t){WebGLDebugUtils=function(){var e;void 0===e&&(e=t);var r=function(t){e.console&&e.console.error?e.console.error(t):function(t){e.console&&e.console.log&&e.console.log(t)}(t)},n={enable:{1:{0:!0}},disable:{1:{0:!0}},getParameter:{1:{0:!0}},drawArrays:{3:{0:!0}},drawElements:{4:{0:!0,2:!0}},createShader:{1:{0:!0}},getShaderParameter:{2:{1:!0}},getProgramParameter:{2:{1:!0}},getShaderPrecisionFormat:{2:{0:!0,1:!0}},getVertexAttrib:{2:{1:!0}},vertexAttribPointer:{6:{2:!0}},bindTexture:{2:{0:!0}},activeTexture:{1:{0:!0}},getTexParameter:{2:{0:!0,1:!0}},texParameterf:{3:{0:!0,1:!0}},texParameteri:{3:{0:!0,1:!0,2:!0}},copyTexImage2D:{8:{0:!0,2:!0}},copyTexSubImage2D:{8:{0:!0}},generateMipmap:{1:{0:!0}},bindBuffer:{2:{0:!0}},getBufferParameter:{2:{0:!0,1:!0}},pixelStorei:{2:{0:!0,1:!0}},bindRenderbuffer:{2:{0:!0}},bindFramebuffer:{2:{0:!0}},checkFramebufferStatus:{1:{0:!0}},framebufferRenderbuffer:{4:{0:!0,1:!0,2:!0}},framebufferTexture2D:{5:{0:!0,1:!0,2:!0}},getFramebufferAttachmentParameter:{3:{0:!0,1:!0,2:!0}},getRenderbufferParameter:{2:{0:!0,1:!0}},renderbufferStorage:{4:{0:!0,1:!0}},clear:{1:{0:{enumBitwiseOr:["COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT"]}}},depthFunc:{1:{0:!0}},blendFunc:{2:{0:!0,1:!0}},blendFuncSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},blendEquation:{1:{0:!0}},blendEquationSeparate:{2:{0:!0,1:!0}},stencilFunc:{3:{0:!0}},stencilFuncSeparate:{4:{0:!0,1:!0}},stencilMaskSeparate:{2:{0:!0}},stencilOp:{3:{0:!0,1:!0,2:!0}},stencilOpSeparate:{4:{0:!0,1:!0,2:!0,3:!0}},cullFace:{1:{0:!0}},frontFace:{1:{0:!0}},drawArraysInstancedANGLE:{4:{0:!0}},drawElementsInstancedANGLE:{5:{0:!0,2:!0}},blendEquationEXT:{1:{0:!0}},bufferData:{3:{0:!0,2:!0},4:{0:!0,2:!0},5:{0:!0,2:!0}},bufferSubData:{3:{0:!0},4:{0:!0},5:{0:!0}},copyBufferSubData:{5:{0:!0,1:!0}},getBufferSubData:{3:{0:!0},4:{0:!0},5:{0:!0}},blitFramebuffer:{10:{8:{enumBitwiseOr:["COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT"]},9:!0}},framebufferTextureLayer:{5:{0:!0,1:!0}},invalidateFramebuffer:{2:{0:!0}},invalidateSubFramebuffer:{6:{0:!0}},readBuffer:{1:{0:!0}},getInternalformatParameter:{3:{0:!0,1:!0,2:!0}},renderbufferStorageMultisample:{5:{0:!0,2:!0}},texStorage2D:{5:{0:!0,2:!0}},texStorage3D:{6:{0:!0,2:!0}},texImage2D:{9:{0:!0,2:!0,6:!0,7:!0},6:{0:!0,2:!0,3:!0,4:!0},10:{0:!0,2:!0,6:!0,7:!0}},texImage3D:{10:{0:!0,2:!0,7:!0,8:!0},11:{0:!0,2:!0,7:!0,8:!0}},texSubImage2D:{9:{0:!0,6:!0,7:!0},7:{0:!0,4:!0,5:!0},10:{0:!0,6:!0,7:!0}},texSubImage3D:{11:{0:!0,8:!0,9:!0},12:{0:!0,8:!0,9:!0}},copyTexSubImage3D:{9:{0:!0}},compressedTexImage2D:{7:{0:!0,2:!0},8:{0:!0,2:!0},9:{0:!0,2:!0}},compressedTexImage3D:{8:{0:!0,2:!0},9:{0:!0,2:!0},10:{0:!0,2:!0}},compressedTexSubImage2D:{8:{0:!0,6:!0},9:{0:!0,6:!0},10:{0:!0,6:!0}},compressedTexSubImage3D:{10:{0:!0,8:!0},11:{0:!0,8:!0},12:{0:!0,8:!0}},vertexAttribIPointer:{5:{2:!0}},drawArraysInstanced:{4:{0:!0}},drawElementsInstanced:{5:{0:!0,2:!0}},drawRangeElements:{6:{0:!0,4:!0}},readPixels:{7:{4:!0,5:!0},8:{4:!0,5:!0}},clearBufferfv:{3:{0:!0},4:{0:!0}},clearBufferiv:{3:{0:!0},4:{0:!0}},clearBufferuiv:{3:{0:!0},4:{0:!0}},clearBufferfi:{4:{0:!0}},beginQuery:{2:{0:!0}},endQuery:{1:{0:!0}},getQuery:{2:{0:!0,1:!0}},getQueryParameter:{2:{1:!0}},samplerParameteri:{3:{1:!0,2:!0}},samplerParameterf:{3:{1:!0}},getSamplerParameter:{2:{1:!0}},fenceSync:{2:{0:!0,1:{enumBitwiseOr:[]}}},clientWaitSync:{3:{1:{enumBitwiseOr:["SYNC_FLUSH_COMMANDS_BIT"]}}},waitSync:{3:{1:{enumBitwiseOr:[]}}},getSyncParameter:{2:{1:!0}},bindTransformFeedback:{2:{0:!0}},beginTransformFeedback:{1:{0:!0}},transformFeedbackVaryings:{3:{2:!0}},bindBufferBase:{3:{0:!0}},bindBufferRange:{5:{0:!0}},getIndexedParameter:{2:{0:!0}},getActiveUniforms:{3:{2:!0}},getActiveUniformBlockParameter:{3:{2:!0}}},i=null,a=null;function o(e){if(null==i)for(var t in i={},a={},e)"number"==typeof e[t]&&(i[e[t]]=t,a[t]=e[t])}function s(){if(null==i)throw"WebGLDebugUtils.init(ctx) not called"}function u(e){s();var t=i[e];return void 0!==t?"gl."+t:"/*UNKNOWN WebGL ENUM*/ 0x"+e.toString(16)}function c(e,t,r,i){var o;if(void 0!==(o=n[e])&&(void 0!==(o=o[t])&&o[r])){if("object"==typeof o[r]&&void 0!==o[r].enumBitwiseOr){for(var s=o[r].enumBitwiseOr,c=0,l=[],f=0;f<s.length;++f){var h=a[s[f]];0!=(i&h)&&(c|=h,l.push(u(h)))}return c===i?l.join(" | "):u(i)}return u(i)}return null===i?"null":void 0===i?"undefined":i.toString()}function l(e,t,r){e.__defineGetter__(r,(function(){return t[r]})),e.__defineSetter__(r,(function(e){t[r]=e}))}function f(e){var t=!!e.createTransformFeedback;t&&e.bindVertexArray(null);var r=e.getParameter(e.MAX_VERTEX_ATTRIBS),n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n);for(var i=0;i<r;++i)e.disableVertexAttribArray(i),e.vertexAttribPointer(i,4,e.FLOAT,!1,0,0),e.vertexAttrib1f(i,0),t&&e.vertexAttribDivisor(i,0);e.deleteBuffer(n);var a=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);for(i=0;i<a;++i)e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_CUBE_MAP,null),e.bindTexture(e.TEXTURE_2D,null),t&&(e.bindTexture(e.TEXTURE_2D_ARRAY,null),e.bindTexture(e.TEXTURE_3D,null),e.bindSampler(i,null));if(e.activeTexture(e.TEXTURE0),e.useProgram(null),e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.DITHER),e.disable(e.SCISSOR_TEST),e.blendColor(0,0,0,0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.clearColor(0,0,0,0),e.clearDepth(1),e.clearStencil(-1),e.colorMask(!0,!0,!0,!0),e.cullFace(e.BACK),e.depthFunc(e.LESS),e.depthMask(!0),e.depthRange(0,1),e.frontFace(e.CCW),e.hint(e.GENERATE_MIPMAP_HINT,e.DONT_CARE),e.lineWidth(1),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.UNPACK_COLORSPACE_CONVERSION_WEBGL&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.polygonOffset(0,0),e.sampleCoverage(1,!1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilMask(4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.viewport(0,0,e.canvas.width,e.canvas.height),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),t){e.drawBuffers([e.BACK]),e.readBuffer(e.BACK),e.bindBuffer(e.COPY_READ_BUFFER,null),e.bindBuffer(e.COPY_WRITE_BUFFER,null),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),e.bindBuffer(e.PIXEL_UNPACK_BUFFER,null);var o=e.getParameter(e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS);for(i=0;i<o;++i)e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,i,null);var s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);for(i=0;i<s;++i)e.bindBufferBase(e.UNIFORM_BUFFER,i,null);e.disable(e.RASTERIZER_DISCARD),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.hint(e.FRAGMENT_SHADER_DERIVATIVE_HINT,e.DONT_CARE)}for(;e.getError(););}return{init:o,mightBeEnum:function(e){return s(),void 0!==i[e]},glEnumToString:u,glFunctionArgToString:c,glFunctionArgsToString:function(e,t){for(var r="",n=t.length,i=0;i<n;++i)r+=(0==i?"":", ")+c(e,n,i,t[i]);return r},makeDebugContext:function e(t,n,i,a){a=a||t,o(t),n=n||function(e,t,n){for(var i="",a=n.length,o=0;o<a;++o)i+=(0==o?"":", ")+c(t,a,o,n[o]);r("WebGL error "+u(e)+" in "+t+"("+i+")")};var s={};function f(e,t){return function(){i&&i(t,arguments);var r=e[t].apply(e,arguments),o=a.getError();return 0!=o&&(s[o]=!0,n(o,t,arguments)),r}}var h={};for(var d in t)if("function"==typeof t[d])if("getExtension"!=d)h[d]=f(t,d);else{var p=f(t,d);h[d]=function(){var r=p.apply(t,arguments);return r?e(r,n,i,a):null}}else l(h,t,d);return h.getError=function(){for(var e in s)if(s.hasOwnProperty(e)&&s[e])return s[e]=!1,e;return t.NO_ERROR},h},makeLostContextSimulatingCanvas:function(t){var r,n,i,a=[],o=[],s={},u=1,c=!1,h=[],d=0,p=0,v=!1,y=0,m={};function b(e){return"function"==typeof e?e:function(t){e.handleEvent(t)}}t.getContext=(i=t.getContext,function(){var a=i.apply(t,arguments);if(a instanceof WebGLRenderingContext||e.WebGL2RenderingContext&&a instanceof WebGL2RenderingContext){if(a!=r){if(r)throw"got different context";n=e.WebGL2RenderingContext&&a instanceof WebGL2RenderingContext,s=T(r=a)}return s}return a});var g=function(e){a.push(b(e))},_=function(e){o.push(b(e))};function R(){++p,c||d==p&&t.loseContext()}function E(e,t){var r=e[t];return function(){if(R(),!c){var t=r.apply(e,arguments);return t}}}function w(e){return{statusMessage:e,preventDefault:function(){v=!0}}}return function(e){var t=e.addEventListener;e.addEventListener=function(r,n,i){switch(r){case"webglcontextlost":g(n);break;case"webglcontextrestored":_(n);break;default:t.apply(e,arguments)}}}(t),t.loseContext=function(){if(!c){for(c=!0,d=0,++u;r.getError(););!function(){for(var e=Object.keys(m),t=0;t<e.length;++t)delete m[e[t]]}(),m[r.CONTEXT_LOST_WEBGL]=!0;var e=w("context lost"),n=a.slice();setTimeout((function(){for(var r=0;r<n.length;++r)n[r](e);y>=0&&setTimeout((function(){t.restoreContext()}),y)}),0)}},t.restoreContext=function(){c&&o.length&&setTimeout((function(){if(!v)throw"can not restore. webglcontestlost listener did not call event.preventDefault";!function(){for(var e=0;e<h.length;++e){var t=h[e];t instanceof WebGLBuffer?r.deleteBuffer(t):t instanceof WebGLFramebuffer?r.deleteFramebuffer(t):t instanceof WebGLProgram?r.deleteProgram(t):t instanceof WebGLRenderbuffer?r.deleteRenderbuffer(t):t instanceof WebGLShader?r.deleteShader(t):t instanceof WebGLTexture?r.deleteTexture(t):n&&(t instanceof WebGLQuery?r.deleteQuery(t):t instanceof WebGLSampler?r.deleteSampler(t):t instanceof WebGLSync?r.deleteSync(t):t instanceof WebGLTransformFeedback?r.deleteTransformFeedback(t):t instanceof WebGLVertexArrayObject&&r.deleteVertexArray(t))}}(),f(r),c=!1,p=0,v=!1;for(var e=o.slice(),t=w("context restored"),i=0;i<e.length;++i)e[i](t)}),0)},t.loseContextInNCalls=function(e){if(c)throw"You can not ask a lost contet to be lost";d=p+e},t.getNumCalls=function(){return p},t.setRestoreTimeout=function(e){y=e},t;function T(e){for(var t in e)"function"==typeof e[t]?s[t]=E(e,t):l(s,e,t);s.getError=function(){if(R(),!c)for(;e=r.getError();)m[e]=!0;for(var e in m)if(m[e])return delete m[e],e;return s.NO_ERROR};var i=["createBuffer","createFramebuffer","createProgram","createRenderbuffer","createShader","createTexture"];n&&i.push("createQuery","createSampler","fenceSync","createTransformFeedback","createVertexArray");for(var a=0;a<i.length;++a){var o=i[a];s[o]=function(t){return function(){if(R(),c)return null;var r=t.apply(e,arguments);return r.__webglDebugContextLostId__=u,h.push(r),r}}(e[o])}var f=["getActiveAttrib","getActiveUniform","getBufferParameter","getContextAttributes","getAttachedShaders","getFramebufferAttachmentParameter","getParameter","getProgramParameter","getProgramInfoLog","getRenderbufferParameter","getShaderParameter","getShaderInfoLog","getShaderSource","getTexParameter","getUniform","getUniformLocation","getVertexAttrib"];n&&f.push("getInternalformatParameter","getQuery","getQueryParameter","getSamplerParameter","getSyncParameter","getTransformFeedbackVarying","getIndexedParameter","getUniformIndices","getActiveUniforms","getActiveUniformBlockParameter","getActiveUniformBlockName");for(a=0;a<f.length;++a){o=f[a];s[o]=function(t){return function(){return R(),c?null:t.apply(e,arguments)}}(s[o])}var d=["isBuffer","isEnabled","isFramebuffer","isProgram","isRenderbuffer","isShader","isTexture"];n&&d.push("isQuery","isSampler","isSync","isTransformFeedback","isVertexArray");for(a=0;a<d.length;++a){o=d[a];s[o]=function(t){return function(){return R(),!c&&t.apply(e,arguments)}}(s[o])}return s.checkFramebufferStatus=function(t){return function(){return R(),c?s.FRAMEBUFFER_UNSUPPORTED:t.apply(e,arguments)}}(s.checkFramebufferStatus),s.getAttribLocation=function(t){return function(){return R(),c?-1:t.apply(e,arguments)}}(s.getAttribLocation),s.getVertexAttribOffset=function(t){return function(){return R(),c?0:t.apply(e,arguments)}}(s.getVertexAttribOffset),s.isContextLost=function(){return c},n&&(s.getFragDataLocation=function(t){return function(){return R(),c?-1:t.apply(e,arguments)}}(s.getFragDataLocation),s.clientWaitSync=function(t){return function(){return R(),c?s.WAIT_FAILED:t.apply(e,arguments)}}(s.clientWaitSync),s.getUniformBlockIndex=function(t){return function(){return R(),c?s.INVALID_INDEX:t.apply(e,arguments)}}(s.getUniformBlockIndex)),s}},resetToInitialState:f}}(),e.exports=WebGLDebugUtils}).call(this,r(31))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r}])}));