System.register([],(function(e,t){"use strict";return{execute:function(){function i(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,n=new Array(t);i=e.length?{done:!0}:{done:!1,value:e[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=e[Symbol.iterator]()).next.bind(i)}function f(e,t,i,n,r){var s={};return Object.keys(n).forEach((function(e){s[e]=n[e]})),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(e,t,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(e,t,s),s=null),s}function p(e,t){const i="undefined"==typeof window?global:window;return void 0===i[e]?i[e]=t:i[e]}e({A:void 0,E:void 0,F:void 0,G:void 0,H:void 0,I:void 0,J:void 0,K:void 0,L:void 0,M:void 0,N:void 0,O:void 0,Q:void 0,S:void 0,T:void 0,U:void 0,V:void 0,W:void 0,X:void 0,Y:void 0,a:function(e,t){t>=0&&e.length,e.length},a$:x_,aT:void 0,aZ:P_,a_:L_,b0:F_,b1:B_,b2:U_,b3:G_,bA:void 0,bB:void 0,bC:void 0,bD:void 0,bE:void 0,bF:void 0,bG:void 0,bJ:void 0,bY:ib,bZ:void 0,bo:void 0,bp:void 0,bt:Ri,bv:s,bw:void 0,bz:void 0,c:void 0,c3:void 0,c4:void 0,c9:void 0,cB:function(e,t,i,n,r){void 0===i&&(i=Fc.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=b_[i];r||(r=s.size);for(var a="set"+Hb(s),o=s.size/s.count,u=Math.floor(t.length/s.count),h=Ec.isLittleEndian,c=0;c15){for(var c=0;n.has(c);)c++;h=c;var l=s[0].replace(s[1],""+h);a=e.replace(s[0],l)}n.add(h),i.set(s[2],h)}s=r.exec(e)};s;)o();return a}(e,t,r,a),t,i,"in",r,a),s=Qv(s,t,i,"out",r)}else"frag"===n&&(s=function(e,t,i){for(var n=e,r=new RegExp("layout\\(location = ([^\\)]+)\\)\\s+in.*?\\s(\\w+)[;,\\)]","g"),s=r.exec(e);s;){var a=s[2];if(!i.has(a)){var o=0;o=i.get(a)||0;var u=s[0].replace(s[1],""+o);n=n.replace(s[0],u)}s=r.exec(e)}return n}(s,0,r));return s},dt:Jv,dw:l,dy:r,e:void 0,e$:uc,e1:void 0,e2:ht,e3:void 0,e4:ot,eA:Rs,eB:Ii,eD:void 0,eE:void 0,eF:void 0,eG:void 0,eI:wi,eJ:lt,eL:void 0,eM:void 0,eN:ut,eO:U,eP:k,eQ:H,eR:W,eT:$h,eU:tc,eV:ic,eW:nc,eX:rc,eY:sc,eZ:ac,e_:oc,ef:qs,eh:Vs,ep:void 0,eq:it,er:Ce,eu:function(e,t,i,n){i&&Object.defineProperty(e,t,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})},ez:Lu,f:void 0,f$:xi,f0:function(e,t,i){var n=Wb(e),r="Camera"+n,s=Zb(r,e,t),a=Xb(e,e.window.width,e.window.height),o=a.width,u=a.height,h="dsForwardPassColor"+r,c="dsForwardPassDS"+r;t.containsResource(h)||(i?t.addRenderTarget(h,Fc.RGBA16F,o,u,Sb.MANAGED):t.addRenderTexture(h,Fc.BGRA8,o,u,e.window),t.addDepthStencil(c,Fc.DEPTH_STENCIL,o,u,Sb.MANAGED)),i?(t.updateRenderTarget(h,o,u),t.updateDepthStencil(c,o,u)):(t.updateRenderWindow(h,e.window),t.updateDepthStencil(c,o,u));var l=t.addRasterPass(o,u,"default");l.name="CameraForwardPass"+n,l.setViewport(new xl(a.x,a.y,o,u));for(var _,f=d(s.mainLightShadowNames);!(_=f()).done;){var p=_.value;if(t.containsResource(p)){var m=new Bb("cc_shadowMap");l.addComputeView(p,m)}}for(var g,v=d(s.spotLightShadowNames);!(g=v()).done;){var y=g.value;if(t.containsResource(y)){var E=new Bb("cc_spotShadowMap");l.addComputeView(y,E)}}var T=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,i?nl.CLEAR:jb(e.clearFlag,Cb.RENDER_TARGET),rl.STORE,e.clearFlag,new Dl(e.clearColor.x,e.clearColor.y,e.clearColor.z,e.clearColor.w)),A=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,i?nl.CLEAR:jb(e.clearFlag,Cb.DEPTH_STENCIL),rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));l.addRasterView(h,T),l.addRasterView(c,A),l.addQueue(Rb.RENDER_OPAQUE).addSceneOfCamera(e,new Ub,Ob.OPAQUE_OBJECT|Ob.PLANAR_SHADOW|Ob.CUTOUT_OBJECT|Ob.DEFAULT_LIGHTING|Ob.DRAW_INSTANCING);var S=Ob.TRANSPARENT_OBJECT|Ob.GEOMETRY;return i||(S|=Ob.UI,l.showStatistics=!0),l.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,S),{rtName:h,dsName:c}},f1:function(e,t){var i=Wb(e),n=Xb(e,e.window.width,e.window.height),r=n.width,s=n.height,a="gBufferPassColorCamera",o="gBufferPassNormal",u="gBufferPassEmissive",h="gBufferPassDSCamera";if(!t.containsResource(a)){var c=Fc.RGBA16F;t.addRenderTarget(a,c,r,s,Sb.MANAGED),t.addRenderTarget(o,c,r,s,Sb.MANAGED),t.addRenderTarget(u,c,r,s,Sb.MANAGED),t.addDepthStencil(h,Fc.DEPTH_STENCIL,r,s,Sb.MANAGED)}t.updateRenderTarget(a,r,s),t.updateRenderTarget(o,r,s),t.updateRenderTarget(u,r,s),t.updateDepthStencil(h,r,s);var l=t.addRasterPass(r,s,"default");l.name="CameraGBufferPass"+i,l.setViewport(new xl(n.x,n.y,n.width,n.height));var _=new Dl(0,0,0,0);e.clearFlag&vl.COLOR&&(t.pipelineSceneData.isHDR?VE(_,e.clearColor):(_.x=e.clearColor.x,_.y=e.clearColor.y,_.z=e.clearColor.z));var d=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,_),f=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,new Dl(0,0,0,0)),p=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,new Dl(0,0,0,0)),m=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,nl.CLEAR,rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));l.addRasterView(a,d),l.addRasterView(o,f),l.addRasterView(u,p),l.addRasterView(h,m),l.addQueue(Rb.RENDER_OPAQUE).addSceneOfCamera(e,new Ub,Ob.OPAQUE_OBJECT|Ob.CUTOUT_OBJECT);var g=new Jb;return g.color=a,g.normal=o,g.emissive=u,g.ds=h,g},f2:function(e,t,i){eO||(eO=new $b);var n=Wb(e),r=Zb("Camera"+n,e,t),s=Xb(e,e.window.width,e.window.height),a=s.width,o=s.height,u="deferredLightingPassRTName",h="deferredLightingPassDS";t.containsResource(u)||(t.addRenderTarget(u,Fc.RGBA8,a,o,Sb.MANAGED),t.addDepthStencil(h,Fc.DEPTH_STENCIL,a,o,Sb.MANAGED)),t.updateRenderTarget(u,a,o),t.updateDepthStencil(h,a,o);var c=t.addRasterPass(a,o,"deferred-lighting");c.name="CameraLightingPass"+n,c.setViewport(new xl(s.x,s.y,a,o));for(var l,_=d(r.mainLightShadowNames);!(l=_()).done;){var f=l.value;if(t.containsResource(f)){var p=new Bb("cc_shadowMap");c.addComputeView(f,p)}}for(var m,g=d(r.spotLightShadowNames);!(m=g()).done;){var v=m.value;if(t.containsResource(v)){var y=new Bb("cc_spotShadowMap");c.addComputeView(v,y)}}if(t.containsResource(i.color)){var E=new Bb;E.name="gbuffer_albedoMap",c.addComputeView(i.color,E);var T=new Bb;T.name="gbuffer_normalMap",c.addComputeView(i.normal,T);var A=new Bb;A.name="gbuffer_emissiveMap",c.addComputeView(i.emissive,A);var S=new Bb;S.name="depth_stencil",c.addComputeView(i.ds,S)}var R=new Dl(0,0,0,0);e.clearFlag&vl.COLOR&&(R.x=e.clearColor.x,R.y=e.clearColor.y,R.z=e.clearColor.z),R.w=0;var w=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,R);return c.addRasterView(u,w),c.addQueue(Rb.RENDER_TRANSPARENT).addCameraQuad(e,eO.deferredLightingMaterial,0,Ob.VOLUMETRIC_LIGHTING),c.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,Ob.TRANSPARENT_OBJECT|Ob.PLANAR_SHADOW|Ob.GEOMETRY),{rtName:u,dsName:h}},f3:function(e,t,i,n){void 0===n&&(n=Gb.NONE),(!Yb||Yb&&Yb.antiAliasing!==n)&&(Yb=new Kb(n));var r=Wb(e),s=Xb(e,e.window.width,e.window.height),a=s.width,o=s.height,u="postprocessPassRTName"+r,h="postprocessPassDS"+r;t.containsResource(u)||(t.addRenderTexture(u,Fc.BGRA8,a,o,e.window),t.addDepthStencil(h,Fc.DEPTH_STENCIL,a,o,Sb.MANAGED)),t.updateRenderWindow(u,e.window),t.updateDepthStencil(h,a,o);var c=t.addRasterPass(a,o,"post-process");if(c.name="CameraPostprocessPass"+r,c.setViewport(new xl(s.x,s.y,s.width,s.height)),t.containsResource(i)){var l=new Bb;l.name="outputResultMap",c.addComputeView(i,l)}var _=new Dl(0,0,0,e.clearColor.w);e.clearFlag&vl.COLOR&&(_.x=e.clearColor.x,_.y=e.clearColor.y,_.z=e.clearColor.z);var d=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,jb(e.clearFlag,Cb.RENDER_TARGET),rl.STORE,e.clearFlag,_),f=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,jb(e.clearFlag,Cb.DEPTH_STENCIL),rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));return c.addRasterView(u,d),c.addRasterView(h,f),c.addQueue(Rb.NONE).addFullscreenQuad(Yb.postMaterial,0,Ob.NONE),c.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,Ob.UI),eT()===e&&(c.showStatistics=!0),{rtName:u,dsName:h}},f4:function(e,t){var i=Wb(e),n="Camera"+i,r=Xb(e,e.window.width,e.window.height),s=r.width,a=r.height,o="dsUIAndProfilerPassColor"+n,u="dsUIAndProfilerPassDS"+n;t.containsResource(o)||(t.addRenderTexture(o,Fc.BGRA8,s,a,e.window),t.addDepthStencil(u,Fc.DEPTH_STENCIL,s,a,Sb.MANAGED)),t.updateRenderWindow(o,e.window),t.updateDepthStencil(u,s,a);var h=t.addRasterPass(s,a,"default");h.name="CameraUIAndProfilerPass"+i,h.setViewport(new xl(r.x,r.y,s,a));var c=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,jb(e.clearFlag,Cb.RENDER_TARGET),rl.STORE,e.clearFlag,new Dl(e.clearColor.x,e.clearColor.y,e.clearColor.z,e.clearColor.w)),l=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,jb(e.clearFlag,Cb.DEPTH_STENCIL),rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));h.addRasterView(o,c),h.addRasterView(u,l);var _=Ob.UI;h.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,_),eT()===e&&(h.showStatistics=!0)},f5:Ga,f7:fi,fA:Pt,fB:void 0,fG:void 0,fP:On,fQ:Qi,fR:Vi,fS:vn,fT:Sn,fV:Mn,fW:Ln,fX:tn,f_:Li,fc:Oi,fd:di,fe:eh,fg:Fi,fi:Ci,fj:Mi,fk:A,fl:Pi,fm:Bi,fp:Ai,fs:ki,ft:void 0,fu:void 0,fv:Gi,g:void 0,g0:Ui,g1:Hi,g4:pt,g8:function(e){e>0&&(ce=e)},g9:function(e){for(var t,i=d(e);!(t=i()).done;)me(t.value)},gF:ka,gH:V,gI:function(e,t){return Rs(e,t,0)},gJ:function(e,t,i){for(var n=0,r=e.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=e[s];if(i(a,t)<0)r=s-1;else{if(!(i(a,t)>0))return s;n=s+1}}return~n},gK:Cc,gM:cL,ga:function(e){return de||(de="undefined"==typeof Proxy?{}:new Proxy(e,{get:function(e,t,i){return me(t),Reflect.get(e,t,i)}})),de},gb:cc,gc:lc,gj:function(e){return e[Ks]},gl:ie,gm:ne,gn:void 0,gp:void 0,gq:mu,h:void 0,h3:void 0,h9:void 0,hM:qx,hm:bp,i:void 0,j:void 0,k:void 0,l:void 0,m:void 0,n:void 0,o:void 0,p:void 0,q:void 0,r:void 0,s:void 0,t:void 0,u:void 0,v:void 0,w:void 0,x:void 0,y:void 0,z:void 0}),e("f8",!1),p("CC_WECHAT",!1),p("CC_BAIDU",!1),p("CC_XIAOMI",!1),p("CC_ALIPAY",!1),p("CC_BYTEDANCE",!1),p("CC_OPPO",!1),p("CC_VIVO",!1),p("CC_HUAWEI",!1),p("CC_COCOSPLAY",!1),p("CC_QTT",!1),p("CC_LINKSURE",!1);const m=e("f9",!1);p("CC_EDITOR",!1),p("CC_PREVIEW",!1),p("CC_BUILD",!0),p("CC_TEST",!1),p("CC_DEBUG",!1),p("CC_DEV",!1),e("fC",!1),p("CC_MINIGAME",!1),e("fE",!1),p("CC_RUNTIME_BASED",!1),p("CC_SUPPORT_JIT",!0),e("fD",!1),p("CC_JSB",!1);var g="undefined"==typeof window?global:window,v=e("by",{_global:g});v.internal={};var y=e("fx","3.7.1");g.CocosEngine=v.ENGINE_VERSION=y,g.cc=v;var E=e("cF",void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis);g.ccwindow=E;var T=e("fn",2147483647);function A(e){return(e>0)-(e<0)}function S(e){var t,i;return t=(e>65535)<<4,t|=i=((e>>>=t)>255)<<3,t|=i=((e>>>=i)>15)<<2,(t|=i=((e>>>=i)>3)<<1)|(e>>>=i)>>1}function R(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24}function w(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}function I(e){return--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)}var b=new Array(256);!function(e){for(var t=0;t<256;++t){var i=t,n=t,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;e[t]=n<>31;return(e^t)-t},min:function(e,t){return t^(e^t)&-(e=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},popCount:R,countTrailingZeros:w,nextPow2:I,prevPow2:function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},parity:function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1},reverse:function(e){return b[255&e]<<24|b[e>>>8&255]<<16|b[e>>>16&255]<<8|b[e>>>24&255]},interleave2:function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},deinterleave2:function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},interleave3:function(e,t,i){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},nextCombination:function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>w(e)+1}});e("fO",O);var N=E.document,C="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",M=null,P=console.log.bind(console),L=P,x=P,D=function(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n2?i-2:0),r=2;rJ.ERROR){var t=function(e){if(v.game.canvas){if(!M){var t=N.createElement("Div");t.setAttribute("id","logInfoDiv"),t.setAttribute("width","200"),t.setAttribute("height",v.game.canvas.height);var i=t.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(M=N.createElement("textarea")).setAttribute("rows","20"),M.setAttribute("cols","30"),M.setAttribute("disabled","true");var n=M.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",t.appendChild(M),v.game.canvas.parentNode.appendChild(t)}M.value=M.value+e+"\r\n",M.scrollTop=M.scrollHeight}};x=function(e){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?t-1:0),n=1;n2?i-2:0),r=2;r1?t-1:0),n=1;n1?t-1:0),n=1;n1?n-1:0),s=1;s1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n2?i-2:0),r=2;r1?t-1:0),n=1;no.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,e+"."+t,i+"."+n),o.count++)},re=e("db",(function(e,t,i){null!=e&&i.forEach((function(i){var n=le++;_e.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ce});var r=null!=i.target?i.target:e,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:t,o=r===e,u=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)e[i.name]=function(){var e;return oe(t,i.name,a,s,G,n,u),(e=i.customFunction).call.apply(e,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var h=null!=i.customSetter,c=null!=i.customGetter;h&&c?Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,a,s,G,n,u),i.customGetter.call(this)},set:function(e){oe(t,i.name,a,s,G,n,u),i.customSetter.call(this,e)},enumerable:!1}):h?Object.defineProperty(e,i.name,{set:function(e){oe(t,i.name,a,s,G,n,u),i.customSetter.call(this,e)},enumerable:!1}):c&&Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,a,s,G,n,u),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,a,s,G,n,u),o?this[s]:r[s]},set:function(e){oe(t,i.name,a,s,G,n,u),o?this[s]=e:r[s]=e},enumerable:!1})}))})),he=function(e,t,i,n,r){var s=_e.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,e+"."+t),s.count++)},se=e("d9",(function(e,t,i){null!=e&&i.forEach((function(i){var n=le++;_e.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ce});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(e,i.name,{get:function(){return he(t,i.name,k,n,r)},set:function(){he(t,i.name,k,n,r)},enumerable:!1})}))})),ue=function(e,t,i,n,r){var s=_e.get(n);s&&s.logTimes>s.count&&(i("'%s' is deprecated. "+r,e+"."+t),s.count++)},ae=e("dM",(function(e,t,i){null!=e&&i.forEach((function(i){var n=i.name,r=Object.getOwnPropertyDescriptor(e,n);if(r&&r.configurable){var s=le++;_e.set(s,{id:s,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ce});var a=i.suggest?"("+i.suggest+")":"";if(void 0!==r.value)if("function"==typeof r.value){var o=r.value;e[n]=function(){return ue(t,n,G,s,a),o.call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}}else{var u=r.value;Object.defineProperty(e,n,{configurable:!0,get:function(){return ue(t,n,G,s,a),u}}),r.writable&&Object.defineProperty(e,n,{set:function(e){ue(t,n,G,s,a),u=e}})}else!function(t,i,n,r,s,a){if(t.get){var o=t.get;t.get=function(){return ue(i,n,r,s,a),o.call(this)}}if(t.set){var u=t.set;t.set=function(e){ue(i,n,r,s,a),u.call(this,e)}}Object.defineProperty(e,n,t)}(r,t,n,G,s,a);Object.defineProperty(e,n,{enumerable:!1})}}))}));var de,fe={};function pe(e){for(var t in e){var i=e[t];fe[t]=i}}function me(e){var t=fe[e];if(t){var i=t.newName,n=t.since;t.removed?i?Z(16003,e,n,i):Z(16002,e,n):i?q(16001,e,n,i):q(16e3,e,n)}}var ge=function(){function e(e){this.id=void 0,this.prefix=void 0,this.id=0|998*Math.random(),this.prefix=e?e+".":""}return e.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},e}();ge.global=new ge("global");var ve=new ge("TmpCId."),ye="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Ee="__cid__";function Te(e){return"number"==typeof e||e instanceof Number}function Ae(e){return"string"==typeof e||e instanceof String}function Se(e){for(var t in e)return!1;return!0}var Re,we=e("f6",(Re={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(e,t,i,n,r){Re.value=i,Re.writable=n,Re.enumerable=r,Object.defineProperty(e,t,Re),Re.value=void 0})),Ie=function(){var e={get:void 0,set:void 0,enumerable:!1};return function(t,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),e.get=n,e.set=r,e.enumerable=s,e.configurable=a,Object.defineProperty(t,i,e),e.get=void 0,e.set=void 0}}(),be=function(){var e={get:void 0,enumerable:!1,configurable:!1};return function(t,i,n,r,s){e.get=n,e.enumerable=r,e.configurable=s,Object.defineProperty(t,i,e),e.get=void 0}}(),Oe=function(){var e={set:void 0,enumerable:!1,configurable:!1};return function(t,i,n,r,s){e.set=n,e.enumerable=r,e.configurable=s,Object.defineProperty(t,i,e),e.set=void 0}}();function Ne(e){var t=Object.create(null);return e&&(t["."]=1,t["/"]=1,delete t["."],delete t["/"]),t}function Ce(e){if("function"==typeof e){var t=e.prototype;if(t&&t.hasOwnProperty("__classname__")&&t.__classname__)return t.__classname__;var i="";if(e.name&&(i=e.name),e.toString){var n,r=e.toString();(n="["===r.charAt(0)?/\[\w+\s*(\w+)\]/.exec(r):/function\s*(\w+)/.exec(r))&&2===n.length&&(i=n[1])}return"Object"!==i?i:""}return e&&e.constructor?Ce(e.constructor):""}function Me(e,t,i,n){var r=/([^.]+)$/,s=r.exec(t)[0],a=r.exec(i)[0];function o(){return this[a]}n?Ie(e,s,o,(function(e){this[a]=e})):be(e,s,o)}function Pe(e,t,i,n){for(var r in i)Me(e,t+"."+r,i[r],n)}var Le=/(%d)|(%s)/,xe=/%s/;function De(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n1?t-1:0),n=1;n1?t-1:0),n=1;n0){--this.count;var e=this._pool[this.count];return this._pool[this.count]=null,e}return null},e.put=function(e){var t=this._pool;if(this.count=0&&(this._pool.length=e,this.count>e&&(this.count=e))},t}()),at=e("eH",function(){function e(e){this.i=0,this.array=e}var t=e.prototype;return t.remove=function(e){var t=this.array.indexOf(e);t>=0&&this.removeAt(t)},t.removeAt=function(e){this.array.splice(e,1),e<=this.i&&--this.i},t.fastRemove=function(e){var t=this.array.indexOf(e);t>=0&&this.fastRemoveAt(t)},t.fastRemoveAt=function(e){var t=this.array;t[e]=t[t.length-1],--t.length,e<=this.i&&--this.i},t.push=function(e){this.array.push(e)},n(e,[{key:"length",get:function(){return this.array.length},set:function(e){this.array.length=e,this.i>=e&&(this.i=e-1)}}]),e}());function ot(e,t){e.splice(t,1)}function ut(e,t){var i=e.length;t<0||t>=i||(e[t]=e[i-1],e.length=i-1)}function ht(e,t){var i=e.indexOf(t);return i>=0&&(ot(e,i),!0)}function ct(e,t){var i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],--e.length)}function lt(e,t){return e.indexOf(t)>=0}var _t=Object.freeze({__proto__:null,removeAt:ot,fastRemoveAt:ut,remove:ht,fastRemove:ct,removeIf:function(e,t){var i=e.findIndex(t);if(i>=0){var n=e[i];return ot(e,i),n}},verifyType:function(e,t){if(e&&e.length>0)for(var i,n=d(e);!(i=n()).done;)if(!(i.value instanceof t))return K(1300),!1;return!0},removeArray:function(e,t){for(var i=0,n=t.length;ii){var n=t;t=i,i=n}return e=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||kt(r,(t=i[n+1])&&t.__attrs__)}return kt(e,(t=i[0])&&t.__attrs__),e.__attrs__}function zt(e,t){var i=Vt(e),n=t+Gt,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Vt(e){return e.hasOwnProperty("__attrs__")&&e.__attrs__||Ht(e)}function Wt(e,t,i,n){Vt(e)[t+Gt+i]=n}var jt=function(){function e(e,t){this.name=void 0,this.default=void 0,this.name=e,this.default=t}return e.prototype.toString=function(){return this.name},e}(),Xt=e("ea",new jt("Integer",0));v.Integer=Xt,v.CCInteger=Xt;var Kt=e("ec",new jt("Float",0));v.Float=Kt,v.CCFloat=Kt;var Yt=e("eb",new jt("Boolean",!1));v.Boolean=Yt,v.CCBoolean=Yt;var qt=e("eg",new jt("String",""));function Qt(e,t){return function(i,n){var r='"'+Ce(i)+"."+n+'"',s=zt(i,n),a=s.type;if(a===Xt||a===Kt?a="Number":a!==qt&&a!==Yt||(a=""+a),a===e){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Dt(o)){var u=typeof o,h=e.toLowerCase();if(u===h)if("object"===h){if(!o||o instanceof s.ctor)return;q(3605,r,Ce(s.ctor))}else"Number"!==e&&q(3606,t,r,e);else{if("function"===u)return;e===qt.default&&null==o?q(3607,r):q(3611,t,r,u)}delete s.type}}}else q(3604,r)}}v.String=qt,v.CCString=qt;var Zt=Object.freeze({__proto__:null,DELIMETER:Gt,createAttrsSingle:kt,createAttrs:Ht,attr:zt,getClassAttrs:Vt,setClassAttr:Wt,PrimitiveType:jt,CCInteger:Xt,CCFloat:Kt,CCBoolean:Yt,CCString:qt,getTypeChecker_ET:Qt,getObjTypeChecker_ET:function(e){return function(t,i){Qt("Object","type")(t,i);var n=Vt(t)[i+Gt+"default"],r=v.Class.getDefault(n);if(!Array.isArray(r)&&Ve(e,v.ValueType)){var s=Ce(e),a=De('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ce(t),i,s);n?U(a):q(3612,a,s,Ce(t),i,s)}}}}),Jt={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function $t(e,t,i,n){if(!e.get&&!e.set&&e.hasOwnProperty("default")){var r="_N$"+t;e.get=function(){return this[r]},e.set=function(e){var t=this[r];this[r]=e,i.call(this,t)};var s={};for(var a in n[r]=s,Jt){var o=Jt[a];e.hasOwnProperty(a)&&(s[a]=e[a],o.canUsedInGet||delete e[a])}}}function ei(e,t,i,n){if(Array.isArray(t)){if(!(t.length>0))return Z(5508,i,n);e.type=t=t[0]}"function"==typeof t&&(t===String?e.type=v.String:t===Boolean?e.type=v.Boolean:t===Number&&(e.type=v.Float))}function ti(e,t,i){var n=e?{_short:!0}:{_short:!0,default:t};return i&&(n.type=i),n}function ii(e,t){if(!e||e.constructor!==Object){if(Array.isArray(e)&&e.length>0)return ti(t,[],e);if("function"==typeof e){var i=e;return ti(t,Ve(i,v.ValueType)?new i:null,i)}return ti(t,e instanceof jt?e.default:e)}return null}var ni,ri=[];function si(){return ri[ri.length-1]}v._RF={push:function(e,t,i,n){void 0===i&&(i=t,t=""),ri.push({uuid:t,script:i,module:e,exports:e.exports,beh:null,importMeta:n})},pop:function(){var e=ri.pop(),t=e.module,i=t.exports;if(i===e.exports){for(var n in i)return;t.exports=i=e.cls}},peek:si},function(e){e[e.STANDALONE=1]="STANDALONE",e[e.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",e[e.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(ni||(ni={}));var ai=Gt,oi="__ctors__",ui=e("gD","Enum"),hi=e("gE","BitMask");function ci(e,t,i,n){!function(e,t){!function(e,t){e.indexOf(t)<0&&e.push(t)}(e.__props__,t)}(e,i),mi(e,n,t,i)}function li(e,t,i,n){var r=n.get;n.set,r&&(mi(e,n,t,i),Wt(e,i,"serializable",!1))}function _i(e){return"function"==typeof e?e():e}function di(e){var t=e.name,i=e.extends,n=function(e,t,i){var n=v.Component,r=si();if(r&&Ve(t,n)){if(Ve(r.cls,n))return Z(3615),null;e=e||r.script}var s=function(e,t,i){var n=i.ctor;return we(n,oi,!0,!0),n.prototype,t&&(n.$super=t),Ze(e,n),n}(e,t,i);if(r)if(Ve(t,n)){var a=r.uuid;a&&qe(a,s),r.cls=s}else Ve(r.cls,n)||(r.cls=s);return s}(t,i,e);t||(t=v.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(e,t,i,n){if(e.__props__=[],n&&n.__props__&&(e.__props__=n.__props__.slice()),i)for(var r in function(e,t){for(var i in e){var n=e[i],r=ii(n,!1);if(r&&(n=e[i]=r),n){var s=n.notify;s&&$t(n,i,s,e),"type"in n&&ei(n,n.type,t,i)}}}(i,t),i){var s=i[r];s.get||s.set?li(e,t,r,s):ci(e,t,r,s)}var a=Vt(e);e.__values__=e.__props__.filter((function(e){return!1!==a[e+ai+"serializable"]}))}(n,t,e.properties,i);var r=e.editor;return r&&Ve(i,v.Component)&&v.Component._registerEditorProps(n,r),n}function fi(e){var t;return null==e||null===(t=e.hasOwnProperty)||void 0===t?void 0:t.call(e,"__values__")}di._isCCClass=function(e){var t;return null==e||null===(t=e.hasOwnProperty)||void 0===t?void 0:t.call(e,oi)},di.fastDefine=function(e,t,i){Ze(e,t);for(var n=t.__props__=t.__values__=Object.keys(i),r=Vt(t),s=0;s=2&&((r||a())[s+"min"]=c[0],r[s+"max"]=c[1],c.length>2&&(r[s+"step"]=c[2])),h("min","number"),h("max","number"),h("step","number")}di.isArray=function(e){return e=_i(e),Array.isArray(e)},di.getDefault=_i,di.escapeForJS=function(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},di.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,di.getNewValueTypeCode=function(e){for(var t=Ce(e),i=e.constructor,n="new "+t+"(",r=0;ri){var n=t;t=i,i=n}return ei?i:e}function wi(e){return e<0?0:e>1?1:e}function Ii(e,t,i){return e+(t-e)*i}function bi(e){return e*gi}function Oi(e){return e*vi}var Ni=e("fh",Math.random);function Ci(e,t){return Math.random()*(t-e)+e}function Mi(e,t){return Math.floor(Ci(e,t))}function Pi(e){return(e=(9301*e+49297)%233280)/233280}function Li(e,t,i){return Pi(e)*(i-t)+t}function xi(e,t,i){return Math.floor(Li(e,t,i))}function Di(e){return I(e)}function Fi(e,t){return e-Math.floor(e/t)*t}function Bi(e,t){return e=Fi(e,2*t),t-Math.abs(e-t)}function Ui(e,t,i){return(i-e)/(t-e)}function Gi(e){return Math.abs(e.x)>Math.abs(e.y)?Math.abs(e.x)>Math.abs(e.z)?e.x:e.z:Math.abs(e.y)>Math.abs(e.z)?e.y:e.z}function ki(e,t){return Math.abs(e)>Math.abs(t)?e:t}function Hi(e,t){t.forEach((function(t){Object.defineProperty(e,t,{enumerable:!0})}))}var zi=e("cJ",function(e){function t(t,i,n,r){var s;return s=e.call(this)||this,t&&"object"==typeof t?(s.x=t.x,s.y=t.y,s.z=t.z,s.w=t.w):(s.x=t||0,s.y=i||0,s.z=n||0,s.w=r||0),s}s(t,e),t.clone=function(e){return new t(e.x,e.y,e.z,e.w)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e},t.set=function(e,t,i,n,r){return e.x=t,e.y=i,e.z=n,e.w=r,e},t.add=function(e,t,i){return e.x=t.x+i.x,e.y=t.y+i.y,e.z=t.z+i.z,e.w=t.w+i.w,e},t.subtract=function(e,t,i){return e.x=t.x-i.x,e.y=t.y-i.y,e.z=t.z-i.z,e.w=t.w-i.w,e},t.multiply=function(e,t,i){return e.x=t.x*i.x,e.y=t.y*i.y,e.z=t.z*i.z,e.w=t.w*i.w,e},t.divide=function(e,t,i){return e.x=t.x/i.x,e.y=t.y/i.y,e.z=t.z/i.z,e.w=t.w/i.w,e},t.ceil=function(e,t){return e.x=Math.ceil(t.x),e.y=Math.ceil(t.y),e.z=Math.ceil(t.z),e.w=Math.ceil(t.w),e},t.floor=function(e,t){return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e.w=Math.floor(t.w),e},t.min=function(e,t,i){return e.x=Math.min(t.x,i.x),e.y=Math.min(t.y,i.y),e.z=Math.min(t.z,i.z),e.w=Math.min(t.w,i.w),e},t.max=function(e,t,i){return e.x=Math.max(t.x,i.x),e.y=Math.max(t.y,i.y),e.z=Math.max(t.z,i.z),e.w=Math.max(t.w,i.w),e},t.round=function(e,t){return e.x=Math.round(t.x),e.y=Math.round(t.y),e.z=Math.round(t.z),e.w=Math.round(t.w),e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e.w=t.w*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e.z=t.z+i.z*n,e.w=t.w+i.w*n,e},t.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z,s=t.w-e.w;return Math.sqrt(i*i+n*n+r*r+s*s)},t.squaredDistance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z,s=t.w-e.w;return i*i+n*n+r*r+s*s},t.len=function(e){var t=e.x,i=e.y,n=e.z,r=e.w;return Math.sqrt(t*t+i*i+n*n+r*r)},t.lengthSqr=function(e){var t=e.x,i=e.y,n=e.z,r=e.w;return t*t+i*i+n*n+r*r},t.negate=function(e,t){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},t.inverse=function(e,t){return e.x=1/t.x,e.y=1/t.y,e.z=1/t.z,e.w=1/t.w,e},t.inverseSafe=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w;return Math.abs(i)0&&(a=1/Math.sqrt(a),e.x=i*a,e.y=n*a,e.z=r*a,e.w=s*a),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},t.lerp=function(e,t,i,n){return e.x=t.x+n*(i.x-t.x),e.y=t.y+n*(i.y-t.y),e.z=t.z+n*(i.z-t.z),e.w=t.w+n*(i.w-t.w),e},t.random=function(e,t){t=t||1;var i=2*Ni()*Math.PI,n=2*Ni()-1,r=Math.sqrt(1-n*n);return e.x=r*Math.cos(i)*t,e.y=r*Math.sin(i)*t,e.z=n*t,e.w=0,e},t.transformMat4=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w;return e.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,e.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,e.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,e.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,e},t.transformAffine=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w;return e.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,e.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,e.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,e.w=t.w,e},t.transformQuat=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.x,o=i.y,u=i.z,h=i.w,c=h*n+o*s-u*r,l=h*r+u*n-a*s,_=h*s+a*r-o*n,d=-a*n-o*r-u*s;return e.x=c*h+d*-a+l*-u-_*-o,e.y=l*h+d*-o+_*-a-c*-u,e.z=_*h+d*-u+c*-o-l*-a,e.w=t.w,e},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e[i+2]=t.z,e[i+3]=t.w,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e.z=t[i+2],e.w=t[i+3],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.x-t.x)<=i*Math.max(1,Math.abs(e.x),Math.abs(t.x))&&Math.abs(e.y-t.y)<=i*Math.max(1,Math.abs(e.y),Math.abs(t.y))&&Math.abs(e.z-t.z)<=i*Math.max(1,Math.abs(e.z),Math.abs(t.z))&&Math.abs(e.w-t.w)<=i*Math.max(1,Math.abs(e.w),Math.abs(t.w))};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.z,this.w)},i.set=function(e,t,i,n){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x=e||0,this.y=t||0,this.z=i||0,this.w=n||0),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t*Math.max(1,Math.abs(this.x),Math.abs(e.x))&&Math.abs(this.y-e.y)<=t*Math.max(1,Math.abs(this.y),Math.abs(e.y))&&Math.abs(this.z-e.z)<=t*Math.max(1,Math.abs(this.z),Math.abs(e.z))&&Math.abs(this.w-e.w)<=t*Math.max(1,Math.abs(this.w),Math.abs(e.w))},i.equals4f=function(e,t,i,n,r){return void 0===r&&(r=Ti),Math.abs(this.x-e)<=r*Math.max(1,Math.abs(this.x),Math.abs(e))&&Math.abs(this.y-t)<=r*Math.max(1,Math.abs(this.y),Math.abs(t))&&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(e){return this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},i.strictEquals4f=function(e,t,i,n){return this.x===e&&this.y===t&&this.z===i&&this.w===n},i.lerp=function(e,t){var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+t*(e.x-i),this.y=n+t*(e.y-n),this.z=r+t*(e.z-r),this.w=s+t*(e.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(e,t){return this.x=Ri(this.x,e.x,t.x),this.y=Ri(this.y,e.y,t.y),this.z=Ri(this.z,e.z,t.z),this.w=Ri(this.w,e.w,t.w),this},i.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},i.add4f=function(e,t,i,n){return this.x+=e,this.y+=t,this.z+=i,this.w+=n,this},i.subtract=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},i.subtract4f=function(e,t,i,n){return this.x-=e,this.y-=t,this.z-=i,this.w-=n,this},i.multiplyScalar=function(e){return"object"==typeof e&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},i.multiply=function(e){return"object"!=typeof e&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},i.multiply4f=function(e,t,i,n){return this.x*=e,this.y*=t,this.z*=i,this.w*=n,this},i.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this},i.divide4f=function(e,t,i,n){return this.x/=e,this.y/=t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},i.cross=function(e){var t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,a=e.z;return this.x=i*a-n*s,this.y=n*r-t*a,this.z=t*s-i*r,this},i.length=function(){var e=this.x,t=this.y,i=this.z,n=this.w;return Math.sqrt(e*e+t*t+i*i+n*n)},i.lengthSqr=function(){var e=this.x,t=this.y,i=this.z,n=this.w;return e*e+t*t+i*i+n*n},i.normalize=function(){var e=this.x,t=this.y,i=this.z,n=this.w,r=e*e+t*t+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=e*r,this.y=t*r,this.z=i*r,this.w=n*r),this},i.transformMat4=function(e){var t=this.x,i=this.y,n=this.z,r=this.w;return this.x=e.m00*t+e.m04*i+e.m08*n+e.m12*r,this.y=e.m01*t+e.m05*i+e.m09*n+e.m13*r,this.z=e.m02*t+e.m06*i+e.m10*n+e.m14*r,this.w=e.m03*t+e.m07*i+e.m11*n+e.m15*r,this},t}(Tt));function Vi(e,t,i,n){return new zi(e,t,i,n)}zi.ZERO=Object.freeze(new zi(0,0,0,0)),zi.ONE=Object.freeze(new zi(1,1,1,1)),zi.NEG_ONE=Object.freeze(new zi(-1,-1,-1,-1)),di.fastDefine("cc.Vec4",zi,{x:0,y:0,z:0,w:0}),v.Vec4=zi,v.v4=Vi;var Wi,ji,Xi,Ki=e("cq",function(e){function t(t,i,n){var r;return r=e.call(this)||this,t&&"object"==typeof t?(r.x=t.x,r.y=t.y,r.z=t.z):(r.x=t||0,r.y=i||0,r.z=n||0),r}s(t,e),t.zero=function(e){return e.x=0,e.y=0,e.z=0,e},t.clone=function(e){return new t(e.x,e.y,e.z)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e},t.set=function(e,t,i,n){return e.x=t,e.y=i,e.z=n,e},t.add=function(e,t,i){return e.x=t.x+i.x,e.y=t.y+i.y,e.z=t.z+i.z,e},t.subtract=function(e,t,i){return e.x=t.x-i.x,e.y=t.y-i.y,e.z=t.z-i.z,e},t.multiply=function(e,t,i){return e.x=t.x*i.x,e.y=t.y*i.y,e.z=t.z*i.z,e},t.divide=function(e,t,i){return e.x=t.x/i.x,e.y=t.y/i.y,e.z=t.z/i.z,e},t.ceil=function(e,t){return e.x=Math.ceil(t.x),e.y=Math.ceil(t.y),e.z=Math.ceil(t.z),e},t.floor=function(e,t){return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e},t.min=function(e,t,i){return e.x=Math.min(t.x,i.x),e.y=Math.min(t.y,i.y),e.z=Math.min(t.z,i.z),e},t.max=function(e,t,i){return e.x=Math.max(t.x,i.x),e.y=Math.max(t.y,i.y),e.z=Math.max(t.z,i.z),e},t.round=function(e,t){return e.x=Math.round(t.x),e.y=Math.round(t.y),e.z=Math.round(t.z),e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e.z=t.z+i.z*n,e},t.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z;return Math.sqrt(i*i+n*n+r*r)},t.squaredDistance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z;return i*i+n*n+r*r},t.len=function(e){var t=e.x,i=e.y,n=e.z;return Math.sqrt(t*t+i*i+n*n)},t.lengthSqr=function(e){var t=e.x,i=e.y,n=e.z;return t*t+i*i+n*n},t.negate=function(e,t){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},t.invert=function(e,t){return e.x=1/t.x,e.y=1/t.y,e.z=1/t.z,e},t.invertSafe=function(e,t){var i=t.x,n=t.y,r=t.z;return Math.abs(i)0&&(s=1/Math.sqrt(s),e.x=i*s,e.y=n*s,e.z=r*s),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},t.cross=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.x,o=i.y,u=i.z;return e.x=r*u-s*o,e.y=s*a-n*u,e.z=n*o-r*a,e},t.lerp=function(e,t,i,n){return e.x=t.x+n*(i.x-t.x),e.y=t.y+n*(i.y-t.y),e.z=t.z+n*(i.z-t.z),e},t.random=function(e,t){t=t||1;var i=2*Ni()*Math.PI,n=2*Ni()-1,r=Math.sqrt(1-n*n);return e.x=r*Math.cos(i)*t,e.y=r*Math.sin(i)*t,e.z=n*t,e},t.transformMat4=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?Math.abs(1/a):1,e.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,e.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,e.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,e},t.transformMat4Normal=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?Math.abs(1/a):1,e.x=(i.m00*n+i.m04*r+i.m08*s)*a,e.y=(i.m01*n+i.m05*r+i.m09*s)*a,e.z=(i.m02*n+i.m06*r+i.m10*s)*a,e},t.transformMat3=function(e,t,i){var n=t.x,r=t.y,s=t.z;return e.x=n*i.m00+r*i.m03+s*i.m06,e.y=n*i.m01+r*i.m04+s*i.m07,e.z=n*i.m02+r*i.m05+s*i.m08,e},t.transformAffine=function(e,t,i){var n=t.x,r=t.y,s=t.z;return e.x=i.m00*n+i.m04*r+i.m08*s+i.m12,e.y=i.m01*n+i.m05*r+i.m09*s+i.m13,e.z=i.m02*n+i.m06*r+i.m10*s+i.m14,e},t.transformQuat=function(e,t,i){var n=i.w*t.x+i.y*t.z-i.z*t.y,r=i.w*t.y+i.z*t.x-i.x*t.z,s=i.w*t.z+i.x*t.y-i.y*t.x,a=-i.x*t.x-i.y*t.y-i.z*t.z;return e.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,e.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,e.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,e},t.transformRTS=function(e,t,i,n,r){var s=t.x*r.x,a=t.y*r.y,o=t.z*r.z,u=i.w*s+i.y*o-i.z*a,h=i.w*a+i.z*s-i.x*o,c=i.w*o+i.x*a-i.y*s,l=-i.x*s-i.y*a-i.z*o;return e.x=u*i.w+l*-i.x+h*-i.z-c*-i.y+n.x,e.y=h*i.w+l*-i.y+c*-i.x-u*-i.z+n.y,e.z=c*i.w+l*-i.z+u*-i.y-h*-i.x+n.z,e},t.transformInverseRTS=function(e,t,i,n,r){var s=t.x-n.x,a=t.y-n.y,o=t.z-n.z,u=i.w*s-i.y*o+i.z*a,h=i.w*a-i.z*s+i.x*o,c=i.w*o-i.x*a+i.y*s,l=i.x*s+i.y*a+i.z*o;return e.x=(u*i.w+l*i.x+h*i.z-c*i.y)/r.x,e.y=(h*i.w+l*i.y+c*i.x-u*i.z)/r.y,e.z=(c*i.w+l*i.z+u*i.y-h*i.x)/r.z,e},t.rotateX=function(e,t,i,n){var r=t.x-i.x,s=t.y-i.y,a=t.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r,c=s*o-a*u,l=s*u+a*o;return e.x=h+i.x,e.y=c+i.y,e.z=l+i.z,e},t.rotateY=function(e,t,i,n){var r=t.x-i.x,s=t.y-i.y,a=t.z-i.z,o=Math.cos(n),u=Math.sin(n),h=a*u+r*o,c=s,l=a*o-r*u;return e.x=h+i.x,e.y=c+i.y,e.z=l+i.z,e},t.rotateZ=function(e,t,i,n){var r=t.x-i.x,s=t.y-i.y,a=t.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r*o-s*u,c=r*u+s*o,l=a;return e.x=h+i.x,e.y=c+i.y,e.z=l+i.z,e},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e[i+2]=t.z,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e.z=t[i+2],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z},t.equals=function(e,t,i){void 0===i&&(i=Ti);var n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,u=t.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-u)<=i*Math.max(1,Math.abs(s),Math.abs(u))},t.angle=function(e,i){t.normalize(Yi,e),t.normalize(qi,i);var n=t.dot(Yi,qi);return n>1?0:n<-1?Math.PI:Math.acos(n)},t.projectOnPlane=function(e,i,n){return t.subtract(e,i,t.project(e,i,n))},t.project=function(e,i,n){var r=t.lengthSqr(n);return r<1e-6?t.set(e,0,0,0):t.multiplyScalar(e,n,t.dot(i,n)/r)};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.z)},i.set=function(e,t,i){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z):(this.x=e||0,this.y=t||0,this.z=i||0),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t&&Math.abs(this.y-e.y)<=t&&Math.abs(this.z-e.z)<=t},i.equals3f=function(e,t,i,n){return void 0===n&&(n=Ti),Math.abs(this.x-e)<=n&&Math.abs(this.y-t)<=n&&Math.abs(this.z-i)<=n},i.strictEquals=function(e){return this.x===e.x&&this.y===e.y&&this.z===e.z},i.strictEquals3f=function(e,t,i){return this.x===e&&this.y===t&&this.z===i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},i.lerp=function(e,t){return this.x+=t*(e.x-this.x),this.y+=t*(e.y-this.y),this.z+=t*(e.z-this.z),this},i.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},i.add3f=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},i.subtract=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},i.subtract3f=function(e,t,i){return this.x-=e,this.y-=t,this.z-=i,this},i.multiplyScalar=function(e){return"object"==typeof e&&console.warn("should use Vec3.multiply for vector * vector operation"),this.x*=e,this.y*=e,this.z*=e,this},i.multiply=function(e){return"object"!=typeof e&&console.warn("should use Vec3.scale for vector * scalar operation"),this.x*=e.x,this.y*=e.y,this.z*=e.z,this},i.multiply3f=function(e,t,i){return this.x*=e,this.y*=t,this.z*=i,this},i.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},i.divide3f=function(e,t,i){return this.x/=e,this.y/=t,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(e,t){return this.x=Ri(this.x,e.x,t.x),this.y=Ri(this.y,e.y,t.y),this.z=Ri(this.z,e.z,t.z),this},i.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},i.cross=function(e){var t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,a=e.z;return this.x=i*a-n*s,this.y=n*r-t*a,this.z=t*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 e=this.x,t=this.y,i=this.z,n=e*e+t*t+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=e*n,this.y=t*n,this.z=i*n),this},i.transformMat4=function(e){var t=this.x,i=this.y,n=this.z,r=e.m03*t+e.m07*i+e.m11*n+e.m15;return r=r?1/r:1,this.x=(e.m00*t+e.m04*i+e.m08*n+e.m12)*r,this.y=(e.m01*t+e.m05*i+e.m09*n+e.m13)*r,this.z=(e.m02*t+e.m06*i+e.m10*n+e.m14)*r,this},t}(Tt));Ki.UNIT_X=Object.freeze(new Ki(1,0,0)),Ki.UNIT_Y=Object.freeze(new Ki(0,1,0)),Ki.UNIT_Z=Object.freeze(new Ki(0,0,1)),Ki.RIGHT=Object.freeze(new Ki(1,0,0)),Ki.UP=Object.freeze(new Ki(0,1,0)),Ki.FORWARD=Object.freeze(new Ki(0,0,-1)),Ki.ZERO=Object.freeze(new Ki(0,0,0)),Ki.ONE=Object.freeze(new Ki(1,1,1)),Ki.NEG_ONE=Object.freeze(new Ki(-1,-1,-1)),Ki.slerp=(Wi=new Ki,ji=new Ki,Xi=new Ki,function(e,t,i,n){var r=1e-5,s=Ki.len(t),a=Ki.len(i);if(s.99999)return Ki.lerp(e,t,i,n);if(u<-.99999){var h=Ki.multiplyScalar(Wi,t,1/s),c=function(e,t){var i=t.x,n=t.y,r=t.z,s=Math.abs(i),a=Math.abs(n),o=Math.abs(r);return s>>0)+(e.b<<16)+(e.g<<8)+e.r,i},t.copy=function(e,t){return e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a,e},t.set=function(e,t,i,n,r){return e.r=t,e.g=i,e.b=n,e.a=r,e},t.toVec4=function(e,t){return(t=void 0!==t?t:new zi).x=nn(e.r),t.y=nn(e.g),t.z=nn(e.b),t.w=nn(e.a),t},t.fromVec4=function(e,i){return(i=void 0===i?new t:i).r=rn(e.x),i.g=rn(e.y),i.b=rn(e.z),i.a=rn(e.w),i},t.fromHEX=function(e,t){t=0===t.indexOf("#")?t.substring(1):t,e.r=parseInt(t.substr(0,2),16)||0,e.g=parseInt(t.substr(2,2),16)||0,e.b=parseInt(t.substr(4,2),16)||0;var i=parseInt(t.substr(6,2),16);return e.a=Number.isNaN(i)?255:i,e._val=(e.a<<24>>>0)+(e.b<<16)+(e.g<<8)+e.r,e},t.add=function(e,t,i){return e.r=t.r+i.r,e.g=t.g+i.g,e.b=t.b+i.b,e.a=t.a+i.a,e},t.subtract=function(e,t,i){return e.r=t.r-i.r,e.g=t.g-i.g,e.b=t.b-i.b,e.a=t.a-i.a,e},t.multiply=function(e,t,i){return e.r=t.r*i.r,e.g=t.g*i.g,e.b=t.b*i.b,e.a=t.a*i.a,e},t.divide=function(e,t,i){return e.r=t.r/i.r,e.g=t.g/i.g,e.b=t.b/i.b,e.a=t.a/i.a,e},t.scale=function(e,t,i){return e.r=t.r*i,e.g=t.g*i,e.b=t.b*i,e.a=t.a*i,e},t.lerp=function(e,t,i,n){var r=t.r,s=t.g,a=t.b,o=t.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,e._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),e},t.toArray=function(e,i,n){void 0===n&&(n=0);var r=i instanceof t||i.a>1?1/255:1;return e[n+0]=i.r*r,e[n+1]=i.g*r,e[n+2]=i.b*r,e[n+3]=i.a*r,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),t.r=255*e[i+0],t.g=255*e[i+1],t.b=255*e[i+2],t.a=255*e[i+3],t},t.strictEquals=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.r-t.r)<=i*Math.max(1,Math.abs(e.r),Math.abs(t.r))&&Math.abs(e.g-t.g)<=i*Math.max(1,Math.abs(e.g),Math.abs(t.g))&&Math.abs(e.b-t.b)<=i*Math.max(1,Math.abs(e.b),Math.abs(t.b))&&Math.abs(e.a-t.a)<=i*Math.max(1,Math.abs(e.a),Math.abs(t.a))},t.hex=function(e){return(255*e.r<<24|255*e.g<<16|255*e.b<<8|255*e.a)>>>0};var i=t.prototype;return i.clone=function(){var e=new t;return e._val=this._val,e},i.equals=function(e){return e&&this._val===e._val},i.lerp=function(e,t){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(e.r-i)*t,n+=(e.g-n)*t,r+=(e.b-r)*t,s+=(e.a-s)*t,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(e){return void 0===e&&(e="rgba"),"rgba"===e?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*$i).toFixed(2)+")":"rgb"===e?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(e)},i.fromHEX=function(e){e=0===e.indexOf("#")?e.substring(1):e;var t=parseInt(e.substr(0,2),16)||0,i=parseInt(e.substr(2,2),16)||0,n=parseInt(e.substr(4,2),16)||0,r=parseInt(e.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|t),this},i.toHEX=function(e){void 0===e&&(e="#rrggbb");var t="0",i=[(this.r<16?t:"")+this.r.toString(16),(this.g<16?t:"")+this.g.toString(16),(this.b<16?t:"")+this.b.toString(16)];return"#rgb"===e?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===e&&i.push((this.a<16?t:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(e,t,i){var n=0,r=0,s=0;if(0===t)n=r=s=i;else if(0===i)n=r=s=0;else{1===e&&(e=0),e*=6;var a=Math.floor(e),o=e-a,u=i*(1-t),h=i*(1-t*o),c=i*(1-t*(1-o));switch(a){default:case 0:n=i,r=c,s=u;break;case 1:n=h,r=i,s=u;break;case 2:n=u,r=i,s=c;break;case 3:n=u,r=h,s=i;break;case 4:n=c,r=u,s=i;break;case 5:n=i,r=u,s=h}}return n*=255,r*=255,s*=255,this._val=(this.a<<24>>>0)+(s<<16)+(r<<8)+(0|n),this},i.toHSV=function(){var e=this.r*$i,t=this.g*$i,i=this.b*$i,n={h:0,s:0,v:0},r=Math.max(e,t,i),s=Math.min(e,t,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=e===r?(t-i)/a:t===r?2+(i-e)/a:4+(e-t)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(e,t,i,n){return"object"==typeof e?null!=e._val?this._val=e._val:(t=e.g||0,i=e.b||0,n="number"==typeof e.a?e.a:255,e=e.r||0,this._val=(n<<24>>>0)+(i<<16)+(t<<8)+(0|e)):(e=e||0,t=t||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(t<<8)+(0|e)),this},i.multiply=function(e){var t=(255&this._val)*e.r>>8,i=(65280&this._val)*e.g>>8,n=(16711680&this._val)*e.b>>8,r=((4278190080&this._val)>>>8)*e.a;return this._val=4278190080&r|16711680&n|65280&i|255&t,this},i._set_r_unsafe=function(e){return this._val=(4294967040&this._val|e)>>>0,this},i._set_g_unsafe=function(e){return this._val=(4294902015&this._val|e<<8)>>>0,this},i._set_b_unsafe=function(e){return this._val=(4278255615&this._val|e<<16)>>>0,this},i._set_a_unsafe=function(e){return this._val=(16777215&this._val|e<<24)>>>0,this},n(t,[{key:"r",get:function(){return 255&this._val},set:function(e){e=~~Ri(e,0,255),this._val=(4294967040&this._val|e)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(e){e=~~Ri(e,0,255),this._val=(4294902015&this._val|e<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(e){e=~~Ri(e,0,255),this._val=(4278255615&this._val|e<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(e){e=~~Ri(e,0,255),this._val=(16777215&this._val|e<<24)>>>0}},{key:"x",get:function(){return this.r*$i},set:function(e){this.r=255*e}},{key:"y",get:function(){return this.g*$i},set:function(e){this.g=255*e}},{key:"z",get:function(){return this.b*$i},set:function(e){this.b=255*e}},{key:"w",get:function(){return this.a*$i},set:function(e){this.a=255*e}}]),t}(Tt));function tn(e,t,i,n){return new en(e,t,i,n)}function nn(e){if((0|e)!==e||e>>>8!=0)throw new RangeError("Value out of 8-bit range");return an[e]}function rn(e){if(e<=0)return 0;var t=an;if(e>=1)return t.length-1;for(var i=0,n=t.length>>>1;0!==n;n>>>=1)t[i|n]<=e&&(i|=n);return e-t[i]<=t[i+1]-e?i:i+1}en.WHITE=Object.freeze(new en(255,255,255,255)),en.GRAY=Object.freeze(new en(127,127,127,255)),en.BLACK=Object.freeze(new en(0,0,0,255)),en.TRANSPARENT=Object.freeze(new en(0,0,0,0)),en.RED=Object.freeze(new en(255,0,0,255)),en.GREEN=Object.freeze(new en(0,255,0,255)),en.BLUE=Object.freeze(new en(0,0,255,255)),en.CYAN=Object.freeze(new en(0,255,255,255)),en.MAGENTA=Object.freeze(new en(255,0,255,255)),en.YELLOW=Object.freeze(new en(255,255,0,255)),di.fastDefine("cc.Color",en,{r:0,g:0,b:0,a:255}),v.Color=en,v.color=tn;for(var sn,an=[],on=0;on<256;on++)an.push((sn=on/255)<=0?0:sn>=1?1:sn<.04045?sn/12.92:Math.pow((sn+.055)/1.055,2.4));function un(e){var t=e.clone();return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t}var hn=e("fb",function(e){function t(t,i,n,r,s,a,o,u,h){var c;return void 0===t&&(t=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===u&&(u=0),void 0===h&&(h=1),c=e.call(this)||this,"object"==typeof t?(c.m00=t.m00,c.m01=t.m01,c.m02=t.m02,c.m03=t.m03,c.m04=t.m04,c.m05=t.m05,c.m06=t.m06,c.m07=t.m07,c.m08=t.m08):(c.m00=t,c.m01=i,c.m02=n,c.m03=r,c.m04=s,c.m05=a,c.m06=o,c.m07=u,c.m08=h),c}s(t,e),t.clone=function(e){return new t(e.m00,e.m01,e.m02,e.m03,e.m04,e.m05,e.m06,e.m07,e.m08)},t.copy=function(e,t){return e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e},t.set=function(e,t,i,n,r,s,a,o,u,h){return e.m00=t,e.m01=i,e.m02=n,e.m03=r,e.m04=s,e.m05=a,e.m06=o,e.m07=u,e.m08=h,e},t.identity=function(e){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=1,e.m05=0,e.m06=0,e.m07=0,e.m08=1,e},t.transpose=function(e,t){if(e===t){var i=t.m01,n=t.m02,r=t.m05;e.m01=t.m03,e.m02=t.m06,e.m03=i,e.m05=t.m07,e.m06=n,e.m07=r}else e.m00=t.m00,e.m01=t.m03,e.m02=t.m06,e.m03=t.m01,e.m04=t.m04,e.m05=t.m07,e.m06=t.m02,e.m07=t.m05,e.m08=t.m08;return e},t.invert=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=c*a-o*h,_=-c*s+o*u,d=h*s-a*u,f=i*l+n*_+r*d;return 0===f?(e.m00=0,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=0,e.m06=0,e.m07=0,e.m08=0,e):(f=1/f,e.m00=l*f,e.m01=(-c*n+r*h)*f,e.m02=(o*n-r*a)*f,e.m03=_*f,e.m04=(c*i-r*u)*f,e.m05=(-o*i+r*s)*f,e.m06=d*f,e.m07=(-h*i+n*u)*f,e.m08=(a*i-n*s)*f,e)},t.determinant=function(e){var t=e.m00,i=e.m01,n=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,h=e.m08;return t*(h*s-a*u)+i*(-h*r+a*o)+n*(u*r-s*o)},t.multiply=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,E=i.m08;return e.m00=_*n+d*a+f*h,e.m01=_*r+d*o+f*c,e.m02=_*s+d*u+f*l,e.m03=p*n+m*a+g*h,e.m04=p*r+m*o+g*c,e.m05=p*s+m*u+g*l,e.m06=v*n+y*a+E*h,e.m07=v*r+y*o+E*c,e.m08=v*s+y*u+E*l,e},t.multiplyMat4=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,E=i.m10;return e.m00=_*n+d*a+f*h,e.m01=_*r+d*o+f*c,e.m02=_*s+d*u+f*l,e.m03=p*n+m*a+g*h,e.m04=p*r+m*o+g*c,e.m05=p*s+m*u+g*l,e.m06=v*n+y*a+E*h,e.m07=v*r+y*o+E*c,e.m08=v*s+y*u+E*l,e},t.transform=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=i.x,d=i.y;return e.m00=n,e.m01=r,e.m02=s,e.m03=a,e.m04=o,e.m05=u,e.m06=_*n+d*a+h,e.m07=_*r+d*o+c,e.m08=_*s+d*u+l,e},t.scale=function(e,t,i){var n=i.x,r=i.y;return e.m00=n*t.m00,e.m01=n*t.m01,e.m02=n*t.m02,e.m03=r*t.m03,e.m04=r*t.m04,e.m05=r*t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e},t.rotate=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=Math.sin(i),d=Math.cos(i);return e.m00=d*n+_*a,e.m01=d*r+_*o,e.m02=d*s+_*u,e.m03=d*a-_*n,e.m04=d*o-_*r,e.m05=d*u-_*s,e.m06=h,e.m07=c,e.m08=l,e},t.fromMat4=function(e,t){return e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m04,e.m04=t.m05,e.m05=t.m06,e.m06=t.m08,e.m07=t.m09,e.m08=t.m10,e},t.fromViewUp=function(e,i,n){return Ki.lengthSqr(i)-.999?(t.x=Math.asin(-o),t.y=Math.atan2(a,u),t.z=Math.atan2(n,s),!0):(t.x=yi,t.y=Math.atan2(r,i),t.z=0,!1):(t.x=-yi,t.y=Math.atan2(-r,i),t.z=0,!1)};var i=t.prototype;return i.clone=function(){var e=this;return new t(e.m00,e.m01,e.m02,e.m03,e.m04,e.m05,e.m06,e.m07,e.m08)},i.set=function(e,t,i,n,r,s,a,o,u){return void 0===e&&(e=1),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),"object"==typeof e?(this.m00=e.m00,this.m01=e.m01,this.m02=e.m02,this.m03=e.m03,this.m04=e.m04,this.m05=e.m05,this.m06=e.m06,this.m07=e.m07,this.m08=e.m08):(this.m00=e,this.m01=t,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=u),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.m00-e.m00)<=t*Math.max(1,Math.abs(this.m00),Math.abs(e.m00))&&Math.abs(this.m01-e.m01)<=t*Math.max(1,Math.abs(this.m01),Math.abs(e.m01))&&Math.abs(this.m02-e.m02)<=t*Math.max(1,Math.abs(this.m02),Math.abs(e.m02))&&Math.abs(this.m03-e.m03)<=t*Math.max(1,Math.abs(this.m03),Math.abs(e.m03))&&Math.abs(this.m04-e.m04)<=t*Math.max(1,Math.abs(this.m04),Math.abs(e.m04))&&Math.abs(this.m05-e.m05)<=t*Math.max(1,Math.abs(this.m05),Math.abs(e.m05))&&Math.abs(this.m06-e.m06)<=t*Math.max(1,Math.abs(this.m06),Math.abs(e.m06))&&Math.abs(this.m07-e.m07)<=t*Math.max(1,Math.abs(this.m07),Math.abs(e.m07))&&Math.abs(this.m08-e.m08)<=t*Math.max(1,Math.abs(this.m08),Math.abs(e.m08))},i.strictEquals=function(e){return this.m00===e.m00&&this.m01===e.m01&&this.m02===e.m02&&this.m03===e.m03&&this.m04===e.m04&&this.m05===e.m05&&this.m06===e.m06&&this.m07===e.m07&&this.m08===e.m08},i.toString=function(){var e=this;return"[\n"+e.m00+", "+e.m01+", "+e.m02+",\n"+e.m03+",\n"+e.m04+", "+e.m05+",\n"+e.m06+", "+e.m07+",\n"+e.m08+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=1,this.m05=0,this.m06=0,this.m07=0,this.m08=1,this},i.transpose=function(){var e=this.m01,t=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=e,this.m05=this.m07,this.m06=t,this.m07=i,this},i.invert=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=u*r-s*o,c=-u*n+s*a,l=o*n-r*a,_=e*h+t*c+i*l;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=h*_,this.m01=(-u*t+i*o)*_,this.m02=(s*t-i*r)*_,this.m03=c*_,this.m04=(u*e-i*a)*_,this.m05=(-s*e+i*n)*_,this.m06=l*_,this.m07=(-o*e+t*a)*_,this.m08=(r*e-t*n)*_,this)},i.determinant=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08;return e*(u*r-s*o)+t*(-u*n+s*a)+i*(o*n-r*a)},i.add=function(e){return this.m00+=e.m00,this.m01+=e.m01,this.m02+=e.m02,this.m03+=e.m03,this.m04+=e.m04,this.m05+=e.m05,this.m06+=e.m06,this.m07+=e.m07,this.m08+=e.m08,this},i.subtract=function(e){return this.m00-=e.m00,this.m01-=e.m01,this.m02-=e.m02,this.m03-=e.m03,this.m04-=e.m04,this.m05-=e.m05,this.m06-=e.m06,this.m07-=e.m07,this.m08-=e.m08,this},i.multiply=function(e){var t=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,c=e.m00,l=e.m01,_=e.m02,d=e.m03,f=e.m04,p=e.m05,m=e.m06,g=e.m07,v=e.m08;return this.m00=c*t+l*r+_*o,this.m01=c*i+l*s+_*u,this.m02=c*n+l*a+_*h,this.m03=d*t+f*r+p*o,this.m04=d*i+f*s+p*u,this.m05=d*n+f*a+p*h,this.m06=m*t+g*r+v*o,this.m07=m*i+g*s+v*u,this.m08=m*n+g*a+v*h,this},i.multiplyScalar=function(e){return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=e,this.m05*=e,this.m06*=e,this.m07*=e,this.m08*=e,this},i.scale=function(e){var t=e.x,i=e.y;return this.m00=t*this.m00,this.m01=t*this.m01,this.m02=t*this.m02,this.m03=i*this.m03,this.m04=i*this.m04,this.m05=i*this.m05,this.m06=this.m06,this.m07=this.m07,this.m08=this.m08,this},i.rotate=function(e){var t=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,c=Math.sin(e),l=Math.cos(e);return this.m00=l*t+c*r,this.m01=l*i+c*s,this.m02=l*n+c*a,this.m03=l*r-c*t,this.m04=l*s-c*i,this.m05=l*a-c*n,this.m06=o,this.m07=u,this.m08=h,this},i.fromQuat=function(e){var t=e.x,i=e.y,n=e.z,r=e.w,s=t+t,a=i+i,o=n+n,u=t*s,h=i*s,c=i*a,l=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-c-d,this.m03=h-m,this.m06=l+p,this.m01=h+m,this.m04=1-u-d,this.m07=_-f,this.m02=l-p,this.m05=_+f,this.m08=1-u-c,this},t}(Tt));hn.IDENTITY=Object.freeze(new hn);var cn=new Ki,ln=new Ki;di.fastDefine("cc.Mat3",hn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),v.Mat3=hn;var _n=e("cv",function(e){function t(t,i,n,r){var s;return s=e.call(this)||this,t&&"object"==typeof t?(s.x=t.x,s.y=t.y,s.z=t.z,s.w=t.w):(s.x=t||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}s(t,e),t.clone=function(e){return new t(e.x,e.y,e.z,e.w)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e},t.set=function(e,t,i,n,r){return e.x=t,e.y=i,e.z=n,e.w=r,e},t.identity=function(e){return e.x=0,e.y=0,e.z=0,e.w=1,e},t.rotationTo=function(e,i,n){var r=Ki.dot(i,n);return r<-.999999?(Ki.cross(pn,Ki.UNIT_X,i),pn.length()<1e-6&&Ki.cross(pn,Ki.UNIT_Y,i),Ki.normalize(pn,pn),t.fromAxisAngle(e,pn,Math.PI),e):r>.999999?(e.x=0,e.y=0,e.z=0,e.w=1,e):(Ki.cross(pn,i,n),e.x=pn.x,e.y=pn.y,e.z=pn.z,e.w=1+r,t.normalize(e,e))},t.getAxisAngle=function(e,t){var i=2*Math.acos(t.w),n=Math.sin(i/2);return 0!==n?(e.x=t.x/n,e.y=t.y/n,e.z=t.z/n):(e.x=1,e.y=0,e.z=0),i},t.multiply=function(e,t,i){var n=t.x*i.w+t.w*i.x+t.y*i.z-t.z*i.y,r=t.y*i.w+t.w*i.y+t.z*i.x-t.x*i.z,s=t.z*i.w+t.w*i.z+t.x*i.y-t.y*i.x,a=t.w*i.w-t.x*i.x-t.y*i.y-t.z*i.z;return e.x=n,e.y=r,e.z=s,e.w=a,e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e.w=t.w*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e.z=t.z+i.z*n,e.w=t.w+i.w*n,e},t.rotateX=function(e,t,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r+u*n,e.y=a*r+o*n,e.z=o*r-a*n,e.w=u*r-s*n,e},t.rotateY=function(e,t,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r-o*n,e.y=a*r+u*n,e.z=o*r+s*n,e.w=u*r-a*n,e},t.rotateZ=function(e,t,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r+a*n,e.y=a*r-s*n,e.z=o*r+u*n,e.w=u*r-o*n,e},t.rotateAround=function(e,i,n,r){return t.invert(dn,i),Ki.transformQuat(pn,n,dn),t.fromAxisAngle(dn,pn,r),t.multiply(e,i,dn),e},t.rotateAroundLocal=function(e,i,n,r){return t.fromAxisAngle(dn,n,r),t.multiply(e,i,dn),e},t.calculateW=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=Math.sqrt(Math.abs(1-t.x*t.x-t.y*t.y-t.z*t.z)),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},t.lerp=function(e,t,i,n){return e.x=t.x+n*(i.x-t.x),e.y=t.y+n*(i.y-t.y),e.z=t.z+n*(i.z-t.z),e.w=t.w+n*(i.w-t.w),e},t.slerp=function(e,t,i,n){var r=0,s=0,a=i.x,o=i.y,u=i.z,h=i.w,c=t.x*i.x+t.y*i.y+t.z*i.z+t.w*i.w;if(c<0&&(c=-c,a=-a,o=-o,u=-u,h=-h),1-c>1e-6){var l=Math.acos(c),_=Math.sin(l);r=Math.sin((1-n)*l)/_,s=Math.sin(n*l)/_}else r=1-n,s=n;return e.x=r*t.x+s*a,e.y=r*t.y+s*o,e.z=r*t.z+s*u,e.w=r*t.w+s*h,e},t.sqlerp=function(e,i,n,r,s,a){return t.slerp(dn,i,s,a),t.slerp(fn,n,r,a),t.slerp(e,dn,fn,2*a*(1-a)),e},t.invert=function(e,t){var i=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w,n=i?1/i:0;return e.x=-t.x*n,e.y=-t.y*n,e.z=-t.z*n,e.w=t.w*n,e},t.conjugate=function(e,t){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=t.w,e},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w)},t.lengthSqr=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},t.normalize=function(e,t){var i=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w;return i>0&&(i=1/Math.sqrt(i),e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e.w=t.w*i),e},t.fromAxes=function(e,i,n,r){return hn.set(mn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),t.normalize(e,t.fromMat3(e,mn))},t.fromViewUp=function(e,i,n){return hn.fromViewUp(mn,i,n),t.normalize(e,t.fromMat3(e,mn))},t.fromAxisAngle=function(e,t,i){i*=.5;var n=Math.sin(i);return e.x=n*t.x,e.y=n*t.y,e.z=n*t.z,e.w=Math.cos(i),e},t.fromMat3=function(e,t){var i=t.m00,n=t.m03,r=t.m06,s=t.m01,a=t.m04,o=t.m07,u=t.m02,h=t.m05,c=t.m08,l=i+a+c;if(l>0){var _=.5/Math.sqrt(l+1);e.w=.25/_,e.x=(h-o)*_,e.y=(r-u)*_,e.z=(s-n)*_}else if(i>a&&i>c){var d=2*Math.sqrt(1+i-a-c);e.w=(h-o)/d,e.x=.25*d,e.y=(n+s)/d,e.z=(r+u)/d}else if(a>c){var f=2*Math.sqrt(1+a-i-c);e.w=(r-u)/f,e.x=(n+s)/f,e.y=.25*f,e.z=(o+h)/f}else{var p=2*Math.sqrt(1+c-i-a);e.w=(s-n)/p,e.x=(r+u)/p,e.y=(o+h)/p,e.z=.25*p}return e},t.fromEuler=function(e,t,i,n){t*=gn,i*=gn,n*=gn;var r=Math.sin(t),s=Math.cos(t),a=Math.sin(i),o=Math.cos(i),u=Math.sin(n),h=Math.cos(n);return e.x=r*o*h+s*a*u,e.y=s*a*h+r*o*u,e.z=s*o*u-r*a*h,e.w=s*o*h-r*a*u,e},t.fromAngleZ=function(e,t){return t*=gn,e.x=e.y=0,e.z=Math.sin(t),e.w=Math.cos(t),e},t.toAxisX=function(e,t){var i=2*t.y,n=2*t.z;return e.x=1-i*t.y-n*t.z,e.y=i*t.x+n*t.w,e.z=n*t.x+i*t.w,e},t.toAxisY=function(e,t){var i=2*t.x,n=2*t.y,r=2*t.z;return e.x=n*t.x-r*t.w,e.y=1-i*t.x-r*t.z,e.z=r*t.y+i*t.w,e},t.toAxisZ=function(e,t){var i=2*t.x,n=2*t.y,r=2*t.z;return e.x=r*t.x-n*t.w,e.y=r*t.y-i*t.w,e.z=1-i*t.x-n*t.y,e},t.toEuler=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=0,u=0,h=0,c=n*r+s*a;if(c>.499999)o=0,u=Oi(2*Math.atan2(n,a)),h=90;else if(c<-.499999)o=0,u=-Oi(2*Math.atan2(n,a)),h=-90;else{var l=n*n,_=r*r,d=s*s;o=Oi(Math.atan2(2*n*a-2*r*s,1-2*l-2*d)),u=Oi(Math.atan2(2*r*a-2*n*s,1-2*_-2*d)),h=Oi(Math.asin(2*c)),i&&(o=-180*Math.sign(o+1e-6)+o,u=-180*Math.sign(u+1e-6)+u,h=180*Math.sign(h+1e-6)-h)}return e.x=o,e.y=u,e.z=h,e},t.toEulerInYXZOrder=function(e,t){hn.fromQuat(mn,t),hn.toEuler(mn,e),e.x=Oi(e.x),e.y=Oi(e.y),e.z=Oi(e.z)},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e[i+2]=t.z,e[i+3]=t.w,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e.z=t[i+2],e.w=t[i+3],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.x-t.x)<=i*Math.max(1,Math.abs(e.x),Math.abs(t.x))&&Math.abs(e.y-t.y)<=i*Math.max(1,Math.abs(e.y),Math.abs(t.y))&&Math.abs(e.z-t.z)<=i*Math.max(1,Math.abs(e.z),Math.abs(t.z))&&Math.abs(e.w-t.w)<=i*Math.max(1,Math.abs(e.w),Math.abs(t.w))};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.z,this.w)},i.set=function(e,t,i,n){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x=e||0,this.y=t||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t*Math.max(1,Math.abs(this.x),Math.abs(e.x))&&Math.abs(this.y-e.y)<=t*Math.max(1,Math.abs(this.y),Math.abs(e.y))&&Math.abs(this.z-e.z)<=t*Math.max(1,Math.abs(this.z),Math.abs(e.z))&&Math.abs(this.w-e.w)<=t*Math.max(1,Math.abs(this.w),Math.abs(e.w))},i.strictEquals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},i.getEulerAngles=function(e){return t.toEuler(e,this)},i.lerp=function(e,t){return this.x+=t*(e.x-this.x),this.y+=t*(e.y-this.y),this.z+=t*(e.z-this.z),this.w+=t*(e.w-this.w),this},i.slerp=function(e,i){return t.slerp(this,this,e,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},t}(Tt));_n.IDENTITY=Object.freeze(new _n);var dn=new _n,fn=new _n,pn=new Ki,mn=new hn,gn=.5*Math.PI/180;function vn(e,t,i,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),new _n(e,t,i,n)}di.fastDefine("cc.Quat",_n,{x:0,y:0,z:0,w:1}),v.Quat=_n,v.quat=vn;var yn=e("fw",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])])),En=e("bs",function(e){function t(t,i,n,r,s,a,o,u,h,c,l,_,d,f,p,m){var g;return void 0===t&&(t=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===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=0),void 0===l&&(l=1),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===m&&(m=1),g=e.call(this)||this,"object"==typeof t?(g.m00=t.m00,g.m01=t.m01,g.m02=t.m02,g.m03=t.m03,g.m04=t.m04,g.m05=t.m05,g.m06=t.m06,g.m07=t.m07,g.m08=t.m08,g.m09=t.m09,g.m10=t.m10,g.m11=t.m11,g.m12=t.m12,g.m13=t.m13,g.m14=t.m14,g.m15=t.m15):(g.m00=t,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=a,g.m06=o,g.m07=u,g.m08=h,g.m09=c,g.m10=l,g.m11=_,g.m12=d,g.m13=f,g.m14=p,g.m15=m),g}s(t,e),t.clone=function(e){return new t(e.m00,e.m01,e.m02,e.m03,e.m04,e.m05,e.m06,e.m07,e.m08,e.m09,e.m10,e.m11,e.m12,e.m13,e.m14,e.m15)},t.copy=function(e,t){return e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e.m09=t.m09,e.m10=t.m10,e.m11=t.m11,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15,e},t.set=function(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p,m){return e.m00=t,e.m01=i,e.m02=n,e.m03=r,e.m04=s,e.m05=a,e.m06=o,e.m07=u,e.m08=h,e.m09=c,e.m10=l,e.m11=_,e.m12=d,e.m13=f,e.m14=p,e.m15=m,e},t.identity=function(e){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=1,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=1,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.transpose=function(e,t){if(e===t){var i=t.m01,n=t.m02,r=t.m03,s=t.m06,a=t.m07,o=t.m11;e.m01=t.m04,e.m02=t.m08,e.m03=t.m12,e.m04=i,e.m06=t.m09,e.m07=t.m13,e.m08=n,e.m09=s,e.m11=t.m14,e.m12=r,e.m13=a,e.m14=o}else e.m00=t.m00,e.m01=t.m04,e.m02=t.m08,e.m03=t.m12,e.m04=t.m01,e.m05=t.m05,e.m06=t.m09,e.m07=t.m13,e.m08=t.m02,e.m09=t.m06,e.m10=t.m10,e.m11=t.m14,e.m12=t.m03,e.m13=t.m07,e.m14=t.m11,e.m15=t.m15;return e},t.invert=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=t.m09,_=t.m10,d=t.m11,f=t.m12,p=t.m13,m=t.m14,g=t.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,A=n*h-s*o,S=r*h-s*u,R=c*p-l*f,w=c*m-_*f,I=c*g-d*f,b=l*m-_*p,O=l*g-d*p,N=_*g-d*m,C=v*N-y*O+E*b+T*I-A*w+S*R;return 0===C?(e.m00=0,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=0,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=0,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=0,e):(C=1/C,e.m00=(o*N-u*O+h*b)*C,e.m01=(r*O-n*N-s*b)*C,e.m02=(p*S-m*A+g*T)*C,e.m03=(_*A-l*S-d*T)*C,e.m04=(u*I-a*N-h*w)*C,e.m05=(i*N-r*I+s*w)*C,e.m06=(m*E-f*S-g*y)*C,e.m07=(c*S-_*E+d*y)*C,e.m08=(a*O-o*I+h*R)*C,e.m09=(n*I-i*O-s*R)*C,e.m10=(f*A-p*E+g*v)*C,e.m11=(l*E-c*A-d*v)*C,e.m12=(o*w-a*b-u*R)*C,e.m13=(i*b-n*w+r*R)*C,e.m14=(p*y-f*T-m*v)*C,e.m15=(c*T-l*y+_*v)*C,e)},t.determinant=function(e){var t=e.m00,i=e.m01,n=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,h=e.m08,c=e.m09,l=e.m10,_=e.m11,d=e.m12,f=e.m13,p=e.m14,m=e.m15;return(t*a-i*s)*(l*m-_*p)-(t*o-n*s)*(c*m-_*f)+(t*u-r*s)*(c*p-l*f)+(i*o-n*a)*(h*m-_*d)-(i*u-r*a)*(h*p-l*d)+(n*u-r*o)*(h*f-c*d)},t.multiply=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=t.m09,d=t.m10,f=t.m11,p=t.m12,m=t.m13,g=t.m14,v=t.m15,y=i.m00,E=i.m01,T=i.m02,A=i.m03;return e.m00=y*n+E*o+T*l+A*p,e.m01=y*r+E*u+T*_+A*m,e.m02=y*s+E*h+T*d+A*g,e.m03=y*a+E*c+T*f+A*v,y=i.m04,E=i.m05,T=i.m06,A=i.m07,e.m04=y*n+E*o+T*l+A*p,e.m05=y*r+E*u+T*_+A*m,e.m06=y*s+E*h+T*d+A*g,e.m07=y*a+E*c+T*f+A*v,y=i.m08,E=i.m09,T=i.m10,A=i.m11,e.m08=y*n+E*o+T*l+A*p,e.m09=y*r+E*u+T*_+A*m,e.m10=y*s+E*h+T*d+A*g,e.m11=y*a+E*c+T*f+A*v,y=i.m12,E=i.m13,T=i.m14,A=i.m15,e.m12=y*n+E*o+T*l+A*p,e.m13=y*r+E*u+T*_+A*m,e.m14=y*s+E*h+T*d+A*g,e.m15=y*a+E*c+T*f+A*v,e},t.transform=function(e,t,i){var n=i.x,r=i.y,s=i.z;if(t===e)e.m12=t.m00*n+t.m04*r+t.m08*s+t.m12,e.m13=t.m01*n+t.m05*r+t.m09*s+t.m13,e.m14=t.m02*n+t.m06*r+t.m10*s+t.m14,e.m15=t.m03*n+t.m07*r+t.m11*s+t.m15;else{var a=t.m00,o=t.m01,u=t.m02,h=t.m03,c=t.m04,l=t.m05,_=t.m06,d=t.m07,f=t.m08,p=t.m09,m=t.m10,g=t.m11;t.m12,t.m13,t.m14,t.m15,e.m00=a,e.m01=o,e.m02=u,e.m03=h,e.m04=c,e.m05=l,e.m06=_,e.m07=d,e.m08=f,e.m09=p,e.m10=m,e.m11=g,e.m12=a*n+c*r+f*s+t.m12,e.m13=o*n+l*r+p*s+t.m13,e.m14=u*n+_*r+m*s+t.m14,e.m15=h*n+d*r+g*s+t.m15}return e},t.translate=function(e,t,i){return t===e?(e.m12+=i.x,e.m13+=i.y,e.m14+=i.z):(e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e.m09=t.m09,e.m10=t.m10,e.m11=t.m11,e.m12+=i.x,e.m13+=i.y,e.m14+=i.z,e.m15=t.m15),e},t.scale=function(e,t,i){var n=i.x,r=i.y,s=i.z;return e.m00=t.m00*n,e.m01=t.m01*n,e.m02=t.m02*n,e.m03=t.m03*n,e.m04=t.m04*r,e.m05=t.m05*r,e.m06=t.m06*r,e.m07=t.m07*r,e.m08=t.m08*s,e.m09=t.m09*s,e.m10=t.m10*s,e.m11=t.m11*s,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15,e},t.rotate=function(e,t,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),e.w=.25*n,e.x=(t.m06-t.m09)/n,e.y=(t.m08-t.m02)/n,e.z=(t.m01-t.m04)/n):t.m00>t.m05&&t.m00>t.m10?(n=2*Math.sqrt(1+t.m00-t.m05-t.m10),e.w=(t.m06-t.m09)/n,e.x=.25*n,e.y=(t.m01+t.m04)/n,e.z=(t.m08+t.m02)/n):t.m05>t.m10?(n=2*Math.sqrt(1+t.m05-t.m00-t.m10),e.w=(t.m08-t.m02)/n,e.x=(t.m01+t.m04)/n,e.y=.25*n,e.z=(t.m06+t.m09)/n):(n=2*Math.sqrt(1+t.m10-t.m00-t.m05),e.w=(t.m01-t.m04)/n,e.x=(t.m08+t.m02)/n,e.y=(t.m06+t.m09)/n,e.z=.25*n),e},t.toRTS=function(e,t,i,n){var r=Ki.set(Tn,e.m00,e.m01,e.m02).length(),s=Ki.set(Tn,e.m04,e.m05,e.m06).length(),a=Ki.set(Tn,e.m08,e.m09,e.m10).length();n&&(n.x=r,n.y=s,n.z=a),i&&Ki.set(i,e.m12,e.m13,e.m14),t&&(An.m00=e.m00/r,An.m01=e.m01/r,An.m02=e.m02/r,An.m03=e.m04/s,An.m04=e.m05/s,An.m05=e.m06/s,An.m06=e.m08/a,An.m07=e.m09/a,An.m08=e.m10/a,hn.determinant(An)<0&&(n&&(n.x*=-1),An.m00*=-1,An.m01*=-1,An.m02*=-1),_n.fromMat3(t,An))},t.fromRTS=function(e,t,i,n){var r=t.x,s=t.y,a=t.z,o=t.w,u=r+r,h=s+s,c=a+a,l=r*u,_=r*h,d=r*c,f=s*h,p=s*c,m=a*c,g=o*u,v=o*h,y=o*c,E=n.x,T=n.y,A=n.z;return e.m00=(1-(f+m))*E,e.m01=(_+y)*E,e.m02=(d-v)*E,e.m03=0,e.m04=(_-y)*T,e.m05=(1-(l+m))*T,e.m06=(p+g)*T,e.m07=0,e.m08=(d+v)*A,e.m09=(p-g)*A,e.m10=(1-(l+f))*A,e.m11=0,e.m12=i.x,e.m13=i.y,e.m14=i.z,e.m15=1,e},t.fromRTSOrigin=function(e,t,i,n,r){var s=t.x,a=t.y,o=t.z,u=t.w,h=s+s,c=a+a,l=o+o,_=s*h,d=s*c,f=s*l,p=a*c,m=a*l,g=o*l,v=u*h,y=u*c,E=u*l,T=n.x,A=n.y,S=n.z,R=r.x,w=r.y,I=r.z;return e.m00=(1-(p+g))*T,e.m01=(d+E)*T,e.m02=(f-y)*T,e.m03=0,e.m04=(d-E)*A,e.m05=(1-(_+g))*A,e.m06=(m+v)*A,e.m07=0,e.m08=(f+y)*S,e.m09=(m-v)*S,e.m10=(1-(_+p))*S,e.m11=0,e.m12=i.x+R-(e.m00*R+e.m04*w+e.m08*I),e.m13=i.y+w-(e.m01*R+e.m05*w+e.m09*I),e.m14=i.z+I-(e.m02*R+e.m06*w+e.m10*I),e.m15=1,e},t.fromQuat=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w,a=i+i,o=n+n,u=r+r,h=i*a,c=n*a,l=n*o,_=r*a,d=r*o,f=r*u,p=s*a,m=s*o,g=s*u;return e.m00=1-l-f,e.m01=c+g,e.m02=_-m,e.m03=0,e.m04=c-g,e.m05=1-h-f,e.m06=d+p,e.m07=0,e.m08=_+m,e.m09=d-p,e.m10=1-h-l,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.frustum=function(e,t,i,n,r,s,a){var o=1/(i-t),u=1/(r-n),h=1/(s-a);return e.m00=2*s*o,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=2*s*u,e.m06=0,e.m07=0,e.m08=(i+t)*o,e.m09=(r+n)*u,e.m10=(a+s)*h,e.m11=-1,e.m12=0,e.m13=0,e.m14=a*s*2*h,e.m15=0,e},t.perspective=function(e,t,i,n,r,s,a,o,u){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===u&&(u=0);var h=1/Math.tan(t/2),c=1/(n-r),l=s?h/i:h,_=(s?h:h*i)*o,d=yn[u];return e.m00=l*d[0],e.m01=l*d[1],e.m02=0,e.m03=0,e.m04=_*d[2],e.m05=_*d[3],e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=(r-a*n)*c,e.m11=-1,e.m12=0,e.m13=0,e.m14=r*n*c*(1-a),e.m15=0,e},t.ortho=function(e,t,i,n,r,s,a,o,u,h){void 0===o&&(o=-1),void 0===u&&(u=1),void 0===h&&(h=0);var c=1/(t-i),l=1/(n-r)*u,_=1/(s-a),d=-2*c,f=-2*l,p=(t+i)*c,m=(r+n)*l,g=yn[h];return e.m00=d*g[0],e.m01=d*g[1],e.m02=0,e.m03=0,e.m04=f*g[2],e.m05=f*g[3],e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=_*(1-o),e.m11=0,e.m12=p*g[0]+m*g[2],e.m13=p*g[1]+m*g[3],e.m14=(s-o*a)*_,e.m15=1,e},t.lookAt=function(e,t,i,n){var r=t.x,s=t.y,a=t.z,o=n.x,u=n.y,h=n.z,c=r-i.x,l=s-i.y,_=a-i.z,d=1/Math.sqrt(c*c+l*l+_*_),f=u*(_*=d)-h*(l*=d),p=h*(c*=d)-o*_,m=o*l-u*c,g=l*(m*=d=1/Math.sqrt(f*f+p*p+m*m))-_*(p*=d),v=_*(f*=d)-c*m,y=c*p-l*f;return e.m00=f,e.m01=g,e.m02=c,e.m03=0,e.m04=p,e.m05=v,e.m06=l,e.m07=0,e.m08=m,e.m09=y,e.m10=_,e.m11=0,e.m12=-(f*r+p*s+m*a),e.m13=-(g*r+v*s+y*a),e.m14=-(c*r+l*s+_*a),e.m15=1,e},t.inverseTranspose=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=t.m09,_=t.m10,d=t.m11,f=t.m12,p=t.m13,m=t.m14,g=t.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,A=n*h-s*o,S=r*h-s*u,R=c*p-l*f,w=c*m-_*f,I=c*g-d*f,b=l*m-_*p,O=l*g-d*p,N=_*g-d*m,C=v*N-y*O+E*b+T*I-A*w+S*R;return C?(C=1/C,e.m00=(o*N-u*O+h*b)*C,e.m01=(u*I-a*N-h*w)*C,e.m02=(a*O-o*I+h*R)*C,e.m03=0,e.m04=(r*O-n*N-s*b)*C,e.m05=(i*N-r*I+s*w)*C,e.m06=(n*I-i*O-s*R)*C,e.m07=0,e.m08=(p*S-m*A+g*T)*C,e.m09=(m*E-f*S-g*y)*C,e.m10=(f*A-p*E+g*v)*C,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e):null},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.m00,e[i+1]=t.m01,e[i+2]=t.m02,e[i+3]=t.m03,e[i+4]=t.m04,e[i+5]=t.m05,e[i+6]=t.m06,e[i+7]=t.m07,e[i+8]=t.m08,e[i+9]=t.m09,e[i+10]=t.m10,e[i+11]=t.m11,e[i+12]=t.m12,e[i+13]=t.m13,e[i+14]=t.m14,e[i+15]=t.m15,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.m00=t[i+0],e.m01=t[i+1],e.m02=t[i+2],e.m03=t[i+3],e.m04=t[i+4],e.m05=t[i+5],e.m06=t[i+6],e.m07=t[i+7],e.m08=t[i+8],e.m09=t[i+9],e.m10=t[i+10],e.m11=t[i+11],e.m12=t[i+12],e.m13=t[i+13],e.m14=t[i+14],e.m15=t[i+15],e},t.add=function(e,t,i){return e.m00=t.m00+i.m00,e.m01=t.m01+i.m01,e.m02=t.m02+i.m02,e.m03=t.m03+i.m03,e.m04=t.m04+i.m04,e.m05=t.m05+i.m05,e.m06=t.m06+i.m06,e.m07=t.m07+i.m07,e.m08=t.m08+i.m08,e.m09=t.m09+i.m09,e.m10=t.m10+i.m10,e.m11=t.m11+i.m11,e.m12=t.m12+i.m12,e.m13=t.m13+i.m13,e.m14=t.m14+i.m14,e.m15=t.m15+i.m15,e},t.subtract=function(e,t,i){return e.m00=t.m00-i.m00,e.m01=t.m01-i.m01,e.m02=t.m02-i.m02,e.m03=t.m03-i.m03,e.m04=t.m04-i.m04,e.m05=t.m05-i.m05,e.m06=t.m06-i.m06,e.m07=t.m07-i.m07,e.m08=t.m08-i.m08,e.m09=t.m09-i.m09,e.m10=t.m10-i.m10,e.m11=t.m11-i.m11,e.m12=t.m12-i.m12,e.m13=t.m13-i.m13,e.m14=t.m14-i.m14,e.m15=t.m15-i.m15,e},t.multiplyScalar=function(e,t,i){return e.m00=t.m00*i,e.m01=t.m01*i,e.m02=t.m02*i,e.m03=t.m03*i,e.m04=t.m04*i,e.m05=t.m05*i,e.m06=t.m06*i,e.m07=t.m07*i,e.m08=t.m08*i,e.m09=t.m09*i,e.m10=t.m10*i,e.m11=t.m11*i,e.m12=t.m12*i,e.m13=t.m13*i,e.m14=t.m14*i,e.m15=t.m15*i,e},t.multiplyScalarAndAdd=function(e,t,i,n){return e.m00=t.m00+i.m00*n,e.m01=t.m01+i.m01*n,e.m02=t.m02+i.m02*n,e.m03=t.m03+i.m03*n,e.m04=t.m04+i.m04*n,e.m05=t.m05+i.m05*n,e.m06=t.m06+i.m06*n,e.m07=t.m07+i.m07*n,e.m08=t.m08+i.m08*n,e.m09=t.m09+i.m09*n,e.m10=t.m10+i.m10*n,e.m11=t.m11+i.m11*n,e.m12=t.m12+i.m12*n,e.m13=t.m13+i.m13*n,e.m14=t.m14+i.m14*n,e.m15=t.m15+i.m15*n,e},t.strictEquals=function(e,t){return e.m00===t.m00&&e.m01===t.m01&&e.m02===t.m02&&e.m03===t.m03&&e.m04===t.m04&&e.m05===t.m05&&e.m06===t.m06&&e.m07===t.m07&&e.m08===t.m08&&e.m09===t.m09&&e.m10===t.m10&&e.m11===t.m11&&e.m12===t.m12&&e.m13===t.m13&&e.m14===t.m14&&e.m15===t.m15},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.m00-t.m00)<=i*Math.max(1,Math.abs(e.m00),Math.abs(t.m00))&&Math.abs(e.m01-t.m01)<=i*Math.max(1,Math.abs(e.m01),Math.abs(t.m01))&&Math.abs(e.m02-t.m02)<=i*Math.max(1,Math.abs(e.m02),Math.abs(t.m02))&&Math.abs(e.m03-t.m03)<=i*Math.max(1,Math.abs(e.m03),Math.abs(t.m03))&&Math.abs(e.m04-t.m04)<=i*Math.max(1,Math.abs(e.m04),Math.abs(t.m04))&&Math.abs(e.m05-t.m05)<=i*Math.max(1,Math.abs(e.m05),Math.abs(t.m05))&&Math.abs(e.m06-t.m06)<=i*Math.max(1,Math.abs(e.m06),Math.abs(t.m06))&&Math.abs(e.m07-t.m07)<=i*Math.max(1,Math.abs(e.m07),Math.abs(t.m07))&&Math.abs(e.m08-t.m08)<=i*Math.max(1,Math.abs(e.m08),Math.abs(t.m08))&&Math.abs(e.m09-t.m09)<=i*Math.max(1,Math.abs(e.m09),Math.abs(t.m09))&&Math.abs(e.m10-t.m10)<=i*Math.max(1,Math.abs(e.m10),Math.abs(t.m10))&&Math.abs(e.m11-t.m11)<=i*Math.max(1,Math.abs(e.m11),Math.abs(t.m11))&&Math.abs(e.m12-t.m12)<=i*Math.max(1,Math.abs(e.m12),Math.abs(t.m12))&&Math.abs(e.m13-t.m13)<=i*Math.max(1,Math.abs(e.m13),Math.abs(t.m13))&&Math.abs(e.m14-t.m14)<=i*Math.max(1,Math.abs(e.m14),Math.abs(t.m14))&&Math.abs(e.m15-t.m15)<=i*Math.max(1,Math.abs(e.m15),Math.abs(t.m15))};var i=t.prototype;return i.clone=function(){return new t(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(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p){return void 0===e&&(e=1),void 0===t&&(t=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===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),"object"==typeof e?(this.m01=e.m01,this.m02=e.m02,this.m03=e.m03,this.m04=e.m04,this.m05=e.m05,this.m06=e.m06,this.m07=e.m07,this.m08=e.m08,this.m09=e.m09,this.m10=e.m10,this.m11=e.m11,this.m12=e.m12,this.m13=e.m13,this.m14=e.m14,this.m15=e.m15,this.m00=e.m00):(this.m01=t,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=u,this.m09=h,this.m10=c,this.m11=l,this.m12=_,this.m13=d,this.m14=f,this.m15=p,this.m00=e),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.m00-e.m00)<=t*Math.max(1,Math.abs(this.m00),Math.abs(e.m00))&&Math.abs(this.m01-e.m01)<=t*Math.max(1,Math.abs(this.m01),Math.abs(e.m01))&&Math.abs(this.m02-e.m02)<=t*Math.max(1,Math.abs(this.m02),Math.abs(e.m02))&&Math.abs(this.m03-e.m03)<=t*Math.max(1,Math.abs(this.m03),Math.abs(e.m03))&&Math.abs(this.m04-e.m04)<=t*Math.max(1,Math.abs(this.m04),Math.abs(e.m04))&&Math.abs(this.m05-e.m05)<=t*Math.max(1,Math.abs(this.m05),Math.abs(e.m05))&&Math.abs(this.m06-e.m06)<=t*Math.max(1,Math.abs(this.m06),Math.abs(e.m06))&&Math.abs(this.m07-e.m07)<=t*Math.max(1,Math.abs(this.m07),Math.abs(e.m07))&&Math.abs(this.m08-e.m08)<=t*Math.max(1,Math.abs(this.m08),Math.abs(e.m08))&&Math.abs(this.m09-e.m09)<=t*Math.max(1,Math.abs(this.m09),Math.abs(e.m09))&&Math.abs(this.m10-e.m10)<=t*Math.max(1,Math.abs(this.m10),Math.abs(e.m10))&&Math.abs(this.m11-e.m11)<=t*Math.max(1,Math.abs(this.m11),Math.abs(e.m11))&&Math.abs(this.m12-e.m12)<=t*Math.max(1,Math.abs(this.m12),Math.abs(e.m12))&&Math.abs(this.m13-e.m13)<=t*Math.max(1,Math.abs(this.m13),Math.abs(e.m13))&&Math.abs(this.m14-e.m14)<=t*Math.max(1,Math.abs(this.m14),Math.abs(e.m14))&&Math.abs(this.m15-e.m15)<=t*Math.max(1,Math.abs(this.m15),Math.abs(e.m15))},i.strictEquals=function(e){return this.m00===e.m00&&this.m01===e.m01&&this.m02===e.m02&&this.m03===e.m03&&this.m04===e.m04&&this.m05===e.m05&&this.m06===e.m06&&this.m07===e.m07&&this.m08===e.m08&&this.m09===e.m09&&this.m10===e.m10&&this.m11===e.m11&&this.m12===e.m12&&this.m13===e.m13&&this.m14===e.m14&&this.m15===e.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 e=this.m01,t=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=e,this.m06=this.m09,this.m07=this.m13,this.m08=t,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15,m=e*s-t*r,g=e*a-i*r,v=e*o-n*r,y=t*a-i*s,E=t*o-n*s,T=i*o-n*a,A=u*d-h*_,S=u*f-c*_,R=u*p-l*_,w=h*f-c*d,I=h*p-l*d,b=c*p-l*f,O=m*b-g*I+v*w+y*R-E*S+T*A;return 0===O?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(O=1/O,this.m00=(s*b-a*I+o*w)*O,this.m01=(i*I-t*b-n*w)*O,this.m02=(d*T-f*E+p*y)*O,this.m03=(c*E-h*T-l*y)*O,this.m04=(a*R-r*b-o*S)*O,this.m05=(e*b-i*R+n*S)*O,this.m06=(f*v-_*T-p*g)*O,this.m07=(u*T-c*v+l*g)*O,this.m08=(r*I-s*R+o*A)*O,this.m09=(t*R-e*I-n*A)*O,this.m10=(_*E-d*v+p*m)*O,this.m11=(h*v-u*E-l*m)*O,this.m12=(s*S-r*w-a*A)*O,this.m13=(e*w-t*S+i*A)*O,this.m14=(d*g-_*y-f*m)*O,this.m15=(u*y-h*g+c*m)*O,this)},i.determinant=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15;return(e*s-t*r)*(c*p-l*f)-(e*a-i*r)*(h*p-l*d)+(e*o-n*r)*(h*f-c*d)+(t*a-i*s)*(u*p-l*_)-(t*o-n*s)*(u*f-c*_)+(i*o-n*a)*(u*d-h*_)},i.add=function(e){return this.m00+=e.m00,this.m01+=e.m01,this.m02+=e.m02,this.m03+=e.m03,this.m04+=e.m04,this.m05+=e.m05,this.m06+=e.m06,this.m07+=e.m07,this.m08+=e.m08,this.m09+=e.m09,this.m10+=e.m10,this.m11+=e.m11,this.m12+=e.m12,this.m13+=e.m13,this.m14+=e.m14,this.m15+=e.m15,this},i.subtract=function(e){return this.m00-=e.m00,this.m01-=e.m01,this.m02-=e.m02,this.m03-=e.m03,this.m04-=e.m04,this.m05-=e.m05,this.m06-=e.m06,this.m07-=e.m07,this.m08-=e.m08,this.m09-=e.m09,this.m10-=e.m10,this.m11-=e.m11,this.m12-=e.m12,this.m13-=e.m13,this.m14-=e.m14,this.m15-=e.m15,this},i.multiply=function(e){var t=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,c=this.m09,l=this.m10,_=this.m11,d=this.m12,f=this.m13,p=this.m14,m=this.m15,g=e.m00,v=e.m01,y=e.m02,E=e.m03;return this.m00=g*t+v*s+y*h+E*d,this.m01=g*i+v*a+y*c+E*f,this.m02=g*n+v*o+y*l+E*p,this.m03=g*r+v*u+y*_+E*m,g=e.m04,v=e.m05,y=e.m06,E=e.m07,this.m04=g*t+v*s+y*h+E*d,this.m05=g*i+v*a+y*c+E*f,this.m06=g*n+v*o+y*l+E*p,this.m07=g*r+v*u+y*_+E*m,g=e.m08,v=e.m09,y=e.m10,E=e.m11,this.m08=g*t+v*s+y*h+E*d,this.m09=g*i+v*a+y*c+E*f,this.m10=g*n+v*o+y*l+E*p,this.m11=g*r+v*u+y*_+E*m,g=e.m12,v=e.m13,y=e.m14,E=e.m15,this.m12=g*t+v*s+y*h+E*d,this.m13=g*i+v*a+y*c+E*f,this.m14=g*n+v*o+y*l+E*p,this.m15=g*r+v*u+y*_+E*m,this},i.multiplyScalar=function(e){return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=e,this.m05*=e,this.m06*=e,this.m07*=e,this.m08*=e,this.m09*=e,this.m10*=e,this.m11*=e,this.m12*=e,this.m13*=e,this.m14*=e,this.m15*=e,this},i.translate=function(e){return this.m12+=e.x,this.m13+=e.y,this.m14+=e.z,this},i.scale=function(e){var t=e.x,i=e.y,n=e.z;return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,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(e,t){var i=t.x,n=t.y,r=t.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)0?(i=2*Math.sqrt(t+1),e.w=.25*i,e.x=(this.m06-this.m09)/i,e.y=(this.m08-this.m02)/i,e.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),e.w=(this.m06-this.m09)/i,e.x=.25*i,e.y=(this.m01+this.m04)/i,e.z=(this.m08+this.m02)/i):this.m05>this.m10?(i=2*Math.sqrt(1+this.m05-this.m00-this.m10),e.w=(this.m08-this.m02)/i,e.x=(this.m01+this.m04)/i,e.y=.25*i,e.z=(this.m06+this.m09)/i):(i=2*Math.sqrt(1+this.m10-this.m00-this.m05),e.w=(this.m01-this.m04)/i,e.x=(this.m08+this.m02)/i,e.y=(this.m06+this.m09)/i,e.z=.25*i),e},i.fromRTS=function(e,t,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=n+n,u=r+r,h=s+s,c=n*o,l=n*u,_=n*h,d=r*u,f=r*h,p=s*h,m=a*o,g=a*u,v=a*h,y=i.x,E=i.y,T=i.z;return this.m00=(1-(d+p))*y,this.m01=(l+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(l-v)*E,this.m05=(1-(c+p))*E,this.m06=(f+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(f-m)*T,this.m10=(1-(c+d))*T,this.m11=0,this.m12=t.x,this.m13=t.y,this.m14=t.z,this.m15=1,this},i.fromQuat=function(e){var t=e.x,i=e.y,n=e.z,r=e.w,s=t+t,a=i+i,o=n+n,u=t*s,h=i*s,c=i*a,l=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-c-d,this.m01=h+m,this.m02=l-p,this.m03=0,this.m04=h-m,this.m05=1-u-d,this.m06=_+f,this.m07=0,this.m08=l+p,this.m09=_-f,this.m10=1-u-c,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},t}(Tt));En.IDENTITY=Object.freeze(new En);var Tn=new Ki,An=new hn;function Sn(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p){return new En(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p)}di.fastDefine("cc.Mat4",En,{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}),v.Mat4=En,v.mat4=Sn;var Rn=e("cH",function(e){function t(t,i){var n;return n=e.call(this)||this,t&&"object"==typeof t?(n.x=t.x,n.y=t.y):(n.x=t||0,n.y=i||0),n}s(t,e),t.clone=function(e){return new t(e.x,e.y)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e},t.set=function(e,t,i){return e.x=t,e.y=i,e},t.add=function(e,t,i){return e.x=t.x+i.x,e.y=t.y+i.y,e},t.subtract=function(e,t,i){return e.x=t.x-i.x,e.y=t.y-i.y,e},t.multiply=function(e,t,i){return e.x=t.x*i.x,e.y=t.y*i.y,e},t.divide=function(e,t,i){return e.x=t.x/i.x,e.y=t.y/i.y,e},t.ceil=function(e,t){return e.x=Math.ceil(t.x),e.y=Math.ceil(t.y),e},t.floor=function(e,t){return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e},t.min=function(e,t,i){return e.x=Math.min(t.x,i.x),e.y=Math.min(t.y,i.y),e},t.max=function(e,t,i){return e.x=Math.max(t.x,i.x),e.y=Math.max(t.y,i.y),e},t.round=function(e,t){return e.x=Math.round(t.x),e.y=Math.round(t.y),e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e},t.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.squaredDistance=function(e,t){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.len=function(e){var t=e.x,i=e.y;return Math.sqrt(t*t+i*i)},t.lengthSqr=function(e){var t=e.x,i=e.y;return t*t+i*i},t.negate=function(e,t){return e.x=-t.x,e.y=-t.y,e},t.inverse=function(e,t){return e.x=1/t.x,e.y=1/t.y,e},t.inverseSafe=function(e,t){var i=t.x,n=t.y;return Math.abs(i)0&&(r=1/Math.sqrt(r),e.x=i*r,e.y=n*r),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y},t.cross=function(e,t,i){return e instanceof Ki?(e.x=e.y=0,e.z=t.x*i.y-t.y*i.x,e):e.x*t.y-e.y*t.x},t.lerp=function(e,t,i,n){var r=t.x,s=t.y;return e.x=r+n*(i.x-r),e.y=s+n*(i.y-s),e},t.random=function(e,t){t=t||1;var i=2*Ni()*Math.PI;return e.x=Math.cos(i)*t,e.y=Math.sin(i)*t,e},t.transformMat3=function(e,t,i){var n=t.x,r=t.y;return e.x=i.m00*n+i.m03*r+i.m06,e.y=i.m01*n+i.m04*r+i.m07,e},t.transformMat4=function(e,t,i){var n=t.x,r=t.y;return e.x=i.m00*n+i.m04*r+i.m12,e.y=i.m01*n+i.m05*r+i.m13,e},t.str=function(e){return"Vec2("+e.x+", "+e.y+")"},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.x-t.x)<=i*Math.max(1,Math.abs(e.x),Math.abs(t.x))&&Math.abs(e.y-t.y)<=i*Math.max(1,Math.abs(e.y),Math.abs(t.y))},t.angle=function(e,i){t.normalize(In,e),t.normalize(bn,i);var n=t.dot(In,bn);return n>1?0:n<-1?Math.PI:Math.acos(n)};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y)},i.set=function(e,t){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t*Math.max(1,Math.abs(this.x),Math.abs(e.x))&&Math.abs(this.y-e.y)<=t*Math.max(1,Math.abs(this.y),Math.abs(e.y))},i.equals2f=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(this.x-e)<=i*Math.max(1,Math.abs(this.x),Math.abs(e))&&Math.abs(this.y-t)<=i*Math.max(1,Math.abs(this.y),Math.abs(t))},i.strictEquals=function(e){return e&&this.x===e.x&&this.y===e.y},i.strictEquals2f=function(e,t){return this.x===e&&this.y===t},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(e,t){var i=this.x,n=this.y;return this.x=i+t*(e.x-i),this.y=n+t*(e.y-n),this},i.clampf=function(e,t){return this.x=Ri(this.x,e.x,t.x),this.y=Ri(this.y,e.y,t.y),this},i.add=function(e){return this.x+=e.x,this.y+=e.y,this},i.add2f=function(e,t){return this.x+=e,this.y+=t,this},i.subtract=function(e){return this.x-=e.x,this.y-=e.y,this},i.subtract2f=function(e,t){return this.x-=e,this.y-=t,this},i.multiplyScalar=function(e){return"object"==typeof e&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=e,this.y*=e,this},i.multiply=function(e){return"object"!=typeof e&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=e.x,this.y*=e.y,this},i.multiply2f=function(e,t){return this.x*=e,this.y*=t,this},i.divide=function(e){return this.x/=e.x,this.y/=e.y,this},i.divide2f=function(e,t){return this.x/=e,this.y/=t,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(e){return this.x*e.x+this.y*e.y},i.cross=function(e){return this.x*e.y-this.y*e.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 e=this.x,t=this.y,i=e*e+t*t;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(e){var t=this.lengthSqr(),i=e.lengthSqr();if(0===t||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(e)/Math.sqrt(t*i);return n=Ri(n,-1,1),Math.acos(n)},i.signAngle=function(e){var t=this.angle(e);return this.cross(e)<0?-t:t},i.rotate=function(e){var t=this.x,i=this.y,n=Math.sin(e),r=Math.cos(e);return this.x=r*t-n*i,this.y=n*t+r*i,this},i.project=function(e){var t=this.dot(e)/e.dot(e);return this.x=e.x*t,this.y=e.y*t,this},i.transformMat4=function(e){var t=this.x,i=this.y;return this.x=e.m00*t+e.m04*i+e.m12,this.y=e.m01*t+e.m05*i+e.m13,this},t}(Tt));Rn.ZERO=Object.freeze(new Rn(0,0)),Rn.ONE=Object.freeze(new Rn(1,1)),Rn.NEG_ONE=Object.freeze(new Rn(-1,-1)),Rn.UNIT_X=Object.freeze(new Rn(1,0)),Rn.UNIT_Y=Object.freeze(new Rn(0,1));var wn,In=new Rn,bn=new Rn;function On(e,t){return new Rn(e,t)}di.fastDefine("cc.Vec2",Rn,{x:0,y:0}),v.Vec2=Rn,v.v2=On,re(Rn,"Vec2",[{name:"sub",newName:"subtract",target:Rn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Rn,targetName:"Vec2"},{name:"div",newName:"divide",target:Rn,targetName:"Vec2"},{name:"dist",newName:"distance",target:Rn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Rn,targetName:"Vec2"},{name:"mag",newName:"len",target:Rn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Rn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Rn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Rn,targetName:"Vec2"}]),re(Rn.prototype,"Vec2",[{name:"mag",newName:"length",target:Rn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Rn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Rn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Rn.prototype,targetName:"Vec2"}]),re(Ki,"Vec3",[{name:"sub",newName:"subtract",target:Ki,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Ki,targetName:"Vec3"},{name:"div",newName:"divide",target:Ki,targetName:"Vec3"},{name:"dist",newName:"distance",target:Ki,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Ki,targetName:"Vec3"},{name:"mag",newName:"len",target:Ki,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Ki,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Ki,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Ki,targetName:"Vec3"}]),re(Ki.prototype,"Vec3",[{name:"mag",newName:"length",target:Ki.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Ki.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Ki.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Ki.prototype,targetName:"Vec3"}]),re(zi,"Vec4",[{name:"sub",newName:"subtract",target:zi,targetName:"Vec4"},{name:"mul",newName:"multiply",target:zi,targetName:"Vec4"},{name:"div",newName:"divide",target:zi,targetName:"Vec4"},{name:"dist",newName:"distance",target:zi,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:zi,targetName:"Vec4"},{name:"mag",newName:"len",target:zi,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:zi,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:zi,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:zi,targetName:"Vec4"}]),re(zi.prototype,"Vec4",[{name:"mag",newName:"length",target:zi.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:zi.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:zi.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:zi.prototype,targetName:"Vec4"}]),re(_n,"Quat",[{name:"mag",newName:"len",target:_n,targetName:"Quat"},{name:"mul",newName:"multiply",target:_n,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Quat"}]),re(_n.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Quat"}]),re(en,"Color",[{name:"sub",newName:"subtract",target:en,targetName:"Color"},{name:"mul",newName:"multiply",target:en,targetName:"Color"},{name:"div",newName:"divide",target:en,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:en,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var e=arguments.length,t=new Array(e),i=0;i=e.x&&this.y<=e.y&&this.y+this.height>=e.y},i.containsRect=function(e){return this.x<=e.x&&this.x+this.width>=e.x+e.width&&this.y<=e.y&&this.y+this.height>=e.y+e.height},i.transformMat4=function(e){var t=this.x,i=this.y,n=t+this.width,r=i+this.height,s=e.m00*t+e.m04*i+e.m12,a=e.m01*t+e.m05*i+e.m13,o=e.m00*n+e.m04*i+e.m12,u=e.m01*n+e.m05*i+e.m13,h=e.m00*t+e.m04*r+e.m12,c=e.m01*t+e.m05*r+e.m13,l=e.m00*n+e.m04*r+e.m12,_=e.m01*n+e.m05*r+e.m13,d=Math.min(s,o,h,l),f=Math.max(s,o,h,l),p=Math.min(a,u,c,_),m=Math.max(a,u,c,_);return this.x=d,this.y=p,this.width=f-d,this.height=m-p,this},i.transformMat4ToPoints=function(e,t,i,n,r){var s=this.x,a=this.y,o=s+this.width,u=a+this.height;t.x=e.m00*s+e.m04*a+e.m12,t.y=e.m01*s+e.m05*a+e.m13,r.x=e.m00*o+e.m04*a+e.m12,r.y=e.m01*o+e.m05*a+e.m13,i.x=e.m00*s+e.m04*u+e.m12,i.y=e.m01*s+e.m05*u+e.m13,n.x=e.m00*o+e.m04*u+e.m12,n.y=e.m01*o+e.m05*u+e.m13},n(t,[{key:"xMin",get:function(){return this.x},set:function(e){this.width+=this.x-e,this.x=e}},{key:"yMin",get:function(){return this.y},set:function(e){this.height+=this.y-e,this.y=e}},{key:"xMax",get:function(){return this.x+this.width},set:function(e){this.width=e-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(e){this.height=e-this.y}},{key:"center",get:function(){return new Rn(this.x+.5*this.width,this.y+.5*this.height)},set:function(e){this.x=e.x-.5*this.width,this.y=e.y-.5*this.height}},{key:"origin",get:function(){return new Rn(this.x,this.y)},set:function(e){this.x=e.x,this.y=e.y}},{key:"size",get:function(){return new Cn(this.width,this.height)},set:function(e){this.width=e.width,this.height=e.height}},{key:"z",get:function(){return this.width},set:function(e){this.width=e}},{key:"w",get:function(){return this.height},set:function(e){this.height=e}}]),t}(Tt));function Ln(e,t,i,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),new Pn(e,t,i,n)}di.fastDefine("cc.Rect",Pn,{x:0,y:0,width:0,height:0}),v.Rect=Pn,v.rect=Ln;var xn=e("g2",Float64Array),Dn=e("g3",function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.createFloatArray=function(e){return new xn(e)},n(t,[{key:"array",get:function(){return this._array}}]),t}(Tt)),Fn=Object.freeze({__proto__:null,bits:O,Vec2:Rn,v2:On,Vec3:Ki,v3:Qi,Vec4:zi,v4:Vi,Quat:_n,quat:vn,Mat3:hn,Mat4:En,mat4:Sn,AffineTransform:Nn,Size:Cn,size:Mn,Rect:Pn,rect:Ln,Color:en,color:tn,preTransforms:yn,HALF_PI:yi,TWO_PI:Ei,EPSILON:Ti,equals:Ai,approx:Si,clamp:Ri,clamp01:wi,lerp:Ii,toRadian:bi,toDegree:Oi,random:Ni,randomRange:Ci,randomRangeInt:Mi,pseudoRandom:Pi,pseudoRandomRange:Li,pseudoRandomRangeInt:xi,nextPow2:Di,repeat:Fi,pingPong:Bi,inverseLerp:Ui,absMaxComponent:Gi,absMax:ki,enumerableProps:Hi,MATH_FLOAT_ARRAY:xn,MathBase:Dn});e("fM",Fn);var Bn=new Ki,Un=new Ki,Gn=new Ki,kn=new Ki,Hn=new Ki,zn=new Ki,Vn=new Array(3),Wn=new Array(3);function jn(e,t){return Ki.dot(t.n,e)-t.d}function Xn(e,t,i){return Ki.copy(e,t),Ki.subtract(Hn,i.center,i.halfExtents),Ki.add(zn,i.center,i.halfExtents),e.x=e.xzn.x?zn.x:e.x,e.y=e.y>zn.y?zn.y:e.y,e.z=e.z>zn.z?zn.z:e.z,e}function Kn(e,t,i){Ki.set(Bn,i.orientation.m00,i.orientation.m01,i.orientation.m02),Ki.set(Un,i.orientation.m03,i.orientation.m04,i.orientation.m05),Ki.set(Gn,i.orientation.m06,i.orientation.m07,i.orientation.m08),Vn[0]=Bn,Vn[1]=Un,Vn[2]=Gn,Wn[0]=i.halfExtents.x,Wn[1]=i.halfExtents.y,Wn[2]=i.halfExtents.z,Ki.subtract(kn,t,i.center),Ki.set(e,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=Ki.dot(kn,Vn[n]);r>Wn[n]&&(r=Wn[n]),r<-Wn[n]&&(r=-Wn[n]),e.x+=r*Vn[n].x,e.y+=r*Vn[n].y,e.z+=r*Vn[n].z}return e}var Yn=Object.freeze({__proto__:null,point_plane:jn,pt_point_plane:function(e,t,i){var n=jn(t,i);return Ki.subtract(e,t,Ki.multiplyScalar(e,i.n,n))},pt_point_aabb:Xn,pt_point_obb:Kn,pt_point_line:function(e,t,i,n){Ki.subtract(Bn,i,n);var r=Bn,s=Ki.lengthSqr(r);if(0===s)Ki.copy(e,i);else{Ki.subtract(Bn,t,i);var a=Ki.dot(Bn,r)/s;a<0?Ki.copy(e,i):a>1?Ki.copy(e,n):Ki.scaleAndAdd(e,i,r,a)}}}),qn={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},Qn=function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=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=qn.SHAPE_LINE,this.s=new Ki(e,t,i),this.e=new Ki(n,r,s)}return e.create=function(t,i,n,r,s,a){return new e(t,i,n,r,s,a)},e.clone=function(t){return new e(t.s.x,t.s.y,t.s.z,t.e.x,t.e.y,t.e.z)},e.copy=function(e,t){return Ki.copy(e.s,t.s),Ki.copy(e.e,t.e),e},e.fromPoints=function(e,t,i){return Ki.copy(e.s,t),Ki.copy(e.e,i),e},e.set=function(e,t,i,n,r,s,a){return e.s.x=t,e.s.y=i,e.s.z=n,e.e.x=r,e.e.y=s,e.e.z=a,e},e.len=function(e){return Ki.distance(e.s,e.e)},e.prototype.length=function(){return Ki.distance(this.s,this.e)},n(e,[{key:"type",get:function(){return this._type}}]),e}(),Zn=e("dD",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=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=qn.SHAPE_RAY,this.o=new Ki(e,t,i),this.d=new Ki(n,r,s)}return e.create=function(t,i,n,r,s,a){return void 0===t&&(t=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 e(t,i,n,r,s,a)},e.clone=function(t){return new e(t.o.x,t.o.y,t.o.z,t.d.x,t.d.y,t.d.z)},e.copy=function(e,t){return Ki.copy(e.o,t.o),Ki.copy(e.d,t.d),e},e.fromPoints=function(e,t,i){return Ki.copy(e.o,t),Ki.normalize(e.d,Ki.subtract(e.d,i,t)),e},e.set=function(e,t,i,n,r,s,a){return e.o.x=t,e.o.y=i,e.o.z=n,e.d.x=r,e.d.y=s,e.d.z=a,e},e.prototype.computeHit=function(e,t){Ki.normalize(e,this.d),Ki.scaleAndAdd(e,this.o,e,t)},n(e,[{key:"type",get:function(){return this._type}}]),e}()),Jn=new Ki,$n=new Ki,er=new Ki,tr=new Ki;function ir(e){return Math.max(Math.max(e.x,e.y),e.z)}var nr,rr,sr,ar,or,ur,hr,cr,lr=e("fr",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new Ki(0,0,0),this._radius=0,this._type=void 0,this._type=qn.SHAPE_SPHERE,this._center=new Ki(e,t,i),this._radius=n}e.create=function(t,i,n,r){return new e(t,i,n,r)},e.clone=function(t){return new e(t.center.x,t.center.y,t.center.z,t.radius)},e.copy=function(e,t){return Ki.copy(e.center,t.center),e.radius=t.radius,e},e.fromPoints=function(e,t,i){return Ki.multiplyScalar(e.center,Ki.add(Jn,t,i),.5),e.radius=.5*Ki.subtract(Jn,i,t).length(),e},e.set=function(e,t,i,n,r){return e.center.x=t,e.center.y=i,e.center.z=n,e.radius=r,e};var t=e.prototype;return t.destroy=function(){},t.clone=function(){return e.clone(this)},t.copy=function(t){return e.copy(this,t)},t.getBoundary=function(e,t){Ki.set(e,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Ki.set(t,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},t.transform=function(e,t,i,n,r){Ki.transformMat4(r.center,this.center,e),r.radius=this.radius*ir(n)},t.translateAndRotate=function(e,t,i){Ki.transformMat4(i.center,this.center,e)},t.setScale=function(e,t){t.radius=this.radius*ir(e)},t.mergePoint=function(e){this.radius<0&&(this.center.set(e),this.radius=0),Ki.subtract($n,e,this.center);var t=$n.length();if(t>this.radius){var i=.5*(t-this.radius);this.radius+=i,Ki.multiplyScalar($n,$n,i/t),Ki.add(this.center,this.center,$n)}},t.mergePoints=function(e){var t=e.length;if(!(t<1)){this.radius=-1;for(var i=0;i-Number.EPSILON))return 0;var r=1/n;Ki.subtract(or,e.o,t.a);var s=Ki.dot(or,ar)*r;if(s<0||s>1)return 0;Ki.cross(ur,or,rr);var a=Ki.dot(e.d,ur)*r;if(a<0||s+a>1)return 0;var o=Ki.dot(sr,ur)*r;return o<0?0:o}),fr=function(){var e=new Ki(0,0,0);return function(t,i){var n=i.radius,r=i.center,s=t.o,a=t.d,o=n*n;Ki.subtract(e,r,s);var u=e.lengthSqr(),h=Ki.dot(e,a),c=o-(u-h*h);if(c<0)return 0;var l=Math.sqrt(c),_=up?0:f>0?f:p}(e,hr,cr)}),mr=function(){var e=new Ki,t=new Ki,i=new Ki,n=new Ki,r=new Ki,s=new Ki,a=new Ki,o=new Array(3),u=new Array(3),h=new Array(3),c=new Array(6);return function(l,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,e=_.center,t=l.o,i=l.d,Ki.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),Ki.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),Ki.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),Ki.subtract(a,e,t),u[0]=Ki.dot(n,i),u[1]=Ki.dot(r,i),u[2]=Ki.dot(s,i),h[0]=Ki.dot(n,a),h[1]=Ki.dot(r,a),h[2]=Ki.dot(s,a);for(var d=0;d<3;++d){if(0===u[d]){if(-h[d]-o[d]>0||-h[d]+o[d]<0)return 0;u[d]=1e-7}c[2*d+0]=(h[d]+o[d])/u[d],c[2*d+1]=(h[d]-o[d])/u[d]}var f=Math.max(Math.max(Math.min(c[0],c[1]),Math.min(c[2],c[3])),Math.min(c[4],c[5])),p=Math.min(Math.min(Math.max(c[0],c[1]),Math.max(c[2],c[3])),Math.max(c[4],c[5]));return p<0||f>p?0:f>0?f:p}}(),gr=function(){var e=new Ki,t=new Ki,i=new Ki,n=new Ki,r=new Ki,s=new Ki,a=new Ki,o=new lr;return function(u,h){var c=h.radius*h.radius,l=Ki.normalize(e,u.d),_=h.ellipseCenter0,d=h.ellipseCenter1,f=Ki.subtract(t,d,_);if(f.equals(Ki.ZERO))return o.radius=h.radius,o.center.set(h.ellipseCenter0),$r.raySphere(u,o);var p=u.o,m=Ki.subtract(i,p,_),g=Ki.cross(n,l,f),v=g.lengthSqr();if(0===v){o.radius=h.radius;var y=Ki.subtract(r,d,p);return m.lengthSqr()=0&&O<=1?R:O<0?(o.radius=h.radius,o.center.set(h.ellipseCenter0),$r.raySphere(u,o)):O>1?(o.radius=h.radius,o.center.set(h.ellipseCenter1),$r.raySphere(u,o)):0}}(),vr=function(){var e=new Ki(0,0,0);return function(t,i){Ki.subtract(e,t.e,t.s);var n=(i.d-Ki.dot(t.s,i.n))/Ki.dot(e,i.n);return n<0||n>1?0:n}}(),yr=function(){var e=new Ki(0,0,0),t=new Ki(0,0,0),i=new Ki(0,0,0),n=new Ki(0,0,0),r=new Ki(0,0,0),s=new Ki(0,0,0);return function(a,o,u){Ki.subtract(e,o.b,o.a),Ki.subtract(t,o.c,o.a),Ki.subtract(i,a.s,a.e),Ki.cross(r,e,t);var h=Ki.dot(i,r);if(h<=0)return 0;Ki.subtract(n,a.s,o.a);var c=Ki.dot(n,r);if(c<0||c>h)return 0;Ki.cross(s,i,n);var l=Ki.dot(t,s);if(l<0||l>h)return 0;var _=-Ki.dot(e,s);if(_<0||l+_>h)return 0;if(u){var d=1/h,f=1-(l*=d)-(_*=d);Ki.set(u,o.a.x*f+o.b.x*l+o.c.x*_,o.a.y*f+o.b.y*l+o.c.y*_,o.a.z*f+o.b.z*l+o.c.z*_)}return 1}}(),Er=new Zn;function Tr(e,t){Er.o.set(e.s),Ki.subtract(Er.d,e.e,e.s),Er.d.normalize();var i=pr(Er,t);return i<=e.length()?i:0}function Ar(e,t){Er.o.set(e.s),Ki.subtract(Er.d,e.e,e.s),Er.d.normalize();var i=mr(Er,t);return i<=e.length()?i:0}function Sr(e,t){Er.o.set(e.s),Ki.subtract(Er.d,e.e,e.s),Er.d.normalize();var i=fr(Er,t);return i<=e.length()?i:0}var Rr,wr,Ir,br,Or=(Rr=new Ki,wr=new Ki,Ir=new Ki,br=new Ki,function(e,t){return Ki.subtract(Rr,e.center,e.halfExtents),Ki.add(wr,e.center,e.halfExtents),Ki.subtract(Ir,t.center,t.halfExtents),Ki.add(br,t.center,t.halfExtents),Rr.x<=br.x&&wr.x>=Ir.x&&Rr.y<=br.y&&wr.y>=Ir.y&&Rr.z<=br.z&&wr.z>=Ir.z});function Nr(e,t,i,n,r,s){Ki.set(s[0],e.x+i.x*t.x+n.x*t.y+r.x*t.z,e.y+i.y*t.x+n.y*t.y+r.y*t.z,e.z+i.z*t.x+n.z*t.y+r.z*t.z),Ki.set(s[1],e.x-i.x*t.x+n.x*t.y+r.x*t.z,e.y-i.y*t.x+n.y*t.y+r.y*t.z,e.z-i.z*t.x+n.z*t.y+r.z*t.z),Ki.set(s[2],e.x+i.x*t.x-n.x*t.y+r.x*t.z,e.y+i.y*t.x-n.y*t.y+r.y*t.z,e.z+i.z*t.x-n.z*t.y+r.z*t.z),Ki.set(s[3],e.x+i.x*t.x+n.x*t.y-r.x*t.z,e.y+i.y*t.x+n.y*t.y-r.y*t.z,e.z+i.z*t.x+n.z*t.y-r.z*t.z),Ki.set(s[4],e.x-i.x*t.x-n.x*t.y-r.x*t.z,e.y-i.y*t.x-n.y*t.y-r.y*t.z,e.z-i.z*t.x-n.z*t.y-r.z*t.z),Ki.set(s[5],e.x+i.x*t.x-n.x*t.y-r.x*t.z,e.y+i.y*t.x-n.y*t.y-r.y*t.z,e.z+i.z*t.x-n.z*t.y-r.z*t.z),Ki.set(s[6],e.x-i.x*t.x+n.x*t.y-r.x*t.z,e.y-i.y*t.x+n.y*t.y-r.y*t.z,e.z-i.z*t.x+n.z*t.y-r.z*t.z),Ki.set(s[7],e.x-i.x*t.x-n.x*t.y+r.x*t.z,e.y-i.y*t.x-n.y*t.y+r.y*t.z,e.z-i.z*t.x-n.z*t.y+r.z*t.z)}function Cr(e,t){for(var i=Ki.dot(t,e[0]),n=i,r=1;r<8;++r){var s=Ki.dot(t,e[r]);i=sn?s:n}return[i,n]}var Mr,Pr,Lr,Dr=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=new Ki(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Ki(0,0,0),n[r]=new Ki(0,0,0);var s=new Ki,a=new Ki;return function(t,r){Ki.set(e[0],1,0,0),Ki.set(e[1],0,1,0),Ki.set(e[2],0,0,1),Ki.set(e[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Ki.set(e[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Ki.set(e[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)Ki.cross(e[6+3*o],e[o],e[3]),Ki.cross(e[7+3*o],e[o],e[4]),Ki.cross(e[7+3*o],e[o],e[5]);Ki.subtract(s,t.center,t.halfExtents),Ki.add(a,t.center,t.halfExtents),function(e,t,i){Ki.set(i[0],e.x,t.y,t.z),Ki.set(i[1],e.x,t.y,e.z),Ki.set(i[2],e.x,e.y,t.z),Ki.set(i[3],e.x,e.y,e.z),Ki.set(i[4],t.x,t.y,t.z),Ki.set(i[5],t.x,t.y,e.z),Ki.set(i[6],t.x,e.y,t.z),Ki.set(i[7],t.x,e.y,e.z)}(s,a,i),Nr(r.center,r.halfExtents,e[3],e[4],e[5],n);for(var u=0;u<15;++u){var h=Cr(i,e[u]),c=Cr(n,e[u]);if(c[0]>h[1]||h[0]>c[1])return 0}return 1}}(),Fr=function(e,t){var i=e.halfExtents.x*Math.abs(t.n.x)+e.halfExtents.y*Math.abs(t.n.y)+e.halfExtents.z*Math.abs(t.n.z),n=Ki.dot(t.n,e.center);return n+it.d?0:1},Br=function(e,t){for(var i=0;in.halfExtents.x?t++:e[h].x<-n.halfExtents.x&&i++;if(t===r.vertices.length||i===r.vertices.length)return 0;t=0,i=0;for(var c=0;cn.halfExtents.y?t++:e[c].y<-n.halfExtents.y&&i++;if(t===r.vertices.length||i===r.vertices.length)return 0;t=0,i=0;for(var l=0;ln.halfExtents.z?t++:e[l].z<-n.halfExtents.z&&i++;return t===r.vertices.length||i===r.vertices.length?0:1}}(),Gr=(Mr=new Ki(0,0,0),Pr=new hn,function(e,t){return Ki.subtract(Mr,t,e.center),Ki.transformMat3(Mr,Mr,hn.transpose(Pr,e.orientation)),i=Mr,n=e.halfExtents,Math.abs(i.x)t.d?0:1}),Hr=function(e,t){for(var i=0;ir.halfExtents.x?i++:t<-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++:t<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var d=0;dr.halfExtents.z?i++:t<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),Vr=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=new Ki(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Ki(0,0,0),n[r]=new Ki(0,0,0);return function(t,r){Ki.set(e[0],t.orientation.m00,t.orientation.m01,t.orientation.m02),Ki.set(e[1],t.orientation.m03,t.orientation.m04,t.orientation.m05),Ki.set(e[2],t.orientation.m06,t.orientation.m07,t.orientation.m08),Ki.set(e[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Ki.set(e[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Ki.set(e[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)Ki.cross(e[6+3*s],e[s],e[3]),Ki.cross(e[7+3*s],e[s],e[4]),Ki.cross(e[8+3*s],e[s],e[5]);Nr(t.center,t.halfExtents,e[0],e[1],e[2],i),Nr(r.center,r.halfExtents,e[3],e[4],e[5],n);for(var a=0;a<15;++a){var o=Cr(i,e[a]),u=Cr(n,e[a]);if(u[0]>o[1]||o[0]>u[1])return 0}return 1}}(),Wr=function(){for(var e=new lr,t=new Ki,i=new Ki,n=new Ki,r=new Array(8),s=0;s<8;s++)r[s]=new Ki;for(var a=new Array(8),o=0;o<8;o++)a[o]=new Ki;return function(s,o){if(0===Ki.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return e.radius=o.radius,e.center.set(o.ellipseCenter0),$r.sphereOBB(e,s);t.x=s.orientation.m00,t.y=s.orientation.m01,t.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,Nr(s.center,s.halfExtents,t,i,n,r);var u=a,h=Ki.copy(u[0],t),c=Ki.copy(u[1],i),l=Ki.copy(u[2],n);Ki.subtract(u[3],o.center,s.center).normalize();var _=Ki.subtract(u[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),Ki.cross(u[5],h,_),Ki.cross(u[6],c,_),Ki.cross(u[7],l,_);for(var d=0;d<8;++d){var f=Cr(r,u[d]),p=Ki.dot(u[d],o.ellipseCenter0),m=Ki.dot(u[d],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>f[1]||f[0]>y)return 0}return 1}}(),jr=function(e,t){var i=Ki.dot(t.n,e.center),n=e.radius*t.n.length();return i+nt.d?0:1},Xr=function(e,t){for(var i=0;ih)){Ki.add(e,o,Ki.multiplyScalar(e,u,a));for(var l=0;l<6;l++)if(l!==r&&l!==r+t[r]){var _=n.planes[l];if(Ki.dot(_.n,e)<_.d)return 0}}}return 1}}(),Yr=function(e,t){var i=e.radius+t.radius;return Ki.squaredDistance(e.center,t.center)1?Ki.squaredDistance(i.center,n.ellipseCenter1)y&&(u=y,h=g+f,E=p)),h<0?(h=0,-m<0?u=0:-m>d?u=y:(u=-m,y=d)):h>E&&(h=E,-m+f<0?u=0:-m+f>d?u=y:(u=-m+f,y=d));var T=Math.abs(u)0&&(e.d=t.d/i),e},e.prototype.transform=function(e){En.invert(is,e),En.transpose(is,is),zi.set(ns,this.n.x,this.n.y,this.n.z,this.d),zi.transformMat4(ns,ns,is),Ki.set(this.n,ns.x,ns.y,ns.z),this.d=ns.w},n(e,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(e){this.n.x=e}},{key:"y",get:function(){return this.n.y},set:function(e){this.n.y=e}},{key:"z",get:function(){return this.n.z},set:function(e){this.n.z=e}},{key:"w",get:function(){return this.d},set:function(e){this.d=e}}]),e}(),ss=e("dO",function(){function e(e,t,i,n,r,s,a,o,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=1),void 0===u&&(u=0),this.a=void 0,this.b=void 0,this.c=void 0,this._type=void 0,this._type=qn.SHAPE_TRIANGLE,this.a=new Ki(e,t,i),this.b=new Ki(n,r,s),this.c=new Ki(a,o,u)}return e.create=function(t,i,n,r,s,a,o,u,h){return void 0===t&&(t=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=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=1),new e(t,i,n,r,s,a,o,u,h)},e.clone=function(t){return new e(t.a.x,t.a.y,t.a.z,t.b.x,t.b.y,t.b.z,t.c.x,t.c.y,t.c.z)},e.copy=function(e,t){return Ki.copy(e.a,t.a),Ki.copy(e.b,t.b),Ki.copy(e.c,t.c),e},e.fromPoints=function(e,t,i,n){return Ki.copy(e.a,t),Ki.copy(e.b,i),Ki.copy(e.c,n),e},e.set=function(e,t,i,n,r,s,a,o,u,h){return e.a.x=t,e.a.y=i,e.a.z=n,e.b.x=r,e.b.y=s,e.b.z=a,e.c.x=o,e.c.y=u,e.c.z=h,e},n(e,[{key:"type",get:function(){return this._type}}]),e}()),as=new Ki,os=new Ki,us=new Ki,hs=new Ki,cs=new hn,ls=function(e,t,i){cs.m00=Math.abs(i.m00),cs.m01=Math.abs(i.m01),cs.m02=Math.abs(i.m02),cs.m03=Math.abs(i.m04),cs.m04=Math.abs(i.m05),cs.m05=Math.abs(i.m06),cs.m06=Math.abs(i.m08),cs.m07=Math.abs(i.m09),cs.m08=Math.abs(i.m10),Ki.transformMat3(e,t,cs)},_s=e("cu",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=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=qn.SHAPE_AABB,this.center=new Ki(e,t,i),this.halfExtents=new Ki(n,r,s)}e.create=function(t,i,n,r,s,a){return new e(t,i,n,r,s,a)},e.clone=function(t){return new e(t.center.x,t.center.y,t.center.z,t.halfExtents.x,t.halfExtents.y,t.halfExtents.z)},e.copy=function(e,t){return Ki.copy(e.center,t.center),Ki.copy(e.halfExtents,t.halfExtents),e},e.fromPoints=function(e,t,i){return Ki.add(as,i,t),Ki.subtract(os,i,t),Ki.multiplyScalar(e.center,as,.5),Ki.multiplyScalar(e.halfExtents,os,.5),e},e.set=function(e,t,i,n,r,s,a){return e.center.set(t,i,n),e.halfExtents.set(r,s,a),e},e.merge=function(t,i,n){return Ki.subtract(as,i.center,i.halfExtents),Ki.subtract(os,n.center,n.halfExtents),Ki.add(us,i.center,i.halfExtents),Ki.add(hs,n.center,n.halfExtents),Ki.max(hs,us,hs),Ki.min(us,as,os),e.fromPoints(t,us,hs)},e.toBoundingSphere=function(e,t){return e.center.set(t.center),e.radius=t.halfExtents.length(),e},e.transform=function(e,t,i){return Ki.transformMat4(e.center,t.center,i),ls(e.halfExtents,t.halfExtents,i),e};var t=e.prototype;return t.getBoundary=function(e,t){Ki.subtract(e,this.center,this.halfExtents),Ki.add(t,this.center,this.halfExtents)},t.transform=function(e,t,i,n,r){Ki.transformMat4(r.center,this.center,e),ls(r.halfExtents,this.halfExtents,e)},t.clone=function(){return e.clone(this)},t.copy=function(t){return e.copy(this,t)},t.mergePoint=function(e){this.getBoundary(as,os),e.xos.x&&(os.x=e.x),e.y>os.y&&(os.y=e.y),e.z>os.z&&(os.z=e.z),Ki.add(us,as,os),this.center.set(Ki.multiplyScalar(us,us,.5)),this.halfExtents.set(os.x-us.x,os.y-us.y,os.z-us.z)},t.mergePoints=function(e){if(!(e.length<1))for(var t=0;t>>1;n<=r;s=n+r>>>1){var a=e[s];if(a>t+i)r=s-1;else{if(!(a=e._times.length)return{done:!0,value:void 0};var i=[e._times[t],e._values[t]];return++t,{done:!1,value:i}}}},t.keyframes=function(){return this},t.times=function(){return this._times},t.values=function(){return this._values},t.getKeyframeTime=function(e){return this._times[e]},t.getKeyframeValue=function(e){return this._values[e]},t.addKeyFrame=function(e,t){return this._insertNewKeyframe(e,t)},t.removeKeyframe=function(e){this._times.splice(e,1),this._values.splice(e,1)},t.indexOfKeyframe=function(e){return Rs(this._times,e)},t.updateTime=function(e,t){var i=this._values[e];this.removeKeyframe(e),this._insertNewKeyframe(t,i)},t.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.slice());else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return e[1]})))}},t.clear=function(){this._times.length=0,this._values.length=0},t.searchKeyframe=function(e){return Rs(this._times,e)},t.setKeyframes=function(e,t){e.length,t.length,function(e){e.every((function(e,t,i){return 0===t||e>i[t-1]||Si(e,i[t-1],1e-6)}))}(e),this._times=e,this._values=t},t._insertNewKeyframe=function(e,t){var i=this._times,n=this._values,r=i.length,s=Rs(i,e);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(e),n.unshift(t)):a===r?(i.push(e),n.push(t)):(i.splice(a-1,0,e),n.splice(a-1,0,t)),a},n(e,[{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]}}]),e}();function Ns(e){return e>-1e-9&&e<1e-9}function Cs(e,t,i,n){return i.slice().reverse().reduce((function(i,n){return n(e,t,i)||i}),n)}di.fastDefine("cc.KeyframeCurve",Os,{_times:[],_values:[]}),function(e){e[e.LINEAR=0]="LINEAR",e[e.CONSTANT=1]="CONSTANT",e[e.CUBIC=2]="CUBIC"}(ws||(ws=e("eE",{}))),function(e){e[e.LINEAR=0]="LINEAR",e[e.CLAMP=1]="CLAMP",e[e.LOOP=2]="LOOP",e[e.PING_PONG=3]="PING_PONG"}(Is||(Is=e("gp",{}))),function(e){e[e.NONE=0]="NONE",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.BOTH=3]="BOTH"}(bs||(bs=e("eF",{})));var Ms=function(){},Ps=function(){return Ms},Ls=xs((function(){}));function xs(e){return function(t){return"function"==typeof t?e(t):function(i){return e(i,t)}}}function Ds(e){return function(t){return function(i){!function(e,t,i){var n=Bs(e);if(n){var r=Us(n,"proto");Us(r,"editor")[t]=i}}(i,e,t)}}}var Fs="__ccclassCache__";function Bs(e){return Us(e,Fs)}function Us(e,t){return e[t]||(e[t]={})}var Gs=e("cr",xs((function(e,t){var i=ze(e);i===Object&&(i=null);var n={name:t,extends:i,ctor:e},r=e[Fs];if(r){var s=r.proto;s&&ke(n,s),e[Fs]=void 0}return di(n)}))),ks=e("d6",Ds("requireComponent")),Hs=e("c_",Ds("executionOrder")),zs=e("cW",Ls);function Vs(e,t,i){var n=null;function r(e,t,i){!function(e,t,i,n,r,s){var a,o=s&&"function"!=typeof s&&(s.get||s.set);r&&(a=ii(r,o));var u=ke(t,a||r||{});o?(s.get&&(u.get=s.get),s.set&&(u.set=s.set)):Xs(e,u,i,n,s)}(function(e){return Bs(e.constructor)}(e),function(e,t){var i,n,r=Us(Bs(e.constructor),"proto"),s=Us(r,"properties");return null!==(n=s[i=t])&&void 0!==n?n:s[i]={}}(e,t),e.constructor,t,n,i)}return void 0===e?Vs({type:void 0}):void 0===t?(n=e,r):void r(e,t,i)}function Ws(e){var t;try{t=e()}catch(t){return e}return"object"!=typeof t||null===t?t:e}function js(e,t,i){var n,r,s=Bs(e.constructor),a=Us(s,"proto"),o=Us(a,"properties"),u=null!==(r=o[n=t])&&void 0!==r?r:o[n]={};return u.__internalFlags|=ni.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(u.get=i.get),i.set&&(u.set=i.set)):Xs(s,u,e.constructor,t,i),u}function Xs(e,t,i,n,r){if(void 0!==r)"function"==typeof r?t.default=Ws(r):null===r||r.initializer&&(t.default=Ws(r.initializer));else{var s=e.default||(e.default=function(e){var t;try{t=new e}catch(e){return{}}return t}(i));s.hasOwnProperty(n)&&(t.default=s[n])}}var Ks=Symbol("cc:SerializationMetadata"),Ys=e("cy",(function(e,t,i){Zs(js(e,t,i))}));function qs(e){return function(t,i,n){var r=js(t,i,n);r.formerlySerializedAs=e,Zs(r)}}var Qs=e("fJ",(function(e,t,i){var n=js(e,t,i);n.editorOnly=!0,Zs(n)}));function Zs(e){e.__internalFlags|=ni.IMPLICIT_SERIALIZABLE}var Js=e("es",Ms),$s=Ls,ea=Ps,ta=Ls,ia=Ps,na=Ps,ra=Ps,sa=e("gs",Ms),aa=e("gu",Ps),oa=e("gv",Ps),ua=e("gt",Ps),ha=e("gx",Ps),ca=e("gy",Ps),la=e("gz",Ms),_a=e("gw",Ps),da=e("gA",Ms),fa=va(Xt),pa=e("ev",va(Kt)),ma=va(Yt),ga=e("cO",va(qt));function va(e){return Vs({type:e})}var ya,Ea=e("cN",(function(e,t,i){js(e,t,i).override=!0})),Ta=e("gg","__editorExtras__"),Aa=e("eo",(function(){})),Sa=Object.freeze({__proto__:null,uniquelyReferenced:Js,ccclass:Gs,property:Vs,requireComponent:ks,executionOrder:Hs,disallowMultiple:zs,allowReplicated:function(e){di.Attr.setClassAttr(e,"replicated","visible",!0)},executeInEditMode:$s,menu:ea,playOnFocus:ta,inspector:ia,icon:na,help:ra,type:va,integer:fa,float:pa,boolean:ma,string:ga,editable:sa,tooltip:ua,visible:aa,displayName:oa,displayOrder:_a,range:ha,rangeStep:ca,slide:la,disallowAnimation:da,override:Ea,formerlySerializedAs:qs,serializable:Ys});e("ge",Sa);var Ra,wa,Ia,ba,Oa,Na,Ca,Ma,Pa,La,xa,Da=1<<22,Fa=[],Ba=e("dU",function(){function e(e){void 0===e&&(e=""),this._objFlags=void 0,this._name=void 0,this._name=e,this._objFlags=0}e._deferredDestroy=function(){for(var e=Fa.length,t=0;t>3},n=i.storageUnit,r=za(i.elementType),s=new(Va(n))(e,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:e*e*(3-2*e)}function bo(e){return e<=0?0:e>=1?1:e*e*e*(e*(6*e-15)+10)}v._decorator=Sa;var Oo=Uo(qa,Qa),No=Uo(Ja,$a),Co=Uo(to,io),Mo=Uo(ro,so),Po=Uo(oo,uo),Lo=Uo(co,lo),xo=Uo(fo,po),Do=Uo(go,vo),Fo=Uo(Eo,To),Bo=Uo(So,Ro);function Uo(e,t){return function(i){return i<.5?t(2*i)/2:e(2*i-1)/2+.5}}var Go,ko,Ho=Object.freeze({__proto__:null,constant:Ka,linear:Ya,quadIn:qa,quadOut:Qa,quadInOut:Za,cubicIn:Ja,cubicOut:$a,cubicInOut:eo,quartIn:to,quartOut:io,quartInOut:no,quintIn:ro,quintOut:so,quintInOut:ao,sineIn:oo,sineOut:uo,sineInOut:ho,expoIn:co,expoOut:lo,expoInOut:_o,circIn:fo,circOut:po,circInOut:mo,elasticIn:go,elasticOut:vo,elasticInOut:yo,backIn:Eo,backOut:To,backInOut:Ao,bounceIn:So,bounceOut:Ro,bounceInOut:wo,smooth:Io,fade:bo,quadOutIn:Oo,cubicOutIn:No,quartOutIn:Co,quintOutIn:Mo,sineOutIn:Po,expoOutIn:Lo,circOutIn:xo,elasticOutIn:Do,backOutIn:Fo,bounceOutIn:Bo});e("ey",Ho),function(e){e[e.LINEAR=0]="LINEAR",e[e.CONSTANT=1]="CONSTANT",e[e.QUAD_IN=2]="QUAD_IN",e[e.QUAD_OUT=3]="QUAD_OUT",e[e.QUAD_IN_OUT=4]="QUAD_IN_OUT",e[e.QUAD_OUT_IN=5]="QUAD_OUT_IN",e[e.CUBIC_IN=6]="CUBIC_IN",e[e.CUBIC_OUT=7]="CUBIC_OUT",e[e.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",e[e.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",e[e.QUART_IN=10]="QUART_IN",e[e.QUART_OUT=11]="QUART_OUT",e[e.QUART_IN_OUT=12]="QUART_IN_OUT",e[e.QUART_OUT_IN=13]="QUART_OUT_IN",e[e.QUINT_IN=14]="QUINT_IN",e[e.QUINT_OUT=15]="QUINT_OUT",e[e.QUINT_IN_OUT=16]="QUINT_IN_OUT",e[e.QUINT_OUT_IN=17]="QUINT_OUT_IN",e[e.SINE_IN=18]="SINE_IN",e[e.SINE_OUT=19]="SINE_OUT",e[e.SINE_IN_OUT=20]="SINE_IN_OUT",e[e.SINE_OUT_IN=21]="SINE_OUT_IN",e[e.EXPO_IN=22]="EXPO_IN",e[e.EXPO_OUT=23]="EXPO_OUT",e[e.EXPO_IN_OUT=24]="EXPO_IN_OUT",e[e.EXPO_OUT_IN=25]="EXPO_OUT_IN",e[e.CIRC_IN=26]="CIRC_IN",e[e.CIRC_OUT=27]="CIRC_OUT",e[e.CIRC_IN_OUT=28]="CIRC_IN_OUT",e[e.CIRC_OUT_IN=29]="CIRC_OUT_IN",e[e.ELASTIC_IN=30]="ELASTIC_IN",e[e.ELASTIC_OUT=31]="ELASTIC_OUT",e[e.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",e[e.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",e[e.BACK_IN=34]="BACK_IN",e[e.BACK_OUT=35]="BACK_OUT",e[e.BACK_IN_OUT=36]="BACK_IN_OUT",e[e.BACK_OUT_IN=37]="BACK_OUT_IN",e[e.BOUNCE_IN=38]="BOUNCE_IN",e[e.BOUNCE_OUT=39]="BOUNCE_OUT",e[e.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",e[e.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",e[e.SMOOTH=42]="SMOOTH",e[e.FADE=43]="FADE"}(ko||(ko=e("eD",{})));var zo,Vo=((Go={})[ko.CONSTANT]=Ka,Go[ko.LINEAR]=Ya,Go[ko.QUAD_IN]=qa,Go[ko.QUAD_OUT]=Qa,Go[ko.QUAD_IN_OUT]=Za,Go[ko.QUAD_OUT_IN]=Oo,Go[ko.CUBIC_IN]=Ja,Go[ko.CUBIC_OUT]=$a,Go[ko.CUBIC_IN_OUT]=eo,Go[ko.CUBIC_OUT_IN]=No,Go[ko.QUART_IN]=to,Go[ko.QUART_OUT]=io,Go[ko.QUART_IN_OUT]=no,Go[ko.QUART_OUT_IN]=Co,Go[ko.QUINT_IN]=ro,Go[ko.QUINT_OUT]=so,Go[ko.QUINT_IN_OUT]=ao,Go[ko.QUINT_OUT_IN]=Mo,Go[ko.SINE_IN]=oo,Go[ko.SINE_OUT]=uo,Go[ko.SINE_IN_OUT]=ho,Go[ko.SINE_OUT_IN]=Po,Go[ko.EXPO_IN]=co,Go[ko.EXPO_OUT]=lo,Go[ko.EXPO_IN_OUT]=_o,Go[ko.EXPO_OUT_IN]=Lo,Go[ko.CIRC_IN]=fo,Go[ko.CIRC_OUT]=po,Go[ko.CIRC_IN_OUT]=mo,Go[ko.CIRC_OUT_IN]=xo,Go[ko.ELASTIC_IN]=go,Go[ko.ELASTIC_OUT]=vo,Go[ko.ELASTIC_IN_OUT]=yo,Go[ko.ELASTIC_OUT_IN]=Do,Go[ko.BACK_IN]=Eo,Go[ko.BACK_OUT]=To,Go[ko.BACK_IN_OUT]=Ao,Go[ko.BACK_OUT_IN]=Fo,Go[ko.BOUNCE_IN]=So,Go[ko.BOUNCE_OUT]=Ro,Go[ko.BOUNCE_IN_OUT]=wo,Go[ko.BOUNCE_OUT_IN]=Bo,Go[ko.SMOOTH]=Io,Go[ko.FADE]=bo,Go);function Wo(e){return Vo[e]}R(255),R(65280);var jo,Xo,Ko,Yo=ws.LINEAR<<0|bs.NONE<<8|ko.LINEAR<<16,qo=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r>0},set:function(e){this._flags&=-256,this._flags|=e<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(e){this._flags&=-65281,this._flags|=e<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(e){this._flags&=-16711681,this._flags|=e<<16}}]),t}(Aa);function Qo(e){var t=new qo;if("number"==typeof e)t.value=e;else{var i=e.interpolationMode,n=e.tangentWeightMode,r=e.value,s=e.rightTangent,a=e.rightTangentWeight,o=e.leftTangent,u=e.leftTangentWeight,h=e.easingMethod,c=e[Ta];t.value=null!=r?r:t.value,t.rightTangent=null!=s?s:t.rightTangent,t.rightTangentWeight=null!=a?a:t.rightTangentWeight,t.leftTangent=null!=o?o:t.leftTangent,t.leftTangentWeight=null!=u?u:t.leftTangentWeight,t.interpolationMode=null!=i?i:t.interpolationMode,t.tangentWeightMode=null!=n?n:t.tangentWeightMode,t.easingMethod=null!=h?h:t.easingMethod,c&&(t[Ta]=c)}return t}di.fastDefine("cc.RealKeyframeValue",qo,((zo={interpolationMode:ws.LINEAR,tangentWeightMode:bs.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:ko.LINEAR})[Ta]=void 0,zo)),di.Attr.setClassAttr(qo,Ta,"editorOnly",!0),(jo=qo,null!==(Ko=(Xo=jo)[Ks])&&void 0!==Ko?Ko:Xo[Ks]={}).uniquelyReferenced=!0;var Zo,Jo=e("et",function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;rs){var u=this.postExtrapolation,h=i[n-1];if(u===Is.CLAMP||n<2)return h.value;switch(u){case Is.LINEAR:return fu(s,h.value,t[n-2],i[n-2].value,e);case Is.LOOP:e=_u(e,r,s);break;case Is.PING_PONG:e=du(e,r,s);break;default:return h.value}}var c=Rs(t,e);if(c>=0)return i[c].value;var l=~c,_=l-1,d=t[_],f=i[_],p=t[l];return function(e,t,i,n,r){var s=i-e;switch(t.interpolationMode){default:case ws.CONSTANT:return t.value;case ws.LINEAR:var a=t.easingMethod===ko.LINEAR?r:Wo(t.easingMethod)(r);return Ii(t.value,n.value,a);case ws.CUBIC:var o=1/3,u=t.rightTangent,h=t.rightTangentWeight,c=0!=(t.tangentWeightMode&bs.RIGHT),l=n.leftTangent,_=n.leftTangentWeight,d=0!=(n.tangentWeightMode&bs.LEFT);if(c||d){var f=0;if(c)f=h;else{var p=s,m=s*u;f=Math.sqrt(p*p+m*m)*o}var g=Math.atan(u),v=Math.cos(g)*f+e,y=Math.sin(g)*f+t.value,E=0;if(d)E=_;else{var T=s,A=s*l;E=Math.sqrt(T*T+A*A)*o}var S=Math.atan(l),R=(v-e)/s,w=(-Math.cos(S)*E+i-e)/s,I=y,b=-Math.sin(S)*E+n.value,O=[0,0,0],N=function(e,t,i,n,r){var s=i/n,a=t/n,o=s*s,u=1/3*(-1/3*o+a),h=.5*(2/27*s*o-1/3*s*a+e/n),c=u*u*u,l=h*h+c,_=0;if(Ns(l)){if(Ns(h))return r[0]=0,1;var d=Math.cbrt(-h);return r[0]=2*d,r[1]=-d,2}if(l<0){var f=1/3*Math.acos(-h/Math.sqrt(-c)),p=2*Math.sqrt(-u);r[0]=p*Math.cos(f),r[1]=-p*Math.cos(f+Math.PI/3),r[2]=-p*Math.cos(f-Math.PI/3),_=3}else{var m=Math.sqrt(l),g=Math.cbrt(m-h),v=-Math.cbrt(m+h);r[0]=g+v,_=1}for(var y=1/3*s,E=0;E<_;++E)r[E]-=y;return _}(0-r,3*R,3*w-6*R,3*(R-w)+1,O),C=function(e,t,i){var n=i;if(1===t)n=e[0];else{n=-1/0;for(var r=0;r=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(O,N,r);return pu(t.value,I,b,n.value,C)}var M=t.value+o*u*s,P=n.value-o*l*s;return pu(t.value,M,P,n.value,r)}}(d,f,p,i[l],(e-d)/(p-d))},i.addKeyFrame=function(t,i){return e.prototype.addKeyFrame.call(this,t,Qo(i))},i.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return Qo(e)})));else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return Qo(e[1])})))}},i.isConstant=function(e){if(this._values.length<=1)return!0;var t=this._values[0].value;return this._values.every((function(i){return Si(i.value,t,e)}))},i[ja]=function(e,t){if(t.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+$o+$o+eu+tu*r+hu*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=$o,s.setUint8(a,this.postExtrapolation),a+=$o,s.setUint32(a,r,!0),a+=eu,i.forEach((function(e,t){return s.setFloat32(a+tu*t,e,!0)})),a+=tu*r;for(var o,u=d(n);!(o=u()).done;){var h=o.value;a=cu(s,h,a)}var c=new Uint8Array(s.buffer,0,a);e.writeProperty("bytes",c);var l=n.map((function(e){return e[Ta]}));l.some((function(e){return void 0!==e}))&&e.writeProperty("keyframeValueEditorExtras",l)}else e.writeThis()},i[Xa]=function(e,t){if(t.fromCCON){var i=e.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=$o,this.postExtrapolation=n.getUint8(r),r+=$o;var s=n.getUint32(r,!0);r+=eu;var a=Array.from({length:s},(function(e,t){return n.getFloat32(r+tu*t,!0)}));r+=tu*s;for(var o=new Array(s),u=0;u>8;return t.easingMethod=s,n}function _u(e,t,i){return t+Fi(e-t,i-t)}function du(e,t,i){return t+Bi(e-t,i-t)}function fu(e,t,i,n,r){return t+(n-t)/(i-e)*(r-e)}function pu(e,t,i,n,r){var s=1-r;return s*s*s*e+3*s*s*r*t+3*s*r*r*i+r*r*r*n}function mu(e,t,i,n,r){var s=1-r;return s*(s*(e+(3*t-e)*r)+3*i*r*r)+n*r*r*r}v.bezier=mu;var gu,vu,yu,Eu,Tu,Au,Su,Ru,wu,Iu,bu=Math.cos,Ou=Math.acos,Nu=Math.max,Cu=2*Math.PI,Mu=Math.sqrt;function Pu(e){return e<0?-Math.pow(-e,1/3):Math.pow(e,1/3)}function Lu(e,t){var i=function(e,t){var i,n,r,s,a=t-0,o=t-e[0],u=3*a,h=3*o,c=3*(t-e[2]),l=1/(-a+h-c+(t-1)),_=1/3,d=(u-6*o+c)*l,f=d*_,p=(-u+h)*l,m=(3*p-d*d)*_,g=m*_,v=(2*d*d*d-9*d*p+a*l*27)/27,y=v/2,E=y*y+g*g*g;if(E<0){var T=-m*_,A=Mu(T*T*T),S=-v/(2*A),R=Ou(S<-1?-1:S>1?1:S),w=2*Pu(A);return n=w*bu(R*_)-f,r=w*bu((R+Cu)*_)-f,s=w*bu((R+2*Cu)*_)-f,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Nu(n,r,s):Nu(n,r):s>=0&&s<=1?Nu(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Nu(r,s):r:s}if(0===E)return r=-(i=y<0?Pu(-y):-Pu(y))-f,(n=2*i-f)>=0&&n<=1?r>=0&&r<=1?Nu(n,r):n:r;var I=Mu(E);return(i=Pu(-y+I))-Pu(y+I)-f}(e,t),n=e[1];return((1-i)*(n+(e[3]-n)*i)*3+i*i)*i}v.bezierByTime=Lu,function(e){e[e.SLERP=0]="SLERP",e[e.CONSTANT=1]="CONSTANT"}(Iu||(Iu=e("eG",{})));var xu,Du=Gs("cc.QuatKeyframeValue")(gu=Js((vu=function(e){var t=void 0===e?{}:e,i=t.value,n=t.interpolationMode,r=t.easingMethod;this.interpolationMode=yu&&yu(),this.value=Eu&&Eu(),this.easingMethod=Tu&&Tu(),this.value=i?_n.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},yu=Cs(vu.prototype,"interpolationMode",[Ys],(function(){return Iu.SLERP})),Eu=Cs(vu.prototype,"value",[Ys],(function(){return _n.clone(_n.IDENTITY)})),Tu=Cs(vu.prototype,"easingMethod",[Ys],(function(){return ko.LINEAR})),gu=vu))||gu)||gu;function Fu(e){return new Du(e)}e("ew",Gs("cc.QuatCurve")((Su=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;rh){var l=r[o-1];switch(s){case Is.LOOP:e=u+Fi(e-u,h-u);break;case Is.PING_PONG:e=u+Bi(e-u,h-u);break;case Is.CLAMP:default:return _n.copy(t,l.value)}}var _=Rs(n,e);if(_>=0)return _n.copy(t,r[_].value);var d=~_,f=d-1,p=n[f],m=r[f],g=n[d],v=r[d],y=(e-p)/(g-p);switch(m.interpolationMode){default:case Iu.CONSTANT:return _n.copy(t,m.value);case Iu.SLERP:var E=m.easingMethod,T=E===ko.LINEAR?y:Array.isArray(E)?Lu(E,y):Wo(E)(y);return _n.slerp(t,m.value,v.value,T)}},i.addKeyFrame=function(t,i){var n=new Du(i);return e.prototype.addKeyFrame.call(this,t,n)},i.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return Fu(e)})));else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return Fu(e[1])})))}},i[ja]=function(e,t){if(t.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(e,t,i){var n=i[0];r&&e.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=zu*(r?1:s),o=n.reduce((function(e,t){var i=t.easingMethod;return e+(Array.isArray(i)?Vu+4*ju:Vu)}),0),u=0,h=new DataView(new ArrayBuffer(u+=Uu+Gu+ku*s+4*Hu*s+o+a+0)),c=0,l=0;r&&(l|=xu.INTERPOLATION_MODE),h.setUint32(c,l,!0),c+=Uu,h.setUint32(c,s,!0),c+=Gu,i.forEach((function(e,t){return h.setFloat32(c+ku*t,e,!0)})),c+=ku*s,n.forEach((function(e,t){var i=e.value,n=i.x,r=i.y,s=i.z,a=i.w,o=c+4*Hu*t;h.setFloat32(o+0*Hu,n,!0),h.setFloat32(o+1*Hu,r,!0),h.setFloat32(o+2*Hu,s,!0),h.setFloat32(o+3*Hu,a,!0)})),c+=4*Hu*s,n.forEach((function(e){var t=e.easingMethod;Array.isArray(t)?(h.setUint8(c,Wu),++c,h.setFloat32(c+0*ju,t[0],!0),h.setFloat32(c+1*ju,t[1],!0),h.setFloat32(c+2*ju,t[2],!0),h.setFloat32(c+3*ju,t[3],!0),c+=4*ju):(h.setUint8(c,t),++c)}));var _=c;c+=a;var d=_;n.forEach((function(e){var t=e.interpolationMode;h.setUint8(d,t),r||(d+=zu)}));var f=new Uint8Array(h.buffer);e.writeProperty("bytes",f)}else e.writeThis()},i[Xa]=function(e,t){if(t.fromCCON){var i=e.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=Uu;var a=s&xu.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Gu;var u=Array.from({length:o},(function(e,t){return n.getFloat32(r+ku*t,!0)})),h=r+=ku*o;r+=4*Hu*o;var c=Array.from({length:o},(function(e,t){var i=h+4*Hu*t,s=n.getFloat32(i+0*Hu,!0),a=n.getFloat32(i+1*Hu,!0),o=n.getFloat32(i+2*Hu,!0),u=n.getFloat32(i+3*Hu,!0),c=n.getUint8(r);++r;var l=Fu({value:{x:s,y:a,z:o,w:u}});return c!==Wu?l.easingMethod=c:(l.easingMethod=[n.getFloat32(r+0*ju,!0),n.getFloat32(r+1*ju,!0),n.getFloat32(r+2*ju,!0),n.getFloat32(r+3*ju,!0)],r+=4*ju),l}));if(a){var l=n.getUint8(r);++r;for(var _=0;_=0)return this._values[t];var i=Ri(~t-1,0,this._values.length-1);return this._values[i]},t}(Os))||Bu),function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0});di.fastDefine("cc.Keyframe",Xu,{time:0,value:0,inTangent:0,outTangent:0});var Ku=function(){function e(){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 e.prototype.evaluate=function(e){return Yu(e-this.time,this.coefficient)},e}();function Yu(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}var qu,Qu,Zu=e("ff",function(){function e(e){if(void 0===e&&(e=null),this.cachedKey=void 0,e instanceof Jo)this._curve=e;else{var t=new Jo;this._curve=t,t.preExtrapolation=Is.LOOP,t.postExtrapolation=Is.CLAMP,e?t.assignSorted(e.map((function(e){return[e.time,{interpolationMode:ws.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]}))):t.assignSorted([[0,{interpolationMode:ws.CUBIC,value:1}],[1,{interpolationMode:ws.CUBIC,value:1}]])}this.cachedKey=new Ku}var t=e.prototype;return t.addKey=function(e){e?this._curve.addKeyFrame(e.time,{interpolationMode:ws.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}):this._curve.clear()},t.evaluate_slow=function(e){return this._curve.evaluate(e)},t.evaluate=function(e){var t=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=e,s=e<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case Is.LOOP:r=Fi(e-a,o-a)+a;break;case Is.PING_PONG:r=Bi(e-a,o-a)+a;break;case Is.CLAMP:default:r=Ri(e,a,o)}if(r>=t.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1t)return a}else for(var o=0;o<3;o++){var u=r-o;if(u>=0&&i.getKeyframeTime(u-1)<=t)return u-1}for(var h,c=0,l=n;l-c>1;)h=Math.floor((c+l)/2),i.getKeyframeTime(h)>=t?l=h:c=h;return c},n(e,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(e){var t=e[0],i=e[1],n=new Xu;return n.time=t,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(e){this._curve.assignSorted(e.map((function(e){return[e.time,{interpolationMode:ws.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]})))}},{key:"preWrapMode",get:function(){return $u(this._curve.preExtrapolation)},set:function(e){this._curve.preExtrapolation=Ju(e)}},{key:"postWrapMode",get:function(){return $u(this._curve.postExtrapolation)},set:function(e){this._curve.postExtrapolation=Ju(e)}}]),e}());function Ju(e){switch(e){default:case qu.Default:case qu.Normal:case qu.Clamp:return Is.CLAMP;case qu.PingPong:return Is.PING_PONG;case qu.Loop:return Is.LOOP}}function $u(e){switch(e){default:case Is.LINEAR:case Is.CLAMP:return qu.Clamp;case Is.PING_PONG:return qu.PingPong;case Is.LOOP:return qu.Loop}}function eh(){var e=new Jo;return e.assignSorted([[0,{interpolationMode:ws.CUBIC,value:1}],[1,{interpolationMode:ws.CUBIC,value:1}]]),e}Zu.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],di.fastDefine("cc.AnimationCurve",Zu,{_curve:null}),function(e){e[e.Default=0]="Default",e[e.Normal=1]="Normal",e[e.Loop=2]="Loop",e[e.ShouldWrap=4]="ShouldWrap",e[e.Clamp=8]="Clamp",e[e.PingPong=22]="PingPong",e[e.Reverse=36]="Reverse"}(qu||(qu=e("ep",{}))),function(e){e[e.LINEAR=0]="LINEAR",e[e.BEZIER=1]="BEZIER",e[e.CATMULL_ROM=2]="CATMULL_ROM"}(Qu||(Qu={}));var th,ih=4294967295,nh=new Ki,rh=new Ki,sh=new Ki,ah=new Ki,oh=function(){function e(e,t){void 0===e&&(e=Qu.CATMULL_ROM),void 0===t&&(t=[]),this._type=void 0,this._mode=Qu.CATMULL_ROM,this._knots=[],this._type=qn.SHAPE_SPLINE,this._mode=e;for(var i=0;i=this._knots.length?this._knots.push(i):this._knots.splice(e,0,i)},t.removeKnot=function(e){e>=0&&this._knots.length,this._knots.splice(e,1)},t.setKnot=function(e,t){e>=0&&this._knots.length,this._knots[e].set(t)},t.getKnot=function(e){return e>=0&&this._knots.length,this._knots[e]},t.getPoint=function(t,i){void 0===i&&(i=ih),t=Ri(t,0,1);var n=this.getSegments();if(0===n)return new Ki(0,0,0);if(i===ih){var r=1/n;i=Math.floor(t/r),t=t%r/r}if(i>=n)return new Ki(this._knots[this._knots.length-1]);switch(this._mode){case Qu.LINEAR:return e.calcLinear(this._knots[i],this._knots[i+1],t);case Qu.BEZIER:return e.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],t);case Qu.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+2this.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},e}()),Eh=function(){function e(){this._poolHandle=-1,yh.addContainer(this)}return e.prototype.destroy=function(){yh.removeContainer(this)},e}(),Th=e("P",function(e){function t(t,i,n){var r;(r=e.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freePool=[],r._dtor=void 0,r._ctor=t,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 e=this._nextAvail>>1;e<=this._nextAvail;e++)this._dtor(this._freePool[e]);this._freePool.length=this._nextAvail>>1,this._nextAvail=this._freePool.length-1}},i.destroy=function(){var t=arguments.length>0?arguments[0]:null;t&&q(14100);var i=t||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freePool[n]);this._freePool.length=0,this._nextAvail=-1,e.prototype.destroy.call(this)},t}(Eh)),Ah=e("R",function(e){function t(t,i,n){var r;(r=e.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=t,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;sthis._data.length)for(var t=this._data.length;t=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var t=0;t>2>this._count){var e=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var t=e;t=this._count)){var t=this._count-1,i=this._data[e];this._data[e]=this._data[t],this._data[t]=i,this._count-=1}},n(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t}(Eh)),Sh=e("C",function(e){function t(t,i){var n;return(n=e.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(t),n._initSize=t,n.length=0,n._compareFn=i,n}s(t,e);var i=t.prototype;return i.push=function(e){this.array[this.length++]=e},i.pop=function(){return this.array[--this.length]},i.get=function(e){return this.array[e]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,e.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(e){for(var t=0;t=this.length||e<0)){var t=--this.length;this.array[e]=this.array[t]}},i.indexOf=function(e){for(var t=0,i=this.length;tt.priority?-1:0};var t=e.prototype;return t.init=function(){},t.update=function(){},t.postUpdate=function(){},t.destroy=function(){},n(e,[{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"id",get:function(){return this._id},set:function(e){this._id=e}}]),e}());Rh.Priority=mt({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var wh=new ge("Scheduler"),Ih=function(e,t,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=e,this.priority=t,this.paused=i,this.markedForDeletion=n};Ih.get=function(e,t,i,n){var r=Ih._listEntries.pop();return r?(r.target=e,r.priority=t,r.paused=i,r.markedForDeletion=n):r=new Ih(e,t,i,n),r},Ih.put=function(e){Ih._listEntries.length<20&&(e.target=null,Ih._listEntries.push(e))},Ih._listEntries=[];var bh=function(e,t,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=e,this.entry=t,this.target=i,this.callback=n};bh.get=function(e,t,i,n){var r=bh._hashUpdateEntries.pop();return r?(r.list=e,r.entry=t,r.target=i,r.callback=n):r=new bh(e,t,i,n),r},bh.put=function(e){bh._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,bh._hashUpdateEntries.push(e))},bh._hashUpdateEntries=[];var Oh=function(e,t,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=e,this.target=t,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s};Oh.get=function(e,t,i,n,r,s){var a=Oh._hashTimerEntries.pop();return a?(a.timers=e,a.target=t,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new Oh(e,t,i,n,r,s),a},Oh.put=function(e){Oh._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,Oh._hashTimerEntries.push(e))},Oh._hashTimerEntries=[];var Nh=function(){function e(){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 t=e.prototype;return t.initWithCallback=function(e,t,i,n,r,s){return this._lock=!1,this._scheduler=e,this._target=i,this._callback=t,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===v.macro.REPEAT_FOREVER,!0},t.getInterval=function(){return this._interval},t.setInterval=function(e){this._interval=e},t.update=function(e){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=e,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()))},t.getCallback=function(){return this._callback},t.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},t.cancel=function(){this._scheduler.unschedule(this._callback,this._target)},e}();Nh._timers=[],Nh.get=function(){return Nh._timers.pop()||new Nh},Nh.put=function(e){Nh._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,Nh._timers.push(e))};var Ch=e("go",function(e){function t(){var t;return(t=e.call(this)||this)._timeScale=void 0,t._updatesNegList=void 0,t._updates0List=void 0,t._updatesPosList=void 0,t._hashForUpdates=void 0,t._hashForTimers=void 0,t._currentTarget=void 0,t._currentTargetSalvaged=void 0,t._updateHashLocked=void 0,t._arrayForTimers=void 0,t._timeScale=1,t._updatesNegList=[],t._updates0List=[],t._updatesPosList=[],t._hashForUpdates=Ne(!0),t._hashForTimers=Ne(!0),t._currentTarget=null,t._currentTargetSalvaged=!1,t._updateHashLocked=!1,t._arrayForTimers=[],t}s(t,e),t.enableForTarget=function(e){var t=!1;(e.uuid||e.id)&&(t=!0),t||(e.__instanceId?q(1513):e.id=wh.getNewId())};var i=t.prototype;return i.setTimeScale=function(e){this._timeScale=e},i.getTimeScale=function(){return this._timeScale},i.update=function(e){var t,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(e*=this._timeScale),t=0,n=(i=this._updatesNegList).length;t=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}else Z(1510)}},i.unscheduleUpdate=function(e){if(e){var t=e.uuid||e.id;if(t){var i=this._hashForUpdates[t];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else Z(1510)}},i.unscheduleAllForTarget=function(e){if(e){var t=e.uuid||e.id;if(t){var i=this._hashForTimers[t];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;t--)i=r[t],this.unscheduleAllForTarget(i.target);var s=0;if(e<0)for(t=0;t=e&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&t++;if(e<=0)for(t=0;t=e&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&t++},i.isScheduled=function(e,t){ee(e,1508),ee(t,1509);var i=t.uuid||t.id;if(!i)return Z(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=e&&(r.paused=!0,s.push(r.target));if(e<=0)for(i=0;i=e&&(r.paused=!0,s.push(r.target));return s},i.resumeTargets=function(e){if(e)for(var t=0;t=0;--e)this.callbackInfos[e]||Ph(this.callbackInfos,e);this.containCanceled=!1},t.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},e}(),Bh=new Th((function(){return new Fh}),16),Uh=e("gG",function(){function e(){this._callbackTable=Ne(!0),this._offCallback=void 0}var t=e.prototype;return t.on=function(e,t,i,n){if(!this.hasEventListener(e,t,i)){var r=this._callbackTable[e];r||(r=this._callbackTable[e]=Bh.alloc());var s=Dh.alloc();s.set(t,i,n),r.callbackInfos.push(s)}return t},t.hasEventListener=function(e,t,i){var n=this._callbackTable&&this._callbackTable[e];if(!n)return!1;var r=n.callbackInfos;if(!t){if(n.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(h=!0,c="",l=0);var d=Wh.UNKNOWN;-1!==s.appVersion.indexOf("Win")?d=Wh.WINDOWS:h?d=Wh.IOS:-1!==s.appVersion.indexOf("Mac")?d=Wh.OSX:-1!==s.appVersion.indexOf("X11")&&-1===s.appVersion.indexOf("Linux")?d=Wh.LINUX:u?d=Wh.ANDROID:-1===s.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(d=Wh.LINUX),n.os=d,n.osVersion=c,n.osMainVersion=l,n.browserType=Hh.UNKNOWN;var f=/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=f?f[0].toLowerCase():Wh.UNKNOWN;("safari"===p&&u||"qq"===p&&/android.*applewebkit/i.test(a))&&(p=Hh.ANDROID);var g={micromessenger:Hh.WECHAT,wechat:Hh.WECHAT,weixin:Hh.WECHAT,trident:Hh.IE,edge:Hh.EDGE,"360 aphone":Hh.BROWSER_360,mxbrowser:Hh.MAXTHON,"opr/":Hh.OPERA,ubrowser:Hh.UC,huaweibrowser:Hh.HUAWEI};n.browserType=g[p]||p,n.browserVersion="";var v=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(a);v||(v=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(a)),n.browserVersion=v?v[4]:"",n.isXR=!1;var y,E=document.createElement("canvas");E.getContext("2d");try{y=E.toDataURL("image/webp").startsWith("data:image/webp")}catch(e){y=!1}if(n.browserType===Hh.SAFARI){var T,A=null===(T=/ version\/(\d+)/.exec(a))||void 0===T?void 0:T[1];"string"==typeof A&&Number.parseInt(A)>=14&&(y=!0)}var S=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||m,R=void 0!==document.documentElement.onmouseup||m;return n._featureMap=((i={})[Xh.WEBP]=y,i[Xh.IMAGE_BITMAP]=!1,i[Xh.WEB_VIEW]=!0,i[Xh.VIDEO_PLAYER]=!0,i[Xh.SAFE_AREA]=!1,i[Xh.INPUT_TOUCH]=S,i[Xh.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||m,i[Xh.EVENT_MOUSE]=R,i[Xh.EVENT_TOUCH]=S||R,i[Xh.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,i[Xh.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads,i[Xh.EVENT_HANDLE]=!1,i[Xh.EVENT_HMD]=n.isXR,i[Xh.EVENT_HANDHELD]=void 0!==navigator.xr,i),n._initPromise=[],n._initPromise.push(n._supportsImageBitmapPromise()),n._registerEvent(),n}s(t,e);var i=t.prototype;return i._supportsImageBitmapPromise=function(){var e=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var t=document.createElement("canvas");t.width=t.height=2;var i=createImageBitmap(t,{});if(i instanceof Promise)return i.then((function(t){e._setFeature(Xh.IMAGE_BITMAP,!0),null==t||t.close()}))}return Promise.resolve()},i._registerEvent=function(){var e,t=this;e=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,t.emit("hide"))},r=function(e,n,r,s,a){i&&(i=!1,t.emit("show",e,n,r,s,a))};if(e)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._setFeature=function(e,t){return this._featureMap[e]=t},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(e){return this._featureMap[e]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(e){window.open(e)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.close=function(){this.emit("close"),window.close()},t}(kh),qh=e("eK",new Yh),Qh=/(\.[^\.\/\?\\]*)(\?.*)?$/,Zh=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,Jh=/[^\.\/]+\/\.\.\//;function $h(){for(var e="",t=arguments.length,i=new Array(t),n=0;n0&&(e=e.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(e.replace(/(\/|\\)$/,""));if(!n)return e;var r=n[2];return t&&e.substring(e.length-t.length).toLowerCase()===t.toLowerCase()?r.substring(0,r.length-t.length):r}function nc(e){var t=Zh.exec(e);return t?t[2]:""}function rc(e,t){t=t||"";var i=e.indexOf("?"),n="";return i>0&&(n=e.substring(i),e=e.substring(0,i)),(i=e.lastIndexOf("."))<0?e+t+n:e.substring(0,i)+t+n}function sc(e,t,i){if(0===t.indexOf("."))return rc(e,t);var n=e.indexOf("?"),r="",s=i?ec(e):"";return n>0&&(r=e.substring(n),e=e.substring(0,n)),n=(n=e.lastIndexOf("/"))<=0?0:n+1,e.substring(0,n)+t+s+r}function ac(e){var t=e=String(e);do{t=e,e=e.replace(Jh,"")}while(t.length!==e.length);return e}function oc(e){return e.replace(/[\/\\]$/,"")}function uc(){return qh.os===Wh.WINDOWS?"\\":"/"}e("g7",Object.freeze({__proto__:null,join:$h,extname:ec,mainFileName:tc,basename:ic,dirname:nc,changeExtname:rc,changeBasename:sc,_normalize:ac,stripSep:oc,getSeperator:uc}));var hc=new Ki;function cc(e,t,i,n){n||(n=new Ki),e.convertToUINode(t,i,n);var r=i.position;return n.add(r),n}function lc(e,t,i){return i||(i=new Ki),e.worldToScreen(t,i),i.x/=v.view.getScaleX(),i.y/=v.view.getScaleY(),i}var _c,dc=e("gd",{WorldNode3DToLocalNodeUI:cc,WorldNode3DToWorldNodeUI:lc});v.pipelineUtils=dc,re(v.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var e=arguments.length,t=new Array(e),i=0;iwindow.innerHeight;this.isFrameRotated=qh.isMobile&&(t&&e===_c.PORTRAIT||!t&&e===_c.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void q(9201);var e,t,i=v.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,u=r/a,h=s/o,c=this._gameContainer.style;u0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),gc.requestFullScreen().then((function(){null==t||t()})).catch((function(e){console.error(e),null==i||i()}))},t.exitFullScreen=function(){return gc.exitFullScreen()},t.autoFullScreen=function(e,t){var i;null===(i=this.requestFullScreen(e,t))||void 0===i||i.catch((function(){}))},t.disableAutoFullScreen=function(){},n(e,[{key:"devicePixelRatio",get:function(){return gc.devicePixelRatio}},{key:"windowSize",get:function(){return gc.windowSize},set:function(e){gc.windowSize=e}},{key:"resolution",get:function(){return gc.resolution}},{key:"supportsFullScreen",get:function(){return gc.supportFullScreen}}]),e}(),yc=e("dK",new vc);v.screen=yc;var Ec=e("cA",{Feature:Xh,hasFeature:function(e){return qh.hasFeature(e)},NetworkType:Vh,Language:zh,OS:Wh,Platform:jh,BrowserType:Hh,isNative:qh.isNative,isBrowser:qh.isBrowser,isMobile:qh.isMobile,isLittleEndian:qh.isLittleEndian,platform:qh.platform,language:qh.language,languageCode:qh.nativeLanguage,os:qh.os,osVersion:qh.osVersion,osMainVersion:qh.osMainVersion,browserType:qh.browserType,browserVersion:qh.browserVersion,isXR:qh.isXR,windowPixelResolution:yc.windowSize,capabilities:{canvas:!0,opengl:!0,webp:qh.hasFeature(Xh.WEBP),imageBitmap:qh.hasFeature(Xh.IMAGE_BITMAP),touches:qh.hasFeature(Xh.INPUT_TOUCH),mouse:qh.hasFeature(Xh.EVENT_MOUSE),keyboard:qh.hasFeature(Xh.EVENT_KEYBOARD),accelerometer:qh.hasFeature(Xh.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return qh.networkType},getBatteryLevel:function(){return qh.getBatteryLevel()},garbageCollect:function(){qh.triggerGC()},isObjectValid:function(e){return null!=e},dump:function(){var e="";e+="isMobile : "+this.isMobile+"\r\n",e+="language : "+this.language+"\r\n",e+="browserType : "+this.browserType+"\r\n",e+="browserVersion : "+this.browserVersion+"\r\n",e+="supports webp: "+Ec.hasFeature(Xh.WEBP)+"\r\n",e+="supports bitmap: "+Ec.hasFeature(Xh.IMAGE_BITMAP)+"\r\n",e+="supports touches: "+Ec.hasFeature(Xh.INPUT_TOUCH)+"\r\n",e+="supports mouse: "+Ec.hasFeature(Xh.EVENT_MOUSE)+"\r\n",e+="supports keyboard: "+Ec.hasFeature(Xh.EVENT_KEYBOARD)+"\r\n",e+="supports accelerometer: "+Ec.hasFeature(Xh.EVENT_ACCELEROMETER)+"\r\n",e+="os : "+this.os+"\r\n",e+="osVersion : "+this.osVersion+"\r\n",e+="platform : "+this.platform+"\r\n",U(e+="Using "+(v.game.renderType===v.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(e){qh.openURL(e)},init:function(){var e=this;return Promise.resolve().then((function(){return qh.init()})).then((function(){try{var t=Ec.localStorage=window.localStorage;t.setItem("storage",""),t.removeItem("storage"),t=null}catch(t){var i=function(){q(5200)};e.localStorage={getItem:i,setItem:i,clear:i,removeItem:i}}e.__isWebIOS14OrIPadOS14Env=(Ec.os===Wh.IOS||Ec.os===Wh.OSX)&&qh.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return qh.now()},restartVM:function(){qh.restartJSVM()},getSafeAreaRect:function(){var e=v.view,t=gc.safeAreaEdge,i=gc.windowSize,n=new Rn(t.left,t.bottom),r=new Rn(i.width-t.right,i.height-t.top);e._convertToUISpace(n),e._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,u=r.y-n.y;return new Pn(s,a,o,u)}});v.sys=Ec,ae(v,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),ae(Ec,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),re(Ec,"sys",["UNKNOWN","ENGLISH","CHINESE","FRENCH","ITALIAN","GERMAN","SPANISH","DUTCH","RUSSIAN","KOREAN","JAPANESE","HUNGARIAN","PORTUGUESE","ARABIC","NORWEGIAN","POLISH","TURKISH","UKRAINIAN","ROMANIAN","BULGARIAN"].map((function(e){return{name:"LANGUAGE_"+e,newName:e,target:Ec.Language,targetName:"sys.Language"}}))),re(Ec,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(e){return{name:"OS_"+e,newName:e,target:Ec.OS,targetName:"sys.OS"}}))),re(Ec,"sys",["UNKNOWN","WECHAT","ANDROID","IE","EDGE","QQ","MOBILE_QQ","UC","UCBS","BAIDU_APP","BAIDU","MAXTHON","OPERA","OUPENG","MIUI","FIREFOX","SAFARI","CHROME","LIEBAO","QZONE","SOUGOU","HUAWEI"].map((function(e){return{name:"BROWSER_TYPE_"+e,newName:e,target:Ec.BrowserType,targetName:"sys.BrowserType"}}))),re(Ec,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Ec.BrowserType,targetName:"sys.BrowserType"}]),re(Ec,"sys",["UNKNOWN","EDITOR_PAGE","EDITOR_CORE","MOBILE_BROWSER","DESKTOP_BROWSER","WIN32","MACOS","IOS","ANDROID","OHOS","WECHAT_GAME","BAIDU_MINI_GAME","XIAOMI_QUICK_GAME","ALIPAY_MINI_GAME","BYTEDANCE_MINI_GAME","OPPO_MINI_GAME","VIVO_MINI_GAME","HUAWEI_QUICK_GAME","COCOSPLAY","LINKSURE_MINI_GAME","QTT_MINI_GAME"].map((function(e){return{name:e,target:Ec.Platform,targetName:"sys.Platform"}}))),re(Ec,"sys",[{name:"IPHONE",newName:"IOS",target:Ec.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Ec.Platform,targetName:"sys.Platform"}]),se(Ec,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(e){return{name:e}}))),re(Ec,"sys",[{name:"windowPixelResolution",target:yc,targetName:"screen",newName:"windowSize"}]),ae(yc,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var Tc=e("c$",{topLeft:v.v2(0,0),topRight:v.v2(0,0),top:v.v2(0,0),bottomLeft:v.v2(0,0),bottomRight:v.v2(0,0),bottom:v.v2(0,0),center:v.v2(0,0),left:v.v2(0,0),right:v.v2(0,0),width:0,height:0,init:function(e){var t=this.width=e.width,i=this.height=e.height,n=e.x,r=e.y,s=r+i,a=n+t;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+t/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+t/2,this.bottom.y=r,this.center.x=n+t/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}});v.visibleRect=Tc;var Ac=String.prototype.charCodeAt;function Sc(e){return this[e]}function Rc(e,t){for(var i=e.length,n=t^i,r=0,s="string"==typeof e?Ac:Sc;i>=4;){var a=255&s.call(e,r)|(255&s.call(e,++r))<<8|(255&s.call(e,++r))<<16|(255&s.call(e,++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(e,r+2))<<16;case 2:n^=(255&s.call(e,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(e,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function wc(){}v.easing=Ho,wc.prototype.once=function(e,t,i){return this.on(e,t,i,!0)},wc.prototype.targetOff=function(e){this.removeAll(e)},e("gr",Object.freeze({__proto__:null,syncNodeValues:function(e){var t=e._lpos;e.setPositionForJS(t.x,t.y,t.z);var i=e._lscale;e.setScaleForJS(i.x,i.y,i.z);var n=e._lrot;e.setRotationForJS(n.x,n.y,n.z,n.w);var r=e._euler;e.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function e(t){if(t){var i=t._children;if(i){var n=i.length;if(n){t._setChildren(i);for(var r=0;r0&&0==(e&e-1)}function L_(e,t,i,n){if(!b_[e].isCompressed)return t*i*n*b_[e].size;switch(e){case Fc.BC1:case Fc.BC1_ALPHA:case Fc.BC1_SRGB:case Fc.BC1_SRGB_ALPHA:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case Fc.BC2:case Fc.BC2_SRGB:case Fc.BC3:case Fc.BC3_SRGB:case Fc.BC4:case Fc.BC4_SNORM:case Fc.BC6H_SF16:case Fc.BC6H_UF16:case Fc.BC7:case Fc.BC7_SRGB:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case Fc.BC5:case Fc.BC5_SNORM:return Math.ceil(t/4)*Math.ceil(i/4)*32*n;case Fc.ETC_RGB8:case Fc.ETC2_RGB8:case Fc.ETC2_SRGB8:case Fc.ETC2_RGB8_A1:case Fc.EAC_R11:case Fc.EAC_R11SN:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case Fc.ETC2_RGBA8:case Fc.ETC2_SRGB8_A1:case Fc.EAC_RG11:case Fc.EAC_RG11SN:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case Fc.PVRTC_RGB2:case Fc.PVRTC_RGBA2:case Fc.PVRTC2_2BPP:return Math.ceil(t/8)*Math.ceil(i/4)*8*n;case Fc.PVRTC_RGB4:case Fc.PVRTC_RGBA4:case Fc.PVRTC2_4BPP:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case Fc.ASTC_RGBA_4X4:case Fc.ASTC_SRGBA_4X4:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case Fc.ASTC_RGBA_5X4:case Fc.ASTC_SRGBA_5X4:return Math.ceil(t/5)*Math.ceil(i/4)*16*n;case Fc.ASTC_RGBA_5X5:case Fc.ASTC_SRGBA_5X5:return Math.ceil(t/5)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_6X5:case Fc.ASTC_SRGBA_6X5:return Math.ceil(t/6)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_6X6:case Fc.ASTC_SRGBA_6X6:return Math.ceil(t/6)*Math.ceil(i/6)*16*n;case Fc.ASTC_RGBA_8X5:case Fc.ASTC_SRGBA_8X5:return Math.ceil(t/8)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_8X6:case Fc.ASTC_SRGBA_8X6:return Math.ceil(t/8)*Math.ceil(i/6)*16*n;case Fc.ASTC_RGBA_8X8:case Fc.ASTC_SRGBA_8X8:return Math.ceil(t/8)*Math.ceil(i/8)*16*n;case Fc.ASTC_RGBA_10X5:case Fc.ASTC_SRGBA_10X5:return Math.ceil(t/10)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_10X6:case Fc.ASTC_SRGBA_10X6:return Math.ceil(t/10)*Math.ceil(i/6)*16*n;case Fc.ASTC_RGBA_10X8:case Fc.ASTC_SRGBA_10X8:return Math.ceil(t/10)*Math.ceil(i/8)*16*n;case Fc.ASTC_RGBA_10X10:case Fc.ASTC_SRGBA_10X10:return Math.ceil(t/10)*Math.ceil(i/10)*16*n;case Fc.ASTC_RGBA_12X10:case Fc.ASTC_SRGBA_12X10:return Math.ceil(t/12)*Math.ceil(i/10)*16*n;case Fc.ASTC_RGBA_12X12:case Fc.ASTC_SRGBA_12X12:return Math.ceil(t/12)*Math.ceil(i/12)*16*n;default:return 0}}function x_(e,t,i,n,r){for(var s=0,a=0;a>1,1),i=Math.max(i>>1,1);return s}var D_=[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 F_(e){return D_[e]||0}function B_(e){if(e.isCompressed)return Uint8Array;var t=e.size/e.count;switch(e.type){case Bc.UNORM:case Bc.UINT:switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Bc.SNORM:case Bc.INT:switch(t){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Bc.FLOAT:return Float32Array}return Float32Array}function U_(e){switch(e){case Fc.BC1:case Fc.BC1_ALPHA:case Fc.BC1_SRGB:case Fc.BC1_SRGB_ALPHA:case Fc.BC2:case Fc.BC2_SRGB:case Fc.BC3:case Fc.BC3_SRGB:case Fc.BC4:case Fc.BC4_SNORM:case Fc.BC6H_SF16:case Fc.BC6H_UF16:case Fc.BC7:case Fc.BC7_SRGB:case Fc.BC5:case Fc.BC5_SNORM:case Fc.ETC_RGB8:case Fc.ETC2_RGB8:case Fc.ETC2_SRGB8:case Fc.ETC2_RGB8_A1:case Fc.EAC_R11:case Fc.EAC_R11SN:case Fc.ETC2_RGBA8:case Fc.ETC2_SRGB8_A1:case Fc.EAC_RG11:case Fc.EAC_RG11SN:return{width:4,height:4};case Fc.PVRTC_RGB2:case Fc.PVRTC_RGBA2:case Fc.PVRTC2_2BPP:return{width:8,height:4};case Fc.PVRTC_RGB4:case Fc.PVRTC_RGBA4:case Fc.PVRTC2_4BPP:return{width:4,height:4};case Fc.ASTC_RGBA_4X4:case Fc.ASTC_SRGBA_4X4:return{width:4,height:4};case Fc.ASTC_RGBA_5X4:case Fc.ASTC_SRGBA_5X4:return{width:5,height:4};case Fc.ASTC_RGBA_5X5:case Fc.ASTC_SRGBA_5X5:return{width:5,height:5};case Fc.ASTC_RGBA_6X5:case Fc.ASTC_SRGBA_6X5:return{width:6,height:5};case Fc.ASTC_RGBA_6X6:case Fc.ASTC_SRGBA_6X6:return{width:6,height:6};case Fc.ASTC_RGBA_8X5:case Fc.ASTC_SRGBA_8X5:return{width:8,height:5};case Fc.ASTC_RGBA_8X6:case Fc.ASTC_SRGBA_8X6:return{width:8,height:6};case Fc.ASTC_RGBA_8X8:case Fc.ASTC_SRGBA_8X8:return{width:8,height:8};case Fc.ASTC_RGBA_10X5:case Fc.ASTC_SRGBA_10X5:return{width:10,height:5};case Fc.ASTC_RGBA_10X6:case Fc.ASTC_SRGBA_10X6:return{width:10,height:6};case Fc.ASTC_RGBA_10X8:case Fc.ASTC_SRGBA_10X8:return{width:10,height:8};case Fc.ASTC_RGBA_10X10:case Fc.ASTC_SRGBA_10X10:return{width:10,height:10};case Fc.ASTC_RGBA_12X10:case Fc.ASTC_SRGBA_12X10:return{width:12,height:10};case Fc.ASTC_RGBA_12X12:case Fc.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function G_(e,t){return Math.ceil(e/t)*t}var k_=Object.freeze({__proto__:null,get ObjectType(){return Mc},get Status(){return Pc},get API(){return Lc},get SurfaceTransform(){return xc},get Feature(){return Dc},get Format(){return Fc},get FormatType(){return Bc},get Type(){return Uc},get BufferUsageBit(){return Gc},get BufferFlagBit(){return kc},get MemoryAccessBit(){return Hc},get MemoryUsageBit(){return zc},get TextureType(){return Vc},get TextureUsageBit(){return Wc},get TextureFlagBit(){return jc},get FormatFeatureBit(){return Xc},get SampleCount(){return Kc},get VsyncMode(){return Yc},get Filter(){return qc},get Address(){return Qc},get ComparisonFunc(){return Zc},get StencilOp(){return Jc},get BlendFactor(){return $c},get BlendOp(){return el},get ColorMask(){return tl},get ShaderStageFlagBit(){return il},get LoadOp(){return nl},get StoreOp(){return rl},get AccessFlagBit(){return sl},get ResolveMode(){return al},get PipelineBindPoint(){return ol},get PrimitiveMode(){return ul},get PolygonMode(){return hl},get ShadeModel(){return cl},get CullMode(){return ll},get DynamicStateFlagBit(){return _l},get StencilFace(){return dl},get DescriptorType(){return fl},get QueueType(){return pl},get QueryType(){return ml},get CommandBufferType(){return gl},get ClearFlagBit(){return vl},get BarrierType(){return yl},get PassType(){return El},Size:Sl,DeviceCaps:Rl,DeviceOptions:wl,Offset:Il,Rect:bl,Extent:Ol,TextureSubresLayers:Nl,TextureSubresRange:Cl,TextureCopy:Ml,TextureBlit:Pl,BufferTextureCopy:Ll,Viewport:xl,Color:Dl,BindingMappingInfo:Fl,SwapchainInfo:Bl,DeviceInfo:Ul,BufferInfo:Gl,BufferViewInfo:kl,DrawInfo:Hl,DispatchInfo:zl,IndirectBuffer:Vl,TextureInfo:Wl,TextureViewInfo:jl,SamplerInfo:Xl,Uniform:Kl,UniformBlock:Yl,UniformSamplerTexture:ql,UniformSampler:Ql,UniformTexture:Zl,UniformStorageImage:Jl,UniformStorageBuffer:$l,UniformInputAttachment:e_,ShaderStage:t_,Attribute:i_,ShaderInfo:n_,InputAssemblerInfo:r_,ColorAttachment:s_,DepthStencilAttachment:a_,SubpassInfo:o_,SubpassDependency:u_,RenderPassInfo:h_,GeneralBarrierInfo:c_,TextureBarrierInfo:l_,BufferBarrierInfo:__,FramebufferInfo:d_,DescriptorSetLayoutBinding:f_,DescriptorSetLayoutInfo:p_,DescriptorSetInfo:m_,PipelineLayoutInfo:g_,InputState:v_,CommandBufferInfo:y_,QueueInfo:E_,QueryPoolInfo:T_,FormatInfo:A_,MemoryStatus:S_,DynamicStencilStates:R_,DynamicStates:w_,GFXObject:I_,get AttributeName(){return Al},FormatInfos:b_,DESCRIPTOR_BUFFER_TYPE:O_,DESCRIPTOR_SAMPLER_TYPE:N_,DESCRIPTOR_DYNAMIC_TYPE:C_,DRAW_INFO_SIZE:M_,IsPowerOf2:P_,FormatSize:L_,FormatSurfaceSize:x_,GetTypeSize:F_,getTypedArrayConstructor:B_,formatAlignment:U_,alignTo:G_}),H_=e("B",function(e){function t(){var t;return(t=e.call(this,Mc.BUFFER)||this)._usage=Gc.NONE,t._memUsage=zc.NONE,t._size=0,t._stride=1,t._count=0,t._flags=kc.NONE,t._isBufferView=!1,t}return s(t,e),n(t,[{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}}]),t}(I_)),z_=e("b",function(e){function t(){var t;return(t=e.call(this,Mc.COMMAND_BUFFER)||this)._queue=null,t._type=gl.PRIMARY,t._numDrawCalls=0,t._numInstances=0,t._numTris=0,t}return s(t,e),n(t,[{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}}]),t}(I_)),V_=e("b4",function(){function e(){this._gfxAPI=Lc.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Dc.COUNT),this._formatFeatures=new Array(Fc.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new S_,this._caps=new Rl,this._bindingMappingInfo=new Fl,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var t=e.prototype;return t.hasFeature=function(e){return this._features[e]},t.getFormatFeatures=function(e){return this._formatFeatures[e]},n(e,[{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}}]),e}());V_.canvas=void 0,e("b5",function(){function e(e){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var t=new Uint8Array(64);if(t.fill(255),e.capabilities.maxTextureSize>=2){this._texture2D=e.createTexture(new Wl(Vc.TEX2D,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE));var i=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,1));e.copyBuffersToTexture([t],this._texture2D,[i])}if(e.capabilities.maxTextureSize>=2){this._textureCube=e.createTexture(new Wl(Vc.CUBE,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE,6));var n=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,1));e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=1,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=2,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=3,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=4,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=5,e.copyBuffersToTexture([t],this._textureCube,[n])}if(e.capabilities.max3DTextureSize>=2){this._texture3D=e.createTexture(new Wl(Vc.TEX3D,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE,1,1,Kc.ONE,2));var r=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,2),new Nl(0,0,1));e.copyBuffersToTexture([t],this._texture3D,[r])}if(e.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=e.createTexture(new Wl(Vc.TEX2D_ARRAY,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE,2));var s=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,1),new Nl(0,0,1));e.copyBuffersToTexture([t],this._texture2DArray,[s]),s.texSubres.baseArrayLayer=1,e.copyBuffersToTexture([t],this._texture2DArray,[s])}}return e.prototype.getTexture=function(e){switch(e){case Vc.TEX2D:return this._texture2D;case Vc.TEX3D:return this._texture3D;case Vc.CUBE:return this._textureCube;case Vc.TEX2D_ARRAY:return this._texture2DArray;default:return null}},e}());var W_=e("b6",function(e){function t(){var t;return(t=e.call(this,Mc.SWAPCHAIN)||this)._transform=xc.IDENTITY,t._colorTexture=null,t._depthStencilTexture=null,t}return s(t,e),n(t,[{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}}]),t}(I_)),j_=e("b7",function(e){function t(){var t;return(t=e.call(this,Mc.FRAMEBUFFER)||this)._renderPass=null,t._colorTextures=[],t._depthStencilTexture=null,t}return s(t,e),n(t,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),t}(I_)),X_=e("b8",function(e){function t(){var t;return(t=e.call(this,Mc.INPUT_ASSEMBLER)||this)._attributes=[],t._attributesHash=0,t._vertexBuffers=[],t._indexBuffer=null,t._indirectBuffer=null,t._drawInfo=new Hl,t}s(t,e);var i=t.prototype;return i.getVertexBuffer=function(e){return void 0===e&&(e=0),e=0){var o=this._colorInfos[i.depthStencil];e+="ds,"+o.format+","+o.sampleCount}}else{e+="ca";for(var u=0;u>0,t.magFilter=(3&e)>>2,t.mipFilter=(3&e)>>4,t.addressU=(3&e)>>6,t.addressV=(3&e)>>8,t.addressW=(3&e)>>10,t.maxAnisotropy=(15&e)>>12,t.cmpFunc=(7&e)>>16,t},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),sd=e("bk",function(e){function t(){var t;return(t=e.call(this,Mc.SHADER)||this)._name="",t._stages=[],t._attributes=[],t._blocks=[],t._samplers=[],t}return s(t,e),n(t,[{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}}]),t}(I_)),ad=e("bl",function(e){function t(){var t;return(t=e.call(this,Mc.TEXTURE)||this)._info=new Wl,t._viewInfo=new jl,t._isPowerOf2=!1,t._isTextureView=!1,t._size=0,t}return s(t,e),t.getLevelCount=function(e,t){return Math.floor(Math.log2(Math.max(e,t)))},n(t,[{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}}]),t}(I_)),od=e("bm",function(e){function t(t,i){var n;return(n=e.call(this,Mc.GLOBAL_BARRIER)||this)._info=new c_,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){return Rc(e.prevAccesses+" "+e.nextAccesses+" "+e.type,666)},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),ud=e("bn",function(e){function t(t,i){var n;return(n=e.call(this,Mc.TEXTURE_BARRIER)||this)._info=new l_,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){var t=e.prevAccesses+" "+e.nextAccesses;return t+=e.type,t+=e.baseMipLevel,t+=e.levelCount,t+=e.baseSlice,t+=e.sliceCount,t+=e.discardContents,t+=e.srcQueue?e.srcQueue.type:0,Rc(t+=e.dstQueue?e.dstQueue.type:0,666)},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),hd=e("fa",function(e){function t(t,i){var n;return(n=e.call(this,Mc.BUFFER_BARRIER)||this)._info=new __,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){var t=e.prevAccesses+" "+e.nextAccesses;return t+=e.type,t+=e.offset,t+=e.size,t+=e.discardContents,t+=e.srcQueue?e.srcQueue.type:0,Rc(t+=e.dstQueue?e.dstQueue.type:0,666)},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),cd={Device:V_,Swapchain:W_,Buffer:H_,Texture:ad,Sampler:rd,Shader:sd,InputAssembler:X_,RenderPass:nd,Framebuffer:j_,DescriptorSet:K_,DescriptorSetLayout:Y_,PipelineLayout:q_,PipelineState:td,CommandBuffer:z_,Queue:id,GeneralBarrier:od,TextureBarrier:ud,BufferBarrier:hd,RasterizerState:Q_,BlendState:$_,BlendTarget:J_,DepthStencilState:Z_,PipelineStateInfo:ed};Object.assign(cd,k_),v.gfx=cd;var ld,_d,dd={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 fd in dd){var pd=dd[fd];!0===pd?pd=fd.slice(3):!1===pd&&(pd=fd),re(v,"cc",[{name:fd,newName:pd,target:v.gfx,targetName:"cc.gfx"}])}se(v,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),se(Dc,"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;"}]),se(s_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),se(a_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),re(V_.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]),function(e){e[e.AUTO=0]="AUTO",e[e.CANVAS=1]="CANVAS",e[e.WEBGL=2]="WEBGL",e[e.HEADLESS=3]="HEADLESS"}(ld||(ld=e("bo",{}))),function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.CANVAS=0]="CANVAS",e[e.WEBGL=1]="WEBGL",e[e.OPENGL=2]="OPENGL",e[e.HEADLESS=3]="HEADLESS"}(_d||(_d=e("bp",{})));var md=e("bq",function(){function e(){this.initialized=!1,this._canvas=null,this._renderType=_d.UNKNOWN}var t=e.prototype;return t.init=function(e,t){if(!this.initialized){var i=St.querySettings(At.Category.RENDERING,"renderMode");if(this._canvas=e,this._renderType=this._determineRenderType(i),this._renderType===_d.WEBGL){var n=new Ul(t),r=!!globalThis.WebGL2RenderingContext,s=globalThis.navigator.userAgent.toLowerCase();(-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")||Ec.browserType===Hh.UC)&&(r=!1);var a=[];r&&v.WebGL2Device&&a.push(v.WebGL2Device),v.WebGLDevice&&a.push(v.WebGLDevice),v.EmptyDevice&&a.push(v.EmptyDevice),V_.canvas=e;for(var o=0;o_d.HEADLESS||ethis.pipes.length?(q(4921),this):(this.pipes.splice(t,0,e),this)},t.append=function(e){return this.pipes.push(e),this},t.remove=function(e){return this.pipes.splice(e,1),this},t.sync=function(e){var t=this.pipes;if(0===t.length)return null;e.isFinished=!1;for(var i=0,n=t.length;i>2],xd[Dd[n++]]=Pd[(3&r)<<2|s>>4],xd[Dd[n++]]=Pd[15&s]}return e.replace(t,xd.join(""))}var Bd=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Ud(e){var t=Bd.exec(e);return t?t[1]:""}function Gd(e,t){(t=t||Object.create(null)).__isNative__=t.isNative,t.nativeExt&&(t.ext=t.nativeExt);var i=Rd.find((function(t){return!!t.getAssetInfo(e)}));return i&&(t.bundle=i.name),zd(e,t)}function kd(e){return!!e&&(e instanceof v.SceneAsset||e instanceof v.Scene)}function Hd(e){return e&&(46===e.charCodeAt(0)&&47===e.charCodeAt(1)?e=e.slice(2):47===e.charCodeAt(0)&&(e=e.slice(1))),e}function zd(e,t){var i=Md.create({input:e,options:t}),n=[];try{for(var r,s=d(bd.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(e){for(var u,h=d(i.output);!(u=h()).done;)u.value.recycle();k(e.message,e.stack)}return i.recycle(),n.length>1?n:n[0]}var Vd,Wd,jd,Xd=Object.freeze({__proto__:null,getUuidFromURL:Ud,getUrlWithUuid:Gd,isScene:kd,normalize:Hd,transform:zd,decodeUuid:Fd}),Kd=Ys,Yd=Vs,qd=e("cw",Gs("cc.Asset")((Wd=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r0&&this._ref--,e&&v.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(e){e&&(this._uuid=e),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return z(te(12101,this._uuid)),e.prototype.destroy.call(this)},n(t,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var e=this._native;if(47===e.charCodeAt(0))return e.slice(1);46===e.charCodeAt(0)?this._nativeUrl=Gd(this._uuid,{nativeExt:e,isNative:!0}):this._nativeUrl=Gd(this._uuid,{__nativeName__:e,nativeExt:ec(e),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(e){this._file=e}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),t}(Gh(Ba)),jd=Cs(Wd.prototype,"_native",[Kd],(function(){return""})),f(Wd.prototype,"_nativeAsset",[Yd],Object.getOwnPropertyDescriptor(Wd.prototype,"_nativeAsset"),Wd.prototype),Vd=Wd))||Vd);qd.prototype.createNode=null,v.Asset=qd;var Qd,Zd,Jd,$d,ef,tf,nf;!function(e){e[e.RGB565=Fc.R5G6B5]="RGB565",e[e.RGB5A1=Fc.RGB5A1]="RGB5A1",e[e.RGBA4444=Fc.RGBA4]="RGBA4444",e[e.RGB888=Fc.RGB8]="RGB888",e[e.RGB32F=Fc.RGB32F]="RGB32F",e[e.RGBA8888=Fc.RGBA8]="RGBA8888",e[e.RGBA32F=Fc.RGBA32F]="RGBA32F",e[e.A8=Fc.A8]="A8",e[e.I8=Fc.L8]="I8",e[e.AI8=Fc.LA8]="AI8",e[e.RGB_PVRTC_2BPPV1=Fc.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",e[e.RGBA_PVRTC_2BPPV1=Fc.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",e[e.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",e[e.RGB_PVRTC_4BPPV1=Fc.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",e[e.RGBA_PVRTC_4BPPV1=Fc.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",e[e.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",e[e.RGB_ETC1=Fc.ETC_RGB8]="RGB_ETC1",e[e.RGBA_ETC1=1026]="RGBA_ETC1",e[e.RGB_ETC2=Fc.ETC2_RGB8]="RGB_ETC2",e[e.RGBA_ETC2=Fc.ETC2_RGBA8]="RGBA_ETC2",e[e.RGBA_ASTC_4x4=Fc.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",e[e.RGBA_ASTC_5x4=Fc.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",e[e.RGBA_ASTC_5x5=Fc.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",e[e.RGBA_ASTC_6x5=Fc.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",e[e.RGBA_ASTC_6x6=Fc.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",e[e.RGBA_ASTC_8x5=Fc.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",e[e.RGBA_ASTC_8x6=Fc.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",e[e.RGBA_ASTC_8x8=Fc.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",e[e.RGBA_ASTC_10x5=Fc.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",e[e.RGBA_ASTC_10x6=Fc.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",e[e.RGBA_ASTC_10x8=Fc.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",e[e.RGBA_ASTC_10x10=Fc.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",e[e.RGBA_ASTC_12x10=Fc.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",e[e.RGBA_ASTC_12x12=Fc.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Qd||(Qd=e("bw",{}))),function(e){e[e.REPEAT=Qc.WRAP]="REPEAT",e[e.CLAMP_TO_EDGE=Qc.CLAMP]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=Qc.MIRROR]="MIRRORED_REPEAT",e[e.CLAMP_TO_BORDER=Qc.BORDER]="CLAMP_TO_BORDER"}(Zd||(Zd=e("dY",{}))),function(e){e[e.NONE=qc.NONE]="NONE",e[e.LINEAR=qc.LINEAR]="LINEAR",e[e.NEAREST=qc.POINT]="NEAREST"}(Jd||(Jd=e("c9",{})));var rf=1346981187,sf=mt({PVR:0,PKM:1,ASTC:2});function af(e,t){return e[t]<<8|e[t+1]}function of(e){return!!(Ec.hasFeature(Ec.Feature.IMAGE_BITMAP)&&e instanceof ImageBitmap)}var uf,hf,cf,lf,_f,df,ff,pf,mf,gf,vf,yf,Ef=e("ci",Gs("cc.ImageAsset")((nf=tf=function(e){function t(t){var i;return(i=e.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=Qd.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==t&&i.reset(t),i}s(t,e),t.mergeCompressedTextureMips=function(e){var t=new Uint8Array(0),i=null;try{for(var n,r=8+4*e.length,s=0,a=d(e);!(n=a()).done;)s+=n.value.byteLength;s+=r,t=new Uint8Array(s);var o=new DataView(t.buffer,t.byteOffset,t.byteLength);o.setUint32(0,rf,!0),o.setUint32(4,e.length,!0);for(var u=r,h=0;h0){var h=new Uint8Array(s,o,u),c=new Uint8Array(r._data.byteLength+h.byteLength);c.set(r._data),c.set(h,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[t]=u}else r._data=new Uint8Array(s,o);r.width=t>0?r.width:a[7],r.height=t>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var l=i+a[0],_=n-a.byteLength;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[t]=_}else r._data=new Uint8Array(s,l);r.width=t>0?r.width:a[1],r.height=t>0?r.height:a[2]}},t.parsePKMTexture=function(e,t,i,n,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s,i,16),o=af(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var u=i+16,h=n-16;if(n>0){var c=new Uint8Array(s,u,h),l=new Uint8Array(r._data.byteLength+c.byteLength);l.set(r._data),l.set(c,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[t]=h}else r._data=new Uint8Array(s,u);r.width=t>0?r.width:af(a,12),r.height=t>0?r.height:af(a,14)},t.parseASTCTexture=function(e,t,i,n,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],u=a[5],h=a[6];if((o<3||o>6||u<3||u>6||h<3||h>6)&&(o<4||7===o||9===o||11===o||o>12||u<4||7===u||9===u||11===u||u>12||1!==h))throw new Error("Invalid block number in ASTC header");var c=function(e,t){return 4===e?Qd.RGBA_ASTC_4x4:5===e?4===t?Qd.RGBA_ASTC_5x4:Qd.RGBA_ASTC_5x5:6===e?5===t?Qd.RGBA_ASTC_6x5:Qd.RGBA_ASTC_6x6:8===e?5===t?Qd.RGBA_ASTC_8x5:6===t?Qd.RGBA_ASTC_8x6:Qd.RGBA_ASTC_8x8:10===e?5===t?Qd.RGBA_ASTC_10x5:6===t?Qd.RGBA_ASTC_10x6:8===t?Qd.RGBA_ASTC_10x8:Qd.RGBA_ASTC_10x10:10===t?Qd.RGBA_ASTC_12x10:Qd.RGBA_ASTC_12x12}(o,u),l=i+16,_=n-16;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[t]=_}else r._data=new Uint8Array(s,l);r.width=t>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=t>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=c};var i=t.prototype;return i.reset=function(e){of(e)||e instanceof HTMLElement?this._nativeData=e:(this._nativeData=e,this._format=e.format)},i.destroy=function(){return this.data&&this.data instanceof HTMLImageElement?(this.data.src="",this._setRawAsset("")):of(this.data)&&this.data.close&&this.data.close(),e.prototype.destroy.call(this)},i._serialize=function(){},i._deserialize=function(e){var i="";"string"==typeof e?i=e:(this._width=e.w,this._height=e.h,i=e.fmt);for(var n,r=gd.gfxDevice,s=i.split("_"),a=Number.MAX_VALUE,o=this._format,u="",h=Rt.SUPPORT_TEXTURE_FORMATS,c=d(s);!(n=c()).done;){var l=n.value.split("@"),_=parseInt(l[0],void 0),f=t.extnames[_]||l[0],p=h.indexOf(f);if(-1!==p&&p=Qd.RGB_ETC1&&this._format<=Qd.RGBA_ASTC_12x12||this._format>=Qd.RGB_A_PVRTC_2BPPV1&&this._format<=Qd.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),t}(qd),tf.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],tf._sharedPlaceHolderCanvas=null,f((ef=nf).prototype,"_nativeAsset",[Ea],Object.getOwnPropertyDescriptor(ef.prototype,"_nativeAsset"),ef.prototype),$d=ef))||$d);v.ImageAsset=Ef,yt(Fc);var Tf,Af,Sf,Rf=new ge("Tex"),wf=e("d7",Gs("cc.TextureBase")((yf=vf=function(e){function t(){var t;return(t=e.call(this)||this)._format=cf&&cf(),t._minFilter=lf&&lf(),t._magFilter=_f&&_f(),t._mipFilter=df&&df(),t._wrapS=ff&&ff(),t._wrapT=pf&&pf(),t._wrapR=mf&&mf(),t._anisotropy=gf&&gf(),t._width=1,t._height=1,t._id=void 0,t._samplerInfo=new Xl,t._gfxSampler=null,t._gfxDevice=null,t._textureHash=0,t._id=Rf.getNewId(),t._gfxDevice=t._getGFXDevice(),t._textureHash=Rc(t._id,666),t}s(t,e);var i=t.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(e,t,i){void 0===i&&(i=e),this._wrapS=e,this._samplerInfo.addressU=e,this._wrapT=t,this._samplerInfo.addressV=t,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(e,t){this._minFilter=e,this._samplerInfo.minFilter=e,this._magFilter=t,this._samplerInfo.magFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(e){this._mipFilter=e,this._samplerInfo.mipFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(e){this._anisotropy=e,this._samplerInfo.maxAnisotropy=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var t,i=e.prototype.destroy.call(this);return i&&null!==(t=v.director.root)&&void 0!==t&&t.batcher2D&&v.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):Z(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(e){var t=e.split(",");t.unshift(""),t.length>=5&&(this.setFilters(parseInt(t[1]),parseInt(t[2])),this.setWrapMode(parseInt(t[3]),parseInt(t[4]))),t.length>=7&&(this.setMipFilter(parseInt(t[5])),this.setAnisotropy(parseInt(t[6])))},i._getGFXDevice=function(){return gd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(e){this._format=void 0===e?Qd.RGBA8888:e},i._getGFXPixelFormat=function(e){return e===Qd.RGBA_ETC1?e=Qd.RGB_ETC1:e===Qd.RGB_A_PVRTC_4BPPV1?e=Qd.RGB_PVRTC_4BPPV1:e===Qd.RGB_A_PVRTC_2BPPV1&&(e=Qd.RGB_PVRTC_2BPPV1),e},n(t,[{key:"isCompressed",get:function(){return this._format>=Qd.RGB_ETC1&&this._format<=Qd.RGBA_ASTC_12x12||this._format>=Qd.RGB_A_PVRTC_2BPPV1&&this._format<=Qd.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(qd),vf.PixelFormat=Qd,vf.WrapMode=Zd,vf.Filter=Jd,cf=Cs((hf=yf).prototype,"_format",[Ys],(function(){return Qd.RGBA8888})),lf=Cs(hf.prototype,"_minFilter",[Ys],(function(){return Jd.LINEAR})),_f=Cs(hf.prototype,"_magFilter",[Ys],(function(){return Jd.LINEAR})),df=Cs(hf.prototype,"_mipFilter",[Ys],(function(){return Jd.NONE})),ff=Cs(hf.prototype,"_wrapS",[Ys],(function(){return Zd.REPEAT})),pf=Cs(hf.prototype,"_wrapT",[Ys],(function(){return Zd.REPEAT})),mf=Cs(hf.prototype,"_wrapR",[Ys],(function(){return Zd.REPEAT})),gf=Cs(hf.prototype,"_anisotropy",[Ys],(function(){return 0})),uf=hf))||uf);v.TextureBase=wf;var If=e("hu",Gs("cc.Script")(Tf=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(qd))||Tf);v._Script=If;var bf=e("hv",Gs("cc.JavaScript")(Af=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(If))||Af);v._JavaScript=bf;var Of,Nf,Cf,Mf,Pf,Lf,xf,Df=e("hw",Gs("cc.TypeScript")(Sf=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(If))||Sf);v._TypeScript=Df;var Ff,Bf,Uf,Gf,kf,Hf,zf,Vf,Wf,jf,Xf,Kf,Yf=e("fz",Gs("cc.ClickEvent")((Nf=function(){function e(){this.target=Cf&&Cf(),this.component=Mf&&Mf(),this._componentId=Pf&&Pf(),this.handler=Lf&&Lf(),this.customEventData=xf&&xf()}e.emitEvents=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r=0,1620),i=Number.isNaN(i)?v.macro.REPEAT_FOREVER:i,n=n||0;var r=v.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(e,this,t,i,n,s)},i.scheduleOnce=function(e,t){void 0===t&&(t=0),this.schedule(e,0,0,t)},i.unschedule=function(e){e&&v.director.getScheduler().unschedule(e,this)},i.unscheduleAllCallbacks=function(){v.director.getScheduler().unscheduleAllForTarget(this)},n(t,[{key:"name",get:function(){if(this._name)return this._name;var e=Ce(this),t=e.lastIndexOf(".");return t>=0&&(e=e.slice(t+1)),this.node?this.node.name+"<"+e+">":e},set:function(e){this._name=e}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(e){if(this._enabled!==e&&(this._enabled=e,this.node.activeInHierarchy)){var t=v.director._compScheduler;e?t.enableComp(this):t.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&Qf}}]),t}(Ba),Vf.EventHandler=Yf,Vf.system=null,f((Gf=Wf).prototype,"__scriptAsset",[Bf],Object.getOwnPropertyDescriptor(Gf.prototype,"__scriptAsset"),Gf.prototype),kf=Cs(Gf.prototype,"node",[Ys],(function(){return null})),Hf=Cs(Gf.prototype,"_enabled",[Ys],(function(){return!0})),zf=Cs(Gf.prototype,"__prefab",[Ys],(function(){return null})),Uf=Gf))||Uf)),Jf=Zf.prototype;Jf.update=null,Jf.lateUpdate=null,Jf.__preload=null,Jf.onLoad=null,Jf.start=null,Jf.onEnable=null,Jf.onDisable=null,Jf.onDestroy=null,Jf.onFocusInEditor=null,Jf.onLostFocusInEditor=null,Jf.resetInEditor=null,Jf._getLocalBounds=null,Jf.onRestore=null,Zf._requireComponent=null,Zf._executionOrder=0,we(Zf,"_registerEditorProps",(function(e,t){var i=t.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),e._requireComponent=i);var n=t.executionOrder;n&&"number"==typeof n&&(e._executionOrder=n)})),v.Component=Zf;var $f=e("hl",Gs("cc.MissingScript")((Xf=function(e){function t(){var t;return(t=e.call(this)||this)._$erialized=Kf&&Kf(),t}return s(t,e),t.safeFindClass=function(e){var t=tt(e);if(t)return t;v.deserialize.reportMissingClass(e)},t.prototype.onLoad=function(){q(4600,this.node.name)},t}(Zf),Kf=Cs(Xf.prototype,"_$erialized",[Ys,Qs],(function(){return null})),jf=Xf))||jf);v._MissingScript=$f;try{var ep=$f.__values__;0!==ep.length&&"_$erialized"===ep[ep.length-1]||(k("The '_$erialized' prop in MissingScript is missing. Please contact jare."),k(" Error props: ['"+ep+"']"))}catch(Wn){k("Error when checking MissingScript 5, "+Wn)}var tp=function(){function e(e,t){this._document=void 0,this._chunks=void 0,this._document=e,this._chunks=t}return n(e,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),e}();function ip(e){var t=e;return{chunks:t.chunks,document:t.document}}function np(e){if(e.length<16)throw new rp(te(13102));var t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(1313817411!==t.getUint32(0,!0))throw new rp(te(13100));var i=t.getUint32(4,!0);if(1!==i)throw new rp(te(13101,i));if(t.getUint32(8,!0)!==t.byteLength)throw new rp(te(13102));var n=12,r=t.getUint32(n,!0);n+=4;var s=new Uint8Array(t.buffer,n+t.byteOffset,r);n+=r;var a,o=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);if("Buffer"in globalThis)return globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString();throw new Error(te(13104))}(s);try{a=JSON.parse(o)}catch(e){throw new rp(e)}for(var u=[];n0&&(e.chunks.length,this._mainBinChunk=e.chunks[0])):t=e,this._serializedData=t,this._context={fromCCON:i};var n=Array.isArray(t)?t[0]:t;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},t._deserializeObject=function(e,t,i,n){switch(e.__type__){case"TypedArray":return this._deserializeTypedArrayView(e);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(e);default:return e.__type__?this._deserializeTypeTaggedObject(e,t,i,n):Array.isArray(e)?this._deserializeArray(e):this._deserializePlainObject(e)}},t._deserializeTypedArrayView=function(e){return globalThis[e.ctor].from(e.array)},t._deserializeTypedArrayViewRef=function(e){var t=e.offset,i=e.length,n=e.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+t,i)},t._deserializeArray=function(e){for(var t,i=new Array(e.length),n=0;n=0&&(r.deserializedList[t]=i),i}(a);return this._deserializeInto(e,o,a),o},t._deserializeInto=function(e,t,i,n){void 0===n&&(n=!1),n||!t[Xa]?t._deserialize?t._deserialize(e.content,this):v.Class._isCCClass(i)?this._deserializeFireClass(t,e,i):this._deserializeFastDefinedObject(t,e,i):this._runCustomizedDeserialize(e,t,i)},t._runCustomizedDeserialize=function(e,t,i){var n=this,r={readProperty:function(t){var i=e[t];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(e,t,i,!0)},readSuper:function(){var r=ze(i);r&&n._deserializeInto(e,t,r)}};t[Xa](r,this._context)},t._deserializeFireClass=function(e,t,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(e,t){for(var i=di.Attr.getClassAttrs(t),n=t.__values__,r=["var prop;"],s=wt.test(rt(t)),a=0;a=0?t[i]=e[5][n]:e[7][3*~n]=t}function yp(e){return function(t,i,n,r){for(var s=0;s=0){var l=o[h];t[a]=gp(e,l,c)}else(0,Ap[h=~h])(e,t,a,c)}return r}(e);v.game._isCloning=!1,e[7]&&function(e,t,i){for(var n=e.length-1,r=0,s=3*e[n];r=0?a[i[u]]=o:a[~u]=o}for(;r=0?h[i[l]]=c:h[~l]=c}}(e[7],u,e[2]),function(e){for(var t=e[5],i=e[2],n=e[1],r=e[8],s=e[9],a=e[10],o=0;o=0?i[h]:~h,s[o]=h);var c=a[o];"number"==typeof c&&(a[o]=n[c])}}(e),n=u[h]}else n=function(e,t,i){var n,r=(i=i||{}).classFinder||tt,s=i.createAssetRefs||Ec.platform===jh.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,u=null!==(n=i.reportMissingClass)&&void 0!==n?n:v.deserialize.reportMissingClass;t.init();var h=lp.pool.get(t,r,u,a,o);v.game._isCloning=!0;var c=h.deserialize(e);return v.game._isCloning=!1,lp.pool.put(h),s&&t.assignAssetsBy((function(e,t){return EditorExtends.serialize.asAsset(e,t.type)})),c}(e,t,i);return r&&pp.pool.put(t),n}Ap[0]=function(e,t,i,n){t[i]=n},Ap[1]=vp,Ap[2]=yp(vp),Ap[3]=yp(Ep),Ap[4]=Tp,Ap[5]=function(e,t,i,n){fp[n[0]](t[i],n)},Ap[6]=Ep,Ap[7]=function(e,t,i,n){t[i].set(n)},Ap[8]=function(e,t,i,n){var r=new _p[n[0]];fp[n[0]](r,n),t[i]=r},Ap[9]=yp(Tp),Ap[10]=function(e,t,i,n){var r=e[3][n[0]];t[i]=gp(e,r,n[1])},Ap[11]=function(e,t,i,n){var r=n[0];t[i]=r;for(var s=1;s>t,r.texExtent.height=this._textureHeight>>t,r.texSubres.mipLevel=t,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(e)?n.copyBuffersToTexture([e],this._gfxTexture,Bp):n.copyTexImagesToTexture([e],this._gfxTexture,Bp)}}},i._assignImage=function(e,t,i){var n=e.data;if(n&&(this.uploadData(n,t,i),this._checkTextureLoaded(),Rt.CLEANUP_IMAGE_CACHE)){var r=Fp.getDeps(this._uuid),s=r.indexOf(e._uuid);-1!==s&&(ut(r,s),e.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(e){this._mipmapLevel=e<1?1:e},i._setMipRange=function(e,t){this._baseLevel=e<1?0:e,this._maxLevel=t<1?0:t},i.setMipRange=function(e,t){ee(e<=t,3124),this._setMipRange(e,t);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 e=this._getGFXDevice();e&&(this._createTexture(e),this._gfxTextureView=this._createTextureView(e))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(e){if(0!==this._width&&0!==this._height){var t=jc.NONE;this._mipFilter!==Jd.NONE&&function(e,t,i){return!(e.gfxAPI===Lc.WEBGL)||Up(t)&&Up(i)}(e,this._width,this._height)&&(this._mipmapLevel=function(e,t){for(var i=Math.max(e,t),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(t=jc.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Wc.SAMPLED|Wc.TRANSFER_DST,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:t});if(i){var n=e.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(e){if(!this._gfxTexture)return null;var t=this._maxLevel0){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(e,i){t._assignImage(e,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.initialize=function(){this.mipmaps=this._mipmaps},i.onLoaded=function(){this.initialize()},i.reset=function(e){this._width=e.width,this._height=e.height,this._setGFXFormat(e.format);var t=void 0===e.mipmapLevel?1:e.mipmapLevel;this._setMipmapLevel(t);var i=void 0===e.baseLevel?0:e.baseLevel,n=void 0===e.maxLevel?1e3:e.maxLevel;this._setMipRange(i,n),this._tryReset()},i.create=function(e,t,i,n,r,s){void 0===i&&(i=Qd.RGBA8888),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:e,height:t,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(e,t){if(void 0===e&&(e=0),!(e>=this._mipmaps.length))for(var i=Math.min(void 0===t?this._mipmaps.length:t,this._mipmaps.length-e),n=0;n"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(t,i){var n=t;e.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r0&&e[0].mipmapLevelDataSize&&e[0].mipmapLevelDataSize.length>0){jp.length=0;for(var t=e[0].mipmapLevelDataSize,i=e[0].data,n=e[0].width,r=e[0].height,s=e[0].format,a=0,o=0;o19||i<0)console.warn("maximum layers reached.");else{var n=1<19||t<0)console.warn("do not change buildin layers.");else{var i=1<31||t<0?(console.warn("Unable to access unknown layer."),""):e.Enum[1<0&&(s=i._findChildComponent(r._children,t)))return s}return null},i._findChildComponents=function(e,t,n){for(var r=0;r0&&i._findChildComponents(s._children,t,n)}};var t=i.prototype;function i(t){var i;return(i=e.call(this,t)||this)._parent=rm&&rm(),i._children=sm&&sm(),i._active=am&&am(),i._components=om&&om(),i._prefab=um&&um(),i._scene=null,i._activeInHierarchy=!1,i._id=Tm.getNewId(),i._name=void 0,i._eventProcessor=new v.NodeEventProcessor(l(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Zp(l(i)),i._static=!1,i._lpos=hm&&hm(),i._lrot=cm&&cm(),i._lscale=lm&&lm(),i._mobility=_m&&_m(),i._layer=dm&&dm(),i._euler=fm&&fm(),i._dirtyFlags=Qp.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._name=void 0!==t?t:"New Node",i._pos=new Ki,i._rot=new _n,i._scale=new Ki(1,1,1),i._mat=new En,i}return t._updateScene=function(){null==this._parent?k("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},t.attr=function(e){ke(this,e)},t.getParent=function(){return this._parent},t.setParent=function(e,t){if(void 0===t&&(t=!1),t&&this.updateWorldTransform(),this._parent!==e){var i=this._parent,n=e;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,t),this.emit&&this.emit(Jp.PARENT_CHANGED,i),i&&!(i._objFlags&vm)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(Jp.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(Jp.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},t.getChildByUuid=function(e){if(!e)return U("Invalid uuid"),null;for(var t=this._children,i=0,n=t.length;i0?(u=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,h=!0);o.length=0,i._stackId--},t.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},t.removeChild=function(e){this._children.indexOf(e)>-1&&(e.parent=null)},t.removeAllChildren=function(){for(var e=this._children,t=e.length-1;t>=0;t--){var i=e[t];i&&(i.parent=null)}this._children.length=0},t.isChildOf=function(e){var t=this;do{if(t===e)return!0;t=t._parent}while(t);return!1},t.getComponent=function(e){var t=Am(e);return t?i._findComponent(this,t):null},t.getComponents=function(e){var t=Am(e),n=[];return t&&i._findComponents(this,t,n),n},t.getComponentInChildren=function(e){var t=Am(e);return t?i._findChildComponent(this._children,t):null},t.getComponentsInChildren=function(e){var t=Am(e),n=[];return t&&(i._findComponents(this,t,n),i._findChildComponents(this._children,t,n)),n},t.addComponent=function(e){var t;if("string"==typeof e){if(!(t=it(e)))throw v._RF.peek()&&Z(3808,e),TypeError(te(3807,e))}else{if(!e)throw TypeError(te(3804));t=e}if("function"!=typeof t)throw TypeError(te(3809));if(!Ve(t,v.Component))throw TypeError(te(3810));var i=t._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n=0;){if(a=(t=Hm[n--]).hasChangedFlags,t.isValid&&(t._dirtyFlags&a&e)!==e)for(t._dirtyFlags|=e,t.hasChangedFlags=a|e,s=(i=t._children).length,r=0;r=0;)Ki.transformInverseRTS(e,e,i._lrot,i._lpos,i._lscale),i=Hm[--n];return e},t.setWorldPosition=function(e,t,i){void 0===t||void 0===i?Ki.copy(this._pos,e):Ki.set(this._pos,e,t,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),Ki.transformMat4(r,this._pos,En.invert(Gm,n._mat))):Ki.copy(r,this._pos),this.invalidateChildren(Qp.POSITION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.POSITION)},t.getWorldPosition=function(e){return this.updateWorldTransform(),e?Ki.copy(e,this._pos):Ki.copy(new Ki,this._pos)},t.setWorldRotation=function(e,t,i,n){void 0===t||void 0===i||void 0===n?_n.copy(this._rot,e):_n.set(this._rot,e,t,i,n),this._parent?(this._parent.updateWorldTransform(),_n.multiply(this._lrot,_n.conjugate(this._lrot,this._parent._rot),this._rot)):_n.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.setWorldRotationFromEuler=function(e,t,i){_n.fromEuler(this._rot,e,t,i),this._parent?(this._parent.updateWorldTransform(),_n.multiply(this._lrot,_n.conjugate(this._lrot,this._parent._rot),this._rot)):_n.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.getWorldRotation=function(e){return this.updateWorldTransform(),e?_n.copy(e,this._rot):_n.copy(new _n,this._rot)},t.setWorldScale=function(e,t,i){var n=this._parent;n&&this.updateWorldTransform(),void 0===t||void 0===i?Ki.copy(this._scale,e):Ki.set(this._scale,e,t,i),n?(Lm.x=this._scale.x/Ki.set(xm,this._mat.m00,this._mat.m01,this._mat.m02).length(),Lm.y=this._scale.y/Ki.set(xm,this._mat.m04,this._mat.m05,this._mat.m06).length(),Lm.z=this._scale.z/Ki.set(xm,this._mat.m08,this._mat.m09,this._mat.m10).length(),En.scale(Gm,this._mat,Lm),En.multiply(km,En.invert(km,n._mat),Gm),hn.fromQuat(Um,_n.conjugate(Bm,this._lrot)),hn.multiplyMat4(Um,Um,km),this._lscale.x=Ki.set(Lm,Um.m00,Um.m01,Um.m02).length(),this._lscale.y=Ki.set(Lm,Um.m03,Um.m04,Um.m05).length(),this._lscale.z=Ki.set(Lm,Um.m06,Um.m07,Um.m08).length()):Ki.copy(this._lscale,this._scale),this.invalidateChildren(Qp.SCALE),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.SCALE)},t.getWorldScale=function(e){return this.updateWorldTransform(),e?Ki.copy(e,this._scale):Ki.copy(new Ki,this._scale)},t.getWorldMatrix=function(e){this.updateWorldTransform();var t=e||new En;return En.copy(t,this._mat)},t.getWorldRS=function(e){this.updateWorldTransform();var t=e||new En;return En.copy(t,this._mat),t.m12=0,t.m13=0,t.m14=0,t},t.getWorldRT=function(e){this.updateWorldTransform();var t=e||new En;return En.fromRT(t,this._rot,this._pos)},t.setRTS=function(e,t,i){var n=0;e&&(n|=Qp.ROTATION,void 0!==e.w?(_n.copy(this._lrot,e),this._eulerDirty=!0):(Ki.copy(this._euler,e),_n.fromEuler(this._lrot,e.x,e.y,e.z),this._eulerDirty=!1)),t&&(Ki.copy(this._lpos,t),n|=Qp.POSITION),i&&(Ki.copy(this._lscale,i),n|=Qp.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,n))},t.pauseSystemEvents=function(e){this._eventProcessor.setEnabled(!1,e)},t.resumeSystemEvents=function(e){this._eventProcessor.setEnabled(!0,e)},i.resetHasChangedFlags=function(){Vm+=1},i.clearNodeArray=function(){i.ClearFrame0},set:function(e){e?this._objFlags|=ym:this._objFlags&=~ym}},{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(e){if(e=!!e,this._active!==e){this._active=e;var t=this._parent;t&&t._activeInHierarchy&&v.director._nodeActivator.activateNode(this,e)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(e){this.setParent(e)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"position",get:function(){return this._lpos},set:function(e){this.setPosition(e)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(e){this.setWorldPosition(e)}},{key:"rotation",get:function(){return this._lrot},set:function(e){this.setRotation(e)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(_n.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(e){this.setRotationFromEuler(e.x,e.y,e.z)}},{key:"angle",get:function(){return this._euler.z},set:function(e){Ki.set(this._euler,0,0,e),_n.fromAngleZ(this._lrot,e),this._eulerDirty=!1,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(e){this.setWorldRotation(e)}},{key:"scale",get:function(){return this._lscale},set:function(e){this.setScale(e)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(e){this.setWorldScale(e)}},{key:"matrix",set:function(e){En.toRTS(e,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Qp.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Ki.transformQuat(new Ki,Ki.FORWARD,this.worldRotation)},set:function(e){var t=e.length();Ki.multiplyScalar(Lm,e,-1/t),_n.fromViewUp(Dm,Lm),this.setWorldRotation(Dm)}},{key:"up",get:function(){return Ki.transformQuat(new Ki,Ki.UP,this.worldRotation)}},{key:"right",get:function(){return Ki.transformQuat(new Ki,Ki.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(e){this._mobility=e,this.emit(Jp.MOBILITY_CHANGED)}},{key:"layer",get:function(){return this._layer},set:function(e){this._layer=e,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(Jp.LAYER_CHANGED,this._layer)}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Vm?this._hasChangedFlags:0},set:function(e){this._flagChangeVersion=Vm,this._hasChangedFlags=e}}]),i}(Ba),pm.idGenerator=Tm,pm._stacks=[[]],pm._stackId=0,pm.EventType=Jp,pm.NodeSpace=qp,pm.TransformDirtyBit=Qp,pm.TransformBit=Qp,pm.reserveContentsForAllSyncablePrefabTag=zm,pm.ClearFrame=0,pm.ClearRound=1e3,f((nm=mm).prototype,"_persistNode",[Vs],Object.getOwnPropertyDescriptor(nm.prototype,"_persistNode"),nm.prototype),rm=Cs(nm.prototype,"_parent",[Ys],(function(){return null})),sm=Cs(nm.prototype,"_children",[Ys],(function(){return[]})),am=Cs(nm.prototype,"_active",[Ys],(function(){return!0})),om=Cs(nm.prototype,"_components",[Ys],(function(){return[]})),um=Cs(nm.prototype,"_prefab",[Ys],(function(){return null})),hm=Cs(nm.prototype,"_lpos",[Ys],(function(){return new Ki})),cm=Cs(nm.prototype,"_lrot",[Ys],(function(){return new _n})),lm=Cs(nm.prototype,"_lscale",[Ys],(function(){return new Ki(1,1,1)})),_m=Cs(nm.prototype,"_mobility",[Ys],(function(){return gm.Static})),dm=Cs(nm.prototype,"_layer",[Ys],(function(){return Yp.Enum.DEFAULT})),fm=Cs(nm.prototype,"_euler",[Ys],(function(){return new Ki})),f(nm.prototype,"eulerAngles",[em],Object.getOwnPropertyDescriptor(nm.prototype,"eulerAngles"),nm.prototype),f(nm.prototype,"mobility",[tm],Object.getOwnPropertyDescriptor(nm.prototype,"mobility"),nm.prototype),im=nm))||im));v.Node=Wm,function(e){e[e.right=0]="right",e[e.left=1]="left",e[e.top=2]="top",e[e.bottom=3]="bottom",e[e.front=4]="front",e[e.back=5]="back"}(Mm||(Mm={})),function(e){e[e.NONE=0]="NONE",e[e.AUTO=1]="AUTO",e[e.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Pm||(Pm={}));var jm=e("hs",Gs("cc.TextureCube")((Cm=Nm=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r=this._mipmaps.length))for(var n=Math.min(void 0===t?this._mipmaps.length:t,this._mipmaps.length-e),r=function(t){var n=e+t;Xm(i._mipmaps[n],(function(e,t){i._assignImage(e,n,t)}))},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(e,i){Xm(e,(function(e,n){t._assignImage(e,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(e){var t=this;if(this._mipmapAtlas=e,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(E.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(e){var s=r[e];Xm(n,(function(e,n){a.clearRect(0,0,i.width,i.height);var r=e.data;a.drawImage(r,0,0);var o=a.getImageData(s.left,s.top,s.width,s.height),u=new Ef({_data:o.data,_compressed:e.isCompressed,width:o.width,height:o.height,format:e.format});t._assignImage(u,s.level,n)}))},u=0;u>>26})),Lv=e("dg",(function(e){return(e&Nv)>>>20})),xv=e("dh",(function(e){return(e&Cv)>>>12})),Dv=e("di",(function(e){return 4095&e})),Fv=e("dj",(function(e,t){return 67108863&e|t<<26&Ov})),Bv=e("dk",((Ev={})[Uc.UNKNOWN]=function(e,t,i){return void 0===i&&(i=0),q(12010,i)},Ev[Uc.INT]=function(e,t,i){return void 0===i&&(i=0),e[i]},Ev[Uc.INT2]=function(e,t,i){return void 0===i&&(i=0),Rn.fromArray(t,e,i)},Ev[Uc.INT3]=function(e,t,i){return void 0===i&&(i=0),Ki.fromArray(t,e,i)},Ev[Uc.INT4]=function(e,t,i){return void 0===i&&(i=0),zi.fromArray(t,e,i)},Ev[Uc.FLOAT]=function(e,t,i){return void 0===i&&(i=0),e[i]},Ev[Uc.FLOAT2]=function(e,t,i){return void 0===i&&(i=0),Rn.fromArray(t,e,i)},Ev[Uc.FLOAT3]=function(e,t,i){return void 0===i&&(i=0),Ki.fromArray(t,e,i)},Ev[Uc.FLOAT4]=function(e,t,i){return void 0===i&&(i=0),zi.fromArray(t,e,i)},Ev[Uc.MAT3]=function(e,t,i){return void 0===i&&(i=0),hn.fromArray(t,e,i)},Ev[Uc.MAT4]=function(e,t,i){return void 0===i&&(i=0),En.fromArray(t,e,i)},Ev)),Uv=e("dl",((Tv={})[Uc.UNKNOWN]=function(e,t,i){return void 0===i&&(i=0),q(12010,i)},Tv[Uc.INT]=function(e,t,i){return void 0===i&&(i=0),e[i]=t},Tv[Uc.INT2]=function(e,t,i){return void 0===i&&(i=0),Rn.toArray(e,t,i)},Tv[Uc.INT3]=function(e,t,i){return void 0===i&&(i=0),Ki.toArray(e,t,i)},Tv[Uc.INT4]=function(e,t,i){return void 0===i&&(i=0),zi.toArray(e,t,i)},Tv[Uc.FLOAT]=function(e,t,i){return void 0===i&&(i=0),e[i]=t},Tv[Uc.FLOAT2]=function(e,t,i){return void 0===i&&(i=0),Rn.toArray(e,t,i)},Tv[Uc.FLOAT3]=function(e,t,i){return void 0===i&&(i=0),Ki.toArray(e,t,i)},Tv[Uc.FLOAT4]=function(e,t,i){return void 0===i&&(i=0),zi.toArray(e,t,i)},Tv[Uc.MAT3]=function(e,t,i){return void 0===i&&(i=0),hn.toArray(e,t,i)},Tv[Uc.MAT4]=function(e,t,i){return void 0===i&&(i=0),En.toArray(e,t,i)},Tv)),Gv=(e("dm",((Av={})[Uc.INT]=function(e){return"number"==typeof e},Av[Uc.FLOAT]=function(e){return"number"==typeof e},Av[Uc.INT2]=function(e){return!!(e instanceof Rn)},Av[Uc.FLOAT2]=function(e){return!!(e instanceof Rn)},Av[Uc.INT3]=function(e){return!!(e instanceof Ki)},Av[Uc.FLOAT3]=function(e){return!!(e instanceof Ki)},Av[Uc.INT4]=function(e){return!!(e instanceof zi)},Av[Uc.FLOAT4]=function(e){return!!(e instanceof zi||e instanceof en||e instanceof _n)},Av[Uc.MAT3]=function(e){return!!(e instanceof hn)},Av[Uc.MAT4]=function(e){return!!(e instanceof En)},Av)),[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 kv(e){switch(e){case Uc.BOOL:case Uc.INT:case Uc.UINT:case Uc.FLOAT:return Gv[0];case Uc.BOOL2:case Uc.INT2:case Uc.UINT2:case Uc.FLOAT2:return Gv[1];case Uc.BOOL4:case Uc.INT4:case Uc.UINT4:case Uc.FLOAT4:return Gv[2];case Uc.MAT4:return Gv[3];case Uc.SAMPLER2D:return"default-texture";case Uc.SAMPLER_CUBE:return"default-cube-texture";case Uc.SAMPLER2D_ARRAY:return"default-array-texture";case Uc.SAMPLER3D:return"default-3d-texture"}return Gv[0]}function Hv(e){switch(e){case Uc.SAMPLER2D:return"-texture";case Uc.SAMPLER_CUBE:return"-cube-texture";case Uc.SAMPLER2D_ARRAY:return"-array-texture";case Uc.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function zv(e,t){for(var i=Object.entries(t),n=!1,r=0;r31&&(e.uber=!0),e.constantMacros="",e.builtins.statistics)e.constantMacros+="#define "+r+" "+e.builtins.statistics[r]+"\n"}(i),this._templates[e.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new n_,n.blockSizes=[],n.bindings=[];for(var s=0;s>2)*o.count}for(var u=0;u0&&this.shaders.length>0},t}(qd),sy._effects={},sy._layoutValid=!0,ty=Cs((ey=ay).prototype,"techniques",[Ys],(function(){return[]})),iy=Cs(ey.prototype,"shaders",[Ys],(function(){return[]})),ny=Cs(ey.prototype,"combinations",[Ys],(function(){return[]})),ry=Cs(ey.prototype,"hideInEditor",[Ys,Qs],(function(){return!1})),$v=ey))||$v);v.EffectAsset=hy;var cy=function(){function e(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new vd,this.scenes=new vd,this.paths=new vd}var t=e.prototype;return t.init=function(e){var t=this;!function(e){var t=e.uuids,i=e.paths,n=e.types,r=e.deps,s=e.paths=Object.create(null);if(!1===e.debug){for(var a=0,o=t.length;at.length)||47===e.charCodeAt(t.length)}(r,e)||!e)for(var s=0,a=i.length;s0&&function(e){var t=Object.create(null);if(t[e._uuid]=e.refCount,fy(e,t,py,-1),py.length=0,0!==t[e._uuid])return t[e._uuid];for(var i in t)0!==t[i]&&fy(Td.get(i),t,py,1);return py.length=0,t[e._uuid]}(e)>0)){Td.remove(i);for(var n=Fp.getDeps(i),r=0,s=n.length;rthis._maxInterval?this._maxInterval:t;e-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=e)},e._handleQueue=function(e,t){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum0&&(xt(this._handleQueue.bind(this),e,t),this._checkNextPeriod=!0)},n(t,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}],[{key:"instance",get:function(){return t._instance||(t._instance=new t),t._instance}}]),t}();Wy._instance=void 0;var jy,Xy,Ky,Yy,qy,Qy,Zy=Wy.instance,Jy=e("e6",Wy.instance),$y=e("hr",Gs("cc.JsonAsset")((Xy=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r0){var a=Md.create({input:s,progress:r,options:n,onProgress:e.onProgress,onError:Md.prototype.recycle,onComplete:function(n){var r;n||((r=e.output).push.apply(r,a.output),a.recycle()),i&&fE(e),t(n)}});Id.async(a)}else i&&fE(e),t()}))}function fE(e){for(var t=e.output,i=0,n=t.length;i=1024)&&p.lightingMap.objectID===a.objectID&&p.useReflectionProbeType===h&&p.reflectionProbeCubemap.objectID===o.objectID&&p.reflectionProbePlanarMap.objectID===u.objectID&&p.stride===r){if(p.count>=p.capacity){p.capacity<<=1;var m=p.stride*p.capacity,g=p.data;p.data=new Uint8Array(m),p.data.set(g),p.vb.resize(m)}return p.shader=c,p.descriptorSet=l,p.data.set(n.buffer,p.stride*p.count++),void(this.hasPendingModels=!0)}}for(var v=this._device.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,32*r,r)),y=new Uint8Array(32*r),E=s.vertexBuffers.slice(),T=s.attributes.slice(),A=s.indexBuffer,S=0;Sm.size&&(m.resize(r),_.vbDatas[f]=new Uint8Array(r),_.vbDatas[f].set(g)),_.vbDatas[f].set(p.buffer,_.vbCount*p.stride)}var v=_.vbIdxData;(s=4*(a+_.vbCount))>_.vbIdx.size&&(_.vbIdx.resize(s),_.vbIdxData=new Float32Array(s/Float32Array.BYTES_PER_ELEMENT),_.vbIdxData.set(v),v=_.vbIdxData);var y=_.vbCount,E=y+a,T=_.mergeCount;if(v[y]!==T||v[E-1]!==T)for(var A=y;A>2,a=this._getBlockView(r,n),o=e.getOffsetFromHandle(t),u=0;u>2)*a,l=0;l+h.length<=c;l+=h.length)o.set(h,s+l);this._rootBufferDirty=!0}},t.resetTexture=function(t,i){var n=this.getHandle(t);if(n){var r=e.getTypeFromHandle(n),s=e.getBindingFromHandle(n),a=this._properties[t],o=a&&a.value,u=o?""+o+Hv(r):kv(r),h=PE.get(u),c=h&&h.getGFXTexture(),l=a&&void 0!==a.samplerHash?rd.unpackFromHash(a.samplerHash):h&&h.getSamplerInfo(),_=this._device.getSampler(l);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,c,i||0)}},t.resetUBOs=function(){for(var e=0;e>2)*r.count,h=0;h+o.length<=u;h+=o.length)s.set(o,i+h);i+=u}this._rootBufferDirty=!0},t.resetTextures=function(){for(var e=0;e=this._passes.length)return void console.warn("illegal pass index: "+i+".");var u=this._passes[i];this._uploadProperty(u,e,t)&&(this._props[u.propertyIndex][e]=t,n=!0)}n||console.warn("illegal property name: "+e+".")},i.getProperty=function(e,t){if(void 0===t)for(var i=this._props,n=i.length,r=0;r=this._props.length)return console.warn("illegal pass index: "+t+"."),null;var a=this._props[this._passes[t].propertyIndex];if(e in a)return a[e]}return null},i.copy=function(e,t){this._techIdx=e._techIdx,this._props.length=e._props.length;for(var i=0;i0},n(t,[{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}}]),t}(qd),YE=Cs(KE.prototype,"_effectAsset",[jE],(function(){return null})),qE=Cs(KE.prototype,"_techIdx",[Ys],(function(){return 0})),QE=Cs(KE.prototype,"_defines",[Ys],(function(){return[]})),ZE=Cs(KE.prototype,"_states",[Ys],(function(){return[]})),JE=Cs(KE.prototype,"_props",[Ys],(function(){return[]})),XE=KE))||XE));v.Material=nT;var rT=e("bP",mt({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048})),sT=e("bQ",mt({Planar:0,ShadowMap:1})),aT=e("bR",mt({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3})),oT=e("bS",mt({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4})),uT=e("bT",mt({NONE:1,RemoveDuplicates:2,DisableRotationFix:3})),hT=sT.ShadowMap+1,cT=e("bU",function(){function e(){this.fixedSphere=new lr(0,0,0,.01),this.maxReceived=4,this._matLight=new En,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=hT,this._distance=0,this._normal=new Ki(0,1,0),this._shadowColor=new en(0,0,0,76),this._size=new Rn(1024,1024),this._shadowMapDirty=!1}var t=e.prototype;return t.getPlanarShader=function(e){this._material||(this._material=new nT,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=this._material.passes;return t.length>0?t[0].getShaderVariant(e):null},t.getPlanarInstanceShader=function(e){this._instancingMaterial||(this._instancingMaterial=new nT,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var t=this._instancingMaterial.passes;return t.length>0?t[0].getShaderVariant(e):null},t.initialize=function(e){this._enabled=e.enabled,this._type=this.enabled?e.type:hT,this.normal=e.planeDirection,this.distance=e.planeHeight,this.shadowColor=e.shadowColor,this.maxReceived=e.maxReceived,e.shadowMapSize!==this._size.x&&(this.size.set(e.shadowMapSize,e.shadowMapSize),this._shadowMapDirty=!0)},t.activate=function(){if(this._enabled)if(this.type===sT.Planar)this._updatePlanarInfo();else{var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=2,e.onGlobalPipelineStateChanged()}else{var t=v.director.root;t.pipeline.macros.CC_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()}},t._updatePlanarInfo=function(){this._material||(this._material=new nT,this._material.initialize({effectName:"pipeline/planar-shadow"})),this._instancingMaterial||(this._instancingMaterial=new nT,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=1,e.onGlobalPipelineStateChanged()},t.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,this.activate()}},{key:"type",get:function(){return this._type},set:function(e){this._type=this.enabled?e:hT,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(e){Ki.copy(this._normal,e)}},{key:"distance",get:function(){return this._distance},set:function(e){this._distance=e}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(e){this._shadowColor=e}},{key:"size",get:function(){return this._size},set:function(e){this._size.set(e)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(e){this._shadowMapDirty=e}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),e}());cT.MAX_FAR=2e3,cT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),v.Shadows=cT;var lT=e("dv",function(e){function t(t,i){var n;(n=e.call(this,t.root)||this)._parent=void 0,n._owner=void 0,n._dontNotify=!1,n._parent=t,n._owner=i,n._doInit(n._parent,!0);for(var r=0;r0)for(var u=0;u=0&&s.node._components.splice(a,1)}}}function lw(e,t,i){if(!(t.length<=0))for(var n=null,r=0;r0){var u=o.pop();if(!u)continue;for(var h=0;h0){var g=p.pop();if(!g)return;for(var v=0;vMath.abs(t)?e:-t},t}(jw),Qw=function(e){function t(t){var i;return(i=e.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=t.up,i.down=t.down,i.left=t.left,i.right=t.right,i.xAxis=new qw({positive:i.right,negative:i.left}),i.yAxis=new qw({positive:i.up,negative:i.down}),i}return s(t,e),t.prototype.getValue=function(){return new Rn(this.xAxis.getValue(),this.yAxis.getValue())},t}(Xw),Zw=(function(e){function t(t){var i;return(i=e.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=t.up,i.down=t.down,i.left=t.left,i.right=t.right,i.forward=t.forward,i.backward=t.backward,i.xAxis=new qw({positive:i.right,negative:i.left}),i.yAxis=new qw({positive:i.up,negative:i.down}),i.zAxis=new qw({positive:i.forward,negative:i.backward}),i}s(t,e),t.prototype.getValue=function(){return new Ki(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(Kw),function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(jw)),Jw=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(Qw),$w=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(Qw),eI=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(Yw),tI=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(Kw),iI=function(){function e(e){this._deviceId=-1,this._connected=!1,this._deviceId=e,this._initInputSource()}e._init=function(){qh.hasFeature(Xh.EVENT_GAMEPAD)&&e._registerEvent()},e._on=function(t,i,n){e._eventTarget.on(t,i,n)},e._removeInputDevice=function(t){var i=e.all.findIndex((function(e){return e.deviceId===t}));-1!==i&&ut(e.all,i)},e._getOrCreateInputDevice=function(t,i){var n=e.all.find((function(e){return e.deviceId===t}));return n||(n=new e(t),e.all.push(n)),n._connected=i,n},e._ensureDirectorDefined=function(){return new Promise((function(t){e._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(e._intervalId),e._intervalId=-1,t())}),50)}))},e._registerEvent=function(){e._ensureDirectorDefined().then((function(){v.director.on(v.Director.EVENT_BEGIN_FRAME,e._scanGamepads)})).catch((function(){})),window.addEventListener("gamepadconnected",(function(t){e._cachedWebGamepads[t.gamepad.index]=t.gamepad;var i=e._getOrCreateInputDevice(t.gamepad.index,!0);e._eventTarget.emit(bw.GAMEPAD_CHANGE,new Dw(bw.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(t){e._cachedWebGamepads[t.gamepad.index]=null;var i=e._getOrCreateInputDevice(t.gamepad.index,!1);e._removeInputDevice(t.gamepad.index),e._eventTarget.emit(bw.GAMEPAD_CHANGE,new Dw(bw.GAMEPAD_CHANGE,i))}))},e._scanGamepads=function(){var t=e._getWebGamePads();if(t){for(var i=[],n=0;n.01){a=e._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}for(var l=s.axes,_=0;_.01){a=e._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}}}}e._cachedWebGamepads=t;for(var p=0;p0?{negative:0,positive:t}:e<0?{negative:t,positive:0}:{negative:0,positive:0}},t._initInputSource=function(){var t=this;this._buttonNorth=new Zw,this._buttonNorth.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[3].value:0},this._buttonEast=new Zw,this._buttonEast.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[1].value:0},this._buttonWest=new Zw,this._buttonWest.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[2].value:0},this._buttonSouth=new Zw,this._buttonSouth.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[0].value:0},this._buttonL1=new Zw,this._buttonL1.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new Zw,this._buttonL2.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[6].value:0},this._buttonL3=new Zw,this._buttonL3.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[10].value:0},this._buttonR1=new Zw,this._buttonR1.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new Zw,this._buttonR2.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[7].value:0},this._buttonR3=new Zw,this._buttonR3.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[11].value:0},this._buttonShare=new Zw,this._buttonShare.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new Zw,this._buttonOptions.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[9].value:0};var i=new Zw;i.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[12].value:0};var n=new Zw;n.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[13].value:0};var r=new Zw;r.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[14].value:0};var s=new Zw;s.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[15].value:0},this._dpad=new Jw({up:i,down:n,left:r,right:s});var a=new Zw;a.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[1]).negative:0};var o=new Zw;o.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[1]).positive:0};var u=new Zw;u.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[0]).negative:0};var h=new Zw;h.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[0]).positive:0},this._leftStick=new $w({up:a,down:o,left:u,right:h});var c=new Zw;c.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[3]).negative:0};var l=new Zw;l.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[3]).positive:0};var _=new Zw;_.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[2]).negative:0};var d=new Zw;d.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[2]).positive:0},this._rightStick=new $w({up:c,down:l,left:_,right:d}),this._buttonStart=new Zw,this._buttonStart.getValue=function(){return 0}},n(e,[{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}}]),e}();iI.all=[],iI._eventTarget=new kh,iI._cachedWebGamepads=[],iI._intervalId=-1,function(e){e[e.BUTTON_EAST=0]="BUTTON_EAST",e[e.BUTTON_SOUTH=1]="BUTTON_SOUTH",e[e.BUTTON_WEST=2]="BUTTON_WEST",e[e.BUTTON_NORTH=3]="BUTTON_NORTH",e[e.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",e[e.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",e[e.TRIGGER_LEFT=6]="TRIGGER_LEFT",e[e.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",e[e.GRIP_LEFT=8]="GRIP_LEFT",e[e.GRIP_RIGHT=9]="GRIP_RIGHT",e[e.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",e[e.LEFT_STICK_UP=11]="LEFT_STICK_UP",e[e.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",e[e.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",e[e.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",e[e.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",e[e.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",e[e.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",e[e.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",e[e.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",e[e.ROKID_MENU=20]="ROKID_MENU",e[e.ROKID_START=21]="ROKID_START"}(kw||(kw={})),function(e){e[e.KET_CLICK=0]="KET_CLICK",e[e.KET_STICK=1]="KET_STICK",e[e.KET_GRAB=2]="KET_GRAB"}(Hw||(Hw={})),function(e){e[e.UNDEFINE=0]="UNDEFINE",e[e.X=1]="X",e[e.Y=2]="Y",e[e.LEFT_STICK_X=3]="LEFT_STICK_X",e[e.LEFT_STICK_Y=4]="LEFT_STICK_Y",e[e.RIGHT_STICK_X=5]="RIGHT_STICK_X",e[e.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",e[e.LEFT_TRIGGER=7]="LEFT_TRIGGER",e[e.RIGHT_TIRGGER=8]="RIGHT_TIRGGER",e[e.LEFT_GRIP=9]="LEFT_GRIP",e[e.RIGHT_GRIP=10]="RIGHT_GRIP"}(zw||(zw={}));var nI,rI,sI={1:kw.BUTTON_EAST,2:kw.BUTTON_SOUTH,3:kw.BUTTON_NORTH,4:kw.BUTTON_WEST,9:kw.BUTTON_LEFT_STICK,10:kw.BUTTON_RIGHT_STICK,11:kw.ROKID_MENU,12:kw.ROKID_START,13:kw.BUTTON_TRIGGER_LEFT,14:kw.BUTTON_TRIGGER_RIGHT},aI=function(){function e(){var e,t=this;this._eventTarget=new kh,this._nativeButtonState=((e={})[kw.BUTTON_SOUTH]=0,e[kw.BUTTON_EAST]=0,e[kw.BUTTON_WEST]=0,e[kw.BUTTON_NORTH]=0,e[kw.BUTTON_TRIGGER_LEFT]=0,e[kw.BUTTON_TRIGGER_RIGHT]=0,e[kw.TRIGGER_LEFT]=0,e[kw.TRIGGER_RIGHT]=0,e[kw.GRIP_LEFT]=0,e[kw.GRIP_RIGHT]=0,e[kw.LEFT_STICK_UP]=0,e[kw.LEFT_STICK_DOWN]=0,e[kw.LEFT_STICK_LEFT]=0,e[kw.LEFT_STICK_RIGHT]=0,e[kw.RIGHT_STICK_UP]=0,e[kw.RIGHT_STICK_DOWN]=0,e[kw.RIGHT_STICK_LEFT]=0,e[kw.RIGHT_STICK_RIGHT]=0,e[kw.BUTTON_LEFT_STICK]=0,e[kw.BUTTON_RIGHT_STICK]=0,e[kw.ROKID_MENU]=0,e[kw.ROKID_START]=0,e),this._initInputSource(),window.addEventListener("xr-remote-input",(function(e){var i=e,n=i.detail.keyEventType,r=i.detail.stickAxisCode,s=i.detail.stickAxisValue,a=i.detail.stickKeyCode,o=i.detail.isButtonPressed;if(n===Hw.KET_CLICK){var u=sI[a];t._nativeButtonState[u]=o?1:0}else if(n===Hw.KET_STICK||n===Hw.KET_GRAB){var h,c,l;switch(r){case zw.LEFT_STICK_X:h=kw.LEFT_STICK_LEFT,c=kw.LEFT_STICK_RIGHT,l=t._axisToButtons(s);break;case zw.LEFT_STICK_Y:h=kw.LEFT_STICK_DOWN,c=kw.LEFT_STICK_UP,l=t._axisToButtons(s);break;case zw.RIGHT_STICK_X:h=kw.RIGHT_STICK_LEFT,c=kw.RIGHT_STICK_RIGHT,l=t._axisToButtons(s);break;case zw.RIGHT_STICK_Y:h=kw.RIGHT_STICK_DOWN,c=kw.RIGHT_STICK_UP,l=t._axisToButtons(s);break;case zw.LEFT_TRIGGER:t._nativeButtonState[kw.TRIGGER_LEFT]=s;break;case zw.RIGHT_TIRGGER:t._nativeButtonState[kw.TRIGGER_RIGHT]=s;break;case zw.LEFT_GRIP:t._nativeButtonState[kw.GRIP_LEFT]=s;break;case zw.RIGHT_GRIP:t._nativeButtonState[kw.GRIP_RIGHT]=s}h&&c&&l&&(t._nativeButtonState[h]=l.negative,t._nativeButtonState[c]=l.positive)}t._eventTarget.emit(bw.HANDLE_INPUT,new Fw(bw.HANDLE_INPUT,t))}))}var t=e.prototype;return t._axisToButtons=function(e){var t=Math.abs(e);return e>0?{negative:0,positive:t}:e<0?{negative:t,positive:0}:{negative:0,positive:0}},t._on=function(e,t,i){this._eventTarget.on(e,t,i)},t._initInputSource=function(){var e=this;this._buttonNorth=new Zw,this._buttonNorth.getValue=function(){return e._nativeButtonState[kw.BUTTON_NORTH]},this._buttonEast=new Zw,this._buttonEast.getValue=function(){return e._nativeButtonState[kw.BUTTON_EAST]},this._buttonWest=new Zw,this._buttonWest.getValue=function(){return e._nativeButtonState[kw.BUTTON_WEST]},this._buttonSouth=new Zw,this._buttonSouth.getValue=function(){return e._nativeButtonState[kw.BUTTON_SOUTH]},this._buttonTriggerLeft=new Zw,this._buttonTriggerLeft.getValue=function(){return e._nativeButtonState[kw.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new Zw,this._buttonTriggerRight.getValue=function(){return e._nativeButtonState[kw.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new Zw,this._triggerLeft.getValue=function(){return e._nativeButtonState[kw.TRIGGER_LEFT]},this._triggerRight=new Zw,this._triggerRight.getValue=function(){return e._nativeButtonState[kw.TRIGGER_RIGHT]},this._gripLeft=new Zw,this._gripLeft.getValue=function(){return e._nativeButtonState[kw.GRIP_LEFT]},this._gripRight=new Zw,this._gripRight.getValue=function(){return e._nativeButtonState[kw.GRIP_RIGHT]},this._buttonLeftStick=new Zw,this._buttonLeftStick.getValue=function(){return e._nativeButtonState[kw.BUTTON_LEFT_STICK]};var t=new Zw;t.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_UP]};var i=new Zw;i.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_DOWN]};var n=new Zw;n.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_LEFT]};var r=new Zw;r.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_RIGHT]},this._leftStick=new $w({up:t,down:i,left:n,right:r}),this._buttonRightStick=new Zw,this._buttonRightStick.getValue=function(){return e._nativeButtonState[kw.BUTTON_RIGHT_STICK]};var s=new Zw;s.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_UP]};var a=new Zw;a.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_DOWN]};var o=new Zw;o.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_LEFT]};var u=new Zw;u.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_RIGHT]},this._rightStick=new $w({up:s,down:a,left:o,right:u}),this._buttonOptions=new Zw,this._buttonOptions.getValue=function(){return e._nativeButtonState[kw.ROKID_MENU]},this._buttonStart=new Zw,this._buttonStart.getValue=function(){return e._nativeButtonState[kw.ROKID_START]},this._handLeftPosition=new tI,this._handLeftPosition.getValue=function(){return Ki.ZERO},this._handLeftOrientation=new eI,this._handLeftOrientation.getValue=function(){return _n.IDENTITY},this._handRightPosition=new tI,this._handRightPosition.getValue=function(){return Ki.ZERO},this._handRightOrientation=new eI,this._handRightOrientation.getValue=function(){return _n.IDENTITY},this._aimLeftPosition=new tI,this._aimLeftPosition.getValue=function(){return Ki.ZERO},this._aimLeftOrientation=new eI,this._aimLeftOrientation.getValue=function(){return _n.IDENTITY},this._aimRightPosition=new tI,this._aimRightPosition.getValue=function(){return Ki.ZERO},this._aimRightOrientation=new eI,this._aimRightOrientation.getValue=function(){return _n.IDENTITY}},n(e,[{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:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{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}}]),e}(),oI=function(){function e(){this._eventTarget=new kh,this._initInputSource()}var t=e.prototype;return t._on=function(e,t,i){this._eventTarget.on(e,t,i)},t._initInputSource=function(){this._viewLeftPosition=new tI,this._viewLeftPosition.getValue=function(){return Ki.ZERO},this._viewLeftOrientation=new eI,this._viewLeftOrientation.getValue=function(){return _n.IDENTITY},this._viewRightPosition=new tI,this._viewRightPosition.getValue=function(){return Ki.ZERO},this._viewRightOrientation=new eI,this._viewRightOrientation.getValue=function(){return _n.IDENTITY},this._headMiddlePosition=new tI,this._headMiddlePosition.getValue=function(){return Ki.ZERO},this._headMiddleOrientation=new eI,this._headMiddleOrientation.getValue=function(){return _n.IDENTITY}},n(e,[{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}}]),e}(),uI=function(){function e(){this._eventTarget=new kh,this._initInputSource()}var t=e.prototype;return t._on=function(e,t,i){this._eventTarget.on(e,t,i)},t._initInputSource=function(){this._handheldPosition=new tI,this._handheldPosition.getValue=function(){return Ki.ZERO},this._handheldOrientation=new eI,this._handheldOrientation.getValue=function(){return _n.IDENTITY}},n(e,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),e}(),hI={Backspace:xw.BACKSPACE,Tab:xw.TAB,Enter:xw.ENTER,ShiftLeft:xw.SHIFT_LEFT,ControlLeft:xw.CTRL_LEFT,AltLeft:xw.ALT_LEFT,ShiftRight:xw.SHIFT_RIGHT,ControlRight:xw.CTRL_RIGHT,AltRight:xw.ALT_RIGHT,Pause:xw.PAUSE,CapsLock:xw.CAPS_LOCK,Escape:xw.ESCAPE,Space:xw.SPACE,PageUp:xw.PAGE_UP,PageDown:xw.PAGE_DOWN,End:xw.END,Home:xw.HOME,ArrowLeft:xw.ARROW_LEFT,ArrowUp:xw.ARROW_UP,ArrowRight:xw.ARROW_RIGHT,ArrowDown:xw.ARROW_DOWN,Insert:xw.INSERT,Delete:xw.DELETE,Digit0:xw.DIGIT_0,Digit1:xw.DIGIT_1,Digit2:xw.DIGIT_2,Digit3:xw.DIGIT_3,Digit4:xw.DIGIT_4,Digit5:xw.DIGIT_5,Digit6:xw.DIGIT_6,Digit7:xw.DIGIT_7,Digit8:xw.DIGIT_8,Digit9:xw.DIGIT_9,KeyA:xw.KEY_A,KeyB:xw.KEY_B,KeyC:xw.KEY_C,KeyD:xw.KEY_D,KeyE:xw.KEY_E,KeyF:xw.KEY_F,KeyG:xw.KEY_G,KeyH:xw.KEY_H,KeyI:xw.KEY_I,KeyJ:xw.KEY_J,KeyK:xw.KEY_K,KeyL:xw.KEY_L,KeyM:xw.KEY_M,KeyN:xw.KEY_N,KeyO:xw.KEY_O,KeyP:xw.KEY_P,KeyQ:xw.KEY_Q,KeyR:xw.KEY_R,KeyS:xw.KEY_S,KeyT:xw.KEY_T,KeyU:xw.KEY_U,KeyV:xw.KEY_V,KeyW:xw.KEY_W,KeyX:xw.KEY_X,KeyY:xw.KEY_Y,KeyZ:xw.KEY_Z,Numpad0:xw.NUM_0,Numpad1:xw.NUM_1,Numpad2:xw.NUM_2,Numpad3:xw.NUM_3,Numpad4:xw.NUM_4,Numpad5:xw.NUM_5,Numpad6:xw.NUM_6,Numpad7:xw.NUM_7,Numpad8:xw.NUM_8,Numpad9:xw.NUM_9,NumpadMultiply:xw.NUM_MULTIPLY,NumpadAdd:xw.NUM_PLUS,NumpadSubtract:xw.NUM_SUBTRACT,NumpadDecimal:xw.NUM_DECIMAL,NumpadDivide:xw.NUM_DIVIDE,NumpadEnter:xw.NUM_ENTER,F1:xw.F1,F2:xw.F2,F3:xw.F3,F4:xw.F4,F5:xw.F5,F6:xw.F6,F7:xw.F7,F8:xw.F8,F9:xw.F9,F10:xw.F10,F11:xw.F11,F12:xw.F12,NumLock:xw.NUM_LOCK,ScrollLock:xw.SCROLL_LOCK,Semicolon:xw.SEMICOLON,Equal:xw.EQUAL,Comma:xw.COMMA,Minus:xw.DASH,Period:xw.PERIOD,Slash:xw.SLASH,Backquote:xw.BACK_QUOTE,BracketLeft:xw.BRACKET_LEFT,Backslash:xw.BACKSLASH,BracketRight:xw.BRACKET_RIGHT,Quote:xw.QUOTE},cI=function(){function e(){this._eventTarget=new kh,this._registerEvent()}var t=e.prototype;return t.dispatchKeyboardDownEvent=function(e){this._handleKeyboardDown(e)},t.dispatchKeyboardUpEvent=function(e){this._handleKeyboardUp(e)},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},t._registerEvent=function(){var e=document.getElementById("GameCanvas");null==e||e.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==e||e.addEventListener("keyup",this._handleKeyboardUp.bind(this))},t._getInputEvent=function(e,t){var i,n=(i=e.code,hI[i]||xw.NONE);return new Cw(n,t)},t._handleKeyboardDown=function(e){if(e.stopPropagation(),e.preventDefault(),e.repeat){var t=this._getInputEvent(e,bw.KEY_PRESSING);this._eventTarget.emit(bw.KEY_PRESSING,t)}else{var i=this._getInputEvent(e,bw.KEY_DOWN);this._eventTarget.emit(bw.KEY_DOWN,i)}},t._handleKeyboardUp=function(e){var t=this._getInputEvent(e,bw.KEY_UP);e.stopPropagation(),e.preventDefault(),this._eventTarget.emit(bw.KEY_UP,t)},e}(),lI=function(){function e(){this._canvas=void 0,this._eventTarget=new kh,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new Rn,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,qh.hasFeature(Xh.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||m||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(bw.MOUSE_DOWN),this._handleMouseMove=this._createCallback(bw.MOUSE_MOVE),this._handleMouseUp=this._createCallback(bw.MOUSE_UP),this._registerEvent())}var t=e.prototype;return t.dispatchMouseDownEvent=function(e){this._handleMouseDown(e)},t.dispatchMouseMoveEvent=function(e){this._handleMouseMove(e)},t.dispatchMouseUpEvent=function(e){this._handleMouseUp(e)},t.dispatchScrollEvent=function(e){this._handleMouseWheel(e)},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},t._getCanvasRect=function(){var e=this._canvas,t=null==e?void 0:e.getBoundingClientRect();return t?new Pn(t.x,t.y,t.width,t.height):new Pn(0,0,0,0)},t._getLocation=function(e){var t=this._getCanvasRect(),i=gc.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+e.movementX:e.clientX-t.x,r=this._pointLocked?this._preMousePos.y/i-e.movementY:t.y+t.height-e.clientY;return new Rn(n*=i,r*=i)},t._registerEvent=function(){var e,t,i,n,r=this;window.addEventListener("mousedown",(function(){r._isPressed=!0})),null===(e=this._canvas)||void 0===e||e.addEventListener("mousedown",this._handleMouseDown),null===(t=this._canvas)||void 0===t||t.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()},t._registerPointerLockEvent=function(){var e=this,t=function(){var t=e._canvas;document.pointerLockElement===t||document.mozPointerLockElement===t?e._pointLocked=!0:e._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",t,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",t,!1)},t._createCallback=function(e){var t=this;return function(i){var n,r=t._getLocation(i),s=i.button,a=i.buttons,o=s;switch(e){case bw.MOUSE_DOWN:null===(n=t._canvas)||void 0===n||n.focus(),t._isPressed=!0;break;case bw.MOUSE_UP:t._isPressed=!1;break;case bw.MOUSE_MOVE:o=1&a?Mw.BUTTON_LEFT:2&a?Mw.BUTTON_RIGHT:4&a?Mw.BUTTON_MIDDLE:Mw.BUTTON_MISSING}var u=new Mw(e,!1,t._preMousePos);u.setLocation(r.x,r.y),u.setButton(o),u.movementX=i.movementX,u.movementY=i.movementY,t._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===t._canvas&&i.preventDefault(),t._eventTarget.emit(e,u)}},t._handleMouseWheel=function(e){var t=bw.MOUSE_WHEEL,i=this._getLocation(e),n=e.button,r=new Mw(t,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=e.movementX,r.movementY=e.movementY,r.setScrollData(5*e.deltaX,5*-e.deltaY),this._preMousePos.set(i.x,i.y),e.stopPropagation(),e.target===this._canvas&&e.preventDefault(),this._eventTarget.emit(t,r)},e}(),_I=new Rn,dI=new(function(){function e(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var t=e.prototype;return t._cloneTouch=function(e){var t=e.getID();e.getStartLocation(_I);var i=new Gw(_I.x,_I.y,t);return e.getLocation(_I),i.setPoint(_I.x,_I.y),e.getPreviousLocation(_I),i.setPrevPoint(_I),i},t._createTouch=function(e,t,i){if(this._touchMap.has(e))console.log("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(e)){var n=new Gw(t,i,e);return this._touchMap.set(e,n),this._updateTouch(n,t,i),this._cloneTouch(n)}console.log("The touches is more than MAX_TOUCHES.")}},t.releaseTouch=function(e){this._touchMap.has(e)&&this._touchMap.delete(e)},t.getTouch=function(e,t,i){var n=this._touchMap.get(e);return n?this._updateTouch(n,t,i):n=this._createTouch(e,t,i),n?this._cloneTouch(n):void 0},t.getAllTouches=function(){var e=this,t=[];return this._touchMap.forEach((function(i){if(i){var n=e._cloneTouch(i);t.push(n)}})),t},t._updateTouch=function(e,t,i){e.getLocation(_I),e.setPrevPoint(_I),e.setPoint(t,i)},t._checkTouchMapSizeMoreThanMax=function(e){var t=this;if(this._touchMap.has(e))return!1;var i=Rt.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.sizeRt.TOUCH_TIMEOUT&&(console.log("The touches is more than MAX_TOUCHES, release touch id "+e.getID()+"."),t.releaseTouch(e.getID()))})),i>=this._touchMap.size},e}()),fI=function(){function e(){this._canvas=void 0,this._eventTarget=new kh,qh.hasFeature(Xh.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||m||console.warn("failed to access canvas"),this._registerEvent())}var t=e.prototype;return t._registerEvent=function(){var e,t,i,n;null===(e=this._canvas)||void 0===e||e.addEventListener("touchstart",this._createCallback(bw.TOUCH_START)),null===(t=this._canvas)||void 0===t||t.addEventListener("touchmove",this._createCallback(bw.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(bw.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(bw.TOUCH_CANCEL))},t._createCallback=function(e){var t=this;return function(i){for(var n,r=t._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o0){var _=new Lw(s,!1,e,Rt.ENABLE_MULTI_TOUCH?dI.getAllTouches():s);t._eventTarget.emit(e,_)}}},t._getCanvasRect=function(){var e=this._canvas,t=null==e?void 0:e.getBoundingClientRect();return t?new Pn(t.x,t.y,t.width,t.height):new Pn(0,0,0,0)},t._getLocation=function(e,t){if(globalThis.__globalXR.ar&&globalThis.__globalXR.ar.isWebXR())return new Rn(e.clientX,e.clientY);var i=e.clientX-t.x,n=t.y+t.height-e.clientY;if(gc.isFrameRotated){var r=i;i=t.height-n,n=r}var s=gc.devicePixelRatio;return new Rn(i*=s,n*=s)},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},e}();!function(e){e[e.GLOBAL=0]="GLOBAL",e[e.UI=1]="UI"}(rI||(rI=e("d$",{})));var pI=function(){function e(e){this.priority=rI.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=e}return e.prototype.dispatchEvent=function(e){return this._inputEventTarget.emit(e.type,e),!0},e}(),mI=((nI={})[bw.MOUSE_DOWN]=bw.TOUCH_START,nI[bw.MOUSE_MOVE]=bw.TOUCH_MOVE,nI[bw.MOUSE_UP]=bw.TOUCH_END,nI),gI=e("d_",function(){function e(){this._dispatchImmediately=!0,this._eventTarget=new kh,this._touchInput=new fI,this._mouseInput=new lI,this._keyboardInput=new cI,this._accelerometerInput=new Vw,this._handleInput=new aI,this._hmdInput=new oI,this._handheldInput=new uI,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new pI(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),iI._init()}var t=e.prototype;return t._dispatchMouseDownEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===t||t.call(i,e)},t._dispatchMouseMoveEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===t||t.call(i,e)},t._dispatchMouseUpEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===t||t.call(i,e)},t._dispatchMouseScrollEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchScrollEvent)||void 0===t||t.call(i,e)},t._dispatchKeyboardDownEvent=function(e){var t,i;null===(t=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===t||t.call(i,e)},t._dispatchKeyboardUpEvent=function(e){var t,i;null===(t=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===t||t.call(i,e)},t.on=function(e,t,i){return this._eventTarget.on(e,t,i),t},t.once=function(e,t,i){return this._eventTarget.once(e,t,i),t},t.off=function(e,t,i){this._eventTarget.off(e,t,i)},t.setAccelerometerEnabled=function(e){e?this._accelerometerInput.start():this._accelerometerInput.stop()},t.setAccelerometerInterval=function(e){this._accelerometerInput.setInterval(e)},t._simulateEventTouch=function(e){var t=mI[e.type],i=dI.getTouch(0,e.getLocationX(),e.getLocationY());if(i){var n=[i],r=new Lw(n,!1,t,t===bw.TOUCH_END?[]:n);r.windowId=e.windowId,t===bw.TOUCH_END&&dI.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},t._registerEventDispatcher=function(e){this._eventDispatcherList.push(e),this._eventDispatcherList.sort((function(e,t){return t.priority-e.priority}))},t._emitEvent=function(e){for(var t=this._eventDispatcherList.length,i=0;i8?Z(12004,8):(this._passes=e,this._flushPassInfo(),this._passes[0].batchingScheme===CE.VB_MERGING&&this.subMesh.genFlatBuffers(),this._descriptorSet&&(this._descriptorSet.destroy(),jI.layout=e[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(jI)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(e){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(e.iaInfo),this._passes[0].batchingScheme===CE.VB_MERGING&&this.subMesh.genFlatBuffers(),this._subMesh=e}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{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(e){this._instancedWorldMatrixIndex=e}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(e){this._instancedSHIndex=e}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(e){this._useReflectionProbeType=e}}]),e}()),KI=new En,YI=[{name:"CC_RECEIVE_SHADOW",value:!0}],qI=[{name:"CC_USE_LIGHTMAP",value:1}],QI=[{name:"CC_USE_LIGHTMAP",value:2}],ZI=[{name:"CC_USE_LIGHT_PROBE",value:!0}];!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.SKINNING=1]="SKINNING",e[e.BAKED_SKINNING=2]="BAKED_SKINNING",e[e.BATCH_2D=3]="BATCH_2D",e[e.PARTICLE_BATCH=4]="PARTICLE_BATCH",e[e.LINE=5]="LINE"}(WI||(WI=e("bJ",{})));var JI,$I=new Xl(qc.LINEAR,qc.LINEAR,qc.NONE,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP),eb=new Xl(qc.LINEAR,qc.LINEAR,qc.LINEAR,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP),tb=(e("bK",function(){function e(){this.type=WI.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(Ig.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new zi,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new Ki(1/0,1/0,1/0),this._useLightProbe=!1,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._shadowBias=0,this._shadowNormalBias=0,this._enabled=!0,this._visFlags=Yp.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0,this._device=gd.gfxDevice}var t=e.prototype;return t.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Yp.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0)},t.destroy=function(){for(var e=this._subModels,t=0;t=0?o.updateInstancedWorldMatrix(r,u):s=!0}(s||n)&&this._localBuffer&&(En.toArray(this._localData,r,Ig.MAT_WORLD_OFFSET),En.inverseTranspose(KI,r),En.toArray(this._localData,KI,Ig.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},t.showTetrahedron=function(){return this.isLightProbeAvailable()},t.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var e=v.director.root.pipeline.pipelineSceneData.lightProbes;return!(!e||e.empty()||!this._worldBounds)},t.updateSHBuffer=function(){if(this._localSHData){for(var e=this._subModels,t=!1,i=0;i=0?n.updateInstancedSH(this._localSHData,r):t=!0}t&&this._localSHBuffer&&this._localSHBuffer.update(this._localSHData)}},t.clearSHUBOs=function(){if(this._localSHData){for(var e=0;e1?eb:$I),r=this._subModels,s=0;s15e3&&(t=15e3);var i=t*t,n=(.860117757+.000154118254*t+1.28641212e-7*i)/(1+.000842420235*t+7.08145163e-7*i),r=(.317398726+422806245e-13*t+4.20481691e-8*i)/(1-289741816e-13*t+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,u=1/o*a,h=1/o*(1-a-o);e.x=3.2404542*u-1.5371385+-.4985314*h,e.y=-.969266*u+1.8760108+.041556*h,e.z=.0556434*u-.2040259+1.0572252*h}!function(e){e[e.DIRECTIONAL=0]="DIRECTIONAL",e[e.SPHERE=1]="SPHERE",e[e.SPOT=2]="SPOT",e[e.UNKNOWN=3]="UNKNOWN"}(JI||(JI=e("bZ",{})));var nb,rb=e("b_",(function(e){return 4*Math.PI*Math.PI*e*e})),sb=e("b$",function(){function e(){this._baked=!1,this._color=new Ki(1,1,1),this._colorTemp=6550,this._colorTempRGB=new Ki(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=JI.UNKNOWN,this._visibility=Sv}var t=e.prototype;return t.initialize=function(){this.color=new Ki(1,1,1),this.colorTemperature=6550},t.attachToScene=function(e){this._scene=e},t.detachFromScene=function(){this._scene=null},t.destroy=function(){this._name=null,this._node=null},t.update=function(){},n(e,[{key:"baked",get:function(){return this._baked},set:function(e){this._baked=e}},{key:"color",get:function(){return this._color},set:function(e){this._color.set(e)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(e){this._useColorTemperature=e}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(e){this._colorTemp=e,ib(this._colorTempRGB,this._colorTemp)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e}},{key:"node",get:function(){return this._node},set:function(e){this._node=e,this._node&&(this._node.hasChangedFlags|=Qp.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"scene",get:function(){return this._scene}}]),e}()),ab=new Ki(0,0,-1),ob=new Ki,ub=(e("c0",function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Ki(1,-1,-1),t._illuminanceHDR=Km.SUN_ILLUM,t._illuminanceLDR=1,t._shadowEnabled=!1,t._shadowPcf=aT.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._shadowSaturation=1,t._shadowDistance=50,t._shadowInvisibleOcclusionRange=200,t._csmLevel=oT.LEVEL_4,t._csmNeedUpdate=!1,t._csmLayerLambda=.75,t._csmOptimizationMode=uT.DisableRotationFix,t._csmLayersTransition=!1,t._csmTransitionRange=.05,t._shadowFixedArea=!1,t._shadowNear=.1,t._shadowFar=10,t._shadowOrthoSize=5,t._type=JI.DIRECTIONAL,t}s(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.illuminance=Km.SUN_ILLUM,this.direction=new Ki(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Ki.transformQuat(ob,ab,this._node.worldRotation))},i._activate=function(){var e=v.director.root,t=e.pipeline;this._shadowEnabled?(this._shadowFixedArea||!t.pipelineSceneData.csmSupported?t.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&t.pipelineSceneData.csmSupported?(t.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,t.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):t.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,t.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):t.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()},n(t,[{key:"direction",get:function(){return this._dir},set:function(e){Ki.normalize(this._dir,e)}},{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=e:this.illuminanceLDR=e}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(e){this._illuminanceHDR=e}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(e){this._illuminanceLDR=e}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled=e,this._activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(e){this._shadowPcf=e,this._activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(e){this._shadowBias=e}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(e){this._shadowNormalBias=e}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(e){this._shadowSaturation=e}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(e){this._shadowDistance=Math.min(e,cT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(e){this._shadowInvisibleOcclusionRange=Math.min(e,cT.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(e){this._csmLevel=e,this._activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(e){this._csmNeedUpdate=e}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(e){this._csmLayerLambda=e}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(e){this._csmOptimizationMode=e}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(e){this._shadowFixedArea=e,this._activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(e){this._shadowNear=e}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(e){this._shadowFar=Math.min(e,cT.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(e){this._shadowOrthoSize=e}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(e){this._csmLayersTransition=e,this._activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(e){this._csmTransitionRange=e}}]),t}(sb)),e("c1",function(e){function t(){var t;return(t=e.call(this)||this)._needUpdate=!1,t._size=.15,t._range=1,t._luminanceHDR=0,t._luminanceLDR=0,t._pos=void 0,t._aabb=void 0,t._aabb=_s.create(),t._pos=new Ki,t._type=JI.SPHERE,t}s(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/rb(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var e=this._range;_s.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,e,e,e),this._needUpdate=!1}},n(t,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(e){this._size=e}},{key:"range",get:function(){return this._range},set:function(e){this._range=e,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=e:this.luminanceLDR=e}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(e){this._luminanceHDR=e}},{key:"luminanceLDR",set:function(e){this._luminanceLDR=e}},{key:"aabb",get:function(){return this._aabb}}]),t}(sb)),new Ki(0,0,-1)),hb=new _n,cb=new En,lb=new En,_b=new En,db=new En,fb=(e("c2",function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Ki(1,-1,-1),t._range=5,t._spotAngle=Math.cos(Math.PI/6),t._pos=void 0,t._aabb=void 0,t._frustum=void 0,t._angle=0,t._needUpdate=!1,t._size=.15,t._luminanceHDR=0,t._luminanceLDR=0,t._shadowEnabled=!1,t._shadowPcf=aT.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._aabb=_s.create(),t._frustum=ys.create(),t._pos=new Ki,t._type=JI.SPOT,t}s(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/rb(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Ki(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Ki.transformQuat(this._dir,ub,this._node.getWorldRotation(hb)),Ki.normalize(this._dir,this._dir),_s.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(cb),En.invert(cb,cb),En.perspective(lb,this._angle,1,.001,this._range),En.multiply(_b,lb,cb),this._frustum.update(_b,db),this._needUpdate=!1)},n(t,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(e){this._size=e}},{key:"range",get:function(){return this._range},set:function(e){this._range=e,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=e:this.luminanceLDR=e}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(e){this._luminanceHDR=e}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(e){this._luminanceLDR=e}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(e){this._angle=e,this._spotAngle=Math.cos(.5*e),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(e){this._shadowEnabled=e}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(e){this._shadowPcf=e}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(e){this._shadowBias=e}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(e){this._shadowNormalBias=e}}]),t}(sb)),new s_);fb.format=Fc.RGBA8;var pb=new a_;pb.format=Fc.DEPTH_STENCIL;var mb,gb,vb=new h_([fb],pb),yb={width:1,height:1,renderPassInfo:vb},Eb=e("dx",Gs("cc.RenderTexture")(nb=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length=0&&this._models.splice(t,1)},t.clearModels=function(){this._models.length=0},n(e,[{key:"models",get:function(){return this._models}}]),e}()),e("c7",function(){function e(){this.scene=void 0,this.node=null,this._device=void 0,this.enabled=!0,this._localBoundaryCenter=new Ki(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=gd.gfxDevice}var t=e.prototype;return t.attachToScene=function(e){this.scene=e},t.detachFromScene=function(){this.scene=null},t.lockLODLevels=function(e){if(e.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var t=e.length,i=0;i=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},t.getScreenUsagePercentage=function(e){return this.node?(e.projectionType===TI.PERSPECTIVE&&(t=Ki.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(e.node.worldPosition))),this.distanceToScreenUsagePercentage(e,t,this.getWorldSpaceSize())):0;var t},t.distanceToScreenUsagePercentage=function(e,t,i){return e.projectionType===TI.PERSPECTIVE?i*e.matProj.m05/(2*t):i*e.matProj.m05*.5},t.getWorldSpaceSize=function(){var e=this.node.scale;return Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z))*this.objectSize},n(e,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(e){this._localBoundaryCenter.set(e)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(e){this._objectSize=e}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),e}()),function(e){e[e.PER_INSTANCE=0]="PER_INSTANCE",e[e.PER_BATCH=1]="PER_BATCH",e[e.PER_PHASE=2]="PER_PHASE",e[e.PER_PASS=3]="PER_PASS",e[e.COUNT=4]="COUNT"}(Tb||(Tb={})),function(e){e[e.CONSTANTS=0]="CONSTANTS",e[e.CBV=1]="CBV",e[e.UAV=2]="UAV",e[e.SRV=3]="SRV",e[e.TABLE=4]="TABLE",e[e.SSV=5]="SSV"}(Ab||(Ab={})),function(e){e[e.MANAGED=0]="MANAGED",e[e.MEMORYLESS=1]="MEMORYLESS",e[e.PERSISTENT=2]="PERSISTENT",e[e.EXTERNAL=3]="EXTERNAL",e[e.BACKBUFFER=4]="BACKBUFFER"}(Sb||(Sb={})),function(e){e[e.NONE=0]="NONE",e[e.RENDER_OPAQUE=1]="RENDER_OPAQUE",e[e.RENDER_CUTOUT=2]="RENDER_CUTOUT",e[e.RENDER_TRANSPARENT=3]="RENDER_TRANSPARENT"}(Rb||(Rb={})),function(e){e[e.BUFFER=0]="BUFFER",e[e.TEXTURE1D=1]="TEXTURE1D",e[e.TEXTURE2D=2]="TEXTURE2D",e[e.TEXTURE3D=3]="TEXTURE3D"}(wb||(wb={})),function(e){e[e.NONE=0]="NONE",e[e.UNIFORM=1]="UNIFORM",e[e.INDIRECT=2]="INDIRECT",e[e.STORAGE=4]="STORAGE",e[e.SAMPLED=8]="SAMPLED",e[e.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",e[e.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT"}(Ib||(Ib={})),function(e){e[e.SYNC=0]="SYNC",e[e.ASYNC=1]="ASYNC"}(bb||(bb={})),function(e){e[e.NONE=0]="NONE",e[e.OPAQUE_OBJECT=1]="OPAQUE_OBJECT",e[e.CUTOUT_OBJECT=2]="CUTOUT_OBJECT",e[e.TRANSPARENT_OBJECT=4]="TRANSPARENT_OBJECT",e[e.SHADOW_CASTER=8]="SHADOW_CASTER",e[e.UI=16]="UI",e[e.DEFAULT_LIGHTING=32]="DEFAULT_LIGHTING",e[e.VOLUMETRIC_LIGHTING=64]="VOLUMETRIC_LIGHTING",e[e.CLUSTERED_LIGHTING=128]="CLUSTERED_LIGHTING",e[e.PLANAR_SHADOW=256]="PLANAR_SHADOW",e[e.GEOMETRY=512]="GEOMETRY",e[e.PROFILER=1024]="PROFILER",e[e.DRAW_INSTANCING=2048]="DRAW_INSTANCING",e[e.DRAW_NON_INSTANCING=4096]="DRAW_NON_INSTANCING",e[e.REFLECTION_PROBE=8192]="REFLECTION_PROBE",e[e.ALL=4294967295]="ALL"}(Ob||(Ob={})),function(e){e[e.NONE=0]="NONE",e[e.DEFAULT=1]="DEFAULT",e[e.CLUSTERED=2]="CLUSTERED"}(Nb||(Nb={})),function(e){e[e.RENDER_TARGET=0]="RENDER_TARGET",e[e.DEPTH_STENCIL=1]="DEPTH_STENCIL"}(Cb||(Cb={})),function(e){e[e.READ=0]="READ",e[e.READ_WRITE=1]="READ_WRITE",e[e.WRITE=2]="WRITE"}(Mb||(Mb={}));var Lb,xb=function(e,t,i,n,r,s,a){void 0===e&&(e=""),void 0===t&&(t=Mb.WRITE),void 0===i&&(i=Cb.RENDER_TARGET),void 0===n&&(n=nl.LOAD),void 0===r&&(r=rl.STORE),void 0===s&&(s=vl.ALL),void 0===a&&(a=new Dl),this.slotName=void 0,this.accessType=void 0,this.attachmentType=void 0,this.loadOp=void 0,this.storeOp=void 0,this.clearFlags=void 0,this.clearColor=void 0,this.slotID=0,this.slotName=e,this.accessType=t,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=a};!function(e){e[e.FLOAT_TYPE=0]="FLOAT_TYPE",e[e.INT_TYPE=1]="INT_TYPE"}(Lb||(Lb={}));var Db,Fb,Bb=function(e,t,i,n,r){void 0===e&&(e=""),void 0===t&&(t=Mb.READ),void 0===i&&(i=vl.NONE),void 0===n&&(n=new Dl),void 0===r&&(r=Lb.FLOAT_TYPE),this.name=void 0,this.accessType=void 0,this.clearFlags=void 0,this.clearColor=void 0,this.clearValueType=void 0,this.name=e,this.accessType=t,this.clearFlags=i,this.clearColor=n,this.clearValueType=r},Ub=function(e,t){void 0===e&&(e=null),void 0===t&&(t=0),this.light=void 0,this.level=void 0,this.light=e,this.level=t};!function(e){e[e.UNIFORM_BUFFER=0]="UNIFORM_BUFFER",e[e.DYNAMIC_UNIFORM_BUFFER=1]="DYNAMIC_UNIFORM_BUFFER",e[e.SAMPLER_TEXTURE=2]="SAMPLER_TEXTURE",e[e.SAMPLER=3]="SAMPLER",e[e.TEXTURE=4]="TEXTURE",e[e.STORAGE_BUFFER=5]="STORAGE_BUFFER",e[e.DYNAMIC_STORAGE_BUFFER=6]="DYNAMIC_STORAGE_BUFFER",e[e.STORAGE_IMAGE=7]="STORAGE_IMAGE",e[e.INPUT_ATTACHMENT=8]="INPUT_ATTACHMENT"}(Db||(Db={})),se(wf.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),re(Eb.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this._window}}]);var Gb,kb=((Fb={})[Bc.UNORM]="Uint",Fb[Bc.SNORM]="Int",Fb[Bc.UINT]="Uint",Fb[Bc.INT]="Int",Fb[Bc.UFLOAT]="Float",Fb[Bc.FLOAT]="Float",Fb.default="Uint",Fb);function Hb(e){return""+(kb[e.type]||kb.default)+e.size/e.count*8}function zb(e,t,i,n,r,s,a){void 0===i&&(i=Fc.R32F),void 0===n&&(n=0),void 0===r&&(r=e.byteLength-n),void 0===s&&(s=0),a||(a=new DataView(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)));var o=b_[i];s||(s=o.size);for(var u="set"+Hb(o),h="get"+Hb(o),c=o.size/o.count,l=Math.floor(r/s),_=Ec.isLittleEndian,d=0;dr.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,s.x=i[u]r.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,r.z=i[u+2]>r.z?i[u+2]:r.z,s.x=i[u]=0;--t){var i=e[t];if(i.window.swapchain)return void($E=i)}$E=null}(e);for(var t=0;t0){var o=a;a=s,s=o}var u=0;switch(e){case xc.IDENTITY:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=a,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=s;break;case xc.ROTATE_90:u=0,i[u++]=-1,i[u++]=-1,i[u++]=r,i[u++]=a,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=s,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=1,i[u++]=n,i[u++]=s;break;case xc.ROTATE_180:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=s,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=a;break;case xc.ROTATE_270:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=-1,i[u++]=n,i[u++]=a,i[u++]=-1,i[u++]=1,i[u++]=r,i[u++]=s,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=a}return i},i._createQuadInputAssembler=function(){var e=new vC,t=4*Float32Array.BYTES_PER_ELEMENT,i=4*t,n=this._device.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE|zc.HOST,i,t));if(!n)return e;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Gl(Gc.INDEX|Gc.TRANSFER_DST,zc.DEVICE,s,r));if(!a)return e;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 u=new Array(2);u[0]=new i_("a_position",Fc.RG32F),u[1]=new i_("a_texCoord",Fc.RG32F);var h=this._device.createInputAssembler(new r_(u,[n],a));return e.quadIB=a,e.quadVB=n,e.quadIA=h,e},i.updateQuadVertexData=function(e,t){var i=this._lastUsedRenderArea;if(i.x!==e.x||i.y!==e.y||i.width!==e.width||i.height!==e.height){var n=this._genQuadVertexData(xc.IDENTITY,e);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(t.swapchain&&t.swapchain.surfaceTransform||xc.IDENTITY,e);this._quadVBOnscreen.update(r),i.copy(e)}},i.destroy=function(){for(var t,i,n=0;n>1,r>>1)),e.prefilterFramebuffer=t.createFramebuffer(new d_(e.renderPass,[e.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)e.downsampleTexs.push(t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,n>>1,r>>1))),e.downsampleFramebuffers[s]=t.createFramebuffer(new d_(e.renderPass,[e.downsampleTexs[s]])),e.upsampleTexs.push(t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,n,r))),e.upsampleFramebuffers[s]=t.createFramebuffer(new d_(e.renderPass,[e.upsampleTexs[s]])),n>>=1,r>>=1;e.combineTex=t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,this._width,this._height)),e.combineFramebuffer=t.createFramebuffer(new d_(e.renderPass,[e.combineTex])),e.sampler=this.globalDSManager.linearSampler}},i.on=function(e,t,i,n){return this._eventProcessor.on(e,t,i,n)},i.once=function(e,t,i){return this._eventProcessor.once(e,t,i)},i.off=function(e,t,i){this._eventProcessor.off(e,t,i)},i.emit=function(e,t,i,n,r,s){this._eventProcessor.emit(e,t,i,n,r,s)},i.targetOff=function(e){this._eventProcessor.targetOff(e)},i.removeAll=function(e){this._eventProcessor.removeAll(e)},i.hasEventListener=function(e,t,i){return this._eventProcessor.hasEventListener(e,t,i)},n(t,[{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(e){this._profiler=e}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(e){this._clusterEnabled=e}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled=e}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(e){this._pipelineSceneData.shadingScale!==e&&(this._pipelineSceneData.shadingScale=e,this.emit(CO.ATTACHMENT_SCALE_CAHNGED,e))}}]),t}(qd),FO=Cs(DO.prototype,"_tag",[Ys],(function(){return 0})),BO=Cs(DO.prototype,"_flows",[LO,Ys],(function(){return[]})),xO=DO))||xO));v.RenderPipeline=yC,ae(yC.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]),function(e){e[e.BLOOM=18]="BLOOM",e[e.POST_PROCESS=19]="POST_PROCESS",e[e.UI=20]="UI"}(UO||(UO={})),function(e){e[e.AR=5]="AR",e[e.FORWARD=10]="FORWARD"}(GO||(GO={})),function(e){e[e.SHADOW=0]="SHADOW",e[e.FORWARD=1]="FORWARD",e[e.UI=10]="UI"}(kO||(kO={})),function(e){e[e.GBUFFER=10]="GBUFFER",e[e.LIGHTING=15]="LIGHTING",e[e.TRANSPARENT=18]="TRANSPARENT"}(HO||(HO={})),function(e){e[e.SHADOW=0]="SHADOW",e[e.MAIN=1]="MAIN",e[e.UI=10]="UI"}(zO||(zO={})),yt(Vc),yt(Wc),yt(rl),yt(nl),yt(sl),yt(Fc),function(e){e[e.SCENE=0]="SCENE",e[e.POSTPROCESS=1]="POSTPROCESS",e[e.UI=2]="UI"}(dC||(dC={})),yt(dC),VO=Gs("RenderTextureDesc"),WO=va(Vc),jO=va(Wc),XO=va(Fc),VO((KO=function(){this.name=YO&&YO(),this.type=qO&&qO(),this.usage=QO&&QO(),this.format=ZO&&ZO(),this.width=JO&&JO(),this.height=$O&&$O()},YO=Cs(KO.prototype,"name",[Ys],(function(){return""})),qO=Cs(KO.prototype,"type",[WO],(function(){return Vc.TEX2D})),QO=Cs(KO.prototype,"usage",[jO],(function(){return Wc.COLOR_ATTACHMENT})),ZO=Cs(KO.prototype,"format",[XO],(function(){return Fc.UNKNOWN})),JO=Cs(KO.prototype,"width",[Ys],(function(){return-1})),$O=Cs(KO.prototype,"height",[Ys],(function(){return-1})),KO));var EC,TC=(eN=Gs("RenderTextureConfig"),tN=va(Eb),eN((nN=function(){this.name=rN&&rN(),this.texture=sN&&sN()},rN=Cs(nN.prototype,"name",[Ys],(function(){return""})),sN=Cs(nN.prototype,"texture",[tN],(function(){return null})),iN=nN))||iN),AC=(aN=Gs("MaterialConfig"),oN=va(nT),aN((uN=function(){this.name=hN&&hN(),this.material=cN&&cN()},hN=Cs(uN.prototype,"name",[Ys],(function(){return""})),cN=Cs(uN.prototype,"material",[oN],(function(){return null})),uN)),lN=Gs("FrameBufferDesc"),_N=va([qt]),dN=va(Eb),lN((fN=function(){this.name=pN&&pN(),this.renderPass=mN&&mN(),this.colorTextures=gN&&gN(),this.depthStencilTexture=vN&&vN(),this.texture=yN&&yN()},pN=Cs(fN.prototype,"name",[Ys],(function(){return""})),mN=Cs(fN.prototype,"renderPass",[Ys],(function(){return 0})),gN=Cs(fN.prototype,"colorTextures",[_N],(function(){return[]})),vN=Cs(fN.prototype,"depthStencilTexture",[Ys],(function(){return""})),yN=Cs(fN.prototype,"texture",[dN],(function(){return null})),fN)),EN=Gs("ColorDesc"),TN=va(Fc),AN=va(nl),SN=va(rl),RN=va(sl),wN=va(sl),EN((bN=function(){this.format=ON&&ON(),this.loadOp=NN&&NN(),this.storeOp=CN&&CN(),this.sampleCount=MN&&MN(),this.beginAccesses=PN&&PN(),this.endAccesses=LN&&LN()},ON=Cs(bN.prototype,"format",[TN],(function(){return Fc.UNKNOWN})),NN=Cs(bN.prototype,"loadOp",[AN],(function(){return nl.CLEAR})),CN=Cs(bN.prototype,"storeOp",[SN],(function(){return rl.STORE})),MN=Cs(bN.prototype,"sampleCount",[Ys],(function(){return 1})),PN=Cs(bN.prototype,"beginAccesses",[RN],(function(){return sl.NONE})),LN=Cs(bN.prototype,"endAccesses",[wN],(function(){return sl.COLOR_ATTACHMENT_WRITE})),IN=bN))||IN),SC=(xN=Gs("DepthStencilDesc"),DN=va(Fc),FN=va(nl),BN=va(rl),UN=va(nl),GN=va(rl),kN=va(sl),HN=va(sl),xN((VN=function(){this.format=WN&&WN(),this.depthLoadOp=jN&&jN(),this.depthStoreOp=XN&&XN(),this.stencilLoadOp=KN&&KN(),this.stencilStoreOp=YN&&YN(),this.sampleCount=qN&&qN(),this.beginAccesses=QN&&QN(),this.endAccesses=ZN&&ZN()},WN=Cs(VN.prototype,"format",[DN],(function(){return Fc.UNKNOWN})),jN=Cs(VN.prototype,"depthLoadOp",[FN],(function(){return nl.CLEAR})),XN=Cs(VN.prototype,"depthStoreOp",[BN],(function(){return rl.STORE})),KN=Cs(VN.prototype,"stencilLoadOp",[UN],(function(){return nl.CLEAR})),YN=Cs(VN.prototype,"stencilStoreOp",[GN],(function(){return rl.STORE})),qN=Cs(VN.prototype,"sampleCount",[Ys],(function(){return 1})),QN=Cs(VN.prototype,"beginAccesses",[kN],(function(){return sl.NONE})),ZN=Cs(VN.prototype,"endAccesses",[HN],(function(){return sl.DEPTH_STENCIL_ATTACHMENT_WRITE})),zN=VN))||zN);JN=Gs("RenderPassDesc"),$N=va([AC]),eC=va(SC),JN((tC=function(){this.index=iC&&iC(),this.colorAttachments=nC&&nC(),this.depthStencilAttachment=rC&&rC()},iC=Cs(tC.prototype,"index",[Ys],(function(){return-1})),nC=Cs(tC.prototype,"colorAttachments",[$N],(function(){return[]})),rC=Cs(tC.prototype,"depthStencilAttachment",[eC],(function(){return new SC})),tC)),function(e){e[e.FRONT_TO_BACK=0]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(EC||(EC={})),yt(EC);var RC=(sC=Gs("RenderQueueDesc"),aC=va(EC),oC=va([qt]),sC((hC=function(){this.isTransparent=cC&&cC(),this.sortMode=lC&&lC(),this.stages=_C&&_C()},cC=Cs(hC.prototype,"isTransparent",[Ys],(function(){return!1})),lC=Cs(hC.prototype,"sortMode",[aC],(function(){return EC.FRONT_TO_BACK})),_C=Cs(hC.prototype,"stages",[oC],(function(){return[]})),uC=hC))||uC);function wC(e,t){return e.hash-t.hash||e.depth-t.depth||e.shaderId-t.shaderId}function IC(e,t){return e.priority-t.priority||e.hash-t.hash||t.depth-e.depth||e.shaderId-t.shaderId}var bC=function(){function e(e){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=e,this._passPool=new Ah((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new Sh(64,this._passDesc.sortFunc)}var t=e.prototype;return t.clear=function(){this.queue.clear(),this._passPool.reset()},t.insertRenderPass=function(e,t,i){var n=e.model.subModels[t],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=e.model.priority,o.hash=a,o.depth=e.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},t.sort=function(){this.queue.sort()},t.recordCommandBuffer=function(e,t,i){for(var n=0;nthis._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Di(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new kl(this._lightBuffer,0,Mg.SIZE)));for(var o=0,u=0;o-1&&this.additiveInstanceQueues.splice(t,1)},i.initialize=function(t){return e.prototype.initialize.call(this,t),t.renderQueues&&(this.renderQueues=t.renderQueues),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i);for(var n=0;n=0;u--){var h=r.array[u];if(h){var c=h.model;c&&c.enabled&&c.node&&((o&c.node.layer)===c.node.layer||o&c.visFlags)&&c.worldBounds&&c.castShadow?$r.aabbFrustum(c.worldBounds,s)&&(a.push(h),i.level0?.5*(1-Math.floor(a/2))*u.y:.5*Math.floor(a/2)*u.y,this._renderArea.width=.5*u.x,this._renderArea.height=.5*u.y}break;case JI.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y}var l=this._shadowFrameBuffer.renderPass;s.beginRenderPass(l,this._shadowFrameBuffer,this._renderArea,gM,e.clearDepth,e.clearStencil),s.bindDescriptorSet(sg.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,l,s),s.endRenderPass(),this._isShadowMapCleared=!1}},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._additiveShadowQueue=new mM(t),this._isShadowMapCleared=!1},t}(NO),lM.initInfo={name:"ShadowStage",priority:GO.FORWARD,tag:0},cM=_M))||cM),yM=[],EM=e("g_",Gs("ShadowFlow")((pM=fM=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r=(cg.COUNT+lg.COUNT+_g.COUNT+dg.COUNT)/4,t.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=t.pipelineSceneData.csmSupported,t.macros.CC_SHADOW_TYPE=0,t.macros.CC_DIR_SHADOW_PCF_TYPE=aT.HARD,t.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.macros.CC_CASCADED_LAYERS_TRANSITION=0,t.onGlobalPipelineStateChanged()},i.render=function(e){var t=this._pipeline,i=t.pipelineSceneData.shadows,n=t.pipelineSceneData.csmLayers,r=t.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===sT.ShadowMap){for(var o=0,u=0;o1&&e.csmOptimizationMode===uT.RemoveDuplicates)if(this._level>=u-1)BM=this._castLightViewBoundingBox.halfExtents.z,FM=this._castLightViewBoundingBox.center.z;else{var h=Math.abs(this._castLightViewBoundingBox.center.z-FM)+BM;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,h)}var c=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*c+r;var l=this._castLightViewBoundingBox.center;if(DM.set(l.x,l.y,l.z+c+r),Ki.transformMat4(DM,DM,AM),En.fromRT(AM,e.node.rotation,DM),En.invert(SM,AM),!i){var _=.5*s,d=.5*a;En.ortho(RM,-_,_,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),En.multiply(IM,RM,o),Ki.transformMat4(NM,DM,IM);var f=2/t;CM.set(f,f);var p=NM.x%CM.x,m=NM.y%CM.y;MM.set(NM.x-p,NM.y-m,NM.z),En.invert(bM,IM),Ki.transformMat4(PM,MM,bM),En.fromRT(AM,e.node.rotation,PM),En.invert(SM,AM),En.multiply(wM,RM,SM),En.copy(this._matShadowView,SM),En.copy(this._matShadowProj,RM),En.copy(this._matShadowViewProj,wM)}ys.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,AM)},n(e,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(e){this._shadowCameraFar=e}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(e){this._matShadowView=e}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(e){this._matShadowProj=e}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(e){this._matShadowViewProj=e}},{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}}]),e}(),GM=function(e){function t(t){var i;return(i=e.call(this,t)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new zi,i._calculateAtlas(t),i}s(t,e);var i=t.prototype;return i.destroy=function(){e.prototype.destroy.call(this)},i._calculateAtlas=function(e){var t=v.director.root.device.capabilities.clipSpaceSignY,i=e%2-.5,n=(.5-Math.floor(e/2))*t;this._csmAtlas.set(.5,.5,i,n)},n(t,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(e){this._splitCameraNear=e}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(e){this._splitCameraFar=e}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(e){this._csmAtlas=e}}]),t}(UM),kM=function(){function e(){this._castShadowObjects=[],this._layerObjects=new Sh(64),this._layers=[],this._levelCount=0,this._specialLayer=new UM(1),this._shadowDistance=0;for(var e=0;e1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(TM,e);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,u=a.splitCameraFar;a.calculateSplitFrustum(e,TM,o,u),a.createMatrix(t,r,!1)}n===oT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,En.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),En.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),En.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(e,TM,.1,t.shadowDistance),this._specialLayer.createMatrix(t,r,!0))}},t._getCameraWorldMatrix=function(e,t){if(t.node){var i=t.node,n=i.getWorldPosition(),r=i.getWorldRotation();En.fromRT(e,r,n),e.m08*=-1,e.m09*=-1,e.m10*=-1}},n(e,[{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}}]),e}(),HM=e("gQ",function(){function e(){this.fog=new SS,this.ambient=new Km,this.skybox=new mT,this.shadows=new cT,this.csmLayers=new kM,this.octree=new tb,this.lightProbes=v.internal.LightProbes?new v.internal.LightProbes:null,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 t=e.prototype;return t.activate=function(e){return this._device=e,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},t.initGeometryRendererMaterials=function(){for(var e=0,t=0;t<6;t++){this._geometryRendererMaterials[t]=new nT,this._geometryRendererMaterials[t]._uuid="geometry-renderer-material-"+t,this._geometryRendererMaterials[t].initialize({effectName:"builtin-geometry-renderer",technique:t});for(var i=0;i0&&(this._occlusionQueryShader=e.passes[0].getShaderVariant())}},t.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},t.updatePipelineSceneData=function(){},t.destroy=function(){var e,t,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null===(e=this._occlusionQueryInputAssembler)||void 0===e||e.destroy(),this._occlusionQueryInputAssembler=null,null===(t=this._occlusionQueryVertexBuffer)||void 0===t||t.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||i.destroy(),this._occlusionQueryIndicesBuffer=null},t._createOcclusionQueryIA=function(){var e=this._device,t=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=e.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(t);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=e.createBuffer(new Gl(Gc.INDEX|Gc.TRANSFER_DST,zc.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new i_("a_position",Fc.RGB32F)],u=new r_(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return e.createInputAssembler(u)},n(e,[{key:"isHDR",get:function(){return this._isHDR},set:function(e){this._isHDR=e}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(e){this._shadingScale=e}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(e){this._csmSupported=e}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),e}()),zM=Yp.makeMaskExclude([Yp.BitMask.UI_2D,Yp.BitMask.UI_3D,Yp.BitMask.GIZMOS,Yp.BitMask.EDITOR,Yp.BitMask.SCENE_GIZMO,Yp.BitMask.PROFILER]),VM="CC_USE_RGBE_OUTPUT",WM=LE("default"),jM=LE("reflect-map");function XM(e){var t=e.passes,i=v.rendering;bv()&&(WM=i.getPhaseID(i.getPassID("default"),"default"));for(var n=0;n1e-4&&(i=Math.log(t)/Math.log(1.1),i=Ri((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=function(e,t,i){if(t>i){var n=t;t=i,i=n}return ei?i:e}(e.multiplyScalar(n),new Ki(0,0,0),new Ki(1,1,1));r.multiplyScalar(255);var s,a,o=un(r).add((s=r.subtract(un(r)))<(a=new Ki(.5,.5,.5))?a:s);return new zi(o.x/255,o.y/255,o.z/255,i/255)}(this._rgbeColor);PP[0].x=r.x,PP[0].y=r.y,PP[0].z=r.z,PP[0].w=r.w}var s=t.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,PP,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(sg.GLOBAL,t.descriptorSet),this._probeRenderQueue.recordCommandBuffer(s,n,i),i.endRenderPass(),t.pipelineUBO.updateCameraUBO(e)},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._probeRenderQueue=new MP(t)},t}(NO),qM.initInfo={name:"ReflectionProbeStage",priority:GO.FORWARD,tag:0},YM=QM))||YM),xP=e("h5",Gs("ReflectionProbeFlow")(($M=JM=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._stages.length){var i=new LP;i.initialize(LP.initInfo),this._stages.push(i)}return!0},i.activate=function(t){e.prototype.activate.call(this,t)},i.render=function(e){if(v.internal.reflectionProbeManager)for(var t=v.internal.reflectionProbeManager.getProbes(),i=0;i0){this._renderQueues.forEach(CC);for(var A=0;A0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new m_(h.localSetLayout)),this._localUBO=i.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE,Ig.SIZE,Ig.SIZE)),this._stageDesc.bindBuffer(Ig.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(sg.MATERIAL,h.descriptorSet),r.bindDescriptorSet(sg.LOCAL,this._stageDesc),r.bindInputAssembler(l),r.draw(l)),this._uiPhase.render(e,u),tT(i,u,r,t.profiler,e),r.endRenderPass()},t}(NO),OP.initInfo={name:"PostProcessStage",priority:UO.POST_PROCESS,tag:0},IP=Cs((wP=NP).prototype,"_postProcessMaterial",[AP,Ys],(function(){return null})),bP=Cs(wP.prototype,"renderQueues",[SP,Ys],(function(){return[]})),RP=wP))||RP));!function(e){e[e.NONE=0]="NONE",e[e.FXAA=1]="FXAA"}(CP||(CP={}));var zP,VP,WP,jP,XP,KP,YP,qP=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r>=1,this._renderArea.height>>=1;var i=t.commandBuffers[0],n=t.pipelineSceneData.bloomMaterial.passes[0],r=t.getPipelineRenderData(),s=r.bloom,a=new Float32Array(ZP.COUNT);a[ZP.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,QP,0,0),i.bindDescriptorSet(sg.GLOBAL,t.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(sg.MATERIAL,n.descriptorSet);var o=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,u=null,h=n.getShaderVariant();null!=n&&null!=h&&null!=o&&(u=kE.getOrCreatePipelineState(t.device,n,h,s.renderPass,o)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(e,t){t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=t.commandBuffers[0],n=t.pipelineSceneData.bloomMaterial,r=t.getPipelineRenderData().bloom,s=new Float32Array(ZP.COUNT),a=0;a>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,QP,0,0);var o=n.passes[1+a],u=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(sg.MATERIAL,o.descriptorSet);var h=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,c=null;null!=o&&null!=u&&null!=h&&(c=kE.getOrCreatePipelineState(t.device,o,u,r.renderPass,h)),null!=c&&(i.bindPipelineState(c),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()}},i._upsamplePass=function(e,t){var i=t.getPipelineRenderData().bloom;t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=t.commandBuffers[0],r=t.pipelineSceneData.bloomMaterial,s=new Float32Array(ZP.COUNT),a=0;a=0&&(this._lodGroups.splice(t,1),e.detachFromScene(),this._lodStateCache.removeLodGroup(e))},t.removeLODGroups=function(){for(var e,t=d(this._lodGroups);!(e=t()).done;){var i=e.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},t.onGlobalPipelineStateChanged=function(){for(var e,t=d(this._models);!(e=t()).done;)e.value.onGlobalPipelineStateChanged()},t.generateModelId=function(){return this._modelId++},n(e,[{key:"root",get:function(){return this._root}},{key:"name",get:function(){return this._name}},{key:"cameras",get:function(){return this._cameras}},{key:"mainLight",get:function(){return this._mainLight}},{key:"sphereLights",get:function(){return this._sphereLights}},{key:"spotLights",get:function(){return this._spotLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),e}()),dL=function(){this.ownerLodLevel=-1,this.lodGroup=null,this.visibleCameras=new Map},fL=function(){this.usedLevel=-1,this.transformDirty=!0},pL=function(){function e(e){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._renderScene=e}var t=e.prototype;return t.addCamera=function(e){for(var t,i=d(this._renderScene.lodGroups);!(t=i()).done;){var n=t.value.node.layer;if((e.visibility&n)===n){this._lodStateInCamera.has(e)||this._lodStateInCamera.set(e,new Map);break}}},t.removeCamera=function(e){this._lodStateInCamera.has(e)&&this._lodStateInCamera.delete(e)},t.addLodGroup=function(e){this._newAddedLodGroupVec.push(e);for(var t,i=d(this._renderScene.cameras);!(t=i()).done;){var n=t.value;if(!this._lodStateInCamera.has(n)){var r=e.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},t.removeLodGroup=function(e){for(var t=0;t0){if(e.node.hasChangedFlags>0)for(var n,r=d(t._lodStateInCamera);!(n=r()).done;){var s=n.value,a=s[1].get(e);a||(a=new fL,s[1].set(e,a)),a.transformDirty=!0}if(e.isLockLevelChanged()){e.resetLockChangeFlag();for(var o=0;o0||I>0||R.transformDirty){R.transformDirty&&(R.transformDirty=!1);var b=e.getVisibleLODLevel(S[0]);b!==R.usedLevel&&(R.usedLevel=b,T=!0)}}if(e.isLockLevelChanged()&&(e.resetLockChangeFlag(),T=!0),T)for(var O=0;O1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0);for(var n=0;n0){this._device.acquire([gd.swapchain]);var o=this._scenes,u=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var h=0;h0?(this._fixedFPS=e,this._fixedFPSFrameTime=1e3/e):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),e}());v.Root=vL,di.Attr.setClassAttr(Yf,"target","type","Object"),di.Attr.setClassAttr(Yf,"target","ctor",Wm);var yL,EL=new Array(16),TL=null,AL=new Rn,SL=[Jp.TOUCH_START,Jp.TOUCH_MOVE,Jp.TOUCH_END,Jp.TOUCH_CANCEL],RL=[Jp.MOUSE_DOWN,Jp.MOUSE_ENTER,Jp.MOUSE_MOVE,Jp.MOUSE_LEAVE,Jp.MOUSE_UP,Jp.MOUSE_WHEEL];!function(e){e[e.ADD_POINTER_EVENT_PROCESSOR=0]="ADD_POINTER_EVENT_PROCESSOR",e[e.REMOVE_POINTER_EVENT_PROCESSOR=1]="REMOVE_POINTER_EVENT_PROCESSOR",e[e.MARK_LIST_DIRTY=2]="MARK_LIST_DIRTY"}(yL||(yL=e("e1",{})));var wL,IL=e("dz",function(){function e(e){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._node=void 0,this._node=e}var t=e.prototype;return t.setEnabled=function(t,i){if(void 0===i&&(i=!1),this._isEnabled!==t){this._isEnabled=t;var n=this.node.children;if(t&&this._attachMask(),e.callbacksInvoker.emit(yL.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r=0;--n)if((t=EL[n]).eventProcessor.capturingTarget&&(e.currentTarget=t,t.eventProcessor.capturingTarget.emit(e.type,e,EL),e.propagationStopped))return void(EL.length=0);if(EL.length=0,e.eventPhase=2,e.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(e.type,e),!e.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(e.type,e),!e.propagationStopped&&e.bubbles)for(this.getBubblingTargets(e.type,EL),e.eventPhase=3,n=0;n0?n:null}return null},t._attachMask=function(){this.maskList=this._searchComponentsInParent(e._maskComp)},t._isTouchEvent=function(e){return-1!==SL.indexOf(e)},t._isMouseEvent=function(e){return-1!==RL.indexOf(e)},t._hasTouchListeners=function(){for(var e=0;e>>1;r<=s;a=r+s>>>1){var o=e[a],u=o.constructor._executionOrder;if(u>i)s=a-1;else if(un)s=a-1;else{if(!(h0&&(e.array.sort(BL),this._invoke(e),e.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var t=this._pos;t.array.length>0&&(t.array.sort(BL),this._invoke(t),t.array.length=0)},t}(FL),GL=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.add=function(e){var t=e.constructor._executionOrder;if(0===t)this._zero.array.push(e);else{var i=t<0?this._neg.array:this._pos.array,n=xL(i,e);n<0&&i.splice(~n,0,e)}},i.remove=function(e){var t=e.constructor._executionOrder;if(0===t)this._zero.fastRemove(e);else{var i=t<0?this._neg:this._pos,n=xL(i.array,e);n>=0&&i.removeAt(n)}},i.invoke=function(e){this._neg.array.length>0&&this._invoke(this._neg,e),this._invoke(this._zero,e),this._pos.array.length>0&&this._invoke(this._pos,e)},t}(FL);function kL(e,t,i){var n="var a=it.array;for(it.i=0;it.i=0?ML(this._deferredComps,t):(!e.start||e._objFlags&PL||this.startInvoker.remove(e),e.update&&this.updateInvoker.remove(e),e.lateUpdate&&this.lateUpdateInvoker.remove(e))},t.enableComp=function(e,t){if(!(e._objFlags&LL)){if(e.onEnable){if(t)return void t.add(e);if(e.onEnable(),!e.node._activeInHierarchy)return}this._onEnabled(e)}},t.disableComp=function(e){e._objFlags&LL&&(e.onDisable&&e.onDisable(),this._onDisabled(e))},t.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},t.updatePhase=function(e){this.updateInvoker.invoke(e)},t.lateUpdatePhase=function(e){this.lateUpdateInvoker.invoke(e),this._updating=!1,this._startForNewComps()},t._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},t._scheduleImmediate=function(e){"function"!=typeof e.start||e._objFlags&PL||this.startInvoker.add(e),"function"==typeof e.update&&this.updateInvoker.add(e),"function"==typeof e.lateUpdate&&this.lateUpdateInvoker.add(e)},t._deferredSchedule=function(){for(var e=this._deferredComps,t=0,i=e.length;t1)e.push("t="+this._targetExp+";"),t="t";else{if(1!==this._exps.length)return;t=this._targetExp}for(var i=0;i0&&(i=ax+this.globalVariables.join(",")+";");var n=Cc(["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;r=t.OptimizationPolicyThreshold)?(e=this._doInstantiate(),this.data._instantiate(e)):e=this.data._instantiate(),++this._instantiatedTimes,e},i.initDefault=function(t){e.prototype.initDefault.call(this,t),this.data=new Wm,this.data.name="(Missing Node)";var i=new v._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var e=this.data;fw(e),_w(e)},t}(qd),Ex.OptimizationPolicy=Rx,Ex.OptimizationPolicyThreshold=3,gx=Cs((mx=Tx).prototype,"data",[Ys],(function(){return null})),vx=Cs(mx.prototype,"optimizationPolicy",[Ys],(function(){return Rx.AUTO})),yx=Cs(mx.prototype,"persistent",[Ys],(function(){return!1})),px=mx))||px);we(wx,"_utils",Sw),v.Prefab=wx,Me(v,"cc._Prefab","Prefab");var Ix=function(){function e(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var t=e.prototype;return t.addRenderer=function(e){-1===e._internalId&&(e._internalId=this._allRenderers.length,this._allRenderers.push(e))},t.removeRenderer=function(e){if(-1!==e._internalId){var t=e._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=t,ut(this._allRenderers,t),e._internalId=-1,e._dirtyVersion===this._dirtyVersion&&(ct(this._dirtyRenderers,e),e._dirtyVersion=-1)}},t.markDirtyRenderer=function(e){e._dirtyVersion!==this._dirtyVersion&&-1!==e._internalId&&(this._dirtyRenderers.push(e),e._dirtyVersion=this._dirtyVersion)},t.updateAllDirtyRenderers=function(){for(var e=this._dirtyRenderers.length,t=this._dirtyRenderers,i=0;i1){var h=Object.create(null);t.forEach((function(e){h[e._uuid]=e})),r={isCompleted:Cx,_map:h}}else r=t[0]}i&&i(e,r)}))},t.getXMLHttpRequest=function(){return new XMLHttpRequest},t.getItem=function(e){return bE.assets.has(e)?{content:bE.assets.get(e)}:null},t.loadRes=function(e,t,i,n){var r=this._parseLoadResArgs(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u=ec(e);u&&!Ny.getInfoWithPath(e,s)&&(e=e.slice(0,-u.length)),Ny.load(e,s,a,o)},t.loadResArray=function(e,t,i,n){var r=this._parseLoadResArgs(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;e.forEach((function(t,i){var n=ec(t);n&&!Ny.getInfoWithPath(t,s)&&(e[i]=t.slice(0,-n.length))})),Ny.load(e,s,a,o)},t.loadResDir=function(e,t,i,n){var r=this._parseLoadResArgs(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;Ny.loadDir(e,s,a,(function(t,i){var n=[];t||(n=Ny.getDirWithPath(e,s).map((function(e){return e.path}))),o&&o(t,i,n)}))},t.getRes=function(e,t){return Td.has(e)?Td.get(e):Ny.get(e,t)},t.getResCount=function(){return Td.count},t.getDependsRecursively=function(e){if(!e)return[];var t="string"==typeof e?e:e._uuid;return Fp.getDepsRecursively(t).concat([t])},t.addDownloadHandlers=function(e){var t=Object.create(null),i=function(i){var n=e[i];t["."+i]=function(e,t,i){n({url:e},i)}};for(var n in e)i(n);Jy.register(t)},t.addLoadHandlers=function(e){var t=Object.create(null),i=function(i){var n=e[i];t["."+i]=function(e,t,i){n({content:e},i)}};for(var n in e)i(n);gE.register(t)},t.release=function(e){if(Array.isArray(e))for(var t=0;tt){var r=n;n=i,i=r}this.scaleSize=e/t>16/9?t/n:e/i},e.update=function(e){var t=this.settings,i=this.device,n=this.swapchain;En.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height;this.initScale(),this._curTime+=1e3*e;var a=$a(wi(this._curTime/t.totalTime)),o=1,u=1;r=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(e){this._curTime=e}}],[{key:"instance",get:function(){return t._ins||(t._ins=new t),t._ins}}]),t}();Hx._ins=void 0,v.internal.SplashScreen=Hx;var zx=new(function(){function e(){this._data=null}return e.prototype.init=function(e){var t=this;return void 0===e&&(e=""),v.rendering&&v.rendering.enableEffectImport&&e?new Promise((function(i,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onload=function(){t._data=r.response,i()},r.onerror=function(){n(new Error("request effect settings failed!"))},r.send(null)})):Promise.resolve()},n(e,[{key:"data",get:function(){return this._data}}]),e}());v.effectSettings=zx;var Vx=e("e9",function(e){function i(){for(var t,i=arguments.length,n=new Array(i),r=0;rthis._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var e=this;if(this._inited)if(Hx.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var t,i=St.querySettings(At.Category.LAUNCH,"launchScene");i?Ux.loadScene(i,(function(){var t;console.log("Success to load scene: "+i),e._initTime=performance.now(),Ux.startAnimation(),null===(t=e.onStart)||void 0===t||t.call(e)})):(this._initTime=performance.now(),Ux.startAnimation(),null===(t=this.onStart)||void 0===t||t.call(this))}else Ux.tick(this._calculateDT());else Hx.instance.update(this._calculateDT())},r.initPacer=function(){var e,t=null!==(e=St.querySettings(At.Category.SCREEN,"frameRate"))&&void 0!==e?e:60;H("number"==typeof t),this._pacer=new Gx,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=t},r._initEvents=function(){qh.on("show",this._onShow,this),qh.on("hide",this._onHide,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r.addPersistRootNode=function(e){Ux.addPersistRootNode(e)},r.removePersistRootNode=function(e){Ux.removePersistRootNode(e)},r.isPersistRootNode=function(e){return Ux.isPersistRootNode(e)},r._setupRenderPipeline=function(){var e=this,t=St.querySettings(At.Category.RENDERING,"renderPipeline");return t?new Promise((function(e,i){bE.loadAny(t,(function(t,n){return!t&&n instanceof yC?e(n):i(t)}))})).then((function(t){e._setRenderPipeline(t)})).catch((function(i){G(i),G("Failed load render pipeline: "+t+", engine failed to initialize, will fallback to default pipeline"),e._setRenderPipeline()})):this._setRenderPipeline()},r._setRenderPipeline=function(e){Ux.root.setRenderPipeline(e)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},r._safeEmit=function(e){this.emit(e)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(e){"number"!=typeof e&&(e=parseInt(e,10),Number.isNaN(e)&&(e=60)),this._frameRate=e,this.frameTime=1e3/e,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}(kh));Vx.EVENT_HIDE="game_on_hide",Vx.EVENT_SHOW="game_on_show",Vx.EVENT_LOW_MEMORY="game_on_low_memory",Vx.EVENT_GAME_INITED="game_inited",Vx.EVENT_ENGINE_INITED="engine_inited",Vx.EVENT_RENDERER_INITED="renderer_inited",Vx.EVENT_PRE_BASE_INIT="pre_base_init",Vx.EVENT_POST_BASE_INIT="post_base_init",Vx.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",Vx.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",Vx.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",Vx.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",Vx.EVENT_PRE_PROJECT_INIT="pre_project_init",Vx.EVENT_POST_PROJECT_INIT="post_project_init",Vx.EVENT_RESTART="game_on_restart",Vx.EVENT_PAUSE="game_on_pause",Vx.EVENT_RESUME="game_on_resume",Vx.RENDER_TYPE_CANVAS=0,Vx.RENDER_TYPE_WEBGL=1,Vx.RENDER_TYPE_OPENGL=2,Vx.RENDER_TYPE_HEADLESS=3,Vx.DEBUG_DT_THRESHOLD=1,v.Game=Vx;var Wx=e("e8",v.game=new Vx);ae(Bx.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"}]),se(Bx.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"}]),re(Ux,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(e){var t;return bE.main?null===(t=bE.main.getSceneInfo(e))||void 0===t?void 0:t.uuid:""}}]),ae(Wx,"game",[{name:"collisionMatrix"},{name:"groupList"}]),re(Wx,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var e=[];return bE.main&&bE.main.config.scenes.forEach((function(t){e.push(t)})),e}}]);var jx,Xx,Kx={syncPhysicsToGraphics:function(e){var t=globalThis.Bullet;t.CACHE.getWrapper(e,t.BODY_CACHE_NAME).syncPhysicsToGraphics()}};globalThis.BULLET&&console.log("[Physics][Bullet]: Using the external Bullet libs."),function(e){e[e.EBulletTypeVec3=0]="EBulletTypeVec3",e[e.EBulletTypeQuat=1]="EBulletTypeQuat",e[e.EBulletTypeTransform=2]="EBulletTypeTransform",e[e.EBulletTypeMotionState=3]="EBulletTypeMotionState",e[e.EBulletTypeCollisionObject=4]="EBulletTypeCollisionObject",e[e.EBulletTypeCollisionShape=5]="EBulletTypeCollisionShape",e[e.EBulletTypeStridingMeshInterface=6]="EBulletTypeStridingMeshInterface",e[e.EBulletTypeTriangleMesh=7]="EBulletTypeTriangleMesh",e[e.EBulletTypeCollisionDispatcher=8]="EBulletTypeCollisionDispatcher",e[e.EBulletTypeDbvtBroadPhase=9]="EBulletTypeDbvtBroadPhase",e[e.EBulletTypeSequentialImpulseConstraintSolver=10]="EBulletTypeSequentialImpulseConstraintSolver",e[e.EBulletTypeCollisionWorld=11]="EBulletTypeCollisionWorld",e[e.EBulletTypeTypedConstraint=12]="EBulletTypeTypedConstraint"}(jx||(jx=e("ft",{}))),function(e){e[e.NONE=0]="NONE",e[e.FilterBackfaces=1]="FilterBackfaces",e[e.KeepUnflippedNormal=2]="KeepUnflippedNormal",e[e.UseSubSimplexConvexCastRaytest=4]="UseSubSimplexConvexCastRaytest",e[e.UseGjkConvexCastRaytest=8]="UseGjkConvexCastRaytest"}(Xx||(Xx=e("fu",{})));var Yx=e("fo",{});function qx(){var e=function(){if((Ec.os===Ec.OS.IOS||Ec.os===Ec.OS.OSX)&&Ec.isBrowser&&/(OS 15_4)|(Version\/15.4)/.test(window.navigator.userAgent))return!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0]));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return!1}return!1}();return Promise.resolve().then((function(){return async function(e){let i;return i=e?await t.import("./bullet.wasm-7211041d.js"):await t.import("./bullet.cocos-430d79e0.js"),i.default}(e)})).then((function(e){if("string"==typeof e){console.info("[Physics][Bullet]: Using wasm Bullet libs.");var t=function(e){console.info(e)},i=function(e){console.error(e)},n=new WebAssembly.Memory({initial:250}),r={cc:Kx,wasi_snapshot_preview1:{fd_close:t,fd_seek:t,fd_write:t},env:{memory:n}};return new Promise((function(t){fetch(e).then((function(e){e.arrayBuffer().then((function(e){!function(e){WebAssembly.instantiate(e,r).then((function(e){var i=e.instance.exports;Object.assign(Yx,i),t()}),i)}(e)}),i)}),i)}))}console.info("[Physics][Bullet]: Using asmjs Bullet libs.");var s=Kx,a={};a.buffer=new ArrayBuffer(16384e3),s.memory=a;var o=e(s,a);return Object.assign(Yx,o),new Promise((function(e){e()}))}))}globalThis.Bullet=Yx,Yx.BODY_CACHE_NAME="body",Wx.onPostInfrastructureInitDelegate.add(qx)}}}));