diff --git a/hurt/page/application.js b/hurt/page/application.js new file mode 100644 index 0000000..69d8a17 --- /dev/null +++ b/hurt/page/application.js @@ -0,0 +1,63 @@ +System.register([], function (_export, _context) { + "use strict"; + + var cc, Application; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + + function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + + return { + setters: [], + execute: function () { + _export("Application", Application = /*#__PURE__*/function () { + function Application() { + _classCallCheck(this, Application); + + this.settingsPath = 'src/settings.json'; + this.showFPS = false; + } + + _createClass(Application, [{ + key: "init", + value: function init(engine) { + cc = engine; + cc.game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this)); + cc.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this)); + } + }, { + key: "onPostInitBase", + value: function onPostInitBase() {// cc.settings.overrideSettings('assets', 'server', ''); + // do custom logic + } + }, { + key: "onPostSystemInit", + value: function onPostSystemInit() {// do custom logic + } + }, { + key: "start", + value: function start() { + return cc.game.init({ + debugMode: false ? cc.DebugMode.INFO : cc.DebugMode.ERROR, + settingsPath: this.settingsPath, + overrideSettings: { + // assets: { + // preloadBundles: [{ bundle: 'main', version: 'xxx' }], + // } + profiling: { + showFPS: this.showFPS + } + } + }).then(function () { + return cc.game.run(); + }); + } + }]); + + return Application; + }()); + } + }; +}); \ No newline at end of file diff --git a/hurt/page/assets/internal/config.json b/hurt/page/assets/internal/config.json new file mode 100644 index 0000000..fb0a9ba --- /dev/null +++ b/hurt/page/assets/internal/config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"internal","deps":[],"uuids":["0846c28f0","1cAq5vRJJJFbj4dJKjseTN","509DSLyINOL48RziM7hZ+h","609xlc7CpF67qUiVX2DoHQ","81Dpbk5FZEaJtZ9OjzlzLA","87HDtsc3lBnb2jeUsjmrkN","8bvbzdXNRBALbVt8liW2EH","93Yf2QulJPhKqTboeP1XbK","97CwWYvLBHFJH7LoFEDczY","a3zQCfCrBCDZJ4uf2rk5u8","b51hFfA3BNfKrTwZTMcc+Y","bc1kzGLdlD9qu+ZjGNMyAy","c2chXYaDVLaL+7verGEAwE","d9MFkNu5JMyIvRI80Cf57f","ddOhRNq39B8IK4LkOgkNSW","e9qpo+WytKx6LHBz3isrJP","ef6OKj6s5Ce7Txy4qTfsd9","f0QW5oAgBLd6kmT50W5JTa","f9KAbXF2hEP6/oErzehNDw","fdoJXLgx1GAa2UhGATlj3o","ffm+GQIKROSLaMduPHz/CF"],"paths":{"1":["db:/internal/effects/builtin-graphics",0],"2":["db:/internal/default_materials/ui-alpha-test-material",1],"3":["db:/internal/effects/builtin-sprite",0],"4":["db:/internal/effects/builtin-clear-stencil",0],"5":["db:/internal/effects/util/profiler",0],"6":["db:/internal/default_materials/default-clear-stencil",1],"7":["db:/internal/effects/pipeline/planar-shadow",0],"8":["db:/internal/effects/util/splash-screen",0],"9":["db:/internal/effects/builtin-unlit",0],"10":["db:/internal/default_materials/default-spine-material",1],"11":["db:/internal/default_materials/missing-effect-material",1],"12":["db:/internal/effects/builtin-spine",0],"13":["db:/internal/default_materials/missing-material",1],"14":["db:/internal/default_materials/ui-sprite-gray-alpha-sep-material",1],"15":["db:/internal/default_materials/ui-base-material",1],"16":["db:/internal/default_materials/ui-sprite-gray-material",1],"17":["db:/internal/default_materials/ui-graphics-material",1],"18":["db:/internal/default_materials/ui-sprite-alpha-sep-material",1],"19":["db:/internal/default_materials/ui-sprite-material",1],"20":["db:/internal/effects/builtin-debug-renderer",0]},"scenes":{},"packs":{"0846c28f0":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"types":["cc.EffectAsset","cc.Material"]} \ No newline at end of file diff --git a/hurt/page/assets/internal/import/08/0846c28f0.json b/hurt/page/assets/internal/import/08/0846c28f0.json new file mode 100644 index 0000000..5860829 --- /dev/null +++ b/hurt/page/assets/internal/import/08/0846c28f0.json @@ -0,0 +1 @@ +[1,["609xlc7CpF67qUiVX2DoHQ","a3zQCfCrBCDZJ4uf2rk5u8","81Dpbk5FZEaJtZ9OjzlzLA","c2chXYaDVLaL+7verGEAwE","1cAq5vRJJJFbj4dJKjseTN"],["_effectAsset"],[["cc.EffectAsset",["_name","shaders","techniques","combinations"],-1],["cc.Material",["_name","_props","_states","_defines"],-1],["cc.Material",["_name","_states","_defines","_props"],0,12]],[[1,0,1,2,3,5],[0,0,1,2,4],[0,0,3,1,2,5],[2,0,1,2,3,4]],[[[[1,"builtin-graphics",[{"hash":3387382926,"name":"builtin-graphics|vs:vert|fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]},{"name":"a_dist","format":11,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nlayout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\nin float a_dist;\nout float v_dist;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nin vec4 v_color;\nin float v_dist;\nvec4 frag () {\n vec4 o = v_color;\n float aa = fwidth(v_dist);\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matViewProj;\nuniform highp mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\nattribute float a_dist;\nvarying float v_dist;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n pos = cc_matViewProj * cc_matWorld * pos;\n v_color = a_color;\n v_dist = a_dist;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives: enable\n#endif\nprecision highp float;\nvarying vec4 v_color;\nvarying float v_dist;\nvec4 frag () {\n vec4 o = v_color;\n #ifdef GL_OES_standard_derivatives\n float aa = fwidth(v_dist);\n #else\n float aa = 0.05;\n #endif\n float alpha = 1. - smoothstep(-aa, 0., abs(v_dist) - 1.0);\n o.rgb *= o.a;\n o *= alpha;\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":54,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[]}],[{"passes":[{"program":"builtin-graphics|vs:vert|fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":1,"blendDst":4,"blendSrcAlpha":1,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"ui-alpha-test-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_ALPHA_TEST":true,"USE_TEXTURE":true,"IS_GRAY":false,"CC_USE_EMBEDDED_ALPHA":false}]]],0,0,[0],[0],[0]],[[[2,"builtin-sprite",[{}],[{"hash":2489457887,"name":"builtin-sprite|sprite-vs:vert|sprite-fs:frag","blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if USE_LOCAL\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n };\n#endif\n#if SAMPLE_FROM_RT\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183f\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define CC_LIGHTMAP_DISABLED 0\n #define CC_LIGHTMAP_ALL_IN_ONE 1\n #define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\n#endif\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nout vec4 color;\nout vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture(tex, uv).rgb, texture(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n layout(std140) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 color;\n#if USE_TEXTURE\n in vec2 uv0;\n uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp mat4 cc_matViewProj;\n uniform highp vec4 cc_cameraPos;\n#if USE_LOCAL\n uniform highp mat4 cc_matWorld;\n#endif\n#if SAMPLE_FROM_RT\n #define QUATER_PI 0.78539816340\n #define HALF_PI 1.57079632679\n #define PI 3.14159265359\n #define PI2 6.28318530718\n #define PI4 12.5663706144\n #define INV_QUATER_PI 1.27323954474\n #define INV_HALF_PI 0.63661977237\n #define INV_PI 0.31830988618\n #define INV_PI2 0.15915494309\n #define INV_PI4 0.07957747155\n #define EPSILON 1e-6\n #define EPSILON_LOWP 1e-4\n #define LOG2 1.442695\n #define EXP_VALUE 2.71828183f\n #define FP_MAX 65504.0\n #define FP_SCALE 0.0009765625\n #define FP_SCALE_INV 1024.0\n #define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n #define CC_LIGHTMAP_DISABLED 0\n #define CC_LIGHTMAP_ALL_IN_ONE 1\n #define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\n#endif\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec4 color;\nvarying vec2 uv0;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n #if USE_PIXEL_ALIGNMENT\n pos = cc_matView * pos;\n pos.xyz = floor(pos.xyz);\n pos = cc_matProj * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n uv0 = a_texCoord;\n #if SAMPLE_FROM_RT\n uv0 = cc_cameraPos.w > 1.0 ? vec2(uv0.x, 1.0 - uv0.y) : uv0;\n #endif\n color = a_color;\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 CCSampleWithAlphaSeparated(sampler2D tex, vec2 uv) {\n#if CC_USE_EMBEDDED_ALPHA\n return vec4(texture2D(tex, uv).rgb, texture2D(tex, uv + vec2(0.0, 0.5)).r);\n#else\n return texture2D(tex, uv);\n#endif\n}\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 color;\n#if USE_TEXTURE\n varying vec2 uv0;\n uniform sampler2D cc_spriteTexture;\n#endif\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o *= CCSampleWithAlphaSeparated(cc_spriteTexture, uv0);\n #if IS_GRAY\n float gray = 0.2126 * o.r + 0.7152 * o.g + 0.0722 * o.b;\n o.r = o.g = o.b = gray;\n #endif\n #endif\n o *= color;\n ALPHA_TEST(o);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","defines":["USE_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":54,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[{"name":"USE_LOCAL","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"USE_PIXEL_ALIGNMENT","type":"boolean"},{"name":"CC_USE_EMBEDDED_ALPHA","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"USE_TEXTURE","type":"boolean"},{"name":"IS_GRAY","type":"boolean"}]}],[{"passes":[{"program":"builtin-sprite|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[2,"builtin-clear-stencil",[{}],[{"hash":3507038093,"name":"builtin-clear-stencil|sprite-vs:vert|sprite-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision highp float;\nin vec3 a_position;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 frag () {\n vec4 o = vec4(1.0);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nattribute vec3 a_position;\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec4 frag () {\n vec4 o = vec4(1.0);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":0,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":0}},"defines":[]}],[{"passes":[{"program":"builtin-clear-stencil|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[1,"util/profiler",[{"hash":412318372,"name":"util/profiler|profiler-vs:vert|profiler-fs:frag","blocks":[{"name":"Constants","stageFlags":1,"binding":0,"members":[{"name":"offset","type":16,"count":1}],"defines":[]},{"name":"PerFrameInfo","stageFlags":1,"binding":1,"members":[{"name":"digits","type":16,"count":20}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_color","format":44,"location":1,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec2 v_uv;\nlayout(std140) uniform Constants {\n vec4 offset;\n};\nlayout(std140) uniform PerFrameInfo {\n vec4 digits[8 * 10 / 4];\n};\nfloat getComponent(vec4 v, float i) {\n if (i < 1.0) { return v.x; }\n else if (i < 2.0) { return v.y; }\n else if (i < 3.0) { return v.z; }\n else { return v.w; }\n}\nvec4 vert () {\n mat2 proj = mat2(cc_matProj[0].xy, cc_matProj[1].xy);\n proj /= abs(proj[1].x + proj[1].y);\n vec2 position = proj * a_position.xy + offset.xy;\n v_uv = a_color.xy;\n if (a_color.z >= 0.0) {\n float n = getComponent(digits[int(a_color.z)], a_color.w);\n v_uv += vec2(offset.z * n, 0.0);\n }\n return vec4(position, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 v_uv;\nuniform sampler2D mainTexture;\nvec4 frag () {\n return CCFragOutput(texture(mainTexture, v_uv));\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform highp mat4 cc_matProj;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec2 v_uv;\n uniform vec4 offset;\n uniform vec4 digits[20];\nfloat getComponent(vec4 v, float i) {\n if (i < 1.0) { return v.x; }\n else if (i < 2.0) { return v.y; }\n else if (i < 3.0) { return v.z; }\n else { return v.w; }\n}\nvec4 vert () {\n mat2 proj = mat2(cc_matProj[0].xy, cc_matProj[1].xy);\n proj /= abs(proj[1].x + proj[1].y);\n vec2 position = proj * a_position.xy + offset.xy;\n v_uv = a_color.xy;\n if (a_color.z >= 0.0) {\n float n = getComponent(digits[int(a_color.z)], a_color.w);\n v_uv += vec2(offset.z * n, 0.0);\n }\n return vec4(position, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nuniform mediump vec4 cc_debug_view_mode;\n uniform mediump vec4 cc_debug_view_composite_pack_1;\n uniform mediump vec4 cc_debug_view_composite_pack_2;\n uniform mediump vec4 cc_debug_view_composite_pack_3;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 v_uv;\nuniform sampler2D mainTexture;\nvec4 frag () {\n return CCFragOutput(texture2D(mainTexture, v_uv));\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":65,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":44}},"defines":[]}],[{"passes":[{"program":"util/profiler|profiler-vs:vert|profiler-fs:frag","priority":255,"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]],[[[0,"default-clear-stencil",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":false}]]],0,0,[0],[0],[2]],[[[1,"pipeline/planar-shadow",[{"hash":1900454553,"name":"pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag","blocks":[],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBias","format":21,"isInstanced":true,"location":11,"defines":["USE_INSTANCING","CC_RECEIVE_SHADOW"]},{"name":"a_vertexId","format":11,"location":12,"defines":["CC_USE_MORPH"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183f\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define CC_LIGHTMAP_DISABLED 0\n#define CC_LIGHTMAP_ALL_IN_ONE 1\n#define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW\n in vec2 a_localShadowBias;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n };\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nout float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n vec3 P = (matWorld * position).xyz;\n vec3 L = cc_mainLitDir.xyz;\n vec3 N = cc_planarNDInfo.xyz;\n float d = cc_planarNDInfo.w + 0.001;\n float dist = (-d - dot(P, N)) / (dot(L, N) + 0.0001);\n vec3 shadowPos = P + L * dist;\n vec3 view = normalize(cc_cameraPos.xyz - shadowPos);\n float viewLength = length(cc_cameraPos.xyz - shadowPos);\n shadowPos += view * min(1.0, 0.005 * viewLength);\n position = cc_matProj * cc_matView * vec4(shadowPos, 1.0);\n v_dist = dist;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nlayout(std140) uniform CCShadow {\n highp mat4 cc_matLightView;\n highp mat4 cc_matLightViewProj;\n highp vec4 cc_shadowInvProjDepthInfo;\n highp vec4 cc_shadowProjDepthInfo;\n highp vec4 cc_shadowProjInfo;\n mediump vec4 cc_shadowNFLSInfo;\n mediump vec4 cc_shadowWHPBInfo;\n mediump vec4 cc_shadowLPNNInfo;\n lowp vec4 cc_shadowColor;\n mediump vec4 cc_planarNDInfo;\n};\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183f\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define CC_LIGHTMAP_DISABLED 0\n#define CC_LIGHTMAP_ALL_IN_ONE 1\n#define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW\n attribute vec2 a_localShadowBias;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_mainLitDir;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\nuniform mediump vec4 cc_planarNDInfo;\nvarying float v_dist;\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n vec3 P = (matWorld * position).xyz;\n vec3 L = cc_mainLitDir.xyz;\n vec3 N = cc_planarNDInfo.xyz;\n float d = cc_planarNDInfo.w + 0.001;\n float dist = (-d - dot(P, N)) / (dot(L, N) + 0.0001);\n vec3 shadowPos = P + L * dist;\n vec3 view = normalize(cc_cameraPos.xyz - shadowPos);\n float viewLength = length(cc_cameraPos.xyz - shadowPos);\n shadowPos += view * min(1.0, 0.005 * viewLength);\n position = cc_matProj * cc_matView * vec4(shadowPos, 1.0);\n v_dist = dist;\n return position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nuniform lowp vec4 cc_shadowColor;\nuniform mediump vec4 cc_debug_view_mode;\n uniform mediump vec4 cc_debug_view_composite_pack_1;\n uniform mediump vec4 cc_debug_view_composite_pack_2;\n uniform mediump vec4 cc_debug_view_composite_pack_3;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying float v_dist;\nvec4 frag () {\n if(v_dist < 0.0)\n discard;\n return CCFragOutput(cc_shadowColor);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]},{"name":"CCShadow","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":88,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":60}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"}]}],[{"passes":[{"phase":"planarShadow","program":"pipeline/planar-shadow|planar-shadow-vs:vert|planar-shadow-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false,"stencilTestFront":true,"stencilFuncFront":5,"stencilPassOpFront":2,"stencilRefBack":128,"stencilRefFront":128,"stencilReadMaskBack":128,"stencilReadMaskFront":128,"stencilWriteMaskBack":128,"stencilWriteMaskFront":128}}]}]]],0,0,[],[],[]],[[[1,"util/splash-screen",[{"hash":3189094080,"name":"util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag","blocks":[{"name":"Constant","stageFlags":1,"binding":0,"members":[{"name":"u_buffer0","type":16,"count":1},{"name":"u_buffer1","type":16,"count":1},{"name":"u_projection","type":25,"count":1}],"defines":[]},{"name":"Factor","stageFlags":16,"binding":1,"members":[{"name":"u_percent","type":13,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":21,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision mediump float;\nin vec2 a_position;\nin vec2 a_texCoord;\nout vec2 v_uv;\nlayout(std140) uniform Constant {\n vec4 u_buffer0;\n vec4 u_buffer1;\n mat4 u_projection;\n};\nvec4 vert () {\n vec2 worldPos = a_position * u_buffer1.xy + u_buffer1.zw;\n vec2 clipSpace = worldPos / u_buffer0.xy * 2.0 - 1.0;\n vec4 screenPos = u_projection * vec4(clipSpace, 0.0, 1.0);\n v_uv = a_texCoord;\n return screenPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nin vec2 v_uv;\nlayout(std140) uniform Factor {\n float u_percent;\n};\nuniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = texture(mainTexture, v_uv);\n float percent = clamp(u_percent, 0.0, 1.0);\n color.xyz *= percent;\n return color;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision mediump float;\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nvarying vec2 v_uv;\n uniform vec4 u_buffer0;\n uniform vec4 u_buffer1;\n uniform mat4 u_projection;\nvec4 vert () {\n vec2 worldPos = a_position * u_buffer1.xy + u_buffer1.zw;\n vec2 clipSpace = worldPos / u_buffer0.xy * 2.0 - 1.0;\n vec4 screenPos = u_projection * vec4(clipSpace, 0.0, 1.0);\n v_uv = a_texCoord;\n return screenPos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nvarying vec2 v_uv;\n uniform float u_percent;\nuniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = texture2D(mainTexture, v_uv);\n float percent = clamp(u_percent, 0.0, 1.0);\n color.xyz *= percent;\n return color;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":6,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[]}],[{"name":"default","passes":[{"program":"util/splash-screen|splash-screen-vs:vert|splash-screen-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"resolution":{"type":14,"value":[640,960],"handleInfo":["u_buffer0",0,14]},"percent":{"type":13,"value":[0.5],"handleInfo":["u_percent",0,13]},"scale":{"type":14,"value":[200,500],"handleInfo":["u_buffer1",0,14]},"translate":{"type":14,"value":[320,480],"handleInfo":["u_buffer1",2,14]},"u_buffer0":{"type":16,"value":[640,960,0,0]},"u_percent":{"type":13,"value":[0.5]},"u_buffer1":{"type":16,"value":[200,500,320,480]}}}]}]]],0,0,[],[],[]],[[[1,"builtin-unlit",[{"hash":45918178,"name":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blocks":[{"name":"TexCoords","stageFlags":1,"binding":0,"members":[{"name":"tilingOffset","type":16,"count":1}],"defines":["USE_TEXTURE"]},{"name":"Constant","stageFlags":16,"binding":1,"members":[{"name":"mainColor","type":16,"count":1},{"name":"colorScaleAndCutoff","type":16,"count":1}],"defines":[]}],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":2,"defines":["USE_TEXTURE"]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_normal","format":32,"location":1,"defines":[]},{"name":"a_texCoord","format":21,"location":2,"defines":[]},{"name":"a_tangent","format":44,"location":3,"defines":[]},{"name":"a_joints","location":4,"defines":["CC_USE_SKINNING"]},{"name":"a_weights","format":44,"location":5,"defines":["CC_USE_SKINNING"]},{"name":"a_jointAnimInfo","format":44,"isInstanced":true,"location":6,"defines":["USE_INSTANCING","CC_USE_BAKED_ANIMATION"]},{"name":"a_matWorld0","format":44,"isInstanced":true,"location":7,"defines":["USE_INSTANCING"]},{"name":"a_matWorld1","format":44,"isInstanced":true,"location":8,"defines":["USE_INSTANCING"]},{"name":"a_matWorld2","format":44,"isInstanced":true,"location":9,"defines":["USE_INSTANCING"]},{"name":"a_lightingMapUVParam","format":44,"isInstanced":true,"location":10,"defines":["USE_INSTANCING","CC_USE_LIGHTMAP"]},{"name":"a_localShadowBias","format":21,"isInstanced":true,"location":11,"defines":["USE_INSTANCING","CC_RECEIVE_SHADOW"]},{"name":"a_vertexId","format":11,"location":12,"defines":["CC_USE_MORPH"]},{"name":"a_color","format":44,"location":13,"defines":["USE_VERTEX_COLOR"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183f\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define CC_LIGHTMAP_DISABLED 0\n#define CC_LIGHTMAP_ALL_IN_ONE 1\n#define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nin vec3 a_position;\nin vec3 a_normal;\nin vec2 a_texCoord;\nin vec4 a_tangent;\n#if CC_USE_SKINNING\n in vec4 a_joints;\n in vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n in highp vec4 a_jointAnimInfo;\n #endif\n in vec4 a_matWorld0;\n in vec4 a_matWorld1;\n in vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n in vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW\n in vec2 a_localShadowBias;\n #endif\n#endif\n#if CC_USE_MORPH\n in float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n layout(std140) uniform CCMorph {\n vec4 cc_displacementWeights[15];\n vec4 cc_displacementTextureInfo;\n };\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {\n ivec2 texSize = textureSize(tex, 0);\n return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture(tex, x)),\n decode32(texture(tex, y)),\n decode32(texture(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n layout(std140) uniform CCSkinningTexture {\n highp vec4 cc_jointTextureInfo;\n };\n layout(std140) uniform CCSkinningAnimation {\n highp vec4 cc_jointAnimInfo;\n };\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n layout(std140) uniform CCSkinning {\n highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n };\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if !USE_INSTANCING\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n };\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nout mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n in lowp vec4 a_color;\n out lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n out vec2 v_uv;\n layout(std140) uniform TexCoords {\n vec4 tilingOffset;\n };\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_HDR\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n return color;\n}\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nin mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n in vec2 v_uv;\n uniform sampler2D mainTexture;\n#endif\nlayout(std140) uniform Constant {\n vec4 mainColor;\n vec4 colorScaleAndCutoff;\n};\n#if USE_VERTEX_COLOR\n in lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183f\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define CC_LIGHTMAP_DISABLED 0\n#define CC_LIGHTMAP_ALL_IN_ONE 1\n#define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\nstruct StandardVertInput {\n highp vec4 position;\n vec3 normal;\n vec4 tangent;\n};\nattribute vec3 a_position;\nattribute vec3 a_normal;\nattribute vec2 a_texCoord;\nattribute vec4 a_tangent;\n#if CC_USE_SKINNING\n attribute vec4 a_joints;\n attribute vec4 a_weights;\n#endif\n#if USE_INSTANCING\n #if CC_USE_BAKED_ANIMATION\n attribute highp vec4 a_jointAnimInfo;\n #endif\n attribute vec4 a_matWorld0;\n attribute vec4 a_matWorld1;\n attribute vec4 a_matWorld2;\n #if CC_USE_LIGHTMAP\n attribute vec4 a_lightingMapUVParam;\n #endif\n #if CC_RECEIVE_SHADOW\n attribute vec2 a_localShadowBias;\n #endif\n#endif\n#if CC_USE_MORPH\n attribute float a_vertexId;\n int getVertexId() {\n return int(a_vertexId);\n }\n#endif\nhighp float decode32 (highp vec4 rgba) {\n rgba = rgba * 255.0;\n highp float Sign = 1.0 - (step(128.0, (rgba[3]) + 0.5)) * 2.0;\n highp float Exponent = 2.0 * (mod(float(int((rgba[3]) + 0.5)), 128.0)) + (step(128.0, (rgba[2]) + 0.5)) - 127.0;\n highp float Mantissa = (mod(float(int((rgba[2]) + 0.5)), 128.0)) * 65536.0 + rgba[1] * 256.0 + rgba[0] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n}\n#if CC_USE_MORPH\n uniform vec4 cc_displacementWeights[15];\n uniform vec4 cc_displacementTextureInfo;\n #if CC_MORPH_TARGET_HAS_POSITION\n uniform sampler2D cc_PositionDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n uniform sampler2D cc_NormalDisplacements;\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n uniform sampler2D cc_TangentDisplacements;\n #endif\n vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {\n float pixelIndexF = float(pixelIndex);\n float x = mod(pixelIndexF, textureResolution.x);\n float y = floor(pixelIndexF / textureResolution.x);\n return vec2(x, y);\n }\n vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {\n return (vec2(location.x, location.y) + .5) / textureResolution;\n }\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);\n return texture2D(tex, uv);\n }\n #else\n vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {\n int pixelIndex = elementIndex * 4;\n vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);\n vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);\n vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);\n return vec4(\n decode32(texture2D(tex, x)),\n decode32(texture2D(tex, y)),\n decode32(texture2D(tex, z)),\n 1.0\n );\n }\n #endif\n float getDisplacementWeight(int index) {\n int quot = index / 4;\n int remainder = index - quot * 4;\n if (remainder == 0) {\n return cc_displacementWeights[quot].x;\n } else if (remainder == 1) {\n return cc_displacementWeights[quot].y;\n } else if (remainder == 2) {\n return cc_displacementWeights[quot].z;\n } else {\n return cc_displacementWeights[quot].w;\n }\n }\n vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {\n #if CC_MORPH_PRECOMPUTED\n return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;\n #else\n vec3 result = vec3(0, 0, 0);\n int nVertices = int(cc_displacementTextureInfo.z);\n for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {\n result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));\n }\n return result;\n #endif\n }\n #if CC_MORPH_TARGET_HAS_POSITION\n vec3 getPositionDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n vec3 getNormalDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);\n }\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n vec3 getTangentDisplacement(int vertexId) {\n return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);\n }\n #endif\n void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n int vertexId = getVertexId();\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_NORMAL\n normal.xyz = normal.xyz + getNormalDisplacement(vertexId);\n #endif\n #if CC_MORPH_TARGET_HAS_TANGENT\n tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);\n #endif\n }\n void applyMorph (inout vec4 position) {\n #if CC_MORPH_TARGET_HAS_POSITION\n position.xyz = position.xyz + getPositionDisplacement(getVertexId());\n #endif\n }\n#endif\n#if CC_USE_SKINNING\n #if CC_USE_BAKED_ANIMATION\n uniform highp vec4 cc_jointTextureInfo;\n uniform highp vec4 cc_jointAnimInfo;\n uniform highp sampler2D cc_jointTexture;\n void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)\n {\n #if USE_INSTANCING\n highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;\n #else\n highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;\n #endif\n invSize = cc_jointTextureInfo.w;\n highp float tempY = floor(temp * invSize);\n x = floor(temp - tempY * cc_jointTextureInfo.x);\n y = (tempY + 0.5) * invSize;\n }\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n uniform highp sampler2D cc_realtimeJoint;\n #else\n uniform highp vec4 cc_joints[CC_JOINT_UNIFORM_CAPACITY * 3];\n #endif\n #endif\n #if CC_USE_BAKED_ANIMATION\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(3.0, i, x, y, invSize);\n vec4 v1 = texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y));\n vec4 v2 = texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y));\n vec4 v3 = texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n highp float x, y, invSize;\n CCGetJointTextureCoords(12.0, i, x, y, invSize);\n vec4 v1 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 0.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 1.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 2.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 3.5) * invSize, y)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 4.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 5.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 6.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 7.5) * invSize, y)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_jointTexture, vec2((x + 8.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 9.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 10.5) * invSize, y))),\n decode32(texture2D(cc_jointTexture, vec2((x + 11.5) * invSize, y)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n #if CC_USE_REAL_TIME_JOINT_TEXTURE\n #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE\n mat4 getJointMatrix (float i) {\n float x = i;\n vec4 v1 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 0.5 / 3.0));\n vec4 v2 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 1.5 / 3.0));\n vec4 v3 = texture2D(cc_realtimeJoint, vec2( x / 256.0, 2.5 / 3.0));\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #else\n mat4 getJointMatrix (float i) {\n float x = 4.0 * i;\n vec4 v1 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 0.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 0.5 / 3.0)))\n );\n vec4 v2 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 1.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 1.5 / 3.0)))\n );\n vec4 v3 = vec4(\n decode32(texture2D(cc_realtimeJoint, vec2((x + 0.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 1.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 2.5)/ 1024.0, 2.5 / 3.0))),\n decode32(texture2D(cc_realtimeJoint, vec2((x + 3.5)/ 1024.0, 2.5 / 3.0)))\n );\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #else\n mat4 getJointMatrix (float i) {\n int idx = int(i);\n vec4 v1 = cc_joints[idx * 3];\n vec4 v2 = cc_joints[idx * 3 + 1];\n vec4 v3 = cc_joints[idx * 3 + 2];\n return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));\n }\n #endif\n #endif\n mat4 skinMatrix () {\n vec4 joints = vec4(a_joints);\n return getJointMatrix(joints.x) * a_weights.x\n + getJointMatrix(joints.y) * a_weights.y\n + getJointMatrix(joints.z) * a_weights.z\n + getJointMatrix(joints.w) * a_weights.w;\n }\n void CCSkin (inout vec4 position) {\n mat4 m = skinMatrix();\n position = m * position;\n }\n void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {\n mat4 m = skinMatrix();\n position = m * position;\n normal = (m * vec4(normal, 0.0)).xyz;\n tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;\n }\n#endif\nvoid CCVertInput(inout vec4 In)\n{\n In = vec4(a_position, 1.0);\n #if CC_USE_MORPH\n applyMorph(In);\n #endif\n #if CC_USE_SKINNING\n CCSkin(In);\n #endif\n}\nuniform highp mat4 cc_matView;\n uniform highp mat4 cc_matProj;\n uniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if !USE_INSTANCING\n uniform highp mat4 cc_matWorld;\n#endif\nvoid CCGetWorldMatrix(out mat4 matWorld)\n{\n #if USE_INSTANCING\n matWorld = mat4(\n vec4(a_matWorld0.xyz, 0.0),\n vec4(a_matWorld1.xyz, 0.0),\n vec4(a_matWorld2.xyz, 0.0),\n vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)\n );\n #else\n matWorld = cc_matWorld;\n #endif\n}\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_TRANSFER_FOG(vec4 pos) {\n#if !CC_USE_ACCURATE_FOG\n CC_TRANSFER_FOG_BASE(pos, v_fog_factor);\n#endif\n}\n#if USE_VERTEX_COLOR\n attribute lowp vec4 a_color;\n varying lowp vec4 v_color;\n#endif\n#if USE_TEXTURE\n varying vec2 v_uv;\n uniform vec4 tilingOffset;\n#endif\nvec4 vert () {\n vec4 position;\n CCVertInput(position);\n mat4 matWorld;\n CCGetWorldMatrix(matWorld);\n #if USE_TEXTURE\n v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;\n #if SAMPLE_FROM_RT\n v_uv = cc_cameraPos.w > 1.0 ? vec2(v_uv.x, 1.0 - v_uv.y) : v_uv;\n #endif\n #endif\n #if USE_VERTEX_COLOR\n v_color = a_color;\n #endif\n CC_TRANSFER_FOG(matWorld * position);\n return cc_matProj * (cc_matView * matWorld) * position;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\nvec3 ACESToneMap (vec3 color) {\n color = min(color, vec3(8.0));\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec3 SRGBToLinear (vec3 gamma) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return gamma;\n }\n #endif\n#endif\n return gamma * gamma;\n}\nvec3 LinearToSRGB(vec3 linear) {\n#ifdef CC_USE_SURFACE_SHADER\n #if CC_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC\n if (!IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION) {\n return linear;\n }\n #endif\n#endif\n return sqrt(linear);\n}\nvec4 CCFragOutput (vec4 color) {\n #if CC_USE_HDR\n color.rgb = ACESToneMap(color.rgb);\n #endif\n color.rgb = LinearToSRGB(color.rgb);\n return color;\n}\nuniform mediump vec4 cc_debug_view_mode;\n uniform mediump vec4 cc_debug_view_composite_pack_1;\n uniform mediump vec4 cc_debug_view_composite_pack_2;\n uniform mediump vec4 cc_debug_view_composite_pack_3;\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_fogColor;\n uniform mediump vec4 cc_fogBase;\n uniform mediump vec4 cc_fogAdd;\n#if CC_USE_FOG != 4\n float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {\n vec4 wPos = pos;\n float cam_dis = distance(cameraPos, wPos.xyz);\n return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);\n }\n float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * fogDensity);\n return f;\n }\n float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {\n vec4 wPos = pos;\n float cam_dis = max(distance(cameraPos, wPos.xyz) - fogStart, 0.0) / fogAtten * 4.;\n float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);\n return f;\n }\n float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {\n vec4 wPos = pos;\n vec3 camWorldProj = cameraPos.xyz;\n camWorldProj.y = 0.;\n vec3 worldPosProj = wPos.xyz;\n worldPosProj.y = 0.;\n float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;\n float fDeltaY, fDensityIntegral;\n if (cameraPos.y > fogTop) {\n if (wPos.y < fogTop) {\n fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;\n fDensityIntegral = fDeltaY * fDeltaY * 0.5;\n }\n else {\n fDeltaY = 0.;\n fDensityIntegral = 0.;\n }\n }\n else {\n if (wPos.y < fogTop) {\n float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;\n float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;\n fDeltaY = abs(fDeltaA - fDeltaB);\n fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));\n }\n else {\n fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;\n fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);\n }\n }\n float fDensity;\n if (fDeltaY != 0.) {\n fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;\n }\n else {\n fDensity = 0.;\n }\n float f = exp(-fDensity);\n return f;\n }\n#endif\nvoid CC_TRANSFER_FOG_BASE(vec4 pos, out float factor)\n{\n#if CC_USE_FOG == 0\n\tfactor = LinearFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.y);\n#elif CC_USE_FOG == 1\n\tfactor = ExpFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 2\n\tfactor = ExpSquaredFog(pos, cc_cameraPos.xyz, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z);\n#elif CC_USE_FOG == 3\n\tfactor = LayeredFog(pos, cc_cameraPos.xyz, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z);\n#else\n\tfactor = 1.0;\n#endif\n}\nvoid CC_APPLY_FOG_BASE(inout vec4 color, float factor) {\n\tcolor = vec4(mix(cc_fogColor.rgb, color.rgb, factor), color.a);\n}\n#if !CC_USE_ACCURATE_FOG\nvarying mediump float v_fog_factor;\n#endif\nvoid CC_APPLY_FOG(inout vec4 color) {\n#if !CC_USE_ACCURATE_FOG\n CC_APPLY_FOG_BASE(color, v_fog_factor);\n#endif\n}\nvoid CC_APPLY_FOG(inout vec4 color, vec3 worldPos) {\n#if CC_USE_ACCURATE_FOG\n float factor;\n CC_TRANSFER_FOG_BASE(vec4(worldPos, 1.0), factor);\n#else\n float factor = v_fog_factor;\n#endif\n CC_APPLY_FOG_BASE(color, factor);\n}\n#if USE_ALPHA_TEST\n#endif\n#if USE_TEXTURE\n varying vec2 v_uv;\n uniform sampler2D mainTexture;\n#endif\n uniform vec4 mainColor;\n uniform vec4 colorScaleAndCutoff;\n#if USE_VERTEX_COLOR\n varying lowp vec4 v_color;\n#endif\nvec4 frag () {\n vec4 o = mainColor;\n o.rgb *= colorScaleAndCutoff.xyz;\n #if USE_VERTEX_COLOR\n o.rgb *= SRGBToLinear(v_color.rgb);\n o.a *= v_color.a;\n #endif\n #if USE_TEXTURE\n vec4 texColor = texture2D(mainTexture, v_uv);\n texColor.rgb = SRGBToLinear(texColor.rgb);\n o *= texColor;\n #endif\n #if USE_ALPHA_TEST\n if (o.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;\n #endif\n CC_APPLY_FOG(o);\n return CCFragOutput(o);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCMorph","defines":["CC_USE_MORPH"]},{"name":"CCSkinningTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinningAnimation","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"CCSkinning","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","!CC_USE_REAL_TIME_JOINT_TEXTURE"]},{"name":"CCLocal","defines":["!USE_INSTANCING"]}],"samplerTextures":[{"name":"cc_PositionDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_POSITION"]},{"name":"cc_NormalDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_NORMAL"]},{"name":"cc_TangentDisplacements","defines":["CC_USE_MORPH","CC_MORPH_TARGET_HAS_TANGENT"]},{"name":"cc_jointTexture","defines":["CC_USE_SKINNING","CC_USE_BAKED_ANIMATION"]},{"name":"cc_realtimeJoint","defines":["CC_USE_SKINNING","!CC_USE_BAKED_ANIMATION","CC_USE_REAL_TIME_JOINT_TEXTURE"]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":73,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":46}},"defines":[{"name":"USE_INSTANCING","type":"boolean"},{"name":"CC_USE_SKINNING","type":"boolean"},{"name":"CC_USE_BAKED_ANIMATION","type":"boolean"},{"name":"CC_USE_LIGHTMAP","type":"boolean"},{"name":"CC_RECEIVE_SHADOW","type":"boolean"},{"name":"CC_USE_MORPH","type":"boolean"},{"name":"CC_MORPH_TARGET_COUNT","type":"number","range":[2,8]},{"name":"CC_MORPH_TARGET_HAS_POSITION","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_NORMAL","type":"boolean"},{"name":"CC_MORPH_TARGET_HAS_TANGENT","type":"boolean"},{"name":"CC_MORPH_PRECOMPUTED","type":"boolean"},{"name":"CC_USE_REAL_TIME_JOINT_TEXTURE","type":"boolean"},{"name":"CC_USE_FOG","type":"number","range":[0,4]},{"name":"CC_USE_ACCURATE_FOG","type":"boolean"},{"name":"USE_VERTEX_COLOR","type":"boolean"},{"name":"USE_TEXTURE","type":"boolean"},{"name":"SAMPLE_FROM_RT","type":"boolean"},{"name":"CC_USE_DEBUG_VIEW","type":"number","range":[0,3]},{"name":"CC_USE_HDR","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"},{"name":"ALPHA_TEST_CHANNEL","type":"string","options":["a","r","g","b"]}]}],[{"name":"opaque","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}}]},{"name":"transparent","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}}]},{"name":"add","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":1,"blendSrcAlpha":2,"blendDstAlpha":1}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}}]},{"name":"alpha-blend","passes":[{"program":"builtin-unlit|unlit-vs:vert|unlit-fs:frag","rasterizerState":{"cullMode":0},"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendSrcAlpha":2,"blendDstAlpha":4}]},"depthStencilState":{"depthTest":true,"depthWrite":false},"properties":{"mainTexture":{"value":"grey","type":28},"tilingOffset":{"type":16,"value":[1,1,0,0]},"mainColor":{"linear":true,"type":16,"value":[1,1,1,1]},"colorScale":{"type":15,"value":[1,1,1],"handleInfo":["colorScaleAndCutoff",0,15]},"alphaThreshold":{"type":13,"value":[0.5],"handleInfo":["colorScaleAndCutoff",3,13]},"color":{"linear":true,"type":16,"handleInfo":["mainColor",0,16]},"colorScaleAndCutoff":{"type":16,"value":[1,1,1,0.5]}}}]}]]],0,0,[],[],[]],[[[0,"default-spine-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":false,"IS_GRAY":false}]]],0,0,[0],[0],[3]],[[[3,"missing-effect-material",[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_COLOR":true}],[[[{},"mainColor",8,[4,4278255615]]],11]]],0,0,[0],[0],[1]],[[[1,"builtin-spine",[{"hash":3890043391,"name":"builtin-spine|sprite-vs:vert|sprite-fs:frag","blocks":[{"name":"ALPHA_TEST_DATA","stageFlags":16,"binding":0,"members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"]}],"samplerTextures":[],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":32,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]},{"name":"a_color2","format":44,"location":3,"defines":["TWO_COLORED"]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision highp float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#if USE_LOCAL\n layout(std140) uniform CCLocal {\n highp mat4 cc_matWorld;\n highp mat4 cc_matWorldIT;\n highp vec4 cc_lightingMapUVParam;\n highp vec4 cc_localShadowBias;\n };\n#endif\nin vec3 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nout vec4 v_light;\nout vec2 uv0;\n#if TWO_COLORED\n in vec4 a_color2;\n out vec4 v_dark;\n#endif\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n pos = cc_matViewProj * pos;\n uv0 = a_texCoord;\n v_light = a_color;\n #if TWO_COLORED\n v_dark = a_color2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n layout(std140) uniform ALPHA_TEST_DATA {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_light;\n#if TWO_COLORED\n in vec4 v_dark;\n#endif\nin vec2 uv0;\nuniform sampler2D cc_spriteTexture;\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if TWO_COLORED\n vec4 texColor = vec4(1, 1, 1, 1);\n texColor *= texture(cc_spriteTexture, uv0);\n o.a = texColor.a * v_light.a;\n o.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n o *= texture(cc_spriteTexture, uv0);\n o *= v_light;\n #endif\n ALPHA_TEST(o);\n return o;\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision highp float;\nuniform highp mat4 cc_matViewProj;\n#if USE_LOCAL\n uniform highp mat4 cc_matWorld;\n#endif\nattribute vec3 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec4 v_light;\nvarying vec2 uv0;\n#if TWO_COLORED\n attribute vec4 a_color2;\n varying vec4 v_dark;\n#endif\nvec4 vert () {\n vec4 pos = vec4(a_position, 1);\n #if USE_LOCAL\n pos = cc_matWorld * pos;\n #endif\n pos = cc_matViewProj * pos;\n uv0 = a_texCoord;\n v_light = a_color;\n #if TWO_COLORED\n v_dark = a_color2;\n #endif\n return pos;\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_light;\n#if TWO_COLORED\n varying vec4 v_dark;\n#endif\nvarying vec2 uv0;\nuniform sampler2D cc_spriteTexture;\nvec4 frag () {\n vec4 o = vec4(1, 1, 1, 1);\n #if TWO_COLORED\n vec4 texColor = vec4(1, 1, 1, 1);\n texColor *= texture2D(cc_spriteTexture, uv0);\n o.a = texColor.a * v_light.a;\n o.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n o *= texture2D(cc_spriteTexture, uv0);\n o *= v_light;\n #endif\n ALPHA_TEST(o);\n return o;\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[{"name":"CCLocal","defines":["USE_LOCAL"]}],"samplerTextures":[{"name":"cc_spriteTexture","defines":[]}],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":54,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":1}},"defines":[{"name":"USE_LOCAL","type":"boolean"},{"name":"TWO_COLORED","type":"boolean"},{"name":"USE_ALPHA_TEST","type":"boolean"}]}],[{"passes":[{"program":"builtin-spine|sprite-vs:vert|sprite-fs:frag","blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false},"properties":{"alphaThreshold":{"type":13,"value":[0.5]}}}]}]]],0,0,[],[],[]],[[[3,"missing-material",[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_COLOR":true}],[[[{},"mainColor",8,[4,4294902015]]],11]]],0,0,[0],[0],[1]],[[[0,"ui-sprite-gray-alpha-sep-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":true,"IS_GRAY":true}]]],0,0,[0],[0],[0]],[[[0,"ui-base-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":false}]]],0,0,[0],[0],[0]],[[[0,"ui-sprite-gray-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":false,"IS_GRAY":true}]]],0,0,[0],[0],[0]],[[[0,"ui-graphics-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{}]]],0,0,[0],[0],[4]],[[[0,"ui-sprite-alpha-sep-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"CC_USE_EMBEDDED_ALPHA":true,"IS_GRAY":false}]]],0,0,[0],[0],[0]],[[[0,"ui-sprite-material",[{}],[{"rasterizerState":{},"depthStencilState":{},"blendState":{"targets":[{}]}}],[{"USE_TEXTURE":true,"IS_GRAY":false,"CC_USE_EMBEDDED_ALPHA":false}]]],0,0,[0],[0],[0]],[[[1,"builtin-debug-renderer",[{"hash":1057188006,"name":"builtin-debug-renderer|debug-renderer-vs:vert|debug-renderer-fs:frag","blocks":[],"samplerTextures":[{"name":"mainTexture","type":28,"count":1,"stageFlags":16,"binding":0,"defines":[]}],"samplers":[],"textures":[],"buffers":[],"images":[],"subpassInputs":[],"attributes":[{"name":"a_position","format":21,"location":0,"defines":[]},{"name":"a_texCoord","format":21,"location":1,"defines":[]},{"name":"a_color","format":44,"location":2,"defines":[]}],"fragColors":[{"name":"cc_FragColor","typename":"vec4","type":16,"count":1,"stageFlags":16,"location":0,"defines":[]}],"glsl3":{"vert":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183f\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define CC_LIGHTMAP_DISABLED 0\n#define CC_LIGHTMAP_ALL_IN_ONE 1\n#define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\nin vec2 a_position;\nin vec2 a_texCoord;\nin vec4 a_color;\nout vec2 v_texCoord;\nout vec4 v_color;\nvec4 vert () {\n int orientation = int(cc_surfaceTransform.x);\n vec4 transform = vec4(1.0, 0.0, 0.0, 1.0);\n if (orientation == 0) {\n transform = vec4(1.0, 0.0, 0.0, 1.0);\n } else if (orientation == 1) {\n transform = vec4(0.0, 1.0, -1.0, 0.0);\n } else if (orientation == 2) {\n transform = vec4(-1.0, 0.0, 0.0, -1.0);\n } else if (orientation == 3) {\n transform = vec4(0.0, -1.0, 1.0, 0.0);\n }\n vec2 invScreenSize = (orientation == 1 || orientation == 3) ? cc_screenSize.wz : cc_screenSize.zw;\n vec2 position = a_position * invScreenSize;\n position = position * vec2(2.0, -2.0) + vec2(-1.0, 1.0);\n vec2 clipPos = vec2(dot(transform.xy, position), dot(transform.zw, position));\n clipPos = cc_cameraPos.w == 0.0 ? vec2(clipPos.x, -clipPos.y) : clipPos;\n v_texCoord = a_texCoord;\n v_color = a_color;\n return vec4(clipPos, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nlayout(std140) uniform CCGlobal {\n highp vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_nativeSize;\n mediump vec4 cc_debug_view_mode;\n mediump vec4 cc_debug_view_composite_pack_1;\n mediump vec4 cc_debug_view_composite_pack_2;\n mediump vec4 cc_debug_view_composite_pack_3;\n};\nlayout(std140) uniform CCCamera {\n highp mat4 cc_matView;\n highp mat4 cc_matViewInv;\n highp mat4 cc_matProj;\n highp mat4 cc_matProjInv;\n highp mat4 cc_matViewProj;\n highp mat4 cc_matViewProjInv;\n highp vec4 cc_cameraPos;\n mediump vec4 cc_surfaceTransform;\n mediump vec4 cc_screenScale;\n mediump vec4 cc_exposure;\n mediump vec4 cc_mainLitDir;\n mediump vec4 cc_mainLitColor;\n mediump vec4 cc_ambientSky;\n mediump vec4 cc_ambientGround;\n mediump vec4 cc_fogColor;\n mediump vec4 cc_fogBase;\n mediump vec4 cc_fogAdd;\n mediump vec4 cc_nearFar;\n mediump vec4 cc_viewPort;\n};\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nin vec2 v_texCoord;\nin vec4 v_color;\nuniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = vec4(v_color.rgb, v_color.a * texture(mainTexture, v_texCoord).r);\n return CCFragOutput(color);\n}\nlayout(location = 0) out vec4 cc_FragColor;\nvoid main() { cc_FragColor = frag(); }"},"glsl1":{"vert":"\nprecision mediump float;\nuniform mediump vec4 cc_screenSize;\nuniform highp vec4 cc_cameraPos;\n uniform mediump vec4 cc_surfaceTransform;\n#define QUATER_PI 0.78539816340\n#define HALF_PI 1.57079632679\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI4 12.5663706144\n#define INV_QUATER_PI 1.27323954474\n#define INV_HALF_PI 0.63661977237\n#define INV_PI 0.31830988618\n#define INV_PI2 0.15915494309\n#define INV_PI4 0.07957747155\n#define EPSILON 1e-6\n#define EPSILON_LOWP 1e-4\n#define LOG2 1.442695\n#define EXP_VALUE 2.71828183f\n#define FP_MAX 65504.0\n#define FP_SCALE 0.0009765625\n#define FP_SCALE_INV 1024.0\n#define GRAY_VECTOR vec3(0.299, 0.587, 0.114)\n#define CC_LIGHTMAP_DISABLED 0\n#define CC_LIGHTMAP_ALL_IN_ONE 1\n#define CC_LIGHTMAP_CC_LIGHTMAP_INDIRECT_OCCLUSION 2\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\nvec4 vert () {\n int orientation = int(cc_surfaceTransform.x);\n vec4 transform = vec4(1.0, 0.0, 0.0, 1.0);\n if (orientation == 0) {\n transform = vec4(1.0, 0.0, 0.0, 1.0);\n } else if (orientation == 1) {\n transform = vec4(0.0, 1.0, -1.0, 0.0);\n } else if (orientation == 2) {\n transform = vec4(-1.0, 0.0, 0.0, -1.0);\n } else if (orientation == 3) {\n transform = vec4(0.0, -1.0, 1.0, 0.0);\n }\n vec2 invScreenSize = (orientation == 1 || orientation == 3) ? cc_screenSize.wz : cc_screenSize.zw;\n vec2 position = a_position * invScreenSize;\n position = position * vec2(2.0, -2.0) + vec2(-1.0, 1.0);\n vec2 clipPos = vec2(dot(transform.xy, position), dot(transform.zw, position));\n clipPos = cc_cameraPos.w == 0.0 ? vec2(clipPos.x, -clipPos.y) : clipPos;\n v_texCoord = a_texCoord;\n v_color = a_color;\n return vec4(clipPos, 0.0, 1.0);\n}\nvoid main() { gl_Position = vert(); }","frag":"\nprecision mediump float;\nuniform mediump vec4 cc_debug_view_mode;\n uniform mediump vec4 cc_debug_view_composite_pack_1;\n uniform mediump vec4 cc_debug_view_composite_pack_2;\n uniform mediump vec4 cc_debug_view_composite_pack_3;\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1\n#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1\n#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1\n#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1\n#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1\n#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1\n#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1\n#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1\n#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1\n#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1\n#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1\n#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1\n#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1\n#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1\n#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1\n#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1\n#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1\n#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1\n#define CC_SURFACES_DEBUG_VIEW_SINGLE 1\n#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2\n#define IS_DEBUG_VIEW_LIGHTING_ENABLE_WITH_ALBEDO (cc_debug_view_mode.y > 0.0)\n#define IS_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION (cc_debug_view_mode.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_DIFFUSE (cc_debug_view_composite_pack_1.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_DIRECT_SPECULAR (cc_debug_view_composite_pack_1.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_DIFFUSE (cc_debug_view_composite_pack_1.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_ENV_SPECULAR (cc_debug_view_composite_pack_1.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_EMISSIVE (cc_debug_view_composite_pack_2.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_LIGHT_MAP (cc_debug_view_composite_pack_2.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_SHADOW (cc_debug_view_composite_pack_2.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_AO (cc_debug_view_composite_pack_2.w > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_NORMAL_MAP (cc_debug_view_composite_pack_3.x > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_FOG (cc_debug_view_composite_pack_3.y > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_TONE_MAPPING (cc_debug_view_composite_pack_3.z > 0.0)\n#define IS_DEBUG_VIEW_COMPOSITE_ENABLE_GAMMA_CORRECTION (cc_debug_view_composite_pack_3.w > 0.0)\nvec4 CCFragOutput (vec4 color) {\n return color;\n}\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\nuniform sampler2D mainTexture;\nvec4 frag () {\n vec4 color = vec4(v_color.rgb, v_color.a * texture2D(mainTexture, v_texCoord).r);\n return CCFragOutput(color);\n}\nvoid main() { gl_FragColor = frag(); }"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]},{"name":"CCCamera","defines":[]}],"samplerTextures":[],"buffers":[],"images":[]},"locals":{"blocks":[],"samplerTextures":[],"buffers":[],"images":[]},"statistics":{"CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS":44,"CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS":44}},"defines":[]}],[{"passes":[{"program":"builtin-debug-renderer|debug-renderer-vs:vert|debug-renderer-fs:frag","priority":255,"blendState":{"targets":[{"blend":true,"blendSrc":2,"blendDst":4,"blendDstAlpha":4}]},"rasterizerState":{"cullMode":0},"depthStencilState":{"depthTest":false,"depthWrite":false}}]}]]],0,0,[],[],[]]]] diff --git a/hurt/page/assets/internal/index.js b/hurt/page/assets/internal/index.js new file mode 100644 index 0000000..0190697 --- /dev/null +++ b/hurt/page/assets/internal/index.js @@ -0,0 +1,20 @@ +System.register("chunks:///_virtual/internal",[],(function(){"use strict";return{execute:function(){}}})); + +(function(r) { + r('virtual:///prerequisite-imports/internal', 'chunks:///_virtual/internal'); +})(function(mid, cid) { + System.register(mid, [cid], function (_export, _context) { + return { + setters: [function(_m) { + var _exportObj = {}; + + for (var _key in _m) { + if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key]; + } + + _export(_exportObj); + }], + execute: function () { } + }; + }); +}); \ No newline at end of file diff --git a/hurt/page/assets/main/config.json b/hurt/page/assets/main/config.json new file mode 100644 index 0000000..8e760ef --- /dev/null +++ b/hurt/page/assets/main/config.json @@ -0,0 +1 @@ +{"importBase":"import","nativeBase":"native","name":"main","deps":[],"uuids":["0a5581a1e","44m3FLs79P3JMW9xJc2LOC","fdjsU2o1RKF5x0TziDw3jI","24xBnqY6hOoanQf8RpSJu8","24xBnqY6hOoanQf8RpSJu8@6c48a","24xBnqY6hOoanQf8RpSJu8@f9941","868l1cneVFT6X57hZgPmcB"],"paths":{"2":["db:/internal/default_renderpipeline/builtin-forward",0]},"scenes":{"db://assets/scene.scene":1},"packs":{"0a5581a1e":["3","4","5","1","6","2"]},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"types":["cc.RenderPipeline"]} \ No newline at end of file diff --git a/hurt/page/assets/main/import/0a/0a5581a1e.json b/hurt/page/assets/main/import/0a/0a5581a1e.json new file mode 100644 index 0000000..f125d00 --- /dev/null +++ b/hurt/page/assets/main/import/0a/0a5581a1e.json @@ -0,0 +1 @@ +[1,["24xBnqY6hOoanQf8RpSJu8@f9941","868l1cneVFT6X57hZgPmcB","24xBnqY6hOoanQf8RpSJu8@6c48a"],["node","_file","_spriteFrame","_textureSource","_cameraComponent","scene","_parent","spriteFrame"],[["cc.Node",["_name","_layer","_id","_components","_lpos","_children","_parent"],0,9,5,2,1],["cc.UITransform",["node","_contentSize"],3,1,5],["RenderQueueDesc",["stages","isTransparent","sortMode"],0],"cc.ImageAsset","cc.Texture2D","cc.SpriteFrame",["cc.SceneAsset",["_name"],2],["cc.Node",["_name","_parent","_components","_lpos"],2,1,2,5],["cc.Canvas",["node","_cameraComponent"],3,1,1],["cc.Widget",["_alignFlags","_top","_bottom","node"],0,1],["cc.ParticleSystem2D",["_name","_dstBlendFactor","emissionRate","life","lifeVar","angle","angleVar","startSize","startSizeVar","endSize","startSpin","endSpin","endSpinVar","speed","speedVar","tangentialAccel","tangentialAccelVar","radialAccel","radialAccelVar","startRadius","_totalParticles","node","posVar","gravity","_startColor","_startColorVar","_endColor","_endColorVar","_file","_spriteFrame"],-18,1,5,5,5,5,5,5,6,6],["ae2d8iSk19Mu4qQwL5kOtqc",["node"],3,1],["3e0d2uf/TxIpKJeFhE5QIxr",["node"],3,1],["6eb33CO51xA4LUUt2PhhO/z",["node"],3,1],["ad47d0CVWhJJbEdVhc/5bKj",["node"],3,1],["cc.Scene",["_name","_children","_globals"],2,2,4],["cc.SceneGlobals",["ambient","shadows","_skybox","fog","octree"],3,4,4,4,4,4],["cc.AmbientInfo",["_skyColorHDR","_groundAlbedoHDR"],3,5,5],["cc.ShadowsInfo",["_shadowColor","_size"],3,5,5],["cc.SkyboxInfo",[],3],["cc.FogInfo",[],3],["cc.OctreeInfo",[],3],["cc.Camera",["_projection","_priority","_orthoHeight","_near","_far","_visibility","node","_color"],-3,1,5],["cc.ParticleAsset",["_name","_native"],1],["ForwardPipeline",["_flows"],3,9],["ShadowFlow",["_name","_stages"],2,9],["ShadowStage",["_name"],2],["ForwardFlow",["_name","_priority","_stages"],1,9],["ForwardStage",["_name","renderQueues"],2,9]],[[0,0,1,6,3,4,3],[1,0,1],[10,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,22],[6,0,2],[0,0,1,2,5,3,4,4],[7,0,1,2,3,2],[1,0,1,1],[8,0,1,1],[9,0,1,2,3,4],[11,0,1],[12,0,1],[13,0,1],[14,0,1],[15,0,1,2,2],[16,0,1,2,3,4,1],[17,0,1,1],[18,0,1,1],[19,1],[20,1],[21,1],[22,0,1,2,3,4,5,6,7,7],[23,0,1,3],[24,0,1],[25,0,1,2],[26,0,2],[27,0,1,2,3],[28,0,1,2],[2,0,2],[2,1,2,0,4]],[[[{"fmt":"0","w":0,"h":0},-1],[3],0,[],[],[]],[[{"base":"2,2,2,2,0,0","mipmaps":["24xBnqY6hOoanQf8RpSJu8"]}],[4],0,[],[],[]],[[{"name":"atom","rect":{"x":0,"y":0,"width":31,"height":31},"offset":{"x":0,"y":0},"originalSize":{"width":31,"height":31},"rotated":false,"capInsets":[0,0,0,0],"vertices":{"rawPosition":[-15.5,-15.5,0,15.5,-15.5,0,-15.5,15.5,0,15.5,15.5,0],"indexes":[0,1,2,2,1,3],"uv":[0,31,31,31,0,0,31,0],"nuv":[0,0,1,0,0,1,1,1],"minPos":{"x":-15.5,"y":-15.5,"z":0},"maxPos":{"x":15.5,"y":15.5,"z":0}},"packable":true,"pixelsToUnit":100,"pivot":{"x":0.5,"y":0.5},"meshType":0}],[5],0,[0],[3],[2]],[[[3,"scene"],[4,"Canvas",33554432,"beI88Z2HpFELqR4T5EMHpg",[-5,-6,-7,-8,-9],[[6,-1,[5,960,640]],[7,-3,-2],[8,45,5.684341886080802e-14,5.684341886080802e-14,-4]],[1,480,320.00000000000006,0]],[0,"Heart",33554432,1,[[1,-10],[2,"Node",1,999.999985098839,0.20000000298023224,0.5,360,360,3.369999885559082,50,30.31999969482422,-47.369998931884766,-47.369998931884766,-142.11000061035156,0,190.7899932861328,-92.11000061035156,65.79000091552734,-671.0499877929688,65.79000091552734,100,200,-11,[0,7,7],[0,0.25,0.8600000143051147],[4,2740373706],[4,3333292005],[4,3591610797],[4,3170498923],0,1],[9,-12]],[1,0,0,-1]],[0,"T",33554432,1,[[1,-13],[2,"Node",1,999.999985098839,0.20000000298023224,0.5,360,360,3.369999885559082,50,30.31999969482422,-47.369998931884766,-47.369998931884766,-142.11000061035156,0,190.7899932861328,-92.11000061035156,65.79000091552734,-671.0499877929688,65.79000091552734,100,200,-14,[0,7,7],[0,0.25,0.8600000143051147],[4,2740373706],[4,3333292005],[4,3591610797],[4,3170498923],2,3],[10,-15]],[1,0,0,-1]],[0,"V",33554432,1,[[1,-16],[2,"Node",1,999.999985098839,0.20000000298023224,0.5,360,360,3.369999885559082,50,30.31999969482422,-47.369998931884766,-47.369998931884766,-142.11000061035156,0,190.7899932861328,-92.11000061035156,65.79000091552734,-671.0499877929688,65.79000091552734,100,200,-17,[0,7,7],[0,0.25,0.8600000143051147],[4,2740373706],[4,3333292005],[4,3591610797],[4,3170498923],4,5],[11,-18]],[1,0,0,-1]],[0,"Split",33554432,1,[[1,-19],[2,"Node",1,999.999985098839,0.20000000298023224,0.5,360,360,3.369999885559082,50,30.31999969482422,-47.369998931884766,-47.369998931884766,-142.11000061035156,0,190.7899932861328,-92.11000061035156,65.79000091552734,-671.0499877929688,65.79000091552734,100,200,-20,[0,7,7],[0,0.25,0.8600000143051147],[4,2740373706],[4,3333292005],[4,3591610797],[4,3170498923],6,7],[12,-21]],[1,0,0,-1]],[13,"scene-2d",[1],[14,[15,[2,0,0,0,0.520833125],[2,0,0,0,0]],[16,[4,4283190348],[0,512,512]],[17],[18],[19]]],[5,"Camera",1,[-22],[1,0,0,1000]],[20,0,1073741824,329.38967136150234,0,2000,41943040,7,[4,4278190080]]],0,[0,0,1,0,4,8,0,0,1,0,0,1,0,-1,7,0,-2,2,0,-3,3,0,-4,4,0,-5,5,0,0,2,0,0,2,0,0,2,0,0,3,0,0,3,0,0,3,0,0,4,0,0,4,0,0,4,0,0,5,0,0,5,0,0,5,0,-1,8,0,5,6,1,6,6,22],[0,0,0,0,0,0,0,0],[1,2,1,2,1,2,1,2],[1,0,1,0,1,0,1,0]],[[[21,"atom",".plist"],-1],0,0,[0],[7],[0]],[[[22,[[23,"ShadowFlow",[[24,"ShadowStage"]]],[25,"ForwardFlow",1,[[26,"ForwardStage",[[27,["default"]],[28,true,1,["default"]]]]]]]]],0,0,[],[],[]]]] diff --git a/hurt/page/assets/main/index.js b/hurt/page/assets/main/index.js new file mode 100644 index 0000000..2430811 --- /dev/null +++ b/hurt/page/assets/main/index.js @@ -0,0 +1,30 @@ +System.register("chunks:///_virtual/BasePartical.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){"use strict";var e,c,r,n,a;return{setters:[function(t){e=t.inheritsLoose},function(t){c=t.cclegacy,r=t._decorator,n=t.Vec3,a=t.Component}],execute:function(){var i;c._RF.push({},"a78fatwjGhKPoEZcmW+t1Vb","BasePartical",void 0);var o=r.ccclass;r.property,t("BasePartical",o("BasePartical")(i=function(t){function c(){for(var e,c=arguments.length,r=new Array(c),n=0;n + + + + angle + 360 + angleVariance + 360 + blendFuncDestination + 1 + blendFuncSource + 2 + duration + -1 + emitterType + 0 + finishColorAlpha + 0.8399999737739563 + finishColorBlue + 0.0771484375 + finishColorGreen + 0.6349284052848816 + finishColorRed + 0.6808268427848816 + finishColorVarianceAlpha + 0.7400000095367432 + finishColorVarianceBlue + 0.9800000190734863 + finishColorVarianceGreen + 0.9800000190734863 + finishColorVarianceRed + 0.41999998688697815 + finishParticleSize + 30.31999969482422 + finishParticleSizeVariance + 0 + gravityx + 0.25 + gravityy + 0.8600000143051147 + maxParticles + 200 + maxRadius + 100 + maxRadiusVariance + 0 + minRadius + 0 + particleLifespan + 0.20000000298023224 + particleLifespanVariance + 0.5 + radialAccelVariance + 65.79000091552734 + radialAcceleration + -671.0499877929688 + rotatePerSecond + 0 + rotatePerSecondVariance + 0 + rotationEnd + -47.369998931884766 + rotationEndVariance + -142.11000061035156 + rotationStart + -47.369998931884766 + rotationStartVariance + 0 + sourcePositionVariancex + 7 + sourcePositionVariancey + 7 + sourcePositionx + 373.7277526855469 + sourcePositiony + 478.40472412109375 + speed + 0 + speedVariance + 190.7899932861328 + startColorAlpha + 0.6399999856948853 + startColorBlue + 0.3375650942325592 + startColorGreen + 0.7879231572151184 + startColorRed + 0.794921875 + startColorVarianceAlpha + 0.7799999713897705 + startColorVarianceBlue + 0.6800000071525574 + startColorVarianceGreen + 1 + startColorVarianceRed + 0.8999999761581421 + startParticleSize + 3.369999885559082 + startParticleSizeVariance + 50 + tangentialAccelVariance + 65.79000091552734 + tangentialAcceleration + -92.11000061035156 + spriteFrameUuid + 24c419ea-63a8-4ea1-a9d0-7fc469489bbc@f9941 + + \ No newline at end of file diff --git a/hurt/page/cocos-js/cc.js b/hurt/page/cocos-js/cc.js new file mode 100644 index 0000000..6d3ac4d --- /dev/null +++ b/hurt/page/cocos-js/cc.js @@ -0,0 +1,3 @@ +System.register([],(function(t,e){"use strict";return{execute:function(){function i(t){var e,i;return e=(t>65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function n(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function r(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}function s(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}t({AntiAliasing:void 0,BitMask:ce,CCClass:ui,CacheMode:void 0,DebugMode:void 0,ECollider2DType:void 0,EJoint2DType:void 0,EPhysics2DDrawFlags:void 0,ERaycast2DType:void 0,ERigidBody2DType:void 0,Enum:_e,Eventify:Pa,ExtrapolationMode:void 0,HorizontalTextAlignment:void 0,InstanceMaterialType:void 0,KeyCode:void 0,NodeEventType:void 0,NodeSpace:void 0,Overflow:void 0,Physics2DManifoldType:void 0,PhysicsGroup:void 0,PipelineEventType:void 0,QuatInterpolationMode:void 0,RealInterpolationMode:void 0,SystemEventType:void 0,TangentWeightMode:void 0,TransformBit:void 0,VerticalTextAlignment:void 0,WorldNode3DToLocalNodeUI:uB,WorldNode3DToWorldNodeUI:lB,__checkObsoleteInNamespace__:function(t){return ct||(ct="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return dt(e),Reflect.get(t,e,i)}})),ct},__checkObsolete__:function(t){for(var e,i=v(t);!(e=i()).done;)dt(e.value)},absMax:Oi,absMaxComponent:Mi,approx:gi,assert:V,assertID:Z,bezier:Kf,bezierByTime:fd,buildShadowPass:uL,buildShadowPasses:cL,ccenum:pe,clamp:yi,clamp01:vi,color:Gi,computeRatioByType:QQ,createDefaultPipeline:fN,debug:k,deprecateModuleExportedName:ft,deserialize:e_,earcut:DY,enumerableProps:Fi,equals:mi,error:L,errorID:q,find:Jx,fragmentText:KV,getBaselineOffset:function(){return 0},getCameraUniqueID:dL,getEnglishWordPartAtFirst:YV,getEnglishWordPartAtLast:qV,getError:Q,getLoadOpOfClearFlag:pL,getPathFromRoot:function(t,e){for(var i=t,n="";null!==i&&i!==e;)n=i.name+"/"+n,i=i.parent;return n.slice(0,-1)},getRenderArea:hL,getSerializationMetadata:function(t){return t[vu]},getWorldTransformUntilRoot:function(t,e,i){for(hn.identity(i);t!==e;)hn.fromRTS(V1,t.rotation,t.position,t.scale),hn.multiply(i,V1,i),t=t.parent;return i},instantiate:y_,inverseLerp:Pi,isDisplayStats:$,isEnglishWordPartAtFirst:function(t){return zV.test(t)},isEnglishWordPartAtLast:function(t){return UV.test(t)},isUnicodeCJK:HV,isUnicodeSpace:WV,isValid:Ea,lerp:Ai,log:F,logID:W,markAsWarning:void 0,mat4:cn,murmurhash2_32_gc:Hs,nextPow2:Ii,pingPong:Di,pseudoRandom:wi,pseudoRandomRange:xi,pseudoRandomRangeInt:Ri,quat:an,randomRange:Ei,randomRangeInt:Ci,rect:An,removeProperty:void 0,repeat:Bi,replaceProperty:void 0,safeMeasureText:XV,sampleAnimationCurve:ZQ,setDefaultLogTimes:function(t){t>0&&(ht=t)},setDisplayStats:tt,size:yn,toDegree:bi,toRadian:Si,tween:L_t,tweenUtil:V_t,v2:pn,v3:Ki,v4:Li,validPunctualLightsCulling:gL,warn:N,warnID:j});var a=new Array(256);!function(t){for(var e=0;e<256;++e){var i=e,n=e,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;t[e]=n<0)-(t<0)},abs:function(t){var e=t>>31;return(t^e)-e},min:function(t,e){return e^(t^e)&-(t=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},popCount:n,countTrailingZeros:r,nextPow2:s,prevPow2:function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},parity:function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1},reverse:function(t){return a[255&t]<<24|a[t>>>8&255]<<16|a[t>>>16&255]<<8|a[t>>>24&255]},interleave2:function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},deinterleave2:function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},interleave3:function(t,e,i){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},nextCombination:function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>r(t)+1}});function h(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(i=t[Symbol.iterator]()).next.bind(i)}function A(t,e,i,n){i&&Object.defineProperty(t,e,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})}function S(t,e,i,n,r){var s={};return Object.keys(n).forEach((function(t){s[t]=n[t]})),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=i.slice().reverse().reduce((function(i,n){return n(t,e,i)||i}),s),r&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(r):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(t,e,s),s=null),s}function b(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t("bits",o),b("CC_WECHAT",!1),b("CC_BAIDU",!1),b("CC_XIAOMI",!1),b("CC_ALIPAY",!1),b("CC_BYTEDANCE",!1),b("CC_OPPO",!1),b("CC_VIVO",!1),b("CC_HUAWEI",!1),b("CC_COCOSPLAY",!1),b("CC_QTT",!1),b("CC_LINKSURE",!1);const T=!1;b("CC_EDITOR",!1),b("CC_PREVIEW",!1),b("CC_BUILD",!0),b("CC_TEST",!1),b("CC_DEBUG",!1),b("CC_DEV",!1),b("CC_MINIGAME",!1),b("CC_RUNTIME_BASED",!1),b("CC_SUPPORT_JIT",!0),b("CC_JSB",!1);var E="undefined"==typeof window?global:window,C=t("cclegacy",{_global:E});C.internal={};var w=t("VERSION","3.6.2");E.CocosEngine=C.ENGINE_VERSION=w,E.cc=C;var x="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",R=null,I=console.log.bind(console),B=I,D=I,P=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n2?i-2:0),r=2;rK.ERROR){var e=function(t){if(C.game.canvas){if(!R){var e=document.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",C.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(R=document.createElement("textarea")).setAttribute("rows","20"),R.setAttribute("cols","30"),R.setAttribute("disabled","true");var n=R.style;n.backgroundColor="transparent",n.borderBottom="1px solid #cccccc",n.borderTopWidth=n.borderLeftWidth=n.borderRightWidth="0px",n.borderTopStyle=n.borderLeftStyle=n.borderRightStyle="none",n.padding="0px",n.margin="0px",e.appendChild(R),C.game.canvas.parentNode.appendChild(e)}R.value=R.value+t+"\r\n",R.scrollTop=R.scrollHeight}};D=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r2?n-2:0),s=2;s1?i-1:0),r=1;r1?i-1:0),r=1;r1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;n1?e-1:0),n=1;n1?n-1:0),s=1;s1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;no.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},et=t("replaceProperty",(function(t,e,i){null!=t&&i.forEach((function(i){var n=ut++;lt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ht});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,h=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return rt(e,i.name,a,s,N,n,h),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var u=null!=i.customSetter,l=null!=i.customGetter;u&&l?Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,N,n,h),i.customGetter.call(this)},set:function(t){rt(e,i.name,a,s,N,n,h),i.customSetter.call(this,t)},enumerable:!1}):u?Object.defineProperty(t,i.name,{set:function(t){rt(e,i.name,a,s,N,n,h),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,N,n,h),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,N,n,h),o?this[s]:r[s]},set:function(t){rt(e,i.name,a,s,N,n,h),o?this[s]=t:r[s]=t},enumerable:!1})}))})),at=function(t,e,i,n,r){var s=lt.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},it=t("removeProperty",(function(t,e,i){null!=t&&i.forEach((function(i){var n=ut++;lt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ht});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,L,n,r)},set:function(){at(e,i.name,L,n,r)},enumerable:!1})}))})),st=function(t,e,i,n,r){var s=lt.get(n);s&&s.logTimes>s.count&&(i("'%s' is deprecated. "+r,t+"."+e),s.count++)},nt=t("markAsWarning",(function(t,e,i){null!=t&&i.forEach((function(i){var n=i.name,r=Object.getOwnPropertyDescriptor(t,n);if(r&&r.configurable){var s=ut++;lt.set(s,{id:s,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ht});var a=i.suggest?"("+i.suggest+")":"";if(void 0!==r.value)if("function"==typeof r.value){var o=r.value;t[n]=function(){return st(e,n,N,s,a),o.call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}}else{var h=r.value;Object.defineProperty(t,n,{configurable:!0,get:function(){return st(e,n,N,s,a),h}}),r.writable&&Object.defineProperty(t,n,{set:function(t){st(e,n,N,s,a),h=t}})}else!function(e,i,n,r,s,a){if(e.get){var o=e.get;e.get=function(){return st(i,n,r,s,a),o.call(this)}}if(e.set){var h=e.set;e.set=function(t){st(i,n,r,s,a),h.call(this,t)}}Object.defineProperty(t,n,e)}(r,e,n,N,s,a);Object.defineProperty(t,n,{enumerable:!1})}}))}));var ct,_t={};function ft(t){for(var e in t){var i=t[e];_t[e]=i}}function dt(t){var e=_t[t];if(e){var i=e.newName,n=e.since;e.removed?i?q(16003,t,n,i):q(16002,t,n):i?j(16001,t,n,i):j(16e3,t,n)}}var pt=function(){function t(t){this.i=0,this.array=t}var e=t.prototype;return e.remove=function(t){var e=this.array.indexOf(t);e>=0&&this.removeAt(e)},e.removeAt=function(t){this.array.splice(t,1),t<=this.i&&--this.i},e.fastRemove=function(t){var e=this.array.indexOf(t);e>=0&&this.fastRemoveAt(e)},e.fastRemoveAt=function(t){var e=this.array;e[t]=e[e.length-1],--e.length,t<=this.i&&--this.i},e.push=function(t){this.array.push(t)},u(t,[{key:"length",get:function(){return this.array.length},set:function(t){this.array.length=t,this.i>=t&&(this.i=t-1)}}]),t}();function mt(t,e){t.splice(e,1)}function gt(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function yt(t,e){var i=t.indexOf(e);return i>=0&&(mt(t,i),!0)}function vt(t,e){return t.indexOf(e)>=0}var At=Object.freeze({__proto__:null,removeAt:mt,fastRemoveAt:gt,remove:yt,fastRemove:function(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)},removeIf:function(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return mt(t,i),n}},verifyType:function(t,e){if(t&&t.length>0)for(var i,n=v(t);!(i=n()).done;)if(!(i.value instanceof e))return W(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n0){--this.count;var t=this._pool[this.count];return this._pool[this.count]=null,t}return null},t.put=function(t){var e=this._pool;if(this.count=0&&(this._pool.length=t,this.count>t&&(this.count=t))},e}(),ue=At,le={IDGenerator:St,Pool:he,array:At,isNumber:Ct,isString:wt,isEmptyObject:xt,getPropertyDescriptor:Ut,addon:Ht,mixin:Wt,extend:Xt,getSuper:jt,isChildClassOf:Yt,clear:qt,value:It,getset:Bt,get:Dt,set:Pt,unregisterClass:ie,getClassName:Ot,setClassName:te,setClassAlias:ee,getClassByName:se,getClassById:re,get _registeredClassNames(){return l({},Jt)},set _registeredClassNames(t){qt(Jt),Object.assign(Jt,t)},get _registeredClassIds(){return l({},Kt)},set _registeredClassIds(t){qt(Kt),Object.assign(Kt,t)},_getClassId:ae,getClassId:oe,_setClassId:Qt,_getClassById:ne,obsolete:Ft,obsoletes:Nt,formatStr:kt,shiftArguments:Gt,createMap:Mt};function ce(t){if("__bitmask__"in t)return t;It(t,"__bitmask__",null,!0);for(var e=-1,i=Object.keys(t),n=0;ni){var n=e;e=i,i=n}return t=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Ne(r,(e=i[n+1])&&e.__attrs__)}return Ne(t,(e=i[0])&&e.__attrs__),t.__attrs__}function Ve(t,e){var i=ke(t),n=e+Fe,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function ke(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Le(t)}function Ge(t,e,i,n){ke(t)[e+Fe+i]=n}var Ue=function(){function t(t,e){this.name=void 0,this.default=void 0,this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),ze=t("CCInteger",new Ue("Integer",0));C.Integer=ze,C.CCInteger=ze;var He=t("CCFloat",new Ue("Float",0));C.Float=He,C.CCFloat=He;var We=t("CCBoolean",new Ue("Boolean",!1));C.Boolean=We,C.CCBoolean=We;var Xe=t("CCString",new Ue("String",""));function je(t,e){return function(i,n){var r='"'+Ot(i)+"."+n+'"',s=Ve(i,n),a=s.type;if(a===ze||a===He?a="Number":a!==Xe&&a!==We||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!De(o)){var h=typeof o,u=t.toLowerCase();if(h===u)if("object"===u){if(!o||o instanceof s.ctor)return;j(3605,r,Ot(s.ctor))}else"Number"!==t&&j(3606,e,r,t);else{if("function"===h)return;t===Xe.default&&null==o?j(3607,r):j(3611,e,r,h)}delete s.type}}}else j(3604,r)}}C.String=Xe,C.CCString=Xe;var Ye=Object.freeze({__proto__:null,DELIMETER:Fe,createAttrsSingle:Ne,createAttrs:Le,attr:Ve,getClassAttrs:ke,setClassAttr:Ge,PrimitiveType:Ue,CCInteger:ze,CCFloat:He,CCBoolean:We,CCString:Xe,getTypeChecker_ET:je,getObjTypeChecker_ET:function(t){return function(e,i){je("Object","type")(e,i);var n=ke(e)[i+Fe+"default"],r=C.Class.getDefault(n);if(!Array.isArray(r)&&Yt(t,C.ValueType)){var s=Ot(t),a=kt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ot(e),i,s);n?F(a):j(3612,a,s,Ot(e),i,s)}}}}),qe={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function Ke(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,qe){var o=qe[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function Je(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return q(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=C.String:e===Boolean?t.type=C.Boolean:e===Number&&(t.type=C.Float))}function Ze(t,e,i){var n=t?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function Qe(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return Ze(e,[],t);if("function"==typeof t){var i=t;return Ze(e,Yt(i,C.ValueType)?new i:null,i)}return Ze(e,t instanceof Ue?t.default:t)}return null}var $e,ti=[];function ei(){return ti[ti.length-1]}C._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ti.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ti.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:ei},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}($e||($e={}));var ii=Fe,ni="__ctors__",ri="Enum",si="BitMask";function ai(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),_i(t,n,e,i)}function oi(t,e,i,n){var r=n.get;n.set,r&&(_i(t,n,e,i),Ge(t,i,"serializable",!1))}function hi(t){return"function"==typeof t?t():t}function ui(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=C.Component,r=ei();if(r&&Yt(e,n)){if(Yt(r.cls,n))return q(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return It(n,ni,!0,!0),n.prototype,e&&(n.$super=e),te(t,n),n}(t,e,i);if(r)if(Yt(e,n)){var a=r.uuid;a&&Qt(a,s),r.cls=s}else Yt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=C.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(t,e,i,n){if(t.__props__=[],n&&n.__props__&&(t.__props__=n.__props__.slice()),i)for(var r in function(t,e){for(var i in t){var n=t[i],r=Qe(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&Ke(n,i,s,t),"type"in n&&Je(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?oi(t,e,r,s):ai(t,e,r,s)}var a=ke(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+ii+"serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Yt(i,C.Component)&&C.Component._registerEditorProps(n,r),n}function li(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}ui._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,ni)},ui.fastDefine=function(t,e,i){te(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=ke(e),s=0;s=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),u("min","number"),u("max","number"),u("step","number")}ui.isArray=function(t){return t=hi(t),Array.isArray(t)},ui.getDefault=hi,ui.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},ui.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,ui.getNewValueTypeCode=function(t){for(var e=Ot(t),i=t.constructor,n="new "+e+"(",r=0;ri){var n=e;e=i,i=n}return ti?i:t}function vi(t){return t<0?0:t>1?1:t}function Ai(t,e,i){return t+(e-t)*i}function Si(t){return t*fi}function bi(t){return t*di}var Ti=t("random",Math.random);function Ei(t,e){return Math.random()*(e-t)+t}function Ci(t,e){return Math.floor(Ei(t,e))}function wi(t){return(t=(9301*t+49297)%233280)/233280}function xi(t,e,i){return wi(t)*(i-e)+e}function Ri(t,e,i){return Math.floor(xi(t,e,i))}function Ii(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function Bi(t,e){return t-Math.floor(t/e)*e}function Di(t,e){return t=Bi(t,2*e),e-Math.abs(t-e)}function Pi(t,e,i){return(i-t)/(e-t)}function Mi(t){return Math.abs(t.x)>Math.abs(t.y)?Math.abs(t.x)>Math.abs(t.z)?t.x:t.z:Math.abs(t.y)>Math.abs(t.z)?t.y:t.z}function Oi(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Fi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Ni=t("Vec4",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,e&&"object"==typeof e?(s.x=e.x,s.y=e.y,s.z=e.z,s.w=e.w):(s.x=e||0,s.y=i||0,s.z=n||0,s.w=r||0),s}c(e,t),e.clone=function(t){return new e(t.x,t.y,t.z,t.w)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t},e.set=function(t,e,i,n,r){return t.x=e,t.y=i,t.z=n,t.w=r,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Math.sqrt(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return Math.abs(i)0&&(a=1/Math.sqrt(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.random=function(t,e){e=e||1;var i=2*Ti()*Math.PI,n=2*Ti()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z,u=i.w,l=u*n+o*s-h*r,c=u*r+h*n-a*s,_=u*s+a*r-o*n,f=-a*n-o*r-h*s;return t.x=l*u+f*-a+c*-h-_*-o,t.y=c*u+f*-o+_*-a-l*-h,t.z=_*u+f*-h+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=n||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.equals4f=function(t,e,i,n,r){return void 0===r&&(r=pi),Math.abs(this.x-t)<=r*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=r*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=r*Math.max(1,Math.abs(this.z),Math.abs(i))&&Math.abs(this.w-n)<=r*Math.max(1,Math.abs(this.w),Math.abs(n))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.strictEquals4f=function(t,e,i,n){return this.x===t&&this.y===e&&this.z===i&&this.w===n},i.lerp=function(t,e){var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this.z=r+e*(t.z-r),this.w=s+e*(t.w-s),this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},i.clampf=function(t,e){return this.x=yi(this.x,t.x,e.x),this.y=yi(this.y,t.y,e.y),this.z=yi(this.z,t.z,e.z),this.w=yi(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=this.w;return this.x=t.m00*e+t.m04*i+t.m08*n+t.m12*r,this.y=t.m01*e+t.m05*i+t.m09*n+t.m13*r,this.z=t.m02*e+t.m06*i+t.m10*n+t.m14*r,this.w=t.m03*e+t.m07*i+t.m11*n+t.m15*r,this},e}(ge));function Li(t,e,i,n){return new Ni(t,e,i,n)}Ni.ZERO=Object.freeze(new Ni(0,0,0,0)),Ni.ONE=Object.freeze(new Ni(1,1,1,1)),Ni.NEG_ONE=Object.freeze(new Ni(-1,-1,-1,-1)),ui.fastDefine("cc.Vec4",Ni,{x:0,y:0,z:0,w:0}),C.Vec4=Ni,C.v4=Li;var Vi=1/255,ki=t("Color",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._val=0,"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}c(e,t),e.clone=function(t){var i=new e;return t._val?i._val=t._val:i._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new Ni).x=Ui(t.r),e.y=Ui(t.g),e.z=Ui(t.b),e.w=Ui(t.a),e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=zi(t.x),i.g=zi(t.y),i.b=zi(t.z),i.a=zi(t.w),i},e.fromHEX=function(t,e){e=0===e.indexOf("#")?e.substring(1):e,t.r=parseInt(e.substr(0,2),16)||0,t.g=parseInt(e.substr(2,2),16)||0,t.b=parseInt(e.substr(4,2),16)||0;var i=parseInt(e.substr(6,2),16);return t.a=Number.isNaN(i)?255:i,t._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,t._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.strictEquals=function(t,e){return t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._val=this._val,t},i.equals=function(t){return t&&this._val===t._val},i.lerp=function(t,e){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(t.r-i)*e,n+=(t.g-n)*e,r+=(t.b-r)*e,s+=(t.a-s)*e,this._val=Math.floor((s<<24>>>0)+(r<<16)+(n<<8)+i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*Vi).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|e),this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this.r<16?e:"")+this.r.toString(16),(this.g<16?e:"")+this.g.toString(16),(this.b<16?e:"")+this.b.toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this.a<16?e:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,h=i*(1-e),u=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=h;break;case 1:n=u,r=i,s=h;break;case 2:n=h,r=i,s=l;break;case 3:n=h,r=u,s=i;break;case 4:n=l,r=h,s=i;break;case 5:n=i,r=h,s=u}}return n*=255,r*=255,s*=255,this._val=(this.a<<24>>>0)+(s<<16)+(r<<8)+(0|n),this},i.toHSV=function(){var t=this.r*Vi,e=this.g*Vi,i=this.b*Vi,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){return"object"==typeof t?null!=t._val?this._val=t._val:(e=t.g||0,i=t.b||0,n="number"==typeof t.a?t.a:255,t=t.r||0,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)):(t=t||0,e=e||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)),this},i.multiply=function(t){var e=(255&this._val)*t.r>>8,i=(65280&this._val)*t.g>>8,n=(16711680&this._val)*t.b>>8,r=((4278190080&this._val)>>>8)*t.a;return this._val=4278190080&r|16711680&n|65280&i|255&e,this},i._set_r_unsafe=function(t){return this._val=(4294967040&this._val|t)>>>0,this},i._set_g_unsafe=function(t){return this._val=(4294902015&this._val|t<<8)>>>0,this},i._set_b_unsafe=function(t){return this._val=(4278255615&this._val|t<<16)>>>0,this},i._set_a_unsafe=function(t){return this._val=(16777215&this._val|t<<24)>>>0,this},u(e,[{key:"r",get:function(){return 255&this._val},set:function(t){t=~~yi(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~yi(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~yi(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~yi(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*Vi},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*Vi},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*Vi},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*Vi},set:function(t){this.a=255*t}}]),e}(ge));function Gi(t,e,i,n){return new ki(t,e,i,n)}function Ui(t){if((0|t)!==t||t>>>8!=0)throw new RangeError("Value out of 8-bit range");return Wi[t]}function zi(t){if(t<=0)return 0;var e=Wi;if(t>=1)return e.length-1;for(var i=0,n=e.length>>>1;0!==n;n>>>=1)e[i|n]<=t&&(i|=n);return t-e[i]<=e[i+1]-t?i:i+1}ki.WHITE=Object.freeze(new ki(255,255,255,255)),ki.GRAY=Object.freeze(new ki(127,127,127,255)),ki.BLACK=Object.freeze(new ki(0,0,0,255)),ki.TRANSPARENT=Object.freeze(new ki(0,0,0,0)),ki.RED=Object.freeze(new ki(255,0,0,255)),ki.GREEN=Object.freeze(new ki(0,255,0,255)),ki.BLUE=Object.freeze(new ki(0,0,255,255)),ki.CYAN=Object.freeze(new ki(0,255,255,255)),ki.MAGENTA=Object.freeze(new ki(255,0,255,255)),ki.YELLOW=Object.freeze(new ki(255,255,0,255)),ui.fastDefine("cc.Color",ki,{r:0,g:0,b:0,a:255}),C.Color=ki,C.color=Gi;for(var Hi,Wi=[],Xi=0;Xi<256;Xi++)Wi.push((Hi=Xi/255)<=0?0:Hi>=1?1:Hi<.04045?Hi/12.92:Math.pow((Hi+.055)/1.055,2.4));var ji=t("Vec3",function(t){function e(e,i,n){var r;return r=t.call(this)||this,e&&"object"==typeof e?(r.x=e.x,r.y=e.y,r.z=e.z):(r.x=e||0,r.y=i||0,r.z=n||0),r}c(e,t),e.zero=function(t){return t.x=0,t.y=0,t.z=0,t},e.clone=function(t){return new e(t.x,t.y,t.z)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t},e.set=function(t,e,i,n){return t.x=e,t.y=i,t.z=n,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return Math.sqrt(i*i+n*n+r*r)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z;return i*i+n*n+r*r},e.len=function(t){var e=t.x,i=t.y,n=t.z;return Math.sqrt(e*e+i*i+n*n)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z;return e*e+i*i+n*n},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t},e.invert=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t},e.invertSafe=function(t,e){var i=e.x,n=e.y,r=e.z;return Math.abs(i)0&&(s=1/Math.sqrt(s),t.x=i*s,t.y=n*s,t.z=r*s),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,h=i.z;return t.x=r*h-s*o,t.y=s*a-n*h,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*Ti()*Math.PI,n=2*Ti()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?Math.abs(1/a):1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?Math.abs(1/a):1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,h=i.w*s+i.y*o-i.z*a,u=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=h*i.w+c*-i.x+u*-i.z-l*-i.y+n.x,t.y=u*i.w+c*-i.y+l*-i.x-h*-i.z+n.y,t.z=l*i.w+c*-i.z+h*-i.y-u*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,h=i.w*s-i.y*o+i.z*a,u=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(h*i.w+c*i.x+u*i.z-l*i.y)/r.x,t.y=(u*i.w+c*i.y+l*i.x-h*i.z)/r.y,t.z=(l*i.w+c*i.z+h*i.y-u*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=r,l=s*o-a*h,c=s*h+a*o;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=a*h+r*o,l=s,c=a*o-r*h;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),h=Math.sin(n),u=r*o-s*h,l=r*h+s*o,c=a;return t.x=u+i.x,t.y=l+i.y,t.z=c+i.z,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z},e.equals=function(t,e,i){void 0===i&&(i=pi);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,h=e.z;return Math.abs(n-a)<=i*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=i*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-h)<=i*Math.max(1,Math.abs(s),Math.abs(h))},e.angle=function(t,i){e.normalize(Yi,t),e.normalize(qi,i);var n=e.dot(Yi,qi);return n>1?0:n<-1?Math.PI:Math.acos(n)},e.projectOnPlane=function(t,i,n){return e.subtract(t,i,e.project(t,i,n))},e.project=function(t,i,n){var r=e.lengthSqr(n);return r<1e-6?e.set(t,0,0,0):e.multiplyScalar(t,n,e.dot(i,n)/r)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z)},i.set=function(t,e,i){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z):(this.x=t||0,this.y=e||0,this.z=i||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))},i.equals3f=function(t,e,i,n){return void 0===n&&(n=pi),Math.abs(this.x-t)<=n*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=n*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=n*Math.max(1,Math.abs(this.z),Math.abs(i))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},i.strictEquals3f=function(t,e,i){return this.x===t&&this.y===e&&this.z===i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},i.add3f=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.subtract3f=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec3.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec3.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.multiply3f=function(t,e,i){return this.x*=t,this.y*=e,this.z*=i,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.divide3f=function(t,e,i){return this.x/=t,this.y/=e,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(t,e){return this.x=yi(this.x,t.x,e.x),this.y=yi(this.y,t.y,e.y),this.z=yi(this.z,t.z,e.z),this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},e}(ge));ji.UNIT_X=Object.freeze(new ji(1,0,0)),ji.UNIT_Y=Object.freeze(new ji(0,1,0)),ji.UNIT_Z=Object.freeze(new ji(0,0,1)),ji.RIGHT=Object.freeze(new ji(1,0,0)),ji.UP=Object.freeze(new ji(0,1,0)),ji.FORWARD=Object.freeze(new ji(0,0,-1)),ji.ZERO=Object.freeze(new ji(0,0,0)),ji.ONE=Object.freeze(new ji(1,1,1)),ji.NEG_ONE=Object.freeze(new ji(-1,-1,-1));var Yi=new ji,qi=new ji;function Ki(t,e,i){return new ji(t,e,i)}ui.fastDefine("cc.Vec3",ji,{x:0,y:0,z:0}),C.Vec3=ji,C.v3=Ki;var Ji=t("Mat3",function(t){function e(e,i,n,r,s,a,o,h,u){var l;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=1),l=t.call(this)||this,"object"==typeof e?(l.m00=e.m00,l.m01=e.m01,l.m02=e.m02,l.m03=e.m03,l.m04=e.m04,l.m05=e.m05,l.m06=e.m06,l.m07=e.m07,l.m08=e.m08):(l.m00=e,l.m01=i,l.m02=n,l.m03=r,l.m04=s,l.m05=a,l.m06=o,l.m07=h,l.m08=u),l}c(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,a,o,h,u){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=l*a-o*u,_=-l*s+o*h,f=u*s-a*h,d=i*c+n*_+r*f;return 0===d?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t):(d=1/d,t.m00=c*d,t.m01=(-l*n+r*u)*d,t.m02=(o*n-r*a)*d,t.m03=_*d,t.m04=(l*i-r*h)*d,t.m05=(-o*i+r*s)*d,t.m06=f*d,t.m07=(-u*i+n*h)*d,t.m08=(a*i-n*s)*d,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08;return e*(u*s-a*h)+i*(-u*r+a*o)+n*(h*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,y=i.m06,v=i.m07,A=i.m08;return t.m00=_*n+f*a+d*u,t.m01=_*r+f*o+d*l,t.m02=_*s+f*h+d*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=y*n+v*a+A*u,t.m07=y*r+v*o+A*l,t.m08=y*s+v*h+A*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,y=i.m08,v=i.m09,A=i.m10;return t.m00=_*n+f*a+d*u,t.m01=_*r+f*o+d*l,t.m02=_*s+f*h+d*c,t.m03=p*n+m*a+g*u,t.m04=p*r+m*o+g*l,t.m05=p*s+m*h+g*c,t.m06=y*n+v*a+A*u,t.m07=y*r+v*o+A*l,t.m08=y*s+v*h+A*c,t},e.transform=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=i.x,f=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=h,t.m06=_*n+f*a+u,t.m07=_*r+f*o+l,t.m08=_*s+f*h+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=Math.sin(i),f=Math.cos(i);return t.m00=f*n+_*a,t.m01=f*r+_*o,t.m02=f*s+_*h,t.m03=f*a-_*n,t.m04=f*o-_*r,t.m05=f*h-_*s,t.m06=u,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return ji.lengthSqr(i).999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(ji.cross(nn,i,n),t.x=nn.x,t.y=nn.y,t.z=nn.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+h*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=h*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r-o*n,t.y=a*r+h*n,t.z=o*r+s*n,t.w=h*r-a*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,h=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+h*n,t.w=h*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(tn,i),ji.transformQuat(nn,n,tn),e.fromAxisAngle(tn,nn,r),e.multiply(t,i,tn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(tn,n,r),e.multiply(t,i,tn),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,h=i.z,u=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,h=-h,u=-u),1-l>1e-6){var c=Math.acos(l),_=Math.sin(c);r=Math.sin((1-n)*c)/_,s=Math.sin(n*c)/_}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*h,t.w=r*e.w+s*u,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(tn,i,s,a),e.slerp(en,n,r,a),e.slerp(t,tn,en,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0&&(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i),t},e.fromAxes=function(t,i,n,r){return Ji.set(rn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,rn))},e.fromViewUp=function(t,i,n){return Ji.fromViewUp(rn,i,n),e.normalize(t,e.fromMat3(t,rn))},e.fromAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t.x=n*e.x,t.y=n*e.y,t.z=n*e.z,t.w=Math.cos(i),t},e.fromMat3=function(t,e){var i=e.m00,n=e.m03,r=e.m06,s=e.m01,a=e.m04,o=e.m07,h=e.m02,u=e.m05,l=e.m08,c=i+a+l;if(c>0){var _=.5/Math.sqrt(c+1);t.w=.25/_,t.x=(u-o)*_,t.y=(r-h)*_,t.z=(s-n)*_}else if(i>a&&i>l){var f=2*Math.sqrt(1+i-a-l);t.w=(u-o)/f,t.x=.25*f,t.y=(n+s)/f,t.z=(r+h)/f}else if(a>l){var d=2*Math.sqrt(1+a-i-l);t.w=(r-h)/d,t.x=(n+s)/d,t.y=.25*d,t.z=(o+u)/d}else{var p=2*Math.sqrt(1+l-i-a);t.w=(s-n)/p,t.x=(r+h)/p,t.y=(o+u)/p,t.z=.25*p}return t},e.fromEuler=function(t,e,i,n){e*=sn,i*=sn,n*=sn;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),h=Math.sin(n),u=Math.cos(n);return t.x=r*o*u+s*a*h,t.y=s*a*u+r*o*h,t.z=s*o*h-r*a*u,t.w=s*o*u-r*a*h,t},e.fromAngleZ=function(t,e){return e*=sn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x+i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x-n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,h=0,u=0,l=n*r+s*a;if(l>.499999)o=0,h=bi(2*Math.atan2(n,a)),u=90;else if(l<-.499999)o=0,h=-bi(2*Math.atan2(n,a)),u=-90;else{var c=n*n,_=r*r,f=s*s;o=bi(Math.atan2(2*n*a-2*r*s,1-2*c-2*f)),h=bi(Math.atan2(2*r*a-2*n*s,1-2*_-2*f)),u=bi(Math.asin(2*l)),i&&(o=-180*Math.sign(o+1e-6)+o,h=-180*Math.sign(h+1e-6)+h,u=180*Math.sign(u+1e-6)-u)}return t.x=o,t.y=h,t.z=u,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))&&Math.abs(t.z-e.z)<=i*Math.max(1,Math.abs(t.z),Math.abs(e.z))&&Math.abs(t.w-e.w)<=i*Math.max(1,Math.abs(t.w),Math.abs(e.w))};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z,this.w)},i.set=function(t,e,i,n){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w):(this.x=t||0,this.y=e||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))&&Math.abs(this.z-t.z)<=e*Math.max(1,Math.abs(this.z),Math.abs(t.z))&&Math.abs(this.w-t.w)<=e*Math.max(1,Math.abs(this.w),Math.abs(t.w))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y&&this.z===t.z&&this.w===t.w},i.getEulerAngles=function(t){return e.toEuler(t,this)},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this.w+=e*(t.w-this.w),this},i.slerp=function(t,i){return e.slerp(this,this,t,i)},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e}(ge));$i.IDENTITY=Object.freeze(new $i);var tn=new $i,en=new $i,nn=new ji,rn=new Ji,sn=.5*Math.PI/180;function an(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),new $i(t,e,i,n)}ui.fastDefine("cc.Quat",$i,{x:0,y:0,z:0,w:1}),C.Quat=$i,C.quat=an;var on=Object.freeze([Object.freeze([1,0,0,1]),Object.freeze([0,1,-1,0]),Object.freeze([-1,0,0,-1]),Object.freeze([0,-1,1,0])]),hn=t("Mat4",function(t){function e(e,i,n,r,s,a,o,h,u,l,c,_,f,d,p,m){var g;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),(g=t.call(this)||this).m00=void 0,g.m01=void 0,g.m02=void 0,g.m03=void 0,g.m04=void 0,g.m05=void 0,g.m06=void 0,g.m07=void 0,g.m08=void 0,g.m09=void 0,g.m10=void 0,g.m11=void 0,g.m12=void 0,g.m13=void 0,g.m14=void 0,g.m15=void 0,"object"==typeof e?(g.m00=e.m00,g.m01=e.m01,g.m02=e.m02,g.m03=e.m03,g.m04=e.m04,g.m05=e.m05,g.m06=e.m06,g.m07=e.m07,g.m08=e.m08,g.m09=e.m09,g.m10=e.m10,g.m11=e.m11,g.m12=e.m12,g.m13=e.m13,g.m14=e.m14,g.m15=e.m15):(g.m00=e,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=a,g.m06=o,g.m07=h,g.m08=u,g.m09=l,g.m10=c,g.m11=_,g.m12=f,g.m13=d,g.m14=p,g.m15=m),g}c(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=h,t.m08=u,t.m09=l,t.m10=c,t.m11=_,t.m12=f,t.m13=d,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,A=i*u-s*a,S=n*h-r*o,b=n*u-s*o,T=r*u-s*h,E=l*p-c*d,C=l*m-_*d,w=l*g-f*d,x=c*m-_*p,R=c*g-f*p,I=_*g-f*m,B=y*I-v*R+A*x+S*w-b*C+T*E;return 0===B?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=0,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=0,t):(B=1/B,t.m00=(o*I-h*R+u*x)*B,t.m01=(r*R-n*I-s*x)*B,t.m02=(p*T-m*b+g*S)*B,t.m03=(_*b-c*T-f*S)*B,t.m04=(h*w-a*I-u*C)*B,t.m05=(i*I-r*w+s*C)*B,t.m06=(m*A-d*T-g*v)*B,t.m07=(l*T-_*A+f*v)*B,t.m08=(a*R-o*w+u*E)*B,t.m09=(n*w-i*R-s*E)*B,t.m10=(d*b-p*A+g*y)*B,t.m11=(c*A-l*b-f*y)*B,t.m12=(o*C-a*x-h*E)*B,t.m13=(i*x-n*C+r*E)*B,t.m14=(p*v-d*S-m*y)*B,t.m15=(l*S-c*v+_*y)*B,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,h=t.m07,u=t.m08,l=t.m09,c=t.m10,_=t.m11,f=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-_*p)-(e*o-n*s)*(l*m-_*d)+(e*h-r*s)*(l*p-c*d)+(i*o-n*a)*(u*m-_*f)-(i*h-r*a)*(u*p-c*f)+(n*h-r*o)*(u*d-l*f)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,h=e.m05,u=e.m06,l=e.m07,c=e.m08,_=e.m09,f=e.m10,d=e.m11,p=e.m12,m=e.m13,g=e.m14,y=e.m15,v=i.m00,A=i.m01,S=i.m02,b=i.m03;return t.m00=v*n+A*o+S*c+b*p,t.m01=v*r+A*h+S*_+b*m,t.m02=v*s+A*u+S*f+b*g,t.m03=v*a+A*l+S*d+b*y,v=i.m04,A=i.m05,S=i.m06,b=i.m07,t.m04=v*n+A*o+S*c+b*p,t.m05=v*r+A*h+S*_+b*m,t.m06=v*s+A*u+S*f+b*g,t.m07=v*a+A*l+S*d+b*y,v=i.m08,A=i.m09,S=i.m10,b=i.m11,t.m08=v*n+A*o+S*c+b*p,t.m09=v*r+A*h+S*_+b*m,t.m10=v*s+A*u+S*f+b*g,t.m11=v*a+A*l+S*d+b*y,v=i.m12,A=i.m13,S=i.m14,b=i.m15,t.m12=v*n+A*o+S*c+b*p,t.m13=v*r+A*h+S*_+b*m,t.m14=v*s+A*u+S*f+b*g,t.m15=v*a+A*l+S*d+b*y,t},e.transform=function(t,e,i){var n=i.x,r=i.y,s=i.z;if(e===t)t.m12=e.m00*n+e.m04*r+e.m08*s+e.m12,t.m13=e.m01*n+e.m05*r+e.m09*s+e.m13,t.m14=e.m02*n+e.m06*r+e.m10*s+e.m14,t.m15=e.m03*n+e.m07*r+e.m11*s+e.m15;else{var a=e.m00,o=e.m01,h=e.m02,u=e.m03,l=e.m04,c=e.m05,_=e.m06,f=e.m07,d=e.m08,p=e.m09,m=e.m10,g=e.m11;e.m12,e.m13,e.m14,e.m15,t.m00=a,t.m01=o,t.m02=h,t.m03=u,t.m04=l,t.m05=c,t.m06=_,t.m07=f,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+d*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=h*n+_*r+m*s+e.m14,t.m15=u*n+f*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12+=i.x,t.m13+=i.y,t.m14+=i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=Math.sqrt(r*r+s*s+a*a);if(Math.abs(o)0?(n=2*Math.sqrt(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Math.sqrt(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Math.sqrt(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Math.sqrt(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,e,i,n){n.x=ji.set(un,t.m00,t.m01,t.m02).length(),ln.m00=t.m00/n.x,ln.m01=t.m01/n.x,ln.m02=t.m02/n.x,n.y=ji.set(un,t.m04,t.m05,t.m06).length(),ln.m03=t.m04/n.y,ln.m04=t.m05/n.y,ln.m05=t.m06/n.y,n.z=ji.set(un,t.m08,t.m09,t.m10).length(),ln.m06=t.m08/n.z,ln.m07=t.m09/n.z,ln.m08=t.m10/n.z,Ji.determinant(ln)<0&&(n.x*=-1,ln.m00*=-1,ln.m01*=-1,ln.m02*=-1),$i.fromMat3(e,ln),ji.set(i,t.m12,t.m13,t.m14)},e.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,h=r+r,u=s+s,l=a+a,c=r*h,_=r*u,f=r*l,d=s*u,p=s*l,m=a*l,g=o*h,y=o*u,v=o*l,A=n.x,S=n.y,b=n.z;return t.m00=(1-(d+m))*A,t.m01=(_+v)*A,t.m02=(f-y)*A,t.m03=0,t.m04=(_-v)*S,t.m05=(1-(c+m))*S,t.m06=(p+g)*S,t.m07=0,t.m08=(f+y)*b,t.m09=(p-g)*b,t.m10=(1-(c+d))*b,t.m11=0,t.m12=i.x,t.m13=i.y,t.m14=i.z,t.m15=1,t},e.fromRTSOrigin=function(t,e,i,n,r){var s=e.x,a=e.y,o=e.z,h=e.w,u=s+s,l=a+a,c=o+o,_=s*u,f=s*l,d=s*c,p=a*l,m=a*c,g=o*c,y=h*u,v=h*l,A=h*c,S=n.x,b=n.y,T=n.z,E=r.x,C=r.y,w=r.z;return t.m00=(1-(p+g))*S,t.m01=(f+A)*S,t.m02=(d-v)*S,t.m03=0,t.m04=(f-A)*b,t.m05=(1-(_+g))*b,t.m06=(m+y)*b,t.m07=0,t.m08=(d+v)*T,t.m09=(m-y)*T,t.m10=(1-(_+p))*T,t.m11=0,t.m12=i.x+E-(t.m00*E+t.m04*C+t.m08*w),t.m13=i.y+C-(t.m01*E+t.m05*C+t.m09*w),t.m14=i.z+w-(t.m02*E+t.m06*C+t.m10*w),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,h=r+r,u=i*a,l=n*a,c=n*o,_=r*a,f=r*o,d=r*h,p=s*a,m=s*o,g=s*h;return t.m00=1-c-d,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-u-d,t.m06=f+p,t.m07=0,t.m08=_+m,t.m09=f-p,t.m10=1-u-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),h=1/(r-n),u=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*h,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*h,t.m10=(a+s)*u,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*u,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,h){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===h&&(h=0);var u=1/Math.tan(e/2),l=1/(n-r),c=s?u/i:u,_=(s?u:u*i)*o,f=on[h];return t.m00=c*f[0],t.m01=c*f[1],t.m02=0,t.m03=0,t.m04=_*f[2],t.m05=_*f[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,h,u){void 0===o&&(o=-1),void 0===h&&(h=1),void 0===u&&(u=0);var l=1/(e-i),c=1/(n-r)*h,_=1/(s-a),f=-2*l,d=-2*c,p=(e+i)*l,m=(r+n)*c,g=on[u];return t.m00=f*g[0],t.m01=f*g[1],t.m02=0,t.m03=0,t.m04=d*g[2],t.m05=d*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,h=n.y,u=n.z,l=r-i.x,c=s-i.y,_=a-i.z,f=1/Math.sqrt(l*l+c*c+_*_),d=h*(_*=f)-u*(c*=f),p=u*(l*=f)-o*_,m=o*c-h*l,g=c*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),y=_*(d*=f)-l*m,v=l*p-c*d;return t.m00=d,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=y,t.m06=c,t.m07=0,t.m08=m,t.m09=v,t.m10=_,t.m11=0,t.m12=-(d*r+p*s+m*a),t.m13=-(g*r+y*s+v*a),t.m14=-(l*r+c*s+_*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,h=e.m06,u=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,y=i*o-n*a,v=i*h-r*a,A=i*u-s*a,S=n*h-r*o,b=n*u-s*o,T=r*u-s*h,E=l*p-c*d,C=l*m-_*d,w=l*g-f*d,x=c*m-_*p,R=c*g-f*p,I=_*g-f*m,B=y*I-v*R+A*x+S*w-b*C+T*E;return B?(B=1/B,t.m00=(o*I-h*R+u*x)*B,t.m01=(h*w-a*I-u*C)*B,t.m02=(a*R-o*w+u*E)*B,t.m03=0,t.m04=(r*R-n*I-s*x)*B,t.m05=(i*I-r*w+s*C)*B,t.m06=(n*w-i*R-s*E)*B,t.m07=0,t.m08=(p*T-m*b+g*S)*B,t.m09=(m*A-d*T-g*v)*B,t.m10=(d*b-p*A+g*y)*B,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t):null},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.m00,t[i+1]=e.m01,t[i+2]=e.m02,t[i+3]=e.m03,t[i+4]=e.m04,t[i+5]=e.m05,t[i+6]=e.m06,t[i+7]=e.m07,t[i+8]=e.m08,t[i+9]=e.m09,t[i+10]=e.m10,t[i+11]=e.m11,t[i+12]=e.m12,t[i+13]=e.m13,t[i+14]=e.m14,t[i+15]=e.m15,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.m00=e[i+0],t.m01=e[i+1],t.m02=e[i+2],t.m03=e[i+3],t.m04=e[i+4],t.m05=e[i+5],t.m06=e[i+6],t.m07=e[i+7],t.m08=e[i+8],t.m09=e[i+9],t.m10=e[i+10],t.m11=e[i+11],t.m12=e[i+12],t.m13=e[i+13],t.m14=e[i+14],t.m15=e[i+15],t},e.add=function(t,e,i){return t.m00=e.m00+i.m00,t.m01=e.m01+i.m01,t.m02=e.m02+i.m02,t.m03=e.m03+i.m03,t.m04=e.m04+i.m04,t.m05=e.m05+i.m05,t.m06=e.m06+i.m06,t.m07=e.m07+i.m07,t.m08=e.m08+i.m08,t.m09=e.m09+i.m09,t.m10=e.m10+i.m10,t.m11=e.m11+i.m11,t.m12=e.m12+i.m12,t.m13=e.m13+i.m13,t.m14=e.m14+i.m14,t.m15=e.m15+i.m15,t},e.subtract=function(t,e,i){return t.m00=e.m00-i.m00,t.m01=e.m01-i.m01,t.m02=e.m02-i.m02,t.m03=e.m03-i.m03,t.m04=e.m04-i.m04,t.m05=e.m05-i.m05,t.m06=e.m06-i.m06,t.m07=e.m07-i.m07,t.m08=e.m08-i.m08,t.m09=e.m09-i.m09,t.m10=e.m10-i.m10,t.m11=e.m11-i.m11,t.m12=e.m12-i.m12,t.m13=e.m13-i.m13,t.m14=e.m14-i.m14,t.m15=e.m15-i.m15,t},e.multiplyScalar=function(t,e,i){return t.m00=e.m00*i,t.m01=e.m01*i,t.m02=e.m02*i,t.m03=e.m03*i,t.m04=e.m04*i,t.m05=e.m05*i,t.m06=e.m06*i,t.m07=e.m07*i,t.m08=e.m08*i,t.m09=e.m09*i,t.m10=e.m10*i,t.m11=e.m11*i,t.m12=e.m12*i,t.m13=e.m13*i,t.m14=e.m14*i,t.m15=e.m15*i,t},e.multiplyScalarAndAdd=function(t,e,i,n){return t.m00=e.m00+i.m00*n,t.m01=e.m01+i.m01*n,t.m02=e.m02+i.m02*n,t.m03=e.m03+i.m03*n,t.m04=e.m04+i.m04*n,t.m05=e.m05+i.m05*n,t.m06=e.m06+i.m06*n,t.m07=e.m07+i.m07*n,t.m08=e.m08+i.m08*n,t.m09=e.m09+i.m09*n,t.m10=e.m10+i.m10*n,t.m11=e.m11+i.m11*n,t.m12=e.m12+i.m12*n,t.m13=e.m13+i.m13*n,t.m14=e.m14+i.m14*n,t.m15=e.m15+i.m15*n,t},e.strictEquals=function(t,e){return t.m00===e.m00&&t.m01===e.m01&&t.m02===e.m02&&t.m03===e.m03&&t.m04===e.m04&&t.m05===e.m05&&t.m06===e.m06&&t.m07===e.m07&&t.m08===e.m08&&t.m09===e.m09&&t.m10===e.m10&&t.m11===e.m11&&t.m12===e.m12&&t.m13===e.m13&&t.m14===e.m14&&t.m15===e.m15},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(e.m15))};var i=e.prototype;return i.clone=function(){return new e(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=0),void 0===u&&(u=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=h,this.m09=u,this.m10=l,this.m11=c,this.m12=_,this.m13=f,this.m14=d,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15,m=t*s-e*r,g=t*a-i*r,y=t*o-n*r,v=e*a-i*s,A=e*o-n*s,S=i*o-n*a,b=h*f-u*_,T=h*d-l*_,E=h*p-c*_,C=u*d-l*f,w=u*p-c*f,x=l*p-c*d,R=m*x-g*w+y*C+v*E-A*T+S*b;return 0===R?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(R=1/R,this.m00=(s*x-a*w+o*C)*R,this.m01=(i*w-e*x-n*C)*R,this.m02=(f*S-d*A+p*v)*R,this.m03=(l*A-u*S-c*v)*R,this.m04=(a*E-r*x-o*T)*R,this.m05=(t*x-i*E+n*T)*R,this.m06=(d*y-_*S-p*g)*R,this.m07=(h*S-l*y+c*g)*R,this.m08=(r*w-s*E+o*b)*R,this.m09=(e*E-t*w-n*b)*R,this.m10=(_*A-f*y+p*m)*R,this.m11=(u*y-h*A-c*m)*R,this.m12=(s*T-r*C-a*b)*R,this.m13=(t*C-e*T+i*b)*R,this.m14=(f*g-_*v-d*m)*R,this.m15=(h*v-u*g+l*m)*R,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,h=this.m08,u=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*d)-(t*a-i*r)*(u*p-c*f)+(t*o-n*r)*(u*d-l*f)+(e*a-i*s)*(h*p-c*_)-(e*o-n*s)*(h*d-l*_)+(i*o-n*a)*(h*f-u*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,h=this.m07,u=this.m08,l=this.m09,c=this.m10,_=this.m11,f=this.m12,d=this.m13,p=this.m14,m=this.m15,g=t.m00,y=t.m01,v=t.m02,A=t.m03;return this.m00=g*e+y*s+v*u+A*f,this.m01=g*i+y*a+v*l+A*d,this.m02=g*n+y*o+v*c+A*p,this.m03=g*r+y*h+v*_+A*m,g=t.m04,y=t.m05,v=t.m06,A=t.m07,this.m04=g*e+y*s+v*u+A*f,this.m05=g*i+y*a+v*l+A*d,this.m06=g*n+y*o+v*c+A*p,this.m07=g*r+y*h+v*_+A*m,g=t.m08,y=t.m09,v=t.m10,A=t.m11,this.m08=g*e+y*s+v*u+A*f,this.m09=g*i+y*a+v*l+A*d,this.m10=g*n+y*o+v*c+A*p,this.m11=g*r+y*h+v*_+A*m,g=t.m12,y=t.m13,v=t.m14,A=t.m15,this.m12=g*e+y*s+v*u+A*f,this.m13=g*i+y*a+v*l+A*d,this.m14=g*n+y*o+v*c+A*p,this.m15=g*r+y*h+v*_+A*m,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.scale=function(t){var e=t.x,i=t.y,n=t.z;return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=i,this.m05*=i,this.m06*=i,this.m07*=i,this.m08*=n,this.m09*=n,this.m10*=n,this.m11*=n,this},i.rotate=function(t,e){var i=e.x,n=e.y,r=e.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)0?(i=2*Math.sqrt(e+1),t.w=.25*i,t.x=(this.m06-this.m09)/i,t.y=(this.m08-this.m02)/i,t.z=(this.m01-this.m04)/i):this.m00>this.m05&&this.m00>this.m10?(i=2*Math.sqrt(1+this.m00-this.m05-this.m10),t.w=(this.m06-this.m09)/i,t.x=.25*i,t.y=(this.m01+this.m04)/i,t.z=(this.m08+this.m02)/i):this.m05>this.m10?(i=2*Math.sqrt(1+this.m05-this.m00-this.m10),t.w=(this.m08-this.m02)/i,t.x=(this.m01+this.m04)/i,t.y=.25*i,t.z=(this.m06+this.m09)/i):(i=2*Math.sqrt(1+this.m10-this.m00-this.m05),t.w=(this.m01-this.m04)/i,t.x=(this.m08+this.m02)/i,t.y=(this.m06+this.m09)/i,t.z=.25*i),t},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,h=r+r,u=s+s,l=n*o,c=n*h,_=n*u,f=r*h,d=r*u,p=s*u,m=a*o,g=a*h,y=a*u,v=i.x,A=i.y,S=i.z;return this.m00=(1-(f+p))*v,this.m01=(c+y)*v,this.m02=(_-g)*v,this.m03=0,this.m04=(c-y)*A,this.m05=(1-(l+p))*A,this.m06=(d+m)*A,this.m07=0,this.m08=(_+g)*S,this.m09=(d-m)*S,this.m10=(1-(l+f))*S,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,h=e*s,u=i*s,l=i*a,c=n*s,_=n*a,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-l-f,this.m01=u+m,this.m02=c-p,this.m03=0,this.m04=u-m,this.m05=1-h-f,this.m06=_+d,this.m07=0,this.m08=c+p,this.m09=_-d,this.m10=1-h-l,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(ge));hn.IDENTITY=Object.freeze(new hn);var un=new ji,ln=new Ji;function cn(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p){return new hn(t,e,i,n,r,s,a,o,h,u,l,c,_,f,d,p)}ui.fastDefine("cc.Mat4",hn,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1}),C.Mat4=hn,C.mat4=cn;var _n=t("Vec2",function(t){function e(e,i){var n;return n=t.call(this)||this,e&&"object"==typeof e?(n.x=e.x,n.y=e.y):(n.x=e||0,n.y=i||0),n}c(e,t),e.clone=function(t){return new e(t.x,t.y)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t},e.set=function(t,e,i){return t.x=e,t.y=i,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.len=function(t){var e=t.x,i=t.y;return Math.sqrt(e*e+i*i)},e.lengthSqr=function(t){var e=t.x,i=t.y;return e*e+i*i},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y;return Math.abs(i)0&&(r=1/Math.sqrt(r),t.x=i*r,t.y=n*r),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof ji?(t.x=t.y=0,t.z=e.x*i.y-e.y*i.x,t):t.x*e.y-t.y*e.x},e.lerp=function(t,e,i,n){var r=e.x,s=e.y;return t.x=r+n*(i.x-r),t.y=s+n*(i.y-s),t},e.random=function(t,e){e=e||1;var i=2*Ti()*Math.PI;return t.x=Math.cos(i)*e,t.y=Math.sin(i)*e,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m03*r+i.m06,t.y=i.m01*n+i.m04*r+i.m07,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y;return t.x=i.m00*n+i.m04*r+i.m12,t.y=i.m01*n+i.m05*r+i.m13,t},e.str=function(t){return"Vec2("+t.x+", "+t.y+")"},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y},e.equals=function(t,e,i){return void 0===i&&(i=pi),Math.abs(t.x-e.x)<=i*Math.max(1,Math.abs(t.x),Math.abs(e.x))&&Math.abs(t.y-e.y)<=i*Math.max(1,Math.abs(t.y),Math.abs(e.y))},e.angle=function(t,i){e.normalize(fn,t),e.normalize(dn,i);var n=e.dot(fn,dn);return n>1?0:n<-1?Math.PI:Math.acos(n)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y):(this.x=t||0,this.y=e||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.x-t.x)<=e*Math.max(1,Math.abs(this.x),Math.abs(t.x))&&Math.abs(this.y-t.y)<=e*Math.max(1,Math.abs(this.y),Math.abs(t.y))},i.equals2f=function(t,e,i){return void 0===i&&(i=pi),Math.abs(this.x-t)<=i*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=i*Math.max(1,Math.abs(this.y),Math.abs(e))},i.strictEquals=function(t){return t&&this.x===t.x&&this.y===t.y},i.strictEquals2f=function(t,e){return this.x===t&&this.y===e},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(t,e){var i=this.x,n=this.y;return this.x=i+e*(t.x-i),this.y=n+e*(t.y-n),this},i.clampf=function(t,e){return this.x=yi(this.x,t.x,e.x),this.y=yi(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(t)/Math.sqrt(e*i);return n=yi(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.angle(t);return this.cross(t)<0?-e:e},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},e}(ge));_n.ZERO=Object.freeze(new _n(0,0)),_n.ONE=Object.freeze(new _n(1,1)),_n.NEG_ONE=Object.freeze(new _n(-1,-1)),_n.UNIT_X=Object.freeze(new _n(1,0)),_n.UNIT_Y=Object.freeze(new _n(0,1));var fn=new _n,dn=new _n;function pn(t,e){return new _n(t,e)}ui.fastDefine("cc.Vec2",_n,{x:0,y:0}),C.Vec2=_n,C.v2=pn,et(_n,"Vec2",[{name:"sub",newName:"subtract",target:_n,targetName:"Vec2"},{name:"mul",newName:"multiply",target:_n,targetName:"Vec2"},{name:"div",newName:"divide",target:_n,targetName:"Vec2"},{name:"dist",newName:"distance",target:_n,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:_n,targetName:"Vec2"},{name:"mag",newName:"len",target:_n,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Vec2"}]),et(_n.prototype,"Vec2",[{name:"mag",newName:"length",target:_n.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:_n.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Vec2"}]),et(ji,"Vec3",[{name:"sub",newName:"subtract",target:ji,targetName:"Vec3"},{name:"mul",newName:"multiply",target:ji,targetName:"Vec3"},{name:"div",newName:"divide",target:ji,targetName:"Vec3"},{name:"dist",newName:"distance",target:ji,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:ji,targetName:"Vec3"},{name:"mag",newName:"len",target:ji,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:ji,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ji,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ji,targetName:"Vec3"}]),et(ji.prototype,"Vec3",[{name:"mag",newName:"length",target:ji.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:ji.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ji.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ji.prototype,targetName:"Vec3"}]),et(Ni,"Vec4",[{name:"sub",newName:"subtract",target:Ni,targetName:"Vec4"},{name:"mul",newName:"multiply",target:Ni,targetName:"Vec4"},{name:"div",newName:"divide",target:Ni,targetName:"Vec4"},{name:"dist",newName:"distance",target:Ni,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:Ni,targetName:"Vec4"},{name:"mag",newName:"len",target:Ni,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:Ni,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Ni,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Ni,targetName:"Vec4"}]),et(Ni.prototype,"Vec4",[{name:"mag",newName:"length",target:Ni.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:Ni.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Ni.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Ni.prototype,targetName:"Vec4"}]),et($i,"Quat",[{name:"mag",newName:"len",target:$i,targetName:"Quat"},{name:"mul",newName:"multiply",target:$i,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:$i,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:$i,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:$i,targetName:"Quat"}]),et($i.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:$i.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:$i.prototype,targetName:"Quat"}]),et(ki,"Color",[{name:"sub",newName:"subtract",target:ki,targetName:"Color"},{name:"mul",newName:"multiply",target:ki,targetName:"Color"},{name:"div",newName:"divide",target:ki,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:ki,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,a=t.m01*e+t.m05*i+t.m13,o=t.m00*n+t.m04*i+t.m12,h=t.m01*n+t.m05*i+t.m13,u=t.m00*e+t.m04*r+t.m12,l=t.m01*e+t.m05*r+t.m13,c=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,f=Math.min(s,o,u,c),d=Math.max(s,o,u,c),p=Math.min(a,h,l,_),m=Math.max(a,h,l,_);return this.x=f,this.y=p,this.width=d-f,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,a=this.y,o=s+this.width,h=a+this.height;e.x=t.m00*s+t.m04*a+t.m12,e.y=t.m01*s+t.m05*a+t.m13,r.x=t.m00*o+t.m04*a+t.m12,r.y=t.m01*o+t.m05*a+t.m13,i.x=t.m00*s+t.m04*h+t.m12,i.y=t.m01*s+t.m05*h+t.m13,n.x=t.m00*o+t.m04*h+t.m12,n.y=t.m01*o+t.m05*h+t.m13},u(e,[{key:"xMin",get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t}},{key:"yMin",get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t}},{key:"xMax",get:function(){return this.x+this.width},set:function(t){this.width=t-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(t){this.height=t-this.y}},{key:"center",get:function(){return new _n(this.x+.5*this.width,this.y+.5*this.height)},set:function(t){this.x=t.x-.5*this.width,this.y=t.y-.5*this.height}},{key:"origin",get:function(){return new _n(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new gn(this.width,this.height)},set:function(t){this.width=t.width,this.height=t.height}},{key:"z",get:function(){return this.width},set:function(t){this.width=t}},{key:"w",get:function(){return this.height},set:function(t){this.height=t}}]),e}(ge));function An(t,e,i,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),new vn(t,e,i,n)}ui.fastDefine("cc.Rect",vn,{x:0,y:0,width:0,height:0}),C.Rect=vn,C.rect=An;var Sn=t("MATH_FLOAT_ARRAY",Float64Array),bn=t("MathBase",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.createFloatArray=function(t){return new Sn(t)},u(e,[{key:"array",get:function(){return this._array}}]),e}(ge)),Tn=Object.freeze({__proto__:null,bits:o,Vec2:_n,v2:pn,Vec3:ji,v3:Ki,Vec4:Ni,v4:Li,Quat:$i,quat:an,Mat3:Ji,Mat4:hn,mat4:cn,AffineTransform:mn,Size:gn,size:yn,Rect:vn,rect:An,Color:ki,color:Gi,EPSILON:pi,equals:mi,approx:gi,clamp:yi,clamp01:vi,lerp:Ai,toRadian:Si,toDegree:bi,random:Ti,randomRange:Ei,randomRangeInt:Ci,pseudoRandom:wi,pseudoRandomRange:xi,pseudoRandomRangeInt:Ri,nextPow2:Ii,repeat:Bi,pingPong:Di,inverseLerp:Pi,absMaxComponent:Mi,absMax:Oi,enumerableProps:Fi,MATH_FLOAT_ARRAY:Sn,MathBase:bn});t("math",Tn);var En,Cn,wn,xn,Rn,In,Bn,Dn,Pn,Mn,On,Fn,Nn,Ln,Vn,kn,Gn,Un,zn,Hn,Wn,Xn,jn,Yn,qn,Kn,Jn,Zn,Qn,$n,tr,er,ir,nr,rr,sr,ar,or,hr,ur,lr,cr,_r,fr,dr=new(function(){function t(){this._finalizationRegistry=null,this._gcObjects=new WeakMap}var e=t.prototype;return e.registerGCObject=function(t){return t},e.init=function(){},e.finalizationRegistryCallback=function(t){var e=this._gcObjects.get(t);e&&(this._gcObjects.delete(t),e.destroy()),this._finalizationRegistry.unregister(t)},e.destroy=function(){},t}()),pr=function(){function t(){return dr.registerGCObject(this)}return t.prototype.destroy=function(){},t}(),mr=function(t,e,i){for(var n=0;n0&&0==(t&t-1)}function Rs(t,e,i,n){if(!Ts[t].isCompressed)return e*i*n*Ts[t].size;switch(t){case In.BC1:case In.BC1_ALPHA:case In.BC1_SRGB:case In.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case In.BC2:case In.BC2_SRGB:case In.BC3:case In.BC3_SRGB:case In.BC4:case In.BC4_SNORM:case In.BC6H_SF16:case In.BC6H_UF16:case In.BC7:case In.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case In.BC5:case In.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case In.ETC_RGB8:case In.ETC2_RGB8:case In.ETC2_SRGB8:case In.ETC2_RGB8_A1:case In.EAC_R11:case In.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case In.ETC2_RGBA8:case In.ETC2_SRGB8_A1:case In.EAC_RG11:case In.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case In.PVRTC_RGB2:case In.PVRTC_RGBA2:case In.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case In.PVRTC_RGB4:case In.PVRTC_RGBA4:case In.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case In.ASTC_RGBA_4X4:case In.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case In.ASTC_RGBA_5X4:case In.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case In.ASTC_RGBA_5X5:case In.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case In.ASTC_RGBA_6X5:case In.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case In.ASTC_RGBA_6X6:case In.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case In.ASTC_RGBA_8X5:case In.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case In.ASTC_RGBA_8X6:case In.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case In.ASTC_RGBA_8X8:case In.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case In.ASTC_RGBA_10X5:case In.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case In.ASTC_RGBA_10X6:case In.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case In.ASTC_RGBA_10X8:case In.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case In.ASTC_RGBA_10X10:case In.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case In.ASTC_RGBA_12X10:case In.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case In.ASTC_RGBA_12X12:case In.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function Is(t,e,i,n,r){for(var s=0,a=0;a>1,1),i=Math.max(i>>1,1);return s}var Bs=[0,4,8,12,16,4,8,12,16,4,8,12,16,4,8,12,16,16,24,32,24,36,48,32,48,64,4,4,4,4,4,4];function Ds(t){return Bs[t]||0}function Ps(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case Bn.UNORM:case Bn.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Bn.SNORM:case Bn.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Bn.FLOAT:return Float32Array}return Float32Array}function Ms(t){switch(t){case In.BC1:case In.BC1_ALPHA:case In.BC1_SRGB:case In.BC1_SRGB_ALPHA:case In.BC2:case In.BC2_SRGB:case In.BC3:case In.BC3_SRGB:case In.BC4:case In.BC4_SNORM:case In.BC6H_SF16:case In.BC6H_UF16:case In.BC7:case In.BC7_SRGB:case In.BC5:case In.BC5_SNORM:case In.ETC_RGB8:case In.ETC2_RGB8:case In.ETC2_SRGB8:case In.ETC2_RGB8_A1:case In.EAC_R11:case In.EAC_R11SN:case In.ETC2_RGBA8:case In.ETC2_SRGB8_A1:case In.EAC_RG11:case In.EAC_RG11SN:return{width:4,height:4};case In.PVRTC_RGB2:case In.PVRTC_RGBA2:case In.PVRTC2_2BPP:return{width:8,height:4};case In.PVRTC_RGB4:case In.PVRTC_RGBA4:case In.PVRTC2_4BPP:return{width:4,height:4};case In.ASTC_RGBA_4X4:case In.ASTC_SRGBA_4X4:return{width:4,height:4};case In.ASTC_RGBA_5X4:case In.ASTC_SRGBA_5X4:return{width:5,height:4};case In.ASTC_RGBA_5X5:case In.ASTC_SRGBA_5X5:return{width:5,height:5};case In.ASTC_RGBA_6X5:case In.ASTC_SRGBA_6X5:return{width:6,height:5};case In.ASTC_RGBA_6X6:case In.ASTC_SRGBA_6X6:return{width:6,height:6};case In.ASTC_RGBA_8X5:case In.ASTC_SRGBA_8X5:return{width:8,height:5};case In.ASTC_RGBA_8X6:case In.ASTC_SRGBA_8X6:return{width:8,height:6};case In.ASTC_RGBA_8X8:case In.ASTC_SRGBA_8X8:return{width:8,height:8};case In.ASTC_RGBA_10X5:case In.ASTC_SRGBA_10X5:return{width:10,height:5};case In.ASTC_RGBA_10X6:case In.ASTC_SRGBA_10X6:return{width:10,height:6};case In.ASTC_RGBA_10X8:case In.ASTC_SRGBA_10X8:return{width:10,height:8};case In.ASTC_RGBA_10X10:case In.ASTC_SRGBA_10X10:return{width:10,height:10};case In.ASTC_RGBA_12X10:case In.ASTC_SRGBA_12X10:return{width:12,height:10};case In.ASTC_RGBA_12X12:case In.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function Os(t,e){return Math.ceil(t/e)*e}var Fs=Object.freeze({__proto__:null,get ObjectType(){return En},get Status(){return Cn},get API(){return wn},get SurfaceTransform(){return xn},get Feature(){return Rn},get Format(){return In},get FormatType(){return Bn},get Type(){return Dn},get BufferUsageBit(){return Pn},get BufferFlagBit(){return Mn},get MemoryAccessBit(){return On},get MemoryUsageBit(){return Fn},get TextureType(){return Nn},get TextureUsageBit(){return Ln},get TextureFlagBit(){return Vn},get FormatFeatureBit(){return kn},get SampleCount(){return Gn},get VsyncMode(){return Un},get Filter(){return zn},get Address(){return Hn},get ComparisonFunc(){return Wn},get StencilOp(){return Xn},get BlendFactor(){return jn},get BlendOp(){return Yn},get ColorMask(){return qn},get ShaderStageFlagBit(){return Kn},get LoadOp(){return Jn},get StoreOp(){return Zn},get AccessFlagBit(){return Qn},get ResolveMode(){return $n},get PipelineBindPoint(){return tr},get PrimitiveMode(){return er},get PolygonMode(){return ir},get ShadeModel(){return nr},get CullMode(){return rr},get DynamicStateFlagBit(){return sr},get StencilFace(){return ar},get DescriptorType(){return or},get QueueType(){return hr},get QueryType(){return ur},get CommandBufferType(){return lr},get ClearFlagBit(){return cr},get BarrierType(){return _r},get PassType(){return fr},Size:yr,DeviceCaps:vr,DeviceOptions:Ar,Offset:Sr,Rect:br,Extent:Tr,TextureSubresLayers:Er,TextureSubresRange:Cr,TextureCopy:wr,TextureBlit:Rr,BufferTextureCopy:Ir,Viewport:Br,Color:Dr,BindingMappingInfo:Pr,SwapchainInfo:Mr,DeviceInfo:Or,BufferInfo:Fr,BufferViewInfo:Nr,DrawInfo:Lr,DispatchInfo:Vr,IndirectBuffer:kr,TextureInfo:Gr,TextureViewInfo:Ur,SamplerInfo:zr,Uniform:Hr,UniformBlock:Wr,UniformSamplerTexture:Xr,UniformSampler:jr,UniformTexture:Yr,UniformStorageImage:qr,UniformStorageBuffer:Kr,UniformInputAttachment:Jr,ShaderStage:Zr,Attribute:Qr,ShaderInfo:$r,InputAssemblerInfo:ts,ColorAttachment:es,DepthStencilAttachment:is,SubpassInfo:ns,SubpassDependency:rs,RenderPassInfo:ss,GeneralBarrierInfo:as,TextureBarrierInfo:os,BufferBarrierInfo:hs,FramebufferInfo:us,DescriptorSetLayoutBinding:ls,DescriptorSetLayoutInfo:cs,DescriptorSetInfo:_s,PipelineLayoutInfo:fs,InputState:ds,CommandBufferInfo:ps,QueueInfo:ms,QueryPoolInfo:gs,FormatInfo:ys,MemoryStatus:vs,DynamicStencilStates:As,DynamicStates:Ss,GFXObject:bs,get AttributeName(){return gr},FormatInfos:Ts,DESCRIPTOR_BUFFER_TYPE:Es,DESCRIPTOR_SAMPLER_TYPE:Cs,DESCRIPTOR_DYNAMIC_TYPE:ws,DRAW_INFO_SIZE:28,IsPowerOf2:xs,FormatSize:Rs,FormatSurfaceSize:Is,GetTypeSize:Ds,getTypedArrayConstructor:Ps,formatAlignment:Ms,alignTo:Os}),Ns=function(t){function e(){var e;return(e=t.call(this,En.BUFFER)||this)._usage=Pn.NONE,e._memUsage=Fn.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Mn.NONE,e._isBufferView=!1,e}return c(e,t),u(e,[{key:"usage",get:function(){return this._usage}},{key:"memUsage",get:function(){return this._memUsage}},{key:"size",get:function(){return this._size}},{key:"stride",get:function(){return this._stride}},{key:"count",get:function(){return this._count}},{key:"flags",get:function(){return this._flags}}]),e}(bs),Ls=function(t){function e(){var e;return(e=t.call(this,En.COMMAND_BUFFER)||this)._queue=null,e._type=lr.PRIMARY,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return c(e,t),u(e,[{key:"type",get:function(){return this._type}},{key:"queue",get:function(){return this._queue}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}}]),e}(bs),Vs=function(){function t(){this._gfxAPI=wn.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Rn.COUNT),this._formatFeatures=new Array(In.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new vs,this._caps=new vr,this._bindingMappingInfo=new Pr,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},u(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),t}();Vs.canvas=void 0;var ks=function(t){function e(){var e;return(e=t.call(this,En.SWAPCHAIN)||this)._transform=xn.IDENTITY,e._colorTexture=null,e._depthStencilTexture=null,e}return c(e,t),u(e,[{key:"colorTexture",get:function(){return this._colorTexture}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"surfaceTransform",get:function(){return this._transform}},{key:"width",get:function(){return this._colorTexture.width}},{key:"height",get:function(){return this._colorTexture.height}}]),e}(bs),Gs=function(t){function e(){var e;return(e=t.call(this,En.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e}return c(e,t),u(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),e}(bs),Us=String.prototype.charCodeAt;function zs(t){return this[t]}function Hs(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?Us:zs;i>=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}var Ws=function(t){function e(){var e;return(e=t.call(this,En.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Lr,e}c(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var h=0;h>0,e.magFilter=(3&t)>>2,e.mipFilter=(3&t)>>4,e.addressU=(3&t)>>6,e.addressV=(3&t)>>8,e.addressW=(3&t)>>10,e.maxAnisotropy=(15&t)>>12,e.cmpFunc=(7&t)>>16,e},u(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(bs),na=function(t){function e(){var e;return(e=t.call(this,En.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return c(e,t),u(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}}]),e}(bs),ra=function(t){function e(){var e;return(e=t.call(this,En.TEXTURE)||this)._info=new Gr,e._viewInfo=new Ur,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return c(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},u(e,[{key:"type",get:function(){return this._info.type}},{key:"usage",get:function(){return this._info.usage}},{key:"format",get:function(){return this._info.format}},{key:"width",get:function(){return this._info.width}},{key:"height",get:function(){return this._info.height}},{key:"depth",get:function(){return this._info.depth}},{key:"layerCount",get:function(){return this._info.layerCount}},{key:"levelCount",get:function(){return this._info.levelCount}},{key:"samples",get:function(){return this._info.samples}},{key:"flags",get:function(){return this._info.flags}},{key:"size",get:function(){return this._size}},{key:"info",get:function(){return this._info}},{key:"viewInfo",get:function(){return this._viewInfo}},{key:"isTextureView",get:function(){return this._isTextureView}}]),e}(bs),sa=function(t){function e(e,i){var n;return(n=t.call(this,En.GLOBAL_BARRIER)||this)._info=new as,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){return Hs(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},u(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(bs),aa=function(t){function e(e,i){var n;return(n=t.call(this,En.TEXTURE_BARRIER)||this)._info=new os,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.baseMipLevel,e+=t.levelCount,e+=t.baseSlice,e+=t.sliceCount,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Hs(e+=t.dstQueue?t.dstQueue.type:0,666)},u(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(bs),oa=function(t){function e(e,i){var n;return(n=t.call(this,En.BUFFER_BARRIER)||this)._info=new hs,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){var e=t.prevAccesses+" "+t.nextAccesses;return e+=t.type,e+=t.offset,e+=t.size,e+=t.discardContents,e+=t.srcQueue?t.srcQueue.type:0,Hs(e+=t.dstQueue?t.dstQueue.type:0,666)},u(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(bs),ha={Device:Vs,Swapchain:ks,Buffer:Ns,Texture:ra,Sampler:ia,Shader:na,InputAssembler:Ws,RenderPass:ea,Framebuffer:Gs,DescriptorSet:Xs,DescriptorSetLayout:js,PipelineLayout:Ys,PipelineState:$s,CommandBuffer:Ls,Queue:ta,GeneralBarrier:sa,TextureBarrier:aa,BufferBarrier:oa,RasterizerState:qs,BlendState:Zs,BlendTarget:Js,DepthStencilState:Ks,PipelineStateInfo:Qs};Object.assign(ha,Fs),C.gfx=ha;var ua={GFXDevice:!0,GFXBuffer:!0,GFXTexture:!0,GFXSampler:!0,GFXShader:!0,GFXInputAssembler:!0,GFXRenderPass:!0,GFXFramebuffer:!0,GFXPipelineState:!0,GFXCommandBuffer:!0,GFXQueue:!0,GFXObjectType:!0,GFXObject:!1,GFXAttributeName:!0,GFXType:!0,GFXFormat:!0,GFXBufferUsageBit:!0,GFXMemoryUsageBit:!0,GFXBufferFlagBit:!0,GFXBufferAccessBit:"MemoryAccessBit",GFXPrimitiveMode:!0,GFXPolygonMode:!0,GFXShadeModel:!0,GFXCullMode:!0,GFXComparisonFunc:!0,GFXStencilOp:!0,GFXBlendOp:!0,GFXBlendFactor:!0,GFXColorMask:!0,GFXFilter:!0,GFXAddress:!0,GFXTextureType:!0,GFXTextureUsageBit:!0,GFXSampleCount:!0,GFXTextureFlagBit:!0,GFXShaderStageFlagBit:!0,GFXDescriptorType:!0,GFXCommandBufferType:!0,GFXLoadOp:!0,GFXStoreOp:!0,GFXPipelineBindPoint:!0,GFXDynamicStateFlagBit:!0,GFXStencilFace:!0,GFXQueueType:!0,GFXRect:!0,GFXViewport:!0,GFXColor:!0,GFXClearFlag:!0,GFXOffset:!0,GFXExtent:!0,GFXTextureSubres:"TextureSubresLayers",GFXTextureCopy:!0,GFXBufferTextureCopy:!0,GFXFormatType:!0,GFXFormatInfo:!0,GFXMemoryStatus:!0,GFXFormatInfos:!0,GFXFormatSize:!0,GFXFormatSurfaceSize:!0,GFXGetTypeSize:!0,getTypedArrayConstructor:!1};for(var la in ua){var ca=ua[la];!0===ca?ca=la.slice(3):!1===ca&&(ca=la),et(C,"cc",[{name:la,newName:ca,target:C.gfx,targetName:"cc.gfx"}])}it(C,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),it(Rn,"Feature",[{name:"COLOR_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.RENDER_TARGET;"},{name:"COLOR_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.RENDER_TARGET;"},{name:"TEXTURE_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R32F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R16F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"TEXTURE_HALF_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"FORMAT_R11G11B10F",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R11G11B10F) !== FormatFeatureBit.NONE;"},{name:"FORMAT_SRGB",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.SRGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC1",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC2",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC2_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_DXT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.BC1) !== FormatFeatureBit.NONE;"},{name:"FORMAT_PVRTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.PVRTC_RGB2) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ASTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ASTC_RGBA_4x4) !== FormatFeatureBit.NONE;"},{name:"FORMAT_RGB8",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.RGB8) !== FormatFeatureBit.NONE;"}]),it(es.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),it(is.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),et(Vs.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var _a=new(function(){function t(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var e=t.prototype;return e.addContainer=function(t){-1===t._poolHandle&&(t._poolHandle=this._pools.length,this._pools.push(t))},e.removeContainer=function(t){-1!==t._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=t._poolHandle,gt(this._pools,t._poolHandle),t._poolHandle=-1)},e.tryShrink=function(){for(var t=0;tthis.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}()),fa=function(){function t(){this._poolHandle=-1,_a.addContainer(this)}return t.prototype.destroy=function(){_a.removeContainer(this)},t}(),da=t("Pool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freepool=[],r._dtor=void 0,r._ctor=e,r._dtor=n||null,r._elementsPerBatch=Math.max(i,1),r._nextAvail=r._elementsPerBatch-1;for(var s=0;s>1>this._elementsPerBatch){if(this._dtor)for(var t=this._nextAvail>>1;t<=this._nextAvail;t++)this._dtor(this._freepool[t]);this._freepool.length=this._nextAvail>>1,this._nextAvail=this._freepool.length-1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&j(14100);var i=e||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freepool[n]);this._freepool.length=0,this._nextAvail=-1,t.prototype.destroy.call(this)},e}(fa)),pa=t("RecyclePool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;sthis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},u(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(fa)),ma=t("CachedArray",function(t){function e(e,i){var n;return(n=t.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(e),n._initSize=e,n.length=0,n._compareFn=i,n}c(e,t);var i=e.prototype;return i.push=function(t){this.array[this.length++]=t},i.pop=function(){return this.array[--this.length]},i.get=function(t){return this.array[t]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,t.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(t){for(var e=0;e=this.length||t<0)){var e=--this.length;this.array[t]=this.array[e]}},i.indexOf=function(t){for(var e=0,i=this.length;e=0;--t)this.callbackInfos[t]||Ca(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),Ba=new da((function(){return new Ia}),16),Da=function(){function t(){this._callbackTable=Mt(!0),this._offCallback=void 0}var e=t.prototype;return e.on=function(t,e,i,n){if(!this.hasEventListener(t,e,i)){var r=this._callbackTable[t];r||(r=this._callbackTable[t]=Ba.alloc());var s=Ra.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(u=!0,l="",c=0);var f=La.UNKNOWN;-1!==s.appVersion.indexOf("Win")?f=La.WINDOWS:u?f=La.IOS:-1!==s.appVersion.indexOf("Mac")?f=La.OSX:-1!==s.appVersion.indexOf("X11")&&-1===s.appVersion.indexOf("Linux")?f=La.LINUX:h?f=La.ANDROID:-1===s.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(f=La.LINUX),n.os=f,n.osVersion=l,n.osMainVersion=c,n.browserType=Oa.UNKNOWN;var d=/wechat|weixin|micromessenger/i.exec(a)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(a)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(a)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(a),p=d?d[0].toLowerCase():La.UNKNOWN;("safari"===p&&h||"qq"===p&&/android.*applewebkit/i.test(a))&&(p=Oa.ANDROID);var m={micromessenger:Oa.WECHAT,wechat:Oa.WECHAT,weixin:Oa.WECHAT,trident:Oa.IE,edge:Oa.EDGE,"360 aphone":Oa.BROWSER_360,mxbrowser:Oa.MAXTHON,"opr/":Oa.OPERA,ubrowser:Oa.UC,huaweibrowser:Oa.HUAWEI};n.browserType=m[p]||p,n.browserVersion="";var g=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(a);g||(g=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(a)),n.browserVersion=g?g[4]:"",n.isXR=!1;var y,v=document.createElement("canvas");v.getContext("2d");try{y=v.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){y=!1}if(n.browserType===Oa.SAFARI){var A,S=null===(A=/ version\/(\d+)/.exec(a))||void 0===A?void 0:A[1];"string"==typeof S&&Number.parseInt(S)>=14&&(y=!0)}var b=!1;"undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob&&(v.width=v.height=2,createImageBitmap(v,{}).then((function(t){b=!0,null==t||t.close()})).catch((function(){})));var E=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||T,C=void 0!==document.documentElement.onmouseup||T;return n._featureMap=((i={})[ka.WEBP]=y,i[ka.IMAGE_BITMAP]=b,i[ka.WEB_VIEW]=!0,i[ka.VIDEO_PLAYER]=!0,i[ka.SAFE_AREA]=!1,i[ka.INPUT_TOUCH]=E,i[ka.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||T,i[ka.EVENT_MOUSE]=C,i[ka.EVENT_TOUCH]=E||C,i[ka.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,i[ka.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads,i[ka.EVENT_HANDLE]=n.isXR,i[ka.EVENT_HMD]=n.isXR,i),n._registerEvent(),n}c(e,t);var i=e.prototype;return i._registerEvent=function(){var t,e=this;t=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.close=function(){this.emit("close"),window.close()},e}(Ma));!function(t){t[t.PORTRAIT=1]="PORTRAIT",t[t.PORTRAIT_UPSIDE_DOWN=2]="PORTRAIT_UPSIDE_DOWN",t[t.LANDSCAPE_LEFT=4]="LANDSCAPE_LEFT",t[t.LANDSCAPE_RIGHT=8]="LANDSCAPE_RIGHT",t[t.LANDSCAPE=12]="LANDSCAPE",t[t.AUTO=13]="AUTO"}(Ua||(Ua={}));var Ha,Wa={auto:Ua.AUTO,landscape:Ua.LANDSCAPE,portrait:Ua.PORTRAIT};!function(t){t[t.Unknown=0]="Unknown",t[t.SubFrame=1]="SubFrame",t[t.BrowserWindow=2]="BrowserWindow",t[t.Fullscreen=3]="Fullscreen"}(Ha||(Ha={}));var Xa=new(function(t){function e(){var e,i,n,r,s,a;(e=t.call(this)||this).isFrameRotated=!1,e.handleResizeEvent=!0,e._gameFrame=void 0,e._gameContainer=void 0,e._gameCanvas=void 0,e._isProportionalToFrame=!1,e._cachedFrameStyle={width:"0px",height:"0px"},e._cachedContainerStyle={width:"0px",height:"0px"},e._cbToUpdateFrameBuffer=void 0,e._supportFullScreen=!1,e._touchEventName=void 0,e._onFullscreenChange=void 0,e._onFullscreenError=void 0,e._orientationChangeTimeoutId=-1,e._cachedFrameSize=new gn(0,0),e._exactFitScreen=!1,e._fn={},e._fnGroup=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement","fullscreenerror"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement","fullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement","msfullscreenerror"]],e._resolutionScale=1,e._orientation=Ua.AUTO,e._gameFrame=document.getElementById("GameDiv"),e._gameContainer=document.getElementById("Cocos3dGameContainer"),e._gameCanvas=document.getElementById("GameCanvas"),e._gameFrame||(e._gameFrame=document.createElement("div"),e._gameFrame.setAttribute("id","GameDiv"),null===(i=e._gameCanvas)||void 0===i||null===(n=i.parentNode)||void 0===n||n.insertBefore(e._gameFrame,e._gameCanvas),e._gameFrame.appendChild(e._gameCanvas)),e._gameContainer||(e._gameContainer=document.createElement("div"),e._gameContainer.setAttribute("id","Cocos3dGameContainer"),null===(r=e._gameCanvas)||void 0===r||null===(s=r.parentNode)||void 0===s||s.insertBefore(e._gameContainer,e._gameCanvas),e._gameContainer.appendChild(e._gameCanvas));for(var o=e._fnGroup,h=0;hwindow.innerHeight;this.isFrameRotated=za.isMobile&&(e&&t===Ua.PORTRAIT||!e&&t===Ua.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void j(9201);var t,e,i=C.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,h=r/a,u=s/o,l=this._gameContainer.style;h0&&j(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),Xa.requestFullScreen().then((function(){null==e||e()})).catch((function(t){console.error(t),null==i||i()}))},e.exitFullScreen=function(){return Xa.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(){}))},e.disableAutoFullScreen=function(){},u(t,[{key:"devicePixelRatio",get:function(){return Xa.devicePixelRatio}},{key:"windowSize",get:function(){return Xa.windowSize},set:function(t){Xa.windowSize=t}},{key:"resolution",get:function(){return Xa.resolution}},{key:"supportsFullScreen",get:function(){return Xa.supportFullScreen}}]),t}(),Ya=t("screen",new ja);C.screen=Ya;var qa,Ka,Ja=t("sys",{Feature:ka,hasFeature:function(t){return za.hasFeature(t)},NetworkType:Na,Language:Fa,OS:La,Platform:Va,BrowserType:Oa,isNative:za.isNative,isBrowser:za.isBrowser,isMobile:za.isMobile,isLittleEndian:za.isLittleEndian,platform:za.platform,language:za.language,languageCode:za.nativeLanguage,os:za.os,osVersion:za.osVersion,osMainVersion:za.osMainVersion,browserType:za.browserType,browserVersion:za.browserVersion,isXR:za.isXR,windowPixelResolution:Ya.windowSize,capabilities:{canvas:!0,opengl:!0,webp:za.hasFeature(ka.WEBP),imageBitmap:za.hasFeature(ka.IMAGE_BITMAP),touches:za.hasFeature(ka.INPUT_TOUCH),mouse:za.hasFeature(ka.EVENT_MOUSE),keyboard:za.hasFeature(ka.EVENT_KEYBOARD),accelerometer:za.hasFeature(ka.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return za.networkType},getBatteryLevel:function(){return za.getBatteryLevel()},garbageCollect:function(){za.triggerGC()},isObjectValid:function(t){return null!=t},dump:function(){var t="";t+="isMobile : "+this.isMobile+"\r\n",t+="language : "+this.language+"\r\n",t+="browserType : "+this.browserType+"\r\n",t+="browserVersion : "+this.browserVersion+"\r\n",t+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",F(t+="Using "+(C.game.renderType===C.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){za.openURL(t)},init:function(){try{var t=Ja.localStorage=window.localStorage;t.setItem("storage",""),t.removeItem("storage"),t=null}catch(t){var e=function(){j(5200)};this.localStorage={getItem:e,setItem:e,clear:e,removeItem:e}}this.__isWebIOS14OrIPadOS14Env=(Ja.os===La.IOS||Ja.os===La.OSX)&&za.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)},now:function(){return za.now()},restartVM:function(){za.restartJSVM()},getSafeAreaRect:function(){var t=C.view,e=Xa.safeAreaEdge,i=Xa.windowSize,n=new _n(e.left,e.bottom),r=new _n(i.width-e.right,i.height-e.top);t._convertToUISpace(n),t._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,h=r.y-n.y;return new vn(s,a,o,h)}});C.sys=Ja,function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS"}(qa||(qa={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.OPENGL=2]="OPENGL",t[t.HEADLESS=3]="HEADLESS"}(Ka||(Ka={}));var Za=function(){function t(){this.initialized=!1,this._canvas=null,this._renderType=Ka.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=ve.querySettings(ye.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===Ka.WEBGL){var n=new Or(e),r=!!window.WebGL2RenderingContext,s=window.navigator.userAgent.toLowerCase();(-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")||Ja.browserType===Oa.UC)&&(r=!1);var a=[];r&&C.WebGL2Device&&a.push(C.WebGL2Device),C.WebGLDevice&&a.push(C.WebGLDevice),C.EmptyDevice&&a.push(C.EmptyDevice),Vs.canvas=t;for(var o=0;oKa.HEADLESS||tro.x?ro.x:t.x,t.y=t.y>ro.y?ro.y:t.y,t.z=t.z>ro.z?ro.z:t.z,t}function uo(t,e,i){ji.set($a,i.orientation.m00,i.orientation.m01,i.orientation.m02),ji.set(to,i.orientation.m03,i.orientation.m04,i.orientation.m05),ji.set(eo,i.orientation.m06,i.orientation.m07,i.orientation.m08),so[0]=$a,so[1]=to,so[2]=eo,ao[0]=i.halfExtents.x,ao[1]=i.halfExtents.y,ao[2]=i.halfExtents.z,ji.subtract(io,e,i.center),ji.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=ji.dot(io,so[n]);r>ao[n]&&(r=ao[n]),r<-ao[n]&&(r=-ao[n]),t.x+=r*so[n].x,t.y+=r*so[n].y,t.z+=r*so[n].z}return t}var lo=Object.freeze({__proto__:null,point_plane:oo,pt_point_plane:function(t,e,i){var n=oo(e,i);return ji.subtract(t,e,ji.multiplyScalar(t,i.n,n))},pt_point_aabb:ho,pt_point_obb:uo,pt_point_line:function(t,e,i,n){ji.subtract($a,i,n);var r=$a,s=ji.lengthSqr(r);if(0==s)ji.copy(t,i);else{ji.subtract($a,e,i);var a=ji.dot($a,r)/s;a<0?ji.copy(t,i):a>1?ji.copy(t,n):ji.scaleAndAdd(t,i,r,a)}}}),co={SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256,SHAPE_CAPSULE:512,SHAPE_SPLINE:1024},_o=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=co.SHAPE_LINE,this.s=new ji(t,e,i),this.e=new ji(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return ji.copy(t.s,e.s),ji.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return ji.copy(t.s,e),ji.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return ji.distance(t.s,t.e)},t.prototype.length=function(){return ji.distance(this.s,this.e)},u(t,[{key:"type",get:function(){return this._type}}]),t}(),fo=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.o=void 0,this.d=void 0,this._type=void 0,this._type=co.SHAPE_RAY,this.o=new ji(t,e,i),this.d=new ji(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return ji.copy(t.o,e.o),ji.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return ji.copy(t.o,e),ji.normalize(t.d,ji.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){ji.normalize(t,this.d),ji.scaleAndAdd(t,this.o,t,e)},u(t,[{key:"type",get:function(){return this._type}}]),t}(),po=new ji,mo=new ji,go=new ji,yo=new ji;function vo(t){return Math.max(Math.max(t.x,t.y),t.z)}var Ao,So=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new ji(0,0,0),this._radius=0,this._type=void 0,this._type=co.SHAPE_SPHERE,this._center=new ji(t,e,i),this._radius=n}t.create=function(e,i,n,r){return new t(e,i,n,r)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.radius)},t.copy=function(t,e){return ji.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return ji.multiplyScalar(t.center,ji.add(po,e,i),.5),t.radius=.5*ji.subtract(po,i,e).length(),t},t.set=function(t,e,i,n,r){return t.center.x=e,t.center.y=i,t.center.z=n,t.radius=r,t};var e=t.prototype;return e.destroy=function(){},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.getBoundary=function(t,e){ji.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),ji.set(e,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},e.transform=function(t,e,i,n,r){ji.transformMat4(r.center,this.center,t),r.radius=this.radius*vo(n)},e.translateAndRotate=function(t,e,i){ji.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*vo(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),ji.subtract(mo,t,this.center);var e=mo.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,ji.multiplyScalar(mo,mo,i/e),ji.add(this.center,this.center,mo)}},e.mergePoints=function(t){var e=t.length;if(!(e<1)){this.radius=-1;for(var i=0;i-Number.EPSILON))return 0;var r=1/n;ji.subtract(xo,t.o,e.a);var s=ji.dot(xo,wo)*r;if(s<0||s>1)return 0;ji.cross(Ro,xo,Eo);var a=ji.dot(t.d,Ro)*r;if(a<0||s+a>1)return 0;var o=ji.dot(Co,Ro)*r;return o<0?0:o}),Mo=function(){var t=new ji(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;ji.subtract(t,r,s);var h=t.lengthSqr(),u=ji.dot(t,a),l=o-(h-u*u);if(l<0)return 0;var c=Math.sqrt(l),_=hp?0:d>0?d:p}var No,Lo,Vo,ko,Go=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji,a=new ji,o=new Array(3),h=new Array(3),u=new Array(3),l=new Array(6);return function(c,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,t=_.center,e=c.o,i=c.d,ji.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),ji.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),ji.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),ji.subtract(a,t,e),h[0]=ji.dot(n,i),h[1]=ji.dot(r,i),h[2]=ji.dot(s,i),u[0]=ji.dot(n,a),u[1]=ji.dot(r,a),u[2]=ji.dot(s,a);for(var f=0;f<3;++f){if(0===h[f]){if(-u[f]-o[f]>0||-u[f]+o[f]<0)return 0;h[f]=1e-7}l[2*f+0]=(u[f]+o[f])/h[f],l[2*f+1]=(u[f]-o[f])/h[f]}var d=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||d>p?0:d>0?d:p}}(),Uo=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji,a=new ji,o=new So;return function(h,u){var l=u.radius*u.radius,c=ji.normalize(t,h.d),_=u.ellipseCenter0,f=u.ellipseCenter1,d=ji.subtract(e,f,_);if(d.equals(ji.ZERO))return o.radius=u.radius,o.center.set(u.ellipseCenter0),Ch.raySphere(h,o);var p=h.o,m=ji.subtract(i,p,_),g=ji.cross(n,c,d),y=g.lengthSqr();if(0===y){o.radius=u.radius;var v=ji.subtract(r,f,p);return m.lengthSqr()=0&&R<=1?E:R<0?(o.radius=u.radius,o.center.set(u.ellipseCenter0),Ch.raySphere(h,o)):R>1?(o.radius=u.radius,o.center.set(u.ellipseCenter1),Ch.raySphere(h,o)):0}}(),zo=(No=bo.create(),Lo={distance:1/0,doubleSided:!1,mode:Ao.ANY},Vo=0,ko=function(t,e,i,n,r,s){t===Ao.CLOSEST?(Vo>e||0===Vo)&&(Vo=e,s&&(0===s.length?s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}):(s[0].distance=e,s[0].vertexIndex0=i/3,s[0].vertexIndex1=n/3,s[0].vertexIndex2=r/3))):(Vo=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(Vo=0,0===e.geometricInfo.positions.length)return Vo;var n=void 0===i?Lo:i;if(Fo(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===er.TRIANGLE_LIST)for(var s=e.length,a=0;ar.distance)&&(ko(r.mode,l,o,h,u,r.result),r.mode===Ao.ANY))return l}else if(i===er.TRIANGLE_STRIP)for(var c=e.length-2,_=0,f=0;fr.distance)&&(ko(r.mode,g,d,p,m,r.result),r.mode===Ao.ANY))return g}else if(i===er.TRIANGLE_FAN){var y=e.length-1,v=3*e[0];ji.set(No.a,t[v],t[v+1],t[v+2]);for(var A=1;Ar.distance)&&(ko(r.mode,T,v,S,b,r.result),r.mode===Ao.ANY))return T}}}(s.positions,s.indices,r,t,n)}return Vo}),Ho=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Ao.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,h=n.struct.maxPosition;if(o&&h&&!Fo(i,o,h))return t;for(var u=0;uc)&&(t=c,s.subIndices&&(s.subIndices[0]=u));else if(t=c,s.subIndices&&s.subIndices.push(u),s.mode===Ao.ANY)return c}return t&&s.mode===Ao.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),Wo=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Ao.ANY},i=new fo,n=new hn;return function(r,s,a){t=0;var o=void 0===a?e:a,h=s.worldBounds;if(h&&!Oo(r,h))return t;fo.copy(i,r),s.node&&(hn.invert(n,s.node.getWorldMatrix(n)),ji.transformMat4(i.o,r.o,n),ji.transformMat4Normal(i.d,r.d,n));for(var u=s.subModels,l=0;l_)&&(t=_,o.subIndices&&(o.subIndices[0]=l));else if(t=_,o.subIndices&&o.subIndices.push(l),o.mode===Ao.ANY)return _}return t&&o.mode===Ao.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}(),Xo=function(){var t=new ji(0,0,0);return function(e,i){ji.subtract(t,e.e,e.s);var n=(i.d-ji.dot(e.s,i.n))/ji.dot(t,i.n);return n<0||n>1?0:n}}(),jo=function(){var t=new ji(0,0,0),e=new ji(0,0,0),i=new ji(0,0,0),n=new ji(0,0,0),r=new ji(0,0,0),s=new ji(0,0,0);return function(a,o,h){ji.subtract(t,o.b,o.a),ji.subtract(e,o.c,o.a),ji.subtract(i,a.s,a.e),ji.cross(r,t,e);var u=ji.dot(i,r);if(u<=0)return 0;ji.subtract(n,a.s,o.a);var l=ji.dot(n,r);if(l<0||l>u)return 0;ji.cross(s,i,n);var c=ji.dot(e,s);if(c<0||c>u)return 0;var _=-ji.dot(t,s);if(_<0||c+_>u)return 0;if(h){var f=1/u,d=1-(c*=f)-(_*=f);ji.set(h,o.a.x*d+o.b.x*c+o.c.x*_,o.a.y*d+o.b.y*c+o.c.y*_,o.a.z*d+o.b.z*c+o.c.z*_)}return 1}}(),Yo=new fo;function qo(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=Oo(Yo,e);return i<=t.length()?i:0}function Ko(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=Go(Yo,e);return i<=t.length()?i:0}function Jo(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=Mo(Yo,e);return i<=t.length()?i:0}var Zo,Qo,$o,th,eh=(Zo=new ji,Qo=new ji,$o=new ji,th=new ji,function(t,e){return ji.subtract(Zo,t.center,t.halfExtents),ji.add(Qo,t.center,t.halfExtents),ji.subtract($o,e.center,e.halfExtents),ji.add(th,e.center,e.halfExtents),Zo.x<=th.x&&Qo.x>=$o.x&&Zo.y<=th.y&&Qo.y>=$o.y&&Zo.z<=th.z&&Qo.z>=$o.z});function ih(t,e,i,n,r,s){ji.set(s[0],t.x+i.x*e.x+n.x*e.y+r.x*e.z,t.y+i.y*e.x+n.y*e.y+r.y*e.z,t.z+i.z*e.x+n.z*e.y+r.z*e.z),ji.set(s[1],t.x-i.x*e.x+n.x*e.y+r.x*e.z,t.y-i.y*e.x+n.y*e.y+r.y*e.z,t.z-i.z*e.x+n.z*e.y+r.z*e.z),ji.set(s[2],t.x+i.x*e.x-n.x*e.y+r.x*e.z,t.y+i.y*e.x-n.y*e.y+r.y*e.z,t.z+i.z*e.x-n.z*e.y+r.z*e.z),ji.set(s[3],t.x+i.x*e.x+n.x*e.y-r.x*e.z,t.y+i.y*e.x+n.y*e.y-r.y*e.z,t.z+i.z*e.x+n.z*e.y-r.z*e.z),ji.set(s[4],t.x-i.x*e.x-n.x*e.y-r.x*e.z,t.y-i.y*e.x-n.y*e.y-r.y*e.z,t.z-i.z*e.x-n.z*e.y-r.z*e.z),ji.set(s[5],t.x+i.x*e.x-n.x*e.y-r.x*e.z,t.y+i.y*e.x-n.y*e.y-r.y*e.z,t.z+i.z*e.x-n.z*e.y-r.z*e.z),ji.set(s[6],t.x-i.x*e.x+n.x*e.y-r.x*e.z,t.y-i.y*e.x+n.y*e.y-r.y*e.z,t.z-i.z*e.x+n.z*e.y-r.z*e.z),ji.set(s[7],t.x-i.x*e.x-n.x*e.y+r.x*e.z,t.y-i.y*e.x-n.y*e.y+r.y*e.z,t.z-i.z*e.x-n.z*e.y+r.z*e.z)}function nh(t,e){for(var i=ji.dot(e,t[0]),n=i,r=1;r<8;++r){var s=ji.dot(e,t[r]);i=sn?s:n}return[i,n]}var rh,sh,ah,oh=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new ji(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new ji(0,0,0),n[r]=new ji(0,0,0);var s=new ji,a=new ji;return function(e,r){ji.set(t[0],1,0,0),ji.set(t[1],0,1,0),ji.set(t[2],0,0,1),ji.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),ji.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),ji.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)ji.cross(t[6+3*o],t[o],t[3]),ji.cross(t[7+3*o],t[o],t[4]),ji.cross(t[7+3*o],t[o],t[5]);ji.subtract(s,e.center,e.halfExtents),ji.add(a,e.center,e.halfExtents),function(t,e,i){ji.set(i[0],t.x,e.y,e.z),ji.set(i[1],t.x,e.y,t.z),ji.set(i[2],t.x,t.y,e.z),ji.set(i[3],t.x,t.y,t.z),ji.set(i[4],e.x,e.y,e.z),ji.set(i[5],e.x,e.y,t.z),ji.set(i[6],e.x,t.y,e.z),ji.set(i[7],e.x,t.y,t.z)}(s,a,i),ih(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var h=0;h<15;++h){var u=nh(i,t[h]),l=nh(n,t[h]);if(l[0]>u[1]||u[0]>l[1])return 0}return 1}}(),hh=function(t,e){var i=t.halfExtents.x*Math.abs(e.n.x)+t.halfExtents.y*Math.abs(e.n.y)+t.halfExtents.z*Math.abs(e.n.z),n=ji.dot(e.n,t.center);return n+ie.d?0:1},uh=function(t,e){for(var i=0;in.halfExtents.x?e++:t[u].x<-n.halfExtents.x&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var l=0;ln.halfExtents.y?e++:t[l].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var c=0;cn.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),ch=(rh=new ji(0,0,0),sh=new Ji,function(t,e){return ji.subtract(rh,e,t.center),ji.transformMat3(rh,rh,Ji.transpose(sh,t.orientation)),i=rh,n=t.halfExtents,Math.abs(i.x)e.d?0:1}),fh=function(t,e){for(var i=0;ir.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var _=0;_r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var f=0;fr.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),ph=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new ji(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new ji(0,0,0),n[r]=new ji(0,0,0);return function(e,r){ji.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),ji.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),ji.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),ji.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),ji.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),ji.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)ji.cross(t[6+3*s],t[s],t[3]),ji.cross(t[7+3*s],t[s],t[4]),ji.cross(t[8+3*s],t[s],t[5]);ih(e.center,e.halfExtents,t[0],t[1],t[2],i),ih(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=nh(i,t[a]),h=nh(n,t[a]);if(h[0]>o[1]||o[0]>h[1])return 0}return 1}}(),mh=function(){for(var t=new So,e=new ji,i=new ji,n=new ji,r=new Array(8),s=0;s<8;s++)r[s]=new ji;for(var a=new Array(8),o=0;o<8;o++)a[o]=new ji;return function(s,o){if(0===ji.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),Ch.sphereOBB(t,s);e.x=s.orientation.m00,e.y=s.orientation.m01,e.z=s.orientation.m02,i.x=s.orientation.m03,i.y=s.orientation.m04,i.z=s.orientation.m05,n.x=s.orientation.m06,n.y=s.orientation.m07,n.z=s.orientation.m08,ih(s.center,s.halfExtents,e,i,n,r);var h=a,u=ji.copy(h[0],e),l=ji.copy(h[1],i),c=ji.copy(h[2],n);ji.subtract(h[3],o.center,s.center).normalize();var _=ji.subtract(h[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),ji.cross(h[5],u,_),ji.cross(h[6],l,_),ji.cross(h[7],c,_);for(var f=0;f<8;++f){var d=nh(r,h[f]),p=ji.dot(h[f],o.ellipseCenter0),m=ji.dot(h[f],o.ellipseCenter1),g=Math.max(p,m),y=Math.min(p,m)-o.radius,v=g+o.radius;if(y>d[1]||d[0]>v)return 0}return 1}}(),gh=function(t,e){var i=ji.dot(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},yh=function(t,e){for(var i=0;iu)){ji.add(t,o,ji.multiplyScalar(t,h,a));for(var c=0;c<6;c++)if(c!==r&&c!==r+e[r]){var _=n.planes[c];if(ji.dot(_.n,t)<_.d)return 0}}}return 1}}(),Ah=function(t,e){var i=t.radius+e.radius;return ji.squaredDistance(t.center,e.center)1?ji.squaredDistance(i.center,n.ellipseCenter1)v&&(h=v,u=g+d,A=p)),u<0?(u=0,-m<0?h=0:-m>f?h=v:(h=-m,v=f)):u>A&&(u=A,-m+d<0?h=0:-m+d>f?h=v:(h=-m+d,v=f));var S=Math.abs(h)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){hn.invert(Rh,t),hn.transpose(Rh,Rh),Ni.set(Ih,this.n.x,this.n.y,this.n.z,this.d),Ni.transformMat4(Ih,Ih,Rh),ji.set(this.n,Ih.x,Ih.y,Ih.z),this.d=Ih.w},u(t,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(t){this.n.x=t}},{key:"y",get:function(){return this.n.y},set:function(t){this.n.y=t}},{key:"z",get:function(){return this.n.z},set:function(t){this.n.z=t}},{key:"w",get:function(){return this.d},set:function(t){this.d=t}}]),t}(),Dh=new ji,Ph=new ji,Mh=new ji,Oh=new ji,Fh=new Ji,Nh=function(t,e,i){Fh.m00=Math.abs(i.m00),Fh.m01=Math.abs(i.m01),Fh.m02=Math.abs(i.m02),Fh.m03=Math.abs(i.m04),Fh.m04=Math.abs(i.m05),Fh.m05=Math.abs(i.m06),Fh.m06=Math.abs(i.m08),Fh.m07=Math.abs(i.m09),Fh.m08=Math.abs(i.m10),ji.transformMat3(t,e,Fh)},Lh=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),this.center=void 0,this.halfExtents=void 0,this._type=void 0,this._type=co.SHAPE_AABB,this.center=new ji(t,e,i),this.halfExtents=new ji(n,r,s)}t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z)},t.copy=function(t,e){return ji.copy(t.center,e.center),ji.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return ji.add(Dh,i,e),ji.subtract(Ph,i,e),ji.multiplyScalar(t.center,Dh,.5),ji.multiplyScalar(t.halfExtents,Ph,.5),t},t.set=function(t,e,i,n,r,s,a){return t.center.set(e,i,n),t.halfExtents.set(r,s,a),t},t.merge=function(e,i,n){return ji.subtract(Dh,i.center,i.halfExtents),ji.subtract(Ph,n.center,n.halfExtents),ji.add(Mh,i.center,i.halfExtents),ji.add(Oh,n.center,n.halfExtents),ji.max(Oh,Mh,Oh),ji.min(Mh,Dh,Ph),t.fromPoints(e,Mh,Oh)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return ji.transformMat4(t.center,e.center,i),Nh(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){ji.subtract(t,this.center,this.halfExtents),ji.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){ji.transformMat4(r.center,this.center,t),Nh(r.halfExtents,this.halfExtents,t)},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.mergePoint=function(t){this.getBoundary(Dh,Ph),t.xPh.x&&(Ph.x=t.x),t.y>Ph.y&&(Ph.y=t.y),t.z>Ph.z&&(Ph.z=t.z),ji.add(Mh,Dh,Ph),this.center.set(ji.multiplyScalar(Mh,Mh,.5)),this.halfExtents.set(Ph.x-Mh.x,Ph.y-Mh.y,Ph.z-Mh.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return Qh(this._times,t)},e.updateTime=function(t,e){var i=this._values[t];this.removeKeyframe(t),this._insertNewKeyframe(e,i)},e.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.slice());else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return t[1]})))}},e.clear=function(){this._times.length=0,this._values.length=0},e.searchKeyframe=function(t){return Qh(this._times,t)},e.setKeyframes=function(t,e){t.length,e.length,function(t){t.every((function(t,e,i){return 0===e||t>i[e-1]||gi(t,i[e-1],1e-6)}))}(t),this._times=t,this._values=e},e._insertNewKeyframe=function(t,e){var i=this._times,n=this._values,r=i.length,s=Qh(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},u(t,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),t}();function nu(t){return t>-1e-9&&t<1e-9}ui.fastDefine("cc.KeyframeCurve",iu,{_times:[],_values:[]}),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}($h||($h=t("RealInterpolationMode",{}))),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(tu||(tu=t("ExtrapolationMode",{}))),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(eu||(eu=t("TangentWeightMode",{})));var ru=function(){},su=function(){return ru},au=ou((function(){}));function ou(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function hu(t){return function(e){return function(i){!function(t,e,i){var n=lu(t);if(n){var r=cu(n,"proto");cu(r,"editor")[e]=i}}(i,t,e)}}}var uu="__ccclassCache__";function lu(t){return cu(t,uu)}function cu(t,e){return t[e]||(t[e]={})}var _u=ou((function(t,e){var i=le.getSuper(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[uu];if(r){var s=r.proto;s&&le.mixin(n,s),t[uu]=void 0}return ui(n)})),fu=hu("requireComponent"),du=hu("executionOrder"),pu=au;function mu(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var a,o=s&&(s.get||s.set);r&&(a=Qe(r,o));var h=le.mixin(e,a||r||{});o?(s.get&&(h.get=s.get),s.set&&(h.set=s.set)):yu(t,h,i,n,s)}(function(t){return lu(t.constructor)}(t),function(t,e){var i,n,r=cu(lu(t.constructor),"proto"),s=cu(r,"properties");return null!==(n=s[i=e])&&void 0!==n?n:s[i]={}}(t,e),t.constructor,e,n,i)}return void 0===t?mu({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function gu(t,e,i){var n,r,s=lu(t.constructor),a=cu(s,"proto"),o=cu(a,"properties"),h=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return h.__internalFlags|=$e.STANDALONE,i&&(i.get||i.set)?(i.get&&(h.get=i.get),i.set&&(h.set=i.set)):yu(s,h,t.constructor,e,i),h}function yu(t,e,i,n,r){if(r)r.initializer&&(e.default=function(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}(r.initializer));else{var s=t.default||(t.default=function(t){var e;try{e=new t}catch(t){return{}}return e}(i));s.hasOwnProperty(n)&&(e.default=s[n])}}var vu=Symbol("cc:SerializationMetadata"),Au=function(t,e,i){Tu(gu(t,e,i))};function Su(t){return function(e,i,n){var r=gu(e,i,n);r.formerlySerializedAs=t,Tu(r)}}var bu=function(t,e,i){var n=gu(t,e,i);n.editorOnly=!0,Tu(n)};function Tu(t){t.__internalFlags|=$e.IMPLICIT_SERIALIZABLE}var Eu=ru,Cu=au,wu=su,xu=au,Ru=su,Iu=su,Bu=su,Du=ru,Pu=su,Mu=ru,Ou=su,Fu=su,Nu=su,Lu=su,Vu=su,ku=su,Gu=ru,Uu=su,zu=ru,Hu=ru,Wu=qu(ze),Xu=qu(He),ju=qu(We),Yu=qu(Xe);function qu(t){return mu({type:t})}var Ku=function(t,e,i){gu(t,e,i).override=!0},Ju=function(){},Zu=Object.freeze({__proto__:null,uniquelyReferenced:Eu,ccclass:_u,property:mu,requireComponent:fu,executionOrder:du,disallowMultiple:pu,allowReplicated:function(t){ui.Attr.setClassAttr(t,"replicated","visible",!0)},executeInEditMode:Cu,menu:wu,playOnFocus:xu,inspector:Ru,icon:Iu,help:Bu,type:qu,integer:Wu,float:Xu,boolean:ju,string:Yu});t("_decorator",Zu);var Qu=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=le.createMap(!0),this._count=0)}var e=t.prototype;return e.add=function(t,e){return t in this._map||this._count++,this._map[t]=e},e.get=function(t){return this._map[t]},e.has=function(t){return t in this._map},e.remove=function(t){var e=this._map[t];return t in this._map&&(delete this._map[t],this._count--),e},e.clear=function(){0!==this._count&&(this._map=le.createMap(!0),this._count=0)},e.forEach=function(t){for(var e in this._map)t(this._map[e],e)},e.find=function(t){for(var e in this._map)if(t(this._map[e],e))return this._map[e];return null},e.destroy=function(){this._map=null},u(t,[{key:"count",get:function(){return this._count}}]),t}(),$u=function(){function t(e,i){this.id=t._pipelineId++,this.name="",this.pipes=[],this.name=e;for(var n=0,r=i.length;nthis.pipes.length?(j(4921),this):(this.pipes.splice(e,0,t),this)},e.append=function(t){return this.pipes.push(t),this},e.remove=function(t){return this.pipes.splice(t,1),this},e.sync=function(t){var e=this.pipes;if(0===e.length)return null;t.isFinish=!1;for(var i=0,n=e.length;i>2],dl[pl[n++]]=_l[(3&r)<<2|s>>4],dl[pl[n++]]=_l[15&s]}return t.replace(e,dl.join(""))}var gl=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function yl(t){var e=gl.exec(t);return e?e[1]:""}function vl(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=rl.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),bl(t,e)}function Al(t){return!!t&&(t instanceof C.SceneAsset||t instanceof C.Scene)}function Sl(t){return t&&(46===t.charCodeAt(0)&&47===t.charCodeAt(1)?t=t.slice(2):47===t.charCodeAt(0)&&(t=t.slice(1))),t}function bl(t,e){var i=cl.create({input:t,options:e}),n=[];try{for(var r,s=v(ol.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var h,u=v(i.output);!(h=u()).done;)h.value.recycle();L(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Tl,El,Cl,wl,xl=Object.freeze({__proto__:null,getUuidFromURL:yl,getUrlWithUuid:vl,isScene:Al,normalize:Sl,transform:bl,decodeUuid:ml}),Rl=/(\.[^\.\/\?\\]*)(\?.*)?$/,Il=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,Bl=/[^\.\/]+\/\.\.\//;function Dl(){for(var t="",e=arguments.length,i=new Array(e),n=0;n0&&(t=t.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(t.replace(/(\/|\\)$/,""));if(!n)return t;var r=n[2];return e&&t.substring(t.length-e.length).toLowerCase()===e.toLowerCase()?r.substring(0,r.length-e.length):r}function Fl(t){var e=Il.exec(t);return e?e[2]:""}function Nl(t,e){e=e||"";var i=t.indexOf("?"),n="";return i>0&&(n=t.substring(i),t=t.substring(0,i)),(i=t.lastIndexOf("."))<0?t+e+n:t.substring(0,i)+e+n}function Ll(t,e,i){if(0===e.indexOf("."))return Nl(t,e);var n=t.indexOf("?"),r="",s=i?Pl(t):"";return n>0&&(r=t.substring(n),t=t.substring(0,n)),n=(n=t.lastIndexOf("/"))<=0?0:n+1,t.substring(0,n)+e+s+r}function Vl(t){var e=t=String(t);do{e=t,t=t.replace(Bl,"")}while(e.length!==t.length);return t}function kl(t){return t.replace(/[\/\\]$/,"")}function Gl(){return za.os===La.WINDOWS?"\\":"/"}t("path",Object.freeze({__proto__:null,join:Dl,extname:Pl,mainFileName:Ml,basename:Ol,dirname:Fl,changeExtname:Nl,changeBasename:Ll,_normalize:Vl,stripSep:kl,getSeperator:Gl}));var Ul,zl,Hl,Wl=t("Asset",_u("cc.Asset")((wl=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&this._ref--,t&&C.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(t){t&&(this._uuid=t),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return k(Q(12101,this._uuid)),t.prototype.destroy.call(this)},u(e,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var t=this._native;if(47===t.charCodeAt(0))return t.slice(1);46===t.charCodeAt(0)?this._nativeUrl=vl(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=vl(this._uuid,{__nativeName__:t,nativeExt:Pl(t),isNative:!0})}return this._nativeUrl}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(Pa(Sa)),Cl=S((El=wl).prototype,"_native",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),S(El.prototype,"_nativeAsset",[mu],Object.getOwnPropertyDescriptor(El.prototype,"_nativeAsset"),El.prototype),Tl=El))||Tl);Wl.prototype.createNode=null,C.Asset=Wl;var Xl=t("Script",_u("cc.Script")(Ul=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Wl))||Ul);C._Script=Xl;var jl=t("JavaScript",_u("cc.JavaScript")(zl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Xl))||zl);C._JavaScript=jl;var Yl,ql,Kl,Jl,Zl,Ql,$l,tc,ec,ic,nc,rc,sc,ac=t("TypeScript",_u("cc.TypeScript")(Hl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Xl))||Hl);C._TypeScript=ac;var oc,hc,uc,lc,cc,_c,fc,dc,pc,mc,gc,yc,vc,Ac,Sc,bc=t("EventHandler",(Yl=_u("cc.ClickEvent"),ql=Fu(),Kl=Fu(),Jl=Fu(),Zl=Fu(),Yl((sc=function(){function t(){A(this,"target",tc,this),A(this,"component",ec,this),A(this,"_componentId",ic,this),A(this,"handler",nc,this),A(this,"customEventData",rc,this)}t.emitEvents=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0,1620),i=Number.isNaN(i)?C.macro.REPEAT_FOREVER:i,n=n||0;var r=C.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(t,this,e,i,n,s)},i.scheduleOnce=function(t,e){void 0===e&&(e=0),this.schedule(t,0,0,e)},i.unschedule=function(t){t&&C.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){C.director.getScheduler().unscheduleAllForTarget(this)},u(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Ot(this),e=t.lastIndexOf(".");return e>=0&&(t=t.slice(e+1)),this.node?this.node.name+"<"+t+">":t},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(t){if(this._enabled!==t&&(this._enabled=t,this.node.activeInHierarchy)){var e=C.director._compScheduler;t?e.enableComp(this):e.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&Ec}}]),e}(Sa),mc.EventHandler=bc,mc.system=null,S((_c=gc).prototype,"__scriptAsset",[hc,uc,lc,Hu],Object.getOwnPropertyDescriptor(_c.prototype,"__scriptAsset"),_c.prototype),fc=S(_c.prototype,"node",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),dc=S(_c.prototype,"_enabled",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),pc=S(_c.prototype,"__prefab",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cc=_c))||cc)),wc=Cc.prototype;wc.update=null,wc.lateUpdate=null,wc.__preload=null,wc.onLoad=null,wc.start=null,wc.onEnable=null,wc.onDisable=null,wc.onDestroy=null,wc.onFocusInEditor=null,wc.onLostFocusInEditor=null,wc.resetInEditor=null,wc._getLocalBounds=null,wc.onRestore=null,Cc._requireComponent=null,Cc._executionOrder=0,It(Cc,"_registerEditorProps",(function(t,e){var i=e.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),t._requireComponent=i);var n=e.executionOrder;n&&"number"==typeof n&&(t._executionOrder=n)})),C.Component=Cc;var xc=t("MissingScript",_u("cc.MissingScript")(yc=Ru()((Sc=function(t){function e(){var e;return A(e=t.call(this)||this,"_$erialized",Ac,g(e)),e}return c(e,t),e.safeFindClass=function(t){var e=re(t);if(e)return e;C.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){j(4600,this.node.name)},e}(Cc),Ac=S((vc=Sc).prototype,"_$erialized",[Au,bu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),yc=vc))||yc)||yc);C._MissingScript=xc;try{var Rc=xc.__values__;0!==Rc.length&&"_$erialized"===Rc[Rc.length-1]||(L("The '_$erialized' prop in MissingScript is missing. Please contact jare."),L(" Error props: ['"+Rc+"']"))}catch(ao){L("Error when checking MissingScript 5, "+ao)}var Ic=t("serializeTag",Symbol("[[Serialize]]")),Bc=t("deserializeTag",Symbol("[[Deserialize]]")),Dc=function(){function t(t,e){this._document=void 0,this._chunks=void 0,this._document=t,this._chunks=e}return u(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function Pc(t){var e=t;return{chunks:e.chunks,document:e.document}}function Mc(t){if(t.length<16)throw new Oc(Q(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Oc(Q(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Oc(Q(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Oc(Q(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var a,o=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(Q(13104))}(s);try{a=JSON.parse(o)}catch(t){throw new Oc(t)}for(var h=[];n0&&(t.chunks.length,this._mainBinChunk=t.chunks[0])):e=t,this._serializedData=e,this._context={fromCCON:i};var n=Array.isArray(e)?e[0]:e;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},e._deserializeObject=function(t,e,i,n){switch(t.__type__){case"TypedArray":return this._deserializeTypedArrayView(t);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(t);default:return t.__type__?this._deserializeTypeTaggedObject(t,e,i,n):Array.isArray(t)?this._deserializeArray(t):this._deserializePlainObject(t)}},e._deserializeTypedArrayView=function(t){return globalThis[t.ctor].from(t.array)},e._deserializeTypedArrayViewRef=function(t){var e=t.offset,i=t.length,n=t.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+e,i)},e._deserializeArray=function(t){for(var e,i=new Array(t.length),n=0;n=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[Bc]?e._deserialize?e._deserialize(t.content,this):C.Class._isCCClass(i)?this._deserializeFireClass(e,t,i):this._deserializeFastDefinedObject(e,t,i):this._runCustomizedDeserialize(t,e,i)},e._runCustomizedDeserialize=function(t,e,i){var n=this,r={readProperty:function(e){var i=t[e];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(t,e,i,!0)},readSuper:function(){var r=jt(i);r&&n._deserializeInto(t,e,r)}};e[Bc](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){for(var i=ke(e),n=e.__values__,r=["var prop;"],s=Se.test(oe(e)),a=0;a=0?e[i]=t[5][n]:t[7][3*~n]=e}function Yc(t){return function(e,i,n,r){i[n]=r;for(var s=0;s=0){var c=o[u];e[a]=Xc(t,c,l)}else(0,Jc[u=~u])(t,e,a,l)}return r}(t);C.game._isCloning=!1,t[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r=0?a[i[h]]=o:a[~h]=o}for(;r=0?u[i[c]]=l:u[~c]=l}}(t[7],h,t[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o=0?i[u]:~u,s[o]=u);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}(t),n=h[u]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||re,s=i.createAssetRefs||Ja.platform===Va.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,h=null!==(n=i.reportMissingClass)&&void 0!==n?n:C.deserialize.reportMissingClass;e.init();var u=kc.pool.get(e,r,h,a,o);C.game._isCloning=!0;var l=u.deserialize(t);return C.game._isCloning=!1,kc.pool.put(u),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&Hc.pool.put(e),n}Jc[0]=function(t,e,i,n){e[i]=n},Jc[1]=jc,Jc[2]=Yc(jc),Jc[3]=Yc(qc),Jc[4]=Kc,Jc[5]=function(t,e,i,n){zc[n[0]](e[i],n)},Jc[6]=qc,Jc[7]=function(t,e,i,n){e[i].set(n)},Jc[8]=function(t,e,i,n){var r=new Gc[n[0]];zc[n[0]](r,n),e[i]=r},Jc[9]=Yc(Kc),Jc[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=Xc(t,r,n[1])},Jc[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s>3},n=i.storageUnit,r=T_(i.elementType),s=new(E_(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:t*t*(3-2*t)}function af(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}C._decorator=Zu;var of=gf(R_,I_),hf=gf(D_,P_),uf=gf(O_,F_),lf=gf(L_,V_),cf=gf(G_,U_),_f=gf(H_,W_),ff=gf(j_,Y_),df=gf(K_,J_),pf=gf(Q_,$_),mf=gf(ef,nf);function gf(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var yf,vf,Af=Object.freeze({__proto__:null,constant:w_,linear:x_,quadIn:R_,quadOut:I_,quadInOut:B_,cubicIn:D_,cubicOut:P_,cubicInOut:M_,quartIn:O_,quartOut:F_,quartInOut:N_,quintIn:L_,quintOut:V_,quintInOut:k_,sineIn:G_,sineOut:U_,sineInOut:z_,expoIn:H_,expoOut:W_,expoInOut:X_,circIn:j_,circOut:Y_,circInOut:q_,elasticIn:K_,elasticOut:J_,elasticInOut:Z_,backIn:Q_,backOut:$_,backInOut:tf,bounceIn:ef,bounceOut:nf,bounceInOut:rf,smooth:sf,fade:af,quadOutIn:of,cubicOutIn:hf,quartOutIn:uf,quintOutIn:lf,sineOutIn:cf,expoOutIn:_f,circOutIn:ff,elasticOutIn:df,backOutIn:pf,bounceOutIn:mf});t("easing",Af),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.QUAD_IN=2]="QUAD_IN",t[t.QUAD_OUT=3]="QUAD_OUT",t[t.QUAD_IN_OUT=4]="QUAD_IN_OUT",t[t.QUAD_OUT_IN=5]="QUAD_OUT_IN",t[t.CUBIC_IN=6]="CUBIC_IN",t[t.CUBIC_OUT=7]="CUBIC_OUT",t[t.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",t[t.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",t[t.QUART_IN=10]="QUART_IN",t[t.QUART_OUT=11]="QUART_OUT",t[t.QUART_IN_OUT=12]="QUART_IN_OUT",t[t.QUART_OUT_IN=13]="QUART_OUT_IN",t[t.QUINT_IN=14]="QUINT_IN",t[t.QUINT_OUT=15]="QUINT_OUT",t[t.QUINT_IN_OUT=16]="QUINT_IN_OUT",t[t.QUINT_OUT_IN=17]="QUINT_OUT_IN",t[t.SINE_IN=18]="SINE_IN",t[t.SINE_OUT=19]="SINE_OUT",t[t.SINE_IN_OUT=20]="SINE_IN_OUT",t[t.SINE_OUT_IN=21]="SINE_OUT_IN",t[t.EXPO_IN=22]="EXPO_IN",t[t.EXPO_OUT=23]="EXPO_OUT",t[t.EXPO_IN_OUT=24]="EXPO_IN_OUT",t[t.EXPO_OUT_IN=25]="EXPO_OUT_IN",t[t.CIRC_IN=26]="CIRC_IN",t[t.CIRC_OUT=27]="CIRC_OUT",t[t.CIRC_IN_OUT=28]="CIRC_IN_OUT",t[t.CIRC_OUT_IN=29]="CIRC_OUT_IN",t[t.ELASTIC_IN=30]="ELASTIC_IN",t[t.ELASTIC_OUT=31]="ELASTIC_OUT",t[t.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",t[t.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",t[t.BACK_IN=34]="BACK_IN",t[t.BACK_OUT=35]="BACK_OUT",t[t.BACK_IN_OUT=36]="BACK_IN_OUT",t[t.BACK_OUT_IN=37]="BACK_OUT_IN",t[t.BOUNCE_IN=38]="BOUNCE_IN",t[t.BOUNCE_OUT=39]="BOUNCE_OUT",t[t.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",t[t.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",t[t.SMOOTH=42]="SMOOTH",t[t.FADE=43]="FADE"}(vf||(vf={}));var Sf,bf=((yf={})[vf.CONSTANT]=w_,yf[vf.LINEAR]=x_,yf[vf.QUAD_IN]=R_,yf[vf.QUAD_OUT]=I_,yf[vf.QUAD_IN_OUT]=B_,yf[vf.QUAD_OUT_IN]=of,yf[vf.CUBIC_IN]=D_,yf[vf.CUBIC_OUT]=P_,yf[vf.CUBIC_IN_OUT]=M_,yf[vf.CUBIC_OUT_IN]=hf,yf[vf.QUART_IN]=O_,yf[vf.QUART_OUT]=F_,yf[vf.QUART_IN_OUT]=N_,yf[vf.QUART_OUT_IN]=uf,yf[vf.QUINT_IN]=L_,yf[vf.QUINT_OUT]=V_,yf[vf.QUINT_IN_OUT]=k_,yf[vf.QUINT_OUT_IN]=lf,yf[vf.SINE_IN]=G_,yf[vf.SINE_OUT]=U_,yf[vf.SINE_IN_OUT]=z_,yf[vf.SINE_OUT_IN]=cf,yf[vf.EXPO_IN]=H_,yf[vf.EXPO_OUT]=W_,yf[vf.EXPO_IN_OUT]=X_,yf[vf.EXPO_OUT_IN]=_f,yf[vf.CIRC_IN]=j_,yf[vf.CIRC_OUT]=Y_,yf[vf.CIRC_IN_OUT]=q_,yf[vf.CIRC_OUT_IN]=ff,yf[vf.ELASTIC_IN]=K_,yf[vf.ELASTIC_OUT]=J_,yf[vf.ELASTIC_IN_OUT]=Z_,yf[vf.ELASTIC_OUT_IN]=df,yf[vf.BACK_IN]=Q_,yf[vf.BACK_OUT]=$_,yf[vf.BACK_IN_OUT]=tf,yf[vf.BACK_OUT_IN]=pf,yf[vf.BOUNCE_IN]=ef,yf[vf.BOUNCE_OUT]=nf,yf[vf.BOUNCE_IN_OUT]=rf,yf[vf.BOUNCE_OUT_IN]=mf,yf[vf.SMOOTH]=sf,yf[vf.FADE]=af,yf);function Tf(t){return bf[t]}n(255),n(65280);var Ef,Cf,wf,xf=$h.LINEAR<<0|eu.NONE<<8|vf.LINEAR<<16,Rf=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>0},set:function(t){this._flags&=-256,this._flags|=t<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(Ju);function If(t){var e=new Rf;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,h=t.leftTangentWeight,u=t.easingMethod,l=t[ya];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=h?h:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=u?u:e.easingMethod,l&&(e[ya]=l)}return e}ui.fastDefine("cc.RealKeyframeValue",Rf,((Sf={interpolationMode:$h.LINEAR,tangentWeightMode:eu.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:vf.LINEAR})[ya]=void 0,Sf)),ui.Attr.setClassAttr(Rf,ya,"editorOnly",!0),(Ef=Rf,null!==(wf=(Cf=Ef)[vu])&&void 0!==wf?wf:Cf[vu]={}).uniquelyReferenced=!0;var Bf,Df=t("RealCurve",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rs){var h=this.postExtrapolation,u=i[n-1];if(h===tu.CLAMP||n<2)return u.value;switch(h){case tu.LINEAR:return Yf(s,u.value,e[n-2],i[n-2].value,t);case tu.LOOP:t=Xf(t,r,s);break;case tu.PING_PONG:t=jf(t,r,s);break;default:return u.value}}var l=Qh(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,f=e[_],d=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case $h.CONSTANT:return e.value;case $h.LINEAR:var a=e.easingMethod===vf.LINEAR?r:Tf(e.easingMethod)(r);return Ai(e.value,n.value,a);case $h.CUBIC:var o=1/3,h=e.rightTangent,u=e.rightTangentWeight,l=0!=(e.tangentWeightMode&eu.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&eu.LEFT);if(l||f){var d=0;if(l)d=u;else{var p=s,m=s*h;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(h),y=Math.cos(g)*d+t,v=Math.sin(g)*d+e.value,A=0;if(f)A=_;else{var S=s,b=s*c;A=Math.sqrt(S*S+b*b)*o}var T=Math.atan(c),E=(y-t)/s,C=(-Math.cos(T)*A+i-t)/s,w=v,x=-Math.sin(T)*A+n.value,R=[0,0,0],I=function(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,h=1/3*(-1/3*o+a),u=.5*(2/27*s*o-1/3*s*a+t/n),l=h*h*h,c=u*u+l,_=0;if(nu(c)){if(nu(u))return r[0]=0,1;var f=Math.cbrt(-u);return r[0]=2*f,r[1]=-f,2}if(c<0){var d=1/3*Math.acos(-u/Math.sqrt(-l)),p=2*Math.sqrt(-h);r[0]=p*Math.cos(d),r[1]=-p*Math.cos(d+Math.PI/3),r[2]=-p*Math.cos(d-Math.PI/3),_=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-u),y=-Math.cbrt(m+u);r[0]=g+y,_=1}for(var v=1/3*s,A=0;A<_;++A)r[A]-=v;return _}(0-r,3*E,3*C-6*E,3*(E-C)+1,R),B=function(t,e,i){var n=i;if(1===e)n=t[0];else{n=-1/0;for(var r=0;r=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(R,I,r);return qf(e.value,w,x,n.value,B)}var D=e.value+o*h*s,P=n.value-o*c*s;return qf(e.value,D,P,n.value,r)}}(f,d,p,i[c],(t-f)/(p-f))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,If(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return If(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return If(t[1])})))}},i.isConstant=function(t){if(this._values.length<=1)return!0;var e=this._values[0].value;return this._values.every((function(i){return gi(i.value,e,t)}))},i[Ic]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Pf+Pf+Mf+Of*r+zf*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Pf,s.setUint8(a,this.postExtrapolation),a+=Pf,s.setUint32(a,r,!0),a+=Mf,i.forEach((function(t,e){return s.setFloat32(a+Of*e,t,!0)})),a+=Of*r;for(var o,h=v(n);!(o=h()).done;){var u=o.value;a=Hf(s,u,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[ya]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[Bc]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=Pf,this.postExtrapolation=n.getUint8(r),r+=Pf;var s=n.getUint32(r,!0);r+=Mf;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+Of*e,!0)}));r+=Of*s;for(var o=new Array(s),h=0;h>8;return e.easingMethod=s,n}function Xf(t,e,i){return e+Bi(t-e,i-e)}function jf(t,e,i){return e+Di(t-e,i-e)}function Yf(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function qf(t,e,i,n,r){var s=1-r;return s*s*s*t+3*s*s*r*e+3*s*r*r*i+r*r*r*n}function Kf(t,e,i,n,r){var s=1-r;return s*(s*(t+(3*e-t)*r)+3*i*r*r)+n*r*r*r}C.bezier=Kf;var Jf,Zf,Qf,$f,td,ed,id,nd,rd,sd,ad,od=Math.cos,hd=Math.acos,ud=Math.max,ld=2*Math.PI,cd=Math.sqrt;function _d(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function fd(t,e){var i=function(t,e){var i,n,r,s,a=e-0,o=e-t[0],h=3*a,u=3*o,l=3*(e-t[2]),c=1/(-a+u-l+(e-1)),_=1/3,f=(h-6*o+l)*c,d=f*_,p=(-h+u)*c,m=(3*p-f*f)*_,g=m*_,y=(2*f*f*f-9*f*p+a*c*27)/27,v=y/2,A=v*v+g*g*g;if(A<0){var S=-m*_,b=cd(S*S*S),T=-y/(2*b),E=hd(T<-1?-1:T>1?1:T),C=2*_d(b);return n=C*od(E*_)-d,r=C*od((E+ld)*_)-d,s=C*od((E+2*ld)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?ud(n,r,s):ud(n,r):s>=0&&s<=1?ud(n,s):n:r>=0&&r<=1?s>=0&&s<=1?ud(r,s):r:s}if(0===A)return r=-(i=v<0?_d(-v):-_d(v))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?ud(n,r):n:r;var w=cd(A);return(i=_d(-v+w))-_d(v+w)-d}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}C.bezierByTime=fd,function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(ad||(ad=t("QuatInterpolationMode",{})));var dd=_u("cc.QuatKeyframeValue")(Jf=Eu((Qf=S((Zf=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;A(this,"interpolationMode",Qf,this),A(this,"value",$f,this),A(this,"easingMethod",td,this),this.value=i?$i.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod}).prototype,"interpolationMode",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ad.SLERP}}),$f=S(Zf.prototype,"value",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return $i.clone($i.IDENTITY)}}),td=S(Zf.prototype,"easingMethod",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return vf.LINEAR}}),Jf=Zf))||Jf)||Jf;function pd(t){return new dd(t)}var md,gd=t("QuatCurve",_u("cc.QuatCurve")((sd=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru){var c=r[o-1];switch(s){case tu.LOOP:t=h+Bi(t-h,u-h);break;case tu.PING_PONG:t=h+Di(t-h,u-h);break;case tu.CLAMP:default:return $i.copy(e,c.value)}}var _=Qh(n,t);if(_>=0)return $i.copy(e,r[_].value);var f=~_,d=f-1,p=n[d],m=r[d],g=n[f],y=r[f],v=(t-p)/(g-p);switch(m.interpolationMode){default:case ad.CONSTANT:return $i.copy(e,m.value);case ad.SLERP:var A=m.easingMethod,S=A===vf.LINEAR?v:Array.isArray(A)?fd(A,v):Tf(A)(v);return $i.slerp(e,m.value,y.value,S)}},i.addKeyFrame=function(e,i){var n=new dd(i);return t.prototype.addKeyFrame.call(this,e,n)},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return pd(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return pd(t[1])})))}},i[Ic]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=Td*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Ed+4*wd:Ed)}),0),h=0,u=new DataView(new ArrayBuffer(h+=vd+Ad+Sd*s+4*bd*s+o+a+0)),l=0,c=0;r&&(c|=md.INTERPOLATION_MODE),u.setUint32(l,c,!0),l+=vd,u.setUint32(l,s,!0),l+=Ad,i.forEach((function(t,e){return u.setFloat32(l+Sd*e,t,!0)})),l+=Sd*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*bd*e;u.setFloat32(o+0*bd,n,!0),u.setFloat32(o+1*bd,r,!0),u.setFloat32(o+2*bd,s,!0),u.setFloat32(o+3*bd,a,!0)})),l+=4*bd*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(u.setUint8(l,Cd),++l,u.setFloat32(l+0*wd,e[0],!0),u.setFloat32(l+1*wd,e[1],!0),u.setFloat32(l+2*wd,e[2],!0),u.setFloat32(l+3*wd,e[3],!0),l+=4*wd):(u.setUint8(l,e),++l)}));var _=l;l+=a;var f=_;n.forEach((function(t){var e=t.interpolationMode;u.setUint8(f,e),r||(f+=Td)}));var d=new Uint8Array(u.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[Bc]=function(t,e){if(e.fromCCON){var i=t.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=vd;var a=s&md.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Ad;var h=Array.from({length:o},(function(t,e){return n.getFloat32(r+Sd*e,!0)})),u=r+=Sd*o;r+=4*bd*o;var l=Array.from({length:o},(function(t,e){var i=u+4*bd*e,s=n.getFloat32(i+0*bd,!0),a=n.getFloat32(i+1*bd,!0),o=n.getFloat32(i+2*bd,!0),h=n.getFloat32(i+3*bd,!0),l=n.getUint8(r);++r;var c=pd({value:{x:s,y:a,z:o,w:h}});return l!==Cd?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*wd,!0),n.getFloat32(r+1*wd,!0),n.getFloat32(r+2*wd,!0),n.getFloat32(r+3*wd,!0)],r+=4*wd),c}));if(a){var c=n.getUint8(r);++r;for(var _=0;_=0)return this._values[e];var i=yi(~e-1,0,this._values.length-1);return this._values[i]},e}(iu))||yd),Rd=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};ui.fastDefine("cc.Keyframe",Rd,{time:0,value:0,inTangent:0,outTangent:0});var Id,Bd=function(){function t(){this.index=void 0,this.time=void 0,this.endTime=void 0,this.coefficient=void 0,this.index=-1,this.time=0,this.endTime=0,this.coefficient=new Float32Array(4)}return t.prototype.evaluate=function(t){return e=t-this.time,i=this.coefficient,e*(e*(e*i[0]+i[1])+i[2])+i[3];var e,i},t}(),Dd=function(){function t(t){if(void 0===t&&(t=null),this.cachedKey=void 0,t instanceof Df)this._curve=t;else{var e=new Df;this._curve=e,e.preExtrapolation=tu.LOOP,e.postExtrapolation=tu.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:$h.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:$h.CUBIC,value:1}],[1,{interpolationMode:$h.CUBIC,value:1}]])}this.cachedKey=new Bd}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:$h.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case tu.LOOP:r=Bi(t-a,o-a)+a;break;case tu.PING_PONG:r=Di(t-a,o-a)+a;break;case tu.CLAMP:default:r=yi(t,a,o)}if(r>=e.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1e)return a}else for(var o=0;o<3;o++){var h=r-o;if(h>=0&&i.getKeyframeTime(h-1)<=e)return h-1}for(var u,l=0,c=n;c-l>1;)u=Math.floor((l+c)/2),i.getKeyframeTime(u)>=e?c=u:l=u;return l},u(t,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(t){var e=t[0],i=t[1],n=new Rd;return n.time=e,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(t){this._curve.assignSorted(t.map((function(t){return[t.time,{interpolationMode:$h.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Md(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=Pd(t)}},{key:"postWrapMode",get:function(){return Md(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=Pd(t)}}]),t}();function Pd(t){switch(t){default:case Wh.Default:case Wh.Normal:case Wh.Clamp:return tu.CLAMP;case Wh.PingPong:return tu.PING_PONG;case Wh.Loop:return tu.LOOP}}function Md(t){switch(t){default:case tu.LINEAR:case tu.CLAMP:return Wh.Clamp;case tu.PING_PONG:return Wh.PingPong;case tu.LOOP:return Wh.Loop}}Dd.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],ui.fastDefine("cc.AnimationCurve",Dd,{_curve:null}),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Id||(Id={}));var Od=4294967295,Fd=new ji,Nd=new ji,Ld=new ji,Vd=new ji,kd=function(){function t(t,e){void 0===t&&(t=Id.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Id.CATMULL_ROM,this._knots=[],this._type=co.SHAPE_SPLINE,this._mode=t;for(var i=0;i=this._knots.length?this._knots.push(i):this._knots.splice(t,0,i)},e.removeKnot=function(t){t>=0&&this._knots.length,this._knots.splice(t,1)},e.setKnot=function(t,e){t>=0&&this._knots.length,this._knots[t].set(e)},e.getKnot=function(t){return t>=0&&this._knots.length,this._knots[t]},e.getPoint=function(e,i){void 0===i&&(i=Od),e=yi(e,0,1);var n=this.getSegments();if(0==n)return new ji(0,0,0);if(i==Od){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new ji(this._knots[this._knots.length-1]);switch(this._mode){case Id.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Id.BEZIER:return t.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],e);case Id.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+219||i<0)console.warn("maximum layers reached.");else{var n=1<19||e<0)console.warn("do not change buildin layers.");else{var i=1<31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<>>26},xm=function(t){return(t&Tm)>>>20},Rm=function(t){return(t&Em)>>>12},Im=function(t){return 4095&t},Bm=function(t,e){return 67108863&t|e<<26&bm},Dm=((mm={})[Dn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},mm[Dn.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mm[Dn.INT2]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},mm[Dn.INT3]=function(t,e,i){return void 0===i&&(i=0),ji.fromArray(e,t,i)},mm[Dn.INT4]=function(t,e,i){return void 0===i&&(i=0),Ni.fromArray(e,t,i)},mm[Dn.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mm[Dn.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},mm[Dn.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),ji.fromArray(e,t,i)},mm[Dn.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),Ni.fromArray(e,t,i)},mm[Dn.MAT3]=function(t,e,i){return void 0===i&&(i=0),Ji.fromArray(e,t,i)},mm[Dn.MAT4]=function(t,e,i){return void 0===i&&(i=0),hn.fromArray(e,t,i)},mm),Pm=((gm={})[Dn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},gm[Dn.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gm[Dn.INT2]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},gm[Dn.INT3]=function(t,e,i){return void 0===i&&(i=0),ji.toArray(t,e,i)},gm[Dn.INT4]=function(t,e,i){return void 0===i&&(i=0),Ni.toArray(t,e,i)},gm[Dn.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gm[Dn.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},gm[Dn.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),ji.toArray(t,e,i)},gm[Dn.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),Ni.toArray(t,e,i)},gm[Dn.MAT3]=function(t,e,i){return void 0===i&&(i=0),Ji.toArray(t,e,i)},gm[Dn.MAT4]=function(t,e,i){return void 0===i&&(i=0),hn.toArray(t,e,i)},gm),Mm=[Object.freeze([0]),Object.freeze([0,0]),Object.freeze([0,0,0,0]),Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])];function Om(t){switch(t){case Dn.BOOL:case Dn.INT:case Dn.UINT:case Dn.FLOAT:return Mm[0];case Dn.BOOL2:case Dn.INT2:case Dn.UINT2:case Dn.FLOAT2:return Mm[1];case Dn.BOOL4:case Dn.INT4:case Dn.UINT4:case Dn.FLOAT4:return Mm[2];case Dn.MAT4:return Mm[3];case Dn.SAMPLER2D:return"default-texture";case Dn.SAMPLER_CUBE:return"default-cube-texture";case Dn.SAMPLER2D_ARRAY:return"default-array-texture";case Dn.SAMPLER3D:return"default-3d-texture"}return Mm[0]}function Fm(t){switch(t){case Dn.SAMPLER2D:return"-texture";case Dn.SAMPLER_CUBE:return"-cube-texture";case Dn.SAMPLER2D_ARRAY:return"-array-texture";case Dn.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Nm(t,e){for(var i=Object.entries(e),n=!1,r=0;r31&&(i.uber=!0),i.constantMacros="",i.builtins.statistics)i.constantMacros+="#define "+a+" "+i.builtins.statistics[a]+"\n";if(this._templates[t.name]=i,!this._templateInfos[i.hash]){var o={};o.samplerStartBinding=i.blocks.length,o.shaderInfo=new $r,o.blockSizes=[],o.bindings=[];for(var h=0;h>2)*o.count}for(var h=0;h0&&this.shaders.length>0},e}(Wl),Jm._effects={},Jm._layoutValid=!0,jm=S((Xm=Zm).prototype,"techniques",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ym=S(Xm.prototype,"shaders",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qm=S(Xm.prototype,"combinations",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Km=S(Xm.prototype,"hideInEditor",[Au,bu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Wm=Xm))||Wm);C.EffectAsset=tg;var eg,ig,ng,rg,sg,ag,og,hg,ug,lg,cg,_g,fg,dg,pg;!function(t){t[t.RGB565=In.R5G6B5]="RGB565",t[t.RGB5A1=In.RGB5A1]="RGB5A1",t[t.RGBA4444=In.RGBA4]="RGBA4444",t[t.RGB888=In.RGB8]="RGB888",t[t.RGB32F=In.RGB32F]="RGB32F",t[t.RGBA8888=In.RGBA8]="RGBA8888",t[t.RGBA32F=In.RGBA32F]="RGBA32F",t[t.A8=In.A8]="A8",t[t.I8=In.L8]="I8",t[t.AI8=In.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=In.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=In.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=In.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=In.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=In.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=In.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=In.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=In.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=In.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=In.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=In.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=In.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=In.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=In.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=In.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=In.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=In.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=In.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=In.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=In.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=In.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(eg||(eg={})),function(t){t[t.REPEAT=Hn.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=Hn.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=Hn.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=Hn.BORDER]="CLAMP_TO_BORDER"}(ig||(ig={})),function(t){t[t.NONE=zn.NONE]="NONE",t[t.LINEAR=zn.LINEAR]="LINEAR",t[t.NEAREST=zn.POINT]="NEAREST"}(ng||(ng={})),pe(In);var mg,gg,yg,vg,Ag=new St("Tex"),Sg=_u("cc.TextureBase")((pg=dg=function(t){function e(){var e;return A(e=t.call(this)||this,"_format",ag,g(e)),A(e,"_minFilter",og,g(e)),A(e,"_magFilter",hg,g(e)),A(e,"_mipFilter",ug,g(e)),A(e,"_wrapS",lg,g(e)),A(e,"_wrapT",cg,g(e)),A(e,"_wrapR",_g,g(e)),A(e,"_anisotropy",fg,g(e)),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new zr,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=Ag.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=Hs(e._id,666),e}c(e,t);var i=e.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(t,e,i){void 0===i&&(i=t),this._wrapS=t,this._samplerInfo.addressU=t,this._wrapT=e,this._samplerInfo.addressV=e,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(t,e){this._minFilter=t,this._samplerInfo.minFilter=t,this._magFilter=e,this._samplerInfo.magFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(t){this._mipFilter=t,this._samplerInfo.mipFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(t){this._anisotropy=t,this._samplerInfo.maxAnisotropy=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var e,i=t.prototype.destroy.call(this);return i&&(null===(e=C.director.root)||void 0===e?void 0:e.batcher2D)&&C.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):q(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(t){var e=t.split(",");e.unshift(""),e.length>=5&&(this.setFilters(parseInt(e[1]),parseInt(e[2])),this.setWrapMode(parseInt(e[3]),parseInt(e[4]))),e.length>=7&&(this.setMipFilter(parseInt(e[5])),this.setAnisotropy(parseInt(e[6])))},i._getGFXDevice=function(){return Qa.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?eg.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===eg.RGBA_ETC1?t=eg.RGB_ETC1:t===eg.RGB_A_PVRTC_4BPPV1?t=eg.RGB_PVRTC_4BPPV1:t===eg.RGB_A_PVRTC_2BPPV1&&(t=eg.RGB_PVRTC_2BPPV1),t},u(e,[{key:"isCompressed",get:function(){return this._format>=eg.RGB_ETC1&&this._format<=eg.RGBA_ASTC_12x12||this._format>=eg.RGB_A_PVRTC_2BPPV1&&this._format<=eg.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(Wl),dg.PixelFormat=eg,dg.WrapMode=ig,dg.Filter=ng,ag=S((sg=pg).prototype,"_format",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return eg.RGBA8888}}),og=S(sg.prototype,"_minFilter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.LINEAR}}),hg=S(sg.prototype,"_magFilter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.LINEAR}}),ug=S(sg.prototype,"_mipFilter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.NONE}}),lg=S(sg.prototype,"_wrapS",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),cg=S(sg.prototype,"_wrapT",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),_g=S(sg.prototype,"_wrapR",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),fg=S(sg.prototype,"_anisotropy",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),rg=sg))||rg;function bg(t){return!!(Ja.hasFeature(Ja.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}C.TextureBase=Sg;var Tg=t("ImageAsset",_u("cc.ImageAsset")((vg=yg=function(t){function e(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=eg.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1},void 0!==e&&i.reset(e),i}c(e,t);var i=e.prototype;return i.reset=function(t){bg(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},i.destroy=function(){return this.data&&this.data instanceof HTMLImageElement?(this.data.src="",this._setRawAsset("")):bg(this.data)&&this.data.close&&this.data.close(),t.prototype.destroy.call(this)},i._serialize=function(){},i._deserialize=function(t){var i="";"string"==typeof t?i=t:(this._width=t.w,this._height=t.h,i=t.fmt);for(var n,r=Qa.gfxDevice,s=i.split("_"),a=Number.MAX_VALUE,o=this._format,h="",u=Ae.SUPPORT_TEXTURE_FORMATS,l=v(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),f=e.extnames[_]||c[0],d=u.indexOf(f);if(-1!==d&&d=eg.RGB_ETC1&&this._format<=eg.RGBA_ASTC_12x12||this._format>=eg.RGB_A_PVRTC_2BPPV1&&this._format<=eg.RGBA_ETC1}},{key:"url",get:function(){return this.nativeUrl}}]),e}(Wl),yg.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],yg._sharedPlaceHolderCanvas=null,S((gg=vg).prototype,"_nativeAsset",[Ku],Object.getOwnPropertyDescriptor(gg.prototype,"_nativeAsset"),gg.prototype),mg=gg))||mg);C.ImageAsset=Tg;var Eg=new WeakMap,Cg=new WeakSet,wg=new WeakSet;function xg(t,e){var i;i=xc.safeFindClass;var n,r=Hc.pool.get();try{n=e_(t,r,{classFinder:i,customEnv:e})}catch(t){throw L(t),Hc.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,h=r.uuidTypeList||[],u=[],l=0;l>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,Bg):n.copyTexImagesToTexture([t],this._gfxTexture,Bg)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ae.CLEANUP_IMAGE_CACHE)){var r=Ig.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(gt(r,s),t.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(t){this._mipmapLevel=t<1?1:t},i._setMipRange=function(t,e){this._baseLevel=t<1?0:t,this._maxLevel=e<1?0:e},i.setMipRange=function(t,e){Z(t<=e,3124),this._setMipRange(t,e);var i=this._getGFXDevice();if(i){var n=this._createTextureView(i);this._tryDestroyTextureView(),this._gfxTextureView=n}},i._getGfxTextureCreateInfo=function(){return null},i._getGfxTextureViewCreateInfo=function(){return null},i._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var t=this._getGFXDevice();t&&(this._createTexture(t),this._gfxTextureView=this._createTextureView(t))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(t){if(0!==this._width&&0!==this._height){var e=Vn.NONE;this._mipFilter!==ng.NONE&&function(t,e,i){return!(t.gfxAPI===wn.WEBGL)||Dg(e)&&Dg(i)}(t,this._width,this._height)&&(this._mipmapLevel=function(t,e){for(var i=Math.max(t,e),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||(e=Vn.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Ln.SAMPLED|Ln.TRANSFER_DST,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel=this._mipmaps.length))for(var i=Math.min(void 0===e?this._mipmaps.length:e,this._mipmaps.length-t),n=0;n"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(e,i){var n=e;t.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r0){var i=this._mipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._mipmaps.forEach((function(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(Vg),Ng=S((Fg=Lg).prototype,"_mipmaps",[Mg],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Og=Fg))||Og));C.Texture2D=Kg,function(t){t[t.right=0]="right",t[t.left=1]="left",t[t.top=2]="top",t[t.bottom=3]="bottom",t[t.front=4]="front",t[t.back=5]="back"}(Yg||(Yg={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(qg||(qg={}));var Jg=t("TextureCube",_u("cc.TextureCube")((jg=Xg=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._mipmaps.length))for(var n=Math.min(void 0===e?this._mipmaps.length:e,this._mipmaps.length-t),r=function(e){var n=t+e;Zg(i._mipmaps[n],(function(t,e){i._assignImage(t,n,e)}))},s=0;s0){var i=this._mipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._mipmaps.forEach((function(t,i){Zg(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(t){var e=this;if(this._mipmapAtlas=t,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(t){var s=r[t];Zg(n,(function(t,n){a.clearRect(0,0,i.width,i.height);var r=t.data;a.drawImage(r,0,0);var o=a.getImageData(s.left,s.top,s.width,s.height),h=new Tg({_data:o.data,_compressed:t.isCompressed,width:o.width,height:o.height,format:t.format});e._assignImage(h,s.level,n)}))},h=0;he.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,a=i.length;s0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,iy(t,e,ny,-1),ny.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&iy(el.get(i),e,ny,1);return ny.length=0,e[t._uuid]}(t)>0)){el.remove(i);for(var n=Ig.getDeps(i),r=0,s=n.length;rthis._maxInterval?this._maxInterval:e;t-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=t)},e._handleQueue=function(t,e){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum0&&(Be(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},u(t,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}]),t}()),Gy=t("JsonAsset",_u("cc.JsonAsset")((Cy=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){var a=cl.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:cl.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&tv(t),e(n)}});al.async(a)}else i&&tv(t),e()}))}function tv(t){for(var e=t.output,i=0,n=e.length;i6||h<3||h>6||u<3||u>6)&&(o<4||7===o||9===o||11===o||o>12||h<4||7===h||9===h||11===h||h>12||1!==u))throw new Error("Invalid block number in ASTC header");var l=function(t,e){return 4===t?eg.RGBA_ASTC_4x4:5===t?4===e?eg.RGBA_ASTC_5x4:eg.RGBA_ASTC_5x5:6===t?5===e?eg.RGBA_ASTC_6x5:eg.RGBA_ASTC_6x6:8===t?5===e?eg.RGBA_ASTC_8x5:6===e?eg.RGBA_ASTC_8x6:eg.RGBA_ASTC_8x8:10===t?5===e?eg.RGBA_ASTC_10x5:6===e?eg.RGBA_ASTC_10x6:8===e?eg.RGBA_ASTC_10x8:eg.RGBA_ASTC_10x10:10===e?eg.RGBA_ASTC_12x10:eg.RGBA_ASTC_12x12}(o,h),c=a[7]+(a[8]<<8)+(a[9]<<16),_=a[10]+(a[11]<<8)+(a[12]<<16);a[13],a[14],a[15],r={_data:new Uint8Array(s,16),_compressed:!0,width:c,height:_,format:l}}catch(t){n=t}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=iv.parse(t);r||(n=new Error("parse failed")),i(n,r)},e.parseImport=function(t,e,i){if(t){var n=null,r=null;try{n=xg(t,e)}catch(t){r=t}i(r,n)}else i(new Error("The json file of asset "+e.__uuid__+" is empty or missing"))},e.init=function(){this._parsing.clear()},e.register=function(t,e){"object"==typeof t?le.mixin(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,a=nl.get(t);if(a)r(null,a);else{var o=this._parsing.get(t);if(o)o.push(r);else{var h=this._parsers[i];h?(this._parsing.add(t,[r]),h(e,n,(function(e,i){e?il.remove(t):Al(i)||nl.add(t,i);for(var n=s._parsing.remove(t),r=0,a=n.length;r=1024)&&_.lightingMap.objectID===a.objectID&&_.stride===r){if(_.count>=_.capacity){_.capacity<<=1;var f=_.stride*_.capacity,d=_.data;_.data=new Uint8Array(f),_.data.set(d),_.vb.resize(f)}return _.shader=o,_.descriptorSet=h,_.data.set(n.buffer,_.stride*_.count++),void(this.hasPendingModels=!0)}}for(var p=this._device.createBuffer(new Fr(Pn.VERTEX|Pn.TRANSFER_DST,Fn.HOST|Fn.DEVICE,32*r,r)),m=new Uint8Array(32*r),g=s.vertexBuffers.slice(),y=s.attributes.slice(),v=s.indexBuffer,A=0;Am.size&&(m.resize(r),_.vbDatas[d]=new Uint8Array(r),_.vbDatas[d].set(g)),_.vbDatas[d].set(p.buffer,_.vbCount*p.stride)}var y=_.vbIdxData;(s=4*(a+_.vbCount))>_.vbIdx.size&&(_.vbIdx.resize(s),_.vbIdxData=new Float32Array(s/Float32Array.BYTES_PER_ELEMENT),_.vbIdxData.set(y),y=_.vbIdxData);var v=_.vbCount,A=v+a,S=_.mergeCount;if(y[v]!==S||y[A-1]!==S)for(var b=v;b>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),h=0;h>2)*a,c=0;c+u.length<=l;c+=u.length)o.set(u,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r=t.getTypeFromHandle(n),s=t.getBindingFromHandle(n),a=this._properties[e],o=a&&a.value,h=o?""+o+Fm(r):Om(r),u=vv.get(h),l=u&&u.getGFXTexture(),c=a&&void 0!==a.samplerHash?ia.unpackFromHash(a.samplerHash):u&&u.getSamplerInfo(),_=this._device.getSampler(c);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,l,i||0)}},e.resetUBOs=function(){for(var t=0;t>2)*r.count,u=0;u+o.length<=h;u+=o.length)s.set(o,i+u);i+=h}this._rootBufferDirty=!0},e.resetTextures=function(){for(var t=0;t=this._passes.length)return void console.warn("illegal pass index: "+i+".");var h=this._passes[i];this._uploadProperty(h,t,e)&&(this._props[h.propertyIndex][t]=e,n=!0)}n||console.warn("illegal property name: "+t+".")},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r=this._props.length)return console.warn("illegal pass index: "+e+"."),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i0},u(e,[{key:"effectAsset",get:function(){return this._effectAsset}},{key:"effectName",get:function(){return this._effectAsset?this._effectAsset.name:""}},{key:"technique",get:function(){return this._techIdx}},{key:"passes",get:function(){return this._passes}},{key:"hash",get:function(){return this._hash}},{key:"parent",get:function(){return null}},{key:"owner",get:function(){return null}}]),e}(Wl),Fv=S((Ov=Gv).prototype,"_effectAsset",[Pv],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Nv=S(Ov.prototype,"_techIdx",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Lv=S(Ov.prototype,"_defines",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Vv=S(Ov.prototype,"_states",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),kv=S(Ov.prototype,"_props",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Mv=Ov))||Mv));function Xv(t,e){for(var i,n=v(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?Xv(t,r):t.push(r)}}function jv(t){var e=[];return Xv(e,t),e.join("")}C.Material=Wv,ft({replaceProperty:{since:"3.6.0",removed:!1},removeProperty:{since:"3.6.0",removed:!1},markAsWarning:{since:"3.6.0",removed:!1},setDefaultLogTimes:{since:"3.6.0",removed:!1}});var Yv=Sa.Flags.Destroyed,qv=Sa.Flags.PersistentMask,Kv=ui.IDENTIFIER_RE,Jv="var ",Zv="o",Qv={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},$v=ui.escapeForJS,tA=function(){function t(t,e){this.varName=void 0,this.expression=void 0,this.varName=t,this.expression=e}return t.prototype.toString=function(){return Jv+this.varName+"="+this.expression+";"},t}();function eA(t,e){return e instanceof tA?new tA(e.varName,t+e.expression):t+e}function iA(t,e,i){Array.isArray(i)?(i[0]=eA(e,i[0]),t.push(i)):t.push(eA(e,i)+";")}var nA=function(){function t(t){this._exps=void 0,this._targetExp=void 0,this._exps=[],this._targetExp=t}var e=t.prototype;return e.append=function(t,e){this._exps.push([t,e])},e.writeCode=function(t){var e;if(this._exps.length>1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i0&&(i=Jv+this.globalVariables.join(",")+";");var n=jv(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r0&&(s=i._findChildComponent(r._children,e)))return s}return null},i._findChildComponents=function(t,e,n){for(var r=0;r0&&i._findChildComponents(s._children,e,n)}};var e=i.prototype;function i(e){var i;return A(i=t.call(this,e)||this,"_parent",lA,g(i)),A(i,"_children",cA,g(i)),A(i,"_active",_A,g(i)),A(i,"_components",fA,g(i)),A(i,"_prefab",dA,g(i)),i._scene=null,i._activeInHierarchy=!1,i._id=SA.getNewId(),i._name=void 0,i._eventProcessor=new C.NodeEventProcessor(g(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._name=void 0!==e?e:"New Node",i}return e._updateScene=function(){null==this._parent?L("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Wt(this,t)},e.getParent=function(){return this._parent},e.setParent=function(t,e){if(void 0===e&&(e=!1),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit(oA.PARENT_CHANGED,i),i&&!(i._objFlags&yA)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(oA.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(oA.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return F("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i0?(h=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,u=!0);o.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=bA(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=bA(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=bA(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=bA(t),n=[];return e&&(i._findComponents(this,e,n),i._findChildComponents(this._children,e,n)),n},e.addComponent=function(t){var e;if("string"==typeof t){if(!(e=se(t)))throw C._RF.peek()&&q(3808,t),TypeError(Q(3807,t))}else{if(!t)throw TypeError(Q(3804));e=t}if("function"!=typeof e)throw TypeError(Q(3809));if(!Yt(e,C.Component))throw TypeError(Q(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n0},set:function(t){t?this._objFlags|=vA:this._objFlags&=~vA}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(t){if(t=!!t,this._active!==t){this._active=t;var e=this._parent;e&&e._activeInHierarchy&&C.director._nodeActivator.activateNode(this,t)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(t){this.setParent(t)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}}]),i}(Sa),pA.idGenerator=SA,pA._stacks=[[]],pA._stackId=0,S((uA=mA).prototype,"_persistNode",[mu],Object.getOwnPropertyDescriptor(uA.prototype,"_persistNode"),uA.prototype),S(uA.prototype,"name",[Du],Object.getOwnPropertyDescriptor(uA.prototype,"name"),uA.prototype),S(uA.prototype,"children",[Du],Object.getOwnPropertyDescriptor(uA.prototype,"children"),uA.prototype),S(uA.prototype,"active",[Du],Object.getOwnPropertyDescriptor(uA.prototype,"active"),uA.prototype),S(uA.prototype,"activeInHierarchy",[Du],Object.getOwnPropertyDescriptor(uA.prototype,"activeInHierarchy"),uA.prototype),S(uA.prototype,"parent",[Du],Object.getOwnPropertyDescriptor(uA.prototype,"parent"),uA.prototype),lA=S(uA.prototype,"_parent",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cA=S(uA.prototype,"_children",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),_A=S(uA.prototype,"_active",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),fA=S(uA.prototype,"_components",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),dA=S(uA.prototype,"_prefab",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),hA=uA))||hA);C._BaseNode=NA,function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(TA||(TA=t("NodeSpace",{}))),function(t){t[t.NONE=0]="NONE",t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.RS=t.ROTATION|t.SCALE]="RS",t[t.TRS=t.POSITION|t.ROTATION|t.SCALE]="TRS",t[t.TRS_MASK=~t.TRS]="TRS_MASK"}(EA||(EA=t("TransformBit",{}))),C.internal.TransformBit=EA;var LA=new ji,VA=new $i,kA=new $i,GA=new $i,UA=new Ji,zA=new Ji,HA=new hn,WA=[],XA=Symbol("ReserveContentsForAllSyncablePrefab"),jA=0,YA=t("Node",(CA=_u("cc.Node"),wA=qu(ji),CA((FA=OA=function(t){function e(e){var i;return(i=t.call(this,e)||this)._uiProps=new gA(g(i)),i._static=!1,A(i,"_lpos",IA,g(i)),A(i,"_lrot",BA,g(i)),A(i,"_lscale",DA,g(i)),A(i,"_layer",PA,g(i)),A(i,"_euler",MA,g(i)),i._dirtyFlags=EA.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new ji,i._rot=new $i,i._scale=new ji(1,1,1),i._mat=new hn,i}c(e,t),e.isNode=function(t){return t instanceof e&&(t.constructor===e||!(t instanceof C.Scene))};var i=e.prototype;return i._onPreDestroy=function(){return this._onPreDestroyBase()},i[Ic]=function(t){t.writeThis()},i.setParent=function(e,i){void 0===i&&(i=!1),i&&this.updateWorldTransform(),t.prototype.setParent.call(this,e,i)},i._onSetParent=function(e,i){if(t.prototype._onSetParent.call(this,e,i),i){var n=this._parent;n?(n.updateWorldTransform(),gi(hn.determinant(n._mat),0,pi)?(j(14300),this._dirtyFlags|=EA.TRS,this.updateWorldTransform()):(hn.multiply(HA,hn.invert(HA,n._mat),this._mat),hn.toRTS(HA,this._lrot,this._lpos,this._lscale))):(ji.copy(this._lpos,this._pos),$i.copy(this._lrot,this._rot),ji.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(EA.TRS)},i._onHierarchyChanged=function(e){this.eventProcessor.reattach(),t.prototype._onHierarchyChangedBase.call(this,e)},i._onBatchCreated=function(t){this.hasChangedFlags=EA.TRS,this._dirtyFlags|=EA.TRS;for(var e=this._children.length,i=0;i=0;){if(a=(e=WA[n--]).hasChangedFlags,e.isValid&&(e._dirtyFlags&a&t)!==t)for(e._dirtyFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r=0;)ji.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=WA[--n];return t},i.setWorldPosition=function(t,e,i){void 0===e||void 0===i?ji.copy(this._pos,t):ji.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),ji.transformMat4(r,this._pos,hn.invert(HA,n._mat))):ji.copy(r,this._pos),this.invalidateChildren(EA.POSITION),1&this._eventMask&&this.emit(oA.TRANSFORM_CHANGED,EA.POSITION)},i.getWorldPosition=function(t){return this.updateWorldTransform(),t?ji.copy(t,this._pos):ji.copy(new ji,this._pos)},i.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?$i.copy(this._rot,t):$i.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),$i.multiply(this._lrot,$i.conjugate(this._lrot,this._parent._rot),this._rot)):$i.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(EA.ROTATION),1&this._eventMask&&this.emit(oA.TRANSFORM_CHANGED,EA.ROTATION)},i.setWorldRotationFromEuler=function(t,e,i){$i.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),$i.multiply(this._lrot,$i.conjugate(this._lrot,this._parent._rot),this._rot)):$i.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(EA.ROTATION),1&this._eventMask&&this.emit(oA.TRANSFORM_CHANGED,EA.ROTATION)},i.getWorldRotation=function(t){return this.updateWorldTransform(),t?$i.copy(t,this._rot):$i.copy(new $i,this._rot)},i.setWorldScale=function(t,e,i){void 0===e||void 0===i?ji.copy(this._scale,t):ji.set(this._scale,t,e,i);var n=this._parent;n?(n.updateWorldTransform(),Ji.fromQuat(UA,$i.conjugate(GA,n._rot)),Ji.multiplyMat4(UA,UA,n._mat),zA.m00=this._scale.x,zA.m04=this._scale.y,zA.m08=this._scale.z,Ji.multiply(UA,zA,Ji.invert(UA,UA)),this._lscale.x=ji.set(LA,UA.m00,UA.m01,UA.m02).length(),this._lscale.y=ji.set(LA,UA.m03,UA.m04,UA.m05).length(),this._lscale.z=ji.set(LA,UA.m06,UA.m07,UA.m08).length()):ji.copy(this._lscale,this._scale),this.invalidateChildren(EA.SCALE),1&this._eventMask&&this.emit(oA.TRANSFORM_CHANGED,EA.SCALE)},i.getWorldScale=function(t){return this.updateWorldTransform(),t?ji.copy(t,this._scale):ji.copy(new ji,this._scale)},i.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new hn;return hn.copy(e,this._mat)},i.getWorldRS=function(t){this.updateWorldTransform();var e=t||new hn;return hn.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},i.getWorldRT=function(t){this.updateWorldTransform();var e=t||new hn;return hn.fromRT(e,this._rot,this._pos)},i.setRTS=function(t,e,i){var n=0;t&&(n|=EA.ROTATION,void 0!==t.w?($i.copy(this._lrot,t),this._eulerDirty=!0):(ji.copy(this._euler,t),$i.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(ji.copy(this._lpos,e),n|=EA.POSITION),i&&(ji.copy(this._lscale,i),n|=EA.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(oA.TRANSFORM_CHANGED,n))},i.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},i.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},e.resetHasChangedFlags=function(){jA+=1},e.clearNodeArray=function(){e.ClearFramee.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},u(t,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"id",get:function(){return this._id},set:function(t){this._id=t}}]),t}());KA.Priority=_e({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var JA=new es;JA.format=In.RGBA8;var ZA=new is;ZA.format=In.DEPTH_STENCIL;var QA,$A,tS,eS,iS,nS,rS,sS=new ss([JA],ZA),aS={width:1,height:1,renderPassInfo:sS},oS=t("RenderTexture",_u("cc.RenderTexture")(qA=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return q(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length=this._materials.length?null:this._materials[t]},i.setMaterial=function(t,e){t&&t instanceof nT&&console.error("Can't set a material instance to a sharedMaterial slot"),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){rT.parent=this._materials[t],rT.owner=this,rT.subModelIdx=t;var e=new nT(rT);rT.parent=null,rT.owner=null,rT.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){j(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},u(e,[{key:"sharedMaterial",get:function(){return this.getMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e0)for(var t=0;t0)for(var r=0;r=0;--n)if((e=bT[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,bT),t.propagationStopped))return void(bT.length=0);if(bT.length=0,t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(this.getBubblingTargets(t.type,bT),t.eventPhase=3,n=0;n0?n:null}return null},e._attachMask=function(){this.maskList=this._searchComponentsInParent(t._maskComp)},e._isTouchEvent=function(t){return-1!==CT.indexOf(t)},e._isMouseEvent=function(t){return-1!==wT.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t0?e[0].getShaderVariant(t):null},e.getPlanarInstanceShader=function(t){this._instancingMaterial||(this._instancingMaterial=new Wv,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var e=this._instancingMaterial.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:OT,this.normal=t.planeDirection,this.distance=t.planeHeight,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===BT.Planar)this._updatePlanarInfo();else{var t=C.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=C.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new Wv,this._material.initialize({effectName:"pipeline/planar-shadow"})),this._instancingMaterial||(this._instancingMaterial=new Wv,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var t=C.director.root;t.pipeline.macros.CC_SHADOW_TYPE=1,t.onGlobalPipelineStateChanged()},e.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},u(t,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,this.activate()}},{key:"type",get:function(){return this._type},set:function(t){this._type=this.enabled?t:OT,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){ji.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();FT.MAX_FAR=2e3,FT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),C.Shadows=FT;var NT=null,LT=null,VT=_e({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),kT=function(){function t(){this._envmapLDR=null,this._envmapHDR=null,this._diffuseMapLDR=null,this._diffuseMapHDR=null,this._globalDSManager=null,this._model=null,this._default=null,this._enabled=!1,this._useIBL=!1,this._useHDR=!0,this._useDiffuseMap=!1,this._editableMaterial=null,this._activated=!1,this._reflectionHDR=null,this._reflectionLDR=null,this._rotationAngle=0}var e=t.prototype;return e.initialize=function(t){this._activated=!1,this._enabled=t.enabled,this._useIBL=t.useIBL,this._useDiffuseMap=t.applyDiffuseMap,this._useHDR=t.useHDR},e.setEnvMaps=function(t,e){this._envmapHDR=t,this._envmapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setDiffuseMaps=function(t,e){this._diffuseMapHDR=t,this._diffuseMapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setSkyboxMaterial=function(t){t?(this._editableMaterial=new nT({parent:t}),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):this._editableMaterial=null,this._updatePipeline()},e.setReflectionMaps=function(t,e){this._reflectionHDR=t,this._reflectionLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setRotationAngle=function(t){this._rotationAngle=t},e.getRotationAngle=function(){return this._rotationAngle},e.updateMaterialRenderInfo=function(){this._updateGlobalBinding(),this._updatePipeline()},e.activate=function(){var t=C.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=vv.get("default-cube-texture"),this._model||(this._model=C.director.root.createModel(C.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!LT){var i=new Wv;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),LT=new nT({parent:i})}this.enabled&&(NT||(NT=C.utils.createMesh(C.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,NT.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,NT.renderingSubMeshes[0],LT)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=C.director.root,e=t.pipeline,i=this.useIBL?this.isRGBE?2:1:0,n=this.useIBL&&this.useDiffuseMap&&this.diffuseMap?this.isRGBE?2:1:0,r=this.useHDR,s=this.useConvolutionMap;if(e.macros.CC_USE_IBL===i&&e.macros.CC_USE_DIFFUSEMAP===n&&e.macros.CC_USE_HDR===r&&e.macros.CC_IBL_CONVOLUTED===s||(e.macros.CC_USE_IBL=i,e.macros.CC_USE_DIFFUSEMAP=n,e.macros.CC_USE_HDR=r,e.macros.CC_IBL_CONVOLUTED=s,this._activated&&t.onGlobalPipelineStateChanged()),this.enabled){var a=this.envmap?this.envmap:this._default,o=this._editableMaterial?this._editableMaterial:LT;o&&(o.setProperty("environmentMap",a),o.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,o),this._updateSubModes())}},e._updateGlobalBinding=function(){if(this._globalDSManager){var t=Qa.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(bp,i),this._globalDSManager.bindTexture(bp,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(bp,s),this._globalDSManager.bindTexture(bp,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),h=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(Cp,h),this._globalDSManager.bindTexture(Cp,o)}this._globalDSManager.update()}},e._updateSubModes=function(){if(this._model)for(var t=this._model.subModels,e=0;eMath.abs(e)?t:-e},e}(nx),hx=function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.xAxis=void 0,i.yAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new ox({positive:i.right,negative:i.left}),i.yAxis=new ox({positive:i.up,negative:i.down}),i}return c(e,t),e.prototype.getValue=function(){return new _n(this.xAxis.getValue(),this.yAxis.getValue())},e}(rx),ux=(function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.forward=void 0,i.backward=void 0,i.xAxis=void 0,i.yAxis=void 0,i.zAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new ox({positive:i.right,negative:i.left}),i.yAxis=new ox({positive:i.up,negative:i.down}),i.zAxis=new ox({positive:i.forward,negative:i.backward}),i}c(e,t),e.prototype.getValue=function(){return new ji(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(sx),function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(nx)),lx=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(hx),cx=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(hx),_x=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(ax),fx=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(sx),dx=function(){function t(t){this._deviceId=-1,this._connected=!1,this._deviceId=t,this._initInputSource()}t._init=function(){za.hasFeature(ka.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&>(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(){return new Promise((function(e){t._intervalId=setInterval((function(){C.director&&C.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},t._registerEvent=function(){t._ensureDirectorDefined().then((function(){C.director.on(C.Director.EVENT_BEGIN_FRAME,t._scanGamepads)})).catch((function(){})),window.addEventListener("gamepadconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=e.gamepad;var i=t._getOrCreateInputDevice(e.gamepad.index,!0);t._eventTarget.emit(hT.GAMEPAD_CHANGE,new mT(hT.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=null;var i=t._getOrCreateInputDevice(e.gamepad.index,!1);t._removeInputDevice(e.gamepad.index),t._eventTarget.emit(hT.GAMEPAD_CHANGE,new mT(hT.GAMEPAD_CHANGE,i))}))},t._scanGamepads=function(){var e=t._getWebGamePads();if(e){for(var i=[],n=0;n.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}for(var c=s.axes,_=0;_.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}}}}t._cachedWebGamepads=e;for(var p=0;p0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._initInputSource=function(){var e=this;this._buttonNorth=new ux,this._buttonNorth.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[3].value:0},this._buttonEast=new ux,this._buttonEast.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[1].value:0},this._buttonWest=new ux,this._buttonWest.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[2].value:0},this._buttonSouth=new ux,this._buttonSouth.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[0].value:0},this._buttonL1=new ux,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new ux,this._buttonL2.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[6].value:0},this._buttonL3=new ux,this._buttonL3.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[10].value:0},this._buttonR1=new ux,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new ux,this._buttonR2.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[7].value:0},this._buttonR3=new ux,this._buttonR3.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[11].value:0},this._buttonShare=new ux,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new ux,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new ux;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new ux;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new ux;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new ux;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new lx({up:i,down:n,left:r,right:s});var a=new ux;a.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).negative:0};var o=new ux;o.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).positive:0};var h=new ux;h.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).negative:0};var u=new ux;u.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).positive:0},this._leftStick=new cx({up:a,down:o,left:h,right:u});var l=new ux;l.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).negative:0};var c=new ux;c.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).positive:0};var _=new ux;_.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).negative:0};var f=new ux;f.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).positive:0},this._rightStick=new cx({up:l,down:c,left:_,right:f}),this._buttonStart=new ux,this._buttonStart.getValue=function(){return 0}},u(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),t}();dx.all=[],dx._eventTarget=new Ma,dx._cachedWebGamepads=[],dx._intervalId=-1;var px,mx,gx=function(){function t(){this._eventTarget=new Ma,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._buttonNorth=new ux,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new ux,this._buttonEast.getValue=function(){return 0},this._buttonWest=new ux,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new ux,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new ux,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new ux,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new ux,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new ux,this._triggerRight.getValue=function(){return 0},this._gripLeft=new ux,this._gripLeft.getValue=function(){return 0},this._gripRight=new ux,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new ux,this._buttonLeftStick.getValue=function(){return 0};var t=new ux;t.getValue=function(){return 0};var e=new ux;e.getValue=function(){return 0};var i=new ux;i.getValue=function(){return 0};var n=new ux;n.getValue=function(){return 0},this._leftStick=new cx({up:t,down:e,left:i,right:n}),this._buttonRightStick=new ux,this._buttonRightStick.getValue=function(){return 0};var r=new ux;r.getValue=function(){return 0};var s=new ux;s.getValue=function(){return 0};var a=new ux;a.getValue=function(){return 0};var o=new ux;o.getValue=function(){return 0},this._rightStick=new cx({up:r,down:s,left:a,right:o}),this._handLeftPosition=new fx,this._handLeftPosition.getValue=function(){return ji.ZERO},this._handLeftOrientation=new _x,this._handLeftOrientation.getValue=function(){return $i.IDENTITY},this._handRightPosition=new fx,this._handRightPosition.getValue=function(){return ji.ZERO},this._handRightOrientation=new _x,this._handRightOrientation.getValue=function(){return $i.IDENTITY},this._aimLeftPosition=new fx,this._aimLeftPosition.getValue=function(){return ji.ZERO},this._aimLeftOrientation=new _x,this._aimLeftOrientation.getValue=function(){return $i.IDENTITY},this._aimRightPosition=new fx,this._aimRightPosition.getValue=function(){return ji.ZERO},this._aimRightOrientation=new _x,this._aimRightOrientation.getValue=function(){return $i.IDENTITY}},u(t,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}}]),t}(),yx=function(){function t(){this._eventTarget=new Ma,this._initInputSource()}var e=t.prototype;return e._on=function(t,e,i){this._eventTarget.on(t,e,i)},e._initInputSource=function(){this._viewLeftPosition=new fx,this._viewLeftPosition.getValue=function(){return ji.ZERO},this._viewLeftOrientation=new _x,this._viewLeftOrientation.getValue=function(){return $i.IDENTITY},this._viewRightPosition=new fx,this._viewRightPosition.getValue=function(){return ji.ZERO},this._viewRightOrientation=new _x,this._viewRightOrientation.getValue=function(){return $i.IDENTITY},this._headMiddlePosition=new fx,this._headMiddlePosition.getValue=function(){return ji.ZERO},this._headMiddleOrientation=new _x,this._headMiddleOrientation.getValue=function(){return $i.IDENTITY}},u(t,[{key:"viewLeftPosition",get:function(){return this._viewLeftPosition}},{key:"viewLeftOrientation",get:function(){return this._viewLeftOrientation}},{key:"viewRightPosition",get:function(){return this._viewRightPosition}},{key:"viewRightOrientation",get:function(){return this._viewRightOrientation}},{key:"headMiddlePosition",get:function(){return this._headMiddlePosition}},{key:"headMiddleOrientation",get:function(){return this._headMiddleOrientation}}]),t}(),vx={Backspace:pT.BACKSPACE,Tab:pT.TAB,Enter:pT.ENTER,ShiftLeft:pT.SHIFT_LEFT,ControlLeft:pT.CTRL_LEFT,AltLeft:pT.ALT_LEFT,ShiftRight:pT.SHIFT_RIGHT,ControlRight:pT.CTRL_RIGHT,AltRight:pT.ALT_RIGHT,Pause:pT.PAUSE,CapsLock:pT.CAPS_LOCK,Escape:pT.ESCAPE,Space:pT.SPACE,PageUp:pT.PAGE_UP,PageDown:pT.PAGE_DOWN,End:pT.END,Home:pT.HOME,ArrowLeft:pT.ARROW_LEFT,ArrowUp:pT.ARROW_UP,ArrowRight:pT.ARROW_RIGHT,ArrowDown:pT.ARROW_DOWN,Insert:pT.INSERT,Delete:pT.DELETE,Digit0:pT.DIGIT_0,Digit1:pT.DIGIT_1,Digit2:pT.DIGIT_2,Digit3:pT.DIGIT_3,Digit4:pT.DIGIT_4,Digit5:pT.DIGIT_5,Digit6:pT.DIGIT_6,Digit7:pT.DIGIT_7,Digit8:pT.DIGIT_8,Digit9:pT.DIGIT_9,KeyA:pT.KEY_A,KeyB:pT.KEY_B,KeyC:pT.KEY_C,KeyD:pT.KEY_D,KeyE:pT.KEY_E,KeyF:pT.KEY_F,KeyG:pT.KEY_G,KeyH:pT.KEY_H,KeyI:pT.KEY_I,KeyJ:pT.KEY_J,KeyK:pT.KEY_K,KeyL:pT.KEY_L,KeyM:pT.KEY_M,KeyN:pT.KEY_N,KeyO:pT.KEY_O,KeyP:pT.KEY_P,KeyQ:pT.KEY_Q,KeyR:pT.KEY_R,KeyS:pT.KEY_S,KeyT:pT.KEY_T,KeyU:pT.KEY_U,KeyV:pT.KEY_V,KeyW:pT.KEY_W,KeyX:pT.KEY_X,KeyY:pT.KEY_Y,KeyZ:pT.KEY_Z,Numpad0:pT.NUM_0,Numpad1:pT.NUM_1,Numpad2:pT.NUM_2,Numpad3:pT.NUM_3,Numpad4:pT.NUM_4,Numpad5:pT.NUM_5,Numpad6:pT.NUM_6,Numpad7:pT.NUM_7,Numpad8:pT.NUM_8,Numpad9:pT.NUM_9,NumpadMultiply:pT.NUM_MULTIPLY,NumpadAdd:pT.NUM_PLUS,NumpadSubtract:pT.NUM_SUBTRACT,NumpadDecimal:pT.NUM_DECIMAL,NumpadDivide:pT.NUM_DIVIDE,NumpadEnter:pT.NUM_ENTER,F1:pT.F1,F2:pT.F2,F3:pT.F3,F4:pT.F4,F5:pT.F5,F6:pT.F6,F7:pT.F7,F8:pT.F8,F9:pT.F9,F10:pT.F10,F11:pT.F11,F12:pT.F12,NumLock:pT.NUM_LOCK,ScrollLock:pT.SCROLL_LOCK,Semicolon:pT.SEMICOLON,Equal:pT.EQUAL,Comma:pT.COMMA,Minus:pT.DASH,Period:pT.PERIOD,Slash:pT.SLASH,Backquote:pT.BACK_QUOTE,BracketLeft:pT.BRACKET_LEFT,Backslash:pT.BACKSLASH,BracketRight:pT.BRACKET_RIGHT,Quote:pT.QUOTE},Ax=function(){function t(){this._eventTarget=new Ma,this._registerEvent()}var e=t.prototype;return e.dispatchKeyboardDownEvent=function(t){this._handleKeyboardDown(t)},e.dispatchKeyboardUpEvent=function(t){this._handleKeyboardUp(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._registerEvent=function(){var t=document.getElementById("GameCanvas");null==t||t.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==t||t.addEventListener("keyup",this._handleKeyboardUp.bind(this))},e._getInputEvent=function(t,e){var i,n=(i=t.code,vx[i]||pT.NONE);return new cT(n,e)},e._handleKeyboardDown=function(t){if(t.stopPropagation(),t.preventDefault(),t.repeat){var e=this._getInputEvent(t,hT.KEY_PRESSING);this._eventTarget.emit(hT.KEY_PRESSING,e)}else{var i=this._getInputEvent(t,hT.KEY_DOWN);this._eventTarget.emit(hT.KEY_DOWN,i)}},e._handleKeyboardUp=function(t){var e=this._getInputEvent(t,hT.KEY_UP);t.stopPropagation(),t.preventDefault(),this._eventTarget.emit(hT.KEY_UP,e)},t}(),Sx=function(){function t(){this._canvas=void 0,this._eventTarget=new Ma,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new _n,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,za.hasFeature(ka.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(hT.MOUSE_DOWN),this._handleMouseMove=this._createCallback(hT.MOUSE_MOVE),this._handleMouseUp=this._createCallback(hT.MOUSE_UP),this._registerEvent())}var e=t.prototype;return e.dispatchMouseDownEvent=function(t){this._handleMouseDown(t)},e.dispatchMouseMoveEvent=function(t){this._handleMouseMove(t)},e.dispatchMouseUpEvent=function(t){this._handleMouseUp(t)},e.dispatchScrollEvent=function(t){this._handleMouseWheel(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new vn(e.x,e.y,e.width,e.height):new vn(0,0,0,0)},e._getLocation=function(t){var e=this._getCanvasRect(),i=Xa.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+t.movementX:t.clientX-e.x,r=this._pointLocked?this._preMousePos.y/i-t.movementY:e.y+e.height-t.clientY;return new _n(n*=i,r*=i)},e._registerEvent=function(){var t,e,i,n,r=this;window.addEventListener("mousedown",(function(){r._isPressed=!0})),null===(t=this._canvas)||void 0===t||t.addEventListener("mousedown",this._handleMouseDown),null===(e=this._canvas)||void 0===e||e.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp),null===(i=this._canvas)||void 0===i||i.addEventListener("mouseup",this._handleMouseUp),null===(n=this._canvas)||void 0===n||n.addEventListener("wheel",this._handleMouseWheel.bind(this)),this._registerPointerLockEvent()},e._registerPointerLockEvent=function(){var t=this,e=function(){var e=t._canvas;document.pointerLockElement===e||document.mozPointerLockElement===e?t._pointLocked=!0:t._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",e,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",e,!1)},e._createCallback=function(t){var e=this;return function(i){var n,r=e._getLocation(i),s=i.button,a=i.buttons,o=s;switch(t){case hT.MOUSE_DOWN:null===(n=e._canvas)||void 0===n||n.focus(),e._isPressed=!0;break;case hT.MOUSE_UP:e._isPressed=!1;break;case hT.MOUSE_MOVE:o=1&a?_T.BUTTON_LEFT:2&a?_T.BUTTON_RIGHT:4&a?_T.BUTTON_MIDDLE:_T.BUTTON_MISSING}var h=new _T(t,!1,e._preMousePos);h.setLocation(r.x,r.y),h.setButton(o),h.movementX=i.movementX,h.movementY=i.movementY,e._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),e._eventTarget.emit(t,h)}},e._handleMouseWheel=function(t){var e=hT.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new _T(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=t.movementX,r.movementY=t.movementY,r.setScrollData(5*t.deltaX,5*-t.deltaY),this._preMousePos.set(i.x,i.y),t.stopPropagation(),t.target===this._canvas&&t.preventDefault(),this._eventTarget.emit(e,r)},t}(),bx=new _n,Tx=new(function(){function t(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var e=t.prototype;return e._cloneTouch=function(t){var e=t.getID();t.getStartLocation(bx);var i=new AT(bx.x,bx.y,e);return t.getLocation(bx),i.setPoint(bx.x,bx.y),t.getPreviousLocation(bx),i.setPrevPoint(bx),i},e._createTouch=function(t,e,i){if(this._touchMap.has(t))console.log("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new AT(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),this._cloneTouch(n)}console.log("The touches is more than MAX_TOUCHES.")}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t,e,i){var n=this._touchMap.get(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n?this._cloneTouch(n):void 0},e.getAllTouches=function(){var t=this,e=[];return this._touchMap.forEach((function(i){if(i){var n=t._cloneTouch(i);e.push(n)}})),e},e._updateTouch=function(t,e,i){t.getLocation(bx),t.setPrevPoint(bx),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ae.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.sizeAe.TOUCH_TIMEOUT&&(console.log("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Ex=function(){function t(){this._canvas=void 0,this._eventTarget=new Ma,za.hasFeature(ka.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback(hT.TOUCH_START)),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback(hT.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(hT.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(hT.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o0){var _=new dT(s,!1,t,Ae.ENABLE_MULTI_TOUCH?Tx.getAllTouches():s);e._eventTarget.emit(t,_)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new vn(e.x,e.y,e.width,e.height):new vn(0,0,0,0)},e._getLocation=function(t,e){var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(Xa.isFrameRotated){var r=i;i=e.height-n,n=r}var s=Xa.devicePixelRatio;return new _n(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(mx||(mx={}));var Cx=function(){function t(t){this.priority=mx.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),wx=((px={})[hT.MOUSE_DOWN]=hT.TOUCH_START,px[hT.MOUSE_MOVE]=hT.TOUCH_MOVE,px[hT.MOUSE_UP]=hT.TOUCH_END,px),xx=t("Input",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Ma,this._touchInput=new Ex,this._mouseInput=new Sx,this._keyboardInput=new Ax,this._accelerometerInput=new ex,this._handleInput=new gx,this._hmdInput=new yx,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Cx(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),dx._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=wx[t.type],i=Tx.getTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new dT(n,!1,e,e===hT.TOUCH_END?[]:n);e===hT.TOUCH_END&&Tx.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i0)for(var h=0;h=0&&s.node._components.splice(a,1)}}}function Xx(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r0){var h=o.pop();if(!h)continue;for(var u=0;u0){var g=p.pop();if(!g)return;for(var y=0;y>>1;r<=s;a=r+s>>>1){var o=t[a],h=o.constructor._executionOrder;if(h>i)s=a-1;else if(hn)s=a-1;else{if(!(u0&&(t.array.sort(nR),this._invoke(t),t.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var e=this._pos;e.array.length>0&&(e.array.sort(nR),this._invoke(e),e.array.length=0)},e}(iR),sR=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.add=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.array.push(t);else{var i=e<0?this._neg.array:this._pos.array,n=tR(i,t);n<0&&i.splice(~n,0,t)}},i.remove=function(t){var e=t.constructor._executionOrder;if(0===e)this._zero.fastRemove(t);else{var i=e<0?this._neg:this._pos,n=tR(i.array,t);n>=0&&i.removeAt(n)}},i.invoke=function(t){this._neg.array.length>0&&this._invoke(this._neg,t),this._invoke(this._zero,t),this._pos.array.length>0&&this._invoke(this._pos,t)},e}(iR);function aR(t,e,i){var n="var a=it.array;for(it.i=0;it.i=0?Zx(this._deferredComps,e):(!t.start||t._objFlags&Qx||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&$x)){if(t.onEnable){if(e)return void e.add(t);if(t.onEnable(),!t.node._activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&$x&&(t.onDisable&&t.onDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.start||t._objFlags&Qx||this.startInvoker.add(t),"function"==typeof t.update&&this.updateInvoker.add(t),"function"==typeof t.lateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new YA,this.data.name="(Missing Node)";var i=new C._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;qx(t),jx(t)},e}(Wl),JI.OptimizationPolicy=aB,JI.OptimizationPolicyThreshold=3,YI=S((jI=ZI).prototype,"data",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),qI=S(jI.prototype,"optimizationPolicy",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return aB.AUTO}}),KI=S(jI.prototype,"persistent",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),XI=jI))||XI);le.value(oB,"_utils",sB),C.Prefab=oB,Ft(C,"cc._Prefab","Prefab"),t("PrefabLink",(QI=_u("cc.PrefabLink"),$I=qu(oB),tB=Pu(),QI((rB=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,h=1/o*a,u=1/o*(1-a-o);t.x=3.2404542*h-1.5371385+-.4985314*u,t.y=-.969266*h+1.8760108+.041556*u,t.z=.0556434*h-.2040259+1.0572252*u}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.UNKNOWN=3]="UNKNOWN"}(yB||(yB={}));var TB,EB,CB,wB,xB,RB,IB,BB,DB,PB,MB=function(t){return 4*Math.PI*Math.PI*t*t},OB=function(){function t(){this._baked=!1,this._color=new ji(1,1,1),this._colorTemp=6550,this._colorTempRGB=new ji(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=yB.UNKNOWN}var e=t.prototype;return e.initialize=function(){this.color=new ji(1,1,1),this.colorTemperature=6550},e.attachToScene=function(t){this._scene=t},e.detachFromScene=function(){this._scene=null},e.destroy=function(){this._name=null,this._node=null},e.update=function(){},u(t,[{key:"baked",get:function(){return this._baked},set:function(t){this._baked=t}},{key:"color",get:function(){return this._color},set:function(t){this._color.set(t)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,bB(this._colorTempRGB,this._colorTemp)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=EA.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(t){this._name=t}},{key:"scene",get:function(){return this._scene}}]),t}(),FB=t("DebugView",function(){function t(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._nativeConfig=null,this._activate()}var e=t.prototype;return e.isCompositeModeEnabled=function(t){return 0!=(this._compositeModeValue&1<=0;--e){var i=t[e];if(i.window.swapchain)return void(Uv=i)}Uv=null}(t);for(var e=0;e0){var o=a;a=s,s=o}var h=0;switch(t){case xn.IDENTITY:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=s;break;case xn.ROTATE_90:h=0,i[h++]=-1,i[h++]=-1,i[h++]=r,i[h++]=a,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=n,i[h++]=s;break;case xn.ROTATE_180:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=r,i[h++]=s,i[h++]=-1,i[h++]=1,i[h++]=n,i[h++]=a,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a;break;case xn.ROTATE_270:h=0,i[h++]=-1,i[h++]=-1,i[h++]=n,i[h++]=s,i[h++]=1,i[h++]=-1,i[h++]=n,i[h++]=a,i[h++]=-1,i[h++]=1,i[h++]=r,i[h++]=s,i[h++]=1,i[h++]=1,i[h++]=r,i[h++]=a}return i},i._createQuadInputAssembler=function(){var t=new qP,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new Fr(Pn.VERTEX|Pn.TRANSFER_DST,Fn.DEVICE|Fn.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Fr(Pn.INDEX|Pn.TRANSFER_DST,Fn.DEVICE,s,r));if(!a)return t;var o=new Uint8Array(6);o[0]=0,o[1]=1,o[2]=2,o[3]=1,o[4]=3,o[5]=2,a.update(o);var h=new Array(2);h[0]=new Qr("a_position",In.RG32F),h[1]=new Qr("a_texCoord",In.RG32F);var u=this._device.createInputAssembler(new ts(h,[n],a));return t.quadIB=a,t.quadVB=n,t.quadIA=u,t},i.updateQuadVertexData=function(t,e){var i=this._lastUsedRenderArea;if(i.x!==t.x||i.y!==t.y||i.width!==t.width||i.height!==t.height){var n=this._genQuadVertexData(xn.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||xn.IDENTITY,t);this._quadVBOnscreen.update(r),i.copy(t)}},i.destroy=function(){for(var e,i,n=0;n>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new us(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new Gr(Nn.TEX2D,Ln.COLOR_ATTACHMENT|Ln.SAMPLED,In.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new us(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new Gr(Nn.TEX2D,Ln.COLOR_ATTACHMENT|Ln.SAMPLED,In.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new us(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new Gr(Nn.TEX2D,Ln.COLOR_ATTACHMENT|Ln.SAMPLED,In.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new us(t.renderPass,[t.combineTex])),t.sampler=this.globalDSManager.linearSampler}},i.on=function(t,e,i,n){return this._eventProcessor.on(t,e,i,n)},i.once=function(t,e,i){return this._eventProcessor.once(t,e,i)},i.off=function(t,e,i){this._eventProcessor.off(t,e,i)},i.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},i.targetOff=function(t){this._eventProcessor.targetOff(t)},i.removeAll=function(t){this._eventProcessor.removeAll(t)},i.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},u(e,[{key:"tag",get:function(){return this._tag}},{key:"flows",get:function(){return this._flows}},{key:"quadIAOnscreen",get:function(){return this._quadIAOnscreen}},{key:"quadIAOffscreen",get:function(){return this._quadIAOffscreen}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"macros",get:function(){return this._macros}},{key:"device",get:function(){return this._device}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"commandBuffers",get:function(){return this._commandBuffers}},{key:"pipelineUBO",get:function(){return this._pipelineUBO}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(t){this._clusterEnabled=t}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(t){this._bloomEnabled=t}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale!==t&&(this._pipelineSceneData.shadingScale=t,this.emit(nD.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(Wl),cD=S((lD=fD).prototype,"_tag",[aD,Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),_D=S(lD.prototype,"_flows",[oD,hD,Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),uD=lD))||uD));C.RenderPipeline=KP,nt(KP.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]),function(t){t[t.BLOOM=18]="BLOOM",t[t.POST_PROCESS=19]="POST_PROCESS",t[t.UI=20]="UI"}(dD||(dD={})),function(t){t[t.FORWARD=10]="FORWARD"}(pD||(pD={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(mD||(mD={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(gD||(gD={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(yD||(yD={})),pe(Nn),pe(Ln),pe(Zn),pe(Jn),pe(Qn),pe(In),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(HP||(HP={})),pe(HP),vD=_u("RenderTextureDesc"),AD=qu(Nn),SD=qu(Ln),bD=qu(In),vD((ED=S((TD=function(){A(this,"name",ED,this),A(this,"type",CD,this),A(this,"usage",wD,this),A(this,"format",xD,this),A(this,"width",RD,this),A(this,"height",ID,this)}).prototype,"name",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),CD=S(TD.prototype,"type",[AD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Nn.TEX2D}}),wD=S(TD.prototype,"usage",[SD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ln.COLOR_ATTACHMENT}}),xD=S(TD.prototype,"format",[bD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return In.UNKNOWN}}),RD=S(TD.prototype,"width",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),ID=S(TD.prototype,"height",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),TD));var JP,ZP=(BD=_u("RenderTextureConfig"),DD=qu(oS),BD((OD=S((MD=function(){A(this,"name",OD,this),A(this,"texture",FD,this)}).prototype,"name",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),FD=S(MD.prototype,"texture",[DD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),PD=MD))||PD),QP=(ND=_u("MaterialConfig"),LD=qu(Wv),ND((kD=S((VD=function(){A(this,"name",kD,this),A(this,"material",GD,this)}).prototype,"name",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),GD=S(VD.prototype,"material",[LD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),VD)),UD=_u("FrameBufferDesc"),zD=qu([Xe]),HD=qu(oS),UD((XD=S((WD=function(){A(this,"name",XD,this),A(this,"renderPass",jD,this),A(this,"colorTextures",YD,this),A(this,"depthStencilTexture",qD,this),A(this,"texture",KD,this)}).prototype,"name",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),jD=S(WD.prototype,"renderPass",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),YD=S(WD.prototype,"colorTextures",[zD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qD=S(WD.prototype,"depthStencilTexture",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),KD=S(WD.prototype,"texture",[HD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),WD)),JD=_u("ColorDesc"),ZD=qu(In),QD=qu(Jn),$D=qu(Zn),tP=qu([Qn]),eP=qu([Qn]),JD((rP=S((nP=function(){A(this,"format",rP,this),A(this,"loadOp",sP,this),A(this,"storeOp",aP,this),A(this,"sampleCount",oP,this),A(this,"beginAccesses",hP,this),A(this,"endAccesses",uP,this)}).prototype,"format",[ZD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return In.UNKNOWN}}),sP=S(nP.prototype,"loadOp",[QD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.CLEAR}}),aP=S(nP.prototype,"storeOp",[$D],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),oP=S(nP.prototype,"sampleCount",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),hP=S(nP.prototype,"beginAccesses",[tP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.NONE}}),uP=S(nP.prototype,"endAccesses",[eP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.COLOR_ATTACHMENT_WRITE}}),iP=nP))||iP),$P=(lP=_u("DepthStencilDesc"),cP=qu(In),_P=qu(Jn),fP=qu(Zn),dP=qu(Jn),pP=qu(Zn),mP=qu(Qn),gP=qu(Qn),lP((AP=S((vP=function(){A(this,"format",AP,this),A(this,"depthLoadOp",SP,this),A(this,"depthStoreOp",bP,this),A(this,"stencilLoadOp",TP,this),A(this,"stencilStoreOp",EP,this),A(this,"sampleCount",CP,this),A(this,"beginAccesses",wP,this),A(this,"endAccesses",xP,this)}).prototype,"format",[cP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return In.UNKNOWN}}),SP=S(vP.prototype,"depthLoadOp",[_P],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.CLEAR}}),bP=S(vP.prototype,"depthStoreOp",[fP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),TP=S(vP.prototype,"stencilLoadOp",[dP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.CLEAR}}),EP=S(vP.prototype,"stencilStoreOp",[pP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),CP=S(vP.prototype,"sampleCount",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),wP=S(vP.prototype,"beginAccesses",[mP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.NONE}}),xP=S(vP.prototype,"endAccesses",[gP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.DEPTH_STENCIL_ATTACHMENT_WRITE}}),yP=vP))||yP);RP=_u("RenderPassDesc"),IP=qu([QP]),BP=qu($P),RP((PP=S((DP=function(){A(this,"index",PP,this),A(this,"colorAttachments",MP,this),A(this,"depthStencilAttachment",OP,this)}).prototype,"index",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),MP=S(DP.prototype,"colorAttachments",[IP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),OP=S(DP.prototype,"depthStencilAttachment",[BP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new $P}}),DP)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(JP||(JP={})),pe(JP);var tM=(FP=_u("RenderQueueDesc"),NP=qu(JP),LP=qu([Xe]),FP((GP=S((kP=function(){A(this,"isTransparent",GP,this),A(this,"sortMode",UP,this),A(this,"stages",zP,this)}).prototype,"isTransparent",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),UP=S(kP.prototype,"sortMode",[NP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return JP.FRONT_TO_BACK}}),zP=S(kP.prototype,"stages",[LP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),VP=kP))||VP);function eM(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function iM(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var nM=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new pa((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new ma(64,this._passDesc.sortFunc)}var e=t.prototype;return e.clear=function(){this.queue.clear(),this._passPool.reset()},e.insertRenderPass=function(t,e,i){var n=t.model.subModels[e],r=n.passes[i],s=n.shaders[i];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=0|r.priority<<16|n.priority<<8|i,o=this._passPool.add();return o.priority=t.model.priority,o.hash=a,o.depth=t.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},e.sort=function(){this.queue.sort()},e.recordCommandBuffer=function(t,e,i){for(var n=0;n8?q(12004,8):(this._passes=t,this._flushPassInfo(),this._passes[0].batchingScheme===gv.VB_MERGING&&this.subMesh.genFlatBuffers(),this._descriptorSet&&(this._descriptorSet.destroy(),lM.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(lM)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(t){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(t.iaInfo),this._passes[0].batchingScheme===gv.VB_MERGING&&this.subMesh.genFlatBuffers(),this._subMesh=t}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"inputAssembler",get:function(){return this._inputAssembler}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"worldBoundDescriptorSet",get:function(){return this._worldBoundDescriptorSet}},{key:"patches",get:function(){return this._patches}},{key:"planarInstanceShader",get:function(){return this._planarInstanceShader}},{key:"planarShader",get:function(){return this._planarShader}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}}]),t}(),_M=new hn,fM=[{name:"CC_RECEIVE_SHADOW",value:!0}],dM=[{name:"CC_USE_LIGHTMAP",value:!0}];!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.SKINNING=1]="SKINNING",t[t.BAKED_SKINNING=2]="BAKED_SKINNING",t[t.BATCH_2D=3]="BATCH_2D",t[t.PARTICLE_BATCH=4]="PARTICLE_BATCH",t[t.LINE=5]="LINE"}(oM||(oM={}));var pM=new zr(zn.LINEAR,zn.LINEAR,zn.NONE,Hn.CLAMP,Hn.CLAMP,Hn.CLAMP),mM=new zr(zn.LINEAR,zn.LINEAR,zn.LINEAR,Hn.CLAMP,Hn.CLAMP,Hn.CLAMP),gM=function(){function t(){this.type=oM.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._device=void 0,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(Dp.COUNT),this._localBuffer=null,this._lightmap=null,this._lightmapUVParam=new Ni,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._shadowBias=0,this._shadowNormalBias=0,this._enabled=!0,this._visFlags=Qd.Enum.NONE,this._priority=0,this._device=Qa.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Qd.Enum.NONE,this._inited=!0)},e.destroy=function(){for(var t=this._subModels,e=0;e=0?a.updateInstancedWorldMatrix(n,o):r=!0}r&&this._localBuffer&&(hn.toArray(this._localData,n,Dp.MAT_WORLD_OFFSET),hn.inverseTranspose(_M,n),hn.toArray(this._localData,_M,Dp.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds=Lh.fromPoints(Lh.create(),t,e),this._worldBounds=Lh.clone(this._modelBounds))},e._createSubModel=function(){return new cM},e.initSubModel=function(t,e,i){this.initialize(),null==this._subModels[t]?this._subModels[t]=this._createSubModel():this._subModels[t].destroy(),this._subModels[t].initialize(e,i.passes,this.getMacroPatches(t)),this._subModels[t].initPlanarShadowShader(),this._subModels[t].initPlanarShadowInstanceShader(),this._updateAttributesAndBinding(t)},e.setSubModelMesh=function(t,e){this._subModels[t]&&(this._subModels[t].subMesh=e)},e.setSubModelMaterial=function(t,e){this._subModels[t]&&(this._subModels[t].passes=e.passes,this._updateAttributesAndBinding(t))},e.onGlobalPipelineStateChanged=function(){for(var t=this._subModels,e=0;e1?mM:pM),r=this._subModels,s=0;s1?2:1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},u(e,[{key:"direction",get:function(){return this._dir},set:function(t){ji.normalize(this._dir,t)}},{key:"illuminance",get:function(){return C.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){C.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=t:this.illuminanceLDR=t}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(t){this._illuminanceHDR=t}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(t){this._illuminanceLDR=t}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t,this._activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t,this._activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(t){this._shadowSaturation=t}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(t){this._shadowDistance=Math.min(t,FT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,FT.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(t){this._csmLevel=t,this._activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(t){this._csmNeedUpdate=t}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(t){this._csmLayerLambda=t}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(t){this._csmOptimizationMode=t}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(t){this._shadowFixedArea=t,this._activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(t){this._shadowNear=t}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(t){this._shadowFar=Math.min(t,FT.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}}]),e}(OB),bM=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Lh.create(),e._pos=new ji,e._type=yB.SPHERE,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/MB(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Lh.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},u(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return C.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){C.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(OB),TM=new ji(0,0,-1),EM=new $i,CM=new hn,wM=new hn,xM=new hn,RM=new hn,IM=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ji(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._pos=void 0,e._aabb=void 0,e._frustum=void 0,e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=DT.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=Lh.create(),e._frustum=Kh.create(),e._pos=new ji,e._type=yB.SPOT,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/MB(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new ji(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),ji.transformQuat(this._dir,TM,this._node.getWorldRotation(EM)),ji.normalize(this._dir,this._dir),Lh.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(CM),hn.invert(CM,CM),hn.perspective(wM,this._angle,1,.001,this._range),hn.multiply(xM,wM,CM),this._frustum.update(xM,RM),this._needUpdate=!1)},u(e,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(t){this._size=t}},{key:"range",get:function(){return this._range},set:function(t){this._range=t,this._needUpdate=!0}},{key:"luminance",get:function(){return C.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){C.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(OB),BM=Object.freeze({__proto__:null,get CameraFOVAxis(){return QA},get CameraProjection(){return $A},get CameraAperture(){return tS},get CameraISO(){return eS},get CameraShutter(){return iS},get CameraType(){return nS},get TrackingType(){return rS},SKYBOX_FLAG:Mb,Camera:Fb,get ModelType(){return oM},Model:gM,SubModel:cM,Ambient:RT,EnvironmentLightingType:VT,Skybox:kT,ShadowSize:IT,ShadowType:BT,PCFType:DT,CSMLevel:PT,CSMOptimizationMode:MT,Shadows:FT,FogType:Lw,Fog:kw,Octree:yM,ColorTemperatureToRGB:bB,get LightType(){return yB},nt2lm:MB,Light:OB,DirectionalLight:SM,SphereLight:bM,SpotLight:IM}),DM=new da((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),PM=new Float32Array(4),MM=[],OM=[],FM=new hn,NM=new hn;function LM(t,e){return!(!e.worldBounds||Ch.aabbWithAABB(e.worldBounds,t.aabb))}function VM(t,e){return!(!e.worldBounds||Ch.aabbWithAABB(e.worldBounds,t.aabb)&&Ch.aabbFrustum(e.worldBounds,t.frustum))}var kM=Av("forward-add"),GM=[];function UM(t,e){e.length=0;for(var i=!1,n=0;nthis._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Ii(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new Nr(this._lightBuffer,0,Fp.SIZE)));for(var o=0,h=0;o-1&&this.additiveInstanceQueues.splice(e,1)},i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n=0;h--){var u=r.array[h];if(u){var l=u.model;l.enabled&&l.node&&(o&l.node.layer)===l.node.layer&&null!=a&&l.castShadow&&l.worldBounds&&Ch.aabbFrustum(l.worldBounds,s)&&(a.push(u),i.level0?.5*(1-Math.floor(a/2))*h.y:.5*Math.floor(a/2)*h.y,this._renderArea.width=.5*h.x,this._renderArea.height=.5*h.y}break;case yB.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=h.x,this._renderArea.height=h.y}var c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,mO,t.clearDepth,t.clearStencil),s.bindDescriptorSet(lp.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,c,s),s.endRenderPass()}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new pO(e)},e}(iD),uO.initInfo={name:"ShadowStage",priority:pD.FORWARD,tag:0},hO=lO))||hO),yO=[],vO=t("ShadowFlow",_u("ShadowFlow")((fO=_O=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=(pp.COUNT+mp.COUNT+gp.COUNT+yp.COUNT)/4,e.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=e.pipelineSceneData.csmSupported,e.macros.CC_SHADOW_TYPE=0,e.macros.CC_DIR_SHADOW_PCF_TYPE=DT.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData.shadows,n=e.pipelineSceneData.csmLayers,r=e.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===BT.ShadowMap){for(var o=0,h=0;or.x?i[h]:r.x,r.y=i[h+1]>r.y?i[h+1]:r.y,s.x=i[h]r.x?i[h]:r.x,r.y=i[h+1]>r.y?i[h+1]:r.y,r.z=i[h+2]>r.z?i[h+2]:r.z,s.x=i[h]1&&t.csmOptimizationMode===MT.RemoveDuplicates)if(this._level>=h-1)BF=this._castLightViewBoundingBox.halfExtents.z,IF=this._castLightViewBoundingBox.center.z;else{var u=Math.abs(this._castLightViewBoundingBox.center.z-IF)+BF;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,u)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(RF.set(c.x,c.y,c.z+l+r),ji.transformMat4(RF,RF,pF),hn.fromRT(pF,t.node.rotation,RF),hn.invert(mF,pF),!i){var _=.5*s,f=.5*a;hn.ortho(gF,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),hn.multiply(vF,gF,o),ji.transformMat4(bF,RF,vF);var d=2/e;TF.set(d,d);var p=bF.x%TF.x,m=bF.y%TF.y;EF.set(bF.x-p,bF.y-m,bF.z),hn.invert(AF,vF),ji.transformMat4(CF,EF,AF),hn.fromRT(pF,t.node.rotation,CF),hn.invert(mF,pF),hn.multiply(yF,gF,mF),hn.copy(this._matShadowView,mF),hn.copy(this._matShadowProj,gF),hn.copy(this._matShadowViewProj,yF)}Kh.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,pF)},u(t,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(t){this._shadowCameraFar=t}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(t){this._matShadowView=t}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(t){this._matShadowProj=t}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(t){this._matShadowViewProj=t}},{key:"validFrustum",get:function(){return this._validFrustum}},{key:"splitFrustum",get:function(){return this._splitFrustum}},{key:"lightViewFrustum",get:function(){return this._lightViewFrustum}},{key:"castLightViewBoundingBox",get:function(){return this._castLightViewBoundingBox}}]),t}(),PF=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new Ni,i._calculateAtlas(e),i}c(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=C.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},u(e,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(t){this._splitCameraNear=t}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(t){this._splitCameraFar=t}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(t){this._csmAtlas=t}}]),e}(DF),MF=function(){function t(){this._castShadowObjects=[],this._layerObjects=new ma(64),this._layers=[],this._levelCount=0,this._specialLayer=new DF(1),this._shadowDistance=0;for(var t=0;t1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(dF,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,h=a.splitCameraFar;a.calculateSplitFrustum(t,dF,o,h),a.createMatrix(e,r,!1)}n===PT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,hn.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),hn.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),hn.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,dF,.1,e.shadowDistance),this._specialLayer.createMatrix(e,r,!0))}},e._getCameraWorldMatrix=function(t,e){if(e.node){var i=e.node,n=i.getWorldPosition(),r=i.getWorldRotation();hn.fromRT(t,r,n),t.m08*=-1,t.m09*=-1,t.m10*=-1}},u(t,[{key:"castShadowObjects",get:function(){return this._castShadowObjects}},{key:"layerObjects",get:function(){return this._layerObjects}},{key:"layers",get:function(){return this._layers}},{key:"specialLayer",get:function(){return this._specialLayer}}]),t}(),OF=t("PipelineSceneData",function(){function t(){this.fog=new kw,this.ambient=new RT,this.skybox=new kT,this.shadows=new FT,this.csmLayers=new MF,this.octree=new yM,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._shadingScale=1}var e=t.prototype;return e.activate=function(t){return this._device=t,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},e.initGeometryRendererMaterials=function(){for(var t=0,e=0;e<6;e++){this._geometryRendererMaterials[e]=new Wv,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"builtin-geometry-renderer",technique:e});for(var i=0;i0&&(this._occlusionQueryShader=t.passes[0].getShaderVariant())}},e.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},e.updatePipelineSceneData=function(){},e.destroy=function(){var t,e,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null===(t=this._occlusionQueryInputAssembler)||void 0===t||t.destroy(),this._occlusionQueryInputAssembler=null,null===(e=this._occlusionQueryVertexBuffer)||void 0===e||e.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||i.destroy(),this._occlusionQueryIndicesBuffer=null},e._createOcclusionQueryIA=function(){var t=this._device,e=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1]),i=3*Float32Array.BYTES_PER_ELEMENT,n=8*i;this._occlusionQueryVertexBuffer=t.createBuffer(new Fr(Pn.VERTEX|Pn.TRANSFER_DST,Fn.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,a=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new Fr(Pn.INDEX|Pn.TRANSFER_DST,Fn.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new Qr("a_position",In.RGB32F)],h=new ts(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(h)},u(t,[{key:"isHDR",get:function(){return this._isHDR},set:function(t){this._isHDR=t}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(t){this._shadingScale=t}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(t){this._csmSupported=t}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),FF=t("ForwardPipeline",(BO=_u("ForwardPipeline"),DO=qu([ZP]),PO=Uu(),BO((NO=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){this._renderQueues.forEach(aM);for(var b=0;b0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new _s(u.localSetLayout)),this._localUBO=i.createBuffer(new Fr(Pn.UNIFORM|Pn.TRANSFER_DST,Fn.DEVICE,Dp.SIZE,Dp.SIZE)),this._stageDesc.bindBuffer(Dp.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(lp.MATERIAL,u.descriptorSet),r.bindDescriptorSet(lp.LOCAL,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,h),zv(i,h,r,e.profiler,t),r.endRenderPass()},e}(iD),cF.initInfo={name:"PostProcessStage",priority:dD.POST_PROCESS,tag:0},uF=S((hF=_F).prototype,"_postProcessMaterial",[nF,Au,rF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),lF=S(hF.prototype,"renderQueues",[sF,Au,aF],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),oF=hF))||oF));!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(fF||(fF={}));var zF,HF,WF,XF,jF,YF,qF,KF,JF=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>=1,this._renderArea.height>>=1;var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial.passes[0],r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(QF.COUNT);a[QF.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,ZF,0,0),i.bindDescriptorSet(lp.GLOBAL,e.descriptorSet),n.descriptorSet.bindBuffer(0,this._bloomUBO[0]),n.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),n.descriptorSet.bindSampler(1,s.sampler),n.descriptorSet.update(),i.bindDescriptorSet(lp.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,h=null,u=n.getShaderVariant();null!=n&&null!=u&&null!=o&&(h=xv.getOrCreatePipelineState(e.device,n,u,s.renderPass,o)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData().bloom,s=new Float32Array(QF.COUNT),a=0;a>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,ZF,0,0);var o=n.passes[1+a],h=o.getShaderVariant();o.descriptorSet.bindBuffer(0,this._bloomUBO[a+1]),0===a?o.descriptorSet.bindTexture(1,r.prefiterTex):o.descriptorSet.bindTexture(1,r.downsampleTexs[a-1]),o.descriptorSet.bindSampler(1,r.sampler),o.descriptorSet.update(),i.bindDescriptorSet(lp.MATERIAL,o.descriptorSet);var u=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=h&&null!=u&&(l=xv.getOrCreatePipelineState(e.device,o,h,r.renderPass,u)),null!=l&&(i.bindPipelineState(l),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()}},i._upsamplePass=function(t,e){var i=e.getPipelineRenderData().bloom;e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=e.commandBuffers[0],r=e.pipelineSceneData.bloomMaterial,s=new Float32Array(QF.COUNT),a=0;a=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();pN._ins=void 0,C.internal.SplashScreen=pN;var mN=new St("Scheduler"),gN=function(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n};gN.get=function(t,e,i,n){var r=gN._listEntries.pop();return r?(r.target=t,r.priority=e,r.paused=i,r.markedForDeletion=n):r=new gN(t,e,i,n),r},gN.put=function(t){gN._listEntries.length<20&&(t.target=null,gN._listEntries.push(t))},gN._listEntries=[];var yN=function(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n};yN.get=function(t,e,i,n){var r=yN._hashUpdateEntries.pop();return r?(r.list=t,r.entry=e,r.target=i,r.callback=n):r=new yN(t,e,i,n),r},yN.put=function(t){yN._hashUpdateEntries.length<20&&(t.list=t.entry=t.target=t.callback=null,yN._hashUpdateEntries.push(t))},yN._hashUpdateEntries=[];var vN=function(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s};vN.get=function(t,e,i,n,r,s){var a=vN._hashTimerEntries.pop();return a?(a.timers=t,a.target=e,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new vN(t,e,i,n,r,s),a},vN.put=function(t){vN._hashTimerEntries.length<20&&(t.timers=t.target=t.currentTimer=null,vN._hashTimerEntries.push(t))},vN._hashTimerEntries=[];var AN=function(){function t(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null,this._callback=null}var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===C.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler.unschedule(this._callback,this._target)},t}();AN._timers=[],AN.get=function(){return AN._timers.pop()||new AN},AN.put=function(t){AN._timers.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,AN._timers.push(t))};var SN=t("Scheduler",function(t){function e(){var e;return(e=t.call(this)||this)._timeScale=void 0,e._updatesNegList=void 0,e._updates0List=void 0,e._updatesPosList=void 0,e._hashForUpdates=void 0,e._hashForTimers=void 0,e._currentTarget=void 0,e._currentTargetSalvaged=void 0,e._updateHashLocked=void 0,e._arrayForTimers=void 0,e._timeScale=1,e._updatesNegList=[],e._updates0List=[],e._updatesPosList=[],e._hashForUpdates=Mt(!0),e._hashForTimers=Mt(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}c(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.__instanceId?j(1513):t.id=mN.getNewId())};var i=e.prototype;return i.setTimeScale=function(t){this._timeScale=t},i.getTimeScale=function(){return this._timeScale},i.update=function(t){var e,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(t*=this._timeScale),e=0,n=(i=this._updatesNegList).length;e=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}else q(1510)}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else q(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(i){var n=i.timers;n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)i=r[e],this.unscheduleAllForTarget(i.target);var s=0;if(t<0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&e++;if(t<=0)for(e=0;e=t&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&e++},i.isScheduled=function(t,e){Z(t,1508),Z(e,1509);var i=e.uuid||e.id;if(!i)return q(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s=t&&(r.paused=!0,s.push(r.target));if(t<=0)for(i=0;i=t&&(r.paused=!0,s.push(r.target));return s},i.resumeTargets=function(t){if(t)for(var e=0;e1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0);for(var e=0;e0){this._device.acquire([Qa.swapchain]);var s=this._scenes,a=C.director.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o0?(this._fixedFPS=t,this._fixedFPSFrameTime=1e3/t):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}}]),t}());C.Root=wN;var xN=function(){function t(){this._rafHandle=0,this._stHandle=0,this._onTick=null,this._targetFrameRate=60,this._frameTime=0,this._startTime=0,this._isPlaying=!1,this._rAF=void 0,this._cAF=void 0,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime.bind(this),this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame||this._ctTime.bind(this)}var e=t.prototype;return e.start=function(){var t=this;this._isPlaying||(60===this._targetFrameRate?this._rafHandle=this._rAF.call(window,(function e(){t._isPlaying&&(t._rafHandle=t._rAF.call(window,e)),t._onTick&&t._onTick()})):(this._startTime=performance.now(),this._stHandle=this._stTime((function e(){t._startTime=performance.now(),t._isPlaying&&(t._stHandle=t._stTime(e)),t._onTick&&t._onTick()}))),this._isPlaying=!0)},e.stop=function(){this._isPlaying&&(this._cAF.call(window,this._rafHandle),this._ctTime(this._stHandle),this._rafHandle=this._stHandle=0,this._isPlaying=!1)},e._stTime=function(t){var e=performance.now(),i=Math.max(0,e-this._startTime),n=Math.max(0,this._frameTime-i);return setTimeout(t,n)},e._ctTime=function(t){clearTimeout(t)},u(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),RN=new(function(){function t(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var e=t.prototype;return e.addRenderer=function(t){-1===t._internalId&&(t._internalId=this._allRenderers.length,this._allRenderers.push(t))},e.removeRenderer=function(t){if(-1!==t._internalId){var e=t._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=e,le.array.fastRemoveAt(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(le.array.fastRemove(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers.length,e=this._dirtyRenderers,i=0;ithis._startTime?(t-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=t,this._deltaTime},n._updateCallback=function(){var t=this;if(this._inited)if(pN.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=ve.querySettings(ye.Category.LAUNCH,"launchScene");i?BN.loadScene(i,(function(){var e;console.log("Success to load scene: "+i),t._initTime=performance.now(),BN.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),BN.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else BN.tick(this._calculateDT());else pN.instance.update(this._calculateDT())},n.initPacer=function(){var t,e=null!==(t=ve.querySettings(ye.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;V("number"==typeof e),this._pacer=new xN,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},n._initEvents=function(){za.on("show",this._onShow,this),za.on("hide",this._onHide,this)},n._onHide=function(){this.emit(i.EVENT_HIDE),this.pause()},n._onShow=function(){this.emit(i.EVENT_SHOW),this.resume()},n.addPersistRootNode=function(t){BN.addPersistRootNode(t)},n.removePersistRootNode=function(t){BN.removePersistRootNode(t)},n.isPersistRootNode=function(t){return BN.isPersistRootNode(t)},n._setupRenderPipeline=function(){var t=this,e=ve.querySettings(ye.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){dv.loadAny(e,(function(e,n){return!e&&n instanceof KP?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){N(i),N("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},n._setRenderPipeline=function(t){BN.root.setRenderPipeline(t)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},n._safeEmit=function(t){this.emit(t)},u(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(t){"number"!=typeof t&&(t=parseInt(t,10),Number.isNaN(t)&&(t=60)),this._frameRate=t,this.frameTime=1e3/t,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(Ma));DN.EVENT_HIDE="game_on_hide",DN.EVENT_SHOW="game_on_show",DN.EVENT_LOW_MEMORY="game_on_low_memory",DN.EVENT_GAME_INITED="game_inited",DN.EVENT_ENGINE_INITED="engine_inited",DN.EVENT_RENDERER_INITED="renderer_inited",DN.EVENT_PRE_BASE_INIT="pre_base_init",DN.EVENT_POST_BASE_INIT="post_base_init",DN.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",DN.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",DN.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",DN.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",DN.EVENT_PRE_PROJECT_INIT="pre_project_init",DN.EVENT_POST_PROJECT_INIT="post_project_init",DN.EVENT_RESTART="game_on_restart",DN.RENDER_TYPE_CANVAS=0,DN.RENDER_TYPE_WEBGL=1,DN.RENDER_TYPE_OPENGL=2,DN.RENDER_TYPE_HEADLESS=3,DN.DEBUG_DT_THRESHOLD=1,C.Game=DN;var PN=t("game",C.game=new DN),MN={};et(MN,"vmath",[{name:"vec2",newName:"Vec2",target:Tn,targetName:"math"},{name:"vec3",newName:"Vec3",target:Tn,targetName:"math"},{name:"vec4",newName:"Vec4",target:Tn,targetName:"math"},{name:"quat",newName:"Quat",target:Tn,targetName:"math"},{name:"mat3",newName:"Mat3",target:Tn,targetName:"math"},{name:"mat4",newName:"Mat4",target:Tn,targetName:"math"},{name:"color4",newName:"Color",target:Tn,targetName:"math"},{name:"rect",newName:"Rect",target:Tn,targetName:"math"},{name:"approx",newName:"approx",target:Tn,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Tn,targetName:"math"},{name:"equals",newName:"equals",target:Tn,targetName:"math"},{name:"clamp",newName:"clamp",target:Tn,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Tn,targetName:"math"},{name:"lerp",newName:"lerp",target:Tn,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Tn,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Tn,targetName:"math"},{name:"random",newName:"random",target:Tn,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Tn,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Tn,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Tn,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Tn,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Tn,targetName:"math"},{name:"repeat",newName:"repeat",target:Tn,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Tn,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Tn,targetName:"math"}]),C.vmath=MN,et(SN.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:SN,targetName:"Scheduler"}]),et(SN,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return KA.Priority.SCHEDULER}}]),it(SN,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),et(cM.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),it(cM.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]),et(wN.prototype,"Root.prototype",[{name:"ui",newName:"batcher2D"}]),nt(PN,"game",[{name:"collisionMatrix"},{name:"groupList"}]),nt(IN.prototype,"director",[{name:"calculateDeltaTime"},{name:"getDeltaTime",suggest:"Use game.deltaTime instead"},{name:"getTotalTime",suggest:"Use game.totalTime instead"},{name:"getCurrentTime",suggest:"Use game.frameStartTime instead"}]),it(IN.prototype,"director",[{name:"setAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getRunningScene",suggest:"please use getScene instead"},{name:"setDepthTest",suggest:"please use camera API instead"},{name:"setClearColor",suggest:"please use camera API instead"},{name:"getWinSize",suggest:"please use view.getVisibleSize instead"},{name:"getWinSizeInPixels"},{name:"purgeCachedData",suggest:"please use assetManager.releaseAll instead"},{name:"convertToGL"},{name:"convertToUI"}]);var ON,FN={topLeft:C.v2(0,0),topRight:C.v2(0,0),top:C.v2(0,0),bottomLeft:C.v2(0,0),bottomRight:C.v2(0,0),bottom:C.v2(0,0),center:C.v2(0,0),left:C.v2(0,0),right:C.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,a=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+e/2,this.top.y=s,this.bottomLeft.x=n,this.bottomLeft.y=r,this.bottomRight.x=a,this.bottomRight.y=r,this.bottom.x=n+e/2,this.bottom.y=r,this.center.x=n+e/2,this.center.y=r+i/2,this.left.x=n,this.left.y=r+i/2,this.right.x=a,this.right.y=r+i/2}};C.visibleRect=FN;var NN=new gn,LN=((ON={})[Ae.ORIENTATION_AUTO]=Ua.AUTO,ON[Ae.ORIENTATION_LANDSCAPE]=Ua.LANDSCAPE,ON[Ae.ORIENTATION_PORTRAIT]=Ua.PORTRAIT,ON),VN=t("View",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=void 0,e._scaleX=void 0,e._scaleY=void 0,e._viewportRect=void 0,e._visibleRect=void 0,e._autoFullScreen=void 0,e._retinaEnabled=void 0,e._resizeCallback=void 0,e._resolutionPolicy=void 0,e._rpExactFit=void 0,e._rpShowAll=void 0,e._rpNoBorder=void 0,e._rpFixedHeight=void 0,e._rpFixedWidth=void 0;var i=kN,n=GN;return e._designResolutionSize=new gn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=new vn(0,0,0,0),e._visibleRect=new vn(0,0,0,0),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null,e._rpExactFit=new UN(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new UN(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new UN(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new UN(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new UN(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}c(e,t);var i=e.prototype;return i.init=function(){var t=Ya.windowSize,e=t.width,i=t.height;this._designResolutionSize.width=e,this._designResolutionSize.height=i,this._viewportRect.width=e,this._viewportRect.height=i,this._visibleRect.width=e,this._visibleRect.height=i,NN.width=this._visibleRect.width,NN.height=this._visibleRect.height,FN&&FN.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=ve.querySettings(ye.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||UN.FIXED_HEIGHT),Xa.on("window-resize",this._updateAdaptResult,this),Xa.on("orientation-change",this._updateAdaptResult,this),Xa.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){Xa.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){Xa.orientation=LN[t]},i.adjustViewportMeta=function(){},i.enableRetina=function(t){this._retinaEnabled=!!t},i.isRetinaEnabled=function(){return this._retinaEnabled},i.enableAutoFullScreen=function(t){t!==this._autoFullScreen&&(this._autoFullScreen=t,t&&Ya.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){Xa.resolutionScale=1;var i=Xa.devicePixelRatio,n=new gn(t*i,e*i);Ya.windowSize=n},i.getCanvasSize=function(){return Ya.windowSize},i.getFrameSize=function(){var t=Xa.devicePixelRatio,e=Ya.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=Xa.devicePixelRatio;Ya.windowSize=new gn(t*i,e*i)},i.getVisibleSize=function(){return new gn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new gn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new _n(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new _n(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof UN)this._resolutionPolicy=t;else{var e=UN;t===e.EXACT_FIT&&(this._resolutionPolicy=this._rpExactFit),t===e.SHOW_ALL&&(this._resolutionPolicy=this._rpShowAll),t===e.NO_BORDER&&(this._resolutionPolicy=this._rpNoBorder),t===e.FIXED_HEIGHT&&(this._resolutionPolicy=this._rpFixedHeight),t===e.FIXED_WIDTH&&(this._resolutionPolicy=this._rpFixedWidth)}},i.setResolutionPolicy=function(t){this._updateResolutionPolicy(t);var e=zN.getDesignResolutionSize();zN.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),NN.width=this._visibleRect.width,NN.height=this._visibleRect.height,FN&&FN.init(this._visibleRect),this.emit("design-resolution-changed")}else q(2200)},i.getDesignResolutionSize=function(){return new gn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return Xa.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new _n);var r=Xa.devicePixelRatio*(t-i.left),s=Xa.devicePixelRatio*(i.top+i.height-e);return Xa.isFrameRotated?(n.x=Ya.windowSize.width-s,n.y=r):(n.x=r,n.y=s),n},i._convertToUISpace=function(t){var e=this._viewportRect;t.x=(t.x-e.x)/this._scaleX,t.y=(t.y-e.y)/this._scaleY},i._updateAdaptResult=function(){var t;C.director.root.resize(Ya.windowSize.width,Ya.windowSize.height);var e=this._designResolutionSize.width,i=this._designResolutionSize.height;e>0&&this.setDesignResolutionSize(e,i,this._resolutionPolicy),this.emit("canvas-resize"),null===(t=this._resizeCallback)||void 0===t||t.call(this)},e}(Pa(KA)));VN.instance=void 0;var kN=function(){function t(){this.name="ContainerStrategy"}var e=t.prototype;return e.preApply=function(){},e.apply=function(){},e.postApply=function(){},e._setupCanvas=function(){var t=C.game.canvas;if(t){var e=Ya.windowSize;t.width=e.width,t.height=e.height}},t}();kN.EQUAL_TO_FRAME=void 0,kN.PROPORTION_TO_FRAME=void 0;var GN=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new vn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();GN.EXACT_FIT=void 0,GN.SHOW_ALL=void 0,GN.NO_BORDER=void 0,GN.FIXED_HEIGHT=void 0,GN.FIXED_WIDTH=void 0,function(){var t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1){var u=Object.create(null);e.forEach((function(t){u[t._uuid]=t})),r={isCompleted:XN,_map:u}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return dv.assets.has(t)?{content:dv.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,h=Pl(t);h&&!gy.getInfoWithPath(t,s)&&(t=t.slice(0,-h.length)),gy.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=Pl(e);n&&!gy.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),gy.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;gy.loadDir(t,s,a,(function(e,i){var n=[];e||(n=gy.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return el.has(t)?el.get(t):gy.get(t,e)},e.getResCount=function(){return el.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return Ig.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(i){var n=t[i];e["."+i]=function(t,e,i){n({url:t},i)}};for(var n in t)i(n);ky.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(i){var n=t[i];e["."+i]=function(t,e,i){n({content:t},i)}};for(var n in t)i(n);rv.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;ethis._width&&(this._x=2,this._y=this._nexty),this._y+o+2>this._nexty&&(this._nexty=this._y+o+2),this._nexty>this._height)return null;C.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var h={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),h},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nexty=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e=0;i--)e=this._atlases[i],le.array.fastRemove(e._innerSpriteFrames,t);var n=t._original._texture;this.deleteAtlasTexture(n)}},i.deleteAtlasTexture=function(t){if(t)for(var e=this._atlases.length-1;e>=0;e--)this._atlases[e].deleteInnerTexture(t),this._atlases[e].isEmpty()&&(this._atlases[e].destroy(),this._atlases.splice(e,1),this._atlasIndex--)},i.packToDynamicAtlas=function(t,e){if(this._enabled&&e&&!e._original&&e.packable&&e.texture&&e.texture.width>0&&e.texture.height>0){var i=this.insertSpriteFrame(e);i&&e._setDynamicAtlasFrame(i)}},u(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),C.director.on(C.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),C.director.off(C.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)),this._enabled=t)}},{key:"maxAtlasCount",get:function(){return this._maxAtlasCount},set:function(t){this._maxAtlasCount=t}},{key:"atlasCount",get:function(){return this._atlases.length}},{key:"textureBleeding",get:function(){return this._textureBleeding},set:function(t){this._textureBleeding=t}},{key:"textureSize",get:function(){return this._textureSize},set:function(t){this._textureSize=t}},{key:"maxFrameSize",get:function(){return this._maxFrameSize},set:function(t){this._maxFrameSize=t}}]),e}(KA);TL.instance=void 0;var EL,CL=t("dynamicAtlasManager",TL.instance=new TL);BN.registerSystem("dynamicAtlasManager",CL,0),C.internal.dynamicAtlasManager=CL,function(t){t[t.positions=gr.ATTR_POSITION]="positions",t[t.normals=gr.ATTR_NORMAL]="normals",t[t.uvs=gr.ATTR_TEX_COORD]="uvs",t[t.colors=gr.ATTR_COLOR]="colors"}(EL||(EL={}));var wL,xL,RL,IL,BL,DL,PL=function(){function t(){this._arrayBufferOrPaddings=[],this._length=0}var e=t.prototype;return e.setNextAlignment=function(t){if(0!==t){var e=this._length%t;if(0!==e){var i=t-e;this._arrayBufferOrPaddings.push(i),this._length+=i}}},e.addBuffer=function(t){var e=this._length;return this._arrayBufferOrPaddings.push(t),this._length+=t.byteLength,e},e.getLength=function(){return this._length},e.getCombined=function(){var t=new Uint8Array(this._length),e=0;return this._arrayBufferOrPaddings.forEach((function(i){"number"==typeof i?e+=i:(t.set(new Uint8Array(i),e),e+=i.byteLength)})),t.buffer},t}(),ML=function(){function t(t,e){if(this._mesh=void 0,this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;nUp.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new FL(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new OL(this._mesh,n,this._mesh.struct.morph,e))}}}return t.prototype.createInstance=function(){for(var t=this,e=this._mesh.struct.primitives.length,i=new Array(e),n=0;n>1;return{width:1<<(1&e?n+1:n),height:1<=65536){j(10001,_,65536);continue}l>>=1,c>>=1}o=i.createBuffer(new Fr(Pn.INDEX,Fn.DEVICE,c,l)),h=new(GL(u.stride))(e,u.offset,u.count),u.stride!==l&&(h=GL(l).from(h)),o.update(h)}var f=a.vertexBundelIndices.map((function(t){return n[t]})),d=[];if(a.vertexBundelIndices.length>0)for(var p=a.vertexBundelIndices[0],m=t._struct.vertexBundles[p].attributes,g=0;g=this._struct.primitives.length)j(14201);else{var i=[];if(e.positions.length>0&&i.push(e.positions),e.normals&&e.normals.length>0&&i.push(e.normals),e.uvs&&e.uvs.length>0&&i.push(e.uvs),e.tangents&&e.tangents.length>0&&i.push(e.tangents),e.colors&&e.colors.length>0&&i.push(e.colors),e.customAttributes)for(var n=0;n0&&(p.set(m),g.update(m,d)),c.view.count=f,h.vertexCount=f}if(a.indexView){var y=a.indexView,A=y.stride,S=2===A?e.indices16.length:e.indices32.length,b=S*A,T=new Uint8Array(this._data.buffer,y.offset,b),E=2===A?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,b):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,b),C=o.indexBuffer;s.maxSubMeshIndices,b>0&&(T.set(E),C.update(E,b)),y.count=S,h.indexCount=S}if(e.minPos&&e.maxPos){var w=new ji(e.minPos.x,e.minPos.y,e.minPos.z),x=new ji(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Lh),Lh.fromPoints(r.bounds[t],w,x);for(var R,I=new ji,B=new ji,D=v(r.bounds);!(R=D()).done;){var P=R.value;P&&(P.getBoundary(I,B),ji.min(w,I,w),ji.max(x,B,x))}this._struct.minPosition=new ji(w.x,w.y,w.z),this._struct.maxPosition=new ji(x.x,x.y,x.z)}o.invalidateGeometricInfo()}else j(14200)},i.destroy=function(){return this.destroyRenderingMesh(),t.prototype.destroy.call(this)},i.destroyRenderingMesh=function(){if(this._renderingSubMeshes){for(var t=0;t=n.length)){ji.transformMat4(zL,UL,n[d]),i[d]=!0;var p=e[d];ji.min(p.center,p.center,zL),ji.max(p.halfExtents,p.halfExtents,zL)}}}}for(var m=0;m=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?In.R8UI:2===i.indexView.stride?In.R16UI:In.R32UI,s=qL(new DataView(this._data.buffer),r),a=0;a=this._struct.primitives.length))for(var n,r=v(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new Fr(Pn.VERTEX,Fn.DEVICE,i.view.length,i.view.stride)),r=new Uint8Array(e,i.view.offset,i.view.length);return n.update(r),n}))},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.reset({struct:{vertexBundles:[],primitives:[]},data:HL})},i.releaseData=function(){this._data=HL},u(e,[{key:"_nativeAsset",get:function(){return this._data.buffer},set:function(t){this._data=new Uint8Array(t)}},{key:"subMeshCount",get:function(){var t=this.renderingSubMeshes;return t?t.length:0}},{key:"minPosition",get:function(){return this.struct.minPosition}},{key:"maxPosition",get:function(){return this.struct.maxPosition}},{key:"struct",get:function(){return this._struct}},{key:"data",get:function(){return this._data}},{key:"hash",get:function(){return this._hash||(this._hash=Hs(this._data,666)),this._hash}},{key:"jointBufferIndices",get:function(){return this._jointBufferIndices?this._jointBufferIndices:this._jointBufferIndices=this._struct.primitives.map((function(t){return t.jointMapIndex||0}))}},{key:"renderingSubMeshes",get:function(){return this.initialize(),this._renderingSubMeshes}},{key:"allowDataAccess",get:function(){return this._allowDataAccess},set:function(t){this._allowDataAccess=t,this._isMeshDataUploaded&&!this._allowDataAccess&&this.releaseData()}}]),e}(Wl),RL=S((xL=DL).prototype,"_struct",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{vertexBundles:[],primitives:[]}}}),IL=S(xL.prototype,"_hash",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),BL=S(xL.prototype,"_allowDataAccess",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),wL=xL))||wL;function XL(t,e){for(var i=0,n=0;n0){if(n=null,t.attributes)for(var u,l=v(t.attributes);!(u=l()).done;){var c=u.value;if(c.name===gr.ATTR_POSITION){n=c;break}}n||(n=$L[0]),r.push(n);var _=Ts[n.format];o=Math.max(o,Math.floor(h.length/_.count)),a.push({offset:s,data:h,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,d=v(t.attributes);!(f=d()).done;){var p=f.value;if(p.name===gr.ATTR_NORMAL){n=p;break}}n||(n=$L[1]);var m=Ts[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/m.count)),a.push({offset:s,data:t.normals,attribute:n}),s+=m.size}if(t.uvs&&t.uvs.length>0){if(n=null,t.attributes)for(var g,y=v(t.attributes);!(g=y()).done;){var A=g.value;if(A.name===gr.ATTR_TEX_COORD){n=A;break}}n||(n=$L[2]);var S=Ts[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/S.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=S.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var b,T=v(t.attributes);!(b=T()).done;){var E=b.value;if(E.name===gr.ATTR_TANGENT){n=E;break}}n||(n=$L[3]);var C=Ts[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/C.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=C.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var w,x=v(t.attributes);!(w=x()).done;){var R=w.value;if(R.name===gr.ATTR_COLOR){n=R;break}}n||(n=$L[4]);var I=Ts[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/I.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=I.size}if(t.customAttributes)for(var B=0;Bt.width?(q(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(q(3301,this.name+"/"+t.name,n,t.height),1))},i._calcTrimmedBorder=function(){var t=this._originalSize.width,e=this._originalSize.height,i=.5*(t-this._rect.width),n=.5*(e-this._rect.height);this._trimmedBorder.x=this._offset.x+i,this._trimmedBorder.y=this._offset.x-i,this._trimmedBorder.z=this._offset.y+n,this._trimmedBorder.w=this._offset.y-n},i.ensureMeshData=function(){this._mesh||(this._initVertices(),this._createMesh())},i.destroy=function(){return this._packable&&CL&&CL.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],a=this._capInsets[2],o=t.width-s-a,h=this._capInsets[1],u=this._capInsets[3],l=t.height-h-u,c=this.uvSliced;if(c.length=0,this._rotated){uV[0].u=t.x/n,uV[1].u=(t.x+u)/n,uV[2].u=(t.x+u+l)/n,uV[3].u=(t.x+t.height)/n,uV[3].v=t.y/r,uV[2].v=(t.y+s)/r,uV[1].v=(t.y+s+o)/r,uV[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var f=uV[_],d=0;d<4;++d){var p=uV[3-d];c.push({u:f.u,v:p.v})}}else{uV[0].u=t.x/n,uV[1].u=(t.x+s)/n,uV[2].u=(t.x+s+o)/n,uV[3].u=(t.x+t.width)/n,uV[3].v=t.y/r,uV[2].v=(t.y+h)/r,uV[1].v=(t.y+h+l)/r,uV[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=uV[m],y=0;y<4;++y){var v=uV[y];c.push({u:v.u,v:g.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,h=0===s?0:t.y/s,u=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):this._isFlipUVX?(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u):this._isFlipUVY?(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h):(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u);var l=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,_=0===s?0:t.y/s,f=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=f,i[2]=c,i[3]=_,i[4]=l,i[5]=f,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=f,i[4]=l,i[5]=_,i[6]=l,i[7]=f):this._isFlipUVY?(i[0]=l,i[1]=f,i[2]=l,i[3]=_,i[4]=c,i[5]=f,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=f,i[4]=c,i[5]=_,i[6]=c,i[7]=f)}else{var d=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=d,e[3]=g,e[4]=p,e[5]=m,e[6]=d,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=d,e[3]=m,e[4]=p,e[5]=g,e[6]=d,e[7]=g):this._isFlipUVY?(e[0]=d,e[1]=g,e[2]=p,e[3]=g,e[4]=d,e[5]=m,e[6]=p,e[7]=m):(e[0]=d,e[1]=m,e[2]=p,e[3]=m,e[4]=d,e[5]=g,e[6]=p,e[7]=g);var y=0===r?0:t.x/r,v=0===r?1:(t.x+t.width)/r,A=0===s?1:(t.y+t.height)/s,S=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=v,i[1]=S,i[2]=y,i[3]=S,i[4]=v,i[5]=A,i[6]=y,i[7]=A):this._isFlipUVX?(i[0]=v,i[1]=A,i[2]=y,i[3]=A,i[4]=v,i[5]=S,i[6]=y,i[7]=S):this._isFlipUVY?(i[0]=y,i[1]=S,i[2]=v,i[3]=S,i[4]=y,i[5]=A,i[6]=v,i[7]=A):(i[0]=y,i[1]=A,i[2]=v,i[3]=A,i[4]=y,i[5]=S,i[6]=v,i[7]=S)}this._calculateSlicedUV()},i._setDynamicAtlasFrame=function(t){t&&(this._original={_texture:this._texture,_x:this._rect.x,_y:this._rect.y},this._texture=t.texture,this._rect.x=t.x,this._rect.y=t.y,this._calculateUV())},i._resetDynamicAtlasFrame=function(){this._original&&(this._rect.x=this._original._x,this._rect.y=this._original._y,this._texture=this._original._texture,this._original=null,this._calculateUV())},i._checkPackable=function(){var t=CL;if(t){var e=this._texture;if(e instanceof Kg&&!e.isCompressed){var i=this.width,n=this.height;!e.image||i>t.maxFrameSize||n>t.maxFrameSize?this._packable=!1:e.image&&e.image instanceof HTMLCanvasElement&&(this._packable=!0)}else this._packable=!1}},i._serialize=function(){return null},i._deserialize=function(t){var e=t,i=e.rect;i&&(this._rect=new vn(i.x,i.y,i.width,i.height));var n=e.offset;e.offset&&(this._offset=new _n(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new gn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=new _n(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:new ji(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new ji(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var h=o.rawPosition,u=0;u0){var e=this.spriteFrames[t[0]];return e&&e.texture}return null},i.getSpriteFrame=function(t){var e=this.spriteFrames[t];return e?(e.name||(e.name=t),e):null},i.getSpriteFrames=function(){for(var t=[],e=this.spriteFrames,i=0,n=Object.keys(e);i=this.limit){var n=this.tail;delete this.datas[n.key],this.count--,this.tail=n.prev,this.tail.next=null,n.prev=null,n.next=null,FV.put(n)}this.moveToHead(i)},e.remove=function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,delete this.datas[t.key],this.count--},e.get=function(t){var e=this.datas[t];return e?(this.remove(e),this.moveToHead(e),e.value):null},e.clear=function(){this.count=0,this.datas={},this.head=null,this.tail=null},e.has=function(t){return!!this.datas[t]},e.delete=function(t){var e=this.datas[t];this.remove(e)},t}())(100),VV=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,kV=/^[!,.:;'}\]%\?>、‘“》?。,!]/,GV=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,UV=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,zV=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function HV(t){return/^[\u4E00-\u9FFF\u3400-\u4DFF]+$/.test(t)||/[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g.test(t)||/^[\u1100-\u11FF]|[\u3130-\u318F]|[\uA960-\uA97F]|[\uAC00-\uD7AF]|[\uD7B0-\uD7FF]+$/.test(t)}function WV(t){var e=t.charCodeAt(0);return e>=9&&e<=13||32===e||133===e||160===e||5760===e||e>=8192&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e}function XV(t,e,i){var n=(i||t.font)+"🎮"+e,r=LV.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return LV.put(n,a),a}function jV(t,e,i){var n=e,r=i,s=t[e];if(s>="\udc00"&&s<="\udfff"&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];a>="\ud800"&&a<="\udbff"&&r--}else s>="\ud800"&&s<="\udbff"&&r++;return t.substring(n,r)}function YV(t){return zV.exec(t)}function qV(t){return UV.exec(t)}function KV(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=jV(s,a),h=e-n(o),u=o,l=0,c=0;h>i&&c++<100;)a*=i/h,h=e-n(o=jV(s,a|=0));for(c=0;o&&h<=i&&c++<100;){var _=VV.exec(o);u=o,h=e-n(o=jV(s,a+=l=_?_[0].length:1))}0==(a-=l)?(a=1,u=jV(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,u=jV(s,2));var f=jV(s,0,a),d=void 0;kV.test(u||o)&&(0==(a-=(d=GV.exec(f))?d[0].length:0)&&(a=1),u=jV(s,a),f=jV(s,0,a)),zV.test(u)&&(d=UV.exec(f))&&f!==d[0]&&(u=jV(s,a-=d[0].length),f=jV(s,0,a)),(0===r.length||(f=f.trim()).length>0)&&r.push(f),e=n(s=u||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var JV,ZV=t("CanvasPool",function(){function t(){this.pool=[]}t.getInstance=function(){return NV||(NV=new t),NV};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Ae.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}()),QV=ki.WHITE.clone(),$V=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.texture=null,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},tk="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",ek=function(){function t(t,e){this.image=null,this.labelInfo=void 0,this.char=void 0,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.hash=void 0,this.char=t,this.labelInfo=e,this.hash=t.charCodeAt(0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,ZV.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=ZV.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){this.context.font=this.labelInfo.fontDesc;var t=XV(this.context,this.char,this.labelInfo.fontDesc),e=2*this.labelInfo.margin+2;this.width=parseFloat(t.toFixed(2))+e,this.height=(1+MV)*this.labelInfo.fontSize+e,this.offsetY=-this.labelInfo.fontSize*MV/2}this.canvas.width!==this.width&&(this.canvas.width=this.width),this.canvas.height!==this.height&&(this.canvas.height=this.height),this.image||(this.image=new Tg),this.image.reset(this.canvas)},e._updateTexture=function(){if(this.context&&this.canvas){var t=this.context,e=this.labelInfo,i=this.canvas.width,n=this.canvas.height;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=tk,t.fillRect(0,0,i,n),t.font=e.fontDesc;var r=e.fontSize,s=i/2,a=n/2+r*OV+0*r,o=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+o.r+", "+o.g+", "+o.b+", 1)",e.isOutlined){var h=e.out||QV;t.strokeStyle="rgba("+h.r+", "+h.g+", "+h.b+", "+h.a/255+")",t.lineWidth=2*e.margin,t.strokeText(this.char,s,a)}t.fillText(this.char,s,a)}},t}(),ik=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=eg.RGBA8888),this.reset({width:t,height:e,format:i})},i.drawTextureAt=function(t,e,i){var n=this.getGFXTexture();if(t&&n){var r=this._getGFXDevice();if(r){var s=new Ir;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(Kg),nk=function(){function t(t,e){this._x=0,this._y=0,this._nextY=0,this._width=0,this._height=0,this._halfBleed=0,this._dirty=!1;var i=new ik;i.initWithSize(t,e),this.fontDefDictionary=new BV(i),this._halfBleed=1,this._width=t,this._height=e,BN.on(IN.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=BN.root.device;if(!e||!this.fontDefDictionary||!i)return null;var n=e.width,r=e.height;if(this._x+n+0>this._width&&(this._x=0,this._y=this._nextY),this._y+r>this._nextY&&(this._nextY=this._y+r+0),this._nextY>this._height)return j(12100),null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new $V;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.texture=this.fontDefDictionary.texture,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset(),this.fontDefDictionary&&(this.fontDefDictionary.texture.destroy(),this.fontDefDictionary.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new ik;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=t.charCodeAt(0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new ek(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},u(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),rk={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:ki.WHITE.clone(),isOutlined:!1,out:ki.WHITE.clone(),margin:0},sk=[new Qr(gr.ATTR_POSITION,In.RGB32F)],ak=[new Qr(gr.ATTR_POSITION,In.RGB32F),new Qr(gr.ATTR_COLOR,In.RGBA32F)],ok=[new Qr(gr.ATTR_POSITION,In.RGB32F),new Qr(gr.ATTR_TEX_COORD,In.RG32F),new Qr(gr.ATTR_COLOR,In.RGBA32F)],hk=[new Qr(gr.ATTR_POSITION,In.RGB32F),new Qr(gr.ATTR_TEX_COORD,In.RG32F),new Qr(gr.ATTR_COLOR,In.RGBA8,!0)],uk=[new Qr(gr.ATTR_POSITION,In.RGB32F),new Qr(gr.ATTR_TEX_COORD,In.RG32F),new Qr(gr.ATTR_COLOR,In.RGBA32F),new Qr(gr.ATTR_COLOR2,In.RGBA32F)],lk=[new Qr(gr.ATTR_POSITION,In.RGB32F),new Qr(gr.ATTR_TEX_COORD,In.RG32F),new Qr(gr.ATTR_COLOR,In.RGBA8,!0),new Qr(gr.ATTR_COLOR2,In.RGBA8,!0)];function ck(t){for(var e=0,i=0;i>2,this._initVDataCount,this._floatsPerVertex,Q(9005),this.vData&&this.iData||(this.vData=new Float32Array(this._initVDataCount),this.iData=new Uint16Array(this._initIDataCount)),this._iaPool.push(this.createNewIA(t))},t.reset=function(){this._nextFreeIAHandle=0,this.dirty=!1},t.destroy=function(){this.reset(),this._attributes=null,this._iaInfo=null,this.vData=null,this.iData=null;for(var t=0;tthis._initVDataCount||n>this._initIDataCount)},t.uploadBuffers=function(){if(0!==this.byteOffset&&this._dirty){for(var t=Ja.__isWebIOS14OrIPadOS14Env?this._nextFreeIAHandle:1,e=this.byteOffset,i=this.indexOffset,n=0;n>2),a=new Uint16Array(this.iData.buffer,0,i),o=r.vertexBuffers[0];e>o.size&&o.resize(e),o.update(s),2*i>r.indexBuffer.size&&r.indexBuffer.resize(2*i),r.indexBuffer.update(a)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Ja.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new Fr(Pn.VERTEX|Pn.TRANSFER_DST,Fn.HOST|Fn.DEVICE,r,r));n=t.createBuffer(new Fr(Pn.INDEX|Pn.TRANSFER_DST,Fn.HOST|Fn.DEVICE,s,s)),i=[a],this._iaInfo=new ts(this._attributes,i,n),e=t.createInputAssembler(this._iaInfo)}else e=t.createInputAssembler(this._iaInfo),i=this._iaInfo.vertexBuffers,n=this._iaInfo.indexBuffer;return{ia:e,vertexBuffers:i,indexBuffer:n}},u(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"byteOffset",get:function(){return this._byteOffset},set:function(t){this._byteOffset=t}},{key:"vertexOffset",get:function(){return this._vertexOffset},set:function(t){this._vertexOffset=t}},{key:"indexOffset",get:function(){return this._indexOffset},set:function(t){this._indexOffset=t}},{key:"dirty",get:function(){return this._dirty},set:function(t){this._dirty=t}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex},set:function(t){this._floatsPerVertex=t}},{key:"vData",get:function(){return this._vData},set:function(t){this._vData=t}},{key:"iData",get:function(){return this._iData},set:function(t){this._iData=t}},{key:"nativeObj",get:function(){return this._nativeObj}},{key:"sharedBuffer",get:function(){return this._sharedBuffer}}]),e}()),yk=function(){function t(t,e){this._device=null,this._attributes=null,this._vertexFormatBytes=void 0,this._floatsPerVertex=void 0,this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=_k(e)>>2,this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT}var e=t.prototype;return e.initialize=function(){},e.reset=function(){},e.request=function(){},e.appendBuffers=function(){},e.uploadBuffers=function(){},e.destroy=function(){this._attributes.length=0},u(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),vk=new da((function(){return{offset:0,length:0}}),32),Ak=function(){function t(t,e,i,n,r,s){this._ib=void 0,this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},u(t,[{key:"ib",get:function(){return this._ib}}]),t}(),Sk=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ae.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}c(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;e=n){o=i[u],s=h,a=u;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&r.checkCapacity(t,e)&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new Ak(this,s,r,l,c,e)}return q(9004,n),null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,h=e[a];h&&h.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),vk.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){Z(this._buffers.length===this._freeLists.length,9003);var t=new gk,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=vk.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),BN.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},u(e,[{key:"id",get:function(){return this._id}}]),e}(yk);Sk.IB_SCALE=4,Sk.ID_COUNT=0,function(t){t[t.DrawInfoType=0]="DrawInfoType",t[t.VertDirty=1]="VertDirty",t[t.IsMeshBuffer=2]="IsMeshBuffer",t[t.Stride=3]="Stride",t[t.Count=4]="Count"}(fk||(fk={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(dk||(dk={})),function(t){t[t.VertexOffset=0]="VertexOffset",t[t.IndexOffset=1]="IndexOffset",t[t.VBCount=2]="VBCount",t[t.IBCount=3]="IBCount",t[t.DataHash=4]="DataHash",t[t.Count=5]="Count"}(pk||(pk={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(mk||(mk={}));var bk,Tk,Ek=function(){function t(t){this._accId=-1,this._bufferId=-1,this._vertexOffset=0,this._indexOffset=0,this._vb=null,this._ib=null,this._vData=null,this._iData=null,this._vertDirty=!1,this._vbCount=0,this._ibCount=0,this._dataHash=0,this._isMeshBuffer=!1,this._material=null,this._texture=null,this._sampler=null,this._stride=0,this._useLocal=!1,this._model=null,this._drawInfoType=mk.COMP,this._subNode=null,this._uint8SharedBuffer=void 0,this._uint16SharedBuffer=void 0,this._uint32SharedBuffer=void 0,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,fk.Count),i+=fk.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,dk.Count),i+=dk.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,pk.Count)}var e=t.prototype;return e.init=function(){},e.clear=function(){this._bufferId=0,this._vertexOffset=0,this._indexOffset=0,this._vertDirty=!1},e.setAccId=function(t){this._accId=t},e.setBufferId=function(t){this._bufferId=t},e.setAccAndBuffer=function(t,e){this._bufferId=e,this._accId=t},e.setVertexOffset=function(t){this._vertexOffset=t},e.setIndexOffset=function(t){this._indexOffset=t},e.setVB=function(){},e.setIB=function(){},e.setVData=function(){},e.setIData=function(){},e.setVBCount=function(t){this._vbCount=t},e.setIBCount=function(){},e.setVertDirty=function(t){this._vertDirty=t},e.setDataHash=function(t){this._dataHash=t},e.setIsMeshBuffer=function(t){this._isMeshBuffer=t},e.setMaterial=function(t){this._material=t},e.setTexture=function(t){this._texture=t},e.setSampler=function(t){this._sampler=t},e.setModel=function(){},e.setDrawInfoType=function(t){this._drawInfoType=t},e.setSubNode=function(t){this._subNode=t},e.setStride=function(t){this._stride=t},e.initRender2dBuffer=function(){},e.fillRender2dBuffer=function(){},u(t,[{key:"nativeObj",get:function(){return this._nativeObj}},{key:"render2dBuffer",get:function(){return this._render2dBuffer}}]),t}();!function(t){t[t.DISABLED=0]="DISABLED",t[t.CLEAR=1]="CLEAR",t[t.ENTER_LEVEL=2]="ENTER_LEVEL",t[t.ENABLED=3]="ENABLED",t[t.EXIT_LEVEL=4]="EXIT_LEVEL",t[t.CLEAR_INVERTED=5]="CLEAR_INVERTED",t[t.ENTER_LEVEL_INVERTED=6]="ENTER_LEVEL_INVERTED"}(bk||(bk={})),function(t){t[t.stencilTest=0]="stencilTest",t[t.func=1]="func",t[t.stencilMask=2]="stencilMask",t[t.writeMask=3]="writeMask",t[t.failOp=4]="failOp",t[t.zFailOp=5]="zFailOp",t[t.passOp=6]="passOp",t[t.ref=7]="ref",t[t.count=8]="count"}(Tk||(Tk={}));var Ck,wk,xk,Rk,Ik,Bk=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Wn.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Xn.KEEP,zFailOp:Xn.KEEP,passOp:Xn.KEEP,ref:1},this._stage=bk.DISABLED,this.stencilStateMap=new Map,this.stencilStateMapWithDepth=new Map}var e=t.prototype;return e.pushMask=function(t){this._maskStack.push(t)},e.clear=function(t){return t.stencilStage!==bk.ENTER_LEVEL?bk.CLEAR_INVERTED:bk.CLEAR},e.enableMask=function(){this.stage=bk.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=bk.DISABLED:this.stage=bk.ENABLED)},e.getWriteMask=function(){return 1<>2,fG=new da((function(){return{x:0,y:0,z:0,u:0,v:0,color:ki.WHITE.clone()}}),128),dG=t("BaseRenderData",function(){function t(t){void 0===t&&(t=ok),this.chunk=null,this._renderDrawInfo=null,this._material=null,this._dataHash=0,this._isMeshBuffer=!1,this._vc=0,this._ic=0,this._floatStride=0,this._vertexFormat=ok,this._drawInfoType=mk.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===ok?_G:_k(t)>>2,this._vertexFormat=t}var e=t.prototype;return e.isValid=function(){return this._ic>0&&this.chunk.vertexAccessor},e.initRenderDrawInfo=function(t,e){void 0===e&&(e=mk.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},u(t,[{key:"vertexCount",get:function(){return this._vc}},{key:"indexCount",get:function(){return this._ic}},{key:"stride",get:function(){return this._floatStride<<2}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vertexFormat",get:function(){return this._vertexFormat}},{key:"drawInfoType",get:function(){return this._drawInfoType},set:function(t){this._drawInfoType=t,this._renderDrawInfo&&this._renderDrawInfo.setDrawInfoType(t)}},{key:"renderDrawInfo",get:function(){return this._renderDrawInfo}},{key:"material",get:function(){return this._material},set:function(t){this._material=t,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(t)}},{key:"dataHash",get:function(){return this._dataHash},set:function(t){this._dataHash=t,this._renderDrawInfo&&this._renderDrawInfo.setDataHash(t)}},{key:"multiOwner",get:function(){return this._multiOwner},set:function(t){this._multiOwner=t}},{key:"batcher",get:function(){return this._batcher||(this._batcher=BN.root.batcher2D),this._batcher}}]),t}()),pG=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=ok),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._pivotX=0,n._pivotY=0,n._width=0,n._height=0,n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}c(e,t),e.add=function(t,i){void 0===t&&(t=ok);var n=new e(t,i);return i||(i=BN.root.batcher2D.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n},e.remove=function(t){t.clear(),t._accessor=null};var i=e.prototype;return i.resize=function(t,e){t===this._vc&&e===this._ic&&this.chunk||(this._vc=t,this._ic=e,this.chunk&&(this._accessor.recycleChunk(this.chunk),this.chunk=null),this.chunk=this._accessor.allocateChunk(t,e),this.updateHash())},i.setRenderDrawInfoAttributes=function(){},i.fillDrawInfoAttributes=function(){},i.syncRender2dBuffer=function(){},i.resizeAndCopy=function(t,e){if(t!==this._vc||e!==this._ic||!this.chunk){this._vc=t,this._ic=e;var i=this.chunk;this.chunk=this._accessor.allocateChunk(t,e),i&&(this.chunk.vb.set(i.vb),this._accessor.recycleChunk(i)),this.updateHash()}},i.getMeshBuffer=function(){return this.chunk&&this._accessor?this._accessor.getMeshBuffer(this.chunk.bufferId):null},i.updateNode=function(t){this.layer=t.node.layer,this.nodeDirty=!1,this.hashDirty=!0},i.updatePass=function(t){this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0},i.updateTexture=function(t){this.frame=t,this.textureHash=t.getHash(),this.textureDirty=!1,this.hashDirty=!0},i.updateHash=function(){var t=""+(this.chunk?this.chunk.bufferId:-1)+this.layer+" "+this.textureHash;this.dataHash=Hs(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.updateSizeNPivot=function(t,e,i,n){t===this._width&&e===this._height&&i===this._pivotX&&n===this._pivotY||(this._width=t,this._height=e,this._pivotX=i,this._pivotY=n,this.vertDirty=!0)},i.clear=function(){this.resize(0,0),this._data.length=0,this._pivotX=0,this._pivotY=0,this._width=0,this._height=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=BN.root.device;return new Sk(n,t,e,i)},u(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){var i=e.length,n=0;for(n=t;n>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new Fr(Pn.VERTEX|Pn.TRANSFER_DST,Fn.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new Fr(Pn.INDEX|Pn.TRANSFER_DST,Fn.DEVICE,r,r))),this._iaInfo=new ts(this._vertexFormat,n,this._indexBuffer),this._iaPool=new pa((function(){return t.createInputAssembler(e._iaInfo)}),1,(function(t){t.destroy()}))}},i._reallocBuffer=function(t,e){var i=this.vData;this.vData=new Float32Array(t),i&&this.vData.set(i,0);var n=this.iData;this.iData=new Uint16Array(e),n&&this.iData.set(n,0)},i.setRenderDrawInfoAttributes=function(){},i.particleInitRenderDrawInfo=function(){},u(e,[{key:"formatByte",get:function(){return this.stride},set:function(){}},{key:"floatStride",get:function(){return this._floatStride}},{key:"vDataOffset",get:function(){return this._byteLength>>>2}}]),e}(dG)),gG=(new pa((function(){return new mG}),32),new _n),yG=new _n,vG=new ji,AG=new hn,SG=new hn,bG=new hn,TG=new hn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),EG=new vn,CG=function(e){return t({UITransform:e,UITransformComponent:e}),e}((Dk=_u("cc.UITransform"),Pk=Bu(),Mk=du(110),Ok=wu(),Fk=Uu(),Nk=Fu(),Lk=Uu(),Vk=Fu(),Dk(kk=Pk(kk=Mk(kk=Ok(kk=pu(kk=Cu((Wk=Hk=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=vG,r=gG,s=yG,a=this._getRenderScene().cameras,o=0;o=0&&s.y>=0&&s.x<=e&&s.y<=i&&(u=this._maskTest(r)),u)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&oh.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(bG),hn.invert(AG,bG),e||(e=new ji),ji.transformMat4(e,t,AG)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(bG),e||(e=new ji),ji.transformMat4(e,t,bG)},i.getBoundingBox=function(){hn.fromRTS(SG,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var t=this._contentSize.width,e=this._contentSize.height,i=new vn(-this._anchorPoint.x*t,-this._anchorPoint.y*e,t,e);return i.transformMat4(SG),i},i.getBoundingBoxToWorld=function(){return this.node.parent?(this.node.parent.getWorldMatrix(bG),this.getBoundingBoxTo(bG)):this.getBoundingBox()},i.getBoundingBoxTo=function(t){hn.fromRTS(SG,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var i=this._contentSize.width,n=this._contentSize.height,r=new vn(-this._anchorPoint.x*i,-this._anchorPoint.y*n,i,n);if(hn.multiply(bG,t,SG),r.transformMat4(bG),!this.node.children)return r;for(var s,a=v(this.node.children);!(s=a()).done;){var o=s.value;if(o&&o.active){var h=o.getComponent(e);if(h){var u=h.getBoundingBoxTo(t);u&&vn.union(r,r,u)}}}return r},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;EG.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),EG.transformMat4(this.node.worldMatrix);var n=EG.x+.5*EG.width,r=EG.y+.5*EG.height,s=this.node.worldPosition.z,a=EG.width/2,o=EG.height/2;return null!=t?(Lh.set(t,n,r,s,a,o,.001),t):new Lh(n,r,s,a,o,.001)},i._parentChanged=function(){this.node.getComponent("cc.RenderRoot2D")||this.node.parent&&e.insertChangeMap(this.node.parent)},i._markRenderDataDirty=function(){var t=this.node._uiProps.uiComp;t&&t.markForUpdateRenderData()},e.insertChangeMap=function(t){var i=t.uuid;e.priorityChangeNodeMap.has(i)||e.priorityChangeNodeMap.set(i,t)},e._sortChildrenSibling=function(t){var e=t.children;e&&e.sort((function(t,e){var i=t._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp,r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.getSiblingIndex()-e.getSiblingIndex():r}))},e._sortSiblings=function(){e.priorityChangeNodeMap.forEach((function(t){e._sortChildrenSibling(t),t._updateSiblingIndex(),t.emit("childrenSiblingOrderChanged")})),e.priorityChangeNodeMap.clear()},e._cleanChangeMap=function(){e.priorityChangeNodeMap.clear()},u(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit(oA.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"width",get:function(){return this._contentSize.width},set:function(t){this._contentSize.width!==t&&(this._contentSize.width=t,this.node.emit(oA.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"height",get:function(){return this._contentSize.height},set:function(t){this.contentSize.height!==t&&(this._contentSize.height=t,this.node.emit(oA.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"anchorPoint",get:function(){return this._anchorPoint},set:function(t){this._anchorPoint.equals(t)||(this._anchorPoint.set(t),this.node.emit(oA.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorX",get:function(){return this._anchorPoint.x},set:function(t){this._anchorPoint.x!==t&&(this._anchorPoint.x=t,this.node.emit(oA.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorY",get:function(){return this._anchorPoint.y},set:function(t){this._anchorPoint.y!==t&&(this._anchorPoint.y=t,this.node.emit(oA.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?j(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=BN.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=BN.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(Cc),Hk.EventType=oA,Hk.priorityChangeNodeMap=new Map,S((Gk=Wk).prototype,"contentSize",[Fk,Nk],Object.getOwnPropertyDescriptor(Gk.prototype,"contentSize"),Gk.prototype),S(Gk.prototype,"anchorPoint",[Lk,Vk],Object.getOwnPropertyDescriptor(Gk.prototype,"anchorPoint"),Gk.prototype),Uk=S(Gk.prototype,"_contentSize",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(100,100)}}),zk=S(Gk.prototype,"_anchorPoint",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n(.5,.5)}}),kk=Gk))||kk)||kk)||kk)||kk)||kk)||kk));BN.on(IN.EVENT_AFTER_UPDATE,CG._sortSiblings),BN.on(IN.EVENT_BEFORE_SCENE_LAUNCH,CG._cleanChangeMap),pe(jn),function(t){t[t.ADD_COLOR=0]="ADD_COLOR",t[t.ADD_COLOR_AND_TEXTURE=1]="ADD_COLOR_AND_TEXTURE",t[t.GRAYSCALE=2]="GRAYSCALE",t[t.USE_ALPHA_SEPARATED=3]="USE_ALPHA_SEPARATED",t[t.USE_ALPHA_SEPARATED_AND_GRAY=4]="USE_ALPHA_SEPARATED_AND_GRAY"}(lG||(lG=t("InstanceMaterialType",{})));var wG,xG,RG,IG,BG,DG,PG,MG,OG,FG,NG,LG,VG,kG,GG,UG,zG,HG,WG,XG,jG,YG,qG,KG,JG,ZG,QG,$G,tU,eU,iU,nU,rU,sU,aU,oU,hU,uU,lU,cU,_U,fU,dU,pU,mU,gU,yU,vU,AU,SU,bU,TU,EU,CU,wU,xU,RU,IU,BU,DU,PU,MU,OU,FU,NU,LU,VU,kU,GU,UU,zU=function(e){return t({UIRenderer:e,RenderComponent:e,UIRenderable:e,Renderable2D:e}),e}((Xk=_u("cc.UIRenderer"),jk=fu(CG),Yk=Pu(),qk=qu(Wv),Kk=Uu(),Jk=Fu(),Zk=Ou(),Qk=Uu(),$k=Fu(),tG=qu(Wv),Xk(eG=jk(eG=Cu((uG=hG=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,A(e,"_materials",nG,g(e)),A(e,"_customMaterial",rG,g(e)),A(e,"_srcBlendFactor",sG,g(e)),A(e,"_dstBlendFactor",aG,g(e)),A(e,"_color",oG,g(e)),e._stencilStage=bk.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._renderEntity=void 0,e._instanceMaterialType=-1,e._srcBlendFactorCache=jn.SRC_ALPHA,e._dstBlendFactorCache=jn.ONE_MINUS_SRC_ALPHA,e._dirtyVersion=-1,e._internalId=-1,e._useVertexOpacity=!1,e._lastParent=null,e._renderEntity=e.createRenderEntity(),e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._renderEntity.setNode(this.node)},i.__preload=function(){this.node._uiProps.uiComp=this,this._flushAssembler&&this._flushAssembler()},i.onEnable=function(){this.node.on(oA.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(oA.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(oA.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),RN.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(oA.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(oA.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(oA.PARENT_CHANGED,this._colorDirty,this),RN.removeRenderer(this),this._renderFlag=!1,this._renderEntity.enabled=!1},i.onDestroy=function(){if(this._renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this.destroyRenderData(),this._materialInstances)for(var t=0;t0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.setMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setMaterial(t,0),this.stencilStage!==bk.ENTER_LEVEL&&this.stencilStage!==bk.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler&&(this._assembler.updateColor(this),this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag))},e.setEntityColorDirtyRecursively=function(t,i){var n=t._uiProps.uiComp;n&&n.color&&(n._renderEntity.colorDirty=i);for(var r=0;r>16,t|=t>>8,t|=t>>4,t|=t>>2,t|=t>>1,++t}function KU(t,e){return Math.ceil(t/e)*e}!function(t){t[t.OPAQUE=0]="OPAQUE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OVERLAY=2]="OVERLAY"}(WU||(WU={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(XU||(XU={}));var JU,ZU,QU,$U,tz,ez,iz,nz,rz,sz=function(){function t(t){this._device=void 0,this._format=In.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Ir,this._region1=new Ir,this._region2=new Ir,this._roundUpFn=null,this._bufferViewCtor=Uint8Array,this._channels=4,this._alignment=1,this._device=t}var e=t.prototype;return e.initialize=function(t){var e=Ts[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=Ps(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),h=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,qU(o)),u=this._chunks[this.createChunk(h)];u.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:u.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=h,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region0),a=0,o+=1,s-=h,u+=h),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),h=this._region1.texExtent.width*this._region1.texExtent.height):(h=s,this._region1.texExtent.width=h,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,u*this._formatSize,h*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=h,u+=h),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,u*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;ai.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,qU(a)),h=this._chunks[this.createChunk(o)];h.start+=t;var u={chunkIdx:this._chunkCount,start:0,end:t,texture:h.texture};return this._handles.push(u),u},t}(),az=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=void 0,this._chunkSize=i*(1<>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===rz.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(oz||(oz={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(hz||(hz={}));var lz,cz=((JU={})[hz.POSITION]=rz.FLOAT32,JU[hz.UV]=rz.FLOAT32,JU[hz.COLOR]=rz.UINT32,JU[hz.COUNT]=rz.NEVER,JU),_z=((ZU={})[hz.POSITION]=hz.UV-hz.POSITION,ZU[hz.UV]=hz.COLOR-hz.UV,ZU[hz.COLOR]=hz.COUNT-hz.COLOR,ZU[hz.COUNT]=1,ZU),fz=new uz(oz.RENDER2D,cz,_z,hz);!function(t){t[t.DIRTY_FLAG=0]="DIRTY_FLAG",t[t.LAYER=1]="LAYER",t[t.WORLD_SCALE=2]="WORLD_SCALE",t[t.WORLD_POSITION=5]="WORLD_POSITION",t[t.WORLD_ROTATION=8]="WORLD_ROTATION",t[t.WORLD_MATRIX=12]="WORLD_MATRIX",t[t.LOCAL_SCALE=28]="LOCAL_SCALE",t[t.LOCAL_POSITION=31]="LOCAL_POSITION",t[t.LOCAL_ROTATION=34]="LOCAL_ROTATION",t[t.COUNT=38]="COUNT"}(lz||(lz={}));var dz,pz=((QU={})[lz.DIRTY_FLAG]=rz.UINT32,QU[lz.LAYER]=rz.UINT32,QU[lz.WORLD_SCALE]=rz.FLOAT32,QU[lz.WORLD_POSITION]=rz.FLOAT32,QU[lz.WORLD_ROTATION]=rz.FLOAT32,QU[lz.WORLD_MATRIX]=rz.FLOAT32,QU[lz.LOCAL_SCALE]=rz.FLOAT32,QU[lz.LOCAL_POSITION]=rz.FLOAT32,QU[lz.LOCAL_ROTATION]=rz.FLOAT32,QU[lz.COUNT]=rz.NEVER,QU),mz=(($U={})[lz.DIRTY_FLAG]=lz.LAYER-lz.DIRTY_FLAG,$U[lz.LAYER]=lz.WORLD_SCALE-lz.LAYER,$U[lz.WORLD_SCALE]=lz.WORLD_POSITION-lz.WORLD_SCALE,$U[lz.WORLD_POSITION]=lz.WORLD_ROTATION-lz.WORLD_POSITION,$U[lz.WORLD_ROTATION]=lz.WORLD_MATRIX-lz.WORLD_ROTATION,$U[lz.WORLD_MATRIX]=lz.LOCAL_SCALE-lz.WORLD_MATRIX,$U[lz.LOCAL_SCALE]=lz.LOCAL_POSITION-lz.LOCAL_SCALE,$U[lz.LOCAL_POSITION]=lz.LOCAL_ROTATION-lz.LOCAL_POSITION,$U[lz.LOCAL_ROTATION]=lz.COUNT-lz.LOCAL_ROTATION,$U[lz.COUNT]=1,$U),gz=new uz(oz.NODE,pz,mz,lz);!function(t){t[t.PRIORITY=0]="PRIORITY",t[t.STAGE=1]="STAGE",t[t.PHASE=2]="PHASE",t[t.PRIMITIVE=3]="PRIMITIVE",t[t.BATCHING_SCHEME=4]="BATCHING_SCHEME",t[t.DYNAMIC_STATE=5]="DYNAMIC_STATE",t[t.HASH=6]="HASH",t[t.COUNT=7]="COUNT"}(dz||(dz={}));var yz,vz=((tz={})[dz.PRIORITY]=rz.UINT32,tz[dz.STAGE]=rz.UINT32,tz[dz.PHASE]=rz.UINT32,tz[dz.PRIMITIVE]=rz.UINT32,tz[dz.BATCHING_SCHEME]=rz.UINT32,tz[dz.DYNAMIC_STATE]=rz.UINT32,tz[dz.HASH]=rz.UINT32,tz[dz.COUNT]=rz.NEVER,tz),Az=((ez={})[dz.PRIORITY]=dz.STAGE-dz.PRIORITY,ez[dz.STAGE]=dz.PHASE-dz.STAGE,ez[dz.PHASE]=dz.PRIMITIVE-dz.PHASE,ez[dz.PRIMITIVE]=dz.BATCHING_SCHEME-dz.PRIMITIVE,ez[dz.BATCHING_SCHEME]=dz.DYNAMIC_STATE-dz.BATCHING_SCHEME,ez[dz.DYNAMIC_STATE]=dz.HASH-dz.DYNAMIC_STATE,ez[dz.HASH]=dz.COUNT-dz.HASH,ez[dz.COUNT]=1,ez),Sz=new uz(oz.PASS,vz,Az,dz);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(yz||(yz={}));var bz=((iz={})[yz.CENTER]=rz.FLOAT32,iz[yz.HALFEXTENTS]=rz.FLOAT32,iz[yz.COUNT]=rz.NEVER,iz),Tz=((nz={})[yz.CENTER]=yz.HALFEXTENTS-yz.CENTER,nz[yz.HALFEXTENTS]=yz.COUNT-yz.HALFEXTENTS,nz[yz.COUNT]=1,nz),Ez=new uz(oz.AABB,bz,Tz,yz);it(TN.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),it(TN.prototype,"RenderScene.prototype",[{name:"raycastAll",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllModels",suggest:"using intersect.rayModel in geometry"},{name:"raycastSingleModel",suggest:"using intersect.rayModel in geometry"},{name:"raycastAllCanvas",suggest:"using intersect.rayAABB in geometry"},{name:"rayResultCanvas"},{name:"rayResultModels"},{name:"rayResultAll"},{name:"rayResultSingleModel"}]),it(gM.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var Cz={};it(Cz,"CameraVisFlags",[{name:"GENERAL"}]),et(Cz,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Qd.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Qd.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Qd.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Qd.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Qd.BitMask,targetName:"UI_2D"}]),C.CameraVisFlags=Cz;var wz={};it(wz,"VisibilityFlags",[{name:"GENERAL"}]),et(wz,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Qd.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Qd.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Qd.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Qd.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Qd.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Qd.Enum,targetName:"UI_2D"}]),C.VisibilityFlags=wz,et(wv.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),it(Fb.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),it(FT.prototype,"Shadows.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),it(IM.prototype,"SpotLight.prototype",[{name:"aspect"}]);var xz,Rz,Iz,Bz=function(t){if(void 0===YU[t]){var e=1<10||(p=.5*(s+o),m=.5*(a+h),g=.5*((c=.5*(e+n))+(f=.5*(n+s))),y=.5*((_=.5*(i+r))+(d=.5*(r+a))),((C=Lz((n-o)*(E=h-i)-(r-h)*(T=o-e)))+(w=Lz((s-o)*E-(a-h)*T)))*(C+w)=2*Pz)l=2*Pz;else for(;l<0;)l+=2*Pz;else if(Lz(l)>=2*Pz)l=2*-Pz;else for(;l>0;)l-=2*Pz;for(h=0|Oz(1,Mz(Lz(l)/(.5*Pz)+.5,5)),c=Lz(4/3*(1-Fz(o=l/h/2))/Nz(o)),a||(c=-c),b=0;b<=h;b++)d=e+(_=Fz(u=r+l*(b/h)))*n,p=i+(f=Nz(u))*n,m=-f*n*c,g=_*n*c,0===b?t.moveTo(d,p):t.bezierCurveTo(y+A,v+S,d-m,p-g,d,p),y=d,v=p,A=m,S=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){Gz(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){Gz(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=Mz(s,.5*Lz(n))*Vz(n),o=Mz(s,.5*Lz(r))*Vz(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-kz),e+a*(1-kz),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-kz),i+r,e+n,i+r-o*(1-kz),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-kz),e+n-a*(1-kz),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-kz),i,e,i+o*(1-kz),e,i+o),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e0){for(var i=0;ii)for(var n=i;n=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===OW.GRAPHICS_ELLIPSE){var h=n/2,u=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(h*h)+c*c/(u*u)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==OW.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(MW);if(!t){var e=this.node;t=this._sprite=e.addComponent(MW)}t.color=ki.WHITE.clone(),t.sizeMode=0}this._sprite.stencilStage=this.inverted?bk.ENTER_LEVEL_INVERTED:bk.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(fW);if(!t){var e=this.node;t=this._graphics=e.addComponent(fW)}t.lineWidth=1;var i=ki.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?bk.ENTER_LEVEL_INVERTED:bk.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===OW.GRAPHICS_RECT||this._type===OW.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(this._type===OW.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===OW.GRAPHICS_ELLIPSE){for(var h=function(t,e,i){VW.length=0;for(var n=2*Math.PI/i,r=0;r"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var h;i=tX.exec(t);for(var u=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,h=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),h.endsWith("/")&&(h=h.slice(0,-1)),"src"===n){switch(h.charCodeAt(0)){case 34:case 39:u=!0,h=h.slice(1,-1)}e.isImage=!0,e.src=h}else if("height"===n)e.imageHeight=parseInt(h);else if("width"===n)e.imageWidth=parseInt(h);else if("align"===n){switch(h.charCodeAt(0)){case 34:case 39:h=h.slice(1,-1)}e.imageAlign=h.toLowerCase()}else"offset"===n?e.imageOffset=h:"click"===n&&(e.event=this._processEventHandler(n+"="+h));e.event&&"param"===n&&(e.event[n]=h.replace(/^"|"$/g,"")),i=tX.exec(t)}return u&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var _,f=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=f.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=f.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-1&&(n=t.length?-1:e+1)):s&&(e=r,i=t.indexOf('"',e+1>=t.length?-1:e+1)),i},e._processEventHandler=function(t){for(var e={},i=0,n=!1,r=$W.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=$W.exec(t)}return e},e._addToStack=function(t){var e=this._attributeToObject(t);if(0===this._stack.length)this._stack.push(e);else{if(e.isNewLine||e.isImage)return;var i=this._stack[this._stack.length-1];for(var n in i)e[n]||(e[n]=i[n]);this._stack.push(e)}},e._processResult=function(t){0!==t.length&&(t=this._escapeSpecialSymbol(t),this._stack.length>0?this._resultObjectArray.push({text:t,style:this._stack[this._stack.length-1]}):this._resultObjectArray.push({text:t}))},e._escapeSpecialSymbol=function(t){for(var e,i=v(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),iX=function(e){return t({LabelOutline:e,LabelOutlineComponent:e}),e}((GW=_u("cc.LabelOutline"),UW=Bu(),zW=du(110),HW=wu(),WW=fu(HU),XW=Fu(),jW=Fu(),GW(YW=UW(YW=zW(YW=HW(YW=WW(YW=Cu((ZW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ru;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),h=this._calculateSize(e,a)}for(var l=1e3,c=1;l&&r0&&(c=_[0].length),s+=c,a=n.substring(r,s),o=n.substring(s),h=this._calculateSize(e,a),l--}for(;l&&a.length>=2&&h.x>u;)s-=c,a=n.substring(r,s),h=this._calculateSize(e,a),c=1,l--;if(a.length>=2){var f=qV(a);f&&f.length>0&&a!==f[0]&&(s-=f[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),l--,this._calculateSize(e,o).x<2048){r=t.length,s=t.length,a=o,i.push(a);break}h=this._calculateSize(e,a)}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(t,e).width};return e?n(e):n},i._calculateSize=function(t,e){var i;return 0===this._labelSegmentsCache.length?(i=this._createFontLabel(e),this._labelSegmentsCache.push(i)):(i=this._labelSegmentsCache[0]).node.getComponent(HU).string=e,i.styleIndex=t,this._applyTextAttribute(i),i.node._uiProps.uiTransformComp.contentSize},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(Cc),r=function(){var r=e.value,s=r.clickHandler,a=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,a)})),t.propagationStopped=!0)},s=v(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(CG);return!!i&&i.getBoundingBoxToWorld().contains(e)},i._resetState=function(){for(var t=this.node.children,e=t.length-1;e>=0;e--){var i=t[e];if(i.name===Sj||i.name===bj){i.parent=null;var n=Cj(i.name);n.node=i,i.name===Sj?(n.comp=i.getComponent(HU),Tj.put(n)):(n.comp=i.getComponent(MW),Ej.put(n)),this._labelChildrenNum--}}this._segments.length=0,this._labelSegmentsCache.length=0,this._linesWidth.length=0,this._lineOffsetX=0,this._lineCount=1,this._labelWidth=0,this._labelHeight=0,this._layoutDirty=!0},i._activateChildren=function(t){for(var e=this.node.children.length-1;e>=0;e--){var i=this.node.children[e];i.name!==Sj&&i.name!==bj||(i.active=t)}},i._addLabelSegment=function(t,e){var i;if(0===this._labelSegmentsCache.length)i=this._createFontLabel(t);else{var n=(i=this._labelSegmentsCache.pop()).node.getComponent(HU);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var h=t.substr(0,r);this._addLabelSegment(h,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var u=KV(t,n,this._maxWidth,this._measureText(i)),l=0;l1&&l0?(o*=a=l/h,h*=a):(o*=a=this._lineHeight/h,h*=a),u>0&&(o=u),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,h),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else j(4400)}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=Aj.parse(this._string);if(!this._needsUpdateTextLayout(t))return this._textArray=t.slice(),void this._updateLabelSegmentTextAttributes();this._textArray=t.slice(),this._resetState();for(var e,i=!1,n=0;n0){var u=this._measureText(n,h);this._updateRichTextWithMaxWidth(h,u,n),a.length>1&&othis._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+MV)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(HV(n)||WV(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=h);var u=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case VU.LEFT:break;case VU.CENTER:u-=this._linesWidth[h-1]/2;break;case VU.RIGHT:u-=this._linesWidth[h-1]}var l=o.node.position;if(o.node.setPosition(t+u,this._lineHeight*(i-h)-this._labelHeight*s,l.z),h===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(MW)){var c=o.node.position.clone(),_=this._lineHeight,f=this._lineHeight*(1+MV);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(f-_)/2;break;case.5:c.y+=f/2;break;default:c.y+=(f-_)/2}if(o.imageOffset){var d=o.imageOffset.split(",");if(1===d.length&&d[0]){var p=parseFloat(d[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===d.length){var m=parseFloat(d[0]),g=parseFloat(d[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var y=o.node.getComponent(iX);if(y){var v=o.node.position.clone();v.y-=y.width,o.node.position=v}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return ki[e]?ki[e]:(new ki).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(HU);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(e.color=this._convertLiteralColorValue(i.color||"white"),e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(iX);r||(r=t.node.addComponent(iX)),r.color=this._convertLiteralColorValue(i.outline.color),r.width=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof gV&&!this._isSystemFontUsed?e.font=this._font:e.fontFamily=this._fontFamily,e.useSystemFont=this._isSystemFontUsed,e.lineHeight=this._lineHeight,e.updateRenderData(!0)}},i._applyLayer=function(){for(var t,e=v(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=ki.WHITE,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},u(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(Cc),yj.HorizontalAlign=VU,yj.VerticalAlign=kU,S((rj=vj).prototype,"string",[zu,kX],Object.getOwnPropertyDescriptor(rj.prototype,"string"),rj.prototype),S(rj.prototype,"horizontalAlign",[GX,UX],Object.getOwnPropertyDescriptor(rj.prototype,"horizontalAlign"),rj.prototype),S(rj.prototype,"verticalAlign",[zX,HX],Object.getOwnPropertyDescriptor(rj.prototype,"verticalAlign"),rj.prototype),S(rj.prototype,"fontSize",[WX],Object.getOwnPropertyDescriptor(rj.prototype,"fontSize"),rj.prototype),S(rj.prototype,"fontFamily",[XX],Object.getOwnPropertyDescriptor(rj.prototype,"fontFamily"),rj.prototype),S(rj.prototype,"font",[jX,YX],Object.getOwnPropertyDescriptor(rj.prototype,"font"),rj.prototype),S(rj.prototype,"useSystemFont",[qX,KX],Object.getOwnPropertyDescriptor(rj.prototype,"useSystemFont"),rj.prototype),S(rj.prototype,"cacheMode",[JX,ZX],Object.getOwnPropertyDescriptor(rj.prototype,"cacheMode"),rj.prototype),S(rj.prototype,"maxWidth",[QX],Object.getOwnPropertyDescriptor(rj.prototype,"maxWidth"),rj.prototype),S(rj.prototype,"lineHeight",[$X],Object.getOwnPropertyDescriptor(rj.prototype,"lineHeight"),rj.prototype),S(rj.prototype,"imageAtlas",[tj,ej],Object.getOwnPropertyDescriptor(rj.prototype,"imageAtlas"),rj.prototype),S(rj.prototype,"handleTouchEvent",[ij],Object.getOwnPropertyDescriptor(rj.prototype,"handleTouchEvent"),rj.prototype),sj=S(rj.prototype,"_lineHeight",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),aj=S(rj.prototype,"_string",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"RichText"}}),oj=S(rj.prototype,"_horizontalAlign",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return VU.LEFT}}),hj=S(rj.prototype,"_verticalAlign",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return kU.TOP}}),uj=S(rj.prototype,"_fontSize",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),lj=S(rj.prototype,"_maxWidth",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),cj=S(rj.prototype,"_fontFamily",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"Arial"}}),_j=S(rj.prototype,"_font",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),fj=S(rj.prototype,"_isSystemFontUsed",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),dj=S(rj.prototype,"_userDefinedFont",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),pj=S(rj.prototype,"_cacheMode",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return UU.NONE}}),mj=S(rj.prototype,"_imageAtlas",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),gj=S(rj.prototype,"_handleTouchEvent",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),nj=rj))||nj)||nj)||nj)||nj)||nj));C.RichText=Rj;var Ij=function(e){return t({UIMeshRenderer:e,UIModelComponent:e}),e}(_u("cc.UIMeshRenderer")(xj=Bu()(xj=du(110)(xj=wu()(xj=Cu(xj=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e.modelCount=0,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=bk.DISABLED,e._renderData=null,e._renderEntity=new cG(Ck.DYNAMIC),e}c(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){RN.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){RN.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):console.warn("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i0)for(s=e;s=e;s-=n)a=IY(s,t[s],t[s+1],a);return a&&CY(a,a.next)&&(BY(a),a=a.next),a}function _Y(t,e){if(void 0===e&&(e=null),!t)return t;e||(e=t);var i=t,n=!1;do{if(n=!1,i.steiner||!CY(i,i.next)&&0!==EY(i.prev,i,i.next))i=i.next;else{if(BY(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function fY(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=AY(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,h=0,u=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||h>0&&n;)0===o?(r=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,h--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,h=null,u=null;t.prev!==t.next;)if(h=t.prev,u=t.next,s?pY(t,n,r,s):dY(t))e.push(h.i/i),e.push(t.i/i),e.push(u.i/i),BY(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?fY(t=mY(t,e,i),e,i,n,r,s,2):2===a&&gY(t,e,i,n,r,s):fY(_Y(t),e,i,n,r,s,1);break}}}function dY(t){var e=t.prev,i=t,n=t.next;if(EY(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(bY(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&EY(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function pY(t,e,i,n){var r=t.prev,s=t,a=t.next;if(EY(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=AY(o,h,e,i,n),_=AY(u,l,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&bY(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&EY(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&bY(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&EY(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function mY(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!CY(r,s)&&wY(r,n,n.next,s)&&xY(r,s)&&xY(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),BY(n),BY(n.next),n=t=s),n=n.next}while(n!==t);return n}function gY(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&TY(a,o)){var h=RY(a,o);return a=_Y(a,a.next),h=_Y(h,h.next),fY(a,e,i,n,r,s),void fY(h,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function yY(t,e){return t.x-e.x}function vY(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,a=null;do{if(r<=i.y&&r>=i.next.y){var o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x=i.x&&i.x>=l&&bY(ra.x)&&xY(i,t)&&(a=i,_=h),i=i.next;return a}(t,e)){var i=RY(e,t);_Y(i,i.next)}}function AY(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function SY(t){var e=t,i=t;do{e.x=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function TY(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&wY(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&xY(t,e)&&xY(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function EY(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function CY(t,e){return t.x===e.x&&t.y===e.y}function wY(t,e,i,n){return!!(CY(t,e)&&CY(i,n)||CY(t,n)&&CY(i,e))||EY(t,e,i)>0!=EY(t,e,n)>0&&EY(i,n,t)>0!=EY(i,n,e)>0}function xY(t,e){return EY(t.prev,t,t.next)<0?EY(t,e,t.next)>=0&&EY(t,t.prev,e)>=0:EY(t,e,t.prev)<0||EY(t,t.next,e)<0}function RY(t,e){var i=new lY(t.i,t.x,t.y),n=new lY(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function IY(t,e,i,n){var r=new lY(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function BY(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function DY(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=cY(t,0,r,i,!0),a=[];if(!s)return a;var o=0,h=0,u=0,l=0,c=0,_=0,f=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a80*i){o=u=t[0],h=l=t[1];for(var d=i;du&&(u=c),_>l&&(l=_);f=Math.max(u-o,l-h)}return fY(s,a,i,o,h,f),a}for(var PY=Math.PI,MY=Math.min,OY=Math.max,FY=Math.ceil,NY=Math.acos,LY=Math.cos,VY=Math.sin,kY=Math.atan2,GY=null,UY=null,zY=new ki,HY=[],WY=0;WY<4;WY++)HY.push(new ji);function XY(t,e,i){return ti?i:t}var jY={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!UY)return null;var i=UY.getRenderDataList(),n=i[UY.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++UY.dataOffset,UY.dataOffset0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a1e-6){var A=1/d;A>600&&(A=600),_.dmx*=A,_.dmy*=A}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=Iz.PT_LEFT),d*(p=OY(11,MY(c.len,_.len)*r))*p<1&&(_.flags|=Iz.PT_INNERBEVEL),_.flags&Iz.PT_CORNER&&(d*n*n<1||i===Rz.BEVEL||i===Rz.ROUND)&&(_.flags|=Iz.PT_BEVEL),0!=(_.flags&(Iz.PT_BEVEL|Iz.PT_INNERBEVEL))&&h.bevel++,c=_,_=u[f+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var h=0,u=s.length;hm&&(g-=2*PY),this._vSet(_,f,1),this._vSet(u-s*n,e.y-a*n,-1);for(var y=XY(FY((m-g)/PY)*r,2,r),v=0;v0&&n>0&&A+u.w*dq>xq&&!WV(c)){nq.push(a),a=0,i++,n=0,r-=bq*this._getFontScale()+0,g=!0;break}oq.x=A,oq.y=r-u.offsetY*dq,this._recordLetterInfo(oq,c,v,i),v+1oq.y-u.h*dq&&(d=oq.y-u.h*dq)}else this._recordPlaceholderInfo(v,c),console.log("Can't find letter definition in texture atlas "+hq.atlasName+" for letter:"+c);else this._recordPlaceholderInfo(v,c)}g||(n=m,od&&(h=d),s<(a=p)&&(s=a),l+=_)}else nq.push(a),a=0,i++,n=0,r-=bq*this._getFontScale()+0,this._recordPlaceholderInfo(l,c),l++}return nq.push(a),lq=(uq=i+1)*bq*this._getFontScale(),uq>1&&(lq+=0*(uq-1)),aq.width=Cq,aq.height=wq,Cq<=0&&(aq.width=parseFloat(s.toFixed(2))+2*rk.margin),wq<=0&&(aq.height=parseFloat(lq.toFixed(2))+2*rk.margin),_q=aq.height,fq=0,o>0&&(_q=aq.height+o),h<-lq&&(fq=lq+h),!0},_getFirstCharLen:function(){return 1},_getFontScale:function(){return Tq===GU.SHRINK?dq:1},_getFirstWordLen:function(t,e,i){var n=t.charAt(e);if(HV(n)||"\n"===n||WV(n))return 1;var r=1,s=rk.fontAtlas.getLetterDefinitionForChar(n,rk);if(!s)return r;for(var a=s.xAdvance*dq+Sq,o=e+1;oxq&&!WV(n)&&xq>0)return r;if(a+=s.xAdvance*dq+Sq,"\n"===n||WV(n)||HV(n))break;r++}return r},_multilineTextWrapByWord:function(){return this._multilineTextWrap(this._getFirstWordLen)},_multilineTextWrapByChar:function(){return this._multilineTextWrap(this._getFirstCharLen)},_recordPlaceholderInfo:function(t,e){if(t>=iq.length){var i=new KY;iq.push(i)}iq[t].char=e,iq[t].hash=""+e.charCodeAt(0)+rk.hash,iq[t].valid=!1},_recordLetterInfo:function(t,e,i,n){if(i>=iq.length){var r=new KY;iq.push(r)}var s=""+e.charCodeAt(0)+rk.hash;iq[i].line=n,iq[i].char=e,iq[i].hash=s,iq[i].valid=rk.fontAtlas.getLetter(s).valid,iq[i].x=t.x,iq[i].y=t.y},_alignText:function(){lq=0,nq.length=0,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),Tq===GU.SHRINK&&gq>0&&this._isVerticalClamp()&&this._shrinkLabelToContentSize(this._isVerticalClamp),this._updateQuads()||Tq===GU.SHRINK&&this._shrinkLabelToContentSize(this._isHorizontalClamp)},_scaleFontSizeDown:function(t){var e=!0;t||(t=.1,e=!1),gq=t,e&&this._updateContent()},_shrinkLabelToContentSize:function(t){for(var e=0,i=0|gq,n=0;e>1;if(r<=0)break;dq=r/yq,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),t()?i=n-1:e=n}e>=0&&this._scaleFontSizeDown(e)},_isVerticalClamp:function(){return lq>aq.height},_isHorizontalClamp:function(){for(var t=!1,e=0,i=mq.length;e0)if(Eq){if(nq[a]>aq.width&&(s>aq.width||s<0)){t=!0;break}}else if(s>aq.width){t=!0;break}}}return t},_isHorizontalClamped:function(t,e){var i=nq[e],n=t>aq.width||t<0;return Eq?i>aq.width&&n:n},_updateQuads:function(){if(!$Y)return!1;var t=pq?pq.texture:rk.fontAtlas.getTexture(),e=$Y.renderData;e.dataLength=0,e.resize(0,0);for(var i=tq.anchorPoint,n=aq,r=i.x*n.width,s=i.y*n.height,a=!0,o=0,h=mq.length;o0){if(c>_q){var _=c-_q;JY.y+=_,JY.height-=_,c-=_}c-JY.height*dq0&&this._isHorizontalClamped(d,f))if(Tq===GU.CLAMP)JY.width=0;else if(Tq===GU.SHRINK){if(aq.width>l.w){a=!1;break}JY.width=0}if(JY.height>0&&JY.width>0){var p=this._determineRect(),m=u.x+rq[u.line];this.appendQuad($Y,t,JY,p,m-r,c-s,dq)}}else console.warn("Can't find letter in this bitmap-font")}}var g=e.indexCount;return this.createQuadIndices(g),e.chunk.setIndexBuffer(qY),a},createQuadIndices:function(t){if(t%6==0){var e=t/6;qY=null,qY=new Uint16Array(t);for(var i=0,n=0;n0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}(rk)},_getFontDesc:function(){return rk.fontSize.toString()+"px "+rk.fontFamily},_computeHorizontalKerningForText:function(){},_determineRect:function(){return!1}}),Mq=new ki(255,255,255,255),Oq={createData:function(t){return t.requestRenderData()},fillBuffers:function(t){if(t.renderData){var e=t.node;Mq.a=255*e._uiProps.opacity,vL(e,0,t.renderData,Mq)}},appendQuad:Bq.appendQuad};Ht(Oq,Pq);var Fq=HU.Overflow,Nq=(1/255).toFixed(3),Lq=null,Vq=null,kq=null,Gq="",Uq="",zq=0,Hq=0,Wq=[],Xq=new gn,jq=0,Yq=0,qq=0,Kq=new ki,Jq="",Zq=Fq.NONE,Qq=!1,$q=null,tK=ki.BLACK.clone(),eK=null,iK=ki.BLACK.clone(),nK=new vn,rK=gn.ZERO.clone(),sK=gn.ZERO.clone(),aK=_n.ZERO.clone(),oK=_n.ZERO.clone(),hK=0,uK=0,lK=!1,cK=!1,_K=!1,fK=["left","center","right"],dK={getAssemblerData:function(){var t=HU._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&HU._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp;this._updateFontFamily(t),this._updateProperties(t,e),this._calculateLabelFont(),this._updateLabelDimensions(),this._updateTexture(t),this._calDynamicAtlas(t),t.actualFontSize=zq,e.setContentSize(Xq),this.updateVertexData(t),this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=sK.width,Lq=null,Vq=null,kq=null}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){Jq=t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_updateProperties:function(t,e){var i=t.assemblerData;i&&(Lq=i.context,Vq=i.canvas,kq=t.spriteFrame,Uq=t.string.toString(),zq=t.fontSize,Hq=zq,Zq=t.overflow,sK.width=Xq.width=e.width,sK.height=Xq.height=e.height,uK=t.underlineHeight,jq=t.lineHeight,Yq=t.horizontalAlign,qq=t.verticalAlign,Kq=t.color,t.node._uiProps.opacity,lK=t.isBold,cK=t.isItalic,_K=t.isUnderline,Qq=Zq!==Fq.NONE&&(Zq===Fq.RESIZE_HEIGHT||t.enableWrapText),($q=($q=iX&&t.getComponent(iX))&&$q.enabled&&$q.width>0?$q:null)&&tK.set($q.color),(eK=(eK=hY&&t.getComponent(hY))&&eK.enabled?eK:null)&&iK.set(eK.color),this._updatePaddingRect())},_updatePaddingRect:function(){var t=0,e=0,i=0,n=0,r=0;if(rK.width=rK.height=0,$q&&(t=e=i=n=r=$q.width,rK.width=rK.height=2*r),eK){var s=eK.blur+r,a=eK.offset.x,o=eK.offset.y;i=Math.max(i,-a+s),n=Math.max(n,a+s),t=Math.max(t,o+s),e=Math.max(e,-o+s)}if(cK){var h=Hq*Math.tan(.20943951);n+=h,rK.width+=h}nK.x=i,nK.y=t,nK.width=i+n,nK.height=t+e},_calculateFillTextStartPosition:function(){var t=0;Yq===VU.RIGHT?t=Xq.width-nK.width:Yq===VU.CENTER&&(t=(Xq.width-nK.width)/2);var e=this._getLineHeight()*(Wq.length-1),i=zq*(1-MV/2);if(qq!==kU.TOP){var n=e+nK.height+zq-Xq.height;qq===kU.BOTTOM?i-=n+=MV/2*zq:i-=n/2}i+=0*zq,aK.set(t+nK.x,i+nK.y)},_updateTexture:function(t){if(Lq&&Vq){Lq.clearRect(0,0,Vq.width,Vq.height),Lq.font=Gq,this._calculateFillTextStartPosition();var e=this._getLineHeight();Lq.lineJoin="round",$q?(Lq.fillStyle="rgba("+tK.r+", "+tK.g+", "+tK.b+", "+Nq+")",Lq.fillRect(0,0,Vq.width,Vq.height)):t._srcBlendFactor===jn.SRC_ALPHA&&(Lq.fillStyle="rgba("+Kq.r+", "+Kq.g+", "+Kq.b+", "+Nq+")",Lq.fillRect(0,0,Vq.width,Vq.height)),Lq.fillStyle="rgb("+Kq.r+", "+Kq.g+", "+Kq.b+")";var i=aK.x,n=0;this._drawTextEffect(aK,e);for(var r=0;r1&&eK,n=this._measureText(Lq,Gq),r=0,s=0;eK&&this._setupShadow(),$q&&this._setupOutline();for(var a=0;a>1)<=0){W(4003);break}zq=u,Gq=this._getFontDesc(),Lq.font=Gq;var l=this._getLineHeight();for(n=0,i=0;ia?h=u-1:o=u}0===o?W(4003):(zq=o,Gq=this._getFontDesc(),Lq.font=Gq)}else{for(n=t.length*this._getLineHeight(),i=0;ir?e:r}i=(Wq.length+MV)*this._getLineHeight();var s=parseFloat(e.toFixed(2)),a=parseFloat(i.toFixed(2));Xq.width=s+nK.width,Xq.height=a+nK.height,sK.width=s+rK.width,sK.height=a+rK.height;break;case Fq.SHRINK:this._calculateShrinkFont(t),this._calculateWrapText(t);break;case Fq.CLAMP:this._calculateWrapText(t);break;case Fq.RESIZE_HEIGHT:this._calculateWrapText(t);var o=(Wq.length+MV)*this._getLineHeight();Xq.height=o+nK.height,sK.height=o+rK.height}}}},pK=ki.WHITE.clone(),mK=Uint16Array.from([0,1,2,1,3,2]),gK={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6);var i=e.chunk.vb;i[3]=i[21]=i[22]=i[31]=0,i[4]=i[12]=i[13]=i[30]=1;for(var n=5,r=0;r<4;r++)ki.toArray(i,pK,n),n+=9;return e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(mK),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,h=0,u=n.length,l=0;l1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0;switch(n.isRotated()?(h=o.x/s,u=(o.y+o.width)/a,l=_=h,d=m=(o.x+o.height)/s,f=g=u,c=p=o.y/a):(h=o.x/s,u=(o.y+o.height)/a,l=d=h,_=m=(o.x+o.width)/s,c=f=u,p=g=o.y/a),t.fillType){case AK.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(f-c)*e,r[12]=l+(_-l)*i,r[13]=c+(f-c)*i,r[21]=d+(m-d)*e,r[22]=p+(g-p)*e,r[30]=d+(m-d)*i,r[31]=p+(g-p)*i;break;case AK.VERTICAL:r[3]=l+(d-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=f+(g-f)*e,r[21]=l+(d-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=f+(g-f)*i;break;default:q(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,h=r.anchorY*a,u=-o,l=-h,c=s-o,_=a-h,f=0;switch(t.fillType){case AK.HORIZONTAL:f=u+(c-u)*i,u+=(c-u)*e,c=f;break;case AK.VERTICAL:f=l+(_-l)*i,l+=(_-l)*e,_=f;break;default:q(2626)}n[0].x=u,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=u,n[2].y=_,n[3].x=c,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(bK);for(var i,n=v(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(SK);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],h=o.x,u=o.y,l=SK.m03*h+SK.m07*u+SK.m15;l=l?Math.abs(1/l):1,r[s=a*i]=(SK.m00*h+SK.m04*u+SK.m12)*l,r[s+1]=(SK.m01*h+SK.m05*u+SK.m13)*l,r[s+2]=(SK.m02*h+SK.m06*u+SK.m14)*l}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,h=s.b/255,u=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=h,i[r+3]=u,r+=n}},EK=2*Math.PI,CK=1e-6,wK=new hn,xK=[new _n,new _n,new _n,new _n],RK=new Array(4),IK=new Array(8),BK=[new _n,new _n,new _n,new _n],DK=[new _n,new _n,new _n,new _n],PK=new _n,MK=[new _n,new _n,new _n,new _n];function OK(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>CK?o:0;var h=Math.cos(s),u=0,l=0;if(0!==(h=Math.abs(h)>CK?h:0)){if(u=o/h,(t-r.x)*h>0){var c=r.y+u*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*h>0){var _=r.y+u*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==o){if(l=h/o,(n-r.y)*o>0){var f=r.x+l*(n-r.y);a[3].x=f,a[3].y=n}if((i-r.y)*o>0){var d=r.x+l*(i-r.y);a[1].x=d,a[1].y=i}}}function FK(t,e){var i=e.x-t.x,n=e.y-t.y;if(0===i&&0===n)return 0;if(0===i)return n>0?.5*Math.PI:1.5*Math.PI;var r=Math.atan(n/i);return i<0&&(r+=Math.PI),r}function NK(t,e,i,n,r){var s=RK,a=s[0],o=s[1],h=s[2],u=s[3];t[e].x=i.x,t[e].y=i.y,t[e+1].x=n.x,t[e+1].y=n.y,t[e+2].x=r.x,t[e+2].y=r.y,LK((i.x-a)/(h-a),(i.y-o)/(u-o),t,e),LK((n.x-a)/(h-a),(n.y-o)/(u-o),t,e+1),LK((r.x-a)/(h-a),(r.y-o)/(u-o),t,e+2)}function LK(t,e,i,n){var r=IK,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,h=r[5]+(r[7]-r[5])*t,u=i[n];u.u=s+(a-s)*e,u.v=o+(h-o)*e}for(var VK={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;CL.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=EK)+(s*=EK);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,h=i-r,u=n-s,l=RK;l[0]=a,l[1]=o,l[2]=h,l[3]=u;var c=t.fillCenter,_=PK.x=Math.min(Math.max(0,c.x),1)*(h-a)+a,f=PK.y=Math.min(Math.max(0,c.y),1)*(u-o)+o;xK[0].x=xK[3].x=a,xK[1].x=xK[2].x=h,xK[0].y=xK[1].y=o,xK[2].y=xK[3].y=u;for(var d,p=v(MK);!(d=p()).done;){var m=d.value;_n.set(m,0,0)}_!==l[0]&&_n.set(MK[0],3,0),_!==l[2]&&_n.set(MK[2],1,2),f!==l[1]&&_n.set(MK[1],0,1),f!==l[3]&&_n.set(MK[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,h=IK;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,a=n.y/i,o=(n.y+n.width)/i,h[0]=h[2]=r,h[4]=h[6]=s,h[3]=h[7]=o,h[1]=h[5]=a):(r=n.x/e,s=(n.x+n.width)/e,a=n.y/i,o=(n.y+n.height)/i,h[0]=h[4]=r,h[2]=h[6]=s,h[1]=h[3]=o,h[5]=h[7]=a)}(e),OK(RK[0],RK[2],RK[1],RK[3],PK,r,BK),OK(RK[0],RK[2],RK[1],RK[3],PK,r+s,DK);for(var o=0,h=0;h<4;++h){var u=MK[h];if(u)if(s>=EK)i.dataLength=o+3,NK(n,o,PK,xK[u.x],xK[u.y]),o+=3;else{var l=FK(PK,xK[u.x]),c=FK(PK,xK[u.y]);c=a||(l>=r?(i.dataLength=o+3,NK(n,o,PK,xK[u.x],c>=a?DK[h]:xK[u.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,NK(n,o,PK,BK[h],xK[u.y]),o+=3):(i.dataLength=o+3,NK(n,o,PK,BK[h],DK[h]),o+=3))),l+=EK,c+=EK}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){vK=null,vK=new Uint16Array(t);for(var e=0,i=0;i1?1:p,m=Number.isNaN(m)||m>1?1:m,f=f<0?0:f,d=d<0?0:d,zK[0].x=-a,zK[0].y=-o,zK[1].x=u*p-a,zK[1].y=_*m-o,zK[2].x=zK[1].x+f,zK[2].y=zK[1].y+d,zK[3].x=r-a,zK[3].y=s-o;for(var g=0;g0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var nJ={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,h=i.insetRight,u=a.width-o-h,l=i.insetTop,c=i.insetBottom,_=a.height-l-c,f=r-o-h,d=s-l-c;f=f>0?f:0,d=d>0?d:0;var p=0===u?f:f/u,m=0===_?d:d/_,g=iJ(i),y=Math.ceil(m+g),v=Math.ceil(p+g);e.dataLength=4*y*v,this.updateVerts(t,f,d,y,v),e.vertexCount!==y*v*4&&(t.renderEntity.colorDirty=!0),e.resize(y*v*4,y*v*6),e.updateRenderData(t,i)}},createQuadIndices:function(t){if(t%6==0){var e=t/6;ZK=null,ZK=new Uint16Array(t);for(var i=0,n=0;n1?1:o.width/(p+m),b=o.height/(y+v)>1?1:o.height/(y+v);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=A>0?Math.floor(1e3*i)/1e3%A==0?A:i%A:i,tJ=Math.max(n+1,r+1);for(var T=0;T=r?c-f:C*g-f,eJ[C].y=C>=n?_-d:C*A-d;else for(var w=0;w1&&w0?p*S-f+g*(w-1):p+e-f:w===r-1?eJ[w].x=p*S-f+s+g*(w-2):w>=r&&(eJ[w].x=Math.min(p+e+m,c)-f),0===w?eJ[w].y=-d:1===w?eJ[w].y=v*b-d:w>1&&w0?v*b-d+A*(w-1):v+i-d:w===n-1?eJ[w].y=v*b-d+a+A*(w-2):w>=n&&(eJ[w].y=Math.min(v+i+y,_)-d);for(var x=0,R=0,I=0,B=0,D=0;DA?i>=(E>0?z:z+1)*A?1:k%1:k;for(var H=0;Hg?e>=(E>0?H:H+1)*g?1:V%1:V,O?(0===E?(G[0]=qK.u,G[1]=qK.u,G[2]=qK.u+(KK.u-qK.u)*L,U[0]=XK.v,U[1]=XK.v+(jK.v-XK.v)*N,U[2]=XK.v):(0===z?(G[0]=WK.u,G[1]=WK.u,G[2]=qK.u):z0){var o=a.claimedTouchIdList.indexOf(n.getID());if(-1!==o){if(a._handleEventTouch(t),t.type!==hT.TOUCH_END&&t.type!==hT.TOUCH_CANCEL||le.array.removeAt(a.claimedTouchIdList,o),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;ie)for(;e0&&(this._meshDataArray.forEach((function(t){t.uploadBuffers()})),this._bufferAccessors.forEach((function(t){t.uploadBuffers(),t.reset()})),this._descriptorSetCache.update())},e.reset=function(){for(var t=0;t0){!function(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,h=0;h>>0;else if(n.size/n.count==4)for(var c=o+3;c>2}}(r.renderData,a);var h=r.renderData.getMeshBuffer();h&&h.setDirty()}if(i.length>0&&!t._static)for(var u=0;u0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),Bk.sharedManager.exitMask())),e+=1}},e._screenSort=function(t,e){return t.node.getSiblingIndex()-e.node.getSiblingIndex()},e._releaseDescriptorSetCache=function(t){this._descriptorSetCache.releaseDescriptorSetCache(t)},e._createClearModel=function(){if(!this._maskClearModel){this._maskClearMtl=vv.get("default-clear-stencil"),this._maskClearModel=C.director.root.createModel(gM);var t=_k(sk),e=Qa.gfxDevice,i=e.createBuffer(new Fr(Pn.VERTEX|Pn.TRANSFER_DST,Fn.DEVICE,4*t,t)),n=new Float32Array([-1,-1,0,1,-1,0,-1,1,0,1,1,0]);i.update(n);var r=e.createBuffer(new Fr(Pn.INDEX|Pn.TRANSFER_DST,Fn.DEVICE,6*Uint16Array.BYTES_PER_ELEMENT,Uint16Array.BYTES_PER_ELEMENT)),s=new Uint16Array([0,1,2,2,1,3]);r.update(s),this._maskModelMesh=new RO([i],sk,er.TRIANGLE_LIST,r),this._maskModelMesh.subMeshIdx=0,this._maskClearModel.initSubModel(0,this._maskModelMesh,this._maskClearMtl)}},e._insertMaskBatch=function(t){this.autoMergeBatches(this._currComponent),this.resetRenderStates(),this._createClearModel(),this._maskClearModel.node=this._maskClearModel.transform=t.node;var e=Bk.sharedManager;e.pushMask(1);var i,n=e.clear(t),r=0,s=this._maskClearMtl;s&&(i=e.getStencilStage(n,s),r=e.getStencilHash(n));var a=this._maskClearModel,o=C.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var h=0;h=0;i--)t.splice(e[i],1)},e.reset=function(){var t=this;this._localDescriptorSetCache.forEach((function(e){t._localCachePool.free(e)})),this._localDescriptorSetCache.length=0},e.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},e.destroy=function(){this._descriptorSetCache.forEach((function(t){t.destroy()})),this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();C.internal.Batcher2D=cJ,t("UIDrawBatch",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(aY)),nt(gk.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),et(gk.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),it(gk.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),et(cJ.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),it(mG.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),et(mG.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("QuadRenderData",function(t){function e(e){var i;return i=t.call(this,e)||this,j(9006),i}return c(e,t),e}(mG));var dJ,pJ=null,mJ=-1,gJ="BES bswy:->@123丁ぁᄁ",yJ=Object.create(null),vJ=[],AJ=3e3;function SJ(){for(var t=!0,e=Date.now(),i=vJ.length-1;i>=0;i--){var n=vJ[i],r=n.fontFamilyName;if(e-n.startTime>AJ)j(4933,r),n.onComplete(null,r),vJ.splice(i,1);else{var s=n.refWidth,a="40px "+r;pJ.font=a,s!==XV(pJ,gJ,a)?(vJ.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(mJ),mJ=-1)}function bJ(t,e,i){var n=function(t){var e=t.lastIndexOf(".ttf");if(-1===e)return t;var i,n=t.lastIndexOf("/");return-1!==(i=-1===n?t.substring(0,e)+"_LABEL":t.substring(n+1,e)+"_LABEL").indexOf(" ")&&(i='"'+i+'"'),i}(t);if(yJ[n])i(null,n);else{if(!pJ){var r=document.createElement("canvas");r.width=100,r.height=100,pJ=r.getContext("2d")}var s=XV(pJ,gJ,"40px "+n),a=document.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",document.body.appendChild(a);var h=document.createElement("div"),u=h.style;if(u.fontFamily=n,h.innerHTML=".",u.position="absolute",u.left="-100px",u.top="-100px",document.body.appendChild(h),function(){if(void 0===dJ)if("FontFace"in window){var t=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);dJ=t?parseInt(t[1],10)>42:!e}else dJ=!1;return dJ}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=AJ?n():document.fonts.load("40px "+e).then((function(t){t.length>=1?i():setTimeout(r,100)}),(function(){n()}))}()})),r=null,s=new Promise((function(t,e){r=setTimeout(e,AJ)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){j(4933,e),i(null,e)}))}(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:s,onComplete:i,startTime:Date.now()};vJ.push(l),-1===mJ&&(mJ=setInterval(SJ,100))}yJ[n]=a}}function TJ(t,e,i,n){var r=new xV;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}ky.register({".font":bJ,".eot":bJ,".ttf":bJ,".woff":bJ,".svg":bJ,".ttc":bJ}),Zy.register({".font":TJ,".eot":TJ,".ttf":TJ,".woff":TJ,".svg":TJ,".ttc":TJ}),C.UI={MeshBuffer:gk,spriteAssembler:aJ,graphicsAssembler:YY,labelAssembler:yK,RenderData:pG,MeshRenderData:mG};var EJ,CJ,wJ,xJ,RJ,IJ,BJ,DJ=Symbol("CreateEval"),PJ=(_u("cc.animation.EmbeddedPlayer")((IJ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(this._delayTime-=t,this._delayTime>0)||(this._currentFramePlayed?this.time+=t*this._speed:this._currentFramePlayed=!0,this._process())},i.sample=function(){var t=this.getWrappedInfo(this.time,this._wrappedInfo);return this._sampleCurves(t.time),this._sampleEvents(t),this._sampleEmbeddedPlayers(t),t},i.onPlay=function(){var t;this.setTime(this._getPlaybackStart()),this._delayTime=this._delay,this._onReplayOrResume(),this.emit(BJ.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(BJ.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(BJ.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(BJ.PAUSE,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPause(this.current)},i._sampleCurves=function(t){var e=this._poseOutput,i=this._clipEval;e&&(e.weight=this.weight),i&&i.evaluate(t)},i._process=function(){this._useSimpleProcess?this.simpleProcess():this.process()},i.process=function(){var t,e=this.sample();this._allowLastFrame&&(t=this._lastWrapInfo?this._lastWrapInfo:this._lastWrapInfo=new Zh(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(BJ.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(BJ.FINISHED,this))},i.simpleProcess=function(){var t=this._playbackRange.min,e=this._playbackDuration,i=0,n=0;if(0!==e&&((i=this.time%e)<0&&(i+=e),n=(t+i)*this._invDuration),this._sampleCurves(t+i),this._clipEventEval||this._clipEmbeddedPlayerEval){var r=this.getWrappedInfo(this.time,this._wrappedInfo);this._sampleEvents(r),this._sampleEmbeddedPlayers(r)}this._allowLastFrame&&(Number.isNaN(this._lastIterations)&&(this._lastIterations=n),(this.time>0&&this._lastIterations>n||this.time<0&&this._lastIterations0&&(t-=1),1&t&&(i=!i)),(e&Wh.Reverse)===Wh.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new Zh;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var h=t%n;t=0===h?n:h}else t<0&&0!=(t%=n)&&(t+=n);var u=!1,l=this._wrapMode&Wh.ShouldWrap;l&&(u=this._needReverse(a));var c=u?-1:1;return this.speed<0&&(c*=-1),l&&u&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){NJ().addAnimation(this)},i._onPauseOrStop=function(){NJ().removeAnimation(this)},u(e,[{key:"clip",get:function(){return this._clip}},{key:"name",get:function(){return this._name}},{key:"length",get:function(){return this.duration}},{key:"wrapMode",get:function(){return this._wrapMode},set:function(t){var e;this._wrapMode=t,this.time=0,t&Wh.Loop?this.repeatCount=1/0:this.repeatCount=1,null===(e=this._clipEventEval)||void 0===e||e.setWrapMode(t)}},{key:"repeatCount",get:function(){return this._repeatCount},set:function(t){this._repeatCount=t;var e=this._wrapMode&Wh.ShouldWrap,i=(this.wrapMode&Wh.Reverse)===Wh.Reverse;this._useSimpleProcess=t===1/0&&!e&&!i}},{key:"delay",get:function(){return this._delay},set:function(t){this._delayTime=this._delay=t}},{key:"playbackRange",get:function(){return this._playbackRange},set:function(t){t.max,t.min,this._playbackRange.min=Math.max(t.min,0),this._playbackRange.max=Math.min(t.max,this.duration),this._playbackDuration=this._playbackRange.max-this._playbackRange.min,this.setTime(0)}},{key:"speed",get:function(){return this._speed},set:function(t){var e;this._speed=t,null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.notifyHostSpeedChanged(t)}},{key:"current",get:function(){return this.getWrappedInfo(this.time).time}},{key:"ratio",get:function(){return 0===this.duration?0:this.current/this.duration}},{key:"weight",get:function(){return this._weight},set:function(t){this._weight=t,this._poseOutput&&(this._poseOutput.weight=t)}},{key:"curveLoaded",get:function(){return this._curveLoaded}}]),e}(OJ));C.AnimationState=UJ,_u("cc.animation.EmbeddedAnimationClipPlayable")((GJ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;re){var i;(i=this._channels).push.apply(i,Array.from({length:t-e},(function(){return new nQ(new Df)})))}}}]),e}(iQ),CZ=S((EZ=wZ).prototype,"_channels",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),EZ)),function(){function t(t){this._curves=t,this._result=new Array(t.length).fill(0)}return t.prototype.evaluate=function(t){for(var e=this._result,i=e.length,n=0;n1}return!1}(e,this.uniformName)?{set:function(t){e.setUniformArray(n,t)}}:{set:function(t){e.setUniform(n,t)}}}var r=wv.getBindingFromHandle(i),s=e.properties[this.uniformName],a=s&&s.value?""+s.value+Fm(s.type):Om(s.type),o=vv.get(a);return o||(N("Illegal texture default value: "+a+"."),o=vv.get("default-texture")),{set:function(t){t||(t=o);var i=t.getGFXTexture();i&&i.width&&i.height&&(e.bindTexture(r,i),t instanceof Sg&&e.bindSampler(r,Qa.gfxDevice.getSampler(t.getSamplerInfo())))}}},t}(),IZ=S((RZ=PZ).prototype,"passIndex",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),BZ=S(RZ.prototype,"uniformName",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),DZ=S(RZ.prototype,"channelIndex",[Xu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),xZ=RZ))||xZ,hQ=_u("cc.animation.MorphWeightValueProxy")((LZ=function(){function t(){A(this,"subMeshIndex",FZ,this),A(this,"shapeIndex",NZ,this)}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),FZ=S((OZ=LZ).prototype,"subMeshIndex",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),NZ=S(OZ.prototype,"shapeIndex",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),MZ=OZ))||MZ,uQ=_u("cc.animation.MorphWeightsValueProxy")((UZ=function(){function t(){A(this,"subMeshIndex",GZ,this)}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),GZ=S((kZ=UZ).prototype,"subMeshIndex",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),VZ=kZ))||VZ,lQ=_u("cc.animation.MorphWeightsAllValueProxy")(zZ=function(){function t(){}return t.prototype.forTarget=function(t){return{set:function(e){for(var i,n,r=null!==(i=null===(n=t.mesh)||void 0===n?void 0:n.struct.primitives.length)&&void 0!==i?i:0,s=0;s1e-6){n=!1;break}this._findRatio=n?$Q:Qh}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());C.RatioSampler=KQ;var JQ=t("AnimCurve",function(){function t(e,i){this.types=void 0,this.type=null,this._values=[],this._lerp=void 0,this._duration=void 0,this._array=void 0,this._duration=i,this._values=e.values;var n=function(e){return"string"==typeof e?e:Array.isArray(e)?e[0]===e[1]&&e[2]===e[3]?t.Linear:t.Bezier(e):t.Linear};if(void 0!==e.easingMethod)this.type=n(e.easingMethod);else if(Array.isArray(e.easingMethods))this.types=e.easingMethods.map(n);else if(void 0!==e.easingMethods){this.types=new Array(this._values.length).fill(null);for(var r=0,s=Object.keys(e.easingMethods);r=e.ratios.length))return t.valueBetween(i,n-1,e.ratios[n-1],n,e.ratios[n]);n=e.ratios.length-1}return t.valueAt(n)}function QQ(t,e){if("string"==typeof e){var i=Af[e];i?t=i(t):q(3906,e)}else Array.isArray(e)&&(t=fd(e,t));return t}function $Q(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],h=t[a];n=(e-h)/(o-h)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.transformTime=function(t){return t-this._timeOffset},e.calculate=function(t,e,i){this._reset();var n=t.length;if(n){var r=t[0],s=t[n-1],a=yi(e,r,s),o=yi(i,r,s);this._timeOffset=a;var h=function(t,e,i){var n=t.length;i>=e&&e>=t[0]&&t[n-1];var r=i0(t,e),s=r.index,a=r.ratio,o=i0(t,i);return{fromIndex:s,fromRatio:a,toIndex:o.index,toRatio:o.ratio}}(t,a,o),u=h.fromIndex,l=h.fromRatio,c=h.toIndex,_=h.toRatio,f=!l,d=!_;u!==c||l!==_?(f||(this.preLerpIndex=u,this.preLerpRatio=l),this.directKeyframesBegin=f?u:u+1,this.directKeyframesEnd=c+1,d||(this.postLerpIndex=c,this.postLerpRatio=_)):f?(this.directKeyframesBegin=u,this.directKeyframesEnd=u+1):(this.preLerpIndex=u,this.preLerpRatio=l)}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0,this._timeOffset=0},u(t,[{key:"keyframesCount",get:function(){var t=this.preLerpIndex,e=this.directKeyframesBegin;return 0+(t<0?0:1)+(this.directKeyframesEnd-e)+(this.postLerpIndex<0?0:1)}}])}();var n0,r0=function(){function t(t,e){this._nodeEvaluations=void 0,this._nodeEvaluations=t.map((function(t){return t.createEvaluator(e)}))}return t.prototype.evaluate=function(t){this._nodeEvaluations.forEach((function(e){e.evaluate(t)}))},t}(),s0=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=C0(e.times,e.values,ji,t,"position",r)),i&&(this._rotation=C0(i.times,i.values,$i,t,"rotation",r)),n&&(this._scale=C0(n.times,n.values,ji,t,"scale",r))}return t.prototype.evaluate=function(t){if(this._position){var e=this._position.evaluator.evaluate(t);this._position.runtimeBinding.setValue(e)}if(this._rotation){var i=this._rotation.evaluator.evaluate(t);this._rotation.runtimeBinding.setValue(i)}if(this._scale){var n=this._scale.evaluator.evaluate(t);this._scale.runtimeBinding.setValue(n)}},t}(),a0=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(es)i.just=!0,i.index=n-1;else{var a=Qh(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,h=o-1,u=t[h],l=t[o],c=(e-t[h])/(l-u);i.just=!1,i.index=h,i.nextIndex=o,i.ratio=c}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),o0={uint8:Uint8Array,uint16:Uint16Array};function h0(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return n0.FLOAT_32;case 8:return n0.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(n0||(n0={}));var u0,l0,c0,_0,f0,d0,p0,m0,g0,y0,v0,A0,S0,b0,T0=_u("cc.animation.QuantizedFloatArray")((j$=function(){function t(t,e,i,n){void 0===n&&(n=0),A(this,"originalPrecision",z$,this),A(this,"min",H$,this),A(this,"extent",W$,this),A(this,"values",X$,this),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+J$(e)+" "+J$(i)+" "+n.join(" ")},u(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),z$=S((U$=j$).prototype,"originalPrecision",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),H$=S(U$.prototype,"min",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),W$=S(U$.prototype,"extent",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),X$=S(U$.prototype,"values",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),G$=U$))||G$;function E0(t,e){return t.values[e]/(1<=0){var _=u.substring(0,c),f=h[_];f&&(l.parent=f)}}for(var d=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=h[e.node];if(i)return H0(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[O0]=function(){this._embeddedPlayers.length=0},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,h=o.length,u=0;u=c&&t<=_?o?e!==u&&(h.stop(),h.play(),a.entered=!0):(h.play(),a.entered=!0):o&&(h.stop(),a.entered=!1),a.lastIterations=e,a.entered){var f=t-c;a.instantiatedPlayer.setTime(f)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?((s&Wh.PingPong)===Wh.PingPong?e*=-1:h=n,o++):1===e&&h===n-1&&ra)break}h+=e,this._doFire(h,!0)}while(h!==r&&h>-1&&h=e.length||this._ignoreIndex===t))for(var i=e[t],n=this._targetNode.components,r=i.events.length,s=0;s0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,h=s.rotation,u=s.eulerAngles;r&&(a&&r&Y0.POSITION&&(e=a.result),o&&r&Y0.SCALE&&(i=o.result),u&&r&Y0.EULER_ANGLES&&(n=u.result),h&&r&Y0.ROTATION&&(n=h.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},u(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}(),t1=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=Y0.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=Y0.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=Y0.EULER_ANGLES,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=Y0.ROTATION,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new Z0},i._createQuatBlendState=function(){return new Q0},e}($0),e1=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.createNodeBlendState=function(){return new t1},e}(q0),i1=function(){function t(t){this.refCount=0,this.result=new ji,this._defaultValue=new ji,this._clipBlendResult=new ji,this._accumulatedWeight=0,ji.copy(this._defaultValue,t),ji.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=s1(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),ji.lerp(e,e,i,t),ji.zero(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){ji.copy(this.result,this._defaultValue)},t}(),n1=function(){function t(t){this.refCount=0,this.result=new $i,this._defaultValue=new $i,this._clipBlendResult=new $i,this._accumulatedWeight=0,$i.copy(this._defaultValue,t),$i.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=a1(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),$i.slerp(e,e,i,t),$i.identity(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){$i.copy(this.result,this._defaultValue)},t}(),r1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>>0,e}c(e,t);var i=e.prototype;return i.setLayerMask=function(t){this._layerMask&=~(1<0;){t=l1[--i],l1[i]=null;var r=t.node;hn.fromRTS(t.local,r.rotation,r.position,r.scale),n=hn.multiply(t.world,n,t.local)}return n}function f1(t){for(var e=c1.get(t.uuid)||null;e;)c1.delete(e.node.uuid),e=e.parent}var d1=t("AnimationManager",_u((u1=h1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?this._crossFades.fastRemoveAt(e):q(3907)},i.update=function(t){var e=this._delayEvents,i=this._crossFades,n=this._sockets,r=i.array;for(i.i=0;i.i=0?this._anims.fastRemoveAt(e):q(3907)},i.pushDelayEvent=function(t,e,i){this._delayEvents.push({fn:t,thisArg:e,args:i})},i.addSockets=function(t,e){for(var i=this,n=function(n){var r=e[n];if(i._sockets.find((function(t){return t.target===r.target})))return"continue";var s=t.getChildByPath(r.path),a=r.target&&s&&function(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(c1.has(s)){n=c1.get(s);break}n={node:t,local:new hn,world:new hn,stamp:-1,parent:null},c1.set(s,n),l1[r++]=n,t=t.parent,n=null}for(;r>0;)i=l1[--r],l1[r]=null,i.parent=n,n=i;return n}(s,t);a&&i._sockets.push({target:r.target,transform:a})},r=0;r=h.easeDuration){a=o+1,h.easeTime=h.easeDuration;break}}if(a!==i.length){for(var c=a;c=0||(this._clips.push(t),this.createState(t)))}}]),e}(Pa(Cc)),B1.EventType=BJ,S((w1=D1).prototype,"clips",[v1,A1],Object.getOwnPropertyDescriptor(w1.prototype,"clips"),w1.prototype),S(w1.prototype,"defaultClip",[S1,b1],Object.getOwnPropertyDescriptor(w1.prototype,"defaultClip"),w1.prototype),x1=S(w1.prototype,"playOnLoad",[Au,T1],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),R1=S(w1.prototype,"_clips",[E1],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),I1=S(w1.prototype,"_defaultClip",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),C1=w1))||C1)||C1)||C1)||C1)||C1));function O1(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}C.Animation=M1,C.AnimationComponent=M1,le.setClassAlias(M1,"cc.AnimationComponent");var F1,N1,L1,V1=new hn;C.easing=Af,function(t){t.PLAYED="play",t.PAUSED="pause",t.STOPPED="stop",t.SEEKED="seeked",t.ENDED="ended",t.INTERRUPTION_BEGIN="interruptionBegin",t.INTERRUPTION_END="interruptionEnd",t.USER_GESTURE="on_gesture"}(F1||(F1={})),function(t){t[t.DOM_AUDIO=0]="DOM_AUDIO",t[t.WEB_AUDIO=1]="WEB_AUDIO",t[t.MINIGAME_AUDIO=2]="MINIGAME_AUDIO",t[t.NATIVE_AUDIO=3]="NATIVE_AUDIO",t[t.UNKNOWN_AUDIO=4]="UNKNOWN_AUDIO"}(N1||(N1={})),function(t){t[t.INIT=0]="INIT",t[t.PLAYING=1]="PLAYING",t[t.PAUSED=2]="PAUSED",t[t.STOPPED=3]="STOPPED",t[t.INTERRUPTED=4]="INTERRUPTED"}(L1||(L1={}));var k1,G1=t("AudioPCMDataView",function(){function t(){if(this._bufferView=void 0,this._normalizeFactor=1,2===arguments.length)this._bufferView=arguments.length<=0?void 0:arguments[0],this._normalizeFactor=arguments.length<=1?void 0:arguments[1];else{var t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],i=arguments.length<=2?void 0:arguments[2];this._bufferView=new e(t),this._normalizeFactor=i}}return t.prototype.getData=function(t){return this._bufferView[t]*this._normalizeFactor},u(t,[{key:"length",get:function(){return this._bufferView.length}}]),t}()),U1=0;function z1(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString());var i=t._operationQueue[0];i&&z1(t,i)})).catch((function(){})))}function H1(t,e,i){var n=i.value;i.value=function(){for(var t=this,e=arguments.length,i=new Array(e),r=0;r=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=yi(t,0,this.duration)},u(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),J1=new(function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}()),Z1=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,Q1="on-context-running",$1=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new Ma,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(Q1)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(Q1,t,e)},e.offRunning=function(t,e){this._eventTarget.off(Q1,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(){}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(){})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function(){i.resume().then(e).catch((function(){}))};null==n||n.addEventListener("touchend",r,{once:!0,capture:!0}),null==n||n.addEventListener("mouseup",r,{once:!0,capture:!0})}else e();else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},u(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();$1.support=!!Z1,$1.support&&(j1=new $1);var t2,e2,i2,n2,r2,s2=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=j1.createBufferSource(t,!1);var n=j1.createGain(e);this._bufferSourceNode.connect(n),j1.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),j1.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;J1.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(){}))},e.stop=function(){clearTimeout(this._currentTimer),J1.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.buffer=null},u(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),a2=(S((X1=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=L1.INIT,this._audioTimer=void 0,this._eventTarget=new Ma,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new K1(t),this._gainNode=j1.createGain(),j1.connectContext(this._gainNode),this._src=e,za.on("hide",this._onHide,this),za.on("show",this._onShow,this)}var e=t.prototype;return e.destroy=function(){this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),J1.tryReleasingCache(this._src),za.off("hide",this._onHide,this),za.off("show",this._onShow,this)},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(n){i(new t(n,e))})).catch((function(){}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=J1.getCache(t);if(n)return J1.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?j1.decodeAudioData(r.response).then((function(i){J1.addCache(t,i),e(i)})).catch((function(){})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new s2(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new G1(this._audioBuffer.getChannelData(t),1)},e._onHide=function(){var t=this;this._state===L1.PLAYING&&this.pause().then((function(){t._state=L1.INTERRUPTED,t._eventTarget.emit(F1.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onShow=function(){var t=this;this._state===L1.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(F1.INTERRUPTION_END)})).catch((function(){}))},e.seek=function(t){var e=this;return new Promise((function(i){j1.offRunning(),e._audioTimer.seek(t),e._state===L1.PLAYING?e._doPlay().then(i).catch((function(){})):i()}))},e.play=function(){return j1.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){j1.isRunning?(t._startSourceNode(),e()):(j1.onceRunning((function(){t._startSourceNode(),e()})),j1.runContext().catch((function(){})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=j1.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.start(0,this._audioTimer.currentTime),this._state=L1.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(F1.ENDED),t._state=L1.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.buffer=null)}catch(t){}},e.pause=function(){return j1.offRunning(),this._state===L1.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=L1.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return j1.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=L1.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.onInterruptionBegin=function(t){this._eventTarget.on(F1.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(F1.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(F1.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(F1.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(F1.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(F1.ENDED,t)},u(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return N1.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=vi(t),this._volume=t,j1.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}()).prototype,"seek",[H1],Object.getOwnPropertyDescriptor(X1.prototype,"seek"),X1.prototype),S(X1.prototype,"play",[H1],Object.getOwnPropertyDescriptor(X1.prototype,"play"),X1.prototype),S(X1.prototype,"pause",[H1],Object.getOwnPropertyDescriptor(X1.prototype,"pause"),X1.prototype),S(X1.prototype,"stop",[H1],Object.getOwnPropertyDescriptor(X1.prototype,"stop"),X1.prototype),X1),o2=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},u(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),h2=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n){(null==i?void 0:i.audioLoadMode)!==N1.DOM_AUDIO&&$1.support?a2.load(e).then((function(e){n(new t(e))})).catch((function(){})):($1.support||j(5201),q1.load(e).then((function(e){n(new t(e))})).catch((function(){})))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==N1.DOM_AUDIO&&$1.support?a2.loadNative(t):($1.support||j(5201),q1.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==N1.DOM_AUDIO&&$1.support?a2.loadOneShotAudio(t,e).then((function(t){n(new o2(t))})).catch(r):($1.support||j(5201),q1.loadOneShotAudio(t,e).then((function(t){n(new o2(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},u(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();h2.maxAudioChannel=24;var u2=t("AudioClip",_u("cc.AudioClip")((r2=n2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){if(t instanceof h2){if(this._tryAddPlaying(this._audioPlayerInfoList,t))return}else this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(gt(t,i),!0)},e.removePlaying=function(t){if(t instanceof h2){if(this._tryRemovePlaying(this._audioPlayerInfoList,t))return}else this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime0){for(var i=0,n=this._objects;i0){for(var r=0;ri&&(r.length=i),t._maxCountMap[n]=i;else for(var n in t._defaultMaxCount=i,t._poolsMap){var r;(r=t._poolsMap[n]).length>i&&(r.length=i),n in t._maxCountMap&&(t._maxCountMap[n]=i)}},t.clearPool=function(e){if(void 0===e&&(e=null),null!==e){var i=String(e);null!==(r=i in t._poolsMap?t._poolsMap[i]:null)&&r.length>0&&(r.length=0)}else for(var n in t._poolsMap){var r;(r=t._poolsMap[n]).length=0}},t.borrowObject=function(e){var i=String(e),n=i in t._poolsMap?t._poolsMap[i]:null;if(null!==n&&n.length>0){var r=n.pop();return r._isInPool=!1,r}var s=new e;return s._onClear(),s},t.prototype.returnToPool=function(){this._onClear(),t._returnObject(this)},t._hashCode=0,t._defaultMaxCount=3e3,t._maxCountMap={},t._poolsMap={},t}();t.BaseObject=e}(k2||(k2={})),function(t){var e=function(){function t(t,e,i,n,r,s){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=s}return t.prototype.toString=function(){return"[object dragonBones.Matrix] a:"+this.a+" b:"+this.b+" c:"+this.c+" d:"+this.d+" tx:"+this.tx+" ty:"+this.ty},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},t.prototype.copyFromArray=function(t,e){return void 0===e&&(e=0),this.a=t[e],this.b=t[e+1],this.c=t[e+2],this.d=t[e+3],this.tx=t[e+4],this.ty=t[e+5],this},t.prototype.identity=function(){return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this},t.prototype.concat=function(t){var e=this.a*t.a,i=0,n=0,r=this.d*t.d,s=this.tx*t.a+t.tx,a=this.ty*t.d+t.ty;return 0===this.b&&0===this.c||(e+=this.b*t.c,i+=this.b*t.d,n+=this.c*t.a,r+=this.c*t.b),0===t.b&&0===t.c||(i+=this.a*t.b,n+=this.d*t.c,s+=this.ty*t.c,a+=this.tx*t.b),this.a=e,this.b=i,this.c=n,this.d=r,this.tx=s,this.ty=a,this},t.prototype.invert=function(){var t=this.a,e=this.b,i=this.c,n=this.d,r=this.tx,s=this.ty;if(0===e&&0===i)return this.b=this.c=0,0===t||0===n?this.a=this.b=this.tx=this.ty=0:(t=this.a=1/t,n=this.d=1/n,this.tx=-t*r,this.ty=-n*s),this;var a=t*n-e*i;if(0===a)return this.a=this.d=1,this.b=this.c=0,this.tx=this.ty=0,this;a=1/a;var o=this.a=n*a;return e=this.b=-e*a,i=this.c=-i*a,n=this.d=t*a,this.tx=-(o*r+i*s),this.ty=-(e*r+n*s),this},t.prototype.transformPoint=function(t,e,i,n){void 0===n&&(n=!1),i.x=this.a*t+this.c*e,i.y=this.b*t+this.d*e,n||(i.x+=this.tx,i.y+=this.ty)},t.prototype.transformRectangle=function(t,e){void 0===e&&(e=!1);var i=this.a,n=this.b,r=this.c,s=this.d,a=e?0:this.tx,o=e?0:this.ty,h=t.x,u=t.y,l=h+t.width,c=u+t.height,_=i*h+r*u+a,f=n*h+s*u+o,d=i*l+r*u+a,p=n*l+s*u+o,m=i*l+r*c+a,g=n*l+s*c+o,y=i*h+r*c+a,v=n*h+s*c+o,A=0;_>d&&(A=_,_=d,d=A),m>y&&(A=m,m=y,y=A),t.x=Math.floor(_y?d:y)-t.x),f>p&&(A=f,f=p,p=A),g>v&&(A=g,g=v,v=A),t.y=Math.floor(fv?p:v)-t.y)},t}();t.Matrix=e}(k2||(k2={})),function(t){var e=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=1),this.x=t,this.y=e,this.skew=i,this.rotation=n,this.scaleX=r,this.scaleY=s}return t.normalizeRadian=function(t){return(t=(t+Math.PI)%(2*Math.PI))+(t>0?-Math.PI:Math.PI)},t.prototype.toString=function(){return"[object dragonBones.Transform] x:"+this.x+" y:"+this.y+" skewX:"+180*this.skew/Math.PI+" skewY:"+180*this.rotation/Math.PI+" scaleX:"+this.scaleX+" scaleY:"+this.scaleY},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.skew=t.skew,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this},t.prototype.identity=function(){return this.x=this.y=0,this.skew=this.rotation=0,this.scaleX=this.scaleY=1,this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.skew+=t.skew,this.rotation+=t.rotation,this.scaleX*=t.scaleX,this.scaleY*=t.scaleY,this},t.prototype.minus=function(t){return this.x-=t.x,this.y-=t.y,this.skew-=t.skew,this.rotation-=t.rotation,this.scaleX/=t.scaleX,this.scaleY/=t.scaleY,this},t.prototype.fromMatrix=function(e){var i=this.scaleX,n=this.scaleY,r=t.PI_Q;this.x=e.tx,this.y=e.ty,this.rotation=Math.atan(e.b/e.a);var s=Math.atan(-e.c/e.d);return this.scaleX=this.rotation>-r&&this.rotation-r&&s=0&&this.scaleX<0&&(this.scaleX=-this.scaleX,this.rotation=this.rotation-Math.PI),n>=0&&this.scaleY<0&&(this.scaleY=-this.scaleY,s-=Math.PI),this.skew=s-this.rotation,this},t.prototype.toMatrix=function(t){return 0===this.rotation?(t.a=1,t.b=0):(t.a=Math.cos(this.rotation),t.b=Math.sin(this.rotation)),0===this.skew?(t.c=-t.b,t.d=t.a):(t.c=-Math.sin(this.skew+this.rotation),t.d=Math.cos(this.skew+this.rotation)),1!==this.scaleX&&(t.a*=this.scaleX,t.b*=this.scaleX),1!==this.scaleY&&(t.c*=this.scaleY,t.d*=this.scaleY),t.tx=this.x,t.ty=this.y,this},t.PI=Math.PI,t.PI_D=2*Math.PI,t.PI_H=Math.PI/2,t.PI_Q=Math.PI/4,t.RAD_DEG=180/Math.PI,t.DEG_RAD=Math.PI/180,t}();t.Transform=e}(k2||(k2={})),function(t){var e=function(){function t(t,e,i,n,r,s,a,o){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),this.alphaMultiplier=t,this.redMultiplier=e,this.greenMultiplier=i,this.blueMultiplier=n,this.alphaOffset=r,this.redOffset=s,this.greenOffset=a,this.blueOffset=o}return t.prototype.copyFrom=function(t){this.alphaMultiplier=t.alphaMultiplier,this.redMultiplier=t.redMultiplier,this.greenMultiplier=t.greenMultiplier,this.blueMultiplier=t.blueMultiplier,this.alphaOffset=t.alphaOffset,this.redOffset=t.redOffset,this.greenOffset=t.greenOffset,this.blueOffset=t.blueOffset},t.prototype.identity=function(){this.alphaMultiplier=this.redMultiplier=this.greenMultiplier=this.blueMultiplier=1,this.alphaOffset=this.redOffset=this.greenOffset=this.blueOffset=0},t}();t.ColorTransform=e}(k2||(k2={})),function(t){var e=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t.prototype.clear=function(){this.x=this.y=0},t}();t.Point=e}(k2||(k2={})),function(t){var e=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},t.prototype.clear=function(){this.x=this.y=0,this.width=this.height=0},t}();t.Rectangle=e}(k2||(k2={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.ints=[],e.floats=[],e.strings=[],e}return V2(e,t),e.toString=function(){return"[class dragonBones.UserData]"},e.prototype._onClear=function(){this.ints.length=0,this.floats.length=0,this.strings.length=0},e.prototype.addInt=function(t){this.ints.push(t)},e.prototype.addFloat=function(t){this.floats.push(t)},e.prototype.addString=function(t){this.strings.push(t)},e.prototype.getInt=function(t){return void 0===t&&(t=0),t>=0&&t=0&&t=0&&t=t&&(i=0),!(this.sortedBones.indexOf(r)>=0)){var s=!1;for(var a in this.constraints){var o=this.constraints[a];if(o.root===r&&this.sortedBones.indexOf(o.target)<0){s=!0;break}}s||null!==r.parent&&this.sortedBones.indexOf(r.parent)<0||(this.sortedBones.push(r),n++)}}}},i.prototype.cacheFrames=function(t){if(!(this.cacheFrameRate>0))for(var e in this.cacheFrameRate=t,this.animations)this.animations[e].cacheFrames(this.cacheFrameRate)},i.prototype.setCacheFrame=function(t,e){var i=this.parent.cachedFrames,n=i.length;return i.length+=10,i[n]=t.a,i[n+1]=t.b,i[n+2]=t.c,i[n+3]=t.d,i[n+4]=t.tx,i[n+5]=t.ty,i[n+6]=e.rotation,i[n+7]=e.skew,i[n+8]=e.scaleX,i[n+9]=e.scaleY,n},i.prototype.getCacheFrame=function(t,e,i){var n=this.parent.cachedFrames;t.a=n[i],t.b=n[i+1],t.c=n[i+2],t.d=n[i+3],t.tx=n[i+4],t.ty=n[i+5],e.rotation=n[i+6],e.skew=n[i+7],e.scaleX=n[i+8],e.scaleY=n[i+9],e.x=t.tx,e.y=t.ty},i.prototype.addBone=function(t){t.name in this.bones?console.warn("Same bone: "+t.name):(this.bones[t.name]=t,this.sortedBones.push(t))},i.prototype.addSlot=function(t){t.name in this.slots?console.warn("Same slot: "+t.name):(this.slots[t.name]=t,this.sortedSlots.push(t))},i.prototype.addConstraint=function(t){t.name in this.constraints?console.warn("Same constraint: "+t.name):this.constraints[t.name]=t},i.prototype.addSkin=function(t){t.name in this.skins?console.warn("Same skin: "+t.name):(t.parent=this,this.skins[t.name]=t,null===this.defaultSkin&&(this.defaultSkin=t),"default"===t.name&&(this.defaultSkin=t))},i.prototype.addAnimation=function(t){t.name in this.animations?console.warn("Same animation: "+t.name):(t.parent=this,this.animations[t.name]=t,this.animationNames.push(t.name),null===this.defaultAnimation&&(this.defaultAnimation=t))},i.prototype.addAction=function(t,e){e?this.defaultActions.push(t):this.actions.push(t)},i.prototype.getBone=function(t){return t in this.bones?this.bones[t]:null},i.prototype.getSlot=function(t){return t in this.slots?this.slots[t]:null},i.prototype.getConstraint=function(t){return t in this.constraints?this.constraints[t]:null},i.prototype.getSkin=function(t){return t in this.skins?this.skins[t]:null},i.prototype.getMesh=function(t,e,i){var n=this.getSkin(t);return null===n?null:n.getDisplay(e,i)},i.prototype.getAnimation=function(t){return t in this.animations?this.animations[t]:null},i}(t.BaseObject);t.ArmatureData=e;var i=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i.transform=new t.Transform,i.userData=null,i}return V2(i,e),i.toString=function(){return"[class dragonBones.BoneData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.inheritTranslation=!1,this.inheritRotation=!1,this.inheritScale=!1,this.inheritReflection=!1,this.type=0,this.length=0,this.name="",this.transform.identity(),this.userData=null,this.parent=null},i}(t.BaseObject);t.BoneData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return V2(e,t),e.toString=function(){return"[class dragonBones.SurfaceData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1,this.segmentX=0,this.segmentY=0,this.vertices.length=0},e}(i);t.SurfaceData=n;var r=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.color=null,t.userData=null,t}return V2(i,e),i.createColor=function(){return new t.ColorTransform},i.toString=function(){return"[class dragonBones.SlotData]"},i.prototype._onClear=function(){null!==this.userData&&this.userData.returnToPool(),this.blendMode=0,this.displayIndex=0,this.zOrder=0,this.name="",this.color=null,this.userData=null,this.parent=null},i.DEFAULT_COLOR=new t.ColorTransform,i}(t.BaseObject);t.SlotData=r}(k2||(k2={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.prototype._onClear=function(){this.order=0,this.name="",this.type=0,this.target=null,this.root=null,this.bone=null},e}(t.BaseObject);t.ConstraintData=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.toString=function(){return"[class dragonBones.IKConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.scaleEnabled=!1,this.bendPositive=!1,this.weight=1},e}(e);t.IKConstraintData=i;var n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bones=[],e}return V2(e,t),e.toString=function(){return"[class dragonBones.PathConstraintData]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.pathSlot=null,this.pathDisplayData=null,this.bones.length=0,this.positionMode=0,this.spacingMode=1,this.rotateMode=1,this.position=0,this.spacing=0,this.rotateOffset=0,this.rotateMix=0,this.translateMix=0},e.prototype.AddBone=function(t){this.bones.push(t)},e}(e);t.PathConstraintData=n}(k2||(k2={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.toString=function(){return"[class dragonBones.CanvasData]"},e.prototype._onClear=function(){this.hasBackground=!1,this.color=0,this.x=0,this.y=0,this.width=0,this.height=0},e}(t.BaseObject);t.CanvasData=e}(k2||(k2={})),function(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.displays={},e}return V2(e,t),e.toString=function(){return"[class dragonBones.SkinData]"},e.prototype._onClear=function(){for(var t in this.displays){for(var e=0,i=this.displays[t];er&&(a|=2),es&&(a|=8),a},e.rectangleIntersectsSegment=function(t,i,n,r,s,a,o,h,u,l,c){void 0===u&&(u=null),void 0===l&&(l=null),void 0===c&&(c=null);var _=t>s&&ta&&is&&na&&r=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return!0}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null);var h=.5*this.width,u=.5*this.height;return e.rectangleIntersectsSegment(t,i,n,r,-h,-u,h,u,s,a,o)},e}(e);t.RectangleBoundingBoxData=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.toString=function(){return"[class dragonBones.EllipseData]"},e.ellipseIntersectsSegment=function(t,e,i,n,r,s,a,o,h,u,l){void 0===h&&(h=null),void 0===u&&(u=null),void 0===l&&(l=null);var c=a/o,_=c*c,f=i-t,d=(n*=c)-(e*=c),p=Math.sqrt(f*f+d*d),m=f/p,g=d/p,y=(r-t)*m+(s-e)*g,v=a*a,A=v-(t*t+e*e)+y*y,S=0;if(A>=0){var b=Math.sqrt(A),T=y-b,E=y+b,C=T<0?-1:T<=p?0:1,w=E<0?-1:E<=p?0:1,x=C*w;if(x<0)return-1;0===x&&(-1===C?(S=2,i=t+E*m,n=(e+E*g)/c,null!==h&&(h.x=i,h.y=n),null!==u&&(u.x=i,u.y=n),null!==l&&(l.x=Math.atan2(n/v*_,i/v),l.y=l.x+Math.PI)):1===w?(S=1,t+=T*m,e=(e+T*g)/c,null!==h&&(h.x=t,h.y=e),null!==u&&(u.x=t,u.y=e),null!==l&&(l.x=Math.atan2(e/v*_,t/v),l.y=l.x+Math.PI)):(S=3,null!==h&&(h.x=t+T*m,h.y=(e+T*g)/c,null!==l&&(l.x=Math.atan2(h.y/v*_,h.x/v))),null!==u&&(u.x=t+E*m,u.y=(e+E*g)/c,null!==l&&(l.y=Math.atan2(u.y/v*_,u.x/v)))))}return S},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=1},e.prototype.containsPoint=function(t,e){var i=.5*this.width;if(t>=-i&&t<=i){var n=.5*this.height;if(e>=-n&&e<=n)return e*=i/n,Math.sqrt(t*t+e*e)<=i}return!1},e.prototype.intersectsSegment=function(t,i,n,r,s,a,o){return void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),e.ellipseIntersectsSegment(t,i,n,r,0,0,.5*this.width,.5*this.height,s,a,o)},e}(e);t.EllipseBoundingBoxData=n;var r=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.vertices=[],e}return V2(e,t),e.toString=function(){return"[class dragonBones.PolygonBoundingBoxData]"},e.polygonIntersectsSegment=function(t,e,i,n,r,s,a,o){void 0===s&&(s=null),void 0===a&&(a=null),void 0===o&&(o=null),t===i&&(t=i+1e-6),e===n&&(e=n+1e-6);for(var h=r.length,u=t-i,l=e-n,c=t*n-e*i,_=0,f=r[h-2],d=r[h-1],p=0,m=0,g=0,y=0,v=0,A=0,S=0;S=f&&R<=b||R>=b&&R<=f)&&(0===u||R>=t&&R<=i||R>=i&&R<=t)){var I=(c*C-l*w)/x;if((I>=d&&I<=T||I>=T&&I<=d)&&(0===l||I>=e&&I<=n||I>=n&&I<=e)){if(null===a){g=R,y=I,v=R,A=I,_++,null!==o&&(o.x=Math.atan2(T-d,b-f)-.5*Math.PI,o.y=o.x);break}var B=R-t;B<0&&(B=-B),0===_?(p=B,m=B,g=R,y=I,v=R,A=I,null!==o&&(o.x=Math.atan2(T-d,b-f)-.5*Math.PI,o.y=o.x)):(Bm&&(m=B,v=R,A=I,null!==o&&(o.y=Math.atan2(T-d,b-f)-.5*Math.PI))),_++}}f=b,d=T}return 1===_?(null!==s&&(s.x=g,s.y=y),null!==a&&(a.x=g,a.y=y),null!==o&&(o.y=o.x+Math.PI)):_>1&&(_++,null!==s&&(s.x=g,s.y=y),null!==a&&(a.x=v,a.y=A)),_},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.type=2,this.x=0,this.y=0,this.vertices.length=0},e.prototype.containsPoint=function(t,e){var i=!1;if(t>=this.x&&t<=this.width&&e>=this.y&&e<=this.height)for(var n=0,r=this.vertices.length,s=r-2;n=e||a=e){var h=this.vertices[s],u=this.vertices[n];(e-o)*(h-u)/(a-o)+u0)){this.cacheFrameRate=Math.max(Math.ceil(t*this.scale),1);var e=Math.ceil(this.cacheFrameRate*this.duration)+1;this.cachedFrames.length=e;for(var i=0,n=this.cacheFrames.length;i=0},e.prototype.addBoneMask=function(t,e,i){void 0===i&&(i=!0);var n=t.getBone(e);if(null!==n&&(this.boneMask.indexOf(e)<0&&this.boneMask.push(e),i))for(var r=0,s=t.getBones();r=0&&this.boneMask.splice(n,1),i){var r=t.getBone(e);if(null!==r)if(this.boneMask.length>0)for(var s=0,a=t.getBones();s=0&&r.contains(o)&&this.boneMask.splice(h,1)}else for(var u=0,l=t.getBones();ue._zOrder?1:-1},i.prototype._onClear=function(){null!==this._clock&&this._clock.remove(this);for(var t=0,e=this._bones;t=s)){var o=i[a],h=this.getSlot(o.name);null!==h&&h._setZorder(r)}}this._slotsDirty=!0,this._zOrderDirty=!n}},i.prototype._addBone=function(t){this._bones.indexOf(t)<0&&this._bones.push(t)},i.prototype._addSlot=function(t){this._slots.indexOf(t)<0&&this._slots.push(t)},i.prototype._addConstraint=function(t){this._constraints.indexOf(t)<0&&this._constraints.push(t)},i.prototype._bufferAction=function(t,e){this._actions.indexOf(t)<0&&(e?this._actions.push(t):this._actions.unshift(t))},i.prototype.dispose=function(){null!==this._armatureData&&(this._lockUpdate=!0,this._dragonBones.bufferObject(this))},i.prototype.init=function(e,i,n,r){null===this._armatureData&&(this._armatureData=e,this._animation=t.BaseObject.borrowObject(t.Animation),this._proxy=i,this._display=n,this._dragonBones=r,this._proxy.dbInit(this),this._animation.init(this),this._animation.animations=this._armatureData.animations)},i.prototype.advanceTime=function(t){if(!this._lockUpdate)if(null!==this._armatureData)if(null!==this._armatureData.parent){var e=this._cacheFrameIndex;if(this._animation.advanceTime(t),this._slotsDirty&&(this._slotsDirty=!1,this._slots.sort(i._onSortSlots)),this._cacheFrameIndex<0||this._cacheFrameIndex!==e){var n=0,r=0;for(n=0,r=this._bones.length;n0){this._lockUpdate=!0;for(var s=0,a=this._actions;s0){if(null!==(a=this.getBone(t))&&(a.invalidUpdate(),e))for(var i=0,n=this._slots;i0){if(null===r&&null===s){m=A;break}var S;null!==r&&((S=o?r.y-e:r.x-t)<0&&(S=-S),(null===m||Su)&&(u=S,_=s.x,f=s.y,g=A,null!==a&&(p=a.y)))}}return null!==m&&null!==r&&(r.x=l,r.y=c,null!==a&&(a.x=d)),null!==g&&null!==s&&(s.x=_,s.y=f,null!==a&&(a.y=p)),m},i.prototype.getBone=function(t){for(var e=0,i=this._bones;e=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];if(e>=0&&this._cachedFrameIndex===e)this._transformDirty=!1;else if(e>=0)this._transformDirty=!0,this._cachedFrameIndex=e;else{if(this._hasConstraint)for(var i=0,n=this._armature._constraints;i=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var r=0,s=this._armature._constraints;r=0;this._localDirty&&this._updateGlobalTransformMatrix(o),o&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},i.prototype.updateByConstraint=function(){this._localDirty&&(this._localDirty=!1,(this._transformDirty||null!==this._parent&&this._parent._childrenTransformDirty)&&this._updateGlobalTransformMatrix(!0),this._transformDirty=!0)},i.prototype.invalidUpdate=function(){this._transformDirty=!0},i.prototype.contains=function(t){if(t===this)return!1;for(var e=t;e!==this&&null!==e;)e=e.parent;return e===this},Object.defineProperty(i.prototype,"boneData",{get:function(){return this._boneData},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){if(this._visible!==t){this._visible=t;for(var e=0,i=this._armature.getSlots();e=s)return this.globalTransformMatrix;if(d=7*(2*(o*(h+1)+2*o+h+f)+((r=i>this._kX*(t+s)+m)?1:0)),this._matrixCahce[d]>0)y.copyFromArray(g,d+1);else{var v=f*(u+2),A=this._hullCache[4],S=this._hullCache[5],b=this._hullCache[2]-(h-f)*A,T=this._hullCache[3]-(h-f)*S,E=this._vertices;r?this._getAffineTransform(-s,m+c,800,c,E[v+u+2],E[v+u+3],b+A,T+S,E[v],E[v+1],e._helpTransform,y,!0):this._getAffineTransform(-n,m,800,c,b,T,E[v],E[v+1],b+A,T+S,e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty}}else if(t>=s){if(i<-s||i>=s)return this.globalTransformMatrix;d=7*(2*(o*(h+1)+o+f)+((r=i>this._kX*(t-n)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=(f+1)*(u+2)-2,A=this._hullCache[4],S=this._hullCache[5],b=this._hullCache[0]+f*A,T=this._hullCache[1]+f*S,E=this._vertices,r?this._getAffineTransform(n,m+c,800,c,b+A,T+S,E[v+u+2],E[v+u+3],b,T,e._helpTransform,y,!0):this._getAffineTransform(s,m,800,c,E[v],E[v+1],b,T,E[v+u+2],E[v+u+3],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else if(i<-s){if(t<-s||t>=s)return this.globalTransformMatrix;d=7*(o*(h+1)+2*_+((r=i>this._kY*(t-p-l)-n)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*_,A=this._hullCache[10],S=this._hullCache[11],b=this._hullCache[8]+_*A,T=this._hullCache[9]+_*S,E=this._vertices,r?this._getAffineTransform(p+l,-s,l,800,E[v+2],E[v+3],E[v],E[v+1],b+A,T+S,e._helpTransform,y,!0):this._getAffineTransform(p,-n,l,800,b,T,b+A,T+S,E[v],E[v+1],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else if(i>=s){if(t<-s||t>=s)return this.globalTransformMatrix;d=7*(2*(o*(h+1)+o+h+f)+((r=i>this._kY*(t-p-l)+s)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=h*(u+2)+2*_,A=this._hullCache[10],S=this._hullCache[11],b=this._hullCache[6]-(o-_)*A,T=this._hullCache[7]-(o-_)*S,E=this._vertices,r?this._getAffineTransform(p+l,n,l,800,b+A,T+S,b,T,E[v+2],E[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,s,l,800,E[v],E[v+1],E[v+2],E[v+3],b,T,e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty)}else d=7*(2*(o*f+_)+((r=i>this._k*(t-p-l)+m)?1:0)),this._matrixCahce[d]>0?y.copyFromArray(g,d+1):(v=2*_+f*(u+2),E=this._vertices,r?this._getAffineTransform(p+l,m+c,l,c,E[v+u+4],E[v+u+5],E[v+u+2],E[v+u+3],E[v+2],E[v+3],e._helpTransform,y,!0):this._getAffineTransform(p,m,l,c,E[v],E[v+1],E[v+2],E[v+3],E[v+u+2],E[v+u+3],e._helpTransform,y,!1),g[d]=1,g[d+1]=y.a,g[d+2]=y.b,g[d+3]=y.c,g[d+4]=y.d,g[d+5]=y.tx,g[d+6]=y.ty);return y},e.prototype.init=function(e,i){if(null===this._boneData){t.prototype.init.call(this,e,i);var n=e.segmentX,r=e.segmentY,s=e.vertices.length;this._dX=400/n,this._dY=400/r,this._k=-this._dY/this._dX,this._kX=-this._dY/800,this._kY=-800/this._dX,this._vertices.length=s,this._deformVertices.length=s,this._matrixCahce.length=14*(n*r+2*n+2*r),this._hullCache.length=10;for(var a=0;a=0&&null!==this._cachedFrameIndices){var i=this._cachedFrameIndices[t];if(i>=0&&this._cachedFrameIndex===i)this._transformDirty=!1;else if(i>=0)this._transformDirty=!0,this._cachedFrameIndex=i;else{if(this._hasConstraint)for(var n=0,r=this._armature._constraints;n=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}}else{if(this._hasConstraint)for(var s=0,a=this._armature._constraints;s=0;this._localDirty&&this._updateGlobalTransformMatrix(l),l&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);var c=2*this.global.x,_=2*this.global.y,f=e._helpPoint;this.globalTransformMatrix.transformPoint(1e3,-200,f),this._hullCache[0]=f.x,this._hullCache[1]=f.y,this._hullCache[2]=c-f.x,this._hullCache[3]=_-f.y,this.globalTransformMatrix.transformPoint(0,this._dY,f,!0),this._hullCache[4]=f.x,this._hullCache[5]=f.y,this.globalTransformMatrix.transformPoint(200,1e3,f),this._hullCache[6]=f.x,this._hullCache[7]=f.y,this._hullCache[8]=c-f.x,this._hullCache[9]=_-f.y,this.globalTransformMatrix.transformPoint(this._dX,0,f,!0),this._hullCache[10]=f.x,this._hullCache[11]=f.y}else this._childrenTransformDirty&&(this._childrenTransformDirty=!1);this._localDirty=!0},e}(t.Bone);t.Surface=e}(k2||(k2={})),function(t){var e=function(e){function i(){var i=null!==e&&e.apply(this,arguments)||this;return i._localMatrix=new t.Matrix,i._colorTransform=new t.ColorTransform,i._displayDatas=[],i._displayList=[],i._deformVertices=null,i._rawDisplay=null,i._meshDisplay=null,i}return V2(i,e),i.prototype._onClear=function(){e.prototype._onClear.call(this);for(var i=[],n=0,r=this._displayList;n=0&&(null!==this._rawDisplayDatas&&(s=this._displayIndex=0&&this._displayIndex=0&&null!==this._rawDisplayDatas){var a=this._displayIndex0)for(var o=0,h=s;o0){this._displayList.length!==e.length&&(this._displayList.length=e.length);for(var i=0,n=e.length;i0&&(this._displayList.length=0);return this._displayIndex>=0&&this._displayIndex=0&&null!==this._cachedFrameIndices){var e=this._cachedFrameIndices[t];e>=0&&this._cachedFrameIndex===e?this._transformDirty=!1:e>=0?(this._transformDirty=!0,this._cachedFrameIndex=e):this._transformDirty||this._parent._childrenTransformDirty?(this._transformDirty=!0,this._cachedFrameIndex=-1):this._cachedFrameIndex>=0?(this._transformDirty=!1,this._cachedFrameIndices[t]=this._cachedFrameIndex):(this._transformDirty=!0,this._cachedFrameIndex=-1)}else(this._transformDirty||this._parent._childrenTransformDirty)&&(t=-1,this._transformDirty=!0,this._cachedFrameIndex=-1);if(null!==this._display){if(this._visibleDirty&&(this._visibleDirty=!1,this._updateVisible()),this._blendModeDirty&&(this._blendModeDirty=!1,this._updateBlendMode()),this._colorDirty&&(this._colorDirty=!1,this._updateColor()),null!==this._deformVertices&&null!==this._deformVertices.verticesData&&this._display===this._meshDisplay){var i=null!==this._deformVertices.verticesData.weight,n=0!==this._parent._boneData.type;if((this._deformVertices.verticesDirty||i&&this._deformVertices.isBonesUpdate()||n&&this._parent._childrenTransformDirty)&&(this._deformVertices.verticesDirty=!1,this._updateMesh()),i||n)return}if(this._transformDirty){if(this._transformDirty=!1,this._cachedFrameIndex<0){var r=t>=0;this._updateGlobalTransformMatrix(r),r&&null!==this._cachedFrameIndices&&(this._cachedFrameIndex=this._cachedFrameIndices[t]=this._armature._armatureData.setCacheFrame(this.globalTransformMatrix,this.global))}else this._isFromCache=!0,this._armature._armatureData.getCacheFrame(this.globalTransformMatrix,this.global,this._cachedFrameIndex);this._updateTransform()}}},i.prototype.updateTransformAndMatrix=function(){this._transformDirty&&(this._transformDirty=!1,this._updateGlobalTransformMatrix(!1))},i.prototype.replaceDisplayData=function(t,e){if(void 0===e&&(e=-1),e<0&&(e=this._displayIndex<0?0:this._displayIndex),this._displayDatas.length<=e){this._displayDatas.length=e+1;for(var i=0,n=this._displayDatas.length;i0&&(1===h||2===h?null!==s?(this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&(a.x=s.x,a.y=s.y)):null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a):(null!==s&&this.globalTransformMatrix.transformPoint(s.x,s.y,s),null!==a&&this.globalTransformMatrix.transformPoint(a.x,a.y,a)),null!==o&&(this.globalTransformMatrix.transformPoint(Math.cos(o.x),Math.sin(o.x),i._helpPoint,!0),o.x=Math.atan2(i._helpPoint.y,i._helpPoint.x),this.globalTransformMatrix.transformPoint(Math.cos(o.y),Math.sin(o.y),i._helpPoint,!0),o.y=Math.atan2(i._helpPoint.y,i._helpPoint.x))),h},i.prototype.invalidUpdate=function(){this._displayDirty=!0,this._transformDirty=!0},Object.defineProperty(i.prototype,"visible",{get:function(){return this._visible},set:function(t){this._visible!==t&&(this._visible=t,this._updateVisible())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayIndex",{get:function(){return this._displayIndex},set:function(t){this._setDisplayIndex(t)&&this.update(-1)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"name",{get:function(){return this._slotData.name},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"displayList",{get:function(){return this._displayList.concat()},set:function(e){var i=this._displayList.concat(),n=new Array;this._setDisplayList(e)&&this.update(-1);for(var r=0,s=i;rd)continue}for(;;W++){var L=p[W];if(!(N>L)){0===W?N/=L:N=(N-(G=p[W-1]))/(L-G);break}}if(W!==_){_=W;var V=6*W;for(E=u[V],C=u[V+1],w=u[V+2],x=u[V+3],R=u[V+4],I=u[V+5],A=2*(m=.03*(E-2*w+R))+(y=.006*(3*(w-R)-E+(B=u[V+6]))),S=2*(g=.03*(C-2*x+I))+(v=.006*(3*(x-I)-C+(D=u[V+7]))),b=.3*(w-E)+m+.16666667*y,T=.3*(x-C)+g+.16666667*v,O=Math.sqrt(b*b+T*T),M[0]=O,V=1;V<8;V++)b+=A,T+=S,A+=y,S+=v,O+=Math.sqrt(b*b+T*T),M[V]=O;b+=A,T+=S,O+=Math.sqrt(b*b+T*T),M[8]=O,b+=A+y,T+=S+v,O+=Math.sqrt(b*b+T*T),M[9]=O,F=0}for(N*=O;;F++){var k=M[F];if(!(N>k)){var G;0===F?N/=k:N=F+(N-(G=M[F-1]))/(k-G);break}}this.addCurvePosition(.1*N,E,C,w,x,R,I,B,D,a,H,i)}}else{var U=t.curveLengths;if(d=U[c-=h?1:2],n&&(f*=d),r)for(var z=0;zd)continue}for(var X=0;;W++){var j=U[W];if(!(f>j)){if(0===W)X=f/j;else{var Y=U[W-1];X=(f-Y)/(j-Y)}break}}W!==_&&(_=W,h&&W===c?(this._computeVertices(l-4,4,0,u),this._computeVertices(0,4,4,u)):this._computeVertices(6*W+2,8,0,u)),this.addCurvePosition(X,u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],a,H,i)}}},i.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,h,u,l,c){if(0===t)return u[l]=e,u[l+1]=i,void(u[l+2]=0);if(1===t)return u[l]=o,u[l+1]=h,void(u[l+2]=0);var _=1-t,f=_*_,d=t*t,p=f*_,m=f*t*3,g=_*d*3,y=t*d,v=p*e+m*n+g*s+y*o,A=p*i+m*r+g*a+y*h;u[l]=v,u[l+1]=A,u[l+2]=c?Math.atan2(A-(p*i+m*r+g*a),v-(p*e+m*n+g*s)):0},i.prototype.init=function(t,e){this._constraintData=t,this._armature=e;var i=t;this.pathOffset=i.pathDisplayData.vertices.offset,this.position=i.position,this.spacing=i.spacing,this.rotateOffset=i.rotateOffset,this.rotateMix=i.rotateMix,this.translateMix=i.translateMix,this._root=this._armature.getBone(i.root.name),this._target=this._armature.getBone(i.target.name),this._pathSlot=this._armature.getSlot(i.pathSlot.name);for(var n=0,r=i.bones.length;n0?t.Transform.DEG_RAD:-t.Transform.DEG_RAD));for(var R=this.rotateMix,I=this.translateMix,B=(g=0,3);g0){var L=P.a,V=P.b,k=P.c,G=P.d,U=void 0,z=void 0,H=void 0;if(U=_?E[B-1]:Math.atan2(O,M),U-=Math.atan2(V,L),T){z=Math.cos(U),H=Math.sin(U);var W=D._boneData.length;w+=(W*(z*L-H*V)-M)*R,x+=(W*(H*L+z*V)-O)*R}else U+=C;U>t.Transform.PI?U-=t.Transform.PI_D:U<-t.Transform.PI&&(U+=t.Transform.PI_D),U*=R,z=Math.cos(U),H=Math.sin(U),P.a=z*L-H*V,P.b=H*L+z*V,P.c=z*k-H*G,P.d=H*k+z*G}D.global.fromMatrix(P)}this.dirty=!1}}},i.prototype.invalidUpdate=function(){},i}(e);t.PathConstraint=n}(k2||(k2={})),function(t){var e=function(){function t(t){void 0===t&&(t=0),this.time=0,this.timeScale=1,this._systemTime=0,this._animatebles=[],this._clock=null,this.time=t,this._systemTime=.001*(new Date).getTime()}return t.prototype.advanceTime=function(t){t!=t&&(t=0);var e=.001*Date.now();if(t<0&&(t=e-this._systemTime),this._systemTime=e,1!==this.timeScale&&(t*=this.timeScale),0!==t){t<0?this.time-=t:this.time+=t;for(var i=0,n=0,r=this._animatebles.length;i0&&(this._animatebles[i-n]=s,this._animatebles[i]=null),s.advanceTime(t)):n++}if(n>0){for(r=this._animatebles.length;i=0&&(this._animatebles[e]=null,t.clock=null)},t.prototype.clear=function(){for(var t=0,e=this._animatebles;t0&&d._subFadeState>0)this._armature._dragonBones.bufferObject(d),this._animationStates.length=0,this._lastAnimationState=null;else{var i=d._animationData,n=i.cacheFrameRate;if(this._animationDirty&&n>0){this._animationDirty=!1;for(var r=0,s=this._armature.getBones();r0){var c=l[0];if(null!==c&&c.parent===this._armature.armatureData.defaultSkin){u._cachedFrameIndices=i.getSlotCachedFrameIndices(u.name);continue}}u._cachedFrameIndices=null}}d.advanceTime(t,n)}else if(e>1){for(var _=0,f=0;_0&&d._subFadeState>0?(f++,this._armature._dragonBones.bufferObject(d),this._animationDirty=!0,this._lastAnimationState===d&&(this._lastAnimationState=null)):(f>0&&(this._animationStates[_-f]=d),d.advanceTime(t,0)),_===e-1&&f>0&&(this._animationStates.length-=f,null===this._lastAnimationState&&this._animationStates.length>0&&(this._lastAnimationState=this._animationStates[this._animationStates.length-1]))}this._armature._cacheFrameIndex=-1}else this._armature._cacheFrameIndex=-1},i.prototype.reset=function(){for(var t=0,e=this._animationStates;t1?(e.position<0?(e.position%=n.duration,e.position=n.duration-e.position):e.position===n.duration?e.position-=1e-6:e.position>n.duration&&(e.position%=n.duration),e.duration>0&&e.position+e.duration>n.duration&&(e.duration=n.duration-e.position),e.playTimes<0&&(e.playTimes=n.playTimes)):(e.playTimes=1,e.position=0,e.duration>0&&(e.duration=0)),0===e.duration&&(e.duration=-1),this._fadeOut(e);var o=t.BaseObject.borrowObject(t.AnimationState);if(o.init(this._armature,n,e),this._animationDirty=!0,this._armature._cacheFrameIndex=-1,this._animationStates.length>0){for(var h=!1,u=0,l=this._animationStates.length;uthis._animationStates[u].layer){h=!0,this._animationStates.splice(u,0,o);break}if(u!==l-1&&o.layer>this._animationStates[u+1].layer){h=!0,this._animationStates.splice(u+1,0,o);break}}h||this._animationStates.push(o)}else this._animationStates.push(o);for(var c=0,_=this._armature.getSlots();c<_.length;c++){var f=_[c].childArmature;null!==f&&f.inheritAnimation&&f.animation.hasAnimation(i)&&null===f.animation.getState(i)&&f.animation.fadeIn(i)}var d=!1;for(var p in n.animationTimelines){this._lockUpdate||(d=!0,this._lockUpdate=!0);var m=this.fadeIn(p,e.fadeInTime,1,o.layer,null,0);null!==m&&(m.resetToPose=!1,m._parent=o,m.stop())}return d&&(this._lockUpdate=!1),this._lockUpdate||(e.fadeInTime<=0&&this._armature.advanceTime(0),this._lastAnimationState=o),o},i.prototype.play=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=null!==t?t:"",null!==t&&t.length>0)this.playConfig(this._animationConfig);else if(null===this._lastAnimationState){var i=this._armature.armatureData.defaultAnimation;null!==i&&(this._animationConfig.animation=i.name,this.playConfig(this._animationConfig))}else this._lastAnimationState.isPlaying||this._lastAnimationState.isCompleted?(this._animationConfig.animation=this._lastAnimationState.name,this.playConfig(this._animationConfig)):this._lastAnimationState.play();return this._lastAnimationState},i.prototype.fadeIn=function(t,e,i,n,r,s){return void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=0),void 0===r&&(r=null),void 0===s&&(s=3),this._animationConfig.clear(),this._animationConfig.fadeOutMode=s,this._animationConfig.playTimes=i,this._animationConfig.layer=n,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==r?r:"",this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByTime=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.position=e,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t,this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByFrame=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*e/n.frameCount),this.playConfig(this._animationConfig)},i.prototype.gotoAndPlayByProgress=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.playTimes=i,this._animationConfig.fadeInTime=0,this._animationConfig.animation=t;var n=t in this._animations?this._animations[t]:null;return null!==n&&(this._animationConfig.position=n.duration*(e>0?e:0)),this.playConfig(this._animationConfig)},i.prototype.gotoAndStopByTime=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByTime(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByFrame=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByFrame(t,e,1);return null!==i&&i.stop(),i},i.prototype.gotoAndStopByProgress=function(t,e){void 0===e&&(e=0);var i=this.gotoAndPlayByProgress(t,e,1);return null!==i&&i.stop(),i},i.prototype.getState=function(t){for(var e=this._animationStates.length;e--;){var i=this._animationStates[e];if(i.name===t)return i}return null},i.prototype.hasAnimation=function(t){return t in this._animations},i.prototype.getStates=function(){return this._animationStates},Object.defineProperty(i.prototype,"isPlaying",{get:function(){for(var t=0,e=this._animationStates;t0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationName",{get:function(){return null!==this._lastAnimationState?this._lastAnimationState.name:""},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animations",{get:function(){return this._animations},set:function(t){if(this._animations!==t){for(var e in this._animationNames.length=0,this._animations)delete this._animations[e];for(var e in t)this._animationNames.push(e),this._animations[e]=t[e]}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationConfig",{get:function(){return this._animationConfig.clear(),this._animationConfig},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastAnimationState",{get:function(){return this._lastAnimationState},enumerable:!0,configurable:!0}),i.prototype.gotoAndPlay=function(t,e,i,n,r,s,a){void 0===e&&(e=-1),void 0===i&&(i=-1),void 0===n&&(n=-1),void 0===r&&(r=0),void 0===s&&(s=null),void 0===a&&(a=3),console.warn("Deprecated."),this._animationConfig.clear(),this._animationConfig.resetToPose=!0,this._animationConfig.fadeOutMode=a,this._animationConfig.playTimes=n,this._animationConfig.layer=r,this._animationConfig.fadeInTime=e,this._animationConfig.animation=t,this._animationConfig.group=null!==s?s:"";var o=this._animations[t];return o&&i>0&&(this._animationConfig.timeScale=o.duration/i),this.playConfig(this._animationConfig)},i.prototype.gotoAndStop=function(t,e){return void 0===e&&(e=0),console.warn("Deprecated."),this.gotoAndStopByTime(t,e)},Object.defineProperty(i.prototype,"animationList",{get:function(){return console.warn("Deprecated."),this._animationNames},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"animationDataList",{get:function(){console.warn("Deprecated.");for(var t=[],e=0,i=this._animationNames.length;e0;if(this._subFadeState<0){this._subFadeState=0;var r=n?t.EventObject.FADE_OUT:t.EventObject.FADE_IN;this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i))}(e<0&&(e=-e),this._fadeTime+=e,this._fadeTime>=this.fadeTotalTime?(this._subFadeState=1,this._fadeProgress=n?0:1):this._fadeTime>0?this._fadeProgress=n?1-this._fadeTime/this.fadeTotalTime:this._fadeTime/this.fadeTotalTime:this._fadeProgress=n?1:0,this._subFadeState>0)&&(n||(this._playheadState|=1,this._fadeState=0),r=n?t.EventObject.FADE_OUT_COMPLETE:t.EventObject.FADE_IN_COMPLETE,this._armature.eventDispatcher.hasDBEventListener(r)&&((i=t.BaseObject.borrowObject(t.EventObject)).type=r,i.armature=this._armature,i.animationState=this,this._armature._dragonBones.bufferEvent(i)))},r.prototype.init=function(e,i,n){if(null===this._armature){if(this._armature=e,this._animationData=i,this.resetToPose=n.resetToPose,this.additiveBlending=n.additiveBlending,this.displayControl=n.displayControl,this.actionEnabled=n.actionEnabled,this.layer=n.layer,this.playTimes=n.playTimes,this.timeScale=n.timeScale,this.fadeTotalTime=n.fadeInTime,this.autoFadeOutTime=n.autoFadeOutTime,this.weight=n.weight,this.name=n.name.length>0?n.name:n.animation,this.group=n.group,n.pauseFadeIn?this._playheadState=2:this._playheadState=3,n.duration<0?(this._position=0,this._duration=this._animationData.duration,0!==n.position?this.timeScale>=0?this._time=n.position:this._time=n.position-this._duration:this._time=0):(this._position=n.position,this._duration=n.duration,this._time=0),this.timeScale<0&&0===this._time&&(this._time=-1e-6),this.fadeTotalTime<=0&&(this._fadeProgress=.999999),n.boneMask.length>0){this._boneMask.length=n.boneMask.length;for(var r=0,s=this._boneMask.length;r0,r=!0,s=!0,a=this._time;if(this._weightResult=this.weight*this._fadeProgress,null!==this._parent&&(this._weightResult*=this._parent._weightResult/this._parent._fadeProgress),this._actionTimeline.playState<=0&&this._actionTimeline.update(a),n){var o=2*i;this._actionTimeline.currentTime=Math.floor(this._actionTimeline.currentTime*o)/o}if(null!==this._zOrderTimeline&&this._zOrderTimeline.playState<=0&&this._zOrderTimeline.update(a),n){var h=Math.floor(this._actionTimeline.currentTime*i);this._armature._cacheFrameIndex===h?(r=!1,s=!1):(this._armature._cacheFrameIndex=h,this._animationData.cachedFrames[h]?s=!1:this._animationData.cachedFrames[h]=!0)}if(r){if(s)for(var u=0,l=this._boneTimelines.length;u0&&(this._subFadeState=0,this._poseTimelines.length>0)){for(var f=0,d=this._poseTimelines;f0&&this.autoFadeOutTime>=0&&this.fadeOut(this.autoFadeOutTime)}}},r.prototype.play=function(){this._playheadState=3},r.prototype.stop=function(){this._playheadState&=1},r.prototype.fadeOut=function(t,e){if(void 0===e&&(e=!0),t<0&&(t=0),e&&(this._playheadState&=2),this._fadeState>0){if(t>this.fadeTotalTime-this._fadeTime)return}else{this._fadeState=1,this._subFadeState=-1,(t<=0||this._fadeProgress<=0)&&(this._fadeProgress=1e-6);for(var i=0,n=this._boneTimelines;i1e-6?t/this._fadeProgress:0,this._fadeTime=this.fadeTotalTime*(1-this._fadeProgress)},r.prototype.containsBoneMask=function(t){return 0===this._boneMask.length||this._boneMask.indexOf(t)>=0},r.prototype.addBoneMask=function(t,e){void 0===e&&(e=!0);var i=this._armature.getBone(t);if(null!==i){if(this._boneMask.indexOf(t)<0&&this._boneMask.push(t),e)for(var n=0,r=this._armature.getBones();n=0&&this._boneMask.splice(i,1),e){var n=this._armature.getBone(t);if(null!==n){var r=this._armature.getBones();if(this._boneMask.length>0)for(var s=0,a=r;s=0&&n.contains(o)&&this._boneMask.splice(h,1)}else for(var u=0,l=r;u0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFadeComplete",{get:function(){return 0===this._fadeState},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return 0!=(2&this._playheadState)&&this._actionTimeline.playState<=0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isCompleted",{get:function(){return this._actionTimeline.playState>0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentPlayTimes",{get:function(){return this._actionTimeline.currentPlayTimes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"totalTime",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"currentTime",{get:function(){return this._actionTimeline.currentTime},set:function(t){var e=this._actionTimeline.currentPlayTimes-(this._actionTimeline.playState>0?1:0);if((t<0||this._duration0&&e===this.playTimes-1&&t===this._duration&&(t=this._duration-1e-6),this._time!==t){this._time=t,this._actionTimeline.setCurrentTime(this._time),null!==this._zOrderTimeline&&(this._zOrderTimeline.playState=-1);for(var i=0,n=this._boneTimelines;i0))return 0;if(this.layer!==e){if(this.layerWeight>=this.leftWeight)return this.leftWeight=0,0;this.layer=e,this.leftWeight-=this.layerWeight,this.layerWeight=0}return t*=this.leftWeight,this.layerWeight+=t,this.blendWeight=t,2}return this.dirty=!0,this.layer=e,this.layerWeight=t,this.leftWeight=1,this.blendWeight=t,1},t.prototype.clear=function(){this.dirty=!1,this.layer=0,this.leftWeight=0,this.layerWeight=0,this.blendWeight=0},t}();t.BlendState=n}(k2||(k2={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.prototype._onClear=function(){this.playState=-1,this.currentPlayTimes=-1,this.currentTime=-1,this._tweenState=0,this._frameRate=0,this._frameValueOffset=0,this._frameCount=0,this._frameOffset=0,this._frameIndex=-1,this._frameRateR=0,this._position=0,this._duration=0,this._timeScale=1,this._timeOffset=0,this._dragonBonesData=null,this._animationData=null,this._timelineData=null,this._armature=null,this._animationState=null,this._actionTimeline=null,this._frameArray=null,this._frameIntArray=null,this._frameFloatArray=null,this._timelineArray=null,this._frameIndices=null},e.prototype._setCurrentTime=function(t){var e=this.playState,i=this.currentPlayTimes,n=this.currentTime;if(null!==this._actionTimeline&&this._frameCount<=1)this.playState=this._actionTimeline.playState>=0?1:-1,this.currentPlayTimes=1,this.currentTime=this._actionTimeline.currentTime;else if(null===this._actionTimeline||1!==this._timeScale||0!==this._timeOffset){var r=this._animationState.playTimes,s=r*this._duration;t*=this._timeScale,0!==this._timeOffset&&(t+=this._timeOffset*this._animationData.duration),r>0&&(t>=s||t<=-s)?(this.playState<=0&&3===this._animationState._playheadState&&(this.playState=1),this.currentPlayTimes=r,this.currentTime=t<0?0:this._duration+1e-6):(0!==this.playState&&3===this._animationState._playheadState&&(this.playState=0),t<0?(t=-t,this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=this._duration-t%this._duration):(this.currentPlayTimes=Math.floor(t/this._duration),this.currentTime=t%this._duration)),this.currentTime+=this._position}else this.playState=this._actionTimeline.playState,this.currentPlayTimes=this._actionTimeline.currentPlayTimes,this.currentTime=this._actionTimeline.currentTime;return(this.currentPlayTimes!==i||this.currentTime!==n)&&((e<0&&this.playState!==e||this.playState<=0&&this.currentPlayTimes!==i)&&(this._frameIndex=-1),!0)},e.prototype.init=function(t,e,i){this._armature=t,this._animationState=e,this._timelineData=i,this._actionTimeline=this._animationState._actionTimeline,this===this._actionTimeline&&(this._actionTimeline=null),this._animationData=this._animationState._animationData,this._frameRate=this._animationData.parent.frameRate,this._frameRateR=1/this._frameRate,this._position=this._animationState._position,this._duration=this._animationState._duration,this._dragonBonesData=this._animationData.parent.parent,null!==this._timelineData&&(this._frameIntArray=this._dragonBonesData.frameIntArray,this._frameFloatArray=this._dragonBonesData.frameFloatArray,this._frameArray=this._dragonBonesData.frameArray,this._timelineArray=this._dragonBonesData.timelineArray,this._frameIndices=this._dragonBonesData.frameIndices,this._frameCount=this._timelineArray[this._timelineData.offset+2],this._frameValueOffset=this._timelineArray[this._timelineData.offset+4],this._timeScale=100/this._timelineArray[this._timelineData.offset+0],this._timeOffset=.01*this._timelineArray[this._timelineData.offset+1])},e.prototype.fadeOut=function(){},e.prototype.update=function(t){if(this._setCurrentTime(t)){if(this._frameCount>1){var e=Math.floor(this.currentTime*this._frameRate),i=this._frameIndices[this._timelineData.frameIndicesOffset+e];this._frameIndex!==i&&(this._frameIndex=i,this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+this._frameIndex],this._onArriveAtFrame())}else this._frameIndex<0&&(this._frameIndex=0,null!==this._timelineData&&(this._frameOffset=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5]),this._onArriveAtFrame());0!==this._tweenState&&this._onUpdateFrame()}},e}(t.BaseObject);t.TimelineState=e;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e._getEasingValue=function(t,e,i){var n=e;switch(t){case 3:n=Math.pow(e,2);break;case 4:n=1-Math.pow(1-e,2);break;case 5:n=.5*(1-Math.cos(e*Math.PI))}return(n-e)*i+e},e._getEasingCurveValue=function(t,e,i,n){if(t<=0)return 0;if(t>=1)return 1;var r=i+1,s=Math.floor(t*r),a=0===s?0:e[n+s-1];return 1e-4*(a+((s===r-1?1e4:e[n+s])-a)*(t*r-s))},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._tweenType=0,this._curveCount=0,this._framePosition=0,this._frameDurationR=0,this._tweenProgress=0,this._tweenEasing=0},e.prototype._onArriveAtFrame=function(){if(this._frameCount>1&&(this._frameIndex!==this._frameCount-1||0===this._animationState.playTimes||this._animationState.currentPlayTimes0?1/e:0}else this._tweenState=1},e.prototype._onUpdateFrame=function(){2===this._tweenState?(this._tweenProgress=(this.currentTime-this._framePosition)*this._frameDurationR,2===this._tweenType?this._tweenProgress=e._getEasingCurveValue(this._tweenProgress,this._frameArray,this._curveCount,this._frameOffset+3):1!==this._tweenType&&(this._tweenProgress=e._getEasingValue(this._tweenType,this._tweenProgress,this._tweenEasing))):this._tweenProgress=0},e}(e);t.TweenTimelineState=i;var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.bone=null,this.bonePose=null},e.prototype.blend=function(t){var e=this.bone._blendState.blendWeight,i=this.bone.animationPose,n=this.bonePose.result;2===t?(i.x+=n.x*e,i.y+=n.y*e,i.rotation+=n.rotation*e,i.skew+=n.skew*e,i.scaleX+=(n.scaleX-1)*e,i.scaleY+=(n.scaleY-1)*e):1!==e?(i.x=n.x*e,i.y=n.y*e,i.rotation=n.rotation*e,i.skew=n.skew*e,i.scaleX=(n.scaleX-1)*e+1,i.scaleY=(n.scaleY-1)*e+1):(i.x=n.x,i.y=n.y,i.rotation=n.rotation,i.skew=n.skew,i.scaleX=n.scaleX,i.scaleY=n.scaleY),0===this._animationState._fadeState&&0===this._animationState._subFadeState||(this.bone._transformDirty=!0)},e}(i);t.BoneTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.slot=null},e}(i);t.SlotTimelineState=r;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.prototype._onClear=function(){t.prototype._onClear.call(this),this.constraint=null},e}(i);t.ConstraintTimelineState=s}(k2||(k2={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return V2(i,e),i.toString=function(){return"[class dragonBones.ActionTimelineState]"},i.prototype._onCrossFrame=function(e){var i=this._armature.eventDispatcher;if(this._animationState.actionEnabled)for(var n=this._animationData.frameOffset+this._timelineArray[this._timelineData.offset+5+e],r=this._frameArray[n+1],s=this._animationData.parent.actions,a=0;a0&&s.hasDBEventListener(t.EventObject.COMPLETE)&&((u=t.BaseObject.borrowObject(t.EventObject)).type=t.EventObject.COMPLETE,u.armature=this._armature,u.animationState=this._animationState)),this._frameCount>1){var l=this._timelineData,c=Math.floor(this.currentTime*this._frameRate),_=this._frameIndices[l.frameIndicesOffset+c];if(this._frameIndex!==_){var f=this._frameIndex;if(this._frameIndex=_,null!==this._timelineArray)if(this._frameOffset=this._animationData.frameOffset+this._timelineArray[l.offset+5+this._frameIndex],o){if(f<0){var d=Math.floor(r*this._frameRate);f=this._frameIndices[l.frameIndicesOffset+d],this.currentPlayTimes===n&&f===_&&(f=-1)}for(;f>=0;){var p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate;if(this._position<=m&&m<=this._position+this._duration&&this._onCrossFrame(f),null!==h&&0===f&&(this._armature._dragonBones.bufferEvent(h),h=null),f>0?f--:f=this._frameCount-1,f===_)break}}else for(f<0&&(d=Math.floor(r*this._frameRate),f=this._frameIndices[l.frameIndicesOffset+d],p=this._animationData.frameOffset+this._timelineArray[l.offset+5+f],m=this._frameArray[p]/this._frameRate,this.currentPlayTimes===n&&(r<=m?f>0?f--:f=this._frameCount-1:f===_&&(f=-1)));f>=0&&(f=0&&(this._frameArray[this._frameOffset+1]>0?this._armature._sortZOrder(this._frameArray,this._frameOffset+2):this._armature._sortZOrder(null,0))},e.prototype._onUpdateFrame=function(){},e}(t.TimelineState);t.ZOrderTimelineState=i;var n=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return V2(i,e),i.toString=function(){return"[class dragonBones.BoneAllTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var t=this._animationData.frameFloatOffset+this._frameValueOffset+6*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[t++]*i,r.y=n[t++]*i,r.rotation=n[t++],r.skew=n[t++],r.scaleX=n[t++],r.scaleY=n[t++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(t=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[t++]*i-r.x,s.y=n[t++]*i-r.y,s.rotation=n[t++]-r.rotation,s.skew=n[t++]-r.skew,s.scaleX=n[t++]-r.scaleX,s.scaleY=n[t++]-r.scaleY):(s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,r.rotation=0,r.skew=0,r.scaleX=1,r.scaleY=1,s.x=0,s.y=0,s.rotation=0,s.skew=0,s.scaleX=0,s.scaleY=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=t.x+i.x*this._tweenProgress,n.y=t.y+i.y*this._tweenProgress,n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress,n.scaleX=t.scaleX+i.scaleX*this._tweenProgress,n.scaleY=t.scaleY+i.scaleY*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneAllTimelineState=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.toString=function(){return"[class dragonBones.BoneTranslateTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._armature._armatureData.scale,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.x=n[e++]*i,r.y=n[e++]*i,2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),s.x=n[e++]*i-r.x,s.y=n[e++]*i-r.y):(s.x=0,s.y=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.x=0,r.y=0,s.x=0,s.y=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.x=e.x+i.x*this._tweenProgress,n.y=e.y+i.y*this._tweenProgress},e}(t.BoneTimelineState);t.BoneTranslateTimelineState=r;var s=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return V2(i,e),i.toString=function(){return"[class dragonBones.BoneRotateTimelineState]"},i.prototype._onArriveAtFrame=function(){if(e.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var i=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,n=this._frameFloatArray,r=this.bonePose.current,s=this.bonePose.delta;r.rotation=n[i++],r.skew=n[i++],2===this._tweenState?(this._frameIndex===this._frameCount-1?(i=this._animationData.frameFloatOffset+this._frameValueOffset,s.rotation=t.Transform.normalizeRadian(n[i++]-r.rotation)):s.rotation=n[i++]-r.rotation,s.skew=n[i++]-r.skew):(s.rotation=0,s.skew=0)}else r=this.bonePose.current,s=this.bonePose.delta,r.rotation=0,r.skew=0,s.rotation=0,s.skew=0},i.prototype._onUpdateFrame=function(){e.prototype._onUpdateFrame.call(this);var t=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.rotation=t.rotation+i.rotation*this._tweenProgress,n.skew=t.skew+i.skew*this._tweenProgress},i.prototype.fadeOut=function(){var e=this.bonePose.result;e.rotation=t.Transform.normalizeRadian(e.rotation),e.skew=t.Transform.normalizeRadian(e.skew)},i}(t.BoneTimelineState);t.BoneRotateTimelineState=s;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.toString=function(){return"[class dragonBones.BoneScaleTimelineState]"},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+2*this._frameIndex,i=this._frameFloatArray,n=this.bonePose.current,r=this.bonePose.delta;n.scaleX=i[e++],n.scaleY=i[e++],2===this._tweenState?(this._frameIndex===this._frameCount-1&&(e=this._animationData.frameFloatOffset+this._frameValueOffset),r.scaleX=i[e++]-n.scaleX,r.scaleY=i[e++]-n.scaleY):(r.scaleX=0,r.scaleY=0)}else n=this.bonePose.current,r=this.bonePose.delta,n.scaleX=1,n.scaleY=1,r.scaleX=0,r.scaleY=0},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this);var e=this.bonePose.current,i=this.bonePose.delta,n=this.bonePose.result;this.bone._transformDirty=!0,2!==this._tweenState&&(this._tweenState=0),n.scaleX=e.scaleX+i.scaleX*this._tweenProgress,n.scaleY=e.scaleY+i.scaleY*this._tweenProgress},e}(t.BoneTimelineState);t.BoneScaleTimelineState=a;var o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return V2(e,t),e.toString=function(){return"[class dragonBones.SurfaceTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.surface=null,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0){var t=null!==this._timelineData?this._frameArray[this._frameOffset+1]:this.slot._slotData.displayIndex;this.slot.displayIndex!==t&&this.slot._setDisplayIndex(t,!0)}},e}(t.SlotTimelineState);t.SlotDislayTimelineState=h;var u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[0,0,0,0,0,0,0,0],e._delta=[0,0,0,0,0,0,0,0],e._result=[0,0,0,0,0,0,0,0],e}return V2(e,t),e.toString=function(){return"[class dragonBones.SlotColorTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this._dirty=!1},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._dragonBonesData.intArray,i=this._frameIntArray,n=this._animationData.frameIntOffset+this._frameValueOffset+1*this._frameIndex,r=i[n];r<0&&(r+=65536),this._current[0]=e[r++],this._current[1]=e[r++],this._current[2]=e[r++],this._current[3]=e[r++],this._current[4]=e[r++],this._current[5]=e[r++],this._current[6]=e[r++],this._current[7]=e[r++],2===this._tweenState&&((r=this._frameIndex===this._frameCount-1?i[this._animationData.frameIntOffset+this._frameValueOffset]:i[n+1])<0&&(r+=65536),this._delta[0]=e[r++]-this._current[0],this._delta[1]=e[r++]-this._current[1],this._delta[2]=e[r++]-this._current[2],this._delta[3]=e[r++]-this._current[3],this._delta[4]=e[r++]-this._current[4],this._delta[5]=e[r++]-this._current[5],this._delta[6]=e[r++]-this._current[6],this._delta[7]=e[r++]-this._current[7])}else{var s=this.slot._slotData.color;this._current[0]=100*s.alphaMultiplier,this._current[1]=100*s.redMultiplier,this._current[2]=100*s.greenMultiplier,this._current[3]=100*s.blueMultiplier,this._current[4]=s.alphaOffset,this._current[5]=s.redOffset,this._current[6]=s.greenOffset,this._current[7]=s.blueOffset}},e.prototype._onUpdateFrame=function(){t.prototype._onUpdateFrame.call(this),this._dirty=!0,2!==this._tweenState&&(this._tweenState=0),this._result[0]=.01*(this._current[0]+this._delta[0]*this._tweenProgress),this._result[1]=.01*(this._current[1]+this._delta[1]*this._tweenProgress),this._result[2]=.01*(this._current[2]+this._delta[2]*this._tweenProgress),this._result[3]=.01*(this._current[3]+this._delta[3]*this._tweenProgress),this._result[4]=this._current[4]+this._delta[4]*this._tweenProgress,this._result[5]=this._current[5]+this._delta[5]*this._tweenProgress,this._result[6]=this._current[6]+this._delta[6]*this._tweenProgress,this._result[7]=this._current[7]+this._delta[7]*this._tweenProgress},e.prototype.fadeOut=function(){this._tweenState=0,this._dirty=!1},e.prototype.update=function(e){if(t.prototype.update.call(this,e),0!==this._tweenState||this._dirty){var i=this.slot._colorTransform;if(0!==this._animationState._fadeState||0!==this._animationState._subFadeState){if(i.alphaMultiplier!==this._result[0]||i.redMultiplier!==this._result[1]||i.greenMultiplier!==this._result[2]||i.blueMultiplier!==this._result[3]||i.alphaOffset!==this._result[4]||i.redOffset!==this._result[5]||i.greenOffset!==this._result[6]||i.blueOffset!==this._result[7]){var n=Math.pow(this._animationState._fadeProgress,4);i.alphaMultiplier+=(this._result[0]-i.alphaMultiplier)*n,i.redMultiplier+=(this._result[1]-i.redMultiplier)*n,i.greenMultiplier+=(this._result[2]-i.greenMultiplier)*n,i.blueMultiplier+=(this._result[3]-i.blueMultiplier)*n,i.alphaOffset+=(this._result[4]-i.alphaOffset)*n,i.redOffset+=(this._result[5]-i.redOffset)*n,i.greenOffset+=(this._result[6]-i.greenOffset)*n,i.blueOffset+=(this._result[7]-i.blueOffset)*n,this.slot._colorDirty=!0}}else this._dirty&&(this._dirty=!1,i.alphaMultiplier===this._result[0]&&i.redMultiplier===this._result[1]&&i.greenMultiplier===this._result[2]&&i.blueMultiplier===this._result[3]&&i.alphaOffset===this._result[4]&&i.redOffset===this._result[5]&&i.greenOffset===this._result[6]&&i.blueOffset===this._result[7]||(i.alphaMultiplier=this._result[0],i.redMultiplier=this._result[1],i.greenMultiplier=this._result[2],i.blueMultiplier=this._result[3],i.alphaOffset=this._result[4],i.redOffset=this._result[5],i.greenOffset=this._result[6],i.blueOffset=this._result[7],this.slot._colorDirty=!0))}},e}(t.SlotTimelineState);t.SlotColorTimelineState=u;var l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._current=[],e._delta=[],e._result=[],e}return V2(e,t),e.toString=function(){return"[class dragonBones.DeformTimelineState]"},e.prototype._onClear=function(){t.prototype._onClear.call(this),this.vertexOffset=0,this._dirty=!1,this._frameFloatOffset=0,this._valueCount=0,this._deformCount=0,this._valueOffset=0,this._current.length=0,this._delta.length=0,this._result.length=0},e.prototype._onArriveAtFrame=function(){if(t.prototype._onArriveAtFrame.call(this),null!==this._timelineData){var e=this._animationData.frameFloatOffset+this._frameValueOffset+this._frameIndex*this._valueCount,i=this._armature._armatureData.scale,n=this._frameFloatArray;if(2===this._tweenState){var r=e+this._valueCount;this._frameIndex===this._frameCount-1&&(r=this._animationData.frameFloatOffset+this._frameValueOffset);for(var s=0;s=0&&(this._floats[2]=this._floats[0]+this._floats[1]*this._tweenProgress),this._floats[5]=this._floats[3]+this._floats[4]*this._tweenProgress},e.prototype.blend=function(t){var e=this.animationState,i=e._blendState.blendWeight;2===t?(e.weight+=this._floats[5]*i,e.currentTime+=this._floats[2]*i):(e.weight=this._floats[5]*i,e.currentTime=this._floats[2]*i)},e}(t.TweenTimelineState);t.AnimationTimelineState=_}(k2||(k2={})),function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return V2(e,t),e.actionDataToInstance=function(t,i,n){0===t.type?i.type=e.FRAME_EVENT:i.type=10===t.type?e.FRAME_EVENT:e.SOUND_EVENT,i.name=t.name,i.armature=n,i.actionData=t,i.data=t.data,null!==t.bone&&(i.bone=n.getBone(t.bone.name)),null!==t.slot&&(i.slot=n.getSlot(t.slot.name))},e.toString=function(){return"[class dragonBones.EventObject]"},e.prototype._onClear=function(){this.time=0,this.type="",this.name="",this.armature=null,this.bone=null,this.slot=null,this.animationState=null,this.actionData=null,this.data=null},e.START="start",e.LOOP_COMPLETE="loopComplete",e.COMPLETE="complete",e.FADE_IN="fadeIn",e.FADE_IN_COMPLETE="fadeInComplete",e.FADE_OUT="fadeOut",e.FADE_OUT_COMPLETE="fadeOutComplete",e.FRAME_EVENT="frameEvent",e.SOUND_EVENT="soundEvent",e}(t.BaseObject);t.EventObject=e}(k2||(k2={})),function(t){var e=function(){function e(){}return e._getArmatureType=function(t){switch(t.toLowerCase()){case"stage":return 2;case"armature":return 0;case"movieclip":return 1;default:return 0}},e._getBoneType=function(t){switch(t.toLowerCase()){case"bone":return 0;case"surface":return 1;default:return 0}},e._getDisplayType=function(t){switch(t.toLowerCase()){case"image":return 0;case"mesh":return 2;case"armature":return 1;case"boundingbox":return 3;case"path":return 4;default:return 0}},e._getBoundingBoxType=function(t){switch(t.toLowerCase()){case"rectangle":return 0;case"ellipse":return 1;case"polygon":return 2;default:return 0}},e._getActionType=function(t){switch(t.toLowerCase()){case"play":return 0;case"frame":return 10;case"sound":return 11;default:return 0}},e._getBlendMode=function(t){switch(t.toLowerCase()){case"normal":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"overlay":return 11;case"screen":return 12;case"subtract":return 13;default:return 0}},e._getPositionMode=function(t){switch(t.toLocaleLowerCase()){case"percent":return 1;case"fixed":return 0;default:return 1}},e._getSpacingMode=function(t){switch(t.toLocaleLowerCase()){case"length":return 0;case"percent":return 2;case"fixed":return 1;default:return 0}},e._getRotateMode=function(t){switch(t.toLocaleLowerCase()){case"tangent":return 0;case"chain":return 1;case"chainscale":return 2;default:return 0}},e.parseDragonBonesData=function(e){return console.warn("Deprecated."),e instanceof ArrayBuffer?t.BinaryDataParser.getInstance().parseDragonBonesData(e):t.ObjectDataParser.getInstance().parseDragonBonesData(e)},e.parseTextureAtlasData=function(i,n){void 0===n&&(n=1),console.warn("已废弃");for(var r={},s=i[e.SUB_TEXTURE],a=0,o=s.length;a255)return encodeURI(r);return r}return String(r)}return n},n.prototype._getCurvePoint=function(t,e,i,n,r,s,a,o,h,u){var l=1-h,c=l*l,_=h*h,f=l*c,d=3*h*c,p=3*l*_,m=h*_;u.x=f*t+d*i+p*r+m*a,u.y=f*e+d*n+p*s+m*o},n.prototype._samplingEasingCurve=function(t,e){for(var i=t.length,n=-2,r=0,s=e.length;r=0&&n+61e-4;){var y=.5*(g+m);this._getCurvePoint(h,u,l,c,_,f,d,p,y,this._helpPoint),a-this._helpPoint.x>0?m=y:g=y}e[r]=this._helpPoint.y}},n.prototype._parseActionDataInFrame=function(e,i,n,r){t.DataParser.EVENT in e&&this._mergeActionFrame(e[t.DataParser.EVENT],i,10,n,r),t.DataParser.SOUND in e&&this._mergeActionFrame(e[t.DataParser.SOUND],i,11,n,r),t.DataParser.ACTION in e&&this._mergeActionFrame(e[t.DataParser.ACTION],i,0,n,r),t.DataParser.EVENTS in e&&this._mergeActionFrame(e[t.DataParser.EVENTS],i,10,n,r),t.DataParser.ACTIONS in e&&this._mergeActionFrame(e[t.DataParser.ACTIONS],i,0,n,r)},n.prototype._mergeActionFrame=function(e,n,r,s,a){for(var o=t.DragonBones.webAssembly?this._armature.actions.size():this._armature.actions.length,h=this._parseActionData(e,r,s,a),u=0,l=null,c=0,_=h;c<_.length;c++){var f=_[c];this._armature.addAction(f,!1)}0===this._actionFrames.length&&((l=new i).frameStart=0,this._actionFrames.push(l),l=null);for(var d=0,p=this._actionFrames;dn)break;u++}null===l&&((l=new i).frameStart=n,this._actionFrames.splice(u+1,0,l));for(var g=0;g0){var f=r.getBone(c);null!==f?_.parent=f:(c in this._cacheBones||(this._cacheBones[c]=[]),this._cacheBones[c].push(_))}if(_.name in this._cacheBones){for(var d=0,p=this._cacheBones[_.name];d0&&null!==i.parent?(s.root=i.parent,s.bone=i):(s.root=i,s.bone=null),s},n.prototype._parsePathConstraint=function(e){var i=this._armature.getSlot(n._getString(e,t.DataParser.TARGET,""));if(null===i)return null;var r=this._armature.defaultSkin;if(null===r)return null;var s=r.getDisplay(i.name,n._getString(e,t.DataParser.TARGET_DISPLAY,i.name));if(null===s||!(s instanceof t.PathDisplayData))return null;var a=e[t.DataParser.BONES];if(null===a||0===a.length)return null;var o=t.BaseObject.borrowObject(t.PathConstraintData);o.name=n._getString(e,t.DataParser.NAME,""),o.type=1,o.pathSlot=i,o.pathDisplayData=s,o.target=i.parent,o.positionMode=t.DataParser._getPositionMode(n._getString(e,t.DataParser.POSITION_MODE,"")),o.spacingMode=t.DataParser._getSpacingMode(n._getString(e,t.DataParser.SPACING_MODE,"")),o.rotateMode=t.DataParser._getRotateMode(n._getString(e,t.DataParser.ROTATE_MODE,"")),o.position=n._getNumber(e,t.DataParser.POSITION,0),o.spacing=n._getNumber(e,t.DataParser.SPACING,0),o.rotateOffset=n._getNumber(e,t.DataParser.ROTATE_OFFSET,0),o.rotateMix=n._getNumber(e,t.DataParser.ROTATE_MIX,1),o.translateMix=n._getNumber(e,t.DataParser.TRANSLATE_MIX,1);for(var h=0,u=a;h0?r:i,this._parsePivot(e,o);break;case 1:var h=a=t.BaseObject.borrowObject(t.ArmatureDisplayData);if(h.name=i,h.path=r.length>0?r:i,h.inheritAnimation=!0,t.DataParser.ACTIONS in e)for(var u=0,l=this._parseActionData(e[t.DataParser.ACTIONS],0,null,null);u0?r:i,p.vertices.data=this._data,t.DataParser.SHARE in e?(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p)):this._parseMesh(e,p),t.DataParser.GLUE_WEIGHTS in e&&t.DataParser.GLUE_MESHES in e&&(this._cacheRawMeshes.push(e),this._cacheMeshes.push(p));break;case 3:var m=this._parseBoundingBox(e);if(null!==m){var g=a=t.BaseObject.borrowObject(t.BoundingBoxDisplayData);g.name=i,g.path=r.length>0?r:i,g.boundingBox=m}break;case 4:var y=e[t.DataParser.LENGTHS],v=a=t.BaseObject.borrowObject(t.PathDisplayData);v.closed=n._getBoolean(e,t.DataParser.CLOSED,!1),v.constantSpeed=n._getBoolean(e,t.DataParser.CONSTANT_SPEED,!1),v.name=i,v.path=r.length>0?r:i,v.vertices.data=this._data,v.curveLengths.length=y.length;for(var A=0,S=y.length;Ai.width&&(i.width=h),ui.height&&(i.height=u))}i.width-=i.x,i.height-=i.y}else console.warn("Data error.\n Please reexport DragonBones Data to fixed the bug.");return i},n.prototype._parseAnimation=function(e){var i=t.BaseObject.borrowObject(t.AnimationData);if(i.frameCount=Math.max(n._getNumber(e,t.DataParser.DURATION,1),1),i.playTimes=n._getNumber(e,t.DataParser.PLAY_TIMES,1),i.duration=i.frameCount/this._armature.frameRate,i.fadeInTime=n._getNumber(e,t.DataParser.FADE_IN_TIME,0),i.scale=n._getNumber(e,t.DataParser.SCALE,1),i.name=n._getString(e,t.DataParser.NAME,t.DataParser.DEFAULT_NAME),0===i.name.length&&(i.name=t.DataParser.DEFAULT_NAME),i.frameIntOffset=this._frameIntArray.length,i.frameFloatOffset=this._frameFloatArray.length,i.frameOffset=this._frameArray.length,this._animation=i,t.DataParser.FRAME in e){var r=e[t.DataParser.FRAME],s=r.length;if(s>0)for(var a=0,o=0;a0&&(this._animation.actionTimeline=this._parseTimeline(null,this._actionFrames,"",0,!1,!1,0,this._parseActionFrame),this._actionFrames.length=0),this._animation=null,i},n.prototype._parseTimeline=function(e,r,s,a,o,h,u,l){if(null!==e&&s.length>0&&s in e&&(r=e[s]),null===r)return null;var c=r.length;if(0===c)return null;var _=this._frameIntArray.length,f=this._frameFloatArray.length,d=t.BaseObject.borrowObject(t.TimelineData),p=this._timelineArray.length;if(this._timelineArray.length+=5+c,null!==e?(this._timelineArray[p+0]=Math.round(100*n._getNumber(e,t.DataParser.SCALE,1)),this._timelineArray[p+1]=Math.round(100*n._getNumber(e,t.DataParser.OFFSET,0))):(this._timelineArray[p+0]=100,this._timelineArray[p+1]=0),this._timelineArray[p+2]=c,this._timelineArray[p+3]=u,this._timelineArray[p+4]=o?_-this._animation.frameIntOffset:h?f-this._animation.frameFloatOffset:0,this._timeline=d,d.type=a,d.offset=p,1===c)d.frameIndicesOffset=-1,this._timelineArray[p+5+0]=l.call(this,r[0],0,0)-this._animation.frameOffset;else{var m=this._animation.frameCount+1,g=this._data.frameIndices,y=0;t.DragonBones.webAssembly?(y=g.size(),g.resize(y+m,0)):(y=g.length,g.length+=m),d.frameIndicesOffset=y;for(var v=0,A=0,S=0,b=0;v0)if(t.DataParser.CURVE in e){var a=r+1;this._helpArray.length=a,this._samplingEasingCurve(e[t.DataParser.CURVE],this._helpArray),this._frameArray.length+=2+this._helpArray.length,this._frameArray[s+1]=2,this._frameArray[s+2]=a;for(var o=0;o0){for(var a=this._armature.sortedSlots.length,o=new Array(a-s.length/2),h=new Array(a),u=0;u0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.TWEEN_ROTATE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=6,this._frameFloatArray[o++]=this._helpTransform.x,this._frameFloatArray[o++]=this._helpTransform.y,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=this._helpTransform.skew,this._frameFloatArray[o++]=this._helpTransform.scaleX,this._frameFloatArray[o++]=this._helpTransform.scaleY,this._parseActionDataInFrame(e,i,this._bone,this._slot),a},n.prototype._parseBoneTranslateFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,0),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,0),s},n.prototype._parseBoneRotateFrame=function(e,i,r){var s=n._getNumber(e,t.DataParser.ROTATE,0)*t.Transform.DEG_RAD;0!==i&&(0===this._prevClockwise?s=this._prevRotation+t.Transform.normalizeRadian(s-this._prevRotation):((this._prevClockwise>0?s>=this._prevRotation:s<=this._prevRotation)&&(this._prevClockwise=this._prevClockwise>0?this._prevClockwise-1:this._prevClockwise+1),s=this._prevRotation+s-this._prevRotation+t.Transform.PI_D*this._prevClockwise)),this._prevClockwise=n._getNumber(e,t.DataParser.CLOCK_WISE,0),this._prevRotation=s;var a=this._parseTweenFrame(e,i,r),o=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[o++]=s,this._frameFloatArray[o++]=n._getNumber(e,t.DataParser.SKEW,0)*t.Transform.DEG_RAD,a},n.prototype._parseBoneScaleFrame=function(e,i,r){var s=this._parseTweenFrame(e,i,r),a=this._frameFloatArray.length;return this._frameFloatArray.length+=2,this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.X,1),this._frameFloatArray[a++]=n._getNumber(e,t.DataParser.Y,1),s},n.prototype._parseSurfaceFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=e[t.DataParser.VERTICES],h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._surface.vertices.length/2,l=0,c=0;this._frameFloatArray.length+=2*u;for(var _=0;_<2*u;_+=2)l=_=o.length?0:o[_-h],c=_+1=o.length?0:o[_+1-h],this._frameFloatArray[s+_]=l,this._frameFloatArray[s+_+1]=c;if(0===i){var f=this._frameIntArray.length;this._frameIntArray.length+=5,this._frameIntArray[f+0]=0,this._frameIntArray[f+1]=this._frameFloatArray.length-s,this._frameIntArray[f+2]=this._frameFloatArray.length-s,this._frameIntArray[f+3]=0,this._frameIntArray[f+4]=s-this._animation.frameFloatOffset,this._timelineArray[this._timeline.offset+3]=f-this._animation.frameIntOffset}return a},n.prototype._parseSlotDisplayFrame=function(e,i,r){var s=this._parseFrame(e,i,r);return this._frameArray.length+=1,t.DataParser.VALUE in e?this._frameArray[s+1]=n._getNumber(e,t.DataParser.VALUE,0):this._frameArray[s+1]=n._getNumber(e,t.DataParser.DISPLAY_INDEX,0),this._parseActionDataInFrame(e,i,this._slot.parent,this._slot),s},n.prototype._parseSlotColorFrame=function(e,i,n){var r=this._parseTweenFrame(e,i,n),s=-1;if(t.DataParser.VALUE in e||t.DataParser.COLOR in e){var a=t.DataParser.VALUE in e?e[t.DataParser.VALUE]:e[t.DataParser.COLOR];for(var o in a){this._parseColorTransform(a,this._helpColorTransform),s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=Math.round(100*this._helpColorTransform.alphaMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.redMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.greenMultiplier),this._intArray[s++]=Math.round(100*this._helpColorTransform.blueMultiplier),this._intArray[s++]=Math.round(this._helpColorTransform.alphaOffset),this._intArray[s++]=Math.round(this._helpColorTransform.redOffset),this._intArray[s++]=Math.round(this._helpColorTransform.greenOffset),this._intArray[s++]=Math.round(this._helpColorTransform.blueOffset),s-=8;break}}s<0&&(this._defaultColorOffset<0&&(this._defaultColorOffset=s=this._intArray.length,this._intArray.length+=8,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=100,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0,this._intArray[s++]=0),s=this._defaultColorOffset);var h=this._frameIntArray.length;return this._frameIntArray.length+=1,this._frameIntArray[h]=s,r},n.prototype._parseSlotFFDFrame=function(e,i,r){var s=this._frameFloatArray.length,a=this._parseTweenFrame(e,i,r),o=t.DataParser.VERTICES in e?e[t.DataParser.VERTICES]:null,h=n._getNumber(e,t.DataParser.OFFSET,0),u=this._intArray[this._mesh.vertices.offset+0],l=this._mesh.parent.name+"_"+this._slot.name+"_"+this._mesh.name,c=this._mesh.vertices.weight,_=0,f=0,d=0,p=0;if(null!==c){var m=this._weightSlotPose[l];this._helpMatrixA.copyFromArray(m,0),this._frameFloatArray.length+=2*c.count,d=c.offset+2+c.bones.length}else this._frameFloatArray.length+=2*u;for(var g=0;g<2*u;g+=2)if(null===o?(_=0,f=0):(_=g=o.length?0:o[g-h],f=g+1=o.length?0:o[g+1-h]),null!==c){var y=this._weightBonePoses[l],v=this._intArray[d++];this._helpMatrixA.transformPoint(_,f,this._helpPoint,!0),_=this._helpPoint.x,f=this._helpPoint.y;for(var A=0;A=0||t.DataParser.DATA_VERSIONS.indexOf(s)>=0){var a=t.BaseObject.borrowObject(t.DragonBonesData);if(a.version=r,a.name=n._getString(e,t.DataParser.NAME,""),a.frameRate=n._getNumber(e,t.DataParser.FRAME_RATE,24),0===a.frameRate&&(a.frameRate=24),t.DataParser.ARMATURE in e){this._data=a,this._parseArray(e);for(var o=0,h=e[t.DataParser.ARMATURE];o0&&(a.stage=a.getArmature(a.armatureNames[0])),this._data=null}return t.DataParser.TEXTURE_ATLAS in e&&(this._rawTextureAtlases=e[t.DataParser.TEXTURE_ATLAS]),a}return console.assert(!1,"Nonsupport data version: "+r+"\nPlease convert DragonBones data to support version.\nRead more: https://github.com/DragonBones/Tools/"),null},n.prototype.parseTextureAtlasData=function(e,i,r){if(void 0===r&&(r=1),console.assert(void 0!==e),null===e){if(null===this._rawTextureAtlases||0===this._rawTextureAtlases.length)return!1;var s=this._rawTextureAtlases[this._rawTextureAtlasIndex++];return this.parseTextureAtlasData(s,i,r),this._rawTextureAtlasIndex>=this._rawTextureAtlases.length&&(this._rawTextureAtlasIndex=0,this._rawTextureAtlases=null),!0}if(i.width=n._getNumber(e,t.DataParser.WIDTH,0),i.height=n._getNumber(e,t.DataParser.HEIGHT,0),i.scale=1===r?1/n._getNumber(e,t.DataParser.SCALE,1):r,i.name=n._getString(e,t.DataParser.NAME,""),i.imagePath=n._getString(e,t.DataParser.IMAGE_PATH,""),t.DataParser.SUB_TEXTURE in e)for(var a=e[t.DataParser.SUB_TEXTURE],o=0,h=a.length;o0&&_>0&&(l.frame=t.TextureData.createRectangle(),l.frame.x=n._getNumber(u,t.DataParser.FRAME_X,0),l.frame.y=n._getNumber(u,t.DataParser.FRAME_Y,0),l.frame.width=c,l.frame.height=_),i.addTexture(l)}return!0},n.getInstance=function(){return null===n._objectDataParserInstance&&(n._objectDataParserInstance=new n),n._objectDataParserInstance},n._objectDataParserInstance=null,n}(t.DataParser);t.ObjectDataParser=e;var i=function(){this.frameStart=0,this.actions=[]};t.ActionFrame=i}(k2||(k2={})),function(t){var e=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return V2(i,e),i.prototype._inRange=function(t,e,i){return e<=t&&t<=i},i.prototype._decodeUTF8=function(t){for(var e,i=0,n="",r=0,s=0,a=0,o=0;t.length>i;){var h=t[i++];if(-1===h)e=0!==s?65533:-1;else if(0===s)this._inRange(h,0,127)?e=h:(this._inRange(h,194,223)?(s=1,o=128,r=h-192):this._inRange(h,224,239)?(s=2,o=2048,r=h-224):this._inRange(h,240,244)&&(s=3,o=65536,r=h-240),r*=Math.pow(64,s),e=null);else if(this._inRange(h,128,191))if(a+=1,r+=(h-128)*Math.pow(64,s-a),a!==s)e=null;else{var u=r,l=o;r=0,s=0,a=0,o=0,e=this._inRange(u,l,1114111)&&!this._inRange(u,55296,57343)?u:h}else r=0,s=0,a=0,o=0,i--,e=h;null!==e&&-1!==e&&(e<=65535?e>0&&(n+=String.fromCharCode(e)):(e-=65536,n+=String.fromCharCode(55296+(e>>10&1023)),n+=String.fromCharCode(56320+(1023&e))))}return n},i.prototype._getUTF16Key=function(t){for(var e=0,i=t.length;e255)return encodeURI(t);return t},i.prototype._parseBinaryTimeline=function(e,i,n){void 0===n&&(n=null);var r=null!==n?n:t.BaseObject.borrowObject(t.TimelineData);r.type=e,r.offset=i,this._timeline=r;var s=this._timelineArrayBuffer[r.offset+2];if(1===s)r.frameIndicesOffset=-1;else{var a=0,o=this._animation.frameCount+1,h=this._data.frameIndices;t.DragonBones.webAssembly?(a=h.size(),h.resize(a+o,0)):(a=h.length,h.length+=o),r.frameIndicesOffset=a;for(var u=0,l=0,c=0,_=0;u=0){var r=t.BaseObject.borrowObject(t.WeightData),s=this._intArrayBuffer[i.offset+0],a=this._intArrayBuffer[n+0];r.offset=n;for(var o=0;o0&&e in this._dragonBonesDataMap&&(a=(s=this._dragonBonesDataMap[e]).getArmature(i)),null===a&&(0===e.length||this.autoSearch))for(var o in this._dragonBonesDataMap)if(s=this._dragonBonesDataMap[o],(0===e.length||s.autoSearch)&&null!==(a=s.getArmature(i))){e=o;break}if(null!==a){if(t.dataName=e,t.textureAtlasName=r,t.data=s,t.armature=a,t.skin=null,n.length>0&&(t.skin=a.getSkin(n),null===t.skin&&this.autoSearch))for(var o in this._dragonBonesDataMap){var h=this._dragonBonesDataMap[o].getArmature(n);if(null!==h){t.skin=h.defaultSkin;break}}return null===t.skin&&(t.skin=a.defaultSkin),!0}return!1},e.prototype._buildBones=function(e,i){for(var n=0,r=e.armature.sortedBones;n0&&(o.texture=this._getTextureData(e.textureAtlasName,i.path)),null===o.texture&&(o.texture=this._getTextureData(s,i.path)),a=null!==n&&2===n.type&&this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 2:var h=i;null!==e&&e.textureAtlasName.length>0&&(h.texture=this._getTextureData(e.textureAtlasName,h.path)),null===h.texture&&(h.texture=this._getTextureData(s,h.path)),a=this._isSupportMesh()?r.meshDisplay:r.rawDisplay;break;case 1:var u=i,l=this._buildChildArmature(e,r,i);if(null!==l){if(l.inheritAnimation=u.inheritAnimation,!l.inheritAnimation){var c=u.actions.length>0?u.actions:l.armatureData.defaultActions;if(c.length>0)for(var _=0,f=c;_=0)){var l=i.getDisplays(u.name);if(l||(null!==a&&i!==a&&(l=a.getDisplays(u.name)),l)){var c=t.DragonBones.webAssembly?l.size():l.length,_=u.displayList;_.length=c;for(var f=0,d=c;f0&&n.inheritDeform,a=this._localVertices;if(r){var o=n.data,h=o.intArray,u=o.floatArray,l=h[n.offset+v5.MeshVertexCount],c=h[r.offset+v5.WeigthFloatOffset];c<0&&(c+=65536);for(var _=0,f=r.offset+v5.WeigthBoneIndices+i.length,d=c,p=0,m=0;_=0;o--)if(s>=e[o]._zOrder){e.splice(o+1,0,r),a=!0;break}a||e.unshift(r)}this._slots=e},i._buildArmature=function(t){var e=t3.borrowObject(N3);e._skinData=t.skin,e._animation=t3.borrowObject(X3),e._animation._armature=e,e._animation.animations=t.armature.animations,e._isChildArmature=!1;var i=new D5;return e.init(t.armature,i,i,this._dragonBones),e},i._buildSlot=function(t,e,i){var n=t3.borrowObject(B5),r=n;return n.init(e,i,r,r),n},i.getDragonBonesDataByUUID=function(t){for(var e in this._dragonBonesDataMap)if(-1!==e.indexOf(t))return this._dragonBonesDataMap[e];return null},i.removeDragonBonesDataByUUID=function(t,e){for(var i in void 0===e&&(e=!0),this._dragonBonesDataMap)-1!==i.indexOf(t)&&(e&&this._dragonBones.bufferObject(this._dragonBonesDataMap[i]),delete this._dragonBonesDataMap[i])},e}(g5),X2._factory=null,W2=j2))||W2,M5=1/60,O5=[],F5=[],N5=0,L5=0,V5=0,k5=null,G5=null,U5=0,z5=0,H5=0,W5=0,X5=0,j5=function(){function t(){this.maxVertexCount=0,this.maxIndexCount=0,this._privateMode=!1,this._inited=!1,this._invalid=!0,this._enableCacheAttachedInfo=!1,this.frames=[],this.totalTime=0,this.isCompleted=!1,this._frameIdx=-1,this._armatureInfo=null,this._animationName=null,this._tempSegments=null,this._tempColors=null,this._tempBoneInfos=null}var e=t.prototype;return e.init=function(t,e){this._inited=!0,this._armatureInfo=t,this._animationName=e},e.clear=function(){this._inited=!1;for(var t=0,e=this.frames.length;t0&&(r[W5-1].vfOffset=V5),r.length=W5,s.length=N5;var a=H5-1;if(a>=0)if(z5>0){var o=n[a];o.indexCount=z5,o.vfCount=9*U5,o.vertexCount=U5,n.length=H5}else n.length=H5-1;if(0!==n.length){var h,u=i.vertices,l=V5/5,c=9*l;(!u||u.length>8&255)/255,u[_+7]=(h>>16&255)/255,u[_+8]=(h>>24&255)/255,_+=9;var d=i.indices;(!d||d.lengththis.maxVertexCount?l:this.maxVertexCount,this.maxIndexCount=d.length>this.maxIndexCount?d.length:this.maxIndexCount}},e._traverseArmature=function(t,e){var i,n,r,s,a,o,h,u,l,c=this._tempColors,_=this._tempSegments,f=this._tempBoneInfos,d=t._slots,p=t._bones;if(this._enableCacheAttachedInfo)for(var m=0,g=p.length;m=0&&(z5>0?((l=_[u]).indexCount=z5,l.vertexCount=U5,l.vfCount=9*U5):H5--),_[H5]={tex:h,blendMode:r._blendMode,indexCount:0,vertexCount:0,vfCount:0},H5++,z5=0,U5=0),o=(a.a*e<<24>>>0)+(a.b<<16)+(a.g<<8)+a.r,X5!==o&&(X5=o,W5>0&&(c[W5-1].vfOffset=V5),c[W5++]={r:a.r,g:a.g,b:a.b,a:a.a*e,vfOffset:0}),i=r._localVertices,n=r._indices,s=r._worldMatrix;for(var T=0,E=i.length;T":0},r=i.animations,s=0;for(var a in r)r.hasOwnProperty(a)&&(n[a]=s+1,s++);return _e(n)}return null},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(Y5.sharedCache.resetArmature(this._uuid),this._factory.removeDragonBonesDataByUUID(this._uuid,!0))},u(e,[{key:"dragonBonesJson",get:function(){return this._dragonBonesJson},set:function(t){this._dragonBonesJson=t,this._dragonBonesJsonData=JSON.parse(t),this.reset()}}]),e}(Wl),Z2=S((J2=Q2).prototype,"_dragonBonesJson",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),K2=J2))||K2;C.internal.DragonBonesAsset=n4;var r4,s4=(q5=_u("dragonBones.DragonBonesAtlasAsset"),K5=qu(Kg),q5((i4=function(t){function e(){var e;return A(e=t.call(this)||this,"_atlasJson",Q5,g(e)),A(e,"_texture",$5,g(e)),A(e,"_atlasJsonData",t4,g(e)),e._factory=null,A(e,"_textureAtlasData",e4,g(e)),e._clear(),e}c(e,t);var i=e.prototype;return i.createNode=function(t){var e=new YA(this.name);return e.addComponent("dragonBones.ArmatureDisplay").dragonAtlasAsset=this,t(null,e)},i.init=function(t){this._factory=t,this._atlasJsonData||(this._atlasJsonData=JSON.parse(this.atlasJson));var e=this._atlasJsonData;this._uuid=this._uuid||e.name,this._textureAtlasData?t.addTextureAtlasData(this._textureAtlasData,this._uuid):this._textureAtlasData=t.parseTextureAtlasData(e,this.texture,this._uuid)},i.destroy=function(){return this._clear(),t.prototype.destroy.call(this)},i._clear=function(){this._factory&&(Y5.sharedCache.resetArmature(this._uuid),this._factory.removeTextureAtlasData(this._uuid,!0),this._factory.removeDragonBonesDataByUUID(this._uuid,!0)),this._textureAtlasData=null},u(e,[{key:"atlasJson",get:function(){return this._atlasJson},set:function(t){this._atlasJson=t,this._atlasJsonData=JSON.parse(this.atlasJson),this._clear()}},{key:"texture",get:function(){return this._texture},set:function(t){this._texture=t,this._clear()}}]),e}(Wl),Q5=S((Z5=i4).prototype,"_atlasJson",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),$5=S(Z5.prototype,"_texture",[Au,K5],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),t4=S(Z5.prototype,"_atlasJsonData",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{}}}),e4=S(Z5.prototype,"_textureAtlasData",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),J5=Z5))||J5);C.internal.DragonBonesAtlasAsset=s4;var a4,o4,h4,u4,l4,c4,_4,f4,d4,p4,m4,g4,y4,v4,A4,S4,b4,T4,E4,C4,w4,x4,R4,I4,B4,D4,P4,M4,O4,F4,N4,L4,V4,k4,G4,U4,z4,H4,W4,X4,j4,Y4,q4,K4,J4,Z4,Q4,$4,t8,e8,i8,n8,r8,s8,a8,o8=new hn,h8=_u("dragonBones.AttachUtil")(r4=function(){function t(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null}var e=t.prototype;return e.init=function(t){this._inited=!0,this._armature=t._armature,this._armatureNode=t.node,this._armatureDisplay=t},e.reset=function(){this._inited=!1,this._armature=null,this._armatureNode=null,this._armatureDisplay=null},e._syncAttachedNode=function(){if(this._inited){this._armatureNode.worldMatrix;var t=null,e=this._armatureDisplay.isAnimationCached();if(!e||!this._armatureDisplay||(t=this._armatureDisplay._curFrame&&this._armatureDisplay._curFrame.boneInfos))for(var i,n,r,s=this._armatureDisplay.sockets,a=this._armatureDisplay.socketNodes,o=this._armature.getBones(),h=s.length-1;h>=0;h--){var u=s[h],l=u.target;if(l)if(l.isValid){var c=e?t[u.boneIndex]:o[u.boneIndex];c&&(i=l,n=c.globalTransformMatrix,r=void 0,(r=o8).m00=n.a,r.m01=n.b,r.m04=-n.c,r.m05=-n.d,r.m12=n.tx,r.m13=n.ty,i.matrix=o8)}else a.delete(u.path),s.splice(h,1)}}},t}())||r4,u8=function(t){function e(){var e;return(e=t.call(this)||this)._armatures=new Set,e}c(e,t),e.getInstance=function(){return e._instance||(e._instance=new e,BN.registerSystem(e.ID,e._instance,KA.Priority.HIGH)),e._instance};var i=e.prototype;return i.add=function(t){t&&(this._armatures.has(t)||this._armatures.add(t))},i.remove=function(t){t&&this._armatures.has(t)&&this._armatures.delete(t)},i.postUpdate=function(t){this._armatures&&this._armatures.forEach((function(e){e.updateAnimation(t)}))},i.prepareRenderData=function(){this._armatures&&this._armatures.forEach((function(t){t.markForUpdateRenderData()}))},e}(KA);function l8(t,e,i){ui.Attr.setClassAttr(t,e,"type","Enum"),ui.Attr.setClassAttr(t,e,"enumList",_e.getList(i))}u8.ID="ARMATURE",u8._instance=void 0,C.internal.ArmatureSystem=u8,function(t){t[t.default=-1]="default"}(n8||(n8={})),pe(n8),function(t){t[t[""]=0]=""}(r8||(r8={})),pe(r8),function(t){t[t.REALTIME=0]="REALTIME"}(s8||(s8={})),pe(r8),function(t){t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(a8||(a8={})),pe(a8);var c8=(a4=_u("dragonBones.ArmatureDisplay.DragonBoneSocket"),o4=qu(YA),a4((l4=S((u4=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),A(this,"path",l4,this),A(this,"target",c4,this),this.boneIndex=null,this.path=t,this.target=e}).prototype,"path",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),c4=S(u4.prototype,"target",[o4,Du,Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),h4=u4))||h4);ee(c8,"dragonBones.ArmatureDisplay.DragonBoneSocket");var _8=(_4=_u("dragonBones.ArmatureDisplay"),f4=Bu(),d4=wu(),p4=qu(n4),m4=Fu(),g4=qu(s4),y4=Fu(),v4=Pu(),A4=Pu(),S4=Ou(),b4=qu(n8),T4=Fu(),E4=qu(r8),C4=Ou(),w4=Fu(),x4=Ou(),R4=Fu(),I4=Fu(),B4=Fu(),D4=Fu(),P4=Fu(),M4=Fu(),O4=qu([c8]),F4=Fu(),N4=qu(Wv),L4=Uu(),V4=Ou(),_4(k4=f4(k4=d4(k4=Cu((i8=e8=function(t){c(i,t);var e=i.prototype;function i(){var e;return A(e=t.call(this)||this,"playTimes",U4,g(e)),A(e,"premultipliedAlpha",z4,g(e)),e._armature=null,e.attachUtil=void 0,A(e,"_defaultArmatureIndexValue",H4,g(e)),A(e,"_dragonAsset",W4,g(e)),A(e,"_dragonAtlasAsset",X4,g(e)),A(e,"_armatureName",j4,g(e)),A(e,"_animationName",Y4,g(e)),A(e,"_animationIndexValue",q4,g(e)),e._preCacheMode=-1,e._cacheMode=a8.REALTIME,A(e,"_defaultCacheModeValue",K4,g(e)),A(e,"_timeScale",J4,g(e)),A(e,"_playTimes",Z4,g(e)),A(e,"_debugBones",Q4,g(e)),A(e,"_enableBatch",$4,g(e)),e._debugDraw=null,e._armatureKey="",e._accTime=0,e._playCount=0,e._frameCache=null,e._curFrame=null,e._playing=!1,e._armatureCache=null,e._eventTarget=void 0,e._factory=null,e._displayProxy=null,e._drawIdx=0,e._drawList=new pa((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumArmatures=_e({}),e._enumAnimations=_e({}),e._socketNodes=new Map,e._cachedSockets=new Map,A(e,"_sockets",t8,g(e)),e._inited=void 0,e._drawInfoList=[],e._cacheModeEnum=void 0,e._eventTarget=new Ma,e._inited=!1,e.attachUtil=new h8,e.initFactory(),l8(g(e),"_animationIndex",e._enumAnimations),l8(g(e),"_defaultArmatureIndex",e._enumArmatures),e._useVertexOpacity=!0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new Ek),this._drawInfoList[t]},e.initFactory=function(){this._factory=P5.getInstance()},e.onLoad=function(){t.prototype.onLoad.call(this);for(var e=this.node.children,i=0,n=e.length;ithis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount)))),e.isCompleted&&r>=i.length){if(this._playCount++,this.playTimes>0&&this._playCount>=this.playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playing=!1,this._playCount=0,this._emitCacheCompleteEvent(),void this.attachUtil._syncAttachedNode();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r],this.attachUtil._syncAttachedNode()}else e.isInvalid()&&(e.updateToFrame(),this._curFrame=i[i.length-1],this.renderData&&(this.renderData.vertexCountthis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount))))}}},e.onDestroy=function(){this._materialInstances=this._materialInstances.filter((function(t){return!!t})),this._inited=!1,this._cacheMode===a8.PRIVATE_CACHE?(this._armatureCache.dispose(),this._armatureCache=null,this._armature=null):this._cacheMode===a8.SHARED_CACHE?(this._armatureCache=null,this._armature=null):this._armature&&(this._armature.dispose(),this._armature=null),this._drawList.destroy(),t.prototype.onDestroy.call(this)},e._updateDebugDraw=function(){if(this.debugBones){if(!this._debugDraw){var t=new YA("DEBUG_DRAW_NODE");t.hideFlags|=Sa.Flags.DontSave|Sa.Flags.HideInHierarchy;var e=t.addComponent(fW);e.lineWidth=1,e.strokeColor=new ki(255,0,0,255),this._debugDraw=e}this._debugDraw.node.parent=this.node}else this._debugDraw&&(this._debugDraw.node.parent=null);this.markForUpdateRenderData()},e._updateBatch=function(){this._cleanMaterialCache(),this.markForUpdateRenderData()},e._buildArmature=function(){if(this.dragonAsset&&this.dragonAtlasAsset&&this.armatureName){this._armature&&(this._preCacheMode===a8.PRIVATE_CACHE?this._armatureCache.dispose():this._preCacheMode===a8.REALTIME&&this._armature.dispose(),this._armatureCache=null,this._armature=null,this._displayProxy=null,this._frameCache=null,this._curFrame=null,this._playing=!1,this._preCacheMode=-1),this._cacheMode===a8.SHARED_CACHE?this._armatureCache=Y5.sharedCache:this._cacheMode===a8.PRIVATE_CACHE&&(this._armatureCache=new Y5,this._armatureCache.enablePrivateMode());var t=this.dragonAtlasAsset._uuid;if(this._armatureKey=this.dragonAsset.init(this._factory,t),this.isAnimationCached()&&(this._armature=this._armatureCache.getArmatureCache(this.armatureName,this._armatureKey,t),this._armature||(this._cacheMode=a8.REALTIME)),this._preCacheMode=this._cacheMode,this._cacheMode===a8.REALTIME){if(this._displayProxy=this._factory.buildArmatureDisplay(this.armatureName,this._armatureKey,"",t),!this._displayProxy)return;this._displayProxy._ccNode=this.node,this._displayProxy._ccComponent=this,this._displayProxy.setEventTarget(this._eventTarget),this._armature=this._displayProxy._armature,this._armature.animation.timeScale=this.timeScale}if(this._cacheMode!==a8.REALTIME&&this.debugBones&&console.warn("Debug bones is invalid in cached mode"),this._armature){var e=this._armature.armatureData.aabb;this.node._uiProps.uiTransformComp.setContentSize(e.width,e.height)}this.attachUtil.init(this),this.animationName&&this.playAnimation(this.animationName,this.playTimes),this._flushAssembler()}},e.querySockets=function(){return this._armature?(0===this._cachedSockets.size&&this._indexBoneSockets(),Array.from(this._cachedSockets.keys()).sort()):[]},e.querySocketPathByName=function(t){for(var e,i=[],n=v(this._cachedSockets.keys());!(e=n()).done;){var r=e.value;r.endsWith(t)&&i.push(r)}return i},e._parseDragonAtlasAsset=function(){this.dragonAtlasAsset&&this.dragonAtlasAsset.init(this._factory)},e._refresh=function(){this._buildArmature(),this._indexBoneSockets(),this.markForUpdateRenderData()},e._updateCacheModeEnum=function(){this._cacheModeEnum=_e({}),this._armature?Object.assign(this._cacheModeEnum,a8):Object.assign(this._cacheModeEnum,s8),l8(this,"_defaultCacheMode",this._cacheModeEnum)},e._updateAnimEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getAnimsEnum(this.armatureName):r8,this._enumAnimations=_e({}),Object.assign(this._enumAnimations,t||r8),_e.update(this._enumAnimations),l8(this,"_animationIndex",this._enumAnimations)},e._updateArmatureEnum=function(){var t;t=this.dragonAsset?this.dragonAsset.getArmatureEnum():n8,this._enumArmatures=_e({}),Object.assign(this._enumArmatures,t||n8),_e.update(this._enumArmatures),l8(this,"_defaultArmatureIndex",this._enumArmatures)},e._indexBoneSockets=function(){if(this._armature){this._cachedSockets.clear();var t=this._cachedSockets,e=function t(e,i,n){if(n.has(e))return n.get(e);var r=i[e];if(!r.parent)return n.set(e,r.name),r.path=r.name,r.name;var s=t(r.parent._boneIndex,i,n)+"/"+r.name;return n.set(e,s),r.path=s,s};!function i(n,r){for(var s=r.getBones(),a=new Map,o=0;o0&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._playing=!0,this._curFrame=this._frameCache.frames[0])}else if(this._armature)return this._armature.animation.play(t,this.playTimes);return this.markForUpdateRenderData(),null},e.updateAnimationCache=function(t){this.isAnimationCached()&&this._armatureCache.updateAnimationCache(this._armatureKey,t)},e.invalidAnimationCache=function(){this.isAnimationCached()&&this._armatureCache.invalidAnimationCache(this._armatureKey)},e.getArmatureNames=function(){var t=this._factory.getDragonBonesData(this._armatureKey);return t&&t.armatureNames||[]},e.getAnimationNames=function(t){var e=[],i=this._factory.getDragonBonesData(this._armatureKey);if(i){var n=i.getArmature(t);if(n)for(var r in n.animations)n.animations.hasOwnProperty(r)&&e.push(r)}return e},e.on=function(t,e,i){this.addEventListener(t,e,i)},e.off=function(t,e,i){this.removeEventListener(t,e,i)},e.once=function(t,e,i){this._eventTarget.once(t,e,i)},e.addEventListener=function(t,e,i){this._eventTarget.on(t,e,i)},e.removeEventListener=function(t,e,i){this._eventTarget.off(t,e,i)},e.buildArmature=function(t,e){return this._factory.createArmatureNode(this,t,e)},e.armature=function(){return this._armature},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t),this._armature&&this._assembler&&(this._renderData=this._assembler.createData(this),this.renderData&&(this.maxVertexCount=this.renderData.vertexCount,this.maxIndexCount=this.renderData.indexCount),this.markForUpdateRenderData(),this._updateColor())},e._updateSocketBindings=function(){if(this._armature){this._socketNodes.clear();for(var t=0,e=this._sockets.length;t0&&this._frameCache&&this._frameCache.enableCacheAttachedInfo()}},{key:"socketNodes",get:function(){return this._socketNodes}},{key:"drawList",get:function(){return this._drawList}},{key:"customMaterial",get:function(){return this._customMaterial},set:function(t){this._customMaterial=t,this._cleanMaterialCache(),this.setMaterial(this._customMaterial,0),this.markForUpdateRenderData()}}]),i}(zU),e8.AnimationCacheMode=a8,S((G4=i8).prototype,"dragonAsset",[Du,p4,m4],Object.getOwnPropertyDescriptor(G4.prototype,"dragonAsset"),G4.prototype),S(G4.prototype,"dragonAtlasAsset",[Du,g4,y4],Object.getOwnPropertyDescriptor(G4.prototype,"dragonAtlasAsset"),G4.prototype),S(G4.prototype,"armatureName",[v4],Object.getOwnPropertyDescriptor(G4.prototype,"armatureName"),G4.prototype),S(G4.prototype,"animationName",[A4],Object.getOwnPropertyDescriptor(G4.prototype,"animationName"),G4.prototype),S(G4.prototype,"_defaultArmatureIndex",[S4,Du,b4,T4],Object.getOwnPropertyDescriptor(G4.prototype,"_defaultArmatureIndex"),G4.prototype),S(G4.prototype,"_animationIndex",[Du,E4,C4,w4],Object.getOwnPropertyDescriptor(G4.prototype,"_animationIndex"),G4.prototype),S(G4.prototype,"_defaultCacheMode",[Du,x4,R4],Object.getOwnPropertyDescriptor(G4.prototype,"_defaultCacheMode"),G4.prototype),S(G4.prototype,"timeScale",[Du,I4,Au],Object.getOwnPropertyDescriptor(G4.prototype,"timeScale"),G4.prototype),U4=S(G4.prototype,"playTimes",[B4,Du,Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),z4=S(G4.prototype,"premultipliedAlpha",[Au,Du,D4],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),S(G4.prototype,"debugBones",[P4,Du],Object.getOwnPropertyDescriptor(G4.prototype,"debugBones"),G4.prototype),S(G4.prototype,"enableBatch",[M4,Du],Object.getOwnPropertyDescriptor(G4.prototype,"enableBatch"),G4.prototype),S(G4.prototype,"sockets",[O4,F4],Object.getOwnPropertyDescriptor(G4.prototype,"sockets"),G4.prototype),H4=S(G4.prototype,"_defaultArmatureIndexValue",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return n8.default}}),W4=S(G4.prototype,"_dragonAsset",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),X4=S(G4.prototype,"_dragonAtlasAsset",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),j4=S(G4.prototype,"_armatureName",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),Y4=S(G4.prototype,"_animationName",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),q4=S(G4.prototype,"_animationIndexValue",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),K4=S(G4.prototype,"_defaultCacheModeValue",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return a8.REALTIME}}),J4=S(G4.prototype,"_timeScale",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),Z4=S(G4.prototype,"_playTimes",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),Q4=S(G4.prototype,"_debugBones",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),$4=S(G4.prototype,"_enableBatch",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),t8=S(G4.prototype,"_sockets",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),S(G4.prototype,"customMaterial",[Ku,N4,L4,V4],Object.getOwnPropertyDescriptor(G4.prototype,"customMaterial"),G4.prototype),k4=G4))||k4)||k4)||k4)||k4);C.internal.ArmatureDisplay=_8;var f8,d8,p8,m8,g8,y8,v8,A8,S8,b8,T8,E8=new ki(255,0,0,255),C8=new ki(0,0,255,255),w8=new ki(0,255,0,255),x8=0,R8=0,I8=0,B8=0,D8=0,P8=0,M8=0,O8=0,F8=0,N8=new Float32Array(4),L8=new ji(0,0,0),V8=new hn,k8=null,G8=null;function U8(t,e){if(!t)return null;var i,n;switch(e){case 1:i=g8?jn.ONE:jn.SRC_ALPHA,n=jn.ONE;break;case 10:i=jn.DST_COLOR,n=jn.ONE_MINUS_SRC_ALPHA;break;case 12:i=jn.ONE,n=jn.ONE_MINUS_SRC_COLOR;break;case 0:default:i=g8?jn.ONE:jn.SRC_ALPHA,n=jn.ONE_MINUS_SRC_ALPHA}return b8.getMaterialForBlend(i,n)}function z8(t,e){var i=t.a*e*m8,n=g8?i/255:1,r=t.r*f8*n/255,s=t.g*d8*n/255,a=t.b*p8*n/255;N8[0]=r,N8[1]=s,N8[2]=a,N8[3]=g8?1:i/255}var H8=null,W8={accessor:H8,vCount:32767,ensureAccessor:function(){if(!H8){var t=BN.root.device,e=BN.root.batcher2D,i=ok;this.accessor=H8=new Sk(t,i,this.vCount),e.registerBufferAccessor(Number.parseInt("DRAGONBONES",36),H8)}return this.accessor},createData:function(t){var e=t.renderData;if(!e){this.ensureAccessor();for(var i=t._armature._slots,n=0,r=0,s=0;s0&&(b8._requestDrawData(k8,G8,F8,A),F8=P8),k8=n,G8=v.tex}R8=v.vertexCount,D8=v.indexCount,a=d.chunk.vertexOffset;for(var S=P8,b=P8+D8;S=f&&(z8(_=c[l++],1),f=_.vfOffset),p.set(N8,R+5);o+=u,I8+=R8,P8+=D8,R8=0,D8=0}}var B=P8-F8;G8&&B>0&&b8._requestDrawData(k8,G8,F8,B)}}}(t._curFrame,n);else{X8(e,1,n);var r=t._debugDraw;if(t.debugBones&&r){r.clear(),r.lineWidth=5,r.strokeColor=E8,r.fillColor=C8;for(var s=e.getBones(),a=0,o=s.length;a0&&(b8._requestDrawData(k8,G8,F8,d),F8=P8),G8=f,k8=r}z8(o,e),V8.set(h._worldMatrix),s=h._localVertices,R8=s.length/4,x8=9*R8,a=h._indices,D8=a.length;var p=!1;if(I8+R8>M8&&(M8=I8+R8,p=!0),P8+D8>O8&&(O8=P8+D8,p=!0),p){var m=A8,g=n.chunk.vertexOffset;n.resizeAndCopy(M8,O8>n.indexCount?O8:n.indexCount),S8=n.chunk.vb,O8>A8.length&&(A8=n.indices=new Uint16Array(O8));for(var y=n.chunk.vertexOffset-g,v=0;v0&&(b8._requestDrawData(k8,G8,F8,u),F8=P8),b8.maxIndexCount=0&&E.gpuDescriptors[C],x=null,R=0;if(w&&w.gpuBuffer){var I=w.gpuBuffer,B=S[T.set],D=B&&B[T.binding];D>=0&&(R=r[D]),"vf32"in I?x=I.vf32:(R+=I.offset,x=I.gpuBuffer.vf32),R>>=2}if(x)for(var P=T.glActiveUniforms.length,M=0;M=0&&It.gpuDescriptors[Bt],Pt=Rt.units.length,Mt=0;Mt0){var Ft=Dt.gpuTexture,Nt=l.glTexUnits[Ot];Nt.glTexture!==Ft.glTexture&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),Ft.glTexture?u.bindTexture(Ft.glTarget,Ft.glTexture):u.bindTexture(Ft.glTarget,t.nullTex2D.gpuTexture.glTexture),Nt.glTexture=Ft.glTexture);var Lt=Dt.gpuSampler;Ft.isPowerOf2?(a=Lt.glWrapS,o=Lt.glWrapT):(a=u.CLAMP_TO_EDGE,o=u.CLAMP_TO_EDGE),h=Ft.isPowerOf2?Ft.mipLevel<=1&&(Lt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Lt.glMinFilter===u.LINEAR_MIPMAP_LINEAR)?u.LINEAR:Lt.glMinFilter:Lt.glMinFilter===u.LINEAR||Lt.glMinFilter===u.LINEAR_MIPMAP_NEAREST||Lt.glMinFilter===u.LINEAR_MIPMAP_LINEAR?u.LINEAR:u.NEAREST,Ft.glWrapS!==a&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Ft.glTarget,u.TEXTURE_WRAP_S,a),Ft.glWrapS=a),Ft.glWrapT!==o&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Ft.glTarget,u.TEXTURE_WRAP_T,o),Ft.glWrapT=o),Ft.glMinFilter!==h&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Ft.glTarget,u.TEXTURE_MIN_FILTER,h),Ft.glMinFilter=h),Ft.glMagFilter!==Lt.glMagFilter&&(l.texUnit!==Ot&&(u.activeTexture(u.TEXTURE0+Ot),l.texUnit=Ot),u.texParameteri(Ft.glTarget,u.TEXTURE_MAG_FILTER,Lt.glMagFilter),Ft.glMagFilter=Lt.glMagFilter)}Dt=It.gpuDescriptors[++Bt]}else L("Sampler binding '"+Rt.name+"' at set "+Rt.set+" binding "+Rt.binding+" index "+Mt+" is not bounded")}}if(i&&c&&(_||y6.gpuInputAssembler!==i)){y6.gpuInputAssembler=i;var Vt=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var kt=t.extensions.OES_vertex_array_object,Gt=i.glVAOs.get(c.glProgram);if(!Gt){var Ut;Gt=kt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,Gt),kt.bindVertexArrayOES(Gt),u.bindBuffer(u.ARRAY_BUFFER,null),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var zt=c.glInputs.length,Ht=0;Ht=0&&(u.enableVertexAttribArray(oe),l.glEnabledAttribLocs[oe]=!0),l.glCurrentAttribLocs[oe]=!0,u.vertexAttribPointer(oe,ie.count,ie.glType,ie.isNormalized,ie.stride,he),Vt&&Vt.vertexAttribDivisorANGLE(oe,ie.isInstanced?1:0)}}}var ue=i.gpuIndexBuffer;ue&&l.glElementArrayBuffer!==ue.glBuffer&&(u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,ue.glBuffer),l.glElementArrayBuffer=ue.glBuffer);for(var le=0;le0){var f=e.firstIndex*h.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,f,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(h){if(e.indexCount>0){var d=e.firstIndex*h.stride;i.drawElements(o,e.indexCount,a.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var T6=new Array(s6.COUNT);function E6(t,e){T6.fill(0);for(var i=0;i0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var y,v=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,A=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,S=e[a++];y=d.width===_.width&&d.height===_.height?new u(S.buffer,S.byteOffset+m.buffOffset):w6(S,i.format,m.buffOffset,d,_),l?i.glInternalFmt===J8.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,A,0,y):r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,v,A,i.glFormat,y):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,v,A,i.glFormat,i.glType,y)}break;case r.TEXTURE_CUBE_MAP:for(var b=0;b0?T.buffStride:_.width,d.height=T.buffTexHeight>0?T.buffTexHeight:_.height;var C=T.texExtent.width+f.x===i.width>>E?T.texExtent.width:_.width,w=T.texExtent.height+f.y===i.height>>E?T.texExtent.height:_.height,x=T.texSubres.baseArrayLayer+T.texSubres.layerCount;for(o=T.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=s(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),I6=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(this._uniformBuffer=new Uint8Array(this._size)),this._gpuBuffer={usage:this._usage,memUsage:this._memUsage,size:this._size,stride:this._stride,buffer:null,vf32:null,indirects:new R6,glTarget:0,glBuffer:null},this._usage&Pn.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Fn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&Pn.VERTEX){e.glTarget=i.ARRAY_BUFFER;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),y6.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&Pn.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),y6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else e.usage&Pn.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&Pn.INDIRECT||e.usage&Pn.TRANSFER_DST||e.usage&Pn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(Q8.instance,this._gpuBuffer),Q8.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),y6.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),y6.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(Q8.instance,this._gpuBuffer),Q8.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Fn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Pn.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),y6.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null):e.usage&Pn.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),y6.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&Pn.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&Pn.INDIRECT||e.usage&Pn.TRANSFER_DST||e.usage&Pn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(Q8.instance,this._gpuBuffer),Q8.instance.memoryStatus.bufferSize-=e,Q8.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&Pn.INDIRECT?0:t.byteLength,g6(Q8.instance,this._gpuBuffer,t,0,i))},u(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(Ns),B6=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new ma(e);for(var i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o0){e.glBlocks=new Array(e.blocks.length);for(var v=0;v0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var I=0;It.capabilities.maxTextureSize&&q(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!Ts[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var l=0;l>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case In.R5G6B5:return e.RGB565;case In.RGB5A1:return e.RGB5_A1;case In.RGBA4:return e.RGBA4;case In.RGBA16F:return J8.RGBA16F_EXT;case In.RGBA32F:return J8.RGBA32F_EXT;case In.SRGB8_A8:return J8.SRGB8_ALPHA8_EXT;case In.DEPTH:return e.DEPTH_COMPONENT16;case In.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case Nn.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&q(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var y=0;y>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Nn.TEX2D,e.glTarget=i.TEXTURE_2D}}(Q8.instance,this._gpuTexture),Q8.instance.memoryStatus.textureSize+=this._size,this._viewInfo.texture=this,this._viewInfo.type=t.type,this._viewInfo.format=t.format,this._viewInfo.baseLevel=0,this._viewInfo.levelCount=t.levelCount,this._viewInfo.baseLayer=0,this._viewInfo.layerCount=t.layerCount)},i.destroy=function(){!this._isTextureView&&this._gpuTexture&&(function(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=Is(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Nn.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&q(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var l=0;l>1),r=Math.max(1,r>>1)}break;case Nn.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&q(9100,c,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var y=0;y>1),r=Math.max(1,r>>1)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Nn.TEX2D,e.glTarget=i.TEXTURE_2D}}}(Q8.instance,this._gpuTexture),Q8.instance.memoryStatus.textureSize-=n,Q8.instance.memoryStatus.textureSize+=this._size)}},i.initAsSwapchainTexture=function(t){var e=new Gr;e.format=t.format,e.usage=Ts[t.format].hasDepth?Ln.DEPTH_STENCIL_ATTACHMENT:Ln.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},u(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(ra),Y6="webglcontextlost";function q6(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;nt.capabilities.maxTextureSize&&q(9100,s,t.capabilities.maxTextureSize),e.samples===Gn.ONE){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_2D,e.mipLevel,e.glInternalFmt,n,r)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case Nn.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);if(l>t.capabilities.maxCubeMapTextureSize&&q(9100,l,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var c=t.stateCache.glTexUnits[t.stateCache.texUnit];if(c.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),c.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var _=0;_>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_CUBE_MAP,e.mipLevel,e.glInternalFmt,n,r)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Nn.TEX2D,e.glTarget=i.TEXTURE_2D}}function b7(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s=0&&S.gpuDescriptors[b];if(T&&T.gpuBuffer){var E=y[A.set],C=E&&E[A.binding],w=T.gpuBuffer.glOffset;C>=0&&(w+=r[C]),o.glBindUBOs[A.glBinding]===T.gpuBuffer.glBuffer&&o.glBindUBOOffsets[A.glBinding]===w||(w?a.bindBufferRange(a.UNIFORM_BUFFER,A.glBinding,T.gpuBuffer.glBuffer,w,T.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,A.glBinding,T.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[A.glBinding]=T.gpuBuffer.glBuffer,o.glBindUBOOffsets[A.glBinding]=w)}else L("Buffer binding '"+A.name+"' at set "+A.set+" binding "+A.binding+" is not bounded")}for(var x=h.glSamplerTextures.length,R=0;R=0&&B.gpuDescriptors[D],M=0;M0){F.glTexture!==V.glTexture&&(o.texUnit!==O&&(a.activeTexture(a.TEXTURE0+O),o.texUnit=O),V.glTexture?a.bindTexture(V.glTarget,V.glTexture):a.bindTexture(V.glTarget,t.nullTex2D.gpuTexture.glTexture),F.glTexture=V.glTexture);var U=P.gpuSampler.getGLSampler(t,k,G);o.glSamplerUnits[O]!==U&&(a.bindSampler(O,U),o.glSamplerUnits[O]=U)}P=B.gpuDescriptors[++D]}else L("Sampler binding '"+I.name+"' at set "+I.set+" binding "+I.binding+" index "+M+" is not bounded")}}if(i&&h&&(u||T7.gpuInputAssembler!==i))if(T7.gpuInputAssembler=i,t.extensions.useVAO){var z=i.glVAOs.get(h.glProgram);if(!z){var H;z=a.createVertexArray(),i.glVAOs.set(h.glProgram,z),a.bindVertexArray(z),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var W=0;W=0&&(a.enableVertexAttribArray(st),o.glEnabledAttribLocs[st]=!0),o.glCurrentAttribLocs[st]=!0,a.vertexAttribPointer(st,et.count,et.glType,et.isNormalized,et.stride,at),a.vertexAttribDivisor(st,et.isInstanced?1:0)}}}var ot=i.gpuIndexBuffer;ot&&o.glElementArrayBuffer!==ot.glBuffer&&(a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,ot.glBuffer),o.glElementArrayBuffer=ot.glBuffer);for(var ht=0;ht0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var _=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}var x7=new Array(h7.COUNT);function R7(t,e){x7.fill(0);for(var i=0;i0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var y,v=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,A=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,S=e[a++];y=d.width===_.width&&d.height===_.height?new u(S.buffer,S.byteOffset+m.buffOffset):B7(S,i.format,m.buffOffset,d,_),l?i.glInternalFmt!==Q6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,v,A,i.glFormat,y):r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,v,A,0,y):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,v,A,i.glFormat,i.glType,y)}break;case r.TEXTURE_2D_ARRAY:for(var b=0;b0?T.buffStride:_.width,d.height=T.buffTexHeight>0?T.buffTexHeight:_.height;var C=T.texExtent.width+f.x===i.width>>E?T.texExtent.width:_.width,w=T.texExtent.height+f.y===i.height>>E?T.texExtent.height:_.height,x=T.texSubres.baseArrayLayer+T.texSubres.layerCount;for(o=T.texSubres.baseArrayLayer;o0?D.buffStride:_.width,d.height=D.buffTexHeight>0?D.buffTexHeight:_.height;var M,O=D.texExtent.width+f.x===i.width>>P?D.texExtent.width:_.width,F=D.texExtent.height+f.y===i.height>>P?D.texExtent.height:_.height,N=e[a++];M=d.width===_.width&&d.height===_.height?new u(N.buffer,N.byteOffset+D.buffOffset):B7(N,i.format,D.buffOffset,d,_),l?i.glInternalFmt!==Q6.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,P,f.x,f.y,f.z,O,F,_.depth,i.glFormat,M):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,P,i.glInternalFmt,O,F,_.depth,0,M):r.texSubImage3D(r.TEXTURE_2D_ARRAY,P,f.x,f.y,f.z,O,F,_.depth,i.glFormat,i.glType,M)}break;case r.TEXTURE_CUBE_MAP:for(var L=0;L0?V.buffStride:_.width,d.height=V.buffTexHeight>0?V.buffTexHeight:_.height;var G=V.texExtent.width+f.x===i.width>>k?V.texExtent.width:_.width,U=V.texExtent.height+f.y===i.height>>k?V.texExtent.height:_.height,z=V.texSubres.baseArrayLayer+V.texSubres.layerCount;for(o=V.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=s(t);var e=new Int32Array(this._capacity),i=new Int32Array(this._capacity),n=new Int32Array(this._capacity);this.byteOffsets=new Int32Array(this._capacity),e.set(this.counts),i.set(this.offsets),n.set(this.instances),this.counts=e,this.offsets=i,this.instances=n}},t}(),M7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),T7.gpuInputAssembler=null,t.stateCache.glArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),t.stateCache.glArrayBuffer=e.glBuffer),i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null))}else if(e.usage&Pn.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),T7.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else if(e.usage&Pn.UNIFORM){e.glTarget=i.UNIFORM_BUFFER;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,t.stateCache.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),t.stateCache.glUniformBuffer=e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null)}else e.usage&Pn.INDIRECT||e.usage&Pn.TRANSFER_DST||e.usage&Pn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(t7.instance,this._gpuBuffer),t7.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),T7.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),T7.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null;break;case i.UNIFORM_BUFFER:i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(t7.instance,this._gpuBuffer),t7.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Fn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Pn.VERTEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),T7.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),n.glArrayBuffer=null):e.usage&Pn.INDEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),T7.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null):e.usage&Pn.UNIFORM?(t.stateCache.glUniformBuffer!==e.glBuffer&&i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null):(e.usage&Pn.INDIRECT||e.usage&Pn.TRANSFER_DST||e.usage&Pn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(t7.instance,this._gpuBuffer),t7.instance.memoryStatus.bufferSize-=e,t7.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&Pn.INDIRECT?0:t.byteLength,A7(t7.instance,this._gpuBuffer,t,0,i))},u(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(Ns),O7=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new ma(e);for(var i=0;i0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView.gpuTexture.width},set width(t){s=t},get height(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView.gpuTexture.height},set height(t){}},function(t,e){for(var i=0;i>o.baseLevel),e.height=Math.min(e.height,h.height>>o.baseLevel))}var u=e.gpuDepthStencilView;if(u){var l=u.gpuTexture,c=Ts[l.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;l.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,c,l.glTarget,l.glTexture,e.gpuDepthStencilView.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,c,n.RENDERBUFFER,l.glRenderbuffer),e.width=Math.min(e.width,l.width>>u.baseLevel),e.height=Math.min(e.height,l.height>>u.baseLevel)}n.drawBuffers(r);var _=n.checkFramebufferStatus(n.FRAMEBUFFER);if(_!==n.FRAMEBUFFER_COMPLETE)switch(_){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(t7.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=t7.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},u(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(Gs),V7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ri&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var B=0;B1&&(this._info.levelCount=Math.min(this._info.levelCount,e.getLevelCount(t,i)));var n=this._size;this._info.width=t,this._info.height=i,this._size=Is(this._info.format,this.width,this.height,this.depth,this._info.levelCount)*this._info.layerCount,!this._isTextureView&&this._gpuTexture&&(this._gpuTexture.width=t,this._gpuTexture.height=i,this._gpuTexture.size=this._size,function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Nn.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&q(9100,s,t.capabilities.maxTextureSize),e.samples===Gn.ONE){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else b7(t,e),S7(t,e)}else e.glRenderbuffer&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case Nn.CUBE:e.type=Nn.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);l>t.capabilities.maxCubeMapTextureSize&&q(9100,l,t.capabilities.maxTextureSize);var c=t.stateCache.glTexUnits[t.stateCache.texUnit];if(c.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),c.glTexture=e.glTexture),Ts[e.format].isCompressed)for(var _=0;_<6;++_){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else b7(t,e),S7(t,e);break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Nn.TEX2D,e.glTarget=i.TEXTURE_2D}}}(t7.instance,this._gpuTexture),t7.instance.memoryStatus.textureSize-=n,t7.instance.memoryStatus.textureSize+=this._size)}},i.initAsSwapchainTexture=function(t){var e=new Gr;e.format=t.format,e.usage=Ts[t.format].hasDepth?Ln.DEPTH_STENCIL_ATTACHMENT:Ln.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},u(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(ra),J7="webglcontextlost";function Z7(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n=0&&o<=1&&h>=0&&h<=1)return!0}return!1}C.WebGL2Device=t9;var i9=new _n,n9=new _n,r9=new _n,s9=new _n;function a9(t,e,i){for(var n=i.length,r=0;rr!=c>r&&n<(l-h)*(r-u)/(c-u)+h&&(i=!i)}return i}function h9(t,e,i,n){var r,s=i.x-e.x,a=i.y-e.y,o=s*s+a*a,h=((t.x-e.x)*s+(t.y-e.y)*a)/o;return r=n?o?h<0?e:h>1?i:i9.set(e.x+h*s,e.y+h*a):e:i9.set(e.x+h*s,e.y+h*a),s=t.x-r.x,a=t.y-r.y,Math.sqrt(s*s+a*a)}var u9=t("Intersection2D",(function(){}));u9.lineLine=e9,u9.lineRect=function(t,e,i){var n=i9.set(i.x,i.y),r=n9.set(i.x,i.yMax),s=r9.set(i.xMax,i.yMax),a=s9.set(i.xMax,i.y);return!!(e9(t,e,n,r)||e9(t,e,r,s)||e9(t,e,s,a)||e9(t,e,a,n))},u9.linePolygon=a9,u9.rectRect=function(t,e){var i=t.x,n=t.y,r=t.x+t.width,s=t.y+t.height,a=e.x,o=e.y,h=e.x+e.width,u=e.y+e.height;return i<=h&&r>=a&&n<=u&&s>=o},u9.rectPolygon=function(t,e){var i=i9.set(t.x,t.y),n=n9.set(t.x,t.yMax),r=r9.set(t.xMax,t.yMax),s=s9.set(t.xMax,t.y);if(a9(i,n,e))return!0;if(a9(n,r,e))return!0;if(a9(r,s,e))return!0;if(a9(s,i,e))return!0;for(var a=0,o=e.length;as+o&&(u=s+o),ra+h&&(l=a+h);var c=n-u,_=r-l;return Math.sqrt(c*c+_*_)<=i},u9.polygonPolygon=function(t,e){var i,n;for(i=0,n=t.length;i1?h=o/u:o=h*u;var l=o/2,c=h/2;if(t.rotation){var _=-l,f=-c,d=l,p=c,m=-Me(t.rotation),g=Math.cos(m),y=Math.sin(m);r[n]=_*g-f*y+s,r[n+1]=_*y+f*g+a,r[n+2]=0,r[n+9]=d*g-f*y+s,r[n+10]=d*y+f*g+a,r[n+11]=0,r[n+18]=_*g-p*y+s,r[n+19]=_*y+p*g+a,r[n+20]=0,r[n+27]=d*g-p*y+s,r[n+28]=d*y+p*g+a,r[n+29]=0}else r[n]=s-l,r[n+1]=a-c,r[n+2]=0,r[n+9]=s+l,r[n+10]=a-c,r[n+11]=0,r[n+18]=s-l,r[n+19]=a+c,r[n+20]=0,r[n+27]=s+l,r[n+28]=a+c,r[n+29]=0;ki.toArray(r,t.color,n+5),ki.toArray(r,t.color,n+14),ki.toArray(r,t.color,n+23),ki.toArray(r,t.color,n+32)},e.step=function(t){var e=this.sys.assembler,i=this.sys,n=i.node,r=this.particles;if(t=t>e.maxParticleDeltaTime?e.maxParticleDeltaTime:t,n.updateWorldTransform(),i.positionType===p9.FREE){this._worldRotation=function(t){for(var e=0,i=t;i;)e+=i.eulerAngles.z,i=i.parent;return e}(n);var s=n.worldMatrix;g9.x=s.m12,g9.y=s.m13}else i.positionType===p9.RELATIVE?(this._worldRotation=n.eulerAngles.z,g9.x=n.position.x,g9.y=n.position.y):this._worldRotation=0;if(this.active&&i.emissionRate){var a=1/i.emissionRate;for(r.lengtha;)this.emitParticle(g9),this.emitCounter-=a;this.elapsed+=t,-1!==i.duration&&i.durationthis.uvFilled&&this.updateUVs();for(var u=0;u0){if(i.emitterMode===d9.GRAVITY){var c=A9,_=y9,f=v9;(l.pos.x||l.pos.y)&&(_.set(l.pos),_.normalize()),f.set(_),_.multiplyScalar(l.radialAccel);var d=f.x;f.x=-f.y,f.y=d,f.multiplyScalar(l.tangentialAccel),c.set(_),c.add(f),c.add(i.gravity),c.multiplyScalar(t),l.dir.add(c),c.set(l.dir),c.multiplyScalar(t),l.pos.add(c)}else l.angle+=l.degreesPerSecond*t,l.radius+=l.deltaRadius*t,l.pos.x=-Math.cos(l.angle)*l.radius,l.pos.y=-Math.sin(l.angle)*l.radius;l.color.r+=l.deltaColor.r*t,l.color.g+=l.deltaColor.g*t,l.color.b+=l.deltaColor.b*t,l.color.a+=l.deltaColor.a*t,l.size+=l.deltaSize*t,l.size<0&&(l.size=0),l.rotation+=l.deltaRotation*t;var p=y9;p.set(l.pos),i.positionType!==p9.GROUPED&&p.add(l.startPos);var m=S9*u*4;this.updateParticleBuffer(l,p,o,m),++u}else{var g=r[u];u!==r.length-1&&(r[u]=r[r.length-1]),T9.put(g),r.length--,o.resize(o.vertexCount-4,o.indexCount-6)}}this.renderData.material=this.sys.getRenderMaterial(0),this.renderData.frame=this.sys._renderSpriteFrame,o.setRenderDrawInfoAttributes(),0!==r.length||this.active||this.readyToPlay||(this.finished=!0,i._finishedSimulation())},e.requestData=function(t,e){var i=this.renderData.indexCount;this.renderData.request(t,e);for(var n=this.renderData.indexCount/6,r=this.renderData.iData,s=i;s>>0;t=n}for(var r,s=1,a=0,o=t.length,h=0;0>>0}function o(e,i){this.index="number"==typeof i?i:0,this.i=0,this.buffer=e instanceof(s?Uint8Array:Array)?e:new(s?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&t(Error("invalid index")),this.buffer.length<=this.index&&this.f()}o.prototype.f=function(){var t,e=this.buffer,i=e.length,n=new(s?Uint8Array:Array)(i<<1);if(s)n.set(e);else for(t=0;t>>8&255]<<16|f[t>>>16&255]<<8|f[t>>>24&255])>>32-e:f[t]>>8-e),8>e+a)o=o<>e-n-1&1,8==++a&&(a=0,r[s++]=f[o],o=0,s===r.length&&(r=this.f()));r[s]=o,this.buffer=r,this.i=a,this.index=s},o.prototype.finish=function(){var t,e=this.buffer,i=this.index;return 0h;++h){for(var l=_=h,c=7,_=_>>>1;_;_>>>=1)l<<=1,l|=1&_,--c;u[h]=(l<>>0}var f=u;function d(t){this.buffer=new(s?Uint16Array:Array)(2*t),this.length=0}function p(t){var e,i,n,r,a,o,h,u,l,c=t.length,_=0,f=Number.POSITIVE_INFINITY;for(u=0;u_&&(_=t[u]),t[u]>=1;for(l=o;ls[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},d.prototype.pop=function(){var t,e,i,n,r,s=this.buffer;for(e=s[0],t=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;!((n=2*r+2)>=this.length)&&(n+2s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:t,value:e,length:this.length}};var g,y=2,v={NONE:0,r:1,j:y,N:3},A=[];for(g=0;288>g;g++)switch(i){case 143>=g:A.push([g+48,8]);break;case 255>=g:A.push([g-144+400,9]);break;case 279>=g:A.push([g-256+0,7]);break;case 287>=g:A.push([g-280+192,8]);break;default:t("invalid literal: "+g)}function S(t,e){this.length=t,this.G=e}function b(){var e=T;switch(i){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}m.prototype.n=function(){var n,r,a,h,u=this.input;switch(this.h){case 0:for(a=0,h=u.length;a>>8&255,g[v++]=255&_,g[v++]=_>>>8&255,s)g.set(f,v),v+=f.length,g=g.subarray(0,v);else{for(p=0,m=f.length;pK)for(;0K?K:138)>K-3&&Q=Q?(it[Z++]=17,it[Z++]=Q-3,nt[17]++):(it[Z++]=18,it[Z++]=Q-11,nt[18]++),K-=Q;else if(it[Z++]=et[Y],nt[et[Y]]++,3>--K)for(;0K?K:6)>K-3&&Qz;z++)j[z]=V[X[z]];for(M=19;4=T;T++)E=b(),C[T]=E[2]<<24|E[1]<<16|E[0];var w=s?new Uint32Array(C):C;function x(n,r){function a(e,n){var r,s,a,o,h=e.G,u=[],l=0;switch(r=w[e.length],u[l++]=65535&r,u[l++]=r>>16&255,u[l++]=r>>24,i){case 1===h:s=[0,h-1,0];break;case 2===h:s=[1,h-2,0];break;case 3===h:s=[2,h-3,0];break;case 4===h:s=[3,h-4,0];break;case 6>=h:s=[4,h-5,1];break;case 8>=h:s=[5,h-7,1];break;case 12>=h:s=[6,h-9,2];break;case 16>=h:s=[7,h-13,2];break;case 24>=h:s=[8,h-17,3];break;case 32>=h:s=[9,h-25,3];break;case 48>=h:s=[10,h-33,4];break;case 64>=h:s=[11,h-49,4];break;case 96>=h:s=[12,h-65,5];break;case 128>=h:s=[13,h-97,5];break;case 192>=h:s=[14,h-129,6];break;case 256>=h:s=[15,h-193,6];break;case 384>=h:s=[16,h-257,7];break;case 512>=h:s=[17,h-385,7];break;case 768>=h:s=[18,h-513,8];break;case 1024>=h:s=[19,h-769,8];break;case 1536>=h:s=[20,h-1025,9];break;case 2048>=h:s=[21,h-1537,9];break;case 3072>=h:s=[22,h-2049,10];break;case 4096>=h:s=[23,h-3073,10];break;case 6144>=h:s=[24,h-4097,11];break;case 8192>=h:s=[25,h-6145,11];break;case 12288>=h:s=[26,h-8193,12];break;case 16384>=h:s=[27,h-12289,12];break;case 24576>=h:s=[28,h-16385,13];break;case 32768>=h:s=[29,h-24577,13];break;default:t("invalid distance")}for(r=s,u[l++]=r[0],u[l++]=r[1],u[l++]=r[2],a=0,o=u.length;a=u;)A[u++]=0;for(u=0;29>=u;)b[u++]=0}for(A[256]=1,o=0,h=r.length;o=h){for(d&&a(d,-1),u=0,l=h-o;uR&&o+Rx&&(C=E,x=R),258===R)break}f=new S(x,o-C),d?d.length2*v[f-1]+A[f]&&(v[f]=2*v[f-1]+A[f]),b[f]=Array(v[f]),T[f]=Array(v[f]);for(_=0;_r[_]?(b[f][p]=m,T[f][p]=y,g+=2):(b[f][p]=r[_],T[f][p]=_,++_);E[f]=0,1===A[f]&&i(f)}for(a=S,o=0,h=n.length;o1<l&&t("undercommitted"),i=0,n=e.length;i>>=1;return o}function B(t,e){this.input=t,this.a=new(s?Uint8Array:Array)(32768),this.h=D.j;var i,n={};for(i in!e&&(e={})||"number"!=typeof e.compressionType||(this.h=e.compressionType),e)n[i]=e[i];n.outputBuffer=this.a,this.z=new m(this.input,n)}var D=v;function P(e,i){switch(this.k=[],this.l=32768,this.e=this.g=this.c=this.q=0,this.input=s?new Uint8Array(e):e,this.s=!1,this.m=O,this.B=!1,!i&&(i={})||(i.index&&(this.c=i.index),i.bufferSize&&(this.l=i.bufferSize),i.bufferType&&(this.m=i.bufferType),i.resize&&(this.B=i.resize)),this.m){case M:this.b=32768,this.a=new(s?Uint8Array:Array)(32768+this.l+258);break;case O:this.b=0,this.a=new(s?Uint8Array:Array)(this.l),this.f=this.J,this.t=this.H,this.o=this.I;break;default:t(Error("invalid inflate mode"))}}B.prototype.n=function(){var e,i,n,r,o,h,u,l=0;switch(u=this.a,e=lt){case lt:i=Math.LOG2E*Math.log(32768)-8;break;default:t(Error("invalid compression method"))}switch(n=i<<4|e,u[l++]=n,e){case lt:switch(this.h){case D.NONE:o=0;break;case D.r:o=1;break;case D.j:o=2;break;default:t(Error("unsupported compression type"))}break;default:t(Error("invalid compression method"))}return r=o<<6|0,u[l++]=r|31-(256*n+r)%31,h=a(this.input),this.z.b=l,l=(u=this.z.n()).length,s&&((u=new Uint8Array(u.buffer)).length<=l+4&&(this.a=new Uint8Array(u.length+4),this.a.set(u),u=this.a),u=u.subarray(0,l+4)),u[l++]=h>>24&255,u[l++]=h>>16&255,u[l++]=h>>8&255,u[l++]=255&h,u},r("Zlib.Deflate",B),r("Zlib.Deflate.compress",(function(t,e){return new B(t,e).n()})),r("Zlib.Deflate.CompressionType",D),r("Zlib.Deflate.CompressionType.NONE",D.NONE),r("Zlib.Deflate.CompressionType.FIXED",D.r),r("Zlib.Deflate.CompressionType.DYNAMIC",D.j);var M=0,O=1,F={D:M,C:O};P.prototype.p=function(){for(;!this.s;){var n=tt(this,3);switch(1&n&&(this.s=i),n>>>=1){case 0:var r=this.input,a=this.c,o=this.a,h=this.b,u=e,l=e,c=e,_=o.length,f=e;switch(this.e=this.g=0,(u=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (first byte)")),l=u,(u=r[a++])===e&&t(Error("invalid uncompressed block header: LEN (second byte)")),l|=u<<8,(u=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (first byte)")),c=u,(u=r[a++])===e&&t(Error("invalid uncompressed block header: NLEN (second byte)")),l===~(c|=u<<8)&&t(Error("invalid uncompressed block header: length verify")),a+l>r.length&&t(Error("input buffer is broken")),this.m){case M:for(;h+l>o.length;){if(l-=f=_-h,s)o.set(r.subarray(a,a+f),h),h+=f,a+=f;else for(;f--;)o[h++]=r[a++];this.b=h,o=this.f(),h=this.b}break;case O:for(;h+l>o.length;)o=this.f({v:2});break;default:t(Error("invalid inflate mode"))}if(s)o.set(r.subarray(a,a+l),h),h+=l,a+=l;else for(;l--;)o[h++]=r[a++];this.c=a,this.b=h,this.a=o;break;case 1:this.o(Z,$);break;case 2:it(this);break;default:t(Error("unknown BTYPE: "+n))}}return this.t()};var N,L,V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=s?new Uint16Array(V):V,G=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],U=s?new Uint16Array(G):G,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],H=s?new Uint8Array(z):z,W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],X=s?new Uint16Array(W):W,j=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Y=s?new Uint8Array(j):j,q=new(s?Uint8Array:Array)(288);for(N=0,L=q.length;N=N?8:255>=N?9:279>=N?7:8;var K,J,Z=p(q),Q=new(s?Uint8Array:Array)(30);for(K=0,J=Q.length;K>>n,i.e=a-n,i.c=h,r}function et(i,n){for(var r,s,a,o=i.g,h=i.e,u=i.input,l=i.c,c=n[0],_=n[1];h<_;)(r=u[l++])===e&&t(Error("input buffer is broken")),o|=r<>>16,i.g=o>>a,i.e=h-a,i.c=l,65535&s}function it(t){function e(t,e,i){var n,r,s,a;for(a=0;ar)n>=h&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(o=U[s=r-257],0=h&&(this.b=n,i=this.f(),n=this.b);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.I=function(t,e){var i=this.a,n=this.b;this.u=t;for(var r,s,a,o,h=i.length;256!==(r=et(this,t));)if(256>r)n>=h&&(h=(i=this.f()).length),i[n++]=r;else for(o=U[s=r-257],0h&&(h=(i=this.f()).length);o--;)i[n]=i[n++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},P.prototype.f=function(){var t,e,i=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(s)i.set(r.subarray(32768,i.length));else for(t=0,e=i.length;tt;++t)r[t]=r[n+t];return this.b=32768,r},P.prototype.J=function(t){var e,i,n,r=this.input.length/this.c+1|0,a=this.input,o=this.a;return t&&("number"==typeof t.v&&(r=t.v),"number"==typeof t.F&&(r+=t.F)),i=2>r?(n=(a.length-this.c)/this.u[2]/2*258|0)e&&(this.a.length=e),t=this.a),this.buffer=t},nt.prototype.p=function(){var e,i=this.input;return e=this.A.p(),this.c=this.A.c,this.M&&(i[this.c++]<<24|i[this.c++]<<16|i[this.c++]<<8|i[this.c++])>>>0!==a(e)&&t(Error("invalid adler-32 checksum")),e},r("Zlib.Inflate",nt),r("Zlib.Inflate.BufferType",F),F.ADAPTIVE=F.C,F.BLOCK=F.D,r("Zlib.Inflate.prototype.decompress",nt.prototype.p);var rt,st,at=new(s?Uint8Array:Array)(288);for(rt=0,st=at.length;rt=rt?8:255>=rt?9:279>=rt?7:8;p(at);var ot,ht,ut=new(s?Uint8Array:Array)(30);for(ot=0,ht=ut.length;ot=0?ns;s>=0?++n:--n)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:this.transparency.indexed=this.read(s);var u=255-this.transparency.indexed.length;if(u>0)for(r=0;u>=0?ru;u>=0?++r:--r)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(s)[0];break;case 2:this.transparency.rgb=this.read(s)}break;case"tEXt":var l=this.read(s),c=l.indexOf(0),_=String.fromCharCode.apply(String,l.slice(0,c));this.text[_]=String.fromCharCode.apply(String,l.slice(c+1));break;case"IEND":e&&this.animation.frames.push(e),this.colors=function(){switch(i.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this);var f=this.colorType;this.hasAlphaChannel=4===f||6===f;var d=this.colors+(this.hasAlphaChannel?1:0);return this.pixelBitlength=this.bits*d,this.colorSpace=function(){switch(i.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData instanceof Uint8Array||(this.imgData=new Uint8Array(this.imgData)));default:this.pos+=s}if(this.pos+=4,this.pos>this.data.length)throw new Error(Q(6017))}}var e=t.prototype;return e.read=function(t){var e=0,i=[];for(e=0;t>=0?et;t>=0?++e:--e)i.push(this.data[this.pos++]);return i},e.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},e.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},e.decodePixels=function(t){if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);t=new x9.Inflate(t,{index:0,verify:!1}).decompress();for(var e=this.pixelBitlength/8,i=e*this.width,n=new Uint8Array(i*this.height),r=t.length,s=0,a=0,o=0,h=0,u=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0,y=0,v=0,A=0,S=0,b=0,T=0;a>>8*(4-s)):r.push(n);else for(var a=0;a=8?-1!==["RATIONAL","SRATIONAL"].indexOf(e)?(r.push(this.getUint32(n+o)),r.push(this.getUint32(n+o+4))):W(8e3):r.push(this.getBytes(s,n+o))}return"ASCII"===e&&r.forEach((function(t,e,i){i[e]=String.fromCharCode(t)})),r},e.getBytes=function(t,e){if(t<=0)W(8001);else{if(t<=1)return this.getUint8(e);if(t<=2)return this.getUint16(e);if(t<=3)return this.getUint32(e)>>>8;if(t<=4)return this.getUint32(e);W(8002)}return 0},e.getBits=function(t,e,i){i=i||0;var n=e+Math.floor(i/8),r=i+t,s=32-t,a=0,o=0;return r<=0?W(6023):r<=8?(a=24+i,o=this.getUint8(n)):r<=16?(a=16+i,o=this.getUint16(n)):r<=32?(a=i,o=this.getUint32(n)):W(6022),{bits:o<>>s,byteOffset:n+Math.floor(r/8),bitOffset:r%8}},e.parseFileDirectory=function(t){var e=this.getUint16(t),i=[],n=0,r=0;for(n=t+2,r=0;r=0&&O<=127?g=O+1:O>=-127&&O<=-1?y=1-O:C=!0}else{for(var F=this.getUint8(A+b),N=0;N0)for(var ut=0;ut>4,i=(15&r)<<4|(s=P9[t.charCodeAt(h++)])>>2,n=(3&s)<<6|(a=P9[t.charCodeAt(h++)]),o.push(String.fromCharCode(e)),64!==s&&o.push(String.fromCharCode(i)),64!==a&&o.push(String.fromCharCode(n));return o.join("")},decodeAsArray:function(t,e){var i,n,r,s=this.decode(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a}},N9=function(t){this.data=t,this.debug=!1,this.gpflags=void 0,this.files=0,this.unzipped=[],this.buf32k=new Array(32768),this.bIdx=0,this.modeZIP=!1,this.bytepos=0,this.bb=1,this.bits=0,this.nameBuf=[],this.fileout=void 0,this.literalTree=new Array(N9.LITERALS),this.distanceTree=new Array(32),this.treepos=0,this.Places=null,this.len=0,this.fpos=new Array(17),this.fpos[0]=0,this.flens=void 0,this.fmax=void 0};N9.gunzip=function(t){return t.constructor===Array||t.constructor,new N9(t).gunzip()[0][0]},N9.HufNode=function(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1},N9.LITERALS=288,N9.NAMEMAX=256,N9.bitReverse=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],N9.cplens=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],N9.cplext=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],N9.cpdist=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],N9.cpdext=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],N9.border=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],N9.prototype.gunzip=function(){return this.outputArr=[],this.nextFile(),this.unzipped},N9.prototype.readByte=function(){return this.bits+=8,this.bytepos>=1,0===this.bb&&(this.bb=this.readByte(),t=1&this.bb,this.bb=this.bb>>1|128),t},N9.prototype.readBits=function(t){for(var e=0,i=t;i--;)e=e<<1|this.readBit();return t&&(e=N9.bitReverse[e]>>8-t),e},N9.prototype.flushBuffer=function(){this.bIdx=0},N9.prototype.addBuffer=function(t){this.buf32k[this.bIdx++]=t,this.outputArr.push(String.fromCharCode(t)),32768===this.bIdx&&(this.bIdx=0)},N9.prototype.IsPat=function(){for(;;){if(this.fpos[this.len]>=this.fmax)return-1;if(this.flens[this.fpos[this.len]]===this.len)return this.fpos[this.len]++;this.fpos[this.len]++}},N9.prototype.Rec=function(){var t,e=this.Places[this.treepos];if(17===this.len)return-1;if(this.treepos++,this.len++,(t=this.IsPat())>=0)e.b0=t;else if(e.b0=32768,this.Rec())return-1;if((t=this.IsPat())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=this.Places[this.treepos],e.jumppos=this.treepos,this.Rec())return-1;return this.len--,0},N9.prototype.CreateTree=function(t,e,i){var n;for(this.Places=t,this.treepos=0,this.flens=i,this.fmax=e,n=0;n<17;n++)this.fpos[n]=0;return this.len=0,this.Rec()?-1:0},N9.prototype.DecodeValue=function(t){for(var e,i,n=0,r=t[n];;)if(this.readBit()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(a=a<<1|this.readBit())>199?a=(a-=128)<<1|this.readBit():(a-=48)>143&&(a+=136):a+=256,a<256)this.addBuffer(a);else{if(256===a)break;for(a-=257,d=this.readBits(N9.cplext[a])+N9.cplens[a],a=N9.bitReverse[this.readBits(5)]>>3,N9.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(N9.cpdext[a]-8)<<8):p=this.readBits(N9.cpdext[a]),p+=N9.cpdist[a],a=0;ao)return this.flushBuffer(),1;for(_=i?c[i-1]:0;a--;)c[i++]=_}else{if(i+(a=17===a?3+this.readBits(3):11+this.readBits(7))>o)return this.flushBuffer(),1;for(;a--;)c[i++]=0}for(d=this.literalTree.length,i=0;i=256){var d,p;if(0==(a-=256))break;for(a--,d=this.readBits(N9.cplext[a])+N9.cplens[a],a=this.DecodeValue(this.distanceTree),N9.cpdext[a]>8?(p=this.readBits(8),p|=this.readBits(N9.cpdext[a]-8)<<8):p=this.readBits(N9.cpdext[a]),p+=N9.cpdist[a];d--;)s=this.buf32k[this.bIdx-p&32767],this.addBuffer(s)}else this.addBuffer(a)}}while(!t);return this.flushBuffer(),this.byteAlign(),0},N9.prototype.unzipFile=function(t){var e;for(this.gunzip(),e=0;e=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},Oet.unzipAsArray=function(t,e){e=e||1;var i,n,r,s=this.unzip(t),a=[];for(i=0,r=s.length/e;i=0;--n)a[i]+=s.charCodeAt(i*e+n)<<8*n;return a},function(t){t[t.JPG=0]="JPG",t[t.PNG=1]="PNG",t[t.TIFF=2]="TIFF",t[t.WEBP=3]="WEBP",t[t.PVR=4]="PVR",t[t.ETC=5]="ETC",t[t.S3TC=6]="S3TC",t[t.ATITC=7]="ATITC",t[t.TGA=8]="TGA",t[t.RAWDATA=9]="RAWDATA",t[t.UNKNOWN=10]="UNKNOWN"}(Met||(Met={}));var Net,Let,Vet,ket,Get,Uet,zet,Het,Wet,Xet,jet,Yet,qet,Ket,Jet,Zet=t("ParticleSystem2D",(L9=_u("cc.ParticleSystem2D"),V9=wu(),k9=Uu(),G9=Fu(),U9=qu(C9),z9=Uu(),H9=Fu(),W9=qu(lV),X9=Fu(),j9=Fu(),Y9=Fu(),q9=Fu(),K9=Fu(),J9=Fu(),Z9=Fu(),Q9=Fu(),$9=Pu(),ttt=Fu(),ett=Fu(),itt=Fu(),ntt=Fu(),rtt=Fu(),stt=Fu(),att=Fu(),ott=Fu(),htt=Fu(),utt=Fu(),ltt=Fu(),ctt=Fu(),_tt=Fu(),ftt=qu(p9),dtt=Fu(),ptt=Uu(),mtt=Fu(),gtt=qu(d9),ytt=Fu(),vtt=Fu(),Att=Fu(),Stt=Fu(),btt=Fu(),Ttt=Fu(),Ett=Fu(),Ctt=Fu(),wtt=Fu(),xtt=Fu(),Rtt=Fu(),Itt=Fu(),Btt=Fu(),Dtt=Fu(),Ptt=Fu(),Mtt=Uu(),Ott=Fu(),Ftt=Uu(),Ntt=Fu(),Ltt=Su("preview"),L9(Vtt=V9(Vtt=xu(Vtt=Cu((Pet=Det=function(t){function e(){var e;return A(e=t.call(this)||this,"duration",Gtt,g(e)),A(e,"emissionRate",Utt,g(e)),A(e,"life",ztt,g(e)),A(e,"lifeVar",Htt,g(e)),A(e,"angle",Wtt,g(e)),A(e,"angleVar",Xtt,g(e)),A(e,"startSize",jtt,g(e)),A(e,"startSizeVar",Ytt,g(e)),A(e,"endSize",qtt,g(e)),A(e,"endSizeVar",Ktt,g(e)),A(e,"startSpin",Jtt,g(e)),A(e,"startSpinVar",Ztt,g(e)),A(e,"endSpin",Qtt,g(e)),A(e,"endSpinVar",$tt,g(e)),A(e,"sourcePos",tet,g(e)),A(e,"posVar",eet,g(e)),A(e,"emitterMode",iet,g(e)),A(e,"gravity",net,g(e)),A(e,"speed",ret,g(e)),A(e,"speedVar",set,g(e)),A(e,"tangentialAccel",aet,g(e)),A(e,"tangentialAccelVar",oet,g(e)),A(e,"radialAccel",het,g(e)),A(e,"radialAccelVar",uet,g(e)),A(e,"rotationIsDir",cet,g(e)),A(e,"startRadius",_et,g(e)),A(e,"startRadiusVar",fet,g(e)),A(e,"endRadius",det,g(e)),A(e,"endRadiusVar",pet,g(e)),A(e,"rotatePerS",met,g(e)),A(e,"rotatePerSVar",get,g(e)),e.aspectRatio=1,A(e,"playOnLoad",yet,g(e)),A(e,"autoRemoveOnFinish",vet,g(e)),A(e,"_preview",Aet,g(e)),A(e,"_custom",bet,g(e)),A(e,"_file",Tet,g(e)),A(e,"_spriteFrame",Eet,g(e)),A(e,"_totalParticles",Cet,g(e)),A(e,"_startColor",wet,g(e)),A(e,"_startColorVar",xet,g(e)),A(e,"_endColor",Ret,g(e)),A(e,"_endColorVar",Iet,g(e)),A(e,"_positionType",Bet,g(e)),e._stopped=!0,e.initProperties(),e}c(e,t);var i=e.prototype;return i.onEnable=function(){t.prototype.onEnable.call(this),this._updateMaterial(),this._updatePositionType()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.autoRemoveOnFinish&&(this.autoRemoveOnFinish=!1),this._simulator.uvFilled=0,this._simulator.renderData&&this._assembler&&this._assembler.removeData(this._simulator.renderData)},i.initProperties=function(){this._previewTimer=null,this._focused=!1,this.aspectRatio=1,this._simulator=new E9(this)},i.onFocusInEditor=function(){this._focused=!0;for(var t=Fet(this.node),e=0;e=this.totalParticles},i._applyFile=function(){var t=this._file;if(t){if(!t)return void q(6029);if(!this.isValid)return;this._plistFile=t.nativeUrl,this._custom||(this._spriteFrame!==t.spriteFrame&&(this.spriteFrame=t.spriteFrame),this._initWithDictionary(t._nativeAsset)),this._spriteFrame?!this._renderSpriteFrame&&this._spriteFrame&&this._applySpriteFrame():t.spriteFrame?this.spriteFrame=t.spriteFrame:this._custom&&this._initTextureWithDictionary(t._nativeAsset)}},i._initTextureWithDictionary=function(t){var e,i=this;if(t.spriteFrameUuid){var n=t.spriteFrameUuid;dv.loadAny(n,(function(e,n){e?(t.spriteFrameUuid=void 0,i._initTextureWithDictionary(t),L(e)):i.spriteFrame=n}))}else{var r=Ll(this._plistFile,t.textureFileName||"");if(t.textureFileName)dv.loadRemote(r,(function(e,n){e?(t.textureFileName=void 0,i._initTextureWithDictionary(t),L(e)):i.spriteFrame=n?lV.createWithImage(n):lV.createWithImage(vv.get("white-texture"))}));else if(t.textureImageData){var s=t.textureImageData;if(!(s&&s.length>0))return!1;var a=dv.assets.get(r);if(!a){var o=Oet.unzipBase64AsArray(s,1);if(!o)return j(6030,this._file.name),!1;var h=(e=o).length>8&&137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]&&13===e[4]&&10===e[5]&&26===e[6]&&10===e[7]?Met.PNG:e.length>2&&(73===e[0]&&73===e[1]||77===e[0]&&77===e[1]||255===e[0]&&216===e[1])?Met.TIFF:Met.UNKNOWN;if(h!==Met.TIFF&&h!==Met.PNG)return j(6031,this._file.name),!1;var u=document.createElement("canvas");h===Met.PNG?new R9(o).render(u):(this._tiffReader||(this._tiffReader=new I9),this._tiffReader.parseTIFF(o,u)),a=new Tg(u),dv.assets.add(r,a)}a||j(6032,this._file.name),this.spriteFrame=a?lV.createWithImage(a):lV.createWithImage(vv.get("white-texture"))}}return!0},i._initWithDictionary=function(t){this.totalParticles=parseInt(t.maxParticles||0),this.life=parseFloat(t.particleLifespan||0),this.lifeVar=parseFloat(t.particleLifespanVariance||0);var e=t.emissionRate;this.emissionRate=e||Math.min(this.totalParticles/this.life,Number.MAX_VALUE),this.duration=parseFloat(t.duration||0),this._srcBlendFactor=parseInt(t.blendFuncSource||jn.SRC_ALPHA),this._dstBlendFactor=parseInt(t.blendFuncDestination||jn.ONE_MINUS_SRC_ALPHA);var i=this._startColor;i.r=255*parseFloat(t.startColorRed||0),i.g=255*parseFloat(t.startColorGreen||0),i.b=255*parseFloat(t.startColorBlue||0),i.a=255*parseFloat(t.startColorAlpha||0);var n=this._startColorVar;n.r=255*parseFloat(t.startColorVarianceRed||0),n.g=255*parseFloat(t.startColorVarianceGreen||0),n.b=255*parseFloat(t.startColorVarianceBlue||0),n.a=255*parseFloat(t.startColorVarianceAlpha||0);var r=this._endColor;r.r=255*parseFloat(t.finishColorRed||0),r.g=255*parseFloat(t.finishColorGreen||0),r.b=255*parseFloat(t.finishColorBlue||0),r.a=255*parseFloat(t.finishColorAlpha||0);var s=this._endColorVar;if(s.r=255*parseFloat(t.finishColorVarianceRed||0),s.g=255*parseFloat(t.finishColorVarianceGreen||0),s.b=255*parseFloat(t.finishColorVarianceBlue||0),s.a=255*parseFloat(t.finishColorVarianceAlpha||0),this.startSize=parseFloat(t.startParticleSize||0),this.startSizeVar=parseFloat(t.startParticleSizeVariance||0),this.endSize=parseFloat(t.finishParticleSize||0),this.endSizeVar=parseFloat(t.finishParticleSizeVariance||0),this.positionType=parseFloat(void 0!==t.positionType?t.positionType:p9.FREE),this.sourcePos.set(0,0),this.posVar.set(parseFloat(t.sourcePositionVariancex||0),parseFloat(t.sourcePositionVariancey||0)),this.angle=parseFloat(t.angle||0),this.angleVar=parseFloat(t.angleVariance||0),this.startSpin=parseFloat(t.rotationStart||0),this.startSpinVar=parseFloat(t.rotationStartVariance||0),this.endSpin=parseFloat(t.rotationEnd||0),this.endSpinVar=parseFloat(t.rotationEndVariance||0),this.emitterMode=parseInt(t.emitterType||d9.GRAVITY),this.emitterMode===d9.GRAVITY){this.gravity.set(parseFloat(t.gravityx||0),parseFloat(t.gravityy||0)),this.speed=parseFloat(t.speed||0),this.speedVar=parseFloat(t.speedVariance||0),this.radialAccel=parseFloat(t.radialAcceleration||0),this.radialAccelVar=parseFloat(t.radialAccelVariance||0),this.tangentialAccel=parseFloat(t.tangentialAcceleration||0),this.tangentialAccelVar=parseFloat(t.tangentialAccelVariance||0);var a=t.rotationIsDir||"";null!==a?(a=a.toString().toLowerCase(),this.rotationIsDir="true"===a||"1"===a):this.rotationIsDir=!1}else{if(this.emitterMode!==d9.RADIUS)return j(6009),!1;this.startRadius=parseFloat(t.maxRadius||0),this.startRadiusVar=parseFloat(t.maxRadiusVariance||0),this.endRadius=parseFloat(t.minRadius||0),this.endRadiusVar=parseFloat(t.minRadiusVariance||0),this.rotatePerS=parseFloat(t.rotatePerSecond||0),this.rotatePerSVar=parseFloat(t.rotatePerSecondVariance||0)}return this._initTextureWithDictionary(t),!0},i._syncAspect=function(){if(this._renderSpriteFrame){var t=this._renderSpriteFrame.rect;this.aspectRatio=t.width/t.height}},i._applySpriteFrame=function(){this._renderSpriteFrame=this._renderSpriteFrame||this._spriteFrame,this._renderSpriteFrame?this._renderSpriteFrame.texture&&(this._simulator.updateUVs(!0),this._syncAspect(),this._updateMaterial(),this._stopped=!1,this.markForUpdateRenderData()):this.resetSystem()},i._getTexture=function(){return this._renderSpriteFrame&&this._renderSpriteFrame.texture},i._updateMaterial=function(){var t=this.getMaterialInstance(0);t&&t.recompileShaders({USE_LOCAL:this._positionType!==p9.FREE}),t&&t.passes.length>0&&this._updateBlendFunc()},i._finishedSimulation=function(){this.resetSystem(),this.stopSystem(),this.markForUpdateRenderData(),this.autoRemoveOnFinish&&this._stopped&&this.node.destroy()},i._canRender=function(){return t.prototype._canRender.call(this)&&!this._stopped&&null!==this._renderSpriteFrame&&void 0!==this._renderSpriteFrame},i._render=function(t){this._positionType===p9.RELATIVE?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node.parent):this.positionType===p9.GROUPED?t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,this.node):t.commitComp(this,this._simulator.renderData,this._renderSpriteFrame,this._assembler,null)},i._updatePositionType=function(){this._positionType===p9.RELATIVE?(this._renderEntity.setRenderTransform(this.node.parent),this._renderEntity.setUseLocal(!0)):this.positionType===p9.GROUPED?(this._renderEntity.setRenderTransform(this.node),this._renderEntity.setUseLocal(!0)):(this._renderEntity.setRenderTransform(null),this._renderEntity.setUseLocal(!1))},u(e,[{key:"custom",get:function(){return this._custom},set:function(t){this._custom!==t&&(this._custom=t,this._applyFile())}},{key:"file",get:function(){return this._file},set:function(t){this._file!==t&&(this._file=t,t?this._applyFile():this.custom=!0)}},{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._renderSpriteFrame!==t&&(this._renderSpriteFrame=t,t&&!t._uuid||(this._spriteFrame=t),this._applySpriteFrame())}},{key:"particleCount",get:function(){return this._simulator.particles.length}},{key:"totalParticles",get:function(){return this._totalParticles},set:function(t){this._totalParticles!==t&&(this._totalParticles=t)}},{key:"startColor",get:function(){return this._startColor},set:function(t){this._startColor.r=t.r,this._startColor.g=t.g,this._startColor.b=t.b,this._startColor.a=t.a}},{key:"startColorVar",get:function(){return this._startColorVar},set:function(t){this._startColorVar.r=t.r,this._startColorVar.g=t.g,this._startColorVar.b=t.b,this._startColorVar.a=t.a}},{key:"color",get:function(){return this._color},set:function(){}},{key:"endColor",get:function(){return this._endColor},set:function(t){this._endColor.r=t.r,this._endColor.g=t.g,this._endColor.b=t.b,this._endColor.a=t.a}},{key:"endColorVar",get:function(){return this._endColorVar},set:function(t){this._endColorVar.r=t.r,this._endColorVar.g=t.g,this._endColorVar.b=t.b,this._endColorVar.a=t.a}},{key:"positionType",get:function(){return this._positionType},set:function(t){this._positionType=t,this._updateMaterial(),this._updatePositionType()}},{key:"preview",get:function(){return this._preview},set:function(t){t?this._startPreview():this._stopPreview(),this._preview=t}},{key:"stopped",get:function(){return this._stopped}},{key:"active",get:function(){return this._simulator.active}},{key:"assembler",get:function(){return this._assembler}}]),e}(zU),Det.EmitterMode=d9,Det.PositionType=p9,Det.DURATION_INFINITY=-1,Det.START_SIZE_EQUAL_TO_END_SIZE=-1,Det.START_RADIUS_EQUAL_TO_END_RADIUS=-1,S((ktt=Pet).prototype,"custom",[Du,k9,G9],Object.getOwnPropertyDescriptor(ktt.prototype,"custom"),ktt.prototype),S(ktt.prototype,"file",[U9,z9,H9],Object.getOwnPropertyDescriptor(ktt.prototype,"file"),ktt.prototype),S(ktt.prototype,"spriteFrame",[W9,X9],Object.getOwnPropertyDescriptor(ktt.prototype,"spriteFrame"),ktt.prototype),S(ktt.prototype,"totalParticles",[Du,j9],Object.getOwnPropertyDescriptor(ktt.prototype,"totalParticles"),ktt.prototype),Gtt=S(ktt.prototype,"duration",[Au,Du,Y9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),Utt=S(ktt.prototype,"emissionRate",[Au,Du,q9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 10}}),ztt=S(ktt.prototype,"life",[Au,Du,K9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),Htt=S(ktt.prototype,"lifeVar",[Au,Du,J9],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),S(ktt.prototype,"startColor",[Du,Z9],Object.getOwnPropertyDescriptor(ktt.prototype,"startColor"),ktt.prototype),S(ktt.prototype,"startColorVar",[Du,Q9],Object.getOwnPropertyDescriptor(ktt.prototype,"startColorVar"),ktt.prototype),S(ktt.prototype,"color",[$9],Object.getOwnPropertyDescriptor(ktt.prototype,"color"),ktt.prototype),S(ktt.prototype,"endColor",[Du,ttt],Object.getOwnPropertyDescriptor(ktt.prototype,"endColor"),ktt.prototype),S(ktt.prototype,"endColorVar",[Du,ett],Object.getOwnPropertyDescriptor(ktt.prototype,"endColorVar"),ktt.prototype),Wtt=S(ktt.prototype,"angle",[Au,Du,itt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 90}}),Xtt=S(ktt.prototype,"angleVar",[Au,Du,ntt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 20}}),jtt=S(ktt.prototype,"startSize",[Au,Du,rtt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 50}}),Ytt=S(ktt.prototype,"startSizeVar",[Au,Du,stt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),qtt=S(ktt.prototype,"endSize",[Au,Du,att],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Ktt=S(ktt.prototype,"endSizeVar",[Au,Du,ott],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Jtt=S(ktt.prototype,"startSpin",[Au,Du,htt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Ztt=S(ktt.prototype,"startSpinVar",[Au,Du,utt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Qtt=S(ktt.prototype,"endSpin",[Au,Du,ltt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),$tt=S(ktt.prototype,"endSpinVar",[Au,Du,ctt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),tet=S(ktt.prototype,"sourcePos",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return _n.ZERO.clone()}}),eet=S(ktt.prototype,"posVar",[Au,Du,_tt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return _n.ZERO.clone()}}),S(ktt.prototype,"positionType",[ftt,dtt],Object.getOwnPropertyDescriptor(ktt.prototype,"positionType"),ktt.prototype),S(ktt.prototype,"preview",[Du,ptt,mtt],Object.getOwnPropertyDescriptor(ktt.prototype,"preview"),ktt.prototype),iet=S(ktt.prototype,"emitterMode",[Au,Du,gtt,ytt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return d9.GRAVITY}}),net=S(ktt.prototype,"gravity",[Au,Du,vtt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return _n.ZERO.clone()}}),ret=S(ktt.prototype,"speed",[Au,Du,Att],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 180}}),set=S(ktt.prototype,"speedVar",[Au,Du,Stt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 50}}),aet=S(ktt.prototype,"tangentialAccel",[Au,Du,btt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 80}}),oet=S(ktt.prototype,"tangentialAccelVar",[Au,Du,Ttt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),het=S(ktt.prototype,"radialAccel",[Au,Du,Ett],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),uet=S(ktt.prototype,"radialAccelVar",[Au,Du,Ctt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),cet=S(ktt.prototype,"rotationIsDir",[Au,Du,wtt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),_et=S(ktt.prototype,"startRadius",[Au,Du,xtt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fet=S(ktt.prototype,"startRadiusVar",[Au,Du,Rtt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),det=S(ktt.prototype,"endRadius",[Au,Du,Itt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),pet=S(ktt.prototype,"endRadiusVar",[Au,Du,Btt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),met=S(ktt.prototype,"rotatePerS",[Au,Du,Dtt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),get=S(ktt.prototype,"rotatePerSVar",[Au,Du,Ptt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),yet=S(ktt.prototype,"playOnLoad",[Au,Du,Mtt,Ott],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),vet=S(ktt.prototype,"autoRemoveOnFinish",[Au,Du,Ftt,Ntt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Aet=S(ktt.prototype,"_preview",[Ltt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),bet=S(ktt.prototype,"_custom",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Tet=S(ktt.prototype,"_file",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Eet=S(ktt.prototype,"_spriteFrame",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Cet=S(ktt.prototype,"_totalParticles",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 150}}),wet=S(ktt.prototype,"_startColor",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ki(255,255,255,255)}}),xet=S(ktt.prototype,"_startColorVar",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ki(0,0,0,0)}}),Ret=S(ktt.prototype,"_endColor",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ki(255,255,255,0)}}),Iet=S(ktt.prototype,"_endColorVar",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ki(0,0,0,0)}}),Bet=S(ktt.prototype,"_positionType",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return p9.FREE}}),Vtt=ktt))||Vtt)||Vtt)||Vtt)||Vtt)),Qet=function(){function t(t,e){this.point=new _n,this.dir=new _n,this.distance=0,this.time=0,t&&this.point.set(t),e&&this.dir.set(e)}var e=t.prototype;return e.setPoint=function(t,e){this.point.x=t,this.point.y=e},e.setDir=function(t,e){this.dir.x=t,this.dir.y=e},t}(),$et=t("MotionStreak",(Net=_u("cc.MotionStreak"),Let=wu(),Vet=Bu(),ket=qu(Kg),Net(Get=Cu(Get=xu(Get=Let(Get=Vet((Ket=qet=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1){var h=o[0],u=h.point.x-s,l=h.point.y-a;u*u+l*l=0;T--){var E=o[T],C=E.point,w=E.dir;if(E.time-=e,E.time<0)o.splice(T,1);else{var x=E.time/S,R=o[T-1];if(!b){if(!R){o.splice(T,1);continue}C.x=R.point.x-w.x*x,C.y=R.point.y-w.y*x}b=!0,iit(tit,w);var I=(x*y<<24>>>0)+(g<<16)+(m<<8)+p,B=_;A[B].x=C.x+tit.x*n,A[B].y=C.y+tit.y*n,A[B].u=1,A[B].v=x,A[B].color._val=I,A[B+=1].x=C.x-tit.x*n,A[B].y=C.y-tit.y*n,A[B].u=0,A[B].v=x,A[B].color._val=I,_+=2}}c=_<=2?0:3*(_-2),f.resize(_,c)}},updateWorldVertexAllData:function(t){for(var e=t.renderData,i=e.floatStride,n=e.data,r=e.chunk.vb,s=0;s1?e-1:0),n=1;ne?t:e}function at(t,e,i){return ti?i:t}function ot(t,e){var i=t[0];t[0]=e[0],e[0]=i}var ht=isFinite;function ut(t){return t*t}function lt(t){return 1/Math.sqrt(t)}var ct=Math.sqrt,_t=Math.pow;function ft(t){return t*tt}function dt(t){return t*et}var pt=Math.cos,mt=Math.sin,gt=Math.acos,yt=Math.asin,vt=Math.atan2;function At(t){return t|=t>>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,1+((t|=t>>8&16777215)|t>>16&65535)}function St(t){return t>0&&0==(t&t-1)}function bt(){return 2*Math.random()-1}function Tt(t,e){return(e-t)*Math.random()+t}var Et=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;i=r){var e=1/t;this.x*=e,this.y*=e}return t},e.SelfNormalize=function(){var t=this.Length();if(t>=r){var e=1/t;this.x*=e,this.y*=e}return this},e.SelfRotate=function(t){var e=Math.cos(t),i=Math.sin(t),n=this.x;return this.x=e*n-i*this.y,this.y=i*n+e*this.y,this},e.SelfRotateCosSin=function(t,e){var i=this.x;return this.x=t*i-e*this.y,this.y=e*i+t*this.y,this},e.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)},e.SelfCrossVS=function(t){var e=this.x;return this.x=t*this.y,this.y=-t*e,this},e.SelfCrossSV=function(t){var e=this.x;return this.x=-t*this.y,this.y=t*e,this},e.SelfMinV=function(t){return this.x=rt(this.x,t.x),this.y=rt(this.y,t.y),this},e.SelfMaxV=function(t){return this.x=st(this.x,t.x),this.y=st(this.y,t.y),this},e.SelfAbs=function(){return this.x=nt(this.x),this.y=nt(this.y),this},e.SelfNeg=function(){return this.x=-this.x,this.y=-this.y,this},e.SelfSkew=function(){var t=this.x;return this.x=-this.y,this.y=t,this},t.MakeArray=function(e){return Z(e,(function(){return new t}))},t.AbsV=function(t,e){return e.x=nt(t.x),e.y=nt(t.y),e},t.MinV=function(t,e,i){return i.x=rt(t.x,e.x),i.y=rt(t.y,e.y),i},t.MaxV=function(t,e,i){return i.x=st(t.x,e.x),i.y=st(t.y,e.y),i},t.ClampV=function(t,e,i,n){return n.x=at(t.x,e.x,i.x),n.y=at(t.y,e.y,i.y),n},t.RotateV=function(t,e,i){var n=t.x,r=t.y,s=Math.cos(e),a=Math.sin(e);return i.x=s*n-a*r,i.y=a*n+s*r,i},t.DotVV=function(t,e){return t.x*e.x+t.y*e.y},t.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},t.CrossVS=function(t,e,i){var n=t.x;return i.x=e*t.y,i.y=-e*n,i},t.CrossVOne=function(t,e){var i=t.x;return e.x=t.y,e.y=-i,e},t.CrossSV=function(t,e,i){var n=e.x;return i.x=-t*e.y,i.y=t*n,i},t.CrossOneV=function(t,e){var i=t.x;return e.x=-t.y,e.y=i,e},t.AddVV=function(t,e,i){return i.x=t.x+e.x,i.y=t.y+e.y,i},t.SubVV=function(t,e,i){return i.x=t.x-e.x,i.y=t.y-e.y,i},t.MulSV=function(t,e,i){return i.x=e.x*t,i.y=e.y*t,i},t.MulVS=function(t,e,i){return i.x=t.x*e,i.y=t.y*e,i},t.AddVMulSV=function(t,e,i,n){return n.x=t.x+e*i.x,n.y=t.y+e*i.y,n},t.SubVMulSV=function(t,e,i,n){return n.x=t.x-e*i.x,n.y=t.y-e*i.y,n},t.AddVCrossSV=function(t,e,i,n){var r=i.x;return n.x=t.x-e*i.y,n.y=t.y+e*r,n},t.MidVV=function(t,e,i){return i.x=.5*(t.x+e.x),i.y=.5*(t.y+e.y),i},t.ExtVV=function(t,e,i){return i.x=.5*(e.x-t.x),i.y=.5*(e.y-t.y),i},t.IsEqualToV=function(t,e){return t.x===e.x&&t.y===e.y},t.DistanceVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.DistanceSquaredVV=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.NegV=function(t,e){return e.x=-t.x,e.y=-t.y,e},u(t,[{key:"x",get:function(){return this.data[0]},set:function(t){this.data[0]=t}},{key:"y",get:function(){return this.data[1]},set:function(t){this.data[1]=t}}]),t}();Et.ZERO=new Et(0,0),Et.UNITX=new Et(1,0),Et.UNITY=new Et(0,1),Et.s_t0=new Et,Et.s_t1=new Et,Et.s_t2=new Et,Et.s_t3=new Et;var Ct=new Et(0,0),wt=function(){function t(){for(var t=arguments.length,e=new Array(t),i=0;ithis.m_count&&(this.m_min_count=this.m_count)},t}(),Lt=function(){function t(t){this.m_stack=[],this.m_count=0,this.m_stack=Z(t,(function(){return null})),this.m_count=0}var e=t.prototype;return e.Reset=function(){return this.m_count=0,this},e.Push=function(t){this.m_stack[this.m_count]=t,this.m_count++},e.Pop=function(){this.m_count--;var t=this.m_stack[this.m_count];if(this.m_stack[this.m_count]=null,null===t)throw new Error;return t},e.GetCount=function(){return this.m_count},t}(),Vt=function(){},kt=function(){},Gt=function(){function t(){this.m_buffer=Et.MakeArray(2),this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0}var e=t.prototype;return e.Copy=function(t){return t.m_vertices===t.m_buffer?(this.m_vertices=this.m_buffer,this.m_buffer[0].Copy(t.m_buffer[0]),this.m_buffer[1].Copy(t.m_buffer[1])):this.m_vertices=t.m_vertices,this.m_count=t.m_count,this.m_radius=t.m_radius,this},e.Reset=function(){return this.m_vertices=this.m_buffer,this.m_count=0,this.m_radius=0,this},e.SetShape=function(t,e){t.SetupDistanceProxy(this,e)},e.SetVerticesRadius=function(t,e,i){this.m_vertices=t,this.m_count=e,this.m_radius=i},e.GetSupport=function(t){for(var e=0,i=Et.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return e},e.GetSupportVertex=function(t){for(var e=0,i=Et.DotVV(this.m_vertices[0],t),n=1;ni&&(e=n,i=r)}return this.m_vertices[e]},e.GetVertexCount=function(){return this.m_count},e.GetVertex=function(t){return this.m_vertices[t]},t}(),Ut=function(){function t(){this.metric=0,this.count=0,this.indexA=[0,0,0],this.indexB=[0,0,0]}return t.prototype.Reset=function(){return this.metric=0,this.count=0,this},t}(),zt=function(){function t(){this.proxyA=new Gt,this.proxyB=new Gt,this.transformA=new Bt,this.transformB=new Bt,this.useRadii=!1}return t.prototype.Reset=function(){return this.proxyA.Reset(),this.proxyB.Reset(),this.transformA.SetIdentity(),this.transformB.SetIdentity(),this.useRadii=!1,this},t}(),Ht=function(){function t(){this.pointA=new Et,this.pointB=new Et,this.distance=0,this.iterations=0}return t.prototype.Reset=function(){return this.pointA.SetZero(),this.pointB.SetZero(),this.distance=0,this.iterations=0,this},t}(),Wt=function(){this.proxyA=new Gt,this.proxyB=new Gt,this.transformA=new Bt,this.transformB=new Bt,this.translationB=new Et},Xt=function(){this.point=new Et,this.normal=new Et,this.lambda=0,this.iterations=0};function jt(){t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0}t.b2_gjkCalls=0,t.b2_gjkIters=0,t.b2_gjkMaxIters=0;var Yt=function(){function t(){this.wA=new Et,this.wB=new Et,this.w=new Et,this.a=0,this.indexA=0,this.indexB=0}return t.prototype.Copy=function(t){return this.wA.Copy(t.wA),this.wB.Copy(t.wB),this.w.Copy(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB,this},t}(),qt=function(){function t(){this.m_v1=new Yt,this.m_v2=new Yt,this.m_v3=new Yt,this.m_vertices=[],this.m_count=0,this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}var e=t.prototype;return e.ReadCache=function(t,e,i,n,s){this.m_count=t.count;for(var a=this.m_vertices,o=0;o1){var c=t.metric,_=this.GetMetric();(_<.5*c||2*c<_||_0?Et.CrossOneV(e,t):Et.CrossVOne(e,t);default:return t.SetZero()}},e.GetClosestPoint=function(t){switch(this.m_count){case 0:return t.SetZero();case 1:return t.Copy(this.m_v1.w);case 2:return t.Set(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);case 3:default:return t.SetZero()}},e.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:break;case 1:t.Copy(this.m_v1.wA),e.Copy(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,e.y=t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y}},e.GetMetric=function(){switch(this.m_count){case 0:case 1:return 0;case 2:return Et.DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return Et.CrossVV(Et.SubVV(this.m_v2.w,this.m_v1.w,Et.s_t0),Et.SubVV(this.m_v3.w,this.m_v1.w,Et.s_t1));default:return 0}},e.Solve2=function(){var e=this.m_v1.w,i=this.m_v2.w,n=Et.SubVV(i,e,t.s_e12),r=-Et.DotVV(e,n);if(r<=0)return this.m_v1.a=1,void(this.m_count=1);var s=Et.DotVV(i,n);if(s<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);var a=1/(s+r);this.m_v1.a=s*a,this.m_v2.a=r*a,this.m_count=2},e.Solve3=function(){var e=this.m_v1.w,i=this.m_v2.w,n=this.m_v3.w,r=Et.SubVV(i,e,t.s_e12),s=Et.DotVV(e,r),a=Et.DotVV(i,r),o=-s,h=Et.SubVV(n,e,t.s_e13),u=Et.DotVV(e,h),l=Et.DotVV(n,h),c=-u,_=Et.SubVV(n,i,t.s_e23),f=Et.DotVV(i,_),d=Et.DotVV(n,_),p=-f,m=Et.CrossVV(r,h),g=m*Et.CrossVV(i,n),y=m*Et.CrossVV(n,e),v=m*Et.CrossVV(e,i);if(o<=0&&c<=0)return this.m_v1.a=1,void(this.m_count=1);if(a>0&&o>0&&v<=0){var A=1/(a+o);return this.m_v1.a=a*A,this.m_v2.a=o*A,void(this.m_count=2)}if(l>0&&c>0&&y<=0){var S=1/(l+c);return this.m_v1.a=l*S,this.m_v3.a=c*S,this.m_count=2,void this.m_v2.Copy(this.m_v3)}if(a<=0&&p<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v2);if(l<=0&&d<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Copy(this.m_v3);if(d>0&&p>0&&g<=0){var b=1/(d+p);return this.m_v2.a=d*b,this.m_v3.a=p*b,this.m_count=2,void this.m_v1.Copy(this.m_v3)}var T=1/(g+y+v);this.m_v1.a=g*T,this.m_v2.a=y*T,this.m_v3.a=v*T,this.m_count=3},t}();qt.s_e12=new Et,qt.s_e13=new Et,qt.s_e23=new Et;var Kt=new qt,Jt=[0,0,0],Zt=[0,0,0],Qt=new Et,$t=new Et,te=new Et,ee=new Et,ie=new Et;function ne(e,i,n){++t.b2_gjkCalls;var a=n.proxyA,o=n.proxyB,h=n.transformA,u=n.transformB,l=Kt;l.ReadCache(i,a,h,o,u);for(var c=l.m_vertices,_=20,f=Jt,d=Zt,p=0,m=0;m<_;){p=l.m_count;for(var g=0;gb+T&&e.distance>r){e.distance-=b+T;var E=Et.SubVV(e.pointB,e.pointA,te);E.Normalize(),e.pointA.SelfMulAdd(b,E),e.pointB.SelfMulSub(T,E)}else{var C=Et.MidVV(e.pointA,e.pointB,Qt);e.pointA.Copy(C),e.pointB.Copy(C),e.distance=0}}}var re,se=new Et,ae=new qt,oe=new Et,he=new Et,ue=new Et,le=new Et,ce=new Et,_e=new Et;function fe(t,e){t.iterations=0,t.lambda=1,t.normal.SetZero(),t.point.SetZero();var i=e.proxyA,n=e.proxyB,r=st(i.m_radius,m)+st(n.m_radius,m),s=e.transformA,a=e.transformB,o=e.translationB,h=se.Set(0,0),u=0,l=ae;l.m_count=0;for(var c=l.m_vertices,_=i.GetSupport(It.MulTRV(s.q,Et.NegV(o,Et.s_t1),Et.s_t0)),d=Bt.MulXV(s,i.GetVertex(_),oe),p=n.GetSupport(It.MulTRV(a.q,o,Et.s_t0)),g=Bt.MulXV(a,n.GetVertex(p),he),y=Et.SubVV(d,g,ue),v=st(m,r-m),A=.5*f,S=20,b=0;bA;){t.iterations+=1,_=i.GetSupport(It.MulTRV(s.q,Et.NegV(y,Et.s_t1),Et.s_t0)),d=Bt.MulXV(s,i.GetVertex(_),oe),p=n.GetSupport(It.MulTRV(a.q,y,Et.s_t0)),g=Bt.MulXV(a,n.GetVertex(p),he);var T=Et.SubVV(d,g,le);y.Normalize();var E=Et.DotVV(y,T),C=Et.DotVV(y,o);if(E-v>u*C){if(C<=0)return!1;if((u=(E-v)/C)>1)return!1;h.Copy(y).SelfNeg(),l.m_count=0}var w=c[l.m_count];switch(w.indexA=p,w.wA.Copy(g).SelfMulAdd(u,o),w.indexB=_,w.wB.Copy(d),w.w.Copy(w.wB).SelfSub(w.wA),w.a=1,l.m_count+=1,l.m_count){case 1:break;case 2:l.Solve2();break;case 3:l.Solve3()}if(3===l.m_count)return!1;l.GetClosestPoint(y),++b}var x=ce,R=_e;return l.GetWitnessPoints(x,R),y.LengthSquared()>0&&(h.Copy(y).SelfNeg(),h.Normalize()),t.normal.Copy(h),t.lambda=u,t.iterations=b,!0}(re=t.b2ContactFeatureType||(t.b2ContactFeatureType={}))[re.e_vertex=0]="e_vertex",re[re.e_face=1]="e_face";var de,pe=function(){function t(){this._key=0,this._key_invalid=!1,this._indexA=0,this._indexB=0,this._typeA=0,this._typeB=0}return u(t,[{key:"key",get:function(){return this._key_invalid&&(this._key_invalid=!1,this._key=this._indexA|this._indexB<<8|this._typeA<<16|this._typeB<<24),this._key},set:function(t){this._key=t,this._key_invalid=!1,this._indexA=255&this._key,this._indexB=this._key>>8&255,this._typeA=this._key>>16&255,this._typeB=this._key>>24&255}},{key:"indexA",get:function(){return this._indexA},set:function(t){this._indexA=t,this._key_invalid=!0}},{key:"indexB",get:function(){return this._indexB},set:function(t){this._indexB=t,this._key_invalid=!0}},{key:"typeA",get:function(){return this._typeA},set:function(t){this._typeA=t,this._key_invalid=!0}},{key:"typeB",get:function(){return this._typeB},set:function(t){this._typeB=t,this._key_invalid=!0}}]),t}(),me=function(){function t(){this.cf=new pe}var e=t.prototype;return e.Copy=function(t){return this.key=t.key,this},e.Clone=function(){return(new t).Copy(this)},u(t,[{key:"key",get:function(){return this.cf.key},set:function(t){this.cf.key=t}}]),t}(),ge=function(){function t(){this.localPoint=new Et,this.normalImpulse=0,this.tangentImpulse=0,this.id=new me}t.MakeArray=function(e){return Z(e,(function(){return new t}))};var e=t.prototype;return e.Reset=function(){this.localPoint.SetZero(),this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},e.Copy=function(t){return this.localPoint.Copy(t.localPoint),this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.Copy(t.id),this},t}();(de=t.b2ManifoldType||(t.b2ManifoldType={}))[de.e_unknown=-1]="e_unknown",de[de.e_circles=0]="e_circles",de[de.e_faceA=1]="e_faceA",de[de.e_faceB=2]="e_faceB";var ye,ve=function(){function e(){this.points=ge.MakeArray(o),this.localNormal=new Et,this.localPoint=new Et,this.type=t.b2ManifoldType.e_unknown,this.pointCount=0}var i=e.prototype;return i.Reset=function(){for(var e=0;es&&Et.SubVV(u,h,this.normal).SelfNormalize();var l=Et.AddVMulSV(h,r,this.normal,e.Initialize_s_cA),c=Et.SubVMulSV(u,o,this.normal,e.Initialize_s_cB);Et.MidVV(l,c,this.points[0]),this.separations[0]=Et.DotVV(Et.SubVV(c,l,Et.s_t0),this.normal);break;case t.b2ManifoldType.e_faceA:It.MulRV(n.q,i.localNormal,this.normal);for(var _=Bt.MulXV(n,i.localPoint,e.Initialize_s_planePoint),f=0;fp){var g=d;d=p,p=g,m=1}if(d>i&&(_.x=m,_.y=0,i=d),i>(s=rt(s,p)))return!1}if(cA){var b=v;v=A,A=b,S=1}if(v>i&&(_.x=0,_.y=S,i=v),i>(s=rt(s,A)))return!1}return!(i<0||e.maxFraction0;){var n=i.Pop();if(null!==n&&n.aabb.TestOverlap(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.QueryPoint=function(t,e){var i=this.m_stack.Reset();for(i.Push(this.m_root);i.GetCount()>0;){var n=i.Pop();if(null!==n&&n.aabb.TestContain(t))if(n.IsLeaf()){if(!e(n))return}else i.Push(n.child1),i.Push(n.child2)}},e.RayCast=function(e,i){var n=e.p1,r=e.p2,s=Et.SubVV(r,n,t.s_r);s.Normalize();var a=Et.CrossOneV(s,t.s_v),o=Et.AbsV(a,t.s_abs_v),h=e.maxFraction,u=t.s_segmentAABB,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y);u.lowerBound.x=rt(n.x,l),u.lowerBound.y=rt(n.y,c),u.upperBound.x=st(n.x,l),u.upperBound.y=st(n.y,c);var _=this.m_stack.Reset();for(_.Push(this.m_root);_.GetCount()>0;){var f=_.Pop();if(null!==f&&we(f.aabb,u)){var d=f.aabb.GetCenter(),p=f.aabb.GetExtents();if(!(nt(Et.DotVV(a,Et.SubVV(n,d,Et.s_t0)))-Et.DotVV(o,p)>0))if(f.IsLeaf()){var m=t.s_subInput;m.p1.Copy(e.p1),m.p2.Copy(e.p2),m.maxFraction=h;var g=i(m,f);if(0===g)return;g>0&&(h=g,l=n.x+h*(r.x-n.x),c=n.y+h*(r.y-n.y),u.lowerBound.x=rt(n.x,l),u.lowerBound.y=rt(n.y,c),u.upperBound.x=st(n.x,l),u.upperBound.y=st(n.y,c))}else _.Push(f.child1),_.Push(f.child2)}}},e.AllocateNode=function(){if(null!==this.m_freeList){var e=this.m_freeList;return this.m_freeList=e.parent,e.parent=null,e.child1=null,e.child2=null,e.height=0,e}return new Me(t.s_node_id++)},e.FreeNode=function(t){t.parent=this.m_freeList,t.child1=null,t.child2=null,t.height=-1,t.Reset(),this.m_freeList=t},e.CreateProxy=function(t,e){var i=this.AllocateNode(),n=l,r=l;return i.aabb.lowerBound.x=t.lowerBound.x-n,i.aabb.lowerBound.y=t.lowerBound.y-r,i.aabb.upperBound.x=t.upperBound.x+n,i.aabb.upperBound.y=t.upperBound.y+r,i.userData=e,i.height=0,this.InsertLeaf(i),i},e.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},e.MoveProxy=function(t,e,i){if(t.aabb.Contains(e))return!1;this.RemoveLeaf(t);var n=l,r=l;t.aabb.lowerBound.x=e.lowerBound.x-n,t.aabb.lowerBound.y=e.lowerBound.y-r,t.aabb.upperBound.x=e.upperBound.x+n,t.aabb.upperBound.y=e.upperBound.y+r;var s=_*i.x,a=_*i.y;return s<0?t.aabb.lowerBound.x+=s:t.aabb.upperBound.x+=s,a<0?t.aabb.lowerBound.y+=a:t.aabb.upperBound.y+=a,this.InsertLeaf(t),!0},e.InsertLeaf=function(e){if(++this.m_insertionCount,null===this.m_root)return this.m_root=e,void(this.m_root.parent=null);for(var i=e.aabb,n=this.m_root;!n.IsLeaf();){var r=Pe(n.child1),s=Pe(n.child2),a=n.aabb.GetPerimeter(),o=t.s_combinedAABB;o.Combine2(n.aabb,i);var h=o.GetPerimeter(),u=2*h,l=2*(h-a),c=void 0,_=t.s_aabb,f=void 0;r.IsLeaf()?(_.Combine2(i,r.aabb),c=_.GetPerimeter()+l):(_.Combine2(i,r.aabb),f=r.aabb.GetPerimeter(),c=_.GetPerimeter()-f+l);var d=void 0;if(s.IsLeaf()?(_.Combine2(i,s.aabb),d=_.GetPerimeter()+l):(_.Combine2(i,s.aabb),f=s.aabb.GetPerimeter(),d=_.GetPerimeter()-f+l),u1){var r=Pe(i.child1),s=Pe(i.child2);return i.child1=t,i.parent=t.parent,t.parent=i,null!==i.parent?i.parent.child1===t?i.parent.child1=i:i.parent.child2=i:this.m_root=i,r.height>s.height?(i.child2=r,t.child2=s,s.parent=t,t.aabb.Combine2(e.aabb,s.aabb),i.aabb.Combine2(t.aabb,r.aabb),t.height=1+st(e.height,s.height),i.height=1+st(t.height,r.height)):(i.child2=s,t.child2=r,r.parent=t,t.aabb.Combine2(e.aabb,r.aabb),i.aabb.Combine2(t.aabb,s.aabb),t.height=1+st(e.height,r.height),i.height=1+st(t.height,s.height)),i}if(n<-1){var a=Pe(e.child1),o=Pe(e.child2);return e.child1=t,e.parent=t.parent,t.parent=e,null!==e.parent?e.parent.child1===t?e.parent.child1=e:e.parent.child2=e:this.m_root=e,a.height>o.height?(e.child2=a,t.child1=o,o.parent=t,t.aabb.Combine2(i.aabb,o.aabb),e.aabb.Combine2(t.aabb,a.aabb),t.height=1+st(i.height,o.height),e.height=1+st(t.height,a.height)):(e.child2=o,t.child1=a,a.parent=t,t.aabb.Combine2(i.aabb,a.aabb),e.aabb.Combine2(t.aabb,o.aabb),t.height=1+st(i.height,a.height),e.height=1+st(t.height,o.height)),e}return t},e.GetHeight=function(){return null===this.m_root?0:this.m_root.height},t.GetAreaNode=function(e){if(null===e)return 0;if(e.IsLeaf())return 0;var i=e.aabb.GetPerimeter();return(i+=t.GetAreaNode(e.child1))+t.GetAreaNode(e.child2)},e.GetAreaRatio=function(){if(null===this.m_root)return 0;var e=this.m_root.aabb.GetPerimeter();return t.GetAreaNode(this.m_root)/e},t.ComputeHeightNode=function(e){return null===e||e.IsLeaf()?0:1+st(t.ComputeHeightNode(e.child1),t.ComputeHeightNode(e.child2))},e.ComputeHeight=function(){return t.ComputeHeightNode(this.m_root)},e.ValidateStructure=function(t){if(null!==t&&(this.m_root,!t.IsLeaf())){var e=Pe(t.child1),i=Pe(t.child2);this.ValidateStructure(e),this.ValidateStructure(i)}},e.ValidateMetrics=function(e){if(null!==e&&!e.IsLeaf()){var i=Pe(e.child1),n=Pe(e.child2);t.s_aabb.Combine2(i.aabb,n.aabb),this.ValidateMetrics(i),this.ValidateMetrics(n)}},e.Validate=function(){},t.GetMaxBalanceNode=function(t,e){if(null===t)return e;if(t.height<=1)return e;var i=Pe(t.child1),n=Pe(t.child2);return st(e,nt(n.height-i.height))},e.GetMaxBalance=function(){return t.GetMaxBalanceNode(this.m_root,0)},e.RebuildBottomUp=function(){this.Validate()},t.ShiftOriginNode=function(e,i){if(null!==e&&!(e.height<=1)){var n=e.child1,r=e.child2;t.ShiftOriginNode(n,i),t.ShiftOriginNode(r,i),e.aabb.lowerBound.SelfSub(i),e.aabb.upperBound.SelfSub(i)}},e.ShiftOrigin=function(e){t.ShiftOriginNode(this.m_root,e)},t}();function Fe(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function Ne(t,e){return t=i)break;Fe(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}Oe.s_r=new Et,Oe.s_v=new Et,Oe.s_abs_v=new Et,Oe.s_segmentAABB=new Ce,Oe.s_subInput=new Te,Oe.s_combinedAABB=new Ce,Oe.s_aabb=new Ce,Oe.s_node_id=0;var Ve=function(t,e){this.proxyA=t,this.proxyB=e},ke=function(){function t(){this.m_tree=new Oe,this.m_proxyCount=0,this.m_moveCount=0,this.m_moveBuffer=[],this.m_pairCount=0,this.m_pairBuffer=[]}var e=t.prototype;return e.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},e.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},e.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},e.TouchProxy=function(t){this.BufferMove(t)},e.GetProxyCount=function(){return this.m_proxyCount},e.UpdatePairs=function(t){var e=this;this.m_pairCount=0;for(var i=function(t){var i=e.m_moveBuffer[t];if(null===i)return"continue";var n=i.aabb;e.m_tree.Query(n,(function(t){if(t.m_id===i.m_id)return!0;var n,r;if(t.m_id_+d){e.state=t.b2TOIOutputState.e_separated,e.t=l,E=!0;break}if(I>_-d){p=C;break}var B=T.Evaluate(x[0],R[0],p);if(B<_-d){e.state=t.b2TOIOutputState.e_failed,e.t=p,E=!0;break}if(B<=_+d){e.state=t.b2TOIOutputState.e_touching,e.t=p,E=!0;break}for(var D=0,P=p,M=C;;){var O=0;O=1&D?P+(_-B)*(M-P)/(I-B):.5*(P+M),++D,++t.b2_toiRootIters;var F=T.Evaluate(x[0],R[0],O);if(nt(F-_)_?(P=O,B=F):(M=O,I=F),50===D)break}if(t.b2_toiMaxRootIters=st(t.b2_toiMaxRootIters,D),++w===a)break}if(++g,++t.b2_toiIters,E)break;if(g===m){e.state=t.b2TOIOutputState.e_failed,e.t=p;break}}t.b2_toiMaxIters=st(t.b2_toiMaxIters,g);var N=n.GetMilliseconds();t.b2_toiMaxTime=st(t.b2_toiMaxTime,N),t.b2_toiTime+=N}var li=new Et,ci=new Et;function _i(e,i,n,r,s){e.pointCount=0;var a=Bt.MulXV(n,i.m_p,li),o=Bt.MulXV(s,r.m_p,ci),h=Et.DistanceSquaredVV(a,o),u=i.m_radius+r.m_radius;h>u*u||(e.type=t.b2ManifoldType.e_circles,e.localPoint.Copy(i.m_p),e.localNormal.SetZero(),e.pointCount=1,e.points[0].localPoint.Copy(r.m_p),e.points[0].id.key=0)}var fi=new Et,di=new Et,pi=new Et;function mi(e,i,s,a,o){e.pointCount=0;for(var h=Bt.MulXV(o,a.m_p,fi),u=Bt.MulTXV(s,h,di),l=0,c=-n,_=i.m_radius+a.m_radius,f=i.m_count,d=i.m_vertices,p=i.m_normals,m=0;m_)return;g>c&&(c=g,l=m)}var y=l,v=(y+1)%f,A=d[y],S=d[v];if(c_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,Et.SubVV(u,A,e.localNormal).SelfNormalize(),e.localPoint.Copy(A),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}else if(T<=0){if(Et.DistanceSquaredVV(u,S)>_*_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,Et.SubVV(u,S,e.localNormal).SelfNormalize(),e.localPoint.Copy(S),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}else{var E=Et.MidVV(A,S,pi);if(Et.DotVV(Et.SubVV(u,E,Et.s_t1),p[y])>_)return;e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(p[y]).SelfNormalize(),e.localPoint.Copy(E),e.points[0].localPoint.Copy(a.m_p),e.points[0].id.key=0}}var gi=new Et,yi=new Et,vi=new Et,Ai=new Et;function Si(t,e,i,r,s){for(var a=t.m_vertices,o=t.m_normals,h=r.m_count,u=r.m_vertices,l=It.MulRV(e.q,o[i],gi),c=It.MulTRV(s.q,l,yi),_=0,f=n,d=0;dc&&(c=f,l=_)}var d=Si(e,i,l,r,s),p=(l+a-1)%a,m=Si(e,i,p,r,s),g=(l+1)%a,y=Si(e,i,g,r,s),v=0,A=0,S=0;if(m>d&&m>y)S=-1,v=p,A=m;else{if(!(y>d))return t[0]=l,d;S=1,v=g,A=y}for(;(d=Si(e,i,l=-1===S?(v+a-1)%a:(v+1)%a,r,s))>A;)v=l,A=d;return t[0]=v,A}var Ci=new Et;function wi(e,i,r,s,a,o){for(var h=i.m_normals,u=a.m_count,l=a.m_vertices,c=a.m_normals,_=It.MulTRV(o.q,It.MulRV(r.q,h[s],Et.s_t0),Ci),f=0,d=n,p=0;pa)){var l=Di;l[0]=0;var c=Ei(l,r,s,i,n);if(!(c>a)){var _,f,d,p,m=0,g=0;c>.98*u+.001?(_=r,f=i,d=s,p=n,m=l[0],e.type=t.b2ManifoldType.e_faceB,g=1):(_=i,f=r,d=n,p=s,m=h[0],e.type=t.b2ManifoldType.e_faceA,g=0);var y=xi;wi(y,_,d,m,f,p);var v=_.m_count,A=_.m_vertices,S=m,b=(m+1)%v,T=A[S],E=A[b],C=Et.SubVV(E,T,Pi);C.Normalize();var w=Et.CrossVOne(C,Mi),x=Et.MidVV(T,E,Oi),R=It.MulRV(d.q,C,Ni),I=Et.CrossVOne(R,Fi),B=Bt.MulXV(d,T,Vi),D=Bt.MulXV(d,E,ki),P=Et.DotVV(I,B),M=-Et.DotVV(R,B)+a,O=Et.DotVV(R,D)+a,F=Ri,N=Ii;if(!(xe(F,y,Et.NegV(R,Li),M,S)<2||xe(N,F,R,O,b)<2)){e.localNormal.Copy(w),e.localPoint.Copy(x);for(var L=0,V=0;V_*_)return;if(i.m_hasVertex0){var m=i.m_vertex0,g=o,y=Et.SubVV(g,m,Xi);if(Et.DotVV(y,Et.SubVV(g,a,Et.s_t0))>0)return}return f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(d),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}if(l<=0){var v=h,A=Et.SubVV(a,v,Wi);if(Et.DotVV(A,A)>_*_)return;if(i.m_hasVertex3){var S=i.m_vertex3,b=h,T=Et.SubVV(S,b,ji);if(Et.DotVV(T,Et.SubVV(a,b,Et.s_t0))>0)return}return f.cf.indexA=1,f.cf.typeA=t.b2ContactFeatureType.e_vertex,e.pointCount=1,e.type=t.b2ManifoldType.e_circles,e.localNormal.SetZero(),e.localPoint.Copy(v),e.points[0].id.Copy(f),void e.points[0].localPoint.Copy(r.m_p)}var E=Et.DotVV(u,u),C=Yi;C.x=1/E*(l*o.x+c*h.x),C.y=1/E*(l*o.y+c*h.y);var w=Et.SubVV(a,C,Wi);if(!(Et.DotVV(w,w)>_*_)){var x=qi.Set(-u.y,u.x);Et.DotVV(x,Et.SubVV(a,o,Et.s_t0))<0&&x.Set(-x.x,-x.y),x.Normalize(),f.cf.indexA=0,f.cf.typeA=t.b2ContactFeatureType.e_face,e.pointCount=1,e.type=t.b2ManifoldType.e_faceA,e.localNormal.Copy(x),e.localPoint.Copy(o),e.points[0].id.Copy(f),e.points[0].localPoint.Copy(r.m_p)}}!function(t){t[t.e_unknown=0]="e_unknown",t[t.e_edgeA=1]="e_edgeA",t[t.e_edgeB=2]="e_edgeB"}(Ui||(Ui={}));var Zi,Qi=function(){this.type=Ui.e_unknown,this.index=0,this.separation=0},$i=function(){this.vertices=[],this.normals=[],this.count=0},tn=function(){this.i1=0,this.i2=0,this.v1=new Et,this.v2=new Et,this.normal=new Et,this.sideNormal1=new Et,this.sideOffset1=0,this.sideNormal2=new Et,this.sideOffset2=0};!function(t){t[t.e_isolated=0]="e_isolated",t[t.e_concave=1]="e_concave",t[t.e_convex=2]="e_convex"}(Zi||(Zi={}));var en=function(){function e(){this.m_polygonB=new $i,this.m_xf=new Bt,this.m_centroidB=new Et,this.m_v0=new Et,this.m_v1=new Et,this.m_v2=new Et,this.m_v3=new Et,this.m_normal0=new Et,this.m_normal1=new Et,this.m_normal2=new Et,this.m_normal=new Et,this.m_type1=Zi.e_isolated,this.m_type2=Zi.e_isolated,this.m_lowerLimit=new Et,this.m_upperLimit=new Et,this.m_radius=0,this.m_front=!1}var i=e.prototype;return i.Collide=function(i,n,r,s,a){Bt.MulTXX(r,a,this.m_xf),Bt.MulXV(this.m_xf,s.m_centroid,this.m_centroidB),this.m_v0.Copy(n.m_vertex0),this.m_v1.Copy(n.m_vertex1),this.m_v2.Copy(n.m_vertex2),this.m_v3.Copy(n.m_vertex3);var h=n.m_hasVertex0,u=n.m_hasVertex3,l=Et.SubVV(this.m_v2,this.m_v1,e.s_edge1);l.Normalize(),this.m_normal1.Set(l.y,-l.x);var c=Et.DotVV(this.m_normal1,Et.SubVV(this.m_centroidB,this.m_v1,Et.s_t0)),_=0,f=0,d=!1,p=!1;if(h){var m=Et.SubVV(this.m_v1,this.m_v0,e.s_edge0);m.Normalize(),this.m_normal0.Set(m.y,-m.x),d=Et.CrossVV(m,l)>=0,_=Et.DotVV(this.m_normal0,Et.SubVV(this.m_centroidB,this.m_v0,Et.s_t0))}if(u){var g=Et.SubVV(this.m_v3,this.m_v2,e.s_edge2);g.Normalize(),this.m_normal2.Set(g.y,-g.x),p=Et.CrossVV(l,g)>0,f=Et.DotVV(this.m_normal2,Et.SubVV(this.m_centroidB,this.m_v2,Et.s_t0))}h&&u?d&&p?(this.m_front=_>=0||c>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):d?(this.m_front=_>=0||c>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):p?(this.m_front=f>=0||_>=0&&c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):(this.m_front=_>=0&&c>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):h?d?(this.m_front=_>=0||c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal0),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg())):(this.m_front=_>=0&&c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal0).SelfNeg())):u?p?(this.m_front=c>=0||f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal2)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=c>=0&&f>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1)):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal2).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1))):(this.m_front=c>=0,this.m_front?(this.m_normal.Copy(this.m_normal1),this.m_lowerLimit.Copy(this.m_normal1).SelfNeg(),this.m_upperLimit.Copy(this.m_normal1).SelfNeg()):(this.m_normal.Copy(this.m_normal1).SelfNeg(),this.m_lowerLimit.Copy(this.m_normal1),this.m_upperLimit.Copy(this.m_normal1))),this.m_polygonB.count=s.m_count;for(var y=0;ythis.m_radius)){var A=this.ComputePolygonSeparation(e.s_polygonAxis);if(!(A.type!==Ui.e_unknown&&A.separation>this.m_radius)){var S,b=.98,T=.001;S=A.type===Ui.e_unknown?v:A.separation>b*v.separation+T?A:v;var E=e.s_ie,C=e.s_rf;if(S.type===Ui.e_edgeA){i.type=t.b2ManifoldType.e_faceA;for(var w=0,x=Et.DotVV(this.m_normal,this.m_polygonB.normals[0]),R=1;Rthis.m_radius)return i.type=Ui.e_edgeB,i.index=s,i.separation=o,i;if(Et.DotVV(a,r)>=0){if(Et.DotVV(Et.SubVV(a,this.m_upperLimit,Et.s_t0),this.m_normal)<-d)continue}else if(Et.DotVV(Et.SubVV(a,this.m_lowerLimit,Et.s_t0),this.m_normal)<-d)continue;o>i.separation&&(i.type=Ui.e_edgeB,i.index=s,i.separation=o)}return i},e}();en.s_edge1=new Et,en.s_edge0=new Et,en.s_edge2=new Et,en.s_ie=be.MakeArray(2),en.s_rf=new tn,en.s_clipPoints1=be.MakeArray(2),en.s_clipPoints2=be.MakeArray(2),en.s_edgeAxis=new Qi,en.s_polygonAxis=new Qi,en.s_n=new Et,en.s_perp=new Et;var nn=new en;function rn(t,e,i,n,r){nn.Collide(t,e,i,n,r)}var sn,an=function(){this.mass=0,this.center=new Et(0,0),this.I=0};(sn=t.b2ShapeType||(t.b2ShapeType={}))[sn.e_unknown=-1]="e_unknown",sn[sn.e_circleShape=0]="e_circleShape",sn[sn.e_edgeShape=1]="e_edgeShape",sn[sn.e_polygonShape=2]="e_polygonShape",sn[sn.e_chainShape=3]="e_chainShape",sn[sn.e_shapeTypeCount=4]="e_shapeTypeCount";var on=function(){function e(e,i){this.m_type=t.b2ShapeType.e_unknown,this.m_radius=0,this.m_type=e,this.m_radius=i}var i=e.prototype;return i.Copy=function(t){return this.m_radius=t.m_radius,this},i.GetType=function(){return this.m_type},e}(),hn=function(e){function i(i){var n;return void 0===i&&(i=0),(n=e.call(this,t.b2ShapeType.e_circleShape,i)||this).m_p=new Et,n}c(i,e);var n=i.prototype;return n.Set=function(t,e){return void 0===e&&(e=this.m_radius),this.m_p.Copy(t),this.m_radius=e,this},n.Clone=function(){return(new i).Copy(this)},n.Copy=function(t){return e.prototype.Copy.call(this,t),this.m_p.Copy(t.m_p),this},n.GetChildCount=function(){return 1},n.TestPoint=function(t,e){var n=Bt.MulXV(t,this.m_p,i.TestPoint_s_center),r=Et.SubVV(e,n,i.TestPoint_s_d);return Et.DotVV(r,r)<=ut(this.m_radius)},n.ComputeDistance=function(t,e,n){var r=Bt.MulXV(t,this.m_p,i.ComputeDistance_s_center);return Et.SubVV(e,r,n),n.Normalize()-this.m_radius},n.RayCast=function(t,e,n){var s=Bt.MulXV(n,this.m_p,i.RayCast_s_position),a=Et.SubVV(e.p1,s,i.RayCast_s_s),o=Et.DotVV(a,a)-ut(this.m_radius),h=Et.SubVV(e.p2,e.p1,i.RayCast_s_r),u=Et.DotVV(a,h),l=Et.DotVV(h,h),c=u*u-l*o;if(c<0||lthis.m_radius)return n.Copy(s),a*this.m_radius*this.m_radius;var h=this.m_radius*this.m_radius,u=o*o,l=h*(yt(o/this.m_radius)+a/2)+o*ct(h-u),c=-2/3*_t(h-u,1.5)/l;return n.x=s.x+t.x*c,n.y=s.y+t.y*c,l},n.Dump=function(t){t(" const shape: b2CircleShape = new b2CircleShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_p.Set(%.15f, %.15f);\n",this.m_p.x,this.m_p.y)},i}(on);hn.TestPoint_s_center=new Et,hn.TestPoint_s_d=new Et,hn.ComputeDistance_s_center=new Et,hn.RayCast_s_position=new Et,hn.RayCast_s_s=new Et,hn.RayCast_s_r=new Et,hn.ComputeAABB_s_p=new Et;var un=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_polygonShape,m)||this).m_centroid=new Et(0,0),i.m_vertices=[],i.m_normals=[],i.m_count=0,i}c(i,e);var s=i.prototype;return s.Clone=function(){return(new i).Copy(this)},s.Copy=function(t){e.prototype.Copy.call(this,t),this.m_centroid.Copy(t.m_centroid),this.m_count=t.m_count,this.m_vertices=Et.MakeArray(this.m_count),this.m_normals=Et.MakeArray(this.m_count);for(var i=0;il||_===l&&r[c].yv.LengthSquared()&&(g=y)}else g=y;if(++p,m=g,g===u)break}this.m_count=p,this.m_vertices=Et.MakeArray(this.m_count),this.m_normals=Et.MakeArray(this.m_count);for(var b=0;b0)return!1;return!0},s.ComputeDistance=function(t,e,r){for(var s=Bt.MulTXV(t,e,i.ComputeDistance_s_pLocal),a=-n,o=i.ComputeDistance_s_normalForMaxDistance.Copy(s),h=0;ha&&(a=u,o.Copy(this.m_normals[h]))}if(a>0){for(var l=i.ComputeDistance_s_minDistance.Copy(o),c=a*a,_=0;_d&&(l.Copy(f),c=d)}return It.MulRV(t.q,l,r),r.Normalize(),Math.sqrt(c)}return It.MulRV(t.q,o,r),a},s.RayCast=function(t,e,n){for(var r=Bt.MulTXV(n,e.p1,i.RayCast_s_p1),s=Bt.MulTXV(n,e.p2,i.RayCast_s_p2),a=Et.SubVV(s,r,i.RayCast_s_d),o=0,h=e.maxFraction,u=-1,l=0;l0&&c=0&&(t.fraction=o,It.MulRV(n.q,this.m_normals[u],t.normal),!0)},s.ComputeAABB=function(t,e){for(var n=Bt.MulXV(e,this.m_vertices[0],t.lowerBound),r=t.upperBound.Copy(n),s=0;s0&&(d?_||(l=f-1,u++):_&&(c=f-1,u++)),_=d}switch(u){case 0:if(_){var p=i.ComputeSubmergedArea_s_md;return this.ComputeMass(p,1),Bt.MulXV(n,p.center,s),p.mass}return 0;case 1:-1===l?l=this.m_count-1:c=this.m_count-1}for(var m,g=(l+1)%this.m_count,y=(c+1)%this.m_count,v=(0-h[l])/(h[g]-h[l]),A=(0-h[c])/(h[y]-h[c]),S=i.ComputeSubmergedArea_s_intoVec.Set(this.m_vertices[l].x*(1-v)+this.m_vertices[g].x*v,this.m_vertices[l].y*(1-v)+this.m_vertices[g].y*v),b=i.ComputeSubmergedArea_s_outoVec.Set(this.m_vertices[c].x*(1-A)+this.m_vertices[y].x*A,this.m_vertices[c].y*(1-A)+this.m_vertices[y].y*A),T=0,E=i.ComputeSubmergedArea_s_center.SetZero(),C=this.m_vertices[g],w=g;w!==y;){m=(w=(w+1)%this.m_count)===y?b:this.m_vertices[w];var x=.5*((C.x-S.x)*(m.y-S.y)-(C.y-S.y)*(m.x-S.x));T+=x,E.x+=x*(S.x+C.x+m.x)/3,E.y+=x*(S.y+C.y+m.y)/3,C=m}return E.SelfMul(1/T),Bt.MulXV(n,E,s),T},s.Dump=function(t){t(" const shape: b2PolygonShape = new b2PolygonShape();\n"),t(" const vs: b2Vec2[] = [];\n");for(var e=0;e0){var u=Et.DotVV(o,o);h>u?Et.SubVV(e,s,a):a.SelfMulSub(h/u,o)}return n.Copy(a),n.Normalize()},n.RayCast=function(t,e,n){var r=Bt.MulTXV(n,e.p1,i.RayCast_s_p1),s=Bt.MulTXV(n,e.p2,i.RayCast_s_p2),a=Et.SubVV(s,r,i.RayCast_s_d),o=this.m_vertex1,h=this.m_vertex2,u=Et.SubVV(h,o,i.RayCast_s_e),l=t.normal.Set(u.y,-u.x).SelfNormalize(),c=Et.DotVV(l,Et.SubVV(o,r,Et.s_t0)),_=Et.DotVV(l,a);if(0===_)return!1;var f=c/_;if(f<0||e.maxFraction0&&t.normal.SelfNeg(),0))},n.ComputeAABB=function(t,e){var n=Bt.MulXV(e,this.m_vertex1,i.ComputeAABB_s_v1),r=Bt.MulXV(e,this.m_vertex2,i.ComputeAABB_s_v2);Et.MinV(n,r,t.lowerBound),Et.MaxV(n,r,t.upperBound);var s=this.m_radius;t.lowerBound.SelfSubXY(s,s),t.upperBound.SelfAddXY(s,s)},n.ComputeMass=function(t){t.mass=0,Et.MidVV(this.m_vertex1,this.m_vertex2,t.center),t.I=0},n.SetupDistanceProxy=function(t){t.m_vertices=t.m_buffer,t.m_vertices[0].Copy(this.m_vertex1),t.m_vertices[1].Copy(this.m_vertex2),t.m_count=2,t.m_radius=this.m_radius},n.ComputeSubmergedArea=function(t,e,i,n){return n.SetZero(),0},n.Dump=function(t){t(" const shape: b2EdgeShape = new b2EdgeShape();\n"),t(" shape.m_radius = %.15f;\n",this.m_radius),t(" shape.m_vertex0.Set(%.15f, %.15f);\n",this.m_vertex0.x,this.m_vertex0.y),t(" shape.m_vertex1.Set(%.15f, %.15f);\n",this.m_vertex1.x,this.m_vertex1.y),t(" shape.m_vertex2.Set(%.15f, %.15f);\n",this.m_vertex2.x,this.m_vertex2.y),t(" shape.m_vertex3.Set(%.15f, %.15f);\n",this.m_vertex3.x,this.m_vertex3.y),t(" shape.m_hasVertex0 = %s;\n",this.m_hasVertex0),t(" shape.m_hasVertex3 = %s;\n",this.m_hasVertex3)},i}(on);ln.ComputeDistance_s_v1=new Et,ln.ComputeDistance_s_v2=new Et,ln.ComputeDistance_s_d=new Et,ln.ComputeDistance_s_s=new Et,ln.RayCast_s_p1=new Et,ln.RayCast_s_p2=new Et,ln.RayCast_s_d=new Et,ln.RayCast_s_e=new Et,ln.RayCast_s_q=new Et,ln.RayCast_s_r=new Et,ln.ComputeAABB_s_v1=new Et,ln.ComputeAABB_s_v2=new Et;var cn=function(e){function i(){var i;return(i=e.call(this,t.b2ShapeType.e_chainShape,m)||this).m_vertices=[],i.m_count=0,i.m_prevVertex=new Et,i.m_nextVertex=new Et,i.m_hasPrevVertex=!1,i.m_hasNextVertex=!1,i}c(i,e);var n=i.prototype;return n.CreateLoop=function(){for(var t=arguments.length,e=new Array(t),i=0;i0?(t.m_vertex0.Copy(this.m_vertices[e-1]),t.m_hasVertex0=!0):(t.m_vertex0.Copy(this.m_prevVertex),t.m_hasVertex0=this.m_hasPrevVertex),e0&&this.ResetMassData(),this.m_world.m_newFixture=!0,e},n.CreateFixtureShapeDensity=function(t,i){void 0===i&&(i=0);var n=e.CreateFixtureShapeDensity_s_def;return n.shape=t,n.density=i,this.CreateFixtureDef(n)},n.DestroyFixture=function(t){if(this.m_world.IsLocked())throw new Error;for(var e=this.m_fixtureList,i=null;null!==e;){if(e===t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}i=e,e=e.m_next}for(var n=this.m_contactList;n;){var r=n.contact;n=n.next;var s=r.GetFixtureA(),a=r.GetFixtureB();t!==s&&t!==a||this.m_world.m_contactManager.Destroy(r)}this.m_activeFlag&&t.DestroyProxies(),t.m_next=null,t.Reset(),--this.m_fixtureCount,this.ResetMassData()},n.SetTransformVec=function(t,e){this.SetTransformXY(t.x,t.y,e)},n.SetTransformXY=function(t,e,i){if(this.m_world.IsLocked())throw new Error;this.m_xf.q.SetAngle(i),this.m_xf.p.Set(t,e),this.m_xf0.Copy(this.m_xf),Bt.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.a=i,this.m_sweep.c0.Copy(this.m_sweep.c),this.m_sweep.a0=i;for(var n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(this.m_xf,this.m_xf,Et.ZERO);this.m_world.m_contactManager.FindNewContacts()},n.SetTransform=function(t){this.SetTransformVec(t.p,t.GetAngle())},n.GetTransform=function(){return this.m_xf},n.GetPosition=function(){return this.m_xf.p},n.SetPosition=function(t){this.SetTransformVec(t,this.GetAngle())},n.SetPositionXY=function(t,e){this.SetTransformXY(t,e,this.GetAngle())},n.GetAngle=function(){return this.m_sweep.a},n.SetAngle=function(t){this.SetTransformVec(this.GetPosition(),t)},n.GetWorldCenter=function(){return this.m_sweep.c},n.GetLocalCenter=function(){return this.m_sweep.localCenter},n.SetLinearVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(Et.DotVV(e,e)>0&&this.SetAwake(!0),this.m_linearVelocity.Copy(e))},n.GetLinearVelocity=function(){return this.m_linearVelocity},n.SetAngularVelocity=function(e){this.m_type!==t.b2BodyType.b2_staticBody&&(e*e>0&&this.SetAwake(!0),this.m_angularVelocity=e)},n.GetAngularVelocity=function(){return this.m_angularVelocity},n.GetDefinition=function(t){return t.type=this.GetType(),t.allowSleep=this.m_autoSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.gravityScale=this.m_gravityScale,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=this.m_fixedRotationFlag,t.bullet=this.m_bulletFlag,t.awake=this.m_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.Copy(this.GetLinearVelocity()),t.position.Copy(this.GetPosition()),t.userData=this.GetUserData(),t},n.ApplyForce=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y,this.m_torque+=(i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x))},n.ApplyForceToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_force.x+=e.x,this.m_force.y+=e.y))},n.ApplyTorque=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_torque+=e))},n.ApplyLinearImpulse=function(e,i,n){void 0===n&&(n=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(n&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y,this.m_angularVelocity+=this.m_invI*((i.x-this.m_sweep.c.x)*e.y-(i.y-this.m_sweep.c.y)*e.x)))},n.ApplyLinearImpulseToCenter=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_linearVelocity.x+=this.m_invMass*e.x,this.m_linearVelocity.y+=this.m_invMass*e.y))},n.ApplyAngularImpulse=function(e,i){void 0===i&&(i=!0),this.m_type===t.b2BodyType.b2_dynamicBody&&(i&&!this.m_awakeFlag&&this.SetAwake(!0),this.m_awakeFlag&&(this.m_angularVelocity+=this.m_invI*e))},n.GetMass=function(){return this.m_mass},n.GetInertia=function(){return this.m_I+this.m_mass*Et.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter)},n.GetMassData=function(t){return t.mass=this.m_mass,t.I=this.m_I+this.m_mass*Et.DotVV(this.m_sweep.localCenter,this.m_sweep.localCenter),t.center.Copy(this.m_sweep.localCenter),t},n.SetMassData=function(i){if(this.m_world.IsLocked())throw new Error;if(this.m_type===t.b2BodyType.b2_dynamicBody){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=i.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,i.I>0&&!this.m_fixedRotationFlag&&(this.m_I=i.I-this.m_mass*Et.DotVV(i.center,i.center),this.m_invI=1/this.m_I);var n=e.SetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(i.center),Bt.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),Et.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,Et.SubVV(this.m_sweep.c,n,Et.s_t0),this.m_linearVelocity)}},n.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type===t.b2BodyType.b2_staticBody||this.m_type===t.b2BodyType.b2_kinematicBody)return this.m_sweep.c0.Copy(this.m_xf.p),this.m_sweep.c.Copy(this.m_xf.p),void(this.m_sweep.a0=this.m_sweep.a);for(var i=e.ResetMassData_s_localCenter.SetZero(),n=this.m_fixtureList;n;n=n.m_next)if(0!==n.m_density){var r=n.GetMassData(e.ResetMassData_s_massData);this.m_mass+=r.mass,i.x+=r.center.x*r.mass,i.y+=r.center.y*r.mass,this.m_I+=r.I}this.m_mass>0?(this.m_invMass=1/this.m_mass,i.x*=this.m_invMass,i.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),this.m_I>0&&!this.m_fixedRotationFlag?(this.m_I-=this.m_mass*Et.DotVV(i,i),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var s=e.ResetMassData_s_oldCenter.Copy(this.m_sweep.c);this.m_sweep.localCenter.Copy(i),Bt.MulXV(this.m_xf,this.m_sweep.localCenter,this.m_sweep.c),this.m_sweep.c0.Copy(this.m_sweep.c),Et.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,Et.SubVV(this.m_sweep.c,s,Et.s_t0),this.m_linearVelocity)},n.GetWorldPoint=function(t,e){return Bt.MulXV(this.m_xf,t,e)},n.GetWorldVector=function(t,e){return It.MulRV(this.m_xf.q,t,e)},n.GetLocalPoint=function(t,e){return Bt.MulTXV(this.m_xf,t,e)},n.GetLocalVector=function(t,e){return It.MulTRV(this.m_xf.q,t,e)},n.GetLinearVelocityFromWorldPoint=function(t,e){return Et.AddVCrossSV(this.m_linearVelocity,this.m_angularVelocity,Et.SubVV(t,this.m_sweep.c,Et.s_t0),e)},n.GetLinearVelocityFromLocalPoint=function(t,e){return this.GetLinearVelocityFromWorldPoint(this.GetWorldPoint(t,e),e)},n.GetLinearDamping=function(){return this.m_linearDamping},n.SetLinearDamping=function(t){this.m_linearDamping=t},n.GetAngularDamping=function(){return this.m_angularDamping},n.SetAngularDamping=function(t){this.m_angularDamping=t},n.GetGravityScale=function(){return this.m_gravityScale},n.SetGravityScale=function(t){this.m_gravityScale=t},n.SetType=function(e){if(this.m_world.IsLocked())throw new Error;if(this.m_type!==e){this.m_type=e,this.ResetMassData(),this.m_type===t.b2BodyType.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sweep.a0=this.m_sweep.a,this.m_sweep.c0.Copy(this.m_sweep.c),this.SynchronizeFixtures()),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var i=this.m_contactList;i;){var n=i;i=i.next,this.m_world.m_contactManager.Destroy(n.contact)}this.m_contactList=null;for(var r=this.m_fixtureList;r;r=r.m_next)r.TouchProxies()}},n.GetType=function(){return this.m_type},n.SetBullet=function(t){this.m_bulletFlag=t},n.IsBullet=function(){return this.m_bulletFlag},n.SetSleepingAllowed=function(t){this.m_autoSleepFlag=t,t||this.SetAwake(!0)},n.IsSleepingAllowed=function(){return this.m_autoSleepFlag},n.SetAwake=function(t){t?(this.m_awakeFlag=!0,this.m_sleepTime=0):(this.m_awakeFlag=!1,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},n.IsAwake=function(){return this.m_awakeFlag},n.SetActive=function(t){if(this.m_world.IsLocked())throw new Error;if(t!==this.IsActive())if(this.m_activeFlag=t,t)for(var e=this.m_fixtureList;e;e=e.m_next)e.CreateProxies();else{for(var i=this.m_fixtureList;i;i=i.m_next)i.DestroyProxies();for(var n=this.m_contactList;n;){var r=n;n=n.next,this.m_world.m_contactManager.Destroy(r.contact)}this.m_contactList=null}},n.IsActive=function(){return this.m_activeFlag},n.SetFixedRotation=function(t){this.m_fixedRotationFlag!==t&&(this.m_fixedRotationFlag=t,this.m_angularVelocity=0,this.ResetMassData())},n.IsFixedRotation=function(){return this.m_fixedRotationFlag},n.GetFixtureList=function(){return this.m_fixtureList},n.GetJointList=function(){return this.m_jointList},n.GetContactList=function(){return this.m_contactList},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.GetWorld=function(){return this.m_world},n.Dump=function(e){var i=this.m_islandIndex;e("{\n"),e(" const bd: b2BodyDef = new b2BodyDef();\n");var n="";switch(this.m_type){case t.b2BodyType.b2_staticBody:n="b2BodyType.b2_staticBody";break;case t.b2BodyType.b2_kinematicBody:n="b2BodyType.b2_kinematicBody";break;case t.b2BodyType.b2_dynamicBody:n="b2BodyType.b2_dynamicBody"}e(" bd.type = %s;\n",n),e(" bd.position.Set(%.15f, %.15f);\n",this.m_xf.p.x,this.m_xf.p.y),e(" bd.angle = %.15f;\n",this.m_sweep.a),e(" bd.linearVelocity.Set(%.15f, %.15f);\n",this.m_linearVelocity.x,this.m_linearVelocity.y),e(" bd.angularVelocity = %.15f;\n",this.m_angularVelocity),e(" bd.linearDamping = %.15f;\n",this.m_linearDamping),e(" bd.angularDamping = %.15f;\n",this.m_angularDamping),e(" bd.allowSleep = %s;\n",this.m_autoSleepFlag?"true":"false"),e(" bd.awake = %s;\n",this.m_awakeFlag?"true":"false"),e(" bd.fixedRotation = %s;\n",this.m_fixedRotationFlag?"true":"false"),e(" bd.bullet = %s;\n",this.m_bulletFlag?"true":"false"),e(" bd.active = %s;\n",this.m_activeFlag?"true":"false"),e(" bd.gravityScale = %.15f;\n",this.m_gravityScale),e("\n"),e(" bodies[%d] = this.m_world.CreateBody(bd);\n",this.m_islandIndex),e("\n");for(var r=this.m_fixtureList;r;r=r.m_next)e(" {\n"),r.Dump(e,i),e(" }\n");e("}\n")},n.SynchronizeFixtures=function(){var t=e.SynchronizeFixtures_s_xf1;t.q.SetAngle(this.m_sweep.a0),It.MulRV(t.q,this.m_sweep.localCenter,t.p),Et.SubVV(this.m_sweep.c0,t.p,t.p);for(var i=Et.SubVV(this.m_sweep.c,this.m_sweep.c0,e.SynchronizeFixtures_s_displacement),n=this.m_fixtureList;n;n=n.m_next)n.SynchronizeProxies(t,this.m_xf,i)},n.SynchronizeTransform=function(){this.m_xf.q.SetAngle(this.m_sweep.a),It.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),Et.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.ShouldCollide=function(e){return(this.m_type!==t.b2BodyType.b2_staticBody||e.m_type!==t.b2BodyType.b2_staticBody)&&this.ShouldCollideConnected(e)},n.ShouldCollideConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other===t&&!e.joint.m_collideConnected)return!1;return!0},n.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.Copy(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.m_xf.q.SetAngle(this.m_sweep.a),It.MulRV(this.m_xf.q,this.m_sweep.localCenter,this.m_xf.p),Et.SubVV(this.m_sweep.c,this.m_xf.p,this.m_xf.p)},n.GetControllerList=function(){return this.m_controllerList},n.GetControllerCount=function(){return this.m_controllerCount},e}();An.CreateFixtureShapeDensity_s_def=new fn,An.SetMassData_s_oldCenter=new Et,An.ResetMassData_s_localCenter=new Et,An.ResetMassData_s_oldCenter=new Et,An.ResetMassData_s_massData=new an,An.SynchronizeFixtures_s_xf1=new Bt,An.SynchronizeFixtures_s_displacement=new Et,(yn=t.b2JointType||(t.b2JointType={}))[yn.e_unknownJoint=0]="e_unknownJoint",yn[yn.e_revoluteJoint=1]="e_revoluteJoint",yn[yn.e_prismaticJoint=2]="e_prismaticJoint",yn[yn.e_distanceJoint=3]="e_distanceJoint",yn[yn.e_pulleyJoint=4]="e_pulleyJoint",yn[yn.e_mouseJoint=5]="e_mouseJoint",yn[yn.e_gearJoint=6]="e_gearJoint",yn[yn.e_wheelJoint=7]="e_wheelJoint",yn[yn.e_weldJoint=8]="e_weldJoint",yn[yn.e_frictionJoint=9]="e_frictionJoint",yn[yn.e_ropeJoint=10]="e_ropeJoint",yn[yn.e_motorJoint=11]="e_motorJoint",yn[yn.e_areaJoint=12]="e_areaJoint",(gn=t.b2LimitState||(t.b2LimitState={}))[gn.e_inactiveLimit=0]="e_inactiveLimit",gn[gn.e_atLowerLimit=1]="e_atLowerLimit",gn[gn.e_atUpperLimit=2]="e_atUpperLimit",gn[gn.e_equalLimits=3]="e_equalLimits";var Sn=function(){function t(){this.linear=new Et,this.angularA=0,this.angularB=0}var e=t.prototype;return e.SetZero=function(){return this.linear.SetZero(),this.angularA=0,this.angularB=0,this},e.Set=function(t,e,i){return this.linear.Copy(t),this.angularA=e,this.angularB=i,this},t}(),bn=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.joint=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},u(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),Tn=function(e){this.type=t.b2JointType.e_unknownJoint,this.userData=null,this.collideConnected=!1,this.type=e},En=function(){function e(e){this.m_type=t.b2JointType.e_unknownJoint,this.m_prev=null,this.m_next=null,this.m_edgeA=new bn(this),this.m_edgeB=new bn(this),this.m_index=0,this.m_islandFlag=!1,this.m_collideConnected=!1,this.m_userData=null,this.m_type=e.type,this.m_edgeA.other=e.bodyB,this.m_edgeB.other=e.bodyA,this.m_bodyA=e.bodyA,this.m_bodyB=e.bodyB,this.m_collideConnected=i(e.collideConnected,!1),this.m_userData=i(e.userData,null)}var n=e.prototype;return n.GetType=function(){return this.m_type},n.GetBodyA=function(){return this.m_bodyA},n.GetBodyB=function(){return this.m_bodyB},n.GetNext=function(){return this.m_next},n.GetUserData=function(){return this.m_userData},n.SetUserData=function(t){this.m_userData=t},n.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},n.GetCollideConnected=function(){return this.m_collideConnected},n.Dump=function(t){t("// Dump is not supported for this joint type.\n")},n.ShiftOrigin=function(){},e}(),Cn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_distanceJoint)||this).localAnchorA=new Et,i.localAnchorB=new Et,i.length=1,i.frequencyHz=0,i.dampingRatio=0,i}return c(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(n,this.localAnchorB),this.length=Et.DistanceVV(i,n),this.frequencyHz=0,this.dampingRatio=0},i}(Tn),wn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_bias=0,n.m_localAnchorA=new Et,n.m_localAnchorB=new Et,n.m_gamma=0,n.m_impulse=0,n.m_length=0,n.m_indexA=0,n.m_indexB=0,n.m_u=new Et,n.m_rA=new Et,n.m_rB=new Et,n.m_localCenterA=new Et,n.m_localCenterB=new Et,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new Et,n.m_lalcB=new Et,n.m_frequencyHz=i(e.frequencyHz,0),n.m_dampingRatio=i(e.dampingRatio,0),n.m_localAnchorA.Copy(e.localAnchorA),n.m_localAnchorB.Copy(e.localAnchorB),n.m_length=e.length,n}c(e,t);var n=e.prototype;return n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse*this.m_u.x,e.y=t*this.m_impulse*this.m_u.y,e},n.GetReactionTorque=function(){return 0},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetLength=function(t){this.m_length=t},n.Length=function(){return this.m_length},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2DistanceJointDef = new b2DistanceJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.length = %.15f;\n",this.m_length),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,o=t.positions[this.m_indexB].c,h=t.positions[this.m_indexB].a,u=t.velocities[this.m_indexB].v,l=t.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(n),_=this.m_qB.SetAngle(h);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(c,this.m_lalcA,this.m_rA),Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(_,this.m_lalcB,this.m_rB),this.m_u.x=o.x+this.m_rB.x-i.x-this.m_rA.x,this.m_u.y=o.y+this.m_rB.y-i.y-this.m_rA.y;var d=this.m_u.Length();d>f?this.m_u.SelfMul(1/d):this.m_u.SetZero();var p=Et.CrossVV(this.m_rA,this.m_u),m=Et.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,this.m_frequencyHz>0){var y=d-this.m_length,v=2*a*this.m_frequencyHz,A=2*this.m_mass*this.m_dampingRatio*v,S=this.m_mass*v*v,b=t.step.dt;this.m_gamma=b*(A+b*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*b*S*this.m_gamma,g+=this.m_gamma,this.m_mass=0!==g?1/g:0}else this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var T=Et.MulSV(this.m_impulse,this.m_u,e.InitVelocityConstraints_s_P);r.SelfMulSub(this.m_invMassA,T),s-=this.m_invIA*Et.CrossVV(this.m_rA,T),u.SelfMulAdd(this.m_invMassB,T),l+=this.m_invIB*Et.CrossVV(this.m_rB,T)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=l},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=Et.AddVCrossSV(i,n,this.m_rA,e.SolveVelocityConstraints_s_vpA),o=Et.AddVCrossSV(r,s,this.m_rB,e.SolveVelocityConstraints_s_vpB),h=Et.DotVV(this.m_u,Et.SubVV(o,a,Et.s_t0)),u=-this.m_mass*(h+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=u;var l=Et.MulSV(u,this.m_u,e.SolveVelocityConstraints_s_P);i.SelfMulSub(this.m_invMassA,l),n-=this.m_invIA*Et.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,l),s+=this.m_invIB*Et.CrossVV(this.m_rB,l),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){if(this.m_frequencyHz>0)return!0;var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=It.MulRV(a,this.m_lalcA,this.m_rA),u=It.MulRV(o,this.m_lalcB,this.m_rB),l=this.m_u;l.x=r.x+u.x-i.x-h.x,l.y=r.y+u.y-i.y-h.y;var c=this.m_u.Normalize()-this.m_length;c=at(c,-S,S);var _=-this.m_mass*c,d=Et.MulSV(_,l,e.SolvePositionConstraints_s_P);return i.SelfMulSub(this.m_invMassA,d),n-=this.m_invIA*Et.CrossVV(h,d),r.SelfMulAdd(this.m_invMassB,d),s+=this.m_invIB*Et.CrossVV(u,d),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,nt(c)ut(S)&&y.SelfMul(S/ct(v)),v>ut(f)&&(_=!1),m.x+=y.x,m.y+=y.y}return _},e}(En),In=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_frictionJoint)||this).localAnchorA=new Et,i.localAnchorB=new Et,i.maxForce=0,i.maxTorque=0,i}return c(i,e),i.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB)},i}(Tn),Bn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_localAnchorA=new Et,n.m_localAnchorB=new Et,n.m_linearImpulse=new Et,n.m_angularImpulse=0,n.m_maxForce=0,n.m_maxTorque=0,n.m_indexA=0,n.m_indexB=0,n.m_rA=new Et,n.m_rB=new Et,n.m_localCenterA=new Et,n.m_localCenterB=new Et,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_linearMass=new xt,n.m_angularMass=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new Et,n.m_lalcB=new Et,n.m_K=new xt,n.m_localAnchorA.Copy(e.localAnchorA),n.m_localAnchorB.Copy(e.localAnchorB),n.m_linearImpulse.SetZero(),n.m_maxForce=i(e.maxForce,0),n.m_maxTorque=i(e.maxTorque,0),n.m_linearMass.SetZero(),n}c(e,t);var n=e.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexA].a,i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.positions[this.m_indexB].a,s=t.velocities[this.m_indexB].v,a=t.velocities[this.m_indexB].w,o=this.m_qA.SetAngle(e),h=this.m_qB.SetAngle(r);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var u=It.MulRV(o,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var l=It.MulRV(h,this.m_lalcB,this.m_rB),c=this.m_invMassA,_=this.m_invMassB,f=this.m_invIA,d=this.m_invIB,p=this.m_K;if(p.ex.x=c+_+f*u.y*u.y+d*l.y*l.y,p.ex.y=-f*u.x*u.y-d*l.x*l.y,p.ey.x=p.ex.y,p.ey.y=c+_+f*u.x*u.x+d*l.x*l.x,p.GetInverse(this.m_linearMass),this.m_angularMass=f+d,this.m_angularMass>0&&(this.m_angularMass=1/this.m_angularMass),t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var m=this.m_linearImpulse;i.SelfMulSub(c,m),n-=f*(Et.CrossVV(this.m_rA,m)+this.m_angularImpulse),s.SelfMulAdd(_,m),a+=d*(Et.CrossVV(this.m_rB,m)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=a},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=s-n,_=-this.m_angularMass*c,f=this.m_angularImpulse,d=l*this.m_maxTorque;this.m_angularImpulse=at(this.m_angularImpulse+_,-d,d),n-=h*(_=this.m_angularImpulse-f),s+=u*_;var p=Et.SubVV(Et.AddVCrossSV(r,s,this.m_rB,Et.s_t0),Et.AddVCrossSV(i,n,this.m_rA,Et.s_t1),e.SolveVelocityConstraints_s_Cdot_v2),m=xt.MulMV(this.m_linearMass,p,e.SolveVelocityConstraints_s_impulseV).SelfNeg(),g=e.SolveVelocityConstraints_s_oldImpulseV.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(m);var y=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>y*y&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(y)),Et.SubVV(this.m_linearImpulse,g,m),i.SelfMulSub(a,m),n-=h*Et.CrossVV(this.m_rA,m),r.SelfMulAdd(o,m),s+=u*Et.CrossVV(this.m_rB,m),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_linearImpulse.x,e.y=t*this.m_linearImpulse.y,e},n.GetReactionTorque=function(t){return t*this.m_angularImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetMaxTorque=function(t){this.m_maxTorque=t},n.GetMaxTorque=function(){return this.m_maxTorque},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2FrictionJointDef = new b2FrictionJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(En);Bn.SolveVelocityConstraints_s_Cdot_v2=new Et,Bn.SolveVelocityConstraints_s_impulseV=new Et,Bn.SolveVelocityConstraints_s_oldImpulseV=new Et;var Dn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_gearJoint)||this).ratio=1,i}return c(i,e),i}(Tn),Pn=function(e){function n(n){var r,s,a;(r=e.call(this,n)||this).m_typeA=t.b2JointType.e_unknownJoint,r.m_typeB=t.b2JointType.e_unknownJoint,r.m_localAnchorA=new Et,r.m_localAnchorB=new Et,r.m_localAnchorC=new Et,r.m_localAnchorD=new Et,r.m_localAxisC=new Et,r.m_localAxisD=new Et,r.m_referenceAngleA=0,r.m_referenceAngleB=0,r.m_constant=0,r.m_ratio=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_indexC=0,r.m_indexD=0,r.m_lcA=new Et,r.m_lcB=new Et,r.m_lcC=new Et,r.m_lcD=new Et,r.m_mA=0,r.m_mB=0,r.m_mC=0,r.m_mD=0,r.m_iA=0,r.m_iB=0,r.m_iC=0,r.m_iD=0,r.m_JvAC=new Et,r.m_JvBD=new Et,r.m_JwA=0,r.m_JwB=0,r.m_JwC=0,r.m_JwD=0,r.m_mass=0,r.m_qA=new It,r.m_qB=new It,r.m_qC=new It,r.m_qD=new It,r.m_lalcA=new Et,r.m_lalcB=new Et,r.m_lalcC=new Et,r.m_lalcD=new Et,r.m_joint1=n.joint1,r.m_joint2=n.joint2,r.m_typeA=r.m_joint1.GetType(),r.m_typeB=r.m_joint2.GetType(),r.m_bodyC=r.m_joint1.GetBodyA(),r.m_bodyA=r.m_joint1.GetBodyB();var o=r.m_bodyA.m_xf,h=r.m_bodyA.m_sweep.a,u=r.m_bodyC.m_xf,l=r.m_bodyC.m_sweep.a;if(r.m_typeA===t.b2JointType.e_revoluteJoint){var c=n.joint1;r.m_localAnchorC.Copy(c.m_localAnchorA),r.m_localAnchorA.Copy(c.m_localAnchorB),r.m_referenceAngleA=c.m_referenceAngle,r.m_localAxisC.SetZero(),s=h-l-r.m_referenceAngleA}else{var _=n.joint1;r.m_localAnchorC.Copy(_.m_localAnchorA),r.m_localAnchorA.Copy(_.m_localAnchorB),r.m_referenceAngleA=_.m_referenceAngle,r.m_localAxisC.Copy(_.m_localXAxisA);var f=r.m_localAnchorC,d=It.MulTRV(u.q,Et.AddVV(It.MulRV(o.q,r.m_localAnchorA,Et.s_t0),Et.SubVV(o.p,u.p,Et.s_t1),Et.s_t0),Et.s_t0);s=Et.DotVV(Et.SubVV(d,f,Et.s_t0),r.m_localAxisC)}r.m_bodyD=r.m_joint2.GetBodyA(),r.m_bodyB=r.m_joint2.GetBodyB();var p=r.m_bodyB.m_xf,m=r.m_bodyB.m_sweep.a,g=r.m_bodyD.m_xf,y=r.m_bodyD.m_sweep.a;if(r.m_typeB===t.b2JointType.e_revoluteJoint){var v=n.joint2;r.m_localAnchorD.Copy(v.m_localAnchorA),r.m_localAnchorB.Copy(v.m_localAnchorB),r.m_referenceAngleB=v.m_referenceAngle,r.m_localAxisD.SetZero(),a=m-y-r.m_referenceAngleB}else{var A=n.joint2;r.m_localAnchorD.Copy(A.m_localAnchorA),r.m_localAnchorB.Copy(A.m_localAnchorB),r.m_referenceAngleB=A.m_referenceAngle,r.m_localAxisD.Copy(A.m_localXAxisA);var S=r.m_localAnchorD,b=It.MulTRV(g.q,Et.AddVV(It.MulRV(p.q,r.m_localAnchorB,Et.s_t0),Et.SubVV(p.p,g.p,Et.s_t1),Et.s_t0),Et.s_t0);a=Et.DotVV(Et.SubVV(b,S,Et.s_t0),r.m_localAxisD)}return r.m_ratio=i(n.ratio,1),r.m_constant=s+r.m_ratio*a,r.m_impulse=0,r}c(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_indexC=this.m_bodyC.m_islandIndex,this.m_indexD=this.m_bodyD.m_islandIndex,this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter),this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter),this.m_mA=this.m_bodyA.m_invMass,this.m_mB=this.m_bodyB.m_invMass,this.m_mC=this.m_bodyC.m_invMass,this.m_mD=this.m_bodyD.m_invMass,this.m_iA=this.m_bodyA.m_invI,this.m_iB=this.m_bodyB.m_invI,this.m_iC=this.m_bodyC.m_invI,this.m_iD=this.m_bodyD.m_invI;var i=e.positions[this.m_indexA].a,r=e.velocities[this.m_indexA].v,s=e.velocities[this.m_indexA].w,a=e.positions[this.m_indexB].a,o=e.velocities[this.m_indexB].v,h=e.velocities[this.m_indexB].w,u=e.positions[this.m_indexC].a,l=e.velocities[this.m_indexC].v,c=e.velocities[this.m_indexC].w,_=e.positions[this.m_indexD].a,f=e.velocities[this.m_indexD].v,d=e.velocities[this.m_indexD].w,p=this.m_qA.SetAngle(i),m=this.m_qB.SetAngle(a),g=this.m_qC.SetAngle(u),y=this.m_qD.SetAngle(_);if(this.m_mass=0,this.m_typeA===t.b2JointType.e_revoluteJoint)this.m_JvAC.SetZero(),this.m_JwA=1,this.m_JwC=1,this.m_mass+=this.m_iA+this.m_iC;else{var v=It.MulRV(g,this.m_localAxisC,n.InitVelocityConstraints_s_u);Et.SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC);var A=It.MulRV(g,this.m_lalcC,n.InitVelocityConstraints_s_rC);Et.SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA);var S=It.MulRV(p,this.m_lalcA,n.InitVelocityConstraints_s_rA);this.m_JvAC.Copy(v),this.m_JwC=Et.CrossVV(A,v),this.m_JwA=Et.CrossVV(S,v),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA}if(this.m_typeB===t.b2JointType.e_revoluteJoint)this.m_JvBD.SetZero(),this.m_JwB=this.m_ratio,this.m_JwD=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD);else{var b=It.MulRV(y,this.m_localAxisD,n.InitVelocityConstraints_s_u);Et.SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD);var T=It.MulRV(y,this.m_lalcD,n.InitVelocityConstraints_s_rD);Et.SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB);var E=It.MulRV(m,this.m_lalcB,n.InitVelocityConstraints_s_rB);Et.MulSV(this.m_ratio,b,this.m_JvBD),this.m_JwD=this.m_ratio*Et.CrossVV(T,b),this.m_JwB=this.m_ratio*Et.CrossVV(E,b),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB}this.m_mass=this.m_mass>0?1/this.m_mass:0,e.step.warmStarting?(r.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),s+=this.m_iA*this.m_impulse*this.m_JwA,o.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),h+=this.m_iB*this.m_impulse*this.m_JwB,l.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),c-=this.m_iC*this.m_impulse*this.m_JwC,f.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),d-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0,e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h,e.velocities[this.m_indexC].w=c,e.velocities[this.m_indexD].w=d},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=t.velocities[this.m_indexC].v,a=t.velocities[this.m_indexC].w,o=t.velocities[this.m_indexD].v,h=t.velocities[this.m_indexD].w,u=Et.DotVV(this.m_JvAC,Et.SubVV(e,s,Et.s_t0))+Et.DotVV(this.m_JvBD,Et.SubVV(n,o,Et.s_t0));u+=this.m_JwA*i-this.m_JwC*a+(this.m_JwB*r-this.m_JwD*h);var l=-this.m_mass*u;this.m_impulse+=l,e.SelfMulAdd(this.m_mA*l,this.m_JvAC),i+=this.m_iA*l*this.m_JwA,n.SelfMulAdd(this.m_mB*l,this.m_JvBD),r+=this.m_iB*l*this.m_JwB,s.SelfMulSub(this.m_mC*l,this.m_JvAC),a-=this.m_iC*l*this.m_JwC,o.SelfMulSub(this.m_mD*l,this.m_JvBD),h-=this.m_iD*l*this.m_JwD,t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=r,t.velocities[this.m_indexC].w=a,t.velocities[this.m_indexD].w=h},r.SolvePositionConstraints=function(e){var i,r,s,a,o,h,u=e.positions[this.m_indexA].c,l=e.positions[this.m_indexA].a,c=e.positions[this.m_indexB].c,_=e.positions[this.m_indexB].a,d=e.positions[this.m_indexC].c,p=e.positions[this.m_indexC].a,m=e.positions[this.m_indexD].c,g=e.positions[this.m_indexD].a,y=this.m_qA.SetAngle(l),v=this.m_qB.SetAngle(_),A=this.m_qC.SetAngle(p),S=this.m_qD.SetAngle(g),b=0,T=this.m_JvAC,E=this.m_JvBD,C=0;if(this.m_typeA===t.b2JointType.e_revoluteJoint)T.SetZero(),s=1,o=1,C+=this.m_iA+this.m_iC,i=l-p-this.m_referenceAngleA;else{var w=It.MulRV(A,this.m_localAxisC,n.SolvePositionConstraints_s_u),x=It.MulRV(A,this.m_lalcC,n.SolvePositionConstraints_s_rC),R=It.MulRV(y,this.m_lalcA,n.SolvePositionConstraints_s_rA);T.Copy(w),o=Et.CrossVV(x,w),s=Et.CrossVV(R,w),C+=this.m_mC+this.m_mA+this.m_iC*o*o+this.m_iA*s*s;var I=this.m_lalcC,B=It.MulTRV(A,Et.AddVV(R,Et.SubVV(u,d,Et.s_t0),Et.s_t0),Et.s_t0);i=Et.DotVV(Et.SubVV(B,I,Et.s_t0),this.m_localAxisC)}if(this.m_typeB===t.b2JointType.e_revoluteJoint)E.SetZero(),a=this.m_ratio,h=this.m_ratio,C+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),r=_-g-this.m_referenceAngleB;else{var D=It.MulRV(S,this.m_localAxisD,n.SolvePositionConstraints_s_u),P=It.MulRV(S,this.m_lalcD,n.SolvePositionConstraints_s_rD),M=It.MulRV(v,this.m_lalcB,n.SolvePositionConstraints_s_rB);Et.MulSV(this.m_ratio,D,E),h=this.m_ratio*Et.CrossVV(P,D),a=this.m_ratio*Et.CrossVV(M,D),C+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*h*h+this.m_iB*a*a;var O=this.m_lalcD,F=It.MulTRV(S,Et.AddVV(M,Et.SubVV(c,m,Et.s_t0),Et.s_t0),Et.s_t0);r=Et.DotVV(Et.SubVV(F,O,Et.s_t0),this.m_localAxisD)}var N=i+this.m_ratio*r-this.m_constant,L=0;return C>0&&(L=-N/C),u.SelfMulAdd(this.m_mA*L,T),l+=this.m_iA*L*s,c.SelfMulAdd(this.m_mB*L,E),_+=this.m_iB*L*a,d.SelfMulSub(this.m_mC*L,T),p-=this.m_iC*L*o,m.SelfMulSub(this.m_mD*L,E),g-=this.m_iD*L*h,e.positions[this.m_indexA].a=l,e.positions[this.m_indexB].a=_,e.positions[this.m_indexC].a=p,e.positions[this.m_indexD].a=g,b0&&(this.m_angularMass=1/this.m_angularMass),Et.SubVV(Et.AddVV(s,_,Et.s_t0),Et.AddVV(e,c,Et.s_t1),this.m_linearError),this.m_angularError=a-i-this.m_angularOffset,t.step.warmStarting){this.m_linearImpulse.SelfMul(t.step.dtRatio),this.m_angularImpulse*=t.step.dtRatio;var y=this.m_linearImpulse;n.SelfMulSub(f,y),r-=p*(Et.CrossVV(c,y)+this.m_angularImpulse),o.SelfMulAdd(d,y),h+=m*(Et.CrossVV(_,y)+this.m_angularImpulse)}else this.m_linearImpulse.SetZero(),this.m_angularImpulse=0;t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB,l=t.step.dt,c=t.step.inv_dt,_=s-n+c*this.m_correctionFactor*this.m_angularError,f=-this.m_angularMass*_,d=this.m_angularImpulse,p=l*this.m_maxTorque;this.m_angularImpulse=at(this.m_angularImpulse+f,-p,p),n-=h*(f=this.m_angularImpulse-d),s+=u*f;var m=this.m_rA,g=this.m_rB,y=Et.AddVV(Et.SubVV(Et.AddVV(r,Et.CrossSV(s,g,Et.s_t0),Et.s_t0),Et.AddVV(i,Et.CrossSV(n,m,Et.s_t1),Et.s_t1),Et.s_t2),Et.MulSV(c*this.m_correctionFactor,this.m_linearError,Et.s_t3),e.SolveVelocityConstraints_s_Cdot_v2),v=xt.MulMV(this.m_linearMass,y,e.SolveVelocityConstraints_s_impulse_v2).SelfNeg(),A=e.SolveVelocityConstraints_s_oldImpulse_v2.Copy(this.m_linearImpulse);this.m_linearImpulse.SelfAdd(v);var S=l*this.m_maxForce;this.m_linearImpulse.LengthSquared()>S*S&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.SelfMul(S)),Et.SubVV(this.m_linearImpulse,A,v),i.SelfMulSub(a,v),n-=h*Et.CrossVV(m,v),r.SelfMulAdd(o,v),s+=u*Et.CrossVV(g,v),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(){return!0},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2MotorJointDef = new b2MotorJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.linearOffset.Set(%.15f, %.15f);\n",this.m_linearOffset.x,this.m_linearOffset.y),t(" jd.angularOffset = %.15f;\n",this.m_angularOffset),t(" jd.maxForce = %.15f;\n",this.m_maxForce),t(" jd.maxTorque = %.15f;\n",this.m_maxTorque),t(" jd.correctionFactor = %.15f;\n",this.m_correctionFactor),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(En);On.SolveVelocityConstraints_s_Cdot_v2=new Et,On.SolveVelocityConstraints_s_impulse_v2=new Et,On.SolveVelocityConstraints_s_oldImpulse_v2=new Et;var Fn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_mouseJoint)||this).target=new Et,i.maxForce=0,i.frequencyHz=5,i.dampingRatio=.7,i}return c(i,e),i}(Tn),Nn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_localAnchorB=new Et,n.m_targetA=new Et,n.m_frequencyHz=0,n.m_dampingRatio=0,n.m_beta=0,n.m_impulse=new Et,n.m_maxForce=0,n.m_gamma=0,n.m_indexA=0,n.m_indexB=0,n.m_rB=new Et,n.m_localCenterB=new Et,n.m_invMassB=0,n.m_invIB=0,n.m_mass=new xt,n.m_C=new Et,n.m_qB=new It,n.m_lalcB=new Et,n.m_K=new xt,n.m_targetA.Copy(i(e.target,Et.ZERO)),Bt.MulTXV(n.m_bodyB.GetTransform(),n.m_targetA,n.m_localAnchorB),n.m_maxForce=i(e.maxForce,0),n.m_impulse.SetZero(),n.m_frequencyHz=i(e.frequencyHz,0),n.m_dampingRatio=i(e.dampingRatio,0),n.m_beta=0,n.m_gamma=0,n}c(e,t);var n=e.prototype;return n.SetTarget=function(t){this.m_bodyB.IsAwake()||this.m_bodyB.SetAwake(!0),this.m_targetA.Copy(t)},n.GetTarget=function(){return this.m_targetA},n.SetMaxForce=function(t){this.m_maxForce=t},n.GetMaxForce=function(){return this.m_maxForce},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIB=this.m_bodyB.m_invI;var e=t.positions[this.m_indexB].c,i=t.positions[this.m_indexB].a,n=t.velocities[this.m_indexB].v,r=t.velocities[this.m_indexB].w,s=this.m_qB.SetAngle(i),o=this.m_bodyB.GetMass(),h=2*a*this.m_frequencyHz,u=2*o*this.m_dampingRatio*h,l=o*h*h,c=t.step.dt;this.m_gamma=c*(u+c*l),0!==this.m_gamma&&(this.m_gamma=1/this.m_gamma),this.m_beta=c*l*this.m_gamma,Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(s,this.m_lalcB,this.m_rB);var _=this.m_K;_.ex.x=this.m_invMassB+this.m_invIB*this.m_rB.y*this.m_rB.y+this.m_gamma,_.ex.y=-this.m_invIB*this.m_rB.x*this.m_rB.y,_.ey.x=_.ex.y,_.ey.y=this.m_invMassB+this.m_invIB*this.m_rB.x*this.m_rB.x+this.m_gamma,_.GetInverse(this.m_mass),this.m_C.x=e.x+this.m_rB.x-this.m_targetA.x,this.m_C.y=e.y+this.m_rB.y-this.m_targetA.y,this.m_C.SelfMul(this.m_beta),r*=.98,t.step.warmStarting?(this.m_impulse.SelfMul(t.step.dtRatio),n.x+=this.m_invMassB*this.m_impulse.x,n.y+=this.m_invMassB*this.m_impulse.y,r+=this.m_invIB*Et.CrossVV(this.m_rB,this.m_impulse)):this.m_impulse.SetZero(),t.velocities[this.m_indexB].w=r},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexB].v,n=t.velocities[this.m_indexB].w,r=Et.AddVCrossSV(i,n,this.m_rB,e.SolveVelocityConstraints_s_Cdot),s=xt.MulMV(this.m_mass,Et.AddVV(r,Et.AddVV(this.m_C,Et.MulSV(this.m_gamma,this.m_impulse,Et.s_t0),Et.s_t0),Et.s_t0).SelfNeg(),e.SolveVelocityConstraints_s_impulse),a=e.SolveVelocityConstraints_s_oldImpulse.Copy(this.m_impulse);this.m_impulse.SelfAdd(s);var o=t.step.dt*this.m_maxForce;this.m_impulse.LengthSquared()>o*o&&this.m_impulse.SelfMul(o/this.m_impulse.Length()),Et.SubVV(this.m_impulse,a,s),i.SelfMulAdd(this.m_invMassB,s),n+=this.m_invIB*Et.CrossVV(this.m_rB,s),t.velocities[this.m_indexB].w=n},n.SolvePositionConstraints=function(){return!0},n.GetAnchorA=function(t){return t.x=this.m_targetA.x,t.y=this.m_targetA.y,t},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return Et.MulSV(t,this.m_impulse,e)},n.GetReactionTorque=function(){return 0},n.Dump=function(t){t("Mouse joint dumping is not supported.\n")},n.ShiftOrigin=function(t){this.m_targetA.SelfSub(t)},e}(En);Nn.SolveVelocityConstraints_s_Cdot=new Et,Nn.SolveVelocityConstraints_s_impulse=new Et,Nn.SolveVelocityConstraints_s_oldImpulse=new Et;var Ln=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_prismaticJoint)||this).localAnchorA=new Et,i.localAnchorB=new Et,i.localAxisA=new Et(1,0),i.referenceAngle=0,i.enableLimit=!1,i.lowerTranslation=0,i.upperTranslation=0,i.enableMotor=!1,i.maxMotorForce=0,i.motorSpeed=0,i}return c(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},i}(Tn),Vn=function(e){function n(n){var r;return(r=e.call(this,n)||this).m_localAnchorA=new Et,r.m_localAnchorB=new Et,r.m_localXAxisA=new Et,r.m_localYAxisA=new Et,r.m_referenceAngle=0,r.m_impulse=new wt(0,0,0),r.m_motorImpulse=0,r.m_lowerTranslation=0,r.m_upperTranslation=0,r.m_maxMotorForce=0,r.m_motorSpeed=0,r.m_enableLimit=!1,r.m_enableMotor=!1,r.m_limitState=t.b2LimitState.e_inactiveLimit,r.m_indexA=0,r.m_indexB=0,r.m_localCenterA=new Et,r.m_localCenterB=new Et,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_axis=new Et(0,0),r.m_perp=new Et(0,0),r.m_s1=0,r.m_s2=0,r.m_a1=0,r.m_a2=0,r.m_K=new Rt,r.m_K3=new Rt,r.m_K2=new xt,r.m_motorMass=0,r.m_qA=new It,r.m_qB=new It,r.m_lalcA=new Et,r.m_lalcB=new Et,r.m_rA=new Et,r.m_rB=new Et,r.m_localAnchorA.Copy(i(n.localAnchorA,Et.ZERO)),r.m_localAnchorB.Copy(i(n.localAnchorB,Et.ZERO)),r.m_localXAxisA.Copy(i(n.localAxisA,new Et(1,0))).SelfNormalize(),Et.CrossOneV(r.m_localXAxisA,r.m_localYAxisA),r.m_referenceAngle=i(n.referenceAngle,0),r.m_lowerTranslation=i(n.lowerTranslation,0),r.m_upperTranslation=i(n.upperTranslation,0),r.m_maxMotorForce=i(n.maxMotorForce,0),r.m_motorSpeed=i(n.motorSpeed,0),r.m_enableLimit=i(n.enableLimit,!1),r.m_enableMotor=i(n.enableMotor,!1),r}c(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(r),_=this.m_qB.SetAngle(h);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var d=It.MulRV(c,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p=It.MulRV(_,this.m_lalcB,this.m_rB),m=Et.AddVV(Et.SubVV(o,i,Et.s_t0),Et.SubVV(p,d,Et.s_t1),n.InitVelocityConstraints_s_d),g=this.m_invMassA,y=this.m_invMassB,v=this.m_invIA,A=this.m_invIB;if(It.MulRV(c,this.m_localXAxisA,this.m_axis),this.m_a1=Et.CrossVV(Et.AddVV(m,d,Et.s_t0),this.m_axis),this.m_a2=Et.CrossVV(p,this.m_axis),this.m_motorMass=g+y+v*this.m_a1*this.m_a1+A*this.m_a2*this.m_a2,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass),It.MulRV(c,this.m_localYAxisA,this.m_perp),this.m_s1=Et.CrossVV(Et.AddVV(m,d,Et.s_t0),this.m_perp),this.m_s2=Et.CrossVV(p,this.m_perp),this.m_K.ex.x=g+y+v*this.m_s1*this.m_s1+A*this.m_s2*this.m_s2,this.m_K.ex.y=v*this.m_s1+A*this.m_s2,this.m_K.ex.z=v*this.m_s1*this.m_a1+A*this.m_s2*this.m_a2,this.m_K.ey.x=this.m_K.ex.y,this.m_K.ey.y=v+A,0===this.m_K.ey.y&&(this.m_K.ey.y=1),this.m_K.ey.z=v*this.m_a1+A*this.m_a2,this.m_K.ez.x=this.m_K.ex.z,this.m_K.ez.y=this.m_K.ey.z,this.m_K.ez.z=g+y+v*this.m_a1*this.m_a1+A*this.m_a2*this.m_a2,this.m_enableLimit){var S=Et.DotVV(this.m_axis,m);nt(this.m_upperTranslation-this.m_lowerTranslation)<2*f?this.m_limitState=t.b2LimitState.e_equalLimits:S<=this.m_lowerTranslation?this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_limitState=t.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):S>=this.m_upperTranslation?this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_limitState=t.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0;if(this.m_enableMotor||(this.m_motorImpulse=0),e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var b=Et.AddVV(Et.MulSV(this.m_impulse.x,this.m_perp,Et.s_t0),Et.MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,Et.s_t1),n.InitVelocityConstraints_s_P),T=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,E=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2;s.SelfMulSub(g,b),a-=v*T,u.SelfMulAdd(y,b),l+=A*E}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=l},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits){var c=Et.DotVV(this.m_axis,Et.SubVV(s,i,Et.s_t0))+this.m_a2*a-this.m_a1*r,_=this.m_motorMass*(this.m_motorSpeed-c),f=this.m_motorImpulse,d=e.step.dt*this.m_maxMotorForce;this.m_motorImpulse=at(this.m_motorImpulse+_,-d,d),_=this.m_motorImpulse-f;var p=Et.MulSV(_,this.m_axis,n.SolveVelocityConstraints_s_P),m=_*this.m_a1,g=_*this.m_a2;i.SelfMulSub(o,p),r-=u*m,s.SelfMulAdd(h,p),a+=l*g}var y=Et.DotVV(this.m_perp,Et.SubVV(s,i,Et.s_t0))+this.m_s2*a-this.m_s1*r,v=a-r;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit){var A=Et.DotVV(this.m_axis,Et.SubVV(s,i,Et.s_t0))+this.m_a2*a-this.m_a1*r,S=n.SolveVelocityConstraints_s_f1.Copy(this.m_impulse),b=this.m_K.Solve33(-y,-v,-A,n.SolveVelocityConstraints_s_df3);this.m_impulse.SelfAdd(b),this.m_limitState===t.b2LimitState.e_atLowerLimit?this.m_impulse.z=st(this.m_impulse.z,0):this.m_limitState===t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=rt(this.m_impulse.z,0));var T=-y-(this.m_impulse.z-S.z)*this.m_K.ez.x,E=-v-(this.m_impulse.z-S.z)*this.m_K.ez.y,C=this.m_K.Solve22(T,E,n.SolveVelocityConstraints_s_f2r);C.x+=S.x,C.y+=S.y,this.m_impulse.x=C.x,this.m_impulse.y=C.y,b.x=this.m_impulse.x-S.x,b.y=this.m_impulse.y-S.y,b.z=this.m_impulse.z-S.z;var w=Et.AddVV(Et.MulSV(b.x,this.m_perp,Et.s_t0),Et.MulSV(b.z,this.m_axis,Et.s_t1),n.SolveVelocityConstraints_s_P),x=b.x*this.m_s1+b.y+b.z*this.m_a1,R=b.x*this.m_s2+b.y+b.z*this.m_a2;i.SelfMulSub(o,w),r-=u*x,s.SelfMulAdd(h,w),a+=l*R}else{var I=this.m_K.Solve22(-y,-v,n.SolveVelocityConstraints_s_df2);this.m_impulse.x+=I.x,this.m_impulse.y+=I.y;var B=Et.MulSV(I.x,this.m_perp,n.SolveVelocityConstraints_s_P),D=I.x*this.m_s1+I.y,P=I.x*this.m_s2+I.y;i.SelfMulSub(o,B),r-=u*D,s.SelfMulAdd(h,B),a+=l*P}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,l=this.m_invIA,c=this.m_invIB,_=It.MulRV(a,this.m_lalcA,this.m_rA),p=It.MulRV(o,this.m_lalcB,this.m_rB),m=Et.SubVV(Et.AddVV(r,p,Et.s_t0),Et.AddVV(e,_,Et.s_t1),n.SolvePositionConstraints_s_d),g=It.MulRV(a,this.m_localXAxisA,this.m_axis),y=Et.CrossVV(Et.AddVV(m,_,Et.s_t0),g),v=Et.CrossVV(p,g),A=It.MulRV(a,this.m_localYAxisA,this.m_perp),b=Et.CrossVV(Et.AddVV(m,_,Et.s_t0),A),T=Et.CrossVV(p,A),E=n.SolvePositionConstraints_s_impulse,C=Et.DotVV(A,m),w=s-i-this.m_referenceAngle,x=nt(C),R=nt(w),I=!1,B=0;if(this.m_enableLimit){var D=Et.DotVV(g,m);nt(this.m_upperTranslation-this.m_lowerTranslation)<2*f?(B=at(D,-S,S),x=st(x,nt(D)),I=!0):D<=this.m_lowerTranslation?(B=at(D-this.m_lowerTranslation+f,-S,0),x=st(x,this.m_lowerTranslation-D),I=!0):D>=this.m_upperTranslation&&(B=at(D-this.m_upperTranslation-f,0,S),x=st(x,D-this.m_upperTranslation),I=!0)}if(I){var P=h+u+l*b*b+c*T*T,M=l*b+c*T,O=l*b*y+c*T*v,F=l+c;0===F&&(F=1);var N=l*y+c*v,L=h+u+l*y*y+c*v*v,V=this.m_K3;V.ex.SetXYZ(P,M,O),V.ey.SetXYZ(M,F,N),V.ez.SetXYZ(O,N,L),E=V.Solve33(-C,-w,-B,E)}else{var k=h+u+l*b*b+c*T*T,G=l*b+c*T,U=l+c;0===U&&(U=1);var z=this.m_K2;z.ex.Set(k,G),z.ey.Set(G,U);var H=z.Solve(-C,-w,n.SolvePositionConstraints_s_impulse1);E.x=H.x,E.y=H.y,E.z=0}var W=Et.AddVV(Et.MulSV(E.x,A,Et.s_t0),Et.MulSV(E.z,g,Et.s_t1),n.SolvePositionConstraints_s_P),X=E.x*b+E.y+E.z*y,j=E.x*T+E.y+E.z*v;return e.SelfMulSub(h,W),i-=l*X,r.SelfMulAdd(u,W),s+=c*j,t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,x<=f&&R<=d},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),e.y=t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y),e},r.GetReactionTorque=function(t){return t*this.m_impulse.y},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetLocalAxisA=function(){return this.m_localXAxisA},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointTranslation=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,n.GetJointTranslation_s_pA),e=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,n.GetJointTranslation_s_pB),i=Et.SubVV(e,t,n.GetJointTranslation_s_d),r=this.m_bodyA.GetWorldVector(this.m_localXAxisA,n.GetJointTranslation_s_axis);return Et.DotVV(i,r)},r.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;Et.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=It.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=It.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=Et.AddVV(t.m_sweep.c,i,Et.s_t0),s=Et.AddVV(e.m_sweep.c,n,Et.s_t1),a=Et.SubVV(s,r,Et.s_t2),o=t.GetWorldVector(this.m_localXAxisA,this.m_axis),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return Et.DotVV(a,Et.CrossSV(l,o,Et.s_t0))+Et.DotVV(o,Et.SubVV(Et.AddVCrossSV(u,c,n,Et.s_t0),Et.AddVCrossSV(h,l,i,Et.s_t1),Et.s_t0))},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerTranslation},r.GetUpperLimit=function(){return this.m_upperTranslation},r.SetLimits=function(t,e){t===this.m_lowerTranslation&&e===this.m_upperTranslation||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e,this.m_impulse.z=0)},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorForce=function(t){t!==this.m_maxMotorForce&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t)},r.GetMaxMotorForce=function(){return this.m_maxMotorForce},r.GetMotorForce=function(t){return t*this.m_motorImpulse},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2PrismaticJointDef = new b2PrismaticJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation),t(" jd.upperTranslation = %.15f;\n",this.m_upperTranslation),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(En);Vn.InitVelocityConstraints_s_d=new Et,Vn.InitVelocityConstraints_s_P=new Et,Vn.SolveVelocityConstraints_s_P=new Et,Vn.SolveVelocityConstraints_s_f2r=new Et,Vn.SolveVelocityConstraints_s_f1=new wt,Vn.SolveVelocityConstraints_s_df3=new wt,Vn.SolveVelocityConstraints_s_df2=new Et,Vn.SolvePositionConstraints_s_d=new Et,Vn.SolvePositionConstraints_s_impulse=new wt,Vn.SolvePositionConstraints_s_impulse1=new Et,Vn.SolvePositionConstraints_s_P=new Et,Vn.GetJointTranslation_s_pA=new Et,Vn.GetJointTranslation_s_pB=new Et,Vn.GetJointTranslation_s_d=new Et,Vn.GetJointTranslation_s_axis=new Et;var kn=2,Gn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_pulleyJoint)||this).groundAnchorA=new Et(-1,1),i.groundAnchorB=new Et(1,1),i.localAnchorA=new Et(-1,0),i.localAnchorB=new Et(1,0),i.lengthA=0,i.lengthB=0,i.ratio=1,i.collideConnected=!0,i}return c(i,e),i.prototype.Initialize=function(t,e,i,n,r,s,a){this.bodyA=t,this.bodyB=e,this.groundAnchorA.Copy(i),this.groundAnchorB.Copy(n),this.bodyA.GetLocalPoint(r,this.localAnchorA),this.bodyB.GetLocalPoint(s,this.localAnchorB),this.lengthA=Et.DistanceVV(r,i),this.lengthB=Et.DistanceVV(s,n),this.ratio=a},i}(Tn),Un=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_groundAnchorA=new Et,n.m_groundAnchorB=new Et,n.m_lengthA=0,n.m_lengthB=0,n.m_localAnchorA=new Et,n.m_localAnchorB=new Et,n.m_constant=0,n.m_ratio=0,n.m_impulse=0,n.m_indexA=0,n.m_indexB=0,n.m_uA=new Et,n.m_uB=new Et,n.m_rA=new Et,n.m_rB=new Et,n.m_localCenterA=new Et,n.m_localCenterB=new Et,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_mass=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new Et,n.m_lalcB=new Et,n.m_groundAnchorA.Copy(i(e.groundAnchorA,new Et(-1,1))),n.m_groundAnchorB.Copy(i(e.groundAnchorB,new Et(1,0))),n.m_localAnchorA.Copy(i(e.localAnchorA,new Et(-1,0))),n.m_localAnchorB.Copy(i(e.localAnchorB,new Et(1,0))),n.m_lengthA=i(e.lengthA,0),n.m_lengthB=i(e.lengthB,0),n.m_ratio=i(e.ratio,1),n.m_constant=i(e.lengthA,0)+n.m_ratio*i(e.lengthB,0),n.m_impulse=0,n}c(e,t);var n=e.prototype;return n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.velocities[this.m_indexA].v,s=t.velocities[this.m_indexA].w,a=t.positions[this.m_indexB].c,o=t.positions[this.m_indexB].a,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=this.m_qA.SetAngle(n),c=this.m_qB.SetAngle(o);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(l,this.m_lalcA,this.m_rA),Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(c,this.m_lalcB,this.m_rB),this.m_uA.Copy(i).SelfAdd(this.m_rA).SelfSub(this.m_groundAnchorA),this.m_uB.Copy(a).SelfAdd(this.m_rB).SelfSub(this.m_groundAnchorB);var _=this.m_uA.Length(),d=this.m_uB.Length();_>10*f?this.m_uA.SelfMul(1/_):this.m_uA.SetZero(),d>10*f?this.m_uB.SelfMul(1/d):this.m_uB.SetZero();var p=Et.CrossVV(this.m_rA,this.m_uA),m=Et.CrossVV(this.m_rB,this.m_uB),g=this.m_invMassA+this.m_invIA*p*p,y=this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=g+this.m_ratio*this.m_ratio*y,this.m_mass>0&&(this.m_mass=1/this.m_mass),t.step.warmStarting){this.m_impulse*=t.step.dtRatio;var v=Et.MulSV(-this.m_impulse,this.m_uA,e.InitVelocityConstraints_s_PA),A=Et.MulSV(-this.m_ratio*this.m_impulse,this.m_uB,e.InitVelocityConstraints_s_PB);r.SelfMulAdd(this.m_invMassA,v),s+=this.m_invIA*Et.CrossVV(this.m_rA,v),h.SelfMulAdd(this.m_invMassB,A),u+=this.m_invIB*Et.CrossVV(this.m_rB,A)}else this.m_impulse=0;t.velocities[this.m_indexA].w=s,t.velocities[this.m_indexB].w=u},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=Et.AddVCrossSV(i,n,this.m_rA,e.SolveVelocityConstraints_s_vpA),o=Et.AddVCrossSV(r,s,this.m_rB,e.SolveVelocityConstraints_s_vpB),h=-Et.DotVV(this.m_uA,a)-this.m_ratio*Et.DotVV(this.m_uB,o),u=-this.m_mass*h;this.m_impulse+=u;var l=Et.MulSV(-u,this.m_uA,e.SolveVelocityConstraints_s_PA),c=Et.MulSV(-this.m_ratio*u,this.m_uB,e.SolveVelocityConstraints_s_PB);i.SelfMulAdd(this.m_invMassA,l),n+=this.m_invIA*Et.CrossVV(this.m_rA,l),r.SelfMulAdd(this.m_invMassB,c),s+=this.m_invIB*Et.CrossVV(this.m_rB,c),t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=It.MulRV(a,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=It.MulRV(o,this.m_lalcB,this.m_rB),l=this.m_uA.Copy(i).SelfAdd(h).SelfSub(this.m_groundAnchorA),c=this.m_uB.Copy(r).SelfAdd(u).SelfSub(this.m_groundAnchorB),_=l.Length(),d=c.Length();_>10*f?l.SelfMul(1/_):l.SetZero(),d>10*f?c.SelfMul(1/d):c.SetZero();var p=Et.CrossVV(h,l),m=Et.CrossVV(u,c),g=this.m_invMassA+this.m_invIA*p*p,y=this.m_invMassB+this.m_invIB*m*m,v=g+this.m_ratio*this.m_ratio*y;v>0&&(v=1/v);var A=this.m_constant-_-this.m_ratio*d,S=nt(A),b=-v*A,T=Et.MulSV(-b,l,e.SolvePositionConstraints_s_PA),E=Et.MulSV(-this.m_ratio*b,c,e.SolvePositionConstraints_s_PB);return i.SelfMulAdd(this.m_invMassA,T),n+=this.m_invIA*Et.CrossVV(h,T),r.SelfMulAdd(this.m_invMassB,E),s+=this.m_invIB*Et.CrossVV(u,E),t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,S0&&(this.m_motorMass=1/this.m_motorMass),this.m_enableMotor&&!m||(this.m_motorImpulse=0),this.m_enableLimit&&!m){var g=a-i-this.m_referenceAngle;nt(this.m_upperAngle-this.m_lowerAngle)<2*d?this.m_limitState=t.b2LimitState.e_equalLimits:g<=this.m_lowerAngle?(this.m_limitState!==t.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atLowerLimit):g>=this.m_upperAngle?(this.m_limitState!==t.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=t.b2LimitState.e_atUpperLimit):(this.m_limitState=t.b2LimitState.e_inactiveLimit,this.m_impulse.z=0)}else this.m_limitState=t.b2LimitState.e_inactiveLimit;if(e.step.warmStarting){this.m_impulse.SelfMul(e.step.dtRatio),this.m_motorImpulse*=e.step.dtRatio;var y=n.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);r.SelfMulSub(c,y),s-=f*(Et.CrossVV(this.m_rA,y)+this.m_motorImpulse+this.m_impulse.z),o.SelfMulAdd(_,y),h+=p*(Et.CrossVV(this.m_rB,y)+this.m_motorImpulse+this.m_impulse.z)}else this.m_impulse.SetZero(),this.m_motorImpulse=0;e.velocities[this.m_indexA].w=s,e.velocities[this.m_indexB].w=h},r.SolveVelocityConstraints=function(e){var i=e.velocities[this.m_indexA].v,r=e.velocities[this.m_indexA].w,s=e.velocities[this.m_indexB].v,a=e.velocities[this.m_indexB].w,o=this.m_invMassA,h=this.m_invMassB,u=this.m_invIA,l=this.m_invIB,c=u+l===0;if(this.m_enableMotor&&this.m_limitState!==t.b2LimitState.e_equalLimits&&!c){var _=a-r-this.m_motorSpeed,f=-this.m_motorMass*_,d=this.m_motorImpulse,p=e.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=at(this.m_motorImpulse+f,-p,p),r-=u*(f=this.m_motorImpulse-d),a+=l*f}if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var m=Et.SubVV(Et.AddVCrossSV(s,a,this.m_rB,Et.s_t0),Et.AddVCrossSV(i,r,this.m_rA,Et.s_t1),n.SolveVelocityConstraints_s_Cdot1),g=a-r,y=this.m_mass.Solve33(m.x,m.y,g,n.SolveVelocityConstraints_s_impulse_v3).SelfNeg();if(this.m_limitState===t.b2LimitState.e_equalLimits)this.m_impulse.SelfAdd(y);else if(this.m_limitState===t.b2LimitState.e_atLowerLimit)if(this.m_impulse.z+y.z<0){var v=-m.x+this.m_impulse.z*this.m_mass.ez.x,A=-m.y+this.m_impulse.z*this.m_mass.ez.y,S=this.m_mass.Solve22(v,A,n.SolveVelocityConstraints_s_reduced_v2);y.x=S.x,y.y=S.y,y.z=-this.m_impulse.z,this.m_impulse.x+=S.x,this.m_impulse.y+=S.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(y);else if(this.m_limitState===t.b2LimitState.e_atUpperLimit)if(this.m_impulse.z+y.z>0){var b=-m.x+this.m_impulse.z*this.m_mass.ez.x,T=-m.y+this.m_impulse.z*this.m_mass.ez.y,E=this.m_mass.Solve22(b,T,n.SolveVelocityConstraints_s_reduced_v2);y.x=E.x,y.y=E.y,y.z=-this.m_impulse.z,this.m_impulse.x+=E.x,this.m_impulse.y+=E.y,this.m_impulse.z=0}else this.m_impulse.SelfAdd(y);var C=n.SolveVelocityConstraints_s_P.Set(y.x,y.y);i.SelfMulSub(o,C),r-=u*(Et.CrossVV(this.m_rA,C)+y.z),s.SelfMulAdd(h,C),a+=l*(Et.CrossVV(this.m_rB,C)+y.z)}else{var w=Et.SubVV(Et.AddVCrossSV(s,a,this.m_rB,Et.s_t0),Et.AddVCrossSV(i,r,this.m_rA,Et.s_t1),n.SolveVelocityConstraints_s_Cdot_v2),x=this.m_mass.Solve22(-w.x,-w.y,n.SolveVelocityConstraints_s_impulse_v2);this.m_impulse.x+=x.x,this.m_impulse.y+=x.y,i.SelfMulSub(o,x),r-=u*Et.CrossVV(this.m_rA,x),s.SelfMulAdd(h,x),a+=l*Et.CrossVV(this.m_rB,x)}e.velocities[this.m_indexA].w=r,e.velocities[this.m_indexB].w=a},r.SolvePositionConstraints=function(e){var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.positions[this.m_indexB].c,a=e.positions[this.m_indexB].a,o=this.m_qA.SetAngle(r),h=this.m_qB.SetAngle(a),u=0,l=0,c=this.m_invIA+this.m_invIB===0;if(this.m_enableLimit&&this.m_limitState!==t.b2LimitState.e_inactiveLimit&&!c){var _=a-r-this.m_referenceAngle,p=0;if(this.m_limitState===t.b2LimitState.e_equalLimits){var m=at(_-this.m_lowerAngle,-b,b);p=-this.m_motorMass*m,u=nt(m)}else if(this.m_limitState===t.b2LimitState.e_atLowerLimit){var g=_-this.m_lowerAngle;u=-g,g=at(g+d,-b,0),p=-this.m_motorMass*g}else if(this.m_limitState===t.b2LimitState.e_atUpperLimit){var y=_-this.m_upperAngle;u=y,y=at(y-d,0,b),p=-this.m_motorMass*y}r-=this.m_invIA*p,a+=this.m_invIB*p}o.SetAngle(r),h.SetAngle(a),Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var v=It.MulRV(o,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var A=It.MulRV(h,this.m_lalcB,this.m_rB),S=Et.SubVV(Et.AddVV(s,A,Et.s_t0),Et.AddVV(i,v,Et.s_t1),n.SolvePositionConstraints_s_C_v2);l=S.Length();var T=this.m_invMassA,E=this.m_invMassB,C=this.m_invIA,w=this.m_invIB,x=this.m_K;x.ex.x=T+E+C*v.y*v.y+w*A.y*A.y,x.ex.y=-C*v.x*v.y-w*A.x*A.y,x.ey.x=x.ex.y,x.ey.y=T+E+C*v.x*v.x+w*A.x*A.x;var R=x.Solve(S.x,S.y,n.SolvePositionConstraints_s_impulse).SelfNeg();return i.SelfMulSub(T,R),r-=C*Et.CrossVV(v,R),s.SelfMulAdd(E,R),a+=w*Et.CrossVV(A,R),e.positions[this.m_indexA].a=r,e.positions[this.m_indexB].a=a,l<=f&&u<=d},r.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},r.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},r.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},r.GetReactionTorque=function(t){return t*this.m_impulse.z},r.GetLocalAnchorA=function(){return this.m_localAnchorA},r.GetLocalAnchorB=function(){return this.m_localAnchorB},r.GetReferenceAngle=function(){return this.m_referenceAngle},r.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},r.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},r.IsMotorEnabled=function(){return this.m_enableMotor},r.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},r.GetMotorTorque=function(t){return t*this.m_motorImpulse},r.GetMotorSpeed=function(){return this.m_motorSpeed},r.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},r.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},r.IsLimitEnabled=function(){return this.m_enableLimit},r.EnableLimit=function(t){t!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t,this.m_impulse.z=0)},r.GetLowerLimit=function(){return this.m_lowerAngle},r.GetUpperLimit=function(){return this.m_upperAngle},r.SetLimits=function(t,e){t===this.m_lowerAngle&&e===this.m_upperAngle||(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=t,this.m_upperAngle=e)},r.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},r.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2RevoluteJointDef = new b2RevoluteJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false"),t(" jd.lowerAngle = %.15f;\n",this.m_lowerAngle),t(" jd.upperAngle = %.15f;\n",this.m_upperAngle),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},n}(En);Hn.InitVelocityConstraints_s_P=new Et,Hn.SolveVelocityConstraints_s_P=new Et,Hn.SolveVelocityConstraints_s_Cdot_v2=new Et,Hn.SolveVelocityConstraints_s_Cdot1=new Et,Hn.SolveVelocityConstraints_s_impulse_v3=new wt,Hn.SolveVelocityConstraints_s_reduced_v2=new Et,Hn.SolveVelocityConstraints_s_impulse_v2=new Et,Hn.SolvePositionConstraints_s_C_v2=new Et,Hn.SolvePositionConstraints_s_impulse=new Et;var Wn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_ropeJoint)||this).localAnchorA=new Et(-1,0),i.localAnchorB=new Et(1,0),i.maxLength=0,i}return c(i,e),i}(Tn),Xn=function(e){function n(n){var r;return(r=e.call(this,n)||this).m_localAnchorA=new Et,r.m_localAnchorB=new Et,r.m_maxLength=0,r.m_length=0,r.m_impulse=0,r.m_indexA=0,r.m_indexB=0,r.m_u=new Et,r.m_rA=new Et,r.m_rB=new Et,r.m_localCenterA=new Et,r.m_localCenterB=new Et,r.m_invMassA=0,r.m_invMassB=0,r.m_invIA=0,r.m_invIB=0,r.m_mass=0,r.m_state=t.b2LimitState.e_inactiveLimit,r.m_qA=new It,r.m_qB=new It,r.m_lalcA=new Et,r.m_lalcB=new Et,r.m_localAnchorA.Copy(i(n.localAnchorA,new Et(-1,0))),r.m_localAnchorB.Copy(i(n.localAnchorB,new Et(1,0))),r.m_maxLength=i(n.maxLength,0),r}c(n,e);var r=n.prototype;return r.InitVelocityConstraints=function(e){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=e.positions[this.m_indexA].c,r=e.positions[this.m_indexA].a,s=e.velocities[this.m_indexA].v,a=e.velocities[this.m_indexA].w,o=e.positions[this.m_indexB].c,h=e.positions[this.m_indexB].a,u=e.velocities[this.m_indexB].v,l=e.velocities[this.m_indexB].w,c=this.m_qA.SetAngle(r),_=this.m_qB.SetAngle(h);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA),It.MulRV(c,this.m_lalcA,this.m_rA),Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB),It.MulRV(_,this.m_lalcB,this.m_rB),this.m_u.Copy(o).SelfAdd(this.m_rB).SelfSub(i).SelfSub(this.m_rA),this.m_length=this.m_u.Length();var d=this.m_length-this.m_maxLength;if(this.m_state=d>0?t.b2LimitState.e_atUpperLimit:t.b2LimitState.e_inactiveLimit,!(this.m_length>f))return this.m_u.SetZero(),this.m_mass=0,void(this.m_impulse=0);this.m_u.SelfMul(1/this.m_length);var p=Et.CrossVV(this.m_rA,this.m_u),m=Et.CrossVV(this.m_rB,this.m_u),g=this.m_invMassA+this.m_invIA*p*p+this.m_invMassB+this.m_invIB*m*m;if(this.m_mass=0!==g?1/g:0,e.step.warmStarting){this.m_impulse*=e.step.dtRatio;var y=Et.MulSV(this.m_impulse,this.m_u,n.InitVelocityConstraints_s_P);s.SelfMulSub(this.m_invMassA,y),a-=this.m_invIA*Et.CrossVV(this.m_rA,y),u.SelfMulAdd(this.m_invMassB,y),l+=this.m_invIB*Et.CrossVV(this.m_rB,y)}else this.m_impulse=0;e.velocities[this.m_indexA].w=a,e.velocities[this.m_indexB].w=l},r.SolveVelocityConstraints=function(t){var e=t.velocities[this.m_indexA].v,i=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=Et.AddVCrossSV(e,i,this.m_rA,n.SolveVelocityConstraints_s_vpA),o=Et.AddVCrossSV(r,s,this.m_rB,n.SolveVelocityConstraints_s_vpB),h=this.m_length-this.m_maxLength,u=Et.DotVV(this.m_u,Et.SubVV(o,a,Et.s_t0));h<0&&(u+=t.step.inv_dt*h);var l=-this.m_mass*u,c=this.m_impulse;this.m_impulse=rt(0,this.m_impulse+l),l=this.m_impulse-c;var _=Et.MulSV(l,this.m_u,n.SolveVelocityConstraints_s_P);e.SelfMulSub(this.m_invMassA,_),i-=this.m_invIA*Et.CrossVV(this.m_rA,_),r.SelfMulAdd(this.m_invMassB,_),s+=this.m_invIB*Et.CrossVV(this.m_rB,_),t.velocities[this.m_indexA].w=i,t.velocities[this.m_indexB].w=s},r.SolvePositionConstraints=function(t){var e=t.positions[this.m_indexA].c,i=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(i),o=this.m_qB.SetAngle(s);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=It.MulRV(a,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u=It.MulRV(o,this.m_lalcB,this.m_rB),l=this.m_u.Copy(r).SelfAdd(u).SelfSub(e).SelfSub(h),c=l.Normalize(),_=c-this.m_maxLength;_=at(_,0,S);var d=-this.m_mass*_,p=Et.MulSV(d,l,n.SolvePositionConstraints_s_P);return e.SelfMulSub(this.m_invMassA,p),i-=this.m_invIA*Et.CrossVV(h,p),r.SelfMulAdd(this.m_invMassB,p),s+=this.m_invIB*Et.CrossVV(u,p),t.positions[this.m_indexA].a=i,t.positions[this.m_indexB].a=s,c-this.m_maxLength0){p.GetInverse22(this.m_mass);var m=f+d,g=m>0?1/m:0,y=s-i-this.m_referenceAngle,v=2*a*this.m_frequencyHz,A=2*g*this.m_dampingRatio*v,S=g*v*v,b=t.step.dt;this.m_gamma=b*(A+b*S),this.m_gamma=0!==this.m_gamma?1/this.m_gamma:0,this.m_bias=y*b*S*this.m_gamma,m+=this.m_gamma,this.m_mass.ez.z=0!==m?1/m:0}else p.GetSymInverse33(this.m_mass),this.m_gamma=0,this.m_bias=0;if(t.step.warmStarting){this.m_impulse.SelfMul(t.step.dtRatio);var T=e.InitVelocityConstraints_s_P.Set(this.m_impulse.x,this.m_impulse.y);n.SelfMulSub(c,T),r-=f*(Et.CrossVV(this.m_rA,T)+this.m_impulse.z),o.SelfMulAdd(_,T),h+=d*(Et.CrossVV(this.m_rB,T)+this.m_impulse.z)}else this.m_impulse.SetZero();t.velocities[this.m_indexA].w=r,t.velocities[this.m_indexB].w=h},n.SolveVelocityConstraints=function(t){var i=t.velocities[this.m_indexA].v,n=t.velocities[this.m_indexA].w,r=t.velocities[this.m_indexB].v,s=t.velocities[this.m_indexB].w,a=this.m_invMassA,o=this.m_invMassB,h=this.m_invIA,u=this.m_invIB;if(this.m_frequencyHz>0){var l=s-n,c=-this.m_mass.ez.z*(l+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=c,n-=h*c,s+=u*c;var _=Et.SubVV(Et.AddVCrossSV(r,s,this.m_rB,Et.s_t0),Et.AddVCrossSV(i,n,this.m_rA,Et.s_t1),e.SolveVelocityConstraints_s_Cdot1),f=Rt.MulM33XY(this.m_mass,_.x,_.y,e.SolveVelocityConstraints_s_impulse1).SelfNeg();this.m_impulse.x+=f.x,this.m_impulse.y+=f.y;var d=f;i.SelfMulSub(a,d),n-=h*Et.CrossVV(this.m_rA,d),r.SelfMulAdd(o,d),s+=u*Et.CrossVV(this.m_rB,d)}else{var p=Et.SubVV(Et.AddVCrossSV(r,s,this.m_rB,Et.s_t0),Et.AddVCrossSV(i,n,this.m_rA,Et.s_t1),e.SolveVelocityConstraints_s_Cdot1),m=s-n,g=Rt.MulM33XYZ(this.m_mass,p.x,p.y,m,e.SolveVelocityConstraints_s_impulse).SelfNeg();this.m_impulse.SelfAdd(g);var y=e.SolveVelocityConstraints_s_P.Set(g.x,g.y);i.SelfMulSub(a,y),n-=h*(Et.CrossVV(this.m_rA,y)+g.z),r.SelfMulAdd(o,y),s+=u*(Et.CrossVV(this.m_rB,y)+g.z)}t.velocities[this.m_indexA].w=n,t.velocities[this.m_indexB].w=s},n.SolvePositionConstraints=function(t){var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s),h=this.m_invMassA,u=this.m_invMassB,l=this.m_invIA,c=this.m_invIB;Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var _=It.MulRV(a,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var p,m,g=It.MulRV(o,this.m_lalcB,this.m_rB),y=this.m_K;if(y.ex.x=h+u+_.y*_.y*l+g.y*g.y*c,y.ey.x=-_.y*_.x*l-g.y*g.x*c,y.ez.x=-_.y*l-g.y*c,y.ex.y=y.ey.x,y.ey.y=h+u+_.x*_.x*l+g.x*g.x*c,y.ez.y=_.x*l+g.x*c,y.ex.z=y.ez.x,y.ey.z=y.ez.y,y.ez.z=l+c,this.m_frequencyHz>0){var v=Et.SubVV(Et.AddVV(r,g,Et.s_t0),Et.AddVV(i,_,Et.s_t1),e.SolvePositionConstraints_s_C1);p=v.Length(),m=0;var A=y.Solve22(v.x,v.y,e.SolvePositionConstraints_s_P).SelfNeg();i.SelfMulSub(h,A),n-=l*Et.CrossVV(_,A),r.SelfMulAdd(u,A),s+=c*Et.CrossVV(g,A)}else{var S=Et.SubVV(Et.AddVV(r,g,Et.s_t0),Et.AddVV(i,_,Et.s_t1),e.SolvePositionConstraints_s_C1),b=s-n-this.m_referenceAngle;p=S.Length(),m=nt(b);var T=y.Solve33(S.x,S.y,b,e.SolvePositionConstraints_s_impulse).SelfNeg(),E=e.SolvePositionConstraints_s_P.Set(T.x,T.y);i.SelfMulSub(h,E),n-=l*(Et.CrossVV(this.m_rA,E)+T.z),r.SelfMulAdd(u,E),s+=c*(Et.CrossVV(this.m_rB,E)+T.z)}return t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,p<=f&&m<=d},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*this.m_impulse.x,e.y=t*this.m_impulse.y,e},n.GetReactionTorque=function(t){return t*this.m_impulse.z},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetReferenceAngle=function(){return this.m_referenceAngle},n.SetFrequency=function(t){this.m_frequencyHz=t},n.GetFrequency=function(){return this.m_frequencyHz},n.SetDampingRatio=function(t){this.m_dampingRatio=t},n.GetDampingRatio=function(){return this.m_dampingRatio},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WeldJointDef = new b2WeldJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.referenceAngle = %.15f;\n",this.m_referenceAngle),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(En);Yn.InitVelocityConstraints_s_P=new Et,Yn.SolveVelocityConstraints_s_Cdot1=new Et,Yn.SolveVelocityConstraints_s_impulse1=new Et,Yn.SolveVelocityConstraints_s_impulse=new wt,Yn.SolveVelocityConstraints_s_P=new Et,Yn.SolvePositionConstraints_s_C1=new Et,Yn.SolvePositionConstraints_s_P=new Et,Yn.SolvePositionConstraints_s_impulse=new wt;var qn=function(e){function i(){var i;return(i=e.call(this,t.b2JointType.e_wheelJoint)||this).localAnchorA=new Et(0,0),i.localAnchorB=new Et(0,0),i.localAxisA=new Et(1,0),i.enableMotor=!1,i.maxMotorTorque=0,i.motorSpeed=0,i.frequencyHz=2,i.dampingRatio=.7,i}return c(i,e),i.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.bodyA.GetLocalPoint(i,this.localAnchorA),this.bodyB.GetLocalPoint(i,this.localAnchorB),this.bodyA.GetLocalVector(n,this.localAxisA)},i}(Tn),Kn=function(t){function e(e){var n;return(n=t.call(this,e)||this).m_frequencyHz=0,n.m_dampingRatio=0,n.m_localAnchorA=new Et,n.m_localAnchorB=new Et,n.m_localXAxisA=new Et,n.m_localYAxisA=new Et,n.m_impulse=0,n.m_motorImpulse=0,n.m_springImpulse=0,n.m_maxMotorTorque=0,n.m_motorSpeed=0,n.m_enableMotor=!1,n.m_indexA=0,n.m_indexB=0,n.m_localCenterA=new Et,n.m_localCenterB=new Et,n.m_invMassA=0,n.m_invMassB=0,n.m_invIA=0,n.m_invIB=0,n.m_ax=new Et,n.m_ay=new Et,n.m_sAx=0,n.m_sBx=0,n.m_sAy=0,n.m_sBy=0,n.m_mass=0,n.m_motorMass=0,n.m_springMass=0,n.m_bias=0,n.m_gamma=0,n.m_qA=new It,n.m_qB=new It,n.m_lalcA=new Et,n.m_lalcB=new Et,n.m_rA=new Et,n.m_rB=new Et,n.m_frequencyHz=i(e.frequencyHz,2),n.m_dampingRatio=i(e.dampingRatio,.7),n.m_localAnchorA.Copy(i(e.localAnchorA,Et.ZERO)),n.m_localAnchorB.Copy(i(e.localAnchorB,Et.ZERO)),n.m_localXAxisA.Copy(i(e.localAxisA,Et.UNITX)),Et.CrossOneV(n.m_localXAxisA,n.m_localYAxisA),n.m_maxMotorTorque=i(e.maxMotorTorque,0),n.m_motorSpeed=i(e.motorSpeed,0),n.m_enableMotor=i(e.enableMotor,!1),n.m_ax.SetZero(),n.m_ay.SetZero(),n}c(e,t);var n=e.prototype;return n.GetMotorSpeed=function(){return this.m_motorSpeed},n.GetMaxMotorTorque=function(){return this.m_maxMotorTorque},n.SetSpringFrequencyHz=function(t){this.m_frequencyHz=t},n.GetSpringFrequencyHz=function(){return this.m_frequencyHz},n.SetSpringDampingRatio=function(t){this.m_dampingRatio=t},n.GetSpringDampingRatio=function(){return this.m_dampingRatio},n.InitVelocityConstraints=function(t){this.m_indexA=this.m_bodyA.m_islandIndex,this.m_indexB=this.m_bodyB.m_islandIndex,this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter),this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter),this.m_invMassA=this.m_bodyA.m_invMass,this.m_invMassB=this.m_bodyB.m_invMass,this.m_invIA=this.m_bodyA.m_invI,this.m_invIB=this.m_bodyB.m_invI;var i=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,o=t.positions[this.m_indexA].c,h=t.positions[this.m_indexA].a,u=t.velocities[this.m_indexA].v,l=t.velocities[this.m_indexA].w,c=t.positions[this.m_indexB].c,_=t.positions[this.m_indexB].a,f=t.velocities[this.m_indexB].v,d=t.velocities[this.m_indexB].w,p=this.m_qA.SetAngle(h),m=this.m_qB.SetAngle(_);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var g=It.MulRV(p,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var y=It.MulRV(m,this.m_lalcB,this.m_rB),v=Et.SubVV(Et.AddVV(c,y,Et.s_t0),Et.AddVV(o,g,Et.s_t1),e.InitVelocityConstraints_s_d);if(It.MulRV(p,this.m_localYAxisA,this.m_ay),this.m_sAy=Et.CrossVV(Et.AddVV(v,g,Et.s_t0),this.m_ay),this.m_sBy=Et.CrossVV(y,this.m_ay),this.m_mass=i+n+r*this.m_sAy*this.m_sAy+s*this.m_sBy*this.m_sBy,this.m_mass>0&&(this.m_mass=1/this.m_mass),this.m_springMass=0,this.m_bias=0,this.m_gamma=0,this.m_frequencyHz>0){It.MulRV(p,this.m_localXAxisA,this.m_ax),this.m_sAx=Et.CrossVV(Et.AddVV(v,g,Et.s_t0),this.m_ax),this.m_sBx=Et.CrossVV(y,this.m_ax);var A=i+n+r*this.m_sAx*this.m_sAx+s*this.m_sBx*this.m_sBx;if(A>0){this.m_springMass=1/A;var S=Et.DotVV(v,this.m_ax),b=2*a*this.m_frequencyHz,T=2*this.m_springMass*this.m_dampingRatio*b,E=this.m_springMass*b*b,C=t.step.dt;this.m_gamma=C*(T+C*E),this.m_gamma>0&&(this.m_gamma=1/this.m_gamma),this.m_bias=S*C*E*this.m_gamma,this.m_springMass=A+this.m_gamma,this.m_springMass>0&&(this.m_springMass=1/this.m_springMass)}}else this.m_springImpulse=0;if(this.m_enableMotor?(this.m_motorMass=r+s,this.m_motorMass>0&&(this.m_motorMass=1/this.m_motorMass)):(this.m_motorMass=0,this.m_motorImpulse=0),t.step.warmStarting){this.m_impulse*=t.step.dtRatio,this.m_springImpulse*=t.step.dtRatio,this.m_motorImpulse*=t.step.dtRatio;var w=Et.AddVV(Et.MulSV(this.m_impulse,this.m_ay,Et.s_t0),Et.MulSV(this.m_springImpulse,this.m_ax,Et.s_t1),e.InitVelocityConstraints_s_P),x=this.m_impulse*this.m_sAy+this.m_springImpulse*this.m_sAx+this.m_motorImpulse,R=this.m_impulse*this.m_sBy+this.m_springImpulse*this.m_sBx+this.m_motorImpulse;u.SelfMulSub(this.m_invMassA,w),l-=this.m_invIA*x,f.SelfMulAdd(this.m_invMassB,w),d+=this.m_invIB*R}else this.m_impulse=0,this.m_springImpulse=0,this.m_motorImpulse=0;t.velocities[this.m_indexA].w=l,t.velocities[this.m_indexB].w=d},n.SolveVelocityConstraints=function(t){var i=this.m_invMassA,n=this.m_invMassB,r=this.m_invIA,s=this.m_invIB,a=t.velocities[this.m_indexA].v,o=t.velocities[this.m_indexA].w,h=t.velocities[this.m_indexB].v,u=t.velocities[this.m_indexB].w,l=Et.DotVV(this.m_ax,Et.SubVV(h,a,Et.s_t0))+this.m_sBx*u-this.m_sAx*o,c=-this.m_springMass*(l+this.m_bias+this.m_gamma*this.m_springImpulse);this.m_springImpulse+=c;var _=Et.MulSV(c,this.m_ax,e.SolveVelocityConstraints_s_P),f=c*this.m_sAx,d=c*this.m_sBx;a.SelfMulSub(i,_),o-=r*f,h.SelfMulAdd(n,_);var p=(u+=s*d)-o-this.m_motorSpeed,m=-this.m_motorMass*p,g=this.m_motorImpulse,y=t.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=at(this.m_motorImpulse+m,-y,y),o-=r*(m=this.m_motorImpulse-g),u+=s*m;var v=Et.DotVV(this.m_ay,Et.SubVV(h,a,Et.s_t0))+this.m_sBy*u-this.m_sAy*o,A=-this.m_mass*v;this.m_impulse+=A;var S=Et.MulSV(A,this.m_ay,e.SolveVelocityConstraints_s_P),b=A*this.m_sAy,T=A*this.m_sBy;a.SelfMulSub(i,S),o-=r*b,h.SelfMulAdd(n,S),u+=s*T,t.velocities[this.m_indexA].w=o,t.velocities[this.m_indexB].w=u},n.SolvePositionConstraints=function(t){var i=t.positions[this.m_indexA].c,n=t.positions[this.m_indexA].a,r=t.positions[this.m_indexB].c,s=t.positions[this.m_indexB].a,a=this.m_qA.SetAngle(n),o=this.m_qB.SetAngle(s);Et.SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var h=It.MulRV(a,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var u,l=It.MulRV(o,this.m_lalcB,this.m_rB),c=Et.AddVV(Et.SubVV(r,i,Et.s_t0),Et.SubVV(l,h,Et.s_t1),e.SolvePositionConstraints_s_d),_=It.MulRV(a,this.m_localYAxisA,this.m_ay),d=Et.CrossVV(Et.AddVV(c,h,Et.s_t0),_),p=Et.CrossVV(l,_),m=Et.DotVV(c,this.m_ay),g=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_sAy*this.m_sAy+this.m_invIB*this.m_sBy*this.m_sBy;u=0!==g?-m/g:0;var y=Et.MulSV(u,_,e.SolvePositionConstraints_s_P),v=u*d,A=u*p;return i.SelfMulSub(this.m_invMassA,y),n-=this.m_invIA*v,r.SelfMulAdd(this.m_invMassB,y),s+=this.m_invIB*A,t.positions[this.m_indexA].a=n,t.positions[this.m_indexB].a=s,nt(m)<=f},n.GetDefinition=function(t){return t},n.GetAnchorA=function(t){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,t)},n.GetAnchorB=function(t){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,t)},n.GetReactionForce=function(t,e){return e.x=t*(this.m_impulse*this.m_ay.x+this.m_springImpulse*this.m_ax.x),e.y=t*(this.m_impulse*this.m_ay.y+this.m_springImpulse*this.m_ax.y),e},n.GetReactionTorque=function(t){return t*this.m_motorImpulse},n.GetLocalAnchorA=function(){return this.m_localAnchorA},n.GetLocalAnchorB=function(){return this.m_localAnchorB},n.GetLocalAxisA=function(){return this.m_localXAxisA},n.GetJointTranslation=function(){return this.GetPrismaticJointTranslation()},n.GetJointLinearSpeed=function(){return this.GetPrismaticJointSpeed()},n.GetJointAngle=function(){return this.GetRevoluteJointAngle()},n.GetJointAngularSpeed=function(){return this.GetRevoluteJointSpeed()},n.GetPrismaticJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchorA,new Et),n=e.GetWorldPoint(this.m_localAnchorB,new Et),r=Et.SubVV(n,i,new Et),s=t.GetWorldVector(this.m_localXAxisA,new Et);return Et.DotVV(r,s)},n.GetPrismaticJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB;Et.SubVV(this.m_localAnchorA,t.m_sweep.localCenter,this.m_lalcA);var i=It.MulRV(t.m_xf.q,this.m_lalcA,this.m_rA);Et.SubVV(this.m_localAnchorB,e.m_sweep.localCenter,this.m_lalcB);var n=It.MulRV(e.m_xf.q,this.m_lalcB,this.m_rB),r=Et.AddVV(t.m_sweep.c,i,Et.s_t0),s=Et.AddVV(e.m_sweep.c,n,Et.s_t1),a=Et.SubVV(s,r,Et.s_t2),o=t.GetWorldVector(this.m_localXAxisA,new Et),h=t.m_linearVelocity,u=e.m_linearVelocity,l=t.m_angularVelocity,c=e.m_angularVelocity;return Et.DotVV(a,Et.CrossSV(l,o,Et.s_t0))+Et.DotVV(o,Et.SubVV(Et.AddVCrossSV(u,c,n,Et.s_t0),Et.AddVCrossSV(h,l,i,Et.s_t1),Et.s_t0))},n.GetRevoluteJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a},n.GetRevoluteJointSpeed=function(){var t=this.m_bodyA.m_angularVelocity;return this.m_bodyB.m_angularVelocity-t},n.IsMotorEnabled=function(){return this.m_enableMotor},n.EnableMotor=function(t){t!==this.m_enableMotor&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t)},n.SetMotorSpeed=function(t){t!==this.m_motorSpeed&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t)},n.SetMaxMotorTorque=function(t){t!==this.m_maxMotorTorque&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorTorque=t)},n.GetMotorTorque=function(t){return t*this.m_motorImpulse},n.Dump=function(t){var e=this.m_bodyA.m_islandIndex,i=this.m_bodyB.m_islandIndex;t(" const jd: b2WheelJointDef = new b2WheelJointDef();\n"),t(" jd.bodyA = bodies[%d];\n",e),t(" jd.bodyB = bodies[%d];\n",i),t(" jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false"),t(" jd.localAnchorA.Set(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y),t(" jd.localAnchorB.Set(%.15f, %.15f);\n",this.m_localAnchorB.x,this.m_localAnchorB.y),t(" jd.localAxisA.Set(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y),t(" jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false"),t(" jd.motorSpeed = %.15f;\n",this.m_motorSpeed),t(" jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque),t(" jd.frequencyHz = %.15f;\n",this.m_frequencyHz),t(" jd.dampingRatio = %.15f;\n",this.m_dampingRatio),t(" joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)},e}(En);function Jn(t,e){return ct(t*e)}function Zn(t,e){return t>e?t:e}Kn.InitVelocityConstraints_s_d=new Et,Kn.InitVelocityConstraints_s_P=new Et,Kn.SolveVelocityConstraints_s_P=new Et,Kn.SolvePositionConstraints_s_d=new Et,Kn.SolvePositionConstraints_s_P=new Et;var Qn=function(){function t(t){this._other=null,this.prev=null,this.next=null,this.contact=t}return t.prototype.Reset=function(){this._other=null,this.prev=null,this.next=null},u(t,[{key:"other",get:function(){if(null===this._other)throw new Error;return this._other},set:function(t){if(null!==this._other)throw new Error;this._other=t}}]),t}(),$n=function(){function t(){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!1,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_prev=null,this.m_next=null,this.m_nodeA=new Qn(this),this.m_nodeB=new Qn(this),this.m_indexA=0,this.m_indexB=0,this.m_manifold=new ve,this.m_toiCount=0,this.m_toi=0,this.m_friction=0,this.m_restitution=0,this.m_tangentSpeed=0,this.m_oldManifold=new ve}var e=t.prototype;return e.GetManifold=function(){return this.m_manifold},e.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.GetShapeA(),r=this.GetShapeB();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},e.IsTouching=function(){return this.m_touchingFlag},e.SetEnabled=function(t){this.m_enabledFlag=t},e.IsEnabled=function(){return this.m_enabledFlag},e.GetNext=function(){return this.m_next},e.GetFixtureA=function(){return this.m_fixtureA},e.GetChildIndexA=function(){return this.m_indexA},e.GetShapeA=function(){return this.m_fixtureA.GetShape()},e.GetFixtureB=function(){return this.m_fixtureB},e.GetChildIndexB=function(){return this.m_indexB},e.GetShapeB=function(){return this.m_fixtureB.GetShape()},e.FlagForFiltering=function(){this.m_filterFlag=!0},e.SetFriction=function(t){this.m_friction=t},e.GetFriction=function(){return this.m_friction},e.ResetFriction=function(){this.m_friction=Jn(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction)},e.SetRestitution=function(t){this.m_restitution=t},e.GetRestitution=function(){return this.m_restitution},e.ResetRestitution=function(){this.m_restitution=Zn(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.SetTangentSpeed=function(t){this.m_tangentSpeed=t},e.GetTangentSpeed=function(){return this.m_tangentSpeed},e.Reset=function(t,e,i,n){this.m_islandFlag=!1,this.m_touchingFlag=!1,this.m_enabledFlag=!0,this.m_filterFlag=!1,this.m_bulletHitFlag=!1,this.m_toiFlag=!1,this.m_fixtureA=t,this.m_fixtureB=i,this.m_indexA=e,this.m_indexB=n,this.m_manifold.pointCount=0,this.m_prev=null,this.m_next=null,this.m_nodeA.Reset(),this.m_nodeB.Reset(),this.m_toiCount=0,this.m_friction=Jn(this.m_fixtureA.m_friction,this.m_fixtureB.m_friction),this.m_restitution=Zn(this.m_fixtureA.m_restitution,this.m_fixtureB.m_restitution)},e.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_enabledFlag=!0;var i=!1,n=this.m_touchingFlag,r=this.m_fixtureA.IsSensor(),s=this.m_fixtureB.IsSensor(),a=r||s,o=this.m_fixtureA.GetBody(),h=this.m_fixtureB.GetBody(),u=o.GetTransform(),l=h.GetTransform();if(a){var c=this.GetShapeA(),_=this.GetShapeB();i=De(c,this.m_indexA,_,this.m_indexB,u,l),this.m_manifold.pointCount=0}else{this.Evaluate(this.m_manifold,u,l),i=this.m_manifold.pointCount>0;for(var f=0;f0:0!=(s.maskBits&a.categoryBits)&&0!=(s.categoryBits&a.maskBits)},i.ShouldCollideFixtureParticle=function(){return!0},i.ShouldCollideParticleParticle=function(){return!0},e}();lr.b2_defaultFilter=new lr;var cr=function(){this.normalImpulses=$(o),this.tangentImpulses=$(o),this.count=0},_r=function(){function t(){}var e=t.prototype;return e.BeginContact=function(){},e.EndContact=function(){},e.BeginContactFixtureParticle=function(){},e.EndContactFixtureParticle=function(){},e.BeginContactParticleParticle=function(){},e.EndContactParticleParticle=function(){},e.PreSolve=function(){},e.PostSolve=function(){},t}();_r.b2_defaultListener=new _r;var fr=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(){return!0},e.ReportParticle=function(){return!1},e.ShouldQueryParticleSystem=function(){return!0},t}(),dr=function(){function t(){}var e=t.prototype;return e.ReportFixture=function(t,e,i,n){return n},e.ReportParticle=function(){return 0},e.ShouldQueryParticleSystem=function(){return!0},t}(),pr=function(){function e(){this.m_broadPhase=new ke,this.m_contactList=null,this.m_contactCount=0,this.m_contactFilter=lr.b2_defaultFilter,this.m_contactListener=_r.b2_defaultListener,this.m_contactFactory=new hr}var i=e.prototype;return i.AddPair=function(t,e){var i=t.fixture,n=e.fixture,r=t.childIndex,s=e.childIndex,a=i.GetBody(),o=n.GetBody();if(a!==o){for(var h=o.GetContactList();h;){if(h.other===a){var u=h.contact.GetFixtureA(),l=h.contact.GetFixtureB(),c=h.contact.GetChildIndexA(),_=h.contact.GetChildIndexB();if(u===i&&l===n&&c===r&&_===s)return;if(u===n&&l===i&&c===s&&_===r)return}h=h.next}if(!this.m_contactFilter||this.m_contactFilter.ShouldCollide(i,n)){var f=this.m_contactFactory.Create(i,r,n,s);null!==f&&(i=f.GetFixtureA(),n=f.GetFixtureB(),r=f.GetChildIndexA(),s=f.GetChildIndexB(),a=i.m_body,o=n.m_body,f.m_prev=null,f.m_next=this.m_contactList,null!==this.m_contactList&&(this.m_contactList.m_prev=f),this.m_contactList=f,f.m_nodeA.other=o,f.m_nodeA.prev=null,f.m_nodeA.next=a.m_contactList,null!==a.m_contactList&&(a.m_contactList.prev=f.m_nodeA),a.m_contactList=f.m_nodeA,f.m_nodeB.other=a,f.m_nodeB.prev=null,f.m_nodeB.next=o.m_contactList,null!==o.m_contactList&&(o.m_contactList.prev=f.m_nodeB),o.m_contactList=f.m_nodeB,i.IsSensor()||n.IsSensor()||(a.SetAwake(!0),o.SetAwake(!0)),++this.m_contactCount)}}},i.FindNewContacts=function(){var t=this;this.m_broadPhase.UpdatePairs((function(e,i){t.AddPair(e,i)}))},i.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();this.m_contactListener&&t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_contactList&&(this.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA===n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB===r.m_contactList&&(r.m_contactList=t.m_nodeB.next),t.m_manifold.pointCount>0&&!e.IsSensor()&&!i.IsSensor()&&(e.GetBody().SetAwake(!0),i.GetBody().SetAwake(!0)),this.m_contactFactory.Destroy(t),--this.m_contactCount},i.Collide=function(){for(var e=this.m_contactList;e;){var i=e.GetFixtureA(),n=e.GetFixtureB(),r=e.GetChildIndexA(),s=e.GetChildIndexB(),a=i.GetBody(),o=n.GetBody();if(e.m_filterFlag){if(this.m_contactFilter&&!this.m_contactFilter.ShouldCollide(i,n)){var h=e;e=h.m_next,this.Destroy(h);continue}e.m_filterFlag=!1}var u=a.IsAwake()&&a.m_type!==t.b2BodyType.b2_staticBody,l=o.IsAwake()&&o.m_type!==t.b2BodyType.b2_staticBody;if(u||l){var c=i.m_proxies[r].treeNode,_=n.m_proxies[s].treeNode;if(we(c.aabb,_.aabb))e.Update(this.m_contactListener),e=e.m_next;else{var f=e;e=f.m_next,this.Destroy(f)}}else e=e.m_next}},e}(),mr=function(){function t(){this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0}return t.prototype.Reset=function(){return this.step=0,this.collide=0,this.solve=0,this.solveInit=0,this.solveVelocity=0,this.solvePosition=0,this.broadphase=0,this.solveTOI=0,this},t}(),gr=function(){function t(){this.dt=0,this.inv_dt=0,this.dtRatio=0,this.velocityIterations=0,this.positionIterations=0,this.particleIterations=0,this.warmStarting=!1}return t.prototype.Copy=function(t){return this.dt=t.dt,this.inv_dt=t.inv_dt,this.dtRatio=t.dtRatio,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.particleIterations=t.particleIterations,this.warmStarting=t.warmStarting,this},t}(),yr=function(){function t(){this.c=new Et,this.a=0}return t.MakeArray=function(e){return Z(e,(function(){return new t}))},t}(),vr=function(){function t(){this.v=new Et,this.w=0}return t.MakeArray=function(e){return Z(e,(function(){return new t}))},t}(),Ar=function(){this.step=new gr},Sr=!1,br=function(){function t(){this.rA=new Et,this.rB=new Et,this.normalImpulse=0,this.tangentImpulse=0,this.normalMass=0,this.tangentMass=0,this.velocityBias=0}return t.MakeArray=function(e){return Z(e,(function(){return new t}))},t}(),Tr=function(){function t(){this.points=br.MakeArray(o),this.normal=new Et,this.tangent=new Et,this.normalMass=new xt,this.K=new xt,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.invIA=0,this.invIB=0,this.friction=0,this.restitution=0,this.tangentSpeed=0,this.pointCount=0,this.contactIndex=0}return t.MakeArray=function(e){return Z(e,(function(){return new t}))},t}(),Er=function(){function e(){this.localPoints=Et.MakeArray(o),this.localNormal=new Et,this.localPoint=new Et,this.indexA=0,this.indexB=0,this.invMassA=0,this.invMassB=0,this.localCenterA=new Et,this.localCenterB=new Et,this.invIA=0,this.invIB=0,this.type=t.b2ManifoldType.e_unknown,this.radiusA=0,this.radiusB=0,this.pointCount=0}return e.MakeArray=function(t){return Z(t,(function(){return new e}))},e}(),Cr=function(){this.step=new gr,this.count=0},wr=function(){function e(){this.normal=new Et,this.point=new Et,this.separation=0}return e.prototype.Initialize=function(i,n,r,s){var a=e.Initialize_s_pointA,o=e.Initialize_s_pointB,h=e.Initialize_s_planePoint,u=e.Initialize_s_clipPoint;switch(i.type){case t.b2ManifoldType.e_circles:Bt.MulXV(n,i.localPoint,a),Bt.MulXV(r,i.localPoints[0],o),Et.SubVV(o,a,this.normal).SelfNormalize(),Et.MidVV(a,o,this.point),this.separation=Et.DotVV(Et.SubVV(o,a,Et.s_t0),this.normal)-i.radiusA-i.radiusB;break;case t.b2ManifoldType.e_faceA:It.MulRV(n.q,i.localNormal,this.normal),Bt.MulXV(n,i.localPoint,h),Bt.MulXV(r,i.localPoints[s],u),this.separation=Et.DotVV(Et.SubVV(u,h,Et.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u);break;case t.b2ManifoldType.e_faceB:It.MulRV(r.q,i.localNormal,this.normal),Bt.MulXV(r,i.localPoint,h),Bt.MulXV(n,i.localPoints[s],u),this.separation=Et.DotVV(Et.SubVV(u,h,Et.s_t0),this.normal)-i.radiusA-i.radiusB,this.point.Copy(u),this.normal.SelfNeg()}},e}();wr.Initialize_s_pointA=new Et,wr.Initialize_s_pointB=new Et,wr.Initialize_s_planePoint=new Et,wr.Initialize_s_clipPoint=new Et;var xr=function(){function t(){this.m_step=new gr,this.m_positionConstraints=Er.MakeArray(1024),this.m_velocityConstraints=Tr.MakeArray(1024),this.m_count=0}var e=t.prototype;return e.Initialize=function(t){if(this.m_step.Copy(t.step),this.m_count=t.count,this.m_positionConstraints.length0?1/M:0;var O=a.tangent,F=Et.CrossVV(B.rA,O),N=Et.CrossVV(B.rB,O),L=f+d+p*F*F+m*N*N;B.tangentMass=L>0?1/L:0,B.velocityBias=0;var V=Et.DotVV(a.normal,Et.SubVV(Et.AddVCrossSV(w,x,B.rB,Et.s_t0),Et.AddVCrossSV(b,T,B.rA,Et.s_t1),Et.s_t0));V<-A&&(B.velocityBias+=-a.restitution*V)}if(2===a.pointCount&&Sr){var k=a.points[0],G=a.points[1],U=Et.CrossVV(k.rA,a.normal),z=Et.CrossVV(k.rB,a.normal),H=Et.CrossVV(G.rA,a.normal),W=Et.CrossVV(G.rB,a.normal),X=f+d+p*U*U+m*z*z,j=f+d+p*H*H+m*W*W,Y=f+d+p*U*H+m*z*W;X*X=0&&o.y>=0){Et.SubVV(o,s,h),Et.MulSV(h.x,C,u),Et.MulSV(h.y,C,l),Et.AddVV(u,l,c),S.SelfMulSub(m,c),b-=g*(Et.CrossVV(k.rA,u)+Et.CrossVV(G.rA,l)),T.SelfMulAdd(y,c),E+=v*(Et.CrossVV(k.rB,u)+Et.CrossVV(G.rB,l)),k.normalImpulse=o.x,G.normalImpulse=o.y;break}if(o.x=-k.normalMass*a.x,o.y=0,U=0,z=f.K.ex.y*o.x+a.y,o.x>=0&&z>=0){Et.SubVV(o,s,h),Et.MulSV(h.x,C,u),Et.MulSV(h.y,C,l),Et.AddVV(u,l,c),S.SelfMulSub(m,c),b-=g*(Et.CrossVV(k.rA,u)+Et.CrossVV(G.rA,l)),T.SelfMulAdd(y,c),E+=v*(Et.CrossVV(k.rB,u)+Et.CrossVV(G.rB,l)),k.normalImpulse=o.x,G.normalImpulse=o.y;break}if(o.x=0,o.y=-G.normalMass*a.y,U=f.K.ey.x*o.y+a.x,z=0,o.y>=0&&U>=0){Et.SubVV(o,s,h),Et.MulSV(h.x,C,u),Et.MulSV(h.y,C,l),Et.AddVV(u,l,c),S.SelfMulSub(m,c),b-=g*(Et.CrossVV(k.rA,u)+Et.CrossVV(G.rA,l)),T.SelfMulAdd(y,c),E+=v*(Et.CrossVV(k.rB,u)+Et.CrossVV(G.rB,l)),k.normalImpulse=o.x,G.normalImpulse=o.y;break}if(o.x=0,o.y=0,U=a.x,z=a.y,U>=0&&z>=0){Et.SubVV(o,s,h),Et.MulSV(h.x,C,u),Et.MulSV(h.y,C,l),Et.AddVV(u,l,c),S.SelfMulSub(m,c),b-=g*(Et.CrossVV(k.rA,u)+Et.CrossVV(G.rA,l)),T.SelfMulAdd(y,c),E+=v*(Et.CrossVV(k.rB,u)+Et.CrossVV(G.rB,l)),k.normalImpulse=o.x,G.normalImpulse=o.y;break}break}}this.m_velocities[d].w=b,this.m_velocities[p].w=E}},e.StoreImpulses=function(){for(var t=0;t0?-B/M:0;Et.MulSV(O,w,a),A.SelfMulSub(d,a),b-=p*Et.CrossVV(r,a),T.SelfMulAdd(g,a),E+=y*Et.CrossVV(s,a)}this.m_positions[l].a=b,this.m_positions[c].a=E}return o>-3*f},e.SolveTOIPositionConstraints=function(e,i){for(var n=t.SolveTOIPositionConstraints_s_xfA,r=t.SolveTOIPositionConstraints_s_xfB,s=t.SolveTOIPositionConstraints_s_psm,a=t.SolveTOIPositionConstraints_s_rA,o=t.SolveTOIPositionConstraints_s_rB,h=t.SolveTOIPositionConstraints_s_P,u=0,l=0;l0?-P/F:0;Et.MulSV(N,I,h),T.SelfMulSub(y,h),E-=v*Et.CrossVV(a,h),C.SelfMulAdd(A,h),w+=b*Et.CrossVV(o,h)}this.m_positions[_].a=E,this.m_positions[d].a=w}return u>=-1.5*f},t}();xr.InitializeVelocityConstraints_s_xfA=new Bt,xr.InitializeVelocityConstraints_s_xfB=new Bt,xr.InitializeVelocityConstraints_s_worldManifold=new Ae,xr.WarmStart_s_P=new Et,xr.SolveVelocityConstraints_s_dv=new Et,xr.SolveVelocityConstraints_s_dv1=new Et,xr.SolveVelocityConstraints_s_dv2=new Et,xr.SolveVelocityConstraints_s_P=new Et,xr.SolveVelocityConstraints_s_a=new Et,xr.SolveVelocityConstraints_s_b=new Et,xr.SolveVelocityConstraints_s_x=new Et,xr.SolveVelocityConstraints_s_d=new Et,xr.SolveVelocityConstraints_s_P1=new Et,xr.SolveVelocityConstraints_s_P2=new Et,xr.SolveVelocityConstraints_s_P1P2=new Et,xr.SolvePositionConstraints_s_xfA=new Bt,xr.SolvePositionConstraints_s_xfB=new Bt,xr.SolvePositionConstraints_s_psm=new wr,xr.SolvePositionConstraints_s_rA=new Et,xr.SolvePositionConstraints_s_rB=new Et,xr.SolvePositionConstraints_s_P=new Et,xr.SolveTOIPositionConstraints_s_xfA=new Bt,xr.SolveTOIPositionConstraints_s_xfB=new Bt,xr.SolveTOIPositionConstraints_s_psm=new wr,xr.SolveTOIPositionConstraints_s_rA=new Et,xr.SolveTOIPositionConstraints_s_rB=new Et,xr.SolveTOIPositionConstraints_s_P=new Et;var Rr,Ir=function(){function e(){this.m_bodies=[],this.m_contacts=[],this.m_joints=[],this.m_positions=yr.MakeArray(1024),this.m_velocities=vr.MakeArray(1024),this.m_bodyCount=0,this.m_jointCount=0,this.m_contactCount=0,this.m_bodyCapacity=0,this.m_contactCapacity=0,this.m_jointCapacity=0}var i=e.prototype;return i.Initialize=function(t,e,i,n){if(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_listener=n,this.m_positions.lengthE){var B=T/I.Length();x.SelfMul(B)}var D=h*R;D*D>w&&(R*=C/nt(D)),S.x+=h*x.x,S.y+=h*x.y,b+=h*R,this.m_positions[A].a=b,this.m_velocities[A].w=R}o.Reset();for(var P=!1,M=0;MX||Et.DotVV(Y.m_linearVelocity,Y.m_linearVelocity)>W?(Y.m_sleepTime=0,H=0):(Y.m_sleepTime+=h,H=rt(H,Y.m_sleepTime)))}if(H>=k&&P)for(var q=0;qE){var g=T/m.Length();d.SelfMul(g)}var y=l*p;y*y>w&&(p*=C/nt(y)),_.SelfMulAdd(l,d),f+=l*p,this.m_positions[c].a=f,this.m_velocities[c].w=p;var v=this.m_bodies[c];v.m_sweep.c.Copy(_),v.m_sweep.a=f,v.m_linearVelocity.Copy(d),v.m_angularVelocity=p,v.SynchronizeTransform()}this.Report(o.m_velocityConstraints)},i.Report=function(t){if(null!==this.m_listener)for(var i=0;i0){var r=1/this.m_mass;this.m_center.SelfMul(r),this.m_linearVelocity.SelfMul(r)}this.m_inertia=0,this.m_angularVelocity=0;for(var s=this.m_firstIndex;s0&&(this.m_angularVelocity*=1/this.m_inertia),this.m_timestamp=this.m_system.m_timestamp}},e}();Fr.GetLinearVelocityFromWorldPoint_s_t0=new Et;var Nr=function(){function t(t){this.m_buffer=[],this.m_front=0,this.m_back=0,this.m_buffer.fill(null,0,t)}var e=t.prototype;return e.Push=function(t){if(this.m_back>=this.m_capacity){for(var e=this.m_front;e=0&&f>=0&&_0&&u.Push(new kr(p-1,m,g-1,y)),m>0&&u.Push(new kr(p,m-1,g-this.m_countX,y)),pV*V+k*k&&(this.m_diagram[P]=F,B>0&&u.Push(new kr(B-1,D,P-1,F)),D>0&&u.Push(new kr(B,D-1,P-this.m_countX,F)),B=i)break;Gr(t,h,i)}}if(0===a)break;r=i,i=s[--a]}return t}function Hr(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=t.length-e),void 0===n&&(n=Ur),zr(t,e,i,n)}function Wr(t,e,i){void 0===i&&(i=t.length);for(var n=0,r=0;r0;){var a=Math.floor(s/2),o=e+a;r(t[o],n)?(e=++o,s-=a+1):s=a}return e}function jr(t,e,i,n,r){for(var s=i-e;s>0;){var a=Math.floor(s/2),o=e+a;r(n,t[o])?s=a:(e=++o,s-=a+1)}return e}function Yr(t,e,i,n){for(var r=i;e!==r;)Gr(t,e++,r++),r===n?r=i:e===i&&(i=r)}function qr(t,e,i,n){if(e===i)return i;for(var r=e;++e!==i;)n(t[r],t[e])||Gr(t,++r,e);return++r}var Kr=function(){function t(t){this.data=[],this.count=0,this.capacity=0,this.allocator=t}var e=t.prototype;return e.Append=function(){return this.count>=this.capacity&&this.Grow(),this.count++},e.Reserve=function(t){if(!(this.capacity>=t)){for(var e=this.capacity;e=0;)this.ReportFixtureAndParticle(t,i,s);return!0},i.ReportParticle=function(){return!1},i.ReportFixtureAndParticle=function(){},e}(fr),Zr=function(){function t(){this.indexA=0,this.indexB=0,this.weight=0,this.normal=new Et,this.flags=0}var e=t.prototype;return e.SetIndices=function(t,e){this.indexA=t,this.indexB=e},e.SetWeight=function(t){this.weight=t},e.SetNormal=function(t){this.normal.Copy(t)},e.SetFlags=function(t){this.flags=t},e.GetIndexA=function(){return this.indexA},e.GetIndexB=function(){return this.indexB},e.GetWeight=function(){return this.weight},e.GetNormal=function(){return this.normal},e.GetFlags=function(){return this.flags},e.IsEqual=function(t){return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&this.weight===t.weight&&this.normal.x===t.normal.x&&this.normal.y===t.normal.y},e.IsNotEqual=function(t){return!this.IsEqual(t)},e.ApproximatelyEqual=function(t){var e=.01,i=1e-4;return this.indexA===t.indexA&&this.indexB===t.indexB&&this.flags===t.flags&&nt(this.weight-t.weight)>>0<>>0)>>>0},e.computeRelativeTag=function(t,i,n){return t+(n<>>0};var r=e.prototype;return r.Drop=function(){for(;this.m_groupList;)this.DestroyParticleGroup(this.m_groupList);this.FreeUserOverridableBuffer(this.m_handleIndexBuffer),this.FreeUserOverridableBuffer(this.m_flagsBuffer),this.FreeUserOverridableBuffer(this.m_lastBodyContactStepBuffer),this.FreeUserOverridableBuffer(this.m_bodyContactCountBuffer),this.FreeUserOverridableBuffer(this.m_consecutiveContactStepsBuffer),this.FreeUserOverridableBuffer(this.m_positionBuffer),this.FreeUserOverridableBuffer(this.m_velocityBuffer),this.FreeUserOverridableBuffer(this.m_colorBuffer),this.FreeUserOverridableBuffer(this.m_userDataBuffer),this.FreeUserOverridableBuffer(this.m_expirationTimeBuffer),this.FreeUserOverridableBuffer(this.m_indexByExpirationTimeBuffer),this.FreeBuffer(this.m_forceBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_weightBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_staticPressureBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulationBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_accumulation2Buffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_depthBuffer,this.m_internalAllocatedCapacity),this.FreeBuffer(this.m_groupBuffer,this.m_internalAllocatedCapacity)},r.CreateParticle=function(t){if(this.m_world.IsLocked())throw new Error;if(this.m_count>=this.m_internalAllocatedCapacity){var e=this.m_count?2*this.m_count:L;this.ReallocateInternalAllocatedBuffers(e)}if(this.m_count>=this.m_internalAllocatedCapacity){if(!this.m_def.destroyByAge)return I;this.DestroyOldestParticle(0,!1),this.SolveZombie()}var n=this.m_count++;this.m_flagsBuffer.data[n]=0,this.m_lastBodyContactStepBuffer.data&&(this.m_lastBodyContactStepBuffer.data[n]=0),this.m_bodyContactCountBuffer.data&&(this.m_bodyContactCountBuffer.data[n]=0),this.m_consecutiveContactStepsBuffer.data&&(this.m_consecutiveContactStepsBuffer.data[n]=0),this.m_positionBuffer.data[n]=(this.m_positionBuffer.data[n]||new Et).Copy(i(t.position,Et.ZERO)),this.m_velocityBuffer.data[n]=(this.m_velocityBuffer.data[n]||new Et).Copy(i(t.velocity,Et.ZERO)),this.m_weightBuffer[n]=0,this.m_forceBuffer[n]=(this.m_forceBuffer[n]||new Et).SetZero(),this.m_staticPressureBuffer&&(this.m_staticPressureBuffer[n]=0),this.m_depthBuffer&&(this.m_depthBuffer[n]=0);var r=(new Mt).Copy(i(t.color,Mt.ZERO));!this.m_colorBuffer.data&&r.IsZero()||(this.m_colorBuffer.data=this.RequestBuffer(this.m_colorBuffer.data),this.m_colorBuffer.data[n]=(this.m_colorBuffer.data[n]||new Mt).Copy(r)),(this.m_userDataBuffer.data||t.userData)&&(this.m_userDataBuffer.data=this.RequestBuffer(this.m_userDataBuffer.data),this.m_userDataBuffer.data[n]=t.userData),this.m_handleIndexBuffer.data&&(this.m_handleIndexBuffer.data[n]=null);var s=this.m_proxyBuffer.data[this.m_proxyBuffer.Append()],a=i(t.lifetime,0),o=a>0;(this.m_expirationTimeBuffer.data||o)&&(this.SetParticleLifetime(n,o?a:this.ExpirationTimeToLifetime(-this.GetQuantizedTimeElapsed())),this.m_indexByExpirationTimeBuffer.data[n]=n),s.index=n;var h=i(t.group,null);return this.m_groupBuffer[n]=h,h&&(h.m_firstIndex0?n:r,e)},r.DestroyParticlesInShape=function(t,i,n){void 0===n&&(n=!1);var r=e.DestroyParticlesInShape_s_aabb;if(this.m_world.IsLocked())throw new Error;var s=new fs(this,t,i,n),a=r;return t.ComputeAABB(a,i,0),this.m_world.QueryAABB(s,a),s.Destroyed()},r.CreateParticleGroup=function(t){var n=e.CreateParticleGroup_s_transform;if(this.m_world.IsLocked())throw new Error;var r=n;r.SetPositionAngle(i(t.position,Et.ZERO),i(t.angle,0));var s=this.m_count;if(t.shape&&this.CreateParticlesWithShapeForGroup(t.shape,t,r),t.shapes&&this.CreateParticlesWithShapesForGroup(t.shapes,i(t.shapeCount,t.shapes.length),t,r),t.positionData)for(var a=i(t.particleCount,t.positionData.length),o=0;o0&&(this.m_lastBodyContactStepBuffer.data=this.RequestBuffer(this.m_lastBodyContactStepBuffer.data),this.m_bodyContactCountBuffer.data=this.RequestBuffer(this.m_bodyContactCountBuffer.data),this.m_consecutiveContactStepsBuffer.data=this.RequestBuffer(this.m_consecutiveContactStepsBuffer.data))},r.GetStuckCandidates=function(){return this.m_stuckParticleBuffer.Data()},r.GetStuckCandidateCount=function(){return this.m_stuckParticleBuffer.GetCount()},r.ComputeCollisionEnergy=function(){for(var t=e.ComputeCollisionEnergy_s_v,i=this.m_velocityBuffer.data,n=0,r=0;r0?this.GetQuantizedTimeElapsed()+s:s;a!==this.m_expirationTimeBuffer.data[t]&&(this.m_expirationTimeBuffer.data[t]=a,this.m_expirationTimeBufferRequiresSorting=!0)},r.GetParticleLifetime=function(t){return this.ExpirationTimeToLifetime(this.GetExpirationTimeBuffer()[t])},r.SetDestructionByAge=function(t){t&&this.GetExpirationTimeBuffer(),this.m_def.destroyByAge=t},r.GetDestructionByAge=function(){return this.m_def.destroyByAge},r.GetExpirationTimeBuffer=function(){return this.m_expirationTimeBuffer.data=this.RequestBuffer(this.m_expirationTimeBuffer.data),this.m_expirationTimeBuffer.data},r.ExpirationTimeToLifetime=function(t){return(t>0?t-this.GetQuantizedTimeElapsed():t)*this.m_def.lifetimeGranularity},r.GetIndexByExpirationTimeBuffer=function(){return this.GetParticleCount()?this.SetParticleLifetime(0,this.GetParticleLifetime(0)):this.m_indexByExpirationTimeBuffer.data=this.RequestBuffer(this.m_indexByExpirationTimeBuffer.data),this.m_indexByExpirationTimeBuffer.data},r.ParticleApplyLinearImpulse=function(t,e){this.ApplyLinearImpulse(t,t+1,e)},r.ApplyLinearImpulse=function(t,e,i){for(var n=this.m_velocityBuffer.data,r=(e-t)*this.GetParticleMass(),s=(new Et).Copy(i).SelfMul(1/r),a=t;a=0;){var m=Et.SubVV(i,u[c],s),g=Et.DotVV(m,f),y=g*g-d*(Et.DotVV(m,m)-this.m_squaredDiameter);if(y>=0){var v=ct(y),A=(-g-v)/d;if(A>_)continue;if(A<0&&((A=(-g+v)/d)<0||A>_))continue;var S=Et.AddVMulSV(m,A,f,o);if(S.Normalize(),(_=rt(_,t.ReportParticle(this,c,Et.AddVMulSV(i,A,f,h),S,A)))<=0)break}}}},r.ComputeAABB=function(t){var e=this.GetParticleCount();t.lowerBound.x=+n,t.lowerBound.y=+n,t.upperBound.x=-n,t.upperBound.y=-n;for(var i=this.m_positionBuffer.data,r=0;re?e:t}if(t=e(t,this.m_def.maxCount),t=e(t,this.m_flagsBuffer.userSuppliedCapacity),t=e(t,this.m_positionBuffer.userSuppliedCapacity),t=e(t,this.m_velocityBuffer.userSuppliedCapacity),t=e(t,this.m_colorBuffer.userSuppliedCapacity),t=e(t,this.m_userDataBuffer.userSuppliedCapacity),this.m_internalAllocatedCapacity0;this.m_lastBodyContactStepBuffer.data=this.ReallocateBuffer4(this.m_lastBodyContactStepBuffer,this.m_internalAllocatedCapacity,t,i),this.m_bodyContactCountBuffer.data=this.ReallocateBuffer4(this.m_bodyContactCountBuffer,this.m_internalAllocatedCapacity,t,i),this.m_consecutiveContactStepsBuffer.data=this.ReallocateBuffer4(this.m_consecutiveContactStepsBuffer,this.m_internalAllocatedCapacity,t,i),this.m_positionBuffer.data=this.ReallocateBuffer4(this.m_positionBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_velocityBuffer.data=this.ReallocateBuffer4(this.m_velocityBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_forceBuffer=this.ReallocateBuffer5(this.m_forceBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_weightBuffer=this.ReallocateBuffer5(this.m_weightBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_staticPressureBuffer=this.ReallocateBuffer5(this.m_staticPressureBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_accumulationBuffer=this.ReallocateBuffer5(this.m_accumulationBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_accumulation2Buffer=this.ReallocateBuffer5(this.m_accumulation2Buffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_depthBuffer=this.ReallocateBuffer5(this.m_depthBuffer,0,this.m_internalAllocatedCapacity,t,!0),this.m_colorBuffer.data=this.ReallocateBuffer4(this.m_colorBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_groupBuffer=this.ReallocateBuffer5(this.m_groupBuffer,0,this.m_internalAllocatedCapacity,t,!1),this.m_userDataBuffer.data=this.ReallocateBuffer4(this.m_userDataBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_expirationTimeBuffer.data=this.ReallocateBuffer4(this.m_expirationTimeBuffer,this.m_internalAllocatedCapacity,t,!0),this.m_indexByExpirationTimeBuffer.data=this.ReallocateBuffer4(this.m_indexByExpirationTimeBuffer,this.m_internalAllocatedCapacity,t,!1),this.m_internalAllocatedCapacity=t}},r.CreateParticleForGroup=function(t,e,n){var r=new Br;r.flags=i(t.flags,0),Bt.MulXV(e,n,r.position),Et.AddVV(i(t.linearVelocity,Et.ZERO),Et.CrossSV(i(t.angularVelocity,0),Et.SubVV(r.position,i(t.position,Et.ZERO),Et.s_t0),Et.s_t0),r.velocity),r.color.Copy(i(t.color,Mt.ZERO)),r.lifetime=i(t.lifetime,0),r.userData=t.userData,this.CreateParticle(r)},r.CreateParticlesStrokeShapeForGroup=function(n,r,s){var a=e.CreateParticlesStrokeShapeForGroup_s_edge,o=e.CreateParticlesStrokeShapeForGroup_s_d,h=e.CreateParticlesStrokeShapeForGroup_s_p,u=i(r.stride,0);0===u&&(u=this.GetParticleStride());for(var l=0,c=n.GetChildCount(),_=0;_=i&&f=i&&dy||Et.DotVV(m,m)>y||Et.DotVV(g,g)>y)return;var v=C.m_groupBuffer[t],A=C.m_groupBuffer[i],S=C.m_groupBuffer[n],b=C.m_triadBuffer.data[C.m_triadBuffer.Append()];b.indexA=t,b.indexB=i,b.indexC=n,b.flags=u|l|c,b.strength=rt(rt(v?v.m_strength:1,A?A.m_strength:1),S?S.m_strength:1);var T=(_.x+f.x+d.x)/3,E=(_.y+f.y+d.y)/3;b.pa.x=_.x-T,b.pa.y=_.y-E,b.pb.x=f.x-T,b.pb.y=f.y-E,b.pc.x=d.x-T,b.pc.y=d.y-E,b.ka=-Et.DotVV(g,p),b.kb=-Et.DotVV(p,m),b.kc=-Et.DotVV(m,g),b.s=Et.CrossVV(_,f)+Et.CrossVV(f,d)+Et.CrossVV(d,_)}};A.GetNodes(w),Hr(this.m_triadBuffer.data,0,this.m_triadBuffer.count,e.CompareTriadIndices),this.m_triadBuffer.Unique(e.MatchTriadIndices)}},r.UpdatePairsAndTriadsWithReactiveParticles=function(){var e=new ms(this.m_flagsBuffer);this.UpdatePairsAndTriads(0,this.m_count,e);for(var i=0;i>0,E=0;EM&&(this.m_depthBuffer[R]=M,C=!0),P>O&&(this.m_depthBuffer[I]=O,C=!0)}if(!C)break}for(var F=0;F0)for(var n=this.GetParticleCount(),r=0;rthis.m_lastBodyContactStepBuffer.data[r]+1&&(this.m_consecutiveContactStepsBuffer.data[r]=0);this.m_bodyContactBuffer.SetCount(0),this.m_stuckParticleBuffer.SetCount(0);var s=t;this.ComputeAABB(s),null===this.UpdateBodyContacts_callback&&(this.UpdateBodyContacts_callback=new gs(this));var a=this.UpdateBodyContacts_callback;a.m_contactFilter=this.GetFixtureContactFilter(),this.m_world.QueryAABB(a,s),this.m_def.strictContactCheck&&this.RemoveSpuriousBodyContacts(),this.NotifyBodyContactListenerPostContact(i)},r.Solve=function(i){var n=e.Solve_s_subStep;if(0!==this.m_count&&(this.m_expirationTimeBuffer.data&&this.SolveLifetimes(i),this.m_allParticleFlags&t.b2ParticleFlag.b2_zombieParticle&&this.SolveZombie(),this.m_needsUpdateAllParticleFlags&&this.UpdateAllParticleFlags(),this.m_needsUpdateAllGroupFlags&&this.UpdateAllGroupFlags(),!this.m_paused))for(this.m_iterationIndex=0;this.m_iterationIndexi&&r.SelfMul(ct(i/s))}},r.SolveGravity=function(t){for(var i=e.SolveGravity_s_gravity,n=this.m_velocityBuffer.data,r=Et.MulSV(t.dt*this.m_def.gravityScale,this.m_world.GetGravity(),i),s=0;s=0;){var F=p[O],N=this.m_groupBuffer[O];if(x!==N&&R!==N){var L=this.GetLinearVelocity(N,O,F,h),k=Et.SubVV(F,E,u),G=Et.SubVV(L,I,l),U=Et.CrossVV(P,G),z=Et.CrossVV(D,G)-Et.CrossVV(k,P),H=Et.CrossVV(D,k),W=void 0,X=void 0,j=c,Y=_;if(0===U){if(0===z)continue;if(!((X=-H/z)>=0&&X=0&&W<=1))continue}else{var q=z*z-4*H*U;if(q<0)continue;var K=ct(q),J=(-z-K)/(2*U),Z=(-z+K)/(2*U);if(J>Z){var Q=J;J=Z,Z=Q}if(X=J,Et.AddVMulSV(D,X,P,j),Et.AddVMulSV(k,X,G,Y),W=Et.DotVV(j,Y)/Et.DotVV(j,j),!(X>=0&&X=0&&W<=1)){if(!((X=Z)>=0&&X=0&&W<=1))continue}}var $=f;$.x=I.x+W*P.x-L.x,$.y=I.y+W*P.y-L.y;var tt=Et.MulSV(v,$,d);if(N&&this.IsRigidGroup(N)){var et=N.GetMass(),it=N.GetInertia();et>0&&N.m_linearVelocity.SelfMulAdd(1/et,tt),it>0&&(N.m_angularVelocity+=Et.CrossVV(Et.SubVV(F,N.GetCenter(),Et.s_t0),tt)/it)}else m[O].SelfAdd($);this.ParticleApplyForce(O,tt.SelfMul(-i.inv_dt))}}}}},r.SolveStaticPressure=function(e){this.m_staticPressureBuffer=this.RequestBuffer(this.m_staticPressureBuffer);for(var i=this.GetCriticalPressure(e),n=this.m_def.staticPressureStrength*i,r=M*i,s=this.m_def.staticPressureRelaxation,a=0;ao){var f=l.body,d=l.mass,p=r[c],m=l.normal,g=Et.MulSV(a*d*(_-o),m,n);s[c].SelfMulSub(h,g),f.ApplyLinearImpulse(g,p,!0)}}}for(var y=0;yo){var S=v.indexA,b=v.indexB,T=v.normal,E=Et.MulSV(a*(A-o),T,n);s[S].SelfSub(E),s[b].SelfAdd(E)}}}},r.SolveSolid=function(t){var i=e.SolveSolid_s_f,n=this.m_velocityBuffer.data;this.m_depthBuffer=this.RequestBuffer(this.m_depthBuffer);for(var r=t.inv_dt*this.m_def.ejectionStrength,s=0;s=0?(C=rt(C,B),w=st(w,B+1)):x=!0}Cr:s})),this.m_expirationTimeBufferRequiresSorting=!1);for(var s=r-1;s>=0;--s){var a=n[s],o=i[a];if(ee.weight:t.indexr)return!0;var h=t.Copy(e.normal);h.SelfMul(s.m_particleDiameter*(1-e.weight));var u=Et.AddVV(s.m_positionBuffer.data[e.index],h,i);if(!e.fixture.TestPoint(u)){for(var l=e.fixture.GetShape().GetChildCount(),c=0;cthis.m_stuckThreshold&&(this.m_stuckParticleBuffer.data[this.m_stuckParticleBuffer.Append()]=t)),this.m_lastBodyContactStepBuffer.data[t]=this.m_timestamp)},r.ValidateParticleIndex=function(t){return t>=0&&t0?1/n:0,e[0]=r>0?1/r:0,i[0]=Et.CrossVV(Et.SubVV(a,s,Et.s_t0),o)},r.InitDampingParameterWithRigidGroupOrParticle=function(e,i,n,r,s,a,o,h){if(s&&r)this.InitDampingParameter(e,i,n,s.GetMass(),s.GetInertia(),s.GetCenter(),o,h);else{var u=this.m_flagsBuffer.data[a];this.InitDampingParameter(e,i,n,u&t.b2ParticleFlag.b2_wallParticle?0:this.GetParticleMass(),0,o,o,h)}},r.ComputeDampingImpulse=function(t,e,i,n,r,s,a){var o=t+e*i*i+n+r*s*s;return o>0?a/o:0},r.ApplyDamping=function(t,e,i,n,r,s,a,o){r&&n?(r.m_linearVelocity.SelfMulAdd(a*t,o),r.m_angularVelocity+=a*i*e):this.m_velocityBuffer.data[s].SelfMulAdd(a*t,o)},e}();is.xTruncBits=12,is.yTruncBits=12,is.tagBits=32,is.yOffset=1<>>0,this.m_xUpper=(i&is.xMask)>>>0,this.m_yLower=(e&is.yMask)>>>0,this.m_yUpper=(i&is.yMask)>>>0,this.m_first=n,this.m_last=r}return t.prototype.GetNext=function(){for(;this.m_first>>0;if(t>=this.m_xLower&&t<=this.m_xUpper)return this.m_system.m_proxyBuffer.data[this.m_first++].index;this.m_first++}return I},t}(),as=function(){this.next=null,this.count=0,this.index=0},os=function(){function t(){}var e=t.prototype;return e.Allocate=function(t,e){return e},e.Clear=function(){},e.GetCount=function(){return 0},e.Invalidate=function(){},e.GetValidBuffer=function(){return[]},e.GetBuffer=function(){return[]},e.SetCount=function(){},t}(),hs=function(t,e){this.second=I,this.first=t,this.second=e},us=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return I},e}(os),ls=function(t,e){this.first=I,this.second=I,this.first=t,this.second=e},cs=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.Initialize=function(){},i.Find=function(){return I},e}(os),_s=function(){function t(){}var e=t.prototype;return e.IsNecessary=function(){return!0},e.ShouldCreatePair=function(){return!0},e.ShouldCreateTriad=function(){return!0},t}(),fs=function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this).m_callDestructionListener=!1,s.m_destroyed=0,s.m_system=e,s.m_shape=i,s.m_xf=n,s.m_callDestructionListener=r,s.m_destroyed=0,s}c(e,t);var i=e.prototype;return i.ReportFixture=function(){return!1},i.ReportParticle=function(t,e){return t===this.m_system&&(this.m_shape.TestPoint(this.m_xf,this.m_system.m_positionBuffer.data[e])&&(this.m_system.DestroyParticle(e,this.m_callDestructionListener),this.m_destroyed++),!0)},i.Destroyed=function(){return this.m_destroyed},e}(fr),ds=function(t){function e(e){var i;return(i=t.call(this)||this).m_threshold=0,i.m_threshold=e,i}c(e,t);var i=e.prototype;return i.ShouldCreatePair=function(t,e){return t0?1/_:0,p=f>0?1/f:0,m=this.m_system.m_flagsBuffer.data[r]&t.b2ParticleFlag.b2_wallParticle?0:this.m_system.GetParticleInvMass(),g=Et.SubVV(o,c,a),y=Et.CrossVV(g,h),v=m+d+p*y*y,A=this.m_system.m_bodyContactBuffer.data[this.m_system.m_bodyContactBuffer.Append()];A.index=r,A.body=l,A.fixture=e,A.weight=1-u*this.m_system.m_inverseDiameter,A.normal.Copy(h.SelfNeg()),A.mass=v>0?1/v:0,this.m_system.DetectStuckParticle(r)}},i}(Jr);gs.ReportFixtureAndParticle_s_n=new Et,gs.ReportFixtureAndParticle_s_rp=new Et;var ys=function(e){function i(t,i){var n;return(n=e.call(this,t)||this).m_step=i,n}c(i,e);var n=i.prototype;return n.ReportFixtureAndParticle=function(e,n,r){var s=i.ReportFixtureAndParticle_s_p1,a=i.ReportFixtureAndParticle_s_output,o=i.ReportFixtureAndParticle_s_input,h=i.ReportFixtureAndParticle_s_p,u=i.ReportFixtureAndParticle_s_v,l=i.ReportFixtureAndParticle_s_f,c=e.GetBody(),_=this.m_system.m_positionBuffer.data[r],d=this.m_system.m_velocityBuffer.data[r],p=a,m=o;if(0===this.m_system.m_iterationIndex){var g=Bt.MulTXV(c.m_xf0,_,s);e.GetShape().GetType()===t.b2ShapeType.e_circleShape&&(g.SelfSub(c.GetLocalCenter()),It.MulRV(c.m_xf0.q,g,g),It.MulTRV(c.m_xf.q,g,g),g.SelfAdd(c.GetLocalCenter())),Bt.MulXV(c.m_xf,g,m.p1)}else m.p1.Copy(_);if(Et.AddVMulSV(_,this.m_step.dt,d,m.p2),m.maxFraction=1,e.RayCast(p,m,n)){var y=p.normal,v=h;v.x=(1-p.fraction)*m.p1.x+p.fraction*m.p2.x+f*y.x,v.y=(1-p.fraction)*m.p1.y+p.fraction*m.p2.y+f*y.y;var A=u;A.x=this.m_step.inv_dt*(v.x-_.x),A.y=this.m_step.inv_dt*(v.y-_.y),this.m_system.m_velocityBuffer.data[r].Copy(A);var S=l;S.x=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.x-A.x),S.y=this.m_step.inv_dt*this.m_system.GetParticleMass()*(d.y-A.y),this.m_system.ParticleApplyForce(r,S)}},n.ReportParticle=function(){return!1},i}(Jr);ys.ReportFixtureAndParticle_s_p1=new Et,ys.ReportFixtureAndParticle_s_output=new Ee,ys.ReportFixtureAndParticle_s_input=new Te,ys.ReportFixtureAndParticle_s_p=new Et,ys.ReportFixtureAndParticle_s_v=new Et,ys.ReportFixtureAndParticle_s_f=new Et;var vs=function(){function e(t){this.m_newFixture=!1,this.m_locked=!1,this.m_clearForces=!0,this.m_contactManager=new pr,this.m_bodyList=null,this.m_jointList=null,this.m_particleSystemList=null,this.m_bodyCount=0,this.m_jointCount=0,this.m_gravity=new Et,this.m_allowSleep=!0,this.m_destructionListener=null,this.m_debugDraw=null,this.m_inv_dt0=0,this.m_warmStarting=!0,this.m_continuousPhysics=!0,this.m_subStepping=!1,this.m_stepComplete=!0,this.m_profile=new mr,this.m_island=new Ir,this.s_stack=[],this.m_controllerList=null,this.m_controllerCount=0,this.m_gravity.Copy(t)}var i=e.prototype;return i.SetDestructionListener=function(t){this.m_destructionListener=t},i.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=t},i.SetContactListener=function(t){this.m_contactManager.m_contactListener=t},i.SetDebugDraw=function(t){this.m_debugDraw=t},i.CreateBody=function(t){if(void 0===t&&(t={}),this.IsLocked())throw new Error;var e=new An(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},i.DestroyBody=function(t){if(this.IsLocked())throw new Error;for(var e=t.m_jointList;e;){var i=e;e=e.next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint),t.m_jointList=e}t.m_jointList=null;for(var n=t.m_controllerList;n;){var r=n;n=n.nextController,r.controller.RemoveBody(t)}for(var s=t.m_contactList;s;){var a=s;s=s.next,this.m_contactManager.Destroy(a.contact)}t.m_contactList=null;for(var o=t.m_fixtureList;o;){var h=o;o=o.m_next,this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(h),h.DestroyProxies(),h.Reset(),t.m_fixtureList=o,t.m_fixtureCount-=1}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount},e._Joint_Create=function(e){switch(e.type){case t.b2JointType.e_distanceJoint:return new wn(e);case t.b2JointType.e_mouseJoint:return new Nn(e);case t.b2JointType.e_prismaticJoint:return new Vn(e);case t.b2JointType.e_revoluteJoint:return new Hn(e);case t.b2JointType.e_pulleyJoint:return new Un(e);case t.b2JointType.e_gearJoint:return new Pn(e);case t.b2JointType.e_wheelJoint:return new Kn(e);case t.b2JointType.e_weldJoint:return new Yn(e);case t.b2JointType.e_frictionJoint:return new Bn(e);case t.b2JointType.e_ropeJoint:return new Xn(e);case t.b2JointType.e_motorJoint:return new On(e);case t.b2JointType.e_areaJoint:return new Rn(e)}throw new Error},e._Joint_Destroy=function(){},i.CreateJoint=function(t){if(this.IsLocked())throw new Error;var i=e._Joint_Create(t);i.m_prev=null,i.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=i),this.m_jointList=i,++this.m_jointCount,i.m_edgeA.prev=null,i.m_edgeA.next=i.m_bodyA.m_jointList,i.m_bodyA.m_jointList&&(i.m_bodyA.m_jointList.prev=i.m_edgeA),i.m_bodyA.m_jointList=i.m_edgeA,i.m_edgeB.prev=null,i.m_edgeB.next=i.m_bodyB.m_jointList,i.m_bodyB.m_jointList&&(i.m_bodyB.m_jointList.prev=i.m_edgeB),i.m_bodyB.m_jointList=i.m_edgeB;var n=i.m_bodyA,r=i.m_bodyB;if(!i.m_collideConnected)for(var s=r.GetContactList();s;)s.other===n&&s.contact.FlagForFiltering(),s=s.next;return i},i.DestroyJoint=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_jointList&&(this.m_jointList=t.m_next);var i=t.m_bodyA,n=t.m_bodyB,r=t.m_collideConnected;if(i.SetAwake(!0),n.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA===i.m_jointList&&(i.m_jointList=t.m_edgeA.next),t.m_edgeA.Reset(),t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB===n.m_jointList&&(n.m_jointList=t.m_edgeB.next),t.m_edgeB.Reset(),e._Joint_Destroy(t),--this.m_jointCount,!r)for(var s=n.GetContactList();s;)s.other===i&&s.contact.FlagForFiltering(),s=s.next},i.CreateParticleSystem=function(t){if(this.IsLocked())throw new Error;var e=new is(t,this);return e.m_prev=null,e.m_next=this.m_particleSystemList,this.m_particleSystemList&&(this.m_particleSystemList.m_prev=e),this.m_particleSystemList=e,e},i.DestroyParticleSystem=function(t){if(this.IsLocked())throw new Error;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t===this.m_particleSystemList&&(this.m_particleSystemList=t.m_next)},i.CalculateReasonableParticleIterations=function(t){if(null===this.m_particleSystemList)return 1;function e(t){for(var e=n,i=t.GetParticleSystemList();null!==i;i=i.m_next)e=rt(e,i.GetRadius());return e}return Dr(this.m_gravity.Length(),e(this),t)},i.Step=function(t,i,n,r){void 0===r&&(r=this.CalculateReasonableParticleIterations(t));var s=e.Step_s_stepTimer.Reset();this.m_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_newFixture=!1),this.m_locked=!0;var a=e.Step_s_step;a.dt=t,a.velocityIterations=i,a.positionIterations=n,a.particleIterations=r,a.inv_dt=t>0?1/t:0,a.dtRatio=this.m_inv_dt0*t,a.warmStarting=this.m_warmStarting;var o=e.Step_s_timer.Reset();if(this.m_contactManager.Collide(),this.m_profile.collide=o.GetMilliseconds(),this.m_stepComplete&&a.dt>0){for(var h=e.Step_s_timer.Reset(),u=this.m_particleSystemList;u;u=u.m_next)u.Solve(a);this.Solve(a),this.m_profile.solve=h.GetMilliseconds()}if(this.m_continuousPhysics&&a.dt>0){var l=e.Step_s_timer.Reset();this.SolveTOI(a),this.m_profile.solveTOI=l.GetMilliseconds()}a.dt>0&&(this.m_inv_dt0=a.inv_dt),this.m_clearForces&&this.ClearForces(),this.m_locked=!1,this.m_profile.step=s.GetMilliseconds()},i.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},i.DrawParticleSystem=function(t){if(null!==this.m_debugDraw){var e=t.GetParticleCount();if(e){var i=t.GetRadius(),n=t.GetPositionBuffer();if(t.m_colorBuffer.data){var r=t.GetColorBuffer();this.m_debugDraw.DrawParticles(n,i,r,e)}else this.m_debugDraw.DrawParticles(n,i,null,e)}}},i.DrawDebugData=function(){if(null!==this.m_debugDraw){var i=this.m_debugDraw.GetFlags(),n=e.DrawDebugData_s_color.SetRGB(0,0,0);if(i&t.b2DrawFlags.e_shapeBit)for(var r=this.m_bodyList;r;r=r.m_next){var s=r.m_xf;this.m_debugDraw.PushTransform(s);for(var a=r.GetFixtureList();a;a=a.m_next)r.IsActive()?r.GetType()===t.b2BodyType.b2_staticBody?(n.SetRGB(.5,.9,.5),this.DrawShape(a,n)):r.GetType()===t.b2BodyType.b2_kinematicBody?(n.SetRGB(.5,.5,.9),this.DrawShape(a,n)):r.IsAwake()?(n.SetRGB(.9,.7,.7),this.DrawShape(a,n)):(n.SetRGB(.6,.6,.6),this.DrawShape(a,n)):(n.SetRGB(.5,.5,.3),this.DrawShape(a,n));this.m_debugDraw.PopTransform(s)}if(i&t.b2DrawFlags.e_particleBit)for(var o=this.m_particleSystemList;o;o=o.m_next)this.DrawParticleSystem(o);if(i&t.b2DrawFlags.e_jointBit)for(var h=this.m_jointList;h;h=h.m_next)this.DrawJoint(h);if(i&t.b2DrawFlags.e_aabbBit){n.SetRGB(.9,.3,.9);for(var u=e.DrawDebugData_s_vs,l=this.m_bodyList;l;l=l.m_next)if(l.IsActive())for(var c=l.GetFixtureList();c;c=c.m_next)for(var _=0;_0;){var c=h[--l];if(!c)throw new Error;if(r.AddBody(c),c.m_awakeFlag=!0,c.GetType()!==t.b2BodyType.b2_staticBody){for(var _=c.m_contactList;_;_=_.next){var f=_.contact;if(!f.m_islandFlag&&f.IsEnabled()&&f.IsTouching()){var d=f.m_fixtureA.m_isSensor,p=f.m_fixtureB.m_isSensor;if(!d&&!p){r.AddContact(f),f.m_islandFlag=!0;var m=_.other;m.m_islandFlag||(h[l++]=m,m.m_islandFlag=!0)}}}for(var g=c.m_jointList;g;g=g.next)if(!g.joint.m_islandFlag){var y=g.other;y.IsActive()&&(r.AddJoint(g.joint),g.joint.m_islandFlag=!0,y.m_islandFlag||(h[l++]=y,y.m_islandFlag=!0))}}}var v=new mr;r.Solve(v,e,this.m_gravity,this.m_allowSleep),this.m_profile.solveInit+=v.solveInit,this.m_profile.solveVelocity+=v.solveVelocity,this.m_profile.solvePosition+=v.solvePosition;for(var A=0;Ag)){var l=1;if(u.m_toiFlag)l=u.m_toi;else{var c=u.GetFixtureA(),_=u.GetFixtureB();if(c.IsSensor()||_.IsSensor())continue;var f=c.GetBody(),d=_.GetBody(),p=f.m_type,m=d.m_type,v=f.IsAwake()&&p!==t.b2BodyType.b2_staticBody,A=d.IsAwake()&&m!==t.b2BodyType.b2_staticBody;if(!v&&!A)continue;var S=f.IsBullet()||p!==t.b2BodyType.b2_dynamicBody,b=d.IsBullet()||m!==t.b2BodyType.b2_dynamicBody;if(!S&&!b)continue;var T=f.m_sweep.alpha0;f.m_sweep.alpha0this.maxTimestep&&this.maxTimestep>0&&(i=this.maxTimestep);for(var n=this.m_bodyList;n;n=n.nextBody){var s=n.body;if(s.IsAwake()){var a=s.GetWorldVector(xt.MulMV(this.T,s.GetLocalVector(s.GetLinearVelocity(),Et.s_t0),Et.s_t1),e.Step_s_damping);s.SetLinearVelocity(Et.AddVV(s.GetLinearVelocity(),Et.MulSV(i,a,Et.s_t0),Et.s_t1))}}}},i.Draw=function(){},i.SetAxisAligned=function(t,e){this.T.ex.x=-t,this.T.ex.y=0,this.T.ey.x=0,this.T.ey.y=-e,this.maxTimestep=t>0||e>0?1/st(t,e):0},e}(Ss);ws.Step_s_damping=new Et;var xs=function(){this.vertices=[],this.count=0,this.masses=[],this.gravity=new Et(0,0),this.damping=.1,this.k2=.9,this.k3=.1},Rs=function(){function t(){this.m_count=0,this.m_ps=[],this.m_p0s=[],this.m_vs=[],this.m_ims=[],this.m_Ls=[],this.m_as=[],this.m_gravity=new Et,this.m_damping=0,this.m_k2=1,this.m_k3=.1}var e=t.prototype;return e.GetVertexCount=function(){return this.m_count},e.GetVertices=function(){return this.m_ps},e.Initialize=function(t){this.m_count=t.count,this.m_ps=Et.MakeArray(this.m_count),this.m_p0s=Et.MakeArray(this.m_count),this.m_vs=Et.MakeArray(this.m_count),this.m_ims=$(this.m_count);for(var e=0;e0?1/i:0}var n=this.m_count-1,r=this.m_count-2;this.m_Ls=$(n),this.m_as=$(r);for(var s=0;s0&&this.m_vs[n].SelfMulAdd(t,this.m_gravity),this.m_vs[n].SelfMul(i),this.m_ps[n].SelfMulAdd(t,this.m_vs[n]);for(var r=0;ra;)T=(m-=2*a)-this.m_as[i];for(;T<-a;)T=(m+=2*a)-this.m_as[i];var E=-this.m_k3*b*T;n.SelfMulAdd(o*E,v),r.SelfMulAdd(h*E,A),s.SelfMulAdd(u*E,S)}}}},e.Draw=function(t){for(var e=new Mt(.4,.5,.7),i=0;ip&&(m=g,p=y)}s=Eit(_,m,t),a=Eit(m,_,t)}return(o=o.concat(Cit(s))).concat(Cit(a))}o.push(t);for(var v=o.length-1;v>=0;v--)0==o[v].length&&o.splice(v,0);return o}function wit(t,e,i){if(xit(t,i)){if(Bit(Tit(t,i),Tit(t-1,i),Tit(e,i))&&Dit(Tit(t,i),Tit(t+1,i),Tit(e,i)))return!1}else if(Dit(Tit(t,i),Tit(t+1,i),Tit(e,i))||Bit(Tit(t,i),Tit(t-1,i),Tit(e,i)))return!1;if(xit(e,i)){if(Bit(Tit(e,i),Tit(e-1,i),Tit(t,i))&&Dit(Tit(e,i),Tit(e+1,i),Tit(t,i)))return!1}else if(Dit(Tit(e,i),Tit(e+1,i),Tit(t,i))||Bit(Tit(e,i),Tit(e-1,i),Tit(t,i)))return!1;for(var n=0;n0}function Bit(t,e,i){return Lit(t,e,i)>=0}function Dit(t,e,i){return Lit(t,e,i)<=0}function Pit(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function Mit(t){Oit(t)||t.reverse()}function Oit(t){return t.length<3||function(t){var e,i=0;for(e=0;e0}function Fit(t,e,i,n){var r,s=new _n,a=e.y-t.y,o=t.x-e.x,h=a*t.x+o*t.y,u=n.y-i.y,l=i.x-n.x,c=u*i.x+l*i.y,_=a*l-u*o;return r=_,0,Math.abs(r-0)<=1e-6||(s.x=(l*h-o*c)/_,s.y=(a*c-u*h)/_),s}function Nit(t,e,i,n,r){if(t==i||t==n||e==i||e==n)return!1;var s=t.x,a=t.y,o=e.x,h=e.y,u=i.x,l=i.y,c=n.x,_=n.y;if(Math.max(s,o)0&&f<1&&d>0&&d<1&&(r.x=s+f*(o-s),r.y=a+f*(h-a),!0))}function Lit(t,e,i){return t.x*(e.y-i.y)+e.x*(i.y-t.y)+i.x*(t.y-e.y)}var Vit=Object.freeze({__proto__:null,ConvexPartition:Cit,ForceCounterClockWise:Mit,IsCounterClockWise:Oit}),kit=function(){return 0},Git={impl:null,rigidBody:null,isAwake:!1,isSleeping:!1,initialize:kit,setType:kit,setLinearDamping:kit,setAngularDamping:kit,setGravityScale:kit,setFixedRotation:kit,setAllowSleep:kit,isActive:kit,setActive:kit,wakeUp:kit,sleep:kit,getMass:kit,getInertia:kit,getLinearVelocity:kit,setLinearVelocity:kit,getLinearVelocityFromWorldPoint:kit,getAngularVelocity:kit,setAngularVelocity:kit,getLocalVector:kit,getWorldVector:kit,getLocalPoint:kit,getWorldPoint:kit,getLocalCenter:kit,getWorldCenter:kit,applyForce:kit,applyForceToCenter:kit,applyTorque:kit,applyLinearImpulse:kit,applyLinearImpulseToCenter:kit,applyAngularImpulse:kit,onEnable:kit,onDisable:kit,onDestroy:kit},Uit={INITED:!1};var zit,Hit,Wit,Xit,jit,Yit,qit={INITED:!1},Kit={impl:null,initialize:kit,setDampingRatio:kit,setFrequency:kit,setMaxForce:kit,setTarget:kit,setDistance:kit,setAngularOffset:kit,setCorrectionFactor:kit,setLinearOffset:kit,setMaxLength:kit,setMaxTorque:kit,setLowerLimit:kit,setUpperLimit:kit,setMaxMotorForce:kit,setMaxMotorTorque:kit,setMotorSpeed:kit,enableLimit:kit,enableMotor:kit,setLowerAngle:kit,setUpperAngle:kit};!function(t){t[t.DYNAMIC=1]="DYNAMIC",t[t.STATIC=2]="STATIC",t[t.KINEMATIC=4]="KINEMATIC"}(zit||(zit={})),_e(zit),function(t){t[t.X_AXIS=0]="X_AXIS",t[t.Y_AXIS=1]="Y_AXIS",t[t.Z_AXIS=2]="Z_AXIS"}(Hit||(Hit={})),_e(Hit),function(t){t[t.VERTEX=1]="VERTEX",t[t.LINE=2]="LINE",t[t.TRIANGLE=3]="TRIANGLE",t[t.TETRAHEDRON=4]="TETRAHEDRON"}(Wit||(Wit={})),_e(Wit),function(t){t[t.BOX=0]="BOX",t[t.SPHERE=1]="SPHERE",t[t.CAPSULE=2]="CAPSULE",t[t.CYLINDER=3]="CYLINDER",t[t.CONE=4]="CONE",t[t.MESH=5]="MESH",t[t.PLANE=6]="PLANE",t[t.SIMPLEX=7]="SIMPLEX",t[t.TERRAIN=8]="TERRAIN"}(Xit||(Xit={})),_e(Xit),function(t){t[t.POINT_TO_POINT=0]="POINT_TO_POINT",t[t.HINGE=1]="HINGE",t[t.CONE_TWIST=2]="CONE_TWIST"}(jit||(jit={})),_e(jit),function(t){t[t.DEFAULT=1]="DEFAULT"}(Yit||(Yit={})),_e(Yit);var Jit=function(t){if(1===t){for(var e=this,i=function(t){var i="_"+(1<e;)this.physicsWorld.step(e,i,n),this._accumulator-=e;for(var s=this._delayEvents,a=0,o=s.length;a=mit.All?1:n)},i.getFixtures=function(){return this._fixtures},i.getPoints=function(){return this._points},i.getNormals=function(){return this._normals},i.getFractions=function(){return this._fractions},e}(git.RayCastCallback)),_st=[],fst=[new _n,new _n],dst=new git.WorldManifold,pst={points:[],separations:[],normal:new _n},mst=function(){this.localPoint=new _n,this.normalImpulse=0,this.tangentImpulse=0},gst=[new mst,new mst],yst={type:0,localPoint:new _n,localNormal:new _n,points:[]},vst={normalImpulses:[],tangentImpulses:[]},Ast=function(){function t(){this.colliderA=null,this.colliderB=null,this.disabled=!1,this.disabledOnce=!1,this._impulse=null,this._inverted=!1,this._b2contact=null}t.get=function(e){var i=_st.pop();return i||(i=new t),i.init(e),i},t.put=function(t){var e=t.m_userData;e&&(_st.push(e),e.reset())};var e=t.prototype;return e._setImpulse=function(t){this._impulse=t},e.init=function(t){this.colliderA=t.m_fixtureA.m_userData.collider,this.colliderB=t.m_fixtureB.m_userData.collider,this.disabled=!1,this.disabledOnce=!1,this._impulse=null,this._inverted=!1,this._b2contact=t,t.m_userData=this},e.reset=function(){this.setTangentSpeed(0),this.resetFriction(),this.resetRestitution(),this.colliderA=null,this.colliderB=null,this.disabled=!1,this._impulse=null,this._b2contact.m_userData=null,this._b2contact=null},e.getWorldManifold=function(){var t=pst.points,e=pst.separations,i=pst.normal;this._b2contact.GetWorldManifold(dst);var n=dst.points,r=dst.separations,s=this._b2contact.GetManifold().pointCount;t.length=e.length=s;for(var a=0;a0){for(var a=r.getPoints(),o=r.getNormals(),h=r.getFractions(),u=[],l=0,c=s.length;l=0;i--){var n=t[i];n.m_userData=null,gnt.instance.physicsWorld.unregisterContactFixture(n),e&&e.DestroyFixture(n)}this._body=null,this._fixtures.length=0,this._shapes.length=0,this._inited=!1}},u(t,[{key:"impl",get:function(){return this._shapes}},{key:"collider",get:function(){return this._collider}},{key:"worldAABB",get:function(){for(var t=1e7,e=t,i=t,n=-t,r=-t,s=this._fixtures,a=0;an&&(n=l.upperBound.x),l.upperBound.y>r&&(r=l.upperBound.y)}e*=Ait,i*=Ait,n*=Ait,r*=Ait;var c=this._rect;return c.x=e,c.y=i,c.width=n-e,c.height=r-i,c}}]),t}(),kst=new vn,Gst=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&r[0].equals(r[r.length-1])&&(r.length-=1);for(var s=Cit(r),a=n.offset,o=0;o=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},i.setWeight=function(t,e,i){var n=this._subMeshShapesWeights;if(!(e>=n.length)){var r=n[e];i>=r.length||(r[i]=t,this._uploadSubMeshShapesWeights(e))}},i.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;nthis._opts.over},e._average=function(t,e){if(void 0===e&&(e=0),this._opts.average){this._accumValue+=t,++this._accumSamples;var i=e;i-this._accumStart>=this._opts.average&&(this._averageValue=this._accumValue/this._accumSamples,this._accumValue=0,this._accumStart=i,this._accumSamples=0)}},u(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),kat=_u("cc.PerfCounter")(Pat=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=void 0,r._time=n,r}c(e,t);var i=e.prototype;return i.start=function(t){void 0===t&&(t=0),this._time=t},i.end=function(t){void 0===t&&(t=0),this._value=t-this._time,this._average(this._value)},i.tick=function(){this.end(),this.start()},i.frame=function(t){var e=t,i=e-this._time;this._total++,i>(this._opts.average||1e3)&&(this._value=1e3*this._total/i,this._total=0,this._time=e,this._average(this._value))},e}(Vat))||Pat,Gat="0123456789. ",Uat=500,zat={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},Hat={fps:{desc:"Framerate (FPS)",below:30,average:Uat,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:Uat},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:Uat,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:Uat},render:{desc:"Renderer (ms)",min:0,max:50,average:Uat,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},Wat=t("Profiler",function(t){function e(){var e;return(e=t.call(this)||this)._stats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._pipeline=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new Ir,e._canvasArr=[],e._regionArr=[e._region],e.digitsData=null,e.offsetData=null,e.pass=null,e._canvasDone=!1,e._statsDone=!1,e._inited=!1,e._lineHeight=256/(Object.keys(Hat).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}c(e,t);var i=e.prototype;return i.init=function(){ve.querySettings(ye.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),C.director.off(C.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),C.director.off(C.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),C.director.off(C.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),C.director.off(C.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),C.director.off(C.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),C.director.off(C.Director.EVENT_AFTER_DRAW,this.afterDraw,this),this._showFPS=!1,BN.root.pipeline.profiler=null,C.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=C.director.root;this._device=Qa.gfxDevice,this._swapchain=t.mainWindow.swapchain,this._pipeline=t.pipeline}this.generateCanvas(),this.generateStats(),C.game.once(C.Game.EVENT_ENGINE_INITED,this.generateNode,this),C.game.on(C.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),C.director.on(C.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),C.director.on(C.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),C.director.on(C.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),C.director.on(C.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),C.director.on(C.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),C.director.on(C.Director.EVENT_AFTER_DRAW,this.afterDraw,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,C.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=256,this._canvas.height=256,this._canvas.style.width=""+this._canvas.width,this._canvas.style.height=""+this._canvas.height,this._ctx.font="23px Arial",this._ctx.textBaseline="top",this._ctx.fillStyle="#fff",this._texture=this._device.createTexture(new Gr(Nn.TEX2D,Ln.SAMPLED|Ln.TRANSFER_DST,In.RGBA8,256,256)),this._region.texExtent.width=256,this._region.texExtent.height=256)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._stats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in Hat){var n=Hat[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new kat(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r=0;o--){var h=8*i+o,u=a[a.length-(8-o)],l=zat[u];void 0===l&&(l=11),n[h]=l}i++}}}},e}(KA)),Xat=t("profiler",new Wat);BN.registerSystem("profiler",Xat,0),C.profiler=Xat;var jat,Yat,qat=(jat=function(t,e){return(jat=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}jat(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});!function(t){var e,i,n,r=function(){function t(t,e,i){if(null==t)throw new Error("name cannot be null.");if(null==e)throw new Error("timelines cannot be null.");this.name=t,this.timelines=e,this.timelineIds=[];for(var n=0;n0&&(e%=this.duration));for(var h=this.timelines,u=0,l=h.length;u>>1;;){if(t[(s+1)*i]<=e?n=s+1:r=s,n==r)return(n+1)*i;s=n+r>>>1}},t.linearSearch=function(t,e,i){for(var n=0,r=t.length-i;n<=r;n+=i)if(t[n]>e)return n;return-1},t}();t.Animation=r,function(t){t[t.setup=0]="setup",t[t.first=1]="first",t[t.replace=2]="replace",t[t.add=3]="add"}(e=t.MixBlend||(t.MixBlend={})),function(t){t[t.mixIn=0]="mixIn",t[t.mixOut=1]="mixOut"}(i=t.MixDirection||(t.MixDirection={})),function(t){t[t.rotate=0]="rotate",t[t.translate=1]="translate",t[t.scale=2]="scale",t[t.shear=3]="shear",t[t.attachment=4]="attachment",t[t.color=5]="color",t[t.deform=6]="deform",t[t.event=7]="event",t[t.drawOrder=8]="drawOrder",t[t.ikConstraint=9]="ikConstraint",t[t.transformConstraint=10]="transformConstraint",t[t.pathConstraintPosition=11]="pathConstraintPosition",t[t.pathConstraintSpacing=12]="pathConstraintSpacing",t[t.pathConstraintMix=13]="pathConstraintMix",t[t.twoColor=14]="twoColor"}(n=t.TimelineType||(t.TimelineType={}));var s=function(){function e(i){if(i<=0)throw new Error("frameCount must be > 0: "+i);this.curves=t.Utils.newFloatArray((i-1)*e.BEZIER_SIZE)}return e.prototype.getFrameCount=function(){return this.curves.length/e.BEZIER_SIZE+1},e.prototype.setLinear=function(t){this.curves[t*e.BEZIER_SIZE]=e.LINEAR},e.prototype.setStepped=function(t){this.curves[t*e.BEZIER_SIZE]=e.STEPPED},e.prototype.getCurveType=function(t){var i=t*e.BEZIER_SIZE;if(i==this.curves.length)return e.LINEAR;var n=this.curves[i];return n==e.LINEAR?e.LINEAR:n==e.STEPPED?e.STEPPED:e.BEZIER},e.prototype.setCurve=function(t,i,n,r,s){var a=.03*(2*-i+r),o=.03*(2*-n+s),h=.006*(3*(i-r)+1),u=.006*(3*(n-s)+1),l=2*a+h,c=2*o+u,_=.3*i+a+.16666667*h,f=.3*n+o+.16666667*u,d=t*e.BEZIER_SIZE,p=this.curves;p[d++]=e.BEZIER;for(var m=_,g=f,y=d+e.BEZIER_SIZE-1;d=n){var l=void 0,c=void 0;return s==h?(l=0,c=0):(l=r[s-2],c=r[s-1]),c+(r[s+1]-c)*(n-l)/(o-l)}var _=r[s-1];return _+(1-_)*(n-o)/(1-o)},e.LINEAR=0,e.STEPPED=1,e.BEZIER=2,e.BEZIER_SIZE=19,e}();t.CurveTimeline=s;var a=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e<<1),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.rotate<<24)+this.boneIndex},s.prototype.setFrame=function(t,e,i){t<<=1,this.frames[t]=e,this.frames[t+s.ROTATION]=i},s.prototype.apply=function(t,i,n,a,o,h){var u=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n=u[u.length-s.ENTRIES]){var _=u[u.length+s.PREV_ROTATION];switch(h){case e.setup:l.rotation=l.data.rotation+_*o;break;case e.first:case e.replace:_+=l.data.rotation-l.rotation,_-=360*(16384-(16384.499999999996-_/360|0));case e.add:l.rotation+=_*o}}else{var f=r.binarySearch(u,n,s.ENTRIES),d=u[f+s.PREV_ROTATION],p=u[f],m=this.getCurvePercent((f>>1)-1,1-(n-p)/(u[f+s.PREV_TIME]-p)),g=u[f+s.ROTATION]-d;switch(g=d+(g-360*(16384-(16384.499999999996-g/360|0)))*m,h){case e.setup:l.rotation=l.data.rotation+(g-360*(16384-(16384.499999999996-g/360|0)))*o;break;case e.first:case e.replace:g+=l.data.rotation-l.rotation;case e.add:l.rotation+=(g-360*(16384-(16384.499999999996-g/360|0)))*o}}},s.ENTRIES=2,s.PREV_TIME=-2,s.PREV_ROTATION=-1,s.ROTATION=1,s}(s);t.RotateTimeline=a;var o=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.translate<<24)+this.boneIndex},s.prototype.setFrame=function(t,e,i,n){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.X]=i,this.frames[t+s.Y]=n},s.prototype.apply=function(t,i,n,a,o,h){var u=this.frames,l=t.bones[this.boneIndex];if(l.active)if(n=u[u.length-s.ENTRIES])c=u[u.length+s.PREV_X],_=u[u.length+s.PREV_Y];else{var f=r.binarySearch(u,n,s.ENTRIES);c=u[f+s.PREV_X],_=u[f+s.PREV_Y];var d=u[f],p=this.getCurvePercent(f/s.ENTRIES-1,1-(n-d)/(u[f+s.PREV_TIME]-d));c+=(u[f+s.X]-c)*p,_+=(u[f+s.Y]-_)*p}switch(h){case e.setup:l.x=l.data.x+c*o,l.y=l.data.y+_*o;break;case e.first:case e.replace:l.x+=(l.data.x+c-l.x)*o,l.y+=(l.data.y+_-l.y)*o;break;case e.add:l.x+=c*o,l.y+=_*o}}},s.ENTRIES=3,s.PREV_TIME=-3,s.PREV_X=-2,s.PREV_Y=-1,s.X=1,s.Y=2,s}(s);t.TranslateTimeline=o;var h=function(s){function a(t){return s.call(this,t)||this}return qat(a,s),a.prototype.getPropertyId=function(){return(n.scale<<24)+this.boneIndex},a.prototype.apply=function(n,s,o,h,u,l,c){var _=this.frames,f=n.bones[this.boneIndex];if(f.active)if(o<_[0])switch(l){case e.setup:return f.scaleX=f.data.scaleX,void(f.scaleY=f.data.scaleY);case e.first:f.scaleX+=(f.data.scaleX-f.scaleX)*u,f.scaleY+=(f.data.scaleY-f.scaleY)*u}else{var d=0,p=0;if(o>=_[_.length-a.ENTRIES])d=_[_.length+a.PREV_X]*f.data.scaleX,p=_[_.length+a.PREV_Y]*f.data.scaleY;else{var m=r.binarySearch(_,o,a.ENTRIES);d=_[m+a.PREV_X],p=_[m+a.PREV_Y];var g=_[m],y=this.getCurvePercent(m/a.ENTRIES-1,1-(o-g)/(_[m+a.PREV_TIME]-g));d=(d+(_[m+a.X]-d)*y)*f.data.scaleX,p=(p+(_[m+a.Y]-p)*y)*f.data.scaleY}if(1==u)l==e.add?(f.scaleX+=d-f.data.scaleX,f.scaleY+=p-f.data.scaleY):(f.scaleX=d,f.scaleY=p);else{var v=0,A=0;if(c==i.mixOut)switch(l){case e.setup:v=f.data.scaleX,A=f.data.scaleY,f.scaleX=v+(Math.abs(d)*t.MathUtils.signum(v)-v)*u,f.scaleY=A+(Math.abs(p)*t.MathUtils.signum(A)-A)*u;break;case e.first:case e.replace:v=f.scaleX,A=f.scaleY,f.scaleX=v+(Math.abs(d)*t.MathUtils.signum(v)-v)*u,f.scaleY=A+(Math.abs(p)*t.MathUtils.signum(A)-A)*u;break;case e.add:v=f.scaleX,A=f.scaleY,f.scaleX=v+(Math.abs(d)*t.MathUtils.signum(v)-f.data.scaleX)*u,f.scaleY=A+(Math.abs(p)*t.MathUtils.signum(A)-f.data.scaleY)*u}else switch(l){case e.setup:v=Math.abs(f.data.scaleX)*t.MathUtils.signum(d),A=Math.abs(f.data.scaleY)*t.MathUtils.signum(p),f.scaleX=v+(d-v)*u,f.scaleY=A+(p-A)*u;break;case e.first:case e.replace:v=Math.abs(f.scaleX)*t.MathUtils.signum(d),A=Math.abs(f.scaleY)*t.MathUtils.signum(p),f.scaleX=v+(d-v)*u,f.scaleY=A+(p-A)*u;break;case e.add:v=t.MathUtils.signum(d),A=t.MathUtils.signum(p),f.scaleX=Math.abs(f.scaleX)*v+(d-Math.abs(f.data.scaleX)*v)*u,f.scaleY=Math.abs(f.scaleY)*A+(p-Math.abs(f.data.scaleY)*A)*u}}}},a}(o);t.ScaleTimeline=h;var u=function(t){function i(e){return t.call(this,e)||this}return qat(i,t),i.prototype.getPropertyId=function(){return(n.shear<<24)+this.boneIndex},i.prototype.apply=function(t,n,s,a,o,h){var u=this.frames,l=t.bones[this.boneIndex];if(l.active)if(s=u[u.length-i.ENTRIES])c=u[u.length+i.PREV_X],_=u[u.length+i.PREV_Y];else{var f=r.binarySearch(u,s,i.ENTRIES);c=u[f+i.PREV_X],_=u[f+i.PREV_Y];var d=u[f],p=this.getCurvePercent(f/i.ENTRIES-1,1-(s-d)/(u[f+i.PREV_TIME]-d));c+=(u[f+i.X]-c)*p,_+=(u[f+i.Y]-_)*p}switch(h){case e.setup:l.shearX=l.data.shearX+c*o,l.shearY=l.data.shearY+_*o;break;case e.first:case e.replace:l.shearX+=(l.data.shearX+c-l.shearX)*o,l.shearY+=(l.data.shearY+_-l.shearY)*o;break;case e.add:l.shearX+=c*o,l.shearY+=_*o}}},i}(o);t.ShearTimeline=u;var l=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.color<<24)+this.slotIndex},s.prototype.setFrame=function(t,e,i,n,r,a){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.R]=i,this.frames[t+s.G]=n,this.frames[t+s.B]=r,this.frames[t+s.A]=a},s.prototype.apply=function(t,i,n,a,o,h){var u=t.slots[this.slotIndex];if(u.bone.active){var l=this.frames;if(n=l[l.length-s.ENTRIES]){var g=l.length;f=l[g+s.PREV_R],d=l[g+s.PREV_G],p=l[g+s.PREV_B],m=l[g+s.PREV_A]}else{var y=r.binarySearch(l,n,s.ENTRIES);f=l[y+s.PREV_R],d=l[y+s.PREV_G],p=l[y+s.PREV_B],m=l[y+s.PREV_A];var v=l[y],A=this.getCurvePercent(y/s.ENTRIES-1,1-(n-v)/(l[y+s.PREV_TIME]-v));f+=(l[y+s.R]-f)*A,d+=(l[y+s.G]-d)*A,p+=(l[y+s.B]-p)*A,m+=(l[y+s.A]-m)*A}1==o?u.color.set(f,d,p,m):(c=u.color,h==e.setup&&c.setFromColor(u.data.color),c.add((f-c.r)*o,(d-c.g)*o,(p-c.b)*o,(m-c.a)*o))}}},s.ENTRIES=5,s.PREV_TIME=-5,s.PREV_R=-4,s.PREV_G=-3,s.PREV_B=-2,s.PREV_A=-1,s.R=1,s.G=2,s.B=3,s.A=4,s}(s);t.ColorTimeline=l;var c=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.twoColor<<24)+this.slotIndex},s.prototype.setFrame=function(t,e,i,n,r,a,o,h,u){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.R]=i,this.frames[t+s.G]=n,this.frames[t+s.B]=r,this.frames[t+s.A]=a,this.frames[t+s.R2]=o,this.frames[t+s.G2]=h,this.frames[t+s.B2]=u},s.prototype.apply=function(t,i,n,a,o,h){var u=t.slots[this.slotIndex];if(u.bone.active){var l=this.frames;if(n=l[l.length-s.ENTRIES]){var b=l.length;p=l[b+s.PREV_R],m=l[b+s.PREV_G],g=l[b+s.PREV_B],y=l[b+s.PREV_A],v=l[b+s.PREV_R2],A=l[b+s.PREV_G2],S=l[b+s.PREV_B2]}else{var T=r.binarySearch(l,n,s.ENTRIES);p=l[T+s.PREV_R],m=l[T+s.PREV_G],g=l[T+s.PREV_B],y=l[T+s.PREV_A],v=l[T+s.PREV_R2],A=l[T+s.PREV_G2],S=l[T+s.PREV_B2];var E=l[T],C=this.getCurvePercent(T/s.ENTRIES-1,1-(n-E)/(l[T+s.PREV_TIME]-E));p+=(l[T+s.R]-p)*C,m+=(l[T+s.G]-m)*C,g+=(l[T+s.B]-g)*C,y+=(l[T+s.A]-y)*C,v+=(l[T+s.R2]-v)*C,A+=(l[T+s.G2]-A)*C,S+=(l[T+s.B2]-S)*C}1==o?(u.color.set(p,m,g,y),u.darkColor.set(v,A,S,1)):(c=u.color,_=u.darkColor,h==e.setup&&(c.setFromColor(u.data.color),_.setFromColor(u.data.darkColor)),c.add((p-c.r)*o,(m-c.g)*o,(g-c.b)*o,(y-c.a)*o),_.add((v-_.r)*o,(A-_.g)*o,(S-_.b)*o,0))}}},s.ENTRIES=8,s.PREV_TIME=-8,s.PREV_R=-7,s.PREV_G=-6,s.PREV_B=-5,s.PREV_A=-4,s.PREV_R2=-3,s.PREV_G2=-2,s.PREV_B2=-1,s.R=1,s.G=2,s.B=3,s.A=4,s.R2=5,s.G2=6,s.B2=7,s}(s);t.TwoColorTimeline=c;var _=function(){function s(e){this.frames=t.Utils.newFloatArray(e),this.attachmentNames=new Array(e)}return s.prototype.getPropertyId=function(){return(n.attachment<<24)+this.slotIndex},s.prototype.getFrameCount=function(){return this.frames.length},s.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.attachmentNames[t]=i},s.prototype.apply=function(t,n,s,a,o,h,u){var l=t.slots[this.slotIndex];if(l.bone.active)if(u!=i.mixOut||h!=e.setup){var c=this.frames;if(s=c[c.length-1]?c.length-1:r.binarySearch(c,s,1)-1;var d=this.attachmentNames[f];t.slots[this.slotIndex].setAttachment(null==d?null:t.getAttachment(this.slotIndex,d))}}else{var p=l.data.attachmentName;l.setAttachment(null==p?null:t.getAttachment(this.slotIndex,p))}},s}();t.AttachmentTimeline=_;var f=null,d=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e),n.frameVertices=new Array(e),null==f&&(f=t.Utils.newFloatArray(64)),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.deform<<27)+ +this.attachment.id+this.slotIndex},s.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.frameVertices[t]=i},s.prototype.apply=function(i,n,s,a,o,h){var u=i.slots[this.slotIndex];if(u.bone.active){var l=u.getAttachment();if(l instanceof t.VertexAttachment&&l.deformAttachment==this.attachment){var c=u.deform;0==c.length&&(h=e.setup);var _=this.frameVertices,f=_[0].length,d=this.frames;if(s=d[d.length-1]){var A=_[d.length-1];if(1==o)if(h==e.add)if(null==(p=l).bones){g=p.vertices;for(var S=0;Si)this.apply(t,e,Number.MAX_VALUE,n,s,a,o),e=-1;else if(e>=h[u-1])return;if(!(i0&&h[l-1]==c;)l--;for(;l=h[l];l++)n.push(this.events[l])}}},e}();t.EventTimeline=p;var m=function(){function s(e){this.frames=t.Utils.newFloatArray(e),this.drawOrders=new Array(e)}return s.prototype.getPropertyId=function(){return n.drawOrder<<24},s.prototype.getFrameCount=function(){return this.frames.length},s.prototype.setFrame=function(t,e,i){this.frames[t]=e,this.drawOrders[t]=i},s.prototype.apply=function(n,s,a,o,h,u,l){var c=n.drawOrder,_=n.slots;if(l!=i.mixOut||u!=e.setup){var f=this.frames;if(a=f[f.length-1]?f.length-1:r.binarySearch(f,a)-1;var p=this.drawOrders[d];if(null==p)t.Utils.arrayCopy(_,0,c,0,_.length);else for(var m=0,g=p.length;m=c[c.length-a.ENTRIES])u==e.setup?(_.mix=_.data.mix+(c[c.length+a.PREV_MIX]-_.data.mix)*h,_.softness=_.data.softness+(c[c.length+a.PREV_SOFTNESS]-_.data.softness)*h,l==i.mixOut?(_.bendDirection=_.data.bendDirection,_.compress=_.data.compress,_.stretch=_.data.stretch):(_.bendDirection=c[c.length+a.PREV_BEND_DIRECTION],_.compress=0!=c[c.length+a.PREV_COMPRESS],_.stretch=0!=c[c.length+a.PREV_STRETCH])):(_.mix+=(c[c.length+a.PREV_MIX]-_.mix)*h,_.softness+=(c[c.length+a.PREV_SOFTNESS]-_.softness)*h,l==i.mixIn&&(_.bendDirection=c[c.length+a.PREV_BEND_DIRECTION],_.compress=0!=c[c.length+a.PREV_COMPRESS],_.stretch=0!=c[c.length+a.PREV_STRETCH]));else{var f=r.binarySearch(c,s,a.ENTRIES),d=c[f+a.PREV_MIX],p=c[f+a.PREV_SOFTNESS],m=c[f],g=this.getCurvePercent(f/a.ENTRIES-1,1-(s-m)/(c[f+a.PREV_TIME]-m));u==e.setup?(_.mix=_.data.mix+(d+(c[f+a.MIX]-d)*g-_.data.mix)*h,_.softness=_.data.softness+(p+(c[f+a.SOFTNESS]-p)*g-_.data.softness)*h,l==i.mixOut?(_.bendDirection=_.data.bendDirection,_.compress=_.data.compress,_.stretch=_.data.stretch):(_.bendDirection=c[f+a.PREV_BEND_DIRECTION],_.compress=0!=c[f+a.PREV_COMPRESS],_.stretch=0!=c[f+a.PREV_STRETCH])):(_.mix+=(d+(c[f+a.MIX]-d)*g-_.mix)*h,_.softness+=(p+(c[f+a.SOFTNESS]-p)*g-_.softness)*h,l==i.mixIn&&(_.bendDirection=c[f+a.PREV_BEND_DIRECTION],_.compress=0!=c[f+a.PREV_COMPRESS],_.stretch=0!=c[f+a.PREV_STRETCH]))}},a.ENTRIES=6,a.PREV_TIME=-6,a.PREV_MIX=-5,a.PREV_SOFTNESS=-4,a.PREV_BEND_DIRECTION=-3,a.PREV_COMPRESS=-2,a.PREV_STRETCH=-1,a.MIX=1,a.SOFTNESS=2,a.BEND_DIRECTION=3,a.COMPRESS=4,a.STRETCH=5,a}(s);t.IkConstraintTimeline=g;var y=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.transformConstraint<<24)+this.transformConstraintIndex},s.prototype.setFrame=function(t,e,i,n,r,a){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.ROTATE]=i,this.frames[t+s.TRANSLATE]=n,this.frames[t+s.SCALE]=r,this.frames[t+s.SHEAR]=a},s.prototype.apply=function(t,i,n,a,o,h){var u=this.frames,l=t.transformConstraints[this.transformConstraintIndex];if(l.active)if(n=u[u.length-s.ENTRIES]){var m=u.length;_=u[m+s.PREV_ROTATE],f=u[m+s.PREV_TRANSLATE],d=u[m+s.PREV_SCALE],p=u[m+s.PREV_SHEAR]}else{var g=r.binarySearch(u,n,s.ENTRIES);_=u[g+s.PREV_ROTATE],f=u[g+s.PREV_TRANSLATE],d=u[g+s.PREV_SCALE],p=u[g+s.PREV_SHEAR];var y=u[g],v=this.getCurvePercent(g/s.ENTRIES-1,1-(n-y)/(u[g+s.PREV_TIME]-y));_+=(u[g+s.ROTATE]-_)*v,f+=(u[g+s.TRANSLATE]-f)*v,d+=(u[g+s.SCALE]-d)*v,p+=(u[g+s.SHEAR]-p)*v}h==e.setup?(c=l.data,l.rotateMix=c.rotateMix+(_-c.rotateMix)*o,l.translateMix=c.translateMix+(f-c.translateMix)*o,l.scaleMix=c.scaleMix+(d-c.scaleMix)*o,l.shearMix=c.shearMix+(p-c.shearMix)*o):(l.rotateMix+=(_-l.rotateMix)*o,l.translateMix+=(f-l.translateMix)*o,l.scaleMix+=(d-l.scaleMix)*o,l.shearMix+=(p-l.shearMix)*o)}},s.ENTRIES=5,s.PREV_TIME=-5,s.PREV_ROTATE=-4,s.PREV_TRANSLATE=-3,s.PREV_SCALE=-2,s.PREV_SHEAR=-1,s.ROTATE=1,s.TRANSLATE=2,s.SCALE=3,s.SHEAR=4,s}(s);t.TransformConstraintTimeline=y;var v=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.pathConstraintPosition<<24)+this.pathConstraintIndex},s.prototype.setFrame=function(t,e,i){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.VALUE]=i},s.prototype.apply=function(t,i,n,a,o,h){var u=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n=u[u.length-s.ENTRIES])c=u[u.length+s.PREV_VALUE];else{var _=r.binarySearch(u,n,s.ENTRIES);c=u[_+s.PREV_VALUE];var f=u[_],d=this.getCurvePercent(_/s.ENTRIES-1,1-(n-f)/(u[_+s.PREV_TIME]-f));c+=(u[_+s.VALUE]-c)*d}h==e.setup?l.position=l.data.position+(c-l.data.position)*o:l.position+=(c-l.position)*o}},s.ENTRIES=2,s.PREV_TIME=-2,s.PREV_VALUE=-1,s.VALUE=1,s}(s);t.PathConstraintPositionTimeline=v;var A=function(t){function i(e){return t.call(this,e)||this}return qat(i,t),i.prototype.getPropertyId=function(){return(n.pathConstraintSpacing<<24)+this.pathConstraintIndex},i.prototype.apply=function(t,n,s,a,o,h){var u=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(s=u[u.length-i.ENTRIES])c=u[u.length+i.PREV_VALUE];else{var _=r.binarySearch(u,s,i.ENTRIES);c=u[_+i.PREV_VALUE];var f=u[_],d=this.getCurvePercent(_/i.ENTRIES-1,1-(s-f)/(u[_+i.PREV_TIME]-f));c+=(u[_+i.VALUE]-c)*d}h==e.setup?l.spacing=l.data.spacing+(c-l.data.spacing)*o:l.spacing+=(c-l.spacing)*o}},i}(v);t.PathConstraintSpacingTimeline=A;var S=function(i){function s(e){var n=i.call(this,e)||this;return n.frames=t.Utils.newFloatArray(e*s.ENTRIES),n}return qat(s,i),s.prototype.getPropertyId=function(){return(n.pathConstraintMix<<24)+this.pathConstraintIndex},s.prototype.setFrame=function(t,e,i,n){t*=s.ENTRIES,this.frames[t]=e,this.frames[t+s.ROTATE]=i,this.frames[t+s.TRANSLATE]=n},s.prototype.apply=function(t,i,n,a,o,h){var u=this.frames,l=t.pathConstraints[this.pathConstraintIndex];if(l.active)if(n=u[u.length-s.ENTRIES])c=u[u.length+s.PREV_ROTATE],_=u[u.length+s.PREV_TRANSLATE];else{var f=r.binarySearch(u,n,s.ENTRIES);c=u[f+s.PREV_ROTATE],_=u[f+s.PREV_TRANSLATE];var d=u[f],p=this.getCurvePercent(f/s.ENTRIES-1,1-(n-d)/(u[f+s.PREV_TIME]-d));c+=(u[f+s.ROTATE]-c)*p,_+=(u[f+s.TRANSLATE]-_)*p}h==e.setup?(l.rotateMix=l.data.rotateMix+(c-l.data.rotateMix)*o,l.translateMix=l.data.translateMix+(_-l.data.translateMix)*o):(l.rotateMix+=(c-l.rotateMix)*o,l.translateMix+=(_-l.translateMix)*o)}},s.ENTRIES=3,s.PREV_TIME=-3,s.PREV_ROTATE=-2,s.PREV_TRANSLATE=-1,s.ROTATE=1,s.TRANSLATE=2,s}(s);t.PathConstraintMixTimeline=S}(Yat||(Yat={})),function(t){var e=function(){function e(e){this.tracks=new Array,this.timeScale=1,this.events=new Array,this.listeners=new Array,this.queue=new r(this),this.propertyIDs=new t.IntSet,this.animationsChanged=!1,this.trackEntryPool=new t.Pool((function(){return new i})),this.data=e}return e.prototype.update=function(t){t*=this.timeScale;for(var e=this.tracks,i=0,n=e.length;i0){if(r.delay-=s,r.delay>0)continue;s=-r.delay,r.delay=0}var a=r.next;if(null!=a){var o=r.trackLast-a.delay;if(o>=0){for(a.delay=0,a.trackTime+=0==r.timeScale?0:(o/r.timeScale+t)*a.timeScale,r.trackTime+=s,this.setCurrent(i,a,!0);null!=a.mixingFrom;)a.mixTime+=t,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&null==r.mixingFrom){e[i]=null,this.queue.end(r),this.disposeNext(r);continue}if(null!=r.mixingFrom&&this.updateMixingFrom(r,t)){var h=r.mixingFrom;for(r.mixingFrom=null,null!=h&&(h.mixingTo=null);null!=h;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=s}}this.queue.drain()},e.prototype.updateMixingFrom=function(t,e){var i=t.mixingFrom;if(null==i)return!0;var n=this.updateMixingFrom(i,e);return i.animationLast=i.nextAnimationLast,i.trackLast=i.nextTrackLast,t.mixTime>0&&t.mixTime>=t.mixDuration?(0!=i.totalAlpha&&0!=t.mixDuration||(t.mixingFrom=i.mixingFrom,null!=i.mixingFrom&&(i.mixingFrom.mixingTo=t),t.interruptAlpha=i.interruptAlpha,this.queue.end(i)),n):(i.trackTime+=e*i.timeScale,t.mixTime+=e,!1)},e.prototype.apply=function(i){if(null==i)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();for(var n=this.events,r=this.tracks,s=!1,a=0,o=r.length;a0)){s=!0;var u=0==a?t.MixBlend.first:h.mixBlend,l=h.alpha;null!=h.mixingFrom?l*=this.applyMixingFrom(h,i,u):h.trackTime>=h.trackEnd&&null==h.next&&(l=0);var c=h.animationLast,_=h.getAnimationTime(),f=h.animation.timelines.length,d=h.animation.timelines;if(0==a&&1==l||u==t.MixBlend.add)for(var p=0;p1&&(a=1),r!=t.MixBlend.first&&(r=s.mixBlend));var o=a0&&this.queueEvents(s,c),this.events.length=0,s.nextAnimationLast=c,s.nextTrackLast=s.trackTime,a},e.prototype.applyRotateTimeline=function(e,i,n,r,s,a,o,h){if(h&&(a[o]=0),1!=r){var u=e,l=u.frames,c=i.bones[u.boneIndex];if(c.active){var _=0,f=0;if(n=l[l.length-t.RotateTimeline.ENTRIES])f=c.data.rotation+l[l.length+t.RotateTimeline.PREV_ROTATION];else{var d=t.Animation.binarySearch(l,n,t.RotateTimeline.ENTRIES),p=l[d+t.RotateTimeline.PREV_ROTATION],m=l[d],g=u.getCurvePercent((d>>1)-1,1-(n-m)/(l[d+t.RotateTimeline.PREV_TIME]-m));f=l[d+t.RotateTimeline.ROTATION]-p,f=p+(f-=360*(16384-(16384.499999999996-f/360|0)))*g+c.data.rotation,f-=360*(16384-(16384.499999999996-f/360|0))}var y=0,v=f-_;if(0==(v-=360*(16384-(16384.499999999996-v/360|0))))y=a[o];else{var A=0,S=0;h?(A=0,S=v):(A=a[o],S=a[o+1]);var b=v>0,T=A>=0;t.MathUtils.signum(S)!=t.MathUtils.signum(v)&&Math.abs(S)<=90&&(Math.abs(A)>180&&(A+=360*t.MathUtils.signum(A)),T=b),y=v+A-A%360,T!=b&&(y+=360*t.MathUtils.signum(A)),a[o]=y}a[o+1]=v,_+=y*r,c.rotation=_-360*(16384-(16384.499999999996-_/360|0))}}else e.apply(i,0,n,null,1,s,t.MixDirection.mixIn)},e.prototype.queueEvents=function(t,e){for(var i=t.animationStart,n=t.animationEnd,r=n-i,s=t.trackLast%r,a=this.events,o=0,h=a.length;on||this.queue.event(t,u)}for((t.loop?0==r||s>t.trackTime%r:e>=n&&t.animationLast=this.tracks.length)){var e=this.tracks[t];if(null!=e){this.queue.end(e),this.disposeNext(e);for(var i=e;;){var n=i.mixingFrom;if(null==n)break;this.queue.end(n),i.mixingFrom=null,i.mixingTo=null,i=n}this.tracks[e.trackIndex]=null,this.queue.drain()}}},e.prototype.setCurrent=function(t,e,i){var n=this.expandToIndex(t);this.tracks[t]=e,null!=n&&(i&&this.queue.interrupt(n),e.mixingFrom=n,n.mixingTo=e,e.mixTime=0,null!=n.mixingFrom&&n.mixDuration>0&&(e.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(e)},e.prototype.setAnimation=function(t,e,i){var n=this.data.skeletonData.findAnimation(e);if(null==n)throw new Error("Animation not found: "+e);return this.setAnimationWith(t,n,i)},e.prototype.setAnimationWith=function(t,e,i){if(null==e)throw new Error("animation cannot be null.");var n=!0,r=this.expandToIndex(t);null!=r&&(-1==r.nextTrackLast?(this.tracks[t]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.disposeNext(r),r=r.mixingFrom,n=!1):this.disposeNext(r));var s=this.trackEntry(t,e,i,r);return this.setCurrent(t,s,n),this.queue.drain(),s},e.prototype.addAnimation=function(t,e,i,n){var r=this.data.skeletonData.findAnimation(e);if(null==r)throw new Error("Animation not found: "+e);return this.addAnimationWith(t,r,i,n)},e.prototype.addAnimationWith=function(t,e,i,n){if(null==e)throw new Error("animation cannot be null.");var r=this.expandToIndex(t);if(null!=r)for(;null!=r.next;)r=r.next;var s=this.trackEntry(t,e,i,r);if(null==r)this.setCurrent(t,s,!0),this.queue.drain();else if(r.next=s,n<=0){var a=r.animationEnd-r.animationStart;0!=a?(r.loop?n+=a*(1+(r.trackTime/a|0)):n+=Math.max(a,r.trackTime),n-=this.data.getMix(r.animation,e)):n=r.trackTime}return s.delay=n,s},e.prototype.setEmptyAnimation=function(t,i){var n=this.setAnimationWith(t,e.emptyAnimation,!1);return n.mixDuration=i,n.trackEnd=i,n},e.prototype.addEmptyAnimation=function(t,i,n){n<=0&&(n-=i);var r=this.addAnimationWith(t,e.emptyAnimation,!1,n);return r.mixDuration=i,r.trackEnd=i,r},e.prototype.setEmptyAnimations=function(t){var e=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(var i=0,n=this.tracks.length;i=0;e--)for(var n=this.tracks[e];null!=n;)this.computeNotLast(n),n=n.mixingFrom},e.prototype.computeHold=function(i){var n=i.mixingTo,r=i.animation.timelines,s=i.animation.timelines.length,a=t.Utils.setArraySize(i.timelineMode,s);i.timelineHoldMix.length=0;var o=t.Utils.setArraySize(i.timelineHoldMix,s),h=this.propertyIDs;if(null!=n&&n.holdPrevious)for(var u=0;u0){a[u]=e.HOLD_MIX,o[u]=_;continue t}break}a[u]=e.HOLD}else a[u]=e.SUBSEQUENT}},e.prototype.computeNotLast=function(i){for(var n=i.animation.timelines,r=i.animation.timelines.length,s=i.timelineMode,a=this.propertyIDs,o=0;o=this.tracks.length?null:this.tracks[t]},e.prototype.addListener=function(t){if(null==t)throw new Error("listener cannot be null.");this.listeners.push(t)},e.prototype.removeListener=function(t){var e=this.listeners.indexOf(t);e>=0&&this.listeners.splice(e,1)},e.prototype.clearListeners=function(){this.listeners.length=0},e.prototype.clearListenerNotifications=function(){this.queue.clear()},e.emptyAnimation=new t.Animation("",[],0),e.SUBSEQUENT=0,e.FIRST=1,e.HOLD=2,e.HOLD_MIX=3,e.NOT_LAST=4,e}();t.AnimationState=e;var i=function(){function e(){this.mixBlend=t.MixBlend.replace,this.timelineMode=new Array,this.timelineHoldMix=new Array,this.timelinesRotation=new Array}return e.prototype.reset=function(){this.next=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0},e.prototype.getAnimationTime=function(){if(this.loop){var t=this.animationEnd-this.animationStart;return 0==t?this.animationStart:this.trackTime%t+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)},e.prototype.setAnimationLast=function(t){this.animationLast=t,this.nextAnimationLast=t},e.prototype.isComplete=function(){return this.trackTime>=this.animationEnd-this.animationStart},e.prototype.resetRotationDirections=function(){this.timelinesRotation.length=0},e}();t.TrackEntry=i;var n,r=function(){function t(t){this.objects=[],this.drainDisabled=!1,this.animState=t}return t.prototype.start=function(t){this.objects.push(n.start),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.interrupt=function(t){this.objects.push(n.interrupt),this.objects.push(t)},t.prototype.end=function(t){this.objects.push(n.end),this.objects.push(t),this.animState.animationsChanged=!0},t.prototype.dispose=function(t){this.objects.push(n.dispose),this.objects.push(t)},t.prototype.complete=function(t){this.objects.push(n.complete),this.objects.push(t)},t.prototype.event=function(t,e){this.objects.push(n.event),this.objects.push(t),this.objects.push(e)},t.prototype.drain=function(){if(!this.drainDisabled){this.drainDisabled=!0;for(var t=this.objects,e=this.animState.listeners,i=0;i=0?i.substring(0,i.lastIndexOf("/")):"";i=this.pathPrefix+i,this.toLoad++,e.downloadText(i,(function(e){var o={count:0},h=new Array;try{new t.TextureAtlas(e,(function(e){h.push(a+"/"+e);var i=document.createElement("img");return i.width=16,i.height=16,new t.FakeTexture(i)}))}catch(t){var u=t;return s.errors[i]="Couldn't load texture atlas "+i+": "+u.message,r&&r(i,"Couldn't load texture atlas "+i+": "+u.message),s.toLoad--,void s.loaded++}for(var l=function(u){var l=!1;s.loadTexture(u,(function(u){if(o.count++,o.count==h.length)if(l)s.errors[i]="Couldn't load texture atlas page "+u+"} of atlas "+i,r&&r(i,"Couldn't load texture atlas page "+u+" of atlas "+i),s.toLoad--,s.loaded++;else try{var c=new t.TextureAtlas(e,(function(t){return s.get(a+"/"+t)}));s.assets[i]=c,n&&n(i,c),s.toLoad--,s.loaded++}catch(t){var _=t;s.errors[i]="Couldn't load texture atlas "+i+": "+_.message,r&&r(i,"Couldn't load texture atlas "+i+": "+_.message),s.toLoad--,s.loaded++}}),(function(t){l=!0,o.count++,o.count==h.length&&(s.errors[i]="Couldn't load texture atlas page "+t+"} of atlas "+i,r&&r(i,"Couldn't load texture atlas page "+t+" of atlas "+i),s.toLoad--,s.loaded++)}))},c=0,_=h;c<_.length;c++)l(_[c])}),(function(t,e){s.errors[i]="Couldn't load texture atlas "+i+": status "+status+", "+e,r&&r(i,"Couldn't load texture atlas "+i+": status "+status+", "+e),s.toLoad--,s.loaded++}))},e.prototype.get=function(t){return t=this.pathPrefix+t,this.assets[t]},e.prototype.remove=function(t){t=this.pathPrefix+t;var e=this.assets[t];e.dispose&&e.dispose(),this.assets[t]=null},e.prototype.removeAll=function(){for(var t in this.assets){var e=this.assets[t];e.dispose&&e.dispose()}this.assets={}},e.prototype.isLoadingComplete=function(){return 0==this.toLoad},e.prototype.getToLoad=function(){return this.toLoad},e.prototype.getLoaded=function(){return this.loaded},e.prototype.dispose=function(){this.removeAll()},e.prototype.hasErrors=function(){return Object.keys(this.errors).length>0},e.prototype.getErrors=function(){return this.errors},e}();t.AssetManager=e}(Yat||(Yat={})),function(t){var e=function(){function e(t){this.atlas=t}return e.prototype.newRegionAttachment=function(e,i,n){var r=this.atlas.findRegion(n);if(null==r)return null;r.renderObject=r;var s=new t.RegionAttachment(i);return s.setRegion(r),s},e.prototype.newMeshAttachment=function(e,i,n){var r=this.atlas.findRegion(n);if(null==r)return null;r.renderObject=r;var s=new t.MeshAttachment(i);return s.region=r,s},e.prototype.newBoundingBoxAttachment=function(e,i){return new t.BoundingBoxAttachment(i)},e.prototype.newPathAttachment=function(e,i){return new t.PathAttachment(i)},e.prototype.newPointAttachment=function(e,i){return new t.PointAttachment(i)},e.prototype.newClippingAttachment=function(e,i){return new t.ClippingAttachment(i)},e}();t.AtlasAttachmentLoader=e}(Yat||(Yat={})),function(t){!function(t){t[t.Normal=0]="Normal",t[t.Additive=1]="Additive",t[t.Multiply=2]="Multiply",t[t.Screen=3]="Screen"}(t.BlendMode||(t.BlendMode={}))}(Yat||(Yat={})),function(t){var e=function(){function e(t,e,i){if(this.children=new Array,this.x=0,this.y=0,this.rotation=0,this.scaleX=0,this.scaleY=0,this.shearX=0,this.shearY=0,this.ax=0,this.ay=0,this.arotation=0,this.ascaleX=0,this.ascaleY=0,this.ashearX=0,this.ashearY=0,this.appliedValid=!1,this.a=0,this.b=0,this.c=0,this.d=0,this.worldY=0,this.worldX=0,this.sorted=!1,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.skeleton=e,this.parent=i,this.setToSetupPose()}return e.prototype.isActive=function(){return this.active},e.prototype.update=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransform=function(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)},e.prototype.updateWorldTransformWith=function(e,i,n,r,s,a,o){this.ax=e,this.ay=i,this.arotation=n,this.ascaleX=r,this.ascaleY=s,this.ashearX=a,this.ashearY=o,this.appliedValid=!0;var h=this.parent;if(null==h){var u=this.skeleton,l=n+90+o,c=u.scaleX,_=u.scaleY;return this.a=t.MathUtils.cosDeg(n+a)*r*c,this.b=t.MathUtils.cosDeg(l)*s*c,this.c=t.MathUtils.sinDeg(n+a)*r*_,this.d=t.MathUtils.sinDeg(l)*s*_,this.worldX=e*c+u.x,void(this.worldY=i*_+u.y)}var f=h.a,d=h.b,p=h.c,m=h.d;switch(this.worldX=f*e+d*i+h.worldX,this.worldY=p*e+m*i+h.worldY,this.data.transformMode){case t.TransformMode.Normal:l=n+90+o;var g=t.MathUtils.cosDeg(n+a)*r,y=t.MathUtils.cosDeg(l)*s,v=t.MathUtils.sinDeg(n+a)*r,A=t.MathUtils.sinDeg(l)*s;return this.a=f*g+d*v,this.b=f*y+d*A,this.c=p*g+m*v,void(this.d=p*y+m*A);case t.TransformMode.OnlyTranslation:l=n+90+o,this.a=t.MathUtils.cosDeg(n+a)*r,this.b=t.MathUtils.cosDeg(l)*s,this.c=t.MathUtils.sinDeg(n+a)*r,this.d=t.MathUtils.sinDeg(l)*s;break;case t.TransformMode.NoRotationOrReflection:var S=0;(E=f*f+p*p)>1e-4?(d=p*(E=Math.abs(f*m-d*p)/E),m=f*E,S=Math.atan2(p,f)*t.MathUtils.radDeg):(f=0,p=0,S=90-Math.atan2(m,d)*t.MathUtils.radDeg);var b=n+a-S,T=n+o-S+90;g=t.MathUtils.cosDeg(b)*r,y=t.MathUtils.cosDeg(T)*s,v=t.MathUtils.sinDeg(b)*r,A=t.MathUtils.sinDeg(T)*s,this.a=f*g-d*v,this.b=f*y-d*A,this.c=p*g+m*v,this.d=p*y+m*A;break;case t.TransformMode.NoScale:case t.TransformMode.NoScaleOrReflection:var E,C=t.MathUtils.cosDeg(n),w=t.MathUtils.sinDeg(n),x=(f*C+d*w)/this.skeleton.scaleX,R=(p*C+m*w)/this.skeleton.scaleY;(E=Math.sqrt(x*x+R*R))>1e-5&&(E=1/E),x*=E,R*=E,E=Math.sqrt(x*x+R*R),this.data.transformMode==t.TransformMode.NoScale&&f*m-d*p<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(E=-E);var I=Math.PI/2+Math.atan2(R,x),B=Math.cos(I)*E,D=Math.sin(I)*E;g=t.MathUtils.cosDeg(a)*r,y=t.MathUtils.cosDeg(90+o)*s,v=t.MathUtils.sinDeg(a)*r,A=t.MathUtils.sinDeg(90+o)*s,this.a=x*g+B*v,this.b=x*y+B*A,this.c=R*g+D*v,this.d=R*y+D*A}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY},e.prototype.setToSetupPose=function(){var t=this.data;this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY},e.prototype.getWorldRotationX=function(){return Math.atan2(this.c,this.a)*t.MathUtils.radDeg},e.prototype.getWorldRotationY=function(){return Math.atan2(this.d,this.b)*t.MathUtils.radDeg},e.prototype.getWorldScaleX=function(){return Math.sqrt(this.a*this.a+this.c*this.c)},e.prototype.getWorldScaleY=function(){return Math.sqrt(this.b*this.b+this.d*this.d)},e.prototype.updateAppliedTransform=function(){this.appliedValid=!0;var e=this.parent;if(null==e)return this.ax=this.worldX,this.ay=this.worldY,this.arotation=Math.atan2(this.c,this.a)*t.MathUtils.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,void(this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*t.MathUtils.radDeg);var i=e.a,n=e.b,r=e.c,s=e.d,a=1/(i*s-n*r),o=this.worldX-e.worldX,h=this.worldY-e.worldY;this.ax=o*s*a-h*n*a,this.ay=h*i*a-o*r*a;var u=a*s,l=a*i,c=a*n,_=a*r,f=u*this.a-c*this.c,d=u*this.b-c*this.d,p=l*this.c-_*this.a,m=l*this.d-_*this.b;if(this.ashearX=0,this.ascaleX=Math.sqrt(f*f+p*p),this.ascaleX>1e-4){var g=f*m-d*p;this.ascaleY=g/this.ascaleX,this.ashearY=Math.atan2(f*d+p*m,g)*t.MathUtils.radDeg,this.arotation=Math.atan2(p,f)*t.MathUtils.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(d*d+m*m),this.ashearY=0,this.arotation=90-Math.atan2(m,d)*t.MathUtils.radDeg},e.prototype.worldToLocal=function(t){var e=this.a,i=this.b,n=this.c,r=this.d,s=1/(e*r-i*n),a=t.x-this.worldX,o=t.y-this.worldY;return t.x=a*r*s-o*i*s,t.y=o*e*s-a*n*s,t},e.prototype.localToWorld=function(t){var e=t.x,i=t.y;return t.x=e*this.a+i*this.b+this.worldX,t.y=e*this.c+i*this.d+this.worldY,t},e.prototype.worldToLocalRotation=function(e){var i=t.MathUtils.sinDeg(e),n=t.MathUtils.cosDeg(e);return Math.atan2(this.a*i-this.c*n,this.d*n-this.b*i)*t.MathUtils.radDeg+this.rotation-this.shearX},e.prototype.localToWorldRotation=function(e){e-=this.rotation-this.shearX;var i=t.MathUtils.sinDeg(e),n=t.MathUtils.cosDeg(e);return Math.atan2(n*this.c+i*this.d,n*this.a+i*this.b)*t.MathUtils.radDeg},e.prototype.rotateWorld=function(e){var i=this.a,n=this.b,r=this.c,s=this.d,a=t.MathUtils.cosDeg(e),o=t.MathUtils.sinDeg(e);this.a=a*i-o*r,this.b=a*n-o*s,this.c=o*i+a*r,this.d=o*n+a*s,this.appliedValid=!1},e}();t.Bone=e}(Yat||(Yat={})),function(t){var e;t.BoneData=function(i,n,r){if(this.x=0,this.y=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.shearX=0,this.shearY=0,this.transformMode=e.Normal,this.skinRequired=!1,this.color=new t.Color,i<0)throw new Error("index must be >= 0.");if(null==n)throw new Error("name cannot be null.");this.index=i,this.name=n,this.parent=r},function(t){t[t.Normal=0]="Normal",t[t.OnlyTranslation=1]="OnlyTranslation",t[t.NoRotationOrReflection=2]="NoRotationOrReflection",t[t.NoScale=3]="NoScale",t[t.NoScaleOrReflection=4]="NoScaleOrReflection"}(e=t.TransformMode||(t.TransformMode={}))}(Yat||(Yat={})),function(t){t.ConstraintData=function(t,e,i){this.name=t,this.order=e,this.skinRequired=i}}(Yat||(Yat={})),function(t){t.Event=function(t,e){if(null==e)throw new Error("data cannot be null.");this.time=t,this.data=e}}(Yat||(Yat={})),function(t){t.EventData=function(t){this.name=t}}(Yat||(Yat={})),function(t){var e=function(){function e(t,e){if(this.bendDirection=0,this.compress=!1,this.stretch=!1,this.mix=1,this.softness=0,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.mix=t.mix,this.softness=t.softness,this.bendDirection=t.bendDirection,this.compress=t.compress,this.stretch=t.stretch,this.bones=new Array;for(var i=0;i180?d-=360:d<-180&&(d+=360);var p=e.ascaleX,m=e.ascaleY;if(r||s){var g=e.data.length*p,y=Math.sqrt(_*_+f*f);if(r&&yg&&g>1e-4){var v=(y/g-1)*o+1;p*=v,a&&(m*=v)}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*o,p,m,e.ashearX,e.ashearY)},e.prototype.apply2=function(e,i,n,r,s,a,o,h){if(0!=h){e.appliedValid||e.updateAppliedTransform(),i.appliedValid||i.updateAppliedTransform();var u=e.ax,l=e.ay,c=e.ascaleX,_=c,f=e.ascaleY,d=i.ascaleX,p=0,m=0,g=0;c<0?(c=-c,p=180,g=-1):(p=0,g=1),f<0&&(f=-f,g=-g),d<0?(d=-d,m=180):m=0;var y=i.ax,v=0,A=0,S=0,b=e.a,T=e.b,E=e.c,C=e.d,w=Math.abs(c-f)<=1e-4;w?(A=b*y+T*(v=i.ay)+e.worldX,S=E*y+C*v+e.worldY):(v=0,A=b*y+e.worldX,S=E*y+e.worldY);var x=e.parent;b=x.a,T=x.b,E=x.c;var R,I,B=1/(b*(C=x.d)-T*E),D=A-x.worldX,P=S-x.worldY,M=(D*C-P*T)*B-u,O=(P*b-D*E)*B-l,F=Math.sqrt(M*M+O*O),N=i.data.length*d;if(F<1e-4)return this.apply1(e,n,r,!1,a,!1,h),void i.updateWorldTransformWith(y,v,0,i.ascaleX,i.ascaleY,i.ashearX,i.ashearY);var L=((D=n-x.worldX)*C-(P=r-x.worldY)*T)*B-u,V=(P*b-D*E)*B-l,k=L*L+V*V;if(0!=o){o*=c*(d+1)/2;var G=Math.sqrt(k),U=G-F-N*c+o;if(U>0){var z=Math.min(1,U/(2*o))-1;k=(L-=(z=(U-o*(1-z*z))/G)*L)*L+(V-=z*V)*V}}t:if(w){var H=(k-F*F-(N*=c)*N)/(2*F*N);H<-1?H=-1:H>1&&(H=1,a&&(_*=(Math.sqrt(k)/(F+N)-1)*h+1)),I=Math.acos(H)*s,b=F+N*H,T=N*Math.sin(I),R=Math.atan2(V*b-L*T,L*b+V*T)}else{var W=(b=c*N)*b,X=(T=f*N)*T,j=Math.atan2(V,L),Y=-2*X*F,q=X-W;if((C=Y*Y-4*q*(E=X*F*F+W*k-W*X))>=0){var K=Math.sqrt(C);Y<0&&(K=-K);var J=(K=-(Y+K)/2)/q,Z=E/K,Q=Math.abs(J)=-1&&E<=1&&(E=Math.acos(E),(C=(D=b*Math.cos(E)+F)*D+(P=T*Math.sin(E))*P)st&&(nt=E,st=C,rt=D,at=P)),k<=(et+st)/2?(R=j-Math.atan2(it*s,tt),I=$*s):(R=j-Math.atan2(at*s,rt),I=nt*s)}var ot=Math.atan2(v,y)*g,ht=e.arotation;(R=(R-ot)*t.MathUtils.radDeg+p-ht)>180?R-=360:R<-180&&(R+=360),e.updateWorldTransformWith(u,l,ht+R*h,_,e.ascaleY,0,0),ht=i.arotation,(I=((I+ot)*t.MathUtils.radDeg-i.ashearX)*g+m-ht)>180?I-=360:I<-180&&(I+=360),i.updateWorldTransformWith(y,v,ht+I*h,i.ascaleX,i.ascaleY,i.ashearX,i.ashearY)}else i.updateWorldTransform()},e}();t.IkConstraint=e}(Yat||(Yat={})),function(t){var e=function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i.bendDirection=1,i.compress=!1,i.stretch=!1,i.uniform=!1,i.mix=1,i.softness=0,i}return qat(e,t),e}(t.ConstraintData);t.IkConstraintData=e}(Yat||(Yat={})),function(t){var e=function(){function e(t,e){if(this.position=0,this.spacing=0,this.rotateMix=0,this.translateMix=0,this.spaces=new Array,this.positions=new Array,this.world=new Array,this.curves=new Array,this.lengths=new Array,this.segments=new Array,this.active=!1,null==t)throw new Error("data cannot be null.");if(null==e)throw new Error("skeleton cannot be null.");this.data=t,this.bones=new Array;for(var i=0,n=t.bones.length;i0;if(r>0||s){var a=this.data,o=a.spacingMode==t.SpacingMode.Percent,h=a.rotateMode,u=h==t.RotateMode.Tangent,l=h==t.RotateMode.ChainScale,c=this.bones.length,_=u?c:c+1,f=this.bones,d=t.Utils.setArraySize(this.spaces,_),p=null,m=this.spacing;if(l||!o){l&&(p=t.Utils.setArraySize(this.lengths,c));for(var g=a.spacingMode==t.SpacingMode.Length,y=0,v=_-1;y0?t.MathUtils.degRad:-t.MathUtils.degRad),y=0;for(var B=3;yt.MathUtils.PI?G-=t.MathUtils.PI2:G<-t.MathUtils.PI&&(G+=t.MathUtils.PI2),G*=n,U=Math.cos(G),z=Math.sin(G),D.a=U*N-z*V,D.b=U*L-z*k,D.c=z*N+U*V,D.d=z*L+U*k}D.appliedValid=!1}}}},e.prototype.computeWorldPositions=function(i,n,r,s,a){var o=this.target,h=this.position,u=this.spaces,l=t.Utils.setArraySize(this.positions,3*n+2),c=null,_=i.closed,f=i.worldVerticesLength,d=f/6,p=e.NONE;if(!i.constantSpeed){var m=i.lengths,g=m[d-=_?1:2];if(s&&(h*=g),a)for(var y=1;yg){p!=e.AFTER&&(p=e.AFTER,i.computeWorldVertices(o,f-6,4,c,0,2)),this.addAfterPosition(S-g,c,0,l,v);continue}}for(;;A++){var b=m[A];if(!(S>b)){0==A?S/=b:S=(S-(K=m[A-1]))/(b-K);break}}A!=p&&(p=A,_&&A==d?(i.computeWorldVertices(o,f-4,4,c,0,2),i.computeWorldVertices(o,0,4,c,4,2)):i.computeWorldVertices(o,6*A+2,8,c,0,2)),this.addCurvePosition(S,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],l,v,r||y>0&&0==X)}return l}_?(f+=2,c=t.Utils.setArraySize(this.world,f),i.computeWorldVertices(o,2,f-4,c,0,2),i.computeWorldVertices(o,0,2,c,f-4,2),c[f-2]=c[0],c[f-1]=c[1]):(d--,f-=4,c=t.Utils.setArraySize(this.world,f),i.computeWorldVertices(o,2,f,c,0,2));for(var T=t.Utils.setArraySize(this.curves,d),E=0,C=c[0],w=c[1],x=0,R=0,I=0,B=0,D=0,P=0,M=0,O=0,F=0,N=0,L=0,V=0,k=0,G=0,U=(y=0,2);yE){this.addAfterPosition(S-E,c,f-4,l,v);continue}}for(;;A++){var j=T[A];if(!(S>j)){0==A?S/=j:S=(S-(K=T[A-1]))/(j-K);break}}if(A!=p){p=A;var Y=6*A;for(C=c[Y],w=c[Y+1],x=c[Y+2],R=c[Y+3],I=c[Y+4],B=c[Y+5],L=2*(M=.03*(C-2*x+I))+(F=.006*(3*(x-I)-C+(D=c[Y+6]))),V=2*(O=.03*(w-2*R+B))+(N=.006*(3*(R-B)-w+(P=c[Y+7]))),k=.3*(x-C)+M+.16666667*F,G=.3*(R-w)+O+.16666667*N,H=Math.sqrt(k*k+G*G),z[0]=H,Y=1;Y<8;Y++)k+=L,G+=V,L+=F,V+=N,H+=Math.sqrt(k*k+G*G),z[Y]=H;k+=L,G+=V,H+=Math.sqrt(k*k+G*G),z[8]=H,k+=L+F,G+=V+N,H+=Math.sqrt(k*k+G*G),z[9]=H,W=0}for(S*=H;;W++){var q=z[W];if(!(S>q)){var K;0==W?S/=q:S=W+(S-(K=z[W-1]))/(q-K);break}}this.addCurvePosition(.1*S,C,w,x,R,I,B,D,P,l,v,r||y>0&&0==X)}return l},e.prototype.addBeforePosition=function(t,e,i,n,r){var s=e[i],a=e[i+1],o=e[i+2]-s,h=e[i+3]-a,u=Math.atan2(h,o);n[r]=s+t*Math.cos(u),n[r+1]=a+t*Math.sin(u),n[r+2]=u},e.prototype.addAfterPosition=function(t,e,i,n,r){var s=e[i+2],a=e[i+3],o=s-e[i],h=a-e[i+1],u=Math.atan2(h,o);n[r]=s+t*Math.cos(u),n[r+1]=a+t*Math.sin(u),n[r+2]=u},e.prototype.addCurvePosition=function(t,e,i,n,r,s,a,o,h,u,l,c){if(0==t||isNaN(t))return u[l]=e,u[l+1]=i,void(u[l+2]=Math.atan2(r-i,n-e));var _=t*t,f=_*t,d=1-t,p=d*d,m=p*d,g=d*t,y=3*g,v=d*y,A=y*t,S=e*m+n*v+s*A+o*f,b=i*m+r*v+a*A+h*f;u[l]=S,u[l+1]=b,c&&(u[l+2]=t<.001?Math.atan2(r-i,n-e):Math.atan2(b-(i*p+r*g*2+a*_),S-(e*p+n*g*2+s*_)))},e.NONE=-1,e.BEFORE=-2,e.AFTER=-3,e.epsilon=1e-5,e}();t.PathConstraint=e}(Yat||(Yat={})),function(t){var e,i,n,r=function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i}return qat(e,t),e}(t.ConstraintData);t.PathConstraintData=r,(n=t.PositionMode||(t.PositionMode={}))[n.Fixed=0]="Fixed",n[n.Percent=1]="Percent",(i=t.SpacingMode||(t.SpacingMode={}))[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",(e=t.RotateMode||(t.RotateMode={}))[e.Tangent=0]="Tangent",e[e.Chain=1]="Chain",e[e.ChainScale=2]="ChainScale"}(Yat||(Yat={})),function(t){var e=function(){function t(t){this.toLoad=new Array,this.assets={},this.clientId=t}return t.prototype.loaded=function(){var t=0;for(var e in this.assets)t++;return t},t}(),i=function(){function t(t){void 0===t&&(t=""),this.clientAssets={},this.queuedAssets={},this.rawAssets={},this.errors={},this.pathPrefix=t}return t.prototype.queueAsset=function(t,i,n){var r=this.clientAssets[t];return null==r&&(r=new e(t),this.clientAssets[t]=r),null!==i&&(r.textureLoader=i),r.toLoad.push(n),this.queuedAssets[n]!==n&&(this.queuedAssets[n]=n,!0)},t.prototype.loadText=function(t,e){var i=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?i.rawAssets[e]=n.responseText:i.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},t.prototype.loadJson=function(t,e){var i=this;if(e=this.pathPrefix+e,this.queueAsset(t,null,e)){var n=new XMLHttpRequest;n.onreadystatechange=function(){n.readyState==XMLHttpRequest.DONE&&(n.status>=200&&n.status<300?i.rawAssets[e]=JSON.parse(n.responseText):i.errors[e]="Couldn't load text "+e+": status "+n.status+", "+n.responseText)},n.open("GET",e,!0),n.send()}},t.prototype.loadTexture=function(t,e,i){var n=this;if(i=this.pathPrefix+i,this.queueAsset(t,e,i)){var r=new Image;r.src=i,r.crossOrigin="anonymous",r.onload=function(){n.rawAssets[i]=r},r.onerror=function(){n.errors[i]="Couldn't load image "+i}}},t.prototype.get=function(t,e){e=this.pathPrefix+e;var i=this.clientAssets[t];return null==i||i.assets[e]},t.prototype.updateClientAssets=function(t){for(var e=0;e0},t.prototype.getErrors=function(){return this.errors},t}();t.SharedAssetManager=i}(Yat||(Yat={})),function(t){var e=function(){function e(e){if(this._updateCache=new Array,this.updateCacheReset=new Array,this.time=0,this.scaleX=1,this.scaleY=1,this.x=0,this.y=0,null==e)throw new Error("data cannot be null.");this.data=e,this.bones=new Array;for(var i=0;i1){var s=n[n.length-1];this._updateCache.indexOf(s)>-1||this.updateCacheReset.push(s)}this._updateCache.push(e),this.sortReset(r.children),n[n.length-1].sorted=!0}},e.prototype.sortPathConstraint=function(e){if(e.active=e.target.bone.isActive()&&(!e.data.skinRequired||null!=this.skin&&t.Utils.contains(this.skin.constraints,e.data,!0)),e.active){var i=e.target,n=i.data.index,r=i.bone;null!=this.skin&&this.sortPathConstraintAttachment(this.skin,n,r),null!=this.data.defaultSkin&&this.data.defaultSkin!=this.skin&&this.sortPathConstraintAttachment(this.data.defaultSkin,n,r);for(var s=0,a=this.data.skins.length;s-1||this.updateCacheReset.push(s)}else for(r=0;r0){A=new t.DrawOrderTimeline(N);var L=r.slots.length;for(l=0;l=0;f--)k[f]=-1;var G=t.Utils.newArray(L-V,0),U=0,z=0;for(f=0;f=0;f--)-1==k[f]&&(k[f]=G[--z]);A.setFrame(l,y,k)}s.push(A),o=Math.max(o,A.frames[N-1])}var H=i.readInt(!0);if(H>0){for(A=new t.EventTimeline(H),l=0;l>>1^-(1&i)},t.prototype.readStringRef=function(){var t=this.readInt(!0);return 0==t?null:this.strings[t-1]},t.prototype.readString=function(){var t=this.readInt(!0);switch(t){case 0:return null;case 1:return""}t--;for(var e="",i=0;i>4){case 12:case 13:e+=String.fromCharCode((31&n)<<6|63&this.readByte()),i+=2;break;case 14:e+=String.fromCharCode((15&n)<<12|(63&this.readByte())<<6|63&this.readByte()),i+=3;break;default:e+=String.fromCharCode(n),i++}}return e},t.prototype.readFloat=function(){var t=this.buffer.getFloat32(this.index);return this.index+=4,t},t.prototype.readBoolean=function(){return 0!=this.readByte()},t}(),n=function(t,e,i,n,r){this.mesh=t,this.skin=e,this.slotIndex=i,this.parent=n,this.inheritDeform=r},r=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.bones=t,this.vertices=e}}(Yat||(Yat={})),function(t){var e=function(){function e(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.boundingBoxes=new Array,this.polygons=new Array,this.polygonPool=new t.Pool((function(){return t.Utils.newFloatArray(16)}))}return e.prototype.update=function(e,i){if(null==e)throw new Error("skeleton cannot be null.");var n=this.boundingBoxes,r=this.polygons,s=this.polygonPool,a=e.slots,o=a.length;n.length=0,s.freeAll(r),r.length=0;for(var h=0;h=this.minX&&t<=this.maxX&&e>=this.minY&&e<=this.maxY},e.prototype.aabbIntersectsSegment=function(t,e,i,n){var r=this.minX,s=this.minY,a=this.maxX,o=this.maxY;if(t<=r&&i<=r||e<=s&&n<=s||t>=a&&i>=a||e>=o&&n>=o)return!1;var h=(n-e)/(i-t),u=h*(r-t)+e;if(u>s&&us&&ur&&lr&&lt.minX&&this.minYt.minY},e.prototype.containsPoint=function(t,e){for(var i=this.polygons,n=0,r=i.length;n=i||u=i){var l=n[o];l+(i-h)/(u-h)*(n[s]-l)=l&&v<=f||v>=f&&v<=l)&&(v>=e&&v<=n||v>=n&&v<=e)){var A=(u*g-h*p)/y;if((A>=c&&A<=d||A>=d&&A<=c)&&(A>=i&&A<=r||A>=r&&A<=i))return!0}l=f,c=d}return!1},e.prototype.getPolygon=function(t){if(null==t)throw new Error("boundingBox cannot be null.");var e=this.boundingBoxes.indexOf(t);return-1==e?null:this.polygons[e]},e.prototype.getWidth=function(){return this.maxX-this.minX},e.prototype.getHeight=function(){return this.maxY-this.minY},e}();t.SkeletonBounds=e}(Yat||(Yat={})),function(t){var e=function(){function e(){this.triangulator=new t.Triangulator,this.clippingPolygon=new Array,this.clipOutput=new Array,this.clippedVertices=new Array,this.clippedTriangles=new Array,this.scratch=new Array}return e.prototype.clipStart=function(i,n){if(null!=this.clipAttachment)return 0;this.clipAttachment=n;var r=n.worldVerticesLength,s=t.Utils.setArraySize(this.clippingPolygon,r);n.computeWorldVertices(i,0,r,s,0,2);var a=this.clippingPolygon;e.makeClockwise(a);for(var o=this.clippingPolygons=this.triangulator.decompose(a,this.triangulator.triangulate(a)),h=0,u=o.length;h>1,z=this.clipOutput,H=t.Utils.setArraySize(f,O+U*g),W=0;W=2?(l=o,o=this.scratch):l=this.scratch,l.length=0,l.push(t),l.push(e),l.push(i),l.push(n),l.push(r),l.push(s),l.push(t),l.push(e),o.length=0;for(var c=a,_=a.length-4,f=0;;f+=2){for(var d=c[f],p=c[f+1],m=c[f+2],g=c[f+3],y=d-m,v=p-g,A=l,S=l.length-2,b=o.length,T=0;T0;if(y*(C-g)-v*(E-m)>0){if(R){o.push(w),o.push(x);continue}var I=(D=x-C)*(m-d)-(P=w-E)*(g-p);if(Math.abs(I)>1e-6){var B=(P*(p-C)-D*(d-E))/I;o.push(d+(m-d)*B),o.push(p+(g-p)*B)}else o.push(d),o.push(p)}else if(R){var D,P;I=(D=x-C)*(m-d)-(P=w-E)*(g-p),Math.abs(I)>1e-6?(B=(P*(p-C)-D*(d-E))/I,o.push(d+(m-d)*B),o.push(p+(g-p)*B)):(o.push(d),o.push(p)),o.push(w),o.push(x)}u=!0}if(b==o.length)return h.length=0,!0;if(o.push(o[0]),o.push(o[1]),f==_)break;var M=o;(o=l).length=0,l=M}if(h!=o){h.length=0,f=0;for(var O=o.length-2;f>1;o=0;_--)-1==j[_]&&(j[_]=q[--J])}A.setFrame(c++,this.getValue(X,"time",0),j)}s.push(A),a=Math.max(a,A.frames[A.getFrameCount()-1])}if(e.events){for(A=new t.EventTimeline(e.events.length),c=0,_=0;_=n.length&&(n.length=t+1),n[t]||(n[t]={}),n[t][e]=i},i.prototype.addSkin=function(t){for(var e=0;e= 0.");if(null==i)throw new Error("name cannot be null.");if(null==n)throw new Error("boneData cannot be null.");this.index=e,this.name=i,this.boneData=n}}(Yat||(Yat={})),function(t){var e,i,n=function(){function t(t){this._image=t}return t.prototype.getImage=function(){return this._image},t.filterFromString=function(t){switch(t.toLowerCase()){case"nearest":return e.Nearest;case"linear":return e.Linear;case"mipmap":return e.MipMap;case"mipmapnearestnearest":return e.MipMapNearestNearest;case"mipmaplinearnearest":return e.MipMapLinearNearest;case"mipmapnearestlinear":return e.MipMapNearestLinear;case"mipmaplinearlinear":return e.MipMapLinearLinear;default:throw new Error("Unknown texture filter "+t)}},t.wrapFromString=function(t){switch(t.toLowerCase()){case"mirroredtepeat":return i.MirroredRepeat;case"clamptoedge":return i.ClampToEdge;case"repeat":return i.Repeat;default:throw new Error("Unknown texture wrap "+t)}},t}();t.Texture=n,function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.MipMap=9987]="MipMap",t[t.MipMapNearestNearest=9984]="MipMapNearestNearest",t[t.MipMapLinearNearest=9985]="MipMapLinearNearest",t[t.MipMapNearestLinear=9986]="MipMapNearestLinear",t[t.MipMapLinearLinear=9987]="MipMapLinearLinear"}(e=t.TextureFilter||(t.TextureFilter={})),function(t){t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.ClampToEdge=33071]="ClampToEdge",t[t.Repeat=10497]="Repeat"}(i=t.TextureWrap||(t.TextureWrap={}));t.TextureRegion=function(){this.u=0,this.v=0,this.u2=0,this.v2=0,this.width=0,this.height=0,this.rotate=!1,this.offsetX=0,this.offsetY=0,this.originalWidth=0,this.originalHeight=0};var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return qat(e,t),e.prototype.setFilters=function(){},e.prototype.setWraps=function(){},e.prototype.dispose=function(){},e}(n);t.FakeTexture=r}(Yat||(Yat={})),function(t){var e=function(){function e(t,e){this.pages=new Array,this.regions=new Array,this.load(t,e)}return e.prototype.load=function(e,s){if(null==s)throw new Error("textureLoader cannot be null.");for(var a=new i(e),o=new Array(4),h=null;;){var u=a.readLine();if(null==u)break;if(0==(u=u.trim()).length)h=null;else if(h){var l=new r;l.name=u,l.page=h;var c=a.readValue();"true"==c.toLocaleLowerCase()?l.degrees=90:"false"==c.toLocaleLowerCase()?l.degrees=0:l.degrees=parseFloat(c),l.rotate=90==l.degrees,a.readTuple(o);var _=parseInt(o[0]),f=parseInt(o[1]);a.readTuple(o);var d=parseInt(o[0]),p=parseInt(o[1]);l.u=_/h.width,l.v=f/h.height,l.rotate?(l.u2=(_+p)/h.width,l.v2=(f+d)/h.height):(l.u2=(_+d)/h.width,l.v2=(f+p)/h.height),l.x=_,l.y=f,l.width=Math.abs(d),l.height=Math.abs(p),4==a.readTuple(o)&&4==a.readTuple(o)&&a.readTuple(o),l.originalWidth=parseInt(o[0]),l.originalHeight=parseInt(o[1]),a.readTuple(o),l.offsetX=parseInt(o[0]),l.offsetY=parseInt(o[1]),l.index=parseInt(a.readValue()),l.texture=h.texture,this.regions.push(l)}else{(h=new n).name=u,2==a.readTuple(o)&&(h.width=parseInt(o[0]),h.height=parseInt(o[1]),a.readTuple(o)),a.readTuple(o),h.minFilter=t.Texture.filterFromString(o[0]),h.magFilter=t.Texture.filterFromString(o[1]);var m=a.readValue();h.uWrap=t.TextureWrap.ClampToEdge,h.vWrap=t.TextureWrap.ClampToEdge,"x"==m?h.uWrap=t.TextureWrap.Repeat:"y"==m?h.vWrap=t.TextureWrap.Repeat:"xy"==m&&(h.uWrap=h.vWrap=t.TextureWrap.Repeat),h.texture=s(u),h.texture.setFilters(h.minFilter,h.magFilter),h.texture.setWraps(h.uWrap,h.vWrap),h.width=h.texture.getImage().width,h.height=h.texture.getImage().height,this.pages.push(h)}}},e.prototype.findRegion=function(t){for(var e=0;e=this.lines.length?null:this.lines[this.index++]},t.prototype.readValue=function(){var t=this.readLine(),e=t.indexOf(":");if(-1==e)throw new Error("Invalid line: "+t);return t.substring(e+1).trim()},t.prototype.readTuple=function(t){var e=this.readLine(),i=e.indexOf(":");if(-1==i)throw new Error("Invalid line: "+e);for(var n=0,r=i+1;n<3;n++){var s=e.indexOf(",",r);if(-1==s)break;t[n]=e.substr(r,s-r).trim(),r=s+1}return t[n]=e.substring(r).trim(),n+1},t}(),n=function(){};t.TextureAtlasPage=n;var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return qat(e,t),e}(t.TextureRegion);t.TextureAtlasRegion=r}(Yat||(Yat={})),function(t){var e=function(){function e(e,i){if(this.rotateMix=0,this.translateMix=0,this.scaleMix=0,this.shearMix=0,this.temp=new t.Vector2,this.active=!1,null==e)throw new Error("data cannot be null.");if(null==i)throw new Error("skeleton cannot be null.");this.data=e,this.rotateMix=e.rotateMix,this.translateMix=e.translateMix,this.scaleMix=e.scaleMix,this.shearMix=e.shearMix,this.bones=new Array;for(var n=0;n0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*l,_=this.data.offsetShearY*l,f=this.bones,d=0,p=f.length;dt.MathUtils.PI?x-=t.MathUtils.PI2:x<-t.MathUtils.PI&&(x+=t.MathUtils.PI2),x*=e;var b=Math.cos(x),T=Math.sin(x);m.a=b*y-T*A,m.b=b*v-T*S,m.c=T*y+b*A,m.d=T*v+b*S,g=!0}if(0!=i){var E=this.temp;s.localToWorld(E.set(this.data.offsetX,this.data.offsetY)),m.worldX+=(E.x-m.worldX)*i,m.worldY+=(E.y-m.worldY)*i,g=!0}if(n>0){var C=Math.sqrt(m.a*m.a+m.c*m.c),w=Math.sqrt(a*a+h*h);C>1e-5&&(C=(C+(w-C+this.data.offsetScaleX)*n)/C),m.a*=C,m.c*=C,C=Math.sqrt(m.b*m.b+m.d*m.d),w=Math.sqrt(o*o+u*u),C>1e-5&&(C=(C+(w-C+this.data.offsetScaleY)*n)/C),m.b*=C,m.d*=C,g=!0}if(r>0){v=m.b,S=m.d;var x,R=Math.atan2(S,v);(x=Math.atan2(u,o)-Math.atan2(h,a)-(R-Math.atan2(m.c,m.a)))>t.MathUtils.PI?x-=t.MathUtils.PI2:x<-t.MathUtils.PI&&(x+=t.MathUtils.PI2),x=R+(x+_)*r,C=Math.sqrt(v*v+S*S),m.b=Math.cos(x)*C,m.d=Math.sin(x)*C,g=!0}g&&(m.appliedValid=!1)}},e.prototype.applyRelativeWorld=function(){for(var e=this.rotateMix,i=this.translateMix,n=this.scaleMix,r=this.shearMix,s=this.target,a=s.a,o=s.b,h=s.c,u=s.d,l=a*u-o*h>0?t.MathUtils.degRad:-t.MathUtils.degRad,c=this.data.offsetRotation*l,_=this.data.offsetShearY*l,f=this.bones,d=0,p=f.length;dt.MathUtils.PI?m-=t.MathUtils.PI2:m<-t.MathUtils.PI&&(m+=t.MathUtils.PI2),m*=e;var T=Math.cos(m),E=Math.sin(m);g.a=T*v-E*S,g.b=T*A-E*b,g.c=E*v+T*S,g.d=E*A+T*b,y=!0}if(0!=i){var C=this.temp;s.localToWorld(C.set(this.data.offsetX,this.data.offsetY)),g.worldX+=C.x*i,g.worldY+=C.y*i,y=!0}if(n>0){var w=(Math.sqrt(a*a+h*h)-1+this.data.offsetScaleX)*n+1;g.a*=w,g.c*=w,w=(Math.sqrt(o*o+u*u)-1+this.data.offsetScaleY)*n+1,g.b*=w,g.d*=w,y=!0}if(r>0)(m=Math.atan2(u,o)-Math.atan2(h,a))>t.MathUtils.PI?m-=t.MathUtils.PI2:m<-t.MathUtils.PI&&(m+=t.MathUtils.PI2),A=g.b,b=g.d,m=Math.atan2(b,A)+(m-t.MathUtils.PI/2+_)*r,w=Math.sqrt(A*A+b*b),g.b=Math.cos(m)*w,g.d=Math.sin(m)*w,y=!0;y&&(g.appliedValid=!1)}},e.prototype.applyAbsoluteLocal=function(){var t=this.rotateMix,e=this.translateMix,i=this.scaleMix,n=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();for(var s=this.bones,a=0,o=s.length;a1e-5&&(f=(f+(r.ascaleX-f+this.data.offsetScaleX)*i)/f),d>1e-5&&(d=(d+(r.ascaleY-d+this.data.offsetScaleY)*i)/d));var p=h.ashearY;0!=n&&(l=r.ashearY-p+this.data.offsetShearY,l-=360*(16384-(16384.499999999996-l/360|0)),h.shearY+=l*n),h.updateWorldTransformWith(c,_,u,f,d,h.ashearX,p)}},e.prototype.applyRelativeLocal=function(){var t=this.rotateMix,e=this.translateMix,i=this.scaleMix,n=this.shearMix,r=this.target;r.appliedValid||r.updateAppliedTransform();for(var s=this.bones,a=0,o=s.length;a1e-5&&(_*=(r.ascaleX-1+this.data.offsetScaleX)*i+1),f>1e-5&&(f*=(r.ascaleY-1+this.data.offsetScaleY)*i+1));var d=h.ashearY;0!=n&&(d+=(r.ashearY+this.data.offsetShearY)*n),h.updateWorldTransformWith(l,c,u,_,f,h.ashearX,d)}},e}();t.TransformConstraint=e}(Yat||(Yat={})),function(t){var e=function(t){function e(e){var i=t.call(this,e,0,!1)||this;return i.bones=new Array,i.rotateMix=0,i.translateMix=0,i.scaleMix=0,i.shearMix=0,i.offsetRotation=0,i.offsetX=0,i.offsetY=0,i.offsetScaleX=0,i.offsetScaleY=0,i.offsetShearY=0,i.relative=!1,i.local=!1,i}return qat(e,t),e}(t.ConstraintData);t.TransformConstraintData=e}(Yat||(Yat={})),function(t){var e=function(){function e(){this.convexPolygons=new Array,this.convexPolygonsIndices=new Array,this.indicesArray=new Array,this.isConcaveArray=new Array,this.triangles=new Array,this.polygonPool=new t.Pool((function(){return new Array})),this.polygonIndicesPool=new t.Pool((function(){return new Array}))}return e.prototype.triangulate=function(t){var i=t,n=t.length>>1,r=this.indicesArray;r.length=0;for(var s=0;s3;){for(var u=n-1,l=(s=0,1);;){t:if(!a[s]){for(var c=r[u]<<1,_=r[s]<<1,f=r[l]<<1,d=i[c],p=i[c+1],m=i[_],g=i[_+1],y=i[f],v=i[f+1],A=(l+1)%n;A!=u;A=(A+1)%n)if(a[A]){var S=r[A]<<1,b=i[S],T=i[S+1];if(e.positiveArea(y,v,d,p,b,T)&&e.positiveArea(d,p,m,g,b,T)&&e.positiveArea(m,g,y,v,b,T))break t}break}if(0==l){do{if(!a[s])break;s--}while(s>0);break}u=s,s=l,l=(l+1)%n}h.push(r[(n+s-1)%n]),h.push(r[s]),h.push(r[(s+1)%n]),r.splice(s,1),a.splice(s,1);var E=(--n+s-1)%n,C=s==n?0:s;a[E]=e.isConcave(E,n,i,r),a[C]=e.isConcave(C,n,i,r)}return 3==n&&(h.push(r[2]),h.push(r[0]),h.push(r[1])),h},e.prototype.decompose=function(t,i){var n=t,r=this.convexPolygons;this.polygonPool.freeAll(r),r.length=0;var s=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(s),s.length=0;var a=this.polygonIndicesPool.obtain();a.length=0;var o=this.polygonPool.obtain();o.length=0;for(var h=-1,u=0,l=0,c=i.length;l0?(r.push(o),s.push(a)):(this.polygonPool.free(o),this.polygonIndicesPool.free(a)),(o=this.polygonPool.obtain()).length=0,o.push(p),o.push(m),o.push(g),o.push(y),o.push(v),o.push(A),(a=this.polygonIndicesPool.obtain()).length=0,a.push(_),a.push(f),a.push(d),u=e.winding(p,m,g,y,v,A),h=_)}for(o.length>0&&(r.push(o),s.push(a)),l=0,c=r.length;l=0;l--)0==(o=r[l]).length&&(r.splice(l,1),this.polygonPool.free(o),a=s[l],s.splice(l,1),this.polygonIndicesPool.free(a));return r},e.isConcave=function(t,e,i,n){var r=n[(e+t-1)%e]<<1,s=n[t]<<1,a=n[(t+1)%e]<<1;return!this.positiveArea(i[r],i[r+1],i[s],i[s+1],i[a],i[a+1])},e.positiveArea=function(t,e,i,n,r,s){return t*(s-n)+i*(e-s)+r*(n-e)>=0},e.winding=function(t,e,i,n,r,s){var a=i-t,o=n-e;return r*o-s*a+a*e-t*o>=0?1:-1},e}();t.Triangulator=e}(Yat||(Yat={})),function(t){var e=function(){function t(){this.array=new Array}return t.prototype.add=function(t){var e=this.contains(t);return this.array[0|t]=0|t,!e},t.prototype.contains=function(t){return null!=this.array[0|t]},t.prototype.remove=function(t){this.array[0|t]=void 0},t.prototype.clear=function(){this.array.length=0},t}();t.IntSet=e;var i=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.r=t,this.g=e,this.b=i,this.a=n}return t.prototype.set=function(t,e,i,n){return this.r=t,this.g=e,this.b=i,this.a=n,this.clamp(),this},t.prototype.setFromColor=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.setFromString=function(t){return t="#"==t.charAt(0)?t.substr(1):t,this.r=parseInt(t.substr(0,2),16)/255,this.g=parseInt(t.substr(2,2),16)/255,this.b=parseInt(t.substr(4,2),16)/255,this.a=(8!=t.length?255:parseInt(t.substr(6,2),16))/255,this},t.prototype.add=function(t,e,i,n){return this.r+=t,this.g+=e,this.b+=i,this.a+=n,this.clamp(),this},t.prototype.clamp=function(){return this.r<0?this.r=0:this.r>1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this},t.rgba8888ToColor=function(t,e){t.r=((4278190080&e)>>>24)/255,t.g=((16711680&e)>>>16)/255,t.b=((65280&e)>>>8)/255,t.a=(255&e)/255},t.rgb888ToColor=function(t,e){t.r=((16711680&e)>>>16)/255,t.g=((65280&e)>>>8)/255,t.b=(255&e)/255},t.WHITE=new t(1,1,1,1),t.RED=new t(1,0,0,1),t.GREEN=new t(0,1,0,1),t.BLUE=new t(0,0,1,1),t.MAGENTA=new t(1,0,1,1),t}();t.Color=i;var n=function(){function t(){}return t.clamp=function(t,e,i){return ti?i:t},t.cosDeg=function(e){return Math.cos(e*t.degRad)},t.sinDeg=function(e){return Math.sin(e*t.degRad)},t.signum=function(t){return t>0?1:t<0?-1:0},t.toInt=function(t){return t>0?Math.floor(t):Math.ceil(t)},t.cbrt=function(t){var e=Math.pow(Math.abs(t),1/3);return t<0?-e:e},t.randomTriangular=function(e,i){return t.randomTriangularWith(e,i,.5*(e+i))},t.randomTriangularWith=function(t,e,i){var n=Math.random(),r=e-t;return n<=(i-t)/r?t+Math.sqrt(n*r*(i-t)):e-Math.sqrt((1-n)*r*(e-i))},t.PI=3.1415927,t.PI2=2*t.PI,t.radiansToDegrees=180/t.PI,t.radDeg=t.radiansToDegrees,t.degreesToRadians=t.PI/180,t.degRad=t.degreesToRadians,t}();t.MathUtils=n;var r=function(){function t(){}return t.prototype.apply=function(t,e,i){return t+(e-t)*this.applyInternal(i)},t}();t.Interpolation=r;var s=function(t){function e(e){var i=t.call(this)||this;return i.power=2,i.power=e,i}return qat(e,t),e.prototype.applyInternal=function(t){return t<=.5?Math.pow(2*t,this.power)/2:Math.pow(2*(t-1),this.power)/(this.power%2==0?-2:2)+1},e}(r);t.Pow=s;var a=function(t){function e(e){return t.call(this,e)||this}return qat(e,t),e.prototype.applyInternal=function(t){return Math.pow(t-1,this.power)*(this.power%2==0?-1:1)+1},e}(s);t.PowOut=a;var o=function(){function t(){}return t.arrayCopy=function(t,e,i,n,r){for(var s=e,a=n;s=i?e:t.setArraySize(e,i,n)},t.newArray=function(t,e){for(var i=new Array(t),n=0;n0?this.items.pop():this.instantiator()},t.prototype.free=function(t){t.reset&&t.reset(),this.items.push(t)},t.prototype.freeAll=function(t){for(var e=0;ethis.maxDelta&&(this.delta=this.maxDelta),this.lastTime=t,this.frameCount++,this.frameTime>1&&(this.framesPerSecond=this.frameCount/this.frameTime,this.frameTime=0,this.frameCount=0)},t}();t.TimeKeeper=c;var _=function(){function t(t){void 0===t&&(t=32),this.addedValues=0,this.lastValue=0,this.mean=0,this.dirty=!0,this.values=new Array(t)}return t.prototype.hasEnoughData=function(){return this.addedValues>=this.values.length},t.prototype.addValue=function(t){this.addedValuesthis.values.length-1&&(this.lastValue=0),this.dirty=!0},t.prototype.getMean=function(){if(this.hasEnoughData()){if(this.dirty){for(var t=0,e=0;e>1)*s;var a=t.bone.skeleton,o=t.deform,h=this.vertices,u=this.bones;if(null!=u){for(var l=0,c=0,_=0;_0&&(h=o);for(var A,S=(A=t.bone).worldX,b=A.worldY,T=A.a,E=A.b,C=A.c,w=A.d,x=e,R=r;R>>0)+(vot.b<<16)+(vot.g<<8)+vot.r,tot=(Aot.a<<24>>>0)+(Aot.b<<16)+(Aot.g<<8)+Aot.r,pot!==$at||mot!==tot){var s=this._tempColors;pot=$at,mot=tot,dot>0&&(s[dot-1].vfOffset=hot),s[dot++]={fr:vot.r,fg:vot.g,fb:vot.b,fa:vot.a,dr:Aot.r,dg:Aot.g,db:Aot.b,da:Aot.a,vfOffset:0}}if(n.isClipping()){n.clipTriangles(rot,got,sot,yot,rot,vot,Aot,!0,6,hot,hot+2);var a=n.clippedVertices,o=n.clippedTriangles;yot=o.length,got=a.length/12*6;for(var h=0,u=oot,l=o.length;h0&&(s[dot-1].vfOffset=hot),s.length=dot,a.length=aot;var o=fot-1;if(o>=0)if(_ot>0){var h=r[o];h.indexCount=_ot,h.vfCount=7*cot,h.vertexCount=cot,r.length=fot}else r.length=fot-1;if(0!==r.length){var u=n.vertices,l=hot/6,c=7*l;(!u||u.lengththis.maxVertexCount?l:this.maxVertexCount,this.maxIndexCount=p.length>this.maxIndexCount?p.length:this.maxIndexCount}},e.needToUpdate=function(t){return!this.isCompleted&&this.totalTime<30&&(void 0===t||this._frameIdx=0&&(_ot>0?((c=d[l]).indexCount=_ot,c.vertexCount=cot,c.vfCount=7*cot):fot--),d[fot]={tex:u,blendMode:_,indexCount:0,vertexCount:0,vfCount:0},fot++,_ot=0,cot=0),o)a=Sot,got=24,yot=6,i.computeWorldVertices(f.bone,rot,hot,6);else if(h){var E=i;a=E.triangles,got=6*(E.worldVerticesLength>>1),yot=a.length,E.computeWorldVertices(f,0,E.worldVerticesLength,rot,hot,6)}if(0!==got&&0!==yot){for(var C=0,w=oot,x=a.length;C0){for(var D=oot,P=oot+yot;D0)&&this.textureNames&&this.textureNames.length>0)return t||console.error(this.name+" no textures found!"),null;var e=this._getAtlas(t);if(!e)return null;var i=new eot.AtlasAttachmentLoader(e),n=null,r=null;return this.skeletonJson?(r=new eot.SkeletonJson(i),n=this.skeletonJson):(r=new eot.SkeletonBinary(i),n=new Uint8Array(this._nativeAsset)),r.scale=this.scale,this._skeletonCache=r.readSkeletonData(n),e.dispose(),this._skeletonCache},i.getSkinsEnum=function(){if(this._skinsEnum)return this._skinsEnum;var t=this.getRuntimeData(!0);if(t){for(var e=t.skins,i={},n=0;n1)return this._animsEnum;var t=this.getRuntimeData(!0);if(t){for(var e={"":0},i=t.animations,n=0;n"]=0]=""}(Uht||(Uht={})),pe(Uht),function(t){t[t.REALTIME=0]="REALTIME",t[t.SHARED_CACHE=1]="SHARED_CACHE",t[t.PRIVATE_CACHE=2]="PRIVATE_CACHE"}(zht||(zht={})),pe(zht),function(t){t[t.COLORED_TEXTURED=0]="COLORED_TEXTURED",t[t.TWO_COLORED=1]="TWO_COLORED"}(Hht||(Hht={}));var jht=(Uot=_u("sp.Skeleton.SpineSocket"),zot=qu(YA),Uot((Xot=S((Wot=function(t,e){void 0===t&&(t=""),void 0===e&&(e=null),A(this,"path",Xot,this),A(this,"target",jot,this),this.path=t,this.target=e}).prototype,"path",[Au,Du],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),jot=S(Wot.prototype,"target",[zot,Du,Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Hot=Wot))||Hot);le.setClassAlias(jht,"sp.Skeleton.SpineSocket");var Yht=(Yot=_u("sp.Skeleton"),qot=Bu(),Kot=wu(),Jot=qu(Wv),Zot=Uu(),Qot=Ou(),$ot=qu(Got),tht=Ou(),eht=qu(Ght),iht=Fu(),nht=Ou(),rht=qu(Uht),sht=Fu(),aht=Ou(),oht=Fu(),hht=qu(zht),uht=Fu(),lht=Fu(),cht=Fu(),_ht=Fu(),fht=Fu(),dht=Fu(),pht=Fu(),mht=Fu(),ght=qu([jht]),yht=Fu(),vht=Pu(),Aht=Pu(),Yot(Sht=qot(Sht=Kot(Sht=Cu((kht=Vht=function(t){c(i,t);var e=i.prototype;function i(){var e;return A(e=t.call(this)||this,"loop",Tht,g(e)),e._frameCache=null,e._curFrame=null,e._effectDelegate=null,e._skeleton=void 0,e._clipper=void 0,e._debugRenderer=void 0,e._startSlotIndex=void 0,e._endSlotIndex=void 0,e._startEntry=void 0,e._endEntry=void 0,e.attachUtil=void 0,e.maxVertexCount=0,e.maxIndexCount=0,e._materialCache={},e._enumSkins=_e({}),e._enumAnimations=_e({}),e._playTimes=0,A(e,"_timeScale",Eht,g(e)),e._paused=!1,e._accTime=0,e._playCount=0,e._skeletonCache=null,e._animationName="",e._animationQueue=[],e._headAniInfo=null,e._isAniComplete=!0,e._needUpdateSkeltonData=!0,A(e,"_useTint",Cht,g(e)),A(e,"_preCacheMode",wht,g(e)),A(e,"_cacheMode",xht,g(e)),A(e,"_defaultCacheMode",Rht,g(e)),A(e,"_debugBones",Iht,g(e)),A(e,"_debugSlots",Bht,g(e)),A(e,"_skeletonData",Dht,g(e)),A(e,"_premultipliedAlpha",Pht,g(e)),A(e,"defaultSkin",Mht,g(e)),A(e,"defaultAnimation",Oht,g(e)),A(e,"_enableBatch",Fht,g(e)),A(e,"_sockets",Nht,g(e)),e._drawIdx=0,e._drawList=new pa((function(){return{material:null,texture:null,indexOffset:0,indexCount:0}}),1),A(e,"_debugMesh",Lht,g(e)),e._rootBone=void 0,e._state=void 0,e._listener=void 0,e._socketNodes=new Map,e._cachedSockets=new Map,e._drawInfoList=[],e._effectDelegate=null,e._skeleton=null,e._rootBone=null,e._listener=null,e._debugRenderer=null,e._startSlotIndex=-1,e._endSlotIndex=-1,e._startEntry={animation:{name:""},trackIndex:0},e._endEntry={animation:{name:""},trackIndex:0},e.attachUtil=new Not,Xht(g(e),"_defaultSkinIndex",e._enumSkins),Xht(g(e),"_animationIndex",e._enumAnimations),e._useVertexOpacity=!0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new Ek),this._drawInfoList[t]},e.setSkeletonData=function(t){var e=this.node._uiProps.uiTransformComp;if(null!=t.width&&null!=t.height&&e.setContentSize(t.width,t.height),this._cacheMode===zht.SHARED_CACHE?this._skeletonCache=Tot.sharedCache:this._cacheMode===zht.PRIVATE_CACHE&&(this._skeletonCache=new Tot,this._skeletonCache.enablePrivateMode()),this.isAnimationCached()){(this.debugBones||this.debugSlots)&&N("Debug bones or slots is invalid in cached mode");var i=this._skeletonCache.getSkeletonCache(this.skeletonData._uuid,t);this._skeleton=i.skeleton,this._clipper=i.clipper,this._rootBone=this._skeleton.getRootBone()}else this._skeleton=new eot.Skeleton(t),this._clipper=new eot.SkeletonClipping,this._rootBone=this._skeleton.getRootBone();this._flushAssembler()},e.setSlotsRange=function(t,e){this.isAnimationCached()?N("Slots visible range can not be modified in cached mode."):(this._startSlotIndex=t,this._endSlotIndex=e)},e.setAnimationStateData=function(t){if(this.isAnimationCached())N("'setAnimationStateData' interface can not be invoked in cached mode.");else{var e=new eot.AnimationState(t);this._listener&&(this._state&&this._state.removeListener(this._listener),e.addListener(this._listener)),this._state=e}},e.__preload=function(){t.prototype.__preload.call(this);for(var e=this.node.children,i=0,n=e.length;ithis._headAniInfo.delay){var n=this._headAniInfo;this._headAniInfo=null,this.setAnimation(0,n.animationName,n.loop)}return}this._updateCache(t)}else this._updateRealtime(t)},e.setVertexEffectDelegate=function(t){this._effectDelegate=t},e.setToSetupPose=function(){this._skeleton&&this._skeleton.setToSetupPose()},e.setBonesToSetupPose=function(){this._skeleton&&this._skeleton.setBonesToSetupPose()},e.setSlotsToSetupPose=function(){this._skeleton&&this._skeleton.setSlotsToSetupPose()},e.updateAnimationCache=function(t){if(this.isAnimationCached()){var e=this._skeletonData._uuid;this._skeletonCache&&this._skeletonCache.updateAnimationCache(e,t)}},e.invalidAnimationCache=function(){this.isAnimationCached()&&this._skeletonCache&&this._skeletonCache.invalidAnimationCache(this._skeletonData._uuid)},e.findBone=function(t){return this._skeleton?this._skeleton.findBone(t):null},e.findSlot=function(t){return this._skeleton?this._skeleton.findSlot(t):null},e.setSkin=function(t){this._skeleton&&(this._skeleton.setSkinByName(t),this._skeleton.setSlotsToSetupPose()),this.invalidAnimationCache()},e.getAttachment=function(t,e){return this._skeleton?this._skeleton.getAttachmentByName(t,e):null},e.setAttachment=function(t,e){this._skeleton&&this._skeleton.setAttachment(t,e),this.invalidAnimationCache()},e.getTextureAtlas=function(t){return t.region},e.setMix=function(t,e,i){this._state&&this._state.data.setMix(t,e,i)},e.setAnimation=function(t,e,i){if(this._playTimes=i?0:1,this._animationName=e,this.isAnimationCached()){if(0!==t&&N("Track index can not greater than 0 in cached mode."),!this._skeletonCache)return null;var n=this._skeletonCache.getAnimationCache(this._skeletonData._uuid,e);n||(n=this._skeletonCache.initAnimationCache(this._skeletonData._uuid,e)),n&&(this._isAniComplete=!1,this._accTime=0,this._playCount=0,this._frameCache=n,this._socketNodes.size>0&&this._frameCache.enableCacheAttachedInfo(),this._frameCache.updateToFrame(0),this._curFrame=this._frameCache.frames[0])}else if(this._skeleton){var r=this._skeleton.data.findAnimation(e);if(!r)return W(7509,e),null;var s=this._state.setAnimationWith(t,r,i);return this._state.apply(this._skeleton),s}return null},e.addAnimation=function(t,e,i,n){if(n=n||0,this.isAnimationCached())0!==t&&N("Track index can not greater than 0 in cached mode."),this._animationQueue.push({animationName:e,loop:i,delay:n});else if(this._skeleton){var r,s=this._skeleton.data.findAnimation(e);return s?null===(r=this._state)||void 0===r?void 0:r.addAnimationWith(t,s,i,n):(W(7510,e),null)}return null},e.findAnimation=function(t){return this._skeleton?this._skeleton.data.findAnimation(t):null},e.getCurrent=function(t){if(this.isAnimationCached())N("'getCurrent' interface can not be invoked in cached mode.");else if(this._state)return this._state.getCurrent(t);return null},e.clearTracks=function(){this.isAnimationCached()?N("'clearTracks' interface can not be invoked in cached mode."):this._state&&(this._state.clearTracks(),this.setToSetupPose())},e.clearTrack=function(t){this.isAnimationCached()?N("'clearTrack' interface can not be invoked in cached mode."):this._state&&this._state.clearTrack(t)},e.setStartListener=function(t){this._ensureListener(),this._listener.start=t},e.setInterruptListener=function(t){this._ensureListener(),this._listener.interrupt=t},e.setEndListener=function(t){this._ensureListener(),this._listener.end=t},e.setDisposeListener=function(t){this._ensureListener(),this._listener.dispose=t},e.setCompleteListener=function(t){this._ensureListener(),this._listener.complete=t},e.setEventListener=function(t){this._ensureListener(),this._listener.event=t},e.setTrackStartListener=function(t,e){iot.getListeners(t).start=e},e.setTrackInterruptListener=function(t,e){iot.getListeners(t).interrupt=e},e.setTrackEndListener=function(t,e){iot.getListeners(t).end=e},e.setTrackDisposeListener=function(t,e){iot.getListeners(t).dispose=e},e.setTrackCompleteListener=function(t,e){iot.getListeners(t).complete=function(t){var i=Math.floor(t.trackTime/t.animationEnd);e(t,i)}},e.setTrackEventListener=function(t,e){iot.getListeners(t).event=e},e.getState=function(){return this._state},e.onEnable=function(){t.prototype.onEnable.call(this),this._flushAssembler(),Wht.getInstance().add(this)},e.onDisable=function(){t.prototype.onDisable.call(this),Wht.getInstance().remove(this)},e.onDestroy=function(){this._cleanMaterialCache(),this._drawList.destroy(),t.prototype.onDestroy.call(this)},e.destroyRenderData=function(){this._drawList.reset(),t.prototype.destroyRenderData.call(this)},e.getMaterialTemplate=function(){var t=this.customMaterial;return null===t&&(t=vv.get("default-spine-material")),t},e.getMaterialForBlendAndTint=function(t,e,i){var n=i+"/"+t+"/"+e,r=this._materialCache[n];if(r)return r;var s=this.getMaterialTemplate();r=new nT({parent:s,subModelIdx:0,owner:this}),this._materialCache[n]=r,r.overridePipelineStates({blendState:{blendColor:ki.WHITE,targets:[{blendEq:Yn.ADD,blendAlphaEq:Yn.ADD,blendSrc:t,blendDst:e,blendSrcAlpha:t,blendDstAlpha:e}]}});var a=!1;i===Hht.TWO_COLORED&&(a=!0);var o=!this._enableBatch;return r.recompileShaders({TWO_COLORED:a,USE_LOCAL:o}),r},e.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},e.querySockets=function(){return this._skeleton?(0===this._cachedSockets.size&&this._indexBoneSockets(),this._cachedSockets.size>0?Array.from(this._cachedSockets.keys()).sort():[]):[]},e._requestDrawData=function(t,e,i,n){var r=this._drawList.add();return r.material=t,r.texture=e,r.indexOffset=i,r.indexCount=n,r},e._render=function(t){var e=0;if(this.renderData&&this._drawList){for(var i=this.renderData,n=i.chunk,r=n.vertexAccessor,s=i.getMeshBuffer(),a=s.indexOffset,o=0;othis.maxVertexCount?e.maxVertexCount:this.maxVertexCount,this.maxIndexCount=e.maxIndexCount>this.maxIndexCount?e.maxIndexCount:this.maxIndexCount,this.renderData.resize(this.maxVertexCount,this.maxIndexCount),(!this.renderData.indices||this.maxIndexCount>this.renderData.indices.length)&&(this.renderData.indices=new Uint16Array(this.maxIndexCount)))),e.isCompleted&&r>=i.length){if(this._playCount++,this._playTimes>0&&this._playCount>=this._playTimes)return this._curFrame=i[i.length-1],this._accTime=0,this._playCount=0,this._isAniComplete=!0,void this._emitCacheCompleteEvent();this._accTime=0,r=0,this._emitCacheCompleteEvent()}this._curFrame=i[r]}},e._updateRealtime=function(t){var e=this._skeleton,i=this._state;e&&(e.update(t),i&&(i.update(t),i.apply(e)))},e._indexBoneSockets=function(){if(this._skeleton){this._cachedSockets.clear();for(var t=this._skeleton.bones,e=function e(i){return null==i.parent?i.data.name||"":e(t[i.parent.data.index])+"/"+i.data.name},i=0,n=t.length;i>>0)+(Aut<<16)+(vut<<8)+yut,but=t.dr*put,Tut=t.dg*mut,Eut=t.db*gut,out=((qht?255:0)<<24>>>0)+(Eut<<16)+(Tut<<8)+but}function elt(t){return(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r}function ilt(t,e,i,n){return(n<<24>>>0)+(i<<16)+(e<<8)+t}var nlt=null,rlt=null,slt={vCount:32767,ensureAccessor:function(t){var e=t?rlt:nlt;if(!e){var i=BN.root.device,n=BN.root.batcher2D,r=t?lk:hk;t?(e=rlt=new Sk(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINETINT",36),rlt)):(e=nlt=new Sk(i,r,this.vCount),n.registerBufferAccessor(Number.parseInt("SPINE",36),nlt))}return e},createData:function(t){var e=t.renderData;if(!e){for(var i=t.useTint||t.isAnimationCached(),n=this.ensureAccessor(i),r=t._skeleton.data.skins,s=0,a=0,o=0;o>1,a+=_.triangles.length)}}(e=pG.add(i?lk:hk,n)).resize(s,a),e.indices&&a===e.indices.length||(e.indices=new Uint16Array(a)),t.maxVertexCount=s,t.maxIndexCount=a}return e},updateRenderData:function(t){Cut=t;var e=t._skeleton;!t.isAnimationCached()&&e&&e.updateWorldTransform(),e&&function(t){if(t._skeleton){var e=t.color;iut=e.r/255,nut=e.g/255,rut=e.b/255,sut=t.node._uiProps.opacity,Qht=t.useTint||t.isAnimationCached(),hut=_k(Qht?lk:hk)>>2,t.drawList.reset(),Cut=t,wut=t.renderData,Zut=null,dut=!0,qht=t.premultipliedAlpha,Kht=1,But=!1,Jut=t._effectDelegate&&t._effectDelegate._vertexEffect,(4294967295!==e._val||qht)&&(But=!0);var i=null;t.enableBatch&&(i=t.node.worldMatrix),t.isAnimationCached()?function(t){var e=Cut._curFrame;if(e){var i=e.segments;if(0!==i.length){uut=12,Wut=0,Xut=0,Hut=0,jut=0;var n=null,r=e.vertices,s=e.indices,a=0,o=0,h=0,u=0,l=e.colors,c=0,_=l[c++],f=_.vfOffset;tlt(_);var d=0,p=wut,m=p.chunk.vb;Iut=new Uint32Array(m.buffer,m.byteOffset,m.length);for(var g=p.indices,y=0,v=i.length;y0&&(Cut._requestDrawData(Zut,Qut,d,S),d=jut),Zut=n,Qut=A.tex}zut=A.vertexCount,Xut=A.indexCount,a=p.chunk.vertexOffset;for(var b=jut,T=jut+Xut;b=f&&(tlt(_=l[c++]),f=_.vfOffset),Iut[x+5]=aut,Iut[x+6]=out;o+=u,Hut+=zut,jut+=Xut,zut=0,Xut=0}}var I=jut-d;Qut&&I>0&&Cut._requestDrawData(Zut,Qut,d,I)}}}(i):(Jut&&Jut.begin(t._skeleton),function(t){var e=wut;Rut=e.chunk.vb,Iut=new Uint32Array(Rut.buffer,Rut.byteOffset,Rut.length),xut=e.indices,Yut=Cut.maxVertexCount,qut=Cut.maxIndexCount;var i,n,r,s,a,o,h=Cut._skeleton,u=h.color,l=Cut._debugRenderer,c=Cut._clipper,_=null;Jht=Cut._startSlotIndex,Zht=Cut._endSlotIndex,fut=!1,-1===Jht&&(fut=!0),$ht=Cut.debugSlots,tut=Cut.debugBones,eut=Cut.debugMesh,l&&(tut||$ht||eut)&&(l.clear(),l.lineWidth=5),uut=12,Uut=0,Hut=0,Wut=0,Xut=0,jut=0;for(var f=0,d=0,p=h.drawOrder.length;d=0&&Jht===o.data.index&&(fut=!0),fut)if(Zht>=0&&Zht===o.data.index&&(fut=!1),Uut=0,Xut=0,i=o.getAttachment())if(s=i instanceof eot.RegionAttachment,a=i instanceof eot.MeshAttachment,i instanceof eot.ClippingAttachment)c.clipStart(o,i);else if(s||a){var m=i.region.texture.getRealTexture();if(_=$ut(o.data.blendMode)){if(Zut||(Zut=_),dut||_.hash!==Zut.hash||m&&Qut!==m){dut=!1;var g=jut-f;g>0&&(Cut._requestDrawData(Zut,Qut,f,g),f=jut),Qut=m,Zut=_}if(s){if(r=Put,Uut=(zut=4)*hut,Xut=6,i.computeWorldVertices(o.bone,Rut,Wut,hut),l&&$ht){l.strokeColor=Mut,l.moveTo(Rut[Wut],Rut[Wut+1]);for(var y=Wut+hut,v=Wut+Uut;y>1,Uut=zut*hut,Xut=r.length,A.computeWorldVertices(o,0,A.worldVerticesLength,Rut,Wut,hut),l&&eut){l.strokeColor=Nut;for(var S=0,b=r.length;S0){for(var B=e.chunk.vertexOffset,D=jut,P=jut+Xut;D0&&Cut._requestDrawData(Zut,Qut,f,F),c.clipEnd(),l&&tut){var N;l.strokeColor=Out,l.fillColor=Mut;for(var L=0,V=h.bones.length;Lr.vertexCount&&(r.resizeAndCopy(Yut,qut>r.indexCount?qut:r.indexCount),Rut=r.chunk.vb,Iut=new Uint32Array(Rut.buffer,Rut.byteOffset,Rut.length),o=!0),qut>xut.length&&(xut=r.indices=new Uint16Array(qut),o=!0),o)for(var h=r.chunk.vertexOffset-a,u=0;u0&&xut.set(h,jut),Jut)for(var u=0,l=o.length,c=Wut;u0&&xut.set(b,jut),Jut)for(var T=0,E=S.length,C=Wut;T1,b=A[0],T=b.getAttribute("source");T=T.replace(/\\/g,"/");var E=m.getElementsByTagName("tile"),C=E&&E.length||1,w=null,x=m.getAttribute("name")||"",R=parseInt(m.getAttribute("spacing"))||0,I=parseInt(m.getAttribute("margin"))||0,B=i||parseInt(m.getAttribute("firstgid"))||0,D=new gn(0,0);D.width=parseFloat(m.getAttribute("tilewidth")),D.height=parseFloat(m.getAttribute("tileheight"));var P=m.getElementsByTagName("tileoffset")[0],M=0,O=0;P&&(M=parseFloat(P.getAttribute("x"))||0,O=parseFloat(P.getAttribute("y"))||0);for(var F=null,N=0;N0){var z=U[0],H=z.getAttribute("source");if(H=H.replace(/\\/g,"/"),F.imageName=H,F.imageSize.width=parseFloat(z.getAttribute("width"))||0,F.imageSize.height=parseFloat(z.getAttribute("height"))||0,F._tileSize.width=F.imageSize.width,F._tileSize.height=F.imageSize.height,F.sourceImage=this._spriteFrameMap[H],!F.sourceImage){var X=t.getNameWithPostfix(H);if(F.imageName=X,F.sourceImage=this._spriteFrameMap[X],!F.sourceImage){var j=t.getShortName(H);F.imageName=j,F.sourceImage=this._spriteFrameMap[j],F.sourceImage||(q(7221,H),console.warn("Please try asset type of "+H+" to 'sprite-frame'"))}}F.firstGid=this.parentGID&_lt.FLIPPED_MASK}var Y=(_lt.FLIPPED_MASK&this.parentGID)>>>0;this._tileProperties.set(Y,Clt(w));var K=w.getElementsByTagName("animation");if(K&&K.length>0){var J=K[0].getElementsByTagName("frame"),Z={frames:[],dt:0,frameIdx:0};this._tileAnimations.set(Y,Z);for(var Q=Z.frames,$=0;$0){var f=_[0];l.type=mlt.TEXT,l.wrap="1"===f.getAttribute("wrap"),l.color=Elt(f.getAttribute("color")),l.halign=blt(f.getAttribute("halign")),l.valign=Tlt(f.getAttribute("valign")),l.pixelsize=parseInt(f.getAttribute("pixelsize"))||16,l.text=f.childNodes[0].nodeValue}var d=u.getAttribute("gid");d&&(l.gid=parseInt(d),l.type=mlt.IMAGE);var p=u.getElementsByTagName("ellipse");p&&p.length>0&&(l.type=mlt.ELLIPSE);var m=u.getElementsByTagName("polygon");if(m&&m.length>0){l.type=mlt.POLYGON;var g=m[0].getAttribute("points");g&&(l.points=this._parsePointsString(g))}var y=u.getElementsByTagName("polyline");if(y&&y.length>0){l.type=mlt.POLYLINE;var v=y[0].getAttribute("points");v&&(l.polylinePoints=this._parsePointsString(v))}l.type||(l.type=mlt.RECT),e.objects.push(l)}"index"!==a&&e.objects.sort((function(t,e){return t.y-e.y}))}return e},e._parsePointsString=function(t){if(!t)return null;for(var e=[],i=t.split(" "),n=0;n1)if(i){v._name=i.name;var T=i.unbiasUV[0],E=i.rotated?i.unbiasUV[1]:i.unbiasUV[5];v.l=T+(v.x+.5)/c,v.t=E+(v.y+.5)/_,v.r=T+(v.x+v.width-.5)/c,v.b=E+(v.y+v.height-.5)/_,v._rect=new vn(v.x,v.y,v.width,v.height)}else v.l=v.x/c,v.t=v.y/_,v.r=(v.x+v.width)/c,v.b=(v.y+v.height)/_,v._rect=new vn(v.x,v.y,v.width,v.height);else i.rotated?(v._rotated=!0,v._name=i.name,v._rect=i.getRect(),v.l=i.unbiasUV[0],v.t=i.unbiasUV[1],v.r=i.unbiasUV[4],v.b=i.unbiasUV[3]):(v._name=i.name,v._rect=i.getRect(),v.l=i.unbiasUV[0],v.t=i.unbiasUV[5],v.r=i.unbiasUV[2],v.b=i.unbiasUV[1]);v.cx=(v.l+v.r)/2,v.cy=(v.t+v.b)/2,e.set(b,v)}}for(var Xlt,jlt,Ylt,qlt,Klt,Jlt,Zlt,Qlt,$lt,tct,ect,ict,nct,rct,sct,act,oct,hct,uct,lct,cct,_ct,fct,dct,pct,mct,gct,yct,vct,Act,Sct,bct,Tct,Ect,Cct,wct,xct,Rct,Ict=new hn,Bct=new _n,Dct=new ji,Pct=new ji,Mct={row:0,col:0},Oct=t("TiledUserNodeData",_u("cc.TiledUserNodeData")(Glt=function(t){function e(){var e;return(e=t.call(this)||this)._index=-1,e._row=-1,e._col=-1,e._tiledLayer=null,e}return c(e,t),e}(Cc))||Glt),Fct=t("TiledLayer",_u("cc.TiledLayer")(Ult=function(t){c(i,t);var e=i.prototype;function i(){var e;return(e=t.call(this)||this)._userNodeGrid={},e._userNodeMap={},e._userNodeDirty=!1,e.tiledTiles=[],e._viewPort={x:-1,y:-1,width:-1,height:-1},e._cullingRect={leftDown:{row:-1,col:-1},rightTop:{row:-1,col:-1}},e._cullingDirty=!0,e._rightTop={row:-1,col:-1},e._layerInfo=null,e._mapInfo=null,e._topOffset=0,e._downOffset=0,e._leftOffset=0,e._rightOffset=0,e.tiles=[],e.vertices=[],e._verticesDirty=!0,e._layerName="",e._layerSize=void 0,e._minGID=void 0,e._maxGID=void 0,e._layerOrientation=null,e._opacity=void 0,e._tintColor=void 0,e.texGrids=null,e._textures=[],e._tilesets=[],e._leftDownToCenterX=0,e._leftDownToCenterY=0,e._hasTiledNodeGrid=!1,e._hasAniGrid=!1,e._animations=null,e._enableCulling=void 0,e.colorChanged=!1,e._properties=void 0,e.renderOrder=void 0,e._staggerAxis=void 0,e._staggerIndex=void 0,e._hexSideLength=void 0,e._mapTileSize=void 0,e._odd_even=void 0,e._diffX1=void 0,e._diffY1=void 0,e._useAutomaticVertexZ=void 0,e._vertexZvalue=void 0,e._offset=void 0,e._tiledDataArray=[],e._drawInfoList=[],e._tiledDataArrayIdx=0,e}return e.requestDrawInfo=function(t){return this._drawInfoList[t]||(this._drawInfoList[t]=new Ek,this._drawInfoList[t].setDrawInfoType(mk.MIDDLEWARE)),this._drawInfoList[t]},e.hasTiledNode=function(){return this._hasTiledNodeGrid},e.hasAnimation=function(){return this._hasAniGrid},e.addUserNode=function(t){var e=t.getComponent(Oct);return e?(N("CCTiledLayer:addUserNode node has been added"),!1):(e=t.addComponent(Oct),t.parent=this.node,this._userNodeMap[t.uuid]=e,e._row=-1,e._col=-1,e._tiledLayer=this,this._nodeLocalPosToLayerPos(t.getPosition(),Bct),this._positionToRowCol(Bct.x,Bct.y,Mct),this._addUserNodeToGrid(e,Mct),this._updateCullingOffsetByUserNode(t),t.on(oA.TRANSFORM_CHANGED,this._userNodePosChange,e),t.on(oA.SIZE_CHANGED,this._userNodeSizeChange,e),!0)},e.removeUserNode=function(t){var e=t.getComponent(Oct);return e?(t.off(oA.TRANSFORM_CHANGED,this._userNodePosChange,e),t.off(oA.SIZE_CHANGED,this._userNodeSizeChange,e),this._removeUserNodeFromGrid(e),delete this._userNodeMap[t.uuid],t._removeComponent(e),e.destroy(),t.removeFromParent(),!0):(N("CCTiledLayer:removeUserNode node is not exist"),!1)},e.destroyUserNode=function(t){this.removeUserNode(t),t.destroy()},e._nodeLocalPosToLayerPos=function(t,e){e.x=t.x+this._leftDownToCenterX,e.y=t.y+this._leftDownToCenterY},e.getNodesByRowCol=function(t,e){var i=this._userNodeGrid[t];return i?i[e]:null},e.getNodesCountByRow=function(t){var e=this._userNodeGrid[t];return e?e.count:0},e._updateAllUserNode=function(){for(var t in this._userNodeGrid={},this._userNodeMap){var e=this._userNodeMap[t];this._nodeLocalPosToLayerPos(e.node.getPosition(),Bct),this._positionToRowCol(Bct.x,Bct.y,Mct),this._addUserNodeToGrid(e,Mct),this._updateCullingOffsetByUserNode(e.node)}},e._updateCullingOffsetByUserNode=function(t){var e=t._uiProps.uiTransformComp.contentSize;this._topOffsetthis._rightTop.row&&(t.row=this._rightTop.row),i<0&&(t.col=0),i>this._rightTop.col&&(t.col=this._rightTop.col)},e._addUserNodeToGrid=function(t,e){var i=e.row,n=e.col,r=this._userNodeGrid[i]=this._userNodeGrid[i]||{count:0},s=r[n]=r[n]||{count:0,list:[]};t._row=i,t._col=n,t._index=s.list.length,r.count++,s.count++,s.list.push(t),this._userNodeDirty=!0},e.isUserNodeDirty=function(){return this._userNodeDirty},e.setUserNodeDirty=function(t){this._userNodeDirty=t},e.onEnable=function(){t.prototype.onEnable.call(this),this.node.on(oA.ANCHOR_CHANGED,this._syncAnchorPoint,this),this.node.on(oA.TRANSFORM_CHANGED,this.updateCulling,this),this.node.on(oA.SIZE_CHANGED,this.updateCulling,this),this.node.parent.on(oA.TRANSFORM_CHANGED,this.updateCulling,this),this.node.parent.on(oA.SIZE_CHANGED,this.updateCulling,this),this.markForUpdateRenderData(),this.scheduleOnce(this.updateCulling.bind(this))},e.onDisable=function(){var e,i;t.prototype.onDisable.call(this),null===(e=this.node.parent)||void 0===e||e.off(oA.SIZE_CHANGED,this.updateCulling,this),null===(i=this.node.parent)||void 0===i||i.off(oA.TRANSFORM_CHANGED,this.updateCulling,this),this.node.off(oA.SIZE_CHANGED,this.updateCulling,this),this.node.off(oA.TRANSFORM_CHANGED,this.updateCulling,this),this.node.off(oA.ANCHOR_CHANGED,this._syncAnchorPoint,this)},e._syncAnchorPoint=function(){var t=this.node,e=t._uiProps.uiTransformComp,i=t.getScale();this._leftDownToCenterX=e.width*e.anchorX*i.x,this._leftDownToCenterY=e.height*e.anchorY*i.y,this._cullingDirty=!0,this.markForUpdateRenderData()},e.getLayerName=function(){return this._layerName},e.setLayerName=function(t){this._layerName=t},e.getProperty=function(t){return this._properties[t]},e.getPositionAt=function(t,e){var i;switch(void 0!==e?(i=Math.floor(t),e=Math.floor(e)):(i=Math.floor(t.x),e=Math.floor(t.y)),this._layerOrientation){case llt.ORTHO:return this._positionForOrthoAt(i,e);case llt.ISO:return this._positionForIsoAt(i,e);case llt.HEX:return this._positionForHexAt(i,e)}return null},e.isInvalidPosition=function(t,e){return t>=this._layerSize.width||e>=this._layerSize.height||t<0||e<0},e._positionForIsoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(s&_lt.FLIPPED_MASK)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new _n(.5*this._mapTileSize.width*(this._layerSize.height+t-e-1)+i,.5*this._mapTileSize.height*(this._layerSize.width-t+this._layerSize.height-e-2)-n)},e._positionForOrthoAt=function(t,e){var i=0,n=0,r=Math.floor(t)+Math.floor(e)*this._layerSize.width,s=this.tiles[r];if(s){var a=(s&_lt.FLIPPED_MASK)>>>0,o=this.texGrids.get(a).tileset.tileOffset;i=o.x,n=o.y}return new _n(t*this._mapTileSize.width+i,(this._layerSize.height-e-1)*this._mapTileSize.height-n)},e._positionForHexAt=function(t,e){var i,n=this._mapTileSize.width,r=this._mapTileSize.height,s=this._layerSize.height,a=Math.floor(t)+Math.floor(e)*this._layerSize.width,o=(this.tiles[a]&_lt.FLIPPED_MASK)>>>0;i=this.texGrids.get(o)?this.texGrids.get(o).tileset.tileOffset:{x:0,y:0};var h=this._staggerIndex===dlt.STAGGERINDEX_ODD?1:-1,u=0,l=0,c=0,_=0;switch(this._staggerAxis){case flt.STAGGERAXIS_Y:c=0,e%2==1&&(c=n/2*h),u=t*n+c+i.x,l=(s-e-1)*(r-(r-this._hexSideLength)/2)-i.y;break;case flt.STAGGERAXIS_X:_=0,t%2==1&&(_=r/2*-h),u=t*(n-(n-this._hexSideLength)/2)+i.x,l=(s-e-1)*r+_-i.y}return new _n(u,l)},e.setTilesGIDAt=function(t,e,i,n){if(t&&0!==t.length&&!(n<=0)){i<0&&(i=0),e<0&&(e=0);for(var r=0,s=e+n,a=i;;a++)for(var o=e;o=t.length)return;this._updateTileForGID(t[r],o,a),r++}}},e.setTileGIDAt=function(t,e,i,n){var r=(t&_lt.FLIPPED_MASK)>>>0;if(e=Math.floor(e),i=Math.floor(i),this.isInvalidPosition(e,i))throw new Error("cc.TiledLayer.setTileGIDAt(): invalid position");this.tiles&&this._tilesets&&0!==this._tilesets.length?0!==r&&r>>0,e,i)):W(7238)},e._updateTileForGID=function(t,e,i){var n=0|e+i*this._layerSize.width;if(!(n>=this.tiles.length)&&t!==this.tiles[n]){var r=(t&_lt.FLIPPED_MASK)>>>0;this.texGrids.get(r)?(this.tiles[n]=t,this._updateVertex(e,i)):this.tiles[n]=0,this._cullingDirty=!0}},e.getTileGIDAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("cc.TiledLayer.getTileGIDAt(): invalid position");if(!this.tiles)return W(7237),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(this.tiles[i]&_lt.FLIPPED_MASK)>>>0},e.getTileFlagsAt=function(t,e){if(this.isInvalidPosition(t,e))throw new Error("TiledLayer.getTileFlagsAt: invalid position");if(!this.tiles)return W(7240),null;var i=Math.floor(t)+Math.floor(e)*this._layerSize.width;return(this.tiles[i]&_lt.FLIPPED_ALL)>>>0},e.setCullingDirty=function(t){this._cullingDirty=t},e.isCullingDirty=function(){return this._cullingDirty},e.updateViewPort=function(t,e,i,n){if(this._viewPort.width!==i||this._viewPort.height!==n||this._viewPort.x!==t||this._viewPort.y!==e){this._viewPort.x=t,this._viewPort.y=e,this._viewPort.width=i,this._viewPort.height=n;var r=1;this._layerOrientation===llt.ISO&&(r=2);var s=this._viewPort.x-this._offset.x+this._leftDownToCenterX,a=this._viewPort.y-this._offset.y+this._leftDownToCenterY,o=s-this._leftOffset,h=a-this._downOffset,u=s+i+this._rightOffset,l=a+n+this._topOffset,c=this._cullingRect.leftDown,_=this._cullingRect.rightTop;o<0&&(o=0),h<0&&(h=0),this._positionToRowCol(o,h,Mct),Mct.row-=r,Mct.col-=r,Mct.row=Mct.row>0?Mct.row:0,Mct.col=Mct.col>0?Mct.col:0,Mct.row===c.row&&Mct.col===c.col||(c.row=Mct.row,c.col=Mct.col,this._cullingDirty=!0),u<0||l<0?(Mct.row=-1,Mct.col=-1):(this._positionToRowCol(u,l,Mct),Mct.row++,Mct.col++),Mct.row>this._rightTop.row&&(Mct.row=this._rightTop.row),Mct.col>this._rightTop.col&&(Mct.col=this._rightTop.col),Mct.row===_.row&&Mct.col===_.col||(_.row=Mct.row,_.col=Mct.col,this._cullingDirty=!0,this.markForUpdateRenderData())}},e._positionToRowCol=function(t,e,i){var n=this._mapTileSize.width,r=this._mapTileSize.height,s=.5*n,a=.5*r,o=0,h=0,u=0,l=0,c=this._staggerAxis;switch(this._layerOrientation){case llt.ORTHO:h=Math.floor(t/n),o=Math.floor(e/r);break;case llt.ISO:h=Math.floor(t/s),o=Math.floor(e/a);break;case llt.HEX:c===flt.STAGGERAXIS_Y?(u=(o=Math.floor(e/(r-this._diffY1)))%2==1?s*this._odd_even:0,h=Math.floor((t-u)/n)):(l=(h=Math.floor(t/(n-this._diffX1)))%2==1?a*-this._odd_even:0,o=Math.floor((e-l)/r))}return i.row=o,i.col=h,i},e.updateCulling=function(){if(this._enableCulling){this.node.updateWorldTransform(),hn.invert(Ict,this.node.getWorldMatrix());var t=BN.root.batcher2D.getFirstRenderCamera(this.node);t&&(Dct.x=0,Dct.y=0,Dct.z=0,Pct.x=t.width,Pct.y=t.height,Pct.z=0,t.screenToWorld(Dct,Dct),t.screenToWorld(Pct,Pct),ji.transformMat4(Dct,Dct,Ict),ji.transformMat4(Pct,Pct,Ict),this.updateViewPort(Dct.x,Dct.y,Pct.x-Dct.x,Pct.y-Dct.y))}},e.getLayerOrientation=function(){return this._layerOrientation},e.getProperties=function(){return this._properties},e._updateVertex=function(t,e){var i=_lt.FLIPPED_MASK,n=this.vertices,r=this._layerOrientation,s=this.tiles;if(s){var a,o,h,u,l=this._rightTop,c=this._mapTileSize.width,_=this._mapTileSize.height,f=.5*c,d=.5*_,p=this._layerSize.height,m=this._layerSize.width,g=this.texGrids,y=0,v=0;r===llt.HEX&&(a=this._staggerAxis,o=this._diffX1,h=this._diffY1,u=this._odd_even);var A,S,b,T=0,E=0,C=0,w=0,x=e*m+t;A=(s[x]&i)>>>0;var R=g.get(A);if(R){switch(this._animations.get(A)&&(this._hasAniGrid=this._hasAniGrid||!0),r){case llt.ORTHO:y=(T=t)*c,v=(E=p-e-1)*_;break;case llt.ISO:y=f*(T=p+t-e-1),v=d*(E=p+m-t-e-2);break;case llt.HEX:y=t*(c-o)+(a===flt.STAGGERAXIS_Y&&e%2==1?f*u:0),v=(p-e-1)*(_-h)+(a===flt.STAGGERAXIS_X&&t%2==1?d*-u:0),T=t,E=p-e-1}var I=n[E]=n[E]||{minCol:0,maxCol:0},B=I[T]=I[T]||{};I.minCol>T&&(I.minCol=T),I.maxCol=0&&this._textures.length>t?this._textures[t]:null},e.getTextures=function(){return this._textures},e.setTexture=function(t){this.setTextures([t])},e.setTextures=function(t){this._textures=t,this.markForUpdateRenderData()},e.getLayerSize=function(){return this._layerSize},e.getMapTileSize=function(){return this._mapTileSize},e.getTileSet=function(t){return t=t||0,this._tilesets&&t>=0&&this._tilesets.length>t?this._tilesets[t]:null},e.getTileSets=function(){return this._tilesets},e.setTileSet=function(t){this.setTileSets([t])},e.setTileSets=function(t){this._tilesets=t;var e=this._textures=[],i=this.texGrids;i.clear();for(var n=0;n0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length;)t.pop();if(t.length>0){var e=t[t.length-1];if(e.renderData&&0===e.renderData.vertexCount)return e}var i={renderData:null,texture:null};return this._tiledDataArray.push(i),i},e.requestSubNodesData=function(){var t=this._tiledDataArray;if(t.length>0&&t[t.length-1].subNodes&&0===t[t.length-1].subNodes.length)return t[t.length-1];var e={subNodes:[]};return this._tiledDataArray.push(e),e},e.destroyRenderData=function(){this._tiledDataArray.forEach((function(t){var e=t.renderData;e&&pG.remove(e)})),this._tiledDataArray.length=0,t.prototype.destroyRenderData.call(this)},e._flushAssembler=function(){var t=i.Assembler.getAssembler(this);this._assembler!==t&&(this._assembler=t,this._assembler.createData(this)),0===this._tiledDataArray.length&&(this.markForUpdateRenderData(),this._updateColor())},e._render=function(t){for(var e=0;e>>0,P=i.get(D);if(!P)continue;var M=P.tileset,O="img"+A.id;g[O]=!0;var F=this.node.getChildByName(O);A.width=A.width||P.width,A.height=A.height||P.height,F&&F._objFlags&Sa.Flags.HideInHierarchy&&(F.removeFromParent(),F.hideFlags|=Sa.Flags.DontSave,F.destroy(),F=null),F||(F=new YA),this._animations.get(D)&&(this.aniObjects.push({object:A,imgNode:F,gridGID:D}),this._hasAniObj=!0);var N=M.tileOffset.x,L=M.tileOffset.y;F.active=A.visible,F.setRotationFromEuler(0,0,-A.rotation),F.setPosition(A.x-d,A.y-p),F.name=O,F.parent=this.node,F.setSiblingIndex(y);var V=F.getComponent(MW);V||(V=F.addComponent(MW));var k=F._uiProps.uiTransformComp;c?(k.anchorX=.5+N/A.width,k.anchorY=L/A.height):(k.anchorX=N/A.width,k.anchorY=L/A.height),this._tintColor?(l.set(this._tintColor),l.a*=this._opacity/255,V.color.set(l)):V.color.a*=this._opacity/255,V.sizeMode=MW.SizeMode.CUSTOM;var G=this._premultiplyAlpha?jn.ONE:jn.SRC_ALPHA;V._srcBlendFactor!==G&&(V._srcBlendFactor=G,V.material&&V._updateBlendFunc());var U=P.spriteFrame;U=U?U.clone():new lV,(B&r)>>>0&&(U.flipUVX=!U.flipUVX),(B&s)>>>0&&(U.flipUVY=!U.flipUVY),U.rotated=P._rotated,U.rect=P._rect,V.spriteFrame=U,k.setContentSize(A.width,A.height),V.markForUpdateRenderData()}}this._objects=m;for(var z=this.node.children,H=/^(?:img|text)\d+$/,W=0,X=z.length;W0&&(m[d[g]]=p[g].text);var y=new zlt(i.tmxXmlStr,m,a,o,c),v=y.getTilesets();v&&0!==v.length||W(7241),this._buildWithMapInfo(y)}else this._releaseMapInfo()},i._releaseMapInfo=function(){for(var t=this._layers,e=0,i=t.length;e0)for(var b=0,T=y.length;b=o.length&&(a.frameIdx=0),h=o[a.frameIdx]),n.set(s,h.grid)}for(var u=this.getLayers(),l=0,c=u.length;l>>0&&(i=qct,qct=Kct,Kct=i),(e&_lt.HORIZONTAL)>>>0&&(i=Yct,Yct=Kct,Kct=i,i=qct,qct=Jct,Jct=i),(e&_lt.VERTICAL)>>>0&&(i=Yct,Yct=qct,qct=i,i=Kct,Kct=Jct,Jct=i)}function s_t(){if(!(t_t<1)&&e_t){var t=4*t_t,e=6*t_t,i=zct.requestTiledRenderData();i.renderData=pG.add(ok),i.texture=e_t;var n=i.renderData;n.resize(t,e),n.chunk.vb.set(Uct.subarray(0,9*t),0),t_t=0,e_t=null}}function a_t(t,e,i,n,r){if(!(e.row<0||e.col<0)){zct=r;var s=r.node.worldMatrix;Zct=0;var a,o,h,u,l,c,_,f,d,p=r.tiledTiles,m=r.texGrids,g=r.tiles,y=18,v=27,A=r.vertices,S=0,b=0,T=0,E=0,C=0,w=0,x=!0;Hct=r_t;var R=new Float32Array(4);R[0]=r.color.r/255,R[1]=r.color.g/255,R[2]=r.color.b/255,R[3]=r.color.a/255,-1===i?(u=e.row,l=t.row):(u=t.row,l=e.row);var I=Math.abs(t.row-e.row)+1,B=Math.abs(e.col-t.col)+1;Uct=new Float32Array(I*B*36),t_t=0;for(var D=Uct;(l-u)*i>=0;u+=i)for(a=A[u],w=r.getNodesCountByRow(u),x=a&&0===w,1===n?(o=x&&t.cola.maxCol?a.maxCol:e.col):(o=x&&e.col>a.maxCol?a.maxCol:e.col,h=x&&t.col=0;o+=n){if(c=a&&a[o],w>0){s_t();var P=r.requestSubNodesData(),M=r.getNodesByRowCol(u,o);M&&M.count>0&&(P.subNodes=M.list)}c&&(S=g[c.index],(f=m.get((S&_lt.FLIPPED_MASK)>>>0))&&(e_t!==f.texture&&(s_t(),e_t=f.texture),_=f.tileset._tileSize,b=c.left-Qct,T=c.bottom-$ct,E=b+_.width,C=T+_.height,d=p[c.index],Zct=36*t_t,d?d.node.active&&o_t(d.node,R,D,b,E,C,T,!1):(kct[0].x=b,kct[0].y=C,kct[1].x=b,kct[1].y=T,kct[2].x=E,kct[2].y=C,kct[3].x=E,kct[3].y=T,kct[0].transformMat4(s),D[Zct]=kct[0].x,D[Zct+1]=kct[0].y,D[Zct+2]=kct[0].z,kct[1].transformMat4(s),D[Zct+9]=kct[1].x,D[Zct+9+1]=kct[1].y,D[Zct+9+2]=kct[1].z,kct[2].transformMat4(s),D[Zct+y]=kct[2].x,D[Zct+y+1]=kct[2].y,D[Zct+y+2]=kct[2].z,kct[3].transformMat4(s),D[Zct+v]=kct[3].x,D[Zct+v+1]=kct[3].y,D[Zct+v+2]=kct[3].z,D.set(R,Zct+5),D.set(R,Zct+9+5),D.set(R,Zct+y+5),D.set(R,Zct+v+5)),Hct(f,S),D[Zct+3]=Yct.x,D[Zct+4]=Yct.y,D[Zct+9+3]=qct.x,D[Zct+9+4]=qct.y,D[Zct+y+3]=Kct.x,D[Zct+y+4]=Kct.y,D[Zct+v+3]=Jct.x,D[Zct+v+4]=Jct.y,++t_t>=Vct&&s_t()))}s_t()}}function o_t(t,e,i,n,r,s,a,o){var h=18,u=27;t.updateWorldTransform(),hn.fromRTS(Wct,t.rotation,t.position,t.scale),ji.set(Xct,-(n+Qct),-(a+$ct),0),hn.transform(Wct,Wct,Xct),hn.multiply(Wct,t.parent.worldMatrix,Wct);var l=Wct,c=l.m12,_=l.m13,f=l.m00,d=l.m01,p=l.m04,m=l.m05,g=1===f&&0===d&&0===p&&1===m;if(o){var y=(n+r)/2,v=(s+a)/2;g?(i[Zct]=y+c,i[Zct+1]=s+_,i[Zct+9]=n+c,i[Zct+9+1]=v+_,i[Zct+h]=r+c,i[Zct+h+1]=v+_,i[Zct+u]=y+c,i[Zct+u+1]=a+_):(i[Zct]=y*f+s*p+c,i[Zct+1]=y*d+s*m+_,i[Zct+9]=n*f+v*p+c,i[Zct+9+1]=n*d+v*m+_,i[Zct+h]=r*f+v*p+c,i[Zct+h+1]=r*d+v*m+_,i[Zct+u]=y*f+a*p+c,i[Zct+u+1]=y*d+a*m+_)}else g?(i[Zct]=n+c,i[Zct+1]=s+_,i[Zct+9]=n+c,i[Zct+9+1]=a+_,i[Zct+h]=r+c,i[Zct+h+1]=s+_,i[Zct+u]=r+c,i[Zct+u+1]=a+_):(i[Zct]=n*f+s*p+c,i[Zct+1]=n*d+s*m+_,i[Zct+9]=n*f+a*p+c,i[Zct+9+1]=n*d+a*m+_,i[Zct+h]=r*f+s*p+c,i[Zct+h+1]=r*d+s*m+_,i[Zct+u]=r*f+a*p+c,i[Zct+u+1]=r*d+a*m+_);i.set(e,Zct+5),i.set(e,Zct+9+5),i.set(e,Zct+h+5),i.set(e,Zct+u+5)}var h_t=t("tiledLayerAssembler",{getAssembler:function(){return n_t}});Fct.Assembler=h_t;var u_t=function(){function t(){this.originalTarget=null,this.target=null,this.tag=t.TAG_INVALID}var e=t.prototype;return e.clone=function(){var e=new t;return e.originalTarget=null,e.target=null,e.tag=this.tag,e},e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.step=function(){W(1006)},e.update=function(){W(1007)},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.reverse=function(){return W(1008),null},e.retain=function(){},e.release=function(){},t}();u_t.TAG_INVALID=-1;var l_t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===u_t.TAG_INVALID&&W(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeActionByTag(t,r,e)}else n.forEach((function(e){i._removeActionByTag(t,e)}))},e.removeAllActionsByTag=function(t,e){var i=this;t===u_t.TAG_INVALID&&W(1002);var n=this._hashTargets;if(e){var r=n.get(e);r&&this._removeAllActionsByTag(t,r,e)}else n.forEach((function(e){i._removeAllActionsByTag(t,e)}))},e.getActionByTag=function(t,e){t===u_t.TAG_INVALID&&W(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n=this._duration},i._cloneDecoration=function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},i._reverseEaseList=function(t){if(this._easeList){t._easeList=[];for(var e=0;e1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},i.startWithTarget=function(t){u_t.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return W(1010),this},i.setAmplitudeRate=function(){W(1011)},i.getAmplitudeRate=function(){return W(1012),0},i.speed=function(t){return t<=0?(W(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),isNaN(t)||t<1?(W(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},i.repeatForever=function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this},e}(l_t),S_t=function(t){function e(i){var n;(n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1;var r=i instanceof Array?i:arguments;if(1===r.length)return q(1019),g(n);var s=r.length-1;if(s>=0&&null==r[s]&&W(1015),s>=0){for(var a,o=r[0],h=1;h1?e%1:e),this._last=n)},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t},e}(A_t);function b_t(t){var e=t instanceof Array?t:arguments;if(1===e.length)return q(1019),null;var i=e.length-1;i>=0&&null==e[i]&&W(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=S_t._actionOneTwo(n,e[r]))}return n}S_t._actionOneTwo=function(t,e){var i=new S_t;return i.initWithTwoActions(t,e),i};var T_t=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,void 0!==i&&n.initWithAction(e,i),n}c(e,t);var i=e.prototype;return i.initWithAction=function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof p_t&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,A_t.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),u_t.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total1?1:r;t>=1&&this._total=0&&null==r[s]&&W(1015),s>=0){for(var a,o=r[0],h=1;hr?this._two=S_t._actionOneTwo(e,R_t(n-r)):n0&&null==e[e.length-1]&&W(1015);for(var i=e[0],n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===Xft.COLOR){var n=e._uiProps.uiComp;ki.lerp(qft,this._fromColor,this._toColor,i),n&&(n.color=qft)}else this.transition===Xft.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ai(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ai(this._fromScale.y,this._toScale.y,i),e.setScale(this._targetScale));1===i&&(this._transitionFinished=!0)}},i._resizeNodeToTargetNode=function(){this.target&&this.target._uiProps.uiTransformComp},i._resetState=function(){this._pressed=!1,this._hovered=!1;var t=this.target;if(t){var e=this._transition;if(e===Xft.COLOR&&this._interactable){var i=t.getComponent(zU);i&&(i.color=this._normalColor)}else e===Xft.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(oA.TOUCH_START,this._onTouchBegan,this),this.node.on(oA.TOUCH_MOVE,this._onTouchMove,this),this.node.on(oA.TOUCH_END,this._onTouchEnded,this),this.node.on(oA.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(oA.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(oA.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(B_t.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(B_t.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(B_t.XRUI_CLICK,this._xrClick,this),this.node.on(B_t.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(oA.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(oA.TOUCH_START,this._onTouchBegan,this),this.node.off(oA.TOUCH_MOVE,this._onTouchMove,this),this.node.off(oA.TOUCH_END,this._onTouchEnded,this),this.node.off(oA.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(oA.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(oA.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(B_t.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(B_t.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(B_t.XRUI_CLICK,this._xrClick,this),this.node.off(B_t.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(oA.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(MW)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new ji),ji.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===Xft.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case jft.NORMAL:this._normalSprite=t;break;case jft.HOVER:this._hoverSprite=t;break;case jft.PRESSED:this._pressedSprite=t;break;case jft.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===Xft.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case jft.NORMAL:this._normalColor=t;break;case jft.HOVER:this._hoverColor=t;break;case jft.PRESSED:this._pressedColor=t;break;case jft.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&EA.SCALE&&this._originalScale&&this._transition===Xft.SCALE&&this._transitionFinished&&ji.copy(this._originalScale,this.target.getScale())},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation());this._transition===Xft.SCALE&&this.target&&this._originalScale?n?(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?jft.PRESSED:jft.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(bc.emitEvents(this.clickEvents,t),this.node.emit(Yft.CLICK,this)),this._pressed=!1,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchCancel=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!1,this._updateState())},i._onMouseMoveIn=function(){!this._pressed&&this.interactable&&this.enabledInHierarchy&&(this._transition!==Xft.SPRITE||this._hoverSprite)&&(this._hovered||(this._hovered=!0,this._updateState()))},i._onMouseMoveOut=function(){this._hovered&&(this._hovered=!1,this._updateState())},i._updateState=function(){var t=this._getButtonState();this._applyTransition(t)},i._getButtonState=function(){var t=jft.NORMAL;return this._interactable?this._pressed?t=jft.PRESSED:this._hovered&&(t=jft.HOVER):t=jft.DISABLED,t.toString()},i._updateColorTransition=function(t){var e,i=this[t+"Color"],n=null===(e=this.target)||void 0===e?void 0:e.getComponent(zU);n&&(t===jft.DISABLED?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===jft.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(ji.copy(this._fromScale,this.target.getScale()),ji.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===Xft.COLOR?this._updateColorTransition(t):e===Xft.SPRITE?this._updateSpriteTransition(t):e===Xft.SCALE&&this._updateScaleTransition(t)},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(bc.emitEvents(this.clickEvents,this),this.node.emit(Yft.CLICK,this)),this._pressed=!1,this._updateState())},u(e,[{key:"target",get:function(){return this._target||this.node},set:function(t){this._target!==t&&(this._target&&this._unregisterTargetEvent(this._target),this._target=t,this._applyTarget())}},{key:"interactable",get:function(){return this._interactable},set:function(t){this._interactable!==t&&(this._interactable=t,this._updateState(),this._interactable||this._resetState())}},{key:"_resizeToTarget",set:function(t){t&&this._resizeNodeToTargetNode()}},{key:"transition",get:function(){return this._transition},set:function(t){this._transition!==t&&(this._transition===Xft.COLOR?this._updateColorTransition(jft.NORMAL):this._transition===Xft.SPRITE&&this._updateSpriteTransition(jft.NORMAL),this._transition=t,this._updateState())}},{key:"normalColor",get:function(){return this._normalColor},set:function(t){this._normalColor!==t&&(this._normalColor.set(t),this._updateState())}},{key:"pressedColor",get:function(){return this._pressedColor},set:function(t){this._pressedColor!==t&&this._pressedColor.set(t)}},{key:"hoverColor",get:function(){return this._hoverColor},set:function(t){this._hoverColor!==t&&this._hoverColor.set(t)}},{key:"disabledColor",get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor.set(t),this._updateState())}},{key:"duration",get:function(){return this._duration},set:function(t){this._duration!==t&&(this._duration=t)}},{key:"zoomScale",get:function(){return this._zoomScale},set:function(t){this._zoomScale!==t&&(this._zoomScale=t)}},{key:"normalSprite",get:function(){return this._normalSprite},set:function(t){if(this._normalSprite!==t){this._normalSprite=t;var e=this.node.getComponent(MW);e&&(e.spriteFrame=t),this._updateState()}}},{key:"pressedSprite",get:function(){return this._pressedSprite},set:function(t){this._pressedSprite!==t&&(this._pressedSprite=t,this._updateState())}},{key:"hoverSprite",get:function(){return this._hoverSprite},set:function(t){this._hoverSprite!==t&&(this._hoverSprite=t,this._updateState())}},{key:"disabledSprite",get:function(){return this._disabledSprite},set:function(t){this._disabledSprite!==t&&(this._disabledSprite=t,this._updateState())}}]),e}(Cc),Hft.Transition=Xft,Hft.EventType=Yft,S((Rft=Wft).prototype,"target",[W_t,X_t,j_t],Object.getOwnPropertyDescriptor(Rft.prototype,"target"),Rft.prototype),S(Rft.prototype,"interactable",[Y_t,q_t],Object.getOwnPropertyDescriptor(Rft.prototype,"interactable"),Rft.prototype),S(Rft.prototype,"transition",[K_t,J_t,Z_t],Object.getOwnPropertyDescriptor(Rft.prototype,"transition"),Rft.prototype),S(Rft.prototype,"normalColor",[Q_t,$_t],Object.getOwnPropertyDescriptor(Rft.prototype,"normalColor"),Rft.prototype),S(Rft.prototype,"pressedColor",[tft,eft],Object.getOwnPropertyDescriptor(Rft.prototype,"pressedColor"),Rft.prototype),S(Rft.prototype,"hoverColor",[ift,nft],Object.getOwnPropertyDescriptor(Rft.prototype,"hoverColor"),Rft.prototype),S(Rft.prototype,"disabledColor",[rft,sft],Object.getOwnPropertyDescriptor(Rft.prototype,"disabledColor"),Rft.prototype),S(Rft.prototype,"duration",[aft,oft,hft,uft],Object.getOwnPropertyDescriptor(Rft.prototype,"duration"),Rft.prototype),S(Rft.prototype,"zoomScale",[lft,cft],Object.getOwnPropertyDescriptor(Rft.prototype,"zoomScale"),Rft.prototype),S(Rft.prototype,"normalSprite",[_ft,fft,dft],Object.getOwnPropertyDescriptor(Rft.prototype,"normalSprite"),Rft.prototype),S(Rft.prototype,"pressedSprite",[pft,mft,gft],Object.getOwnPropertyDescriptor(Rft.prototype,"pressedSprite"),Rft.prototype),S(Rft.prototype,"hoverSprite",[yft,vft,Aft],Object.getOwnPropertyDescriptor(Rft.prototype,"hoverSprite"),Rft.prototype),S(Rft.prototype,"disabledSprite",[Sft,bft,Tft],Object.getOwnPropertyDescriptor(Rft.prototype,"disabledSprite"),Rft.prototype),Ift=S(Rft.prototype,"clickEvents",[Eft,Au,Cft,wft],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Bft=S(Rft.prototype,"_interactable",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Dft=S(Rft.prototype,"_transition",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Xft.NONE}}),Pft=S(Rft.prototype,"_normalColor",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ki.WHITE.clone()}}),Mft=S(Rft.prototype,"_hoverColor",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ki(211,211,211,255)}}),Oft=S(Rft.prototype,"_pressedColor",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ki.WHITE.clone()}}),Fft=S(Rft.prototype,"_disabledColor",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new ki(124,124,124,255)}}),Nft=S(Rft.prototype,"_normalSprite",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Lft=S(Rft.prototype,"_hoverSprite",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Vft=S(Rft.prototype,"_pressedSprite",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),kft=S(Rft.prototype,"_disabledSprite",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Gft=S(Rft.prototype,"_duration",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),Uft=S(Rft.prototype,"_zoomScale",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.2}}),zft=S(Rft.prototype,"_target",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),xft=Rft))||xft)||xft)||xft)||xft)||xft)||xft));C.Button=Kft;var Jft,Zft,Qft,$ft=function(){function t(){}return t.add=function(t){var e=this._tabIndexList;-1===e.indexOf(t)&&e.push(t)},t.remove=function(t){var e=this._tabIndexList,i=e.indexOf(t);-1!==i&&e.splice(i,1)},t.resort=function(){this._tabIndexList.sort((function(t,e){return t._delegate.tabIndex-e._delegate.tabIndex}))},t.next=function(t){var e=this._tabIndexList,i=e.indexOf(t);if(t.setFocus(!1),-1!==i){var n=e[i+1];n&&n._delegate.tabIndex>=0&&n.setFocus(!0)}},t}();$ft._tabIndexList=[],function(t){t[t.DEFAULT=0]="DEFAULT",t[t.DONE=1]="DONE",t[t.SEND=2]="SEND",t[t.SEARCH=3]="SEARCH",t[t.GO=4]="GO",t[t.NEXT=5]="NEXT"}(Jft||(Jft={})),_e(Jft),function(t){t[t.ANY=0]="ANY",t[t.EMAIL_ADDR=1]="EMAIL_ADDR",t[t.NUMERIC=2]="NUMERIC",t[t.PHONE_NUMBER=3]="PHONE_NUMBER",t[t.URL=4]="URL",t[t.DECIMAL=5]="DECIMAL",t[t.SINGLE_LINE=6]="SINGLE_LINE"}(Zft||(Zft={})),_e(Zft),function(t){t[t.PASSWORD=0]="PASSWORD",t[t.SENSITIVE=1]="SENSITIVE",t[t.INITIAL_CAPS_WORD=2]="INITIAL_CAPS_WORD",t[t.INITIAL_CAPS_SENTENCE=3]="INITIAL_CAPS_SENTENCE",t[t.INITIAL_CAPS_ALL_CHARACTERS=4]="INITIAL_CAPS_ALL_CHARACTERS",t[t.DEFAULT=5]="DEFAULT"}(Qft||(Qft={})),_e(Qft);var tdt,edt,idt,ndt,rdt,sdt,adt,odt,hdt,udt,ldt,cdt,_dt,fdt,ddt,pdt,mdt,gdt,ydt,vdt,Adt,Sdt,bdt,Tdt,Edt,Cdt,wdt,xdt,Rdt,Idt,Bdt,Ddt,Pdt,Mdt,Odt,Fdt,Ndt,Ldt,Vdt,kdt,Gdt,Udt,zdt,Hdt,Wdt,Xdt,jdt,Ydt,qdt,Kdt,Jdt,Zdt,Qdt,$dt,tpt,ept,ipt,npt,rpt,spt,apt,opt=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.update=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),hpt=new hn,upt=new hn,lpt=new ji,cpt=null,_pt=0,fpt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&Ja.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===pT.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===pT.TAB&&(i.propagationStopped=!0,i.preventDefault(),$ft.next(t))},n.onBlur=function(){Ja.isMobile&&i&&n.compositionEnd(),t._editing=!1,cpt=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(opt);!function(t){t.EDITING_DID_BEGAN="editing-did-began",t.EDITING_DID_ENDED="editing-did-ended",t.TEXT_CHANGED="text-changed",t.EDITING_RETURN="editing-return",t.XR_EDITING_DID_BEGAN="xr-editing-did-began",t.XR_EDITING_DID_ENDED="xr-editing-did-ended"}(apt||(apt={}));var dpt,ppt,mpt,gpt,ypt,vpt,Apt,Spt,bpt,Tpt,Ept,Cpt,wpt,xpt,Rpt,Ipt,Bpt,Dpt,Ppt,Mpt,Opt,Fpt,Npt,Lpt,Vpt,kpt,Gpt,Upt,zpt,Hpt,Wpt,Xpt,jpt,Ypt,qpt,Kpt,Jpt,Zpt,Qpt,$pt,tmt,emt,imt,nmt,rmt,smt,amt,omt,hmt,umt,lmt,cmt,_mt,fmt,dmt,pmt,mmt,gmt,ymt,vmt,Amt,Smt=function(e){return t({EditBox:e,EditBoxComponent:e}),e}((tdt=_u("cc.EditBox"),edt=Bu(),idt=du(110),ndt=wu(),rdt=fu(CG),sdt=Uu(),adt=Fu(),odt=Uu(),hdt=Fu(),udt=qu(HU),ldt=Uu(),cdt=Fu(),_dt=qu(HU),fdt=Uu(),ddt=Fu(),pdt=qu(lV),mdt=Uu(),gdt=Fu(),ydt=qu(Qft),vdt=Uu(),Adt=Fu(),Sdt=qu(Zft),bdt=Uu(),Tdt=Fu(),Edt=qu(Jft),Cdt=Uu(),wdt=Fu(),xdt=Uu(),Rdt=Fu(),Idt=Uu(),Bdt=Fu(),Ddt=qu([bc]),Pdt=Uu(),Mdt=Fu(),Odt=qu([bc]),Fdt=Uu(),Ndt=Fu(),Ldt=qu([bc]),Vdt=Uu(),kdt=Fu(),Gdt=qu([bc]),Udt=Uu(),zdt=Fu(),tdt(Hdt=edt(Hdt=idt(Hdt=ndt(Hdt=rdt(Hdt=Cu((spt=rpt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(Cc),rpt._EditBoxImpl=opt,rpt.KeyboardReturnType=Jft,rpt.InputFlag=Qft,rpt.InputMode=Zft,rpt.EventType=apt,S((Wdt=spt).prototype,"string",[sdt,adt],Object.getOwnPropertyDescriptor(Wdt.prototype,"string"),Wdt.prototype),S(Wdt.prototype,"placeholder",[odt,hdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"placeholder"),Wdt.prototype),S(Wdt.prototype,"textLabel",[udt,ldt,cdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"textLabel"),Wdt.prototype),S(Wdt.prototype,"placeholderLabel",[_dt,fdt,ddt],Object.getOwnPropertyDescriptor(Wdt.prototype,"placeholderLabel"),Wdt.prototype),S(Wdt.prototype,"backgroundImage",[pdt,mdt,gdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"backgroundImage"),Wdt.prototype),S(Wdt.prototype,"inputFlag",[ydt,vdt,Adt],Object.getOwnPropertyDescriptor(Wdt.prototype,"inputFlag"),Wdt.prototype),S(Wdt.prototype,"inputMode",[Sdt,bdt,Tdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"inputMode"),Wdt.prototype),S(Wdt.prototype,"returnType",[Edt,Cdt,wdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"returnType"),Wdt.prototype),S(Wdt.prototype,"maxLength",[xdt,Rdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"maxLength"),Wdt.prototype),S(Wdt.prototype,"tabIndex",[Idt,Bdt],Object.getOwnPropertyDescriptor(Wdt.prototype,"tabIndex"),Wdt.prototype),Xdt=S(Wdt.prototype,"editingDidBegan",[Ddt,Au,Pdt,Mdt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),jdt=S(Wdt.prototype,"textChanged",[Odt,Au,Fdt,Ndt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ydt=S(Wdt.prototype,"editingDidEnded",[Ldt,Au,Vdt,kdt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qdt=S(Wdt.prototype,"editingReturn",[Gdt,Au,Udt,zdt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Kdt=S(Wdt.prototype,"_textLabel",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Jdt=S(Wdt.prototype,"_placeholderLabel",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Zdt=S(Wdt.prototype,"_returnType",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jft.DEFAULT}}),Qdt=S(Wdt.prototype,"_string",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),$dt=S(Wdt.prototype,"_tabIndex",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),tpt=S(Wdt.prototype,"_backgroundImage",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ept=S(Wdt.prototype,"_inputFlag",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qft.DEFAULT}}),ipt=S(Wdt.prototype,"_inputMode",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zft.ANY}}),npt=S(Wdt.prototype,"_maxLength",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 20}}),Hdt=Wdt))||Hdt)||Hdt)||Hdt)||Hdt)||Hdt)||Hdt));"object"==typeof window&&"object"==typeof document&&(Smt._EditBoxImpl=fpt),C.internal.EditBox=Smt,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(pmt||(pmt={})),pe(pmt),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(mmt||(mmt={})),pe(mmt),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(gmt||(gmt={})),pe(gmt),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(ymt||(ymt={})),pe(ymt),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(vmt||(vmt={})),pe(vmt),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(Amt||(Amt={})),pe(Amt);var bmt,Tmt,Emt,Cmt,wmt,xmt,Rmt,Imt,Bmt,Dmt,Pmt,Mmt,Omt,Fmt,Nmt,Lmt,Vmt,kmt,Gmt,Umt,zmt,Hmt,Wmt,Xmt=new ji,jmt=function(e){return t({Layout:e,LayoutComponent:e}),e}((dpt=_u("cc.Layout"),ppt=Bu(),mpt=du(110),gpt=wu(),ypt=fu(CG),vpt=Pu(),Apt=Fu(),Spt=Pu(),bpt=Fu(),Tpt=qu(pmt),Ept=Uu(),Cpt=Fu(),wpt=qu(mmt),xpt=Pu(),Rpt=Fu(),Ipt=Pu(),Bpt=Fu(),Dpt=qu(gmt),Ppt=Fu(),Mpt=Fu(),Opt=Fu(),Fpt=Fu(),Npt=Fu(),Lpt=Fu(),Vpt=Fu(),kpt=qu(ymt),Gpt=Fu(),Upt=qu(vmt),zpt=Fu(),Hpt=qu(Amt),Wpt=Pu(),Xpt=Fu(),jpt=Pu(),Ypt=Fu(),qpt=Fu(),dpt(Kpt=ppt(Kpt=mpt(Kpt=gpt(Kpt=ypt(Kpt=Cu((dmt=fmt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._uiProps.uiTransformComp;t.contentSize.equals(gn.ZERO)&&t.setContentSize(this._layoutSize),this._childrenChanged()},i.onDisable=function(){this._usefulLayoutObj.length=0,this._removeEventListeners()},i._checkUsefulObj=function(){this._usefulLayoutObj.length=0;for(var t=this.node.children,e=0;e_&&(f=Math.max(_,f),c=_||x,_=x),u+=a*(C*w+this._spacingX);var R=a*(1-C)*w;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(c=_>x?_:c);else if(w>t-g)u>h+a*C*w&&(d=!0);else{var I=(1-this._horizontalDirection-r.x)*t,B=u+R+a*(a>0?this._paddingRight:this._paddingLeft);d=Math.abs(B)>Math.abs(I)}d&&(u=h+a*C*w,x!==_&&(c=_),l+=c+this._spacingY,c=_=x)}var D=i(S,A,l);n&&S.setPosition(u,D),u+=R}return c=Math.max(c,_),Math.max(f,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===ymt.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var h=(this._verticalDirection-r.y)*t+a*o,u=h-a*this._spacingY,l=0,c=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==pmt.GRID&&this._resizeMode===mmt.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var y=this._usefulLayoutObj,v=0;vl&&(c=Math.max(l,c),_=l||w,l=w),u+=a*(C*x+this._spacingY);var R=a*(1-C)*x;if(e){if(s>0)(d=v/s>0&&v%s==0)&&(_=l>x?l:_);else if(x>t-g)u>h+a*C*x&&(d=!0);else{var I=(1-this._verticalDirection-r.y)*t,B=u+R+a*(a>0?this._paddingTop:this._paddingBottom);d=Math.abs(B)>Math.abs(I)}d&&(u=h+a*C*x,w!==l&&(_=l),f+=_+this._spacingX,_=l=w)}var D=i(S,A,f);n&&(S.getPosition(Xmt),S.setPosition(D,u,Xmt.z)),u+=R}return _=Math.max(_,l),Math.max(c,f+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===ymt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},h=0;this._resizeMode===mmt.CONTAINER&&(h=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*h,this._verticalDirection===ymt.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*h)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===mmt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,h)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===vmt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},h=0;this._resizeMode===mmt.CONTAINER&&(h=this._doLayoutVertically(n,!0,o,!1),s=-t.x*h,this._horizontalDirection===vmt.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*h)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===mmt.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(h,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===gmt.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===gmt.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===mmt.CONTAINER){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var h=0;o&&(h=vi(h=r/o));var u=(n-a)*h;this._direction===ygt.VERTICAL?t.set(0,u):t.set(u,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===bgt.x&&n.y===bgt.y||e.setAnchorPoint(bgt),this._direction===ygt.HORIZONTAL?e.setContentSize(t,i.height):e.setContentSize(i.width,t)}},i._processAutoHide=function(t){if(this._enableAutoHide&&!(this._autoHideRemainingTime<=0)&&!this._touching&&(this._autoHideRemainingTime-=t,this._autoHideRemainingTime<=this._autoHideTime)){this._autoHideRemainingTime=Math.max(0,this._autoHideRemainingTime);var e=this._opacity*(this._autoHideRemainingTime/this._autoHideTime);this._setOpacity(e)}},u(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(_n.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(_n.ZERO))}},{key:"enableAutoHide",get:function(){return this._enableAutoHide},set:function(t){this._enableAutoHide!==t&&(this._enableAutoHide=t,this._enableAutoHide&&this._setOpacity(0))}},{key:"autoHideTime",get:function(){return this._autoHideTime},set:function(t){this._autoHideTime!==t&&(this._autoHideTime=t)}}]),e}(Cc),pgt.Direction=ygt,S((ugt=mgt).prototype,"handle",[Qmt,$mt,tgt],Object.getOwnPropertyDescriptor(ugt.prototype,"handle"),ugt.prototype),S(ugt.prototype,"direction",[egt,igt,ngt],Object.getOwnPropertyDescriptor(ugt.prototype,"direction"),ugt.prototype),S(ugt.prototype,"enableAutoHide",[rgt,sgt],Object.getOwnPropertyDescriptor(ugt.prototype,"enableAutoHide"),ugt.prototype),S(ugt.prototype,"autoHideTime",[agt,ogt],Object.getOwnPropertyDescriptor(ugt.prototype,"autoHideTime"),ugt.prototype),lgt=S(ugt.prototype,"_scrollView",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cgt=S(ugt.prototype,"_handle",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),_gt=S(ugt.prototype,"_direction",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ygt.HORIZONTAL}}),fgt=S(ugt.prototype,"_enableAutoHide",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),dgt=S(ugt.prototype,"_autoHideTime",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),hgt=ugt))||hgt)||hgt)||hgt)||hgt)||hgt));C.ScrollBar=wgt;var xgt,Rgt,Igt,Bgt,Dgt,Pgt,Mgt,Ogt,Fgt,Ngt,Lgt,Vgt,kgt,Ggt,Ugt,zgt,Hgt,Wgt,Xgt,jgt,Ygt,qgt,Kgt,Jgt,Zgt,Qgt,$gt,tyt,eyt,iyt,nyt,ryt,syt,ayt,oyt,hyt,uyt,lyt,cyt,_yt,fyt,dyt,pyt,myt,gyt,yyt,vyt,Ayt,Syt=t("ViewGroup",_u("cc.ViewGroup")(Cgt=du(110)(Cgt=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Cc))||Cgt)||Cgt);C.ViewGroup=Syt;var byt,Tyt,Eyt=1e-4,Cyt=new ji,wyt=new ji,xyt=new _n,Ryt=new _n,Iyt=function(){return(new Date).getMilliseconds()},Byt={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(byt||(byt={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(Tyt||(Tyt={}));var Dyt,Pyt,Myt,Oyt,Fyt,Nyt,Lyt,Vyt,kyt,Gyt,Uyt,zyt,Hyt,Wyt,Xyt,jyt,Yyt,qyt,Kyt,Jyt,Zyt,Qyt=function(e){return t({ScrollView:e,ScrollViewComponent:e}),e}((xgt=_u("cc.ScrollView"),Rgt=Bu(),Igt=du(110),Bgt=wu(),Dgt=fu(CG),Pgt=Nu(),Mgt=Uu(),Ogt=Fu(),Fgt=Nu(),Ngt=Uu(),Lgt=Fu(),Vgt=Uu(),kgt=Fu(),Ggt=Uu(),Ugt=Fu(),zgt=qu(YA),Hgt=Uu(),Wgt=Fu(),Xgt=Uu(),jgt=Fu(),Ygt=qu(wgt),qgt=Uu(),Kgt=Fu(),Jgt=Uu(),Zgt=Fu(),Qgt=qu(wgt),$gt=Uu(),tyt=Fu(),eyt=Uu(),iyt=Fu(),nyt=qu([bc]),ryt=Uu(),syt=Fu(),xgt(ayt=Rgt(ayt=Igt(ayt=Bgt(ayt=Dgt((Ayt=vyt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(t,0),applyToHorizontal:!0,applyToVertical:!1});e?this._startAutoScroll(n,e,!1!==i):this._moveContent(n)},i.scrollTo=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(t),applyToHorizontal:!0,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.scrollToPercentVertical=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(0,t),applyToHorizontal:!1,applyToVertical:!0});e?this._startAutoScroll(n,e,i):this._moveContent(n)},i.stopAutoScroll=function(){this._autoScrolling=!1,this._autoScrollAccumulatedTime=this._autoScrollTotalTime},i.setContentPosition=function(t){this._setContentPosition(t)},i._setContentPosition=function(t){if(this._content){var e=this._getContentPosition();Math.abs(t.x-e.x)7&&!this._touchMoved&&t.target!==this.node){var r=new dT(t.getTouches(),t.bubbles,oT.TOUCH_CANCEL);r.touch=t.touch,r.simulate=!0,t.target.dispatchEvent(r),this._touchMoved=!0}this._stopPropagationIfTargetIsMe(t)}}},i._onTouchEnded=function(t,e){if(this.enabledInHierarchy&&this._content&&t&&!this._hasNestedViewGroup(t,e)){this._dispatchEvent(byt.TOUCH_UP);var i=t.touch;this._handleReleaseLogic(i),this._touchMoved?t.propagationStopped=!0:this._stopPropagationIfTargetIsMe(t)}},i._onTouchCancelled=function(t,e){if(this.enabledInHierarchy&&this._content&&!this._hasNestedViewGroup(t,e)){if(t&&!t.simulate){var i=t.touch;this._handleReleaseLogic(i)}this._stopPropagationIfTargetIsMe(t)}},i._calculateBoundary=function(){if(this._content&&this.view){var t=this._content.getComponent(jmt);t&&t.enabledInHierarchy&&t.updateLayout();var e=this.view,i=e.width*e.anchorX,n=e.height*e.anchorY;this._leftBoundary=-i,this._bottomBoundary=-n,this._rightBoundary=this._leftBoundary+e.width,this._topBoundary=this._bottomBoundary+e.height,this._moveContentToTopLeft(e.contentSize)}},i._hasNestedViewGroup=function(t,e){if(!t||t.eventPhase!==uT.CAPTURING_PHASE)return!1;if(e)for(var i,n=v(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(Syt));if(r.getComponent(Syt))return!0}return!1},i._startInertiaScroll=function(t){var e=new ji(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),h=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*h*(1-this.brake),i.z=0}var u=t.length(),l=i.length()/u;if(i.add(t),this.brake>0&&l>7){l=Math.sqrt(l);var c=t.clone();c.multiplyScalar(l),i.set(c),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(_*=l=3),0===this.brake&&l>1&&(_*=l),this._startAutoScroll(i,_,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,ji.copy(this._autoScrollStartPosition,this._getContentPosition()),this._autoScrollTotalTime=e,this._autoScrollAccumulatedTime=0,this._autoScrollBraking=!1,this._isScrollEndedWithThresholdEventFired=!1,this._autoScrollBrakingStartPosition.set(0,0,0),this._getHowMuchOutOfBoundary().equals(ji.ZERO,Eyt)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new ji,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(ji.ZERO);else{var i=new ji;i=this._touchMoveDisplacements.reduce((function(t,e){return t.add(e),t}),i),t.set(i.x*(1-this.brake)/e,i.y*(1-this.brake)/e,i.z)}return t},i._flattenVectorByDirection=function(t){var e=t;return e.x=this.horizontal?e.x:0,e.y=this.vertical?e.y:0,e},i._moveContent=function(t,e){var i=this._flattenVectorByDirection(t);Cyt.set(this._getContentPosition()),Cyt.add(i),Cyt.set(Math.round(1e4*Cyt.x)*Eyt,Math.round(1e4*Cyt.y)*Eyt,Cyt.z),this._setContentPosition(Cyt);var n=this._getHowMuchOutOfBoundary();xyt.set(n.x,n.y),this._updateScrollBar(xyt),this.elastic&&e&&this._startBounceBackIfNeeded()},i._getContentLeftBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.x-e.anchorX*e.width},i._getContentRightBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentLeftBoundary()+t.width},i._getContentTopBoundary=function(){if(!this._content)return-1;var t=this._content._uiProps.uiTransformComp;return this._getContentBottomBoundary()+t.height},i._getContentBottomBoundary=function(){if(!this._content)return-1;var t=this._getContentPosition(),e=this._content._uiProps.uiTransformComp;return t.y-e.anchorY*e.height},i._getHowMuchOutOfBoundary=function(t){if((t=t||new ji).equals(ji.ZERO,Eyt)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new ji,i=this._getContentLeftBoundary(),n=this._getContentRightBoundary();i+t.x>this._leftBoundary?e.x=this._leftBoundary-(i+t.x):n+t.xthis._bottomBoundary&&(e.y=this._bottomBoundary-(s+t.y)),t.equals(ji.ZERO,Eyt)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.onScroll(t),this.verticalScrollBar&&this.verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchBegan(),this.verticalScrollBar&&this.verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchEnded(),this.verticalScrollBar&&this.verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===byt.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===byt.SCROLL_TO_TOP||t===byt.SCROLL_TO_BOTTOM||t===byt.SCROLL_TO_LEFT||t===byt.SCROLL_TO_RIGHT){var e=1<0?l.y-o*u+i.y>=this._bottomBoundary&&(n=byt.SCROLL_TO_BOTTOM):i.y<0&&l.y-o*u+u+i.y<=this._topBoundary&&(n=byt.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-a*h+h+i.x<=this._rightBoundary&&(r=byt.SCROLL_TO_RIGHT):i.x>0&&l.x-a*h+i.x>=this._leftBoundary&&(r=byt.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(byt.SCROLL_BEGAN)),this._dispatchEvent(byt.SCROLLING)),""!==n&&this._dispatchEvent(n),""!==r&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(byt.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=Iyt(),this._touchMoveDisplacements.length=0,this._touchMoveTimeDeltas.length=0,this._onScrollBarTouchBegan()},i._clampDelta=function(t){if(this._content&&this.view){var e=this.view.contentSize,i=this._content._uiProps.uiTransformComp;i.width=5;)this._touchMoveDisplacements.shift(),this._touchMoveTimeDeltas.shift();this._touchMoveDisplacements.push(e);var i=Iyt();this._touchMoveTimeDeltas.push((i-this._touchMovePreviousTimestamp)/1e3),this._touchMovePreviousTimestamp=i},i._startBounceBackIfNeeded=function(){if(!this.elastic)return!1;var t=this._getHowMuchOutOfBoundary();if(this._clampDelta(t),t.equals(ji.ZERO,Eyt))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(byt.BOUNCE_TOP),t.y<0&&this._dispatchEvent(byt.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(byt.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(byt.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(Cyt,Eyt)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(ji.ZERO,Eyt)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,ji.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var a=this._autoScrollStartPosition.clone();a.add(s);var o=Math.abs(r-1)<=Eyt;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(byt.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var h=a.clone();h.subtract(this._autoScrollBrakingStartPosition),e&&h.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(h)}else{var u=a.clone();u.subtract(this.getContentPosition());var l=this._getHowMuchOutOfBoundary(u);l.equals(ji.ZERO,Eyt)||(a.add(l),o=!0)}o&&(this._autoScrolling=!1);var c=a.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,o),this._dispatchEvent(byt.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(byt.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(ji.ZERO,Eyt))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(byt.SCROLL_ENDED),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(byt.SCROLL_ENDED),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(_n.ZERO,_n.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new ji;if(this._content&&this.view){var o=0,h=this._content._uiProps.uiTransformComp.contentSize,u=this.view.contentSize;i&&(o=h.width-u.width,a.x=s-o*e.x),n&&(o=h.height-u.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new ji,n=0,r=this._getContentLeftBoundary()-this._leftBoundary;if(r=-r,this._content){var s=this._content._uiProps.uiTransformComp.contentSize;s.height1)for(var n=i[0],r=0;r0){var i=this.node.parent&&this.node.parent._uiProps,n=i&&i.uiTransformComp,r=n?n.contentSize:FN;this.isAlignLeft&&t===IAt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===IAt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===IAt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===IAt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===IAt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===IAt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(CG)&&(t.on(oA.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(oA.SIZE_CHANGED,this._setDirtyByMode,this),t.on(oA.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(oA.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(oA.SIZE_CHANGED,this._setDirtyByMode,this),t.off(oA.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(oA.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(oA.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===RAt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&$At)>0,n=this.node._uiProps.uiTransformComp;e?(this._alignFlags|=t,i?(this.isAlignHorizontalCenter=!1,this.isStretchWidth&&(this._originalWidth=n.width)):(this.isAlignVerticalCenter=!1,this.isStretchHeight&&(this._originalHeight=n.height))):(i?this.isStretchWidth&&(n.width=this._originalWidth):this.isStretchHeight&&(n.height=this._originalHeight),this._alignFlags&=~t)}},i._recursiveDirty=function(){this._dirty||(this._dirty=!0)},u(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._unregisterTargetEvents(),this._target=t,this._registerTargetEvents(),this._validateTargetInDEV(),this._recursiveDirty())}},{key:"isAlignTop",get:function(){return(this._alignFlags&IAt.TOP)>0},set:function(t){this._setAlign(IAt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&IAt.BOT)>0},set:function(t){this._setAlign(IAt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&IAt.LEFT)>0},set:function(t){this._setAlign(IAt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&IAt.RIGHT)>0},set:function(t){this._setAlign(IAt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&IAt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=IAt.MID):this._alignFlags&=~IAt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&IAt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=IAt.CENTER):this._alignFlags&=~IAt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&$At)===$At}},{key:"isStretchHeight",get:function(){return(this._alignFlags&QAt)===QAt}},{key:"top",get:function(){return this._top},set:function(t){this._top=t,this._recursiveDirty()}},{key:"editorTop",get:function(){return this._isAbsTop?this._top:100*this._top},set:function(t){this._top=this._isAbsTop?t:t/100,this._recursiveDirty()}},{key:"bottom",get:function(){return this._bottom},set:function(t){this._bottom=t,this._recursiveDirty()}},{key:"editorBottom",get:function(){return this._isAbsBottom?this._bottom:100*this._bottom},set:function(t){this._bottom=this._isAbsBottom?t:t/100,this._recursiveDirty()}},{key:"left",get:function(){return this._left},set:function(t){this._left=t,this._recursiveDirty()}},{key:"editorLeft",get:function(){return this._isAbsLeft?this._left:100*this._left},set:function(t){this._left=this._isAbsLeft?t:t/100,this._recursiveDirty()}},{key:"right",get:function(){return this._right},set:function(t){this._right=t,this._recursiveDirty()}},{key:"editorRight",get:function(){return this._isAbsRight?this._right:100*this._right},set:function(t){this._right=this._isAbsRight?t:t/100,this._recursiveDirty()}},{key:"horizontalCenter",get:function(){return this._horizontalCenter},set:function(t){this._horizontalCenter=t,this._recursiveDirty()}},{key:"editorHorizontalCenter",get:function(){return this._isAbsHorizontalCenter?this._horizontalCenter:100*this._horizontalCenter},set:function(t){this._horizontalCenter=this._isAbsHorizontalCenter?t:t/100,this._recursiveDirty()}},{key:"verticalCenter",get:function(){return this._verticalCenter},set:function(t){this._verticalCenter=t,this._recursiveDirty()}},{key:"editorVerticalCenter",get:function(){return this._isAbsVerticalCenter?this._verticalCenter:100*this._verticalCenter},set:function(t){this._verticalCenter=this._isAbsVerticalCenter?t:t/100,this._recursiveDirty()}},{key:"isAbsoluteTop",get:function(){return this._isAbsTop},set:function(t){this._isAbsTop!==t&&(this._isAbsTop=t,this._autoChangedValue(IAt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(IAt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(IAt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(IAt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(IAt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(IAt.MID,this._isAbsVerticalCenter))}},{key:"alignMode",get:function(){return this._alignMode},set:function(t){this._alignMode=t,this._recursiveDirty()}},{key:"alignFlags",get:function(){return this._alignFlags},set:function(t){this._alignFlags!==t&&(this._alignFlags=t,this._recursiveDirty())}}]),e}(Cc),CAt.AlignMode=RAt,S((aAt=wAt).prototype,"target",[Uvt,zvt],Object.getOwnPropertyDescriptor(aAt.prototype,"target"),aAt.prototype),S(aAt.prototype,"isAlignTop",[Hvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isAlignTop"),aAt.prototype),S(aAt.prototype,"isAlignBottom",[Wvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isAlignBottom"),aAt.prototype),S(aAt.prototype,"isAlignLeft",[Xvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isAlignLeft"),aAt.prototype),S(aAt.prototype,"isAlignRight",[jvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isAlignRight"),aAt.prototype),S(aAt.prototype,"isAlignVerticalCenter",[Yvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isAlignVerticalCenter"),aAt.prototype),S(aAt.prototype,"isAlignHorizontalCenter",[qvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isAlignHorizontalCenter"),aAt.prototype),S(aAt.prototype,"isStretchWidth",[Kvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isStretchWidth"),aAt.prototype),S(aAt.prototype,"isStretchHeight",[Jvt],Object.getOwnPropertyDescriptor(aAt.prototype,"isStretchHeight"),aAt.prototype),S(aAt.prototype,"top",[Zvt],Object.getOwnPropertyDescriptor(aAt.prototype,"top"),aAt.prototype),S(aAt.prototype,"editorTop",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"editorTop"),aAt.prototype),S(aAt.prototype,"bottom",[Qvt],Object.getOwnPropertyDescriptor(aAt.prototype,"bottom"),aAt.prototype),S(aAt.prototype,"editorBottom",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"editorBottom"),aAt.prototype),S(aAt.prototype,"left",[$vt],Object.getOwnPropertyDescriptor(aAt.prototype,"left"),aAt.prototype),S(aAt.prototype,"editorLeft",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"editorLeft"),aAt.prototype),S(aAt.prototype,"right",[tAt],Object.getOwnPropertyDescriptor(aAt.prototype,"right"),aAt.prototype),S(aAt.prototype,"editorRight",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"editorRight"),aAt.prototype),S(aAt.prototype,"horizontalCenter",[eAt],Object.getOwnPropertyDescriptor(aAt.prototype,"horizontalCenter"),aAt.prototype),S(aAt.prototype,"editorHorizontalCenter",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"editorHorizontalCenter"),aAt.prototype),S(aAt.prototype,"verticalCenter",[iAt],Object.getOwnPropertyDescriptor(aAt.prototype,"verticalCenter"),aAt.prototype),S(aAt.prototype,"editorVerticalCenter",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"editorVerticalCenter"),aAt.prototype),S(aAt.prototype,"isAbsoluteTop",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"isAbsoluteTop"),aAt.prototype),S(aAt.prototype,"isAbsoluteBottom",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"isAbsoluteBottom"),aAt.prototype),S(aAt.prototype,"isAbsoluteLeft",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"isAbsoluteLeft"),aAt.prototype),S(aAt.prototype,"isAbsoluteRight",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"isAbsoluteRight"),aAt.prototype),S(aAt.prototype,"isAbsoluteHorizontalCenter",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"isAbsoluteHorizontalCenter"),aAt.prototype),S(aAt.prototype,"isAbsoluteVerticalCenter",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"isAbsoluteVerticalCenter"),aAt.prototype),S(aAt.prototype,"alignMode",[nAt,rAt],Object.getOwnPropertyDescriptor(aAt.prototype,"alignMode"),aAt.prototype),S(aAt.prototype,"alignFlags",[Du],Object.getOwnPropertyDescriptor(aAt.prototype,"alignFlags"),aAt.prototype),oAt=S(aAt.prototype,"_alignFlags",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),hAt=S(aAt.prototype,"_target",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),uAt=S(aAt.prototype,"_left",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),lAt=S(aAt.prototype,"_right",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),cAt=S(aAt.prototype,"_top",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),_At=S(aAt.prototype,"_bottom",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fAt=S(aAt.prototype,"_horizontalCenter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),dAt=S(aAt.prototype,"_verticalCenter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),pAt=S(aAt.prototype,"_isAbsLeft",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),mAt=S(aAt.prototype,"_isAbsRight",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),gAt=S(aAt.prototype,"_isAbsTop",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),yAt=S(aAt.prototype,"_isAbsBottom",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),vAt=S(aAt.prototype,"_isAbsHorizontalCenter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),AAt=S(aAt.prototype,"_isAbsVerticalCenter",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),SAt=S(aAt.prototype,"_originalWidth",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),bAt=S(aAt.prototype,"_originalHeight",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),TAt=S(aAt.prototype,"_alignMode",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return RAt.ON_WINDOW_RESIZE}}),EAt=S(aAt.prototype,"_lockFlags",[Au,bu],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),sAt=aAt))||sAt)||sAt)||sAt)||sAt)||sAt)||sAt));C.internal.computeInverseTransForTarget=PAt,C.internal.getReadonlyNodeSize=DAt,C.Widget=tSt;var eSt,iSt=new ki;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(eSt||(eSt={})),pe(eSt);var nSt,rSt,sSt,aSt,oSt,hSt,uSt,lSt,cSt,_St,fSt,dSt,pSt,mSt,gSt,ySt,vSt,ASt,SSt,bSt,TSt,ESt,CSt,wSt,xSt,RSt,ISt,BSt,DSt,PSt,MSt,OSt,FSt,NSt,LSt,VSt,kSt,GSt,USt,zSt,HSt,WSt,XSt,jSt=function(e){return t({PageViewIndicator:e,PageViewIndicatorComponent:e}),e}((MAt=_u("cc.PageViewIndicator"),OAt=Bu(),FAt=du(110),NAt=wu(),LAt=qu(lV),VAt=Fu(),kAt=qu(eSt),GAt=Fu(),UAt=qu(gn),zAt=Fu(),HAt=Fu(),MAt(WAt=OAt(WAt=FAt(WAt=NAt((ZAt=JAt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},u(e,[{key:"spriteFrame",get:function(){return this._spriteFrame},set:function(t){this._spriteFrame!==t&&(this._spriteFrame=t)}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t)}},{key:"cellSize",get:function(){return this._cellSize},set:function(t){this._cellSize!==t&&(this._cellSize=t)}}]),e}(Cc),JAt.Direction=eSt,S((XAt=ZAt).prototype,"spriteFrame",[LAt,VAt],Object.getOwnPropertyDescriptor(XAt.prototype,"spriteFrame"),XAt.prototype),S(XAt.prototype,"direction",[kAt,GAt],Object.getOwnPropertyDescriptor(XAt.prototype,"direction"),XAt.prototype),S(XAt.prototype,"cellSize",[UAt,zAt],Object.getOwnPropertyDescriptor(XAt.prototype,"cellSize"),XAt.prototype),jAt=S(XAt.prototype,"spacing",[Au,HAt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),YAt=S(XAt.prototype,"_spriteFrame",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),qAt=S(XAt.prototype,"_direction",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return eSt.HORIZONTAL}}),KAt=S(XAt.prototype,"_cellSize",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(20,20)}}),WAt=XAt))||WAt)||WAt)||WAt)||WAt));C.PageViewIndicator=jSt;var YSt,qSt,KSt,JSt=new _n;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(YSt||(YSt={})),pe(YSt),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(qSt||(qSt={})),pe(qSt),function(t){t.PAGE_TURNING="page-turning"}(KSt||(KSt={}));var ZSt=function(e){return t({PageView:e,PageViewComponent:e}),e}((nSt=_u("cc.PageView"),rSt=Bu(),sSt=du(110),aSt=wu(),oSt=qu(YSt),hSt=Fu(),uSt=qu(qSt),lSt=Fu(),cSt=Nu(),_St=Fu(),fSt=Nu(),dSt=Fu(),pSt=qu(jSt),mSt=Fu(),gSt=Fu(),ySt=qu(wgt),vSt=Pu(),ASt=qu(wgt),SSt=Pu(),bSt=Pu(),TSt=Pu(),ESt=Pu(),CSt=qu([bc]),wSt=Pu(),xSt=Fu(),RSt=qu([bc]),ISt=Fu(),nSt(BSt=rSt(BSt=sSt(BSt=aSt((XSt=WSt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void W(4301);this._pages.splice(e,0,t),this.content.insertChild(t,e),this._updatePageView()}},i.removePage=function(t){if(t&&this.content){var e=this._pages.indexOf(t);-1!==e?this.removePageAtIndex(e):j(4300,t.name)}},i.removePageAtIndex=function(t){var e=this._pages;if(!(t<0||t>=e.length)){var i=e[t];i&&this.content&&(this.content.removeChild(i),e.splice(t,1),this._updatePageView())}},i.removeAllPages=function(){if(this.content){for(var t=this._pages,e=0,i=t.length;e=this._pages.length||(this._curPageIdx=t,this.scrollToOffset(this._moveOffsetValue(t),e,!0),this.indicator&&this.indicator._changedState())},i.getScrollEndedEventTiming=function(){return this.pageTurningEventTiming},i._updatePageView=function(){if(this.content){var t=this.content.getComponent(jmt);t&&t.enabled&&t.updateLayout();var e=this._pages.length;this._curPageIdx>=e&&(this._curPageIdx=0===e?0:e-1,this._lastPageIdx=this._curPageIdx);for(var i=this._initContentPos,n=0;n0){var i=this._pages[0]._uiProps.uiTransformComp,n=this._pages[this._pages.length-1]._uiProps.uiTransformComp;this.direction===qSt.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===qSt.Vertical&&(e.paddingTop=(t.height-i.height)/2,e.paddingBottom=(t.height-n.height)/2)}e.updateLayout()}}},i._initPages=function(){if(this.content){this._initContentPos=this.content.position;for(var t=this.content.children,e=0;e=0||this._pages.push(i)}this._syncScrollDirection(),this._syncSizeMode(),this._updatePageView()}},i._dispatchPageTurningEvent=function(){this._lastPageIdx!==this._curPageIdx&&(this._lastPageIdx=this._curPageIdx,bc.emitEvents(this.pageEvents,this,KSt.PAGE_TURNING),this.node.emit(KSt.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===qSt.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===qSt.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new _n;if(this._sizeMode===YSt.Free)this.direction===qSt.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===qSt.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===qSt.Horizontal?e.x=t*i.width:this.direction===qSt.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===qSt.Horizontal?0===t.x?0:t.x>0?1:-1:0===t.y?0:t.y<0?1:-1},i._isScrollable=function(t,e,i){if(this._sizeMode===YSt.Free){var n=0,r=0;if(this.direction===qSt.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===qSt.Vertical)return n=this._scrollCenterOffsetY[e],r=this._scrollCenterOffsetY[i],Math.abs(t.y)>=Math.abs(n-r)*this.scrollThreshold}else{var s=this.view;if(!s)return!1;if(this.direction===qSt.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===qSt.Vertical)return Math.abs(t.y)>=s.height*this.scrollThreshold}return!1},i._autoScrollToPage=function(){if(this._startBounceBackIfNeeded()){var t=this._getHowMuchOutOfBoundary();this._clampDelta(t),(t.x>0||t.y<0)&&(this._curPageIdx=0===this._pages.length?0:this._pages.length-1),(t.x<0||t.y>0)&&(this._curPageIdx=0),this.indicator&&this.indicator._changedState()}else{var e=new _n;_n.subtract(e,this._touchBeganPosition,this._touchEndPosition);var i=this._curPageIdx,n=i+this._getDragDirection(e),r=this.pageTurningSpeed*Math.abs(i-n);if(n1e-10?e:t}var n=t.node,r=n.parent;if(r){var s=ibt;s.set(0,0);var a=nbt;if(a.set(1,1),t.target&&PAt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,h=o?o.anchorPoint:$St,u=n._uiProps.uiTransformComp,l=DAt(r),c=u.anchorPoint,_=n.getPosition(),f=IAt,d=n.getScale(),p=0;if(e&f.LEFT){var m=-h.x*l.width;m+=s.x,m*=a.x,p=_.x-c.x*u.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&f.RIGHT){var g=(1-h.x)*l.width;g+=s.x,p=(g*=a.x)-(_.x+(1-c.x)*u.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&f.TOP){var y=(1-h.y)*l.height;y+=s.y,p=(y*=a.y)-(_.y+(1-c.y)*u.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&f.BOT){var v=-h.y*l.height;v+=s.y,v*=a.y,p=_.y-c.y*u.height*Math.abs(d.y)-v,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&YA.isNode(i)&&t(i);var n=e.getComponent(tSt);n&&i&&rbt(e,n)},AlignMode:RAt,AlignFlags:IAt});BN.on(IN.EVENT_INIT,(function(){ubt.init()}));var lbt,cbt,_bt,fbt,dbt,pbt,mbt,gbt,ybt,vbt,Abt,Sbt,bbt,Tbt,Ebt,Cbt,wbt,xbt,Rbt,Ibt=function(e){return t({SafeArea:e,SafeAreaComponent:e}),e}(_u("cc.SafeArea")(obt=Bu()(obt=du(110)(obt=Cu(obt=wu()(obt=fu(tSt)(obt=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),Xa.on("window-resize",this.updateArea,this),Xa.on("orientation-change",this.updateArea,this)},i.onDisable=function(){Xa.off("window-resize",this.updateArea,this),Xa.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(tSt),e=this.node.getComponent(CG);if(t&&e){t.updateAlignment();var i=this.node.position.clone(),n=e.anchorPoint.clone();t.isAlignTop=t.isAlignBottom=t.isAlignLeft=t.isAlignRight=!0;var r=zN.getVisibleSize(),s=r.width,a=r.height,o=Ja.getSafeAreaRect();t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var h=this.node.position.clone(),u=n.x-(h.x-i.x)/e.width,l=n.y-(h.y-i.y)/e.height;e.setAnchorPoint(u,l),ubt.add(t)}},e}(Cc))||obt)||obt)||obt)||obt)||obt)||obt);C.SafeArea=Ibt;var Bbt,Dbt=function(e){return t({UICoordinateTracker:e,UICoordinateTrackerComponent:e}),e}((lbt=_u("cc.UICoordinateTracker"),cbt=Bu(),_bt=wu(),fbt=du(110),dbt=qu(YA),pbt=Fu(),mbt=qu(Hb),gbt=Fu(),ybt=Fu(),vbt=Fu(),Abt=qu([bc]),Sbt=Fu(),lbt(bbt=cbt(bbt=_bt(bbt=fbt((S((Tbt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0)){var i=this._distance/Math.abs(this._viewPos.z);bc.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},u(e,[{key:"target",get:function(){return this._target},set:function(t){this._target!==t&&(this._target=t,this._checkCanMove())}},{key:"camera",get:function(){return this._camera},set:function(t){this._camera!==t&&(this._camera=t,this._checkCanMove())}},{key:"useScale",get:function(){return this._useScale},set:function(t){this._useScale!==t&&(this._useScale=t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance!==t&&(this._distance=t)}}]),e}(Cc)).prototype,"target",[dbt,pbt],Object.getOwnPropertyDescriptor(Tbt.prototype,"target"),Tbt.prototype),S(Tbt.prototype,"camera",[mbt,gbt],Object.getOwnPropertyDescriptor(Tbt.prototype,"camera"),Tbt.prototype),S(Tbt.prototype,"useScale",[ybt],Object.getOwnPropertyDescriptor(Tbt.prototype,"useScale"),Tbt.prototype),S(Tbt.prototype,"distance",[vbt],Object.getOwnPropertyDescriptor(Tbt.prototype,"distance"),Tbt.prototype),Ebt=S(Tbt.prototype,"syncEvents",[Abt,Au,Sbt],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Cbt=S(Tbt.prototype,"_target",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),wbt=S(Tbt.prototype,"_camera",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),xbt=S(Tbt.prototype,"_useScale",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Rbt=S(Tbt.prototype,"_distance",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),bbt=Tbt))||bbt)||bbt)||bbt)||bbt)),Pbt=[oA.TOUCH_START,oA.TOUCH_END,oA.TOUCH_MOVE,oA.MOUSE_DOWN,oA.MOUSE_MOVE,oA.MOUSE_UP,oA.MOUSE_ENTER,oA.MOUSE_LEAVE,oA.MOUSE_WHEEL];function Mbt(t){t.propagationStopped=!0}var Obt,Fbt,Nbt,Lbt,Vbt,kbt,Gbt,Ubt,zbt,Hbt,Wbt,Xbt,jbt=function(e){return t({BlockInputEvents:e,BlockInputEventsComponent:e}),e}(_u("cc.BlockInputEvents")(Bbt=Bu()(Bbt=wu()(Bbt=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;tn?n:i;e.width*=r,e.height*=r;var s=zN.getViewportRect(),a=e.getBoundingBoxToWorld(),o=zN.getVisibleSize(),h=Xa.devicePixelRatio,u=(s.width*(a.x/o.width)+s.x)/h,l=(s.height*(a.y/o.height)+s.y)/h,c=s.width*(a.width/o.width)/h,_=s.height*(a.height/o.height)/h;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:u,y:l,width:c,height:_})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(oA.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(oA.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(oA.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(oA.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(oA.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(oA.LAYER_CHANGED,this._updateContentLayer,this)},i._updateContentLayer=function(){this._content.layer=this.node.layer},i.update=function(t){void 0===t?this._updateSubContextTexture():performance.now()-this._updatedTime>=this._updateInterval&&(this._updatedTime+=this._updateInterval,this._updateSubContextTexture())},i.onDestroy=function(){this._content.destroy(),this._texture.destroy(),this._sprite&&this._sprite.destroy(),this._imageAsset.destroy(),this._openDataContext=null},u(e,[{key:"designResolutionSize",get:function(){return this._designResolutionSize},set:function(){}},{key:"fps",get:function(){return this._fps},set:function(t){this._fps!==t&&(this._fps=t,this._updateInterval=1e3/t)}}]),e}(Cc)).prototype,"designResolutionSize",[kbt],Object.getOwnPropertyDescriptor(zbt.prototype,"designResolutionSize"),zbt.prototype),S(zbt.prototype,"fps",[Gbt],Object.getOwnPropertyDescriptor(zbt.prototype,"fps"),zbt.prototype),Hbt=S(zbt.prototype,"_fps",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 60}}),Wbt=S(zbt.prototype,"_designResolutionSize",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(640,960)}}),Ubt=zbt))||Ubt)||Ubt)||Ubt)||Ubt)||Ubt));C.SubContextView=Ybt,ft({ButtonComponent:{newName:"Button",since:"1.2.0",removed:!1},EditBoxComponent:{newName:"EditBox",since:"1.2.0",removed:!1},LayoutComponent:{newName:"Layout",since:"1.2.0",removed:!1},ProgressBarComponent:{newName:"ProgressBar",since:"1.2.0",removed:!1},ScrollViewComponent:{newName:"ScrollView",since:"1.2.0",removed:!1},ScrollBarComponent:{newName:"ScrollBar",since:"1.2.0",removed:!1},SliderComponent:{newName:"Slider",since:"1.2.0",removed:!1},ToggleComponent:{newName:"Toggle",since:"1.2.0",removed:!1},ToggleContainerComponent:{newName:"ToggleContainer",since:"1.2.0",removed:!1},WidgetComponent:{newName:"Widget",since:"1.2.0",removed:!1},PageViewComponent:{newName:"PageView",since:"1.2.0",removed:!1},PageViewIndicatorComponent:{newName:"PageViewIndicator",since:"1.2.0",removed:!1},SafeAreaComponent:{newName:"SafeArea",since:"1.2.0",removed:!1},UICoordinateTrackerComponent:{newName:"UICoordinateTracker",since:"1.2.0",removed:!1},BlockInputEventsComponent:{newName:"BlockInputEvents",since:"1.2.0",removed:!1}});var qbt,Kbt,Jbt,Zbt,Qbt=t("UIReorderComponent",_u("cc.UIReorderComponent")(Xbt=function(){j(1408,"UIReorderComponent")})||Xbt);C.UIReorderComponent=Qbt,C.ButtonComponent=Kft,le.setClassAlias(Kft,"cc.ButtonComponent"),C.EditBoxComponent=Smt,le.setClassAlias(Smt,"cc.EditBoxComponent"),C.LayoutComponent=jmt,le.setClassAlias(jmt,"cc.LayoutComponent"),C.ProgressBarComponent=ggt,le.setClassAlias(ggt,"cc.ProgressBarComponent"),C.ScrollViewComponent=Qyt,le.setClassAlias(Qyt,"cc.ScrollViewComponent"),C.ScrollBarComponent=wgt,le.setClassAlias(wgt,"cc.ScrollBarComponent"),C.SliderComponent=Svt,le.setClassAlias(Svt,"cc.SliderComponent"),C.ToggleComponent=Fvt,le.setClassAlias(Fvt,"cc.ToggleComponent"),C.ToggleContainerComponent=xAt,le.setClassAlias(xAt,"cc.ToggleContainerComponent"),C.WidgetComponent=tSt,le.setClassAlias(tSt,"cc.WidgetComponent"),C.PageViewComponent=ZSt,le.setClassAlias(ZSt,"cc.PageViewComponent"),C.PageViewIndicatorComponent=jSt,le.setClassAlias(jSt,"cc.PageViewIndicatorComponent"),C.SafeAreaComponent=Ibt,le.setClassAlias(Ibt,"cc.SafeAreaComponent"),le.setClassAlias(Dbt,"cc.UICoordinateTrackerComponent"),C.BlockInputEventsComponent=jbt,le.setClassAlias(jbt,"cc.BlockInputEventsComponent");var $bt=t("VideoClip",_u("cc.VideoClip")((Zbt=function(t){function e(){var e;return A(e=t.call(this)||this,"_duration",Jbt,g(e)),e._video=null,e}return c(e,t),u(e,[{key:"_nativeAsset",get:function(){return this._video},set:function(t){this._video=t,this._duration=t?t.duration:0}}]),e}(Wl),Jbt=S((Kbt=Zbt).prototype,"_duration",[Au],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),qbt=Kbt))||qbt);function tTt(t,e,i){var n=document.createElement("video"),r=document.createElement("source");n.appendChild(r);var s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType="blob",s.onload=function(){200===this.status||0===this.status?(r.src=URL.createObjectURL(this.response),i(null,n)):i(new Error(s.status+"(no response)"))},s.onerror=function(){var e="load video failure - "+t;F(e),i(new Error(e))},s.send()}function eTt(t,e,i,n){var r=new $bt;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}ky.register({".mp4":tTt,".avi":tTt,".mov":tTt,".mpg":tTt,".mpeg":tTt,".rm":tTt,".rmvb":tTt}),Zy.register({".mp4":eTt,".avi":eTt,".mov":eTt,".mpg":eTt,".mpeg":eTt,".rm":eTt,".rmvb":eTt});var iTt,nTt,rTt=_e({REMOTE:0,LOCAL:1});!function(t){t.NONE="none",t.PLAYING="playing",t.PAUSED="paused",t.STOPPED="stopped",t.COMPLETED="completed",t.META_LOADED="meta-loaded",t.READY_TO_PLAY="ready-to-play",t.ERROR="error",t.CLICKED="clicked"}(iTt||(iTt={})),function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"}(nTt||(nTt={}));var sTt=function(){function t(t){var e=this;this._componentEventList=new Map,this._state=iTt.NONE,this._video=null,this._onHide=void 0,this._onShow=void 0,this._interrupted=!1,this._loaded=!1,this._loadedMeta=!1,this._ignorePause=!1,this._fullScreenOnAwake=!1,this._visible=!0,this._playing=!1,this._cachedCurrentTime=-1,this._waitingFullscreen=!1,this._waitingPlay=!1,this._keepAspectRatio=!1,this._component=null,this._uiTrans=null,this._node=null,this._stayOnBottom=!1,this._dirty=!1,this._forceUpdate=!1,this._w=0,this._h=0,this._m00=0,this._m01=0,this._m04=0,this._m05=0,this._m12=0,this._m13=0,this._component=t,this._node=t.node,this._uiTrans=t.node.getComponent(CG),this._onHide=function(){e.video&&e._state===iTt.PLAYING&&(e.video.pause(),e._interrupted=!0)},this._onShow=function(){e._interrupted&&e.video&&(e.video.play(),e._interrupted=!1)},C.game.on(C.Game.EVENT_HIDE,this._onHide),C.game.on(C.Game.EVENT_SHOW,this._onShow)}var e=t.prototype;return e.onLoadedMetadata=function(t){this._loadedMeta=!0,this._forceUpdate=!0,this._visible?this.enable():this.disable(),this.dispatchEvent(iTt.META_LOADED);var e=t.target;this._keepAspectRatio&&e&&this.syncUITransform(e.videoWidth,e.videoHeight),this.delayedFullScreen(),this.delayedPlay()},e.onCanPlay=function(){this._loaded=!0,this.dispatchEvent(iTt.READY_TO_PLAY)},e.onPlay=function(){this._playing=!0,this.dispatchEvent(iTt.PLAYING)},e.onPlaying=function(){this.dispatchEvent(iTt.PLAYING)},e.onPause=function(){this._ignorePause?this._ignorePause=!1:(this._playing=!1,this.dispatchEvent(iTt.PAUSED))},e.onStoped=function(){this._playing=!1,this._ignorePause=!1,this.dispatchEvent(iTt.STOPPED)},e.onEnded=function(){this.dispatchEvent(iTt.COMPLETED)},e.onClick=function(){this.dispatchEvent(iTt.CLICKED)},e.onError=function(t){this.dispatchEvent(iTt.ERROR);var e=t.target;e&&e.error&&L("Error "+e.error.code+"; details: "+e.error.message)},e.play=function(){this._loadedMeta||this._loaded?this.canPlay():this._waitingPlay=!0},e.delayedPlay=function(){this._waitingPlay&&(this.canPlay(),this._waitingPlay=!1)},e.syncFullScreenOnAwake=function(t){this._fullScreenOnAwake=t,this._loadedMeta||this._loaded?this.canFullScreen(t):this._waitingFullscreen=!0},e.delayedFullScreen=function(){this._waitingFullscreen&&(this.canFullScreen(this._fullScreenOnAwake),this._waitingFullscreen=!1)},e.dispatchEvent=function(t){var e=this._componentEventList.get(t);e&&(this._state=t,e.call(this))},e.syncUITransform=function(t,e){this._uiTrans&&(this._uiTrans.width=t,this._uiTrans.height=e)},e.syncCurrentTime=function(){this.video&&-1!==this._cachedCurrentTime&&this.video.currentTime!==this._cachedCurrentTime&&(this.seekTo(this._cachedCurrentTime),this._cachedCurrentTime=-1)},e.destroy=function(){this.removeVideoPlayer(),this._componentEventList.clear(),C.game.off(C.Game.EVENT_HIDE,this._onHide),C.game.off(C.Game.EVENT_SHOW,this._onShow)},u(t,[{key:"fullScreenOnAwake",get:function(){return this._fullScreenOnAwake}},{key:"loaded",get:function(){return this._loaded}},{key:"componentEventList",get:function(){return this._componentEventList}},{key:"video",get:function(){return this._video}},{key:"state",get:function(){return this._state}},{key:"isPlaying",get:function(){return this._playing}},{key:"UICamera",get:function(){return BN.root.batcher2D.getFirstRenderCamera(this._node)}}]),t}();C.internal.VideoPlayerImpl=sTt;var aTt,oTt,hTt,uTt,lTt,cTt,_Tt,fTt,dTt,pTt,mTt,gTt,yTt,vTt,ATt,STt,bTt,TTt,ETt,CTt,wTt,xTt,RTt,ITt,BTt,DTt,PTt,MTt,OTt,FTt,NTt,LTt,VTt,kTt,GTt,UTt,zTt,HTt,WTt,XTt=-Math.pow(2,15),jTt=cn(),YTt=function(t){function e(e){var i;return(i=t.call(this,e)||this)._eventList=new Map,i._clearColorA=-1,i._clearFlag=void 0,i}c(e,t);var i=e.prototype;return i.addListener=function(t,e){this._video&&(this._eventList.set(t,e),this._video.addEventListener(t,e))},i.removeAllListeners=function(){var t=this;this._eventList.forEach((function(e,i){t._video&&t._video.removeEventListener(i,e)})),this._eventList.clear()},i.canPlay=function(){var t=this;if(this.video){var e=this.video.play();window.Promise&&e instanceof Promise&&e.catch((function(){})).then((function(){t.syncCurrentTime()}))}},i.pause=function(){this.video&&(this.video.pause(),this._cachedCurrentTime=this.video.currentTime)},i.resume=function(){this.play()},i.stop=function(){var t=this;this.video&&(this._ignorePause=!0,this.video.currentTime=0,this.video.pause(),this._cachedCurrentTime=0,setTimeout((function(){t._ignorePause=!1,t.dispatchEvent(iTt.STOPPED)}),0))},i.syncClip=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t.nativeUrl)},i.syncURL=function(t){this.removeVideoPlayer(),t&&this.createVideoPlayer(t)},i.syncPlaybackRate=function(t){Ja.browserType!==Oa.UC?this.video&&(this.video.playbackRate=t):N("playbackRate is not supported by the uc mobile browser.")},i.syncVolume=function(t){this.video&&(this.video.volume=t)},i.syncMute=function(t){this.video&&(this.video.muted=t)},i.syncLoop=function(t){this.video&&(this.video.loop=t)},i.getDuration=function(){return this.video?this.video.duration:0},i.getCurrentTime=function(){return this.video?this.video.currentTime:-1},i.seekTo=function(t){this.video&&(this.video.currentTime=t)},i.canFullScreen=function(t){var e=this,i=this._video;if(i&&i.readyState===nTt.HAVE_ENOUGH_DATA)return Ja.os===La.IOS&&Ja.isBrowser?(t?i.webkitEnterFullscreen&&i.webkitEnterFullscreen():i.webkitExitFullscreen&&i.webkitExitFullscreen(),void(this._fullScreenOnAwake=i.webkitDisplayingFullscreen)):Ya.supportsFullScreen?void(t?(Ja.browserType===Oa.IE&&(i.style.transform=""),i.setAttribute("x5-video-player-fullscreen","true"),Ya.requestFullScreen(i,(function(t){var n=Ja.browserType===Oa.IE?t.msFullscreenElement:t.fullscreenElement;e._fullScreenOnAwake=n===i}),(function(){e._fullScreenOnAwake=!1}))):(i.removeAttribute("x5-video-player-fullscreen"),Ya.exitFullScreen())):(this._fullScreenOnAwake=t,this._forceUpdate=!0,void this.syncMatrix())},i.syncStayOnBottom=function(t){this._video&&(this._video.style["z-index"]=t?XTt:0,this._stayOnBottom=t),this._dirty=!0},i.syncKeepAspectRatio=function(t){this._keepAspectRatio=t,t&&this._loadedMeta&&this._video&&this.syncUITransform(this._video.videoWidth,this._video.videoHeight)},i.removeVideoPlayer=function(){var t=this._video;t&&Re(PN.container,t)&&(PN.container.removeChild(t),this.removeAllListeners()),this._cachedCurrentTime=0,this._playing=!1,this._loaded=!1,this._loadedMeta=!1,this._video=null},i.createVideoPlayer=function(t){var e=this._video=document.createElement("video");e.className="cocosVideo",e.style.visibility="hidden",e.style.position="absolute",e.style.bottom="0px",e.style.left="0px",e.style["transform-origin"]="0px 100% 0px",e.style["-webkit-transform-origin"]="0px 100% 0px",e.setAttribute("preload","auto"),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""),e.setAttribute("playsinline",""),this._bindDomEvent(),PN.container.appendChild(e);var i=document.createElement("source");e.appendChild(i),i.src=t},i._bindDomEvent=function(){this._video,this.addListener("loadedmetadata",this.onLoadedMetadata.bind(this)),this.addListener("canplay",this.onCanPlay.bind(this)),this.addListener("canplaythrough",this.onCanPlay.bind(this)),this.addListener("play",this.onPlay.bind(this)),this.addListener("playing",this.onPlaying.bind(this)),this.addListener("pause",this.onPause.bind(this)),this.addListener("click",this.onClick.bind(this)),this.addListener("ended",this.onEnded.bind(this)),this.addListener("error",this.onError.bind(this))},i.onCanPlay=function(e){var i=e.target;if(!this._loaded||!i)switch(i.readyState){case nTt.HAVE_METADATA:case nTt.HAVE_ENOUGH_DATA:t.prototype.onCanPlay.call(this,e)}},i.enable=function(){if(this._video){if(this._visible=!0,"visible"===this._video.style.visibility)return;this._video.style.visibility="visible"}},i.disable=function(t){if(this._video){if(!t&&this._playing&&this._video.pause(),this._visible=!1,"hidden"===this._video.style.visibility)return;this._video.style.visibility="hidden"}},i.syncMatrix=function(){if(this._video&&this._visible&&this._component){var t=this.UICamera;if(t&&!Ya.fullScreen()){this._dirty&&(this._dirty=!1,this._stayOnBottom?(this._clearColorA=t.clearColor.w,this._clearFlag=t.clearFlag,t.clearColor.w=0,t.clearFlag=cr.ALL):this._clearFlag&&(t.clearColor.w=this._clearColorA,t.clearFlag=this._clearFlag,this._clearColorA=-1,this._clearFlag=null)),this._component.node.getWorldMatrix(jTt),t.update(!0),t.worldMatrixToScreen(jTt,jTt,PN.canvas.width,PN.canvas.height);var e=0,i=0;if(this._fullScreenOnAwake?(e=FN.width,i=FN.height):(e=this._uiTrans.contentSize.width,i=this._uiTrans.contentSize.height),this._forceUpdate||this._m00!==jTt.m00||this._m01!==jTt.m01||this._m04!==jTt.m04||this._m05!==jTt.m05||this._m12!==jTt.m12||this._m13!==jTt.m13||this._w!==e||this._h!==i){this._m00=jTt.m00,this._m01=jTt.m01,this._m04=jTt.m04,this._m05=jTt.m05,this._m12=jTt.m12,this._m13=jTt.m13,this._w=e,this._h=i;var n=Xa.devicePixelRatio,r=1/n,s=1/n,a=PN.container,o=jTt.m00*r,h=jTt.m01,u=jTt.m04,l=jTt.m05*s;this._video.style.width=this._w+"px",this._video.style.height=this._h+"px",Ja.browserType!==Oa.MOBILE_QQ?this._video.style.objectFit=this._keepAspectRatio?"none":"fill":N("keepAspectRatio is not supported by the qq mobile browser.");var c=this._w*r,_=this._h*s,f=this._uiTrans.anchorPoint,d=f.x,p=f.y,m=c*jTt.m00*d,g=_*jTt.m05*p,y=a&&a.style.paddingLeft?parseInt(a.style.paddingLeft):0,v=a&&a.style.paddingBottom?parseInt(a.style.paddingBottom):0,A="matrix("+o+","+-h+","+-u+","+l+","+(jTt.m12*r-m+y)+","+-(jTt.m13*s-g+v)+")";this._video.style.transform=A,this._video.style["-webkit-transform"]=A,Ja.browserType!==Oa.IE&&(this._forceUpdate=!1)}}}},e}(sTt),qTt=function(){function t(){}return t.getImpl=function(t){return new YTt(t)},t}();C.internal.VideoPlayerImplManager=qTt;var KTt,JTt=t("VideoPlayer",(aTt=_u("cc.VideoPlayer"),oTt=Bu(),hTt=wu(),uTt=fu(CG),lTt=qu($bt),cTt=qu(rTt),_Tt=Fu(),fTt=Fu(),dTt=qu($bt),pTt=Fu(),mTt=Fu(),gTt=Nu(),yTt=Fu(),vTt=Nu(),ATt=Fu(),STt=Fu(),bTt=Fu(),TTt=Fu(),ETt=Fu(),CTt=Fu(),wTt=qu([bc]),xTt=Uu(),RTt=Fu(),aTt(ITt=oTt(ITt=hTt(ITt=uTt(ITt=Cu((WTt=HTt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1?i-1:0),r=1;r + + + + + Cocos Creator | Hurt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + + + + + + + + + + diff --git a/hurt/page/index.js b/hurt/page/index.js new file mode 100644 index 0000000..6e17063 --- /dev/null +++ b/hurt/page/index.js @@ -0,0 +1,30 @@ +System.register(["./application.js"], function (_export, _context) { + "use strict"; + + var Application, canvas, $p, bcr, application; + + function topLevelImport(url) { + return System["import"](url); + } + + return { + setters: [function (_applicationJs) { + Application = _applicationJs.Application; + }], + execute: function () { + canvas = document.getElementById('GameCanvas'); + $p = canvas.parentElement; + bcr = $p.getBoundingClientRect(); + canvas.width = bcr.width; + canvas.height = bcr.height; + application = new Application(); + topLevelImport('cc').then(function (engine) { + return application.init(engine); + }).then(function () { + return application.start(); + })["catch"](function (err) { + console.error(err); + }); + } + }; +}); \ No newline at end of file diff --git a/hurt/page/src/chunks/bundle.js b/hurt/page/src/chunks/bundle.js new file mode 100644 index 0000000..4ce3c43 --- /dev/null +++ b/hurt/page/src/chunks/bundle.js @@ -0,0 +1,4 @@ +System.register([], function(_export, _context) { return { execute: function () { +System.register("chunks:///_virtual/rollupPluginModLoBabelHelpers.js",[],(function(t){"use strict";return{execute:function(){function e(o,r){return(e=t("setPrototypeOf",Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t}))(o,r)}t({inheritsLoose:function(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,e(t,o)},setPrototypeOf:e})}}})); + +} }; }); \ No newline at end of file diff --git a/hurt/page/src/import-map.json b/hurt/page/src/import-map.json new file mode 100644 index 0000000..566b545 --- /dev/null +++ b/hurt/page/src/import-map.json @@ -0,0 +1 @@ +{"imports":{"cc":"./../cocos-js/cc.js"}} \ No newline at end of file diff --git a/hurt/page/src/polyfills.bundle.js b/hurt/page/src/polyfills.bundle.js new file mode 100644 index 0000000..1287c60 --- /dev/null +++ b/hurt/page/src/polyfills.bundle.js @@ -0,0 +1 @@ +!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,r,e=(function(n){!function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=0)}([function(t,n,r){r(1),r(62),r(63),r(64),r(65),r(66),r(67),r(68),r(69),r(70),r(71),r(72),r(73),r(74),r(75),r(76),r(81),r(84),r(87),r(89),r(90),r(91),r(92),r(94),r(95),r(97),r(106),r(107),r(108),r(116),r(117),r(119),r(120),r(121),r(123),r(124),r(125),r(126),r(128),r(129),r(130),r(131),r(138),r(140),r(141),r(142),r(143),r(144),r(145),r(152),r(154),r(155),r(156),r(158),r(159),r(161),r(162),r(164),r(165),r(166),r(167),r(168),r(169),r(170),r(171),r(172),r(173),r(174),r(177),r(178),r(180),r(182),r(183),r(184),r(185),r(186),r(188),r(190),r(193),r(195),r(197),r(198),r(200),r(201),r(202),r(203),r(204),r(205),r(206),r(208),r(209),r(210),r(211),r(212),r(213),r(214),r(215),r(216),r(218),r(219),r(229),r(230),r(231),r(232),r(234),r(235),r(236),r(237),r(238),r(239),r(240),r(241),r(242),r(243),r(244),r(245),r(249),r(251),r(252),r(253),r(254),r(255),r(256),r(258),r(261),r(262),r(263),r(264),r(268),r(269),r(272),r(273),r(274),r(275),r(276),r(277),r(278),r(279),r(281),r(282),r(283),r(286),r(287),r(288),r(289),r(290),r(291),r(292),r(293),r(294),r(295),r(296),r(297),r(298),r(305),r(306),r(307),r(308),r(309),r(310),r(311),r(312),r(313),r(314),r(315),r(316),r(317),r(318),r(319),r(320),r(321),r(322),r(323),r(324),r(325),r(326),r(327),r(328),r(329),r(330),r(331),r(332),r(333),r(334),r(335),r(336),r(337),r(338),t.exports=r(340)},function(t,n,r){var e=r(2),o=r(3),i=r(34),u=r(29),a=r(5),c=r(45),f=r(46),s=r(6),l=r(15),p=r(47),h=r(14),v=r(20),d=r(48),g=r(9),y=r(13),x=r(8),b=r(49),m=r(51),S=r(36),E=r(53),w=r(43),A=r(4),O=r(19),T=r(7),M=r(18),I=r(21),j=r(28),R=r(27),_=r(31),P=r(30),N=r(54),F=r(55),k=r(56),C=r(57),U=r(25),D=r(58).forEach,L=R("hidden"),z=N("toPrimitive"),W=U.set,B=U.getterFor("Symbol"),Y=Object.prototype,V=o.Symbol,$=i("JSON","stringify"),G=A.f,X=O.f,q=E.f,K=T.f,J=j("symbols"),Q=j("op-symbols"),H=j("string-to-symbol-registry"),Z=j("symbol-to-string-registry"),tt=j("wks"),nt=o.QObject,rt=!nt||!nt.prototype||!nt.prototype.findChild,et=a&&s((function(){return 7!=b(X({},"a",{get:function(){return X(this,"a",{value:7}).a}})).a}))?function(t,n,r){var e=G(Y,n);e&&delete Y[n],X(t,n,r),e&&t!==Y&&X(Y,n,e)}:X,ot=function(t,n){var r=J[t]=b(V.prototype);return W(r,{type:"Symbol",tag:t,description:n}),a||(r.description=n),r},it=f?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof V},ut=function(t,n,r){t===Y&&ut(Q,n,r),v(t);var e=y(n,!0);return v(r),l(J,e)?(r.enumerable?(l(t,L)&&t[L][e]&&(t[L][e]=!1),r=b(r,{enumerable:x(0,!1)})):(l(t,L)||X(t,L,x(1,{})),t[L][e]=!0),et(t,e,r)):X(t,e,r)},at=function(t,n){v(t);var r=g(n),e=m(r).concat(lt(r));return D(e,(function(n){a&&!ct.call(r,n)||ut(t,n,r[n])})),t},ct=function(t){var n=y(t,!0),r=K.call(this,n);return!(this===Y&&l(J,n)&&!l(Q,n))&&(!(r||!l(this,n)||!l(J,n)||l(this,L)&&this[L][n])||r)},ft=function(t,n){var r=g(t),e=y(n,!0);if(r!==Y||!l(J,e)||l(Q,e)){var o=G(r,e);return!o||!l(J,e)||l(r,L)&&r[L][e]||(o.enumerable=!0),o}},st=function(t){var n=q(g(t)),r=[];return D(n,(function(t){l(J,t)||l(_,t)||r.push(t)})),r},lt=function(t){var n=t===Y,r=q(n?Q:g(t)),e=[];return D(r,(function(t){!l(J,t)||n&&!l(Y,t)||e.push(J[t])})),e};c||(I((V=function(){if(this instanceof V)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,n=P(t),r=function(t){this===Y&&r.call(Q,t),l(this,L)&&l(this[L],n)&&(this[L][n]=!1),et(this,n,x(1,t))};return a&&rt&&et(Y,n,{configurable:!0,set:r}),ot(n,t)}).prototype,"toString",(function(){return B(this).tag})),I(V,"withoutSetter",(function(t){return ot(P(t),t)})),T.f=ct,O.f=ut,A.f=ft,S.f=E.f=st,w.f=lt,F.f=function(t){return ot(N(t),t)},a&&(X(V.prototype,"description",{configurable:!0,get:function(){return B(this).description}}),u||I(Y,"propertyIsEnumerable",ct,{unsafe:!0}))),e({global:!0,wrap:!0,forced:!c,sham:!c},{Symbol:V}),D(m(tt),(function(t){k(t)})),e({target:"Symbol",stat:!0,forced:!c},{for:function(t){var n=String(t);if(l(H,n))return H[n];var r=V(n);return H[n]=r,Z[r]=n,r},keyFor:function(t){if(!it(t))throw TypeError(t+" is not a symbol");if(l(Z,t))return Z[t]},useSetter:function(){rt=!0},useSimple:function(){rt=!1}}),e({target:"Object",stat:!0,forced:!c,sham:!a},{create:function(t,n){return void 0===n?b(t):at(b(t),n)},defineProperty:ut,defineProperties:at,getOwnPropertyDescriptor:ft}),e({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:st,getOwnPropertySymbols:lt}),e({target:"Object",stat:!0,forced:s((function(){w.f(1)}))},{getOwnPropertySymbols:function(t){return w.f(d(t))}}),$&&e({target:"JSON",stat:!0,forced:!c||s((function(){var t=V();return"[null]"!=$([t])||"{}"!=$({a:t})||"{}"!=$(Object(t))}))},{stringify:function(t,n,r){for(var e,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(e=n,(h(n)||void 0!==t)&&!it(t))return p(n)||(n=function(t,n){if("function"==typeof e&&(n=e.call(this,t,n)),!it(n))return n}),o[1]=n,$.apply(null,o)}}),V.prototype[z]||M(V.prototype,z,V.prototype.valueOf),C(V,"Symbol"),_[L]=!0},function(t,n,r){var e=r(3),o=r(4).f,i=r(18),u=r(21),a=r(22),c=r(32),f=r(44);t.exports=function(t,n){var r,s,l,p,h,v=t.target,d=t.global,g=t.stat;if(r=d?e:g?e[v]||a(v,{}):(e[v]||{}).prototype)for(s in n){if(p=n[s],l=t.noTargetGet?(h=o(r,s))&&h.value:r[s],!f(d?s:v+(g?".":"#")+s,t.forced)&&void 0!==l){if(typeof p==typeof l)continue;c(p,l)}(t.sham||l&&l.sham)&&i(p,"sham",!0),u(r,s,p,t)}}},function(n,r){var e=function(t){return t&&t.Math==Math&&t};n.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof t&&t)||Function("return this")()},function(t,n,r){var e=r(5),o=r(7),i=r(8),u=r(9),a=r(13),c=r(15),f=r(16),s=Object.getOwnPropertyDescriptor;n.f=e?s:function(t,n){if(t=u(t),n=a(n,!0),f)try{return s(t,n)}catch(t){}if(c(t,n))return i(!o.f.call(t,n),t[n])}},function(t,n,r){var e=r(6);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,r){var e={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!e.call({1:2},1);n.f=i?function(t){var n=o(this,t);return!!n&&n.enumerable}:e},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,r){var e=r(10),o=r(12);t.exports=function(t){return e(o(t))}},function(t,n,r){var e=r(6),o=r(11),i="".split;t.exports=e((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,r){var e=r(14);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n,r){var e=r(5),o=r(6),i=r(17);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,n,r){var e=r(3),o=r(14),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},function(t,n,r){var e=r(5),o=r(19),i=r(8);t.exports=e?function(t,n,r){return o.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(5),o=r(16),i=r(20),u=r(13),a=Object.defineProperty;n.f=e?a:function(t,n,r){if(i(t),n=u(n,!0),i(r),o)try{return a(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(14);t.exports=function(t){if(!e(t))throw TypeError(String(t)+" is not an object");return t}},function(t,n,r){var e=r(3),o=r(18),i=r(15),u=r(22),a=r(23),c=r(25),f=c.get,s=c.enforce,l=String(String).split("String");(t.exports=function(t,n,r,a){var c=!!a&&!!a.unsafe,f=!!a&&!!a.enumerable,p=!!a&&!!a.noTargetGet;"function"==typeof r&&("string"!=typeof n||i(r,"name")||o(r,"name",n),s(r).source=l.join("string"==typeof n?n:"")),t!==e?(c?!p&&t[n]&&(f=!0):delete t[n],f?t[n]=r:o(t,n,r)):f?t[n]=r:u(n,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&f(this).source||a(this)}))},function(t,n,r){var e=r(3),o=r(18);t.exports=function(t,n){try{o(e,t,n)}catch(r){e[t]=n}return n}},function(t,n,r){var e=r(24),o=Function.toString;"function"!=typeof e.inspectSource&&(e.inspectSource=function(t){return o.call(t)}),t.exports=e.inspectSource},function(t,n,r){var e=r(3),o=r(22),i=e["__core-js_shared__"]||o("__core-js_shared__",{});t.exports=i},function(t,n,r){var e,o,i,u=r(26),a=r(3),c=r(14),f=r(18),s=r(15),l=r(27),p=r(31),h=a.WeakMap;if(u){var v=new h,d=v.get,g=v.has,y=v.set;e=function(t,n){return y.call(v,t,n),n},o=function(t){return d.call(v,t)||{}},i=function(t){return g.call(v,t)}}else{var x=l("state");p[x]=!0,e=function(t,n){return f(t,x,n),n},o=function(t){return s(t,x)?t[x]:{}},i=function(t){return s(t,x)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(n){var r;if(!c(n)||(r=o(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},function(t,n,r){var e=r(3),o=r(23),i=e.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},function(t,n,r){var e=r(28),o=r(30),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},function(t,n,r){var e=r(29),o=r(24);(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.6.5",mode:e?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(t,n){t.exports=!1},function(t,n){var r=0,e=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++r+e).toString(36)}},function(t,n){t.exports={}},function(t,n,r){var e=r(15),o=r(33),i=r(4),u=r(19);t.exports=function(t,n){for(var r=o(n),a=u.f,c=i.f,f=0;fc;)e(a,r=n[c++])&&(~i(f,r)||f.push(r));return f}},function(t,n,r){var e=r(9),o=r(39),i=r(41),u=function(t){return function(n,r,u){var a,c=e(n),f=o(c.length),s=i(u,f);if(t&&r!=r){for(;f>s;)if((a=c[s++])!=a)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===r)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},function(t,n,r){var e=r(40),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(40),o=Math.max,i=Math.min;t.exports=function(t,n){var r=e(t);return r<0?o(r+n,0):i(r,n)}},function(t,n){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(6),o=/#|\.prototype\./,i=function(t,n){var r=a[u(t)];return r==f||r!=c&&("function"==typeof n?e(n):!!n)},u=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},a=i.data={},c=i.NATIVE="N",f=i.POLYFILL="P";t.exports=i},function(t,n,r){var e=r(6);t.exports=!!Object.getOwnPropertySymbols&&!e((function(){return!String(Symbol())}))},function(t,n,r){var e=r(45);t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,n,r){var e=r(11);t.exports=Array.isArray||function(t){return"Array"==e(t)}},function(t,n,r){var e=r(12);t.exports=function(t){return Object(e(t))}},function(t,n,r){var e,o=r(20),i=r(50),u=r(42),a=r(31),c=r(52),f=r(17),s=r(27),l=s("IE_PROTO"),p=function(){},h=function(t){return"